From df987f62361f4d2478eb05e8a67d24576213df0b Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Sat, 21 Feb 2026 15:40:26 +0800 Subject: [PATCH 1/2] pass billing grace end period data from useOnyx --- src/components/Search/SearchPageHeader/SearchFiltersBar.tsx | 2 ++ src/libs/actions/Search.ts | 5 ++++- src/pages/Search/SearchSelectedNarrow.tsx | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/Search/SearchPageHeader/SearchFiltersBar.tsx b/src/components/Search/SearchPageHeader/SearchFiltersBar.tsx index 140e65011c584..0158612deaeef 100644 --- a/src/components/Search/SearchPageHeader/SearchFiltersBar.tsx +++ b/src/components/Search/SearchPageHeader/SearchFiltersBar.tsx @@ -146,6 +146,7 @@ function SearchFiltersBar({ }: SearchFiltersBarProps) { const scrollRef = useRef>(null); const currentPolicy = usePolicy(currentSelectedPolicyID); + const [userBillingGraceEndPeriodCollection] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END, {canBeMissing: true}); const [isUserValidated] = useOnyx(ONYXKEYS.ACCOUNT, {selector: isUserValidatedSelector, canBeMissing: true}); const [searchAdvancedFiltersForm = getEmptyObject>()] = useOnyx(ONYXKEYS.FORMS.SEARCH_ADVANCED_FILTERS_FORM, {canBeMissing: true}); // type, groupBy, status, and view values are not guaranteed to respect the ts type as they come from user input @@ -807,6 +808,7 @@ function SearchFiltersBar({ activeAdminPolicies, isUserValidated, isDelegateAccessRestricted, + userBillingGraceEndPeriodCollection, showDelegateNoAccessModal, confirmPayment, }) diff --git a/src/libs/actions/Search.ts b/src/libs/actions/Search.ts index ce235e34ae9d5..08b8a06068ef8 100644 --- a/src/libs/actions/Search.ts +++ b/src/libs/actions/Search.ts @@ -51,6 +51,7 @@ import type {SearchAdvancedFiltersForm} from '@src/types/form/SearchAdvancedFilt import type { BankAccountList, Beta, + BillingGraceEndPeriod, ExportTemplate, LastPaymentMethod, LastPaymentMethodType, @@ -1291,6 +1292,7 @@ function handleBulkPayItemSelected(params: { activeAdminPolicies: Policy[]; isUserValidated: boolean | undefined; isDelegateAccessRestricted: boolean; + userBillingGraceEndPeriodCollection: OnyxCollection; showDelegateNoAccessModal: () => void; confirmPayment?: (paymentType: PaymentMethodType | undefined, additionalData?: Record) => void; }) { @@ -1304,6 +1306,7 @@ function handleBulkPayItemSelected(params: { activeAdminPolicies, isUserValidated, isDelegateAccessRestricted, + userBillingGraceEndPeriodCollection, showDelegateNoAccessModal, confirmPayment, } = params; @@ -1323,7 +1326,7 @@ function handleBulkPayItemSelected(params: { return; } - if (policy && shouldRestrictUserBillableActions(policy?.id)) { + if (policy && shouldRestrictUserBillableActions(policy?.id, userBillingGraceEndPeriodCollection)) { Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(policy?.id)); return; } diff --git a/src/pages/Search/SearchSelectedNarrow.tsx b/src/pages/Search/SearchSelectedNarrow.tsx index c6a6d006fd0d7..7cc6f4e0120c5 100644 --- a/src/pages/Search/SearchSelectedNarrow.tsx +++ b/src/pages/Search/SearchSelectedNarrow.tsx @@ -34,6 +34,7 @@ type SearchSelectedNarrowProps = { function SearchSelectedNarrow({options, itemsLength, currentSelectedPolicyID, currentSelectedReportID, confirmPayment, latestBankItems}: SearchSelectedNarrowProps) { const styles = useThemeStyles(); + const [userBillingGraceEndPeriodCollection] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END, {canBeMissing: true}); const [allPolicies] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {canBeMissing: true}); const [selectedIouReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${currentSelectedReportID}`, {canBeMissing: true}); const {translate, localeCompare} = useLocalize(); @@ -95,6 +96,7 @@ function SearchSelectedNarrow({options, itemsLength, currentSelectedPolicyID, cu activeAdminPolicies, isUserValidated, isDelegateAccessRestricted, + userBillingGraceEndPeriodCollection, showDelegateNoAccessModal, confirmPayment, }) From 7477a1f1e0ad30e51f271f934e444faab3317a47 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Thu, 26 Feb 2026 13:26:02 +0800 Subject: [PATCH 2/2] rename --- src/components/Search/SearchPageHeader/SearchFiltersBar.tsx | 4 ++-- src/libs/actions/Search.ts | 6 +++--- src/pages/Search/SearchSelectedNarrow.tsx | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/Search/SearchPageHeader/SearchFiltersBar.tsx b/src/components/Search/SearchPageHeader/SearchFiltersBar.tsx index b97ccfe83b28e..f4c4216cec3df 100644 --- a/src/components/Search/SearchPageHeader/SearchFiltersBar.tsx +++ b/src/components/Search/SearchPageHeader/SearchFiltersBar.tsx @@ -146,7 +146,7 @@ function SearchFiltersBar({ }: SearchFiltersBarProps) { const scrollRef = useRef>(null); const currentPolicy = usePolicy(currentSelectedPolicyID); - 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 [isUserValidated] = useOnyx(ONYXKEYS.ACCOUNT, {selector: isUserValidatedSelector}); const [searchAdvancedFiltersForm = getEmptyObject>()] = useOnyx(ONYXKEYS.FORMS.SEARCH_ADVANCED_FILTERS_FORM); // type, groupBy, status, and view values are not guaranteed to respect the ts type as they come from user input @@ -808,7 +808,7 @@ function SearchFiltersBar({ activeAdminPolicies, isUserValidated, isDelegateAccessRestricted, - userBillingGraceEndPeriodCollection, + userBillingGraceEndPeriods, showDelegateNoAccessModal, confirmPayment, }) diff --git a/src/libs/actions/Search.ts b/src/libs/actions/Search.ts index 08b8a06068ef8..b8f72c014bb6b 100644 --- a/src/libs/actions/Search.ts +++ b/src/libs/actions/Search.ts @@ -1292,7 +1292,7 @@ function handleBulkPayItemSelected(params: { activeAdminPolicies: Policy[]; isUserValidated: boolean | undefined; isDelegateAccessRestricted: boolean; - userBillingGraceEndPeriodCollection: OnyxCollection; + userBillingGraceEndPeriods: OnyxCollection; showDelegateNoAccessModal: () => void; confirmPayment?: (paymentType: PaymentMethodType | undefined, additionalData?: Record) => void; }) { @@ -1306,7 +1306,7 @@ function handleBulkPayItemSelected(params: { activeAdminPolicies, isUserValidated, isDelegateAccessRestricted, - userBillingGraceEndPeriodCollection, + userBillingGraceEndPeriods, showDelegateNoAccessModal, confirmPayment, } = params; @@ -1326,7 +1326,7 @@ function handleBulkPayItemSelected(params: { return; } - if (policy && shouldRestrictUserBillableActions(policy?.id, userBillingGraceEndPeriodCollection)) { + if (policy && shouldRestrictUserBillableActions(policy?.id, userBillingGraceEndPeriods)) { Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(policy?.id)); return; } diff --git a/src/pages/Search/SearchSelectedNarrow.tsx b/src/pages/Search/SearchSelectedNarrow.tsx index e9f65a490651f..db79d809e80d6 100644 --- a/src/pages/Search/SearchSelectedNarrow.tsx +++ b/src/pages/Search/SearchSelectedNarrow.tsx @@ -34,7 +34,7 @@ type SearchSelectedNarrowProps = { function SearchSelectedNarrow({options, itemsLength, currentSelectedPolicyID, currentSelectedReportID, confirmPayment, latestBankItems}: SearchSelectedNarrowProps) { const styles = useThemeStyles(); - 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 [allPolicies] = useOnyx(ONYXKEYS.COLLECTION.POLICY); const [selectedIouReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${currentSelectedReportID}`); const {translate, localeCompare} = useLocalize(); @@ -96,7 +96,7 @@ function SearchSelectedNarrow({options, itemsLength, currentSelectedPolicyID, cu activeAdminPolicies, isUserValidated, isDelegateAccessRestricted, - userBillingGraceEndPeriodCollection, + userBillingGraceEndPeriods, showDelegateNoAccessModal, confirmPayment, })