From 779270ce761e6f62b03654bcb5608d031d924768 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Musia=C5=82?= Date: Tue, 23 Dec 2025 10:41:38 +0100 Subject: [PATCH 01/31] Merge branch 'main' into feat/domain-report-sus-activity --- src/ONYXKEYS.ts | 2 +- src/SCREENS.ts | 2 +- src/languages/en.ts | 6 +-- .../Navigators/DomainSplitNavigator.tsx | 1 - src/libs/Navigation/types.ts | 2 +- .../domain/Admins/DomainAdminDetailsPage.tsx | 21 +++++---- src/pages/domain/Admins/DomainAdminsPage.tsx | 2 +- .../BaseDomainMemberDetailsComponent.tsx | 10 +--- src/pages/domain/BaseDomainMembersPage.tsx | 47 ++++++++++++------- .../domain/Members/DomainMembersPage.tsx | 21 ++++----- .../domain/Members/MembersDetailsPage.tsx | 7 ++- src/types/onyx/Domain.ts | 4 +- src/types/onyx/index.ts | 4 +- tests/unit/DomainSelectorsTest.ts | 3 +- 14 files changed, 70 insertions(+), 62 deletions(-) diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index cf6d9bb64b85..04d4f9129e54 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -1161,7 +1161,7 @@ type OnyxCollectionValuesMapping = { [ONYXKEYS.COLLECTION.EXPENSIFY_ADMIN_ACCESS_PREFIX]: number; [ONYXKEYS.COLLECTION.DOMAIN_PENDING_ACTIONS]: OnyxTypes.DomainPendingActions; [ONYXKEYS.COLLECTION.DOMAIN_ERRORS]: OnyxTypes.DomainErrors; - [ONYXKEYS.COLLECTION.DOMAIN_SECURITY_GROUP_PREFIX] : OnyxTypes.DomainSecurityGroup; + [ONYXKEYS.COLLECTION.DOMAIN_SECURITY_GROUP_PREFIX]: OnyxTypes.DomainSecurityGroup; }; type OnyxValuesMapping = { diff --git a/src/SCREENS.ts b/src/SCREENS.ts index cebb796df4e7..420d2f45a490 100644 --- a/src/SCREENS.ts +++ b/src/SCREENS.ts @@ -870,7 +870,7 @@ const SCREENS = { ADMINS_SETTINGS: 'Admins_Settings', ADD_PRIMARY_CONTACT: 'Add_Primary_Contact', MEMBERS: 'Domain_Members', - MEMBER_DETAILS:'Member_Details', + MEMBER_DETAILS: 'Member_Details', }, } as const; diff --git a/src/languages/en.ts b/src/languages/en.ts index 02d048ae56a0..f19e3fc3bde5 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -7874,11 +7874,11 @@ const translations = { `When enabled, the primary contact will pay for all workspaces owned by ${domainName} members and receive all billing receipts.`, consolidatedDomainBillingError: "Consolidated domain billing couldn't be changed. Please try again later.", }, - members:{ + members: { title: 'Members', findMember: 'Find member', - closeAccount:'Close account', - } + closeAccount: 'Close account', + }, }, }; diff --git a/src/libs/Navigation/AppNavigator/Navigators/DomainSplitNavigator.tsx b/src/libs/Navigation/AppNavigator/Navigators/DomainSplitNavigator.tsx index c6d75b979786..649f911492e0 100644 --- a/src/libs/Navigation/AppNavigator/Navigators/DomainSplitNavigator.tsx +++ b/src/libs/Navigation/AppNavigator/Navigators/DomainSplitNavigator.tsx @@ -16,7 +16,6 @@ const loadDomainSamlPage = () => require('../../../../page const loadDomainAdminsPage = () => require('../../../../pages/domain/Admins/DomainAdminsPage').default; const loadDomainMembersPage = () => require('../../../../pages/domain/Members/DomainMembersPage').default; - const Split = createSplitNavigator(); function DomainSplitNavigator({route, navigation}: PlatformStackScreenProps) { diff --git a/src/libs/Navigation/types.ts b/src/libs/Navigation/types.ts index 9502a725381c..137a8902fb97 100644 --- a/src/libs/Navigation/types.ts +++ b/src/libs/Navigation/types.ts @@ -2503,7 +2503,7 @@ type DomainSplitNavigatorParamList = { [SCREENS.DOMAIN.MEMBER_DETAILS]: { domainAccountID: number; accountID: number; - } + }; }; type OnboardingModalNavigatorParamList = { diff --git a/src/pages/domain/Admins/DomainAdminDetailsPage.tsx b/src/pages/domain/Admins/DomainAdminDetailsPage.tsx index c6cfb53d0a2e..80ec705c2dc2 100644 --- a/src/pages/domain/Admins/DomainAdminDetailsPage.tsx +++ b/src/pages/domain/Admins/DomainAdminDetailsPage.tsx @@ -16,15 +16,18 @@ function DomainAdminDetailsPage({route}: DomainAdminDetailsPageProps) { const {translate} = useLocalize(); const icons = useMemoizedLazyExpensifyIcons(['Info'] as const); - const menuItems = useMemo((): MemberDetailsMenuItem[] => [ - { - key: 'profile', - title: translate('common.profile'), - icon: icons.Info, - onPress: () => Navigation.navigate(ROUTES.PROFILE.getRoute(accountID, Navigation.getActiveRoute())), - shouldShowRightIcon: true, - }, - ], [accountID, icons.Info, translate]); + const menuItems = useMemo( + (): MemberDetailsMenuItem[] => [ + { + key: 'profile', + title: translate('common.profile'), + icon: icons.Info, + onPress: () => Navigation.navigate(ROUTES.PROFILE.getRoute(accountID, Navigation.getActiveRoute())), + shouldShowRightIcon: true, + }, + ], + [accountID, icons.Info, translate], + ); return ( & { accountID: number; @@ -58,16 +58,16 @@ type BaseDomainMembersPageProps = { }; function BaseDomainMembersPage({ - domainAccountID, - accountIDs, - headerTitle, - searchPlaceholder, - headerContent, - onSelectRow, - headerIcon, - getCustomRightElement, - isLoading = false, - }: BaseDomainMembersPageProps) { + domainAccountID, + accountIDs, + headerTitle, + searchPlaceholder, + headerContent, + onSelectRow, + headerIcon, + getCustomRightElement, + isLoading = false, +}: BaseDomainMembersPageProps) { const {formatPhoneNumber, localeCompare} = useLocalize(); const styles = useThemeStyles(); const {shouldUseNarrowLayout} = useResponsiveLayout(); @@ -114,12 +114,22 @@ function BaseDomainMembersPage({ if (filteredData.length === 0) { return null; } - return ; + return ( + + ); }; const listHeaderContent = data.length > CONST.SEARCH_ITEM_LIMIT ? ( - + ) : null; if (isLoading) { @@ -134,7 +144,12 @@ function BaseDomainMembersPage({ shouldShowOfflineIndicatorInWideScreen testID={BaseDomainMembersPage.displayName} > - + {!shouldUseNarrowLayout && !!headerContent && {headerContent}} diff --git a/src/pages/domain/Members/DomainMembersPage.tsx b/src/pages/domain/Members/DomainMembersPage.tsx index d5a2a061b670..981c9a0c5af8 100644 --- a/src/pages/domain/Members/DomainMembersPage.tsx +++ b/src/pages/domain/Members/DomainMembersPage.tsx @@ -1,19 +1,18 @@ -import { selectMemberIDs } from '@selectors/Domain'; +import {selectMemberIDs} from '@selectors/Domain'; import React from 'react'; -import { useMemoizedLazyIllustrations } from '@hooks/useLazyAsset'; +import {useMemoizedLazyIllustrations} from '@hooks/useLazyAsset'; import useLocalize from '@hooks/useLocalize'; import useOnyx from '@hooks/useOnyx'; import Navigation from '@navigation/Navigation'; -import type { PlatformStackScreenProps } from '@navigation/PlatformStackNavigation/types'; -import type { DomainSplitNavigatorParamList } from '@navigation/types'; -import type { MemberOption } from '@pages/domain/BaseDomainMembersPage'; +import type {PlatformStackScreenProps} from '@navigation/PlatformStackNavigation/types'; +import type {DomainSplitNavigatorParamList} from '@navigation/types'; +import type {MemberOption} from '@pages/domain/BaseDomainMembersPage'; import BaseDomainMembersPage from '@pages/domain/BaseDomainMembersPage'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; import isLoadingOnyxValue from '@src/types/utils/isLoadingOnyxValue'; - type DomainMembersPageProps = PlatformStackScreenProps; function DomainMembersPage({route}: DomainMembersPageProps) { @@ -21,16 +20,16 @@ function DomainMembersPage({route}: DomainMembersPageProps) { const {translate} = useLocalize(); const illustrations = useMemoizedLazyIllustrations(['Members']); - const [memberIDs,memberMetadata] = useOnyx(`${ONYXKEYS.COLLECTION.DOMAIN}${domainAccountID}`, { + const [memberIDs, memberMetadata] = useOnyx(`${ONYXKEYS.COLLECTION.DOMAIN}${domainAccountID}`, { canBeMissing: true, selector: selectMemberIDs, }); const openMemberDetails = (item: MemberOption) => { - Navigation.setNavigationActionToMicrotaskQueue(() => { - Navigation.navigate(ROUTES.DOMAIN_MEMBER_DETAILS.getRoute(domainAccountID, item.accountID)); - }); - } + Navigation.setNavigationActionToMicrotaskQueue(() => { + Navigation.navigate(ROUTES.DOMAIN_MEMBER_DETAILS.getRoute(domainAccountID, item.accountID)); + }); + }; return ( { - }} + onPress={() => {}} isDisabled icon={Expensicons.ClosedSign} style={styles.mb5} diff --git a/src/types/onyx/Domain.ts b/src/types/onyx/Domain.ts index 42fbfbcf50f3..f88fa1ac3009 100644 --- a/src/types/onyx/Domain.ts +++ b/src/types/onyx/Domain.ts @@ -1,7 +1,7 @@ import type ONYXKEYS from '@src/ONYXKEYS'; -import type * as OnyxCommon from './OnyxCommon'; -import SecurityGroup from '@src/types/onyx/SecurityGroup'; import type * as OnyxTypes from '@src/types/onyx/index'; +import SecurityGroup from '@src/types/onyx/SecurityGroup'; +import type * as OnyxCommon from './OnyxCommon'; /** * A utility type that creates a record where all keys are strings that start with a specified prefix. diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index 99adb40be37c..64f5977d7576 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -32,7 +32,7 @@ import type {OutstandingReportsByPolicyIDDerivedValue, ReportAttributesDerivedVa import type DismissedProductTraining from './DismissedProductTraining'; import type DismissedReferralBanners from './DismissedReferralBanners'; import type Domain from './Domain'; -import type {SamlMetadata, DomainSecurityGroup} from './Domain'; +import type {DomainSecurityGroup, SamlMetadata} from './Domain'; import type DomainErrors from './DomainErrors'; import type DomainPendingActions from './DomainPendingActions'; import type Download from './Download'; @@ -311,5 +311,5 @@ export type { SamlMetadata, DomainErrors, DomainPendingActions, - DomainSecurityGroup + DomainSecurityGroup, }; diff --git a/tests/unit/DomainSelectorsTest.ts b/tests/unit/DomainSelectorsTest.ts index 1de2264a8ae1..99280a6b6e38 100644 --- a/tests/unit/DomainSelectorsTest.ts +++ b/tests/unit/DomainSelectorsTest.ts @@ -1,4 +1,4 @@ -import {adminAccountIDsSelector, technicalContactSettingsSelector,selectMemberIDs} from '@selectors/Domain'; +import {adminAccountIDsSelector, selectMemberIDs, technicalContactSettingsSelector} from '@selectors/Domain'; import type {OnyxEntry} from 'react-native-onyx'; import ONYXKEYS from '@src/ONYXKEYS'; import type {CardFeeds, Domain} from '@src/types/onyx'; @@ -201,4 +201,3 @@ describe('domainSelectors', () => { }); }); }); - From 3c12ed114599c010182a44fc33171c7e669ed3af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Musia=C5=82?= Date: Tue, 23 Dec 2025 10:43:31 +0100 Subject: [PATCH 02/31] Merge branch 'main' into feat/domain-report-sus-activity --- src/ROUTES.ts | 4 ++ src/SCREENS.ts | 1 + src/languages/en.ts | 2 + .../ModalStackNavigators/index.tsx | 1 + .../linkingConfig/RELATIONS/DOMAIN_TO_RHP.ts | 2 +- src/libs/Navigation/linkingConfig/config.ts | 3 + src/libs/Navigation/types.ts | 4 ++ .../BaseDomainMemberDetailsComponent.tsx | 1 + .../DomainMembersReportSuspiciousActivity.tsx | 72 +++++++++++++++++++ .../domain/Members/MembersDetailsPage.tsx | 23 ++++-- 10 files changed, 107 insertions(+), 6 deletions(-) create mode 100644 src/pages/domain/Members/DomainMembersReportSuspiciousActivity.tsx diff --git a/src/ROUTES.ts b/src/ROUTES.ts index b343e8439fde..42de748bd417 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -3555,6 +3555,10 @@ const ROUTES = { route: 'domain/:domainAccountID/members/:accountID', getRoute: (domainAccountID: number, accountID: number) => `domain/${domainAccountID}/members/${accountID}` as const, }, + DOMAIN_MEMBER_REPORT_SUSPICIOUS_ACTIVITY: { + route: 'domain/:domainAccountID/members/:accountID/report-suspicious-activity', + getRoute: (domainAccountID: number, accountID: number) => `domain/${domainAccountID}/members/${accountID}/report-suspicious-activity` as const, + }, } as const; /** diff --git a/src/SCREENS.ts b/src/SCREENS.ts index 420d2f45a490..525d1f8215b6 100644 --- a/src/SCREENS.ts +++ b/src/SCREENS.ts @@ -871,6 +871,7 @@ const SCREENS = { ADD_PRIMARY_CONTACT: 'Add_Primary_Contact', MEMBERS: 'Domain_Members', MEMBER_DETAILS: 'Member_Details', + MEMBER_REPORT_SUSPICIOUS_ACTIVITY: 'Member_Report_Suspicious_Activity', }, } as const; diff --git a/src/languages/en.ts b/src/languages/en.ts index f19e3fc3bde5..6e6c8721a981 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -7878,6 +7878,8 @@ const translations = { title: 'Members', findMember: 'Find member', closeAccount: 'Close account', + reportSuspiciousActivityPrompt: (email: string) => + `Are you sure? This will lock ${email}'s account.

Our team will then review the account and remove any unauthorized access. To regain access, they'll need to work with Concierge.`, }, }, }; diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx index fbb258329998..ebd5ceabeb15 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx @@ -803,6 +803,7 @@ const SettingsModalStackNavigator = createModalStackNavigator require('../../../../pages/domain/Admins/DomainAdminsSettingsPage').default, [SCREENS.DOMAIN.ADD_PRIMARY_CONTACT]: () => require('../../../../pages/domain/Admins/DomainAddPrimaryContactPage').default, [SCREENS.DOMAIN.MEMBER_DETAILS]: () => require('../../../../pages/domain/members/MembersDetailsPage').default, + [SCREENS.DOMAIN.MEMBER_REPORT_SUSPICIOUS_ACTIVITY]: () => require('../../../../pages/domain/members/DomainMembersReportSuspiciousActivity').default, }); const TwoFactorAuthenticatorStackNavigator = createModalStackNavigator({ diff --git a/src/libs/Navigation/linkingConfig/RELATIONS/DOMAIN_TO_RHP.ts b/src/libs/Navigation/linkingConfig/RELATIONS/DOMAIN_TO_RHP.ts index 8d4333e9f93e..40dcdcfb8253 100755 --- a/src/libs/Navigation/linkingConfig/RELATIONS/DOMAIN_TO_RHP.ts +++ b/src/libs/Navigation/linkingConfig/RELATIONS/DOMAIN_TO_RHP.ts @@ -6,7 +6,7 @@ const DOMAIN_TO_RHP: Partial['config'] = { [SCREENS.DOMAIN.MEMBER_DETAILS]: { path: ROUTES.DOMAIN_MEMBER_DETAILS.route, }, + [SCREENS.DOMAIN.MEMBER_REPORT_SUSPICIOUS_ACTIVITY]: { + path: ROUTES.DOMAIN_MEMBER_REPORT_SUSPICIOUS_ACTIVITY.route, + }, }, }, [SCREENS.RIGHT_MODAL.TWO_FACTOR_AUTH]: { diff --git a/src/libs/Navigation/types.ts b/src/libs/Navigation/types.ts index 137a8902fb97..b1977ff7773e 100644 --- a/src/libs/Navigation/types.ts +++ b/src/libs/Navigation/types.ts @@ -1378,6 +1378,10 @@ type SettingsNavigatorParamList = { domainAccountID: number; accountID: number; }; + [SCREENS.DOMAIN.MEMBER_REPORT_SUSPICIOUS_ACTIVITY]: { + domainAccountID: number; + accountID: number; + }; } & ReimbursementAccountNavigatorParamList; type DomainCardNavigatorParamList = { diff --git a/src/pages/domain/BaseDomainMemberDetailsComponent.tsx b/src/pages/domain/BaseDomainMemberDetailsComponent.tsx index d7d903c6bb48..146a595dbe2d 100644 --- a/src/pages/domain/BaseDomainMemberDetailsComponent.tsx +++ b/src/pages/domain/BaseDomainMemberDetailsComponent.tsx @@ -18,6 +18,7 @@ import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import type {PersonalDetails} from '@src/types/onyx'; import type IconAsset from '@src/types/utils/IconAsset'; +import DomainNotFoundPageWrapper from './DomainNotFoundPageWrapper'; type MemberDetailsMenuItem = { key: string; diff --git a/src/pages/domain/Members/DomainMembersReportSuspiciousActivity.tsx b/src/pages/domain/Members/DomainMembersReportSuspiciousActivity.tsx new file mode 100644 index 000000000000..2481c3b915cf --- /dev/null +++ b/src/pages/domain/Members/DomainMembersReportSuspiciousActivity.tsx @@ -0,0 +1,72 @@ +import React from 'react'; +import Button from '@components/Button'; +import FixedFooter from '@components/FixedFooter'; +import HeaderWithBackButton from '@components/HeaderWithBackButton'; +import RenderHTML from '@components/RenderHTML'; +import ScreenWrapper from '@components/ScreenWrapper'; +import Text from '@components/Text'; +import useConfirmModal from '@hooks/useConfirmModal'; +import useLocalize from '@hooks/useLocalize'; +import useNetwork from '@hooks/useNetwork'; +import useThemeStyles from '@hooks/useThemeStyles'; +import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; +import type {SettingsNavigatorParamList} from '@navigation/types'; +import DomainNotFoundPageWrapper from '@pages/domain/DomainNotFoundPageWrapper'; +import ROUTES from '@src/ROUTES'; +import type SCREENS from '@src/SCREENS'; + +type DomainMembersReportSuspiciousActivityProps = PlatformStackScreenProps; + +function DomainMembersReportSuspiciousActivity({route}: DomainMembersReportSuspiciousActivityProps) { + const {domainAccountID, accountID} = route.params; + const {isOffline} = useNetwork(); + const styles = useThemeStyles(); + + const {translate} = useLocalize(); + + const {showConfirmModal} = useConfirmModal(); + + const handleReportSuspiciousActivity = () => { + showConfirmModal({ + title: translate('lockAccountPage.reportSuspiciousActivity'), + // prompt: translate('domain.members.reportSuspiciousActivityPrompt', 'test'), + confirmText: translate('lockAccountPage.lockAccount'), + shouldShowCancelButton: false, + danger: true, + }); + }; + + return ( + + + Navigation.goBack(ROUTES.DOMAIN_MEMBER_DETAILS.getRoute(domainAccountID, accountID))} + /> + + + + +