@bunnyapp/components 1.0.18 → 1.0.19

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 (38) hide show
  1. package/dist/cjs/index.js +487 -16022
  2. package/dist/cjs/src/components/BillingDetails/BillingDetails.d.ts +6 -2
  3. package/dist/cjs/src/components/Invoice/Invoice.d.ts +1 -0
  4. package/dist/cjs/src/components/LegacyInvoicePDF.d.ts +2 -1
  5. package/dist/cjs/src/components/PaymentForm/DemoPay/hooks/usePay.d.ts +3 -2
  6. package/dist/cjs/src/components/PaymentForm/PaymentForm.d.ts +3 -2
  7. package/dist/cjs/src/components/PaymentForm/Stripe/hooks/usePay.d.ts +3 -2
  8. package/dist/cjs/src/components/Quote/Quote.stories.d.ts +16 -15
  9. package/dist/cjs/src/components/Signup/PaymentForms.d.ts +4 -3
  10. package/dist/cjs/src/components/Signup/Signup.d.ts +1 -3
  11. package/dist/cjs/src/contexts/PaymentContext.d.ts +2 -1
  12. package/dist/cjs/src/graphql/mutations/billingDetailsUpdate.d.ts +6 -0
  13. package/dist/cjs/src/graphql/queries/getBillingDetails.d.ts +6 -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/cjs/src/types/billingDetails.d.ts +12 -0
  17. package/dist/esm/index.js +554 -16089
  18. package/dist/esm/src/components/BillingDetails/BillingDetails.d.ts +6 -2
  19. package/dist/esm/src/components/Invoice/Invoice.d.ts +1 -0
  20. package/dist/esm/src/components/LegacyInvoicePDF.d.ts +2 -1
  21. package/dist/esm/src/components/PaymentForm/DemoPay/hooks/usePay.d.ts +3 -2
  22. package/dist/esm/src/components/PaymentForm/PaymentForm.d.ts +3 -2
  23. package/dist/esm/src/components/PaymentForm/Stripe/hooks/usePay.d.ts +3 -2
  24. package/dist/esm/src/components/Quote/Quote.stories.d.ts +16 -15
  25. package/dist/esm/src/components/Signup/PaymentForms.d.ts +4 -3
  26. package/dist/esm/src/components/Signup/Signup.d.ts +1 -3
  27. package/dist/esm/src/contexts/PaymentContext.d.ts +2 -1
  28. package/dist/esm/src/graphql/mutations/billingDetailsUpdate.d.ts +6 -0
  29. package/dist/esm/src/graphql/queries/getBillingDetails.d.ts +6 -0
  30. package/dist/esm/src/hooks/usePaymentMethod.d.ts +1 -1
  31. package/dist/esm/src/hooks/useToken.d.ts +2 -0
  32. package/dist/esm/src/types/billingDetails.d.ts +12 -0
  33. package/dist/index.d.ts +8 -6
  34. package/package.json +1 -1
  35. package/dist/cjs/src/graphql/mutations/portalSessionCreate.d.ts +0 -8
  36. package/dist/cjs/src/graphql/queries/getAccount.d.ts +0 -7
  37. package/dist/esm/src/graphql/mutations/portalSessionCreate.d.ts +0 -8
  38. package/dist/esm/src/graphql/queries/getAccount.d.ts +0 -7
@@ -1,10 +1,14 @@
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, 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
+ hidePaymentMethodForm?: boolean | undefined;
9
+ countryListFilter?: ((country: {
10
+ value: string;
11
+ label: string;
12
+ }) => boolean) | undefined;
9
13
  }) => import("react/jsx-runtime").JSX.Element;
10
14
  export default BillingDetails;
@@ -1,2 +1,3 @@
1
1
  import { InvoiceQuoteContextProps } from "./InvoiceQuoteContext";
2
+ import "../../styles/index.less";
2
3
  export default function Invoice({ id, invoiceQuoteViewComponent, backButtonName, onBackButtonClick, onInvoiceDownloadError, onPaymentSuccess, entityId, shadow, className, hideDownloadButton, }: InvoiceQuoteContextProps): import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,5 @@
1
- export default function InvoicePDF({ invoiceUuid, apiHost, }: {
1
+ export default function InvoicePDF({ invoiceUuid, apiHost, token, }: {
2
2
  invoiceUuid?: string;
3
3
  apiHost: string;
4
+ token: string;
4
5
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,10 +1,11 @@
1
- import { FormattedInvoice, PaymentMethod, Quote } from "@bunnyapp/common";
2
- export declare function usePay({ onPaymentSuccess, onPaymentError, quote, invoice, storedPaymentMethod, }: {
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
7
  storedPaymentMethod?: PaymentMethod;
8
+ plugin: PluginData | undefined;
8
9
  }): {
9
10
  pay: () => Promise<void>;
10
11
  };
@@ -1,6 +1,6 @@
1
- import { FormattedInvoice, Quote } from "@bunnyapp/common";
1
+ import { FormattedInvoice, PluginData, Quote } from "@bunnyapp/common";
2
2
  import { GraphQLClient } from "graphql-request";
3
- 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, }: {
4
4
  entityId: string;
5
5
  invoice?: FormattedInvoice | undefined;
6
6
  quote?: Quote | undefined;
@@ -10,4 +10,5 @@ export declare const PaymentForm: ({ entityId, invoice, onFail, onPaymentSuccess
10
10
  accountId?: string | undefined;
11
11
  overrideToken?: string | undefined;
12
12
  graphQLClient: GraphQLClient;
13
+ customCheckoutFunction?: ((plugin: PluginData | undefined) => Promise<any>) | undefined;
13
14
  }) => import("react/jsx-runtime").JSX.Element;
@@ -1,10 +1,11 @@
1
- import { FormattedInvoice, PaymentMethod, Quote } from "@bunnyapp/common";
2
- export declare function usePay({ onPaymentSuccess, onPaymentError, quote, invoice, storedPaymentMethod, }: {
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
7
  storedPaymentMethod?: PaymentMethod;
8
+ plugin: PluginData | undefined;
8
9
  }): {
9
10
  pay: () => Promise<void>;
10
11
  };
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { Meta, StoryObj } from "@storybook/react";
2
3
  import Quote from "./Quote";
3
4
  declare const meta: Meta<typeof Quote>;
@@ -15,16 +16,16 @@ export declare const Default: import("@storybook/csf").StoryAnnotations<import("
15
16
  className?: string | undefined;
16
17
  hideDownloadButton?: boolean | undefined;
17
18
  }, {
19
+ id?: string | undefined;
20
+ entityId?: string | undefined;
18
21
  backButtonName?: string | undefined;
19
22
  onBackButtonClick?: (() => void) | undefined;
20
23
  shadow?: import("../../types/shadowType").ShadowType | undefined;
21
24
  hideDownloadButton?: boolean | undefined;
22
- id?: string | undefined;
23
25
  className?: string | undefined;
26
+ onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
24
27
  invoiceQuoteViewComponent?: import("react").ReactNode;
25
28
  onInvoiceDownloadError?: (() => void) | undefined;
26
- onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
27
- entityId?: string | undefined;
28
29
  }>;
29
30
  export declare const NoShadow: import("@storybook/csf").StoryAnnotations<import("@storybook/react/dist/types-a5624094").R, {
30
31
  id?: string | undefined;
@@ -38,16 +39,16 @@ export declare const NoShadow: import("@storybook/csf").StoryAnnotations<import(
38
39
  className?: string | undefined;
39
40
  hideDownloadButton?: boolean | undefined;
40
41
  }, {
42
+ id?: string | undefined;
43
+ entityId?: string | undefined;
41
44
  backButtonName?: string | undefined;
42
45
  onBackButtonClick?: (() => void) | undefined;
43
46
  shadow?: import("../../types/shadowType").ShadowType | undefined;
44
47
  hideDownloadButton?: boolean | undefined;
45
- id?: string | undefined;
46
48
  className?: string | undefined;
49
+ onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
47
50
  invoiceQuoteViewComponent?: import("react").ReactNode;
48
51
  onInvoiceDownloadError?: (() => void) | undefined;
49
- onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
50
- entityId?: string | undefined;
51
52
  }>;
52
53
  export declare const Mobile: import("@storybook/csf").StoryAnnotations<import("@storybook/react/dist/types-a5624094").R, {
53
54
  id?: string | undefined;
@@ -61,16 +62,16 @@ export declare const Mobile: import("@storybook/csf").StoryAnnotations<import("@
61
62
  className?: string | undefined;
62
63
  hideDownloadButton?: boolean | undefined;
63
64
  }, {
65
+ id?: string | undefined;
66
+ entityId?: string | undefined;
64
67
  backButtonName?: string | undefined;
65
68
  onBackButtonClick?: (() => void) | undefined;
66
69
  shadow?: import("../../types/shadowType").ShadowType | undefined;
67
70
  hideDownloadButton?: boolean | undefined;
68
- id?: string | undefined;
69
71
  className?: string | undefined;
72
+ onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
70
73
  invoiceQuoteViewComponent?: import("react").ReactNode;
71
74
  onInvoiceDownloadError?: (() => void) | undefined;
72
- onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
73
- entityId?: string | undefined;
74
75
  }>;
75
76
  export declare const CustomClassName: import("@storybook/csf").StoryAnnotations<import("@storybook/react/dist/types-a5624094").R, {
76
77
  id?: string | undefined;
@@ -84,16 +85,16 @@ export declare const CustomClassName: import("@storybook/csf").StoryAnnotations<
84
85
  className?: string | undefined;
85
86
  hideDownloadButton?: boolean | undefined;
86
87
  }, {
88
+ id?: string | undefined;
89
+ entityId?: string | undefined;
87
90
  backButtonName?: string | undefined;
88
91
  onBackButtonClick?: (() => void) | undefined;
89
92
  shadow?: import("../../types/shadowType").ShadowType | undefined;
90
93
  hideDownloadButton?: boolean | undefined;
91
- id?: string | undefined;
92
94
  className?: string | undefined;
95
+ onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
93
96
  invoiceQuoteViewComponent?: import("react").ReactNode;
94
97
  onInvoiceDownloadError?: (() => void) | undefined;
95
- onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
96
- entityId?: string | undefined;
97
98
  }>;
98
99
  export declare const HideDownloadButton: Story;
99
100
  export declare const AcceptedQuote: Story;
@@ -110,14 +111,14 @@ export declare const DarkMode: import("@storybook/csf").StoryAnnotations<import(
110
111
  className?: string | undefined;
111
112
  hideDownloadButton?: boolean | undefined;
112
113
  }, {
114
+ id?: string | undefined;
115
+ entityId?: string | undefined;
113
116
  backButtonName?: string | undefined;
114
117
  onBackButtonClick?: (() => void) | undefined;
115
118
  shadow?: import("../../types/shadowType").ShadowType | undefined;
116
119
  hideDownloadButton?: boolean | undefined;
117
- id?: string | undefined;
118
120
  className?: string | undefined;
121
+ onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
119
122
  invoiceQuoteViewComponent?: import("react").ReactNode;
120
123
  onInvoiceDownloadError?: (() => void) | undefined;
121
- onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
122
- entityId?: string | undefined;
123
124
  }>;
@@ -1,13 +1,14 @@
1
- import { Quote } from "@bunnyapp/common";
2
- 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, }: {
3
3
  quote?: Quote;
4
- handlePaymentSaveSuccess: () => void;
4
+ handlePaymentSuccess: () => void;
5
5
  handlePaymentFail: (error: any) => void;
6
6
  handleSubmit: (formData: FormData) => void;
7
7
  proceedingToPayment: boolean;
8
8
  entityId: string;
9
9
  accountId?: string;
10
10
  overrideToken?: string;
11
+ customCheckoutFunction?: (plugin: PluginData | undefined) => Promise<any>;
11
12
  }): import("react/jsx-runtime").JSX.Element;
12
13
  export type FormData = {
13
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,9 +1,10 @@
1
1
  /// <reference types="react" />
2
- import { PaymentMethod } from "@bunnyapp/common";
2
+ import { PaymentMethod, PluginData } from "@bunnyapp/common";
3
3
  export type PaymentContextValues = {
4
4
  onClickCancel?: () => void;
5
5
  accountId?: string;
6
6
  overrideToken?: string;
7
7
  storedPaymentMethod?: PaymentMethod;
8
+ customCheckoutFunction?: (plugin: PluginData | undefined) => Promise<any>;
8
9
  };
9
10
  export declare const PaymentContext: import("react").Context<PaymentContextValues>;
@@ -0,0 +1,6 @@
1
+ declare const billingDetailsUpdate: ({ attributes, token, apiHost, }: {
2
+ attributes: Record<string, string>;
3
+ token: string;
4
+ apiHost: string;
5
+ }) => Promise<any>;
6
+ export default billingDetailsUpdate;
@@ -0,0 +1,6 @@
1
+ import BillingDetails from "../../types/billingDetails";
2
+ declare const getBillingDetails: ({ token, apiHost, }: {
3
+ token: string;
4
+ apiHost: string;
5
+ }) => Promise<BillingDetails>;
6
+ export default getBillingDetails;
@@ -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;
@@ -0,0 +1,12 @@
1
+ export default interface BillingDetails {
2
+ name?: string;
3
+ billingCity?: string;
4
+ billingContact?: {
5
+ email?: string;
6
+ };
7
+ billingCountry?: string;
8
+ billingState?: string;
9
+ billingStreet?: string;
10
+ billingZip?: string;
11
+ taxNumber?: string;
12
+ }
package/dist/index.d.ts CHANGED
@@ -101,9 +101,7 @@ declare const Checkout: ({ entityId, onCancel, onSuccess, onFail, invoice, open,
101
101
 
102
102
  declare const getQuoteAmountDue: (quote: Quote$1) => number;
103
103
 
104
- declare function Signup({ apiToken, companyName, entityId, priceListCode, returnUrl, isCardEnabled, className, shadow, style, }: {
105
- /** The API token to use for the signup. Signup needs a Bunny api client token, not a portalSessionToken. */
106
- apiToken: string;
104
+ declare function Signup({ companyName, entityId, priceListCode, returnUrl, isCardEnabled, className, shadow, style, }: {
107
105
  /** The company name to display on the signup page */
108
106
  companyName: string;
109
107
  /** The entity ID to use for the signup */
@@ -185,14 +183,18 @@ declare const Subscriptions: ({ companyName, entityId, gap, shadow, showTitle, c
185
183
  className?: string | undefined;
186
184
  }) => react_jsx_runtime.JSX.Element;
187
185
 
188
- declare const BillingDetails: ({ entityId, accountId, isCardEnabled, shadow, className, }: {
186
+ declare const BillingDetails: ({ entityId, isCardEnabled, shadow, className, hidePaymentMethodForm, countryListFilter, }: {
189
187
  entityId: string;
190
- accountId: string;
191
188
  isCardEnabled?: boolean | undefined;
192
189
  shadow?: ShadowType | undefined;
193
190
  className?: string | undefined;
191
+ hidePaymentMethodForm?: boolean | undefined;
192
+ countryListFilter?: ((country: {
193
+ value: string;
194
+ label: string;
195
+ }) => boolean) | undefined;
194
196
  }) => react_jsx_runtime.JSX.Element;
195
197
 
196
- declare const usePaymentMethod: (graphQLClient: GraphQLClient, accountId?: string) => _tanstack_react_query_build_legacy_types.UseQueryResult<any, Error>;
198
+ declare const usePaymentMethod: (graphQLClient: GraphQLClient) => _tanstack_react_query_build_legacy_types.UseQueryResult<any, Error>;
197
199
 
198
200
  export { BillingDetails, BunnyProvider, Checkout, Invoice, PaymentMethod, Quote, Quotes, Signup, Subscriptions, Transactions, getQuoteAmountDue, usePaymentMethod };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bunnyapp/components",
3
- "version": "1.0.18",
3
+ "version": "1.0.19",
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
- declare const portalSessionCreate: ({ tenantCode, expiry, returnUrl, token, apiHost, }: {
2
- tenantCode: string;
3
- expiry: number;
4
- returnUrl: string;
5
- token: string;
6
- apiHost: string;
7
- }) => Promise<any>;
8
- export default portalSessionCreate;
@@ -1,7 +0,0 @@
1
- import { Account } from "@bunnyapp/common";
2
- declare const getAccount: ({ id, token, apiHost, }: {
3
- id?: string | undefined;
4
- token: string;
5
- apiHost: string;
6
- }) => Promise<Account>;
7
- export default getAccount;
@@ -1,8 +0,0 @@
1
- declare const portalSessionCreate: ({ tenantCode, expiry, returnUrl, token, apiHost, }: {
2
- tenantCode: string;
3
- expiry: number;
4
- returnUrl: string;
5
- token: string;
6
- apiHost: string;
7
- }) => Promise<any>;
8
- export default portalSessionCreate;
@@ -1,7 +0,0 @@
1
- import { Account } from "@bunnyapp/common";
2
- declare const getAccount: ({ id, token, apiHost, }: {
3
- id?: string | undefined;
4
- token: string;
5
- apiHost: string;
6
- }) => Promise<Account>;
7
- export default getAccount;