@bunnyapp/components 1.0.62-beta.3 → 1.0.62-beta.5
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 +103 -44
- package/dist/cjs/src/components/DocumentTemplatePreview.d.ts +4 -0
- package/dist/cjs/src/components/Invoice/InvoiceQuoteView.d.ts +2 -1
- package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/PriceListCardDescription.d.ts +1 -1
- package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/PriceListCardPrice.d.ts +1 -1
- package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/PriceListCardPriceDescription.d.ts +1 -1
- package/dist/cjs/src/components/Subscriptions/SubscriptionsListContainer.d.ts +2 -2
- package/dist/cjs/src/enums/BillingPeriodConverter.d.ts +8 -0
- package/dist/cjs/src/hooks/usePlugins.d.ts +1 -1
- package/dist/esm/index.js +104 -46
- package/dist/esm/src/components/DocumentTemplatePreview.d.ts +4 -0
- package/dist/esm/src/components/Invoice/InvoiceQuoteView.d.ts +2 -1
- package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/PriceListCardDescription.d.ts +1 -1
- package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/PriceListCardPrice.d.ts +1 -1
- package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/PriceListCardPriceDescription.d.ts +1 -1
- package/dist/esm/src/components/Subscriptions/SubscriptionsListContainer.d.ts +2 -2
- package/dist/esm/src/enums/BillingPeriodConverter.d.ts +8 -0
- package/dist/esm/src/hooks/usePlugins.d.ts +1 -1
- package/package.json +3 -2
- package/dist/cjs/src/graphql/queries/getPlanChangeOptions.d.ts +0 -8
- package/dist/esm/src/graphql/queries/getPlanChangeOptions.d.ts +0 -8
package/dist/cjs/index.js
CHANGED
|
@@ -15,6 +15,7 @@ var recoil = require('recoil');
|
|
|
15
15
|
var request = require('graphql-request');
|
|
16
16
|
var reactStripeJs = require('@stripe/react-stripe-js');
|
|
17
17
|
var index_js = require('@stripe/stripe-js/pure/index.js');
|
|
18
|
+
var parse = require('html-react-parser');
|
|
18
19
|
var reactFontawesome = require('@fortawesome/react-fontawesome');
|
|
19
20
|
var freeSolidSvgIcons = require('@fortawesome/free-solid-svg-icons');
|
|
20
21
|
var recharts = require('recharts');
|
|
@@ -44,6 +45,7 @@ function _interopNamespace(e) {
|
|
|
44
45
|
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
45
46
|
var theme__default = /*#__PURE__*/_interopDefaultLegacy(theme);
|
|
46
47
|
var request__default = /*#__PURE__*/_interopDefaultLegacy(request);
|
|
48
|
+
var parse__default = /*#__PURE__*/_interopDefaultLegacy(parse);
|
|
47
49
|
var pkg__default = /*#__PURE__*/_interopDefaultLegacy(pkg);
|
|
48
50
|
|
|
49
51
|
function styleInject(css, ref) {
|
|
@@ -171,7 +173,7 @@ var BrandContext = react.createContext({
|
|
|
171
173
|
});
|
|
172
174
|
|
|
173
175
|
// This will be replaced at build time by rollup-plugin-replace
|
|
174
|
-
var PACKAGE_VERSION = '1.0.62-beta.
|
|
176
|
+
var PACKAGE_VERSION = '1.0.62-beta.5';
|
|
175
177
|
var createRequestHeaders = function (token) {
|
|
176
178
|
var _a;
|
|
177
179
|
var bearerToken = token ? "Bearer ".concat(token) : null;
|
|
@@ -416,9 +418,59 @@ function useToken() {
|
|
|
416
418
|
return overrideToken || tokenFromContext;
|
|
417
419
|
}
|
|
418
420
|
|
|
421
|
+
var DocumentTemplatePreview = function (_a) {
|
|
422
|
+
var targetUrl = _a.targetUrl;
|
|
423
|
+
var _b = react.useState(null), pdfUrl = _b[0], setPdfUrl = _b[1];
|
|
424
|
+
var queryClient = reactQuery.useQueryClient();
|
|
425
|
+
var queryKey = react.useMemo(function () { return ['documentTemplatePreview', targetUrl]; }, [targetUrl]);
|
|
426
|
+
// Clear previous data when component mounts or id changes
|
|
427
|
+
react.useEffect(function () {
|
|
428
|
+
// Remove any existing data for this query
|
|
429
|
+
queryClient.removeQueries({ queryKey: queryKey });
|
|
430
|
+
}, [queryClient, queryKey]);
|
|
431
|
+
var _c = reactQuery.useQuery({
|
|
432
|
+
queryKey: queryKey,
|
|
433
|
+
queryFn: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
434
|
+
var response, blob;
|
|
435
|
+
return __generator(this, function (_a) {
|
|
436
|
+
switch (_a.label) {
|
|
437
|
+
case 0: return [4 /*yield*/, fetch(targetUrl)];
|
|
438
|
+
case 1:
|
|
439
|
+
response = _a.sent();
|
|
440
|
+
if (!response.ok) {
|
|
441
|
+
throw new Error('Failed to fetch PDF');
|
|
442
|
+
}
|
|
443
|
+
return [4 /*yield*/, response.blob()];
|
|
444
|
+
case 2:
|
|
445
|
+
blob = _a.sent();
|
|
446
|
+
return [2 /*return*/, blob];
|
|
447
|
+
}
|
|
448
|
+
});
|
|
449
|
+
}); },
|
|
450
|
+
enabled: !!targetUrl,
|
|
451
|
+
}), data = _c.data, isLoading = _c.isLoading;
|
|
452
|
+
react.useEffect(function () {
|
|
453
|
+
if (data) {
|
|
454
|
+
var url_1 = URL.createObjectURL(data);
|
|
455
|
+
setPdfUrl(url_1);
|
|
456
|
+
// Cleanup function to revoke the object URL
|
|
457
|
+
return function () {
|
|
458
|
+
URL.revokeObjectURL(url_1);
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
}, [data]);
|
|
462
|
+
if (isLoading) {
|
|
463
|
+
return (jsxRuntime.jsx("div", __assign({ className: "flex items-center justify-center h-96" }, { children: jsxRuntime.jsx(antd.Spin, {}) })));
|
|
464
|
+
}
|
|
465
|
+
if (!pdfUrl) {
|
|
466
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
467
|
+
}
|
|
468
|
+
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" }) })));
|
|
469
|
+
};
|
|
470
|
+
|
|
419
471
|
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"])));
|
|
420
472
|
var InvoiceQuoteView = function (_a) {
|
|
421
|
-
var children = _a.children, formattedInvoice = _a.formattedInvoice, html = _a.html, backButtonName = _a.backButtonName, onBackButtonClick = _a.onBackButtonClick, onDownloadError = _a.onDownloadError;
|
|
473
|
+
var children = _a.children, formattedInvoice = _a.formattedInvoice, html = _a.html, backButtonName = _a.backButtonName, onBackButtonClick = _a.onBackButtonClick, onDownloadError = _a.onDownloadError, targetUrl = _a.targetUrl;
|
|
422
474
|
var downloadFile = useDownloadFile(formattedInvoice === null || formattedInvoice === void 0 ? void 0 : formattedInvoice.id, onDownloadError);
|
|
423
475
|
var secondaryColor = react.useContext(BrandContext).secondaryColor;
|
|
424
476
|
var apiHost = react.useContext(BunnyContext).apiHost;
|
|
@@ -430,9 +482,9 @@ var InvoiceQuoteView = function (_a) {
|
|
|
430
482
|
color: secondaryColor,
|
|
431
483
|
}, type: "link" }, { children: backButtonName || 'Back' }))) : null }), !hideDownloadButton ? (jsxRuntime.jsx(antd.Button, __assign({ icon: jsxRuntime.jsx(icons.DownloadOutlined, {}), onClick: function () {
|
|
432
484
|
return downloadFile(apiHost + '/api/pdf/invoice/' + formattedInvoice.id, token);
|
|
433
|
-
} }, { 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: [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: {
|
|
485
|
+
} }, { 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: {
|
|
434
486
|
minWidth: '750px',
|
|
435
|
-
} }, { children: [jsxRuntime.jsx(interweave.Markup, { content: html }), children] })))] })));
|
|
487
|
+
} }, { children: [targetUrl ? (jsxRuntime.jsx(DocumentTemplatePreview, { targetUrl: targetUrl })) : (jsxRuntime.jsx(interweave.Markup, { content: html })), children] })))] })));
|
|
436
488
|
};
|
|
437
489
|
var templateObject_1$c;
|
|
438
490
|
|
|
@@ -19036,7 +19088,6 @@ function useSetDefaultPaymentMethod(paymentPlugins, apiHost, token, accountId, o
|
|
|
19036
19088
|
return { setDefaultPaymentMethod: setDefaultPaymentMethod, loading: loading };
|
|
19037
19089
|
}
|
|
19038
19090
|
|
|
19039
|
-
var Panel = antd.Collapse.Panel;
|
|
19040
19091
|
var showErrorNotification$1 = common.useErrorNotification();
|
|
19041
19092
|
var PaymentForm = function (_a) {
|
|
19042
19093
|
var _b;
|
|
@@ -19119,7 +19170,14 @@ var PaymentForm = function (_a) {
|
|
|
19119
19170
|
storedPaymentMethods: storedPaymentMethods,
|
|
19120
19171
|
defaultPaymentMethod: defaultPaymentMethod,
|
|
19121
19172
|
customCheckoutFunction: customCheckoutFunction,
|
|
19122
|
-
} }, { children: jsxRuntime.jsx(StripeWrapper, __assign({ plugin: selectorPaymentMethodPlugin, token: token, apiHost: apiHost, currencyId: currencyId, accountId: accountId }, { children: jsxRuntime.jsx("div", __assign({ className: "bunny-flex bunny-flex-col bunny-gap-0 bunny-w-full" }, { children: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-gap-2 bunny-px-4" }, { children: [storedPaymentMethods === null || storedPaymentMethods === void 0 ? void 0 : storedPaymentMethods.map(function (paymentMethod) { return (jsxRuntime.jsx(MiniCreditCard, { onClickRemove: function () { return onClickRemove(paymentMethod); }, onClickSetDefault: function () { return handleSetDefault(paymentMethod); }, paymentMethodData: paymentMethod, id: "payment-method-".concat(paymentMethod.id) }, paymentMethod.id)); }), (storedPaymentMethods === null || storedPaymentMethods === void 0 ? void 0 : storedPaymentMethods.length) === 0 && (jsxRuntime.jsx(MiniCreditCard, { onClickRemove: function () { }, onClickSetDefault: function () { } }))] })), jsxRuntime.jsx(antd.Collapse,
|
|
19173
|
+
} }, { children: jsxRuntime.jsx(StripeWrapper, __assign({ plugin: selectorPaymentMethodPlugin, token: token, apiHost: apiHost, currencyId: currencyId, accountId: accountId }, { children: jsxRuntime.jsx("div", __assign({ className: "bunny-flex bunny-flex-col bunny-gap-0 bunny-w-full" }, { children: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-gap-2 bunny-px-4" }, { children: [storedPaymentMethods === null || storedPaymentMethods === void 0 ? void 0 : storedPaymentMethods.map(function (paymentMethod) { return (jsxRuntime.jsx(MiniCreditCard, { onClickRemove: function () { return onClickRemove(paymentMethod); }, onClickSetDefault: function () { return handleSetDefault(paymentMethod); }, paymentMethodData: paymentMethod, id: "payment-method-".concat(paymentMethod.id) }, paymentMethod.id)); }), (storedPaymentMethods === null || storedPaymentMethods === void 0 ? void 0 : storedPaymentMethods.length) === 0 && (jsxRuntime.jsx(MiniCreditCard, { onClickRemove: function () { }, onClickSetDefault: function () { } }))] })), jsxRuntime.jsx(antd.Collapse, { bordered: false, activeKey: showPaymentMethodForm ? '1' : undefined, ghost: true, collapsible: "disabled", destroyOnHidden: true, items: [
|
|
19174
|
+
{
|
|
19175
|
+
key: '1',
|
|
19176
|
+
showArrow: false,
|
|
19177
|
+
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,
|
|
19178
|
+
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 }) })))] }))),
|
|
19179
|
+
},
|
|
19180
|
+
] }), 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] }) })) })) })));
|
|
19123
19181
|
};
|
|
19124
19182
|
function StripeWrapper(_a) {
|
|
19125
19183
|
var children = _a.children, plugin = _a.plugin, token = _a.token, apiHost = _a.apiHost, currencyId = _a.currencyId, accountId = _a.accountId;
|
|
@@ -19187,7 +19245,7 @@ function ActualInvoice() {
|
|
|
19187
19245
|
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 }) })))] })) })));
|
|
19188
19246
|
}
|
|
19189
19247
|
|
|
19190
|
-
var MUTATION$7 = function (id) { return "\n query formattedQuote ($id: ID) {\n formattedQuote (id: $id) {\n object {\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
|
|
19248
|
+
var MUTATION$7 = function (id) { return "\n query formattedQuote ($id: ID) {\n formattedQuote (id: $id) {\n object {\n documents { id filename size date url }\n documentTemplateId\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 }"; };
|
|
19191
19249
|
var getFormattedQuote = function (_a) {
|
|
19192
19250
|
var id = _a.id, token = _a.token, apiHost = _a.apiHost;
|
|
19193
19251
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -19214,7 +19272,7 @@ var getFormattedQuote = function (_a) {
|
|
|
19214
19272
|
var usePlugins = function (_a) {
|
|
19215
19273
|
var apiHost = _a.apiHost, token = _a.token;
|
|
19216
19274
|
var response = reactQuery.useQuery({
|
|
19217
|
-
queryKey: common.QueryKeyFactory.default.pluginsKey(token ||
|
|
19275
|
+
queryKey: common.QueryKeyFactory.default.pluginsKey(token || ''),
|
|
19218
19276
|
queryFn: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
19219
19277
|
var plugins;
|
|
19220
19278
|
return __generator(this, function (_a) {
|
|
@@ -19225,7 +19283,6 @@ var usePlugins = function (_a) {
|
|
|
19225
19283
|
})];
|
|
19226
19284
|
case 1:
|
|
19227
19285
|
plugins = _a.sent();
|
|
19228
|
-
console.log("plugins in usePlugins: ", plugins);
|
|
19229
19286
|
return [2 /*return*/, plugins];
|
|
19230
19287
|
}
|
|
19231
19288
|
});
|
|
@@ -19252,9 +19309,7 @@ var getPlugins = function (_a) {
|
|
|
19252
19309
|
plugins = _b.sent();
|
|
19253
19310
|
filteredPlugins = plugins.filter(function (plugin) {
|
|
19254
19311
|
var _a, _b;
|
|
19255
|
-
var result = ((_a = plugin.entities) === null || _a === void 0 ? void 0 : _a.includes(Number(entityId))) ||
|
|
19256
|
-
((_b = plugin.entities) === null || _b === void 0 ? void 0 : _b.length) === 0 ||
|
|
19257
|
-
!entityId;
|
|
19312
|
+
var result = ((_a = plugin.entities) === null || _a === void 0 ? void 0 : _a.includes(Number(entityId))) || ((_b = plugin.entities) === null || _b === void 0 ? void 0 : _b.length) === 0 || !entityId;
|
|
19258
19313
|
return result;
|
|
19259
19314
|
});
|
|
19260
19315
|
return [2 /*return*/, filteredPlugins];
|
|
@@ -19584,14 +19639,13 @@ var useQuotePaymentHold = function (formattedQuote) {
|
|
|
19584
19639
|
};
|
|
19585
19640
|
function ActualQuote() {
|
|
19586
19641
|
var _this = this;
|
|
19587
|
-
var _a, _b, _c;
|
|
19642
|
+
var _a, _b, _c, _d;
|
|
19588
19643
|
// Context
|
|
19589
|
-
var
|
|
19644
|
+
var _e = react.useContext(BunnyContext), apiHost = _e.apiHost, onTokenExpired = _e.onTokenExpired;
|
|
19590
19645
|
var token = useToken();
|
|
19591
|
-
react.useContext(
|
|
19592
|
-
var _e = react.useContext(InvoiceQuoteContext), className = _e.className, id = _e.id, hideDownloadButton = _e.hideDownloadButton, onQuoteLoaded = _e.onQuoteLoaded;
|
|
19646
|
+
var _f = react.useContext(InvoiceQuoteContext), className = _f.className, id = _f.id, hideDownloadButton = _f.hideDownloadButton, onQuoteLoaded = _f.onQuoteLoaded;
|
|
19593
19647
|
// Queries
|
|
19594
|
-
var
|
|
19648
|
+
var _g = reactQuery.useQuery({
|
|
19595
19649
|
queryKey: common.QueryKeyFactory.default.createQuoteKey({ id: id, token: token }),
|
|
19596
19650
|
queryFn: function () { return __awaiter(_this, void 0, void 0, function () {
|
|
19597
19651
|
var error_1;
|
|
@@ -19610,15 +19664,16 @@ function ActualQuote() {
|
|
|
19610
19664
|
});
|
|
19611
19665
|
}); },
|
|
19612
19666
|
placeholderData: reactQuery.keepPreviousData,
|
|
19613
|
-
}), data =
|
|
19667
|
+
}), data = _g.data, isLoading = _g.isLoading;
|
|
19614
19668
|
var formattedQuote = data;
|
|
19669
|
+
console.log(data);
|
|
19615
19670
|
// Hooks
|
|
19616
|
-
var
|
|
19671
|
+
var _h = useSendAcceptQuote({
|
|
19617
19672
|
token: token,
|
|
19618
19673
|
onTokenExpired: onTokenExpired,
|
|
19619
19674
|
apiHost: apiHost,
|
|
19620
19675
|
quoteId: id,
|
|
19621
|
-
}), acceptBoxVisible =
|
|
19676
|
+
}), acceptBoxVisible = _h.acceptBoxVisible, isAccepting = _h.isAccepting, sendAccept = _h.sendAccept, setAcceptBoxVisible = _h.setAcceptBoxVisible, setIsAccepting = _h.setIsAccepting, startAcceptance = _h.startAcceptance, pandadocPollingModalVisible = _h.pandadocPollingModalVisible, setPandadocPollingModalVisible = _h.setPandadocPollingModalVisible, isSendAcceptPending = _h.isSendAcceptPending;
|
|
19622
19677
|
useSigningComplete({ data: formattedQuote, token: token });
|
|
19623
19678
|
var isMobile = common.useIsMobile();
|
|
19624
19679
|
var showErrorNotification = common.useErrorNotification();
|
|
@@ -19628,7 +19683,7 @@ function ActualQuote() {
|
|
|
19628
19683
|
}
|
|
19629
19684
|
}, [formattedQuote]);
|
|
19630
19685
|
// Payment hold stuff here
|
|
19631
|
-
var
|
|
19686
|
+
var _j = useQuotePaymentHold(formattedQuote), paymentHoldModalVisible = _j.paymentHoldModalVisible, setPaymentHoldModalVisible = _j.setPaymentHoldModalVisible, shouldDoPaymentHold = _j.shouldDoPaymentHold, paymentHoldCompleted = _j.paymentHoldCompleted, paymentHold = _j.paymentHold;
|
|
19632
19687
|
var handleClickAccept = function () {
|
|
19633
19688
|
if (shouldDoPaymentHold && !paymentHoldCompleted) {
|
|
19634
19689
|
setPaymentHoldModalVisible(true);
|
|
@@ -19646,7 +19701,7 @@ function ActualQuote() {
|
|
|
19646
19701
|
if ((firstInvoice === null || firstInvoice === void 0 ? void 0 : firstInvoice.state) === 'PAID' && paymentHoldCompleted) {
|
|
19647
19702
|
return jsxRuntime.jsx(Invoice, { id: firstInvoice.id });
|
|
19648
19703
|
}
|
|
19649
|
-
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 }, { children: ((
|
|
19704
|
+
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.object) === null || _b === void 0 ? void 0 : _b.documentTemplateId) ? "".concat(apiHost, "/api/pdf/quote") : undefined }, { children: ((_d = (_c = formattedQuote.object) === 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.object.documents.map(function (doc, index) {
|
|
19650
19705
|
return (jsxRuntime.jsx(antd.Button, __assign({ download: doc.filename, href: doc.url, type: "link" }, { children: doc.filename }), index));
|
|
19651
19706
|
}) }))) : null }))] })), jsxRuntime.jsx(AcceptQuoteModal, { acceptBoxVisible: acceptBoxVisible, formattedQuote: formattedQuote, setAcceptBoxVisible: setAcceptBoxVisible, setIsAccepting: setIsAccepting, sendAccept: sendAccept, isSendAcceptPending: isSendAcceptPending }), jsxRuntime.jsx(PaymentHoldModal, { visible: paymentHoldModalVisible, setVisible: setPaymentHoldModalVisible, quote: formattedQuote }), jsxRuntime.jsx(PandadocPollingModal, { isVisible: pandadocPollingModalVisible, setVisible: setPandadocPollingModalVisible, id: id })] }));
|
|
19652
19707
|
}
|
|
@@ -21233,7 +21288,7 @@ var PlanPickerCheckoutBar = function (_a) {
|
|
|
21233
21288
|
};
|
|
21234
21289
|
|
|
21235
21290
|
// WARNING: There is a preview button on APP that will need to be changed if this query is changed
|
|
21236
|
-
var PRICE_LIST_CHANGE_OPTIONS_QUERY = "\n query priceListChangeOptions($subscriptionId: ID, $productId: ID) {\n priceListChangeOptions(subscriptionId: $subscriptionId, productId: $productId) {\n products {\n everythingInPlus\n id\n name\n plansToDisplay\n features(sort: \"position asc\") {\n description\n id\n isVisible\n kind\n name\n position\n }\n }\n priceLists {\n basePrice\n id\n
|
|
21291
|
+
var PRICE_LIST_CHANGE_OPTIONS_QUERY = "\n query priceListChangeOptions($subscriptionId: ID, $productId: ID) {\n priceListChangeOptions(subscriptionId: $subscriptionId, productId: $productId) {\n products {\n everythingInPlus\n id\n name\n plansToDisplay\n features(sort: \"position asc\") {\n description\n id\n isVisible\n kind\n name\n position\n }\n }\n priceLists {\n basePrice\n currencyId\n id\n monthlyBasePrice\n periodMonths\n plan {\n code\n contactUsLabel\n contactUsUrl\n description\n id\n name\n position\n pricingDescription\n pricingStyle\n planFeatures {\n featureId\n value\n feature {\n name\n }\n }\n }\n product {\n id\n }\n charges {\n basePrice\n billingPeriod\n chargeType\n id\n name\n priceDecimals\n pricingModel\n quantityMax\n quantityMin\n selfServiceQuantity\n feature {\n name\n unitName\n }\n }\n }\n }\n }";
|
|
21237
21292
|
var getPriceListChangeOptions = function (_a) {
|
|
21238
21293
|
var apiHost = _a.apiHost, isInPreviewMode = _a.isInPreviewMode, productId = _a.productId, token = _a.token, upgradingSubscription = _a.upgradingSubscription;
|
|
21239
21294
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -21339,21 +21394,35 @@ var PriceListCardTitle = function (_a) {
|
|
|
21339
21394
|
|
|
21340
21395
|
var PriceListCardPrice = function (_a) {
|
|
21341
21396
|
var priceList = _a.priceList;
|
|
21342
|
-
return (jsxRuntime.jsx("div", __assign({ className: "bunny-font-medium bunny-text-center bunny-text-gray-900", style: { fontSize:
|
|
21343
|
-
? common.formatCurrency(priceList.
|
|
21397
|
+
return (jsxRuntime.jsx("div", __assign({ className: "bunny-font-medium bunny-text-center bunny-text-gray-900", style: { fontSize: '32px' } }, { children: !priceList.plan.pricingStyle || priceList.plan.pricingStyle === common.PricingStyle.PRICED
|
|
21398
|
+
? common.formatCurrency(priceList.monthlyBasePrice, priceList.currencyId, 0)
|
|
21344
21399
|
: priceList.plan.pricingStyle === common.PricingStyle.CONTACT_US
|
|
21345
|
-
?
|
|
21346
|
-
:
|
|
21400
|
+
? ''
|
|
21401
|
+
: 'Free' })));
|
|
21347
21402
|
};
|
|
21348
21403
|
|
|
21349
21404
|
var Text$c = antd.Typography.Text;
|
|
21350
21405
|
var PriceListCardDescription = function (_a) {
|
|
21351
21406
|
var description = _a.description;
|
|
21407
|
+
var htmlParsedDescription = parse__default["default"](description || '');
|
|
21352
21408
|
if (!description)
|
|
21353
21409
|
return null;
|
|
21354
|
-
return jsxRuntime.jsx(Text$c, __assign({ className: "bunny-text-center" }, { children:
|
|
21410
|
+
return jsxRuntime.jsx(Text$c, __assign({ className: "bunny-text-center" }, { children: htmlParsedDescription }));
|
|
21355
21411
|
};
|
|
21356
21412
|
|
|
21413
|
+
var BillingPeriodConverter;
|
|
21414
|
+
(function (BillingPeriodConverter) {
|
|
21415
|
+
BillingPeriodConverter["ONCE"] = "once";
|
|
21416
|
+
BillingPeriodConverter["MONTHLY"] = "monthly";
|
|
21417
|
+
BillingPeriodConverter["ANNUAL"] = "annually";
|
|
21418
|
+
BillingPeriodConverter["SEMI_ANNUAL"] = "semi annually";
|
|
21419
|
+
BillingPeriodConverter["QUARTERLY"] = "quarterly";
|
|
21420
|
+
})(BillingPeriodConverter || (BillingPeriodConverter = {}));
|
|
21421
|
+
var BillingPeriodConverter$1 = BillingPeriodConverter;
|
|
21422
|
+
|
|
21423
|
+
var isEmptyHtml = function (html) {
|
|
21424
|
+
return /^<[^>]*>(\s*)<\/[^>]*>$/.test(html);
|
|
21425
|
+
};
|
|
21357
21426
|
var Text$b = antd.Typography.Text;
|
|
21358
21427
|
var PriceListCardPriceDescription = function (_a) {
|
|
21359
21428
|
var feature = _a.feature, priceList = _a.priceList;
|
|
@@ -21361,13 +21430,11 @@ var PriceListCardPriceDescription = function (_a) {
|
|
|
21361
21430
|
var doesPlanHaveFlatFeeCharges = priceList.charges.some(function (charge) { return charge.pricingModel === common.PricingModel.FLAT && charge.basePrice > 0; });
|
|
21362
21431
|
if (priceList.periodMonths <= 0 || priceList.plan.pricingStyle !== common.PricingStyle.PRICED)
|
|
21363
21432
|
return null;
|
|
21364
|
-
return (jsxRuntime.jsx(Text$b, __assign({ className: "bunny-text-center bunny-text-gray-900", style: {
|
|
21365
|
-
|
|
21366
|
-
|
|
21367
|
-
|
|
21368
|
-
|
|
21369
|
-
? "".concat(feature.unitName.toLowerCase(), " / ")
|
|
21370
|
-
: "").concat(common.PERIOD_LABELS[periodMonthsConverter(priceList.periodMonths)]) })));
|
|
21433
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Text$b, __assign({ className: "bunny-text-center bunny-text-gray-900", style: {
|
|
21434
|
+
fontSize: isMobile ? '13px' : '12px',
|
|
21435
|
+
} }, { children: priceList.plan.pricingDescription && !isEmptyHtml(priceList.plan.pricingDescription) ? (jsxRuntime.jsx(interweave.Markup, { content: priceList.plan.pricingDescription })) : ("per ".concat((feature === null || feature === void 0 ? void 0 : feature.unitName) && !doesPlanHaveFlatFeeCharges
|
|
21436
|
+
? "".concat(feature.unitName.toLowerCase(), " / ")
|
|
21437
|
+
: '', "month")) })), priceList.periodMonths > 1 && (jsxRuntime.jsxs(Text$b, __assign({ className: "bunny-text-center bunny-text-gray-900", style: { fontSize: isMobile ? '12px' : '11px' } }, { children: ["billed ", BillingPeriodConverter$1[periodMonthsConverter(priceList.periodMonths)]] })))] }));
|
|
21371
21438
|
};
|
|
21372
21439
|
|
|
21373
21440
|
var CheckIcon = function (_a) {
|
|
@@ -22232,17 +22299,9 @@ var SubscriptionCardHeader = function (_a) {
|
|
|
22232
22299
|
} }, { children: [jsxRuntime.jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-gap-2" }, { children: [((_c = subscription === null || subscription === void 0 ? void 0 : subscription.product) === null || _c === void 0 ? void 0 : _c.name) && (jsxRuntime.jsx(Text$7, __assign({ style: __assign({ fontSize: "11px", fontWeight: 500, color: brandColor }, subscriptionProductNameStyle) }, { children: (_d = subscription.product.name) === null || _d === void 0 ? void 0 : _d.toUpperCase() }))), jsxRuntime.jsxs("div", __assign({ className: "bunny-flex bunny-grow bunny-items-center bunny-gap-2" }, { children: [((_e = subscription === null || subscription === void 0 ? void 0 : subscription.plan) === null || _e === void 0 ? void 0 : _e.name) && jsxRuntime.jsx(Text$7, __assign({ className: "bunny-text-lg" }, { children: subscription.plan.name })), jsxRuntime.jsxs(CustomizedTag, __assign({ color: common.TAG_COLORS[(_f = subscription.state) === null || _f === void 0 ? void 0 : _f.toUpperCase()] }, { children: [lodashExports.capitalize(subscription.state.toLowerCase()), isTrial ? " (".concat(trialDaysLeft, " days left)") : ""] }))] }))] })), jsxRuntime.jsxs("div", __assign({ className: "bunny-flex bunny-items-center bunny-gap-6" }, { children: [jsxRuntime.jsx(Text$7, __assign({ className: "bunny-grow bunny-text-xs" }, { children: getSubscriptionStatusText(subscription) })), !isMobile && priceListChangeOptions && onChangePlanClick && onCancelSubscriptionClick && (jsxRuntime.jsx(SubscriptionCardActions, { onChangePlanClick: onChangePlanClick, onCancelSubscriptionClick: onCancelSubscriptionClick, priceListChangeOptions: priceListChangeOptions, subscription: subscription }))] }))] })));
|
|
22233
22300
|
};
|
|
22234
22301
|
|
|
22235
|
-
var BillingPeriodConverter;
|
|
22236
|
-
(function (BillingPeriodConverter) {
|
|
22237
|
-
BillingPeriodConverter["ONCE"] = "once";
|
|
22238
|
-
BillingPeriodConverter["MONTHLY"] = "monthly";
|
|
22239
|
-
BillingPeriodConverter["ANNUAL"] = "annually";
|
|
22240
|
-
BillingPeriodConverter["SEMI_ANNUAL"] = "semi annually";
|
|
22241
|
-
BillingPeriodConverter["QUARTERLY"] = "quarterly";
|
|
22242
|
-
})(BillingPeriodConverter || (BillingPeriodConverter = {}));
|
|
22243
22302
|
var SubscriptionChargeTotal = function (_a) {
|
|
22244
22303
|
var charge = _a.charge, subscription = _a.subscription;
|
|
22245
|
-
var billingPeriod = charge.billingPeriod && BillingPeriodConverter[charge.billingPeriod];
|
|
22304
|
+
var billingPeriod = charge.billingPeriod && BillingPeriodConverter$1[charge.billingPeriod];
|
|
22246
22305
|
var isMobile = common.useIsMobile();
|
|
22247
22306
|
var currencyId = subscription.currencyId;
|
|
22248
22307
|
var formattedDiscountedPrice = common.formatCurrency(charge.price, currencyId);
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { FormattedInvoice } from '@bunnyapp/common';
|
|
3
|
-
declare const InvoiceQuoteView: ({ children, formattedInvoice, html, backButtonName, onBackButtonClick, onDownloadError, }: {
|
|
3
|
+
declare const InvoiceQuoteView: ({ children, formattedInvoice, html, backButtonName, onBackButtonClick, onDownloadError, targetUrl, }: {
|
|
4
4
|
html: string;
|
|
5
5
|
children?: ReactNode;
|
|
6
6
|
formattedInvoice?: FormattedInvoice | undefined;
|
|
7
7
|
backButtonName?: string | undefined;
|
|
8
8
|
onBackButtonClick?: (() => void) | undefined;
|
|
9
9
|
onDownloadError?: (() => void) | undefined;
|
|
10
|
+
targetUrl?: string | undefined;
|
|
10
11
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
11
12
|
export default InvoiceQuoteView;
|
package/dist/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsx,
|
|
1
|
+
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { createContext, useEffect, useContext, useMemo, useState, useCallback, useRef } from 'react';
|
|
3
3
|
import { Markup } from 'interweave';
|
|
4
|
-
import { ConfigProvider, Button, Tag, Typography, Dropdown, Input, Checkbox,
|
|
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';
|
|
6
6
|
import styled from 'styled-components';
|
|
7
7
|
import { DEFAULT_ACCENT_COLOR, DEFAULT_BRAND_COLOR, DEFAULT_SECONDARY_COLOR, DEFAULT_TOP_NAV_IMAGE_URL, gqlRequest as gqlRequest$1, X_BUNNY_COMPONENTS_VERSION_HEADER_NAME, QueryKeyFactory, useIsMobile, isColorTooDark, INPUT_BORDER_COLOR, SLATE_50, SLATE_400, SLATE_200, useErrorNotification, invokePlugin, useAllErrorFormats, formatCurrency, GRAY_500, GRAY_200, useSuccessNotification, getFormattedInvoice, PAYABLE_INVOICE_STATES, BreakpointNumbers, request as request$1, useGraphQLmutation, formatDate, FrontendTransaction, SLATE_600, WHITE, TransactionKind, SLATE_500, PRIMARY_COLOR as PRIMARY_COLOR$1, sortSubscriptionCharges, Lists, getAccount, StringUtils, BillingPeriod, ChargeType, SubscriptionState as SubscriptionState$2, PERIOD_LABELS, PricingStyle, PricingModel, SLATE_100, useInfoNotification, MODAL_MAX_HEIGHT, DataInterval, QuoteChangeKind, TAG_COLORS } from '@bunnyapp/common';
|
|
@@ -11,6 +11,7 @@ import { RecoilRoot } from 'recoil';
|
|
|
11
11
|
import request, { GraphQLClient } from 'graphql-request';
|
|
12
12
|
import { useElements, useStripe, PaymentElement, Elements } from '@stripe/react-stripe-js';
|
|
13
13
|
import { loadStripe } from '@stripe/stripe-js/pure/index.js';
|
|
14
|
+
import parse from 'html-react-parser';
|
|
14
15
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
15
16
|
import { faChevronLeft, faChevronRight } from '@fortawesome/free-solid-svg-icons';
|
|
16
17
|
import { BarChart, ResponsiveContainer, XAxis, Tooltip as Tooltip$1, Bar, Rectangle } from 'recharts';
|
|
@@ -142,7 +143,7 @@ var BrandContext = createContext({
|
|
|
142
143
|
});
|
|
143
144
|
|
|
144
145
|
// This will be replaced at build time by rollup-plugin-replace
|
|
145
|
-
var PACKAGE_VERSION = '1.0.62-beta.
|
|
146
|
+
var PACKAGE_VERSION = '1.0.62-beta.5';
|
|
146
147
|
var createRequestHeaders = function (token) {
|
|
147
148
|
var _a;
|
|
148
149
|
var bearerToken = token ? "Bearer ".concat(token) : null;
|
|
@@ -387,9 +388,59 @@ function useToken() {
|
|
|
387
388
|
return overrideToken || tokenFromContext;
|
|
388
389
|
}
|
|
389
390
|
|
|
391
|
+
var DocumentTemplatePreview = function (_a) {
|
|
392
|
+
var targetUrl = _a.targetUrl;
|
|
393
|
+
var _b = useState(null), pdfUrl = _b[0], setPdfUrl = _b[1];
|
|
394
|
+
var queryClient = useQueryClient();
|
|
395
|
+
var queryKey = useMemo(function () { return ['documentTemplatePreview', targetUrl]; }, [targetUrl]);
|
|
396
|
+
// Clear previous data when component mounts or id changes
|
|
397
|
+
useEffect(function () {
|
|
398
|
+
// Remove any existing data for this query
|
|
399
|
+
queryClient.removeQueries({ queryKey: queryKey });
|
|
400
|
+
}, [queryClient, queryKey]);
|
|
401
|
+
var _c = useQuery({
|
|
402
|
+
queryKey: queryKey,
|
|
403
|
+
queryFn: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
404
|
+
var response, blob;
|
|
405
|
+
return __generator(this, function (_a) {
|
|
406
|
+
switch (_a.label) {
|
|
407
|
+
case 0: return [4 /*yield*/, fetch(targetUrl)];
|
|
408
|
+
case 1:
|
|
409
|
+
response = _a.sent();
|
|
410
|
+
if (!response.ok) {
|
|
411
|
+
throw new Error('Failed to fetch PDF');
|
|
412
|
+
}
|
|
413
|
+
return [4 /*yield*/, response.blob()];
|
|
414
|
+
case 2:
|
|
415
|
+
blob = _a.sent();
|
|
416
|
+
return [2 /*return*/, blob];
|
|
417
|
+
}
|
|
418
|
+
});
|
|
419
|
+
}); },
|
|
420
|
+
enabled: !!targetUrl,
|
|
421
|
+
}), data = _c.data, isLoading = _c.isLoading;
|
|
422
|
+
useEffect(function () {
|
|
423
|
+
if (data) {
|
|
424
|
+
var url_1 = URL.createObjectURL(data);
|
|
425
|
+
setPdfUrl(url_1);
|
|
426
|
+
// Cleanup function to revoke the object URL
|
|
427
|
+
return function () {
|
|
428
|
+
URL.revokeObjectURL(url_1);
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
}, [data]);
|
|
432
|
+
if (isLoading) {
|
|
433
|
+
return (jsx("div", __assign({ className: "flex items-center justify-center h-96" }, { children: jsx(Spin, {}) })));
|
|
434
|
+
}
|
|
435
|
+
if (!pdfUrl) {
|
|
436
|
+
return jsx(Fragment, {});
|
|
437
|
+
}
|
|
438
|
+
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" }) })));
|
|
439
|
+
};
|
|
440
|
+
|
|
390
441
|
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"])));
|
|
391
442
|
var InvoiceQuoteView = function (_a) {
|
|
392
|
-
var children = _a.children, formattedInvoice = _a.formattedInvoice, html = _a.html, backButtonName = _a.backButtonName, onBackButtonClick = _a.onBackButtonClick, onDownloadError = _a.onDownloadError;
|
|
443
|
+
var children = _a.children, formattedInvoice = _a.formattedInvoice, html = _a.html, backButtonName = _a.backButtonName, onBackButtonClick = _a.onBackButtonClick, onDownloadError = _a.onDownloadError, targetUrl = _a.targetUrl;
|
|
393
444
|
var downloadFile = useDownloadFile(formattedInvoice === null || formattedInvoice === void 0 ? void 0 : formattedInvoice.id, onDownloadError);
|
|
394
445
|
var secondaryColor = useContext(BrandContext).secondaryColor;
|
|
395
446
|
var apiHost = useContext(BunnyContext).apiHost;
|
|
@@ -401,9 +452,9 @@ var InvoiceQuoteView = function (_a) {
|
|
|
401
452
|
color: secondaryColor,
|
|
402
453
|
}, type: "link" }, { children: backButtonName || 'Back' }))) : null }), !hideDownloadButton ? (jsx(Button, __assign({ icon: jsx(DownloadOutlined, {}), onClick: function () {
|
|
403
454
|
return downloadFile(apiHost + '/api/pdf/invoice/' + formattedInvoice.id, token);
|
|
404
|
-
} }, { 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: [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: {
|
|
455
|
+
} }, { 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: {
|
|
405
456
|
minWidth: '750px',
|
|
406
|
-
} }, { children: [jsx(Markup, { content: html }), children] })))] })));
|
|
457
|
+
} }, { children: [targetUrl ? (jsx(DocumentTemplatePreview, { targetUrl: targetUrl })) : (jsx(Markup, { content: html })), children] })))] })));
|
|
407
458
|
};
|
|
408
459
|
var templateObject_1$c;
|
|
409
460
|
|
|
@@ -19007,7 +19058,6 @@ function useSetDefaultPaymentMethod(paymentPlugins, apiHost, token, accountId, o
|
|
|
19007
19058
|
return { setDefaultPaymentMethod: setDefaultPaymentMethod, loading: loading };
|
|
19008
19059
|
}
|
|
19009
19060
|
|
|
19010
|
-
var Panel = Collapse.Panel;
|
|
19011
19061
|
var showErrorNotification$1 = useErrorNotification();
|
|
19012
19062
|
var PaymentForm = function (_a) {
|
|
19013
19063
|
var _b;
|
|
@@ -19090,7 +19140,14 @@ var PaymentForm = function (_a) {
|
|
|
19090
19140
|
storedPaymentMethods: storedPaymentMethods,
|
|
19091
19141
|
defaultPaymentMethod: defaultPaymentMethod,
|
|
19092
19142
|
customCheckoutFunction: customCheckoutFunction,
|
|
19093
|
-
} }, { children: jsx(StripeWrapper, __assign({ plugin: selectorPaymentMethodPlugin, token: token, apiHost: apiHost, currencyId: currencyId, accountId: accountId }, { children: jsx("div", __assign({ className: "bunny-flex bunny-flex-col bunny-gap-0 bunny-w-full" }, { children: jsxs(Fragment, { children: [jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-gap-2 bunny-px-4" }, { children: [storedPaymentMethods === null || storedPaymentMethods === void 0 ? void 0 : storedPaymentMethods.map(function (paymentMethod) { return (jsx(MiniCreditCard, { onClickRemove: function () { return onClickRemove(paymentMethod); }, onClickSetDefault: function () { return handleSetDefault(paymentMethod); }, paymentMethodData: paymentMethod, id: "payment-method-".concat(paymentMethod.id) }, paymentMethod.id)); }), (storedPaymentMethods === null || storedPaymentMethods === void 0 ? void 0 : storedPaymentMethods.length) === 0 && (jsx(MiniCreditCard, { onClickRemove: function () { }, onClickSetDefault: function () { } }))] })), jsx(Collapse,
|
|
19143
|
+
} }, { children: jsx(StripeWrapper, __assign({ plugin: selectorPaymentMethodPlugin, token: token, apiHost: apiHost, currencyId: currencyId, accountId: accountId }, { children: jsx("div", __assign({ className: "bunny-flex bunny-flex-col bunny-gap-0 bunny-w-full" }, { children: jsxs(Fragment, { children: [jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-gap-2 bunny-px-4" }, { children: [storedPaymentMethods === null || storedPaymentMethods === void 0 ? void 0 : storedPaymentMethods.map(function (paymentMethod) { return (jsx(MiniCreditCard, { onClickRemove: function () { return onClickRemove(paymentMethod); }, onClickSetDefault: function () { return handleSetDefault(paymentMethod); }, paymentMethodData: paymentMethod, id: "payment-method-".concat(paymentMethod.id) }, paymentMethod.id)); }), (storedPaymentMethods === null || storedPaymentMethods === void 0 ? void 0 : storedPaymentMethods.length) === 0 && (jsx(MiniCreditCard, { onClickRemove: function () { }, onClickSetDefault: function () { } }))] })), jsx(Collapse, { bordered: false, activeKey: showPaymentMethodForm ? '1' : undefined, ghost: true, collapsible: "disabled", destroyOnHidden: true, items: [
|
|
19144
|
+
{
|
|
19145
|
+
key: '1',
|
|
19146
|
+
showArrow: false,
|
|
19147
|
+
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,
|
|
19148
|
+
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 }) })))] }))),
|
|
19149
|
+
},
|
|
19150
|
+
] }), 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] }) })) })) })));
|
|
19094
19151
|
};
|
|
19095
19152
|
function StripeWrapper(_a) {
|
|
19096
19153
|
var children = _a.children, plugin = _a.plugin, token = _a.token, apiHost = _a.apiHost, currencyId = _a.currencyId, accountId = _a.accountId;
|
|
@@ -19158,7 +19215,7 @@ function ActualInvoice() {
|
|
|
19158
19215
|
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 }) })))] })) })));
|
|
19159
19216
|
}
|
|
19160
19217
|
|
|
19161
|
-
var MUTATION$7 = function (id) { return "\n query formattedQuote ($id: ID) {\n formattedQuote (id: $id) {\n object {\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
|
|
19218
|
+
var MUTATION$7 = function (id) { return "\n query formattedQuote ($id: ID) {\n formattedQuote (id: $id) {\n object {\n documents { id filename size date url }\n documentTemplateId\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 }"; };
|
|
19162
19219
|
var getFormattedQuote = function (_a) {
|
|
19163
19220
|
var id = _a.id, token = _a.token, apiHost = _a.apiHost;
|
|
19164
19221
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -19185,7 +19242,7 @@ var getFormattedQuote = function (_a) {
|
|
|
19185
19242
|
var usePlugins = function (_a) {
|
|
19186
19243
|
var apiHost = _a.apiHost, token = _a.token;
|
|
19187
19244
|
var response = useQuery({
|
|
19188
|
-
queryKey: QueryKeyFactory.default.pluginsKey(token ||
|
|
19245
|
+
queryKey: QueryKeyFactory.default.pluginsKey(token || ''),
|
|
19189
19246
|
queryFn: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
19190
19247
|
var plugins;
|
|
19191
19248
|
return __generator(this, function (_a) {
|
|
@@ -19196,7 +19253,6 @@ var usePlugins = function (_a) {
|
|
|
19196
19253
|
})];
|
|
19197
19254
|
case 1:
|
|
19198
19255
|
plugins = _a.sent();
|
|
19199
|
-
console.log("plugins in usePlugins: ", plugins);
|
|
19200
19256
|
return [2 /*return*/, plugins];
|
|
19201
19257
|
}
|
|
19202
19258
|
});
|
|
@@ -19223,9 +19279,7 @@ var getPlugins = function (_a) {
|
|
|
19223
19279
|
plugins = _b.sent();
|
|
19224
19280
|
filteredPlugins = plugins.filter(function (plugin) {
|
|
19225
19281
|
var _a, _b;
|
|
19226
|
-
var result = ((_a = plugin.entities) === null || _a === void 0 ? void 0 : _a.includes(Number(entityId))) ||
|
|
19227
|
-
((_b = plugin.entities) === null || _b === void 0 ? void 0 : _b.length) === 0 ||
|
|
19228
|
-
!entityId;
|
|
19282
|
+
var result = ((_a = plugin.entities) === null || _a === void 0 ? void 0 : _a.includes(Number(entityId))) || ((_b = plugin.entities) === null || _b === void 0 ? void 0 : _b.length) === 0 || !entityId;
|
|
19229
19283
|
return result;
|
|
19230
19284
|
});
|
|
19231
19285
|
return [2 /*return*/, filteredPlugins];
|
|
@@ -19555,14 +19609,13 @@ var useQuotePaymentHold = function (formattedQuote) {
|
|
|
19555
19609
|
};
|
|
19556
19610
|
function ActualQuote() {
|
|
19557
19611
|
var _this = this;
|
|
19558
|
-
var _a, _b, _c;
|
|
19612
|
+
var _a, _b, _c, _d;
|
|
19559
19613
|
// Context
|
|
19560
|
-
var
|
|
19614
|
+
var _e = useContext(BunnyContext), apiHost = _e.apiHost, onTokenExpired = _e.onTokenExpired;
|
|
19561
19615
|
var token = useToken();
|
|
19562
|
-
useContext(
|
|
19563
|
-
var _e = useContext(InvoiceQuoteContext), className = _e.className, id = _e.id, hideDownloadButton = _e.hideDownloadButton, onQuoteLoaded = _e.onQuoteLoaded;
|
|
19616
|
+
var _f = useContext(InvoiceQuoteContext), className = _f.className, id = _f.id, hideDownloadButton = _f.hideDownloadButton, onQuoteLoaded = _f.onQuoteLoaded;
|
|
19564
19617
|
// Queries
|
|
19565
|
-
var
|
|
19618
|
+
var _g = useQuery({
|
|
19566
19619
|
queryKey: QueryKeyFactory.default.createQuoteKey({ id: id, token: token }),
|
|
19567
19620
|
queryFn: function () { return __awaiter(_this, void 0, void 0, function () {
|
|
19568
19621
|
var error_1;
|
|
@@ -19581,15 +19634,16 @@ function ActualQuote() {
|
|
|
19581
19634
|
});
|
|
19582
19635
|
}); },
|
|
19583
19636
|
placeholderData: keepPreviousData,
|
|
19584
|
-
}), data =
|
|
19637
|
+
}), data = _g.data, isLoading = _g.isLoading;
|
|
19585
19638
|
var formattedQuote = data;
|
|
19639
|
+
console.log(data);
|
|
19586
19640
|
// Hooks
|
|
19587
|
-
var
|
|
19641
|
+
var _h = useSendAcceptQuote({
|
|
19588
19642
|
token: token,
|
|
19589
19643
|
onTokenExpired: onTokenExpired,
|
|
19590
19644
|
apiHost: apiHost,
|
|
19591
19645
|
quoteId: id,
|
|
19592
|
-
}), acceptBoxVisible =
|
|
19646
|
+
}), acceptBoxVisible = _h.acceptBoxVisible, isAccepting = _h.isAccepting, sendAccept = _h.sendAccept, setAcceptBoxVisible = _h.setAcceptBoxVisible, setIsAccepting = _h.setIsAccepting, startAcceptance = _h.startAcceptance, pandadocPollingModalVisible = _h.pandadocPollingModalVisible, setPandadocPollingModalVisible = _h.setPandadocPollingModalVisible, isSendAcceptPending = _h.isSendAcceptPending;
|
|
19593
19647
|
useSigningComplete({ data: formattedQuote, token: token });
|
|
19594
19648
|
var isMobile = useIsMobile();
|
|
19595
19649
|
var showErrorNotification = useErrorNotification();
|
|
@@ -19599,7 +19653,7 @@ function ActualQuote() {
|
|
|
19599
19653
|
}
|
|
19600
19654
|
}, [formattedQuote]);
|
|
19601
19655
|
// Payment hold stuff here
|
|
19602
|
-
var
|
|
19656
|
+
var _j = useQuotePaymentHold(formattedQuote), paymentHoldModalVisible = _j.paymentHoldModalVisible, setPaymentHoldModalVisible = _j.setPaymentHoldModalVisible, shouldDoPaymentHold = _j.shouldDoPaymentHold, paymentHoldCompleted = _j.paymentHoldCompleted, paymentHold = _j.paymentHold;
|
|
19603
19657
|
var handleClickAccept = function () {
|
|
19604
19658
|
if (shouldDoPaymentHold && !paymentHoldCompleted) {
|
|
19605
19659
|
setPaymentHoldModalVisible(true);
|
|
@@ -19617,7 +19671,7 @@ function ActualQuote() {
|
|
|
19617
19671
|
if ((firstInvoice === null || firstInvoice === void 0 ? void 0 : firstInvoice.state) === 'PAID' && paymentHoldCompleted) {
|
|
19618
19672
|
return jsx(Invoice, { id: firstInvoice.id });
|
|
19619
19673
|
}
|
|
19620
|
-
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 }, { children: ((
|
|
19674
|
+
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.object) === null || _b === void 0 ? void 0 : _b.documentTemplateId) ? "".concat(apiHost, "/api/pdf/quote") : undefined }, { children: ((_d = (_c = formattedQuote.object) === 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.object.documents.map(function (doc, index) {
|
|
19621
19675
|
return (jsx(Button, __assign({ download: doc.filename, href: doc.url, type: "link" }, { children: doc.filename }), index));
|
|
19622
19676
|
}) }))) : null }))] })), jsx(AcceptQuoteModal, { acceptBoxVisible: acceptBoxVisible, formattedQuote: formattedQuote, setAcceptBoxVisible: setAcceptBoxVisible, setIsAccepting: setIsAccepting, sendAccept: sendAccept, isSendAcceptPending: isSendAcceptPending }), jsx(PaymentHoldModal, { visible: paymentHoldModalVisible, setVisible: setPaymentHoldModalVisible, quote: formattedQuote }), jsx(PandadocPollingModal, { isVisible: pandadocPollingModalVisible, setVisible: setPandadocPollingModalVisible, id: id })] }));
|
|
19623
19677
|
}
|
|
@@ -21204,7 +21258,7 @@ var PlanPickerCheckoutBar = function (_a) {
|
|
|
21204
21258
|
};
|
|
21205
21259
|
|
|
21206
21260
|
// WARNING: There is a preview button on APP that will need to be changed if this query is changed
|
|
21207
|
-
var PRICE_LIST_CHANGE_OPTIONS_QUERY = "\n query priceListChangeOptions($subscriptionId: ID, $productId: ID) {\n priceListChangeOptions(subscriptionId: $subscriptionId, productId: $productId) {\n products {\n everythingInPlus\n id\n name\n plansToDisplay\n features(sort: \"position asc\") {\n description\n id\n isVisible\n kind\n name\n position\n }\n }\n priceLists {\n basePrice\n id\n
|
|
21261
|
+
var PRICE_LIST_CHANGE_OPTIONS_QUERY = "\n query priceListChangeOptions($subscriptionId: ID, $productId: ID) {\n priceListChangeOptions(subscriptionId: $subscriptionId, productId: $productId) {\n products {\n everythingInPlus\n id\n name\n plansToDisplay\n features(sort: \"position asc\") {\n description\n id\n isVisible\n kind\n name\n position\n }\n }\n priceLists {\n basePrice\n currencyId\n id\n monthlyBasePrice\n periodMonths\n plan {\n code\n contactUsLabel\n contactUsUrl\n description\n id\n name\n position\n pricingDescription\n pricingStyle\n planFeatures {\n featureId\n value\n feature {\n name\n }\n }\n }\n product {\n id\n }\n charges {\n basePrice\n billingPeriod\n chargeType\n id\n name\n priceDecimals\n pricingModel\n quantityMax\n quantityMin\n selfServiceQuantity\n feature {\n name\n unitName\n }\n }\n }\n }\n }";
|
|
21208
21262
|
var getPriceListChangeOptions = function (_a) {
|
|
21209
21263
|
var apiHost = _a.apiHost, isInPreviewMode = _a.isInPreviewMode, productId = _a.productId, token = _a.token, upgradingSubscription = _a.upgradingSubscription;
|
|
21210
21264
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -21310,21 +21364,35 @@ var PriceListCardTitle = function (_a) {
|
|
|
21310
21364
|
|
|
21311
21365
|
var PriceListCardPrice = function (_a) {
|
|
21312
21366
|
var priceList = _a.priceList;
|
|
21313
|
-
return (jsx("div", __assign({ className: "bunny-font-medium bunny-text-center bunny-text-gray-900", style: { fontSize:
|
|
21314
|
-
? formatCurrency(priceList.
|
|
21367
|
+
return (jsx("div", __assign({ className: "bunny-font-medium bunny-text-center bunny-text-gray-900", style: { fontSize: '32px' } }, { children: !priceList.plan.pricingStyle || priceList.plan.pricingStyle === PricingStyle.PRICED
|
|
21368
|
+
? formatCurrency(priceList.monthlyBasePrice, priceList.currencyId, 0)
|
|
21315
21369
|
: priceList.plan.pricingStyle === PricingStyle.CONTACT_US
|
|
21316
|
-
?
|
|
21317
|
-
:
|
|
21370
|
+
? ''
|
|
21371
|
+
: 'Free' })));
|
|
21318
21372
|
};
|
|
21319
21373
|
|
|
21320
21374
|
var Text$c = Typography.Text;
|
|
21321
21375
|
var PriceListCardDescription = function (_a) {
|
|
21322
21376
|
var description = _a.description;
|
|
21377
|
+
var htmlParsedDescription = parse(description || '');
|
|
21323
21378
|
if (!description)
|
|
21324
21379
|
return null;
|
|
21325
|
-
return jsx(Text$c, __assign({ className: "bunny-text-center" }, { children:
|
|
21380
|
+
return jsx(Text$c, __assign({ className: "bunny-text-center" }, { children: htmlParsedDescription }));
|
|
21326
21381
|
};
|
|
21327
21382
|
|
|
21383
|
+
var BillingPeriodConverter;
|
|
21384
|
+
(function (BillingPeriodConverter) {
|
|
21385
|
+
BillingPeriodConverter["ONCE"] = "once";
|
|
21386
|
+
BillingPeriodConverter["MONTHLY"] = "monthly";
|
|
21387
|
+
BillingPeriodConverter["ANNUAL"] = "annually";
|
|
21388
|
+
BillingPeriodConverter["SEMI_ANNUAL"] = "semi annually";
|
|
21389
|
+
BillingPeriodConverter["QUARTERLY"] = "quarterly";
|
|
21390
|
+
})(BillingPeriodConverter || (BillingPeriodConverter = {}));
|
|
21391
|
+
var BillingPeriodConverter$1 = BillingPeriodConverter;
|
|
21392
|
+
|
|
21393
|
+
var isEmptyHtml = function (html) {
|
|
21394
|
+
return /^<[^>]*>(\s*)<\/[^>]*>$/.test(html);
|
|
21395
|
+
};
|
|
21328
21396
|
var Text$b = Typography.Text;
|
|
21329
21397
|
var PriceListCardPriceDescription = function (_a) {
|
|
21330
21398
|
var feature = _a.feature, priceList = _a.priceList;
|
|
@@ -21332,13 +21400,11 @@ var PriceListCardPriceDescription = function (_a) {
|
|
|
21332
21400
|
var doesPlanHaveFlatFeeCharges = priceList.charges.some(function (charge) { return charge.pricingModel === PricingModel.FLAT && charge.basePrice > 0; });
|
|
21333
21401
|
if (priceList.periodMonths <= 0 || priceList.plan.pricingStyle !== PricingStyle.PRICED)
|
|
21334
21402
|
return null;
|
|
21335
|
-
return (jsx(Text$b, __assign({ className: "bunny-text-center bunny-text-gray-900", style: {
|
|
21336
|
-
|
|
21337
|
-
|
|
21338
|
-
|
|
21339
|
-
|
|
21340
|
-
? "".concat(feature.unitName.toLowerCase(), " / ")
|
|
21341
|
-
: "").concat(PERIOD_LABELS[periodMonthsConverter(priceList.periodMonths)]) })));
|
|
21403
|
+
return (jsxs(Fragment, { children: [jsx(Text$b, __assign({ className: "bunny-text-center bunny-text-gray-900", style: {
|
|
21404
|
+
fontSize: isMobile ? '13px' : '12px',
|
|
21405
|
+
} }, { children: priceList.plan.pricingDescription && !isEmptyHtml(priceList.plan.pricingDescription) ? (jsx(Markup, { content: priceList.plan.pricingDescription })) : ("per ".concat((feature === null || feature === void 0 ? void 0 : feature.unitName) && !doesPlanHaveFlatFeeCharges
|
|
21406
|
+
? "".concat(feature.unitName.toLowerCase(), " / ")
|
|
21407
|
+
: '', "month")) })), priceList.periodMonths > 1 && (jsxs(Text$b, __assign({ className: "bunny-text-center bunny-text-gray-900", style: { fontSize: isMobile ? '12px' : '11px' } }, { children: ["billed ", BillingPeriodConverter$1[periodMonthsConverter(priceList.periodMonths)]] })))] }));
|
|
21342
21408
|
};
|
|
21343
21409
|
|
|
21344
21410
|
var CheckIcon = function (_a) {
|
|
@@ -22203,17 +22269,9 @@ var SubscriptionCardHeader = function (_a) {
|
|
|
22203
22269
|
} }, { children: [jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-gap-2" }, { children: [((_c = subscription === null || subscription === void 0 ? void 0 : subscription.product) === null || _c === void 0 ? void 0 : _c.name) && (jsx(Text$7, __assign({ style: __assign({ fontSize: "11px", fontWeight: 500, color: brandColor }, subscriptionProductNameStyle) }, { children: (_d = subscription.product.name) === null || _d === void 0 ? void 0 : _d.toUpperCase() }))), jsxs("div", __assign({ className: "bunny-flex bunny-grow bunny-items-center bunny-gap-2" }, { children: [((_e = subscription === null || subscription === void 0 ? void 0 : subscription.plan) === null || _e === void 0 ? void 0 : _e.name) && jsx(Text$7, __assign({ className: "bunny-text-lg" }, { children: subscription.plan.name })), jsxs(CustomizedTag, __assign({ color: TAG_COLORS[(_f = subscription.state) === null || _f === void 0 ? void 0 : _f.toUpperCase()] }, { children: [lodashExports.capitalize(subscription.state.toLowerCase()), isTrial ? " (".concat(trialDaysLeft, " days left)") : ""] }))] }))] })), jsxs("div", __assign({ className: "bunny-flex bunny-items-center bunny-gap-6" }, { children: [jsx(Text$7, __assign({ className: "bunny-grow bunny-text-xs" }, { children: getSubscriptionStatusText(subscription) })), !isMobile && priceListChangeOptions && onChangePlanClick && onCancelSubscriptionClick && (jsx(SubscriptionCardActions, { onChangePlanClick: onChangePlanClick, onCancelSubscriptionClick: onCancelSubscriptionClick, priceListChangeOptions: priceListChangeOptions, subscription: subscription }))] }))] })));
|
|
22204
22270
|
};
|
|
22205
22271
|
|
|
22206
|
-
var BillingPeriodConverter;
|
|
22207
|
-
(function (BillingPeriodConverter) {
|
|
22208
|
-
BillingPeriodConverter["ONCE"] = "once";
|
|
22209
|
-
BillingPeriodConverter["MONTHLY"] = "monthly";
|
|
22210
|
-
BillingPeriodConverter["ANNUAL"] = "annually";
|
|
22211
|
-
BillingPeriodConverter["SEMI_ANNUAL"] = "semi annually";
|
|
22212
|
-
BillingPeriodConverter["QUARTERLY"] = "quarterly";
|
|
22213
|
-
})(BillingPeriodConverter || (BillingPeriodConverter = {}));
|
|
22214
22272
|
var SubscriptionChargeTotal = function (_a) {
|
|
22215
22273
|
var charge = _a.charge, subscription = _a.subscription;
|
|
22216
|
-
var billingPeriod = charge.billingPeriod && BillingPeriodConverter[charge.billingPeriod];
|
|
22274
|
+
var billingPeriod = charge.billingPeriod && BillingPeriodConverter$1[charge.billingPeriod];
|
|
22217
22275
|
var isMobile = useIsMobile();
|
|
22218
22276
|
var currencyId = subscription.currencyId;
|
|
22219
22277
|
var formattedDiscountedPrice = formatCurrency(charge.price, currencyId);
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { FormattedInvoice } from '@bunnyapp/common';
|
|
3
|
-
declare const InvoiceQuoteView: ({ children, formattedInvoice, html, backButtonName, onBackButtonClick, onDownloadError, }: {
|
|
3
|
+
declare const InvoiceQuoteView: ({ children, formattedInvoice, html, backButtonName, onBackButtonClick, onDownloadError, targetUrl, }: {
|
|
4
4
|
html: string;
|
|
5
5
|
children?: ReactNode;
|
|
6
6
|
formattedInvoice?: FormattedInvoice | undefined;
|
|
7
7
|
backButtonName?: string | undefined;
|
|
8
8
|
onBackButtonClick?: (() => void) | undefined;
|
|
9
9
|
onDownloadError?: (() => void) | undefined;
|
|
10
|
+
targetUrl?: string | undefined;
|
|
10
11
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
11
12
|
export default InvoiceQuoteView;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bunnyapp/components",
|
|
3
|
-
"version": "1.0.62-beta.
|
|
3
|
+
"version": "1.0.62-beta.5",
|
|
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.62-beta.
|
|
68
|
+
"@bunnyapp/common": "^1.0.62-beta.6",
|
|
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
|
+
"html-react-parser": "^5.2.5",
|
|
96
97
|
"msw-storybook-addon": "^2.0.4"
|
|
97
98
|
}
|
|
98
99
|
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Subscription } from '@bunnyapp/common';
|
|
2
|
-
declare const getPlanChangeOptions: ({ isInPreviewMode, token, upgradingSubscription, apiHost, }: {
|
|
3
|
-
isInPreviewMode?: boolean | undefined;
|
|
4
|
-
token?: string | undefined;
|
|
5
|
-
upgradingSubscription?: Subscription | undefined;
|
|
6
|
-
apiHost: string;
|
|
7
|
-
}) => Promise<any>;
|
|
8
|
-
export default getPlanChangeOptions;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Subscription } from '@bunnyapp/common';
|
|
2
|
-
declare const getPlanChangeOptions: ({ isInPreviewMode, token, upgradingSubscription, apiHost, }: {
|
|
3
|
-
isInPreviewMode?: boolean | undefined;
|
|
4
|
-
token?: string | undefined;
|
|
5
|
-
upgradingSubscription?: Subscription | undefined;
|
|
6
|
-
apiHost: string;
|
|
7
|
-
}) => Promise<any>;
|
|
8
|
-
export default getPlanChangeOptions;
|