Skip to content

Commit 50a6769

Browse files
authored
Merge pull request #65900 from callstack-internal/bugfix/65797
Update TestDrive link for invited employees
2 parents 3b13ae9 + f75c4d5 commit 50a6769

File tree

11 files changed

+57
-94
lines changed

11 files changed

+57
-94
lines changed

src/CONST/index.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ const onboardingInviteTypes = {
130130
IOU: 'iou',
131131
INVOICE: 'invoice',
132132
CHAT: 'chat',
133+
WORKSPACE: 'workspace',
133134
} as const;
134135

135136
const onboardingCompanySize = {
@@ -965,18 +966,15 @@ const CONST = {
965966
TEST_RECEIPT_URL: `${CLOUDFRONT_URL}/images/fake-receipt__tacotodds.png`,
966967
// Use Environment.getEnvironmentURL to get the complete URL with port number
967968
DEV_NEW_EXPENSIFY_URL: 'https://dev.new.expensify.com:',
968-
NAVATTIC: {
969-
ADMIN_TOUR_PRODUCTION: 'https://expensify.navattic.com/kh204a7',
970-
ADMIN_TOUR_STAGING: 'https://expensify.navattic.com/3i300k18',
971-
EMPLOYEE_TOUR_PRODUCTION: 'https://expensify.navattic.com/35609gb',
972-
EMPLOYEE_TOUR_STAGING: 'https://expensify.navattic.com/cf15002s',
973-
COMPLETED: 'completed',
974-
},
975969
STORYLANE: {
976970
ADMIN_TOUR: 'https://app.storylane.io/demo/bbcreg8vccag?embed=inline',
977971
ADMIN_TOUR_MOBILE: 'https://app.storylane.io/demo/b6faqcdsxgww?embed=inline',
978972
TRACK_WORKSPACE_TOUR: 'https://app.storylane.io/share/agmsfwgasaed?embed=inline',
979973
TRACK_WORKSPACE_TOUR_MOBILE: 'https://app.storylane.io/share/wq4hiwsqvoho?embed=inline',
974+
975+
// At the moment we are using Navattic links, but it will be changed to Storylane in the future.
976+
EMPLOYEE_TOUR: 'https://expensify.navattic.com/35609gb',
977+
EMPLOYEE_TOUR_MOBILE: 'https://expensify.navattic.com/35609gb',
980978
},
981979
OLD_DOT_PUBLIC_URLS: {
982980
TERMS_URL: `${EXPENSIFY_URL}/terms`,

src/components/HTMLEngineProvider/HTMLRenderers/AnchorRenderer.tsx

Lines changed: 5 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,32 @@
11
import {Str} from 'expensify-common';
2-
import React, {useContext, useMemo} from 'react';
2+
import React, {useMemo} from 'react';
33
import type {StyleProp, TextStyle} from 'react-native';
4-
import {TNodeChildrenRenderer} from 'react-native-render-html';
54
import type {CustomRendererProps, TBlock} from 'react-native-render-html';
5+
import {TNodeChildrenRenderer} from 'react-native-render-html';
66
import AnchorForAttachmentsOnly from '@components/AnchorForAttachmentsOnly';
77
import AnchorForCommentsOnly from '@components/AnchorForCommentsOnly';
88
import * as HTMLEngineUtils from '@components/HTMLEngineProvider/htmlEngineUtils';
9-
import {ShowContextMenuContext} from '@components/ShowContextMenuContext';
109
import Text from '@components/Text';
11-
import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails';
1210
import useEnvironment from '@hooks/useEnvironment';
1311
import useHover from '@hooks/useHover';
14-
import useOnyx from '@hooks/useOnyx';
15-
import useParentReport from '@hooks/useParentReport';
16-
import useReportIsArchived from '@hooks/useReportIsArchived';
1712
import useStyleUtils from '@hooks/useStyleUtils';
1813
import useTheme from '@hooks/useTheme';
1914
import useThemeStyles from '@hooks/useThemeStyles';
20-
import {getInternalExpensifyPath, getInternalNewExpensifyPath, openExternalLink, openLink} from '@libs/actions/Link';
21-
import {isAnonymousUser} from '@libs/actions/Session';
22-
import {canActionTask, canModifyTask, completeTask} from '@libs/actions/Task';
23-
import {setSelfTourViewed} from '@libs/actions/Welcome';
24-
import {hasSeenTourSelector} from '@libs/onboardingSelectors';
25-
import {getNavatticURL} from '@libs/TourUtils';
15+
import {getInternalExpensifyPath, getInternalNewExpensifyPath, openLink} from '@libs/actions/Link';
2616
import tryResolveUrlFromApiRoot from '@libs/tryResolveUrlFromApiRoot';
2717
import CONST from '@src/CONST';
28-
import ONYXKEYS from '@src/ONYXKEYS';
2918

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

3524
function AnchorRenderer({tnode, style, key}: AnchorRendererProps) {
36-
const currentUserPersonalDetails = useCurrentUserPersonalDetails();
37-
const {report, action} = useContext(ShowContextMenuContext);
38-
const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED, {canBeMissing: true});
39-
const [viewTourTaskReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${introSelected?.viewTour}`, {canBeMissing: true});
40-
const [hasSeenTour = false] = useOnyx(ONYXKEYS.NVP_ONBOARDING, {
41-
selector: hasSeenTourSelector,
42-
canBeMissing: true,
43-
});
44-
const parentReport = useParentReport(report?.reportID);
45-
const isParentReportArchived = useReportIsArchived(parentReport?.reportID);
46-
const canModifyViewTourTask = canModifyTask(viewTourTaskReport, currentUserPersonalDetails.accountID, isParentReportArchived);
47-
const canActionViewTourTask = canActionTask(viewTourTaskReport, currentUserPersonalDetails.accountID, parentReport, isParentReportArchived);
48-
4925
const theme = useTheme();
5026
const styles = useThemeStyles();
5127
const StyleUtils = useStyleUtils();
5228
const htmlAttribs = tnode.attributes;
53-
const {environment, environmentURL} = useEnvironment();
29+
const {environmentURL} = useEnvironment();
5430
const {hovered, bind} = useHover();
5531
// An auth token is needed to download Expensify chat attachments
5632
const isAttachment = !!htmlAttribs[CONST.ATTACHMENT_SOURCE_ATTRIBUTE];
@@ -68,26 +44,13 @@ function AnchorRenderer({tnode, style, key}: AnchorRendererProps) {
6844

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

71-
const isInConciergeTaskView = action?.actionName === CONST.REPORT.ACTIONS.TYPE.CREATED && report?.type === CONST.REPORT.TYPE.TASK && report.ownerAccountID === CONST.ACCOUNT_ID.CONCIERGE;
72-
const isTourTask = attrHref === getNavatticURL(environment, introSelected?.choice) && (action?.actorAccountID === CONST.ACCOUNT_ID.CONCIERGE || isInConciergeTaskView);
73-
7447
const onLinkPress = useMemo(() => {
7548
if (internalNewExpensifyPath || internalExpensifyPath) {
7649
return () => openLink(attrHref, environmentURL, isAttachment);
7750
}
7851

79-
if (isTourTask && !hasSeenTour) {
80-
return () => {
81-
openExternalLink(attrHref);
82-
setSelfTourViewed(isAnonymousUser());
83-
if (viewTourTaskReport && canModifyViewTourTask && canActionViewTourTask) {
84-
completeTask(viewTourTaskReport);
85-
}
86-
};
87-
}
88-
8952
return undefined;
90-
}, [internalNewExpensifyPath, internalExpensifyPath, attrHref, environmentURL, isAttachment, isTourTask, hasSeenTour, viewTourTaskReport, canModifyViewTourTask, canActionViewTourTask]);
53+
}, [internalNewExpensifyPath, internalExpensifyPath, attrHref, environmentURL, isAttachment]);
9154

9255
if (!HTMLEngineUtils.isChildOfComment(tnode) && !isChildOfTaskTitle) {
9356
// This is not a comment from a chat, the AnchorForCommentsOnly uses a Pressable to create a context menu on right click.

src/components/TestDrive/TestDriveDemo.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ function TestDriveDemo() {
6464
<TestDriveBanner onPress={closeModal} />
6565
<FullPageOfflineBlockingView>
6666
<EmbeddedDemo
67-
url={getTestDriveURL(shouldUseNarrowLayout, introSelected?.choice)}
67+
url={getTestDriveURL(shouldUseNarrowLayout, introSelected)}
6868
iframeTitle={testDrive.EMBEDDED_DEMO_IFRAME_TITLE}
6969
/>
7070
</FullPageOfflineBlockingView>

src/libs/ReportUtils.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,6 @@ import {
211211
} from './ReportActionsUtils';
212212
import type {LastVisibleMessage} from './ReportActionsUtils';
213213
import {shouldRestrictUserBillableActions} from './SubscriptionUtils';
214-
import {getNavatticURL} from './TourUtils';
215214
import {
216215
getAttendees,
217216
getBillable,
@@ -10106,6 +10105,16 @@ function prepareOnboardingOnyxData(
1010610105
const firstAdminPolicy = getActivePolicies(allPolicies, currentUserEmail).find(
1010710106
(policy) => policy.type !== CONST.POLICY.TYPE.PERSONAL && getPolicyRole(policy, currentUserEmail) === CONST.POLICY.ROLE.ADMIN,
1010810107
);
10108+
10109+
let testDriveURL: string;
10110+
if (([CONST.ONBOARDING_CHOICES.MANAGE_TEAM, CONST.ONBOARDING_CHOICES.TEST_DRIVE_RECEIVER, CONST.ONBOARDING_CHOICES.TRACK_WORKSPACE] as OnboardingPurpose[]).includes(engagementChoice)) {
10111+
testDriveURL = ROUTES.TEST_DRIVE_DEMO_ROOT;
10112+
} else if (introSelected?.choice === CONST.ONBOARDING_CHOICES.SUBMIT && introSelected.inviteType === CONST.ONBOARDING_INVITE_TYPES.WORKSPACE) {
10113+
testDriveURL = ROUTES.TEST_DRIVE_DEMO_ROOT;
10114+
} else {
10115+
testDriveURL = ROUTES.TEST_DRIVE_MODAL_ROOT.route;
10116+
}
10117+
1010910118
const onboardingTaskParams: OnboardingTaskLinks = {
1011010119
integrationName,
1011110120
onboardingCompanySize: companySize ?? onboardingCompanySize,
@@ -10114,12 +10123,7 @@ function prepareOnboardingOnyxData(
1011410123
workspaceMembersLink: `${environmentURL}/${ROUTES.WORKSPACE_MEMBERS.getRoute(onboardingPolicyID)}`,
1011510124
workspaceMoreFeaturesLink: `${environmentURL}/${ROUTES.WORKSPACE_MORE_FEATURES.getRoute(onboardingPolicyID)}`,
1011610125
workspaceConfirmationLink: `${environmentURL}/${ROUTES.WORKSPACE_CONFIRMATION.getRoute(ROUTES.WORKSPACES_LIST.route)}`,
10117-
navatticURL: getNavatticURL(environment, engagementChoice),
10118-
testDriveURL: `${environmentURL}/${
10119-
([CONST.ONBOARDING_CHOICES.MANAGE_TEAM, CONST.ONBOARDING_CHOICES.TEST_DRIVE_RECEIVER, CONST.ONBOARDING_CHOICES.TRACK_WORKSPACE] as OnboardingPurpose[]).includes(engagementChoice)
10120-
? ROUTES.TEST_DRIVE_DEMO_ROOT
10121-
: ROUTES.TEST_DRIVE_MODAL_ROOT.route
10122-
}`,
10126+
testDriveURL: `${environmentURL}/${testDriveURL}`,
1012310127
workspaceAccountingLink: `${environmentURL}/${ROUTES.POLICY_ACCOUNTING.getRoute(onboardingPolicyID)}`,
1012410128
corporateCardLink: `${environmentURL}/${ROUTES.WORKSPACE_COMPANY_CARDS.getRoute(onboardingPolicyID)}`,
1012510129
};

src/libs/TourUtils.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
1-
import type {ValueOf} from 'type-fest';
21
import CONST from '@src/CONST';
3-
import type {OnboardingPurpose} from './actions/Welcome/OnboardingFlow';
2+
import type {IntroSelected} from './actions/Report';
43

5-
function getNavatticURL(environment: ValueOf<typeof CONST.ENVIRONMENT>, introSelected?: OnboardingPurpose) {
6-
const adminTourURL = environment === CONST.ENVIRONMENT.PRODUCTION ? CONST.NAVATTIC.ADMIN_TOUR_PRODUCTION : CONST.NAVATTIC.ADMIN_TOUR_STAGING;
7-
const employeeTourURL = environment === CONST.ENVIRONMENT.PRODUCTION ? CONST.NAVATTIC.EMPLOYEE_TOUR_PRODUCTION : CONST.NAVATTIC.EMPLOYEE_TOUR_STAGING;
8-
return introSelected === CONST.SELECTABLE_ONBOARDING_CHOICES.MANAGE_TEAM ? adminTourURL : employeeTourURL;
9-
}
4+
function getTestDriveURL(shouldUseNarrowLayout: boolean, introSelected?: IntroSelected) {
5+
if (introSelected?.choice === CONST.ONBOARDING_CHOICES.SUBMIT && introSelected.inviteType === CONST.ONBOARDING_INVITE_TYPES.WORKSPACE) {
6+
return shouldUseNarrowLayout ? CONST.STORYLANE.EMPLOYEE_TOUR_MOBILE : CONST.STORYLANE.EMPLOYEE_TOUR;
7+
}
108

11-
function getTestDriveURL(shouldUseNarrowLayout: boolean, introSelected?: OnboardingPurpose) {
12-
if (shouldUseNarrowLayout) {
13-
return introSelected === CONST.ONBOARDING_CHOICES.TRACK_WORKSPACE ? CONST.STORYLANE.TRACK_WORKSPACE_TOUR_MOBILE : CONST.STORYLANE.ADMIN_TOUR_MOBILE;
9+
if (introSelected?.choice === CONST.ONBOARDING_CHOICES.TRACK_WORKSPACE) {
10+
return shouldUseNarrowLayout ? CONST.STORYLANE.TRACK_WORKSPACE_TOUR_MOBILE : CONST.STORYLANE.TRACK_WORKSPACE_TOUR;
1411
}
1512

16-
return introSelected === CONST.ONBOARDING_CHOICES.TRACK_WORKSPACE ? CONST.STORYLANE.TRACK_WORKSPACE_TOUR : CONST.STORYLANE.ADMIN_TOUR;
13+
return shouldUseNarrowLayout ? CONST.STORYLANE.ADMIN_TOUR_MOBILE : CONST.STORYLANE.ADMIN_TOUR;
1714
}
1815

19-
export {getNavatticURL, getTestDriveURL};
16+
// eslint-disable-next-line import/prefer-default-export
17+
export {getTestDriveURL};

src/libs/actions/Welcome/OnboardingFlow.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ type OnboardingTaskLinks = Partial<{
5656
workspaceMembersLink: string;
5757
workspaceAccountingLink: string;
5858
workspaceConfirmationLink: string;
59-
navatticURL: string;
6059
testDriveURL: string;
6160
corporateCardLink: string;
6261
}>;

src/pages/ConciergePage.tsx

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {useFocusEffect, useRoute} from '@react-navigation/native';
1+
import {useFocusEffect} from '@react-navigation/native';
22
import React, {useCallback, useEffect, useRef} from 'react';
33
import {View} from 'react-native';
44
import ReportActionsSkeletonView from '@components/ReportActionsSkeletonView';
@@ -8,9 +8,7 @@ import useOnyx from '@hooks/useOnyx';
88
import useThemeStyles from '@hooks/useThemeStyles';
99
import {confirmReadyToOpenApp} from '@libs/actions/App';
1010
import {navigateToConciergeChat} from '@libs/actions/Report';
11-
import {completeTask} from '@libs/actions/Task';
1211
import Navigation from '@libs/Navigation/Navigation';
13-
import CONST from '@src/CONST';
1412
import ONYXKEYS from '@src/ONYXKEYS';
1513
import ROUTES from '@src/ROUTES';
1614

@@ -24,11 +22,6 @@ function ConciergePage() {
2422
const isUnmounted = useRef(false);
2523
const [session] = useOnyx(ONYXKEYS.SESSION, {canBeMissing: false});
2624
const [isLoadingReportData = true] = useOnyx(ONYXKEYS.IS_LOADING_REPORT_DATA, {canBeMissing: true});
27-
const route = useRoute();
28-
29-
const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED, {canBeMissing: true});
30-
const viewTourTaskReportID = introSelected?.viewTour;
31-
const [viewTourTaskReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${viewTourTaskReportID}`, {canBeMissing: true});
3225

3326
useFocusEffect(
3427
useCallback(() => {
@@ -39,21 +32,12 @@ function ConciergePage() {
3932
return;
4033
}
4134

42-
// Mark the viewTourTask as complete if we are redirected to Concierge after finishing the Navattic tour
43-
const {navattic} = (route.params as {navattic?: string}) ?? {};
44-
if (navattic === CONST.NAVATTIC.COMPLETED) {
45-
if (viewTourTaskReport) {
46-
if (viewTourTaskReport.stateNum !== CONST.REPORT.STATE_NUM.APPROVED || viewTourTaskReport.statusNum !== CONST.REPORT.STATUS_NUM.APPROVED) {
47-
completeTask(viewTourTaskReport);
48-
}
49-
}
50-
}
5135
navigateToConciergeChat(true, () => !isUnmounted.current);
5236
});
5337
} else {
5438
Navigation.navigate(ROUTES.HOME);
5539
}
56-
}, [session, isLoadingReportData, route.params, viewTourTaskReport]),
40+
}, [session, isLoadingReportData]),
5741
);
5842

5943
useEffect(() => {

src/pages/Search/EmptySearchView.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,8 @@ function EmptySearchView({hash, type, groupBy, hasResults}: EmptySearchViewProps
209209
if (
210210
introSelected?.choice === CONST.ONBOARDING_CHOICES.MANAGE_TEAM ||
211211
introSelected?.choice === CONST.ONBOARDING_CHOICES.TEST_DRIVE_RECEIVER ||
212-
introSelected?.choice === CONST.ONBOARDING_CHOICES.TRACK_WORKSPACE
212+
introSelected?.choice === CONST.ONBOARDING_CHOICES.TRACK_WORKSPACE ||
213+
(introSelected?.choice === CONST.ONBOARDING_CHOICES.SUBMIT && introSelected.inviteType === CONST.ONBOARDING_INVITE_TYPES.WORKSPACE)
213214
) {
214215
completeTestDriveTask(viewTourReport, viewTourReportID);
215216
Navigation.navigate(ROUTES.TEST_DRIVE_DEMO_ROOT);
@@ -379,6 +380,7 @@ function EmptySearchView({hash, type, groupBy, hasResults}: EmptySearchViewProps
379380
styles.textAlignLeft,
380381
styles.tripEmptyStateLottieWebView,
381382
introSelected?.choice,
383+
introSelected?.inviteType,
382384
hasResults,
383385
defaultViewItemHeader,
384386
hasSeenTour,

src/pages/home/sidebar/FloatingActionButtonAndPopover.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,8 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, isT
512512
if (
513513
introSelected?.choice === CONST.ONBOARDING_CHOICES.MANAGE_TEAM ||
514514
introSelected?.choice === CONST.ONBOARDING_CHOICES.TEST_DRIVE_RECEIVER ||
515-
introSelected?.choice === CONST.ONBOARDING_CHOICES.TRACK_WORKSPACE
515+
introSelected?.choice === CONST.ONBOARDING_CHOICES.TRACK_WORKSPACE ||
516+
(introSelected?.choice === CONST.ONBOARDING_CHOICES.SUBMIT && introSelected.inviteType === CONST.ONBOARDING_INVITE_TYPES.WORKSPACE)
516517
) {
517518
completeTestDriveTask(viewTourReport, viewTourReportID, isAnonymousUser());
518519
Navigation.navigate(ROUTES.TEST_DRIVE_DEMO_ROOT);

src/types/onyx/Onboarding.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ type Onboarding = {
1212
/** A string that informs which qualifier the user selected during sign up */
1313
signupQualifier: ValueOf<typeof CONST.ONBOARDING_SIGNUP_QUALIFIERS>;
1414

15-
/** A Boolean that tells whether the user has seen navattic tour */
15+
/** A Boolean that tells whether the user has seen Storylane tour */
1616
selfTourViewed?: boolean;
1717

1818
/** A Boolean that tells whether the user should be redirected to OD after merging work email */

0 commit comments

Comments
 (0)