@bunnyapp/components 1.0.21 → 1.0.22

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
@@ -11,7 +11,7 @@ var common = require('@bunnyapp/common');
11
11
  var reactQuery = require('@tanstack/react-query');
12
12
  var theme = require('antd/lib/theme');
13
13
  var recoil = require('recoil');
14
- var request = import('graphql-request');
14
+ var request = require('graphql-request');
15
15
  var reactHelmetAsync = require('react-helmet-async');
16
16
  var reactStripeJs = require('@stripe/react-stripe-js');
17
17
  var pure = require('@stripe/stripe-js/pure');
@@ -4214,7 +4214,7 @@ function Signup(_a) {
4214
4214
  : "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
4215
  }
4216
4216
 
4217
- 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 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 }";
4217
+ 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
4218
  var getSubscriptions = function (_a) {
4219
4219
  var apiHost = _a.apiHost, entityId = _a.entityId, isInPreviewMode = _a.isInPreviewMode, token = _a.token;
4220
4220
  return __awaiter(void 0, void 0, void 0, function () {
@@ -4240,7 +4240,8 @@ var getSubscriptions = function (_a) {
4240
4240
  var useSubscriptions = function (_a) {
4241
4241
  var data = _a.data;
4242
4242
  return React.useMemo(function () {
4243
- var combinedSubscriptions = data === null || data === void 0 ? void 0 : data.map(function (subscription) {
4243
+ var clonedData = lodash.cloneDeep(data);
4244
+ var combinedSubscriptions = clonedData === null || clonedData === void 0 ? void 0 : clonedData.map(function (subscription) {
4244
4245
  var _a;
4245
4246
  var orderedSubscriptionCharges = subscription.charges.sort(function (a, b) {
4246
4247
  if (a.priceListChargeId !== b.priceListChargeId) {
@@ -4662,6 +4663,7 @@ var SubscriptionCardDesktop = function (_a) {
4662
4663
  })] }))] })));
4663
4664
  };
4664
4665
  var SubscriptionCardDesktopRow = function (_a) {
4666
+ var _b, _c;
4665
4667
  var charge = _a.charge, chargeIndex = _a.chargeIndex, subscription = _a.subscription;
4666
4668
  // Context
4667
4669
  var apiHost = React.useContext(BunnyContext).apiHost;
@@ -4699,7 +4701,9 @@ var SubscriptionCardDesktopRow = function (_a) {
4699
4701
  ? ""
4700
4702
  : charge.chargeType === common.ChargeType.USAGE
4701
4703
  ? data && jsxRuntime.jsx(FeatureUsageGraph, { charge: charge, featureUsage: data })
4702
- : charge.quantity })), jsxRuntime.jsx(SubscriptionsListCell, __assign({ right: true }, { children: jsxRuntime.jsx(SubscriptionChargeUnitPrice, { charge: charge, subscription: subscription }) })), jsxRuntime.jsx(SubscriptionsListCell, __assign({ right: true }, { children: jsxRuntime.jsx(SubscriptionChargeTotal, { charge: charge, subscription: subscription }) }))] })));
4704
+ : charge.isAmendment
4705
+ ? "+".concat((_b = charge.quantity) === null || _b === void 0 ? void 0 : _b.toLocaleString())
4706
+ : (_c = charge.quantity) === null || _c === void 0 ? void 0 : _c.toLocaleString() })), jsxRuntime.jsx(SubscriptionsListCell, __assign({ right: true }, { children: jsxRuntime.jsx(SubscriptionChargeUnitPrice, { charge: charge, subscription: subscription }) })), jsxRuntime.jsx(SubscriptionsListCell, __assign({ right: true }, { children: jsxRuntime.jsx(SubscriptionChargeTotal, { charge: charge, subscription: subscription }) }))] })));
4703
4707
  };
4704
4708
 
4705
4709
  var Text = antd.Typography.Text;
@@ -14,7 +14,7 @@ declare const Subscriptions: ({ className, companyName, entityId, hideExpired, o
14
14
  onSubscriptionsLoaded?: ((subscriptions: Subscription[]) => void) | undefined;
15
15
  styles?: {
16
16
  gap?: number | undefined;
17
- shadow?: "none" | "lg" | "md" | "sm" | undefined;
17
+ shadow?: "none" | "sm" | "md" | "lg" | undefined;
18
18
  } | undefined;
19
19
  }) => import("react/jsx-runtime").JSX.Element;
20
20
  export default Subscriptions;
package/dist/esm/index.js CHANGED
@@ -12,7 +12,7 @@ import request, { GraphQLClient } from 'graphql-request';
12
12
  import { HelmetProvider, Helmet } from 'react-helmet-async';
13
13
  import { useElements, useStripe, PaymentElement, Elements } from '@stripe/react-stripe-js';
14
14
  import { loadStripe } from '@stripe/stripe-js/pure';
15
- import { capitalize, startCase, omit } from 'lodash';
15
+ import { capitalize, startCase, cloneDeep, omit } from 'lodash';
16
16
  import { BarChart, ResponsiveContainer, XAxis, Tooltip, Bar, Rectangle } from 'recharts';
17
17
 
18
18
  function styleInject(css, ref) {
@@ -4185,7 +4185,7 @@ function Signup(_a) {
4185
4185
  : "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
4186
  }
4187
4187
 
4188
- 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 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 }";
4188
+ 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
4189
  var getSubscriptions = function (_a) {
4190
4190
  var apiHost = _a.apiHost, entityId = _a.entityId, isInPreviewMode = _a.isInPreviewMode, token = _a.token;
4191
4191
  return __awaiter(void 0, void 0, void 0, function () {
@@ -4211,7 +4211,8 @@ var getSubscriptions = function (_a) {
4211
4211
  var useSubscriptions = function (_a) {
4212
4212
  var data = _a.data;
4213
4213
  return useMemo(function () {
4214
- var combinedSubscriptions = data === null || data === void 0 ? void 0 : data.map(function (subscription) {
4214
+ var clonedData = cloneDeep(data);
4215
+ var combinedSubscriptions = clonedData === null || clonedData === void 0 ? void 0 : clonedData.map(function (subscription) {
4215
4216
  var _a;
4216
4217
  var orderedSubscriptionCharges = subscription.charges.sort(function (a, b) {
4217
4218
  if (a.priceListChargeId !== b.priceListChargeId) {
@@ -4633,6 +4634,7 @@ var SubscriptionCardDesktop = function (_a) {
4633
4634
  })] }))] })));
4634
4635
  };
4635
4636
  var SubscriptionCardDesktopRow = function (_a) {
4637
+ var _b, _c;
4636
4638
  var charge = _a.charge, chargeIndex = _a.chargeIndex, subscription = _a.subscription;
4637
4639
  // Context
4638
4640
  var apiHost = useContext(BunnyContext).apiHost;
@@ -4670,7 +4672,9 @@ var SubscriptionCardDesktopRow = function (_a) {
4670
4672
  ? ""
4671
4673
  : charge.chargeType === ChargeType.USAGE
4672
4674
  ? data && jsx(FeatureUsageGraph, { charge: charge, featureUsage: data })
4673
- : charge.quantity })), jsx(SubscriptionsListCell, __assign({ right: true }, { children: jsx(SubscriptionChargeUnitPrice, { charge: charge, subscription: subscription }) })), jsx(SubscriptionsListCell, __assign({ right: true }, { children: jsx(SubscriptionChargeTotal, { charge: charge, subscription: subscription }) }))] })));
4675
+ : charge.isAmendment
4676
+ ? "+".concat((_b = charge.quantity) === null || _b === void 0 ? void 0 : _b.toLocaleString())
4677
+ : (_c = charge.quantity) === null || _c === void 0 ? void 0 : _c.toLocaleString() })), jsx(SubscriptionsListCell, __assign({ right: true }, { children: jsx(SubscriptionChargeUnitPrice, { charge: charge, subscription: subscription }) })), jsx(SubscriptionsListCell, __assign({ right: true }, { children: jsx(SubscriptionChargeTotal, { charge: charge, subscription: subscription }) }))] })));
4674
4678
  };
4675
4679
 
4676
4680
  var Text = Typography.Text;
@@ -14,7 +14,7 @@ declare const Subscriptions: ({ className, companyName, entityId, hideExpired, o
14
14
  onSubscriptionsLoaded?: ((subscriptions: Subscription[]) => void) | undefined;
15
15
  styles?: {
16
16
  gap?: number | undefined;
17
- shadow?: "none" | "lg" | "md" | "sm" | undefined;
17
+ shadow?: "none" | "sm" | "md" | "lg" | undefined;
18
18
  } | undefined;
19
19
  }) => import("react/jsx-runtime").JSX.Element;
20
20
  export default Subscriptions;
package/dist/index.d.ts CHANGED
@@ -188,7 +188,7 @@ declare const Subscriptions: ({ className, companyName, entityId, hideExpired, o
188
188
  onSubscriptionsLoaded?: ((subscriptions: Subscription[]) => void) | undefined;
189
189
  styles?: {
190
190
  gap?: number | undefined;
191
- shadow?: "none" | "lg" | "md" | "sm" | undefined;
191
+ shadow?: "none" | "sm" | "md" | "lg" | undefined;
192
192
  } | undefined;
193
193
  }) => react_jsx_runtime.JSX.Element;
194
194
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bunnyapp/components",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
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",