@bunnyapp/components 1.0.11 → 1.0.13

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 (134) hide show
  1. package/dist/cjs/index.js +1112 -1214
  2. package/dist/cjs/src/components/BillingDetails/BillingDetails.d.ts +10 -0
  3. package/dist/cjs/src/components/BillingDetails/BillingDetails.stories.d.ts +11 -0
  4. package/dist/cjs/src/components/BillingDetails/index.d.ts +1 -0
  5. package/dist/cjs/src/components/BunnyProvider.d.ts +3 -3
  6. package/dist/cjs/src/components/Checkout/InvoiceCheckout.d.ts +1 -21
  7. package/dist/cjs/src/components/Checkout/QuoteCheckout.d.ts +1 -1
  8. package/dist/cjs/src/components/Invoice/Invoice.d.ts +8 -2
  9. package/dist/cjs/src/components/Invoice/Invoice.stories.d.ts +14 -5
  10. package/dist/cjs/src/components/PageHeaderWithActions.d.ts +2 -1
  11. package/dist/cjs/src/components/PaymentForm/CheckoutFooter.d.ts +8 -7
  12. package/dist/cjs/src/components/PaymentForm/DemoPay/DemoPayForm.d.ts +6 -2
  13. package/dist/cjs/src/components/PaymentForm/DemoPay/demoPayUtils.d.ts +1 -3
  14. package/dist/cjs/src/components/PaymentForm/DemoPay/hooks/usePay.d.ts +13 -0
  15. package/dist/cjs/src/components/PaymentForm/DemoPay/hooks/useSave.d.ts +21 -0
  16. package/dist/cjs/src/components/PaymentForm/PaymentForm.d.ts +10 -6
  17. package/dist/cjs/src/components/PaymentForm/PaymentFormTypes.d.ts +0 -8
  18. package/dist/cjs/src/components/PaymentForm/PaymentMethod/CreditCard/CreditCard.d.ts +12 -2
  19. package/dist/cjs/src/components/PaymentForm/PaymentMethod/PaymentMethod.d.ts +6 -4
  20. package/dist/cjs/src/components/PaymentForm/PaymentMethod/PaymentMethod.stories.d.ts +11 -0
  21. package/dist/cjs/src/components/PaymentForm/PaymentMethodDetails.d.ts +8 -0
  22. package/dist/cjs/src/components/PaymentForm/PaymentMethodSelector.d.ts +2 -3
  23. package/dist/cjs/src/components/PaymentForm/SavePaymentMethodFooter.d.ts +6 -0
  24. package/dist/cjs/src/components/PaymentForm/Stripe/PaymentMethodForm.d.ts +6 -2
  25. package/dist/cjs/src/components/PaymentForm/Stripe/StripeForm.d.ts +6 -2
  26. package/dist/cjs/src/components/PaymentForm/Stripe/hooks/usePay.d.ts +12 -0
  27. package/dist/cjs/src/components/PaymentForm/Stripe/hooks/useSave.d.ts +10 -0
  28. package/dist/cjs/src/components/PaymentForm/Stripe/stripeUtils.d.ts +9 -3
  29. package/dist/cjs/src/components/PaymentForm/useRemovePaymentMethod.d.ts +3 -0
  30. package/dist/cjs/src/components/Quote/Quote.d.ts +2 -4
  31. package/dist/cjs/src/components/Quote/Quote.stories.d.ts +122 -6
  32. package/dist/cjs/src/components/Quotes/Quotes.d.ts +8 -4
  33. package/dist/cjs/src/components/Quotes/Quotes.stories.d.ts +22 -0
  34. package/dist/cjs/src/components/Signup/PaymentForms.d.ts +2 -4
  35. package/dist/cjs/src/components/Signup/Signup.d.ts +11 -1
  36. package/dist/cjs/src/components/Signup/Signup.stories.d.ts +6 -4
  37. package/dist/cjs/src/components/StateTag.d.ts +3 -5
  38. package/dist/cjs/src/components/Subscriptions/Subscriptions.d.ts +2 -1
  39. package/dist/cjs/src/components/Subscriptions/Subscriptions.stories.d.ts +10 -0
  40. package/dist/cjs/src/components/Transactions/Transactions.d.ts +7 -5
  41. package/dist/cjs/src/components/Transactions/Transactions.stories.d.ts +15 -6
  42. package/dist/cjs/src/components/Transactions/TransactionsListContext.d.ts +5 -1
  43. package/dist/cjs/src/components/Transactions/transactionsList/TransactionsListDesktop.d.ts +1 -1
  44. package/dist/cjs/src/contexts/PaymentContext.d.ts +2 -2
  45. package/dist/cjs/src/graphql/queries/getAccount.d.ts +1 -1
  46. package/dist/cjs/src/hooks/quotes/useSendAcceptQuote.d.ts +2 -2
  47. package/dist/cjs/src/hooks/usePaymentMethod.d.ts +1 -1
  48. package/dist/cjs/src/mocks/handlers.d.ts +1 -1
  49. package/dist/cjs/src/storybook-utils.d.ts +10 -0
  50. package/dist/cjs/src/types/shadowType.d.ts +1 -0
  51. package/dist/esm/index.js +1116 -1218
  52. package/dist/esm/src/components/BillingDetails/BillingDetails.d.ts +10 -0
  53. package/dist/esm/src/components/BillingDetails/BillingDetails.stories.d.ts +11 -0
  54. package/dist/esm/src/components/BillingDetails/index.d.ts +1 -0
  55. package/dist/esm/src/components/BunnyProvider.d.ts +3 -3
  56. package/dist/esm/src/components/Checkout/InvoiceCheckout.d.ts +1 -21
  57. package/dist/esm/src/components/Checkout/QuoteCheckout.d.ts +1 -1
  58. package/dist/esm/src/components/Invoice/Invoice.d.ts +8 -2
  59. package/dist/esm/src/components/Invoice/Invoice.stories.d.ts +14 -5
  60. package/dist/esm/src/components/PageHeaderWithActions.d.ts +2 -1
  61. package/dist/esm/src/components/PaymentForm/CheckoutFooter.d.ts +8 -7
  62. package/dist/esm/src/components/PaymentForm/DemoPay/DemoPayForm.d.ts +6 -2
  63. package/dist/esm/src/components/PaymentForm/DemoPay/demoPayUtils.d.ts +1 -3
  64. package/dist/esm/src/components/PaymentForm/DemoPay/hooks/usePay.d.ts +13 -0
  65. package/dist/esm/src/components/PaymentForm/DemoPay/hooks/useSave.d.ts +21 -0
  66. package/dist/esm/src/components/PaymentForm/PaymentForm.d.ts +10 -6
  67. package/dist/esm/src/components/PaymentForm/PaymentFormTypes.d.ts +0 -8
  68. package/dist/esm/src/components/PaymentForm/PaymentMethod/CreditCard/CreditCard.d.ts +12 -2
  69. package/dist/esm/src/components/PaymentForm/PaymentMethod/PaymentMethod.d.ts +6 -4
  70. package/dist/esm/src/components/PaymentForm/PaymentMethod/PaymentMethod.stories.d.ts +11 -0
  71. package/dist/esm/src/components/PaymentForm/PaymentMethodDetails.d.ts +8 -0
  72. package/dist/esm/src/components/PaymentForm/PaymentMethodSelector.d.ts +2 -3
  73. package/dist/esm/src/components/PaymentForm/SavePaymentMethodFooter.d.ts +6 -0
  74. package/dist/esm/src/components/PaymentForm/Stripe/PaymentMethodForm.d.ts +6 -2
  75. package/dist/esm/src/components/PaymentForm/Stripe/StripeForm.d.ts +6 -2
  76. package/dist/esm/src/components/PaymentForm/Stripe/hooks/usePay.d.ts +12 -0
  77. package/dist/esm/src/components/PaymentForm/Stripe/hooks/useSave.d.ts +10 -0
  78. package/dist/esm/src/components/PaymentForm/Stripe/stripeUtils.d.ts +9 -3
  79. package/dist/esm/src/components/PaymentForm/useRemovePaymentMethod.d.ts +3 -0
  80. package/dist/esm/src/components/Quote/Quote.d.ts +2 -4
  81. package/dist/esm/src/components/Quote/Quote.stories.d.ts +122 -6
  82. package/dist/esm/src/components/Quotes/Quotes.d.ts +8 -4
  83. package/dist/esm/src/components/Quotes/Quotes.stories.d.ts +22 -0
  84. package/dist/esm/src/components/Signup/PaymentForms.d.ts +2 -4
  85. package/dist/esm/src/components/Signup/Signup.d.ts +11 -1
  86. package/dist/esm/src/components/Signup/Signup.stories.d.ts +6 -4
  87. package/dist/esm/src/components/StateTag.d.ts +3 -5
  88. package/dist/esm/src/components/Subscriptions/Subscriptions.d.ts +2 -1
  89. package/dist/esm/src/components/Subscriptions/Subscriptions.stories.d.ts +10 -0
  90. package/dist/esm/src/components/Transactions/Transactions.d.ts +7 -5
  91. package/dist/esm/src/components/Transactions/Transactions.stories.d.ts +15 -6
  92. package/dist/esm/src/components/Transactions/TransactionsListContext.d.ts +5 -1
  93. package/dist/esm/src/components/Transactions/transactionsList/TransactionsListDesktop.d.ts +1 -1
  94. package/dist/esm/src/contexts/PaymentContext.d.ts +2 -2
  95. package/dist/esm/src/graphql/queries/getAccount.d.ts +1 -1
  96. package/dist/esm/src/hooks/quotes/useSendAcceptQuote.d.ts +2 -2
  97. package/dist/esm/src/hooks/usePaymentMethod.d.ts +1 -1
  98. package/dist/esm/src/mocks/handlers.d.ts +1 -1
  99. package/dist/esm/src/storybook-utils.d.ts +10 -0
  100. package/dist/esm/src/types/shadowType.d.ts +1 -0
  101. package/dist/index.d.ts +45 -25
  102. package/package.json +2 -2
  103. package/dist/cjs/src/components/PaymentForm/Finix/FinixCardForm.d.ts +0 -4
  104. package/dist/cjs/src/components/PaymentForm/Finix/index.d.ts +0 -2
  105. package/dist/cjs/src/components/PaymentForm/FinixAch.d.ts +0 -3
  106. package/dist/cjs/src/components/PaymentForm/PaymentMethod/PaymentMethodContext.d.ts +0 -5
  107. package/dist/cjs/src/components/PaymentForm/PaymentMethodForm.d.ts +0 -3
  108. package/dist/cjs/src/components/PaymentForm/PaymentOption.d.ts +0 -8
  109. package/dist/cjs/src/components/PaymentForm/StoredPaymentMethod/StoredPaymentMethodForm.d.ts +0 -3
  110. package/dist/cjs/src/components/PaymentForm/Stripe/CheckoutForm.d.ts +0 -3
  111. package/dist/cjs/src/components/PaymentForm/Stripe/index.d.ts +0 -1
  112. package/dist/cjs/src/components/PaymentForm/paymentUtils.d.ts +0 -7
  113. package/dist/cjs/src/stories/Button.d.ts +0 -15
  114. package/dist/cjs/src/stories/Button.stories.d.ts +0 -9
  115. package/dist/cjs/src/stories/Header.d.ts +0 -12
  116. package/dist/cjs/src/stories/Header.stories.d.ts +0 -7
  117. package/dist/cjs/src/stories/Page.d.ts +0 -3
  118. package/dist/cjs/src/stories/Page.stories.d.ts +0 -7
  119. package/dist/esm/src/components/PaymentForm/Finix/FinixCardForm.d.ts +0 -4
  120. package/dist/esm/src/components/PaymentForm/Finix/index.d.ts +0 -2
  121. package/dist/esm/src/components/PaymentForm/FinixAch.d.ts +0 -3
  122. package/dist/esm/src/components/PaymentForm/PaymentMethod/PaymentMethodContext.d.ts +0 -5
  123. package/dist/esm/src/components/PaymentForm/PaymentMethodForm.d.ts +0 -3
  124. package/dist/esm/src/components/PaymentForm/PaymentOption.d.ts +0 -8
  125. package/dist/esm/src/components/PaymentForm/StoredPaymentMethod/StoredPaymentMethodForm.d.ts +0 -3
  126. package/dist/esm/src/components/PaymentForm/Stripe/CheckoutForm.d.ts +0 -3
  127. package/dist/esm/src/components/PaymentForm/Stripe/index.d.ts +0 -1
  128. package/dist/esm/src/components/PaymentForm/paymentUtils.d.ts +0 -7
  129. package/dist/esm/src/stories/Button.d.ts +0 -15
  130. package/dist/esm/src/stories/Button.stories.d.ts +0 -9
  131. package/dist/esm/src/stories/Header.d.ts +0 -12
  132. package/dist/esm/src/stories/Header.stories.d.ts +0 -7
  133. package/dist/esm/src/stories/Page.d.ts +0 -3
  134. package/dist/esm/src/stories/Page.stories.d.ts +0 -7
@@ -0,0 +1,10 @@
1
+ import "../../styles/index.less";
2
+ import { ShadowType } from "../../types/shadowType";
3
+ declare const BillingDetails: ({ entityId, accountId, isCardEnabled, shadow, className, }: {
4
+ entityId: string;
5
+ accountId: string;
6
+ isCardEnabled?: boolean | undefined;
7
+ shadow?: ShadowType | undefined;
8
+ className?: string | undefined;
9
+ }) => import("react/jsx-runtime").JSX.Element;
10
+ export default BillingDetails;
@@ -0,0 +1,11 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import BillingDetails from "./BillingDetails";
3
+ declare const meta: Meta<typeof BillingDetails>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof meta>;
6
+ export declare const Default: Story;
7
+ export declare const NoShadow: Story;
8
+ export declare const CustomClassName: Story;
9
+ export declare const NoCard: Story;
10
+ export declare const Mobile: Story;
11
+ export declare const DarkMode: Story;
@@ -0,0 +1 @@
1
+ export { default as BillingDetails } from "./BillingDetails";
@@ -9,17 +9,17 @@ export type BunnyContextValues = {
9
9
  accountId?: string;
10
10
  displayPayButtonNameAnyways?: boolean;
11
11
  darkMode?: boolean;
12
- onErrorNavigate?: () => void;
12
+ onTokenExpired?: () => void;
13
13
  };
14
14
  export declare const BunnyContext: import("react").Context<BunnyContextValues>;
15
- declare function BunnyProvider({ accountId, children, darkMode, onErrorNavigate, queryClient, apiHost, token, window, }: {
15
+ declare function BunnyProvider({ accountId, children, darkMode, queryClient, apiHost, token, window, onTokenExpired, }: {
16
16
  accountId?: string;
17
17
  children: React.ReactNode;
18
18
  darkMode?: boolean;
19
- onErrorNavigate?: () => void;
20
19
  queryClient?: QueryClient;
21
20
  apiHost: string;
22
21
  token: string;
23
22
  window: Window;
23
+ onTokenExpired?: () => void;
24
24
  }): import("react/jsx-runtime").JSX.Element;
25
25
  export default BunnyProvider;
@@ -1,28 +1,8 @@
1
- /// <reference types="react" />
2
1
  import { FormattedInvoice } from "@bunnyapp/common";
3
2
  import { InvoiceQuoteParentProps } from "../PaymentForm/PaymentFormTypes";
4
3
  interface InvoiceCheckoutProps extends InvoiceQuoteParentProps {
5
4
  invoice?: FormattedInvoice;
6
- preCheckout?: () => void;
7
- setIsPreCheckoutLoading?: (loading: boolean) => void;
8
- isPreCheckoutLoading?: boolean;
9
- payImmediatelyGivenInvoice?: boolean;
10
- checkoutButtonName?: {
11
- notIsSaving: string;
12
- isSaving: string;
13
- };
14
5
  entityId: string;
15
6
  }
16
- export declare const InvoiceCheckoutContext: import("react").Context<{
17
- preCheckout?: (() => void) | undefined;
18
- setIsPreCheckoutLoading?: ((loading: boolean) => void) | undefined;
19
- isPreCheckoutLoading?: boolean | undefined;
20
- payImmediatelyGivenInvoice?: boolean | undefined;
21
- checkoutButtonName?: {
22
- notIsSaving: string;
23
- isSaving: string;
24
- } | undefined;
25
- invoice?: FormattedInvoice | undefined;
26
- }>;
27
- declare const InvoiceCheckout: ({ isSaving, onSuccess, onFail, invoice, setIsSaving, preCheckout, setIsPreCheckoutLoading, isPreCheckoutLoading, payImmediatelyGivenInvoice, checkoutButtonName, entityId, }: InvoiceCheckoutProps) => import("react/jsx-runtime").JSX.Element;
7
+ declare const InvoiceCheckout: ({ onSuccess, onFail, invoice, entityId, }: InvoiceCheckoutProps) => import("react/jsx-runtime").JSX.Element;
28
8
  export default InvoiceCheckout;
@@ -8,5 +8,5 @@ interface QuoteCheckoutProps extends InvoiceQuoteParentProps {
8
8
  storedPaymentMethod?: PaymentMethod;
9
9
  entityId: string;
10
10
  }
11
- declare const QuoteCheckout: ({ account, isSaving, onSuccess, onFail, quote, setIsSaving, taxationRequiredAccountFields, entityId, }: QuoteCheckoutProps) => import("react/jsx-runtime").JSX.Element;
11
+ declare const QuoteCheckout: ({ account, onSuccess, onFail, quote, taxationRequiredAccountFields, entityId, }: QuoteCheckoutProps) => import("react/jsx-runtime").JSX.Element;
12
12
  export default QuoteCheckout;
@@ -1,5 +1,6 @@
1
1
  import React from "react";
2
- export default function Invoice({ id, invoiceQuoteViewComponent, backButtonName, onBackButtonClick, onInvoiceDownloadError, onPaymentSuccess, entityId, }: {
2
+ import { ShadowType } from "../../types/shadowType";
3
+ export type InvoiceQuoteContextProps = {
3
4
  id?: string;
4
5
  invoiceQuoteViewComponent?: React.ReactNode;
5
6
  backButtonName?: string;
@@ -7,4 +8,9 @@ export default function Invoice({ id, invoiceQuoteViewComponent, backButtonName,
7
8
  onInvoiceDownloadError?: () => void;
8
9
  onPaymentSuccess?: (savePaymentMethod?: boolean) => void;
9
10
  entityId: string;
10
- }): import("react/jsx-runtime").JSX.Element;
11
+ shadow?: ShadowType;
12
+ className?: string;
13
+ hideDownloadButton?: boolean;
14
+ };
15
+ export declare const InvoiceQuoteContext: React.Context<InvoiceQuoteContextProps>;
16
+ export default function Invoice({ id, invoiceQuoteViewComponent, backButtonName, onBackButtonClick, onInvoiceDownloadError, onPaymentSuccess, entityId, shadow, className, hideDownloadButton, }: InvoiceQuoteContextProps): import("react/jsx-runtime").JSX.Element;
@@ -1,9 +1,18 @@
1
- import type { StoryObj } from "@storybook/react";
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
2
  import Invoice from "./Invoice";
3
- declare const meta: {
4
- component: typeof Invoice;
5
- tags: string[];
6
- };
3
+ declare const meta: Meta<typeof Invoice>;
7
4
  export default meta;
8
5
  type Story = StoryObj<typeof meta>;
6
+ export declare const basicArgs: {
7
+ token: string;
8
+ id: string;
9
+ entityId: string;
10
+ };
9
11
  export declare const Default: Story;
12
+ export declare const NoShadow: Story;
13
+ export declare const CustomBackButton: Story;
14
+ export declare const Mobile: Story;
15
+ export declare const CustomClassName: Story;
16
+ export declare const HideDownloadButton: Story;
17
+ export declare const InvoiceDue: Story;
18
+ export declare const DarkMode: Story;
@@ -1,6 +1,7 @@
1
1
  import { ReactNode } from "react";
2
- declare const PageHeaderWithActions: ({ children, title, }: {
2
+ declare const PageHeaderWithActions: ({ children, title, className, }: {
3
3
  children?: ReactNode | ReactNode[];
4
4
  title?: string | ReactNode;
5
+ className?: string | undefined;
5
6
  }) => import("react/jsx-runtime").JSX.Element;
6
7
  export default PageHeaderWithActions;
@@ -1,9 +1,10 @@
1
- declare const CheckoutFooter: ({ amountDue, currencyId, isSaving, onPaymentSubmit, onlySavePaymentMethod, noPadding, }: {
2
- amountDue?: number | undefined;
3
- currencyId?: string | undefined;
4
- isSaving: boolean;
5
- onPaymentSubmit: () => void;
6
- onlySavePaymentMethod?: boolean | undefined;
1
+ import { FormattedInvoice, PaymentMethod, PluginData, Quote } from "@bunnyapp/common";
2
+ import { OnPaymentSuccessType } from "./PaymentFormTypes";
3
+ declare const CheckoutFooter: ({ quote, invoice, onPaymentSuccess, noPadding, plugin, }: {
4
+ quote?: Quote | undefined;
5
+ invoice?: FormattedInvoice | undefined;
6
+ onPaymentSuccess: ({ pluginPaymentResponse, savedPaymentMethodResponse, }: OnPaymentSuccessType) => void;
7
7
  noPadding?: boolean | undefined;
8
- }) => import("react/jsx-runtime").JSX.Element;
8
+ plugin: PluginData | PaymentMethod | undefined;
9
+ }) => import("react/jsx-runtime").JSX.Element | null;
9
10
  export default CheckoutFooter;
@@ -1,3 +1,7 @@
1
- import { PluginFormProps } from "../PaymentFormTypes";
2
- declare const DemoPayForm: ({ isSaving, invoice, onFail, onPaymentSuccess, plugin, quote, setIsSaving, }: PluginFormProps) => import("react/jsx-runtime").JSX.Element;
1
+ import { PluginData } from "@bunnyapp/common";
2
+ declare const DemoPayForm: ({ onFail, onSavePaymentMethod, plugin, }: {
3
+ onFail: (error: any) => void;
4
+ onSavePaymentMethod: (response: any) => void;
5
+ plugin: PluginData;
6
+ }) => import("react/jsx-runtime").JSX.Element;
3
7
  export default DemoPayForm;
@@ -1,13 +1,11 @@
1
1
  import { PluginData } from "@bunnyapp/common";
2
- export declare const confirmPayment: ({ amount, currency, cardDetails, }: {
2
+ export declare const confirmPayment: ({ amount, currency, }: {
3
3
  amount: number;
4
4
  currency: string;
5
- cardDetails: any;
6
5
  }) => {
7
6
  token: string;
8
7
  amount: number;
9
8
  currency: string;
10
- cardDetails: any;
11
9
  };
12
10
  export declare const isDigit: (char: string) => boolean;
13
11
  export declare const isValidKey: (code: number) => boolean;
@@ -0,0 +1,13 @@
1
+ import { FormattedInvoice, PluginData, Quote } from "@bunnyapp/common";
2
+ export declare function usePay({ onPaymentSuccess, onPaymentError, quote, invoice, }: {
3
+ onPaymentSuccess: (response: any) => void;
4
+ onPaymentError?: (error: any) => void;
5
+ quote?: Quote;
6
+ invoice?: FormattedInvoice;
7
+ }): {
8
+ pay: ({ plugin, savePaymentMethod, }: {
9
+ plugin: PluginData;
10
+ savePaymentMethod: boolean;
11
+ }) => Promise<void>;
12
+ };
13
+ export default usePay;
@@ -0,0 +1,21 @@
1
+ import { FormattedInvoice, PluginData, Quote } from "@bunnyapp/common";
2
+ export declare function useSave({ onSaveSuccess, token, apiHost, accountId, }: {
3
+ onSaveSuccess: (response: any) => void;
4
+ quote?: Quote;
5
+ invoice?: FormattedInvoice;
6
+ token: string;
7
+ apiHost: string;
8
+ accountId?: string;
9
+ }): {
10
+ save: ({ cardDetails, plugin, savePaymentMethod, }: {
11
+ cardDetails: {
12
+ number: string;
13
+ expiry: string;
14
+ cvc: string;
15
+ };
16
+ plugin: PluginData;
17
+ savePaymentMethod: boolean;
18
+ }) => Promise<void>;
19
+ isSaving: boolean;
20
+ };
21
+ export default useSave;
@@ -1,7 +1,11 @@
1
- import { ReactNode } from "react";
2
- import { GeneralPaymentFormProps } from "./PaymentFormTypes";
3
- export declare const PaymentFormWrapper: ({ children, setMaxHeight, }: {
4
- children: ReactNode | ReactNode[];
5
- setMaxHeight: boolean;
1
+ import { FormattedInvoice, Quote } from "@bunnyapp/common";
2
+ import { OnPaymentSuccessType } from "./PaymentFormTypes";
3
+ export declare const PaymentForm: ({ entityId, invoice, onFail, onPaymentSuccess, quote, accountId, onSavePaymentMethod, }: {
4
+ entityId: string;
5
+ invoice?: FormattedInvoice | undefined;
6
+ quote?: Quote | undefined;
7
+ onFail: (error: any) => void;
8
+ onPaymentSuccess?: (({ pluginPaymentResponse, savedPaymentMethodResponse, }: OnPaymentSuccessType) => void) | undefined;
9
+ onSavePaymentMethod?: (() => void) | undefined;
10
+ accountId?: string | undefined;
6
11
  }) => import("react/jsx-runtime").JSX.Element;
7
- export declare const PaymentForm: ({ entityId, invoice, isSaving, onFail, onPaymentSuccess, quote, setIsSaving, }: GeneralPaymentFormProps) => import("react/jsx-runtime").JSX.Element;
@@ -8,10 +8,6 @@ export type PluginPaymentResponse = {
8
8
  savePaymentMethod?: boolean;
9
9
  token: string;
10
10
  };
11
- export interface PaymentMethodFormProps extends GeneralPaymentFormProps {
12
- isPlugin: boolean;
13
- paymentMethod: PaymentMethod | PluginData;
14
- }
15
11
  export interface StoredPaymentMethodFormProps extends GeneralPaymentFormProps {
16
12
  paymentMethod: PaymentMethod;
17
13
  }
@@ -22,12 +18,10 @@ export interface PluginFormProps extends GeneralPaymentFormProps {
22
18
  plugin: PluginData;
23
19
  }
24
20
  export type InvoiceQuoteParentProps = {
25
- isSaving: boolean;
26
21
  onSuccess: ({ savePaymentMethod }: {
27
22
  savePaymentMethod?: boolean;
28
23
  }) => void;
29
24
  onFail: (error: any) => void;
30
- setIsSaving: (isSaving: boolean) => void;
31
25
  };
32
26
  export type OnPaymentSuccessType = {
33
27
  pluginPaymentResponse?: PluginPaymentResponse;
@@ -38,10 +32,8 @@ export type GeneralPaymentFormProps = {
38
32
  payable?: Payable;
39
33
  invoice?: FormattedInvoice;
40
34
  quote?: Quote;
41
- isSaving: boolean;
42
35
  onFail: (error: any) => void;
43
36
  onPaymentSuccess: ({ pluginPaymentResponse, savedPaymentMethodResponse, }: OnPaymentSuccessType) => void;
44
- setIsSaving: (isSaving: boolean) => void;
45
37
  };
46
38
  export type CheckoutProps = {
47
39
  invoice?: FormattedInvoice;
@@ -1,12 +1,22 @@
1
1
  import { PaymentMethod } from "@bunnyapp/common";
2
+ import { ShadowType } from "../../../../types/shadowType";
2
3
  type CreditCardProps = {
3
4
  onClickRemove: () => void;
4
5
  onClickUpdate: () => void;
5
6
  paymentMethodData: PaymentMethod;
7
+ shadow?: ShadowType;
8
+ cardEnabled?: boolean;
6
9
  };
7
- declare const CreditCard: ({ onClickRemove, onClickUpdate, paymentMethodData, }: CreditCardProps) => import("react/jsx-runtime").JSX.Element;
8
- declare const EmptyCard: ({ onClick }: {
10
+ declare const CreditCard: ({ onClickRemove, onClickUpdate, paymentMethodData, shadow, cardEnabled, }: CreditCardProps) => import("react/jsx-runtime").JSX.Element;
11
+ export declare const MiniCreditCard: ({ hideRemoveButton, onClickRemove, paymentMethodData, }: {
12
+ hideRemoveButton?: boolean | undefined;
13
+ onClickRemove: () => void;
14
+ paymentMethodData: PaymentMethod;
15
+ }) => import("react/jsx-runtime").JSX.Element;
16
+ declare const EmptyCard: ({ onClick, shadow, cardEnabled, }: {
9
17
  onClick: () => void;
18
+ shadow?: ShadowType | undefined;
19
+ cardEnabled?: boolean | undefined;
10
20
  }) => import("react/jsx-runtime").JSX.Element;
11
21
  export { EmptyCard };
12
22
  export default CreditCard;
@@ -1,6 +1,8 @@
1
- /// <reference types="react" />
2
1
  import "../../../styles/index.less";
3
- export declare function PaymentMethod({ entityId, footer, }: {
2
+ import { ShadowType } from "../../../types/shadowType";
3
+ export declare const PaymentMethod: ({ entityId, className, shadow, cardEnabled, }: {
4
4
  entityId: string;
5
- footer?: React.ReactNode;
6
- }): import("react/jsx-runtime").JSX.Element;
5
+ className?: string | undefined;
6
+ shadow?: ShadowType | undefined;
7
+ cardEnabled?: boolean | undefined;
8
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,11 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { PaymentMethod } from "./PaymentMethod";
3
+ declare const meta: Meta<typeof PaymentMethod>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof meta>;
6
+ export declare const Default: Story;
7
+ export declare const CustomClassName: Story;
8
+ export declare const NoShadow: Story;
9
+ export declare const NoCard: Story;
10
+ export declare const Mobile: Story;
11
+ export declare const DarkMode: Story;
@@ -0,0 +1,8 @@
1
+ import { PaymentMethod, PluginData } from "@bunnyapp/common";
2
+ import { OnPaymentSuccessType } from "./PaymentFormTypes";
3
+ declare const PaymentMethodDetails: ({ onFail, paymentMethod, onSavePaymentMethod, }: {
4
+ onFail: (error: any) => void;
5
+ paymentMethod: PaymentMethod | PluginData;
6
+ onSavePaymentMethod: ({ pluginPaymentResponse, savedPaymentMethodResponse, }: OnPaymentSuccessType) => void;
7
+ }) => import("react/jsx-runtime").JSX.Element | null;
8
+ export default PaymentMethodDetails;
@@ -1,8 +1,7 @@
1
- import { PluginData, PaymentMethod } from "@bunnyapp/common";
2
- declare const PaymentMethodSelector: ({ paymentMethodAllowedPlugins, onSelect, showStoredPaymentMethodOption, value, }: {
1
+ import { PaymentMethod, PluginData } from "@bunnyapp/common";
2
+ declare const PaymentMethodSelector: ({ paymentMethodAllowedPlugins, onSelect, value, }: {
3
3
  onSelect: (paymentMethod?: PluginData | PaymentMethod) => void;
4
4
  paymentMethodAllowedPlugins?: PluginData[] | undefined;
5
- showStoredPaymentMethodOption: boolean;
6
5
  value?: PluginData | PaymentMethod | null | undefined;
7
6
  }) => import("react/jsx-runtime").JSX.Element;
8
7
  export default PaymentMethodSelector;
@@ -0,0 +1,6 @@
1
+ declare const SavePaymentMethodFooter: ({ isSaving, onSave, noPadding, }: {
2
+ isSaving: boolean;
3
+ onSave: () => void;
4
+ noPadding?: boolean | undefined;
5
+ }) => import("react/jsx-runtime").JSX.Element;
6
+ export default SavePaymentMethodFooter;
@@ -1,3 +1,7 @@
1
- import { PluginFormProps } from "../PaymentFormTypes";
2
- declare const PaymentMethodForm: ({ isSaving, setIsSaving, plugin, onFail, onPaymentSuccess, }: PluginFormProps) => import("react/jsx-runtime").JSX.Element;
1
+ import { PluginData } from "@bunnyapp/common";
2
+ declare const PaymentMethodForm: ({ plugin, onFail, onSavePaymentMethod, }: {
3
+ plugin: PluginData;
4
+ onFail: (error: any) => void;
5
+ onSavePaymentMethod: (response: any) => void;
6
+ }) => import("react/jsx-runtime").JSX.Element;
3
7
  export default PaymentMethodForm;
@@ -1,3 +1,7 @@
1
- import { PluginFormProps } from "../PaymentFormTypes";
2
- declare const StripeForm: ({ entityId, payable, plugin, isSaving, setIsSaving, onFail, onPaymentSuccess, }: PluginFormProps) => import("react/jsx-runtime").JSX.Element | null;
1
+ import { PluginData } from "@bunnyapp/common";
2
+ declare const StripeForm: ({ plugin, onFail, onSavePaymentMethod, }: {
3
+ plugin: PluginData;
4
+ onFail: (error: any) => void;
5
+ onSavePaymentMethod: (response: any) => void;
6
+ }) => import("react/jsx-runtime").JSX.Element | null;
3
7
  export default StripeForm;
@@ -0,0 +1,12 @@
1
+ import { FormattedInvoice, PluginData, Quote } from "@bunnyapp/common";
2
+ export declare function usePay({ onPaymentSuccess, onPaymentError, quote, invoice, }: {
3
+ onPaymentSuccess?: (response: any) => void;
4
+ onPaymentError?: (error: any) => void;
5
+ quote?: Quote;
6
+ invoice?: FormattedInvoice;
7
+ }): {
8
+ pay: ({ plugin }: {
9
+ plugin: PluginData;
10
+ }) => Promise<void>;
11
+ };
12
+ export default usePay;
@@ -0,0 +1,10 @@
1
+ import { PluginData } from "@bunnyapp/common";
2
+ export declare function useSave({ onSaveSuccess, }: {
3
+ onSaveSuccess: (response: any) => void;
4
+ }): {
5
+ save: ({ plugin }: {
6
+ plugin: PluginData;
7
+ }) => Promise<void>;
8
+ isSaving: boolean;
9
+ };
10
+ export default useSave;
@@ -8,13 +8,19 @@ export declare const createPaymentMethod: ({ paymentMethodId, plugin, token, api
8
8
  accountId?: string | undefined;
9
9
  }) => Promise<any>;
10
10
  export declare const createSetupIntent: (plugin: PluginData, token: string, apiHost: string, accountId?: string) => Promise<any>;
11
- export declare const createPaymentIntent: ({ payable, savePaymentMethod, memo, plugin, token, apiHost, accountId, }: {
11
+ export declare const createPaymentIntent: ({ payable, savePaymentMethod, memo, plugin, token, apiHost, }: {
12
12
  payable: Payable;
13
13
  savePaymentMethod: boolean;
14
14
  memo?: string | undefined;
15
15
  plugin: PluginData;
16
16
  token: string;
17
17
  apiHost: string;
18
- accountId?: string | undefined;
19
18
  }) => Promise<any>;
20
- export declare const useStripePlugin: (plugin: PluginData, token: string, apiHost: string, accountId?: string) => Stripe | null;
19
+ export declare const useStripePlugin: (plugin: PluginData | undefined, token: string, apiHost: string, accountId?: string) => {
20
+ stripe: Stripe | null;
21
+ options: {
22
+ mode: "setup";
23
+ currency: string;
24
+ setupFutureUsage: "off_session";
25
+ };
26
+ };
@@ -0,0 +1,3 @@
1
+ import { PluginData } from "@bunnyapp/common";
2
+ declare function useRemovePaymentMethod(paymentPlugins: PluginData[], token: string, apiHost: string, accountId?: string): (data: any) => void;
3
+ export default useRemovePaymentMethod;
@@ -1,6 +1,4 @@
1
1
  /// <reference types="react" />
2
+ import { InvoiceQuoteContextProps } from "../Invoice/Invoice";
2
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;
3
- export default function Quote({ entityId, id, }: {
4
- entityId: string;
5
- id?: string;
6
- }): import("react/jsx-runtime").JSX.Element;
4
+ export default function Quote({ id, invoiceQuoteViewComponent, onInvoiceDownloadError, onPaymentSuccess, entityId, shadow, className, hideDownloadButton, }: InvoiceQuoteContextProps): import("react/jsx-runtime").JSX.Element;
@@ -1,8 +1,124 @@
1
- import type { StoryObj } from "@storybook/react";
2
- import Transactions from "./Quote";
3
- declare const meta: {
4
- component: typeof Transactions;
5
- };
1
+ /// <reference types="react" />
2
+ import type { Meta, StoryObj } from "@storybook/react";
3
+ import Quote from "./Quote";
4
+ declare const meta: Meta<typeof Quote>;
6
5
  export default meta;
7
6
  type Story = StoryObj<typeof meta>;
8
- export declare const Default: Story;
7
+ export declare const Default: import("@storybook/csf").StoryAnnotations<import("@storybook/react/dist/types-a5624094").R, {
8
+ id?: string | undefined;
9
+ invoiceQuoteViewComponent?: import("react").ReactNode;
10
+ backButtonName?: string | undefined;
11
+ onBackButtonClick?: (() => void) | undefined;
12
+ onInvoiceDownloadError?: (() => void) | undefined;
13
+ onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
14
+ entityId: string;
15
+ shadow?: import("../../types/shadowType").ShadowType | undefined;
16
+ className?: string | undefined;
17
+ hideDownloadButton?: boolean | undefined;
18
+ }, {
19
+ id?: string | undefined;
20
+ entityId?: string | undefined;
21
+ className?: string | undefined;
22
+ invoiceQuoteViewComponent?: import("react").ReactNode;
23
+ 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
+ }>;
30
+ export declare const NoShadow: import("@storybook/csf").StoryAnnotations<import("@storybook/react/dist/types-a5624094").R, {
31
+ id?: string | undefined;
32
+ invoiceQuoteViewComponent?: import("react").ReactNode;
33
+ backButtonName?: string | undefined;
34
+ onBackButtonClick?: (() => void) | undefined;
35
+ onInvoiceDownloadError?: (() => void) | undefined;
36
+ onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
37
+ entityId: string;
38
+ shadow?: import("../../types/shadowType").ShadowType | undefined;
39
+ className?: string | undefined;
40
+ hideDownloadButton?: boolean | undefined;
41
+ }, {
42
+ id?: string | undefined;
43
+ entityId?: string | undefined;
44
+ className?: string | undefined;
45
+ invoiceQuoteViewComponent?: import("react").ReactNode;
46
+ 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
+ }>;
53
+ export declare const Mobile: import("@storybook/csf").StoryAnnotations<import("@storybook/react/dist/types-a5624094").R, {
54
+ id?: string | undefined;
55
+ invoiceQuoteViewComponent?: import("react").ReactNode;
56
+ backButtonName?: string | undefined;
57
+ onBackButtonClick?: (() => void) | undefined;
58
+ onInvoiceDownloadError?: (() => void) | undefined;
59
+ onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
60
+ entityId: string;
61
+ shadow?: import("../../types/shadowType").ShadowType | undefined;
62
+ className?: string | undefined;
63
+ hideDownloadButton?: boolean | undefined;
64
+ }, {
65
+ id?: string | undefined;
66
+ entityId?: string | undefined;
67
+ className?: string | undefined;
68
+ invoiceQuoteViewComponent?: import("react").ReactNode;
69
+ 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
+ }>;
76
+ export declare const CustomClassName: import("@storybook/csf").StoryAnnotations<import("@storybook/react/dist/types-a5624094").R, {
77
+ id?: string | undefined;
78
+ invoiceQuoteViewComponent?: import("react").ReactNode;
79
+ backButtonName?: string | undefined;
80
+ onBackButtonClick?: (() => void) | undefined;
81
+ onInvoiceDownloadError?: (() => void) | undefined;
82
+ onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
83
+ entityId: string;
84
+ shadow?: import("../../types/shadowType").ShadowType | undefined;
85
+ className?: string | undefined;
86
+ hideDownloadButton?: boolean | undefined;
87
+ }, {
88
+ id?: string | undefined;
89
+ entityId?: string | undefined;
90
+ className?: string | undefined;
91
+ invoiceQuoteViewComponent?: import("react").ReactNode;
92
+ 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
+ }>;
99
+ export declare const HideDownloadButton: Story;
100
+ export declare const AcceptedQuote: Story;
101
+ export declare const AcceptedQuoteDarkMode: Story;
102
+ export declare const DarkMode: import("@storybook/csf").StoryAnnotations<import("@storybook/react/dist/types-a5624094").R, {
103
+ id?: string | undefined;
104
+ invoiceQuoteViewComponent?: import("react").ReactNode;
105
+ backButtonName?: string | undefined;
106
+ onBackButtonClick?: (() => void) | undefined;
107
+ onInvoiceDownloadError?: (() => void) | undefined;
108
+ onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
109
+ entityId: string;
110
+ shadow?: import("../../types/shadowType").ShadowType | undefined;
111
+ className?: string | undefined;
112
+ hideDownloadButton?: boolean | undefined;
113
+ }, {
114
+ id?: string | undefined;
115
+ entityId?: string | undefined;
116
+ className?: string | undefined;
117
+ invoiceQuoteViewComponent?: import("react").ReactNode;
118
+ 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
+ }>;
@@ -1,20 +1,24 @@
1
1
  /// <reference types="react" />
2
2
  import { FrontendTransaction as T } from "@bunnyapp/common";
3
- declare function Quotes({ className, columns, entityId, filter, noQuotesMessage, onQuoteClick, quoteComponent, searchBarClassName, shadow, showSearchBar, showTitle, style, suppressQuoteDisplay, useModal, }: {
3
+ import { ShadowType } from "../../types/shadowType";
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, }: {
4
6
  /** A custom component to render instead of the default invoice component */
5
7
  quoteComponent?: React.ReactNode;
6
8
  /** Whether to show the search bar */
7
9
  showSearchBar?: boolean;
8
10
  /** Whether to show the title */
9
11
  showTitle?: boolean;
10
- /** The columns to display in the transactions list */
11
- columns?: ("date-and-title" | "state" | "amount" | "download" | "actions")[];
12
+ /** The title to display in the quotes list */
13
+ title?: string;
14
+ /** The columns to display in the quotes list */
15
+ columns?: TransactionListColumnType[];
12
16
  /** A custom class name to apply to the component */
13
17
  className?: string;
14
18
  /** Whether to use a modal for the invoice drawer */
15
19
  useModal?: boolean;
16
20
  /** Whether to show a shadow around the transactions list */
17
- shadow?: "none" | "sm" | "md" | "lg" | "xl";
21
+ shadow?: ShadowType;
18
22
  /** A custom class name to apply to the search bar */
19
23
  searchBarClassName?: string;
20
24
  /** A function to call when a quote is clicked */
@@ -0,0 +1,22 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import Quotes from "./Quotes";
3
+ declare const meta: Meta<typeof Quotes>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof meta>;
6
+ export declare const Default: Story;
7
+ export declare const Padding0BGRed: Story;
8
+ export declare const NoShadow: Story;
9
+ export declare const WithModal: Story;
10
+ export declare const HideSearchBar: Story;
11
+ export declare const HideTitle: Story;
12
+ export declare const HideTitleAndSearchBar: Story;
13
+ export declare const CustomTitle: Story;
14
+ export declare const Mobile: Story;
15
+ export declare const WithCustomQuoteComponent: Story;
16
+ export declare const WithCustomColumns1: Story;
17
+ export declare const WithCustomColumns2: Story;
18
+ export declare const WithCustomColumns3: Story;
19
+ export declare const WithCustomColumns4: Story;
20
+ export declare const WithCustomColumns5: Story;
21
+ export declare const DarkMode: Story;
22
+ export declare const CustomColors: Story;