@bunnyapp/components 1.5.0 → 1.6.0-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/README.md +71 -0
  2. package/dist/cjs/index.js +2054 -1714
  3. package/dist/cjs/types/src/components/FeatureUsageGraph.d.ts +4 -3
  4. package/dist/cjs/types/src/components/QuoteProvider/QuoteProvider.d.ts +4 -0
  5. package/dist/cjs/types/src/components/{QuoteProvider.d.ts → QuoteProvider/context/QuoteContext.d.ts} +4 -6
  6. package/dist/cjs/types/src/components/QuoteProvider/fragments/quoteFragment.d.ts +77 -0
  7. package/dist/cjs/types/src/components/QuoteProvider/hooks/useQuoteCreate.d.ts +19 -0
  8. package/dist/cjs/types/src/{hooks/quotes → components/QuoteProvider/hooks}/useQuoteQuantities.d.ts +4 -2
  9. package/dist/cjs/types/src/{graphql → components/QuoteProvider}/mutations/quoteChargeUpdate.d.ts +12 -2
  10. package/dist/cjs/types/src/components/QuoteProvider/queries/getQuote.d.ts +16 -0
  11. package/dist/cjs/types/src/components/Subscriptions/Upgrade/PlanPicker/PriceListGrid.d.ts +2 -1
  12. package/dist/cjs/types/src/components/Subscriptions/Upgrade/PlanPicker/checkoutBar/CheckoutBarInput.d.ts +2 -2
  13. package/dist/cjs/types/src/components/Subscriptions/Upgrade/PlanPicker/planPickerDesktop/BillingPeriodSelector.d.ts +3 -2
  14. package/dist/cjs/types/src/components/Subscriptions/Upgrade/PlanPicker/planPickerDesktop/PlanAddonsCard.d.ts +2 -1
  15. package/dist/cjs/types/src/components/Subscriptions/Upgrade/PlanPicker/planPickerDesktop/PriceListGridDesktop.d.ts +3 -2
  16. package/dist/cjs/types/src/components/Subscriptions/Upgrade/PlanPicker/planPickerDesktop/util.d.ts +1 -1
  17. package/dist/cjs/types/src/components/Subscriptions/Upgrade/PlanPicker/priceListCard/PriceDescription/PriceListCardPriceDescription.d.ts +6 -0
  18. package/dist/cjs/types/src/components/Subscriptions/Upgrade/PlanPicker/priceListCard/PriceDescription/utils/hasMultipleRecurringCharges.d.ts +2 -0
  19. package/dist/cjs/types/src/components/Subscriptions/quantityChangeDrawer/quantityChangeDrawerDesktop/QuantityChangeDrawerDesktop.d.ts +0 -2
  20. package/dist/cjs/types/src/components/Subscriptions/subscriptionsList/subscriptionUtils.d.ts +0 -2
  21. package/dist/cjs/types/src/components/Subscriptions/tieredDisplayDropdown/TieredDisplayDropdown.d.ts +9 -0
  22. package/dist/cjs/types/src/components/Subscriptions/tieredDisplayDropdown/util.d.ts +9 -0
  23. package/dist/cjs/types/src/components/priceListPricing/PricingTooltip.d.ts +40 -0
  24. package/dist/cjs/types/src/components/priceListPricing/components/ChargePriceTiers.d.ts +23 -0
  25. package/dist/cjs/types/src/components/priceListPricing/components/PriceTierPrice.d.ts +7 -0
  26. package/dist/cjs/types/src/components/priceListPricing/components/PriceTierRow.d.ts +13 -0
  27. package/dist/cjs/types/src/components/priceListPricing/misc/consts.d.ts +1 -0
  28. package/dist/cjs/types/src/components/priceListPricing/types/PriceTier.d.ts +4 -0
  29. package/dist/cjs/types/src/components/priceListPricing/utils/getPricingModelDescription.d.ts +2 -0
  30. package/dist/cjs/types/src/components/priceListPricing/utils/getPricingModelTitle.d.ts +2 -0
  31. package/dist/cjs/types/src/components/priceListPricing/utils/hasPriceTiers.d.ts +9 -0
  32. package/dist/cjs/types/src/components/priceListPricing/utils/priceListChargeUtil.ts/getFirstTierPrice.d.ts +7 -0
  33. package/dist/cjs/types/src/enums/SubscriptionState.d.ts +9 -0
  34. package/dist/cjs/types/src/graphql/mutations/quoteChargeDelete.d.ts +11 -2
  35. package/dist/cjs/types/src/graphql/queries/getQuote.d.ts +29 -2
  36. package/dist/cjs/types/src/graphql-codegen/exportedScalarTypes.d.ts +6 -0
  37. package/dist/cjs/types/src/index.d.ts +2 -2
  38. package/dist/cjs/types/src/utils/addonPlanUtils.d.ts +2 -1
  39. package/dist/cjs/types/src/utils/featureAddonUtils.d.ts +16 -1
  40. package/dist/cjs/types/src/utils/formatCurrency.d.ts +1 -0
  41. package/dist/cjs/types/src/utils/priceListUtils/doesPriceListHaveFlatFeeCharges.d.ts +7 -0
  42. package/dist/cjs/types/src/utils/priceListUtils/getPrice.d.ts +5 -0
  43. package/dist/cjs/types/src/utils/priceListUtils/priceDescription.d.ts +6 -0
  44. package/dist/cjs/types/src/utils/priceListUtils/priceListPriceText.d.ts +12 -0
  45. package/dist/cjs/types/src/utils/pricePickerUtils.d.ts +3 -3
  46. package/dist/esm/index.js +2093 -1753
  47. package/dist/esm/types/src/components/FeatureUsageGraph.d.ts +4 -3
  48. package/dist/esm/types/src/components/QuoteProvider/QuoteProvider.d.ts +4 -0
  49. package/dist/esm/types/src/components/{QuoteProvider.d.ts → QuoteProvider/context/QuoteContext.d.ts} +4 -6
  50. package/dist/esm/types/src/components/QuoteProvider/fragments/quoteFragment.d.ts +77 -0
  51. package/dist/esm/types/src/components/QuoteProvider/hooks/useQuoteCreate.d.ts +19 -0
  52. package/dist/esm/types/src/{hooks/quotes → components/QuoteProvider/hooks}/useQuoteQuantities.d.ts +4 -2
  53. package/dist/esm/types/src/{graphql → components/QuoteProvider}/mutations/quoteChargeUpdate.d.ts +12 -2
  54. package/dist/esm/types/src/components/QuoteProvider/queries/getQuote.d.ts +16 -0
  55. package/dist/esm/types/src/components/Subscriptions/Upgrade/PlanPicker/PriceListGrid.d.ts +2 -1
  56. package/dist/esm/types/src/components/Subscriptions/Upgrade/PlanPicker/checkoutBar/CheckoutBarInput.d.ts +2 -2
  57. package/dist/esm/types/src/components/Subscriptions/Upgrade/PlanPicker/planPickerDesktop/BillingPeriodSelector.d.ts +3 -2
  58. package/dist/esm/types/src/components/Subscriptions/Upgrade/PlanPicker/planPickerDesktop/PlanAddonsCard.d.ts +2 -1
  59. package/dist/esm/types/src/components/Subscriptions/Upgrade/PlanPicker/planPickerDesktop/PriceListGridDesktop.d.ts +3 -2
  60. package/dist/esm/types/src/components/Subscriptions/Upgrade/PlanPicker/planPickerDesktop/util.d.ts +1 -1
  61. package/dist/esm/types/src/components/Subscriptions/Upgrade/PlanPicker/priceListCard/PriceDescription/PriceListCardPriceDescription.d.ts +6 -0
  62. package/dist/esm/types/src/components/Subscriptions/Upgrade/PlanPicker/priceListCard/PriceDescription/utils/hasMultipleRecurringCharges.d.ts +2 -0
  63. package/dist/esm/types/src/components/Subscriptions/quantityChangeDrawer/quantityChangeDrawerDesktop/QuantityChangeDrawerDesktop.d.ts +0 -2
  64. package/dist/esm/types/src/components/Subscriptions/subscriptionsList/subscriptionUtils.d.ts +0 -2
  65. package/dist/esm/types/src/components/Subscriptions/tieredDisplayDropdown/TieredDisplayDropdown.d.ts +9 -0
  66. package/dist/esm/types/src/components/Subscriptions/tieredDisplayDropdown/util.d.ts +9 -0
  67. package/dist/esm/types/src/components/priceListPricing/PricingTooltip.d.ts +40 -0
  68. package/dist/esm/types/src/components/priceListPricing/components/ChargePriceTiers.d.ts +23 -0
  69. package/dist/esm/types/src/components/priceListPricing/components/PriceTierPrice.d.ts +7 -0
  70. package/dist/esm/types/src/components/priceListPricing/components/PriceTierRow.d.ts +13 -0
  71. package/dist/esm/types/src/components/priceListPricing/misc/consts.d.ts +1 -0
  72. package/dist/esm/types/src/components/priceListPricing/types/PriceTier.d.ts +4 -0
  73. package/dist/esm/types/src/components/priceListPricing/utils/getPricingModelDescription.d.ts +2 -0
  74. package/dist/esm/types/src/components/priceListPricing/utils/getPricingModelTitle.d.ts +2 -0
  75. package/dist/esm/types/src/components/priceListPricing/utils/hasPriceTiers.d.ts +9 -0
  76. package/dist/esm/types/src/components/priceListPricing/utils/priceListChargeUtil.ts/getFirstTierPrice.d.ts +7 -0
  77. package/dist/esm/types/src/enums/SubscriptionState.d.ts +9 -0
  78. package/dist/esm/types/src/graphql/mutations/quoteChargeDelete.d.ts +11 -2
  79. package/dist/esm/types/src/graphql/queries/getQuote.d.ts +29 -2
  80. package/dist/esm/types/src/graphql-codegen/exportedScalarTypes.d.ts +6 -0
  81. package/dist/esm/types/src/index.d.ts +2 -2
  82. package/dist/esm/types/src/utils/addonPlanUtils.d.ts +2 -1
  83. package/dist/esm/types/src/utils/featureAddonUtils.d.ts +16 -1
  84. package/dist/esm/types/src/utils/formatCurrency.d.ts +1 -0
  85. package/dist/esm/types/src/utils/priceListUtils/doesPriceListHaveFlatFeeCharges.d.ts +7 -0
  86. package/dist/esm/types/src/utils/priceListUtils/getPrice.d.ts +5 -0
  87. package/dist/esm/types/src/utils/priceListUtils/priceDescription.d.ts +6 -0
  88. package/dist/esm/types/src/utils/priceListUtils/priceListPriceText.d.ts +12 -0
  89. package/dist/esm/types/src/utils/pricePickerUtils.d.ts +3 -3
  90. package/package.json +2 -2
  91. package/dist/cjs/types/src/components/Subscriptions/TieredDisplayDropdown.d.ts +0 -8
  92. package/dist/cjs/types/src/components/Subscriptions/Upgrade/PlanPicker/priceListCard/PriceListCardPriceDescription.d.ts +0 -13
  93. package/dist/cjs/types/src/hooks/quotes/useQuoteCreate.d.ts +0 -9
  94. package/dist/esm/types/src/components/Subscriptions/TieredDisplayDropdown.d.ts +0 -8
  95. package/dist/esm/types/src/components/Subscriptions/Upgrade/PlanPicker/priceListCard/PriceListCardPriceDescription.d.ts +0 -13
  96. package/dist/esm/types/src/hooks/quotes/useQuoteCreate.d.ts +0 -9
  97. /package/dist/cjs/types/src/components/Subscriptions/Upgrade/PlanPicker/planPickerDesktop/{PriceListCardDesktop.d.ts → priceListCardDesktop/PriceListCardDesktop.d.ts} +0 -0
  98. /package/dist/esm/types/src/components/Subscriptions/Upgrade/PlanPicker/planPickerDesktop/{PriceListCardDesktop.d.ts → priceListCardDesktop/PriceListCardDesktop.d.ts} +0 -0
@@ -1,6 +1,7 @@
1
- import { FeatureUsage, SubscriptionCharge } from "@bunnyapp/common";
2
- declare const FeatureUsageGraph: ({ charge, featureUsage, }: {
1
+ import { FeatureUsage, SubscriptionCharge } from '@bunnyapp/common';
2
+ declare const FeatureUsageGraph: ({ charge, featureUsage, useAreaChart, }: {
3
3
  charge: SubscriptionCharge;
4
4
  featureUsage: FeatureUsage;
5
- }) => import("react/jsx-runtime").JSX.Element;
5
+ useAreaChart?: boolean;
6
+ }) => import("react/jsx-runtime").JSX.Element | "no usage" | null;
6
7
  export default FeatureUsageGraph;
@@ -0,0 +1,4 @@
1
+ declare function QuoteProvider({ children }: {
2
+ children: React.ReactNode;
3
+ }): import("react/jsx-runtime").JSX.Element;
4
+ export default QuoteProvider;
@@ -1,6 +1,8 @@
1
- import { PriceList, Quote } from '@bunnyapp/common';
1
+ import { PriceList } from '@bunnyapp/common';
2
+ import { ResultOf } from 'gql.tada';
3
+ import { QuoteContext_QuoteFragment } from '../fragments/quoteFragment';
2
4
  export type QuoteContextValues = {
3
- quote: Quote | undefined;
5
+ quote: ResultOf<typeof QuoteContext_QuoteFragment> | null | undefined;
4
6
  selectedPriceList: PriceList | undefined;
5
7
  isQuotePending: boolean;
6
8
  isAddonPlanLoading: boolean;
@@ -15,7 +17,3 @@ export type QuoteContextValues = {
15
17
  onChangeQuantity: (priceListChargeId: string, quantity: number) => void;
16
18
  };
17
19
  export declare const QuoteContext: import("react").Context<QuoteContextValues>;
18
- declare function QuoteProvider({ children }: {
19
- children: React.ReactNode;
20
- }): import("react/jsx-runtime").JSX.Element;
21
- export default QuoteProvider;
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Central quote fragment for QuoteProvider context.
3
+ *
4
+ * This fragment aggregates all child component fragments to ensure the QuoteProvider
5
+ * fetches all required quote data upfront. When a component needs specific quote fields,
6
+ * add its fragment here to maintain type safety and avoid over-fetching.
7
+ *
8
+ * Pattern: Fragment Composition
9
+ * - Components define their data needs via fragments
10
+ * - Provider composes these fragments into a single query
11
+ * - Type safety ensures all required fields are fetched
12
+ */
13
+ export declare const QuoteContext_QuoteFragment: import("gql.tada").TadaDocumentNode<{
14
+ accountId: string;
15
+ amount: number;
16
+ amountDue: number | null;
17
+ smallUnitAmountDue: number | null;
18
+ currencyId: string;
19
+ id: string | null;
20
+ payableId: string | null;
21
+ periodAmount: number | null;
22
+ subtotal: number;
23
+ taxAmount: number;
24
+ startDate: unknown;
25
+ formattedQuote: {
26
+ html: string | null;
27
+ } | null;
28
+ amountsByPeriod: {
29
+ amount: number | null;
30
+ startDate: unknown;
31
+ }[];
32
+ kind: "COUPON" | "SUBSCRIBE" | "UPDATE" | "RENEW" | "REINSTATE" | "UNSUBSCRIBE" | "ADJUSTMENT" | "DISCOUNT" | "CREDIT" | "PRICE_UPDATE" | "QUANTITY_UPDATE" | "FREE_PERIOD_DISCOUNT" | "ACTIVATE";
33
+ quoteChanges: {
34
+ currencyId: string;
35
+ id: string | null;
36
+ kind: "COUPON" | "SUBSCRIBE" | "UPDATE" | "RENEW" | "REINSTATE" | "UNSUBSCRIBE" | "ADJUSTMENT" | "DISCOUNT" | "CREDIT" | "PRICE_UPDATE" | "QUANTITY_UPDATE" | "FREE_PERIOD_DISCOUNT" | "ACTIVATE";
37
+ charges: {
38
+ subtotal: number | null;
39
+ amountsByPeriod: {
40
+ amount: number | null;
41
+ startDate: unknown;
42
+ }[] | null;
43
+ amount: number | null;
44
+ billingPeriod: "ONCE" | "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL" | null;
45
+ currencyId: string;
46
+ feature: {
47
+ unitName: string | null;
48
+ } | null;
49
+ id: string | null;
50
+ name: string | null;
51
+ priceListCharge: {
52
+ id: string;
53
+ } | null;
54
+ priceList: {
55
+ id: string;
56
+ } | null;
57
+ coupon: {
58
+ couponCode: string;
59
+ } | null;
60
+ quantity: number | null;
61
+ kind: "COUPON" | "SUBSCRIBE" | "UPDATE" | "RENEW" | "REINSTATE" | "UNSUBSCRIBE" | "ADJUSTMENT" | "DISCOUNT" | "CREDIT" | "PRICE_UPDATE" | "QUANTITY_UPDATE" | "FREE_PERIOD_DISCOUNT" | "ACTIVATE" | null;
62
+ }[];
63
+ priceList: {
64
+ id: string;
65
+ plan: {
66
+ name: string;
67
+ } | null;
68
+ product: {
69
+ name: string;
70
+ } | null;
71
+ } | null;
72
+ }[] | null;
73
+ }, {}, {
74
+ fragment: "QuoteContext_QuoteFragment";
75
+ on: "Quote";
76
+ masked: true;
77
+ }>;
@@ -0,0 +1,19 @@
1
+ import { PriceList, Subscription } from '@bunnyapp/common';
2
+ export declare const useQuoteCreate: ({ upgradingSubscription, selectedPriceList, token, }: {
3
+ upgradingSubscription?: Subscription;
4
+ selectedPriceList?: PriceList;
5
+ token?: string;
6
+ }) => {
7
+ quote: {
8
+ [$tada.fragmentRefs]: {
9
+ QuoteContext_QuoteFragment: "Quote";
10
+ };
11
+ } | {
12
+ [$tada.fragmentRefs]: {
13
+ QuoteContext_QuoteFragment: "Quote";
14
+ } & {
15
+ FormattedQuoteFields_QuoteFragment: "Quote";
16
+ };
17
+ } | null | undefined;
18
+ isQuotePending: boolean;
19
+ };
@@ -1,7 +1,9 @@
1
- import { PriceList, Quote } from '@bunnyapp/common';
1
+ import { PriceList } from '@bunnyapp/common';
2
+ import { ResultOf } from 'gql.tada';
3
+ import { QuoteContext_QuoteFragment } from '../fragments/quoteFragment';
2
4
  export declare const useQuoteQuantities: ({ selectedPriceList, quote, }: {
3
5
  selectedPriceList: PriceList;
4
- quote?: Quote;
6
+ quote: ResultOf<typeof QuoteContext_QuoteFragment> | null | undefined;
5
7
  }) => {
6
8
  onChangeQuantity: (priceListChargeId: string, quantity: number) => void;
7
9
  getFeatureQuantity: (featureId: string) => number | undefined;
@@ -1,4 +1,3 @@
1
- import { QuoteCharge } from '@bunnyapp/common';
2
1
  declare const quoteChargeUpdate: ({ discount, name, price, quantity, quoteChargeId, startDate, subtotal, apiHost, token, }: {
3
2
  discount?: number;
4
3
  name?: string;
@@ -9,5 +8,16 @@ declare const quoteChargeUpdate: ({ discount, name, price, quantity, quoteCharge
9
8
  subtotal?: number;
10
9
  apiHost: string;
11
10
  token: string;
12
- }) => Promise<QuoteCharge>;
11
+ }) => Promise<{
12
+ quoteChange: {
13
+ id: string | null;
14
+ quoteId: string;
15
+ quote: {
16
+ [$tada.fragmentRefs]: {
17
+ QuoteContext_QuoteFragment: "Quote";
18
+ };
19
+ };
20
+ };
21
+ id: string | null;
22
+ } | null | undefined>;
13
23
  export default quoteChargeUpdate;
@@ -0,0 +1,16 @@
1
+ export declare const getQuote: ({ id, token, apiHost, includeHtmlField, }: {
2
+ id: string;
3
+ token?: string;
4
+ apiHost: string;
5
+ includeHtmlField?: boolean;
6
+ }) => Promise<{
7
+ [$tada.fragmentRefs]: {
8
+ QuoteContext_QuoteFragment: "Quote";
9
+ };
10
+ } | {
11
+ [$tada.fragmentRefs]: {
12
+ QuoteContext_QuoteFragment: "Quote";
13
+ } & {
14
+ FormattedQuoteFields_QuoteFragment: "Quote";
15
+ };
16
+ } | null>;
@@ -1,4 +1,5 @@
1
- import { BillingPeriod, PriceList, PriceListChangeOptions, Product, Subscription } from '@bunnyapp/common';
1
+ import { BillingPeriod } from '@/graphql-codegen/exportedScalarTypes';
2
+ import { PriceList, PriceListChangeOptions, Product, Subscription } from '@bunnyapp/common';
2
3
  import { Dispatch, SetStateAction } from 'react';
3
4
  type PriceListGridProps = {
4
5
  availablePriceLists: PriceList[];
@@ -1,7 +1,7 @@
1
1
  import { PriceListCharge } from '@bunnyapp/common';
2
- declare const CheckoutBarInput: ({ disabled, charge, quantity, onQuantityChanged, }: {
2
+ declare const CheckoutBarInput: ({ disabled, priceListCharge, quantity, onQuantityChanged, }: {
3
3
  disabled?: boolean;
4
- charge: PriceListCharge;
4
+ priceListCharge: PriceListCharge;
5
5
  quantity: number;
6
6
  onQuantityChanged: (quantity: number) => void;
7
7
  }) => import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,6 @@
1
- import { BillingPeriod, Product } from '@bunnyapp/common';
2
- import { PeriodMonths } from '../../../../../utils/pricePickerUtils';
1
+ import { Product } from '@bunnyapp/common';
2
+ import { BillingPeriod } from '@/graphql-codegen/exportedScalarTypes';
3
+ type PeriodMonths = number;
3
4
  declare const BillingPeriodSelector: ({ availableBillingPeriods, onChangeBillingPeriod, products, selectedBillingPeriod, selectedProduct, onChangeProduct, }: {
4
5
  availableBillingPeriods?: PeriodMonths[];
5
6
  onChangeBillingPeriod: (billingPeriod: BillingPeriod) => void;
@@ -1,4 +1,5 @@
1
- import { BillingPeriod, Plan, PriceList, Subscription } from '@bunnyapp/common';
1
+ import { Plan, PriceList, Subscription } from '@bunnyapp/common';
2
+ import { BillingPeriod } from '@/graphql-codegen/exportedScalarTypes';
2
3
  type PlanAddonsCardProps = {
3
4
  selectedPriceList: PriceList;
4
5
  subscriptions: Subscription[];
@@ -1,5 +1,6 @@
1
- import { BillingPeriod, PriceList, PriceListChangeOptions, Product, Subscription } from '@bunnyapp/common';
1
+ import { PriceList, PriceListChangeOptions, Product, Subscription } from '@bunnyapp/common';
2
2
  import { Dispatch, SetStateAction } from 'react';
3
+ import { BillingPeriod } from '@/graphql-codegen/exportedScalarTypes';
3
4
  type PriceListGridDesktopProps = {
4
5
  availablePriceLists: PriceList[];
5
6
  priceListChangeOptions?: PriceListChangeOptions;
@@ -9,7 +10,7 @@ type PriceListGridDesktopProps = {
9
10
  setPriceListStart: Dispatch<SetStateAction<number>>;
10
11
  subscriptions: Subscription[];
11
12
  trialRemainingDays: number;
12
- selectedBillingPeriod?: BillingPeriod | undefined;
13
+ selectedBillingPeriod?: BillingPeriod;
13
14
  onClickPriceListCard: (priceList: PriceList) => void;
14
15
  };
15
16
  declare const PriceListGridDesktop: ({ availablePriceLists, priceListChangeOptions, priceListStart, selectedPriceList, selectedProduct, setPriceListStart, subscriptions, trialRemainingDays, selectedBillingPeriod, onClickPriceListCard, }: PriceListGridDesktopProps) => import("react/jsx-runtime").JSX.Element;
@@ -57,7 +57,7 @@ export declare const filterUniqueFeatures: ({ availablePriceLists, }: {
57
57
  showPriceAsMonthly?: boolean;
58
58
  sku?: string;
59
59
  trialAllowed: boolean;
60
- trialExpirationAction?: "CANCEL" | "ACTIVATE";
60
+ trialExpirationAction?: "ACTIVATE" | "CANCEL";
61
61
  trialLengthDays?: number;
62
62
  updatedAt: string;
63
63
  addonPlans?: import("@bunnyapp/common").Plan[];
@@ -0,0 +1,6 @@
1
+ import { Feature, PriceList } from '@bunnyapp/common';
2
+ declare const PriceListCardPriceDescription: ({ feature, priceList, }: {
3
+ feature?: Feature;
4
+ priceList: PriceList;
5
+ }) => import("react/jsx-runtime").JSX.Element | null;
6
+ export default PriceListCardPriceDescription;
@@ -0,0 +1,2 @@
1
+ import { PriceList } from '@bunnyapp/common';
2
+ export declare const hasMultipleRecurringCharges: (priceList: PriceList) => number;
@@ -2,10 +2,8 @@ import { Quote } from '@bunnyapp/common';
2
2
  import { FragmentOf } from 'gql.tada';
3
3
  import { EditingQuoteDataType } from '../../SubscriptionsListContainer';
4
4
  export declare const QuantityDrawerDesktop_SubscriptionFragment: import("gql.tada").TadaDocumentNode<{
5
- state: "ACTIVE" | "TRIAL" | "CANCELED" | "EXPIRED" | "TRIAL_EXPIRED" | "PENDING";
6
5
  currentCharges: {
7
6
  chargeType: "ONE_TIME" | "RECURRING" | "USAGE" | null;
8
- trial: boolean;
9
7
  [$tada.fragmentRefs]: {
10
8
  QuantityChangeGridRow_SubscriptionChargeFragment: "SubscriptionCharge";
11
9
  };
@@ -11,6 +11,4 @@ export declare const isSubscriptionTrial: (subscription: Subscription) => boolea
11
11
  export declare const isSubscriptionTrialExpired: (subscription: Subscription) => boolean;
12
12
  export declare const isDiscount: (kind?: QuoteChangeKind) => kind is QuoteChangeKind.DISCOUNT | QuoteChangeKind.FREE_PERIOD_DISCOUNT;
13
13
  export declare const hasPriceTiers: (charge: SubscriptionCharge) => boolean;
14
- export declare const hasMultiplePriceTiers: (charge: SubscriptionCharge) => boolean;
15
- export declare const getApplicablePriceTier: (charge: SubscriptionCharge, currencyId: string, priceDecimals: number) => string;
16
14
  export declare const getUpdatingChargeQuantityId: (charge: SubscriptionCharge, subscription: Subscription) => string;
@@ -0,0 +1,9 @@
1
+ import { PriceTier } from '@bunnyapp/common';
2
+ import { ReactNode } from 'react';
3
+ declare const TieredDisplayDropdown: ({ priceTiers, currencyId, priceDecimals, truncatedText, }: {
4
+ priceTiers: PriceTier[];
5
+ currencyId: string;
6
+ priceDecimals: number;
7
+ truncatedText: ReactNode;
8
+ }) => import("react/jsx-runtime").JSX.Element;
9
+ export default TieredDisplayDropdown;
@@ -0,0 +1,9 @@
1
+ import { PricingModel } from '../../../graphql-codegen/exportedScalarTypes';
2
+ export declare const getApplicablePriceTier: (charge: {
3
+ priceTiers: {
4
+ starts: number | null;
5
+ price: number | null;
6
+ }[] | null;
7
+ pricingModel: PricingModel | null;
8
+ quantity: number | null;
9
+ }, currencyId: string, priceDecimals: number) => string;
@@ -0,0 +1,40 @@
1
+ import { PlanPricingStyles, PricingModel } from '@/graphql-codegen/exportedScalarTypes';
2
+ import { FragmentOf } from 'gql.tada';
3
+ export declare const PricingTooltip_PriceListChargeFragment: import("gql.tada").TadaDocumentNode<{
4
+ priceListChargeTiers: {
5
+ starts: number | null;
6
+ price: number | null;
7
+ }[] | null;
8
+ pricingModel: "FLAT" | "TIERED" | "VOLUME" | "BANDS" | null;
9
+ feature: {
10
+ unitName: string | null;
11
+ } | null;
12
+ priceDecimals: number | null;
13
+ name: string;
14
+ [$tada.fragmentRefs]: {
15
+ ChargePriceTiers_PriceListChargeFragment: "PriceListCharge";
16
+ };
17
+ }, {}, {
18
+ fragment: "PricingTooltip_PriceListChargeFragment";
19
+ on: "PriceListCharge";
20
+ masked: true;
21
+ }>;
22
+ export declare const PricingTooltip: ({ className, priceListCharges: maskedPriceListCharges, currencyId, priceList, }: {
23
+ className?: string;
24
+ priceListCharges: FragmentOf<typeof PricingTooltip_PriceListChargeFragment>[];
25
+ currencyId: string;
26
+ priceList: {
27
+ showPriceAsMonthly?: boolean;
28
+ periodMonths?: number;
29
+ charges: {
30
+ pricingModel?: PricingModel;
31
+ basePrice?: number;
32
+ }[];
33
+ plan: {
34
+ pricingStyle?: PlanPricingStyles;
35
+ };
36
+ currencyId?: string;
37
+ monthlyBasePrice?: number;
38
+ basePrice?: number;
39
+ };
40
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,23 @@
1
+ import { FragmentOf } from 'gql.tada';
2
+ export declare const ChargePriceTiers_PriceListChargeFragment: import("gql.tada").TadaDocumentNode<{
3
+ id: string;
4
+ name: string;
5
+ pricingModel: "FLAT" | "TIERED" | "VOLUME" | "BANDS" | null;
6
+ priceDecimals: number | null;
7
+ priceListChargeTiers: {
8
+ starts: number | null;
9
+ price: number | null;
10
+ [$tada.fragmentRefs]: {
11
+ PriceTierRow_PriceTierFragment: "PriceListChargeTier";
12
+ };
13
+ }[] | null;
14
+ }, {}, {
15
+ fragment: "ChargePriceTiers_PriceListChargeFragment";
16
+ on: "PriceListCharge";
17
+ masked: true;
18
+ }>;
19
+ declare const ChargePriceTiers: ({ charge: maskedCharge, currencyId, }: {
20
+ charge: FragmentOf<typeof ChargePriceTiers_PriceListChargeFragment>;
21
+ currencyId: string;
22
+ }) => import("react/jsx-runtime").JSX.Element;
23
+ export default ChargePriceTiers;
@@ -0,0 +1,7 @@
1
+ import { PriceTier } from '../types/PriceTier';
2
+ declare const PriceTierPrice: ({ currencyId, priceDecimals, tier, }: {
3
+ currencyId: string;
4
+ priceDecimals: number;
5
+ tier: PriceTier;
6
+ }) => import("react/jsx-runtime").JSX.Element;
7
+ export default PriceTierPrice;
@@ -0,0 +1,13 @@
1
+ import { FragmentOf } from 'gql.tada';
2
+ export declare const PriceTierRow_PriceTierFragment: import("gql.tada").TadaDocumentNode<{
3
+ starts: number | null;
4
+ }, {}, {
5
+ fragment: "PriceTierRow_PriceTierFragment";
6
+ on: "PriceListChargeTier";
7
+ masked: true;
8
+ }>;
9
+ declare const PriceTierRow: ({ tier: maskedTier, nextTier: maskedNextTier, }: {
10
+ tier: FragmentOf<typeof PriceTierRow_PriceTierFragment> | null;
11
+ nextTier: FragmentOf<typeof PriceTierRow_PriceTierFragment> | null;
12
+ }) => import("react/jsx-runtime").JSX.Element;
13
+ export default PriceTierRow;
@@ -0,0 +1 @@
1
+ export declare const TOOLTIP_BG_COLOR = "#2F353B";
@@ -0,0 +1,4 @@
1
+ export type PriceTier = {
2
+ starts: number | null;
3
+ price: number | null;
4
+ };
@@ -0,0 +1,2 @@
1
+ import { PricingModel } from '@/graphql-codegen/exportedScalarTypes';
2
+ export declare const getPricingModelDescription: (pricingModel: PricingModel | null) => "" | "units in each tier are priced separately." | "the highest tier reached prices all units." | "the quantity indexes to a flat price.";
@@ -0,0 +1,2 @@
1
+ import { PricingModel } from '@/graphql-codegen/exportedScalarTypes';
2
+ export declare const getPricingModelTitle: (pricingModel: PricingModel | null) => "" | "Tiered" | "Volume" | "Bands";
@@ -0,0 +1,9 @@
1
+ import { PriceTier } from '../types/PriceTier';
2
+ export declare const priceListHasPriceTiers: (priceList: {
3
+ charges: {
4
+ priceListChargeTiers: PriceTier[];
5
+ }[];
6
+ }) => boolean;
7
+ export declare const chargeHasPriceTiers: (charge: {
8
+ priceListChargeTiers: PriceTier[] | null;
9
+ }) => boolean | 0 | undefined;
@@ -0,0 +1,7 @@
1
+ export declare const getFirstTierPrice: (charge: {
2
+ priceListChargeTiers: {
3
+ starts: number | null;
4
+ price: number | null;
5
+ }[] | null;
6
+ priceDecimals: number | null;
7
+ }, currencyId: string) => string | number;
@@ -0,0 +1,9 @@
1
+ declare enum SubscriptionState {
2
+ ACTIVE = "ACTIVE",
3
+ TRIAL = "TRIAL",
4
+ PENDING = "PENDING",
5
+ EXPIRED = "EXPIRED",
6
+ CANCELED = "CANCELED",
7
+ TRIAL_EXPIRED = "TRIAL_EXPIRED"
8
+ }
9
+ export default SubscriptionState;
@@ -1,8 +1,17 @@
1
- import { QuoteCharge } from '@bunnyapp/common';
2
1
  type QuoteChargeDeleteProps = {
3
2
  apiHost: string;
4
3
  quoteChargeId: string;
5
4
  token?: string;
6
5
  };
7
- declare const quoteChargeDelete: ({ quoteChargeId, token, apiHost }: QuoteChargeDeleteProps) => Promise<QuoteCharge>;
6
+ declare const quoteChargeDelete: ({ quoteChargeId, token, apiHost }: QuoteChargeDeleteProps) => Promise<{
7
+ quoteChange: {
8
+ id: string | null;
9
+ quoteId: string;
10
+ quote: {
11
+ [$tada.fragmentRefs]: {
12
+ QuoteContext_QuoteFragment: "Quote";
13
+ };
14
+ };
15
+ };
16
+ } | null | undefined>;
8
17
  export default quoteChargeDelete;
@@ -1,9 +1,36 @@
1
- import { Quote } from '@bunnyapp/common';
1
+ import { ResultOf } from 'gql.tada';
2
2
  export declare const QUOTE_FIELDS: (removeFormattedQuoteField?: boolean) => string;
3
+ declare const query: import("gql.tada").TadaDocumentNode<{
4
+ quote: {
5
+ [$tada.fragmentRefs]: {
6
+ QuoteContext_QuoteFragment: "Quote";
7
+ };
8
+ } | {
9
+ [$tada.fragmentRefs]: {
10
+ QuoteContext_QuoteFragment: "Quote";
11
+ } & {
12
+ FormattedQuoteField_QuoteFragment: "Quote";
13
+ };
14
+ } | null;
15
+ }, {
16
+ removeFormattedQuoteField: boolean;
17
+ id?: string | null | undefined;
18
+ }, void>;
19
+ export type Quote = ResultOf<typeof query>['quote'];
3
20
  declare const getQuote: ({ id, token, apiHost, removeFormattedQuoteField, }: {
4
21
  id: string;
5
22
  token?: string;
6
23
  apiHost: string;
7
24
  removeFormattedQuoteField?: boolean;
8
- }) => Promise<Quote>;
25
+ }) => Promise<{
26
+ [$tada.fragmentRefs]: {
27
+ QuoteContext_QuoteFragment: "Quote";
28
+ };
29
+ } | {
30
+ [$tada.fragmentRefs]: {
31
+ QuoteContext_QuoteFragment: "Quote";
32
+ } & {
33
+ FormattedQuoteField_QuoteFragment: "Quote";
34
+ };
35
+ } | null>;
9
36
  export default getQuote;
@@ -0,0 +1,6 @@
1
+ import { graphql } from './graphql';
2
+ export type QuoteChangeKind = ReturnType<typeof graphql.scalar<'QuoteChangeKind'>>;
3
+ export type PricingModel = ReturnType<typeof graphql.scalar<'PricingModel'>>;
4
+ export type BillingPeriod = ReturnType<typeof graphql.scalar<'BillingPeriod'>>;
5
+ export type PlanPricingStyles = ReturnType<typeof graphql.scalar<'PlanPricingStyles'>>;
6
+ export type ChargeType = ReturnType<typeof graphql.scalar<'ChargeType'>>;
@@ -1,2 +1,2 @@
1
- import "./styles/index.less";
2
- export * from "./components";
1
+ import './styles/index.less';
2
+ export * from './components';
@@ -1,4 +1,5 @@
1
- import { BillingPeriod, Plan, PriceList, Subscription } from '@bunnyapp/common';
1
+ import { Plan, PriceList, Subscription } from '@bunnyapp/common';
2
+ import { BillingPeriod } from '@/graphql-codegen/exportedScalarTypes';
2
3
  export declare const ADDON_INDENTATION = 64;
3
4
  export declare function findNonAddonSubscriptions(subscriptions: Subscription[]): Subscription[];
4
5
  export declare function findAddonSubscriptions(parentSubscription: Subscription, subscriptions: Subscription[]): Subscription[];
@@ -2,5 +2,20 @@ import { PriceList, PriceListCharge, Quote, Subscription } from '@bunnyapp/commo
2
2
  export declare function isAddonPurchased(featureAddon: PriceListCharge, currentSubscription: Subscription | undefined): boolean;
3
3
  export declare function hasUnpurchasedFeatureAddons(priceList: PriceList, currentSubscription: Subscription | undefined): boolean;
4
4
  export declare function findQuoteChangeForFeatureAddon(quote: Quote): import("@bunnyapp/common").QuoteChange | undefined;
5
- export declare function featureAddonInQuote(selectedPriceList: PriceList, priceListCharge: PriceListCharge, quote?: Quote): boolean;
5
+ export declare function featureAddonInQuote(selectedPriceList: {
6
+ id: string;
7
+ }, priceListCharge: {
8
+ id: string;
9
+ }, quote?: {
10
+ quoteChanges?: {
11
+ priceList?: {
12
+ id?: string;
13
+ } | null;
14
+ charges?: {
15
+ priceListCharge?: {
16
+ id?: string;
17
+ } | null;
18
+ }[];
19
+ }[] | null;
20
+ } | null): boolean;
6
21
  export declare function featureAddonSwitchTestId(featureAddon: PriceListCharge): string;
@@ -0,0 +1 @@
1
+ export declare const formatCurrency: (value: number | string | null | undefined, currencyIsoCode: string | undefined, decimals?: number) => string | number;
@@ -0,0 +1,7 @@
1
+ import { PricingModel } from '@/graphql-codegen/exportedScalarTypes';
2
+ export declare function doesPriceListHaveFlatFeeCharges(priceList: {
3
+ charges: {
4
+ pricingModel?: PricingModel;
5
+ basePrice?: number;
6
+ }[];
7
+ }): boolean;
@@ -0,0 +1,5 @@
1
+ export declare const getPrice: (priceList: {
2
+ showPriceAsMonthly?: boolean;
3
+ monthlyBasePrice?: number;
4
+ basePrice?: number;
5
+ }) => number | undefined;
@@ -0,0 +1,6 @@
1
+ export declare function priceDescriptionString({ unitName, showPriceAsMonthly, periodMonths, priceListHasFlatFeeCharges, }: {
2
+ unitName?: string;
3
+ showPriceAsMonthly?: boolean;
4
+ periodMonths?: number;
5
+ priceListHasFlatFeeCharges: boolean;
6
+ }): string;
@@ -0,0 +1,12 @@
1
+ import { PlanPricingStyles } from '@/graphql-codegen/exportedScalarTypes';
2
+ export declare function priceListPriceText({ priceList, }: {
3
+ priceList: {
4
+ plan: {
5
+ pricingStyle?: PlanPricingStyles;
6
+ };
7
+ currencyId?: string;
8
+ showPriceAsMonthly?: boolean;
9
+ monthlyBasePrice?: number;
10
+ basePrice?: number;
11
+ };
12
+ }): string | number;
@@ -1,5 +1,5 @@
1
- import { BillingPeriod, Plan, Product } from "@bunnyapp/common";
2
- export type PeriodMonths = 0 | 1 | 3 | 6 | 12;
3
- export declare const periodMonthsConverter: (period: PeriodMonths) => BillingPeriod;
1
+ import { Plan, Product } from '@bunnyapp/common';
2
+ import { BillingPeriod } from '@/graphql-codegen/exportedScalarTypes';
3
+ export declare const periodMonthsConverter: (period?: number) => "ONCE" | "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL";
4
4
  export declare const billingPeriodConverter: (period?: BillingPeriod) => 1 | 0 | 3 | 6 | 12;
5
5
  export declare const createAvailableBillingPeriods: (plans?: Plan[], selectedProduct?: Product) => (0 | 1 | 3 | 6 | 12)[] | undefined;