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

Open
wants to merge 36 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
36 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
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 @@ -130,12 +130,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+',
};
nkdengineer marked this conversation as resolved.
Show resolved Hide resolved

type OnboardingInviteType = ValueOf<typeof onboardingInviteTypes>;

type OnboardingTaskType = {
Expand Down Expand Up @@ -4445,6 +4457,7 @@ const CONST = {
ONBOARDING_CHOICES: {...onboardingChoices},
SELECTABLE_ONBOARDING_CHOICES: {...selectableOnboardingChoices},
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 @@ -5765,6 +5778,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 @@ -343,6 +343,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 @@ -947,6 +950,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_ERROR_MESSAGE]: string;
[ONYXKEYS.ONBOARDING_POLICY_ID]: string;
[ONYXKEYS.ONBOARDING_ADMINS_CHAT_REPORT_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 @@ -1125,6 +1125,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 @@ -509,6 +509,8 @@ const SCREENS = {
PERSONAL_DETAILS: 'Onboarding_Personal_Details',
PURPOSE: 'Onboarding_Purpose',
WORK: 'Onboarding_Work',
EMPLOYEES: 'Onboarding_Employees',
ACCOUNTING: 'Onboarding_accounting',
nkdengineer marked this conversation as resolved.
Show resolved Hide resolved
},

WELCOME_VIDEO: {
Expand Down
13 changes: 13 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1631,6 +1631,19 @@ export default {
[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?',
description: 'Connect your accounting software directly to Expensify',
noneOfAbove: 'None of the above',
},
error: {
requiredFirstName: 'Please input your first name to continue.',
},
Expand Down
13 changes: 13 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1639,6 +1639,19 @@ export default {
[CONST.ONBOARDING_CHOICES.CHAT_SPLIT]: 'Chatea y divide gastos con tus amigos',
[CONST.ONBOARDING_CHOICES.LOOKING_AROUND]: 'Algo más',
},
employees: {
title: 'How many empleados do you have?',
[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]: 'More than 1,000 empleados',
},
accounting: {
title: 'Do you use any accounting software?',
description: 'Connect your accounting software directly to Expensify',
noneOfAbove: 'None of the above',
},
Comment on lines +1644 to +1656
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marcaaron Should we confirm these copies on this PR or will complete on the next PR?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already confirmed. We need translations though.

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 @@ -12,6 +12,8 @@ import OnboardingModalNavigatorScreenOptions from '@libs/Navigation/AppNavigator
import Navigation from '@libs/Navigation/Navigation';
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 @@ -87,6 +89,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 @@ -1313,6 +1313,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
6 changes: 5 additions & 1 deletion src/libs/actions/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ import {doesReportBelongToWorkspace} from '@libs/ReportUtils';
import shouldSkipDeepLinkNavigation from '@libs/shouldSkipDeepLinkNavigation';
import Visibility from '@libs/Visibility';
import CONFIG from '@src/CONFIG';
import type {OnboardingPurposeType} from '@src/CONST';
import type {OnboardingAccountingType, OnboardingCompanySizeType, OnboardingPurposeType} from '@src/CONST';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type {Route} from '@src/ROUTES';
Expand Down Expand Up @@ -3341,6 +3341,8 @@ function completeOnboarding(
adminsChatReportID?: string,
onboardingPolicyID?: string,
paymentSelected?: string,
companySize?: OnboardingCompanySizeType,
userReportedIntegration?: OnboardingAccountingType,
) {
const actorAccountID = CONST.ACCOUNT_ID.CONCIERGE;
const targetChatReport = ReportUtils.getChatByParticipants([actorAccountID, currentUserAccountID]);
Expand Down Expand Up @@ -3687,6 +3689,8 @@ function completeOnboarding(
actorAccountID,
guidedSetupData: JSON.stringify(guidedSetupData),
paymentSelected,
companySize,
userReportedIntegration,
};

API.write(WRITE_COMMANDS.COMPLETE_GUIDED_SETUP, parameters, {optimisticData, successData, failureData});
Expand Down
4 changes: 2 additions & 2 deletions src/libs/actions/Welcome/OnboardingFlow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function adaptOnboardingRouteState() {
}

let adaptedOnboardingModalNavigatorState = {} as Readonly<PartialState<NavigationState>>;
if (currentRoute?.name === SCREENS.ONBOARDING.PERSONAL_DETAILS && selectedPurpose === CONST.ONBOARDING_CHOICES.MANAGE_TEAM) {
if (currentRoute?.name === SCREENS.ONBOARDING.ACCOUNTING && selectedPurpose === CONST.ONBOARDING_CHOICES.MANAGE_TEAM) {
adaptedOnboardingModalNavigatorState = {
index: 2,
routes: [
Expand All @@ -61,7 +61,7 @@ function adaptOnboardingRouteState() {
params: currentRoute?.params,
},
{
name: SCREENS.ONBOARDING.WORK,
name: SCREENS.ONBOARDING.EMPLOYEES,
params: currentRoute?.params,
},
{...currentRoute},
Expand Down
7 changes: 6 additions & 1 deletion src/libs/actions/Welcome/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as API from '@libs/API';
import {WRITE_COMMANDS} from '@libs/API/types';
import Navigation from '@libs/Navigation/Navigation';
import variables from '@styles/variables';
import type {OnboardingPurposeType} from '@src/CONST';
import type {OnboardingCompanySizeType, OnboardingPurposeType} from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import type Onboarding from '@src/types/onyx/Onboarding';
Expand Down Expand Up @@ -144,6 +144,10 @@ function setOnboardingPurposeSelected(value: OnboardingPurposeType) {
Onyx.set(ONYXKEYS.ONBOARDING_PURPOSE_SELECTED, value ?? null);
}

function setOnboardingCompanySize(value: OnboardingCompanySizeType) {
Onyx.set(ONYXKEYS.ONBOARDING_COMPANY_SIZE, value);
}

function setOnboardingErrorMessage(value: string) {
Onyx.set(ONYXKEYS.ONBOARDING_ERROR_MESSAGE, value ?? null);
}
Expand Down Expand Up @@ -236,4 +240,5 @@ export {
completeHybridAppOnboarding,
handleHybridAppOnboarding,
setOnboardingErrorMessage,
setOnboardingCompanySize,
};
Loading
Loading