0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-03-24 22:41:28 -05:00

refactor(console): update usage-based feature beta tip for org feature (#5117)

This commit is contained in:
Xiao Yijun 2023-12-19 11:44:51 +08:00 committed by GitHub
parent 5256da26ea
commit bb4632e0e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 85 additions and 3 deletions

View file

@ -7,12 +7,48 @@ import DynamicT from '@/ds-components/DynamicT';
import QuotaValueWrapper from './QuotaValueWrapper';
type Props = {
/**
* Whether the feature is enabled.
* If `undefined`, it means that the feature quota is not determined yet, will display 'Contact us' and other props will be ignored.
*/
isEnabled?: boolean;
/**
* Whether the feature is in beta.
* Often used with the `paymentType` prop.
* - `false`:
* - When `isEnabled` is `true`, it will display a checkmark.
* - When `isEnabled` is `false`, it will display '-'.
* - `true`:
* - when the `paymentType` is `add-on` or `undefined`, it will display 'Add-on (Beta)', or it will display '-'.
* - when the `paymentType` is `usage`, it will display 'Beta'.
*/
isBeta?: boolean;
tipPhraseKey?: TFuncKey<'translation', 'admin_console.subscription.quota_table'>;
/**
* Used with the `isBeta` prop to indicate the payment type of the feature.
*/
paymentType?: 'add-on' | 'usage';
/**
* The tip phrase key to show
*/
tipPhraseKey?: TFuncKey<'translation', 'admin_console.subscription.quota_table'>;
};
/**
* Render a feature flag to indicate whether a feature is enabled or not in the plan comparison table.
* - **For normal features**:
* - If `isEnabled` is `undefined`, it will display 'Contact us'.
* - If `isEnabled` is `true`, it will display a checkmark.
* - **For beta features**:
* - If `isBeta` is `true` and the feature is enabled:
* - If `paymentType` is `add-on` or `undefined`, it will display 'Add-on (Beta)'.
* - If `paymentType` is `usage`, it will display 'Beta'.
* - If `isBeta` is `false` or the feature is disabled: works the same as normal features.
*
* @example
* ```tsx
* <GenericFeatureFlag isEnabled={true} />
* ```
*/
function GenericFeatureFlag({ isEnabled, isBeta, tipPhraseKey, paymentType }: Props) {
if (isEnabled === undefined) {
return <DynamicT forKey="subscription.quota_table.contact" />;

View file

@ -127,8 +127,10 @@ export const quotaValueRenderer: Record<
isEnabled={organizationsEnabled}
// Todo @xiaoyijun [Pricing] Remove feature flag
isBeta={isDevFeaturesEnabled}
// Todo @xiaoyijun [Pricing] Remove feature flag & update usage-based feature tip
tipPhraseKey={cond(isDevFeaturesEnabled && organizationsEnabled && 'beta_feature_tip')}
// Todo @xiaoyijun [Pricing] Remove feature flag
tipPhraseKey={cond(
isDevFeaturesEnabled && organizationsEnabled && 'usage_based_beta_feature_tip'
)}
paymentType="usage"
/>
),

View file

@ -96,6 +96,9 @@ const quota_table = {
beta_feature_tip:
'Free to use during the beta phase. We will begin charging once we finalize the add-on pricing.',
/** UNTRANSLATED */
usage_based_beta_feature_tip:
'Free to use during the beta phase. We will begin charging once we finalize the org usage-based pricing.',
/** UNTRANSLATED */
beta: 'Beta',
/** UNTRANSLATED */
add_on_beta: 'Add-on (Beta)',

View file

@ -84,6 +84,8 @@ const quota_table = {
'We may add charges for features that go beyond your quota limit as add-ons once we finalize the prices.',
beta_feature_tip:
'Free to use during the beta phase. We will begin charging once we finalize the add-on pricing.',
usage_based_beta_feature_tip:
'Free to use during the beta phase. We will begin charging once we finalize the org usage-based pricing.',
beta: 'Beta',
add_on_beta: 'Add-on (Beta)',
};

View file

@ -96,6 +96,9 @@ const quota_table = {
beta_feature_tip:
'Free to use during the beta phase. We will begin charging once we finalize the add-on pricing.',
/** UNTRANSLATED */
usage_based_beta_feature_tip:
'Free to use during the beta phase. We will begin charging once we finalize the org usage-based pricing.',
/** UNTRANSLATED */
beta: 'Beta',
/** UNTRANSLATED */
add_on_beta: 'Add-on (Beta)',

View file

@ -96,6 +96,9 @@ const quota_table = {
beta_feature_tip:
'Free to use during the beta phase. We will begin charging once we finalize the add-on pricing.',
/** UNTRANSLATED */
usage_based_beta_feature_tip:
'Free to use during the beta phase. We will begin charging once we finalize the org usage-based pricing.',
/** UNTRANSLATED */
beta: 'Beta',
/** UNTRANSLATED */
add_on_beta: 'Add-on (Beta)',

View file

@ -96,6 +96,9 @@ const quota_table = {
beta_feature_tip:
'Free to use during the beta phase. We will begin charging once we finalize the add-on pricing.',
/** UNTRANSLATED */
usage_based_beta_feature_tip:
'Free to use during the beta phase. We will begin charging once we finalize the org usage-based pricing.',
/** UNTRANSLATED */
beta: 'Beta',
/** UNTRANSLATED */
add_on_beta: 'Add-on (Beta)',

View file

@ -96,6 +96,9 @@ const quota_table = {
beta_feature_tip:
'Free to use during the beta phase. We will begin charging once we finalize the add-on pricing.',
/** UNTRANSLATED */
usage_based_beta_feature_tip:
'Free to use during the beta phase. We will begin charging once we finalize the org usage-based pricing.',
/** UNTRANSLATED */
beta: 'Beta',
/** UNTRANSLATED */
add_on_beta: 'Add-on (Beta)',

View file

@ -96,6 +96,9 @@ const quota_table = {
beta_feature_tip:
'Free to use during the beta phase. We will begin charging once we finalize the add-on pricing.',
/** UNTRANSLATED */
usage_based_beta_feature_tip:
'Free to use during the beta phase. We will begin charging once we finalize the org usage-based pricing.',
/** UNTRANSLATED */
beta: 'Beta',
/** UNTRANSLATED */
add_on_beta: 'Add-on (Beta)',

View file

@ -96,6 +96,9 @@ const quota_table = {
beta_feature_tip:
'Free to use during the beta phase. We will begin charging once we finalize the add-on pricing.',
/** UNTRANSLATED */
usage_based_beta_feature_tip:
'Free to use during the beta phase. We will begin charging once we finalize the org usage-based pricing.',
/** UNTRANSLATED */
beta: 'Beta',
/** UNTRANSLATED */
add_on_beta: 'Add-on (Beta)',

View file

@ -96,6 +96,9 @@ const quota_table = {
beta_feature_tip:
'Free to use during the beta phase. We will begin charging once we finalize the add-on pricing.',
/** UNTRANSLATED */
usage_based_beta_feature_tip:
'Free to use during the beta phase. We will begin charging once we finalize the org usage-based pricing.',
/** UNTRANSLATED */
beta: 'Beta',
/** UNTRANSLATED */
add_on_beta: 'Add-on (Beta)',

View file

@ -96,6 +96,9 @@ const quota_table = {
beta_feature_tip:
'Free to use during the beta phase. We will begin charging once we finalize the add-on pricing.',
/** UNTRANSLATED */
usage_based_beta_feature_tip:
'Free to use during the beta phase. We will begin charging once we finalize the org usage-based pricing.',
/** UNTRANSLATED */
beta: 'Beta',
/** UNTRANSLATED */
add_on_beta: 'Add-on (Beta)',

View file

@ -96,6 +96,9 @@ const quota_table = {
beta_feature_tip:
'Free to use during the beta phase. We will begin charging once we finalize the add-on pricing.',
/** UNTRANSLATED */
usage_based_beta_feature_tip:
'Free to use during the beta phase. We will begin charging once we finalize the org usage-based pricing.',
/** UNTRANSLATED */
beta: 'Beta',
/** UNTRANSLATED */
add_on_beta: 'Add-on (Beta)',

View file

@ -96,6 +96,9 @@ const quota_table = {
beta_feature_tip:
'Free to use during the beta phase. We will begin charging once we finalize the add-on pricing.',
/** UNTRANSLATED */
usage_based_beta_feature_tip:
'Free to use during the beta phase. We will begin charging once we finalize the org usage-based pricing.',
/** UNTRANSLATED */
beta: 'Beta',
/** UNTRANSLATED */
add_on_beta: 'Add-on (Beta)',

View file

@ -96,6 +96,9 @@ const quota_table = {
beta_feature_tip:
'Free to use during the beta phase. We will begin charging once we finalize the add-on pricing.',
/** UNTRANSLATED */
usage_based_beta_feature_tip:
'Free to use during the beta phase. We will begin charging once we finalize the org usage-based pricing.',
/** UNTRANSLATED */
beta: 'Beta',
/** UNTRANSLATED */
add_on_beta: 'Add-on (Beta)',

View file

@ -96,6 +96,9 @@ const quota_table = {
beta_feature_tip:
'Free to use during the beta phase. We will begin charging once we finalize the add-on pricing.',
/** UNTRANSLATED */
usage_based_beta_feature_tip:
'Free to use during the beta phase. We will begin charging once we finalize the org usage-based pricing.',
/** UNTRANSLATED */
beta: 'Beta',
/** UNTRANSLATED */
add_on_beta: 'Add-on (Beta)',

View file

@ -96,6 +96,9 @@ const quota_table = {
beta_feature_tip:
'Free to use during the beta phase. We will begin charging once we finalize the add-on pricing.',
/** UNTRANSLATED */
usage_based_beta_feature_tip:
'Free to use during the beta phase. We will begin charging once we finalize the org usage-based pricing.',
/** UNTRANSLATED */
beta: 'Beta',
/** UNTRANSLATED */
add_on_beta: 'Add-on (Beta)',