@bunnyapp/components 1.0.18 → 1.0.20

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 (72) hide show
  1. package/dist/cjs/index.js +722 -16444
  2. package/dist/cjs/src/components/BillingDetails/BillingDetails.d.ts +6 -2
  3. package/dist/cjs/src/components/Card.d.ts +0 -1
  4. package/dist/cjs/src/components/Invoice/Invoice.d.ts +1 -0
  5. package/dist/cjs/src/components/LegacyInvoicePDF.d.ts +2 -1
  6. package/dist/cjs/src/components/PaymentForm/DemoPay/hooks/usePay.d.ts +3 -2
  7. package/dist/cjs/src/components/PaymentForm/PaymentForm.d.ts +3 -2
  8. package/dist/cjs/src/components/PaymentForm/Stripe/hooks/usePay.d.ts +3 -2
  9. package/dist/cjs/src/components/PaymentForm/useRemovePaymentMethod.d.ts +1 -1
  10. package/dist/cjs/src/components/Quote/Quote.stories.d.ts +30 -30
  11. package/dist/cjs/src/components/Signup/PaymentForms.d.ts +4 -3
  12. package/dist/cjs/src/components/Signup/Signup.d.ts +1 -3
  13. package/dist/cjs/src/components/Subscriptions/Subscriptions.d.ts +11 -5
  14. package/dist/cjs/src/components/Subscriptions/SubscriptionsContext.d.ts +1 -4
  15. package/dist/cjs/src/components/Subscriptions/subscriptionsList/SubscriptionCardActions.d.ts +3 -3
  16. package/dist/cjs/src/components/Subscriptions/subscriptionsList/SubscriptionCardHeader.d.ts +3 -3
  17. package/dist/cjs/src/components/Subscriptions/subscriptionsList/SubscriptionsList.d.ts +4 -5
  18. package/dist/cjs/src/components/Subscriptions/subscriptionsList/subscriptionCardDesktop/SubscriptionCardDesktop.d.ts +3 -3
  19. package/dist/cjs/src/components/Subscriptions/subscriptionsList/subscriptionCardMobile/SubscriptionCardMobile.d.ts +2 -5
  20. package/dist/cjs/src/components/Subscriptions/subscriptionsList/subscriptionUtils.d.ts +0 -3
  21. package/dist/cjs/src/components/Transactions/Transactions.d.ts +4 -1
  22. package/dist/cjs/src/components/Transactions/TransactionsListContext.d.ts +3 -1
  23. package/dist/cjs/src/components/Transactions/transactionsList/TransactionsListDesktop.d.ts +2 -2
  24. package/dist/cjs/src/components/Transactions/transactionsList/TransactionsListMobile.d.ts +1 -1
  25. package/dist/cjs/src/components/Transactions/transactionsList/utils.d.ts +3 -0
  26. package/dist/cjs/src/contexts/PaymentContext.d.ts +2 -1
  27. package/dist/cjs/src/graphql/mutations/billingDetailsUpdate.d.ts +6 -0
  28. package/dist/cjs/src/graphql/queries/getBillingDetails.d.ts +6 -0
  29. package/dist/cjs/src/graphql/queries/getSubscriptions.d.ts +2 -2
  30. package/dist/cjs/src/hooks/quotes/useSendAcceptQuote.d.ts +0 -1
  31. package/dist/cjs/src/hooks/usePaymentMethod.d.ts +1 -1
  32. package/dist/cjs/src/hooks/useToken.d.ts +2 -0
  33. package/dist/cjs/src/types/billingDetails.d.ts +12 -0
  34. package/dist/esm/index.js +787 -16509
  35. package/dist/esm/src/components/BillingDetails/BillingDetails.d.ts +6 -2
  36. package/dist/esm/src/components/Card.d.ts +0 -1
  37. package/dist/esm/src/components/Invoice/Invoice.d.ts +1 -0
  38. package/dist/esm/src/components/LegacyInvoicePDF.d.ts +2 -1
  39. package/dist/esm/src/components/PaymentForm/DemoPay/hooks/usePay.d.ts +3 -2
  40. package/dist/esm/src/components/PaymentForm/PaymentForm.d.ts +3 -2
  41. package/dist/esm/src/components/PaymentForm/Stripe/hooks/usePay.d.ts +3 -2
  42. package/dist/esm/src/components/PaymentForm/useRemovePaymentMethod.d.ts +1 -1
  43. package/dist/esm/src/components/Quote/Quote.stories.d.ts +30 -30
  44. package/dist/esm/src/components/Signup/PaymentForms.d.ts +4 -3
  45. package/dist/esm/src/components/Signup/Signup.d.ts +1 -3
  46. package/dist/esm/src/components/Subscriptions/Subscriptions.d.ts +11 -5
  47. package/dist/esm/src/components/Subscriptions/SubscriptionsContext.d.ts +1 -4
  48. package/dist/esm/src/components/Subscriptions/subscriptionsList/SubscriptionCardActions.d.ts +3 -3
  49. package/dist/esm/src/components/Subscriptions/subscriptionsList/SubscriptionCardHeader.d.ts +3 -3
  50. package/dist/esm/src/components/Subscriptions/subscriptionsList/SubscriptionsList.d.ts +4 -5
  51. package/dist/esm/src/components/Subscriptions/subscriptionsList/subscriptionCardDesktop/SubscriptionCardDesktop.d.ts +3 -3
  52. package/dist/esm/src/components/Subscriptions/subscriptionsList/subscriptionCardMobile/SubscriptionCardMobile.d.ts +2 -5
  53. package/dist/esm/src/components/Subscriptions/subscriptionsList/subscriptionUtils.d.ts +0 -3
  54. package/dist/esm/src/components/Transactions/Transactions.d.ts +4 -1
  55. package/dist/esm/src/components/Transactions/TransactionsListContext.d.ts +3 -1
  56. package/dist/esm/src/components/Transactions/transactionsList/TransactionsListDesktop.d.ts +2 -2
  57. package/dist/esm/src/components/Transactions/transactionsList/TransactionsListMobile.d.ts +1 -1
  58. package/dist/esm/src/components/Transactions/transactionsList/utils.d.ts +3 -0
  59. package/dist/esm/src/contexts/PaymentContext.d.ts +2 -1
  60. package/dist/esm/src/graphql/mutations/billingDetailsUpdate.d.ts +6 -0
  61. package/dist/esm/src/graphql/queries/getBillingDetails.d.ts +6 -0
  62. package/dist/esm/src/graphql/queries/getSubscriptions.d.ts +2 -2
  63. package/dist/esm/src/hooks/quotes/useSendAcceptQuote.d.ts +0 -1
  64. package/dist/esm/src/hooks/usePaymentMethod.d.ts +1 -1
  65. package/dist/esm/src/hooks/useToken.d.ts +2 -0
  66. package/dist/esm/src/types/billingDetails.d.ts +12 -0
  67. package/dist/index.d.ts +24 -13
  68. package/package.json +2 -2
  69. package/dist/cjs/src/graphql/mutations/portalSessionCreate.d.ts +0 -8
  70. package/dist/cjs/src/graphql/queries/getAccount.d.ts +0 -7
  71. package/dist/esm/src/graphql/mutations/portalSessionCreate.d.ts +0 -8
  72. 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,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  declare const Card: ({ children, className, style, }: {
3
2
  children: React.ReactNode;
4
3
  className?: string | undefined;
@@ -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,3 @@
1
1
  import { PluginData } from "@bunnyapp/common";
2
- declare function useRemovePaymentMethod(paymentPlugins: PluginData[], token: string, apiHost: string, accountId?: string): (data: any) => void;
2
+ declare function useRemovePaymentMethod(paymentPlugins: PluginData[], token: string, apiHost: string, accountId?: string): (data: any) => Promise<void>;
3
3
  export default useRemovePaymentMethod;
@@ -15,16 +15,16 @@ export declare const Default: import("@storybook/csf").StoryAnnotations<import("
15
15
  className?: string | undefined;
16
16
  hideDownloadButton?: boolean | undefined;
17
17
  }, {
18
+ className?: string | undefined;
19
+ id?: string | undefined;
20
+ entityId?: string | undefined;
21
+ shadow?: import("../../types/shadowType").ShadowType | undefined;
22
+ onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
18
23
  backButtonName?: string | undefined;
19
24
  onBackButtonClick?: (() => void) | undefined;
20
- shadow?: import("../../types/shadowType").ShadowType | undefined;
21
- hideDownloadButton?: boolean | undefined;
22
- id?: string | undefined;
23
- className?: string | undefined;
24
25
  invoiceQuoteViewComponent?: import("react").ReactNode;
25
26
  onInvoiceDownloadError?: (() => void) | undefined;
26
- onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
27
- entityId?: string | undefined;
27
+ hideDownloadButton?: boolean | undefined;
28
28
  }>;
29
29
  export declare const NoShadow: import("@storybook/csf").StoryAnnotations<import("@storybook/react/dist/types-a5624094").R, {
30
30
  id?: string | undefined;
@@ -38,16 +38,16 @@ export declare const NoShadow: import("@storybook/csf").StoryAnnotations<import(
38
38
  className?: string | undefined;
39
39
  hideDownloadButton?: boolean | undefined;
40
40
  }, {
41
+ className?: string | undefined;
42
+ id?: string | undefined;
43
+ entityId?: string | undefined;
44
+ shadow?: import("../../types/shadowType").ShadowType | undefined;
45
+ onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
41
46
  backButtonName?: string | undefined;
42
47
  onBackButtonClick?: (() => void) | undefined;
43
- shadow?: import("../../types/shadowType").ShadowType | undefined;
44
- hideDownloadButton?: boolean | undefined;
45
- id?: string | undefined;
46
- className?: string | undefined;
47
48
  invoiceQuoteViewComponent?: import("react").ReactNode;
48
49
  onInvoiceDownloadError?: (() => void) | undefined;
49
- onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
50
- entityId?: string | undefined;
50
+ hideDownloadButton?: boolean | undefined;
51
51
  }>;
52
52
  export declare const Mobile: import("@storybook/csf").StoryAnnotations<import("@storybook/react/dist/types-a5624094").R, {
53
53
  id?: string | undefined;
@@ -61,16 +61,16 @@ export declare const Mobile: import("@storybook/csf").StoryAnnotations<import("@
61
61
  className?: string | undefined;
62
62
  hideDownloadButton?: boolean | undefined;
63
63
  }, {
64
+ className?: string | undefined;
65
+ id?: string | undefined;
66
+ entityId?: string | undefined;
67
+ shadow?: import("../../types/shadowType").ShadowType | undefined;
68
+ onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
64
69
  backButtonName?: string | undefined;
65
70
  onBackButtonClick?: (() => void) | undefined;
66
- shadow?: import("../../types/shadowType").ShadowType | undefined;
67
- hideDownloadButton?: boolean | undefined;
68
- id?: string | undefined;
69
- className?: string | undefined;
70
71
  invoiceQuoteViewComponent?: import("react").ReactNode;
71
72
  onInvoiceDownloadError?: (() => void) | undefined;
72
- onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
73
- entityId?: string | undefined;
73
+ hideDownloadButton?: boolean | undefined;
74
74
  }>;
75
75
  export declare const CustomClassName: import("@storybook/csf").StoryAnnotations<import("@storybook/react/dist/types-a5624094").R, {
76
76
  id?: string | undefined;
@@ -84,16 +84,16 @@ export declare const CustomClassName: import("@storybook/csf").StoryAnnotations<
84
84
  className?: string | undefined;
85
85
  hideDownloadButton?: boolean | undefined;
86
86
  }, {
87
+ className?: string | undefined;
88
+ id?: string | undefined;
89
+ entityId?: string | undefined;
90
+ shadow?: import("../../types/shadowType").ShadowType | undefined;
91
+ onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
87
92
  backButtonName?: string | undefined;
88
93
  onBackButtonClick?: (() => void) | undefined;
89
- shadow?: import("../../types/shadowType").ShadowType | undefined;
90
- hideDownloadButton?: boolean | undefined;
91
- id?: string | undefined;
92
- className?: string | undefined;
93
94
  invoiceQuoteViewComponent?: import("react").ReactNode;
94
95
  onInvoiceDownloadError?: (() => void) | undefined;
95
- onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
96
- entityId?: string | undefined;
96
+ hideDownloadButton?: boolean | undefined;
97
97
  }>;
98
98
  export declare const HideDownloadButton: Story;
99
99
  export declare const AcceptedQuote: Story;
@@ -110,14 +110,14 @@ export declare const DarkMode: import("@storybook/csf").StoryAnnotations<import(
110
110
  className?: string | undefined;
111
111
  hideDownloadButton?: boolean | undefined;
112
112
  }, {
113
+ className?: string | undefined;
114
+ id?: string | undefined;
115
+ entityId?: string | undefined;
116
+ shadow?: import("../../types/shadowType").ShadowType | undefined;
117
+ onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
113
118
  backButtonName?: string | undefined;
114
119
  onBackButtonClick?: (() => void) | undefined;
115
- shadow?: import("../../types/shadowType").ShadowType | undefined;
116
- hideDownloadButton?: boolean | undefined;
117
- id?: string | undefined;
118
- className?: string | undefined;
119
120
  invoiceQuoteViewComponent?: import("react").ReactNode;
120
121
  onInvoiceDownloadError?: (() => void) | undefined;
121
- onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
122
- entityId?: string | undefined;
122
+ hideDownloadButton?: boolean | undefined;
123
123
  }>;
@@ -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,14 +1,20 @@
1
+ import { Subscription } from "@bunnyapp/common";
1
2
  import "../../styles/index.less";
2
3
  export type EditingQuoteDataType = {
3
4
  id: string;
4
5
  isTrial: boolean;
5
6
  };
6
- declare const Subscriptions: ({ companyName, entityId, gap, shadow, showTitle, className, }: {
7
+ declare const Subscriptions: ({ className, companyName, entityId, hideExpired, onCancelSubscriptionClick, onChangePlanClick, onSubscriptionsLoaded, styles, }: {
8
+ className?: string | undefined;
7
9
  companyName: string;
8
10
  entityId: string;
9
- gap?: number | undefined;
10
- shadow?: "none" | "lg" | "md" | "sm" | undefined;
11
- showTitle?: boolean | undefined;
12
- className?: string | undefined;
11
+ hideExpired?: boolean | undefined;
12
+ onCancelSubscriptionClick?: ((subscription: Subscription) => void) | undefined;
13
+ onChangePlanClick?: ((subscription: Subscription) => void) | undefined;
14
+ onSubscriptionsLoaded?: ((subscriptions: Subscription[]) => void) | undefined;
15
+ styles?: {
16
+ gap?: number | undefined;
17
+ shadow?: "none" | "sm" | "md" | "lg" | undefined;
18
+ } | undefined;
13
19
  }) => import("react/jsx-runtime").JSX.Element;
14
20
  export default Subscriptions;
@@ -1,10 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  export type SubscriptionsContextValues = {
3
- onChangePlanClick: () => void;
4
- onClickUpgrade: () => void;
5
- isTempViewOnly: boolean;
6
- shadow?: "none" | "sm" | "md" | "lg";
7
3
  gap?: number;
4
+ shadow?: "none" | "sm" | "md" | "lg";
8
5
  showTitle?: boolean;
9
6
  };
10
7
  export declare const SubscriptionsContext: import("react").Context<SubscriptionsContextValues>;
@@ -1,8 +1,8 @@
1
1
  import { PlanChangeOptions, Subscription } from "@bunnyapp/common";
2
- declare const SubscriptionCardActions: ({ planChangeOptions, subscription, setEditingQuoteData, setPayModalVisible, }: {
2
+ declare const SubscriptionCardActions: ({ onChangePlanClick, onCancelSubscriptionClick, planChangeOptions, subscription, }: {
3
+ onChangePlanClick: (subscription: Subscription) => void;
4
+ onCancelSubscriptionClick: (subscription: Subscription) => void;
3
5
  planChangeOptions?: PlanChangeOptions | undefined;
4
6
  subscription: Subscription;
5
- setEditingQuoteData: (value: any) => void;
6
- setPayModalVisible: (value: any) => void;
7
7
  }) => import("react/jsx-runtime").JSX.Element | null;
8
8
  export default SubscriptionCardActions;
@@ -1,8 +1,8 @@
1
1
  import { PlanChangeOptions, Subscription } from "@bunnyapp/common";
2
- declare const SubscriptionCardHeader: ({ planChangeOptions, setEditingQuoteData, setPayModalVisible, subscription, }: {
2
+ declare const SubscriptionCardHeader: ({ onChangePlanClick, onCancelSubscriptionClick, planChangeOptions, subscription, }: {
3
+ onChangePlanClick?: ((subscription: Subscription) => void) | undefined;
4
+ onCancelSubscriptionClick?: ((subscription: Subscription) => void) | undefined;
3
5
  planChangeOptions?: PlanChangeOptions | undefined;
4
- setEditingQuoteData: (value: any) => void;
5
- setPayModalVisible: (value: any) => void;
6
6
  subscription: Subscription;
7
7
  }) => import("react/jsx-runtime").JSX.Element;
8
8
  export default SubscriptionCardHeader;
@@ -1,10 +1,9 @@
1
- import { Invoice, PlanChangeOptions, Subscription } from "@bunnyapp/common";
2
- declare const SubscriptionsList: ({ hideExpired, planChangeOptions, setEditingQuoteData, setPayModalVisible, subscriptions, }: {
1
+ import { PlanChangeOptions, Subscription } from "@bunnyapp/common";
2
+ declare const SubscriptionsList: ({ hideExpired, onChangePlanClick, onCancelSubscriptionClick, planChangeOptions, subscriptions, }: {
3
3
  hideExpired: boolean;
4
- invoice?: Invoice | undefined;
4
+ onChangePlanClick?: ((subscription: Subscription) => void) | undefined;
5
+ onCancelSubscriptionClick?: ((subscription: Subscription) => void) | undefined;
5
6
  planChangeOptions?: PlanChangeOptions | undefined;
6
- setEditingQuoteData: (value: any) => void;
7
- setPayModalVisible: (value: any) => void;
8
7
  subscriptions: Subscription[];
9
8
  }) => import("react/jsx-runtime").JSX.Element;
10
9
  export default SubscriptionsList;
@@ -1,8 +1,8 @@
1
1
  import { PlanChangeOptions, Subscription } from "@bunnyapp/common";
2
- declare const SubscriptionCardDesktop: ({ planChangeOptions, setEditingQuoteData, setPayModalVisible, subscription, }: {
2
+ declare const SubscriptionCardDesktop: ({ onChangePlanClick, onCancelSubscriptionClick, planChangeOptions, subscription, }: {
3
+ onChangePlanClick?: ((subscription: Subscription) => void) | undefined;
4
+ onCancelSubscriptionClick?: ((subscription: Subscription) => void) | undefined;
3
5
  planChangeOptions?: PlanChangeOptions | undefined;
4
- setEditingQuoteData: (value: any) => void;
5
- setPayModalVisible: (value: any) => void;
6
6
  subscription: Subscription;
7
7
  }) => import("react/jsx-runtime").JSX.Element;
8
8
  export default SubscriptionCardDesktop;
@@ -1,8 +1,5 @@
1
- import { PlanChangeOptions, Subscription } from "@bunnyapp/common";
2
- declare const SubscriptionCard: ({ planChangeOptions, setEditingQuoteData, setPayModalVisible, subscription, }: {
3
- planChangeOptions?: PlanChangeOptions | undefined;
4
- setEditingQuoteData: (value: any) => void;
5
- setPayModalVisible: (value: any) => void;
1
+ import { Subscription } from "@bunnyapp/common";
2
+ declare const SubscriptionCard: ({ subscription }: {
6
3
  subscription: Subscription;
7
4
  }) => import("react/jsx-runtime").JSX.Element;
8
5
  export default SubscriptionCard;
@@ -7,9 +7,6 @@ export declare const createQuoteParams: (quote: Quote, subscriptionQuantity: num
7
7
  }[];
8
8
  quoteChange: import("@bunnyapp/common").QuoteChange | undefined;
9
9
  };
10
- export declare const canShowChangeQuantities: ({ subscriptions, }: {
11
- subscriptions: Subscription[];
12
- }) => boolean;
13
10
  export declare const isSubscriptionNotActive: (subscription: Subscription) => boolean;
14
11
  export declare const productPlanName: ({ plan, product, }: {
15
12
  plan: Plan;
@@ -1,7 +1,8 @@
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, filterTransactions, sortTransactions, }: {
4
+ import { TransactionDateType } from "./TransactionsListContext";
5
+ export default function Transactions({ transactionComponent, showSearchBar, showTitle, title, columns, className, shadow, searchBarClassName, useModal, onTransactionClick, suppressTransactionDisplay, kindsToShow, style, filter, noTransactionsMessage, entityId, filterTransactions, sortTransactions, transactionDateType, }: {
5
6
  /** A custom component to render instead of the default invoice component */
6
7
  transactionComponent?: React.ReactNode;
7
8
  /** Whether to show the search bar */
@@ -43,6 +44,8 @@ export default function Transactions({ transactionComponent, showSearchBar, show
43
44
  filterTransactions?: (transaction: T.Transaction) => boolean;
44
45
  /** A function to sort the transactions. Runs on the client side. */
45
46
  sortTransactions?: (transactionA: T.Transaction, transactionB: T.Transaction) => number;
47
+ /** The type of date to display for transactions if applicable. Payments will always only show createdAt date. */
48
+ transactionDateType?: TransactionDateType;
46
49
  }): import("react/jsx-runtime").JSX.Element;
47
50
  export declare function TransactionsDisplay({ transactions, onSearchValueChanged, search, }: {
48
51
  transactions: T.Transaction[];
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { FrontendTransaction as T, TransactionKind } from "@bunnyapp/common";
3
- import { TransactionListColumnType } from "./transactionsList/TransactionsListDesktop";
4
3
  import { ShadowType } from "../../types/shadowType";
4
+ import { TransactionListColumnType } from "./transactionsList/TransactionsListDesktop";
5
5
  export type TransactionsContextValues = {
6
6
  showSearchBar?: boolean;
7
7
  showTitle?: boolean;
@@ -24,5 +24,7 @@ export type TransactionsContextValues = {
24
24
  entityId: string;
25
25
  filterTransactions?: (transaction: T.Transaction) => boolean;
26
26
  sortTransactions?: (transactionA: T.Transaction, transactionB: T.Transaction) => number;
27
+ transactionDateType: TransactionDateType;
27
28
  };
29
+ export type TransactionDateType = "createdAt" | "issuedAt" | "dueAt";
28
30
  export declare const TransactionsListContext: import("react").Context<TransactionsContextValues>;
@@ -1,7 +1,7 @@
1
- import { FrontendTransaction as T, Transaction } from "@bunnyapp/common";
1
+ import { FrontendTransaction as T } 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[];
5
5
  onTransactionClick?: ((transaction: T.Transaction) => void) | undefined;
6
- }) => import("react/jsx-runtime").JSX.Element | import("react/jsx-runtime").JSX.Element[];
6
+ }) => import("react/jsx-runtime").JSX.Element;
7
7
  export default TransactionsListDesktop;
@@ -2,5 +2,5 @@ import { FrontendTransaction as T } from "@bunnyapp/common";
2
2
  declare const TransactionsListMobile: ({ transactions, onTransactionClick, }: {
3
3
  transactions: T.Transaction[];
4
4
  onTransactionClick: (transaction: T.Transaction) => void;
5
- }) => import("react/jsx-runtime").JSX.Element | import("react/jsx-runtime").JSX.Element[];
5
+ }) => import("react/jsx-runtime").JSX.Element;
6
6
  export default TransactionsListMobile;
@@ -0,0 +1,3 @@
1
+ import { FrontendTransaction as T } from "@bunnyapp/common";
2
+ import { TransactionDateType } from "../TransactionsListContext";
3
+ export declare function transactionDateToDisplay(transaction: T.Transaction, transactionDateType: TransactionDateType): any;
@@ -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,7 +1,7 @@
1
- declare const getSubscriptions: ({ entityId, isInPreviewMode, token, apiHost, }: {
1
+ declare const getSubscriptions: ({ apiHost, entityId, isInPreviewMode, token, }: {
2
+ apiHost: string;
2
3
  entityId: string;
3
4
  isInPreviewMode?: boolean | undefined;
4
5
  token: string;
5
- apiHost: string;
6
6
  }) => Promise<any>;
7
7
  export default getSubscriptions;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  declare const useSendAcceptQuote: ({ entityId, onTokenExpired, quoteId, apiHost, token, }: {
3
2
  entityId: string;
4
3
  onTokenExpired?: (() => void) | undefined;
@@ -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
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
- import { FrontendTransaction, FormattedInvoice, Quote as Quote$1, PriceList, PaymentMethod as PaymentMethod$1, TransactionKind } from '@bunnyapp/common';
3
+ import { FrontendTransaction, FormattedInvoice, Quote as Quote$1, PriceList, PaymentMethod as PaymentMethod$1, TransactionKind, Subscription } from '@bunnyapp/common';
4
4
  import { QueryClient } from '@tanstack/react-query';
5
5
  import { ThemeConfig } from 'antd';
6
6
  import react from 'react';
@@ -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 */
@@ -132,7 +130,9 @@ declare function BunnyProvider({ children, darkMode, queryClient, apiHost, token
132
130
  configProviderProps?: ThemeConfig | undefined;
133
131
  }): react_jsx_runtime.JSX.Element;
134
132
 
135
- declare function Transactions({ transactionComponent, showSearchBar, showTitle, title, columns, className, shadow, searchBarClassName, useModal, onTransactionClick, suppressTransactionDisplay, kindsToShow, style, filter, noTransactionsMessage, entityId, filterTransactions, sortTransactions, }: {
133
+ type TransactionDateType = "createdAt" | "issuedAt" | "dueAt";
134
+
135
+ declare function Transactions({ transactionComponent, showSearchBar, showTitle, title, columns, className, shadow, searchBarClassName, useModal, onTransactionClick, suppressTransactionDisplay, kindsToShow, style, filter, noTransactionsMessage, entityId, filterTransactions, sortTransactions, transactionDateType, }: {
136
136
  /** A custom component to render instead of the default invoice component */
137
137
  transactionComponent?: react.ReactNode;
138
138
  /** Whether to show the search bar */
@@ -174,25 +174,36 @@ declare function Transactions({ transactionComponent, showSearchBar, showTitle,
174
174
  filterTransactions?: (transaction: FrontendTransaction.Transaction) => boolean;
175
175
  /** A function to sort the transactions. Runs on the client side. */
176
176
  sortTransactions?: (transactionA: FrontendTransaction.Transaction, transactionB: FrontendTransaction.Transaction) => number;
177
+ /** The type of date to display for transactions if applicable. Payments will always only show createdAt date. */
178
+ transactionDateType?: TransactionDateType;
177
179
  }): react_jsx_runtime.JSX.Element;
178
180
 
179
- declare const Subscriptions: ({ companyName, entityId, gap, shadow, showTitle, className, }: {
181
+ declare const Subscriptions: ({ className, companyName, entityId, hideExpired, onCancelSubscriptionClick, onChangePlanClick, onSubscriptionsLoaded, styles, }: {
182
+ className?: string | undefined;
180
183
  companyName: string;
181
184
  entityId: string;
182
- gap?: number | undefined;
183
- shadow?: "none" | "lg" | "md" | "sm" | undefined;
184
- showTitle?: boolean | undefined;
185
- className?: string | undefined;
185
+ hideExpired?: boolean | undefined;
186
+ onCancelSubscriptionClick?: ((subscription: Subscription) => void) | undefined;
187
+ onChangePlanClick?: ((subscription: Subscription) => void) | undefined;
188
+ onSubscriptionsLoaded?: ((subscriptions: Subscription[]) => void) | undefined;
189
+ styles?: {
190
+ gap?: number | undefined;
191
+ shadow?: "none" | "sm" | "md" | "lg" | undefined;
192
+ } | undefined;
186
193
  }) => react_jsx_runtime.JSX.Element;
187
194
 
188
- declare const BillingDetails: ({ entityId, accountId, isCardEnabled, shadow, className, }: {
195
+ declare const BillingDetails: ({ entityId, isCardEnabled, shadow, className, hidePaymentMethodForm, countryListFilter, }: {
189
196
  entityId: string;
190
- accountId: string;
191
197
  isCardEnabled?: boolean | undefined;
192
198
  shadow?: ShadowType | undefined;
193
199
  className?: string | undefined;
200
+ hidePaymentMethodForm?: boolean | undefined;
201
+ countryListFilter?: ((country: {
202
+ value: string;
203
+ label: string;
204
+ }) => boolean) | undefined;
194
205
  }) => react_jsx_runtime.JSX.Element;
195
206
 
196
- declare const usePaymentMethod: (graphQLClient: GraphQLClient, accountId?: string) => _tanstack_react_query_build_legacy_types.UseQueryResult<any, Error>;
207
+ declare const usePaymentMethod: (graphQLClient: GraphQLClient) => _tanstack_react_query_build_legacy_types.UseQueryResult<any, Error>;
197
208
 
198
209
  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.20",
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",
@@ -62,7 +62,7 @@
62
62
  "vite": "^5.4.11"
63
63
  },
64
64
  "peerDependencies": {
65
- "@bunnyapp/common": "^1.0.40",
65
+ "@bunnyapp/common": "^1.0.42",
66
66
  "@fortawesome/fontawesome-svg-core": "^6.7.2",
67
67
  "@fortawesome/free-brands-svg-icons": "^6.7.2",
68
68
  "@fortawesome/free-regular-svg-icons": "^6.7.2",
@@ -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;