Skip to content
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

feat: add employee and accounting page to onboarding flow #49161

Merged
merged 61 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from 55 commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
accc8a1
feat: add employee and accounting page to onboarding flow
nkdengineer Sep 13, 2024
419f7cc
fix ts error
nkdengineer Sep 13, 2024
88dda39
Merge branch 'main' into fix/48745
nkdengineer Sep 16, 2024
6bdf7ed
add OnboadingListItem
nkdengineer Sep 16, 2024
e0bc748
fix test
nkdengineer Sep 16, 2024
de74800
add offline indicator and fix ts bug
nkdengineer Sep 16, 2024
5f75726
Merge branch 'main' into fix/48745
nkdengineer Sep 17, 2024
a37009d
fix the font-size issue
nkdengineer Sep 17, 2024
d72dec2
decrease spacing between title and description
nkdengineer Sep 17, 2024
2200305
Merge branch 'main' into fix/48745
nkdengineer Sep 18, 2024
646fc6d
Update src/pages/OnboardingEmployees/index.tsx
nkdengineer Sep 18, 2024
b7b016f
Update src/pages/OnboardingAccounting/index.tsx
nkdengineer Sep 18, 2024
6964f34
call completeOnboarding API
nkdengineer Sep 18, 2024
def4389
fix ts error
nkdengineer Sep 18, 2024
b923dab
Merge branch 'main' into fix/48745
nkdengineer Sep 18, 2024
b1e8c24
move the type to CONST
nkdengineer Sep 18, 2024
f8ff1f5
remove OnboardingListItem
nkdengineer Sep 18, 2024
a773766
remove onboardingIcon type
nkdengineer Sep 18, 2024
a50ce47
remove unused style
nkdengineer Sep 18, 2024
c9b6a0b
fix lint
nkdengineer Sep 18, 2024
0d6adac
merge main
nkdengineer Sep 19, 2024
13f4da9
add type and refactor style
nkdengineer Sep 19, 2024
944b3d3
Merge branch 'main' into fix/48745
nkdengineer Sep 20, 2024
1a67914
change firstname and lastname as optional
nkdengineer Sep 20, 2024
497a35e
migrate to useOnyx
nkdengineer Sep 20, 2024
ced0874
remove withOnyx
nkdengineer Sep 20, 2024
41de3e1
Merge branch 'main' into fix/48745
nkdengineer Sep 20, 2024
d417b6a
remove unnecessary code
nkdengineer Sep 20, 2024
c6c8cbc
Update src/SCREENS.ts
nkdengineer Sep 20, 2024
11f3a4a
Merge branch 'main' into fix/48745
nkdengineer Sep 23, 2024
465ffbc
Update src/CONST.ts
nkdengineer Sep 23, 2024
d3121d6
Update src/pages/OnboardingAccounting/BaseOnboardingAccounting.tsx
nkdengineer Sep 23, 2024
f72f134
refactor code
nkdengineer Sep 23, 2024
076d4af
Merge branch 'fix/48745' of https://github.com/nkdengineer/App into f…
nkdengineer Sep 23, 2024
ccfa4e1
fix type error
nkdengineer Sep 23, 2024
a1201d2
remove unnecessary prop
nkdengineer Sep 23, 2024
91bbbaf
Merge branch 'main' into fix/48745
nkdengineer Sep 24, 2024
63a5932
remove unused style
nkdengineer Sep 24, 2024
34f74ad
fix lint
nkdengineer Sep 24, 2024
fb70a3f
add style prop for list item
nkdengineer Sep 24, 2024
bdf3a08
Merge branch 'main' into fix/48745
nkdengineer Sep 25, 2024
d0be895
remove unnecessary prop
nkdengineer Sep 25, 2024
5e61daf
add pl8 and pr8 style
nkdengineer Sep 25, 2024
d8b71b0
Merge branch 'main' into fix/48745
nkdengineer Sep 27, 2024
0057cb1
resolve conflict
nkdengineer Oct 2, 2024
939c169
merge main
nkdengineer Oct 2, 2024
97e41e8
fix ts error
nkdengineer Oct 2, 2024
556b83f
merge main
nkdengineer Oct 8, 2024
fe9d9b5
remove description translation
nkdengineer Oct 8, 2024
9a1c414
Merge branch 'main' into fix/48745
nkdengineer Oct 8, 2024
8706f60
update translation
nkdengineer Oct 8, 2024
74631ed
Merge branch 'main' into fix/48745
nkdengineer Oct 8, 2024
4516b4d
update confirm button to continue button
nkdengineer Oct 8, 2024
aab3ad8
fix ts error
nkdengineer Oct 8, 2024
9985e88
remove unused variable
nkdengineer Oct 8, 2024
7bba26c
Merge branch 'main' into fix/48745
nkdengineer Oct 9, 2024
7fb12f0
remove onboaring work
nkdengineer Oct 9, 2024
433261c
merge main
nkdengineer Oct 9, 2024
f806fde
remove import type
nkdengineer Oct 9, 2024
3584504
merge main
nkdengineer Oct 10, 2024
bd6b524
merge main
nkdengineer Oct 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -4481,6 +4493,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 @@ -5835,6 +5848,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;
6 changes: 5 additions & 1 deletion 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 @@ -960,6 +963,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
8 changes: 8 additions & 0 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1167,6 +1167,14 @@ const ROUTES = {
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',
getRoute: (backTo?: string) => getUrlWithBackToParam(`onboarding/purpose`, backTo),
Expand Down
2 changes: 2 additions & 0 deletions src/SCREENS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,8 @@ const SCREENS = {
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 @@ -1723,9 +1723,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 @@ -1734,6 +1734,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 @@ -1723,9 +1723,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 @@ -1734,6 +1734,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,6 +9,8 @@ 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';
Expand Down Expand Up @@ -55,6 +57,14 @@ function OnboardingModalNavigator() {
name={SCREENS.ONBOARDING.WORK}
component={OnboardingWork}
/>
<Stack.Screen
name={SCREENS.ONBOARDING.EMPLOYEES}
component={OnboardingEmployees}
/>
<Stack.Screen
name={SCREENS.ONBOARDING.ACCOUNTING}
component={OnboardingAccounting}
/>
</Stack.Navigator>
</View>
</FocusTrapForScreens>
Expand Down
8 changes: 8 additions & 0 deletions src/libs/Navigation/linkingConfig/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,14 @@ const config: LinkingOptions<RootStackParamList>['config'] = {
path: ROUTES.ONBOARDING_WORK.route,
exact: true,
},
[SCREENS.ONBOARDING.EMPLOYEES]: {
path: ROUTES.ONBOARDING_EMPLOYEES.route,
exact: true,
},
[SCREENS.ONBOARDING.ACCOUNTING]: {
path: ROUTES.ONBOARDING_ACCOUNTING.route,
exact: true,
},
},
},
[NAVIGATORS.RIGHT_MODAL_NAVIGATOR]: {
Expand Down
6 changes: 6 additions & 0 deletions src/libs/Navigation/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1390,6 +1390,12 @@ type OnboardingModalNavigatorParamList = {
[SCREENS.ONBOARDING.WORK]: {
backTo?: string;
};
[SCREENS.ONBOARDING.EMPLOYEES]: {
backTo?: string;
};
[SCREENS.ONBOARDING.ACCOUNTING]: {
backTo?: string;
};
};

type WelcomeVideoModalNavigatorParamList = {
Expand Down
9 changes: 8 additions & 1 deletion src/libs/NavigationUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,14 @@ 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.WORK,
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
Loading