@gusto/embedded-react-sdk 0.52.0 → 0.52.2

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 (131) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/dist/components/Base/Base.d.ts +2 -0
  3. package/dist/components/Base/Base.js.map +1 -1
  4. package/dist/components/Common/PaginationControl/PaginationControlTypes.d.ts +4 -1
  5. package/dist/components/Common/UI/Breadcrumbs/BreadcrumbsTypes.d.ts +1 -1
  6. package/dist/components/Common/UI/Breadcrumbs/BreadcrumbsTypes.js.map +1 -1
  7. package/dist/components/Common/UI/CheckboxGroup/CheckboxGroupTypes.d.ts +1 -1
  8. package/dist/components/Common/UI/CheckboxGroup/CheckboxGroupTypes.js.map +1 -1
  9. package/dist/components/Common/UI/ComboBox/ComboBoxTypes.d.ts +2 -2
  10. package/dist/components/Common/UI/DateRangePicker/DateRangePickerTypes.d.ts +3 -2
  11. package/dist/components/Common/UI/DescriptionList/DescriptionListTypes.d.ts +1 -1
  12. package/dist/components/Common/UI/DescriptionList/DescriptionListTypes.js.map +1 -1
  13. package/dist/components/Common/UI/Menu/MenuTypes.d.ts +3 -3
  14. package/dist/components/Common/UI/Menu/MenuTypes.js.map +1 -1
  15. package/dist/components/Common/UI/MultiSelectComboBox/MultiSelectComboBoxTypes.d.ts +2 -2
  16. package/dist/components/Common/UI/RadioGroup/RadioGroupTypes.d.ts +2 -2
  17. package/dist/components/Common/UI/RadioGroup/RadioGroupTypes.js.map +1 -1
  18. package/dist/components/Common/UI/Select/SelectTypes.d.ts +2 -2
  19. package/dist/components/Common/UI/Table/TableTypes.d.ts +4 -4
  20. package/dist/components/Common/UI/Table/TableTypes.js.map +1 -1
  21. package/dist/components/Common/UI/Tabs/TabsTypes.d.ts +2 -2
  22. package/dist/components/Company/DocumentSigner/shared/useSignCompanyForm/fields.js +4 -4
  23. package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/fields.js +5 -5
  24. package/dist/components/Company/StateTaxes/stateTaxesStateMachine.d.ts +0 -1
  25. package/dist/components/Company/StateTaxes/stateTaxesStateMachine.js +12 -14
  26. package/dist/components/Company/StateTaxes/stateTaxesStateMachine.js.map +1 -1
  27. package/dist/components/Contractor/Address/Address.js +83 -75
  28. package/dist/components/Contractor/Address/Address.js.map +1 -1
  29. package/dist/components/Contractor/ContractorList/index.d.ts +2 -1
  30. package/dist/components/Contractor/ContractorList/index.js +112 -99
  31. package/dist/components/Contractor/ContractorList/index.js.map +1 -1
  32. package/dist/components/Contractor/Documents/SignatureForm/SignatureForm.js +170 -123
  33. package/dist/components/Contractor/Documents/SignatureForm/SignatureForm.js.map +1 -1
  34. package/dist/components/Contractor/Documents/SignatureForm/SignatureForm.module.scss.js +12 -0
  35. package/dist/components/Contractor/Documents/SignatureForm/SignatureForm.module.scss.js.map +1 -0
  36. package/dist/components/Contractor/Documents/SignatureForm/useContractorSignatureForm/fields.js +44 -43
  37. package/dist/components/Contractor/Documents/SignatureForm/useContractorSignatureForm/fields.js.map +1 -1
  38. package/dist/components/Contractor/Documents/SignatureForm/useContractorSignatureForm/useContractorSignatureForm.js +91 -88
  39. package/dist/components/Contractor/Documents/SignatureForm/useContractorSignatureForm/useContractorSignatureForm.js.map +1 -1
  40. package/dist/components/Contractor/Documents/SignatureForm/useContractorSignatureForm/w9Fields.d.ts +0 -33
  41. package/dist/components/Contractor/Documents/SignatureForm/useContractorSignatureForm/w9Fields.js +77 -86
  42. package/dist/components/Contractor/Documents/SignatureForm/useContractorSignatureForm/w9Fields.js.map +1 -1
  43. package/dist/components/Contractor/OnboardingFlow/OnboardingFlow.d.ts +1 -1
  44. package/dist/components/Contractor/OnboardingFlow/OnboardingFlow.js.map +1 -1
  45. package/dist/components/Contractor/OnboardingFlow/OnboardingFlowComponents.d.ts +2 -0
  46. package/dist/components/Contractor/OnboardingFlow/OnboardingFlowComponents.js.map +1 -1
  47. package/dist/components/Contractor/OnboardingFlow/onboardingStateMachine.js +150 -80
  48. package/dist/components/Contractor/OnboardingFlow/onboardingStateMachine.js.map +1 -1
  49. package/dist/components/Contractor/OnboardingFlow/onboardingStateMachine.test.d.ts +1 -0
  50. package/dist/components/Contractor/PaymentMethod/shared/useContractorBankAccountForm/fields.js +1 -1
  51. package/dist/components/Contractor/Profile/BusinessSelfOnboardingProfile.js +19 -18
  52. package/dist/components/Contractor/Profile/BusinessSelfOnboardingProfile.js.map +1 -1
  53. package/dist/components/Contractor/Profile/ContractorProfile.d.ts +1 -1
  54. package/dist/components/Contractor/Profile/ContractorProfile.js +121 -111
  55. package/dist/components/Contractor/Profile/ContractorProfile.js.map +1 -1
  56. package/dist/components/Contractor/Profile/IndividualSelfOnboardingProfile.js +27 -26
  57. package/dist/components/Contractor/Profile/IndividualSelfOnboardingProfile.js.map +1 -1
  58. package/dist/components/Contractor/Profile/shared/useContractorDetailsForm/fields.js +16 -16
  59. package/dist/components/Contractor/Submit/Submit.js +127 -67
  60. package/dist/components/Contractor/Submit/Submit.js.map +1 -1
  61. package/dist/components/Contractor/shared/useContractorHasSignedW9.d.ts +8 -0
  62. package/dist/components/Contractor/shared/useContractorHasSignedW9.js +10 -0
  63. package/dist/components/Contractor/shared/useContractorHasSignedW9.js.map +1 -0
  64. package/dist/components/Employee/Compensation/shared/useCompensationForm/fields.js +4 -4
  65. package/dist/components/Employee/Compensation/shared/useJobForm/fields.js +6 -6
  66. package/dist/components/Employee/Deductions/shared/useChildSupportGarnishmentForm/fields.js +8 -8
  67. package/dist/components/Employee/Deductions/shared/useDeductionForm/fields.js +4 -4
  68. package/dist/components/Employee/Documents/shared/useSignEmployeeForm/fields.js +1 -1
  69. package/dist/components/Employee/FederalTaxes/shared/useFederalTaxesForm/fields.js +4 -4
  70. package/dist/components/Employee/PaymentMethod/shared/useBankForm/fields.js +1 -1
  71. package/dist/components/Employee/PaymentMethod/shared/useSplitPaymentsForm/splitFieldFactory.js +4 -4
  72. package/dist/components/Employee/Profile/shared/useEmployeeDetailsForm/fields.js +8 -8
  73. package/dist/components/Employee/Profile/shared/useHomeAddressForm/fields.js +5 -5
  74. package/dist/components/Employee/Profile/shared/useHomeAddressForm/useCurrentHomeAddressForm.d.ts +1 -0
  75. package/dist/components/Employee/Profile/shared/useHomeAddressForm/useCurrentHomeAddressForm.js.map +1 -1
  76. package/dist/components/Employee/Profile/shared/useWorkAddressForm/fields.js +4 -4
  77. package/dist/components/Employee/Profile/shared/useWorkAddressForm/useCurrentWorkAddressForm.d.ts +1 -0
  78. package/dist/components/Employee/Profile/shared/useWorkAddressForm/useCurrentWorkAddressForm.js.map +1 -1
  79. package/dist/components/Employee/StateTaxes/shared/useEmployeeStateTaxesForm/fieldComponents.js +8 -8
  80. package/dist/components/Employee/StateTaxes/shared/useEmployeeStateTaxesForm/fields.d.ts +2 -2
  81. package/dist/components/Employee/StateTaxes/shared/useEmployeeStateTaxesForm/fields.js.map +1 -1
  82. package/dist/components/index.d.ts +40 -0
  83. package/dist/contexts/ComponentAdapter/useComponentContext.d.ts +1 -1
  84. package/dist/contexts/ComponentAdapter/useComponentContext.js.map +1 -1
  85. package/dist/contexts/GustoProvider/GustoProvider.d.ts +1 -0
  86. package/dist/contexts/GustoProvider/GustoProvider.js.map +1 -1
  87. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.d.ts +1 -0
  88. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
  89. package/dist/contexts/ThemeProvider/types.d.ts +2 -2
  90. package/dist/i18n/en/Contractor.Address.json.js +22 -20
  91. package/dist/i18n/en/Contractor.Address.json.js.map +1 -1
  92. package/dist/i18n/en/Contractor.ContractorList.json.js +22 -20
  93. package/dist/i18n/en/Contractor.ContractorList.json.js.map +1 -1
  94. package/dist/i18n/en/Contractor.Profile.json.js +13 -11
  95. package/dist/i18n/en/Contractor.Profile.json.js.map +1 -1
  96. package/dist/i18n/en/Contractor.SignatureForm.json.js +5 -5
  97. package/dist/i18n/en/Contractor.Submit.json.js +11 -11
  98. package/dist/i18n/types.d.ts +29 -9
  99. package/dist/index.d.ts +6 -3
  100. package/dist/models/WA_RISK_CODES.d.ts +1 -0
  101. package/dist/models/WA_RISK_CODES.js.map +1 -1
  102. package/dist/partner-hook-utils/composeErrorHandler.d.ts +4 -0
  103. package/dist/partner-hook-utils/composeErrorHandler.js.map +1 -1
  104. package/dist/partner-hook-utils/form/SDKFormProvider.d.ts +1 -0
  105. package/dist/partner-hook-utils/form/SDKFormProvider.js.map +1 -1
  106. package/dist/partner-hook-utils/form/composeSubmitHandler.d.ts +4 -0
  107. package/dist/partner-hook-utils/form/composeSubmitHandler.js.map +1 -1
  108. package/dist/partner-hook-utils/form/fields/CheckboxHookField.d.ts +1 -0
  109. package/dist/partner-hook-utils/form/fields/CheckboxHookField.js.map +1 -1
  110. package/dist/partner-hook-utils/form/fields/DatePickerHookField.d.ts +1 -0
  111. package/dist/partner-hook-utils/form/fields/DatePickerHookField.js.map +1 -1
  112. package/dist/partner-hook-utils/form/fields/NumberInputHookField.d.ts +1 -0
  113. package/dist/partner-hook-utils/form/fields/NumberInputHookField.js.map +1 -1
  114. package/dist/partner-hook-utils/form/fields/RadioGroupHookField.d.ts +1 -0
  115. package/dist/partner-hook-utils/form/fields/RadioGroupHookField.js.map +1 -1
  116. package/dist/partner-hook-utils/form/fields/SelectHookField.d.ts +1 -0
  117. package/dist/partner-hook-utils/form/fields/SelectHookField.js.map +1 -1
  118. package/dist/partner-hook-utils/form/fields/SwitchHookField.d.ts +1 -0
  119. package/dist/partner-hook-utils/form/fields/SwitchHookField.js.map +1 -1
  120. package/dist/partner-hook-utils/form/fields/TextInputHookField.d.ts +1 -0
  121. package/dist/partner-hook-utils/form/fields/TextInputHookField.js.map +1 -1
  122. package/dist/partner-hook-utils/types.d.ts +9 -0
  123. package/dist/shared/constants.d.ts +10 -0
  124. package/dist/shared/constants.js +7 -6
  125. package/dist/shared/constants.js.map +1 -1
  126. package/dist/style.css +1 -1
  127. package/dist/types/Helpers.d.ts +2 -0
  128. package/dist/types/hooks.d.ts +1 -0
  129. package/dist/types/observability.d.ts +1 -0
  130. package/docs/guides/endpoint-inventory.json +17 -28
  131. package/package.json +16 -16
@@ -0,0 +1,12 @@
1
+ const t = "_tinRow_513el_1", n = "_tinInput_513el_8", o = "_tinButton_513el_13", i = {
2
+ tinRow: t,
3
+ tinInput: n,
4
+ tinButton: o
5
+ };
6
+ export {
7
+ i as default,
8
+ o as tinButton,
9
+ n as tinInput,
10
+ t as tinRow
11
+ };
12
+ //# sourceMappingURL=SignatureForm.module.scss.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SignatureForm.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
@@ -1,85 +1,86 @@
1
1
  import { jsx as n } from "react/jsx-runtime";
2
- import { normalizeEinOrNotApplicable as i, normalizeSsnOrNotApplicable as o } from "./w9Fields.js";
3
2
  import { TextInputHookField as r } from "../../../../../partner-hook-utils/form/fields/TextInputHookField.js";
3
+ import { SelectHookField as i } from "../../../../../partner-hook-utils/form/fields/SelectHookField.js";
4
4
  import { CheckboxHookField as t } from "../../../../../partner-hook-utils/form/fields/CheckboxHookField.js";
5
- import { SelectHookField as m } from "../../../../../partner-hook-utils/form/fields/SelectHookField.js";
6
- import { RadioGroupHookField as a } from "../../../../../partner-hook-utils/form/fields/RadioGroupHookField.js";
7
- function F(e) {
8
- return /* @__PURE__ */ n(r, { ...e, name: "name" });
9
- }
5
+ import { RadioGroupHookField as o } from "../../../../../partner-hook-utils/form/fields/RadioGroupHookField.js";
6
+ import { normalizeSSN as m } from "../../../../../helpers/ssn.js";
7
+ import { normalizeEin as a } from "../../../../../helpers/federalEin.js";
10
8
  function p(e) {
11
- return /* @__PURE__ */ n(a, { ...e, name: "taxClassification" });
9
+ return /* @__PURE__ */ n(r, { ...e, name: "name" });
12
10
  }
13
11
  function x(e) {
14
- return /* @__PURE__ */ n(r, { ...e, name: "homeAddressStreet1" });
12
+ return /* @__PURE__ */ n(o, { ...e, name: "taxClassification" });
15
13
  }
16
14
  function A(e) {
17
- return /* @__PURE__ */ n(r, { ...e, name: "homeAddressCity" });
15
+ return /* @__PURE__ */ n(r, { ...e, name: "homeAddressStreet1" });
18
16
  }
19
17
  function C(e) {
20
- return /* @__PURE__ */ n(r, { ...e, name: "homeAddressState" });
18
+ return /* @__PURE__ */ n(r, { ...e, name: "homeAddressCity" });
21
19
  }
22
20
  function S(e) {
23
- return /* @__PURE__ */ n(r, { ...e, name: "homeAddressZip" });
21
+ return /* @__PURE__ */ n(r, { ...e, name: "homeAddressState" });
24
22
  }
25
23
  function H(e) {
26
- return /* @__PURE__ */ n(r, { ...e, name: "ssn", transform: o });
24
+ return /* @__PURE__ */ n(r, { ...e, name: "homeAddressZip" });
25
+ }
26
+ function h(e) {
27
+ return /* @__PURE__ */ n(r, { ...e, name: "ssn", transform: m });
27
28
  }
28
29
  function N(e) {
29
- return /* @__PURE__ */ n(r, { ...e, name: "ein", transform: i });
30
+ return /* @__PURE__ */ n(r, { ...e, name: "ein", transform: a });
30
31
  }
31
- function h(e) {
32
+ function g(e) {
32
33
  return /* @__PURE__ */ n(r, { ...e, name: "signatureText" });
33
34
  }
34
- function b(e) {
35
+ function y(e) {
35
36
  return /* @__PURE__ */ n(t, { ...e, name: "agree" });
36
37
  }
37
- function g(e) {
38
+ function T(e) {
38
39
  return /* @__PURE__ */ n(r, { ...e, name: "businessName" });
39
40
  }
40
- function y(e) {
41
- return /* @__PURE__ */ n(m, { ...e, name: "llcClassificationCode" });
41
+ function k(e) {
42
+ return /* @__PURE__ */ n(i, { ...e, name: "llcClassificationCode" });
42
43
  }
43
- function T(e) {
44
+ function b(e) {
44
45
  return /* @__PURE__ */ n(r, { ...e, name: "otherText" });
45
46
  }
46
- function k(e) {
47
+ function E(e) {
47
48
  return /* @__PURE__ */ n(t, { ...e, name: "foreignPartners" });
48
49
  }
49
- function E(e) {
50
+ function P(e) {
50
51
  return /* @__PURE__ */ n(r, { ...e, name: "exemptPayeeCode" });
51
52
  }
52
- function P(e) {
53
+ function z(e) {
53
54
  return /* @__PURE__ */ n(r, { ...e, name: "exemptionFromFatca" });
54
55
  }
55
- function O(e) {
56
+ function Z(e) {
56
57
  return /* @__PURE__ */ n(r, { ...e, name: "homeAddressStreet2" });
57
58
  }
58
- function z(e) {
59
+ function j(e) {
59
60
  return /* @__PURE__ */ n(r, { ...e, name: "accountNumber" });
60
61
  }
61
- function Z(e) {
62
+ function B(e) {
62
63
  return /* @__PURE__ */ n(r, { ...e, name: "companyName" });
63
64
  }
64
65
  export {
65
- z as AccountNumberField,
66
- b as AgreeField,
67
- g as BusinessNameField,
68
- Z as CompanyNameField,
66
+ j as AccountNumberField,
67
+ y as AgreeField,
68
+ T as BusinessNameField,
69
+ B as CompanyNameField,
69
70
  N as EinField,
70
- E as ExemptPayeeCodeField,
71
- P as ExemptionFromFatcaField,
72
- k as ForeignPartnersField,
73
- A as HomeAddressCityField,
74
- C as HomeAddressStateField,
75
- x as HomeAddressStreet1Field,
76
- O as HomeAddressStreet2Field,
77
- S as HomeAddressZipField,
78
- y as LlcClassificationCodeField,
79
- F as NameField,
80
- T as OtherTextField,
81
- h as SignatureTextField,
82
- H as SsnField,
83
- p as TaxClassificationField
71
+ P as ExemptPayeeCodeField,
72
+ z as ExemptionFromFatcaField,
73
+ E as ForeignPartnersField,
74
+ C as HomeAddressCityField,
75
+ S as HomeAddressStateField,
76
+ A as HomeAddressStreet1Field,
77
+ Z as HomeAddressStreet2Field,
78
+ H as HomeAddressZipField,
79
+ k as LlcClassificationCodeField,
80
+ p as NameField,
81
+ b as OtherTextField,
82
+ g as SignatureTextField,
83
+ h as SsnField,
84
+ x as TaxClassificationField
84
85
  };
85
86
  //# sourceMappingURL=fields.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fields.js","sources":["../../../../../../src/components/Contractor/Documents/SignatureForm/useContractorSignatureForm/fields.tsx"],"sourcesContent":["import type { ComponentType } from 'react'\nimport type { ContractorSignatureFormErrorCodes } from './contractorSignatureFormSchema'\nimport { normalizeEinOrNotApplicable, normalizeSsnOrNotApplicable } from './w9Fields'\nimport type { TextInputHookFieldProps } from '@/partner-hook-utils/form/fields/TextInputHookField'\nimport type { CheckboxHookFieldProps } from '@/partner-hook-utils/form/fields/CheckboxHookField'\nimport type { RadioGroupHookFieldProps } from '@/partner-hook-utils/form/fields/RadioGroupHookField'\nimport type { SelectHookFieldProps } from '@/partner-hook-utils/form/fields/SelectHookField'\nimport {\n TextInputHookField,\n CheckboxHookField,\n RadioGroupHookField,\n SelectHookField,\n} from '@/partner-hook-utils/form/fields'\nimport type { HookFieldProps } from '@/partner-hook-utils/types'\n\n/**\n * The form-field name of the electronic-signature consent checkbox.\n *\n * @internal\n */\nexport const AGREE_FIELD = 'agree'\n\n// ── Shared prop types ─────────────────────────────────────────────────\n\n/**\n * The required-field error code emitted by most {@link useContractorSignatureForm} fields.\n *\n * @remarks\n * Use as a key in `validationMessages` for text inputs, selects, and radio groups\n * that only emit the `REQUIRED` error. See {@link ContractorSignatureFormErrorCodes}.\n *\n * @public\n */\nexport type RequiredValidation = typeof ContractorSignatureFormErrorCodes.REQUIRED\n\n/**\n * Validation error code emitted by the `Agree` consent checkbox.\n *\n * @remarks\n * Use as a key in `validationMessages` on `Fields.Agree`. See\n * {@link ContractorSignatureFormErrorCodes}.\n *\n * @public\n */\nexport type AgreeValidation = typeof ContractorSignatureFormErrorCodes.AGREE_REQUIRED\n\n/**\n * The format-validation error code emitted by the `ssn` field of {@link useContractorSignatureForm}.\n *\n * @remarks\n * Use as a key in `validationMessages` on `Fields.Ssn`. See\n * {@link ContractorSignatureFormErrorCodes}.\n *\n * @public\n */\nexport type SsnValidation = typeof ContractorSignatureFormErrorCodes.INVALID_SSN\n\n/**\n * The format-validation error code emitted by the `ein` field of {@link useContractorSignatureForm}.\n *\n * @remarks\n * Use as a key in `validationMessages` on `Fields.Ein`. See\n * {@link ContractorSignatureFormErrorCodes}.\n *\n * @public\n */\nexport type EinValidation = typeof ContractorSignatureFormErrorCodes.INVALID_EIN\n\n// ── Field prop types ──────────────────────────────────────────────────\n\n/**\n * Props accepted by {@link useContractorSignatureForm}'s `Fields.Name` component.\n *\n * @public\n */\nexport type NameFieldProps = HookFieldProps<TextInputHookFieldProps<RequiredValidation>>\n\n/**\n * Props accepted by {@link useContractorSignatureForm}'s `Fields.TaxClassification` component.\n *\n * @public\n */\nexport type TaxClassificationFieldProps = HookFieldProps<\n RadioGroupHookFieldProps<RequiredValidation, string>\n>\n\n/**\n * Props accepted by {@link useContractorSignatureForm}'s `Fields.HomeAddressStreet1` component.\n *\n * @public\n */\nexport type HomeAddressStreet1FieldProps = HookFieldProps<\n TextInputHookFieldProps<RequiredValidation>\n>\n\n/**\n * Props accepted by {@link useContractorSignatureForm}'s `Fields.HomeAddressCity` component.\n *\n * @public\n */\nexport type HomeAddressCityFieldProps = HookFieldProps<TextInputHookFieldProps<RequiredValidation>>\n\n/**\n * Props accepted by {@link useContractorSignatureForm}'s `Fields.HomeAddressState` component.\n *\n * @public\n */\nexport type HomeAddressStateFieldProps = HookFieldProps<TextInputHookFieldProps<RequiredValidation>>\n\n/**\n * Props accepted by {@link useContractorSignatureForm}'s `Fields.HomeAddressZip` component.\n *\n * @public\n */\nexport type HomeAddressZipFieldProps = HookFieldProps<TextInputHookFieldProps<RequiredValidation>>\n\n/**\n * Props accepted by {@link useContractorSignatureForm}'s `Fields.Ssn` component.\n *\n * @public\n */\nexport type SsnFieldProps = HookFieldProps<\n TextInputHookFieldProps<SsnValidation, RequiredValidation>\n>\n\n/**\n * Props accepted by {@link useContractorSignatureForm}'s `Fields.Ein` component.\n *\n * @public\n */\nexport type EinFieldProps = HookFieldProps<\n TextInputHookFieldProps<EinValidation, RequiredValidation>\n>\n\n/**\n * Props accepted by {@link useContractorSignatureForm}'s `Fields.SignatureText` component.\n *\n * @public\n */\nexport type SignatureTextFieldProps = HookFieldProps<TextInputHookFieldProps<RequiredValidation>>\n\n/**\n * Props accepted by {@link useContractorSignatureForm}'s `Fields.Agree` component.\n *\n * @public\n */\nexport type AgreeFieldProps = HookFieldProps<CheckboxHookFieldProps<AgreeValidation>>\n\n/**\n * Props accepted by {@link useContractorSignatureForm}'s `Fields.BusinessName` component.\n *\n * @public\n */\nexport type BusinessNameFieldProps = HookFieldProps<TextInputHookFieldProps<RequiredValidation>>\n\n/**\n * Props accepted by {@link useContractorSignatureForm}'s `Fields.LlcClassificationCode` component.\n *\n * @public\n */\nexport type LlcClassificationCodeFieldProps = HookFieldProps<\n SelectHookFieldProps<RequiredValidation, string>\n>\n\n/**\n * Props accepted by {@link useContractorSignatureForm}'s `Fields.OtherText` component.\n *\n * @public\n */\nexport type OtherTextFieldProps = HookFieldProps<TextInputHookFieldProps<RequiredValidation>>\n\n/**\n * Props accepted by {@link useContractorSignatureForm}'s `Fields.ForeignPartners` component.\n *\n * @public\n */\nexport type ForeignPartnersFieldProps = HookFieldProps<CheckboxHookFieldProps>\n\n/**\n * Props accepted by {@link useContractorSignatureForm}'s `Fields.ExemptPayeeCode` component.\n *\n * @public\n */\nexport type ExemptPayeeCodeFieldProps = HookFieldProps<TextInputHookFieldProps<RequiredValidation>>\n\n/**\n * Props accepted by {@link useContractorSignatureForm}'s `Fields.ExemptionFromFatca` component.\n *\n * @public\n */\nexport type ExemptionFromFatcaFieldProps = HookFieldProps<\n TextInputHookFieldProps<RequiredValidation>\n>\n\n/**\n * Props accepted by {@link useContractorSignatureForm}'s `Fields.HomeAddressStreet2` component.\n *\n * @public\n */\nexport type HomeAddressStreet2FieldProps = HookFieldProps<\n TextInputHookFieldProps<RequiredValidation>\n>\n\n/**\n * Props accepted by {@link useContractorSignatureForm}'s `Fields.AccountNumber` component.\n *\n * @public\n */\nexport type AccountNumberFieldProps = HookFieldProps<TextInputHookFieldProps<RequiredValidation>>\n\n/**\n * Props accepted by {@link useContractorSignatureForm}'s `Fields.CompanyName` component.\n *\n * @public\n */\nexport type CompanyNameFieldProps = HookFieldProps<TextInputHookFieldProps<RequiredValidation>>\n\n// ── Core fields (always present) ──────────────────────────────────────\n\n/** @internal */\nexport function NameField(props: NameFieldProps) {\n return <TextInputHookField {...props} name=\"name\" />\n}\n\n/** @internal */\nexport function TaxClassificationField(props: TaxClassificationFieldProps) {\n return <RadioGroupHookField {...props} name=\"taxClassification\" />\n}\n\n/** @internal */\nexport function HomeAddressStreet1Field(props: HomeAddressStreet1FieldProps) {\n return <TextInputHookField {...props} name=\"homeAddressStreet1\" />\n}\n\n/** @internal */\nexport function HomeAddressCityField(props: HomeAddressCityFieldProps) {\n return <TextInputHookField {...props} name=\"homeAddressCity\" />\n}\n\n/** @internal */\nexport function HomeAddressStateField(props: HomeAddressStateFieldProps) {\n return <TextInputHookField {...props} name=\"homeAddressState\" />\n}\n\n/** @internal */\nexport function HomeAddressZipField(props: HomeAddressZipFieldProps) {\n return <TextInputHookField {...props} name=\"homeAddressZip\" />\n}\n\n/** @internal */\nexport function SsnField(props: SsnFieldProps) {\n return <TextInputHookField {...props} name=\"ssn\" transform={normalizeSsnOrNotApplicable} />\n}\n\n/** @internal */\nexport function EinField(props: EinFieldProps) {\n return <TextInputHookField {...props} name=\"ein\" transform={normalizeEinOrNotApplicable} />\n}\n\n/** @internal */\nexport function SignatureTextField(props: SignatureTextFieldProps) {\n return <TextInputHookField {...props} name=\"signatureText\" />\n}\n\n/** @internal */\nexport function AgreeField(props: AgreeFieldProps) {\n return <CheckboxHookField {...props} name=\"agree\" />\n}\n\n// ── Variable fields (rendered only when the API returns them) ─────────\n\n/** @internal */\nexport function BusinessNameField(props: BusinessNameFieldProps) {\n return <TextInputHookField {...props} name=\"businessName\" />\n}\n\n/** @internal */\nexport function LlcClassificationCodeField(props: LlcClassificationCodeFieldProps) {\n return <SelectHookField {...props} name=\"llcClassificationCode\" />\n}\n\n/** @internal */\nexport function OtherTextField(props: OtherTextFieldProps) {\n return <TextInputHookField {...props} name=\"otherText\" />\n}\n\n/** @internal */\nexport function ForeignPartnersField(props: ForeignPartnersFieldProps) {\n return <CheckboxHookField {...props} name=\"foreignPartners\" />\n}\n\n/** @internal */\nexport function ExemptPayeeCodeField(props: ExemptPayeeCodeFieldProps) {\n return <TextInputHookField {...props} name=\"exemptPayeeCode\" />\n}\n\n/** @internal */\nexport function ExemptionFromFatcaField(props: ExemptionFromFatcaFieldProps) {\n return <TextInputHookField {...props} name=\"exemptionFromFatca\" />\n}\n\n/** @internal */\nexport function HomeAddressStreet2Field(props: HomeAddressStreet2FieldProps) {\n return <TextInputHookField {...props} name=\"homeAddressStreet2\" />\n}\n\n/** @internal */\nexport function AccountNumberField(props: AccountNumberFieldProps) {\n return <TextInputHookField {...props} name=\"accountNumber\" />\n}\n\n/** @internal */\nexport function CompanyNameField(props: CompanyNameFieldProps) {\n return <TextInputHookField {...props} name=\"companyName\" />\n}\n\n/**\n * Field components exposed by {@link useContractorSignatureForm} on `form.Fields`.\n *\n * @remarks\n * Every field is presence-gated against the API response and is `undefined`\n * when the document didn't return its backing field — always null-check before\n * rendering. This guards against the document API diverging (dropping or\n * renaming a field) by skipping fields it no longer returns, mirroring the\n * stable signing flow. `Agree` is the sole exception: it's a synthesized\n * electronic-signature consent checkbox with no API field, so it's always\n * present.\n *\n * @public\n */\nexport interface ContractorSignatureFormFieldComponents {\n /** Entity or individual name; defined only when the API returns `name`. */\n Name: ComponentType<NameFieldProps> | undefined\n /** Federal tax classification radio group; defined only when the document carries classification checkboxes. */\n TaxClassification: ComponentType<TaxClassificationFieldProps> | undefined\n /** Street address line 1; defined only when the API returns `home_address_street_1`. */\n HomeAddressStreet1: ComponentType<HomeAddressStreet1FieldProps> | undefined\n /** City; defined only when the API returns `home_address_city`. */\n HomeAddressCity: ComponentType<HomeAddressCityFieldProps> | undefined\n /** State; defined only when the API returns `home_address_state`. */\n HomeAddressState: ComponentType<HomeAddressStateFieldProps> | undefined\n /** ZIP code; defined only when the API returns `home_address_zip`. */\n HomeAddressZip: ComponentType<HomeAddressZipFieldProps> | undefined\n /** Social Security Number; defined only when the API returns `ssn`. */\n Ssn: ComponentType<SsnFieldProps> | undefined\n /** Employer Identification Number; defined only when the API returns `ein`. */\n Ein: ComponentType<EinFieldProps> | undefined\n /** Typed signature; defined only when the API returns `signature_text`. */\n SignatureText: ComponentType<SignatureTextFieldProps> | undefined\n /** Electronic-signature consent checkbox; always present (synthesized, not an API field). */\n Agree: ComponentType<AgreeFieldProps>\n /** Business name; defined only when the API returns `business_name`. */\n BusinessName: ComponentType<BusinessNameFieldProps> | undefined\n /** LLC tax classification code select; defined only when classification checkboxes are present. */\n LlcClassificationCode: ComponentType<LlcClassificationCodeFieldProps> | undefined\n /** \"Other\" free-text classification; defined only when the API returns `other_text`. */\n OtherText: ComponentType<OtherTextFieldProps> | undefined\n /** Foreign partners checkbox; defined only when the API returns `foreign_partners`. */\n ForeignPartners: ComponentType<ForeignPartnersFieldProps> | undefined\n /** Exempt payee code; defined only when the API returns `exempt_payee_code`. */\n ExemptPayeeCode: ComponentType<ExemptPayeeCodeFieldProps> | undefined\n /** FATCA exemption code; defined only when the API returns `exemption_from_FATCA`. */\n ExemptionFromFatca: ComponentType<ExemptionFromFatcaFieldProps> | undefined\n /** Street address line 2; defined only when the API returns `home_address_street_2`. */\n HomeAddressStreet2: ComponentType<HomeAddressStreet2FieldProps> | undefined\n /** Account number(s); defined only when the API returns `account_number`. */\n AccountNumber: ComponentType<AccountNumberFieldProps> | undefined\n /** Requester's name and address; defined only when the API returns `company_name`. */\n CompanyName: ComponentType<CompanyNameFieldProps> | undefined\n}\n"],"names":["NameField","props","jsx","TextInputHookField","TaxClassificationField","RadioGroupHookField","HomeAddressStreet1Field","HomeAddressCityField","HomeAddressStateField","HomeAddressZipField","SsnField","normalizeSsnOrNotApplicable","EinField","normalizeEinOrNotApplicable","SignatureTextField","AgreeField","CheckboxHookField","BusinessNameField","LlcClassificationCodeField","SelectHookField","OtherTextField","ForeignPartnersField","ExemptPayeeCodeField","ExemptionFromFatcaField","HomeAddressStreet2Field","AccountNumberField","CompanyNameField"],"mappings":";;;;;;AA4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B,EAAenB,GAA4B;AACzD,SAAO,gBAAAC,EAACC,GAAA,EAAoB,GAAGF,GAAO,MAAK,aAAY;AACzD;AAGO,SAASoB,EAAqBpB,GAAkC;AACrE,SAAO,gBAAAC,EAACc,GAAA,EAAmB,GAAGf,GAAO,MAAK,mBAAkB;AAC9D;AAGO,SAASqB,EAAqBrB,GAAkC;AACrE,SAAO,gBAAAC,EAACC,GAAA,EAAoB,GAAGF,GAAO,MAAK,mBAAkB;AAC/D;AAGO,SAASsB,EAAwBtB,GAAqC;AAC3E,SAAO,gBAAAC,EAACC,GAAA,EAAoB,GAAGF,GAAO,MAAK,sBAAqB;AAClE;AAGO,SAASuB,EAAwBvB,GAAqC;AAC3E,SAAO,gBAAAC,EAACC,GAAA,EAAoB,GAAGF,GAAO,MAAK,sBAAqB;AAClE;AAGO,SAASwB,EAAmBxB,GAAgC;AACjE,SAAO,gBAAAC,EAACC,GAAA,EAAoB,GAAGF,GAAO,MAAK,iBAAgB;AAC7D;AAGO,SAASyB,EAAiBzB,GAA8B;AAC7D,SAAO,gBAAAC,EAACC,GAAA,EAAoB,GAAGF,GAAO,MAAK,eAAc;AAC3D;"}
1
+ {"version":3,"file":"fields.js","sources":["../../../../../../src/components/Contractor/Documents/SignatureForm/useContractorSignatureForm/fields.tsx"],"sourcesContent":["import type { ComponentType } from 'react'\nimport type { ContractorSignatureFormErrorCodes } from './contractorSignatureFormSchema'\nimport type { TextInputHookFieldProps } from '@/partner-hook-utils/form/fields/TextInputHookField'\nimport type { CheckboxHookFieldProps } from '@/partner-hook-utils/form/fields/CheckboxHookField'\nimport type { RadioGroupHookFieldProps } from '@/partner-hook-utils/form/fields/RadioGroupHookField'\nimport type { SelectHookFieldProps } from '@/partner-hook-utils/form/fields/SelectHookField'\nimport {\n TextInputHookField,\n CheckboxHookField,\n RadioGroupHookField,\n SelectHookField,\n} from '@/partner-hook-utils/form/fields'\nimport type { HookFieldProps } from '@/partner-hook-utils/types'\nimport { normalizeSSN } from '@/helpers/ssn'\nimport { normalizeEin } from '@/helpers/federalEin'\n\n/**\n * The form-field name of the electronic-signature consent checkbox.\n *\n * @internal\n */\nexport const AGREE_FIELD = 'agree'\n\n// ── Shared prop types ─────────────────────────────────────────────────\n\n/**\n * The required-field error code emitted by most {@link useContractorSignatureForm} fields.\n *\n * @remarks\n * Use as a key in `validationMessages` for text inputs, selects, and radio groups\n * that only emit the `REQUIRED` error. See {@link ContractorSignatureFormErrorCodes}.\n *\n * @public\n */\nexport type RequiredValidation = typeof ContractorSignatureFormErrorCodes.REQUIRED\n\n/**\n * Validation error code emitted by the `Agree` consent checkbox.\n *\n * @remarks\n * Use as a key in `validationMessages` on `Fields.Agree`. See\n * {@link ContractorSignatureFormErrorCodes}.\n *\n * @public\n */\nexport type AgreeValidation = typeof ContractorSignatureFormErrorCodes.AGREE_REQUIRED\n\n/**\n * The format-validation error code emitted by the `ssn` field of {@link useContractorSignatureForm}.\n *\n * @remarks\n * Use as a key in `validationMessages` on `Fields.Ssn`. See\n * {@link ContractorSignatureFormErrorCodes}.\n *\n * @public\n */\nexport type SsnValidation = typeof ContractorSignatureFormErrorCodes.INVALID_SSN\n\n/**\n * The format-validation error code emitted by the `ein` field of {@link useContractorSignatureForm}.\n *\n * @remarks\n * Use as a key in `validationMessages` on `Fields.Ein`. See\n * {@link ContractorSignatureFormErrorCodes}.\n *\n * @public\n */\nexport type EinValidation = typeof ContractorSignatureFormErrorCodes.INVALID_EIN\n\n// ── Field prop types ──────────────────────────────────────────────────\n\n/**\n * Props accepted by {@link useContractorSignatureForm}'s `Fields.Name` component.\n *\n * @public\n */\nexport type NameFieldProps = HookFieldProps<TextInputHookFieldProps<RequiredValidation>>\n\n/**\n * Props accepted by {@link useContractorSignatureForm}'s `Fields.TaxClassification` component.\n *\n * @public\n */\nexport type TaxClassificationFieldProps = HookFieldProps<\n RadioGroupHookFieldProps<RequiredValidation, string>\n>\n\n/**\n * Props accepted by {@link useContractorSignatureForm}'s `Fields.HomeAddressStreet1` component.\n *\n * @public\n */\nexport type HomeAddressStreet1FieldProps = HookFieldProps<\n TextInputHookFieldProps<RequiredValidation>\n>\n\n/**\n * Props accepted by {@link useContractorSignatureForm}'s `Fields.HomeAddressCity` component.\n *\n * @public\n */\nexport type HomeAddressCityFieldProps = HookFieldProps<TextInputHookFieldProps<RequiredValidation>>\n\n/**\n * Props accepted by {@link useContractorSignatureForm}'s `Fields.HomeAddressState` component.\n *\n * @public\n */\nexport type HomeAddressStateFieldProps = HookFieldProps<TextInputHookFieldProps<RequiredValidation>>\n\n/**\n * Props accepted by {@link useContractorSignatureForm}'s `Fields.HomeAddressZip` component.\n *\n * @public\n */\nexport type HomeAddressZipFieldProps = HookFieldProps<TextInputHookFieldProps<RequiredValidation>>\n\n/**\n * Props accepted by {@link useContractorSignatureForm}'s `Fields.Ssn` component.\n *\n * @public\n */\nexport type SsnFieldProps = HookFieldProps<\n TextInputHookFieldProps<SsnValidation, RequiredValidation>\n>\n\n/**\n * Props accepted by {@link useContractorSignatureForm}'s `Fields.Ein` component.\n *\n * @public\n */\nexport type EinFieldProps = HookFieldProps<\n TextInputHookFieldProps<EinValidation, RequiredValidation>\n>\n\n/**\n * Props accepted by {@link useContractorSignatureForm}'s `Fields.SignatureText` component.\n *\n * @public\n */\nexport type SignatureTextFieldProps = HookFieldProps<TextInputHookFieldProps<RequiredValidation>>\n\n/**\n * Props accepted by {@link useContractorSignatureForm}'s `Fields.Agree` component.\n *\n * @public\n */\nexport type AgreeFieldProps = HookFieldProps<CheckboxHookFieldProps<AgreeValidation>>\n\n/**\n * Props accepted by {@link useContractorSignatureForm}'s `Fields.BusinessName` component.\n *\n * @public\n */\nexport type BusinessNameFieldProps = HookFieldProps<TextInputHookFieldProps<RequiredValidation>>\n\n/**\n * Props accepted by {@link useContractorSignatureForm}'s `Fields.LlcClassificationCode` component.\n *\n * @public\n */\nexport type LlcClassificationCodeFieldProps = HookFieldProps<\n SelectHookFieldProps<RequiredValidation, string>\n>\n\n/**\n * Props accepted by {@link useContractorSignatureForm}'s `Fields.OtherText` component.\n *\n * @public\n */\nexport type OtherTextFieldProps = HookFieldProps<TextInputHookFieldProps<RequiredValidation>>\n\n/**\n * Props accepted by {@link useContractorSignatureForm}'s `Fields.ForeignPartners` component.\n *\n * @public\n */\nexport type ForeignPartnersFieldProps = HookFieldProps<CheckboxHookFieldProps>\n\n/**\n * Props accepted by {@link useContractorSignatureForm}'s `Fields.ExemptPayeeCode` component.\n *\n * @public\n */\nexport type ExemptPayeeCodeFieldProps = HookFieldProps<TextInputHookFieldProps<RequiredValidation>>\n\n/**\n * Props accepted by {@link useContractorSignatureForm}'s `Fields.ExemptionFromFatca` component.\n *\n * @public\n */\nexport type ExemptionFromFatcaFieldProps = HookFieldProps<\n TextInputHookFieldProps<RequiredValidation>\n>\n\n/**\n * Props accepted by {@link useContractorSignatureForm}'s `Fields.HomeAddressStreet2` component.\n *\n * @public\n */\nexport type HomeAddressStreet2FieldProps = HookFieldProps<\n TextInputHookFieldProps<RequiredValidation>\n>\n\n/**\n * Props accepted by {@link useContractorSignatureForm}'s `Fields.AccountNumber` component.\n *\n * @public\n */\nexport type AccountNumberFieldProps = HookFieldProps<TextInputHookFieldProps<RequiredValidation>>\n\n/**\n * Props accepted by {@link useContractorSignatureForm}'s `Fields.CompanyName` component.\n *\n * @public\n */\nexport type CompanyNameFieldProps = HookFieldProps<TextInputHookFieldProps<RequiredValidation>>\n\n// ── Core fields (always present) ──────────────────────────────────────\n\n/** @internal */\nexport function NameField(props: NameFieldProps) {\n return <TextInputHookField {...props} name=\"name\" />\n}\n\n/** @internal */\nexport function TaxClassificationField(props: TaxClassificationFieldProps) {\n return <RadioGroupHookField {...props} name=\"taxClassification\" />\n}\n\n/** @internal */\nexport function HomeAddressStreet1Field(props: HomeAddressStreet1FieldProps) {\n return <TextInputHookField {...props} name=\"homeAddressStreet1\" />\n}\n\n/** @internal */\nexport function HomeAddressCityField(props: HomeAddressCityFieldProps) {\n return <TextInputHookField {...props} name=\"homeAddressCity\" />\n}\n\n/** @internal */\nexport function HomeAddressStateField(props: HomeAddressStateFieldProps) {\n return <TextInputHookField {...props} name=\"homeAddressState\" />\n}\n\n/** @internal */\nexport function HomeAddressZipField(props: HomeAddressZipFieldProps) {\n return <TextInputHookField {...props} name=\"homeAddressZip\" />\n}\n\n/** @internal */\nexport function SsnField(props: SsnFieldProps) {\n return <TextInputHookField {...props} name=\"ssn\" transform={normalizeSSN} />\n}\n\n/** @internal */\nexport function EinField(props: EinFieldProps) {\n return <TextInputHookField {...props} name=\"ein\" transform={normalizeEin} />\n}\n\n/** @internal */\nexport function SignatureTextField(props: SignatureTextFieldProps) {\n return <TextInputHookField {...props} name=\"signatureText\" />\n}\n\n/** @internal */\nexport function AgreeField(props: AgreeFieldProps) {\n return <CheckboxHookField {...props} name=\"agree\" />\n}\n\n// ── Variable fields (rendered only when the API returns them) ─────────\n\n/** @internal */\nexport function BusinessNameField(props: BusinessNameFieldProps) {\n return <TextInputHookField {...props} name=\"businessName\" />\n}\n\n/** @internal */\nexport function LlcClassificationCodeField(props: LlcClassificationCodeFieldProps) {\n return <SelectHookField {...props} name=\"llcClassificationCode\" />\n}\n\n/** @internal */\nexport function OtherTextField(props: OtherTextFieldProps) {\n return <TextInputHookField {...props} name=\"otherText\" />\n}\n\n/** @internal */\nexport function ForeignPartnersField(props: ForeignPartnersFieldProps) {\n return <CheckboxHookField {...props} name=\"foreignPartners\" />\n}\n\n/** @internal */\nexport function ExemptPayeeCodeField(props: ExemptPayeeCodeFieldProps) {\n return <TextInputHookField {...props} name=\"exemptPayeeCode\" />\n}\n\n/** @internal */\nexport function ExemptionFromFatcaField(props: ExemptionFromFatcaFieldProps) {\n return <TextInputHookField {...props} name=\"exemptionFromFatca\" />\n}\n\n/** @internal */\nexport function HomeAddressStreet2Field(props: HomeAddressStreet2FieldProps) {\n return <TextInputHookField {...props} name=\"homeAddressStreet2\" />\n}\n\n/** @internal */\nexport function AccountNumberField(props: AccountNumberFieldProps) {\n return <TextInputHookField {...props} name=\"accountNumber\" />\n}\n\n/** @internal */\nexport function CompanyNameField(props: CompanyNameFieldProps) {\n return <TextInputHookField {...props} name=\"companyName\" />\n}\n\n/**\n * Field components exposed by {@link useContractorSignatureForm} on `form.Fields`.\n *\n * @remarks\n * Every field is presence-gated against the API response and is `undefined`\n * when the document didn't return its backing field — always null-check before\n * rendering. This guards against the document API diverging (dropping or\n * renaming a field) by skipping fields it no longer returns, mirroring the\n * stable signing flow. `Agree` is the sole exception: it's a synthesized\n * electronic-signature consent checkbox with no API field, so it's always\n * present.\n *\n * @public\n */\nexport interface ContractorSignatureFormFieldComponents {\n /** Entity or individual name; defined only when the API returns `name`. */\n Name: ComponentType<NameFieldProps> | undefined\n /** Federal tax classification radio group; defined only when the document carries classification checkboxes. */\n TaxClassification: ComponentType<TaxClassificationFieldProps> | undefined\n /** Street address line 1; defined only when the API returns `home_address_street_1`. */\n HomeAddressStreet1: ComponentType<HomeAddressStreet1FieldProps> | undefined\n /** City; defined only when the API returns `home_address_city`. */\n HomeAddressCity: ComponentType<HomeAddressCityFieldProps> | undefined\n /** State; defined only when the API returns `home_address_state`. */\n HomeAddressState: ComponentType<HomeAddressStateFieldProps> | undefined\n /** ZIP code; defined only when the API returns `home_address_zip`. */\n HomeAddressZip: ComponentType<HomeAddressZipFieldProps> | undefined\n /** Social Security Number; defined only when the API returns `ssn`. */\n Ssn: ComponentType<SsnFieldProps> | undefined\n /** Employer Identification Number; defined only when the API returns `ein`. */\n Ein: ComponentType<EinFieldProps> | undefined\n /** Typed signature; defined only when the API returns `signature_text`. */\n SignatureText: ComponentType<SignatureTextFieldProps> | undefined\n /** Electronic-signature consent checkbox; always present (synthesized, not an API field). */\n Agree: ComponentType<AgreeFieldProps>\n /** Business name; defined only when the API returns `business_name`. */\n BusinessName: ComponentType<BusinessNameFieldProps> | undefined\n /** LLC tax classification code select; defined only when classification checkboxes are present. */\n LlcClassificationCode: ComponentType<LlcClassificationCodeFieldProps> | undefined\n /** \"Other\" free-text classification; defined only when the API returns `other_text`. */\n OtherText: ComponentType<OtherTextFieldProps> | undefined\n /** Foreign partners checkbox; defined only when the API returns `foreign_partners`. */\n ForeignPartners: ComponentType<ForeignPartnersFieldProps> | undefined\n /** Exempt payee code; defined only when the API returns `exempt_payee_code`. */\n ExemptPayeeCode: ComponentType<ExemptPayeeCodeFieldProps> | undefined\n /** FATCA exemption code; defined only when the API returns `exemption_from_FATCA`. */\n ExemptionFromFatca: ComponentType<ExemptionFromFatcaFieldProps> | undefined\n /** Street address line 2; defined only when the API returns `home_address_street_2`. */\n HomeAddressStreet2: ComponentType<HomeAddressStreet2FieldProps> | undefined\n /** Account number(s); defined only when the API returns `account_number`. */\n AccountNumber: ComponentType<AccountNumberFieldProps> | undefined\n /** Requester's name and address; defined only when the API returns `company_name`. */\n CompanyName: ComponentType<CompanyNameFieldProps> | undefined\n}\n"],"names":["NameField","props","jsx","TextInputHookField","TaxClassificationField","RadioGroupHookField","HomeAddressStreet1Field","HomeAddressCityField","HomeAddressStateField","HomeAddressZipField","SsnField","normalizeSSN","EinField","normalizeEin","SignatureTextField","AgreeField","CheckboxHookField","BusinessNameField","LlcClassificationCodeField","SelectHookField","OtherTextField","ForeignPartnersField","ExemptPayeeCodeField","ExemptionFromFatcaField","HomeAddressStreet2Field","AccountNumberField","CompanyNameField"],"mappings":";;;;;;;AA6NO,SAASA,EAAUC,GAAuB;AAC/C,SAAO,gBAAAC,EAACC,GAAA,EAAoB,GAAGF,GAAO,MAAK,QAAO;AACpD;AAGO,SAASG,EAAuBH,GAAoC;AACzE,SAAO,gBAAAC,EAACG,GAAA,EAAqB,GAAGJ,GAAO,MAAK,qBAAoB;AAClE;AAGO,SAASK,EAAwBL,GAAqC;AAC3E,SAAO,gBAAAC,EAACC,GAAA,EAAoB,GAAGF,GAAO,MAAK,sBAAqB;AAClE;AAGO,SAASM,EAAqBN,GAAkC;AACrE,SAAO,gBAAAC,EAACC,GAAA,EAAoB,GAAGF,GAAO,MAAK,mBAAkB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AClE;AAGO,SAASuB,EAAwBvB,GAAqC;AAC3E,SAAO,gBAAAC,EAACC,GAAA,EAAoB,GAAGF,GAAO,MAAK,sBAAqB;AAClE;AAGO,SAASwB,EAAmBxB,GAAgC;AACjE,SAAO,gBAAAC,EAACC,GAAA,EAAoB,GAAGF,GAAO,MAAK,iBAAgB;AAC7D;AAGO,SAASyB,EAAiBzB,GAA8B;AAC7D,SAAO,gBAAAC,EAACC,GAAA,EAAoB,GAAGF,GAAO,MAAK,eAAc;AAC3D;"}
@@ -1,64 +1,67 @@
1
- import { useMemo as i } from "react";
2
- import { useForm as M, useWatch as N } from "react-hook-form";
3
- import { zodResolver as B } from "@hookform/resolvers/zod";
4
- import { useContractorDocumentsGet as Z } from "@gusto/embedded-api/react-query/contractorDocumentsGet";
5
- import { useContractorDocumentsGetPdf as V } from "@gusto/embedded-api/react-query/contractorDocumentsGetPdf";
6
- import { useContractorDocumentsSignMutation as W } from "@gusto/embedded-api/react-query/contractorDocumentsSign";
7
- import { getPresentFieldNames as z, getRedactionState as G, EMPTY_W9_DEFAULTS as k, buildW9Defaults as K, OTHER_CLASSIFICATION_OPTION as Q, LLC_CLASSIFICATION_OPTION as Y, serializeW9Fields as q, LLC_CLASSIFICATION_CODES as x, TAX_CLASSIFICATION_OPTION_KEYS as v } from "./w9Fields.js";
8
- import { createContractorSignatureFormSchema as U } from "./contractorSignatureFormSchema.js";
9
- import { CompanyNameField as X, AccountNumberField as j, HomeAddressStreet2Field as J, ExemptionFromFatcaField as $, ExemptPayeeCodeField as ee, ForeignPartnersField as te, OtherTextField as oe, LlcClassificationCodeField as re, BusinessNameField as se, AgreeField as ie, SignatureTextField as ae, EinField as ne, SsnField as de, HomeAddressZipField as me, HomeAddressStateField as ce, HomeAddressCityField as ue, HomeAddressStreet1Field as le, TaxClassificationField as fe, NameField as he } from "./fields.js";
10
- import { useDeriveFieldsMetadata as Ce } from "../../../../../partner-hook-utils/form/useDeriveFieldsMetadata.js";
11
- import { withOptions as y } from "../../../../../partner-hook-utils/form/withOptions.js";
12
- import { withFlags as P } from "../../../../../partner-hook-utils/form/withFlags.js";
13
- import { useHookFormInternals as Se } from "../../../../../partner-hook-utils/form/useHookFormInternals.js";
14
- import { createGetFormSubmissionValues as Ae } from "../../../../../partner-hook-utils/form/getFormSubmissionValues.js";
15
- import { composeErrorHandler as ge } from "../../../../../partner-hook-utils/composeErrorHandler.js";
16
- import { useBaseSubmit as Fe } from "../../../../Base/useBaseSubmit.js";
17
- import { SDKInternalError as T } from "../../../../../types/sdkError.js";
18
- function pe(e, r) {
1
+ import { useMemo as a } from "react";
2
+ import { useForm as M, useWatch as B } from "react-hook-form";
3
+ import { zodResolver as Z } from "@hookform/resolvers/zod";
4
+ import { useContractorDocumentsGet as V } from "@gusto/embedded-api/react-query/contractorDocumentsGet";
5
+ import { useContractorDocumentsGetPdf as W } from "@gusto/embedded-api/react-query/contractorDocumentsGetPdf";
6
+ import { useContractorDocumentsSignMutation as z } from "@gusto/embedded-api/react-query/contractorDocumentsSign";
7
+ import { getPresentFieldNames as G, getRedactionState as k, EMPTY_W9_DEFAULTS as K, buildW9Defaults as Q, OTHER_CLASSIFICATION_OPTION as U, LLC_CLASSIFICATION_OPTION as Y, NOT_APPLICABLE_VALUE as x, serializeW9Fields as q, LLC_CLASSIFICATION_CODES as v, TAX_CLASSIFICATION_OPTION_KEYS as P } from "./w9Fields.js";
8
+ import { createContractorSignatureFormSchema as X } from "./contractorSignatureFormSchema.js";
9
+ import { CompanyNameField as j, AccountNumberField as J, HomeAddressStreet2Field as $, ExemptionFromFatcaField as ee, ExemptPayeeCodeField as te, ForeignPartnersField as oe, OtherTextField as re, LlcClassificationCodeField as se, BusinessNameField as ie, AgreeField as ae, SignatureTextField as ne, EinField as de, SsnField as me, HomeAddressZipField as ce, HomeAddressStateField as ue, HomeAddressCityField as le, HomeAddressStreet1Field as fe, TaxClassificationField as he, NameField as Ce } from "./fields.js";
10
+ import { useDeriveFieldsMetadata as Se } from "../../../../../partner-hook-utils/form/useDeriveFieldsMetadata.js";
11
+ import { withOptions as T } from "../../../../../partner-hook-utils/form/withOptions.js";
12
+ import { withFlags as y } from "../../../../../partner-hook-utils/form/withFlags.js";
13
+ import { useHookFormInternals as Ae } from "../../../../../partner-hook-utils/form/useHookFormInternals.js";
14
+ import { createGetFormSubmissionValues as ge } from "../../../../../partner-hook-utils/form/getFormSubmissionValues.js";
15
+ import { composeErrorHandler as Fe } from "../../../../../partner-hook-utils/composeErrorHandler.js";
16
+ import { useBaseSubmit as pe } from "../../../../Base/useBaseSubmit.js";
17
+ import { SDKInternalError as I } from "../../../../../types/sdkError.js";
18
+ function xe(e, r, s) {
19
19
  return {
20
20
  // Every field is presence-gated to guard against the document API diverging
21
21
  // (dropping or renaming a field) — only `Agree` is synthesized and always on.
22
- Name: e.has("name") ? he : void 0,
23
- TaxClassification: e.has("taxClassification") ? fe : void 0,
24
- HomeAddressStreet1: e.has("homeAddressStreet1") ? le : void 0,
25
- HomeAddressCity: e.has("homeAddressCity") ? ue : void 0,
26
- HomeAddressState: e.has("homeAddressState") ? ce : void 0,
27
- HomeAddressZip: e.has("homeAddressZip") ? me : void 0,
28
- Ssn: e.has("ssn") ? de : void 0,
29
- Ein: e.has("ein") ? ne : void 0,
30
- SignatureText: e.has("signatureText") ? ae : void 0,
31
- Agree: ie,
32
- BusinessName: e.has("businessName") ? se : void 0,
22
+ Name: e.has("name") ? Ce : void 0,
23
+ TaxClassification: e.has("taxClassification") ? he : void 0,
24
+ HomeAddressStreet1: e.has("homeAddressStreet1") ? fe : void 0,
25
+ HomeAddressCity: e.has("homeAddressCity") ? le : void 0,
26
+ HomeAddressState: e.has("homeAddressState") ? ue : void 0,
27
+ HomeAddressZip: e.has("homeAddressZip") ? ce : void 0,
28
+ // The non-applicable TIN (an individual's EIN, a business's SSN) arrives as
29
+ // the `N/A` sentinel and is never rendered, while its `N/A` default stays in
30
+ // form state and still serializes onto the W-9.
31
+ Ssn: e.has("ssn") && s.ssn !== x ? me : void 0,
32
+ Ein: e.has("ein") && s.ein !== x ? de : void 0,
33
+ SignatureText: e.has("signatureText") ? ne : void 0,
34
+ Agree: ae,
35
+ BusinessName: e.has("businessName") ? ie : void 0,
33
36
  // Revealed only while the LLC classification is selected (and the document
34
37
  // carries classification checkboxes).
35
- LlcClassificationCode: e.has("llcClassificationCode") && r === Y ? re : void 0,
38
+ LlcClassificationCode: e.has("llcClassificationCode") && r === Y ? se : void 0,
36
39
  // Revealed only while the "Other" classification is selected.
37
- OtherText: e.has("otherText") && r === Q ? oe : void 0,
38
- ForeignPartners: e.has("foreignPartners") ? te : void 0,
39
- ExemptPayeeCode: e.has("exemptPayeeCode") ? ee : void 0,
40
- ExemptionFromFatca: e.has("exemptionFromFatca") ? $ : void 0,
41
- HomeAddressStreet2: e.has("homeAddressStreet2") ? J : void 0,
42
- AccountNumber: e.has("accountNumber") ? j : void 0,
43
- CompanyName: e.has("companyName") ? X : void 0
40
+ OtherText: e.has("otherText") && r === U ? re : void 0,
41
+ ForeignPartners: e.has("foreignPartners") ? oe : void 0,
42
+ ExemptPayeeCode: e.has("exemptPayeeCode") ? te : void 0,
43
+ ExemptionFromFatca: e.has("exemptionFromFatca") ? ee : void 0,
44
+ HomeAddressStreet2: e.has("homeAddressStreet2") ? $ : void 0,
45
+ AccountNumber: e.has("accountNumber") ? J : void 0,
46
+ CompanyName: e.has("companyName") ? j : void 0
44
47
  };
45
48
  }
46
- function xe(e, { ssnPlaceholder: r, einPlaceholder: d }) {
47
- const m = v.map((s) => ({
48
- value: s,
49
- label: s
50
- })), a = x.map((s) => ({
51
- value: s,
52
- label: s
49
+ function ve(e, { ssnPlaceholder: r, einPlaceholder: s }) {
50
+ const m = P.map((i) => ({
51
+ value: i,
52
+ label: i
53
+ })), n = v.map((i) => ({
54
+ value: i,
55
+ label: i
53
56
  }));
54
57
  return {
55
58
  name: e.name,
56
59
  businessName: e.businessName,
57
- taxClassification: y(e.taxClassification, m, [
58
- ...v
60
+ taxClassification: T(e.taxClassification, m, [
61
+ ...P
59
62
  ]),
60
- llcClassificationCode: y(e.llcClassificationCode, a, [
61
- ...x
63
+ llcClassificationCode: T(e.llcClassificationCode, n, [
64
+ ...v
62
65
  ]),
63
66
  otherText: e.otherText,
64
67
  foreignPartners: e.foreignPartners,
@@ -73,67 +76,67 @@ function xe(e, { ssnPlaceholder: r, einPlaceholder: d }) {
73
76
  companyName: e.companyName,
74
77
  // The masked value drives the redacted SSN/EIN placeholder. `buildFormSchema`
75
78
  // already set `hasRedactedValue` and exempted the field from required validation.
76
- ssn: P(e.ssn, r ? { placeholder: r } : {}),
77
- ein: P(e.ein, d ? { placeholder: d } : {}),
79
+ ssn: y(e.ssn, r ? { placeholder: r } : {}),
80
+ ein: y(e.ein, s ? { placeholder: s } : {}),
78
81
  signatureText: e.signatureText,
79
82
  agree: e.agree
80
83
  };
81
84
  }
82
- function Ve({
85
+ function We({
83
86
  documentUuid: e,
84
87
  validationMode: r = "onSubmit",
85
- shouldFocusError: d = !0,
88
+ shouldFocusError: s = !0,
86
89
  optionalFieldsToRequire: m
87
90
  }) {
88
- const a = Z({ documentUuid: e }), s = V({ documentUuid: e }), t = a.data?.document, c = i(
89
- () => t ? z(t) : /* @__PURE__ */ new Set(),
91
+ const n = V({ documentUuid: e }), i = W({ documentUuid: e }), t = n.data?.document, u = a(
92
+ () => t ? G(t) : /* @__PURE__ */ new Set(),
90
93
  [t]
91
- ), o = i(
92
- () => t ? G(t) : { ssnRedacted: !1, einRedacted: !1 },
94
+ ), o = a(
95
+ () => t ? k(t) : { ssnRedacted: !1, einRedacted: !1 },
93
96
  [t]
94
- ), [u, I] = i(
95
- () => U({
97
+ ), [l, O] = a(
98
+ () => X({
96
99
  optionalFieldsToRequire: m,
97
100
  ssnRedacted: o.ssnRedacted,
98
101
  einRedacted: o.einRedacted
99
102
  }),
100
103
  [m, o.ssnRedacted, o.einRedacted]
101
- ), l = i(
102
- () => t ? K(t) : k,
104
+ ), c = a(
105
+ () => t ? Q(t) : K,
103
106
  [t]
104
- ), n = M(
107
+ ), d = M(
105
108
  {
106
- resolver: B(u),
109
+ resolver: Z(l),
107
110
  mode: r,
108
- shouldFocusError: d,
109
- defaultValues: l,
110
- values: l,
111
+ shouldFocusError: s,
112
+ defaultValues: c,
113
+ values: c,
111
114
  resetOptions: { keepDirtyValues: !0 }
112
115
  }
113
- ), f = N({
114
- control: n.control,
116
+ ), f = B({
117
+ control: d.control,
115
118
  name: "taxClassification"
116
- }), O = i(
117
- () => pe(c, f),
118
- [c, f]
119
- ), h = Ce(I, n.control), E = i(
120
- () => xe(h, {
119
+ }), E = a(
120
+ () => xe(u, f, c),
121
+ [u, f, c]
122
+ ), h = Se(O, d.control), L = a(
123
+ () => ve(h, {
121
124
  ssnPlaceholder: o.ssnPlaceholder,
122
125
  einPlaceholder: o.einPlaceholder
123
126
  }),
124
127
  [h, o]
125
- ), C = W(), H = C.isPending, {
126
- baseSubmitHandler: L,
128
+ ), C = z(), H = C.isPending, {
129
+ baseSubmitHandler: _,
127
130
  error: w,
128
131
  setError: D
129
- } = Fe("ContractorSignatureForm"), S = ge([a], { submitError: w, setSubmitError: D }), R = async () => {
132
+ } = pe("ContractorSignatureForm"), S = Fe([n], { submitError: w, setSubmitError: D }), R = async () => {
130
133
  let A;
131
134
  return await new Promise((g) => {
132
- n.handleSubmit(
135
+ d.handleSubmit(
133
136
  async (b) => {
134
- await L(b, async (F) => {
137
+ await _(b, async (F) => {
135
138
  if (!t)
136
- throw new T("Document must be loaded before signing");
139
+ throw new I("Document must be loaded before signing");
137
140
  const p = (await C.mutateAsync({
138
141
  request: {
139
142
  documentUuid: e,
@@ -148,7 +151,7 @@ function Ve({
148
151
  }
149
152
  })).documentSigned;
150
153
  if (!p)
151
- throw new T("Contractor document signing failed");
154
+ throw new I("Contractor document signing failed");
152
155
  A = { mode: "create", data: p };
153
156
  }), g();
154
157
  },
@@ -157,26 +160,26 @@ function Ve({
157
160
  }
158
161
  )();
159
162
  }), A;
160
- }, _ = Se(n);
161
- return a.isLoading || !t ? { isLoading: !0, errorHandling: S } : {
163
+ }, N = Ae(d);
164
+ return n.isLoading || !t ? { isLoading: !0, errorHandling: S } : {
162
165
  isLoading: !1,
163
166
  data: {
164
167
  document: t,
165
- pdfUrl: s.data?.documentPdf?.documentUrl ?? null,
166
- hasFields: c.size > 0
168
+ pdfUrl: i.data?.documentPdf?.documentUrl ?? null,
169
+ hasFields: u.size > 0
167
170
  },
168
171
  status: { isPending: H, mode: "create" },
169
172
  actions: { onSubmit: R },
170
173
  errorHandling: S,
171
174
  form: {
172
- Fields: O,
173
- fieldsMetadata: E,
174
- hookFormInternals: _,
175
- getFormSubmissionValues: Ae(n, u)
175
+ Fields: E,
176
+ fieldsMetadata: L,
177
+ hookFormInternals: N,
178
+ getFormSubmissionValues: ge(d, l)
176
179
  }
177
180
  };
178
181
  }
179
182
  export {
180
- Ve as useContractorSignatureForm
183
+ We as useContractorSignatureForm
181
184
  };
182
185
  //# sourceMappingURL=useContractorSignatureForm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useContractorSignatureForm.js","sources":["../../../../../../src/components/Contractor/Documents/SignatureForm/useContractorSignatureForm/useContractorSignatureForm.tsx"],"sourcesContent":["import { useMemo } from 'react'\nimport { useForm, useWatch } from 'react-hook-form'\nimport type { UseFormProps } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport type { Document } from '@gusto/embedded-api/models/components/document'\nimport type { DocumentSigned } from '@gusto/embedded-api/models/components/documentsigned'\nimport { useContractorDocumentsGet } from '@gusto/embedded-api/react-query/contractorDocumentsGet'\nimport { useContractorDocumentsGetPdf } from '@gusto/embedded-api/react-query/contractorDocumentsGetPdf'\nimport { useContractorDocumentsSignMutation } from '@gusto/embedded-api/react-query/contractorDocumentsSign'\nimport {\n buildW9Defaults,\n getPresentFieldNames,\n getRedactionState,\n serializeW9Fields,\n EMPTY_W9_DEFAULTS,\n TAX_CLASSIFICATION_OPTION_KEYS,\n LLC_CLASSIFICATION_CODES,\n LLC_CLASSIFICATION_OPTION,\n OTHER_CLASSIFICATION_OPTION,\n type W9RedactionState,\n} from './w9Fields'\nimport {\n createContractorSignatureFormSchema,\n type ContractorSignatureFormData,\n type ContractorSignatureFormOutputs,\n type ContractorSignatureOptionalFieldsToRequire,\n} from './contractorSignatureFormSchema'\nimport {\n NameField,\n TaxClassificationField,\n HomeAddressStreet1Field,\n HomeAddressCityField,\n HomeAddressStateField,\n HomeAddressZipField,\n SsnField,\n EinField,\n SignatureTextField,\n AgreeField,\n BusinessNameField,\n LlcClassificationCodeField,\n OtherTextField,\n ForeignPartnersField,\n ExemptPayeeCodeField,\n ExemptionFromFatcaField,\n HomeAddressStreet2Field,\n AccountNumberField,\n CompanyNameField,\n type ContractorSignatureFormFieldComponents,\n} from './fields'\nimport { useDeriveFieldsMetadata } from '@/partner-hook-utils/form/useDeriveFieldsMetadata'\nimport { withOptions } from '@/partner-hook-utils/form/withOptions'\nimport { withFlags } from '@/partner-hook-utils/form/withFlags'\nimport { useHookFormInternals } from '@/partner-hook-utils/form/useHookFormInternals'\nimport { createGetFormSubmissionValues } from '@/partner-hook-utils/form/getFormSubmissionValues'\nimport { composeErrorHandler } from '@/partner-hook-utils/composeErrorHandler'\nimport type {\n BaseFormHookReady,\n FieldMetadata,\n FieldsMetadata,\n HookLoadingResult,\n HookSubmitResult,\n} from '@/partner-hook-utils/types'\nimport { useBaseSubmit } from '@/components/Base/useBaseSubmit'\nimport { SDKInternalError } from '@/types/sdkError'\n\n/**\n * Props for {@link useContractorSignatureForm}.\n *\n * @public\n */\nexport interface UseContractorSignatureFormProps {\n /** UUID of the contractor document to sign. */\n documentUuid: string\n /** When validation runs. Passed through to react-hook-form; defaults to `'onSubmit'`. */\n validationMode?: UseFormProps['mode']\n /** Auto-focus the first invalid field on submit. Defaults to `true`; set to `false` when using `composeSubmitHandler`. */\n shouldFocusError?: boolean\n /** Promote optional W-9 fields to required (e.g. `{ create: ['businessName'] }`). */\n optionalFieldsToRequire?: ContractorSignatureOptionalFieldsToRequire\n}\n\n/**\n * Ready-state shape returned by {@link useContractorSignatureForm} once the\n * document metadata has loaded.\n *\n * @public\n */\nexport interface UseContractorSignatureFormReady extends BaseFormHookReady<\n ContractorSignatureFieldsMetadata,\n ContractorSignatureFormData,\n ContractorSignatureFormFieldComponents\n> {\n /** Loaded data — the document being signed and a downloadable PDF URL. */\n data: {\n /** The document entity fetched from the API. */\n document: Document\n /** URL to the document's PDF, or `null` when unavailable. */\n pdfUrl: string | null\n /** Whether the document carries signable fields (vs. acknowledge-only). */\n hasFields: boolean\n }\n /** Submit-state flags. */\n status: {\n /** `true` while the sign mutation is in flight. */\n isPending: boolean\n /** Always `'create'`; the hook always submits as a signing operation. */\n mode: 'create'\n }\n /** Imperative actions exposed by the hook. */\n actions: {\n /** Validates the form and submits the signature. Resolves with the signed document on success, or `undefined` on validation or API failure. */\n onSubmit: () => Promise<HookSubmitResult<DocumentSigned> | undefined>\n }\n}\n\n/**\n * Result of {@link useContractorSignatureForm} — a discriminated union on `isLoading`.\n *\n * @public\n */\nexport type UseContractorSignatureFormResult = HookLoadingResult | UseContractorSignatureFormReady\n\n/**\n * Per-field metadata exposed by {@link useContractorSignatureForm} as `form.fieldsMetadata`.\n *\n * @remarks\n * Extracted from the ready-state result for standalone use when a partner needs\n * to type-check or reference the metadata shape independently.\n *\n * @public\n */\nexport type ContractorSignatureFieldsMetadata = ReturnType<\n typeof buildContractorSignatureFieldsMetadata\n>\n\nfunction buildFields(\n presentFieldNames: Set<string>,\n classification: string,\n): ContractorSignatureFormFieldComponents {\n return {\n // Every field is presence-gated to guard against the document API diverging\n // (dropping or renaming a field) — only `Agree` is synthesized and always on.\n Name: presentFieldNames.has('name') ? NameField : undefined,\n TaxClassification: presentFieldNames.has('taxClassification')\n ? TaxClassificationField\n : undefined,\n HomeAddressStreet1: presentFieldNames.has('homeAddressStreet1')\n ? HomeAddressStreet1Field\n : undefined,\n HomeAddressCity: presentFieldNames.has('homeAddressCity') ? HomeAddressCityField : undefined,\n HomeAddressState: presentFieldNames.has('homeAddressState') ? HomeAddressStateField : undefined,\n HomeAddressZip: presentFieldNames.has('homeAddressZip') ? HomeAddressZipField : undefined,\n Ssn: presentFieldNames.has('ssn') ? SsnField : undefined,\n Ein: presentFieldNames.has('ein') ? EinField : undefined,\n SignatureText: presentFieldNames.has('signatureText') ? SignatureTextField : undefined,\n Agree: AgreeField,\n BusinessName: presentFieldNames.has('businessName') ? BusinessNameField : undefined,\n // Revealed only while the LLC classification is selected (and the document\n // carries classification checkboxes).\n LlcClassificationCode:\n presentFieldNames.has('llcClassificationCode') && classification === LLC_CLASSIFICATION_OPTION\n ? LlcClassificationCodeField\n : undefined,\n // Revealed only while the \"Other\" classification is selected.\n OtherText:\n presentFieldNames.has('otherText') && classification === OTHER_CLASSIFICATION_OPTION\n ? OtherTextField\n : undefined,\n ForeignPartners: presentFieldNames.has('foreignPartners') ? ForeignPartnersField : undefined,\n ExemptPayeeCode: presentFieldNames.has('exemptPayeeCode') ? ExemptPayeeCodeField : undefined,\n ExemptionFromFatca: presentFieldNames.has('exemptionFromFatca')\n ? ExemptionFromFatcaField\n : undefined,\n HomeAddressStreet2: presentFieldNames.has('homeAddressStreet2')\n ? HomeAddressStreet2Field\n : undefined,\n AccountNumber: presentFieldNames.has('accountNumber') ? AccountNumberField : undefined,\n CompanyName: presentFieldNames.has('companyName') ? CompanyNameField : undefined,\n }\n}\n\n/** @internal */\nfunction buildContractorSignatureFieldsMetadata(\n base: Record<keyof ContractorSignatureFormData, FieldMetadata>,\n { ssnPlaceholder, einPlaceholder }: { ssnPlaceholder?: string; einPlaceholder?: string },\n) {\n const taxClassificationOptions = TAX_CLASSIFICATION_OPTION_KEYS.map(key => ({\n value: key,\n label: key,\n }))\n const llcClassificationOptions = LLC_CLASSIFICATION_CODES.map(code => ({\n value: code,\n label: code,\n }))\n\n return {\n name: base.name,\n businessName: base.businessName,\n taxClassification: withOptions(base.taxClassification, taxClassificationOptions, [\n ...TAX_CLASSIFICATION_OPTION_KEYS,\n ]),\n llcClassificationCode: withOptions(base.llcClassificationCode, llcClassificationOptions, [\n ...LLC_CLASSIFICATION_CODES,\n ]),\n otherText: base.otherText,\n foreignPartners: base.foreignPartners,\n exemptPayeeCode: base.exemptPayeeCode,\n exemptionFromFatca: base.exemptionFromFatca,\n homeAddressStreet1: base.homeAddressStreet1,\n homeAddressStreet2: base.homeAddressStreet2,\n homeAddressCity: base.homeAddressCity,\n homeAddressState: base.homeAddressState,\n homeAddressZip: base.homeAddressZip,\n accountNumber: base.accountNumber,\n companyName: base.companyName,\n // The masked value drives the redacted SSN/EIN placeholder. `buildFormSchema`\n // already set `hasRedactedValue` and exempted the field from required validation.\n ssn: withFlags(base.ssn, ssnPlaceholder ? { placeholder: ssnPlaceholder } : {}),\n ein: withFlags(base.ein, einPlaceholder ? { placeholder: einPlaceholder } : {}),\n signatureText: base.signatureText,\n agree: base.agree,\n } satisfies FieldsMetadata\n}\n\n/**\n * Headless hook for signing a contractor document — collects the document's\n * fields plus a typed signature and consent.\n *\n * @remarks\n * This hook implements the W-9 — the only signable contractor document the API\n * exposes today (`taxpayer_identification_form_w_9`). The field surface is\n * declared statically (`form.Fields`), like the other SDK form hooks: core\n * fields are always present, while variable fields are exposed only when the API\n * returns them (otherwise `undefined`) — a presence-based safety check, so a\n * field the API drops is skipped rather than rendered as an orphan. The seven\n * federal tax-classification checkboxes are collapsed into a single required\n * radio group with conditional LLC-code and \"Other\" sub-fields, and on submit\n * the selection is mapped back to the W-9 wire format. Pre-filled values (name,\n * address, TIN, etc.) are editable inputs; the signing `date` is omitted so the\n * API auto-fills it. A document that returns no recognized W-9 fields renders\n * as acknowledge-only (`data.hasFields` is `false`). Consult\n * `form.fieldsMetadata` for per-field required flags and select/radio options.\n *\n * @param props - See {@link UseContractorSignatureFormProps}.\n * @returns A {@link HookLoadingResult} while loading, or a {@link UseContractorSignatureFormReady} once loaded.\n * @public\n *\n * @example\n * ```tsx\n * import {\n * useContractorSignatureForm,\n * SDKFormProvider,\n * type UseContractorSignatureFormReady,\n * } from '@gusto/embedded-react-sdk'\n *\n * function SignDocumentPage({ documentId }: { documentId: string }) {\n * const signatureForm = useContractorSignatureForm({ documentId })\n *\n * if (signatureForm.isLoading) return <div>Loading...</div>\n *\n * return <SignDocumentReady signatureForm={signatureForm} />\n * }\n *\n * function SignDocumentReady({\n * signatureForm,\n * }: {\n * signatureForm: UseContractorSignatureFormReady\n * }) {\n * const { Fields } = signatureForm.form\n *\n * const handleSubmit = async () => {\n * await signatureForm.actions.onSubmit()\n * }\n *\n * return (\n * <SDKFormProvider {...signatureForm.form.methods}>\n * {Fields.Name ? <Fields.Name /> : null}\n * {Fields.SignatureText ? <Fields.SignatureText /> : null}\n * <Fields.Agree />\n * <button onClick={handleSubmit}>Sign</button>\n * </SDKFormProvider>\n * )\n * }\n * ```\n */\nexport function useContractorSignatureForm({\n documentUuid,\n validationMode = 'onSubmit',\n shouldFocusError = true,\n optionalFieldsToRequire,\n}: UseContractorSignatureFormProps): UseContractorSignatureFormResult {\n const documentQuery = useContractorDocumentsGet({ documentUuid })\n // PDF failures are intentionally excluded from the page error surface; the\n // download link is simply hidden when the URL is unavailable.\n const pdfQuery = useContractorDocumentsGetPdf({ documentUuid })\n\n const document = documentQuery.data?.document\n\n const presentFieldNames = useMemo(\n () => (document ? getPresentFieldNames(document) : new Set<string>()),\n [document],\n )\n const redaction = useMemo<W9RedactionState>(\n () => (document ? getRedactionState(document) : { ssnRedacted: false, einRedacted: false }),\n [document],\n )\n\n const [schema, metadataConfig] = useMemo(\n () =>\n createContractorSignatureFormSchema({\n optionalFieldsToRequire,\n ssnRedacted: redaction.ssnRedacted,\n einRedacted: redaction.einRedacted,\n }),\n [optionalFieldsToRequire, redaction.ssnRedacted, redaction.einRedacted],\n )\n\n const defaultValues = useMemo<ContractorSignatureFormData>(\n () => (document ? buildW9Defaults(document) : EMPTY_W9_DEFAULTS),\n [document],\n )\n\n const formMethods = useForm<ContractorSignatureFormData, unknown, ContractorSignatureFormOutputs>(\n {\n resolver: zodResolver(schema),\n mode: validationMode,\n shouldFocusError,\n defaultValues,\n values: defaultValues,\n resetOptions: { keepDirtyValues: true },\n },\n )\n\n const watchedClassification = useWatch({\n control: formMethods.control,\n name: 'taxClassification',\n })\n const Fields = useMemo(\n () => buildFields(presentFieldNames, watchedClassification),\n [presentFieldNames, watchedClassification],\n )\n\n const baseMetadata = useDeriveFieldsMetadata(metadataConfig, formMethods.control)\n\n const fieldsMetadata = useMemo(\n () =>\n buildContractorSignatureFieldsMetadata(baseMetadata, {\n ssnPlaceholder: redaction.ssnPlaceholder,\n einPlaceholder: redaction.einPlaceholder,\n }),\n [baseMetadata, redaction],\n )\n\n const signMutation = useContractorDocumentsSignMutation()\n const isPending = signMutation.isPending\n\n const {\n baseSubmitHandler,\n error: submitError,\n setError: setSubmitError,\n } = useBaseSubmit('ContractorSignatureForm')\n\n const errorHandling = composeErrorHandler([documentQuery], { submitError, setSubmitError })\n\n const onSubmit = async (): Promise<HookSubmitResult<DocumentSigned> | undefined> => {\n let submitResult: HookSubmitResult<DocumentSigned> | undefined\n\n await new Promise<void>(resolve => {\n void formMethods.handleSubmit(\n async (data: ContractorSignatureFormOutputs) => {\n await baseSubmitHandler(data, async payload => {\n if (!document) {\n throw new SDKInternalError('Document must be loaded before signing')\n }\n\n const result = await signMutation.mutateAsync({\n request: {\n documentUuid,\n requestBody: {\n fields: serializeW9Fields(document, payload, redaction),\n agree: payload.agree,\n // The signing IP is supplied by the partner proxy via the\n // `x-gusto-client-ip` header; send an empty body value to\n // match the employee/company sign flows.\n signedByIpAddress: '',\n },\n },\n })\n\n const signedDocument = result.documentSigned\n\n if (!signedDocument) {\n throw new SDKInternalError('Contractor document signing failed')\n }\n\n submitResult = { mode: 'create', data: signedDocument }\n })\n resolve()\n },\n () => {\n resolve()\n },\n )()\n })\n\n return submitResult\n }\n\n const hookFormInternals = useHookFormInternals(formMethods)\n\n if (documentQuery.isLoading || !document) {\n return { isLoading: true, errorHandling }\n }\n\n return {\n isLoading: false,\n data: {\n document,\n pdfUrl: pdfQuery.data?.documentPdf?.documentUrl ?? null,\n hasFields: presentFieldNames.size > 0,\n },\n status: { isPending, mode: 'create' },\n actions: { onSubmit },\n errorHandling,\n form: {\n Fields,\n fieldsMetadata,\n hookFormInternals,\n getFormSubmissionValues: createGetFormSubmissionValues(formMethods, schema),\n },\n }\n}\n"],"names":["buildFields","presentFieldNames","classification","NameField","TaxClassificationField","HomeAddressStreet1Field","HomeAddressCityField","HomeAddressStateField","HomeAddressZipField","SsnField","EinField","SignatureTextField","AgreeField","BusinessNameField","LLC_CLASSIFICATION_OPTION","LlcClassificationCodeField","OTHER_CLASSIFICATION_OPTION","OtherTextField","ForeignPartnersField","ExemptPayeeCodeField","ExemptionFromFatcaField","HomeAddressStreet2Field","AccountNumberField","CompanyNameField","buildContractorSignatureFieldsMetadata","base","ssnPlaceholder","einPlaceholder","taxClassificationOptions","TAX_CLASSIFICATION_OPTION_KEYS","key","llcClassificationOptions","LLC_CLASSIFICATION_CODES","code","withOptions","withFlags","useContractorSignatureForm","documentUuid","validationMode","shouldFocusError","optionalFieldsToRequire","documentQuery","useContractorDocumentsGet","pdfQuery","useContractorDocumentsGetPdf","document","useMemo","getPresentFieldNames","redaction","getRedactionState","schema","metadataConfig","createContractorSignatureFormSchema","defaultValues","buildW9Defaults","EMPTY_W9_DEFAULTS","formMethods","useForm","zodResolver","watchedClassification","useWatch","Fields","baseMetadata","useDeriveFieldsMetadata","fieldsMetadata","signMutation","useContractorDocumentsSignMutation","isPending","baseSubmitHandler","submitError","setSubmitError","useBaseSubmit","errorHandling","composeErrorHandler","onSubmit","submitResult","resolve","data","payload","SDKInternalError","signedDocument","serializeW9Fields","hookFormInternals","useHookFormInternals","createGetFormSubmissionValues"],"mappings":";;;;;;;;;;;;;;;;;AAuIA,SAASA,GACPC,GACAC,GACwC;AACxC,SAAO;AAAA;AAAA;AAAA,IAGL,MAAMD,EAAkB,IAA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GAAaN,CAAM;AAAA,IAAA;AAAA,EAC5E;AAEJ;"}
1
+ {"version":3,"file":"useContractorSignatureForm.js","sources":["../../../../../../src/components/Contractor/Documents/SignatureForm/useContractorSignatureForm/useContractorSignatureForm.tsx"],"sourcesContent":["import { useMemo } from 'react'\nimport { useForm, useWatch } from 'react-hook-form'\nimport type { UseFormProps } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport type { Document } from '@gusto/embedded-api/models/components/document'\nimport type { DocumentSigned } from '@gusto/embedded-api/models/components/documentsigned'\nimport { useContractorDocumentsGet } from '@gusto/embedded-api/react-query/contractorDocumentsGet'\nimport { useContractorDocumentsGetPdf } from '@gusto/embedded-api/react-query/contractorDocumentsGetPdf'\nimport { useContractorDocumentsSignMutation } from '@gusto/embedded-api/react-query/contractorDocumentsSign'\nimport {\n buildW9Defaults,\n getPresentFieldNames,\n getRedactionState,\n serializeW9Fields,\n EMPTY_W9_DEFAULTS,\n NOT_APPLICABLE_VALUE,\n TAX_CLASSIFICATION_OPTION_KEYS,\n LLC_CLASSIFICATION_CODES,\n LLC_CLASSIFICATION_OPTION,\n OTHER_CLASSIFICATION_OPTION,\n type W9RedactionState,\n} from './w9Fields'\nimport {\n createContractorSignatureFormSchema,\n type ContractorSignatureFormData,\n type ContractorSignatureFormOutputs,\n type ContractorSignatureOptionalFieldsToRequire,\n} from './contractorSignatureFormSchema'\nimport {\n NameField,\n TaxClassificationField,\n HomeAddressStreet1Field,\n HomeAddressCityField,\n HomeAddressStateField,\n HomeAddressZipField,\n SsnField,\n EinField,\n SignatureTextField,\n AgreeField,\n BusinessNameField,\n LlcClassificationCodeField,\n OtherTextField,\n ForeignPartnersField,\n ExemptPayeeCodeField,\n ExemptionFromFatcaField,\n HomeAddressStreet2Field,\n AccountNumberField,\n CompanyNameField,\n type ContractorSignatureFormFieldComponents,\n} from './fields'\nimport { useDeriveFieldsMetadata } from '@/partner-hook-utils/form/useDeriveFieldsMetadata'\nimport { withOptions } from '@/partner-hook-utils/form/withOptions'\nimport { withFlags } from '@/partner-hook-utils/form/withFlags'\nimport { useHookFormInternals } from '@/partner-hook-utils/form/useHookFormInternals'\nimport { createGetFormSubmissionValues } from '@/partner-hook-utils/form/getFormSubmissionValues'\nimport { composeErrorHandler } from '@/partner-hook-utils/composeErrorHandler'\nimport type {\n BaseFormHookReady,\n FieldMetadata,\n FieldsMetadata,\n HookLoadingResult,\n HookSubmitResult,\n} from '@/partner-hook-utils/types'\nimport { useBaseSubmit } from '@/components/Base/useBaseSubmit'\nimport { SDKInternalError } from '@/types/sdkError'\n\n/**\n * Props for {@link useContractorSignatureForm}.\n *\n * @public\n */\nexport interface UseContractorSignatureFormProps {\n /** UUID of the contractor document to sign. */\n documentUuid: string\n /** When validation runs. Passed through to react-hook-form; defaults to `'onSubmit'`. */\n validationMode?: UseFormProps['mode']\n /** Auto-focus the first invalid field on submit. Defaults to `true`; set to `false` when using `composeSubmitHandler`. */\n shouldFocusError?: boolean\n /** Promote optional W-9 fields to required (e.g. `{ create: ['businessName'] }`). */\n optionalFieldsToRequire?: ContractorSignatureOptionalFieldsToRequire\n}\n\n/**\n * Ready-state shape returned by {@link useContractorSignatureForm} once the\n * document metadata has loaded.\n *\n * @public\n */\nexport interface UseContractorSignatureFormReady extends BaseFormHookReady<\n ContractorSignatureFieldsMetadata,\n ContractorSignatureFormData,\n ContractorSignatureFormFieldComponents\n> {\n /** Loaded data — the document being signed and a downloadable PDF URL. */\n data: {\n /** The document entity fetched from the API. */\n document: Document\n /** URL to the document's PDF, or `null` when unavailable. */\n pdfUrl: string | null\n /** Whether the document carries signable fields (vs. acknowledge-only). */\n hasFields: boolean\n }\n /** Submit-state flags. */\n status: {\n /** `true` while the sign mutation is in flight. */\n isPending: boolean\n /** Always `'create'`; the hook always submits as a signing operation. */\n mode: 'create'\n }\n /** Imperative actions exposed by the hook. */\n actions: {\n /** Validates the form and submits the signature. Resolves with the signed document on success, or `undefined` on validation or API failure. */\n onSubmit: () => Promise<HookSubmitResult<DocumentSigned> | undefined>\n }\n}\n\n/**\n * Result of {@link useContractorSignatureForm} — a discriminated union on `isLoading`.\n *\n * @public\n */\nexport type UseContractorSignatureFormResult = HookLoadingResult | UseContractorSignatureFormReady\n\n/**\n * Per-field metadata exposed by {@link useContractorSignatureForm} as `form.fieldsMetadata`.\n *\n * @remarks\n * Extracted from the ready-state result for standalone use when a partner needs\n * to type-check or reference the metadata shape independently.\n *\n * @public\n */\nexport type ContractorSignatureFieldsMetadata = ReturnType<\n typeof buildContractorSignatureFieldsMetadata\n>\n\nfunction buildFields(\n presentFieldNames: Set<string>,\n classification: string,\n defaultValues: ContractorSignatureFormData,\n): ContractorSignatureFormFieldComponents {\n return {\n // Every field is presence-gated to guard against the document API diverging\n // (dropping or renaming a field) — only `Agree` is synthesized and always on.\n Name: presentFieldNames.has('name') ? NameField : undefined,\n TaxClassification: presentFieldNames.has('taxClassification')\n ? TaxClassificationField\n : undefined,\n HomeAddressStreet1: presentFieldNames.has('homeAddressStreet1')\n ? HomeAddressStreet1Field\n : undefined,\n HomeAddressCity: presentFieldNames.has('homeAddressCity') ? HomeAddressCityField : undefined,\n HomeAddressState: presentFieldNames.has('homeAddressState') ? HomeAddressStateField : undefined,\n HomeAddressZip: presentFieldNames.has('homeAddressZip') ? HomeAddressZipField : undefined,\n // The non-applicable TIN (an individual's EIN, a business's SSN) arrives as\n // the `N/A` sentinel and is never rendered, while its `N/A` default stays in\n // form state and still serializes onto the W-9.\n Ssn:\n presentFieldNames.has('ssn') && defaultValues.ssn !== NOT_APPLICABLE_VALUE\n ? SsnField\n : undefined,\n Ein:\n presentFieldNames.has('ein') && defaultValues.ein !== NOT_APPLICABLE_VALUE\n ? EinField\n : undefined,\n SignatureText: presentFieldNames.has('signatureText') ? SignatureTextField : undefined,\n Agree: AgreeField,\n BusinessName: presentFieldNames.has('businessName') ? BusinessNameField : undefined,\n // Revealed only while the LLC classification is selected (and the document\n // carries classification checkboxes).\n LlcClassificationCode:\n presentFieldNames.has('llcClassificationCode') && classification === LLC_CLASSIFICATION_OPTION\n ? LlcClassificationCodeField\n : undefined,\n // Revealed only while the \"Other\" classification is selected.\n OtherText:\n presentFieldNames.has('otherText') && classification === OTHER_CLASSIFICATION_OPTION\n ? OtherTextField\n : undefined,\n ForeignPartners: presentFieldNames.has('foreignPartners') ? ForeignPartnersField : undefined,\n ExemptPayeeCode: presentFieldNames.has('exemptPayeeCode') ? ExemptPayeeCodeField : undefined,\n ExemptionFromFatca: presentFieldNames.has('exemptionFromFatca')\n ? ExemptionFromFatcaField\n : undefined,\n HomeAddressStreet2: presentFieldNames.has('homeAddressStreet2')\n ? HomeAddressStreet2Field\n : undefined,\n AccountNumber: presentFieldNames.has('accountNumber') ? AccountNumberField : undefined,\n CompanyName: presentFieldNames.has('companyName') ? CompanyNameField : undefined,\n }\n}\n\n/** @internal */\nfunction buildContractorSignatureFieldsMetadata(\n base: Record<keyof ContractorSignatureFormData, FieldMetadata>,\n { ssnPlaceholder, einPlaceholder }: { ssnPlaceholder?: string; einPlaceholder?: string },\n) {\n const taxClassificationOptions = TAX_CLASSIFICATION_OPTION_KEYS.map(key => ({\n value: key,\n label: key,\n }))\n const llcClassificationOptions = LLC_CLASSIFICATION_CODES.map(code => ({\n value: code,\n label: code,\n }))\n\n return {\n name: base.name,\n businessName: base.businessName,\n taxClassification: withOptions(base.taxClassification, taxClassificationOptions, [\n ...TAX_CLASSIFICATION_OPTION_KEYS,\n ]),\n llcClassificationCode: withOptions(base.llcClassificationCode, llcClassificationOptions, [\n ...LLC_CLASSIFICATION_CODES,\n ]),\n otherText: base.otherText,\n foreignPartners: base.foreignPartners,\n exemptPayeeCode: base.exemptPayeeCode,\n exemptionFromFatca: base.exemptionFromFatca,\n homeAddressStreet1: base.homeAddressStreet1,\n homeAddressStreet2: base.homeAddressStreet2,\n homeAddressCity: base.homeAddressCity,\n homeAddressState: base.homeAddressState,\n homeAddressZip: base.homeAddressZip,\n accountNumber: base.accountNumber,\n companyName: base.companyName,\n // The masked value drives the redacted SSN/EIN placeholder. `buildFormSchema`\n // already set `hasRedactedValue` and exempted the field from required validation.\n ssn: withFlags(base.ssn, ssnPlaceholder ? { placeholder: ssnPlaceholder } : {}),\n ein: withFlags(base.ein, einPlaceholder ? { placeholder: einPlaceholder } : {}),\n signatureText: base.signatureText,\n agree: base.agree,\n } satisfies FieldsMetadata\n}\n\n/**\n * Headless hook for signing a contractor document — collects the document's\n * fields plus a typed signature and consent.\n *\n * @remarks\n * This hook implements the W-9 — the only signable contractor document the API\n * exposes today (`taxpayer_identification_form_w_9`). The field surface is\n * declared statically (`form.Fields`), like the other SDK form hooks: core\n * fields are always present, while variable fields are exposed only when the API\n * returns them (otherwise `undefined`) — a presence-based safety check, so a\n * field the API drops is skipped rather than rendered as an orphan. The seven\n * federal tax-classification checkboxes are collapsed into a single required\n * radio group with conditional LLC-code and \"Other\" sub-fields, and on submit\n * the selection is mapped back to the W-9 wire format. Pre-filled values (name,\n * address, TIN, etc.) are editable inputs; the signing `date` is omitted so the\n * API auto-fills it. A document that returns no recognized W-9 fields renders\n * as acknowledge-only (`data.hasFields` is `false`). Consult\n * `form.fieldsMetadata` for per-field required flags and select/radio options.\n *\n * @param props - See {@link UseContractorSignatureFormProps}.\n * @returns A {@link HookLoadingResult} while loading, or a {@link UseContractorSignatureFormReady} once loaded.\n * @public\n *\n * @example\n * ```tsx\n * import {\n * useContractorSignatureForm,\n * SDKFormProvider,\n * type UseContractorSignatureFormReady,\n * } from '@gusto/embedded-react-sdk'\n *\n * function SignDocumentPage({ documentId }: { documentId: string }) {\n * const signatureForm = useContractorSignatureForm({ documentId })\n *\n * if (signatureForm.isLoading) return <div>Loading...</div>\n *\n * return <SignDocumentReady signatureForm={signatureForm} />\n * }\n *\n * function SignDocumentReady({\n * signatureForm,\n * }: {\n * signatureForm: UseContractorSignatureFormReady\n * }) {\n * const { Fields } = signatureForm.form\n *\n * const handleSubmit = async () => {\n * await signatureForm.actions.onSubmit()\n * }\n *\n * return (\n * <SDKFormProvider {...signatureForm.form.methods}>\n * {Fields.Name ? <Fields.Name /> : null}\n * {Fields.SignatureText ? <Fields.SignatureText /> : null}\n * <Fields.Agree />\n * <button onClick={handleSubmit}>Sign</button>\n * </SDKFormProvider>\n * )\n * }\n * ```\n */\nexport function useContractorSignatureForm({\n documentUuid,\n validationMode = 'onSubmit',\n shouldFocusError = true,\n optionalFieldsToRequire,\n}: UseContractorSignatureFormProps): UseContractorSignatureFormResult {\n const documentQuery = useContractorDocumentsGet({ documentUuid })\n // PDF failures are intentionally excluded from the page error surface; the\n // download link is simply hidden when the URL is unavailable.\n const pdfQuery = useContractorDocumentsGetPdf({ documentUuid })\n\n const document = documentQuery.data?.document\n\n const presentFieldNames = useMemo(\n () => (document ? getPresentFieldNames(document) : new Set<string>()),\n [document],\n )\n const redaction = useMemo<W9RedactionState>(\n () => (document ? getRedactionState(document) : { ssnRedacted: false, einRedacted: false }),\n [document],\n )\n const [schema, metadataConfig] = useMemo(\n () =>\n createContractorSignatureFormSchema({\n optionalFieldsToRequire,\n ssnRedacted: redaction.ssnRedacted,\n einRedacted: redaction.einRedacted,\n }),\n [optionalFieldsToRequire, redaction.ssnRedacted, redaction.einRedacted],\n )\n\n const defaultValues = useMemo<ContractorSignatureFormData>(\n () => (document ? buildW9Defaults(document) : EMPTY_W9_DEFAULTS),\n [document],\n )\n\n const formMethods = useForm<ContractorSignatureFormData, unknown, ContractorSignatureFormOutputs>(\n {\n resolver: zodResolver(schema),\n mode: validationMode,\n shouldFocusError,\n defaultValues,\n values: defaultValues,\n resetOptions: { keepDirtyValues: true },\n },\n )\n\n const watchedClassification = useWatch({\n control: formMethods.control,\n name: 'taxClassification',\n })\n const Fields = useMemo(\n () => buildFields(presentFieldNames, watchedClassification, defaultValues),\n [presentFieldNames, watchedClassification, defaultValues],\n )\n\n const baseMetadata = useDeriveFieldsMetadata(metadataConfig, formMethods.control)\n\n const fieldsMetadata = useMemo(\n () =>\n buildContractorSignatureFieldsMetadata(baseMetadata, {\n ssnPlaceholder: redaction.ssnPlaceholder,\n einPlaceholder: redaction.einPlaceholder,\n }),\n [baseMetadata, redaction],\n )\n\n const signMutation = useContractorDocumentsSignMutation()\n const isPending = signMutation.isPending\n\n const {\n baseSubmitHandler,\n error: submitError,\n setError: setSubmitError,\n } = useBaseSubmit('ContractorSignatureForm')\n\n const errorHandling = composeErrorHandler([documentQuery], { submitError, setSubmitError })\n\n const onSubmit = async (): Promise<HookSubmitResult<DocumentSigned> | undefined> => {\n let submitResult: HookSubmitResult<DocumentSigned> | undefined\n\n await new Promise<void>(resolve => {\n void formMethods.handleSubmit(\n async (data: ContractorSignatureFormOutputs) => {\n await baseSubmitHandler(data, async payload => {\n if (!document) {\n throw new SDKInternalError('Document must be loaded before signing')\n }\n\n const result = await signMutation.mutateAsync({\n request: {\n documentUuid,\n requestBody: {\n fields: serializeW9Fields(document, payload, redaction),\n agree: payload.agree,\n // The signing IP is supplied by the partner proxy via the\n // `x-gusto-client-ip` header; send an empty body value to\n // match the employee/company sign flows.\n signedByIpAddress: '',\n },\n },\n })\n\n const signedDocument = result.documentSigned\n\n if (!signedDocument) {\n throw new SDKInternalError('Contractor document signing failed')\n }\n\n submitResult = { mode: 'create', data: signedDocument }\n })\n resolve()\n },\n () => {\n resolve()\n },\n )()\n })\n\n return submitResult\n }\n\n const hookFormInternals = useHookFormInternals(formMethods)\n\n if (documentQuery.isLoading || !document) {\n return { isLoading: true, errorHandling }\n }\n\n return {\n isLoading: false,\n data: {\n document,\n pdfUrl: pdfQuery.data?.documentPdf?.documentUrl ?? null,\n hasFields: presentFieldNames.size > 0,\n },\n status: { isPending, mode: 'create' },\n actions: { onSubmit },\n errorHandling,\n form: {\n Fields,\n fieldsMetadata,\n hookFormInternals,\n getFormSubmissionValues: createGetFormSubmissionValues(formMethods, schema),\n },\n }\n}\n"],"names":["buildFields","presentFieldNames","classification","defaultValues","NameField","TaxClassificationField","HomeAddressStreet1Field","HomeAddressCityField","HomeAddressStateField","HomeAddressZipField","NOT_APPLICABLE_VALUE","SsnField","EinField","SignatureTextField","AgreeField","BusinessNameField","LLC_CLASSIFICATION_OPTION","LlcClassificationCodeField","OTHER_CLASSIFICATION_OPTION","OtherTextField","ForeignPartnersField","ExemptPayeeCodeField","ExemptionFromFatcaField","HomeAddressStreet2Field","AccountNumberField","CompanyNameField","buildContractorSignatureFieldsMetadata","base","ssnPlaceholder","einPlaceholder","taxClassificationOptions","TAX_CLASSIFICATION_OPTION_KEYS","key","llcClassificationOptions","LLC_CLASSIFICATION_CODES","code","withOptions","withFlags","useContractorSignatureForm","documentUuid","validationMode","shouldFocusError","optionalFieldsToRequire","documentQuery","useContractorDocumentsGet","pdfQuery","useContractorDocumentsGetPdf","document","useMemo","getPresentFieldNames","redaction","getRedactionState","schema","metadataConfig","createContractorSignatureFormSchema","buildW9Defaults","EMPTY_W9_DEFAULTS","formMethods","useForm","zodResolver","watchedClassification","useWatch","Fields","baseMetadata","useDeriveFieldsMetadata","fieldsMetadata","signMutation","useContractorDocumentsSignMutation","isPending","baseSubmitHandler","submitError","setSubmitError","useBaseSubmit","errorHandling","composeErrorHandler","onSubmit","submitResult","resolve","data","payload","SDKInternalError","signedDocument","serializeW9Fields","hookFormInternals","useHookFormInternals","createGetFormSubmissionValues"],"mappings":";;;;;;;;;;;;;;;;;AAwIA,SAASA,GACPC,GACAC,GACAC,GACwC;AACxC,SAAO;AAAA;AAAA;AAAA,IAGL,MAAMF,EAAkB,IAAI,MAAM,IAAIG,KAAY;AAAA,IAClD,mBAAmBH,EAAkB,IAAI,mBAAmB,IACxDI,KACA;AAAA,IACJ,oBAAoBJ,EAAkB,IAAI,oBAAoB,IAC1DK,KACA;AAAA,IACJ,iBAAiBL,EAAkB,IAAI,iBAAiB,IAAIM,KAAuB;AAAA,IACnF,kBAAkBN,EAAkB,IAAI,kBAAkB,IAAIO,KAAwB;AAAA,IACtF,gBAAgBP,EAAkB,IAAI,gBAAgB,IAAIQ,KAAsB;AAAA;AAAA;AAAA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