@bunnyapp/components 1.0.13 → 1.0.15

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 (68) hide show
  1. package/dist/cjs/index.js +16297 -701
  2. package/dist/cjs/src/components/BunnyProvider.d.ts +3 -5
  3. package/dist/cjs/src/components/Invoice/Invoice.d.ts +1 -15
  4. package/dist/cjs/src/components/Invoice/InvoiceQuoteContext.d.ts +15 -0
  5. package/dist/cjs/src/components/PaymentForm/CheckoutFooter.d.ts +3 -4
  6. package/dist/cjs/src/components/PaymentForm/DemoPay/hooks/usePay.d.ts +4 -6
  7. package/dist/cjs/src/components/PaymentForm/PaymentForm.d.ts +5 -3
  8. package/dist/cjs/src/components/PaymentForm/PaymentFormTypes.d.ts +3 -28
  9. package/dist/cjs/src/components/PaymentForm/PaymentMethodDetails.d.ts +1 -2
  10. package/dist/cjs/src/components/PaymentForm/PaymentMethodSelector.d.ts +3 -3
  11. package/dist/cjs/src/components/PaymentForm/Stripe/StripeForm.d.ts +1 -1
  12. package/dist/cjs/src/components/PaymentForm/Stripe/hooks/usePay.d.ts +4 -5
  13. package/dist/cjs/src/components/Quote/Quote.d.ts +1 -1
  14. package/dist/cjs/src/components/Quote/Quote.stories.d.ts +25 -25
  15. package/dist/cjs/src/components/Quotes/Quotes.d.ts +5 -1
  16. package/dist/cjs/src/components/Signup/PaymentForms.d.ts +3 -3
  17. package/dist/cjs/src/components/Signup/Signup.d.ts +7 -1
  18. package/dist/cjs/src/components/Subscriptions/Subscriptions.d.ts +0 -10
  19. package/dist/cjs/src/components/Subscriptions/SubscriptionsContext.d.ts +10 -0
  20. package/dist/cjs/src/components/Transactions/Transactions.d.ts +11 -2
  21. package/dist/cjs/src/components/Transactions/TransactionsListContext.d.ts +3 -1
  22. package/dist/cjs/src/components/Transactions/transactionsList/TransactionsListDesktop.d.ts +1 -1
  23. package/dist/cjs/src/components/index.d.ts +1 -0
  24. package/dist/cjs/src/contexts/PaymentContext.d.ts +3 -0
  25. package/dist/cjs/src/graphql/graphqlUtil.d.ts +10 -0
  26. package/dist/cjs/src/graphql/queries/getTransactions.d.ts +2 -2
  27. package/dist/esm/index.js +16433 -839
  28. package/dist/esm/src/components/BunnyProvider.d.ts +3 -5
  29. package/dist/esm/src/components/Invoice/Invoice.d.ts +1 -15
  30. package/dist/esm/src/components/Invoice/InvoiceQuoteContext.d.ts +15 -0
  31. package/dist/esm/src/components/PaymentForm/CheckoutFooter.d.ts +3 -4
  32. package/dist/esm/src/components/PaymentForm/DemoPay/hooks/usePay.d.ts +4 -6
  33. package/dist/esm/src/components/PaymentForm/PaymentForm.d.ts +5 -3
  34. package/dist/esm/src/components/PaymentForm/PaymentFormTypes.d.ts +3 -28
  35. package/dist/esm/src/components/PaymentForm/PaymentMethodDetails.d.ts +1 -2
  36. package/dist/esm/src/components/PaymentForm/PaymentMethodSelector.d.ts +3 -3
  37. package/dist/esm/src/components/PaymentForm/Stripe/StripeForm.d.ts +1 -1
  38. package/dist/esm/src/components/PaymentForm/Stripe/hooks/usePay.d.ts +4 -5
  39. package/dist/esm/src/components/Quote/Quote.d.ts +1 -1
  40. package/dist/esm/src/components/Quote/Quote.stories.d.ts +25 -25
  41. package/dist/esm/src/components/Quotes/Quotes.d.ts +5 -1
  42. package/dist/esm/src/components/Signup/PaymentForms.d.ts +3 -3
  43. package/dist/esm/src/components/Signup/Signup.d.ts +7 -1
  44. package/dist/esm/src/components/Subscriptions/Subscriptions.d.ts +0 -10
  45. package/dist/esm/src/components/Subscriptions/SubscriptionsContext.d.ts +10 -0
  46. package/dist/esm/src/components/Transactions/Transactions.d.ts +11 -2
  47. package/dist/esm/src/components/Transactions/TransactionsListContext.d.ts +3 -1
  48. package/dist/esm/src/components/Transactions/transactionsList/TransactionsListDesktop.d.ts +1 -1
  49. package/dist/esm/src/components/index.d.ts +1 -0
  50. package/dist/esm/src/contexts/PaymentContext.d.ts +3 -0
  51. package/dist/esm/src/graphql/graphqlUtil.d.ts +10 -0
  52. package/dist/esm/src/graphql/queries/getTransactions.d.ts +2 -2
  53. package/dist/index.d.ts +41 -15
  54. package/package.json +4 -3
  55. package/dist/cjs/src/components/Checkout/InvoiceCheckout.d.ts +0 -8
  56. package/dist/cjs/src/components/Transactions/DocumentNameEnum.d.ts +0 -4
  57. package/dist/cjs/src/components/icons/BunnyFooterIcon.d.ts +0 -4
  58. package/dist/cjs/src/consts/paymentConsts.d.ts +0 -16
  59. package/dist/cjs/src/graphql/mutations/quoteCreate.d.ts +0 -9
  60. package/dist/cjs/src/graphql/queries/getInvoice.d.ts +0 -7
  61. package/dist/cjs/src/graphql/queries/getSubscription.d.ts +0 -12
  62. package/dist/esm/src/components/Checkout/InvoiceCheckout.d.ts +0 -8
  63. package/dist/esm/src/components/Transactions/DocumentNameEnum.d.ts +0 -4
  64. package/dist/esm/src/components/icons/BunnyFooterIcon.d.ts +0 -4
  65. package/dist/esm/src/consts/paymentConsts.d.ts +0 -16
  66. package/dist/esm/src/graphql/mutations/quoteCreate.d.ts +0 -9
  67. package/dist/esm/src/graphql/queries/getInvoice.d.ts +0 -7
  68. package/dist/esm/src/graphql/queries/getSubscription.d.ts +0 -12
@@ -1,25 +1,23 @@
1
1
  /// <reference types="react" />
2
2
  import { QueryClient } from "@tanstack/react-query";
3
+ import { ThemeConfig } from "antd";
3
4
  import { GraphQLClient } from "graphql-request";
4
5
  export type BunnyContextValues = {
5
6
  apiHost: string;
6
7
  graphQLClient: GraphQLClient;
7
- window: Window;
8
8
  token: string;
9
- accountId?: string;
10
9
  displayPayButtonNameAnyways?: boolean;
11
10
  darkMode?: boolean;
12
11
  onTokenExpired?: () => void;
13
12
  };
14
13
  export declare const BunnyContext: import("react").Context<BunnyContextValues>;
15
- declare function BunnyProvider({ accountId, children, darkMode, queryClient, apiHost, token, window, onTokenExpired, }: {
16
- accountId?: string;
14
+ declare function BunnyProvider({ children, darkMode, queryClient, apiHost, token, onTokenExpired, configProviderProps, }: {
17
15
  children: React.ReactNode;
18
16
  darkMode?: boolean;
19
17
  queryClient?: QueryClient;
20
18
  apiHost: string;
21
19
  token: string;
22
- window: Window;
23
20
  onTokenExpired?: () => void;
21
+ configProviderProps?: ThemeConfig | undefined;
24
22
  }): import("react/jsx-runtime").JSX.Element;
25
23
  export default BunnyProvider;
@@ -1,16 +1,2 @@
1
- import React from "react";
2
- import { ShadowType } from "../../types/shadowType";
3
- export type InvoiceQuoteContextProps = {
4
- id?: string;
5
- invoiceQuoteViewComponent?: React.ReactNode;
6
- backButtonName?: string;
7
- onBackButtonClick?: () => void;
8
- onInvoiceDownloadError?: () => void;
9
- onPaymentSuccess?: (savePaymentMethod?: boolean) => void;
10
- entityId: string;
11
- shadow?: ShadowType;
12
- className?: string;
13
- hideDownloadButton?: boolean;
14
- };
15
- export declare const InvoiceQuoteContext: React.Context<InvoiceQuoteContextProps>;
1
+ import { InvoiceQuoteContextProps } from "./InvoiceQuoteContext";
16
2
  export default function Invoice({ id, invoiceQuoteViewComponent, backButtonName, onBackButtonClick, onInvoiceDownloadError, onPaymentSuccess, entityId, shadow, className, hideDownloadButton, }: InvoiceQuoteContextProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,15 @@
1
+ /// <reference types="react" />
2
+ import { ShadowType } from "../../types/shadowType";
3
+ export type InvoiceQuoteContextProps = {
4
+ id?: string;
5
+ invoiceQuoteViewComponent?: React.ReactNode;
6
+ backButtonName?: string;
7
+ onBackButtonClick?: () => void;
8
+ onInvoiceDownloadError?: () => void;
9
+ onPaymentSuccess?: (savePaymentMethod?: boolean) => void;
10
+ entityId: string;
11
+ shadow?: ShadowType;
12
+ className?: string;
13
+ hideDownloadButton?: boolean;
14
+ };
15
+ export declare const InvoiceQuoteContext: import("react").Context<InvoiceQuoteContextProps>;
@@ -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,11 @@
1
- import { FormattedInvoice, PluginData, Quote } from "@bunnyapp/common";
2
- export declare function usePay({ onPaymentSuccess, onPaymentError, quote, invoice, }: {
1
+ import { FormattedInvoice, PaymentMethod, Quote } from "@bunnyapp/common";
2
+ export declare function usePay({ onPaymentSuccess, onPaymentError, quote, invoice, storedPaymentMethod, }: {
3
3
  onPaymentSuccess: (response: any) => void;
4
4
  onPaymentError?: (error: any) => void;
5
5
  quote?: Quote;
6
6
  invoice?: FormattedInvoice;
7
+ storedPaymentMethod?: PaymentMethod;
7
8
  }): {
8
- pay: ({ plugin, savePaymentMethod, }: {
9
- plugin: PluginData;
10
- savePaymentMethod: boolean;
11
- }) => Promise<void>;
9
+ pay: () => Promise<void>;
12
10
  };
13
11
  export default usePay;
@@ -1,11 +1,13 @@
1
1
  import { FormattedInvoice, Quote } from "@bunnyapp/common";
2
- import { OnPaymentSuccessType } from "./PaymentFormTypes";
3
- export declare const PaymentForm: ({ entityId, invoice, onFail, onPaymentSuccess, quote, accountId, onSavePaymentMethod, }: {
2
+ import { GraphQLClient } from "graphql-request";
3
+ export declare const PaymentForm: ({ entityId, invoice, onFail, onPaymentSuccess, quote, accountId, onSavePaymentMethod, overrideToken, graphQLClient, }: {
4
4
  entityId: string;
5
5
  invoice?: FormattedInvoice | undefined;
6
6
  quote?: Quote | undefined;
7
7
  onFail: (error: any) => void;
8
- onPaymentSuccess?: (({ pluginPaymentResponse, savedPaymentMethodResponse, }: OnPaymentSuccessType) => void) | undefined;
8
+ onPaymentSuccess?: (() => void) | undefined;
9
9
  onSavePaymentMethod?: (() => void) | undefined;
10
10
  accountId?: string | undefined;
11
+ overrideToken?: string | undefined;
12
+ graphQLClient: GraphQLClient;
11
13
  }) => 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,11 @@
1
- import { FormattedInvoice, PluginData, Quote } from "@bunnyapp/common";
2
- export declare function usePay({ onPaymentSuccess, onPaymentError, quote, invoice, }: {
1
+ import { FormattedInvoice, PaymentMethod, Quote } from "@bunnyapp/common";
2
+ export declare function usePay({ onPaymentSuccess, onPaymentError, quote, invoice, storedPaymentMethod, }: {
3
3
  onPaymentSuccess?: (response: any) => void;
4
4
  onPaymentError?: (error: any) => void;
5
5
  quote?: Quote;
6
6
  invoice?: FormattedInvoice;
7
+ storedPaymentMethod?: PaymentMethod;
7
8
  }): {
8
- pay: ({ plugin }: {
9
- plugin: PluginData;
10
- }) => Promise<void>;
9
+ pay: () => Promise<void>;
11
10
  };
12
11
  export default usePay;
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
- import { InvoiceQuoteContextProps } from "../Invoice/Invoice";
2
+ import { InvoiceQuoteContextProps } from "../Invoice/InvoiceQuoteContext";
3
3
  export declare const MarkupContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
4
4
  export default function Quote({ id, invoiceQuoteViewComponent, onInvoiceDownloadError, onPaymentSuccess, entityId, shadow, className, hideDownloadButton, }: InvoiceQuoteContextProps): import("react/jsx-runtime").JSX.Element;
@@ -18,14 +18,14 @@ export declare const Default: import("@storybook/csf").StoryAnnotations<import("
18
18
  }, {
19
19
  id?: string | undefined;
20
20
  entityId?: string | undefined;
21
+ backButtonName?: string | undefined;
22
+ onBackButtonClick?: (() => void) | undefined;
23
+ shadow?: import("../../types/shadowType").ShadowType | undefined;
24
+ hideDownloadButton?: boolean | undefined;
21
25
  className?: string | undefined;
26
+ onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
22
27
  invoiceQuoteViewComponent?: import("react").ReactNode;
23
28
  onInvoiceDownloadError?: (() => void) | undefined;
24
- onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
25
- shadow?: import("../../types/shadowType").ShadowType | undefined;
26
- hideDownloadButton?: boolean | undefined;
27
- backButtonName?: string | undefined;
28
- onBackButtonClick?: (() => void) | undefined;
29
29
  }>;
30
30
  export declare const NoShadow: import("@storybook/csf").StoryAnnotations<import("@storybook/react/dist/types-a5624094").R, {
31
31
  id?: string | undefined;
@@ -41,14 +41,14 @@ export declare const NoShadow: import("@storybook/csf").StoryAnnotations<import(
41
41
  }, {
42
42
  id?: string | undefined;
43
43
  entityId?: string | undefined;
44
+ backButtonName?: string | undefined;
45
+ onBackButtonClick?: (() => void) | undefined;
46
+ shadow?: import("../../types/shadowType").ShadowType | undefined;
47
+ hideDownloadButton?: boolean | undefined;
44
48
  className?: string | undefined;
49
+ onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
45
50
  invoiceQuoteViewComponent?: import("react").ReactNode;
46
51
  onInvoiceDownloadError?: (() => void) | undefined;
47
- onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
48
- shadow?: import("../../types/shadowType").ShadowType | undefined;
49
- hideDownloadButton?: boolean | undefined;
50
- backButtonName?: string | undefined;
51
- onBackButtonClick?: (() => void) | undefined;
52
52
  }>;
53
53
  export declare const Mobile: import("@storybook/csf").StoryAnnotations<import("@storybook/react/dist/types-a5624094").R, {
54
54
  id?: string | undefined;
@@ -64,14 +64,14 @@ export declare const Mobile: import("@storybook/csf").StoryAnnotations<import("@
64
64
  }, {
65
65
  id?: string | undefined;
66
66
  entityId?: string | undefined;
67
+ backButtonName?: string | undefined;
68
+ onBackButtonClick?: (() => void) | undefined;
69
+ shadow?: import("../../types/shadowType").ShadowType | undefined;
70
+ hideDownloadButton?: boolean | undefined;
67
71
  className?: string | undefined;
72
+ onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
68
73
  invoiceQuoteViewComponent?: import("react").ReactNode;
69
74
  onInvoiceDownloadError?: (() => void) | undefined;
70
- onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
71
- shadow?: import("../../types/shadowType").ShadowType | undefined;
72
- hideDownloadButton?: boolean | undefined;
73
- backButtonName?: string | undefined;
74
- onBackButtonClick?: (() => void) | undefined;
75
75
  }>;
76
76
  export declare const CustomClassName: import("@storybook/csf").StoryAnnotations<import("@storybook/react/dist/types-a5624094").R, {
77
77
  id?: string | undefined;
@@ -87,14 +87,14 @@ export declare const CustomClassName: import("@storybook/csf").StoryAnnotations<
87
87
  }, {
88
88
  id?: string | undefined;
89
89
  entityId?: string | undefined;
90
+ backButtonName?: string | undefined;
91
+ onBackButtonClick?: (() => void) | undefined;
92
+ shadow?: import("../../types/shadowType").ShadowType | undefined;
93
+ hideDownloadButton?: boolean | undefined;
90
94
  className?: string | undefined;
95
+ onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
91
96
  invoiceQuoteViewComponent?: import("react").ReactNode;
92
97
  onInvoiceDownloadError?: (() => void) | undefined;
93
- onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
94
- shadow?: import("../../types/shadowType").ShadowType | undefined;
95
- hideDownloadButton?: boolean | undefined;
96
- backButtonName?: string | undefined;
97
- onBackButtonClick?: (() => void) | undefined;
98
98
  }>;
99
99
  export declare const HideDownloadButton: Story;
100
100
  export declare const AcceptedQuote: Story;
@@ -113,12 +113,12 @@ export declare const DarkMode: import("@storybook/csf").StoryAnnotations<import(
113
113
  }, {
114
114
  id?: string | undefined;
115
115
  entityId?: string | undefined;
116
+ backButtonName?: string | undefined;
117
+ onBackButtonClick?: (() => void) | undefined;
118
+ shadow?: import("../../types/shadowType").ShadowType | undefined;
119
+ hideDownloadButton?: boolean | undefined;
116
120
  className?: string | undefined;
121
+ onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
117
122
  invoiceQuoteViewComponent?: import("react").ReactNode;
118
123
  onInvoiceDownloadError?: (() => void) | undefined;
119
- onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
120
- shadow?: import("../../types/shadowType").ShadowType | undefined;
121
- hideDownloadButton?: boolean | undefined;
122
- backButtonName?: string | undefined;
123
- onBackButtonClick?: (() => void) | undefined;
124
124
  }>;
@@ -2,7 +2,7 @@
2
2
  import { FrontendTransaction as T } from "@bunnyapp/common";
3
3
  import { ShadowType } from "../../types/shadowType";
4
4
  import { TransactionListColumnType } from "../Transactions/transactionsList/TransactionsListDesktop";
5
- declare function Quotes({ className, columns, entityId, filter, noQuotesMessage, onQuoteClick, quoteComponent, searchBarClassName, shadow, showSearchBar, showTitle, title, style, suppressQuoteDisplay, useModal, }: {
5
+ declare function Quotes({ className, columns, entityId, filter, filterQuotes, sort, noQuotesMessage, onQuoteClick, quoteComponent, searchBarClassName, shadow, showSearchBar, showTitle, title, style, suppressQuoteDisplay, useModal, }: {
6
6
  /** A custom component to render instead of the default invoice component */
7
7
  quoteComponent?: React.ReactNode;
8
8
  /** Whether to show the search bar */
@@ -29,6 +29,10 @@ declare function Quotes({ className, columns, entityId, filter, noQuotesMessage,
29
29
  style?: React.CSSProperties;
30
30
  /** A filter to apply to the quotes. Docs on filter: https://docs.bunny.com/developer/getting-started/using-filters-in-queries */
31
31
  filter?: string;
32
+ /** A function to filter the quotes. Runs on the client side. */
33
+ filterQuotes?: (quote: T.Transaction) => boolean;
34
+ /** A function to sort the quotes. Runs on the client side. */
35
+ sort?: (a: T.Transaction, b: T.Transaction) => number;
32
36
  /** Message to display when there are no quotes */
33
37
  noQuotesMessage?: string;
34
38
  entityId: string;
@@ -1,13 +1,13 @@
1
1
  import { Quote } from "@bunnyapp/common";
2
- import { OnPaymentSuccessType } from "../PaymentForm/PaymentFormTypes";
3
- export default function PaymentForms({ quote, handlePaymentSaveSuccess, handlePaymentFail, handleSubmit, proceedingToPayment, entityId, accountId, }: {
2
+ export default function PaymentForms({ quote, handlePaymentSaveSuccess, handlePaymentFail, handleSubmit, proceedingToPayment, entityId, accountId, overrideToken, }: {
4
3
  quote?: Quote;
5
- handlePaymentSaveSuccess: (paymentSuccess: OnPaymentSuccessType) => void;
4
+ handlePaymentSaveSuccess: () => 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;
10
+ overrideToken?: string;
11
11
  }): import("react/jsx-runtime").JSX.Element;
12
12
  export type FormData = {
13
13
  firstName: string;
@@ -1,10 +1,16 @@
1
1
  /// <reference types="react" />
2
2
  import "../../styles/index.less";
3
3
  import { ShadowType } from "../../types/shadowType";
4
- export default function Signup({ companyName, entityId, priceListCode, returnUrl, isCardEnabled, className, shadow, style, }: {
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;
7
+ /** The company name to display on the signup page */
5
8
  companyName: string;
9
+ /** The entity ID to use for the signup */
6
10
  entityId: string;
11
+ /** The price list code to use for the signup */
7
12
  priceListCode: string;
13
+ /** The return URL to that customers can be redirected to after signup */
8
14
  returnUrl?: string;
9
15
  /** Whether or not to display signup within a card */
10
16
  isCardEnabled?: boolean;
@@ -1,14 +1,4 @@
1
- /// <reference types="react" />
2
1
  import "../../styles/index.less";
3
- export type SubscriptionsContextValues = {
4
- onChangePlanClick: () => void;
5
- onClickUpgrade: () => void;
6
- isTempViewOnly: boolean;
7
- shadow?: "none" | "sm" | "md" | "lg";
8
- gap?: number;
9
- showTitle?: boolean;
10
- };
11
- export declare const SubscriptionsContext: import("react").Context<SubscriptionsContextValues>;
12
2
  export type EditingQuoteDataType = {
13
3
  id: string;
14
4
  isTrial: boolean;
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ export type SubscriptionsContextValues = {
3
+ onChangePlanClick: () => void;
4
+ onClickUpgrade: () => void;
5
+ isTempViewOnly: boolean;
6
+ shadow?: "none" | "sm" | "md" | "lg";
7
+ gap?: number;
8
+ showTitle?: boolean;
9
+ };
10
+ export declare const SubscriptionsContext: import("react").Context<SubscriptionsContextValues>;
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { FrontendTransaction as T, TransactionKind } from "@bunnyapp/common";
3
3
  import { ShadowType } from "../../types/shadowType";
4
- export default function Transactions({ transactionComponent, showSearchBar, showTitle, title, columns, className, shadow, searchBarClassName, useModal, onTransactionClick, suppressTransactionDisplay, kindsToShow, style, filter, noTransactionsMessage, entityId, }: {
4
+ export default function Transactions({ transactionComponent, showSearchBar, showTitle, title, columns, className, shadow, searchBarClassName, useModal, onTransactionClick, suppressTransactionDisplay, kindsToShow, style, filter, noTransactionsMessage, entityId, filterTransactions, sortTransactions, }: {
5
5
  /** A custom component to render instead of the default invoice component */
6
6
  transactionComponent?: React.ReactNode;
7
7
  /** Whether to show the search bar */
@@ -28,12 +28,21 @@ export default function Transactions({ transactionComponent, showSearchBar, show
28
28
  kindsToShow?: TransactionKind[];
29
29
  /** A custom style to apply to the component */
30
30
  style?: React.CSSProperties;
31
- /** A filter to apply to the transactions. Docs on filter: https://docs.bunny.com/developer/getting-started/using-filters-in-queries */
31
+ /** A filter to apply to the transactions. Docs on filter: https://docs.bunny.com/developer/getting-started/using-filters-in-queries
32
+ * Filtering is applied on the api side, potentially speeding up the transactions query
33
+ */
32
34
  filter?: string;
33
35
  /** Message to display when there are no transactions */
34
36
  noTransactionsMessage?: string;
35
37
  /** The entity id to pass to the invoice component */
36
38
  entityId: string;
39
+ /** A function to filter the transactions
40
+ * Filtering is applied on the client side.
41
+ * This is useful to have more control over the filtering logic.
42
+ */
43
+ filterTransactions?: (transaction: T.Transaction) => boolean;
44
+ /** A function to sort the transactions. Runs on the client side. */
45
+ sortTransactions?: (transactionA: T.Transaction, transactionB: T.Transaction) => number;
37
46
  }): import("react/jsx-runtime").JSX.Element;
38
47
  export declare function TransactionsDisplay({ transactions, onSearchValueChanged, search, }: {
39
48
  transactions: T.Transaction[];
@@ -16,11 +16,13 @@ export type TransactionsContextValues = {
16
16
  onTransactionClick?: (transaction: T.Transaction) => void;
17
17
  onTransactionDisplayClose?: (transaction: T.Transaction | null) => void;
18
18
  suppressTransactionDisplay?: boolean;
19
- kindsToShow: TransactionKind[];
19
+ kindsToShow?: TransactionKind[];
20
20
  style?: React.CSSProperties;
21
21
  filter?: string;
22
22
  noTransactionsMessage?: string;
23
23
  downloadTransactionLink?: (id: string) => string;
24
24
  entityId: string;
25
+ filterTransactions?: (transaction: T.Transaction) => boolean;
26
+ sortTransactions?: (transactionA: T.Transaction, transactionB: T.Transaction) => number;
25
27
  };
26
28
  export declare const TransactionsListContext: import("react").Context<TransactionsContextValues>;
@@ -1,4 +1,4 @@
1
- import { FrontendTransaction as T } from "@bunnyapp/common";
1
+ import { FrontendTransaction as T, Transaction } from "@bunnyapp/common";
2
2
  export type TransactionListColumnType = "date-and-title" | "state" | "amount" | "download";
3
3
  declare const TransactionsListDesktop: ({ transactions, onTransactionClick, }: {
4
4
  transactions: T.Transaction[];
@@ -7,3 +7,4 @@ export { Signup } from "./Signup";
7
7
  export { default as BunnyProvider } from "./BunnyProvider";
8
8
  export { default as Transactions } from "./Transactions";
9
9
  export { Subscriptions } from "./Subscriptions";
10
+ export { BillingDetails } from "./BillingDetails";
@@ -1,6 +1,9 @@
1
1
  /// <reference types="react" />
2
+ import { PaymentMethod } from "@bunnyapp/common";
2
3
  export type PaymentContextValues = {
3
4
  onClickCancel?: () => void;
4
5
  accountId?: string;
6
+ overrideToken?: string;
7
+ storedPaymentMethod?: PaymentMethod;
5
8
  };
6
9
  export declare const PaymentContext: import("react").Context<PaymentContextValues>;
@@ -0,0 +1,10 @@
1
+ type gqlRequestOptions = {
2
+ query: string;
3
+ vars?: Record<string, any>;
4
+ headers?: Record<string, string>;
5
+ token: string;
6
+ isInPreviewMode?: boolean;
7
+ apiHost: string;
8
+ };
9
+ export declare const gqlRequest: ({ query, vars, headers, token, isInPreviewMode, apiHost, }: gqlRequestOptions) => Promise<unknown>;
10
+ export {};
@@ -1,3 +1,3 @@
1
- import { TransactionKind } from "@bunnyapp/common";
2
- declare const getTransactions: (filter: string, token: string, apiHost: string, kindsToShow: TransactionKind[]) => Promise<any>;
1
+ import { FrontendTransaction as T } from "@bunnyapp/common";
2
+ declare const getTransactions: (filter: string, token: string, apiHost: string) => Promise<T.Transaction[]>;
3
3
  export default getTransactions;
package/dist/index.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  /// <reference types="react" />
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
- import React$1 from 'react';
4
3
  import { FrontendTransaction, FormattedInvoice, Quote as Quote$1, PriceList, PaymentMethod as PaymentMethod$1, TransactionKind } from '@bunnyapp/common';
5
4
  import { QueryClient } from '@tanstack/react-query';
5
+ import { ThemeConfig } from 'antd';
6
+ import react from 'react';
6
7
  import * as _tanstack_react_query_build_legacy_types from '@tanstack/react-query/build/legacy/types';
7
8
  import { GraphQLClient } from 'graphql-request';
8
9
 
@@ -10,7 +11,7 @@ type ShadowType = "shadow-none" | "shadow-sm" | "shadow-md" | "shadow-lg" | "sha
10
11
 
11
12
  type InvoiceQuoteContextProps = {
12
13
  id?: string;
13
- invoiceQuoteViewComponent?: React$1.ReactNode;
14
+ invoiceQuoteViewComponent?: React.ReactNode;
14
15
  backButtonName?: string;
15
16
  onBackButtonClick?: () => void;
16
17
  onInvoiceDownloadError?: () => void;
@@ -20,6 +21,7 @@ type InvoiceQuoteContextProps = {
20
21
  className?: string;
21
22
  hideDownloadButton?: boolean;
22
23
  };
24
+
23
25
  declare function Invoice({ id, invoiceQuoteViewComponent, backButtonName, onBackButtonClick, onInvoiceDownloadError, onPaymentSuccess, entityId, shadow, className, hideDownloadButton, }: InvoiceQuoteContextProps): react_jsx_runtime.JSX.Element;
24
26
 
25
27
  declare global {
@@ -34,7 +36,7 @@ declare function Quote({ id, invoiceQuoteViewComponent, onInvoiceDownloadError,
34
36
 
35
37
  type TransactionListColumnType = "date-and-title" | "state" | "amount" | "download";
36
38
 
37
- declare function Quotes({ className, columns, entityId, filter, noQuotesMessage, onQuoteClick, quoteComponent, searchBarClassName, shadow, showSearchBar, showTitle, title, style, suppressQuoteDisplay, useModal, }: {
39
+ declare function Quotes({ className, columns, entityId, filter, filterQuotes, sort, noQuotesMessage, onQuoteClick, quoteComponent, searchBarClassName, shadow, showSearchBar, showTitle, title, style, suppressQuoteDisplay, useModal, }: {
38
40
  /** A custom component to render instead of the default invoice component */
39
41
  quoteComponent?: React.ReactNode;
40
42
  /** Whether to show the search bar */
@@ -61,6 +63,10 @@ declare function Quotes({ className, columns, entityId, filter, noQuotesMessage,
61
63
  style?: React.CSSProperties;
62
64
  /** A filter to apply to the quotes. Docs on filter: https://docs.bunny.com/developer/getting-started/using-filters-in-queries */
63
65
  filter?: string;
66
+ /** A function to filter the quotes. Runs on the client side. */
67
+ filterQuotes?: (quote: FrontendTransaction.Transaction) => boolean;
68
+ /** A function to sort the quotes. Runs on the client side. */
69
+ sort?: (a: FrontendTransaction.Transaction, b: FrontendTransaction.Transaction) => number;
64
70
  /** Message to display when there are no quotes */
65
71
  noQuotesMessage?: string;
66
72
  entityId: string;
@@ -77,9 +83,7 @@ type CheckoutProps = {
77
83
  invoice?: FormattedInvoice;
78
84
  onCancel: () => void;
79
85
  onFail: (error: any) => void;
80
- onSuccess: ({ savePaymentMethod }: {
81
- savePaymentMethod?: boolean;
82
- }) => void;
86
+ onSuccess: () => void;
83
87
  open: boolean;
84
88
  quote?: Quote$1;
85
89
  selectedPriceList?: PriceList;
@@ -97,10 +101,16 @@ declare const Checkout: ({ entityId, onCancel, onSuccess, onFail, invoice, open,
97
101
 
98
102
  declare const getQuoteAmountDue: (quote: Quote$1) => number;
99
103
 
100
- declare function Signup({ companyName, entityId, priceListCode, returnUrl, isCardEnabled, className, shadow, style, }: {
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;
107
+ /** The company name to display on the signup page */
101
108
  companyName: string;
109
+ /** The entity ID to use for the signup */
102
110
  entityId: string;
111
+ /** The price list code to use for the signup */
103
112
  priceListCode: string;
113
+ /** The return URL to that customers can be redirected to after signup */
104
114
  returnUrl?: string;
105
115
  /** Whether or not to display signup within a card */
106
116
  isCardEnabled?: boolean;
@@ -112,20 +122,19 @@ declare function Signup({ companyName, entityId, priceListCode, returnUrl, isCar
112
122
  style?: React.CSSProperties;
113
123
  }): react_jsx_runtime.JSX.Element;
114
124
 
115
- declare function BunnyProvider({ accountId, children, darkMode, queryClient, apiHost, token, window, onTokenExpired, }: {
116
- accountId?: string;
125
+ declare function BunnyProvider({ children, darkMode, queryClient, apiHost, token, onTokenExpired, configProviderProps, }: {
117
126
  children: React.ReactNode;
118
127
  darkMode?: boolean;
119
128
  queryClient?: QueryClient;
120
129
  apiHost: string;
121
130
  token: string;
122
- window: Window;
123
131
  onTokenExpired?: () => void;
132
+ configProviderProps?: ThemeConfig | undefined;
124
133
  }): react_jsx_runtime.JSX.Element;
125
134
 
126
- declare function Transactions({ transactionComponent, showSearchBar, showTitle, title, columns, className, shadow, searchBarClassName, useModal, onTransactionClick, suppressTransactionDisplay, kindsToShow, style, filter, noTransactionsMessage, entityId, }: {
135
+ declare function Transactions({ transactionComponent, showSearchBar, showTitle, title, columns, className, shadow, searchBarClassName, useModal, onTransactionClick, suppressTransactionDisplay, kindsToShow, style, filter, noTransactionsMessage, entityId, filterTransactions, sortTransactions, }: {
127
136
  /** A custom component to render instead of the default invoice component */
128
- transactionComponent?: React$1.ReactNode;
137
+ transactionComponent?: react.ReactNode;
129
138
  /** Whether to show the search bar */
130
139
  showSearchBar?: boolean;
131
140
  /** Whether to show the title */
@@ -149,13 +158,22 @@ declare function Transactions({ transactionComponent, showSearchBar, showTitle,
149
158
  /** The kinds of transactions to show */
150
159
  kindsToShow?: TransactionKind[];
151
160
  /** A custom style to apply to the component */
152
- style?: React$1.CSSProperties;
153
- /** A filter to apply to the transactions. Docs on filter: https://docs.bunny.com/developer/getting-started/using-filters-in-queries */
161
+ style?: react.CSSProperties;
162
+ /** A filter to apply to the transactions. Docs on filter: https://docs.bunny.com/developer/getting-started/using-filters-in-queries
163
+ * Filtering is applied on the api side, potentially speeding up the transactions query
164
+ */
154
165
  filter?: string;
155
166
  /** Message to display when there are no transactions */
156
167
  noTransactionsMessage?: string;
157
168
  /** The entity id to pass to the invoice component */
158
169
  entityId: string;
170
+ /** A function to filter the transactions
171
+ * Filtering is applied on the client side.
172
+ * This is useful to have more control over the filtering logic.
173
+ */
174
+ filterTransactions?: (transaction: FrontendTransaction.Transaction) => boolean;
175
+ /** A function to sort the transactions. Runs on the client side. */
176
+ sortTransactions?: (transactionA: FrontendTransaction.Transaction, transactionB: FrontendTransaction.Transaction) => number;
159
177
  }): react_jsx_runtime.JSX.Element;
160
178
 
161
179
  declare const Subscriptions: ({ companyName, entityId, gap, shadow, showTitle, className, }: {
@@ -167,6 +185,14 @@ declare const Subscriptions: ({ companyName, entityId, gap, shadow, showTitle, c
167
185
  className?: string | undefined;
168
186
  }) => react_jsx_runtime.JSX.Element;
169
187
 
188
+ declare const BillingDetails: ({ entityId, accountId, isCardEnabled, shadow, className, }: {
189
+ entityId: string;
190
+ accountId: string;
191
+ isCardEnabled?: boolean | undefined;
192
+ shadow?: ShadowType | undefined;
193
+ className?: string | undefined;
194
+ }) => react_jsx_runtime.JSX.Element;
195
+
170
196
  declare const usePaymentMethod: (graphQLClient: GraphQLClient, accountId?: string) => _tanstack_react_query_build_legacy_types.UseQueryResult<any, Error>;
171
197
 
172
- export { BunnyProvider, Checkout, Invoice, PaymentMethod, Quote, Quotes, Signup, Subscriptions, Transactions, getQuoteAmountDue, usePaymentMethod };
198
+ export { BillingDetails, BunnyProvider, Checkout, Invoice, PaymentMethod, Quote, Quotes, Signup, Subscriptions, Transactions, getQuoteAmountDue, usePaymentMethod };