From a3e502015a1cd0f0aa3fb154791d0bd84f85d7d0 Mon Sep 17 00:00:00 2001 From: Rodrigo Lino da Costa Date: Thu, 12 Feb 2026 12:06:59 -0300 Subject: [PATCH 1/4] Remove unused reportActions prop from PureReportActionItem MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The reportActions prop (entire sorted array of all report actions) was threaded through 4+ component levels to PureReportActionItem where it was never used in the render body. Its only usage was a deepEqual comparison in the memo comparator โ€” an expensive O(n) check on 50-100+ objects that protected against a no-op re-render. This prop was originally used in a withOnyx HOC key function but that usage was removed in April 2024 when it was replaced by parentReportActionForTransactionThread. The prop, eslint-disable, and deepEqual were left behind as dead code. Co-Authored-By: Claude Opus 4.6 --- .../MoneyRequestReportActionsList.tsx | 1 - src/components/SelectionListWithSections/ChatListItem.tsx | 1 - .../Debug/ReportAction/DebugReportActionCreatePage.tsx | 1 - src/pages/Debug/ReportAction/DebugReportActionPreview.tsx | 1 - src/pages/TransactionDuplicate/DuplicateTransactionItem.tsx | 1 - src/pages/inbox/report/PureReportActionItem.tsx | 5 ----- src/pages/inbox/report/ReportActionItemParentAction.tsx | 5 ----- src/pages/inbox/report/ReportActionsList.tsx | 1 - src/pages/inbox/report/ReportActionsListItemRenderer.tsx | 6 ------ tests/ui/PureReportActionItemTest.tsx | 5 ----- 10 files changed, 27 deletions(-) diff --git a/src/components/MoneyRequestReportView/MoneyRequestReportActionsList.tsx b/src/components/MoneyRequestReportView/MoneyRequestReportActionsList.tsx index 2529ce98a22d..35e7310ff5d9 100644 --- a/src/components/MoneyRequestReportView/MoneyRequestReportActionsList.tsx +++ b/src/components/MoneyRequestReportView/MoneyRequestReportActionsList.tsx @@ -568,7 +568,6 @@ function MoneyRequestReportActionsList({ allReports={allReports} policies={policies} reportAction={reportAction} - reportActions={reportActions} parentReportAction={parentReportAction} parentReportActionForTransactionThread={EmptyParentReportActionForTransactionThread} index={index} diff --git a/src/components/SelectionListWithSections/ChatListItem.tsx b/src/components/SelectionListWithSections/ChatListItem.tsx index c0684bf08164..bef3516aed61 100644 --- a/src/components/SelectionListWithSections/ChatListItem.tsx +++ b/src/components/SelectionListWithSections/ChatListItem.tsx @@ -76,7 +76,6 @@ function ChatListItem({ allReports={allReports} action={reportActionItem} report={report} - reportActions={[]} onPress={() => onSelectRow(item)} parentReportAction={undefined} displayAsGroup={false} diff --git a/src/pages/Debug/ReportAction/DebugReportActionCreatePage.tsx b/src/pages/Debug/ReportAction/DebugReportActionCreatePage.tsx index 2b64029efad6..3cc6c65c64a3 100644 --- a/src/pages/Debug/ReportAction/DebugReportActionCreatePage.tsx +++ b/src/pages/Debug/ReportAction/DebugReportActionCreatePage.tsx @@ -120,7 +120,6 @@ function DebugReportActionCreatePage({ policies={policies} action={JSON.parse(draftReportAction.replaceAll('\n', '')) as ReportAction} report={{reportID}} - reportActions={[]} parentReportAction={undefined} displayAsGroup={false} isMostRecentIOUReportAction={false} diff --git a/src/pages/Debug/ReportAction/DebugReportActionPreview.tsx b/src/pages/Debug/ReportAction/DebugReportActionPreview.tsx index a4a01140cb3e..c277025f1438 100644 --- a/src/pages/Debug/ReportAction/DebugReportActionPreview.tsx +++ b/src/pages/Debug/ReportAction/DebugReportActionPreview.tsx @@ -35,7 +35,6 @@ function DebugReportActionPreview({reportAction, reportID}: DebugReportActionPre policies={policies} action={reportAction ?? ({} as ReportAction)} report={report ?? ({} as Report)} - reportActions={[]} parentReportAction={undefined} displayAsGroup={false} isMostRecentIOUReportAction={false} diff --git a/src/pages/TransactionDuplicate/DuplicateTransactionItem.tsx b/src/pages/TransactionDuplicate/DuplicateTransactionItem.tsx index 89571c707048..7593939a6be5 100644 --- a/src/pages/TransactionDuplicate/DuplicateTransactionItem.tsx +++ b/src/pages/TransactionDuplicate/DuplicateTransactionItem.tsx @@ -80,7 +80,6 @@ function DuplicateTransactionItem({transaction, index, allReports, policies, onP report={report} parentReportAction={getReportAction(report?.parentReportID, report?.parentReportActionID)} index={index} - reportActions={Object.values(reportActions ?? {})} displayAsGroup={false} shouldDisplayNewMarker={false} isMostRecentIOUReportAction={false} diff --git a/src/pages/inbox/report/PureReportActionItem.tsx b/src/pages/inbox/report/PureReportActionItem.tsx index 1f4bd99431b4..219fa4a132bb 100644 --- a/src/pages/inbox/report/PureReportActionItem.tsx +++ b/src/pages/inbox/report/PureReportActionItem.tsx @@ -280,10 +280,6 @@ type PureReportActionItemProps = { /** The transaction thread report associated with the report for this action, if any */ transactionThreadReport?: OnyxEntry; - /** Array of report actions for the report for this action */ - // eslint-disable-next-line react/no-unused-prop-types - reportActions: OnyxTypes.ReportAction[]; - /** Report action belonging to the report's parent */ parentReportAction: OnyxEntry; @@ -2194,7 +2190,6 @@ export default memo(PureReportActionItem, (prevProps, nextProps) => { prevProps.linkedReportActionID === nextProps.linkedReportActionID && deepEqual(prevProps.report?.fieldList, nextProps.report?.fieldList) && deepEqual(prevProps.transactionThreadReport, nextProps.transactionThreadReport) && - deepEqual(prevProps.reportActions, nextProps.reportActions) && deepEqual(prevParentReportAction, nextParentReportAction) && prevProps.draftMessage === nextProps.draftMessage && prevProps.iouReport?.reportID === nextProps.iouReport?.reportID && diff --git a/src/pages/inbox/report/ReportActionItemParentAction.tsx b/src/pages/inbox/report/ReportActionItemParentAction.tsx index 21873a506331..22cb96b709ce 100644 --- a/src/pages/inbox/report/ReportActionItemParentAction.tsx +++ b/src/pages/inbox/report/ReportActionItemParentAction.tsx @@ -49,9 +49,6 @@ type ReportActionItemParentActionProps = { /** The transaction thread report associated with the current report, if any */ transactionThreadReport: OnyxEntry; - /** Array of report actions for this report */ - reportActions: OnyxTypes.ReportAction[]; - /** Report actions belonging to the report's parent */ parentReportAction: OnyxEntry; @@ -97,7 +94,6 @@ function ReportActionItemParentAction({ policies, report, transactionThreadReport, - reportActions, parentReportAction, index = 0, shouldHideThreadDividerLine = false, @@ -192,7 +188,6 @@ function ReportActionItemParentAction({ } parentReportAction={parentReportAction} report={ancestorReport} - reportActions={reportActions} transactionThreadReport={transactionThreadReport} action={ancestorReportAction} displayAsGroup={false} diff --git a/src/pages/inbox/report/ReportActionsList.tsx b/src/pages/inbox/report/ReportActionsList.tsx index 2824662771a4..8a6c457f10f2 100644 --- a/src/pages/inbox/report/ReportActionsList.tsx +++ b/src/pages/inbox/report/ReportActionsList.tsx @@ -696,7 +696,6 @@ function ReportActionsList({ allReports={allReports} policies={policies} reportAction={reportAction} - reportActions={sortedReportActions} parentReportAction={parentReportAction} parentReportActionForTransactionThread={parentReportActionForTransactionThread} index={index} diff --git a/src/pages/inbox/report/ReportActionsListItemRenderer.tsx b/src/pages/inbox/report/ReportActionsListItemRenderer.tsx index d0e564ec3d2e..6057cac393db 100644 --- a/src/pages/inbox/report/ReportActionsListItemRenderer.tsx +++ b/src/pages/inbox/report/ReportActionsListItemRenderer.tsx @@ -18,9 +18,6 @@ type ReportActionsListItemRendererProps = { /** All the data of the action item */ reportAction: ReportAction; - /** Array of report actions for the report */ - reportActions: ReportAction[]; - /** All the data of the transaction collection */ transactions?: Array>; @@ -109,7 +106,6 @@ function ReportActionsListItemRenderer({ allReports, policies, reportAction, - reportActions = [], transactions, parentReportAction, index, @@ -222,7 +218,6 @@ function ReportActionsListItemRenderer({ parentReportAction={parentReportAction} reportID={report.reportID} report={report} - reportActions={reportActions} transactionThreadReport={transactionThreadReport} index={index} isFirstVisibleReportAction={isFirstVisibleReportAction} @@ -250,7 +245,6 @@ function ReportActionsListItemRenderer({ transactionThreadReport={transactionThreadReport} parentReportActionForTransactionThread={parentReportActionForTransactionThread} action={action} - reportActions={reportActions} linkedReportActionID={linkedReportActionID} displayAsGroup={displayAsGroup} transactions={transactions} diff --git a/tests/ui/PureReportActionItemTest.tsx b/tests/ui/PureReportActionItemTest.tsx index 589612424e27..f413892b2056 100644 --- a/tests/ui/PureReportActionItemTest.tsx +++ b/tests/ui/PureReportActionItemTest.tsx @@ -89,7 +89,6 @@ describe('PureReportActionItem', () => { policies={undefined} personalPolicyID={undefined} report={undefined} - reportActions={[]} parentReportAction={undefined} action={action} displayAsGroup={false} @@ -269,7 +268,6 @@ describe('PureReportActionItem', () => { policies={{testPolicy: dewPolicy as Policy}} policy={dewPolicy as Policy} report={{reportID: 'testReport', policyID: 'testPolicy'}} - reportActions={[]} parentReportAction={undefined} action={action} displayAsGroup={false} @@ -329,7 +327,6 @@ describe('PureReportActionItem', () => { policies={{testPolicy: basicPolicy as Policy}} policy={basicPolicy as Policy} report={{reportID: 'testReport', policyID: 'testPolicy'}} - reportActions={[]} parentReportAction={undefined} action={action} displayAsGroup={false} @@ -400,7 +397,6 @@ describe('PureReportActionItem', () => { policies={undefined} personalPolicyID={undefined} report={report} - reportActions={[]} parentReportAction={undefined} action={action} displayAsGroup={false} @@ -466,7 +462,6 @@ describe('PureReportActionItem', () => { policies={undefined} personalPolicyID={undefined} report={report} - reportActions={[]} parentReportAction={undefined} action={action} displayAsGroup={false} From 009eb24d41024cd552ffecdcf22cc203a77cd48b Mon Sep 17 00:00:00 2001 From: Rodrigo Lino da Costa Date: Thu, 12 Feb 2026 14:41:32 -0300 Subject: [PATCH 2/4] Fix stale reportActions references after prop removal Remove reportActions from useCallback dependency arrays in ReportActionsList and MoneyRequestReportActionsList, and fix a missed test instance in PureReportActionItemTest. Co-Authored-By: Claude Opus 4.6 --- .../MoneyRequestReportView/MoneyRequestReportActionsList.tsx | 1 - src/pages/inbox/report/ReportActionsList.tsx | 1 - tests/ui/PureReportActionItemTest.tsx | 1 - 3 files changed, 3 deletions(-) diff --git a/src/components/MoneyRequestReportView/MoneyRequestReportActionsList.tsx b/src/components/MoneyRequestReportView/MoneyRequestReportActionsList.tsx index 35e7310ff5d9..c48c3676435a 100644 --- a/src/components/MoneyRequestReportView/MoneyRequestReportActionsList.tsx +++ b/src/components/MoneyRequestReportView/MoneyRequestReportActionsList.tsx @@ -595,7 +595,6 @@ function MoneyRequestReportActionsList({ }, [ visibleReportActions, - reportActions, parentReportAction, report, transactionThreadReport, diff --git a/src/pages/inbox/report/ReportActionsList.tsx b/src/pages/inbox/report/ReportActionsList.tsx index 8a6c457f10f2..290d6da4b447 100644 --- a/src/pages/inbox/report/ReportActionsList.tsx +++ b/src/pages/inbox/report/ReportActionsList.tsx @@ -734,7 +734,6 @@ function ReportActionsList({ emojiReactions, allReports, policies, - sortedReportActions, parentReportAction, parentReportActionForTransactionThread, report, diff --git a/tests/ui/PureReportActionItemTest.tsx b/tests/ui/PureReportActionItemTest.tsx index 4e4144367fc2..a0817bebef36 100644 --- a/tests/ui/PureReportActionItemTest.tsx +++ b/tests/ui/PureReportActionItemTest.tsx @@ -524,7 +524,6 @@ describe('PureReportActionItem', () => { policies={undefined} personalPolicyID={undefined} report={report} - reportActions={[]} parentReportAction={undefined} action={action} displayAsGroup={false} From 48bcac7a447ac5c15cd3e50eca50122f322246d1 Mon Sep 17 00:00:00 2001 From: Rodrigo Lino da Costa Date: Thu, 12 Feb 2026 16:25:10 -0300 Subject: [PATCH 3/4] Add index to PureReportActionItem memo comparator MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The removed deepEqual on reportActions was accidentally preventing stale index values โ€” when new messages arrived, the array changed, every item re-rendered, and picked up its updated position. Without that check, index can go stale, causing scrollToIndex in ReportActionItemMessageEdit to target the wrong row during editing. Co-Authored-By: Claude Opus 4.6 --- src/pages/inbox/report/PureReportActionItem.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/inbox/report/PureReportActionItem.tsx b/src/pages/inbox/report/PureReportActionItem.tsx index 219fa4a132bb..64e784c219a1 100644 --- a/src/pages/inbox/report/PureReportActionItem.tsx +++ b/src/pages/inbox/report/PureReportActionItem.tsx @@ -2183,6 +2183,7 @@ export default memo(PureReportActionItem, (prevProps, nextProps) => { prevProps.report?.description === nextProps.report?.description && isCompletedTaskReport(prevProps.report) === isCompletedTaskReport(nextProps.report) && prevProps.report?.managerID === nextProps.report?.managerID && + prevProps.index === nextProps.index && prevProps.shouldHideThreadDividerLine === nextProps.shouldHideThreadDividerLine && prevProps.report?.total === nextProps.report?.total && prevProps.report?.nonReimbursableTotal === nextProps.report?.nonReimbursableTotal && From 3235cb24170c09ccd7d47423c0892ad9a18c62d1 Mon Sep 17 00:00:00 2001 From: Rodrigo Lino da Costa Date: Mon, 16 Feb 2026 10:04:56 -0300 Subject: [PATCH 4/4] merge main --- .claude/agents/code-inline-reviewer.md | 1708 +---------------- .claude/scripts/createInlineComment.sh | 2 +- .claude/settings.json | 2 +- .claude/skills/coding-standards/SKILL.md | 57 + .../clean-react-1-composition-over-config.md | 171 ++ .../rules/clean-react-2-own-behavior.md | 125 ++ .../clean-react-3-context-free-contracts.md | 135 ++ .../clean-react-4-no-side-effect-spaghetti.md | 169 ++ .../rules/clean-react-5-narrow-state.md | 119 ++ .../rules/consistency-1-no-platform-checks.md | 57 + .../rules/consistency-2-no-magic-values.md | 53 + .../consistency-3-no-code-duplication.md | 74 + .../rules/consistency-4-no-unused-props.md | 68 + .../consistency-5-justify-eslint-disable.md | 47 + .../consistency-6-proper-error-handling.md | 60 + .../rules/perf-1-no-spread-in-renderitem.md | 54 + .../rules/perf-10-no-useeffect-parent-comm.md | 60 + .../rules/perf-11-optimize-data-selection.md | 57 + .../rules/perf-12-prevent-memory-leaks.md | 67 + .../rules/perf-13-hoist-iterator-calls.md | 75 + .../rules/perf-14-use-sync-external-store.md | 95 + .../rules/perf-15-cleanup-async-effects.md | 90 + .../rules/perf-16-guard-double-init.md | 75 + .../rules/perf-2-early-return.md | 56 + .../rules/perf-3-onyx-list-item-provider.md | 42 + .../rules/perf-5-shallow-comparison.md | 49 + .../rules/perf-6-derive-state-from-props.md | 57 + .../rules/perf-7-reset-via-key-prop.md | 62 + .../rules/perf-8-events-in-handlers.md | 62 + .../rules/perf-9-no-useeffect-chains.md | 71 + .github/scripts/extractAllowedRules.sh | 25 +- .github/workflows/buildAdHoc.yml | 472 +++++ .github/workflows/claude-review.yml | 10 +- .../workflows/deployBlockerInvestigation.yml | 2 +- .github/workflows/testBuild.yml | 394 +--- .github/workflows/testBuildOnPush.yml | 422 +--- .prettierrc.js | 2 +- .../@expensify/react-native-live-markdown.ts | 27 +- __mocks__/Illustrations.ts | 2 + android/app/build.gradle | 4 +- .../chat/bootsplash/BootSplashModule.java | 87 +- assets/images/receipt-body.svg | 2 +- .../simple-illustration__bankcoin.svg | 1 + .../simple-illustration__wallet-alt2.svg | 1 + contributingGuides/STYLE.md | 2 +- .../philosophies/AI-REVIEWER.md | 4 +- .../Unlisted/Compliance-Documentation.md | 88 +- .../reports-and-expenses/Create-an-Expense.md | 48 +- ...-Tracking-and-Set-a-Default-Hourly-Rate.md | 102 + .../travel-analytics/Overview-of-Analytics.md | 43 +- .../Configuring-Flight-Settings.md | 44 +- .../Configuring-Hotel-Settings.md | 78 +- ios/NewExpensify/Info.plist | 4 +- ios/NotificationServiceExtension/Info.plist | 4 +- ios/ShareViewController/Info.plist | 4 +- package-lock.json | 564 ++++-- package.json | 14 +- .../@shopify+flash-list+2.2.0.patch | 23 + patches/@shopify/flash-list/details.md | 8 + src/CONFIG.ts | 2 +- src/CONST/index.ts | 166 +- src/ONYXKEYS.ts | 6 +- src/ROUTES.ts | 47 +- src/SCREENS.ts | 2 + src/components/AnimatedCollapsible/index.tsx | 5 +- src/components/DistanceEReceipt.tsx | 4 - src/components/EReceipt.tsx | 23 +- src/components/EReceiptBody/index.android.tsx | 22 + src/components/EReceiptBody/index.tsx | 19 + src/components/EReceiptThumbnail.tsx | 14 +- .../Icon/chunks/illustrations.chunk.ts | 10 +- src/components/Icon/index.tsx | 9 +- src/components/Image/BaseImage.ios.tsx | 57 - ...Image.android.tsx => BaseImage.native.tsx} | 2 + src/components/Image/BaseImage.tsx | 3 + src/components/ImageSVG/index.android.tsx | 2 + src/components/ImageSVG/index.ios.tsx | 6 +- src/components/ImageSVG/types.ts | 4 +- src/components/InteractiveStepSubHeader.tsx | 14 +- src/components/KYCWall/BaseKYCWall.tsx | 8 +- src/components/MoneyReportHeader.tsx | 24 +- src/components/MoneyRequestAmountInput.tsx | 5 + .../MoneyRequestConfirmationList.tsx | 11 +- src/components/MoneyRequestHeader.tsx | 12 +- .../MoneyRequestReportActionsList.tsx | 12 +- .../MoneyRequestReportTransactionList.tsx | 5 +- .../SearchMoneyRequestReportEmptyState.tsx | 7 +- src/components/Navigation/DebugTabView.tsx | 8 +- .../Navigation/NavigationTabBar/index.tsx | 1 + src/components/NumberWithSymbolForm.tsx | 29 +- .../GenericPressable/implementation/index.tsx | 1 + .../MoneyRequestReceiptView.tsx | 37 + .../MoneyRequestReportPreviewContent.tsx | 75 +- .../MoneyRequestReportPreview/index.tsx | 3 +- .../MoneyRequestReportPreview/types.ts | 3 +- .../ReportActionItemImages.tsx | 5 +- src/components/ReportWelcomeText.tsx | 3 +- src/components/Rule/RuleSelectionBase.tsx | 7 +- .../FilterDropdowns/DateSelectPopup.tsx | 2 + .../Search/FilterDropdowns/DropdownButton.tsx | 6 +- .../FilterDropdowns/MultiSelectPopup.tsx | 3 + .../FilterDropdowns/SingleSelectPopup.tsx | 3 + .../FilterDropdowns/UserSelectPopup.tsx | 2 + .../Search/SearchAutocompleteInput.tsx | 40 +- .../Search/SearchAutocompleteList.tsx | 488 +++-- .../Search/SearchFilterPageFooterButtons.tsx | 3 + src/components/Search/SearchList/index.tsx | 2 + .../SearchPageHeader/SearchFiltersBar.tsx | 51 +- .../SearchPageHeaderInput.tsx | 41 +- .../SearchTypeMenuPopover.tsx | 2 + .../Search/SearchRouter/SearchRouter.tsx | 41 +- .../SelectionList/ListItem/BaseListItem.tsx | 2 +- .../SelectionList/ListItem/SplitListItem.tsx | 12 +- .../SplitListItem/SplitAmountInput.tsx | 1 + .../SelectionList/ListItem/types.ts | 2 + .../BaseSelectionListWithSections.tsx | 44 +- .../SelectionListWithSections/types.ts | 9 +- src/components/SelectionList/types.ts | 3 + .../CustomListHeader.tsx | 2 +- .../Search/ActionCell.tsx | 3 + .../Search/BaseListItemHeader.tsx | 1 + .../Search/ExpenseReportListItemRow.tsx | 2 + .../Search/TransactionGroupListExpanded.tsx | 2 + .../Search/TransactionGroupListItem.tsx | 1 + .../Search/TransactionListItem.tsx | 2 + .../SortableHeaderText.tsx | 6 +- .../SortableTableHeader.tsx | 1 + src/components/SettlementButton/index.tsx | 35 +- .../AppleAuthWrapper/index.ios.tsx | 11 +- .../SubStepForms/CountryFullStep.tsx | 41 +- src/components/TransactionItemRow/index.tsx | 4 + .../ValuePicker/ValueSelectionList.tsx | 2 + .../ValuePicker/ValueSelectorModal.tsx | 2 + src/components/ValuePicker/index.tsx | 3 + src/components/ValuePicker/types.ts | 11 +- src/hooks/useActiveAdminPolicies.ts | 18 + src/hooks/useAdvancedSearchFilters.ts | 4 +- src/hooks/useBulkPayOptions.ts | 21 +- src/hooks/useCardFeeds.tsx | 4 +- src/hooks/useCardFeedsForDisplay.ts | 4 +- src/hooks/useCompanyCards.ts | 68 +- src/hooks/usePaymentOptions.ts | 13 +- src/hooks/usePolicyForMovingExpenses.ts | 7 +- src/hooks/usePolicyForTransaction.ts | 20 +- src/hooks/useSearchTypeMenu.tsx | 4 + src/hooks/useSortedActiveAdminPolicies.ts | 14 + src/languages/de.ts | 25 +- src/languages/en.ts | 29 +- src/languages/es.ts | 29 +- src/languages/fr.ts | 21 +- src/languages/it.ts | 25 +- src/languages/ja.ts | 25 +- src/languages/nl.ts | 25 +- src/languages/pl.ts | 25 +- src/languages/pt-BR.ts | 25 +- src/languages/zh-hans.ts | 25 +- src/libs/API/index.ts | 6 +- src/libs/API/parameters/FreezeCardParams.ts | 6 + .../OpenReimbursementAccountPageParams.ts | 3 +- ...PersonalInformationForBankAccountParams.ts | 2 +- ...lidateBankAccountWithTransactionsParams.ts | 2 +- .../VerifyIdentityForBankAccountParams.ts | 2 +- src/libs/API/parameters/index.ts | 1 + src/libs/API/types.ts | 4 + src/libs/Authentication.ts | 4 +- src/libs/CardFeedUtils.ts | 39 +- src/libs/CardUtils.ts | 77 +- src/libs/ErrorUtils.ts | 4 +- src/libs/ExpenseRuleUtils.ts | 4 +- src/libs/LoginUtils.ts | 2 +- src/libs/ModifiedExpenseMessage.ts | 4 + .../ModalStackNavigators/index.tsx | 1 + .../Navigators/DomainSplitNavigator.tsx | 7 + .../useSplitNavigatorScreenOptions.ts | 8 +- src/libs/Navigation/Navigation.ts | 11 +- .../getSearchTopmostReportParams.ts | 62 - .../linkingConfig/RELATIONS/DOMAIN_TO_RHP.ts | 1 + .../RELATIONS/SETTINGS_TO_RHP.ts | 1 + src/libs/Navigation/linkingConfig/config.ts | 24 +- src/libs/Navigation/types.ts | 17 +- src/libs/Network/SequentialQueue.ts | 220 ++- src/libs/Network/index.ts | 3 +- .../PushNotification/NotificationType.ts | 27 +- .../parsePushNotificationPayload.ts | 10 +- .../subscribeToPushNotifications.ts | 9 +- src/libs/NumberUtils.ts | 42 +- src/libs/PolicyUtils.ts | 13 + src/libs/Pusher/types.ts | 4 +- src/libs/PusherUtils.ts | 9 +- src/libs/QuickActionUtils.ts | 21 +- src/libs/ReimbursementAccountUtils.ts | 12 +- src/libs/ReportActionsUtils.ts | 4 +- src/libs/ReportLayoutUtils.ts | 2 +- src/libs/ReportUtils.ts | 82 +- src/libs/SearchQueryUtils.ts | 14 +- src/libs/SearchUIUtils.ts | 10 +- src/libs/SubscriptionUtils.ts | 9 +- src/libs/TagUtils.ts | 10 +- src/libs/TagsOptionsListUtils.ts | 26 +- src/libs/TransactionPreviewUtils.ts | 2 +- src/libs/TransactionUtils/index.ts | 2 +- src/libs/actions/App.ts | 20 +- src/libs/actions/BankAccounts.ts | 38 +- src/libs/actions/Card.ts | 120 +- src/libs/actions/Delegate.ts | 4 +- src/libs/actions/Domain.ts | 28 +- src/libs/actions/IOU/Duplicate.ts | 12 +- src/libs/actions/IOU/Hold.ts | 11 +- src/libs/actions/IOU/MoneyRequest.ts | 19 +- src/libs/actions/IOU/Split.ts | 223 ++- src/libs/actions/IOU/index.ts | 160 +- src/libs/actions/ImportTransactions.ts | 4 +- src/libs/actions/MergeTransaction.ts | 28 +- .../OnyxDerived/configs/cardFeedErrors.ts | 4 +- src/libs/actions/OnyxUpdateManager/index.ts | 10 +- src/libs/actions/OnyxUpdateManager/types.ts | 3 +- .../utils/DeferredOnyxUpdates.ts | 10 +- src/libs/actions/OnyxUpdates.ts | 18 +- src/libs/actions/PaymentMethods.ts | 4 +- src/libs/actions/PersistedRequests.ts | 153 +- src/libs/actions/Policy/Member.ts | 45 +- src/libs/actions/Policy/Policy.ts | 106 +- src/libs/actions/PolicyConnections.ts | 4 +- src/libs/actions/QuickActionNavigation.ts | 5 + .../actions/ReimbursementAccount/index.ts | 7 +- .../ReimbursementAccount/navigation.ts | 18 +- .../resetNonUSDBankAccount.ts | 38 +- src/libs/actions/Report/index.ts | 42 +- src/libs/actions/Session/index.ts | 40 +- src/libs/actions/User.ts | 26 +- src/libs/actions/__mocks__/App.ts | 11 +- src/libs/actions/__mocks__/OnyxUpdates.ts | 7 +- src/libs/actions/applyOnyxUpdatesReliably.ts | 6 +- src/libs/getImageRecyclingKey.ts | 31 + .../middlewares/httpClientCancelledFilter.ts | 22 + src/libs/telemetry/middlewares/index.ts | 3 +- .../telemetry/trackExpenseCreationError.ts | 141 ++ .../LogInWithShortLivedAuthTokenPage.tsx | 13 +- src/pages/NewChatPage.tsx | 4 +- .../NonUSD/Finish/index.tsx | 2 +- .../ReimbursementAccountPage.tsx | 125 +- .../ReimbursementAccountVerifyAccountPage.tsx | 4 +- .../CompleteVerification.tsx | 7 +- .../components/BankAccountValidationForm.tsx | 2 +- .../components/Enable2FACard.tsx | 2 +- .../VerifyIdentity/VerifyIdentity.tsx | 4 - src/pages/Search/AdvancedSearchFilters.tsx | 35 +- .../Search/SavedSearchItemThreeDotMenu.tsx | 1 + src/pages/Search/SearchPage.tsx | 59 +- src/pages/Search/SearchSelectedNarrow.tsx | 10 +- src/pages/Search/SearchTypeMenu.tsx | 6 + src/pages/domain/BaseDomainMembersPage.tsx | 1 + src/pages/domain/Groups/DomainGroupsPage.tsx | 94 + .../domain/Members/DomainMembersPage.tsx | 27 +- src/pages/home/TimeSensitiveSection/index.tsx | 16 +- .../items/FixCompanyCardConnection.tsx | 10 +- .../inbox/report/PureReportActionItem.tsx | 11 +- .../AttachmentPickerWithMenuItems.tsx | 3 +- .../ReportActionCompose.tsx | 5 +- src/pages/inbox/report/ReportActionsList.tsx | 11 +- .../FloatingActionButtonAndPopover.tsx | 4 +- src/pages/iou/ReceiptDropUI.tsx | 4 +- src/pages/iou/SplitExpensePage.tsx | 43 +- src/pages/iou/request/IOURequestStartPage.tsx | 4 +- .../step/IOURequestEditReportCommon.tsx | 6 +- .../step/IOURequestStepConfirmation.tsx | 5 +- .../step/IOURequestStepDestination.tsx | 13 +- .../step/IOURequestStepDistanceOdometer.tsx | 201 +- .../iou/request/step/IOURequestStepReport.tsx | 10 +- .../request/step/IOURequestStepScan/index.tsx | 4 +- src/pages/settings/InitialSettingsPage.tsx | 4 +- .../settings/Rules/Fields/AddTagPage.tsx | 53 +- src/pages/settings/Rules/RulePageBase.tsx | 92 +- .../TwoFactorAuth/TwoFactorAuthWrapper.tsx | 6 +- .../Security/TwoFactorAuth/VerifyPage.tsx | 2 +- .../Wallet/BankAccountPurposePage/index.tsx | 43 + .../substeps/BankAccountPurpose.tsx | 57 + .../substeps/CountrySelection.tsx | 90 + .../settings/Wallet/CountrySelectionList.tsx | 96 + .../Wallet/ExpensifyCardPage/index.tsx | 43 +- .../InternationalDepositAccountContent.tsx | 30 +- .../InternationalDepositAccount/index.tsx | 11 +- .../substeps/CountrySelection.tsx | 96 +- .../NewBankAccountVerifyAccountPage.tsx | 14 +- .../Wallet/PersonalCardDetailsHeaderMenu.tsx | 10 - .../Wallet/WalletPage/CardDetails.tsx | 18 +- .../settings/Wallet/WalletPage/index.tsx | 20 +- .../signin/SAMLSignInPage/index.native.tsx | 122 +- src/pages/signin/Socials.tsx | 3 +- .../workspace/AccessOrNotFoundWrapper.tsx | 11 +- ...ConnectExistingBusinessBankAccountPage.tsx | 4 +- .../WorkspaceOverviewCurrencyPage.tsx | 2 +- .../WorkspaceCompanyCardsTable/index.tsx | 14 +- .../companyCards/addNew/AddNewCardPage.tsx | 11 +- .../distanceRates/PolicyDistanceRatesPage.tsx | 66 +- .../WorkspaceEditCardLimitTypePage.tsx | 72 +- .../WorkspaceExpensifyCardBankAccounts.tsx | 8 +- .../WorkspaceExpensifyCardPageEmptyState.tsx | 8 +- .../expensifyCard/issueNew/LimitTypeStep.tsx | 1 + .../invoices/WorkspaceInvoiceVBASection.tsx | 10 +- .../rules/MerchantRules/AddTagPage.tsx | 40 +- .../MerchantRules/MerchantRulePageBase.tsx | 65 +- .../workspace/rules/MerchantRulesSection.tsx | 4 +- .../workspace/tags/WorkspaceTagsPage.tsx | 74 +- .../WorkspaceTravelInvoicingSection.tsx | 8 +- ...ceTravelInvoicingSettlementAccountPage.tsx | 8 +- .../workflows/WorkspaceWorkflowsPage.tsx | 10 +- src/selectors/Card.ts | 55 +- src/selectors/Domain.ts | 21 + src/selectors/Policy.ts | 9 +- src/styles/index.ts | 4 + src/styles/utils/spacing.ts | 8 + src/types/form/ReimbursementAccountForm.ts | 2 +- src/types/onyx/IOU.ts | 7 + src/types/onyx/OnyxUpdatesFromServer.ts | 40 +- src/types/onyx/OriginalMessage.ts | 5 +- src/types/onyx/ReimbursementAccount.ts | 3 + src/types/onyx/Response.ts | 2 +- src/types/onyx/Session.ts | 3 + src/types/onyx/index.ts | 3 +- tests/actions/IOUTest.ts | 350 ---- tests/actions/IOUTest/SplitTest.ts | 4 +- tests/actions/OnyxUpdateManagerTest.ts | 8 +- tests/actions/SessionTest.ts | 95 +- tests/actions/connections/QuickbooksOnline.ts | 4 +- tests/perf-test/ReportUtils.perf-test.ts | 2 +- tests/ui/IOURequestStepHoursTest.tsx | 368 ++++ tests/ui/IOURequestStepTimeRateTest.tsx | 255 +++ tests/ui/PaginationTest.tsx | 2 +- tests/ui/TimeExpenseConfirmationTest.tsx | 336 ++++ tests/ui/UnreadIndicatorsTest.tsx | 4 +- tests/ui/WorkEmailOnboarding.tsx | 10 +- tests/unit/CardFeedErrorsDerivedValueTest.ts | 3 + tests/unit/CardFeedUtilsTest.ts | 4 + tests/unit/CardUtilsTest.ts | 748 ++++++++ tests/unit/DomainSelectorsTest.ts | 37 + tests/unit/OnyxUpdateManagerTest.ts | 8 +- tests/unit/OnyxUpdatesTest.ts | 4 +- tests/unit/PolicyUtilsTest.ts | 39 + tests/unit/QuickActionNavigationTest.ts | 16 + tests/unit/QuickActionUtilsTest.ts | 75 +- tests/unit/ReportUtilsTest.ts | 546 +++++- tests/unit/Search/SearchQueryUtilsTest.ts | 32 + .../unit/Search/buildSubstitutionsMapTest.ts | 3 + tests/unit/SplitExpenseAutoAdjustmentTest.ts | 408 ++++ tests/unit/SubscriptionUtilsTest.ts | 49 +- tests/unit/TagUtilsTest.ts | 82 +- tests/unit/TagsOptionsListUtilsTest.ts | 44 +- tests/unit/TimeTrackingUtilsTest.ts | 159 ++ tests/unit/TransactionPreviewUtils.test.ts | 2 +- tests/unit/TransactionUtilsTest.ts | 27 + tests/unit/generateTranslationsTest.ts | 8 - tests/unit/getImageRecyclingKeyTest.ts | 29 + .../unit/hooks/useActiveAdminPolicies.test.ts | 107 ++ tests/unit/hooks/useCompanyCards.test.ts | 391 +++- .../useSortedActiveAdminPolicies.test.ts | 65 + tests/unit/selectors/CardTest.ts | 110 ++ tests/unit/selectors/PolicyTest.ts | 60 +- tests/unit/usePolicyForMovingExpensesTest.ts | 212 ++ tests/utils/OnyxUpdateMockUtils.ts | 7 +- tests/utils/PusherHelper.ts | 8 +- tests/utils/TestHelper.ts | 15 +- 362 files changed, 12083 insertions(+), 5321 deletions(-) create mode 100644 .claude/skills/coding-standards/SKILL.md create mode 100644 .claude/skills/coding-standards/rules/clean-react-1-composition-over-config.md create mode 100644 .claude/skills/coding-standards/rules/clean-react-2-own-behavior.md create mode 100644 .claude/skills/coding-standards/rules/clean-react-3-context-free-contracts.md create mode 100644 .claude/skills/coding-standards/rules/clean-react-4-no-side-effect-spaghetti.md create mode 100644 .claude/skills/coding-standards/rules/clean-react-5-narrow-state.md create mode 100644 .claude/skills/coding-standards/rules/consistency-1-no-platform-checks.md create mode 100644 .claude/skills/coding-standards/rules/consistency-2-no-magic-values.md create mode 100644 .claude/skills/coding-standards/rules/consistency-3-no-code-duplication.md create mode 100644 .claude/skills/coding-standards/rules/consistency-4-no-unused-props.md create mode 100644 .claude/skills/coding-standards/rules/consistency-5-justify-eslint-disable.md create mode 100644 .claude/skills/coding-standards/rules/consistency-6-proper-error-handling.md create mode 100644 .claude/skills/coding-standards/rules/perf-1-no-spread-in-renderitem.md create mode 100644 .claude/skills/coding-standards/rules/perf-10-no-useeffect-parent-comm.md create mode 100644 .claude/skills/coding-standards/rules/perf-11-optimize-data-selection.md create mode 100644 .claude/skills/coding-standards/rules/perf-12-prevent-memory-leaks.md create mode 100644 .claude/skills/coding-standards/rules/perf-13-hoist-iterator-calls.md create mode 100644 .claude/skills/coding-standards/rules/perf-14-use-sync-external-store.md create mode 100644 .claude/skills/coding-standards/rules/perf-15-cleanup-async-effects.md create mode 100644 .claude/skills/coding-standards/rules/perf-16-guard-double-init.md create mode 100644 .claude/skills/coding-standards/rules/perf-2-early-return.md create mode 100644 .claude/skills/coding-standards/rules/perf-3-onyx-list-item-provider.md create mode 100644 .claude/skills/coding-standards/rules/perf-5-shallow-comparison.md create mode 100644 .claude/skills/coding-standards/rules/perf-6-derive-state-from-props.md create mode 100644 .claude/skills/coding-standards/rules/perf-7-reset-via-key-prop.md create mode 100644 .claude/skills/coding-standards/rules/perf-8-events-in-handlers.md create mode 100644 .claude/skills/coding-standards/rules/perf-9-no-useeffect-chains.md create mode 100644 .github/workflows/buildAdHoc.yml create mode 100644 assets/images/simple-illustrations/simple-illustration__bankcoin.svg create mode 100644 assets/images/simple-illustrations/simple-illustration__wallet-alt2.svg create mode 100644 docs/articles/new-expensify/workspaces/Enable-Time-Tracking-and-Set-a-Default-Hourly-Rate.md create mode 100644 patches/@shopify/flash-list/@shopify+flash-list+2.2.0.patch create mode 100644 patches/@shopify/flash-list/details.md create mode 100644 src/components/EReceiptBody/index.android.tsx create mode 100644 src/components/EReceiptBody/index.tsx delete mode 100644 src/components/Image/BaseImage.ios.tsx rename src/components/Image/{BaseImage.android.tsx => BaseImage.native.tsx} (94%) create mode 100644 src/hooks/useActiveAdminPolicies.ts create mode 100644 src/hooks/useSortedActiveAdminPolicies.ts create mode 100644 src/libs/API/parameters/FreezeCardParams.ts delete mode 100644 src/libs/Navigation/getSearchTopmostReportParams.ts create mode 100644 src/libs/getImageRecyclingKey.ts create mode 100644 src/libs/telemetry/middlewares/httpClientCancelledFilter.ts create mode 100644 src/libs/telemetry/trackExpenseCreationError.ts create mode 100644 src/pages/domain/Groups/DomainGroupsPage.tsx create mode 100644 src/pages/settings/Wallet/BankAccountPurposePage/index.tsx create mode 100644 src/pages/settings/Wallet/BankAccountPurposePage/substeps/BankAccountPurpose.tsx create mode 100644 src/pages/settings/Wallet/BankAccountPurposePage/substeps/CountrySelection.tsx create mode 100644 src/pages/settings/Wallet/CountrySelectionList.tsx create mode 100644 tests/ui/IOURequestStepHoursTest.tsx create mode 100644 tests/ui/IOURequestStepTimeRateTest.tsx create mode 100644 tests/ui/TimeExpenseConfirmationTest.tsx create mode 100644 tests/unit/SplitExpenseAutoAdjustmentTest.ts create mode 100644 tests/unit/TimeTrackingUtilsTest.ts create mode 100644 tests/unit/getImageRecyclingKeyTest.ts create mode 100644 tests/unit/hooks/useActiveAdminPolicies.test.ts create mode 100644 tests/unit/hooks/useSortedActiveAdminPolicies.test.ts create mode 100644 tests/unit/usePolicyForMovingExpensesTest.ts diff --git a/.claude/agents/code-inline-reviewer.md b/.claude/agents/code-inline-reviewer.md index 487bba3a6977..bddb0fd886dd 100644 --- a/.claude/agents/code-inline-reviewer.md +++ b/.claude/agents/code-inline-reviewer.md @@ -10,1700 +10,55 @@ model: inherit You are a **React Native Expert** โ€” an AI trained to evaluate code contributions to Expensify and create inline comments for specific violations. -Your job is to scan through changed files and create **inline comments** for specific violations based on the below rules. +Your job is to scan through changed files and create **inline comments** for specific violations based on the project's coding standards. ## Rules -Each rule includes: +Coding standards are defined as individual rule files in `.claude/skills/coding-standards/rules/`. -- A unique **Rule ID** -- **Search patterns**: Grep patterns to efficiently locate potential violations in large files -- **Pass/Fail condition** -- **Reasoning**: Technical explanation of why the rule is important -- Examples of good and bad usage - -### [PERF-1] No spread in list item's renderItem - -- **Search patterns**: `renderItem`, `...` (look for both in proximity) - -- **Condition**: Flag ONLY when ALL of these are true: - - - Code is inside a renderItem function (function passed to FlatList, SectionList, etc.) - - A spread operator (...) is used on an object - - That object is being passed as a prop to a component - - The spread creates a NEW object literal inline - - **DO NOT flag if:** - - - Spread is used outside renderItem - - Spread is on an array - - Object is created once outside renderItem and reused - - Spread is used to clone for local manipulation (not passed as prop) - -- **Reasoning**: `renderItem` functions execute for every visible list item on each render. Creating new objects with spread operators forces React to treat each item as changed, preventing reconciliation optimizations and causing unnecessary re-renders of child components. - -Good: - -```tsx - -``` - -Bad: - -```tsx - -``` - ---- - -### [PERF-2] Return early before expensive work - -- **Search patterns**: Function bodies where `if (!param)` or `if (param === undefined)` appears AFTER function calls that use `param` - -- **Condition**: Flag ONLY when ALL of these are true: - - - Code performs expensive work (function calls, iterations, API/Onyx reads) - - A simple check could short-circuit earlier - - The simple check happens AFTER the expensive work - - **DO NOT flag if**: - - - Simple checks already come first - - Validation requires the computed result - - Expensive work must run for side effects - -- **Reasoning**: Early returns prevent wasted computation. Validate inputs before passing them to expensive operations. - -Good: - -```ts -function clearReportActionErrors(reportID: string, reportAction: ReportAction) { - if (!reportAction?.reportActionID) { - return; - } - - const originalReportID = getOriginalReportID(reportID, reportAction); - // ... -} -``` - -Bad: - -```ts -function clearReportActionErrors(reportID: string, reportAction: ReportAction) { - const originalReportID = getOriginalReportID(reportID, reportAction); - - if (!reportAction?.reportActionID) { - return; - } - // ... -} -``` - ---- - -### [PERF-3] Use OnyxListItemProvider hooks instead of useOnyx in renderItem - -- **Search patterns**: `useOnyx` within components used in `renderItem` - -- **Condition**: Components rendered inside `renderItem` functions should use dedicated hooks from `OnyxListItemProvider` instead of individual `useOnyx` calls. -- **Reasoning**: Individual `useOnyx` calls in renderItem create separate subscriptions for each list item, causing memory overhead and update cascades. `OnyxListItemProvider` hooks provide optimized data access patterns specifically designed for list rendering performance. - -Good: - -```tsx -const personalDetails = usePersonalDetails(); -``` - -Bad: - -```tsx -const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST); -``` - ---- - -### [PERF-5] Use shallow comparisons instead of deep comparisons - -- **Search patterns**: `React.memo`, `deepEqual` - -- **Condition**: In `React.memo` and similar optimization functions, compare only specific relevant properties instead of using deep equality checks. -- **Reasoning**: Deep equality checks recursively compare all nested properties, creating performance overhead that often exceeds the re-render cost they aim to prevent. Shallow comparisons of specific relevant properties provide the same optimization benefits with minimal computational cost. - -Good: - -```tsx -memo(ReportActionItem, (prevProps, nextProps) => - prevProps.report.type === nextProps.report.type && - prevProps.report.reportID === nextProps.report.reportID && - prevProps.isSelected === nextProps.isSelected -) -``` - -Bad: - -```tsx -memo(ReportActionItem, (prevProps, nextProps) => - deepEqual(prevProps.report, nextProps.report) && - prevProps.isSelected === nextProps.isSelected -) -``` - ---- - -### [PERF-6] Derive state from props - -- **Condition**: Flag when useEffect updates state based on props or other state, when the value could be computed directly - -- **Reasoning**: Computing derived values directly in the component body ensures they're always synchronized with props/state and avoids unnecessary re-renders. - -Good: - -```tsx -function Form() { - const [firstName, setFirstName] = useState('Taylor'); - const [lastName, setLastName] = useState('Swift'); - - // โœ… Good: calculated during rendering - const fullName = firstName + ' ' + lastName; -} -``` - -Bad: - -```tsx -function Form() { - const [firstName, setFirstName] = useState('Taylor'); - const [lastName, setLastName] = useState('Swift'); - - // ๐Ÿ”ด Avoid: redundant state and unnecessary Effect - const [fullName, setFullName] = useState(''); - useEffect(() => { - setFullName(firstName + ' ' + lastName); - }, [firstName, lastName]); -} -``` - ---- - -### [PERF-7] Control component resets via key prop - -- **Condition**: - - Flag when useEffect resets all or most component state when a prop changes - - Should use `key` prop instead to reset the entire component - -- **Reasoning**: Using `key` prop for full resets is more React-idiomatic. When a prop changes and you need to reset all component state, the `key` prop causes React to unmount and remount the component, automatically resetting all state without needing useEffect. - -Good: - -```tsx -function ProfilePage({ userId }) { - return ; -} - -function ProfileView({ userId }) { - const [comment, setComment] = useState(''); - const [rating, setRating] = useState(0); - // Component resets when userId changes due to key prop -} -``` - -Bad: - -```tsx -// ๐Ÿ”ด Avoid: resetting all state with useEffect -function ProfilePage({ userId }) { - return ; -} - -function ProfileView({ userId }) { - const [comment, setComment] = useState(''); - const [rating, setRating] = useState(0); - - useEffect(() => { - setComment(''); // Reset when userId changes - setRating(0); - }, [userId]); -} -``` - ---- - -### [PERF-8] Handle events in event handlers - -- **Condition**: Flag when useEffect responds to user events that should be handled in event handlers - -- **Reasoning**: Event handlers provide immediate response and clearer code flow. useEffect adds unnecessary render cycles and makes the relationship between user action and response less clear. - -Good: - -```tsx -function BuyButton({ productId, onBuy }) { - function handleClick() { - // โœ… Good: handle event directly in event handler - onBuy(); - showNotification('Item purchased!'); - } - - return ; -} -``` - -Bad: - -```tsx -function BuyButton({ productId, onBuy }) { - const [isBuying, setIsBuying] = useState(false); - - // ๐Ÿ”ด Avoid: handling events in useEffect - useEffect(() => { - if (isBuying) { - onBuy(); - showNotification('Item purchased!'); - } - }, [isBuying, onBuy]); - - return ; -} -``` - ---- - -### [PERF-9] Avoid useEffect chains - -- **Condition**: Flag when multiple useEffects form a chain where one effect's state update triggers another effect - -- **Reasoning**: Chains of effects create complex dependencies, timing issues, and unnecessary renders. Logic should be restructured to avoid interdependent effects. - -Good: - -```tsx -function Form() { - const [firstName, setFirstName] = useState(''); - const [lastName, setLastName] = useState(''); - - // โœ… Good: compute derived values directly - const fullName = firstName + ' ' + lastName; - const isValid = firstName.length > 0 && lastName.length > 0; - - return ( -
- setFirstName(e.target.value)} /> - setLastName(e.target.value)} /> - {isValid && } -
- ); -} -``` - -Bad: - -```tsx -function Form() { - const [firstName, setFirstName] = useState(''); - const [lastName, setLastName] = useState(''); - const [fullName, setFullName] = useState(''); - const [isValid, setIsValid] = useState(false); - - // ๐Ÿ”ด Avoid: chain of effects - useEffect(() => { - setFullName(firstName + ' ' + lastName); - }, [firstName, lastName]); - - useEffect(() => { - setIsValid(fullName.length > 0); - }, [fullName]); -} -``` - ---- - -### [PERF-10] Communicate with parent components without useEffect - -- **Condition**: Flag when useEffect calls parent callbacks to communicate state changes or pass data to parent components - -- **Reasoning**: Parent-child communication should not use useEffect. Instead, lift the state up to the parent component and pass it down as props. This follows React's unidirectional data flow pattern, eliminates synchronization issues, reduces unnecessary renders, and makes the data flow clearer. Use useEffect only when synchronizing with external systems, not for parent-child communication. - -Good: - -```tsx -// Lifting state up -function Parent() { - const [value, setValue] = useState(''); - return ; -} - -function Child({ value, onChange }) { - return onChange(e.target.value)} />; -} -``` - -Bad: - -```tsx -// ๐Ÿ”ด Avoid: passing data via useEffect -function Child({ onValueChange }) { - const [value, setValue] = useState(''); - - useEffect(() => { - onValueChange(value); - }, [value, onValueChange]); - - return setValue(e.target.value)} />; -} -``` - ---- - -### [PERF-11] Optimize data selection and handling - -- **Search patterns**: `useOnyx`, `selector`, `.filter(`, `.map(` - -- **Condition**: Flag ONLY when ALL of these are true: - - - A component uses a broad data structure (e.g., entire object) without selecting specific fields - - This causes unnecessary re-renders when unrelated fields change - - OR unnecessary data filtering/fetching is performed (excluding necessary data, fetching already available data) - - **DO NOT flag if:** - - - Specific fields are already being selected or the data structure is static - - The filtering is necessary for correct functionality - - The fetched data is required and cannot be derived from existing data - - The function requires the entire object for valid operations - -- **Reasoning**: Using broad data structures or performing unnecessary data operations causes excessive re-renders and degrades performance. Selecting specific fields and avoiding redundant operations reduces render cycles and improves efficiency. - -Good: - -```tsx -function UserProfile({ userId }) { - const [user] = useOnyx(`${ONYXKEYS.USER}${userId}`, { - selector: (user) => ({ - name: user?.name, - avatar: user?.avatar, - }), - }); - return {user?.name}; -} -``` - -Bad: - -```tsx -function UserProfile({ userId }) { - const [user] = useOnyx(`${ONYXKEYS.USER}${userId}`); - // Component re-renders when any user field changes, even unused ones - return {user?.name}; -} -``` - ---- - -### [PERF-12] Prevent memory leaks in components and plugins - -- **Search patterns**: `setInterval`, `setTimeout`, `addEventListener`, `subscribe`, `useEffect` with missing cleanup - -- **Condition**: Flag ONLY when ALL of these are true: - - - A resource (timeout, interval, event listener, subscription, etc.) is created in a component - - The resource is not cleared upon component unmount - - Asynchronous operations are initiated without a corresponding cleanup mechanism - - **DO NOT flag if:** - - - The resource is cleared properly in a cleanup function (e.g., inside `useEffect` return) - - The resource is not expected to persist beyond the component's lifecycle - - The resource is managed by a library that handles cleanup automatically - - The operation is guaranteed to complete before the component unmounts - -- **Reasoning**: Failing to clear resources causes memory leaks, leading to increased memory consumption and potential crashes, especially in long-lived components or components that mount/unmount frequently. - -Good: - -```tsx -function TimerComponent() { - useEffect(() => { - const intervalId = setInterval(() => { - updateTimer(); - }, 1000); - - return () => { - clearInterval(intervalId); - }; - }, []); - - return Timer; -} -``` - -Bad: - -```tsx -function TimerComponent() { - useEffect(() => { - const intervalId = setInterval(() => { - updateTimer(); - }, 1000); - // Missing cleanup - interval will continue after unmount - }, []); - - return Timer; -} -``` - ---- - -### [PERF-13] Avoid iterator-independent function calls in array methods - -- **Search patterns**: `.map(`, `.reduce(`, `.filter(`, `.some(`, `.every(`, `.find(`, `.findIndex(`, `.flatMap(`, `.forEach(` - -- **Condition**: Flag when ALL of these are true: - - **For side-effect-free methods** (`.map`, `.reduce`, `.filter`, `.some`, `.every`, `.find`, `.findIndex`, `.flatMap`): - - A function call exists inside the callback - - The function call does NOT receive: - - The iterator variable directly (e.g., `transform(item)`) - - A property/value derived from the iterator (e.g., `format(item.name)`) - - The index parameter when used meaningfully (e.g., `generateId(index)`) - - The function is not a method called ON the iterator or iterator-derived value (e.g., `item.getValue()`) - - **For `.forEach`**: - - Same conditions as above, BUT also verify the side effect doesn't depend on iteration context - - If the function call would produce the same effect regardless of which iteration it runs in, flag it - - **DO NOT flag if:** - - - Function uses iterator, its parts or derived value based on iterator (e.g. `func(item.process())`) - - Function call depends on iterator (e.g. `item.value ?? getDefault()`) - - Function is used when mapping to new entities (e.g. `const thing = { id: createID() }`) - - Above but applied to index instead of iterator - -- **Reasoning**: Function calls inside iteration callbacks that don't use the iterator variable execute redundantly - producing the same result. This creates O(n) overhead that scales with data size. Hoisting these calls outside the loop eliminates redundant computation and improves performance, especially on large datasets like transaction lists or report collections. - -Good: - -```ts -// Hoist iterator-independent calls outside the loop -const config = getConfig(); - -const results = items.map((item) => item.value * config.multiplier); -``` - -```ts -// Function receives iterator or iterator-derived value -const formatted = items.map((item) => formatCurrency(item.amount)); -``` - -```ts -// Index used meaningfully -const indexed = items.map((item, index) => ({ ...item, id: generateId(index) })); -``` - -Bad: - -```ts -// getConfig() called on every iteration but doesn't use item -const results = items.map((item) => { - const config = getConfig(); - return item.value * config.multiplier; -}); -``` - ---- - -### [PERF-14] Use `useSyncExternalStore` for external store subscriptions - -- **Search patterns**: `addEventListener`, `subscribe`, `useEffect`, `useState` - -- **Condition**: Flag ONLY when ALL of these are true: - - - A `useEffect` subscribes to an external source (DOM events, third-party store, browser API) - - Inside the listener, at least one `setState` call directly mirrors an external value - (e.g., `setWidth(window.innerWidth)`, `setOnline(navigator.onLine)`) - - The pattern for that state variable follows: subscribe in setup, unsubscribe in cleanup, - `setState(externalValue)` in the listener - - Evaluate each state variable independently โ€” if one state variable is a raw mirror of an - external value, flag it even if the same effect also manages other state for different purposes - - **DO NOT flag if:** - - - The specific state variable being flagged undergoes transformation, debouncing, or derives - from computation rather than directly mirroring the external value. Other state variables - in the same effect that DO directly mirror external values should still be flagged. - - The external API doesn't fit the `subscribe` / `getSnapshot` contract - - The code already uses `useSyncExternalStore` - - The subscription is managed by a library (e.g., Onyx's `useOnyx`) - -- **Reasoning**: [`useSyncExternalStore`](https://react.dev/learn/you-might-not-need-an-effect#subscribing-to-an-external-store) is React's purpose-built hook for reading external store values. It handles concurrent rendering edge cases (tearing), avoids the extra render pass of `useEffect` + `setState`, and makes the subscription contract explicit. Manual subscriptions via `useEffect` are more error-prone and miss these guarantees. - -Good: - -```tsx -function subscribe(callback) { - window.addEventListener('online', callback); - window.addEventListener('offline', callback); - return () => { - window.removeEventListener('online', callback); - window.removeEventListener('offline', callback); - }; -} - -function useOnlineStatus() { - // โœ… Good: Subscribing to an external store with a built-in Hook - return useSyncExternalStore( - subscribe, // React won't resubscribe for as long as you pass the same function - () => navigator.onLine, // How to get the value on the client - () => true // How to get the value on the server - ); -} - -function ChatIndicator() { - const isOnline = useOnlineStatus(); - // ... -} -``` - -Bad: - -```tsx -function useOnlineStatus() { - // Not ideal: Manual store subscription in an Effect - const [isOnline, setIsOnline] = useState(true); - useEffect(() => { - function updateState() { - setIsOnline(navigator.onLine); - } - - updateState(); - - window.addEventListener('online', updateState); - window.addEventListener('offline', updateState); - return () => { - window.removeEventListener('online', updateState); - window.removeEventListener('offline', updateState); - }; - }, []); - return isOnline; -} - -function ChatIndicator() { - const isOnline = useOnlineStatus(); - // ... -} -``` - ---- - -### [PERF-15] Clean up async Effects to prevent race conditions - -- **Search patterns**: `useEffect`, `fetch(`, `async`, `await`, `.then(`, `setState`, `eslint-disable` - -- **Condition**: Flag when EITHER of these is true: - - **Case 1 โ€” Missing cleanup:** - - A `useEffect` performs async work (fetch, promise chain, async/await) - - The async callback performs side effects (setState, navigation, data mutations, deletions) - - There is no cleanup mechanism to discard stale responses (no `ignore` flag, no `AbortController`, no cancellation token) - - **Case 2 โ€” Suppressed dependency lint:** - - A `useEffect` performs async work and triggers side effects (setState, navigation, mutations) - - The dependency array has an `eslint-disable` comment suppressing `react-hooks/exhaustive-deps` - - This hides a dependency that could change and cause a race condition - - **DO NOT flag if:** - - - The Effect includes an `ignore`/`cancelled` boolean checked before `setState` - - The Effect uses `AbortController` to cancel the request on cleanup - - The async operation is truly fire-and-forget (no setState, no navigation, no mutations โ€” - just logging or analytics that are safe to complete after unmount) - - The dependency array is empty `[]` with no suppressed lint, AND the async callback only - performs idempotent/safe operations (no navigation, no destructive mutations that could - fire after unmount) - - Data fetching is handled by a library/framework (e.g., Onyx, React Query) - -- **Reasoning**: When an Effect's dependencies change, the previous async operation [may still be in flight](https://react.dev/learn/you-might-not-need-an-effect#fetching-data). Without cleanup, a slow earlier response can overwrite the result of a faster later response, showing stale data. This is especially dangerous for search inputs and navigation where dependencies change rapidly. - -Good (ignore flag): - -```tsx -useEffect(() => { - let ignore = false; - - fetchResults(query).then((json) => { - if (!ignore) { - setResults(json); - } - }); - - return () => { - ignore = true; - }; -}, [query]); -``` - -Good (AbortController): - -```tsx -useEffect(() => { - const controller = new AbortController(); - - fetch(`/api/search?q=${query}`, {signal: controller.signal}) - .then((res) => res.json()) - .then((data) => setResults(data)) - .catch((e) => { - if (e.name !== 'AbortError') { - setError(e); - } - }); - - return () => controller.abort(); -}, [query]); -``` - -Bad: - -```tsx -useEffect(() => { - fetchResults(query).then((json) => { - setResults(json); - }); -}, [query]); -``` - ---- - -### [PERF-16] Guard initialization logic against double-execution - -- **Search patterns**: `useEffect` with empty dependency array `[]` containing initialization logic (API calls, storage access, authentication checks, SDK setup, global configuration, event handler registration) - -- **Condition**: Flag ONLY when ALL of these are true: - - - A `useEffect` with empty dependency array `[]` runs non-idempotent initialization logic - - The logic would cause problems if executed twice (e.g., double API calls, invalidated tokens, duplicate SDK init, duplicate analytics sessions, duplicate deep link registrations) - - There is no guard mechanism (module-level flag or module-level execution) - - This applies at any level โ€” app-wide init, feature screens, or individual components - - **DO NOT flag if:** - - - A module-level or ref-based guard variable prevents double execution. A proper execution - guard follows this pattern: `if (didInit) return; didInit = true;` โ€” it checks a flag AND - sets it. Conditional checks on data/props (e.g., `if (!transaction) return`, - `if (action !== 'CREATE') return`) are NOT execution guards โ€” they validate preconditions - but don't prevent the logic from running again if the same preconditions hold in a second - invocation (which happens in React Strict Mode). - - The logic is idempotent (safe to run twice with no side effects) - - NOTE: Navigation calls (e.g., `navigate()`), data deletion (e.g., `removeDraftTransactions()`), - and similar mutations are NOT idempotent โ€” running them twice produces different/undesirable results. - - The logic is at module level, outside any component - - The Effect has non-empty dependencies (not one-time init) - -- **Reasoning**: React Strict Mode [intentionally double-invokes Effects](https://react.dev/learn/you-might-not-need-an-effect#initializing-the-application) in development to surface missing cleanup. Non-idempotent initialization โ€” whether app-wide (auth tokens, global config) or per-feature (SDK setup, analytics session creation, deep link handler registration) โ€” can break when executed twice. Guarding with a module-level flag or moving initialization outside the component ensures it runs exactly once regardless of rendering mode. - -Good (module-level guard): - -```tsx -let didInit = false; - -function App() { - useEffect(() => { - if (didInit) { - return; - } - didInit = true; - - loadDataFromLocalStorage(); - checkAuthToken(); - }, []); -} -``` - -Good (module-level execution): - -```tsx -if (typeof window !== 'undefined') { - checkAuthToken(); - loadDataFromLocalStorage(); -} - -function App() { - // ... -} -``` - -Bad: - -```tsx -function App() { - useEffect(() => { - loadDataFromLocalStorage(); - checkAuthToken(); - }, []); -} -``` - ---- - -### [CONSISTENCY-1] Avoid platform-specific checks within components - -- **Search patterns**: `Platform.OS`, `isAndroid`, `isIOS`, `Platform\.select` - -- **Condition**: Flag ONLY when ALL of these are true: +**Always use the `coding-standards` skill to review changed files.** - - Platform detection checks (e.g., `Platform.OS`, `isAndroid`, `isIOS`) are present within a component - - The checks lead to hardcoded values or styles specific to a platform - - The component is not structured to handle platform-specific logic through file extensions or separate components +Each rule file contains: - **DO NOT flag if:** - - - The logic is handled through platform-specific file extensions (e.g., `index.web.tsx`, `index.native.tsx`) - -- **Reasoning**: Mixing platform-specific logic within components increases maintenance overhead, complexity, and bug risk. Separating concerns through dedicated files or components improves maintainability and reduces platform-specific bugs. - -Good: - -```tsx -// Platform-specific file: Button.desktop.tsx -function Button() { - return ; +} + +// Parent wires siblings together + + formRef.current?.getData()} /> +``` + +### Correct + +#### Correct (abstract contract) + +- Interface exposes capability: "user can add a stop" +- Implementation details (index computation, navigation) stay with consumer +- Component is reusable in any context needing an "add stop" action + +```tsx + { + const nextIndex = Object.keys(transaction?.comment?.waypoints ?? {}).length; + Navigation.navigate(ROUTES.MONEY_REQUEST_STEP_WAYPOINT.getRoute(..., nextIndex.toString(), ...)); + }} +/> + +// in DistanceRequestFooter + +``` + +#### Correct (independent contracts) + +- Each component has a self-contained interface +- State coordination happens at composition level + +```tsx +function EditProfile() { + const [formData, setFormData] = useState(); + return ( + <> + + API.save(formData)} /> + + ); +} +``` + +--- + +### Review Metadata + +#### Condition + +Flag ONLY when BOTH of these are true: + +1. A component's interface is shaped around a specific consumer's implementation rather than abstract capabilities +2. AND at least ONE of the following manifestations is present: + - The component receives data only to extract values for callbacks (doesn't use it for rendering) + - Callback signatures encode consumer-specific assumptions (e.g., `(index: number) => void` for navigation) + - The component accesses external state through refs or imperative handles + +**Signs of violation:** +- Callback signatures that encode consumer assumptions: `navigateToWaypoint(index: number)` instead of `onAddWaypoint()` +- Props passed only to extract values for callbacks, not for rendering (e.g., `transaction` passed just to compute `waypoints.length`) +- Imperative access to external state via refs or `useImperativeHandle` +- Component requires modification to work in a different context + +**DO NOT flag if:** +- Component signals events with data it naturally owns (e.g., `onChange(value)` for an input, `onSelectItem(item)` for a list) +- Callbacks are abstract actions the component can trigger (e.g., `onAddStop()`, `onSubmit()`) +- State coordination happens at a higher level with clear data flow + +**What makes a contract "abstract":** +- Callback describes *what happened* in component terms: `onAddStop`, `onSelect`, `onChange` +- Callback does NOT describe *what consumer should do*: `navigateToWaypoint(index)`, `updateParentState(value)` +- Props are used for rendering or internal logic, not just to compute callback arguments +- Component works without modification in a different context + +**Search Patterns** (hints for reviewers): +- `index: number` (in callback signatures) +- `useImperativeHandle` +- `ref` diff --git a/.claude/skills/coding-standards/rules/clean-react-4-no-side-effect-spaghetti.md b/.claude/skills/coding-standards/rules/clean-react-4-no-side-effect-spaghetti.md new file mode 100644 index 000000000000..817ededb2e35 --- /dev/null +++ b/.claude/skills/coding-standards/rules/clean-react-4-no-side-effect-spaghetti.md @@ -0,0 +1,169 @@ +--- +ruleId: CLEAN-REACT-PATTERNS-4 +title: Avoid side-effect spaghetti +--- + +## [CLEAN-REACT-PATTERNS-4] Avoid side-effect spaghetti + +### Reasoning + +When multiple unrelated responsibilities are grouped into a single component, hook, or utility, if any one concern changes, then unrelated logic must be touched as well, increasing coupling, regression risk, and cognitive load. This is the single responsibility principle for React: extract small units that do very little, very well. A component with several unrelated effects is a code smell - even a single effect can benefit from extraction to something with a good name, proper description, and isolated tests. + +**Bucketing questions for refactoring:** +1. Does this logic need the React render loop? YES -> Extract to a focused custom hook. NO -> Extract out of React entirely (e.g., Onyx migration, global initialization). +2. Does this logic need to be in this component? YES -> Keep it, but use a focused hook. NO -> Extract to a separate component that owns this concern. + +**Hook granularity guidance:** +- Group effects that serve the same purpose into one hook (e.g., all telemetry setup in `useTelemetry`) +- Group effects that can be reused together across components +- Don't create 15 separate single-effect hooks if 5 well-named grouped hooks make more sense + +### Incorrect + +#### Incorrect (side-effect spaghetti) + +- Component mixes session management, deep linking, telemetry, navigation, splash screen, audio, and other startup logic +- Several unrelated `useOnyx` calls and `useEffect` hooks in a single component +- Changing one concern risks breaking others + +```tsx +function Expensify() { + // Session & auth + const [account] = useOnyx(ONYXKEYS.ACCOUNT); + const [session] = useOnyx(ONYXKEYS.SESSION); + + // Navigation & routing + const [lastRoute] = useOnyx(ONYXKEYS.LAST_ROUTE); + const [lastVisitedPath] = useOnyx(ONYXKEYS.LAST_VISITED_PATH); + const [isNavigationReady, setIsNavigationReady] = useState(false); + + // App state + const [updateAvailable] = useOnyx(ONYXKEYS.UPDATE_AVAILABLE); + const [updateRequired] = useOnyx(ONYXKEYS.UPDATE_REQUIRED); + const [isSidebarLoaded] = useOnyx(ONYXKEYS.IS_SIDEBAR_LOADED); + + // Splash screen + const {splashScreenState, setSplashScreenState} = useContext(SplashScreenStateContext); + + // ... 10+ more useOnyx calls for unrelated concerns ... + + // Telemetry effect + useEffect(() => { + bootsplashSpan.current = startSpan(CONST.TELEMETRY.SPAN_BOOTSPLASH.ROOT, {...}); + // ... + }, []); + + // Public room checking effect + useEffect(() => { + if (isCheckingPublicRoom) return; + endSpan(CONST.TELEMETRY.SPAN_BOOTSPLASH.ONYX); + // ... + }, [isCheckingPublicRoom]); + + // Splash screen effect + useEffect(() => { + if (!shouldHideSplash) return; + startSpan(CONST.TELEMETRY.SPAN_BOOTSPLASH.SPLASH_HIDER, {...}); + }, [shouldHideSplash]); + + // Deep linking effect + useEffect(() => { + Linking.getInitialURL().then((url) => { + if (url) { + openReportFromDeepLink(url, ...); + } + }); + // ... + }, []); + + // Audio mode effect + useEffect(() => { + Audio.setAudioModeAsync({playsInSilentModeIOS: true}); + }, []); + + // ... 10+ more useEffects mixing concerns ... +} +``` + +In this example: +- The component handles telemetry, deep linking, audio, session, navigation, splash screen, and more +- Each concern is interleaved with others, making it hard to modify one without risking regression in another +- Effects could be extracted to focused hooks: `useTelemetrySpans`, `useDeepLinking`, `useAudioMode`, etc. +- Entry points don't get special treatment โ€” extracting effects into named hooks improves clarity and makes it possible to understand what each effect does and how to safely modify it + +### Correct + +#### Correct (separated concerns) + +- Each piece of logic is extracted to a focused hook or component +- Parent component only orchestrates what to render +- State subscriptions in smaller components don't cause re-renders in parent +- Component-scoped hooks can be co-located in the same directory for maintainability + +```tsx +function DebugMenu() { + useDebugShortcut(); + + return ( + // Debug menu UI + ); +} + +function ParentComponent({ reportID }: { reportID: string }) { + return ( + + {/* Each child owns its own concerns */} + + + + ); +} +``` + +```tsx +// Focused hook that does one thing well +function useDebugShortcut() { + useEffect(() => { + const debugShortcutConfig = CONST.KEYBOARD_SHORTCUTS.DEBUG; + const unsubscribeDebugShortcut = KeyboardShortcut.subscribe( + debugShortcutConfig.shortcutKey, + () => toggleTestToolsModal(), + debugShortcutConfig.descriptionKey, + debugShortcutConfig.modifiers, + true, + ); + + return () => { + unsubscribeDebugShortcut(); + }; + }, []); +} +``` + +--- + +### Review Metadata + +#### Condition + +Flag when a component, hook, or utility aggregates multiple unrelated responsibilities in a single unit, making it difficult to modify one concern without touching others. + +**Signs of violation:** +- Component has several `useEffect` hooks handling unrelated concerns (e.g., telemetry, deep linking, audio, session management all in one component) +- A single `useEffect` or hook handles multiple distinct responsibilities +- Unrelated state variables are interdependent or updated together +- Logic mixes data fetching, navigation, UI state, and lifecycle behavior in one place +- Removing one piece of functionality requires careful untangling from others + +**What counts as "unrelated":** +- Group by responsibility (what the code does), NOT by timing (when it runs) +- Data fetching and analytics are NOT related โ€” they serve different purposes even if both run on mount +- Session management and audio configuration are NOT related โ€” different domains entirely + +**DO NOT flag if:** +- Component is a thin orchestration layer that ONLY composes child components (no business logic, no effects beyond rendering) +- Effects are extracted into focused custom hooks with single responsibilities (e.g., `useDebugShortcut`, `usePriorityMode`) โ€” inline `useEffect` calls are a code smell and should be named hooks + +**Search Patterns** (hints for reviewers): +- `useEffect` +- `useOnyx` diff --git a/.claude/skills/coding-standards/rules/clean-react-5-narrow-state.md b/.claude/skills/coding-standards/rules/clean-react-5-narrow-state.md new file mode 100644 index 000000000000..19f5d01cf8e3 --- /dev/null +++ b/.claude/skills/coding-standards/rules/clean-react-5-narrow-state.md @@ -0,0 +1,119 @@ +--- +ruleId: CLEAN-REACT-PATTERNS-5 +title: Keep state and subscriptions narrow +--- + +## [CLEAN-REACT-PATTERNS-5] Keep state and subscriptions narrow + +### Reasoning + +When unrelated pieces of data are grouped into a single state structure, if an unused part changes, then all consumers re-render unnecessarily. This silently expands render scope, increases coupling, and makes performance regressions hard to detect. Structuring state around cohesive concerns ensures render scope stays predictable and changes remain local. + +**Distinction from PERF-11**: PERF-11 addresses individual `useOnyx` selector usage. This rule addresses state structure โ€” how multiple values are grouped and exposed to consumers via contexts, hooks, or stores. + +**Distinction from CLEAN-REACT-PATTERNS-2**: PATTERNS-2 addresses data flow direction โ€” parent shouldn't fetch data just to pass to children. This rule addresses how state is structured and grouped within any state provider. + +### Incorrect + +#### Incorrect (grab-bag state โ€” bundles unrelated concerns) + +- State provider subscribes to many unrelated Onyx collections +- Exposed value mixes navigation state, list data, membership data, and cache utilities +- Any consumer re-renders when ANY subscribed value changes + +```tsx +function SidebarOrderedReportsContextProvider({children}) { + // Many unrelated Onyx subscriptions bundled together + const [priorityMode] = useOnyx(ONYXKEYS.NVP_PRIORITY_MODE); + const [chatReports] = useOnyx(ONYXKEYS.COLLECTION.REPORT); + const [policies] = useOnyx(ONYXKEYS.COLLECTION.POLICY); + const [transactions] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION); + const [transactionViolations] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS); + const [reportNameValuePairs] = useOnyx(ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS); + const [reportsDrafts] = useOnyx(ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT); + const [betas] = useOnyx(ONYXKEYS.BETAS); + const [reportAttributes] = useOnyx(ONYXKEYS.DERIVED.REPORT_ATTRIBUTES); + + // Context value mixes unrelated concerns + const contextValue = { + orderedReports, // List data + orderedReportIDs, // List data + currentReportID, // Navigation state + policyMemberAccountIDs, // Policy membership + clearLHNCache, // Cache management utility + }; + + return {children}; +} + +// A component needing only currentReportID re-renders when orderedReports changes +// A component needing only policyMemberAccountIDs re-renders when navigation changes +``` + +### Correct + +#### Correct (cohesive state โ€” all values serve one purpose) + +- All state relates to one concern (keyboard) +- Values change together โ€” no wasted re-renders +- Derived state computed inline, not stored separately + +```tsx +type KeyboardStateContextValue = { + isKeyboardShown: boolean; + isKeyboardActive: boolean; + keyboardHeight: number; +}; + +function KeyboardStateProvider({children}: ChildrenProps) { + const [keyboardHeight, setKeyboardHeight] = useState(0); + const [isKeyboardActive, setIsKeyboardActive] = useState(false); + + useEffect(() => { + const showListener = KeyboardEvents.addListener('keyboardDidShow', (e) => { + setKeyboardHeight(e.height); + setIsKeyboardActive(true); + }); + const hideListener = KeyboardEvents.addListener('keyboardDidHide', () => { + setKeyboardHeight(0); + setIsKeyboardActive(false); + }); + return () => { + showListener.remove(); + hideListener.remove(); + }; + }, []); + + const contextValue = useMemo(() => ({ + keyboardHeight, + isKeyboardShown: keyboardHeight !== 0, // Derived, not separate state + isKeyboardActive, + }), [keyboardHeight, isKeyboardActive]); + + return {children}; +} +``` + +--- + +### Review Metadata + +#### Condition + +Flag when a state structure (context, hook, store, or subscription) bundles unrelated concerns together, causing consumers to re-render when data they don't use changes. + +**Signs of violation:** +- State provider (context, hook, or store) that bundles unrelated data (e.g., navigation state + list data + cache utilities in one structure) +- State object where properties serve different purposes and change independently +- Multiple unrelated subscriptions (`useOnyx`, `useContext`, store selectors) aggregated into a single exposed value +- Consumers of a state source that only use a subset of the provided values + +**DO NOT flag if:** +- State values are cohesive โ€” they change together and serve the same purpose (e.g., `keyboardHeight` + `isKeyboardShown` both relate to keyboard state) +- The state structure is intentionally designed as an aggregation point and consumers use most/all values +- Individual `useOnyx` calls without selectors โ€” this is covered by [PERF-11] + +**Search Patterns** (hints for reviewers): +- `Context` +- `Provider` +- `useOnyx` diff --git a/.claude/skills/coding-standards/rules/consistency-1-no-platform-checks.md b/.claude/skills/coding-standards/rules/consistency-1-no-platform-checks.md new file mode 100644 index 000000000000..fe42131682d5 --- /dev/null +++ b/.claude/skills/coding-standards/rules/consistency-1-no-platform-checks.md @@ -0,0 +1,57 @@ +--- +ruleId: CONSISTENCY-1 +title: Avoid platform-specific checks within components +--- + +## [CONSISTENCY-1] Avoid platform-specific checks within components + +### Reasoning + +Mixing platform-specific logic within components increases maintenance overhead, complexity, and bug risk. Separating concerns through dedicated files or components improves maintainability and reduces platform-specific bugs. + +### Incorrect + +```tsx +function Button() { + const isAndroid = Platform.OS === 'android'; + return isAndroid ? ( + + ) : ( + ; +} +``` + +### Correct + +```tsx +function BuyButton({ productId, onBuy }) { + function handleClick() { + // Good: handle event directly in event handler + onBuy(); + showNotification('Item purchased!'); + } + + return ; +} +``` + +--- + +### Review Metadata + +Flag ONLY when ALL of these are true: + +- `useEffect` responds to user events +- The event handler is available (onClick, onChange, etc.) +- Logic could be moved directly to the event handler + +**DO NOT flag if:** + +- useEffect performs necessary setup/teardown not tied to events +- Event response depends on component state initialization +- Multiple events need the same handler and useEffect is cleaner + +**Search Patterns** (hints for reviewers): +- `useEffect` +- `useState` diff --git a/.claude/skills/coding-standards/rules/perf-9-no-useeffect-chains.md b/.claude/skills/coding-standards/rules/perf-9-no-useeffect-chains.md new file mode 100644 index 000000000000..918ddb8f0c55 --- /dev/null +++ b/.claude/skills/coding-standards/rules/perf-9-no-useeffect-chains.md @@ -0,0 +1,71 @@ +--- +ruleId: PERF-9 +title: Avoid useEffect chains +--- + +## [PERF-9] Avoid useEffect chains + +### Reasoning + +Chains of effects create complex dependencies, timing issues, and unnecessary renders. Logic should be restructured to avoid interdependent effects. + +### Incorrect + +```tsx +function Form() { + const [firstName, setFirstName] = useState(''); + const [lastName, setLastName] = useState(''); + const [fullName, setFullName] = useState(''); + const [isValid, setIsValid] = useState(false); + + // Avoid: chain of effects + useEffect(() => { + setFullName(firstName + ' ' + lastName); + }, [firstName, lastName]); + + useEffect(() => { + setIsValid(fullName.length > 0); + }, [fullName]); +} +``` + +### Correct + +```tsx +function Form() { + const [firstName, setFirstName] = useState(''); + const [lastName, setLastName] = useState(''); + + // Good: compute derived values directly + const fullName = firstName + ' ' + lastName; + const isValid = firstName.length > 0 && lastName.length > 0; + + return ( + + setFirstName(e.target.value)} /> + setLastName(e.target.value)} /> + {isValid && } + + ); +} +``` + +--- + +### Review Metadata + +Flag ONLY when ALL of these are true: + +- Multiple `useEffect` hooks exist +- One effect's state update triggers another effect +- Logic could be combined or computed instead + +**DO NOT flag if:** + +- Effects handle different concerns (e.g., one for setup, one for event listening) +- Effects depend on external events that can't be combined +- Separation of concerns requires multiple effects + +**Search Patterns** (hints for reviewers): +- `useEffect` +- `useState` diff --git a/.github/scripts/extractAllowedRules.sh b/.github/scripts/extractAllowedRules.sh index af2007d18c3f..5b84f43f02ec 100755 --- a/.github/scripts/extractAllowedRules.sh +++ b/.github/scripts/extractAllowedRules.sh @@ -1,26 +1,31 @@ #!/bin/bash -# Extract allowed rules from code-inline-reviewer.md -# Rules are in format [PREFIX-NUMBER] where PREFIX is uppercase letters +# Extract allowed rules from individual rule files in the rules directory. +# Each rule file has YAML frontmatter with a ruleId field. set -euo pipefail -REVIEWER_FILE="${1:-.claude/agents/code-inline-reviewer.md}" +RULES_DIR="${1:-.claude/skills/coding-standards/rules}" OUTPUT_FILE="${2:-.claude/allowed-rules.txt}" -if [[ ! -f "$REVIEWER_FILE" ]]; then - echo "Error: Reviewer file not found: $REVIEWER_FILE" >&2 +if [[ ! -d "$RULES_DIR" ]]; then + echo "Error: Rules directory not found: $RULES_DIR" >&2 exit 1 fi -# Extract rules in format [CAPS-NUMBER] (e.g., [PERF-1], [SEC-1], [STYLE-1]) -# Remove brackets to store as PERF-1, SEC-1, etc. -grep -oE '\[[A-Z]+-[0-9]+\]' "$REVIEWER_FILE" | sed 's/\[\(.*\)\]/\1/' | sort -u > "$OUTPUT_FILE" +# Extract ruleId from YAML frontmatter of each non-underscore .md file +# Use multi-hyphen regex to validate rule ID format (e.g., PERF-1, CLEAN-REACT-PATTERNS-1) +true > "$OUTPUT_FILE" +for file in "$RULES_DIR"/[!_]*.md; do + [[ -f "$file" ]] || continue + grep -m1 '^ruleId:' "$file" | grep -oE '[A-Z]+(-[A-Z]+)*-[0-9]+' >> "$OUTPUT_FILE" || true +done + +sort -u -o "$OUTPUT_FILE" "$OUTPUT_FILE" if [[ ! -s "$OUTPUT_FILE" ]]; then - echo "Error: No allowed rules found in $REVIEWER_FILE" >&2 + echo "Error: No allowed rules found in $RULES_DIR" >&2 exit 1 fi echo "Extracted allowed rules:" cat "$OUTPUT_FILE" - diff --git a/.github/workflows/buildAdHoc.yml b/.github/workflows/buildAdHoc.yml new file mode 100644 index 000000000000..3ee1e1d63775 --- /dev/null +++ b/.github/workflows/buildAdHoc.yml @@ -0,0 +1,472 @@ +name: Build and deploy ad-hoc apps + +on: + workflow_call: + inputs: + APP_REF: + description: Git ref to checkout for building + type: string + required: true + APP_PR_NUMBER: + description: Expensify/App pull request number (empty to skip comments and web deploy) + type: string + default: '' + MOBILE_EXPENSIFY_REF: + description: Mobile-Expensify ref to checkout (empty to use submodule at HEAD) + type: string + default: '' + MOBILE_EXPENSIFY_PR: + description: Mobile-Expensify pull request number (empty to skip ME PR comments) + type: string + default: '' + BUILD_WEB: + description: Whether to build the web app + type: string + default: 'true' + BUILD_IOS: + description: Whether to build the iOS app + type: string + default: 'true' + BUILD_ANDROID: + description: Whether to build the Android app + type: string + default: 'true' + TRIGGER_ACTOR: + description: GitHub username who triggered the build + type: string + required: true + +jobs: + postGitHubCommentBuildStarted: + name: Post build started comment + if: ${{ inputs.APP_PR_NUMBER != '' || inputs.MOBILE_EXPENSIFY_PR != '' }} + runs-on: blacksmith-4vcpu-ubuntu-2404 + steps: + - name: Add build start comment to Expensify/App PR + if: ${{ inputs.APP_PR_NUMBER != '' }} + # v8 + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd + with: + github-token: ${{ github.token }} + script: | + const workflowURL = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`; + github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: ${{ inputs.APP_PR_NUMBER }}, + body: `๐Ÿšง @${{ inputs.TRIGGER_ACTOR }} has triggered a test Expensify/App build. You can view the [workflow run here](${workflowURL}).` + }); + + - name: Add build start comment to Expensify/Mobile-Expensify PR + if: ${{ inputs.MOBILE_EXPENSIFY_PR != '' }} + # v8 + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd + with: + github-token: ${{ secrets.OS_BOTIFY_TOKEN }} + script: | + const workflowURL = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`; + github.rest.issues.createComment({ + owner: context.repo.owner, + repo: 'Mobile-Expensify', + issue_number: ${{ inputs.MOBILE_EXPENSIFY_PR }}, + body: `๐Ÿšง @${{ inputs.TRIGGER_ACTOR }} has triggered a test Expensify/Mobile-Expensify build. You can view the [workflow run here](${workflowURL}).` + }); + + web: + name: Build and deploy Web + if: ${{ inputs.BUILD_WEB == 'true' && inputs.APP_PR_NUMBER != '' }} + runs-on: blacksmith-16vcpu-ubuntu-2404 + env: + PULL_REQUEST_NUMBER: ${{ inputs.APP_PR_NUMBER }} + steps: + - name: Checkout + # v6 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd + with: + ref: ${{ inputs.APP_REF }} + + - name: Create .env.adhoc file based on staging + run: | + cp .env.staging .env.adhoc + sed -i 's/ENVIRONMENT=staging/ENVIRONMENT=adhoc/' .env.adhoc + + - name: Inject CI data into JS bundle + run: ./.github/scripts/inject-ci-data.sh PULL_REQUEST_NUMBER="$PULL_REQUEST_NUMBER" + + - name: Setup Node + uses: ./.github/actions/composite/setupNode + + - name: Configure AWS Credentials + # v6 + uses: aws-actions/configure-aws-credentials@8df5847569e6427dd6c4fb1cf565c83acfa8afa7 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: us-east-1 + + - name: Build web for testing + run: npm run build-adhoc + env: + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + + - name: Deploy to S3 for internal testing + run: aws s3 cp --recursive --acl public-read "$GITHUB_WORKSPACE"/dist s3://ad-hoc-expensify-cash/web/"$PULL_REQUEST_NUMBER" + + androidHybrid: + name: Build Android HybridApp + if: ${{ inputs.BUILD_ANDROID == 'true' }} + runs-on: blacksmith-32vcpu-ubuntu-2404 + env: + PULL_REQUEST_NUMBER: ${{ inputs.APP_PR_NUMBER }} + outputs: + ROCK_ANDROID_ADHOC_INDEX_URL: ${{ steps.set-artifact-url.outputs.ARTIFACT_URL }} + steps: + - name: Checkout + # v6 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd + with: + submodules: true + ref: ${{ inputs.APP_REF }} + token: ${{ secrets.OS_BOTIFY_TOKEN }} + + - name: Checkout Mobile-Expensify to specified branch or commit + if: ${{ inputs.MOBILE_EXPENSIFY_REF != '' }} + run: | + cd Mobile-Expensify + git fetch origin ${{ inputs.MOBILE_EXPENSIFY_REF }} + git checkout ${{ inputs.MOBILE_EXPENSIFY_REF }} + echo "Building from https://github.com/Expensify/Mobile-Expensify/pull/${{ inputs.MOBILE_EXPENSIFY_PR }}" + + - name: Configure MapBox SDK + run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }} + + - name: Setup Node + id: setup-node + uses: ./.github/actions/composite/setupNode + with: + IS_HYBRID_BUILD: 'true' + + - name: Run grunt build + run: | + cd Mobile-Expensify + npm run grunt:build:shared + + - name: Create .env.adhoc file based on staging + run: | + cp .env.staging .env.adhoc + sed -i 's/ENVIRONMENT=staging/ENVIRONMENT=adhoc/' .env.adhoc + + - name: Inject CI data into JS bundle + run: ./.github/scripts/inject-ci-data.sh PULL_REQUEST_NUMBER="$PULL_REQUEST_NUMBER" + + - name: Setup 1Password CLI and certificates + uses: Expensify/GitHub-Actions/setup-certificate-1p@main + with: + OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} + SHOULD_LOAD_SSL_CERTIFICATES: 'false' + + - name: Load files from 1Password + env: + OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} + run: | + op read "op://${{ vars.OP_VAULT }}/upload-key.keystore/upload-key.keystore" --force --out-file ./upload-key.keystore + op read "op://${{ vars.OP_VAULT }}/android-fastlane-json-key.json/android-fastlane-json-key.json" --force --out-file ./android-fastlane-json-key.json + + # Copy the keystore to the Android directory for Fullstory + cp ./upload-key.keystore Mobile-Expensify/Android + + - name: Load Android upload keystore credentials from 1Password + id: load-credentials + # v3 + uses: 1password/load-secrets-action@8d0d610af187e78a2772c2d18d627f4c52d3fbfb + with: + export-env: false + env: + OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} + ANDROID_UPLOAD_KEYSTORE_PASSWORD: op://${{ vars.OP_VAULT }}/Repository-Secrets/ANDROID_UPLOAD_KEYSTORE_PASSWORD + ANDROID_UPLOAD_KEYSTORE_ALIAS: op://${{ vars.OP_VAULT }}/Repository-Secrets/ANDROID_UPLOAD_KEYSTORE_ALIAS + ANDROID_UPLOAD_KEY_PASSWORD: op://${{ vars.OP_VAULT }}/Repository-Secrets/ANDROID_UPLOAD_KEY_PASSWORD + + - name: Configure AWS Credentials + # v6 + uses: aws-actions/configure-aws-credentials@8df5847569e6427dd6c4fb1cf565c83acfa8afa7 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: us-east-1 + + - name: Rock Remote Build - Android + id: rock-remote-build-android + uses: callstackincubator/android@2177ac62cabe662aa49a2bc6f3154070705dd8f5 + env: + GITHUB_TOKEN: ${{ github.token }} + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + IS_HYBRID_APP: true + with: + variant: 'Adhoc' + sign: true + re-sign: true + ad-hoc: true + keystore-file: './upload-key.keystore' + keystore-store-file: 'upload-key.keystore' + keystore-store-password: ${{ steps.load-credentials.outputs.ANDROID_UPLOAD_KEYSTORE_PASSWORD }} + keystore-key-alias: ${{ steps.load-credentials.outputs.ANDROID_UPLOAD_KEYSTORE_ALIAS }} + keystore-key-password: ${{ steps.load-credentials.outputs.ANDROID_UPLOAD_KEY_PASSWORD }} + # Specify the path (relative to the Android source directory) where the keystore should be placed. + keystore-path: '../tools/buildtools/upload-key.keystore' + comment-bot: false + rock-build-extra-params: '--extra-params "-PreactNativeArchitectures=arm64-v8a,x86_64 --profile"' + custom-ref: ${{ inputs.APP_REF }} + + - name: Upload Gradle profile report + if: always() + # v6 + uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f + with: + name: gradle-profile-report + path: Mobile-Expensify/Android/build/reports/profile/ + if-no-files-found: ignore + + - name: Set artifact URL output + id: set-artifact-url + run: echo "ARTIFACT_URL=$ARTIFACT_URL" >> "$GITHUB_OUTPUT" + + iosHybrid: + name: Build and deploy iOS for testing + if: ${{ inputs.BUILD_IOS == 'true' }} + env: + DEVELOPER_DIR: /Applications/Xcode_26.2.app/Contents/Developer + PULL_REQUEST_NUMBER: ${{ inputs.APP_PR_NUMBER }} + runs-on: macos-15-xlarge + outputs: + ROCK_IOS_ADHOC_INDEX_URL: ${{ steps.set-artifact-url.outputs.ARTIFACT_URL }} + steps: + - name: Checkout + # v6 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd + with: + submodules: true + ref: ${{ inputs.APP_REF }} + token: ${{ secrets.OS_BOTIFY_TOKEN }} + + - name: Checkout Mobile-Expensify to specified branch or commit + if: ${{ inputs.MOBILE_EXPENSIFY_REF != '' }} + run: | + cd Mobile-Expensify + git fetch origin ${{ inputs.MOBILE_EXPENSIFY_REF }} + git checkout ${{ inputs.MOBILE_EXPENSIFY_REF }} + echo "Building from https://github.com/Expensify/Mobile-Expensify/pull/${{ inputs.MOBILE_EXPENSIFY_PR }}" + + - name: Configure MapBox SDK + run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }} + + - name: Setup Node + id: setup-node + uses: ./.github/actions/composite/setupNode + with: + IS_HYBRID_BUILD: 'true' + + - name: Create .env.adhoc file based on staging + run: | + cp .env.staging .env.adhoc + sed -i '' 's/ENVIRONMENT=staging/ENVIRONMENT=adhoc/' .env.adhoc + + - name: Inject CI data into JS bundle + run: ./.github/scripts/inject-ci-data.sh PULL_REQUEST_NUMBER="$PULL_REQUEST_NUMBER" + + - name: Setup 1Password CLI and certificates + uses: Expensify/GitHub-Actions/setup-certificate-1p@main + with: + OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} + SHOULD_LOAD_SSL_CERTIFICATES: 'false' + + - name: Load files from 1Password + env: + OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} + run: | + op read "op://${{ vars.OP_VAULT }}/OldApp_AdHoc/OldApp_AdHoc.mobileprovision" --force --out-file ./OldApp_AdHoc.mobileprovision + op read "op://${{ vars.OP_VAULT }}/OldApp_AdHoc_Share_Extension/OldApp_AdHoc_Share_Extension.mobileprovision" --force --out-file ./OldApp_AdHoc_Share_Extension.mobileprovision + op read "op://${{ vars.OP_VAULT }}/OldApp_AdHoc_Notification_Service/OldApp_AdHoc_Notification_Service.mobileprovision" --force --out-file ./OldApp_AdHoc_Notification_Service.mobileprovision + op read "op://${{ vars.OP_VAULT }}/New Expensify Distribution Certificate/Certificates.p12" --force --out-file ./Certificates.p12 + + - name: Create ExportOptions.plist + run: | + cat > Mobile-Expensify/iOS/ExportOptions.plist << 'EOF' + + + + + method + ad-hoc + provisioningProfiles + + com.expensify.expensifylite.adhoc + (OldApp) AdHoc + com.expensify.expensifylite.adhoc.SmartScanExtension + (OldApp) AdHoc: Share Extension + com.expensify.expensifylite.adhoc.NotificationServiceExtension + (OldApp) AdHoc: Notification Service + + + + EOF + + - name: Configure AWS Credentials + # v6 + uses: aws-actions/configure-aws-credentials@8df5847569e6427dd6c4fb1cf565c83acfa8afa7 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: us-east-1 + + - name: Rock Remote Build - iOS + id: rock-remote-build-ios + uses: callstackincubator/ios@d638bd25c764655baeeced3232c692f1698cf72b + env: + GITHUB_TOKEN: ${{ github.token }} + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + IS_HYBRID_APP: true + with: + destination: device + re-sign: true + ad-hoc: true + scheme: 'Expensify AdHoc' + configuration: 'AdHoc' + certificate-file: './Certificates.p12' + provisioning-profiles: | + [ + { + "name": "(OldApp) AdHoc", + "file": "./OldApp_AdHoc.mobileprovision" + }, + { + "name": "(OldApp) AdHoc: Share Extension", + "file": "./OldApp_AdHoc_Share_Extension.mobileprovision" + }, + { + "name": "(OldApp) AdHoc: Notification Service", + "file": "./OldApp_AdHoc_Notification_Service.mobileprovision" + } + ] + comment-bot: false + custom-ref: ${{ inputs.APP_REF }} + + - name: Set artifact URL output + id: set-artifact-url + run: echo "ARTIFACT_URL=$ARTIFACT_URL" >> "$GITHUB_OUTPUT" + + postGithubComment: + runs-on: blacksmith-4vcpu-ubuntu-2404 + if: ${{ always() && (inputs.APP_PR_NUMBER != '' || inputs.MOBILE_EXPENSIFY_PR != '') }} + name: Post a GitHub comment with app download links for testing + needs: [web, androidHybrid, iosHybrid] + steps: + - name: Checkout + # v6 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd + with: + ref: ${{ inputs.APP_REF }} + + - name: Download Artifact + # v7 + uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 + + - name: Publish links to apps for download on Expensify/App PR + if: ${{ inputs.APP_PR_NUMBER != '' }} + uses: ./.github/actions/javascript/postTestBuildComment + with: + REPO: App + APP_PR_NUMBER: ${{ inputs.APP_PR_NUMBER }} + MOBILE_EXPENSIFY_PR_NUMBER: ${{ inputs.MOBILE_EXPENSIFY_PR }} + GITHUB_TOKEN: ${{ github.token }} + ANDROID: ${{ needs.androidHybrid.result }} + IOS: ${{ needs.iosHybrid.result }} + WEB: ${{ needs.web.result }} + ANDROID_LINK: ${{ needs.androidHybrid.outputs.ROCK_ANDROID_ADHOC_INDEX_URL }} + IOS_LINK: ${{ needs.iosHybrid.outputs.ROCK_IOS_ADHOC_INDEX_URL }} + WEB_LINK: https://${{ inputs.APP_PR_NUMBER }}.pr-testing.expensify.com + + - name: Publish links to apps for download on Expensify/Mobile-Expensify PR + if: ${{ inputs.MOBILE_EXPENSIFY_PR != '' }} + uses: ./.github/actions/javascript/postTestBuildComment + with: + REPO: Mobile-Expensify + MOBILE_EXPENSIFY_PR_NUMBER: ${{ inputs.MOBILE_EXPENSIFY_PR }} + GITHUB_TOKEN: ${{ secrets.OS_BOTIFY_TOKEN }} + ANDROID: ${{ needs.androidHybrid.result }} + IOS: ${{ needs.iosHybrid.result }} + ANDROID_LINK: ${{ needs.androidHybrid.outputs.ROCK_ANDROID_ADHOC_INDEX_URL }} + IOS_LINK: ${{ needs.iosHybrid.outputs.ROCK_IOS_ADHOC_INDEX_URL }} + + buildSummary: + runs-on: blacksmith-4vcpu-ubuntu-2404 + if: ${{ always() && (inputs.APP_PR_NUMBER != '' || needs.androidHybrid.outputs.ROCK_ANDROID_ADHOC_INDEX_URL != '' || needs.iosHybrid.outputs.ROCK_IOS_ADHOC_INDEX_URL != '') }} + name: Build Summary + needs: [web, androidHybrid, iosHybrid] + steps: + - name: Checkout + # v6 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd + with: + ref: ${{ inputs.APP_REF }} + + - name: Get Mobile-Expensify ref + id: getMobileExpensifySHA + run: | + if [ -n "${{ inputs.MOBILE_EXPENSIFY_REF }}" ]; then + echo "SHA=${{ inputs.MOBILE_EXPENSIFY_REF }}" >> "$GITHUB_OUTPUT" + elif [ -d "Mobile-Expensify" ]; then + SUBMODULE_SHA=$(git ls-tree HEAD Mobile-Expensify | awk '{print $3}') + echo "SHA=$SUBMODULE_SHA" >> "$GITHUB_OUTPUT" + fi + + - name: Create build summary + # v8 + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd + with: + github-token: ${{ github.token }} + script: | + const prNumber = '${{ inputs.APP_PR_NUMBER }}'; + const webLink = prNumber && '${{ needs.web.result }}' === 'success' ? `https://${prNumber}.pr-testing.expensify.com` : ''; + const androidLink = '${{ needs.androidHybrid.outputs.ROCK_ANDROID_ADHOC_INDEX_URL }}' || ''; + const iosLink = '${{ needs.iosHybrid.outputs.ROCK_IOS_ADHOC_INDEX_URL }}' || ''; + const mobileExpensifySHA = '${{ steps.getMobileExpensifySHA.outputs.SHA }}' || ''; + + const webStatus = webLink ? 'โœ… Success' : '${{ needs.web.result }}' === 'failure' ? 'โŒ Failed' : 'โญ๏ธ Skipped'; + const androidStatus = androidLink ? 'โœ… Success' : '${{ needs.androidHybrid.result }}' === 'failure' ? 'โŒ Failed' : 'โญ๏ธ Skipped'; + const iosStatus = iosLink ? 'โœ… Success' : '${{ needs.iosHybrid.result }}' === 'failure' ? 'โŒ Failed' : 'โญ๏ธ Skipped'; + + const summary = core.summary + .addTable([ + [{data: 'Platform', header: true}, {data: 'Status', header: true}, {data: 'Download', header: true}], + [ + 'Web', + webStatus, + webLink ? `${webLink}` : '-' + ], + [ + 'Android', + androidStatus, + androidLink ? `${androidLink}` : '-' + ], + [ + 'iOS', + iosStatus, + iosLink ? `${iosLink}` : '-' + ], + ]); + + if (mobileExpensifySHA) { + const mobileExpensifyUrl = `https://github.com/Expensify/Mobile-Expensify/commit/${mobileExpensifySHA}`; + const label = '${{ inputs.MOBILE_EXPENSIFY_REF }}' ? 'Mobile-Expensify SHA (Custom)' : 'Mobile-Expensify Submodule SHA'; + summary.addRaw(`\n**${label}:** [${mobileExpensifySHA}](${mobileExpensifyUrl})`); + } + + if (prNumber) { + const prUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/pull/${prNumber}`; + summary.addRaw(`\n**PR Link:** ${prUrl}`); + } else { + summary.addRaw(`\n**PR Link:** No PR associated with this commit.`); + } + + summary.write(); diff --git a/.github/workflows/claude-review.yml b/.github/workflows/claude-review.yml index 543ffd303dcd..29bc53910719 100644 --- a/.github/workflows/claude-review.yml +++ b/.github/workflows/claude-review.yml @@ -42,30 +42,32 @@ jobs: run: | echo "$GITHUB_WORKSPACE/.claude/scripts" >> "$GITHUB_PATH" - - name: Extract allowed rules from code-inline-reviewer.md + - name: Extract allowed rules from coding standards run: | "$GITHUB_WORKSPACE/.github/scripts/extractAllowedRules.sh" \ - "$GITHUB_WORKSPACE/.claude/agents/code-inline-reviewer.md" \ + "$GITHUB_WORKSPACE/.claude/skills/coding-standards/rules" \ "$GITHUB_WORKSPACE/.claude/allowed-rules.txt" - name: Run Claude Code (code) if: steps.filter.outputs.code == 'true' - uses: anthropics/claude-code-action@a7e4c51380c42dd89b127f5e5f9be7b54020bc6b # v1.0.21 + uses: anthropics/claude-code-action@ea36d6abdedc17fc2a671b36060770b208a6f8f1 # v1.0.51 with: anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} github_token: ${{ secrets.GITHUB_TOKEN }} allowed_non_write_users: "*" prompt: "/review-code-pr REPO: ${{ github.repository }} PR_NUMBER: ${{ github.event.pull_request.number }}" claude_args: | + --model claude-opus-4-6 --allowedTools "Task,Glob,Grep,Read,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(addPrReaction.sh:*),Bash(createInlineComment.sh:*)" - name: Run Claude Code (docs) if: steps.filter.outputs.docs == 'true' - uses: anthropics/claude-code-action@a7e4c51380c42dd89b127f5e5f9be7b54020bc6b # v1.0.21 + uses: anthropics/claude-code-action@ea36d6abdedc17fc2a671b36060770b208a6f8f1 # v1.0.51 with: anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} github_token: ${{ secrets.GITHUB_TOKEN }} allowed_non_write_users: "*" prompt: "/review-helpdot-pr REPO: ${{ github.repository }} PR_NUMBER: ${{ github.event.pull_request.number }}" claude_args: | + --model claude-opus-4-6 --allowedTools "Task,Glob,Grep,Read,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),mcp__github_inline_comment__create_inline_comment" diff --git a/.github/workflows/deployBlockerInvestigation.yml b/.github/workflows/deployBlockerInvestigation.yml index 6722161a186b..a6186228db10 100644 --- a/.github/workflows/deployBlockerInvestigation.yml +++ b/.github/workflows/deployBlockerInvestigation.yml @@ -70,7 +70,7 @@ jobs: - name: Run Claude to investigate deploy blocker if: steps.validate.outputs.valid == 'true' - uses: anthropics/claude-code-action@a7e4c51380c42dd89b127f5e5f9be7b54020bc6b # v1.0.21 + uses: anthropics/claude-code-action@ea36d6abdedc17fc2a671b36060770b208a6f8f1 # v1.0.51 with: anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} github_token: ${{ secrets.OS_BOTIFY_TOKEN }} diff --git a/.github/workflows/testBuild.yml b/.github/workflows/testBuild.yml index efe04e957438..ba03181ff3d1 100644 --- a/.github/workflows/testBuild.yml +++ b/.github/workflows/testBuild.yml @@ -40,8 +40,8 @@ jobs: MOBILE_PR_NUMBER: ${{ steps.extractMobilePRNumber.outputs.PR_NUMBER }} steps: - name: Checkout - # v4 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 + # v6 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd - name: Validate that user is an Expensify employee uses: ./.github/actions/composite/validateActor @@ -78,7 +78,6 @@ jobs: echo "PR_NUMBER=$PR_NUMBER" >> "$GITHUB_OUTPUT" - name: Check if App pull request number is correct - if: ${{ github.event_name == 'workflow_dispatch' }} id: getHeadRef run: | set -e @@ -98,15 +97,19 @@ jobs: steps: - name: Check if author specified Expensify/Mobile-Expensify PR id: mobileExpensifyPR - # v7 - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea + # v8 + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd with: github-token: ${{ github.token }} result-encoding: string script: | - if ('${{ needs.prep.outputs.MOBILE_PR_NUMBER }}') return '${{ needs.prep.outputs.MOBILE_PR_NUMBER }}'; + if ('${{ needs.prep.outputs.MOBILE_PR_NUMBER }}') { + return '${{ needs.prep.outputs.MOBILE_PR_NUMBER }}'; + } - if (!'${{ needs.prep.outputs.APP_PR_NUMBER }}') return ''; + if (!'${{ needs.prep.outputs.APP_PR_NUMBER }}') { + return ''; + } const pullRequest = await github.rest.pulls.get({ owner: context.repo.owner, @@ -127,8 +130,8 @@ jobs: MOBILE_EXPENSIFY_REF: ${{ steps.getHeadRef.outputs.REF || 'main' }} steps: - name: Checkout - # v4 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 + # v6 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd - name: Check if Expensify/Mobile-Expensify pull request number is correct id: getHeadRef @@ -143,365 +146,16 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.OS_BOTIFY_TOKEN }} - postGitHubCommentBuildStarted: - name: Post build started comment - runs-on: blacksmith-4vcpu-ubuntu-2404 - needs: [prep, getMobileExpensifyPR, getMobileExpensifyRef] - steps: - - name: Add build start comment to Expensify/App PR - if: ${{ needs.prep.outputs.APP_PR_NUMBER != '' }} - # v7 - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea - with: - github-token: ${{ github.token }} - script: | - const workflowURL = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`; - github.rest.issues.createComment({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: ${{ needs.prep.outputs.APP_PR_NUMBER }}, - body: `๐Ÿšง @${{ github.actor }} has triggered a test Expensify/App build. You can view the [workflow run here](${workflowURL}).` - }); - - - name: Add build start comment to Expensify/Mobile-Expensify PR - if: ${{ needs.getMobileExpensifyPR.outputs.MOBILE_EXPENSIFY_PR != '' }} - # v7 - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea - with: - github-token: ${{ secrets.OS_BOTIFY_TOKEN }} - script: | - const workflowURL = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`; - github.rest.issues.createComment({ - owner: context.repo.owner, - repo: 'Mobile-Expensify', - issue_number: ${{ needs.getMobileExpensifyPR.outputs.MOBILE_EXPENSIFY_PR }}, - body: `๐Ÿšง @${{ github.actor }} has triggered a test Expensify/Mobile-Expensify build. You can view the [workflow run here](${workflowURL}).` - }); - - web: - name: Build and deploy Web - if: ${{ inputs.WEB && needs.prep.outputs.APP_PR_NUMBER }} - needs: [prep] - runs-on: blacksmith-16vcpu-ubuntu-2404 - env: - PULL_REQUEST_NUMBER: ${{ needs.prep.outputs.APP_PR_NUMBER }} - steps: - - name: Checkout - # v4 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - ref: ${{ needs.prep.outputs.APP_REF }} - - - name: Create .env.adhoc file based on staging - run: | - cp .env.staging .env.adhoc - sed -i 's/ENVIRONMENT=staging/ENVIRONMENT=adhoc/' .env.adhoc - - - name: Inject CI data into JS bundle - run: ./.github/scripts/inject-ci-data.sh PULL_REQUEST_NUMBER="$PULL_REQUEST_NUMBER" - - - name: Setup Node - uses: ./.github/actions/composite/setupNode - - - name: Configure AWS Credentials - # v4 - uses: aws-actions/configure-aws-credentials@ececac1a45f3b08a01d2dd070d28d111c5fe6722 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: us-east-1 - - - name: Build web for testing - run: npm run build-adhoc - env: - SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - - - name: Deploy to S3 for internal testing - run: aws s3 cp --recursive --acl public-read "$GITHUB_WORKSPACE"/dist s3://ad-hoc-expensify-cash/web/"$PULL_REQUEST_NUMBER" - - androidHybrid: - name: Build Android HybridApp - if: ${{ inputs.ANDROID }} - needs: [prep, getMobileExpensifyPR, getMobileExpensifyRef] - runs-on: blacksmith-16vcpu-ubuntu-2404 - env: - PULL_REQUEST_NUMBER: ${{ needs.prep.outputs.APP_PR_NUMBER }} - outputs: - ROCK_ANDROID_ADHOC_INDEX_URL: ${{ steps.set-artifact-url.outputs.ARTIFACT_URL }} - steps: - - name: Checkout - # v4 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - submodules: true - ref: ${{ needs.prep.outputs.APP_REF }} - token: ${{ secrets.OS_BOTIFY_TOKEN }} - - - name: Checkout Mobile-Expensify to specified branch or commit - if: ${{ needs.getMobileExpensifyRef.outputs.MOBILE_EXPENSIFY_REF != '' }} - run: | - cd Mobile-Expensify - git fetch origin ${{ needs.getMobileExpensifyRef.outputs.MOBILE_EXPENSIFY_REF }} - git checkout ${{ needs.getMobileExpensifyRef.outputs.MOBILE_EXPENSIFY_REF }} - echo "Building from https://github.com/Expensify/Mobile-Expensify/pull/${{ needs.getMobileExpensifyPR.outputs.MOBILE_EXPENSIFY_PR }}" - - - name: Configure MapBox SDK - run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }} - - - name: Setup Node - id: setup-node - uses: ./.github/actions/composite/setupNode - with: - IS_HYBRID_BUILD: 'true' - - - name: Run grunt build - run: | - cd Mobile-Expensify - npm run grunt:build:shared - - - name: Create .env.adhoc file based on staging - run: | - cp .env.staging .env.adhoc - sed -i 's/ENVIRONMENT=staging/ENVIRONMENT=adhoc/' .env.adhoc - - - name: Inject CI data into JS bundle - run: ./.github/scripts/inject-ci-data.sh PULL_REQUEST_NUMBER="$PULL_REQUEST_NUMBER" - - - name: Setup 1Password CLI and certificates - uses: Expensify/GitHub-Actions/setup-certificate-1p@main - with: - OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} - SHOULD_LOAD_SSL_CERTIFICATES: 'false' - - - name: Load files from 1Password - env: - OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} - run: | - op read "op://${{ vars.OP_VAULT }}/upload-key.keystore/upload-key.keystore" --force --out-file ./upload-key.keystore - op read "op://${{ vars.OP_VAULT }}/android-fastlane-json-key.json/android-fastlane-json-key.json" --force --out-file ./android-fastlane-json-key.json - - # Copy the keystore to the Android directory for Fullstory - cp ./upload-key.keystore Mobile-Expensify/Android - - - name: Load Android upload keystore credentials from 1Password - id: load-credentials - # v2 - uses: 1password/load-secrets-action@581a835fb51b8e7ec56b71cf2ffddd7e68bb25e0 - with: - export-env: false - env: - OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} - ANDROID_UPLOAD_KEYSTORE_PASSWORD: op://${{ vars.OP_VAULT }}/Repository-Secrets/ANDROID_UPLOAD_KEYSTORE_PASSWORD - ANDROID_UPLOAD_KEYSTORE_ALIAS: op://${{ vars.OP_VAULT }}/Repository-Secrets/ANDROID_UPLOAD_KEYSTORE_ALIAS - ANDROID_UPLOAD_KEY_PASSWORD: op://${{ vars.OP_VAULT }}/Repository-Secrets/ANDROID_UPLOAD_KEY_PASSWORD - - - name: Configure AWS Credentials - # v4 - uses: aws-actions/configure-aws-credentials@ececac1a45f3b08a01d2dd070d28d111c5fe6722 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: us-east-1 - - - name: Rock Remote Build - Android - id: rock-remote-build-android - uses: callstackincubator/android@2177ac62cabe662aa49a2bc6f3154070705dd8f5 - env: - GITHUB_TOKEN: ${{ github.token }} - SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - IS_HYBRID_APP: true - with: - variant: 'Adhoc' - sign: true - re-sign: true - ad-hoc: true - keystore-file: './upload-key.keystore' - keystore-store-file: 'upload-key.keystore' - keystore-store-password: ${{ steps.load-credentials.outputs.ANDROID_UPLOAD_KEYSTORE_PASSWORD }} - keystore-key-alias: ${{ steps.load-credentials.outputs.ANDROID_UPLOAD_KEYSTORE_ALIAS }} - keystore-key-password: ${{ steps.load-credentials.outputs.ANDROID_UPLOAD_KEY_PASSWORD }} - # Specify the path (relative to the Android source directory) where the keystore should be placed. - keystore-path: '../tools/buildtools/upload-key.keystore' - comment-bot: false - rock-build-extra-params: '--extra-params "-PreactNativeArchitectures=arm64-v8a,x86_64 --profile"' - custom-ref: ${{ needs.prep.outputs.APP_REF }} - - - name: Upload Gradle profile report - if: always() - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 - with: - name: gradle-profile-report - path: Mobile-Expensify/Android/build/reports/profile/ - if-no-files-found: ignore - - - name: Set artifact URL output - id: set-artifact-url - run: echo "ARTIFACT_URL=$ARTIFACT_URL" >> "$GITHUB_OUTPUT" - - iosHybrid: - name: Build and deploy iOS for testing - if: ${{ inputs.IOS }} + buildApps: needs: [prep, getMobileExpensifyPR, getMobileExpensifyRef] - env: - DEVELOPER_DIR: /Applications/Xcode_26.2.app/Contents/Developer - PULL_REQUEST_NUMBER: ${{ needs.prep.outputs.APP_PR_NUMBER }} - runs-on: macos-15-xlarge - outputs: - ROCK_IOS_ADHOC_INDEX_URL: ${{ steps.set-artifact-url.outputs.ARTIFACT_URL }} - steps: - - name: Checkout - # v4 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - submodules: true - ref: ${{ needs.prep.outputs.APP_REF }} - token: ${{ secrets.OS_BOTIFY_TOKEN }} - - - name: Checkout Mobile-Expensify to specified branch or commit - if: ${{ needs.getMobileExpensifyRef.outputs.MOBILE_EXPENSIFY_REF != '' }} - run: | - cd Mobile-Expensify - git fetch origin ${{ needs.getMobileExpensifyRef.outputs.MOBILE_EXPENSIFY_REF }} - git checkout ${{ needs.getMobileExpensifyRef.outputs.MOBILE_EXPENSIFY_REF }} - echo "Building from https://github.com/Expensify/Mobile-Expensify/pull/${{ needs.getMobileExpensifyPR.outputs.MOBILE_EXPENSIFY_PR }}" - - - name: Configure MapBox SDK - run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }} - - - name: Setup Node - id: setup-node - uses: ./.github/actions/composite/setupNode - with: - IS_HYBRID_BUILD: 'true' - - - name: Create .env.adhoc file based on staging - run: | - cp .env.staging .env.adhoc - sed -i '' 's/ENVIRONMENT=staging/ENVIRONMENT=adhoc/' .env.adhoc - - - name: Inject CI data into JS bundle - run: ./.github/scripts/inject-ci-data.sh PULL_REQUEST_NUMBER="$PULL_REQUEST_NUMBER" - - - name: Setup 1Password CLI and certificates - uses: Expensify/GitHub-Actions/setup-certificate-1p@main - with: - OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} - SHOULD_LOAD_SSL_CERTIFICATES: 'false' - - - name: Load files from 1Password - env: - OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} - run: | - op read "op://${{ vars.OP_VAULT }}/OldApp_AdHoc/OldApp_AdHoc.mobileprovision" --force --out-file ./OldApp_AdHoc.mobileprovision - op read "op://${{ vars.OP_VAULT }}/OldApp_AdHoc_Share_Extension/OldApp_AdHoc_Share_Extension.mobileprovision" --force --out-file ./OldApp_AdHoc_Share_Extension.mobileprovision - op read "op://${{ vars.OP_VAULT }}/OldApp_AdHoc_Notification_Service/OldApp_AdHoc_Notification_Service.mobileprovision" --force --out-file ./OldApp_AdHoc_Notification_Service.mobileprovision - op read "op://${{ vars.OP_VAULT }}/New Expensify Distribution Certificate/Certificates.p12" --force --out-file ./Certificates.p12 - - - name: Create ExportOptions.plist - run: | - cat > Mobile-Expensify/iOS/ExportOptions.plist << 'EOF' - - - - - method - ad-hoc - provisioningProfiles - - com.expensify.expensifylite.adhoc - (OldApp) AdHoc - com.expensify.expensifylite.adhoc.SmartScanExtension - (OldApp) AdHoc: Share Extension - com.expensify.expensifylite.adhoc.NotificationServiceExtension - (OldApp) AdHoc: Notification Service - - - - EOF - - - name: Configure AWS Credentials - # v4 - uses: aws-actions/configure-aws-credentials@ececac1a45f3b08a01d2dd070d28d111c5fe6722 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: us-east-1 - - - name: Rock Remote Build - iOS - id: rock-remote-build-ios - uses: callstackincubator/ios@d638bd25c764655baeeced3232c692f1698cf72b - env: - GITHUB_TOKEN: ${{ github.token }} - SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - IS_HYBRID_APP: true - with: - destination: device - re-sign: true - ad-hoc: true - scheme: 'Expensify AdHoc' - configuration: 'AdHoc' - certificate-file: './Certificates.p12' - provisioning-profiles: | - [ - { - "name": "(OldApp) AdHoc", - "file": "./OldApp_AdHoc.mobileprovision" - }, - { - "name": "(OldApp) AdHoc: Share Extension", - "file": "./OldApp_AdHoc_Share_Extension.mobileprovision" - }, - { - "name": "(OldApp) AdHoc: Notification Service", - "file": "./OldApp_AdHoc_Notification_Service.mobileprovision" - } - ] - comment-bot: false - custom-ref: ${{ needs.prep.outputs.APP_REF }} - - - name: Set artifact URL output - id: set-artifact-url - run: echo "ARTIFACT_URL=$ARTIFACT_URL" >> "$GITHUB_OUTPUT" - - postGithubComment: - runs-on: blacksmith-4vcpu-ubuntu-2404 - if: always() - name: Post a GitHub comment with app download links for testing - needs: [prep, getMobileExpensifyPR, web, androidHybrid, iosHybrid] - steps: - - name: Checkout - # v4 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - ref: ${{ needs.prep.outputs.APP_REF }} - - - name: Download Artifact - # v4 - uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e - - - name: Publish links to apps for download on Expensify/App PR - if: ${{ needs.prep.outputs.APP_PR_NUMBER || (!needs.prep.outputs.APP_PR_NUMBER && !needs.getMobileExpensifyPR.outputs.MOBILE_EXPENSIFY_PR) }} - uses: ./.github/actions/javascript/postTestBuildComment - with: - REPO: App - APP_PR_NUMBER: ${{ needs.prep.outputs.APP_PR_NUMBER }} - MOBILE_EXPENSIFY_PR_NUMBER: ${{ needs.getMobileExpensifyPR.outputs.MOBILE_EXPENSIFY_PR }} - GITHUB_TOKEN: ${{ github.token }} - ANDROID: ${{ needs.androidHybrid.result }} - IOS: ${{ needs.iosHybrid.result }} - WEB: ${{ needs.web.result }} - ANDROID_LINK: ${{ needs.androidHybrid.outputs.ROCK_ANDROID_ADHOC_INDEX_URL }} - IOS_LINK: ${{ needs.iosHybrid.outputs.ROCK_IOS_ADHOC_INDEX_URL }} - WEB_LINK: https://${{ needs.prep.outputs.APP_PR_NUMBER }}.pr-testing.expensify.com - - - name: Publish links to apps for download on Expensify/Mobile-Expensify PR - if: ${{ needs.getMobileExpensifyPR.outputs.MOBILE_EXPENSIFY_PR }} - uses: ./.github/actions/javascript/postTestBuildComment - with: - REPO: Mobile-Expensify - MOBILE_EXPENSIFY_PR_NUMBER: ${{ needs.getMobileExpensifyPR.outputs.MOBILE_EXPENSIFY_PR }} - GITHUB_TOKEN: ${{ secrets.OS_BOTIFY_TOKEN }} - ANDROID: ${{ needs.androidHybrid.result }} - IOS: ${{ needs.iosHybrid.result }} - ANDROID_LINK: ${{ needs.androidHybrid.outputs.ROCK_ANDROID_ADHOC_INDEX_URL }} - IOS_LINK: ${{ needs.iosHybrid.outputs.ROCK_IOS_ADHOC_INDEX_URL }} \ No newline at end of file + uses: ./.github/workflows/buildAdHoc.yml + with: + APP_REF: ${{ needs.prep.outputs.APP_REF }} + APP_PR_NUMBER: ${{ needs.prep.outputs.APP_PR_NUMBER }} + MOBILE_EXPENSIFY_REF: ${{ needs.getMobileExpensifyRef.outputs.MOBILE_EXPENSIFY_REF }} + MOBILE_EXPENSIFY_PR: ${{ needs.getMobileExpensifyPR.outputs.MOBILE_EXPENSIFY_PR }} + BUILD_WEB: ${{ inputs.WEB && 'true' || 'false' }} + BUILD_IOS: ${{ inputs.IOS && 'true' || 'false' }} + BUILD_ANDROID: ${{ inputs.ANDROID && 'true' || 'false' }} + TRIGGER_ACTOR: ${{ github.actor }} + secrets: inherit diff --git a/.github/workflows/testBuildOnPush.yml b/.github/workflows/testBuildOnPush.yml index 6257816619f8..5bc2bbe15063 100644 --- a/.github/workflows/testBuildOnPush.yml +++ b/.github/workflows/testBuildOnPush.yml @@ -11,8 +11,8 @@ jobs: timeout-minutes: 120 steps: - name: Checkout - # v4 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 + # v6 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd - name: Wait for earlier runs to finish (FIFO queue) uses: ./.github/actions/javascript/waitForPreviousRuns @@ -27,14 +27,12 @@ jobs: outputs: APP_REF: ${{ github.sha }} APP_PR_NUMBER: ${{ steps.getMergedPullRequest.outputs.PR_NUMBER }} - PR_URL: ${{ steps.getMergedPullRequest.outputs.PR_URL }} BUILD_WEB: ${{ steps.detectOSBotifyPush.outputs.BUILD_WEB || 'true' }} BUILD_MOBILE: ${{ steps.detectOSBotifyPush.outputs.BUILD_MOBILE || 'true' }} - POST_COMMENTS: ${{ steps.detectOSBotifyPush.outputs.POST_COMMENTS || steps.getMergedPullRequest.outputs.POST_COMMENTS || 'true' }} steps: - name: Checkout - # v4 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 + # v6 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd - name: Validate that user is an Expensify employee uses: ./.github/actions/composite/validateActor @@ -45,421 +43,51 @@ jobs: - name: Detect OSBotify automated push id: detectOSBotifyPush if: ${{ github.actor == 'OSBotify' }} - # v7 - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea + # v8 + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd with: github-token: ${{ github.token }} script: | const commitMessage = context.payload?.head_commit?.message || ''; - if (commitMessage.startsWith('Update Mobile-Expensify submodule')) { core.notice(`${context.actor} automated push with Mobile-Expensify submodule update detected. Skipping web build and post comments. No PR associated with this commit.`); core.setOutput('BUILD_WEB', 'false'); - core.setOutput('POST_COMMENTS', 'false'); } else { core.warning(`OSBotify automated push detected but without Mobile-Expensify submodule update commit phrase. Skipping rest of the workflow. No PR associated with this commit.`); core.setOutput('BUILD_MOBILE', 'false'); core.setOutput('BUILD_WEB', 'false'); - core.setOutput('POST_COMMENTS', 'false'); } - name: Get merged pull request id: getMergedPullRequest if: ${{ github.actor != 'OSBotify' }} - # v7 - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea + # v8 + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd with: github-token: ${{ github.token }} script: | const prData = await github.rest.repos.listPullRequestsAssociatedWithCommit({ - owner: context.repo.owner, - repo: context.repo.repo, - commit_sha: context.sha, + owner: context.repo.owner, + repo: context.repo.repo, + commit_sha: context.sha, }); const prNumber = prData?.data?.find(p => p.state === 'closed' && p.merged_at)?.number?.toString(); if (prNumber) { - const prUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/pull/${prNumber}`; - core.notice(`Found merged pull request: [#${prNumber}](${prUrl})`); - core.setOutput('PR_URL', prUrl); - core.setOutput('PR_NUMBER', prNumber); + const prUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/pull/${prNumber}`; + core.notice(`Found merged pull request: [#${prNumber}](${prUrl})`); + core.setOutput('PR_NUMBER', prNumber); } else { - core.setOutput('POST_COMMENTS', 'false'); - core.setFailed(`Commit pushed by non-OSBotify actor. No merged pull request found for commit ${context.sha}`); + core.setFailed(`Commit pushed by non-OSBotify actor. No merged pull request found for commit ${context.sha}`); } - postGitHubCommentBuildStarted: - name: Post build started comment - runs-on: blacksmith-4vcpu-ubuntu-2404 - if: ${{ needs.prep.outputs.POST_COMMENTS == 'true' }} - needs: [prep] - steps: - - name: Add build start comment to Expensify/App PR - if: ${{ needs.prep.outputs.APP_PR_NUMBER != '' }} - # v7 - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea - with: - github-token: ${{ github.token }} - script: | - const workflowURL = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`; - github.rest.issues.createComment({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: ${{ needs.prep.outputs.APP_PR_NUMBER }}, - body: `๐Ÿšง @${{ github.actor }} has triggered a test Expensify/App build. You can view the [workflow run here](${workflowURL}).` - }); - - web: - name: Build and deploy Web - if: ${{ needs.prep.outputs.BUILD_WEB == 'true' && needs.prep.outputs.APP_PR_NUMBER }} - needs: [prep] - runs-on: blacksmith-16vcpu-ubuntu-2404 - env: - PULL_REQUEST_NUMBER: ${{ needs.prep.outputs.APP_PR_NUMBER || '' }} - steps: - - name: Checkout - # v4 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - ref: ${{ needs.prep.outputs.APP_REF }} - - - name: Create .env.adhoc file based on staging - run: | - cp .env.staging .env.adhoc - sed -i 's/ENVIRONMENT=staging/ENVIRONMENT=adhoc/' .env.adhoc - - - name: Inject CI data into JS bundle - run: ./.github/scripts/inject-ci-data.sh PULL_REQUEST_NUMBER="$PULL_REQUEST_NUMBER" - - - name: Setup Node - uses: ./.github/actions/composite/setupNode - - - name: Configure AWS Credentials - # v4 - uses: aws-actions/configure-aws-credentials@ececac1a45f3b08a01d2dd070d28d111c5fe6722 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: us-east-1 - - - name: Build web for testing - run: npm run build-adhoc - env: - SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - - - name: Deploy to S3 for internal testing - run: aws s3 cp --recursive --acl public-read "$GITHUB_WORKSPACE"/dist s3://ad-hoc-expensify-cash/web/"$PULL_REQUEST_NUMBER" - - androidHybrid: - name: Build Android HybridApp - if: ${{ needs.prep.outputs.BUILD_MOBILE == 'true' }} - needs: [prep] - runs-on: blacksmith-16vcpu-ubuntu-2404 - env: - PULL_REQUEST_NUMBER: ${{ needs.prep.outputs.APP_PR_NUMBER || '' }} - outputs: - ROCK_ANDROID_ADHOC_INDEX_URL: ${{ steps.set-artifact-url.outputs.ARTIFACT_URL }} - steps: - - name: Checkout - # v4 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - submodules: true - ref: ${{ needs.prep.outputs.APP_REF }} - token: ${{ secrets.OS_BOTIFY_TOKEN }} - - - name: Configure MapBox SDK - run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }} - - - name: Setup Node - id: setup-node - uses: ./.github/actions/composite/setupNode - with: - IS_HYBRID_BUILD: 'true' - - - name: Run grunt build - run: | - cd Mobile-Expensify - npm run grunt:build:shared - - - name: Create .env.adhoc file based on staging - run: | - cp .env.staging .env.adhoc - sed -i 's/ENVIRONMENT=staging/ENVIRONMENT=adhoc/' .env.adhoc - - - name: Inject CI data into JS bundle - run: ./.github/scripts/inject-ci-data.sh PULL_REQUEST_NUMBER="$PULL_REQUEST_NUMBER" - - - name: Setup 1Password CLI and certificates - uses: Expensify/GitHub-Actions/setup-certificate-1p@main - with: - OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} - SHOULD_LOAD_SSL_CERTIFICATES: 'false' - - - name: Load files from 1Password - env: - OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} - run: | - op read "op://${{ vars.OP_VAULT }}/upload-key.keystore/upload-key.keystore" --force --out-file ./upload-key.keystore - op read "op://${{ vars.OP_VAULT }}/android-fastlane-json-key.json/android-fastlane-json-key.json" --force --out-file ./android-fastlane-json-key.json - - # Copy the keystore to the Android directory for Fullstory - cp ./upload-key.keystore Mobile-Expensify/Android - - - name: Load Android upload keystore credentials from 1Password - id: load-credentials - # v2 - uses: 1password/load-secrets-action@581a835fb51b8e7ec56b71cf2ffddd7e68bb25e0 - with: - export-env: false - env: - OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} - ANDROID_UPLOAD_KEYSTORE_PASSWORD: op://${{ vars.OP_VAULT }}/Repository-Secrets/ANDROID_UPLOAD_KEYSTORE_PASSWORD - ANDROID_UPLOAD_KEYSTORE_ALIAS: op://${{ vars.OP_VAULT }}/Repository-Secrets/ANDROID_UPLOAD_KEYSTORE_ALIAS - ANDROID_UPLOAD_KEY_PASSWORD: op://${{ vars.OP_VAULT }}/Repository-Secrets/ANDROID_UPLOAD_KEY_PASSWORD - - - name: Configure AWS Credentials - # v4 - uses: aws-actions/configure-aws-credentials@ececac1a45f3b08a01d2dd070d28d111c5fe6722 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: us-east-1 - - - name: Rock Remote Build - Android - id: rock-remote-build-android - uses: callstackincubator/android@0bbc1b7c2e1a8be1ecb4d6c744c211869823fd65 - env: - GITHUB_TOKEN: ${{ github.token }} - SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - IS_HYBRID_APP: true - with: - variant: 'Adhoc' - sign: true - re-sign: true - ad-hoc: true - keystore-file: './upload-key.keystore' - keystore-store-file: 'upload-key.keystore' - keystore-store-password: ${{ steps.load-credentials.outputs.ANDROID_UPLOAD_KEYSTORE_PASSWORD }} - keystore-key-alias: ${{ steps.load-credentials.outputs.ANDROID_UPLOAD_KEYSTORE_ALIAS }} - keystore-key-password: ${{ steps.load-credentials.outputs.ANDROID_UPLOAD_KEY_PASSWORD }} - # Specify the path (relative to the Android source directory) where the keystore should be placed. - keystore-path: '../tools/buildtools/upload-key.keystore' - comment-bot: false - rock-build-extra-params: '--extra-params -PreactNativeArchitectures=arm64-v8a,x86_64' - - - name: Set artifact URL output - id: set-artifact-url - run: echo "ARTIFACT_URL=$ARTIFACT_URL" >> "$GITHUB_OUTPUT" - - iosHybrid: - name: Build and deploy iOS for testing - if: ${{ needs.prep.outputs.BUILD_MOBILE == 'true' }} + buildApps: needs: [prep] - env: - DEVELOPER_DIR: /Applications/Xcode_26.2.app/Contents/Developer - PULL_REQUEST_NUMBER: ${{ needs.prep.outputs.APP_PR_NUMBER || '' }} - runs-on: macos-15-xlarge - outputs: - ROCK_IOS_ADHOC_INDEX_URL: ${{ steps.set-artifact-url.outputs.ARTIFACT_URL }} - steps: - - name: Checkout - # v4 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - submodules: true - ref: ${{ needs.prep.outputs.APP_REF }} - token: ${{ secrets.OS_BOTIFY_TOKEN }} - - - name: Configure MapBox SDK - run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }} - - - name: Setup Node - id: setup-node - uses: ./.github/actions/composite/setupNode - with: - IS_HYBRID_BUILD: 'true' - - - name: Create .env.adhoc file based on staging - run: | - cp .env.staging .env.adhoc - sed -i '' 's/ENVIRONMENT=staging/ENVIRONMENT=adhoc/' .env.adhoc - - - name: Inject CI data into JS bundle - run: ./.github/scripts/inject-ci-data.sh PULL_REQUEST_NUMBER="$PULL_REQUEST_NUMBER" - - - name: Setup 1Password CLI and certificates - uses: Expensify/GitHub-Actions/setup-certificate-1p@main - with: - OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} - SHOULD_LOAD_SSL_CERTIFICATES: 'false' - - - name: Load files from 1Password - env: - OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} - run: | - op read "op://${{ vars.OP_VAULT }}/OldApp_AdHoc/OldApp_AdHoc.mobileprovision" --force --out-file ./OldApp_AdHoc.mobileprovision - op read "op://${{ vars.OP_VAULT }}/OldApp_AdHoc_Share_Extension/OldApp_AdHoc_Share_Extension.mobileprovision" --force --out-file ./OldApp_AdHoc_Share_Extension.mobileprovision - op read "op://${{ vars.OP_VAULT }}/OldApp_AdHoc_Notification_Service/OldApp_AdHoc_Notification_Service.mobileprovision" --force --out-file ./OldApp_AdHoc_Notification_Service.mobileprovision - op read "op://${{ vars.OP_VAULT }}/New Expensify Distribution Certificate/Certificates.p12" --force --out-file ./Certificates.p12 - - - name: Create ExportOptions.plist - run: | - cat > Mobile-Expensify/iOS/ExportOptions.plist << 'EOF' - - - - - method - ad-hoc - provisioningProfiles - - com.expensify.expensifylite.adhoc - (OldApp) AdHoc - com.expensify.expensifylite.adhoc.SmartScanExtension - (OldApp) AdHoc: Share Extension - com.expensify.expensifylite.adhoc.NotificationServiceExtension - (OldApp) AdHoc: Notification Service - - - - EOF - - - name: Configure AWS Credentials - # v4 - uses: aws-actions/configure-aws-credentials@ececac1a45f3b08a01d2dd070d28d111c5fe6722 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: us-east-1 - - - name: Rock Remote Build - iOS - id: rock-remote-build-ios - uses: callstackincubator/ios@8dcef6cc275e0cf3299f5a97cde5ebd635c887d7 - env: - GITHUB_TOKEN: ${{ github.token }} - SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - IS_HYBRID_APP: true - with: - destination: device - re-sign: true - ad-hoc: true - scheme: 'Expensify AdHoc' - configuration: 'AdHoc' - certificate-file: './Certificates.p12' - provisioning-profiles: | - [ - { - "name": "(OldApp) AdHoc", - "file": "./OldApp_AdHoc.mobileprovision" - }, - { - "name": "(OldApp) AdHoc: Share Extension", - "file": "./OldApp_AdHoc_Share_Extension.mobileprovision" - }, - { - "name": "(OldApp) AdHoc: Notification Service", - "file": "./OldApp_AdHoc_Notification_Service.mobileprovision" - } - ] - comment-bot: false - - - name: Set artifact URL output - id: set-artifact-url - run: echo "ARTIFACT_URL=$ARTIFACT_URL" >> "$GITHUB_OUTPUT" - - postGithubComment: - runs-on: blacksmith-4vcpu-ubuntu-2404 - if: ${{ always() && needs.prep.outputs.POST_COMMENTS == 'true' }} - name: Post a GitHub comment with app download links for testing - needs: [prep, web, androidHybrid, iosHybrid] - steps: - - name: Checkout - # v4 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - ref: ${{ needs.prep.outputs.APP_REF }} - - - name: Publish links to apps for download on Expensify/App PR - if: ${{ needs.prep.outputs.APP_PR_NUMBER }} - uses: ./.github/actions/javascript/postTestBuildComment - with: - REPO: App - APP_PR_NUMBER: ${{ needs.prep.outputs.APP_PR_NUMBER }} - GITHUB_TOKEN: ${{ github.token }} - ANDROID: ${{ needs.androidHybrid.result }} - IOS: ${{ needs.iosHybrid.result }} - WEB: ${{ needs.web.result }} - ANDROID_LINK: ${{ needs.androidHybrid.outputs.ROCK_ANDROID_ADHOC_INDEX_URL || ''}} - IOS_LINK: ${{ needs.iosHybrid.outputs.ROCK_IOS_ADHOC_INDEX_URL || ''}} - WEB_LINK: https://${{ needs.prep.outputs.APP_PR_NUMBER }}.pr-testing.expensify.com - - buildSummary: - runs-on: blacksmith-4vcpu-ubuntu-2404 - if: ${{ always() && (needs.prep.outputs.APP_PR_NUMBER != '' || needs.androidHybrid.outputs.ROCK_ANDROID_ADHOC_INDEX_URL != '' || needs.iosHybrid.outputs.ROCK_IOS_ADHOC_INDEX_URL != '') }} - name: Build Summary - needs: [prep, web, androidHybrid, iosHybrid] - steps: - - name: Checkout - # v4 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - ref: ${{ needs.prep.outputs.APP_REF }} - - - name: Get Mobile-Expensify submodule SHA - id: getSubmoduleSHA - run: | - if [ -d "Mobile-Expensify" ]; then - SUBMODULE_SHA=$(git ls-tree HEAD Mobile-Expensify | awk '{print $3}') - echo "SHA=$SUBMODULE_SHA" >> "$GITHUB_OUTPUT" - fi - - - name: Create build summary - # v7 - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea - with: - github-token: ${{ github.token }} - script: | - const prNumber = '${{ needs.prep.outputs.APP_PR_NUMBER }}'; - const webLink = prNumber && '${{ needs.web.result }}' === 'success' ? `https://${prNumber}.pr-testing.expensify.com` : ''; - const androidLink = '${{ needs.androidHybrid.outputs.ROCK_ANDROID_ADHOC_INDEX_URL }}' || ''; - const iosLink = '${{ needs.iosHybrid.outputs.ROCK_IOS_ADHOC_INDEX_URL }}' || ''; - const submoduleSHA = '${{ steps.getSubmoduleSHA.outputs.SHA }}' || ''; - - const webStatus = webLink ? 'โœ… Success' : '${{ needs.web.result }}' === 'failure' ? 'โŒ Failed' : 'โญ๏ธ Skipped'; - const androidStatus = androidLink ? 'โœ… Success' : '${{ needs.androidHybrid.result }}' === 'failure' ? 'โŒ Failed' : 'โญ๏ธ Skipped'; - const iosStatus = iosLink ? 'โœ… Success' : '${{ needs.iosHybrid.result }}' === 'failure' ? 'โŒ Failed' : 'โญ๏ธ Skipped'; - - const summary = core.summary - .addTable([ - [{data: 'Platform', header: true}, {data: 'Status', header: true}, {data: 'Download', header: true}], - [ - 'Web', - webStatus, - webLink ? `${webLink}` : '-' - ], - [ - 'Android', - androidStatus, - androidLink ? `${androidLink}` : '-' - ], - [ - 'iOS', - iosStatus, - iosLink ? `${iosLink}` : '-' - ], - ]); - - if (submoduleSHA) { - const submoduleUrl = `https://github.com/Expensify/Mobile-Expensify/commit/${submoduleSHA}`; - summary.addRaw(`\n**Mobile-Expensify Submodule SHA:** [${submoduleSHA}](${submoduleUrl})`); - } - - const prUrl = '${{ needs.prep.outputs.PR_URL }}'; - - if (prUrl) { - summary.addRaw(`\n**PR Link:** ${prUrl}`); - } else { - summary.addRaw(`\n**PR Link:** No PR associated with this commit.`); - } - - summary.write(); + uses: ./.github/workflows/buildAdHoc.yml + with: + APP_REF: ${{ needs.prep.outputs.APP_REF }} + APP_PR_NUMBER: ${{ needs.prep.outputs.APP_PR_NUMBER }} + BUILD_WEB: ${{ needs.prep.outputs.BUILD_WEB }} + BUILD_IOS: ${{ needs.prep.outputs.BUILD_MOBILE }} + BUILD_ANDROID: ${{ needs.prep.outputs.BUILD_MOBILE }} + TRIGGER_ACTOR: ${{ github.actor }} + secrets: inherit diff --git a/.prettierrc.js b/.prettierrc.js index 006c40885ee7..eb30ae7216e3 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -6,7 +6,7 @@ module.exports = { arrowParens: 'always', printWidth: 190, singleAttributePerLine: true, - plugins: [require.resolve('@trivago/prettier-plugin-sort-imports')], + plugins: [require.resolve('@prettier/plugin-oxc'), require.resolve('@trivago/prettier-plugin-sort-imports')], // Parser plugins to support TypeScript and JSX importOrderParserPlugins: ['typescript', 'jsx'], // Use modern 'with' syntax for import assertions diff --git a/__mocks__/@expensify/react-native-live-markdown.ts b/__mocks__/@expensify/react-native-live-markdown.ts index f5c894fcc548..c6f2149189a1 100644 --- a/__mocks__/@expensify/react-native-live-markdown.ts +++ b/__mocks__/@expensify/react-native-live-markdown.ts @@ -1,4 +1,27 @@ -export * from '@expensify/react-native-live-markdown/mock'; +import type {Ref} from 'react'; +import React from 'react'; +import {TextInput} from 'react-native'; +import type {TextInputProps} from 'react-native'; + +type MarkdownTextInputProps = TextInputProps & { + ref?: Ref; + parser?: (value: string) => unknown[]; + markdownStyle?: unknown; + formatSelection?: unknown; +}; + +function MarkdownTextInput({ref, parser, markdownStyle, formatSelection, ...textInputProps}: MarkdownTextInputProps) { + if (parser || markdownStyle || formatSelection) { + // no-op to mark unsupported mock props as used + } + return React.createElement(TextInput, { + ...textInputProps, + ref, + }); +} + +const parseExpensiMark = () => []; const getWorkletRuntime = () => ({}); -export {getWorkletRuntime}; + +export {MarkdownTextInput, parseExpensiMark, getWorkletRuntime}; diff --git a/__mocks__/Illustrations.ts b/__mocks__/Illustrations.ts index 300f7529830a..8f7aeedb0090 100644 --- a/__mocks__/Illustrations.ts +++ b/__mocks__/Illustrations.ts @@ -56,6 +56,7 @@ const TeachersUnite = 'TeachersUnite'; const Abacus = 'Abacus'; const Binoculars = 'Binoculars'; const CompanyCard = 'CompanyCard'; +const ReceiptStack = 'ReceiptStack'; const ReceiptUpload = 'ReceiptUpload'; const ExpensifyCardIllustration = 'ExpensifyCardIllustration'; const ExpensifyCardImage = 'ExpensifyCardImage'; @@ -174,6 +175,7 @@ export { Abacus, Binoculars, CompanyCard, + ReceiptStack, ReceiptUpload, ExpensifyCardIllustration, ExpensifyCardImage, diff --git a/android/app/build.gradle b/android/app/build.gradle index 12cc3c0440a5..c2e439bb14e2 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -113,8 +113,8 @@ android { minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion multiDexEnabled rootProject.ext.multiDexEnabled - versionCode 1009031800 - versionName "9.3.18-0" + versionCode 1009031904 + versionName "9.3.19-4" // Supported language variants must be declared here to avoid from being removed during the compilation. // This also helps us to not include unnecessary language variants in the APK. resConfigs "en", "es" diff --git a/android/app/src/main/java/com/expensify/chat/bootsplash/BootSplashModule.java b/android/app/src/main/java/com/expensify/chat/bootsplash/BootSplashModule.java index 7498fa6594fb..656026257dce 100644 --- a/android/app/src/main/java/com/expensify/chat/bootsplash/BootSplashModule.java +++ b/android/app/src/main/java/com/expensify/chat/bootsplash/BootSplashModule.java @@ -16,6 +16,7 @@ import com.expensify.chat.R; import com.facebook.common.logging.FLog; import com.facebook.react.bridge.Promise; +import com.facebook.react.bridge.LifecycleEventListener; import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.bridge.ReactContextBaseJavaModule; import com.facebook.react.bridge.ReactMethod; @@ -30,7 +31,7 @@ import java.util.TimerTask; @ReactModule(name = BootSplashModule.NAME) -public class BootSplashModule extends ReactContextBaseJavaModule { +public class BootSplashModule extends ReactContextBaseJavaModule implements LifecycleEventListener { public static final String NAME = "BootSplash"; private static final BootSplashQueue mPromiseQueue = new BootSplashQueue<>(); @@ -41,6 +42,26 @@ public class BootSplashModule extends ReactContextBaseJavaModule { public BootSplashModule(ReactApplicationContext reactContext) { super(reactContext); + reactContext.addLifecycleEventListener(this); + } + + @Override + public void onHostResume() {} + + @Override + public void onHostPause() {} + + @Override + public void onHostDestroy() { + mShouldKeepOnScreen = false; + clearPromiseQueue(); + + if (mDialog != null) { + try { + mDialog.dismiss(); + } catch (Exception ignored) {} + mDialog = null; + } } @Override @@ -123,19 +144,63 @@ public void onSplashScreenExit(@NonNull SplashScreenView view) { mDialog = new BootSplashDialog(activity, R.style.BootTheme); - mDialog.setOnShowListener(new DialogInterface.OnShowListener() { + UiThreadUtil.runOnUiThread(new Runnable() { @Override - public void onShow(DialogInterface dialog) { - mShouldKeepOnScreen = false; + public void run() { + showDialog(mDialog, new Runnable() { + @Override + public void run() { + mShouldKeepOnScreen = false; + } + }); } }); + } - UiThreadUtil.runOnUiThread(new Runnable() { + private static void showDialog( + @NonNull final BootSplashDialog dialog, + @NonNull final Runnable callback + ) { + if (dialog.isShowing()) { + callback.run(); + return; + } + + dialog.setOnShowListener(new DialogInterface.OnShowListener() { @Override - public void run() { - mDialog.show(); + public void onShow(DialogInterface d) { + callback.run(); + } + }); + + try { + dialog.show(); + } catch (Exception exception) { + callback.run(); + } + } + + private static void dismissDialog( + @Nullable final BootSplashDialog dialog, + @NonNull final Runnable callback + ) { + if (dialog == null || !dialog.isShowing()) { + callback.run(); + return; + } + + dialog.setOnDismissListener(new DialogInterface.OnDismissListener() { + @Override + public void onDismiss(DialogInterface d) { + callback.run(); } }); + + try { + dialog.dismiss(); + } catch (Exception exception) { + callback.run(); + } } private void clearPromiseQueue() { @@ -153,7 +218,7 @@ private void hideAndClearPromiseQueue() { public void run() { final Activity activity = getReactApplicationContext().getCurrentActivity(); - if (mShouldKeepOnScreen || activity == null || activity.isFinishing()) { + if (mShouldKeepOnScreen || activity == null || activity.isFinishing() || activity.isDestroyed()) { final Timer timer = new Timer(); timer.schedule(new TimerTask() { @@ -166,15 +231,13 @@ public void run() { } else if (mDialog == null) { clearPromiseQueue(); } else { - mDialog.setOnDismissListener(new DialogInterface.OnDismissListener() { + dismissDialog(mDialog, new Runnable() { @Override - public void onDismiss(DialogInterface dialog) { + public void run() { mDialog = null; clearPromiseQueue(); } }); - - mDialog.dismiss(); } } }); diff --git a/assets/images/receipt-body.svg b/assets/images/receipt-body.svg index 0c70412de946..73681e08aba0 100644 --- a/assets/images/receipt-body.svg +++ b/assets/images/receipt-body.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/images/simple-illustrations/simple-illustration__bankcoin.svg b/assets/images/simple-illustrations/simple-illustration__bankcoin.svg new file mode 100644 index 000000000000..708eaaedd671 --- /dev/null +++ b/assets/images/simple-illustrations/simple-illustration__bankcoin.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/images/simple-illustrations/simple-illustration__wallet-alt2.svg b/assets/images/simple-illustrations/simple-illustration__wallet-alt2.svg new file mode 100644 index 000000000000..3a3c8b0952c9 --- /dev/null +++ b/assets/images/simple-illustrations/simple-illustration__wallet-alt2.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/contributingGuides/STYLE.md b/contributingGuides/STYLE.md index b61b678d0091..da18f59c5dce 100644 --- a/contributingGuides/STYLE.md +++ b/contributingGuides/STYLE.md @@ -1016,7 +1016,7 @@ So, if a new language feature isn't something we have agreed to support it's off ## React Coding Standards -For additional React best practices and patterns that are automatically enforced during code review, see the [AI Code Reviewer Rules](../.claude/agents/code-inline-reviewer.md). +For additional React best practices and patterns that are automatically enforced during code review, see the [Coding Standards](../.claude/skills/coding-standards/SKILL.md). ### Code Documentation diff --git a/contributingGuides/philosophies/AI-REVIEWER.md b/contributingGuides/philosophies/AI-REVIEWER.md index 2cb76c592035..d9b29dafd19c 100644 --- a/contributingGuides/philosophies/AI-REVIEWER.md +++ b/contributingGuides/philosophies/AI-REVIEWER.md @@ -37,7 +37,7 @@ When AI feedback is unclear or ambiguous, contributors will benefit from discuss When AI feedback is incorrect or not applicable, reach out to the AI reviewer maintainers in the #expensify-open-source Slack channel to help improve the system. This feedback helps refine the reviewers and prevents the same issues from recurring. ### Keep rule documentation in sync with AI reviewer prompts -When adding or modifying rules in AI reviewer agent files, the corresponding documentation should be updated. The agent files in `.claude/agents/` are the source of truth for specific rules. +When adding or modifying rules, the corresponding documentation should be updated. The coding standard files in `.claude/skills/coding-standards/` are the source of truth for code review rules. ## Reviewer Setup @@ -46,7 +46,7 @@ When adding or modifying rules in AI reviewer agent files, the corresponding doc **code-inline-reviewer (Smart Linter)** - Reviews source code PRs for specific, predefined violations - Creates inline comments on lines that violate rules -- See `.claude/agents/code-inline-reviewer.md` for current rule definitions +- See `.claude/skills/coding-standards/` for current rule definitions **Holistic Reviewer** - Provides general code review without predefined rules diff --git a/docs/articles/Unlisted/Compliance-Documentation.md b/docs/articles/Unlisted/Compliance-Documentation.md index b2c7475ebad8..7ee71c9e16e4 100644 --- a/docs/articles/Unlisted/Compliance-Documentation.md +++ b/docs/articles/Unlisted/Compliance-Documentation.md @@ -1,39 +1,91 @@ --- title: How to access Expensifyโ€™s SOC 1, SOC 2, and compliance documentation -description: Learn how to access Expensifyโ€™s SOC 1 and SOC 2 reports, bridge letter, and key legal policies. -keywords: SOC 1, SOC 2, security report, compliance, bridge letter, Expensify privacy policy, Expensify subprocessors, Expensify terms of service +description: Learn how to request compliance documents through the Expensify Trust Center. +keywords: SOC, SOC 1 Type 2, SOC 2 Type 2, bridge letter, W-9, COI, Certificate of Insurance, compliance documentation, security report, vendor security review +internalScope: Audience is security reviewers, procurement teams, and customers evaluating Expensify. Covers how to obtain SOC reports and compliance documentation from the Trust Center. Does not cover technical security architecture details or audit control explanations. --- -Expensify is committed to keeping your data secure and transparent. You can access our latest SOC reports and compliance documentation below. +Expensify is committed to protecting your data and maintaining transparency around our security practices. -# Expensify SOC 1 and SOC 2 reports +All compliance documentation, including SOC reports and insurance certificates โ€” is available through our Trust Center. -You can view or download the following audit documents to verify our security and operational controls: +--- + +# How to access Expensify compliance documentation + +You can request and download the latest compliance documents directly from the Expensify Trust Center: + +https://trust.expensify.com/ + +The Trust Center includes: + +- SOC 1 Type 2 Report +- SOC 2 Type 2 Report +- SOC 1 and SOC 2 Bridge Letter +- Certificate of Insurance +- W-9 +- Additional security and compliance resources + +You may be asked to submit a short access request form before downloading certain documents. + +--- + +# How to request Expensifyโ€™s SOC 1 Type 2 Report or SOC 2 Type 2 Report + +If you need a SOC report for a vendor security review or procurement process: + +1. Go to https://trust.expensify.com/ +2. Select the SOC 1 Type 2 Report or SOC 2 Type 2 Report +3. Click Request access +4. Complete the request form +5. Submit the form to receive access instructions -- [Bridge Letter for SOC 1 and SOC 2 โ€“ June 2025](https://drive.google.com/file/d/1kxttniCMLFah4uPNjhknxs0Zor6tWGWE/view?usp=drive_link) -- [SOC 1 Type 2 Report โ€“ September 30, 2024](https://s3-us-west-1.amazonaws.com/concierge-responses-expensify-com/uploads%2F1733950182002-SOC+1+Type+2+Report+09-30-24+-+Expensify.pdf) -- [SOC 2 Type 2 Report โ€“ September 30, 2024](https://s3-us-west-1.amazonaws.com/concierge-responses-expensify-com/uploads%2F1733950193162-SOC+2+Type+2+Report+09-30-24+-+Expensify.pdf) +--- + +# How to get Expensifyโ€™s SOC 1 and SOC 2 Bridge Letter + +The SOC bridge letter provides coverage between the end of the last audit period and the current date. + +To access the bridge letter: + +1. Visit https://trust.expensify.com/ +2. Select SOC 1 and SOC 2 Bridge Letter +3. Click Request access (if prompted) +4. Download the document once approved + +--- + +# How to get Expensifyโ€™s W-9 or Certificate of Insurance + +For accounting, tax setup, or vendor onboarding: -**Note:** If you need additional details for vendor security reviews or procurement, reach out to your Account Manager or [Concierge](mailto:concierge@expensify.com). +1. Go to https://trust.expensify.com/ +2. Select W-9 or Certificate of Insurance +3. Request or download the document --- -# Additional Expensify legal resources +# When to contact Expensify about compliance documentation -You can find more information about our legal and compliance commitments here: +If youโ€™re unable to access a document in the Trust Center, or if your organization requires additional documentation for a vendor security review, reach out to your Account Manager or Concierge. -- [Expensify Terms of Service](https://www.expensify.com/terms) -- [Expensify Privacy Policy](https://www.expensify.com/privacy) -- [List of Subprocessors](https://use.expensify.com/subprocessors) +Include details about: + +- The document you need +- Your company name +- Any required deadline + +This helps us respond as quickly as possible. --- # FAQ -## Who can access Expensifyโ€™s SOC 1 and SOC 2 reports? +## Who can access Expensifyโ€™s SOC 1 Type 2 and SOC 2 Type 2 reports? + +Anyone conducting a vendor security review or procurement evaluation can request access through the Trust Center. Approval may be required before downloading. -Anyone evaluating Expensify for security and compliance purposes can access these reports using the links above. If you're a current customer, you can also request them from your Account Manager. +## What is the SOC bridge letter used for? -## What is the bridge letter for? +The bridge letter provides coverage between the end date of the most recent SOC audit and the present date. It confirms there have been no material changes affecting control effectiveness. -The bridge letter explains the period between the last audit date and the current date to maintain coverage while a new audit is underway. diff --git a/docs/articles/new-expensify/reports-and-expenses/Create-an-Expense.md b/docs/articles/new-expensify/reports-and-expenses/Create-an-Expense.md index a01ec756c0b2..80034db8455f 100644 --- a/docs/articles/new-expensify/reports-and-expenses/Create-an-Expense.md +++ b/docs/articles/new-expensify/reports-and-expenses/Create-an-Expense.md @@ -1,11 +1,11 @@ --- title: Create an Expense -description: Learn how to create and submit expenses in Expensify using SmartScan, manual entry, or distance tracking. -keywords: [New Expensify, create expense, SmartScan, manual expense, distance expense, submit expense, expense report, submit to individual, track mileage, scan receipts, group split, Expensify chat, upload receipts, multi-scan, bulk upload, submit to workspace, peer reimbursement, workspace merchant rules, auto-categorize, reimbursable, billable] -internalScope: Audience is submitters, approvers, and admins. Covers how to create and submit expenses to a workspace or individual using SmartScan, manual entry, or distance tracking. Does not cover credit card import. +description: Learn how to create and submit expenses in Expensify using SmartScan, manual entry, distance tracking, or time expenses. +keywords: [create expense, submit expense, SmartScan, manual expense, distance expense, time expense, create time expense, log time, track hours, expense report, submit to workspace, submit to individual, split expense, scan receipts, bulk upload] +internalScope: Audience is submitters, approvers, and Workspace Admins. Covers how to create and submit expenses to a workspace or individual using SmartScan, manual entry, distance tracking, or Time expenses. Does not cover credit card import or Time Tracking --- -You can create expenses in Expensify by scanning a receipt, entering details manually, or tracking distance. Once created, expenses can be submitted to either a workspace (for business reimbursement) or an individual (for personal repayment). +You can create expenses in Expensify by scanning a receipt, entering details manually, tracking distance, or logging time. Once created, expenses can be submitted to either a workspace (for business reimbursement) or an individual (for personal repayment). --- @@ -34,7 +34,7 @@ You can create an expense by scanning a receipt, entering details manually, or t 4. Tap **Create expense**. **On web:** -1. Click the green **scan** button at the bottom of your screen. +1. Click the green **scan** button. 2. Drag and drop the receipt file to the page or click **Choose files** to upload. 3. Enter the workspace or recipientโ€™s email/phone number. 4. Add details like description, category, tags, and tax. @@ -49,7 +49,7 @@ You can create an expense by scanning a receipt, entering details manually, or t ## How to manually create an expense -1. Click the **โž• Create** button at the bottom of your screen. +1. Click the **โž• Create** button. 2. Select **Create Expense** then **Manual**. 3. Enter the amount and currency, then click **Next**. 4. Choose a workspace or an individual. @@ -60,19 +60,39 @@ You can create an expense by scanning a receipt, entering details manually, or t ## How to create a distance expense -1. From the navigation tabs, click the grey **+** button. +To create a distance expense: + +1. Click the **โž• Create** button. 2. Select **Track distance**. 3. Enter start and stop locations. 4. (Optional) Add additional stops. 5. Click **Next**. -6. Choose the recipient and add expense details. +6. Choose the recipient and add expense details like description, category, tags, tax, date, and set whether the expense is reimbursable. +7. Click **Create expense**. + +--- + +## How to create a time expense + +Use a Time expense to log billable hours instead of entering a dollar amount manually. The total amount is calculated automatically based on the number of hours and the workspaceโ€™s hourly rate. + +To create a time expense: + +1. Click the **โž• Create** button. +2. Select **Create expense**. +3. Select **Time**. +4. Enter the number of hours. +5. Click **Next**. +6. Choose the recipient and add expense details like description, category, tags, tax, date, and set whether the expense is reimbursable. 7. Click **Create expense**. +The total amount will be calculated automatically using the hourly rate set for the workspace. + --- ## How to scan multiple receipts (mobile only) -1. On mobile, tap the green camera button. +1. On mobile, tap the green **camera** icon. 2. Tap the lightning bolt icon in the upper-right corner. 3. Tap the green capture button to take a photo of each receipt. 4. Once youโ€™ve scanned all your receipts, tap the green arrow to confirm. @@ -82,7 +102,7 @@ You can create an expense by scanning a receipt, entering details manually, or t ## How to bulk upload multiple receipts (web only) -1. On the web, go to the Reports page. +1. On the web, go to the **Reports** page. 2. Drag up to 30 PDF or image files (under 10MB each) into Expensify. 3. Follow the prompts to assign workspaces, recipients, and coding. 4. Once the expenses are ready, click **Create expenses**. @@ -116,7 +136,7 @@ To split an expense with multiple individuals, start a group chat including each ## How to start a group chat -1. From the navigation tabs, click the **+ Create** button. +1. Click the **โž• Create** button. 2. Select **Start chat**. 3. Search for the person by name, email, or phone number. 4. Send them a message to begin the conversation. @@ -165,7 +185,9 @@ If you're submitting to someone for the first time, their contact information wi **Chrome:** - Go to **Settings > Site settings > Camera > Allow** for Expensify. - **Safari:** -- Tap **aA > Website Settings > Camera > Allow**, then tap **Done** and refresh the page. +- Tap **A > Website Settings > Camera > Allow**, then tap **Done** and refresh the page. + +## Can I change the hourly rate when creating a Time expense? +Yes. The default hourly rate is set at the workspace level, but you can update the rate when creating a Time expense if a different rate is required. diff --git a/docs/articles/new-expensify/workspaces/Enable-Time-Tracking-and-Set-a-Default-Hourly-Rate.md b/docs/articles/new-expensify/workspaces/Enable-Time-Tracking-and-Set-a-Default-Hourly-Rate.md new file mode 100644 index 000000000000..c9f3e03b3186 --- /dev/null +++ b/docs/articles/new-expensify/workspaces/Enable-Time-Tracking-and-Set-a-Default-Hourly-Rate.md @@ -0,0 +1,102 @@ +--- +title: Enable Time Tracking and Set a Default Hourly Rate +description: Learn how to enable Time Tracking and set a default hourly rate for your workspace. +keywords: [New Expensify, Time Tracking, enable Time Tracking, default hourly rate, Collect plan, Control plan, Workspace Admin, track time, hourly rate] +internalScope: Audience is Workspace Admins. Covers enabling Time Tracking and setting a default hourly rate in Collect and Control workspaces. Does not cover invoicing, billing, or time report approvals. +--- + +# Enable Time Tracking and Set a Default Hourly Rate + +Time Tracking lets workspace members log billable hours with automatic hourly rate calculations. +Once enabled, members can log time directly in your workspace, helping you manage billable work and reimbursements more accurately. + +--- + +## Who can enable and use Time Tracking + +Workspace Admins can enable or configure Time Tracking on a workspace to allow workspace members to create time expenses. + +--- + +## Where to find Time Tracking in your workspace + +After Time Tracking is enabled, **Time** appears in the navigation tabs: + +- **Web:** In the navigation tabs on the left +- **Mobile:** In the navigation tabs on the bottom + +--- + +## How to enable Time Tracking in your workspace + +Workspace Admins can enable Time Tracking from the workspace settings. This allows members to begin logging time and creating time expenses. + +To enable Time Tracking: + +1. Go to **Workspaces** in the navigation tabs + - **Web:** Navigation tabs on the left + - **Mobile:** Navigation tabs on the bottom +2. Select your workspace name +3. Select **More Features** +4. Toggle on **Time** + +Once enabled, the **Time** tab will appear in your workspace navigation. + +--- + +## How to set the default hourly rate in Time Tracking + +Setting a default hourly rate ensures all logged time uses a standard rate unless otherwise specified. + +To set the default hourly rate: + +1. Go to **Workspaces** in the navigation tabs + - **Web:** Navigation tabs on the left + - **Mobile:** Navigation tabs on the bottom +2. Select your workspace name +3. Select **Time** +4. Enter the amount under **Default hourly rate** +5. Click **Save** + +The default hourly rate will automatically apply to new time entries. + +--- + +## How Time Tracking helps with billing and reimbursement + +Time Tracking helps you: + +- Standardize hourly billing rates +- Track billable hours in one place +- Improve reporting accuracy +- Automate reimbursement calculations + +By setting a default hourly rate, you reduce manual edits and ensure consistent payouts. + +--- + +## How members create Time Tracking expenses + +Once Time Tracking is enabled, members can log time and create time expenses in the workspace. + +To learn how members log time and submit time expenses, see [Create Time Expenses[(https://help.expensify.com/articles/new-expensify/reports-and-expenses/Create-an-Expense#how-to-create-a-time-expense). + +--- + +# FAQ + +## Why donโ€™t I see the Time tab in my workspace? + +The **Time** tab only appears after Time Tracking is enabled by a Workspace Admin. If you donโ€™t see it, confirm that Time Tracking has been turned on in **Workspaces > Workspace Name > More Features**. + +## Can different workspace members have different hourly rates? + +The default hourly rate applies workspace-wide. However, members can edit the rate when creating a Time expense if needed. + +## Can I change the default hourly rate later? + +Yes. Workspace Admins can update the default hourly rate at any time by going to **Workspaces > Workspace Name > Time**. + +## What happens to existing time entries if I change the default hourly rate? + +Changing the default hourly rate only affects new time entries. Existing time entries keep the hourly rate that was applied when they were created. diff --git a/docs/articles/travel/travel-analytics/Overview-of-Analytics.md b/docs/articles/travel/travel-analytics/Overview-of-Analytics.md index 76cf094d9556..ec3ff78ebe99 100644 --- a/docs/articles/travel/travel-analytics/Overview-of-Analytics.md +++ b/docs/articles/travel/travel-analytics/Overview-of-Analytics.md @@ -1,19 +1,19 @@ --- title: Overview of Analytics description: Learn how to use Expensify Travel analytics to monitor spend, track bookings, and access company-wide travel insights. -keywords: [travel analytics, reporting, travel spend, usage insights, expensify travel reports] +internalScope: Audience is Workspace Admins and approvers. Covers using Expensify Travel analytics to track spend, generate reports, and schedule insights. Does not cover booking travel. +keywords: [Expensify Travel, travel analytics, company reports, travel spend tracking, schedule report, export travel data, filter reports, Workspace Admin, approver, company-wide analytics] --- Expensify Travel analytics give travelers, approvers, and admins real-time visibility into travel activity and spend. These insights help identify travel trends, ensure policy compliance, and support strategic decision-making across your organization. --- -## How to access Expensify Travel +## Where to find Expensify Travel -- **In New Expensify:** Click the green **+** button in the bottom-left corner of your screen, then select **Book travel**. -- **In Classic Expensify:** Click **Travel** in the left-hand menu, then select **Book or manage travel**. +Tap the green โž• **Create** button at the bottom of your screen, then choose **Book travel**. -**Need to enable travel still?** Reach out to your Account Manager or Concierge to schedule a travel demo and get it enabled for your account. +If you donโ€™t see **Book travel**, ask a Workspace Admin to [enable Expensify Travel](https://help.expensify.com/articles/travel/company-setup/Enable-Travel-on-a-Workspace) on the workspace. --- @@ -69,6 +69,39 @@ Most reports include a visual graph highlighting key metrics over time. Tile sum --- +## Favorites + +Admins can favorite specific Company Reports to make them easier to access in the future. + +Once you've applied your desired filters to a report, click the **star** icon on the far right of the Report Filters. This adds the report to a **Favorites** category, visible in the left-hand menu. + +To remove a report from Favorites: +1. Select the report under the **Favorites** category. +2. Click the star icon again to unfavorite it. + +--- + +## Scheduling Reports + +Admins can schedule Company Reports to be automatically delivered on a recurring basis. + +Once you've applied your desired filters to a report, click the **calendar** icon on the far right of the Report Filters and select **Create new schedule**. + +To set up a report schedule, fill in the following fields: +- **Schedule name** โ€“ A descriptive name for easy identification. +- **Schedule description** โ€“ A short paragraph describing the report. +- **Format** โ€“ Choose one: CSV, PDF, PNG, or XLSX. +- **Delivery method** โ€“ Currently only email is supported. +- **Report date range** โ€“ Choose from a list of preset date ranges. +- **(Optional) Timestamp format** โ€“ Add a timestamp suffix to the report filename. +- **Frequency** โ€“ Set how often the report is delivered. +- **Specify user for data filtering** โ€“ Enter an org-based email address. This ensures the user can only see data belonging to their organization. +- **Email recipients** โ€“ Add the email addresses of those who should receive the scheduled report. + +To manage existing schedules, click the **calendar** icon and select **View Report Schedules**. + +--- + # FAQ **Can I see my team's travel activity if Iโ€™m not an admin?** diff --git a/docs/articles/travel/travel-policy/Configuring-Flight-Settings.md b/docs/articles/travel/travel-policy/Configuring-Flight-Settings.md index f8ed4055f744..1b4978ec812a 100644 --- a/docs/articles/travel/travel-policy/Configuring-Flight-Settings.md +++ b/docs/articles/travel/travel-policy/Configuring-Flight-Settings.md @@ -7,14 +7,13 @@ keywords: [flight policy, cabin class, travel approval, air booking rules, lowes Set clear, customizable flight rules to control how travelers book airfare in Expensify travel. These settings help your team stay compliant while giving flexibility where needed. -## How to access Expensify travel +--- -- **In New Expensify:** Click the green **+** button in the bottom-left corner of your screen, then select **Book travel**. -- **In Classic Expensify:** Click **Travel** in the left-hand menu, then select **Book or manage travel**. +## Where to find Expensify Travel -Note: Only Travel Admins can create or manage travel policies in Expensify Travel. +Tap the green โž• **Create** button at the bottom of your screen, then choose **Book travel**. -**Need to enable travel still?** Reach out to your Account Manager or Concierge to schedule a travel demo and get it enabled for your account. +If you donโ€™t see **Book travel**, ask a Workspace Admin to [enable Expensify Travel](https://help.expensify.com/articles/travel/company-setup/Enable-Travel-on-a-Workspace) on the workspace. --- @@ -44,6 +43,23 @@ _Note: These rules override all other policy settings._ --- +## Restrict by fare name + +Define specific keywords by airline to block flight fares containing those keywords in their fare names. + +Click **+ Add Restriction**, select the airlines the restriction applies to, then enter comma-separated keywords that should be restricted in the fare name. + +**Note:** Keywords are matched against fare names using complete word matching. Matching is: +- Case-insensitive +- Airline-specific +- Evaluated independently + +For example: +- The keyword **Basic** will match **Basic Economy** and **Basic Plus** +- The keyword **Bas** will not match **Basic Economy** + +--- + ## Highest cabin class - Domestic flights Set a cabin class for domestic travel: @@ -107,19 +123,31 @@ Let travelers book higher cabin classes when conditions are met: - Premium Economy - Business - First + +--- + +## Add Block fares with airport transfers + +Block travelers from booking flights that require changing airports during layovers. + +To enable this restriction, customers can click the toggle. --- ## Budgets -Create dynamic flight budgets for domestic and international flights. -- **Amount or % over** a selected baseline option which includes: +Create dynamic flight budgets for domestic and international flights. + +Set budgets in two ways: +- **Maximum price per booking** for all flights booked under the policy + - Further customization is possible, setting a maximum price based on the flight duration, allowing higher budgets for longer flights. +- Dynamic **Amount or % over** the maximum price per booking, which includes the following options: - None - More than lowest fare - More than median fare - Less than median fare - More than lowest logical fare -- Or set a **Maximum price per booking** for all flights under the policy. + --- diff --git a/docs/articles/travel/travel-policy/Configuring-Hotel-Settings.md b/docs/articles/travel/travel-policy/Configuring-Hotel-Settings.md index 6c30fda43a43..63853e7fa069 100644 --- a/docs/articles/travel/travel-policy/Configuring-Hotel-Settings.md +++ b/docs/articles/travel/travel-policy/Configuring-Hotel-Settings.md @@ -6,14 +6,13 @@ keywords: [hotel policy, hotel settings, spotnana travel, booking rules, hotel r Customize hotel booking policies to guide travelers toward compliant, cost-effective stays. These controls help enforce standards while allowing flexibility where it makes sense. -## How to access Expensify Travel +--- -- **In New Expensify:** Click the green **+** button in the bottom-left corner of your screen, then select **Book travel**. -- **In Classic Expensify:** Click **Travel** in the left-hand menu, then select **Book or manage travel**. +## Where to find Expensify Travel -Note: Only Travel Admins can create or manage travel policies in Expensify Travel. +Tap the green โž• **Create** button at the bottom of your screen, then choose **Book travel**. -**Need to enable travel still?** Reach out to your Account Manager or Concierge to schedule a travel demo and get it enabled for your account. +If you donโ€™t see **Book travel**, ask a Workspace Admin to [enable Expensify Travel](https://help.expensify.com/articles/travel/company-setup/Enable-Travel-on-a-Workspace) on the workspace. --- @@ -29,13 +28,15 @@ Note: Any setting with a chain link icon (๐Ÿ”—) that is not crossed out is inher --- -## Hotel policy settings +## Restrict bookings by -**Restrict bookings by** Set specific keywords that will restrict hotel bookings if matched in the rate description. - Useful for excluding specific phrases like "non-refundable" or "prepaid." -**Hotel rate conditions not allowed to be booked** +--- + +## Hotel rate conditions not allowed to be booked + Block specific rate types from being available to travelers. - Options include: - Non-refundable @@ -45,33 +46,82 @@ Block specific rate types from being available to travelers. You can also add a custom message explaining the restriction to travelers during the booking process. -**Only consider cheapest rate as in-policy** +--- + +## Add Property type + +Configure hotel restrictions by property type. + +Configure the following settings: + +- **Property types to restrict** โ€“ Properties matching these types will be marked out-of-policy. + *Note: Select from property types including Apartment, Castle, Health Spa, and Boatel.* + +- **Restricted properties can have their own Out of Policy action** โ€“ Choose how to handle bookings that violate this restriction. + *Note: This allows you to set different approval requirements for specific property types.* + +- **Tier exception** โ€“ Allow preferred properties to bypass type restrictions. + *Note: To set preferred hotels, go to Program > Company > Supplier > Supplier Management. + +--- + +## Only consider cheapest rate as in-policy + Flags the lowest-priced rate at each hotel as **in policy**. - All other rates for that property will be **out of policy**. -**Maximum price** +--- + +## Maximum price + Set a global nightly price cap for hotel stays. - Customize rates further by city or country/region. - Choose whether the limit includes taxes and fees. -**Booking window** +--- + +## Booking window + Define how many days before check-in a booking becomes out of policy. - Example: If set to 5 days, any booking made less than 5 days in advance is flagged as out of policy. -**Cancellation policy** +--- + +## Cancellation policy + Determine what refund options you want travelers to book: - Any (allow all) - Fully refundable rooms only - Partially or fully refundable rooms only -**Experience** +--- + +## Experience + Set minimum and maximum star ratings to define acceptable hotel experiences. - Helps maintain booking quality while controlling costs. -**Out of policy reason codes** +--- + +## Nightly median rate + +Configure parameters to calculate the median hotel rate based on the traveler's search results. The median rate represents the midpoint price where half the hotels cost more and half cost less. + +To configure: +- **Search radius** โ€“ The radius (in miles) around a travelerโ€™s search location used to calculate the median. +- **Rating range (number of stars)** โ€“ Minimum and maximum star ratings considered when calculating the median. + +**Note:** This feature is informational only. It does not determine in-policy or out-of-policy status, but helps travelers understand the context of their options. + +--- + +## Out of policy reason codes + Enable travelers to create or select a reason when selecting an out-of-policy hotel. - Click **Manage Reason Codes** to create, edit, or delete available reason options. +--- + # FAQ **Does the โ€œcheapest rateโ€ rule consider taxes and fees?** diff --git a/ios/NewExpensify/Info.plist b/ios/NewExpensify/Info.plist index e1024816505a..0d61a0043f20 100644 --- a/ios/NewExpensify/Info.plist +++ b/ios/NewExpensify/Info.plist @@ -23,7 +23,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 9.3.18 + 9.3.19 CFBundleSignature ???? CFBundleURLTypes @@ -44,7 +44,7 @@ CFBundleVersion - 9.3.18.0 + 9.3.19.4 FullStory OrgId diff --git a/ios/NotificationServiceExtension/Info.plist b/ios/NotificationServiceExtension/Info.plist index 1eef29d0caca..5484b94eca2c 100644 --- a/ios/NotificationServiceExtension/Info.plist +++ b/ios/NotificationServiceExtension/Info.plist @@ -11,9 +11,9 @@ CFBundleName $(PRODUCT_NAME) CFBundleShortVersionString - 9.3.18 + 9.3.19 CFBundleVersion - 9.3.18.0 + 9.3.19.4 NSExtension NSExtensionPointIdentifier diff --git a/ios/ShareViewController/Info.plist b/ios/ShareViewController/Info.plist index 4770b674f709..2c77bbda0b42 100644 --- a/ios/ShareViewController/Info.plist +++ b/ios/ShareViewController/Info.plist @@ -11,9 +11,9 @@ CFBundleName $(PRODUCT_NAME) CFBundleShortVersionString - 9.3.18 + 9.3.19 CFBundleVersion - 9.3.18.0 + 9.3.19.4 NSExtension NSExtensionAttributes diff --git a/package-lock.json b/package-lock.json index 3f1071352748..69714532403f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "new.expensify", - "version": "9.3.18-0", + "version": "9.3.19-4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "new.expensify", - "version": "9.3.18-0", + "version": "9.3.19-4", "hasInstallScript": true, "license": "MIT", "dependencies": { @@ -75,6 +75,7 @@ "expo-store-review": "~9.0.8", "expo-task-manager": "~14.0.9", "expo-video": "3.0.12", + "expo-web-browser": "15.0.10", "fast-equals": "^5.2.2", "focus-trap-react": "^11.0.3", "group-ib-fp": "file:modules/group-ib-fp", @@ -178,6 +179,7 @@ "@perf-profiler/reporter": "^0.9.0", "@perf-profiler/types": "^0.8.0", "@pmmmwh/react-refresh-webpack-plugin": "^0.5.15", + "@prettier/plugin-oxc": "^0.1.3", "@react-native-community/cli": "20.0.0", "@react-native-community/cli-platform-android": "20.0.0", "@react-native-community/cli-platform-ios": "20.0.0", @@ -227,7 +229,7 @@ "@vue/preload-webpack-plugin": "^2.0.0", "@welldone-software/why-did-you-render": "7.0.1", "babel-jest": "29.7.0", - "babel-loader": "^9.1.3", + "babel-loader": "^10.0.0", "babel-plugin-module-resolver": "^5.0.0", "babel-plugin-react-compiler": "1.0.0", "babel-plugin-react-native-web": "^0.18.7", @@ -285,7 +287,7 @@ "shellcheck": "^1.1.0", "source-map": "^0.7.4", "storybook": "10.1.10", - "style-loader": "^2.0.0", + "style-loader": "^3.0.0", "svgo": "^4.0.0", "time-analytics-webpack-plugin": "^0.1.17", "ts-jest": "^29.2.5", @@ -4933,6 +4935,40 @@ "node": ">=0.8.0" } }, + "node_modules/@emnapi/core": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.8.1.tgz", + "integrity": "sha512-AvT9QFpxK0Zd8J0jopedNm+w/2fIzvtPKPjqyw9jwvBaReTTqPBk9Hixaz7KbjimP+QNz605/XnjFcDAL2pqBg==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/wasi-threads": "1.1.0", + "tslib": "^2.4.0" + } + }, + "node_modules/@emnapi/runtime": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.8.1.tgz", + "integrity": "sha512-mehfKSMWjjNol8659Z8KxEMrdSJDDot5SXMq00dM8BN4o+CLNXQ0xH2V7EchNHV4RmbZLmmPdEaXZc5H2FXmDg==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@emnapi/wasi-threads": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.1.0.tgz", + "integrity": "sha512-WI0DdZ8xFSbgMjR1sFsKABJ/C5OnRrjT06JXbZKexJGrDuPTzZdDYfFlsgcCXCyf+suG5QU2e/y1Wo2V/OapLQ==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, "node_modules/@es-joy/jsdoccomment": { "version": "0.65.2", "resolved": "https://registry.npmjs.org/@es-joy/jsdoccomment/-/jsdoccomment-0.65.2.tgz", @@ -10308,6 +10344,23 @@ "react": ">=16" } }, + "node_modules/@napi-rs/wasm-runtime": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.1.1.tgz", + "integrity": "sha512-p64ah1M1ld8xjWv3qbvFwHiFVWrq1yFvV4f7w+mzaqiR4IlSgkqhcRdHwsGgomwzBH51sRY4NEowLxnaBjcW/A==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/core": "^1.7.1", + "@emnapi/runtime": "^1.7.1", + "@tybys/wasm-util": "^0.10.1" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Brooooooklyn" + } + }, "node_modules/@native-html/css-processor": { "version": "1.11.0", "license": "MIT", @@ -10597,6 +10650,271 @@ "react-native": ">=0.70.0 <1.0.x" } }, + "node_modules/@oxc-parser/binding-android-arm64": { + "version": "0.99.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-android-arm64/-/binding-android-arm64-0.99.0.tgz", + "integrity": "sha512-V4jhmKXgQQdRnm73F+r3ZY4pUEsijQeSraFeaCGng7abSNJGs76X6l82wHnmjLGFAeY00LWtjcELs7ZmbJ9+lA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-darwin-arm64": { + "version": "0.99.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-darwin-arm64/-/binding-darwin-arm64-0.99.0.tgz", + "integrity": "sha512-Rp41nf9zD5FyLZciS9l1GfK8PhYqrD5kEGxyTOA2esTLeAy37rZxetG2E3xteEolAkeb2WDkVrlxPtibeAncMg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-darwin-x64": { + "version": "0.99.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-darwin-x64/-/binding-darwin-x64-0.99.0.tgz", + "integrity": "sha512-WVonp40fPPxo5Gs0POTI57iEFv485TvNKOHMwZRhigwZRhZY2accEAkYIhei9eswF4HN5B44Wybkz7Gd1Qr/5Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-freebsd-x64": { + "version": "0.99.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-freebsd-x64/-/binding-freebsd-x64-0.99.0.tgz", + "integrity": "sha512-H30bjOOttPmG54gAqu6+HzbLEzuNOYO2jZYrIq4At+NtLJwvNhXz28Hf5iEAFZIH/4hMpLkM4VN7uc+5UlNW3Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-linux-arm-gnueabihf": { + "version": "0.99.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-0.99.0.tgz", + "integrity": "sha512-0Z/Th0SYqzSRDPs6tk5lQdW0i73UCupnim3dgq2oW0//UdLonV/5wIZCArfKGC7w9y4h8TxgXpgtIyD1kKzzlQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-linux-arm-musleabihf": { + "version": "0.99.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-arm-musleabihf/-/binding-linux-arm-musleabihf-0.99.0.tgz", + "integrity": "sha512-xo0wqNd5bpbzQVNpAIFbHk1xa+SaS/FGBABCd942SRTnrpxl6GeDj/s1BFaGcTl8MlwlKVMwOcyKrw/2Kdfquw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-linux-arm64-gnu": { + "version": "0.99.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-0.99.0.tgz", + "integrity": "sha512-u26I6LKoLTPTd4Fcpr0aoAtjnGf5/ulMllo+QUiBhupgbVCAlaj4RyXH/mvcjcsl2bVBv9E/gYJZz2JjxQWXBA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-linux-arm64-musl": { + "version": "0.99.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-arm64-musl/-/binding-linux-arm64-musl-0.99.0.tgz", + "integrity": "sha512-qhftDo2D37SqCEl3ZTa367NqWSZNb1Ddp34CTmShLKFrnKdNiUn55RdokLnHtf1AL5ssaQlYDwBECX7XiBWOhw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-linux-riscv64-gnu": { + "version": "0.99.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-riscv64-gnu/-/binding-linux-riscv64-gnu-0.99.0.tgz", + "integrity": "sha512-zxn/xkf519f12FKkpL5XwJipsylfSSnm36h6c1zBDTz4fbIDMGyIhHfWfwM7uUmHo9Aqw1pLxFpY39Etv398+Q==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-linux-s390x-gnu": { + "version": "0.99.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-0.99.0.tgz", + "integrity": "sha512-Y1eSDKDS5E4IVC7Oxw+NbYAKRmJPMJTIjW+9xOWwteDHkFqpocKe0USxog+Q1uhzalD9M0p9eXWEWdGQCMDBMQ==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-linux-x64-gnu": { + "version": "0.99.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-x64-gnu/-/binding-linux-x64-gnu-0.99.0.tgz", + "integrity": "sha512-YVJMfk5cFWB8i2/nIrbk6n15bFkMHqWnMIWkVx7r2KwpTxHyFMfu2IpeVKo1ITDSmt5nBrGdLHD36QRlu2nDLg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-linux-x64-musl": { + "version": "0.99.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-x64-musl/-/binding-linux-x64-musl-0.99.0.tgz", + "integrity": "sha512-2+SDPrie5f90A1b9EirtVggOgsqtsYU5raZwkDYKyS1uvJzjqHCDhG/f4TwQxHmIc5YkczdQfwvN91lwmjsKYQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-wasm32-wasi": { + "version": "0.99.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-wasm32-wasi/-/binding-wasm32-wasi-0.99.0.tgz", + "integrity": "sha512-DKA4j0QerUWSMADziLM5sAyM7V53Fj95CV9SjP77bPfEfT7MnvFKnneaRMqPK1cpzjAGiQF52OBUIKyk0dwOQA==", + "cpu": [ + "wasm32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@napi-rs/wasm-runtime": "^1.0.7" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@oxc-parser/binding-win32-arm64-msvc": { + "version": "0.99.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-0.99.0.tgz", + "integrity": "sha512-EaB3AvsxqdNUhh9FOoAxRZ2L4PCRwDlDb//QXItwyOJrX7XS+uGK9B1KEUV4FZ/7rDhHsWieLt5e07wl2Ti5AQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-win32-x64-msvc": { + "version": "0.99.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-win32-x64-msvc/-/binding-win32-x64-msvc-0.99.0.tgz", + "integrity": "sha512-sJN1Q8h7ggFOyDn0zsHaXbP/MklAVUvhrbq0LA46Qum686P3SZQHjbATqJn9yaVEvaSKXCshgl0vQ1gWkGgpcQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-project/types": { + "version": "0.99.0", + "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.99.0.tgz", + "integrity": "sha512-LLDEhXB7g1m5J+woRSgfKsFPS3LhR9xRhTeIoEBm5WrkwMxn6eZ0Ld0c0K5eHB57ChZX6I3uSmmLjZ8pcjlRcw==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/Boshen" + } + }, "node_modules/@peggyjs/from-mem": { "version": "1.3.0", "dev": true, @@ -10790,6 +11108,22 @@ "url": "https://opencollective.com/preact" } }, + "node_modules/@prettier/plugin-oxc": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@prettier/plugin-oxc/-/plugin-oxc-0.1.3.tgz", + "integrity": "sha512-aABz3zIRilpWMekbt1FL1JVBQrQLR8L4Td2SRctECrWSsXGTNn/G1BqNSKCdbvQS1LWstAXfqcXzDki7GAAJyg==", + "dev": true, + "license": "MIT", + "dependencies": { + "oxc-parser": "0.99.0" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/@protobufjs/aspromise": { "version": "1.1.2", "license": "BSD-3-Clause" @@ -14823,23 +15157,6 @@ "babel-loader": "^10.0.0" } }, - "node_modules/@storybook/addon-webpack5-compiler-babel/node_modules/babel-loader": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-10.0.0.tgz", - "integrity": "sha512-z8jt+EdS61AMw22nSfoNJAZ0vrtmhPRVi6ghL3rCeRZI8cdNYFiV5xeV3HbE7rlZZNmGH8BVccwWt8/ED0QOHA==", - "dev": true, - "license": "MIT", - "dependencies": { - "find-up": "^5.0.0" - }, - "engines": { - "node": "^18.20.0 || ^20.10.0 || >=22.0.0" - }, - "peerDependencies": { - "@babel/core": "^7.12.0", - "webpack": ">=5.61.0" - } - }, "node_modules/@storybook/builder-webpack5": { "version": "10.1.10", "resolved": "https://registry.npmjs.org/@storybook/builder-webpack5/-/builder-webpack5-10.1.10.tgz", @@ -16067,6 +16384,17 @@ "url": "https://opencollective.com/turf" } }, + "node_modules/@tybys/wasm-util": { + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.1.tgz", + "integrity": "sha512-9tTaPJLSiejZKx+Bmog4uSubteqTvFrVrURwkmHixBo0G4seD0zUxp98E1DzUBJxLQ3NPwXrGKDiVjwx/DpPsg==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, "node_modules/@types/aria-query": { "version": "5.0.4", "resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.4.tgz", @@ -18116,142 +18444,20 @@ } }, "node_modules/babel-loader": { - "version": "9.2.1", + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-10.0.0.tgz", + "integrity": "sha512-z8jt+EdS61AMw22nSfoNJAZ0vrtmhPRVi6ghL3rCeRZI8cdNYFiV5xeV3HbE7rlZZNmGH8BVccwWt8/ED0QOHA==", "dev": true, "license": "MIT", "dependencies": { - "find-cache-dir": "^4.0.0", - "schema-utils": "^4.0.0" + "find-up": "^5.0.0" }, "engines": { - "node": ">= 14.15.0" + "node": "^18.20.0 || ^20.10.0 || >=22.0.0" }, "peerDependencies": { "@babel/core": "^7.12.0", - "webpack": ">=5" - } - }, - "node_modules/babel-loader/node_modules/find-cache-dir": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "common-path-prefix": "^3.0.0", - "pkg-dir": "^7.0.0" - }, - "engines": { - "node": ">=14.16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/babel-loader/node_modules/find-up": { - "version": "6.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "locate-path": "^7.1.0", - "path-exists": "^5.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/babel-loader/node_modules/locate-path": { - "version": "7.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "p-locate": "^6.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/babel-loader/node_modules/p-limit": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "yocto-queue": "^1.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/babel-loader/node_modules/p-locate": { - "version": "6.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "p-limit": "^4.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/babel-loader/node_modules/path-exists": { - "version": "5.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - } - }, - "node_modules/babel-loader/node_modules/pkg-dir": { - "version": "7.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "find-up": "^6.3.0" - }, - "engines": { - "node": ">=14.16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/babel-loader/node_modules/schema-utils": { - "version": "4.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/json-schema": "^7.0.9", - "ajv": "^8.9.0", - "ajv-formats": "^2.1.1", - "ajv-keywords": "^5.1.0" - }, - "engines": { - "node": ">= 12.13.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - } - }, - "node_modules/babel-loader/node_modules/yocto-queue": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12.20" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "webpack": ">=5.61.0" } }, "node_modules/babel-plugin-add-module-exports": { @@ -19835,11 +20041,6 @@ "node": ">= 12.0.0" } }, - "node_modules/common-path-prefix": { - "version": "3.0.0", - "dev": true, - "license": "ISC" - }, "node_modules/commondir": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", @@ -23789,6 +23990,16 @@ "react-native": "*" } }, + "node_modules/expo-web-browser": { + "version": "15.0.10", + "resolved": "https://registry.npmjs.org/expo-web-browser/-/expo-web-browser-15.0.10.tgz", + "integrity": "sha512-fvDhW4bhmXAeWFNFiInmsGCK83PAqAcQaFyp/3pE/jbdKmFKoRCWr46uZGIfN4msLK/OODhaQ/+US7GSJNDHJg==", + "license": "MIT", + "peerDependencies": { + "expo": "*", + "react-native": "*" + } + }, "node_modules/expo/node_modules/@expo/cli": { "version": "54.0.8", "resolved": "https://registry.npmjs.org/@expo/cli/-/cli-54.0.8.tgz", @@ -32040,6 +32251,39 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/oxc-parser": { + "version": "0.99.0", + "resolved": "https://registry.npmjs.org/oxc-parser/-/oxc-parser-0.99.0.tgz", + "integrity": "sha512-MpS1lbd2vR0NZn1v0drpgu7RUFu3x9Rd0kxExObZc2+F+DIrV0BOMval/RO3BYGwssIOerII6iS8EbbpCCZQpQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@oxc-project/types": "^0.99.0" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/sponsors/Boshen" + }, + "optionalDependencies": { + "@oxc-parser/binding-android-arm64": "0.99.0", + "@oxc-parser/binding-darwin-arm64": "0.99.0", + "@oxc-parser/binding-darwin-x64": "0.99.0", + "@oxc-parser/binding-freebsd-x64": "0.99.0", + "@oxc-parser/binding-linux-arm-gnueabihf": "0.99.0", + "@oxc-parser/binding-linux-arm-musleabihf": "0.99.0", + "@oxc-parser/binding-linux-arm64-gnu": "0.99.0", + "@oxc-parser/binding-linux-arm64-musl": "0.99.0", + "@oxc-parser/binding-linux-riscv64-gnu": "0.99.0", + "@oxc-parser/binding-linux-s390x-gnu": "0.99.0", + "@oxc-parser/binding-linux-x64-gnu": "0.99.0", + "@oxc-parser/binding-linux-x64-musl": "0.99.0", + "@oxc-parser/binding-wasm32-wasi": "0.99.0", + "@oxc-parser/binding-win32-arm64-msvc": "0.99.0", + "@oxc-parser/binding-win32-x64-msvc": "0.99.0" + } + }, "node_modules/p-limit": { "version": "3.1.0", "license": "MIT", @@ -36688,22 +36932,20 @@ "license": "MIT" }, "node_modules/style-loader": { - "version": "2.0.0", + "version": "3.3.4", + "resolved": "https://registry.npmjs.org/style-loader/-/style-loader-3.3.4.tgz", + "integrity": "sha512-0WqXzrsMTyb8yjZJHDqwmnwRJvhALK9LfRtRc6B4UTWe8AijYLZYZ9thuJTZc2VfQWINADW/j+LiJnfy2RoC1w==", "dev": true, "license": "MIT", - "dependencies": { - "loader-utils": "^2.0.0", - "schema-utils": "^3.0.0" - }, "engines": { - "node": ">= 10.13.0" + "node": ">= 12.13.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/webpack" }, "peerDependencies": { - "webpack": "^4.0.0 || ^5.0.0" + "webpack": "^5.0.0" } }, "node_modules/styleq": { diff --git a/package.json b/package.json index ba183008071a..d77cfad4fcc4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "new.expensify", - "version": "9.3.18-0", + "version": "9.3.19-4", "author": "Expensify, Inc.", "homepage": "https://new.expensify.com", "description": "New Expensify is the next generation of Expensify: a reimagination of payments based atop a foundation of chat.", @@ -50,9 +50,9 @@ "shellcheck": "./scripts/shellCheck.sh", "spell": "cspell --color **/*", "spell-changed": "cspell --color --no-must-find-files", - "prettier": "prettier --write .", - "prettier-changed": "prettier --write --ignore-unknown $(git diff --diff-filter=AMR --name-only origin/main HEAD)", - "prettier-watch": "onchange \"**/*.{js,mjs,ts,tsx}\" -- prettier --write --ignore-unknown {{changed}}", + "prettier": "prettier --experimental-cli --write .", + "prettier-changed": "prettier --experimental-cli --write --ignore-unknown $(git diff --diff-filter=AMR --name-only origin/main HEAD)", + "prettier-watch": "onchange \"**/*.{js,mjs,ts,tsx}\" -- prettier --experimental-cli --write --ignore-unknown {{changed}}", "print-version": "echo $npm_package_version", "storybook": "storybook dev -p 6006", "storybook-build": "ENV=production storybook build -o dist/docs", @@ -144,6 +144,7 @@ "expo-store-review": "~9.0.8", "expo-task-manager": "~14.0.9", "expo-video": "3.0.12", + "expo-web-browser": "15.0.10", "fast-equals": "^5.2.2", "focus-trap-react": "^11.0.3", "group-ib-fp": "file:modules/group-ib-fp", @@ -247,6 +248,7 @@ "@perf-profiler/reporter": "^0.9.0", "@perf-profiler/types": "^0.8.0", "@pmmmwh/react-refresh-webpack-plugin": "^0.5.15", + "@prettier/plugin-oxc": "^0.1.3", "@react-native-community/cli": "20.0.0", "@react-native-community/cli-platform-android": "20.0.0", "@react-native-community/cli-platform-ios": "20.0.0", @@ -296,7 +298,7 @@ "@vue/preload-webpack-plugin": "^2.0.0", "@welldone-software/why-did-you-render": "7.0.1", "babel-jest": "29.7.0", - "babel-loader": "^9.1.3", + "babel-loader": "^10.0.0", "babel-plugin-module-resolver": "^5.0.0", "babel-plugin-react-compiler": "1.0.0", "babel-plugin-react-native-web": "^0.18.7", @@ -354,7 +356,7 @@ "shellcheck": "^1.1.0", "source-map": "^0.7.4", "storybook": "10.1.10", - "style-loader": "^2.0.0", + "style-loader": "^3.0.0", "svgo": "^4.0.0", "time-analytics-webpack-plugin": "^0.1.17", "ts-jest": "^29.2.5", diff --git a/patches/@shopify/flash-list/@shopify+flash-list+2.2.0.patch b/patches/@shopify/flash-list/@shopify+flash-list+2.2.0.patch new file mode 100644 index 000000000000..d7dc8019aad3 --- /dev/null +++ b/patches/@shopify/flash-list/@shopify+flash-list+2.2.0.patch @@ -0,0 +1,23 @@ +diff --git a/node_modules/@shopify/flash-list/dist/recyclerview/layout-managers/LinearLayoutManager.js b/node_modules/@shopify/flash-list/dist/recyclerview/layout-managers/LinearLayoutManager.js +index fb40ded..67432e6 100644 +--- a/node_modules/@shopify/flash-list/dist/recyclerview/layout-managers/LinearLayoutManager.js ++++ b/node_modules/@shopify/flash-list/dist/recyclerview/layout-managers/LinearLayoutManager.js +@@ -115,8 +115,16 @@ export class RVLinearLayoutManagerImpl extends RVLayoutManager { + layout.minHeight = targetMinHeight; + } + newTallestItem.minHeight = 0; +- this.tallestItem = newTallestItem; +- this.tallestItemHeight = newTallestItem.height; ++ // When items shrink (targetMinHeight = 0), reset tracking so the ++ // next cycle re-detects the tallest item after repaint and properly ++ // re-applies minHeight for all layouts. ++ if (targetMinHeight === 0) { ++ this.tallestItem = undefined; ++ this.tallestItemHeight = 0; ++ } else { ++ this.tallestItem = newTallestItem; ++ this.tallestItemHeight = newTallestItem.height; ++ } + } + } + /** diff --git a/patches/@shopify/flash-list/details.md b/patches/@shopify/flash-list/details.md new file mode 100644 index 000000000000..c53cc337ca88 --- /dev/null +++ b/patches/@shopify/flash-list/details.md @@ -0,0 +1,8 @@ +# `@shopify/flash-list` patches + +### [@shopify+flash-list+2.2.0.patch](@shopify+flash-list+2.2.0.patch) + +- Reason: Fixes horizontal FlashList items getting stuck with `minHeight: 0` after a layout change (e.g., screen resize). In `LinearLayoutManager.normalizeLayoutHeights`, when items shrink, `tallestItemHeight` was updated prematurely, causing the next cycle to skip re-normalization. The fix resets the tallest item tracking when items shrink so the next repaint cycle properly re-detects the tallest item and re-applies `minHeight` for all layouts. +- Upstream PR/issue: TBD +- E/App issue: https://github.com/Expensify/App/issues/33725 +- PR introducing patch: https://github.com/Expensify/App/pull/81566 diff --git a/src/CONFIG.ts b/src/CONFIG.ts index 5db59448fb78..ca78f5a608b8 100644 --- a/src/CONFIG.ts +++ b/src/CONFIG.ts @@ -89,7 +89,7 @@ export default { CONCIERGE_URL_PATHNAME: 'concierge/', DEVPORTAL_URL_PATHNAME: '_devportal/', CONCIERGE_URL: `${expensifyURL}concierge/`, - SAML_URL: `${expensifyURL}authentication/saml/login`, + SAML_URL: `${expensifyURL}authentication/saml`, }, IS_IN_PRODUCTION: Platform.OS === 'web' ? process.env.NODE_ENV === 'production' : !__DEV__, IS_IN_STAGING: ENVIRONMENT === CONST.ENVIRONMENT.STAGING, diff --git a/src/CONST/index.ts b/src/CONST/index.ts index 4eb625affacd..ca0bc34ee545 100755 --- a/src/CONST/index.ts +++ b/src/CONST/index.ts @@ -777,6 +777,7 @@ const CONST = { ODOMETER_EXPENSES: 'odometerExpenses', NEW_DOT_HOME: 'newDotHome', SINGLE_USE_AND_EXPIRE_BY_CARDS: 'singleUseAndExpireByCards', + PAY_INVOICE_VIA_EXPENSIFY: 'payInvoiceViaExpensify', PERSONAL_CARD_IMPORT: 'personalCardImport', SUGGESTED_FOLLOWUPS: 'suggestedFollowups', }, @@ -1027,6 +1028,7 @@ const CONST = { GOOGLE_DOC_IMAGE_LINK_MATCH: 'googleusercontent.com', IMAGE_BASE64_MATCH: 'base64', DEEPLINK_BASE_URL: 'new-expensify://', + SAML_REDIRECT_URL: 'expensify://open', PDF_VIEWER_URL: '/pdf/web/viewer.html', CLOUDFRONT_DOMAIN_REGEX: /^https:\/\/\w+\.cloudfront\.net/i, EXPENSIFY_ICON_URL: `${CLOUDFRONT_URL}/images/favicon-2019.png`, @@ -1163,6 +1165,7 @@ const CONST = { REQUEST_MANUAL: 'requestManual', REQUEST_SCAN: 'requestScan', REQUEST_DISTANCE: 'requestDistance', + REQUEST_TIME: 'requestTime', PER_DIEM: 'perDiem', SPLIT_MANUAL: 'splitManual', SPLIT_SCAN: 'splitScan', @@ -1766,6 +1769,24 @@ const CONST = { TAG_AUTHENTICATION_FUNCTION: 'authentication_function', TAG_AUTHENTICATION_ERROR_TYPE: 'authentication_error_type', TAG_AUTHENTICATION_JSON_CODE: 'authentication_json_code', + TAG_EXPENSE_ERROR_TYPE: 'expense_error_type', + TAG_EXPENSE_ERROR_SOURCE: 'expense_error_source', + EXPENSE_ERROR_TYPE: { + REPORT_CREATION_FAILED: 'report_creation_failed', + TRANSACTION_MISSING: 'transaction_missing', + API_ERROR: 'api_error', + OPEN_REPORT_FAILED: 'open_report_failed', + }, + EXPENSE_ERROR_SOURCE: { + TRANSACTION: 'transaction', + REPORT_ACTION: 'report_action', + REPORT_CREATION: 'report_creation', + API_RESPONSE: 'api_response', + }, + TAG_EXPENSE_IS_REQUEST_PENDING: 'expense_is_request_pending', + TAG_EXPENSE_HAS_RECEIPT: 'expense_has_receipt', + TAG_EXPENSE_COMMAND: 'expense_command', + TAG_EXPENSE_JSON_CODE: 'expense_json_code', // Span names SPAN_OPEN_REPORT: 'ManualOpenReport', SPAN_APP_STARTUP: 'ManualAppStartup', @@ -4243,15 +4264,7 @@ const CONST = { LINKEDIN: 'https://www.linkedin.com/company/expensify', }, - // These split the maximum decimal value of a signed 64-bit number (9,223,372,036,854,775,807) into parts where none of them are too big to fit into a 32-bit number, so that we can - // generate them each with a random number generator with only 32-bits of precision. - MAX_64BIT_LEFT_PART: 92233, - MAX_64BIT_MIDDLE_PART: 7203685, - MAX_64BIT_RIGHT_PART: 4775807, INVALID_CATEGORY_NAME: '###', - - // When generating a random value to fit in 7 digits (for the `middle` or `right` parts above), this is the maximum value to multiply by Math.random(). - MAX_INT_FOR_RANDOM_7_DIGIT_VALUE: 10000000, IOS_KEYBOARD_SPACE_OFFSET: -30, API_REQUEST_TYPE: { @@ -4645,6 +4658,88 @@ const CONST = { PLAID_EXCLUDED_COUNTRIES: ['IR', 'CU', 'SY', 'UA', 'KP'] as string[], PLAID_SUPPORT_COUNTRIES: ['US', 'CA', 'GB', 'AT', 'BE', 'DK', 'EE', 'FI', 'FR', 'DE', 'IE', 'IT', 'LV', 'LT', 'NL', 'NO', 'PL', 'PT', 'ES', 'SE'] as string[], + BBA_SUPPORTED_COUNTRIES: [ + 'AT', + 'AU', + 'BE', + 'BG', + 'CA', + 'CY', + 'CZ', + 'DE', + 'DK', + 'EE', + 'ES', + 'FI', + 'FR', + 'GR', + 'HR', + 'HU', + 'IE', + 'IT', + 'LT', + 'LU', + 'LV', + 'MT', + 'NL', + 'PL', + 'PT', + 'RO', + 'SE', + 'SI', + 'SK', + 'GB', + 'US', + ] as string[], + + BBA_COUNTRY_CURRENCY_MAP: { + AT: 'EUR', + AU: 'AUD', + BE: 'EUR', + BG: 'EUR', + CA: 'CAD', + CY: 'EUR', + CZ: 'EUR', + DE: 'EUR', + DK: 'EUR', + EE: 'EUR', + ES: 'EUR', + FI: 'EUR', + FR: 'EUR', + GR: 'EUR', + HR: 'EUR', + HU: 'EUR', + IE: 'EUR', + IT: 'EUR', + LT: 'EUR', + LU: 'EUR', + LV: 'EUR', + MT: 'EUR', + NL: 'EUR', + PL: 'EUR', + PT: 'EUR', + RO: 'EUR', + SE: 'EUR', + SI: 'EUR', + SK: 'EUR', + GB: 'GBP', + US: 'USD', + } as Record, + + // Maps actual local currencies to their respective countries (not BBA currencies) + // Used to determine country selection based on personal policy outputCurrency + // Only includes currencies used by a single country (EUR excluded as it's used by multiple countries) + BBA_EU_ORIGINAL_CURRENCY_COUNTRY_MAP: { + BGN: 'BG', + CZK: 'CZ', + DKK: 'DK', + GBP: 'GB', + HUF: 'HU', + PLN: 'PL', + RON: 'RO', + SEK: 'SE', + } as Record, + // Sources: https://github.com/Expensify/App/issues/14958#issuecomment-1442138427 // https://github.com/Expensify/App/issues/14958#issuecomment-1456026810 COUNTRY_ZIP_REGEX_DATA: { @@ -8160,6 +8255,55 @@ const CONST = { USER_SELECTION_CHECKBOX: 'Search-UserSelectionCheckbox', TRANSACTION_GROUP_LIST_ITEM: 'Search-TransactionGroupListItem', SELECT_ALL_BUTTON: 'Search-SelectAllButton', + TYPE_MENU_BUTTON: 'Search-TypeMenuButton', + FILTER_TYPE: 'Search-FilterType', + FILTER_STATUS: 'Search-FilterStatus', + FILTER_DATE: 'Search-FilterDate', + FILTER_FROM: 'Search-FilterFrom', + FILTER_WORKSPACE: 'Search-FilterWorkspace', + FILTER_GROUP_BY: 'Search-FilterGroupBy', + FILTER_GROUP_CURRENCY: 'Search-FilterGroupCurrency', + FILTER_VIEW: 'Search-FilterView', + FILTER_FEED: 'Search-FilterFeed', + FILTER_POSTED: 'Search-FilterPosted', + FILTER_WITHDRAWN: 'Search-FilterWithdrawn', + FILTER_WITHDRAWAL_TYPE: 'Search-FilterWithdrawalType', + FILTER_HAS: 'Search-FilterHas', + FILTER_IS: 'Search-FilterIs', + ADVANCED_FILTERS_BUTTON: 'Search-AdvancedFiltersButton', + COLUMNS_BUTTON: 'Search-ColumnsButton', + SELECT_ALL_MATCHING_BUTTON: 'Search-SelectAllMatchingButton', + BULK_ACTIONS_DROPDOWN: 'Search-BulkActionsDropdown', + SELECT_ALL_CHECKBOX: 'Search-SelectAllCheckbox', + SELECTION_MODE_MENU_ITEM: 'Search-SelectionModeMenuItem', + FILTER_RESET_BUTTON: 'Search-FilterResetButton', + FILTER_SAVE_BUTTON: 'Search-FilterSaveButton', + NARROW_BULK_ACTIONS_DROPDOWN: 'Search-NarrowBulkActionsDropdown', + SAVED_SEARCH_THREE_DOT_MENU: 'Search-SavedSearchThreeDotMenu', + FILTER_POPUP_RESET_SINGLE_SELECT: 'Search-FilterPopupResetSingleSelect', + FILTER_POPUP_APPLY_SINGLE_SELECT: 'Search-FilterPopupApplySingleSelect', + FILTER_POPUP_RESET_MULTI_SELECT: 'Search-FilterPopupResetMultiSelect', + FILTER_POPUP_APPLY_MULTI_SELECT: 'Search-FilterPopupApplyMultiSelect', + FILTER_POPUP_RESET_DATE: 'Search-FilterPopupResetDate', + FILTER_POPUP_APPLY_DATE: 'Search-FilterPopupApplyDate', + FILTER_POPUP_RESET_USER: 'Search-FilterPopupResetUser', + FILTER_POPUP_APPLY_USER: 'Search-FilterPopupApplyUser', + TRANSACTION_LIST_ITEM: 'Search-TransactionListItem', + TRANSACTION_LIST_ITEM_CHECKBOX: 'Search-TransactionListItemCheckbox', + EXPANDED_TRANSACTION_ROW: 'Search-ExpandedTransactionRow', + EXPANDED_TRANSACTION_ROW_CHECKBOX: 'Search-ExpandedTransactionRowCheckbox', + TYPE_MENU_ITEM: 'Search-TypeMenuItem', + SAVED_SEARCH_MENU_ITEM: 'Search-SavedSearchMenuItem', + ADVANCED_FILTER_ITEM: 'Search-AdvancedFilterItem', + SAVE_SEARCH_BUTTON: 'Search-SaveSearchButton', + VIEW_RESULTS_BUTTON: 'Search-ViewResultsButton', + ACTION_CELL_VIEW: 'Search-ActionCellView', + ACTION_CELL_PAY: 'Search-ActionCellPay', + ACTION_CELL_ACTION: 'Search-ActionCellAction', + EXPENSE_REPORT_CHECKBOX: 'Search-ExpenseReportCheckbox', + GROUP_EXPAND_TOGGLE: 'Search-GroupExpandToggle', + GROUP_SELECT_ALL_CHECKBOX: 'Search-GroupSelectAllCheckbox', + SORTABLE_HEADER: 'Search-SortableHeader', }, REPORT: { FLOATING_MESSAGE_COUNTER: 'Report-FloatingMessageCounter', @@ -8454,6 +8598,12 @@ const CONST = { RESEND_CODE: 'ValidateCode-ResendCode', RECOVERY_CODE: 'ValidateCode-RecoveryCode', }, + INTERACTIVE_STEP_SUB_HEADER: { + STEP_BUTTON: 'InteractiveStepSubHeader-StepButton', + }, + SOCIALS: { + LINK: 'Socials', + }, }, DOMAIN: { diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 9abf1a8d2639..f79fdffec872 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -1,4 +1,3 @@ -import type {OnyxUpdate} from 'react-native-onyx'; import type {ValueOf} from 'type-fest'; import type CONST from './CONST'; import type {OnboardingAccounting} from './CONST'; @@ -9,6 +8,7 @@ import type * as FormTypes from './types/form'; import type * as OnyxTypes from './types/onyx'; import type {Attendee, DistanceExpenseType, Participant} from './types/onyx/IOU'; import type Onboarding from './types/onyx/Onboarding'; +import type {AnyOnyxUpdate} from './types/onyx/Request'; import type AssertTypesEqual from './types/utils/AssertTypesEqual'; import type DeepValueOf from './types/utils/DeepValueOf'; @@ -1267,7 +1267,7 @@ type OnyxValuesMapping = { [ONYXKEYS.NVP_MUTED_PLATFORMS]: Partial>; [ONYXKEYS.NVP_PRIORITY_MODE]: ValueOf; [ONYXKEYS.NVP_BLOCKED_FROM_CONCIERGE]: OnyxTypes.BlockedFromConcierge; - [ONYXKEYS.QUEUE_FLUSHED_DATA]: OnyxUpdate[]; + [ONYXKEYS.QUEUE_FLUSHED_DATA]: AnyOnyxUpdate[]; // The value of this nvp is a string representation of the date when the block expires, or an empty string if the user is not blocked [ONYXKEYS.NVP_BLOCKED_FROM_CHAT]: string; @@ -1333,7 +1333,7 @@ type OnyxValuesMapping = { [ONYXKEYS.VERIFY_3DS_SUBSCRIPTION]: string; [ONYXKEYS.PREFERRED_THEME]: ValueOf; [ONYXKEYS.MAPBOX_ACCESS_TOKEN]: OnyxTypes.MapboxAccessToken; - [ONYXKEYS.ONYX_UPDATES_FROM_SERVER]: OnyxTypes.OnyxUpdatesFromServer; + [ONYXKEYS.ONYX_UPDATES_FROM_SERVER]: OnyxTypes.AnyOnyxUpdatesFromServer; [ONYXKEYS.ONYX_UPDATES_LAST_UPDATE_ID_APPLIED_TO_CLIENT]: number; [ONYXKEYS.MAX_CANVAS_AREA]: number; [ONYXKEYS.MAX_CANVAS_HEIGHT]: number; diff --git a/src/ROUTES.ts b/src/ROUTES.ts index 4f22f01b50d4..25eabf9623a0 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -1,3 +1,4 @@ +/* eslint-disable max-lines */ /** * NOTE!!!! * @@ -229,9 +230,27 @@ const ROUTES = { BANK_ACCOUNT_PERSONAL: 'bank-account/personal', BANK_ACCOUNT_WITH_STEP_TO_OPEN: { route: 'bank-account/:stepToOpen?', - getRoute: (policyID: string | undefined, stepToOpen: ReimbursementAccountStepToOpen = '', backTo?: string, subStepToOpen?: typeof CONST.BANK_ACCOUNT.STEP.COUNTRY) => { - if (!policyID) { - Log.warn('Invalid policyID is used to build the BANK_ACCOUNT_WITH_STEP_TO_OPEN route'); + getRoute: ({ + policyID, + stepToOpen = '', + bankAccountID, + backTo, + subStepToOpen, + }: { + policyID: string | undefined; + stepToOpen?: ReimbursementAccountStepToOpen; + bankAccountID?: number; + backTo?: string; + subStepToOpen?: typeof CONST.BANK_ACCOUNT.STEP.COUNTRY; + }) => { + if (!policyID && !bankAccountID) { + // eslint-disable-next-line no-restricted-syntax -- Legacy route generation + return getUrlWithBackToParam(`bank-account/${stepToOpen}`, backTo); + } + + if (bankAccountID) { + // eslint-disable-next-line no-restricted-syntax -- Legacy route generation + return getUrlWithBackToParam(`bank-account/${stepToOpen}?bankAccountID=${bankAccountID}`, backTo); } // TODO this backTo comes from drilling it through bank account form screens // should be removed once https://github.com/Expensify/App/pull/72219 is resolved @@ -417,6 +436,7 @@ const ROUTES = { SETTINGS_ADD_US_BANK_ACCOUNT: 'settings/wallet/add-us-bank-account', SETTINGS_ADD_US_BANK_ACCOUNT_ENTRY_POINT: 'settings/wallet/add-us-bank-account/entry-point', SETTINGS_ADD_BANK_ACCOUNT_SELECT_COUNTRY_VERIFY_ACCOUNT: `settings/wallet/add-bank-account/select-country/${VERIFY_ACCOUNT}`, + SETTINGS_BANK_ACCOUNT_PURPOSE: 'settings/wallet/bank-account-purpose', SETTINGS_ENABLE_PAYMENTS: 'settings/wallet/enable-payments', SETTINGS_WALLET_UNSHARE_BANK_ACCOUNT: { route: 'settings/wallet/:bankAccountID/unshare-bank-account', @@ -471,15 +491,15 @@ const ROUTES = { }, SETTINGS_RULES: 'settings/rules', SETTINGS_RULES_ADD: { - route: 'settings/rules/new/:field?', - getRoute: (field?: ValueOf) => { - return `settings/rules/new/${field ? StringUtils.camelToHyphenCase(field) : ''}` as const; + route: 'settings/rules/new/:field?/:index?', + getRoute: (field?: ValueOf, index?: number) => { + return `settings/rules/new/${field ? StringUtils.camelToHyphenCase(field) : ''}${index !== undefined ? `/${index === -1 ? ':index' : index}` : ''}` as const; }, }, SETTINGS_RULES_EDIT: { - route: 'settings/rules/edit/:hash/:field?', - getRoute: (hash?: string, field?: ValueOf) => { - return `settings/rules/edit/${hash ?? ':hash'}/${field ? StringUtils.camelToHyphenCase(field) : ''}` as const; + route: 'settings/rules/edit/:hash/:field?/:index?', + getRoute: (hash?: string, field?: ValueOf, index?: number) => { + return `settings/rules/edit/${hash ?? ':hash'}/${field ? StringUtils.camelToHyphenCase(field) : ''}${index !== undefined ? `/${index === -1 ? ':index' : index}` : ''}` as const; }, }, SETTINGS_LEGAL_NAME: 'settings/profile/legal-name', @@ -2809,8 +2829,8 @@ const ROUTES = { getRoute: (policyID: string, ruleID?: string) => `workspaces/${policyID}/rules/merchant-rules/${ruleID ?? 'new'}/category` as const, }, RULES_MERCHANT_TAG: { - route: 'workspaces/:policyID/rules/merchant-rules/:ruleID/tag', - getRoute: (policyID: string, ruleID?: string) => `workspaces/${policyID}/rules/merchant-rules/${ruleID ?? 'new'}/tag` as const, + route: 'workspaces/:policyID/rules/merchant-rules/:ruleID/tag/:orderWeight', + getRoute: (policyID: string, ruleID?: string, orderWeight?: number) => `workspaces/${policyID}/rules/merchant-rules/${ruleID ?? 'new'}/tag/${orderWeight}` as const, }, RULES_MERCHANT_TAX: { route: 'workspaces/:policyID/rules/merchant-rules/:ruleID/tax', @@ -3918,6 +3938,11 @@ const ROUTES = { MULTIFACTOR_AUTHENTICATION_NOT_FOUND: 'multifactor-authentication/not-found', MULTIFACTOR_AUTHENTICATION_REVOKE: 'multifactor-authentication/revoke', + + DOMAIN_GROUPS: { + route: 'domain/:domainAccountID/groups', + getRoute: (domainAccountID: number) => `domain/${domainAccountID}/groups` as const, + }, } as const; /** diff --git a/src/SCREENS.ts b/src/SCREENS.ts index 2f5062cfd97c..2e2307a91c03 100644 --- a/src/SCREENS.ts +++ b/src/SCREENS.ts @@ -112,6 +112,7 @@ const SCREENS = { ADD_US_BANK_ACCOUNT: 'Settings_Add_US_Bank_Account', ADD_US_BANK_ACCOUNT_ENTRY_POINT: 'Settings_Add_US_Bank_Account_Entry_Point', ADD_BANK_ACCOUNT_SELECT_COUNTRY_VERIFY_ACCOUNT: 'Settings_Add_Bank_Account_Select_Country_Verify_Account', + BANK_ACCOUNT_PURPOSE: 'Settings_Bank_Account_Purpose', CLOSE: 'Settings_Close', REPORT_CARD_LOST_OR_DAMAGED: 'Settings_ReportCardLostOrDamaged', REPORT_CARD_LOST_OR_DAMAGED_CONFIRM_MAGIC_CODE: 'Settings_ReportCardLostOrDamaged_ConfirmMagicCode', @@ -945,6 +946,7 @@ const SCREENS = { ADD_MEMBER: 'Domain_Add_Member', MEMBERS_SETTINGS: 'Members_Settings', MEMBERS_SETTINGS_TWO_FACTOR_AUTH: 'Members_Settings_Two_Factor_Auth', + GROUPS: 'Domain_Groups', }, MULTIFACTOR_AUTHENTICATION: { MAGIC_CODE: 'Multifactor_Authentication_Magic_Code', diff --git a/src/components/AnimatedCollapsible/index.tsx b/src/components/AnimatedCollapsible/index.tsx index 8526f23e9fc3..805922b0db28 100644 --- a/src/components/AnimatedCollapsible/index.tsx +++ b/src/components/AnimatedCollapsible/index.tsx @@ -11,8 +11,9 @@ import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import CONST from '@src/CONST'; +import type WithSentryLabel from '@src/types/utils/SentryLabel'; -type AnimatedCollapsibleProps = { +type AnimatedCollapsibleProps = WithSentryLabel & { /** Whether the component is expanded */ isExpanded: boolean; @@ -67,6 +68,7 @@ function AnimatedCollapsible({ disabled = false, shouldShowToggleButton = true, borderBottomStyle, + sentryLabel, }: AnimatedCollapsibleProps) { const theme = useTheme(); const styles = useThemeStyles(); @@ -139,6 +141,7 @@ function AnimatedCollapsible({ style={[styles.p3Half, styles.justifyContentCenter, styles.alignItemsCenter, expandButtonStyle]} accessibilityRole={CONST.ROLE.BUTTON} accessibilityLabel={isExpanded ? CONST.ACCESSIBILITY_LABELS.COLLAPSE : CONST.ACCESSIBILITY_LABELS.EXPAND} + sentryLabel={sentryLabel} > {({hovered}) => ( @@ -105,8 +103,6 @@ function DistanceEReceipt({transaction, hoverPreview = false}: DistanceEReceiptP width={86} height={19.25} src={icons.ExpensifyWordmark} - // Temporary solution only, since other cache policies are causing memory leaks on iOS - cachePolicy="none" /> {translate('eReceipt.guaranteed')} diff --git a/src/components/EReceipt.tsx b/src/components/EReceipt.tsx index a975f0b4a71c..76b97ca3d3b3 100644 --- a/src/components/EReceipt.tsx +++ b/src/components/EReceipt.tsx @@ -17,6 +17,7 @@ import variables from '@styles/variables'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import type Transaction from '@src/types/onyx/Transaction'; +import EReceiptBody from './EReceiptBody'; import Icon from './Icon'; import ImageSVG from './ImageSVG'; import type {TransactionListItemType} from './SelectionListWithSections/types'; @@ -44,7 +45,7 @@ function EReceipt({transactionID, transactionItem, onLoad, isThumbnail = false}: const {translate} = useLocalize(); const {getCurrencySymbol} = useCurrencyList(); const theme = useTheme(); - const icons = useMemoizedLazyExpensifyIcons(['ReceiptBody', 'ExpensifyWordmark']); + const icons = useMemoizedLazyExpensifyIcons(['ExpensifyWordmark']); const [cardList] = useOnyx(ONYXKEYS.CARD_LIST, {selector: filterOutPersonalCards, canBeMissing: true}); const [transaction] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION}${getNonEmptyStringOnyxID(transactionID)}`, {canBeMissing: true}); @@ -87,21 +88,11 @@ function EReceipt({transactionID, transactionItem, onLoad, isThumbnail = false}: > - + - + ) : null} {!MCCIcon && tripIcon ? ( @@ -131,8 +120,6 @@ function EReceipt({transactionID, transactionItem, onLoad, isThumbnail = false}: height={receiptMCCSize} width={receiptMCCSize} fill={primaryColor} - // Temporary solution only, since other cache policies are causing memory leaks on iOS - cachePolicy="none" /> ) : null} @@ -173,8 +160,6 @@ function EReceipt({transactionID, transactionItem, onLoad, isThumbnail = false}: height={variables.eReceiptWordmarkHeight} fill={secondaryColor} src={icons.ExpensifyWordmark} - // Temporary solution only, since other cache policies are causing memory leaks on iOS - cachePolicy="none" /> diff --git a/src/components/EReceiptBody/index.android.tsx b/src/components/EReceiptBody/index.android.tsx new file mode 100644 index 000000000000..1299dca997dd --- /dev/null +++ b/src/components/EReceiptBody/index.android.tsx @@ -0,0 +1,22 @@ +import React from 'react'; +import ImageSVG from '@components/ImageSVG'; +import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset'; +import useTheme from '@hooks/useTheme'; + +// On Android, applying the fill color directly to the SVG doesn't work, +// so the color is passed via the fill prop (expo-image's tintColor) instead. +// On iOS, the fill is baked into the SVG to avoid a 3x resolution rendering issue (see index.tsx). +function EReceiptBody() { + const icons = useMemoizedLazyExpensifyIcons(['ReceiptBody']); + const theme = useTheme(); + + return ( + + ); +} + +export default EReceiptBody; diff --git a/src/components/EReceiptBody/index.tsx b/src/components/EReceiptBody/index.tsx new file mode 100644 index 000000000000..eaac3e9d5a26 --- /dev/null +++ b/src/components/EReceiptBody/index.tsx @@ -0,0 +1,19 @@ +import React from 'react'; +import ImageSVG from '@components/ImageSVG'; +import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset'; + +// The fill color is applied directly to the SVG file because using expo-image's +// tintColor on iOS causes the image to render at 3x resolution. +// On Android, the SVG fill doesn't work, so the color is passed via the fill prop instead (see index.android.tsx). +function EReceiptBody() { + const icons = useMemoizedLazyExpensifyIcons(['ReceiptBody']); + + return ( + + ); +} + +export default EReceiptBody; diff --git a/src/components/EReceiptThumbnail.tsx b/src/components/EReceiptThumbnail.tsx index 219e140dedf9..7650e4cb588f 100644 --- a/src/components/EReceiptThumbnail.tsx +++ b/src/components/EReceiptThumbnail.tsx @@ -87,11 +87,7 @@ function EReceiptThumbnail({transactionID, borderRadius, fileExtension, isReceip ]} > - + @@ -101,8 +97,6 @@ function EReceiptThumbnail({transactionID, borderRadius, fileExtension, isReceip width={receiptIconWidth} fill={secondaryColor} additionalStyles={[styles.fullScreen]} - // Temporary solution only, since other cache policies are causing memory leaks on iOS - cachePolicy="none" /> {isReceiptThumbnail && !!fileExtension && ( ) : null} {!isPerDiemRequest && MCCIcon && !isReceiptThumbnail ? ( @@ -133,8 +125,6 @@ function EReceiptThumbnail({transactionID, borderRadius, fileExtension, isReceip height={receiptMCCSize} width={receiptMCCSize} fill={primaryColor} - // Temporary solution only, since other cache policies are causing memory leaks on iOS - cachePolicy="none" /> ) : null} {!isPerDiemRequest && !MCCIcon && tripIcon ? ( @@ -143,8 +133,6 @@ function EReceiptThumbnail({transactionID, borderRadius, fileExtension, isReceip height={receiptMCCSize} width={receiptMCCSize} fill={primaryColor} - // Temporary solution only, since other cache policies are causing memory leaks on iOS - cachePolicy="none" /> ) : null} diff --git a/src/components/Icon/chunks/illustrations.chunk.ts b/src/components/Icon/chunks/illustrations.chunk.ts index f86a9b9bd84a..171962ca52ba 100644 --- a/src/components/Icon/chunks/illustrations.chunk.ts +++ b/src/components/Icon/chunks/illustrations.chunk.ts @@ -79,7 +79,7 @@ import ToddBehindCloud from '@assets/images/product-illustrations/todd-behind-cl import ToddInCar from '@assets/images/product-illustrations/todd-in-car.svg'; import ToddWithPhones from '@assets/images/product-illustrations/todd-with-phones.svg'; import WorkspaceScene from '@assets/images/product-illustrations/workspace-scene.svg'; -import ReceiptUpload from '@assets/images/receipt-upload.svg'; +import ReceiptStack from '@assets/images/receipt-upload.svg'; import RunningTurtle from '@assets/images/running-turtle.svg'; import Shutter from '@assets/images/shutter.svg'; // Simple Illustrations - Bucket 3 (Common) @@ -91,6 +91,7 @@ import Alert from '@assets/images/simple-illustrations/simple-illustration__aler import Members from '@assets/images/simple-illustrations/simple-illustration__approval-members.svg'; import Approval from '@assets/images/simple-illustrations/simple-illustration__approval.svg'; import ShareBank from '@assets/images/simple-illustrations/simple-illustration__bank-share.svg'; +import BankCoin from '@assets/images/simple-illustrations/simple-illustration__bankcoin.svg'; import Binoculars from '@assets/images/simple-illustrations/simple-illustration__binoculars.svg'; import BlueShield from '@assets/images/simple-illustrations/simple-illustration__blueshield.svg'; import Building from '@assets/images/simple-illustrations/simple-illustration__building.svg'; @@ -145,6 +146,7 @@ import RealtimeReport from '@assets/images/simple-illustrations/simple-illustrat import ReceiptLocationMarker from '@assets/images/simple-illustrations/simple-illustration__receipt-location-marker.svg'; import ReceiptWrangler from '@assets/images/simple-illustrations/simple-illustration__receipt-wrangler.svg'; import ReceiptPartners from '@assets/images/simple-illustrations/simple-illustration__receipt.svg'; +import ReceiptUpload from '@assets/images/simple-illustrations/simple-illustration__receiptupload.svg'; import ReportReceipt from '@assets/images/simple-illustrations/simple-illustration__report-receipt.svg'; import Rules from '@assets/images/simple-illustrations/simple-illustration__rules.svg'; import SendMoney from '@assets/images/simple-illustrations/simple-illustration__sendmoney.svg'; @@ -164,6 +166,7 @@ import TreasureChest from '@assets/images/simple-illustrations/simple-illustrati import CompanyCard from '@assets/images/simple-illustrations/simple-illustration__twocards-horizontal.svg'; import UserShield from '@assets/images/simple-illustrations/simple-illustration__user-shield.svg'; import VirtualCard from '@assets/images/simple-illustrations/simple-illustration__virtualcard.svg'; +import WalletAlt2 from '@assets/images/simple-illustrations/simple-illustration__wallet-alt2.svg'; import Workflows from '@assets/images/simple-illustrations/simple-illustration__workflows.svg'; import ExpensifyApprovedLogo from '@assets/images/subscription-details__approvedlogo.svg'; import TurtleInShell from '@assets/images/turtle-in-shell.svg'; @@ -251,7 +254,7 @@ const Illustrations = { // Other Images Hand, PendingTravel, - ReceiptUpload, + ReceiptStack, RunningTurtle, Shutter, ExpensifyApprovedLogo, @@ -260,6 +263,7 @@ const Illustrations = { // Simple Illustrations Accounting, Building, + BankCoin, Coins, CreditCardsNew, FolderOpen, @@ -274,6 +278,7 @@ const Illustrations = { RealtimeReport, ReceiptPartners, ReceiptWrangler, + ReceiptUpload, TravelAlerts, ReportReceipt, Rules, @@ -338,6 +343,7 @@ const Illustrations = { ShieldYellow, Clock, Members, + WalletAlt2, UserShield, // Multifactor Authentication Illustrations diff --git a/src/components/Icon/index.tsx b/src/components/Icon/index.tsx index 960ea049d01c..0bf07bb964bd 100644 --- a/src/components/Icon/index.tsx +++ b/src/components/Icon/index.tsx @@ -1,4 +1,4 @@ -import type {ImageContentFit, ImageProps} from 'expo-image'; +import type {ImageContentFit} from 'expo-image'; import React, {useCallback, useContext, useMemo, useState} from 'react'; import type {LayoutChangeEvent, StyleProp, ViewStyle} from 'react-native'; import {PixelRatio, StyleSheet, View} from 'react-native'; @@ -60,9 +60,6 @@ type IconProps = { /** Renders the Icon component within a MultiGestureCanvas for improved gesture controls. */ enableMultiGestureCanvas?: boolean; - - /** The image cache policy */ - cachePolicy?: ImageProps['cachePolicy']; }; function Icon({ @@ -82,7 +79,6 @@ function Icon({ contentFit = 'cover', isButtonIcon = false, enableMultiGestureCanvas = false, - cachePolicy, }: IconProps) { const StyleUtils = useStyleUtils(); const styles = useThemeStyles(); @@ -129,7 +125,6 @@ function Icon({ hovered={hovered} pressed={pressed} contentFit={contentFit} - cachePolicy={cachePolicy} /> @@ -166,7 +161,6 @@ function Icon({ hovered={hovered} pressed={pressed} contentFit={contentFit} - cachePolicy={cachePolicy} /> @@ -191,7 +185,6 @@ function Icon({ hovered={hovered} pressed={pressed} contentFit={contentFit} - cachePolicy={cachePolicy} /> ); diff --git a/src/components/Image/BaseImage.ios.tsx b/src/components/Image/BaseImage.ios.tsx deleted file mode 100644 index ca90ef3d1768..000000000000 --- a/src/components/Image/BaseImage.ios.tsx +++ /dev/null @@ -1,57 +0,0 @@ -import {Image as ExpoImage} from 'expo-image'; -import type {ImageLoadEventData} from 'expo-image'; -import {useCallback, useContext, useEffect, useRef} from 'react'; -import type {AttachmentSource} from '@components/Attachments/types'; -import {AttachmentStateContext} from '@pages/media/AttachmentModalScreen/AttachmentModalBaseContent/AttachmentStateContextProvider'; -import type {BaseImageProps} from './types'; - -function BaseImage({onLoad, source, ...props}: BaseImageProps) { - const isLoadedRef = useRef(false); - const attachmentContext = useContext(AttachmentStateContext); - const {setAttachmentLoaded, isAttachmentLoaded} = attachmentContext || {}; - - useEffect(() => { - if (isAttachmentLoaded?.(source as AttachmentSource)) { - return; - } - setAttachmentLoaded(source as AttachmentSource, false); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); - - // Reset isLoadedRef when source changes to allow onLoad to fire again for new images (e.g., after rotation) - useEffect(() => { - isLoadedRef.current = false; - }, [source]); - - const imageLoadedSuccessfully = useCallback( - (event: ImageLoadEventData) => { - setAttachmentLoaded(source as AttachmentSource, true); - if (!onLoad) { - return; - } - if (isLoadedRef.current === true) { - return; - } - - // We override `onLoad`, so both web and native have the same signature - const {width, height} = event.source; - isLoadedRef.current = true; - onLoad({nativeEvent: {width, height}}); - }, - [onLoad, setAttachmentLoaded, source], - ); - - return ( - - ); -} - -export default BaseImage; diff --git a/src/components/Image/BaseImage.android.tsx b/src/components/Image/BaseImage.native.tsx similarity index 94% rename from src/components/Image/BaseImage.android.tsx rename to src/components/Image/BaseImage.native.tsx index e272ceeb9051..7d2c4e716dbd 100644 --- a/src/components/Image/BaseImage.android.tsx +++ b/src/components/Image/BaseImage.native.tsx @@ -2,6 +2,7 @@ import {Image as ExpoImage} from 'expo-image'; import type {ImageLoadEventData} from 'expo-image'; import {useCallback, useContext, useEffect, useRef} from 'react'; import type {AttachmentSource} from '@components/Attachments/types'; +import getImageRecyclingKey from '@libs/getImageRecyclingKey'; import {AttachmentStateContext} from '@pages/media/AttachmentModalScreen/AttachmentModalBaseContent/AttachmentStateContextProvider'; import type {BaseImageProps} from './types'; @@ -46,6 +47,7 @@ function BaseImage({onLoad, source, ...props}: BaseImageProps) { // Only subscribe to onLoad when a handler is provided to avoid unnecessary event registrations, optimizing performance. onLoad={onLoad ? imageLoadedSuccessfully : undefined} source={source} + recyclingKey={getImageRecyclingKey(source)} // eslint-disable-next-line react/jsx-props-no-spreading {...props} /> diff --git a/src/components/Image/BaseImage.tsx b/src/components/Image/BaseImage.tsx index ca07c09323b2..708348202ef2 100644 --- a/src/components/Image/BaseImage.tsx +++ b/src/components/Image/BaseImage.tsx @@ -2,6 +2,7 @@ import React, {useCallback, useContext, useEffect} from 'react'; import {Image as RNImage} from 'react-native'; import type {ImageLoadEvent, ImageSourcePropType} from 'react-native'; import type {AttachmentSource} from '@components/Attachments/types'; +import getImageRecyclingKey from '@libs/getImageRecyclingKey'; import {AttachmentStateContext} from '@pages/media/AttachmentModalScreen/AttachmentModalBaseContent/AttachmentStateContextProvider'; import type {BaseImageProps} from './types'; @@ -34,6 +35,8 @@ function BaseImage({onLoad, source, ...props}: BaseImageProps) { // Only subscribe to onLoad when a handler is provided to avoid unnecessary event registrations, optimizing performance. onLoad={onLoad ? imageLoadedSuccessfully : undefined} source={source as ImageSourcePropType} + // TODO: Replace with recyclingKey when the component is migrated to expo-image + key={getImageRecyclingKey(source)} // eslint-disable-next-line react/jsx-props-no-spreading {...props} /> diff --git a/src/components/ImageSVG/index.android.tsx b/src/components/ImageSVG/index.android.tsx index a479888a7b27..616329f7b8a0 100644 --- a/src/components/ImageSVG/index.android.tsx +++ b/src/components/ImageSVG/index.android.tsx @@ -1,5 +1,6 @@ import {Image} from 'expo-image'; import React, {useEffect} from 'react'; +import getImageRecyclingKey from '@libs/getImageRecyclingKey'; import type ImageSVGProps from './types'; function ImageSVG({src, width = '100%', height = '100%', fill, contentFit = 'cover', style, onLoadEnd}: ImageSVGProps) { @@ -56,6 +57,7 @@ function ImageSVG({src, width = '100%', height = '100%', fill, contentFit = 'cov cachePolicy="memory" contentFit={contentFit} source={src} + recyclingKey={getImageRecyclingKey(src)} style={[{width, height}, style]} // eslint-disable-next-line react/jsx-props-no-spreading {...tintColorProp} diff --git a/src/components/ImageSVG/index.ios.tsx b/src/components/ImageSVG/index.ios.tsx index bcd537cd3c9e..eb059574dd54 100644 --- a/src/components/ImageSVG/index.ios.tsx +++ b/src/components/ImageSVG/index.ios.tsx @@ -1,8 +1,9 @@ import {Image} from 'expo-image'; import React, {useEffect} from 'react'; +import getImageRecyclingKey from '@libs/getImageRecyclingKey'; import type ImageSVGProps from './types'; -function ImageSVG({src, width = '100%', height = '100%', fill, contentFit = 'cover', style, onLoadEnd, cachePolicy}: ImageSVGProps) { +function ImageSVG({src, width = '100%', height = '100%', fill, contentFit = 'cover', style, onLoadEnd}: ImageSVGProps) { const tintColorProp = fill ? {tintColor: fill} : {}; const isReactComponent = typeof src === 'function'; @@ -40,12 +41,13 @@ function ImageSVG({src, width = '100%', height = '100%', fill, contentFit = 'cov return ( ); } diff --git a/src/components/ImageSVG/types.ts b/src/components/ImageSVG/types.ts index 3d387d00651c..3da13542bafd 100644 --- a/src/components/ImageSVG/types.ts +++ b/src/components/ImageSVG/types.ts @@ -1,10 +1,8 @@ -import type {ImageContentFit, ImageProps, ImageStyle} from 'expo-image'; +import type {ImageContentFit, ImageStyle} from 'expo-image'; import type {StyleProp, ViewStyle} from 'react-native'; import type IconAsset from '@src/types/utils/IconAsset'; type ImageSVGProps = { - /** The image cache policy */ - cachePolicy?: ImageProps['cachePolicy']; /** The asset to render. */ src: IconAsset | undefined; diff --git a/src/components/InteractiveStepSubHeader.tsx b/src/components/InteractiveStepSubHeader.tsx index 387eb031a73f..de38723de3ba 100644 --- a/src/components/InteractiveStepSubHeader.tsx +++ b/src/components/InteractiveStepSubHeader.tsx @@ -2,6 +2,7 @@ import type {ForwardedRef} from 'react'; import React, {useImperativeHandle, useState} from 'react'; import type {ViewStyle} from 'react-native'; import {View} from 'react-native'; +import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import colors from '@styles/theme/colors'; import variables from '@styles/variables'; @@ -41,6 +42,7 @@ const MIN_AMOUNT_OF_STEPS = 2; function InteractiveStepSubHeader({stepNames, startStepIndex = 0, onStepSelected, ref}: InteractiveStepSubHeaderProps) { const styles = useThemeStyles(); + const {translate} = useLocalize(); const containerWidthStyle: ViewStyle = stepNames.length < MIN_AMOUNT_FOR_EXPANDING ? styles.mnw60 : styles.mnw100; if (stepNames.length < MIN_AMOUNT_OF_STEPS) { @@ -67,7 +69,11 @@ function InteractiveStepSubHeader({stepNames, startStepIndex = 0, onStepSelected const amountOfUnions = stepNames.length - 1; return ( - + {stepNames.map((stepName, index) => { const isCompletedStep = currentStep > index; const isLockedStep = currentStep < index; @@ -99,10 +105,10 @@ function InteractiveStepSubHeader({stepNames, startStepIndex = 0, onStepSelected ]} disabled={isLockedStep || !onStepSelected} onPress={moveToStep} - accessible - accessibilityLabel={`${index + 1}`} - aria-current={currentStep === index ? 'step' : undefined} + accessible={false} + aria-hidden role={CONST.ROLE.BUTTON} + sentryLabel={CONST.SENTRY_LABEL.INTERACTIVE_STEP_SUB_HEADER.STEP_BUTTON} > {isCompletedStep ? ( getAddExpenseDropdownOptions(translate, expensifyIcons, moneyRequestReport?.reportID, policy, undefined, undefined, lastDistanceExpenseType), - [moneyRequestReport?.reportID, policy, lastDistanceExpenseType, expensifyIcons, translate], + () => + getAddExpenseDropdownOptions(translate, expensifyIcons, moneyRequestReport?.reportID, policy, userBillingGraceEndPeriodCollection, undefined, undefined, lastDistanceExpenseType), + [moneyRequestReport?.reportID, policy, userBillingGraceEndPeriodCollection, lastDistanceExpenseType, expensifyIcons, translate], ); const exportSubmenuOptions: Record> = useMemo(() => { @@ -1244,7 +1246,7 @@ function MoneyReportHeader({ [CONST.REPORT.SECONDARY_ACTIONS.DOWNLOAD_PDF]: { value: CONST.REPORT.SECONDARY_ACTIONS.DOWNLOAD_PDF, text: translate('common.downloadAsPDF'), - icon: expensifyIcons.Document, + icon: expensifyIcons.Download, sentryLabel: CONST.SENTRY_LABEL.MORE_MENU.DOWNLOAD_PDF, onSelected: () => { if (!moneyRequestReport) { @@ -1402,7 +1404,7 @@ function MoneyReportHeader({ value: CONST.REPORT.SECONDARY_ACTIONS.DUPLICATE, onSelected: () => { if (hasCustomUnitOutOfPolicyViolation) { - setDuplicateDistanceErrorModalVisible(true); + setRateErrorModalVisible(true); return; } @@ -1591,7 +1593,7 @@ function MoneyReportHeader({ if (!moneyRequestReport?.reportID) { return; } - if (policy && shouldRestrictUserBillableActions(policy.id)) { + if (policy && shouldRestrictUserBillableActions(policy.id, userBillingGraceEndPeriodCollection)) { Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(policy.id)); return; } @@ -1894,11 +1896,11 @@ function MoneyReportHeader({ /> setDuplicateDistanceErrorModalVisible(false)} - onCancel={() => setDuplicateDistanceErrorModalVisible(false)} + isVisible={rateErrorModalVisible} + onConfirm={() => setRateErrorModalVisible(false)} + onCancel={() => setRateErrorModalVisible(false)} confirmText={translate('common.buttonConfirm')} - prompt={translate('iou.correctDistanceRateError')} + prompt={translate('iou.correctRateError')} shouldShowCancelButton={false} /> | null>(null); - const [duplicateDistanceErrorModalVisible, setDuplicateDistanceErrorModalVisible] = useState(false); + const [rateErrorModalVisible, setRateErrorModalVisible] = useState(false); const [duplicatePerDiemErrorModalVisible, setDuplicatePerDiemErrorModalVisible] = useState(false); const [isDuplicateActive, temporarilyDisableDuplicateAction] = useThrottledButtonState(); const [dismissedRejectUseExplanation] = useOnyx(ONYXKEYS.NVP_DISMISSED_REJECT_USE_EXPLANATION, {canBeMissing: true}); @@ -457,7 +457,7 @@ function MoneyRequestHeader({report, parentReportAction, policy, onBackButtonPre value: CONST.REPORT.SECONDARY_ACTIONS.DUPLICATE, onSelected: () => { if (hasCustomUnitOutOfPolicyViolation) { - setDuplicateDistanceErrorModalVisible(true); + setRateErrorModalVisible(true); return; } @@ -638,11 +638,11 @@ function MoneyRequestHeader({report, parentReportAction, policy, onBackButtonPre /> setDuplicateDistanceErrorModalVisible(false)} - onCancel={() => setDuplicateDistanceErrorModalVisible(false)} + isVisible={rateErrorModalVisible} + onConfirm={() => setRateErrorModalVisible(false)} + onCancel={() => setRateErrorModalVisible(false)} confirmText={translate('common.buttonConfirm')} - prompt={translate('iou.correctDistanceRateError')} + prompt={translate('iou.correctRateError')} shouldShowCancelButton={false} /> transactions.filter((t) => !isTransactionPendingDelete(t)), [transactions]); const mostRecentIOUReportActionID = useMemo(() => getMostRecentIOURequestActionID(reportActions), [reportActions]); + // reportActions is passed as an array because it's sorted chronologically for FlatList rendering and pagination. + // However, getOriginalReportID expects the Onyx object format (keyed by reportActionID) for efficient lookups. + const reportActionsObject = useMemo(() => { + const obj: OnyxTypes.ReportActions = {}; + for (const action of reportActions) { + obj[action.reportActionID] = action; + } + return obj; + }, [reportActions]); const transactionThreadReportID = getOneTransactionThreadReportID(report, chatReport, reportActions ?? [], false, reportTransactionIDs); const firstVisibleReportActionID = useMemo(() => getFirstVisibleReportActionID(reportActions, isOffline), [reportActions, isOffline]); const [transactionThreadReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${transactionThreadReportID}`, {canBeMissing: true}); @@ -558,7 +567,7 @@ function MoneyRequestReportActionsList({ hasNextActionMadeBySameActor(visibleReportActions, index); const actionEmojiReactions = emojiReactions?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS_REACTIONS}${reportAction.reportActionID}`]; - const originalReportID = getOriginalReportID(report.reportID, reportAction, undefined); + const originalReportID = getOriginalReportID(report.reportID, reportAction, reportActionsObject); const reportDraftMessages = draftMessage?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS_DRAFTS}${originalReportID}`]; const matchingDraftMessage = reportDraftMessages?.[reportAction.reportActionID]; const matchingDraftMessageString = matchingDraftMessage?.message; @@ -595,6 +604,7 @@ function MoneyRequestReportActionsList({ }, [ visibleReportActions, + reportActionsObject, parentReportAction, report, transactionThreadReport, diff --git a/src/components/MoneyRequestReportView/MoneyRequestReportTransactionList.tsx b/src/components/MoneyRequestReportView/MoneyRequestReportTransactionList.tsx index 020ab602c31e..d9a5630927f7 100644 --- a/src/components/MoneyRequestReportView/MoneyRequestReportTransactionList.tsx +++ b/src/components/MoneyRequestReportView/MoneyRequestReportTransactionList.tsx @@ -192,14 +192,15 @@ function MoneyRequestReportTransactionList({ const currentUserDetails = useCurrentUserPersonalDetails(); const isReportArchived = useReportIsArchived(report?.reportID); const shouldShowAddExpenseButton = canAddTransaction(report, isReportArchived) && isCurrentUserSubmitter(report); + const [userBillingGraceEndPeriodCollection] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END, {canBeMissing: true}); const [lastDistanceExpenseType] = useOnyx(ONYXKEYS.NVP_LAST_DISTANCE_EXPENSE_TYPE, {canBeMissing: true}); const [reportLayoutGroupBy] = useOnyx(ONYXKEYS.NVP_REPORT_LAYOUT_GROUP_BY, {canBeMissing: true}); const shouldShowGroupedTransactions = isExpenseReport(report) && !isIOUReport(report); const addExpenseDropdownOptions = useMemo( - () => getAddExpenseDropdownOptions(translate, expensifyIcons, report?.reportID, policy, undefined, undefined, lastDistanceExpenseType), - [translate, expensifyIcons, report?.reportID, policy, lastDistanceExpenseType], + () => getAddExpenseDropdownOptions(translate, expensifyIcons, report?.reportID, policy, userBillingGraceEndPeriodCollection, undefined, undefined, lastDistanceExpenseType), + [translate, expensifyIcons, report?.reportID, policy, userBillingGraceEndPeriodCollection, lastDistanceExpenseType], ); const hasPendingAction = useMemo(() => { diff --git a/src/components/MoneyRequestReportView/SearchMoneyRequestReportEmptyState.tsx b/src/components/MoneyRequestReportView/SearchMoneyRequestReportEmptyState.tsx index 639066bbf326..596e53dd8bb2 100644 --- a/src/components/MoneyRequestReportView/SearchMoneyRequestReportEmptyState.tsx +++ b/src/components/MoneyRequestReportView/SearchMoneyRequestReportEmptyState.tsx @@ -22,6 +22,7 @@ import type * as OnyxTypes from '@src/types/onyx'; const minModalHeight = 380; function SearchMoneyRequestReportEmptyState({report, policy}: {report: OnyxTypes.Report; policy?: OnyxTypes.Policy}) { + const [userBillingGraceEndPeriodCollection] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END, {canBeMissing: true}); const [reportNameValuePairs] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report.reportID}`, {canBeMissing: true}); const {translate} = useLocalize(); const styles = useThemeStyles(); @@ -40,7 +41,7 @@ function SearchMoneyRequestReportEmptyState({report, policy}: {report: OnyxTypes if (!reportId) { return; } - if (policy && shouldRestrictUserBillableActions(policy.id)) { + if (policy && shouldRestrictUserBillableActions(policy.id, userBillingGraceEndPeriodCollection)) { Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(policy.id)); return; } @@ -55,7 +56,7 @@ function SearchMoneyRequestReportEmptyState({report, policy}: {report: OnyxTypes if (!reportId) { return; } - if (policy && shouldRestrictUserBillableActions(policy.id)) { + if (policy && shouldRestrictUserBillableActions(policy.id, userBillingGraceEndPeriodCollection)) { Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(policy.id)); return; } @@ -67,7 +68,7 @@ function SearchMoneyRequestReportEmptyState({report, policy}: {report: OnyxTypes text: translate('iou.addUnreportedExpense'), icon: icons.ReceiptPlus, onSelected: () => { - if (policy && shouldRestrictUserBillableActions(policy.id)) { + if (policy && shouldRestrictUserBillableActions(policy.id, userBillingGraceEndPeriodCollection)) { Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(policy.id)); return; } diff --git a/src/components/Navigation/DebugTabView.tsx b/src/components/Navigation/DebugTabView.tsx index 304dca6145c6..48e82ef7e169 100644 --- a/src/components/Navigation/DebugTabView.tsx +++ b/src/components/Navigation/DebugTabView.tsx @@ -80,10 +80,10 @@ function getSettingsRoute(status: IndicatorStatus | undefined, reimbursementAcco case CONST.INDICATOR_STATUS.HAS_POLICY_ERRORS: return ROUTES.WORKSPACE_INITIAL.getRoute(policyIDWithErrors); case CONST.INDICATOR_STATUS.HAS_REIMBURSEMENT_ACCOUNT_ERRORS: - return ROUTES.BANK_ACCOUNT_WITH_STEP_TO_OPEN.getRoute( - reimbursementAccount?.achData?.policyID, - getReimbursementAccountRouteForCurrentStep(reimbursementAccount?.achData?.currentStep ?? CONST.BANK_ACCOUNT.STEP.BANK_ACCOUNT), - ); + return ROUTES.BANK_ACCOUNT_WITH_STEP_TO_OPEN.getRoute({ + policyID: reimbursementAccount?.achData?.policyID, + stepToOpen: getReimbursementAccountRouteForCurrentStep(reimbursementAccount?.achData?.currentStep ?? CONST.BANK_ACCOUNT.STEP.BANK_ACCOUNT), + }); case CONST.INDICATOR_STATUS.HAS_SUBSCRIPTION_ERRORS: return ROUTES.SETTINGS_SUBSCRIPTION.route; case CONST.INDICATOR_STATUS.HAS_SUBSCRIPTION_INFO: diff --git a/src/components/Navigation/NavigationTabBar/index.tsx b/src/components/Navigation/NavigationTabBar/index.tsx index c08f4c974e90..300534324740 100644 --- a/src/components/Navigation/NavigationTabBar/index.tsx +++ b/src/components/Navigation/NavigationTabBar/index.tsx @@ -221,6 +221,7 @@ function NavigationTabBar({selectedTab, isTopLevelBar = false, shouldShowFloatin name: CONST.TELEMETRY.SPAN_NAVIGATE_TO_REPORTS_TAB, op: CONST.TELEMETRY.SPAN_NAVIGATE_TO_REPORTS_TAB, }); + parentSpan?.setAttribute(CONST.TELEMETRY.ATTRIBUTE_ROUTE_FROM, selectedTab ?? ''); startSpan(CONST.TELEMETRY.SPAN_ON_LAYOUT_SKELETON_REPORTS, { name: CONST.TELEMETRY.SPAN_ON_LAYOUT_SKELETON_REPORTS, diff --git a/src/components/NumberWithSymbolForm.tsx b/src/components/NumberWithSymbolForm.tsx index 37ec58a8d0a6..809d8c03e4a2 100644 --- a/src/components/NumberWithSymbolForm.tsx +++ b/src/components/NumberWithSymbolForm.tsx @@ -79,6 +79,9 @@ type NumberWithSymbolFormProps = { /** Whether to allow flipping amount */ allowFlippingAmount?: boolean; + /** Whether to allow direct negative input (for split amounts where value is already negative) */ + allowNegativeInput?: boolean; + /** Whether the input is disabled or not */ disabled?: boolean; @@ -144,6 +147,7 @@ function NumberWithSymbolForm({ shouldWrapInputInContainer = true, isNegative = false, allowFlippingAmount = false, + allowNegativeInput = false, toggleNegative, clearNegative, ref, @@ -218,11 +222,13 @@ function NumberWithSymbolForm({ const newNumberWithoutSpaces = stripSpacesFromAmount(newNumber); const rawFinalNumber = newNumberWithoutSpaces.includes('.') ? stripCommaFromAmount(newNumberWithoutSpaces) : replaceCommasWithPeriod(newNumberWithoutSpaces); - const finalNumber = handleNegativeAmountFlipping(rawFinalNumber, allowFlippingAmount, toggleNegative); + // When allowNegativeInput is true, keep negative sign as-is (for split amounts) + // When allowFlippingAmount is true, strip the negative sign and call toggleNegative + const finalNumber = allowNegativeInput ? rawFinalNumber : handleNegativeAmountFlipping(rawFinalNumber, allowFlippingAmount, toggleNegative); // Use a shallow copy of selection to trigger setSelection // More info: https://github.com/Expensify/App/issues/16385 - if (!validateAmount(finalNumber, decimals, maxLength)) { + if (!validateAmount(finalNumber, decimals, maxLength, allowNegativeInput)) { setSelection((prevSelection) => ({...prevSelection})); return; } @@ -242,7 +248,7 @@ function NumberWithSymbolForm({ }); onInputChange?.(strippedNumber); }, - [decimals, maxLength, onInputChange, allowFlippingAmount, toggleNegative], + [decimals, maxLength, onInputChange, allowFlippingAmount, toggleNegative, allowNegativeInput], ); /** @@ -253,11 +259,14 @@ function NumberWithSymbolForm({ // Remove spaces from the new number because Safari on iOS adds spaces when pasting a copied number // More info: https://github.com/Expensify/App/issues/16974 const newNumberWithoutSpaces = stripSpacesFromAmount(text); - const replacedCommasNumber = handleNegativeAmountFlipping(replaceCommasWithPeriod(newNumberWithoutSpaces), allowFlippingAmount, toggleNegative); + // When allowNegativeInput is true, keep negative sign as-is + const replacedCommasNumber = allowNegativeInput + ? replaceCommasWithPeriod(newNumberWithoutSpaces) + : handleNegativeAmountFlipping(replaceCommasWithPeriod(newNumberWithoutSpaces), allowFlippingAmount, toggleNegative); - const withLeadingZero = addLeadingZero(replacedCommasNumber); + const withLeadingZero = addLeadingZero(replacedCommasNumber, allowNegativeInput); - if (!validateAmount(withLeadingZero, decimals, maxLength)) { + if (!validateAmount(withLeadingZero, decimals, maxLength, allowNegativeInput)) { setSelection((prevSelection) => ({...prevSelection})); return; } @@ -280,7 +289,7 @@ function NumberWithSymbolForm({ // Modifies the number to match changed decimals. useEffect(() => { // If the number supports decimals, we can return - if (validateAmount(currentNumber, decimals, maxLength, allowFlippingAmount)) { + if (validateAmount(currentNumber, decimals, maxLength, allowNegativeInput || allowFlippingAmount)) { return; } @@ -305,14 +314,14 @@ function NumberWithSymbolForm({ if (currentNumber.length > 0) { const selectionStart = selection.start === selection.end ? selection.start - 1 : selection.start; const newNumber = `${currentNumber.substring(0, selectionStart)}${currentNumber.substring(selection.end)}`; - setNewNumber(addLeadingZero(newNumber)); + setNewNumber(addLeadingZero(newNumber, allowNegativeInput)); } return; } - const newNumber = addLeadingZero(`${currentNumber.substring(0, selection.start)}${key}${currentNumber.substring(selection.end)}`); + const newNumber = addLeadingZero(`${currentNumber.substring(0, selection.start)}${key}${currentNumber.substring(selection.end)}`, allowNegativeInput); setNewNumber(newNumber); }, - [currentNumber, selection.start, selection.end, shouldUpdateSelection, setNewNumber], + [currentNumber, selection.start, selection.end, shouldUpdateSelection, setNewNumber, allowNegativeInput], ); /** diff --git a/src/components/Pressable/GenericPressable/implementation/index.tsx b/src/components/Pressable/GenericPressable/implementation/index.tsx index 189f7d295fe3..08c219c1a2aa 100644 --- a/src/components/Pressable/GenericPressable/implementation/index.tsx +++ b/src/components/Pressable/GenericPressable/implementation/index.tsx @@ -10,6 +10,7 @@ function WebGenericPressable({focusable = true, ref, sentryLabel, ...props}: Pre ; + let errorSource: ValueOf; + + if (!isEmptyObject(reportCreationError)) { + errorType = CONST.TELEMETRY.EXPENSE_ERROR_TYPE.REPORT_CREATION_FAILED; + errorSource = CONST.TELEMETRY.EXPENSE_ERROR_SOURCE.REPORT_CREATION; + } else if (parentReportAction?.errors && !isEmptyObject(parentReportAction.errors)) { + errorType = CONST.TELEMETRY.EXPENSE_ERROR_TYPE.TRANSACTION_MISSING; + errorSource = CONST.TELEMETRY.EXPENSE_ERROR_SOURCE.REPORT_ACTION; + } else { + errorType = CONST.TELEMETRY.EXPENSE_ERROR_TYPE.TRANSACTION_MISSING; + errorSource = CONST.TELEMETRY.EXPENSE_ERROR_SOURCE.TRANSACTION; + } + + const errorValue = Object.values(errors).at(0); + const errorMessage = typeof errorValue === 'string' ? errorValue : JSON.stringify(errorValue); + const isRequestPending = transaction?.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD; + const isTransactionMissing = !transaction?.transactionID && !!linkedTransactionID; + + trackExpenseCreationError(null, { + errorType, + errorSource, + reportID: report.reportID, + transactionID: linkedTransactionID, + hasReceipt, + pendingAction: transaction?.pendingAction, + iouType, + errorMessage, + isRequestPending, + isTransactionMissing, + }); + } if (transaction?.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD) { if (chatReport?.reportID && getCreationReportErrors(chatReport)) { navigateToConciergeChatAndDeleteReport(chatReport.reportID, conciergeReportID, true, true); diff --git a/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx b/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx index d62d0eedf913..f390923e6f31 100644 --- a/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx +++ b/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx @@ -1,6 +1,8 @@ +import {FlashList} from '@shopify/flash-list'; +import type {FlashListRef, ListRenderItemInfo} from '@shopify/flash-list'; import React, {useCallback, useContext, useDeferredValue, useEffect, useMemo, useRef, useState} from 'react'; -import {FlatList, View} from 'react-native'; -import type {ListRenderItemInfo, ViewToken} from 'react-native'; +import {View} from 'react-native'; +import type {ViewToken} from 'react-native'; import type {OnyxEntry} from 'react-native-onyx'; import Animated, {useAnimatedStyle, useSharedValue, withDelay, withSpring, withTiming} from 'react-native-reanimated'; import ActivityIndicator from '@components/ActivityIndicator'; @@ -91,6 +93,13 @@ import AccessMoneyRequestReportPreviewPlaceHolder from './AccessMoneyRequestRepo import EmptyMoneyRequestReportPreview from './EmptyMoneyRequestReportPreview'; import type {MoneyRequestReportPreviewContentProps} from './types'; +const MAX_PREVIEWS_NUMBER = 10; + +const ITEM_LAYOUT_TYPE = { + PREVIEW: 'preview', + SHOW_MORE: 'showMore', +}; + const reportAttributesSelector = (c: OnyxEntry) => c?.reports; function MoneyRequestReportPreviewContent({ @@ -122,6 +131,7 @@ function MoneyRequestReportPreviewContent({ onPress, forwardedFSClass, }: MoneyRequestReportPreviewContentProps) { + const [userBillingGraceEndPeriodCollection] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END, {canBeMissing: true}); const [chatReportMetadata] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_METADATA}${chatReportID}`, {canBeMissing: true, allowStaleData: true}); const [iouReportMetadata] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_METADATA}${iouReportID}`, {canBeMissing: true}); const [activePolicyID] = useOnyx(ONYXKEYS.NVP_ACTIVE_POLICY_ID, {canBeMissing: true}); @@ -451,9 +461,9 @@ function MoneyRequestReportPreviewContent({ // value ensures that disabled state is applied instantly and not overridden by onViewableItemsChanged when scrolling // undefined makes arrow buttons react on currentIndex changes when scrolling manually const [optimisticIndex, setOptimisticIndex] = useState(undefined); - const carouselRef = useRef | null>(null); + const carouselRef = useRef | null>(null); const visibleItemsOnEndCount = useMemo(() => { - const lastItemWidth = transactions.length > 10 ? footerWidth : reportPreviewStyles.transactionPreviewCarouselStyle.width; + const lastItemWidth = transactions.length > MAX_PREVIEWS_NUMBER ? footerWidth : reportPreviewStyles.transactionPreviewCarouselStyle.width; const lastItemWithGap = lastItemWidth + styles.gap2.gap; const itemWithGap = reportPreviewStyles.transactionPreviewCarouselStyle.width + styles.gap2.gap; return Math.floor((currentWidth - 2 * styles.pl2.paddingLeft - lastItemWithGap) / itemWithGap) + 1; @@ -471,30 +481,38 @@ function MoneyRequestReportPreviewContent({ setCurrentVisibleItems(viewableItemsIndexes); }).current; + const snapOffsets = carouselTransactions.map((_, index) => index * (reportPreviewStyles.transactionPreviewCarouselStyle.width + styles.transactionsCarouselGap.width)); + const handleChange = (index: number) => { if (index > carouselTransactions.length - visibleItemsOnEndCount) { - setOptimisticIndex(carouselTransactions.length - visibleItemsOnEndCount); - carouselRef.current?.scrollToIndex({index: carouselTransactions.length - visibleItemsOnEndCount, animated: true, viewOffset: 2 * styles.gap2.gap}); + const lastScrollableIndex = carouselTransactions.length - visibleItemsOnEndCount; + setOptimisticIndex(lastScrollableIndex); + carouselRef.current?.scrollToOffset({offset: snapOffsets.at(lastScrollableIndex) ?? 0, animated: true}); return; } if (index < 0) { setOptimisticIndex(0); - carouselRef.current?.scrollToIndex({index: 0, animated: true, viewOffset: 2 * styles.gap2.gap}); + carouselRef.current?.scrollToTop({animated: true}); + return; + } + if (index === carouselTransactions.length - visibleItemsOnEndCount) { + setOptimisticIndex(index); + carouselRef.current?.scrollToEnd({animated: true}); return; } setOptimisticIndex(index); - carouselRef.current?.scrollToIndex({index, animated: true, viewOffset: 2 * styles.gap2.gap}); + carouselRef.current?.scrollToOffset({offset: snapOffsets.at(index) ?? 0, animated: true}); }; - const renderFlatlistItem = (itemInfo: ListRenderItemInfo) => { - if (itemInfo.index > 9) { + const renderItem = (itemInfo: ListRenderItemInfo) => { + if (itemInfo.index > MAX_PREVIEWS_NUMBER - 1) { return ( setFooterWidth(e.nativeEvent.layout.width)} > - +{transactions.length - 10} {translate('common.more').toLowerCase()} + +{transactions.length - MAX_PREVIEWS_NUMBER} {translate('common.more').toLowerCase()} ); @@ -578,8 +596,18 @@ function MoneyRequestReportPreviewContent({ ]); const addExpenseDropdownOptions = useMemo( - () => getAddExpenseDropdownOptions(translate, expensifyIcons, iouReport?.reportID, policy, chatReportID, iouReport?.parentReportID, lastDistanceExpenseType), - [translate, expensifyIcons, iouReport?.reportID, iouReport?.parentReportID, policy, chatReportID, lastDistanceExpenseType], + () => + getAddExpenseDropdownOptions( + translate, + expensifyIcons, + iouReport?.reportID, + policy, + userBillingGraceEndPeriodCollection, + chatReportID, + iouReport?.parentReportID, + lastDistanceExpenseType, + ), + [translate, expensifyIcons, iouReport?.reportID, iouReport?.parentReportID, policy, userBillingGraceEndPeriodCollection, chatReportID, lastDistanceExpenseType], ); const isReportDeleted = action?.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE; @@ -693,6 +721,12 @@ function MoneyRequestReportPreviewContent({ carouselRef.current?.scrollToEnd(); }, [carouselTransactions.length]); + const renderSeparator = () => ; + + const getItemType = (_item: Transaction, index: number) => { + return index === MAX_PREVIEWS_NUMBER ? ITEM_LAYOUT_TYPE.SHOW_MORE : ITEM_LAYOUT_TYPE.PREVIEW; + }; + return ( ) : ( - - + `${item.transactionID}_${reportPreviewStyles.transactionPreviewCarouselStyle.width}`} - contentContainerStyle={[styles.gap2]} + contentContainerStyle={styles.ph2} style={reportPreviewStyles.flatListStyle} showsHorizontalScrollIndicator={false} - renderItem={renderFlatlistItem} + renderItem={renderItem} + getItemType={getItemType} onViewableItemsChanged={onViewableItemsChanged} onEndReached={adjustScroll} viewabilityConfig={viewabilityConfig} ListFooterComponent={} ListHeaderComponent={} + drawDistance={1000} /> {shouldShowAccessPlaceHolder && } {shouldShowEmptyPlaceholder && !shouldShowAccessPlaceHolder && } diff --git a/src/components/ReportActionItem/MoneyRequestReportPreview/index.tsx b/src/components/ReportActionItem/MoneyRequestReportPreview/index.tsx index d2ed348d977d..8e60d87023e9 100644 --- a/src/components/ReportActionItem/MoneyRequestReportPreview/index.tsx +++ b/src/components/ReportActionItem/MoneyRequestReportPreview/index.tsx @@ -1,5 +1,6 @@ +import type {ListRenderItem} from '@shopify/flash-list'; import React, {useCallback, useMemo, useRef, useState} from 'react'; -import type {LayoutChangeEvent, ListRenderItem} from 'react-native'; +import type {LayoutChangeEvent} from 'react-native'; import {usePersonalDetails} from '@components/OnyxListItemProvider'; import TransactionPreview from '@components/ReportActionItem/TransactionPreview'; import usePolicy from '@hooks/usePolicy'; diff --git a/src/components/ReportActionItem/MoneyRequestReportPreview/types.ts b/src/components/ReportActionItem/MoneyRequestReportPreview/types.ts index 56eb8b73a0c6..f5b2174088c1 100644 --- a/src/components/ReportActionItem/MoneyRequestReportPreview/types.ts +++ b/src/components/ReportActionItem/MoneyRequestReportPreview/types.ts @@ -1,4 +1,5 @@ -import type {LayoutChangeEvent, ListRenderItem, StyleProp, ViewStyle} from 'react-native'; +import type {ListRenderItem} from '@shopify/flash-list'; +import type {LayoutChangeEvent, StyleProp, ViewStyle} from 'react-native'; import type {OnyxCollection, OnyxEntry} from 'react-native-onyx'; import type {TransactionPreviewStyleType} from '@components/ReportActionItem/TransactionPreview/types'; import type {ForwardedFSClassProps} from '@libs/Fullstory/types'; diff --git a/src/components/ReportActionItem/ReportActionItemImages.tsx b/src/components/ReportActionItem/ReportActionItemImages.tsx index 00c10e3aec15..4d1609fbe89e 100644 --- a/src/components/ReportActionItem/ReportActionItemImages.tsx +++ b/src/components/ReportActionItem/ReportActionItemImages.tsx @@ -1,4 +1,5 @@ /* eslint-disable react/no-array-index-key */ +import {useMappingHelper} from '@shopify/flash-list'; import {Str} from 'expensify-common'; import React from 'react'; import {View} from 'react-native'; @@ -49,6 +50,7 @@ function ReportActionItemImages({images, size, total, isHovered = false, onPress const theme = useTheme(); const styles = useThemeStyles(); const StyleUtils = useStyleUtils(); + const {getMappingKey} = useMappingHelper(); // Calculate the number of images to be shown, limited by the value of 'size' (if defined) // or the total number of images. const numberOfShownImages = Math.min(size ?? images.length, images.length); @@ -79,9 +81,10 @@ function ReportActionItemImages({images, size, total, isHovered = false, onPress // Show a border to separate multiple images. Shown to the right for each except the last. const shouldShowBorder = shownImages.length > 1 && index < shownImages.length - 1; const borderStyle = shouldShowBorder ? styles.reportActionItemImageBorder : {}; + const key = getMappingKey(image ?? '', index); return ( diff --git a/src/components/ReportWelcomeText.tsx b/src/components/ReportWelcomeText.tsx index 69dcd5bad589..d4c29dc5f332 100644 --- a/src/components/ReportWelcomeText.tsx +++ b/src/components/ReportWelcomeText.tsx @@ -67,9 +67,10 @@ function ReportWelcomeText({report, policy}: ReportWelcomeTextProps) { const isSelfDM = isSelfDMReportUtils(report); const isInvoiceRoom = isInvoiceRoomReportUtils(report); const isSystemChat = isSystemChatReportUtils(report); + const [betas] = useOnyx(ONYXKEYS.BETAS, {canBeMissing: true}); const isDefault = !(isChatRoom || isPolicyExpenseChat || isSelfDM || isSystemChat); const participantAccountIDs = getParticipantsAccountIDsForDisplay(report, undefined, true, true, reportMetadata); - const moneyRequestOptions = temporary_getMoneyRequestOptions(report, policy, participantAccountIDs, isReportArchived, isRestrictedToPreferredPolicy); + const moneyRequestOptions = temporary_getMoneyRequestOptions(report, policy, participantAccountIDs, betas, isReportArchived, isRestrictedToPreferredPolicy); const policyName = getPolicyName({report}); const filteredOptions = moneyRequestOptions.filter( diff --git a/src/components/Rule/RuleSelectionBase.tsx b/src/components/Rule/RuleSelectionBase.tsx index 23074806ff78..fa0791fd72b3 100644 --- a/src/components/Rule/RuleSelectionBase.tsx +++ b/src/components/Rule/RuleSelectionBase.tsx @@ -18,6 +18,9 @@ type RuleSelectionBaseProps = { /** The translation key for the page title */ titleKey: TranslationPaths; + /** The translated page title */ + title?: string; + /** Test ID for the screen wrapper */ testID: string; @@ -40,7 +43,7 @@ type RuleSelectionBaseProps = { hash?: string; }; -function RuleSelectionBase({titleKey, testID, selectedItem, items, onSave, onBack, backToRoute, hash}: RuleSelectionBaseProps) { +function RuleSelectionBase({titleKey, title, testID, selectedItem, items, onSave, onBack, backToRoute, hash}: RuleSelectionBaseProps) { const styles = useThemeStyles(); const {translate} = useLocalize(); @@ -52,7 +55,7 @@ function RuleSelectionBase({titleKey, testID, selectedItem, items, onSave, onBac shouldEnableMaxHeight > diff --git a/src/components/Search/FilterDropdowns/DateSelectPopup.tsx b/src/components/Search/FilterDropdowns/DateSelectPopup.tsx index 37de2770526b..626c381eba5a 100644 --- a/src/components/Search/FilterDropdowns/DateSelectPopup.tsx +++ b/src/components/Search/FilterDropdowns/DateSelectPopup.tsx @@ -100,6 +100,7 @@ function DateSelectPopup({label, value, presets, closeOverlay, onChange}: DateSe style={[styles.flex1]} text={translate('common.reset')} onPress={resetChanges} + sentryLabel={CONST.SENTRY_LABEL.SEARCH.FILTER_POPUP_RESET_DATE} />