@bunnyapp/components 1.0.49 → 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.
Files changed (52) hide show
  1. package/dist/cjs/index.js +300 -400
  2. package/dist/cjs/src/components/Signup/Signup.d.ts +3 -1
  3. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/PriceListGrid.d.ts +3 -3
  4. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/PriceListSelector.d.ts +3 -3
  5. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/planPickerDesktop/EverythingPlanFeatures.d.ts +3 -3
  6. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/planPickerDesktop/PlanFeatures.d.ts +2 -3
  7. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/planPickerDesktop/PriceListCardDesktop.d.ts +2 -3
  8. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/planPickerDesktop/PriceListGridDesktop.d.ts +5 -4
  9. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/planPickerMobile/PriceListCardMobile.d.ts +2 -3
  10. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/planPickerMobile/PriceListGridMobile.d.ts +4 -4
  11. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/planPickerUtils.d.ts +6 -6
  12. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/PriceListCard.d.ts +2 -3
  13. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/PriceListCardButton.d.ts +3 -3
  14. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/PriceListCardFeature.d.ts +3 -3
  15. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/PriceListCardPrice.d.ts +2 -3
  16. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/PriceListCardPriceDescription.d.ts +2 -3
  17. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/PriceListCardTitle.d.ts +3 -3
  18. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/priceListCardUtils.d.ts +3 -3
  19. package/dist/cjs/src/components/Subscriptions/subscriptionsList/SubscriptionCardActions.d.ts +3 -3
  20. package/dist/cjs/src/components/Subscriptions/subscriptionsList/SubscriptionCardHeader.d.ts +3 -3
  21. package/dist/cjs/src/components/Subscriptions/subscriptionsList/SubscriptionsList.d.ts +3 -3
  22. package/dist/cjs/src/components/Subscriptions/subscriptionsList/subscriptionCardDesktop/SubscriptionCardDesktop.d.ts +3 -3
  23. package/dist/cjs/src/graphql/mutations/accountSignup.d.ts +2 -1
  24. package/dist/cjs/src/graphql/mutations/quoteAccountSignup.d.ts +2 -1
  25. package/dist/cjs/src/graphql/queries/getPriceListChangeOptions.d.ts +9 -0
  26. package/dist/esm/index.js +300 -400
  27. package/dist/esm/src/components/Signup/Signup.d.ts +3 -1
  28. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/PriceListGrid.d.ts +3 -3
  29. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/PriceListSelector.d.ts +3 -3
  30. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/planPickerDesktop/EverythingPlanFeatures.d.ts +3 -3
  31. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/planPickerDesktop/PlanFeatures.d.ts +2 -3
  32. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/planPickerDesktop/PriceListCardDesktop.d.ts +2 -3
  33. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/planPickerDesktop/PriceListGridDesktop.d.ts +5 -4
  34. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/planPickerMobile/PriceListCardMobile.d.ts +2 -3
  35. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/planPickerMobile/PriceListGridMobile.d.ts +4 -4
  36. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/planPickerUtils.d.ts +6 -6
  37. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/PriceListCard.d.ts +2 -3
  38. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/PriceListCardButton.d.ts +3 -3
  39. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/PriceListCardFeature.d.ts +3 -3
  40. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/PriceListCardPrice.d.ts +2 -3
  41. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/PriceListCardPriceDescription.d.ts +2 -3
  42. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/PriceListCardTitle.d.ts +3 -3
  43. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/priceListCardUtils.d.ts +3 -3
  44. package/dist/esm/src/components/Subscriptions/subscriptionsList/SubscriptionCardActions.d.ts +3 -3
  45. package/dist/esm/src/components/Subscriptions/subscriptionsList/SubscriptionCardHeader.d.ts +3 -3
  46. package/dist/esm/src/components/Subscriptions/subscriptionsList/SubscriptionsList.d.ts +3 -3
  47. package/dist/esm/src/components/Subscriptions/subscriptionsList/subscriptionCardDesktop/SubscriptionCardDesktop.d.ts +3 -3
  48. package/dist/esm/src/graphql/mutations/accountSignup.d.ts +2 -1
  49. package/dist/esm/src/graphql/mutations/quoteAccountSignup.d.ts +2 -1
  50. package/dist/esm/src/graphql/queries/getPriceListChangeOptions.d.ts +9 -0
  51. package/dist/index.d.ts +3 -1
  52. 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$q = Typography.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$q, { 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 }))] }))] }))] })));
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$q, { 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$q, __assign({ className: "relative -top-0.5" }, { children: "****" })), jsx(Text$q, { 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$q, __assign({ className: "text-slate-400", style: { fontSize: "12px" } }, { children: "No payment method selected" })), jsx(Button, { disabled: true, type: "link" })] }))) })));
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$q, { children: 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$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$p = Typography.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$p, { children: "DemoPay is for testing only." }), jsx(SavePaymentMethodFooter, { isSaving: isSaving, onSave: onSave })] })));
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$o = Typography.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$o, { children: name })] })), isAch ? (jsx(BankOutlined, { className: "text-slate-400" })) : isCard ? (jsx(CardIcon, {})) : (jsx(CardIcon, {}))] })));
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$n = Typography.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$n, { children: "Quote was accepted by ".concat(formattedQuote.acceptedByName, " on ").concat(formatDate(formattedQuote.acceptedAt)) })) : null, (!isMobile || !isAccepted) && (jsxs("div", __assign({ className: isMobile
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$m = Typography.Text;
19188
+ var Text$k = Typography.Text;
19189
19189
  var TransactionDate = function (_a) {
19190
19190
  var date = _a.date;
19191
- return jsx(Text$m, __assign({ className: "text-sm" }, { children: formatDate(date) }));
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$l = Typography.Text;
19228
+ var Text$j = Typography.Text;
19229
19229
  var TransactionsEmptyState = function () {
19230
19230
  var noTransactionsMessage = useContext(TransactionsListContext).noTransactionsMessage;
19231
- return (jsx(Text$l, __assign({ className: "flex justify-center p-4 text-base" }, { children: noTransactionsMessage || "There are no transactions" })));
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$k = Typography.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$k, { 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$k, { children: lodashExports.capitalize(transaction.kind.toLowerCase()) }), jsx(TransactionRowTitle, { transaction: transaction })] })) })), showAccountName && (jsx(TransactionGridCell, __assign({ right: false }, { children: jsx(Text$k, { 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$k, { 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));
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$j = Typography.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$j, { 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$j, { children: (_a = transaction.account) === null || _a === void 0 ? void 0 : _a.name }), showAccountName && showDate && jsx(Text$j, { children: "\u00B7" }), showDate && (jsx(TransactionDate, { date: transactionDateToDisplay(transaction, transactionDateType) })), showDate && showAmount && jsx(Text$j, { children: "\u00B7" }), showAmount && (jsx(Text$j, { children: formatCurrency(transaction.transactionable.amount ||
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$i = Typography.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$i, __assign({ className: "shrink-0 font-medium", style: { color: darkMode ? undefined : secondaryColor } }, { children: title }))) : (jsx("div", {}) // Empty div so justify-between works
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$h = Typography.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$h, __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 }))] })));
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) {
@@ -19649,9 +19649,9 @@ var PaymentMethodDisplay = function (_a) {
19649
19649
  }, title: jsx(DrawerHeader, { onClose: function () { return setShowModal(false); }, title: "New payment method", closeButtonClassName: "ant-drawer-close" }) }, { children: children })));
19650
19650
  };
19651
19651
 
19652
- var MUTATION$6 = function () { return "\nmutation AccountSignup (\n $pluginId: String!,\n $paymentMethodId: String,\n $priceListCode: String!,\n $accountId: ID!,\n $quoteId: ID!\n) {\n accountSignup(\n pluginId: $pluginId,\n paymentMethodId: $paymentMethodId,\n priceListCode: $priceListCode,\n accountId: $accountId,\n quoteId: $quoteId\n ) {\n errors\n quote {\n acceptedByName\n acceptedByTitle\n accountId\n amount\n amountDue\n applicationDate\n applied\n backdatedPeriods\n backdatedQuote\n billingDay\n contactId\n createdAt\n credits\n currencyId\n dealId\n discount\n discountValue\n endDate\n evergreen\n expiresAt\n id\n invoiceImmediately\n invoiceImmediatelyAvailable\n invoiceUntil\n isPendingApprovalRequest\n kind\n message\n name\n netPaymentDays\n notes\n number\n ownerId\n payableId\n periodAmount\n poNumber\n requiresApproval\n smallUnitAmountDue\n splitInvoice\n startDate\n state\n subtotal\n taxAmount\n taxCode\n updatedAt\n uuid\n }\n }\n}"; };
19652
+ var MUTATION$6 = function () { return "\nmutation AccountSignup (\n $pluginId: String!,\n $paymentMethodId: String,\n $priceListCode: String!,\n $accountId: ID!,\n $quoteId: ID!,\n $entityId: ID!\n) {\n accountSignup(\n pluginId: $pluginId,\n paymentMethodId: $paymentMethodId,\n priceListCode: $priceListCode,\n accountId: $accountId,\n quoteId: $quoteId,\n entityId: $entityId\n ) {\n errors\n quote {\n acceptedByName\n acceptedByTitle\n accountId\n amount\n amountDue\n applicationDate\n applied\n backdatedPeriods\n backdatedQuote\n billingDay\n contactId\n createdAt\n credits\n currencyId\n dealId\n discount\n discountValue\n endDate\n evergreen\n expiresAt\n id\n invoiceImmediately\n invoiceImmediatelyAvailable\n invoiceUntil\n isPendingApprovalRequest\n kind\n message\n name\n netPaymentDays\n notes\n number\n ownerId\n payableId\n periodAmount\n poNumber\n requiresApproval\n smallUnitAmountDue\n splitInvoice\n startDate\n state\n subtotal\n taxAmount\n taxCode\n updatedAt\n uuid\n }\n }\n}"; };
19653
19653
  var accountSignup = function (_a) {
19654
- var token = _a.token, apiHost = _a.apiHost, accountId = _a.accountId, quoteId = _a.quoteId, paymentToken = _a.paymentToken, paymentMethodId = _a.paymentMethodId, pluginId = _a.pluginId, priceListCode = _a.priceListCode;
19654
+ var token = _a.token, apiHost = _a.apiHost, accountId = _a.accountId, quoteId = _a.quoteId, paymentToken = _a.paymentToken, paymentMethodId = _a.paymentMethodId, pluginId = _a.pluginId, priceListCode = _a.priceListCode, entityId = _a.entityId;
19655
19655
  return __awaiter(void 0, void 0, void 0, function () {
19656
19656
  var vars, response, errors;
19657
19657
  var _b;
@@ -19665,6 +19665,7 @@ var accountSignup = function (_a) {
19665
19665
  pluginId: pluginId,
19666
19666
  paymentMethodId: paymentMethodId,
19667
19667
  priceListCode: priceListCode,
19668
+ entityId: entityId,
19668
19669
  };
19669
19670
  return [4 /*yield*/, gqlRequest({
19670
19671
  query: MUTATION$6(),
@@ -19683,9 +19684,9 @@ var accountSignup = function (_a) {
19683
19684
  });
19684
19685
  };
19685
19686
 
19686
- var MUTATION$5 = function () { return "\nmutation QuoteAccountSignup (\n $accountName: String!,\n $billingContact: ContactAttributes!,\n $priceListCode: String!\n) {\n quoteAccountSignup(\n priceListCode: $priceListCode,\n accountName: $accountName,\n billingContact: $billingContact\n ) {\n account {\n id\n }\n quote {\n acceptedByName\n acceptedByTitle\n accountId\n amount\n amountDue\n applicationDate\n applied\n backdatedPeriods\n backdatedQuote\n billingDay\n contactId\n createdAt\n credits\n currencyId\n dealId\n discount\n discountValue\n endDate\n evergreen\n expiresAt\n id\n invoiceImmediately\n invoiceImmediatelyAvailable\n invoiceUntil\n isPendingApprovalRequest\n kind\n message\n name\n netPaymentDays\n notes\n number\n ownerId\n payableId\n periodAmount\n poNumber\n requiresApproval\n smallUnitAmountDue\n splitInvoice\n startDate\n state\n subtotal\n taxAmount\n taxCode\n updatedAt\n uuid\n }\n tenant {\n code\n }\n portalSessionToken\n errors\n }\n}"; };
19687
+ var MUTATION$5 = function () { return "\nmutation QuoteAccountSignup (\n $accountName: String!,\n $billingContact: ContactAttributes!,\n $priceListCode: String!,\n $entityId: ID!\n) {\n quoteAccountSignup(\n priceListCode: $priceListCode,\n accountName: $accountName,\n billingContact: $billingContact,\n entityId: $entityId\n ) {\n account {\n id\n }\n quote {\n acceptedByName\n acceptedByTitle\n accountId\n amount\n amountDue\n applicationDate\n applied\n backdatedPeriods\n backdatedQuote\n billingDay\n contactId\n createdAt\n credits\n currencyId\n dealId\n discount\n discountValue\n endDate\n evergreen\n expiresAt\n id\n invoiceImmediately\n invoiceImmediatelyAvailable\n invoiceUntil\n isPendingApprovalRequest\n kind\n message\n name\n netPaymentDays\n notes\n number\n ownerId\n payableId\n periodAmount\n poNumber\n requiresApproval\n smallUnitAmountDue\n splitInvoice\n startDate\n state\n subtotal\n taxAmount\n taxCode\n updatedAt\n uuid\n }\n tenant {\n code\n }\n portalSessionToken\n errors\n }\n}"; };
19687
19688
  var quoteAccountSignup = function (_a) {
19688
- var token = _a.token, apiHost = _a.apiHost, priceListCode = _a.priceListCode, accountName = _a.accountName, billingContact = _a.billingContact;
19689
+ var token = _a.token, apiHost = _a.apiHost, priceListCode = _a.priceListCode, accountName = _a.accountName, billingContact = _a.billingContact, entityId = _a.entityId;
19689
19690
  return __awaiter(void 0, void 0, void 0, function () {
19690
19691
  var vars, response, errors;
19691
19692
  var _b;
@@ -19696,6 +19697,7 @@ var quoteAccountSignup = function (_a) {
19696
19697
  priceListCode: priceListCode,
19697
19698
  accountName: accountName,
19698
19699
  billingContact: billingContact,
19700
+ entityId: entityId,
19699
19701
  };
19700
19702
  return [4 /*yield*/, gqlRequest({
19701
19703
  query: MUTATION$5(),
@@ -19756,23 +19758,23 @@ function InitialSignupForm(_a) {
19756
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" })) })] })));
19757
19759
  }
19758
19760
 
19759
- var Title = Typography.Title, Text$g = Typography.Text;
19761
+ var Title = Typography.Title, Text$e = Typography.Text;
19760
19762
  function PaymentSuccessDisplay(_a) {
19761
19763
  var amountPaid = _a.amountPaid, className = _a.className, companyName = _a.companyName, returnUrl = _a.returnUrl, style = _a.style, currencyId = _a.currencyId;
19762
- 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$g, __assign({ className: "text-slate-500 cursor-pointer underline", onClick: function () { return (window.location.href = returnUrl); } }, { children: ["Back to ", companyName] })))] })));
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] })))] })));
19763
19765
  }
19764
19766
 
19765
- var Text$f = Typography.Text;
19767
+ var Text$d = Typography.Text;
19766
19768
  function PriceListDisplay(_a) {
19767
19769
  var priceListData = _a.priceListData, topNavImageUrl = _a.topNavImageUrl;
19768
19770
  if (!priceListData)
19769
19771
  return null;
19770
- 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$f, __assign({ className: "text-slate-500 font-bold text-lg" }, { children: priceListData.name })), jsxs(Text$f, __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$f, __assign({ style: { fontSize: "16px" }, className: "text-slate-500" }, { children: [priceListData.trialLengthDays, " day trial"] })), jsx(Text$f, __assign({ className: "text-slate-500", style: { fontSize: "12px" } }, { children: "You will not be charged until the last day of the trial." }))] }))) : 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$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] })) })) }));
19771
19773
  }
19772
19774
 
19773
19775
  var showErrorNotification = useErrorNotification();
19774
19776
  function Signup(_a) {
19775
- var companyName = _a.companyName, priceListCode = _a.priceListCode, returnUrl = _a.returnUrl, _b = _a.isCardEnabled, isCardEnabled = _b === void 0 ? true : _b, className = _a.className, _c = _a.shadow, shadow = _c === void 0 ? "shadow-md" : _c, style = _a.style;
19777
+ var companyName = _a.companyName, priceListCode = _a.priceListCode, returnUrl = _a.returnUrl, _b = _a.isCardEnabled, isCardEnabled = _b === void 0 ? true : _b, className = _a.className, _c = _a.shadow, shadow = _c === void 0 ? "shadow-md" : _c, style = _a.style, entityId = _a.entityId;
19776
19778
  // Hooks
19777
19779
  var _d = useContext(BunnyContext), apiHost = _d.apiHost, graphQLClient = _d.graphQLClient;
19778
19780
  var tokenFromContexts = useToken();
@@ -19814,6 +19816,7 @@ function Signup(_a) {
19814
19816
  lastName: formData.lastName,
19815
19817
  email: formData.email,
19816
19818
  },
19819
+ entityId: entityId,
19817
19820
  })];
19818
19821
  case 1:
19819
19822
  data = _a.sent();
@@ -19873,6 +19876,7 @@ function Signup(_a) {
19873
19876
  pluginId: plugin === null || plugin === void 0 ? void 0 : plugin.id.toString(),
19874
19877
  priceListCode: priceListCode,
19875
19878
  accountId: accountId,
19879
+ entityId: entityId,
19876
19880
  })];
19877
19881
  case 1: return [2 /*return*/, _a.sent()];
19878
19882
  }
@@ -19888,7 +19892,7 @@ function Signup(_a) {
19888
19892
  };
19889
19893
  return (jsx(WrapperComponent, __assign({ className: "p-4 flex flex-col ".concat(shadow, " ").concat(className), style: style }, { children: purchaseSucceeded ? (jsx(Fragment, { children: (quote === null || quote === void 0 ? void 0 : quote.currencyId) !== undefined ? (jsx(PaymentSuccessDisplay, { amountPaid: (quote === null || quote === void 0 ? void 0 : quote.amountDue) || 0, className: "w-full", companyName: companyName, returnUrl: returnUrl, currencyId: quote === null || quote === void 0 ? void 0 : quote.currencyId })) : (jsx("div", { children: "No currency ID found from Quote" })) })) : (jsxs("div", __assign({ className: "flex ".concat(isMobile ? "flex-col" : "flex-row", " h-full w-full") }, { children: [jsx("div", __assign({ className: "flex flex-col ".concat(isMobile ? "items-center" : "w-1/2 items-center") }, { children: jsx(PriceListDisplay, { priceListData: priceListData, topNavImageUrl: topNavImageUrl }) })), jsx("div", __assign({ className: "".concat(isMobile ? "h-full" : "my-4") }, { children: jsx(Divider, { className: "h-full", type: isMobile ? undefined : "vertical" }) })), jsx("div", __assign({ className: "flex ".concat(isMobile
19890
19894
  ? "items-center justify-center my-12"
19891
- : "w-1/2 items-center justify-center my-12") }, { children: jsx("div", __assign({ className: "".concat(isMobile ? "w-full" : "w-1/2") }, { children: jsx(PaymentForms, { quote: quote, handlePaymentSuccess: handlePaymentSuccess, handlePaymentFail: handlePaymentFail, handleSubmit: handleSubmit, proceedingToPayment: proceedingToPayment, accountId: accountId, overrideToken: portalSessionToken, customCheckoutFunction: accountSignupFunction }) })) }))] }))) })));
19895
+ : "w-1/2 items-center justify-center my-12") }, { children: jsx("div", __assign({ className: "".concat(isMobile ? "w-full" : "") }, { children: jsx(PaymentForms, { quote: quote, handlePaymentSuccess: handlePaymentSuccess, handlePaymentFail: handlePaymentFail, handleSubmit: handleSubmit, proceedingToPayment: proceedingToPayment, accountId: accountId, overrideToken: portalSessionToken, customCheckoutFunction: accountSignupFunction }) })) }))] }))) })));
19892
19896
  }
19893
19897
 
19894
19898
  var createRequestHeaders = function (token) {
@@ -20476,13 +20480,13 @@ var billingPeriodConverter = function (period) {
20476
20480
 
20477
20481
  var removeHTMLTagsRegex = /<br>(?=(?:\s*<[^>]*>)*$)|(<br>)|<[^>]*>/gi;
20478
20482
  // Description is a string that can contain HTML tags. We want to remove all HTML tags except <br> tags.
20479
- var createPlanDescription = function (plan) {
20480
- return (plan.description || "").replace(removeHTMLTagsRegex, function (x, y) {
20483
+ var createPlanDescription = function (priceList) {
20484
+ return (priceList.plan.description || "").replace(removeHTMLTagsRegex, function (x, y) {
20481
20485
  return y ? " & " : "";
20482
20486
  });
20483
20487
  };
20484
- var getActivePlanPriceData = function (plan, selectedPriceList) {
20485
- if (!plan) {
20488
+ var getActivePlanPriceData = function (priceList, selectedPriceList) {
20489
+ if (!priceList) {
20486
20490
  return;
20487
20491
  }
20488
20492
  // If a period option is selected, return the charge that matches the selected period option
@@ -20490,33 +20494,28 @@ var getActivePlanPriceData = function (plan, selectedPriceList) {
20490
20494
  // Default to first price list charge
20491
20495
  var lowestPLCharge;
20492
20496
  // Find the lowest price list charge with a billing period that matches the selected period option
20493
- for (var i = 0; i < plan.priceLists.length; i++) {
20494
- var priceList = plan.priceLists[i];
20495
- if (priceList.id === (selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id)) {
20496
- activeBillingPLCharge = priceList.charges[0];
20497
- break;
20498
- }
20499
- for (var j = 0; j < priceList.charges.length; j++) {
20500
- var charge = priceList.charges[j];
20501
- if (charge.chargeType === ChargeType.USAGE)
20502
- continue;
20503
- if (activeBillingPLCharge) {
20504
- // If we already found a charge with the same billing period check if this charge is lower
20505
- if (charge.basePrice < activeBillingPLCharge.basePrice &&
20506
- charge.billingPeriod === (activeBillingPLCharge === null || activeBillingPLCharge === void 0 ? void 0 : activeBillingPLCharge.billingPeriod)) {
20507
- activeBillingPLCharge = charge;
20508
- }
20509
- }
20510
- // If a period option is selected, only return the charge if it matches the selected period option
20511
- else if (selectedPriceList &&
20512
- charge.billingPeriod ===
20513
- 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)) {
20514
20508
  activeBillingPLCharge = charge;
20515
20509
  }
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;
20519
- }
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;
20520
20519
  }
20521
20520
  }
20522
20521
  return {
@@ -20536,8 +20535,7 @@ var isPriceListDisabled = function (_a) {
20536
20535
  var isPriceListCurrentSubscription = (upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.priceList.id) === priceList.id;
20537
20536
  // Is this plan the one that the user is upgrading from
20538
20537
  var isUpgradingPlan = (upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.plan.id) === priceList.plan.id;
20539
- if ((subscriptionPlan && !isUpgradingPlan) ||
20540
- isPriceListCurrentSubscription) {
20538
+ if ((subscriptionPlan && !isUpgradingPlan) || isPriceListCurrentSubscription) {
20541
20539
  disableOnClick = true;
20542
20540
  }
20543
20541
  return disableOnClick;
@@ -20562,7 +20560,7 @@ var CheckoutPrice = function (_a) {
20562
20560
  };
20563
20561
 
20564
20562
  var CheckoutBarSummarySection = function (_a) {
20565
- var _b, _c;
20563
+ var _b;
20566
20564
  var open = _a.open, quantityLocal = _a.quantityLocal, quote = _a.quote, selectedPriceList = _a.selectedPriceList, onClickCheckout = _a.onClickCheckout, upgradingSubscription = _a.upgradingSubscription, quotePreviewData = _a.quotePreviewData;
20567
20565
  // Context
20568
20566
  var apiHost = useContext(BunnyContext).apiHost;
@@ -20587,12 +20585,7 @@ var CheckoutBarSummarySection = function (_a) {
20587
20585
  isFetching ||
20588
20586
  selectedPriceList.id === (upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.priceList.id) ||
20589
20587
  open);
20590
- var planChangeOptions = queryClient.getQueryData(QueryKeyFactory.default.planChangeOptionsKey({
20591
- subscriptionId: upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.id,
20592
- token: token,
20593
- }));
20594
- 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); });
20595
- 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;
20596
20589
  var isUsage = (activeCharge === null || activeCharge === void 0 ? void 0 : activeCharge.chargeType) === ChargeType.USAGE;
20597
20590
  var hasPaymentMethodsOrIsFree = Boolean(paymentMethodAllowedPlugins === null || paymentMethodAllowedPlugins === void 0 ? void 0 : paymentMethodAllowedPlugins.length) ||
20598
20591
  Boolean(quote && getQuoteAmountDue(quote) === 0);
@@ -20734,64 +20727,35 @@ var PlanPickerCheckoutBar = function (_a) {
20734
20727
  };
20735
20728
 
20736
20729
  // WARNING: There is a preview button on APP that will need to be changed if this query is changed
20737
- var PLAN_CHANGE_OPTIONS_QUERY = "\n query planChangeOptions($subscriptionId: ID) {\n planChangeOptions(subscriptionId: $subscriptionId) {\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 plans {\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 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 productId\n }\n }\n }";
20738
- var getPlanChangeOptions = function (_a) {
20739
- var isInPreviewMode = _a.isInPreviewMode, token = _a.token, upgradingSubscription = _a.upgradingSubscription, apiHost = _a.apiHost;
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;
20740
20733
  return __awaiter(void 0, void 0, void 0, function () {
20741
- var response, planChangeOptions;
20734
+ var response, priceListChangeOptions;
20742
20735
  return __generator(this, function (_b) {
20743
20736
  switch (_b.label) {
20744
20737
  case 0: return [4 /*yield*/, gqlRequest({
20745
20738
  isInPreviewMode: isInPreviewMode,
20746
- query: PLAN_CHANGE_OPTIONS_QUERY,
20747
- 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 },
20748
20741
  token: token,
20749
20742
  apiHost: apiHost,
20750
20743
  })];
20751
20744
  case 1:
20752
20745
  response = _b.sent();
20753
- planChangeOptions = response.planChangeOptions;
20754
- if (planChangeOptions === null || planChangeOptions === void 0 ? void 0 : planChangeOptions.errors)
20755
- throw planChangeOptions.errors;
20746
+ priceListChangeOptions = response;
20747
+ if (priceListChangeOptions === null || priceListChangeOptions === void 0 ? void 0 : priceListChangeOptions.errors)
20748
+ throw priceListChangeOptions.errors;
20756
20749
  // Sort planChangeOptions.plans by position
20757
- if (planChangeOptions === null || planChangeOptions === void 0 ? void 0 : planChangeOptions.plans) {
20758
- planChangeOptions.plans.sort(function (a, b) { return a.position - b.position; });
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; });
20759
20752
  }
20760
- return [2 /*return*/, planChangeOptions];
20753
+ return [2 /*return*/, priceListChangeOptions];
20761
20754
  }
20762
20755
  });
20763
20756
  });
20764
20757
  };
20765
20758
 
20766
- 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}"); };
20767
- var getPortalPreviewData = function (id, apiHost, token) { return __awaiter(void 0, void 0, void 0, function () {
20768
- var response;
20769
- return __generator(this, function (_a) {
20770
- switch (_a.label) {
20771
- case 0: return [4 /*yield*/, gqlRequest({
20772
- isInPreviewMode: true,
20773
- query: portalPreviewQuery(id),
20774
- token: token || "",
20775
- apiHost: apiHost,
20776
- })];
20777
- case 1:
20778
- response = _a.sent();
20779
- if (response.product && response.plans) {
20780
- response.plans = response.plans.nodes;
20781
- response.products = [response.product];
20782
- delete response.product;
20783
- // Sort plans by position
20784
- if (response.plans) {
20785
- response.plans.sort(function (a, b) { return a.position - b.position; });
20786
- }
20787
- return [2 /*return*/, response];
20788
- }
20789
- else
20790
- throw response;
20791
- }
20792
- });
20793
- }); };
20794
-
20795
20759
  var ErrorView = function (_a) {
20796
20760
  var children = _a.children, message = _a.message;
20797
20761
  return (jsxs("div", __assign({ className: "flex flex-col w-full", style: { marginTop: "80px" } }, { children: [jsx("div", __assign({ style: { fontSize: "32px" } }, { children: message })), children] })));
@@ -20828,105 +20792,57 @@ var StyledRadioGroup = styled.div(templateObject_2 || (templateObject_2 = __make
20828
20792
  });
20829
20793
  var templateObject_1$4, templateObject_2;
20830
20794
 
20831
- var NextPriceListButton = function (_a) {
20832
- var availablePriceLists = _a.availablePriceLists, priceListStart = _a.priceListStart, setPriceListStart = _a.setPriceListStart;
20833
- 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 () {
20834
- setPriceListStart(function (prev) {
20835
- var newValue = prev - 1;
20836
- if (newValue < 0) {
20837
- return prev;
20838
- }
20839
- return newValue;
20840
- });
20841
- }, 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 () {
20842
- return setPriceListStart(function (prev) {
20843
- var newValue = prev + 1;
20844
- if (newValue >= availablePriceLists.length) {
20845
- return prev;
20846
- }
20847
- return newValue;
20848
- });
20849
- }, style: { width: "22px", height: "22px" } }, { children: jsx(FontAwesomeIcon, { icon: faChevronRight }) })))] })));
20850
- };
20851
-
20852
- var getAvailablePlansAndPriceLists = function (_a) {
20853
- var availablePriceLists = _a.availablePriceLists, planChangeOptions = _a.planChangeOptions, priceListStart = _a.priceListStart;
20854
- var displayPriceLists = availablePriceLists.slice(priceListStart, priceListStart + 3);
20855
- var availablePlansArray = displayPriceLists === null || displayPriceLists === void 0 ? void 0 : displayPriceLists.map(function (priceList) {
20856
- var _a;
20857
- 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; });
20858
- return plan;
20859
- });
20860
- return {
20861
- availablePlansArray: availablePlansArray,
20862
- displayPriceLists: displayPriceLists,
20863
- };
20864
- };
20865
- var everythingInPlusString = function (_a) {
20866
- var plan = _a.plan;
20867
- return "Everything in ".concat(plan.name, ", plus");
20868
- };
20869
-
20870
- var PLAN_GRID_PADDING = 4;
20871
- var PlanPickerGridCell = function (_a) {
20872
- var children = _a.children, noBorder = _a.noBorder;
20873
- var isMobile = useIsMobile();
20874
- return (jsxs("div", __assign({ className: "flex flex-col", style: isMobile
20875
- ? {}
20876
- : __assign({}, (noBorder ? {} : { borderLeft: "1px solid ".concat(SLATE_200) })) }, { children: [jsx("div", __assign({ className: "grow" }, { children: children })), !isMobile && jsx(Divider, {})] })));
20877
- };
20878
-
20879
20795
  var PriceListCardTitle = function (_a) {
20880
- var plan = _a.plan, isPriceListCurrentSubscription = _a.isPriceListCurrentSubscription, trialRemainingDays = _a.trialRemainingDays;
20796
+ var priceList = _a.priceList, isPriceListCurrentSubscription = _a.isPriceListCurrentSubscription, trialRemainingDays = _a.trialRemainingDays;
20881
20797
  var isMobile = useIsMobile();
20882
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
20883
20799
  ? "Trial ends in ".concat(trialRemainingDays, " day").concat(trialRemainingDays === 1 ? "" : "s")
20884
- : " " }))), jsx("div", __assign({ className: "font-medium text-center ".concat(isMobile ? "text-slate-500" : "text-orange-600"), style: { fontSize: "20px" } }, { children: plan.name }))] })));
20885
- };
20886
-
20887
- var Text$e = Typography.Text;
20888
- var PriceListCardDescription = function (_a) {
20889
- var description = _a.description;
20890
- if (!description)
20891
- return null;
20892
- 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 }))] })));
20893
20801
  };
20894
20802
 
20895
20803
  var PriceListCardPrice = function (_a) {
20896
- var plan = _a.plan, priceList = _a.priceList;
20897
- 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
20898
20806
  ? formatCurrency(priceList.basePrice, priceList.currencyId, 0)
20899
- : plan.pricingStyle === PricingStyle.CONTACT_US
20807
+ : priceList.plan.pricingStyle === PricingStyle.CONTACT_US
20900
20808
  ? ""
20901
20809
  : "Free" })));
20902
20810
  };
20903
20811
 
20904
- var Text$d = Typography.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;
20905
20821
  var PriceListCardPriceDescription = function (_a) {
20906
- var feature = _a.feature, plan = _a.plan, priceList = _a.priceList;
20822
+ var feature = _a.feature, priceList = _a.priceList;
20907
20823
  var isMobile = useIsMobile();
20908
- var doesPlanHaveFlatFeeCharges = plan.priceLists.some(function (priceList) {
20909
- return priceList.charges.some(function (charge) {
20910
- return charge.pricingModel === PricingModel.FLAT && charge.basePrice > 0;
20911
- });
20912
- });
20913
- 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)
20914
20826
  return null;
20915
- return (jsx(Text$d, __assign({ className: "text-center text-gray-900", style: {
20827
+ return (jsx(Text$b, __assign({ className: "text-center text-gray-900", style: {
20916
20828
  fontSize: isMobile ? "13px" : "12px",
20917
- } }, { children: plan.pricingDescription
20918
- ? plan.pricingDescription
20829
+ } }, { children: priceList.plan.pricingDescription
20830
+ ? priceList.plan.pricingDescription
20919
20831
  : "per ".concat((feature === null || feature === void 0 ? void 0 : feature.unitName) && !doesPlanHaveFlatFeeCharges
20920
20832
  ? "".concat(feature.unitName.toLowerCase(), " / ")
20921
20833
  : "").concat(PERIOD_LABELS[periodMonthsConverter(priceList.periodMonths)]) })));
20922
20834
  };
20923
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
+
20924
20841
  var PriceListCardButton = function (_a) {
20925
- var disableOnClick = _a.disableOnClick, isPriceListCurrentSubscription = _a.isPriceListCurrentSubscription, isSelected = _a.isSelected, plan = _a.plan, subscriptionPlan = _a.subscriptionPlan;
20842
+ var disableOnClick = _a.disableOnClick, isPriceListCurrentSubscription = _a.isPriceListCurrentSubscription, isSelected = _a.isSelected, priceList = _a.priceList, subscriptionPlan = _a.subscriptionPlan;
20926
20843
  // Context
20927
20844
  var upgradingSubscription = useContext(SubscriptionsContext).upgradingSubscription;
20928
- var isPriceListNonSubscribedCurrentPlan = (upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.plan.id) === plan.id &&
20929
- !isPriceListCurrentSubscription;
20845
+ var isPriceListNonSubscribedCurrentPlan = (upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.plan.id) === priceList.plan.id && !isPriceListCurrentSubscription;
20930
20846
  var createButtonText = function () {
20931
20847
  if (isPriceListCurrentSubscription)
20932
20848
  return "Current";
@@ -20934,8 +20850,8 @@ var PriceListCardButton = function (_a) {
20934
20850
  return "Selected";
20935
20851
  if (subscriptionPlan && !isPriceListNonSubscribedCurrentPlan)
20936
20852
  return "Subscribed";
20937
- if (plan.pricingStyle === PricingStyle.CONTACT_US)
20938
- return plan.contactUsLabel;
20853
+ if (priceList.plan.pricingStyle === PricingStyle.CONTACT_US)
20854
+ return priceList.plan.contactUsLabel;
20939
20855
  return "Select";
20940
20856
  };
20941
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: {
@@ -20945,29 +20861,8 @@ var PriceListCardButton = function (_a) {
20945
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);
20946
20862
  var templateObject_1$3;
20947
20863
 
20948
- var PriceListCardDesktop = function (_a) {
20949
- 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;
20950
- 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 () {
20951
- if (!disableOnClick) {
20952
- if (plan.pricingStyle === PricingStyle.CONTACT_US) {
20953
- window.open(plan.contactUsUrl, "_blank");
20954
- }
20955
- else
20956
- onClick(priceList);
20957
- }
20958
- }, style: {
20959
- height: "100%",
20960
- maxWidth: "440px",
20961
- } }, { 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 })] })) }));
20962
- };
20963
-
20964
- var CheckIcon = function (_a) {
20965
- var backgroundColor = _a.backgroundColor, size = _a.size;
20966
- 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" }) })) })));
20967
- };
20968
-
20969
20864
  var PriceListCardMobile = function (_a) {
20970
- 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;
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;
20971
20866
  var brandColor = useContext(BrandContext).brandColor;
20972
20867
  return (jsxs("div", __assign({ className: "relative flex flex-col border-2 border-solid rounded-lg p-4", onClick: function () {
20973
20868
  if (!disableOnClick)
@@ -20978,22 +20873,44 @@ var PriceListCardMobile = function (_a) {
20978
20873
  } }, { children: [isSelected && (jsx("div", __assign({ className: "absolute", style: {
20979
20874
  top: "10px",
20980
20875
  right: "10px",
20981
- } }, { 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, 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 })] }))] })));
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 })] })) }));
20982
20902
  };
20983
20903
 
20984
20904
  var PriceListCard = function (_a) {
20985
20905
  var _b;
20986
- var isSelected = _a.isSelected, onClick = _a.onClick, plan = _a.plan, priceList = _a.priceList, subscriptions = _a.subscriptions, trialRemainingDays = _a.trialRemainingDays;
20906
+ var isSelected = _a.isSelected, onClick = _a.onClick, priceList = _a.priceList, subscriptions = _a.subscriptions, trialRemainingDays = _a.trialRemainingDays;
20987
20907
  // Context
20988
20908
  var upgradingSubscription = useContext(SubscriptionsContext).upgradingSubscription;
20989
20909
  var isMobile = useIsMobile();
20990
- if (!plan) {
20991
- return null;
20992
- }
20993
20910
  // Derived state
20994
- var description = createPlanDescription(plan);
20911
+ var description = createPlanDescription(priceList);
20995
20912
  // Get the active price list charge for this plan
20996
- var activeCharge = (_b = getActivePlanPriceData(plan, priceList)) === null || _b === void 0 ? void 0 : _b.activeCharge;
20913
+ var activeCharge = (_b = getActivePlanPriceData(priceList, priceList)) === null || _b === void 0 ? void 0 : _b.activeCharge;
20997
20914
  // Is the price list the current price list for the upgradingSubscription
20998
20915
  var isPriceListCurrentSubscription = (upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.priceList.id) === priceList.id;
20999
20916
  var disableOnClick = isPriceListDisabled({
@@ -21003,7 +20920,7 @@ var PriceListCard = function (_a) {
21003
20920
  });
21004
20921
  var subscriptionPlan = subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.find(function (subscription) {
21005
20922
  var _a, _b;
21006
- return subscription.plan.id === plan.id &&
20923
+ return subscription.plan.id === priceList.plan.id &&
21007
20924
  ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) !== SubscriptionState$2.CANCELED &&
21008
20925
  ((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) !== SubscriptionState$2.EXPIRED;
21009
20926
  });
@@ -21011,50 +20928,48 @@ var PriceListCard = function (_a) {
21011
20928
  return null;
21012
20929
  }
21013
20930
  var feature = activeCharge.feature;
21014
- return isMobile ? (jsx(PriceListCardMobile, { description: description, disableOnClick: disableOnClick, feature: feature, isPriceListCurrentSubscription: isPriceListCurrentSubscription, isSelected: isSelected, onClick: onClick, plan: plan, priceList: priceList, trialRemainingDays: trialRemainingDays, subscriptionPlan: subscriptionPlan })) : (jsx(PriceListCardDesktop, { description: description, disableOnClick: disableOnClick, feature: feature, isPriceListCurrentSubscription: isPriceListCurrentSubscription, isSelected: isSelected, onClick: onClick, plan: plan, priceList: priceList, trialRemainingDays: trialRemainingDays, subscriptionPlan: subscriptionPlan }));
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 }));
21015
20932
  };
21016
20933
 
21017
- var PLANS_TO_DISPLAY = 3;
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
+ };
21018
20942
 
21019
- var Text$c = Typography.Text;
21020
- var filterUniqueFeatures = function (_a) {
21021
- // Remove any features that in previous plans if everythingInPlus is true
21022
- var availablePlansArray = _a.availablePlansArray;
21023
- var uniqueFeatures = new Set();
21024
- 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) {
21025
20947
  var _a;
21026
- var updatedPlanFeatures = (_a = plan.planFeatures) === null || _a === void 0 ? void 0 : _a.filter(function (feature) {
21027
- if (uniqueFeatures.has(feature.featureId)) {
21028
- return false;
21029
- }
21030
- else {
21031
- uniqueFeatures.add(feature.featureId);
21032
- return true;
21033
- }
21034
- });
21035
- 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;
21036
20950
  });
21037
- return updatedPlansArray;
20951
+ return {
20952
+ availablePlansArray: availablePlansArray,
20953
+ displayPriceLists: displayPriceLists,
20954
+ };
21038
20955
  };
21039
- var EverythingPlanFeatures = function (_a) {
21040
- var availablePlansArray = _a.availablePlansArray, selectedProduct = _a.selectedProduct;
21041
- var brandColor = useContext(BrandContext).brandColor;
21042
- var uniquePlanFeatures = filterUniqueFeatures({ availablePlansArray: availablePlansArray });
21043
- return (jsx(Fragment, { children: __spreadArray([], Array(PLANS_TO_DISPLAY), true).map(function (_, planIndex) {
21044
- var plan = uniquePlanFeatures[planIndex];
21045
- var prevPlan = availablePlansArray[planIndex - 1];
21046
- if (!plan)
21047
- return (jsx("div", { style: prevPlan ? { borderLeft: "1px solid ".concat(SLATE_200) } : {} }, planIndex));
21048
- if (!plan.planFeatures)
21049
- return jsx("div", {}, planIndex);
21050
- return (jsx("div", __assign({ className: "flex flex-col gap-4 p-4", style: { borderLeft: "1px solid ".concat(SLATE_200) } }, { children: plan.planFeatures.map(function (planFeature, planFeatureIndex) {
21051
- var everythingInPlus = selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.everythingInPlus;
21052
- return (jsxs("div", __assign({ className: "contents" }, { children: [prevPlan &&
21053
- everythingInPlus &&
21054
- planIndex > 0 &&
21055
- planFeatureIndex === 0 && (jsx(Text$c, __assign({ className: "font-medium", style: { fontSize: "13px" } }, { children: everythingInPlusString({ plan: prevPlan }) }))), jsxs("div", __assign({ className: "flex gap-1 text-gray-600", style: { fontSize: "13px" } }, { children: [jsx(CheckIcon, { backgroundColor: brandColor, size: "15px" }), jsx(Text$c, { children: planFeature.feature.name })] }))] }), planFeatureIndex));
21056
- }) }), planIndex));
21057
- }) }));
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)); }) }))] }));
21058
20973
  };
21059
20974
 
21060
20975
  var shouldColorRow = function (_a) {
@@ -21071,15 +20986,15 @@ var FeatureGridCell = function (_a) {
21071
20986
  : {})) }, { children: children })));
21072
20987
  };
21073
20988
 
21074
- var Text$b = Typography.Text;
20989
+ var PLANS_TO_DISPLAY$1 = 3;
20990
+
20991
+ var Text$9 = Typography.Text;
21075
20992
  var PlanFeatures = function (_a) {
21076
20993
  var _b;
21077
- var availablePlansArray = _a.availablePlansArray, plans = _a.plans, selectedProduct = _a.selectedProduct;
20994
+ var availablePlansArray = _a.availablePlansArray, selectedProduct = _a.selectedProduct;
21078
20995
  var featureGroupCounter = useRef(0);
21079
20996
  var visibleFeatureCounter = useRef(1);
21080
20997
  var brandColor = useContext(BrandContext).brandColor;
21081
- if (!plans)
21082
- return null;
21083
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) {
21084
20999
  if (!selectedProduct.features)
21085
21000
  return null;
@@ -21101,7 +21016,7 @@ var PlanFeatures = function (_a) {
21101
21016
  rowIndex = rowIndex + featureGroupCounter.current;
21102
21017
  // Increment the visible feature counter
21103
21018
  visibleFeatureCounter.current = visibleFeatureCounter.current + 1;
21104
- 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) {
21105
21020
  var _a;
21106
21021
  var plan = availablePlansArray[columnIndex];
21107
21022
  var doesHavePrevPlan = availablePlansArray[columnIndex - 1];
@@ -21111,91 +21026,115 @@ var PlanFeatures = function (_a) {
21111
21026
  if (!plan)
21112
21027
  return (jsx(FeatureGridCell, { rowIndex: rowIndex, noBorder: !Boolean(doesHavePrevPlan) }, columnIndex));
21113
21028
  if (isFeatureGroup)
21114
- return (jsx(FeatureGridCell, { isFeatureGroup: true, rowIndex: rowIndex }, columnIndex));
21115
- 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$b, __assign({ className: "text-gray" }, { children: "-" }))) })) }), columnIndex));
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));
21116
21031
  })] }), rowIndex));
21117
21032
  }) }));
21118
21033
  };
21119
21034
  var FeatureTitle = function (_a) {
21120
21035
  var _b;
21121
21036
  var isFeatureGroup = _a.isFeatureGroup, feature = _a.feature;
21122
- return (jsx(Text$b, __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 })));
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
+ }) }));
21123
21096
  };
21124
21097
 
21098
+ var PLANS_TO_DISPLAY = 3;
21125
21099
  var PriceListGridDesktop = function (_a) {
21126
- var availablePriceLists = _a.availablePriceLists, onChangePriceList = _a.onChangePriceList, planChangeOptions = _a.planChangeOptions, priceListStart = _a.priceListStart, selectedPlan = _a.selectedPlan, selectedProduct = _a.selectedProduct, setPriceListStart = _a.setPriceListStart, subscriptions = _a.subscriptions, trialRemainingDays = _a.trialRemainingDays;
21127
- // Context
21128
- 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;
21129
21101
  var _b = useMemo(function () {
21130
21102
  return getAvailablePlansAndPriceLists({
21131
21103
  availablePriceLists: availablePriceLists,
21132
- planChangeOptions: planChangeOptions,
21104
+ priceListChangeOptions: priceListChangeOptions,
21133
21105
  priceListStart: priceListStart,
21134
21106
  });
21135
- }, [availablePriceLists, planChangeOptions, priceListStart]), availablePlansArray = _b.availablePlansArray, displayPriceLists = _b.displayPriceLists;
21107
+ }, [availablePriceLists, priceListChangeOptions, priceListStart]), availablePlansArray = _b.availablePlansArray, displayPriceLists = _b.displayPriceLists;
21136
21108
  var everythingInPlus = selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.everythingInPlus;
21137
- return (jsx("div", __assign({ className: "" }, { children: jsxs("div", __assign({ className: "relative flex flex-col h-full rounded-md overflow-hidden bg-white ".concat(shadow ? "shadow-".concat(shadow) : "") }, { children: [jsx(NextPriceListButton, { availablePriceLists: availablePriceLists, priceListStart: priceListStart, setPriceListStart: setPriceListStart }), jsxs("div", __assign({ className: "grid w-full", style: {
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: {
21138
21110
  gridTemplateColumns: everythingInPlus
21139
21111
  ? "repeat(3, minmax(120px, 1fr))"
21140
21112
  : "minmax(auto, 400px) repeat(3, minmax(120px, 1fr))",
21141
21113
  } }, { children: [!everythingInPlus && jsx(PlanPickerGridCell, { noBorder: true }), __spreadArray([], Array(PLANS_TO_DISPLAY), true).map(function (_, index) {
21142
- var _a;
21143
21114
  var priceList = displayPriceLists[index];
21144
21115
  var doesPrevPriceListExist = displayPriceLists[index - 1];
21145
21116
  if (!priceList)
21146
- return (jsx(PlanPickerGridCell, { noBorder: !Boolean(doesPrevPriceListExist) }, index));
21147
- 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; });
21148
- 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));
21149
- }), (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 }))] }))] })) })));
21150
- };
21151
-
21152
- var Text$a = Typography.Text;
21153
- var PriceListCardFeature = function (_a) {
21154
- var feature = _a.feature, index = _a.index;
21155
- var brandColor = useContext(BrandContext).brandColor;
21156
- if (feature.kind === "GROUP")
21157
- return jsx(Text$a, __assign({ className: "font-medium base-text" }, { children: feature.name }));
21158
- 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));
21159
- };
21160
-
21161
- var Text$9 = Typography.Text;
21162
- var PriceListGridMobile = function (_a) {
21163
- var _b, _c, _d;
21164
- var availablePriceLists = _a.availablePriceLists, onChangePriceList = _a.onChangePriceList, planChangeOptions = _a.planChangeOptions, selectedPlan = _a.selectedPlan, selectedProduct = _a.selectedProduct, subscriptions = _a.subscriptions, trialRemainingDays = _a.trialRemainingDays;
21165
- var everythingInPlus = selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.everythingInPlus;
21166
- var prevPriceListIndex = availablePriceLists.findIndex(function (priceList) { return priceList.plan.id === (selectedPlan === null || selectedPlan === void 0 ? void 0 : selectedPlan.id); });
21167
- var prevPlanId = (_b = availablePriceLists[prevPriceListIndex - 1]) === null || _b === void 0 ? void 0 : _b.plan.id;
21168
- 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; });
21169
- 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) {
21170
- var _a;
21171
- 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; });
21172
- 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));
21173
- }) })), jsx(Text$9, __assign({ className: "text-slate-500 pt-5 pb-4 bunny-shadow-padding-x" }, { children: everythingInPlus && prevPlan
21174
- ? everythingInPlusString({ plan: prevPlan })
21175
- : "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 }))] }))] })) })));
21176
21120
  };
21177
21121
 
21178
21122
  var PriceListGrid = function (_a) {
21179
21123
  var _b, _c;
21180
- var availablePriceLists = _a.availablePriceLists, onChangePriceList = _a.onChangePriceList, planChangeOptions = _a.planChangeOptions, priceListStart = _a.priceListStart, selectedPriceList = _a.selectedPriceList, selectedProduct = _a.selectedProduct, setPriceListStart = _a.setPriceListStart, subscriptions = _a.subscriptions, upgradingSubscriptionState = _a.upgradingSubscriptionState;
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;
21181
21125
  // Hooks
21182
21126
  var isMobile = useIsMobile();
21183
21127
  // Derived state
21184
- var currentPlan = (_b = planChangeOptions === null || planChangeOptions === void 0 ? void 0 : planChangeOptions.plans) === null || _b === void 0 ? void 0 : _b.find(function (plan) { return plan.id === (upgradingSubscriptionState === null || upgradingSubscriptionState === void 0 ? void 0 : upgradingSubscriptionState.plan.id); });
21185
- var selectedPlan = (_c = planChangeOptions === null || planChangeOptions === void 0 ? void 0 : planChangeOptions.plans) === null || _c === void 0 ? void 0 : _c.find(function (plan) { return plan.id === (selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.plan.id); });
21186
- var trialRemainingDays = dayjs(currentPlan === null || currentPlan === void 0 ? void 0 : currentPlan.trialEndDate).diff(dayjs(), "days");
21187
- 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 }));
21188
21131
  };
21189
21132
 
21190
- var createAvailableBillingPeriods = function (plans, selectedProduct) {
21191
- return plans === null || plans === void 0 ? void 0 : plans.flatMap(function (plan) {
21192
- return plan.priceLists
21193
- .filter(function (priceList) { return priceList.product.id === (selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.id); })
21194
- .map(function (priceList) { return priceList.periodMonths; });
21195
- }).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); });
21196
21135
  };
21197
21136
  var PriceListSelector = function (_a) {
21198
- var arePlanChangeOptionsLoading = _a.arePlanChangeOptionsLoading, areSubscriptionsLoading = _a.areSubscriptionsLoading, onChangePriceList = _a.onChangePriceList, planChangeOptions = _a.planChangeOptions, selectedPriceList = _a.selectedPriceList, subscriptions = _a.subscriptions, upgradingSubscription = _a.upgradingSubscription;
21137
+ var arePlanChangeOptionsLoading = _a.arePlanChangeOptionsLoading, areSubscriptionsLoading = _a.areSubscriptionsLoading, onChangePriceList = _a.onChangePriceList, priceListChangeOptions = _a.priceListChangeOptions, selectedPriceList = _a.selectedPriceList, subscriptions = _a.subscriptions, upgradingSubscription = _a.upgradingSubscription;
21199
21138
  // Context
21200
21139
  var _b = useContext(SubscriptionsContext), isInPreviewMode = _b.isInPreviewMode, quotePreviewData = _b.quotePreviewData, setQuotePreviewData = _b.setQuotePreviewData;
21201
21140
  // Local state
@@ -21203,32 +21142,22 @@ var PriceListSelector = function (_a) {
21203
21142
  var _d = useState(), selectedBillingPeriod = _d[0], setSelectedBillingPeriod = _d[1];
21204
21143
  var _e = useState(0), priceListStart = _e[0], setPriceListStart = _e[1];
21205
21144
  // Derived state
21206
- var availableBillingPeriods = useMemo(function () {
21207
- return createAvailableBillingPeriods(planChangeOptions === null || planChangeOptions === void 0 ? void 0 : planChangeOptions.plans, selectedProduct);
21208
- }, [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]);
21209
21146
  var availablePriceLists = useMemo(function () {
21210
21147
  var _a;
21211
- return (((_a = planChangeOptions === null || planChangeOptions === void 0 ? void 0 : planChangeOptions.plans) === null || _a === void 0 ? void 0 : _a.flatMap(function (plan) {
21212
- return plan.priceLists.filter(function (priceList) {
21213
- return periodMonthsConverter(priceList.periodMonths) ===
21214
- selectedBillingPeriod &&
21215
- priceList.product.id === (selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.id);
21216
- });
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);
21217
21151
  })) || []);
21218
- }, [planChangeOptions, selectedBillingPeriod, selectedProduct]);
21152
+ }, [priceListChangeOptions, selectedBillingPeriod, selectedProduct]);
21219
21153
  // Handlers
21220
21154
  var onChangeBillingPeriod = useCallback(function (billingPeriod) {
21221
21155
  var _a, _b;
21222
21156
  setSelectedBillingPeriod(billingPeriod);
21223
21157
  setPriceListStart(0);
21224
21158
  if ((quotePreviewData === null || quotePreviewData === void 0 ? void 0 : quotePreviewData.priceList) &&
21225
- billingPeriod !==
21226
- periodMonthsConverter((_a = quotePreviewData === null || quotePreviewData === void 0 ? void 0 : quotePreviewData.priceList) === null || _a === void 0 ? void 0 : _a.periodMonths)) {
21227
- var availablePriceLists_1 = ((_b = planChangeOptions === null || planChangeOptions === void 0 ? void 0 : planChangeOptions.plans) === null || _b === void 0 ? void 0 : _b.flatMap(function (plan) {
21228
- return plan.priceLists.filter(function (priceList) {
21229
- return periodMonthsConverter(priceList.periodMonths) === billingPeriod;
21230
- });
21231
- })) || [];
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; })) || [];
21232
21161
  var newSelectedPriceList = availablePriceLists_1.find(function (priceList) {
21233
21162
  var _a;
21234
21163
  return periodMonthsConverter(priceList.periodMonths) === billingPeriod &&
@@ -21239,8 +21168,7 @@ var PriceListSelector = function (_a) {
21239
21168
  upgradingSubscription: upgradingSubscription,
21240
21169
  });
21241
21170
  });
21242
- var isPriceListCurrentSubscription = newSelectedPriceList &&
21243
- (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;
21244
21172
  if (newSelectedPriceList && !isPriceListCurrentSubscription) {
21245
21173
  setQuotePreviewData({
21246
21174
  priceList: newSelectedPriceList,
@@ -21255,32 +21183,30 @@ var PriceListSelector = function (_a) {
21255
21183
  }
21256
21184
  }, [
21257
21185
  quotePreviewData,
21258
- planChangeOptions,
21186
+ priceListChangeOptions,
21259
21187
  subscriptions,
21260
21188
  upgradingSubscription,
21261
21189
  setQuotePreviewData,
21262
21190
  ]);
21263
21191
  var onChangeProduct = useCallback(function (product) {
21264
- var newAvailableBillingPeriods = createAvailableBillingPeriods(planChangeOptions === null || planChangeOptions === void 0 ? void 0 : planChangeOptions.plans, product);
21192
+ var newAvailableBillingPeriods = createAvailableBillingPeriods(priceListChangeOptions === null || priceListChangeOptions === void 0 ? void 0 : priceListChangeOptions.priceLists, product);
21265
21193
  if (!(newAvailableBillingPeriods === null || newAvailableBillingPeriods === void 0 ? void 0 : newAvailableBillingPeriods.includes(billingPeriodConverter(selectedBillingPeriod)))) {
21266
- onChangeBillingPeriod(periodMonthsConverter((newAvailableBillingPeriods === null || newAvailableBillingPeriods === void 0 ? void 0 : newAvailableBillingPeriods[0]) !== undefined
21267
- ? newAvailableBillingPeriods[0]
21268
- : 1));
21194
+ onChangeBillingPeriod(periodMonthsConverter((newAvailableBillingPeriods === null || newAvailableBillingPeriods === void 0 ? void 0 : newAvailableBillingPeriods[0]) !== undefined ? newAvailableBillingPeriods[0] : 1));
21269
21195
  }
21270
21196
  setSelectedProduct(product);
21271
- }, [planChangeOptions, selectedBillingPeriod, onChangeBillingPeriod]);
21197
+ }, [priceListChangeOptions, selectedBillingPeriod, onChangeBillingPeriod]);
21272
21198
  // Default settings
21273
21199
  useEffect(function () {
21274
21200
  var _a, _b, _c, _d;
21275
21201
  if (arePlanChangeOptionsLoading ||
21276
21202
  areSubscriptionsLoading ||
21277
- !planChangeOptions ||
21203
+ !priceListChangeOptions ||
21278
21204
  selectedBillingPeriod ||
21279
21205
  selectedProduct ||
21280
21206
  selectedPriceList)
21281
21207
  return;
21282
- var initialProduct = (_a = planChangeOptions === null || planChangeOptions === void 0 ? void 0 : planChangeOptions.products) === null || _a === void 0 ? void 0 : _a[0];
21283
- var initialAvailableBillingPeriods = createAvailableBillingPeriods(planChangeOptions === null || planChangeOptions === void 0 ? void 0 : planChangeOptions.plans, initialProduct);
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);
21284
21210
  var initialBillingPeriod;
21285
21211
  if ((upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.priceList) &&
21286
21212
  (initialAvailableBillingPeriods === null || initialAvailableBillingPeriods === void 0 ? void 0 : initialAvailableBillingPeriods.includes(billingPeriodConverter(periodMonthsConverter(upgradingSubscription.priceList.periodMonths))))) {
@@ -21289,12 +21215,9 @@ var PriceListSelector = function (_a) {
21289
21215
  else {
21290
21216
  initialBillingPeriod = periodMonthsConverter((initialAvailableBillingPeriods === null || initialAvailableBillingPeriods === void 0 ? void 0 : initialAvailableBillingPeriods[0]) || 1);
21291
21217
  }
21292
- var initialAvailablePriceLists = ((_b = planChangeOptions === null || planChangeOptions === void 0 ? void 0 : planChangeOptions.plans) === null || _b === void 0 ? void 0 : _b.flatMap(function (plan) {
21293
- return plan.priceLists.filter(function (priceList) {
21294
- return periodMonthsConverter(priceList.periodMonths) ===
21295
- initialBillingPeriod &&
21296
- priceList.product.id === (initialProduct === null || initialProduct === void 0 ? void 0 : initialProduct.id);
21297
- });
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);
21298
21221
  })) || [];
21299
21222
  var initialPriceList;
21300
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;
@@ -21321,7 +21244,7 @@ var PriceListSelector = function (_a) {
21321
21244
  arePlanChangeOptionsLoading,
21322
21245
  areSubscriptionsLoading,
21323
21246
  isInPreviewMode,
21324
- planChangeOptions,
21247
+ priceListChangeOptions,
21325
21248
  selectedBillingPeriod,
21326
21249
  selectedPriceList,
21327
21250
  selectedProduct,
@@ -21329,7 +21252,7 @@ var PriceListSelector = function (_a) {
21329
21252
  subscriptions,
21330
21253
  upgradingSubscription,
21331
21254
  ]);
21332
- return (jsxs(Fragment, { children: [jsx(BillingPeriodSelector, { availableBillingPeriods: availableBillingPeriods, onChangeBillingPeriod: onChangeBillingPeriod, products: planChangeOptions === null || planChangeOptions === void 0 ? void 0 : planChangeOptions.products, selectedBillingPeriod: selectedBillingPeriod, selectedProduct: selectedProduct, onChangeProduct: onChangeProduct }), jsx(PriceListGrid, { availablePriceLists: availablePriceLists, onChangePriceList: onChangePriceList, planChangeOptions: planChangeOptions, priceListStart: priceListStart, selectedPriceList: selectedPriceList, selectedProduct: selectedProduct, setPriceListStart: setPriceListStart, subscriptions: subscriptions, upgradingSubscriptionState: upgradingSubscription })] }));
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 })] }));
21333
21256
  };
21334
21257
 
21335
21258
  var PlanPicker = function () {
@@ -21355,27 +21278,16 @@ var PlanPicker = function () {
21355
21278
  token: token,
21356
21279
  }),
21357
21280
  queryFn: function () {
21358
- return getPlanChangeOptions({
21281
+ return getPriceListChangeOptions({
21282
+ apiHost: apiHost,
21359
21283
  isInPreviewMode: isInPreviewMode,
21284
+ productId: productId,
21360
21285
  token: token,
21361
21286
  upgradingSubscription: upgradingSubscription,
21362
- apiHost: apiHost,
21363
21287
  });
21364
21288
  },
21365
21289
  enabled: !areSubscriptionsLoading,
21366
- }), data = _d.data, arePlanChangeOptionsLoading = _d.isLoading;
21367
- var previewDataQuery = useQuery({
21368
- queryKey: QueryKeyFactory.default.createTableKey({
21369
- pluralType: "portalPreview",
21370
- filterString: productId || "",
21371
- token: token,
21372
- }),
21373
- queryFn: function () { return getPortalPreviewData(productId || "", apiHost, token); },
21374
- enabled: isInPreviewMode,
21375
- });
21376
- var planChangeOptions = useMemo(function () {
21377
- return isInPreviewMode ? previewDataQuery.data : data;
21378
- }, [isInPreviewMode, previewDataQuery.data, data]);
21290
+ }), priceListChangeOptions = _d.data, arePlanChangeOptionsLoading = _d.isLoading;
21379
21291
  // Handlers
21380
21292
  var onChangePriceList = useCallback(function (selectedPriceList) {
21381
21293
  if (isInPreviewMode)
@@ -21391,16 +21303,16 @@ var PlanPicker = function () {
21391
21303
  setQuotePreviewData({});
21392
21304
  };
21393
21305
  }, [setQuotePreviewData]);
21394
- if (queryClient.getQueryData(QueryKeyFactory.default.planChangeOptionsKey({
21395
- subscriptionId: upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.id,
21396
- token: token,
21397
- })) === undefined) {
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
+ }))
21398
21312
  return jsx(Fragment, {});
21399
- }
21400
- 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)
21401
21314
  return jsx(ErrorView, { message: "There are no plans available" });
21402
- }
21403
- 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 }));
21404
21316
  };
21405
21317
 
21406
21318
  var Text$8 = Typography.Text;
@@ -21447,25 +21359,16 @@ var PlanManager = function (_a) {
21447
21359
  token: token,
21448
21360
  }),
21449
21361
  queryFn: function () {
21450
- return (editingQuoteData === null || editingQuoteData === void 0 ? void 0 : editingQuoteData.id)
21451
- ? getQuote({ token: token, id: editingQuoteData.id, apiHost: apiHost })
21452
- : undefined;
21362
+ return (editingQuoteData === null || editingQuoteData === void 0 ? void 0 : editingQuoteData.id) ? getQuote({ token: token, id: editingQuoteData.id, apiHost: apiHost }) : undefined;
21453
21363
  },
21454
21364
  enabled: Boolean(editingQuoteData === null || editingQuoteData === void 0 ? void 0 : editingQuoteData.id),
21455
21365
  }).data;
21456
21366
  useEffect(function () {
21457
21367
  if (subscriptionUpgradeId && !upgradingSubscription) {
21458
- var subscription = subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.find(function (subscription) {
21459
- return subscription.id === subscriptionUpgradeId;
21460
- });
21368
+ var subscription = subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.find(function (subscription) { return subscription.id === subscriptionUpgradeId; });
21461
21369
  setUpgradingSubscription(subscription);
21462
21370
  }
21463
- }, [
21464
- setUpgradingSubscription,
21465
- subscriptionUpgradeId,
21466
- subscriptions,
21467
- upgradingSubscription,
21468
- ]);
21371
+ }, [setUpgradingSubscription, subscriptionUpgradeId, subscriptions, upgradingSubscription]);
21469
21372
  useEffect(function () {
21470
21373
  var observer = new IntersectionObserver(function (_a) {
21471
21374
  var entry = _a[0];
@@ -21714,10 +21617,10 @@ var canShowSubscriptionActions = function (subscription) {
21714
21617
 
21715
21618
  var SubscriptionCardActions = function (_a) {
21716
21619
  var _b, _c;
21717
- var onChangePlanClick = _a.onChangePlanClick, onCancelSubscriptionClick = _a.onCancelSubscriptionClick, planChangeOptions = _a.planChangeOptions, subscription = _a.subscription;
21620
+ var onChangePlanClick = _a.onChangePlanClick, onCancelSubscriptionClick = _a.onCancelSubscriptionClick, priceListChangeOptions = _a.priceListChangeOptions, subscription = _a.subscription;
21718
21621
  // Derived state
21719
21622
  var canShowCancelButton = subscription.plan.selfServiceCancel;
21720
- var productPlans = (_b = planChangeOptions === null || planChangeOptions === void 0 ? void 0 : planChangeOptions.plans) === null || _b === void 0 ? void 0 : _b.filter(function (plan) { var _a; return ((_a = plan.priceLists) === null || _a === void 0 ? void 0 : _a.length) > 0 && plan.productId === subscription.product.id; });
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; });
21721
21624
  var canShowChangePlanButton = ((productPlans === null || productPlans === void 0 ? void 0 : productPlans.length) || 0) > 0;
21722
21625
  return (canShowChangePlanButton || canShowCancelButton) &&
21723
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;
@@ -21742,7 +21645,7 @@ var getSubscriptionStatusText = function (subscription) {
21742
21645
  };
21743
21646
  var SubscriptionCardHeader = function (_a) {
21744
21647
  var _b, _c, _d, _e, _f;
21745
- var onChangePlanClick = _a.onChangePlanClick, onCancelSubscriptionClick = _a.onCancelSubscriptionClick, planChangeOptions = _a.planChangeOptions, subscription = _a.subscription;
21648
+ var onChangePlanClick = _a.onChangePlanClick, onCancelSubscriptionClick = _a.onCancelSubscriptionClick, priceListChangeOptions = _a.priceListChangeOptions, subscription = _a.subscription;
21746
21649
  var darkMode = useContext(BunnyContext).darkMode;
21747
21650
  var brandColor = useContext(BrandContext).brandColor;
21748
21651
  var subscriptionProductNameStyle = useContext(SubscriptionsContext).subscriptionProductNameStyle;
@@ -21752,10 +21655,7 @@ var SubscriptionCardHeader = function (_a) {
21752
21655
  var isTrial = ((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === SubscriptionState$2.TRIAL;
21753
21656
  return (jsxs("div", __assign({ className: "flex items-center justify-between", style: {
21754
21657
  backgroundColor: darkMode ? "var(--row-background-dark)" : "",
21755
- } }, { 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 &&
21756
- planChangeOptions &&
21757
- onChangePlanClick &&
21758
- 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 }))] }))] })));
21759
21659
  };
21760
21660
 
21761
21661
  var BillingPeriodConverter;
@@ -21849,11 +21749,11 @@ var CARD_COLUMNS = [
21849
21749
  ];
21850
21750
  var SubscriptionCardDesktop = function (_a) {
21851
21751
  var _b;
21852
- var onChangePlanClick = _a.onChangePlanClick, onCancelSubscriptionClick = _a.onCancelSubscriptionClick, planChangeOptions = _a.planChangeOptions, subscription = _a.subscription;
21752
+ var onChangePlanClick = _a.onChangePlanClick, onCancelSubscriptionClick = _a.onCancelSubscriptionClick, priceListChangeOptions = _a.priceListChangeOptions, subscription = _a.subscription;
21853
21753
  var shadow = useContext(SubscriptionsContext).shadow;
21854
21754
  // Derived state
21855
21755
  var isTrial = ((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === SubscriptionState$1.TRIAL;
21856
- return (jsxs(Card, __assign({ className: "p-4 ".concat(shadow ? "shadow-".concat(shadow) : "") }, { children: [jsx(SubscriptionCardHeader, { onChangePlanClick: onChangePlanClick, onCancelSubscriptionClick: onCancelSubscriptionClick, planChangeOptions: planChangeOptions, subscription: subscription }), jsx(Divider, { className: "my-4", style: {
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: {
21857
21757
  gridColumn: "1 / 5",
21858
21758
  width: "calc(100% + 32px)",
21859
21759
  transform: "translateX(-16px)",
@@ -21960,14 +21860,14 @@ var SubscriptionCard = function (_a) {
21960
21860
  };
21961
21861
 
21962
21862
  var SubscriptionsList = function (_a) {
21963
- var hideExpired = _a.hideExpired, onChangePlanClick = _a.onChangePlanClick, onCancelSubscriptionClick = _a.onCancelSubscriptionClick, planChangeOptions = _a.planChangeOptions, subscriptions = _a.subscriptions;
21863
+ var hideExpired = _a.hideExpired, onChangePlanClick = _a.onChangePlanClick, onCancelSubscriptionClick = _a.onCancelSubscriptionClick, priceListChangeOptions = _a.priceListChangeOptions, subscriptions = _a.subscriptions;
21964
21864
  var isMobile = useIsMobile();
21965
21865
  return (jsx(Fragment, { children: subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.map(function (subscription, subscriptionIndex) {
21966
21866
  if (hideExpired && isSubscriptionNotActive(subscription))
21967
21867
  return null;
21968
21868
  if (isMobile)
21969
- return (jsx(SubscriptionCard, { subscription: subscription }, subscriptionIndex));
21970
- return (jsx(SubscriptionCardDesktop, { onChangePlanClick: onChangePlanClick, onCancelSubscriptionClick: onCancelSubscriptionClick, planChangeOptions: planChangeOptions, subscription: subscription }, subscriptionIndex));
21869
+ return jsx(SubscriptionCard, { subscription: subscription }, subscriptionIndex);
21870
+ return (jsx(SubscriptionCardDesktop, { onChangePlanClick: onChangePlanClick, onCancelSubscriptionClick: onCancelSubscriptionClick, priceListChangeOptions: priceListChangeOptions, subscription: subscription }, subscriptionIndex));
21971
21871
  }) }));
21972
21872
  };
21973
21873
 
@@ -21983,13 +21883,13 @@ var SubscriptionsListContainer = function (_a) {
21983
21883
  // Queries
21984
21884
  var _c = useQuery({
21985
21885
  queryKey: QueryKeyFactory.default.planChangeOptionsKey({ token: token }),
21986
- queryFn: function () { return getPlanChangeOptions({ token: token, apiHost: apiHost }); },
21886
+ queryFn: function () { return getPriceListChangeOptions({ token: token, apiHost: apiHost }); },
21987
21887
  enabled: Boolean(onChangePlanClick),
21988
- }), planChangeOptions = _c.data, arePlanChangeOptionsLoading = _c.isLoading;
21888
+ }), priceListChangeOptions = _c.data, arePriceListChangeOptionsLoading = _c.isLoading;
21989
21889
  if (subscriptionsAreLoading ||
21990
- (Boolean(onChangePlanClick) ? arePlanChangeOptionsLoading : false))
21890
+ (Boolean(onChangePlanClick) ? arePriceListChangeOptionsLoading : false))
21991
21891
  return jsx(Fragment, {});
21992
- return (jsx("div", __assign({ className: "flex flex-col gap-".concat(gap, " shrink overflow-auto") }, { children: (subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.length) > 0 ? (jsx(SubscriptionsList, { hideExpired: hideExpired, onChangePlanClick: onChangePlanClick, onCancelSubscriptionClick: onCancelSubscriptionClick, planChangeOptions: planChangeOptions, 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") }) })))) })));
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") }) })))) }));
21993
21893
  };
21994
21894
 
21995
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";