Skip to content

Commit a10303f

Browse files
authored
Merge pull request #83125 from bernhardoj/chore/66456-remove-onyx-connect-shared-billing-grace-period-subscription-utils-5
#5 - Get the billing grace end period collection with useOnyx
2 parents 5635997 + bf03514 commit a10303f

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

src/components/Search/SearchBulkActionsButton.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ function SearchBulkActionsButton({queryJSON}: SearchBulkActionsButtonProps) {
4343
const {showLockedAccountModal} = useLockedAccountActions();
4444
const {isDelegateAccessRestricted} = useDelegateNoAccessState();
4545
const {showDelegateNoAccessModal} = useDelegateNoAccessActions();
46+
const [userBillingGraceEndPeriods] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END);
4647
const [isUserValidated] = useOnyx(ONYXKEYS.ACCOUNT, {selector: isUserValidatedSelector});
4748
const activeAdminPolicies = useSortedActiveAdminPolicies();
4849

@@ -128,6 +129,7 @@ function SearchBulkActionsButton({queryJSON}: SearchBulkActionsButtonProps) {
128129
isDelegateAccessRestricted,
129130
showDelegateNoAccessModal,
130131
confirmPayment,
132+
userBillingGraceEndPeriods,
131133
})
132134
}
133135
success
@@ -162,6 +164,7 @@ function SearchBulkActionsButton({queryJSON}: SearchBulkActionsButtonProps) {
162164
isDelegateAccessRestricted,
163165
showDelegateNoAccessModal,
164166
confirmPayment,
167+
userBillingGraceEndPeriods,
165168
})
166169
}
167170
isSplitButton={false}

src/libs/actions/Search.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ import type {SearchAdvancedFiltersForm} from '@src/types/form/SearchAdvancedFilt
5151
import type {
5252
BankAccountList,
5353
Beta,
54+
BillingGraceEndPeriod,
5455
ExportTemplate,
5556
LastPaymentMethod,
5657
LastPaymentMethodType,
@@ -1310,6 +1311,7 @@ function handleBulkPayItemSelected(params: {
13101311
activeAdminPolicies: Policy[];
13111312
isUserValidated: boolean | undefined;
13121313
isDelegateAccessRestricted: boolean;
1314+
userBillingGraceEndPeriods: OnyxCollection<BillingGraceEndPeriod>;
13131315
showDelegateNoAccessModal: () => void;
13141316
confirmPayment?: (paymentType: PaymentMethodType | undefined, additionalData?: Record<string, unknown>) => void;
13151317
}) {
@@ -1323,6 +1325,7 @@ function handleBulkPayItemSelected(params: {
13231325
activeAdminPolicies,
13241326
isUserValidated,
13251327
isDelegateAccessRestricted,
1328+
userBillingGraceEndPeriods,
13261329
showDelegateNoAccessModal,
13271330
confirmPayment,
13281331
} = params;
@@ -1342,7 +1345,7 @@ function handleBulkPayItemSelected(params: {
13421345
return;
13431346
}
13441347

1345-
if (policy && shouldRestrictUserBillableActions(policy?.id)) {
1348+
if (policy && shouldRestrictUserBillableActions(policy?.id, userBillingGraceEndPeriods)) {
13461349
Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(policy?.id));
13471350
return;
13481351
}

0 commit comments

Comments
 (0)