Skip to content

Commit

Permalink
Merge pull request #53343 from jayeshmangwani/ws_downgrade_plan_type_…
Browse files Browse the repository at this point in the history
…page

WS plan type and upgrade common features view Pages
  • Loading branch information
carlosmiceli authored Dec 19, 2024
2 parents 1d33fee + 5f896eb commit 154a485
Show file tree
Hide file tree
Showing 25 changed files with 568 additions and 78 deletions.
1 change: 1 addition & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,7 @@ const CONST = {
MAX_DATE: '9999-12-31',
MIN_DATE: '0001-01-01',
ORDINAL_DAY_OF_MONTH: 'do',
MONTH_DAY_YEAR_ORDINAL_FORMAT: 'MMMM do, yyyy',
},
SMS: {
DOMAIN: '@expensify.sms',
Expand Down
16 changes: 10 additions & 6 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,10 @@ const ROUTES = {
route: 'settings/workspaces/:policyID/profile/address',
getRoute: (policyID: string, backTo?: string) => getUrlWithBackToParam(`settings/workspaces/${policyID}/profile/address` as const, backTo),
},
WORKSPACE_PROFILE_PLAN: {
route: 'settings/workspaces/:policyID/profile/plan',
getRoute: (policyID: string, backTo?: string) => getUrlWithBackToParam(`settings/workspaces/${policyID}/profile/plan` as const, backTo),
},
WORKSPACE_ACCOUNTING: {
route: 'settings/workspaces/:policyID/accounting',
getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting` as const,
Expand Down Expand Up @@ -979,9 +983,9 @@ const ROUTES = {
getRoute: (policyID: string, categoryName: string) => `settings/workspaces/${policyID}/category/${encodeURIComponent(categoryName)}` as const,
},
WORKSPACE_UPGRADE: {
route: 'settings/workspaces/:policyID/upgrade/:featureName',
getRoute: (policyID: string, featureName: string, backTo?: string) =>
getUrlWithBackToParam(`settings/workspaces/${policyID}/upgrade/${encodeURIComponent(featureName)}` as const, backTo),
route: 'settings/workspaces/:policyID/upgrade/:featureName?',
getRoute: (policyID: string, featureName?: string, backTo?: string) =>
getUrlWithBackToParam(`settings/workspaces/${policyID}/upgrade/${encodeURIComponent(featureName ?? '')}` as const, backTo),
},
WORKSPACE_DOWNGRADE: {
route: 'settings/workspaces/:policyID/downgrade/',
Expand Down Expand Up @@ -1162,16 +1166,16 @@ const ROUTES = {
},
WORKSPACE_REPORT_FIELDS_LIST_VALUES: {
route: 'settings/workspaces/:policyID/reportFields/listValues/:reportFieldID?',
getRoute: (policyID: string, reportFieldID?: string) => `settings/workspaces/${policyID}/reportFields/listValues/${encodeURIComponent(reportFieldID ?? '')}` as const,
getRoute: (policyID: string, reportFieldID?: string) => `settings/workspaces/${policyID}/reportFields/listValues/${reportFieldID ? encodeURIComponent(reportFieldID) : ''}` as const,
},
WORKSPACE_REPORT_FIELDS_ADD_VALUE: {
route: 'settings/workspaces/:policyID/reportFields/addValue/:reportFieldID?',
getRoute: (policyID: string, reportFieldID?: string) => `settings/workspaces/${policyID}/reportFields/addValue/${encodeURIComponent(reportFieldID ?? '')}` as const,
getRoute: (policyID: string, reportFieldID?: string) => `settings/workspaces/${policyID}/reportFields/addValue/${reportFieldID ? encodeURIComponent(reportFieldID) : ''}` as const,
},
WORKSPACE_REPORT_FIELDS_VALUE_SETTINGS: {
route: 'settings/workspaces/:policyID/reportFields/:valueIndex/:reportFieldID?',
getRoute: (policyID: string, valueIndex: number, reportFieldID?: string) =>
`settings/workspaces/${policyID}/reportFields/${valueIndex}/${encodeURIComponent(reportFieldID ?? '')}` as const,
`settings/workspaces/${policyID}/reportFields/${valueIndex}/${reportFieldID ? encodeURIComponent(reportFieldID) : ''}` as const,
},
WORKSPACE_REPORT_FIELDS_EDIT_VALUE: {
route: 'settings/workspaces/:policyID/reportFields/new/:valueIndex/edit',
Expand Down
1 change: 1 addition & 0 deletions src/SCREENS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@ const SCREENS = {
TAG_GL_CODE: 'Tag_GL_Code',
CURRENCY: 'Workspace_Profile_Currency',
ADDRESS: 'Workspace_Profile_Address',
PLAN: 'Workspace_Profile_Plan_Type',
WORKFLOWS: 'Workspace_Workflows',
WORKFLOWS_PAYER: 'Workspace_Workflows_Payer',
WORKFLOWS_APPROVALS_NEW: 'Workspace_Approvals_New',
Expand Down
34 changes: 34 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ import type {
WelcomeNoteParams,
WelcomeToRoomParams,
WeSentYouMagicSignInLinkParams,
WorkspaceLockedPlanTypeParams,
WorkspaceMemberList,
WorkspaceOwnerWillNeedToAddOrUpdatePaymentCardParams,
WorkspaceYouMayJoin,
Expand Down Expand Up @@ -2612,6 +2613,7 @@ const translations = {
return 'Member';
}
},
planType: 'Plan type',
submitExpense: 'Submit expenses using your workspace chat below:',
defaultCategory: 'Default category',
},
Expand Down Expand Up @@ -4366,6 +4368,19 @@ const translations = {
moreDetails: 'for more details.',
gotIt: 'Got it, thanks',
},
commonFeatures: {
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.',
learnMore: 'Learn more',
pricing: 'about our plans and pricing.',
benefit1: 'Advanced accounting connections (NetSuite, Sage Intacct, and more)',
benefit2: 'Smart expense rules',
benefit3: 'Multi-level approval workflows',
benefit4: 'Enhanced security controls',
},
},
},
restrictedAction: {
restricted: 'Restricted',
Expand Down Expand Up @@ -4469,6 +4484,25 @@ const translations = {
andEnableWorkflows: 'and enable workflows, then add approvals to unlock this feature.',
},
},
planTypePage: {
planTypes: {
team: {
label: 'Collect',
description: 'For teams looking to automate their processes.',
},
corporate: {
label: 'Control',
description: 'For organizations with advanced requirements.',
},
},
description: "Choose a plan that's right for you. For a detailed list of features and pricing, check out our",
subscriptionLink: 'plan types and pricing help page',
lockedPlanDescription: ({count, annualSubscriptionEndDate}: WorkspaceLockedPlanTypeParams) => ({
one: `You've committed to 1 active member on the Control plan until your annual subscription ends on ${annualSubscriptionEndDate}. You can switch to pay-per-use subscription and downgrade to the Collect plan starting ${annualSubscriptionEndDate} by disabling auto-renew in`,
other: `You've committed to ${count} active members on the Control plan until your annual subscription ends on ${annualSubscriptionEndDate}. You can switch to pay-per-use subscription and downgrade to the Collect plan starting ${annualSubscriptionEndDate} by disabling auto-renew in`,
}),
subscriptions: 'Subscriptions',
},
},
getAssistancePage: {
title: 'Get assistance',
Expand Down
34 changes: 34 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ import type {
WelcomeNoteParams,
WelcomeToRoomParams,
WeSentYouMagicSignInLinkParams,
WorkspaceLockedPlanTypeParams,
WorkspaceMemberList,
WorkspaceOwnerWillNeedToAddOrUpdatePaymentCardParams,
WorkspaceYouMayJoin,
Expand Down Expand Up @@ -2636,6 +2637,7 @@ const translations = {
return 'Miembro';
}
},
planType: 'Tipo de plan',
submitExpense: 'Envíe los gastos utilizando el chat de su espacio de trabajo:',
defaultCategory: 'Categoría predeterminada',
},
Expand Down Expand Up @@ -4333,6 +4335,25 @@ const translations = {
confirmText: 'Sí, exportar de nuevo',
cancelText: 'Cancelar',
},
planTypePage: {
planTypes: {
team: {
label: 'Collect',
description: 'Para equipos que buscan automatizar sus procesos.',
},
corporate: {
label: 'Recolectar',
description: 'Para organizaciones con requisitos avanzados.',
},
},
description: 'Elige el plan adecuado para ti. Para ver una lista detallada de funciones y precios, consulta nuestra',
subscriptionLink: 'página de ayuda sobre tipos de planes y precios',
lockedPlanDescription: ({count, annualSubscriptionEndDate}: WorkspaceLockedPlanTypeParams) => ({
one: `Tienes un compromiso anual de 1 miembro activo en el plan Control hasta el ${annualSubscriptionEndDate}. Puedes cambiar a una suscripción de pago por uso y desmejorar al plan Recopilar a partir del ${annualSubscriptionEndDate} desactivando la renovación automática en`,
other: `Tienes un compromiso anual de ${count} miembros activos en el plan Control hasta el ${annualSubscriptionEndDate}. Puedes cambiar a una suscripción de pago por uso y desmejorar al plan Recopilar a partir del ${annualSubscriptionEndDate} desactivando la renovación automática en`,
}),
subscriptions: 'Suscripciones',
},
upgrade: {
reportFields: {
title: 'Los campos',
Expand Down Expand Up @@ -4414,6 +4435,19 @@ const translations = {
moreDetails: 'para obtener más información.',
gotIt: 'Entendido, gracias.',
},
commonFeatures: {
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.',
learnMore: 'Más información',
pricing: 'sobre nuestros planes y precios.',
benefit1: 'Conexiones avanzadas de contabilidad (NetSuite, Sage Intacct y más)',
benefit2: 'Reglas inteligentes de gastos',
benefit3: 'Flujos de aprobación de varios niveles',
benefit4: 'Controles de seguridad mejorados',
},
},
},
restrictedAction: {
restricted: 'Restringido',
Expand Down
6 changes: 6 additions & 0 deletions src/languages/params.ts
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,11 @@ type CurrencyCodeParams = {
currencyCode: string;
};

type WorkspaceLockedPlanTypeParams = {
count: number;
annualSubscriptionEndDate: string;
};

type CompanyNameParams = {
companyName: string;
};
Expand Down Expand Up @@ -789,6 +794,7 @@ export type {
WorkspaceMemberList,
ImportPerDiemRatesSuccessfullDescriptionParams,
CurrencyCodeParams,
WorkspaceLockedPlanTypeParams,
CompanyNameParams,
CustomUnitRateParams,
ChatWithAccountManagerParams,
Expand Down
5 changes: 5 additions & 0 deletions src/libs/API/parameters/OpenWorkspacePlanPage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
type OpenWorkspacePlanPageParams = {
policyID: string;
};

export default OpenWorkspacePlanPageParams;
2 changes: 1 addition & 1 deletion src/libs/API/parameters/UpgradeToCorporateParams.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
type UpgradeToCorporateParams = {
policyID: string;
featureName: string;
featureName?: string;
};

export default UpgradeToCorporateParams;
1 change: 1 addition & 0 deletions src/libs/API/parameters/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,4 +356,5 @@ export type {default as JoinAccessiblePolicyParams} from './JoinAccessiblePolicy
export type {default as ImportPerDiemRatesParams} from './ImportPerDiemRatesParams';
export type {default as ExportPerDiemCSVParams} from './ExportPerDiemCSVParams';
export type {default as DismissProductTrainingParams} from './DismissProductTraining';
export type {default as OpenWorkspacePlanPageParams} from './OpenWorkspacePlanPage';
export type {default as ResetSMSDeliveryFailureParams} from './ResetSMSDeliveryFailureParams';
2 changes: 2 additions & 0 deletions src/libs/API/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -958,6 +958,7 @@ const READ_COMMANDS = {
START_ISSUE_NEW_CARD_FLOW: 'StartIssueNewCardFlow',
OPEN_CARD_DETAILS_PAGE: 'OpenCardDetailsPage',
GET_ASSIGNED_SUPPORT_DATA: 'GetAssignedSupportData',
OPEN_WORKSPACE_PLAN_PAGE: 'OpenWorkspacePlanPage',
} as const;

type ReadCommand = ValueOf<typeof READ_COMMANDS>;
Expand Down Expand Up @@ -1021,6 +1022,7 @@ type ReadCommandParameters = {
[READ_COMMANDS.START_ISSUE_NEW_CARD_FLOW]: Parameters.StartIssueNewCardFlowParams;
[READ_COMMANDS.OPEN_CARD_DETAILS_PAGE]: Parameters.OpenCardDetailsPageParams;
[READ_COMMANDS.GET_ASSIGNED_SUPPORT_DATA]: Parameters.GetAssignedSupportDataParams;
[READ_COMMANDS.OPEN_WORKSPACE_PLAN_PAGE]: Parameters.OpenWorkspacePlanPageParams;
};

const SIDE_EFFECT_REQUEST_COMMANDS = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ const SettingsModalStackNavigator = createModalStackNavigator<SettingsNavigatorP
[SCREENS.WORKSPACE.CURRENCY]: () => require<ReactComponentModule>('../../../../pages/workspace/WorkspaceProfileCurrencyPage').default,
[SCREENS.WORKSPACE.CATEGORY_SETTINGS]: () => require<ReactComponentModule>('../../../../pages/workspace/categories/CategorySettingsPage').default,
[SCREENS.WORKSPACE.ADDRESS]: () => require<ReactComponentModule>('../../../../pages/workspace/WorkspaceProfileAddressPage').default,
[SCREENS.WORKSPACE.PLAN]: () => require<ReactComponentModule>('../../../../pages/workspace/WorkspaceProfilePlanTypePage').default,
[SCREENS.WORKSPACE.CATEGORIES_SETTINGS]: () => require<ReactComponentModule>('../../../../pages/workspace/categories/WorkspaceCategoriesSettingsPage').default,
[SCREENS.WORKSPACE.CATEGORIES_IMPORT]: () => require<ReactComponentModule>('../../../../pages/workspace/categories/ImportCategoriesPage').default,
[SCREENS.WORKSPACE.CATEGORIES_IMPORTED]: () => require<ReactComponentModule>('../../../../pages/workspace/categories/ImportedCategoriesPage').default,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const FULL_SCREEN_TO_RHP_MAPPING: Partial<Record<FullScreenName, string[]>> = {
[SCREENS.WORKSPACE.PROFILE]: [
SCREENS.WORKSPACE.NAME,
SCREENS.WORKSPACE.ADDRESS,
SCREENS.WORKSPACE.PLAN,
SCREENS.WORKSPACE.CURRENCY,
SCREENS.WORKSPACE.DESCRIPTION,
SCREENS.WORKSPACE.SHARE,
Expand Down
3 changes: 3 additions & 0 deletions src/libs/Navigation/linkingConfig/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,9 @@ const config: LinkingOptions<RootStackParamList>['config'] = {
[SCREENS.WORKSPACE.ADDRESS]: {
path: ROUTES.WORKSPACE_PROFILE_ADDRESS.route,
},
[SCREENS.WORKSPACE.PLAN]: {
path: ROUTES.WORKSPACE_PROFILE_PLAN.route,
},
[SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_IMPORT]: {path: ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_IMPORT.route},
[SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_CHART_OF_ACCOUNTS]: {path: ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_CHART_OF_ACCOUNTS.route},
[SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_CLASSES]: {path: ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_CLASSES.route},
Expand Down
2 changes: 1 addition & 1 deletion src/libs/Navigation/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ type SettingsNavigatorParamList = {
};
[SCREENS.WORKSPACE.UPGRADE]: {
policyID: string;
featureName: string;
featureName?: string;
backTo?: Routes;
categoryId?: string;
};
Expand Down
11 changes: 10 additions & 1 deletion src/libs/Permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function canUseCategoryAndTagApprovers(betas: OnyxEntry<Beta[]>): boolean {
function canUseCombinedTrackSubmit(): boolean {
// We don't need to show this to all betas since this will be used for developing a feature for A/B testing.
const session = SessionUtils.getSession();
return isAccountIDEven(session?.accountID ?? -1);
return isAccountIDEven(session?.accountID ?? CONST.DEFAULT_NUMBER_ID);
}

function canUsePerDiem(betas: OnyxEntry<Beta[]>): boolean {
Expand All @@ -47,6 +47,14 @@ function canUseLinkPreviews(): boolean {
return false;
}

/**
* Workspace downgrade is temporarily disabled
* API is being integrated in this GH issue https://github.com/Expensify/App/issues/51494
*/
function canUseWorkspaceDowngrade() {
return false;
}

export default {
canUseDefaultRooms,
canUseLinkPreviews,
Expand All @@ -55,5 +63,6 @@ export default {
canUseCombinedTrackSubmit,
canUseCategoryAndTagApprovers,
canUsePerDiem,
canUseWorkspaceDowngrade,
shouldShowProductTrainingElements,
};
Loading

0 comments on commit 154a485

Please sign in to comment.