@gusto/embedded-react-sdk 0.10.7-rc.2 → 0.11.0-rc.1

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 (135) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/components/Common/HamburgerMenu/HamburgerMenu.js +20 -19
  3. package/dist/components/Common/HamburgerMenu/HamburgerMenu.js.map +1 -1
  4. package/dist/components/Common/ReorderableList/ReorderableItem.js +1 -1
  5. package/dist/components/Common/ReorderableList/ReorderableItem.js.map +1 -1
  6. package/dist/components/Common/UI/Button/Button.d.ts +1 -1
  7. package/dist/components/Common/UI/Button/Button.js +4 -4
  8. package/dist/components/Common/UI/Button/Button.js.map +1 -1
  9. package/dist/components/Common/UI/Button/ButtonTypes.d.ts +1 -1
  10. package/dist/components/Company/AssignSignatory/AssignSignatory.d.ts +0 -5
  11. package/dist/components/Company/AssignSignatory/AssignSignatory.js +39 -42
  12. package/dist/components/Company/AssignSignatory/AssignSignatory.js.map +1 -1
  13. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.d.ts +0 -4
  14. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js +51 -53
  15. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js.map +1 -1
  16. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.d.ts +0 -4
  17. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js +40 -42
  18. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js.map +1 -1
  19. package/dist/components/Company/AssignSignatory/index.d.ts +0 -1
  20. package/dist/components/Company/BankAccount/BankAccount.d.ts +0 -5
  21. package/dist/components/Company/BankAccount/BankAccount.js +17 -23
  22. package/dist/components/Company/BankAccount/BankAccount.js.map +1 -1
  23. package/dist/components/Company/BankAccount/BankAccountForm/BankAccountForm.d.ts +0 -5
  24. package/dist/components/Company/BankAccount/BankAccountForm/BankAccountForm.js +28 -31
  25. package/dist/components/Company/BankAccount/BankAccountForm/BankAccountForm.js.map +1 -1
  26. package/dist/components/Company/BankAccount/BankAccountList/BankAccountList.d.ts +0 -5
  27. package/dist/components/Company/BankAccount/BankAccountList/BankAccountList.js +25 -28
  28. package/dist/components/Company/BankAccount/BankAccountList/BankAccountList.js.map +1 -1
  29. package/dist/components/Company/BankAccount/BankAccountVerify/BankAccountVerify.d.ts +0 -5
  30. package/dist/components/Company/BankAccount/BankAccountVerify/BankAccountVerify.js +33 -36
  31. package/dist/components/Company/BankAccount/BankAccountVerify/BankAccountVerify.js.map +1 -1
  32. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.d.ts +0 -6
  33. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js +37 -41
  34. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  35. package/dist/components/Company/DocumentSigner/DocumentSigner.d.ts +0 -4
  36. package/dist/components/Company/DocumentSigner/DocumentSigner.js +23 -26
  37. package/dist/components/Company/DocumentSigner/DocumentSigner.js.map +1 -1
  38. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.d.ts +0 -6
  39. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js +40 -44
  40. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
  41. package/dist/components/Company/Industry/Industry.d.ts +0 -5
  42. package/dist/components/Company/Industry/Industry.js +23 -29
  43. package/dist/components/Company/Industry/Industry.js.map +1 -1
  44. package/dist/components/Company/Locations/LocationForm/LocationForm.d.ts +0 -5
  45. package/dist/components/Company/Locations/LocationForm/LocationForm.js +41 -44
  46. package/dist/components/Company/Locations/LocationForm/LocationForm.js.map +1 -1
  47. package/dist/components/Company/Locations/Locations.d.ts +0 -4
  48. package/dist/components/Company/Locations/Locations.js +14 -18
  49. package/dist/components/Company/Locations/Locations.js.map +1 -1
  50. package/dist/components/Company/Locations/LocationsList/LocationsList.d.ts +0 -5
  51. package/dist/components/Company/Locations/LocationsList/LocationsList.js +28 -31
  52. package/dist/components/Company/Locations/LocationsList/LocationsList.js.map +1 -1
  53. package/dist/components/Company/PaySchedule/PaySchedule.d.ts +1 -7
  54. package/dist/components/Company/PaySchedule/PaySchedule.js +67 -71
  55. package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
  56. package/dist/components/Company/StateTaxes/StateTaxes.d.ts +0 -4
  57. package/dist/components/Company/StateTaxes/StateTaxes.js +39 -22
  58. package/dist/components/Company/StateTaxes/StateTaxes.js.map +1 -1
  59. package/dist/components/Company/StateTaxes/StateTaxesComponents.d.ts +8 -6
  60. package/dist/components/Company/StateTaxes/StateTaxesComponents.js +16 -15
  61. package/dist/components/Company/StateTaxes/StateTaxesComponents.js.map +1 -1
  62. package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.d.ts +0 -5
  63. package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js +44 -47
  64. package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js.map +1 -1
  65. package/dist/components/Company/StateTaxes/StateTaxesList/StateTaxesList.d.ts +0 -5
  66. package/dist/components/Company/StateTaxes/StateTaxesList/StateTaxesList.js +26 -29
  67. package/dist/components/Company/StateTaxes/StateTaxesList/StateTaxesList.js.map +1 -1
  68. package/dist/components/Company/StateTaxes/stateTaxesReducer.d.ts +20 -0
  69. package/dist/components/Company/StateTaxes/stateTaxesReducer.js +40 -0
  70. package/dist/components/Company/StateTaxes/stateTaxesReducer.js.map +1 -0
  71. package/dist/components/Contractor/Address/Address.d.ts +0 -5
  72. package/dist/components/Contractor/Address/Address.js +35 -38
  73. package/dist/components/Contractor/Address/Address.js.map +1 -1
  74. package/dist/components/Contractor/Profile/ContractorProfile.d.ts +11 -0
  75. package/dist/components/Contractor/Profile/ContractorProfile.js +24 -0
  76. package/dist/components/Contractor/Profile/ContractorProfile.js.map +1 -0
  77. package/dist/components/Contractor/Profile/ContractorProfileForm.d.ts +5 -0
  78. package/dist/components/Contractor/Profile/ContractorProfileForm.js +140 -0
  79. package/dist/components/Contractor/Profile/ContractorProfileForm.js.map +1 -0
  80. package/dist/components/Contractor/Profile/index.d.ts +3 -0
  81. package/dist/components/Contractor/Profile/useContractorProfile.d.ts +254 -0
  82. package/dist/components/Contractor/Profile/useContractorProfile.js +223 -0
  83. package/dist/components/Contractor/Profile/useContractorProfile.js.map +1 -0
  84. package/dist/components/Contractor/Submit/ContractorSubmitWithApi.d.ts +6 -0
  85. package/dist/components/Contractor/Submit/ContractorSubmitWithApi.js +27 -0
  86. package/dist/components/Contractor/Submit/ContractorSubmitWithApi.js.map +1 -0
  87. package/dist/components/Contractor/Submit/SubmitDone.d.ts +5 -0
  88. package/dist/components/Contractor/Submit/SubmitDone.js +18 -0
  89. package/dist/components/Contractor/Submit/SubmitDone.js.map +1 -0
  90. package/dist/components/Contractor/Submit/index.d.ts +6 -0
  91. package/dist/components/Contractor/Submit/index.js +18 -0
  92. package/dist/components/Contractor/Submit/index.js.map +1 -0
  93. package/dist/components/Contractor/Submit/index.module.scss.js +8 -0
  94. package/dist/components/Contractor/Submit/index.module.scss.js.map +1 -0
  95. package/dist/components/Contractor/index.d.ts +2 -0
  96. package/dist/components/Contractor/index.js +10 -6
  97. package/dist/components/Contractor/index.js.map +1 -1
  98. package/dist/components/Employee/Compensation/Compensation.d.ts +0 -6
  99. package/dist/components/Employee/Compensation/Compensation.js +97 -102
  100. package/dist/components/Employee/Compensation/Compensation.js.map +1 -1
  101. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.d.ts +0 -5
  102. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js +25 -28
  103. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  104. package/dist/components/Employee/DocumentSigner/DocumentSigner.d.ts +1 -7
  105. package/dist/components/Employee/DocumentSigner/DocumentSigner.js +16 -20
  106. package/dist/components/Employee/DocumentSigner/DocumentSigner.js.map +1 -1
  107. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.d.ts +0 -7
  108. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js +40 -44
  109. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
  110. package/dist/components/Employee/EmployeeList/EmployeeList.d.ts +0 -5
  111. package/dist/components/Employee/EmployeeList/EmployeeList.js +56 -59
  112. package/dist/components/Employee/EmployeeList/EmployeeList.js.map +1 -1
  113. package/dist/components/Employee/Profile/AdminPersonalDetails.d.ts +3 -3
  114. package/dist/components/Employee/Profile/PersonalDetailsInputs.d.ts +2 -2
  115. package/dist/components/Employee/Profile/Profile.d.ts +0 -8
  116. package/dist/components/Employee/Profile/Profile.js +131 -138
  117. package/dist/components/Employee/Profile/Profile.js.map +1 -1
  118. package/dist/components/Employee/Taxes/Taxes.d.ts +0 -6
  119. package/dist/components/Employee/Taxes/Taxes.js +76 -81
  120. package/dist/components/Employee/Taxes/Taxes.js.map +1 -1
  121. package/dist/i18n/I18n.js +1 -1
  122. package/dist/i18n/I18n.js.map +1 -1
  123. package/dist/i18n/en/Contractor.ContractorSubmit.json.js +22 -0
  124. package/dist/i18n/en/Contractor.ContractorSubmit.json.js.map +1 -0
  125. package/dist/i18n/en/Contractor.Profile.json.js +73 -0
  126. package/dist/i18n/en/Contractor.Profile.json.js.map +1 -0
  127. package/dist/shared/constants.d.ts +14 -0
  128. package/dist/shared/constants.js +33 -26
  129. package/dist/shared/constants.js.map +1 -1
  130. package/dist/style.css +1 -1
  131. package/dist/types/i18next.d.ts +77 -1
  132. package/package.json +2 -2
  133. package/dist/components/Company/StateTaxes/stateTaxesStateMachine.d.ts +0 -5
  134. package/dist/components/Company/StateTaxes/stateTaxesStateMachine.js +0 -48
  135. package/dist/components/Company/StateTaxes/stateTaxesStateMachine.js.map +0 -1
@@ -0,0 +1,40 @@
1
+ import { componentEvents as t } from "../../../shared/constants.js";
2
+ const T = {
3
+ state: "viewStateTaxes",
4
+ selectedState: void 0
5
+ };
6
+ function d(e, a) {
7
+ switch (a.type) {
8
+ case t.COMPANY_STATE_TAX_EDIT:
9
+ return {
10
+ ...e,
11
+ state: "editStateTaxes",
12
+ selectedState: a.payload.state
13
+ };
14
+ case t.COMPANY_STATE_TAX_UPDATED:
15
+ return {
16
+ ...e,
17
+ state: "viewStateTaxes",
18
+ selectedState: void 0
19
+ };
20
+ case t.CANCEL:
21
+ return {
22
+ ...e,
23
+ state: "viewStateTaxes",
24
+ selectedState: void 0
25
+ };
26
+ case t.COMPANY_STATE_TAX_DONE:
27
+ return {
28
+ ...e,
29
+ state: "done",
30
+ selectedState: void 0
31
+ };
32
+ default:
33
+ return e;
34
+ }
35
+ }
36
+ export {
37
+ T as initialState,
38
+ d as stateTaxesReducer
39
+ };
40
+ //# sourceMappingURL=stateTaxesReducer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stateTaxesReducer.js","sources":["../../../../src/components/Company/StateTaxes/stateTaxesReducer.ts"],"sourcesContent":["import { componentEvents } from '@/shared/constants'\n\nexport type StateTaxesState = 'viewStateTaxes' | 'editStateTaxes' | 'done'\n\nexport interface StateTaxesStateData {\n state: StateTaxesState\n selectedState?: string\n}\n\nexport type StateTaxesAction =\n | { type: typeof componentEvents.COMPANY_STATE_TAX_EDIT; payload: { state: string } }\n | { type: typeof componentEvents.COMPANY_STATE_TAX_UPDATED }\n | { type: typeof componentEvents.COMPANY_STATE_TAX_DONE }\n | { type: typeof componentEvents.CANCEL }\n\nexport const initialState: StateTaxesStateData = {\n state: 'viewStateTaxes',\n selectedState: undefined,\n}\n\nexport function stateTaxesReducer(\n state: StateTaxesStateData,\n action: StateTaxesAction,\n): StateTaxesStateData {\n switch (action.type) {\n case componentEvents.COMPANY_STATE_TAX_EDIT:\n return {\n ...state,\n state: 'editStateTaxes',\n selectedState: action.payload.state,\n }\n\n case componentEvents.COMPANY_STATE_TAX_UPDATED:\n return {\n ...state,\n state: 'viewStateTaxes',\n selectedState: undefined,\n }\n\n case componentEvents.CANCEL:\n return {\n ...state,\n state: 'viewStateTaxes',\n selectedState: undefined,\n }\n\n case componentEvents.COMPANY_STATE_TAX_DONE:\n return {\n ...state,\n state: 'done',\n selectedState: undefined,\n }\n\n default:\n return state\n }\n}\n"],"names":["initialState","stateTaxesReducer","state","action","componentEvents"],"mappings":";AAeO,MAAMA,IAAoC;AAAA,EAC/C,OAAO;AAAA,EACP,eAAe;AACjB;AAEgB,SAAAC,EACdC,GACAC,GACqB;AACrB,UAAQA,EAAO,MAAM;AAAA,IACnB,KAAKC,EAAgB;AACZ,aAAA;AAAA,QACL,GAAGF;AAAA,QACH,OAAO;AAAA,QACP,eAAeC,EAAO,QAAQ;AAAA,MAChC;AAAA,IAEF,KAAKC,EAAgB;AACZ,aAAA;AAAA,QACL,GAAGF;AAAA,QACH,OAAO;AAAA,QACP,eAAe;AAAA,MACjB;AAAA,IAEF,KAAKE,EAAgB;AACZ,aAAA;AAAA,QACL,GAAGF;AAAA,QACH,OAAO;AAAA,QACP,eAAe;AAAA,MACjB;AAAA,IAEF,KAAKE,EAAgB;AACZ,aAAA;AAAA,QACL,GAAGF;AAAA,QACH,OAAO;AAAA,QACP,eAAe;AAAA,MACjB;AAAA,IAEF;AACS,aAAAA;AAAA,EAAA;AAEb;"}
@@ -8,9 +8,4 @@ export interface AddressProps extends BaseComponentInterface<'Contractor.Address
8
8
  className?: string;
9
9
  }
10
10
  export declare function Address(props: AddressProps): import("react/jsx-runtime").JSX.Element;
11
- export declare namespace Address {
12
- var Head: typeof import("./Head").Head;
13
- var Form: typeof import("./Form").Form;
14
- var Actions: typeof import("./Actions").Actions;
15
- }
16
11
  export default Address;
@@ -1,36 +1,36 @@
1
- import { jsx as t, jsxs as E, Fragment as P } from "react/jsx-runtime";
2
- import { useContractorsGetSuspense as T } from "@gusto/embedded-api/react-query/contractorsGet";
3
- import { useContractorsGetAddressSuspense as U } from "@gusto/embedded-api/react-query/contractorsGetAddress";
4
- import { useContractorsUpdateAddressMutation as b } from "@gusto/embedded-api/react-query/contractorsUpdateAddress";
5
- import { useForm as x, FormProvider as O } from "react-hook-form";
6
- import { zodResolver as _ } from "@hookform/resolvers/zod";
7
- import { AddressFormSchema as B, AddressProvider as H } from "./useAddress.js";
8
- import { Head as p } from "./Head.js";
9
- import { Form as u } from "./Form.js";
10
- import { Actions as f } from "./Actions.js";
1
+ import { jsx as t, jsxs as F, Fragment as R } from "react/jsx-runtime";
2
+ import { useContractorsGetSuspense as g } from "@gusto/embedded-api/react-query/contractorsGet";
3
+ import { useContractorsGetAddressSuspense as z } from "@gusto/embedded-api/react-query/contractorsGetAddress";
4
+ import { useContractorsUpdateAddressMutation as E } from "@gusto/embedded-api/react-query/contractorsUpdateAddress";
5
+ import { useForm as P, FormProvider as T } from "react-hook-form";
6
+ import { zodResolver as U } from "@hookform/resolvers/zod";
7
+ import { AddressFormSchema as b, AddressProvider as x } from "./useAddress.js";
8
+ import { Head as O } from "./Head.js";
9
+ import { Form as _ } from "./Form.js";
10
+ import { Actions as B } from "./Actions.js";
11
11
  import { Form as N } from "../../Common/Form/Form.js";
12
12
  import { useComponentDictionary as j, useI18n as q } from "../../../i18n/I18n.js";
13
13
  import { Flex as w } from "../../Common/Flex/Flex.js";
14
14
  import { BaseComponent as G } from "../../Base/Base.js";
15
- import { useBase as M } from "../../Base/useBase.js";
16
- import { contractorEvents as a } from "../../../shared/constants.js";
17
- function n(r) {
18
- return /* @__PURE__ */ t(G, { ...r, children: /* @__PURE__ */ t($, { ...r, children: r.children }) });
15
+ import { useBase as H } from "../../Base/useBase.js";
16
+ import { contractorEvents as d } from "../../../shared/constants.js";
17
+ function st(r) {
18
+ return /* @__PURE__ */ t(G, { ...r, children: /* @__PURE__ */ t(M, { ...r, children: r.children }) });
19
19
  }
20
- function $({ contractorId: r, defaultValues: e, children: i, className: A, dictionary: D }) {
21
- j("Contractor.Address", D), q("Contractor.Address");
22
- const { onEvent: c, baseSubmitHandler: h } = M(), { data: m } = T({ contractorUuid: r }), { data: C } = U({ contractorUuid: r }), { mutateAsync: S, isPending: l } = b(), v = m.contractor, F = m.contractor?.type, o = C.contractorAddress, y = {
20
+ function M({ contractorId: r, defaultValues: e, children: n, className: a, dictionary: p }) {
21
+ j("Contractor.Address", p), q("Contractor.Address");
22
+ const { onEvent: i, baseSubmitHandler: u } = H(), { data: c } = g({ contractorUuid: r }), { data: f } = z({ contractorUuid: r }), { mutateAsync: A, isPending: D } = E(), h = c.contractor, C = c.contractor?.type, o = f.contractorAddress, S = {
23
23
  street1: o?.street1 || e?.street1 || "",
24
24
  street2: o?.street2 || e?.street2 || "",
25
25
  city: o?.city || e?.city || "",
26
26
  state: o?.state || e?.state || "",
27
27
  zip: o?.zip || e?.zip || ""
28
- }, d = x({
29
- resolver: _(B),
30
- defaultValues: y
31
- }), R = async (g) => {
32
- await h(g, async (s) => {
33
- const { contractorAddress: z } = await S({
28
+ }, m = P({
29
+ resolver: U(b),
30
+ defaultValues: S
31
+ }), l = async (v) => {
32
+ await u(v, async (s) => {
33
+ const { contractorAddress: y } = await A({
34
34
  request: {
35
35
  contractorUuid: r,
36
36
  requestBody: {
@@ -43,31 +43,28 @@ function $({ contractorId: r, defaultValues: e, children: i, className: A, dicti
43
43
  }
44
44
  }
45
45
  });
46
- c(a.CONTRACTOR_ADDRESS_UPDATED, z), c(a.CONTRACTOR_ADDRESS_DONE);
46
+ i(d.CONTRACTOR_ADDRESS_UPDATED, y), i(d.CONTRACTOR_ADDRESS_DONE);
47
47
  });
48
48
  };
49
- return /* @__PURE__ */ t("section", { className: A, children: /* @__PURE__ */ t(
50
- H,
49
+ return /* @__PURE__ */ t("section", { className: a, children: /* @__PURE__ */ t(
50
+ x,
51
51
  {
52
52
  value: {
53
- contractor: v,
54
- contractorType: F,
53
+ contractor: h,
54
+ contractorType: C,
55
55
  address: o,
56
- isPending: l
56
+ isPending: D
57
57
  },
58
- children: /* @__PURE__ */ t(O, { ...d, children: /* @__PURE__ */ t(N, { onSubmit: d.handleSubmit(R), children: /* @__PURE__ */ t(w, { flexDirection: "column", gap: 32, children: i || /* @__PURE__ */ E(P, { children: [
59
- /* @__PURE__ */ t(p, {}),
60
- /* @__PURE__ */ t(u, {}),
61
- /* @__PURE__ */ t(f, {})
58
+ children: /* @__PURE__ */ t(T, { ...m, children: /* @__PURE__ */ t(N, { onSubmit: m.handleSubmit(l), children: /* @__PURE__ */ t(w, { flexDirection: "column", gap: 32, children: n || /* @__PURE__ */ F(R, { children: [
59
+ /* @__PURE__ */ t(O, {}),
60
+ /* @__PURE__ */ t(_, {}),
61
+ /* @__PURE__ */ t(B, {})
62
62
  ] }) }) }) })
63
63
  }
64
64
  ) });
65
65
  }
66
- n.Head = p;
67
- n.Form = u;
68
- n.Actions = f;
69
66
  export {
70
- n as Address,
71
- n as default
67
+ st as Address,
68
+ st as default
72
69
  };
73
70
  //# sourceMappingURL=Address.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Address.js","sources":["../../../../src/components/Contractor/Address/Address.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { useContractorsGetSuspense } from '@gusto/embedded-api/react-query/contractorsGet'\nimport { useContractorsGetAddressSuspense } from '@gusto/embedded-api/react-query/contractorsGetAddress'\nimport { useContractorsUpdateAddressMutation } from '@gusto/embedded-api/react-query/contractorsUpdateAddress'\nimport { FormProvider, useForm } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { AddressFormSchema, AddressProvider } from './useAddress'\nimport { Head } from './Head'\nimport { Form } from './Form'\nimport { Actions } from './Actions'\nimport type { AddressDefaultValues, AddressFormValues } from './useAddress'\nimport { Form as HtmlForm } from '@/components/Common/Form/Form'\nimport { useI18n, useComponentDictionary } from '@/i18n'\nimport { Flex } from '@/components/Common'\nimport type { BaseComponentInterface } from '@/components/Base/Base'\nimport { BaseComponent } from '@/components/Base/Base'\nimport { useBase } from '@/components/Base/useBase'\nimport { contractorEvents } from '@/shared/constants'\n\nexport interface AddressProps extends BaseComponentInterface<'Contractor.Address'> {\n contractorId: string\n defaultValues?: AddressDefaultValues\n children?: ReactNode\n className?: string\n}\n\nexport function Address(props: AddressProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ contractorId, defaultValues, children, className, dictionary }: AddressProps) {\n useComponentDictionary('Contractor.Address', dictionary)\n useI18n('Contractor.Address')\n\n const { onEvent, baseSubmitHandler } = useBase()\n\n const { data: contractorData } = useContractorsGetSuspense({ contractorUuid: contractorId })\n const { data: addressData } = useContractorsGetAddressSuspense({ contractorUuid: contractorId })\n\n const { mutateAsync: updateAddress, isPending: isUpdatingAddressPending } =\n useContractorsUpdateAddressMutation()\n\n const contractor = contractorData.contractor\n const contractorType = contractorData.contractor?.type\n const address = addressData.contractorAddress\n\n const formDefaultValues = {\n street1: address?.street1 || defaultValues?.street1 || '',\n street2: address?.street2 || defaultValues?.street2 || '',\n city: address?.city || defaultValues?.city || '',\n state: address?.state || defaultValues?.state || '',\n zip: address?.zip || defaultValues?.zip || '',\n }\n\n const formMethods = useForm<AddressFormValues>({\n resolver: zodResolver(AddressFormSchema),\n defaultValues: formDefaultValues,\n })\n\n const onSubmit = async (data: AddressFormValues) => {\n await baseSubmitHandler(data, async payload => {\n const { contractorAddress } = await updateAddress({\n request: {\n contractorUuid: contractorId,\n requestBody: {\n version: address?.version as string,\n street1: payload.street1,\n street2: payload.street2,\n city: payload.city,\n state: payload.state,\n zip: payload.zip,\n },\n },\n })\n\n onEvent(contractorEvents.CONTRACTOR_ADDRESS_UPDATED, contractorAddress)\n onEvent(contractorEvents.CONTRACTOR_ADDRESS_DONE)\n })\n }\n\n return (\n <section className={className}>\n <AddressProvider\n value={{\n contractor,\n contractorType,\n address,\n isPending: isUpdatingAddressPending,\n }}\n >\n <FormProvider {...formMethods}>\n <HtmlForm onSubmit={formMethods.handleSubmit(onSubmit)}>\n <Flex flexDirection=\"column\" gap={32}>\n {children ? (\n children\n ) : (\n <>\n <Head />\n <Form />\n <Actions />\n </>\n )}\n </Flex>\n </HtmlForm>\n </FormProvider>\n </AddressProvider>\n </section>\n )\n}\n\nAddress.Head = Head\nAddress.Form = Form\nAddress.Actions = Actions\n\nexport default Address\n"],"names":["Address","props","jsx","BaseComponent","Root","contractorId","defaultValues","children","className","dictionary","useComponentDictionary","useI18n","onEvent","baseSubmitHandler","useBase","contractorData","useContractorsGetSuspense","addressData","useContractorsGetAddressSuspense","updateAddress","isUpdatingAddressPending","useContractorsUpdateAddressMutation","contractor","contractorType","address","formDefaultValues","formMethods","useForm","zodResolver","AddressFormSchema","onSubmit","data","payload","contractorAddress","contractorEvents","AddressProvider","FormProvider","HtmlForm","Flex","jsxs","Fragment","Head","Form","Actions"],"mappings":";;;;;;;;;;;;;;;;AA0BO,SAASA,EAAQC,GAAqB;AAEzC,SAAA,gBAAAC,EAACC,GAAe,EAAA,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAMA,EAAA,SAAA,CAAS,EACnC,CAAA;AAEJ;AAEA,SAASG,EAAK,EAAE,cAAAC,GAAc,eAAAC,GAAe,UAAAC,GAAU,WAAAC,GAAW,YAAAC,KAA4B;AAC5F,EAAAC,EAAuB,sBAAsBD,CAAU,GACvDE,EAAQ,oBAAoB;AAE5B,QAAM,EAAE,SAAAC,GAAS,mBAAAC,EAAkB,IAAIC,EAAQ,GAEzC,EAAE,MAAMC,EAAe,IAAIC,EAA0B,EAAE,gBAAgBX,GAAc,GACrF,EAAE,MAAMY,EAAY,IAAIC,EAAiC,EAAE,gBAAgBb,GAAc,GAEzF,EAAE,aAAac,GAAe,WAAWC,EAAA,IAC7CC,EAAoC,GAEhCC,IAAaP,EAAe,YAC5BQ,IAAiBR,EAAe,YAAY,MAC5CS,IAAUP,EAAY,mBAEtBQ,IAAoB;AAAA,IACxB,SAASD,GAAS,WAAWlB,GAAe,WAAW;AAAA,IACvD,SAASkB,GAAS,WAAWlB,GAAe,WAAW;AAAA,IACvD,MAAMkB,GAAS,QAAQlB,GAAe,QA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A;AAAA,IAAA;AAAA,EAAA,GAEJ;AAEJ;AAEA3C,EAAQ,OAAOyC;AACfzC,EAAQ,OAAO0C;AACf1C,EAAQ,UAAU2C;"}
1
+ {"version":3,"file":"Address.js","sources":["../../../../src/components/Contractor/Address/Address.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { useContractorsGetSuspense } from '@gusto/embedded-api/react-query/contractorsGet'\nimport { useContractorsGetAddressSuspense } from '@gusto/embedded-api/react-query/contractorsGetAddress'\nimport { useContractorsUpdateAddressMutation } from '@gusto/embedded-api/react-query/contractorsUpdateAddress'\nimport { FormProvider, useForm } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { AddressFormSchema, AddressProvider } from './useAddress'\nimport { Head } from './Head'\nimport { Form } from './Form'\nimport { Actions } from './Actions'\nimport type { AddressDefaultValues, AddressFormValues } from './useAddress'\nimport { Form as HtmlForm } from '@/components/Common/Form/Form'\nimport { useI18n, useComponentDictionary } from '@/i18n'\nimport { Flex } from '@/components/Common'\nimport type { BaseComponentInterface } from '@/components/Base/Base'\nimport { BaseComponent } from '@/components/Base/Base'\nimport { useBase } from '@/components/Base/useBase'\nimport { contractorEvents } from '@/shared/constants'\n\nexport interface AddressProps extends BaseComponentInterface<'Contractor.Address'> {\n contractorId: string\n defaultValues?: AddressDefaultValues\n children?: ReactNode\n className?: string\n}\n\nexport function Address(props: AddressProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ contractorId, defaultValues, children, className, dictionary }: AddressProps) {\n useComponentDictionary('Contractor.Address', dictionary)\n useI18n('Contractor.Address')\n\n const { onEvent, baseSubmitHandler } = useBase()\n\n const { data: contractorData } = useContractorsGetSuspense({ contractorUuid: contractorId })\n const { data: addressData } = useContractorsGetAddressSuspense({ contractorUuid: contractorId })\n\n const { mutateAsync: updateAddress, isPending: isUpdatingAddressPending } =\n useContractorsUpdateAddressMutation()\n\n const contractor = contractorData.contractor\n const contractorType = contractorData.contractor?.type\n const address = addressData.contractorAddress\n\n const formDefaultValues = {\n street1: address?.street1 || defaultValues?.street1 || '',\n street2: address?.street2 || defaultValues?.street2 || '',\n city: address?.city || defaultValues?.city || '',\n state: address?.state || defaultValues?.state || '',\n zip: address?.zip || defaultValues?.zip || '',\n }\n\n const formMethods = useForm<AddressFormValues>({\n resolver: zodResolver(AddressFormSchema),\n defaultValues: formDefaultValues,\n })\n\n const onSubmit = async (data: AddressFormValues) => {\n await baseSubmitHandler(data, async payload => {\n const { contractorAddress } = await updateAddress({\n request: {\n contractorUuid: contractorId,\n requestBody: {\n version: address?.version as string,\n street1: payload.street1,\n street2: payload.street2,\n city: payload.city,\n state: payload.state,\n zip: payload.zip,\n },\n },\n })\n\n onEvent(contractorEvents.CONTRACTOR_ADDRESS_UPDATED, contractorAddress)\n onEvent(contractorEvents.CONTRACTOR_ADDRESS_DONE)\n })\n }\n\n return (\n <section className={className}>\n <AddressProvider\n value={{\n contractor,\n contractorType,\n address,\n isPending: isUpdatingAddressPending,\n }}\n >\n <FormProvider {...formMethods}>\n <HtmlForm onSubmit={formMethods.handleSubmit(onSubmit)}>\n <Flex flexDirection=\"column\" gap={32}>\n {children ? (\n children\n ) : (\n <>\n <Head />\n <Form />\n <Actions />\n </>\n )}\n </Flex>\n </HtmlForm>\n </FormProvider>\n </AddressProvider>\n </section>\n )\n}\n\nexport default Address\n"],"names":["Address","props","jsx","BaseComponent","Root","contractorId","defaultValues","children","className","dictionary","useComponentDictionary","useI18n","onEvent","baseSubmitHandler","useBase","contractorData","useContractorsGetSuspense","addressData","useContractorsGetAddressSuspense","updateAddress","isUpdatingAddressPending","useContractorsUpdateAddressMutation","contractor","contractorType","address","formDefaultValues","formMethods","useForm","zodResolver","AddressFormSchema","onSubmit","data","payload","contractorAddress","contractorEvents","AddressProvider","FormProvider","HtmlForm","Flex","jsxs","Fragment","Head","Form","Actions"],"mappings":";;;;;;;;;;;;;;;;AA0BO,SAASA,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AAA,YACjB,MAAMA,EAAQ;AAAA,YACd,OAAOA,EAAQ;AAAA,YACf,KAAKA,EAAQ;AAAA,UAAA;AAAA,QACf;AAAA,MACF,CACD;AAEO,MAAApB,EAAAsB,EAAiB,4BAA4BD,CAAiB,GACtErB,EAAQsB,EAAiB,uBAAuB;AAAA,IAAA,CACjD;AAAA,EACH;AAGE,SAAA,gBAAAhC,EAAC,aAAQ,WAAAM,GACP,UAAA,gBAAAN;AAAA,IAACiC;AAAA,IAAA;AAAA,MACC,OAAO;AAAA,QACL,YAAAb;AAAA,QACA,gBAAAC;AAAA,QACA,SAAAC;AAAA,QACA,WAAWJ;AAAA,MACb;AAAA,MAEA,4BAACgB,GAAc,EAAA,GAAGV,GAChB,UAAC,gBAAAxB,EAAAmC,GAAA,EAAS,UAAUX,EAAY,aAAaI,CAAQ,GACnD,UAAA,gBAAA5B,EAACoC,KAAK,eAAc,UAAS,KAAK,IAC/B,UAAA/B,KAIG,gBAAAgC,EAAAC,GAAA,EAAA,UAAA;AAAA,QAAA,gBAAAtC,EAACuC,GAAK,EAAA;AAAA,0BACLC,GAAK,EAAA;AAAA,0BACLC,GAAQ,CAAA,CAAA;AAAA,MAAA,GACX,EAAA,CAEJ,GACF,EACF,CAAA;AAAA,IAAA;AAAA,EAAA,GAEJ;AAEJ;"}
@@ -0,0 +1,11 @@
1
+ import { ContractorType, WageType, UseContractorProfileProps } from './useContractorProfile';
2
+ import { BaseComponentInterface, CommonComponentInterface } from '../../Base/Base';
3
+ interface ContractorProfileProps extends CommonComponentInterface<'Contractor.Profile'> {
4
+ companyId: string;
5
+ contractorId?: string;
6
+ defaultValues?: UseContractorProfileProps['defaultValues'];
7
+ }
8
+ export declare function ContractorProfile(props: ContractorProfileProps & BaseComponentInterface): import("react/jsx-runtime").JSX.Element;
9
+ export { ContractorType, WageType };
10
+ export type { UseContractorProfileProps as ContractorProfileFormData };
11
+ export { ContractorProfileForm } from './ContractorProfileForm';
@@ -0,0 +1,24 @@
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { useContractorProfile as m } from "./useContractorProfile.js";
3
+ import { ContractorType as h, WageType as D } from "./useContractorProfile.js";
4
+ import { ContractorProfileForm as f } from "./ContractorProfileForm.js";
5
+ import { BaseComponent as a } from "../../Base/Base.js";
6
+ import { useComponentDictionary as c } from "../../../i18n/I18n.js";
7
+ function s(o) {
8
+ return c("Contractor.Profile", o.dictionary), /* @__PURE__ */ r(a, { ...o, children: /* @__PURE__ */ r(p, { ...o }) });
9
+ }
10
+ function p({ companyId: o, contractorId: t, defaultValues: n, className: e }) {
11
+ const i = m({
12
+ companyId: o,
13
+ contractorId: t,
14
+ defaultValues: n
15
+ });
16
+ return /* @__PURE__ */ r(f, { ...i, className: e });
17
+ }
18
+ export {
19
+ s as ContractorProfile,
20
+ f as ContractorProfileForm,
21
+ h as ContractorType,
22
+ D as WageType
23
+ };
24
+ //# sourceMappingURL=ContractorProfile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContractorProfile.js","sources":["../../../../src/components/Contractor/Profile/ContractorProfile.tsx"],"sourcesContent":["import {\n useContractorProfile,\n ContractorType,\n WageType,\n type UseContractorProfileProps,\n} from './useContractorProfile'\nimport { ContractorProfileForm } from './ContractorProfileForm'\nimport type { BaseComponentInterface, CommonComponentInterface } from '@/components/Base/Base'\nimport { BaseComponent } from '@/components/Base/Base'\nimport { useComponentDictionary } from '@/i18n/I18n'\n\ninterface ContractorProfileProps extends CommonComponentInterface<'Contractor.Profile'> {\n companyId: string\n contractorId?: string\n defaultValues?: UseContractorProfileProps['defaultValues']\n}\n\n// Container component - calls hook and passes data to presentation component\nexport function ContractorProfile(props: ContractorProfileProps & BaseComponentInterface) {\n useComponentDictionary('Contractor.Profile', props.dictionary)\n return (\n <BaseComponent {...props}>\n <Root {...props} />\n </BaseComponent>\n )\n}\n\nfunction Root({ companyId, contractorId, defaultValues, className }: ContractorProfileProps) {\n const hookData = useContractorProfile({\n companyId,\n contractorId,\n defaultValues,\n })\n\n return <ContractorProfileForm {...hookData} className={className} />\n}\n\n// Re-export types and enums for convenience\nexport { ContractorType, WageType }\nexport type { UseContractorProfileProps as ContractorProfileFormData }\n\n// Re-export the form component for convenience\nexport { ContractorProfileForm } from './ContractorProfileForm'\n"],"names":["ContractorProfile","props","useComponentDictionary","jsx","BaseComponent","Root","companyId","contractorId","defaultValues","className","hookData","useContractorProfile","ContractorProfileForm"],"mappings":";;;;;;AAkBO,SAASA,EAAkBC,GAAwD;AACjE,SAAAC,EAAA,sBAAsBD,EAAM,UAAU,GAE3D,gBAAAE,EAACC,KAAe,GAAGH,GACjB,4BAACI,GAAM,EAAA,GAAGJ,GAAO,EACnB,CAAA;AAEJ;AAEA,SAASI,EAAK,EAAE,WAAAC,GAAW,cAAAC,GAAc,eAAAC,GAAe,WAAAC,KAAqC;AAC3F,QAAMC,IAAWC,EAAqB;AAAA,IACpC,WAAAL;AAAA,IACA,cAAAC;AAAA,IACA,eAAAC;AAAA,EAAA,CACD;AAED,SAAQ,gBAAAL,EAAAS,GAAA,EAAuB,GAAGF,GAAU,WAAAD,EAAsB,CAAA;AACpE;"}
@@ -0,0 +1,5 @@
1
+ import { useContractorProfile } from './useContractorProfile';
2
+ export type ContractorProfileFormProps = ReturnType<typeof useContractorProfile> & {
3
+ className?: string;
4
+ };
5
+ export declare function ContractorProfileForm({ formMethods, handleSubmit, formState, handleCancel, shouldShowEmailField, shouldShowBusinessFields, shouldShowIndividualFields, shouldShowHourlyRate, contractorTypeOptions, wageTypeOptions, isEditing, className, }: ContractorProfileFormProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,140 @@
1
+ import { jsx as i, jsxs as r, Fragment as s } from "react/jsx-runtime";
2
+ import { FormProvider as R } from "react-hook-form";
3
+ import { useTranslation as F } from "react-i18next";
4
+ import { useComponentContext as N } from "../../../contexts/ComponentAdapter/useComponentContext.js";
5
+ import { useI18n as T } from "../../../i18n/I18n.js";
6
+ import { Form as q } from "../../Common/Form/Form.js";
7
+ import { Grid as a } from "../../Common/Grid/Grid.js";
8
+ import { Flex as x } from "../../Common/Flex/Flex.js";
9
+ import { normalizeSSN as v } from "../../../helpers/ssn.js";
10
+ import { normalizeEin as D } from "../../../helpers/federalEin.js";
11
+ import { TextInputField as t } from "../../Common/Fields/TextInputField/TextInputField.js";
12
+ import { RadioGroupField as m } from "../../Common/Fields/RadioGroupField/RadioGroupField.js";
13
+ import { NumberInputField as I } from "../../Common/Fields/NumberInputField/NumberInputField.js";
14
+ import { SwitchField as P } from "../../Common/Fields/SwitchField/SwitchField.js";
15
+ import { DatePickerField as S } from "../../Common/Fields/DatePickerField/DatePickerField.js";
16
+ function U({
17
+ formMethods: d,
18
+ handleSubmit: u,
19
+ formState: n,
20
+ handleCancel: c,
21
+ shouldShowEmailField: p,
22
+ shouldShowBusinessFields: f,
23
+ shouldShowIndividualFields: b,
24
+ shouldShowHourlyRate: h,
25
+ contractorTypeOptions: C,
26
+ wageTypeOptions: g,
27
+ isEditing: o,
28
+ className: y
29
+ }) {
30
+ const l = N();
31
+ T("Contractor.Profile");
32
+ const { t: e } = F("Contractor.Profile");
33
+ return /* @__PURE__ */ i("section", { className: y, children: /* @__PURE__ */ i(R, { ...d, children: /* @__PURE__ */ r(q, { onSubmit: u, children: [
34
+ /* @__PURE__ */ r(a, { gridTemplateColumns: "1fr", gap: 24, className: "mb-8", children: [
35
+ /* @__PURE__ */ r("header", { children: [
36
+ /* @__PURE__ */ i(l.Heading, { as: "h2", children: e("title") }),
37
+ /* @__PURE__ */ i(l.Text, { children: e("subtitle") })
38
+ ] }),
39
+ /* @__PURE__ */ i(l.Card, { children: /* @__PURE__ */ r(a, { gap: 16, children: [
40
+ /* @__PURE__ */ i(
41
+ P,
42
+ {
43
+ name: "inviteContractor",
44
+ label: e("fields.inviteContractor.label"),
45
+ description: e("fields.inviteContractor.description")
46
+ }
47
+ ),
48
+ p && /* @__PURE__ */ i(
49
+ t,
50
+ {
51
+ name: "email",
52
+ label: e("fields.email.label"),
53
+ isRequired: !0,
54
+ type: "email"
55
+ }
56
+ )
57
+ ] }) }),
58
+ /* @__PURE__ */ i(
59
+ m,
60
+ {
61
+ name: "contractorType",
62
+ label: e("fields.contractorType.label"),
63
+ options: C
64
+ }
65
+ ),
66
+ b && /* @__PURE__ */ r(s, { children: [
67
+ /* @__PURE__ */ r(a, { gridTemplateColumns: { base: "1fr", medium: "1fr 1fr" }, gap: 16, children: [
68
+ /* @__PURE__ */ i(t, { name: "firstName", label: e("fields.firstName.label"), isRequired: !0 }),
69
+ /* @__PURE__ */ i(t, { name: "middleInitial", label: e("fields.middleInitial.label") })
70
+ ] }),
71
+ /* @__PURE__ */ i(t, { name: "lastName", label: e("fields.lastName.label"), isRequired: !0 }),
72
+ /* @__PURE__ */ i(
73
+ t,
74
+ {
75
+ name: "ssn",
76
+ label: e("fields.ssn.label"),
77
+ placeholder: e("fields.ssn.placeholder"),
78
+ transform: v,
79
+ isRequired: !0
80
+ }
81
+ )
82
+ ] }),
83
+ f && /* @__PURE__ */ r(s, { children: [
84
+ /* @__PURE__ */ i(
85
+ t,
86
+ {
87
+ name: "businessName",
88
+ label: e("fields.businessName.label"),
89
+ isRequired: !0
90
+ }
91
+ ),
92
+ /* @__PURE__ */ i(
93
+ t,
94
+ {
95
+ name: "ein",
96
+ label: e("fields.ein.label"),
97
+ placeholder: e("fields.ein.placeholder"),
98
+ transform: D,
99
+ isRequired: !0
100
+ }
101
+ )
102
+ ] }),
103
+ /* @__PURE__ */ i(
104
+ m,
105
+ {
106
+ name: "wageType",
107
+ label: e("fields.wageType.label"),
108
+ options: g
109
+ }
110
+ ),
111
+ h && /* @__PURE__ */ i(
112
+ I,
113
+ {
114
+ name: "hourlyRate",
115
+ label: e("fields.hourlyRate.label"),
116
+ min: 0,
117
+ isRequired: !0,
118
+ format: "currency"
119
+ }
120
+ ),
121
+ /* @__PURE__ */ i(
122
+ S,
123
+ {
124
+ name: "startDate",
125
+ label: e("fields.startDate.label"),
126
+ description: e("fields.startDate.description"),
127
+ isRequired: !0
128
+ }
129
+ )
130
+ ] }),
131
+ /* @__PURE__ */ r(x, { gap: 12, justifyContent: "flex-end", children: [
132
+ /* @__PURE__ */ i(l.Button, { type: "button", variant: "secondary", onClick: c, children: e("buttons.cancel") }),
133
+ /* @__PURE__ */ i(l.Button, { type: "submit", variant: "primary", isDisabled: n.isSubmitting, children: n.isSubmitting ? e(o ? "buttons.updating" : "buttons.creating") : e(o ? "buttons.update" : "buttons.create") })
134
+ ] })
135
+ ] }) }) });
136
+ }
137
+ export {
138
+ U as ContractorProfileForm
139
+ };
140
+ //# sourceMappingURL=ContractorProfileForm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContractorProfileForm.js","sources":["../../../../src/components/Contractor/Profile/ContractorProfileForm.tsx"],"sourcesContent":["import { FormProvider } from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport type { useContractorProfile } from './useContractorProfile'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\nimport { Form } from '@/components/Common/Form'\nimport { Grid } from '@/components/Common/Grid/Grid'\nimport { Flex } from '@/components/Common/Flex'\nimport { TextInputField } from '@/components/Common/Fields/TextInputField'\nimport { NumberInputField } from '@/components/Common/Fields/NumberInputField'\nimport { RadioGroupField } from '@/components/Common/Fields/RadioGroupField'\nimport { SwitchField } from '@/components/Common/Fields/SwitchField'\nimport { DatePickerField } from '@/components/Common/Fields/DatePickerField'\nimport { normalizeSSN } from '@/helpers/ssn'\nimport { normalizeEin } from '@/helpers/federalEin'\n\n// Pure presentation component - takes all data as props\nexport type ContractorProfileFormProps = ReturnType<typeof useContractorProfile> & {\n className?: string\n}\n\nexport function ContractorProfileForm({\n formMethods,\n handleSubmit,\n formState,\n handleCancel,\n shouldShowEmailField,\n shouldShowBusinessFields,\n shouldShowIndividualFields,\n shouldShowHourlyRate,\n contractorTypeOptions,\n wageTypeOptions,\n isEditing,\n className,\n}: ContractorProfileFormProps) {\n const Components = useComponentContext()\n useI18n('Contractor.Profile')\n const { t } = useTranslation('Contractor.Profile')\n\n return (\n <section className={className}>\n <FormProvider {...formMethods}>\n <Form onSubmit={handleSubmit}>\n <Grid gridTemplateColumns=\"1fr\" gap={24} className=\"mb-8\">\n <header>\n <Components.Heading as=\"h2\">{t('title')}</Components.Heading>\n <Components.Text>{t('subtitle')}</Components.Text>\n </header>\n\n {/* Invite Contractor Card */}\n <Components.Card>\n <Grid gap={16}>\n {/* Invite Contractor Toggle */}\n <SwitchField\n name=\"inviteContractor\"\n label={t('fields.inviteContractor.label')}\n description={t('fields.inviteContractor.description')}\n />\n\n {/* Email Field - shown when inviting contractor */}\n {shouldShowEmailField && (\n <TextInputField\n name=\"email\"\n label={t('fields.email.label')}\n isRequired\n type=\"email\"\n />\n )}\n </Grid>\n </Components.Card>\n\n {/* Contractor Type */}\n <RadioGroupField\n name=\"contractorType\"\n label={t('fields.contractorType.label')}\n options={contractorTypeOptions}\n />\n\n {/* Individual Contractor Fields */}\n {shouldShowIndividualFields && (\n <>\n <Grid gridTemplateColumns={{ base: '1fr', medium: '1fr 1fr' }} gap={16}>\n <TextInputField name=\"firstName\" label={t('fields.firstName.label')} isRequired />\n <TextInputField name=\"middleInitial\" label={t('fields.middleInitial.label')} />\n </Grid>\n <TextInputField name=\"lastName\" label={t('fields.lastName.label')} isRequired />\n <TextInputField\n name=\"ssn\"\n label={t('fields.ssn.label')}\n placeholder={t('fields.ssn.placeholder')}\n transform={normalizeSSN}\n isRequired\n />\n </>\n )}\n\n {/* Business Contractor Fields */}\n {shouldShowBusinessFields && (\n <>\n <TextInputField\n name=\"businessName\"\n label={t('fields.businessName.label')}\n isRequired\n />\n <TextInputField\n name=\"ein\"\n label={t('fields.ein.label')}\n placeholder={t('fields.ein.placeholder')}\n transform={normalizeEin}\n isRequired\n />\n </>\n )}\n\n {/* Wage Type */}\n <RadioGroupField\n name=\"wageType\"\n label={t('fields.wageType.label')}\n options={wageTypeOptions}\n />\n\n {/* Hourly Rate - shown for hourly contractors */}\n {shouldShowHourlyRate && (\n <NumberInputField\n name=\"hourlyRate\"\n label={t('fields.hourlyRate.label')}\n min={0}\n isRequired\n format=\"currency\"\n />\n )}\n\n {/* Start Date */}\n <DatePickerField\n name=\"startDate\"\n label={t('fields.startDate.label')}\n description={t('fields.startDate.description')}\n isRequired\n />\n </Grid>\n\n {/* Actions */}\n <Flex gap={12} justifyContent=\"flex-end\">\n <Components.Button type=\"button\" variant=\"secondary\" onClick={handleCancel}>\n {t('buttons.cancel')}\n </Components.Button>\n <Components.Button type=\"submit\" variant=\"primary\" isDisabled={formState.isSubmitting}>\n {formState.isSubmitting\n ? isEditing\n ? t('buttons.updating')\n : t('buttons.creating')\n : isEditing\n ? t('buttons.update')\n : t('buttons.create')}\n </Components.Button>\n </Flex>\n </Form>\n </FormProvider>\n </section>\n )\n}\n"],"names":["ContractorProfileForm","formMethods","handleSubmit","formState","handleCancel","shouldShowEmailField","shouldShowBusinessFields","shouldShowIndividualFields","shouldShowHourlyRate","contractorTypeOptions","wageTypeOptions","isEditing","className","Components","useComponentContext","useI18n","t","useTranslation","jsx","FormProvider","jsxs","Form","Grid","SwitchField","TextInputField","RadioGroupField","Fragment","normalizeSSN","normalizeEin","NumberInputField","DatePickerField","Flex"],"mappings":";;;;;;;;;;;;;;;AAqBO,SAASA,EAAsB;AAAA,EACpC,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,WAAAC;AAAA,EACA,cAAAC;AAAA,EACA,sBAAAC;AAAA,EACA,0BAAAC;AAAA,EACA,4BAAAC;AAAA,EACA,sBAAAC;AAAA,EACA,uBAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,WAAAC;AACF,GAA+B;AAC7B,QAAMC,IAAaC,EAAoB;AACvC,EAAAC,EAAQ,oBAAoB;AAC5B,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,oBAAoB;AAG/C,SAAA,gBAAAC,EAAC,WAAQ,EAAA,WAAAN,G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A;AAAA,IACZ,GACF;AAAA,IAGC,gBAAAI,EAAAW,GAAA,EAAK,KAAK,IAAI,gBAAe,YAC5B,UAAA;AAAA,MAAC,gBAAAb,EAAAL,EAAW,QAAX,EAAkB,MAAK,UAAS,SAAQ,aAAY,SAAST,GAC3D,UAAEY,EAAA,gBAAgB,EACrB,CAAA;AAAA,MACA,gBAAAE,EAACL,EAAW,QAAX,EAAkB,MAAK,UAAS,SAAQ,WAAU,YAAYV,EAAU,cACtE,UAAUA,EAAA,eAELa,EADFL,IACI,qBACA,kBADkB,IAGpBK,EADFL,IACI,mBACA,gBADgB,EAE1B,CAAA;AAAA,IAAA,EACF,CAAA;AAAA,EAAA,EACF,CAAA,EACF,CAAA,GACF;AAEJ;"}
@@ -0,0 +1,3 @@
1
+ import "./types/i18next.d.ts"
2
+ export { ContractorProfile } from './ContractorProfile';
3
+ export { ContractorProfileForm } from './ContractorProfileForm';