Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
131 changes: 103 additions & 28 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ const onboardingChoices = {
...backendOnboardingChoices,
} as const;

const combinedTrackSubmitOnboardingChoices = {
PERSONAL_SPEND: selectableOnboardingChoices.PERSONAL_SPEND,
EMPLOYER: selectableOnboardingChoices.EMPLOYER,
SUBMIT: backendOnboardingChoices.SUBMIT,
} as const;

const signupQualifiers = {
INDIVIDUAL: 'individual',
VSB: 'vsb',
Expand Down Expand Up @@ -127,6 +133,95 @@ const onboardingEmployerOrSubmitMessage: OnboardingMessageType = {
],
};

const combinedTrackSubmitOnboardingEmployerOrSubmitMessage: OnboardingMessageType = {
...onboardingEmployerOrSubmitMessage,
tasks: [
{
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 *Create expense*.\n' +
'3. Enter an amount or scan a receipt.\n' +
'4. Add your reimburser to the request.\n' +
'5. Click *Submit*.\n' +
'\n' +
'And you’re done! Now wait for that sweet “Cha-ching!” when it’s complete.',
},
{
type: 'addBankAccount',
autoCompleted: false,
title: 'Add personal bank account',
description:
'You’ll need to add your personal bank account to get paid back. Don’t worry, it’s easy!\n' +
'\n' +
'Here’s how to set up your bank account:\n' +
'\n' +
'1. Click your profile picture.\n' +
'2. Click *Wallet* > *Bank accounts* > *+ Add bank account*.\n' +
'3. Connect your bank account.\n' +
'\n' +
'Once that’s done, you can request money from anyone and get paid back right into your personal bank account.',
},
],
};

const onboardingPersonalSpendMessage: OnboardingMessageType = {
message: 'Here’s how to track your spend in a few clicks.',
video: {
url: `${CLOUDFRONT_URL}/videos/guided-setup-track-personal-v2.mp4`,
thumbnailUrl: `${CLOUDFRONT_URL}/images/guided-setup-track-personal.jpg`,
duration: 55,
width: 1280,
height: 960,
},
tasks: [
{
type: 'trackExpense',
autoCompleted: false,
title: 'Track an expense',
description:
'*Track an expense* in any currency, whether you have a receipt or not.\n' +
'\n' +
'Here’s how to track an expense:\n' +
'\n' +
'1. Click the green *+* button.\n' +
'2. Choose *Track expense*.\n' +
'3. Enter an amount or scan a receipt.\n' +
'4. Click *Track*.\n' +
'\n' +
'And you’re done! Yep, it’s that easy.',
},
],
};
const combinedTrackSubmitOnboardingPersonalSpendMessage: OnboardingMessageType = {
...onboardingPersonalSpendMessage,
tasks: [
{
type: 'trackExpense',
autoCompleted: false,
title: 'Track an expense',
description:
'*Track an expense* in any currency, whether you have a receipt or not.\n' +
'\n' +
'Here’s how to track an expense:\n' +
'\n' +
'1. Click the green *+* button.\n' +
'2. Choose *Create expense*.\n' +
'3. Enter an amount or scan a receipt.\n' +
'4. Click "Just track it (don\'t submit it)".\n' +
'5. Click *Track*.\n' +
'\n' +
'And you’re done! Yep, it’s that easy.',
},
],
};

type OnboardingPurposeType = ValueOf<typeof onboardingChoices>;

type OnboardingCompanySizeType = ValueOf<typeof onboardingCompanySize>;
Expand Down Expand Up @@ -4710,6 +4805,7 @@ const CONST = {
ONBOARDING_INTRODUCTION: 'Let’s get you set up 🔧',
ONBOARDING_CHOICES: {...onboardingChoices},
SELECTABLE_ONBOARDING_CHOICES: {...selectableOnboardingChoices},
COMBINED_TRACK_SUBMIT_ONBOARDING_CHOICES: {...combinedTrackSubmitOnboardingChoices},
ONBOARDING_SIGNUP_QUALIFIERS: {...signupQualifiers},
ONBOARDING_INVITE_TYPES: {...onboardingInviteTypes},
ONBOARDING_COMPANY_SIZE: {...onboardingCompanySize},
Expand Down Expand Up @@ -4891,34 +4987,7 @@ const CONST = {
},
],
},
[onboardingChoices.PERSONAL_SPEND]: {
message: 'Here’s how to track your spend in a few clicks.',
video: {
url: `${CLOUDFRONT_URL}/videos/guided-setup-track-personal-v2.mp4`,
thumbnailUrl: `${CLOUDFRONT_URL}/images/guided-setup-track-personal.jpg`,
duration: 55,
width: 1280,
height: 960,
},
tasks: [
{
type: 'trackExpense',
autoCompleted: false,
title: 'Track an expense',
description:
'*Track an expense* in any currency, whether you have a receipt or not.\n' +
'\n' +
'Here’s how to track an expense:\n' +
'\n' +
'1. Click the green *+* button.\n' +
'2. Choose *Track expense*.\n' +
'3. Enter an amount or scan a receipt.\n' +
'4. Click *Track*.\n' +
'\n' +
'And you’re done! Yep, it’s that easy.',
},
],
},
[onboardingChoices.PERSONAL_SPEND]: onboardingPersonalSpendMessage,
[onboardingChoices.CHAT_SPLIT]: {
message: 'Splitting bills with friends is as easy as sending a message. Here’s how.',
video: {
Expand Down Expand Up @@ -4987,6 +5056,12 @@ const CONST = {
},
} satisfies Record<OnboardingPurposeType, OnboardingMessageType>,

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

REPORT_FIELD_TITLE_FIELD_ID: 'text_title',

MOBILE_PAGINATION_SIZE: 15,
Expand Down
21 changes: 21 additions & 0 deletions src/libs/actions/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ import enhanceParameters from '@libs/Network/enhanceParameters';
import type {NetworkStatus} from '@libs/NetworkConnection';
import LocalNotification from '@libs/Notification/LocalNotification';
import Parser from '@libs/Parser';
import Permissions from '@libs/Permissions';
import * as PersonalDetailsUtils from '@libs/PersonalDetailsUtils';
import * as PhoneNumber from '@libs/PhoneNumber';
import getPolicyEmployeeAccountIDs from '@libs/PolicyEmployeeListUtils';
Expand All @@ -92,6 +93,7 @@ import type {Route} from '@src/ROUTES';
import ROUTES from '@src/ROUTES';
import INPUT_IDS from '@src/types/form/NewRoomForm';
import type {
Beta,
InvitedEmailsToAccountIDs,
NewGroupChatDraft,
PersonalDetailsList,
Expand Down Expand Up @@ -270,6 +272,12 @@ Onyx.connect({
callback: (value) => (allReportDraftComments = value),
});

let allBetas: OnyxEntry<Beta[]>;
Onyx.connect({
key: ONYXKEYS.BETAS,
callback: (value) => (allBetas = value),
});

let environmentURL: string;
Environment.getEnvironmentURL().then((url: string) => (environmentURL = url));

Expand Down Expand Up @@ -3380,6 +3388,19 @@ function completeOnboarding(
companySize?: OnboardingCompanySizeType,
userReportedIntegration?: OnboardingAccountingType,
) {
// If the user has the "combinedTrackSubmit" beta enabled we'll show different tasks for track and submit expense.
if (Permissions.canUseCombinedTrackSubmit(allBetas)) {
if (engagementChoice === CONST.ONBOARDING_CHOICES.PERSONAL_SPEND) {
// eslint-disable-next-line no-param-reassign
data = CONST.COMBINED_TRACK_SUBMIT_ONBOARDING_MESSAGES[CONST.ONBOARDING_CHOICES.PERSONAL_SPEND];
}

if (engagementChoice === CONST.ONBOARDING_CHOICES.EMPLOYER || engagementChoice === CONST.ONBOARDING_CHOICES.SUBMIT) {
// eslint-disable-next-line no-param-reassign
data = CONST.COMBINED_TRACK_SUBMIT_ONBOARDING_MESSAGES[CONST.ONBOARDING_CHOICES.SUBMIT];
}
}

const integrationName = userReportedIntegration ? CONST.ONBOARDING_ACCOUNTING_MAPPING[userReportedIntegration] : '';
const actorAccountID = CONST.ACCOUNT_ID.CONCIERGE;
const targetChatReport = ReportUtils.getChatByParticipants([actorAccountID, currentUserAccountID]);
Expand Down