@bunnyapp/components 1.6.0-beta.13 → 1.6.0-beta.15

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 (66) hide show
  1. package/README.md +42 -0
  2. package/dist/cjs/index.js +2216 -2045
  3. package/dist/cjs/types/src/components/Checkout/Checkout.d.ts +1 -1
  4. package/dist/cjs/types/src/components/Checkout/QuoteCheckout.d.ts +4 -4
  5. package/dist/cjs/types/src/components/QuoteProvider/fragments/quoteFieldsFragment.d.ts +65 -0
  6. package/dist/cjs/types/src/components/QuoteProvider/fragments/quoteFragment.d.ts +16 -112
  7. package/dist/cjs/types/src/components/QuoteProvider/hooks/useFeatureQuantities.d.ts +12 -0
  8. package/dist/cjs/types/src/components/QuoteProvider/hooks/useQuoteQuantities.d.ts +0 -5
  9. package/dist/cjs/types/src/components/QuoteProvider/mutations/quoteChangeUpdate.d.ts +16 -0
  10. package/dist/cjs/types/src/components/QuoteProvider/utils/getQuantityFromQuoteChange.d.ts +11 -0
  11. package/dist/cjs/types/src/components/QuoteProvider/utils/quoteChangeCanBeEdited.d.ts +4 -0
  12. package/dist/cjs/types/src/components/Subscriptions/Subscriptions.d.ts +1 -1
  13. package/dist/cjs/types/src/components/Subscriptions/Upgrade/PlanPicker/PlanPicker.d.ts +1 -2
  14. package/dist/cjs/types/src/components/Subscriptions/Upgrade/PlanPicker/checkoutBar/PlanPickerCheckoutBar.d.ts +19 -0
  15. package/dist/cjs/types/src/components/Subscriptions/Upgrade/PlanPicker/planPickerDesktop/planManagerUtils.d.ts +5 -2
  16. package/dist/cjs/types/src/components/Subscriptions/quantityChangeDrawer/QuantityInput.d.ts +1 -1
  17. package/dist/cjs/types/src/components/Subscriptions/quantityChangeDrawer/utils/utils.d.ts +1 -1
  18. package/dist/cjs/types/src/components/Subscriptions/subscriptionsList/SubscriptionChargeTotal.d.ts +3 -3
  19. package/dist/cjs/types/src/components/Subscriptions/subscriptionsList/subscriptionCardHeader/components/SubscriptionCardActions.d.ts +21 -0
  20. package/dist/cjs/types/src/components/Subscriptions/subscriptionsList/subscriptionCardHeader/queries/getPriceListChangeOptions.d.ts +9 -0
  21. package/dist/cjs/types/src/components/Subscriptions/subscriptionsList/utils/filterSubscriptionCharges.d.ts +2 -0
  22. package/dist/cjs/types/src/components/Subscriptions/subscriptionsList/utils/sortSubscriptionCharges.d.ts +2 -0
  23. package/dist/cjs/types/src/components/priceListPricing/PricingTooltip.d.ts +1 -0
  24. package/dist/cjs/types/src/components/priceListPricing/utils/priceListChargeUtil.ts/getChargeBasePrice.d.ts +8 -0
  25. package/dist/cjs/types/src/graphql/queries/getPriceListChangeOptions.d.ts +3 -4
  26. package/dist/cjs/types/src/types/SubscriptionCharge.d.ts +39 -0
  27. package/dist/cjs/types/src/utils/QueryKeyFactory.d.ts +91 -0
  28. package/dist/cjs/types/src/utils/chargeUtils.d.ts +5 -2
  29. package/dist/esm/index.js +2378 -2207
  30. package/dist/esm/types/src/components/Checkout/Checkout.d.ts +1 -1
  31. package/dist/esm/types/src/components/Checkout/QuoteCheckout.d.ts +4 -4
  32. package/dist/esm/types/src/components/QuoteProvider/fragments/quoteFieldsFragment.d.ts +65 -0
  33. package/dist/esm/types/src/components/QuoteProvider/fragments/quoteFragment.d.ts +16 -112
  34. package/dist/esm/types/src/components/QuoteProvider/hooks/useFeatureQuantities.d.ts +12 -0
  35. package/dist/esm/types/src/components/QuoteProvider/hooks/useQuoteQuantities.d.ts +0 -5
  36. package/dist/esm/types/src/components/QuoteProvider/mutations/quoteChangeUpdate.d.ts +16 -0
  37. package/dist/esm/types/src/components/QuoteProvider/utils/getQuantityFromQuoteChange.d.ts +11 -0
  38. package/dist/esm/types/src/components/QuoteProvider/utils/quoteChangeCanBeEdited.d.ts +4 -0
  39. package/dist/esm/types/src/components/Subscriptions/Subscriptions.d.ts +1 -1
  40. package/dist/esm/types/src/components/Subscriptions/Upgrade/PlanPicker/PlanPicker.d.ts +1 -2
  41. package/dist/esm/types/src/components/Subscriptions/Upgrade/PlanPicker/checkoutBar/PlanPickerCheckoutBar.d.ts +19 -0
  42. package/dist/esm/types/src/components/Subscriptions/Upgrade/PlanPicker/planPickerDesktop/planManagerUtils.d.ts +5 -2
  43. package/dist/esm/types/src/components/Subscriptions/quantityChangeDrawer/QuantityInput.d.ts +1 -1
  44. package/dist/esm/types/src/components/Subscriptions/quantityChangeDrawer/utils/utils.d.ts +1 -1
  45. package/dist/esm/types/src/components/Subscriptions/subscriptionsList/SubscriptionChargeTotal.d.ts +3 -3
  46. package/dist/esm/types/src/components/Subscriptions/subscriptionsList/subscriptionCardHeader/components/SubscriptionCardActions.d.ts +21 -0
  47. package/dist/esm/types/src/components/Subscriptions/subscriptionsList/subscriptionCardHeader/queries/getPriceListChangeOptions.d.ts +9 -0
  48. package/dist/esm/types/src/components/Subscriptions/subscriptionsList/utils/filterSubscriptionCharges.d.ts +2 -0
  49. package/dist/esm/types/src/components/Subscriptions/subscriptionsList/utils/sortSubscriptionCharges.d.ts +2 -0
  50. package/dist/esm/types/src/components/priceListPricing/PricingTooltip.d.ts +1 -0
  51. package/dist/esm/types/src/components/priceListPricing/utils/priceListChargeUtil.ts/getChargeBasePrice.d.ts +8 -0
  52. package/dist/esm/types/src/graphql/queries/getPriceListChangeOptions.d.ts +3 -4
  53. package/dist/esm/types/src/types/SubscriptionCharge.d.ts +39 -0
  54. package/dist/esm/types/src/utils/QueryKeyFactory.d.ts +91 -0
  55. package/dist/esm/types/src/utils/chargeUtils.d.ts +5 -2
  56. package/package.json +1 -1
  57. package/dist/cjs/types/src/components/QuoteProvider/mutations/quoteChargeUpdate.d.ts +0 -23
  58. package/dist/cjs/types/src/components/Subscriptions/subscriptionsList/SubscriptionCardActions.d.ts +0 -9
  59. package/dist/cjs/types/src/graphql/queries/getFeatureUsage.d.ts +0 -7
  60. package/dist/cjs/types/src/hooks/usePriceListChangeOptions.d.ts +0 -9
  61. package/dist/esm/types/src/components/QuoteProvider/mutations/quoteChargeUpdate.d.ts +0 -23
  62. package/dist/esm/types/src/components/Subscriptions/subscriptionsList/SubscriptionCardActions.d.ts +0 -9
  63. package/dist/esm/types/src/graphql/queries/getFeatureUsage.d.ts +0 -7
  64. package/dist/esm/types/src/hooks/usePriceListChangeOptions.d.ts +0 -9
  65. /package/dist/cjs/types/src/components/Subscriptions/subscriptionsList/{SubscriptionCardHeader.d.ts → subscriptionCardHeader/SubscriptionCardHeader.d.ts} +0 -0
  66. /package/dist/esm/types/src/components/Subscriptions/subscriptionsList/{SubscriptionCardHeader.d.ts → subscriptionCardHeader/SubscriptionCardHeader.d.ts} +0 -0
@@ -20,7 +20,7 @@ type CheckoutProps = {
20
20
  onFail: (error: any) => void;
21
21
  onSuccess: () => void;
22
22
  open: boolean;
23
- quote?: FragmentOf<typeof Checkout_QuoteFragment>;
23
+ quote?: FragmentOf<typeof Checkout_QuoteFragment> | null;
24
24
  token?: string;
25
25
  isUpdatingQuote: boolean;
26
26
  };
@@ -9,7 +9,7 @@ export declare const QuoteCheckout_QuoteFragment: import("gql.tada").TadaDocumen
9
9
  quoteChanges: ({
10
10
  id: string | null;
11
11
  charges: {
12
- kind: "COUPON" | "SUBSCRIBE" | "UPDATE" | "RENEW" | "REINSTATE" | "UNSUBSCRIBE" | "ADJUSTMENT" | "DISCOUNT" | "CREDIT" | "PRICE_UPDATE" | "QUANTITY_UPDATE" | "FREE_PERIOD_DISCOUNT" | "ACTIVATE" | null;
12
+ kind: "SUBSCRIBE" | "UPDATE" | "RENEW" | "REINSTATE" | "UNSUBSCRIBE" | "ADJUSTMENT" | "COUPON" | "DISCOUNT" | "CREDIT" | "PRICE_UPDATE" | "QUANTITY_UPDATE" | "FREE_PERIOD_DISCOUNT" | "ACTIVATE" | null;
13
13
  coupon: {
14
14
  couponCode: string;
15
15
  } | null;
@@ -17,7 +17,7 @@ export declare const QuoteCheckout_QuoteFragment: import("gql.tada").TadaDocumen
17
17
  }[] & {
18
18
  currencyId: string;
19
19
  id: string | null;
20
- kind: "COUPON" | "SUBSCRIBE" | "UPDATE" | "RENEW" | "REINSTATE" | "UNSUBSCRIBE" | "ADJUSTMENT" | "DISCOUNT" | "CREDIT" | "PRICE_UPDATE" | "QUANTITY_UPDATE" | "FREE_PERIOD_DISCOUNT" | "ACTIVATE";
20
+ kind: "SUBSCRIBE" | "UPDATE" | "RENEW" | "REINSTATE" | "UNSUBSCRIBE" | "ADJUSTMENT" | "COUPON" | "DISCOUNT" | "CREDIT" | "PRICE_UPDATE" | "QUANTITY_UPDATE" | "FREE_PERIOD_DISCOUNT" | "ACTIVATE";
21
21
  charges: {
22
22
  subtotal: number | null;
23
23
  amountsByPeriod: {
@@ -42,7 +42,7 @@ export declare const QuoteCheckout_QuoteFragment: import("gql.tada").TadaDocumen
42
42
  couponCode: string;
43
43
  } | null;
44
44
  quantity: number | null;
45
- kind: "COUPON" | "SUBSCRIBE" | "UPDATE" | "RENEW" | "REINSTATE" | "UNSUBSCRIBE" | "ADJUSTMENT" | "DISCOUNT" | "CREDIT" | "PRICE_UPDATE" | "QUANTITY_UPDATE" | "FREE_PERIOD_DISCOUNT" | "ACTIVATE" | null;
45
+ kind: "SUBSCRIBE" | "UPDATE" | "RENEW" | "REINSTATE" | "UNSUBSCRIBE" | "ADJUSTMENT" | "COUPON" | "DISCOUNT" | "CREDIT" | "PRICE_UPDATE" | "QUANTITY_UPDATE" | "FREE_PERIOD_DISCOUNT" | "ACTIVATE" | null;
46
46
  }[];
47
47
  priceList: {
48
48
  id: string;
@@ -68,7 +68,7 @@ export declare const QuoteCheckout_QuoteFragment: import("gql.tada").TadaDocumen
68
68
  amount: number | null;
69
69
  startDate: unknown;
70
70
  }[];
71
- kind: "COUPON" | "SUBSCRIBE" | "UPDATE" | "RENEW" | "REINSTATE" | "UNSUBSCRIBE" | "ADJUSTMENT" | "DISCOUNT" | "CREDIT" | "PRICE_UPDATE" | "QUANTITY_UPDATE" | "FREE_PERIOD_DISCOUNT" | "ACTIVATE";
71
+ kind: "SUBSCRIBE" | "UPDATE" | "RENEW" | "REINSTATE" | "UNSUBSCRIBE" | "ADJUSTMENT" | "COUPON" | "DISCOUNT" | "CREDIT" | "PRICE_UPDATE" | "QUANTITY_UPDATE" | "FREE_PERIOD_DISCOUNT" | "ACTIVATE";
72
72
  }, {}, {
73
73
  fragment: "QuoteCheckout_QuoteFragment";
74
74
  on: "Quote";
@@ -0,0 +1,65 @@
1
+ export declare const QuoteFields_QuoteFragment: import("gql.tada").TadaDocumentNode<{
2
+ accountId: string;
3
+ amount: number;
4
+ amountDue: number | null;
5
+ smallUnitAmountDue: number | null;
6
+ currencyId: string;
7
+ id: string | null;
8
+ payableId: string | null;
9
+ periodAmount: number | null;
10
+ subtotal: number;
11
+ taxAmount: number;
12
+ startDate: unknown;
13
+ formattedQuote: {
14
+ html: string | null;
15
+ } | null;
16
+ amountsByPeriod: {
17
+ amount: number | null;
18
+ startDate: unknown;
19
+ }[];
20
+ kind: "SUBSCRIBE" | "UPDATE" | "RENEW" | "REINSTATE" | "UNSUBSCRIBE" | "ADJUSTMENT" | "COUPON" | "DISCOUNT" | "CREDIT" | "PRICE_UPDATE" | "QUANTITY_UPDATE" | "FREE_PERIOD_DISCOUNT" | "ACTIVATE";
21
+ quoteChanges: {
22
+ currencyId: string;
23
+ id: string | null;
24
+ kind: "SUBSCRIBE" | "UPDATE" | "RENEW" | "REINSTATE" | "UNSUBSCRIBE" | "ADJUSTMENT" | "COUPON" | "DISCOUNT" | "CREDIT" | "PRICE_UPDATE" | "QUANTITY_UPDATE" | "FREE_PERIOD_DISCOUNT" | "ACTIVATE";
25
+ charges: {
26
+ subtotal: number | null;
27
+ amountsByPeriod: {
28
+ amount: number | null;
29
+ startDate: unknown;
30
+ }[] | null;
31
+ amount: number | null;
32
+ billingPeriod: "ONCE" | "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL" | null;
33
+ currencyId: string;
34
+ feature: {
35
+ unitName: string | null;
36
+ } | null;
37
+ id: string | null;
38
+ name: string | null;
39
+ priceListCharge: {
40
+ id: string;
41
+ } | null;
42
+ priceList: {
43
+ id: string;
44
+ } | null;
45
+ coupon: {
46
+ couponCode: string;
47
+ } | null;
48
+ quantity: number | null;
49
+ kind: "SUBSCRIBE" | "UPDATE" | "RENEW" | "REINSTATE" | "UNSUBSCRIBE" | "ADJUSTMENT" | "COUPON" | "DISCOUNT" | "CREDIT" | "PRICE_UPDATE" | "QUANTITY_UPDATE" | "FREE_PERIOD_DISCOUNT" | "ACTIVATE" | null;
50
+ }[];
51
+ priceList: {
52
+ id: string;
53
+ plan: {
54
+ name: string;
55
+ } | null;
56
+ product: {
57
+ name: string;
58
+ } | null;
59
+ } | null;
60
+ }[] | null;
61
+ }, {}, {
62
+ fragment: "QuoteFields_QuoteFragment";
63
+ on: "Quote";
64
+ masked: false;
65
+ }>;
@@ -1,68 +1,3 @@
1
- export declare const QuoteFields_QuoteFragment: import("gql.tada").TadaDocumentNode<{
2
- accountId: string;
3
- amount: number;
4
- amountDue: number | null;
5
- smallUnitAmountDue: number | null;
6
- currencyId: string;
7
- id: string | null;
8
- payableId: string | null;
9
- periodAmount: number | null;
10
- subtotal: number;
11
- taxAmount: number;
12
- startDate: unknown;
13
- formattedQuote: {
14
- html: string | null;
15
- } | null;
16
- amountsByPeriod: {
17
- amount: number | null;
18
- startDate: unknown;
19
- }[];
20
- kind: "COUPON" | "SUBSCRIBE" | "UPDATE" | "RENEW" | "REINSTATE" | "UNSUBSCRIBE" | "ADJUSTMENT" | "DISCOUNT" | "CREDIT" | "PRICE_UPDATE" | "QUANTITY_UPDATE" | "FREE_PERIOD_DISCOUNT" | "ACTIVATE";
21
- quoteChanges: {
22
- currencyId: string;
23
- id: string | null;
24
- kind: "COUPON" | "SUBSCRIBE" | "UPDATE" | "RENEW" | "REINSTATE" | "UNSUBSCRIBE" | "ADJUSTMENT" | "DISCOUNT" | "CREDIT" | "PRICE_UPDATE" | "QUANTITY_UPDATE" | "FREE_PERIOD_DISCOUNT" | "ACTIVATE";
25
- charges: {
26
- subtotal: number | null;
27
- amountsByPeriod: {
28
- amount: number | null;
29
- startDate: unknown;
30
- }[] | null;
31
- amount: number | null;
32
- billingPeriod: "ONCE" | "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL" | null;
33
- currencyId: string;
34
- feature: {
35
- unitName: string | null;
36
- } | null;
37
- id: string | null;
38
- name: string | null;
39
- priceListCharge: {
40
- id: string;
41
- } | null;
42
- priceList: {
43
- id: string;
44
- } | null;
45
- coupon: {
46
- couponCode: string;
47
- } | null;
48
- quantity: number | null;
49
- kind: "COUPON" | "SUBSCRIBE" | "UPDATE" | "RENEW" | "REINSTATE" | "UNSUBSCRIBE" | "ADJUSTMENT" | "DISCOUNT" | "CREDIT" | "PRICE_UPDATE" | "QUANTITY_UPDATE" | "FREE_PERIOD_DISCOUNT" | "ACTIVATE" | null;
50
- }[];
51
- priceList: {
52
- id: string;
53
- plan: {
54
- name: string;
55
- } | null;
56
- product: {
57
- name: string;
58
- } | null;
59
- } | null;
60
- }[] | null;
61
- }, {}, {
62
- fragment: "QuoteFields_QuoteFragment";
63
- on: "Quote";
64
- masked: false;
65
- }>;
66
1
  /**
67
2
  * Central quote fragment for QuoteProvider context.
68
3
  *
@@ -76,65 +11,34 @@ export declare const QuoteFields_QuoteFragment: import("gql.tada").TadaDocumentN
76
11
  * - Type safety ensures all required fields are fetched
77
12
  */
78
13
  export declare const QuoteContext_QuoteFragment: import("gql.tada").TadaDocumentNode<{
79
- accountId: string;
80
- amount: number;
81
- amountDue: number | null;
82
- smallUnitAmountDue: number | null;
83
- currencyId: string;
84
14
  id: string | null;
85
- payableId: string | null;
86
- periodAmount: number | null;
87
- subtotal: number;
88
- taxAmount: number;
89
- startDate: unknown;
90
- formattedQuote: {
91
- html: string | null;
92
- } | null;
93
- amountsByPeriod: {
94
- amount: number | null;
95
- startDate: unknown;
96
- }[];
97
- kind: "COUPON" | "SUBSCRIBE" | "UPDATE" | "RENEW" | "REINSTATE" | "UNSUBSCRIBE" | "ADJUSTMENT" | "DISCOUNT" | "CREDIT" | "PRICE_UPDATE" | "QUANTITY_UPDATE" | "FREE_PERIOD_DISCOUNT" | "ACTIVATE";
15
+ currencyId: string;
16
+ amountDue: number | null;
98
17
  quoteChanges: {
99
- currencyId: string;
100
18
  id: string | null;
101
- kind: "COUPON" | "SUBSCRIBE" | "UPDATE" | "RENEW" | "REINSTATE" | "UNSUBSCRIBE" | "ADJUSTMENT" | "DISCOUNT" | "CREDIT" | "PRICE_UPDATE" | "QUANTITY_UPDATE" | "FREE_PERIOD_DISCOUNT" | "ACTIVATE";
19
+ kind: "SUBSCRIBE" | "UPDATE" | "RENEW" | "REINSTATE" | "UNSUBSCRIBE" | "ADJUSTMENT" | "COUPON" | "DISCOUNT" | "CREDIT" | "PRICE_UPDATE" | "QUANTITY_UPDATE" | "FREE_PERIOD_DISCOUNT" | "ACTIVATE";
20
+ priceList: {
21
+ id: string;
22
+ } | null;
102
23
  charges: {
103
- subtotal: number | null;
104
- amountsByPeriod: {
105
- amount: number | null;
106
- startDate: unknown;
107
- }[] | null;
108
- amount: number | null;
109
- billingPeriod: "ONCE" | "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL" | null;
110
- currencyId: string;
111
- feature: {
112
- unitName: string | null;
113
- } | null;
114
- id: string | null;
115
- name: string | null;
116
24
  priceListCharge: {
117
25
  id: string;
26
+ chargeType: "ONE_TIME" | "RECURRING" | "USAGE" | null;
27
+ pricingModel: "FLAT" | "TIERED" | "VOLUME" | "BANDS" | null;
28
+ quantityMin: number | null;
29
+ quantityMax: number | null;
30
+ selfServiceQuantity: boolean | null;
118
31
  } | null;
119
- priceList: {
32
+ feature: {
120
33
  id: string;
121
34
  } | null;
122
- coupon: {
123
- couponCode: string;
124
- } | null;
125
35
  quantity: number | null;
126
- kind: "COUPON" | "SUBSCRIBE" | "UPDATE" | "RENEW" | "REINSTATE" | "UNSUBSCRIBE" | "ADJUSTMENT" | "DISCOUNT" | "CREDIT" | "PRICE_UPDATE" | "QUANTITY_UPDATE" | "FREE_PERIOD_DISCOUNT" | "ACTIVATE" | null;
36
+ id: string | null;
127
37
  }[];
128
- priceList: {
129
- id: string;
130
- plan: {
131
- name: string;
132
- } | null;
133
- product: {
134
- name: string;
135
- } | null;
136
- } | null;
137
38
  }[] | null;
39
+ [$tada.fragmentRefs]: {
40
+ PlanPickerCheckoutBar_QuoteFragment: "Quote";
41
+ };
138
42
  }, {}, {
139
43
  fragment: "QuoteContext_QuoteFragment";
140
44
  on: "Quote";
@@ -0,0 +1,12 @@
1
+ export type FeatureQuantitiesDict = Record<string, number | undefined>;
2
+ /**
3
+ * Hook to manage feature quantities using a dictionary keyed by feature ID
4
+ * This tracks quantities for each unique feature.
5
+ */
6
+ export declare function useFeatureQuantities({ onFeatureQuantitiesChanged, }: {
7
+ onFeatureQuantitiesChanged?: (featureQuantities: FeatureQuantitiesDict) => void;
8
+ }): {
9
+ featureQuantities: FeatureQuantitiesDict;
10
+ getFeatureQuantity: (featureId: string, featureQuantities: FeatureQuantitiesDict) => number | undefined;
11
+ onUpdateFeatureQuantity: (featureId: string, quantity: number) => void;
12
+ };
@@ -9,8 +9,3 @@ export declare const useQuoteQuantities: ({ selectedPriceList, quote, }: {
9
9
  getFeatureQuantity: (featureId: string) => number | undefined;
10
10
  isUpdatingCharges: boolean;
11
11
  };
12
- /**
13
- * Hook to manage feature quantities using a dictionary keyed by feature ID
14
- * This tracks quantities for each unique feature.
15
- */
16
- export type FeatureQuantitiesDict = Record<string, number | undefined>;
@@ -0,0 +1,16 @@
1
+ declare const quoteChangeUpdate: ({ quoteChangeId, charges, apiHost, token, }: {
2
+ quoteChangeId: string;
3
+ charges: {
4
+ id: string;
5
+ quantity: number;
6
+ }[];
7
+ apiHost: string;
8
+ token: string;
9
+ }) => Promise<{
10
+ quote: {
11
+ [$tada.fragmentRefs]: {
12
+ QuoteContext_QuoteFragment: "Quote";
13
+ };
14
+ };
15
+ } | null | undefined>;
16
+ export default quoteChangeUpdate;
@@ -0,0 +1,11 @@
1
+ export declare function getQuantityFromQuoteChange(quoteChange: {
2
+ priceList: {
3
+ id: string;
4
+ } | null;
5
+ charges: {
6
+ feature: {
7
+ id: string;
8
+ } | null;
9
+ quantity: number | null;
10
+ }[];
11
+ } | null, featureId: string): number | null | undefined;
@@ -0,0 +1,4 @@
1
+ import { QuoteChangeKind } from '@/graphql-codegen/exportedScalarTypes';
2
+ export declare function isQuoteChangeEditable(quoteChange: {
3
+ kind: QuoteChangeKind;
4
+ }): boolean;
@@ -1,5 +1,5 @@
1
1
  export declare const Subscriptions_SubscriptionFragment: import("gql.tada").TadaDocumentNode<{
2
- state: "ACTIVE" | "TRIAL" | "CANCELED" | "EXPIRED" | "TRIAL_EXPIRED" | "PENDING";
2
+ state: "ACTIVE" | "TRIAL" | "PENDING" | "EXPIRED" | "CANCELED" | "TRIAL_EXPIRED";
3
3
  }, {}, {
4
4
  fragment: "Subscriptions_SubscriptionFragment";
5
5
  on: "Subscription";
@@ -1,6 +1,5 @@
1
1
  import { Subscription } from '@bunnyapp/common';
2
- declare const PlanPicker: ({ upgradingSubscription, onGoBack, areSubscriptionsLoading, subscriptions, }: {
3
- upgradingSubscription?: Subscription;
2
+ declare const PlanPicker: ({ onGoBack, areSubscriptionsLoading, subscriptions, }: {
4
3
  onGoBack?: () => void;
5
4
  areSubscriptionsLoading: boolean;
6
5
  subscriptions: Subscription[];
@@ -1,4 +1,23 @@
1
1
  import { PriceList } from '@bunnyapp/common';
2
+ export declare const PlanPickerCheckoutBar_QuoteFragment: import("gql.tada").TadaDocumentNode<{
3
+ [$tada.fragmentRefs]: {
4
+ Checkout_QuoteFragment: "Quote";
5
+ };
6
+ quoteChanges: {
7
+ priceList: {
8
+ id: string;
9
+ } | null;
10
+ charges: {
11
+ priceListCharge: {
12
+ id: string;
13
+ } | null;
14
+ }[];
15
+ }[] | null;
16
+ }, {}, {
17
+ fragment: "PlanPickerCheckoutBar_QuoteFragment";
18
+ on: "Quote";
19
+ masked: true;
20
+ }>;
2
21
  declare const PlanPickerCheckoutBar: ({ selectedPriceList, handlePortalErrors, onCheckoutSuccess, }: {
3
22
  selectedPriceList: PriceList;
4
23
  handlePortalErrors?: (errors: any) => void;
@@ -1,2 +1,5 @@
1
- import { PriceListCharge } from '@bunnyapp/common';
2
- export declare const calculateNewQuantity: (priceListCharge: PriceListCharge, currentQuantity?: number) => number;
1
+ export declare const calculateNewQuantity: (priceListCharge: {
2
+ quantityMax: number | null;
3
+ quantityMin: number | null;
4
+ selfServiceQuantity: boolean | null;
5
+ }, currentQuantity?: number) => number;
@@ -12,7 +12,7 @@ export declare const QuantityInput_SubscriptionChargeFragment: import("gql.tada"
12
12
  }>;
13
13
  export declare const QuantityInput_SubscriptionFragment: import("gql.tada").TadaDocumentNode<{
14
14
  id: string;
15
- state: "ACTIVE" | "TRIAL" | "CANCELED" | "EXPIRED" | "TRIAL_EXPIRED" | "PENDING";
15
+ state: "ACTIVE" | "TRIAL" | "PENDING" | "EXPIRED" | "CANCELED" | "TRIAL_EXPIRED";
16
16
  priceList: {
17
17
  id: string;
18
18
  } | null;
@@ -11,7 +11,7 @@ export declare const CanShowQuantitiesInput_SubscriptionChargeFragment: import("
11
11
  }>;
12
12
  export declare const CanShowQuantitiesInput_SubscriptionFragment: import("gql.tada").TadaDocumentNode<{
13
13
  id: string;
14
- state: "ACTIVE" | "TRIAL" | "CANCELED" | "EXPIRED" | "TRIAL_EXPIRED" | "PENDING";
14
+ state: "ACTIVE" | "TRIAL" | "PENDING" | "EXPIRED" | "CANCELED" | "TRIAL_EXPIRED";
15
15
  priceList: {
16
16
  id: string;
17
17
  } | null;
@@ -1,6 +1,6 @@
1
- import { Subscription, SubscriptionCharge } from '@bunnyapp/common';
2
- declare const SubscriptionChargeTotal: ({ charge, subscription, }: {
1
+ import { SubscriptionCharge } from '@bunnyapp/common';
2
+ declare const SubscriptionChargeTotal: ({ charge, currencyId, }: {
3
3
  charge: SubscriptionCharge;
4
- subscription: Subscription;
4
+ currencyId: string;
5
5
  }) => import("react/jsx-runtime").JSX.Element;
6
6
  export default SubscriptionChargeTotal;
@@ -0,0 +1,21 @@
1
+ import { Subscription } from '@bunnyapp/common';
2
+ import { FragmentOf } from 'gql.tada';
3
+ export declare const SubscriptionCardActions_PriceListChangeOptionsFragment: import("gql.tada").TadaDocumentNode<{
4
+ priceLists: {
5
+ id: string;
6
+ product: {
7
+ id: string;
8
+ } | null;
9
+ }[] | null;
10
+ }, {}, {
11
+ fragment: "SubscriptionCardActions_PriceListChangeOptionsFragment";
12
+ on: "PriceListChangeOptions";
13
+ masked: true;
14
+ }>;
15
+ export declare const SubscriptionCardActions: ({ onChangePlanClick, onCancelSubscriptionClick, priceListChangeOptions: maskedPriceListChangeOptions, subscription, isPaymentMethodLoading, }: {
16
+ onChangePlanClick?: (subscription: Subscription) => void;
17
+ onCancelSubscriptionClick?: (subscription: Subscription) => void;
18
+ priceListChangeOptions?: FragmentOf<typeof SubscriptionCardActions_PriceListChangeOptionsFragment>;
19
+ subscription: Subscription;
20
+ isPaymentMethodLoading: boolean;
21
+ }) => import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,9 @@
1
+ export declare const getPriceListChangeOptions: ({ apiHost, productId, token, }: {
2
+ apiHost: string;
3
+ productId: string;
4
+ token?: string;
5
+ }) => Promise<{
6
+ [$tada.fragmentRefs]: {
7
+ SubscriptionCardActions_PriceListChangeOptionsFragment: "PriceListChangeOptions";
8
+ };
9
+ }>;
@@ -0,0 +1,2 @@
1
+ import { SubscriptionCharge } from '../../../../types/SubscriptionCharge';
2
+ export declare const filterSubscriptionCharges: (charges: SubscriptionCharge[]) => SubscriptionCharge[];
@@ -0,0 +1,2 @@
1
+ import { SubscriptionCharge } from '../../../../types/SubscriptionCharge';
2
+ export declare const sortSubscriptionCharges: (charges: SubscriptionCharge[]) => SubscriptionCharge[];
@@ -10,6 +10,7 @@ export declare const PricingTooltip_PriceListChargeFragment: import("gql.tada").
10
10
  unitName: string | null;
11
11
  } | null;
12
12
  priceDecimals: number | null;
13
+ basePrice: number;
13
14
  name: string;
14
15
  [$tada.fragmentRefs]: {
15
16
  ChargePriceTiers_PriceListChargeFragment: "PriceListCharge";
@@ -0,0 +1,8 @@
1
+ export declare const getChargeBasePrice: (charge: {
2
+ priceListChargeTiers: {
3
+ starts: number | null;
4
+ price: number | null;
5
+ }[] | null;
6
+ priceDecimals: number | null;
7
+ basePrice: number;
8
+ }, currencyId: string) => string | number;
@@ -1,9 +1,8 @@
1
- import { PriceListChangeOptions, Subscription } from '@bunnyapp/common';
2
- declare const getPriceListChangeOptions: ({ apiHost, isInPreviewMode, productId, token, upgradingSubscription, }: {
1
+ import { PriceListChangeOptions } from '@bunnyapp/common';
2
+ declare const getPriceListChangeOptions: ({ apiHost, isInPreviewMode, token, subscriptionId, }: {
3
3
  apiHost: string;
4
4
  isInPreviewMode?: boolean;
5
- productId?: string;
6
5
  token?: string;
7
- upgradingSubscription?: Subscription;
6
+ subscriptionId?: string;
8
7
  }) => Promise<PriceListChangeOptions>;
9
8
  export default getPriceListChangeOptions;
@@ -0,0 +1,39 @@
1
+ import { Account, BillingPeriod, ChargeType, Currency, Feature, FeatureUsage, PriceList, PriceListCharge, PriceTier, PricingModel, QuoteChangeKind } from '@bunnyapp/common';
2
+ export type SubscriptionCharge = {
3
+ account: Account;
4
+ amount: number;
5
+ billingPeriod: BillingPeriod;
6
+ chargeType: ChargeType;
7
+ createdAt: string;
8
+ currency: Currency;
9
+ discount?: number;
10
+ discountedPrice: string;
11
+ endDate: string;
12
+ expired: boolean;
13
+ feature?: Feature;
14
+ id: string;
15
+ invoiceLineText: string;
16
+ isAmendment: boolean;
17
+ isRamp?: boolean;
18
+ kind: QuoteChangeKind;
19
+ name: string;
20
+ periodPrice: number;
21
+ price: string;
22
+ priceDecimals: number;
23
+ priceList: PriceList;
24
+ priceListCharge?: PriceListCharge;
25
+ priceListChargeId: string;
26
+ priceListId: string;
27
+ priceTiers: PriceTier[];
28
+ pricingModel: PricingModel;
29
+ prorationRate?: number;
30
+ quantity: number;
31
+ quantityMax?: number;
32
+ quantityMin?: number;
33
+ selfServiceQuantity?: boolean;
34
+ startDate: string;
35
+ tieredAveragePrice?: number;
36
+ trial: boolean;
37
+ updatedAt: string;
38
+ histogram?: FeatureUsage;
39
+ };
@@ -0,0 +1,91 @@
1
+ export declare const CHILD_SEARCH_CACHE_KEY = "childSearch";
2
+ export declare const SEARCH_CACHE_KEY = "search";
3
+ interface AccountPaymentMethodKeyParams {
4
+ accountId?: string;
5
+ entityId?: string;
6
+ token?: string;
7
+ }
8
+ interface BillingDetailsKeyParams {
9
+ entityId?: string;
10
+ token?: string;
11
+ }
12
+ interface CalculatedPricesKeyParams {
13
+ priceListId?: string;
14
+ quantity?: number;
15
+ token?: string;
16
+ }
17
+ interface EventsKeyParams {
18
+ entityId: string;
19
+ pluralType: string;
20
+ token?: string;
21
+ }
22
+ interface ObjectKeyParams {
23
+ id?: string;
24
+ objectName: string;
25
+ token?: string;
26
+ }
27
+ interface TableKeyParams {
28
+ filterString?: string;
29
+ pluralType: string;
30
+ token?: string;
31
+ }
32
+ interface FormattedInvoiceKeyParams {
33
+ id?: string;
34
+ token?: string;
35
+ }
36
+ interface InvoiceKeyParams {
37
+ id?: string;
38
+ token?: string;
39
+ }
40
+ interface PlanChangeOptionsKeyParams {
41
+ subscriptionId?: string | null;
42
+ productId?: string | null;
43
+ token?: string;
44
+ }
45
+ interface PortalPreviewDataKeyParams {
46
+ productId?: string | null;
47
+ token?: string;
48
+ }
49
+ interface QuoteKeyParams {
50
+ id?: string;
51
+ token?: string;
52
+ }
53
+ interface QuoteTaxCalculateKeyParams {
54
+ id?: string;
55
+ token?: string;
56
+ }
57
+ interface TaxationRequiredAccountFieldsKeyParams {
58
+ entityId?: string;
59
+ token?: string;
60
+ }
61
+ interface TransactionsKeyParams {
62
+ filter?: string;
63
+ token?: string;
64
+ }
65
+ declare const QueryKeyFactory: {
66
+ accountPaymentMethodsKey: ({ accountId, entityId, token }: AccountPaymentMethodKeyParams) => string[];
67
+ billingDetailsKey: ({ entityId, token }: BillingDetailsKeyParams) => string[];
68
+ brandingKey: (token?: string) => string[];
69
+ calculatedPricesKey: ({ priceListId, quantity, token }: CalculatedPricesKeyParams) => (string | number)[];
70
+ createEventsKey: ({ entityId, pluralType, token }: EventsKeyParams) => string[];
71
+ createFormattedInvoiceKey: ({ id, token }: FormattedInvoiceKeyParams) => (string | undefined)[];
72
+ createInvoiceKey: ({ id, token }: InvoiceKeyParams) => (string | undefined)[];
73
+ createObjectKey: ({ id, objectName, token }: ObjectKeyParams) => string[];
74
+ createQuoteKey: ({ id, token }: QuoteKeyParams) => (string | undefined)[];
75
+ createQuoteTaxCalculateKey: ({ id, token }: QuoteTaxCalculateKeyParams) => string[];
76
+ createTableKey: ({ filterString, pluralType, token }: TableKeyParams) => (string | undefined)[];
77
+ currentUserKey: (token?: string) => string[];
78
+ editingQuoteKey: (token?: string) => string[];
79
+ finixAchKey: (token?: string) => string[];
80
+ finixKey: (token?: string) => string[];
81
+ planChangeOptionsKey: ({ subscriptionId, productId, token }: PlanChangeOptionsKeyParams) => string[];
82
+ pluginsKey: (token?: string) => string[];
83
+ portalPreviewDataKey: ({ productId, token }: PortalPreviewDataKeyParams) => string[];
84
+ taxationRequiredAccountFieldsKey: ({ entityId, token, }: TaxationRequiredAccountFieldsKeyParams) => string[];
85
+ transactionsKey: ({ filter, token }: TransactionsKeyParams) => string[];
86
+ availableAddonPlansKey: ({ priceListId, token, }: {
87
+ priceListId: string | undefined;
88
+ token?: string;
89
+ }) => (string | undefined)[];
90
+ };
91
+ export default QueryKeyFactory;
@@ -1,2 +1,5 @@
1
- import { PriceListCharge } from '@bunnyapp/common';
2
- export declare function canEditChargeQuantity(charge: PriceListCharge): boolean;
1
+ import { ChargeType, PricingModel } from '@/graphql-codegen/exportedScalarTypes';
2
+ export declare function canEditChargeQuantity(charge: {
3
+ chargeType: ChargeType | null;
4
+ pricingModel: PricingModel | null;
5
+ } | null): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bunnyapp/components",
3
- "version": "1.6.0-beta.13",
3
+ "version": "1.6.0-beta.15",
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",
@@ -1,23 +0,0 @@
1
- declare const quoteChargeUpdate: ({ discount, name, price, quantity, quoteChargeId, startDate, subtotal, apiHost, token, }: {
2
- discount?: number;
3
- name?: string;
4
- price?: number;
5
- quantity?: number;
6
- quoteChargeId: string;
7
- startDate?: string;
8
- subtotal?: number;
9
- apiHost: string;
10
- token: string;
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>;
23
- export default quoteChargeUpdate;