@bunnyapp/components 1.6.0-beta.1 → 1.6.0-beta.11

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 (132) hide show
  1. package/README.md +71 -0
  2. package/dist/cjs/index.js +2811 -2381
  3. package/dist/cjs/types/src/components/Checkout/Checkout.d.ts +18 -3
  4. package/dist/cjs/types/src/components/Checkout/QuoteCheckout.d.ts +77 -3
  5. package/dist/cjs/types/src/components/Checkout/checkoutUtils.d.ts +4 -2
  6. package/dist/cjs/types/src/components/FeatureUsageGraph.d.ts +4 -3
  7. package/dist/cjs/types/src/components/QuoteProvider/QuoteProvider.d.ts +4 -0
  8. package/dist/cjs/types/src/components/{QuoteProvider.d.ts → QuoteProvider/context/QuoteContext.d.ts} +4 -6
  9. package/dist/cjs/types/src/components/QuoteProvider/fragments/quoteFragment.d.ts +142 -0
  10. package/dist/cjs/types/src/components/QuoteProvider/hooks/useQuoteCreate.d.ts +19 -0
  11. package/dist/{esm/types/src/hooks/quotes → cjs/types/src/components/QuoteProvider/hooks}/useQuoteQuantities.d.ts +4 -2
  12. package/dist/cjs/types/src/{graphql → components/QuoteProvider}/mutations/quoteChargeUpdate.d.ts +12 -2
  13. package/dist/cjs/types/src/components/QuoteProvider/queries/getQuote.d.ts +16 -0
  14. package/dist/cjs/types/src/components/Subscriptions/Upgrade/PlanPicker/PriceListGrid.d.ts +2 -1
  15. package/dist/cjs/types/src/components/Subscriptions/Upgrade/PlanPicker/checkoutBar/CheckoutBarInput.d.ts +2 -2
  16. package/dist/cjs/types/src/components/Subscriptions/Upgrade/PlanPicker/planPickerDesktop/BillingPeriodSelector.d.ts +3 -2
  17. package/dist/cjs/types/src/components/Subscriptions/Upgrade/PlanPicker/planPickerDesktop/PlanAddonsCard.d.ts +2 -1
  18. package/dist/cjs/types/src/components/Subscriptions/Upgrade/PlanPicker/planPickerDesktop/PriceListGridDesktop.d.ts +3 -2
  19. package/dist/cjs/types/src/components/Subscriptions/Upgrade/PlanPicker/planPickerDesktop/util.d.ts +1 -1
  20. package/dist/cjs/types/src/components/Subscriptions/Upgrade/PlanPicker/priceListCard/PriceDescription/PriceListCardPriceDescription.d.ts +6 -0
  21. package/dist/cjs/types/src/components/Subscriptions/Upgrade/PlanPicker/priceListCard/PriceDescription/utils/hasMultipleRecurringCharges.d.ts +2 -0
  22. package/dist/cjs/types/src/components/Subscriptions/quantityChangeDrawer/QuantityChangeGridRow.d.ts +2 -3
  23. package/dist/{esm/types/src/components/Subscriptions/QuantityDrawerContainer.d.ts → cjs/types/src/components/Subscriptions/quantityChangeDrawer/QuantityDrawer.d.ts} +4 -4
  24. package/dist/cjs/types/src/components/Subscriptions/quantityChangeDrawer/QuantityInput.d.ts +3 -11
  25. package/dist/cjs/types/src/components/Subscriptions/quantityChangeDrawer/fragments/QuantityDrawerQuoteFragment.d.ts +10 -0
  26. package/dist/cjs/types/src/components/Subscriptions/quantityChangeDrawer/hooks/useQuoteQueryData.d.ts +3 -0
  27. package/dist/cjs/types/src/components/Subscriptions/quantityChangeDrawer/hooks/useSetQuoteQueryData.d.ts +5 -0
  28. package/dist/cjs/types/src/components/Subscriptions/quantityChangeDrawer/quantityChangeDrawerDesktop/QuantityChangeDrawerDesktop.d.ts +0 -2
  29. package/dist/cjs/types/src/components/Subscriptions/quantityChangeDrawer/queries/quoteChargeCreate.d.ts +23 -0
  30. package/dist/cjs/types/src/components/Subscriptions/quantityChangeDrawer/queries/quoteChargeUpdate.d.ts +12 -0
  31. package/dist/cjs/types/src/components/Subscriptions/quantityChangeDrawer/queries/quoteSubscriptionUpdate.d.ts +22 -0
  32. package/dist/cjs/types/src/components/Subscriptions/quantityChangeDrawer/utils/formatDateForApi.d.ts +2 -0
  33. package/dist/cjs/types/src/components/Subscriptions/quantityChangeDrawer/{utils.d.ts → utils/utils.d.ts} +0 -9
  34. package/dist/cjs/types/src/components/Subscriptions/subscriptionsList/SubscriptionsNavigation.d.ts +1 -1
  35. package/dist/cjs/types/src/components/Subscriptions/subscriptionsList/subscriptionUtils.d.ts +0 -2
  36. package/dist/cjs/types/src/components/Subscriptions/tieredDisplayDropdown/TieredDisplayDropdown.d.ts +9 -0
  37. package/dist/cjs/types/src/components/Subscriptions/tieredDisplayDropdown/util.d.ts +9 -0
  38. package/dist/cjs/types/src/components/TaxationForm.d.ts +3 -3
  39. package/dist/cjs/types/src/components/priceListPricing/PricingTooltip.d.ts +40 -0
  40. package/dist/cjs/types/src/components/priceListPricing/components/ChargePriceTiers.d.ts +23 -0
  41. package/dist/cjs/types/src/components/priceListPricing/components/PriceTierPrice.d.ts +7 -0
  42. package/dist/cjs/types/src/components/priceListPricing/components/PriceTierRow.d.ts +13 -0
  43. package/dist/cjs/types/src/components/priceListPricing/misc/consts.d.ts +1 -0
  44. package/dist/cjs/types/src/components/priceListPricing/types/PriceTier.d.ts +4 -0
  45. package/dist/cjs/types/src/components/priceListPricing/utils/getPricingModelDescription.d.ts +2 -0
  46. package/dist/cjs/types/src/components/priceListPricing/utils/getPricingModelTitle.d.ts +2 -0
  47. package/dist/cjs/types/src/components/priceListPricing/utils/hasPriceTiers.d.ts +9 -0
  48. package/dist/cjs/types/src/components/priceListPricing/utils/priceListChargeUtil.ts/getFirstTierPrice.d.ts +7 -0
  49. package/dist/cjs/types/src/enums/SubscriptionState.d.ts +9 -0
  50. package/dist/cjs/types/src/graphql/QuoteRequests.d.ts +0 -5
  51. package/dist/cjs/types/src/graphql/mutations/quoteChargeDelete.d.ts +11 -2
  52. package/dist/cjs/types/src/graphql/queries/getQuote.d.ts +29 -2
  53. package/dist/cjs/types/src/graphql-codegen/exportedScalarTypes.d.ts +6 -0
  54. package/dist/cjs/types/src/index.d.ts +2 -2
  55. package/dist/cjs/types/src/utils/addonPlanUtils.d.ts +2 -1
  56. package/dist/cjs/types/src/utils/featureAddonUtils.d.ts +16 -1
  57. package/dist/cjs/types/src/utils/formatCurrency.d.ts +1 -0
  58. package/dist/cjs/types/src/utils/priceListUtils/doesPriceListHaveFlatFeeCharges.d.ts +7 -0
  59. package/dist/cjs/types/src/utils/priceListUtils/getPrice.d.ts +5 -0
  60. package/dist/cjs/types/src/utils/priceListUtils/priceDescription.d.ts +6 -0
  61. package/dist/cjs/types/src/utils/priceListUtils/priceListPriceText.d.ts +12 -0
  62. package/dist/cjs/types/src/utils/pricePickerUtils.d.ts +3 -3
  63. package/dist/esm/index.js +2849 -2419
  64. package/dist/esm/types/src/components/Checkout/Checkout.d.ts +18 -3
  65. package/dist/esm/types/src/components/Checkout/QuoteCheckout.d.ts +77 -3
  66. package/dist/esm/types/src/components/Checkout/checkoutUtils.d.ts +4 -2
  67. package/dist/esm/types/src/components/FeatureUsageGraph.d.ts +4 -3
  68. package/dist/esm/types/src/components/QuoteProvider/QuoteProvider.d.ts +4 -0
  69. package/dist/esm/types/src/components/{QuoteProvider.d.ts → QuoteProvider/context/QuoteContext.d.ts} +4 -6
  70. package/dist/esm/types/src/components/QuoteProvider/fragments/quoteFragment.d.ts +142 -0
  71. package/dist/esm/types/src/components/QuoteProvider/hooks/useQuoteCreate.d.ts +19 -0
  72. package/dist/{cjs/types/src/hooks/quotes → esm/types/src/components/QuoteProvider/hooks}/useQuoteQuantities.d.ts +4 -2
  73. package/dist/esm/types/src/{graphql → components/QuoteProvider}/mutations/quoteChargeUpdate.d.ts +12 -2
  74. package/dist/esm/types/src/components/QuoteProvider/queries/getQuote.d.ts +16 -0
  75. package/dist/esm/types/src/components/Subscriptions/Upgrade/PlanPicker/PriceListGrid.d.ts +2 -1
  76. package/dist/esm/types/src/components/Subscriptions/Upgrade/PlanPicker/checkoutBar/CheckoutBarInput.d.ts +2 -2
  77. package/dist/esm/types/src/components/Subscriptions/Upgrade/PlanPicker/planPickerDesktop/BillingPeriodSelector.d.ts +3 -2
  78. package/dist/esm/types/src/components/Subscriptions/Upgrade/PlanPicker/planPickerDesktop/PlanAddonsCard.d.ts +2 -1
  79. package/dist/esm/types/src/components/Subscriptions/Upgrade/PlanPicker/planPickerDesktop/PriceListGridDesktop.d.ts +3 -2
  80. package/dist/esm/types/src/components/Subscriptions/Upgrade/PlanPicker/planPickerDesktop/util.d.ts +1 -1
  81. package/dist/esm/types/src/components/Subscriptions/Upgrade/PlanPicker/priceListCard/PriceDescription/PriceListCardPriceDescription.d.ts +6 -0
  82. package/dist/esm/types/src/components/Subscriptions/Upgrade/PlanPicker/priceListCard/PriceDescription/utils/hasMultipleRecurringCharges.d.ts +2 -0
  83. package/dist/esm/types/src/components/Subscriptions/quantityChangeDrawer/QuantityChangeGridRow.d.ts +2 -3
  84. package/dist/{cjs/types/src/components/Subscriptions/QuantityDrawerContainer.d.ts → esm/types/src/components/Subscriptions/quantityChangeDrawer/QuantityDrawer.d.ts} +4 -4
  85. package/dist/esm/types/src/components/Subscriptions/quantityChangeDrawer/QuantityInput.d.ts +3 -11
  86. package/dist/esm/types/src/components/Subscriptions/quantityChangeDrawer/fragments/QuantityDrawerQuoteFragment.d.ts +10 -0
  87. package/dist/esm/types/src/components/Subscriptions/quantityChangeDrawer/hooks/useQuoteQueryData.d.ts +3 -0
  88. package/dist/esm/types/src/components/Subscriptions/quantityChangeDrawer/hooks/useSetQuoteQueryData.d.ts +5 -0
  89. package/dist/esm/types/src/components/Subscriptions/quantityChangeDrawer/quantityChangeDrawerDesktop/QuantityChangeDrawerDesktop.d.ts +0 -2
  90. package/dist/esm/types/src/components/Subscriptions/quantityChangeDrawer/queries/quoteChargeCreate.d.ts +23 -0
  91. package/dist/esm/types/src/components/Subscriptions/quantityChangeDrawer/queries/quoteChargeUpdate.d.ts +12 -0
  92. package/dist/esm/types/src/components/Subscriptions/quantityChangeDrawer/queries/quoteSubscriptionUpdate.d.ts +22 -0
  93. package/dist/esm/types/src/components/Subscriptions/quantityChangeDrawer/utils/formatDateForApi.d.ts +2 -0
  94. package/dist/esm/types/src/components/Subscriptions/quantityChangeDrawer/{utils.d.ts → utils/utils.d.ts} +0 -9
  95. package/dist/esm/types/src/components/Subscriptions/subscriptionsList/SubscriptionsNavigation.d.ts +1 -1
  96. package/dist/esm/types/src/components/Subscriptions/subscriptionsList/subscriptionUtils.d.ts +0 -2
  97. package/dist/esm/types/src/components/Subscriptions/tieredDisplayDropdown/TieredDisplayDropdown.d.ts +9 -0
  98. package/dist/esm/types/src/components/Subscriptions/tieredDisplayDropdown/util.d.ts +9 -0
  99. package/dist/esm/types/src/components/TaxationForm.d.ts +3 -3
  100. package/dist/esm/types/src/components/priceListPricing/PricingTooltip.d.ts +40 -0
  101. package/dist/esm/types/src/components/priceListPricing/components/ChargePriceTiers.d.ts +23 -0
  102. package/dist/esm/types/src/components/priceListPricing/components/PriceTierPrice.d.ts +7 -0
  103. package/dist/esm/types/src/components/priceListPricing/components/PriceTierRow.d.ts +13 -0
  104. package/dist/esm/types/src/components/priceListPricing/misc/consts.d.ts +1 -0
  105. package/dist/esm/types/src/components/priceListPricing/types/PriceTier.d.ts +4 -0
  106. package/dist/esm/types/src/components/priceListPricing/utils/getPricingModelDescription.d.ts +2 -0
  107. package/dist/esm/types/src/components/priceListPricing/utils/getPricingModelTitle.d.ts +2 -0
  108. package/dist/esm/types/src/components/priceListPricing/utils/hasPriceTiers.d.ts +9 -0
  109. package/dist/esm/types/src/components/priceListPricing/utils/priceListChargeUtil.ts/getFirstTierPrice.d.ts +7 -0
  110. package/dist/esm/types/src/enums/SubscriptionState.d.ts +9 -0
  111. package/dist/esm/types/src/graphql/QuoteRequests.d.ts +0 -5
  112. package/dist/esm/types/src/graphql/mutations/quoteChargeDelete.d.ts +11 -2
  113. package/dist/esm/types/src/graphql/queries/getQuote.d.ts +29 -2
  114. package/dist/esm/types/src/graphql-codegen/exportedScalarTypes.d.ts +6 -0
  115. package/dist/esm/types/src/index.d.ts +2 -2
  116. package/dist/esm/types/src/utils/addonPlanUtils.d.ts +2 -1
  117. package/dist/esm/types/src/utils/featureAddonUtils.d.ts +16 -1
  118. package/dist/esm/types/src/utils/formatCurrency.d.ts +1 -0
  119. package/dist/esm/types/src/utils/priceListUtils/doesPriceListHaveFlatFeeCharges.d.ts +7 -0
  120. package/dist/esm/types/src/utils/priceListUtils/getPrice.d.ts +5 -0
  121. package/dist/esm/types/src/utils/priceListUtils/priceDescription.d.ts +6 -0
  122. package/dist/esm/types/src/utils/priceListUtils/priceListPriceText.d.ts +12 -0
  123. package/dist/esm/types/src/utils/pricePickerUtils.d.ts +3 -3
  124. package/package.json +2 -2
  125. package/dist/cjs/types/src/components/Subscriptions/TieredDisplayDropdown.d.ts +0 -8
  126. package/dist/cjs/types/src/components/Subscriptions/Upgrade/PlanPicker/priceListCard/PriceListCardPriceDescription.d.ts +0 -13
  127. package/dist/cjs/types/src/hooks/quotes/useQuoteCreate.d.ts +0 -9
  128. package/dist/esm/types/src/components/Subscriptions/TieredDisplayDropdown.d.ts +0 -8
  129. package/dist/esm/types/src/components/Subscriptions/Upgrade/PlanPicker/priceListCard/PriceListCardPriceDescription.d.ts +0 -13
  130. package/dist/esm/types/src/hooks/quotes/useQuoteCreate.d.ts +0 -9
  131. /package/dist/cjs/types/src/components/Subscriptions/Upgrade/PlanPicker/planPickerDesktop/{PriceListCardDesktop.d.ts → priceListCardDesktop/PriceListCardDesktop.d.ts} +0 -0
  132. /package/dist/esm/types/src/components/Subscriptions/Upgrade/PlanPicker/planPickerDesktop/{PriceListCardDesktop.d.ts → priceListCardDesktop/PriceListCardDesktop.d.ts} +0 -0
@@ -1,13 +1,28 @@
1
- import { FormattedInvoice, Quote } from '@bunnyapp/common';
1
+ import { FormattedInvoice } from '@bunnyapp/common';
2
+ import { FragmentOf } from 'gql.tada';
3
+ export declare const Checkout_QuoteFragment: import("gql.tada").TadaDocumentNode<{
4
+ id: string | null;
5
+ accountId: string;
6
+ formattedQuote: {
7
+ html: string | null;
8
+ } | null;
9
+ [$tada.fragmentRefs]: {
10
+ QuoteCheckout_QuoteFragment: "Quote";
11
+ };
12
+ }, {}, {
13
+ fragment: "Checkout_QuoteFragment";
14
+ on: "Quote";
15
+ masked: true;
16
+ }>;
2
17
  type CheckoutProps = {
3
18
  invoice?: FormattedInvoice;
4
19
  onCancel: () => void;
5
20
  onFail: (error: any) => void;
6
21
  onSuccess: () => void;
7
22
  open: boolean;
8
- quote?: Quote;
23
+ quote?: FragmentOf<typeof Checkout_QuoteFragment>;
9
24
  token?: string;
10
25
  isUpdatingQuote: boolean;
11
26
  };
12
- declare const Checkout: ({ onCancel, onSuccess, onFail, invoice, open, quote, isUpdatingQuote, }: CheckoutProps) => import("react/jsx-runtime").JSX.Element | null;
27
+ declare const Checkout: ({ onCancel, onSuccess, onFail, invoice, open, quote: maskedQuote, isUpdatingQuote, }: CheckoutProps) => import("react/jsx-runtime").JSX.Element | null;
13
28
  export default Checkout;
@@ -1,12 +1,86 @@
1
- import { Account, PaymentMethod, Quote, TaxationRequiredAccountFields } from '@bunnyapp/common';
1
+ import { Account, PaymentMethod, TaxationRequiredAccountFields } from '@bunnyapp/common';
2
+ import { FragmentOf } from 'gql.tada';
2
3
  import { InvoiceQuoteParentProps } from '../PaymentForm/PaymentFormTypes';
4
+ export declare const QuoteCheckout_QuoteFragment: import("gql.tada").TadaDocumentNode<{
5
+ id: string | null;
6
+ accountId: string;
7
+ amountDue: number | null;
8
+ amount: number;
9
+ quoteChanges: ({
10
+ id: string | null;
11
+ charges: {
12
+ kind: "COUPON" | "SUBSCRIBE" | "UPDATE" | "RENEW" | "REINSTATE" | "UNSUBSCRIBE" | "ADJUSTMENT" | "DISCOUNT" | "CREDIT" | "PRICE_UPDATE" | "QUANTITY_UPDATE" | "FREE_PERIOD_DISCOUNT" | "ACTIVATE" | null;
13
+ coupon: {
14
+ couponCode: string;
15
+ } | null;
16
+ }[];
17
+ }[] & {
18
+ currencyId: string;
19
+ id: string | null;
20
+ kind: "COUPON" | "SUBSCRIBE" | "UPDATE" | "RENEW" | "REINSTATE" | "UNSUBSCRIBE" | "ADJUSTMENT" | "DISCOUNT" | "CREDIT" | "PRICE_UPDATE" | "QUANTITY_UPDATE" | "FREE_PERIOD_DISCOUNT" | "ACTIVATE";
21
+ charges: {
22
+ subtotal: number | null;
23
+ amountsByPeriod: {
24
+ amount: number | null;
25
+ startDate: unknown;
26
+ }[] | null;
27
+ amount: number | null;
28
+ billingPeriod: "ONCE" | "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL" | null;
29
+ currencyId: string;
30
+ feature: {
31
+ unitName: string | null;
32
+ } | null;
33
+ id: string | null;
34
+ name: string | null;
35
+ priceListCharge: {
36
+ id: string;
37
+ } | null;
38
+ priceList: {
39
+ id: string;
40
+ } | null;
41
+ coupon: {
42
+ couponCode: string;
43
+ } | null;
44
+ quantity: number | null;
45
+ kind: "COUPON" | "SUBSCRIBE" | "UPDATE" | "RENEW" | "REINSTATE" | "UNSUBSCRIBE" | "ADJUSTMENT" | "DISCOUNT" | "CREDIT" | "PRICE_UPDATE" | "QUANTITY_UPDATE" | "FREE_PERIOD_DISCOUNT" | "ACTIVATE" | null;
46
+ }[];
47
+ priceList: {
48
+ id: string;
49
+ plan: {
50
+ name: string;
51
+ } | null;
52
+ product: {
53
+ name: string;
54
+ } | null;
55
+ } | null;
56
+ }[]) | null;
57
+ smallUnitAmountDue: number | null;
58
+ currencyId: string;
59
+ payableId: string | null;
60
+ periodAmount: number | null;
61
+ subtotal: number;
62
+ taxAmount: number;
63
+ startDate: unknown;
64
+ formattedQuote: {
65
+ html: string | null;
66
+ } | null;
67
+ amountsByPeriod: {
68
+ amount: number | null;
69
+ startDate: unknown;
70
+ }[];
71
+ kind: "COUPON" | "SUBSCRIBE" | "UPDATE" | "RENEW" | "REINSTATE" | "UNSUBSCRIBE" | "ADJUSTMENT" | "DISCOUNT" | "CREDIT" | "PRICE_UPDATE" | "QUANTITY_UPDATE" | "FREE_PERIOD_DISCOUNT" | "ACTIVATE";
72
+ }, {}, {
73
+ fragment: "QuoteCheckout_QuoteFragment";
74
+ on: "Quote";
75
+ masked: true;
76
+ }>;
3
77
  interface QuoteCheckoutProps extends InvoiceQuoteParentProps {
4
78
  account: Account;
5
- quote: Quote;
79
+ quote: FragmentOf<typeof QuoteCheckout_QuoteFragment>;
6
80
  taxationRequiredAccountFields?: TaxationRequiredAccountFields | null;
7
81
  token?: string;
8
82
  storedPaymentMethod?: PaymentMethod;
9
83
  onRecalculateTaxes: () => void;
10
84
  }
11
- declare const QuoteCheckout: ({ account, onSuccess, onFail, quote, taxationRequiredAccountFields, onRecalculateTaxes, }: QuoteCheckoutProps) => import("react/jsx-runtime").JSX.Element;
85
+ declare const QuoteCheckout: ({ account, onSuccess, onFail, quote: maskedQuote, taxationRequiredAccountFields, onRecalculateTaxes, }: QuoteCheckoutProps) => import("react/jsx-runtime").JSX.Element;
12
86
  export default QuoteCheckout;
@@ -1,2 +1,4 @@
1
- import { Quote } from '@bunnyapp/common';
2
- export declare const getQuoteAmountDue: (quote: Quote) => number;
1
+ export declare const getQuoteAmountDue: (quote: {
2
+ amountDue: number | null;
3
+ amount: number;
4
+ }) => number;
@@ -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,142 @@
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
+ /**
67
+ * Central quote fragment for QuoteProvider context.
68
+ *
69
+ * This fragment aggregates all child component fragments to ensure the QuoteProvider
70
+ * fetches all required quote data upfront. When a component needs specific quote fields,
71
+ * add its fragment here to maintain type safety and avoid over-fetching.
72
+ *
73
+ * Pattern: Fragment Composition
74
+ * - Components define their data needs via fragments
75
+ * - Provider composes these fragments into a single query
76
+ * - Type safety ensures all required fields are fetched
77
+ */
78
+ 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
+ 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";
98
+ quoteChanges: {
99
+ currencyId: string;
100
+ id: string | null;
101
+ kind: "COUPON" | "SUBSCRIBE" | "UPDATE" | "RENEW" | "REINSTATE" | "UNSUBSCRIBE" | "ADJUSTMENT" | "DISCOUNT" | "CREDIT" | "PRICE_UPDATE" | "QUANTITY_UPDATE" | "FREE_PERIOD_DISCOUNT" | "ACTIVATE";
102
+ 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
+ priceListCharge: {
117
+ id: string;
118
+ } | null;
119
+ priceList: {
120
+ id: string;
121
+ } | null;
122
+ coupon: {
123
+ couponCode: string;
124
+ } | null;
125
+ quantity: number | null;
126
+ kind: "COUPON" | "SUBSCRIBE" | "UPDATE" | "RENEW" | "REINSTATE" | "UNSUBSCRIBE" | "ADJUSTMENT" | "DISCOUNT" | "CREDIT" | "PRICE_UPDATE" | "QUANTITY_UPDATE" | "FREE_PERIOD_DISCOUNT" | "ACTIVATE" | null;
127
+ }[];
128
+ priceList: {
129
+ id: string;
130
+ plan: {
131
+ name: string;
132
+ } | null;
133
+ product: {
134
+ name: string;
135
+ } | null;
136
+ } | null;
137
+ }[] | null;
138
+ }, {}, {
139
+ fragment: "QuoteContext_QuoteFragment";
140
+ on: "Quote";
141
+ masked: true;
142
+ }>;
@@ -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;
@@ -39,10 +39,9 @@ export declare const QuantityChangeGridRow_SubscriptionFragment: import("gql.tad
39
39
  on: "Subscription";
40
40
  masked: true;
41
41
  }>;
42
- declare const QuantityChangeGridRow: ({ chargeIndex, editingQuote, subscriptionIndex, setEditingQuoteData, subscription: maskedSubscription, subscriptionCharge: maskedSubscriptionCharge, setUpdatingChargeQuantityId, updatingChargeQuantityId, setErrorUpdatingQuantity, }: {
43
- chargeIndex: number;
42
+ declare const QuantityChangeGridRow: ({ editingQuote, editingQuoteId, setEditingQuoteData, subscription: maskedSubscription, subscriptionCharge: maskedSubscriptionCharge, setUpdatingChargeQuantityId, updatingChargeQuantityId, setErrorUpdatingQuantity, }: {
44
43
  editingQuote?: Quote;
45
- subscriptionIndex: number;
44
+ editingQuoteId?: string;
46
45
  setEditingQuoteData: (value: any) => void;
47
46
  subscription: FragmentOf<typeof QuantityChangeGridRow_SubscriptionFragment>;
48
47
  subscriptionCharge: FragmentOf<typeof QuantityChangeGridRow_SubscriptionChargeFragment>;
@@ -1,15 +1,15 @@
1
1
  import { FragmentOf } from 'gql.tada';
2
- import { QuantityDrawerDesktop_SubscriptionFragment } from './quantityChangeDrawer/quantityChangeDrawerDesktop/QuantityChangeDrawerDesktop';
2
+ import { QuantityDrawerDesktop_SubscriptionFragment } from './quantityChangeDrawerDesktop/QuantityChangeDrawerDesktop';
3
3
  export type EditingQuoteDataType = {
4
4
  id: string;
5
5
  isTrial: boolean;
6
6
  };
7
- interface QuantityDrawerContainerProps {
7
+ interface QuantityDrawerProps {
8
8
  subscriptions: (FragmentOf<typeof QuantityDrawerDesktop_SubscriptionFragment> | null)[];
9
9
  quantityDrawerOpen: boolean;
10
10
  setQuantityDrawerOpen: (open: boolean) => void;
11
11
  handlePortalErrors?: (errors: any) => void;
12
12
  setShowInactive: (showInactive: boolean) => void;
13
13
  }
14
- declare const QuantityDrawerContainer: ({ subscriptions, quantityDrawerOpen, setQuantityDrawerOpen, handlePortalErrors, setShowInactive, }: QuantityDrawerContainerProps) => import("react/jsx-runtime").JSX.Element;
15
- export default QuantityDrawerContainer;
14
+ export declare const QuantityDrawer: ({ subscriptions, quantityDrawerOpen, setQuantityDrawerOpen, handlePortalErrors, setShowInactive, }: QuantityDrawerProps) => import("react/jsx-runtime").JSX.Element;
15
+ export {};
@@ -1,5 +1,5 @@
1
1
  import { Quote } from '@bunnyapp/common';
2
- import { FragmentOf, ResultOf } from 'gql.tada';
2
+ import { FragmentOf } from 'gql.tada';
3
3
  export declare const QuantityInput_SubscriptionChargeFragment: import("gql.tada").TadaDocumentNode<{
4
4
  id: string | null;
5
5
  quantity: number | null;
@@ -31,23 +31,15 @@ export declare const QuantityInput_SubscriptionFragment: import("gql.tada").Tada
31
31
  on: "Subscription";
32
32
  masked: true;
33
33
  }>;
34
- export type EditingSubscriptionType = {
35
- chargeId: string;
36
- chargeIndex: number;
37
- quantity: number | undefined;
38
- subscription: ResultOf<typeof QuantityInput_SubscriptionFragment>;
39
- subscriptionIndex: number;
40
- };
41
- declare const QuantityInput: ({ charge: maskedCharge, chargeIndex, editingQuote, setEditingQuoteData, subscription: maskedSubscription, subscriptionIndex, setUpdatingChargeQuantityId, updatingChargeQuantityId, setErrorUpdatingQuantity, }: {
34
+ declare const QuantityInput: ({ charge: maskedCharge, editingQuote, editingQuoteId, setEditingQuoteData, subscription: maskedSubscription, setUpdatingChargeQuantityId, updatingChargeQuantityId, setErrorUpdatingQuantity, }: {
42
35
  charge: FragmentOf<typeof QuantityInput_SubscriptionChargeFragment>;
43
- chargeIndex: number;
44
36
  editingQuote?: Quote;
37
+ editingQuoteId?: string;
45
38
  setEditingQuoteData: (editingQuoteData: {
46
39
  id: string;
47
40
  isTrial: boolean;
48
41
  } | undefined) => void;
49
42
  subscription: FragmentOf<typeof QuantityInput_SubscriptionFragment>;
50
- subscriptionIndex: number;
51
43
  setUpdatingChargeQuantityId: (updatingChargeQuantityId: string | undefined) => void;
52
44
  updatingChargeQuantityId: string | undefined;
53
45
  setErrorUpdatingQuantity: (errorUpdatingQuantity: boolean) => void;
@@ -0,0 +1,10 @@
1
+ export declare const QuantityDrawer_QuoteFragment: import("gql.tada").TadaDocumentNode<{
2
+ id: string | null;
3
+ [$tada.fragmentRefs]: {
4
+ Checkout_QuoteFragment: "Quote";
5
+ };
6
+ }, {}, {
7
+ fragment: "QuantityDrawer_QuoteFragment";
8
+ on: "Quote";
9
+ masked: true;
10
+ }>;
@@ -0,0 +1,3 @@
1
+ import { FragmentOf } from 'gql.tada';
2
+ import { QuantityDrawer_QuoteFragment } from '../fragments/QuantityDrawerQuoteFragment';
3
+ export declare const useQuoteQueryData: (quoteId: string | undefined) => FragmentOf<typeof QuantityDrawer_QuoteFragment> | undefined;
@@ -0,0 +1,5 @@
1
+ import { FragmentOf } from 'gql.tada';
2
+ import { QuantityDrawer_QuoteFragment } from '../fragments/QuantityDrawerQuoteFragment';
3
+ export declare const useSetQuoteQueryData: () => {
4
+ setQuoteQueryData: (quoteId: string, maskedQuote: FragmentOf<typeof QuantityDrawer_QuoteFragment> | null) => void;
5
+ };
@@ -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
  };
@@ -0,0 +1,23 @@
1
+ type QuoteChangeCreateChargeProps = {
2
+ apiHost: string;
3
+ price?: number;
4
+ priceListChargeId?: string;
5
+ quantity?: number;
6
+ quoteChangeId: string;
7
+ startDate: string;
8
+ subscriptionChargeId?: string;
9
+ token?: string;
10
+ };
11
+ export declare const quoteChargeCreate: ({ price, priceListChargeId, quantity, quoteChangeId, startDate, subscriptionChargeId, token, apiHost, }: QuoteChangeCreateChargeProps) => Promise<{
12
+ quoteChange: {
13
+ id: string | null;
14
+ quoteId: string;
15
+ quote: {
16
+ [$tada.fragmentRefs]: {
17
+ QuantityDrawer_QuoteFragment: "Quote";
18
+ };
19
+ };
20
+ };
21
+ id: string | null;
22
+ } | null | undefined>;
23
+ export {};
@@ -0,0 +1,12 @@
1
+ export declare const quoteChargeUpdate: (quoteChargeId: string, quantity: number, apiHost: string, token?: string) => Promise<{
2
+ quoteChange: {
3
+ id: string | null;
4
+ quoteId: string;
5
+ quote: {
6
+ [$tada.fragmentRefs]: {
7
+ QuantityDrawer_QuoteFragment: "Quote";
8
+ };
9
+ };
10
+ };
11
+ id: string | null;
12
+ } | null | undefined>;
@@ -0,0 +1,22 @@
1
+ export declare const quoteSubscriptionUpdate: (subscriptionIds: string[], apiHost: string, token?: string) => Promise<{
2
+ id: string | null;
3
+ quoteChanges: {
4
+ id: string | null;
5
+ priceList: {
6
+ id: string;
7
+ } | null;
8
+ subscription: {
9
+ charges: {
10
+ startDate: unknown;
11
+ endDate: unknown;
12
+ id: string | null;
13
+ priceListCharge: {
14
+ id: string;
15
+ } | null;
16
+ }[] | null;
17
+ } | null;
18
+ }[] | null;
19
+ [$tada.fragmentRefs]: {
20
+ QuantityDrawer_QuoteFragment: "Quote";
21
+ };
22
+ } | null | undefined>;
@@ -0,0 +1,2 @@
1
+ import { Dayjs } from 'dayjs';
2
+ export declare const formatDateForApi: (date: Dayjs | string) => string;