Skip to content

Commit

Permalink
Merge pull request #46052 from software-mansion-labs/@cdOut/guided-3-…
Browse files Browse the repository at this point in the history
…onboarding

[Guided Setup: Stage 3] Send the Onboarding Message After Sign-In
  • Loading branch information
deetergp authored Nov 13, 2024
2 parents 2f8a878 + 54c71f8 commit e6b4167
Show file tree
Hide file tree
Showing 15 changed files with 232 additions and 95 deletions.
93 changes: 75 additions & 18 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ const selectableOnboardingChoices = {
} as const;

const backendOnboardingChoices = {
ADMIN: 'newDotAdmin',
SUBMIT: 'newDotSubmit',
} as const;

Expand All @@ -90,14 +91,14 @@ const signupQualifiers = {
SMB: 'smb',
} as const;

const selfGuidedTourTask: OnboardingTaskType = {
const selfGuidedTourTask: OnboardingTask = {
type: 'viewTour',
autoCompleted: false,
title: 'Take a 2-minute tour',
description: ({navatticURL}) => `[Take a self-guided product tour](${navatticURL}) and learn about everything Expensify has to offer.`,
};

const onboardingEmployerOrSubmitMessage: OnboardingMessageType = {
const onboardingEmployerOrSubmitMessage: OnboardingMessage = {
message: 'Getting paid back is as easy as sending a message. Let’s go over the basics.',
video: {
url: `${CLOUDFRONT_URL}/videos/guided-setup-get-paid-back-v2.mp4`,
Expand Down Expand Up @@ -142,7 +143,7 @@ const onboardingEmployerOrSubmitMessage: OnboardingMessageType = {
],
};

const combinedTrackSubmitOnboardingEmployerOrSubmitMessage: OnboardingMessageType = {
const combinedTrackSubmitOnboardingEmployerOrSubmitMessage: OnboardingMessage = {
...onboardingEmployerOrSubmitMessage,
tasks: [
{
Expand Down Expand Up @@ -180,7 +181,7 @@ const combinedTrackSubmitOnboardingEmployerOrSubmitMessage: OnboardingMessageTyp
],
};

const onboardingPersonalSpendMessage: OnboardingMessageType = {
const onboardingPersonalSpendMessage: OnboardingMessage = {
message: 'Here’s how to track your spend in a few clicks.',
video: {
url: `${CLOUDFRONT_URL}/videos/guided-setup-track-personal-v2.mp4`,
Expand Down Expand Up @@ -208,7 +209,7 @@ const onboardingPersonalSpendMessage: OnboardingMessageType = {
},
],
};
const combinedTrackSubmitOnboardingPersonalSpendMessage: OnboardingMessageType = {
const combinedTrackSubmitOnboardingPersonalSpendMessage: OnboardingMessage = {
...onboardingPersonalSpendMessage,
tasks: [
{
Expand All @@ -231,11 +232,11 @@ const combinedTrackSubmitOnboardingPersonalSpendMessage: OnboardingMessageType =
],
};

type OnboardingPurposeType = ValueOf<typeof onboardingChoices>;
type OnboardingPurpose = ValueOf<typeof onboardingChoices>;

type OnboardingCompanySizeType = ValueOf<typeof onboardingCompanySize>;
type OnboardingCompanySize = ValueOf<typeof onboardingCompanySize>;

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

const onboardingInviteTypes = {
IOU: 'iou',
Expand All @@ -251,9 +252,9 @@ const onboardingCompanySize = {
LARGE: '1001+',
} as const;

type OnboardingInviteType = ValueOf<typeof onboardingInviteTypes>;
type OnboardingInvite = ValueOf<typeof onboardingInviteTypes>;

type OnboardingTaskType = {
type OnboardingTask = {
type: string;
autoCompleted: boolean;
title:
Expand All @@ -278,10 +279,17 @@ type OnboardingTaskType = {
) => string);
};

type OnboardingMessageType = {
type OnboardingMessage = {
/** Text message that will be displayed first */
message: string;

/** Video object to be displayed after initial description message */
video?: Video;
tasks: OnboardingTaskType[];

/** List of tasks connected with the message, they will have a checkbox and a separate report for more information */
tasks: OnboardingTask[];

/** Type of task described in a string format */
type?: string;
};

Expand Down Expand Up @@ -5055,18 +5063,67 @@ const CONST = {
},
],
},
[onboardingChoices.ADMIN]: {
message: "As an admin, learn how to manage your team's workspace and submit expenses yourself.",
video: {
url: `${CLOUDFRONT_URL}/videos/guided-setup-manage-team-v2.mp4`,
thumbnailUrl: `${CLOUDFRONT_URL}/images/guided-setup-manage-team.jpg`,
duration: 55,
width: 1280,
height: 960,
},
tasks: [
{
type: 'meetSetupSpecialist',
autoCompleted: false,
title: 'Meet your setup specialist',
description:
'*Meet your setup specialist* who can answer any questions as you get started with Expensify. Yes, a real human!' +
'\n' +
'Chat with them in your #admins room or schedule a call today.',
},
{
type: 'reviewWorkspaceSettings',
autoCompleted: false,
title: 'Review your workspace settings',
description:
"Here's how to review and update your workspace settings:" +
'\n' +
'1. Click your profile picture.' +
'2. Click *Workspaces* > [Your workspace].' +
'\n' +
"Make any changes there and we'll track them in the #admins room.",
},
{
type: 'submitExpense',
autoCompleted: false,
title: 'Submit an expense',
description:
'*Submit an expense* by entering an amount or scanning a receipt.\n' +
'\n' +
'Here’s how to submit an expense:\n' +
'\n' +
'1. Click the green *+* button.\n' +
'2. Choose *Submit expense*.\n' +
'3. Enter an amount or scan a receipt.\n' +
'4. Add your reimburser to the request.\n' +
'\n' +
'Then, send your request and wait for that sweet “Cha-ching!” when it’s complete.',
},
],
},
[onboardingChoices.LOOKING_AROUND]: {
message:
"Expensify is best known for expense and corporate card management, but we do a lot more than that. Let me know what you're interested in and I'll help get you started.",
tasks: [],
},
} satisfies Record<OnboardingPurposeType, OnboardingMessageType>,
} satisfies Record<OnboardingPurpose, OnboardingMessage>,

COMBINED_TRACK_SUBMIT_ONBOARDING_MESSAGES: {
[combinedTrackSubmitOnboardingChoices.PERSONAL_SPEND]: combinedTrackSubmitOnboardingPersonalSpendMessage,
[combinedTrackSubmitOnboardingChoices.EMPLOYER]: combinedTrackSubmitOnboardingEmployerOrSubmitMessage,
[combinedTrackSubmitOnboardingChoices.SUBMIT]: combinedTrackSubmitOnboardingEmployerOrSubmitMessage,
} satisfies Record<ValueOf<typeof combinedTrackSubmitOnboardingChoices>, OnboardingMessageType>,
} satisfies Record<ValueOf<typeof combinedTrackSubmitOnboardingChoices>, OnboardingMessage>,

REPORT_FIELD_TITLE_FIELD_ID: 'text_title',

Expand Down Expand Up @@ -6229,14 +6286,14 @@ export type {
Country,
IOUAction,
IOUType,
OnboardingPurposeType,
OnboardingCompanySizeType,
OnboardingPurpose,
OnboardingCompanySize,
IOURequestType,
SubscriptionType,
FeedbackSurveyOptionID,
CancellationType,
OnboardingInviteType,
OnboardingAccountingType,
OnboardingInvite,
OnboardingAccounting,
};

export default CONST;
8 changes: 4 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 {OnboardingCompanySizeType, OnboardingPurposeType} from './CONST';
import type {OnboardingCompanySize} from './CONST';
import type Platform from './libs/getPlatform/types';
import type * as FormTypes from './types/form';
import type * as OnyxTypes from './types/onyx';
Expand Down Expand Up @@ -982,9 +982,9 @@ type OnyxValuesMapping = {
[ONYXKEYS.MAX_CANVAS_AREA]: number;
[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_PURPOSE_SELECTED]: OnyxTypes.OnboardingPurpose;
[ONYXKEYS.ONBOARDING_COMPANY_SIZE]: OnboardingCompanySize;
[ONYXKEYS.ONBOARDING_CUSTOM_CHOICES]: OnyxTypes.OnboardingPurpose[] | [];
[ONYXKEYS.ONBOARDING_ERROR_MESSAGE]: string;
[ONYXKEYS.ONBOARDING_POLICY_ID]: string;
[ONYXKEYS.ONBOARDING_ADMINS_CHAT_REPORT_ID]: string;
Expand Down
9 changes: 5 additions & 4 deletions src/libs/API/parameters/CompleteGuidedSetupParams.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import type {OnboardingAccountingType, OnboardingCompanySizeType, OnboardingPurposeType} from '@src/CONST';
import type {OnboardingAccounting, OnboardingCompanySize} from '@src/CONST';
import type {OnboardingPurpose} from '@src/types/onyx';

type CompleteGuidedSetupParams = {
firstName: string;
lastName: string;
actorAccountID: number;
guidedSetupData: string;
engagementChoice: OnboardingPurposeType;
engagementChoice: OnboardingPurpose;
paymentSelected?: string;
companySize?: OnboardingCompanySizeType;
userReportedIntegration?: OnboardingAccountingType;
companySize?: OnboardingCompanySize;
userReportedIntegration?: OnboardingAccounting;
policyID?: string;
};

Expand Down
1 change: 1 addition & 0 deletions src/libs/API/parameters/OpenReportParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ type OpenReportParams = {
chatType?: string;
optimisticAccountIDList?: string;
file?: File | CustomRNImageManipulatorResult;
guidedSetupData?: string;
};

export default OpenReportParams;
4 changes: 2 additions & 2 deletions src/libs/TourUtils.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type {ValueOf} from 'type-fest';
import CONST from '@src/CONST';
import type {OnboardingPurposeType} from '@src/CONST';
import type {OnboardingPurpose} from '@src/CONST';

function getNavatticURL(environment: ValueOf<typeof CONST.ENVIRONMENT>, introSelected?: OnboardingPurposeType) {
function getNavatticURL(environment: ValueOf<typeof CONST.ENVIRONMENT>, introSelected?: OnboardingPurpose) {
const adminTourURL = environment === CONST.ENVIRONMENT.PRODUCTION ? CONST.NAVATTIC.ADMIN_TOUR_PRODUCTION : CONST.NAVATTIC.ADMIN_TOUR_STAGING;
const employeeTourURL = environment === CONST.ENVIRONMENT.PRODUCTION ? CONST.NAVATTIC.EMPLOYEE_TOUR_PRODUCTION : CONST.NAVATTIC.EMPLOYEE_TOUR_STAGING;
return introSelected === CONST.SELECTABLE_ONBOARDING_CHOICES.MANAGE_TEAM ? adminTourURL : employeeTourURL;
Expand Down
6 changes: 3 additions & 3 deletions src/libs/actions/IOU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7372,12 +7372,12 @@ function completePaymentOnboarding(paymentSelected: ValueOf<typeof CONST.PAYMENT
const personalDetailsListValues = Object.values(OptionsListUtils.getPersonalDetailsForAccountIDs(session?.accountID ? [session.accountID] : [], personalDetailsList));
const personalDetails = personalDetailsListValues.at(0);

let onboardingPurpose = introSelected.choice;
if (introSelected.inviteType === CONST.ONBOARDING_INVITE_TYPES.IOU && paymentSelected === CONST.IOU.PAYMENT_SELECTED.BBA) {
let onboardingPurpose = introSelected?.choice;
if (introSelected?.inviteType === CONST.ONBOARDING_INVITE_TYPES.IOU && paymentSelected === CONST.IOU.PAYMENT_SELECTED.BBA) {
onboardingPurpose = CONST.ONBOARDING_CHOICES.MANAGE_TEAM;
}

if (introSelected.inviteType === CONST.ONBOARDING_INVITE_TYPES.INVOICE && paymentSelected !== CONST.IOU.PAYMENT_SELECTED.BBA) {
if (introSelected?.inviteType === CONST.ONBOARDING_INVITE_TYPES.INVOICE && paymentSelected !== CONST.IOU.PAYMENT_SELECTED.BBA) {
onboardingPurpose = CONST.ONBOARDING_CHOICES.CHAT_SPLIT;
}

Expand Down
Loading

0 comments on commit e6b4167

Please sign in to comment.