@gusto/embedded-react-sdk 0.8.0 → 0.8.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 (214) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/components/Common/DataView/DataCards/DataCards.module.scss.js +5 -3
  3. package/dist/components/Common/DataView/DataCards/DataCards.module.scss.js.map +1 -1
  4. package/dist/components/Common/FadeIn/FadeIn.module.scss.js +4 -4
  5. package/dist/components/Common/{UI/FieldCaption → FieldCaption}/FieldCaption.js +1 -1
  6. package/dist/components/Common/FieldCaption/FieldCaption.js.map +1 -0
  7. package/dist/components/Common/{UI/FieldDescription → FieldDescription}/FieldDescription.js +1 -1
  8. package/dist/components/Common/FieldDescription/FieldDescription.js.map +1 -0
  9. package/dist/components/Common/{UI/FieldErrorMessage → FieldErrorMessage}/FieldErrorMessage.js +1 -1
  10. package/dist/components/Common/FieldErrorMessage/FieldErrorMessage.js.map +1 -0
  11. package/dist/components/Common/{UI/FieldLayout → FieldLayout}/FieldLayout.js +1 -1
  12. package/dist/components/Common/FieldLayout/FieldLayout.js.map +1 -0
  13. package/dist/components/Common/FieldLayout/FieldLayoutTypes.d.ts +52 -0
  14. package/dist/components/Common/{UI/Fieldset → Fieldset}/Fieldset.js +1 -1
  15. package/dist/components/Common/Fieldset/Fieldset.js.map +1 -0
  16. package/dist/components/Common/{UI/HorizontalFieldLayout → HorizontalFieldLayout}/HorizontalFieldLayout.js +2 -2
  17. package/dist/components/Common/HorizontalFieldLayout/HorizontalFieldLayout.js.map +1 -0
  18. package/dist/components/Common/SignatureForm/SignatureForm.d.ts +12 -6
  19. package/dist/components/Common/SignatureForm/SignatureForm.js +10 -10
  20. package/dist/components/Common/SignatureForm/SignatureForm.js.map +1 -1
  21. package/dist/components/Common/UI/Alert/Alert.d.ts +1 -1
  22. package/dist/components/Common/UI/Alert/Alert.js +13 -12
  23. package/dist/components/Common/UI/Alert/Alert.js.map +1 -1
  24. package/dist/components/Common/UI/Alert/AlertTypes.d.ts +16 -4
  25. package/dist/components/Common/UI/Badge/BadgeTypes.d.ts +6 -0
  26. package/dist/components/Common/UI/Button/Button.js +28 -27
  27. package/dist/components/Common/UI/Button/Button.js.map +1 -1
  28. package/dist/components/Common/UI/Button/Button.module.scss.js +1 -1
  29. package/dist/components/Common/UI/Button/ButtonTypes.d.ts +29 -4
  30. package/dist/components/Common/UI/CalendarPreview/CalendarPreviewTypes.d.ts +24 -0
  31. package/dist/components/Common/UI/Card/Card.module.scss.js +1 -1
  32. package/dist/components/Common/UI/Card/CardTypes.d.ts +12 -4
  33. package/dist/components/Common/UI/Checkbox/Checkbox.js +4 -4
  34. package/dist/components/Common/UI/Checkbox/Checkbox.js.map +1 -1
  35. package/dist/components/Common/UI/Checkbox/CheckboxTypes.d.ts +16 -1
  36. package/dist/components/Common/UI/CheckboxGroup/CheckboxGroup.js +4 -4
  37. package/dist/components/Common/UI/CheckboxGroup/CheckboxGroup.js.map +1 -1
  38. package/dist/components/Common/UI/CheckboxGroup/CheckboxGroupTypes.d.ts +33 -3
  39. package/dist/components/Common/UI/ComboBox/ComboBox.js +8 -8
  40. package/dist/components/Common/UI/ComboBox/ComboBox.js.map +1 -1
  41. package/dist/components/Common/UI/ComboBox/ComboBoxTypes.d.ts +31 -1
  42. package/dist/components/Common/UI/DatePicker/DatePicker.js +13 -13
  43. package/dist/components/Common/UI/DatePicker/DatePicker.js.map +1 -1
  44. package/dist/components/Common/UI/DatePicker/DatePickerTypes.d.ts +25 -1
  45. package/dist/components/Common/UI/Heading/HeadingTypes.d.ts +12 -0
  46. package/dist/components/Common/UI/Link/LinkTypes.d.ts +53 -1
  47. package/dist/components/Common/UI/List/ListTypes.d.ts +3 -5
  48. package/dist/components/Common/UI/Menu/MenuTypes.d.ts +30 -0
  49. package/dist/components/Common/UI/NumberInput/NumberInput.js +4 -4
  50. package/dist/components/Common/UI/NumberInput/NumberInput.js.map +1 -1
  51. package/dist/components/Common/UI/NumberInput/NumberInputTypes.d.ts +34 -1
  52. package/dist/components/Common/UI/ProgressBar/ProgressBarTypes.d.ts +12 -0
  53. package/dist/components/Common/UI/Radio/Radio.js +1 -1
  54. package/dist/components/Common/UI/Radio/Radio.js.map +1 -1
  55. package/dist/components/Common/UI/Radio/RadioTypes.d.ts +16 -1
  56. package/dist/components/Common/UI/RadioGroup/RadioGroup.js +4 -4
  57. package/dist/components/Common/UI/RadioGroup/RadioGroup.js.map +1 -1
  58. package/dist/components/Common/UI/RadioGroup/RadioGroupTypes.d.ts +33 -3
  59. package/dist/components/Common/UI/Select/Select.js +8 -8
  60. package/dist/components/Common/UI/Select/Select.js.map +1 -1
  61. package/dist/components/Common/UI/Select/SelectTypes.d.ts +34 -1
  62. package/dist/components/Common/UI/Switch/Switch.js +1 -1
  63. package/dist/components/Common/UI/Switch/Switch.js.map +1 -1
  64. package/dist/components/Common/UI/Switch/SwitchTypes.d.ts +25 -1
  65. package/dist/components/Common/UI/Table/TableTypes.d.ts +21 -0
  66. package/dist/components/Common/UI/Text/TextTypes.d.ts +18 -0
  67. package/dist/components/Common/UI/TextInput/TextInput.js +1 -1
  68. package/dist/components/Common/UI/TextInput/TextInput.js.map +1 -1
  69. package/dist/components/Common/UI/TextInput/TextInputTypes.d.ts +22 -1
  70. package/dist/components/Company/AssignSignatory/AssignSignatory.js +12 -12
  71. package/dist/components/Company/AssignSignatory/AssignSignatory.js.map +1 -1
  72. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js +7 -7
  73. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js.map +1 -1
  74. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.d.ts +2 -2
  75. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js.map +1 -1
  76. package/dist/components/Company/AssignSignatory/CreateSignatory/Schema.d.ts +41 -15
  77. package/dist/components/Company/AssignSignatory/CreateSignatory/Schema.js +17 -20
  78. package/dist/components/Company/AssignSignatory/CreateSignatory/Schema.js.map +1 -1
  79. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js +10 -10
  80. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js.map +1 -1
  81. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.d.ts +17 -11
  82. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js +42 -45
  83. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js.map +1 -1
  84. package/dist/components/Company/BankAccount/BankAccountForm/BankAccountForm.js +6 -6
  85. package/dist/components/Company/BankAccount/BankAccountForm/BankAccountForm.js.map +1 -1
  86. package/dist/components/Company/BankAccount/BankAccountForm/Form.d.ts +12 -6
  87. package/dist/components/Company/BankAccount/BankAccountForm/Form.js +2 -2
  88. package/dist/components/Company/BankAccount/BankAccountForm/Form.js.map +1 -1
  89. package/dist/components/Company/BankAccount/BankAccountVerify/BankAccountVerify.js +10 -10
  90. package/dist/components/Company/BankAccount/BankAccountVerify/BankAccountVerify.js.map +1 -1
  91. package/dist/components/Company/BankAccount/BankAccountVerify/Form.d.ts +12 -6
  92. package/dist/components/Company/BankAccount/BankAccountVerify/Form.js +17 -17
  93. package/dist/components/Company/BankAccount/BankAccountVerify/Form.js.map +1 -1
  94. package/dist/components/Company/DocumentSignerFlow/SignatureForm/SignatureForm.js +1 -1
  95. package/dist/components/Company/DocumentSignerFlow/SignatureForm/SignatureForm.js.map +1 -1
  96. package/dist/components/Company/FederalTaxes/FederalTaxes.js +5 -5
  97. package/dist/components/Company/FederalTaxes/FederalTaxes.js.map +1 -1
  98. package/dist/components/Company/FederalTaxes/useFederalTaxes.d.ts +18 -8
  99. package/dist/components/Company/FederalTaxes/useFederalTaxes.js +12 -16
  100. package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
  101. package/dist/components/Company/Industry/Industry.js +1 -1
  102. package/dist/components/Company/Industry/Industry.js.map +1 -1
  103. package/dist/components/Company/Locations/LocationForm/Form.d.ts +27 -11
  104. package/dist/components/Company/Locations/LocationForm/Form.js +24 -24
  105. package/dist/components/Company/Locations/LocationForm/Form.js.map +1 -1
  106. package/dist/components/Company/Locations/LocationForm/LocationForm.js +24 -24
  107. package/dist/components/Company/Locations/LocationForm/LocationForm.js.map +1 -1
  108. package/dist/components/Company/PaySchedule/PaySchedule.js +7 -7
  109. package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
  110. package/dist/components/Company/PaySchedule/_parts/List.js +28 -31
  111. package/dist/components/Company/PaySchedule/_parts/List.js.map +1 -1
  112. package/dist/components/Company/PaySchedule/_parts/List.module.scss.js +8 -0
  113. package/dist/components/Company/PaySchedule/_parts/List.module.scss.js.map +1 -0
  114. package/dist/components/Company/PaySchedule/usePaySchedule.d.ts +31 -13
  115. package/dist/components/Company/PaySchedule/usePaySchedule.js +15 -20
  116. package/dist/components/Company/PaySchedule/usePaySchedule.js.map +1 -1
  117. package/dist/components/Company/StateTaxes/StateTaxesForm/Form.d.ts +3 -3
  118. package/dist/components/Company/StateTaxes/StateTaxesForm/Form.js +3 -3
  119. package/dist/components/Company/StateTaxes/StateTaxesForm/Form.js.map +1 -1
  120. package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js +66 -77
  121. package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js.map +1 -1
  122. package/dist/components/Employee/Compensation/Compensation.js +5 -5
  123. package/dist/components/Employee/Compensation/Compensation.js.map +1 -1
  124. package/dist/components/Employee/Compensation/List.js +10 -10
  125. package/dist/components/Employee/Compensation/List.js.map +1 -1
  126. package/dist/components/Employee/Compensation/useCompensation.d.ts +90 -42
  127. package/dist/components/Employee/Compensation/useCompensation.js +45 -69
  128. package/dist/components/Employee/Compensation/useCompensation.js.map +1 -1
  129. package/dist/components/Employee/Deductions/Deductions.d.ts +9 -5
  130. package/dist/components/Employee/Deductions/Deductions.js +13 -13
  131. package/dist/components/Employee/Deductions/Deductions.js.map +1 -1
  132. package/dist/components/Employee/Deductions/useDeductions.d.ts +34 -14
  133. package/dist/components/Employee/Deductions/useDeductions.js +14 -32
  134. package/dist/components/Employee/Deductions/useDeductions.js.map +1 -1
  135. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js +1 -1
  136. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
  137. package/dist/components/Employee/EmployeeList/EmployeeList.js +1 -1
  138. package/dist/components/Employee/EmployeeList/EmployeeList.js.map +1 -1
  139. package/dist/components/Employee/PaymentMethod/BankAccount.d.ts +22 -10
  140. package/dist/components/Employee/PaymentMethod/BankAccount.js +9 -9
  141. package/dist/components/Employee/PaymentMethod/BankAccount.js.map +1 -1
  142. package/dist/components/Employee/PaymentMethod/PaymentMethod.js +13 -13
  143. package/dist/components/Employee/PaymentMethod/PaymentMethod.js.map +1 -1
  144. package/dist/components/Employee/PaymentMethod/PaymentTypeForm.d.ts +10 -6
  145. package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js +8 -8
  146. package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js.map +1 -1
  147. package/dist/components/Employee/PaymentMethod/usePaymentMethod.d.ts +92 -37
  148. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +35 -42
  149. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
  150. package/dist/components/Employee/Profile/AdminPersonalDetails.d.ts +68 -31
  151. package/dist/components/Employee/Profile/AdminPersonalDetails.js +33 -46
  152. package/dist/components/Employee/Profile/AdminPersonalDetails.js.map +1 -1
  153. package/dist/components/Employee/Profile/HomeAddress.d.ts +33 -13
  154. package/dist/components/Employee/Profile/HomeAddress.js +39 -38
  155. package/dist/components/Employee/Profile/HomeAddress.js.map +1 -1
  156. package/dist/components/Employee/Profile/PersonalDetailsInputs.d.ts +81 -32
  157. package/dist/components/Employee/Profile/PersonalDetailsInputs.js +60 -74
  158. package/dist/components/Employee/Profile/PersonalDetailsInputs.js.map +1 -1
  159. package/dist/components/Employee/Profile/Profile.js +51 -55
  160. package/dist/components/Employee/Profile/Profile.js.map +1 -1
  161. package/dist/components/Employee/Profile/SelfPersonalDetails.d.ts +44 -15
  162. package/dist/components/Employee/Profile/SelfPersonalDetails.js +18 -21
  163. package/dist/components/Employee/Profile/SelfPersonalDetails.js.map +1 -1
  164. package/dist/components/Employee/Taxes/FederalForm.d.ts +28 -12
  165. package/dist/components/Employee/Taxes/FederalForm.js +28 -28
  166. package/dist/components/Employee/Taxes/FederalForm.js.map +1 -1
  167. package/dist/components/Employee/Taxes/StateForm.d.ts +9 -5
  168. package/dist/components/Employee/Taxes/StateForm.js +5 -5
  169. package/dist/components/Employee/Taxes/StateForm.js.map +1 -1
  170. package/dist/components/Employee/Taxes/Taxes.js +31 -34
  171. package/dist/components/Employee/Taxes/Taxes.js.map +1 -1
  172. package/dist/contexts/ApiProvider/ApiProvider.d.ts +5 -0
  173. package/dist/contexts/ApiProvider/ApiProvider.js +34 -0
  174. package/dist/contexts/ApiProvider/ApiProvider.js.map +1 -0
  175. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.d.ts +1 -1
  176. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +16 -16
  177. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
  178. package/dist/helpers/validations.d.ts +6 -5
  179. package/dist/helpers/validations.js +10 -17
  180. package/dist/helpers/validations.js.map +1 -1
  181. package/dist/style.css +1 -1
  182. package/package.json +7 -4
  183. package/dist/components/Common/UI/FieldCaption/FieldCaption.js.map +0 -1
  184. package/dist/components/Common/UI/FieldDescription/FieldDescription.js.map +0 -1
  185. package/dist/components/Common/UI/FieldErrorMessage/FieldErrorMessage.js.map +0 -1
  186. package/dist/components/Common/UI/FieldLayout/FieldLayout.js.map +0 -1
  187. package/dist/components/Common/UI/FieldLayout/FieldLayoutTypes.d.ts +0 -19
  188. package/dist/components/Common/UI/Fieldset/Fieldset.js.map +0 -1
  189. package/dist/components/Common/UI/HorizontalFieldLayout/HorizontalFieldLayout.js.map +0 -1
  190. /package/dist/components/Common/{UI/FieldCaption → FieldCaption}/FieldCaption.d.ts +0 -0
  191. /package/dist/components/Common/{UI/FieldCaption → FieldCaption}/FieldCaption.module.scss.js +0 -0
  192. /package/dist/components/Common/{UI/FieldCaption → FieldCaption}/FieldCaption.module.scss.js.map +0 -0
  193. /package/dist/components/Common/{UI/FieldCaption → FieldCaption}/index.d.ts +0 -0
  194. /package/dist/components/Common/{UI/FieldDescription → FieldDescription}/FieldDescription.d.ts +0 -0
  195. /package/dist/components/Common/{UI/FieldDescription → FieldDescription}/FieldDescription.module.scss.js +0 -0
  196. /package/dist/components/Common/{UI/FieldDescription → FieldDescription}/FieldDescription.module.scss.js.map +0 -0
  197. /package/dist/components/Common/{UI/FieldDescription → FieldDescription}/index.d.ts +0 -0
  198. /package/dist/components/Common/{UI/FieldErrorMessage → FieldErrorMessage}/FieldErrorMessage.d.ts +0 -0
  199. /package/dist/components/Common/{UI/FieldErrorMessage → FieldErrorMessage}/FieldErrorMessage.module.scss.js +0 -0
  200. /package/dist/components/Common/{UI/FieldErrorMessage → FieldErrorMessage}/FieldErrorMessage.module.scss.js.map +0 -0
  201. /package/dist/components/Common/{UI/FieldErrorMessage → FieldErrorMessage}/index.d.ts +0 -0
  202. /package/dist/components/Common/{UI/FieldLayout → FieldLayout}/FieldLayout.d.ts +0 -0
  203. /package/dist/components/Common/{UI/FieldLayout → FieldLayout}/FieldLayout.module.scss.js +0 -0
  204. /package/dist/components/Common/{UI/FieldLayout → FieldLayout}/FieldLayout.module.scss.js.map +0 -0
  205. /package/dist/components/Common/{UI/FieldLayout → FieldLayout}/index.d.ts +0 -0
  206. /package/dist/components/Common/{UI/Fieldset → Fieldset}/Fieldset.d.ts +0 -0
  207. /package/dist/components/Common/{UI/Fieldset → Fieldset}/Fieldset.module.scss.js +0 -0
  208. /package/dist/components/Common/{UI/Fieldset → Fieldset}/Fieldset.module.scss.js.map +0 -0
  209. /package/dist/components/Common/{UI/Fieldset → Fieldset}/index.d.ts +0 -0
  210. /package/dist/components/Common/{UI/HorizontalFieldLayout → HorizontalFieldLayout}/HorizontalFieldLayout.d.ts +0 -0
  211. /package/dist/components/Common/{UI/HorizontalFieldLayout → HorizontalFieldLayout}/HorizontalFieldLayout.module.scss.js +0 -0
  212. /package/dist/components/Common/{UI/HorizontalFieldLayout → HorizontalFieldLayout}/HorizontalFieldLayout.module.scss.js.map +0 -0
  213. /package/dist/components/Common/{UI/HorizontalFieldLayout → HorizontalFieldLayout}/HorizontalFieldLayoutTypes.d.ts +0 -0
  214. /package/dist/components/Common/{UI/HorizontalFieldLayout → HorizontalFieldLayout}/index.d.ts +0 -0
@@ -1,48 +1,47 @@
1
1
  import { jsx as t, jsxs as ce, Fragment as pe } from "react/jsx-runtime";
2
- import { valibotResolver as ye } from "@hookform/resolvers/valibot";
2
+ import { zodResolver as ye } from "@hookform/resolvers/zod";
3
3
  import { useRef as Ae } from "react";
4
4
  import { useForm as Ee, useWatch as fe, FormProvider as he } from "react-hook-form";
5
- import * as De from "valibot";
6
- import { useLocationsGetSuspense as Oe } from "@gusto/embedded-api/react-query/locationsGet";
7
- import { useEmployeesCreateMutation as Se } from "@gusto/embedded-api/react-query/employeesCreate";
8
- import { useEmployeesGetSuspense as Pe } from "@gusto/embedded-api/react-query/employeesGet";
9
- import { useEmployeeAddressesGetSuspense as ge } from "@gusto/embedded-api/react-query/employeeAddressesGet";
10
- import { useEmployeeAddressesCreateMutation as be } from "@gusto/embedded-api/react-query/employeeAddressesCreate";
11
- import { useEmployeeAddressesUpdateMutation as Ne } from "@gusto/embedded-api/react-query/employeeAddressesUpdate";
12
- import { useEmployeeAddressesUpdateWorkAddressMutation as Ie } from "@gusto/embedded-api/react-query/employeeAddressesUpdateWorkAddress";
13
- import { useEmployeesUpdateMutation as _e } from "@gusto/embedded-api/react-query/employeesUpdate";
14
- import { useEmployeeAddressesGetWorkAddressesSuspense as we } from "@gusto/embedded-api/react-query/employeeAddressesGetWorkAddresses";
15
- import { useEmployeeAddressesCreateWorkAddressMutation as ke } from "@gusto/embedded-api/react-query/employeeAddressesCreateWorkAddress";
16
- import { RFCDate as Me } from "@gusto/embedded-api/types/rfcdate";
17
- import { useEmployeesUpdateOnboardingStatusMutation as Re } from "@gusto/embedded-api/react-query/employeesUpdateOnboardingStatus";
18
- import { invalidateEmployeesList as ve } from "@gusto/embedded-api/react-query/employeesList";
19
- import { useQueryClient as Le } from "@gusto/embedded-api/ReactSDKProvider";
20
- import { AdminPersonalDetailsSchema as Be, AdminPersonalDetails as v } from "./AdminPersonalDetails.js";
21
- import { SelfPersonalDetailsSchema as Ce, SelfPersonalDetails as L } from "./SelfPersonalDetails.js";
22
- import { Head as B } from "./Head.js";
5
+ import { useLocationsGetSuspense as De } from "@gusto/embedded-api/react-query/locationsGet";
6
+ import { useEmployeesCreateMutation as Oe } from "@gusto/embedded-api/react-query/employeesCreate";
7
+ import { useEmployeesGetSuspense as Se } from "@gusto/embedded-api/react-query/employeesGet";
8
+ import { useEmployeeAddressesGetSuspense as Pe } from "@gusto/embedded-api/react-query/employeeAddressesGet";
9
+ import { useEmployeeAddressesCreateMutation as ge } from "@gusto/embedded-api/react-query/employeeAddressesCreate";
10
+ import { useEmployeeAddressesUpdateMutation as be } from "@gusto/embedded-api/react-query/employeeAddressesUpdate";
11
+ import { useEmployeeAddressesUpdateWorkAddressMutation as Ne } from "@gusto/embedded-api/react-query/employeeAddressesUpdateWorkAddress";
12
+ import { useEmployeesUpdateMutation as Ie } from "@gusto/embedded-api/react-query/employeesUpdate";
13
+ import { useEmployeeAddressesGetWorkAddressesSuspense as _e } from "@gusto/embedded-api/react-query/employeeAddressesGetWorkAddresses";
14
+ import { useEmployeeAddressesCreateWorkAddressMutation as we } from "@gusto/embedded-api/react-query/employeeAddressesCreateWorkAddress";
15
+ import { RFCDate as ke } from "@gusto/embedded-api/types/rfcdate";
16
+ import { useEmployeesUpdateOnboardingStatusMutation as Me } from "@gusto/embedded-api/react-query/employeesUpdateOnboardingStatus";
17
+ import { invalidateEmployeesList as Re } from "@gusto/embedded-api/react-query/employeesList";
18
+ import { useQueryClient as Le } from "@tanstack/react-query";
19
+ import { AdminPersonalDetailsSchema as Be, AdminPersonalDetails as L } from "./AdminPersonalDetails.js";
20
+ import { SelfPersonalDetailsSchema as ve, SelfPersonalDetails as B } from "./SelfPersonalDetails.js";
21
+ import { Head as v } from "./Head.js";
23
22
  import { Actions as C } from "./Actions.js";
24
- import { HomeAddressSchema as We, HomeAddress as W } from "./HomeAddress.js";
23
+ import { HomeAddressSchema as Ce, HomeAddress as W } from "./HomeAddress.js";
25
24
  import { WorkAddress as U } from "./WorkAddress.js";
26
- import { ProfileProvider as Ue } from "./useProfile.js";
27
- import { getEmployeeAddressForProfile as qe } from "./getEmployeeAddressForProfile.js";
28
- import { Form as Te } from "../../Common/Form/Form.js";
29
- import { BaseComponent as He } from "../../Base/Base.js";
30
- import { useBase as Ge } from "../../Base/useBase.js";
25
+ import { ProfileProvider as We } from "./useProfile.js";
26
+ import { getEmployeeAddressForProfile as Ue } from "./getEmployeeAddressForProfile.js";
27
+ import { Form as qe } from "../../Common/Form/Form.js";
28
+ import { BaseComponent as Te } from "../../Base/Base.js";
29
+ import { useBase as He } from "../../Base/useBase.js";
31
30
  import { useI18n as R } from "../../../i18n/I18n.js";
32
- import { EmployeeOnboardingStatus as l, EmployeeSelfOnboardingStatuses as Fe, componentEvents as d } from "../../../shared/constants.js";
33
- import { useFlow as Ve } from "../../Flow/useFlow.js";
34
- import { ensureRequired as Ye } from "../../../helpers/ensureRequired.js";
31
+ import { EmployeeOnboardingStatus as l, EmployeeSelfOnboardingStatuses as Ge, componentEvents as d } from "../../../shared/constants.js";
32
+ import { useFlow as Fe } from "../../Flow/useFlow.js";
33
+ import { ensureRequired as Ve } from "../../../helpers/ensureRequired.js";
35
34
  function m(r) {
36
- return /* @__PURE__ */ t(He, { ...r, children: r.employeeId ? /* @__PURE__ */ t(xe, { ...r, employeeId: r.employeeId, children: r.children }) : /* @__PURE__ */ t(q, { ...r, children: r.children }) });
35
+ return /* @__PURE__ */ t(Te, { ...r, children: r.employeeId ? /* @__PURE__ */ t(Ye, { ...r, employeeId: r.employeeId, children: r.children }) : /* @__PURE__ */ t(q, { ...r, children: r.children }) });
37
36
  }
38
- function xe({ employeeId: r, ...a }) {
37
+ function Ye({ employeeId: r, ...a }) {
39
38
  const {
40
39
  data: { employee: u }
41
- } = Pe({ employeeId: r }), {
40
+ } = Se({ employeeId: r }), {
42
41
  data: { employeeAddressList: i }
43
- } = ge({ employeeId: r }), {
42
+ } = Pe({ employeeId: r }), {
44
43
  data: { employeeWorkAddressList: c }
45
- } = we({ employeeId: r });
44
+ } = _e({ employeeId: r });
46
45
  return /* @__PURE__ */ t(
47
46
  q,
48
47
  {
@@ -67,12 +66,12 @@ const q = ({
67
66
  children: P,
68
67
  className: T = "",
69
68
  defaultValues: s
70
- } = u, { onEvent: n, baseSubmitHandler: H } = Ge(), G = Le(), { data: F } = Oe({ companyId: i }), V = F.locationList, { mutateAsync: Y, isPending: x } = Se(), { mutateAsync: j, isPending: z } = _e(), { mutateAsync: K, isPending: Q } = ke(), { mutateAsync: J, isPending: X } = Ie(), { mutateAsync: Z, isPending: $ } = be(), { mutateAsync: ee, isPending: re } = Ne(), {
69
+ } = u, { onEvent: n, baseSubmitHandler: H } = He(), G = Le(), { data: F } = De({ companyId: i }), V = F.locationList, { mutateAsync: Y, isPending: x } = Oe(), { mutateAsync: z, isPending: j } = Ie(), { mutateAsync: K, isPending: Q } = we(), { mutateAsync: J, isPending: X } = Ne(), { mutateAsync: Z, isPending: $ } = ge(), { mutateAsync: ee, isPending: re } = be(), {
71
70
  mutateAsync: te,
72
71
  isPending: oe
73
- } = Re({
74
- onSettled: () => ve(G, [i])
75
- }), g = { employee: c, workAddresses: S }, se = qe(f), ne = g.workAddresses?.find((O) => O.active), e = Ae({
72
+ } = Me({
73
+ onSettled: () => Re(G, [i])
74
+ }), g = { employee: c, workAddresses: S }, se = Ue(f), ne = g.workAddresses?.find((O) => O.active), e = Ae({
76
75
  employee: g.employee,
77
76
  homeAddress: se,
78
77
  workAddress: ne
@@ -95,7 +94,7 @@ const q = ({
95
94
  ...h,
96
95
  selfOnboarding: a && e.current.employee?.onboardingStatus ? (
97
96
  // @ts-expect-error: onboarding_status during runtime can be one of self onboarding statuses
98
- Fe.has(e.current.employee.onboarding_status)
97
+ Ge.has(e.current.employee.onboarding_status)
99
98
  ) : !1,
100
99
  enableSsn: !e.current.employee?.hasSsn,
101
100
  ssn: ""
@@ -105,10 +104,7 @@ const q = ({
105
104
  ssn: ""
106
105
  }, D = Ee({
107
106
  resolver: ye(
108
- De.intersect([
109
- r ? Be : Ce,
110
- We
111
- ])
107
+ (r ? Be : ve).and(Ce)
112
108
  ),
113
109
  defaultValues: r ? de : ie
114
110
  }), { handleSubmit: me } = D, b = fe({ control: D.control, name: "selfOnboarding" }), ae = async (O) => {
@@ -129,7 +125,7 @@ const q = ({
129
125
  onboardingStatus: p.onboardingStatus
130
126
  }, n(d.EMPLOYEE_ONBOARDING_STATUS_UPDATED, p);
131
127
  }
132
- const { employee: o } = await j({
128
+ const { employee: o } = await z({
133
129
  request: {
134
130
  employeeId: e.current.employee.uuid,
135
131
  requestBody: { ...I, version: e.current.employee.version }
@@ -200,7 +196,7 @@ const q = ({
200
196
  employeeId: e.current.employee?.uuid,
201
197
  requestBody: {
202
198
  locationUuid: N,
203
- effectiveDate: new Me(A.startDate || /* @__PURE__ */ new Date())
199
+ effectiveDate: new ke(A.startDate || /* @__PURE__ */ new Date())
204
200
  }
205
201
  }
206
202
  });
@@ -215,7 +211,7 @@ const q = ({
215
211
  n(d.CANCEL);
216
212
  };
217
213
  return /* @__PURE__ */ t("section", { className: T, children: /* @__PURE__ */ t(
218
- Ue,
214
+ We,
219
215
  {
220
216
  value: {
221
217
  companyLocations: V,
@@ -225,12 +221,12 @@ const q = ({
225
221
  handleCancel: le,
226
222
  isAdmin: r,
227
223
  isSelfOnboardingEnabled: a,
228
- isPending: z || X || $ || re || x || Q || oe
224
+ isPending: j || X || $ || re || x || Q || oe
229
225
  },
230
- children: /* @__PURE__ */ t(he, { ...D, children: /* @__PURE__ */ t(Te, { onSubmit: me(ae), children: P || /* @__PURE__ */ ce(pe, { children: [
231
- /* @__PURE__ */ t(B, {}),
226
+ children: /* @__PURE__ */ t(he, { ...D, children: /* @__PURE__ */ t(qe, { onSubmit: me(ae), children: P || /* @__PURE__ */ ce(pe, { children: [
232
227
  /* @__PURE__ */ t(v, {}),
233
228
  /* @__PURE__ */ t(L, {}),
229
+ /* @__PURE__ */ t(B, {}),
234
230
  /* @__PURE__ */ t(W, {}),
235
231
  /* @__PURE__ */ t(U, {}),
236
232
  /* @__PURE__ */ t(C, {})
@@ -238,18 +234,18 @@ const q = ({
238
234
  }
239
235
  ) });
240
236
  };
241
- m.Head = B;
237
+ m.Head = v;
242
238
  m.Actions = C;
243
- m.AdminPersonalDetails = v;
244
- m.SelfPersonalDetails = L;
239
+ m.AdminPersonalDetails = L;
240
+ m.SelfPersonalDetails = B;
245
241
  m.HomeAddress = W;
246
242
  m.WorkAddress = U;
247
- const Nr = () => {
248
- const { companyId: r, employeeId: a, onEvent: u, isAdmin: i, defaultValues: c, isSelfOnboardingEnabled: f } = Ve();
243
+ const br = () => {
244
+ const { companyId: r, employeeId: a, onEvent: u, isAdmin: i, defaultValues: c, isSelfOnboardingEnabled: f } = Fe();
249
245
  return /* @__PURE__ */ t(
250
246
  m,
251
247
  {
252
- companyId: Ye(r),
248
+ companyId: Ve(r),
253
249
  employeeId: a,
254
250
  onEvent: u,
255
251
  isAdmin: i,
@@ -260,6 +256,6 @@ const Nr = () => {
260
256
  };
261
257
  export {
262
258
  m as Profile,
263
- Nr as ProfileContextual
259
+ br as ProfileContextual
264
260
  };
265
261
  //# sourceMappingURL=Profile.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Profile.js","sources":["../../../../src/components/Employee/Profile/Profile.tsx"],"sourcesContent":["import { valibotResolver } from '@hookform/resolvers/valibot'\nimport { useRef } from 'react'\nimport type { SubmitHandler } from 'react-hook-form'\nimport { FormProvider, useForm, useWatch } from 'react-hook-form'\nimport * as v from 'valibot'\nimport { useLocationsGetSuspense } from '@gusto/embedded-api/react-query/locationsGet'\nimport { useEmployeesCreateMutation } from '@gusto/embedded-api/react-query/employeesCreate'\nimport { useEmployeesGetSuspense } from '@gusto/embedded-api/react-query/employeesGet'\nimport { type Employee } from '@gusto/embedded-api/models/components/employee'\nimport { useEmployeeAddressesGetSuspense } from '@gusto/embedded-api/react-query/employeeAddressesGet'\nimport { type EmployeeAddress } from '@gusto/embedded-api/models/components/employeeaddress'\nimport { useEmployeeAddressesCreateMutation } from '@gusto/embedded-api/react-query/employeeAddressesCreate'\nimport { useEmployeeAddressesUpdateMutation } from '@gusto/embedded-api/react-query/employeeAddressesUpdate'\nimport { useEmployeeAddressesUpdateWorkAddressMutation } from '@gusto/embedded-api/react-query/employeeAddressesUpdateWorkAddress'\nimport { useEmployeesUpdateMutation } from '@gusto/embedded-api/react-query/employeesUpdate'\nimport { useEmployeeAddressesGetWorkAddressesSuspense } from '@gusto/embedded-api/react-query/employeeAddressesGetWorkAddresses'\nimport type { EmployeeWorkAddress } from '@gusto/embedded-api/models/components/employeeworkaddress'\nimport { useEmployeeAddressesCreateWorkAddressMutation } from '@gusto/embedded-api/react-query/employeeAddressesCreateWorkAddress'\nimport { RFCDate } from '@gusto/embedded-api/types/rfcdate'\nimport { useEmployeesUpdateOnboardingStatusMutation } from '@gusto/embedded-api/react-query/employeesUpdateOnboardingStatus'\nimport { invalidateEmployeesList } from '@gusto/embedded-api/react-query/employeesList'\nimport { useQueryClient } from '@gusto/embedded-api/ReactSDKProvider'\nimport { AdminPersonalDetails, AdminPersonalDetailsSchema } from './AdminPersonalDetails'\nimport { SelfPersonalDetails, SelfPersonalDetailsSchema } from './SelfPersonalDetails'\nimport { type PersonalDetailsPayload, type PersonalDetailsInputs } from './PersonalDetailsInputs'\nimport { Head } from './Head'\nimport { Actions } from './Actions'\nimport { HomeAddress, HomeAddressSchema, type HomeAddressInputs } from './HomeAddress'\nimport { WorkAddress } from './WorkAddress'\nimport { ProfileProvider } from './useProfile'\nimport { getEmployeeAddressForProfile } from './getEmployeeAddressForProfile'\nimport { Form } from '@/components/Common/Form'\nimport {\n useBase,\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n} from '@/components/Base'\nimport { useI18n } from '@/i18n'\nimport {\n componentEvents,\n EmployeeOnboardingStatus,\n EmployeeSelfOnboardingStatuses,\n} from '@/shared/constants'\nimport type { RequireAtLeastOne, WithRequired } from '@/types/Helpers'\nimport type { EmployeeOnboardingContextInterface } from '@/components/Flow/EmployeeOnboardingFlow'\nimport { useFlow } from '@/components/Flow/useFlow'\nimport { ensureRequired } from '@/helpers/ensureRequired'\n\nexport type ProfileDefaultValues = RequireAtLeastOne<{\n employee?: RequireAtLeastOne<{\n firstName?: string\n middleInitial?: string\n lastName?: string\n email?: string\n dateOfBirth?: string\n }>\n homeAddress?: RequireAtLeastOne<{\n street1?: string\n street2?: string\n city?: string\n state?: string\n zip?: string\n }>\n}>\ninterface ProfileProps extends CommonComponentInterface {\n employeeId?: string\n companyId: string\n defaultValues?: ProfileDefaultValues\n isAdmin?: boolean\n isSelfOnboardingEnabled?: boolean\n}\n\ninterface ProfileConditionalProps {\n employee?: Employee\n homeAddresses?: EmployeeAddress[]\n workAddresses?: EmployeeWorkAddress[]\n}\n\nexport function Profile(props: ProfileProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n {props.employeeId ? (\n <RootWithEmployee {...props} employeeId={props.employeeId}>\n {props.children}\n </RootWithEmployee>\n ) : (\n <Root {...props}>{props.children}</Root>\n )}\n </BaseComponent>\n )\n}\n\n/**Accounting for conditional logic where employee data needs to be fetched only if employeeId is present */\nfunction RootWithEmployee({ employeeId, ...props }: WithRequired<ProfileProps, 'employeeId'>) {\n const {\n data: { employee },\n } = useEmployeesGetSuspense({ employeeId })\n const {\n data: { employeeAddressList },\n } = useEmployeeAddressesGetSuspense({ employeeId })\n const {\n data: { employeeWorkAddressList },\n } = useEmployeeAddressesGetWorkAddressesSuspense({ employeeId })\n return (\n <Root\n {...props}\n employee={employee}\n homeAddresses={employeeAddressList}\n workAddresses={employeeWorkAddressList}\n />\n )\n}\n\nconst Root = ({\n isAdmin = false,\n isSelfOnboardingEnabled = true,\n ...props\n}: ProfileProps & ProfileConditionalProps) => {\n useI18n('Employee.Profile')\n useI18n('Employee.HomeAddress')\n const {\n companyId,\n employee,\n homeAddresses,\n workAddresses,\n children,\n className = '',\n defaultValues,\n } = props\n const { onEvent, baseSubmitHandler } = useBase()\n const queryClient = useQueryClient()\n\n const { data } = useLocationsGetSuspense({ companyId })\n const companyLocations = data.locationList!\n\n const { mutateAsync: createEmployee, isPending: isPendingCreateEmployee } =\n useEmployeesCreateMutation()\n const { mutateAsync: mutateEmployee, isPending: isPendingEmployeeUpdate } =\n useEmployeesUpdateMutation()\n\n const { mutateAsync: createEmployeeWorkAddress, isPending: isPendingCreateWA } =\n useEmployeeAddressesCreateWorkAddressMutation()\n const { mutateAsync: mutateEmployeeWorkAddress, isPending: isPendingWorkAddressUpdate } =\n useEmployeeAddressesUpdateWorkAddressMutation()\n\n const { mutateAsync: createEmployeeHomeAddress, isPending: isPendingAddHA } =\n useEmployeeAddressesCreateMutation()\n const { mutateAsync: mutateEmployeeHomeAddress, isPending: isPendingUpdateHA } =\n useEmployeeAddressesUpdateMutation()\n\n const {\n mutateAsync: updateEmployeeOnboardingStatus,\n isPending: isPendingUpdateOnboardingStatus,\n } = useEmployeesUpdateOnboardingStatusMutation({\n onSettled: () => invalidateEmployeesList(queryClient, [companyId]),\n })\n\n const existingData = { employee, workAddresses, homeAddresses }\n\n const currentHomeAddress = getEmployeeAddressForProfile(homeAddresses)\n\n const currentWorkAddress = existingData.workAddresses?.find(address => address.active)\n const mergedData = useRef({\n employee: existingData.employee,\n homeAddress: currentHomeAddress,\n workAddress: currentWorkAddress,\n })\n const initialValues = {\n firstName: mergedData.current.employee?.firstName ?? defaultValues?.employee?.firstName ?? '',\n middleInitial:\n mergedData.current.employee?.middleInitial ?? defaultValues?.employee?.middleInitial ?? '',\n lastName: mergedData.current.employee?.lastName ?? defaultValues?.employee?.lastName ?? '',\n workAddress: mergedData.current.workAddress?.locationUuid,\n startDate: mergedData.current.employee?.jobs?.[0]?.hireDate\n ? new Date(mergedData.current.employee.jobs[0].hireDate)\n : null, // By default employee response contains only current job - therefore jobs[0]\n email: mergedData.current.employee?.email ?? defaultValues?.employee?.email ?? '',\n dateOfBirth: mergedData.current.employee?.dateOfBirth\n ? new Date(mergedData.current.employee.dateOfBirth)\n : defaultValues?.employee?.dateOfBirth\n ? new Date(defaultValues.employee.dateOfBirth)\n : null,\n\n street1: mergedData.current.homeAddress?.street1 ?? defaultValues?.homeAddress?.street1 ?? '',\n street2: mergedData.current.homeAddress?.street2 ?? defaultValues?.homeAddress?.street2 ?? '',\n city: mergedData.current.homeAddress?.city ?? defaultValues?.homeAddress?.city ?? '',\n zip: mergedData.current.homeAddress?.zip ?? defaultValues?.homeAddress?.zip ?? '',\n state: mergedData.current.homeAddress?.state ?? defaultValues?.homeAddress?.state ?? '',\n courtesyWithholding: mergedData.current.homeAddress?.courtesyWithholding ?? false,\n }\n\n const adminDefaultValues =\n mergedData.current.employee?.onboarded ||\n mergedData.current.employee?.onboardingStatus ===\n EmployeeOnboardingStatus.ONBOARDING_COMPLETED ||\n (mergedData.current.employee?.onboardingStatus !== undefined &&\n mergedData.current.employee.onboardingStatus !==\n EmployeeOnboardingStatus.ADMIN_ONBOARDING_INCOMPLETE)\n ? { ...initialValues, enableSsn: false, selfOnboarding: true }\n : {\n ...initialValues,\n selfOnboarding: isSelfOnboardingEnabled\n ? mergedData.current.employee?.onboardingStatus\n ? // @ts-expect-error: onboarding_status during runtime can be one of self onboarding statuses\n EmployeeSelfOnboardingStatuses.has(mergedData.current.employee.onboarding_status)\n : false\n : false,\n enableSsn: !mergedData.current.employee?.hasSsn,\n ssn: '',\n } // In edit mode ssn is submitted only if it has been modified\n\n const selfDetaultValues = {\n ...initialValues,\n enableSsn: !mergedData.current.employee?.hasSsn,\n ssn: '',\n }\n\n const formMethods = useForm<\n PersonalDetailsInputs & HomeAddressInputs,\n unknown,\n PersonalDetailsPayload & HomeAddressInputs\n >({\n resolver: valibotResolver(\n v.intersect([\n isAdmin ? AdminPersonalDetailsSchema : SelfPersonalDetailsSchema,\n HomeAddressSchema,\n ]),\n ),\n defaultValues: isAdmin ? adminDefaultValues : selfDetaultValues,\n })\n\n const { handleSubmit } = formMethods\n const watchedSelfOnboarding = useWatch({ control: formMethods.control, name: 'selfOnboarding' })\n\n const onSubmit: SubmitHandler<PersonalDetailsPayload & HomeAddressInputs> = async data => {\n await baseSubmitHandler(data, async payload => {\n const { workAddress, startDate, selfOnboarding, ...body } = payload\n //create or update employee\n if (!mergedData.current.employee) {\n const { employee: employeeData } = await createEmployee({\n request: {\n companyId,\n requestBody: { ...body, selfOnboarding },\n },\n })\n mergedData.current = { ...mergedData.current, employee: employeeData }\n onEvent(componentEvents.EMPLOYEE_CREATED, employeeData)\n } else {\n // Updating self-onboarding status\n if (\n (selfOnboarding &&\n mergedData.current.employee.onboardingStatus ===\n EmployeeOnboardingStatus.ADMIN_ONBOARDING_INCOMPLETE) ||\n (!selfOnboarding &&\n mergedData.current.employee.onboardingStatus ===\n EmployeeOnboardingStatus.SELF_ONBOARDING_PENDING_INVITE)\n ) {\n const { employeeOnboardingStatus } = await updateEmployeeOnboardingStatus({\n request: {\n employeeId: mergedData.current.employee.uuid,\n requestBody: {\n onboardingStatus: selfOnboarding\n ? EmployeeOnboardingStatus.SELF_ONBOARDING_PENDING_INVITE\n : EmployeeOnboardingStatus.ADMIN_ONBOARDING_INCOMPLETE,\n },\n },\n })\n mergedData.current.employee = {\n ...mergedData.current.employee,\n onboardingStatus: employeeOnboardingStatus!\n .onboardingStatus as (typeof EmployeeOnboardingStatus)[keyof typeof EmployeeOnboardingStatus],\n }\n onEvent(componentEvents.EMPLOYEE_ONBOARDING_STATUS_UPDATED, employeeOnboardingStatus)\n }\n const { employee: employeeData } = await mutateEmployee({\n request: {\n employeeId: mergedData.current.employee.uuid,\n requestBody: { ...body, version: mergedData.current.employee.version as string },\n },\n })\n mergedData.current = { ...mergedData.current, employee: employeeData }\n onEvent(componentEvents.EMPLOYEE_UPDATED, employeeData)\n }\n if (typeof mergedData.current.employee?.uuid !== 'string') {\n throw new Error('Employee id is not available')\n }\n //create or update home address - only if not intended for self onboarding\n if (!watchedSelfOnboarding || !isAdmin) {\n //typeguard: in this scenario payload will contain address information\n if (!payload.selfOnboarding) {\n const { street1, street2, city, state, zip, courtesyWithholding } = payload\n if (!mergedData.current.homeAddress) {\n // Creating home address - for new employee effective_date is the same as work start date\n const { employeeAddress } = await createEmployeeHomeAddress({\n request: {\n employeeId: mergedData.current.employee.uuid,\n requestBody: {\n street1,\n street2,\n city,\n state,\n zip,\n courtesyWithholding,\n },\n },\n })\n mergedData.current = { ...mergedData.current, homeAddress: employeeAddress }\n onEvent(componentEvents.EMPLOYEE_HOME_ADDRESS_CREATED, employeeAddress)\n } else {\n const { employeeAddress } = await mutateEmployeeHomeAddress({\n request: {\n homeAddressUuid: mergedData.current.homeAddress.uuid as string,\n requestBody: {\n version: mergedData.current.homeAddress.version as string,\n street1,\n street2,\n city,\n state,\n zip,\n courtesyWithholding,\n },\n },\n })\n mergedData.current = { ...mergedData.current, homeAddress: employeeAddress }\n onEvent(componentEvents.EMPLOYEE_HOME_ADDRESS_UPDATED, employeeAddress)\n }\n }\n }\n\n if (isAdmin) {\n //create or update workaddress\n if (!mergedData.current.workAddress) {\n const { employeeWorkAddress } = await createEmployeeWorkAddress({\n request: {\n employeeId: mergedData.current.employee?.uuid as string,\n requestBody: {\n locationUuid: workAddress,\n effectiveDate: new RFCDate(payload.startDate || new Date()),\n },\n },\n })\n\n mergedData.current = { ...mergedData.current, workAddress: employeeWorkAddress }\n onEvent(componentEvents.EMPLOYEE_WORK_ADDRESS_CREATED, employeeWorkAddress)\n } else {\n //effective_date is excluded from update operation since it cannot be changed on initial work address\n const { employeeWorkAddress } = await mutateEmployeeWorkAddress({\n request: {\n workAddressUuid: mergedData.current.workAddress.uuid,\n requestBody: {\n version: mergedData.current.workAddress.version,\n locationUuid: workAddress,\n },\n },\n })\n mergedData.current = { ...mergedData.current, workAddress: employeeWorkAddress }\n onEvent(componentEvents.EMPLOYEE_WORK_ADDRESS_UPDATED, employeeWorkAddress)\n }\n }\n\n onEvent(componentEvents.EMPLOYEE_PROFILE_DONE, {\n ...mergedData.current.employee,\n startDate,\n })\n })\n }\n\n const handleCancel = () => {\n onEvent(componentEvents.CANCEL)\n }\n return (\n <section className={className}>\n <ProfileProvider\n value={{\n companyLocations,\n workAddresses,\n employee: mergedData.current.employee ?? undefined,\n isSelfOnboardingIntended: watchedSelfOnboarding,\n handleCancel,\n isAdmin,\n isSelfOnboardingEnabled,\n isPending:\n isPendingEmployeeUpdate ||\n isPendingWorkAddressUpdate ||\n isPendingAddHA ||\n isPendingUpdateHA ||\n isPendingCreateEmployee ||\n isPendingCreateWA ||\n isPendingUpdateOnboardingStatus,\n }}\n >\n <FormProvider {...formMethods}>\n <Form onSubmit={handleSubmit(onSubmit)}>\n {children ? (\n children\n ) : (\n <>\n <Head />\n <AdminPersonalDetails />\n <SelfPersonalDetails />\n <HomeAddress />\n <WorkAddress />\n <Actions />\n </>\n )}\n </Form>\n </FormProvider>\n </ProfileProvider>\n </section>\n )\n}\n\nProfile.Head = Head\nProfile.Actions = Actions\nProfile.AdminPersonalDetails = AdminPersonalDetails\nProfile.SelfPersonalDetails = SelfPersonalDetails\nProfile.HomeAddress = HomeAddress\nProfile.WorkAddress = WorkAddress\n\nexport const ProfileContextual = () => {\n const { companyId, employeeId, onEvent, isAdmin, defaultValues, isSelfOnboardingEnabled } =\n useFlow<EmployeeOnboardingContextInterface>()\n\n return (\n <Profile\n companyId={ensureRequired(companyId)}\n employeeId={employeeId}\n onEvent={onEvent}\n isAdmin={isAdmin}\n defaultValues={defaultValues?.profile}\n isSelfOnboardingEnabled={isSelfOnboardingEnabled}\n />\n )\n}\n"],"names":["Profile","props","jsx","BaseComponent","RootWithEmployee","Root","employeeId","employee","useEmployeesGetSuspense","employeeAddressList","useEmployeeAddressesGetSuspense","employeeWorkAddressList","useEmployeeAddressesGetWorkAddressesSuspense","isAdmin","isSelfOnboardingEnabled","useI18n","companyId","homeAddresses","workAddresses","children","className","defaultValues","onEvent","baseSubmitHandler","useBase","queryClient","useQueryClient","data","useLocationsGetSuspense","companyLocations","createEmployee","isPendingCreateEmployee","useEmployeesCreateMutation","mutateEmployee","isPendingEmployeeUpdate","useEmployeesUpdateMutation","createEmployeeWorkAddress","isPendingCreateWA","useEmployeeAddressesCreateWorkAddressMutation","mutateEmployeeWorkAddress","isPendingWorkAddressUpdate","useEmployeeAddressesUpdateWorkAddressMutation","createEmployeeHomeAddress","isPendingAddHA","useEmployeeAddressesCreateMutation","mutateEmployeeHomeAddress","isPendingUpdateHA","useEmployeeAddressesUpdateMutation","updateEmployeeOnboardingStatus","isPendingUpdateOnboardingStatus","useEmployeesUpdateOnboardingStatusMutation","invalidateEmployeesList","existingData","currentHomeAddress","getEmployeeAddressForProfile","currentWorkAddress","address","mergedData","useRef","initialValues","adminDefaultValues","EmployeeOnboardingStatus","EmployeeSelfOnboardingStatuses","selfDetaultValues","formMethods","useForm","valibotResolver","v","AdminPersonalDetailsSchema","SelfPersonalDetailsSchema","HomeAddressSchema","handleSubmit","watchedSelfOnboarding","useWatch","onSubmit","payload","workAddress","startDate","selfOnboarding","body","employeeOnboardingStatus","componentEvents","employeeData","street1","street2","city","state","zip","courtesyWithholding","employeeAddress","employeeWorkAddress","RFCDate","handleCancel","ProfileProvider","FormProvider","Form","jsxs","Fragment","Head","AdminPersonalDetails","SelfPersonalDetails","HomeAddress","WorkAddress","Actions","ProfileContextual","useFlow","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;AAAA,QACA,eAAAX;AAAA,QACA,UAAUuC,EAAW,QAAQ,YAAY;AAAA,QACzC,0BAA0Be;AAAA,QAC1B,cAAAoB;AAAA,QACA,SAAA/E;AAAA,QACA,yBAAAC;AAAA,QACA,WACEoB,KACAM,KACAG,KACAG,MACAf,KACAM,KACAY;AAAA,MACJ;AAAA,MAEA,UAAC,gBAAA/C,EAAA4F,IAAA,EAAc,GAAG9B,GAChB,UAAC,gBAAA9D,EAAA6F,IAAA,EAAK,UAAUxB,GAAaG,EAAQ,GAClC,UACCvD,KAGE,gBAAA6E,GAAAC,IAAA,EAAA,UAAA;AAAA,QAAA,gBAAA/F,EAACgG,GAAK,EAAA;AAAA,0BACLC,GAAqB,EAAA;AAAA,0BACrBC,GAAoB,EAAA;AAAA,0BACpBC,GAAY,EAAA;AAAA,0BACZC,GAAY,EAAA;AAAA,0BACZC,GAAQ,CAAA,CAAA;AAAA,MAAA,EACX,CAAA,EAEJ,CAAA,EACF,CAAA;AAAA,IAAA;AAAA,EAAA,GAEJ;AAEJ;AAEAvG,EAAQ,OAAOkG;AACflG,EAAQ,UAAUuG;AAClBvG,EAAQ,uBAAuBmG;AAC/BnG,EAAQ,sBAAsBoG;AAC9BpG,EAAQ,cAAcqG;AACtBrG,EAAQ,cAAcsG;AAEf,MAAME,KAAoB,MAAM;AAC/B,QAAA,EAAE,WAAAxF,GAAW,YAAAV,GAAY,SAAAgB,GAAS,SAAAT,GAAS,eAAAQ,GAAe,yBAAAP,MAC9D2F,GAA4C;AAG5C,SAAA,gBAAAvG;AAAA,IAACF;AAAA,IAAA;AAAA,MACC,WAAW0G,GAAe1F,CAAS;AAAA,MACnC,YAAAV;AAAA,MACA,SAAAgB;AAAA,MACA,SAAAT;AAAA,MACA,eAAeQ,GAAe;AAAA,MAC9B,yBAAAP;AAAA,IAAA;AAAA,EACF;AAEJ;"}
1
+ {"version":3,"file":"Profile.js","sources":["../../../../src/components/Employee/Profile/Profile.tsx"],"sourcesContent":["import { zodResolver } from '@hookform/resolvers/zod'\nimport { useRef } from 'react'\nimport type { SubmitHandler } from 'react-hook-form'\nimport { FormProvider, useForm, useWatch } from 'react-hook-form'\nimport { useLocationsGetSuspense } from '@gusto/embedded-api/react-query/locationsGet'\nimport { useEmployeesCreateMutation } from '@gusto/embedded-api/react-query/employeesCreate'\nimport { useEmployeesGetSuspense } from '@gusto/embedded-api/react-query/employeesGet'\nimport { type Employee } from '@gusto/embedded-api/models/components/employee'\nimport { useEmployeeAddressesGetSuspense } from '@gusto/embedded-api/react-query/employeeAddressesGet'\nimport { type EmployeeAddress } from '@gusto/embedded-api/models/components/employeeaddress'\nimport { useEmployeeAddressesCreateMutation } from '@gusto/embedded-api/react-query/employeeAddressesCreate'\nimport { useEmployeeAddressesUpdateMutation } from '@gusto/embedded-api/react-query/employeeAddressesUpdate'\nimport { useEmployeeAddressesUpdateWorkAddressMutation } from '@gusto/embedded-api/react-query/employeeAddressesUpdateWorkAddress'\nimport { useEmployeesUpdateMutation } from '@gusto/embedded-api/react-query/employeesUpdate'\nimport { useEmployeeAddressesGetWorkAddressesSuspense } from '@gusto/embedded-api/react-query/employeeAddressesGetWorkAddresses'\nimport type { EmployeeWorkAddress } from '@gusto/embedded-api/models/components/employeeworkaddress'\nimport { useEmployeeAddressesCreateWorkAddressMutation } from '@gusto/embedded-api/react-query/employeeAddressesCreateWorkAddress'\nimport { RFCDate } from '@gusto/embedded-api/types/rfcdate'\nimport { useEmployeesUpdateOnboardingStatusMutation } from '@gusto/embedded-api/react-query/employeesUpdateOnboardingStatus'\nimport { invalidateEmployeesList } from '@gusto/embedded-api/react-query/employeesList'\nimport { useQueryClient } from '@tanstack/react-query'\nimport { AdminPersonalDetails, AdminPersonalDetailsSchema } from './AdminPersonalDetails'\nimport { SelfPersonalDetails, SelfPersonalDetailsSchema } from './SelfPersonalDetails'\nimport { type PersonalDetailsPayload, type PersonalDetailsInputs } from './PersonalDetailsInputs'\nimport { Head } from './Head'\nimport { Actions } from './Actions'\nimport { HomeAddress, HomeAddressSchema, type HomeAddressInputs } from './HomeAddress'\nimport { WorkAddress } from './WorkAddress'\nimport { ProfileProvider } from './useProfile'\nimport { getEmployeeAddressForProfile } from './getEmployeeAddressForProfile'\nimport { Form } from '@/components/Common/Form'\nimport {\n useBase,\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n} from '@/components/Base'\nimport { useI18n } from '@/i18n'\nimport {\n componentEvents,\n EmployeeOnboardingStatus,\n EmployeeSelfOnboardingStatuses,\n} from '@/shared/constants'\nimport type { RequireAtLeastOne, WithRequired } from '@/types/Helpers'\nimport type { EmployeeOnboardingContextInterface } from '@/components/Flow/EmployeeOnboardingFlow'\nimport { useFlow } from '@/components/Flow/useFlow'\nimport { ensureRequired } from '@/helpers/ensureRequired'\n\nexport type ProfileDefaultValues = RequireAtLeastOne<{\n employee?: RequireAtLeastOne<{\n firstName?: string\n middleInitial?: string\n lastName?: string\n email?: string\n dateOfBirth?: string\n }>\n homeAddress?: RequireAtLeastOne<{\n street1?: string\n street2?: string\n city?: string\n state?: string\n zip?: string\n }>\n}>\ninterface ProfileProps extends CommonComponentInterface {\n employeeId?: string\n companyId: string\n defaultValues?: ProfileDefaultValues\n isAdmin?: boolean\n isSelfOnboardingEnabled?: boolean\n}\n\ninterface ProfileConditionalProps {\n employee?: Employee\n homeAddresses?: EmployeeAddress[]\n workAddresses?: EmployeeWorkAddress[]\n}\n\nexport function Profile(props: ProfileProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n {props.employeeId ? (\n <RootWithEmployee {...props} employeeId={props.employeeId}>\n {props.children}\n </RootWithEmployee>\n ) : (\n <Root {...props}>{props.children}</Root>\n )}\n </BaseComponent>\n )\n}\n\n/**Accounting for conditional logic where employee data needs to be fetched only if employeeId is present */\nfunction RootWithEmployee({ employeeId, ...props }: WithRequired<ProfileProps, 'employeeId'>) {\n const {\n data: { employee },\n } = useEmployeesGetSuspense({ employeeId })\n const {\n data: { employeeAddressList },\n } = useEmployeeAddressesGetSuspense({ employeeId })\n const {\n data: { employeeWorkAddressList },\n } = useEmployeeAddressesGetWorkAddressesSuspense({ employeeId })\n return (\n <Root\n {...props}\n employee={employee}\n homeAddresses={employeeAddressList}\n workAddresses={employeeWorkAddressList}\n />\n )\n}\n\nconst Root = ({\n isAdmin = false,\n isSelfOnboardingEnabled = true,\n ...props\n}: ProfileProps & ProfileConditionalProps) => {\n useI18n('Employee.Profile')\n useI18n('Employee.HomeAddress')\n const {\n companyId,\n employee,\n homeAddresses,\n workAddresses,\n children,\n className = '',\n defaultValues,\n } = props\n const { onEvent, baseSubmitHandler } = useBase()\n const queryClient = useQueryClient()\n\n const { data } = useLocationsGetSuspense({ companyId })\n const companyLocations = data.locationList!\n\n const { mutateAsync: createEmployee, isPending: isPendingCreateEmployee } =\n useEmployeesCreateMutation()\n const { mutateAsync: mutateEmployee, isPending: isPendingEmployeeUpdate } =\n useEmployeesUpdateMutation()\n\n const { mutateAsync: createEmployeeWorkAddress, isPending: isPendingCreateWA } =\n useEmployeeAddressesCreateWorkAddressMutation()\n const { mutateAsync: mutateEmployeeWorkAddress, isPending: isPendingWorkAddressUpdate } =\n useEmployeeAddressesUpdateWorkAddressMutation()\n\n const { mutateAsync: createEmployeeHomeAddress, isPending: isPendingAddHA } =\n useEmployeeAddressesCreateMutation()\n const { mutateAsync: mutateEmployeeHomeAddress, isPending: isPendingUpdateHA } =\n useEmployeeAddressesUpdateMutation()\n\n const {\n mutateAsync: updateEmployeeOnboardingStatus,\n isPending: isPendingUpdateOnboardingStatus,\n } = useEmployeesUpdateOnboardingStatusMutation({\n onSettled: () => invalidateEmployeesList(queryClient, [companyId]),\n })\n\n const existingData = { employee, workAddresses, homeAddresses }\n\n const currentHomeAddress = getEmployeeAddressForProfile(homeAddresses)\n\n const currentWorkAddress = existingData.workAddresses?.find(address => address.active)\n const mergedData = useRef({\n employee: existingData.employee,\n homeAddress: currentHomeAddress,\n workAddress: currentWorkAddress,\n })\n const initialValues = {\n firstName: mergedData.current.employee?.firstName ?? defaultValues?.employee?.firstName ?? '',\n middleInitial:\n mergedData.current.employee?.middleInitial ?? defaultValues?.employee?.middleInitial ?? '',\n lastName: mergedData.current.employee?.lastName ?? defaultValues?.employee?.lastName ?? '',\n workAddress: mergedData.current.workAddress?.locationUuid,\n startDate: mergedData.current.employee?.jobs?.[0]?.hireDate\n ? new Date(mergedData.current.employee.jobs[0].hireDate)\n : null, // By default employee response contains only current job - therefore jobs[0]\n email: mergedData.current.employee?.email ?? defaultValues?.employee?.email ?? '',\n dateOfBirth: mergedData.current.employee?.dateOfBirth\n ? new Date(mergedData.current.employee.dateOfBirth)\n : defaultValues?.employee?.dateOfBirth\n ? new Date(defaultValues.employee.dateOfBirth)\n : null,\n\n street1: mergedData.current.homeAddress?.street1 ?? defaultValues?.homeAddress?.street1 ?? '',\n street2: mergedData.current.homeAddress?.street2 ?? defaultValues?.homeAddress?.street2 ?? '',\n city: mergedData.current.homeAddress?.city ?? defaultValues?.homeAddress?.city ?? '',\n zip: mergedData.current.homeAddress?.zip ?? defaultValues?.homeAddress?.zip ?? '',\n state: mergedData.current.homeAddress?.state ?? defaultValues?.homeAddress?.state ?? '',\n courtesyWithholding: mergedData.current.homeAddress?.courtesyWithholding ?? false,\n }\n\n const adminDefaultValues =\n mergedData.current.employee?.onboarded ||\n mergedData.current.employee?.onboardingStatus ===\n EmployeeOnboardingStatus.ONBOARDING_COMPLETED ||\n (mergedData.current.employee?.onboardingStatus !== undefined &&\n mergedData.current.employee.onboardingStatus !==\n EmployeeOnboardingStatus.ADMIN_ONBOARDING_INCOMPLETE)\n ? { ...initialValues, enableSsn: false, selfOnboarding: true }\n : {\n ...initialValues,\n selfOnboarding: isSelfOnboardingEnabled\n ? mergedData.current.employee?.onboardingStatus\n ? // @ts-expect-error: onboarding_status during runtime can be one of self onboarding statuses\n EmployeeSelfOnboardingStatuses.has(mergedData.current.employee.onboarding_status)\n : false\n : false,\n enableSsn: !mergedData.current.employee?.hasSsn,\n ssn: '',\n } // In edit mode ssn is submitted only if it has been modified\n\n const selfDetaultValues = {\n ...initialValues,\n enableSsn: !mergedData.current.employee?.hasSsn,\n ssn: '',\n }\n\n const formMethods = useForm<\n PersonalDetailsInputs & HomeAddressInputs,\n unknown,\n PersonalDetailsPayload & HomeAddressInputs\n >({\n resolver: zodResolver(\n (isAdmin ? AdminPersonalDetailsSchema : SelfPersonalDetailsSchema).and(HomeAddressSchema),\n ),\n defaultValues: isAdmin ? adminDefaultValues : selfDetaultValues,\n })\n\n const { handleSubmit } = formMethods\n const watchedSelfOnboarding = useWatch({ control: formMethods.control, name: 'selfOnboarding' })\n\n const onSubmit: SubmitHandler<PersonalDetailsPayload & HomeAddressInputs> = async data => {\n await baseSubmitHandler(data, async payload => {\n const { workAddress, startDate, selfOnboarding, ...body } = payload\n //create or update employee\n if (!mergedData.current.employee) {\n const { employee: employeeData } = await createEmployee({\n request: {\n companyId,\n requestBody: { ...body, selfOnboarding },\n },\n })\n mergedData.current = { ...mergedData.current, employee: employeeData }\n onEvent(componentEvents.EMPLOYEE_CREATED, employeeData)\n } else {\n // Updating self-onboarding status\n if (\n (selfOnboarding &&\n mergedData.current.employee.onboardingStatus ===\n EmployeeOnboardingStatus.ADMIN_ONBOARDING_INCOMPLETE) ||\n (!selfOnboarding &&\n mergedData.current.employee.onboardingStatus ===\n EmployeeOnboardingStatus.SELF_ONBOARDING_PENDING_INVITE)\n ) {\n const { employeeOnboardingStatus } = await updateEmployeeOnboardingStatus({\n request: {\n employeeId: mergedData.current.employee.uuid,\n requestBody: {\n onboardingStatus: selfOnboarding\n ? EmployeeOnboardingStatus.SELF_ONBOARDING_PENDING_INVITE\n : EmployeeOnboardingStatus.ADMIN_ONBOARDING_INCOMPLETE,\n },\n },\n })\n mergedData.current.employee = {\n ...mergedData.current.employee,\n onboardingStatus: employeeOnboardingStatus!\n .onboardingStatus as (typeof EmployeeOnboardingStatus)[keyof typeof EmployeeOnboardingStatus],\n }\n onEvent(componentEvents.EMPLOYEE_ONBOARDING_STATUS_UPDATED, employeeOnboardingStatus)\n }\n const { employee: employeeData } = await mutateEmployee({\n request: {\n employeeId: mergedData.current.employee.uuid,\n requestBody: { ...body, version: mergedData.current.employee.version as string },\n },\n })\n mergedData.current = { ...mergedData.current, employee: employeeData }\n onEvent(componentEvents.EMPLOYEE_UPDATED, employeeData)\n }\n if (typeof mergedData.current.employee?.uuid !== 'string') {\n throw new Error('Employee id is not available')\n }\n //create or update home address - only if not intended for self onboarding\n if (!watchedSelfOnboarding || !isAdmin) {\n //typeguard: in this scenario payload will contain address information\n if (!payload.selfOnboarding) {\n const { street1, street2, city, state, zip, courtesyWithholding } = payload\n if (!mergedData.current.homeAddress) {\n // Creating home address - for new employee effective_date is the same as work start date\n const { employeeAddress } = await createEmployeeHomeAddress({\n request: {\n employeeId: mergedData.current.employee.uuid,\n requestBody: {\n street1,\n street2,\n city,\n state,\n zip,\n courtesyWithholding,\n },\n },\n })\n mergedData.current = { ...mergedData.current, homeAddress: employeeAddress }\n onEvent(componentEvents.EMPLOYEE_HOME_ADDRESS_CREATED, employeeAddress)\n } else {\n const { employeeAddress } = await mutateEmployeeHomeAddress({\n request: {\n homeAddressUuid: mergedData.current.homeAddress.uuid as string,\n requestBody: {\n version: mergedData.current.homeAddress.version as string,\n street1,\n street2,\n city,\n state,\n zip,\n courtesyWithholding,\n },\n },\n })\n mergedData.current = { ...mergedData.current, homeAddress: employeeAddress }\n onEvent(componentEvents.EMPLOYEE_HOME_ADDRESS_UPDATED, employeeAddress)\n }\n }\n }\n\n if (isAdmin) {\n //create or update workaddress\n if (!mergedData.current.workAddress) {\n const { employeeWorkAddress } = await createEmployeeWorkAddress({\n request: {\n employeeId: mergedData.current.employee?.uuid as string,\n requestBody: {\n locationUuid: workAddress,\n effectiveDate: new RFCDate(payload.startDate || new Date()),\n },\n },\n })\n\n mergedData.current = { ...mergedData.current, workAddress: employeeWorkAddress }\n onEvent(componentEvents.EMPLOYEE_WORK_ADDRESS_CREATED, employeeWorkAddress)\n } else {\n //effective_date is excluded from update operation since it cannot be changed on initial work address\n const { employeeWorkAddress } = await mutateEmployeeWorkAddress({\n request: {\n workAddressUuid: mergedData.current.workAddress.uuid,\n requestBody: {\n version: mergedData.current.workAddress.version,\n locationUuid: workAddress,\n },\n },\n })\n mergedData.current = { ...mergedData.current, workAddress: employeeWorkAddress }\n onEvent(componentEvents.EMPLOYEE_WORK_ADDRESS_UPDATED, employeeWorkAddress)\n }\n }\n\n onEvent(componentEvents.EMPLOYEE_PROFILE_DONE, {\n ...mergedData.current.employee,\n startDate,\n })\n })\n }\n\n const handleCancel = () => {\n onEvent(componentEvents.CANCEL)\n }\n return (\n <section className={className}>\n <ProfileProvider\n value={{\n companyLocations,\n workAddresses,\n employee: mergedData.current.employee ?? undefined,\n isSelfOnboardingIntended: watchedSelfOnboarding,\n handleCancel,\n isAdmin,\n isSelfOnboardingEnabled,\n isPending:\n isPendingEmployeeUpdate ||\n isPendingWorkAddressUpdate ||\n isPendingAddHA ||\n isPendingUpdateHA ||\n isPendingCreateEmployee ||\n isPendingCreateWA ||\n isPendingUpdateOnboardingStatus,\n }}\n >\n <FormProvider {...formMethods}>\n <Form onSubmit={handleSubmit(onSubmit)}>\n {children ? (\n children\n ) : (\n <>\n <Head />\n <AdminPersonalDetails />\n <SelfPersonalDetails />\n <HomeAddress />\n <WorkAddress />\n <Actions />\n </>\n )}\n </Form>\n </FormProvider>\n </ProfileProvider>\n </section>\n )\n}\n\nProfile.Head = Head\nProfile.Actions = Actions\nProfile.AdminPersonalDetails = AdminPersonalDetails\nProfile.SelfPersonalDetails = SelfPersonalDetails\nProfile.HomeAddress = HomeAddress\nProfile.WorkAddress = WorkAddress\n\nexport const ProfileContextual = () => {\n const { companyId, employeeId, onEvent, isAdmin, defaultValues, isSelfOnboardingEnabled } =\n useFlow<EmployeeOnboardingContextInterface>()\n\n return (\n <Profile\n companyId={ensureRequired(companyId)}\n employeeId={employeeId}\n onEvent={onEvent}\n isAdmin={isAdmin}\n defaultValues={defaultValues?.profile}\n isSelfOnboardingEnabled={isSelfOnboardingEnabled}\n />\n )\n}\n"],"names":["Profile","props","jsx","BaseComponent","RootWithEmployee","Root","employeeId","employee","useEmployeesGetSuspense","employeeAddressList","useEmployeeAddressesGetSuspense","employeeWorkAddressList","useEmployeeAddressesGetWorkAddressesSuspense","isAdmin","isSelfOnboardingEnabled","useI18n","companyId","homeAddresses","workAddresses","children","className","defaultValues","onEvent","baseSubmitHandler","useBase","queryClient","useQueryClient","data","useLocationsGetSuspense","companyLocations","createEmployee","isPendingCreateEmployee","useEmployeesCreateMutation","mutateEmployee","isPendingEmployeeUpdate","useEmployeesUpdateMutation","createEmployeeWorkAddress","isPendingCreateWA","useEmployeeAddressesCreateWorkAddressMutation","mutateEmployeeWorkAddress","isPendingWorkAddressUpdate","useEmployeeAddressesUpdateWorkAddressMutation","createEmployeeHomeAddress","isPendingAddHA","useEmployeeAddressesCreateMutation","mutateEmployeeHomeAddress","isPendingUpdateHA","useEmployeeAddressesUpdateMutation","updateEmployeeOnboardingStatus","isPendingUpdateOnboardingStatus","useEmployeesUpdateOnboardingStatusMutation","invalidateEmployeesList","existingData","currentHomeAddress","getEmployeeAddressForProfile","currentWorkAddress","address","mergedData","useRef","initialValues","adminDefaultValues","EmployeeOnboardingStatus","EmployeeSelfOnboardingStatuses","selfDetaultValues","formMethods","useForm","zodResolver","AdminPersonalDetailsSchema","SelfPersonalDetailsSchema","HomeAddressSchema","handleSubmit","watchedSelfOnboarding","useWatch","onSubmit","payload","workAddress","startDate","selfOnboarding","body","employeeOnboardingStatus","componentEvents","employeeData","street1","street2","city","state","zip","courtesyWithholding","employeeAddress","employeeWorkAddress","RFCDate","handleCancel","ProfileProvider","FormProvider","Form","jsxs","Fragment","Head","AdminPersonalDetails","SelfPersonalDetails","HomeAddress","WorkAddress","Actions","ProfileContextual","useFlow","ensureRequired"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8EO,SAASA,EAAQC,G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AA9E;AAAA,QACA,yBAAAC;AAAA,QACA,WACEoB,KACAM,KACAG,KACAG,MACAf,KACAM,KACAY;AAAA,MACJ;AAAA,MAEA,UAAC,gBAAA/C,EAAA2F,IAAA,EAAc,GAAG7B,GAChB,UAAC,gBAAA9D,EAAA4F,IAAA,EAAK,UAAUxB,GAAaG,EAAQ,GAClC,UACCtD,KAGE,gBAAA4E,GAAAC,IAAA,EAAA,UAAA;AAAA,QAAA,gBAAA9F,EAAC+F,GAAK,EAAA;AAAA,0BACLC,GAAqB,EAAA;AAAA,0BACrBC,GAAoB,EAAA;AAAA,0BACpBC,GAAY,EAAA;AAAA,0BACZC,GAAY,EAAA;AAAA,0BACZC,GAAQ,CAAA,CAAA;AAAA,MAAA,EACX,CAAA,EAEJ,CAAA,EACF,CAAA;AAAA,IAAA;AAAA,EAAA,GAEJ;AAEJ;AAEAtG,EAAQ,OAAOiG;AACfjG,EAAQ,UAAUsG;AAClBtG,EAAQ,uBAAuBkG;AAC/BlG,EAAQ,sBAAsBmG;AAC9BnG,EAAQ,cAAcoG;AACtBpG,EAAQ,cAAcqG;AAEf,MAAME,KAAoB,MAAM;AAC/B,QAAA,EAAE,WAAAvF,GAAW,YAAAV,GAAY,SAAAgB,GAAS,SAAAT,GAAS,eAAAQ,GAAe,yBAAAP,MAC9D0F,GAA4C;AAG5C,SAAA,gBAAAtG;AAAA,IAACF;AAAA,IAAA;AAAA,MACC,WAAWyG,GAAezF,CAAS;AAAA,MACnC,YAAAV;AAAA,MACA,SAAAgB;AAAA,MACA,SAAAT;AAAA,MACA,eAAeQ,GAAe;AAAA,MAC9B,yBAAAP;AAAA,IAAA;AAAA,EACF;AAEJ;"}
@@ -1,16 +1,45 @@
1
- import * as v from 'valibot';
2
- export declare const SelfPersonalDetailsSchema: v.VariantSchema<"enableSsn", [v.ObjectSchema<{
3
- readonly enableSsn: v.LiteralSchema<true, undefined>;
4
- readonly dateOfBirth: v.SchemaWithPipe<[v.InstanceSchema<DateConstructor, undefined>, v.TransformAction<Date, string | undefined>]>;
5
- readonly ssn: v.SchemaWithPipe<[v.StringSchema<undefined>, v.TransformAction<string, string>, v.CheckAction<string, undefined>]>;
6
- readonly firstName: v.SchemaWithPipe<[v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.RegexAction<string, undefined>]>;
7
- readonly middleInitial: v.OptionalSchema<v.StringSchema<undefined>, never>;
8
- readonly lastName: v.SchemaWithPipe<[v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.RegexAction<string, undefined>]>;
9
- }, undefined>, v.ObjectSchema<{
10
- readonly enableSsn: v.LiteralSchema<false, undefined>;
11
- readonly dateOfBirth: v.SchemaWithPipe<[v.InstanceSchema<DateConstructor, undefined>, v.TransformAction<Date, string | undefined>]>;
12
- readonly firstName: v.SchemaWithPipe<[v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.RegexAction<string, undefined>]>;
13
- readonly middleInitial: v.OptionalSchema<v.StringSchema<undefined>, never>;
14
- readonly lastName: v.SchemaWithPipe<[v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.RegexAction<string, undefined>]>;
15
- }, undefined>], undefined>;
1
+ import { z } from 'zod';
2
+ export declare const SelfPersonalDetailsSchema: z.ZodDiscriminatedUnion<"enableSsn", [z.ZodObject<{
3
+ firstName: z.ZodString;
4
+ middleInitial: z.ZodOptional<z.ZodString>;
5
+ lastName: z.ZodString;
6
+ ssn: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
7
+ dateOfBirth: z.ZodEffects<z.ZodDate, string | undefined, Date>;
8
+ } & {
9
+ enableSsn: z.ZodLiteral<true>;
10
+ }, "strip", z.ZodTypeAny, {
11
+ ssn: string;
12
+ firstName: string;
13
+ lastName: string;
14
+ enableSsn: true;
15
+ middleInitial?: string | undefined;
16
+ dateOfBirth?: string | undefined;
17
+ }, {
18
+ ssn: string;
19
+ firstName: string;
20
+ lastName: string;
21
+ dateOfBirth: Date;
22
+ enableSsn: true;
23
+ middleInitial?: string | undefined;
24
+ }>, z.ZodObject<{
25
+ firstName: z.ZodString;
26
+ middleInitial: z.ZodOptional<z.ZodString>;
27
+ lastName: z.ZodString;
28
+ } & {
29
+ dateOfBirth: z.ZodEffects<z.ZodDate, string | undefined, Date>;
30
+ } & {
31
+ enableSsn: z.ZodLiteral<false>;
32
+ }, "strip", z.ZodTypeAny, {
33
+ firstName: string;
34
+ lastName: string;
35
+ enableSsn: false;
36
+ middleInitial?: string | undefined;
37
+ dateOfBirth?: string | undefined;
38
+ }, {
39
+ firstName: string;
40
+ lastName: string;
41
+ dateOfBirth: Date;
42
+ enableSsn: false;
43
+ middleInitial?: string | undefined;
44
+ }>]>;
16
45
  export declare const SelfPersonalDetails: () => import("react/jsx-runtime").JSX.Element | null;
@@ -1,29 +1,26 @@
1
- import { jsxs as s, Fragment as l, jsx as t } from "react/jsx-runtime";
2
- import * as e from "valibot";
3
- import { DateOfBirthSchema as r, SocialSecurityNumberSchema as o, NameInputsSchema as n, NameInputs as m, SocialSecurityNumberInput as c, DateOfBirthInput as u } from "./PersonalDetailsInputs.js";
1
+ import { jsxs as a, Fragment as l, jsx as e } from "react/jsx-runtime";
2
+ import { z as r } from "zod";
3
+ import { NameInputsSchema as t, SocialSecurityNumberSchema as o, DateOfBirthSchema as n, NameInputs as s, SocialSecurityNumberInput as c, DateOfBirthInput as u } from "./PersonalDetailsInputs.js";
4
4
  import { useProfile as S } from "./useProfile.js";
5
- const h = e.variant("enableSsn", [
6
- e.object({
7
- ...n.entries,
8
- ...o.entries,
9
- ...r.entries,
10
- enableSsn: e.literal(!0)
5
+ const b = r.discriminatedUnion("enableSsn", [
6
+ // Case 1: enableSsn is true
7
+ t.merge(o).merge(n).extend({
8
+ enableSsn: r.literal(!0)
11
9
  }),
12
- e.object({
13
- ...n.entries,
14
- ...r.entries,
15
- enableSsn: e.literal(!1)
10
+ // Case 2: enableSsn is false
11
+ t.merge(n).extend({
12
+ enableSsn: r.literal(!1)
16
13
  })
17
- ]), j = () => {
18
- const { employee: i, isAdmin: a } = S();
19
- return a ? null : /* @__PURE__ */ s(l, { children: [
20
- /* @__PURE__ */ t(m, {}),
21
- /* @__PURE__ */ t(c, { employee: i }),
22
- /* @__PURE__ */ t(u, {})
14
+ ]), x = () => {
15
+ const { employee: i, isAdmin: m } = S();
16
+ return m ? null : /* @__PURE__ */ a(l, { children: [
17
+ /* @__PURE__ */ e(s, {}),
18
+ /* @__PURE__ */ e(c, { employee: i }),
19
+ /* @__PURE__ */ e(u, {})
23
20
  ] });
24
21
  };
25
22
  export {
26
- j as SelfPersonalDetails,
27
- h as SelfPersonalDetailsSchema
23
+ x as SelfPersonalDetails,
24
+ b as SelfPersonalDetailsSchema
28
25
  };
29
26
  //# sourceMappingURL=SelfPersonalDetails.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SelfPersonalDetails.js","sources":["../../../../src/components/Employee/Profile/SelfPersonalDetails.tsx"],"sourcesContent":["import * as v from 'valibot'\nimport {\n NameInputsSchema,\n SocialSecurityNumberSchema,\n DateOfBirthSchema,\n NameInputs,\n SocialSecurityNumberInput,\n DateOfBirthInput,\n} from './PersonalDetailsInputs'\nimport { useProfile } from './useProfile'\n\nexport const SelfPersonalDetailsSchema = v.variant('enableSsn', [\n v.object({\n ...NameInputsSchema.entries,\n ...SocialSecurityNumberSchema.entries,\n ...DateOfBirthSchema.entries,\n enableSsn: v.literal(true),\n }),\n v.object({\n ...NameInputsSchema.entries,\n ...DateOfBirthSchema.entries,\n enableSsn: v.literal(false),\n }),\n])\n\nexport const SelfPersonalDetails = () => {\n const { employee, isAdmin } = useProfile()\n\n if (isAdmin) {\n return null\n }\n\n return (\n <>\n <NameInputs />\n <SocialSecurityNumberInput employee={employee} />\n <DateOfBirthInput />\n </>\n )\n}\n"],"names":["SelfPersonalDetailsSchema","v","NameInputsSchema","SocialSecurityNumberSchema","DateOfBirthSchema","SelfPersonalDetails","employee","isAdmin","useProfile","jsxs","Fragment","jsx","NameInputs","SocialSecurityNumberInput","DateOfBirthInput"],"mappings":";;;;AAWa,MAAAA,IAA4BC,EAAE,QAAQ,aAAa;AAAA,EAC9DA,EAAE,OAAO;AAAA,IACP,GAAGC,EAAiB;AAAA,IACpB,GAAGC,EAA2B;AAAA,IAC9B,GAAGC,EAAkB;AAAA,IACrB,WAAWH,EAAE,QAAQ,EAAI;AAAA,EAAA,CAC1B;AAAA,EACDA,EAAE,OAAO;AAAA,IACP,GAAGC,EAAiB;AAAA,IACpB,GAAGE,EAAkB;AAAA,IACrB,WAAWH,EAAE,QAAQ,EAAK;AAAA,EAC3B,CAAA;AACH,CAAC,GAEYI,IAAsB,MAAM;AACvC,QAAM,EAAE,UAAAC,GAAU,SAAAC,EAAQ,IAAIC,EAAW;AAEzC,SAAID,IACK,OAKL,gBAAAE,EAAAC,GAAA,EAAA,UAAA;AAAA,IAAA,gBAAAC,EAACC,GAAW,EAAA;AAAA,IACZ,gBAAAD,EAACE,KAA0B,UAAAP,GAAoB;AAAA,sBAC9CQ,GAAiB,CAAA,CAAA;AAAA,EAAA,GACpB;AAEJ;"}
1
+ {"version":3,"file":"SelfPersonalDetails.js","sources":["../../../../src/components/Employee/Profile/SelfPersonalDetails.tsx"],"sourcesContent":["import { z } from 'zod'\nimport {\n NameInputsSchema,\n SocialSecurityNumberSchema,\n DateOfBirthSchema,\n NameInputs,\n SocialSecurityNumberInput,\n DateOfBirthInput,\n} from './PersonalDetailsInputs'\nimport { useProfile } from './useProfile'\n\nexport const SelfPersonalDetailsSchema = z.discriminatedUnion('enableSsn', [\n // Case 1: enableSsn is true\n NameInputsSchema.merge(SocialSecurityNumberSchema)\n .merge(DateOfBirthSchema)\n .extend({\n enableSsn: z.literal(true),\n }),\n // Case 2: enableSsn is false\n NameInputsSchema.merge(DateOfBirthSchema).extend({\n enableSsn: z.literal(false),\n }),\n])\n\nexport const SelfPersonalDetails = () => {\n const { employee, isAdmin } = useProfile()\n\n if (isAdmin) {\n return null\n }\n\n return (\n <>\n <NameInputs />\n <SocialSecurityNumberInput employee={employee} />\n <DateOfBirthInput />\n </>\n )\n}\n"],"names":["SelfPersonalDetailsSchema","z","NameInputsSchema","SocialSecurityNumberSchema","DateOfBirthSchema","SelfPersonalDetails","employee","isAdmin","useProfile","jsxs","Fragment","jsx","NameInputs","SocialSecurityNumberInput","DateOfBirthInput"],"mappings":";;;;AAWa,MAAAA,IAA4BC,EAAE,mBAAmB,aAAa;AAAA;AAAA,EAEzEC,EAAiB,MAAMC,CAA0B,EAC9C,MAAMC,CAAiB,EACvB,OAAO;AAAA,IACN,WAAWH,EAAE,QAAQ,EAAI;AAAA,EAAA,CAC1B;AAAA;AAAA,EAEHC,EAAiB,MAAME,CAAiB,EAAE,OAAO;AAAA,IAC/C,WAAWH,EAAE,QAAQ,EAAK;AAAA,EAC3B,CAAA;AACH,CAAC,GAEYI,IAAsB,MAAM;AACvC,QAAM,EAAE,UAAAC,GAAU,SAAAC,EAAQ,IAAIC,EAAW;AAEzC,SAAID,IACK,OAKL,gBAAAE,EAAAC,GAAA,EAAA,UAAA;AAAA,IAAA,gBAAAC,EAACC,GAAW,EAAA;AAAA,IACZ,gBAAAD,EAACE,KAA0B,UAAAP,GAAoB;AAAA,sBAC9CQ,GAAiB,CAAA,CAAA;AAAA,EAAA,GACpB;AAEJ;"}
@@ -1,13 +1,29 @@
1
- import * as v from 'valibot';
2
- export declare const FederalFormSchema: v.ObjectSchema<{
3
- readonly filingStatus: v.SchemaWithPipe<[v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
4
- readonly twoJobs: v.SchemaWithPipe<[v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
5
- readonly dependentsAmount: v.SchemaWithPipe<[v.NumberSchema<undefined>, v.TransformAction<any, string>]>;
6
- readonly otherIncome: v.SchemaWithPipe<[v.NumberSchema<undefined>, v.TransformAction<any, string>]>;
7
- readonly deductions: v.SchemaWithPipe<[v.NumberSchema<undefined>, v.TransformAction<any, string>]>;
8
- readonly extraWithholding: v.SchemaWithPipe<[v.NumberSchema<undefined>, v.TransformAction<any, string>]>;
9
- readonly w4DataType: v.PicklistSchema<["pre_2020_w4", "rev_2020_w4"], undefined>;
10
- }, undefined>;
11
- export type FederalFormInputs = v.InferInput<typeof FederalFormSchema>;
12
- export type FederalFormPayload = v.InferOutput<typeof FederalFormSchema>;
1
+ import { z } from 'zod';
2
+ export declare const FederalFormSchema: z.ZodObject<{
3
+ filingStatus: z.ZodString;
4
+ twoJobs: z.ZodString;
5
+ dependentsAmount: z.ZodEffects<z.ZodNumber, string, number>;
6
+ otherIncome: z.ZodEffects<z.ZodNumber, string, number>;
7
+ deductions: z.ZodEffects<z.ZodNumber, string, number>;
8
+ extraWithholding: z.ZodEffects<z.ZodNumber, string, number>;
9
+ w4DataType: z.ZodEnum<["pre_2020_w4", "rev_2020_w4"]>;
10
+ }, "strip", z.ZodTypeAny, {
11
+ deductions: string;
12
+ extraWithholding: string;
13
+ otherIncome: string;
14
+ filingStatus: string;
15
+ twoJobs: string;
16
+ dependentsAmount: string;
17
+ w4DataType: "pre_2020_w4" | "rev_2020_w4";
18
+ }, {
19
+ deductions: number;
20
+ extraWithholding: number;
21
+ otherIncome: number;
22
+ filingStatus: string;
23
+ twoJobs: string;
24
+ dependentsAmount: number;
25
+ w4DataType: "pre_2020_w4" | "rev_2020_w4";
26
+ }>;
27
+ export type FederalFormInputs = z.input<typeof FederalFormSchema>;
28
+ export type FederalFormPayload = z.output<typeof FederalFormSchema>;
13
29
  export declare function FederalForm(): import("react/jsx-runtime").JSX.Element;
@@ -1,20 +1,20 @@
1
- import { jsxs as l, Fragment as a, jsx as i } from "react/jsx-runtime";
1
+ import { jsxs as l, Fragment as a, jsx as r } from "react/jsx-runtime";
2
2
  import { useTranslation as s, Trans as m } from "react-i18next";
3
- import * as r from "valibot";
3
+ import { z as t } from "zod";
4
4
  import { useComponentContext as u } from "../../../contexts/ComponentAdapter/useComponentContext.js";
5
5
  import { SelectField as d } from "../../Common/Fields/SelectField/SelectField.js";
6
- import { RadioGroupField as p } from "../../Common/Fields/RadioGroupField/RadioGroupField.js";
7
- import { NumberInputField as t } from "../../Common/Fields/NumberInputField/NumberInputField.js";
8
- const F = r.object({
9
- filingStatus: r.pipe(r.string(), r.nonEmpty()),
10
- twoJobs: r.pipe(r.string(), r.nonEmpty()),
11
- dependentsAmount: r.pipe(r.number(), r.transform(String)),
12
- otherIncome: r.pipe(r.number(), r.transform(String)),
13
- deductions: r.pipe(r.number(), r.transform(String)),
14
- extraWithholding: r.pipe(r.number(), r.transform(String)),
15
- w4DataType: r.picklist(["pre_2020_w4", "rev_2020_w4"])
6
+ import { RadioGroupField as f } from "../../Common/Fields/RadioGroupField/RadioGroupField.js";
7
+ import { NumberInputField as i } from "../../Common/Fields/NumberInputField/NumberInputField.js";
8
+ const x = t.object({
9
+ filingStatus: t.string().min(1),
10
+ twoJobs: t.string().min(1),
11
+ dependentsAmount: t.number().transform(String),
12
+ otherIncome: t.number().transform(String),
13
+ deductions: t.number().transform(String),
14
+ extraWithholding: t.number().transform(String),
15
+ w4DataType: t.enum(["pre_2020_w4", "rev_2020_w4"])
16
16
  });
17
- function x() {
17
+ function R() {
18
18
  const { t: e } = s("Employee.Taxes"), o = u(), n = [
19
19
  { value: "Single", label: e("filingStatusSingle") },
20
20
  { value: "Married", label: e("filingStatusMarried") },
@@ -22,7 +22,7 @@ function x() {
22
22
  { value: "Exempt from withholding", label: e("filingStatusExemptFromWithholding") }
23
23
  ];
24
24
  return /* @__PURE__ */ l(a, { children: [
25
- /* @__PURE__ */ i(
25
+ /* @__PURE__ */ r(
26
26
  d,
27
27
  {
28
28
  name: "filingStatus",
@@ -33,19 +33,19 @@ function x() {
33
33
  errorMessage: e("validations.federalFilingStatus")
34
34
  }
35
35
  ),
36
- /* @__PURE__ */ i(
37
- p,
36
+ /* @__PURE__ */ r(
37
+ f,
38
38
  {
39
39
  name: "twoJobs",
40
40
  label: e("multipleJobs2c"),
41
41
  errorMessage: e("validations.federalTwoJobs"),
42
- description: /* @__PURE__ */ i(
42
+ description: /* @__PURE__ */ r(
43
43
  m,
44
44
  {
45
45
  i18nKey: "includesSpouseExplanation",
46
46
  t: e,
47
47
  components: {
48
- irs_link: /* @__PURE__ */ i(o.Link, {})
48
+ irs_link: /* @__PURE__ */ r(o.Link, {})
49
49
  }
50
50
  }
51
51
  ),
@@ -55,8 +55,8 @@ function x() {
55
55
  ]
56
56
  }
57
57
  ),
58
- /* @__PURE__ */ i(
59
- t,
58
+ /* @__PURE__ */ r(
59
+ i,
60
60
  {
61
61
  name: "dependentsAmount",
62
62
  isRequired: !0,
@@ -64,8 +64,8 @@ function x() {
64
64
  errorMessage: e("fieldIsRequired")
65
65
  }
66
66
  ),
67
- /* @__PURE__ */ i(
68
- t,
67
+ /* @__PURE__ */ r(
68
+ i,
69
69
  {
70
70
  name: "otherIncome",
71
71
  isRequired: !0,
@@ -75,8 +75,8 @@ function x() {
75
75
  errorMessage: e("fieldIsRequired")
76
76
  }
77
77
  ),
78
- /* @__PURE__ */ i(
79
- t,
78
+ /* @__PURE__ */ r(
79
+ i,
80
80
  {
81
81
  name: "deductions",
82
82
  isRequired: !0,
@@ -86,8 +86,8 @@ function x() {
86
86
  errorMessage: e("fieldIsRequired")
87
87
  }
88
88
  ),
89
- /* @__PURE__ */ i(
90
- t,
89
+ /* @__PURE__ */ r(
90
+ i,
91
91
  {
92
92
  name: "extraWithholding",
93
93
  isRequired: !0,
@@ -100,7 +100,7 @@ function x() {
100
100
  ] });
101
101
  }
102
102
  export {
103
- x as FederalForm,
104
- F as FederalFormSchema
103
+ R as FederalForm,
104
+ x as FederalFormSchema
105
105
  };
106
106
  //# sourceMappingURL=FederalForm.js.map