From b9e9716e8d0d784fe6c17cc4dac68340e0326789 Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Tue, 25 Jun 2024 10:37:45 +0700 Subject: [PATCH 1/3] feature: Add deeplinks to workspace editor in the onboarding checklist tasks --- src/CONST.ts | 12 ++++++------ src/libs/actions/Report.ts | 2 ++ .../BaseOnboardingPersonalDetails.tsx | 12 +++++++++++- src/pages/OnboardingPersonalDetails/types.ts | 2 ++ 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/CONST.ts b/src/CONST.ts index 45fb1da9328c..9ec046a3f9e9 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -3917,13 +3917,13 @@ const CONST = { type: 'setupCategories', autoCompleted: false, title: 'Set up categories', - description: + description: ({workspaceLink}: {workspaceLink: string}) => '*Set up categories* so your team can code expenses for easy reporting.\n' + '\n' + 'Here’s how to set up categories:\n' + '\n' + '1. Click your profile picture.\n' + - '2. Go to *Workspaces* > [your workspace].\n' + + `2. Go to [*Workspaces* > [your workspace]](${workspaceLink}).\n` + '3. Click *Categories*.\n' + '4. Enable and disable default categories.\n' + '5. Click *Add categories* to make your own.\n' + @@ -3934,13 +3934,13 @@ const CONST = { type: 'addExpenseApprovals', autoCompleted: false, title: 'Add expense approvals', - description: + description: ({workspaceLink}: {workspaceLink: string}) => '*Add expense approvals* to review your team’s spend and keep it under control.\n' + '\n' + 'Here’s how to add expense approvals:\n' + '\n' + '1. Click your profile picture.\n' + - '2. Go to *Workspaces* > [your workspace].\n' + + `2. Go to [*Workspaces* > [your workspace]](${workspaceLink}).\n` + '3. Click *More features*.\n' + '4. Enable *Workflows*.\n' + '5. In *Workflows*, enable *Add approvals*.\n' + @@ -3951,13 +3951,13 @@ const CONST = { type: 'inviteTeam', autoCompleted: false, title: 'Invite your team', - description: + description: ({workspaceLink}: {workspaceLink: string}) => '*Invite your team* to Expensify so they can start tracking expenses today.\n' + '\n' + 'Here’s how to invite your team:\n' + '\n' + '1. Click your profile picture.\n' + - '2. Go to *Workspaces* > [your workspace].\n' + + `2. Go to [*Workspaces* > [your workspace]](${workspaceLink}).\n` + '3. Click *Members* > *Invite member*.\n' + '4. Enter emails or phone numbers. \n' + '5. Add an invite message if you want.\n' + diff --git a/src/libs/actions/Report.ts b/src/libs/actions/Report.ts index f0f85c8f01f3..a0b67cfd8a6d 100644 --- a/src/libs/actions/Report.ts +++ b/src/libs/actions/Report.ts @@ -3143,6 +3143,7 @@ function completeOnboarding( lastName: string; }, adminsChatReportID?: string, + onboardingPolicyID?: string, ) { const isAccountIDOdd = AccountUtils.isAccountIDOddNumber(currentUserAccountID ?? 0); const targetEmail = isAccountIDOdd ? CONST.EMAIL.NOTIFICATIONS : CONST.EMAIL.CONCIERGE; @@ -3186,6 +3187,7 @@ function completeOnboarding( typeof task.description === 'function' ? task.description({ adminsRoomLink: `${CONFIG.EXPENSIFY.NEW_EXPENSIFY_URL}${ROUTES.REPORT_WITH_ID.getRoute(adminsChatReportID ?? '-1')}`, + workspaceLink: `${CONFIG.EXPENSIFY.NEW_EXPENSIFY_URL}${ROUTES.WORKSPACE_INITIAL.getRoute(onboardingPolicyID ?? '-1')}`, }) : task.description; const currentTask = ReportUtils.buildOptimisticTaskReport( diff --git a/src/pages/OnboardingPersonalDetails/BaseOnboardingPersonalDetails.tsx b/src/pages/OnboardingPersonalDetails/BaseOnboardingPersonalDetails.tsx index ba90def232d5..15b2c82fa6e6 100644 --- a/src/pages/OnboardingPersonalDetails/BaseOnboardingPersonalDetails.tsx +++ b/src/pages/OnboardingPersonalDetails/BaseOnboardingPersonalDetails.tsx @@ -31,7 +31,13 @@ import ROUTES from '@src/ROUTES'; import INPUT_IDS from '@src/types/form/DisplayNameForm'; import type {BaseOnboardingPersonalDetailsOnyxProps, BaseOnboardingPersonalDetailsProps} from './types'; -function BaseOnboardingPersonalDetails({currentUserPersonalDetails, shouldUseNativeStyles, onboardingPurposeSelected, onboardingAdminsChatReportID}: BaseOnboardingPersonalDetailsProps) { +function BaseOnboardingPersonalDetails({ + currentUserPersonalDetails, + shouldUseNativeStyles, + onboardingPurposeSelected, + onboardingAdminsChatReportID, + onboardingPolicyID, +}: BaseOnboardingPersonalDetailsProps) { const styles = useThemeStyles(); const {translate} = useLocalize(); const {isSmallScreenWidth} = useWindowDimensions(); @@ -61,6 +67,7 @@ function BaseOnboardingPersonalDetails({currentUserPersonalDetails, shouldUseNat lastName, }, onboardingAdminsChatReportID ?? undefined, + onboardingPolicyID, ); Welcome.setOnboardingAdminsChatReportID(); @@ -194,5 +201,8 @@ export default withCurrentUserPersonalDetails( onboardingAdminsChatReportID: { key: ONYXKEYS.ONBOARDING_ADMINS_CHAT_REPORT_ID, }, + onboardingPolicyID: { + key: ONYXKEYS.ONBOARDING_POLICY_ID, + }, })(BaseOnboardingPersonalDetails), ); diff --git a/src/pages/OnboardingPersonalDetails/types.ts b/src/pages/OnboardingPersonalDetails/types.ts index a89fe5ff8df7..267e70de2322 100644 --- a/src/pages/OnboardingPersonalDetails/types.ts +++ b/src/pages/OnboardingPersonalDetails/types.ts @@ -10,6 +10,8 @@ type BaseOnboardingPersonalDetailsOnyxProps = { /** Saved onboarding admin chat report ID */ onboardingAdminsChatReportID: OnyxEntry; + + onboardingPolicyID: OnyxEntry; }; type BaseOnboardingPersonalDetailsProps = WithCurrentUserPersonalDetailsProps & From c4d7fb4f32587f49b2e7022506f408059588c443 Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Wed, 26 Jun 2024 15:20:30 +0700 Subject: [PATCH 2/3] fix lint --- .../OnboardingPersonalDetails/BaseOnboardingPersonalDetails.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/OnboardingPersonalDetails/BaseOnboardingPersonalDetails.tsx b/src/pages/OnboardingPersonalDetails/BaseOnboardingPersonalDetails.tsx index 15b2c82fa6e6..f5bd14ed7aa1 100644 --- a/src/pages/OnboardingPersonalDetails/BaseOnboardingPersonalDetails.tsx +++ b/src/pages/OnboardingPersonalDetails/BaseOnboardingPersonalDetails.tsx @@ -91,7 +91,7 @@ function BaseOnboardingPersonalDetails({ Navigation.navigate(ROUTES.WELCOME_VIDEO_ROOT); }, variables.welcomeVideoDelay); }, - [isSmallScreenWidth, onboardingPurposeSelected, onboardingAdminsChatReportID, accountID], + [onboardingPurposeSelected, onboardingAdminsChatReportID, onboardingPolicyID, isSmallScreenWidth, accountID], ); const validate = (values: FormOnyxValues<'onboardingPersonalDetailsForm'>) => { From b6cb57fa0f632d72197c55af093e92676ead49fb Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Wed, 3 Jul 2024 21:50:41 +0700 Subject: [PATCH 3/3] add comment --- src/pages/OnboardingPersonalDetails/types.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/OnboardingPersonalDetails/types.ts b/src/pages/OnboardingPersonalDetails/types.ts index 267e70de2322..ccd4d3a52254 100644 --- a/src/pages/OnboardingPersonalDetails/types.ts +++ b/src/pages/OnboardingPersonalDetails/types.ts @@ -11,6 +11,7 @@ type BaseOnboardingPersonalDetailsOnyxProps = { /** Saved onboarding admin chat report ID */ onboardingAdminsChatReportID: OnyxEntry; + /** Saved onboarding policy ID */ onboardingPolicyID: OnyxEntry; };