@bunnyapp/components 1.0.14 → 1.0.16

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 (46) hide show
  1. package/dist/cjs/index.js +649 -814
  2. package/dist/cjs/src/components/BillingDetails/BillingDetails.d.ts +7 -2
  3. package/dist/cjs/src/components/PaymentForm/CheckoutFooter.d.ts +3 -4
  4. package/dist/cjs/src/components/PaymentForm/DemoPay/hooks/usePay.d.ts +5 -6
  5. package/dist/cjs/src/components/PaymentForm/PaymentForm.d.ts +4 -4
  6. package/dist/cjs/src/components/PaymentForm/PaymentFormTypes.d.ts +3 -28
  7. package/dist/cjs/src/components/PaymentForm/PaymentMethodDetails.d.ts +1 -2
  8. package/dist/cjs/src/components/PaymentForm/PaymentMethodSelector.d.ts +3 -3
  9. package/dist/cjs/src/components/PaymentForm/Stripe/StripeForm.d.ts +1 -1
  10. package/dist/cjs/src/components/PaymentForm/Stripe/hooks/usePay.d.ts +5 -5
  11. package/dist/cjs/src/components/Signup/PaymentForms.d.ts +4 -4
  12. package/dist/cjs/src/components/Signup/Signup.d.ts +1 -3
  13. package/dist/cjs/src/contexts/PaymentContext.d.ts +3 -0
  14. package/dist/cjs/src/hooks/usePaymentMethod.d.ts +1 -1
  15. package/dist/cjs/src/hooks/useToken.d.ts +2 -0
  16. package/dist/esm/index.js +652 -817
  17. package/dist/esm/src/components/BillingDetails/BillingDetails.d.ts +7 -2
  18. package/dist/esm/src/components/PaymentForm/CheckoutFooter.d.ts +3 -4
  19. package/dist/esm/src/components/PaymentForm/DemoPay/hooks/usePay.d.ts +5 -6
  20. package/dist/esm/src/components/PaymentForm/PaymentForm.d.ts +4 -4
  21. package/dist/esm/src/components/PaymentForm/PaymentFormTypes.d.ts +3 -28
  22. package/dist/esm/src/components/PaymentForm/PaymentMethodDetails.d.ts +1 -2
  23. package/dist/esm/src/components/PaymentForm/PaymentMethodSelector.d.ts +3 -3
  24. package/dist/esm/src/components/PaymentForm/Stripe/StripeForm.d.ts +1 -1
  25. package/dist/esm/src/components/PaymentForm/Stripe/hooks/usePay.d.ts +5 -5
  26. package/dist/esm/src/components/Signup/PaymentForms.d.ts +4 -4
  27. package/dist/esm/src/components/Signup/Signup.d.ts +1 -3
  28. package/dist/esm/src/contexts/PaymentContext.d.ts +3 -0
  29. package/dist/esm/src/hooks/usePaymentMethod.d.ts +1 -1
  30. package/dist/esm/src/hooks/useToken.d.ts +2 -0
  31. package/dist/index.d.ts +10 -9
  32. package/package.json +4 -3
  33. package/dist/cjs/src/components/Checkout/InvoiceCheckout.d.ts +0 -8
  34. package/dist/cjs/src/components/Transactions/DocumentNameEnum.d.ts +0 -4
  35. package/dist/cjs/src/components/icons/BunnyFooterIcon.d.ts +0 -4
  36. package/dist/cjs/src/consts/paymentConsts.d.ts +0 -16
  37. package/dist/cjs/src/graphql/mutations/quoteCreate.d.ts +0 -9
  38. package/dist/cjs/src/graphql/queries/getInvoice.d.ts +0 -7
  39. package/dist/cjs/src/graphql/queries/getSubscription.d.ts +0 -12
  40. package/dist/esm/src/components/Checkout/InvoiceCheckout.d.ts +0 -8
  41. package/dist/esm/src/components/Transactions/DocumentNameEnum.d.ts +0 -4
  42. package/dist/esm/src/components/icons/BunnyFooterIcon.d.ts +0 -4
  43. package/dist/esm/src/consts/paymentConsts.d.ts +0 -16
  44. package/dist/esm/src/graphql/mutations/quoteCreate.d.ts +0 -9
  45. package/dist/esm/src/graphql/queries/getInvoice.d.ts +0 -7
  46. package/dist/esm/src/graphql/queries/getSubscription.d.ts +0 -12
@@ -1,10 +1,15 @@
1
1
  import "../../styles/index.less";
2
2
  import { ShadowType } from "../../types/shadowType";
3
- declare const BillingDetails: ({ entityId, accountId, isCardEnabled, shadow, className, }: {
3
+ declare const BillingDetails: ({ entityId, isCardEnabled, shadow, className, accountId: accountIdProp, hidePaymentMethodForm, countryListFilter, }: {
4
4
  entityId: string;
5
- accountId: string;
6
5
  isCardEnabled?: boolean | undefined;
7
6
  shadow?: ShadowType | undefined;
8
7
  className?: string | undefined;
8
+ accountId?: string | undefined;
9
+ hidePaymentMethodForm?: boolean | undefined;
10
+ countryListFilter?: ((country: {
11
+ value: string;
12
+ label: string;
13
+ }) => boolean) | undefined;
9
14
  }) => import("react/jsx-runtime").JSX.Element;
10
15
  export default BillingDetails;
@@ -1,10 +1,9 @@
1
- import { FormattedInvoice, PaymentMethod, PluginData, Quote } from "@bunnyapp/common";
2
- import { OnPaymentSuccessType } from "./PaymentFormTypes";
1
+ import { FormattedInvoice, PluginData, Quote } from "@bunnyapp/common";
3
2
  declare const CheckoutFooter: ({ quote, invoice, onPaymentSuccess, noPadding, plugin, }: {
4
3
  quote?: Quote | undefined;
5
4
  invoice?: FormattedInvoice | undefined;
6
- onPaymentSuccess: ({ pluginPaymentResponse, savedPaymentMethodResponse, }: OnPaymentSuccessType) => void;
5
+ onPaymentSuccess: () => void;
7
6
  noPadding?: boolean | undefined;
8
- plugin: PluginData | PaymentMethod | undefined;
7
+ plugin: PluginData | undefined;
9
8
  }) => import("react/jsx-runtime").JSX.Element | null;
10
9
  export default CheckoutFooter;
@@ -1,13 +1,12 @@
1
- import { FormattedInvoice, PluginData, Quote } from "@bunnyapp/common";
2
- export declare function usePay({ onPaymentSuccess, onPaymentError, quote, invoice, }: {
1
+ import { FormattedInvoice, PaymentMethod, PluginData, Quote } from "@bunnyapp/common";
2
+ export declare function usePay({ onPaymentSuccess, onPaymentError, quote, invoice, storedPaymentMethod, plugin, }: {
3
3
  onPaymentSuccess: (response: any) => void;
4
4
  onPaymentError?: (error: any) => void;
5
5
  quote?: Quote;
6
6
  invoice?: FormattedInvoice;
7
+ storedPaymentMethod?: PaymentMethod;
8
+ plugin: PluginData | undefined;
7
9
  }): {
8
- pay: ({ plugin, savePaymentMethod, }: {
9
- plugin: PluginData;
10
- savePaymentMethod: boolean;
11
- }) => Promise<void>;
10
+ pay: () => Promise<void>;
12
11
  };
13
12
  export default usePay;
@@ -1,14 +1,14 @@
1
- import { FormattedInvoice, Quote } from "@bunnyapp/common";
2
- import { OnPaymentSuccessType } from "./PaymentFormTypes";
1
+ import { FormattedInvoice, PluginData, Quote } from "@bunnyapp/common";
3
2
  import { GraphQLClient } from "graphql-request";
4
- export declare const PaymentForm: ({ entityId, invoice, onFail, onPaymentSuccess, quote, accountId, onSavePaymentMethod, overrideToken, graphQLClient, }: {
3
+ export declare const PaymentForm: ({ entityId, invoice, onFail, onPaymentSuccess, quote, accountId, onSavePaymentMethod, overrideToken, graphQLClient, customCheckoutFunction, }: {
5
4
  entityId: string;
6
5
  invoice?: FormattedInvoice | undefined;
7
6
  quote?: Quote | undefined;
8
7
  onFail: (error: any) => void;
9
- onPaymentSuccess?: (({ pluginPaymentResponse, savedPaymentMethodResponse, }: OnPaymentSuccessType) => void) | undefined;
8
+ onPaymentSuccess?: (() => void) | undefined;
10
9
  onSavePaymentMethod?: (() => void) | undefined;
11
10
  accountId?: string | undefined;
12
11
  overrideToken?: string | undefined;
13
12
  graphQLClient: GraphQLClient;
13
+ customCheckoutFunction?: ((plugin: PluginData | undefined) => Promise<any>) | undefined;
14
14
  }) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
- import { Quote, FormattedInvoice, PluginData, PriceList, Payable, PaymentMethod } from "@bunnyapp/common";
1
+ import { Quote, FormattedInvoice, PluginData, PriceList } from "@bunnyapp/common";
2
2
  export type SavedPaymentMethodResponse = {
3
3
  paymentMethodId: string;
4
4
  };
@@ -8,40 +8,15 @@ export type PluginPaymentResponse = {
8
8
  savePaymentMethod?: boolean;
9
9
  token: string;
10
10
  };
11
- export interface StoredPaymentMethodFormProps extends GeneralPaymentFormProps {
12
- paymentMethod: PaymentMethod;
13
- }
14
- export interface PluginPaymentFormProps extends PluginFormProps {
15
- formData: any;
16
- }
17
- export interface PluginFormProps extends GeneralPaymentFormProps {
18
- plugin: PluginData;
19
- }
20
11
  export type InvoiceQuoteParentProps = {
21
- onSuccess: ({ savePaymentMethod }: {
22
- savePaymentMethod?: boolean;
23
- }) => void;
24
- onFail: (error: any) => void;
25
- };
26
- export type OnPaymentSuccessType = {
27
- pluginPaymentResponse?: PluginPaymentResponse;
28
- savedPaymentMethodResponse?: SavedPaymentMethodResponse;
29
- };
30
- export type GeneralPaymentFormProps = {
31
- entityId: string;
32
- payable?: Payable;
33
- invoice?: FormattedInvoice;
34
- quote?: Quote;
12
+ onSuccess: () => void;
35
13
  onFail: (error: any) => void;
36
- onPaymentSuccess: ({ pluginPaymentResponse, savedPaymentMethodResponse, }: OnPaymentSuccessType) => void;
37
14
  };
38
15
  export type CheckoutProps = {
39
16
  invoice?: FormattedInvoice;
40
17
  onCancel: () => void;
41
18
  onFail: (error: any) => void;
42
- onSuccess: ({ savePaymentMethod }: {
43
- savePaymentMethod?: boolean;
44
- }) => void;
19
+ onSuccess: () => void;
45
20
  open: boolean;
46
21
  quote?: Quote;
47
22
  selectedPriceList?: PriceList;
@@ -1,8 +1,7 @@
1
1
  import { PaymentMethod, PluginData } from "@bunnyapp/common";
2
- import { OnPaymentSuccessType } from "./PaymentFormTypes";
3
2
  declare const PaymentMethodDetails: ({ onFail, paymentMethod, onSavePaymentMethod, }: {
4
3
  onFail: (error: any) => void;
5
4
  paymentMethod: PaymentMethod | PluginData;
6
- onSavePaymentMethod: ({ pluginPaymentResponse, savedPaymentMethodResponse, }: OnPaymentSuccessType) => void;
5
+ onSavePaymentMethod: () => void;
7
6
  }) => import("react/jsx-runtime").JSX.Element | null;
8
7
  export default PaymentMethodDetails;
@@ -1,7 +1,7 @@
1
- import { PaymentMethod, PluginData } from "@bunnyapp/common";
1
+ import { PluginData } from "@bunnyapp/common";
2
2
  declare const PaymentMethodSelector: ({ paymentMethodAllowedPlugins, onSelect, value, }: {
3
- onSelect: (paymentMethod?: PluginData | PaymentMethod) => void;
3
+ onSelect: (paymentPlugin?: PluginData) => void;
4
4
  paymentMethodAllowedPlugins?: PluginData[] | undefined;
5
- value?: PluginData | PaymentMethod | null | undefined;
5
+ value?: PluginData | null | undefined;
6
6
  }) => import("react/jsx-runtime").JSX.Element;
7
7
  export default PaymentMethodSelector;
@@ -3,5 +3,5 @@ declare const StripeForm: ({ plugin, onFail, onSavePaymentMethod, }: {
3
3
  plugin: PluginData;
4
4
  onFail: (error: any) => void;
5
5
  onSavePaymentMethod: (response: any) => void;
6
- }) => import("react/jsx-runtime").JSX.Element | null;
6
+ }) => import("react/jsx-runtime").JSX.Element;
7
7
  export default StripeForm;
@@ -1,12 +1,12 @@
1
- import { FormattedInvoice, PluginData, Quote } from "@bunnyapp/common";
2
- export declare function usePay({ onPaymentSuccess, onPaymentError, quote, invoice, }: {
1
+ import { FormattedInvoice, PaymentMethod, PluginData, Quote } from "@bunnyapp/common";
2
+ export declare function usePay({ onPaymentSuccess, onPaymentError, quote, invoice, storedPaymentMethod, plugin, }: {
3
3
  onPaymentSuccess?: (response: any) => void;
4
4
  onPaymentError?: (error: any) => void;
5
5
  quote?: Quote;
6
6
  invoice?: FormattedInvoice;
7
+ storedPaymentMethod?: PaymentMethod;
8
+ plugin: PluginData | undefined;
7
9
  }): {
8
- pay: ({ plugin }: {
9
- plugin: PluginData;
10
- }) => Promise<void>;
10
+ pay: () => Promise<void>;
11
11
  };
12
12
  export default usePay;
@@ -1,14 +1,14 @@
1
- import { Quote } from "@bunnyapp/common";
2
- import { OnPaymentSuccessType } from "../PaymentForm/PaymentFormTypes";
3
- export default function PaymentForms({ quote, handlePaymentSaveSuccess, handlePaymentFail, handleSubmit, proceedingToPayment, entityId, accountId, overrideToken, }: {
1
+ import { PluginData, Quote } from "@bunnyapp/common";
2
+ export default function PaymentForms({ quote, handlePaymentSuccess, handlePaymentFail, handleSubmit, proceedingToPayment, entityId, accountId, overrideToken, customCheckoutFunction, }: {
4
3
  quote?: Quote;
5
- handlePaymentSaveSuccess: (paymentSuccess: OnPaymentSuccessType) => void;
4
+ handlePaymentSuccess: () => void;
6
5
  handlePaymentFail: (error: any) => void;
7
6
  handleSubmit: (formData: FormData) => void;
8
7
  proceedingToPayment: boolean;
9
8
  entityId: string;
10
9
  accountId?: string;
11
10
  overrideToken?: string;
11
+ customCheckoutFunction?: (plugin: PluginData | undefined) => Promise<any>;
12
12
  }): import("react/jsx-runtime").JSX.Element;
13
13
  export type FormData = {
14
14
  firstName: string;
@@ -1,9 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import "../../styles/index.less";
3
3
  import { ShadowType } from "../../types/shadowType";
4
- export default function Signup({ apiToken, companyName, entityId, priceListCode, returnUrl, isCardEnabled, className, shadow, style, }: {
5
- /** The API token to use for the signup. Signup needs a Bunny api client token, not a portalSessionToken. */
6
- apiToken: string;
4
+ export default function Signup({ companyName, entityId, priceListCode, returnUrl, isCardEnabled, className, shadow, style, }: {
7
5
  /** The company name to display on the signup page */
8
6
  companyName: string;
9
7
  /** The entity ID to use for the signup */
@@ -1,7 +1,10 @@
1
1
  /// <reference types="react" />
2
+ import { PaymentMethod, PluginData } from "@bunnyapp/common";
2
3
  export type PaymentContextValues = {
3
4
  onClickCancel?: () => void;
4
5
  accountId?: string;
5
6
  overrideToken?: string;
7
+ storedPaymentMethod?: PaymentMethod;
8
+ customCheckoutFunction?: (plugin: PluginData | undefined) => Promise<any>;
6
9
  };
7
10
  export declare const PaymentContext: import("react").Context<PaymentContextValues>;
@@ -1,2 +1,2 @@
1
1
  import { GraphQLClient } from "graphql-request";
2
- export declare const usePaymentMethod: (graphQLClient: GraphQLClient, accountId?: string) => import("@tanstack/react-query/build/legacy/types").UseQueryResult<any, Error>;
2
+ export declare const usePaymentMethod: (graphQLClient: GraphQLClient) => import("@tanstack/react-query/build/legacy/types").UseQueryResult<any, Error>;
@@ -0,0 +1,2 @@
1
+ declare function useToken(): string;
2
+ export default useToken;