Skip to content

Update TestDrive link for invited employees #65900

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

Merged
merged 5 commits into from
Jul 14, 2025
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
12 changes: 5 additions & 7 deletions src/CONST/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ const onboardingInviteTypes = {
IOU: 'iou',
INVOICE: 'invoice',
CHAT: 'chat',
WORKSPACE: 'workspace',
} as const;

const onboardingCompanySize = {
Expand Down Expand Up @@ -965,18 +966,15 @@ const CONST = {
TEST_RECEIPT_URL: `${CLOUDFRONT_URL}/images/fake-receipt__tacotodds.png`,
// Use Environment.getEnvironmentURL to get the complete URL with port number
DEV_NEW_EXPENSIFY_URL: 'https://dev.new.expensify.com:',
NAVATTIC: {
ADMIN_TOUR_PRODUCTION: 'https://expensify.navattic.com/kh204a7',
ADMIN_TOUR_STAGING: 'https://expensify.navattic.com/3i300k18',
EMPLOYEE_TOUR_PRODUCTION: 'https://expensify.navattic.com/35609gb',
EMPLOYEE_TOUR_STAGING: 'https://expensify.navattic.com/cf15002s',
COMPLETED: 'completed',
},
STORYLANE: {
ADMIN_TOUR: 'https://app.storylane.io/demo/bbcreg8vccag?embed=inline',
ADMIN_TOUR_MOBILE: 'https://app.storylane.io/demo/b6faqcdsxgww?embed=inline',
TRACK_WORKSPACE_TOUR: 'https://app.storylane.io/share/agmsfwgasaed?embed=inline',
TRACK_WORKSPACE_TOUR_MOBILE: 'https://app.storylane.io/share/wq4hiwsqvoho?embed=inline',

// At the moment we are using Navattic links, but it will be changed to Storylane in the future.
EMPLOYEE_TOUR: 'https://expensify.navattic.com/35609gb',
EMPLOYEE_TOUR_MOBILE: 'https://expensify.navattic.com/35609gb',
},
OLD_DOT_PUBLIC_URLS: {
TERMS_URL: `${EXPENSIFY_URL}/terms`,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,56 +1,32 @@
import {Str} from 'expensify-common';
import React, {useContext, useMemo} from 'react';
import React, {useMemo} from 'react';
import type {StyleProp, TextStyle} from 'react-native';
import {TNodeChildrenRenderer} from 'react-native-render-html';
import type {CustomRendererProps, TBlock} from 'react-native-render-html';
import {TNodeChildrenRenderer} from 'react-native-render-html';
import AnchorForAttachmentsOnly from '@components/AnchorForAttachmentsOnly';
import AnchorForCommentsOnly from '@components/AnchorForCommentsOnly';
import * as HTMLEngineUtils from '@components/HTMLEngineProvider/htmlEngineUtils';
import {ShowContextMenuContext} from '@components/ShowContextMenuContext';
import Text from '@components/Text';
import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails';
import useEnvironment from '@hooks/useEnvironment';
import useHover from '@hooks/useHover';
import useOnyx from '@hooks/useOnyx';
import useParentReport from '@hooks/useParentReport';
import useReportIsArchived from '@hooks/useReportIsArchived';
import useStyleUtils from '@hooks/useStyleUtils';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import {getInternalExpensifyPath, getInternalNewExpensifyPath, openExternalLink, openLink} from '@libs/actions/Link';
import {isAnonymousUser} from '@libs/actions/Session';
import {canActionTask, canModifyTask, completeTask} from '@libs/actions/Task';
import {setSelfTourViewed} from '@libs/actions/Welcome';
import {hasSeenTourSelector} from '@libs/onboardingSelectors';
import {getNavatticURL} from '@libs/TourUtils';
import {getInternalExpensifyPath, getInternalNewExpensifyPath, openLink} from '@libs/actions/Link';
import tryResolveUrlFromApiRoot from '@libs/tryResolveUrlFromApiRoot';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';

type AnchorRendererProps = CustomRendererProps<TBlock> & {
/** Key of the element */
key?: string;
};

function AnchorRenderer({tnode, style, key}: AnchorRendererProps) {
const currentUserPersonalDetails = useCurrentUserPersonalDetails();
const {report, action} = useContext(ShowContextMenuContext);
const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED, {canBeMissing: true});
const [viewTourTaskReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${introSelected?.viewTour}`, {canBeMissing: true});
const [hasSeenTour = false] = useOnyx(ONYXKEYS.NVP_ONBOARDING, {
selector: hasSeenTourSelector,
canBeMissing: true,
});
const parentReport = useParentReport(report?.reportID);
const isParentReportArchived = useReportIsArchived(parentReport?.reportID);
const canModifyViewTourTask = canModifyTask(viewTourTaskReport, currentUserPersonalDetails.accountID, isParentReportArchived);
const canActionViewTourTask = canActionTask(viewTourTaskReport, currentUserPersonalDetails.accountID, parentReport, isParentReportArchived);

const theme = useTheme();
const styles = useThemeStyles();
const StyleUtils = useStyleUtils();
const htmlAttribs = tnode.attributes;
const {environment, environmentURL} = useEnvironment();
const {environmentURL} = useEnvironment();
const {hovered, bind} = useHover();
// An auth token is needed to download Expensify chat attachments
const isAttachment = !!htmlAttribs[CONST.ATTACHMENT_SOURCE_ATTRIBUTE];
Expand All @@ -68,26 +44,13 @@ function AnchorRenderer({tnode, style, key}: AnchorRendererProps) {

const textDecorationLineStyle = isDeleted ? styles.lineThrough : {};

const isInConciergeTaskView = action?.actionName === CONST.REPORT.ACTIONS.TYPE.CREATED && report?.type === CONST.REPORT.TYPE.TASK && report.ownerAccountID === CONST.ACCOUNT_ID.CONCIERGE;
const isTourTask = attrHref === getNavatticURL(environment, introSelected?.choice) && (action?.actorAccountID === CONST.ACCOUNT_ID.CONCIERGE || isInConciergeTaskView);

const onLinkPress = useMemo(() => {
if (internalNewExpensifyPath || internalExpensifyPath) {
return () => openLink(attrHref, environmentURL, isAttachment);
}

if (isTourTask && !hasSeenTour) {
return () => {
openExternalLink(attrHref);
setSelfTourViewed(isAnonymousUser());
if (viewTourTaskReport && canModifyViewTourTask && canActionViewTourTask) {
completeTask(viewTourTaskReport);
}
};
}

return undefined;
}, [internalNewExpensifyPath, internalExpensifyPath, attrHref, environmentURL, isAttachment, isTourTask, hasSeenTour, viewTourTaskReport, canModifyViewTourTask, canActionViewTourTask]);
}, [internalNewExpensifyPath, internalExpensifyPath, attrHref, environmentURL, isAttachment]);

if (!HTMLEngineUtils.isChildOfComment(tnode) && !isChildOfTaskTitle) {
// This is not a comment from a chat, the AnchorForCommentsOnly uses a Pressable to create a context menu on right click.
Expand Down
2 changes: 1 addition & 1 deletion src/components/TestDrive/TestDriveDemo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function TestDriveDemo() {
<TestDriveBanner onPress={closeModal} />
<FullPageOfflineBlockingView>
<EmbeddedDemo
url={getTestDriveURL(shouldUseNarrowLayout, introSelected?.choice)}
url={getTestDriveURL(shouldUseNarrowLayout, introSelected)}
iframeTitle={testDrive.EMBEDDED_DEMO_IFRAME_TITLE}
/>
</FullPageOfflineBlockingView>
Expand Down
18 changes: 11 additions & 7 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@
} from './ReportActionsUtils';
import type {LastVisibleMessage} from './ReportActionsUtils';
import {shouldRestrictUserBillableActions} from './SubscriptionUtils';
import {getNavatticURL} from './TourUtils';
import {
getAttendees,
getBillable,
Expand Down Expand Up @@ -886,7 +885,7 @@
const parsedReportActionMessageCache: Record<string, string> = {};

let conciergeReportID: OnyxEntry<string>;
Onyx.connect({

Check warning on line 888 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.CONCIERGE_REPORT_ID,
callback: (value) => {
conciergeReportID = value;
Expand All @@ -894,7 +893,7 @@
});

const defaultAvatarBuildingIconTestID = 'SvgDefaultAvatarBuilding Icon';
Onyx.connect({

Check warning on line 896 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.SESSION,
callback: (value) => {
// When signed out, val is undefined
Expand All @@ -912,7 +911,7 @@
let allPersonalDetails: OnyxEntry<PersonalDetailsList>;
let allPersonalDetailLogins: string[];
let currentUserPersonalDetails: OnyxEntry<PersonalDetails>;
Onyx.connect({

Check warning on line 914 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
callback: (value) => {
if (currentUserAccountID) {
Expand All @@ -924,14 +923,14 @@
});

let allReportsDraft: OnyxCollection<Report>;
Onyx.connect({

Check warning on line 926 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT_DRAFT,
waitForCollectionCallback: true,
callback: (value) => (allReportsDraft = value),
});

let allPolicies: OnyxCollection<Policy>;
Onyx.connect({

Check warning on line 933 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.POLICY,
waitForCollectionCallback: true,
callback: (value) => (allPolicies = value),
Expand All @@ -939,7 +938,7 @@

let allReports: OnyxCollection<Report>;
let reportsByPolicyID: ReportByPolicyMap;
Onyx.connect({

Check warning on line 941 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT,
waitForCollectionCallback: true,
callback: (value) => {
Expand Down Expand Up @@ -976,14 +975,14 @@
});

let allBetas: OnyxEntry<Beta[]>;
Onyx.connect({

Check warning on line 978 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.BETAS,
callback: (value) => (allBetas = value),
});

let allTransactions: OnyxCollection<Transaction> = {};
let reportsTransactions: Record<string, Transaction[]> = {};
Onyx.connect({

Check warning on line 985 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.TRANSACTION,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -1009,7 +1008,7 @@
});

let allReportActions: OnyxCollection<ReportActions>;
Onyx.connect({

Check warning on line 1011 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT_ACTIONS,
waitForCollectionCallback: true,
callback: (actions) => {
Expand All @@ -1022,7 +1021,7 @@

let allReportMetadata: OnyxCollection<ReportMetadata>;
const allReportMetadataKeyValue: Record<string, ReportMetadata> = {};
Onyx.connect({

Check warning on line 1024 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT_METADATA,
waitForCollectionCallback: true,
callback: (value) => {
Expand Down Expand Up @@ -10160,6 +10159,16 @@
const firstAdminPolicy = getActivePolicies(allPolicies, currentUserEmail).find(
(policy) => policy.type !== CONST.POLICY.TYPE.PERSONAL && getPolicyRole(policy, currentUserEmail) === CONST.POLICY.ROLE.ADMIN,
);

let testDriveURL: string;
if (([CONST.ONBOARDING_CHOICES.MANAGE_TEAM, CONST.ONBOARDING_CHOICES.TEST_DRIVE_RECEIVER, CONST.ONBOARDING_CHOICES.TRACK_WORKSPACE] as OnboardingPurpose[]).includes(engagementChoice)) {
testDriveURL = ROUTES.TEST_DRIVE_DEMO_ROOT;
} else if (introSelected?.choice === CONST.ONBOARDING_CHOICES.SUBMIT && introSelected.inviteType === CONST.ONBOARDING_INVITE_TYPES.WORKSPACE) {
testDriveURL = ROUTES.TEST_DRIVE_DEMO_ROOT;
} else {
testDriveURL = ROUTES.TEST_DRIVE_MODAL_ROOT.route;
}

const onboardingTaskParams: OnboardingTaskLinks = {
integrationName,
onboardingCompanySize: companySize ?? onboardingCompanySize,
Expand All @@ -10168,12 +10177,7 @@
workspaceMembersLink: `${environmentURL}/${ROUTES.WORKSPACE_MEMBERS.getRoute(onboardingPolicyID)}`,
workspaceMoreFeaturesLink: `${environmentURL}/${ROUTES.WORKSPACE_MORE_FEATURES.getRoute(onboardingPolicyID)}`,
workspaceConfirmationLink: `${environmentURL}/${ROUTES.WORKSPACE_CONFIRMATION.getRoute(ROUTES.WORKSPACES_LIST.route)}`,
navatticURL: getNavatticURL(environment, engagementChoice),
testDriveURL: `${environmentURL}/${
([CONST.ONBOARDING_CHOICES.MANAGE_TEAM, CONST.ONBOARDING_CHOICES.TEST_DRIVE_RECEIVER, CONST.ONBOARDING_CHOICES.TRACK_WORKSPACE] as OnboardingPurpose[]).includes(engagementChoice)
? ROUTES.TEST_DRIVE_DEMO_ROOT
: ROUTES.TEST_DRIVE_MODAL_ROOT.route
}`,
testDriveURL: `${environmentURL}/${testDriveURL}`,
workspaceAccountingLink: `${environmentURL}/${ROUTES.POLICY_ACCOUNTING.getRoute(onboardingPolicyID)}`,
corporateCardLink: `${environmentURL}/${ROUTES.WORKSPACE_COMPANY_CARDS.getRoute(onboardingPolicyID)}`,
};
Expand Down
22 changes: 10 additions & 12 deletions src/libs/TourUtils.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
import type {ValueOf} from 'type-fest';
import CONST from '@src/CONST';
import type {OnboardingPurpose} from './actions/Welcome/OnboardingFlow';
import type {IntroSelected} from './actions/Report';

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;
}
function getTestDriveURL(shouldUseNarrowLayout: boolean, introSelected?: IntroSelected) {
if (introSelected?.choice === CONST.ONBOARDING_CHOICES.SUBMIT && introSelected.inviteType === CONST.ONBOARDING_INVITE_TYPES.WORKSPACE) {
return shouldUseNarrowLayout ? CONST.STORYLANE.EMPLOYEE_TOUR_MOBILE : CONST.STORYLANE.EMPLOYEE_TOUR;
}

function getTestDriveURL(shouldUseNarrowLayout: boolean, introSelected?: OnboardingPurpose) {
if (shouldUseNarrowLayout) {
return introSelected === CONST.ONBOARDING_CHOICES.TRACK_WORKSPACE ? CONST.STORYLANE.TRACK_WORKSPACE_TOUR_MOBILE : CONST.STORYLANE.ADMIN_TOUR_MOBILE;
if (introSelected?.choice === CONST.ONBOARDING_CHOICES.TRACK_WORKSPACE) {
return shouldUseNarrowLayout ? CONST.STORYLANE.TRACK_WORKSPACE_TOUR_MOBILE : CONST.STORYLANE.TRACK_WORKSPACE_TOUR;
}

return introSelected === CONST.ONBOARDING_CHOICES.TRACK_WORKSPACE ? CONST.STORYLANE.TRACK_WORKSPACE_TOUR : CONST.STORYLANE.ADMIN_TOUR;
return shouldUseNarrowLayout ? CONST.STORYLANE.ADMIN_TOUR_MOBILE : CONST.STORYLANE.ADMIN_TOUR;
}

export {getNavatticURL, getTestDriveURL};
// eslint-disable-next-line import/prefer-default-export
export {getTestDriveURL};
1 change: 0 additions & 1 deletion src/libs/actions/Welcome/OnboardingFlow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ type OnboardingTaskLinks = Partial<{
workspaceMembersLink: string;
workspaceAccountingLink: string;
workspaceConfirmationLink: string;
navatticURL: string;
testDriveURL: string;
corporateCardLink: string;
}>;
Expand Down
20 changes: 2 additions & 18 deletions src/pages/ConciergePage.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {useFocusEffect, useRoute} from '@react-navigation/native';
import {useFocusEffect} from '@react-navigation/native';
import React, {useCallback, useEffect, useRef} from 'react';
import {View} from 'react-native';
import ReportActionsSkeletonView from '@components/ReportActionsSkeletonView';
Expand All @@ -8,9 +8,7 @@ import useOnyx from '@hooks/useOnyx';
import useThemeStyles from '@hooks/useThemeStyles';
import {confirmReadyToOpenApp} from '@libs/actions/App';
import {navigateToConciergeChat} from '@libs/actions/Report';
import {completeTask} from '@libs/actions/Task';
import Navigation from '@libs/Navigation/Navigation';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';

Expand All @@ -24,11 +22,6 @@ function ConciergePage() {
const isUnmounted = useRef(false);
const [session] = useOnyx(ONYXKEYS.SESSION, {canBeMissing: false});
const [isLoadingReportData = true] = useOnyx(ONYXKEYS.IS_LOADING_REPORT_DATA, {canBeMissing: true});
const route = useRoute();

const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED, {canBeMissing: true});
const viewTourTaskReportID = introSelected?.viewTour;
const [viewTourTaskReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${viewTourTaskReportID}`, {canBeMissing: true});

useFocusEffect(
useCallback(() => {
Expand All @@ -39,21 +32,12 @@ function ConciergePage() {
return;
}

// Mark the viewTourTask as complete if we are redirected to Concierge after finishing the Navattic tour
const {navattic} = (route.params as {navattic?: string}) ?? {};
if (navattic === CONST.NAVATTIC.COMPLETED) {
if (viewTourTaskReport) {
if (viewTourTaskReport.stateNum !== CONST.REPORT.STATE_NUM.APPROVED || viewTourTaskReport.statusNum !== CONST.REPORT.STATUS_NUM.APPROVED) {
completeTask(viewTourTaskReport);
}
}
}
navigateToConciergeChat(true, () => !isUnmounted.current);
Comment on lines -42 to -50
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this may be related to #66152

});
} else {
Navigation.navigate(ROUTES.HOME);
}
}, [session, isLoadingReportData, route.params, viewTourTaskReport]),
}, [session, isLoadingReportData]),
);

useEffect(() => {
Expand Down
4 changes: 3 additions & 1 deletion src/pages/Search/EmptySearchView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,8 @@ function EmptySearchView({hash, type, groupBy, hasResults}: EmptySearchViewProps
if (
introSelected?.choice === CONST.ONBOARDING_CHOICES.MANAGE_TEAM ||
introSelected?.choice === CONST.ONBOARDING_CHOICES.TEST_DRIVE_RECEIVER ||
introSelected?.choice === CONST.ONBOARDING_CHOICES.TRACK_WORKSPACE
introSelected?.choice === CONST.ONBOARDING_CHOICES.TRACK_WORKSPACE ||
(introSelected?.choice === CONST.ONBOARDING_CHOICES.SUBMIT && introSelected.inviteType === CONST.ONBOARDING_INVITE_TYPES.WORKSPACE)
) {
completeTestDriveTask(viewTourReport, viewTourReportID);
Navigation.navigate(ROUTES.TEST_DRIVE_DEMO_ROOT);
Expand Down Expand Up @@ -379,6 +380,7 @@ function EmptySearchView({hash, type, groupBy, hasResults}: EmptySearchViewProps
styles.textAlignLeft,
styles.tripEmptyStateLottieWebView,
introSelected?.choice,
introSelected?.inviteType,
hasResults,
defaultViewItemHeader,
hasSeenTour,
Expand Down
3 changes: 2 additions & 1 deletion src/pages/home/sidebar/FloatingActionButtonAndPopover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,8 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, isT
if (
introSelected?.choice === CONST.ONBOARDING_CHOICES.MANAGE_TEAM ||
introSelected?.choice === CONST.ONBOARDING_CHOICES.TEST_DRIVE_RECEIVER ||
introSelected?.choice === CONST.ONBOARDING_CHOICES.TRACK_WORKSPACE
introSelected?.choice === CONST.ONBOARDING_CHOICES.TRACK_WORKSPACE ||
(introSelected?.choice === CONST.ONBOARDING_CHOICES.SUBMIT && introSelected.inviteType === CONST.ONBOARDING_INVITE_TYPES.WORKSPACE)
) {
completeTestDriveTask(viewTourReport, viewTourReportID, isAnonymousUser());
Navigation.navigate(ROUTES.TEST_DRIVE_DEMO_ROOT);
Expand Down
2 changes: 1 addition & 1 deletion src/types/onyx/Onboarding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type Onboarding = {
/** A string that informs which qualifier the user selected during sign up */
signupQualifier: ValueOf<typeof CONST.ONBOARDING_SIGNUP_QUALIFIERS>;

/** A Boolean that tells whether the user has seen navattic tour */
/** A Boolean that tells whether the user has seen Storylane tour */
selfTourViewed?: boolean;

/** A Boolean that tells whether the user should be redirected to OD after merging work email */
Expand Down
20 changes: 17 additions & 3 deletions tests/unit/TourUtilsTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,35 @@ import CONST from '@src/CONST';

describe('TourUtils', () => {
describe('getTestDriveURL', () => {
describe('Invited employee', () => {
it('returns proper URL when screen is narrow', () => {
const url = getTestDriveURL(true, {choice: CONST.ONBOARDING_CHOICES.SUBMIT, inviteType: CONST.ONBOARDING_INVITE_TYPES.WORKSPACE});

expect(url).toBe(CONST.STORYLANE.EMPLOYEE_TOUR_MOBILE);
});

it('returns proper URL when screen is not narrow', () => {
const url = getTestDriveURL(false, {choice: CONST.ONBOARDING_CHOICES.SUBMIT, inviteType: CONST.ONBOARDING_INVITE_TYPES.WORKSPACE});

expect(url).toBe(CONST.STORYLANE.EMPLOYEE_TOUR);
});
});

describe('Intro selected is Track Workspace', () => {
it('returns proper URL when screen is narrow', () => {
const url = getTestDriveURL(true, CONST.ONBOARDING_CHOICES.TRACK_WORKSPACE);
const url = getTestDriveURL(true, {choice: CONST.ONBOARDING_CHOICES.TRACK_WORKSPACE});

expect(url).toBe(CONST.STORYLANE.TRACK_WORKSPACE_TOUR_MOBILE);
});

it('returns proper URL when screen is not narrow', () => {
const url = getTestDriveURL(false, CONST.ONBOARDING_CHOICES.TRACK_WORKSPACE);
const url = getTestDriveURL(false, {choice: CONST.ONBOARDING_CHOICES.TRACK_WORKSPACE});

expect(url).toBe(CONST.STORYLANE.TRACK_WORKSPACE_TOUR);
});
});

describe('Intro selected is Track Workspace', () => {
describe('Default case - Admin tour', () => {
it('returns proper URL when screen is narrow', () => {
const url = getTestDriveURL(true);

Expand Down
Loading