Repository navigation
Add trackExpensesWithConcierge onboarding RHP variant #85762
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
4a5d679
0c68b3c
eb81921
82411f3
6f9f74e
f9ab3dc
2f5f252
7a26abd
d67590d
e23f976
1439fbd
04a3d5c
24f4af9
ec10be6
34eb46d
757b33f
f9e8b4e
dcb89b2
2e56631
d318b29
c49db33
c7542e8
4cce0a7
1cfec5d
b3df0cc
65ee42d
214b607
f4e39d6
8fdcdec
caf9cf3
d1e4cec
bc7b877
85bec38
25fb304
158ebe1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,6 @@ | ||
| type ShouldOpenRHPVariant = () => boolean; | ||
| type HandleRHPVariantNavigation = (onboardingPolicyID?: string) => void; | ||
| import type {OnboardingRHPVariant} from '@src/types/onyx'; | ||
|
|
||
| type ShouldOpenRHPVariant = (variantOverride?: OnboardingRHPVariant | null) => boolean; | ||
| type HandleRHPVariantNavigation = (onboardingPolicyID?: string, variantOverride?: OnboardingRHPVariant | null) => void; | ||
|
|
||
| export type {ShouldOpenRHPVariant, HandleRHPVariantNavigation}; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,18 @@ | ||
| import {hasSeenTourSelector} from '@selectors/Onboarding'; | ||
| import {useCallback, useMemo} from 'react'; | ||
| import type {OnyxCollection} from 'react-native-onyx'; | ||
| import isSidePanelReportSupported from '@components/SidePanel/isSidePanelReportSupported'; | ||
| import Log from '@libs/Log'; | ||
| import {navigateAfterOnboardingWithMicrotaskQueue} from '@libs/navigateAfterOnboarding'; | ||
| import {createDisplayName} from '@libs/PersonalDetailsUtils'; | ||
| import {isPaidGroupPolicy, isPolicyAdmin} from '@libs/PolicyUtils'; | ||
| import {createWorkspace, generatePolicyID, newGenerateDefaultWorkspaceName} from '@userActions/Policy/Policy'; | ||
| import {completeOnboarding} from '@userActions/Report'; | ||
| import {completeOnboarding, extractRHPVariantFromResponse} from '@userActions/Report'; | ||
| import {setOnboardingAdminsChatReportID, setOnboardingPolicyID} from '@userActions/Welcome'; | ||
| import CONST from '@src/CONST'; | ||
| import ONYXKEYS from '@src/ONYXKEYS'; | ||
| import {lastWorkspaceNumberSelector} from '@src/selectors/Policy'; | ||
| import type {OnboardingPurpose, Policy} from '@src/types/onyx'; | ||
| import type {OnboardingPurpose, OnboardingRHPVariant, Policy} from '@src/types/onyx'; | ||
| import useArchivedReportsIdSet from './useArchivedReportsIdSet'; | ||
| import useCurrentUserPersonalDetails from './useCurrentUserPersonalDetails'; | ||
| import useHasActiveAdminPolicies from './useHasActiveAdminPolicies'; | ||
|
|
@@ -67,7 +69,7 @@ function useAutoCreateTrackWorkspace() { | |
| const mergedAccountConciergeReportID = !onboardingValues?.shouldRedirectToClassicAfterMerge && onboardingValues?.shouldValidate ? conciergeChatReportID : undefined; | ||
|
|
||
| const autoCreateTrackWorkspace = useCallback( | ||
| (firstName: string, lastName: string, onboardingPurposeSelected: OnboardingPurpose) => { | ||
| async (firstName: string, lastName: string, onboardingPurposeSelected: OnboardingPurpose) => { | ||
| const shouldCreateWorkspace = !isRestrictedPolicyCreation && !onboardingPolicyID && !hasPaidGroupAdminPolicy; | ||
| const displayName = createDisplayName(session?.email ?? '', {firstName, lastName}, formatPhoneNumber); | ||
|
|
||
|
|
@@ -93,30 +95,43 @@ function useAutoCreateTrackWorkspace() { | |
| }) | ||
| : {adminsChatReportID: onboardingAdminsChatReportID, policyID: onboardingPolicyID}; | ||
|
|
||
| completeOnboarding({ | ||
| engagementChoice: CONST.ONBOARDING_CHOICES.TRACK_WORKSPACE, | ||
| onboardingMessage: onboardingMessages[CONST.ONBOARDING_CHOICES.TRACK_WORKSPACE], | ||
| firstName, | ||
| lastName, | ||
| adminsChatReportID: newAdminsChatReportID, | ||
| onboardingPolicyID: newPolicyID, | ||
| introSelected, | ||
| isSelfTourViewed, | ||
| betas, | ||
| }); | ||
| // On mobile, hardcode trackExpensesWithConcierge since the web flow already works | ||
| // with the CompleteGuidedSetup response and side panel isn't supported on native. | ||
| let rhpVariant: OnboardingRHPVariant | undefined = isSidePanelReportSupported ? undefined : CONST.ONBOARDING_RHP_VARIANT.TRACK_EXPENSES_WITH_CONCIERGE; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Useful? React with 👍 / 👎.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That’s fine for now, as |
||
| try { | ||
| const response = await completeOnboarding({ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change introduced a regression, fixed in #89904. While awaiting |
||
| engagementChoice: CONST.ONBOARDING_CHOICES.TRACK_WORKSPACE, | ||
| onboardingMessage: onboardingMessages[CONST.ONBOARDING_CHOICES.TRACK_WORKSPACE], | ||
| firstName, | ||
| lastName, | ||
| adminsChatReportID: newAdminsChatReportID, | ||
| onboardingPolicyID: newPolicyID, | ||
| shouldWaitForRHPVariantInitialization: isSidePanelReportSupported, | ||
| introSelected, | ||
| isSelfTourViewed, | ||
| betas, | ||
| }); | ||
|
|
||
| setOnboardingAdminsChatReportID(); | ||
| setOnboardingPolicyID(); | ||
| if (isSidePanelReportSupported) { | ||
| rhpVariant = extractRHPVariantFromResponse(response); | ||
| } | ||
| } catch (error) { | ||
| Log.warn('[useAutoCreateTrackWorkspace] Error completing onboarding', {error}); | ||
| } finally { | ||
| setOnboardingAdminsChatReportID(); | ||
| setOnboardingPolicyID(); | ||
|
|
||
| navigateAfterOnboardingWithMicrotaskQueue( | ||
| isSmallScreenWidth, | ||
| isBetaEnabled(CONST.BETAS.DEFAULT_ROOMS), | ||
| conciergeChatReportID, | ||
| archivedReportsIdSet, | ||
| newPolicyID, | ||
| mergedAccountConciergeReportID, | ||
| false, | ||
| ); | ||
| navigateAfterOnboardingWithMicrotaskQueue( | ||
| isSmallScreenWidth, | ||
| isBetaEnabled(CONST.BETAS.DEFAULT_ROOMS), | ||
| conciergeChatReportID, | ||
| archivedReportsIdSet, | ||
| newPolicyID, | ||
| mergedAccountConciergeReportID, | ||
| false, | ||
| rhpVariant, | ||
| ); | ||
| } | ||
| }, | ||
| [ | ||
| session?.email, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ CONSISTENCY-6 (docs)
The callback was changed from synchronous (fire-and-forget) to
asyncwithawait completeOnboarding(...), but there is no try/catch around this critical API call. If the request fails, the subsequentsetOnboardingAdminsChatReportID(),setOnboardingPolicyID(), andnavigateAfterOnboardingWithMicrotaskQueue()calls will never execute, silently leaving the user stuck in the onboarding flow.Note that
BaseOnboardingInterestedFeatures.tsxalready wraps the sameawait completeOnboarding(...)call in a try/catch withLog.warn. Apply the same pattern here:Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MelvinBot please do above change and add catch
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done — wrapped the completeOnboarding call in a try/catch with Log.warn, matching the pattern in BaseOnboardingInterestedFeatures.tsx. Also used the new shared extractRHPVariantFromResponse helper.