@bunnyapp/components 1.0.50 → 1.0.52
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 +290 -394
- package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/PriceListGrid.d.ts +3 -3
- package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/PriceListSelector.d.ts +3 -3
- package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/planPickerDesktop/EverythingPlanFeatures.d.ts +3 -3
- package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/planPickerDesktop/PlanFeatures.d.ts +2 -3
- package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/planPickerDesktop/PriceListCardDesktop.d.ts +2 -3
- package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/planPickerDesktop/PriceListGridDesktop.d.ts +5 -4
- package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/planPickerMobile/PriceListCardMobile.d.ts +2 -3
- package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/planPickerMobile/PriceListGridMobile.d.ts +4 -4
- package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/planPickerUtils.d.ts +6 -6
- package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/PriceListCard.d.ts +2 -3
- package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/PriceListCardButton.d.ts +3 -3
- package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/PriceListCardFeature.d.ts +3 -3
- package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/PriceListCardPrice.d.ts +2 -3
- package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/PriceListCardPriceDescription.d.ts +2 -3
- package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/PriceListCardTitle.d.ts +3 -3
- package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/priceListCardUtils.d.ts +3 -3
- package/dist/cjs/src/components/Subscriptions/subscriptionsList/SubscriptionCardActions.d.ts +3 -3
- package/dist/cjs/src/components/Subscriptions/subscriptionsList/SubscriptionCardHeader.d.ts +3 -3
- package/dist/cjs/src/components/Subscriptions/subscriptionsList/SubscriptionsList.d.ts +3 -3
- package/dist/cjs/src/components/Subscriptions/subscriptionsList/subscriptionCardDesktop/SubscriptionCardDesktop.d.ts +3 -3
- package/dist/cjs/src/graphql/queries/getPriceListChangeOptions.d.ts +9 -0
- package/dist/esm/index.js +290 -394
- package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/PriceListGrid.d.ts +3 -3
- package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/PriceListSelector.d.ts +3 -3
- package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/planPickerDesktop/EverythingPlanFeatures.d.ts +3 -3
- package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/planPickerDesktop/PlanFeatures.d.ts +2 -3
- package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/planPickerDesktop/PriceListCardDesktop.d.ts +2 -3
- package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/planPickerDesktop/PriceListGridDesktop.d.ts +5 -4
- package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/planPickerMobile/PriceListCardMobile.d.ts +2 -3
- package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/planPickerMobile/PriceListGridMobile.d.ts +4 -4
- package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/planPickerUtils.d.ts +6 -6
- package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/PriceListCard.d.ts +2 -3
- package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/PriceListCardButton.d.ts +3 -3
- package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/PriceListCardFeature.d.ts +3 -3
- package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/PriceListCardPrice.d.ts +2 -3
- package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/PriceListCardPriceDescription.d.ts +2 -3
- package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/PriceListCardTitle.d.ts +3 -3
- package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/priceListCardUtils.d.ts +3 -3
- package/dist/esm/src/components/Subscriptions/subscriptionsList/SubscriptionCardActions.d.ts +3 -3
- package/dist/esm/src/components/Subscriptions/subscriptionsList/SubscriptionCardHeader.d.ts +3 -3
- package/dist/esm/src/components/Subscriptions/subscriptionsList/SubscriptionsList.d.ts +3 -3
- package/dist/esm/src/components/Subscriptions/subscriptionsList/subscriptionCardDesktop/SubscriptionCardDesktop.d.ts +3 -3
- package/dist/esm/src/graphql/queries/getPriceListChangeOptions.d.ts +9 -0
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -794,13 +794,13 @@ var PlusIcon = function (_a) {
|
|
|
794
794
|
return (jsxs("svg", __assign({ width: "14", height: "15", viewBox: "0 0 14 15", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: [jsx("path", { d: "M2.9165 7.5H11.0832", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), jsx("path", { d: "M7 3.41663V11.5833", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })] })));
|
|
795
795
|
};
|
|
796
796
|
|
|
797
|
-
var Text$
|
|
797
|
+
var Text$o = Typography.Text;
|
|
798
798
|
var CreditCard = function (_a) {
|
|
799
799
|
var _b;
|
|
800
800
|
var onClickRemove = _a.onClickRemove, onClickUpdate = _a.onClickUpdate, paymentMethodData = _a.paymentMethodData, _c = _a.shadow, shadow = _c === void 0 ? "shadow-md" : _c, _d = _a.cardEnabled, cardEnabled = _d === void 0 ? true : _d;
|
|
801
801
|
var isMobile = useIsMobile();
|
|
802
802
|
var Wrapper = cardEnabled ? Card : "div";
|
|
803
|
-
return (jsxs(Wrapper, __assign({ className: "".concat(cardEnabled ? shadow : "", " m-0") }, { children: [jsxs("div", __assign({ className: "flex items-center justify-between gap-4 p-4" }, { children: [jsxs("div", __assign({ className: "flex items-center gap-4" }, { children: [jsxs("div", __assign({ className: "flex items-center gap-2" }, { children: [jsx(CardImage, { paymentMethodData: paymentMethodData }), jsx(Text$
|
|
803
|
+
return (jsxs(Wrapper, __assign({ className: "".concat(cardEnabled ? shadow : "", " m-0") }, { children: [jsxs("div", __assign({ className: "flex items-center justify-between gap-4 p-4" }, { children: [jsxs("div", __assign({ className: "flex items-center gap-4" }, { children: [jsxs("div", __assign({ className: "flex items-center gap-2" }, { children: [jsx(CardImage, { paymentMethodData: paymentMethodData }), jsx(Text$o, { children: (_b = paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.metadata) === null || _b === void 0 ? void 0 : _b.identifier })] })), jsx(CustomizedTag, __assign({ color: isExpired(paymentMethodData) ? "red" : "green" }, { children: isExpired(paymentMethodData) ? "Expired" : "Valid" }))] })), !isMobile && (jsx(CardActions, { onClickRemove: onClickRemove, onClickUpdate: onClickUpdate }))] })), dayjs(paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.expirationDate).isValid() && (jsxs(Fragment, { children: [jsx(Divider, {}), jsxs("div", __assign({ className: "flex flex-col p-4" }, { children: [jsx(CardAttribute, { title: "EXPIRATION", value: expirationDate(paymentMethodData) }), isMobile && (jsx(CardActions, { onClickRemove: onClickRemove, onClickUpdate: onClickUpdate }))] }))] }))] })));
|
|
804
804
|
};
|
|
805
805
|
var MiniCreditCard = function (_a) {
|
|
806
806
|
var _b, _c;
|
|
@@ -815,7 +815,7 @@ var MiniCreditCard = function (_a) {
|
|
|
815
815
|
function capitalize(str) {
|
|
816
816
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
817
817
|
}
|
|
818
|
-
return (jsx("div", __assign({ className: "flex flex-row justify-between items-center p-1 px-3 border-solid ".concat(backgroundColor, " ").concat(borderColor, " rounded-md border") }, { children: paymentMethodData ? (jsxs(Fragment, { children: [jsx("div", __assign({ className: "flex flex-row gap-4" }, { children: jsxs("div", __assign({ className: "flex items-center gap-2 space-between w-full" }, { children: [jsx(CardImage, { paymentMethodData: paymentMethodData }), jsx(Text$
|
|
818
|
+
return (jsx("div", __assign({ className: "flex flex-row justify-between items-center p-1 px-3 border-solid ".concat(backgroundColor, " ").concat(borderColor, " rounded-md border") }, { children: paymentMethodData ? (jsxs(Fragment, { children: [jsx("div", __assign({ className: "flex flex-row gap-4" }, { children: jsxs("div", __assign({ className: "flex items-center gap-2 space-between w-full" }, { children: [jsx(CardImage, { paymentMethodData: paymentMethodData }), jsx(Text$o, { children: capitalize((_b = paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.metadata) === null || _b === void 0 ? void 0 : _b.issuer) }), jsxs("div", { children: [jsx(Text$o, __assign({ className: "relative -top-0.5" }, { children: "****" })), jsx(Text$o, { children: (_c = paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.metadata) === null || _c === void 0 ? void 0 : _c.identifier })] })] })) })), !hideRemoveButton && (jsx(Popconfirm, __assign({ title: "Remove card?", onConfirm: onClickRemove }, { children: jsx(Button, __assign({ className: "font-normal p-0", type: "link" }, { children: "Remove" })) })))] })) : (jsxs("div", __assign({ className: "flex flex-row gap-2 items-center" }, { children: [jsx(CreditCardOutlined, {}), jsx(Text$o, __assign({ className: "text-slate-400", style: { fontSize: "12px" } }, { children: "No payment method selected" })), jsx(Button, { disabled: true, type: "link" })] }))) })));
|
|
819
819
|
};
|
|
820
820
|
var CardImage = function (_a) {
|
|
821
821
|
var _b;
|
|
@@ -847,7 +847,7 @@ var CardImage = function (_a) {
|
|
|
847
847
|
};
|
|
848
848
|
var CardAttribute = function (_a) {
|
|
849
849
|
var title = _a.title, value = _a.value;
|
|
850
|
-
return (jsxs("div", __assign({ className: "flex flex-col gap-2" }, { children: [jsx("div", __assign({ className: "text-slate-400", style: { fontSize: "11px" } }, { children: title })), jsx(Text$
|
|
850
|
+
return (jsxs("div", __assign({ className: "flex flex-col gap-2" }, { children: [jsx("div", __assign({ className: "text-slate-400", style: { fontSize: "11px" } }, { children: title })), jsx(Text$o, { children: value })] })));
|
|
851
851
|
};
|
|
852
852
|
var CardActions = function (_a) {
|
|
853
853
|
var onClickRemove = _a.onClickRemove, onClickUpdate = _a.onClickUpdate;
|
|
@@ -1028,7 +1028,7 @@ function useSave$1(_a) {
|
|
|
1028
1028
|
return { save: save, isSaving: isSaving };
|
|
1029
1029
|
}
|
|
1030
1030
|
|
|
1031
|
-
var Text$
|
|
1031
|
+
var Text$n = Typography.Text;
|
|
1032
1032
|
var TEST_CARD = "4242424242424242";
|
|
1033
1033
|
var DemoPayForm = function (_a) {
|
|
1034
1034
|
var onFail = _a.onFail, onSavePaymentMethod = _a.onSavePaymentMethod, plugin = _a.plugin;
|
|
@@ -1089,7 +1089,7 @@ var DemoPayForm = function (_a) {
|
|
|
1089
1089
|
var onCardCvcChange = function (cvc) {
|
|
1090
1090
|
setCardDetails(__assign(__assign({}, cardDetails), { cvc: cvc }));
|
|
1091
1091
|
};
|
|
1092
|
-
return (jsxs("div", __assign({ className: "flex flex-col gap-2" }, { children: [jsxs(StyledInputs, __assign({ className: "flex flex-col gap-2", darkMode: darkMode !== null && darkMode !== void 0 ? darkMode : false }, { children: [jsx(DemoPayCardNumber, { onChange: onCardNumberChange, value: cardDetails.number }), jsxs("div", __assign({ className: "flex gap-2" }, { children: [jsx(DemoPayExpiry, { onChange: onCardExpiryChange, value: cardDetails.expiry }), jsx(DemoPayCardCvc, { onChange: onCardCvcChange, value: cardDetails.cvc })] }))] })), jsx(Text$
|
|
1092
|
+
return (jsxs("div", __assign({ className: "flex flex-col gap-2" }, { children: [jsxs(StyledInputs, __assign({ className: "flex flex-col gap-2", darkMode: darkMode !== null && darkMode !== void 0 ? darkMode : false }, { children: [jsx(DemoPayCardNumber, { onChange: onCardNumberChange, value: cardDetails.number }), jsxs("div", __assign({ className: "flex gap-2" }, { children: [jsx(DemoPayExpiry, { onChange: onCardExpiryChange, value: cardDetails.expiry }), jsx(DemoPayCardCvc, { onChange: onCardCvcChange, value: cardDetails.cvc })] }))] })), jsx(Text$n, { children: "DemoPay is for testing only." }), jsx(SavePaymentMethodFooter, { isSaving: isSaving, onSave: onSave })] })));
|
|
1093
1093
|
};
|
|
1094
1094
|
var StyledInputs = defaultStyled.div(templateObject_1$a || (templateObject_1$a = __makeTemplateObject(["\n .ant-input {\n background-color: ", " !important;\n }\n .ant-input:not(:focus) {\n border-color: ", " !important;\n }\n"], ["\n .ant-input {\n background-color: ", " !important;\n }\n .ant-input:not(:focus) {\n border-color: ", " !important;\n }\n"])), function (_a) {
|
|
1095
1095
|
var darkMode = _a.darkMode;
|
|
@@ -1331,7 +1331,7 @@ var CardIcon = function () {
|
|
|
1331
1331
|
return (jsxs("svg", __assign({ width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: [jsx("path", { d: "M15 3.75H3C2.17157 3.75 1.5 4.42157 1.5 5.25V12.75C1.5 13.5784 2.17157 14.25 3 14.25H15C15.8284 14.25 16.5 13.5784 16.5 12.75V5.25C16.5 4.42157 15.8284 3.75 15 3.75Z", stroke: SLATE_400, strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), jsx("path", { d: "M1.5 7.5H16.5", stroke: SLATE_400, strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })] })));
|
|
1332
1332
|
};
|
|
1333
1333
|
|
|
1334
|
-
var Text$
|
|
1334
|
+
var Text$m = Typography.Text;
|
|
1335
1335
|
var PaymentMethodSelector = function (_a) {
|
|
1336
1336
|
var paymentMethodAllowedPlugins = _a.paymentMethodAllowedPlugins, onSelect = _a.onSelect, value = _a.value;
|
|
1337
1337
|
return (jsx("div", __assign({ className: "flex flex-col gap-2" }, { children: paymentMethodAllowedPlugins === null || paymentMethodAllowedPlugins === void 0 ? void 0 : paymentMethodAllowedPlugins.map(function (plugin, index) { return (jsx(PaymentOption, { name: plugin.name, onClick: onSelect, paymentPlugin: plugin, selected: (value === null || value === void 0 ? void 0 : value.id) === plugin.id }, index)); }) })));
|
|
@@ -1344,7 +1344,7 @@ var PaymentOption = function (_a) {
|
|
|
1344
1344
|
var isCard = name === null || name === void 0 ? void 0 : name.toLowerCase().includes("card");
|
|
1345
1345
|
return (jsxs(PaymentOptionContainer, __assign({ "$brandColor": brandColor, "$selected": selected, className: "flex justify-between items-center w-full cursor-pointer py-2 px-4 rounded border-solid ".concat(darkMode
|
|
1346
1346
|
? "var(--row-background-dark) border-gray-500"
|
|
1347
|
-
: "bg-slate-50 border-slate-200", " border"), onClick: function () { return onClick(paymentPlugin); } }, { children: [jsxs("div", __assign({ className: "flex gap-2 items-center" }, { children: [jsx(Checkbox, { checked: selected, className: darkMode ? "border-gray-400" : "" }), jsx(Text$
|
|
1347
|
+
: "bg-slate-50 border-slate-200", " border"), onClick: function () { return onClick(paymentPlugin); } }, { children: [jsxs("div", __assign({ className: "flex gap-2 items-center" }, { children: [jsx(Checkbox, { checked: selected, className: darkMode ? "border-gray-400" : "" }), jsx(Text$m, { children: name })] })), isAch ? (jsx(BankOutlined, { className: "text-slate-400" })) : isCard ? (jsx(CardIcon, {})) : (jsx(CardIcon, {}))] })));
|
|
1348
1348
|
};
|
|
1349
1349
|
var PaymentOptionContainer = defaultStyled.div(templateObject_1$9 || (templateObject_1$9 = __makeTemplateObject(["\n transition: border 0.3s ease;\n\n ", "\n\n &:hover {\n border-color: ", ";\n }\n"], ["\n transition: border 0.3s ease;\n\n ", "\n\n &:hover {\n border-color: ", ";\n }\n"])), function (_a) {
|
|
1350
1350
|
var $brandColor = _a.$brandColor, $selected = _a.$selected;
|
|
@@ -1810,7 +1810,7 @@ var AcceptQuoteModal = function (_a) {
|
|
|
1810
1810
|
}, open: acceptBoxVisible, title: "Accept quote", width: 400 }, { children: jsxs(Form, __assign({ className: "flex flex-col 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, {}) })))] })) })));
|
|
1811
1811
|
};
|
|
1812
1812
|
|
|
1813
|
-
var Text$
|
|
1813
|
+
var Text$l = Typography.Text;
|
|
1814
1814
|
defaultStyled.div(templateObject_1$7 || (templateObject_1$7 = __makeTemplateObject(["\n span {\n width: 100%;\n }\n"], ["\n span {\n width: 100%;\n }\n"])));
|
|
1815
1815
|
function Quote(_a) {
|
|
1816
1816
|
var id = _a.id, invoiceQuoteViewComponent = _a.invoiceQuoteViewComponent, onInvoiceDownloadError = _a.onInvoiceDownloadError, onPaymentSuccess = _a.onPaymentSuccess, _b = _a.shadow, shadow = _b === void 0 ? "shadow-md" : _b, className = _a.className, _c = _a.hideDownloadButton, hideDownloadButton = _c === void 0 ? false : _c, onQuoteLoaded = _a.onQuoteLoaded;
|
|
@@ -1879,7 +1879,7 @@ function ActualQuote() {
|
|
|
1879
1879
|
var isAccepted = formattedQuote.state === "ACCEPTED";
|
|
1880
1880
|
return (jsxs(Fragment, { children: [jsxs("div", __assign({ className: "flex flex-col gap-4 ".concat(isMobile ? "w-full overflow-hidden" : "bunny-shadow-padding-xb", " ").concat(className) }, { children: [jsxs("div", __assign({ className: "flex flex-row justify-end items-center gap-4", id: "acceptance", style: {
|
|
1881
1881
|
color: entityBranding.secondaryColor,
|
|
1882
|
-
} }, { children: [isAccepted && formattedQuote.acceptedAt ? (jsx(Text$
|
|
1882
|
+
} }, { children: [isAccepted && formattedQuote.acceptedAt ? (jsx(Text$l, { children: "Quote was accepted by ".concat(formattedQuote.acceptedByName, " on ").concat(formatDate(formattedQuote.acceptedAt)) })) : null, (!isMobile || !isAccepted) && (jsxs("div", __assign({ className: isMobile
|
|
1883
1883
|
? "flex w-full justify-end gap-2"
|
|
1884
1884
|
: "flex items-center justify-end gap-2" }, { children: [!isMobile && !hideDownloadButton ? (jsx(Button, __assign({ icon: jsx(DownloadOutlined, {}), onClick: function () {
|
|
1885
1885
|
return downloadFile(apiHost + "/api/pdf/quote", token);
|
|
@@ -19185,10 +19185,10 @@ var getColor = function (state) {
|
|
|
19185
19185
|
}
|
|
19186
19186
|
};
|
|
19187
19187
|
|
|
19188
|
-
var Text$
|
|
19188
|
+
var Text$k = Typography.Text;
|
|
19189
19189
|
var TransactionDate = function (_a) {
|
|
19190
19190
|
var date = _a.date;
|
|
19191
|
-
return jsx(Text$
|
|
19191
|
+
return jsx(Text$k, __assign({ className: "text-sm" }, { children: formatDate(date) }));
|
|
19192
19192
|
};
|
|
19193
19193
|
|
|
19194
19194
|
var ArrowDownToLine = function (_a) {
|
|
@@ -19225,10 +19225,10 @@ var TransactionGridCell = defaultStyled.div.withConfig({
|
|
|
19225
19225
|
}, SLATE_600);
|
|
19226
19226
|
var templateObject_1$6;
|
|
19227
19227
|
|
|
19228
|
-
var Text$
|
|
19228
|
+
var Text$j = Typography.Text;
|
|
19229
19229
|
var TransactionsEmptyState = function () {
|
|
19230
19230
|
var noTransactionsMessage = useContext(TransactionsListContext).noTransactionsMessage;
|
|
19231
|
-
return (jsx(Text$
|
|
19231
|
+
return (jsx(Text$j, __assign({ className: "flex justify-center p-4 text-base" }, { children: noTransactionsMessage || "There are no transactions" })));
|
|
19232
19232
|
};
|
|
19233
19233
|
|
|
19234
19234
|
var isInvoice = function (transaction) {
|
|
@@ -19261,7 +19261,7 @@ function transactionDateToDisplay(transaction, transactionDateType) {
|
|
|
19261
19261
|
}
|
|
19262
19262
|
}
|
|
19263
19263
|
|
|
19264
|
-
var Text$
|
|
19264
|
+
var Text$i = Typography.Text;
|
|
19265
19265
|
var TransactionsListDesktop = function (_a) {
|
|
19266
19266
|
var transactions = _a.transactions, onTransactionClick = _a.onTransactionClick;
|
|
19267
19267
|
var _b = useContext(TransactionsListContext), columns = _b.columns, transactionDateType = _b.transactionDateType;
|
|
@@ -19290,11 +19290,11 @@ var TransactionsListDesktop = function (_a) {
|
|
|
19290
19290
|
!showState &&
|
|
19291
19291
|
!showAmount &&
|
|
19292
19292
|
!showDownload &&
|
|
19293
|
-
!showAccountName && (jsx(TransactionGridCell, { children: jsx(Text$
|
|
19293
|
+
!showAccountName && (jsx(TransactionGridCell, { children: jsx(Text$i, { children: "No columns selected" }) })), showDate && (jsx(TransactionGridCell, __assign({ right: false }, { children: jsx(TransactionDate, { date: transactionDateToDisplay(transaction, transactionDateType) }) }))), showTitle && (jsx(Fragment, { children: jsxs(TransactionGridCell, __assign({ right: false, className: "flex items-center gap-2" }, { children: [jsx(Text$i, { children: lodashExports.capitalize(transaction.kind.toLowerCase()) }), jsx(TransactionRowTitle, { transaction: transaction })] })) })), showAccountName && (jsx(TransactionGridCell, __assign({ right: false }, { children: jsx(Text$i, { children: (_a = transaction.account) === null || _a === void 0 ? void 0 : _a.name }) }))), !showDate && !showTitle && !showAccountName && (jsx(TransactionGridCell, { right: false })), showDownload && (jsx(TransactionGridCell, { children: jsx(TransactionDownload, { transaction: transaction, token: token, apiHost: apiHost }) })), showState ? (jsx(TransactionGridCell, __assign({ right: true }, { children: jsx(StateTag, { state: transaction.state }) }))) : null, showAmount && (jsx(TransactionGridCell, __assign({ right: true }, { children: jsx(Text$i, { children: formatCurrency(((_b = transaction === null || transaction === void 0 ? void 0 : transaction.transactionable) === null || _b === void 0 ? void 0 : _b.amount) || transaction.amount, transaction.currencyId) }) })))] }), index));
|
|
19294
19294
|
}) }));
|
|
19295
19295
|
};
|
|
19296
19296
|
|
|
19297
|
-
var Text$
|
|
19297
|
+
var Text$h = Typography.Text;
|
|
19298
19298
|
var TransactionsListMobile = function (_a) {
|
|
19299
19299
|
var transactions = _a.transactions, onTransactionClick = _a.onTransactionClick;
|
|
19300
19300
|
var _b = useContext(TransactionsListContext), columns = _b.columns, transactionDateType = _b.transactionDateType;
|
|
@@ -19317,12 +19317,12 @@ var TransactionsListMobile = function (_a) {
|
|
|
19317
19317
|
backgroundColor: index % 2 === 0
|
|
19318
19318
|
? "var(--row-background".concat(darkMode ? "-dark" : "", ")")
|
|
19319
19319
|
: "var(--row-background-alternate".concat(darkMode ? "-dark" : "", ")"),
|
|
19320
|
-
} }, { children: [jsx(TransactionGridCell, { children: jsxs("div", __assign({ className: "flex flex-col gap-2" }, { children: [(showTitle || showState) && (jsxs("div", __assign({ className: "flex items-center gap-2" }, { children: [showTitle && (jsxs(Fragment, { children: [jsx(Text$
|
|
19320
|
+
} }, { children: [jsx(TransactionGridCell, { children: jsxs("div", __assign({ className: "flex flex-col gap-2" }, { children: [(showTitle || showState) && (jsxs("div", __assign({ className: "flex items-center gap-2" }, { children: [showTitle && (jsxs(Fragment, { children: [jsx(Text$h, { children: lodashExports.capitalize(transaction.kind.toLowerCase()) }), jsx(TransactionRowTitle, { transaction: transaction })] })), showState && jsx(StateTag, { state: transaction.state })] }))), jsxs("div", __assign({ className: "flex items-center gap-2" }, { children: [showAccountName && jsx(Text$h, { children: (_a = transaction.account) === null || _a === void 0 ? void 0 : _a.name }), showAccountName && showDate && jsx(Text$h, { children: "\u00B7" }), showDate && (jsx(TransactionDate, { date: transactionDateToDisplay(transaction, transactionDateType) })), showDate && showAmount && jsx(Text$h, { children: "\u00B7" }), showAmount && (jsx(Text$h, { children: formatCurrency(transaction.transactionable.amount ||
|
|
19321
19321
|
transaction.amount, transaction.currencyId) }))] }))] })) }), showDownload && (jsx(TransactionGridCell, __assign({ right: true }, { children: jsx(TransactionDownload, { transaction: transaction, token: token, apiHost: apiHost }) })))] }), index));
|
|
19322
19322
|
}) }));
|
|
19323
19323
|
};
|
|
19324
19324
|
|
|
19325
|
-
var Text$
|
|
19325
|
+
var Text$g = Typography.Text;
|
|
19326
19326
|
var DISPLAY_WIDTH = 1200;
|
|
19327
19327
|
function Transactions(_a) {
|
|
19328
19328
|
var transactionComponent = _a.transactionComponent, _b = _a.showSearchBar, showSearchBar = _b === void 0 ? true : _b, _c = _a.showTitle, showTitle = _c === void 0 ? true : _c, _d = _a.title, title = _d === void 0 ? "Past transactions" : _d, _e = _a.columns, columns = _e === void 0 ? ["date", "title", "state", "amount", "download"] : _e, className = _a.className, _f = _a.shadow, shadow = _f === void 0 ? "shadow-md" : _f, searchBarClassName = _a.searchBarClassName, _g = _a.useModal, useModal = _g === void 0 ? false : _g, onTransactionClick = _a.onTransactionClick, _h = _a.suppressTransactionDisplay, suppressTransactionDisplay = _h === void 0 ? false : _h, _j = _a.kindsToShow, kindsToShow = _j === void 0 ? [
|
|
@@ -19435,7 +19435,7 @@ function TransactionsDisplay(_a) {
|
|
|
19435
19435
|
onTransactionDisplayClose === null || onTransactionDisplayClose === void 0 ? void 0 : onTransactionDisplayClose(selectedTransaction);
|
|
19436
19436
|
setDrawerOpen(false);
|
|
19437
19437
|
}
|
|
19438
|
-
return (jsxs("div", __assign({ style: style }, { children: [jsxs("div", __assign({ className: "flex flex-col w-full bunny-shadow-padding-xb gap-2 ".concat(isMobile ? "overflow-hidden" : "", " ").concat(className) }, { children: [showTitle || showSearchBar ? (jsxs("div", __assign({ className: "flex ".concat(isMobile ? "flex-col gap-1" : "flex-row items-center", " justify-between") }, { children: [showTitle ? (jsx(Text$
|
|
19438
|
+
return (jsxs("div", __assign({ style: style }, { children: [jsxs("div", __assign({ className: "flex flex-col w-full bunny-shadow-padding-xb gap-2 ".concat(isMobile ? "overflow-hidden" : "", " ").concat(className) }, { children: [showTitle || showSearchBar ? (jsxs("div", __assign({ className: "flex ".concat(isMobile ? "flex-col gap-1" : "flex-row items-center", " justify-between") }, { children: [showTitle ? (jsx(Text$g, __assign({ className: "shrink-0 font-medium", style: { color: darkMode ? undefined : secondaryColor } }, { children: title }))) : (jsx("div", {}) // Empty div so justify-between works
|
|
19439
19439
|
), showSearchBar && (jsx("div", __assign({ className: "".concat(isMobile ? "w-full" : "") }, { children: jsx(Input, { className: searchBarClassName
|
|
19440
19440
|
? searchBarClassName
|
|
19441
19441
|
: "border border-slate-200", onChange: function (e) {
|
|
@@ -19580,10 +19580,10 @@ var getBillingDetails = function (_a) {
|
|
|
19580
19580
|
});
|
|
19581
19581
|
};
|
|
19582
19582
|
|
|
19583
|
-
var Text$
|
|
19583
|
+
var Text$f = Typography.Text;
|
|
19584
19584
|
var DrawerHeader = function (_a) {
|
|
19585
19585
|
var description = _a.description, onClose = _a.onClose, title = _a.title, closeButtonClassName = _a.closeButtonClassName;
|
|
19586
|
-
return (jsxs("div", __assign({ className: "flex flex-col gap-4" }, { children: [jsxs("div", __assign({ className: "flex items-center justify-between gap-2" }, { children: [jsx(Text$
|
|
19586
|
+
return (jsxs("div", __assign({ className: "flex flex-col gap-4" }, { children: [jsxs("div", __assign({ className: "flex items-center justify-between gap-2" }, { children: [jsx(Text$f, __assign({ className: "text-xl", style: { fontWeight: 400 } }, { children: title })), onClose ? (jsx("button", __assign({ id: "closePayment", onClick: onClose, className: closeButtonClassName }, { children: jsx(CloseOutlined, {}) }))) : null] })), description && jsx("div", __assign({ className: "text-xs" }, { children: description }))] })));
|
|
19587
19587
|
};
|
|
19588
19588
|
|
|
19589
19589
|
var PaymentMethod = function (_a) {
|
|
@@ -19758,18 +19758,18 @@ function InitialSignupForm(_a) {
|
|
|
19758
19758
|
] }, { children: jsx(Input, { placeholder: "Company name" }) }))] })), jsx(Form.Item, { children: jsx(Button, __assign({ type: "primary", onClick: handleSubmit, loading: submitting, className: "w-full mt-4" }, { children: "Proceed to payment" })) })] })));
|
|
19759
19759
|
}
|
|
19760
19760
|
|
|
19761
|
-
var Title = Typography.Title, Text$
|
|
19761
|
+
var Title = Typography.Title, Text$e = Typography.Text;
|
|
19762
19762
|
function PaymentSuccessDisplay(_a) {
|
|
19763
19763
|
var amountPaid = _a.amountPaid, className = _a.className, companyName = _a.companyName, returnUrl = _a.returnUrl, style = _a.style, currencyId = _a.currencyId;
|
|
19764
|
-
return (jsxs("div", __assign({ className: "flex flex-col items-center justify-center h-full ".concat(className), style: style }, { children: [jsx(CheckCircleFilled, { style: { fontSize: "48px", color: "rgb(52 211 153)" } }), jsxs(Title, __assign({ level: 3, className: "mt-2 m-0" }, { children: ["Payment of ", formatCurrency(amountPaid, currencyId), " successful"] })), returnUrl && (jsxs(Text$
|
|
19764
|
+
return (jsxs("div", __assign({ className: "flex flex-col items-center justify-center h-full ".concat(className), style: style }, { children: [jsx(CheckCircleFilled, { style: { fontSize: "48px", color: "rgb(52 211 153)" } }), jsxs(Title, __assign({ level: 3, className: "mt-2 m-0" }, { children: ["Payment of ", formatCurrency(amountPaid, currencyId), " successful"] })), returnUrl && (jsxs(Text$e, __assign({ className: "text-slate-500 cursor-pointer underline", onClick: function () { return (window.location.href = returnUrl); } }, { children: ["Back to ", companyName] })))] })));
|
|
19765
19765
|
}
|
|
19766
19766
|
|
|
19767
|
-
var Text$
|
|
19767
|
+
var Text$d = Typography.Text;
|
|
19768
19768
|
function PriceListDisplay(_a) {
|
|
19769
19769
|
var priceListData = _a.priceListData, topNavImageUrl = _a.topNavImageUrl;
|
|
19770
19770
|
if (!priceListData)
|
|
19771
19771
|
return null;
|
|
19772
|
-
return (jsx(Fragment, { children: jsx("div", __assign({ className: "flex flex-col justify-between h-full my-12" }, { children: jsxs("div", __assign({ className: "flex flex-col space-y-8" }, { children: [jsx(Image, { width: 24, src: topNavImageUrl, alt: "Logo", preview: false }), jsxs("div", __assign({ className: "flex flex-col" }, { children: [jsx(Text$
|
|
19772
|
+
return (jsx(Fragment, { children: jsx("div", __assign({ className: "flex flex-col justify-between h-full my-12" }, { children: jsxs("div", __assign({ className: "flex flex-col space-y-8" }, { children: [jsx(Image, { width: 24, src: topNavImageUrl, alt: "Logo", preview: false }), jsxs("div", __assign({ className: "flex flex-col" }, { children: [jsx(Text$d, __assign({ className: "text-slate-500 font-bold text-lg" }, { children: priceListData.name })), jsxs(Text$d, __assign({ className: "font-bold text-xl" }, { children: [formatCurrency(priceListData.basePrice, priceListData.currencyId), " ", "/ month"] }))] })), priceListData.trialAllowed ? (jsxs("div", __assign({ className: "flex flex-col" }, { children: [jsxs(Text$d, __assign({ style: { fontSize: "16px" }, className: "text-slate-500" }, { children: [priceListData.trialLengthDays, " day trial"] })), jsx(Text$d, __assign({ className: "text-slate-500", style: { fontSize: "12px" } }, { children: "You will not be charged until the last day of the trial." }))] }))) : null] })) })) }));
|
|
19773
19773
|
}
|
|
19774
19774
|
|
|
19775
19775
|
var showErrorNotification = useErrorNotification();
|
|
@@ -20480,13 +20480,13 @@ var billingPeriodConverter = function (period) {
|
|
|
20480
20480
|
|
|
20481
20481
|
var removeHTMLTagsRegex = /<br>(?=(?:\s*<[^>]*>)*$)|(<br>)|<[^>]*>/gi;
|
|
20482
20482
|
// Description is a string that can contain HTML tags. We want to remove all HTML tags except <br> tags.
|
|
20483
|
-
var createPlanDescription = function (
|
|
20484
|
-
return (plan.description || "").replace(removeHTMLTagsRegex, function (x, y) {
|
|
20483
|
+
var createPlanDescription = function (priceList) {
|
|
20484
|
+
return (priceList.plan.description || "").replace(removeHTMLTagsRegex, function (x, y) {
|
|
20485
20485
|
return y ? " & " : "";
|
|
20486
20486
|
});
|
|
20487
20487
|
};
|
|
20488
|
-
var getActivePlanPriceData = function (
|
|
20489
|
-
if (!
|
|
20488
|
+
var getActivePlanPriceData = function (priceList, selectedPriceList) {
|
|
20489
|
+
if (!priceList) {
|
|
20490
20490
|
return;
|
|
20491
20491
|
}
|
|
20492
20492
|
// If a period option is selected, return the charge that matches the selected period option
|
|
@@ -20494,33 +20494,28 @@ var getActivePlanPriceData = function (plan, selectedPriceList) {
|
|
|
20494
20494
|
// Default to first price list charge
|
|
20495
20495
|
var lowestPLCharge;
|
|
20496
20496
|
// Find the lowest price list charge with a billing period that matches the selected period option
|
|
20497
|
-
|
|
20498
|
-
|
|
20499
|
-
|
|
20500
|
-
|
|
20501
|
-
|
|
20502
|
-
|
|
20503
|
-
|
|
20504
|
-
|
|
20505
|
-
if
|
|
20506
|
-
|
|
20507
|
-
|
|
20508
|
-
// If we already found a charge with the same billing period check if this charge is lower
|
|
20509
|
-
if (charge.basePrice < activeBillingPLCharge.basePrice &&
|
|
20510
|
-
charge.billingPeriod === (activeBillingPLCharge === null || activeBillingPLCharge === void 0 ? void 0 : activeBillingPLCharge.billingPeriod)) {
|
|
20511
|
-
activeBillingPLCharge = charge;
|
|
20512
|
-
}
|
|
20513
|
-
}
|
|
20514
|
-
// If a period option is selected, only return the charge if it matches the selected period option
|
|
20515
|
-
else if (selectedPriceList &&
|
|
20516
|
-
charge.billingPeriod ===
|
|
20517
|
-
periodMonthsConverter(selectedPriceList.periodMonths)) {
|
|
20497
|
+
if (priceList.id === (selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id)) {
|
|
20498
|
+
activeBillingPLCharge = priceList.charges[0];
|
|
20499
|
+
}
|
|
20500
|
+
for (var j = 0; j < priceList.charges.length; j++) {
|
|
20501
|
+
var charge = priceList.charges[j];
|
|
20502
|
+
if (charge.chargeType === ChargeType.USAGE)
|
|
20503
|
+
continue;
|
|
20504
|
+
if (activeBillingPLCharge) {
|
|
20505
|
+
// If we already found a charge with the same billing period check if this charge is lower
|
|
20506
|
+
if (charge.basePrice < activeBillingPLCharge.basePrice &&
|
|
20507
|
+
charge.billingPeriod === (activeBillingPLCharge === null || activeBillingPLCharge === void 0 ? void 0 : activeBillingPLCharge.billingPeriod)) {
|
|
20518
20508
|
activeBillingPLCharge = charge;
|
|
20519
20509
|
}
|
|
20520
|
-
|
|
20521
|
-
|
|
20522
|
-
|
|
20523
|
-
|
|
20510
|
+
}
|
|
20511
|
+
// If a period option is selected, only return the charge if it matches the selected period option
|
|
20512
|
+
else if (selectedPriceList &&
|
|
20513
|
+
charge.billingPeriod === periodMonthsConverter(selectedPriceList.periodMonths)) {
|
|
20514
|
+
activeBillingPLCharge = charge;
|
|
20515
|
+
}
|
|
20516
|
+
// Otherwise, return the lowest price list charge
|
|
20517
|
+
else if (charge.basePrice < ((lowestPLCharge === null || lowestPLCharge === void 0 ? void 0 : lowestPLCharge.basePrice) || -1)) {
|
|
20518
|
+
lowestPLCharge = charge;
|
|
20524
20519
|
}
|
|
20525
20520
|
}
|
|
20526
20521
|
return {
|
|
@@ -20540,8 +20535,7 @@ var isPriceListDisabled = function (_a) {
|
|
|
20540
20535
|
var isPriceListCurrentSubscription = (upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.priceList.id) === priceList.id;
|
|
20541
20536
|
// Is this plan the one that the user is upgrading from
|
|
20542
20537
|
var isUpgradingPlan = (upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.plan.id) === priceList.plan.id;
|
|
20543
|
-
if ((subscriptionPlan && !isUpgradingPlan) ||
|
|
20544
|
-
isPriceListCurrentSubscription) {
|
|
20538
|
+
if ((subscriptionPlan && !isUpgradingPlan) || isPriceListCurrentSubscription) {
|
|
20545
20539
|
disableOnClick = true;
|
|
20546
20540
|
}
|
|
20547
20541
|
return disableOnClick;
|
|
@@ -20566,7 +20560,7 @@ var CheckoutPrice = function (_a) {
|
|
|
20566
20560
|
};
|
|
20567
20561
|
|
|
20568
20562
|
var CheckoutBarSummarySection = function (_a) {
|
|
20569
|
-
var _b
|
|
20563
|
+
var _b;
|
|
20570
20564
|
var open = _a.open, quantityLocal = _a.quantityLocal, quote = _a.quote, selectedPriceList = _a.selectedPriceList, onClickCheckout = _a.onClickCheckout, upgradingSubscription = _a.upgradingSubscription, quotePreviewData = _a.quotePreviewData;
|
|
20571
20565
|
// Context
|
|
20572
20566
|
var apiHost = useContext(BunnyContext).apiHost;
|
|
@@ -20591,12 +20585,7 @@ var CheckoutBarSummarySection = function (_a) {
|
|
|
20591
20585
|
isFetching ||
|
|
20592
20586
|
selectedPriceList.id === (upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.priceList.id) ||
|
|
20593
20587
|
open);
|
|
20594
|
-
var
|
|
20595
|
-
subscriptionId: upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.id,
|
|
20596
|
-
token: token,
|
|
20597
|
-
}));
|
|
20598
|
-
var selectedPlan = (_b = planChangeOptions === null || planChangeOptions === void 0 ? void 0 : planChangeOptions.plans) === null || _b === void 0 ? void 0 : _b.find(function (plan) { return plan.id === (selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.plan.id); });
|
|
20599
|
-
var activeCharge = (_c = getActivePlanPriceData(selectedPlan, selectedPriceList)) === null || _c === void 0 ? void 0 : _c.activeCharge;
|
|
20588
|
+
var activeCharge = (_b = getActivePlanPriceData(selectedPriceList, selectedPriceList)) === null || _b === void 0 ? void 0 : _b.activeCharge;
|
|
20600
20589
|
var isUsage = (activeCharge === null || activeCharge === void 0 ? void 0 : activeCharge.chargeType) === ChargeType.USAGE;
|
|
20601
20590
|
var hasPaymentMethodsOrIsFree = Boolean(paymentMethodAllowedPlugins === null || paymentMethodAllowedPlugins === void 0 ? void 0 : paymentMethodAllowedPlugins.length) ||
|
|
20602
20591
|
Boolean(quote && getQuoteAmountDue(quote) === 0);
|
|
@@ -20738,64 +20727,35 @@ var PlanPickerCheckoutBar = function (_a) {
|
|
|
20738
20727
|
};
|
|
20739
20728
|
|
|
20740
20729
|
// WARNING: There is a preview button on APP that will need to be changed if this query is changed
|
|
20741
|
-
var
|
|
20742
|
-
var
|
|
20743
|
-
var isInPreviewMode = _a.isInPreviewMode,
|
|
20730
|
+
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 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 currencyId\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 }";
|
|
20731
|
+
var getPriceListChangeOptions = function (_a) {
|
|
20732
|
+
var apiHost = _a.apiHost, isInPreviewMode = _a.isInPreviewMode, productId = _a.productId, token = _a.token, upgradingSubscription = _a.upgradingSubscription;
|
|
20744
20733
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
20745
|
-
var response,
|
|
20734
|
+
var response, priceListChangeOptions;
|
|
20746
20735
|
return __generator(this, function (_b) {
|
|
20747
20736
|
switch (_b.label) {
|
|
20748
20737
|
case 0: return [4 /*yield*/, gqlRequest({
|
|
20749
20738
|
isInPreviewMode: isInPreviewMode,
|
|
20750
|
-
query:
|
|
20751
|
-
vars: { subscriptionId: upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.id },
|
|
20739
|
+
query: PRICE_LIST_CHANGE_OPTIONS_QUERY,
|
|
20740
|
+
vars: { subscriptionId: upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.id, productId: productId },
|
|
20752
20741
|
token: token,
|
|
20753
20742
|
apiHost: apiHost,
|
|
20754
20743
|
})];
|
|
20755
20744
|
case 1:
|
|
20756
20745
|
response = _b.sent();
|
|
20757
|
-
|
|
20758
|
-
if (
|
|
20759
|
-
throw
|
|
20746
|
+
priceListChangeOptions = response;
|
|
20747
|
+
if (priceListChangeOptions === null || priceListChangeOptions === void 0 ? void 0 : priceListChangeOptions.errors)
|
|
20748
|
+
throw priceListChangeOptions.errors;
|
|
20760
20749
|
// Sort planChangeOptions.plans by position
|
|
20761
|
-
if (
|
|
20762
|
-
|
|
20750
|
+
if (priceListChangeOptions === null || priceListChangeOptions === void 0 ? void 0 : priceListChangeOptions.priceLists) {
|
|
20751
|
+
priceListChangeOptions.priceLists.sort(function (a, b) { return a.plan.position - b.plan.position; });
|
|
20763
20752
|
}
|
|
20764
|
-
return [2 /*return*/,
|
|
20753
|
+
return [2 /*return*/, priceListChangeOptions];
|
|
20765
20754
|
}
|
|
20766
20755
|
});
|
|
20767
20756
|
});
|
|
20768
20757
|
};
|
|
20769
20758
|
|
|
20770
|
-
var portalPreviewQuery = function (id) { return "\nquery portalPreviewQuery {\n product(id: ".concat(id, ") {\n everythingInPlus\n id\n name\n features(sort: \"position asc\") {\n description\n id\n isVisible\n kind\n name\n position\n }\n }\n plans(filter: \"plan.productId is ").concat(id, "\") {\n nodes {\n\t\t\tcode\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 priceLists {\n basePrice\n id\n currencyId\n periodMonths\n plan {\n id\n position\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 }\n}"); };
|
|
20771
|
-
var getPortalPreviewData = function (id, apiHost, token) { return __awaiter(void 0, void 0, void 0, function () {
|
|
20772
|
-
var response;
|
|
20773
|
-
return __generator(this, function (_a) {
|
|
20774
|
-
switch (_a.label) {
|
|
20775
|
-
case 0: return [4 /*yield*/, gqlRequest({
|
|
20776
|
-
isInPreviewMode: true,
|
|
20777
|
-
query: portalPreviewQuery(id),
|
|
20778
|
-
token: token || "",
|
|
20779
|
-
apiHost: apiHost,
|
|
20780
|
-
})];
|
|
20781
|
-
case 1:
|
|
20782
|
-
response = _a.sent();
|
|
20783
|
-
if (response.product && response.plans) {
|
|
20784
|
-
response.plans = response.plans.nodes;
|
|
20785
|
-
response.products = [response.product];
|
|
20786
|
-
delete response.product;
|
|
20787
|
-
// Sort plans by position
|
|
20788
|
-
if (response.plans) {
|
|
20789
|
-
response.plans.sort(function (a, b) { return a.position - b.position; });
|
|
20790
|
-
}
|
|
20791
|
-
return [2 /*return*/, response];
|
|
20792
|
-
}
|
|
20793
|
-
else
|
|
20794
|
-
throw response;
|
|
20795
|
-
}
|
|
20796
|
-
});
|
|
20797
|
-
}); };
|
|
20798
|
-
|
|
20799
20759
|
var ErrorView = function (_a) {
|
|
20800
20760
|
var children = _a.children, message = _a.message;
|
|
20801
20761
|
return (jsxs("div", __assign({ className: "flex flex-col w-full", style: { marginTop: "80px" } }, { children: [jsx("div", __assign({ style: { fontSize: "32px" } }, { children: message })), children] })));
|
|
@@ -20832,105 +20792,57 @@ var StyledRadioGroup = styled.div(templateObject_2 || (templateObject_2 = __make
|
|
|
20832
20792
|
});
|
|
20833
20793
|
var templateObject_1$4, templateObject_2;
|
|
20834
20794
|
|
|
20835
|
-
var NextPriceListButton = function (_a) {
|
|
20836
|
-
var availablePriceLists = _a.availablePriceLists, priceListStart = _a.priceListStart, setPriceListStart = _a.setPriceListStart;
|
|
20837
|
-
return (jsxs("div", __assign({ className: "absolute flex gap-1", style: { top: "12px", right: "8px", zIndex: 10 } }, { children: [priceListStart > 0 && (jsx("div", __assign({ className: "flex items-center justify-center rounded-full shadow p-1 cursor-pointer", onClick: function () {
|
|
20838
|
-
setPriceListStart(function (prev) {
|
|
20839
|
-
var newValue = prev - 1;
|
|
20840
|
-
if (newValue < 0) {
|
|
20841
|
-
return prev;
|
|
20842
|
-
}
|
|
20843
|
-
return newValue;
|
|
20844
|
-
});
|
|
20845
|
-
}, style: { width: "22px", height: "22px" } }, { children: jsx(FontAwesomeIcon, { icon: faChevronLeft }) }))), priceListStart < availablePriceLists.length - 3 && (jsx("div", __assign({ className: "flex items-center justify-center rounded-full shadow p-1 cursor-pointer", onClick: function () {
|
|
20846
|
-
return setPriceListStart(function (prev) {
|
|
20847
|
-
var newValue = prev + 1;
|
|
20848
|
-
if (newValue >= availablePriceLists.length) {
|
|
20849
|
-
return prev;
|
|
20850
|
-
}
|
|
20851
|
-
return newValue;
|
|
20852
|
-
});
|
|
20853
|
-
}, style: { width: "22px", height: "22px" } }, { children: jsx(FontAwesomeIcon, { icon: faChevronRight }) })))] })));
|
|
20854
|
-
};
|
|
20855
|
-
|
|
20856
|
-
var getAvailablePlansAndPriceLists = function (_a) {
|
|
20857
|
-
var availablePriceLists = _a.availablePriceLists, planChangeOptions = _a.planChangeOptions, priceListStart = _a.priceListStart;
|
|
20858
|
-
var displayPriceLists = availablePriceLists.slice(priceListStart, priceListStart + 3);
|
|
20859
|
-
var availablePlansArray = displayPriceLists === null || displayPriceLists === void 0 ? void 0 : displayPriceLists.map(function (priceList) {
|
|
20860
|
-
var _a;
|
|
20861
|
-
var plan = (_a = planChangeOptions === null || planChangeOptions === void 0 ? void 0 : planChangeOptions.plans) === null || _a === void 0 ? void 0 : _a.find(function (plan) { return plan.id === priceList.plan.id; });
|
|
20862
|
-
return plan;
|
|
20863
|
-
});
|
|
20864
|
-
return {
|
|
20865
|
-
availablePlansArray: availablePlansArray,
|
|
20866
|
-
displayPriceLists: displayPriceLists,
|
|
20867
|
-
};
|
|
20868
|
-
};
|
|
20869
|
-
var everythingInPlusString = function (_a) {
|
|
20870
|
-
var plan = _a.plan;
|
|
20871
|
-
return "Everything in ".concat(plan.name, ", plus");
|
|
20872
|
-
};
|
|
20873
|
-
|
|
20874
|
-
var PLAN_GRID_PADDING = 4;
|
|
20875
|
-
var PlanPickerGridCell = function (_a) {
|
|
20876
|
-
var children = _a.children, noBorder = _a.noBorder;
|
|
20877
|
-
var isMobile = useIsMobile();
|
|
20878
|
-
return (jsxs("div", __assign({ className: "flex flex-col", style: isMobile
|
|
20879
|
-
? {}
|
|
20880
|
-
: __assign({}, (noBorder ? {} : { borderLeft: "1px solid ".concat(SLATE_200) })) }, { children: [jsx("div", __assign({ className: "grow" }, { children: children })), !isMobile && jsx(Divider, {})] })));
|
|
20881
|
-
};
|
|
20882
|
-
|
|
20883
20795
|
var PriceListCardTitle = function (_a) {
|
|
20884
|
-
var
|
|
20796
|
+
var priceList = _a.priceList, isPriceListCurrentSubscription = _a.isPriceListCurrentSubscription, trialRemainingDays = _a.trialRemainingDays;
|
|
20885
20797
|
var isMobile = useIsMobile();
|
|
20886
20798
|
return (jsxs("div", __assign({ className: "flex flex-col items-center gap-4" }, { children: [Boolean(trialRemainingDays) && (jsx("div", __assign({ className: "font-medium text-secondary", style: { height: "1rem" } }, { children: isPriceListCurrentSubscription
|
|
20887
20799
|
? "Trial ends in ".concat(trialRemainingDays, " day").concat(trialRemainingDays === 1 ? "" : "s")
|
|
20888
|
-
: " " }))), jsx("div", __assign({ className: "font-medium text-center ".concat(isMobile ? "text-slate-500" : "text-orange-600"), style: { fontSize: "20px" } }, { children: plan.name }))] })));
|
|
20889
|
-
};
|
|
20890
|
-
|
|
20891
|
-
var Text$e = Typography.Text;
|
|
20892
|
-
var PriceListCardDescription = function (_a) {
|
|
20893
|
-
var description = _a.description;
|
|
20894
|
-
if (!description)
|
|
20895
|
-
return null;
|
|
20896
|
-
return jsx(Text$e, __assign({ className: "text-center" }, { children: description }));
|
|
20800
|
+
: " " }))), jsx("div", __assign({ className: "font-medium text-center ".concat(isMobile ? "text-slate-500" : "text-orange-600"), style: { fontSize: "20px" } }, { children: priceList.plan.name }))] })));
|
|
20897
20801
|
};
|
|
20898
20802
|
|
|
20899
20803
|
var PriceListCardPrice = function (_a) {
|
|
20900
|
-
var
|
|
20901
|
-
return (jsx("div", __assign({ className: "font-medium text-center text-gray-900", style: { fontSize: "32px" } }, { children: !plan.pricingStyle || plan.pricingStyle === PricingStyle.PRICED
|
|
20804
|
+
var priceList = _a.priceList;
|
|
20805
|
+
return (jsx("div", __assign({ className: "font-medium text-center text-gray-900", style: { fontSize: "32px" } }, { children: !priceList.plan.pricingStyle || priceList.plan.pricingStyle === PricingStyle.PRICED
|
|
20902
20806
|
? formatCurrency(priceList.basePrice, priceList.currencyId, 0)
|
|
20903
|
-
: plan.pricingStyle === PricingStyle.CONTACT_US
|
|
20807
|
+
: priceList.plan.pricingStyle === PricingStyle.CONTACT_US
|
|
20904
20808
|
? ""
|
|
20905
20809
|
: "Free" })));
|
|
20906
20810
|
};
|
|
20907
20811
|
|
|
20908
|
-
var Text$
|
|
20812
|
+
var Text$c = Typography.Text;
|
|
20813
|
+
var PriceListCardDescription = function (_a) {
|
|
20814
|
+
var description = _a.description;
|
|
20815
|
+
if (!description)
|
|
20816
|
+
return null;
|
|
20817
|
+
return jsx(Text$c, __assign({ className: "text-center" }, { children: description }));
|
|
20818
|
+
};
|
|
20819
|
+
|
|
20820
|
+
var Text$b = Typography.Text;
|
|
20909
20821
|
var PriceListCardPriceDescription = function (_a) {
|
|
20910
|
-
var feature = _a.feature,
|
|
20822
|
+
var feature = _a.feature, priceList = _a.priceList;
|
|
20911
20823
|
var isMobile = useIsMobile();
|
|
20912
|
-
var doesPlanHaveFlatFeeCharges =
|
|
20913
|
-
|
|
20914
|
-
return charge.pricingModel === PricingModel.FLAT && charge.basePrice > 0;
|
|
20915
|
-
});
|
|
20916
|
-
});
|
|
20917
|
-
if (priceList.periodMonths <= 0 || plan.pricingStyle !== PricingStyle.PRICED)
|
|
20824
|
+
var doesPlanHaveFlatFeeCharges = priceList.charges.some(function (charge) { return charge.pricingModel === PricingModel.FLAT && charge.basePrice > 0; });
|
|
20825
|
+
if (priceList.periodMonths <= 0 || priceList.plan.pricingStyle !== PricingStyle.PRICED)
|
|
20918
20826
|
return null;
|
|
20919
|
-
return (jsx(Text$
|
|
20827
|
+
return (jsx(Text$b, __assign({ className: "text-center text-gray-900", style: {
|
|
20920
20828
|
fontSize: isMobile ? "13px" : "12px",
|
|
20921
|
-
} }, { children: plan.pricingDescription
|
|
20922
|
-
? plan.pricingDescription
|
|
20829
|
+
} }, { children: priceList.plan.pricingDescription
|
|
20830
|
+
? priceList.plan.pricingDescription
|
|
20923
20831
|
: "per ".concat((feature === null || feature === void 0 ? void 0 : feature.unitName) && !doesPlanHaveFlatFeeCharges
|
|
20924
20832
|
? "".concat(feature.unitName.toLowerCase(), " / ")
|
|
20925
20833
|
: "").concat(PERIOD_LABELS[periodMonthsConverter(priceList.periodMonths)]) })));
|
|
20926
20834
|
};
|
|
20927
20835
|
|
|
20836
|
+
var CheckIcon = function (_a) {
|
|
20837
|
+
var backgroundColor = _a.backgroundColor, size = _a.size;
|
|
20838
|
+
return (jsx("div", __assign({ className: "flex items-center justify-center rounded-full shrink-0", style: { width: size, height: size, backgroundColor: backgroundColor } }, { children: jsx("svg", __assign({ width: "8", height: "6", viewBox: "0 0 8 6", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: jsx("path", { d: "M1.5 2.99992L3.16667 4.66659L6.5 1.33325", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })) })));
|
|
20839
|
+
};
|
|
20840
|
+
|
|
20928
20841
|
var PriceListCardButton = function (_a) {
|
|
20929
|
-
var disableOnClick = _a.disableOnClick, isPriceListCurrentSubscription = _a.isPriceListCurrentSubscription, isSelected = _a.isSelected,
|
|
20842
|
+
var disableOnClick = _a.disableOnClick, isPriceListCurrentSubscription = _a.isPriceListCurrentSubscription, isSelected = _a.isSelected, priceList = _a.priceList, subscriptionPlan = _a.subscriptionPlan;
|
|
20930
20843
|
// Context
|
|
20931
20844
|
var upgradingSubscription = useContext(SubscriptionsContext).upgradingSubscription;
|
|
20932
|
-
var isPriceListNonSubscribedCurrentPlan = (upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.plan.id) === plan.id &&
|
|
20933
|
-
!isPriceListCurrentSubscription;
|
|
20845
|
+
var isPriceListNonSubscribedCurrentPlan = (upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.plan.id) === priceList.plan.id && !isPriceListCurrentSubscription;
|
|
20934
20846
|
var createButtonText = function () {
|
|
20935
20847
|
if (isPriceListCurrentSubscription)
|
|
20936
20848
|
return "Current";
|
|
@@ -20938,8 +20850,8 @@ var PriceListCardButton = function (_a) {
|
|
|
20938
20850
|
return "Selected";
|
|
20939
20851
|
if (subscriptionPlan && !isPriceListNonSubscribedCurrentPlan)
|
|
20940
20852
|
return "Subscribed";
|
|
20941
|
-
if (plan.pricingStyle === PricingStyle.CONTACT_US)
|
|
20942
|
-
return plan.contactUsLabel;
|
|
20853
|
+
if (priceList.plan.pricingStyle === PricingStyle.CONTACT_US)
|
|
20854
|
+
return priceList.plan.contactUsLabel;
|
|
20943
20855
|
return "Select";
|
|
20944
20856
|
};
|
|
20945
20857
|
return (jsx("div", __assign({ className: "flex flex-col grow w-full justify-end" }, { children: jsx(StyledCardButton, __assign({ className: "flex justify-center w-full" }, { children: jsx(Button, __assign({ className: "w-full", disabled: disableOnClick, style: {
|
|
@@ -20949,29 +20861,8 @@ var PriceListCardButton = function (_a) {
|
|
|
20949
20861
|
var StyledCardButton = styled.div(templateObject_1$3 || (templateObject_1$3 = __makeTemplateObject(["\n .ant-btn-primary {\n border-color: transparent !important;\n }\n .ant-btn-primary:disabled {\n background: ", ";\n color: ", ";\n }\n"], ["\n .ant-btn-primary {\n border-color: transparent !important;\n }\n .ant-btn-primary:disabled {\n background: ", ";\n color: ", ";\n }\n"])), SLATE_200, SLATE_600);
|
|
20950
20862
|
var templateObject_1$3;
|
|
20951
20863
|
|
|
20952
|
-
var PriceListCardDesktop = function (_a) {
|
|
20953
|
-
var description = _a.description, disableOnClick = _a.disableOnClick, feature = _a.feature, isPriceListCurrentSubscription = _a.isPriceListCurrentSubscription, isSelected = _a.isSelected, onClick = _a.onClick, plan = _a.plan, priceList = _a.priceList, subscriptionPlan = _a.subscriptionPlan, trialRemainingDays = _a.trialRemainingDays;
|
|
20954
|
-
return (jsx(PlanPickerGridCell, { children: jsxs("div", __assign({ className: "flex flex-col items-center justify-between w-full rounded-md gap-4 pt-6 px-4 pb-4 ".concat(disableOnClick ? "" : "cursor-pointer"), onClick: function () {
|
|
20955
|
-
if (!disableOnClick) {
|
|
20956
|
-
if (plan.pricingStyle === PricingStyle.CONTACT_US) {
|
|
20957
|
-
window.open(plan.contactUsUrl, "_blank");
|
|
20958
|
-
}
|
|
20959
|
-
else
|
|
20960
|
-
onClick(priceList);
|
|
20961
|
-
}
|
|
20962
|
-
}, style: {
|
|
20963
|
-
height: "100%",
|
|
20964
|
-
maxWidth: "440px",
|
|
20965
|
-
} }, { children: [jsxs("div", __assign({ className: "flex flex-col items-center gap-3" }, { children: [jsxs("div", __assign({ className: "flex flex-col items-center gap-2" }, { children: [jsx(PriceListCardTitle, { isPriceListCurrentSubscription: isPriceListCurrentSubscription, plan: plan, trialRemainingDays: trialRemainingDays }), jsx(PriceListCardDescription, { description: description })] })), jsxs("div", __assign({ className: "flex flex-col items-center gap-2" }, { children: [jsx(PriceListCardPrice, { plan: plan, priceList: priceList }), jsx(PriceListCardPriceDescription, { feature: feature, plan: plan, priceList: priceList })] }))] })), jsx(PriceListCardButton, { disableOnClick: disableOnClick, isPriceListCurrentSubscription: isPriceListCurrentSubscription, isSelected: isSelected, plan: plan, subscriptionPlan: subscriptionPlan })] })) }));
|
|
20966
|
-
};
|
|
20967
|
-
|
|
20968
|
-
var CheckIcon = function (_a) {
|
|
20969
|
-
var backgroundColor = _a.backgroundColor, size = _a.size;
|
|
20970
|
-
return (jsx("div", __assign({ className: "flex items-center justify-center rounded-full shrink-0", style: { width: size, height: size, backgroundColor: backgroundColor } }, { children: jsx("svg", __assign({ width: "8", height: "6", viewBox: "0 0 8 6", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: jsx("path", { d: "M1.5 2.99992L3.16667 4.66659L6.5 1.33325", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })) })));
|
|
20971
|
-
};
|
|
20972
|
-
|
|
20973
20864
|
var PriceListCardMobile = function (_a) {
|
|
20974
|
-
var description = _a.description, disableOnClick = _a.disableOnClick, feature = _a.feature, isPriceListCurrentSubscription = _a.isPriceListCurrentSubscription, isSelected = _a.isSelected, onClick = _a.onClick,
|
|
20865
|
+
var description = _a.description, disableOnClick = _a.disableOnClick, feature = _a.feature, isPriceListCurrentSubscription = _a.isPriceListCurrentSubscription, isSelected = _a.isSelected, onClick = _a.onClick, priceList = _a.priceList, subscriptionPlan = _a.subscriptionPlan, trialRemainingDays = _a.trialRemainingDays;
|
|
20975
20866
|
var brandColor = useContext(BrandContext).brandColor;
|
|
20976
20867
|
return (jsxs("div", __assign({ className: "relative flex flex-col border-2 border-solid rounded-lg p-4", onClick: function () {
|
|
20977
20868
|
if (!disableOnClick)
|
|
@@ -20982,22 +20873,44 @@ var PriceListCardMobile = function (_a) {
|
|
|
20982
20873
|
} }, { children: [isSelected && (jsx("div", __assign({ className: "absolute", style: {
|
|
20983
20874
|
top: "10px",
|
|
20984
20875
|
right: "10px",
|
|
20985
|
-
} }, { children: jsx(CheckIcon, { backgroundColor: brandColor, size: "20px" }) }))), jsxs("div", __assign({ className: "flex flex-col items-center grow gap-2" }, { children: [jsxs("div", __assign({ className: "flex flex-col items-center gap-2" }, { children: [jsx(PriceListCardTitle, { isPriceListCurrentSubscription: isPriceListCurrentSubscription,
|
|
20876
|
+
} }, { children: jsx(CheckIcon, { backgroundColor: brandColor, size: "20px" }) }))), jsxs("div", __assign({ className: "flex flex-col items-center grow gap-2" }, { children: [jsxs("div", __assign({ className: "flex flex-col items-center gap-2" }, { children: [jsx(PriceListCardTitle, { isPriceListCurrentSubscription: isPriceListCurrentSubscription, priceList: priceList, trialRemainingDays: trialRemainingDays }), jsx(PriceListCardDescription, { description: description })] })), jsxs("div", __assign({ className: "flex flex-col items-center gap-2" }, { children: [jsx(PriceListCardPrice, { priceList: priceList }), jsx(PriceListCardPriceDescription, { feature: feature, priceList: priceList })] })), jsx(PriceListCardButton, { disableOnClick: disableOnClick, isPriceListCurrentSubscription: isPriceListCurrentSubscription, isSelected: isSelected, priceList: priceList, subscriptionPlan: subscriptionPlan })] }))] })));
|
|
20877
|
+
};
|
|
20878
|
+
|
|
20879
|
+
var PLAN_GRID_PADDING = 4;
|
|
20880
|
+
var PlanPickerGridCell = function (_a) {
|
|
20881
|
+
var children = _a.children, noBorder = _a.noBorder;
|
|
20882
|
+
var isMobile = useIsMobile();
|
|
20883
|
+
return (jsxs("div", __assign({ className: "flex flex-col", style: isMobile
|
|
20884
|
+
? {}
|
|
20885
|
+
: __assign({}, (noBorder ? {} : { borderLeft: "1px solid ".concat(SLATE_200) })) }, { children: [jsx("div", __assign({ className: "grow" }, { children: children })), !isMobile && jsx(Divider, {})] })));
|
|
20886
|
+
};
|
|
20887
|
+
|
|
20888
|
+
var PriceListCardDesktop = function (_a) {
|
|
20889
|
+
var description = _a.description, disableOnClick = _a.disableOnClick, feature = _a.feature, isPriceListCurrentSubscription = _a.isPriceListCurrentSubscription, isSelected = _a.isSelected, onClick = _a.onClick, priceList = _a.priceList, subscriptionPlan = _a.subscriptionPlan, trialRemainingDays = _a.trialRemainingDays;
|
|
20890
|
+
return (jsx(PlanPickerGridCell, { children: jsxs("div", __assign({ className: "flex flex-col items-center justify-between w-full rounded-md gap-4 pt-6 px-4 pb-4 ".concat(disableOnClick ? "" : "cursor-pointer"), onClick: function () {
|
|
20891
|
+
if (!disableOnClick) {
|
|
20892
|
+
if (priceList.plan.pricingStyle === PricingStyle.CONTACT_US) {
|
|
20893
|
+
window.open(priceList.plan.contactUsUrl, "_blank");
|
|
20894
|
+
}
|
|
20895
|
+
else
|
|
20896
|
+
onClick(priceList);
|
|
20897
|
+
}
|
|
20898
|
+
}, style: {
|
|
20899
|
+
height: "100%",
|
|
20900
|
+
maxWidth: "440px",
|
|
20901
|
+
} }, { children: [jsxs("div", __assign({ className: "flex flex-col items-center gap-3" }, { children: [jsxs("div", __assign({ className: "flex flex-col items-center gap-2" }, { children: [jsx(PriceListCardTitle, { isPriceListCurrentSubscription: isPriceListCurrentSubscription, priceList: priceList, trialRemainingDays: trialRemainingDays }), jsx(PriceListCardDescription, { description: description })] })), jsxs("div", __assign({ className: "flex flex-col items-center gap-2" }, { children: [jsx(PriceListCardPrice, { priceList: priceList }), jsx(PriceListCardPriceDescription, { feature: feature, priceList: priceList })] }))] })), jsx(PriceListCardButton, { disableOnClick: disableOnClick, isPriceListCurrentSubscription: isPriceListCurrentSubscription, isSelected: isSelected, priceList: priceList, subscriptionPlan: subscriptionPlan })] })) }));
|
|
20986
20902
|
};
|
|
20987
20903
|
|
|
20988
20904
|
var PriceListCard = function (_a) {
|
|
20989
20905
|
var _b;
|
|
20990
|
-
var isSelected = _a.isSelected, onClick = _a.onClick,
|
|
20906
|
+
var isSelected = _a.isSelected, onClick = _a.onClick, priceList = _a.priceList, subscriptions = _a.subscriptions, trialRemainingDays = _a.trialRemainingDays;
|
|
20991
20907
|
// Context
|
|
20992
20908
|
var upgradingSubscription = useContext(SubscriptionsContext).upgradingSubscription;
|
|
20993
20909
|
var isMobile = useIsMobile();
|
|
20994
|
-
if (!plan) {
|
|
20995
|
-
return null;
|
|
20996
|
-
}
|
|
20997
20910
|
// Derived state
|
|
20998
|
-
var description = createPlanDescription(
|
|
20911
|
+
var description = createPlanDescription(priceList);
|
|
20999
20912
|
// Get the active price list charge for this plan
|
|
21000
|
-
var activeCharge = (_b = getActivePlanPriceData(
|
|
20913
|
+
var activeCharge = (_b = getActivePlanPriceData(priceList, priceList)) === null || _b === void 0 ? void 0 : _b.activeCharge;
|
|
21001
20914
|
// Is the price list the current price list for the upgradingSubscription
|
|
21002
20915
|
var isPriceListCurrentSubscription = (upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.priceList.id) === priceList.id;
|
|
21003
20916
|
var disableOnClick = isPriceListDisabled({
|
|
@@ -21007,7 +20920,7 @@ var PriceListCard = function (_a) {
|
|
|
21007
20920
|
});
|
|
21008
20921
|
var subscriptionPlan = subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.find(function (subscription) {
|
|
21009
20922
|
var _a, _b;
|
|
21010
|
-
return subscription.plan.id === plan.id &&
|
|
20923
|
+
return subscription.plan.id === priceList.plan.id &&
|
|
21011
20924
|
((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) !== SubscriptionState$2.CANCELED &&
|
|
21012
20925
|
((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) !== SubscriptionState$2.EXPIRED;
|
|
21013
20926
|
});
|
|
@@ -21015,50 +20928,48 @@ var PriceListCard = function (_a) {
|
|
|
21015
20928
|
return null;
|
|
21016
20929
|
}
|
|
21017
20930
|
var feature = activeCharge.feature;
|
|
21018
|
-
return isMobile ? (jsx(PriceListCardMobile, { description: description, disableOnClick: disableOnClick, feature: feature, isPriceListCurrentSubscription: isPriceListCurrentSubscription, isSelected: isSelected, onClick: onClick,
|
|
20931
|
+
return isMobile ? (jsx(PriceListCardMobile, { description: description, disableOnClick: disableOnClick, feature: feature, isPriceListCurrentSubscription: isPriceListCurrentSubscription, isSelected: isSelected, onClick: onClick, priceList: priceList, trialRemainingDays: trialRemainingDays, subscriptionPlan: subscriptionPlan })) : (jsx(PriceListCardDesktop, { description: description, disableOnClick: disableOnClick, feature: feature, isPriceListCurrentSubscription: isPriceListCurrentSubscription, isSelected: isSelected, onClick: onClick, priceList: priceList, trialRemainingDays: trialRemainingDays, subscriptionPlan: subscriptionPlan }));
|
|
21019
20932
|
};
|
|
21020
20933
|
|
|
21021
|
-
var
|
|
20934
|
+
var Text$a = Typography.Text;
|
|
20935
|
+
var PriceListCardFeature = function (_a) {
|
|
20936
|
+
var index = _a.index, planFeature = _a.planFeature;
|
|
20937
|
+
var brandColor = useContext(BrandContext).brandColor;
|
|
20938
|
+
if (planFeature.feature.kind === "GROUP")
|
|
20939
|
+
return jsx(Text$a, __assign({ className: "font-medium base-text" }, { children: planFeature.name }));
|
|
20940
|
+
return (jsxs("div", __assign({ className: "flex items-center gap-2" }, { children: [jsx(CheckIcon, { backgroundColor: brandColor, size: "15px" }), jsx(Text$a, __assign({ className: "text-gray-600" }, { children: planFeature.feature.name }))] }), index));
|
|
20941
|
+
};
|
|
21022
20942
|
|
|
21023
|
-
var
|
|
21024
|
-
var
|
|
21025
|
-
|
|
21026
|
-
var availablePlansArray =
|
|
21027
|
-
var uniqueFeatures = new Set();
|
|
21028
|
-
var updatedPlansArray = availablePlansArray.map(function (plan) {
|
|
20943
|
+
var getAvailablePlansAndPriceLists = function (_a) {
|
|
20944
|
+
var availablePriceLists = _a.availablePriceLists, priceListChangeOptions = _a.priceListChangeOptions, priceListStart = _a.priceListStart;
|
|
20945
|
+
var displayPriceLists = availablePriceLists.slice(priceListStart, priceListStart + 3);
|
|
20946
|
+
var availablePlansArray = displayPriceLists === null || displayPriceLists === void 0 ? void 0 : displayPriceLists.map(function (displayPriceList) {
|
|
21029
20947
|
var _a;
|
|
21030
|
-
var
|
|
21031
|
-
|
|
21032
|
-
return false;
|
|
21033
|
-
}
|
|
21034
|
-
else {
|
|
21035
|
-
uniqueFeatures.add(feature.featureId);
|
|
21036
|
-
return true;
|
|
21037
|
-
}
|
|
21038
|
-
});
|
|
21039
|
-
return __assign(__assign({}, plan), { planFeatures: updatedPlanFeatures });
|
|
20948
|
+
var foundPriceList = (_a = priceListChangeOptions === null || priceListChangeOptions === void 0 ? void 0 : priceListChangeOptions.priceLists) === null || _a === void 0 ? void 0 : _a.find(function (priceList) { return priceList.plan.id === displayPriceList.plan.id; });
|
|
20949
|
+
return foundPriceList.plan;
|
|
21040
20950
|
});
|
|
21041
|
-
return
|
|
20951
|
+
return {
|
|
20952
|
+
availablePlansArray: availablePlansArray,
|
|
20953
|
+
displayPriceLists: displayPriceLists,
|
|
20954
|
+
};
|
|
21042
20955
|
};
|
|
21043
|
-
var
|
|
21044
|
-
var
|
|
21045
|
-
|
|
21046
|
-
|
|
21047
|
-
|
|
21048
|
-
|
|
21049
|
-
|
|
21050
|
-
|
|
21051
|
-
|
|
21052
|
-
|
|
21053
|
-
|
|
21054
|
-
|
|
21055
|
-
|
|
21056
|
-
return (
|
|
21057
|
-
|
|
21058
|
-
|
|
21059
|
-
|
|
21060
|
-
}) }), planIndex));
|
|
21061
|
-
}) }));
|
|
20956
|
+
var everythingInPlusString = function (_a) {
|
|
20957
|
+
var priceList = _a.priceList;
|
|
20958
|
+
return "Everything in ".concat(priceList.plan.name, ", plus");
|
|
20959
|
+
};
|
|
20960
|
+
|
|
20961
|
+
var PriceListGridMobile = function (_a) {
|
|
20962
|
+
var _b, _c, _d, _e;
|
|
20963
|
+
var availablePriceLists = _a.availablePriceLists, onChangePriceList = _a.onChangePriceList, priceListChangeOptions = _a.priceListChangeOptions, selectedPriceList = _a.selectedPriceList, selectedProduct = _a.selectedProduct, subscriptions = _a.subscriptions, trialRemainingDays = _a.trialRemainingDays;
|
|
20964
|
+
var everythingInPlus = selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.everythingInPlus;
|
|
20965
|
+
var prevPriceListIndex = availablePriceLists.findIndex(function (priceList) { return priceList.id === (selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id); });
|
|
20966
|
+
var prevPriceListId = (_b = availablePriceLists[prevPriceListIndex - 1]) === null || _b === void 0 ? void 0 : _b.id;
|
|
20967
|
+
var prevPriceList = (_c = priceListChangeOptions === null || priceListChangeOptions === void 0 ? void 0 : priceListChangeOptions.priceLists) === null || _c === void 0 ? void 0 : _c.find(function (priceList) { return priceList.id === prevPriceListId; });
|
|
20968
|
+
return (jsxs(Fragment, { children: [jsx("div", __assign({ className: "flex gap-4 overflow-auto shadow-padding-xb", style: { flexShrink: 0 } }, { children: availablePriceLists.map(function (priceList, index) {
|
|
20969
|
+
return (jsx(PriceListCard, { isSelected: priceList.id === (selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id), onClick: onChangePriceList, priceList: priceList, subscriptions: subscriptions, trialRemainingDays: trialRemainingDays }, index));
|
|
20970
|
+
}) })), jsx("div", __assign({ className: "text-slate-500 pt-5 pb-4 shadow-padding-x" }, { children: everythingInPlus && prevPriceList
|
|
20971
|
+
? everythingInPlusString({ priceList: prevPriceList })
|
|
20972
|
+
: "Features" })), jsx("div", __assign({ className: "flex flex-col gap-4 overflow-auto shadow-padding-x" }, { children: (_e = (_d = selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.plan) === null || _d === void 0 ? void 0 : _d.planFeatures) === null || _e === void 0 ? void 0 : _e.map(function (planFeature, index) { return (jsx(PriceListCardFeature, { planFeature: planFeature, index: index }, index)); }) }))] }));
|
|
21062
20973
|
};
|
|
21063
20974
|
|
|
21064
20975
|
var shouldColorRow = function (_a) {
|
|
@@ -21075,15 +20986,15 @@ var FeatureGridCell = function (_a) {
|
|
|
21075
20986
|
: {})) }, { children: children })));
|
|
21076
20987
|
};
|
|
21077
20988
|
|
|
21078
|
-
var
|
|
20989
|
+
var PLANS_TO_DISPLAY$1 = 3;
|
|
20990
|
+
|
|
20991
|
+
var Text$9 = Typography.Text;
|
|
21079
20992
|
var PlanFeatures = function (_a) {
|
|
21080
20993
|
var _b;
|
|
21081
|
-
var availablePlansArray = _a.availablePlansArray,
|
|
20994
|
+
var availablePlansArray = _a.availablePlansArray, selectedProduct = _a.selectedProduct;
|
|
21082
20995
|
var featureGroupCounter = useRef(0);
|
|
21083
20996
|
var visibleFeatureCounter = useRef(1);
|
|
21084
20997
|
var brandColor = useContext(BrandContext).brandColor;
|
|
21085
|
-
if (!plans)
|
|
21086
|
-
return null;
|
|
21087
20998
|
return (jsx(Fragment, { children: (_b = selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.features) === null || _b === void 0 ? void 0 : _b.map(function (feature, featureIndex) {
|
|
21088
20999
|
if (!selectedProduct.features)
|
|
21089
21000
|
return null;
|
|
@@ -21105,7 +21016,7 @@ var PlanFeatures = function (_a) {
|
|
|
21105
21016
|
rowIndex = rowIndex + featureGroupCounter.current;
|
|
21106
21017
|
// Increment the visible feature counter
|
|
21107
21018
|
visibleFeatureCounter.current = visibleFeatureCounter.current + 1;
|
|
21108
|
-
return (jsxs("div", __assign({ className: "contents" }, { children: [jsx(FeatureGridCell, __assign({ isFeatureGroup: isFeatureGroup, noBorder: true, rowIndex: rowIndex }, { children: jsx(FeatureTitle, { isFeatureGroup: isFeatureGroup, feature: feature }) })), __spreadArray([], Array(PLANS_TO_DISPLAY), true).map(function (_, columnIndex) {
|
|
21019
|
+
return (jsxs("div", __assign({ className: "contents" }, { children: [jsx(FeatureGridCell, __assign({ isFeatureGroup: isFeatureGroup, noBorder: true, rowIndex: rowIndex }, { children: jsx(FeatureTitle, { isFeatureGroup: isFeatureGroup, feature: feature }) })), __spreadArray([], Array(PLANS_TO_DISPLAY$1), true).map(function (_, columnIndex) {
|
|
21109
21020
|
var _a;
|
|
21110
21021
|
var plan = availablePlansArray[columnIndex];
|
|
21111
21022
|
var doesHavePrevPlan = availablePlansArray[columnIndex - 1];
|
|
@@ -21115,91 +21026,115 @@ var PlanFeatures = function (_a) {
|
|
|
21115
21026
|
if (!plan)
|
|
21116
21027
|
return (jsx(FeatureGridCell, { rowIndex: rowIndex, noBorder: !Boolean(doesHavePrevPlan) }, columnIndex));
|
|
21117
21028
|
if (isFeatureGroup)
|
|
21118
|
-
return
|
|
21119
|
-
return (jsx(FeatureGridCell, __assign({ rowIndex: rowIndex }, { children: jsx("div", __assign({ className: "flex justify-center text-center" }, { children: planFeature ? ((planFeature === null || planFeature === void 0 ? void 0 : planFeature.value) ? (planFeature.value) : (jsx(CheckIcon, { backgroundColor: brandColor, size: "15px" }))) : (jsx(Text$
|
|
21029
|
+
return jsx(FeatureGridCell, { isFeatureGroup: true, rowIndex: rowIndex }, columnIndex);
|
|
21030
|
+
return (jsx(FeatureGridCell, __assign({ rowIndex: rowIndex }, { children: jsx("div", __assign({ className: "flex justify-center text-center" }, { children: planFeature ? ((planFeature === null || planFeature === void 0 ? void 0 : planFeature.value) ? (planFeature.value) : (jsx(CheckIcon, { backgroundColor: brandColor, size: "15px" }))) : (jsx(Text$9, __assign({ className: "text-gray" }, { children: "-" }))) })) }), columnIndex));
|
|
21120
21031
|
})] }), rowIndex));
|
|
21121
21032
|
}) }));
|
|
21122
21033
|
};
|
|
21123
21034
|
var FeatureTitle = function (_a) {
|
|
21124
21035
|
var _b;
|
|
21125
21036
|
var isFeatureGroup = _a.isFeatureGroup, feature = _a.feature;
|
|
21126
|
-
return (jsx(Text$
|
|
21037
|
+
return (jsx(Text$9, __assign({ className: " ".concat(isFeatureGroup ? "text-slate-500 font-medium pt-4" : ""), style: __assign({}, (isFeatureGroup ? { fontSize: "11px" } : {})) }, { children: isFeatureGroup ? (_b = feature === null || feature === void 0 ? void 0 : feature.name) === null || _b === void 0 ? void 0 : _b.toUpperCase() : feature === null || feature === void 0 ? void 0 : feature.name })));
|
|
21038
|
+
};
|
|
21039
|
+
|
|
21040
|
+
var NextPriceListButton = function (_a) {
|
|
21041
|
+
var availablePriceLists = _a.availablePriceLists, priceListStart = _a.priceListStart, setPriceListStart = _a.setPriceListStart;
|
|
21042
|
+
return (jsxs("div", __assign({ className: "absolute flex gap-1", style: { top: "12px", right: "8px", zIndex: 10 } }, { children: [priceListStart > 0 && (jsx("div", __assign({ className: "flex items-center justify-center rounded-full shadow p-1 cursor-pointer", onClick: function () {
|
|
21043
|
+
setPriceListStart(function (prev) {
|
|
21044
|
+
var newValue = prev - 1;
|
|
21045
|
+
if (newValue < 0) {
|
|
21046
|
+
return prev;
|
|
21047
|
+
}
|
|
21048
|
+
return newValue;
|
|
21049
|
+
});
|
|
21050
|
+
}, style: { width: "22px", height: "22px" } }, { children: jsx(FontAwesomeIcon, { icon: faChevronLeft }) }))), priceListStart < availablePriceLists.length - 3 && (jsx("div", __assign({ className: "flex items-center justify-center rounded-full shadow p-1 cursor-pointer", onClick: function () {
|
|
21051
|
+
return setPriceListStart(function (prev) {
|
|
21052
|
+
var newValue = prev + 1;
|
|
21053
|
+
if (newValue >= availablePriceLists.length) {
|
|
21054
|
+
return prev;
|
|
21055
|
+
}
|
|
21056
|
+
return newValue;
|
|
21057
|
+
});
|
|
21058
|
+
}, style: { width: "22px", height: "22px" } }, { children: jsx(FontAwesomeIcon, { icon: faChevronRight }) })))] })));
|
|
21059
|
+
};
|
|
21060
|
+
|
|
21061
|
+
var filterUniqueFeatures = function (_a) {
|
|
21062
|
+
// Remove any features that in previous plans if everythingInPlus is true
|
|
21063
|
+
var availablePriceLists = _a.availablePriceLists;
|
|
21064
|
+
var uniqueFeatures = new Set();
|
|
21065
|
+
var updatedPriceLists = availablePriceLists.map(function (priceList) {
|
|
21066
|
+
var _a;
|
|
21067
|
+
var updatedPlanFeatures = (_a = priceList.plan.planFeatures) === null || _a === void 0 ? void 0 : _a.filter(function (feature) {
|
|
21068
|
+
if (uniqueFeatures.has(feature.featureId)) {
|
|
21069
|
+
return false;
|
|
21070
|
+
}
|
|
21071
|
+
else {
|
|
21072
|
+
uniqueFeatures.add(feature.featureId);
|
|
21073
|
+
return true;
|
|
21074
|
+
}
|
|
21075
|
+
});
|
|
21076
|
+
return __assign(__assign({}, priceList), { plan: __assign(__assign({}, priceList.plan), { planFeatures: updatedPlanFeatures }) });
|
|
21077
|
+
});
|
|
21078
|
+
return updatedPriceLists;
|
|
21079
|
+
};
|
|
21080
|
+
var EverythingPlanFeatures = function (_a) {
|
|
21081
|
+
var availablePriceLists = _a.availablePriceLists, selectedProduct = _a.selectedProduct;
|
|
21082
|
+
var brandColor = useContext(BrandContext).brandColor;
|
|
21083
|
+
var uniquePlanFeatures = filterUniqueFeatures({ availablePriceLists: availablePriceLists });
|
|
21084
|
+
return (jsx(Fragment, { children: __spreadArray([], Array(PLANS_TO_DISPLAY), true).map(function (_, planIndex) {
|
|
21085
|
+
var priceList = uniquePlanFeatures[planIndex];
|
|
21086
|
+
var prevPriceList = availablePriceLists[planIndex - 1];
|
|
21087
|
+
if (!priceList)
|
|
21088
|
+
return (jsx("div", { style: prevPriceList ? { borderLeft: "1px solid ".concat(SLATE_200) } : {} }, planIndex));
|
|
21089
|
+
if (!priceList.plan.planFeatures)
|
|
21090
|
+
return jsx("div", {}, planIndex);
|
|
21091
|
+
return (jsx("div", __assign({ className: "flex flex-col gap-4 p-4", style: { borderLeft: "1px solid ".concat(SLATE_200) } }, { children: priceList.plan.planFeatures.map(function (planFeature, planFeatureIndex) {
|
|
21092
|
+
var everythingInPlus = selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.everythingInPlus;
|
|
21093
|
+
return (jsxs("div", __assign({ className: "contents" }, { children: [prevPriceList && everythingInPlus && planIndex > 0 && planFeatureIndex === 0 && (jsx("div", __assign({ className: "font-medium", style: { fontSize: "13px" } }, { children: everythingInPlusString({ priceList: prevPriceList }) }))), jsxs("div", __assign({ className: "flex gap-1 text-gray-600", style: { fontSize: "13px" } }, { children: [jsx(CheckIcon, { backgroundColor: brandColor, size: "15px" }), planFeature.feature.name] }))] }), planFeatureIndex));
|
|
21094
|
+
}) }), planIndex));
|
|
21095
|
+
}) }));
|
|
21127
21096
|
};
|
|
21128
21097
|
|
|
21098
|
+
var PLANS_TO_DISPLAY = 3;
|
|
21129
21099
|
var PriceListGridDesktop = function (_a) {
|
|
21130
|
-
var availablePriceLists = _a.availablePriceLists, onChangePriceList = _a.onChangePriceList,
|
|
21131
|
-
// Context
|
|
21132
|
-
var shadow = useContext(SubscriptionsContext).shadow;
|
|
21100
|
+
var availablePriceLists = _a.availablePriceLists, onChangePriceList = _a.onChangePriceList, priceListChangeOptions = _a.priceListChangeOptions, priceListStart = _a.priceListStart, selectedPriceList = _a.selectedPriceList, selectedProduct = _a.selectedProduct, setPriceListStart = _a.setPriceListStart, subscriptions = _a.subscriptions, trialRemainingDays = _a.trialRemainingDays;
|
|
21133
21101
|
var _b = useMemo(function () {
|
|
21134
21102
|
return getAvailablePlansAndPriceLists({
|
|
21135
21103
|
availablePriceLists: availablePriceLists,
|
|
21136
|
-
|
|
21104
|
+
priceListChangeOptions: priceListChangeOptions,
|
|
21137
21105
|
priceListStart: priceListStart,
|
|
21138
21106
|
});
|
|
21139
|
-
}, [availablePriceLists,
|
|
21107
|
+
}, [availablePriceLists, priceListChangeOptions, priceListStart]), availablePlansArray = _b.availablePlansArray, displayPriceLists = _b.displayPriceLists;
|
|
21140
21108
|
var everythingInPlus = selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.everythingInPlus;
|
|
21141
|
-
return (jsx("div", __assign({ className: "" }, { children: jsxs("div", __assign({ className: "relative flex flex-col h-full rounded-md overflow-hidden bg-white
|
|
21109
|
+
return (jsx("div", __assign({ className: "shadow-padding-xb" }, { children: jsxs("div", __assign({ className: "relative flex flex-col h-full rounded-md shadow overflow-hidden bg-white" }, { children: [jsx(NextPriceListButton, { availablePriceLists: availablePriceLists, priceListStart: priceListStart, setPriceListStart: setPriceListStart }), jsxs("div", __assign({ className: "grid w-full", style: {
|
|
21142
21110
|
gridTemplateColumns: everythingInPlus
|
|
21143
21111
|
? "repeat(3, minmax(120px, 1fr))"
|
|
21144
21112
|
: "minmax(auto, 400px) repeat(3, minmax(120px, 1fr))",
|
|
21145
21113
|
} }, { children: [!everythingInPlus && jsx(PlanPickerGridCell, { noBorder: true }), __spreadArray([], Array(PLANS_TO_DISPLAY), true).map(function (_, index) {
|
|
21146
|
-
var _a;
|
|
21147
21114
|
var priceList = displayPriceLists[index];
|
|
21148
21115
|
var doesPrevPriceListExist = displayPriceLists[index - 1];
|
|
21149
21116
|
if (!priceList)
|
|
21150
|
-
return
|
|
21151
|
-
|
|
21152
|
-
|
|
21153
|
-
}), (selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.everythingInPlus) ? (jsx(EverythingPlanFeatures, { availablePlansArray: availablePlansArray, selectedProduct: selectedProduct })) : (jsx(PlanFeatures, { availablePlansArray: availablePlansArray, plans: planChangeOptions === null || planChangeOptions === void 0 ? void 0 : planChangeOptions.plans, selectedProduct: selectedProduct }))] }))] })) })));
|
|
21154
|
-
};
|
|
21155
|
-
|
|
21156
|
-
var Text$a = Typography.Text;
|
|
21157
|
-
var PriceListCardFeature = function (_a) {
|
|
21158
|
-
var feature = _a.feature, index = _a.index;
|
|
21159
|
-
var brandColor = useContext(BrandContext).brandColor;
|
|
21160
|
-
if (feature.kind === "GROUP")
|
|
21161
|
-
return jsx(Text$a, __assign({ className: "font-medium base-text" }, { children: feature.name }));
|
|
21162
|
-
return (jsxs("div", __assign({ className: "flex items-center gap-2" }, { children: [jsx(CheckIcon, { backgroundColor: brandColor, size: "15px" }), jsx(Text$a, __assign({ className: "text-gray-600" }, { children: feature.name }))] }), index));
|
|
21163
|
-
};
|
|
21164
|
-
|
|
21165
|
-
var Text$9 = Typography.Text;
|
|
21166
|
-
var PriceListGridMobile = function (_a) {
|
|
21167
|
-
var _b, _c, _d;
|
|
21168
|
-
var availablePriceLists = _a.availablePriceLists, onChangePriceList = _a.onChangePriceList, planChangeOptions = _a.planChangeOptions, selectedPlan = _a.selectedPlan, selectedProduct = _a.selectedProduct, subscriptions = _a.subscriptions, trialRemainingDays = _a.trialRemainingDays;
|
|
21169
|
-
var everythingInPlus = selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.everythingInPlus;
|
|
21170
|
-
var prevPriceListIndex = availablePriceLists.findIndex(function (priceList) { return priceList.plan.id === (selectedPlan === null || selectedPlan === void 0 ? void 0 : selectedPlan.id); });
|
|
21171
|
-
var prevPlanId = (_b = availablePriceLists[prevPriceListIndex - 1]) === null || _b === void 0 ? void 0 : _b.plan.id;
|
|
21172
|
-
var prevPlan = (_c = planChangeOptions === null || planChangeOptions === void 0 ? void 0 : planChangeOptions.plans) === null || _c === void 0 ? void 0 : _c.find(function (plan) { return plan.id === prevPlanId; });
|
|
21173
|
-
return (jsxs(Fragment, { children: [jsx("div", __assign({ className: "flex gap-4 overflow-auto bunny-shadow-padding-xb", style: { flexShrink: 0 } }, { children: availablePriceLists.map(function (priceList, index) {
|
|
21174
|
-
var _a;
|
|
21175
|
-
var plan = (_a = planChangeOptions === null || planChangeOptions === void 0 ? void 0 : planChangeOptions.plans) === null || _a === void 0 ? void 0 : _a.find(function (plan) { return plan.id === priceList.plan.id; });
|
|
21176
|
-
return (jsx(PriceListCard, { isSelected: priceList.plan.id === (selectedPlan === null || selectedPlan === void 0 ? void 0 : selectedPlan.id), onClick: onChangePriceList, plan: plan, priceList: priceList, subscriptions: subscriptions, trialRemainingDays: trialRemainingDays }, index));
|
|
21177
|
-
}) })), jsx(Text$9, __assign({ className: "text-slate-500 pt-5 pb-4 bunny-shadow-padding-x" }, { children: everythingInPlus && prevPlan
|
|
21178
|
-
? everythingInPlusString({ plan: prevPlan })
|
|
21179
|
-
: "Features" })), jsx("div", __assign({ className: "flex flex-col gap-4 overflow-auto bunny-shadow-padding-x" }, { children: (_d = selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.features) === null || _d === void 0 ? void 0 : _d.map(function (feature, index) { return (jsx(PriceListCardFeature, { feature: feature, index: index }, index)); }) }))] }));
|
|
21117
|
+
return jsx(PlanPickerGridCell, { noBorder: !Boolean(doesPrevPriceListExist) }, index);
|
|
21118
|
+
return (jsx(PriceListCard, { isSelected: priceList.plan.id === (selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.plan.id), onClick: onChangePriceList, priceList: priceList, subscriptions: subscriptions, trialRemainingDays: trialRemainingDays }, index));
|
|
21119
|
+
}), (selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.everythingInPlus) ? (jsx(EverythingPlanFeatures, { availablePriceLists: availablePriceLists, selectedProduct: selectedProduct })) : (jsx(PlanFeatures, { availablePlansArray: availablePlansArray, selectedProduct: selectedProduct }))] }))] })) })));
|
|
21180
21120
|
};
|
|
21181
21121
|
|
|
21182
21122
|
var PriceListGrid = function (_a) {
|
|
21183
21123
|
var _b, _c;
|
|
21184
|
-
var availablePriceLists = _a.availablePriceLists, onChangePriceList = _a.onChangePriceList,
|
|
21124
|
+
var availablePriceLists = _a.availablePriceLists, onChangePriceList = _a.onChangePriceList, priceListChangeOptions = _a.priceListChangeOptions, priceListStart = _a.priceListStart, selectedPriceList = _a.selectedPriceList, selectedProduct = _a.selectedProduct, setPriceListStart = _a.setPriceListStart, subscriptions = _a.subscriptions, upgradingSubscriptionState = _a.upgradingSubscriptionState;
|
|
21185
21125
|
// Hooks
|
|
21186
21126
|
var isMobile = useIsMobile();
|
|
21187
21127
|
// Derived state
|
|
21188
|
-
var
|
|
21189
|
-
var
|
|
21190
|
-
|
|
21191
|
-
return isMobile ? (jsx(PriceListGridMobile, { availablePriceLists: availablePriceLists, onChangePriceList: onChangePriceList, planChangeOptions: planChangeOptions, selectedPlan: selectedPlan, selectedProduct: selectedProduct, subscriptions: subscriptions, trialRemainingDays: trialRemainingDays })) : (jsx(PriceListGridDesktop, { availablePriceLists: availablePriceLists, onChangePriceList: onChangePriceList, planChangeOptions: planChangeOptions, priceListStart: priceListStart, selectedPlan: selectedPlan, selectedProduct: selectedProduct, setPriceListStart: setPriceListStart, subscriptions: subscriptions, trialRemainingDays: trialRemainingDays }));
|
|
21128
|
+
var currentPriceList = (_b = priceListChangeOptions === null || priceListChangeOptions === void 0 ? void 0 : priceListChangeOptions.priceLists) === null || _b === void 0 ? void 0 : _b.find(function (priceList) { var _a; return priceList.id === ((_a = upgradingSubscriptionState === null || upgradingSubscriptionState === void 0 ? void 0 : upgradingSubscriptionState.plan) === null || _a === void 0 ? void 0 : _a.id); });
|
|
21129
|
+
var trialRemainingDays = dayjs((_c = currentPriceList === null || currentPriceList === void 0 ? void 0 : currentPriceList.plan) === null || _c === void 0 ? void 0 : _c.trialEndDate).diff(dayjs(), "days");
|
|
21130
|
+
return isMobile ? (jsx(PriceListGridMobile, { availablePriceLists: availablePriceLists, onChangePriceList: onChangePriceList, priceListChangeOptions: priceListChangeOptions, selectedPriceList: selectedPriceList, selectedProduct: selectedProduct, subscriptions: subscriptions, trialRemainingDays: trialRemainingDays })) : (jsx(PriceListGridDesktop, { availablePriceLists: availablePriceLists, onChangePriceList: onChangePriceList, priceListChangeOptions: priceListChangeOptions, priceListStart: priceListStart, selectedPriceList: selectedPriceList, selectedProduct: selectedProduct, setPriceListStart: setPriceListStart, subscriptions: subscriptions, trialRemainingDays: trialRemainingDays }));
|
|
21192
21131
|
};
|
|
21193
21132
|
|
|
21194
|
-
var createAvailableBillingPeriods = function (
|
|
21195
|
-
return
|
|
21196
|
-
return plan.priceLists
|
|
21197
|
-
.filter(function (priceList) { return priceList.product.id === (selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.id); })
|
|
21198
|
-
.map(function (priceList) { return priceList.periodMonths; });
|
|
21199
|
-
}).sort(function (a, b) { return a - b; }).filter(function (currentValue, index, array) { return index === array.indexOf(currentValue); });
|
|
21133
|
+
var createAvailableBillingPeriods = function (priceLists, selectedProduct) {
|
|
21134
|
+
return priceLists === null || priceLists === void 0 ? void 0 : priceLists.filter(function (priceList) { return priceList.product.id === (selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.id); }).map(function (priceList) { return priceList.periodMonths; }).sort(function (a, b) { return a - b; }).filter(function (currentValue, index, array) { return index === array.indexOf(currentValue); });
|
|
21200
21135
|
};
|
|
21201
21136
|
var PriceListSelector = function (_a) {
|
|
21202
|
-
var arePlanChangeOptionsLoading = _a.arePlanChangeOptionsLoading, areSubscriptionsLoading = _a.areSubscriptionsLoading, onChangePriceList = _a.onChangePriceList,
|
|
21137
|
+
var arePlanChangeOptionsLoading = _a.arePlanChangeOptionsLoading, areSubscriptionsLoading = _a.areSubscriptionsLoading, onChangePriceList = _a.onChangePriceList, priceListChangeOptions = _a.priceListChangeOptions, selectedPriceList = _a.selectedPriceList, subscriptions = _a.subscriptions, upgradingSubscription = _a.upgradingSubscription;
|
|
21203
21138
|
// Context
|
|
21204
21139
|
var _b = useContext(SubscriptionsContext), isInPreviewMode = _b.isInPreviewMode, quotePreviewData = _b.quotePreviewData, setQuotePreviewData = _b.setQuotePreviewData;
|
|
21205
21140
|
// Local state
|
|
@@ -21207,32 +21142,22 @@ var PriceListSelector = function (_a) {
|
|
|
21207
21142
|
var _d = useState(), selectedBillingPeriod = _d[0], setSelectedBillingPeriod = _d[1];
|
|
21208
21143
|
var _e = useState(0), priceListStart = _e[0], setPriceListStart = _e[1];
|
|
21209
21144
|
// Derived state
|
|
21210
|
-
var availableBillingPeriods = useMemo(function () {
|
|
21211
|
-
return createAvailableBillingPeriods(planChangeOptions === null || planChangeOptions === void 0 ? void 0 : planChangeOptions.plans, selectedProduct);
|
|
21212
|
-
}, [planChangeOptions === null || planChangeOptions === void 0 ? void 0 : planChangeOptions.plans, selectedProduct]);
|
|
21145
|
+
var availableBillingPeriods = useMemo(function () { return createAvailableBillingPeriods(priceListChangeOptions === null || priceListChangeOptions === void 0 ? void 0 : priceListChangeOptions.priceLists, selectedProduct); }, [priceListChangeOptions === null || priceListChangeOptions === void 0 ? void 0 : priceListChangeOptions.priceLists, selectedProduct]);
|
|
21213
21146
|
var availablePriceLists = useMemo(function () {
|
|
21214
21147
|
var _a;
|
|
21215
|
-
return (((_a =
|
|
21216
|
-
return
|
|
21217
|
-
|
|
21218
|
-
selectedBillingPeriod &&
|
|
21219
|
-
priceList.product.id === (selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.id);
|
|
21220
|
-
});
|
|
21148
|
+
return (((_a = priceListChangeOptions === null || priceListChangeOptions === void 0 ? void 0 : priceListChangeOptions.priceLists) === null || _a === void 0 ? void 0 : _a.filter(function (priceList) {
|
|
21149
|
+
return periodMonthsConverter(priceList.periodMonths) === selectedBillingPeriod &&
|
|
21150
|
+
priceList.product.id === (selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.id);
|
|
21221
21151
|
})) || []);
|
|
21222
|
-
}, [
|
|
21152
|
+
}, [priceListChangeOptions, selectedBillingPeriod, selectedProduct]);
|
|
21223
21153
|
// Handlers
|
|
21224
21154
|
var onChangeBillingPeriod = useCallback(function (billingPeriod) {
|
|
21225
21155
|
var _a, _b;
|
|
21226
21156
|
setSelectedBillingPeriod(billingPeriod);
|
|
21227
21157
|
setPriceListStart(0);
|
|
21228
21158
|
if ((quotePreviewData === null || quotePreviewData === void 0 ? void 0 : quotePreviewData.priceList) &&
|
|
21229
|
-
billingPeriod !==
|
|
21230
|
-
|
|
21231
|
-
var availablePriceLists_1 = ((_b = planChangeOptions === null || planChangeOptions === void 0 ? void 0 : planChangeOptions.plans) === null || _b === void 0 ? void 0 : _b.flatMap(function (plan) {
|
|
21232
|
-
return plan.priceLists.filter(function (priceList) {
|
|
21233
|
-
return periodMonthsConverter(priceList.periodMonths) === billingPeriod;
|
|
21234
|
-
});
|
|
21235
|
-
})) || [];
|
|
21159
|
+
billingPeriod !== periodMonthsConverter((_a = quotePreviewData === null || quotePreviewData === void 0 ? void 0 : quotePreviewData.priceList) === null || _a === void 0 ? void 0 : _a.periodMonths)) {
|
|
21160
|
+
var availablePriceLists_1 = ((_b = priceListChangeOptions === null || priceListChangeOptions === void 0 ? void 0 : priceListChangeOptions.priceLists) === null || _b === void 0 ? void 0 : _b.filter(function (priceList) { return periodMonthsConverter(priceList.periodMonths) === billingPeriod; })) || [];
|
|
21236
21161
|
var newSelectedPriceList = availablePriceLists_1.find(function (priceList) {
|
|
21237
21162
|
var _a;
|
|
21238
21163
|
return periodMonthsConverter(priceList.periodMonths) === billingPeriod &&
|
|
@@ -21243,8 +21168,7 @@ var PriceListSelector = function (_a) {
|
|
|
21243
21168
|
upgradingSubscription: upgradingSubscription,
|
|
21244
21169
|
});
|
|
21245
21170
|
});
|
|
21246
|
-
var isPriceListCurrentSubscription = newSelectedPriceList &&
|
|
21247
|
-
(upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.priceList.id) === newSelectedPriceList.id;
|
|
21171
|
+
var isPriceListCurrentSubscription = newSelectedPriceList && (upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.priceList.id) === newSelectedPriceList.id;
|
|
21248
21172
|
if (newSelectedPriceList && !isPriceListCurrentSubscription) {
|
|
21249
21173
|
setQuotePreviewData({
|
|
21250
21174
|
priceList: newSelectedPriceList,
|
|
@@ -21259,32 +21183,30 @@ var PriceListSelector = function (_a) {
|
|
|
21259
21183
|
}
|
|
21260
21184
|
}, [
|
|
21261
21185
|
quotePreviewData,
|
|
21262
|
-
|
|
21186
|
+
priceListChangeOptions,
|
|
21263
21187
|
subscriptions,
|
|
21264
21188
|
upgradingSubscription,
|
|
21265
21189
|
setQuotePreviewData,
|
|
21266
21190
|
]);
|
|
21267
21191
|
var onChangeProduct = useCallback(function (product) {
|
|
21268
|
-
var newAvailableBillingPeriods = createAvailableBillingPeriods(
|
|
21192
|
+
var newAvailableBillingPeriods = createAvailableBillingPeriods(priceListChangeOptions === null || priceListChangeOptions === void 0 ? void 0 : priceListChangeOptions.priceLists, product);
|
|
21269
21193
|
if (!(newAvailableBillingPeriods === null || newAvailableBillingPeriods === void 0 ? void 0 : newAvailableBillingPeriods.includes(billingPeriodConverter(selectedBillingPeriod)))) {
|
|
21270
|
-
onChangeBillingPeriod(periodMonthsConverter((newAvailableBillingPeriods === null || newAvailableBillingPeriods === void 0 ? void 0 : newAvailableBillingPeriods[0]) !== undefined
|
|
21271
|
-
? newAvailableBillingPeriods[0]
|
|
21272
|
-
: 1));
|
|
21194
|
+
onChangeBillingPeriod(periodMonthsConverter((newAvailableBillingPeriods === null || newAvailableBillingPeriods === void 0 ? void 0 : newAvailableBillingPeriods[0]) !== undefined ? newAvailableBillingPeriods[0] : 1));
|
|
21273
21195
|
}
|
|
21274
21196
|
setSelectedProduct(product);
|
|
21275
|
-
}, [
|
|
21197
|
+
}, [priceListChangeOptions, selectedBillingPeriod, onChangeBillingPeriod]);
|
|
21276
21198
|
// Default settings
|
|
21277
21199
|
useEffect(function () {
|
|
21278
21200
|
var _a, _b, _c, _d;
|
|
21279
21201
|
if (arePlanChangeOptionsLoading ||
|
|
21280
21202
|
areSubscriptionsLoading ||
|
|
21281
|
-
!
|
|
21203
|
+
!priceListChangeOptions ||
|
|
21282
21204
|
selectedBillingPeriod ||
|
|
21283
21205
|
selectedProduct ||
|
|
21284
21206
|
selectedPriceList)
|
|
21285
21207
|
return;
|
|
21286
|
-
var initialProduct = (_a =
|
|
21287
|
-
var initialAvailableBillingPeriods = createAvailableBillingPeriods(
|
|
21208
|
+
var initialProduct = (_a = priceListChangeOptions === null || priceListChangeOptions === void 0 ? void 0 : priceListChangeOptions.products) === null || _a === void 0 ? void 0 : _a[0];
|
|
21209
|
+
var initialAvailableBillingPeriods = createAvailableBillingPeriods(priceListChangeOptions === null || priceListChangeOptions === void 0 ? void 0 : priceListChangeOptions.priceLists, initialProduct);
|
|
21288
21210
|
var initialBillingPeriod;
|
|
21289
21211
|
if ((upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.priceList) &&
|
|
21290
21212
|
(initialAvailableBillingPeriods === null || initialAvailableBillingPeriods === void 0 ? void 0 : initialAvailableBillingPeriods.includes(billingPeriodConverter(periodMonthsConverter(upgradingSubscription.priceList.periodMonths))))) {
|
|
@@ -21293,12 +21215,9 @@ var PriceListSelector = function (_a) {
|
|
|
21293
21215
|
else {
|
|
21294
21216
|
initialBillingPeriod = periodMonthsConverter((initialAvailableBillingPeriods === null || initialAvailableBillingPeriods === void 0 ? void 0 : initialAvailableBillingPeriods[0]) || 1);
|
|
21295
21217
|
}
|
|
21296
|
-
var initialAvailablePriceLists = ((_b =
|
|
21297
|
-
return
|
|
21298
|
-
|
|
21299
|
-
initialBillingPeriod &&
|
|
21300
|
-
priceList.product.id === (initialProduct === null || initialProduct === void 0 ? void 0 : initialProduct.id);
|
|
21301
|
-
});
|
|
21218
|
+
var initialAvailablePriceLists = ((_b = priceListChangeOptions === null || priceListChangeOptions === void 0 ? void 0 : priceListChangeOptions.priceLists) === null || _b === void 0 ? void 0 : _b.filter(function (priceList) {
|
|
21219
|
+
return periodMonthsConverter(priceList.periodMonths) === initialBillingPeriod &&
|
|
21220
|
+
priceList.product.id === (initialProduct === null || initialProduct === void 0 ? void 0 : initialProduct.id);
|
|
21302
21221
|
})) || [];
|
|
21303
21222
|
var initialPriceList;
|
|
21304
21223
|
var initialQuantity = (_d = (_c = upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.charges) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.quantity;
|
|
@@ -21325,7 +21244,7 @@ var PriceListSelector = function (_a) {
|
|
|
21325
21244
|
arePlanChangeOptionsLoading,
|
|
21326
21245
|
areSubscriptionsLoading,
|
|
21327
21246
|
isInPreviewMode,
|
|
21328
|
-
|
|
21247
|
+
priceListChangeOptions,
|
|
21329
21248
|
selectedBillingPeriod,
|
|
21330
21249
|
selectedPriceList,
|
|
21331
21250
|
selectedProduct,
|
|
@@ -21333,7 +21252,7 @@ var PriceListSelector = function (_a) {
|
|
|
21333
21252
|
subscriptions,
|
|
21334
21253
|
upgradingSubscription,
|
|
21335
21254
|
]);
|
|
21336
|
-
return (jsxs(Fragment, { children: [jsx(BillingPeriodSelector, { availableBillingPeriods: availableBillingPeriods, onChangeBillingPeriod: onChangeBillingPeriod, products:
|
|
21255
|
+
return (jsxs(Fragment, { children: [jsx(BillingPeriodSelector, { availableBillingPeriods: availableBillingPeriods, onChangeBillingPeriod: onChangeBillingPeriod, products: priceListChangeOptions === null || priceListChangeOptions === void 0 ? void 0 : priceListChangeOptions.products, selectedBillingPeriod: selectedBillingPeriod, selectedProduct: selectedProduct, onChangeProduct: onChangeProduct }), jsx(PriceListGrid, { availablePriceLists: availablePriceLists, onChangePriceList: onChangePriceList, priceListChangeOptions: priceListChangeOptions, priceListStart: priceListStart, selectedPriceList: selectedPriceList, selectedProduct: selectedProduct, setPriceListStart: setPriceListStart, subscriptions: subscriptions, upgradingSubscriptionState: upgradingSubscription })] }));
|
|
21337
21256
|
};
|
|
21338
21257
|
|
|
21339
21258
|
var PlanPicker = function () {
|
|
@@ -21359,27 +21278,16 @@ var PlanPicker = function () {
|
|
|
21359
21278
|
token: token,
|
|
21360
21279
|
}),
|
|
21361
21280
|
queryFn: function () {
|
|
21362
|
-
return
|
|
21281
|
+
return getPriceListChangeOptions({
|
|
21282
|
+
apiHost: apiHost,
|
|
21363
21283
|
isInPreviewMode: isInPreviewMode,
|
|
21284
|
+
productId: productId,
|
|
21364
21285
|
token: token,
|
|
21365
21286
|
upgradingSubscription: upgradingSubscription,
|
|
21366
|
-
apiHost: apiHost,
|
|
21367
21287
|
});
|
|
21368
21288
|
},
|
|
21369
21289
|
enabled: !areSubscriptionsLoading,
|
|
21370
|
-
}),
|
|
21371
|
-
var previewDataQuery = useQuery({
|
|
21372
|
-
queryKey: QueryKeyFactory.default.createTableKey({
|
|
21373
|
-
pluralType: "portalPreview",
|
|
21374
|
-
filterString: productId || "",
|
|
21375
|
-
token: token,
|
|
21376
|
-
}),
|
|
21377
|
-
queryFn: function () { return getPortalPreviewData(productId || "", apiHost, token); },
|
|
21378
|
-
enabled: isInPreviewMode,
|
|
21379
|
-
});
|
|
21380
|
-
var planChangeOptions = useMemo(function () {
|
|
21381
|
-
return isInPreviewMode ? previewDataQuery.data : data;
|
|
21382
|
-
}, [isInPreviewMode, previewDataQuery.data, data]);
|
|
21290
|
+
}), priceListChangeOptions = _d.data, arePlanChangeOptionsLoading = _d.isLoading;
|
|
21383
21291
|
// Handlers
|
|
21384
21292
|
var onChangePriceList = useCallback(function (selectedPriceList) {
|
|
21385
21293
|
if (isInPreviewMode)
|
|
@@ -21395,16 +21303,16 @@ var PlanPicker = function () {
|
|
|
21395
21303
|
setQuotePreviewData({});
|
|
21396
21304
|
};
|
|
21397
21305
|
}, [setQuotePreviewData]);
|
|
21398
|
-
if (queryClient.
|
|
21399
|
-
|
|
21400
|
-
|
|
21401
|
-
|
|
21306
|
+
if (queryClient.isFetching({
|
|
21307
|
+
queryKey: QueryKeyFactory.default.planChangeOptionsKey({
|
|
21308
|
+
subscriptionId: upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.id,
|
|
21309
|
+
token: token,
|
|
21310
|
+
}),
|
|
21311
|
+
}))
|
|
21402
21312
|
return jsx(Fragment, {});
|
|
21403
|
-
|
|
21404
|
-
else if (((_a = planChangeOptions === null || planChangeOptions === void 0 ? void 0 : planChangeOptions.plans) === null || _a === void 0 ? void 0 : _a.length) === 0) {
|
|
21313
|
+
else if (((_a = priceListChangeOptions === null || priceListChangeOptions === void 0 ? void 0 : priceListChangeOptions.priceLists) === null || _a === void 0 ? void 0 : _a.length) === 0)
|
|
21405
21314
|
return jsx(ErrorView, { message: "There are no plans available" });
|
|
21406
|
-
}
|
|
21407
|
-
return (jsx(PriceListSelector, { arePlanChangeOptionsLoading: arePlanChangeOptionsLoading, areSubscriptionsLoading: areSubscriptionsLoading, onChangePriceList: onChangePriceList, planChangeOptions: planChangeOptions, selectedPriceList: quotePreviewData === null || quotePreviewData === void 0 ? void 0 : quotePreviewData.priceList, subscriptions: subscriptions }));
|
|
21315
|
+
return (jsx(PriceListSelector, { arePlanChangeOptionsLoading: arePlanChangeOptionsLoading, areSubscriptionsLoading: areSubscriptionsLoading, onChangePriceList: onChangePriceList, priceListChangeOptions: priceListChangeOptions, selectedPriceList: quotePreviewData === null || quotePreviewData === void 0 ? void 0 : quotePreviewData.priceList, subscriptions: subscriptions }));
|
|
21408
21316
|
};
|
|
21409
21317
|
|
|
21410
21318
|
var Text$8 = Typography.Text;
|
|
@@ -21451,25 +21359,16 @@ var PlanManager = function (_a) {
|
|
|
21451
21359
|
token: token,
|
|
21452
21360
|
}),
|
|
21453
21361
|
queryFn: function () {
|
|
21454
|
-
return (editingQuoteData === null || editingQuoteData === void 0 ? void 0 : editingQuoteData.id)
|
|
21455
|
-
? getQuote({ token: token, id: editingQuoteData.id, apiHost: apiHost })
|
|
21456
|
-
: undefined;
|
|
21362
|
+
return (editingQuoteData === null || editingQuoteData === void 0 ? void 0 : editingQuoteData.id) ? getQuote({ token: token, id: editingQuoteData.id, apiHost: apiHost }) : undefined;
|
|
21457
21363
|
},
|
|
21458
21364
|
enabled: Boolean(editingQuoteData === null || editingQuoteData === void 0 ? void 0 : editingQuoteData.id),
|
|
21459
21365
|
}).data;
|
|
21460
21366
|
useEffect(function () {
|
|
21461
21367
|
if (subscriptionUpgradeId && !upgradingSubscription) {
|
|
21462
|
-
var subscription = subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.find(function (subscription) {
|
|
21463
|
-
return subscription.id === subscriptionUpgradeId;
|
|
21464
|
-
});
|
|
21368
|
+
var subscription = subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.find(function (subscription) { return subscription.id === subscriptionUpgradeId; });
|
|
21465
21369
|
setUpgradingSubscription(subscription);
|
|
21466
21370
|
}
|
|
21467
|
-
}, [
|
|
21468
|
-
setUpgradingSubscription,
|
|
21469
|
-
subscriptionUpgradeId,
|
|
21470
|
-
subscriptions,
|
|
21471
|
-
upgradingSubscription,
|
|
21472
|
-
]);
|
|
21371
|
+
}, [setUpgradingSubscription, subscriptionUpgradeId, subscriptions, upgradingSubscription]);
|
|
21473
21372
|
useEffect(function () {
|
|
21474
21373
|
var observer = new IntersectionObserver(function (_a) {
|
|
21475
21374
|
var entry = _a[0];
|
|
@@ -21718,10 +21617,10 @@ var canShowSubscriptionActions = function (subscription) {
|
|
|
21718
21617
|
|
|
21719
21618
|
var SubscriptionCardActions = function (_a) {
|
|
21720
21619
|
var _b, _c;
|
|
21721
|
-
var onChangePlanClick = _a.onChangePlanClick, onCancelSubscriptionClick = _a.onCancelSubscriptionClick,
|
|
21620
|
+
var onChangePlanClick = _a.onChangePlanClick, onCancelSubscriptionClick = _a.onCancelSubscriptionClick, priceListChangeOptions = _a.priceListChangeOptions, subscription = _a.subscription;
|
|
21722
21621
|
// Derived state
|
|
21723
21622
|
var canShowCancelButton = subscription.plan.selfServiceCancel;
|
|
21724
|
-
var productPlans = (_b =
|
|
21623
|
+
var productPlans = (_b = priceListChangeOptions === null || priceListChangeOptions === void 0 ? void 0 : priceListChangeOptions.priceLists) === null || _b === void 0 ? void 0 : _b.filter(function (priceList) { return priceList.productId === subscription.product.id; });
|
|
21725
21624
|
var canShowChangePlanButton = ((productPlans === null || productPlans === void 0 ? void 0 : productPlans.length) || 0) > 0;
|
|
21726
21625
|
return (canShowChangePlanButton || canShowCancelButton) &&
|
|
21727
21626
|
canShowSubscriptionActions(subscription) ? (jsxs(Fragment, { children: [canShowCancelButton && (jsx(Popconfirm, __assign({ icon: null, onConfirm: function () { return onCancelSubscriptionClick === null || onCancelSubscriptionClick === void 0 ? void 0 : onCancelSubscriptionClick(subscription); }, title: "Cancel subscription" }, { children: jsx(Button, __assign({ className: "p-0", type: "link" }, { children: "Cancel subscription" })) }))), canShowChangePlanButton && (jsx(Button, __assign({ onClick: function () { return onChangePlanClick(subscription); }, type: "primary" }, { children: "Change plan" })))] })) : ((_c = subscription.state) === null || _c === void 0 ? void 0 : _c.toUpperCase()) === SubscriptionState$2.TRIAL ? (jsx(Button, __assign({ onClick: function () { return onChangePlanClick(subscription); }, type: "primary" }, { children: "Upgrade" }))) : null;
|
|
@@ -21746,7 +21645,7 @@ var getSubscriptionStatusText = function (subscription) {
|
|
|
21746
21645
|
};
|
|
21747
21646
|
var SubscriptionCardHeader = function (_a) {
|
|
21748
21647
|
var _b, _c, _d, _e, _f;
|
|
21749
|
-
var onChangePlanClick = _a.onChangePlanClick, onCancelSubscriptionClick = _a.onCancelSubscriptionClick,
|
|
21648
|
+
var onChangePlanClick = _a.onChangePlanClick, onCancelSubscriptionClick = _a.onCancelSubscriptionClick, priceListChangeOptions = _a.priceListChangeOptions, subscription = _a.subscription;
|
|
21750
21649
|
var darkMode = useContext(BunnyContext).darkMode;
|
|
21751
21650
|
var brandColor = useContext(BrandContext).brandColor;
|
|
21752
21651
|
var subscriptionProductNameStyle = useContext(SubscriptionsContext).subscriptionProductNameStyle;
|
|
@@ -21756,10 +21655,7 @@ var SubscriptionCardHeader = function (_a) {
|
|
|
21756
21655
|
var isTrial = ((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === SubscriptionState$2.TRIAL;
|
|
21757
21656
|
return (jsxs("div", __assign({ className: "flex items-center justify-between", style: {
|
|
21758
21657
|
backgroundColor: darkMode ? "var(--row-background-dark)" : "",
|
|
21759
|
-
} }, { children: [jsxs("div", __assign({ className: "flex flex-col 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: "flex grow items-center gap-2" }, { children: [((_e = subscription === null || subscription === void 0 ? void 0 : subscription.plan) === null || _e === void 0 ? void 0 : _e.name) &&
|
|
21760
|
-
planChangeOptions &&
|
|
21761
|
-
onChangePlanClick &&
|
|
21762
|
-
onCancelSubscriptionClick && (jsx(SubscriptionCardActions, { onChangePlanClick: onChangePlanClick, onCancelSubscriptionClick: onCancelSubscriptionClick, planChangeOptions: planChangeOptions, subscription: subscription }))] }))] })));
|
|
21658
|
+
} }, { children: [jsxs("div", __assign({ className: "flex flex-col 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: "flex grow items-center 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: "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: "flex items-center gap-6" }, { children: [jsx(Text$7, __assign({ className: "grow text-xs" }, { children: getSubscriptionStatusText(subscription) })), !isMobile && priceListChangeOptions && onChangePlanClick && onCancelSubscriptionClick && (jsx(SubscriptionCardActions, { onChangePlanClick: onChangePlanClick, onCancelSubscriptionClick: onCancelSubscriptionClick, priceListChangeOptions: priceListChangeOptions, subscription: subscription }))] }))] })));
|
|
21763
21659
|
};
|
|
21764
21660
|
|
|
21765
21661
|
var BillingPeriodConverter;
|
|
@@ -21853,11 +21749,11 @@ var CARD_COLUMNS = [
|
|
|
21853
21749
|
];
|
|
21854
21750
|
var SubscriptionCardDesktop = function (_a) {
|
|
21855
21751
|
var _b;
|
|
21856
|
-
var onChangePlanClick = _a.onChangePlanClick, onCancelSubscriptionClick = _a.onCancelSubscriptionClick,
|
|
21752
|
+
var onChangePlanClick = _a.onChangePlanClick, onCancelSubscriptionClick = _a.onCancelSubscriptionClick, priceListChangeOptions = _a.priceListChangeOptions, subscription = _a.subscription;
|
|
21857
21753
|
var shadow = useContext(SubscriptionsContext).shadow;
|
|
21858
21754
|
// Derived state
|
|
21859
21755
|
var isTrial = ((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === SubscriptionState$1.TRIAL;
|
|
21860
|
-
return (jsxs(Card, __assign({ className: "p-4 ".concat(shadow ? "shadow-".concat(shadow) : "") }, { children: [jsx(SubscriptionCardHeader, { onChangePlanClick: onChangePlanClick, onCancelSubscriptionClick: onCancelSubscriptionClick,
|
|
21756
|
+
return (jsxs(Card, __assign({ className: "p-4 ".concat(shadow ? "shadow-".concat(shadow) : "") }, { children: [jsx(SubscriptionCardHeader, { onChangePlanClick: onChangePlanClick, onCancelSubscriptionClick: onCancelSubscriptionClick, priceListChangeOptions: priceListChangeOptions, subscription: subscription }), jsx(Divider, { className: "my-4", style: {
|
|
21861
21757
|
gridColumn: "1 / 5",
|
|
21862
21758
|
width: "calc(100% + 32px)",
|
|
21863
21759
|
transform: "translateX(-16px)",
|
|
@@ -21964,14 +21860,14 @@ var SubscriptionCard = function (_a) {
|
|
|
21964
21860
|
};
|
|
21965
21861
|
|
|
21966
21862
|
var SubscriptionsList = function (_a) {
|
|
21967
|
-
var hideExpired = _a.hideExpired, onChangePlanClick = _a.onChangePlanClick, onCancelSubscriptionClick = _a.onCancelSubscriptionClick,
|
|
21863
|
+
var hideExpired = _a.hideExpired, onChangePlanClick = _a.onChangePlanClick, onCancelSubscriptionClick = _a.onCancelSubscriptionClick, priceListChangeOptions = _a.priceListChangeOptions, subscriptions = _a.subscriptions;
|
|
21968
21864
|
var isMobile = useIsMobile();
|
|
21969
21865
|
return (jsx(Fragment, { children: subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.map(function (subscription, subscriptionIndex) {
|
|
21970
21866
|
if (hideExpired && isSubscriptionNotActive(subscription))
|
|
21971
21867
|
return null;
|
|
21972
21868
|
if (isMobile)
|
|
21973
|
-
return
|
|
21974
|
-
return (jsx(SubscriptionCardDesktop, { onChangePlanClick: onChangePlanClick, onCancelSubscriptionClick: onCancelSubscriptionClick,
|
|
21869
|
+
return jsx(SubscriptionCard, { subscription: subscription }, subscriptionIndex);
|
|
21870
|
+
return (jsx(SubscriptionCardDesktop, { onChangePlanClick: onChangePlanClick, onCancelSubscriptionClick: onCancelSubscriptionClick, priceListChangeOptions: priceListChangeOptions, subscription: subscription }, subscriptionIndex));
|
|
21975
21871
|
}) }));
|
|
21976
21872
|
};
|
|
21977
21873
|
|
|
@@ -21987,13 +21883,13 @@ var SubscriptionsListContainer = function (_a) {
|
|
|
21987
21883
|
// Queries
|
|
21988
21884
|
var _c = useQuery({
|
|
21989
21885
|
queryKey: QueryKeyFactory.default.planChangeOptionsKey({ token: token }),
|
|
21990
|
-
queryFn: function () { return
|
|
21886
|
+
queryFn: function () { return getPriceListChangeOptions({ token: token, apiHost: apiHost }); },
|
|
21991
21887
|
enabled: Boolean(onChangePlanClick),
|
|
21992
|
-
}),
|
|
21888
|
+
}), priceListChangeOptions = _c.data, arePriceListChangeOptionsLoading = _c.isLoading;
|
|
21993
21889
|
if (subscriptionsAreLoading ||
|
|
21994
|
-
(Boolean(onChangePlanClick) ?
|
|
21890
|
+
(Boolean(onChangePlanClick) ? arePriceListChangeOptionsLoading : false))
|
|
21995
21891
|
return jsx(Fragment, {});
|
|
21996
|
-
return (jsx(Fragment, { children: (subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.length) > 0 ? (jsx("div", __assign({ className: "flex flex-col gap-".concat(gap, " shrink overflow-auto") }, { children: jsx(SubscriptionsList, { hideExpired: hideExpired, onChangePlanClick: onChangePlanClick, onCancelSubscriptionClick: onCancelSubscriptionClick,
|
|
21892
|
+
return (jsx(Fragment, { children: (subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.length) > 0 ? (jsx("div", __assign({ className: "flex flex-col gap-".concat(gap, " shrink overflow-auto") }, { children: jsx(SubscriptionsList, { hideExpired: hideExpired, onChangePlanClick: onChangePlanClick, onCancelSubscriptionClick: onCancelSubscriptionClick, priceListChangeOptions: priceListChangeOptions, subscriptions: subscriptions }) }))) : (noSubscriptionsComponent || (jsx("div", __assign({ className: "flex flex-col items-center w-full" }, { children: jsx(ErrorView, { message: "You have no subscriptions with ".concat(companyName, " yet") }) })))) }));
|
|
21997
21893
|
};
|
|
21998
21894
|
|
|
21999
21895
|
var QUOTE_CHARGE_CREATE = "\nmutation QuoteChargeCreate ($quoteChangeId: ID!, $startDate: ISO8601Date!, $endDate: ISO8601Date, $priceListChargeId: ID, $subscriptionChargeId: ID, $price: Float, $quantity: Int) {\n quoteChargeCreate(\n endDate: $endDate\n price: $price\n priceListChargeId: $priceListChargeId\n quantity: $quantity\n quoteChangeId: $quoteChangeId\n startDate: $startDate\n subscriptionChargeId: $subscriptionChargeId\n ) {\n quoteCharge {\n quoteChange {\n id\n quoteId\n }\n }\n }\n}\n\n";
|