@bunnyapp/components 1.8.0-beta.11 → 1.8.0-beta.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +28 -12
- package/dist/cjs/types/src/components/PaymentForm/context/PaymentProvider.d.ts +8 -0
- package/dist/cjs/types/src/components/Subscriptions/Upgrade/PlanPicker/planPickerDesktop/priceListCardDesktop/addonPlans/fragments/AddonPlans_PlanFragment.d.ts +3 -0
- package/dist/esm/index.js +28 -12
- package/dist/esm/types/src/components/PaymentForm/context/PaymentProvider.d.ts +8 -0
- package/dist/esm/types/src/components/Subscriptions/Upgrade/PlanPicker/planPickerDesktop/priceListCardDesktop/addonPlans/fragments/AddonPlans_PlanFragment.d.ts +3 -0
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -1283,7 +1283,7 @@ const DEFAULT_CONFIG = {
|
|
|
1283
1283
|
};
|
|
1284
1284
|
|
|
1285
1285
|
// This will be replaced at build time by rollup-plugin-replace
|
|
1286
|
-
const PACKAGE_VERSION = '1.8.0-beta.
|
|
1286
|
+
const PACKAGE_VERSION = '1.8.0-beta.12';
|
|
1287
1287
|
const createRequestHeaders = (token) => {
|
|
1288
1288
|
const headers = createClientDevHeaders({ token });
|
|
1289
1289
|
// Add the components version header
|
|
@@ -20561,6 +20561,8 @@ function PaymentProvider({ children, quote: maskedQuote, invoice: maskedInvoice,
|
|
|
20561
20561
|
const invoice = readFragment(PaymentProvider_InvoiceFragment, maskedInvoice);
|
|
20562
20562
|
// State
|
|
20563
20563
|
const [isPaid, setIsPaid] = react.useState(false);
|
|
20564
|
+
const [isPaying, setIsPaying] = react.useState(false);
|
|
20565
|
+
const [isApprovingHold, setIsApprovingHold] = react.useState(false);
|
|
20564
20566
|
const getAmountDue = () => {
|
|
20565
20567
|
return quote ? getQuoteAmountDue(quote) : invoice === null || invoice === void 0 ? void 0 : invoice.amountDue;
|
|
20566
20568
|
};
|
|
@@ -20596,7 +20598,11 @@ function PaymentProvider({ children, quote: maskedQuote, invoice: maskedInvoice,
|
|
|
20596
20598
|
amountDue: amountDue !== null && amountDue !== void 0 ? amountDue : undefined,
|
|
20597
20599
|
formattedAmountDue: formattedAmountDueValue,
|
|
20598
20600
|
isPaid,
|
|
20599
|
-
setIsPaid
|
|
20601
|
+
setIsPaid,
|
|
20602
|
+
isPaying,
|
|
20603
|
+
setIsPaying,
|
|
20604
|
+
isApprovingHold,
|
|
20605
|
+
setIsApprovingHold,
|
|
20600
20606
|
}, children: children }));
|
|
20601
20607
|
}
|
|
20602
20608
|
|
|
@@ -21100,7 +21106,7 @@ function Pay(props = {}) {
|
|
|
21100
21106
|
const isMobile = useIsMobile();
|
|
21101
21107
|
const { onPaymentSuccess, onPaymentHoldSuccess, onSavePaymentMethod, paymentHoldPrecondition } = usePaymentFormCallbacks();
|
|
21102
21108
|
const selectedPlugin = useSelectedPlugin();
|
|
21103
|
-
const { quoteId, invoiceId, paymentHold, paymentType, setIsPaid } = usePayable();
|
|
21109
|
+
const { quoteId, invoiceId, paymentHold, paymentType, setIsPaid, setIsPaying, setIsApprovingHold } = usePayable();
|
|
21104
21110
|
const accountId = useAccountId();
|
|
21105
21111
|
const { defaultPaymentMethod } = usePaymentMethod({ accountId });
|
|
21106
21112
|
const [showPaymentDetailsForm, setShowPaymentDetailsForm] = useShowPaymentDetails();
|
|
@@ -21175,6 +21181,14 @@ function Pay(props = {}) {
|
|
|
21175
21181
|
return;
|
|
21176
21182
|
}
|
|
21177
21183
|
}
|
|
21184
|
+
react.useEffect(() => {
|
|
21185
|
+
setIsPaying(isPaying);
|
|
21186
|
+
return () => setIsPaying(false);
|
|
21187
|
+
}, [isPaying, setIsPaying]);
|
|
21188
|
+
react.useEffect(() => {
|
|
21189
|
+
setIsApprovingHold(isApprovingHold);
|
|
21190
|
+
return () => setIsApprovingHold(false);
|
|
21191
|
+
}, [isApprovingHold, setIsApprovingHold]);
|
|
21178
21192
|
return (jsxRuntime.jsx(antd.Button, { className: "bunny-w-full", disabled: isPaying || isApprovingHold || isSaving || disabled, loading: isPaying || isApprovingHold || isSaving, onClick: handlePayment, size: isMobile ? 'large' : 'middle', type: "primary", children: paymentButtonText }));
|
|
21179
21193
|
}
|
|
21180
21194
|
|
|
@@ -21331,6 +21345,7 @@ function PaymentMethodDetailsRoot(props = {}) {
|
|
|
21331
21345
|
const accountId = useAccountId();
|
|
21332
21346
|
const { paymentMethods } = usePaymentMethod({ accountId });
|
|
21333
21347
|
const { paymentPlugins } = usePaymentPlugins(accountId);
|
|
21348
|
+
const { isPaying, isApprovingHold } = usePayable();
|
|
21334
21349
|
function handleClickAddPaymentMethod() {
|
|
21335
21350
|
if ((paymentPlugins === null || paymentPlugins === void 0 ? void 0 : paymentPlugins.length) === 0) {
|
|
21336
21351
|
showErrorNotification$6('No payment plugins available', 'Error adding payment method');
|
|
@@ -21349,7 +21364,7 @@ function PaymentMethodDetailsRoot(props = {}) {
|
|
|
21349
21364
|
{
|
|
21350
21365
|
key: '1',
|
|
21351
21366
|
showArrow: false,
|
|
21352
|
-
label: !showPaymentMethodForm ? (jsxRuntime.jsx("div", { className: "bunny-pt-2", children: jsxRuntime.jsx(antd.Button, { onClick: handleClickAddPaymentMethod, type: "default", className: "bunny-w-full", id: "addPaymentMethod", children: "Add payment method" }) })) : null,
|
|
21367
|
+
label: !showPaymentMethodForm ? (jsxRuntime.jsx("div", { className: "bunny-pt-2", children: jsxRuntime.jsx(antd.Button, { onClick: handleClickAddPaymentMethod, type: "default", className: "bunny-w-full", id: "addPaymentMethod", disabled: isPaying || isApprovingHold, children: "Add payment method" }) })) : null,
|
|
21353
21368
|
children: (jsxRuntime.jsxs("div", { className: "bunny-flex bunny-flex-col bunny-gap-2 bunny-mt-2", children: [jsxRuntime.jsx(PaymentMethodSelector, {}), selectedPlugin && (jsxRuntime.jsx("div", { className: "bunny-flex bunny-flex-col", children: getPaymentMethodForm((_b = (_a = selectedPlugin.components) === null || _a === void 0 ? void 0 : _a.frontend) === null || _b === void 0 ? void 0 : _b[0].name) })), footer] })),
|
|
21354
21369
|
},
|
|
21355
21370
|
] }) }));
|
|
@@ -21474,11 +21489,9 @@ function PaymentFormRoot({ currencyId: accountCurrencyId, invoice: maskedInvoice
|
|
|
21474
21489
|
}
|
|
21475
21490
|
// Default layout that uses PaymentFormRoot under the hood when no children are provided.
|
|
21476
21491
|
function PaymentFormDefault(props) {
|
|
21477
|
-
console.log('PaymentFormDefault', props);
|
|
21478
21492
|
return jsxRuntime.jsx(PaymentFormRoot, { ...props, children: ({ hasPaymentMethods, isPaymentMethodDetailsOpen, isPayableAvailable, amountDue }) => {
|
|
21479
21493
|
const showPayButton = amountDue !== undefined && amountDue > 0 && !isPaymentMethodDetailsOpen && hasPaymentMethods;
|
|
21480
21494
|
const checkoutNoPaymentButton = amountDue !== undefined && amountDue === 0;
|
|
21481
|
-
console.log('props.disablePayButton', props.disablePayButton);
|
|
21482
21495
|
if (checkoutNoPaymentButton) {
|
|
21483
21496
|
return jsxRuntime.jsx(PaymentForm.CheckoutNoPayment, { className: "bunny-px-4", disabled: props.disablePayButton });
|
|
21484
21497
|
}
|
|
@@ -24388,11 +24401,11 @@ function useQuantityEditableCharges({ upgradingSubscription: maskedUpgradingSubs
|
|
|
24388
24401
|
// 2. Get all quote charges
|
|
24389
24402
|
// We cannot edit adjustment charges so filter them out.
|
|
24390
24403
|
const nonAdjustmentQuoteChanges = (_d = quote === null || quote === void 0 ? void 0 : quote.quoteChanges) === null || _d === void 0 ? void 0 : _d.filter(qc => qc.kind !== 'ADJUSTMENT');
|
|
24391
|
-
const
|
|
24392
|
-
// 3. Filter out
|
|
24404
|
+
const allCharges = (_e = nonAdjustmentQuoteChanges === null || nonAdjustmentQuoteChanges === void 0 ? void 0 : nonAdjustmentQuoteChanges.flatMap(qc => qc.charges.flatMap(charge => charge === null || charge === void 0 ? void 0 : charge.priceListCharge)).filter(c => c !== null)) !== null && _e !== void 0 ? _e : [];
|
|
24405
|
+
// 3. Filter out charges that are already in the subscription (duplicates)
|
|
24393
24406
|
const allSubscriptionChargeIds = new Set(allSubscriptionCharges === null || allSubscriptionCharges === void 0 ? void 0 : allSubscriptionCharges.map(c => c === null || c === void 0 ? void 0 : c.id));
|
|
24394
|
-
const
|
|
24395
|
-
return [...allSubscriptionCharges, ...
|
|
24407
|
+
const filteredCharges = allCharges === null || allCharges === void 0 ? void 0 : allCharges.filter(charge => !allSubscriptionChargeIds.has(charge === null || charge === void 0 ? void 0 : charge.id));
|
|
24408
|
+
return [...allSubscriptionCharges, ...filteredCharges];
|
|
24396
24409
|
}, [upgradingSubscription, quote, pricelistId]);
|
|
24397
24410
|
/**
|
|
24398
24411
|
* Rules for when pricelist charges can be edited:
|
|
@@ -24425,7 +24438,7 @@ function useQuantityEditableCharges({ upgradingSubscription: maskedUpgradingSubs
|
|
|
24425
24438
|
return true;
|
|
24426
24439
|
});
|
|
24427
24440
|
return thirdPassCharges !== null && thirdPassCharges !== void 0 ? thirdPassCharges : [];
|
|
24428
|
-
}, [selectedPriceListQuoteChange]);
|
|
24441
|
+
}, [selectedPriceListQuoteChange, priceListCharges]);
|
|
24429
24442
|
/**
|
|
24430
24443
|
* Find a subscription charge by price list charge ID
|
|
24431
24444
|
* @param priceListChargeId - The ID of the price list charge to find
|
|
@@ -27485,6 +27498,9 @@ const AddonPlans_PlanFragment = t(`
|
|
|
27485
27498
|
id
|
|
27486
27499
|
name
|
|
27487
27500
|
periodMonths
|
|
27501
|
+
plan {
|
|
27502
|
+
selfServiceBuy
|
|
27503
|
+
}
|
|
27488
27504
|
...AddonPlanModal_PriceListFragment
|
|
27489
27505
|
...AddonPlanRow_PriceListFragment
|
|
27490
27506
|
}
|
|
@@ -27536,7 +27552,7 @@ const AddonPlans = ({ selectedPriceList, subscriptions, selectedBillingPeriod, c
|
|
|
27536
27552
|
const addonPlans = maskedAddonPlans === null || maskedAddonPlans === void 0 ? void 0 : maskedAddonPlans.map(maskedAddonPlan => readFragment(AddonPlans_PlanFragment, maskedAddonPlan));
|
|
27537
27553
|
// Derived state
|
|
27538
27554
|
const addonPriceLists = addonPlans
|
|
27539
|
-
? getAddonsForBillingPeriod(selectedBillingPeriod, addonPlans)
|
|
27555
|
+
? getAddonsForBillingPeriod(selectedBillingPeriod, addonPlans).filter(priceList => { var _a; return (_a = priceList.plan) === null || _a === void 0 ? void 0 : _a.selfServiceBuy; })
|
|
27540
27556
|
: [];
|
|
27541
27557
|
const selectedAddonPriceList = addonPriceLists.find(priceList => priceList.id === selectedAddonPriceListId);
|
|
27542
27558
|
function isAddonPriceListPurchased(priceList) {
|
|
@@ -13,6 +13,10 @@ declare const PayableProvider: ({ value, children }: {
|
|
|
13
13
|
formattedAmountDue: string | undefined;
|
|
14
14
|
isPaid: boolean;
|
|
15
15
|
setIsPaid: React.Dispatch<React.SetStateAction<boolean>>;
|
|
16
|
+
isPaying: boolean;
|
|
17
|
+
setIsPaying: React.Dispatch<React.SetStateAction<boolean>>;
|
|
18
|
+
isApprovingHold: boolean;
|
|
19
|
+
setIsApprovingHold: React.Dispatch<React.SetStateAction<boolean>>;
|
|
16
20
|
};
|
|
17
21
|
children?: import("react").ReactNode;
|
|
18
22
|
}) => import("react/jsx-runtime").JSX.Element, usePayable: () => {
|
|
@@ -27,6 +31,10 @@ declare const PayableProvider: ({ value, children }: {
|
|
|
27
31
|
formattedAmountDue: string | undefined;
|
|
28
32
|
isPaid: boolean;
|
|
29
33
|
setIsPaid: React.Dispatch<React.SetStateAction<boolean>>;
|
|
34
|
+
isPaying: boolean;
|
|
35
|
+
setIsPaying: React.Dispatch<React.SetStateAction<boolean>>;
|
|
36
|
+
isApprovingHold: boolean;
|
|
37
|
+
setIsApprovingHold: React.Dispatch<React.SetStateAction<boolean>>;
|
|
30
38
|
};
|
|
31
39
|
export { PayableProvider, usePayable, };
|
|
32
40
|
export declare const PaymentProvider_QuoteFragment: import("gql.tada").TadaDocumentNode<{
|
|
@@ -5,6 +5,9 @@ export declare const AddonPlans_PlanFragment: import("gql.tada").TadaDocumentNod
|
|
|
5
5
|
id: string;
|
|
6
6
|
name: string;
|
|
7
7
|
periodMonths: number | null;
|
|
8
|
+
plan: {
|
|
9
|
+
selfServiceBuy: boolean | null;
|
|
10
|
+
} | null;
|
|
8
11
|
[$tada.fragmentRefs]: {
|
|
9
12
|
AddonPlanModal_PriceListFragment: "PriceList";
|
|
10
13
|
} & {
|
package/dist/esm/index.js
CHANGED
|
@@ -1281,7 +1281,7 @@ const DEFAULT_CONFIG = {
|
|
|
1281
1281
|
};
|
|
1282
1282
|
|
|
1283
1283
|
// This will be replaced at build time by rollup-plugin-replace
|
|
1284
|
-
const PACKAGE_VERSION = '1.8.0-beta.
|
|
1284
|
+
const PACKAGE_VERSION = '1.8.0-beta.12';
|
|
1285
1285
|
const createRequestHeaders = (token) => {
|
|
1286
1286
|
const headers = createClientDevHeaders({ token });
|
|
1287
1287
|
// Add the components version header
|
|
@@ -20559,6 +20559,8 @@ function PaymentProvider({ children, quote: maskedQuote, invoice: maskedInvoice,
|
|
|
20559
20559
|
const invoice = readFragment(PaymentProvider_InvoiceFragment, maskedInvoice);
|
|
20560
20560
|
// State
|
|
20561
20561
|
const [isPaid, setIsPaid] = useState(false);
|
|
20562
|
+
const [isPaying, setIsPaying] = useState(false);
|
|
20563
|
+
const [isApprovingHold, setIsApprovingHold] = useState(false);
|
|
20562
20564
|
const getAmountDue = () => {
|
|
20563
20565
|
return quote ? getQuoteAmountDue(quote) : invoice === null || invoice === void 0 ? void 0 : invoice.amountDue;
|
|
20564
20566
|
};
|
|
@@ -20594,7 +20596,11 @@ function PaymentProvider({ children, quote: maskedQuote, invoice: maskedInvoice,
|
|
|
20594
20596
|
amountDue: amountDue !== null && amountDue !== void 0 ? amountDue : undefined,
|
|
20595
20597
|
formattedAmountDue: formattedAmountDueValue,
|
|
20596
20598
|
isPaid,
|
|
20597
|
-
setIsPaid
|
|
20599
|
+
setIsPaid,
|
|
20600
|
+
isPaying,
|
|
20601
|
+
setIsPaying,
|
|
20602
|
+
isApprovingHold,
|
|
20603
|
+
setIsApprovingHold,
|
|
20598
20604
|
}, children: children }));
|
|
20599
20605
|
}
|
|
20600
20606
|
|
|
@@ -21098,7 +21104,7 @@ function Pay(props = {}) {
|
|
|
21098
21104
|
const isMobile = useIsMobile();
|
|
21099
21105
|
const { onPaymentSuccess, onPaymentHoldSuccess, onSavePaymentMethod, paymentHoldPrecondition } = usePaymentFormCallbacks();
|
|
21100
21106
|
const selectedPlugin = useSelectedPlugin();
|
|
21101
|
-
const { quoteId, invoiceId, paymentHold, paymentType, setIsPaid } = usePayable();
|
|
21107
|
+
const { quoteId, invoiceId, paymentHold, paymentType, setIsPaid, setIsPaying, setIsApprovingHold } = usePayable();
|
|
21102
21108
|
const accountId = useAccountId();
|
|
21103
21109
|
const { defaultPaymentMethod } = usePaymentMethod({ accountId });
|
|
21104
21110
|
const [showPaymentDetailsForm, setShowPaymentDetailsForm] = useShowPaymentDetails();
|
|
@@ -21173,6 +21179,14 @@ function Pay(props = {}) {
|
|
|
21173
21179
|
return;
|
|
21174
21180
|
}
|
|
21175
21181
|
}
|
|
21182
|
+
useEffect(() => {
|
|
21183
|
+
setIsPaying(isPaying);
|
|
21184
|
+
return () => setIsPaying(false);
|
|
21185
|
+
}, [isPaying, setIsPaying]);
|
|
21186
|
+
useEffect(() => {
|
|
21187
|
+
setIsApprovingHold(isApprovingHold);
|
|
21188
|
+
return () => setIsApprovingHold(false);
|
|
21189
|
+
}, [isApprovingHold, setIsApprovingHold]);
|
|
21176
21190
|
return (jsx(Button, { className: "bunny-w-full", disabled: isPaying || isApprovingHold || isSaving || disabled, loading: isPaying || isApprovingHold || isSaving, onClick: handlePayment, size: isMobile ? 'large' : 'middle', type: "primary", children: paymentButtonText }));
|
|
21177
21191
|
}
|
|
21178
21192
|
|
|
@@ -21329,6 +21343,7 @@ function PaymentMethodDetailsRoot(props = {}) {
|
|
|
21329
21343
|
const accountId = useAccountId();
|
|
21330
21344
|
const { paymentMethods } = usePaymentMethod({ accountId });
|
|
21331
21345
|
const { paymentPlugins } = usePaymentPlugins(accountId);
|
|
21346
|
+
const { isPaying, isApprovingHold } = usePayable();
|
|
21332
21347
|
function handleClickAddPaymentMethod() {
|
|
21333
21348
|
if ((paymentPlugins === null || paymentPlugins === void 0 ? void 0 : paymentPlugins.length) === 0) {
|
|
21334
21349
|
showErrorNotification$6('No payment plugins available', 'Error adding payment method');
|
|
@@ -21347,7 +21362,7 @@ function PaymentMethodDetailsRoot(props = {}) {
|
|
|
21347
21362
|
{
|
|
21348
21363
|
key: '1',
|
|
21349
21364
|
showArrow: false,
|
|
21350
|
-
label: !showPaymentMethodForm ? (jsx("div", { className: "bunny-pt-2", children: jsx(Button, { onClick: handleClickAddPaymentMethod, type: "default", className: "bunny-w-full", id: "addPaymentMethod", children: "Add payment method" }) })) : null,
|
|
21365
|
+
label: !showPaymentMethodForm ? (jsx("div", { className: "bunny-pt-2", children: jsx(Button, { onClick: handleClickAddPaymentMethod, type: "default", className: "bunny-w-full", id: "addPaymentMethod", disabled: isPaying || isApprovingHold, children: "Add payment method" }) })) : null,
|
|
21351
21366
|
children: (jsxs("div", { className: "bunny-flex bunny-flex-col bunny-gap-2 bunny-mt-2", children: [jsx(PaymentMethodSelector, {}), selectedPlugin && (jsx("div", { className: "bunny-flex bunny-flex-col", children: getPaymentMethodForm((_b = (_a = selectedPlugin.components) === null || _a === void 0 ? void 0 : _a.frontend) === null || _b === void 0 ? void 0 : _b[0].name) })), footer] })),
|
|
21352
21367
|
},
|
|
21353
21368
|
] }) }));
|
|
@@ -21472,11 +21487,9 @@ function PaymentFormRoot({ currencyId: accountCurrencyId, invoice: maskedInvoice
|
|
|
21472
21487
|
}
|
|
21473
21488
|
// Default layout that uses PaymentFormRoot under the hood when no children are provided.
|
|
21474
21489
|
function PaymentFormDefault(props) {
|
|
21475
|
-
console.log('PaymentFormDefault', props);
|
|
21476
21490
|
return jsx(PaymentFormRoot, { ...props, children: ({ hasPaymentMethods, isPaymentMethodDetailsOpen, isPayableAvailable, amountDue }) => {
|
|
21477
21491
|
const showPayButton = amountDue !== undefined && amountDue > 0 && !isPaymentMethodDetailsOpen && hasPaymentMethods;
|
|
21478
21492
|
const checkoutNoPaymentButton = amountDue !== undefined && amountDue === 0;
|
|
21479
|
-
console.log('props.disablePayButton', props.disablePayButton);
|
|
21480
21493
|
if (checkoutNoPaymentButton) {
|
|
21481
21494
|
return jsx(PaymentForm.CheckoutNoPayment, { className: "bunny-px-4", disabled: props.disablePayButton });
|
|
21482
21495
|
}
|
|
@@ -24386,11 +24399,11 @@ function useQuantityEditableCharges({ upgradingSubscription: maskedUpgradingSubs
|
|
|
24386
24399
|
// 2. Get all quote charges
|
|
24387
24400
|
// We cannot edit adjustment charges so filter them out.
|
|
24388
24401
|
const nonAdjustmentQuoteChanges = (_d = quote === null || quote === void 0 ? void 0 : quote.quoteChanges) === null || _d === void 0 ? void 0 : _d.filter(qc => qc.kind !== 'ADJUSTMENT');
|
|
24389
|
-
const
|
|
24390
|
-
// 3. Filter out
|
|
24402
|
+
const allCharges = (_e = nonAdjustmentQuoteChanges === null || nonAdjustmentQuoteChanges === void 0 ? void 0 : nonAdjustmentQuoteChanges.flatMap(qc => qc.charges.flatMap(charge => charge === null || charge === void 0 ? void 0 : charge.priceListCharge)).filter(c => c !== null)) !== null && _e !== void 0 ? _e : [];
|
|
24403
|
+
// 3. Filter out charges that are already in the subscription (duplicates)
|
|
24391
24404
|
const allSubscriptionChargeIds = new Set(allSubscriptionCharges === null || allSubscriptionCharges === void 0 ? void 0 : allSubscriptionCharges.map(c => c === null || c === void 0 ? void 0 : c.id));
|
|
24392
|
-
const
|
|
24393
|
-
return [...allSubscriptionCharges, ...
|
|
24405
|
+
const filteredCharges = allCharges === null || allCharges === void 0 ? void 0 : allCharges.filter(charge => !allSubscriptionChargeIds.has(charge === null || charge === void 0 ? void 0 : charge.id));
|
|
24406
|
+
return [...allSubscriptionCharges, ...filteredCharges];
|
|
24394
24407
|
}, [upgradingSubscription, quote, pricelistId]);
|
|
24395
24408
|
/**
|
|
24396
24409
|
* Rules for when pricelist charges can be edited:
|
|
@@ -24423,7 +24436,7 @@ function useQuantityEditableCharges({ upgradingSubscription: maskedUpgradingSubs
|
|
|
24423
24436
|
return true;
|
|
24424
24437
|
});
|
|
24425
24438
|
return thirdPassCharges !== null && thirdPassCharges !== void 0 ? thirdPassCharges : [];
|
|
24426
|
-
}, [selectedPriceListQuoteChange]);
|
|
24439
|
+
}, [selectedPriceListQuoteChange, priceListCharges]);
|
|
24427
24440
|
/**
|
|
24428
24441
|
* Find a subscription charge by price list charge ID
|
|
24429
24442
|
* @param priceListChargeId - The ID of the price list charge to find
|
|
@@ -27483,6 +27496,9 @@ const AddonPlans_PlanFragment = t(`
|
|
|
27483
27496
|
id
|
|
27484
27497
|
name
|
|
27485
27498
|
periodMonths
|
|
27499
|
+
plan {
|
|
27500
|
+
selfServiceBuy
|
|
27501
|
+
}
|
|
27486
27502
|
...AddonPlanModal_PriceListFragment
|
|
27487
27503
|
...AddonPlanRow_PriceListFragment
|
|
27488
27504
|
}
|
|
@@ -27534,7 +27550,7 @@ const AddonPlans = ({ selectedPriceList, subscriptions, selectedBillingPeriod, c
|
|
|
27534
27550
|
const addonPlans = maskedAddonPlans === null || maskedAddonPlans === void 0 ? void 0 : maskedAddonPlans.map(maskedAddonPlan => readFragment(AddonPlans_PlanFragment, maskedAddonPlan));
|
|
27535
27551
|
// Derived state
|
|
27536
27552
|
const addonPriceLists = addonPlans
|
|
27537
|
-
? getAddonsForBillingPeriod(selectedBillingPeriod, addonPlans)
|
|
27553
|
+
? getAddonsForBillingPeriod(selectedBillingPeriod, addonPlans).filter(priceList => { var _a; return (_a = priceList.plan) === null || _a === void 0 ? void 0 : _a.selfServiceBuy; })
|
|
27538
27554
|
: [];
|
|
27539
27555
|
const selectedAddonPriceList = addonPriceLists.find(priceList => priceList.id === selectedAddonPriceListId);
|
|
27540
27556
|
function isAddonPriceListPurchased(priceList) {
|
|
@@ -13,6 +13,10 @@ declare const PayableProvider: ({ value, children }: {
|
|
|
13
13
|
formattedAmountDue: string | undefined;
|
|
14
14
|
isPaid: boolean;
|
|
15
15
|
setIsPaid: React.Dispatch<React.SetStateAction<boolean>>;
|
|
16
|
+
isPaying: boolean;
|
|
17
|
+
setIsPaying: React.Dispatch<React.SetStateAction<boolean>>;
|
|
18
|
+
isApprovingHold: boolean;
|
|
19
|
+
setIsApprovingHold: React.Dispatch<React.SetStateAction<boolean>>;
|
|
16
20
|
};
|
|
17
21
|
children?: import("react").ReactNode;
|
|
18
22
|
}) => import("react/jsx-runtime").JSX.Element, usePayable: () => {
|
|
@@ -27,6 +31,10 @@ declare const PayableProvider: ({ value, children }: {
|
|
|
27
31
|
formattedAmountDue: string | undefined;
|
|
28
32
|
isPaid: boolean;
|
|
29
33
|
setIsPaid: React.Dispatch<React.SetStateAction<boolean>>;
|
|
34
|
+
isPaying: boolean;
|
|
35
|
+
setIsPaying: React.Dispatch<React.SetStateAction<boolean>>;
|
|
36
|
+
isApprovingHold: boolean;
|
|
37
|
+
setIsApprovingHold: React.Dispatch<React.SetStateAction<boolean>>;
|
|
30
38
|
};
|
|
31
39
|
export { PayableProvider, usePayable, };
|
|
32
40
|
export declare const PaymentProvider_QuoteFragment: import("gql.tada").TadaDocumentNode<{
|
|
@@ -5,6 +5,9 @@ export declare const AddonPlans_PlanFragment: import("gql.tada").TadaDocumentNod
|
|
|
5
5
|
id: string;
|
|
6
6
|
name: string;
|
|
7
7
|
periodMonths: number | null;
|
|
8
|
+
plan: {
|
|
9
|
+
selfServiceBuy: boolean | null;
|
|
10
|
+
} | null;
|
|
8
11
|
[$tada.fragmentRefs]: {
|
|
9
12
|
AddonPlanModal_PriceListFragment: "PriceList";
|
|
10
13
|
} & {
|
package/package.json
CHANGED