Skip to content

Commit

Permalink
minor refactoring per suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosmiceli committed Oct 3, 2024
1 parent f0c2b2a commit 7622e11
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
3 changes: 2 additions & 1 deletion src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const signupQualifiers = {
INDIVIDUAL: 'individual',
VSB: 'vsb',
SMB: 'smb',
};
} as const;

const onboardingEmployerOrSubmitMessage: OnboardingMessageType = {
message: 'Getting paid back is as easy as sending a message. Let’s go over the basics.',
Expand Down Expand Up @@ -4469,6 +4469,7 @@ const CONST = {

WELCOME_VIDEO_URL: `${CLOUDFRONT_URL}/videos/intro-1280.mp4`,

QUALIFIER_PARAM: 'signupQualifier',
ONBOARDING_INTRODUCTION: 'Let’s get you set up 🔧',
ONBOARDING_CHOICES: {...onboardingChoices},
SELECTABLE_ONBOARDING_CHOICES: {...selectableOnboardingChoices},
Expand Down
7 changes: 3 additions & 4 deletions src/libs/Navigation/AppNavigator/AuthScreens.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,9 @@ function AuthScreens({session, lastOpenedPublicRoomID, initialLastUpdateIDApplie
}

let signupQualifier;
if (currentUrl.includes('signupQualifier')) {
signupQualifier = new URL(currentUrl).searchParams.get('signupQualifier');
}
if (signupQualifier) {
if (currentUrl.includes(CONST.QUALIFIER_PARAM)) {
signupQualifier = new URL(currentUrl).searchParams.get(CONST.QUALIFIER_PARAM);

if (signupQualifier === CONST.ONBOARDING_SIGNUP_QUALIFIERS.INDIVIDUAL) {
Welcome.setOnboardingCustomChoices([CONST.ONBOARDING_CHOICES.PERSONAL_SPEND, CONST.ONBOARDING_CHOICES.EMPLOYER, CONST.ONBOARDING_CHOICES.CHAT_SPLIT]);
}
Expand Down
2 changes: 1 addition & 1 deletion src/libs/actions/Welcome/OnboardingFlow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ function startOnboardingFlow() {

function getOnboardingInitialPath(): string {
const state = getStateFromPath(onboardingInitialPath, linkingConfig.config);
const showBusinessModal = onboardingValues && 'signupQualifier' in onboardingValues && onboardingValues.signupQualifier === CONST.ONBOARDING_SIGNUP_QUALIFIERS.VSB;
const showBusinessModal = onboardingValues && CONST.QUALIFIER_PARAM in onboardingValues && onboardingValues.signupQualifier === CONST.ONBOARDING_SIGNUP_QUALIFIERS.VSB;

if (showBusinessModal) {
return `/${ROUTES.ONBOARDING_WORK.route}`;
Expand Down
4 changes: 2 additions & 2 deletions src/pages/OnboardingWork/BaseOnboardingWork.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function BaseOnboardingWork({shouldUseNativeStyles, route}: BaseOnboardingWorkPr
const {inputCallbackRef} = useAutoFocusInput();
const {isOffline} = useNetwork();

const vsbOnboarding = onboardingValues && 'signupQualifier' in onboardingValues && onboardingValues.signupQualifier === CONST.ONBOARDING_SIGNUP_QUALIFIERS.VSB;
const isVsbOnboarding = onboardingValues && CONST.QUALIFIER_PARAM in onboardingValues && onboardingValues.signupQualifier === CONST.ONBOARDING_SIGNUP_QUALIFIERS.VSB;

const completeEngagement = useCallback(
(values: FormOnyxValues<'onboardingWorkForm'>) => {
Expand Down Expand Up @@ -82,7 +82,7 @@ function BaseOnboardingWork({shouldUseNativeStyles, route}: BaseOnboardingWorkPr
style={[styles.defaultModalContainer, shouldUseNativeStyles && styles.pt8]}
>
<HeaderWithBackButton
shouldShowBackButton={!vsbOnboarding}
shouldShowBackButton={!isVsbOnboarding}
progressBarPercentage={onboardingPurposeSelected === CONST.ONBOARDING_CHOICES.MANAGE_TEAM ? 50 : 75}
onBackButtonPress={OnboardingFlow.goBack}
/>
Expand Down
5 changes: 4 additions & 1 deletion src/types/onyx/Onboarding.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import type {ValueOf} from 'type-fest';
import type CONST from '@src/CONST';

/** Model of onboarding */
type Onboarding = {
/** ID of the report used to display the onboarding checklist message */
Expand All @@ -7,7 +10,7 @@ type Onboarding = {
hasCompletedGuidedSetupFlow: boolean;

/** A string that informs which qualifier the user selected during sign up */
signupQualifier: string;
signupQualifier: ValueOf<typeof CONST.ONBOARDING_SIGNUP_QUALIFIERS>;
};

export default Onboarding;

0 comments on commit 7622e11

Please sign in to comment.