Skip to content

Commit 8cb7f86

Browse files
authored
Merge pull request #89187 from Expensify/beaman/612787-app-export-explain-button
[Payment due @jayeshmangwani] Add Explain button to auto-export system messages
2 parents b1951f7 + 447ed7c commit 8cb7f86

33 files changed

Lines changed: 481 additions & 9 deletions

File tree

src/CONST/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8611,6 +8611,7 @@ const CONST = {
86118611
HAS_POLICY_ADMIN_CARD_FEED_ERRORS: 'hasPolicyAdminCardFeedErrors',
86128612
HAS_DOMAIN_ERRORS: 'hasDomainErrors',
86138613
HAS_LOCKED_BANK_ACCOUNT: 'hasLockedBankAccount',
8614+
HAS_DEVICE_MANAGEMENT_ERROR: 'hasDeviceManagementError',
86148615
},
86158616

86168617
DEBUG: {
@@ -9632,6 +9633,7 @@ const CONST = {
96329633
REVOKE_MFA: 'SettingsSecurity-RevokeMFA',
96339634
MERGE_ACCOUNTS: 'SettingsSecurity-MergeAccounts',
96349635
LOCK_UNLOCK_ACCOUNT: 'SettingsSecurity-LockUnlockAccount',
9636+
DEVICE_MANAGEMENT: 'SettingsSecurity-DeviceManagement',
96359637
CLOSE_ACCOUNT: 'SettingsSecurity-CloseAccount',
96369638
ADD_COPILOT: 'SettingsSecurity-AddCopilot',
96379639
DELEGATE_ITEM: 'SettingsSecurity-DelegateItem',
@@ -9763,6 +9765,12 @@ const CONST = {
97639765
ROUTE_SOURCE: 'route-source',
97649766
ROUTE_FILL: 'route-fill',
97659767
},
9768+
9769+
PARTNER_ID: {
9770+
IPHONE: 14,
9771+
ANDROID: 16,
9772+
NEWDOT: 83,
9773+
},
97669774
} as const;
97679775

97689776
const CONTINUATION_DETECTION_SEARCH_FILTER_KEYS = [

src/ONYXKEYS.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@ const ONYXKEYS = {
114114
/** Contains latitude and longitude of user's last known location */
115115
USER_LOCATION: 'userLocation',
116116

117+
/** Contains metadata (partner, login, validation date) for all of the user's logins */
118+
LOGINS: 'logins',
119+
117120
/** Contains metadata (partner, login, validation date) for all of the user's logins */
118121
LOGIN_LIST: 'loginList',
119122

@@ -1374,6 +1377,7 @@ type OnyxValuesMapping = {
13741377
[ONYXKEYS.COUNTRY_CODE]: number;
13751378
[ONYXKEYS.COUNTRY]: string;
13761379
[ONYXKEYS.USER_LOCATION]: OnyxTypes.UserLocation;
1380+
[ONYXKEYS.LOGINS]: OnyxTypes.Logins;
13771381
[ONYXKEYS.LOGIN_LIST]: OnyxTypes.LoginList;
13781382
[ONYXKEYS.PENDING_CONTACT_ACTION]: OnyxTypes.PendingContactAction;
13791383
[ONYXKEYS.VALIDATE_ACTION_CODE]: OnyxTypes.ValidateMagicCodeAction;

src/ROUTES.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,7 @@ const ROUTES = {
725725
SETTINGS_PAYMENT_CURRENCY: 'setting/preferences/payment-currency',
726726
SETTINGS_THEME: 'settings/preferences/theme',
727727
SETTINGS_SECURITY: 'settings/security',
728+
SETTINGS_DEVICE_MANAGEMENT: 'settings/security/device-management',
728729
SETTINGS_CLOSE: 'settings/security/closeAccount',
729730
SETTINGS_MERGE_ACCOUNTS: {
730731
route: 'settings/security/merge-accounts',

src/SCREENS.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ const SCREENS = {
126126
UPDATE_PERSONAL_BANK_ACCOUNT: 'Settings_Update_Personal_Bank_Account',
127127
ADD_BANK_ACCOUNT_SELECT_COUNTRY_VERIFY_ACCOUNT: 'Settings_Add_Bank_Account_Select_Country_Verify_Account',
128128
BANK_ACCOUNT_PURPOSE: 'Settings_Bank_Account_Purpose',
129+
DEVICE_MANAGEMENT: 'Settings_Device_Management',
129130
CLOSE: 'Settings_Close',
130131
REPORT_CARD_LOST_OR_DAMAGED: 'Settings_ReportCardLostOrDamaged',
131132
REPORT_CARD_LOST_OR_DAMAGED_CONFIRM_MAGIC_CODE: 'Settings_ReportCardLostOrDamaged_ConfirmMagicCode',

src/components/ReportActionItem/ExportIntegration.tsx

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,38 @@ import type {OnyxEntry} from 'react-native-onyx';
55
import Text from '@components/Text';
66
import TextLink from '@components/TextLink';
77
import useLocalize from '@hooks/useLocalize';
8+
import useOnyx from '@hooks/useOnyx';
89
import useThemeStyles from '@hooks/useThemeStyles';
9-
import {getExportIntegrationActionFragments} from '@libs/ReportActionsUtils';
10-
import type {ReportAction} from '@src/types/onyx';
10+
import getNonEmptyStringOnyxID from '@libs/getNonEmptyStringOnyxID';
11+
import {getExportIntegrationActionFragments, getExportIntegrationMessageHTML, hasReasoning} from '@libs/ReportActionsUtils';
12+
import ReportActionItemMessageWithExplain from '@pages/inbox/report/ReportActionItemMessageWithExplain';
13+
import ONYXKEYS from '@src/ONYXKEYS';
14+
import type {Report, ReportAction} from '@src/types/onyx';
1115

1216
type ExportIntegrationProps = {
1317
action: OnyxEntry<ReportAction>;
18+
19+
/** Original report from which the given reportAction is first created */
20+
originalReport: OnyxEntry<Report>;
1421
};
1522

16-
function ExportIntegration({action}: ExportIntegrationProps) {
23+
function ExportIntegration({action, originalReport}: ExportIntegrationProps) {
1724
const styles = useThemeStyles();
1825
const {translate} = useLocalize();
26+
const [childReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${getNonEmptyStringOnyxID(action?.childReportID)}`);
27+
28+
if (hasReasoning(action)) {
29+
const message = getExportIntegrationMessageHTML(translate, action);
30+
return (
31+
<ReportActionItemMessageWithExplain
32+
message={message}
33+
action={action}
34+
childReport={childReport}
35+
originalReport={originalReport}
36+
/>
37+
);
38+
}
39+
1940
const fragments = getExportIntegrationActionFragments(translate, action);
2041

2142
return (

src/hooks/useAccountIndicatorChecks.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {hasPaymentMethodError} from '@libs/actions/PaymentMethods';
22
import {hasPartiallySetupBankAccount, hasPersonalBankAccountMissingInfo} from '@libs/BankAccountUtils';
33
import {hasPendingExpensifyCardAction} from '@libs/CardUtils';
44
import {hasSubscriptionGreenDotInfo, hasSubscriptionRedDotError} from '@libs/SubscriptionUtils';
5-
import {hasLoginListError, hasLoginListInfo} from '@libs/UserUtils';
5+
import {hasDeviceManagementError, hasLoginListError, hasLoginListInfo} from '@libs/UserUtils';
66
import CONST from '@src/CONST';
77
import ONYXKEYS from '@src/ONYXKEYS';
88
import type IndicatorStatus from '@src/types/utils/IndicatorStatus';
@@ -33,6 +33,7 @@ function useAccountIndicatorChecks(): AccountIndicatorChecksResult {
3333
const [session] = useOnyx(ONYXKEYS.SESSION);
3434
const [reimbursementAccount] = useOnyx(ONYXKEYS.REIMBURSEMENT_ACCOUNT);
3535
const [policies] = useOnyx(ONYXKEYS.COLLECTION.POLICY);
36+
const [hasDeviceManagementErrorValue] = useOnyx(ONYXKEYS.LOGINS, {selector: hasDeviceManagementError});
3637

3738
const {
3839
companyCards: {shouldShowRBR: hasCompanyCardFeedErrors},
@@ -59,6 +60,7 @@ function useAccountIndicatorChecks(): AccountIndicatorChecksResult {
5960
[CONST.INDICATOR_STATUS.HAS_PHONE_NUMBER_ERROR]: !!privatePersonalDetails?.errorFields?.phoneNumber,
6061
[CONST.INDICATOR_STATUS.HAS_EMPLOYEE_CARD_FEED_ERRORS]: !isPolicyAdmin ? hasCompanyCardFeedErrors : false,
6162
[CONST.INDICATOR_STATUS.HAS_LOCKED_BANK_ACCOUNT]: Object.values(bankAccountList ?? {}).some((bankAccount) => bankAccount?.accountData?.state === CONST.BANK_ACCOUNT.STATE.LOCKED),
63+
[CONST.INDICATOR_STATUS.HAS_DEVICE_MANAGEMENT_ERROR]: hasDeviceManagementErrorValue,
6264
};
6365

6466
const infoChecks: Partial<Record<IndicatorStatus, boolean>> = {

src/languages/de.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2206,6 +2206,12 @@ const translations: TranslationDeepObject<typeof en> = {
22062206
chatToConciergeToUnlock: 'Chatte mit Concierge, um Sicherheitsbedenken zu klären und dein Konto zu entsperren.',
22072207
chatWithConcierge: 'Mit Concierge chatten',
22082208
},
2209+
deviceManagementPage: {
2210+
title: 'Geräteverwaltung',
2211+
description: 'Verwalten Sie alle Geräte, auf denen Sie sich mit Ihrem Expensify-Konto angemeldet haben.',
2212+
revoke: 'Widerrufen',
2213+
unknownDevice: 'Unbekanntes Gerät',
2214+
},
22092215
twoFactorAuth: {
22102216
headerTitle: 'Zwei-Faktor-Authentifizierung',
22112217
twoFactorAuthEnabled: 'Zwei-Faktor-Authentifizierung aktiviert',

src/languages/en.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2277,6 +2277,12 @@ const translations = {
22772277
chatToConciergeToUnlock: 'Chat with Concierge to resolve security concerns and unlock your account.',
22782278
chatWithConcierge: 'Chat with Concierge',
22792279
},
2280+
deviceManagementPage: {
2281+
title: 'Device management',
2282+
description: 'Manage all the devices that you have logged into with your Expensify Account.',
2283+
revoke: 'Revoke',
2284+
unknownDevice: 'Unknown Device',
2285+
},
22802286
twoFactorAuth: {
22812287
headerTitle: 'Two-factor authentication',
22822288
twoFactorAuthEnabled: 'Two-factor authentication enabled',

src/languages/es.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2111,6 +2111,12 @@ const translations: TranslationDeepObject<typeof en> = {
21112111
chatToConciergeToUnlock: 'Chatea con Concierge para resolver los problemas de seguridad y desbloquear tu cuenta.',
21122112
chatWithConcierge: 'Chatear con Concierge',
21132113
},
2114+
deviceManagementPage: {
2115+
title: 'Gestión de dispositivos',
2116+
description: 'Gestiona todos los dispositivos en los que has iniciado sesión con tu cuenta de Expensify.',
2117+
revoke: 'Revocar',
2118+
unknownDevice: 'Dispositivo Desconocido',
2119+
},
21142120
twoFactorAuth: {
21152121
headerTitle: 'Autenticación de dos factores',
21162122
twoFactorAuthEnabled: 'Autenticación de dos factores habilitada',

src/languages/fr.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2211,6 +2211,12 @@ const translations: TranslationDeepObject<typeof en> = {
22112211
chatToConciergeToUnlock: 'Discutez avec Concierge pour résoudre vos problèmes de sécurité et déverrouiller votre compte.',
22122212
chatWithConcierge: 'Discuter avec Concierge',
22132213
},
2214+
deviceManagementPage: {
2215+
title: 'Gestion des appareils',
2216+
description: 'Gérez tous les appareils sur lesquels vous vous êtes connecté avec votre compte Expensify.',
2217+
revoke: 'Révoquer',
2218+
unknownDevice: 'Appareil Inconnu',
2219+
},
22142220
twoFactorAuth: {
22152221
headerTitle: 'Authentification à deux facteurs',
22162222
twoFactorAuthEnabled: 'Authentification à deux facteurs activée',

0 commit comments

Comments
 (0)