@bunnyapp/components 1.8.0-beta.24 → 1.8.0-beta.26

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 (36) hide show
  1. package/dist/cjs/index.js +288 -229
  2. package/dist/cjs/types/src/components/PaymentForm/PaymentForm.d.ts +4 -6
  3. package/dist/cjs/types/src/components/PaymentForm/components/PaymentMethodDetails/components/Collapsible.d.ts +7 -0
  4. package/dist/cjs/types/src/components/PaymentForm/constants.d.ts +1 -0
  5. package/dist/cjs/types/src/components/PaymentForm/context/CallbacksContext.d.ts +1 -1
  6. package/dist/cjs/types/src/components/Signup/Signup.d.ts +3 -8
  7. package/dist/cjs/types/src/components/Signup/SignupContent.d.ts +1 -1
  8. package/dist/cjs/types/src/components/Signup/components/CheckoutSummary/fragments/CheckoutSummary_QuoteFragment.d.ts +0 -2
  9. package/dist/cjs/types/src/components/Signup/components/PriceListDisplay.d.ts +11 -1
  10. package/dist/cjs/types/src/components/Signup/components/QuoteCreateButton.d.ts +1 -4
  11. package/dist/cjs/types/src/components/Signup/fragments/Signup_PriceListFragment.d.ts +0 -1
  12. package/dist/cjs/types/src/components/Signup/fragments/Signup_QuoteFragment.d.ts +3 -2
  13. package/dist/cjs/types/src/components/Signup/hooks/useApplyDefaultCoupon.d.ts +1 -10
  14. package/dist/cjs/types/src/components/Signup/hooks/useQuoteAccountSignupMutation.d.ts +1 -4
  15. package/dist/cjs/types/src/components/Signup/hooks/useSignupQuoteQueryData.d.ts +8 -1
  16. package/dist/cjs/types/src/components/Signup/queries/getSignupQuote.d.ts +10 -0
  17. package/dist/esm/index.js +290 -231
  18. package/dist/esm/types/src/components/PaymentForm/PaymentForm.d.ts +4 -6
  19. package/dist/esm/types/src/components/PaymentForm/components/PaymentMethodDetails/components/Collapsible.d.ts +7 -0
  20. package/dist/esm/types/src/components/PaymentForm/constants.d.ts +1 -0
  21. package/dist/esm/types/src/components/PaymentForm/context/CallbacksContext.d.ts +1 -1
  22. package/dist/esm/types/src/components/Signup/Signup.d.ts +3 -8
  23. package/dist/esm/types/src/components/Signup/SignupContent.d.ts +1 -1
  24. package/dist/esm/types/src/components/Signup/components/CheckoutSummary/fragments/CheckoutSummary_QuoteFragment.d.ts +0 -2
  25. package/dist/esm/types/src/components/Signup/components/PriceListDisplay.d.ts +11 -1
  26. package/dist/esm/types/src/components/Signup/components/QuoteCreateButton.d.ts +1 -4
  27. package/dist/esm/types/src/components/Signup/fragments/Signup_PriceListFragment.d.ts +0 -1
  28. package/dist/esm/types/src/components/Signup/fragments/Signup_QuoteFragment.d.ts +3 -2
  29. package/dist/esm/types/src/components/Signup/hooks/useApplyDefaultCoupon.d.ts +1 -10
  30. package/dist/esm/types/src/components/Signup/hooks/useQuoteAccountSignupMutation.d.ts +1 -4
  31. package/dist/esm/types/src/components/Signup/hooks/useSignupQuoteQueryData.d.ts +8 -1
  32. package/dist/esm/types/src/components/Signup/queries/getSignupQuote.d.ts +10 -0
  33. package/dist/index.d.ts +7 -13
  34. package/package.json +1 -1
  35. package/dist/cjs/types/src/components/Signup/fragments/useApplyDefaultCoupon_QuoteFragment.d.ts +0 -9
  36. package/dist/esm/types/src/components/Signup/fragments/useApplyDefaultCoupon_QuoteFragment.d.ts +0 -9
@@ -19,7 +19,7 @@ export declare const PaymentForm_InvoiceFragment: import("gql.tada").TadaDocumen
19
19
  on: "Invoice";
20
20
  masked: true;
21
21
  }>;
22
- declare function PaymentFormRoot({ currencyId: accountCurrencyId, invoice: maskedInvoice, quote: maskedQuote, paymentHold, onPaymentSuccess, onPaymentHoldSuccess, paymentHoldPrecondition, accountId, onSavePaymentMethod, onPaymentMethodRemoved, onSetDefaultPaymentMethod, customCheckoutFunction, children, }: {
22
+ declare function PaymentFormRoot({ currencyId: accountCurrencyId, invoice: maskedInvoice, quote: maskedQuote, paymentHold, onPaymentSuccess, onPaymentHoldSuccess, checkoutPrecondition, accountId, onSavePaymentMethod, onPaymentMethodRemoved, onSetDefaultPaymentMethod, customCheckoutFunction, children, }: {
23
23
  currencyId?: string;
24
24
  invoice?: FragmentOf<typeof PaymentForm_InvoiceFragment>;
25
25
  quote?: FragmentOf<typeof PaymentForm_QuoteFragment>;
@@ -29,17 +29,15 @@ declare function PaymentFormRoot({ currencyId: accountCurrencyId, invoice: maske
29
29
  };
30
30
  onPaymentSuccess?: (response: any) => void;
31
31
  onPaymentHoldSuccess?: (response: any) => void;
32
- /**
33
- * If provided, the payment hold will only go through if this condition returns true.
34
- */
35
- paymentHoldPrecondition?: () => boolean | Promise<boolean>;
32
+ /** Precondition that must pass before checking out free/trial/paid/payment-hold quotes. */
33
+ checkoutPrecondition?: () => boolean | Promise<boolean>;
36
34
  onSavePaymentMethod?: (response: any) => void;
37
35
  onPaymentMethodRemoved?: (paymentMethod: PaymentMethodFragment) => void;
38
36
  onSetDefaultPaymentMethod?: () => void;
39
37
  accountId?: string;
40
38
  customCheckoutFunction?: (pluginId: string, paymentMethodId: string) => Promise<any>;
41
39
  children?: ReactNode | ((state: PaymentFormRenderState) => ReactNode);
42
- }): import("react/jsx-runtime").JSX.Element;
40
+ }): import("react/jsx-runtime").JSX.Element | null;
43
41
  type PaymentFormProps = ComponentProps<typeof PaymentFormRoot>;
44
42
  export type PaymentFormRenderState = {
45
43
  hasPaymentMethods: boolean;
@@ -0,0 +1,7 @@
1
+ import { ReactNode } from 'react';
2
+ type CollapsibleProps = {
3
+ open: boolean;
4
+ children: ReactNode;
5
+ };
6
+ export declare function Collapsible({ open, children }: CollapsibleProps): import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1 @@
1
+ export declare const PAYMENT_FORM_GAP = "bunny-gap-2";
@@ -5,7 +5,7 @@ export type PaymentCallbacksContextValue = {
5
5
  onPaymentMethodRemoved: ((paymentMethod: PaymentMethodFragment) => void) | undefined;
6
6
  onSavePaymentMethod: ((response: any) => void) | undefined;
7
7
  onPaymentHoldSuccess: ((response: any) => void) | undefined;
8
- paymentHoldPrecondition: (() => boolean | Promise<boolean>) | undefined;
8
+ checkoutPrecondition: (() => boolean | Promise<boolean>) | undefined;
9
9
  };
10
10
  declare const PaymentFormCallbacksProvider: ({ value, children }: {
11
11
  value: PaymentCallbacksContextValue;
@@ -1,16 +1,9 @@
1
1
  import type { FormInstance } from "antd/es/form";
2
- import { ShadowType } from '../../types/shadowType';
3
2
  import { type DefaultSignupValues, InitialSignupFormData, type RequiredBillingDetailsFlags } from "./components/InitialSignupFormFields";
4
3
  export type SignupProps = {
5
4
  priceListCode: string;
6
5
  /** If trial is allowed on priceList, enableTrial will enable the trial for the signup */
7
6
  enableTrial?: boolean;
8
- /** The URL to redirect to after the signup is complete */
9
- returnUrl?: string;
10
- /** A custom class name to apply to the component */
11
- className?: string;
12
- /** The shadow level to apply to the component */
13
- shadow?: ShadowType;
14
7
  /** A custom style to apply to the component */
15
8
  style?: React.CSSProperties;
16
9
  /** The default form values to use for the signup */
@@ -21,6 +14,8 @@ export type SignupProps = {
21
14
  documentTemplateId?: string;
22
15
  /** Which account billing fields to show and require */
23
16
  requiredBillingDetails?: RequiredBillingDetailsFlags;
17
+ /** A default coupon code to pre-apply to the checkout */
18
+ defaultCouponCode?: string;
24
19
  };
25
20
  declare const useSignupPortalSessionToken: () => [string | undefined, import("react").Dispatch<import("react").SetStateAction<string | undefined>>];
26
21
  declare const useSignupAccountId: () => [string | undefined, import("react").Dispatch<import("react").SetStateAction<string | undefined>>];
@@ -30,5 +25,5 @@ declare const useSignupOptions: () => {
30
25
  enableTrial: boolean;
31
26
  paymentRequiredToAcceptQuote?: boolean;
32
27
  };
33
- export default function Signup({ priceListCode, enableTrial, returnUrl, className, shadow, style, defaultFormValues, paymentRequiredToAcceptQuote, documentTemplateId, requiredBillingDetails, }: SignupProps): import("react/jsx-runtime").JSX.Element;
28
+ export default function Signup({ priceListCode, enableTrial, style, defaultFormValues, paymentRequiredToAcceptQuote, documentTemplateId, requiredBillingDetails, defaultCouponCode, }: SignupProps): import("react/jsx-runtime").JSX.Element;
34
29
  export { useSignupAccountId, useSignupForm, useSignupOptions, useSignupPortalSessionToken, useSignupPurchaseSucceeded };
@@ -1,2 +1,2 @@
1
1
  import type { SignupProps } from './Signup';
2
- export declare function SignupContent({ priceListCode, defaultFormValues, documentTemplateId, requiredBillingDetails, returnUrl: returnUrlProp, style, }: SignupProps): import("react/jsx-runtime").JSX.Element;
2
+ export declare function SignupContent({ priceListCode, defaultFormValues, documentTemplateId, requiredBillingDetails, style, defaultCouponCode, }: SignupProps): import("react/jsx-runtime").JSX.Element;
@@ -21,8 +21,6 @@ export declare const CheckoutSummary_QuoteFragment: import("gql.tada").TadaDocum
21
21
  }[];
22
22
  }[] | null;
23
23
  [$tada.fragmentRefs]: {
24
- useApplyDefaultCoupon_QuoteFragment: "Quote";
25
- } & {
26
24
  canApplyCoupons_QuoteFragment: "Quote";
27
25
  };
28
26
  }, {}, {
@@ -14,6 +14,16 @@ export declare const PriceListDisplay_PriceListFragment: import("gql.tada").Tada
14
14
  on: "PriceList";
15
15
  masked: true;
16
16
  }>;
17
- export default function PriceListDisplay({ priceList: maskedPriceList }: {
17
+ export declare const PriceListDisplay_QuoteFragment: import("gql.tada").TadaDocumentNode<{
18
+ quoteChanges: {
19
+ isTrial: boolean;
20
+ }[] | null;
21
+ }, {}, {
22
+ fragment: "PriceListDisplay_QuoteFragment";
23
+ on: "Quote";
24
+ masked: true;
25
+ }>;
26
+ export default function PriceListDisplay({ priceList: maskedPriceList, quote: maskedQuote, }: {
18
27
  priceList: FragmentOf<typeof PriceListDisplay_PriceListFragment> | undefined | null;
28
+ quote?: FragmentOf<typeof PriceListDisplay_QuoteFragment> | undefined | null;
19
29
  }): import("react/jsx-runtime").JSX.Element | null;
@@ -1,9 +1,6 @@
1
1
  type QuoteCreateButtonProps = {
2
2
  priceListCode: string;
3
- priceList: {
4
- trialAllowed?: boolean;
5
- } | null | undefined;
6
3
  documentTemplateId?: string;
7
4
  };
8
- export default function QuoteCreateButton({ priceListCode, priceList, documentTemplateId, }: QuoteCreateButtonProps): import("react/jsx-runtime").JSX.Element;
5
+ export default function QuoteCreateButton({ priceListCode, documentTemplateId, }: QuoteCreateButtonProps): import("react/jsx-runtime").JSX.Element;
9
6
  export {};
@@ -16,7 +16,6 @@ export declare const Signup_PriceListFragment: import("gql.tada").TadaDocumentNo
16
16
  } | null;
17
17
  code: string | null;
18
18
  currencyId: string;
19
- trialAllowed: boolean;
20
19
  }, {}, {
21
20
  fragment: "Signup_PriceListFragment";
22
21
  on: "PriceList";
@@ -1,7 +1,5 @@
1
1
  export declare const Signup_QuoteFragment: import("gql.tada").TadaDocumentNode<{
2
2
  [$tada.fragmentRefs]: {
3
- useApplyDefaultCoupon_QuoteFragment: "Quote";
4
- } & {
5
3
  CheckoutSummary_QuoteFragment: "Quote";
6
4
  } & {
7
5
  PaymentForm_QuoteFragment: "Quote";
@@ -9,12 +7,15 @@ export declare const Signup_QuoteFragment: import("gql.tada").TadaDocumentNode<{
9
7
  SignupPaymentForm_QuoteFragment: "Quote";
10
8
  } & {
11
9
  SignupQuote_QuoteFragment: "Quote";
10
+ } & {
11
+ PriceListDisplay_QuoteFragment: "Quote";
12
12
  };
13
13
  state: "APPROVED" | "REJECTED" | "DRAFT" | "SHARED" | "VIEWED" | "ACCEPTED" | "IN_APPROVAL" | "UNDONE";
14
14
  id: string | null;
15
15
  accountId: string;
16
16
  currencyId: string;
17
17
  amountDue: number | null;
18
+ amount: number;
18
19
  payToAccept: boolean | null;
19
20
  quoteChanges: {
20
21
  id: string | null;
@@ -1,13 +1,4 @@
1
- import { FragmentOf } from 'gql.tada';
2
- import { useApplyDefaultCoupon_QuoteFragment } from '../fragments/useApplyDefaultCoupon_QuoteFragment';
3
- /**
4
- * Applies a default coupon code once when quoteChangeId is available.
5
- * Uses a ref to ensure coupon code is only applied once.
6
- */
7
- export default function useApplyDefaultCoupon({ couponCode, quoteChangeId, quote: maskedQuote, activeCouponsExist, addCoupon, }: {
1
+ export default function useApplyDefaultCoupon({ couponCode, addCoupon, }: {
8
2
  couponCode: string | undefined;
9
- quoteChangeId: string | undefined;
10
- quote: FragmentOf<typeof useApplyDefaultCoupon_QuoteFragment> | undefined | null;
11
- activeCouponsExist: boolean;
12
3
  addCoupon: (code: string) => void;
13
4
  }): void;
@@ -4,14 +4,11 @@ import { Signup_QuoteFragment } from '../fragments/Signup_QuoteFragment';
4
4
  export type UseQuoteAccountSignupMutationOptions = {
5
5
  priceListCode: string;
6
6
  enableTrial: boolean;
7
- priceList: {
8
- trialAllowed?: boolean;
9
- } | null | undefined;
10
7
  paymentRequiredToAcceptQuote?: boolean;
11
8
  documentTemplateId?: string;
12
9
  onQuoteAccountSignupSuccess: (portalSessionToken: string, accountId: string, quote: FragmentOf<typeof Signup_QuoteFragment> | null) => void;
13
10
  };
14
- export declare function useQuoteAccountSignupMutation({ priceListCode, enableTrial, priceList, paymentRequiredToAcceptQuote, documentTemplateId, onQuoteAccountSignupSuccess, }: UseQuoteAccountSignupMutationOptions): import("@tanstack/react-query").UseMutationResult<{
11
+ export declare function useQuoteAccountSignupMutation({ priceListCode, enableTrial, paymentRequiredToAcceptQuote, documentTemplateId, onQuoteAccountSignupSuccess, }: UseQuoteAccountSignupMutationOptions): import("@tanstack/react-query").UseMutationResult<{
15
12
  account: {
16
13
  id: string;
17
14
  } | null;
@@ -2,4 +2,11 @@ import { ResultOf } from 'gql.tada';
2
2
  import { Signup_QuoteFragment } from '../fragments/Signup_QuoteFragment';
3
3
  export declare const useSignupQuoteQueryData: ({ tokenOverride, }: {
4
4
  tokenOverride?: string;
5
- }) => ResultOf<typeof Signup_QuoteFragment> | undefined;
5
+ }) => {
6
+ data: ResultOf<typeof Signup_QuoteFragment> | undefined;
7
+ refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<{
8
+ [$tada.fragmentRefs]: {
9
+ Signup_QuoteFragment: "Quote";
10
+ };
11
+ } | undefined, Error>>;
12
+ };
@@ -0,0 +1,10 @@
1
+ declare const getSignupQuote: ({ id, token, apiHost, }: {
2
+ id: string;
3
+ token?: string;
4
+ apiHost: string;
5
+ }) => Promise<{
6
+ [$tada.fragmentRefs]: {
7
+ Signup_QuoteFragment: "Quote";
8
+ };
9
+ } | null>;
10
+ export default getSignupQuote;
package/dist/index.d.ts CHANGED
@@ -173,7 +173,7 @@ declare const PaymentForm_InvoiceFragment: gql_tada.TadaDocumentNode<{
173
173
  on: "Invoice";
174
174
  masked: true;
175
175
  }>;
176
- declare function PaymentFormRoot({ currencyId: accountCurrencyId, invoice: maskedInvoice, quote: maskedQuote, paymentHold, onPaymentSuccess, onPaymentHoldSuccess, paymentHoldPrecondition, accountId, onSavePaymentMethod, onPaymentMethodRemoved, onSetDefaultPaymentMethod, customCheckoutFunction, children, }: {
176
+ declare function PaymentFormRoot({ currencyId: accountCurrencyId, invoice: maskedInvoice, quote: maskedQuote, paymentHold, onPaymentSuccess, onPaymentHoldSuccess, checkoutPrecondition, accountId, onSavePaymentMethod, onPaymentMethodRemoved, onSetDefaultPaymentMethod, customCheckoutFunction, children, }: {
177
177
  currencyId?: string;
178
178
  invoice?: FragmentOf<typeof PaymentForm_InvoiceFragment>;
179
179
  quote?: FragmentOf<typeof PaymentForm_QuoteFragment>;
@@ -183,17 +183,15 @@ declare function PaymentFormRoot({ currencyId: accountCurrencyId, invoice: maske
183
183
  };
184
184
  onPaymentSuccess?: (response: any) => void;
185
185
  onPaymentHoldSuccess?: (response: any) => void;
186
- /**
187
- * If provided, the payment hold will only go through if this condition returns true.
188
- */
189
- paymentHoldPrecondition?: () => boolean | Promise<boolean>;
186
+ /** Precondition that must pass before checking out free/trial/paid/payment-hold quotes. */
187
+ checkoutPrecondition?: () => boolean | Promise<boolean>;
190
188
  onSavePaymentMethod?: (response: any) => void;
191
189
  onPaymentMethodRemoved?: (paymentMethod: PaymentMethodFragment) => void;
192
190
  onSetDefaultPaymentMethod?: () => void;
193
191
  accountId?: string;
194
192
  customCheckoutFunction?: (pluginId: string, paymentMethodId: string) => Promise<any>;
195
193
  children?: ReactNode | ((state: PaymentFormRenderState) => ReactNode);
196
- }): react_jsx_runtime.JSX.Element;
194
+ }): react_jsx_runtime.JSX.Element | null;
197
195
  type PaymentFormProps = ComponentProps<typeof PaymentFormRoot>;
198
196
  type PaymentFormRenderState = {
199
197
  hasPaymentMethods: boolean;
@@ -238,12 +236,6 @@ type SignupProps = {
238
236
  priceListCode: string;
239
237
  /** If trial is allowed on priceList, enableTrial will enable the trial for the signup */
240
238
  enableTrial?: boolean;
241
- /** The URL to redirect to after the signup is complete */
242
- returnUrl?: string;
243
- /** A custom class name to apply to the component */
244
- className?: string;
245
- /** The shadow level to apply to the component */
246
- shadow?: ShadowType;
247
239
  /** A custom style to apply to the component */
248
240
  style?: React.CSSProperties;
249
241
  /** The default form values to use for the signup */
@@ -254,8 +246,10 @@ type SignupProps = {
254
246
  documentTemplateId?: string;
255
247
  /** Which account billing fields to show and require */
256
248
  requiredBillingDetails?: RequiredBillingDetailsFlags;
249
+ /** A default coupon code to pre-apply to the checkout */
250
+ defaultCouponCode?: string;
257
251
  };
258
- declare function Signup({ priceListCode, enableTrial, returnUrl, className, shadow, style, defaultFormValues, paymentRequiredToAcceptQuote, documentTemplateId, requiredBillingDetails, }: SignupProps): react_jsx_runtime.JSX.Element;
252
+ declare function Signup({ priceListCode, enableTrial, style, defaultFormValues, paymentRequiredToAcceptQuote, documentTemplateId, requiredBillingDetails, defaultCouponCode, }: SignupProps): react_jsx_runtime.JSX.Element;
259
253
 
260
254
  declare function BunnyProvider({ children, darkMode, queryClient, apiHost, token, onTokenExpired, onUserUnavailable, onInvalidOrMissingAuthorization, suppressUserUnavailableErrorNotification, configProviderProps, }: {
261
255
  children: React.ReactNode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bunnyapp/components",
3
- "version": "1.8.0-beta.24",
3
+ "version": "1.8.0-beta.26",
4
4
  "description": "Components from the Bunny portal to embed Bunny UI functionality into your application.",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -1,9 +0,0 @@
1
- export declare const useApplyDefaultCoupon_QuoteFragment: import("gql.tada").TadaDocumentNode<{
2
- [$tada.fragmentRefs]: {
3
- canApplyCoupons_QuoteFragment: "Quote";
4
- };
5
- }, {}, {
6
- fragment: "useApplyDefaultCoupon_QuoteFragment";
7
- on: "Quote";
8
- masked: true;
9
- }>;
@@ -1,9 +0,0 @@
1
- export declare const useApplyDefaultCoupon_QuoteFragment: import("gql.tada").TadaDocumentNode<{
2
- [$tada.fragmentRefs]: {
3
- canApplyCoupons_QuoteFragment: "Quote";
4
- };
5
- }, {}, {
6
- fragment: "useApplyDefaultCoupon_QuoteFragment";
7
- on: "Quote";
8
- masked: true;
9
- }>;