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

[Self-guided tours][V2] Add tour links to onboarding tasks #51153

Merged
merged 10 commits into from
Nov 5, 2024
17 changes: 16 additions & 1 deletion src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ const signupQualifiers = {
SMB: 'smb',
} as const;

const selfGuidedTourTask: OnboardingTaskType = {
type: 'viewTour',
autoCompleted: false,
mountiny marked this conversation as resolved.
Show resolved Hide resolved
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 = {
message: 'Getting paid back is as easy as sending a message. Let’s go over the basics.',
video: {
Expand All @@ -93,6 +100,7 @@ const onboardingEmployerOrSubmitMessage: OnboardingMessageType = {
height: 960,
},
tasks: [
selfGuidedTourTask,
{
type: 'submitExpense',
autoCompleted: false,
Expand Down Expand Up @@ -149,11 +157,15 @@ const onboardingCompanySize = {

type OnboardingInviteType = ValueOf<typeof onboardingInviteTypes>;

type Description =
| string
| ((params: Partial<{adminsRoomLink: string; workspaceCategoriesLink: string; workspaceMoreFeaturesLink: string; workspaceMembersLink: string; navatticURL: string}>) => string);

type OnboardingTaskType = {
type: string;
autoCompleted: boolean;
title: string;
description: string | ((params: Partial<{adminsRoomLink: string; workspaceCategoriesLink: string; workspaceMoreFeaturesLink: string; workspaceMembersLink: string}>) => string);
description: Description;
};

type OnboardingMessageType = {
Expand Down Expand Up @@ -4692,6 +4704,7 @@ const CONST = {
'\n' +
'*Your new workspace is ready! It’ll keep all of your spend (and chats) in one place.*',
},
selfGuidedTourTask,
{
type: 'meetGuide',
autoCompleted: false,
Expand Down Expand Up @@ -4788,6 +4801,7 @@ const CONST = {
height: 960,
},
tasks: [
selfGuidedTourTask,
{
type: 'trackExpense',
autoCompleted: false,
Expand Down Expand Up @@ -4816,6 +4830,7 @@ const CONST = {
height: 960,
},
tasks: [
selfGuidedTourTask,
{
type: 'startChat',
autoCompleted: false,
Expand Down
10 changes: 9 additions & 1 deletion src/libs/actions/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ import DateUtils from '@libs/DateUtils';
import {prepareDraftComment} from '@libs/DraftCommentUtils';
import * as EmojiUtils from '@libs/EmojiUtils';
import * as Environment from '@libs/Environment/Environment';
import getEnvironment from '@libs/Environment/getEnvironment';
import type EnvironmentType from '@libs/Environment/getEnvironment/types';
import * as ErrorUtils from '@libs/ErrorUtils';
import fileDownload from '@libs/fileDownload';
import HttpUtils from '@libs/HttpUtils';
Expand All @@ -83,6 +85,7 @@ import type {OptimisticAddCommentReportAction} from '@libs/ReportUtils';
import * as ReportUtils from '@libs/ReportUtils';
import {doesReportBelongToWorkspace} from '@libs/ReportUtils';
import shouldSkipDeepLinkNavigation from '@libs/shouldSkipDeepLinkNavigation';
import {getNavatticURL} from '@libs/TourUtils';
import Visibility from '@libs/Visibility';
import CONFIG from '@src/CONFIG';
import type {OnboardingAccountingType, OnboardingCompanySizeType, OnboardingPurposeType} from '@src/CONST';
Expand Down Expand Up @@ -273,6 +276,11 @@ Onyx.connect({
let environmentURL: string;
Environment.getEnvironmentURL().then((url: string) => (environmentURL = url));

let environment: EnvironmentType;
getEnvironment().then((env) => {
environment = env;
});

registerPaginationConfig({
initialCommand: WRITE_COMMANDS.OPEN_REPORT,
previousCommand: READ_COMMANDS.GET_OLDER_ACTIONS,
Expand Down Expand Up @@ -3370,7 +3378,6 @@ function completeOnboarding(
reportComment: videoComment.commentText,
};
}

const tasksData = data.tasks.map((task, index) => {
const taskDescription =
typeof task.description === 'function'
Expand All @@ -3379,6 +3386,7 @@ function completeOnboarding(
workspaceCategoriesLink: `${environmentURL}/${ROUTES.WORKSPACE_CATEGORIES.getRoute(onboardingPolicyID ?? '-1')}`,
workspaceMembersLink: `${environmentURL}/${ROUTES.WORKSPACE_MEMBERS.getRoute(onboardingPolicyID ?? '-1')}`,
workspaceMoreFeaturesLink: `${environmentURL}/${ROUTES.WORKSPACE_MORE_FEATURES.getRoute(onboardingPolicyID ?? '-1')}`,
navatticURL: getNavatticURL(environment, engagementChoice),
})
: task.description;
const currentTask = ReportUtils.buildOptimisticTaskReport(
Expand Down
Loading