From ad6007b63983e276c05113bfb2ce57adf7d092e4 Mon Sep 17 00:00:00 2001 From: Sibtain Ali Date: Mon, 4 Nov 2024 01:10:11 +0500 Subject: [PATCH] onboarding flow without errors --- src/ONYXKEYS.ts | 3 + src/ROUTES.ts | 8 + src/SCREENS.ts | 2 + .../ValidateCodeForm/BaseValidateCodeForm.tsx | 24 +-- src/hooks/useOnboardingFlow.ts | 10 +- src/languages/en.ts | 10 ++ src/languages/es.ts | 10 ++ src/languages/params.ts | 6 + .../parameters/JoinAccessiblePolicyParams.ts | 5 + ...idateUserAndGetAccessiblePoliciesParams.ts | 5 + src/libs/API/parameters/index.ts | 2 + src/libs/API/types.ts | 5 + .../Navigators/OnboardingModalNavigator.tsx | 10 ++ src/libs/Navigation/NavigationRoot.tsx | 5 +- src/libs/Navigation/linkingConfig/config.ts | 8 + src/libs/Navigation/types.ts | 6 + src/libs/NavigationUtils.ts | 2 + src/libs/actions/Policy/Member.ts | 33 +++- src/libs/actions/User.ts | 32 ++++ src/libs/actions/Welcome/OnboardingFlow.ts | 11 +- .../BaseOnboardingPersonalDetails.tsx | 27 +++- .../BaseOnboardingPrivateDomain.tsx | 94 +++++++++++ .../OnboardingPrivateDomain/index.native.tsx | 17 ++ src/pages/OnboardingPrivateDomain/index.tsx | 26 +++ src/pages/OnboardingPrivateDomain/types.ts | 15 ++ .../BaseOnboardingPurpose.tsx | 23 ++- .../BaseOnboardingWorkspaces.tsx | 149 ++++++++++++++++++ .../OnboardingWorkspaces/index.native.tsx | 17 ++ src/pages/OnboardingWorkspaces/index.tsx | 26 +++ src/pages/OnboardingWorkspaces/types.ts | 15 ++ .../ValidateCodeForm/BaseValidateCodeForm.tsx | 31 ++-- src/pages/signin/ValidateCodeForm/types.ts | 2 + src/types/onyx/JoinablePolicies.ts | 32 ++++ src/types/onyx/index.ts | 2 + 34 files changed, 635 insertions(+), 38 deletions(-) create mode 100644 src/libs/API/parameters/JoinAccessiblePolicyParams.ts create mode 100644 src/libs/API/parameters/ValidateUserAndGetAccessiblePoliciesParams.ts create mode 100644 src/pages/OnboardingPrivateDomain/BaseOnboardingPrivateDomain.tsx create mode 100644 src/pages/OnboardingPrivateDomain/index.native.tsx create mode 100644 src/pages/OnboardingPrivateDomain/index.tsx create mode 100644 src/pages/OnboardingPrivateDomain/types.ts create mode 100644 src/pages/OnboardingWorkspaces/BaseOnboardingWorkspaces.tsx create mode 100644 src/pages/OnboardingWorkspaces/index.native.tsx create mode 100644 src/pages/OnboardingWorkspaces/index.tsx create mode 100644 src/pages/OnboardingWorkspaces/types.ts create mode 100644 src/types/onyx/JoinablePolicies.ts diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 7d3d0edef36e..bc2791c8ce32 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -104,6 +104,8 @@ const ONYXKEYS = { /** Store the information of magic code */ VALIDATE_ACTION_CODE: 'validate_action_code', + KEY_JOINABLE_POLICIES: 'keyJoinablePolicies', + /** Information about the current session (authToken, accountID, email, loading, error) */ SESSION: 'session', STASHED_SESSION: 'stashedSession', @@ -907,6 +909,7 @@ type OnyxValuesMapping = { [ONYXKEYS.LOGIN_LIST]: OnyxTypes.LoginList; [ONYXKEYS.PENDING_CONTACT_ACTION]: OnyxTypes.PendingContactAction; [ONYXKEYS.VALIDATE_ACTION_CODE]: OnyxTypes.ValidateMagicCodeAction; + [ONYXKEYS.KEY_JOINABLE_POLICIES]: OnyxTypes.JoinablePolicies; [ONYXKEYS.SESSION]: OnyxTypes.Session; [ONYXKEYS.USER_METADATA]: OnyxTypes.UserMetadata; [ONYXKEYS.STASHED_SESSION]: OnyxTypes.Session; diff --git a/src/ROUTES.ts b/src/ROUTES.ts index 45501bf46374..d3e022a678f8 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -1325,6 +1325,10 @@ const ROUTES = { route: 'onboarding/personal-details', getRoute: (backTo?: string) => getUrlWithBackToParam(`onboarding/personal-details`, backTo), }, + ONBOARDING_PRIVATE_DOMAIN: { + route: 'onboarding/private-domain', + getRoute: (backTo?: string) => getUrlWithBackToParam(`onboarding/private-domain`, backTo), + }, ONBOARDING_EMPLOYEES: { route: 'onboarding/employees', getRoute: (backTo?: string) => getUrlWithBackToParam(`onboarding/employees`, backTo), @@ -1337,6 +1341,10 @@ const ROUTES = { route: 'onboarding/purpose', getRoute: (backTo?: string) => getUrlWithBackToParam(`onboarding/purpose`, backTo), }, + ONBOARDING_WORKSPACES: { + route: 'onboarding/workspaces', + getRoute: (backTo?: string) => getUrlWithBackToParam(`onboarding/workspaces`, backTo), + }, WELCOME_VIDEO_ROOT: 'onboarding/welcome-video', EXPLANATION_MODAL_ROOT: 'onboarding/explanation', diff --git a/src/SCREENS.ts b/src/SCREENS.ts index dea0f028e1a0..75f38569faf7 100644 --- a/src/SCREENS.ts +++ b/src/SCREENS.ts @@ -566,8 +566,10 @@ const SCREENS = { ONBOARDING: { PERSONAL_DETAILS: 'Onboarding_Personal_Details', PURPOSE: 'Onboarding_Purpose', + PRIVATE_DOMAIN: 'Onboarding_Private_Domain', EMPLOYEES: 'Onboarding_Employees', ACCOUNTING: 'Onboarding_Accounting', + WORKSPACES: 'Onboarding_Workspaces', }, WELCOME_VIDEO: { diff --git a/src/components/ValidateCodeActionModal/ValidateCodeForm/BaseValidateCodeForm.tsx b/src/components/ValidateCodeActionModal/ValidateCodeForm/BaseValidateCodeForm.tsx index cc2a7314f570..a02f3365cf96 100644 --- a/src/components/ValidateCodeActionModal/ValidateCodeForm/BaseValidateCodeForm.tsx +++ b/src/components/ValidateCodeActionModal/ValidateCodeForm/BaseValidateCodeForm.tsx @@ -63,6 +63,9 @@ type ValidateCodeFormProps = { /** Function to clear error of the form */ clearError: () => void; + /** Whether to show the verify button (hidden in private domain onboarding) */ + hideButton?: boolean; + /** Function is called when validate code modal is mounted and on magic code resend */ sendValidateCode: () => void; }; @@ -78,6 +81,7 @@ function BaseValidateCodeForm({ clearError, sendValidateCode, buttonStyles, + hideButton, }: ValidateCodeFormProps) { const {translate} = useLocalize(); const {isOffline} = useNetwork(); @@ -259,15 +263,17 @@ function BaseValidateCodeForm({ onClose={() => clearError()} style={buttonStyles} > -