From ed39347b4ef1f0232689fd1dc791993c8694b47d Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Fri, 20 Feb 2026 18:52:45 +0800 Subject: [PATCH 1/4] pass billing grace end period data from useOnyx --- .../BaseFloatingCameraButton.tsx | 3 ++- src/components/SettlementButton/index.tsx | 15 +++++++++++++-- src/hooks/useReceiptScanDrop.tsx | 3 ++- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/components/FloatingCameraButton/BaseFloatingCameraButton.tsx b/src/components/FloatingCameraButton/BaseFloatingCameraButton.tsx index b0f424e3303ac..e62971e89267d 100644 --- a/src/components/FloatingCameraButton/BaseFloatingCameraButton.tsx +++ b/src/components/FloatingCameraButton/BaseFloatingCameraButton.tsx @@ -37,6 +37,7 @@ function BaseFloatingCameraButton({icon}: BaseFloatingCameraButtonProps) { const [activePolicy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${activePolicyID}`, {canBeMissing: true}); const [session] = useOnyx(ONYXKEYS.SESSION, {canBeMissing: false, selector: sessionSelector}); const [allTransactionDrafts] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_DRAFT, {canBeMissing: true}); + const [userBillingGraceEndPeriodCollection] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END, {canBeMissing: true}); const reportID = useMemo(() => generateReportID(), []); const policyChatForActivePolicySelector = useCallback( @@ -53,7 +54,7 @@ function BaseFloatingCameraButton({icon}: BaseFloatingCameraButtonProps) { const onPress = () => { interceptAnonymousUser(() => { - if (policyChatForActivePolicy?.policyID && shouldRestrictUserBillableActions(policyChatForActivePolicy.policyID)) { + if (policyChatForActivePolicy?.policyID && shouldRestrictUserBillableActions(policyChatForActivePolicy.policyID, userBillingGraceEndPeriodCollection)) { Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(policyChatForActivePolicy.policyID)); return; } diff --git a/src/components/SettlementButton/index.tsx b/src/components/SettlementButton/index.tsx index 187afb92e4d65..4195406a8b221 100644 --- a/src/components/SettlementButton/index.tsx +++ b/src/components/SettlementButton/index.tsx @@ -119,6 +119,7 @@ function SettlementButton({ const [lastPaymentMethods, lastPaymentMethodResult] = useOnyx(ONYXKEYS.NVP_LAST_PAYMENT_METHOD, {canBeMissing: true}); const [personalPolicyID] = useOnyx(ONYXKEYS.PERSONAL_POLICY_ID, {canBeMissing: true}); const [betas] = useOnyx(ONYXKEYS.BETAS, {canBeMissing: true}); + const [userBillingGraceEndPeriodCollection] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END, {canBeMissing: true}); const lastPaymentMethod = useMemo(() => { if (!iouReport?.type) { @@ -211,13 +212,23 @@ function SettlementButton({ return true; } - if (policy && shouldRestrictUserBillableActions(policy.id)) { + if (policy && shouldRestrictUserBillableActions(policy.id, userBillingGraceEndPeriodCollection)) { Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(policy.id)); return true; } return false; - }, [policy, isAccountLocked, isUserValidated, chatReportID, reportID, showLockedAccountModal, isDelegateAccessRestricted, showDelegateNoAccessModal]); + }, [ + policy, + isAccountLocked, + isUserValidated, + chatReportID, + reportID, + showLockedAccountModal, + isDelegateAccessRestricted, + showDelegateNoAccessModal, + userBillingGraceEndPeriodCollection, + ]); const getPaymentSubItems = useCallback( (payAsBusiness: boolean) => { diff --git a/src/hooks/useReceiptScanDrop.tsx b/src/hooks/useReceiptScanDrop.tsx index 9b1a57248f930..2a8d3493bfb09 100644 --- a/src/hooks/useReceiptScanDrop.tsx +++ b/src/hooks/useReceiptScanDrop.tsx @@ -25,6 +25,7 @@ import useSelfDMReport from './useSelfDMReport'; function useReceiptScanDrop() { const currentUserPersonalDetails = useCurrentUserPersonalDetails(); const selfDMReport = useSelfDMReport(); + const [userBillingGraceEndPeriodCollection] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END, {canBeMissing: true}); const [policies] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {canBeMissing: true}); const [currentDate] = useOnyx(ONYXKEYS.CURRENT_DATE, {canBeMissing: true}); const [activePolicyID] = useOnyx(ONYXKEYS.NVP_ACTIVE_POLICY_ID, {canBeMissing: false}); @@ -75,7 +76,7 @@ function useReceiptScanDrop() { setMoneyRequestReceipt(transactionID, source, file.name ?? '', true, file.type); } - if (isPaidGroupPolicy(activePolicy) && activePolicy?.isPolicyExpenseChatEnabled && !shouldRestrictUserBillableActions(activePolicy.id)) { + if (isPaidGroupPolicy(activePolicy) && activePolicy?.isPolicyExpenseChatEnabled && !shouldRestrictUserBillableActions(activePolicy.id, userBillingGraceEndPeriodCollection)) { const shouldAutoReport = !!activePolicy?.autoReporting || !!personalPolicy?.autoReporting; const report = shouldAutoReport ? getPolicyExpenseChat(currentUserPersonalDetails.accountID, activePolicy?.id) : selfDMReport; const transactionReportID = isSelfDM(report) ? CONST.REPORT.UNREPORTED_REPORT_ID : report?.reportID; From 259bd34297e76df5cc7fa3fdffe2a785e4ee99b1 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Tue, 24 Feb 2026 00:51:00 +0800 Subject: [PATCH 2/4] remove canBeMissing --- .../FloatingCameraButton/BaseFloatingCameraButton.tsx | 2 +- src/hooks/useReceiptScanDrop.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/FloatingCameraButton/BaseFloatingCameraButton.tsx b/src/components/FloatingCameraButton/BaseFloatingCameraButton.tsx index 44795f16bd76b..79ab14822cdbb 100644 --- a/src/components/FloatingCameraButton/BaseFloatingCameraButton.tsx +++ b/src/components/FloatingCameraButton/BaseFloatingCameraButton.tsx @@ -35,7 +35,7 @@ function BaseFloatingCameraButton({icon}: BaseFloatingCameraButtonProps) { const [activePolicyID] = useOnyx(ONYXKEYS.NVP_ACTIVE_POLICY_ID); const [activePolicy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${activePolicyID}`); - const [session] = useOnyx(ONYXKEYS.SESSION, {canBeMissing: false, selector: sessionSelector}); + const [session] = useOnyx(ONYXKEYS.SESSION, {selector: sessionSelector}); const [allTransactionDrafts] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_DRAFT); const [userBillingGraceEndPeriodCollection] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END); const reportID = useMemo(() => generateReportID(), []); diff --git a/src/hooks/useReceiptScanDrop.tsx b/src/hooks/useReceiptScanDrop.tsx index 1bdcc034d2c59..a9e74c0d0f478 100644 --- a/src/hooks/useReceiptScanDrop.tsx +++ b/src/hooks/useReceiptScanDrop.tsx @@ -28,7 +28,7 @@ function useReceiptScanDrop() { const [userBillingGraceEndPeriodCollection] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END); const [policies] = useOnyx(ONYXKEYS.COLLECTION.POLICY); const [currentDate] = useOnyx(ONYXKEYS.CURRENT_DATE); - const [activePolicyID] = useOnyx(ONYXKEYS.NVP_ACTIVE_POLICY_ID, {canBeMissing: false}); + const [activePolicyID] = useOnyx(ONYXKEYS.NVP_ACTIVE_POLICY_ID); const [activePolicy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${activePolicyID}`); const [personalPolicyID] = useOnyx(ONYXKEYS.PERSONAL_POLICY_ID); const [personalPolicy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${personalPolicyID}`); From 7d0e9ddf6f43f51fb0342bd964e2d7413601bccd Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Thu, 26 Feb 2026 13:20:33 +0800 Subject: [PATCH 3/4] rename --- .../FloatingCameraButton/BaseFloatingCameraButton.tsx | 4 ++-- src/components/SettlementButton/index.tsx | 6 +++--- src/hooks/useReceiptScanDrop.tsx | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/FloatingCameraButton/BaseFloatingCameraButton.tsx b/src/components/FloatingCameraButton/BaseFloatingCameraButton.tsx index 79ab14822cdbb..61aec9e812fb3 100644 --- a/src/components/FloatingCameraButton/BaseFloatingCameraButton.tsx +++ b/src/components/FloatingCameraButton/BaseFloatingCameraButton.tsx @@ -37,7 +37,7 @@ function BaseFloatingCameraButton({icon}: BaseFloatingCameraButtonProps) { const [activePolicy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${activePolicyID}`); const [session] = useOnyx(ONYXKEYS.SESSION, {selector: sessionSelector}); const [allTransactionDrafts] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_DRAFT); - 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 reportID = useMemo(() => generateReportID(), []); const policyChatForActivePolicySelector = useCallback( @@ -54,7 +54,7 @@ function BaseFloatingCameraButton({icon}: BaseFloatingCameraButtonProps) { const onPress = () => { interceptAnonymousUser(() => { - if (policyChatForActivePolicy?.policyID && shouldRestrictUserBillableActions(policyChatForActivePolicy.policyID, userBillingGraceEndPeriodCollection)) { + if (policyChatForActivePolicy?.policyID && shouldRestrictUserBillableActions(policyChatForActivePolicy.policyID, userBillingGraceEndPeriods)) { Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(policyChatForActivePolicy.policyID)); return; } diff --git a/src/components/SettlementButton/index.tsx b/src/components/SettlementButton/index.tsx index 17c5098145964..22799bf130341 100644 --- a/src/components/SettlementButton/index.tsx +++ b/src/components/SettlementButton/index.tsx @@ -120,7 +120,7 @@ function SettlementButton({ const [lastPaymentMethods, lastPaymentMethodResult] = useOnyx(ONYXKEYS.NVP_LAST_PAYMENT_METHOD); const [personalPolicyID] = useOnyx(ONYXKEYS.PERSONAL_POLICY_ID); const [betas] = useOnyx(ONYXKEYS.BETAS); - 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 lastPaymentMethod = useMemo(() => { if (!iouReport?.type) { @@ -216,7 +216,7 @@ function SettlementButton({ return true; } - if (policy && shouldRestrictUserBillableActions(policy.id, userBillingGraceEndPeriodCollection)) { + if (policy && shouldRestrictUserBillableActions(policy.id, userBillingGraceEndPeriods)) { Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(policy.id)); return true; } @@ -231,7 +231,7 @@ function SettlementButton({ showLockedAccountModal, isDelegateAccessRestricted, showDelegateNoAccessModal, - userBillingGraceEndPeriodCollection, + userBillingGraceEndPeriods, ]); const getPaymentSubItems = useCallback( diff --git a/src/hooks/useReceiptScanDrop.tsx b/src/hooks/useReceiptScanDrop.tsx index a9e74c0d0f478..8079a70f3b86c 100644 --- a/src/hooks/useReceiptScanDrop.tsx +++ b/src/hooks/useReceiptScanDrop.tsx @@ -25,7 +25,7 @@ import useSelfDMReport from './useSelfDMReport'; function useReceiptScanDrop() { const currentUserPersonalDetails = useCurrentUserPersonalDetails(); const selfDMReport = useSelfDMReport(); - 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 [policies] = useOnyx(ONYXKEYS.COLLECTION.POLICY); const [currentDate] = useOnyx(ONYXKEYS.CURRENT_DATE); const [activePolicyID] = useOnyx(ONYXKEYS.NVP_ACTIVE_POLICY_ID); @@ -76,7 +76,7 @@ function useReceiptScanDrop() { setMoneyRequestReceipt(transactionID, source, file.name ?? '', true, file.type); } - if (isPaidGroupPolicy(activePolicy) && activePolicy?.isPolicyExpenseChatEnabled && !shouldRestrictUserBillableActions(activePolicy.id, userBillingGraceEndPeriodCollection)) { + if (isPaidGroupPolicy(activePolicy) && activePolicy?.isPolicyExpenseChatEnabled && !shouldRestrictUserBillableActions(activePolicy.id, userBillingGraceEndPeriods)) { const shouldAutoReport = !!activePolicy?.autoReporting || !!personalPolicy?.autoReporting; const report = shouldAutoReport ? getPolicyExpenseChat(currentUserPersonalDetails.accountID, activePolicy?.id) : selfDMReport; const transactionReportID = isSelfDM(report) ? CONST.REPORT.UNREPORTED_REPORT_ID : report?.reportID; From 6b5b75e40995671acef66c49d598ff20fe2b4ec4 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Fri, 27 Feb 2026 11:32:22 +0800 Subject: [PATCH 4/4] prettier --- src/components/SettlementButton/index.tsx | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/components/SettlementButton/index.tsx b/src/components/SettlementButton/index.tsx index 22799bf130341..f0f72f187882d 100644 --- a/src/components/SettlementButton/index.tsx +++ b/src/components/SettlementButton/index.tsx @@ -222,17 +222,7 @@ function SettlementButton({ } return false; - }, [ - policy, - isAccountLocked, - isUserValidated, - chatReportID, - reportID, - showLockedAccountModal, - isDelegateAccessRestricted, - showDelegateNoAccessModal, - userBillingGraceEndPeriods, - ]); + }, [policy, isAccountLocked, isUserValidated, chatReportID, reportID, showLockedAccountModal, isDelegateAccessRestricted, showDelegateNoAccessModal, userBillingGraceEndPeriods]); const getPaymentSubItems = useCallback( (payAsBusiness: boolean) => {