@bunnyapp/components 1.0.66 → 1.0.68-beta.1
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
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.
|
|
177
|
+
var PACKAGE_VERSION = '1.0.68-beta.1';
|
|
177
178
|
var createRequestHeaders = function (token) {
|
|
178
179
|
var headers = common.createClientDevHeaders(token);
|
|
179
180
|
// Add the components version header
|
|
@@ -407,6 +408,20 @@ function useToken() {
|
|
|
407
408
|
return overrideToken || tokenFromContext;
|
|
408
409
|
}
|
|
409
410
|
|
|
411
|
+
var LISENSE_KEY = 'eyJkYXRhIjoiZXlKMElqb2liM0puWVc1cGVtRjBhVzl1SWl3aVlYWjFJam94TnpneU5ETXhPVGs1TENKa2JTSTZJbUoxYm01NUxtTnZiU0lzSW00aU9pSmhOV1F5TWpKaFpXTTNOelF5TkdFNUlpd2laWGh3SWpveE56WTJORFEzT1RrNUxDSmtiWFFpT2lKM2FXeGtZMkZ5WkNKOSIsInNpZ25hdHVyZSI6ImdJWW5BYWp0WW1aSHV1b1RrTkZCZnRGYjEzUTJOZXZwQXlKRmszdy9STDNUa08rRXZYWlV0MDZxenBrZWdOK1A4TXlkbFY1aityemQvM1VpYlB5SW1VSzAweHZSVk5hS29EOXB0cVpkbjR5SWRRdE1pU1NjZ0J1K1RkM0NXM2FONVNrdlNJVDEyTGpBMnVVYll2RmJ6RFpMci9hODkwa05sT0NQZURoVjMyd0w3R0NrTnV2Z1MyZlk5Mis0L25FdUdvZXBZR0RPN0Ryb3NaOGVlbnJ6b1BsQ044T204eFlMNXJxdUkvS2xLVTVYaGN0allrdzBTR0FlL0pDR1dTN1dLTDAvYmFvbS9GS1ltNU91VmlzcmlDVlc2UXgvbzBnTGE4bUtXLytMb3pNaHdFemdtU2I2S0xERzZpTEVPL0czQ2pYN2p2dTU1NEc4OUx2aW1BaE5BQT09In0=';
|
|
412
|
+
// Custom zoom layout component that uses useZoomContext
|
|
413
|
+
var CustomZoomLayout = function () {
|
|
414
|
+
// Consume from the controller provider
|
|
415
|
+
var _a = react$1.useZoomContext(), currentZoom = _a.currentZoom, setZoomLevel = _a.setZoomLevel;
|
|
416
|
+
var mountTimeRef = react.useRef(Date.now());
|
|
417
|
+
// Set default zoom to 100% once the document is loaded
|
|
418
|
+
react.useEffect(function () {
|
|
419
|
+
if (currentZoom < 1 && Date.now() - mountTimeRef.current < 3000) {
|
|
420
|
+
setZoomLevel(100);
|
|
421
|
+
}
|
|
422
|
+
}, [currentZoom, setZoomLevel]);
|
|
423
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
424
|
+
};
|
|
410
425
|
var DocumentTemplatePreview = function (_a) {
|
|
411
426
|
var targetUrl = _a.targetUrl;
|
|
412
427
|
var _b = react.useState(null), pdfUrl = _b[0], setPdfUrl = _b[1];
|
|
@@ -454,7 +469,13 @@ var DocumentTemplatePreview = function (_a) {
|
|
|
454
469
|
if (!pdfUrl) {
|
|
455
470
|
return jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
456
471
|
}
|
|
457
|
-
return (jsxRuntime.jsx("div", __assign({ className: "
|
|
472
|
+
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, __assign({ licenseKey: LISENSE_KEY }, { children: jsxRuntime.jsxs(react$1.RPProvider, __assign({ src: pdfUrl }, { children: [jsxRuntime.jsx(CustomZoomLayout, {}), jsxRuntime.jsx(react$1.RPDefaultLayout, __assign({ style: {
|
|
473
|
+
width: '100%',
|
|
474
|
+
height: '100%',
|
|
475
|
+
}, slots: {
|
|
476
|
+
openFileTool: false,
|
|
477
|
+
downloadTool: false,
|
|
478
|
+
} }, { children: jsxRuntime.jsx(react$1.RPPages, {}) }))] })) })) })));
|
|
458
479
|
};
|
|
459
480
|
|
|
460
481
|
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 +492,7 @@ var InvoiceQuoteView = function (_a) {
|
|
|
471
492
|
color: secondaryColor,
|
|
472
493
|
}, type: "link" }, { children: backButtonName || 'Back' }))) : null }), !hideDownloadButton ? (jsxRuntime.jsx(antd.Button, __assign({ icon: jsxRuntime.jsx(icons.DownloadOutlined, {}), onClick: function () {
|
|
473
494
|
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: {
|
|
495
|
+
} }, { 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
496
|
minWidth: '750px',
|
|
476
497
|
} }, { children: [targetUrl ? (jsxRuntime.jsx(DocumentTemplatePreview, { targetUrl: targetUrl })) : (jsxRuntime.jsx(interweave.Markup, { content: html })), children] })))] })));
|
|
477
498
|
};
|
|
@@ -18917,7 +18938,9 @@ var PaymentMethodForm = function (_a) {
|
|
|
18917
18938
|
}
|
|
18918
18939
|
});
|
|
18919
18940
|
}); };
|
|
18920
|
-
return (jsxRuntime.jsxs("form", { children: [jsxRuntime.jsx(reactStripeJs.PaymentElement, { options: {
|
|
18941
|
+
return (jsxRuntime.jsxs("form", { children: [jsxRuntime.jsx(reactStripeJs.PaymentElement, { options: {
|
|
18942
|
+
layout: { type: 'accordion' },
|
|
18943
|
+
} }), jsxRuntime.jsx(SavePaymentMethodFooter, { isSaving: isSaving, onSave: onSubmit })] }));
|
|
18921
18944
|
};
|
|
18922
18945
|
|
|
18923
18946
|
// This is just a wrapper to fetch the stripe object and pass it to the form
|
|
@@ -19565,15 +19588,25 @@ var AcceptQuoteModal = function (_a) {
|
|
|
19565
19588
|
}, open: acceptBoxVisible, title: "Accept quote", width: 400 }, { children: jsxRuntime.jsxs(antd.Form, __assign({ className: "bunny-flex bunny-flex-col bunny-gap-2", form: form, layout: "vertical" }, { children: [jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Your name", name: "name", rules: createRules(true, "Your name") }, { children: jsxRuntime.jsx(antd.Input, { autoFocus: true, ref: firstInputRef }) })), jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Your job title", name: "title", rules: createRules(true, "Your job title") }, { children: jsxRuntime.jsx(antd.Input, {}) })), jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Purchase order number", name: "poNumber", rules: createRules(poNumberRequired, "Purchase order number") }, { children: jsxRuntime.jsx(antd.Input, {}) })), taxNumberRequired && (jsxRuntime.jsx(antd.Form.Item, __assign({ name: "taxNumber", label: taxNumberLabel, rules: createRules(taxNumberRequired, taxNumberLabel) }, { children: jsxRuntime.jsx(antd.Input, {}) })))] })) })));
|
|
19566
19589
|
};
|
|
19567
19590
|
|
|
19591
|
+
var useCurrentUserData = function () {
|
|
19592
|
+
var queryClient = reactQuery.useQueryClient();
|
|
19593
|
+
var token = useToken();
|
|
19594
|
+
var currentUser = queryClient.getQueryData(common.QueryKeyFactory.default.currentUserKey(token));
|
|
19595
|
+
if (!currentUser)
|
|
19596
|
+
return {};
|
|
19597
|
+
return currentUser;
|
|
19598
|
+
};
|
|
19599
|
+
|
|
19568
19600
|
var Title$2 = antd.Typography.Title;
|
|
19569
19601
|
var showSuccessNotification$1 = common.useSuccessNotification();
|
|
19570
19602
|
var PaymentHoldModal = function (_a) {
|
|
19571
19603
|
var visible = _a.visible, setVisible = _a.setVisible, quote = _a.quote;
|
|
19572
19604
|
var queryClient = reactQuery.useQueryClient();
|
|
19573
19605
|
var token = useToken();
|
|
19606
|
+
var account = useCurrentUserData().account;
|
|
19574
19607
|
return (jsxRuntime.jsxs(StyledModal$1, __assign({ centered: true, onCancel: function () {
|
|
19575
19608
|
setVisible(false);
|
|
19576
|
-
}, footer: null, open: visible, width: 600 }, { children: [jsxRuntime.jsx(Title$2, __assign({ className: "mt-4 pb-4 mx-4", level: 5 }, { children: "Pay to accept" })), jsxRuntime.jsx("div", __assign({ className: "mb-4" }, { children: jsxRuntime.jsx(PaymentForm, { quote: {
|
|
19609
|
+
}, footer: null, open: visible, width: 600 }, { children: [jsxRuntime.jsx(Title$2, __assign({ className: "mt-4 pb-4 mx-4", level: 5 }, { children: "Pay to accept" })), jsxRuntime.jsx("div", __assign({ className: "mb-4" }, { children: jsxRuntime.jsx(PaymentForm, { country: account === null || account === void 0 ? void 0 : account.billingCountry, quote: {
|
|
19577
19610
|
amount: quote.amount,
|
|
19578
19611
|
currencyId: quote.currency,
|
|
19579
19612
|
id: quote.quote.id,
|
|
@@ -19688,7 +19721,7 @@ function ActualQuote() {
|
|
|
19688
19721
|
if ((firstInvoice === null || firstInvoice === void 0 ? void 0 : firstInvoice.state) === 'PAID' && paymentHoldCompleted) {
|
|
19689
19722
|
return jsxRuntime.jsx(Invoice, { id: firstInvoice.id });
|
|
19690
19723
|
}
|
|
19691
|
-
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)
|
|
19724
|
+
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)
|
|
19692
19725
|
? "".concat(apiHost, "/api/pdf/quote/").concat(formattedQuote.quote.id)
|
|
19693
19726
|
: 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) {
|
|
19694
19727
|
return (jsxRuntime.jsx(antd.Button, __assign({ download: doc.filename, href: doc.url, type: "link" }, { children: doc.filename }), index));
|
|
@@ -20305,15 +20338,6 @@ var getQuote = function (_a) {
|
|
|
20305
20338
|
});
|
|
20306
20339
|
};
|
|
20307
20340
|
|
|
20308
|
-
var useCurrentUserData = function () {
|
|
20309
|
-
var queryClient = reactQuery.useQueryClient();
|
|
20310
|
-
var token = useToken();
|
|
20311
|
-
var currentUser = queryClient.getQueryData(common.QueryKeyFactory.default.currentUserKey(token));
|
|
20312
|
-
if (!currentUser)
|
|
20313
|
-
return {};
|
|
20314
|
-
return currentUser;
|
|
20315
|
-
};
|
|
20316
|
-
|
|
20317
20341
|
var BunnyFooterIcon = function (_a) {
|
|
20318
20342
|
var color = _a.color;
|
|
20319
20343
|
return (jsxRuntime.jsxs("svg", __assign({ width: "45", height: "15", viewBox: "0 0 39 13", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: [jsxRuntime.jsxs("g", __assign({ clipPath: "url(#clip0_6_851)" }, { children: [jsxRuntime.jsx("path", { className: "bunny-icon-path", d: "M14.5898 7.19708C14.5898 9.35053 13.0926 10.325 11.2495 10.325C9.39955 10.325 7.90234 9.35001 7.90234 7.18967V3.26221H10.1125V7.00052C10.1125 7.87719 10.5855 8.27725 11.2495 8.27725C11.9061 8.27725 12.3865 7.87719 12.3865 7.00052V3.26221H14.5898V7.19708Z", fill: color }), jsxRuntime.jsx("path", { className: "bunny-icon-path", d: "M31.8943 12.9625H29.4793L31.8523 8.62816L28.9355 3.26221H31.4708L33.0457 6.35524L34.5924 3.26221H37.0075L31.8943 12.9625Z", fill: color }), jsxRuntime.jsx("path", { className: "bunny-icon-path", d: "M15.1602 5.96827C15.1602 3.8148 16.6574 2.84033 18.5005 2.84033C20.3504 2.84033 21.8476 3.81533 21.8476 5.97568V10.1473H19.6374V6.16483C19.6374 5.28815 19.1645 4.8881 18.5005 4.8881C17.8439 4.8881 17.3634 5.28815 17.3634 6.16483V10.1473H15.1602V5.96827Z", fill: color }), jsxRuntime.jsx("path", { className: "bunny-icon-path", d: "M22.4316 5.96827C22.4316 3.8148 23.9289 2.84033 25.7719 2.84033C27.6219 2.84033 29.1191 3.81533 29.1191 5.97568V10.1473H26.9089V6.16483C26.9089 5.28815 26.4359 4.8881 25.7719 4.8881C25.1154 4.8881 24.6349 5.28815 24.6349 6.16483V10.1473H22.4316V5.96827Z", fill: color }), jsxRuntime.jsx("path", { className: "bunny-icon-path", d: "M7.40511 6.68957C7.40511 8.7236 6.02815 10.3227 4.17816 10.3227C3.23907 10.3227 2.61071 9.94378 2.19358 9.40371V10.1404H0.0605469V0.0405273H2.26381V3.91939C2.68041 3.42158 3.28802 3.07069 4.17763 3.07069C6.02759 3.07069 7.40511 4.66981 7.40511 6.68957ZM2.17229 6.69642C2.17229 7.60802 2.77937 8.2744 3.64823 8.2744C4.53783 8.2744 5.13107 7.59372 5.13107 6.69642C5.13107 5.79912 4.53783 5.11844 3.64823 5.11844C2.77937 5.11844 2.17229 5.78482 2.17229 6.69642Z", fill: color }), jsxRuntime.jsx("path", { className: "bunny-icon-path", d: "M38.966 8.94801C38.966 9.76181 38.2668 10.4631 37.4618 10.4631C36.6499 10.4631 35.9434 9.76181 35.9434 8.94801C35.9434 8.14846 36.6494 7.46094 37.4618 7.46094C38.2668 7.46094 38.966 8.14846 38.966 8.94801Z", fill: color })] })), jsxRuntime.jsx("defs", { children: jsxRuntime.jsx("clipPath", __assign({ id: "clip0_6_851" }, { children: jsxRuntime.jsx("rect", { width: "39", height: "13", fill: "white" }) })) })] })));
|
|
@@ -20324,7 +20348,7 @@ var Footer = function (_a) {
|
|
|
20324
20348
|
var className = _a.className;
|
|
20325
20349
|
var _b = useCurrentUserData(), privacyUrl = _b.privacyUrl, termsUrl = _b.termsUrl;
|
|
20326
20350
|
var isMobile = common.useIsMobile();
|
|
20327
|
-
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
|
|
20351
|
+
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, {})] })));
|
|
20328
20352
|
};
|
|
20329
20353
|
var BunnyMarketingLink = function () {
|
|
20330
20354
|
var _a = react.useState(false), isHovered = _a[0], setIsHovered = _a[1];
|
|
@@ -20338,7 +20362,8 @@ var templateObject_1$6, templateObject_2$1;
|
|
|
20338
20362
|
var Title$1 = antd.Typography.Title;
|
|
20339
20363
|
function PaymentForms(_a) {
|
|
20340
20364
|
var quote = _a.quote, handlePaymentSuccess = _a.handlePaymentSuccess, handlePaymentFail = _a.handlePaymentFail, handleSubmit = _a.handleSubmit, proceedingToPayment = _a.proceedingToPayment, accountId = _a.accountId, overrideToken = _a.overrideToken, customCheckoutFunction = _a.customCheckoutFunction;
|
|
20341
|
-
|
|
20365
|
+
var account = useCurrentUserData().account;
|
|
20366
|
+
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: quote ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: overrideToken ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Title$1, __assign({ className: "bunny-px-4 bunny-m-0", level: 2 }, { children: "Payment" })), jsxRuntime.jsx(PaymentForm, { country: account === null || account === void 0 ? void 0 : account.billingCountry, onFail: handlePaymentFail, onPaymentSuccess: handlePaymentSuccess, accountId: accountId, quote: quote, overrideToken: overrideToken, customCheckoutFunction: customCheckoutFunction })] })) : null })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Title$1, __assign({ className: "bunny-px-4 bunny-m-0", level: 2 }, { children: "Signup" })), jsxRuntime.jsx(InitialSignupForm, { className: "bunny-px-4", onSubmit: handleSubmit, submitting: proceedingToPayment })] })) }));
|
|
20342
20367
|
}
|
|
20343
20368
|
function InitialSignupForm(_a) {
|
|
20344
20369
|
var className = _a.className, onSubmit = _a.onSubmit, submitting = _a.submitting;
|
|
@@ -20803,7 +20828,7 @@ var QuoteCheckout = function (_a) {
|
|
|
20803
20828
|
}
|
|
20804
20829
|
if (taxationRequiredAccountFields)
|
|
20805
20830
|
return (jsxRuntime.jsx(PaymentFormWrapper, __assign({ setMaxHeight: false }, { children: jsxRuntime.jsx(TaxationForm, { account: account, quote: quote }) })));
|
|
20806
|
-
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: paymentRequired ? (jsxRuntime.jsx(PaymentForm, { onFail: onFail, onPaymentSuccess: onSuccess, quote: quote })) : (jsxRuntime.jsx(PaymentFormWrapper, __assign({ setMaxHeight: false }, { children: jsxRuntime.jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-gap-2 ".concat(isMobile ? 'bunny-shadow-padding-x' : '') }, { children: [jsxRuntime.jsx(antd.Button, __assign({ onClick: handleCheckoutNoPayment, type: "primary" }, { children: isSaving ? 'Processing...' : 'Complete order' })), jsxRuntime.jsx("div", __assign({ className: "bunny-text-xs bunny-text-slate-500" }, { children: "No payment is required" }))] })) }))) }));
|
|
20831
|
+
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: paymentRequired ? (jsxRuntime.jsx(PaymentForm, { country: account === null || account === void 0 ? void 0 : account.billingCountry, onFail: onFail, onPaymentSuccess: onSuccess, quote: quote })) : (jsxRuntime.jsx(PaymentFormWrapper, __assign({ setMaxHeight: false }, { children: jsxRuntime.jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-gap-2 ".concat(isMobile ? 'bunny-shadow-padding-x' : '') }, { children: [jsxRuntime.jsx(antd.Button, __assign({ onClick: handleCheckoutNoPayment, type: "primary" }, { children: isSaving ? 'Processing...' : 'Complete order' })), jsxRuntime.jsx("div", __assign({ className: "bunny-text-xs bunny-text-slate-500" }, { children: "No payment is required" }))] })) }))) }));
|
|
20807
20832
|
};
|
|
20808
20833
|
var PaymentFormWrapper = function (_a) {
|
|
20809
20834
|
var children = _a.children, setMaxHeight = _a.setMaxHeight, className = _a.className;
|
|
@@ -23281,6 +23306,7 @@ var PaymentFormSection = function (_a) {
|
|
|
23281
23306
|
var onTokenExpired = react.useContext(BunnyContext).onTokenExpired;
|
|
23282
23307
|
var handleAllErrorFormats = common.useAllErrorFormats(onTokenExpired);
|
|
23283
23308
|
var showSuccessNotification = common.useSuccessNotification();
|
|
23309
|
+
useCurrentUserData().account;
|
|
23284
23310
|
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) {
|
|
23285
23311
|
handleAllErrorFormats(error);
|
|
23286
23312
|
}, onSavePaymentMethod: function () {
|
package/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import { createContext, useEffect, useContext, useMemo, useState,
|
|
2
|
+
import { createContext, useEffect, useContext, useMemo, useState, useRef, useCallback } from 'react';
|
|
3
3
|
import { Markup } from 'interweave';
|
|
4
4
|
import { ConfigProvider, Spin, Button, Tag, Typography, Dropdown, Input, Checkbox, Skeleton, Collapse, Modal, Form, Tooltip, Drawer, Card as Card$1, Image, Divider, Select, Radio, Space, Popconfirm, Table } from 'antd';
|
|
5
5
|
import { DownloadOutlined, CreditCardOutlined, EllipsisOutlined, BankOutlined, SearchOutlined, CheckCircleFilled, CloseOutlined, ArrowLeftOutlined } from '@ant-design/icons';
|
|
@@ -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, useZoomContext } 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.
|
|
147
|
+
var PACKAGE_VERSION = '1.0.68-beta.1';
|
|
147
148
|
var createRequestHeaders = function (token) {
|
|
148
149
|
var headers = createClientDevHeaders(token);
|
|
149
150
|
// Add the components version header
|
|
@@ -377,6 +378,20 @@ function useToken() {
|
|
|
377
378
|
return overrideToken || tokenFromContext;
|
|
378
379
|
}
|
|
379
380
|
|
|
381
|
+
var LISENSE_KEY = 'eyJkYXRhIjoiZXlKMElqb2liM0puWVc1cGVtRjBhVzl1SWl3aVlYWjFJam94TnpneU5ETXhPVGs1TENKa2JTSTZJbUoxYm01NUxtTnZiU0lzSW00aU9pSmhOV1F5TWpKaFpXTTNOelF5TkdFNUlpd2laWGh3SWpveE56WTJORFEzT1RrNUxDSmtiWFFpT2lKM2FXeGtZMkZ5WkNKOSIsInNpZ25hdHVyZSI6ImdJWW5BYWp0WW1aSHV1b1RrTkZCZnRGYjEzUTJOZXZwQXlKRmszdy9STDNUa08rRXZYWlV0MDZxenBrZWdOK1A4TXlkbFY1aityemQvM1VpYlB5SW1VSzAweHZSVk5hS29EOXB0cVpkbjR5SWRRdE1pU1NjZ0J1K1RkM0NXM2FONVNrdlNJVDEyTGpBMnVVYll2RmJ6RFpMci9hODkwa05sT0NQZURoVjMyd0w3R0NrTnV2Z1MyZlk5Mis0L25FdUdvZXBZR0RPN0Ryb3NaOGVlbnJ6b1BsQ044T204eFlMNXJxdUkvS2xLVTVYaGN0allrdzBTR0FlL0pDR1dTN1dLTDAvYmFvbS9GS1ltNU91VmlzcmlDVlc2UXgvbzBnTGE4bUtXLytMb3pNaHdFemdtU2I2S0xERzZpTEVPL0czQ2pYN2p2dTU1NEc4OUx2aW1BaE5BQT09In0=';
|
|
382
|
+
// Custom zoom layout component that uses useZoomContext
|
|
383
|
+
var CustomZoomLayout = function () {
|
|
384
|
+
// Consume from the controller provider
|
|
385
|
+
var _a = useZoomContext(), currentZoom = _a.currentZoom, setZoomLevel = _a.setZoomLevel;
|
|
386
|
+
var mountTimeRef = useRef(Date.now());
|
|
387
|
+
// Set default zoom to 100% once the document is loaded
|
|
388
|
+
useEffect(function () {
|
|
389
|
+
if (currentZoom < 1 && Date.now() - mountTimeRef.current < 3000) {
|
|
390
|
+
setZoomLevel(100);
|
|
391
|
+
}
|
|
392
|
+
}, [currentZoom, setZoomLevel]);
|
|
393
|
+
return jsx(Fragment, {});
|
|
394
|
+
};
|
|
380
395
|
var DocumentTemplatePreview = function (_a) {
|
|
381
396
|
var targetUrl = _a.targetUrl;
|
|
382
397
|
var _b = useState(null), pdfUrl = _b[0], setPdfUrl = _b[1];
|
|
@@ -424,7 +439,13 @@ var DocumentTemplatePreview = function (_a) {
|
|
|
424
439
|
if (!pdfUrl) {
|
|
425
440
|
return jsx(Fragment, {});
|
|
426
441
|
}
|
|
427
|
-
return (jsx("div", __assign({ className: "
|
|
442
|
+
return (jsx("div", __assign({ className: "bunny-rounded bunny-w-full bunny-overflow-hidden bunny-grow bunny-min-h-0" }, { children: jsx(RPConfig, __assign({ licenseKey: LISENSE_KEY }, { children: jsxs(RPProvider, __assign({ src: pdfUrl }, { children: [jsx(CustomZoomLayout, {}), jsx(RPDefaultLayout, __assign({ style: {
|
|
443
|
+
width: '100%',
|
|
444
|
+
height: '100%',
|
|
445
|
+
}, slots: {
|
|
446
|
+
openFileTool: false,
|
|
447
|
+
downloadTool: false,
|
|
448
|
+
} }, { children: jsx(RPPages, {}) }))] })) })) })));
|
|
428
449
|
};
|
|
429
450
|
|
|
430
451
|
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 +462,7 @@ var InvoiceQuoteView = function (_a) {
|
|
|
441
462
|
color: secondaryColor,
|
|
442
463
|
}, type: "link" }, { children: backButtonName || 'Back' }))) : null }), !hideDownloadButton ? (jsx(Button, __assign({ icon: jsx(DownloadOutlined, {}), onClick: function () {
|
|
443
464
|
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: {
|
|
465
|
+
} }, { 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
466
|
minWidth: '750px',
|
|
446
467
|
} }, { children: [targetUrl ? (jsx(DocumentTemplatePreview, { targetUrl: targetUrl })) : (jsx(Markup, { content: html })), children] })))] })));
|
|
447
468
|
};
|
|
@@ -18887,7 +18908,9 @@ var PaymentMethodForm = function (_a) {
|
|
|
18887
18908
|
}
|
|
18888
18909
|
});
|
|
18889
18910
|
}); };
|
|
18890
|
-
return (jsxs("form", { children: [jsx(PaymentElement, { options: {
|
|
18911
|
+
return (jsxs("form", { children: [jsx(PaymentElement, { options: {
|
|
18912
|
+
layout: { type: 'accordion' },
|
|
18913
|
+
} }), jsx(SavePaymentMethodFooter, { isSaving: isSaving, onSave: onSubmit })] }));
|
|
18891
18914
|
};
|
|
18892
18915
|
|
|
18893
18916
|
// This is just a wrapper to fetch the stripe object and pass it to the form
|
|
@@ -19535,15 +19558,25 @@ var AcceptQuoteModal = function (_a) {
|
|
|
19535
19558
|
}, open: acceptBoxVisible, title: "Accept quote", width: 400 }, { children: jsxs(Form, __assign({ className: "bunny-flex bunny-flex-col bunny-gap-2", form: form, layout: "vertical" }, { children: [jsx(Form.Item, __assign({ label: "Your name", name: "name", rules: createRules(true, "Your name") }, { children: jsx(Input, { autoFocus: true, ref: firstInputRef }) })), jsx(Form.Item, __assign({ label: "Your job title", name: "title", rules: createRules(true, "Your job title") }, { children: jsx(Input, {}) })), jsx(Form.Item, __assign({ label: "Purchase order number", name: "poNumber", rules: createRules(poNumberRequired, "Purchase order number") }, { children: jsx(Input, {}) })), taxNumberRequired && (jsx(Form.Item, __assign({ name: "taxNumber", label: taxNumberLabel, rules: createRules(taxNumberRequired, taxNumberLabel) }, { children: jsx(Input, {}) })))] })) })));
|
|
19536
19559
|
};
|
|
19537
19560
|
|
|
19561
|
+
var useCurrentUserData = function () {
|
|
19562
|
+
var queryClient = useQueryClient();
|
|
19563
|
+
var token = useToken();
|
|
19564
|
+
var currentUser = queryClient.getQueryData(QueryKeyFactory.default.currentUserKey(token));
|
|
19565
|
+
if (!currentUser)
|
|
19566
|
+
return {};
|
|
19567
|
+
return currentUser;
|
|
19568
|
+
};
|
|
19569
|
+
|
|
19538
19570
|
var Title$2 = Typography.Title;
|
|
19539
19571
|
var showSuccessNotification$1 = useSuccessNotification();
|
|
19540
19572
|
var PaymentHoldModal = function (_a) {
|
|
19541
19573
|
var visible = _a.visible, setVisible = _a.setVisible, quote = _a.quote;
|
|
19542
19574
|
var queryClient = useQueryClient();
|
|
19543
19575
|
var token = useToken();
|
|
19576
|
+
var account = useCurrentUserData().account;
|
|
19544
19577
|
return (jsxs(StyledModal$1, __assign({ centered: true, onCancel: function () {
|
|
19545
19578
|
setVisible(false);
|
|
19546
|
-
}, footer: null, open: visible, width: 600 }, { children: [jsx(Title$2, __assign({ className: "mt-4 pb-4 mx-4", level: 5 }, { children: "Pay to accept" })), jsx("div", __assign({ className: "mb-4" }, { children: jsx(PaymentForm, { quote: {
|
|
19579
|
+
}, footer: null, open: visible, width: 600 }, { children: [jsx(Title$2, __assign({ className: "mt-4 pb-4 mx-4", level: 5 }, { children: "Pay to accept" })), jsx("div", __assign({ className: "mb-4" }, { children: jsx(PaymentForm, { country: account === null || account === void 0 ? void 0 : account.billingCountry, quote: {
|
|
19547
19580
|
amount: quote.amount,
|
|
19548
19581
|
currencyId: quote.currency,
|
|
19549
19582
|
id: quote.quote.id,
|
|
@@ -19658,7 +19691,7 @@ function ActualQuote() {
|
|
|
19658
19691
|
if ((firstInvoice === null || firstInvoice === void 0 ? void 0 : firstInvoice.state) === 'PAID' && paymentHoldCompleted) {
|
|
19659
19692
|
return jsx(Invoice, { id: firstInvoice.id });
|
|
19660
19693
|
}
|
|
19661
|
-
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)
|
|
19694
|
+
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)
|
|
19662
19695
|
? "".concat(apiHost, "/api/pdf/quote/").concat(formattedQuote.quote.id)
|
|
19663
19696
|
: 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) {
|
|
19664
19697
|
return (jsx(Button, __assign({ download: doc.filename, href: doc.url, type: "link" }, { children: doc.filename }), index));
|
|
@@ -20275,15 +20308,6 @@ var getQuote = function (_a) {
|
|
|
20275
20308
|
});
|
|
20276
20309
|
};
|
|
20277
20310
|
|
|
20278
|
-
var useCurrentUserData = function () {
|
|
20279
|
-
var queryClient = useQueryClient();
|
|
20280
|
-
var token = useToken();
|
|
20281
|
-
var currentUser = queryClient.getQueryData(QueryKeyFactory.default.currentUserKey(token));
|
|
20282
|
-
if (!currentUser)
|
|
20283
|
-
return {};
|
|
20284
|
-
return currentUser;
|
|
20285
|
-
};
|
|
20286
|
-
|
|
20287
20311
|
var BunnyFooterIcon = function (_a) {
|
|
20288
20312
|
var color = _a.color;
|
|
20289
20313
|
return (jsxs("svg", __assign({ width: "45", height: "15", viewBox: "0 0 39 13", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: [jsxs("g", __assign({ clipPath: "url(#clip0_6_851)" }, { children: [jsx("path", { className: "bunny-icon-path", d: "M14.5898 7.19708C14.5898 9.35053 13.0926 10.325 11.2495 10.325C9.39955 10.325 7.90234 9.35001 7.90234 7.18967V3.26221H10.1125V7.00052C10.1125 7.87719 10.5855 8.27725 11.2495 8.27725C11.9061 8.27725 12.3865 7.87719 12.3865 7.00052V3.26221H14.5898V7.19708Z", fill: color }), jsx("path", { className: "bunny-icon-path", d: "M31.8943 12.9625H29.4793L31.8523 8.62816L28.9355 3.26221H31.4708L33.0457 6.35524L34.5924 3.26221H37.0075L31.8943 12.9625Z", fill: color }), jsx("path", { className: "bunny-icon-path", d: "M15.1602 5.96827C15.1602 3.8148 16.6574 2.84033 18.5005 2.84033C20.3504 2.84033 21.8476 3.81533 21.8476 5.97568V10.1473H19.6374V6.16483C19.6374 5.28815 19.1645 4.8881 18.5005 4.8881C17.8439 4.8881 17.3634 5.28815 17.3634 6.16483V10.1473H15.1602V5.96827Z", fill: color }), jsx("path", { className: "bunny-icon-path", d: "M22.4316 5.96827C22.4316 3.8148 23.9289 2.84033 25.7719 2.84033C27.6219 2.84033 29.1191 3.81533 29.1191 5.97568V10.1473H26.9089V6.16483C26.9089 5.28815 26.4359 4.8881 25.7719 4.8881C25.1154 4.8881 24.6349 5.28815 24.6349 6.16483V10.1473H22.4316V5.96827Z", fill: color }), jsx("path", { className: "bunny-icon-path", d: "M7.40511 6.68957C7.40511 8.7236 6.02815 10.3227 4.17816 10.3227C3.23907 10.3227 2.61071 9.94378 2.19358 9.40371V10.1404H0.0605469V0.0405273H2.26381V3.91939C2.68041 3.42158 3.28802 3.07069 4.17763 3.07069C6.02759 3.07069 7.40511 4.66981 7.40511 6.68957ZM2.17229 6.69642C2.17229 7.60802 2.77937 8.2744 3.64823 8.2744C4.53783 8.2744 5.13107 7.59372 5.13107 6.69642C5.13107 5.79912 4.53783 5.11844 3.64823 5.11844C2.77937 5.11844 2.17229 5.78482 2.17229 6.69642Z", fill: color }), jsx("path", { className: "bunny-icon-path", d: "M38.966 8.94801C38.966 9.76181 38.2668 10.4631 37.4618 10.4631C36.6499 10.4631 35.9434 9.76181 35.9434 8.94801C35.9434 8.14846 36.6494 7.46094 37.4618 7.46094C38.2668 7.46094 38.966 8.14846 38.966 8.94801Z", fill: color })] })), jsx("defs", { children: jsx("clipPath", __assign({ id: "clip0_6_851" }, { children: jsx("rect", { width: "39", height: "13", fill: "white" }) })) })] })));
|
|
@@ -20294,7 +20318,7 @@ var Footer = function (_a) {
|
|
|
20294
20318
|
var className = _a.className;
|
|
20295
20319
|
var _b = useCurrentUserData(), privacyUrl = _b.privacyUrl, termsUrl = _b.termsUrl;
|
|
20296
20320
|
var isMobile = useIsMobile();
|
|
20297
|
-
return (jsxs("div", __assign({ className: "bunny-flex bunny-items-center bunny-justify-between bunny-shrink-0 ".concat(isMobile ? 'bunny-flex-col bunny-gap-2
|
|
20321
|
+
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, {})] })));
|
|
20298
20322
|
};
|
|
20299
20323
|
var BunnyMarketingLink = function () {
|
|
20300
20324
|
var _a = useState(false), isHovered = _a[0], setIsHovered = _a[1];
|
|
@@ -20308,7 +20332,8 @@ var templateObject_1$6, templateObject_2$1;
|
|
|
20308
20332
|
var Title$1 = Typography.Title;
|
|
20309
20333
|
function PaymentForms(_a) {
|
|
20310
20334
|
var quote = _a.quote, handlePaymentSuccess = _a.handlePaymentSuccess, handlePaymentFail = _a.handlePaymentFail, handleSubmit = _a.handleSubmit, proceedingToPayment = _a.proceedingToPayment, accountId = _a.accountId, overrideToken = _a.overrideToken, customCheckoutFunction = _a.customCheckoutFunction;
|
|
20311
|
-
|
|
20335
|
+
var account = useCurrentUserData().account;
|
|
20336
|
+
return (jsx(Fragment, { children: quote ? (jsx(Fragment, { children: overrideToken ? (jsxs(Fragment, { children: [jsx(Title$1, __assign({ className: "bunny-px-4 bunny-m-0", level: 2 }, { children: "Payment" })), jsx(PaymentForm, { country: account === null || account === void 0 ? void 0 : account.billingCountry, onFail: handlePaymentFail, onPaymentSuccess: handlePaymentSuccess, accountId: accountId, quote: quote, overrideToken: overrideToken, customCheckoutFunction: customCheckoutFunction })] })) : null })) : (jsxs(Fragment, { children: [jsx(Title$1, __assign({ className: "bunny-px-4 bunny-m-0", level: 2 }, { children: "Signup" })), jsx(InitialSignupForm, { className: "bunny-px-4", onSubmit: handleSubmit, submitting: proceedingToPayment })] })) }));
|
|
20312
20337
|
}
|
|
20313
20338
|
function InitialSignupForm(_a) {
|
|
20314
20339
|
var className = _a.className, onSubmit = _a.onSubmit, submitting = _a.submitting;
|
|
@@ -20773,7 +20798,7 @@ var QuoteCheckout = function (_a) {
|
|
|
20773
20798
|
}
|
|
20774
20799
|
if (taxationRequiredAccountFields)
|
|
20775
20800
|
return (jsx(PaymentFormWrapper, __assign({ setMaxHeight: false }, { children: jsx(TaxationForm, { account: account, quote: quote }) })));
|
|
20776
|
-
return (jsx(Fragment, { children: paymentRequired ? (jsx(PaymentForm, { onFail: onFail, onPaymentSuccess: onSuccess, quote: quote })) : (jsx(PaymentFormWrapper, __assign({ setMaxHeight: false }, { children: jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-gap-2 ".concat(isMobile ? 'bunny-shadow-padding-x' : '') }, { children: [jsx(Button, __assign({ onClick: handleCheckoutNoPayment, type: "primary" }, { children: isSaving ? 'Processing...' : 'Complete order' })), jsx("div", __assign({ className: "bunny-text-xs bunny-text-slate-500" }, { children: "No payment is required" }))] })) }))) }));
|
|
20801
|
+
return (jsx(Fragment, { children: paymentRequired ? (jsx(PaymentForm, { country: account === null || account === void 0 ? void 0 : account.billingCountry, onFail: onFail, onPaymentSuccess: onSuccess, quote: quote })) : (jsx(PaymentFormWrapper, __assign({ setMaxHeight: false }, { children: jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-gap-2 ".concat(isMobile ? 'bunny-shadow-padding-x' : '') }, { children: [jsx(Button, __assign({ onClick: handleCheckoutNoPayment, type: "primary" }, { children: isSaving ? 'Processing...' : 'Complete order' })), jsx("div", __assign({ className: "bunny-text-xs bunny-text-slate-500" }, { children: "No payment is required" }))] })) }))) }));
|
|
20777
20802
|
};
|
|
20778
20803
|
var PaymentFormWrapper = function (_a) {
|
|
20779
20804
|
var children = _a.children, setMaxHeight = _a.setMaxHeight, className = _a.className;
|
|
@@ -23251,6 +23276,7 @@ var PaymentFormSection = function (_a) {
|
|
|
23251
23276
|
var onTokenExpired = useContext(BunnyContext).onTokenExpired;
|
|
23252
23277
|
var handleAllErrorFormats = useAllErrorFormats(onTokenExpired);
|
|
23253
23278
|
var showSuccessNotification = useSuccessNotification();
|
|
23279
|
+
useCurrentUserData().account;
|
|
23254
23280
|
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) {
|
|
23255
23281
|
handleAllErrorFormats(error);
|
|
23256
23282
|
}, onSavePaymentMethod: function () {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bunnyapp/components",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.68-beta.1",
|
|
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",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|
|
67
67
|
"@ant-design/icons": "^5.6.1",
|
|
68
|
-
"@bunnyapp/common": "^1.0.
|
|
68
|
+
"@bunnyapp/common": "^1.0.66-beta.1",
|
|
69
69
|
"@fortawesome/fontawesome-svg-core": "^6.7.2",
|
|
70
70
|
"@fortawesome/free-brands-svg-icons": "^6.7.2",
|
|
71
71
|
"@fortawesome/free-regular-svg-icons": "^6.7.2",
|
|
@@ -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
|
}
|