From b3690f8c849b2d410501a4f59c790440202ba003 Mon Sep 17 00:00:00 2001 From: Antony Kithinzi Date: Tue, 7 Jan 2025 23:33:40 +0100 Subject: [PATCH 1/3] fix: displaying control price in user's local currency if no feature is selected --- src/languages/en.ts | 3 ++- src/languages/es.ts | 3 ++- src/pages/workspace/upgrade/GenericFeaturesView.tsx | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index 3f17099c452e..62a72033d7fa 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -200,6 +200,7 @@ import type { WorkspaceLockedPlanTypeParams, WorkspaceMemberList, WorkspaceOwnerWillNeedToAddOrUpdatePaymentCardParams, + WorkspacePriceParams, WorkspaceYouMayJoin, YourPlanPriceParams, ZipCodeExampleFormatParams, @@ -4382,7 +4383,7 @@ const translations = { title: 'Upgrade to the Control plan', note: 'Unlock our most powerful features, including:', benefits: { - note: 'The Control plan starts at $9 per active member per month.', + note: ({price}: WorkspacePriceParams) => `The Control plan starts at ${price} per active member per month.`, learnMore: 'Learn more', pricing: 'about our plans and pricing.', benefit1: 'Advanced accounting connections (NetSuite, Sage Intacct, and more)', diff --git a/src/languages/es.ts b/src/languages/es.ts index 3de91d7d2a71..5d396476d2c3 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -200,6 +200,7 @@ import type { WorkspaceLockedPlanTypeParams, WorkspaceMemberList, WorkspaceOwnerWillNeedToAddOrUpdatePaymentCardParams, + WorkspacePriceParams, WorkspaceYouMayJoin, YourPlanPriceParams, ZipCodeExampleFormatParams, @@ -4448,7 +4449,7 @@ const translations = { title: 'Mejorar al plan Controlar', note: 'Desbloquea nuestras funciones más potentes, incluyendo:', benefits: { - note: 'El plan Controlar comienza desde $9 por miembro activo al mes.', + note: ({price}: WorkspacePriceParams) => `El plan Controlar comienza desde ${price} por miembro activo al mes.`, learnMore: 'Más información', pricing: 'sobre nuestros planes y precios.', benefit1: 'Conexiones avanzadas de contabilidad (NetSuite, Sage Intacct y más)', diff --git a/src/pages/workspace/upgrade/GenericFeaturesView.tsx b/src/pages/workspace/upgrade/GenericFeaturesView.tsx index c181af37f483..aa07710ec56f 100644 --- a/src/pages/workspace/upgrade/GenericFeaturesView.tsx +++ b/src/pages/workspace/upgrade/GenericFeaturesView.tsx @@ -15,9 +15,10 @@ type GenericFeaturesViewProps = { buttonDisabled?: boolean; loading?: boolean; onUpgrade: () => void; + formattedPrice: string; }; -function GenericFeaturesView({onUpgrade, buttonDisabled, loading}: GenericFeaturesViewProps) { +function GenericFeaturesView({onUpgrade, buttonDisabled, loading, formattedPrice}: GenericFeaturesViewProps) { const styles = useThemeStyles(); const {translate} = useLocalize(); const {isExtraSmallScreenWidth} = useResponsiveLayout(); @@ -51,7 +52,7 @@ function GenericFeaturesView({onUpgrade, buttonDisabled, loading}: GenericFeatur ))} - {translate('workspace.upgrade.commonFeatures.benefits.note')}{' '} + {translate('workspace.upgrade.commonFeatures.benefits.note', {price: formattedPrice})}{' '} Navigation.navigate(ROUTES.SETTINGS_SUBSCRIPTION)} From 7295de653a8d6876bfb061d5dfbceb5f1d1b1ca7 Mon Sep 17 00:00:00 2001 From: Antony Kithinzi Date: Tue, 7 Jan 2025 23:34:55 +0100 Subject: [PATCH 2/3] getting upgrade price from UpgradIntro.tsx --- src/pages/workspace/upgrade/UpgradeIntro.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/pages/workspace/upgrade/UpgradeIntro.tsx b/src/pages/workspace/upgrade/UpgradeIntro.tsx index a13519c87ad0..d61a617353f7 100644 --- a/src/pages/workspace/upgrade/UpgradeIntro.tsx +++ b/src/pages/workspace/upgrade/UpgradeIntro.tsx @@ -39,10 +39,11 @@ function UpgradeIntro({feature, onUpgrade, buttonDisabled, loading, isCategorizi const preferredCurrency = usePreferredCurrency(); const formattedPrice = React.useMemo(() => { - const upgradePlan = isCategorizing ? CONST.POLICY.TYPE.TEAM : CONST.POLICY.TYPE.CORPORATE; const upgradeCurrency = Object.hasOwn(CONST.SUBSCRIPTION_PRICES, preferredCurrency) ? preferredCurrency : CONST.PAYMENT_CARD_CURRENCY.USD; - const upgradePrice = CONST.SUBSCRIPTION_PRICES[upgradeCurrency][upgradePlan][CONST.SUBSCRIPTION.TYPE.ANNUAL]; - return `${convertToShortDisplayString(upgradePrice, upgradeCurrency)} `; + return convertToShortDisplayString( + CONST.SUBSCRIPTION_PRICES[upgradeCurrency][isCategorizing ? CONST.POLICY.TYPE.TEAM : CONST.POLICY.TYPE.CORPORATE][CONST.SUBSCRIPTION.TYPE.ANNUAL], + upgradeCurrency, + ); }, [preferredCurrency, isCategorizing]); if (!feature) { @@ -50,6 +51,7 @@ function UpgradeIntro({feature, onUpgrade, buttonDisabled, loading, isCategorizi ); @@ -87,7 +89,7 @@ function UpgradeIntro({feature, onUpgrade, buttonDisabled, loading, isCategorizi {translate(feature.description)} {translate(`workspace.upgrade.${feature.id}.onlyAvailableOnPlan`)} - {formattedPrice} + {`${formattedPrice} `} {translate(`workspace.upgrade.pricing.perActiveMember`)} From a8ed8ba422de3c2589dea1733d21ebe84038a7db Mon Sep 17 00:00:00 2001 From: Antony Kithinzi Date: Wed, 8 Jan 2025 00:06:21 +0100 Subject: [PATCH 3/3] created WorkspacePriceParams --- src/languages/params.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/languages/params.ts b/src/languages/params.ts index 969706eeeb2f..b52c16d4a62e 100644 --- a/src/languages/params.ts +++ b/src/languages/params.ts @@ -294,6 +294,8 @@ type AccountOwnerParams = {accountOwnerEmail: string}; type ExportedToIntegrationParams = {label: string; markedManually?: boolean; inProgress?: boolean; lastModified?: string}; +type WorkspacePriceParams = {price: string}; + type IntegrationsMessageParams = { label: string; result: { @@ -724,6 +726,7 @@ export type { ReportArchiveReasonsClosedParams, ReportArchiveReasonsMergedParams, ReportPolicyNameParams, + WorkspacePriceParams, ReportArchiveReasonsInvoiceReceiverPolicyDeletedParams, ReportArchiveReasonsRemovedFromPolicyParams, RequestAmountParams,