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
1 change: 0 additions & 1 deletion src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,6 @@ const CONST = {
COMPANY_CARD_FEEDS: 'companyCardFeeds',
DIRECT_FEEDS: 'directFeeds',
NETSUITE_USA_TAX: 'netsuiteUsaTax',
NEW_DOT_COPILOT: 'newDotCopilot',
COMBINED_TRACK_SUBMIT: 'combinedTrackSubmit',
CATEGORY_AND_TAG_APPROVERS: 'categoryAndTagApprovers',
PER_DIEM: 'newDotPerDiem',
Expand Down
4 changes: 1 addition & 3 deletions src/components/AccountSwitcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {useOnyx} from 'react-native-onyx';
import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails';
import useLocalize from '@hooks/useLocalize';
import useNetwork from '@hooks/useNetwork';
import usePermissions from '@hooks/usePermissions';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
Expand Down Expand Up @@ -34,7 +33,6 @@ function AccountSwitcher() {
const theme = useTheme();
const {translate} = useLocalize();
const {isOffline} = useNetwork();
const {canUseNewDotCopilot} = usePermissions();
const {shouldUseNarrowLayout} = useResponsiveLayout();
const [account] = useOnyx(ONYXKEYS.ACCOUNT);
const [session] = useOnyx(ONYXKEYS.SESSION);
Expand All @@ -47,7 +45,7 @@ function AccountSwitcher() {
const delegators = account?.delegatedAccess?.delegators ?? [];

const isActingAsDelegate = !!account?.delegatedAccess?.delegate ?? false;
const canSwitchAccounts = canUseNewDotCopilot && (delegators.length > 0 || isActingAsDelegate);
const canSwitchAccounts = delegators.length > 0 || isActingAsDelegate;

const createBaseMenuItem = (
personalDetails: PersonalDetails | undefined,
Expand Down
5 changes: 0 additions & 5 deletions src/libs/Permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ function canUseNetSuiteUSATax(betas: OnyxEntry<Beta[]>): boolean {
return !!betas?.includes(CONST.BETAS.NETSUITE_USA_TAX) || canUseAllBetas(betas);
}

function canUseNewDotCopilot(betas: OnyxEntry<Beta[]>): boolean {
return !!betas?.includes(CONST.BETAS.NEW_DOT_COPILOT) || canUseAllBetas(betas);
}

function canUseCategoryAndTagApprovers(betas: OnyxEntry<Beta[]>): boolean {
return !!betas?.includes(CONST.BETAS.CATEGORY_AND_TAG_APPROVERS) || canUseAllBetas(betas);
}
Expand Down Expand Up @@ -69,7 +65,6 @@ export default {
canUseCompanyCardFeeds,
canUseDirectFeeds,
canUseNetSuiteUSATax,
canUseNewDotCopilot,
canUseCombinedTrackSubmit,
canUseCategoryAndTagApprovers,
canUsePerDiem,
Expand Down
88 changes: 42 additions & 46 deletions src/pages/settings/Security/SecuritySettingsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import Section from '@components/Section';
import Text from '@components/Text';
import TextLink from '@components/TextLink';
import useLocalize from '@hooks/useLocalize';
import usePermissions from '@hooks/usePermissions';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useThemeStyles from '@hooks/useThemeStyles';
import useWaitForNavigation from '@hooks/useWaitForNavigation';
Expand All @@ -46,7 +45,6 @@ function SecuritySettingsPage() {
const {translate} = useLocalize();
const waitForNavigate = useWaitForNavigation();
const {shouldUseNarrowLayout} = useResponsiveLayout();
const {canUseNewDotCopilot} = usePermissions();
const {windowWidth} = useWindowDimensions();
const personalDetails = usePersonalDetails();

Expand Down Expand Up @@ -236,50 +234,48 @@ function SecuritySettingsPage() {
shouldUseSingleExecution
/>
</Section>
{!!canUseNewDotCopilot && (
<View style={safeAreaPaddingBottomStyle}>
<Section
title={translate('delegate.copilotDelegatedAccess')}
renderSubtitle={() => (
<Text style={[styles.flexRow, styles.alignItemsCenter, styles.w100, styles.mt2]}>
<Text style={[styles.textNormal, styles.colorMuted]}>{translate('delegate.copilotDelegatedAccessDescription')} </Text>
<TextLink
style={[styles.link]}
href={CONST.COPILOT_HELP_URL}
>
{translate('common.learnMore')}
</TextLink>
</Text>
)}
isCentralPane
subtitleMuted
titleStyles={styles.accountSettingsSectionTitle}
childrenStyles={styles.pt5}
>
{hasDelegates && (
<>
<Text style={[styles.textLabelSupporting, styles.pv1]}>{translate('delegate.membersCanAccessYourAccount')}</Text>
<MenuItemList menuItems={delegateMenuItems} />
</>
)}
{!isActingAsDelegate && (
<MenuItem
title={translate('delegate.addCopilot')}
icon={Expensicons.UserPlus}
onPress={() => Navigation.navigate(ROUTES.SETTINGS_ADD_DELEGATE)}
shouldShowRightIcon
wrapperStyle={[styles.sectionMenuItemTopDescription, styles.mb6]}
/>
)}
{hasDelegators && (
<>
<Text style={[styles.textLabelSupporting, styles.pv1]}>{translate('delegate.youCanAccessTheseAccounts')}</Text>
<MenuItemList menuItems={delegatorMenuItems} />
</>
)}
</Section>
</View>
)}
<View style={safeAreaPaddingBottomStyle}>
<Section
title={translate('delegate.copilotDelegatedAccess')}
renderSubtitle={() => (
<Text style={[styles.flexRow, styles.alignItemsCenter, styles.w100, styles.mt2]}>
<Text style={[styles.textNormal, styles.colorMuted]}>{translate('delegate.copilotDelegatedAccessDescription')} </Text>
<TextLink
style={[styles.link]}
href={CONST.COPILOT_HELP_URL}
>
{translate('common.learnMore')}
</TextLink>
</Text>
)}
isCentralPane
subtitleMuted
titleStyles={styles.accountSettingsSectionTitle}
childrenStyles={styles.pt5}
>
{hasDelegates && (
<>
<Text style={[styles.textLabelSupporting, styles.pv1]}>{translate('delegate.membersCanAccessYourAccount')}</Text>
<MenuItemList menuItems={delegateMenuItems} />
</>
)}
{!isActingAsDelegate && (
<MenuItem
title={translate('delegate.addCopilot')}
icon={Expensicons.UserPlus}
onPress={() => Navigation.navigate(ROUTES.SETTINGS_ADD_DELEGATE)}
shouldShowRightIcon
wrapperStyle={[styles.sectionMenuItemTopDescription, styles.mb6]}
/>
)}
{hasDelegators && (
<>
<Text style={[styles.textLabelSupporting, styles.pv1]}>{translate('delegate.youCanAccessTheseAccounts')}</Text>
<MenuItemList menuItems={delegatorMenuItems} />
</>
)}
</Section>
</View>
<Popover
isVisible={shouldShowDelegatePopoverMenu}
anchorRef={delegateButtonRef as RefObject<View>}
Expand Down