@bunnyapp/components 1.8.0-beta.53 → 1.8.0-beta.55

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 (24) hide show
  1. package/dist/cjs/index.js +14 -14
  2. package/dist/cjs/types/src/components/Signup/Signup.d.ts +6 -3
  3. package/dist/cjs/types/src/components/Signup/Signup.stories.d.ts +1 -0
  4. package/dist/cjs/types/src/components/Signup/SignupContent.d.ts +1 -1
  5. package/dist/cjs/types/src/components/Signup/components/InitialSignupFormFields.d.ts +1 -2
  6. package/dist/cjs/types/src/components/Signup/components/SignupForm/SignupForm.d.ts +1 -4
  7. package/dist/cjs/types/src/components/Signup/components/SignupForm/components/ExistingAccountForm.d.ts +2 -4
  8. package/dist/cjs/types/src/components/Signup/components/SignupForm/components/NewAccountForm.d.ts +2 -4
  9. package/dist/cjs/types/src/components/Signup/contexts/SignupFormOptionsContext.d.ts +24 -0
  10. package/dist/cjs/types/src/components/Signup/index.d.ts +3 -0
  11. package/dist/cjs/types/src/components/index.d.ts +1 -0
  12. package/dist/esm/index.js +18 -18
  13. package/dist/esm/types/src/components/Signup/Signup.d.ts +6 -3
  14. package/dist/esm/types/src/components/Signup/Signup.stories.d.ts +1 -0
  15. package/dist/esm/types/src/components/Signup/SignupContent.d.ts +1 -1
  16. package/dist/esm/types/src/components/Signup/components/InitialSignupFormFields.d.ts +1 -2
  17. package/dist/esm/types/src/components/Signup/components/SignupForm/SignupForm.d.ts +1 -4
  18. package/dist/esm/types/src/components/Signup/components/SignupForm/components/ExistingAccountForm.d.ts +2 -4
  19. package/dist/esm/types/src/components/Signup/components/SignupForm/components/NewAccountForm.d.ts +2 -4
  20. package/dist/esm/types/src/components/Signup/contexts/SignupFormOptionsContext.d.ts +24 -0
  21. package/dist/esm/types/src/components/Signup/index.d.ts +3 -0
  22. package/dist/esm/types/src/components/index.d.ts +1 -0
  23. package/dist/index.d.ts +24 -3
  24. package/package.json +1 -1
@@ -1,19 +1,22 @@
1
1
  import type { FormInstance } from "antd/es/form";
2
2
  import { type DefaultSignupValues, InitialSignupFormData, type RequiredBillingDetailsFlags } from "./components/InitialSignupFormFields";
3
3
  import { type SignupCallbacks } from './contexts/SignupCallbacksContext';
4
+ import { type SignupFormOptions } from './contexts/SignupFormOptionsContext';
4
5
  export type SignupProps = {
5
6
  priceListCode: string;
6
7
  /** If trial is allowed on priceList, enableTrial will enable the trial for the signup */
7
8
  enableTrial?: boolean;
8
9
  /** A custom style to apply to the component */
9
10
  style?: React.CSSProperties;
10
- /** The default form values to use for the signup */
11
+ /** Form configuration: default values, required billing details and disabled fields */
12
+ form?: SignupFormOptions;
13
+ /** @deprecated Use `form.defaultValues` instead */
11
14
  defaultFormValues?: DefaultSignupValues;
12
15
  /** Whether to require quote acceptance before checking out */
13
16
  paymentRequiredToAcceptQuote?: boolean;
14
17
  /** The document template ID to apply to the quote for the signup */
15
18
  documentTemplateId?: string;
16
- /** Which account billing fields to show and require */
19
+ /** @deprecated Use `form.requiredBillingDetails` instead */
17
20
  requiredBillingDetails?: RequiredBillingDetailsFlags;
18
21
  /** A default coupon code to pre-apply to the checkout */
19
22
  defaultCouponCode?: string;
@@ -28,5 +31,5 @@ declare const useSignupOptions: () => {
28
31
  enableTrial: boolean;
29
32
  paymentRequiredToAcceptQuote?: boolean;
30
33
  };
31
- export default function Signup({ priceListCode, enableTrial, style, defaultFormValues, paymentRequiredToAcceptQuote, documentTemplateId, requiredBillingDetails, defaultCouponCode, callbacks, }: SignupProps): import("react").JSX.Element;
34
+ export default function Signup({ priceListCode, enableTrial, style, form, defaultFormValues, paymentRequiredToAcceptQuote, documentTemplateId, requiredBillingDetails, defaultCouponCode, callbacks, }: SignupProps): import("react").JSX.Element;
32
35
  export { useSignupAccountId, useSignupForm, useSignupOptions, useSignupPortalSessionToken, useSignupPurchaseSucceeded };
@@ -4,5 +4,6 @@ declare const meta: Meta<typeof Signup>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof meta>;
6
6
  export declare const Default: Story;
7
+ export declare const DisabledFields: Story;
7
8
  export declare const Mobile: Story;
8
9
  export declare const DarkMode: Story;
@@ -1,2 +1,2 @@
1
1
  import type { SignupProps } from './Signup';
2
- export declare function SignupContent({ priceListCode, defaultFormValues, documentTemplateId, requiredBillingDetails, style, defaultCouponCode, }: SignupProps): import("react").JSX.Element;
2
+ export declare function SignupContent({ priceListCode, documentTemplateId, style, defaultCouponCode, }: Pick<SignupProps, 'priceListCode' | 'documentTemplateId' | 'style' | 'defaultCouponCode'>): import("react").JSX.Element;
@@ -36,11 +36,10 @@ export type RequiredBillingDetailsFlags = {
36
36
  };
37
37
  /** Optional fields not shown by default; enabled via `extraFieldsToShow`. */
38
38
  export type ExtraSignupFormField = 'title';
39
- export default function InitialSignupFormFields({ className, requiredBillingDetails,
39
+ export default function InitialSignupFormFields({ className,
40
40
  /** Called when focus leaves this form (e.g. tab to payment). Implemented via Form `onBlurCapture` so moving between fields does not fire. */
41
41
  onBlur, disabled, extraFieldsToShow, }: {
42
42
  className?: string;
43
- requiredBillingDetails?: RequiredBillingDetailsFlags;
44
43
  onBlur?: () => void;
45
44
  disabled?: boolean;
46
45
  extraFieldsToShow?: ExtraSignupFormField[];
@@ -1,10 +1,7 @@
1
1
  import type { ResultOf } from 'gql.tada';
2
2
  import { Signup_PriceListFragment } from '../../fragments/Signup_PriceListFragment';
3
- import { type DefaultSignupValues, type RequiredBillingDetailsFlags } from '../InitialSignupFormFields';
4
3
  type SignupFormProps = {
5
4
  priceList?: ResultOf<typeof Signup_PriceListFragment> | null;
6
- defaultFormValues?: DefaultSignupValues;
7
- requiredBillingDetails?: RequiredBillingDetailsFlags;
8
5
  };
9
- export default function SignupForm({ priceList, defaultFormValues, requiredBillingDetails, }: SignupFormProps): import("react").JSX.Element;
6
+ export default function SignupForm({ priceList }: SignupFormProps): import("react").JSX.Element;
10
7
  export {};
@@ -1,6 +1,6 @@
1
1
  import { FragmentOf, type ResultOf } from 'gql.tada';
2
2
  import { Signup_PriceListFragment } from '../../../fragments/Signup_PriceListFragment';
3
- import { ExtraSignupFormField, type DefaultSignupValues, type RequiredBillingDetailsFlags } from '../../InitialSignupFormFields';
3
+ import { ExtraSignupFormField } from '../../InitialSignupFormFields';
4
4
  export declare const ExistingAccountForm_AccountFragment: import("gql.tada").TadaDocumentNode<{
5
5
  [$tada.fragmentRefs]: {
6
6
  ExistingAccountLoadedEffect_AccountFragment: "Account";
@@ -15,13 +15,11 @@ export declare const ExistingAccountForm_AccountFragment: import("gql.tada").Tad
15
15
  masked: true;
16
16
  }>;
17
17
  /** Account-details form after `quoteAccountSignup` has created an account; saves via `contactUpdate` + `accountUpdate` on blur. */
18
- export default function ExistingAccountForm({ title, className, account: maskedAccount, extraFieldsToShow, requiredBillingDetails, defaultFormValues, priceList, onSelfServiceBuyDisabled, }: {
18
+ export default function ExistingAccountForm({ title, className, account: maskedAccount, extraFieldsToShow, priceList, onSelfServiceBuyDisabled, }: {
19
19
  title: string;
20
20
  className?: string;
21
21
  account: FragmentOf<typeof ExistingAccountForm_AccountFragment> | undefined | null;
22
22
  extraFieldsToShow?: ExtraSignupFormField[];
23
- requiredBillingDetails?: RequiredBillingDetailsFlags;
24
- defaultFormValues?: DefaultSignupValues;
25
23
  priceList?: ResultOf<typeof Signup_PriceListFragment> | null;
26
24
  onSelfServiceBuyDisabled: () => void;
27
25
  }): import("react").JSX.Element;
@@ -1,8 +1,6 @@
1
- import { ExtraSignupFormField, type DefaultSignupValues, type RequiredBillingDetailsFlags } from '../../InitialSignupFormFields';
2
- export default function NewAccountForm({ className, extraFieldsToShow, requiredBillingDetails, defaultFormValues, title, }: {
1
+ import { ExtraSignupFormField } from '../../InitialSignupFormFields';
2
+ export default function NewAccountForm({ className, extraFieldsToShow, title, }: {
3
3
  className?: string;
4
4
  extraFieldsToShow?: ExtraSignupFormField[];
5
- requiredBillingDetails?: RequiredBillingDetailsFlags;
6
- defaultFormValues?: DefaultSignupValues;
7
5
  title: string;
8
6
  }): import("react").JSX.Element;
@@ -0,0 +1,24 @@
1
+ import { ReactNode } from 'react';
2
+ import type { DefaultSignupValues, RequiredBillingDetailsFlags } from '../components/InitialSignupFormFields';
3
+ /** Fields that can be disabled. Same keys as `DefaultSignupValues`. */
4
+ export type DisabledSignupFields = Partial<Record<keyof DefaultSignupValues, boolean>>;
5
+ /**
6
+ * Customer-facing form configuration for the Signup component.
7
+ * All options are optional. Add new form options here rather than as new props on Signup.
8
+ */
9
+ export type SignupFormOptions = {
10
+ /** The default form values to use for the signup */
11
+ defaultValues?: DefaultSignupValues;
12
+ /** Which account billing fields to show and require */
13
+ requiredBillingDetails?: RequiredBillingDetailsFlags;
14
+ /**
15
+ * Fields the user cannot edit. Provide a default value for each disabled field:
16
+ * all fields are required, so an empty disabled field blocks the signup.
17
+ */
18
+ disabledFields?: DisabledSignupFields;
19
+ };
20
+ export declare const SignupFormOptionsProvider: ({ formOptions, children, }: {
21
+ formOptions?: SignupFormOptions;
22
+ children: ReactNode;
23
+ }) => import("react").JSX.Element;
24
+ export declare const useSignupFormOptions: () => SignupFormOptions;
@@ -1,2 +1,5 @@
1
1
  export { default as Signup } from "./Signup";
2
+ export type { SignupProps } from "./Signup";
2
3
  export type { SignupCallbacks } from "./contexts/SignupCallbacksContext";
4
+ export type { DisabledSignupFields, SignupFormOptions } from "./contexts/SignupFormOptionsContext";
5
+ export type { DefaultSignupValues, RequiredBillingDetailsFlags, } from "./components/InitialSignupFormFields";
@@ -4,6 +4,7 @@ export { Quote } from './Quote';
4
4
  export { Quotes } from './tables/Quotes';
5
5
  export { PaymentForm } from './PaymentForm';
6
6
  export { Signup } from './Signup';
7
+ export type { DefaultSignupValues, DisabledSignupFields, RequiredBillingDetailsFlags, SignupCallbacks, SignupFormOptions, SignupProps, } from './Signup';
7
8
  export { default as BunnyProvider } from './BunnyProvider/BunnyProvider';
8
9
  export { default as Transactions } from './tables/Transactions';
9
10
  export { Subscriptions } from './Subscriptions';
package/dist/index.d.ts CHANGED
@@ -289,26 +289,46 @@ type SignupCallbacks = {
289
289
  onPaymentHoldSuccess?: () => void;
290
290
  };
291
291
 
292
+ /** Fields that can be disabled. Same keys as `DefaultSignupValues`. */
293
+ type DisabledSignupFields = Partial<Record<keyof DefaultSignupValues, boolean>>;
294
+ /**
295
+ * Customer-facing form configuration for the Signup component.
296
+ * All options are optional. Add new form options here rather than as new props on Signup.
297
+ */
298
+ type SignupFormOptions = {
299
+ /** The default form values to use for the signup */
300
+ defaultValues?: DefaultSignupValues;
301
+ /** Which account billing fields to show and require */
302
+ requiredBillingDetails?: RequiredBillingDetailsFlags;
303
+ /**
304
+ * Fields the user cannot edit. Provide a default value for each disabled field:
305
+ * all fields are required, so an empty disabled field blocks the signup.
306
+ */
307
+ disabledFields?: DisabledSignupFields;
308
+ };
309
+
292
310
  type SignupProps = {
293
311
  priceListCode: string;
294
312
  /** If trial is allowed on priceList, enableTrial will enable the trial for the signup */
295
313
  enableTrial?: boolean;
296
314
  /** A custom style to apply to the component */
297
315
  style?: React.CSSProperties;
298
- /** The default form values to use for the signup */
316
+ /** Form configuration: default values, required billing details and disabled fields */
317
+ form?: SignupFormOptions;
318
+ /** @deprecated Use `form.defaultValues` instead */
299
319
  defaultFormValues?: DefaultSignupValues;
300
320
  /** Whether to require quote acceptance before checking out */
301
321
  paymentRequiredToAcceptQuote?: boolean;
302
322
  /** The document template ID to apply to the quote for the signup */
303
323
  documentTemplateId?: string;
304
- /** Which account billing fields to show and require */
324
+ /** @deprecated Use `form.requiredBillingDetails` instead */
305
325
  requiredBillingDetails?: RequiredBillingDetailsFlags;
306
326
  /** A default coupon code to pre-apply to the checkout */
307
327
  defaultCouponCode?: string;
308
328
  /** Callbacks fired at key signup lifecycle events */
309
329
  callbacks?: SignupCallbacks;
310
330
  };
311
- declare function Signup({ priceListCode, enableTrial, style, defaultFormValues, paymentRequiredToAcceptQuote, documentTemplateId, requiredBillingDetails, defaultCouponCode, callbacks, }: SignupProps): react.JSX.Element;
331
+ declare function Signup({ priceListCode, enableTrial, style, form, defaultFormValues, paymentRequiredToAcceptQuote, documentTemplateId, requiredBillingDetails, defaultCouponCode, callbacks, }: SignupProps): react.JSX.Element;
312
332
 
313
333
  declare function BunnyProvider({ children, darkMode, queryClient, apiHost, token, onTokenExpired, onUserUnavailable, onInvalidOrMissingAuthorization, suppressUserUnavailableErrorNotification, disableErrorNotifications, configProviderProps, }: {
314
334
  children: React.ReactNode;
@@ -432,3 +452,4 @@ declare function MiniCreditCard({ className, buttons, hideDropdownMenu, hideDefa
432
452
  }): react.JSX.Element;
433
453
 
434
454
  export { BillingDetails, BunnyProvider, Footer, Invoice, Invoices, MiniCreditCard, PaymentForm, Quote, Quotes, Signup, SubscriptionsWrapper as Subscriptions, Transactions, UpgradeWrapper as Upgrade };
455
+ export type { DefaultSignupValues, DisabledSignupFields, RequiredBillingDetailsFlags, SignupCallbacks, SignupFormOptions, SignupProps };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bunnyapp/components",
3
- "version": "1.8.0-beta.53",
3
+ "version": "1.8.0-beta.55",
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",