@bunnyapp/components 1.0.66-beta.1 → 1.0.66-beta.3
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 +18 -27
- package/dist/cjs/src/components/PaymentForm/PaymentForm.d.ts +1 -2
- package/dist/cjs/src/components/PaymentForm/PaymentMethodDetails.d.ts +1 -2
- package/dist/cjs/src/components/PaymentForm/Stripe/PaymentMethodForm.d.ts +1 -2
- package/dist/cjs/src/components/PaymentForm/Stripe/StripeForm.d.ts +1 -2
- package/dist/esm/index.js +18 -27
- package/dist/esm/src/components/PaymentForm/PaymentForm.d.ts +1 -2
- package/dist/esm/src/components/PaymentForm/PaymentMethodDetails.d.ts +1 -2
- package/dist/esm/src/components/PaymentForm/Stripe/PaymentMethodForm.d.ts +1 -2
- package/dist/esm/src/components/PaymentForm/Stripe/StripeForm.d.ts +1 -2
- package/dist/index.d.ts +1 -2
- package/package.json +2 -1
package/dist/cjs/index.js
CHANGED
|
@@ -13,6 +13,7 @@ var reactQuery = require('@tanstack/react-query');
|
|
|
13
13
|
var theme = require('antd/lib/theme/index.js');
|
|
14
14
|
var recoil = require('recoil');
|
|
15
15
|
var request = require('graphql-request');
|
|
16
|
+
var react$1 = require('@pdf-viewer/react');
|
|
16
17
|
var reactStripeJs = require('@stripe/react-stripe-js');
|
|
17
18
|
var index_js = require('@stripe/stripe-js/pure/index.js');
|
|
18
19
|
var parse = require('html-react-parser');
|
|
@@ -173,7 +174,7 @@ var BrandContext = react.createContext({
|
|
|
173
174
|
});
|
|
174
175
|
|
|
175
176
|
// This will be replaced at build time by rollup-plugin-replace
|
|
176
|
-
var PACKAGE_VERSION = '1.0.66-beta.
|
|
177
|
+
var PACKAGE_VERSION = '1.0.66-beta.3';
|
|
177
178
|
var createRequestHeaders = function (token) {
|
|
178
179
|
var headers = common.createClientDevHeaders(token);
|
|
179
180
|
// Add the components version header
|
|
@@ -454,7 +455,7 @@ var DocumentTemplatePreview = function (_a) {
|
|
|
454
455
|
if (!pdfUrl) {
|
|
455
456
|
return jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
456
457
|
}
|
|
457
|
-
return (jsxRuntime.jsx("div", __assign({ className: "
|
|
458
|
+
return (jsxRuntime.jsx("div", __assign({ className: "bunny-rounded bunny-w-full bunny-overflow-hidden bunny-grow bunny-min-h-0" }, { children: jsxRuntime.jsx(react$1.RPConfig, { children: jsxRuntime.jsx(react$1.RPProvider, __assign({ src: pdfUrl }, { children: jsxRuntime.jsx(react$1.RPDefaultLayout, __assign({ style: { height: '100%', width: '100%' } }, { children: jsxRuntime.jsx(react$1.RPPages, {}) })) })) }) })));
|
|
458
459
|
};
|
|
459
460
|
|
|
460
461
|
var MarkupContainer = defaultStyled.div(templateObject_1$c || (templateObject_1$c = __makeTemplateObject(["\n span {\n width: 100%;\n }\n"], ["\n span {\n width: 100%;\n }\n"])));
|
|
@@ -471,7 +472,7 @@ var InvoiceQuoteView = function (_a) {
|
|
|
471
472
|
color: secondaryColor,
|
|
472
473
|
}, type: "link" }, { children: backButtonName || 'Back' }))) : null }), !hideDownloadButton ? (jsxRuntime.jsx(antd.Button, __assign({ icon: jsxRuntime.jsx(icons.DownloadOutlined, {}), onClick: function () {
|
|
473
474
|
return downloadFile(apiHost + '/api/pdf/invoice/' + formattedInvoice.id, token);
|
|
474
|
-
} }, { children: "Download" }))) : null] }))) : null, isMobile ? (jsxRuntime.jsxs(MarkupContainer, __assign({ className: "bunny-flex bunny-flex-col bunny-gap-4 bunny-grow bunny-w-full bunny-shadow-padding-xb bunny-overflow-auto" }, { children: [targetUrl ? (jsxRuntime.jsx(DocumentTemplatePreview, { targetUrl: targetUrl })) : (jsxRuntime.jsx(interweave.Markup, { content: html })), children] }))) : (jsxRuntime.jsxs(MarkupContainer, __assign({ className: "bunny-flex bunny-flex-col bunny-gap-4 bunny-p-4 bunny-w-full bunny-bg-white ".concat(shadow ? shadow : 'bunny-shadow-md', " bunny-rounded-md"), style: {
|
|
475
|
+
} }, { children: "Download" }))) : null] }))) : null, isMobile ? (jsxRuntime.jsxs(MarkupContainer, __assign({ className: "bunny-flex bunny-flex-col bunny-gap-4 bunny-grow bunny-w-full bunny-shadow-padding-xb bunny-overflow-auto" }, { children: [targetUrl ? (jsxRuntime.jsx(DocumentTemplatePreview, { targetUrl: targetUrl })) : (jsxRuntime.jsx(interweave.Markup, { content: html })), children] }))) : (jsxRuntime.jsxs(MarkupContainer, __assign({ className: "bunny-flex bunny-flex-col bunny-gap-4 bunny-p-4 bunny-w-full bunny-bg-white bunny-grow ".concat(shadow ? shadow : 'bunny-shadow-md', " bunny-rounded-md"), style: {
|
|
475
476
|
minWidth: '750px',
|
|
476
477
|
} }, { children: [targetUrl ? (jsxRuntime.jsx(DocumentTemplatePreview, { targetUrl: targetUrl })) : (jsxRuntime.jsx(interweave.Markup, { content: html })), children] })))] })));
|
|
477
478
|
};
|
|
@@ -18892,7 +18893,7 @@ function useSave(_a) {
|
|
|
18892
18893
|
}
|
|
18893
18894
|
|
|
18894
18895
|
var PaymentMethodForm = function (_a) {
|
|
18895
|
-
var
|
|
18896
|
+
var plugin = _a.plugin, onFail = _a.onFail, onSavePaymentMethod = _a.onSavePaymentMethod;
|
|
18896
18897
|
// Hooks
|
|
18897
18898
|
var _b = useSave({
|
|
18898
18899
|
onSaveSuccess: onSavePaymentMethod,
|
|
@@ -18917,33 +18918,23 @@ var PaymentMethodForm = function (_a) {
|
|
|
18917
18918
|
}
|
|
18918
18919
|
});
|
|
18919
18920
|
}); };
|
|
18920
|
-
console.log('country', country);
|
|
18921
|
-
console.log('plugin', plugin);
|
|
18922
|
-
console.log('plugin', plugin);
|
|
18923
18921
|
return (jsxRuntime.jsxs("form", { children: [jsxRuntime.jsx(reactStripeJs.PaymentElement, { options: {
|
|
18924
18922
|
layout: { type: 'accordion' },
|
|
18925
|
-
defaultValues: {
|
|
18926
|
-
billingDetails: {
|
|
18927
|
-
address: {
|
|
18928
|
-
country: country,
|
|
18929
|
-
},
|
|
18930
|
-
},
|
|
18931
|
-
},
|
|
18932
18923
|
} }), jsxRuntime.jsx(SavePaymentMethodFooter, { isSaving: isSaving, onSave: onSubmit })] }));
|
|
18933
18924
|
};
|
|
18934
18925
|
|
|
18935
18926
|
// This is just a wrapper to fetch the stripe object and pass it to the form
|
|
18936
18927
|
var StripeForm = function (_a) {
|
|
18937
|
-
var
|
|
18938
|
-
return (jsxRuntime.jsx(PaymentMethodForm, {
|
|
18928
|
+
var plugin = _a.plugin, onFail = _a.onFail, onSavePaymentMethod = _a.onSavePaymentMethod;
|
|
18929
|
+
return (jsxRuntime.jsx(PaymentMethodForm, { plugin: plugin, onFail: onFail, onSavePaymentMethod: onSavePaymentMethod }));
|
|
18939
18930
|
};
|
|
18940
18931
|
|
|
18941
18932
|
var PaymentMethodDetails = function (_a) {
|
|
18942
18933
|
var _b, _c;
|
|
18943
|
-
var
|
|
18934
|
+
var onFail = _a.onFail, plugin = _a.plugin, onSavePaymentMethod = _a.onSavePaymentMethod;
|
|
18944
18935
|
switch ((_c = (_b = plugin.components) === null || _b === void 0 ? void 0 : _b.frontend) === null || _c === void 0 ? void 0 : _c[0].name) {
|
|
18945
18936
|
case 'StripePayment':
|
|
18946
|
-
return (jsxRuntime.jsx(StripeForm, {
|
|
18937
|
+
return (jsxRuntime.jsx(StripeForm, { onFail: onFail, onSavePaymentMethod: onSavePaymentMethod, plugin: plugin }));
|
|
18947
18938
|
case 'DemoPayPayment':
|
|
18948
18939
|
return (jsxRuntime.jsx(DemoPayForm, { onFail: onFail, onSavePaymentMethod: onSavePaymentMethod, plugin: plugin }));
|
|
18949
18940
|
default:
|
|
@@ -19090,7 +19081,7 @@ function useSetDefaultPaymentMethod(paymentPlugins, apiHost, token, accountId, o
|
|
|
19090
19081
|
var showErrorNotification$1 = common.useErrorNotification();
|
|
19091
19082
|
var PaymentForm = function (_a) {
|
|
19092
19083
|
var _b;
|
|
19093
|
-
var
|
|
19084
|
+
var invoice = _a.invoice, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, onPaymentHoldSuccess = _a.onPaymentHoldSuccess, quote = _a.quote, accountId = _a.accountId, onSavePaymentMethod = _a.onSavePaymentMethod, onRemovePaymentMethod = _a.onRemovePaymentMethod, onSetDefaultPaymentMethod = _a.onSetDefaultPaymentMethod, overrideToken = _a.overrideToken, customCheckoutFunction = _a.customCheckoutFunction, currencyIdFromProps = _a.currencyId, paymentHoldOptions = _a.paymentHoldOptions;
|
|
19094
19085
|
// Local state
|
|
19095
19086
|
var _c = react.useState(false), showPaymentMethodForm = _c[0], setShowPaymentMethodForm = _c[1];
|
|
19096
19087
|
// Simple hooks
|
|
@@ -19174,7 +19165,7 @@ var PaymentForm = function (_a) {
|
|
|
19174
19165
|
key: '1',
|
|
19175
19166
|
showArrow: false,
|
|
19176
19167
|
label: !showPaymentMethodForm ? (jsxRuntime.jsx("div", __assign({ className: "bunny-pt-2" }, { children: jsxRuntime.jsx(antd.Button, __assign({ onClick: handleClickAddPaymentMethod, type: "default", className: "bunny-w-full", id: "addPaymentMethod" }, { children: "Add payment method" })) }))) : null,
|
|
19177
|
-
children: (jsxRuntime.jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-gap-2 bunny-mt-2" }, { children: [jsxRuntime.jsx(PaymentMethodSelector, { onSelect: setSelectorPaymentMethodPlugin, paymentMethodAllowedPlugins: paymentPlugins, value: selectorPaymentMethodPlugin }), selectorPaymentMethodPlugin && (jsxRuntime.jsx("div", __assign({ className: "bunny-flex bunny-flex-col" }, { children: jsxRuntime.jsx(PaymentMethodDetails, {
|
|
19168
|
+
children: (jsxRuntime.jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-gap-2 bunny-mt-2" }, { children: [jsxRuntime.jsx(PaymentMethodSelector, { onSelect: setSelectorPaymentMethodPlugin, paymentMethodAllowedPlugins: paymentPlugins, value: selectorPaymentMethodPlugin }), selectorPaymentMethodPlugin && (jsxRuntime.jsx("div", __assign({ className: "bunny-flex bunny-flex-col" }, { children: jsxRuntime.jsx(PaymentMethodDetails, { onFail: onFail, onSavePaymentMethod: handleSavePaymentMethod, plugin: selectorPaymentMethodPlugin }) })))] }))),
|
|
19178
19169
|
},
|
|
19179
19170
|
] }), paying && !selectedPaymentPluginIsManualPayment ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: defaultPaymentMethod && selectedPaymentMethodPlugin ? (jsxRuntime.jsx("div", __assign({ className: "bunny-px-4" }, { children: jsxRuntime.jsx(CheckoutFooter, { quote: quote, invoice: invoice, onPaymentSuccess: handlePaymentSuccess, onPaymentHoldSuccess: onPaymentHoldSuccess, plugin: selectedPaymentMethodPlugin, paymentHoldOptions: paymentHoldOptions }) }))) : null })) : null] }) })) })) })));
|
|
19180
19171
|
};
|
|
@@ -19241,7 +19232,7 @@ function ActualInvoice() {
|
|
|
19241
19232
|
}, [formattedInvoice]);
|
|
19242
19233
|
if (!formattedInvoice)
|
|
19243
19234
|
return jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
19244
|
-
return (jsxRuntime.jsx("div", __assign({ className: "bunny-invoice-container" }, { children: jsxRuntime.jsxs("div", __assign({ className: "bunny-flex bunny-gap-6 bunny-overflow-hidden ".concat(isMobile ? 'bunny-flex-col bunny-w-full' : '', " ").concat(className) }, { children: [formattedInvoice.isLegacy ? (jsxRuntime.jsx("div", __assign({ 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 && (jsxRuntime.jsx("div", __assign({ className: "bunny-w-full ".concat(hideDownloadButton || formattedInvoice.isLegacy ? '' : 'pt-12') }, { children: jsxRuntime.jsx(PaymentForm, {
|
|
19235
|
+
return (jsxRuntime.jsx("div", __assign({ className: "bunny-invoice-container" }, { children: jsxRuntime.jsxs("div", __assign({ className: "bunny-flex bunny-gap-6 bunny-overflow-hidden ".concat(isMobile ? 'bunny-flex-col bunny-w-full' : '', " ").concat(className) }, { children: [formattedInvoice.isLegacy ? (jsxRuntime.jsx("div", __assign({ 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 && (jsxRuntime.jsx("div", __assign({ className: "bunny-w-full ".concat(hideDownloadButton || formattedInvoice.isLegacy ? '' : 'pt-12') }, { children: jsxRuntime.jsx(PaymentForm, { onPaymentSuccess: onSuccess, onFail: onFail, invoice: formattedInvoice }) })))] })) })));
|
|
19245
19236
|
}
|
|
19246
19237
|
|
|
19247
19238
|
var MUTATION$7 = function (id) { return "\n query formattedQuote ($id: ID) {\n formattedQuote (id: $id) {\n quote {\n documentTemplateId\n documents { id filename size date url }\n firstInvoice {\n id\n state\n }\n payableId\n id\n payToAccept\n currentPaymentHold {\n createdAt\n expiresAt\n id\n updatedAt\n paymentMethod {\n accountId\n createdAt\n expirationDate\n failureCode\n id\n isDefault\n lastSuccess\n paymentType\n pluginId\n state\n updatedAt\n metadata {\n description\n expiration\n icon\n identifier\n issuer\n kind\n }\n }\n }\n }\n payableId\n acceptedAt\n acceptedByName\n amount\n amountDue\n amountsByPeriod {\n id\n name\n amount\n }\n billingCity\n billingCountry\n billingState\n billingStreet\n billingZip\n contactName\n currency\n customerBillingCity\n customerBillingCountry\n customerBillingState\n customerBillingStreet\n customerBillingZip\n customerName\n discount\n discountValue\n duration\n endDate\n expiresAt\n html\n formattedLines {\n amount\n amountsByPeriod {\n quantity\n id\n name\n startDate\n endDate\n amount\n amountsByTier {\n id\n tier {\n starts\n ends\n price\n }\n quantity\n amount\n }\n prorationRate\n }\n billingPeriodEnd\n billingPeriodStart\n chargeType\n discount\n frequency\n isRamp\n periods\n planName\n position\n price\n priceDecimals\n priceListChargeId\n priceListChargeName\n priceListId\n priceListName\n priceTiers {\n price\n starts\n }\n pricingModel\n productName\n prorationRate\n quantity\n showProductNameOnLineItem\n taxCode\n trialEndDate\n trialStartDate\n unitOfMeasure\n vatCode\n }\n netPaymentDays\n notes\n number\n poNumberRequired\n salesContactEmail\n sharedAt\n startDate\n state\n subtotal\n taxAmount\n taxNumberLabel\n taxNumberRequired\n vendorName\n }\n }"; };
|
|
@@ -19710,7 +19701,7 @@ function ActualQuote() {
|
|
|
19710
19701
|
if ((firstInvoice === null || firstInvoice === void 0 ? void 0 : firstInvoice.state) === 'PAID' && paymentHoldCompleted) {
|
|
19711
19702
|
return jsxRuntime.jsx(Invoice, { id: firstInvoice.id });
|
|
19712
19703
|
}
|
|
19713
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-gap-4 ".concat(isMobile ? 'bunny-w-full bunny-overflow-hidden' : '', " ").concat(className) }, { children: [jsxRuntime.jsx(QuoteButtons, { isAccepted: isAccepted, formattedQuote: formattedQuote, isMobile: isMobile, hideDownloadButton: hideDownloadButton, id: id, isAccepting: isAccepting, handleClickAccept: handleClickAccept, setPaymentHoldModalVisible: setPaymentHoldModalVisible, shouldDoPaymentHold: shouldDoPaymentHold, paymentHoldCompleted: paymentHoldCompleted, paymentHold: paymentHold }), jsxRuntime.jsx(InvoiceQuoteView, __assign({ html: formattedQuote.html, targetUrl: ((_b = formattedQuote === null || formattedQuote === void 0 ? void 0 : formattedQuote.quote) === null || _b === void 0 ? void 0 : _b.documentTemplateId)
|
|
19704
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-gap-4 bunny-grow ".concat(isMobile ? 'bunny-w-full bunny-overflow-hidden' : '', " ").concat(className) }, { children: [jsxRuntime.jsx(QuoteButtons, { isAccepted: isAccepted, formattedQuote: formattedQuote, isMobile: isMobile, hideDownloadButton: hideDownloadButton, id: id, isAccepting: isAccepting, handleClickAccept: handleClickAccept, setPaymentHoldModalVisible: setPaymentHoldModalVisible, shouldDoPaymentHold: shouldDoPaymentHold, paymentHoldCompleted: paymentHoldCompleted, paymentHold: paymentHold }), jsxRuntime.jsx(InvoiceQuoteView, __assign({ html: formattedQuote.html, targetUrl: ((_b = formattedQuote === null || formattedQuote === void 0 ? void 0 : formattedQuote.quote) === null || _b === void 0 ? void 0 : _b.documentTemplateId)
|
|
19714
19705
|
? "".concat(apiHost, "/api/pdf/quote/").concat(formattedQuote.quote.id)
|
|
19715
19706
|
: undefined }, { children: ((_d = (_c = formattedQuote.quote) === null || _c === void 0 ? void 0 : _c.documents) === null || _d === void 0 ? void 0 : _d.length) > 0 ? (jsxRuntime.jsx("div", __assign({ className: "bunny-flex bunny-flex-col bunny-items-end" }, { children: formattedQuote.quote.documents.map(function (doc, index) {
|
|
19716
19707
|
return (jsxRuntime.jsx(antd.Button, __assign({ download: doc.filename, href: doc.url, type: "link" }, { children: doc.filename }), index));
|
|
@@ -20337,7 +20328,7 @@ var Footer = function (_a) {
|
|
|
20337
20328
|
var className = _a.className;
|
|
20338
20329
|
var _b = useCurrentUserData(), privacyUrl = _b.privacyUrl, termsUrl = _b.termsUrl;
|
|
20339
20330
|
var isMobile = common.useIsMobile();
|
|
20340
|
-
return (jsxRuntime.jsxs("div", __assign({ className: "bunny-flex bunny-items-center bunny-justify-between bunny-shrink-0 ".concat(isMobile ? 'bunny-flex-col bunny-gap-2
|
|
20331
|
+
return (jsxRuntime.jsxs("div", __assign({ className: "bunny-flex bunny-items-center bunny-justify-between bunny-shrink-0 ".concat(isMobile ? 'bunny-flex-col bunny-gap-2' : '', " ").concat(className) }, { children: [(termsUrl || privacyUrl) && (jsxRuntime.jsxs("div", __assign({ className: "bunny-flex bunny-items-center bunny-gap-3" }, { children: [termsUrl && (jsxRuntime.jsx(StyedLink, __assign({ className: "bunny-text-xs bunny-text-slate-400", href: termsUrl, rel: "noopener noreferrer", target: "_blank", type: "text" }, { children: "Terms" }))), privacyUrl && (jsxRuntime.jsx(StyedLink, __assign({ className: "bunny-text-xs bunny-text-slate-400", href: privacyUrl, rel: "noopener noreferrer", target: "_blank", type: "text" }, { children: "Privacy" })))] }))), jsxRuntime.jsx(BunnyMarketingLink, {})] })));
|
|
20341
20332
|
};
|
|
20342
20333
|
var BunnyMarketingLink = function () {
|
|
20343
20334
|
var _a = react.useState(false), isHovered = _a[0], setIsHovered = _a[1];
|
|
@@ -20906,9 +20897,9 @@ var Checkout = function (_a) {
|
|
|
20906
20897
|
return null;
|
|
20907
20898
|
return (jsxRuntime.jsx("div", __assign({ className: "bunny-flex bunny-flex-col bunny-fixed bunny-top-0 bunny-left-0 bunny-right-0 bunny-bottom-0 bunny-bg-slate-50 bunny-overflow-auto", style: {
|
|
20908
20899
|
zIndex: 1001,
|
|
20909
|
-
} }, { children: jsxRuntime.jsxs("div", __assign({ className: pageWrapperClassName(isMobile) }, { children: [jsxRuntime.jsx("div", __assign({ className: "bunny-flex bunny-justify-end bunny-w-full" }, { children: jsxRuntime.jsx(icons.CloseOutlined, { className: "bunny-text-base bunny-shadow-padding-xb", onClick: onCancel }) })), jsxRuntime.jsxs("div", __assign({ className: "bunny-flex bunny-justify-end bunny-pt-4 bunny-gap-4 ".concat(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 : quote ? quote.formattedQuote.html : '' })), !isMobile && ((invoice === null || invoice === void 0 ? void 0 : invoice.html) || ((_c = quote === null || quote === void 0 ? void 0 : quote.formattedQuote) === null || _c === void 0 ? void 0 : _c.html)) && (jsxRuntime.jsx(antd.Divider, { className: "bunny-h-full", type: "vertical" })), invoice ? (jsxRuntime.jsx("div", __assign({ className: "bunny-w-full bunny-pt-12" }, { children: jsxRuntime.jsx(PaymentForm, {
|
|
20900
|
+
} }, { children: jsxRuntime.jsxs("div", __assign({ className: pageWrapperClassName(isMobile) }, { children: [jsxRuntime.jsx("div", __assign({ className: "bunny-flex bunny-justify-end bunny-w-full" }, { children: jsxRuntime.jsx(icons.CloseOutlined, { className: "bunny-text-base bunny-shadow-padding-xb", onClick: onCancel }) })), jsxRuntime.jsxs("div", __assign({ className: "bunny-flex bunny-justify-end bunny-pt-4 bunny-gap-4 ".concat(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 : quote ? quote.formattedQuote.html : '' })), !isMobile && ((invoice === null || invoice === void 0 ? void 0 : invoice.html) || ((_c = quote === null || quote === void 0 ? void 0 : quote.formattedQuote) === null || _c === void 0 ? void 0 : _c.html)) && (jsxRuntime.jsx(antd.Divider, { className: "bunny-h-full", type: "vertical" })), invoice ? (jsxRuntime.jsx("div", __assign({ className: "bunny-w-full bunny-pt-12" }, { children: jsxRuntime.jsx(PaymentForm, { onPaymentSuccess: onSuccess, onFail: onFail, invoice: invoice }) }))) : quote ? (jsxRuntime.jsx(QuoteCheckout, { account: account, onFail: function (error) {
|
|
20910
20901
|
onFail(error);
|
|
20911
|
-
}, onSuccess: onSuccess, quote: quote, taxationRequiredAccountFields: taxationRequiredAccountFields, token: token })) : (jsxRuntime.jsx(PaymentForm, {
|
|
20902
|
+
}, onSuccess: onSuccess, quote: quote, taxationRequiredAccountFields: taxationRequiredAccountFields, token: token })) : (jsxRuntime.jsx(PaymentForm, { onFail: function (error) {
|
|
20912
20903
|
onFail(error);
|
|
20913
20904
|
}, onPaymentSuccess: onSuccess }))] })), jsxRuntime.jsx(Footer, {})] })) })));
|
|
20914
20905
|
};
|
|
@@ -23295,8 +23286,8 @@ var PaymentFormSection = function (_a) {
|
|
|
23295
23286
|
var onTokenExpired = react.useContext(BunnyContext).onTokenExpired;
|
|
23296
23287
|
var handleAllErrorFormats = common.useAllErrorFormats(onTokenExpired);
|
|
23297
23288
|
var showSuccessNotification = common.useSuccessNotification();
|
|
23298
|
-
|
|
23299
|
-
return (jsxRuntime.jsx("div", __assign({ className: "".concat(isMobile || hideBillingDetailsForm ? 'bunny-w-full' : 'bunny-w-1/2 bunny-pt-4', " bunny-flex bunny-justify-center") }, { children: jsxRuntime.jsx(PaymentForm, {
|
|
23289
|
+
useCurrentUserData().account;
|
|
23290
|
+
return (jsxRuntime.jsx("div", __assign({ className: "".concat(isMobile || hideBillingDetailsForm ? 'bunny-w-full' : 'bunny-w-1/2 bunny-pt-4', " bunny-flex bunny-justify-center") }, { children: jsxRuntime.jsx(PaymentForm, { onFail: function (error) {
|
|
23300
23291
|
handleAllErrorFormats(error);
|
|
23301
23292
|
}, onSavePaymentMethod: function () {
|
|
23302
23293
|
showSuccessNotification('Your payment method has been saved');
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { FormattedInvoice, PluginData, Quote } from '@bunnyapp/common';
|
|
2
|
-
export declare const PaymentForm: ({
|
|
3
|
-
country?: string | undefined;
|
|
2
|
+
export declare const PaymentForm: ({ invoice, onFail, onPaymentSuccess, onPaymentHoldSuccess, quote, accountId, onSavePaymentMethod, onRemovePaymentMethod, onSetDefaultPaymentMethod, overrideToken, customCheckoutFunction, currencyId: currencyIdFromProps, paymentHoldOptions, }: {
|
|
4
3
|
invoice?: FormattedInvoice | undefined;
|
|
5
4
|
quote?: Quote | undefined;
|
|
6
5
|
onFail: (error: any) => void;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { PluginData } from '@bunnyapp/common';
|
|
2
|
-
declare const PaymentMethodDetails: ({
|
|
3
|
-
country?: string | undefined;
|
|
2
|
+
declare const PaymentMethodDetails: ({ onFail, plugin, onSavePaymentMethod, }: {
|
|
4
3
|
onFail: (error: any) => void;
|
|
5
4
|
plugin: PluginData;
|
|
6
5
|
onSavePaymentMethod: () => void;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { PluginData } from '@bunnyapp/common';
|
|
2
|
-
declare const PaymentMethodForm: ({
|
|
3
|
-
country?: string | undefined;
|
|
2
|
+
declare const PaymentMethodForm: ({ plugin, onFail, onSavePaymentMethod, }: {
|
|
4
3
|
plugin: PluginData;
|
|
5
4
|
onFail: (error: any) => void;
|
|
6
5
|
onSavePaymentMethod: (response: any) => void;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { PluginData } from '@bunnyapp/common';
|
|
2
|
-
declare const StripeForm: ({
|
|
3
|
-
country?: string | undefined;
|
|
2
|
+
declare const StripeForm: ({ plugin, onFail, onSavePaymentMethod, }: {
|
|
4
3
|
plugin: PluginData;
|
|
5
4
|
onFail: (error: any) => void;
|
|
6
5
|
onSavePaymentMethod: (response: any) => void;
|
package/dist/esm/index.js
CHANGED
|
@@ -9,6 +9,7 @@ import { QueryClient, QueryClientProvider, useQuery, useQueryClient, useMutation
|
|
|
9
9
|
import theme from 'antd/lib/theme/index.js';
|
|
10
10
|
import { RecoilRoot } from 'recoil';
|
|
11
11
|
import request, { GraphQLClient } from 'graphql-request';
|
|
12
|
+
import { RPConfig, RPProvider, RPDefaultLayout, RPPages } from '@pdf-viewer/react';
|
|
12
13
|
import { useElements, useStripe, PaymentElement, Elements } from '@stripe/react-stripe-js';
|
|
13
14
|
import { loadStripe } from '@stripe/stripe-js/pure/index.js';
|
|
14
15
|
import parse from 'html-react-parser';
|
|
@@ -143,7 +144,7 @@ var BrandContext = createContext({
|
|
|
143
144
|
});
|
|
144
145
|
|
|
145
146
|
// This will be replaced at build time by rollup-plugin-replace
|
|
146
|
-
var PACKAGE_VERSION = '1.0.66-beta.
|
|
147
|
+
var PACKAGE_VERSION = '1.0.66-beta.3';
|
|
147
148
|
var createRequestHeaders = function (token) {
|
|
148
149
|
var headers = createClientDevHeaders(token);
|
|
149
150
|
// Add the components version header
|
|
@@ -424,7 +425,7 @@ var DocumentTemplatePreview = function (_a) {
|
|
|
424
425
|
if (!pdfUrl) {
|
|
425
426
|
return jsx(Fragment, {});
|
|
426
427
|
}
|
|
427
|
-
return (jsx("div", __assign({ className: "
|
|
428
|
+
return (jsx("div", __assign({ className: "bunny-rounded bunny-w-full bunny-overflow-hidden bunny-grow bunny-min-h-0" }, { children: jsx(RPConfig, { children: jsx(RPProvider, __assign({ src: pdfUrl }, { children: jsx(RPDefaultLayout, __assign({ style: { height: '100%', width: '100%' } }, { children: jsx(RPPages, {}) })) })) }) })));
|
|
428
429
|
};
|
|
429
430
|
|
|
430
431
|
var MarkupContainer = defaultStyled.div(templateObject_1$c || (templateObject_1$c = __makeTemplateObject(["\n span {\n width: 100%;\n }\n"], ["\n span {\n width: 100%;\n }\n"])));
|
|
@@ -441,7 +442,7 @@ var InvoiceQuoteView = function (_a) {
|
|
|
441
442
|
color: secondaryColor,
|
|
442
443
|
}, type: "link" }, { children: backButtonName || 'Back' }))) : null }), !hideDownloadButton ? (jsx(Button, __assign({ icon: jsx(DownloadOutlined, {}), onClick: function () {
|
|
443
444
|
return downloadFile(apiHost + '/api/pdf/invoice/' + formattedInvoice.id, token);
|
|
444
|
-
} }, { children: "Download" }))) : null] }))) : null, isMobile ? (jsxs(MarkupContainer, __assign({ className: "bunny-flex bunny-flex-col bunny-gap-4 bunny-grow bunny-w-full bunny-shadow-padding-xb bunny-overflow-auto" }, { children: [targetUrl ? (jsx(DocumentTemplatePreview, { targetUrl: targetUrl })) : (jsx(Markup, { content: html })), children] }))) : (jsxs(MarkupContainer, __assign({ className: "bunny-flex bunny-flex-col bunny-gap-4 bunny-p-4 bunny-w-full bunny-bg-white ".concat(shadow ? shadow : 'bunny-shadow-md', " bunny-rounded-md"), style: {
|
|
445
|
+
} }, { children: "Download" }))) : null] }))) : null, isMobile ? (jsxs(MarkupContainer, __assign({ className: "bunny-flex bunny-flex-col bunny-gap-4 bunny-grow bunny-w-full bunny-shadow-padding-xb bunny-overflow-auto" }, { children: [targetUrl ? (jsx(DocumentTemplatePreview, { targetUrl: targetUrl })) : (jsx(Markup, { content: html })), children] }))) : (jsxs(MarkupContainer, __assign({ className: "bunny-flex bunny-flex-col bunny-gap-4 bunny-p-4 bunny-w-full bunny-bg-white bunny-grow ".concat(shadow ? shadow : 'bunny-shadow-md', " bunny-rounded-md"), style: {
|
|
445
446
|
minWidth: '750px',
|
|
446
447
|
} }, { children: [targetUrl ? (jsx(DocumentTemplatePreview, { targetUrl: targetUrl })) : (jsx(Markup, { content: html })), children] })))] })));
|
|
447
448
|
};
|
|
@@ -18862,7 +18863,7 @@ function useSave(_a) {
|
|
|
18862
18863
|
}
|
|
18863
18864
|
|
|
18864
18865
|
var PaymentMethodForm = function (_a) {
|
|
18865
|
-
var
|
|
18866
|
+
var plugin = _a.plugin, onFail = _a.onFail, onSavePaymentMethod = _a.onSavePaymentMethod;
|
|
18866
18867
|
// Hooks
|
|
18867
18868
|
var _b = useSave({
|
|
18868
18869
|
onSaveSuccess: onSavePaymentMethod,
|
|
@@ -18887,33 +18888,23 @@ var PaymentMethodForm = function (_a) {
|
|
|
18887
18888
|
}
|
|
18888
18889
|
});
|
|
18889
18890
|
}); };
|
|
18890
|
-
console.log('country', country);
|
|
18891
|
-
console.log('plugin', plugin);
|
|
18892
|
-
console.log('plugin', plugin);
|
|
18893
18891
|
return (jsxs("form", { children: [jsx(PaymentElement, { options: {
|
|
18894
18892
|
layout: { type: 'accordion' },
|
|
18895
|
-
defaultValues: {
|
|
18896
|
-
billingDetails: {
|
|
18897
|
-
address: {
|
|
18898
|
-
country: country,
|
|
18899
|
-
},
|
|
18900
|
-
},
|
|
18901
|
-
},
|
|
18902
18893
|
} }), jsx(SavePaymentMethodFooter, { isSaving: isSaving, onSave: onSubmit })] }));
|
|
18903
18894
|
};
|
|
18904
18895
|
|
|
18905
18896
|
// This is just a wrapper to fetch the stripe object and pass it to the form
|
|
18906
18897
|
var StripeForm = function (_a) {
|
|
18907
|
-
var
|
|
18908
|
-
return (jsx(PaymentMethodForm, {
|
|
18898
|
+
var plugin = _a.plugin, onFail = _a.onFail, onSavePaymentMethod = _a.onSavePaymentMethod;
|
|
18899
|
+
return (jsx(PaymentMethodForm, { plugin: plugin, onFail: onFail, onSavePaymentMethod: onSavePaymentMethod }));
|
|
18909
18900
|
};
|
|
18910
18901
|
|
|
18911
18902
|
var PaymentMethodDetails = function (_a) {
|
|
18912
18903
|
var _b, _c;
|
|
18913
|
-
var
|
|
18904
|
+
var onFail = _a.onFail, plugin = _a.plugin, onSavePaymentMethod = _a.onSavePaymentMethod;
|
|
18914
18905
|
switch ((_c = (_b = plugin.components) === null || _b === void 0 ? void 0 : _b.frontend) === null || _c === void 0 ? void 0 : _c[0].name) {
|
|
18915
18906
|
case 'StripePayment':
|
|
18916
|
-
return (jsx(StripeForm, {
|
|
18907
|
+
return (jsx(StripeForm, { onFail: onFail, onSavePaymentMethod: onSavePaymentMethod, plugin: plugin }));
|
|
18917
18908
|
case 'DemoPayPayment':
|
|
18918
18909
|
return (jsx(DemoPayForm, { onFail: onFail, onSavePaymentMethod: onSavePaymentMethod, plugin: plugin }));
|
|
18919
18910
|
default:
|
|
@@ -19060,7 +19051,7 @@ function useSetDefaultPaymentMethod(paymentPlugins, apiHost, token, accountId, o
|
|
|
19060
19051
|
var showErrorNotification$1 = useErrorNotification();
|
|
19061
19052
|
var PaymentForm = function (_a) {
|
|
19062
19053
|
var _b;
|
|
19063
|
-
var
|
|
19054
|
+
var invoice = _a.invoice, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, onPaymentHoldSuccess = _a.onPaymentHoldSuccess, quote = _a.quote, accountId = _a.accountId, onSavePaymentMethod = _a.onSavePaymentMethod, onRemovePaymentMethod = _a.onRemovePaymentMethod, onSetDefaultPaymentMethod = _a.onSetDefaultPaymentMethod, overrideToken = _a.overrideToken, customCheckoutFunction = _a.customCheckoutFunction, currencyIdFromProps = _a.currencyId, paymentHoldOptions = _a.paymentHoldOptions;
|
|
19064
19055
|
// Local state
|
|
19065
19056
|
var _c = useState(false), showPaymentMethodForm = _c[0], setShowPaymentMethodForm = _c[1];
|
|
19066
19057
|
// Simple hooks
|
|
@@ -19144,7 +19135,7 @@ var PaymentForm = function (_a) {
|
|
|
19144
19135
|
key: '1',
|
|
19145
19136
|
showArrow: false,
|
|
19146
19137
|
label: !showPaymentMethodForm ? (jsx("div", __assign({ className: "bunny-pt-2" }, { children: jsx(Button, __assign({ onClick: handleClickAddPaymentMethod, type: "default", className: "bunny-w-full", id: "addPaymentMethod" }, { children: "Add payment method" })) }))) : null,
|
|
19147
|
-
children: (jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-gap-2 bunny-mt-2" }, { children: [jsx(PaymentMethodSelector, { onSelect: setSelectorPaymentMethodPlugin, paymentMethodAllowedPlugins: paymentPlugins, value: selectorPaymentMethodPlugin }), selectorPaymentMethodPlugin && (jsx("div", __assign({ className: "bunny-flex bunny-flex-col" }, { children: jsx(PaymentMethodDetails, {
|
|
19138
|
+
children: (jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-gap-2 bunny-mt-2" }, { children: [jsx(PaymentMethodSelector, { onSelect: setSelectorPaymentMethodPlugin, paymentMethodAllowedPlugins: paymentPlugins, value: selectorPaymentMethodPlugin }), selectorPaymentMethodPlugin && (jsx("div", __assign({ className: "bunny-flex bunny-flex-col" }, { children: jsx(PaymentMethodDetails, { onFail: onFail, onSavePaymentMethod: handleSavePaymentMethod, plugin: selectorPaymentMethodPlugin }) })))] }))),
|
|
19148
19139
|
},
|
|
19149
19140
|
] }), paying && !selectedPaymentPluginIsManualPayment ? (jsx(Fragment, { children: defaultPaymentMethod && selectedPaymentMethodPlugin ? (jsx("div", __assign({ className: "bunny-px-4" }, { children: jsx(CheckoutFooter, { quote: quote, invoice: invoice, onPaymentSuccess: handlePaymentSuccess, onPaymentHoldSuccess: onPaymentHoldSuccess, plugin: selectedPaymentMethodPlugin, paymentHoldOptions: paymentHoldOptions }) }))) : null })) : null] }) })) })) })));
|
|
19150
19141
|
};
|
|
@@ -19211,7 +19202,7 @@ function ActualInvoice() {
|
|
|
19211
19202
|
}, [formattedInvoice]);
|
|
19212
19203
|
if (!formattedInvoice)
|
|
19213
19204
|
return jsx(Fragment, {});
|
|
19214
|
-
return (jsx("div", __assign({ className: "bunny-invoice-container" }, { children: jsxs("div", __assign({ className: "bunny-flex bunny-gap-6 bunny-overflow-hidden ".concat(isMobile ? 'bunny-flex-col bunny-w-full' : '', " ").concat(className) }, { children: [formattedInvoice.isLegacy ? (jsx("div", __assign({ 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 && (jsx("div", __assign({ className: "bunny-w-full ".concat(hideDownloadButton || formattedInvoice.isLegacy ? '' : 'pt-12') }, { children: jsx(PaymentForm, {
|
|
19205
|
+
return (jsx("div", __assign({ className: "bunny-invoice-container" }, { children: jsxs("div", __assign({ className: "bunny-flex bunny-gap-6 bunny-overflow-hidden ".concat(isMobile ? 'bunny-flex-col bunny-w-full' : '', " ").concat(className) }, { children: [formattedInvoice.isLegacy ? (jsx("div", __assign({ 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 && (jsx("div", __assign({ className: "bunny-w-full ".concat(hideDownloadButton || formattedInvoice.isLegacy ? '' : 'pt-12') }, { children: jsx(PaymentForm, { onPaymentSuccess: onSuccess, onFail: onFail, invoice: formattedInvoice }) })))] })) })));
|
|
19215
19206
|
}
|
|
19216
19207
|
|
|
19217
19208
|
var MUTATION$7 = function (id) { return "\n query formattedQuote ($id: ID) {\n formattedQuote (id: $id) {\n quote {\n documentTemplateId\n documents { id filename size date url }\n firstInvoice {\n id\n state\n }\n payableId\n id\n payToAccept\n currentPaymentHold {\n createdAt\n expiresAt\n id\n updatedAt\n paymentMethod {\n accountId\n createdAt\n expirationDate\n failureCode\n id\n isDefault\n lastSuccess\n paymentType\n pluginId\n state\n updatedAt\n metadata {\n description\n expiration\n icon\n identifier\n issuer\n kind\n }\n }\n }\n }\n payableId\n acceptedAt\n acceptedByName\n amount\n amountDue\n amountsByPeriod {\n id\n name\n amount\n }\n billingCity\n billingCountry\n billingState\n billingStreet\n billingZip\n contactName\n currency\n customerBillingCity\n customerBillingCountry\n customerBillingState\n customerBillingStreet\n customerBillingZip\n customerName\n discount\n discountValue\n duration\n endDate\n expiresAt\n html\n formattedLines {\n amount\n amountsByPeriod {\n quantity\n id\n name\n startDate\n endDate\n amount\n amountsByTier {\n id\n tier {\n starts\n ends\n price\n }\n quantity\n amount\n }\n prorationRate\n }\n billingPeriodEnd\n billingPeriodStart\n chargeType\n discount\n frequency\n isRamp\n periods\n planName\n position\n price\n priceDecimals\n priceListChargeId\n priceListChargeName\n priceListId\n priceListName\n priceTiers {\n price\n starts\n }\n pricingModel\n productName\n prorationRate\n quantity\n showProductNameOnLineItem\n taxCode\n trialEndDate\n trialStartDate\n unitOfMeasure\n vatCode\n }\n netPaymentDays\n notes\n number\n poNumberRequired\n salesContactEmail\n sharedAt\n startDate\n state\n subtotal\n taxAmount\n taxNumberLabel\n taxNumberRequired\n vendorName\n }\n }"; };
|
|
@@ -19680,7 +19671,7 @@ function ActualQuote() {
|
|
|
19680
19671
|
if ((firstInvoice === null || firstInvoice === void 0 ? void 0 : firstInvoice.state) === 'PAID' && paymentHoldCompleted) {
|
|
19681
19672
|
return jsx(Invoice, { id: firstInvoice.id });
|
|
19682
19673
|
}
|
|
19683
|
-
return (jsxs(Fragment, { children: [jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-gap-4 ".concat(isMobile ? 'bunny-w-full bunny-overflow-hidden' : '', " ").concat(className) }, { children: [jsx(QuoteButtons, { isAccepted: isAccepted, formattedQuote: formattedQuote, isMobile: isMobile, hideDownloadButton: hideDownloadButton, id: id, isAccepting: isAccepting, handleClickAccept: handleClickAccept, setPaymentHoldModalVisible: setPaymentHoldModalVisible, shouldDoPaymentHold: shouldDoPaymentHold, paymentHoldCompleted: paymentHoldCompleted, paymentHold: paymentHold }), jsx(InvoiceQuoteView, __assign({ html: formattedQuote.html, targetUrl: ((_b = formattedQuote === null || formattedQuote === void 0 ? void 0 : formattedQuote.quote) === null || _b === void 0 ? void 0 : _b.documentTemplateId)
|
|
19674
|
+
return (jsxs(Fragment, { children: [jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-gap-4 bunny-grow ".concat(isMobile ? 'bunny-w-full bunny-overflow-hidden' : '', " ").concat(className) }, { children: [jsx(QuoteButtons, { isAccepted: isAccepted, formattedQuote: formattedQuote, isMobile: isMobile, hideDownloadButton: hideDownloadButton, id: id, isAccepting: isAccepting, handleClickAccept: handleClickAccept, setPaymentHoldModalVisible: setPaymentHoldModalVisible, shouldDoPaymentHold: shouldDoPaymentHold, paymentHoldCompleted: paymentHoldCompleted, paymentHold: paymentHold }), jsx(InvoiceQuoteView, __assign({ html: formattedQuote.html, targetUrl: ((_b = formattedQuote === null || formattedQuote === void 0 ? void 0 : formattedQuote.quote) === null || _b === void 0 ? void 0 : _b.documentTemplateId)
|
|
19684
19675
|
? "".concat(apiHost, "/api/pdf/quote/").concat(formattedQuote.quote.id)
|
|
19685
19676
|
: undefined }, { children: ((_d = (_c = formattedQuote.quote) === null || _c === void 0 ? void 0 : _c.documents) === null || _d === void 0 ? void 0 : _d.length) > 0 ? (jsx("div", __assign({ className: "bunny-flex bunny-flex-col bunny-items-end" }, { children: formattedQuote.quote.documents.map(function (doc, index) {
|
|
19686
19677
|
return (jsx(Button, __assign({ download: doc.filename, href: doc.url, type: "link" }, { children: doc.filename }), index));
|
|
@@ -20307,7 +20298,7 @@ var Footer = function (_a) {
|
|
|
20307
20298
|
var className = _a.className;
|
|
20308
20299
|
var _b = useCurrentUserData(), privacyUrl = _b.privacyUrl, termsUrl = _b.termsUrl;
|
|
20309
20300
|
var isMobile = useIsMobile();
|
|
20310
|
-
return (jsxs("div", __assign({ className: "bunny-flex bunny-items-center bunny-justify-between bunny-shrink-0 ".concat(isMobile ? 'bunny-flex-col bunny-gap-2
|
|
20301
|
+
return (jsxs("div", __assign({ className: "bunny-flex bunny-items-center bunny-justify-between bunny-shrink-0 ".concat(isMobile ? 'bunny-flex-col bunny-gap-2' : '', " ").concat(className) }, { children: [(termsUrl || privacyUrl) && (jsxs("div", __assign({ className: "bunny-flex bunny-items-center bunny-gap-3" }, { children: [termsUrl && (jsx(StyedLink, __assign({ className: "bunny-text-xs bunny-text-slate-400", href: termsUrl, rel: "noopener noreferrer", target: "_blank", type: "text" }, { children: "Terms" }))), privacyUrl && (jsx(StyedLink, __assign({ className: "bunny-text-xs bunny-text-slate-400", href: privacyUrl, rel: "noopener noreferrer", target: "_blank", type: "text" }, { children: "Privacy" })))] }))), jsx(BunnyMarketingLink, {})] })));
|
|
20311
20302
|
};
|
|
20312
20303
|
var BunnyMarketingLink = function () {
|
|
20313
20304
|
var _a = useState(false), isHovered = _a[0], setIsHovered = _a[1];
|
|
@@ -20876,9 +20867,9 @@ var Checkout = function (_a) {
|
|
|
20876
20867
|
return null;
|
|
20877
20868
|
return (jsx("div", __assign({ className: "bunny-flex bunny-flex-col bunny-fixed bunny-top-0 bunny-left-0 bunny-right-0 bunny-bottom-0 bunny-bg-slate-50 bunny-overflow-auto", style: {
|
|
20878
20869
|
zIndex: 1001,
|
|
20879
|
-
} }, { children: jsxs("div", __assign({ className: pageWrapperClassName(isMobile) }, { children: [jsx("div", __assign({ className: "bunny-flex bunny-justify-end bunny-w-full" }, { children: jsx(CloseOutlined, { className: "bunny-text-base bunny-shadow-padding-xb", onClick: onCancel }) })), jsxs("div", __assign({ className: "bunny-flex bunny-justify-end bunny-pt-4 bunny-gap-4 ".concat(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 : quote ? quote.formattedQuote.html : '' })), !isMobile && ((invoice === null || invoice === void 0 ? void 0 : invoice.html) || ((_c = quote === null || quote === void 0 ? void 0 : quote.formattedQuote) === null || _c === void 0 ? void 0 : _c.html)) && (jsx(Divider, { className: "bunny-h-full", type: "vertical" })), invoice ? (jsx("div", __assign({ className: "bunny-w-full bunny-pt-12" }, { children: jsx(PaymentForm, {
|
|
20870
|
+
} }, { children: jsxs("div", __assign({ className: pageWrapperClassName(isMobile) }, { children: [jsx("div", __assign({ className: "bunny-flex bunny-justify-end bunny-w-full" }, { children: jsx(CloseOutlined, { className: "bunny-text-base bunny-shadow-padding-xb", onClick: onCancel }) })), jsxs("div", __assign({ className: "bunny-flex bunny-justify-end bunny-pt-4 bunny-gap-4 ".concat(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 : quote ? quote.formattedQuote.html : '' })), !isMobile && ((invoice === null || invoice === void 0 ? void 0 : invoice.html) || ((_c = quote === null || quote === void 0 ? void 0 : quote.formattedQuote) === null || _c === void 0 ? void 0 : _c.html)) && (jsx(Divider, { className: "bunny-h-full", type: "vertical" })), invoice ? (jsx("div", __assign({ className: "bunny-w-full bunny-pt-12" }, { children: jsx(PaymentForm, { onPaymentSuccess: onSuccess, onFail: onFail, invoice: invoice }) }))) : quote ? (jsx(QuoteCheckout, { account: account, onFail: function (error) {
|
|
20880
20871
|
onFail(error);
|
|
20881
|
-
}, onSuccess: onSuccess, quote: quote, taxationRequiredAccountFields: taxationRequiredAccountFields, token: token })) : (jsx(PaymentForm, {
|
|
20872
|
+
}, onSuccess: onSuccess, quote: quote, taxationRequiredAccountFields: taxationRequiredAccountFields, token: token })) : (jsx(PaymentForm, { onFail: function (error) {
|
|
20882
20873
|
onFail(error);
|
|
20883
20874
|
}, onPaymentSuccess: onSuccess }))] })), jsx(Footer, {})] })) })));
|
|
20884
20875
|
};
|
|
@@ -23265,8 +23256,8 @@ var PaymentFormSection = function (_a) {
|
|
|
23265
23256
|
var onTokenExpired = useContext(BunnyContext).onTokenExpired;
|
|
23266
23257
|
var handleAllErrorFormats = useAllErrorFormats(onTokenExpired);
|
|
23267
23258
|
var showSuccessNotification = useSuccessNotification();
|
|
23268
|
-
|
|
23269
|
-
return (jsx("div", __assign({ className: "".concat(isMobile || hideBillingDetailsForm ? 'bunny-w-full' : 'bunny-w-1/2 bunny-pt-4', " bunny-flex bunny-justify-center") }, { children: jsx(PaymentForm, {
|
|
23259
|
+
useCurrentUserData().account;
|
|
23260
|
+
return (jsx("div", __assign({ className: "".concat(isMobile || hideBillingDetailsForm ? 'bunny-w-full' : 'bunny-w-1/2 bunny-pt-4', " bunny-flex bunny-justify-center") }, { children: jsx(PaymentForm, { onFail: function (error) {
|
|
23270
23261
|
handleAllErrorFormats(error);
|
|
23271
23262
|
}, onSavePaymentMethod: function () {
|
|
23272
23263
|
showSuccessNotification('Your payment method has been saved');
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { FormattedInvoice, PluginData, Quote } from '@bunnyapp/common';
|
|
2
|
-
export declare const PaymentForm: ({
|
|
3
|
-
country?: string | undefined;
|
|
2
|
+
export declare const PaymentForm: ({ invoice, onFail, onPaymentSuccess, onPaymentHoldSuccess, quote, accountId, onSavePaymentMethod, onRemovePaymentMethod, onSetDefaultPaymentMethod, overrideToken, customCheckoutFunction, currencyId: currencyIdFromProps, paymentHoldOptions, }: {
|
|
4
3
|
invoice?: FormattedInvoice | undefined;
|
|
5
4
|
quote?: Quote | undefined;
|
|
6
5
|
onFail: (error: any) => void;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { PluginData } from '@bunnyapp/common';
|
|
2
|
-
declare const PaymentMethodDetails: ({
|
|
3
|
-
country?: string | undefined;
|
|
2
|
+
declare const PaymentMethodDetails: ({ onFail, plugin, onSavePaymentMethod, }: {
|
|
4
3
|
onFail: (error: any) => void;
|
|
5
4
|
plugin: PluginData;
|
|
6
5
|
onSavePaymentMethod: () => void;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { PluginData } from '@bunnyapp/common';
|
|
2
|
-
declare const PaymentMethodForm: ({
|
|
3
|
-
country?: string | undefined;
|
|
2
|
+
declare const PaymentMethodForm: ({ plugin, onFail, onSavePaymentMethod, }: {
|
|
4
3
|
plugin: PluginData;
|
|
5
4
|
onFail: (error: any) => void;
|
|
6
5
|
onSavePaymentMethod: (response: any) => void;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { PluginData } from '@bunnyapp/common';
|
|
2
|
-
declare const StripeForm: ({
|
|
3
|
-
country?: string | undefined;
|
|
2
|
+
declare const StripeForm: ({ plugin, onFail, onSavePaymentMethod, }: {
|
|
4
3
|
plugin: PluginData;
|
|
5
4
|
onFail: (error: any) => void;
|
|
6
5
|
onSavePaymentMethod: (response: any) => void;
|
package/dist/index.d.ts
CHANGED
|
@@ -71,8 +71,7 @@ declare function Quotes({ className, columns, filter, filterQuotes, sort, noQuot
|
|
|
71
71
|
noQuotesMessage?: string;
|
|
72
72
|
}): react_jsx_runtime.JSX.Element;
|
|
73
73
|
|
|
74
|
-
declare const PaymentForm: ({
|
|
75
|
-
country?: string | undefined;
|
|
74
|
+
declare const PaymentForm: ({ invoice, onFail, onPaymentSuccess, onPaymentHoldSuccess, quote, accountId, onSavePaymentMethod, onRemovePaymentMethod, onSetDefaultPaymentMethod, overrideToken, customCheckoutFunction, currencyId: currencyIdFromProps, paymentHoldOptions, }: {
|
|
76
75
|
invoice?: FormattedInvoice | undefined;
|
|
77
76
|
quote?: Quote$1 | undefined;
|
|
78
77
|
onFail: (error: any) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bunnyapp/components",
|
|
3
|
-
"version": "1.0.66-beta.
|
|
3
|
+
"version": "1.0.66-beta.3",
|
|
4
4
|
"description": "Components from the Bunny portal to embed Bunny UI functionality into your application.",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -93,6 +93,7 @@
|
|
|
93
93
|
]
|
|
94
94
|
},
|
|
95
95
|
"dependencies": {
|
|
96
|
+
"@pdf-viewer/react": "^1.7.1",
|
|
96
97
|
"html-react-parser": "^5.2.5",
|
|
97
98
|
"msw-storybook-addon": "^2.0.4"
|
|
98
99
|
}
|