@bunnyapp/components 1.0.66-beta.6 → 1.0.66

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,7 +13,6 @@ 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');
17
16
  var reactStripeJs = require('@stripe/react-stripe-js');
18
17
  var index_js = require('@stripe/stripe-js/pure/index.js');
19
18
  var parse = require('html-react-parser');
@@ -174,7 +173,7 @@ var BrandContext = react.createContext({
174
173
  });
175
174
 
176
175
  // This will be replaced at build time by rollup-plugin-replace
177
- var PACKAGE_VERSION = '1.0.66-beta.6';
176
+ var PACKAGE_VERSION = '1.0.65';
178
177
  var createRequestHeaders = function (token) {
179
178
  var headers = common.createClientDevHeaders(token);
180
179
  // Add the components version header
@@ -408,20 +407,6 @@ function useToken() {
408
407
  return overrideToken || tokenFromContext;
409
408
  }
410
409
 
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
- };
425
410
  var DocumentTemplatePreview = function (_a) {
426
411
  var targetUrl = _a.targetUrl;
427
412
  var _b = react.useState(null), pdfUrl = _b[0], setPdfUrl = _b[1];
@@ -469,13 +454,7 @@ var DocumentTemplatePreview = function (_a) {
469
454
  if (!pdfUrl) {
470
455
  return jsxRuntime.jsx(jsxRuntime.Fragment, {});
471
456
  }
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, {}) }))] })) })) })));
457
+ return (jsxRuntime.jsx("div", __assign({ className: "document-template-preview max-w-[1280px] mx-auto bg-white rounded p-4" }, { children: jsxRuntime.jsx("iframe", { src: pdfUrl, width: "100%", height: "800px", style: { border: 'none' }, title: "Document Template Preview" }) })));
479
458
  };
480
459
 
481
460
  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"])));
@@ -492,7 +471,7 @@ var InvoiceQuoteView = function (_a) {
492
471
  color: secondaryColor,
493
472
  }, type: "link" }, { children: backButtonName || 'Back' }))) : null }), !hideDownloadButton ? (jsxRuntime.jsx(antd.Button, __assign({ icon: jsxRuntime.jsx(icons.DownloadOutlined, {}), onClick: function () {
494
473
  return downloadFile(apiHost + '/api/pdf/invoice/' + formattedInvoice.id, token);
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: {
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: {
496
475
  minWidth: '750px',
497
476
  } }, { children: [targetUrl ? (jsxRuntime.jsx(DocumentTemplatePreview, { targetUrl: targetUrl })) : (jsxRuntime.jsx(interweave.Markup, { content: html })), children] })))] })));
498
477
  };
@@ -18938,9 +18917,7 @@ var PaymentMethodForm = function (_a) {
18938
18917
  }
18939
18918
  });
18940
18919
  }); };
18941
- return (jsxRuntime.jsxs("form", { children: [jsxRuntime.jsx(reactStripeJs.PaymentElement, { options: {
18942
- layout: { type: 'accordion' },
18943
- } }), jsxRuntime.jsx(SavePaymentMethodFooter, { isSaving: isSaving, onSave: onSubmit })] }));
18920
+ return (jsxRuntime.jsxs("form", { children: [jsxRuntime.jsx(reactStripeJs.PaymentElement, { options: { layout: { type: 'accordion' } } }), jsxRuntime.jsx(SavePaymentMethodFooter, { isSaving: isSaving, onSave: onSubmit })] }));
18944
18921
  };
18945
18922
 
18946
18923
  // This is just a wrapper to fetch the stripe object and pass it to the form
@@ -19588,25 +19565,15 @@ var AcceptQuoteModal = function (_a) {
19588
19565
  }, 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, {}) })))] })) })));
19589
19566
  };
19590
19567
 
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
-
19600
19568
  var Title$2 = antd.Typography.Title;
19601
19569
  var showSuccessNotification$1 = common.useSuccessNotification();
19602
19570
  var PaymentHoldModal = function (_a) {
19603
19571
  var visible = _a.visible, setVisible = _a.setVisible, quote = _a.quote;
19604
19572
  var queryClient = reactQuery.useQueryClient();
19605
19573
  var token = useToken();
19606
- var account = useCurrentUserData().account;
19607
19574
  return (jsxRuntime.jsxs(StyledModal$1, __assign({ centered: true, onCancel: function () {
19608
19575
  setVisible(false);
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: {
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: {
19610
19577
  amount: quote.amount,
19611
19578
  currencyId: quote.currency,
19612
19579
  id: quote.quote.id,
@@ -19721,7 +19688,7 @@ function ActualQuote() {
19721
19688
  if ((firstInvoice === null || firstInvoice === void 0 ? void 0 : firstInvoice.state) === 'PAID' && paymentHoldCompleted) {
19722
19689
  return jsxRuntime.jsx(Invoice, { id: firstInvoice.id });
19723
19690
  }
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)
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)
19725
19692
  ? "".concat(apiHost, "/api/pdf/quote/").concat(formattedQuote.quote.id)
19726
19693
  : 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) {
19727
19694
  return (jsxRuntime.jsx(antd.Button, __assign({ download: doc.filename, href: doc.url, type: "link" }, { children: doc.filename }), index));
@@ -20338,6 +20305,15 @@ var getQuote = function (_a) {
20338
20305
  });
20339
20306
  };
20340
20307
 
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
+
20341
20317
  var BunnyFooterIcon = function (_a) {
20342
20318
  var color = _a.color;
20343
20319
  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" }) })) })] })));
@@ -20348,7 +20324,7 @@ var Footer = function (_a) {
20348
20324
  var className = _a.className;
20349
20325
  var _b = useCurrentUserData(), privacyUrl = _b.privacyUrl, termsUrl = _b.termsUrl;
20350
20326
  var isMobile = common.useIsMobile();
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, {})] })));
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 bunny-grow' : '', " ").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, {})] })));
20352
20328
  };
20353
20329
  var BunnyMarketingLink = function () {
20354
20330
  var _a = react.useState(false), isHovered = _a[0], setIsHovered = _a[1];
@@ -20362,8 +20338,7 @@ var templateObject_1$6, templateObject_2$1;
20362
20338
  var Title$1 = antd.Typography.Title;
20363
20339
  function PaymentForms(_a) {
20364
20340
  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;
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 })] })) }));
20341
+ 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, { 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 })] })) }));
20367
20342
  }
20368
20343
  function InitialSignupForm(_a) {
20369
20344
  var className = _a.className, onSubmit = _a.onSubmit, submitting = _a.submitting;
@@ -20828,7 +20803,7 @@ var QuoteCheckout = function (_a) {
20828
20803
  }
20829
20804
  if (taxationRequiredAccountFields)
20830
20805
  return (jsxRuntime.jsx(PaymentFormWrapper, __assign({ setMaxHeight: false }, { children: jsxRuntime.jsx(TaxationForm, { account: account, quote: quote }) })));
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" }))] })) }))) }));
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" }))] })) }))) }));
20832
20807
  };
20833
20808
  var PaymentFormWrapper = function (_a) {
20834
20809
  var children = _a.children, setMaxHeight = _a.setMaxHeight, className = _a.className;
@@ -23306,7 +23281,6 @@ var PaymentFormSection = function (_a) {
23306
23281
  var onTokenExpired = react.useContext(BunnyContext).onTokenExpired;
23307
23282
  var handleAllErrorFormats = common.useAllErrorFormats(onTokenExpired);
23308
23283
  var showSuccessNotification = common.useSuccessNotification();
23309
- useCurrentUserData().account;
23310
23284
  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) {
23311
23285
  handleAllErrorFormats(error);
23312
23286
  }, onSavePaymentMethod: function () {
@@ -1,4 +1,4 @@
1
- import { PluginData } from '@bunnyapp/common';
1
+ import { PluginData } from "@bunnyapp/common";
2
2
  declare const StripeForm: ({ plugin, onFail, onSavePaymentMethod, }: {
3
3
  plugin: PluginData;
4
4
  onFail: (error: any) => void;
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, useRef, useCallback } from 'react';
2
+ import { createContext, useEffect, useContext, useMemo, useState, useCallback, useRef } 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,7 +9,6 @@ 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';
13
12
  import { useElements, useStripe, PaymentElement, Elements } from '@stripe/react-stripe-js';
14
13
  import { loadStripe } from '@stripe/stripe-js/pure/index.js';
15
14
  import parse from 'html-react-parser';
@@ -144,7 +143,7 @@ var BrandContext = createContext({
144
143
  });
145
144
 
146
145
  // This will be replaced at build time by rollup-plugin-replace
147
- var PACKAGE_VERSION = '1.0.66-beta.6';
146
+ var PACKAGE_VERSION = '1.0.65';
148
147
  var createRequestHeaders = function (token) {
149
148
  var headers = createClientDevHeaders(token);
150
149
  // Add the components version header
@@ -378,20 +377,6 @@ function useToken() {
378
377
  return overrideToken || tokenFromContext;
379
378
  }
380
379
 
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
- };
395
380
  var DocumentTemplatePreview = function (_a) {
396
381
  var targetUrl = _a.targetUrl;
397
382
  var _b = useState(null), pdfUrl = _b[0], setPdfUrl = _b[1];
@@ -439,13 +424,7 @@ var DocumentTemplatePreview = function (_a) {
439
424
  if (!pdfUrl) {
440
425
  return jsx(Fragment, {});
441
426
  }
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, {}) }))] })) })) })));
427
+ return (jsx("div", __assign({ className: "document-template-preview max-w-[1280px] mx-auto bg-white rounded p-4" }, { children: jsx("iframe", { src: pdfUrl, width: "100%", height: "800px", style: { border: 'none' }, title: "Document Template Preview" }) })));
449
428
  };
450
429
 
451
430
  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"])));
@@ -462,7 +441,7 @@ var InvoiceQuoteView = function (_a) {
462
441
  color: secondaryColor,
463
442
  }, type: "link" }, { children: backButtonName || 'Back' }))) : null }), !hideDownloadButton ? (jsx(Button, __assign({ icon: jsx(DownloadOutlined, {}), onClick: function () {
464
443
  return downloadFile(apiHost + '/api/pdf/invoice/' + formattedInvoice.id, token);
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: {
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: {
466
445
  minWidth: '750px',
467
446
  } }, { children: [targetUrl ? (jsx(DocumentTemplatePreview, { targetUrl: targetUrl })) : (jsx(Markup, { content: html })), children] })))] })));
468
447
  };
@@ -18908,9 +18887,7 @@ var PaymentMethodForm = function (_a) {
18908
18887
  }
18909
18888
  });
18910
18889
  }); };
18911
- return (jsxs("form", { children: [jsx(PaymentElement, { options: {
18912
- layout: { type: 'accordion' },
18913
- } }), jsx(SavePaymentMethodFooter, { isSaving: isSaving, onSave: onSubmit })] }));
18890
+ return (jsxs("form", { children: [jsx(PaymentElement, { options: { layout: { type: 'accordion' } } }), jsx(SavePaymentMethodFooter, { isSaving: isSaving, onSave: onSubmit })] }));
18914
18891
  };
18915
18892
 
18916
18893
  // This is just a wrapper to fetch the stripe object and pass it to the form
@@ -19558,25 +19535,15 @@ var AcceptQuoteModal = function (_a) {
19558
19535
  }, 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, {}) })))] })) })));
19559
19536
  };
19560
19537
 
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
-
19570
19538
  var Title$2 = Typography.Title;
19571
19539
  var showSuccessNotification$1 = useSuccessNotification();
19572
19540
  var PaymentHoldModal = function (_a) {
19573
19541
  var visible = _a.visible, setVisible = _a.setVisible, quote = _a.quote;
19574
19542
  var queryClient = useQueryClient();
19575
19543
  var token = useToken();
19576
- var account = useCurrentUserData().account;
19577
19544
  return (jsxs(StyledModal$1, __assign({ centered: true, onCancel: function () {
19578
19545
  setVisible(false);
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: {
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: {
19580
19547
  amount: quote.amount,
19581
19548
  currencyId: quote.currency,
19582
19549
  id: quote.quote.id,
@@ -19691,7 +19658,7 @@ function ActualQuote() {
19691
19658
  if ((firstInvoice === null || firstInvoice === void 0 ? void 0 : firstInvoice.state) === 'PAID' && paymentHoldCompleted) {
19692
19659
  return jsx(Invoice, { id: firstInvoice.id });
19693
19660
  }
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)
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)
19695
19662
  ? "".concat(apiHost, "/api/pdf/quote/").concat(formattedQuote.quote.id)
19696
19663
  : 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) {
19697
19664
  return (jsx(Button, __assign({ download: doc.filename, href: doc.url, type: "link" }, { children: doc.filename }), index));
@@ -20308,6 +20275,15 @@ var getQuote = function (_a) {
20308
20275
  });
20309
20276
  };
20310
20277
 
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
+
20311
20287
  var BunnyFooterIcon = function (_a) {
20312
20288
  var color = _a.color;
20313
20289
  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" }) })) })] })));
@@ -20318,7 +20294,7 @@ var Footer = function (_a) {
20318
20294
  var className = _a.className;
20319
20295
  var _b = useCurrentUserData(), privacyUrl = _b.privacyUrl, termsUrl = _b.termsUrl;
20320
20296
  var isMobile = useIsMobile();
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, {})] })));
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 bunny-grow' : '', " ").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, {})] })));
20322
20298
  };
20323
20299
  var BunnyMarketingLink = function () {
20324
20300
  var _a = useState(false), isHovered = _a[0], setIsHovered = _a[1];
@@ -20332,8 +20308,7 @@ var templateObject_1$6, templateObject_2$1;
20332
20308
  var Title$1 = Typography.Title;
20333
20309
  function PaymentForms(_a) {
20334
20310
  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;
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 })] })) }));
20311
+ 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, { 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 })] })) }));
20337
20312
  }
20338
20313
  function InitialSignupForm(_a) {
20339
20314
  var className = _a.className, onSubmit = _a.onSubmit, submitting = _a.submitting;
@@ -20798,7 +20773,7 @@ var QuoteCheckout = function (_a) {
20798
20773
  }
20799
20774
  if (taxationRequiredAccountFields)
20800
20775
  return (jsx(PaymentFormWrapper, __assign({ setMaxHeight: false }, { children: jsx(TaxationForm, { account: account, quote: quote }) })));
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" }))] })) }))) }));
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" }))] })) }))) }));
20802
20777
  };
20803
20778
  var PaymentFormWrapper = function (_a) {
20804
20779
  var children = _a.children, setMaxHeight = _a.setMaxHeight, className = _a.className;
@@ -23276,7 +23251,6 @@ var PaymentFormSection = function (_a) {
23276
23251
  var onTokenExpired = useContext(BunnyContext).onTokenExpired;
23277
23252
  var handleAllErrorFormats = useAllErrorFormats(onTokenExpired);
23278
23253
  var showSuccessNotification = useSuccessNotification();
23279
- useCurrentUserData().account;
23280
23254
  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) {
23281
23255
  handleAllErrorFormats(error);
23282
23256
  }, onSavePaymentMethod: function () {
@@ -1,4 +1,4 @@
1
- import { PluginData } from '@bunnyapp/common';
1
+ import { PluginData } from "@bunnyapp/common";
2
2
  declare const StripeForm: ({ plugin, onFail, onSavePaymentMethod, }: {
3
3
  plugin: PluginData;
4
4
  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.6",
3
+ "version": "1.0.66",
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.66-beta.1",
68
+ "@bunnyapp/common": "^1.0.62-beta.7",
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,7 +93,6 @@
93
93
  ]
94
94
  },
95
95
  "dependencies": {
96
- "@pdf-viewer/react": "^1.7.1",
97
96
  "html-react-parser": "^5.2.5",
98
97
  "msw-storybook-addon": "^2.0.4"
99
98
  }