@bunnyapp/components 1.7.0-beta.41 → 1.7.0-beta.43

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
@@ -1283,7 +1283,7 @@ const DEFAULT_CONFIG = {
1283
1283
  };
1284
1284
 
1285
1285
  // This will be replaced at build time by rollup-plugin-replace
1286
- const PACKAGE_VERSION = '1.7.0-beta.40';
1286
+ const PACKAGE_VERSION = '1.7.0-beta.42';
1287
1287
  const createRequestHeaders = (token) => {
1288
1288
  const headers = createClientDevHeaders({ token });
1289
1289
  // Add the components version header
@@ -23314,6 +23314,35 @@ const TAG_COLORS = {
23314
23314
  PENDING: 'yellow',
23315
23315
  };
23316
23316
 
23317
+ const graphql = initGraphQLTada();
23318
+
23319
+ const periodMonthsConverter = (period) => {
23320
+ if (period === 0)
23321
+ return graphql.scalar('BillingPeriod', 'ONCE');
23322
+ else if (period === 1)
23323
+ return graphql.scalar('BillingPeriod', 'MONTHLY');
23324
+ else if (period === 3)
23325
+ return graphql.scalar('BillingPeriod', 'QUARTERLY');
23326
+ else if (period === 6)
23327
+ return graphql.scalar('BillingPeriod', 'SEMI_ANNUAL');
23328
+ else if (period === 12)
23329
+ return graphql.scalar('BillingPeriod', 'ANNUAL');
23330
+ else
23331
+ return null;
23332
+ };
23333
+ const billingPeriodConverter = (period) => {
23334
+ if (period === graphql.scalar('BillingPeriod', 'ONCE'))
23335
+ return 0;
23336
+ else if (period === graphql.scalar('BillingPeriod', 'MONTHLY'))
23337
+ return 1;
23338
+ else if (period === graphql.scalar('BillingPeriod', 'QUARTERLY'))
23339
+ return 3;
23340
+ else if (period === graphql.scalar('BillingPeriod', 'SEMI_ANNUAL'))
23341
+ return 6;
23342
+ else
23343
+ return 12;
23344
+ };
23345
+
23317
23346
  const { Text: Text$p } = antd.Typography;
23318
23347
  const PriceListDisplay_PriceListFragment = t(`
23319
23348
  fragment PriceListDisplay_PriceListFragment on PriceList {
@@ -23325,14 +23354,17 @@ const PriceListDisplay_PriceListFragment = t(`
23325
23354
  currencyId
23326
23355
  trialAllowed
23327
23356
  trialLengthDays
23357
+ periodMonths
23328
23358
  }
23329
23359
  `);
23330
23360
  function PriceListDisplay({ priceList: maskedPriceList }) {
23331
23361
  var _a, _b;
23332
23362
  const priceList = readFragment(PriceListDisplay_PriceListFragment, maskedPriceList);
23363
+ const convertedPeriodMonths = periodMonthsConverter(priceList === null || priceList === void 0 ? void 0 : priceList.periodMonths);
23364
+ const periodLabel = convertedPeriodMonths ? PERIOD_LABELS[convertedPeriodMonths] : 'undefined';
23333
23365
  if (!priceList)
23334
23366
  return null;
23335
- return (jsxRuntime.jsxs("div", { className: "bunny-flex bunny-flex-col bunny-gap-4", children: [jsxRuntime.jsxs("div", { className: "bunny-flex bunny-flex-col bunny-gap-0", children: [jsxRuntime.jsxs(Text$p, { className: "bunny-text-slate-500 bunny-font-bold bunny-text-lg", children: [(_a = priceList.product) === null || _a === void 0 ? void 0 : _a.name, " ", priceList.name] }), jsxRuntime.jsxs(Text$p, { className: "bunny-font-bold bunny-text-xl", children: [formatCurrency(priceList.basePrice, priceList.currencyId), " / month"] })] }), priceList.trialAllowed ? (jsxRuntime.jsx("div", { className: "bunny-flex", children: jsxRuntime.jsx(CustomizedTag, { color: TAG_COLORS["TRIAL"], children: `${(_b = priceList.trialLengthDays) !== null && _b !== void 0 ? _b : 'N/A'} day trial` }) })) : null] }));
23367
+ return (jsxRuntime.jsxs("div", { className: "bunny-flex bunny-flex-col bunny-gap-4", children: [jsxRuntime.jsxs("div", { className: "bunny-flex bunny-flex-col bunny-gap-0", children: [jsxRuntime.jsxs(Text$p, { className: "bunny-text-slate-500 bunny-font-bold bunny-text-lg", children: [(_a = priceList.product) === null || _a === void 0 ? void 0 : _a.name, " ", priceList.name] }), jsxRuntime.jsxs(Text$p, { className: "bunny-font-bold bunny-text-xl", children: [formatCurrency(priceList.basePrice, priceList.currencyId), " / ", periodLabel] })] }), priceList.trialAllowed ? (jsxRuntime.jsx("div", { className: "bunny-flex", children: jsxRuntime.jsx(CustomizedTag, { color: TAG_COLORS["TRIAL"], children: `${(_b = priceList.trialLengthDays) !== null && _b !== void 0 ? _b : 'N/A'} day trial` }) })) : null] }));
23336
23368
  }
23337
23369
 
23338
23370
  const Signup_PriceListFragment = t(`
@@ -23351,8 +23383,6 @@ const Signup_PriceListFragment = t(`
23351
23383
  SelfServiceBuyWarning_PriceListFragment,
23352
23384
  ]);
23353
23385
 
23354
- const graphql = initGraphQLTada();
23355
-
23356
23386
  const mutation$g = graphql(`
23357
23387
  mutation AccountSignup (
23358
23388
  $pluginId: String!,
@@ -24168,33 +24198,6 @@ const CheckoutButton = ({ disabled, onClickCheckout, loading, tooltipText, }) =>
24168
24198
  return (jsxRuntime.jsx(TooltipWrapper, { children: jsxRuntime.jsx(antd.Button, { className: isMobile ? 'w-full' : '', disabled: disabled, onClick: onClickCheckout, size: isMobile ? 'large' : 'middle', type: "primary", loading: loading, children: "Proceed to checkout" }) }));
24169
24199
  };
24170
24200
 
24171
- const periodMonthsConverter = (period) => {
24172
- if (period === 0)
24173
- return graphql.scalar('BillingPeriod', 'ONCE');
24174
- else if (period === 1)
24175
- return graphql.scalar('BillingPeriod', 'MONTHLY');
24176
- else if (period === 3)
24177
- return graphql.scalar('BillingPeriod', 'QUARTERLY');
24178
- else if (period === 6)
24179
- return graphql.scalar('BillingPeriod', 'SEMI_ANNUAL');
24180
- else if (period === 12)
24181
- return graphql.scalar('BillingPeriod', 'ANNUAL');
24182
- else
24183
- return null;
24184
- };
24185
- const billingPeriodConverter = (period) => {
24186
- if (period === graphql.scalar('BillingPeriod', 'ONCE'))
24187
- return 0;
24188
- else if (period === graphql.scalar('BillingPeriod', 'MONTHLY'))
24189
- return 1;
24190
- else if (period === graphql.scalar('BillingPeriod', 'QUARTERLY'))
24191
- return 3;
24192
- else if (period === graphql.scalar('BillingPeriod', 'SEMI_ANNUAL'))
24193
- return 6;
24194
- else
24195
- return 12;
24196
- };
24197
-
24198
24201
  const CheckoutPrice_QuoteFragment = t(`
24199
24202
  fragment CheckoutPrice_QuoteFragment on Quote {
24200
24203
  periodAmount
@@ -28713,7 +28716,7 @@ const useQuoteRecalculateTaxes$1 = () => {
28713
28716
  };
28714
28717
  };
28715
28718
 
28716
- const QuantityDrawerContent = ({ subscriptions, quantityDrawerOpen, setQuantityDrawerOpen, handlePortalErrors, setShowInactive, }) => {
28719
+ const QuantityDrawerContent = ({ subscriptions, quantityDrawerOpen, setQuantityDrawerOpen, handlePortalErrors, }) => {
28717
28720
  const token = useToken();
28718
28721
  const queryClient = reactQuery.useQueryClient();
28719
28722
  const showSuccessNotification = useSuccessNotification();
@@ -28734,7 +28737,6 @@ const QuantityDrawerContent = ({ subscriptions, quantityDrawerOpen, setQuantityD
28734
28737
  invalidateSubscriptionsQueryKeys(queryClient, token);
28735
28738
  showSuccessNotification('Your plan has been updated', 'Payment successful');
28736
28739
  setPayModalVisible(false);
28737
- setShowInactive(true);
28738
28740
  setUpdatingChargeQuantityId(undefined);
28739
28741
  };
28740
28742
  const onCancel = () => {
@@ -28755,12 +28757,12 @@ const QuantityDrawerContent = ({ subscriptions, quantityDrawerOpen, setQuantityD
28755
28757
  };
28756
28758
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(QuantityChangeDrawerDesktop, { onClose: handleDrawerClose, open: quantityDrawerOpen, openCheckout: handleOpenCheckout, subscriptions: subscriptions, setUpdatingChargeQuantityId: setUpdatingChargeQuantityId, updatingChargeQuantityId: updatingChargeQuantityId }), jsxRuntime.jsx(Checkout, { onCancel: onCancel, onSuccess: onSuccess, onFail: onFail, onRecalculateTaxes: quoteRecalculateTaxesMutation, open: payModalVisible, quote: quote, token: token, isUpdatingQuote: false, isRecalculatingTaxes: isRecalculatingTaxes })] }));
28757
28759
  };
28758
- const QuantityDrawer = ({ subscriptions, quantityDrawerOpen, setQuantityDrawerOpen, handlePortalErrors, setShowInactive, }) => {
28760
+ const QuantityDrawer = ({ subscriptions, quantityDrawerOpen, setQuantityDrawerOpen, handlePortalErrors, }) => {
28759
28761
  const { quoteRecalculateTaxesMutation, isRecalculatingTaxes } = useQuoteRecalculateTaxes$1();
28760
28762
  return (jsxRuntime.jsx(QuoteIdProvider, { children: jsxRuntime.jsx(QuoteIsLoadingProvider, { children: jsxRuntime.jsx(QuoteRecalculateTaxesProvider, { value: {
28761
28763
  quoteRecalculateTaxesMutation: (quoteId) => quoteRecalculateTaxesMutation({ quoteId }),
28762
28764
  isRecalculatingTaxes,
28763
- }, children: jsxRuntime.jsx(QuantityDrawerContent, { subscriptions: subscriptions, quantityDrawerOpen: quantityDrawerOpen, setQuantityDrawerOpen: setQuantityDrawerOpen, handlePortalErrors: handlePortalErrors, setShowInactive: setShowInactive }) }) }) }));
28765
+ }, children: jsxRuntime.jsx(QuantityDrawerContent, { subscriptions: subscriptions, quantityDrawerOpen: quantityDrawerOpen, setQuantityDrawerOpen: setQuantityDrawerOpen, handlePortalErrors: handlePortalErrors }) }) }) }));
28764
28766
  };
28765
28767
 
28766
28768
  // TODO: this query will be trimmed and cleaned up once we fully migrate to gql.tada codegen
@@ -29792,7 +29794,7 @@ const Subscriptions = ({ subscriptions: maskedSubscriptions, subscriptionsAreLoa
29792
29794
  }
29793
29795
  if (!subscriptions)
29794
29796
  return null;
29795
- return (jsxRuntime.jsx(UpgradingSubscriptionProvider, { value: upgradingSubscription, children: jsxRuntime.jsx(SubscriptionCancelProvider, { value: onCancelSubscriptionClick, children: jsxRuntime.jsx(ChangeUpgradingSubscriptionProvider, { value: onChangePlanClick, children: jsxRuntime.jsxs("div", { className: className, children: [jsxRuntime.jsx(PageHeaderWithActions, { title: jsxRuntime.jsx(jsxRuntime.Fragment, { children: isMobile && inactiveSwitchVisible && (jsxRuntime.jsx(ShowInactiveToggle, { showInactive: showInactiveSubscriptions, setShowInactive: setShowInactiveSubscriptionsState })) }), children: !isMobile && (jsxRuntime.jsx(SubscriptionsNavigation, { inactiveSwitchVisible: inactiveSwitchVisible, showInactive: showInactiveSubscriptions, setShowInactive: setShowInactiveSubscriptionsState, setQuantityDrawerOpen: setQuantityDrawerOpen, subscriptions: subscriptions })) }), jsxRuntime.jsx(SubscriptionsListContainer, { companyName: companyName, showInactive: showInactiveSubscriptions, subscriptions: subscriptions, subscriptionsAreLoading: subscriptionsAreLoading, noSubscriptionsComponent: noSubscriptionsComponent }), isMobile && (jsxRuntime.jsx("div", { className: "bunny-pt-4 bunny-pb-2", children: jsxRuntime.jsx(SubscriptionsNavigation, { inactiveSwitchVisible: inactiveSwitchVisible, showInactive: showInactiveSubscriptions, setShowInactive: setShowInactiveSubscriptionsState, setQuantityDrawerOpen: setQuantityDrawerOpen, subscriptions: subscriptions }) })), jsxRuntime.jsx(QuantityDrawer, { subscriptions: subscriptions, quantityDrawerOpen: quantityDrawerOpen, setQuantityDrawerOpen: setQuantityDrawerOpen, handlePortalErrors: handlePortalErrors, setShowInactive: setShowInactiveSubscriptionsState })] }) }) }) }));
29797
+ return (jsxRuntime.jsx(UpgradingSubscriptionProvider, { value: upgradingSubscription, children: jsxRuntime.jsx(SubscriptionCancelProvider, { value: onCancelSubscriptionClick, children: jsxRuntime.jsx(ChangeUpgradingSubscriptionProvider, { value: onChangePlanClick, children: jsxRuntime.jsxs("div", { className: className, children: [jsxRuntime.jsx(PageHeaderWithActions, { title: jsxRuntime.jsx(jsxRuntime.Fragment, { children: isMobile && inactiveSwitchVisible && (jsxRuntime.jsx(ShowInactiveToggle, { showInactive: showInactiveSubscriptions, setShowInactive: setShowInactiveSubscriptionsState })) }), children: !isMobile && (jsxRuntime.jsx(SubscriptionsNavigation, { inactiveSwitchVisible: inactiveSwitchVisible, showInactive: showInactiveSubscriptions, setShowInactive: setShowInactiveSubscriptionsState, setQuantityDrawerOpen: setQuantityDrawerOpen, subscriptions: subscriptions })) }), jsxRuntime.jsx(SubscriptionsListContainer, { companyName: companyName, showInactive: showInactiveSubscriptions, subscriptions: subscriptions, subscriptionsAreLoading: subscriptionsAreLoading, noSubscriptionsComponent: noSubscriptionsComponent }), isMobile && (jsxRuntime.jsx("div", { className: "bunny-pt-4 bunny-pb-2", children: jsxRuntime.jsx(SubscriptionsNavigation, { inactiveSwitchVisible: inactiveSwitchVisible, showInactive: showInactiveSubscriptions, setShowInactive: setShowInactiveSubscriptionsState, setQuantityDrawerOpen: setQuantityDrawerOpen, subscriptions: subscriptions }) })), jsxRuntime.jsx(QuantityDrawer, { subscriptions: subscriptions, quantityDrawerOpen: quantityDrawerOpen, setQuantityDrawerOpen: setQuantityDrawerOpen, handlePortalErrors: handlePortalErrors })] }) }) }) }));
29796
29798
  };
29797
29799
  const PageHeaderWithActions = ({ children, title, }) => {
29798
29800
  const isMobile = useIsMobile();
@@ -8,6 +8,7 @@ export declare const PriceListDisplay_PriceListFragment: import("gql.tada").Tada
8
8
  currencyId: string;
9
9
  trialAllowed: boolean;
10
10
  trialLengthDays: number | null;
11
+ periodMonths: number | null;
11
12
  }, {}, {
12
13
  fragment: "PriceListDisplay_PriceListFragment";
13
14
  on: "PriceList";
@@ -5,8 +5,7 @@ interface QuantityDrawerProps {
5
5
  quantityDrawerOpen: boolean;
6
6
  setQuantityDrawerOpen: (open: boolean) => void;
7
7
  handlePortalErrors?: (errors: any) => void;
8
- setShowInactive: (showInactive: boolean) => void;
9
8
  }
10
- export declare const QuantityDrawerContent: ({ subscriptions, quantityDrawerOpen, setQuantityDrawerOpen, handlePortalErrors, setShowInactive, }: QuantityDrawerProps) => import("react/jsx-runtime").JSX.Element;
11
- export declare const QuantityDrawer: ({ subscriptions, quantityDrawerOpen, setQuantityDrawerOpen, handlePortalErrors, setShowInactive, }: QuantityDrawerProps) => import("react/jsx-runtime").JSX.Element;
9
+ export declare const QuantityDrawerContent: ({ subscriptions, quantityDrawerOpen, setQuantityDrawerOpen, handlePortalErrors, }: QuantityDrawerProps) => import("react/jsx-runtime").JSX.Element;
10
+ export declare const QuantityDrawer: ({ subscriptions, quantityDrawerOpen, setQuantityDrawerOpen, handlePortalErrors, }: QuantityDrawerProps) => import("react/jsx-runtime").JSX.Element;
12
11
  export {};
@@ -1,6 +1,6 @@
1
1
  import { BillingPeriod } from '@/graphql-codegen/exportedScalarTypes';
2
2
  import { Plan } from '@/types/Plan';
3
3
  import Product from '@/types/Product';
4
- export declare const periodMonthsConverter: (period: number | null) => "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL" | "ONCE" | null;
4
+ export declare const periodMonthsConverter: (period: number | undefined | null) => "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL" | "ONCE" | null;
5
5
  export declare const billingPeriodConverter: (period?: BillingPeriod) => 3 | 0 | 1 | 6 | 12;
6
6
  export declare const createAvailableBillingPeriods: (plans?: Plan[], selectedProduct?: Product) => (0 | 1 | 3 | 6 | 12)[] | undefined;
package/dist/esm/index.js CHANGED
@@ -1281,7 +1281,7 @@ const DEFAULT_CONFIG = {
1281
1281
  };
1282
1282
 
1283
1283
  // This will be replaced at build time by rollup-plugin-replace
1284
- const PACKAGE_VERSION = '1.7.0-beta.40';
1284
+ const PACKAGE_VERSION = '1.7.0-beta.42';
1285
1285
  const createRequestHeaders = (token) => {
1286
1286
  const headers = createClientDevHeaders({ token });
1287
1287
  // Add the components version header
@@ -23312,6 +23312,35 @@ const TAG_COLORS = {
23312
23312
  PENDING: 'yellow',
23313
23313
  };
23314
23314
 
23315
+ const graphql = initGraphQLTada();
23316
+
23317
+ const periodMonthsConverter = (period) => {
23318
+ if (period === 0)
23319
+ return graphql.scalar('BillingPeriod', 'ONCE');
23320
+ else if (period === 1)
23321
+ return graphql.scalar('BillingPeriod', 'MONTHLY');
23322
+ else if (period === 3)
23323
+ return graphql.scalar('BillingPeriod', 'QUARTERLY');
23324
+ else if (period === 6)
23325
+ return graphql.scalar('BillingPeriod', 'SEMI_ANNUAL');
23326
+ else if (period === 12)
23327
+ return graphql.scalar('BillingPeriod', 'ANNUAL');
23328
+ else
23329
+ return null;
23330
+ };
23331
+ const billingPeriodConverter = (period) => {
23332
+ if (period === graphql.scalar('BillingPeriod', 'ONCE'))
23333
+ return 0;
23334
+ else if (period === graphql.scalar('BillingPeriod', 'MONTHLY'))
23335
+ return 1;
23336
+ else if (period === graphql.scalar('BillingPeriod', 'QUARTERLY'))
23337
+ return 3;
23338
+ else if (period === graphql.scalar('BillingPeriod', 'SEMI_ANNUAL'))
23339
+ return 6;
23340
+ else
23341
+ return 12;
23342
+ };
23343
+
23315
23344
  const { Text: Text$p } = Typography;
23316
23345
  const PriceListDisplay_PriceListFragment = t(`
23317
23346
  fragment PriceListDisplay_PriceListFragment on PriceList {
@@ -23323,14 +23352,17 @@ const PriceListDisplay_PriceListFragment = t(`
23323
23352
  currencyId
23324
23353
  trialAllowed
23325
23354
  trialLengthDays
23355
+ periodMonths
23326
23356
  }
23327
23357
  `);
23328
23358
  function PriceListDisplay({ priceList: maskedPriceList }) {
23329
23359
  var _a, _b;
23330
23360
  const priceList = readFragment(PriceListDisplay_PriceListFragment, maskedPriceList);
23361
+ const convertedPeriodMonths = periodMonthsConverter(priceList === null || priceList === void 0 ? void 0 : priceList.periodMonths);
23362
+ const periodLabel = convertedPeriodMonths ? PERIOD_LABELS[convertedPeriodMonths] : 'undefined';
23331
23363
  if (!priceList)
23332
23364
  return null;
23333
- return (jsxs("div", { className: "bunny-flex bunny-flex-col bunny-gap-4", children: [jsxs("div", { className: "bunny-flex bunny-flex-col bunny-gap-0", children: [jsxs(Text$p, { className: "bunny-text-slate-500 bunny-font-bold bunny-text-lg", children: [(_a = priceList.product) === null || _a === void 0 ? void 0 : _a.name, " ", priceList.name] }), jsxs(Text$p, { className: "bunny-font-bold bunny-text-xl", children: [formatCurrency(priceList.basePrice, priceList.currencyId), " / month"] })] }), priceList.trialAllowed ? (jsx("div", { className: "bunny-flex", children: jsx(CustomizedTag, { color: TAG_COLORS["TRIAL"], children: `${(_b = priceList.trialLengthDays) !== null && _b !== void 0 ? _b : 'N/A'} day trial` }) })) : null] }));
23365
+ return (jsxs("div", { className: "bunny-flex bunny-flex-col bunny-gap-4", children: [jsxs("div", { className: "bunny-flex bunny-flex-col bunny-gap-0", children: [jsxs(Text$p, { className: "bunny-text-slate-500 bunny-font-bold bunny-text-lg", children: [(_a = priceList.product) === null || _a === void 0 ? void 0 : _a.name, " ", priceList.name] }), jsxs(Text$p, { className: "bunny-font-bold bunny-text-xl", children: [formatCurrency(priceList.basePrice, priceList.currencyId), " / ", periodLabel] })] }), priceList.trialAllowed ? (jsx("div", { className: "bunny-flex", children: jsx(CustomizedTag, { color: TAG_COLORS["TRIAL"], children: `${(_b = priceList.trialLengthDays) !== null && _b !== void 0 ? _b : 'N/A'} day trial` }) })) : null] }));
23334
23366
  }
23335
23367
 
23336
23368
  const Signup_PriceListFragment = t(`
@@ -23349,8 +23381,6 @@ const Signup_PriceListFragment = t(`
23349
23381
  SelfServiceBuyWarning_PriceListFragment,
23350
23382
  ]);
23351
23383
 
23352
- const graphql = initGraphQLTada();
23353
-
23354
23384
  const mutation$g = graphql(`
23355
23385
  mutation AccountSignup (
23356
23386
  $pluginId: String!,
@@ -24166,33 +24196,6 @@ const CheckoutButton = ({ disabled, onClickCheckout, loading, tooltipText, }) =>
24166
24196
  return (jsx(TooltipWrapper, { children: jsx(Button, { className: isMobile ? 'w-full' : '', disabled: disabled, onClick: onClickCheckout, size: isMobile ? 'large' : 'middle', type: "primary", loading: loading, children: "Proceed to checkout" }) }));
24167
24197
  };
24168
24198
 
24169
- const periodMonthsConverter = (period) => {
24170
- if (period === 0)
24171
- return graphql.scalar('BillingPeriod', 'ONCE');
24172
- else if (period === 1)
24173
- return graphql.scalar('BillingPeriod', 'MONTHLY');
24174
- else if (period === 3)
24175
- return graphql.scalar('BillingPeriod', 'QUARTERLY');
24176
- else if (period === 6)
24177
- return graphql.scalar('BillingPeriod', 'SEMI_ANNUAL');
24178
- else if (period === 12)
24179
- return graphql.scalar('BillingPeriod', 'ANNUAL');
24180
- else
24181
- return null;
24182
- };
24183
- const billingPeriodConverter = (period) => {
24184
- if (period === graphql.scalar('BillingPeriod', 'ONCE'))
24185
- return 0;
24186
- else if (period === graphql.scalar('BillingPeriod', 'MONTHLY'))
24187
- return 1;
24188
- else if (period === graphql.scalar('BillingPeriod', 'QUARTERLY'))
24189
- return 3;
24190
- else if (period === graphql.scalar('BillingPeriod', 'SEMI_ANNUAL'))
24191
- return 6;
24192
- else
24193
- return 12;
24194
- };
24195
-
24196
24199
  const CheckoutPrice_QuoteFragment = t(`
24197
24200
  fragment CheckoutPrice_QuoteFragment on Quote {
24198
24201
  periodAmount
@@ -28711,7 +28714,7 @@ const useQuoteRecalculateTaxes$1 = () => {
28711
28714
  };
28712
28715
  };
28713
28716
 
28714
- const QuantityDrawerContent = ({ subscriptions, quantityDrawerOpen, setQuantityDrawerOpen, handlePortalErrors, setShowInactive, }) => {
28717
+ const QuantityDrawerContent = ({ subscriptions, quantityDrawerOpen, setQuantityDrawerOpen, handlePortalErrors, }) => {
28715
28718
  const token = useToken();
28716
28719
  const queryClient = useQueryClient();
28717
28720
  const showSuccessNotification = useSuccessNotification();
@@ -28732,7 +28735,6 @@ const QuantityDrawerContent = ({ subscriptions, quantityDrawerOpen, setQuantityD
28732
28735
  invalidateSubscriptionsQueryKeys(queryClient, token);
28733
28736
  showSuccessNotification('Your plan has been updated', 'Payment successful');
28734
28737
  setPayModalVisible(false);
28735
- setShowInactive(true);
28736
28738
  setUpdatingChargeQuantityId(undefined);
28737
28739
  };
28738
28740
  const onCancel = () => {
@@ -28753,12 +28755,12 @@ const QuantityDrawerContent = ({ subscriptions, quantityDrawerOpen, setQuantityD
28753
28755
  };
28754
28756
  return (jsxs(Fragment, { children: [jsx(QuantityChangeDrawerDesktop, { onClose: handleDrawerClose, open: quantityDrawerOpen, openCheckout: handleOpenCheckout, subscriptions: subscriptions, setUpdatingChargeQuantityId: setUpdatingChargeQuantityId, updatingChargeQuantityId: updatingChargeQuantityId }), jsx(Checkout, { onCancel: onCancel, onSuccess: onSuccess, onFail: onFail, onRecalculateTaxes: quoteRecalculateTaxesMutation, open: payModalVisible, quote: quote, token: token, isUpdatingQuote: false, isRecalculatingTaxes: isRecalculatingTaxes })] }));
28755
28757
  };
28756
- const QuantityDrawer = ({ subscriptions, quantityDrawerOpen, setQuantityDrawerOpen, handlePortalErrors, setShowInactive, }) => {
28758
+ const QuantityDrawer = ({ subscriptions, quantityDrawerOpen, setQuantityDrawerOpen, handlePortalErrors, }) => {
28757
28759
  const { quoteRecalculateTaxesMutation, isRecalculatingTaxes } = useQuoteRecalculateTaxes$1();
28758
28760
  return (jsx(QuoteIdProvider, { children: jsx(QuoteIsLoadingProvider, { children: jsx(QuoteRecalculateTaxesProvider, { value: {
28759
28761
  quoteRecalculateTaxesMutation: (quoteId) => quoteRecalculateTaxesMutation({ quoteId }),
28760
28762
  isRecalculatingTaxes,
28761
- }, children: jsx(QuantityDrawerContent, { subscriptions: subscriptions, quantityDrawerOpen: quantityDrawerOpen, setQuantityDrawerOpen: setQuantityDrawerOpen, handlePortalErrors: handlePortalErrors, setShowInactive: setShowInactive }) }) }) }));
28763
+ }, children: jsx(QuantityDrawerContent, { subscriptions: subscriptions, quantityDrawerOpen: quantityDrawerOpen, setQuantityDrawerOpen: setQuantityDrawerOpen, handlePortalErrors: handlePortalErrors }) }) }) }));
28762
28764
  };
28763
28765
 
28764
28766
  // TODO: this query will be trimmed and cleaned up once we fully migrate to gql.tada codegen
@@ -29790,7 +29792,7 @@ const Subscriptions = ({ subscriptions: maskedSubscriptions, subscriptionsAreLoa
29790
29792
  }
29791
29793
  if (!subscriptions)
29792
29794
  return null;
29793
- return (jsx(UpgradingSubscriptionProvider, { value: upgradingSubscription, children: jsx(SubscriptionCancelProvider, { value: onCancelSubscriptionClick, children: jsx(ChangeUpgradingSubscriptionProvider, { value: onChangePlanClick, children: jsxs("div", { className: className, children: [jsx(PageHeaderWithActions, { title: jsx(Fragment, { children: isMobile && inactiveSwitchVisible && (jsx(ShowInactiveToggle, { showInactive: showInactiveSubscriptions, setShowInactive: setShowInactiveSubscriptionsState })) }), children: !isMobile && (jsx(SubscriptionsNavigation, { inactiveSwitchVisible: inactiveSwitchVisible, showInactive: showInactiveSubscriptions, setShowInactive: setShowInactiveSubscriptionsState, setQuantityDrawerOpen: setQuantityDrawerOpen, subscriptions: subscriptions })) }), jsx(SubscriptionsListContainer, { companyName: companyName, showInactive: showInactiveSubscriptions, subscriptions: subscriptions, subscriptionsAreLoading: subscriptionsAreLoading, noSubscriptionsComponent: noSubscriptionsComponent }), isMobile && (jsx("div", { className: "bunny-pt-4 bunny-pb-2", children: jsx(SubscriptionsNavigation, { inactiveSwitchVisible: inactiveSwitchVisible, showInactive: showInactiveSubscriptions, setShowInactive: setShowInactiveSubscriptionsState, setQuantityDrawerOpen: setQuantityDrawerOpen, subscriptions: subscriptions }) })), jsx(QuantityDrawer, { subscriptions: subscriptions, quantityDrawerOpen: quantityDrawerOpen, setQuantityDrawerOpen: setQuantityDrawerOpen, handlePortalErrors: handlePortalErrors, setShowInactive: setShowInactiveSubscriptionsState })] }) }) }) }));
29795
+ return (jsx(UpgradingSubscriptionProvider, { value: upgradingSubscription, children: jsx(SubscriptionCancelProvider, { value: onCancelSubscriptionClick, children: jsx(ChangeUpgradingSubscriptionProvider, { value: onChangePlanClick, children: jsxs("div", { className: className, children: [jsx(PageHeaderWithActions, { title: jsx(Fragment, { children: isMobile && inactiveSwitchVisible && (jsx(ShowInactiveToggle, { showInactive: showInactiveSubscriptions, setShowInactive: setShowInactiveSubscriptionsState })) }), children: !isMobile && (jsx(SubscriptionsNavigation, { inactiveSwitchVisible: inactiveSwitchVisible, showInactive: showInactiveSubscriptions, setShowInactive: setShowInactiveSubscriptionsState, setQuantityDrawerOpen: setQuantityDrawerOpen, subscriptions: subscriptions })) }), jsx(SubscriptionsListContainer, { companyName: companyName, showInactive: showInactiveSubscriptions, subscriptions: subscriptions, subscriptionsAreLoading: subscriptionsAreLoading, noSubscriptionsComponent: noSubscriptionsComponent }), isMobile && (jsx("div", { className: "bunny-pt-4 bunny-pb-2", children: jsx(SubscriptionsNavigation, { inactiveSwitchVisible: inactiveSwitchVisible, showInactive: showInactiveSubscriptions, setShowInactive: setShowInactiveSubscriptionsState, setQuantityDrawerOpen: setQuantityDrawerOpen, subscriptions: subscriptions }) })), jsx(QuantityDrawer, { subscriptions: subscriptions, quantityDrawerOpen: quantityDrawerOpen, setQuantityDrawerOpen: setQuantityDrawerOpen, handlePortalErrors: handlePortalErrors })] }) }) }) }));
29794
29796
  };
29795
29797
  const PageHeaderWithActions = ({ children, title, }) => {
29796
29798
  const isMobile = useIsMobile();
@@ -8,6 +8,7 @@ export declare const PriceListDisplay_PriceListFragment: import("gql.tada").Tada
8
8
  currencyId: string;
9
9
  trialAllowed: boolean;
10
10
  trialLengthDays: number | null;
11
+ periodMonths: number | null;
11
12
  }, {}, {
12
13
  fragment: "PriceListDisplay_PriceListFragment";
13
14
  on: "PriceList";
@@ -5,8 +5,7 @@ interface QuantityDrawerProps {
5
5
  quantityDrawerOpen: boolean;
6
6
  setQuantityDrawerOpen: (open: boolean) => void;
7
7
  handlePortalErrors?: (errors: any) => void;
8
- setShowInactive: (showInactive: boolean) => void;
9
8
  }
10
- export declare const QuantityDrawerContent: ({ subscriptions, quantityDrawerOpen, setQuantityDrawerOpen, handlePortalErrors, setShowInactive, }: QuantityDrawerProps) => import("react/jsx-runtime").JSX.Element;
11
- export declare const QuantityDrawer: ({ subscriptions, quantityDrawerOpen, setQuantityDrawerOpen, handlePortalErrors, setShowInactive, }: QuantityDrawerProps) => import("react/jsx-runtime").JSX.Element;
9
+ export declare const QuantityDrawerContent: ({ subscriptions, quantityDrawerOpen, setQuantityDrawerOpen, handlePortalErrors, }: QuantityDrawerProps) => import("react/jsx-runtime").JSX.Element;
10
+ export declare const QuantityDrawer: ({ subscriptions, quantityDrawerOpen, setQuantityDrawerOpen, handlePortalErrors, }: QuantityDrawerProps) => import("react/jsx-runtime").JSX.Element;
12
11
  export {};
@@ -1,6 +1,6 @@
1
1
  import { BillingPeriod } from '@/graphql-codegen/exportedScalarTypes';
2
2
  import { Plan } from '@/types/Plan';
3
3
  import Product from '@/types/Product';
4
- export declare const periodMonthsConverter: (period: number | null) => "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL" | "ONCE" | null;
4
+ export declare const periodMonthsConverter: (period: number | undefined | null) => "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL" | "ONCE" | null;
5
5
  export declare const billingPeriodConverter: (period?: BillingPeriod) => 3 | 0 | 1 | 6 | 12;
6
6
  export declare const createAvailableBillingPeriods: (plans?: Plan[], selectedProduct?: Product) => (0 | 1 | 3 | 6 | 12)[] | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bunnyapp/components",
3
- "version": "1.7.0-beta.41",
3
+ "version": "1.7.0-beta.43",
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",