@bunnyapp/components 1.7.0-beta.12 → 1.7.0-beta.15
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 +49 -24
- package/dist/cjs/types/src/components/BillingDetails/BillingDetails.d.ts +3 -2
- package/dist/cjs/types/src/components/Invoice/Invoice.d.ts +3 -1
- package/dist/cjs/types/src/components/PaymentForm/PaymentForm.d.ts +5 -2
- package/dist/cjs/types/src/components/PaymentForm/fragments/PaymentForm_PaymentMethodsFragment.d.ts +3 -0
- package/dist/cjs/types/src/components/PaymentForm/hooks/useRemovePaymentMethod.d.ts +4 -1
- package/dist/cjs/types/src/components/Subscriptions/Subscriptions.d.ts +3 -1
- package/dist/cjs/types/src/components/Subscriptions/Upgrade/Upgrade.d.ts +3 -1
- package/dist/cjs/types/src/contexts/onPaymentMethodRemoved.d.ts +5 -0
- package/dist/cjs/types/src/contexts/onPaymentMethodSaved.d.ts +5 -0
- package/dist/esm/index.js +49 -24
- package/dist/esm/types/src/components/BillingDetails/BillingDetails.d.ts +3 -2
- package/dist/esm/types/src/components/Invoice/Invoice.d.ts +3 -1
- package/dist/esm/types/src/components/PaymentForm/PaymentForm.d.ts +5 -2
- package/dist/esm/types/src/components/PaymentForm/fragments/PaymentForm_PaymentMethodsFragment.d.ts +3 -0
- package/dist/esm/types/src/components/PaymentForm/hooks/useRemovePaymentMethod.d.ts +4 -1
- package/dist/esm/types/src/components/Subscriptions/Subscriptions.d.ts +3 -1
- package/dist/esm/types/src/components/Subscriptions/Upgrade/Upgrade.d.ts +3 -1
- package/dist/esm/types/src/contexts/onPaymentMethodRemoved.d.ts +5 -0
- package/dist/esm/types/src/contexts/onPaymentMethodSaved.d.ts +5 -0
- package/dist/index.d.ts +29 -7
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -1280,7 +1280,7 @@ const DEFAULT_CONFIG = {
|
|
|
1280
1280
|
};
|
|
1281
1281
|
|
|
1282
1282
|
// This will be replaced at build time by rollup-plugin-replace
|
|
1283
|
-
const PACKAGE_VERSION = '1.7.0-beta.
|
|
1283
|
+
const PACKAGE_VERSION = '1.7.0-beta.14';
|
|
1284
1284
|
const createRequestHeaders = (token) => {
|
|
1285
1285
|
const headers = createClientDevHeaders({ token });
|
|
1286
1286
|
// Add the components version header
|
|
@@ -19759,6 +19759,9 @@ const PaymentForm_PaymentMethodsFragment = t(`
|
|
|
19759
19759
|
fragment PaymentForm_PaymentMethodsFragment on PaymentMethod {
|
|
19760
19760
|
...MiniCreditCard_PaymentMethodFragment
|
|
19761
19761
|
id
|
|
19762
|
+
plugin {
|
|
19763
|
+
id
|
|
19764
|
+
}
|
|
19762
19765
|
}
|
|
19763
19766
|
`, [MiniCreditCard_PaymentMethodFragment]);
|
|
19764
19767
|
|
|
@@ -21139,7 +21142,7 @@ function useRemovePaymentMethod(onRemovePaymentMethod, onError) {
|
|
|
21139
21142
|
const token = useToken();
|
|
21140
21143
|
const { apiHost } = react.useContext(BunnyContext);
|
|
21141
21144
|
const removePaymentMethod = react.useCallback(async (data) => {
|
|
21142
|
-
const plugin = paymentPlugins === null || paymentPlugins === void 0 ? void 0 : paymentPlugins.find(paymentPlugin => { var _a; return String(paymentPlugin.id) === ((_a = data === null || data === void 0 ? void 0 : data.plugin) === null || _a === void 0 ? void 0 : _a.id); });
|
|
21145
|
+
const plugin = paymentPlugins === null || paymentPlugins === void 0 ? void 0 : paymentPlugins.find(paymentPlugin => { var _a; return String(paymentPlugin.id) === String((_a = data === null || data === void 0 ? void 0 : data.plugin) === null || _a === void 0 ? void 0 : _a.id); });
|
|
21143
21146
|
if (data && plugin) {
|
|
21144
21147
|
await invokePlugin({
|
|
21145
21148
|
plugin: plugin, // TODO: type the plugin
|
|
@@ -21159,17 +21162,21 @@ function useRemovePaymentMethod(onRemovePaymentMethod, onError) {
|
|
|
21159
21162
|
accountId,
|
|
21160
21163
|
}),
|
|
21161
21164
|
});
|
|
21162
|
-
onRemovePaymentMethod === null || onRemovePaymentMethod === void 0 ? void 0 : onRemovePaymentMethod();
|
|
21165
|
+
onRemovePaymentMethod === null || onRemovePaymentMethod === void 0 ? void 0 : onRemovePaymentMethod(data);
|
|
21163
21166
|
})
|
|
21164
21167
|
.catch((error) => {
|
|
21165
21168
|
showErrorNotification(error.message, 'Error removing payment method');
|
|
21166
21169
|
});
|
|
21167
21170
|
}
|
|
21168
21171
|
else {
|
|
21169
|
-
const availablePlugins = paymentPlugins === null || paymentPlugins === void 0 ? void 0 : paymentPlugins.map(
|
|
21172
|
+
const availablePlugins = paymentPlugins === null || paymentPlugins === void 0 ? void 0 : paymentPlugins.map(plugin => {
|
|
21173
|
+
var _a, _b;
|
|
21174
|
+
const components = plugin.components;
|
|
21175
|
+
return (_b = (_a = components === null || components === void 0 ? void 0 : components.frontend) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.name;
|
|
21176
|
+
});
|
|
21170
21177
|
onError === null || onError === void 0 ? void 0 : onError(`Either the payment method was not found or the plugin was not present. Available plugins: ${availablePlugins === null || availablePlugins === void 0 ? void 0 : availablePlugins.join(', ')}`);
|
|
21171
21178
|
}
|
|
21172
|
-
}, [paymentPlugins, token, apiHost, queryClient]);
|
|
21179
|
+
}, [paymentPlugins, token, apiHost, queryClient, onRemovePaymentMethod, accountId, onError]);
|
|
21173
21180
|
return removePaymentMethod;
|
|
21174
21181
|
}
|
|
21175
21182
|
|
|
@@ -21504,7 +21511,7 @@ const InvoiceQuoteView = ({ children, formattedInvoice, html, backButtonName, on
|
|
|
21504
21511
|
}, children: [targetUrl ? (jsxRuntime.jsx(DocumentTemplatePreview, { targetUrl: targetUrl })) : (jsxRuntime.jsx(interweave.Markup, { content: html })), children] }))] }));
|
|
21505
21512
|
};
|
|
21506
21513
|
|
|
21507
|
-
function Invoice({ id, invoiceQuoteViewComponent, backButtonName, onBackButtonClick, onInvoiceDownloadError, onPaymentSuccess, shadow = 'shadow-md', className, hideDownloadButton = false, hidePaymentForm = false, onInvoiceLoaded, }) {
|
|
21514
|
+
function Invoice({ id, invoiceQuoteViewComponent, backButtonName, onBackButtonClick, onInvoiceDownloadError, onPaymentSuccess, shadow = 'shadow-md', className, hideDownloadButton = false, hidePaymentForm = false, onInvoiceLoaded, onPaymentMethodSaved, onPaymentMethodRemoved, }) {
|
|
21508
21515
|
return (jsxRuntime.jsx(InvoiceQuoteContext.Provider, { value: {
|
|
21509
21516
|
id,
|
|
21510
21517
|
invoiceQuoteViewComponent,
|
|
@@ -21516,9 +21523,9 @@ function Invoice({ id, invoiceQuoteViewComponent, backButtonName, onBackButtonCl
|
|
|
21516
21523
|
className,
|
|
21517
21524
|
hideDownloadButton,
|
|
21518
21525
|
onInvoiceLoaded,
|
|
21519
|
-
}, children: jsxRuntime.jsx(ActualInvoice, { hidePaymentForm: hidePaymentForm }) }));
|
|
21526
|
+
}, children: jsxRuntime.jsx(ActualInvoice, { hidePaymentForm: hidePaymentForm, onSavePaymentMethod: onPaymentMethodSaved, onRemovePaymentMethod: onPaymentMethodRemoved }) }));
|
|
21520
21527
|
}
|
|
21521
|
-
function ActualInvoice({ hidePaymentForm }) {
|
|
21528
|
+
function ActualInvoice({ hidePaymentForm, onSavePaymentMethod, onRemovePaymentMethod }) {
|
|
21522
21529
|
// Context
|
|
21523
21530
|
const queryClient = reactQuery.useQueryClient();
|
|
21524
21531
|
const { id, invoiceQuoteViewComponent, backButtonName, onBackButtonClick, onPaymentSuccess, className, } = react.useContext(InvoiceQuoteContext);
|
|
@@ -21556,7 +21563,11 @@ function ActualInvoice({ hidePaymentForm }) {
|
|
|
21556
21563
|
}, [formattedInvoice]);
|
|
21557
21564
|
if (!formattedInvoice)
|
|
21558
21565
|
return jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
21559
|
-
return (jsxRuntime.jsx("div", { className: "bunny-invoice-container", children: jsxRuntime.jsxs("div", { className: `bunny-flex bunny-gap-6 ${isMobile ? 'bunny-flex-col bunny-w-full' : ''} ${className}`, children: [formattedInvoice.isLegacy ? (jsxRuntime.jsx("div", { className: "bunny-flex bunny-justify-center bunny-w-full", children: jsxRuntime.jsx(LegacyDocument, { documentUuid: formattedInvoice.uuid, documentType: "invoice" }) })) : (invoiceQuoteViewComponent || (jsxRuntime.jsx(InvoiceQuoteView, { html: formattedInvoice.html, formattedInvoice: formattedInvoice, backButtonName: backButtonName, onBackButtonClick: onBackButtonClick }))), isInvoicePayable && !hidePaymentForm && (jsxRuntime.jsx("div", { className: `bunny-w-full ${hideDownloadButton || formattedInvoice.isLegacy ? '' : 'pt-12'}`, children: jsxRuntime.jsx(PaymentForm, { onPaymentSuccess: handlePaymentSuccess, invoice: formattedInvoice
|
|
21566
|
+
return (jsxRuntime.jsx("div", { className: "bunny-invoice-container", children: jsxRuntime.jsxs("div", { className: `bunny-flex bunny-gap-6 ${isMobile ? 'bunny-flex-col bunny-w-full' : ''} ${className}`, children: [formattedInvoice.isLegacy ? (jsxRuntime.jsx("div", { className: "bunny-flex bunny-justify-center bunny-w-full", children: jsxRuntime.jsx(LegacyDocument, { documentUuid: formattedInvoice.uuid, documentType: "invoice" }) })) : (invoiceQuoteViewComponent || (jsxRuntime.jsx(InvoiceQuoteView, { html: formattedInvoice.html, formattedInvoice: formattedInvoice, backButtonName: backButtonName, onBackButtonClick: onBackButtonClick }))), isInvoicePayable && !hidePaymentForm && (jsxRuntime.jsx("div", { className: `bunny-w-full ${hideDownloadButton || formattedInvoice.isLegacy ? '' : 'pt-12'}`, children: jsxRuntime.jsx(PaymentForm, { onPaymentSuccess: handlePaymentSuccess, invoice: formattedInvoice, onSavePaymentMethod: (paymentMethodId) => {
|
|
21567
|
+
onSavePaymentMethod === null || onSavePaymentMethod === void 0 ? void 0 : onSavePaymentMethod(paymentMethodId);
|
|
21568
|
+
}, onRemovePaymentMethod: (paymentMethod) => {
|
|
21569
|
+
onRemovePaymentMethod === null || onRemovePaymentMethod === void 0 ? void 0 : onRemovePaymentMethod(paymentMethod.id);
|
|
21570
|
+
} }) }))] }) }));
|
|
21560
21571
|
}
|
|
21561
21572
|
|
|
21562
21573
|
const useFocusFirstInput = ({ firstInputRef, isVisible, }) => {
|
|
@@ -23468,6 +23479,12 @@ const FormBillingState = () => {
|
|
|
23468
23479
|
return (jsxRuntime.jsx(antd.Form.Item, { label: "Billing state", name: "billingState", rules: [{ required: billingStateRequired }], children: jsxRuntime.jsx(antd.Input, { placeholder: "State" }) }));
|
|
23469
23480
|
};
|
|
23470
23481
|
|
|
23482
|
+
const [OnPaymentMethodSavedProvider, useOnPaymentMethodSaved] = createValueContext();
|
|
23483
|
+
// This provider is used in all components that may save a payment method
|
|
23484
|
+
|
|
23485
|
+
const [OnPaymentMethodRemovedProvider, useOnPaymentMethodRemoved] = createValueContext();
|
|
23486
|
+
// This provider is used in all components that may remove a payment method
|
|
23487
|
+
|
|
23471
23488
|
const { Text: Text$o } = antd.Typography;
|
|
23472
23489
|
// HACK: I have imported QuoteFields_QuoteFragment here as a hack to ensure I have all of the quote data needed for
|
|
23473
23490
|
// the eventual children of this component.
|
|
@@ -23511,6 +23528,9 @@ const QuoteCheckout = ({ account, onSuccess, onFail, quote: maskedQuote, taxatio
|
|
|
23511
23528
|
// Read fragments
|
|
23512
23529
|
const quote = readFragment(QuoteCheckout_QuoteFragment, maskedQuote);
|
|
23513
23530
|
const upgradingSubscription = readFragment(QuoteCheckout_SubscriptionFragment, maskedUpgradingSubscription);
|
|
23531
|
+
// Context
|
|
23532
|
+
const onPaymentMethodSaved = useOnPaymentMethodSaved();
|
|
23533
|
+
const onPaymentMethodRemoved = useOnPaymentMethodRemoved();
|
|
23514
23534
|
const { apiHost } = react.useContext(BunnyContext);
|
|
23515
23535
|
const token = useToken();
|
|
23516
23536
|
const isMobile = useIsMobile();
|
|
@@ -23569,7 +23589,7 @@ const QuoteCheckout = ({ account, onSuccess, onFail, quote: maskedQuote, taxatio
|
|
|
23569
23589
|
}
|
|
23570
23590
|
if (taxationRequiredAccountFields)
|
|
23571
23591
|
return (jsxRuntime.jsx(PaymentFormWrapper, { setMaxHeight: false, children: jsxRuntime.jsx(TaxationForm, { account: account, accountId: quote.accountId }) }));
|
|
23572
|
-
return (jsxRuntime.jsx(PaymentFormWrapper, { setMaxHeight: false, children: paymentRequired ? (jsxRuntime.jsxs("div", { className: "bunny-flex bunny-flex-col bunny-gap-2 bunny-w-full", children: [jsxRuntime.jsx(PaymentForm, { onPaymentSuccess: onSuccess, quote: quote }), (couponsOnQuote === null || couponsOnQuote === void 0 ? void 0 : couponsOnQuote.length) === 0 ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: upgradingSubscription &&
|
|
23592
|
+
return (jsxRuntime.jsx(PaymentFormWrapper, { setMaxHeight: false, children: paymentRequired ? (jsxRuntime.jsxs("div", { className: "bunny-flex bunny-flex-col bunny-gap-2 bunny-w-full", children: [jsxRuntime.jsx(PaymentForm, { onPaymentSuccess: onSuccess, quote: quote, onSavePaymentMethod: (paymentMethod) => onPaymentMethodSaved === null || onPaymentMethodSaved === void 0 ? void 0 : onPaymentMethodSaved(paymentMethod.savedPaymentMethodResponse.paymentMethodId), onRemovePaymentMethod: (paymentMethod) => onPaymentMethodRemoved === null || onPaymentMethodRemoved === void 0 ? void 0 : onPaymentMethodRemoved(paymentMethod.id) }), (couponsOnQuote === null || couponsOnQuote === void 0 ? void 0 : couponsOnQuote.length) === 0 ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: upgradingSubscription &&
|
|
23573
23593
|
shouldShowCouponEditor(quote, activeCouponsExist, upgradingSubscription) && (jsxRuntime.jsx(CouponEditor, { className: "bunny-px-4 bunny-pt-1", onAddCoupon: addCoupon, isAddingCoupon: isAddingCoupon, couponCode: couponCode, setCouponCode: setCouponCode })) })) : (jsxRuntime.jsx(antd.Button, { type: "link", loading: isRemovingCoupon, onClick: () => {
|
|
23574
23594
|
couponsOnQuote === null || couponsOnQuote === void 0 ? void 0 : couponsOnQuote.forEach(couponCharge => {
|
|
23575
23595
|
var _a;
|
|
@@ -23609,6 +23629,9 @@ const Checkout = ({ onCancel, onSuccess, onFail, onRecalculateTaxes, invoice, op
|
|
|
23609
23629
|
const { apiHost } = react.useContext(BunnyContext);
|
|
23610
23630
|
const isMobile = useIsMobile();
|
|
23611
23631
|
const token = useToken();
|
|
23632
|
+
// Context
|
|
23633
|
+
const onPaymentMethodSaved = useOnPaymentMethodSaved();
|
|
23634
|
+
const onPaymentMethodRemoved = useOnPaymentMethodRemoved();
|
|
23612
23635
|
// Read fragments
|
|
23613
23636
|
const quote = readFragment(Checkout_QuoteFragment, maskedQuote);
|
|
23614
23637
|
const hasTaxPlugin = useHasTaxPlugin({
|
|
@@ -23657,13 +23680,13 @@ const Checkout = ({ onCancel, onSuccess, onFail, onRecalculateTaxes, invoice, op
|
|
|
23657
23680
|
return (jsxRuntime.jsx("div", { className: `bunny-flex bunny-flex-col bunny-fixed bunny-top-0 bunny-left-0 bunny-right-0 bunny-bottom-0 bunny-bg-slate-50
|
|
23658
23681
|
bunny-overflow-auto bunny-height-full`, style: {
|
|
23659
23682
|
zIndex: 1001,
|
|
23660
|
-
}, children: jsxRuntime.jsxs("div", { className: `bunny-flex bunny-flex-col bunny-grow bunny-pt-4 ${isMobile ? 'bunny-pb-4' : 'bunny-pb-8'} bunny-content-container`, children: [jsxRuntime.jsx("div", { className: "bunny-flex bunny-justify-end bunny-w-full bunny-pr-4", children: jsxRuntime.jsx(icons.CloseOutlined, { className: "bunny-text-base bunny-shadow-padding-xb", onClick: onCancel }) }), jsxRuntime.jsxs("div", { className: `bunny-flex bunny-justify-end bunny-pt-4 bunny-gap-4 ${isMobile ? 'bunny-flex-col' : 'bunny-shadow-padding-xb'}`, children: [((invoice === null || invoice === void 0 ? void 0 : invoice.html) || ((_b = quote === null || quote === void 0 ? void 0 : quote.formattedQuote) === null || _b === void 0 ? void 0 : _b.html)) && (jsxRuntime.jsx(InvoiceQuoteView, { html: invoice ? invoice.html : (_d = (_c = quote === null || quote === void 0 ? void 0 : quote.formattedQuote) === null || _c === void 0 ? void 0 : _c.html) !== null && _d !== void 0 ? _d : '' })), !isMobile && ((invoice === null || invoice === void 0 ? void 0 : invoice.html) || ((_e = quote === null || quote === void 0 ? void 0 : quote.formattedQuote) === null || _e === void 0 ? void 0 : _e.html)) && (jsxRuntime.jsx(antd.Divider, { className: "bunny-h-full", type: "vertical" })), invoice ? (jsxRuntime.jsx("div", { className: "bunny-w-full bunny-pt-12", children: jsxRuntime.jsx(PaymentForm, { onPaymentSuccess: onSuccess, invoice: invoice }) })) : quote ? (jsxRuntime.jsx(QuoteCheckout, { account: account, onFail: error => {
|
|
23683
|
+
}, children: jsxRuntime.jsxs("div", { className: `bunny-flex bunny-flex-col bunny-grow bunny-pt-4 ${isMobile ? 'bunny-pb-4' : 'bunny-pb-8'} bunny-content-container`, children: [jsxRuntime.jsx("div", { className: "bunny-flex bunny-justify-end bunny-w-full bunny-pr-4", children: jsxRuntime.jsx(icons.CloseOutlined, { className: "bunny-text-base bunny-shadow-padding-xb", onClick: onCancel }) }), jsxRuntime.jsxs("div", { className: `bunny-flex bunny-justify-end bunny-pt-4 bunny-gap-4 ${isMobile ? 'bunny-flex-col' : 'bunny-shadow-padding-xb'}`, children: [((invoice === null || invoice === void 0 ? void 0 : invoice.html) || ((_b = quote === null || quote === void 0 ? void 0 : quote.formattedQuote) === null || _b === void 0 ? void 0 : _b.html)) && (jsxRuntime.jsx(InvoiceQuoteView, { html: invoice ? invoice.html : (_d = (_c = quote === null || quote === void 0 ? void 0 : quote.formattedQuote) === null || _c === void 0 ? void 0 : _c.html) !== null && _d !== void 0 ? _d : '' })), !isMobile && ((invoice === null || invoice === void 0 ? void 0 : invoice.html) || ((_e = quote === null || quote === void 0 ? void 0 : quote.formattedQuote) === null || _e === void 0 ? void 0 : _e.html)) && (jsxRuntime.jsx(antd.Divider, { className: "bunny-h-full", type: "vertical" })), invoice ? (jsxRuntime.jsx("div", { className: "bunny-w-full bunny-pt-12", children: jsxRuntime.jsx(PaymentForm, { onPaymentSuccess: onSuccess, invoice: invoice, onSavePaymentMethod: (paymentMethod) => onPaymentMethodSaved === null || onPaymentMethodSaved === void 0 ? void 0 : onPaymentMethodSaved(paymentMethod.savedPaymentMethodResponse.paymentMethodId), onRemovePaymentMethod: (paymentMethod) => onPaymentMethodRemoved === null || onPaymentMethodRemoved === void 0 ? void 0 : onPaymentMethodRemoved(paymentMethod.id) }) })) : quote ? (jsxRuntime.jsx(QuoteCheckout, { account: account, onFail: error => {
|
|
23661
23684
|
onFail(error);
|
|
23662
23685
|
}, onSuccess: onSuccess, quote: quote, taxationRequiredAccountFields: taxationRequiredAccountFields, token: token, onRecalculateTaxes: async () => {
|
|
23663
23686
|
if (recalculateTaxesEnabled) {
|
|
23664
23687
|
await recalculateTaxes();
|
|
23665
23688
|
}
|
|
23666
|
-
} })) : (jsxRuntime.jsx(PaymentForm, { onPaymentSuccess: onSuccess }))] }), jsxRuntime.jsx(Footer, { className: "bunny-px-12" })] }) }));
|
|
23689
|
+
} })) : (jsxRuntime.jsx(PaymentForm, { onPaymentSuccess: onSuccess, onSavePaymentMethod: (paymentMethod) => onPaymentMethodSaved === null || onPaymentMethodSaved === void 0 ? void 0 : onPaymentMethodSaved(paymentMethod.savedPaymentMethodResponse.paymentMethodId), onRemovePaymentMethod: (paymentMethod) => onPaymentMethodRemoved === null || onPaymentMethodRemoved === void 0 ? void 0 : onPaymentMethodRemoved(paymentMethod.id) }))] }), jsxRuntime.jsx(Footer, { className: "bunny-px-12" })] }) }));
|
|
23667
23690
|
};
|
|
23668
23691
|
|
|
23669
23692
|
function canEditChargeQuantity(charge) {
|
|
@@ -26300,9 +26323,7 @@ const FeatureAddonsList_PriceListFragment = t(`
|
|
|
26300
26323
|
function FeatureAddonsList({ priceList: maskedPriceList, }) {
|
|
26301
26324
|
var _a;
|
|
26302
26325
|
const priceList = readFragment(FeatureAddonsList_PriceListFragment, maskedPriceList);
|
|
26303
|
-
console.log('pricelist charges', priceList === null || priceList === void 0 ? void 0 : priceList.charges);
|
|
26304
26326
|
const featureAddons = (_a = priceList === null || priceList === void 0 ? void 0 : priceList.charges) === null || _a === void 0 ? void 0 : _a.filter(charge => filterDeprecatedCharges(undefined, charge)).filter(charge => charge.featureAddon === true);
|
|
26305
|
-
console.log('featureAddons', featureAddons);
|
|
26306
26327
|
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: featureAddons === null || featureAddons === void 0 ? void 0 : featureAddons.map((featureAddon, featureAddonIndex) => {
|
|
26307
26328
|
return (jsxRuntime.jsx(FeatureAddonRow, { featureAddon: featureAddon, priceList: priceList }, featureAddonIndex));
|
|
26308
26329
|
}) }));
|
|
@@ -28787,7 +28808,7 @@ const getSubscriptions = async ({ apiHost, isInPreviewMode, token, }) => {
|
|
|
28787
28808
|
};
|
|
28788
28809
|
|
|
28789
28810
|
const showInfoNotification = useInfoNotification();
|
|
28790
|
-
const UpgradeWrapper = ({ onChangePlanCancel, handlePortalErrors, upgradingSubscriptionId, isInPreviewMode, productId, className, shadow = 'md', }) => {
|
|
28811
|
+
const UpgradeWrapper = ({ onChangePlanCancel, handlePortalErrors, upgradingSubscriptionId, isInPreviewMode, productId, className, shadow = 'md', onPaymentMethodSaved, onPaymentMethodRemoved, }) => {
|
|
28791
28812
|
var _a, _b, _c;
|
|
28792
28813
|
// Context
|
|
28793
28814
|
const token = useToken();
|
|
@@ -28813,7 +28834,7 @@ const UpgradeWrapper = ({ onChangePlanCancel, handlePortalErrors, upgradingSubsc
|
|
|
28813
28834
|
productId,
|
|
28814
28835
|
className,
|
|
28815
28836
|
shadow,
|
|
28816
|
-
}, children: jsxRuntime.jsx(UpgradingSubscriptionIdProvider, { initialValue: upgradingSubscriptionId, children: jsxRuntime.jsx(UpgradingSubscriptionProvider, { value: upgradingSubscription, children: jsxRuntime.jsx(QuoteProvider, { children: jsxRuntime.jsx(UpgradeContent, { onChangePlanCancel: onChangePlanCancel, handlePortalErrors: handlePortalErrors, subscriptions: (_c = subscriptionsData === null || subscriptionsData === void 0 ? void 0 : subscriptionsData.subscriptions) === null || _c === void 0 ? void 0 : _c.nodes, subscriptionsAreLoading: subscriptionsAreLoading }) }) }) }) }));
|
|
28837
|
+
}, children: jsxRuntime.jsx(UpgradingSubscriptionIdProvider, { initialValue: upgradingSubscriptionId, children: jsxRuntime.jsx(UpgradingSubscriptionProvider, { value: upgradingSubscription, children: jsxRuntime.jsx(OnPaymentMethodSavedProvider, { value: onPaymentMethodSaved, children: jsxRuntime.jsx(OnPaymentMethodRemovedProvider, { value: onPaymentMethodRemoved, children: jsxRuntime.jsx(QuoteProvider, { children: jsxRuntime.jsx(UpgradeContent, { onChangePlanCancel: onChangePlanCancel, handlePortalErrors: handlePortalErrors, subscriptions: (_c = subscriptionsData === null || subscriptionsData === void 0 ? void 0 : subscriptionsData.subscriptions) === null || _c === void 0 ? void 0 : _c.nodes, subscriptionsAreLoading: subscriptionsAreLoading }) }) }) }) }) }) }));
|
|
28817
28838
|
};
|
|
28818
28839
|
const UpgradeContent = ({ onChangePlanCancel, handlePortalErrors, subscriptions, subscriptionsAreLoading, }) => {
|
|
28819
28840
|
// Context
|
|
@@ -28850,7 +28871,7 @@ const UpgradeContent = ({ onChangePlanCancel, handlePortalErrors, subscriptions,
|
|
|
28850
28871
|
} }), jsxRuntime.jsx("div", { ref: stickyRef }), jsxRuntime.jsx("div", { className: `bunny-sticky bunny-bottom-4 bunny-transition-[margin] bunny-duration-300 ${isSticky ? 'bunny-mx-4' : 'bunny-mx-0'}`, children: selectedPriceList && (jsxRuntime.jsx(PlanPickerCheckoutBar, { selectedPriceList: selectedPriceList, handlePortalErrors: handlePortalErrors, onCheckoutSuccess: () => onChangePlanCancel() })) })] }));
|
|
28851
28872
|
};
|
|
28852
28873
|
|
|
28853
|
-
const SubscriptionsWrapper = ({ handlePortalErrors, companyName, isInPreviewMode = false, productId, className, styles: userStyles = {}, noSubscriptionsComponent, showInactiveSubscriptions, showInactiveSubscriptionsToggle = true, }) => {
|
|
28874
|
+
const SubscriptionsWrapper = ({ handlePortalErrors, companyName, isInPreviewMode = false, productId, className, styles: userStyles = {}, noSubscriptionsComponent, showInactiveSubscriptions, showInactiveSubscriptionsToggle = true, onPaymentMethodSaved, onPaymentMethodRemoved, }) => {
|
|
28854
28875
|
var _a, _b;
|
|
28855
28876
|
// Context
|
|
28856
28877
|
const token = useToken();
|
|
@@ -28881,15 +28902,17 @@ const SubscriptionsWrapper = ({ handlePortalErrors, companyName, isInPreviewMode
|
|
|
28881
28902
|
productId,
|
|
28882
28903
|
isInPreviewMode,
|
|
28883
28904
|
showInactiveSubscriptions,
|
|
28884
|
-
}, children: jsxRuntime.jsx(UpgradingSubscriptionIdProvider, { children: jsxRuntime.jsx(Subscriptions, { subscriptions: subscriptions, subscriptionsAreLoading: subscriptionsAreLoading, handlePortalErrors: handlePortalErrors, companyName: companyName, noSubscriptionsComponent: noSubscriptionsComponent, showInactiveSubscriptionsToggle: showInactiveSubscriptionsToggle }) }) }));
|
|
28905
|
+
}, children: jsxRuntime.jsx(UpgradingSubscriptionIdProvider, { children: jsxRuntime.jsx(OnPaymentMethodSavedProvider, { value: onPaymentMethodSaved, children: jsxRuntime.jsx(OnPaymentMethodRemovedProvider, { value: onPaymentMethodRemoved, children: jsxRuntime.jsx(Subscriptions, { subscriptions: subscriptions, subscriptionsAreLoading: subscriptionsAreLoading, handlePortalErrors: handlePortalErrors, companyName: companyName, noSubscriptionsComponent: noSubscriptionsComponent, showInactiveSubscriptionsToggle: showInactiveSubscriptionsToggle }) }) }) }) }));
|
|
28885
28906
|
};
|
|
28886
28907
|
const Subscriptions = ({ subscriptions: maskedSubscriptions, subscriptionsAreLoading, handlePortalErrors, companyName, noSubscriptionsComponent, showInactiveSubscriptionsToggle, }) => {
|
|
28887
28908
|
// Context
|
|
28888
28909
|
const token = useToken();
|
|
28889
28910
|
const { apiHost } = react.useContext(BunnyContext);
|
|
28890
28911
|
const { className, isInPreviewMode, showInactiveSubscriptions: showInactiveSubscriptionsOverride, productId, shadow, } = useSubscriptionProps();
|
|
28891
|
-
const
|
|
28912
|
+
const onPaymentMethodSaved = useOnPaymentMethodSaved();
|
|
28913
|
+
const onPaymentMethodRemoved = useOnPaymentMethodRemoved();
|
|
28892
28914
|
// Local state
|
|
28915
|
+
const [upgradingSubscriptionId, setUpgradingSubscriptionId] = useUpgradingSubscriptionId();
|
|
28893
28916
|
const [showInactiveSubscriptionsState, setShowInactiveSubscriptionsState] = react.useState(false);
|
|
28894
28917
|
const [isChangingPlan, setIsChangingPlan] = react.useState(false);
|
|
28895
28918
|
const [quantityDrawerOpen, setQuantityDrawerOpen] = react.useState(false);
|
|
@@ -28948,7 +28971,7 @@ const Subscriptions = ({ subscriptions: maskedSubscriptions, subscriptionsAreLoa
|
|
|
28948
28971
|
if (isChangingPlan || isInPreviewMode) {
|
|
28949
28972
|
return (jsxRuntime.jsx(UpgradeWrapper, { isInPreviewMode: isInPreviewMode, productId: productId, onChangePlanCancel: () => {
|
|
28950
28973
|
setIsChangingPlan(false);
|
|
28951
|
-
}, handlePortalErrors: handlePortalErrors, upgradingSubscriptionId: upgradingSubscriptionId, className: className, shadow: shadow }));
|
|
28974
|
+
}, handlePortalErrors: handlePortalErrors, upgradingSubscriptionId: upgradingSubscriptionId, className: className, shadow: shadow, onPaymentMethodSaved: onPaymentMethodSaved, onPaymentMethodRemoved: onPaymentMethodRemoved }));
|
|
28952
28975
|
}
|
|
28953
28976
|
if (!subscriptions)
|
|
28954
28977
|
return null;
|
|
@@ -29319,10 +29342,10 @@ function BillingDetailsSection({ hidePaymentMethodForm, countryListFilter, }) {
|
|
|
29319
29342
|
}, accountId: accountId, onContactCreated: handleContactCreated })] }));
|
|
29320
29343
|
}
|
|
29321
29344
|
|
|
29322
|
-
const BillingDetails = ({ className, countryListFilter, hideBillingDetailsForm = false, hidePaymentMethodForm = false, isCardEnabled = true, isUpgradeFromTrial = false, shadow = 'shadow-md', onSavePaymentMethod, }) => {
|
|
29345
|
+
const BillingDetails = ({ className, countryListFilter, hideBillingDetailsForm = false, hidePaymentMethodForm = false, isCardEnabled = true, isUpgradeFromTrial = false, shadow = 'shadow-md', onSavePaymentMethod, onPaymentMethodRemoved, }) => {
|
|
29323
29346
|
// Hooks
|
|
29324
29347
|
const isMobile = useIsMobile();
|
|
29325
|
-
return (jsxRuntime.jsx(WrapperComponent, { isCardEnabled: isCardEnabled, shadow: shadow, className: className, children: jsxRuntime.jsxs("div", { className: `bunny-flex bunny-py-2 bunny-my-2 ${isMobile ? 'bunny-flex-col bunny-space-y-4' : 'bunny-flex-row'} bunny-gap-4`, children: [!hideBillingDetailsForm ? (jsxRuntime.jsx(BillingDetailsSection, { hidePaymentMethodForm: hidePaymentMethodForm, countryListFilter: countryListFilter })) : null, !hideBillingDetailsForm && !hidePaymentMethodForm ? jsxRuntime.jsx(ResponsiveDivider, {}) : null, !hidePaymentMethodForm ? (jsxRuntime.jsx(PaymentFormSection, { hideBillingDetailsForm: hideBillingDetailsForm, isUpgradeFromTrial: isUpgradeFromTrial, onSavePaymentMethod: onSavePaymentMethod })) : null] }) }));
|
|
29348
|
+
return (jsxRuntime.jsx(WrapperComponent, { isCardEnabled: isCardEnabled, shadow: shadow, className: className, children: jsxRuntime.jsxs("div", { className: `bunny-flex bunny-py-2 bunny-my-2 ${isMobile ? 'bunny-flex-col bunny-space-y-4' : 'bunny-flex-row'} bunny-gap-4`, children: [!hideBillingDetailsForm ? (jsxRuntime.jsx(BillingDetailsSection, { hidePaymentMethodForm: hidePaymentMethodForm, countryListFilter: countryListFilter })) : null, !hideBillingDetailsForm && !hidePaymentMethodForm ? jsxRuntime.jsx(ResponsiveDivider, {}) : null, !hidePaymentMethodForm ? (jsxRuntime.jsx(PaymentFormSection, { hideBillingDetailsForm: hideBillingDetailsForm, isUpgradeFromTrial: isUpgradeFromTrial, onSavePaymentMethod: onSavePaymentMethod, onPaymentMethodRemoved: onPaymentMethodRemoved })) : null] }) }));
|
|
29326
29349
|
};
|
|
29327
29350
|
const WrapperComponent = ({ children, isCardEnabled, shadow, className, }) => {
|
|
29328
29351
|
return (jsxRuntime.jsx("div", { className: `${className}`, children: isCardEnabled ? jsxRuntime.jsx(Card, { className: `${shadow}`, children: children }) : jsxRuntime.jsx("div", { children: children }) }));
|
|
@@ -29331,7 +29354,7 @@ const ResponsiveDivider = () => {
|
|
|
29331
29354
|
const isMobile = useIsMobile();
|
|
29332
29355
|
return isMobile ? (jsxRuntime.jsx("div", { className: "bunny-mx-4", children: jsxRuntime.jsx(antd.Divider, {}) })) : (jsxRuntime.jsx("div", { children: jsxRuntime.jsx(antd.Divider, { className: "bunny-h-full", type: "vertical" }) }));
|
|
29333
29356
|
};
|
|
29334
|
-
const PaymentFormSection = ({ hideBillingDetailsForm, isUpgradeFromTrial, onSavePaymentMethod, }) => {
|
|
29357
|
+
const PaymentFormSection = ({ hideBillingDetailsForm, isUpgradeFromTrial, onSavePaymentMethod, onPaymentMethodRemoved, }) => {
|
|
29335
29358
|
const isMobile = useIsMobile();
|
|
29336
29359
|
const showSuccessNotification = useSuccessNotification();
|
|
29337
29360
|
return (jsxRuntime.jsx("div", { className: `${isMobile || hideBillingDetailsForm ? 'bunny-w-full' : 'bunny-w-1/2 bunny-pt-4'} bunny-flex bunny-justify-center`, children: jsxRuntime.jsx(PaymentForm, { onSavePaymentMethod: (response) => {
|
|
@@ -29340,7 +29363,9 @@ const PaymentFormSection = ({ hideBillingDetailsForm, isUpgradeFromTrial, onSave
|
|
|
29340
29363
|
: 'Payment method saved successfully!');
|
|
29341
29364
|
// TODO: onSavePaymentMethod(response: any) should be cleaned up to have a response type (not any)
|
|
29342
29365
|
// and work with both stripe and demo pay requests
|
|
29343
|
-
onSavePaymentMethod === null || onSavePaymentMethod === void 0 ? void 0 : onSavePaymentMethod(response);
|
|
29366
|
+
onSavePaymentMethod === null || onSavePaymentMethod === void 0 ? void 0 : onSavePaymentMethod(response.savedPaymentMethodResponse.paymentMethodId);
|
|
29367
|
+
}, onRemovePaymentMethod: (response) => {
|
|
29368
|
+
onPaymentMethodRemoved === null || onPaymentMethodRemoved === void 0 ? void 0 : onPaymentMethodRemoved(response.id);
|
|
29344
29369
|
} }) }));
|
|
29345
29370
|
};
|
|
29346
29371
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '../../styles/index.less';
|
|
2
2
|
import { ShadowType } from '../../types/shadowType';
|
|
3
|
-
declare const BillingDetails: ({ className, countryListFilter, hideBillingDetailsForm, hidePaymentMethodForm, isCardEnabled, isUpgradeFromTrial, shadow, onSavePaymentMethod, }: {
|
|
3
|
+
declare const BillingDetails: ({ className, countryListFilter, hideBillingDetailsForm, hidePaymentMethodForm, isCardEnabled, isUpgradeFromTrial, shadow, onSavePaymentMethod, onPaymentMethodRemoved, }: {
|
|
4
4
|
className?: string;
|
|
5
5
|
countryListFilter?: (country: {
|
|
6
6
|
value: string;
|
|
@@ -11,6 +11,7 @@ declare const BillingDetails: ({ className, countryListFilter, hideBillingDetail
|
|
|
11
11
|
isCardEnabled?: boolean;
|
|
12
12
|
isUpgradeFromTrial?: boolean;
|
|
13
13
|
shadow?: ShadowType;
|
|
14
|
-
onSavePaymentMethod?: (
|
|
14
|
+
onSavePaymentMethod?: (paymentMethodId: string) => void;
|
|
15
|
+
onPaymentMethodRemoved?: (paymentMethodId: string) => void;
|
|
15
16
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
16
17
|
export default BillingDetails;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { InvoiceQuoteContextProps } from '../../contexts/InvoiceQuoteContext';
|
|
2
2
|
export type InvoiceProps = InvoiceQuoteContextProps & {
|
|
3
3
|
hidePaymentForm?: boolean;
|
|
4
|
+
onPaymentMethodSaved?: (paymentMethodId: string) => void;
|
|
5
|
+
onPaymentMethodRemoved?: (paymentMethodId: string) => void;
|
|
4
6
|
};
|
|
5
|
-
export default function Invoice({ id, invoiceQuoteViewComponent, backButtonName, onBackButtonClick, onInvoiceDownloadError, onPaymentSuccess, shadow, className, hideDownloadButton, hidePaymentForm, onInvoiceLoaded, }: InvoiceProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default function Invoice({ id, invoiceQuoteViewComponent, backButtonName, onBackButtonClick, onInvoiceDownloadError, onPaymentSuccess, shadow, className, hideDownloadButton, hidePaymentForm, onInvoiceLoaded, onPaymentMethodSaved, onPaymentMethodRemoved, }: InvoiceProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import FormattedInvoice from '@/types/FormattedInvoice';
|
|
2
2
|
import Invoice from '@/types/Invoice';
|
|
3
|
-
import { FragmentOf } from 'gql.tada';
|
|
3
|
+
import { FragmentOf, ResultOf } from 'gql.tada';
|
|
4
|
+
import { PaymentForm_PaymentMethodsFragment } from './fragments/PaymentForm_PaymentMethodsFragment';
|
|
5
|
+
type PaymentMethodFragment = ResultOf<typeof PaymentForm_PaymentMethodsFragment>;
|
|
4
6
|
export declare const PaymentForm_QuoteFragment: import("gql.tada").TadaDocumentNode<{
|
|
5
7
|
id: string | null;
|
|
6
8
|
currencyId: string;
|
|
@@ -18,7 +20,7 @@ export declare function PaymentForm({ invoice, quote: maskedQuote, onPaymentSucc
|
|
|
18
20
|
onPaymentSuccess?: (response: any) => void;
|
|
19
21
|
onPaymentHoldSuccess?: (response: any) => void;
|
|
20
22
|
onSavePaymentMethod?: (response: any) => void;
|
|
21
|
-
onRemovePaymentMethod?: () => void;
|
|
23
|
+
onRemovePaymentMethod?: (paymentMethod: PaymentMethodFragment) => void;
|
|
22
24
|
onSetDefaultPaymentMethod?: () => void;
|
|
23
25
|
accountId?: string;
|
|
24
26
|
overrideToken?: string;
|
|
@@ -28,3 +30,4 @@ export declare function PaymentForm({ invoice, quote: maskedQuote, onPaymentSucc
|
|
|
28
30
|
amountToHold?: number;
|
|
29
31
|
};
|
|
30
32
|
}): import("react/jsx-runtime").JSX.Element | null;
|
|
33
|
+
export {};
|
package/dist/cjs/types/src/components/PaymentForm/fragments/PaymentForm_PaymentMethodsFragment.d.ts
CHANGED
|
@@ -3,6 +3,9 @@ export declare const PaymentForm_PaymentMethodsFragment: import("gql.tada").Tada
|
|
|
3
3
|
MiniCreditCard_PaymentMethodFragment: "PaymentMethod";
|
|
4
4
|
};
|
|
5
5
|
id: string;
|
|
6
|
+
plugin: {
|
|
7
|
+
id: string;
|
|
8
|
+
} | null;
|
|
6
9
|
}, {}, {
|
|
7
10
|
fragment: "PaymentForm_PaymentMethodsFragment";
|
|
8
11
|
on: "PaymentMethod";
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { ResultOf } from 'gql.tada';
|
|
2
|
+
import { PaymentForm_PaymentMethodsFragment } from '../fragments/PaymentForm_PaymentMethodsFragment';
|
|
3
|
+
type PaymentMethodFragment = ResultOf<typeof PaymentForm_PaymentMethodsFragment>;
|
|
4
|
+
declare function useRemovePaymentMethod(onRemovePaymentMethod?: (paymentMethod: PaymentMethodFragment) => void, onError?: (message: string) => void): (data: PaymentMethodFragment) => Promise<void>;
|
|
2
5
|
export default useRemovePaymentMethod;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const SubscriptionsWrapper: ({ handlePortalErrors, companyName, isInPreviewMode, productId, className, styles: userStyles, noSubscriptionsComponent, showInactiveSubscriptions, showInactiveSubscriptionsToggle, }: {
|
|
1
|
+
declare const SubscriptionsWrapper: ({ handlePortalErrors, companyName, isInPreviewMode, productId, className, styles: userStyles, noSubscriptionsComponent, showInactiveSubscriptions, showInactiveSubscriptionsToggle, onPaymentMethodSaved, onPaymentMethodRemoved, }: {
|
|
2
2
|
handlePortalErrors?: (errors: any) => void;
|
|
3
3
|
companyName: string;
|
|
4
4
|
isInPreviewMode?: boolean;
|
|
@@ -12,5 +12,7 @@ declare const SubscriptionsWrapper: ({ handlePortalErrors, companyName, isInPrev
|
|
|
12
12
|
noSubscriptionsComponent?: React.ReactNode;
|
|
13
13
|
showInactiveSubscriptions?: boolean;
|
|
14
14
|
showInactiveSubscriptionsToggle?: boolean;
|
|
15
|
+
onPaymentMethodSaved?: (paymentMethodId: string) => void;
|
|
16
|
+
onPaymentMethodRemoved?: (paymentMethodId: string) => void;
|
|
15
17
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
16
18
|
export default SubscriptionsWrapper;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const UpgradeWrapper: ({ onChangePlanCancel, handlePortalErrors, upgradingSubscriptionId, isInPreviewMode, productId, className, shadow, }: {
|
|
1
|
+
declare const UpgradeWrapper: ({ onChangePlanCancel, handlePortalErrors, upgradingSubscriptionId, isInPreviewMode, productId, className, shadow, onPaymentMethodSaved, onPaymentMethodRemoved, }: {
|
|
2
2
|
onChangePlanCancel: () => void;
|
|
3
3
|
handlePortalErrors?: (error: any) => void;
|
|
4
4
|
upgradingSubscriptionId?: string;
|
|
@@ -6,5 +6,7 @@ declare const UpgradeWrapper: ({ onChangePlanCancel, handlePortalErrors, upgradi
|
|
|
6
6
|
productId: string | undefined;
|
|
7
7
|
className?: string;
|
|
8
8
|
shadow?: "none" | "sm" | "md" | "lg";
|
|
9
|
+
onPaymentMethodSaved?: (paymentMethodId: string) => void;
|
|
10
|
+
onPaymentMethodRemoved?: (paymentMethodId: string) => void;
|
|
9
11
|
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
10
12
|
export default UpgradeWrapper;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
declare const OnPaymentMethodRemovedProvider: ({ value, children }: {
|
|
2
|
+
value: ((paymentMethodId: string) => void) | undefined;
|
|
3
|
+
children?: import("react").ReactNode;
|
|
4
|
+
}) => import("react/jsx-runtime").JSX.Element, useOnPaymentMethodRemoved: () => ((paymentMethodId: string) => void) | undefined;
|
|
5
|
+
export { OnPaymentMethodRemovedProvider, useOnPaymentMethodRemoved };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
declare const OnPaymentMethodSavedProvider: ({ value, children }: {
|
|
2
|
+
value: ((paymentMethodId: string) => void) | undefined;
|
|
3
|
+
children?: import("react").ReactNode;
|
|
4
|
+
}) => import("react/jsx-runtime").JSX.Element, useOnPaymentMethodSaved: () => ((paymentMethodId: string) => void) | undefined;
|
|
5
|
+
export { OnPaymentMethodSavedProvider, useOnPaymentMethodSaved };
|
package/dist/esm/index.js
CHANGED
|
@@ -1278,7 +1278,7 @@ const DEFAULT_CONFIG = {
|
|
|
1278
1278
|
};
|
|
1279
1279
|
|
|
1280
1280
|
// This will be replaced at build time by rollup-plugin-replace
|
|
1281
|
-
const PACKAGE_VERSION = '1.7.0-beta.
|
|
1281
|
+
const PACKAGE_VERSION = '1.7.0-beta.14';
|
|
1282
1282
|
const createRequestHeaders = (token) => {
|
|
1283
1283
|
const headers = createClientDevHeaders({ token });
|
|
1284
1284
|
// Add the components version header
|
|
@@ -19757,6 +19757,9 @@ const PaymentForm_PaymentMethodsFragment = t(`
|
|
|
19757
19757
|
fragment PaymentForm_PaymentMethodsFragment on PaymentMethod {
|
|
19758
19758
|
...MiniCreditCard_PaymentMethodFragment
|
|
19759
19759
|
id
|
|
19760
|
+
plugin {
|
|
19761
|
+
id
|
|
19762
|
+
}
|
|
19760
19763
|
}
|
|
19761
19764
|
`, [MiniCreditCard_PaymentMethodFragment]);
|
|
19762
19765
|
|
|
@@ -21137,7 +21140,7 @@ function useRemovePaymentMethod(onRemovePaymentMethod, onError) {
|
|
|
21137
21140
|
const token = useToken();
|
|
21138
21141
|
const { apiHost } = useContext(BunnyContext);
|
|
21139
21142
|
const removePaymentMethod = useCallback(async (data) => {
|
|
21140
|
-
const plugin = paymentPlugins === null || paymentPlugins === void 0 ? void 0 : paymentPlugins.find(paymentPlugin => { var _a; return String(paymentPlugin.id) === ((_a = data === null || data === void 0 ? void 0 : data.plugin) === null || _a === void 0 ? void 0 : _a.id); });
|
|
21143
|
+
const plugin = paymentPlugins === null || paymentPlugins === void 0 ? void 0 : paymentPlugins.find(paymentPlugin => { var _a; return String(paymentPlugin.id) === String((_a = data === null || data === void 0 ? void 0 : data.plugin) === null || _a === void 0 ? void 0 : _a.id); });
|
|
21141
21144
|
if (data && plugin) {
|
|
21142
21145
|
await invokePlugin({
|
|
21143
21146
|
plugin: plugin, // TODO: type the plugin
|
|
@@ -21157,17 +21160,21 @@ function useRemovePaymentMethod(onRemovePaymentMethod, onError) {
|
|
|
21157
21160
|
accountId,
|
|
21158
21161
|
}),
|
|
21159
21162
|
});
|
|
21160
|
-
onRemovePaymentMethod === null || onRemovePaymentMethod === void 0 ? void 0 : onRemovePaymentMethod();
|
|
21163
|
+
onRemovePaymentMethod === null || onRemovePaymentMethod === void 0 ? void 0 : onRemovePaymentMethod(data);
|
|
21161
21164
|
})
|
|
21162
21165
|
.catch((error) => {
|
|
21163
21166
|
showErrorNotification(error.message, 'Error removing payment method');
|
|
21164
21167
|
});
|
|
21165
21168
|
}
|
|
21166
21169
|
else {
|
|
21167
|
-
const availablePlugins = paymentPlugins === null || paymentPlugins === void 0 ? void 0 : paymentPlugins.map(
|
|
21170
|
+
const availablePlugins = paymentPlugins === null || paymentPlugins === void 0 ? void 0 : paymentPlugins.map(plugin => {
|
|
21171
|
+
var _a, _b;
|
|
21172
|
+
const components = plugin.components;
|
|
21173
|
+
return (_b = (_a = components === null || components === void 0 ? void 0 : components.frontend) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.name;
|
|
21174
|
+
});
|
|
21168
21175
|
onError === null || onError === void 0 ? void 0 : onError(`Either the payment method was not found or the plugin was not present. Available plugins: ${availablePlugins === null || availablePlugins === void 0 ? void 0 : availablePlugins.join(', ')}`);
|
|
21169
21176
|
}
|
|
21170
|
-
}, [paymentPlugins, token, apiHost, queryClient]);
|
|
21177
|
+
}, [paymentPlugins, token, apiHost, queryClient, onRemovePaymentMethod, accountId, onError]);
|
|
21171
21178
|
return removePaymentMethod;
|
|
21172
21179
|
}
|
|
21173
21180
|
|
|
@@ -21502,7 +21509,7 @@ const InvoiceQuoteView = ({ children, formattedInvoice, html, backButtonName, on
|
|
|
21502
21509
|
}, children: [targetUrl ? (jsx(DocumentTemplatePreview, { targetUrl: targetUrl })) : (jsx(Markup, { content: html })), children] }))] }));
|
|
21503
21510
|
};
|
|
21504
21511
|
|
|
21505
|
-
function Invoice({ id, invoiceQuoteViewComponent, backButtonName, onBackButtonClick, onInvoiceDownloadError, onPaymentSuccess, shadow = 'shadow-md', className, hideDownloadButton = false, hidePaymentForm = false, onInvoiceLoaded, }) {
|
|
21512
|
+
function Invoice({ id, invoiceQuoteViewComponent, backButtonName, onBackButtonClick, onInvoiceDownloadError, onPaymentSuccess, shadow = 'shadow-md', className, hideDownloadButton = false, hidePaymentForm = false, onInvoiceLoaded, onPaymentMethodSaved, onPaymentMethodRemoved, }) {
|
|
21506
21513
|
return (jsx(InvoiceQuoteContext.Provider, { value: {
|
|
21507
21514
|
id,
|
|
21508
21515
|
invoiceQuoteViewComponent,
|
|
@@ -21514,9 +21521,9 @@ function Invoice({ id, invoiceQuoteViewComponent, backButtonName, onBackButtonCl
|
|
|
21514
21521
|
className,
|
|
21515
21522
|
hideDownloadButton,
|
|
21516
21523
|
onInvoiceLoaded,
|
|
21517
|
-
}, children: jsx(ActualInvoice, { hidePaymentForm: hidePaymentForm }) }));
|
|
21524
|
+
}, children: jsx(ActualInvoice, { hidePaymentForm: hidePaymentForm, onSavePaymentMethod: onPaymentMethodSaved, onRemovePaymentMethod: onPaymentMethodRemoved }) }));
|
|
21518
21525
|
}
|
|
21519
|
-
function ActualInvoice({ hidePaymentForm }) {
|
|
21526
|
+
function ActualInvoice({ hidePaymentForm, onSavePaymentMethod, onRemovePaymentMethod }) {
|
|
21520
21527
|
// Context
|
|
21521
21528
|
const queryClient = useQueryClient();
|
|
21522
21529
|
const { id, invoiceQuoteViewComponent, backButtonName, onBackButtonClick, onPaymentSuccess, className, } = useContext(InvoiceQuoteContext);
|
|
@@ -21554,7 +21561,11 @@ function ActualInvoice({ hidePaymentForm }) {
|
|
|
21554
21561
|
}, [formattedInvoice]);
|
|
21555
21562
|
if (!formattedInvoice)
|
|
21556
21563
|
return jsx(Fragment, {});
|
|
21557
|
-
return (jsx("div", { className: "bunny-invoice-container", children: jsxs("div", { className: `bunny-flex bunny-gap-6 ${isMobile ? 'bunny-flex-col bunny-w-full' : ''} ${className}`, children: [formattedInvoice.isLegacy ? (jsx("div", { className: "bunny-flex bunny-justify-center bunny-w-full", children: jsx(LegacyDocument, { documentUuid: formattedInvoice.uuid, documentType: "invoice" }) })) : (invoiceQuoteViewComponent || (jsx(InvoiceQuoteView, { html: formattedInvoice.html, formattedInvoice: formattedInvoice, backButtonName: backButtonName, onBackButtonClick: onBackButtonClick }))), isInvoicePayable && !hidePaymentForm && (jsx("div", { className: `bunny-w-full ${hideDownloadButton || formattedInvoice.isLegacy ? '' : 'pt-12'}`, children: jsx(PaymentForm, { onPaymentSuccess: handlePaymentSuccess, invoice: formattedInvoice
|
|
21564
|
+
return (jsx("div", { className: "bunny-invoice-container", children: jsxs("div", { className: `bunny-flex bunny-gap-6 ${isMobile ? 'bunny-flex-col bunny-w-full' : ''} ${className}`, children: [formattedInvoice.isLegacy ? (jsx("div", { className: "bunny-flex bunny-justify-center bunny-w-full", children: jsx(LegacyDocument, { documentUuid: formattedInvoice.uuid, documentType: "invoice" }) })) : (invoiceQuoteViewComponent || (jsx(InvoiceQuoteView, { html: formattedInvoice.html, formattedInvoice: formattedInvoice, backButtonName: backButtonName, onBackButtonClick: onBackButtonClick }))), isInvoicePayable && !hidePaymentForm && (jsx("div", { className: `bunny-w-full ${hideDownloadButton || formattedInvoice.isLegacy ? '' : 'pt-12'}`, children: jsx(PaymentForm, { onPaymentSuccess: handlePaymentSuccess, invoice: formattedInvoice, onSavePaymentMethod: (paymentMethodId) => {
|
|
21565
|
+
onSavePaymentMethod === null || onSavePaymentMethod === void 0 ? void 0 : onSavePaymentMethod(paymentMethodId);
|
|
21566
|
+
}, onRemovePaymentMethod: (paymentMethod) => {
|
|
21567
|
+
onRemovePaymentMethod === null || onRemovePaymentMethod === void 0 ? void 0 : onRemovePaymentMethod(paymentMethod.id);
|
|
21568
|
+
} }) }))] }) }));
|
|
21558
21569
|
}
|
|
21559
21570
|
|
|
21560
21571
|
const useFocusFirstInput = ({ firstInputRef, isVisible, }) => {
|
|
@@ -23466,6 +23477,12 @@ const FormBillingState = () => {
|
|
|
23466
23477
|
return (jsx(Form.Item, { label: "Billing state", name: "billingState", rules: [{ required: billingStateRequired }], children: jsx(Input, { placeholder: "State" }) }));
|
|
23467
23478
|
};
|
|
23468
23479
|
|
|
23480
|
+
const [OnPaymentMethodSavedProvider, useOnPaymentMethodSaved] = createValueContext();
|
|
23481
|
+
// This provider is used in all components that may save a payment method
|
|
23482
|
+
|
|
23483
|
+
const [OnPaymentMethodRemovedProvider, useOnPaymentMethodRemoved] = createValueContext();
|
|
23484
|
+
// This provider is used in all components that may remove a payment method
|
|
23485
|
+
|
|
23469
23486
|
const { Text: Text$o } = Typography;
|
|
23470
23487
|
// HACK: I have imported QuoteFields_QuoteFragment here as a hack to ensure I have all of the quote data needed for
|
|
23471
23488
|
// the eventual children of this component.
|
|
@@ -23509,6 +23526,9 @@ const QuoteCheckout = ({ account, onSuccess, onFail, quote: maskedQuote, taxatio
|
|
|
23509
23526
|
// Read fragments
|
|
23510
23527
|
const quote = readFragment(QuoteCheckout_QuoteFragment, maskedQuote);
|
|
23511
23528
|
const upgradingSubscription = readFragment(QuoteCheckout_SubscriptionFragment, maskedUpgradingSubscription);
|
|
23529
|
+
// Context
|
|
23530
|
+
const onPaymentMethodSaved = useOnPaymentMethodSaved();
|
|
23531
|
+
const onPaymentMethodRemoved = useOnPaymentMethodRemoved();
|
|
23512
23532
|
const { apiHost } = useContext(BunnyContext);
|
|
23513
23533
|
const token = useToken();
|
|
23514
23534
|
const isMobile = useIsMobile();
|
|
@@ -23567,7 +23587,7 @@ const QuoteCheckout = ({ account, onSuccess, onFail, quote: maskedQuote, taxatio
|
|
|
23567
23587
|
}
|
|
23568
23588
|
if (taxationRequiredAccountFields)
|
|
23569
23589
|
return (jsx(PaymentFormWrapper, { setMaxHeight: false, children: jsx(TaxationForm, { account: account, accountId: quote.accountId }) }));
|
|
23570
|
-
return (jsx(PaymentFormWrapper, { setMaxHeight: false, children: paymentRequired ? (jsxs("div", { className: "bunny-flex bunny-flex-col bunny-gap-2 bunny-w-full", children: [jsx(PaymentForm, { onPaymentSuccess: onSuccess, quote: quote }), (couponsOnQuote === null || couponsOnQuote === void 0 ? void 0 : couponsOnQuote.length) === 0 ? (jsx(Fragment, { children: upgradingSubscription &&
|
|
23590
|
+
return (jsx(PaymentFormWrapper, { setMaxHeight: false, children: paymentRequired ? (jsxs("div", { className: "bunny-flex bunny-flex-col bunny-gap-2 bunny-w-full", children: [jsx(PaymentForm, { onPaymentSuccess: onSuccess, quote: quote, onSavePaymentMethod: (paymentMethod) => onPaymentMethodSaved === null || onPaymentMethodSaved === void 0 ? void 0 : onPaymentMethodSaved(paymentMethod.savedPaymentMethodResponse.paymentMethodId), onRemovePaymentMethod: (paymentMethod) => onPaymentMethodRemoved === null || onPaymentMethodRemoved === void 0 ? void 0 : onPaymentMethodRemoved(paymentMethod.id) }), (couponsOnQuote === null || couponsOnQuote === void 0 ? void 0 : couponsOnQuote.length) === 0 ? (jsx(Fragment, { children: upgradingSubscription &&
|
|
23571
23591
|
shouldShowCouponEditor(quote, activeCouponsExist, upgradingSubscription) && (jsx(CouponEditor, { className: "bunny-px-4 bunny-pt-1", onAddCoupon: addCoupon, isAddingCoupon: isAddingCoupon, couponCode: couponCode, setCouponCode: setCouponCode })) })) : (jsx(Button, { type: "link", loading: isRemovingCoupon, onClick: () => {
|
|
23572
23592
|
couponsOnQuote === null || couponsOnQuote === void 0 ? void 0 : couponsOnQuote.forEach(couponCharge => {
|
|
23573
23593
|
var _a;
|
|
@@ -23607,6 +23627,9 @@ const Checkout = ({ onCancel, onSuccess, onFail, onRecalculateTaxes, invoice, op
|
|
|
23607
23627
|
const { apiHost } = useContext(BunnyContext);
|
|
23608
23628
|
const isMobile = useIsMobile();
|
|
23609
23629
|
const token = useToken();
|
|
23630
|
+
// Context
|
|
23631
|
+
const onPaymentMethodSaved = useOnPaymentMethodSaved();
|
|
23632
|
+
const onPaymentMethodRemoved = useOnPaymentMethodRemoved();
|
|
23610
23633
|
// Read fragments
|
|
23611
23634
|
const quote = readFragment(Checkout_QuoteFragment, maskedQuote);
|
|
23612
23635
|
const hasTaxPlugin = useHasTaxPlugin({
|
|
@@ -23655,13 +23678,13 @@ const Checkout = ({ onCancel, onSuccess, onFail, onRecalculateTaxes, invoice, op
|
|
|
23655
23678
|
return (jsx("div", { className: `bunny-flex bunny-flex-col bunny-fixed bunny-top-0 bunny-left-0 bunny-right-0 bunny-bottom-0 bunny-bg-slate-50
|
|
23656
23679
|
bunny-overflow-auto bunny-height-full`, style: {
|
|
23657
23680
|
zIndex: 1001,
|
|
23658
|
-
}, children: jsxs("div", { className: `bunny-flex bunny-flex-col bunny-grow bunny-pt-4 ${isMobile ? 'bunny-pb-4' : 'bunny-pb-8'} bunny-content-container`, children: [jsx("div", { className: "bunny-flex bunny-justify-end bunny-w-full bunny-pr-4", children: jsx(CloseOutlined, { className: "bunny-text-base bunny-shadow-padding-xb", onClick: onCancel }) }), jsxs("div", { className: `bunny-flex bunny-justify-end bunny-pt-4 bunny-gap-4 ${isMobile ? 'bunny-flex-col' : 'bunny-shadow-padding-xb'}`, children: [((invoice === null || invoice === void 0 ? void 0 : invoice.html) || ((_b = quote === null || quote === void 0 ? void 0 : quote.formattedQuote) === null || _b === void 0 ? void 0 : _b.html)) && (jsx(InvoiceQuoteView, { html: invoice ? invoice.html : (_d = (_c = quote === null || quote === void 0 ? void 0 : quote.formattedQuote) === null || _c === void 0 ? void 0 : _c.html) !== null && _d !== void 0 ? _d : '' })), !isMobile && ((invoice === null || invoice === void 0 ? void 0 : invoice.html) || ((_e = quote === null || quote === void 0 ? void 0 : quote.formattedQuote) === null || _e === void 0 ? void 0 : _e.html)) && (jsx(Divider, { className: "bunny-h-full", type: "vertical" })), invoice ? (jsx("div", { className: "bunny-w-full bunny-pt-12", children: jsx(PaymentForm, { onPaymentSuccess: onSuccess, invoice: invoice }) })) : quote ? (jsx(QuoteCheckout, { account: account, onFail: error => {
|
|
23681
|
+
}, children: jsxs("div", { className: `bunny-flex bunny-flex-col bunny-grow bunny-pt-4 ${isMobile ? 'bunny-pb-4' : 'bunny-pb-8'} bunny-content-container`, children: [jsx("div", { className: "bunny-flex bunny-justify-end bunny-w-full bunny-pr-4", children: jsx(CloseOutlined, { className: "bunny-text-base bunny-shadow-padding-xb", onClick: onCancel }) }), jsxs("div", { className: `bunny-flex bunny-justify-end bunny-pt-4 bunny-gap-4 ${isMobile ? 'bunny-flex-col' : 'bunny-shadow-padding-xb'}`, children: [((invoice === null || invoice === void 0 ? void 0 : invoice.html) || ((_b = quote === null || quote === void 0 ? void 0 : quote.formattedQuote) === null || _b === void 0 ? void 0 : _b.html)) && (jsx(InvoiceQuoteView, { html: invoice ? invoice.html : (_d = (_c = quote === null || quote === void 0 ? void 0 : quote.formattedQuote) === null || _c === void 0 ? void 0 : _c.html) !== null && _d !== void 0 ? _d : '' })), !isMobile && ((invoice === null || invoice === void 0 ? void 0 : invoice.html) || ((_e = quote === null || quote === void 0 ? void 0 : quote.formattedQuote) === null || _e === void 0 ? void 0 : _e.html)) && (jsx(Divider, { className: "bunny-h-full", type: "vertical" })), invoice ? (jsx("div", { className: "bunny-w-full bunny-pt-12", children: jsx(PaymentForm, { onPaymentSuccess: onSuccess, invoice: invoice, onSavePaymentMethod: (paymentMethod) => onPaymentMethodSaved === null || onPaymentMethodSaved === void 0 ? void 0 : onPaymentMethodSaved(paymentMethod.savedPaymentMethodResponse.paymentMethodId), onRemovePaymentMethod: (paymentMethod) => onPaymentMethodRemoved === null || onPaymentMethodRemoved === void 0 ? void 0 : onPaymentMethodRemoved(paymentMethod.id) }) })) : quote ? (jsx(QuoteCheckout, { account: account, onFail: error => {
|
|
23659
23682
|
onFail(error);
|
|
23660
23683
|
}, onSuccess: onSuccess, quote: quote, taxationRequiredAccountFields: taxationRequiredAccountFields, token: token, onRecalculateTaxes: async () => {
|
|
23661
23684
|
if (recalculateTaxesEnabled) {
|
|
23662
23685
|
await recalculateTaxes();
|
|
23663
23686
|
}
|
|
23664
|
-
} })) : (jsx(PaymentForm, { onPaymentSuccess: onSuccess }))] }), jsx(Footer, { className: "bunny-px-12" })] }) }));
|
|
23687
|
+
} })) : (jsx(PaymentForm, { onPaymentSuccess: onSuccess, onSavePaymentMethod: (paymentMethod) => onPaymentMethodSaved === null || onPaymentMethodSaved === void 0 ? void 0 : onPaymentMethodSaved(paymentMethod.savedPaymentMethodResponse.paymentMethodId), onRemovePaymentMethod: (paymentMethod) => onPaymentMethodRemoved === null || onPaymentMethodRemoved === void 0 ? void 0 : onPaymentMethodRemoved(paymentMethod.id) }))] }), jsx(Footer, { className: "bunny-px-12" })] }) }));
|
|
23665
23688
|
};
|
|
23666
23689
|
|
|
23667
23690
|
function canEditChargeQuantity(charge) {
|
|
@@ -26298,9 +26321,7 @@ const FeatureAddonsList_PriceListFragment = t(`
|
|
|
26298
26321
|
function FeatureAddonsList({ priceList: maskedPriceList, }) {
|
|
26299
26322
|
var _a;
|
|
26300
26323
|
const priceList = readFragment(FeatureAddonsList_PriceListFragment, maskedPriceList);
|
|
26301
|
-
console.log('pricelist charges', priceList === null || priceList === void 0 ? void 0 : priceList.charges);
|
|
26302
26324
|
const featureAddons = (_a = priceList === null || priceList === void 0 ? void 0 : priceList.charges) === null || _a === void 0 ? void 0 : _a.filter(charge => filterDeprecatedCharges(undefined, charge)).filter(charge => charge.featureAddon === true);
|
|
26303
|
-
console.log('featureAddons', featureAddons);
|
|
26304
26325
|
return (jsx(Fragment, { children: featureAddons === null || featureAddons === void 0 ? void 0 : featureAddons.map((featureAddon, featureAddonIndex) => {
|
|
26305
26326
|
return (jsx(FeatureAddonRow, { featureAddon: featureAddon, priceList: priceList }, featureAddonIndex));
|
|
26306
26327
|
}) }));
|
|
@@ -28785,7 +28806,7 @@ const getSubscriptions = async ({ apiHost, isInPreviewMode, token, }) => {
|
|
|
28785
28806
|
};
|
|
28786
28807
|
|
|
28787
28808
|
const showInfoNotification = useInfoNotification();
|
|
28788
|
-
const UpgradeWrapper = ({ onChangePlanCancel, handlePortalErrors, upgradingSubscriptionId, isInPreviewMode, productId, className, shadow = 'md', }) => {
|
|
28809
|
+
const UpgradeWrapper = ({ onChangePlanCancel, handlePortalErrors, upgradingSubscriptionId, isInPreviewMode, productId, className, shadow = 'md', onPaymentMethodSaved, onPaymentMethodRemoved, }) => {
|
|
28789
28810
|
var _a, _b, _c;
|
|
28790
28811
|
// Context
|
|
28791
28812
|
const token = useToken();
|
|
@@ -28811,7 +28832,7 @@ const UpgradeWrapper = ({ onChangePlanCancel, handlePortalErrors, upgradingSubsc
|
|
|
28811
28832
|
productId,
|
|
28812
28833
|
className,
|
|
28813
28834
|
shadow,
|
|
28814
|
-
}, children: jsx(UpgradingSubscriptionIdProvider, { initialValue: upgradingSubscriptionId, children: jsx(UpgradingSubscriptionProvider, { value: upgradingSubscription, children: jsx(QuoteProvider, { children: jsx(UpgradeContent, { onChangePlanCancel: onChangePlanCancel, handlePortalErrors: handlePortalErrors, subscriptions: (_c = subscriptionsData === null || subscriptionsData === void 0 ? void 0 : subscriptionsData.subscriptions) === null || _c === void 0 ? void 0 : _c.nodes, subscriptionsAreLoading: subscriptionsAreLoading }) }) }) }) }));
|
|
28835
|
+
}, children: jsx(UpgradingSubscriptionIdProvider, { initialValue: upgradingSubscriptionId, children: jsx(UpgradingSubscriptionProvider, { value: upgradingSubscription, children: jsx(OnPaymentMethodSavedProvider, { value: onPaymentMethodSaved, children: jsx(OnPaymentMethodRemovedProvider, { value: onPaymentMethodRemoved, children: jsx(QuoteProvider, { children: jsx(UpgradeContent, { onChangePlanCancel: onChangePlanCancel, handlePortalErrors: handlePortalErrors, subscriptions: (_c = subscriptionsData === null || subscriptionsData === void 0 ? void 0 : subscriptionsData.subscriptions) === null || _c === void 0 ? void 0 : _c.nodes, subscriptionsAreLoading: subscriptionsAreLoading }) }) }) }) }) }) }));
|
|
28815
28836
|
};
|
|
28816
28837
|
const UpgradeContent = ({ onChangePlanCancel, handlePortalErrors, subscriptions, subscriptionsAreLoading, }) => {
|
|
28817
28838
|
// Context
|
|
@@ -28848,7 +28869,7 @@ const UpgradeContent = ({ onChangePlanCancel, handlePortalErrors, subscriptions,
|
|
|
28848
28869
|
} }), jsx("div", { ref: stickyRef }), jsx("div", { className: `bunny-sticky bunny-bottom-4 bunny-transition-[margin] bunny-duration-300 ${isSticky ? 'bunny-mx-4' : 'bunny-mx-0'}`, children: selectedPriceList && (jsx(PlanPickerCheckoutBar, { selectedPriceList: selectedPriceList, handlePortalErrors: handlePortalErrors, onCheckoutSuccess: () => onChangePlanCancel() })) })] }));
|
|
28849
28870
|
};
|
|
28850
28871
|
|
|
28851
|
-
const SubscriptionsWrapper = ({ handlePortalErrors, companyName, isInPreviewMode = false, productId, className, styles: userStyles = {}, noSubscriptionsComponent, showInactiveSubscriptions, showInactiveSubscriptionsToggle = true, }) => {
|
|
28872
|
+
const SubscriptionsWrapper = ({ handlePortalErrors, companyName, isInPreviewMode = false, productId, className, styles: userStyles = {}, noSubscriptionsComponent, showInactiveSubscriptions, showInactiveSubscriptionsToggle = true, onPaymentMethodSaved, onPaymentMethodRemoved, }) => {
|
|
28852
28873
|
var _a, _b;
|
|
28853
28874
|
// Context
|
|
28854
28875
|
const token = useToken();
|
|
@@ -28879,15 +28900,17 @@ const SubscriptionsWrapper = ({ handlePortalErrors, companyName, isInPreviewMode
|
|
|
28879
28900
|
productId,
|
|
28880
28901
|
isInPreviewMode,
|
|
28881
28902
|
showInactiveSubscriptions,
|
|
28882
|
-
}, children: jsx(UpgradingSubscriptionIdProvider, { children: jsx(Subscriptions, { subscriptions: subscriptions, subscriptionsAreLoading: subscriptionsAreLoading, handlePortalErrors: handlePortalErrors, companyName: companyName, noSubscriptionsComponent: noSubscriptionsComponent, showInactiveSubscriptionsToggle: showInactiveSubscriptionsToggle }) }) }));
|
|
28903
|
+
}, children: jsx(UpgradingSubscriptionIdProvider, { children: jsx(OnPaymentMethodSavedProvider, { value: onPaymentMethodSaved, children: jsx(OnPaymentMethodRemovedProvider, { value: onPaymentMethodRemoved, children: jsx(Subscriptions, { subscriptions: subscriptions, subscriptionsAreLoading: subscriptionsAreLoading, handlePortalErrors: handlePortalErrors, companyName: companyName, noSubscriptionsComponent: noSubscriptionsComponent, showInactiveSubscriptionsToggle: showInactiveSubscriptionsToggle }) }) }) }) }));
|
|
28883
28904
|
};
|
|
28884
28905
|
const Subscriptions = ({ subscriptions: maskedSubscriptions, subscriptionsAreLoading, handlePortalErrors, companyName, noSubscriptionsComponent, showInactiveSubscriptionsToggle, }) => {
|
|
28885
28906
|
// Context
|
|
28886
28907
|
const token = useToken();
|
|
28887
28908
|
const { apiHost } = useContext(BunnyContext);
|
|
28888
28909
|
const { className, isInPreviewMode, showInactiveSubscriptions: showInactiveSubscriptionsOverride, productId, shadow, } = useSubscriptionProps();
|
|
28889
|
-
const
|
|
28910
|
+
const onPaymentMethodSaved = useOnPaymentMethodSaved();
|
|
28911
|
+
const onPaymentMethodRemoved = useOnPaymentMethodRemoved();
|
|
28890
28912
|
// Local state
|
|
28913
|
+
const [upgradingSubscriptionId, setUpgradingSubscriptionId] = useUpgradingSubscriptionId();
|
|
28891
28914
|
const [showInactiveSubscriptionsState, setShowInactiveSubscriptionsState] = useState(false);
|
|
28892
28915
|
const [isChangingPlan, setIsChangingPlan] = useState(false);
|
|
28893
28916
|
const [quantityDrawerOpen, setQuantityDrawerOpen] = useState(false);
|
|
@@ -28946,7 +28969,7 @@ const Subscriptions = ({ subscriptions: maskedSubscriptions, subscriptionsAreLoa
|
|
|
28946
28969
|
if (isChangingPlan || isInPreviewMode) {
|
|
28947
28970
|
return (jsx(UpgradeWrapper, { isInPreviewMode: isInPreviewMode, productId: productId, onChangePlanCancel: () => {
|
|
28948
28971
|
setIsChangingPlan(false);
|
|
28949
|
-
}, handlePortalErrors: handlePortalErrors, upgradingSubscriptionId: upgradingSubscriptionId, className: className, shadow: shadow }));
|
|
28972
|
+
}, handlePortalErrors: handlePortalErrors, upgradingSubscriptionId: upgradingSubscriptionId, className: className, shadow: shadow, onPaymentMethodSaved: onPaymentMethodSaved, onPaymentMethodRemoved: onPaymentMethodRemoved }));
|
|
28950
28973
|
}
|
|
28951
28974
|
if (!subscriptions)
|
|
28952
28975
|
return null;
|
|
@@ -29317,10 +29340,10 @@ function BillingDetailsSection({ hidePaymentMethodForm, countryListFilter, }) {
|
|
|
29317
29340
|
}, accountId: accountId, onContactCreated: handleContactCreated })] }));
|
|
29318
29341
|
}
|
|
29319
29342
|
|
|
29320
|
-
const BillingDetails = ({ className, countryListFilter, hideBillingDetailsForm = false, hidePaymentMethodForm = false, isCardEnabled = true, isUpgradeFromTrial = false, shadow = 'shadow-md', onSavePaymentMethod, }) => {
|
|
29343
|
+
const BillingDetails = ({ className, countryListFilter, hideBillingDetailsForm = false, hidePaymentMethodForm = false, isCardEnabled = true, isUpgradeFromTrial = false, shadow = 'shadow-md', onSavePaymentMethod, onPaymentMethodRemoved, }) => {
|
|
29321
29344
|
// Hooks
|
|
29322
29345
|
const isMobile = useIsMobile();
|
|
29323
|
-
return (jsx(WrapperComponent, { isCardEnabled: isCardEnabled, shadow: shadow, className: className, children: jsxs("div", { className: `bunny-flex bunny-py-2 bunny-my-2 ${isMobile ? 'bunny-flex-col bunny-space-y-4' : 'bunny-flex-row'} bunny-gap-4`, children: [!hideBillingDetailsForm ? (jsx(BillingDetailsSection, { hidePaymentMethodForm: hidePaymentMethodForm, countryListFilter: countryListFilter })) : null, !hideBillingDetailsForm && !hidePaymentMethodForm ? jsx(ResponsiveDivider, {}) : null, !hidePaymentMethodForm ? (jsx(PaymentFormSection, { hideBillingDetailsForm: hideBillingDetailsForm, isUpgradeFromTrial: isUpgradeFromTrial, onSavePaymentMethod: onSavePaymentMethod })) : null] }) }));
|
|
29346
|
+
return (jsx(WrapperComponent, { isCardEnabled: isCardEnabled, shadow: shadow, className: className, children: jsxs("div", { className: `bunny-flex bunny-py-2 bunny-my-2 ${isMobile ? 'bunny-flex-col bunny-space-y-4' : 'bunny-flex-row'} bunny-gap-4`, children: [!hideBillingDetailsForm ? (jsx(BillingDetailsSection, { hidePaymentMethodForm: hidePaymentMethodForm, countryListFilter: countryListFilter })) : null, !hideBillingDetailsForm && !hidePaymentMethodForm ? jsx(ResponsiveDivider, {}) : null, !hidePaymentMethodForm ? (jsx(PaymentFormSection, { hideBillingDetailsForm: hideBillingDetailsForm, isUpgradeFromTrial: isUpgradeFromTrial, onSavePaymentMethod: onSavePaymentMethod, onPaymentMethodRemoved: onPaymentMethodRemoved })) : null] }) }));
|
|
29324
29347
|
};
|
|
29325
29348
|
const WrapperComponent = ({ children, isCardEnabled, shadow, className, }) => {
|
|
29326
29349
|
return (jsx("div", { className: `${className}`, children: isCardEnabled ? jsx(Card, { className: `${shadow}`, children: children }) : jsx("div", { children: children }) }));
|
|
@@ -29329,7 +29352,7 @@ const ResponsiveDivider = () => {
|
|
|
29329
29352
|
const isMobile = useIsMobile();
|
|
29330
29353
|
return isMobile ? (jsx("div", { className: "bunny-mx-4", children: jsx(Divider, {}) })) : (jsx("div", { children: jsx(Divider, { className: "bunny-h-full", type: "vertical" }) }));
|
|
29331
29354
|
};
|
|
29332
|
-
const PaymentFormSection = ({ hideBillingDetailsForm, isUpgradeFromTrial, onSavePaymentMethod, }) => {
|
|
29355
|
+
const PaymentFormSection = ({ hideBillingDetailsForm, isUpgradeFromTrial, onSavePaymentMethod, onPaymentMethodRemoved, }) => {
|
|
29333
29356
|
const isMobile = useIsMobile();
|
|
29334
29357
|
const showSuccessNotification = useSuccessNotification();
|
|
29335
29358
|
return (jsx("div", { className: `${isMobile || hideBillingDetailsForm ? 'bunny-w-full' : 'bunny-w-1/2 bunny-pt-4'} bunny-flex bunny-justify-center`, children: jsx(PaymentForm, { onSavePaymentMethod: (response) => {
|
|
@@ -29338,7 +29361,9 @@ const PaymentFormSection = ({ hideBillingDetailsForm, isUpgradeFromTrial, onSave
|
|
|
29338
29361
|
: 'Payment method saved successfully!');
|
|
29339
29362
|
// TODO: onSavePaymentMethod(response: any) should be cleaned up to have a response type (not any)
|
|
29340
29363
|
// and work with both stripe and demo pay requests
|
|
29341
|
-
onSavePaymentMethod === null || onSavePaymentMethod === void 0 ? void 0 : onSavePaymentMethod(response);
|
|
29364
|
+
onSavePaymentMethod === null || onSavePaymentMethod === void 0 ? void 0 : onSavePaymentMethod(response.savedPaymentMethodResponse.paymentMethodId);
|
|
29365
|
+
}, onRemovePaymentMethod: (response) => {
|
|
29366
|
+
onPaymentMethodRemoved === null || onPaymentMethodRemoved === void 0 ? void 0 : onPaymentMethodRemoved(response.id);
|
|
29342
29367
|
} }) }));
|
|
29343
29368
|
};
|
|
29344
29369
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '../../styles/index.less';
|
|
2
2
|
import { ShadowType } from '../../types/shadowType';
|
|
3
|
-
declare const BillingDetails: ({ className, countryListFilter, hideBillingDetailsForm, hidePaymentMethodForm, isCardEnabled, isUpgradeFromTrial, shadow, onSavePaymentMethod, }: {
|
|
3
|
+
declare const BillingDetails: ({ className, countryListFilter, hideBillingDetailsForm, hidePaymentMethodForm, isCardEnabled, isUpgradeFromTrial, shadow, onSavePaymentMethod, onPaymentMethodRemoved, }: {
|
|
4
4
|
className?: string;
|
|
5
5
|
countryListFilter?: (country: {
|
|
6
6
|
value: string;
|
|
@@ -11,6 +11,7 @@ declare const BillingDetails: ({ className, countryListFilter, hideBillingDetail
|
|
|
11
11
|
isCardEnabled?: boolean;
|
|
12
12
|
isUpgradeFromTrial?: boolean;
|
|
13
13
|
shadow?: ShadowType;
|
|
14
|
-
onSavePaymentMethod?: (
|
|
14
|
+
onSavePaymentMethod?: (paymentMethodId: string) => void;
|
|
15
|
+
onPaymentMethodRemoved?: (paymentMethodId: string) => void;
|
|
15
16
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
16
17
|
export default BillingDetails;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { InvoiceQuoteContextProps } from '../../contexts/InvoiceQuoteContext';
|
|
2
2
|
export type InvoiceProps = InvoiceQuoteContextProps & {
|
|
3
3
|
hidePaymentForm?: boolean;
|
|
4
|
+
onPaymentMethodSaved?: (paymentMethodId: string) => void;
|
|
5
|
+
onPaymentMethodRemoved?: (paymentMethodId: string) => void;
|
|
4
6
|
};
|
|
5
|
-
export default function Invoice({ id, invoiceQuoteViewComponent, backButtonName, onBackButtonClick, onInvoiceDownloadError, onPaymentSuccess, shadow, className, hideDownloadButton, hidePaymentForm, onInvoiceLoaded, }: InvoiceProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default function Invoice({ id, invoiceQuoteViewComponent, backButtonName, onBackButtonClick, onInvoiceDownloadError, onPaymentSuccess, shadow, className, hideDownloadButton, hidePaymentForm, onInvoiceLoaded, onPaymentMethodSaved, onPaymentMethodRemoved, }: InvoiceProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import FormattedInvoice from '@/types/FormattedInvoice';
|
|
2
2
|
import Invoice from '@/types/Invoice';
|
|
3
|
-
import { FragmentOf } from 'gql.tada';
|
|
3
|
+
import { FragmentOf, ResultOf } from 'gql.tada';
|
|
4
|
+
import { PaymentForm_PaymentMethodsFragment } from './fragments/PaymentForm_PaymentMethodsFragment';
|
|
5
|
+
type PaymentMethodFragment = ResultOf<typeof PaymentForm_PaymentMethodsFragment>;
|
|
4
6
|
export declare const PaymentForm_QuoteFragment: import("gql.tada").TadaDocumentNode<{
|
|
5
7
|
id: string | null;
|
|
6
8
|
currencyId: string;
|
|
@@ -18,7 +20,7 @@ export declare function PaymentForm({ invoice, quote: maskedQuote, onPaymentSucc
|
|
|
18
20
|
onPaymentSuccess?: (response: any) => void;
|
|
19
21
|
onPaymentHoldSuccess?: (response: any) => void;
|
|
20
22
|
onSavePaymentMethod?: (response: any) => void;
|
|
21
|
-
onRemovePaymentMethod?: () => void;
|
|
23
|
+
onRemovePaymentMethod?: (paymentMethod: PaymentMethodFragment) => void;
|
|
22
24
|
onSetDefaultPaymentMethod?: () => void;
|
|
23
25
|
accountId?: string;
|
|
24
26
|
overrideToken?: string;
|
|
@@ -28,3 +30,4 @@ export declare function PaymentForm({ invoice, quote: maskedQuote, onPaymentSucc
|
|
|
28
30
|
amountToHold?: number;
|
|
29
31
|
};
|
|
30
32
|
}): import("react/jsx-runtime").JSX.Element | null;
|
|
33
|
+
export {};
|
package/dist/esm/types/src/components/PaymentForm/fragments/PaymentForm_PaymentMethodsFragment.d.ts
CHANGED
|
@@ -3,6 +3,9 @@ export declare const PaymentForm_PaymentMethodsFragment: import("gql.tada").Tada
|
|
|
3
3
|
MiniCreditCard_PaymentMethodFragment: "PaymentMethod";
|
|
4
4
|
};
|
|
5
5
|
id: string;
|
|
6
|
+
plugin: {
|
|
7
|
+
id: string;
|
|
8
|
+
} | null;
|
|
6
9
|
}, {}, {
|
|
7
10
|
fragment: "PaymentForm_PaymentMethodsFragment";
|
|
8
11
|
on: "PaymentMethod";
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { ResultOf } from 'gql.tada';
|
|
2
|
+
import { PaymentForm_PaymentMethodsFragment } from '../fragments/PaymentForm_PaymentMethodsFragment';
|
|
3
|
+
type PaymentMethodFragment = ResultOf<typeof PaymentForm_PaymentMethodsFragment>;
|
|
4
|
+
declare function useRemovePaymentMethod(onRemovePaymentMethod?: (paymentMethod: PaymentMethodFragment) => void, onError?: (message: string) => void): (data: PaymentMethodFragment) => Promise<void>;
|
|
2
5
|
export default useRemovePaymentMethod;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const SubscriptionsWrapper: ({ handlePortalErrors, companyName, isInPreviewMode, productId, className, styles: userStyles, noSubscriptionsComponent, showInactiveSubscriptions, showInactiveSubscriptionsToggle, }: {
|
|
1
|
+
declare const SubscriptionsWrapper: ({ handlePortalErrors, companyName, isInPreviewMode, productId, className, styles: userStyles, noSubscriptionsComponent, showInactiveSubscriptions, showInactiveSubscriptionsToggle, onPaymentMethodSaved, onPaymentMethodRemoved, }: {
|
|
2
2
|
handlePortalErrors?: (errors: any) => void;
|
|
3
3
|
companyName: string;
|
|
4
4
|
isInPreviewMode?: boolean;
|
|
@@ -12,5 +12,7 @@ declare const SubscriptionsWrapper: ({ handlePortalErrors, companyName, isInPrev
|
|
|
12
12
|
noSubscriptionsComponent?: React.ReactNode;
|
|
13
13
|
showInactiveSubscriptions?: boolean;
|
|
14
14
|
showInactiveSubscriptionsToggle?: boolean;
|
|
15
|
+
onPaymentMethodSaved?: (paymentMethodId: string) => void;
|
|
16
|
+
onPaymentMethodRemoved?: (paymentMethodId: string) => void;
|
|
15
17
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
16
18
|
export default SubscriptionsWrapper;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const UpgradeWrapper: ({ onChangePlanCancel, handlePortalErrors, upgradingSubscriptionId, isInPreviewMode, productId, className, shadow, }: {
|
|
1
|
+
declare const UpgradeWrapper: ({ onChangePlanCancel, handlePortalErrors, upgradingSubscriptionId, isInPreviewMode, productId, className, shadow, onPaymentMethodSaved, onPaymentMethodRemoved, }: {
|
|
2
2
|
onChangePlanCancel: () => void;
|
|
3
3
|
handlePortalErrors?: (error: any) => void;
|
|
4
4
|
upgradingSubscriptionId?: string;
|
|
@@ -6,5 +6,7 @@ declare const UpgradeWrapper: ({ onChangePlanCancel, handlePortalErrors, upgradi
|
|
|
6
6
|
productId: string | undefined;
|
|
7
7
|
className?: string;
|
|
8
8
|
shadow?: "none" | "sm" | "md" | "lg";
|
|
9
|
+
onPaymentMethodSaved?: (paymentMethodId: string) => void;
|
|
10
|
+
onPaymentMethodRemoved?: (paymentMethodId: string) => void;
|
|
9
11
|
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
10
12
|
export default UpgradeWrapper;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
declare const OnPaymentMethodRemovedProvider: ({ value, children }: {
|
|
2
|
+
value: ((paymentMethodId: string) => void) | undefined;
|
|
3
|
+
children?: import("react").ReactNode;
|
|
4
|
+
}) => import("react/jsx-runtime").JSX.Element, useOnPaymentMethodRemoved: () => ((paymentMethodId: string) => void) | undefined;
|
|
5
|
+
export { OnPaymentMethodRemovedProvider, useOnPaymentMethodRemoved };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
declare const OnPaymentMethodSavedProvider: ({ value, children }: {
|
|
2
|
+
value: ((paymentMethodId: string) => void) | undefined;
|
|
3
|
+
children?: import("react").ReactNode;
|
|
4
|
+
}) => import("react/jsx-runtime").JSX.Element, useOnPaymentMethodSaved: () => ((paymentMethodId: string) => void) | undefined;
|
|
5
|
+
export { OnPaymentMethodSavedProvider, useOnPaymentMethodSaved };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import FormattedInvoice from '@/types/FormattedInvoice';
|
|
|
3
3
|
import { FormattedQuote } from '@/types/FormattedQuote';
|
|
4
4
|
import { Transaction, TransactionKind } from '@/types/Transaction';
|
|
5
5
|
import * as gql_tada from 'gql.tada';
|
|
6
|
-
import { FragmentOf } from 'gql.tada';
|
|
6
|
+
import { FragmentOf, ResultOf } from 'gql.tada';
|
|
7
7
|
import Invoice$1 from '@/types/Invoice';
|
|
8
8
|
import { QueryClient } from '@tanstack/react-query';
|
|
9
9
|
import { ThemeConfig } from 'antd';
|
|
@@ -27,8 +27,10 @@ type InvoiceQuoteContextProps = {
|
|
|
27
27
|
|
|
28
28
|
type InvoiceProps = InvoiceQuoteContextProps & {
|
|
29
29
|
hidePaymentForm?: boolean;
|
|
30
|
+
onPaymentMethodSaved?: (paymentMethodId: string) => void;
|
|
31
|
+
onPaymentMethodRemoved?: (paymentMethodId: string) => void;
|
|
30
32
|
};
|
|
31
|
-
declare function Invoice({ id, invoiceQuoteViewComponent, backButtonName, onBackButtonClick, onInvoiceDownloadError, onPaymentSuccess, shadow, className, hideDownloadButton, hidePaymentForm, onInvoiceLoaded, }: InvoiceProps): react_jsx_runtime.JSX.Element;
|
|
33
|
+
declare function Invoice({ id, invoiceQuoteViewComponent, backButtonName, onBackButtonClick, onInvoiceDownloadError, onPaymentSuccess, shadow, className, hideDownloadButton, hidePaymentForm, onInvoiceLoaded, onPaymentMethodSaved, onPaymentMethodRemoved, }: InvoiceProps): react_jsx_runtime.JSX.Element;
|
|
32
34
|
|
|
33
35
|
declare global {
|
|
34
36
|
interface Window {
|
|
@@ -79,6 +81,21 @@ declare function Quotes({ className, columns, filter, filterQuotes, sort, noQuot
|
|
|
79
81
|
noQuotesMessage?: string;
|
|
80
82
|
}): react_jsx_runtime.JSX.Element;
|
|
81
83
|
|
|
84
|
+
declare const PaymentForm_PaymentMethodsFragment: gql_tada.TadaDocumentNode<{
|
|
85
|
+
[$tada.fragmentRefs]: {
|
|
86
|
+
MiniCreditCard_PaymentMethodFragment: "PaymentMethod";
|
|
87
|
+
};
|
|
88
|
+
id: string;
|
|
89
|
+
plugin: {
|
|
90
|
+
id: string;
|
|
91
|
+
} | null;
|
|
92
|
+
}, {}, {
|
|
93
|
+
fragment: "PaymentForm_PaymentMethodsFragment";
|
|
94
|
+
on: "PaymentMethod";
|
|
95
|
+
masked: true;
|
|
96
|
+
}>;
|
|
97
|
+
|
|
98
|
+
type PaymentMethodFragment = ResultOf<typeof PaymentForm_PaymentMethodsFragment>;
|
|
82
99
|
declare const PaymentForm_QuoteFragment: gql_tada.TadaDocumentNode<{
|
|
83
100
|
id: string | null;
|
|
84
101
|
currencyId: string;
|
|
@@ -96,7 +113,7 @@ declare function PaymentForm({ invoice, quote: maskedQuote, onPaymentSuccess, on
|
|
|
96
113
|
onPaymentSuccess?: (response: any) => void;
|
|
97
114
|
onPaymentHoldSuccess?: (response: any) => void;
|
|
98
115
|
onSavePaymentMethod?: (response: any) => void;
|
|
99
|
-
onRemovePaymentMethod?: () => void;
|
|
116
|
+
onRemovePaymentMethod?: (paymentMethod: PaymentMethodFragment) => void;
|
|
100
117
|
onSetDefaultPaymentMethod?: () => void;
|
|
101
118
|
accountId?: string;
|
|
102
119
|
overrideToken?: string;
|
|
@@ -192,7 +209,7 @@ declare function Transactions({ transactionComponent, showSearchBar, showTitle,
|
|
|
192
209
|
hidePaymentForm?: boolean;
|
|
193
210
|
}): react_jsx_runtime.JSX.Element;
|
|
194
211
|
|
|
195
|
-
declare const SubscriptionsWrapper: ({ handlePortalErrors, companyName, isInPreviewMode, productId, className, styles: userStyles, noSubscriptionsComponent, showInactiveSubscriptions, showInactiveSubscriptionsToggle, }: {
|
|
212
|
+
declare const SubscriptionsWrapper: ({ handlePortalErrors, companyName, isInPreviewMode, productId, className, styles: userStyles, noSubscriptionsComponent, showInactiveSubscriptions, showInactiveSubscriptionsToggle, onPaymentMethodSaved, onPaymentMethodRemoved, }: {
|
|
196
213
|
handlePortalErrors?: (errors: any) => void;
|
|
197
214
|
companyName: string;
|
|
198
215
|
isInPreviewMode?: boolean;
|
|
@@ -206,9 +223,11 @@ declare const SubscriptionsWrapper: ({ handlePortalErrors, companyName, isInPrev
|
|
|
206
223
|
noSubscriptionsComponent?: React.ReactNode;
|
|
207
224
|
showInactiveSubscriptions?: boolean;
|
|
208
225
|
showInactiveSubscriptionsToggle?: boolean;
|
|
226
|
+
onPaymentMethodSaved?: (paymentMethodId: string) => void;
|
|
227
|
+
onPaymentMethodRemoved?: (paymentMethodId: string) => void;
|
|
209
228
|
}) => react_jsx_runtime.JSX.Element;
|
|
210
229
|
|
|
211
|
-
declare const UpgradeWrapper: ({ onChangePlanCancel, handlePortalErrors, upgradingSubscriptionId, isInPreviewMode, productId, className, shadow, }: {
|
|
230
|
+
declare const UpgradeWrapper: ({ onChangePlanCancel, handlePortalErrors, upgradingSubscriptionId, isInPreviewMode, productId, className, shadow, onPaymentMethodSaved, onPaymentMethodRemoved, }: {
|
|
212
231
|
onChangePlanCancel: () => void;
|
|
213
232
|
handlePortalErrors?: (error: any) => void;
|
|
214
233
|
upgradingSubscriptionId?: string;
|
|
@@ -216,9 +235,11 @@ declare const UpgradeWrapper: ({ onChangePlanCancel, handlePortalErrors, upgradi
|
|
|
216
235
|
productId: string | undefined;
|
|
217
236
|
className?: string;
|
|
218
237
|
shadow?: "none" | "sm" | "md" | "lg";
|
|
238
|
+
onPaymentMethodSaved?: (paymentMethodId: string) => void;
|
|
239
|
+
onPaymentMethodRemoved?: (paymentMethodId: string) => void;
|
|
219
240
|
}) => react_jsx_runtime.JSX.Element | null;
|
|
220
241
|
|
|
221
|
-
declare const BillingDetails: ({ className, countryListFilter, hideBillingDetailsForm, hidePaymentMethodForm, isCardEnabled, isUpgradeFromTrial, shadow, onSavePaymentMethod, }: {
|
|
242
|
+
declare const BillingDetails: ({ className, countryListFilter, hideBillingDetailsForm, hidePaymentMethodForm, isCardEnabled, isUpgradeFromTrial, shadow, onSavePaymentMethod, onPaymentMethodRemoved, }: {
|
|
222
243
|
className?: string;
|
|
223
244
|
countryListFilter?: (country: {
|
|
224
245
|
value: string;
|
|
@@ -229,7 +250,8 @@ declare const BillingDetails: ({ className, countryListFilter, hideBillingDetail
|
|
|
229
250
|
isCardEnabled?: boolean;
|
|
230
251
|
isUpgradeFromTrial?: boolean;
|
|
231
252
|
shadow?: ShadowType;
|
|
232
|
-
onSavePaymentMethod?: (
|
|
253
|
+
onSavePaymentMethod?: (paymentMethodId: string) => void;
|
|
254
|
+
onPaymentMethodRemoved?: (paymentMethodId: string) => void;
|
|
233
255
|
}) => react_jsx_runtime.JSX.Element;
|
|
234
256
|
|
|
235
257
|
declare const Footer: ({ className }: {
|
package/package.json
CHANGED