diff --git a/src/libs/Navigation/AppNavigator/AuthScreens.tsx b/src/libs/Navigation/AppNavigator/AuthScreens.tsx
index abeae7e42701..daf4debb4041 100644
--- a/src/libs/Navigation/AppNavigator/AuthScreens.tsx
+++ b/src/libs/Navigation/AppNavigator/AuthScreens.tsx
@@ -15,6 +15,7 @@ import useOnboardingFlowRouter from '@hooks/useOnboardingFlow';
import {ReportIDsContextProvider} from '@hooks/useReportIDs';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useTheme from '@hooks/useTheme';
+import {connect} from '@libs/actions/Delegate';
import setFullscreenVisibility from '@libs/actions/setFullscreenVisibility';
import {READ_COMMANDS} from '@libs/API/types';
import HttpUtils from '@libs/HttpUtils';
@@ -276,11 +277,14 @@ function AuthScreens({session, lastOpenedPublicRoomID, initialLastUpdateIDApplie
PusherConnectionManager.init();
initializePusher();
+ const url = new URL(currentUrl);
+ const delegatorEmail = url.searchParams.get('delegatorEmail') ?? '';
+
// In Hybrid App we decide to call one of those method when booting ND and we don't want to duplicate calls
if (!CONFIG.IS_HYBRID_APP) {
// If we are on this screen then we are "logged in", but the user might not have "just logged in". They could be reopening the app
// or returning from background. If so, we'll assume they have some app data already and we can call reconnectApp() instead of openApp().
- if (SessionUtils.didUserLogInDuringSession()) {
+ if (SessionUtils.didUserLogInDuringSession() || delegatorEmail) {
App.openApp();
} else {
Log.info('[AuthScreens] Sending ReconnectApp');
@@ -292,6 +296,10 @@ function AuthScreens({session, lastOpenedPublicRoomID, initialLastUpdateIDApplie
App.setUpPoliciesAndNavigate(session);
+ if (delegatorEmail) {
+ connect(delegatorEmail, true);
+ }
+
App.redirectThirdPartyDesktopSignIn();
if (lastOpenedPublicRoomID) {
diff --git a/src/libs/Navigation/types.ts b/src/libs/Navigation/types.ts
index 5f3c43e6ec2b..70df546df230 100644
--- a/src/libs/Navigation/types.ts
+++ b/src/libs/Navigation/types.ts
@@ -1787,6 +1787,7 @@ type SharedScreensParamList = {
exitTo?: Routes | HybridAppRoute;
shouldForceLogin: string;
domain?: Routes;
+ delegatorEmail?: string;
};
[SCREENS.VALIDATE_LOGIN]: {
accountID: string;
diff --git a/src/libs/actions/Delegate.ts b/src/libs/actions/Delegate.ts
index da6e60717c4a..1454c949fe67 100644
--- a/src/libs/actions/Delegate.ts
+++ b/src/libs/actions/Delegate.ts
@@ -75,8 +75,8 @@ const KEYS_TO_PRESERVE_DELEGATE_ACCESS = [
ONYXKEYS.IS_SIDEBAR_LOADED,
];
-function connect(email: string) {
- if (!delegatedAccess?.delegators) {
+function connect(email: string, isFromOldDot = false) {
+ if (!delegatedAccess?.delegators && !isFromOldDot) {
return;
}
@@ -142,7 +142,7 @@ function connect(email: string) {
Onyx.update(failureData);
return;
}
- if (!activePolicyID) {
+ if (!activePolicyID && CONFIG.IS_HYBRID_APP) {
Log.alert('[Delegate] Unable to access activePolicyID');
Onyx.update(failureData);
return;
@@ -159,7 +159,7 @@ function connect(email: string) {
NetworkStore.setAuthToken(response?.restrictedToken ?? null);
confirmReadyToOpenApp();
openApp().then(() => {
- if (!CONFIG.IS_HYBRID_APP) {
+ if (!CONFIG.IS_HYBRID_APP || !policyID) {
return;
}
HybridAppModule.switchAccount({
diff --git a/src/pages/settings/ExitSurvey/ExitSurveyBookCall.tsx b/src/pages/settings/ExitSurvey/ExitSurveyBookCall.tsx
index 10085dd7a569..eb6f596d79ee 100644
--- a/src/pages/settings/ExitSurvey/ExitSurveyBookCall.tsx
+++ b/src/pages/settings/ExitSurvey/ExitSurveyBookCall.tsx
@@ -1,7 +1,6 @@
import React from 'react';
import {View} from 'react-native';
import Button from '@components/Button';
-import DelegateNoAccessWrapper from '@components/DelegateNoAccessWrapper';
import FixedFooter from '@components/FixedFooter';
import HeaderWithBackButton from '@components/HeaderWithBackButton';
import ScreenWrapper from '@components/ScreenWrapper';
@@ -10,7 +9,7 @@ import useLocalize from '@hooks/useLocalize';
import useNetwork from '@hooks/useNetwork';
import useThemeStyles from '@hooks/useThemeStyles';
import Navigation from '@navigation/Navigation';
-import * as Link from '@userActions/Link';
+import {openExternalLink} from '@userActions/Link';
import * as Expensicons from '@src/components/Icon/Expensicons';
import CONST from '@src/CONST';
import ROUTES from '@src/ROUTES';
@@ -23,60 +22,58 @@ function ExitSurveyBookCallPage() {
return (
-
- Navigation.goBack()}
+ Navigation.goBack()}
+ />
+
+ {isOffline && }
+ {!isOffline && (
+ <>
+ {translate('exitSurvey.bookACallTitle')}
+ {translate('exitSurvey.bookACallTextTop')}
+
+ {Object.values(CONST.EXIT_SURVEY.BENEFIT).map((value) => {
+ return (
+
+
+ {translate(`exitSurvey.benefits.${value}`)}
+
+ );
+ })}
+
+ {translate('exitSurvey.bookACallTextBottom')}
+ >
+ )}
+
+
+
+ {
+ Navigation.dismissModal();
+ openExternalLink(CONST.EXIT_SURVEY.BOOK_MEETING_LINK);
+ }}
+ isDisabled={isOffline}
+ />
+
);
}
diff --git a/src/pages/settings/ExitSurvey/ExitSurveyConfirmPage.tsx b/src/pages/settings/ExitSurvey/ExitSurveyConfirmPage.tsx
index fe4354a2986b..f7583d45dce9 100644
--- a/src/pages/settings/ExitSurvey/ExitSurveyConfirmPage.tsx
+++ b/src/pages/settings/ExitSurvey/ExitSurveyConfirmPage.tsx
@@ -4,7 +4,6 @@ import {useOnyx} from 'react-native-onyx';
import type {OnyxEntry} from 'react-native-onyx';
import Icon from '@components//Icon';
import Button from '@components/Button';
-import DelegateNoAccessWrapper from '@components/DelegateNoAccessWrapper';
import FixedFooter from '@components/FixedFooter';
import HeaderWithBackButton from '@components/HeaderWithBackButton';
import {MushroomTopHat} from '@components/Icon/Illustrations';
@@ -17,8 +16,8 @@ import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavig
import Navigation from '@navigation/Navigation';
import type {SettingsNavigatorParamList} from '@navigation/types';
import variables from '@styles/variables';
-import * as ExitSurvey from '@userActions/ExitSurvey';
-import * as Link from '@userActions/Link';
+import {switchToOldDot} from '@userActions/ExitSurvey';
+import {openOldDotLink} from '@userActions/Link';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
@@ -61,42 +60,40 @@ function ExitSurveyConfirmPage({route, navigation}: ExitSurveyConfirmPageProps)
return (
-
- Navigation.goBack()}
+ Navigation.goBack()}
+ />
+
+ {isOffline && }
+ {!isOffline && (
+ <>
+
+
+ {translate(shouldShowQuickTips ? 'exitSurvey.quickTip' : 'exitSurvey.thankYou')}
+
+ {translate(shouldShowQuickTips ? 'exitSurvey.quickTipSubTitle' : 'exitSurvey.thankYouSubtitle')}
+ >
+ )}
+
+
+ {
+ switchToOldDot();
+ Navigation.dismissModal();
+ openOldDotLink(CONST.OLDDOT_URLS.INBOX, true);
+ }}
+ isDisabled={isOffline}
/>
-
- {isOffline && }
- {!isOffline && (
- <>
-
-
- {translate(shouldShowQuickTips ? 'exitSurvey.quickTip' : 'exitSurvey.thankYou')}
-
- {translate(shouldShowQuickTips ? 'exitSurvey.quickTipSubTitle' : 'exitSurvey.thankYouSubtitle')}
- >
- )}
-
-
- {
- ExitSurvey.switchToOldDot();
- Navigation.dismissModal();
- Link.openOldDotLink(CONST.OLDDOT_URLS.INBOX, true);
- }}
- isDisabled={isOffline}
- />
-
-
+
);
}
diff --git a/src/pages/settings/ExitSurvey/ExitSurveyReasonPage.tsx b/src/pages/settings/ExitSurvey/ExitSurveyReasonPage.tsx
index 4e34fc47a6ed..a2cebae70c8c 100644
--- a/src/pages/settings/ExitSurvey/ExitSurveyReasonPage.tsx
+++ b/src/pages/settings/ExitSurvey/ExitSurveyReasonPage.tsx
@@ -1,7 +1,6 @@
import React, {useEffect, useMemo, useState} from 'react';
import type {OnyxEntry} from 'react-native-onyx';
import {useOnyx} from 'react-native-onyx';
-import DelegateNoAccessWrapper from '@components/DelegateNoAccessWrapper';
import FormProvider from '@components/Form/FormProvider';
import InputWrapper from '@components/Form/InputWrapper';
import HeaderWithBackButton from '@components/HeaderWithBackButton';
@@ -13,7 +12,7 @@ import useLocalize from '@hooks/useLocalize';
import useNetwork from '@hooks/useNetwork';
import useThemeStyles from '@hooks/useThemeStyles';
import Navigation from '@navigation/Navigation';
-import * as ExitSurvey from '@userActions/ExitSurvey';
+import {saveExitReason} from '@userActions/ExitSurvey';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
@@ -49,49 +48,47 @@ function ExitSurveyReasonPage() {
return (
-
- Navigation.goBack()}
- />
- {
- const errors: Errors = {};
- if (!reason) {
- errors[INPUT_IDS.REASON] = translate('common.error.fieldRequired');
- }
- return errors;
- }}
- onSubmit={() => {
- if (!reason) {
- return;
- }
- ExitSurvey.saveExitReason(reason);
- Navigation.navigate(ROUTES.SETTINGS_EXIT_SURVEY_RESPONSE.getRoute(reason, ROUTES.SETTINGS_EXIT_SURVEY_REASON.route));
- }}
- submitButtonText={translate('common.next')}
- shouldValidateOnBlur
- shouldValidateOnChange
- >
- {isOffline && }
- {!isOffline && (
- <>
- {translate('exitSurvey.reasonPage.title')}
- {translate('exitSurvey.reasonPage.subtitle')}
- void}
- shouldSaveDraft
- />
- >
- )}
-
-
+ Navigation.goBack()}
+ />
+ {
+ const errors: Errors = {};
+ if (!reason) {
+ errors[INPUT_IDS.REASON] = translate('common.error.fieldRequired');
+ }
+ return errors;
+ }}
+ onSubmit={() => {
+ if (!reason) {
+ return;
+ }
+ saveExitReason(reason);
+ Navigation.navigate(ROUTES.SETTINGS_EXIT_SURVEY_RESPONSE.getRoute(reason, ROUTES.SETTINGS_EXIT_SURVEY_REASON.route));
+ }}
+ submitButtonText={translate('common.next')}
+ shouldValidateOnBlur
+ shouldValidateOnChange
+ >
+ {isOffline && }
+ {!isOffline && (
+ <>
+ {translate('exitSurvey.reasonPage.title')}
+ {translate('exitSurvey.reasonPage.subtitle')}
+ void}
+ shouldSaveDraft
+ />
+ >
+ )}
+
);
}
diff --git a/src/pages/settings/ExitSurvey/ExitSurveyResponsePage.tsx b/src/pages/settings/ExitSurvey/ExitSurveyResponsePage.tsx
index ba451cf8ce55..2cd201afe238 100644
--- a/src/pages/settings/ExitSurvey/ExitSurveyResponsePage.tsx
+++ b/src/pages/settings/ExitSurvey/ExitSurveyResponsePage.tsx
@@ -1,6 +1,5 @@
import React, {useCallback, useEffect} from 'react';
import {useOnyx} from 'react-native-onyx';
-import DelegateNoAccessWrapper from '@components/DelegateNoAccessWrapper';
import FormProvider from '@components/Form/FormProvider';
import InputWrapper from '@components/Form/InputWrapper';
import HeaderWithBackButton from '@components/HeaderWithBackButton';
@@ -87,52 +86,50 @@ function ExitSurveyResponsePage({route, navigation}: ExitSurveyResponsePageProps
testID={ExitSurveyResponsePage.displayName}
shouldEnableMaxHeight
>
-
- Navigation.goBack()}
- />
- {
- const errors: Errors = {};
- if (!draftResponse?.trim()) {
- errors[INPUT_IDS.RESPONSE] = translate('common.error.fieldRequired');
- } else if (draftResponse.length > CONST.MAX_COMMENT_LENGTH) {
- errors[INPUT_IDS.RESPONSE] = translate('common.error.characterLimitExceedCounter', {
- length: draftResponse.length,
- limit: CONST.MAX_COMMENT_LENGTH,
- });
- }
- return errors;
- }}
- shouldValidateOnBlur
- shouldValidateOnChange
- >
- {isOffline && }
- {!isOffline && (
- <>
- {translate(`exitSurvey.prompts.${reason}`)}
-
- >
- )}
-
-
+ Navigation.goBack()}
+ />
+ {
+ const errors: Errors = {};
+ if (!draftResponse?.trim()) {
+ errors[INPUT_IDS.RESPONSE] = translate('common.error.fieldRequired');
+ } else if (draftResponse.length > CONST.MAX_COMMENT_LENGTH) {
+ errors[INPUT_IDS.RESPONSE] = translate('common.error.characterLimitExceedCounter', {
+ length: draftResponse.length,
+ limit: CONST.MAX_COMMENT_LENGTH,
+ });
+ }
+ return errors;
+ }}
+ shouldValidateOnBlur
+ shouldValidateOnChange
+ >
+ {isOffline && }
+ {!isOffline && (
+ <>
+ {translate(`exitSurvey.prompts.${reason}`)}
+
+ >
+ )}
+
);
}
diff --git a/src/pages/settings/InitialSettingsPage.tsx b/src/pages/settings/InitialSettingsPage.tsx
index d63cfd6a0407..8fc5223a9089 100755
--- a/src/pages/settings/InitialSettingsPage.tsx
+++ b/src/pages/settings/InitialSettingsPage.tsx
@@ -10,7 +10,6 @@ import AccountSwitcher from '@components/AccountSwitcher';
import AccountSwitcherSkeletonView from '@components/AccountSwitcherSkeletonView';
import ConfirmModal from '@components/ConfirmModal';
import CustomStatusBarAndBackgroundContext from '@components/CustomStatusBarAndBackground/CustomStatusBarAndBackgroundContext';
-import DelegateNoAccessModal from '@components/DelegateNoAccessModal';
import Icon from '@components/Icon';
import * as Expensicons from '@components/Icon/Expensicons';
import MenuItem from '@components/MenuItem';
@@ -90,10 +89,6 @@ function InitialSettingsPage({currentUserPersonalDetails}: InitialSettingsPagePr
const [privatePersonalDetails] = useOnyx(ONYXKEYS.PRIVATE_PERSONAL_DETAILS);
const [tryNewDot] = useOnyx(ONYXKEYS.NVP_TRYNEWDOT);
- const [isActingAsDelegate] = useOnyx(ONYXKEYS.ACCOUNT, {selector: (account) => !!account?.delegatedAccess?.delegate});
-
- const [isNoDelegateAccessMenuVisible, setIsNoDelegateAccessMenuVisible] = useState(false);
-
const network = useNetwork();
const theme = useTheme();
const styles = useThemeStyles();
@@ -257,10 +252,6 @@ function InitialSettingsPage({currentUserPersonalDetails}: InitialSettingsPagePr
}
: {
action() {
- if (isActingAsDelegate) {
- setIsNoDelegateAccessMenuVisible(true);
- return;
- }
resetExitSurveyForm(() => {
if (shouldOpenBookACall) {
Navigation.navigate(ROUTES.SETTINGS_EXIT_SURVERY_BOOK_CALL.route);
@@ -298,7 +289,7 @@ function InitialSettingsPage({currentUserPersonalDetails}: InitialSettingsPagePr
},
],
};
- }, [styles.pt4, setRootStatusBarEnabled, isActingAsDelegate, shouldOpenBookACall, signOut]);
+ }, [styles.pt4, setRootStatusBarEnabled, shouldOpenBookACall, signOut]);
/**
* Retuns JSX.Element with menu items
@@ -467,10 +458,6 @@ function InitialSettingsPage({currentUserPersonalDetails}: InitialSettingsPagePr
onCancel={() => toggleSignoutConfirmModal(false)}
/>
- setIsNoDelegateAccessMenuVisible(false)}
- />
);
}