@gusto/embedded-react-sdk 0.9.0 → 0.10.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 (96) hide show
  1. package/CHANGELOG.md +86 -2
  2. package/dist/components/Base/Base.d.ts +1 -1
  3. package/dist/components/Base/Base.js +39 -40
  4. package/dist/components/Base/Base.js.map +1 -1
  5. package/dist/components/Common/OnboardingStatusBadge/index.d.ts +21 -0
  6. package/dist/components/Common/OnboardingStatusBadge/index.js +17 -0
  7. package/dist/components/Common/OnboardingStatusBadge/index.js.map +1 -0
  8. package/dist/components/Common/TaxInputs/TaxInputs.js +42 -36
  9. package/dist/components/Common/TaxInputs/TaxInputs.js.map +1 -1
  10. package/dist/components/Contractor/Address/Form.js +4 -12
  11. package/dist/components/Contractor/Address/Form.js.map +1 -1
  12. package/dist/components/Contractor/List/index.d.ts +25 -0
  13. package/dist/components/Contractor/List/index.js +84 -0
  14. package/dist/components/Contractor/List/index.js.map +1 -0
  15. package/dist/components/Contractor/List/useContractorList.d.ts +20 -0
  16. package/dist/components/Contractor/List/useContractorList.js +31 -0
  17. package/dist/components/Contractor/List/useContractorList.js.map +1 -0
  18. package/dist/components/Contractor/NewHireReport/NewHireReport.d.ts +21 -0
  19. package/dist/components/Contractor/NewHireReport/NewHireReport.js +111 -0
  20. package/dist/components/Contractor/NewHireReport/NewHireReport.js.map +1 -0
  21. package/dist/components/Contractor/NewHireReport/types.d.ts +4 -0
  22. package/dist/components/Contractor/PaymentMethod/BankAccountForm.d.ts +2 -0
  23. package/dist/components/Contractor/PaymentMethod/BankAccountForm.js +52 -0
  24. package/dist/components/Contractor/PaymentMethod/BankAccountForm.js.map +1 -0
  25. package/dist/components/Contractor/PaymentMethod/PaymentMethod.d.ts +31 -0
  26. package/dist/components/Contractor/PaymentMethod/PaymentMethod.js +116 -0
  27. package/dist/components/Contractor/PaymentMethod/PaymentMethod.js.map +1 -0
  28. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.d.ts +11 -0
  29. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js +35 -0
  30. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js.map +1 -0
  31. package/dist/components/Contractor/PaymentMethod/types.d.ts +8 -0
  32. package/dist/components/Contractor/index.d.ts +3 -0
  33. package/dist/components/Contractor/index.js +8 -2
  34. package/dist/components/Contractor/index.js.map +1 -1
  35. package/dist/components/Employee/Compensation/Edit.js +59 -56
  36. package/dist/components/Employee/Compensation/Edit.js.map +1 -1
  37. package/dist/components/Employee/Compensation/useCompensation.d.ts +2 -0
  38. package/dist/components/Employee/Compensation/useCompensation.js +16 -14
  39. package/dist/components/Employee/Compensation/useCompensation.js.map +1 -1
  40. package/dist/components/Employee/Deductions/DeductionForm.js +11 -3
  41. package/dist/components/Employee/Deductions/DeductionForm.js.map +1 -1
  42. package/dist/components/Employee/Deductions/Deductions.js +25 -25
  43. package/dist/components/Employee/Deductions/Deductions.js.map +1 -1
  44. package/dist/components/Employee/EmployeeList/List.js +56 -51
  45. package/dist/components/Employee/EmployeeList/List.js.map +1 -1
  46. package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js +48 -43
  47. package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js.map +1 -1
  48. package/dist/components/Employee/PaymentMethod/BankAccountEdit.js +1 -1
  49. package/dist/components/Employee/PaymentMethod/BankAccountEdit.js.map +1 -1
  50. package/dist/components/Employee/PaymentMethod/PaymentMethod.js +3 -4
  51. package/dist/components/Employee/PaymentMethod/PaymentMethod.js.map +1 -1
  52. package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js +1 -1
  53. package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js.map +1 -1
  54. package/dist/components/Employee/PaymentMethod/Split.js +88 -76
  55. package/dist/components/Employee/PaymentMethod/Split.js.map +1 -1
  56. package/dist/components/Employee/PaymentMethod/usePaymentMethod.d.ts +2 -2
  57. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +29 -25
  58. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
  59. package/dist/components/Employee/Profile/AdminPersonalDetails.d.ts +49 -20
  60. package/dist/components/Employee/Profile/AdminPersonalDetails.js +27 -25
  61. package/dist/components/Employee/Profile/AdminPersonalDetails.js.map +1 -1
  62. package/dist/components/Employee/Profile/PersonalDetailsInputs.js +1 -1
  63. package/dist/components/Employee/Profile/Profile.js +135 -129
  64. package/dist/components/Employee/Profile/Profile.js.map +1 -1
  65. package/dist/components/Employee/Taxes/StateForm.d.ts +1 -1
  66. package/dist/components/Employee/Taxes/StateForm.js +27 -25
  67. package/dist/components/Employee/Taxes/StateForm.js.map +1 -1
  68. package/dist/components/Employee/Taxes/Taxes.d.ts +1 -1
  69. package/dist/components/Employee/Taxes/Taxes.js +77 -73
  70. package/dist/components/Employee/Taxes/Taxes.js.map +1 -1
  71. package/dist/components/index.d.ts +1 -1
  72. package/dist/i18n/I18n.js +17 -17
  73. package/dist/i18n/I18n.js.map +1 -1
  74. package/dist/i18n/en/Contractor.ContractorList.json.js +25 -0
  75. package/dist/i18n/en/Contractor.ContractorList.json.js.map +1 -0
  76. package/dist/i18n/en/Contractor.NewHireReport.json.js +24 -0
  77. package/dist/i18n/en/Contractor.NewHireReport.json.js.map +1 -0
  78. package/dist/i18n/en/Contractor.PaymentMethod.json.js +35 -0
  79. package/dist/i18n/en/Contractor.PaymentMethod.json.js.map +1 -0
  80. package/dist/i18n/en/Employee.Compensation.json.js +22 -20
  81. package/dist/i18n/en/Employee.Compensation.json.js.map +1 -1
  82. package/dist/i18n/en/Employee.PaymentMethod.json.js +18 -17
  83. package/dist/i18n/en/Employee.PaymentMethod.json.js.map +1 -1
  84. package/dist/i18n/en/common.json.d.ts +21 -9
  85. package/dist/i18n/en/common.json.js +35 -23
  86. package/dist/i18n/en/common.json.js.map +1 -1
  87. package/dist/index.js +4 -4
  88. package/dist/shared/constants.d.ts +18 -0
  89. package/dist/shared/constants.js +28 -15
  90. package/dist/shared/constants.js.map +1 -1
  91. package/dist/style.css +1 -1
  92. package/dist/types/i18next.d.ts +64 -1
  93. package/package.json +4 -3
  94. package/dist/components/Employee/PaymentMethod/Constants.d.ts +0 -8
  95. package/dist/components/Employee/PaymentMethod/Constants.js +0 -6
  96. package/dist/components/Employee/PaymentMethod/Constants.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Profile.js","sources":["../../../../src/components/Employee/Profile/Profile.tsx"],"sourcesContent":["import { zodResolver } from '@hookform/resolvers/zod'\nimport { useRef } from 'react'\nimport type { SubmitHandler } from 'react-hook-form'\nimport { FormProvider, useForm, useWatch } from 'react-hook-form'\nimport { useLocationsGetSuspense } from '@gusto/embedded-api/react-query/locationsGet'\nimport { useEmployeesCreateMutation } from '@gusto/embedded-api/react-query/employeesCreate'\nimport { useEmployeesGetSuspense } from '@gusto/embedded-api/react-query/employeesGet'\nimport { type Employee } from '@gusto/embedded-api/models/components/employee'\nimport { useEmployeeAddressesGetSuspense } from '@gusto/embedded-api/react-query/employeeAddressesGet'\nimport { type EmployeeAddress } from '@gusto/embedded-api/models/components/employeeaddress'\nimport { useEmployeeAddressesCreateMutation } from '@gusto/embedded-api/react-query/employeeAddressesCreate'\nimport { useEmployeeAddressesUpdateMutation } from '@gusto/embedded-api/react-query/employeeAddressesUpdate'\nimport { useEmployeeAddressesUpdateWorkAddressMutation } from '@gusto/embedded-api/react-query/employeeAddressesUpdateWorkAddress'\nimport { useEmployeesUpdateMutation } from '@gusto/embedded-api/react-query/employeesUpdate'\nimport { useEmployeeAddressesGetWorkAddressesSuspense } from '@gusto/embedded-api/react-query/employeeAddressesGetWorkAddresses'\nimport type { EmployeeWorkAddress } from '@gusto/embedded-api/models/components/employeeworkaddress'\nimport { useEmployeeAddressesCreateWorkAddressMutation } from '@gusto/embedded-api/react-query/employeeAddressesCreateWorkAddress'\nimport { RFCDate } from '@gusto/embedded-api/types/rfcdate'\nimport { useEmployeesUpdateOnboardingStatusMutation } from '@gusto/embedded-api/react-query/employeesUpdateOnboardingStatus'\nimport { invalidateEmployeesList } from '@gusto/embedded-api/react-query/employeesList'\nimport { useQueryClient } from '@tanstack/react-query'\nimport type { OnboardingContextInterface } from '../OnboardingFlow/OnboardingFlow'\nimport { AdminPersonalDetails, AdminPersonalDetailsSchema } from './AdminPersonalDetails'\nimport { SelfPersonalDetails, SelfPersonalDetailsSchema } from './SelfPersonalDetails'\nimport { type PersonalDetailsPayload, type PersonalDetailsInputs } from './PersonalDetailsInputs'\nimport { Head } from './Head'\nimport { Actions } from './Actions'\nimport { HomeAddress, HomeAddressSchema, type HomeAddressInputs } from './HomeAddress'\nimport { WorkAddress } from './WorkAddress'\nimport { ProfileProvider } from './useProfile'\nimport { getEmployeeAddressForProfile } from './getEmployeeAddressForProfile'\nimport { Form } from '@/components/Common/Form'\nimport {\n useBase,\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n} from '@/components/Base'\nimport { useI18n } from '@/i18n'\nimport {\n componentEvents,\n EmployeeOnboardingStatus,\n EmployeeSelfOnboardingStatuses,\n} from '@/shared/constants'\nimport type { RequireAtLeastOne, WithRequired } from '@/types/Helpers'\nimport { 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 const queryClient = useQueryClient()\n\n const { data } = useLocationsGetSuspense({ companyId })\n const companyLocations = data.locationList!\n\n const { mutateAsync: createEmployee, isPending: isPendingCreateEmployee } =\n useEmployeesCreateMutation()\n const { mutateAsync: mutateEmployee, isPending: isPendingEmployeeUpdate } =\n useEmployeesUpdateMutation()\n\n const { mutateAsync: createEmployeeWorkAddress, isPending: isPendingCreateWA } =\n useEmployeeAddressesCreateWorkAddressMutation()\n const { mutateAsync: mutateEmployeeWorkAddress, isPending: isPendingWorkAddressUpdate } =\n useEmployeeAddressesUpdateWorkAddressMutation()\n\n const { mutateAsync: createEmployeeHomeAddress, isPending: isPendingAddHA } =\n useEmployeeAddressesCreateMutation()\n const { mutateAsync: mutateEmployeeHomeAddress, isPending: isPendingUpdateHA } =\n useEmployeeAddressesUpdateMutation()\n\n const {\n mutateAsync: updateEmployeeOnboardingStatus,\n isPending: isPendingUpdateOnboardingStatus,\n } = useEmployeesUpdateOnboardingStatusMutation({\n onSettled: () => invalidateEmployeesList(queryClient, [companyId]),\n })\n\n const existingData = { employee, workAddresses, homeAddresses }\n\n const currentHomeAddress = getEmployeeAddressForProfile(homeAddresses)\n\n const currentWorkAddress = existingData.workAddresses?.find(address => address.active)\n const mergedData = useRef({\n employee: existingData.employee,\n homeAddress: currentHomeAddress,\n workAddress: currentWorkAddress,\n })\n const initialValues = {\n firstName: mergedData.current.employee?.firstName ?? defaultValues?.employee?.firstName ?? '',\n middleInitial:\n mergedData.current.employee?.middleInitial ?? defaultValues?.employee?.middleInitial ?? '',\n lastName: mergedData.current.employee?.lastName ?? defaultValues?.employee?.lastName ?? '',\n workAddress: mergedData.current.workAddress?.locationUuid,\n startDate: mergedData.current.employee?.jobs?.[0]?.hireDate\n ? new Date(mergedData.current.employee.jobs[0].hireDate)\n : null, // By default employee response contains only current job - therefore jobs[0]\n email: mergedData.current.employee?.email ?? defaultValues?.employee?.email ?? '',\n dateOfBirth: mergedData.current.employee?.dateOfBirth\n ? new Date(mergedData.current.employee.dateOfBirth)\n : defaultValues?.employee?.dateOfBirth\n ? new Date(defaultValues.employee.dateOfBirth)\n : null,\n\n street1: mergedData.current.homeAddress?.street1 ?? defaultValues?.homeAddress?.street1 ?? '',\n street2: mergedData.current.homeAddress?.street2 ?? defaultValues?.homeAddress?.street2 ?? '',\n city: mergedData.current.homeAddress?.city ?? defaultValues?.homeAddress?.city ?? '',\n zip: mergedData.current.homeAddress?.zip ?? defaultValues?.homeAddress?.zip ?? '',\n state: mergedData.current.homeAddress?.state ?? defaultValues?.homeAddress?.state ?? '',\n courtesyWithholding: mergedData.current.homeAddress?.courtesyWithholding ?? false,\n }\n\n const adminDefaultValues =\n mergedData.current.employee?.onboarded ||\n mergedData.current.employee?.onboardingStatus ===\n EmployeeOnboardingStatus.ONBOARDING_COMPLETED ||\n (mergedData.current.employee?.onboardingStatus !== undefined &&\n mergedData.current.employee.onboardingStatus !==\n EmployeeOnboardingStatus.ADMIN_ONBOARDING_INCOMPLETE)\n ? { ...initialValues, enableSsn: false, selfOnboarding: true }\n : {\n ...initialValues,\n selfOnboarding: isSelfOnboardingEnabled\n ? mergedData.current.employee?.onboardingStatus\n ? // @ts-expect-error: onboarding_status during runtime can be one of self onboarding statuses\n EmployeeSelfOnboardingStatuses.has(mergedData.current.employee.onboarding_status)\n : false\n : false,\n enableSsn: !mergedData.current.employee?.hasSsn,\n ssn: '',\n } // In edit mode ssn is submitted only if it has been modified\n\n const selfDetaultValues = {\n ...initialValues,\n enableSsn: !mergedData.current.employee?.hasSsn,\n ssn: '',\n }\n\n const formMethods = useForm<\n PersonalDetailsInputs & HomeAddressInputs,\n unknown,\n PersonalDetailsPayload & HomeAddressInputs\n >({\n resolver: zodResolver(\n (isAdmin ? AdminPersonalDetailsSchema : SelfPersonalDetailsSchema).and(HomeAddressSchema),\n ),\n defaultValues: isAdmin ? adminDefaultValues : selfDetaultValues,\n })\n\n const { handleSubmit } = formMethods\n const watchedSelfOnboarding = useWatch({ control: formMethods.control, name: 'selfOnboarding' })\n\n const onSubmit: SubmitHandler<PersonalDetailsPayload & HomeAddressInputs> = async data => {\n await baseSubmitHandler(data, async payload => {\n const { workAddress, startDate, selfOnboarding, ...body } = payload\n //create or update employee\n if (!mergedData.current.employee) {\n const { employee: employeeData } = await createEmployee({\n request: {\n companyId,\n requestBody: {\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\nProfile.Head = Head\nProfile.Actions = Actions\nProfile.AdminPersonalDetails = AdminPersonalDetails\nProfile.SelfPersonalDetails = SelfPersonalDetails\nProfile.HomeAddress = HomeAddress\nProfile.WorkAddress = WorkAddress\n\nexport const ProfileContextual = () => {\n const { companyId, employeeId, onEvent, isAdmin, defaultValues, isSelfOnboardingEnabled } =\n useFlow<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","queryClient","useQueryClient","data","useLocationsGetSuspense","companyLocations","createEmployee","isPendingCreateEmployee","useEmployeesCreateMutation","mutateEmployee","isPendingEmployeeUpdate","useEmployeesUpdateMutation","createEmployeeWorkAddress","isPendingCreateWA","useEmployeeAddressesCreateWorkAddressMutation","mutateEmployeeWorkAddress","isPendingWorkAddressUpdate","useEmployeeAddressesUpdateWorkAddressMutation","createEmployeeHomeAddress","isPendingAddHA","useEmployeeAddressesCreateMutation","mutateEmployeeHomeAddress","isPendingUpdateHA","useEmployeeAddressesUpdateMutation","updateEmployeeOnboardingStatus","isPendingUpdateOnboardingStatus","useEmployeesUpdateOnboardingStatusMutation","invalidateEmployeesList","existingData","currentHomeAddress","getEmployeeAddressForProfile","currentWorkAddress","address","mergedData","useRef","initialValues","adminDefaultValues","EmployeeOnboardingStatus","EmployeeSelfOnboardingStatuses","selfDetaultValues","formMethods","useForm","zodResolver","AdminPersonalDetailsSchema","SelfPersonalDetailsSchema","HomeAddressSchema","handleSubmit","watchedSelfOnboarding","useWatch","onSubmit","payload","workAddress","startDate","selfOnboarding","body","employeeOnboardingStatus","componentEvents","employeeData","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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+EO,SAASA,EAAQC,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,yB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tG,EAAQ,cAAcuG;AAEf,MAAME,KAAoB,MAAM;AAC/B,QAAA,EAAE,WAAAvF,GAAW,YAAAZ,GAAY,SAAAkB,GAAS,SAAAX,GAAS,eAAAU,GAAe,yBAAAT,MAC9D4F,GAAoC;AAGpC,SAAA,gBAAAxG;AAAA,IAACF;AAAA,IAAA;AAAA,MACC,WAAW2G,GAAezF,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 {\n invalidateAllEmployeeAddressesGetWorkAddresses,\n useEmployeeAddressesGetWorkAddressesSuspense,\n} from '@gusto/embedded-api/react-query/employeeAddressesGetWorkAddresses'\nimport type { EmployeeWorkAddress } from '@gusto/embedded-api/models/components/employeeworkaddress'\nimport { useEmployeeAddressesCreateWorkAddressMutation } from '@gusto/embedded-api/react-query/employeeAddressesCreateWorkAddress'\nimport { RFCDate } from '@gusto/embedded-api/types/rfcdate'\nimport { useEmployeesUpdateOnboardingStatusMutation } from '@gusto/embedded-api/react-query/employeesUpdateOnboardingStatus'\nimport { invalidateEmployeesList } from '@gusto/embedded-api/react-query/employeesList'\nimport { useQueryClient } from '@tanstack/react-query'\nimport 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 const queryClient = useQueryClient()\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 onSettled: () => invalidateEmployeesList(queryClient, [companyId]),\n })\n\n const existingData = { employee, workAddresses, homeAddresses }\n\n const currentHomeAddress = getEmployeeAddressForProfile(homeAddresses)\n\n const currentWorkAddress = existingData.workAddresses?.find(address => address.active)\n const mergedData = useRef({\n employee: existingData.employee,\n homeAddress: currentHomeAddress,\n workAddress: currentWorkAddress,\n })\n const initialValues = {\n firstName: mergedData.current.employee?.firstName ?? defaultValues?.employee?.firstName ?? '',\n middleInitial:\n mergedData.current.employee?.middleInitial ?? defaultValues?.employee?.middleInitial ?? '',\n lastName: mergedData.current.employee?.lastName ?? defaultValues?.employee?.lastName ?? '',\n workAddress: mergedData.current.workAddress?.locationUuid,\n startDate: mergedData.current.employee?.jobs?.[0]?.hireDate\n ? new Date(mergedData.current.employee.jobs[0].hireDate)\n : null, // By default employee response contains only current job - therefore jobs[0]\n email: mergedData.current.employee?.email ?? defaultValues?.employee?.email ?? '',\n dateOfBirth: mergedData.current.employee?.dateOfBirth\n ? new Date(mergedData.current.employee.dateOfBirth)\n : defaultValues?.employee?.dateOfBirth\n ? new Date(defaultValues.employee.dateOfBirth)\n : null,\n\n street1: mergedData.current.homeAddress?.street1 ?? defaultValues?.homeAddress?.street1 ?? '',\n street2: mergedData.current.homeAddress?.street2 ?? defaultValues?.homeAddress?.street2 ?? '',\n city: mergedData.current.homeAddress?.city ?? defaultValues?.homeAddress?.city ?? '',\n zip: mergedData.current.homeAddress?.zip ?? defaultValues?.homeAddress?.zip ?? '',\n state: mergedData.current.homeAddress?.state ?? defaultValues?.homeAddress?.state ?? '',\n courtesyWithholding: mergedData.current.homeAddress?.courtesyWithholding ?? false,\n }\n\n const adminDefaultValues =\n mergedData.current.employee?.onboarded ||\n mergedData.current.employee?.onboardingStatus ===\n EmployeeOnboardingStatus.ONBOARDING_COMPLETED ||\n (mergedData.current.employee?.onboardingStatus !== undefined &&\n mergedData.current.employee.onboardingStatus !==\n EmployeeOnboardingStatus.ADMIN_ONBOARDING_INCOMPLETE)\n ? { ...initialValues, enableSsn: false, selfOnboarding: true }\n : {\n ...initialValues,\n selfOnboarding: isSelfOnboardingEnabled\n ? mergedData.current.employee?.onboardingStatus\n ? // @ts-expect-error: onboarding_status during runtime can be one of self onboarding statuses\n EmployeeSelfOnboardingStatuses.has(mergedData.current.employee.onboarding_status)\n : false\n : false,\n enableSsn: !mergedData.current.employee?.hasSsn,\n ssn: '',\n } // In edit mode ssn is submitted only if it has been modified\n\n const selfDetaultValues = {\n ...initialValues,\n enableSsn: !mergedData.current.employee?.hasSsn,\n ssn: '',\n }\n\n const formMethods = useForm<\n PersonalDetailsInputs & HomeAddressInputs,\n unknown,\n PersonalDetailsPayload & HomeAddressInputs\n >({\n resolver: zodResolver(\n (isAdmin ? 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 await invalidateAllEmployeeAddressesGetWorkAddresses(queryClient)\n }\n\n onEvent(componentEvents.EMPLOYEE_PROFILE_DONE, {\n ...mergedData.current.employee,\n startDate,\n })\n })\n }\n\n const handleCancel = () => {\n onEvent(componentEvents.CANCEL)\n }\n return (\n <section className={className}>\n <ProfileProvider\n value={{\n companyLocations,\n workAddresses,\n employee: mergedData.current.employee ?? undefined,\n isSelfOnboardingIntended: watchedSelfOnboarding,\n handleCancel,\n isAdmin,\n isSelfOnboardingEnabled,\n isPending:\n isPendingEmployeeUpdate ||\n isPendingWorkAddressUpdate ||\n isPendingAddHA ||\n isPendingUpdateHA ||\n isPendingCreateEmployee ||\n isPendingCreateWA ||\n isPendingUpdateOnboardingStatus,\n }}\n >\n <FormProvider {...formMethods}>\n <Form onSubmit={handleSubmit(onSubmit)}>\n {children ? (\n children\n ) : (\n <>\n <Head />\n <AdminPersonalDetails />\n <SelfPersonalDetails />\n <HomeAddress />\n <WorkAddress />\n <Actions />\n </>\n )}\n </Form>\n </FormProvider>\n </ProfileProvider>\n </section>\n )\n}\n\nProfile.Head = Head\nProfile.Actions = Actions\nProfile.AdminPersonalDetails = AdminPersonalDetails\nProfile.SelfPersonalDetails = SelfPersonalDetails\nProfile.HomeAddress = HomeAddress\nProfile.WorkAddress = WorkAddress\n\nexport const ProfileContextual = () => {\n const { companyId, employeeId, onEvent, isAdmin, defaultValues, isSelfOnboardingEnabled } =\n useFlow<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","queryClient","useQueryClient","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","invalidateEmployeesList","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","invalidateAllEmployeeAddressesGetWorkAddresses","handleCancel","ProfileProvider","FormProvider","Form","jsxs","Fragment","Head","AdminPersonalDetails","SelfPersonalDetails","HomeAddress","WorkAddress","Actions","ProfileContextual","useFlow","ensureRequired"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsFO,SAASA,EAAQC,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,EA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4 +7,4 @@ export declare const StateFormSchema: z.ZodObject<{
7
7
  states?: Record<string, Record<string, unknown>> | undefined;
8
8
  }>;
9
9
  export type StateFormPayload = z.output<typeof StateFormSchema>;
10
- export declare const StateForm: () => import("react/jsx-runtime").JSX.Element[];
10
+ export declare const StateForm: () => (import("react/jsx-runtime").JSX.Element | null)[];
@@ -1,32 +1,34 @@
1
- import { jsxs as l, Fragment as f, jsx as r } from "react/jsx-runtime";
2
- import { useTranslation as s } from "react-i18next";
1
+ import { jsxs as c, Fragment as y, jsx as s } from "react/jsx-runtime";
2
+ import { useTranslation as m } from "react-i18next";
3
3
  import { z as t } from "zod";
4
- import { useTaxes as u } from "./useTaxes.js";
5
- import { snakeCaseToCamelCase as y } from "../../../helpers/formattedStrings.js";
6
- import { QuestionInput as x } from "../../Common/TaxInputs/TaxInputs.js";
7
- import { useComponentContext as d } from "../../../contexts/ComponentAdapter/useComponentContext.js";
8
- const S = t.object({
4
+ import { useTaxes as f } from "./useTaxes.js";
5
+ import { snakeCaseToCamelCase as d } from "../../../helpers/formattedStrings.js";
6
+ import { QuestionInput as u } from "../../Common/TaxInputs/TaxInputs.js";
7
+ import { useComponentContext as x } from "../../../contexts/ComponentAdapter/useComponentContext.js";
8
+ const H = t.object({
9
9
  states: t.record(t.string(), t.record(t.string(), t.unknown())).optional()
10
- }), j = () => {
11
- const n = d(), { employeeStateTaxes: m, isAdmin: a } = u(), { t: i } = s("Employee.Taxes"), { t: p } = s("common", { keyPrefix: "statesHash" });
12
- return m.map(({ state: o, questions: c }) => /* @__PURE__ */ l(f, { children: [
13
- /* @__PURE__ */ r(n.Heading, { as: "h2", children: i("stateTaxesTitle", { state: p(o) }) }),
14
- c?.map((e) => e.isQuestionForAdminOnly && !a ? null : /* @__PURE__ */ r(
15
- x,
16
- {
17
- question: {
18
- ...e,
19
- key: `states.${o}.${y(e.key)}`
20
- // Its important not to convert state as it must maintain two capital letters
10
+ }), Q = () => {
11
+ const a = x(), { employeeStateTaxes: i, isAdmin: n } = f(), { t: p } = m("Employee.Taxes"), { t: l } = m("common", { keyPrefix: "statesHash" });
12
+ return i.map(
13
+ ({ state: o, questions: r }) => Array.isArray(r) && (n || r.find((e) => !e.isQuestionForAdminOnly)) ? /* @__PURE__ */ c(y, { children: [
14
+ /* @__PURE__ */ s(a.Heading, { as: "h2", children: p("stateTaxesTitle", { state: l(o) }) }),
15
+ r.map((e) => e.isQuestionForAdminOnly && !n ? null : /* @__PURE__ */ s(
16
+ u,
17
+ {
18
+ question: {
19
+ ...e,
20
+ key: `states.${o}.${d(e.key)}`
21
+ // Its important not to convert state as it must maintain two capital letters
22
+ },
23
+ questionType: e.key === "fileNewHireReport" ? "Radio" : e.inputQuestionFormat.type
21
24
  },
22
- questionType: e.key === "fileNewHireReport" ? "Radio" : e.inputQuestionFormat.type
23
- },
24
- e.key
25
- ))
26
- ] }, o));
25
+ e.key
26
+ ))
27
+ ] }, o) : null
28
+ );
27
29
  };
28
30
  export {
29
- j as StateForm,
30
- S as StateFormSchema
31
+ Q as StateForm,
32
+ H as StateFormSchema
31
33
  };
32
34
  //# sourceMappingURL=StateForm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"StateForm.js","sources":["../../../../src/components/Employee/Taxes/StateForm.tsx"],"sourcesContent":["import { Fragment } from 'react/jsx-runtime'\nimport { useTranslation } from 'react-i18next'\nimport { z } from 'zod'\nimport { useTaxes } from './useTaxes'\nimport type { STATES_ABBR } from '@/shared/constants'\nimport { snakeCaseToCamelCase } from '@/helpers/formattedStrings'\nimport { QuestionInput } from '@/components/Common/TaxInputs/TaxInputs'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\nexport const StateFormSchema = z.object({\n states: z.record(z.string(), z.record(z.string(), z.unknown())).optional(),\n})\n\nexport type StateFormPayload = z.output<typeof StateFormSchema>\n\nexport const StateForm = () => {\n const Components = useComponentContext()\n const { employeeStateTaxes, isAdmin } = useTaxes()\n const { t } = useTranslation('Employee.Taxes')\n const { t: statesHash } = useTranslation('common', { keyPrefix: 'statesHash' })\n\n return employeeStateTaxes.map(({ state, questions }) => (\n <Fragment key={state}>\n <Components.Heading as=\"h2\">\n {t('stateTaxesTitle', { state: statesHash(state as (typeof STATES_ABBR)[number]) })}\n </Components.Heading>\n {questions?.map(question => {\n if (question.isQuestionForAdminOnly && !isAdmin) return null\n return (\n <QuestionInput\n question={{\n ...question,\n key: `states.${state}.${snakeCaseToCamelCase(question.key)}`, // Its important not to convert state as it must maintain two capital letters\n }}\n questionType={\n question.key === 'fileNewHireReport' ? 'Radio' : question.inputQuestionFormat.type\n }\n key={question.key}\n />\n )\n })}\n </Fragment>\n ))\n}\n"],"names":["StateFormSchema","z","StateForm","Components","useComponentContext","employeeStateTaxes","isAdmin","useTaxes","t","useTranslation","statesHash","state","questions","Fragment","jsx","question","QuestionInput","snakeCaseToCamelCase"],"mappings":";;;;;;;AASa,MAAAA,IAAkBC,EAAE,OAAO;AAAA,EACtC,QAAQA,EAAE,OAAOA,EAAE,UAAUA,EAAE,OAAOA,EAAE,OAAA,GAAUA,EAAE,QAAS,CAAA,CAAC,EAAE,SAAS;AAC3E,CAAC,GAIYC,IAAY,MAAM;AAC7B,QAAMC,IAAaC,EAAoB,GACjC,EAAE,oBAAAC,GAAoB,SAAAC,EAAQ,IAAIC,EAAS,GAC3C,EAAE,GAAAC,EAAA,IAAMC,EAAe,gBAAgB,GACvC,EAAE,GAAGC,MAAeD,EAAe,UAAU,EAAE,WAAW,cAAc;AAEvE,SAAAJ,EAAmB,IAAI,CAAC,EAAE,OAAAM,GAAO,WAAAC,EAAU,wBAC/CC,GACC,EAAA,UAAA;AAAA,IAAA,gBAAAC,EAACX,EAAW,SAAX,EAAmB,IAAG,MACpB,UAAAK,EAAE,mBAAmB,EAAE,OAAOE,EAAWC,CAAqC,EAAA,CAAG,EACpF,CAAA;AAAA,IACCC,GAAW,IAAI,CAAYG,MACtBA,EAAS,0BAA0B,CAACT,IAAgB,OAEtD,gBAAAQ;AAAA,MAACE;AAAA,MAAA;AAAA,QACC,UAAU;AAAA,UACR,GAAGD;AAAA,UACH,KAAK,UAAUJ,CAAK,IAAIM,EAAqBF,EAAS,GAAG,CAAC;AAAA;AAAA,QAC5D;AAAA,QACA,cACEA,EAAS,QAAQ,sBAAsB,UAAUA,EAAS,oBAAoB;AAAA,MAAA;AAAA,MAE3EA,EAAS;AAAA,IAChB,CAEH;AAAA,EAAA,EAAA,GAlBYJ,CAmBf,CACD;AACH;"}
1
+ {"version":3,"file":"StateForm.js","sources":["../../../../src/components/Employee/Taxes/StateForm.tsx"],"sourcesContent":["import { Fragment } from 'react/jsx-runtime'\nimport { useTranslation } from 'react-i18next'\nimport { z } from 'zod'\nimport { useTaxes } from './useTaxes'\nimport type { STATES_ABBR } from '@/shared/constants'\nimport { snakeCaseToCamelCase } from '@/helpers/formattedStrings'\nimport { QuestionInput } from '@/components/Common/TaxInputs/TaxInputs'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\nexport const StateFormSchema = z.object({\n states: z.record(z.string(), z.record(z.string(), z.unknown())).optional(),\n})\n\nexport type StateFormPayload = z.output<typeof StateFormSchema>\n\nexport const StateForm = () => {\n const Components = useComponentContext()\n const { employeeStateTaxes, isAdmin } = useTaxes()\n const { t } = useTranslation('Employee.Taxes')\n const { t: statesHash } = useTranslation('common', { keyPrefix: 'statesHash' })\n\n return employeeStateTaxes.map(({ state, questions }) =>\n Array.isArray(questions) && (isAdmin || questions.find(q => !q.isQuestionForAdminOnly)) ? (\n <Fragment key={state}>\n <Components.Heading as=\"h2\">\n {t('stateTaxesTitle', { state: statesHash(state as (typeof STATES_ABBR)[number]) })}\n </Components.Heading>\n {questions.map(question => {\n if (question.isQuestionForAdminOnly && !isAdmin) return null\n return (\n <QuestionInput\n question={{\n ...question,\n key: `states.${state}.${snakeCaseToCamelCase(question.key)}`, // Its important not to convert state as it must maintain two capital letters\n }}\n questionType={\n question.key === 'fileNewHireReport' ? 'Radio' : question.inputQuestionFormat.type\n }\n key={question.key}\n />\n )\n })}\n </Fragment>\n ) : null,\n )\n}\n"],"names":["StateFormSchema","z","StateForm","Components","useComponentContext","employeeStateTaxes","isAdmin","useTaxes","t","useTranslation","statesHash","state","questions","q","Fragment","jsx","question","QuestionInput","snakeCaseToCamelCase"],"mappings":";;;;;;;AASa,MAAAA,IAAkBC,EAAE,OAAO;AAAA,EACtC,QAAQA,EAAE,OAAOA,EAAE,UAAUA,EAAE,OAAOA,EAAE,OAAA,GAAUA,EAAE,QAAS,CAAA,CAAC,EAAE,SAAS;AAC3E,CAAC,GAIYC,IAAY,MAAM;AAC7B,QAAMC,IAAaC,EAAoB,GACjC,EAAE,oBAAAC,GAAoB,SAAAC,EAAQ,IAAIC,EAAS,GAC3C,EAAE,GAAAC,EAAA,IAAMC,EAAe,gBAAgB,GACvC,EAAE,GAAGC,MAAeD,EAAe,UAAU,EAAE,WAAW,cAAc;AAE9E,SAAOJ,EAAmB;AAAA,IAAI,CAAC,EAAE,OAAAM,GAAO,WAAAC,QACtC,MAAM,QAAQA,CAAS,MAAMN,KAAWM,EAAU,KAAK,CAAKC,MAAA,CAACA,EAAE,sBAAsB,uBAClFC,GACC,EAAA,UAAA;AAAA,MAAA,gBAAAC,EAACZ,EAAW,SAAX,EAAmB,IAAG,MACpB,UAAAK,EAAE,mBAAmB,EAAE,OAAOE,EAAWC,CAAqC,EAAA,CAAG,EACpF,CAAA;AAAA,MACCC,EAAU,IAAI,CAAYI,MACrBA,EAAS,0BAA0B,CAACV,IAAgB,OAEtD,gBAAAS;AAAA,QAACE;AAAA,QAAA;AAAA,UACC,UAAU;AAAA,YACR,GAAGD;AAAA,YACH,KAAK,UAAUL,CAAK,IAAIO,EAAqBF,EAAS,GAAG,CAAC;AAAA;AAAA,UAC5D;AAAA,UACA,cACEA,EAAS,QAAQ,sBAAsB,UAAUA,EAAS,oBAAoB;AAAA,QAAA;AAAA,QAE3EA,EAAS;AAAA,MAChB,CAEH;AAAA,IAAA,EAAA,GAlBYL,CAmBf,IACE;AAAA,EACN;AACF;"}
@@ -7,7 +7,7 @@ export declare function Taxes(props: TaxesProps & BaseComponentInterface): impor
7
7
  export declare namespace Taxes {
8
8
  var FederalHead: typeof import("./FederalHead").FederalHead;
9
9
  var FederalForm: typeof import("./FederalForm").FederalForm;
10
- var StateForm: () => import("react/jsx-runtime").JSX.Element[];
10
+ var StateForm: () => (import("react/jsx-runtime").JSX.Element | null)[];
11
11
  var Actions: () => import("react/jsx-runtime").JSX.Element;
12
12
  }
13
13
  export declare const TaxesContextual: () => import("react/jsx-runtime").JSX.Element;
@@ -1,36 +1,37 @@
1
1
  import { jsx as t, jsxs as J, Fragment as X } from "react/jsx-runtime";
2
- import { zodResolver as q } from "@hookform/resolvers/zod";
3
- import { useForm as B, FormProvider as V } from "react-hook-form";
2
+ import { zodResolver as B } from "@hookform/resolvers/zod";
3
+ import { useForm as G, FormProvider as V } from "react-hook-form";
4
4
  import { useTranslation as W } from "react-i18next";
5
5
  import { useEffect as Y } from "react";
6
- import { useEmployeeTaxSetupGetFederalTaxesSuspense as j } from "@gusto/embedded-api/react-query/employeeTaxSetupGetFederalTaxes";
7
- import { useEmployeeTaxSetupUpdateFederalTaxesMutation as G } from "@gusto/embedded-api/react-query/employeeTaxSetupUpdateFederalTaxes";
8
- import { useEmployeeTaxSetupGetStateTaxesSuspense as z } from "@gusto/embedded-api/react-query/employeeTaxSetupGetStateTaxes";
9
- import { useEmployeeTaxSetupUpdateStateTaxesMutation as K } from "@gusto/embedded-api/react-query/employeeTaxSetupUpdateStateTaxes";
6
+ import { useQueryClient as j } from "@tanstack/react-query";
7
+ import { useEmployeeTaxSetupGetFederalTaxesSuspense as Q, invalidateEmployeeTaxSetupGetFederalTaxes as z } from "@gusto/embedded-api/react-query/employeeTaxSetupGetFederalTaxes";
8
+ import { useEmployeeTaxSetupUpdateFederalTaxesMutation as K } from "@gusto/embedded-api/react-query/employeeTaxSetupUpdateFederalTaxes";
9
+ import { useEmployeeTaxSetupGetStateTaxesSuspense as Z } from "@gusto/embedded-api/react-query/employeeTaxSetupGetStateTaxes";
10
+ import { useEmployeeTaxSetupUpdateStateTaxesMutation as $ } from "@gusto/embedded-api/react-query/employeeTaxSetupUpdateStateTaxes";
10
11
  import { Actions as g } from "./Actions.js";
11
- import { FederalFormSchema as Q, FederalForm as w } from "./FederalForm.js";
12
- import { FederalHead as P } from "./FederalHead.js";
13
- import { StateFormSchema as Z, StateForm as b } from "./StateForm.js";
14
- import { TaxesProvider as $ } from "./useTaxes.js";
15
- import { BaseComponent as ee } from "../../Base/Base.js";
16
- import { useBase as te } from "../../Base/useBase.js";
17
- import { useFlow as oe } from "../../Flow/useFlow.js";
18
- import { useI18n as se, useComponentDictionary as re } from "../../../i18n/I18n.js";
12
+ import { FederalFormSchema as ee, FederalForm as P } from "./FederalForm.js";
13
+ import { FederalHead as b } from "./FederalHead.js";
14
+ import { StateFormSchema as te, StateForm as _ } from "./StateForm.js";
15
+ import { TaxesProvider as oe } from "./useTaxes.js";
16
+ import { BaseComponent as re } from "../../Base/Base.js";
17
+ import { useBase as se } from "../../Base/useBase.js";
18
+ import { useFlow as ae } from "../../Flow/useFlow.js";
19
+ import { useI18n as ne, useComponentDictionary as ie } from "../../../i18n/I18n.js";
19
20
  import { componentEvents as S } from "../../../shared/constants.js";
20
- import { snakeCaseToCamelCase as A } from "../../../helpers/formattedStrings.js";
21
- import { Form as ae } from "../../Common/Form/Form.js";
22
- const ne = "2010-01-01";
23
- function l(o) {
24
- return /* @__PURE__ */ t(ee, { ...o, children: /* @__PURE__ */ t(me, { ...o, children: o.children }) });
21
+ import { snakeCaseToCamelCase as w } from "../../../helpers/formattedStrings.js";
22
+ import { Form as me } from "../../Common/Form/Form.js";
23
+ const le = "2010-01-01";
24
+ function u(o) {
25
+ return /* @__PURE__ */ t(re, { ...o, children: /* @__PURE__ */ t(de, { ...o, children: o.children }) });
25
26
  }
26
- const me = (o) => {
27
- const { employeeId: n, className: y, children: u, isAdmin: _ = !1, dictionary: D } = o, { onEvent: T, fieldErrors: p, baseSubmitHandler: U } = te();
28
- se("Employee.Taxes"), re("Employee.Taxes", D);
29
- const { data: N } = j({
30
- employeeUuid: n
31
- }), e = N.employeeFederalTax, { mutateAsync: k, isPending: I } = G(), { data: R } = z({
32
- employeeUuid: n
33
- }), E = R.employeeStateTaxesList, { mutateAsync: C, isPending: L } = K(), M = {
27
+ const de = (o) => {
28
+ const { employeeId: r, className: y, children: p, isAdmin: h = !1, dictionary: D } = o, { onEvent: T, fieldErrors: c, baseSubmitHandler: U } = se();
29
+ ne("Employee.Taxes"), ie("Employee.Taxes", D);
30
+ const N = j(), { data: k } = Q({
31
+ employeeUuid: r
32
+ }), e = k.employeeFederalTax, { mutateAsync: C, isPending: I } = K(), { data: R } = Z({
33
+ employeeUuid: r
34
+ }), E = R.employeeStateTaxesList, { mutateAsync: L, isPending: M } = $(), O = {
34
35
  ...e,
35
36
  filingStatus: e.filingStatus ?? void 0,
36
37
  twoJobs: e.twoJobs ? "true" : "false",
@@ -38,94 +39,97 @@ const me = (o) => {
38
39
  dependentsAmount: e.dependentsAmount ? Number(e.dependentsAmount) : 0,
39
40
  otherIncome: e.otherIncome ? Number(e.otherIncome) : 0,
40
41
  extraWithholding: e.extraWithholding ? Number(e.extraWithholding) : 0,
41
- states: E.reduce((s, r) => (r.state && (s[r.state] = r.questions?.reduce((a, i) => {
42
- const d = i.answers[0]?.value, m = A(i.key);
43
- return m === "fileNewHireReport" ? a[m] = typeof d > "u" ? !0 : d : a[m] = d ?? "", a;
42
+ states: E.reduce((s, a) => (a.state && (s[a.state] = a.questions?.reduce((n, l) => {
43
+ const d = l.answers[0]?.value, m = w(l.key);
44
+ return m === "fileNewHireReport" ? n[m] = typeof d > "u" ? !0 : d : n[m] = d, n;
44
45
  }, {})), s), {})
45
- }, F = B({
46
- resolver: q(Q.merge(Z)),
47
- defaultValues: M
48
- }), { handleSubmit: O, setError: h } = F;
46
+ }, v = G({
47
+ resolver: B(ee.merge(te)),
48
+ defaultValues: O
49
+ }), { handleSubmit: q, setError: A } = v;
49
50
  return Y(() => {
50
- p && p.length > 0 && p.forEach((s) => {
51
- const r = s.key.replace(".value", "");
52
- h(r, { type: "custom", message: s.message });
51
+ c && c.length > 0 && c.forEach((s) => {
52
+ const a = s.key.replace(".value", "");
53
+ A(a, { type: "custom", message: s.message });
53
54
  });
54
- }, [p, h]), /* @__PURE__ */ t("section", { className: y, children: /* @__PURE__ */ t(
55
- $,
55
+ }, [c, A]), /* @__PURE__ */ t("section", { className: y, children: /* @__PURE__ */ t(
56
+ oe,
56
57
  {
57
58
  value: {
58
59
  employeeStateTaxes: E,
59
- isAdmin: _,
60
- isPending: I || L
60
+ isAdmin: h,
61
+ isPending: I || M
61
62
  },
62
- children: /* @__PURE__ */ t(V, { ...F, children: /* @__PURE__ */ t(ae, { onSubmit: O(async (s) => {
63
- await U(s, async (r) => {
64
- const { states: a, ...i } = r, d = await k({
63
+ children: /* @__PURE__ */ t(V, { ...v, children: /* @__PURE__ */ t(me, { onSubmit: q(async (s) => {
64
+ await U(s, async (a) => {
65
+ const { states: n, ...l } = a, d = await C({
65
66
  request: {
66
- employeeUuid: n,
67
+ employeeUuid: r,
67
68
  requestBody: {
68
- ...i,
69
- twoJobs: i.twoJobs === "true",
69
+ ...l,
70
+ twoJobs: l.twoJobs === "true",
70
71
  version: e.version
71
72
  }
72
73
  }
73
74
  });
74
- if (T(S.EMPLOYEE_FEDERAL_TAXES_UPDATED, d), a && Object.keys(a).length > 0) {
75
+ if (await z(N, [r]), T(S.EMPLOYEE_FEDERAL_TAXES_UPDATED, d), n && Object.keys(n).length > 0) {
75
76
  const m = [];
76
- for (const v of E) {
77
- const x = v.state;
78
- x && m.push({
79
- state: x,
80
- questions: v.questions?.map((c) => {
81
- const f = a[x]?.[A(c.key)];
77
+ for (const x of E) {
78
+ const F = x.state;
79
+ F && x.questions !== void 0 && m.push({
80
+ state: F,
81
+ questions: x.questions.map((i) => {
82
+ if (i.isQuestionForAdminOnly && !h)
83
+ return null;
84
+ const f = n[F]?.[w(i.key)];
82
85
  return {
83
- key: c.key,
86
+ key: i.key,
84
87
  answers: [
85
88
  {
86
- validFrom: c.answers[0]?.validFrom ?? ne,
87
- validUpTo: c.answers[0]?.validUpTo ?? null,
89
+ validFrom: i.answers[0]?.validFrom ?? le,
90
+ validUpTo: i.answers[0]?.validUpTo ?? null,
88
91
  value: f == null || typeof f == "number" && isNaN(f) ? "" : f
89
92
  }
90
93
  ]
91
94
  };
92
- })
95
+ }).filter((i) => i !== null)
96
+ //Filtering out questions in non-admin setup
93
97
  });
94
98
  }
95
- const H = await C({
96
- request: { employeeUuid: n, employeeStateTaxesRequest: { states: m } }
99
+ const H = await L({
100
+ request: { employeeUuid: r, employeeStateTaxesRequest: { states: m } }
97
101
  });
98
102
  T(S.EMPLOYEE_STATE_TAXES_UPDATED, H);
99
103
  }
100
104
  T(S.EMPLOYEE_TAXES_DONE);
101
105
  });
102
- }), children: u || /* @__PURE__ */ J(X, { children: [
103
- /* @__PURE__ */ t(P, {}),
104
- /* @__PURE__ */ t(w, {}),
106
+ }), children: p || /* @__PURE__ */ J(X, { children: [
105
107
  /* @__PURE__ */ t(b, {}),
108
+ /* @__PURE__ */ t(P, {}),
109
+ /* @__PURE__ */ t(_, {}),
106
110
  /* @__PURE__ */ t(g, {})
107
111
  ] }) }) })
108
112
  }
109
113
  ) });
110
114
  };
111
- l.FederalHead = P;
112
- l.FederalForm = w;
113
- l.StateForm = b;
114
- l.Actions = g;
115
- const Ue = () => {
116
- const { employeeId: o, onEvent: n, isAdmin: y } = oe(), { t: u } = W();
115
+ u.FederalHead = b;
116
+ u.FederalForm = P;
117
+ u.StateForm = _;
118
+ u.Actions = g;
119
+ const Ie = () => {
120
+ const { employeeId: o, onEvent: r, isAdmin: y } = ae(), { t: p } = W();
117
121
  if (!o)
118
122
  throw new Error(
119
- u("errors.missingParamsOrContext", {
123
+ p("errors.missingParamsOrContext", {
120
124
  component: "EmployeeTaxes",
121
125
  param: "employeeId",
122
126
  provider: "FlowProvider"
123
127
  })
124
128
  );
125
- return /* @__PURE__ */ t(l, { employeeId: o, onEvent: n, isAdmin: y ?? !1 });
129
+ return /* @__PURE__ */ t(u, { employeeId: o, onEvent: r, isAdmin: y ?? !1 });
126
130
  };
127
131
  export {
128
- l as Taxes,
129
- Ue as TaxesContextual
132
+ u as Taxes,
133
+ Ie as TaxesContextual
130
134
  };
131
135
  //# sourceMappingURL=Taxes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Taxes.js","sources":["../../../../src/components/Employee/Taxes/Taxes.tsx"],"sourcesContent":["import { zodResolver } from '@hookform/resolvers/zod'\nimport { FormProvider, useForm, type SubmitHandler } from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport { useEffect } from 'react'\nimport { useEmployeeTaxSetupGetFederalTaxesSuspense } from '@gusto/embedded-api/react-query/employeeTaxSetupGetFederalTaxes'\nimport { useEmployeeTaxSetupUpdateFederalTaxesMutation } from '@gusto/embedded-api/react-query/employeeTaxSetupUpdateFederalTaxes'\nimport { useEmployeeTaxSetupGetStateTaxesSuspense } from '@gusto/embedded-api/react-query/employeeTaxSetupGetStateTaxes'\nimport { useEmployeeTaxSetupUpdateStateTaxesMutation } from '@gusto/embedded-api/react-query/employeeTaxSetupUpdateStateTaxes'\nimport type { OnboardingContextInterface } from '../OnboardingFlow/OnboardingFlow'\nimport { Actions } from './Actions'\nimport {\n FederalForm,\n FederalFormSchema,\n type FederalFormInputs,\n type FederalFormPayload,\n} from './FederalForm'\nimport { FederalHead } from './FederalHead'\nimport { StateForm, StateFormSchema, type StateFormPayload } from './StateForm'\nimport { TaxesProvider } from './useTaxes'\nimport {\n useBase,\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n} from '@/components/Base'\nimport { useFlow } from '@/components/Flow/useFlow'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { snakeCaseToCamelCase } from '@/helpers/formattedStrings'\nimport { Form } from '@/components/Common/Form'\nimport { useComponentDictionary } from '@/i18n/I18n'\n\nconst DEFAULT_TAX_VALID_FROM = '2010-01-01'\n\ninterface TaxesProps extends CommonComponentInterface<'Employee.Taxes'> {\n employeeId: string\n isAdmin?: boolean\n}\n\nexport function Taxes(props: TaxesProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nconst Root = (props: TaxesProps) => {\n const { employeeId, className, children, isAdmin = false, dictionary } = props\n const { onEvent, fieldErrors, baseSubmitHandler } = useBase()\n useI18n('Employee.Taxes')\n useComponentDictionary('Employee.Taxes', dictionary)\n\n const { data: fedData } = useEmployeeTaxSetupGetFederalTaxesSuspense({\n employeeUuid: employeeId,\n })\n const employeeFederalTax = fedData.employeeFederalTax!\n\n const { mutateAsync: updateFederalTaxes, isPending: isPendingFederalTaxes } =\n useEmployeeTaxSetupUpdateFederalTaxesMutation()\n\n const { data: stateData } = useEmployeeTaxSetupGetStateTaxesSuspense({\n employeeUuid: employeeId,\n })\n const employeeStateTaxes = stateData.employeeStateTaxesList!\n const { mutateAsync: updateStateTaxes, isPending: isPendingStateTaxes } =\n useEmployeeTaxSetupUpdateStateTaxesMutation()\n\n const defaultValues = {\n ...employeeFederalTax,\n filingStatus: employeeFederalTax.filingStatus ?? undefined,\n twoJobs: employeeFederalTax.twoJobs ? 'true' : 'false',\n deductions: employeeFederalTax.deductions ? Number(employeeFederalTax.deductions) : 0,\n dependentsAmount: employeeFederalTax.dependentsAmount\n ? Number(employeeFederalTax.dependentsAmount)\n : 0,\n otherIncome: employeeFederalTax.otherIncome ? Number(employeeFederalTax.otherIncome) : 0,\n extraWithholding: employeeFederalTax.extraWithholding\n ? Number(employeeFederalTax.extraWithholding)\n : 0,\n states: employeeStateTaxes.reduce((acc: Record<string, unknown>, state) => {\n if (state.state) {\n acc[state.state] = state.questions?.reduce((acc: Record<string, unknown>, question) => {\n const value = question.answers[0]?.value\n const key = snakeCaseToCamelCase(question.key)\n // Default new hire report to true if not specified\n if (key === 'fileNewHireReport') {\n acc[key] = typeof value === 'undefined' ? true : value\n } else {\n acc[key] = value ?? ''\n }\n return acc\n }, {})\n }\n return acc\n }, {}),\n }\n\n const formMethods = useForm<FederalFormInputs, unknown, FederalFormPayload & StateFormPayload>({\n resolver: zodResolver(FederalFormSchema.merge(StateFormSchema)),\n defaultValues,\n })\n const { handleSubmit, setError: _setError } = formMethods\n\n useEffect(() => {\n //If list of field specific errors from API is present, mark corresponding fields as invalid\n if (fieldErrors && fieldErrors.length > 0) {\n fieldErrors.forEach(msgObject => {\n const key = msgObject.key.replace('.value', '')\n _setError(key as keyof FederalFormInputs, { type: 'custom', message: msgObject.message })\n })\n }\n }, [fieldErrors, _setError])\n\n const onSubmit: SubmitHandler<FederalFormPayload & StateFormPayload> = async data => {\n await baseSubmitHandler(data, async payload => {\n const { states: statesPayload, ...federalPayload } = payload\n\n const federalTaxesResponse = await updateFederalTaxes({\n request: {\n employeeUuid: employeeId,\n requestBody: {\n ...federalPayload,\n twoJobs: federalPayload.twoJobs === 'true',\n version: employeeFederalTax.version,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_FEDERAL_TAXES_UPDATED, federalTaxesResponse)\n\n //State Taxes - only process if statesPayload exists\n if (statesPayload && Object.keys(statesPayload).length > 0) {\n const states = []\n\n for (const state of employeeStateTaxes) {\n const stateName = state.state\n\n if (stateName) {\n states.push({\n state: stateName,\n questions: state.questions?.map(question => {\n const formValue = statesPayload[stateName]?.[snakeCaseToCamelCase(question.key)]\n return {\n key: question.key,\n answers: [\n {\n validFrom: question.answers[0]?.validFrom ?? DEFAULT_TAX_VALID_FROM,\n validUpTo: question.answers[0]?.validUpTo ?? null,\n value:\n formValue == null || (typeof formValue === 'number' && isNaN(formValue))\n ? ''\n : (formValue as string | number | boolean),\n },\n ],\n }\n }),\n })\n }\n }\n\n const stateTaxesResponse = await updateStateTaxes({\n request: { employeeUuid: employeeId, employeeStateTaxesRequest: { states } },\n })\n onEvent(componentEvents.EMPLOYEE_STATE_TAXES_UPDATED, stateTaxesResponse)\n }\n\n onEvent(componentEvents.EMPLOYEE_TAXES_DONE)\n })\n }\n\n return (\n <section className={className}>\n <TaxesProvider\n value={{\n employeeStateTaxes,\n isAdmin: isAdmin,\n isPending: isPendingFederalTaxes || isPendingStateTaxes,\n }}\n >\n <FormProvider {...formMethods}>\n <Form onSubmit={handleSubmit(onSubmit)}>\n {children ? (\n children\n ) : (\n <>\n <FederalHead />\n <FederalForm />\n <StateForm />\n <Actions />\n </>\n )}\n </Form>\n </FormProvider>\n </TaxesProvider>\n </section>\n )\n}\nTaxes.FederalHead = FederalHead\nTaxes.FederalForm = FederalForm\nTaxes.StateForm = StateForm\nTaxes.Actions = Actions\n\nexport const TaxesContextual = () => {\n const { employeeId, onEvent, isAdmin } = useFlow<OnboardingContextInterface>()\n const { t } = useTranslation()\n if (!employeeId) {\n throw new Error(\n t('errors.missingParamsOrContext', {\n component: 'EmployeeTaxes',\n param: 'employeeId',\n provider: 'FlowProvider',\n }),\n )\n }\n return <Taxes employeeId={employeeId} onEvent={onEvent} isAdmin={isAdmin ?? false} />\n}\n"],"names":["DEFAULT_TAX_VALID_FROM","Taxes","props","jsx","BaseComponent","Root","employeeId","className","children","isAdmin","dictionary","onEvent","fieldErrors","baseSubmitHandler","useBase","useI18n","useComponentDictionary","fedData","useEmployeeTaxSetupGetFederalTaxesSuspense","employeeFederalTax","updateFederalTaxes","isPendingFederalTaxes","useEmployeeTaxSetupUpdateFederalTaxesMutation","stateData","useEmployeeTaxSetupGetStateTaxesSuspense","employeeStateTaxes","updateStateTaxes","isPendingStateTaxes","useEmployeeTaxSetupUpdateStateTaxesMutation","defaultValues","acc","state","question","value","key","snakeCaseToCamelCase","formMethods","useForm","zodResolver","FederalFormSchema","StateFormSchema","handleSubmit","_setError","useEffect","msgObject","TaxesProvider","FormProvider","Form","data","payload","statesPayload","federalPayload","federalTaxesResponse","componentEvents","states","stateName","formValue","stateTaxesResponse","jsxs","Fragment","FederalHead","FederalForm","StateForm","Actions","TaxesContextual","useFlow","t","useTranslation"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAgCA,MAAMA,KAAyB;AAOxB,SAASC,EAAMC,GAA4C;AAE9D,SAAA,gBAAAC,EAACC,IAAe,EAAA,GAAGF,GACjB,UAAA,gBAAAC,EAACE,MAAM,GAAGH,GAAQ,UAAMA,EAAA,SAAA,CAAS,EACnC,CAAA;AAEJ;AAEA,MAAMG,KAAO,CAACH,MAAsB;AAClC,QAAM,EAAE,YAAAI,GAAY,WAAAC,GAAW,UAAAC,GAAU,SAAAC,IAAU,IAAO,YAAAC,MAAeR,GACnE,EAAE,SAAAS,GAAS,aAAAC,GAAa,mBAAAC,EAAA,IAAsBC,GAAQ;AAC5D,EAAAC,GAAQ,gBAAgB,GACxBC,GAAuB,kBAAkBN,CAAU;AAEnD,QAAM,EAAE,MAAMO,EAAQ,IAAIC,EAA2C;AAAA,IACnE,cAAcZ;AAAA,EAAA,CACf,GACKa,IAAqBF,EAAQ,oBAE7B,EAAE,aAAaG,GAAoB,WAAWC,EAAA,IAClDC,EAA8C,GAE1C,EAAE,MAAMC,EAAU,IAAIC,EAAyC;AAAA,IACnE,cAAclB;AAAA,EAAA,CACf,GACKmB,IAAqBF,EAAU,wBAC/B,EAAE,aAAaG,GAAkB,WAAWC,EAAA,IAChDC,EAA4C,GAExCC,IAAgB;AAAA,IACpB,GAAGV;AAAA,IACH,cAAcA,EAAmB,gBAAgB;AAAA,IACjD,SAASA,EAAmB,UAAU,SAAS;AAAA,IAC/C,YAAYA,EAAmB,aAAa,OAAOA,EAAmB,UAAU,IAAI;AAAA,IACpF,kBAAkBA,EAAmB,mBACjC,OAAOA,EAAmB,gBAAgB,IAC1C;AAAA,IACJ,aAAaA,EAAmB,cAAc,OAAOA,EAAmB,WAAW,IAAI;AAAA,IACvF,kBAAkBA,EAAmB,mBACjC,OAAOA,EAAmB,gBAAgB,IAC1C;AAAA,I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ACyD,GAAY,EAAA;AAAA,0BACZC,GAAY,EAAA;AAAA,0BACZC,GAAU,EAAA;AAAA,0BACVC,GAAQ,CAAA,CAAA;AAAA,MAAA,EACX,CAAA,EAEJ,CAAA,EACF,CAAA;AAAA,IAAA;AAAA,EAAA,GAEJ;AAEJ;AACA9D,EAAM,cAAc2D;AACpB3D,EAAM,cAAc4D;AACpB5D,EAAM,YAAY6D;AAClB7D,EAAM,UAAU8D;AAET,MAAMC,KAAkB,MAAM;AACnC,QAAM,EAAE,YAAA1D,GAAY,SAAAK,GAAS,SAAAF,EAAA,IAAYwD,GAAoC,GACvE,EAAE,GAAAC,EAAE,IAAIC,EAAe;AAC7B,MAAI,CAAC7D;AACH,UAAM,IAAI;AAAA,MACR4D,EAAE,iCAAiC;AAAA,QACjC,WAAW;AAAA,QACX,OAAO;AAAA,QACP,UAAU;AAAA,MACX,CAAA;AAAA,IACH;AAEF,2BAAQjE,GAAM,EAAA,YAAAK,GAAwB,SAAAK,GAAkB,SAASF,KAAW,IAAO;AACrF;"}
1
+ {"version":3,"file":"Taxes.js","sources":["../../../../src/components/Employee/Taxes/Taxes.tsx"],"sourcesContent":["import { zodResolver } from '@hookform/resolvers/zod'\nimport { FormProvider, useForm, type SubmitHandler } from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport { useEffect } from 'react'\nimport { useQueryClient } from '@tanstack/react-query'\nimport {\n useEmployeeTaxSetupGetFederalTaxesSuspense,\n invalidateEmployeeTaxSetupGetFederalTaxes,\n} from '@gusto/embedded-api/react-query/employeeTaxSetupGetFederalTaxes'\nimport { useEmployeeTaxSetupUpdateFederalTaxesMutation } from '@gusto/embedded-api/react-query/employeeTaxSetupUpdateFederalTaxes'\nimport { useEmployeeTaxSetupGetStateTaxesSuspense } from '@gusto/embedded-api/react-query/employeeTaxSetupGetStateTaxes'\nimport { useEmployeeTaxSetupUpdateStateTaxesMutation } from '@gusto/embedded-api/react-query/employeeTaxSetupUpdateStateTaxes'\nimport type { OnboardingContextInterface } from '../OnboardingFlow/OnboardingFlow'\nimport { Actions } from './Actions'\nimport {\n FederalForm,\n FederalFormSchema,\n type FederalFormInputs,\n type FederalFormPayload,\n} from './FederalForm'\nimport { FederalHead } from './FederalHead'\nimport { StateForm, StateFormSchema, type StateFormPayload } from './StateForm'\nimport { TaxesProvider } from './useTaxes'\nimport {\n useBase,\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n} from '@/components/Base'\nimport { useFlow } from '@/components/Flow/useFlow'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { snakeCaseToCamelCase } from '@/helpers/formattedStrings'\nimport { Form } from '@/components/Common/Form'\nimport { useComponentDictionary } from '@/i18n/I18n'\n\nconst DEFAULT_TAX_VALID_FROM = '2010-01-01'\n\ninterface TaxesProps extends CommonComponentInterface<'Employee.Taxes'> {\n employeeId: string\n isAdmin?: boolean\n}\n\nexport function Taxes(props: TaxesProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nconst Root = (props: TaxesProps) => {\n const { employeeId, className, children, isAdmin = false, dictionary } = props\n const { onEvent, fieldErrors, baseSubmitHandler } = useBase()\n useI18n('Employee.Taxes')\n useComponentDictionary('Employee.Taxes', dictionary)\n const queryClient = useQueryClient()\n\n const { data: fedData } = useEmployeeTaxSetupGetFederalTaxesSuspense({\n employeeUuid: employeeId,\n })\n const employeeFederalTax = fedData.employeeFederalTax!\n\n const { mutateAsync: updateFederalTaxes, isPending: isPendingFederalTaxes } =\n useEmployeeTaxSetupUpdateFederalTaxesMutation()\n\n const { data: stateData } = useEmployeeTaxSetupGetStateTaxesSuspense({\n employeeUuid: employeeId,\n })\n const employeeStateTaxes = stateData.employeeStateTaxesList!\n const { mutateAsync: updateStateTaxes, isPending: isPendingStateTaxes } =\n useEmployeeTaxSetupUpdateStateTaxesMutation()\n\n const defaultValues = {\n ...employeeFederalTax,\n filingStatus: employeeFederalTax.filingStatus ?? undefined,\n twoJobs: employeeFederalTax.twoJobs ? 'true' : 'false',\n deductions: employeeFederalTax.deductions ? Number(employeeFederalTax.deductions) : 0,\n dependentsAmount: employeeFederalTax.dependentsAmount\n ? Number(employeeFederalTax.dependentsAmount)\n : 0,\n otherIncome: employeeFederalTax.otherIncome ? Number(employeeFederalTax.otherIncome) : 0,\n extraWithholding: employeeFederalTax.extraWithholding\n ? Number(employeeFederalTax.extraWithholding)\n : 0,\n states: employeeStateTaxes.reduce((acc: Record<string, unknown>, state) => {\n if (state.state) {\n acc[state.state] = state.questions?.reduce((acc: Record<string, unknown>, question) => {\n const value = question.answers[0]?.value\n const key = snakeCaseToCamelCase(question.key)\n // Default new hire report to true if not specified\n if (key === 'fileNewHireReport') {\n acc[key] = typeof value === 'undefined' ? true : value\n } else {\n acc[key] = value\n }\n return acc\n }, {})\n }\n return acc\n }, {}),\n }\n\n const formMethods = useForm<FederalFormInputs, unknown, FederalFormPayload & StateFormPayload>({\n resolver: zodResolver(FederalFormSchema.merge(StateFormSchema)),\n defaultValues,\n })\n const { handleSubmit, setError: _setError } = formMethods\n\n useEffect(() => {\n //If list of field specific errors from API is present, mark corresponding fields as invalid\n if (fieldErrors && fieldErrors.length > 0) {\n fieldErrors.forEach(msgObject => {\n const key = msgObject.key.replace('.value', '')\n _setError(key as keyof FederalFormInputs, { type: 'custom', message: msgObject.message })\n })\n }\n }, [fieldErrors, _setError])\n\n const onSubmit: SubmitHandler<FederalFormPayload & StateFormPayload> = async data => {\n await baseSubmitHandler(data, async payload => {\n const { states: statesPayload, ...federalPayload } = payload\n\n const federalTaxesResponse = await updateFederalTaxes({\n request: {\n employeeUuid: employeeId,\n requestBody: {\n ...federalPayload,\n twoJobs: federalPayload.twoJobs === 'true',\n version: employeeFederalTax.version,\n },\n },\n })\n await invalidateEmployeeTaxSetupGetFederalTaxes(queryClient, [employeeId])\n onEvent(componentEvents.EMPLOYEE_FEDERAL_TAXES_UPDATED, federalTaxesResponse)\n\n //State Taxes - only process if statesPayload exists\n if (statesPayload && Object.keys(statesPayload).length > 0) {\n const states = []\n\n for (const state of employeeStateTaxes) {\n const stateName = state.state\n\n if (stateName && state.questions !== undefined) {\n states.push({\n state: stateName,\n questions: state.questions\n .map(question => {\n if (question.isQuestionForAdminOnly && !isAdmin) {\n return null\n }\n const formValue = statesPayload[stateName]?.[snakeCaseToCamelCase(question.key)]\n return {\n key: question.key,\n answers: [\n {\n validFrom: question.answers[0]?.validFrom ?? DEFAULT_TAX_VALID_FROM,\n validUpTo: question.answers[0]?.validUpTo ?? null,\n value:\n formValue == null || (typeof formValue === 'number' && isNaN(formValue))\n ? ''\n : (formValue as string | number | boolean),\n },\n ],\n }\n })\n .filter(q => q !== null), //Filtering out questions in non-admin setup\n })\n }\n }\n\n const stateTaxesResponse = await updateStateTaxes({\n request: { employeeUuid: employeeId, employeeStateTaxesRequest: { states } },\n })\n onEvent(componentEvents.EMPLOYEE_STATE_TAXES_UPDATED, stateTaxesResponse)\n }\n\n onEvent(componentEvents.EMPLOYEE_TAXES_DONE)\n })\n }\n\n return (\n <section className={className}>\n <TaxesProvider\n value={{\n employeeStateTaxes,\n isAdmin: isAdmin,\n isPending: isPendingFederalTaxes || isPendingStateTaxes,\n }}\n >\n <FormProvider {...formMethods}>\n <Form onSubmit={handleSubmit(onSubmit)}>\n {children ? (\n children\n ) : (\n <>\n <FederalHead />\n <FederalForm />\n <StateForm />\n <Actions />\n </>\n )}\n </Form>\n </FormProvider>\n </TaxesProvider>\n </section>\n )\n}\nTaxes.FederalHead = FederalHead\nTaxes.FederalForm = FederalForm\nTaxes.StateForm = StateForm\nTaxes.Actions = Actions\n\nexport const TaxesContextual = () => {\n const { employeeId, onEvent, isAdmin } = useFlow<OnboardingContextInterface>()\n const { t } = useTranslation()\n if (!employeeId) {\n throw new Error(\n t('errors.missingParamsOrContext', {\n component: 'EmployeeTaxes',\n param: 'employeeId',\n provider: 'FlowProvider',\n }),\n )\n }\n return <Taxes employeeId={employeeId} onEvent={onEvent} isAdmin={isAdmin ?? false} />\n}\n"],"names":["DEFAULT_TAX_VALID_FROM","Taxes","props","jsx","BaseComponent","Root","employeeId","className","children","isAdmin","dictionary","onEvent","fieldErrors","baseSubmitHandler","useBase","useI18n","useComponentDictionary","queryClient","useQueryClient","fedData","useEmployeeTaxSetupGetFederalTaxesSuspense","employeeFederalTax","updateFederalTaxes","isPendingFederalTaxes","useEmployeeTaxSetupUpdateFederalTaxesMutation","stateData","useEmployeeTaxSetupGetStateTaxesSuspense","employeeStateTaxes","updateStateTaxes","isPendingStateTaxes","useEmployeeTaxSetupUpdateStateTaxesMutation","defaultValues","acc","state","question","value","key","snakeCaseToCamelCase","formMethods","useForm","zodResolver","FederalFormSchema","StateFormSchema","handleSubmit","_setError","useEffect","msgObject","TaxesProvider","FormProvider","Form","data","payload","statesPayload","federalPayload","federalTaxesResponse","invalidateEmployeeTaxSetupGetFederalTaxes","componentEvents","states","stateName","formValue","q","stateTaxesResponse","jsxs","Fragment","FederalHead","FederalForm","StateForm","Actions","TaxesContextual","useFlow","t","useTranslation"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAoCA,MAAMA,KAAyB;AAOxB,SAASC,EAAMC,GAA4C;AAE9D,SAAA,gBAAAC,EAACC,IAAe,EAAA,GAAGF,GACjB,UAAA,gBAAAC,EAACE,MAAM,GAAGH,GAAQ,UAAMA,EAAA,SAAA,CAAS,EACnC,CAAA;AAEJ;AAEA,MAAMG,KAAO,CAACH,MAAsB;AAClC,QAAM,EAAE,YAAAI,GAAY,WAAAC,GAAW,UAAAC,GAAU,SAAAC,IAAU,IAAO,YAAAC,MAAeR,GACnE,EAAE,SAAAS,GAAS,aAAAC,GAAa,mBAAAC,EAAA,IAAsBC,GAAQ;AAC5D,EAAAC,GAAQ,gBAAgB,GACxBC,GAAuB,kBAAkBN,CAAU;AACnD,QAAMO,IAAcC,EAAe,GAE7B,EAAE,MAAMC,EAAQ,IAAIC,EAA2C;AAAA,IACnE,cA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gE,EAAE,iCAAiC;AAAA,QACjC,WAAW;AAAA,QACX,OAAO;AAAA,QACP,UAAU;AAAA,MACX,CAAA;AAAA,IACH;AAEF,2BAAQrE,GAAM,EAAA,YAAAK,GAAwB,SAAAK,GAAkB,SAASF,KAAW,IAAO;AACrF;"}
@@ -1,4 +1,4 @@
1
1
  import "./types/i18next.d.ts"
2
2
  export * as Company from './Company';
3
- export * as Employee from './Employee';
4
3
  export * as Contractor from './Contractor';
4
+ export * as Employee from './Employee';
package/dist/i18n/I18n.js CHANGED
@@ -1,41 +1,41 @@
1
1
  import p from "../_virtual/dynamic-import-helper.js";
2
2
  import { useTranslation as m } from "react-i18next";
3
3
  import { LRUCache as l } from "../helpers/LRUCache.js";
4
- const g = "common", s = new l(50), c = ({ lng: n = "en", ns: o }) => {
5
- let e = !0, r = !1, t;
4
+ const C = "common", s = new l(50), c = ({ lng: n = "en", ns: o }) => {
5
+ let e = !0, t = !1, r;
6
6
  const i = (async () => {
7
7
  try {
8
- t = (await p(/* @__PURE__ */ Object.assign({ "./en/Company.AddBank.json": () => import("./en/Company.AddBank.json.js"), "./en/Company.Addresses.json": () => import("./en/Company.Addresses.json.js"), "./en/Company.AssignSignatory.json": () => import("./en/Company.AssignSignatory.json.js"), "./en/Company.BankAccount.json": () => import("./en/Company.BankAccount.json.js"), "./en/Company.DocumentList.json": () => import("./en/Company.DocumentList.json.js"), "./en/Company.FederalTaxes.json": () => import("./en/Company.FederalTaxes.json.js"), "./en/Company.Industry.json": () => import("./en/Company.Industry.json.js"), "./en/Company.Locations.json": () => import("./en/Company.Locations.json.js"), "./en/Company.OnboardingOverview.json": () => import("./en/Company.OnboardingOverview.json.js"), "./en/Company.PaySchedule.json": () => import("./en/Company.PaySchedule.json.js"), "./en/Company.SignatureForm.json": () => import("./en/Company.SignatureForm.json.js"), "./en/Company.StateTaxes.json": () => import("./en/Company.StateTaxes.json.js"), "./en/Contractor.Address.json": () => import("./en/Contractor.Address.json.js"), "./en/Employee.BankAccount.json": () => import("./en/Employee.BankAccount.json.js"), "./en/Employee.Compensation.json": () => import("./en/Employee.Compensation.json.js"), "./en/Employee.Deductions.json": () => import("./en/Employee.Deductions.json.js"), "./en/Employee.DocumentSigner.json": () => import("./en/Employee.DocumentSigner.json.js"), "./en/Employee.EmployeeList.json": () => import("./en/Employee.EmployeeList.json.js"), "./en/Employee.HomeAddress.json": () => import("./en/Employee.HomeAddress.json.js"), "./en/Employee.Landing.json": () => import("./en/Employee.Landing.json.js"), "./en/Employee.OnboardingSummary.json": () => import("./en/Employee.OnboardingSummary.json.js"), "./en/Employee.PaySchedules.json": () => import("./en/Employee.PaySchedules.json.js"), "./en/Employee.PaymentMethod.json": () => import("./en/Employee.PaymentMethod.json.js"), "./en/Employee.Profile.json": () => import("./en/Employee.Profile.json.js"), "./en/Employee.SplitPaycheck.json": () => import("./en/Employee.SplitPaycheck.json.js"), "./en/Employee.StateTaxes.json": () => import("./en/Employee.StateTaxes.json.js"), "./en/Employee.Taxes.json": () => import("./en/Employee.Taxes.json.js"), "./en/Payroll.PayrollHistoryList.json": () => import("./en/Payroll.PayrollHistoryList.json.js"), "./en/Payroll.PayrollSchedule.json": () => import("./en/Payroll.PayrollSchedule.json.js"), "./en/common.json": () => import("./en/common.json.js") }), `./${n}/${o}.json`, 3)).default, e = !1;
8
+ r = (await p(/* @__PURE__ */ Object.assign({ "./en/Company.AddBank.json": () => import("./en/Company.AddBank.json.js"), "./en/Company.Addresses.json": () => import("./en/Company.Addresses.json.js"), "./en/Company.AssignSignatory.json": () => import("./en/Company.AssignSignatory.json.js"), "./en/Company.BankAccount.json": () => import("./en/Company.BankAccount.json.js"), "./en/Company.DocumentList.json": () => import("./en/Company.DocumentList.json.js"), "./en/Company.FederalTaxes.json": () => import("./en/Company.FederalTaxes.json.js"), "./en/Company.Industry.json": () => import("./en/Company.Industry.json.js"), "./en/Company.Locations.json": () => import("./en/Company.Locations.json.js"), "./en/Company.OnboardingOverview.json": () => import("./en/Company.OnboardingOverview.json.js"), "./en/Company.PaySchedule.json": () => import("./en/Company.PaySchedule.json.js"), "./en/Company.SignatureForm.json": () => import("./en/Company.SignatureForm.json.js"), "./en/Company.StateTaxes.json": () => import("./en/Company.StateTaxes.json.js"), "./en/Contractor.Address.json": () => import("./en/Contractor.Address.json.js"), "./en/Contractor.ContractorList.json": () => import("./en/Contractor.ContractorList.json.js"), "./en/Contractor.NewHireReport.json": () => import("./en/Contractor.NewHireReport.json.js"), "./en/Contractor.PaymentMethod.json": () => import("./en/Contractor.PaymentMethod.json.js"), "./en/Employee.BankAccount.json": () => import("./en/Employee.BankAccount.json.js"), "./en/Employee.Compensation.json": () => import("./en/Employee.Compensation.json.js"), "./en/Employee.Deductions.json": () => import("./en/Employee.Deductions.json.js"), "./en/Employee.DocumentSigner.json": () => import("./en/Employee.DocumentSigner.json.js"), "./en/Employee.EmployeeList.json": () => import("./en/Employee.EmployeeList.json.js"), "./en/Employee.HomeAddress.json": () => import("./en/Employee.HomeAddress.json.js"), "./en/Employee.Landing.json": () => import("./en/Employee.Landing.json.js"), "./en/Employee.OnboardingSummary.json": () => import("./en/Employee.OnboardingSummary.json.js"), "./en/Employee.PaySchedules.json": () => import("./en/Employee.PaySchedules.json.js"), "./en/Employee.PaymentMethod.json": () => import("./en/Employee.PaymentMethod.json.js"), "./en/Employee.Profile.json": () => import("./en/Employee.Profile.json.js"), "./en/Employee.SplitPaycheck.json": () => import("./en/Employee.SplitPaycheck.json.js"), "./en/Employee.StateTaxes.json": () => import("./en/Employee.StateTaxes.json.js"), "./en/Employee.Taxes.json": () => import("./en/Employee.Taxes.json.js"), "./en/Payroll.PayrollHistoryList.json": () => import("./en/Payroll.PayrollHistoryList.json.js"), "./en/Payroll.PayrollSchedule.json": () => import("./en/Payroll.PayrollSchedule.json.js"), "./en/common.json": () => import("./en/common.json.js") }), `./${n}/${o}.json`, 3)).default, e = !1;
9
9
  } catch {
10
- r = !0, e = !1;
10
+ t = !0, e = !1;
11
11
  }
12
12
  })();
13
13
  return () => {
14
14
  if (e)
15
15
  throw i;
16
- if (r)
16
+ if (t)
17
17
  throw new Error(`Error loading translation for component: ${o}`);
18
- return t;
18
+ return r;
19
19
  };
20
- }, f = (n) => {
20
+ }, g = (n) => {
21
21
  const { i18n: o } = m();
22
22
  if (!n) return;
23
23
  const e = `${o.resolvedLanguage}:${n}`;
24
24
  s.get(e) === null && s.put(e, c({ lng: o.resolvedLanguage, ns: n }));
25
- const r = s.get(e);
26
- if (r) {
27
- const t = r();
28
- o.addResourceBundle(o.resolvedLanguage ?? "en", n, t, !0, !1);
25
+ const t = s.get(e);
26
+ if (t) {
27
+ const r = t();
28
+ o.addResourceBundle(o.resolvedLanguage ?? "en", n, r, !0, !1);
29
29
  }
30
- }, E = (n, o) => {
30
+ }, f = (n, o) => {
31
31
  const { i18n: e } = m();
32
32
  if (o)
33
- for (const r in o)
34
- e.addResourceBundle(r, n, o[r], !0, !0);
33
+ for (const t in o)
34
+ e.addResourceBundle(t, n, o[t], !0, !0);
35
35
  };
36
36
  export {
37
- g as defaultNS,
38
- E as useComponentDictionary,
39
- f as useI18n
37
+ C as defaultNS,
38
+ f as useComponentDictionary,
39
+ g as useI18n
40
40
  };
41
41
  //# sourceMappingURL=I18n.js.map