@bunnyapp/components 1.7.0-beta.25 → 1.7.0-beta.27
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 +36 -33
- package/dist/cjs/types/src/components/PaymentForm/PaymentForm.d.ts +2 -2
- package/dist/cjs/types/src/components/PaymentForm/hooks/useRemovePaymentMethod.d.ts +1 -1
- package/dist/esm/index.js +36 -33
- package/dist/esm/types/src/components/PaymentForm/PaymentForm.d.ts +2 -2
- package/dist/esm/types/src/components/PaymentForm/hooks/useRemovePaymentMethod.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- 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.7.0-beta.
|
|
1286
|
+
const PACKAGE_VERSION = '1.7.0-beta.26';
|
|
1287
1287
|
const createRequestHeaders = (token) => {
|
|
1288
1288
|
const headers = createClientDevHeaders({ token });
|
|
1289
1289
|
// Add the components version header
|
|
@@ -21175,7 +21175,7 @@ function usePayableCurrency({ payableCurrencyId, accountCurrencyId }) {
|
|
|
21175
21175
|
return { currencyId, isCurrencyIdLoading: isCurrentUserDataLoading };
|
|
21176
21176
|
}
|
|
21177
21177
|
|
|
21178
|
-
function useRemovePaymentMethod(
|
|
21178
|
+
function useRemovePaymentMethod(onPaymentMethodRemoved, onError) {
|
|
21179
21179
|
const queryClient = reactQuery.useQueryClient();
|
|
21180
21180
|
const showErrorNotification = useErrorNotification();
|
|
21181
21181
|
const showSuccessNotification = useSuccessNotification();
|
|
@@ -21204,7 +21204,7 @@ function useRemovePaymentMethod(onRemovePaymentMethod, onError) {
|
|
|
21204
21204
|
accountId,
|
|
21205
21205
|
}),
|
|
21206
21206
|
});
|
|
21207
|
-
|
|
21207
|
+
onPaymentMethodRemoved === null || onPaymentMethodRemoved === void 0 ? void 0 : onPaymentMethodRemoved(data);
|
|
21208
21208
|
})
|
|
21209
21209
|
.catch((error) => {
|
|
21210
21210
|
showErrorNotification(error.message, 'Error removing payment method');
|
|
@@ -21218,7 +21218,7 @@ function useRemovePaymentMethod(onRemovePaymentMethod, onError) {
|
|
|
21218
21218
|
});
|
|
21219
21219
|
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(', ')}`);
|
|
21220
21220
|
}
|
|
21221
|
-
}, [paymentPlugins, token, apiHost, queryClient,
|
|
21221
|
+
}, [paymentPlugins, token, apiHost, queryClient, onPaymentMethodRemoved, accountId, onError]);
|
|
21222
21222
|
return removePaymentMethod;
|
|
21223
21223
|
}
|
|
21224
21224
|
|
|
@@ -21289,7 +21289,7 @@ const PaymentForm_QuoteFragment = t(`
|
|
|
21289
21289
|
...PaymentProvider_QuoteFragment
|
|
21290
21290
|
}
|
|
21291
21291
|
`, [PaymentProvider_QuoteFragment]);
|
|
21292
|
-
function PaymentForm({ currencyId: accountCurrencyId, invoice, quote: maskedQuote, onPaymentSuccess, onPaymentHoldSuccess, accountId, onSavePaymentMethod,
|
|
21292
|
+
function PaymentForm({ currencyId: accountCurrencyId, invoice, quote: maskedQuote, onPaymentSuccess, onPaymentHoldSuccess, accountId, onSavePaymentMethod, onPaymentMethodRemoved, onSetDefaultPaymentMethod, overrideToken, customCheckoutFunction, paymentHoldOptions, }) {
|
|
21293
21293
|
var _a;
|
|
21294
21294
|
// Read fragments
|
|
21295
21295
|
const quote = readFragment(PaymentForm_QuoteFragment, maskedQuote);
|
|
@@ -21310,9 +21310,9 @@ function PaymentForm({ currencyId: accountCurrencyId, invoice, quote: maskedQuot
|
|
|
21310
21310
|
[ShowPaymentDetailsProvider, { value: undefined }],
|
|
21311
21311
|
[CustomCheckoutFunctionProvider, { value: customCheckoutFunction }],
|
|
21312
21312
|
];
|
|
21313
|
-
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: providers.reduceRight((acc, [Provider, props]) => react.createElement(Provider, props, acc), jsxRuntime.jsx(OverrideTokenContext.Provider, { value: { overrideToken }, children: jsxRuntime.jsx(SelectedPluginProvider, { accountId: accountId, children: jsxRuntime.jsx(StripeWrapper, { currencyId: currencyId, accountId: accountId, children: jsxRuntime.jsx(PaymentProvider, { quote: quote, invoice: invoice, accountId: accountId, onPaymentHoldSuccess: onPaymentHoldSuccess, onPaymentSuccess: onPaymentSuccess, paymentHoldOptions: paymentHoldOptions !== null && paymentHoldOptions !== void 0 ? paymentHoldOptions : {}, onSavePaymentMethod: onSavePaymentMethod, children: jsxRuntime.jsx(PaymentFormContent, {
|
|
21313
|
+
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: providers.reduceRight((acc, [Provider, props]) => react.createElement(Provider, props, acc), jsxRuntime.jsx(OverrideTokenContext.Provider, { value: { overrideToken }, children: jsxRuntime.jsx(SelectedPluginProvider, { accountId: accountId, children: jsxRuntime.jsx(StripeWrapper, { currencyId: currencyId, accountId: accountId, children: jsxRuntime.jsx(PaymentProvider, { quote: quote, invoice: invoice, accountId: accountId, onPaymentHoldSuccess: onPaymentHoldSuccess, onPaymentSuccess: onPaymentSuccess, paymentHoldOptions: paymentHoldOptions !== null && paymentHoldOptions !== void 0 ? paymentHoldOptions : {}, onSavePaymentMethod: onSavePaymentMethod, children: jsxRuntime.jsx(PaymentFormContent, { onPaymentMethodRemoved: onPaymentMethodRemoved, onSetDefaultPaymentMethod: onSetDefaultPaymentMethod }) }) }) }) })) }));
|
|
21314
21314
|
}
|
|
21315
|
-
function PaymentFormContent({
|
|
21315
|
+
function PaymentFormContent({ onPaymentMethodRemoved, onSetDefaultPaymentMethod, }) {
|
|
21316
21316
|
// Context
|
|
21317
21317
|
const [showPaymentMethodForm, setShowPaymentMethodForm] = useShowPaymentDetails();
|
|
21318
21318
|
const paymentType = usePaymentType();
|
|
@@ -21339,7 +21339,7 @@ function PaymentFormContent({ onRemovePaymentMethod, onSetDefaultPaymentMethod,
|
|
|
21339
21339
|
setDefaultPaymentMethodLoading,
|
|
21340
21340
|
enabled: !!paymentPlugins,
|
|
21341
21341
|
});
|
|
21342
|
-
const onClickRemove = useRemovePaymentMethod(
|
|
21342
|
+
const onClickRemove = useRemovePaymentMethod(onPaymentMethodRemoved, message => {
|
|
21343
21343
|
showErrorNotification$5(message, 'Error removing payment method');
|
|
21344
21344
|
});
|
|
21345
21345
|
function handleClickAddPaymentMethod() {
|
|
@@ -21424,23 +21424,26 @@ if (typeof window !== 'undefined') {
|
|
|
21424
21424
|
const shadowRoot = originalAttachShadow.call(this, init);
|
|
21425
21425
|
// Prevent watermark styles from being injected
|
|
21426
21426
|
const originalInnerHTMLSetter = (_a = Object.getOwnPropertyDescriptor(ShadowRoot.prototype, 'innerHTML')) === null || _a === void 0 ? void 0 : _a.set;
|
|
21427
|
-
console.log('originalInnerHTMLSetter', originalInnerHTMLSetter);
|
|
21428
21427
|
if (originalInnerHTMLSetter) {
|
|
21429
|
-
|
|
21430
|
-
|
|
21431
|
-
|
|
21432
|
-
|
|
21433
|
-
|
|
21434
|
-
|
|
21435
|
-
|
|
21436
|
-
|
|
21437
|
-
|
|
21438
|
-
|
|
21439
|
-
|
|
21440
|
-
|
|
21441
|
-
|
|
21442
|
-
|
|
21443
|
-
|
|
21428
|
+
try {
|
|
21429
|
+
Object.defineProperty(shadowRoot, 'innerHTML', {
|
|
21430
|
+
configurable: true,
|
|
21431
|
+
set: function (value) {
|
|
21432
|
+
// Block watermark injection
|
|
21433
|
+
if (typeof value === 'string' &&
|
|
21434
|
+
value.includes('background-image: url(data:image/webp')) {
|
|
21435
|
+
return; // Don't set the watermark HTML
|
|
21436
|
+
}
|
|
21437
|
+
originalInnerHTMLSetter.call(this, value);
|
|
21438
|
+
},
|
|
21439
|
+
get: function () {
|
|
21440
|
+
return this.innerHTML;
|
|
21441
|
+
},
|
|
21442
|
+
});
|
|
21443
|
+
}
|
|
21444
|
+
catch (e) {
|
|
21445
|
+
// Property already defined, ignore error (happens during hot module reloading)
|
|
21446
|
+
}
|
|
21444
21447
|
}
|
|
21445
21448
|
return shadowRoot;
|
|
21446
21449
|
};
|
|
@@ -21567,9 +21570,9 @@ function Invoice({ id, invoiceQuoteViewComponent, backButtonName, onBackButtonCl
|
|
|
21567
21570
|
className,
|
|
21568
21571
|
hideDownloadButton,
|
|
21569
21572
|
onInvoiceLoaded,
|
|
21570
|
-
}, children: jsxRuntime.jsx(ActualInvoice, { hidePaymentForm: hidePaymentForm, onSavePaymentMethod: onPaymentMethodSaved,
|
|
21573
|
+
}, children: jsxRuntime.jsx(ActualInvoice, { hidePaymentForm: hidePaymentForm, onSavePaymentMethod: onPaymentMethodSaved, onPaymentMethodRemoved: onPaymentMethodRemoved }) }));
|
|
21571
21574
|
}
|
|
21572
|
-
function ActualInvoice({ hidePaymentForm, onSavePaymentMethod,
|
|
21575
|
+
function ActualInvoice({ hidePaymentForm, onSavePaymentMethod, onPaymentMethodRemoved, }) {
|
|
21573
21576
|
// Context
|
|
21574
21577
|
const queryClient = reactQuery.useQueryClient();
|
|
21575
21578
|
const { id, invoiceQuoteViewComponent, backButtonName, onBackButtonClick, onPaymentSuccess, className, } = react.useContext(InvoiceQuoteContext);
|
|
@@ -21607,10 +21610,10 @@ function ActualInvoice({ hidePaymentForm, onSavePaymentMethod, onRemovePaymentMe
|
|
|
21607
21610
|
}, [formattedInvoice]);
|
|
21608
21611
|
if (!formattedInvoice)
|
|
21609
21612
|
return jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
21610
|
-
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:
|
|
21613
|
+
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 => {
|
|
21611
21614
|
onSavePaymentMethod === null || onSavePaymentMethod === void 0 ? void 0 : onSavePaymentMethod(paymentMethodId);
|
|
21612
|
-
},
|
|
21613
|
-
|
|
21615
|
+
}, onPaymentMethodRemoved: paymentMethod => {
|
|
21616
|
+
onPaymentMethodRemoved === null || onPaymentMethodRemoved === void 0 ? void 0 : onPaymentMethodRemoved(paymentMethod.id);
|
|
21614
21617
|
} }) }))] }) }));
|
|
21615
21618
|
}
|
|
21616
21619
|
|
|
@@ -23633,7 +23636,7 @@ const QuoteCheckout = ({ account, onSuccess, onFail, quote: maskedQuote, taxatio
|
|
|
23633
23636
|
}
|
|
23634
23637
|
if (taxationRequiredAccountFields)
|
|
23635
23638
|
return (jsxRuntime.jsx(PaymentFormWrapper, { setMaxHeight: false, children: jsxRuntime.jsx(TaxationForm, { account: account, accountId: quote.accountId }) }));
|
|
23636
|
-
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),
|
|
23639
|
+
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), onPaymentMethodRemoved: (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 &&
|
|
23637
23640
|
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: () => {
|
|
23638
23641
|
couponsOnQuote === null || couponsOnQuote === void 0 ? void 0 : couponsOnQuote.forEach(couponCharge => {
|
|
23639
23642
|
var _a;
|
|
@@ -23724,13 +23727,13 @@ const Checkout = ({ onCancel, onSuccess, onFail, onRecalculateTaxes, invoice, op
|
|
|
23724
23727
|
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
|
|
23725
23728
|
bunny-overflow-auto bunny-height-full`, style: {
|
|
23726
23729
|
zIndex: 1001,
|
|
23727
|
-
}, 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),
|
|
23730
|
+
}, 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), onPaymentMethodRemoved: (paymentMethod) => onPaymentMethodRemoved === null || onPaymentMethodRemoved === void 0 ? void 0 : onPaymentMethodRemoved(paymentMethod.id) }) })) : quote ? (jsxRuntime.jsx(QuoteCheckout, { account: account, onFail: error => {
|
|
23728
23731
|
onFail(error);
|
|
23729
23732
|
}, onSuccess: onSuccess, quote: quote, taxationRequiredAccountFields: taxationRequiredAccountFields, token: token, onRecalculateTaxes: async () => {
|
|
23730
23733
|
if (recalculateTaxesEnabled) {
|
|
23731
23734
|
await recalculateTaxes();
|
|
23732
23735
|
}
|
|
23733
|
-
} })) : (jsxRuntime.jsx(PaymentForm, { onPaymentSuccess: onSuccess, onSavePaymentMethod: (paymentMethod) => onPaymentMethodSaved === null || onPaymentMethodSaved === void 0 ? void 0 : onPaymentMethodSaved(paymentMethod.savedPaymentMethodResponse.paymentMethodId),
|
|
23736
|
+
} })) : (jsxRuntime.jsx(PaymentForm, { onPaymentSuccess: onSuccess, onSavePaymentMethod: (paymentMethod) => onPaymentMethodSaved === null || onPaymentMethodSaved === void 0 ? void 0 : onPaymentMethodSaved(paymentMethod.savedPaymentMethodResponse.paymentMethodId), onPaymentMethodRemoved: (paymentMethod) => onPaymentMethodRemoved === null || onPaymentMethodRemoved === void 0 ? void 0 : onPaymentMethodRemoved(paymentMethod.id) }))] }), jsxRuntime.jsx(Footer, { className: "bunny-px-12" })] }) }));
|
|
23734
23737
|
};
|
|
23735
23738
|
|
|
23736
23739
|
function canEditChargeQuantity(charge) {
|
|
@@ -29646,7 +29649,7 @@ const PaymentFormSection = ({ hideBillingDetailsForm, isUpgradeFromTrial, onSave
|
|
|
29646
29649
|
// TODO: onSavePaymentMethod(response: any) should be cleaned up to have a response type (not any)
|
|
29647
29650
|
// and work with both stripe and demo pay requests
|
|
29648
29651
|
onSavePaymentMethod === null || onSavePaymentMethod === void 0 ? void 0 : onSavePaymentMethod(response.savedPaymentMethodResponse.paymentMethodId);
|
|
29649
|
-
},
|
|
29652
|
+
}, onPaymentMethodRemoved: response => {
|
|
29650
29653
|
onPaymentMethodRemoved === null || onPaymentMethodRemoved === void 0 ? void 0 : onPaymentMethodRemoved(response.id);
|
|
29651
29654
|
} }) }));
|
|
29652
29655
|
};
|
|
@@ -14,14 +14,14 @@ export declare const PaymentForm_QuoteFragment: import("gql.tada").TadaDocumentN
|
|
|
14
14
|
on: "Quote";
|
|
15
15
|
masked: true;
|
|
16
16
|
}>;
|
|
17
|
-
export declare function PaymentForm({ currencyId: accountCurrencyId, invoice, quote: maskedQuote, onPaymentSuccess, onPaymentHoldSuccess, accountId, onSavePaymentMethod,
|
|
17
|
+
export declare function PaymentForm({ currencyId: accountCurrencyId, invoice, quote: maskedQuote, onPaymentSuccess, onPaymentHoldSuccess, accountId, onSavePaymentMethod, onPaymentMethodRemoved, onSetDefaultPaymentMethod, overrideToken, customCheckoutFunction, paymentHoldOptions, }: {
|
|
18
18
|
currencyId?: string;
|
|
19
19
|
invoice?: FormattedInvoice | Invoice;
|
|
20
20
|
quote?: FragmentOf<typeof PaymentForm_QuoteFragment>;
|
|
21
21
|
onPaymentSuccess?: (response: any) => void;
|
|
22
22
|
onPaymentHoldSuccess?: (response: any) => void;
|
|
23
23
|
onSavePaymentMethod?: (response: any) => void;
|
|
24
|
-
|
|
24
|
+
onPaymentMethodRemoved?: (paymentMethod: PaymentMethodFragment) => void;
|
|
25
25
|
onSetDefaultPaymentMethod?: () => void;
|
|
26
26
|
accountId?: string;
|
|
27
27
|
overrideToken?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ResultOf } from 'gql.tada';
|
|
2
2
|
import { PaymentForm_PaymentMethodsFragment } from '../fragments/PaymentForm_PaymentMethodsFragment';
|
|
3
3
|
type PaymentMethodFragment = ResultOf<typeof PaymentForm_PaymentMethodsFragment>;
|
|
4
|
-
declare function useRemovePaymentMethod(
|
|
4
|
+
declare function useRemovePaymentMethod(onPaymentMethodRemoved?: (paymentMethod: PaymentMethodFragment) => void, onError?: (message: string) => void): (data: PaymentMethodFragment) => Promise<void>;
|
|
5
5
|
export default useRemovePaymentMethod;
|
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.7.0-beta.
|
|
1284
|
+
const PACKAGE_VERSION = '1.7.0-beta.26';
|
|
1285
1285
|
const createRequestHeaders = (token) => {
|
|
1286
1286
|
const headers = createClientDevHeaders({ token });
|
|
1287
1287
|
// Add the components version header
|
|
@@ -21173,7 +21173,7 @@ function usePayableCurrency({ payableCurrencyId, accountCurrencyId }) {
|
|
|
21173
21173
|
return { currencyId, isCurrencyIdLoading: isCurrentUserDataLoading };
|
|
21174
21174
|
}
|
|
21175
21175
|
|
|
21176
|
-
function useRemovePaymentMethod(
|
|
21176
|
+
function useRemovePaymentMethod(onPaymentMethodRemoved, onError) {
|
|
21177
21177
|
const queryClient = useQueryClient();
|
|
21178
21178
|
const showErrorNotification = useErrorNotification();
|
|
21179
21179
|
const showSuccessNotification = useSuccessNotification();
|
|
@@ -21202,7 +21202,7 @@ function useRemovePaymentMethod(onRemovePaymentMethod, onError) {
|
|
|
21202
21202
|
accountId,
|
|
21203
21203
|
}),
|
|
21204
21204
|
});
|
|
21205
|
-
|
|
21205
|
+
onPaymentMethodRemoved === null || onPaymentMethodRemoved === void 0 ? void 0 : onPaymentMethodRemoved(data);
|
|
21206
21206
|
})
|
|
21207
21207
|
.catch((error) => {
|
|
21208
21208
|
showErrorNotification(error.message, 'Error removing payment method');
|
|
@@ -21216,7 +21216,7 @@ function useRemovePaymentMethod(onRemovePaymentMethod, onError) {
|
|
|
21216
21216
|
});
|
|
21217
21217
|
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(', ')}`);
|
|
21218
21218
|
}
|
|
21219
|
-
}, [paymentPlugins, token, apiHost, queryClient,
|
|
21219
|
+
}, [paymentPlugins, token, apiHost, queryClient, onPaymentMethodRemoved, accountId, onError]);
|
|
21220
21220
|
return removePaymentMethod;
|
|
21221
21221
|
}
|
|
21222
21222
|
|
|
@@ -21287,7 +21287,7 @@ const PaymentForm_QuoteFragment = t(`
|
|
|
21287
21287
|
...PaymentProvider_QuoteFragment
|
|
21288
21288
|
}
|
|
21289
21289
|
`, [PaymentProvider_QuoteFragment]);
|
|
21290
|
-
function PaymentForm({ currencyId: accountCurrencyId, invoice, quote: maskedQuote, onPaymentSuccess, onPaymentHoldSuccess, accountId, onSavePaymentMethod,
|
|
21290
|
+
function PaymentForm({ currencyId: accountCurrencyId, invoice, quote: maskedQuote, onPaymentSuccess, onPaymentHoldSuccess, accountId, onSavePaymentMethod, onPaymentMethodRemoved, onSetDefaultPaymentMethod, overrideToken, customCheckoutFunction, paymentHoldOptions, }) {
|
|
21291
21291
|
var _a;
|
|
21292
21292
|
// Read fragments
|
|
21293
21293
|
const quote = readFragment(PaymentForm_QuoteFragment, maskedQuote);
|
|
@@ -21308,9 +21308,9 @@ function PaymentForm({ currencyId: accountCurrencyId, invoice, quote: maskedQuot
|
|
|
21308
21308
|
[ShowPaymentDetailsProvider, { value: undefined }],
|
|
21309
21309
|
[CustomCheckoutFunctionProvider, { value: customCheckoutFunction }],
|
|
21310
21310
|
];
|
|
21311
|
-
return (jsx(Fragment, { children: providers.reduceRight((acc, [Provider, props]) => createElement(Provider, props, acc), jsx(OverrideTokenContext.Provider, { value: { overrideToken }, children: jsx(SelectedPluginProvider, { accountId: accountId, children: jsx(StripeWrapper, { currencyId: currencyId, accountId: accountId, children: jsx(PaymentProvider, { quote: quote, invoice: invoice, accountId: accountId, onPaymentHoldSuccess: onPaymentHoldSuccess, onPaymentSuccess: onPaymentSuccess, paymentHoldOptions: paymentHoldOptions !== null && paymentHoldOptions !== void 0 ? paymentHoldOptions : {}, onSavePaymentMethod: onSavePaymentMethod, children: jsx(PaymentFormContent, {
|
|
21311
|
+
return (jsx(Fragment, { children: providers.reduceRight((acc, [Provider, props]) => createElement(Provider, props, acc), jsx(OverrideTokenContext.Provider, { value: { overrideToken }, children: jsx(SelectedPluginProvider, { accountId: accountId, children: jsx(StripeWrapper, { currencyId: currencyId, accountId: accountId, children: jsx(PaymentProvider, { quote: quote, invoice: invoice, accountId: accountId, onPaymentHoldSuccess: onPaymentHoldSuccess, onPaymentSuccess: onPaymentSuccess, paymentHoldOptions: paymentHoldOptions !== null && paymentHoldOptions !== void 0 ? paymentHoldOptions : {}, onSavePaymentMethod: onSavePaymentMethod, children: jsx(PaymentFormContent, { onPaymentMethodRemoved: onPaymentMethodRemoved, onSetDefaultPaymentMethod: onSetDefaultPaymentMethod }) }) }) }) })) }));
|
|
21312
21312
|
}
|
|
21313
|
-
function PaymentFormContent({
|
|
21313
|
+
function PaymentFormContent({ onPaymentMethodRemoved, onSetDefaultPaymentMethod, }) {
|
|
21314
21314
|
// Context
|
|
21315
21315
|
const [showPaymentMethodForm, setShowPaymentMethodForm] = useShowPaymentDetails();
|
|
21316
21316
|
const paymentType = usePaymentType();
|
|
@@ -21337,7 +21337,7 @@ function PaymentFormContent({ onRemovePaymentMethod, onSetDefaultPaymentMethod,
|
|
|
21337
21337
|
setDefaultPaymentMethodLoading,
|
|
21338
21338
|
enabled: !!paymentPlugins,
|
|
21339
21339
|
});
|
|
21340
|
-
const onClickRemove = useRemovePaymentMethod(
|
|
21340
|
+
const onClickRemove = useRemovePaymentMethod(onPaymentMethodRemoved, message => {
|
|
21341
21341
|
showErrorNotification$5(message, 'Error removing payment method');
|
|
21342
21342
|
});
|
|
21343
21343
|
function handleClickAddPaymentMethod() {
|
|
@@ -21422,23 +21422,26 @@ if (typeof window !== 'undefined') {
|
|
|
21422
21422
|
const shadowRoot = originalAttachShadow.call(this, init);
|
|
21423
21423
|
// Prevent watermark styles from being injected
|
|
21424
21424
|
const originalInnerHTMLSetter = (_a = Object.getOwnPropertyDescriptor(ShadowRoot.prototype, 'innerHTML')) === null || _a === void 0 ? void 0 : _a.set;
|
|
21425
|
-
console.log('originalInnerHTMLSetter', originalInnerHTMLSetter);
|
|
21426
21425
|
if (originalInnerHTMLSetter) {
|
|
21427
|
-
|
|
21428
|
-
|
|
21429
|
-
|
|
21430
|
-
|
|
21431
|
-
|
|
21432
|
-
|
|
21433
|
-
|
|
21434
|
-
|
|
21435
|
-
|
|
21436
|
-
|
|
21437
|
-
|
|
21438
|
-
|
|
21439
|
-
|
|
21440
|
-
|
|
21441
|
-
|
|
21426
|
+
try {
|
|
21427
|
+
Object.defineProperty(shadowRoot, 'innerHTML', {
|
|
21428
|
+
configurable: true,
|
|
21429
|
+
set: function (value) {
|
|
21430
|
+
// Block watermark injection
|
|
21431
|
+
if (typeof value === 'string' &&
|
|
21432
|
+
value.includes('background-image: url(data:image/webp')) {
|
|
21433
|
+
return; // Don't set the watermark HTML
|
|
21434
|
+
}
|
|
21435
|
+
originalInnerHTMLSetter.call(this, value);
|
|
21436
|
+
},
|
|
21437
|
+
get: function () {
|
|
21438
|
+
return this.innerHTML;
|
|
21439
|
+
},
|
|
21440
|
+
});
|
|
21441
|
+
}
|
|
21442
|
+
catch (e) {
|
|
21443
|
+
// Property already defined, ignore error (happens during hot module reloading)
|
|
21444
|
+
}
|
|
21442
21445
|
}
|
|
21443
21446
|
return shadowRoot;
|
|
21444
21447
|
};
|
|
@@ -21565,9 +21568,9 @@ function Invoice({ id, invoiceQuoteViewComponent, backButtonName, onBackButtonCl
|
|
|
21565
21568
|
className,
|
|
21566
21569
|
hideDownloadButton,
|
|
21567
21570
|
onInvoiceLoaded,
|
|
21568
|
-
}, children: jsx(ActualInvoice, { hidePaymentForm: hidePaymentForm, onSavePaymentMethod: onPaymentMethodSaved,
|
|
21571
|
+
}, children: jsx(ActualInvoice, { hidePaymentForm: hidePaymentForm, onSavePaymentMethod: onPaymentMethodSaved, onPaymentMethodRemoved: onPaymentMethodRemoved }) }));
|
|
21569
21572
|
}
|
|
21570
|
-
function ActualInvoice({ hidePaymentForm, onSavePaymentMethod,
|
|
21573
|
+
function ActualInvoice({ hidePaymentForm, onSavePaymentMethod, onPaymentMethodRemoved, }) {
|
|
21571
21574
|
// Context
|
|
21572
21575
|
const queryClient = useQueryClient();
|
|
21573
21576
|
const { id, invoiceQuoteViewComponent, backButtonName, onBackButtonClick, onPaymentSuccess, className, } = useContext(InvoiceQuoteContext);
|
|
@@ -21605,10 +21608,10 @@ function ActualInvoice({ hidePaymentForm, onSavePaymentMethod, onRemovePaymentMe
|
|
|
21605
21608
|
}, [formattedInvoice]);
|
|
21606
21609
|
if (!formattedInvoice)
|
|
21607
21610
|
return jsx(Fragment, {});
|
|
21608
|
-
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:
|
|
21611
|
+
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 => {
|
|
21609
21612
|
onSavePaymentMethod === null || onSavePaymentMethod === void 0 ? void 0 : onSavePaymentMethod(paymentMethodId);
|
|
21610
|
-
},
|
|
21611
|
-
|
|
21613
|
+
}, onPaymentMethodRemoved: paymentMethod => {
|
|
21614
|
+
onPaymentMethodRemoved === null || onPaymentMethodRemoved === void 0 ? void 0 : onPaymentMethodRemoved(paymentMethod.id);
|
|
21612
21615
|
} }) }))] }) }));
|
|
21613
21616
|
}
|
|
21614
21617
|
|
|
@@ -23631,7 +23634,7 @@ const QuoteCheckout = ({ account, onSuccess, onFail, quote: maskedQuote, taxatio
|
|
|
23631
23634
|
}
|
|
23632
23635
|
if (taxationRequiredAccountFields)
|
|
23633
23636
|
return (jsx(PaymentFormWrapper, { setMaxHeight: false, children: jsx(TaxationForm, { account: account, accountId: quote.accountId }) }));
|
|
23634
|
-
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),
|
|
23637
|
+
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), onPaymentMethodRemoved: (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 &&
|
|
23635
23638
|
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: () => {
|
|
23636
23639
|
couponsOnQuote === null || couponsOnQuote === void 0 ? void 0 : couponsOnQuote.forEach(couponCharge => {
|
|
23637
23640
|
var _a;
|
|
@@ -23722,13 +23725,13 @@ const Checkout = ({ onCancel, onSuccess, onFail, onRecalculateTaxes, invoice, op
|
|
|
23722
23725
|
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
|
|
23723
23726
|
bunny-overflow-auto bunny-height-full`, style: {
|
|
23724
23727
|
zIndex: 1001,
|
|
23725
|
-
}, 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),
|
|
23728
|
+
}, 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), onPaymentMethodRemoved: (paymentMethod) => onPaymentMethodRemoved === null || onPaymentMethodRemoved === void 0 ? void 0 : onPaymentMethodRemoved(paymentMethod.id) }) })) : quote ? (jsx(QuoteCheckout, { account: account, onFail: error => {
|
|
23726
23729
|
onFail(error);
|
|
23727
23730
|
}, onSuccess: onSuccess, quote: quote, taxationRequiredAccountFields: taxationRequiredAccountFields, token: token, onRecalculateTaxes: async () => {
|
|
23728
23731
|
if (recalculateTaxesEnabled) {
|
|
23729
23732
|
await recalculateTaxes();
|
|
23730
23733
|
}
|
|
23731
|
-
} })) : (jsx(PaymentForm, { onPaymentSuccess: onSuccess, onSavePaymentMethod: (paymentMethod) => onPaymentMethodSaved === null || onPaymentMethodSaved === void 0 ? void 0 : onPaymentMethodSaved(paymentMethod.savedPaymentMethodResponse.paymentMethodId),
|
|
23734
|
+
} })) : (jsx(PaymentForm, { onPaymentSuccess: onSuccess, onSavePaymentMethod: (paymentMethod) => onPaymentMethodSaved === null || onPaymentMethodSaved === void 0 ? void 0 : onPaymentMethodSaved(paymentMethod.savedPaymentMethodResponse.paymentMethodId), onPaymentMethodRemoved: (paymentMethod) => onPaymentMethodRemoved === null || onPaymentMethodRemoved === void 0 ? void 0 : onPaymentMethodRemoved(paymentMethod.id) }))] }), jsx(Footer, { className: "bunny-px-12" })] }) }));
|
|
23732
23735
|
};
|
|
23733
23736
|
|
|
23734
23737
|
function canEditChargeQuantity(charge) {
|
|
@@ -29644,7 +29647,7 @@ const PaymentFormSection = ({ hideBillingDetailsForm, isUpgradeFromTrial, onSave
|
|
|
29644
29647
|
// TODO: onSavePaymentMethod(response: any) should be cleaned up to have a response type (not any)
|
|
29645
29648
|
// and work with both stripe and demo pay requests
|
|
29646
29649
|
onSavePaymentMethod === null || onSavePaymentMethod === void 0 ? void 0 : onSavePaymentMethod(response.savedPaymentMethodResponse.paymentMethodId);
|
|
29647
|
-
},
|
|
29650
|
+
}, onPaymentMethodRemoved: response => {
|
|
29648
29651
|
onPaymentMethodRemoved === null || onPaymentMethodRemoved === void 0 ? void 0 : onPaymentMethodRemoved(response.id);
|
|
29649
29652
|
} }) }));
|
|
29650
29653
|
};
|
|
@@ -14,14 +14,14 @@ export declare const PaymentForm_QuoteFragment: import("gql.tada").TadaDocumentN
|
|
|
14
14
|
on: "Quote";
|
|
15
15
|
masked: true;
|
|
16
16
|
}>;
|
|
17
|
-
export declare function PaymentForm({ currencyId: accountCurrencyId, invoice, quote: maskedQuote, onPaymentSuccess, onPaymentHoldSuccess, accountId, onSavePaymentMethod,
|
|
17
|
+
export declare function PaymentForm({ currencyId: accountCurrencyId, invoice, quote: maskedQuote, onPaymentSuccess, onPaymentHoldSuccess, accountId, onSavePaymentMethod, onPaymentMethodRemoved, onSetDefaultPaymentMethod, overrideToken, customCheckoutFunction, paymentHoldOptions, }: {
|
|
18
18
|
currencyId?: string;
|
|
19
19
|
invoice?: FormattedInvoice | Invoice;
|
|
20
20
|
quote?: FragmentOf<typeof PaymentForm_QuoteFragment>;
|
|
21
21
|
onPaymentSuccess?: (response: any) => void;
|
|
22
22
|
onPaymentHoldSuccess?: (response: any) => void;
|
|
23
23
|
onSavePaymentMethod?: (response: any) => void;
|
|
24
|
-
|
|
24
|
+
onPaymentMethodRemoved?: (paymentMethod: PaymentMethodFragment) => void;
|
|
25
25
|
onSetDefaultPaymentMethod?: () => void;
|
|
26
26
|
accountId?: string;
|
|
27
27
|
overrideToken?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ResultOf } from 'gql.tada';
|
|
2
2
|
import { PaymentForm_PaymentMethodsFragment } from '../fragments/PaymentForm_PaymentMethodsFragment';
|
|
3
3
|
type PaymentMethodFragment = ResultOf<typeof PaymentForm_PaymentMethodsFragment>;
|
|
4
|
-
declare function useRemovePaymentMethod(
|
|
4
|
+
declare function useRemovePaymentMethod(onPaymentMethodRemoved?: (paymentMethod: PaymentMethodFragment) => void, onError?: (message: string) => void): (data: PaymentMethodFragment) => Promise<void>;
|
|
5
5
|
export default useRemovePaymentMethod;
|
package/dist/index.d.ts
CHANGED
|
@@ -107,14 +107,14 @@ declare const PaymentForm_QuoteFragment: gql_tada.TadaDocumentNode<{
|
|
|
107
107
|
on: "Quote";
|
|
108
108
|
masked: true;
|
|
109
109
|
}>;
|
|
110
|
-
declare function PaymentForm({ currencyId: accountCurrencyId, invoice, quote: maskedQuote, onPaymentSuccess, onPaymentHoldSuccess, accountId, onSavePaymentMethod,
|
|
110
|
+
declare function PaymentForm({ currencyId: accountCurrencyId, invoice, quote: maskedQuote, onPaymentSuccess, onPaymentHoldSuccess, accountId, onSavePaymentMethod, onPaymentMethodRemoved, onSetDefaultPaymentMethod, overrideToken, customCheckoutFunction, paymentHoldOptions, }: {
|
|
111
111
|
currencyId?: string;
|
|
112
112
|
invoice?: FormattedInvoice | Invoice$1;
|
|
113
113
|
quote?: FragmentOf<typeof PaymentForm_QuoteFragment>;
|
|
114
114
|
onPaymentSuccess?: (response: any) => void;
|
|
115
115
|
onPaymentHoldSuccess?: (response: any) => void;
|
|
116
116
|
onSavePaymentMethod?: (response: any) => void;
|
|
117
|
-
|
|
117
|
+
onPaymentMethodRemoved?: (paymentMethod: PaymentMethodFragment) => void;
|
|
118
118
|
onSetDefaultPaymentMethod?: () => void;
|
|
119
119
|
accountId?: string;
|
|
120
120
|
overrideToken?: string;
|
package/package.json
CHANGED