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
3 changes: 0 additions & 3 deletions src/components/SidePanel/RHPVariantTest/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ const shouldOpenRHPVariant: ShouldOpenRHPVariant = () => {
const handleRHPVariantNavigation: HandleRHPVariantNavigation = (onboardingPolicyID) => {
Navigation.navigate(ROUTES.WORKSPACE_OVERVIEW.getRoute(onboardingPolicyID));
SidePanelActions.openSidePanel(true);
Navigation.isNavigationReady().then(() => {
Navigation.navigate(ROUTES.TEST_DRIVE_MODAL_ROOT.route);
});
};

export {shouldOpenRHPVariant, handleRHPVariantNavigation};
163 changes: 0 additions & 163 deletions src/libs/Navigation/guards/TestDriveModalGuard.ts

This file was deleted.

2 changes: 0 additions & 2 deletions src/libs/Navigation/guards/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import ONYXKEYS from '@src/ONYXKEYS';
import type {Session} from '@src/types/onyx';
import MigratedUserWelcomeModalGuard from './MigratedUserWelcomeModalGuard';
import OnboardingGuard from './OnboardingGuard';
import TestDriveModalGuard from './TestDriveModalGuard';
import type {GuardContext, GuardResult, NavigationGuard} from './types';

/**
Expand Down Expand Up @@ -102,7 +101,6 @@ function clearGuards(): void {

registerGuard(OnboardingGuard);
registerGuard(MigratedUserWelcomeModalGuard);
Comment on lines 102 to 103

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Keep the test-drive modal guard registered

Removing registerGuard(TestDriveModalGuard) drops the modal-active blocking logic while the app still navigates users to ROUTES.TEST_DRIVE_MODAL_ROOT in the RHP onboarding path (src/components/SidePanel/RHPVariantTest/index.ts). In that flow, if a user switches tabs before the modal overlay is fully mounted, DISMISS_MODAL can no longer pop the modal because handleDismissModalAction only succeeds when the last route is a modal (src/libs/Navigation/AppNavigator/createRootStackNavigator/GetStateForActionHandlers.ts), which leaves affected onboarding users in a broken navigation state.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The Test Drive modal is removed from the RHP onboarding path

registerGuard(TestDriveModalGuard);

export {registerGuard, createGuardContext, evaluateGuards, getRegisteredGuards, clearGuards};
export type {NavigationGuard, GuardResult, GuardContext};
11 changes: 2 additions & 9 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,7 @@
};

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

Check warning on line 1039 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) => {
conciergeReportIDOnyxConnect = value;
Expand All @@ -1044,7 +1044,7 @@
});

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

Check warning on line 1047 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 @@ -1062,7 +1062,7 @@
let allPersonalDetails: OnyxEntry<PersonalDetailsList>;
let allPersonalDetailLogins: string[];
let currentUserPersonalDetails: OnyxEntry<PersonalDetails>;
Onyx.connect({

Check warning on line 1065 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 @@ -1074,7 +1074,7 @@
});

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

Check warning on line 1077 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),
Expand All @@ -1082,7 +1082,7 @@

let allPolicies: OnyxCollection<Policy>;
let policiesArray: Policy[] = [];
Onyx.connect({

Check warning on line 1085 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) => {
Expand All @@ -1092,7 +1092,7 @@
});

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

Check warning on line 1095 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_DRAFTS,
waitForCollectionCallback: true,
callback: (value) => (allPolicyDrafts = value),
Expand All @@ -1100,7 +1100,7 @@

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

Check warning on line 1103 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 @@ -1136,14 +1136,14 @@
});

let betaConfiguration: OnyxEntry<BetaConfiguration> = {};
Onyx.connect({

Check warning on line 1139 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.BETA_CONFIGURATION,
callback: (value) => (betaConfiguration = value ?? {}),
});

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

Check warning on line 1146 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 @@ -1169,7 +1169,7 @@
});

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

Check warning on line 1172 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 Down Expand Up @@ -6426,7 +6426,7 @@

function buildConciergeGreetingReportAction(reportID: string, greetingText: string, created: string): ReportAction {
return {
reportActionID: CONST.CONCIERGE_GREETING_ACTION_ID,
reportActionID: String(CONST.CONCIERGE_GREETING_ACTION_ID),
reportID,
actionName: CONST.REPORT.ACTIONS.TYPE.ADD_COMMENT,
actorAccountID: CONST.ACCOUNT_ID.CONCIERGE,
Expand Down Expand Up @@ -11616,14 +11616,7 @@
(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 testDriveURL = ROUTES.TEST_DRIVE_DEMO_ROOT;

const onboardingTaskParams: OnboardingTaskLinks = {
integrationName,
Expand Down
1 change: 0 additions & 1 deletion src/libs/actions/IOU/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11255,7 +11255,6 @@ function completePaymentOnboarding(
onboardingPolicyID,
paymentSelected,
wasInvited: true,
shouldSkipTestDriveModal: true,
companySize: introSelected?.companySize as OnboardingCompanySize,
introSelected,
isSelfTourViewed,
Expand Down
23 changes: 0 additions & 23 deletions src/libs/actions/Report/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4876,7 +4876,6 @@ type CompleteOnboardingProps = {
userReportedIntegration?: OnboardingAccounting;
wasInvited?: boolean;
selectedInterestedFeatures?: string[];
shouldSkipTestDriveModal?: boolean;
isInvitedAccountant?: boolean;
onboardingPurposeSelected?: OnboardingPurpose;
shouldWaitForRHPVariantInitialization?: boolean;
Expand All @@ -4897,7 +4896,6 @@ async function completeOnboarding({
userReportedIntegration,
wasInvited,
selectedInterestedFeatures,
shouldSkipTestDriveModal,
isInvitedAccountant,
onboardingPurposeSelected,
shouldWaitForRHPVariantInitialization = false,
Expand Down Expand Up @@ -4942,27 +4940,6 @@ async function completeOnboarding({
optimisticConciergeReportActionID,
};

// We should only set testDriveModalDismissed to false if it's not already true (i.e., if the modal hasn't been dismissed yet).
if (!shouldSkipTestDriveModal && onboarding?.testDriveModalDismissed !== true) {
optimisticData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: ONYXKEYS.NVP_ONBOARDING,
value: {testDriveModalDismissed: false},
});

successData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: ONYXKEYS.NVP_ONBOARDING,
value: {testDriveModalDismissed: false},
});

failureData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: ONYXKEYS.NVP_ONBOARDING,
value: {testDriveModalDismissed: null},
});
}

if (shouldWaitForRHPVariantInitialization) {
// Wait for the workspace to be created before completing the guided setup
await waitForWrites(SIDE_EFFECT_REQUEST_COMMANDS.COMPLETE_GUIDED_SETUP);
Expand Down
11 changes: 6 additions & 5 deletions src/libs/actions/Tour.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,19 @@ import type {IntroSelected} from './Report';
function startTestDrive(introSelected: IntroSelected | undefined, hasUserBeenAddedToNudgeMigration: boolean, isUserPaidPolicyMember: boolean) {
// eslint-disable-next-line @typescript-eslint/no-deprecated
InteractionManager.runAfterInteractions(() => {
if (
const shouldNavigateToDemo =
hasUserBeenAddedToNudgeMigration ||
isUserPaidPolicyMember ||
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.SUBMIT && introSelected.inviteType === CONST.ONBOARDING_INVITE_TYPES.WORKSPACE)
) {
(introSelected?.choice === CONST.ONBOARDING_CHOICES.SUBMIT && introSelected.inviteType === CONST.ONBOARDING_INVITE_TYPES.WORKSPACE);

if (shouldNavigateToDemo) {
Navigation.navigate(ROUTES.TEST_DRIVE_DEMO_ROOT);
} else {
Navigation.navigate(ROUTES.TEST_DRIVE_MODAL_ROOT.route);
return;
}
Navigation.navigate(ROUTES.TEST_DRIVE_DEMO_ROOT);
});
}

Expand Down
4 changes: 0 additions & 4 deletions src/libs/actions/Welcome/OnboardingFlow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,6 @@ function getOnboardingInitialPath(getOnboardingInitialPathParams: GetOnboardingI
const isIndividual = currentOnboardingValues?.signupQualifier === CONST.ONBOARDING_SIGNUP_QUALIFIERS.INDIVIDUAL;
const isCurrentOnboardingPurposeManageTeam = currentOnboardingPurposeSelected === CONST.ONBOARDING_CHOICES.MANAGE_TEAM;

if (onboardingInitialPath.includes(ROUTES.TEST_DRIVE_MODAL_ROOT.route)) {
return `/${ROUTES.TEST_DRIVE_MODAL_ROOT.route}`;
}

if (isVsb) {
Onyx.set(ONYXKEYS.ONBOARDING_PURPOSE_SELECTED, CONST.ONBOARDING_CHOICES.MANAGE_TEAM);
Onyx.set(ONYXKEYS.ONBOARDING_COMPANY_SIZE, CONST.ONBOARDING_COMPANY_SIZE.MICRO);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ function BaseOnboardingInterestedFeatures({shouldUseNativeStyles}: BaseOnboardin
firstName: currentUserPersonalDetails?.firstName,
lastName: currentUserPersonalDetails?.lastName,
selectedInterestedFeatures: featuresMap.filter((feature) => feature.enabled).map((feature) => feature.id),
shouldSkipTestDriveModal: !!policyID && !adminsChatReportID,
shouldWaitForRHPVariantInitialization: isSidePanelReportSupported,
introSelected,
isSelfTourViewed,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ function BaseOnboardingPersonalDetails({currentUserPersonalDetails, shouldUseNat
lastName,
adminsChatReportID: onboardingAdminsChatReportID,
onboardingPolicyID,
shouldSkipTestDriveModal: !!onboardingPolicyID && !mergedAccountConciergeReportID,
introSelected,
isSelfTourViewed,
betas,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ function BaseOnboardingWorkspaceInvite({shouldUseNativeStyles}: BaseOnboardingWo
lastName: currentUserPersonalDetails.lastName,
adminsChatReportID: onboardingAdminsChatReportID,
onboardingPolicyID,
shouldSkipTestDriveModal: !!onboardingPolicyID && !onboardingAdminsChatReportID,
isInvitedAccountant,
onboardingPurposeSelected,
introSelected,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ function BaseOnboardingWorkspaceOptional({shouldUseNativeStyles}: BaseOnboarding
lastName: currentUserPersonalDetails.lastName,
adminsChatReportID: resolvedAdminsChatReportID,
onboardingPolicyID: resolvedPolicyID,
shouldSkipTestDriveModal: (!!resolvedPolicyID && !resolvedAdminsChatReportID) || engagementChoice === CONST.ONBOARDING_CHOICES.PERSONAL_SPEND,
introSelected,
betas,
isSelfTourViewed,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ function BaseOnboardingWorkspaces({route, shouldUseNativeStyles}: BaseOnboarding
onboardingMessage: onboardingMessages[CONST.ONBOARDING_CHOICES.LOOKING_AROUND],
firstName: onboardingPersonalDetails?.firstName ?? '',
lastName: onboardingPersonalDetails?.lastName ?? '',
shouldSkipTestDriveModal: !!(policy.automaticJoiningEnabled ? policy.policyID : undefined),
companySize: onboardingCompanySize,
introSelected,
isSelfTourViewed,
Expand Down
2 changes: 0 additions & 2 deletions tests/actions/IOUTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15654,7 +15654,6 @@ describe('actions/IOU', () => {
engagementChoice: CONST.ONBOARDING_CHOICES.MANAGE_TEAM,
paymentSelected: CONST.PAYMENT_SELECTED.BBA,
wasInvited: true,
shouldSkipTestDriveModal: true,
companySize: CONST.ONBOARDING_COMPANY_SIZE.MICRO,
introSelected,
isSelfTourViewed: false,
Expand All @@ -15675,7 +15674,6 @@ describe('actions/IOU', () => {
engagementChoice: CONST.ONBOARDING_CHOICES.CHAT_SPLIT,
paymentSelected: CONST.PAYMENT_SELECTED.PBA,
wasInvited: true,
shouldSkipTestDriveModal: true,
companySize: CONST.ONBOARDING_COMPANY_SIZE.SMALL,
introSelected,
isSelfTourViewed: false,
Expand Down
4 changes: 2 additions & 2 deletions tests/actions/TourTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ describe('actions/Tour', () => {
expect(Navigation.navigate).toHaveBeenCalledWith(ROUTES.TEST_DRIVE_DEMO_ROOT);
});

it.each(onboardingChoices.filter((choice) => !onboardingDemoChoices.has(choice)))('should show the Test Drive modal if user has "%s" onboarding choice', async (choice) => {
it.each(onboardingChoices.filter((choice) => !onboardingDemoChoices.has(choice)))('should show the Test Drive demo if user has "%s" onboarding choice', async (choice) => {
startTestDrive({choice}, false, false);
await waitForBatchedUpdates();

expect(Navigation.navigate).toHaveBeenCalledWith(ROUTES.TEST_DRIVE_MODAL_ROOT.route);
expect(Navigation.navigate).toHaveBeenCalledWith(ROUTES.TEST_DRIVE_DEMO_ROOT);
});

it('should show the Test Drive demo if user is an invited employee', async () => {
Expand Down
Loading
Loading