Skip to content

Commit

Permalink
Merge pull request #49161 from nkdengineer/fix/48745
Browse files Browse the repository at this point in the history
feat: add employee and accounting page to onboarding flow
  • Loading branch information
marcaaron authored Oct 10, 2024
2 parents 0984f7d + bd6b524 commit 476d112
Show file tree
Hide file tree
Showing 39 changed files with 553 additions and 225 deletions.
28 changes: 27 additions & 1 deletion src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,24 @@ const onboardingEmployerOrSubmitMessage: OnboardingMessageType = {

type OnboardingPurposeType = ValueOf<typeof onboardingChoices>;

type OnboardingCompanySizeType = ValueOf<typeof onboardingCompanySize>;

type OnboardingAccountingType = ValueOf<typeof CONST.POLICY.CONNECTIONS.NAME> | null;

const onboardingInviteTypes = {
IOU: 'iou',
INVOICE: 'invoice',
CHAT: 'chat',
} as const;

const onboardingCompanySize = {
MICRO: '1-10',
SMALL: '11-50',
MEDIUM_SMALL: '51-100',
MEDIUM: '101-1000',
LARGE: '1001+',
} as const;

type OnboardingInviteType = ValueOf<typeof onboardingInviteTypes>;

type OnboardingTaskType = {
Expand Down Expand Up @@ -4488,6 +4500,7 @@ const CONST = {
SELECTABLE_ONBOARDING_CHOICES: {...selectableOnboardingChoices},
ONBOARDING_SIGNUP_QUALIFIERS: {...signupQualifiers},
ONBOARDING_INVITE_TYPES: {...onboardingInviteTypes},
ONBOARDING_COMPANY_SIZE: {...onboardingCompanySize},
ACTIONABLE_TRACK_EXPENSE_WHISPER_MESSAGE: 'What would you like to do with this expense?',
ONBOARDING_CONCIERGE: {
[onboardingChoices.EMPLOYER]:
Expand Down Expand Up @@ -5842,6 +5855,19 @@ type FeedbackSurveyOptionID = ValueOf<Pick<ValueOf<typeof CONST.FEEDBACK_SURVEY_
type SubscriptionType = ValueOf<typeof CONST.SUBSCRIPTION.TYPE>;
type CancellationType = ValueOf<typeof CONST.CANCELLATION_TYPE>;

export type {Country, IOUAction, IOUType, RateAndUnit, OnboardingPurposeType, IOURequestType, SubscriptionType, FeedbackSurveyOptionID, CancellationType, OnboardingInviteType};
export type {
Country,
IOUAction,
IOUType,
RateAndUnit,
OnboardingPurposeType,
OnboardingCompanySizeType,
IOURequestType,
SubscriptionType,
FeedbackSurveyOptionID,
CancellationType,
OnboardingInviteType,
OnboardingAccountingType,
};

export default CONST;
9 changes: 5 additions & 4 deletions src/ONYXKEYS.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type {ValueOf} from 'type-fest';
import type CONST from './CONST';
import type {OnboardingPurposeType} from './CONST';
import type {OnboardingCompanySizeType, OnboardingPurposeType} from './CONST';
import type * as FormTypes from './types/form';
import type * as OnyxTypes from './types/onyx';
import type Onboarding from './types/onyx/Onboarding';
Expand Down Expand Up @@ -342,6 +342,9 @@ const ONYXKEYS = {
/** Onboarding policyID selected by the user during Onboarding flow */
ONBOARDING_POLICY_ID: 'onboardingPolicyID',

/** Onboarding company size selected by the user during Onboarding flow */
ONBOARDING_COMPANY_SIZE: 'onboardingCompanySize',

/** Onboarding Purpose selected by the user during Onboarding flow */
ONBOARDING_ADMINS_CHAT_REPORT_ID: 'onboardingAdminsChatReportID',

Expand Down Expand Up @@ -557,8 +560,6 @@ const ONYXKEYS = {
DISPLAY_NAME_FORM_DRAFT: 'displayNameFormDraft',
ONBOARDING_PERSONAL_DETAILS_FORM: 'onboardingPersonalDetailsForm',
ONBOARDING_PERSONAL_DETAILS_FORM_DRAFT: 'onboardingPersonalDetailsFormDraft',
ONBOARDING_PERSONAL_WORK: 'onboardingWorkForm',
ONBOARDING_PERSONAL_WORK_DRAFT: 'onboardingWorkFormDraft',
ROOM_NAME_FORM: 'roomNameForm',
ROOM_NAME_FORM_DRAFT: 'roomNameFormDraft',
REPORT_DESCRIPTION_FORM: 'reportDescriptionForm',
Expand Down Expand Up @@ -721,7 +722,6 @@ type OnyxFormValuesMapping = {
[ONYXKEYS.FORMS.PROFILE_SETTINGS_FORM]: FormTypes.ProfileSettingsForm;
[ONYXKEYS.FORMS.DISPLAY_NAME_FORM]: FormTypes.DisplayNameForm;
[ONYXKEYS.FORMS.ONBOARDING_PERSONAL_DETAILS_FORM]: FormTypes.DisplayNameForm;
[ONYXKEYS.FORMS.ONBOARDING_PERSONAL_WORK]: FormTypes.WorkForm;
[ONYXKEYS.FORMS.ROOM_NAME_FORM]: FormTypes.RoomNameForm;
[ONYXKEYS.FORMS.REPORT_DESCRIPTION_FORM]: FormTypes.ReportDescriptionForm;
[ONYXKEYS.FORMS.LEGAL_NAME_FORM]: FormTypes.LegalNameForm;
Expand Down Expand Up @@ -960,6 +960,7 @@ type OnyxValuesMapping = {
[ONYXKEYS.MAX_CANVAS_HEIGHT]: number;
[ONYXKEYS.MAX_CANVAS_WIDTH]: number;
[ONYXKEYS.ONBOARDING_PURPOSE_SELECTED]: OnboardingPurposeType;
[ONYXKEYS.ONBOARDING_COMPANY_SIZE]: OnboardingCompanySizeType;
[ONYXKEYS.ONBOARDING_CUSTOM_CHOICES]: OnboardingPurposeType[] | [];
[ONYXKEYS.ONBOARDING_ERROR_MESSAGE]: string;
[ONYXKEYS.ONBOARDING_POLICY_ID]: string;
Expand Down
10 changes: 7 additions & 3 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1179,9 +1179,13 @@ const ROUTES = {
route: 'onboarding/personal-details',
getRoute: (backTo?: string) => getUrlWithBackToParam(`onboarding/personal-details`, backTo),
},
ONBOARDING_WORK: {
route: 'onboarding/work',
getRoute: (backTo?: string) => getUrlWithBackToParam(`onboarding/work`, backTo),
ONBOARDING_EMPLOYEES: {
route: 'onboarding/employees',
getRoute: (backTo?: string) => getUrlWithBackToParam(`onboarding/employees`, backTo),
},
ONBOARDING_ACCOUNTING: {
route: 'onboarding/accounting',
getRoute: (backTo?: string) => getUrlWithBackToParam(`onboarding/accounting`, backTo),
},
ONBOARDING_PURPOSE: {
route: 'onboarding/purpose',
Expand Down
3 changes: 2 additions & 1 deletion src/SCREENS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,8 @@ const SCREENS = {
ONBOARDING: {
PERSONAL_DETAILS: 'Onboarding_Personal_Details',
PURPOSE: 'Onboarding_Purpose',
WORK: 'Onboarding_Work',
EMPLOYEES: 'Onboarding_Employees',
ACCOUNTING: 'Onboarding_Accounting',
},

WELCOME_VIDEO: {
Expand Down
2 changes: 1 addition & 1 deletion src/components/ContextMenuItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ function ContextMenuItem(
title={itemText}
icon={itemIcon}
onPress={triggerPressAndUpdateSuccess}
wrapperStyle={[styles.pr9, wrapperStyle]}
wrapperStyle={[styles.pr8, wrapperStyle]}
success={!isThrottledButtonActive}
description={description}
descriptionTextStyle={styles.breakWord}
Expand Down
2 changes: 2 additions & 0 deletions src/components/SelectionList/BaseSelectionList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ function BaseSelectionList<TItem extends ListItem>(
onLongPressRow,
shouldShowTextInput = !!textInputLabel || !!textInputIconLeft,
shouldShowListEmptyContent = true,
listItemWrapperStyle,
shouldIgnoreFocus = false,
scrollEventThrottle,
contentContainerStyle,
Expand Down Expand Up @@ -475,6 +476,7 @@ function BaseSelectionList<TItem extends ListItem>(
setFocusedIndex(normalizedIndex);
}}
shouldSyncFocus={!isTextInputFocusedRef.current}
wrapperStyle={listItemWrapperStyle}
/>
{item.footerContent && item.footerContent}
</>
Expand Down
3 changes: 2 additions & 1 deletion src/components/SelectionList/RadioListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ function RadioListItem<TItem extends ListItem>({
alternateTextNumberOfLines = 2,
onFocus,
shouldSyncFocus,
wrapperStyle,
}: RadioListItemProps<TItem>) {
const styles = useThemeStyles();
const fullTitle = isMultilineSupported ? item.text?.trimStart() : item.text;
Expand All @@ -31,7 +32,7 @@ function RadioListItem<TItem extends ListItem>({
return (
<BaseListItem
item={item}
wrapperStyle={[styles.flex1, styles.justifyContentBetween, styles.sidebarLinkInner, styles.userSelectNone, styles.optionRow, isFocused && styles.sidebarLinkActive]}
wrapperStyle={[styles.flex1, styles.justifyContentBetween, styles.sidebarLinkInner, styles.userSelectNone, styles.optionRow, isFocused && styles.sidebarLinkActive, wrapperStyle]}
isFocused={isFocused}
isDisabled={isDisabled}
showTooltip={showTooltip}
Expand Down
3 changes: 3 additions & 0 deletions src/components/SelectionList/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,9 @@ type BaseSelectionListProps<TItem extends ListItem> = Partial<ChildrenProps> & {
/** Whether to show the empty list content */
shouldShowListEmptyContent?: boolean;

/** The style is applied for the wrap component of list item */
listItemWrapperStyle?: StyleProp<ViewStyle>;

/** Scroll event throttle for preventing onScroll callbacks to be fired too often */
scrollEventThrottle?: number;

Expand Down
14 changes: 13 additions & 1 deletion src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1724,9 +1724,9 @@ const translations = {
getStarted: 'Get started',
whatsYourName: "What's your name?",
whereYouWork: 'Where do you work?',
errorSelection: 'Please make a selection to continue.',
purpose: {
title: 'What do you want to do today?',
errorSelection: 'Please make a selection to continue.',
errorContinue: 'Please press continue to get set up.',
errorBackButton: 'Please finish the setup questions to start using the app.',
[CONST.ONBOARDING_CHOICES.EMPLOYER]: 'Get paid back by my employer',
Expand All @@ -1735,6 +1735,18 @@ const translations = {
[CONST.ONBOARDING_CHOICES.CHAT_SPLIT]: 'Chat and split expenses with friends',
[CONST.ONBOARDING_CHOICES.LOOKING_AROUND]: 'Something else',
},
employees: {
title: 'How many employees do you have?',
[CONST.ONBOARDING_COMPANY_SIZE.MICRO]: '1-10 employees',
[CONST.ONBOARDING_COMPANY_SIZE.SMALL]: '11-50 employees',
[CONST.ONBOARDING_COMPANY_SIZE.MEDIUM_SMALL]: '51-100 employees',
[CONST.ONBOARDING_COMPANY_SIZE.MEDIUM]: '101-1,000 employees',
[CONST.ONBOARDING_COMPANY_SIZE.LARGE]: 'More than 1,000 employees',
},
accounting: {
title: 'Do you use any accounting software?',
noneOfAbove: 'None of the above',
},
error: {
requiredFirstName: 'Please input your first name to continue.',
},
Expand Down
14 changes: 13 additions & 1 deletion src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1724,9 +1724,9 @@ const translations = {
getStarted: 'Comenzar',
whatsYourName: '¿Cómo te llamas?',
whereYouWork: '¿Dónde trabajas?',
errorSelection: 'Por favor selecciona una opción para continuar.',
purpose: {
title: '¿Qué quieres hacer hoy?',
errorSelection: 'Por favor selecciona una opción para continuar.',
errorContinue: 'Por favor, haz click en continuar para configurar tu cuenta.',
errorBackButton: 'Por favor, finaliza las preguntas de configuración para empezar a utilizar la aplicación.',
[CONST.ONBOARDING_CHOICES.EMPLOYER]: 'Cobrar de mi empresa',
Expand All @@ -1735,6 +1735,18 @@ const translations = {
[CONST.ONBOARDING_CHOICES.CHAT_SPLIT]: 'Chatea y divide gastos con tus amigos',
[CONST.ONBOARDING_CHOICES.LOOKING_AROUND]: 'Algo más',
},
employees: {
title: '¿Cuántos empleados tienes?',
[CONST.ONBOARDING_COMPANY_SIZE.MICRO]: '1-10 empleados',
[CONST.ONBOARDING_COMPANY_SIZE.SMALL]: '11-50 empleados',
[CONST.ONBOARDING_COMPANY_SIZE.MEDIUM_SMALL]: '51-100 empleados',
[CONST.ONBOARDING_COMPANY_SIZE.MEDIUM]: '101-1,000 empleados',
[CONST.ONBOARDING_COMPANY_SIZE.LARGE]: 'Más de 1,000 empleados',
},
accounting: {
title: '¿Utilizas algún software de contabilidad?',
noneOfAbove: 'Ninguno de los anteriores',
},
error: {
requiredFirstName: 'Introduce tu nombre para continuar.',
},
Expand Down
4 changes: 3 additions & 1 deletion src/libs/API/parameters/CompleteGuidedSetupParams.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type {OnboardingPurposeType} from '@src/CONST';
import type {OnboardingAccountingType, OnboardingCompanySizeType, OnboardingPurposeType} from '@src/CONST';

type CompleteGuidedSetupParams = {
firstName: string;
Expand All @@ -7,6 +7,8 @@ type CompleteGuidedSetupParams = {
guidedSetupData: string;
engagementChoice: OnboardingPurposeType;
paymentSelected?: string;
companySize?: OnboardingCompanySizeType;
userReportedIntegration?: OnboardingAccountingType;
};

export default CompleteGuidedSetupParams;
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ import useThemeStyles from '@hooks/useThemeStyles';
import OnboardingModalNavigatorScreenOptions from '@libs/Navigation/AppNavigator/OnboardingModalNavigatorScreenOptions';
import type {OnboardingModalNavigatorParamList} from '@libs/Navigation/types';
import OnboardingRefManager from '@libs/OnboardingRefManager';
import OnboardingAccounting from '@pages/OnboardingAccounting';
import OnboardingEmployees from '@pages/OnboardingEmployees';
import OnboardingPersonalDetails from '@pages/OnboardingPersonalDetails';
import OnboardingPurpose from '@pages/OnboardingPurpose';
import OnboardingWork from '@pages/OnboardingWork';
import CONST from '@src/CONST';
import SCREENS from '@src/SCREENS';
import Overlay from './Overlay';
Expand Down Expand Up @@ -52,8 +53,12 @@ function OnboardingModalNavigator() {
component={OnboardingPersonalDetails}
/>
<Stack.Screen
name={SCREENS.ONBOARDING.WORK}
component={OnboardingWork}
name={SCREENS.ONBOARDING.EMPLOYEES}
component={OnboardingEmployees}
/>
<Stack.Screen
name={SCREENS.ONBOARDING.ACCOUNTING}
component={OnboardingAccounting}
/>
</Stack.Navigator>
</View>
Expand Down
8 changes: 6 additions & 2 deletions src/libs/Navigation/linkingConfig/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,12 @@ const config: LinkingOptions<RootStackParamList>['config'] = {
path: ROUTES.ONBOARDING_PERSONAL_DETAILS.route,
exact: true,
},
[SCREENS.ONBOARDING.WORK]: {
path: ROUTES.ONBOARDING_WORK.route,
[SCREENS.ONBOARDING.EMPLOYEES]: {
path: ROUTES.ONBOARDING_EMPLOYEES.route,
exact: true,
},
[SCREENS.ONBOARDING.ACCOUNTING]: {
path: ROUTES.ONBOARDING_ACCOUNTING.route,
exact: true,
},
},
Expand Down
5 changes: 4 additions & 1 deletion src/libs/Navigation/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1396,7 +1396,10 @@ type OnboardingModalNavigatorParamList = {
[SCREENS.ONBOARDING.PURPOSE]: {
backTo?: string;
};
[SCREENS.ONBOARDING.WORK]: {
[SCREENS.ONBOARDING.EMPLOYEES]: {
backTo?: string;
};
[SCREENS.ONBOARDING.ACCOUNTING]: {
backTo?: string;
};
};
Expand Down
8 changes: 7 additions & 1 deletion src/libs/NavigationUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@ const CENTRAL_PANE_SCREEN_NAMES = new Set([
SCREENS.REPORT,
]);

const ONBOARDING_SCREEN_NAMES = new Set([SCREENS.ONBOARDING.PERSONAL_DETAILS, SCREENS.ONBOARDING.PURPOSE, SCREENS.ONBOARDING.WORK, SCREENS.ONBOARDING_MODAL.ONBOARDING]);
const ONBOARDING_SCREEN_NAMES = new Set([
SCREENS.ONBOARDING.PERSONAL_DETAILS,
SCREENS.ONBOARDING.PURPOSE,
SCREENS.ONBOARDING_MODAL.ONBOARDING,
SCREENS.ONBOARDING.EMPLOYEES,
SCREENS.ONBOARDING.ACCOUNTING,
]);

const removePolicyIDParamFromState = (state: State<RootStackParamList>) => {
const stateCopy = cloneDeep(state);
Expand Down
10 changes: 1 addition & 9 deletions src/libs/actions/IOU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7562,15 +7562,7 @@ function completePaymentOnboarding(paymentSelected: ValueOf<typeof CONST.PAYMENT
onboardingPurpose = CONST.ONBOARDING_CHOICES.CHAT_SPLIT;
}

Report.completeOnboarding(
onboardingPurpose,
CONST.ONBOARDING_MESSAGES[onboardingPurpose],
{
firstName: personalDetails?.firstName ?? '',
lastName: personalDetails?.lastName ?? '',
},
paymentSelected,
);
Report.completeOnboarding(onboardingPurpose, CONST.ONBOARDING_MESSAGES[onboardingPurpose], personalDetails?.firstName ?? '', personalDetails?.lastName ?? '', paymentSelected);
}

function payMoneyRequest(paymentType: PaymentMethodType, chatReport: OnyxTypes.Report, iouReport: OnyxEntry<OnyxTypes.Report>, full = true) {
Expand Down
Loading

0 comments on commit 476d112

Please sign in to comment.