Skip to content

Commit

Permalink
Merge pull request #40328 from tienifr/fix/40261
Browse files Browse the repository at this point in the history
Update custom messages in the onboarding flow
  • Loading branch information
MariaHCD authored Apr 17, 2024
2 parents 5bace84 + e8ccd30 commit cd7db88
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 23 deletions.
28 changes: 9 additions & 19 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3551,12 +3551,11 @@ const CONST = {

ONBOARDING_CONCIERGE: {
[onboardingChoices.TRACK]:
"# Welcome to Expensify, let's start tracking your expenses!\n" +
"Hi there, I'm Concierge. Chat with me here for anything you need.\n" +
"# Let's start tracking your expenses!\n" +
'\n' +
"To track your expenses, create a workspace to keep everything in one place. Here's how:\n" +
'1. From the home screen, click the green + button > New Workspace\n' +
'2. Give your workspace a name (e.g. "My business expenses).\n' +
'2. Give your workspace a name (e.g. "My business expenses").\n' +
'\n' +
'Then, add expenses to your workspace:\n' +
'1. Find your workspace using the search field.\n' +
Expand All @@ -3565,30 +3564,27 @@ const CONST = {
'\n' +
"We'll store all expenses in your new workspace for easy access. Let me know if you have any questions!",
[onboardingChoices.EMPLOYER]:
'# Welcome to Expensify, the fastest way to get paid back!\n' +
"Hi there, I'm Concierge. Chat with me here for anything you need.\n" +
'# Expensify is the fastest way to get paid back!\n' +
'\n' +
'To submit expenses for reimbursement:\n' +
'1. From the home screen, click the green + button > Request money.\n' +
"2. Enter an amount or scan a receipt, then input your boss's email.\n" +
'\n' +
"That'll send a request to get you paid back. Let me know if you have any questions!",
[onboardingChoices.MANAGE_TEAM]:
"# Welcome to Expensify, let's start managing your team's expenses!\n" +
"Hi there, I'm Concierge. Chat with me here for anything you need.\n" +
"# Let's start managing your team's expenses!\n" +
'\n' +
"To manage your team's expenses, create a workspace to keep everything in one place. Here's how:\n" +
'1. From the home screen, click the green + button > New Workspace\n' +
'2. Give your workspace a name (e.g. Sales team expenses).\n' +
'2. Give your workspace a name (e.g. "Sales team expenses").\n' +
'\n' +
'Then, invite your team to your workspace via the Members pane and connect a business bank account to reimburse them. Let me know if you have any questions!',
'Then, invite your team to your workspace via the Members pane and [connect a business bank account](https://help.expensify.com/articles/new-expensify/bank-accounts/Connect-a-Bank-Account) to reimburse them. Let me know if you have any questions!',
[onboardingChoices.PERSONAL_SPEND]:
"# Welcome to Expensify, let's start tracking your expenses!\n" +
"Hi there, I'm Concierge. Chat with me here for anything you need.\n" +
"# Let's start tracking your expenses! \n" +
'\n' +
"To track your expenses, create a workspace to keep everything in one place. Here's how:\n" +
'1. From the home screen, click the green + button > New Workspace\n' +
'2. Give your workspace a name (e.g. "My expenses).\n' +
'2. Give your workspace a name (e.g. "My expenses").\n' +
'\n' +
'Then, add expenses to your workspace:\n' +
'1. Find your workspace using the search field.\n' +
Expand All @@ -3597,19 +3593,13 @@ const CONST = {
'\n' +
"We'll store all expenses in your new workspace for easy access. Let me know if you have any questions!",
[onboardingChoices.CHAT_SPLIT]:
'# Welcome to Expensify, where splitting the bill is an easy conversation!\n' +
"Hi there, I'm Concierge. Chat with me here for anything you need.\n" +
'# Splitting the bill is as easy as a conversation!\n' +
'\n' +
'To split an expense:\n' +
'1. From the home screen, click the green + button > Request money.\n' +
'2. Enter an amount or scan a receipt, then choose who you want to split it with.\n' +
'\n' +
"We'll send a request to each person so they can pay you back. Let me know if you have any questions!",
[onboardingChoices.LOOKING_AROUND]:
'# Welcome to Expensify!\n' +
"Hi there, I'm Concierge. Chat with me here for anything you need.\n" +
'\n' +
"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.",
},

REPORT_FIELD_TITLE_FIELD_ID: 'text_title',
Expand Down
24 changes: 23 additions & 1 deletion src/libs/actions/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2941,8 +2941,29 @@ function getReportPrivateNote(reportID: string | undefined) {
* - Sets the introSelected NVP to the choice the user made
* - Creates an optimistic report comment from concierge
*/
function completeEngagementModal(text: string, choice: ValueOf<typeof CONST.ONBOARDING_CHOICES>) {
function completeEngagementModal(choice: ValueOf<typeof CONST.ONBOARDING_CHOICES>, text?: string) {
const conciergeAccountID = PersonalDetailsUtils.getAccountIDsByLogins([CONST.EMAIL.CONCIERGE])[0];

// We do not need to send any message for some choices
if (!text) {
const parameters: CompleteEngagementModalParams = {
reportID: conciergeChatReportID ?? '',
engagementChoice: choice,
};

const optimisticData: OnyxUpdate[] = [
{
onyxMethod: Onyx.METHOD.MERGE,
key: ONYXKEYS.NVP_INTRO_SELECTED,
value: {choice},
},
];
API.write(WRITE_COMMANDS.COMPLETE_ENGAGEMENT_MODAL, parameters, {
optimisticData,
});
return;
}

const reportComment = ReportUtils.buildOptimisticAddCommentReportAction(text, undefined, conciergeAccountID);
const reportCommentAction: OptimisticAddCommentReportAction = reportComment.reportAction;
const lastComment = reportCommentAction?.message?.[0];
Expand Down Expand Up @@ -3007,6 +3028,7 @@ function completeEngagementModal(text: string, choice: ValueOf<typeof CONST.ONBO
},
];

// eslint-disable-next-line rulesdir/no-multiple-api-calls
API.write(WRITE_COMMANDS.COMPLETE_ENGAGEMENT_MODAL, parameters, {
optimisticData,
successData,
Expand Down
2 changes: 1 addition & 1 deletion src/pages/OnboardEngagement/ManageTeamsExpensesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function ManageTeamsExpensesModal() {
);

const completeEngagement = () => {
Report.completeEngagementModal(messageCopy, CONST.INTRO_CHOICES.MANAGE_TEAM);
Report.completeEngagementModal(CONST.INTRO_CHOICES.MANAGE_TEAM, messageCopy);
Report.navigateToConciergeChat();
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function PurposeForUsingExpensifyModal() {
return Navigation.navigate(ROUTES.ONBOARD_MANAGE_EXPENSES);
}

Report.completeEngagementModal(message, choice);
Report.completeEngagementModal(choice, message);
Report.navigateToConciergeChat(true);
}, []);

Expand Down
2 changes: 1 addition & 1 deletion src/pages/OnboardingPurpose/BaseOnboardingPurpose.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function BaseOnboardingPurpose({shouldUseNativeStyles, shouldEnableMaxHeight, on
return;
}

Report.completeEngagementModal(CONST.ONBOARDING_CONCIERGE[selectedPurpose], selectedPurpose);
Report.completeEngagementModal(selectedPurpose, CONST.ONBOARDING_CONCIERGE[selectedPurpose]);

Navigation.dismissModal();
// Only navigate to concierge chat when central pane is visible
Expand Down

0 comments on commit cd7db88

Please sign in to comment.