@bunnyapp/components 1.0.55 → 1.0.56-beta.0.1

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 (96) hide show
  1. package/dist/cjs/index.js +685 -625
  2. package/dist/cjs/src/components/BunnyProvider.d.ts +2 -2
  3. package/dist/cjs/src/components/Checkout/Checkout.d.ts +2 -3
  4. package/dist/cjs/src/components/Checkout/QuoteCheckout.d.ts +1 -1
  5. package/dist/cjs/src/components/PaymentForm/{PaymentMethod → DemoPay}/CreditCard/CreditCard.d.ts +5 -3
  6. package/dist/cjs/src/components/PaymentForm/PaymentForm.d.ts +2 -3
  7. package/dist/cjs/src/components/PaymentForm/PaymentFormTypes.d.ts +1 -1
  8. package/dist/cjs/src/components/PaymentForm/PaymentMethodDetails.d.ts +4 -4
  9. package/dist/cjs/src/components/PaymentForm/hooks/useAutoSetDefaultPaymentMethod.d.ts +8 -0
  10. package/dist/cjs/src/components/PaymentForm/hooks/useHasActiveSubscription.d.ts +5 -0
  11. package/dist/cjs/src/components/PaymentForm/hooks/usePaymentMethodSelectorPlugin.d.ts +11 -0
  12. package/dist/cjs/src/components/PaymentForm/index.d.ts +0 -1
  13. package/dist/cjs/src/components/PaymentForm/useRemovePaymentMethod.d.ts +1 -1
  14. package/dist/cjs/src/components/PaymentForm/useSetDefaultPaymentMethod.d.ts +6 -0
  15. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/NextPriceListButton.d.ts +2 -1
  16. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/checkoutBar/CheckoutBarInput.d.ts +3 -2
  17. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/checkoutBar/CheckoutBarSummarySection.d.ts +1 -2
  18. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/planPickerDesktop/EverythingPlanFeatures.d.ts +2 -1
  19. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/planPickerDesktop/PlanFeatures.d.ts +2 -1
  20. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/planPickerDesktop/PriceListGridDesktop.d.ts +1 -2
  21. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/planPickerUtils.d.ts +3 -2
  22. package/dist/cjs/src/components/Subscriptions/SubscriptionRequests.d.ts +2 -2
  23. package/dist/cjs/src/components/index.d.ts +1 -1
  24. package/dist/cjs/src/contexts/PaymentContext.d.ts +2 -1
  25. package/dist/cjs/src/graphql/QuoteRequests.d.ts +4 -3
  26. package/dist/cjs/src/graphql/mutations/quoteChargeCreate.d.ts +2 -3
  27. package/dist/cjs/src/graphql/mutations/quoteChargeUpdate.d.ts +12 -0
  28. package/dist/cjs/src/graphql/mutations/quoteCompose.d.ts +1 -1
  29. package/dist/cjs/src/graphql/mutations/quoteRecalculateTaxes.d.ts +2 -2
  30. package/dist/cjs/src/graphql/queries/getPriceListChangeOptions.d.ts +1 -1
  31. package/dist/cjs/src/graphql/queries/getTaxationRequiredAccountFields.d.ts +2 -2
  32. package/dist/cjs/src/hooks/quotes/useSendAcceptQuote.d.ts +1 -1
  33. package/dist/cjs/src/hooks/quotes/useSigningComplete.d.ts +1 -1
  34. package/dist/cjs/src/hooks/useHasTaxPlugin.d.ts +1 -1
  35. package/dist/cjs/src/hooks/usePaymentMethod.d.ts +6 -5
  36. package/dist/cjs/src/hooks/usePaymentPlugins.d.ts +1 -1
  37. package/dist/cjs/src/hooks/usePlugins.d.ts +2 -2
  38. package/dist/cjs/src/hooks/useSigningPlugins.d.ts +1 -1
  39. package/dist/cjs/src/hooks/useToken.d.ts +1 -1
  40. package/dist/cjs/src/utils/apiUtils.d.ts +1 -1
  41. package/dist/esm/index.js +689 -628
  42. package/dist/esm/src/components/BunnyProvider.d.ts +2 -2
  43. package/dist/esm/src/components/Checkout/Checkout.d.ts +2 -3
  44. package/dist/esm/src/components/Checkout/QuoteCheckout.d.ts +1 -1
  45. package/dist/esm/src/components/PaymentForm/{PaymentMethod → DemoPay}/CreditCard/CreditCard.d.ts +5 -3
  46. package/dist/esm/src/components/PaymentForm/PaymentForm.d.ts +2 -3
  47. package/dist/esm/src/components/PaymentForm/PaymentFormTypes.d.ts +1 -1
  48. package/dist/esm/src/components/PaymentForm/PaymentMethodDetails.d.ts +4 -4
  49. package/dist/esm/src/components/PaymentForm/hooks/useAutoSetDefaultPaymentMethod.d.ts +8 -0
  50. package/dist/esm/src/components/PaymentForm/hooks/useHasActiveSubscription.d.ts +5 -0
  51. package/dist/esm/src/components/PaymentForm/hooks/usePaymentMethodSelectorPlugin.d.ts +11 -0
  52. package/dist/esm/src/components/PaymentForm/index.d.ts +0 -1
  53. package/dist/esm/src/components/PaymentForm/useRemovePaymentMethod.d.ts +1 -1
  54. package/dist/esm/src/components/PaymentForm/useSetDefaultPaymentMethod.d.ts +6 -0
  55. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/NextPriceListButton.d.ts +2 -1
  56. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/checkoutBar/CheckoutBarInput.d.ts +3 -2
  57. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/checkoutBar/CheckoutBarSummarySection.d.ts +1 -2
  58. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/planPickerDesktop/EverythingPlanFeatures.d.ts +2 -1
  59. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/planPickerDesktop/PlanFeatures.d.ts +2 -1
  60. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/planPickerDesktop/PriceListGridDesktop.d.ts +1 -2
  61. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/planPickerUtils.d.ts +3 -2
  62. package/dist/esm/src/components/Subscriptions/SubscriptionRequests.d.ts +2 -2
  63. package/dist/esm/src/components/index.d.ts +1 -1
  64. package/dist/esm/src/contexts/PaymentContext.d.ts +2 -1
  65. package/dist/esm/src/graphql/QuoteRequests.d.ts +4 -3
  66. package/dist/esm/src/graphql/mutations/quoteChargeCreate.d.ts +2 -3
  67. package/dist/esm/src/graphql/mutations/quoteChargeUpdate.d.ts +12 -0
  68. package/dist/esm/src/graphql/mutations/quoteCompose.d.ts +1 -1
  69. package/dist/esm/src/graphql/mutations/quoteRecalculateTaxes.d.ts +2 -2
  70. package/dist/esm/src/graphql/queries/getPriceListChangeOptions.d.ts +1 -1
  71. package/dist/esm/src/graphql/queries/getTaxationRequiredAccountFields.d.ts +2 -2
  72. package/dist/esm/src/hooks/quotes/useSendAcceptQuote.d.ts +1 -1
  73. package/dist/esm/src/hooks/quotes/useSigningComplete.d.ts +1 -1
  74. package/dist/esm/src/hooks/useHasTaxPlugin.d.ts +1 -1
  75. package/dist/esm/src/hooks/usePaymentMethod.d.ts +6 -5
  76. package/dist/esm/src/hooks/usePaymentPlugins.d.ts +1 -1
  77. package/dist/esm/src/hooks/usePlugins.d.ts +2 -2
  78. package/dist/esm/src/hooks/useSigningPlugins.d.ts +1 -1
  79. package/dist/esm/src/hooks/useToken.d.ts +1 -1
  80. package/dist/esm/src/utils/apiUtils.d.ts +1 -1
  81. package/dist/index.d.ts +4 -12
  82. package/package.json +1 -1
  83. package/dist/cjs/src/components/PaymentForm/PaymentMethod/PaymentMethod.d.ts +0 -8
  84. package/dist/cjs/src/components/PaymentForm/PaymentMethod/PaymentMethod.stories.d.ts +0 -11
  85. package/dist/cjs/src/components/PaymentForm/PaymentMethod/index.d.ts +0 -1
  86. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/planPickerDesktop/consts.d.ts +0 -1
  87. package/dist/cjs/src/graphql/queries/getPortalPreviewQuery.d.ts +0 -2
  88. package/dist/esm/src/components/PaymentForm/PaymentMethod/PaymentMethod.d.ts +0 -8
  89. package/dist/esm/src/components/PaymentForm/PaymentMethod/PaymentMethod.stories.d.ts +0 -11
  90. package/dist/esm/src/components/PaymentForm/PaymentMethod/index.d.ts +0 -1
  91. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/planPickerDesktop/consts.d.ts +0 -1
  92. package/dist/esm/src/graphql/queries/getPortalPreviewQuery.d.ts +0 -2
  93. /package/dist/cjs/src/components/PaymentForm/{PaymentMethod → DemoPay}/CreditCard/LargCardIcon.d.ts +0 -0
  94. /package/dist/cjs/src/components/PaymentForm/{PaymentMethod → DemoPay}/CreditCard/PlusIcon.d.ts +0 -0
  95. /package/dist/esm/src/components/PaymentForm/{PaymentMethod → DemoPay}/CreditCard/LargCardIcon.d.ts +0 -0
  96. /package/dist/esm/src/components/PaymentForm/{PaymentMethod → DemoPay}/CreditCard/PlusIcon.d.ts +0 -0
@@ -5,7 +5,7 @@ import { GraphQLClient } from "graphql-request";
5
5
  export type BunnyContextValues = {
6
6
  apiHost: string;
7
7
  graphQLClient: GraphQLClient;
8
- token: string;
8
+ token?: string;
9
9
  displayPayButtonNameAnyways?: boolean;
10
10
  darkMode?: boolean;
11
11
  onTokenExpired?: () => void;
@@ -16,7 +16,7 @@ declare function BunnyProvider({ children, darkMode, queryClient, apiHost, token
16
16
  darkMode?: boolean;
17
17
  queryClient?: QueryClient;
18
18
  apiHost: string;
19
- token: string;
19
+ token?: string;
20
20
  onTokenExpired?: () => void;
21
21
  configProviderProps?: ThemeConfig | undefined;
22
22
  }): import("react/jsx-runtime").JSX.Element;
@@ -2,9 +2,8 @@ import { PaymentMethod } from "@bunnyapp/common";
2
2
  import { CheckoutProps } from "../PaymentForm/PaymentFormTypes";
3
3
  interface CheckoutComponentProps extends CheckoutProps {
4
4
  isMobile: boolean;
5
- token: string;
5
+ token?: string;
6
6
  storedPaymentMethod?: PaymentMethod;
7
- quantity?: number;
8
7
  }
9
- declare const Checkout: ({ onCancel, onSuccess, onFail, invoice, open, quote, selectedPriceList, token, quantity, }: CheckoutComponentProps) => import("react/jsx-runtime").JSX.Element | null;
8
+ declare const Checkout: ({ onCancel, onSuccess, onFail, invoice, open, quote, selectedPriceList, token, }: CheckoutComponentProps) => import("react/jsx-runtime").JSX.Element | null;
10
9
  export default Checkout;
@@ -4,7 +4,7 @@ interface QuoteCheckoutProps extends InvoiceQuoteParentProps {
4
4
  account: Account;
5
5
  quote: Quote;
6
6
  taxationRequiredAccountFields?: TaxationRequiredAccountFields | null;
7
- token: string;
7
+ token?: string;
8
8
  storedPaymentMethod?: PaymentMethod;
9
9
  }
10
10
  declare const QuoteCheckout: ({ account, onSuccess, onFail, quote, taxationRequiredAccountFields, }: QuoteCheckoutProps) => import("react/jsx-runtime").JSX.Element;
@@ -8,10 +8,12 @@ type CreditCardProps = {
8
8
  cardEnabled?: boolean;
9
9
  };
10
10
  declare const CreditCard: ({ onClickRemove, onClickUpdate, paymentMethodData, shadow, cardEnabled, }: CreditCardProps) => import("react/jsx-runtime").JSX.Element;
11
- export declare const MiniCreditCard: ({ hideRemoveButton, onClickRemove, paymentMethodData, }: {
12
- hideRemoveButton?: boolean | undefined;
11
+ export declare const MiniCreditCard: ({ hideDropdownMenu, onClickRemove, paymentMethodData, onClickSetDefault, id, }: {
12
+ hideDropdownMenu?: boolean | undefined;
13
13
  onClickRemove: () => void;
14
- paymentMethodData: PaymentMethod;
14
+ paymentMethodData?: PaymentMethod | undefined;
15
+ onClickSetDefault: () => void;
16
+ id?: string | undefined;
15
17
  }) => import("react/jsx-runtime").JSX.Element;
16
18
  declare const EmptyCard: ({ onClick, shadow, cardEnabled, }: {
17
19
  onClick: () => void;
@@ -1,15 +1,14 @@
1
1
  /// <reference types="react" />
2
2
  import { FormattedInvoice, PluginData, Quote } from "@bunnyapp/common";
3
- import { GraphQLClient } from "graphql-request";
4
- export declare const PaymentForm: ({ invoice, onFail, onPaymentSuccess, quote, accountId, onSavePaymentMethod, overrideToken, graphQLClient, customCheckoutFunction, currencyId: currencyIdFromProps, customPaymentForms, useAllPaymentPlugins, }: {
3
+ export declare const PaymentForm: ({ invoice, onFail, onPaymentSuccess, quote, accountId, onSavePaymentMethod, onRemovePaymentMethod, overrideToken, customCheckoutFunction, currencyId: currencyIdFromProps, customPaymentForms, useAllPaymentPlugins, }: {
5
4
  invoice?: FormattedInvoice | undefined;
6
5
  quote?: Quote | undefined;
7
6
  onFail: (error: any) => void;
8
7
  onPaymentSuccess?: (() => void) | undefined;
9
8
  onSavePaymentMethod?: (() => void) | undefined;
9
+ onRemovePaymentMethod?: (() => void) | undefined;
10
10
  accountId?: string | undefined;
11
11
  overrideToken?: string | undefined;
12
- graphQLClient: GraphQLClient;
13
12
  customCheckoutFunction?: ((plugin: PluginData | undefined) => Promise<any>) | undefined;
14
13
  currencyId?: string | undefined;
15
14
  customPaymentForms?: Record<string, import("react").ReactNode> | undefined;
@@ -20,5 +20,5 @@ export type CheckoutProps = {
20
20
  open: boolean;
21
21
  quote?: Quote;
22
22
  selectedPriceList?: PriceList;
23
- token: string;
23
+ token?: string;
24
24
  };
@@ -1,9 +1,9 @@
1
1
  /// <reference types="react" />
2
- import { PaymentMethod, PluginData } from "@bunnyapp/common";
3
- declare const PaymentMethodDetails: ({ onFail, paymentMethod, onSavePaymentMethod, customPaymentForms, }: {
2
+ import { PluginData } from "@bunnyapp/common";
3
+ declare const PaymentMethodDetails: ({ onFail, plugin, onSavePaymentMethod, customPaymentForms, }: {
4
4
  onFail: (error: any) => void;
5
- paymentMethod: PaymentMethod | PluginData;
5
+ plugin: PluginData;
6
6
  onSavePaymentMethod: () => void;
7
7
  customPaymentForms?: Record<string, import("react").ReactNode> | undefined;
8
- }) => import("react/jsx-runtime").JSX.Element | null;
8
+ }) => import("react/jsx-runtime").JSX.Element;
9
9
  export default PaymentMethodDetails;
@@ -0,0 +1,8 @@
1
+ import { PaymentMethod } from "@bunnyapp/common";
2
+ declare const useAutoSetDefaultPaymentMethod: ({ accountId, token, handleSetDefault, setDefaultPaymentMethodLoading, }: {
3
+ accountId: string | undefined;
4
+ token?: string | undefined;
5
+ handleSetDefault: (paymentMethod: PaymentMethod) => void;
6
+ setDefaultPaymentMethodLoading: boolean;
7
+ }) => void;
8
+ export default useAutoSetDefaultPaymentMethod;
@@ -0,0 +1,5 @@
1
+ declare function useHasActiveSubscription({ token, apiHost, }: {
2
+ token: string;
3
+ apiHost: string;
4
+ }): any;
5
+ export default useHasActiveSubscription;
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ import { PaymentMethod, PluginData } from "@bunnyapp/common";
3
+ declare const usePaymentMethodSelectorPlugin: ({ defaultPaymentMethod, defaultPaymentMethodPlugin, paymentMethodAllowedPlugins, }: {
4
+ defaultPaymentMethod: PaymentMethod | undefined;
5
+ defaultPaymentMethodPlugin: PluginData | undefined;
6
+ paymentMethodAllowedPlugins: PluginData[] | undefined;
7
+ }) => {
8
+ selectorPaymentMethodPlugin: PluginData | undefined;
9
+ setSelectorPaymentMethodPlugin: import("react").Dispatch<import("react").SetStateAction<PluginData | undefined>>;
10
+ };
11
+ export default usePaymentMethodSelectorPlugin;
@@ -1,2 +1 @@
1
- export { PaymentMethod } from "./PaymentMethod";
2
1
  export { PaymentForm } from "./PaymentForm";
@@ -1,3 +1,3 @@
1
1
  import { PluginData } from "@bunnyapp/common";
2
- declare function useRemovePaymentMethod(paymentPlugins: PluginData[], apiHost: string, token: string, accountId?: string): (data: any) => Promise<void>;
2
+ declare function useRemovePaymentMethod(paymentPlugins: PluginData[], apiHost: string, token?: string, accountId?: string, onRemovePaymentMethod?: () => void): (data: any) => Promise<void>;
3
3
  export default useRemovePaymentMethod;
@@ -0,0 +1,6 @@
1
+ import { PluginData } from "@bunnyapp/common";
2
+ declare function useSetDefaultPaymentMethod(paymentPlugins: PluginData[], apiHost: string, token?: string, accountId?: string): {
3
+ setDefaultPaymentMethod: (data: any) => Promise<void>;
4
+ loading: boolean;
5
+ };
6
+ export default useSetDefaultPaymentMethod;
@@ -1,7 +1,8 @@
1
1
  import { Dispatch, SetStateAction } from "react";
2
2
  import { PriceList } from "@bunnyapp/common";
3
- declare const NextPriceListButton: ({ availablePriceLists, priceListStart, setPriceListStart, }: {
3
+ declare const NextPriceListButton: ({ availablePriceLists, priceListStart, setPriceListStart, numberOfPlansToDisplay, }: {
4
4
  availablePriceLists: PriceList[];
5
+ numberOfPlansToDisplay: number;
5
6
  priceListStart: number;
6
7
  setPriceListStart: Dispatch<SetStateAction<number>>;
7
8
  }) => import("react/jsx-runtime").JSX.Element;
@@ -1,8 +1,9 @@
1
1
  import { PriceList, PriceListCharge } from "@bunnyapp/common";
2
- declare const CheckoutBarInput: ({ charge, quantity, selectedPriceList, setQuantity, }: {
2
+ declare const CheckoutBarInput: ({ disabled, charge, quantity, selectedPriceList, onQuantityChanged, }: {
3
+ disabled?: boolean | undefined;
3
4
  charge: PriceListCharge;
4
5
  quantity: number;
5
6
  selectedPriceList?: PriceList | undefined;
6
- setQuantity: (quantity: number) => void;
7
+ onQuantityChanged: (quantity: number) => void;
7
8
  }) => import("react/jsx-runtime").JSX.Element | null;
8
9
  export default CheckoutBarInput;
@@ -1,7 +1,6 @@
1
1
  import { PriceList, Quote, QuotePreviewData, Subscription } from "@bunnyapp/common";
2
- declare const CheckoutBarSummarySection: ({ open, quantityLocal, quote, selectedPriceList, onClickCheckout, upgradingSubscription, quotePreviewData, }: {
2
+ declare const CheckoutBarSummarySection: ({ open, quote, selectedPriceList, onClickCheckout, upgradingSubscription, quotePreviewData, }: {
3
3
  open: boolean;
4
- quantityLocal: number;
5
4
  quote?: Quote | undefined;
6
5
  selectedPriceList: PriceList;
7
6
  onClickCheckout: () => void;
@@ -1,6 +1,7 @@
1
1
  import { PriceList, Product } from "@bunnyapp/common";
2
- declare const EverythingPlanFeatures: ({ availablePriceLists, selectedProduct, }: {
2
+ declare const EverythingPlanFeatures: ({ availablePriceLists, selectedProduct, plansToDisplay, }: {
3
3
  availablePriceLists: PriceList[];
4
+ plansToDisplay: number;
4
5
  selectedProduct?: Product | undefined;
5
6
  }) => import("react/jsx-runtime").JSX.Element;
6
7
  export default EverythingPlanFeatures;
@@ -1,6 +1,7 @@
1
1
  import { Plan, Product } from "@bunnyapp/common";
2
- declare const PlanFeatures: ({ availablePlansArray, selectedProduct, }: {
2
+ declare const PlanFeatures: ({ availablePlansArray, selectedProduct, plansToDisplay, }: {
3
3
  availablePlansArray: Plan[];
4
+ plansToDisplay: number;
4
5
  selectedProduct?: Product | undefined;
5
6
  }) => import("react/jsx-runtime").JSX.Element;
6
7
  export default PlanFeatures;
@@ -1,6 +1,5 @@
1
- import { Product, PriceList, Subscription, PriceListChangeOptions } from "@bunnyapp/common";
1
+ import { PriceList, PriceListChangeOptions, Product, Subscription } from "@bunnyapp/common";
2
2
  import { Dispatch, SetStateAction } from "react";
3
- export declare const PLANS_TO_DISPLAY = 3;
4
3
  type PriceListGridDesktopProps = {
5
4
  availablePriceLists: PriceList[];
6
5
  onChangePriceList: (selectedPriceList: PriceList) => void;
@@ -1,12 +1,13 @@
1
1
  import { PriceList, PriceListChangeOptions } from "@bunnyapp/common";
2
- export declare const getAvailablePlansAndPriceLists: ({ availablePriceLists, priceListChangeOptions, priceListStart, }: {
2
+ export declare const getAvailablePlansAndPriceLists: ({ availablePriceLists, priceListChangeOptions, priceListStart, plansToDisplay, }: {
3
3
  availablePriceLists: PriceList[];
4
4
  priceListChangeOptions?: PriceListChangeOptions | undefined;
5
5
  priceListStart: number;
6
+ plansToDisplay: number;
6
7
  }) => {
7
8
  availablePlansArray: import("@bunnyapp/common").Plan[];
8
9
  displayPriceLists: PriceList[];
9
10
  };
10
- export declare const everythingInPlusString: ({ priceList }: {
11
+ export declare const everythingInPlusString: ({ priceList, }: {
11
12
  priceList: PriceList;
12
13
  }) => string;
@@ -1,2 +1,2 @@
1
- export declare const useCancelSubscription: () => (subscriptionIds: string[], token: string, apiHost: string) => Promise<any>;
2
- export declare const useSubscriptionTrialConvert: (handlePortalErrors: (errors: any) => void, apiHost: string) => (subscriptionId: string, token: string, paymentId?: string) => Promise<any>;
1
+ export declare const useCancelSubscription: () => (subscriptionIds: string[], apiHost: string, token?: string) => Promise<any>;
2
+ export declare const useSubscriptionTrialConvert: (handlePortalErrors: (errors: any) => void, apiHost: string) => (subscriptionId: string, token?: string, paymentId?: string) => Promise<any>;
@@ -1,7 +1,7 @@
1
1
  export { Invoice } from "./Invoice";
2
2
  export { Quote } from "./Quote";
3
3
  export { Quotes } from "./Quotes";
4
- export { PaymentMethod, PaymentForm } from "./PaymentForm";
4
+ export { PaymentForm } from "./PaymentForm";
5
5
  export { Signup } from "./Signup";
6
6
  export { default as BunnyProvider } from "./BunnyProvider";
7
7
  export { default as Transactions } from "./Transactions";
@@ -4,7 +4,8 @@ export type PaymentContextValues = {
4
4
  onClickCancel?: () => void;
5
5
  accountId?: string;
6
6
  overrideToken?: string;
7
- storedPaymentMethod?: PaymentMethod;
7
+ storedPaymentMethods?: PaymentMethod[];
8
+ defaultPaymentMethod?: PaymentMethod;
8
9
  customCheckoutFunction?: (plugin: PluginData | undefined) => Promise<any>;
9
10
  };
10
11
  export declare const PaymentContext: import("react").Context<PaymentContextValues>;
@@ -1,6 +1,7 @@
1
- export declare const useCreateSubscriptionQuote: () => (subscriptionIds: string[], token: string, apiHost: string) => Promise<unknown>;
1
+ export declare const useQuoteSubscriptionUpgrade: () => (subscriptionId: string, priceListId: string, apiHost: string, token?: string) => Promise<unknown>;
2
+ export declare const useCreateSubscriptionQuote: () => (subscriptionIds: string[], apiHost: string, token?: string) => Promise<unknown>;
2
3
  export declare const useQuoteChangeUpdate: () => (charges: {
3
4
  id: string;
4
5
  quantity: number;
5
- }[], quoteChangeId: string, token: string, apiHost: string) => Promise<unknown>;
6
- export declare const useQuoteDelete: () => (quoteId: string, token: string, apiHost: string) => Promise<unknown>;
6
+ }[], quoteChangeId: string, apiHost: string, token?: string) => Promise<unknown>;
7
+ export declare const useQuoteDelete: () => (quoteId: string, apiHost: string, token?: string) => Promise<unknown>;
@@ -1,13 +1,12 @@
1
1
  type QuoteChangeCreateChargeProps = {
2
2
  apiHost: string;
3
- endDate: string;
4
3
  price?: number;
5
4
  priceListChargeId?: string;
6
5
  quantity?: number;
7
6
  quoteChangeId: string;
8
7
  startDate: string;
9
8
  subscriptionChargeId?: string;
10
- token: string;
9
+ token?: string;
11
10
  };
12
- declare const quoteChargeCreate: ({ endDate, price, priceListChargeId, quantity, quoteChangeId, startDate, subscriptionChargeId, token, apiHost, }: QuoteChangeCreateChargeProps) => Promise<unknown>;
11
+ declare const quoteChargeCreate: ({ price, priceListChargeId, quantity, quoteChangeId, startDate, subscriptionChargeId, token, apiHost, }: QuoteChangeCreateChargeProps) => Promise<unknown>;
13
12
  export default quoteChargeCreate;
@@ -0,0 +1,12 @@
1
+ declare const quoteChargeUpdate: ({ discount, name, price, quantity, quoteChargeId, startDate, subtotal, apiHost, token, }: {
2
+ discount?: number | undefined;
3
+ name?: string | undefined;
4
+ price?: number | undefined;
5
+ quantity?: number | undefined;
6
+ quoteChargeId: string;
7
+ startDate?: string | undefined;
8
+ subtotal?: number | undefined;
9
+ apiHost: string;
10
+ token: string;
11
+ }) => Promise<unknown>;
12
+ export default quoteChargeUpdate;
@@ -6,7 +6,7 @@ type Options = {
6
6
  subscriptionId?: string;
7
7
  quantity?: number;
8
8
  accountId?: string;
9
- token: string;
9
+ token?: string;
10
10
  apiHost: string;
11
11
  };
12
12
  declare const quoteCompose: ({ quoteId, priceListId, subscriptionId, quantity, accountId, token, apiHost, }: Options) => Promise<Quote>;
@@ -1,6 +1,6 @@
1
- declare const quoteRecalculateTaxes: ({ quoteId, token, apiHost, }: {
1
+ declare const quoteRecalculateTaxes: ({ quoteId, apiHost, token, }: {
2
2
  quoteId: string;
3
- token: string;
4
3
  apiHost: string;
4
+ token?: string | undefined;
5
5
  }) => Promise<any>;
6
6
  export default quoteRecalculateTaxes;
@@ -3,7 +3,7 @@ declare const getPriceListChangeOptions: ({ apiHost, isInPreviewMode, productId,
3
3
  apiHost: string;
4
4
  isInPreviewMode?: boolean | undefined;
5
5
  productId?: string | undefined;
6
- token: string;
6
+ token?: string | undefined;
7
7
  upgradingSubscription?: Subscription | undefined;
8
8
  }) => Promise<any>;
9
9
  export default getPriceListChangeOptions;
@@ -1,6 +1,6 @@
1
1
  import { TaxationRequiredAccountFields } from "@bunnyapp/common";
2
- declare const getTaxationRequiredAccountFields: ({ token, apiHost, }: {
3
- token: string;
2
+ declare const getTaxationRequiredAccountFields: ({ apiHost, token, }: {
4
3
  apiHost: string;
4
+ token?: string | undefined;
5
5
  }) => Promise<TaxationRequiredAccountFields | null>;
6
6
  export default getTaxationRequiredAccountFields;
@@ -3,7 +3,7 @@ declare const useSendAcceptQuote: ({ onTokenExpired, quoteId, apiHost, token, }:
3
3
  onTokenExpired?: (() => void) | undefined;
4
4
  quoteId?: string | undefined;
5
5
  apiHost: string;
6
- token: string;
6
+ token?: string | undefined;
7
7
  }) => {
8
8
  acceptBoxVisible: boolean;
9
9
  isAccepting: boolean;
@@ -1,5 +1,5 @@
1
1
  declare const useSigningComplete: ({ data, token }: {
2
2
  data: any;
3
- token: string;
3
+ token?: string | undefined;
4
4
  }) => void;
5
5
  export default useSigningComplete;
@@ -1,5 +1,5 @@
1
1
  declare const useHasTaxPlugin: ({ apiHost, token, }: {
2
2
  apiHost: string;
3
- token: string;
3
+ token?: string | undefined;
4
4
  }) => boolean;
5
5
  export default useHasTaxPlugin;
@@ -1,9 +1,10 @@
1
- import { GraphQLClient } from "graphql-request";
2
- export declare const usePaymentMethod: ({ accountId, graphQLClient, token, }: {
1
+ import { PaymentMethod } from "@bunnyapp/common";
2
+ export declare const usePaymentMethod: ({ accountId, token, apiHost, }: {
3
3
  accountId?: string | undefined;
4
- graphQLClient: GraphQLClient;
5
- token: string;
4
+ token?: string | undefined;
5
+ apiHost: string;
6
6
  }) => {
7
- data: any;
7
+ paymentMethods: PaymentMethod[];
8
+ defaultPaymentMethod: PaymentMethod | undefined;
8
9
  isLoading: boolean;
9
10
  };
@@ -1,7 +1,7 @@
1
1
  import { PluginData } from "@bunnyapp/common";
2
2
  export declare const usePaymentPlugins: ({ apiHost, token, }: {
3
3
  apiHost: string;
4
- token: string;
4
+ token?: string | undefined;
5
5
  }) => {
6
6
  paymentPlugins: PluginData[] | undefined;
7
7
  paymentMethodAllowedPlugins: PluginData[] | undefined;
@@ -1,5 +1,5 @@
1
- declare const usePlugins: ({ apiHost, token }: {
1
+ declare const usePlugins: ({ apiHost, token, }: {
2
2
  apiHost: string;
3
- token: string;
3
+ token?: string | undefined;
4
4
  }) => import("@tanstack/react-query/build/legacy/types").UseQueryResult<any, Error>;
5
5
  export default usePlugins;
@@ -1,5 +1,5 @@
1
1
  import { PluginData } from "@bunnyapp/common";
2
2
  export declare const useSigningPlugins: ({ apiHost, token, }: {
3
3
  apiHost: string;
4
- token: string;
4
+ token?: string | undefined;
5
5
  }) => PluginData[] | undefined;
@@ -1,2 +1,2 @@
1
- declare function useToken(): string;
1
+ declare function useToken(): string | undefined;
2
2
  export default useToken;
@@ -1,2 +1,2 @@
1
1
  export declare const getGraphQLBaseURL: (apiHost: string) => string;
2
- export declare const useGraphQLRequest: () => (query: string, token: string, apiHost: string, variables?: any) => Promise<unknown>;
2
+ export declare const useGraphQLRequest: () => (query: string, apiHost: string, token?: string, variables?: any) => Promise<unknown>;
package/dist/index.d.ts CHANGED
@@ -3,7 +3,6 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
3
3
  import { FormattedInvoice, FormattedQuote, FrontendTransaction, Quote as Quote$1, PluginData, TransactionKind } from '@bunnyapp/common';
4
4
  import * as react from 'react';
5
5
  import react__default from 'react';
6
- import { GraphQLClient } from 'graphql-request';
7
6
  import { QueryClient } from '@tanstack/react-query';
8
7
  import { ThemeConfig } from 'antd';
9
8
 
@@ -72,22 +71,15 @@ declare function Quotes({ className, columns, filter, filterQuotes, sort, noQuot
72
71
  noQuotesMessage?: string;
73
72
  }): react_jsx_runtime.JSX.Element;
74
73
 
75
- declare const PaymentMethod: ({ className, shadow, cardEnabled, useModal, }: {
76
- className?: string | undefined;
77
- shadow?: ShadowType | undefined;
78
- cardEnabled?: boolean | undefined;
79
- useModal?: boolean | undefined;
80
- }) => react_jsx_runtime.JSX.Element;
81
-
82
- declare const PaymentForm: ({ invoice, onFail, onPaymentSuccess, quote, accountId, onSavePaymentMethod, overrideToken, graphQLClient, customCheckoutFunction, currencyId: currencyIdFromProps, customPaymentForms, useAllPaymentPlugins, }: {
74
+ declare const PaymentForm: ({ invoice, onFail, onPaymentSuccess, quote, accountId, onSavePaymentMethod, onRemovePaymentMethod, overrideToken, customCheckoutFunction, currencyId: currencyIdFromProps, customPaymentForms, useAllPaymentPlugins, }: {
83
75
  invoice?: FormattedInvoice | undefined;
84
76
  quote?: Quote$1 | undefined;
85
77
  onFail: (error: any) => void;
86
78
  onPaymentSuccess?: (() => void) | undefined;
87
79
  onSavePaymentMethod?: (() => void) | undefined;
80
+ onRemovePaymentMethod?: (() => void) | undefined;
88
81
  accountId?: string | undefined;
89
82
  overrideToken?: string | undefined;
90
- graphQLClient: GraphQLClient;
91
83
  customCheckoutFunction?: ((plugin: PluginData | undefined) => Promise<any>) | undefined;
92
84
  currencyId?: string | undefined;
93
85
  customPaymentForms?: Record<string, react.ReactNode> | undefined;
@@ -118,7 +110,7 @@ declare function BunnyProvider({ children, darkMode, queryClient, apiHost, token
118
110
  darkMode?: boolean;
119
111
  queryClient?: QueryClient;
120
112
  apiHost: string;
121
- token: string;
113
+ token?: string;
122
114
  onTokenExpired?: () => void;
123
115
  configProviderProps?: ThemeConfig | undefined;
124
116
  }): react_jsx_runtime.JSX.Element;
@@ -200,4 +192,4 @@ declare const Footer: ({ className }: {
200
192
  className?: string | undefined;
201
193
  }) => react_jsx_runtime.JSX.Element;
202
194
 
203
- export { BillingDetails, BunnyProvider, Footer, Invoice, PaymentForm, PaymentMethod, Quote, Quotes, Signup, SubscriptionsWrapper as Subscriptions, Transactions };
195
+ export { BillingDetails, BunnyProvider, Footer, Invoice, PaymentForm, Quote, Quotes, Signup, SubscriptionsWrapper as Subscriptions, Transactions };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bunnyapp/components",
3
- "version": "1.0.55",
3
+ "version": "1.0.56-beta.0.1",
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,8 +0,0 @@
1
- import "../../../styles/index.less";
2
- import { ShadowType } from "../../../types/shadowType";
3
- export declare const PaymentMethod: ({ className, shadow, cardEnabled, useModal, }: {
4
- className?: string | undefined;
5
- shadow?: ShadowType | undefined;
6
- cardEnabled?: boolean | undefined;
7
- useModal?: boolean | undefined;
8
- }) => import("react/jsx-runtime").JSX.Element;
@@ -1,11 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/react";
2
- import { PaymentMethod } from "./PaymentMethod";
3
- declare const meta: Meta<typeof PaymentMethod>;
4
- export default meta;
5
- type Story = StoryObj<typeof meta>;
6
- export declare const Default: Story;
7
- export declare const CustomClassName: Story;
8
- export declare const NoShadow: Story;
9
- export declare const NoCard: Story;
10
- export declare const Mobile: Story;
11
- export declare const DarkMode: Story;
@@ -1 +0,0 @@
1
- export { PaymentMethod } from "./PaymentMethod";
@@ -1 +0,0 @@
1
- export declare const PLANS_TO_DISPLAY = 3;
@@ -1,2 +0,0 @@
1
- declare const getPortalPreviewData: (id: string, apiHost: string, token?: string) => Promise<any>;
2
- export default getPortalPreviewData;
@@ -1,8 +0,0 @@
1
- import "../../../styles/index.less";
2
- import { ShadowType } from "../../../types/shadowType";
3
- export declare const PaymentMethod: ({ className, shadow, cardEnabled, useModal, }: {
4
- className?: string | undefined;
5
- shadow?: ShadowType | undefined;
6
- cardEnabled?: boolean | undefined;
7
- useModal?: boolean | undefined;
8
- }) => import("react/jsx-runtime").JSX.Element;
@@ -1,11 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/react";
2
- import { PaymentMethod } from "./PaymentMethod";
3
- declare const meta: Meta<typeof PaymentMethod>;
4
- export default meta;
5
- type Story = StoryObj<typeof meta>;
6
- export declare const Default: Story;
7
- export declare const CustomClassName: Story;
8
- export declare const NoShadow: Story;
9
- export declare const NoCard: Story;
10
- export declare const Mobile: Story;
11
- export declare const DarkMode: Story;
@@ -1 +0,0 @@
1
- export { PaymentMethod } from "./PaymentMethod";
@@ -1 +0,0 @@
1
- export declare const PLANS_TO_DISPLAY = 3;
@@ -1,2 +0,0 @@
1
- declare const getPortalPreviewData: (id: string, apiHost: string, token?: string) => Promise<any>;
2
- export default getPortalPreviewData;