@bunnyapp/components 1.0.23 → 1.0.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -12,7 +12,6 @@ var reactQuery = require('@tanstack/react-query');
12
12
  var theme = require('antd/lib/theme');
13
13
  var recoil = require('recoil');
14
14
  var request = import('graphql-request');
15
- var reactHelmetAsync = require('react-helmet-async');
16
15
  var reactStripeJs = require('@stripe/react-stripe-js');
17
16
  var pure = require('@stripe/stripe-js/pure');
18
17
  var lodash = require('lodash');
@@ -1820,14 +1819,6 @@ var InvoiceQuoteView = function (_a) {
1820
1819
  };
1821
1820
  var templateObject_1$7;
1822
1821
 
1823
- var quoteMetaDescription = function (vendorName) {
1824
- return "View this quote on the ".concat(vendorName, " customer portal. Powered by Bunny");
1825
- };
1826
- var quoteMetaTitle = function (_a) {
1827
- var documentName = _a.documentName, vendorName = _a.vendorName;
1828
- return vendorName + " " + documentName;
1829
- };
1830
-
1831
1822
  var fetchPDF = function (apiEndpoint, invoiceUuid, token) { return __awaiter(void 0, void 0, void 0, function () {
1832
1823
  var response;
1833
1824
  return __generator(this, function (_a) {
@@ -2849,26 +2840,27 @@ function StripeWrapper(_a) {
2849
2840
  }
2850
2841
 
2851
2842
  function Invoice(_a) {
2852
- var id = _a.id, invoiceQuoteViewComponent = _a.invoiceQuoteViewComponent, backButtonName = _a.backButtonName, onBackButtonClick = _a.onBackButtonClick, onInvoiceDownloadError = _a.onInvoiceDownloadError, onPaymentSuccess = _a.onPaymentSuccess, entityId = _a.entityId, _b = _a.shadow, shadow = _b === void 0 ? "shadow-md" : _b, className = _a.className, _c = _a.hideDownloadButton, hideDownloadButton = _c === void 0 ? false : _c;
2853
- return (jsxRuntime.jsx(reactHelmetAsync.HelmetProvider, { children: jsxRuntime.jsx(InvoiceQuoteContext.Provider, __assign({ value: {
2854
- id: id,
2855
- invoiceQuoteViewComponent: invoiceQuoteViewComponent,
2856
- backButtonName: backButtonName,
2857
- onBackButtonClick: onBackButtonClick,
2858
- onInvoiceDownloadError: onInvoiceDownloadError,
2859
- onPaymentSuccess: onPaymentSuccess,
2860
- entityId: entityId,
2861
- shadow: shadow,
2862
- className: className,
2863
- hideDownloadButton: hideDownloadButton,
2864
- } }, { children: jsxRuntime.jsx(ActualInvoice, {}) })) }));
2843
+ var id = _a.id, invoiceQuoteViewComponent = _a.invoiceQuoteViewComponent, backButtonName = _a.backButtonName, onBackButtonClick = _a.onBackButtonClick, onInvoiceDownloadError = _a.onInvoiceDownloadError, onPaymentSuccess = _a.onPaymentSuccess, entityId = _a.entityId, _b = _a.shadow, shadow = _b === void 0 ? "shadow-md" : _b, className = _a.className, _c = _a.hideDownloadButton, hideDownloadButton = _c === void 0 ? false : _c, onInvoiceLoaded = _a.onInvoiceLoaded;
2844
+ return (jsxRuntime.jsx(InvoiceQuoteContext.Provider, __assign({ value: {
2845
+ id: id,
2846
+ invoiceQuoteViewComponent: invoiceQuoteViewComponent,
2847
+ backButtonName: backButtonName,
2848
+ onBackButtonClick: onBackButtonClick,
2849
+ onInvoiceDownloadError: onInvoiceDownloadError,
2850
+ onPaymentSuccess: onPaymentSuccess,
2851
+ entityId: entityId,
2852
+ shadow: shadow,
2853
+ className: className,
2854
+ hideDownloadButton: hideDownloadButton,
2855
+ onInvoiceLoaded: onInvoiceLoaded,
2856
+ } }, { children: jsxRuntime.jsx(ActualInvoice, {}) })));
2865
2857
  }
2866
2858
  function ActualInvoice() {
2867
2859
  // Context
2868
2860
  var queryClient = reactQuery.useQueryClient();
2869
2861
  var _a = React.useContext(InvoiceQuoteContext), id = _a.id, invoiceQuoteViewComponent = _a.invoiceQuoteViewComponent, backButtonName = _a.backButtonName, onBackButtonClick = _a.onBackButtonClick, entityId = _a.entityId, className = _a.className;
2870
2862
  var _b = React.useContext(BunnyContext), apiHost = _b.apiHost, onTokenExpired = _b.onTokenExpired, graphQLClient = _b.graphQLClient;
2871
- var hideDownloadButton = React.useContext(InvoiceQuoteContext).hideDownloadButton;
2863
+ var _c = React.useContext(InvoiceQuoteContext), hideDownloadButton = _c.hideDownloadButton, onInvoiceLoaded = _c.onInvoiceLoaded;
2872
2864
  var token = useToken();
2873
2865
  // Hooks
2874
2866
  var showSuccessNotification = common.useSuccessNotification();
@@ -2882,8 +2874,6 @@ function ActualInvoice() {
2882
2874
  var isInvoicePayable = common.PAYABLE_INVOICE_STATES.includes((formattedInvoice === null || formattedInvoice === void 0 ? void 0 : formattedInvoice.state) || "");
2883
2875
  // Local state
2884
2876
  var isMobile = common.useIsMobile(isInvoicePayable ? common.BreakpointNumbers.lg : undefined);
2885
- if (!formattedInvoice)
2886
- return jsxRuntime.jsx(jsxRuntime.Fragment, {});
2887
2877
  var onSuccess = function () {
2888
2878
  queryClient.invalidateQueries({
2889
2879
  queryKey: common.QueryKeyFactory.default.transactionsKey(),
@@ -2896,10 +2886,14 @@ function ActualInvoice() {
2896
2886
  var onFail = function (error) {
2897
2887
  handleAllErrorFormats(error.message);
2898
2888
  };
2899
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs(reactHelmetAsync.Helmet, { children: [jsxRuntime.jsxs("title", { children: [formattedInvoice.vendorName, " ", common.DOCUMENT_NAME.INVOICE] }), jsxRuntime.jsx("meta", { name: "description", content: quoteMetaDescription(formattedInvoice.vendorName) }), jsxRuntime.jsx("meta", { property: "og:type", content: "website" }), jsxRuntime.jsx("meta", { property: "og:title", content: quoteMetaTitle({
2900
- vendorName: formattedInvoice.vendorName,
2901
- documentName: common.DOCUMENT_NAME.INVOICE,
2902
- }) }), jsxRuntime.jsx("meta", { property: "og:description", content: quoteMetaDescription(formattedInvoice.vendorName) })] }), jsxRuntime.jsxs("div", __assign({ className: "flex gap-6 ".concat(isMobile ? "flex-col w-full overflow-hidden" : "shadow-padding-xb", " ").concat(className) }, { children: [formattedInvoice.isLegacy ? (jsxRuntime.jsx("div", __assign({ className: "flex justify-center w-full" }, { children: jsxRuntime.jsx(InvoicePDF, { invoiceUuid: formattedInvoice.uuid, apiHost: apiHost, token: token }) }))) : (invoiceQuoteViewComponent || (jsxRuntime.jsx(InvoiceQuoteView, { html: formattedInvoice.html, formattedInvoice: formattedInvoice, backButtonName: backButtonName, onBackButtonClick: onBackButtonClick }))), isInvoicePayable && (jsxRuntime.jsx("div", __assign({ className: "w-full ".concat(hideDownloadButton || formattedInvoice.isLegacy ? "" : "pt-12") }, { children: jsxRuntime.jsx(PaymentForm, { entityId: entityId, onPaymentSuccess: onSuccess, onFail: onFail, invoice: formattedInvoice, graphQLClient: graphQLClient }) })))] }))] }));
2889
+ React.useEffect(function () {
2890
+ if (formattedInvoice) {
2891
+ onInvoiceLoaded === null || onInvoiceLoaded === void 0 ? void 0 : onInvoiceLoaded(formattedInvoice);
2892
+ }
2893
+ }, [formattedInvoice]);
2894
+ if (!formattedInvoice)
2895
+ return jsxRuntime.jsx(jsxRuntime.Fragment, {});
2896
+ return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs("div", __assign({ className: "flex gap-6 ".concat(isMobile ? "flex-col w-full overflow-hidden" : "shadow-padding-xb", " ").concat(className) }, { children: [formattedInvoice.isLegacy ? (jsxRuntime.jsx("div", __assign({ className: "flex justify-center w-full" }, { children: jsxRuntime.jsx(InvoicePDF, { invoiceUuid: formattedInvoice.uuid, apiHost: apiHost, token: token }) }))) : (invoiceQuoteViewComponent || (jsxRuntime.jsx(InvoiceQuoteView, { html: formattedInvoice.html, formattedInvoice: formattedInvoice, backButtonName: backButtonName, onBackButtonClick: onBackButtonClick }))), isInvoicePayable && (jsxRuntime.jsx("div", __assign({ className: "w-full ".concat(hideDownloadButton || formattedInvoice.isLegacy ? "" : "pt-12") }, { children: jsxRuntime.jsx(PaymentForm, { entityId: entityId, onPaymentSuccess: onSuccess, onFail: onFail, invoice: formattedInvoice, graphQLClient: graphQLClient }) })))] })) }));
2903
2897
  }
2904
2898
 
2905
2899
  var MUTATION$6 = function (id) { return "\n query formattedQuote ($id: ID) {\n formattedQuote (id: $id) {\n payableId\n acceptedAt\n acceptedByName\n amount\n amountDue\n amountsByPeriod {\n id\n name\n amount\n }\n object { documents { id filename size date url } }\n billingCity\n billingCountry\n billingState\n billingStreet\n billingZip\n contactName\n currency\n customerBillingCity\n customerBillingCountry\n customerBillingState\n customerBillingStreet\n customerBillingZip\n customerName\n discount\n discountValue\n duration\n endDate\n expiresAt\n html\n formattedLines {\n amount\n amountsByPeriod {\n quantity\n id\n name\n startDate\n endDate\n amount\n amountsByTier {\n id\n tier {\n starts\n ends\n price\n }\n quantity\n amount\n }\n prorationRate\n }\n billingPeriodEnd\n billingPeriodStart\n chargeType\n discount\n frequency\n isRamp\n periods\n planName\n position\n price\n priceDecimals\n priceListChargeId\n priceListChargeName\n priceListId\n priceListName\n priceTiers {\n price\n starts\n }\n pricingModel\n productName\n prorationRate\n quantity\n showProductNameOnLineItem\n taxCode\n trialEndDate\n trialStartDate\n unitOfMeasure\n vatCode\n }\n netPaymentDays\n notes\n number\n poNumberRequired\n salesContactEmail\n sharedAt\n startDate\n state\n subtotal\n taxAmount\n taxNumberLabel\n taxNumberRequired\n vendorName\n }\n }"; };
@@ -3148,27 +3142,21 @@ var AcceptQuoteModal = function (_a) {
3148
3142
  }, open: acceptBoxVisible, title: "Accept quote", width: 400 }, { children: jsxRuntime.jsxs(antd.Form, __assign({ className: "flex flex-col gap-2", form: form, layout: "vertical" }, { children: [jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Your name", name: "name", rules: createRules(true, "Your name") }, { children: jsxRuntime.jsx(antd.Input, { autoFocus: true, ref: firstInputRef }) })), jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Your job title", name: "title", rules: createRules(true, "Your job title") }, { children: jsxRuntime.jsx(antd.Input, {}) })), jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Purchase order number", name: "poNumber", rules: createRules(poNumberRequired, "Purchase order number") }, { children: jsxRuntime.jsx(antd.Input, {}) })), taxNumberRequired && (jsxRuntime.jsx(antd.Form.Item, __assign({ name: "taxNumber", label: taxNumberLabel, rules: createRules(taxNumberRequired, taxNumberLabel) }, { children: jsxRuntime.jsx(antd.Input, {}) })))] })) })));
3149
3143
  };
3150
3144
 
3151
- var DOCUMENT_NAME;
3152
- (function (DOCUMENT_NAME) {
3153
- DOCUMENT_NAME["INVOICE"] = "invoice";
3154
- DOCUMENT_NAME["QUOTE"] = "quote";
3155
- })(DOCUMENT_NAME || (DOCUMENT_NAME = {}));
3156
-
3157
3145
  var Text$b = antd.Typography.Text;
3158
- var documentName = DOCUMENT_NAME.QUOTE;
3159
3146
  styled__default["default"].div(templateObject_1$3 || (templateObject_1$3 = __makeTemplateObject(["\n span {\n width: 100%;\n }\n"], ["\n span {\n width: 100%;\n }\n"])));
3160
3147
  function Quote(_a) {
3161
- var id = _a.id, invoiceQuoteViewComponent = _a.invoiceQuoteViewComponent, onInvoiceDownloadError = _a.onInvoiceDownloadError, onPaymentSuccess = _a.onPaymentSuccess, entityId = _a.entityId, _b = _a.shadow, shadow = _b === void 0 ? "shadow-md" : _b, className = _a.className, _c = _a.hideDownloadButton, hideDownloadButton = _c === void 0 ? false : _c;
3162
- return (jsxRuntime.jsx(reactHelmetAsync.HelmetProvider, { children: jsxRuntime.jsx(InvoiceQuoteContext.Provider, __assign({ value: {
3163
- id: id,
3164
- invoiceQuoteViewComponent: invoiceQuoteViewComponent,
3165
- onInvoiceDownloadError: onInvoiceDownloadError,
3166
- onPaymentSuccess: onPaymentSuccess,
3167
- entityId: entityId,
3168
- shadow: shadow,
3169
- className: className,
3170
- hideDownloadButton: hideDownloadButton,
3171
- } }, { children: jsxRuntime.jsx(ActualQuote, { entityId: entityId }) })) }));
3148
+ var id = _a.id, invoiceQuoteViewComponent = _a.invoiceQuoteViewComponent, onInvoiceDownloadError = _a.onInvoiceDownloadError, onPaymentSuccess = _a.onPaymentSuccess, entityId = _a.entityId, _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;
3149
+ return (jsxRuntime.jsx(InvoiceQuoteContext.Provider, __assign({ value: {
3150
+ id: id,
3151
+ invoiceQuoteViewComponent: invoiceQuoteViewComponent,
3152
+ onInvoiceDownloadError: onInvoiceDownloadError,
3153
+ onPaymentSuccess: onPaymentSuccess,
3154
+ entityId: entityId,
3155
+ shadow: shadow,
3156
+ className: className,
3157
+ hideDownloadButton: hideDownloadButton,
3158
+ onQuoteLoaded: onQuoteLoaded,
3159
+ } }, { children: jsxRuntime.jsx(ActualQuote, { entityId: entityId }) })));
3172
3160
  }
3173
3161
  function ActualQuote(_a) {
3174
3162
  var _this = this;
@@ -3178,7 +3166,7 @@ function ActualQuote(_a) {
3178
3166
  var _d = React.useContext(BunnyContext), apiHost = _d.apiHost, onTokenExpired = _d.onTokenExpired;
3179
3167
  var token = useToken();
3180
3168
  var entityBranding = React.useContext(BrandContext);
3181
- var _e = React.useContext(InvoiceQuoteContext), className = _e.className, id = _e.id, hideDownloadButton = _e.hideDownloadButton;
3169
+ var _e = React.useContext(InvoiceQuoteContext), className = _e.className, id = _e.id, hideDownloadButton = _e.hideDownloadButton, onQuoteLoaded = _e.onQuoteLoaded;
3182
3170
  // Queries
3183
3171
  var _f = reactQuery.useQuery({
3184
3172
  queryKey: common.QueryKeyFactory.default.createQuoteKey(token, id),
@@ -3214,15 +3202,17 @@ function ActualQuote(_a) {
3214
3202
  useSigningComplete({ data: formattedQuote, token: token });
3215
3203
  var isMobile = common.useIsMobile();
3216
3204
  var showErrorNotification = common.useErrorNotification();
3205
+ React.useEffect(function () {
3206
+ if (formattedQuote) {
3207
+ onQuoteLoaded === null || onQuoteLoaded === void 0 ? void 0 : onQuoteLoaded(formattedQuote);
3208
+ }
3209
+ }, [formattedQuote]);
3217
3210
  if (!formattedQuote || isLoading) {
3218
3211
  return jsxRuntime.jsx(jsxRuntime.Fragment, {});
3219
3212
  }
3220
3213
  // Derived state
3221
3214
  var isAccepted = formattedQuote.state === "ACCEPTED";
3222
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs(reactHelmetAsync.Helmet, { children: [jsxRuntime.jsxs("title", { children: [formattedQuote.vendorName, " ", documentName] }), jsxRuntime.jsx("meta", { name: "description", content: quoteMetaDescription(formattedQuote.vendorName) }), jsxRuntime.jsx("meta", { property: "og:type", content: "website" }), jsxRuntime.jsx("meta", { property: "og:title", content: quoteMetaTitle({
3223
- vendorName: formattedQuote.vendorName,
3224
- documentName: documentName,
3225
- }) }), jsxRuntime.jsx("meta", { property: "og:description", content: quoteMetaDescription(formattedQuote.vendorName) })] }), jsxRuntime.jsxs("div", __assign({ className: "flex flex-col gap-4 ".concat(isMobile ? "w-full overflow-hidden" : "shadow-padding-xb", " ").concat(className) }, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex flex-row justify-end items-center gap-4", id: "acceptance", style: {
3215
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex flex-col gap-4 ".concat(isMobile ? "w-full overflow-hidden" : "shadow-padding-xb", " ").concat(className) }, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex flex-row justify-end items-center gap-4", id: "acceptance", style: {
3226
3216
  color: entityBranding.secondaryColor,
3227
3217
  } }, { children: [isAccepted && formattedQuote.acceptedAt ? (jsxRuntime.jsx(Text$b, { children: "Quote was accepted by ".concat(formattedQuote.acceptedByName, " on ").concat(common.formatDate(formattedQuote.acceptedAt)) })) : null, (!isMobile || !isAccepted) && (jsxRuntime.jsxs("div", __assign({ className: isMobile
3228
3218
  ? "flex w-full justify-end gap-2"
@@ -4214,6 +4204,36 @@ function Signup(_a) {
4214
4204
  : "w-1/2 items-center justify-center my-12") }, { children: jsxRuntime.jsx("div", __assign({ className: "".concat(isMobile ? "w-full" : "w-1/2") }, { children: jsxRuntime.jsx(PaymentForms, { entityId: entityId, quote: quote, handlePaymentSuccess: handlePaymentSuccess, handlePaymentFail: handlePaymentFail, handleSubmit: handleSubmit, proceedingToPayment: proceedingToPayment, accountId: accountId, overrideToken: portalSessionToken, customCheckoutFunction: accountSignupFunction }) })) }))] }))) })));
4215
4205
  }
4216
4206
 
4207
+ // WARNING: There is a preview button on APP that will need to be changed if this query is changed
4208
+ 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 }";
4209
+ var getPlanChangeOptions = function (_a) {
4210
+ var isInPreviewMode = _a.isInPreviewMode, token = _a.token, upgradingSubscription = _a.upgradingSubscription, apiHost = _a.apiHost;
4211
+ return __awaiter(void 0, void 0, void 0, function () {
4212
+ var response, planChangeOptions;
4213
+ return __generator(this, function (_b) {
4214
+ switch (_b.label) {
4215
+ case 0: return [4 /*yield*/, common.gqlRequest({
4216
+ isInPreviewMode: isInPreviewMode,
4217
+ query: PLAN_CHANGE_OPTIONS_QUERY,
4218
+ vars: { subscriptionId: upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.id },
4219
+ token: token,
4220
+ apiHost: apiHost,
4221
+ })];
4222
+ case 1:
4223
+ response = _b.sent();
4224
+ planChangeOptions = response.planChangeOptions;
4225
+ if (planChangeOptions === null || planChangeOptions === void 0 ? void 0 : planChangeOptions.errors)
4226
+ throw planChangeOptions.errors;
4227
+ // Sort planChangeOptions.plans by position
4228
+ if (planChangeOptions === null || planChangeOptions === void 0 ? void 0 : planChangeOptions.plans) {
4229
+ planChangeOptions.plans.sort(function (a, b) { return a.position - b.position; });
4230
+ }
4231
+ return [2 /*return*/, planChangeOptions];
4232
+ }
4233
+ });
4234
+ });
4235
+ };
4236
+
4217
4237
  var SUBSCRIPTIONS_QUERY = "\nquery subscriptions {\n subscriptions {\n nodes {\n cancellationDate\n currencyId\n endDate\n evergreen\n id\n period\n plan { id name selfServiceBuy selfServiceCancel selfServiceRenew }\n priceList { id periodMonths }\n product { id name showProductNameOnLineItem }\n startDate\n state\n trialEndDate\n trialPeriod\n trialStartDate\n charges {\n priceListCharge {\n priceListChargeTiers {\n price\n starts\n }\n }\n amount\n billingPeriod\n chargeType\n discount\n discountedPrice\n endDate\n expired\n feature { name }\n id\n isAmendment\n isRamp\n kind\n name\n periodPrice\n price\n priceDecimals\n priceListChargeId\n priceTiers { starts price }\n pricingModel\n quantity\n selfServiceQuantity\n startDate\n trial\n }\n }\n }\n }";
4218
4238
  var getSubscriptions = function (_a) {
4219
4239
  var apiHost = _a.apiHost, entityId = _a.entityId, isInPreviewMode = _a.isInPreviewMode, token = _a.token;
@@ -4307,6 +4327,8 @@ var ErrorView = function (_a) {
4307
4327
  return (jsxRuntime.jsxs("div", __assign({ className: "flex flex-col w-full", style: { marginTop: "80px" } }, { children: [jsxRuntime.jsx("div", __assign({ style: { fontSize: "32px" } }, { children: message })), children] })));
4308
4328
  };
4309
4329
 
4330
+ var SubscriptionsContext = React.createContext({});
4331
+
4310
4332
  var SubscriptionState;
4311
4333
  (function (SubscriptionState) {
4312
4334
  SubscriptionState["ACTIVE"] = "ACTIVE";
@@ -4502,8 +4524,6 @@ var FeatureBarChart = function (_a) {
4502
4524
  var StyledBarChart = styled__default["default"](recharts.BarChart)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n .recharts-surface {\n overflow: visible;\n }\n"], ["\n .recharts-surface {\n overflow: visible;\n }\n"])));
4503
4525
  var templateObject_1;
4504
4526
 
4505
- var SubscriptionsContext = React.createContext({});
4506
-
4507
4527
  var isSubscriptionNotActive = function (subscription) {
4508
4528
  var _a, _b;
4509
4529
  return ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === common.SubscriptionState.EXPIRED ||
@@ -4548,13 +4568,14 @@ var SubscriptionCardHeader = function (_a) {
4548
4568
  var onChangePlanClick = _a.onChangePlanClick, onCancelSubscriptionClick = _a.onCancelSubscriptionClick, planChangeOptions = _a.planChangeOptions, subscription = _a.subscription;
4549
4569
  var darkMode = React.useContext(BunnyContext).darkMode;
4550
4570
  var brandColor = React.useContext(BrandContext).brandColor;
4571
+ var subscriptionProductNameStyle = React.useContext(SubscriptionsContext).subscriptionProductNameStyle;
4551
4572
  var isMobile = common.useIsMobile();
4552
4573
  // Derived state
4553
4574
  var trialDaysLeft = dayjs(subscription.trialEndDate).diff(dayjs(), "days");
4554
4575
  var isTrial = ((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === common.SubscriptionState.TRIAL;
4555
4576
  return (jsxRuntime.jsxs("div", __assign({ className: "flex items-center justify-between", style: {
4556
4577
  backgroundColor: darkMode ? "var(--row-background-dark)" : "",
4557
- } }, { children: [jsxRuntime.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) && (jsxRuntime.jsx("div", __assign({ className: "font-medium", style: { fontSize: "11px", color: brandColor } }, { children: (_d = subscription.product.name) === null || _d === void 0 ? void 0 : _d.toUpperCase() }))), jsxRuntime.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) && (jsxRuntime.jsx(Text$2, __assign({ className: "text-lg" }, { children: subscription.plan.name }))), jsxRuntime.jsxs(antd.Tag, __assign({ className: "ant-tag-".concat(common.TAG_COLORS[(_f = subscription.state) === null || _f === void 0 ? void 0 : _f.toUpperCase()]) }, { children: [lodash.capitalize(subscription.state.toLowerCase()), isTrial ? " (".concat(trialDaysLeft, " days left)") : ""] }))] }))] })), jsxRuntime.jsxs("div", __assign({ className: "flex items-center gap-6" }, { children: [jsxRuntime.jsx(Text$2, __assign({ className: "grow text-xs" }, { children: getSubscriptionStatusText(subscription) })), !isMobile &&
4578
+ } }, { children: [jsxRuntime.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) && (jsxRuntime.jsx("div", __assign({ style: __assign({ fontSize: "11px", fontWeight: 500, color: brandColor }, subscriptionProductNameStyle) }, { children: (_d = subscription.product.name) === null || _d === void 0 ? void 0 : _d.toUpperCase() }))), jsxRuntime.jsxs("div", __assign({ className: "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) && (jsxRuntime.jsx(Text$2, __assign({ className: "text-lg" }, { children: subscription.plan.name }))), jsxRuntime.jsxs(antd.Tag, __assign({ className: "ant-tag-".concat(common.TAG_COLORS[(_f = subscription.state) === null || _f === void 0 ? void 0 : _f.toUpperCase()]) }, { children: [lodash.capitalize(subscription.state.toLowerCase()), isTrial ? " (".concat(trialDaysLeft, " days left)") : ""] }))] }))] })), jsxRuntime.jsxs("div", __assign({ className: "flex items-center gap-6" }, { children: [jsxRuntime.jsx(Text$2, __assign({ className: "grow text-xs" }, { children: getSubscriptionStatusText(subscription) })), !isMobile &&
4558
4579
  planChangeOptions &&
4559
4580
  onChangePlanClick &&
4560
4581
  onCancelSubscriptionClick && (jsxRuntime.jsx(SubscriptionCardActions, { onChangePlanClick: onChangePlanClick, onCancelSubscriptionClick: onCancelSubscriptionClick, planChangeOptions: planChangeOptions, subscription: subscription }))] }))] })));
@@ -4770,41 +4791,15 @@ var SubscriptionsList = function (_a) {
4770
4791
  }) }));
4771
4792
  };
4772
4793
 
4773
- // WARNING: There is a preview button on APP that will need to be changed if this query is changed
4774
- 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 }";
4775
- var getPlanChangeOptions = function (_a) {
4776
- var isInPreviewMode = _a.isInPreviewMode, token = _a.token, upgradingSubscription = _a.upgradingSubscription, apiHost = _a.apiHost;
4777
- return __awaiter(void 0, void 0, void 0, function () {
4778
- var response, planChangeOptions;
4779
- return __generator(this, function (_b) {
4780
- switch (_b.label) {
4781
- case 0: return [4 /*yield*/, common.gqlRequest({
4782
- isInPreviewMode: isInPreviewMode,
4783
- query: PLAN_CHANGE_OPTIONS_QUERY,
4784
- vars: { subscriptionId: upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.id },
4785
- token: token,
4786
- apiHost: apiHost,
4787
- })];
4788
- case 1:
4789
- response = _b.sent();
4790
- planChangeOptions = response.planChangeOptions;
4791
- if (planChangeOptions === null || planChangeOptions === void 0 ? void 0 : planChangeOptions.errors)
4792
- throw planChangeOptions.errors;
4793
- // Sort planChangeOptions.plans by position
4794
- if (planChangeOptions === null || planChangeOptions === void 0 ? void 0 : planChangeOptions.plans) {
4795
- planChangeOptions.plans.sort(function (a, b) { return a.position - b.position; });
4796
- }
4797
- return [2 /*return*/, planChangeOptions];
4798
- }
4799
- });
4800
- });
4801
- };
4802
-
4803
4794
  var Subscriptions = function (_a) {
4804
4795
  var className = _a.className, companyName = _a.companyName, entityId = _a.entityId, _b = _a.hideExpired, hideExpired = _b === void 0 ? false : _b, onCancelSubscriptionClick = _a.onCancelSubscriptionClick, onChangePlanClick = _a.onChangePlanClick, onSubscriptionsLoaded = _a.onSubscriptionsLoaded, _c = _a.styles, styles = _c === void 0 ? {
4805
4796
  gap: 4,
4806
4797
  shadow: "sm",
4807
- } : _c;
4798
+ subscriptionProductNameStyle: {
4799
+ fontSize: "11px",
4800
+ fontWeight: 500,
4801
+ },
4802
+ } : _c, noSubscriptionsComponent = _a.noSubscriptionsComponent;
4808
4803
  var gap = styles.gap, shadow = styles.shadow;
4809
4804
  // Context
4810
4805
  var apiHost = React.useContext(BunnyContext).apiHost;
@@ -4832,7 +4827,8 @@ var Subscriptions = function (_a) {
4832
4827
  return (jsxRuntime.jsx(SubscriptionsContext.Provider, __assign({ value: {
4833
4828
  gap: gap,
4834
4829
  shadow: shadow,
4835
- } }, { children: jsxRuntime.jsx("div", __assign({ className: "flex flex-col gap-".concat(gap, " shrink shadow-padding-xb overflow-auto ").concat(className) }, { children: (subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.length) > 0 ? (jsxRuntime.jsx(SubscriptionsList, { hideExpired: hideExpired, onChangePlanClick: onChangePlanClick, onCancelSubscriptionClick: onCancelSubscriptionClick, planChangeOptions: planChangeOptions, subscriptions: subscriptions })) : (jsxRuntime.jsx("div", __assign({ className: "flex flex-col items-center w-full" }, { children: jsxRuntime.jsx(ErrorView, { message: "You have no subscriptions with ".concat(companyName, " yet") }) }))) })) })));
4830
+ subscriptionProductNameStyle: styles.subscriptionProductNameStyle,
4831
+ } }, { children: jsxRuntime.jsx("div", __assign({ className: "flex flex-col gap-".concat(gap, " shrink shadow-padding-xb overflow-auto ").concat(className) }, { children: (subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.length) > 0 ? (jsxRuntime.jsx(SubscriptionsList, { hideExpired: hideExpired, onChangePlanClick: onChangePlanClick, onCancelSubscriptionClick: onCancelSubscriptionClick, planChangeOptions: planChangeOptions, subscriptions: subscriptions })) : (noSubscriptionsComponent || (jsxRuntime.jsx("div", __assign({ className: "flex flex-col items-center w-full" }, { children: jsxRuntime.jsx(ErrorView, { message: "You have no subscriptions with ".concat(companyName, " yet") }) })))) })) })));
4836
4832
  };
4837
4833
 
4838
4834
  var MUTATION = "\nmutation BillingDetailsUpdate(\n $attributes: BillingDetailsAttributes!) {\n billingDetailsUpdate(\n attributes: $attributes\n ) {\n billingDetails {\n billingCity\n billingContact {\n email\n }\n billingCountry\n billingState\n billingStreet\n billingZip\n name\n taxNumber\n }\n errors\n }\n }\n";
@@ -1,3 +1,3 @@
1
- import { InvoiceQuoteContextProps } from "./InvoiceQuoteContext";
2
1
  import "../../styles/index.less";
3
- export default function Invoice({ id, invoiceQuoteViewComponent, backButtonName, onBackButtonClick, onInvoiceDownloadError, onPaymentSuccess, entityId, shadow, className, hideDownloadButton, }: InvoiceQuoteContextProps): import("react/jsx-runtime").JSX.Element;
2
+ import { InvoiceQuoteContextProps } from "./InvoiceQuoteContext";
3
+ export default function Invoice({ id, invoiceQuoteViewComponent, backButtonName, onBackButtonClick, onInvoiceDownloadError, onPaymentSuccess, entityId, shadow, className, hideDownloadButton, onInvoiceLoaded, }: InvoiceQuoteContextProps): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { ShadowType } from "../../types/shadowType";
3
+ import { FormattedInvoice, FormattedQuote } from "@bunnyapp/common";
3
4
  export type InvoiceQuoteContextProps = {
4
5
  id?: string;
5
6
  invoiceQuoteViewComponent?: React.ReactNode;
@@ -11,5 +12,7 @@ export type InvoiceQuoteContextProps = {
11
12
  shadow?: ShadowType;
12
13
  className?: string;
13
14
  hideDownloadButton?: boolean;
15
+ onInvoiceLoaded?: (formattedInvoice: FormattedInvoice) => void;
16
+ onQuoteLoaded?: (formattedQuote: FormattedQuote) => void;
14
17
  };
15
18
  export declare const InvoiceQuoteContext: import("react").Context<InvoiceQuoteContextProps>;
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import { InvoiceQuoteContextProps } from "../Invoice/InvoiceQuoteContext";
3
3
  export declare const MarkupContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
4
- export default function Quote({ id, invoiceQuoteViewComponent, onInvoiceDownloadError, onPaymentSuccess, entityId, shadow, className, hideDownloadButton, }: InvoiceQuoteContextProps): import("react/jsx-runtime").JSX.Element;
4
+ export default function Quote({ id, invoiceQuoteViewComponent, onInvoiceDownloadError, onPaymentSuccess, entityId, shadow, className, hideDownloadButton, onQuoteLoaded, }: InvoiceQuoteContextProps): import("react/jsx-runtime").JSX.Element;
@@ -15,6 +15,8 @@ export declare const Default: import("@storybook/csf").StoryAnnotations<import("
15
15
  shadow?: import("../../types/shadowType").ShadowType | undefined;
16
16
  className?: string | undefined;
17
17
  hideDownloadButton?: boolean | undefined;
18
+ onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
19
+ onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
18
20
  }, {
19
21
  backButtonName?: string | undefined;
20
22
  onBackButtonClick?: (() => void) | undefined;
@@ -26,6 +28,8 @@ export declare const Default: import("@storybook/csf").StoryAnnotations<import("
26
28
  onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
27
29
  invoiceQuoteViewComponent?: import("react").ReactNode;
28
30
  onInvoiceDownloadError?: (() => void) | undefined;
31
+ onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
32
+ onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
29
33
  }>;
30
34
  export declare const NoShadow: import("@storybook/csf").StoryAnnotations<import("@storybook/react/dist/types-a5624094").R, {
31
35
  id?: string | undefined;
@@ -38,6 +42,8 @@ export declare const NoShadow: import("@storybook/csf").StoryAnnotations<import(
38
42
  shadow?: import("../../types/shadowType").ShadowType | undefined;
39
43
  className?: string | undefined;
40
44
  hideDownloadButton?: boolean | undefined;
45
+ onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
46
+ onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
41
47
  }, {
42
48
  backButtonName?: string | undefined;
43
49
  onBackButtonClick?: (() => void) | undefined;
@@ -49,6 +55,8 @@ export declare const NoShadow: import("@storybook/csf").StoryAnnotations<import(
49
55
  onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
50
56
  invoiceQuoteViewComponent?: import("react").ReactNode;
51
57
  onInvoiceDownloadError?: (() => void) | undefined;
58
+ onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
59
+ onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
52
60
  }>;
53
61
  export declare const Mobile: import("@storybook/csf").StoryAnnotations<import("@storybook/react/dist/types-a5624094").R, {
54
62
  id?: string | undefined;
@@ -61,6 +69,8 @@ export declare const Mobile: import("@storybook/csf").StoryAnnotations<import("@
61
69
  shadow?: import("../../types/shadowType").ShadowType | undefined;
62
70
  className?: string | undefined;
63
71
  hideDownloadButton?: boolean | undefined;
72
+ onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
73
+ onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
64
74
  }, {
65
75
  backButtonName?: string | undefined;
66
76
  onBackButtonClick?: (() => void) | undefined;
@@ -72,6 +82,8 @@ export declare const Mobile: import("@storybook/csf").StoryAnnotations<import("@
72
82
  onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
73
83
  invoiceQuoteViewComponent?: import("react").ReactNode;
74
84
  onInvoiceDownloadError?: (() => void) | undefined;
85
+ onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
86
+ onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
75
87
  }>;
76
88
  export declare const CustomClassName: import("@storybook/csf").StoryAnnotations<import("@storybook/react/dist/types-a5624094").R, {
77
89
  id?: string | undefined;
@@ -84,6 +96,8 @@ export declare const CustomClassName: import("@storybook/csf").StoryAnnotations<
84
96
  shadow?: import("../../types/shadowType").ShadowType | undefined;
85
97
  className?: string | undefined;
86
98
  hideDownloadButton?: boolean | undefined;
99
+ onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
100
+ onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
87
101
  }, {
88
102
  backButtonName?: string | undefined;
89
103
  onBackButtonClick?: (() => void) | undefined;
@@ -95,6 +109,8 @@ export declare const CustomClassName: import("@storybook/csf").StoryAnnotations<
95
109
  onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
96
110
  invoiceQuoteViewComponent?: import("react").ReactNode;
97
111
  onInvoiceDownloadError?: (() => void) | undefined;
112
+ onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
113
+ onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
98
114
  }>;
99
115
  export declare const HideDownloadButton: Story;
100
116
  export declare const AcceptedQuote: Story;
@@ -110,6 +126,8 @@ export declare const DarkMode: import("@storybook/csf").StoryAnnotations<import(
110
126
  shadow?: import("../../types/shadowType").ShadowType | undefined;
111
127
  className?: string | undefined;
112
128
  hideDownloadButton?: boolean | undefined;
129
+ onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
130
+ onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
113
131
  }, {
114
132
  backButtonName?: string | undefined;
115
133
  onBackButtonClick?: (() => void) | undefined;
@@ -121,4 +139,6 @@ export declare const DarkMode: import("@storybook/csf").StoryAnnotations<import(
121
139
  onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
122
140
  invoiceQuoteViewComponent?: import("react").ReactNode;
123
141
  onInvoiceDownloadError?: (() => void) | undefined;
142
+ onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
143
+ onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
124
144
  }>;
@@ -1,10 +1,11 @@
1
+ /// <reference types="react" />
1
2
  import { Subscription } from "@bunnyapp/common";
2
3
  import "../../styles/index.less";
3
4
  export type EditingQuoteDataType = {
4
5
  id: string;
5
6
  isTrial: boolean;
6
7
  };
7
- declare const Subscriptions: ({ className, companyName, entityId, hideExpired, onCancelSubscriptionClick, onChangePlanClick, onSubscriptionsLoaded, styles, }: {
8
+ declare const Subscriptions: ({ className, companyName, entityId, hideExpired, onCancelSubscriptionClick, onChangePlanClick, onSubscriptionsLoaded, styles, noSubscriptionsComponent, }: {
8
9
  className?: string | undefined;
9
10
  companyName: string;
10
11
  entityId: string;
@@ -15,6 +16,8 @@ declare const Subscriptions: ({ className, companyName, entityId, hideExpired, o
15
16
  styles?: {
16
17
  gap?: number | undefined;
17
18
  shadow?: "none" | "lg" | "md" | "sm" | undefined;
19
+ subscriptionProductNameStyle?: import("react").CSSProperties | undefined;
18
20
  } | undefined;
21
+ noSubscriptionsComponent?: React.ReactNode;
19
22
  }) => import("react/jsx-runtime").JSX.Element;
20
23
  export default Subscriptions;
@@ -3,5 +3,6 @@ export type SubscriptionsContextValues = {
3
3
  gap?: number;
4
4
  shadow?: "none" | "sm" | "md" | "lg";
5
5
  showTitle?: boolean;
6
+ subscriptionProductNameStyle?: React.CSSProperties;
6
7
  };
7
8
  export declare const SubscriptionsContext: import("react").Context<SubscriptionsContextValues>;
package/dist/esm/index.js CHANGED
@@ -4,12 +4,11 @@ import React__default, { createContext, useContext, useEffect, useState, useMemo
4
4
  import { Markup } from 'interweave';
5
5
  import { ConfigProvider, Button, Typography, Tag, Divider, Popconfirm, Input, Checkbox, Collapse, Modal, Form, Drawer, Card as Card$1, Select, Image, Dropdown, Skeleton } from 'antd';
6
6
  import styled from 'styled-components';
7
- import { DEFAULT_ACCENT_COLOR, DEFAULT_BRAND_COLOR, DEFAULT_SECONDARY_COLOR, DEFAULT_TOP_NAV_IMAGE_URL, gqlRequest as gqlRequest$1, QueryKeyFactory, useIsMobile, isColorTooDark, MARK_PRO, INPUT_BORDER_COLOR, SLATE_50, SLATE_400, SLATE_200, getPlugins, DEFAULT_CONFIG, useErrorNotification, formatCurrency, invokePlugin, GRAY_500, GRAY_200, useSuccessNotification, useAllErrorFormats, getFormattedInvoice, PAYABLE_INVOICE_STATES, BreakpointNumbers, DOCUMENT_NAME as DOCUMENT_NAME$1, useGraphQLmutation, formatDate, FrontendTransaction, SLATE_600, WHITE, TransactionKind, Lists, getAccount, SubscriptionChargeKind, SubscriptionState as SubscriptionState$2, MODAL_MAX_HEIGHT, SLATE_500, StringUtils, DataInterval, TAG_COLORS, PricingModel, ChargeType } from '@bunnyapp/common';
7
+ import { DEFAULT_ACCENT_COLOR, DEFAULT_BRAND_COLOR, DEFAULT_SECONDARY_COLOR, DEFAULT_TOP_NAV_IMAGE_URL, gqlRequest as gqlRequest$1, QueryKeyFactory, useIsMobile, isColorTooDark, MARK_PRO, INPUT_BORDER_COLOR, SLATE_50, SLATE_400, SLATE_200, getPlugins, DEFAULT_CONFIG, useErrorNotification, formatCurrency, invokePlugin, GRAY_500, GRAY_200, useSuccessNotification, useAllErrorFormats, getFormattedInvoice, PAYABLE_INVOICE_STATES, BreakpointNumbers, useGraphQLmutation, formatDate, FrontendTransaction, SLATE_600, WHITE, TransactionKind, Lists, getAccount, SubscriptionChargeKind, SubscriptionState as SubscriptionState$2, MODAL_MAX_HEIGHT, SLATE_500, StringUtils, DataInterval, TAG_COLORS, PricingModel, ChargeType } from '@bunnyapp/common';
8
8
  import { QueryClient, QueryClientProvider, useQuery, useQueryClient, keepPreviousData, useMutation } from '@tanstack/react-query';
9
9
  import theme from 'antd/lib/theme';
10
10
  import { RecoilRoot } from 'recoil';
11
11
  import request, { GraphQLClient } from 'graphql-request';
12
- import { HelmetProvider, Helmet } from 'react-helmet-async';
13
12
  import { useElements, useStripe, PaymentElement, Elements } from '@stripe/react-stripe-js';
14
13
  import { loadStripe } from '@stripe/stripe-js/pure';
15
14
  import { capitalize, startCase, cloneDeep, omit } from 'lodash';
@@ -1791,14 +1790,6 @@ var InvoiceQuoteView = function (_a) {
1791
1790
  };
1792
1791
  var templateObject_1$7;
1793
1792
 
1794
- var quoteMetaDescription = function (vendorName) {
1795
- return "View this quote on the ".concat(vendorName, " customer portal. Powered by Bunny");
1796
- };
1797
- var quoteMetaTitle = function (_a) {
1798
- var documentName = _a.documentName, vendorName = _a.vendorName;
1799
- return vendorName + " " + documentName;
1800
- };
1801
-
1802
1793
  var fetchPDF = function (apiEndpoint, invoiceUuid, token) { return __awaiter(void 0, void 0, void 0, function () {
1803
1794
  var response;
1804
1795
  return __generator(this, function (_a) {
@@ -2820,26 +2811,27 @@ function StripeWrapper(_a) {
2820
2811
  }
2821
2812
 
2822
2813
  function Invoice(_a) {
2823
- var id = _a.id, invoiceQuoteViewComponent = _a.invoiceQuoteViewComponent, backButtonName = _a.backButtonName, onBackButtonClick = _a.onBackButtonClick, onInvoiceDownloadError = _a.onInvoiceDownloadError, onPaymentSuccess = _a.onPaymentSuccess, entityId = _a.entityId, _b = _a.shadow, shadow = _b === void 0 ? "shadow-md" : _b, className = _a.className, _c = _a.hideDownloadButton, hideDownloadButton = _c === void 0 ? false : _c;
2824
- return (jsx(HelmetProvider, { children: jsx(InvoiceQuoteContext.Provider, __assign({ value: {
2825
- id: id,
2826
- invoiceQuoteViewComponent: invoiceQuoteViewComponent,
2827
- backButtonName: backButtonName,
2828
- onBackButtonClick: onBackButtonClick,
2829
- onInvoiceDownloadError: onInvoiceDownloadError,
2830
- onPaymentSuccess: onPaymentSuccess,
2831
- entityId: entityId,
2832
- shadow: shadow,
2833
- className: className,
2834
- hideDownloadButton: hideDownloadButton,
2835
- } }, { children: jsx(ActualInvoice, {}) })) }));
2814
+ var id = _a.id, invoiceQuoteViewComponent = _a.invoiceQuoteViewComponent, backButtonName = _a.backButtonName, onBackButtonClick = _a.onBackButtonClick, onInvoiceDownloadError = _a.onInvoiceDownloadError, onPaymentSuccess = _a.onPaymentSuccess, entityId = _a.entityId, _b = _a.shadow, shadow = _b === void 0 ? "shadow-md" : _b, className = _a.className, _c = _a.hideDownloadButton, hideDownloadButton = _c === void 0 ? false : _c, onInvoiceLoaded = _a.onInvoiceLoaded;
2815
+ return (jsx(InvoiceQuoteContext.Provider, __assign({ value: {
2816
+ id: id,
2817
+ invoiceQuoteViewComponent: invoiceQuoteViewComponent,
2818
+ backButtonName: backButtonName,
2819
+ onBackButtonClick: onBackButtonClick,
2820
+ onInvoiceDownloadError: onInvoiceDownloadError,
2821
+ onPaymentSuccess: onPaymentSuccess,
2822
+ entityId: entityId,
2823
+ shadow: shadow,
2824
+ className: className,
2825
+ hideDownloadButton: hideDownloadButton,
2826
+ onInvoiceLoaded: onInvoiceLoaded,
2827
+ } }, { children: jsx(ActualInvoice, {}) })));
2836
2828
  }
2837
2829
  function ActualInvoice() {
2838
2830
  // Context
2839
2831
  var queryClient = useQueryClient();
2840
2832
  var _a = useContext(InvoiceQuoteContext), id = _a.id, invoiceQuoteViewComponent = _a.invoiceQuoteViewComponent, backButtonName = _a.backButtonName, onBackButtonClick = _a.onBackButtonClick, entityId = _a.entityId, className = _a.className;
2841
2833
  var _b = useContext(BunnyContext), apiHost = _b.apiHost, onTokenExpired = _b.onTokenExpired, graphQLClient = _b.graphQLClient;
2842
- var hideDownloadButton = useContext(InvoiceQuoteContext).hideDownloadButton;
2834
+ var _c = useContext(InvoiceQuoteContext), hideDownloadButton = _c.hideDownloadButton, onInvoiceLoaded = _c.onInvoiceLoaded;
2843
2835
  var token = useToken();
2844
2836
  // Hooks
2845
2837
  var showSuccessNotification = useSuccessNotification();
@@ -2853,8 +2845,6 @@ function ActualInvoice() {
2853
2845
  var isInvoicePayable = PAYABLE_INVOICE_STATES.includes((formattedInvoice === null || formattedInvoice === void 0 ? void 0 : formattedInvoice.state) || "");
2854
2846
  // Local state
2855
2847
  var isMobile = useIsMobile(isInvoicePayable ? BreakpointNumbers.lg : undefined);
2856
- if (!formattedInvoice)
2857
- return jsx(Fragment, {});
2858
2848
  var onSuccess = function () {
2859
2849
  queryClient.invalidateQueries({
2860
2850
  queryKey: QueryKeyFactory.default.transactionsKey(),
@@ -2867,10 +2857,14 @@ function ActualInvoice() {
2867
2857
  var onFail = function (error) {
2868
2858
  handleAllErrorFormats(error.message);
2869
2859
  };
2870
- return (jsxs(Fragment, { children: [jsxs(Helmet, { children: [jsxs("title", { children: [formattedInvoice.vendorName, " ", DOCUMENT_NAME$1.INVOICE] }), jsx("meta", { name: "description", content: quoteMetaDescription(formattedInvoice.vendorName) }), jsx("meta", { property: "og:type", content: "website" }), jsx("meta", { property: "og:title", content: quoteMetaTitle({
2871
- vendorName: formattedInvoice.vendorName,
2872
- documentName: DOCUMENT_NAME$1.INVOICE,
2873
- }) }), jsx("meta", { property: "og:description", content: quoteMetaDescription(formattedInvoice.vendorName) })] }), jsxs("div", __assign({ className: "flex gap-6 ".concat(isMobile ? "flex-col w-full overflow-hidden" : "shadow-padding-xb", " ").concat(className) }, { children: [formattedInvoice.isLegacy ? (jsx("div", __assign({ className: "flex justify-center w-full" }, { children: jsx(InvoicePDF, { invoiceUuid: formattedInvoice.uuid, apiHost: apiHost, token: token }) }))) : (invoiceQuoteViewComponent || (jsx(InvoiceQuoteView, { html: formattedInvoice.html, formattedInvoice: formattedInvoice, backButtonName: backButtonName, onBackButtonClick: onBackButtonClick }))), isInvoicePayable && (jsx("div", __assign({ className: "w-full ".concat(hideDownloadButton || formattedInvoice.isLegacy ? "" : "pt-12") }, { children: jsx(PaymentForm, { entityId: entityId, onPaymentSuccess: onSuccess, onFail: onFail, invoice: formattedInvoice, graphQLClient: graphQLClient }) })))] }))] }));
2860
+ useEffect(function () {
2861
+ if (formattedInvoice) {
2862
+ onInvoiceLoaded === null || onInvoiceLoaded === void 0 ? void 0 : onInvoiceLoaded(formattedInvoice);
2863
+ }
2864
+ }, [formattedInvoice]);
2865
+ if (!formattedInvoice)
2866
+ return jsx(Fragment, {});
2867
+ return (jsx(Fragment, { children: jsxs("div", __assign({ className: "flex gap-6 ".concat(isMobile ? "flex-col w-full overflow-hidden" : "shadow-padding-xb", " ").concat(className) }, { children: [formattedInvoice.isLegacy ? (jsx("div", __assign({ className: "flex justify-center w-full" }, { children: jsx(InvoicePDF, { invoiceUuid: formattedInvoice.uuid, apiHost: apiHost, token: token }) }))) : (invoiceQuoteViewComponent || (jsx(InvoiceQuoteView, { html: formattedInvoice.html, formattedInvoice: formattedInvoice, backButtonName: backButtonName, onBackButtonClick: onBackButtonClick }))), isInvoicePayable && (jsx("div", __assign({ className: "w-full ".concat(hideDownloadButton || formattedInvoice.isLegacy ? "" : "pt-12") }, { children: jsx(PaymentForm, { entityId: entityId, onPaymentSuccess: onSuccess, onFail: onFail, invoice: formattedInvoice, graphQLClient: graphQLClient }) })))] })) }));
2874
2868
  }
2875
2869
 
2876
2870
  var MUTATION$6 = function (id) { return "\n query formattedQuote ($id: ID) {\n formattedQuote (id: $id) {\n payableId\n acceptedAt\n acceptedByName\n amount\n amountDue\n amountsByPeriod {\n id\n name\n amount\n }\n object { documents { id filename size date url } }\n billingCity\n billingCountry\n billingState\n billingStreet\n billingZip\n contactName\n currency\n customerBillingCity\n customerBillingCountry\n customerBillingState\n customerBillingStreet\n customerBillingZip\n customerName\n discount\n discountValue\n duration\n endDate\n expiresAt\n html\n formattedLines {\n amount\n amountsByPeriod {\n quantity\n id\n name\n startDate\n endDate\n amount\n amountsByTier {\n id\n tier {\n starts\n ends\n price\n }\n quantity\n amount\n }\n prorationRate\n }\n billingPeriodEnd\n billingPeriodStart\n chargeType\n discount\n frequency\n isRamp\n periods\n planName\n position\n price\n priceDecimals\n priceListChargeId\n priceListChargeName\n priceListId\n priceListName\n priceTiers {\n price\n starts\n }\n pricingModel\n productName\n prorationRate\n quantity\n showProductNameOnLineItem\n taxCode\n trialEndDate\n trialStartDate\n unitOfMeasure\n vatCode\n }\n netPaymentDays\n notes\n number\n poNumberRequired\n salesContactEmail\n sharedAt\n startDate\n state\n subtotal\n taxAmount\n taxNumberLabel\n taxNumberRequired\n vendorName\n }\n }"; };
@@ -3119,27 +3113,21 @@ var AcceptQuoteModal = function (_a) {
3119
3113
  }, 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, {}) })))] })) })));
3120
3114
  };
3121
3115
 
3122
- var DOCUMENT_NAME;
3123
- (function (DOCUMENT_NAME) {
3124
- DOCUMENT_NAME["INVOICE"] = "invoice";
3125
- DOCUMENT_NAME["QUOTE"] = "quote";
3126
- })(DOCUMENT_NAME || (DOCUMENT_NAME = {}));
3127
-
3128
3116
  var Text$b = Typography.Text;
3129
- var documentName = DOCUMENT_NAME.QUOTE;
3130
3117
  styled.div(templateObject_1$3 || (templateObject_1$3 = __makeTemplateObject(["\n span {\n width: 100%;\n }\n"], ["\n span {\n width: 100%;\n }\n"])));
3131
3118
  function Quote(_a) {
3132
- var id = _a.id, invoiceQuoteViewComponent = _a.invoiceQuoteViewComponent, onInvoiceDownloadError = _a.onInvoiceDownloadError, onPaymentSuccess = _a.onPaymentSuccess, entityId = _a.entityId, _b = _a.shadow, shadow = _b === void 0 ? "shadow-md" : _b, className = _a.className, _c = _a.hideDownloadButton, hideDownloadButton = _c === void 0 ? false : _c;
3133
- return (jsx(HelmetProvider, { children: jsx(InvoiceQuoteContext.Provider, __assign({ value: {
3134
- id: id,
3135
- invoiceQuoteViewComponent: invoiceQuoteViewComponent,
3136
- onInvoiceDownloadError: onInvoiceDownloadError,
3137
- onPaymentSuccess: onPaymentSuccess,
3138
- entityId: entityId,
3139
- shadow: shadow,
3140
- className: className,
3141
- hideDownloadButton: hideDownloadButton,
3142
- } }, { children: jsx(ActualQuote, { entityId: entityId }) })) }));
3119
+ var id = _a.id, invoiceQuoteViewComponent = _a.invoiceQuoteViewComponent, onInvoiceDownloadError = _a.onInvoiceDownloadError, onPaymentSuccess = _a.onPaymentSuccess, entityId = _a.entityId, _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;
3120
+ return (jsx(InvoiceQuoteContext.Provider, __assign({ value: {
3121
+ id: id,
3122
+ invoiceQuoteViewComponent: invoiceQuoteViewComponent,
3123
+ onInvoiceDownloadError: onInvoiceDownloadError,
3124
+ onPaymentSuccess: onPaymentSuccess,
3125
+ entityId: entityId,
3126
+ shadow: shadow,
3127
+ className: className,
3128
+ hideDownloadButton: hideDownloadButton,
3129
+ onQuoteLoaded: onQuoteLoaded,
3130
+ } }, { children: jsx(ActualQuote, { entityId: entityId }) })));
3143
3131
  }
3144
3132
  function ActualQuote(_a) {
3145
3133
  var _this = this;
@@ -3149,7 +3137,7 @@ function ActualQuote(_a) {
3149
3137
  var _d = useContext(BunnyContext), apiHost = _d.apiHost, onTokenExpired = _d.onTokenExpired;
3150
3138
  var token = useToken();
3151
3139
  var entityBranding = useContext(BrandContext);
3152
- var _e = useContext(InvoiceQuoteContext), className = _e.className, id = _e.id, hideDownloadButton = _e.hideDownloadButton;
3140
+ var _e = useContext(InvoiceQuoteContext), className = _e.className, id = _e.id, hideDownloadButton = _e.hideDownloadButton, onQuoteLoaded = _e.onQuoteLoaded;
3153
3141
  // Queries
3154
3142
  var _f = useQuery({
3155
3143
  queryKey: QueryKeyFactory.default.createQuoteKey(token, id),
@@ -3185,15 +3173,17 @@ function ActualQuote(_a) {
3185
3173
  useSigningComplete({ data: formattedQuote, token: token });
3186
3174
  var isMobile = useIsMobile();
3187
3175
  var showErrorNotification = useErrorNotification();
3176
+ useEffect(function () {
3177
+ if (formattedQuote) {
3178
+ onQuoteLoaded === null || onQuoteLoaded === void 0 ? void 0 : onQuoteLoaded(formattedQuote);
3179
+ }
3180
+ }, [formattedQuote]);
3188
3181
  if (!formattedQuote || isLoading) {
3189
3182
  return jsx(Fragment, {});
3190
3183
  }
3191
3184
  // Derived state
3192
3185
  var isAccepted = formattedQuote.state === "ACCEPTED";
3193
- return (jsxs(Fragment, { children: [jsxs(Helmet, { children: [jsxs("title", { children: [formattedQuote.vendorName, " ", documentName] }), jsx("meta", { name: "description", content: quoteMetaDescription(formattedQuote.vendorName) }), jsx("meta", { property: "og:type", content: "website" }), jsx("meta", { property: "og:title", content: quoteMetaTitle({
3194
- vendorName: formattedQuote.vendorName,
3195
- documentName: documentName,
3196
- }) }), jsx("meta", { property: "og:description", content: quoteMetaDescription(formattedQuote.vendorName) })] }), jsxs("div", __assign({ className: "flex flex-col gap-4 ".concat(isMobile ? "w-full overflow-hidden" : "shadow-padding-xb", " ").concat(className) }, { children: [jsxs("div", __assign({ className: "flex flex-row justify-end items-center gap-4", id: "acceptance", style: {
3186
+ return (jsxs(Fragment, { children: [jsxs("div", __assign({ className: "flex flex-col gap-4 ".concat(isMobile ? "w-full overflow-hidden" : "shadow-padding-xb", " ").concat(className) }, { children: [jsxs("div", __assign({ className: "flex flex-row justify-end items-center gap-4", id: "acceptance", style: {
3197
3187
  color: entityBranding.secondaryColor,
3198
3188
  } }, { children: [isAccepted && formattedQuote.acceptedAt ? (jsx(Text$b, { children: "Quote was accepted by ".concat(formattedQuote.acceptedByName, " on ").concat(formatDate(formattedQuote.acceptedAt)) })) : null, (!isMobile || !isAccepted) && (jsxs("div", __assign({ className: isMobile
3199
3189
  ? "flex w-full justify-end gap-2"
@@ -4185,6 +4175,36 @@ function Signup(_a) {
4185
4175
  : "w-1/2 items-center justify-center my-12") }, { children: jsx("div", __assign({ className: "".concat(isMobile ? "w-full" : "w-1/2") }, { children: jsx(PaymentForms, { entityId: entityId, quote: quote, handlePaymentSuccess: handlePaymentSuccess, handlePaymentFail: handlePaymentFail, handleSubmit: handleSubmit, proceedingToPayment: proceedingToPayment, accountId: accountId, overrideToken: portalSessionToken, customCheckoutFunction: accountSignupFunction }) })) }))] }))) })));
4186
4176
  }
4187
4177
 
4178
+ // WARNING: There is a preview button on APP that will need to be changed if this query is changed
4179
+ 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 }";
4180
+ var getPlanChangeOptions = function (_a) {
4181
+ var isInPreviewMode = _a.isInPreviewMode, token = _a.token, upgradingSubscription = _a.upgradingSubscription, apiHost = _a.apiHost;
4182
+ return __awaiter(void 0, void 0, void 0, function () {
4183
+ var response, planChangeOptions;
4184
+ return __generator(this, function (_b) {
4185
+ switch (_b.label) {
4186
+ case 0: return [4 /*yield*/, gqlRequest$1({
4187
+ isInPreviewMode: isInPreviewMode,
4188
+ query: PLAN_CHANGE_OPTIONS_QUERY,
4189
+ vars: { subscriptionId: upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.id },
4190
+ token: token,
4191
+ apiHost: apiHost,
4192
+ })];
4193
+ case 1:
4194
+ response = _b.sent();
4195
+ planChangeOptions = response.planChangeOptions;
4196
+ if (planChangeOptions === null || planChangeOptions === void 0 ? void 0 : planChangeOptions.errors)
4197
+ throw planChangeOptions.errors;
4198
+ // Sort planChangeOptions.plans by position
4199
+ if (planChangeOptions === null || planChangeOptions === void 0 ? void 0 : planChangeOptions.plans) {
4200
+ planChangeOptions.plans.sort(function (a, b) { return a.position - b.position; });
4201
+ }
4202
+ return [2 /*return*/, planChangeOptions];
4203
+ }
4204
+ });
4205
+ });
4206
+ };
4207
+
4188
4208
  var SUBSCRIPTIONS_QUERY = "\nquery subscriptions {\n subscriptions {\n nodes {\n cancellationDate\n currencyId\n endDate\n evergreen\n id\n period\n plan { id name selfServiceBuy selfServiceCancel selfServiceRenew }\n priceList { id periodMonths }\n product { id name showProductNameOnLineItem }\n startDate\n state\n trialEndDate\n trialPeriod\n trialStartDate\n charges {\n priceListCharge {\n priceListChargeTiers {\n price\n starts\n }\n }\n amount\n billingPeriod\n chargeType\n discount\n discountedPrice\n endDate\n expired\n feature { name }\n id\n isAmendment\n isRamp\n kind\n name\n periodPrice\n price\n priceDecimals\n priceListChargeId\n priceTiers { starts price }\n pricingModel\n quantity\n selfServiceQuantity\n startDate\n trial\n }\n }\n }\n }";
4189
4209
  var getSubscriptions = function (_a) {
4190
4210
  var apiHost = _a.apiHost, entityId = _a.entityId, isInPreviewMode = _a.isInPreviewMode, token = _a.token;
@@ -4278,6 +4298,8 @@ var ErrorView = function (_a) {
4278
4298
  return (jsxs("div", __assign({ className: "flex flex-col w-full", style: { marginTop: "80px" } }, { children: [jsx("div", __assign({ style: { fontSize: "32px" } }, { children: message })), children] })));
4279
4299
  };
4280
4300
 
4301
+ var SubscriptionsContext = createContext({});
4302
+
4281
4303
  var SubscriptionState;
4282
4304
  (function (SubscriptionState) {
4283
4305
  SubscriptionState["ACTIVE"] = "ACTIVE";
@@ -4473,8 +4495,6 @@ var FeatureBarChart = function (_a) {
4473
4495
  var StyledBarChart = styled(BarChart)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n .recharts-surface {\n overflow: visible;\n }\n"], ["\n .recharts-surface {\n overflow: visible;\n }\n"])));
4474
4496
  var templateObject_1;
4475
4497
 
4476
- var SubscriptionsContext = createContext({});
4477
-
4478
4498
  var isSubscriptionNotActive = function (subscription) {
4479
4499
  var _a, _b;
4480
4500
  return ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState$2.EXPIRED ||
@@ -4519,13 +4539,14 @@ var SubscriptionCardHeader = function (_a) {
4519
4539
  var onChangePlanClick = _a.onChangePlanClick, onCancelSubscriptionClick = _a.onCancelSubscriptionClick, planChangeOptions = _a.planChangeOptions, subscription = _a.subscription;
4520
4540
  var darkMode = useContext(BunnyContext).darkMode;
4521
4541
  var brandColor = useContext(BrandContext).brandColor;
4542
+ var subscriptionProductNameStyle = useContext(SubscriptionsContext).subscriptionProductNameStyle;
4522
4543
  var isMobile = useIsMobile();
4523
4544
  // Derived state
4524
4545
  var trialDaysLeft = dayjs(subscription.trialEndDate).diff(dayjs(), "days");
4525
4546
  var isTrial = ((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === SubscriptionState$2.TRIAL;
4526
4547
  return (jsxs("div", __assign({ className: "flex items-center justify-between", style: {
4527
4548
  backgroundColor: darkMode ? "var(--row-background-dark)" : "",
4528
- } }, { 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("div", __assign({ className: "font-medium", style: { fontSize: "11px", color: brandColor } }, { 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$2, __assign({ className: "text-lg" }, { children: subscription.plan.name }))), jsxs(Tag, __assign({ className: "ant-tag-".concat(TAG_COLORS[(_f = subscription.state) === null || _f === void 0 ? void 0 : _f.toUpperCase()]) }, { children: [capitalize(subscription.state.toLowerCase()), isTrial ? " (".concat(trialDaysLeft, " days left)") : ""] }))] }))] })), jsxs("div", __assign({ className: "flex items-center gap-6" }, { children: [jsx(Text$2, __assign({ className: "grow text-xs" }, { children: getSubscriptionStatusText(subscription) })), !isMobile &&
4549
+ } }, { 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("div", __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$2, __assign({ className: "text-lg" }, { children: subscription.plan.name }))), jsxs(Tag, __assign({ className: "ant-tag-".concat(TAG_COLORS[(_f = subscription.state) === null || _f === void 0 ? void 0 : _f.toUpperCase()]) }, { children: [capitalize(subscription.state.toLowerCase()), isTrial ? " (".concat(trialDaysLeft, " days left)") : ""] }))] }))] })), jsxs("div", __assign({ className: "flex items-center gap-6" }, { children: [jsx(Text$2, __assign({ className: "grow text-xs" }, { children: getSubscriptionStatusText(subscription) })), !isMobile &&
4529
4550
  planChangeOptions &&
4530
4551
  onChangePlanClick &&
4531
4552
  onCancelSubscriptionClick && (jsx(SubscriptionCardActions, { onChangePlanClick: onChangePlanClick, onCancelSubscriptionClick: onCancelSubscriptionClick, planChangeOptions: planChangeOptions, subscription: subscription }))] }))] })));
@@ -4741,41 +4762,15 @@ var SubscriptionsList = function (_a) {
4741
4762
  }) }));
4742
4763
  };
4743
4764
 
4744
- // WARNING: There is a preview button on APP that will need to be changed if this query is changed
4745
- 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 }";
4746
- var getPlanChangeOptions = function (_a) {
4747
- var isInPreviewMode = _a.isInPreviewMode, token = _a.token, upgradingSubscription = _a.upgradingSubscription, apiHost = _a.apiHost;
4748
- return __awaiter(void 0, void 0, void 0, function () {
4749
- var response, planChangeOptions;
4750
- return __generator(this, function (_b) {
4751
- switch (_b.label) {
4752
- case 0: return [4 /*yield*/, gqlRequest$1({
4753
- isInPreviewMode: isInPreviewMode,
4754
- query: PLAN_CHANGE_OPTIONS_QUERY,
4755
- vars: { subscriptionId: upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.id },
4756
- token: token,
4757
- apiHost: apiHost,
4758
- })];
4759
- case 1:
4760
- response = _b.sent();
4761
- planChangeOptions = response.planChangeOptions;
4762
- if (planChangeOptions === null || planChangeOptions === void 0 ? void 0 : planChangeOptions.errors)
4763
- throw planChangeOptions.errors;
4764
- // Sort planChangeOptions.plans by position
4765
- if (planChangeOptions === null || planChangeOptions === void 0 ? void 0 : planChangeOptions.plans) {
4766
- planChangeOptions.plans.sort(function (a, b) { return a.position - b.position; });
4767
- }
4768
- return [2 /*return*/, planChangeOptions];
4769
- }
4770
- });
4771
- });
4772
- };
4773
-
4774
4765
  var Subscriptions = function (_a) {
4775
4766
  var className = _a.className, companyName = _a.companyName, entityId = _a.entityId, _b = _a.hideExpired, hideExpired = _b === void 0 ? false : _b, onCancelSubscriptionClick = _a.onCancelSubscriptionClick, onChangePlanClick = _a.onChangePlanClick, onSubscriptionsLoaded = _a.onSubscriptionsLoaded, _c = _a.styles, styles = _c === void 0 ? {
4776
4767
  gap: 4,
4777
4768
  shadow: "sm",
4778
- } : _c;
4769
+ subscriptionProductNameStyle: {
4770
+ fontSize: "11px",
4771
+ fontWeight: 500,
4772
+ },
4773
+ } : _c, noSubscriptionsComponent = _a.noSubscriptionsComponent;
4779
4774
  var gap = styles.gap, shadow = styles.shadow;
4780
4775
  // Context
4781
4776
  var apiHost = useContext(BunnyContext).apiHost;
@@ -4803,7 +4798,8 @@ var Subscriptions = function (_a) {
4803
4798
  return (jsx(SubscriptionsContext.Provider, __assign({ value: {
4804
4799
  gap: gap,
4805
4800
  shadow: shadow,
4806
- } }, { children: jsx("div", __assign({ className: "flex flex-col gap-".concat(gap, " shrink shadow-padding-xb overflow-auto ").concat(className) }, { children: (subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.length) > 0 ? (jsx(SubscriptionsList, { hideExpired: hideExpired, onChangePlanClick: onChangePlanClick, onCancelSubscriptionClick: onCancelSubscriptionClick, planChangeOptions: planChangeOptions, subscriptions: subscriptions })) : (jsx("div", __assign({ className: "flex flex-col items-center w-full" }, { children: jsx(ErrorView, { message: "You have no subscriptions with ".concat(companyName, " yet") }) }))) })) })));
4801
+ subscriptionProductNameStyle: styles.subscriptionProductNameStyle,
4802
+ } }, { children: jsx("div", __assign({ className: "flex flex-col gap-".concat(gap, " shrink shadow-padding-xb overflow-auto ").concat(className) }, { 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") }) })))) })) })));
4807
4803
  };
4808
4804
 
4809
4805
  var MUTATION = "\nmutation BillingDetailsUpdate(\n $attributes: BillingDetailsAttributes!) {\n billingDetailsUpdate(\n attributes: $attributes\n ) {\n billingDetails {\n billingCity\n billingContact {\n email\n }\n billingCountry\n billingState\n billingStreet\n billingZip\n name\n taxNumber\n }\n errors\n }\n }\n";
@@ -1,3 +1,3 @@
1
- import { InvoiceQuoteContextProps } from "./InvoiceQuoteContext";
2
1
  import "../../styles/index.less";
3
- export default function Invoice({ id, invoiceQuoteViewComponent, backButtonName, onBackButtonClick, onInvoiceDownloadError, onPaymentSuccess, entityId, shadow, className, hideDownloadButton, }: InvoiceQuoteContextProps): import("react/jsx-runtime").JSX.Element;
2
+ import { InvoiceQuoteContextProps } from "./InvoiceQuoteContext";
3
+ export default function Invoice({ id, invoiceQuoteViewComponent, backButtonName, onBackButtonClick, onInvoiceDownloadError, onPaymentSuccess, entityId, shadow, className, hideDownloadButton, onInvoiceLoaded, }: InvoiceQuoteContextProps): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { ShadowType } from "../../types/shadowType";
3
+ import { FormattedInvoice, FormattedQuote } from "@bunnyapp/common";
3
4
  export type InvoiceQuoteContextProps = {
4
5
  id?: string;
5
6
  invoiceQuoteViewComponent?: React.ReactNode;
@@ -11,5 +12,7 @@ export type InvoiceQuoteContextProps = {
11
12
  shadow?: ShadowType;
12
13
  className?: string;
13
14
  hideDownloadButton?: boolean;
15
+ onInvoiceLoaded?: (formattedInvoice: FormattedInvoice) => void;
16
+ onQuoteLoaded?: (formattedQuote: FormattedQuote) => void;
14
17
  };
15
18
  export declare const InvoiceQuoteContext: import("react").Context<InvoiceQuoteContextProps>;
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import { InvoiceQuoteContextProps } from "../Invoice/InvoiceQuoteContext";
3
3
  export declare const MarkupContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
4
- export default function Quote({ id, invoiceQuoteViewComponent, onInvoiceDownloadError, onPaymentSuccess, entityId, shadow, className, hideDownloadButton, }: InvoiceQuoteContextProps): import("react/jsx-runtime").JSX.Element;
4
+ export default function Quote({ id, invoiceQuoteViewComponent, onInvoiceDownloadError, onPaymentSuccess, entityId, shadow, className, hideDownloadButton, onQuoteLoaded, }: InvoiceQuoteContextProps): import("react/jsx-runtime").JSX.Element;
@@ -15,6 +15,8 @@ export declare const Default: import("@storybook/csf").StoryAnnotations<import("
15
15
  shadow?: import("../../types/shadowType").ShadowType | undefined;
16
16
  className?: string | undefined;
17
17
  hideDownloadButton?: boolean | undefined;
18
+ onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
19
+ onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
18
20
  }, {
19
21
  backButtonName?: string | undefined;
20
22
  onBackButtonClick?: (() => void) | undefined;
@@ -26,6 +28,8 @@ export declare const Default: import("@storybook/csf").StoryAnnotations<import("
26
28
  onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
27
29
  invoiceQuoteViewComponent?: import("react").ReactNode;
28
30
  onInvoiceDownloadError?: (() => void) | undefined;
31
+ onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
32
+ onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
29
33
  }>;
30
34
  export declare const NoShadow: import("@storybook/csf").StoryAnnotations<import("@storybook/react/dist/types-a5624094").R, {
31
35
  id?: string | undefined;
@@ -38,6 +42,8 @@ export declare const NoShadow: import("@storybook/csf").StoryAnnotations<import(
38
42
  shadow?: import("../../types/shadowType").ShadowType | undefined;
39
43
  className?: string | undefined;
40
44
  hideDownloadButton?: boolean | undefined;
45
+ onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
46
+ onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
41
47
  }, {
42
48
  backButtonName?: string | undefined;
43
49
  onBackButtonClick?: (() => void) | undefined;
@@ -49,6 +55,8 @@ export declare const NoShadow: import("@storybook/csf").StoryAnnotations<import(
49
55
  onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
50
56
  invoiceQuoteViewComponent?: import("react").ReactNode;
51
57
  onInvoiceDownloadError?: (() => void) | undefined;
58
+ onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
59
+ onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
52
60
  }>;
53
61
  export declare const Mobile: import("@storybook/csf").StoryAnnotations<import("@storybook/react/dist/types-a5624094").R, {
54
62
  id?: string | undefined;
@@ -61,6 +69,8 @@ export declare const Mobile: import("@storybook/csf").StoryAnnotations<import("@
61
69
  shadow?: import("../../types/shadowType").ShadowType | undefined;
62
70
  className?: string | undefined;
63
71
  hideDownloadButton?: boolean | undefined;
72
+ onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
73
+ onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
64
74
  }, {
65
75
  backButtonName?: string | undefined;
66
76
  onBackButtonClick?: (() => void) | undefined;
@@ -72,6 +82,8 @@ export declare const Mobile: import("@storybook/csf").StoryAnnotations<import("@
72
82
  onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
73
83
  invoiceQuoteViewComponent?: import("react").ReactNode;
74
84
  onInvoiceDownloadError?: (() => void) | undefined;
85
+ onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
86
+ onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
75
87
  }>;
76
88
  export declare const CustomClassName: import("@storybook/csf").StoryAnnotations<import("@storybook/react/dist/types-a5624094").R, {
77
89
  id?: string | undefined;
@@ -84,6 +96,8 @@ export declare const CustomClassName: import("@storybook/csf").StoryAnnotations<
84
96
  shadow?: import("../../types/shadowType").ShadowType | undefined;
85
97
  className?: string | undefined;
86
98
  hideDownloadButton?: boolean | undefined;
99
+ onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
100
+ onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
87
101
  }, {
88
102
  backButtonName?: string | undefined;
89
103
  onBackButtonClick?: (() => void) | undefined;
@@ -95,6 +109,8 @@ export declare const CustomClassName: import("@storybook/csf").StoryAnnotations<
95
109
  onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
96
110
  invoiceQuoteViewComponent?: import("react").ReactNode;
97
111
  onInvoiceDownloadError?: (() => void) | undefined;
112
+ onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
113
+ onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
98
114
  }>;
99
115
  export declare const HideDownloadButton: Story;
100
116
  export declare const AcceptedQuote: Story;
@@ -110,6 +126,8 @@ export declare const DarkMode: import("@storybook/csf").StoryAnnotations<import(
110
126
  shadow?: import("../../types/shadowType").ShadowType | undefined;
111
127
  className?: string | undefined;
112
128
  hideDownloadButton?: boolean | undefined;
129
+ onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
130
+ onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
113
131
  }, {
114
132
  backButtonName?: string | undefined;
115
133
  onBackButtonClick?: (() => void) | undefined;
@@ -121,4 +139,6 @@ export declare const DarkMode: import("@storybook/csf").StoryAnnotations<import(
121
139
  onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
122
140
  invoiceQuoteViewComponent?: import("react").ReactNode;
123
141
  onInvoiceDownloadError?: (() => void) | undefined;
142
+ onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
143
+ onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
124
144
  }>;
@@ -1,10 +1,11 @@
1
+ /// <reference types="react" />
1
2
  import { Subscription } from "@bunnyapp/common";
2
3
  import "../../styles/index.less";
3
4
  export type EditingQuoteDataType = {
4
5
  id: string;
5
6
  isTrial: boolean;
6
7
  };
7
- declare const Subscriptions: ({ className, companyName, entityId, hideExpired, onCancelSubscriptionClick, onChangePlanClick, onSubscriptionsLoaded, styles, }: {
8
+ declare const Subscriptions: ({ className, companyName, entityId, hideExpired, onCancelSubscriptionClick, onChangePlanClick, onSubscriptionsLoaded, styles, noSubscriptionsComponent, }: {
8
9
  className?: string | undefined;
9
10
  companyName: string;
10
11
  entityId: string;
@@ -15,6 +16,8 @@ declare const Subscriptions: ({ className, companyName, entityId, hideExpired, o
15
16
  styles?: {
16
17
  gap?: number | undefined;
17
18
  shadow?: "none" | "lg" | "md" | "sm" | undefined;
19
+ subscriptionProductNameStyle?: import("react").CSSProperties | undefined;
18
20
  } | undefined;
21
+ noSubscriptionsComponent?: React.ReactNode;
19
22
  }) => import("react/jsx-runtime").JSX.Element;
20
23
  export default Subscriptions;
@@ -3,5 +3,6 @@ export type SubscriptionsContextValues = {
3
3
  gap?: number;
4
4
  shadow?: "none" | "sm" | "md" | "lg";
5
5
  showTitle?: boolean;
6
+ subscriptionProductNameStyle?: React.CSSProperties;
6
7
  };
7
8
  export declare const SubscriptionsContext: import("react").Context<SubscriptionsContextValues>;
package/dist/index.d.ts CHANGED
@@ -1,9 +1,10 @@
1
1
  /// <reference types="react" />
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
- import { FrontendTransaction, FormattedInvoice, Quote as Quote$1, PriceList, PaymentMethod as PaymentMethod$1, TransactionKind, Subscription } from '@bunnyapp/common';
3
+ import { FormattedInvoice, FormattedQuote, FrontendTransaction, Quote as Quote$1, PriceList, PaymentMethod as PaymentMethod$1, TransactionKind, Subscription } from '@bunnyapp/common';
4
4
  import { QueryClient } from '@tanstack/react-query';
5
5
  import { ThemeConfig } from 'antd';
6
- import react from 'react';
6
+ import * as react from 'react';
7
+ import react__default from 'react';
7
8
  import * as _tanstack_react_query_build_legacy_types from '@tanstack/react-query/build/legacy/types';
8
9
  import { GraphQLClient } from 'graphql-request';
9
10
 
@@ -20,9 +21,11 @@ type InvoiceQuoteContextProps = {
20
21
  shadow?: ShadowType;
21
22
  className?: string;
22
23
  hideDownloadButton?: boolean;
24
+ onInvoiceLoaded?: (formattedInvoice: FormattedInvoice) => void;
25
+ onQuoteLoaded?: (formattedQuote: FormattedQuote) => void;
23
26
  };
24
27
 
25
- declare function Invoice({ id, invoiceQuoteViewComponent, backButtonName, onBackButtonClick, onInvoiceDownloadError, onPaymentSuccess, entityId, shadow, className, hideDownloadButton, }: InvoiceQuoteContextProps): react_jsx_runtime.JSX.Element;
28
+ declare function Invoice({ id, invoiceQuoteViewComponent, backButtonName, onBackButtonClick, onInvoiceDownloadError, onPaymentSuccess, entityId, shadow, className, hideDownloadButton, onInvoiceLoaded, }: InvoiceQuoteContextProps): react_jsx_runtime.JSX.Element;
26
29
 
27
30
  declare global {
28
31
  interface Window {
@@ -32,7 +35,7 @@ declare global {
32
35
  }
33
36
  }
34
37
 
35
- declare function Quote({ id, invoiceQuoteViewComponent, onInvoiceDownloadError, onPaymentSuccess, entityId, shadow, className, hideDownloadButton, }: InvoiceQuoteContextProps): react_jsx_runtime.JSX.Element;
38
+ declare function Quote({ id, invoiceQuoteViewComponent, onInvoiceDownloadError, onPaymentSuccess, entityId, shadow, className, hideDownloadButton, onQuoteLoaded, }: InvoiceQuoteContextProps): react_jsx_runtime.JSX.Element;
36
39
 
37
40
  type TransactionListColumnType = "date-and-title" | "state" | "amount" | "download";
38
41
 
@@ -134,7 +137,7 @@ type TransactionDateType = "createdAt" | "issuedAt" | "dueAt";
134
137
 
135
138
  declare function Transactions({ transactionComponent, showSearchBar, showTitle, title, columns, className, shadow, searchBarClassName, useModal, onTransactionClick, suppressTransactionDisplay, kindsToShow, style, filter, noTransactionsMessage, entityId, filterTransactions, sortTransactions, transactionDateType, }: {
136
139
  /** A custom component to render instead of the default invoice component */
137
- transactionComponent?: react.ReactNode;
140
+ transactionComponent?: react__default.ReactNode;
138
141
  /** Whether to show the search bar */
139
142
  showSearchBar?: boolean;
140
143
  /** Whether to show the title */
@@ -158,7 +161,7 @@ declare function Transactions({ transactionComponent, showSearchBar, showTitle,
158
161
  /** The kinds of transactions to show */
159
162
  kindsToShow?: TransactionKind[];
160
163
  /** A custom style to apply to the component */
161
- style?: react.CSSProperties;
164
+ style?: react__default.CSSProperties;
162
165
  /** A filter to apply to the transactions. Docs on filter: https://docs.bunny.com/developer/getting-started/using-filters-in-queries
163
166
  * Filtering is applied on the api side, potentially speeding up the transactions query
164
167
  */
@@ -178,7 +181,7 @@ declare function Transactions({ transactionComponent, showSearchBar, showTitle,
178
181
  transactionDateType?: TransactionDateType;
179
182
  }): react_jsx_runtime.JSX.Element;
180
183
 
181
- declare const Subscriptions: ({ className, companyName, entityId, hideExpired, onCancelSubscriptionClick, onChangePlanClick, onSubscriptionsLoaded, styles, }: {
184
+ declare const Subscriptions: ({ className, companyName, entityId, hideExpired, onCancelSubscriptionClick, onChangePlanClick, onSubscriptionsLoaded, styles, noSubscriptionsComponent, }: {
182
185
  className?: string | undefined;
183
186
  companyName: string;
184
187
  entityId: string;
@@ -189,7 +192,9 @@ declare const Subscriptions: ({ className, companyName, entityId, hideExpired, o
189
192
  styles?: {
190
193
  gap?: number | undefined;
191
194
  shadow?: "none" | "lg" | "md" | "sm" | undefined;
195
+ subscriptionProductNameStyle?: react.CSSProperties | undefined;
192
196
  } | undefined;
197
+ noSubscriptionsComponent?: React.ReactNode;
193
198
  }) => react_jsx_runtime.JSX.Element;
194
199
 
195
200
  declare const BillingDetails: ({ entityId, isCardEnabled, shadow, className, hidePaymentMethodForm, countryListFilter, }: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bunnyapp/components",
3
- "version": "1.0.23",
3
+ "version": "1.0.25",
4
4
  "description": "Components from the Bunny portal to embed Bunny UI functionality into your application.",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -79,7 +79,6 @@
79
79
  "lodash": "^4.17.21",
80
80
  "react": "^18.3.1",
81
81
  "react-dom": "^18.3.1",
82
- "react-helmet-async": "^2.0.5",
83
82
  "recharts": "^2.15.0",
84
83
  "recoil": "^0.7.7",
85
84
  "styled-components": "^6.1.13"
@@ -1,4 +0,0 @@
1
- export declare enum DOCUMENT_NAME {
2
- INVOICE = "invoice",
3
- QUOTE = "quote"
4
- }
@@ -1,4 +0,0 @@
1
- export declare enum DOCUMENT_NAME {
2
- INVOICE = "invoice",
3
- QUOTE = "quote"
4
- }