diff --git a/src/components/MoneyReportHeader.tsx b/src/components/MoneyReportHeader.tsx index 39c27bbe33976..f2c7a67889808 100644 --- a/src/components/MoneyReportHeader.tsx +++ b/src/components/MoneyReportHeader.tsx @@ -1051,7 +1051,7 @@ function MoneyReportHeader({ icons: expensifyIcons, iouReportID: moneyRequestReport?.reportID, policy, - userBillingGraceEndPeriodCollection: userBillingGraceEndPeriods, + userBillingGraceEndPeriods, draftTransactionIDs, amountOwed, ownerBillingGraceEndPeriod, diff --git a/src/components/MoneyRequestReportView/MoneyRequestReportTransactionList.tsx b/src/components/MoneyRequestReportView/MoneyRequestReportTransactionList.tsx index 6dec97fb10a21..1239c32f21e84 100644 --- a/src/components/MoneyRequestReportView/MoneyRequestReportTransactionList.tsx +++ b/src/components/MoneyRequestReportView/MoneyRequestReportTransactionList.tsx @@ -189,7 +189,7 @@ 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); + const [userBillingGraceEndPeriods] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END); const [ownerBillingGraceEndPeriod] = useOnyx(ONYXKEYS.NVP_PRIVATE_OWNER_BILLING_GRACE_PERIOD_END); const [lastDistanceExpenseType] = useOnyx(ONYXKEYS.NVP_LAST_DISTANCE_EXPENSE_TYPE); const [reportLayoutGroupBy] = useOnyx(ONYXKEYS.NVP_REPORT_LAYOUT_GROUP_BY); @@ -207,13 +207,13 @@ function MoneyRequestReportTransactionList({ icons: expensifyIcons, iouReportID: report?.reportID, policy, - userBillingGraceEndPeriodCollection, + userBillingGraceEndPeriods, draftTransactionIDs, amountOwed, ownerBillingGraceEndPeriod, lastDistanceExpenseType, }), - [translate, expensifyIcons, report?.reportID, policy, userBillingGraceEndPeriodCollection, amountOwed, lastDistanceExpenseType, ownerBillingGraceEndPeriod, draftTransactionIDs], + [translate, expensifyIcons, report?.reportID, policy, userBillingGraceEndPeriods, amountOwed, lastDistanceExpenseType, ownerBillingGraceEndPeriod, draftTransactionIDs], ); const hasPendingAction = useMemo(() => { diff --git a/src/components/MoneyRequestReportView/SearchMoneyRequestReportEmptyState.tsx b/src/components/MoneyRequestReportView/SearchMoneyRequestReportEmptyState.tsx index 411ca65ceef0a..9b6089bd04318 100644 --- a/src/components/MoneyRequestReportView/SearchMoneyRequestReportEmptyState.tsx +++ b/src/components/MoneyRequestReportView/SearchMoneyRequestReportEmptyState.tsx @@ -21,7 +21,7 @@ import type * as OnyxTypes from '@src/types/onyx'; const minModalHeight = 380; function SearchMoneyRequestReportEmptyState({report, policy, onLayout}: {report: OnyxTypes.Report; policy?: OnyxTypes.Policy; onLayout?: (event: LayoutChangeEvent) => void}) { - const [userBillingGraceEndPeriodCollection] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END); + const [userBillingGraceEndPeriods] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END); const [ownerBillingGraceEndPeriod] = useOnyx(ONYXKEYS.NVP_PRIVATE_OWNER_BILLING_GRACE_PERIOD_END); const [reportNameValuePairs] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report.reportID}`); const {translate} = useLocalize(); @@ -43,7 +43,7 @@ function SearchMoneyRequestReportEmptyState({report, policy, onLayout}: {report: if (!reportId) { return; } - if (policy && shouldRestrictUserBillableActions(policy.id, userBillingGraceEndPeriodCollection, undefined, ownerBillingGraceEndPeriod)) { + if (policy && shouldRestrictUserBillableActions(policy.id, userBillingGraceEndPeriods, undefined, ownerBillingGraceEndPeriod)) { Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(policy.id)); return; } @@ -58,7 +58,7 @@ function SearchMoneyRequestReportEmptyState({report, policy, onLayout}: {report: if (!reportId) { return; } - if (policy && shouldRestrictUserBillableActions(policy.id, userBillingGraceEndPeriodCollection, undefined, ownerBillingGraceEndPeriod)) { + if (policy && shouldRestrictUserBillableActions(policy.id, userBillingGraceEndPeriods, undefined, ownerBillingGraceEndPeriod)) { Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(policy.id)); return; } @@ -70,7 +70,7 @@ function SearchMoneyRequestReportEmptyState({report, policy, onLayout}: {report: text: translate('iou.addUnreportedExpense'), icon: icons.ReceiptPlus, onSelected: () => { - if (policy && shouldRestrictUserBillableActions(policy.id, userBillingGraceEndPeriodCollection, undefined, ownerBillingGraceEndPeriod)) { + if (policy && shouldRestrictUserBillableActions(policy.id, userBillingGraceEndPeriods, undefined, ownerBillingGraceEndPeriod)) { Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(policy.id)); return; } diff --git a/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx b/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx index 0a6f33c5630c6..c6ca35b4f9150 100644 --- a/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx +++ b/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx @@ -717,7 +717,7 @@ function MoneyRequestReportPreviewContent({ icons: expensifyIcons, iouReportID: iouReport?.reportID, policy, - userBillingGraceEndPeriodCollection: userBillingGraceEndPeriods, + userBillingGraceEndPeriods, draftTransactionIDs, amountOwed, ownerBillingGraceEndPeriod, diff --git a/src/components/Search/SearchPageHeader/SearchFiltersBarCreateButton.tsx b/src/components/Search/SearchPageHeader/SearchFiltersBarCreateButton.tsx index e9a6152e480b9..2ca9bded7a574 100644 --- a/src/components/Search/SearchPageHeader/SearchFiltersBarCreateButton.tsx +++ b/src/components/Search/SearchPageHeader/SearchFiltersBarCreateButton.tsx @@ -59,6 +59,7 @@ function SearchFiltersBarCreateButton() { const [activePolicyID] = useOnyx(ONYXKEYS.NVP_ACTIVE_POLICY_ID); const [activePolicy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${activePolicyID}`); const [ownerBillingGraceEndPeriod] = useOnyx(ONYXKEYS.NVP_PRIVATE_OWNER_BILLING_GRACE_PERIOD_END); + const [userBillingGraceEndPeriods] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END); const {policyForMovingExpensesID, shouldSelectPolicy} = usePolicyForMovingExpenses(); const shouldNavigateToUpgradePath = !policyForMovingExpensesID && !shouldSelectPolicy; const {showConfirmModal} = useConfirmModal(); @@ -184,14 +185,15 @@ function SearchFiltersBarCreateButton() { // No default or restricted with multiple workspaces → workspace selector if ( !workspaceIDForReportCreation || - (shouldRestrictUserBillableActions(workspaceIDForReportCreation, undefined, undefined, ownerBillingGraceEndPeriod) && groupPoliciesWithChatEnabled.length > 1) + (shouldRestrictUserBillableActions(workspaceIDForReportCreation, userBillingGraceEndPeriods, undefined, ownerBillingGraceEndPeriod) && + groupPoliciesWithChatEnabled.length > 1) ) { Navigation.navigate(ROUTES.NEW_REPORT_WORKSPACE_SELECTION.getRoute()); return; } // Default workspace is not restricted → create report directly - if (!shouldRestrictUserBillableActions(workspaceIDForReportCreation, undefined, undefined, ownerBillingGraceEndPeriod)) { + if (!shouldRestrictUserBillableActions(workspaceIDForReportCreation, userBillingGraceEndPeriods, undefined, ownerBillingGraceEndPeriod)) { // Check if empty report confirmation should be shown if (shouldShowEmptyReportConfirmationForDefaultChatEnabledPolicy) { openCreateReportConfirmation(); @@ -215,6 +217,8 @@ function SearchFiltersBarCreateButton() { groupPoliciesWithChatEnabled.length, defaultChatEnabledPolicyID, shouldShowEmptyReportConfirmationForDefaultChatEnabledPolicy, + ownerBillingGraceEndPeriod, + userBillingGraceEndPeriods, openCreateReportConfirmation, handleCreateWorkspaceReport, ], diff --git a/src/components/SelectionListWithSections/Search/ExpenseReportListItem.tsx b/src/components/SelectionListWithSections/Search/ExpenseReportListItem.tsx index b3b44b0286e0b..106453b5b9338 100644 --- a/src/components/SelectionListWithSections/Search/ExpenseReportListItem.tsx +++ b/src/components/SelectionListWithSections/Search/ExpenseReportListItem.tsx @@ -54,6 +54,7 @@ function ExpenseReportListItem({ const {translate} = useLocalize(); const {isLargeScreenWidth} = useResponsiveLayout(); const {currentSearchHash, currentSearchKey, currentSearchResults} = useSearchStateContext(); + const [userBillingGraceEndPeriods] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END); const [isActionLoading] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_METADATA}${reportItem.reportID}`, {selector: isActionLoadingSelector}); const expensifyIcons = useMemoizedLazyExpensifyIcons(['DotIndicator']); const currentUserDetails = useCurrentUserPersonalDetails(); @@ -129,6 +130,7 @@ function ExpenseReportListItem({ snapshotReport, snapshotPolicy, lastPaymentMethod, + userBillingGraceEndPeriods, currentSearchKey, onDEWModalOpen, isDEWBetaEnabled, @@ -143,6 +145,7 @@ function ExpenseReportListItem({ snapshotReport, snapshotPolicy, lastPaymentMethod, + userBillingGraceEndPeriods, personalPolicyID, currentSearchKey, onDEWModalOpen, diff --git a/src/components/SelectionListWithSections/Search/ReportListItemHeader.tsx b/src/components/SelectionListWithSections/Search/ReportListItemHeader.tsx index f50152f645c7a..33d1927cf60d8 100644 --- a/src/components/SelectionListWithSections/Search/ReportListItemHeader.tsx +++ b/src/components/SelectionListWithSections/Search/ReportListItemHeader.tsx @@ -223,6 +223,7 @@ function ReportListItemHeader({ const theme = useTheme(); const {currentSearchHash, currentSearchKey, currentSearchResults: snapshot} = useSearchStateContext(); const {isLargeScreenWidth, shouldUseNarrowLayout} = useResponsiveLayout(); + const [userBillingGraceEndPeriods] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END); const thereIsFromAndTo = !!reportItem?.from && !!reportItem?.to; const showUserInfo = (reportItem.type === CONST.REPORT.TYPE.IOU && thereIsFromAndTo) || (reportItem.type === CONST.REPORT.TYPE.EXPENSE && !!reportItem?.from); const snapshotReport = useMemo(() => { @@ -245,6 +246,7 @@ function ReportListItemHeader({ snapshotReport, snapshotPolicy, lastPaymentMethod, + userBillingGraceEndPeriods, currentSearchKey, onDEWModalOpen, isDEWBetaEnabled, diff --git a/src/components/SelectionListWithSections/Search/TransactionListItem.tsx b/src/components/SelectionListWithSections/Search/TransactionListItem.tsx index cb7fa5715fc34..a66ddcae04897 100644 --- a/src/components/SelectionListWithSections/Search/TransactionListItem.tsx +++ b/src/components/SelectionListWithSections/Search/TransactionListItem.tsx @@ -61,6 +61,7 @@ function TransactionListItem({ const {currentSearchHash, currentSearchKey, currentSearchResults} = useSearchStateContext(); const snapshotReport = (currentSearchResults?.data?.[`${ONYXKEYS.COLLECTION.REPORT}${transactionItem.reportID}`] ?? {}) as Report; + const [userBillingGraceEndPeriods] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END); const [isActionLoading] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_METADATA}${transactionItem.reportID}`, {selector: isActionLoadingSelector}); // Use active policy (user's current workspace) as fallback for self DM tracking expenses @@ -158,6 +159,7 @@ function TransactionListItem({ snapshotReport, snapshotPolicy, lastPaymentMethod, + userBillingGraceEndPeriods, currentSearchKey, onDEWModalOpen, isDEWBetaEnabled, diff --git a/src/hooks/useSearchBulkActions.ts b/src/hooks/useSearchBulkActions.ts index 438b2ad50694c..282ed1a59cf6a 100644 --- a/src/hooks/useSearchBulkActions.ts +++ b/src/hooks/useSearchBulkActions.ts @@ -101,7 +101,7 @@ function useSearchBulkActions({queryJSON}: UseSearchBulkActionsParams) { const [transactions] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION); const [allTransactionViolations] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS); const personalPolicy = usePersonalPolicy(); - const [userBillingGraceEndPeriodCollection] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END); + const [userBillingGraceEndPeriods] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END); // Cache the last search results that had data, so the merge option remains available // while results are temporarily unset (e.g. during sorting/loading). @@ -379,7 +379,7 @@ function useSearchBulkActions({queryJSON}: UseSearchBulkActionsParams) { const selectedItems = selectedReports.length ? selectedReports : Object.values(selectedTransactions); - const restrictedPolicyID = getRestrictedPolicyID(selectedItems, userBillingGraceEndPeriodCollection); + const restrictedPolicyID = getRestrictedPolicyID(selectedItems, userBillingGraceEndPeriods); if (restrictedPolicyID) { Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(restrictedPolicyID)); return; @@ -428,7 +428,7 @@ function useSearchBulkActions({queryJSON}: UseSearchBulkActionsParams) { translate, hash, clearSelectedTransactions, - userBillingGraceEndPeriodCollection, + userBillingGraceEndPeriods, ]); const {expenseCount, uniqueReportCount} = useMemo(() => { @@ -557,7 +557,7 @@ function useSearchBulkActions({queryJSON}: UseSearchBulkActionsParams) { const selectedOptions = selectedReports.length ? selectedReports : Object.values(selectedTransactions); const expenseReportBankAccountID = additionalData?.bankAccountID; - const restrictedPolicyID = getRestrictedPolicyID(selectedOptions, userBillingGraceEndPeriodCollection); + const restrictedPolicyID = getRestrictedPolicyID(selectedOptions, userBillingGraceEndPeriods); if (restrictedPolicyID) { Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(restrictedPolicyID)); return; @@ -678,7 +678,7 @@ function useSearchBulkActions({queryJSON}: UseSearchBulkActionsParams) { personalPolicyID, allTransactions, allReports, - userBillingGraceEndPeriodCollection, + userBillingGraceEndPeriods, ], ); @@ -962,7 +962,7 @@ function useSearchBulkActions({queryJSON}: UseSearchBulkActionsParams) { const itemList = !selectedReports.length ? Object.values(selectedTransactions).map((transaction) => transaction) : (selectedReports?.filter((report) => !!report) ?? []); - const restrictedPolicyID = getRestrictedPolicyID(itemList, userBillingGraceEndPeriodCollection); + const restrictedPolicyID = getRestrictedPolicyID(itemList, userBillingGraceEndPeriods); if (restrictedPolicyID) { Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(restrictedPolicyID)); return; @@ -1222,7 +1222,7 @@ function useSearchBulkActions({queryJSON}: UseSearchBulkActionsParams) { styles.colorMuted, styles.fontWeightNormal, styles.textWrap, - userBillingGraceEndPeriodCollection, + userBillingGraceEndPeriods, currentSearchKey, ]); diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 910024b7f1cdc..8f3a64f7014c3 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -3001,7 +3001,7 @@ type GetAddExpenseDropdownOptionsParams = { icons: Record<'Location' | 'ReceiptPlus', IconAsset>; iouReportID: string | undefined; policy: OnyxEntry; - userBillingGraceEndPeriodCollection: OnyxCollection; + userBillingGraceEndPeriods: OnyxCollection; draftTransactionIDs: string[] | undefined; amountOwed: OnyxEntry; ownerBillingGraceEndPeriod: OnyxEntry; @@ -3015,7 +3015,7 @@ function getAddExpenseDropdownOptions({ icons, iouReportID, policy, - userBillingGraceEndPeriodCollection, + userBillingGraceEndPeriods, draftTransactionIDs, amountOwed, ownerBillingGraceEndPeriod, @@ -3036,7 +3036,7 @@ function getAddExpenseDropdownOptions({ if ( policy && policy.type !== CONST.POLICY.TYPE.PERSONAL && - shouldRestrictUserBillableActions(policy.id, userBillingGraceEndPeriodCollection, amountOwed, ownerBillingGraceEndPeriod) + shouldRestrictUserBillableActions(policy.id, userBillingGraceEndPeriods, amountOwed, ownerBillingGraceEndPeriod) ) { Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(policy.id)); return; @@ -3053,7 +3053,7 @@ function getAddExpenseDropdownOptions({ if (!iouReportID) { return; } - if (policy && shouldRestrictUserBillableActions(policy.id, userBillingGraceEndPeriodCollection, amountOwed, ownerBillingGraceEndPeriod)) { + if (policy && shouldRestrictUserBillableActions(policy.id, userBillingGraceEndPeriods, amountOwed, ownerBillingGraceEndPeriod)) { Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(policy.id)); return; } @@ -3066,7 +3066,7 @@ function getAddExpenseDropdownOptions({ icon: icons.ReceiptPlus, sentryLabel: CONST.SENTRY_LABEL.MORE_MENU.ADD_EXPENSE_UNREPORTED, onSelected: () => { - if (policy && shouldRestrictUserBillableActions(policy.id, userBillingGraceEndPeriodCollection, amountOwed, ownerBillingGraceEndPeriod)) { + if (policy && shouldRestrictUserBillableActions(policy.id, userBillingGraceEndPeriods, amountOwed, ownerBillingGraceEndPeriod)) { Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(policy.id)); return; } @@ -11223,7 +11223,7 @@ type CreateDraftTransactionParams = { introSelected: OnyxEntry; allTransactionDrafts: OnyxCollection; activePolicy: OnyxEntry; - userBillingGraceEndPeriodCollection: OnyxCollection; + userBillingGraceEndPeriods: OnyxCollection; amountOwed: OnyxEntry; isRestrictedToPreferredPolicy?: boolean; preferredPolicyID?: string; @@ -11237,7 +11237,7 @@ function createDraftTransactionAndNavigateToParticipantSelector({ introSelected, allTransactionDrafts, activePolicy, - userBillingGraceEndPeriodCollection, + userBillingGraceEndPeriods, amountOwed, isRestrictedToPreferredPolicy = false, preferredPolicyID, @@ -11304,7 +11304,7 @@ function createDraftTransactionAndNavigateToParticipantSelector({ } if (actionName === CONST.IOU.ACTION.CATEGORIZE) { - if (activePolicy && shouldRestrictUserBillableActions(activePolicy.id, userBillingGraceEndPeriodCollection, amountOwed)) { + if (activePolicy && shouldRestrictUserBillableActions(activePolicy.id, userBillingGraceEndPeriods, amountOwed)) { Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(activePolicy.id)); return; } diff --git a/src/libs/SubscriptionUtils.ts b/src/libs/SubscriptionUtils.ts index dc2e5f64b64a7..20631b82f6847 100644 --- a/src/libs/SubscriptionUtils.ts +++ b/src/libs/SubscriptionUtils.ts @@ -72,10 +72,10 @@ Onyx.connect({ callback: (value) => (ownerBillingGraceEndPeriodDeprecated = value), }); -let deprecatedUserBillingGraceEndPeriodCollection: OnyxCollection; +let deprecatedUserBillingGraceEndPeriods: OnyxCollection; Onyx.connect({ key: ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END, - callback: (value) => (deprecatedUserBillingGraceEndPeriodCollection = value), + callback: (value) => (deprecatedUserBillingGraceEndPeriods = value), waitForCollectionCallback: true, }); @@ -470,7 +470,7 @@ function doesUserHavePaymentCardAdded(userBillingFundID: number | undefined): bo */ function shouldRestrictUserBillableActions( policyID: string, - userBillingGraceEndPeriodCollection: OnyxCollection = deprecatedUserBillingGraceEndPeriodCollection, + userBillingGraceEndPeriods: OnyxCollection = deprecatedUserBillingGraceEndPeriods, amountOwed: OnyxEntry = privateAmountOwed, ownerBillingGraceEndPeriod: OnyxEntry = ownerBillingGraceEndPeriodDeprecated, ): boolean { @@ -481,7 +481,7 @@ function shouldRestrictUserBillableActions( // This logic will be executed if the user is a workspace's non-owner (normal user or admin). // We should restrict the workspace's non-owner actions if it's member of a workspace where the owner is // past due and is past its grace period end. - for (const userBillingGraceEndPeriodEntry of Object.entries(userBillingGraceEndPeriodCollection ?? {})) { + for (const userBillingGraceEndPeriodEntry of Object.entries(userBillingGraceEndPeriods ?? {})) { const [entryKey, userBillingGracePeriodEnd] = userBillingGraceEndPeriodEntry; if (userBillingGracePeriodEnd && isAfter(currentDate, fromUnixTime(userBillingGracePeriodEnd.value))) { diff --git a/src/libs/actions/Search.ts b/src/libs/actions/Search.ts index 7054ed988356a..1954fff98bdc1 100644 --- a/src/libs/actions/Search.ts +++ b/src/libs/actions/Search.ts @@ -96,6 +96,7 @@ type HandleActionButtonPressParams = { snapshotReport: Report; snapshotPolicy: Policy; lastPaymentMethod: OnyxEntry; + userBillingGraceEndPeriods: OnyxCollection; currentSearchKey?: SearchKey; onDEWModalOpen?: () => void; isDEWBetaEnabled?: boolean; @@ -127,6 +128,7 @@ function handleActionButtonPress({ snapshotReport, snapshotPolicy, lastPaymentMethod, + userBillingGraceEndPeriods, currentSearchKey, onDEWModalOpen, isDEWBetaEnabled, @@ -150,7 +152,7 @@ function handleActionButtonPress({ onDelegateAccessRestricted?.(); return; } - if (snapshotReport.policyID && shouldRestrictUserBillableActions(snapshotReport.policyID)) { + if (snapshotReport.policyID && shouldRestrictUserBillableActions(snapshotReport.policyID, userBillingGraceEndPeriods)) { Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(snapshotReport.policyID)); return; } @@ -161,7 +163,7 @@ function handleActionButtonPress({ onDelegateAccessRestricted?.(); return; } - if (snapshotReport.policyID && shouldRestrictUserBillableActions(snapshotReport.policyID)) { + if (snapshotReport.policyID && shouldRestrictUserBillableActions(snapshotReport.policyID, userBillingGraceEndPeriods)) { Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(snapshotReport.policyID)); return; } @@ -172,7 +174,7 @@ function handleActionButtonPress({ approveMoneyRequestOnSearch(hash, item.reportID ? [item.reportID] : [], currentSearchKey); return; case CONST.SEARCH.ACTION_TYPES.SUBMIT: { - if (snapshotReport.policyID && shouldRestrictUserBillableActions(snapshotReport.policyID)) { + if (snapshotReport.policyID && shouldRestrictUserBillableActions(snapshotReport.policyID, userBillingGraceEndPeriods)) { Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(snapshotReport.policyID)); return; } diff --git a/src/pages/AddUnreportedExpense.tsx b/src/pages/AddUnreportedExpense.tsx index 82c69fe40aaea..30d13bd9ea90c 100644 --- a/src/pages/AddUnreportedExpense.tsx +++ b/src/pages/AddUnreportedExpense.tsx @@ -59,6 +59,7 @@ function AddUnreportedExpense({route}: AddUnreportedExpensePageType) { const [cardList] = useOnyx(ONYXKEYS.CARD_LIST); const {accountID: currentUserAccountID} = useCurrentUserPersonalDetails(); const [ownerBillingGraceEndPeriod] = useOnyx(ONYXKEYS.NVP_PRIVATE_OWNER_BILLING_GRACE_PERIOD_END); + const [userBillingGraceEndPeriods] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END); const shouldShowUnreportedTransactionsSkeletons = isLoadingUnreportedTransactions && hasMoreUnreportedTransactionsResults && !isOffline; const [draftTransactionIDs] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_DRAFT, {selector: validTransactionDraftIDsSelector}); @@ -295,7 +296,7 @@ function AddUnreportedExpense({route}: AddUnreportedExpensePageType) { { buttonText: translate('iou.createExpense'), buttonAction: () => { - if (report && report.policyID && shouldRestrictUserBillableActions(report.policyID, undefined, undefined, ownerBillingGraceEndPeriod)) { + if (report && report.policyID && shouldRestrictUserBillableActions(report.policyID, userBillingGraceEndPeriods, undefined, ownerBillingGraceEndPeriod)) { Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(report.policyID)); return; } diff --git a/src/pages/NewReportWorkspaceSelectionPage.tsx b/src/pages/NewReportWorkspaceSelectionPage.tsx index a2ba28c70cea7..7f1d7d5d83ed2 100644 --- a/src/pages/NewReportWorkspaceSelectionPage.tsx +++ b/src/pages/NewReportWorkspaceSelectionPage.tsx @@ -71,6 +71,7 @@ function NewReportWorkspaceSelectionPage({route}: NewReportWorkspaceSelectionPag const [hasDismissedEmptyReportsConfirmation] = useOnyx(ONYXKEYS.NVP_EMPTY_REPORTS_CONFIRMATION_DISMISSED); const [betas] = useOnyx(ONYXKEYS.BETAS); const [ownerBillingGraceEndPeriod] = useOnyx(ONYXKEYS.NVP_PRIVATE_OWNER_BILLING_GRACE_PERIOD_END); + const [userBillingGracePeriods] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END); const [policies, fetchStatus] = useOnyx(ONYXKEYS.COLLECTION.POLICY); const [allTransactions] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION); const currentUserPersonalDetails = useCurrentUserPersonalDetails(); @@ -181,7 +182,7 @@ function NewReportWorkspaceSelectionPage({route}: NewReportWorkspaceSelectionPag return; } - if (shouldRestrictUserBillableActions(policy.policyID, undefined, undefined, ownerBillingGraceEndPeriod)) { + if (shouldRestrictUserBillableActions(policy.policyID, userBillingGracePeriods, undefined, ownerBillingGraceEndPeriod)) { Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(policy.policyID)); return; } diff --git a/src/pages/ReportDetailsPage.tsx b/src/pages/ReportDetailsPage.tsx index da4bb7a036755..34c67390d8299 100644 --- a/src/pages/ReportDetailsPage.tsx +++ b/src/pages/ReportDetailsPage.tsx @@ -164,7 +164,7 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail const expensifyIcons = useMemoizedLazyExpensifyIcons(['Users', 'Gear', 'Send', 'Folder', 'UserPlus', 'Pencil', 'Checkmark', 'Building', 'Exit', 'Bug', 'Camera', 'Trashcan']); const backTo = route.params.backTo; - const [userBillingGraceEndPeriodCollection] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END); + const [userBillingGraceEndPeriods] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END); const [amountOwed] = useOnyx(ONYXKEYS.NVP_PRIVATE_AMOUNT_OWED); const [parentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${report.parentReportID}`); const [chatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${report.chatReportID}`); @@ -460,7 +460,7 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail introSelected, allTransactionDrafts, activePolicy, - userBillingGraceEndPeriodCollection, + userBillingGraceEndPeriods, amountOwed, isRestrictedToPreferredPolicy, preferredPolicyID, @@ -483,7 +483,7 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail introSelected, allTransactionDrafts, activePolicy, - userBillingGraceEndPeriodCollection, + userBillingGraceEndPeriods, amountOwed, }); }, @@ -503,7 +503,7 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail introSelected, allTransactionDrafts, activePolicy, - userBillingGraceEndPeriodCollection, + userBillingGraceEndPeriods, amountOwed, }); }, @@ -631,7 +631,7 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail activePolicy, parentReport, reportActionsForOriginalReportID, - userBillingGraceEndPeriodCollection, + userBillingGraceEndPeriods, amountOwed, ]); diff --git a/src/pages/RestrictedAction/Workspace/WorkspaceRestrictedActionPage.tsx b/src/pages/RestrictedAction/Workspace/WorkspaceRestrictedActionPage.tsx index 4f29b0d65d038..3e4c457429c34 100644 --- a/src/pages/RestrictedAction/Workspace/WorkspaceRestrictedActionPage.tsx +++ b/src/pages/RestrictedAction/Workspace/WorkspaceRestrictedActionPage.tsx @@ -41,7 +41,7 @@ function WorkspaceRestrictedActionPage({ }, []); // Watch billing NVPs so the component re-renders when fresh data arrives from the server. - const [userBillingGracePeriodCollection] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END); + const [userBillingGracePeriods] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END); const [ownerBillingGraceEndPeriod] = useOnyx(ONYXKEYS.NVP_PRIVATE_OWNER_BILLING_GRACE_PERIOD_END); // Navigate back if the fresh server data shows the restriction no longer applies. @@ -49,10 +49,10 @@ function WorkspaceRestrictedActionPage({ if (isLoadingSubscriptionData !== false) { return; } - if (!shouldRestrictUserBillableActions(policyID, userBillingGracePeriodCollection, undefined, ownerBillingGraceEndPeriod)) { + if (!shouldRestrictUserBillableActions(policyID, userBillingGracePeriods, undefined, ownerBillingGraceEndPeriod)) { Navigation.goBack(); } - }, [policyID, isLoadingSubscriptionData, userBillingGracePeriodCollection, ownerBillingGraceEndPeriod]); + }, [policyID, isLoadingSubscriptionData, userBillingGracePeriods, ownerBillingGraceEndPeriod]); // Show a loading indicator while waiting for fresh billing data from the server, // instead of flashing the restriction UI which may no longer apply. diff --git a/src/pages/inbox/report/PureReportActionItem.tsx b/src/pages/inbox/report/PureReportActionItem.tsx index 54f9f9cf80706..0d676d5fec6d2 100644 --- a/src/pages/inbox/report/PureReportActionItem.tsx +++ b/src/pages/inbox/report/PureReportActionItem.tsx @@ -468,7 +468,7 @@ type PureReportActionItemProps = { reportMetadata?: OnyxEntry; /** The billing grace end period's shared NVP collection */ - userBillingGraceEndPeriodCollection: OnyxCollection; + userBillingGraceEndPeriods: OnyxCollection; }; // This is equivalent to returning a negative boolean in normal functions, but we can keep the element return type @@ -537,7 +537,7 @@ function PureReportActionItem({ reportNameValuePairsOrigin, reportNameValuePairsOriginalID, reportMetadata, - userBillingGraceEndPeriodCollection, + userBillingGraceEndPeriods, }: PureReportActionItemProps) { const isConciergeGreeting = action.reportActionID === CONST.CONCIERGE_GREETING_ACTION_ID; const shouldDisplayContextMenuValue = shouldDisplayContextMenu && !isConciergeGreeting; @@ -947,7 +947,7 @@ function PureReportActionItem({ introSelected, allTransactionDrafts, activePolicy, - userBillingGraceEndPeriodCollection, + userBillingGraceEndPeriods, amountOwed, isRestrictedToPreferredPolicy, preferredPolicyID, @@ -970,7 +970,7 @@ function PureReportActionItem({ introSelected, allTransactionDrafts, activePolicy, - userBillingGraceEndPeriodCollection, + userBillingGraceEndPeriods, amountOwed, }); }, @@ -987,7 +987,7 @@ function PureReportActionItem({ introSelected, allTransactionDrafts, activePolicy, - userBillingGraceEndPeriodCollection, + userBillingGraceEndPeriods, amountOwed, }); }, @@ -1133,7 +1133,7 @@ function PureReportActionItem({ report, originalReport, personalPolicyID, - userBillingGraceEndPeriodCollection, + userBillingGraceEndPeriods, amountOwed, ]); diff --git a/src/pages/inbox/report/ReportActionItem.tsx b/src/pages/inbox/report/ReportActionItem.tsx index a98f627bc2634..53fe3d6335935 100644 --- a/src/pages/inbox/report/ReportActionItem.tsx +++ b/src/pages/inbox/report/ReportActionItem.tsx @@ -39,7 +39,7 @@ import PureReportActionItem from './PureReportActionItem'; type ReportActionItemProps = Omit< PureReportActionItemProps, - 'taskReport' | 'linkedReport' | 'iouReportOfLinkedReport' | 'currentUserAccountID' | 'personalPolicyID' | 'allTransactionDrafts' | 'userBillingGraceEndPeriodCollection' + 'taskReport' | 'linkedReport' | 'iouReportOfLinkedReport' | 'currentUserAccountID' | 'personalPolicyID' | 'allTransactionDrafts' | 'userBillingGraceEndPeriods' > & { /** Whether to show the draft message or not */ shouldShowDraftMessage?: boolean; @@ -112,7 +112,7 @@ function ReportActionItem({ const [cardList] = useOnyx(ONYXKEYS.CARD_LIST); const [bankAccountList] = useOnyx(ONYXKEYS.BANK_ACCOUNT_LIST); const [personalPolicyID] = useOnyx(ONYXKEYS.PERSONAL_POLICY_ID); - const [userBillingGraceEndPeriodCollection] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END); + const [userBillingGraceEndPeriods] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END); const transactionsOnIOUReport = useReportTransactions(iouReport?.reportID); const transactionID = isMoneyRequestAction(action) && getOriginalMessage(action)?.IOUTransactionID; @@ -186,7 +186,7 @@ function ReportActionItem({ isTryNewDotNVPDismissed={isTryNewDotNVPDismissed} bankAccountList={bankAccountList} reportMetadata={reportMetadata} - userBillingGraceEndPeriodCollection={userBillingGraceEndPeriodCollection} + userBillingGraceEndPeriods={userBillingGraceEndPeriods} /> ); } diff --git a/src/pages/iou/request/MoneyRequestParticipantsSelector.tsx b/src/pages/iou/request/MoneyRequestParticipantsSelector.tsx index 7d5838bed75bd..c222acc64ace9 100644 --- a/src/pages/iou/request/MoneyRequestParticipantsSelector.tsx +++ b/src/pages/iou/request/MoneyRequestParticipantsSelector.tsx @@ -115,7 +115,7 @@ function MoneyRequestParticipantsSelector({ const {isDismissed} = useDismissedReferralBanners({referralContentType}); const {isRestrictedToPreferredPolicy, preferredPolicyID} = usePreferredPolicy(); const {didScreenTransitionEnd} = useScreenWrapperTransitionStatus(); - const [userBillingGraceEndPeriodCollection] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END); + const [userBillingGraceEndPeriods] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END); const [activePolicyID] = useOnyx(ONYXKEYS.NVP_ACTIVE_POLICY_ID); const [allPolicies] = useOnyx(ONYXKEYS.COLLECTION.POLICY); const policy = allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${activePolicyID}`]; @@ -518,11 +518,7 @@ function MoneyRequestParticipantsSelector({ const onSelectRow = useCallback( (option: Participant) => { - if ( - option.isPolicyExpenseChat && - option.policyID && - shouldRestrictUserBillableActions(option.policyID, userBillingGraceEndPeriodCollection, undefined, ownerBillingGraceEndPeriod) - ) { + if (option.isPolicyExpenseChat && option.policyID && shouldRestrictUserBillableActions(option.policyID, userBillingGraceEndPeriods, undefined, ownerBillingGraceEndPeriod)) { Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(option.policyID)); return; } @@ -534,7 +530,7 @@ function MoneyRequestParticipantsSelector({ addSingleParticipant(option); }, - [isIOUSplit, addParticipantToSelection, addSingleParticipant, userBillingGraceEndPeriodCollection, ownerBillingGraceEndPeriod], + [isIOUSplit, addParticipantToSelection, addSingleParticipant, userBillingGraceEndPeriods, ownerBillingGraceEndPeriod], ); const importContactsButtonComponent = useMemo(() => { diff --git a/tests/actions/IOUTest.ts b/tests/actions/IOUTest.ts index b578ad5498138..b1ea44e70cdc0 100644 --- a/tests/actions/IOUTest.ts +++ b/tests/actions/IOUTest.ts @@ -635,7 +635,7 @@ describe('actions/IOU', () => { introSelected: {choice: CONST.ONBOARDING_CHOICES.MANAGE_TEAM}, allTransactionDrafts: {}, activePolicy: undefined, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, amountOwed: 0, }); await waitForBatchedUpdates(); @@ -1208,7 +1208,7 @@ describe('actions/IOU', () => { introSelected: {choice: CONST.ONBOARDING_CHOICES.MANAGE_TEAM}, allTransactionDrafts: {}, activePolicy: undefined, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, amountOwed: 0, }); await waitForBatchedUpdates(); @@ -1864,7 +1864,7 @@ describe('actions/IOU', () => { introSelected: {choice: CONST.ONBOARDING_CHOICES.MANAGE_TEAM}, allTransactionDrafts, activePolicy: undefined, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, amountOwed: 0, }); await waitForBatchedUpdates(); @@ -1912,7 +1912,7 @@ describe('actions/IOU', () => { introSelected: {choice: CONST.ONBOARDING_CHOICES.MANAGE_TEAM}, allTransactionDrafts: {}, activePolicy: undefined, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, amountOwed: 0, }); await waitForBatchedUpdates(); @@ -1949,7 +1949,7 @@ describe('actions/IOU', () => { introSelected: {choice: CONST.ONBOARDING_CHOICES.MANAGE_TEAM}, allTransactionDrafts: {}, activePolicy: undefined, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, amountOwed: 0, }); await waitForBatchedUpdates(); @@ -1981,7 +1981,7 @@ describe('actions/IOU', () => { introSelected: {choice: CONST.ONBOARDING_CHOICES.MANAGE_TEAM}, allTransactionDrafts: {}, activePolicy: undefined, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, amountOwed: 0, }); await waitForBatchedUpdates(); diff --git a/tests/ui/ClearReportActionErrorsUITest.tsx b/tests/ui/ClearReportActionErrorsUITest.tsx index 19c54a7ec7e09..cdd04dc103813 100644 --- a/tests/ui/ClearReportActionErrorsUITest.tsx +++ b/tests/ui/ClearReportActionErrorsUITest.tsx @@ -106,7 +106,7 @@ describe('ClearReportActionErrors UI', () => { iouReportOfLinkedReport={undefined} currentUserAccountID={ACTOR_ACCOUNT_ID} allTransactionDrafts={undefined} - userBillingGraceEndPeriodCollection={undefined} + userBillingGraceEndPeriods={undefined} clearAllRelatedReportActionErrors={clearErrorFn} originalReportID={originalReportID} /> diff --git a/tests/ui/PureReportActionItemTest.tsx b/tests/ui/PureReportActionItemTest.tsx index b6d88011f4e60..2599e82b58931 100644 --- a/tests/ui/PureReportActionItemTest.tsx +++ b/tests/ui/PureReportActionItemTest.tsx @@ -112,7 +112,7 @@ describe('PureReportActionItem', () => { iouReportOfLinkedReport={undefined} currentUserAccountID={ACTOR_ACCOUNT_ID} allTransactionDrafts={undefined} - userBillingGraceEndPeriodCollection={undefined} + userBillingGraceEndPeriods={undefined} /> @@ -318,7 +318,7 @@ describe('PureReportActionItem', () => { reportMetadata={reportMetadata} currentUserAccountID={ACTOR_ACCOUNT_ID} allTransactionDrafts={undefined} - userBillingGraceEndPeriodCollection={undefined} + userBillingGraceEndPeriods={undefined} /> @@ -375,7 +375,7 @@ describe('PureReportActionItem', () => { iouReportOfLinkedReport={undefined} currentUserAccountID={ACTOR_ACCOUNT_ID} allTransactionDrafts={undefined} - userBillingGraceEndPeriodCollection={undefined} + userBillingGraceEndPeriods={undefined} /> @@ -444,7 +444,7 @@ describe('PureReportActionItem', () => { iouReportOfLinkedReport={undefined} currentUserAccountID={ACTOR_ACCOUNT_ID} allTransactionDrafts={undefined} - userBillingGraceEndPeriodCollection={undefined} + userBillingGraceEndPeriods={undefined} /> @@ -508,7 +508,7 @@ describe('PureReportActionItem', () => { iouReportOfLinkedReport={undefined} currentUserAccountID={ACTOR_ACCOUNT_ID} allTransactionDrafts={undefined} - userBillingGraceEndPeriodCollection={undefined} + userBillingGraceEndPeriods={undefined} /> @@ -559,7 +559,7 @@ describe('PureReportActionItem', () => { currentUserAccountID={ACTOR_ACCOUNT_ID} allTransactionDrafts={undefined} modifiedExpenseMessage={modifiedExpenseMessage} - userBillingGraceEndPeriodCollection={undefined} + userBillingGraceEndPeriods={undefined} /> diff --git a/tests/unit/ReportUtilsTest.ts b/tests/unit/ReportUtilsTest.ts index 9db06b91b9169..d6355b0d9db19 100644 --- a/tests/unit/ReportUtilsTest.ts +++ b/tests/unit/ReportUtilsTest.ts @@ -12752,7 +12752,7 @@ describe('ReportUtils', () => { introSelected: undefined, allTransactionDrafts: undefined, activePolicy, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, amountOwed: 1, }); @@ -12772,7 +12772,7 @@ describe('ReportUtils', () => { await Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION}${transaction.transactionID}`, transaction); await Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${1}`, {}); await Onyx.merge(`${ONYXKEYS.COLLECTION.POLICY}${activePolicy.id}`, activePolicy); - const userBillingGraceEndPeriodCollection = { + const userBillingGraceEndPeriods = { [`${ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END}${ownerAccountID}`]: { value: 1, }, @@ -12787,7 +12787,7 @@ describe('ReportUtils', () => { introSelected: undefined, allTransactionDrafts: undefined, activePolicy, - userBillingGraceEndPeriodCollection, + userBillingGraceEndPeriods, amountOwed: 0, }); @@ -12825,7 +12825,7 @@ describe('ReportUtils', () => { introSelected: undefined, allTransactionDrafts: undefined, activePolicy, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, amountOwed: 0, }); @@ -12865,7 +12865,7 @@ describe('ReportUtils', () => { introSelected: undefined, allTransactionDrafts: undefined, activePolicy: undefined, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, amountOwed: 0, }); @@ -12892,7 +12892,7 @@ describe('ReportUtils', () => { introSelected: undefined, allTransactionDrafts: undefined, activePolicy: undefined, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, amountOwed: 0, }); @@ -12940,7 +12940,7 @@ describe('ReportUtils', () => { introSelected: undefined, allTransactionDrafts: undefined, activePolicy: undefined, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, amountOwed: 0, }); @@ -12984,7 +12984,7 @@ describe('ReportUtils', () => { introSelected: undefined, allTransactionDrafts: undefined, activePolicy, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, amountOwed: 0, }); @@ -13026,7 +13026,7 @@ describe('ReportUtils', () => { introSelected: undefined, allTransactionDrafts: undefined, activePolicy, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, amountOwed: 0, }); @@ -13060,7 +13060,7 @@ describe('ReportUtils', () => { introSelected: undefined, allTransactionDrafts: undefined, activePolicy, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, amountOwed: 50, }); @@ -13663,7 +13663,7 @@ describe('ReportUtils', () => { icons: mockIcons, iouReportID: mockIouReportID, policy: undefined, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, draftTransactionIDs: undefined, amountOwed: 0, ownerBillingGraceEndPeriod: undefined, @@ -13677,7 +13677,7 @@ describe('ReportUtils', () => { icons: mockIcons, iouReportID: mockIouReportID, policy: undefined, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, draftTransactionIDs: undefined, amountOwed: undefined, ownerBillingGraceEndPeriod: undefined, @@ -13693,7 +13693,7 @@ describe('ReportUtils', () => { icons: mockIcons, iouReportID: mockIouReportID, policy: undefined, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, draftTransactionIDs: undefined, amountOwed: 0, ownerBillingGraceEndPeriod: undefined, @@ -13709,7 +13709,7 @@ describe('ReportUtils', () => { icons: mockIcons, iouReportID: mockIouReportID, policy: undefined, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, draftTransactionIDs: undefined, amountOwed: 0, ownerBillingGraceEndPeriod: undefined, @@ -13728,7 +13728,7 @@ describe('ReportUtils', () => { icons: mockIcons, iouReportID: mockIouReportID, policy: mockPolicy, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, draftTransactionIDs: undefined, amountOwed, ownerBillingGraceEndPeriod: undefined, @@ -13748,7 +13748,7 @@ describe('ReportUtils', () => { icons: mockIcons, iouReportID: mockIouReportID, policy: mockPolicy, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, draftTransactionIDs: undefined, amountOwed: 0, ownerBillingGraceEndPeriod: undefined, @@ -13767,7 +13767,7 @@ describe('ReportUtils', () => { icons: mockIcons, iouReportID: undefined, policy: undefined, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, draftTransactionIDs: undefined, amountOwed: 0, ownerBillingGraceEndPeriod: undefined, @@ -13786,7 +13786,7 @@ describe('ReportUtils', () => { icons: mockIcons, iouReportID: mockIouReportID, policy: undefined, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, draftTransactionIDs: undefined, amountOwed: 0, ownerBillingGraceEndPeriod: undefined, @@ -13805,7 +13805,7 @@ describe('ReportUtils', () => { icons: mockIcons, iouReportID: mockIouReportID, policy: undefined, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, draftTransactionIDs: undefined, amountOwed, ownerBillingGraceEndPeriod: undefined, @@ -13820,7 +13820,7 @@ describe('ReportUtils', () => { icons: mockIcons, iouReportID: mockIouReportID, policy: undefined, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, draftTransactionIDs: undefined, amountOwed: 0, ownerBillingGraceEndPeriod: undefined, @@ -13985,7 +13985,7 @@ describe('ReportUtils', () => { icons: mockIcons, iouReportID, policy: undefined, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, draftTransactionIDs: undefined, amountOwed: undefined, ownerBillingGraceEndPeriod: undefined, @@ -14004,7 +14004,7 @@ describe('ReportUtils', () => { icons: mockIcons, iouReportID: undefined, policy: undefined, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, draftTransactionIDs: undefined, amountOwed: undefined, ownerBillingGraceEndPeriod: undefined, @@ -14035,7 +14035,7 @@ describe('ReportUtils', () => { icons: mockIcons, iouReportID, policy: testPolicy, - userBillingGraceEndPeriodCollection: pastDueCollection, + userBillingGraceEndPeriods: pastDueCollection, draftTransactionIDs: undefined, amountOwed: undefined, ownerBillingGraceEndPeriod: undefined, @@ -14067,7 +14067,7 @@ describe('ReportUtils', () => { icons: mockIcons, iouReportID, policy: testPolicy, - userBillingGraceEndPeriodCollection: pastDueCollection, + userBillingGraceEndPeriods: pastDueCollection, draftTransactionIDs: undefined, amountOwed: undefined, ownerBillingGraceEndPeriod: undefined, @@ -14093,7 +14093,7 @@ describe('ReportUtils', () => { icons: mockIcons, iouReportID, policy: testPolicy, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, draftTransactionIDs: undefined, amountOwed: undefined, ownerBillingGraceEndPeriod: gracePeriodEnd, diff --git a/tests/unit/Search/handleActionButtonPressTest.ts b/tests/unit/Search/handleActionButtonPressTest.ts index 44a9c55d3e533..63fc316d9d767 100644 --- a/tests/unit/Search/handleActionButtonPressTest.ts +++ b/tests/unit/Search/handleActionButtonPressTest.ts @@ -325,6 +325,7 @@ describe('handleActionButtonPress', () => { snapshotPolicy: snapshotPolicy as Policy, lastPaymentMethod: mockLastPaymentMethod, personalPolicyID: undefined, + userBillingGraceEndPeriods: undefined, }); expect(goToItem).toHaveBeenCalledTimes(1); }); @@ -339,6 +340,7 @@ describe('handleActionButtonPress', () => { snapshotPolicy: snapshotPolicy as Policy, lastPaymentMethod: mockLastPaymentMethod, personalPolicyID: undefined, + userBillingGraceEndPeriods: undefined, }); expect(goToItem).toHaveBeenCalledTimes(0); });