@gusto/embedded-react-sdk 0.11.0 → 0.11.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 (183) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/components/Base/Base.js +18 -19
  3. package/dist/components/Base/Base.js.map +1 -1
  4. package/dist/components/Common/DataView/DataView.js +20 -20
  5. package/dist/components/Common/DataView/DataView.js.map +1 -1
  6. package/dist/components/Common/SignatureForm/SignatureForm.js +4 -6
  7. package/dist/components/Common/SignatureForm/SignatureForm.js.map +1 -1
  8. package/dist/components/Common/SignatureForm/SignatureFormActions.js +10 -12
  9. package/dist/components/Common/SignatureForm/SignatureFormActions.js.map +1 -1
  10. package/dist/components/Common/SignatureForm/SignatureFormFields.js +6 -8
  11. package/dist/components/Common/SignatureForm/SignatureFormFields.js.map +1 -1
  12. package/dist/components/Company/AssignSignatory/AssignSignatory.js +2 -3
  13. package/dist/components/Company/AssignSignatory/AssignSignatory.js.map +1 -1
  14. package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js +6 -8
  15. package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js.map +1 -1
  16. package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js +8 -10
  17. package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js.map +1 -1
  18. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js +11 -11
  19. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +1 -1
  20. package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js +6 -8
  21. package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js.map +1 -1
  22. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js +1 -1
  23. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +1 -1
  24. package/dist/components/Company/AssignSignatory/TitleSelect.js +7 -8
  25. package/dist/components/Company/AssignSignatory/TitleSelect.js.map +1 -1
  26. package/dist/components/Company/AssignSignatory/useAssignSignatory.js +1 -1
  27. package/dist/components/Company/BankAccount/BankAccountForm/Actions.js +8 -9
  28. package/dist/components/Company/BankAccount/BankAccountForm/Actions.js.map +1 -1
  29. package/dist/components/Company/BankAccount/BankAccountForm/Form.js +9 -11
  30. package/dist/components/Company/BankAccount/BankAccountForm/Form.js.map +1 -1
  31. package/dist/components/Company/BankAccount/BankAccountForm/context.js +1 -1
  32. package/dist/components/Company/BankAccount/BankAccountList/Actions.js +10 -12
  33. package/dist/components/Company/BankAccount/BankAccountList/Actions.js.map +1 -1
  34. package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js +11 -13
  35. package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js.map +1 -1
  36. package/dist/components/Company/BankAccount/BankAccountVerify/Form.js +4 -6
  37. package/dist/components/Company/BankAccount/BankAccountVerify/Form.js.map +1 -1
  38. package/dist/components/Company/DocumentSigner/DocumentList/Actions.js +5 -7
  39. package/dist/components/Company/DocumentSigner/DocumentList/Actions.js.map +1 -1
  40. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js +6 -7
  41. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  42. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +1 -1
  43. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js +2 -3
  44. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
  45. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js +1 -1
  46. package/dist/components/Company/FederalTaxes/Actions.js +7 -9
  47. package/dist/components/Company/FederalTaxes/Actions.js.map +1 -1
  48. package/dist/components/Company/FederalTaxes/FederalTaxes.js +6 -7
  49. package/dist/components/Company/FederalTaxes/FederalTaxes.js.map +1 -1
  50. package/dist/components/Company/FederalTaxes/Form.js +3 -5
  51. package/dist/components/Company/FederalTaxes/Form.js.map +1 -1
  52. package/dist/components/Company/FederalTaxes/useFederalTaxes.js +1 -1
  53. package/dist/components/Company/Industry/Actions.js +5 -7
  54. package/dist/components/Company/Industry/Actions.js.map +1 -1
  55. package/dist/components/Company/Industry/Context.js +1 -1
  56. package/dist/components/Company/Industry/Edit.js +10 -12
  57. package/dist/components/Company/Industry/Edit.js.map +1 -1
  58. package/dist/components/Company/Locations/LocationForm/Actions.js +6 -8
  59. package/dist/components/Company/Locations/LocationForm/Actions.js.map +1 -1
  60. package/dist/components/Company/Locations/LocationForm/Form.js +1 -1
  61. package/dist/components/Company/Locations/LocationForm/LocationForm.js +3 -4
  62. package/dist/components/Company/Locations/LocationForm/LocationForm.js.map +1 -1
  63. package/dist/components/Company/Locations/LocationForm/useLocationForm.js +1 -1
  64. package/dist/components/Company/Locations/LocationsList/Actions.js +6 -8
  65. package/dist/components/Company/Locations/LocationsList/Actions.js.map +1 -1
  66. package/dist/components/Company/Locations/LocationsList/List.js +2 -4
  67. package/dist/components/Company/Locations/LocationsList/List.js.map +1 -1
  68. package/dist/components/Company/Locations/LocationsList/LocationsList.js +8 -9
  69. package/dist/components/Company/Locations/LocationsList/LocationsList.js.map +1 -1
  70. package/dist/components/Company/Locations/LocationsList/useLocationsList.js +1 -1
  71. package/dist/components/Company/OnboardingOverview/Completed.js +12 -14
  72. package/dist/components/Company/OnboardingOverview/Completed.js.map +1 -1
  73. package/dist/components/Company/OnboardingOverview/MissingRequirements.js +6 -8
  74. package/dist/components/Company/OnboardingOverview/MissingRequirements.js.map +1 -1
  75. package/dist/components/Company/OnboardingOverview/OnboardingOverview.js +2 -3
  76. package/dist/components/Company/OnboardingOverview/OnboardingOverview.js.map +1 -1
  77. package/dist/components/Company/OnboardingOverview/context.js +1 -1
  78. package/dist/components/Company/PaySchedule/PaySchedule.js +3 -4
  79. package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
  80. package/dist/components/Company/PaySchedule/_parts/Actions.js +10 -12
  81. package/dist/components/Company/PaySchedule/_parts/Actions.js.map +1 -1
  82. package/dist/components/Company/PaySchedule/_parts/Edit.js +15 -15
  83. package/dist/components/Company/PaySchedule/_parts/Head.js +6 -8
  84. package/dist/components/Company/PaySchedule/_parts/Head.js.map +1 -1
  85. package/dist/components/Company/PaySchedule/_parts/List.js +13 -15
  86. package/dist/components/Company/PaySchedule/_parts/List.js.map +1 -1
  87. package/dist/components/Company/PaySchedule/usePaySchedule.js +1 -1
  88. package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js +5 -7
  89. package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js.map +1 -1
  90. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +1 -1
  91. package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js +6 -8
  92. package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js.map +1 -1
  93. package/dist/components/Company/StateTaxes/StateTaxesList/List.js +5 -7
  94. package/dist/components/Company/StateTaxes/StateTaxesList/List.js.map +1 -1
  95. package/dist/components/Company/StateTaxes/StateTaxesList/context.js +1 -1
  96. package/dist/components/Contractor/Address/Address.js +4 -5
  97. package/dist/components/Contractor/Address/Address.js.map +1 -1
  98. package/dist/components/Contractor/Address/Form.js +1 -1
  99. package/dist/components/Contractor/Address/useAddress.js +1 -1
  100. package/dist/components/Contractor/NewHireReport/NewHireReport.js +16 -17
  101. package/dist/components/Contractor/NewHireReport/NewHireReport.js.map +1 -1
  102. package/dist/components/Contractor/PaymentMethod/BankAccountForm.js +6 -7
  103. package/dist/components/Contractor/PaymentMethod/BankAccountForm.js.map +1 -1
  104. package/dist/components/Contractor/PaymentMethod/PaymentMethod.js +2 -3
  105. package/dist/components/Contractor/PaymentMethod/PaymentMethod.js.map +1 -1
  106. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js +2 -3
  107. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js.map +1 -1
  108. package/dist/components/Contractor/Profile/ContractorProfileForm.js +20 -18
  109. package/dist/components/Contractor/Profile/ContractorProfileForm.js.map +1 -1
  110. package/dist/components/Contractor/Profile/useContractorProfile.js +1 -1
  111. package/dist/components/Contractor/Submit/index.js +9 -11
  112. package/dist/components/Contractor/Submit/index.js.map +1 -1
  113. package/dist/components/Employee/Compensation/Actions.js +5 -6
  114. package/dist/components/Employee/Compensation/Actions.js.map +1 -1
  115. package/dist/components/Employee/Compensation/Edit.js +29 -29
  116. package/dist/components/Employee/Compensation/Edit.js.map +1 -1
  117. package/dist/components/Employee/Compensation/List.js +23 -25
  118. package/dist/components/Employee/Compensation/List.js.map +1 -1
  119. package/dist/components/Employee/Deductions/Actions.js +10 -12
  120. package/dist/components/Employee/Deductions/Actions.js.map +1 -1
  121. package/dist/components/Employee/Deductions/DeductionForm.js +10 -12
  122. package/dist/components/Employee/Deductions/DeductionForm.js.map +1 -1
  123. package/dist/components/Employee/Deductions/DeductionsList.js +5 -7
  124. package/dist/components/Employee/Deductions/DeductionsList.js.map +1 -1
  125. package/dist/components/Employee/Deductions/IncludeDeductionsForm.js +11 -12
  126. package/dist/components/Employee/Deductions/IncludeDeductionsForm.js.map +1 -1
  127. package/dist/components/Employee/Deductions/useDeductions.js +1 -1
  128. package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js +6 -8
  129. package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js.map +1 -1
  130. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js +6 -7
  131. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  132. package/dist/components/Employee/DocumentSigner/DocumentList/List.js +2 -4
  133. package/dist/components/Employee/DocumentSigner/DocumentList/List.js.map +1 -1
  134. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +1 -1
  135. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js +7 -8
  136. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
  137. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +1 -1
  138. package/dist/components/Employee/EmployeeList/Actions.js +4 -6
  139. package/dist/components/Employee/EmployeeList/Actions.js.map +1 -1
  140. package/dist/components/Employee/EmployeeList/EmployeeList.js +3 -4
  141. package/dist/components/Employee/EmployeeList/EmployeeList.js.map +1 -1
  142. package/dist/components/Employee/EmployeeList/Head.js +5 -7
  143. package/dist/components/Employee/EmployeeList/Head.js.map +1 -1
  144. package/dist/components/Employee/EmployeeList/List.js +14 -15
  145. package/dist/components/Employee/EmployeeList/List.js.map +1 -1
  146. package/dist/components/Employee/EmployeeList/useEmployeeList.js +1 -1
  147. package/dist/components/Employee/Landing/Landing.js +12 -13
  148. package/dist/components/Employee/Landing/Landing.js.map +1 -1
  149. package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js +7 -7
  150. package/dist/components/Employee/PaymentMethod/Actions.js +7 -9
  151. package/dist/components/Employee/PaymentMethod/Actions.js.map +1 -1
  152. package/dist/components/Employee/PaymentMethod/BankAccountEdit.js +7 -7
  153. package/dist/components/Employee/PaymentMethod/BankAccountEdit.js.map +1 -1
  154. package/dist/components/Employee/PaymentMethod/BankAccountsList.js +8 -10
  155. package/dist/components/Employee/PaymentMethod/BankAccountsList.js.map +1 -1
  156. package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js +2 -3
  157. package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js.map +1 -1
  158. package/dist/components/Employee/PaymentMethod/Split.js +10 -11
  159. package/dist/components/Employee/PaymentMethod/Split.js.map +1 -1
  160. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +1 -1
  161. package/dist/components/Employee/Profile/Actions.js +7 -9
  162. package/dist/components/Employee/Profile/Actions.js.map +1 -1
  163. package/dist/components/Employee/Profile/AdminPersonalDetails.js +9 -10
  164. package/dist/components/Employee/Profile/AdminPersonalDetails.js.map +1 -1
  165. package/dist/components/Employee/Profile/HomeAddress.js +1 -1
  166. package/dist/components/Employee/Profile/PersonalDetailsInputs.js +51 -49
  167. package/dist/components/Employee/Profile/PersonalDetailsInputs.js.map +1 -1
  168. package/dist/components/Employee/Profile/Profile.js +1 -1
  169. package/dist/components/Employee/Profile/Profile.js.map +1 -1
  170. package/dist/components/Employee/Profile/useProfile.js +1 -1
  171. package/dist/components/Employee/Taxes/Actions.js +8 -10
  172. package/dist/components/Employee/Taxes/Actions.js.map +1 -1
  173. package/dist/components/Employee/Taxes/FederalForm.js +13 -14
  174. package/dist/components/Employee/Taxes/FederalForm.js.map +1 -1
  175. package/dist/components/Employee/Taxes/useTaxes.js +1 -1
  176. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +2 -4
  177. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
  178. package/dist/hooks/useContainerBreakpoints/useContainerBreakpoints.js +34 -23
  179. package/dist/hooks/useContainerBreakpoints/useContainerBreakpoints.js.map +1 -1
  180. package/dist/style.css +1 -1
  181. package/package.json +6 -6
  182. package/dist/hooks/useDebounce/useDebounce.js +0 -19
  183. package/dist/hooks/useDebounce/useDebounce.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"AdminPersonalDetails.js","sources":["../../../../src/components/Employee/Profile/AdminPersonalDetails.tsx"],"sourcesContent":["import { useEffect } from 'react'\nimport { useFormContext } from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport { z } from 'zod'\nimport {\n AdminInputs,\n AdminInputsSchema,\n NameInputs,\n NameInputsSchema,\n SocialSecurityNumberInput,\n SocialSecurityNumberSchema,\n DateOfBirthInput,\n DateOfBirthSchema,\n type PersonalDetailsInputs,\n} from './PersonalDetailsInputs'\nimport { useProfile } from './useProfile'\nimport { EmployeeOnboardingStatus } from '@/shared/constants'\nimport { CheckboxField } from '@/components/Common'\n\nexport const AdminSelfOnboardingPersonalDetailsSchema = AdminInputsSchema.merge(\n NameInputsSchema,\n).extend({\n selfOnboarding: z.boolean(),\n})\n\nexport const AdminPersonalDetailsSchema = z.discriminatedUnion('enableSsn', [\n AdminSelfOnboardingPersonalDetailsSchema.merge(SocialSecurityNumberSchema)\n .merge(DateOfBirthSchema)\n .extend({\n enableSsn: z.literal(true),\n }),\n AdminSelfOnboardingPersonalDetailsSchema.merge(DateOfBirthSchema).extend({\n enableSsn: z.literal(false),\n }),\n])\n\nexport const AdminPersonalDetails = () => {\n const { companyLocations, employee, isAdmin, isSelfOnboardingEnabled } = useProfile()\n const { t } = useTranslation('Employee.Profile')\n const { watch, setValue, getFieldState } = useFormContext<PersonalDetailsInputs>()\n\n const isSelfOnboardingChecked = watch('selfOnboarding')\n const { isDirty: isSsnDirty } = getFieldState('ssn')\n\n useEffect(() => {\n if (isSelfOnboardingChecked) {\n setValue('enableSsn', false)\n } else {\n setValue('enableSsn', isSsnDirty ? true : !employee?.hasSsn)\n }\n }, [isSelfOnboardingChecked, employee?.hasSsn, isSsnDirty, setValue])\n\n if (!isAdmin) {\n return null\n }\n\n return (\n <>\n <NameInputs />\n <AdminInputs companyLocations={companyLocations} />\n {isSelfOnboardingEnabled && (\n <CheckboxField\n name=\"selfOnboarding\"\n label={t('selfOnboardingLabel')}\n isDisabled={\n employee?.onboarded ||\n employee?.onboardingStatus === EmployeeOnboardingStatus.ONBOARDING_COMPLETED ||\n employee?.onboardingStatus ===\n EmployeeOnboardingStatus.SELF_ONBOARDING_AWAITING_ADMIN_REVIEW\n }\n />\n )}\n\n {!isSelfOnboardingChecked && (\n <>\n <SocialSecurityNumberInput employee={employee} />\n <DateOfBirthInput />\n </>\n )}\n </>\n )\n}\n"],"names":["AdminSelfOnboardingPersonalDetailsSchema","AdminInputsSchema","NameInputsSchema","z","AdminPersonalDetailsSchema","SocialSecurityNumberSchema","DateOfBirthSchema","AdminPersonalDetails","companyLocations","employee","isAdmin","isSelfOnboardingEnabled","useProfile","t","useTranslation","watch","setValue","getFieldState","useFormContext","isSelfOnboardingChecked","isSsnDirty","useEffect","jsxs","Fragment","jsx","NameInputs","AdminInputs","CheckboxField","EmployeeOnboardingStatus","SocialSecurityNumberInput","DateOfBirthInput"],"mappings":";;;;;;;;;;AAmBO,MAAMA,IAA2CC,EAAkB;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A;AAAA,MAAA,gBAAAC,EAACK,KAA0B,UAAApB,GAAoB;AAAA,wBAC9CqB,GAAiB,CAAA,CAAA;AAAA,IAAA,EACpB,CAAA;AAAA,EAAA,GAEJ,IA1BO;AA4BX;"}
1
+ {"version":3,"file":"AdminPersonalDetails.js","sources":["../../../../src/components/Employee/Profile/AdminPersonalDetails.tsx"],"sourcesContent":["import { useEffect } from 'react'\nimport { useFormContext } from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport { z } from 'zod'\nimport {\n AdminInputs,\n AdminInputsSchema,\n NameInputs,\n NameInputsSchema,\n SocialSecurityNumberInput,\n SocialSecurityNumberSchema,\n DateOfBirthInput,\n DateOfBirthSchema,\n type PersonalDetailsInputs,\n} from './PersonalDetailsInputs'\nimport { useProfile } from './useProfile'\nimport { EmployeeOnboardingStatus } from '@/shared/constants'\nimport { CheckboxField } from '@/components/Common'\n\nexport const AdminSelfOnboardingPersonalDetailsSchema = AdminInputsSchema.merge(\n NameInputsSchema,\n).extend({\n selfOnboarding: z.boolean(),\n})\n\nexport const AdminPersonalDetailsSchema = z.discriminatedUnion('enableSsn', [\n AdminSelfOnboardingPersonalDetailsSchema.merge(SocialSecurityNumberSchema)\n .merge(DateOfBirthSchema)\n .extend({\n enableSsn: z.literal(true),\n }),\n AdminSelfOnboardingPersonalDetailsSchema.merge(DateOfBirthSchema).extend({\n enableSsn: z.literal(false),\n }),\n])\n\nexport const AdminPersonalDetails = () => {\n const { companyLocations, employee, isAdmin, isSelfOnboardingEnabled } = useProfile()\n const { t } = useTranslation('Employee.Profile')\n const { watch, setValue, getFieldState } = useFormContext<PersonalDetailsInputs>()\n\n const isSelfOnboardingChecked = watch('selfOnboarding')\n const { isDirty: isSsnDirty } = getFieldState('ssn')\n\n useEffect(() => {\n if (isSelfOnboardingChecked) {\n setValue('enableSsn', false)\n } else {\n setValue('enableSsn', isSsnDirty ? true : !employee?.hasSsn)\n }\n }, [isSelfOnboardingChecked, employee?.hasSsn, isSsnDirty, setValue])\n\n if (!isAdmin) {\n return null\n }\n\n return (\n <>\n <NameInputs />\n <AdminInputs companyLocations={companyLocations} />\n {isSelfOnboardingEnabled && (\n <CheckboxField\n name=\"selfOnboarding\"\n label={t('selfOnboardingLabel')}\n isDisabled={\n employee?.onboarded ||\n employee?.onboardingStatus === EmployeeOnboardingStatus.ONBOARDING_COMPLETED ||\n employee?.onboardingStatus ===\n EmployeeOnboardingStatus.SELF_ONBOARDING_AWAITING_ADMIN_REVIEW\n }\n />\n )}\n\n {!isSelfOnboardingChecked && (\n <>\n <SocialSecurityNumberInput employee={employee} />\n <DateOfBirthInput />\n </>\n )}\n </>\n )\n}\n"],"names":["AdminSelfOnboardingPersonalDetailsSchema","AdminInputsSchema","NameInputsSchema","z","AdminPersonalDetailsSchema","SocialSecurityNumberSchema","DateOfBirthSchema","AdminPersonalDetails","companyLocations","employee","isAdmin","isSelfOnboardingEnabled","useProfile","t","useTranslation","watch","setValue","getFieldState","useFormContext","isSelfOnboardingChecked","isSsnDirty","useEffect","jsxs","Fragment","jsx","NameInputs","AdminInputs","CheckboxField","EmployeeOnboardingStatus","SocialSecurityNumberInput","DateOfBirthInput"],"mappings":";;;;;;;;;AAmBO,MAAMA,IAA2CC,EAAkB;AAAA,EACxEC;AACF,EAAE,OAAO;AAAA,EACP,gBAAgBC,EAAE,QAAQ;AAC5B,CAAC,GAEYC,IAA6BD,EAAE,mBAAmB,aAAa;AAAA,EAC1EH,EAAyC,MAAMK,CAA0B,EACtE,MAAMC,CAAiB,EACvB,OAAO;AAAA,IACN,WAAWH,EAAE,QAAQ,EAAI;AAAA,EAAA,CAC1B;AAAA,EACHH,EAAyC,MAAMM,CAAiB,EAAE,OAAO;AAAA,IACvE,WAAWH,EAAE,QAAQ,EAAK;AAAA,EAC3B,CAAA;AACH,CAAC,GAEYI,IAAuB,MAAM;AACxC,QAAM,EAAE,kBAAAC,GAAkB,UAAAC,GAAU,SAAAC,GAAS,yBAAAC,EAAA,IAA4BC,EAAW,GAC9E,EAAE,GAAAC,EAAA,IAAMC,EAAe,kBAAkB,GACzC,EAAE,OAAAC,GAAO,UAAAC,GAAU,eAAAC,EAAA,IAAkBC,EAAsC,GAE3EC,IAA0BJ,EAAM,gBAAgB,GAChD,EAAE,SAASK,MAAeH,EAAc,KAAK;AAUnD,SARAI,EAAU,MAAM;AACd,IAAIF,IACFH,EAAS,aAAa,EAAK,IAE3BA,EAAS,aAAaI,IAAa,KAAO,CAACX,GAAU,MAAM;AAAA,EAC7D,GACC,CAACU,GAAyBV,GAAU,QAAQW,GAAYJ,CAAQ,CAAC,GAE/DN,IAMD,gBAAAY,EAAAC,GAAA,EAAA,UAAA;AAAA,IAAA,gBAAAC,EAACC,GAAW,EAAA;AAAA,IACZ,gBAAAD,EAACE,KAAY,kBAAAlB,GAAoC;AAAA,IAChDG,KACC,gBAAAa;AAAA,MAACG;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,OAAOd,EAAE,qBAAqB;AAAA,QAC9B,YACEJ,GAAU,aACVA,GAAU,qBAAqBmB,EAAyB,wBACxDnB,GAAU,qBACRmB,EAAyB;AAAA,MAAA;AAAA,IAE/B;AAAA,IAGD,CAACT,KAEE,gBAAAG,EAAAC,GAAA,EAAA,UAAA;AAAA,MAAA,gBAAAC,EAACK,KAA0B,UAAApB,GAAoB;AAAA,wBAC9CqB,GAAiB,CAAA,CAAA;AAAA,IAAA,EACpB,CAAA;AAAA,EAAA,GAEJ,IA1BO;AA4BX;"}
@@ -5,8 +5,8 @@ import { z as t } from "zod";
5
5
  import { useProfile as g } from "./useProfile.js";
6
6
  import { STATES_ABBR as f } from "../../../shared/constants.js";
7
7
  import { Grid as b } from "../../Common/Grid/Grid.js";
8
- import { TextInputField as n } from "../../Common/Fields/TextInputField/TextInputField.js";
9
8
  import { useComponentContext as y } from "../../../contexts/ComponentAdapter/useComponentContext.js";
9
+ import { TextInputField as n } from "../../Common/Fields/TextInputField/TextInputField.js";
10
10
  import { SelectField as T } from "../../Common/Fields/SelectField/SelectField.js";
11
11
  import { CheckboxField as x } from "../../Common/Fields/CheckboxField/CheckboxField.js";
12
12
  const j = t.union([
@@ -1,25 +1,25 @@
1
1
  import { jsxs as l, Fragment as d, jsx as a } from "react/jsx-runtime";
2
- import { z as r } from "zod";
2
+ import { z as t } from "zod";
3
3
  import { useFormContext as c } from "react-hook-form";
4
- import { useTranslation as i } from "react-i18next";
4
+ import { useTranslation as o } from "react-i18next";
5
5
  import { Grid as b } from "../../Common/Grid/Grid.js";
6
- import { TextInputField as s } from "../../Common/Fields/TextInputField/TextInputField.js";
7
- import { DatePickerField as p } from "../../Common/Fields/DatePickerField/DatePickerField.js";
8
6
  import { removeNonDigits as S, addressInline as g } from "../../../helpers/formattedStrings.js";
9
7
  import { usePlaceholderSSN as h, normalizeSSN as N } from "../../../helpers/ssn.js";
10
8
  import { SSN_REGEX as D, nameValidation as m } from "../../../helpers/validations.js";
9
+ import { TextInputField as i } from "../../Common/Fields/TextInputField/TextInputField.js";
11
10
  import { SelectField as I } from "../../Common/Fields/SelectField/SelectField.js";
12
- const v = r.object({
11
+ import { DatePickerField as u } from "../../Common/Fields/DatePickerField/DatePickerField.js";
12
+ const v = t.object({
13
13
  firstName: m,
14
- middleInitial: r.string().optional(),
14
+ middleInitial: t.string().optional(),
15
15
  lastName: m
16
16
  });
17
17
  function B() {
18
- const { t: e } = i("Employee.Profile");
18
+ const { t: e } = o("Employee.Profile");
19
19
  return /* @__PURE__ */ l(d, { children: [
20
20
  /* @__PURE__ */ l(b, { gap: { base: 20, small: 8 }, gridTemplateColumns: { base: "1fr", small: ["1fr", 200] }, children: [
21
21
  /* @__PURE__ */ a(
22
- s,
22
+ i,
23
23
  {
24
24
  name: "firstName",
25
25
  isRequired: !0,
@@ -27,10 +27,10 @@ function B() {
27
27
  errorMessage: e("validations.firstName")
28
28
  }
29
29
  ),
30
- /* @__PURE__ */ a(s, { name: "middleInitial", label: e("middleInitial") })
30
+ /* @__PURE__ */ a(i, { name: "middleInitial", label: e("middleInitial") })
31
31
  ] }),
32
32
  /* @__PURE__ */ a(
33
- s,
33
+ i,
34
34
  {
35
35
  name: "lastName",
36
36
  isRequired: !0,
@@ -40,13 +40,13 @@ function B() {
40
40
  )
41
41
  ] });
42
42
  }
43
- const O = r.object({
44
- workAddress: r.string().min(1),
45
- startDate: r.date().transform((e) => e.toISOString().split("T")[0]),
46
- email: r.string().email()
43
+ const O = t.object({
44
+ workAddress: t.string().min(1),
45
+ startDate: t.date().transform((e) => e.toISOString().split("T")[0]),
46
+ email: t.string().email()
47
47
  });
48
48
  function C({ companyLocations: e }) {
49
- const { t } = i("Employee.Profile"), {
49
+ const { t: r } = o("Employee.Profile"), {
50
50
  formState: { errors: n }
51
51
  } = c();
52
52
  return /* @__PURE__ */ l(d, { children: [
@@ -54,86 +54,88 @@ function C({ companyLocations: e }) {
54
54
  I,
55
55
  {
56
56
  name: "workAddress",
57
- options: e.map((o) => ({
58
- value: o.uuid,
59
- label: g(o)
57
+ options: e.map((s) => ({
58
+ value: s.uuid,
59
+ label: g(s)
60
60
  })),
61
- label: t("workAddress"),
62
- description: t("workAddressDescription"),
63
- placeholder: t("workAddressPlaceholder"),
64
- errorMessage: t("validations.location", { ns: "common" }),
61
+ label: r("workAddress"),
62
+ description: r("workAddressDescription"),
63
+ placeholder: r("workAddressPlaceholder"),
64
+ errorMessage: r("validations.location", { ns: "common" }),
65
65
  isRequired: !0
66
66
  }
67
67
  ),
68
68
  /* @__PURE__ */ a(
69
- p,
69
+ u,
70
70
  {
71
71
  name: "startDate",
72
- label: t("startDateLabel"),
73
- description: t("startDateDescription"),
74
- errorMessage: n.startDate?.type === "custom" ? t("validations.startDateOutOfRange") : t("validations.startDate")
72
+ label: r("startDateLabel"),
73
+ description: r("startDateDescription"),
74
+ isRequired: !0,
75
+ errorMessage: n.startDate?.type === "custom" ? r("validations.startDateOutOfRange") : r("validations.startDate")
75
76
  }
76
77
  ),
77
78
  /* @__PURE__ */ a(
78
- s,
79
+ i,
79
80
  {
80
81
  name: "email",
81
- label: t("email"),
82
- description: t("emailDescription"),
83
- errorMessage: t("validations.email"),
82
+ label: r("email"),
83
+ description: r("emailDescription"),
84
+ errorMessage: r("validations.email"),
84
85
  isRequired: !0,
85
86
  type: "email"
86
87
  }
87
88
  )
88
89
  ] });
89
90
  }
90
- const y = r.object({
91
- ssn: r.string().transform((e) => S(e)).refine((e) => D.test(e)),
92
- enableSsn: r.boolean()
91
+ const R = t.object({
92
+ ssn: t.string().transform((e) => S(e)).refine((e) => D.test(e)),
93
+ enableSsn: t.boolean()
93
94
  });
94
- function L({ employee: e, onChange: t }) {
95
- const { setValue: n } = c(), { t: o } = i("Employee.Profile"), u = h(e?.hasSsn);
95
+ function L({ employee: e, onChange: r }) {
96
+ const { setValue: n } = c(), { t: s } = o("Employee.Profile"), p = h(e?.hasSsn);
96
97
  return /* @__PURE__ */ a(
97
- s,
98
+ i,
98
99
  {
99
100
  isRequired: !0,
100
101
  name: "ssn",
101
- label: o("ssnLabel"),
102
- errorMessage: o("validations.ssn", { ns: "common" }),
103
- placeholder: u,
102
+ label: s("ssnLabel"),
103
+ errorMessage: s("validations.ssn", { ns: "common" }),
104
+ placeholder: p,
104
105
  transform: N,
105
106
  onChange: (f) => {
106
- n("enableSsn", !0), t?.(f);
107
+ n("enableSsn", !0), r?.(f);
107
108
  }
108
109
  }
109
110
  );
110
111
  }
111
- const A = r.object({
112
- dateOfBirth: r.date().transform((e) => e.toISOString().split("T")[0])
112
+ const y = t.object({
113
+ dateOfBirth: t.date().transform((e) => e.toISOString().split("T")[0])
113
114
  });
114
115
  function z() {
115
- const { t: e } = i("Employee.Profile");
116
+ const { t: e } = o("Employee.Profile");
116
117
  return /* @__PURE__ */ a(
117
- p,
118
+ u,
118
119
  {
119
120
  name: "dateOfBirth",
120
121
  label: e("dobLabel"),
122
+ isRequired: !0,
121
123
  errorMessage: e("validations.dob", { ns: "common" })
122
124
  }
123
125
  );
124
126
  }
125
- v.merge(O).merge(y).merge(A).extend({
126
- selfOnboarding: r.boolean(),
127
- enableSsn: r.boolean()
127
+ v.merge(O).merge(R).merge(y).extend({
128
+ selfOnboarding: t.boolean(),
129
+ enableSsn: t.boolean()
128
130
  });
129
131
  export {
130
132
  C as AdminInputs,
131
133
  O as AdminInputsSchema,
132
134
  z as DateOfBirthInput,
133
- A as DateOfBirthSchema,
135
+ y as DateOfBirthSchema,
134
136
  B as NameInputs,
135
137
  v as NameInputsSchema,
136
138
  L as SocialSecurityNumberInput,
137
- y as SocialSecurityNumberSchema
139
+ R as SocialSecurityNumberSchema
138
140
  };
139
141
  //# sourceMappingURL=PersonalDetailsInputs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PersonalDetailsInputs.js","sources":["../../../../src/components/Employee/Profile/PersonalDetailsInputs.tsx"],"sourcesContent":["import { z } from 'zod'\nimport { useFormContext } from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport { type Location } from '@gusto/embedded-api/models/components/location'\nimport { type Employee } from '@gusto/embedded-api/models/components/employee'\nimport { SelectField, TextInputField, Grid, DatePickerField } from '@/components/Common'\nimport { addressInline, removeNonDigits } from '@/helpers/formattedStrings'\nimport { normalizeSSN, usePlaceholderSSN } from '@/helpers/ssn'\nimport { nameValidation, SSN_REGEX } from '@/helpers/validations'\n\nexport const NameInputsSchema = z.object({\n firstName: nameValidation,\n middleInitial: z.string().optional(),\n lastName: nameValidation,\n})\n\nexport function NameInputs() {\n const { t } = useTranslation('Employee.Profile')\n\n return (\n <>\n <Grid gap={{ base: 20, small: 8 }} gridTemplateColumns={{ base: '1fr', small: ['1fr', 200] }}>\n <TextInputField\n name=\"firstName\"\n isRequired\n label={t('firstName')}\n errorMessage={t('validations.firstName')}\n />\n <TextInputField name=\"middleInitial\" label={t('middleInitial')} />\n </Grid>\n <TextInputField\n name=\"lastName\"\n isRequired\n label={t('lastName')}\n errorMessage={t('validations.lastName')}\n />\n </>\n )\n}\n\nexport const AdminInputsSchema = z.object({\n workAddress: z.string().min(1),\n startDate: z.date().transform(date => date.toISOString().split('T')[0]),\n email: z.string().email(),\n})\n\ntype AdminInputsSchemaType = z.infer<typeof AdminInputsSchema>\n\ninterface AdminInputsProps {\n companyLocations: Location[]\n}\n\nexport function AdminInputs({ companyLocations }: AdminInputsProps) {\n const { t } = useTranslation('Employee.Profile')\n const {\n formState: { errors },\n } = useFormContext<AdminInputsSchemaType>()\n\n return (\n <>\n <SelectField\n name=\"workAddress\"\n options={companyLocations.map(location => ({\n value: location.uuid,\n label: addressInline(location),\n }))}\n label={t('workAddress')}\n description={t('workAddressDescription')}\n placeholder={t('workAddressPlaceholder')}\n errorMessage={t('validations.location', { ns: 'common' })}\n isRequired\n />\n <DatePickerField\n name=\"startDate\"\n label={t('startDateLabel')}\n description={t('startDateDescription')}\n errorMessage={\n errors.startDate?.type === 'custom'\n ? t('validations.startDateOutOfRange')\n : t('validations.startDate')\n }\n />\n <TextInputField\n name=\"email\"\n label={t('email')}\n description={t('emailDescription')}\n errorMessage={t('validations.email')}\n isRequired\n type=\"email\"\n />\n </>\n )\n}\n\nexport const SocialSecurityNumberSchema = z.object({\n ssn: z\n .string()\n .transform(input => removeNonDigits(input))\n .refine(input => SSN_REGEX.test(input)),\n enableSsn: z.boolean(),\n})\n\ntype SocialSecurityNumberSchemaType = z.infer<typeof SocialSecurityNumberSchema>\n\ninterface SocialSecurityNumberInputProps {\n employee?: Employee\n onChange?: (updatedValue: string) => void\n}\n\nexport function SocialSecurityNumberInput({ employee, onChange }: SocialSecurityNumberInputProps) {\n const { setValue } = useFormContext<SocialSecurityNumberSchemaType>()\n const { t } = useTranslation('Employee.Profile')\n const placeholderSSN = usePlaceholderSSN(employee?.hasSsn)\n return (\n <TextInputField\n isRequired\n name=\"ssn\"\n label={t('ssnLabel')}\n errorMessage={t('validations.ssn', { ns: 'common' })}\n placeholder={placeholderSSN}\n transform={normalizeSSN}\n onChange={updatedValue => {\n setValue('enableSsn', true)\n onChange?.(updatedValue)\n }}\n />\n )\n}\n\nexport const DateOfBirthSchema = z.object({\n dateOfBirth: z.date().transform(date => date.toISOString().split('T')[0]),\n})\n\nexport function DateOfBirthInput() {\n const { t } = useTranslation('Employee.Profile')\n return (\n <DatePickerField\n name=\"dateOfBirth\"\n label={t('dobLabel')}\n errorMessage={t('validations.dob', { ns: 'common' })}\n />\n )\n}\n\n// All possible inputs for PersonalDetails forms\nconst PersonalDetailsTotalSchema = NameInputsSchema.merge(AdminInputsSchema)\n .merge(SocialSecurityNumberSchema)\n .merge(DateOfBirthSchema)\n .extend({\n selfOnboarding: z.boolean(),\n enableSsn: z.boolean(),\n })\n\ntype NullableDatesMapper<Source> = {\n [Property in keyof Source]: Source[Property] extends Date\n ? Source[Property] | null\n : Source[Property]\n}\n\nexport type PersonalDetailsPayload = z.infer<typeof PersonalDetailsTotalSchema>\n\n//Typescript magic to mark date fields as nullable for correct defaultvalues\nexport type PersonalDetailsInputs = NullableDatesMapper<z.input<typeof PersonalDetailsTotalSchema>>\n"],"names":["NameInputsSchema","z","nameValidation","NameInputs","t","useTranslation","jsxs","Fragment","Grid","jsx","TextInputField","AdminInputsSchema","date","AdminInputs","companyLocations","errors","useFormContext","SelectField","location","addressInline","DatePickerField","SocialSecurityNumberSchema","input","removeNonDigits","SSN_REGEX","SocialSecurityNumberInput","employee","onChange","setValue","placeholderSSN","usePlaceholderSSN","normalizeSSN","updatedValue","DateOfBirthSchema","DateOfBirthInput"],"mappings":";;;;;;;;;;;AAUa,MAAAA,IAAmBC,EAAE,OAAO;AAAA,EACvC,WAAWC;AAAA,EACX,eAAeD,EAAE,OAAO,EAAE,SAAS;AAAA,EACnC,UAAUC;AACZ,CAAC;AAEM,SAASC,IAAa;AAC3B,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,kBAAkB;AAE/C,SAEI,gBAAAC,EAAAC,GAAA,EAAA,UAAA;AAAA,IAAA,gBAAAD,EAACE,KAAK,KAAK,EAAE,MAAM,IAAI,OAAO,EAAE,GAAG,qBAAqB,EAAE,MAA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,EACF;AAEJ;AAEa,MAAAC,IAAoBhC,EAAE,OAAO;AAAA,EACxC,aAAaA,EAAE,KAAK,EAAE,UAAU,CAAAW,MAAQA,EAAK,YAAA,EAAc,MAAM,GAAG,EAAE,CAAC,CAAC;AAC1E,CAAC;AAEM,SAASsB,IAAmB;AACjC,QAAM,EAAE,GAAA9B,EAAA,IAAMC,EAAe,kBAAkB;AAE7C,SAAA,gBAAAI;AAAA,IAACW;AAAA,IAAA;AAAA,MACC,MAAK;AAAA,MACL,OAAOhB,EAAE,UAAU;AAAA,MACnB,cAAcA,EAAE,mBAAmB,EAAE,IAAI,SAAU,CAAA;AAAA,IAAA;AAAA,EACrD;AAEJ;AAGmCJ,EAAiB,MAAMW,CAAiB,EACxE,MAAMU,CAA0B,EAChC,MAAMY,CAAiB,EACvB,OAAO;AAAA,EACN,gBAAgBhC,EAAE,QAAQ;AAAA,EAC1B,WAAWA,EAAE,QAAQ;AACvB,CAAC;"}
1
+ {"version":3,"file":"PersonalDetailsInputs.js","sources":["../../../../src/components/Employee/Profile/PersonalDetailsInputs.tsx"],"sourcesContent":["import { z } from 'zod'\nimport { useFormContext } from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport { type Location } from '@gusto/embedded-api/models/components/location'\nimport { type Employee } from '@gusto/embedded-api/models/components/employee'\nimport { SelectField, TextInputField, Grid, DatePickerField } from '@/components/Common'\nimport { addressInline, removeNonDigits } from '@/helpers/formattedStrings'\nimport { normalizeSSN, usePlaceholderSSN } from '@/helpers/ssn'\nimport { nameValidation, SSN_REGEX } from '@/helpers/validations'\n\nexport const NameInputsSchema = z.object({\n firstName: nameValidation,\n middleInitial: z.string().optional(),\n lastName: nameValidation,\n})\n\nexport function NameInputs() {\n const { t } = useTranslation('Employee.Profile')\n\n return (\n <>\n <Grid gap={{ base: 20, small: 8 }} gridTemplateColumns={{ base: '1fr', small: ['1fr', 200] }}>\n <TextInputField\n name=\"firstName\"\n isRequired\n label={t('firstName')}\n errorMessage={t('validations.firstName')}\n />\n <TextInputField name=\"middleInitial\" label={t('middleInitial')} />\n </Grid>\n <TextInputField\n name=\"lastName\"\n isRequired\n label={t('lastName')}\n errorMessage={t('validations.lastName')}\n />\n </>\n )\n}\n\nexport const AdminInputsSchema = z.object({\n workAddress: z.string().min(1),\n startDate: z.date().transform(date => date.toISOString().split('T')[0]),\n email: z.string().email(),\n})\n\ntype AdminInputsSchemaType = z.infer<typeof AdminInputsSchema>\n\ninterface AdminInputsProps {\n companyLocations: Location[]\n}\n\nexport function AdminInputs({ companyLocations }: AdminInputsProps) {\n const { t } = useTranslation('Employee.Profile')\n const {\n formState: { errors },\n } = useFormContext<AdminInputsSchemaType>()\n\n return (\n <>\n <SelectField\n name=\"workAddress\"\n options={companyLocations.map(location => ({\n value: location.uuid,\n label: addressInline(location),\n }))}\n label={t('workAddress')}\n description={t('workAddressDescription')}\n placeholder={t('workAddressPlaceholder')}\n errorMessage={t('validations.location', { ns: 'common' })}\n isRequired\n />\n <DatePickerField\n name=\"startDate\"\n label={t('startDateLabel')}\n description={t('startDateDescription')}\n isRequired\n errorMessage={\n errors.startDate?.type === 'custom'\n ? t('validations.startDateOutOfRange')\n : t('validations.startDate')\n }\n />\n <TextInputField\n name=\"email\"\n label={t('email')}\n description={t('emailDescription')}\n errorMessage={t('validations.email')}\n isRequired\n type=\"email\"\n />\n </>\n )\n}\n\nexport const SocialSecurityNumberSchema = z.object({\n ssn: z\n .string()\n .transform(input => removeNonDigits(input))\n .refine(input => SSN_REGEX.test(input)),\n enableSsn: z.boolean(),\n})\n\ntype SocialSecurityNumberSchemaType = z.infer<typeof SocialSecurityNumberSchema>\n\ninterface SocialSecurityNumberInputProps {\n employee?: Employee\n onChange?: (updatedValue: string) => void\n}\n\nexport function SocialSecurityNumberInput({ employee, onChange }: SocialSecurityNumberInputProps) {\n const { setValue } = useFormContext<SocialSecurityNumberSchemaType>()\n const { t } = useTranslation('Employee.Profile')\n const placeholderSSN = usePlaceholderSSN(employee?.hasSsn)\n return (\n <TextInputField\n isRequired\n name=\"ssn\"\n label={t('ssnLabel')}\n errorMessage={t('validations.ssn', { ns: 'common' })}\n placeholder={placeholderSSN}\n transform={normalizeSSN}\n onChange={updatedValue => {\n setValue('enableSsn', true)\n onChange?.(updatedValue)\n }}\n />\n )\n}\n\nexport const DateOfBirthSchema = z.object({\n dateOfBirth: z.date().transform(date => date.toISOString().split('T')[0]),\n})\n\nexport function DateOfBirthInput() {\n const { t } = useTranslation('Employee.Profile')\n return (\n <DatePickerField\n name=\"dateOfBirth\"\n label={t('dobLabel')}\n isRequired\n errorMessage={t('validations.dob', { ns: 'common' })}\n />\n )\n}\n\n// All possible inputs for PersonalDetails forms\nconst PersonalDetailsTotalSchema = NameInputsSchema.merge(AdminInputsSchema)\n .merge(SocialSecurityNumberSchema)\n .merge(DateOfBirthSchema)\n .extend({\n selfOnboarding: z.boolean(),\n enableSsn: z.boolean(),\n })\n\ntype NullableDatesMapper<Source> = {\n [Property in keyof Source]: Source[Property] extends Date\n ? Source[Property] | null\n : Source[Property]\n}\n\nexport type PersonalDetailsPayload = z.infer<typeof PersonalDetailsTotalSchema>\n\n//Typescript magic to mark date fields as nullable for correct defaultvalues\nexport type PersonalDetailsInputs = NullableDatesMapper<z.input<typeof PersonalDetailsTotalSchema>>\n"],"names":["NameInputsSchema","z","nameValidation","NameInputs","t","useTranslation","jsxs","Fragment","Grid","jsx","TextInputField","AdminInputsSchema","date","AdminInputs","companyLocations","errors","useFormContext","SelectField","location","addressInline","DatePickerField","SocialSecurityNumberSchema","input","removeNonDigits","SSN_REGEX","SocialSecurityNumberInput","employee","onChange","setValue","placeholderSSN","usePlaceholderSSN","normalizeSSN","updatedValue","DateOfBirthSchema","DateOfBirthInput"],"mappings":";;;;;;;;;;;AAUa,MAAAA,IAAmBC,EAAE,OAAO;AAAA,EACvC,WAAWC;AAAA,EACX,eAAeD,EAAE,OAAO,EAAE,SAAS;AAAA,EACnC,UAAUC;AACZ,CAAC;AAEM,SAASC,IAAa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;AAAA,MACL,OAAON,EAAE,UAAU;AAAA,MACnB,cAAcA,EAAE,mBAAmB,EAAE,IAAI,UAAU;AAAA,MACnD,aAAayB;AAAA,MACb,WAAWE;AAAA,MACX,UAAU,CAAgBC,MAAA;AACxB,QAAAJ,EAAS,aAAa,EAAI,GAC1BD,IAAWK,CAAY;AAAA,MAAA;AAAA,IACzB;AAAA,EACF;AAEJ;AAEa,MAAAC,IAAoBhC,EAAE,OAAO;AAAA,EACxC,aAAaA,EAAE,KAAK,EAAE,UAAU,CAAAW,MAAQA,EAAK,YAAA,EAAc,MAAM,GAAG,EAAE,CAAC,CAAC;AAC1E,CAAC;AAEM,SAASsB,IAAmB;AACjC,QAAM,EAAE,GAAA9B,EAAA,IAAMC,EAAe,kBAAkB;AAE7C,SAAA,gBAAAI;AAAA,IAACW;AAAA,IAAA;AAAA,MACC,MAAK;AAAA,MACL,OAAOhB,EAAE,UAAU;AAAA,MACnB,YAAU;AAAA,MACV,cAAcA,EAAE,mBAAmB,EAAE,IAAI,SAAU,CAAA;AAAA,IAAA;AAAA,EACrD;AAEJ;AAGmCJ,EAAiB,MAAMW,CAAiB,EACxE,MAAMU,CAA0B,EAChC,MAAMY,CAAiB,EACvB,OAAO;AAAA,EACN,gBAAgBhC,EAAE,QAAQ;AAAA,EAC1B,WAAWA,EAAE,QAAQ;AACvB,CAAC;"}
@@ -112,7 +112,7 @@ const v = ({
112
112
  await U(S, async (A) => {
113
113
  const { workAddress: I, startDate: me, selfOnboarding: f, ...E } = A;
114
114
  if (e.current.employee) {
115
- if (f && e.current.employee.onboardingStatus === a.ADMIN_ONBOARDING_INCOMPLETE || !f && e.current.employee.onboardingStatus === a.SELF_ONBOARDING_PENDING_INVITE) {
115
+ if (r && (f && e.current.employee.onboardingStatus === a.ADMIN_ONBOARDING_INCOMPLETE || !f && e.current.employee.onboardingStatus === a.SELF_ONBOARDING_PENDING_INVITE)) {
116
116
  const { employeeOnboardingStatus: c } = await $({
117
117
  request: {
118
118
  employeeId: e.current.employee.uuid,
@@ -1 +1 @@
1
- {"version":3,"file":"Profile.js","sources":["../../../../src/components/Employee/Profile/Profile.tsx"],"sourcesContent":["import { zodResolver } from '@hookform/resolvers/zod'\nimport { useRef, useState, useEffect } 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 type { OnboardingContextInterface } from '../OnboardingFlow/OnboardingFlow'\nimport {\n AdminPersonalDetails,\n AdminPersonalDetailsSchema,\n AdminSelfOnboardingPersonalDetailsSchema,\n} 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 { useFlow } from '@/components/Flow/useFlow'\nimport { ensureRequired } from '@/helpers/ensureRequired'\nimport { useComponentDictionary } from '@/i18n/I18n'\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<'Employee.Profile'> {\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: { employeeWorkAddressesList },\n } = useEmployeeAddressesGetWorkAddressesSuspense({ employeeId })\n return (\n <Root\n {...props}\n employee={employee}\n homeAddresses={employeeAddressList}\n workAddresses={employeeWorkAddressesList}\n />\n )\n}\n\nconst Root = ({\n isAdmin = false,\n isSelfOnboardingEnabled = true,\n dictionary,\n ...props\n}: ProfileProps & ProfileConditionalProps) => {\n useI18n('Employee.Profile')\n useI18n('Employee.HomeAddress')\n useComponentDictionary('Employee.Profile', dictionary)\n const {\n companyId,\n employee,\n homeAddresses,\n workAddresses,\n children,\n className = '',\n defaultValues,\n } = props\n const { onEvent, baseSubmitHandler } = useBase()\n\n const [AdminSchema, setAdminSchema] = useState<\n typeof AdminPersonalDetailsSchema | typeof AdminSelfOnboardingPersonalDetailsSchema\n >(AdminPersonalDetailsSchema)\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\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 ? AdminSchema : 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 useEffect(() => {\n if (isAdmin) {\n if (watchedSelfOnboarding) {\n setAdminSchema(AdminSelfOnboardingPersonalDetailsSchema)\n } else {\n setAdminSchema(AdminPersonalDetailsSchema)\n }\n }\n }, [watchedSelfOnboarding, isAdmin])\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: {\n ...body,\n selfOnboarding,\n dateOfBirth: body.dateOfBirth ? new RFCDate(body.dateOfBirth) : undefined,\n },\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,\n requestBody: {\n version: mergedData.current.homeAddress.version,\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\nexport const ProfileContextual = () => {\n const { companyId, employeeId, onEvent, isAdmin, defaultValues, isSelfOnboardingEnabled } =\n useFlow<OnboardingContextInterface>()\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","employeeWorkAddressesList","useEmployeeAddressesGetWorkAddressesSuspense","isAdmin","isSelfOnboardingEnabled","dictionary","useI18n","useComponentDictionary","companyId","homeAddresses","workAddresses","children","className","defaultValues","onEvent","baseSubmitHandler","useBase","AdminSchema","setAdminSchema","useState","AdminPersonalDetailsSchema","data","useLocationsGetSuspense","companyLocations","createEmployee","isPendingCreateEmployee","useEmployeesCreateMutation","mutateEmployee","isPendingEmployeeUpdate","useEmployeesUpdateMutation","createEmployeeWorkAddress","isPendingCreateWA","useEmployeeAddressesCreateWorkAddressMutation","mutateEmployeeWorkAddress","isPendingWorkAddressUpdate","useEmployeeAddressesUpdateWorkAddressMutation","createEmployeeHomeAddress","isPendingAddHA","useEmployeeAddressesCreateMutation","mutateEmployeeHomeAddress","isPendingUpdateHA","useEmployeeAddressesUpdateMutation","updateEmployeeOnboardingStatus","isPendingUpdateOnboardingStatus","useEmployeesUpdateOnboardingStatusMutation","existingData","currentHomeAddress","getEmployeeAddressForProfile","currentWorkAddress","address","mergedData","useRef","initialValues","adminDefaultValues","EmployeeOnboardingStatus","EmployeeSelfOnboardingStatuses","selfDetaultValues","formMethods","useForm","zodResolver","SelfPersonalDetailsSchema","HomeAddressSchema","handleSubmit","watchedSelfOnboarding","useWatch","useEffect","AdminSelfOnboardingPersonalDetailsSchema","onSubmit","payload","workAddress","startDate","selfOnboarding","body","employeeOnboardingStatus","componentEvents","employeeData","RFCDate","street1","street2","city","state","zip","courtesyWithholding","employeeAddress","employeeWorkAddress","handleCancel","ProfileProvider","FormProvider","Form","jsxs","Fragment","Head","AdminPersonalDetails","SelfPersonalDetails","HomeAddress","WorkAddress","Actions","ProfileContextual","useFlow","ensureRequired"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiFO,SAASA,GAAQC,GAA8C;AAElE,SAAA,gBAAAC,EAACC,MAAe,GAAGF,GAChB,YAAM,aACL,gBAAAC,EAACE,IAAkB,EAAA,GAAGH,GAAO,YAAYA,EAAM,YAC5C,UAAAA,EAAM,SACT,CAAA,IAEA,gBAAAC,EAACG,KAAM,GAAGJ,GAAQ,UAAMA,EAAA,SAAA,CAAS,EAErC,CAAA;AAEJ;AAGA,SAASG,GAAiB,EAAE,YAAAE,GAAY,GAAGL,KAAmD;AACtF,QAAA;AAAA,IACJ,MAAM,EAAE,UAAAM,EAAS;AAAA,EAAA,IACfC,GAAwB,EAAE,YAAAF,GAAY,GACpC;AAAA,IACJ,MAAM,EAAE,qBAAAG,EAAoB;AAAA,EAAA,IAC1BC,GAAgC,EAAE,YAAAJ,GAAY,GAC5C;AAAA,IACJ,MAAM,EAAE,2BAAAK,EAA0B;AAAA,EAAA,IAChCC,GAA6C,EAAE,YAAAN,GAAY;AAE7D,SAAA,gBAAAJ;AAAA,IAACG;AAAA,IAAA;AAAA,MACE,GAAGJ;AAAA,MACJ,UAAAM;AAAA,MACA,eAAeE;AAAA,MACf,eAAeE;AAAA,IAAA;AAAA,EACjB;AAEJ;AAEA,MAAMN,IAAO,CAAC;AAAA,EACZ,SAAAQ,IAAU;AAAA,EACV,yBAAAC,IAA0B;AAAA,EAC1B,YAAAC;AAAA,EACA,GAAGd;AACL,MAA8C;AAC5C,EAAAe,EAAQ,kBAAkB,GAC1BA,EAAQ,sBAAsB,GAC9BC,GAAuB,oBAAoB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,MACC,WAAW6G,GAAe3F,CAAS;AAAA,MACnC,YAAAZ;AAAA,MACA,SAAAkB;AAAA,MACA,SAAAX;AAAA,MACA,eAAeU,GAAe;AAAA,MAC9B,yBAAAT;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, useState, useEffect } 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 type { OnboardingContextInterface } from '../OnboardingFlow/OnboardingFlow'\nimport {\n AdminPersonalDetails,\n AdminPersonalDetailsSchema,\n AdminSelfOnboardingPersonalDetailsSchema,\n} 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 { useFlow } from '@/components/Flow/useFlow'\nimport { ensureRequired } from '@/helpers/ensureRequired'\nimport { useComponentDictionary } from '@/i18n/I18n'\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<'Employee.Profile'> {\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: { employeeWorkAddressesList },\n } = useEmployeeAddressesGetWorkAddressesSuspense({ employeeId })\n return (\n <Root\n {...props}\n employee={employee}\n homeAddresses={employeeAddressList}\n workAddresses={employeeWorkAddressesList}\n />\n )\n}\n\nconst Root = ({\n isAdmin = false,\n isSelfOnboardingEnabled = true,\n dictionary,\n ...props\n}: ProfileProps & ProfileConditionalProps) => {\n useI18n('Employee.Profile')\n useI18n('Employee.HomeAddress')\n useComponentDictionary('Employee.Profile', dictionary)\n const {\n companyId,\n employee,\n homeAddresses,\n workAddresses,\n children,\n className = '',\n defaultValues,\n } = props\n const { onEvent, baseSubmitHandler } = useBase()\n\n const [AdminSchema, setAdminSchema] = useState<\n typeof AdminPersonalDetailsSchema | typeof AdminSelfOnboardingPersonalDetailsSchema\n >(AdminPersonalDetailsSchema)\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\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 ? AdminSchema : 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 useEffect(() => {\n if (isAdmin) {\n if (watchedSelfOnboarding) {\n setAdminSchema(AdminSelfOnboardingPersonalDetailsSchema)\n } else {\n setAdminSchema(AdminPersonalDetailsSchema)\n }\n }\n }, [watchedSelfOnboarding, isAdmin])\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: {\n ...body,\n selfOnboarding,\n dateOfBirth: body.dateOfBirth ? new RFCDate(body.dateOfBirth) : undefined,\n },\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 isAdmin &&\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,\n requestBody: {\n version: mergedData.current.homeAddress.version,\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\nexport const ProfileContextual = () => {\n const { companyId, employeeId, onEvent, isAdmin, defaultValues, isSelfOnboardingEnabled } =\n useFlow<OnboardingContextInterface>()\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","employeeWorkAddressesList","useEmployeeAddressesGetWorkAddressesSuspense","isAdmin","isSelfOnboardingEnabled","dictionary","useI18n","useComponentDictionary","companyId","homeAddresses","workAddresses","children","className","defaultValues","onEvent","baseSubmitHandler","useBase","AdminSchema","setAdminSchema","useState","AdminPersonalDetailsSchema","data","useLocationsGetSuspense","companyLocations","createEmployee","isPendingCreateEmployee","useEmployeesCreateMutation","mutateEmployee","isPendingEmployeeUpdate","useEmployeesUpdateMutation","createEmployeeWorkAddress","isPendingCreateWA","useEmployeeAddressesCreateWorkAddressMutation","mutateEmployeeWorkAddress","isPendingWorkAddressUpdate","useEmployeeAddressesUpdateWorkAddressMutation","createEmployeeHomeAddress","isPendingAddHA","useEmployeeAddressesCreateMutation","mutateEmployeeHomeAddress","isPendingUpdateHA","useEmployeeAddressesUpdateMutation","updateEmployeeOnboardingStatus","isPendingUpdateOnboardingStatus","useEmployeesUpdateOnboardingStatusMutation","existingData","currentHomeAddress","getEmployeeAddressForProfile","currentWorkAddress","address","mergedData","useRef","initialValues","adminDefaultValues","EmployeeOnboardingStatus","EmployeeSelfOnboardingStatuses","selfDetaultValues","formMethods","useForm","zodResolver","SelfPersonalDetailsSchema","HomeAddressSchema","handleSubmit","watchedSelfOnboarding","useWatch","useEffect","AdminSelfOnboardingPersonalDetailsSchema","onSubmit","payload","workAddress","startDate","selfOnboarding","body","employeeOnboardingStatus","componentEvents","employeeData","RFCDate","street1","street2","city","state","zip","courtesyWithholding","employeeAddress","employeeWorkAddress","handleCancel","ProfileProvider","FormProvider","Form","jsxs","Fragment","Head","AdminPersonalDetails","SelfPersonalDetails","HomeAddress","WorkAddress","Actions","ProfileContextual","useFlow","ensureRequired"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiFO,SAASA,GAAQC,GAA8C;AAElE,SAAA,gBAAAC,EAACC,MAAe,GAAGF,GAChB,YAAM,aACL,gBAAAC,EAACE,IAAkB,EAAA,GAAGH,GAAO,YAAYA,EAAM,YAC5C,UAAAA,EAAM,SACT,CAAA,IAEA,gBAAAC,EAACG,KAAM,GAAGJ,GAAQ,UAAMA,EAAA,SAAA,CAAS,EAErC,CAAA;AAEJ;AAGA,SAASG,GAAiB,EAAE,YAAAE,GAAY,GAAGL,KAAmD;AACtF,QAAA;AAAA,IACJ,MAAM,EAAE,UAAAM,EAAS;AAAA,EAAA,IACfC,GAAwB,EAAE,YAAAF,GAAY,GACpC;AAAA,IACJ,MAAM,EAAE,qBAAAG,EAAoB;AAAA,EAAA,IAC1BC,GAAgC,EAAE,YAAAJ,GAAY,GAC5C;AAAA,IACJ,MAAM,EAAE,2BAAAK,EAA0B;AAAA,EAAA,IAChCC,GAA6C,EAAE,YAAAN,GAAY;AAE7D,SAAA,gBAAAJ;AAAA,IAACG;AAAA,IAAA;AAAA,MACE,GAAGJ;AAAA,MACJ,UAAAM;AAAA,MACA,eAAeE;AAAA,MACf,eAAeE;AAAA,IAAA;AAAA,EACjB;AAEJ;AAEA,MAAMN,IAAO,CAAC;AAAA,EACZ,SAAAQ,IAAU;AAAA,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,EAAE,WAAAzF,GAAW,YAAAZ,GAAY,SAAAkB,GAAS,SAAAX,GAAS,eAAAU,GAAe,yBAAAT,MAC9D8F,GAAoC;AAGpC,SAAA,gBAAA1G;AAAA,IAACF;AAAA,IAAA;AAAA,MACC,WAAW6G,GAAe3F,CAAS;AAAA,MACnC,YAAAZ;AAAA,MACA,SAAAkB;AAAA,MACA,SAAAX;AAAA,MACA,eAAeU,GAAe;AAAA,MAC9B,yBAAAT;AAAA,IAAA;AAAA,EACF;AAEJ;"}
@@ -8,9 +8,9 @@ import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
8
8
  import "@tanstack/react-query";
9
9
  import "../../Base/useBase.js";
10
10
  import "../../../shared/constants.js";
11
- import "classnames";
12
11
  import "dompurify";
13
12
  import "../../../contexts/ComponentAdapter/useComponentContext.js";
13
+ import "../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
14
14
  import { createCompoundContext as o } from "../../Base/createCompoundContext.js";
15
15
  const [s, u] = o("ProfileContext");
16
16
  export {
@@ -1,15 +1,13 @@
1
1
  import { jsx as o } from "react/jsx-runtime";
2
- import { useTranslation as r } from "react-i18next";
3
- import { useTaxes as s } from "./useTaxes.js";
4
- import "classnames";
5
- import "../../../shared/constants.js";
6
- import { ActionsLayout as m } from "../../Common/ActionsLayout/ActionsLayout.js";
7
- import { useComponentContext as e } from "../../../contexts/ComponentAdapter/useComponentContext.js";
8
- const l = () => {
9
- const { t } = r("Employee.Taxes"), { isPending: n } = s(), i = e();
10
- return /* @__PURE__ */ o(m, { children: /* @__PURE__ */ o(i.Button, { type: "submit", isLoading: n, children: t("submitCta") }) });
2
+ import { useTranslation as e } from "react-i18next";
3
+ import { useTaxes as i } from "./useTaxes.js";
4
+ import { ActionsLayout as r } from "../../Common/ActionsLayout/ActionsLayout.js";
5
+ import { useComponentContext as m } from "../../../contexts/ComponentAdapter/useComponentContext.js";
6
+ const x = () => {
7
+ const { t } = e("Employee.Taxes"), { isPending: n } = i(), s = m();
8
+ return /* @__PURE__ */ o(r, { children: /* @__PURE__ */ o(s.Button, { type: "submit", isLoading: n, children: t("submitCta") }) });
11
9
  };
12
10
  export {
13
- l as Actions
11
+ x as Actions
14
12
  };
15
13
  //# sourceMappingURL=Actions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Actions.js","sources":["../../../../src/components/Employee/Taxes/Actions.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useTaxes } from './useTaxes'\nimport { ActionsLayout } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\nexport const Actions = () => {\n const { t } = useTranslation('Employee.Taxes')\n const { isPending } = useTaxes()\n const Components = useComponentContext()\n\n return (\n <ActionsLayout>\n <Components.Button type=\"submit\" isLoading={isPending}>\n {t('submitCta')}\n </Components.Button>\n </ActionsLayout>\n )\n}\n"],"names":["Actions","useTranslation","isPending","useTaxes","Components","useComponentContext","jsx","ActionsLayout"],"mappings":";;;;;;;AAKO,MAAMA,IAAU,MAAM;AAC3B,QAAM,EAAE,EAAA,IAAMC,EAAe,gBAAgB,GACvC,EAAE,WAAAC,EAAU,IAAIC,EAAS,GACzBC,IAAaC,EAAoB;AAEvC,SACG,gBAAAC,EAAAC,GAAA,EACC,UAAC,gBAAAD,EAAAF,EAAW,QAAX,EAAkB,MAAK,UAAS,WAAWF,GACzC,UAAE,EAAA,WAAW,EAChB,CAAA,GACF;AAEJ;"}
1
+ {"version":3,"file":"Actions.js","sources":["../../../../src/components/Employee/Taxes/Actions.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useTaxes } from './useTaxes'\nimport { ActionsLayout } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\nexport const Actions = () => {\n const { t } = useTranslation('Employee.Taxes')\n const { isPending } = useTaxes()\n const Components = useComponentContext()\n\n return (\n <ActionsLayout>\n <Components.Button type=\"submit\" isLoading={isPending}>\n {t('submitCta')}\n </Components.Button>\n </ActionsLayout>\n )\n}\n"],"names":["Actions","useTranslation","isPending","useTaxes","Components","useComponentContext","jsx","ActionsLayout"],"mappings":";;;;;AAKO,MAAMA,IAAU,MAAM;AAC3B,QAAM,EAAE,EAAA,IAAMC,EAAe,gBAAgB,GACvC,EAAE,WAAAC,EAAU,IAAIC,EAAS,GACzBC,IAAaC,EAAoB;AAEvC,SACG,gBAAAC,EAAAC,GAAA,EACC,UAAC,gBAAAD,EAAAF,EAAW,QAAX,EAAkB,MAAK,UAAS,WAAWF,GACzC,UAAE,EAAA,WAAW,EAChB,CAAA,GACF;AAEJ;"}
@@ -1,13 +1,11 @@
1
1
  import { jsxs as l, Fragment as a, jsx as r } from "react/jsx-runtime";
2
- import { useTranslation as s, Trans as m } from "react-i18next";
2
+ import { useTranslation as s, Trans as u } from "react-i18next";
3
3
  import { z as t } from "zod";
4
- import "classnames";
5
- import "../../../shared/constants.js";
6
- import { RadioGroupField as u } from "../../Common/Fields/RadioGroupField/RadioGroupField.js";
4
+ import { useComponentContext as m } from "../../../contexts/ComponentAdapter/useComponentContext.js";
5
+ import { SelectField as d } from "../../Common/Fields/SelectField/SelectField.js";
6
+ import { RadioGroupField as f } from "../../Common/Fields/RadioGroupField/RadioGroupField.js";
7
7
  import { NumberInputField as i } from "../../Common/Fields/NumberInputField/NumberInputField.js";
8
- import { useComponentContext as d } from "../../../contexts/ComponentAdapter/useComponentContext.js";
9
- import { SelectField as f } from "../../Common/Fields/SelectField/SelectField.js";
10
- const q = t.object({
8
+ const F = t.object({
11
9
  filingStatus: t.string().min(1),
12
10
  twoJobs: t.string().min(1),
13
11
  dependentsAmount: t.number().transform(String),
@@ -16,8 +14,8 @@ const q = t.object({
16
14
  extraWithholding: t.number().transform(String),
17
15
  w4DataType: t.enum(["pre_2020_w4", "rev_2020_w4"])
18
16
  });
19
- function v() {
20
- const { t: e } = s("Employee.Taxes"), o = d(), n = [
17
+ function R() {
18
+ const { t: e } = s("Employee.Taxes"), o = m(), n = [
21
19
  { value: "Single", label: e("filingStatusSingle") },
22
20
  { value: "Married", label: e("filingStatusMarried") },
23
21
  { value: "Head of Household", label: e("filingStatusHeadOfHousehold") },
@@ -25,7 +23,7 @@ function v() {
25
23
  ];
26
24
  return /* @__PURE__ */ l(a, { children: [
27
25
  /* @__PURE__ */ r(
28
- f,
26
+ d,
29
27
  {
30
28
  name: "filingStatus",
31
29
  label: e("federalFilingStatus1c"),
@@ -36,13 +34,14 @@ function v() {
36
34
  }
37
35
  ),
38
36
  /* @__PURE__ */ r(
39
- u,
37
+ f,
40
38
  {
41
39
  name: "twoJobs",
40
+ isRequired: !0,
42
41
  label: e("multipleJobs2c"),
43
42
  errorMessage: e("validations.federalTwoJobs"),
44
43
  description: /* @__PURE__ */ r(o.Text, { children: /* @__PURE__ */ r(
45
- m,
44
+ u,
46
45
  {
47
46
  i18nKey: "includesSpouseExplanation",
48
47
  t: e,
@@ -102,7 +101,7 @@ function v() {
102
101
  ] });
103
102
  }
104
103
  export {
105
- v as FederalForm,
106
- q as FederalFormSchema
104
+ R as FederalForm,
105
+ F as FederalFormSchema
107
106
  };
108
107
  //# sourceMappingURL=FederalForm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FederalForm.js","sources":["../../../../src/components/Employee/Taxes/FederalForm.tsx"],"sourcesContent":["import { Trans, useTranslation } from 'react-i18next'\nimport { z } from 'zod'\nimport { NumberInputField, RadioGroupField, SelectField } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\nexport const FederalFormSchema = z.object({\n filingStatus: z.string().min(1),\n twoJobs: z.string().min(1),\n dependentsAmount: z.number().transform(String),\n otherIncome: z.number().transform(String),\n deductions: z.number().transform(String),\n extraWithholding: z.number().transform(String),\n w4DataType: z.enum(['pre_2020_w4', 'rev_2020_w4']),\n})\n\nexport type FederalFormInputs = z.input<typeof FederalFormSchema>\nexport type FederalFormPayload = z.output<typeof FederalFormSchema>\n\nexport function FederalForm() {\n const { t } = useTranslation('Employee.Taxes')\n const Components = useComponentContext()\n\n const filingStatusCategories = [\n { value: 'Single', label: t('filingStatusSingle') },\n { value: 'Married', label: t('filingStatusMarried') },\n { value: 'Head of Household', label: t('filingStatusHeadOfHousehold') },\n { value: 'Exempt from withholding', label: t('filingStatusExemptFromWithholding') },\n ]\n\n return (\n <>\n <SelectField\n name=\"filingStatus\"\n label={t('federalFilingStatus1c')}\n placeholder={t('federalFillingStatusPlaceholder')}\n options={filingStatusCategories}\n isRequired\n errorMessage={t('validations.federalFilingStatus')}\n />\n <RadioGroupField\n name=\"twoJobs\"\n label={t('multipleJobs2c')}\n errorMessage={t('validations.federalTwoJobs')}\n description={\n <Components.Text>\n <Trans\n i18nKey={'includesSpouseExplanation'}\n t={t}\n components={{\n irs_link: <Components.Link />,\n }}\n />\n </Components.Text>\n }\n options={[\n { value: 'true', label: t('twoJobYesLabel') },\n { value: 'false', label: t('twoJobNoLabel') },\n ]}\n />\n <NumberInputField\n name=\"dependentsAmount\"\n isRequired\n label={t('dependentsTotalIfApplicable')}\n errorMessage={t('fieldIsRequired')}\n />\n <NumberInputField\n name=\"otherIncome\"\n isRequired\n label={t('otherIncome')}\n format=\"currency\"\n min={0}\n errorMessage={t('fieldIsRequired')}\n />\n <NumberInputField\n name=\"deductions\"\n isRequired\n label={t('deductions')}\n format=\"currency\"\n min={0}\n errorMessage={t('fieldIsRequired')}\n />\n <NumberInputField\n name=\"extraWithholding\"\n isRequired\n label={t('extraWithholding')}\n format=\"currency\"\n min={0}\n errorMessage={t('fieldIsRequired')}\n />\n </>\n )\n}\n"],"names":["FederalFormSchema","z","FederalForm","t","useTranslation","Components","useComponentContext","filingStatusCategories","jsxs","Fragment","jsx","SelectField","RadioGroupField","Trans","NumberInputField"],"mappings":";;;;;;;;;AAKa,MAAAA,IAAoBC,EAAE,OAAO;AAAA,EACxC,cAAcA,EAAE,SAAS,IAAI,CAAC;AAAA,EAC9B,SAASA,EAAE,SAAS,IAAI,CAAC;AAAA,EACzB,kBAAkBA,EAA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;AAAA,UACP,EAAE,OAAO,QAAQ,OAAOF,EAAE,gBAAgB,EAAE;AAAA,UAC5C,EAAE,OAAO,SAAS,OAAOA,EAAE,eAAe,EAAE;AAAA,QAAA;AAAA,MAC9C;AAAA,IACF;AAAA,IACA,gBAAAO;AAAA,MAACI;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,YAAU;AAAA,QACV,OAAOX,EAAE,6BAA6B;AAAA,QACtC,cAAcA,EAAE,iBAAiB;AAAA,MAAA;AAAA,IACnC;AAAA,IACA,gBAAAO;AAAA,MAACI;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,YAAU;AAAA,QACV,OAAOX,EAAE,aAAa;AAAA,QACtB,QAAO;AAAA,QACP,KAAK;AAAA,QACL,cAAcA,EAAE,iBAAiB;AAAA,MAAA;AAAA,IACnC;AAAA,IACA,gBAAAO;AAAA,MAACI;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,YAAU;AAAA,QACV,OAAOX,EAAE,YAAY;AAAA,QACrB,QAAO;AAAA,QACP,KAAK;AAAA,QACL,cAAcA,EAAE,iBAAiB;AAAA,MAAA;AAAA,IACnC;AAAA,IACA,gBAAAO;AAAA,MAACI;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,YAAU;AAAA,QACV,OAAOX,EAAE,kBAAkB;AAAA,QAC3B,QAAO;AAAA,QACP,KAAK;AAAA,QACL,cAAcA,EAAE,iBAAiB;AAAA,MAAA;AAAA,IAAA;AAAA,EACnC,GACF;AAEJ;"}
1
+ {"version":3,"file":"FederalForm.js","sources":["../../../../src/components/Employee/Taxes/FederalForm.tsx"],"sourcesContent":["import { Trans, useTranslation } from 'react-i18next'\nimport { z } from 'zod'\nimport { NumberInputField, RadioGroupField, SelectField } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\nexport const FederalFormSchema = z.object({\n filingStatus: z.string().min(1),\n twoJobs: z.string().min(1),\n dependentsAmount: z.number().transform(String),\n otherIncome: z.number().transform(String),\n deductions: z.number().transform(String),\n extraWithholding: z.number().transform(String),\n w4DataType: z.enum(['pre_2020_w4', 'rev_2020_w4']),\n})\n\nexport type FederalFormInputs = z.input<typeof FederalFormSchema>\nexport type FederalFormPayload = z.output<typeof FederalFormSchema>\n\nexport function FederalForm() {\n const { t } = useTranslation('Employee.Taxes')\n const Components = useComponentContext()\n\n const filingStatusCategories = [\n { value: 'Single', label: t('filingStatusSingle') },\n { value: 'Married', label: t('filingStatusMarried') },\n { value: 'Head of Household', label: t('filingStatusHeadOfHousehold') },\n { value: 'Exempt from withholding', label: t('filingStatusExemptFromWithholding') },\n ]\n\n return (\n <>\n <SelectField\n name=\"filingStatus\"\n label={t('federalFilingStatus1c')}\n placeholder={t('federalFillingStatusPlaceholder')}\n options={filingStatusCategories}\n isRequired\n errorMessage={t('validations.federalFilingStatus')}\n />\n <RadioGroupField\n name=\"twoJobs\"\n isRequired\n label={t('multipleJobs2c')}\n errorMessage={t('validations.federalTwoJobs')}\n description={\n <Components.Text>\n <Trans\n i18nKey={'includesSpouseExplanation'}\n t={t}\n components={{\n irs_link: <Components.Link />,\n }}\n />\n </Components.Text>\n }\n options={[\n { value: 'true', label: t('twoJobYesLabel') },\n { value: 'false', label: t('twoJobNoLabel') },\n ]}\n />\n <NumberInputField\n name=\"dependentsAmount\"\n isRequired\n label={t('dependentsTotalIfApplicable')}\n errorMessage={t('fieldIsRequired')}\n />\n <NumberInputField\n name=\"otherIncome\"\n isRequired\n label={t('otherIncome')}\n format=\"currency\"\n min={0}\n errorMessage={t('fieldIsRequired')}\n />\n <NumberInputField\n name=\"deductions\"\n isRequired\n label={t('deductions')}\n format=\"currency\"\n min={0}\n errorMessage={t('fieldIsRequired')}\n />\n <NumberInputField\n name=\"extraWithholding\"\n isRequired\n label={t('extraWithholding')}\n format=\"currency\"\n min={0}\n errorMessage={t('fieldIsRequired')}\n />\n </>\n )\n}\n"],"names":["FederalFormSchema","z","FederalForm","t","useTranslation","Components","useComponentContext","filingStatusCategories","jsxs","Fragment","jsx","SelectField","RadioGroupField","Trans","NumberInputField"],"mappings":";;;;;;;AAKa,MAAAA,IAAoBC,EAAE,OAAO;AAAA,EACxC,cAAcA,EAAE,SAAS,IAAI,CAAC;AAAA,EAC9B,SAASA,EAAE,SAAS,IAAI,CAAC;AAAA,EACzB,kBAAkBA,EAAE,SAAS,UAAU,MAAM;AAAA,EAC7C,aAAaA,EAAE,SAAS,UAAU,MAAM;AAAA,EACxC,YAAYA,EAAE,SAAS,UAAU,MAAM;AAAA,EACvC,kBAAkBA,EAAE,SAAS,UAAU,MAAM;AAAA,EAC7C,YAAYA,EAAE,KAAK,CAAC,eAAe,aAAa,CAAC;AACnD,CAAC;AAKM,SAASC,IAAc;AAC5B,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,gBAAgB,GACvCC,IAAaC,EAAoB,GAEjCC,IAAyB;AAAA,IAC7B,EAAE,OAAO,UAAU,OAAOJ,EAAE,oBAAoB,EAAE;AAAA,IAClD,EAAE,OAAO,WAAW,OAAOA,EAAE,qBAAqB,EAAE;AAAA,IACpD,EAAE,OAAO,qBAAqB,OAAOA,EAAE,6BAA6B,EAAE;AAAA,IACtE,EAAE,OAAO,2BAA2B,OAAOA,EAAE,mCAAmC,EAAE;AAAA,EACpF;AAEA,SAEI,gBAAAK,EAAAC,GAAA,EAAA,UAAA;AAAA,IAAA,gBAAAC;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,OAAOR,EAAE,uBAAuB;AAAA,QAChC,aAAaA,EAAE,iCAAiC;AAAA,QAChD,SAASI;AAAA,QACT,YAAU;AAAA,QACV,cAAcJ,EAAE,iCAAiC;AAAA,MAAA;AAAA,IACnD;AAAA,IACA,gBAAAO;AAAA,MAACE;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,YAAU;AAAA,QACV,OAAOT,EAAE,gBAAgB;AAAA,QACzB,cAAcA,EAAE,4BAA4B;AAAA,QAC5C,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processableentityerrorobject";
8
8
  import "@tanstack/react-query";
9
9
  import "../../Base/useBase.js";
10
10
  import "../../../shared/constants.js";
11
- import "classnames";
12
11
  import "dompurify";
13
12
  import "../../../contexts/ComponentAdapter/useComponentContext.js";
13
+ import "../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
14
14
  import { createCompoundContext as o } from "../../Base/createCompoundContext.js";
15
15
  const [u, f] = o("TaxesContext");
16
16
  export {
@@ -6,12 +6,10 @@ import { ComponentsProvider as P } from "../ComponentAdapter/ComponentsProvider.
6
6
  import { ApiProvider as I } from "../ApiProvider/ApiProvider.js";
7
7
  import { LoadingIndicatorProvider as x } from "../LoadingIndicatorProvider/LoadingIndicatorProvider.js";
8
8
  import { SDKI18next as i } from "./SDKI18next.js";
9
- import "classnames";
10
- import "../../shared/constants.js";
11
9
  import { InternalError as y } from "../../components/Common/InternalError/InternalError.js";
12
10
  import { LocaleProvider as C } from "../LocaleProvider/LocaleProvider.js";
13
11
  import { ThemeProvider as L } from "../ThemeProvider/ThemeProvider.js";
14
- const R = (a) => {
12
+ const G = (a) => {
15
13
  const {
16
14
  children: d,
17
15
  config: t,
@@ -40,6 +38,6 @@ const R = (a) => {
40
38
  }, [e]), /* @__PURE__ */ r(P, { value: f, children: /* @__PURE__ */ r(x, { value: s, children: /* @__PURE__ */ r(h, { FallbackComponent: y, children: /* @__PURE__ */ r(L, { theme: p, children: /* @__PURE__ */ r(C, { locale: c, currency: l, children: /* @__PURE__ */ r(v, { i18n: i, children: /* @__PURE__ */ r(I, { url: t.baseUrl, headers: t.headers, children: d }) }, e) }) }) }) }) });
41
39
  };
42
40
  export {
43
- R as GustoProviderCustomUIAdapter
41
+ G as GustoProviderCustomUIAdapter
44
42
  };
45
43
  //# sourceMappingURL=GustoProviderCustomUIAdapter.js.map