@bunnyapp/components 1.0.15 → 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.
@@ -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,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,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>;
@@ -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;
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,19 @@ 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, accountId: accountIdProp, 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
+ accountId?: string | undefined;
192
+ hidePaymentMethodForm?: boolean | undefined;
193
+ countryListFilter?: ((country: {
194
+ value: string;
195
+ label: string;
196
+ }) => boolean) | undefined;
194
197
  }) => react_jsx_runtime.JSX.Element;
195
198
 
196
- declare const usePaymentMethod: (graphQLClient: GraphQLClient, accountId?: string) => _tanstack_react_query_build_legacy_types.UseQueryResult<any, Error>;
199
+ declare const usePaymentMethod: (graphQLClient: GraphQLClient) => _tanstack_react_query_build_legacy_types.UseQueryResult<any, Error>;
197
200
 
198
201
  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.15",
3
+ "version": "1.0.16",
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",