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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/components/Common/HamburgerMenu/HamburgerMenu.js +20 -19
  3. package/dist/components/Common/HamburgerMenu/HamburgerMenu.js.map +1 -1
  4. package/dist/components/Common/ReorderableList/ReorderableItem.js +1 -1
  5. package/dist/components/Common/ReorderableList/ReorderableItem.js.map +1 -1
  6. package/dist/components/Common/UI/Button/Button.d.ts +1 -1
  7. package/dist/components/Common/UI/Button/Button.js +4 -4
  8. package/dist/components/Common/UI/Button/Button.js.map +1 -1
  9. package/dist/components/Common/UI/Button/ButtonTypes.d.ts +1 -1
  10. package/dist/components/Company/AssignSignatory/AssignSignatory.d.ts +0 -5
  11. package/dist/components/Company/AssignSignatory/AssignSignatory.js +39 -42
  12. package/dist/components/Company/AssignSignatory/AssignSignatory.js.map +1 -1
  13. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.d.ts +0 -4
  14. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js +51 -53
  15. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js.map +1 -1
  16. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.d.ts +0 -4
  17. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js +40 -42
  18. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js.map +1 -1
  19. package/dist/components/Company/AssignSignatory/index.d.ts +0 -1
  20. package/dist/components/Company/BankAccount/BankAccount.d.ts +0 -5
  21. package/dist/components/Company/BankAccount/BankAccount.js +17 -23
  22. package/dist/components/Company/BankAccount/BankAccount.js.map +1 -1
  23. package/dist/components/Company/BankAccount/BankAccountForm/BankAccountForm.d.ts +0 -5
  24. package/dist/components/Company/BankAccount/BankAccountForm/BankAccountForm.js +28 -31
  25. package/dist/components/Company/BankAccount/BankAccountForm/BankAccountForm.js.map +1 -1
  26. package/dist/components/Company/BankAccount/BankAccountList/BankAccountList.d.ts +0 -5
  27. package/dist/components/Company/BankAccount/BankAccountList/BankAccountList.js +25 -28
  28. package/dist/components/Company/BankAccount/BankAccountList/BankAccountList.js.map +1 -1
  29. package/dist/components/Company/BankAccount/BankAccountVerify/BankAccountVerify.d.ts +0 -5
  30. package/dist/components/Company/BankAccount/BankAccountVerify/BankAccountVerify.js +33 -36
  31. package/dist/components/Company/BankAccount/BankAccountVerify/BankAccountVerify.js.map +1 -1
  32. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.d.ts +0 -6
  33. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js +37 -41
  34. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  35. package/dist/components/Company/DocumentSigner/DocumentSigner.d.ts +0 -4
  36. package/dist/components/Company/DocumentSigner/DocumentSigner.js +23 -26
  37. package/dist/components/Company/DocumentSigner/DocumentSigner.js.map +1 -1
  38. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.d.ts +0 -6
  39. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js +40 -44
  40. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
  41. package/dist/components/Company/Industry/Industry.d.ts +0 -5
  42. package/dist/components/Company/Industry/Industry.js +23 -29
  43. package/dist/components/Company/Industry/Industry.js.map +1 -1
  44. package/dist/components/Company/Locations/LocationForm/LocationForm.d.ts +0 -5
  45. package/dist/components/Company/Locations/LocationForm/LocationForm.js +41 -44
  46. package/dist/components/Company/Locations/LocationForm/LocationForm.js.map +1 -1
  47. package/dist/components/Company/Locations/Locations.d.ts +0 -4
  48. package/dist/components/Company/Locations/Locations.js +14 -18
  49. package/dist/components/Company/Locations/Locations.js.map +1 -1
  50. package/dist/components/Company/Locations/LocationsList/LocationsList.d.ts +0 -5
  51. package/dist/components/Company/Locations/LocationsList/LocationsList.js +28 -31
  52. package/dist/components/Company/Locations/LocationsList/LocationsList.js.map +1 -1
  53. package/dist/components/Company/PaySchedule/PaySchedule.d.ts +1 -7
  54. package/dist/components/Company/PaySchedule/PaySchedule.js +67 -71
  55. package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
  56. package/dist/components/Company/StateTaxes/StateTaxes.d.ts +0 -4
  57. package/dist/components/Company/StateTaxes/StateTaxes.js +39 -22
  58. package/dist/components/Company/StateTaxes/StateTaxes.js.map +1 -1
  59. package/dist/components/Company/StateTaxes/StateTaxesComponents.d.ts +8 -6
  60. package/dist/components/Company/StateTaxes/StateTaxesComponents.js +16 -15
  61. package/dist/components/Company/StateTaxes/StateTaxesComponents.js.map +1 -1
  62. package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.d.ts +0 -5
  63. package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js +44 -47
  64. package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js.map +1 -1
  65. package/dist/components/Company/StateTaxes/StateTaxesList/StateTaxesList.d.ts +0 -5
  66. package/dist/components/Company/StateTaxes/StateTaxesList/StateTaxesList.js +26 -29
  67. package/dist/components/Company/StateTaxes/StateTaxesList/StateTaxesList.js.map +1 -1
  68. package/dist/components/Company/StateTaxes/stateTaxesReducer.d.ts +20 -0
  69. package/dist/components/Company/StateTaxes/stateTaxesReducer.js +40 -0
  70. package/dist/components/Company/StateTaxes/stateTaxesReducer.js.map +1 -0
  71. package/dist/components/Contractor/Address/Address.d.ts +0 -5
  72. package/dist/components/Contractor/Address/Address.js +35 -38
  73. package/dist/components/Contractor/Address/Address.js.map +1 -1
  74. package/dist/components/Contractor/Profile/ContractorProfile.d.ts +11 -0
  75. package/dist/components/Contractor/Profile/ContractorProfile.js +24 -0
  76. package/dist/components/Contractor/Profile/ContractorProfile.js.map +1 -0
  77. package/dist/components/Contractor/Profile/ContractorProfileForm.d.ts +5 -0
  78. package/dist/components/Contractor/Profile/ContractorProfileForm.js +140 -0
  79. package/dist/components/Contractor/Profile/ContractorProfileForm.js.map +1 -0
  80. package/dist/components/Contractor/Profile/index.d.ts +3 -0
  81. package/dist/components/Contractor/Profile/useContractorProfile.d.ts +254 -0
  82. package/dist/components/Contractor/Profile/useContractorProfile.js +223 -0
  83. package/dist/components/Contractor/Profile/useContractorProfile.js.map +1 -0
  84. package/dist/components/Contractor/Submit/ContractorSubmitWithApi.d.ts +6 -0
  85. package/dist/components/Contractor/Submit/ContractorSubmitWithApi.js +27 -0
  86. package/dist/components/Contractor/Submit/ContractorSubmitWithApi.js.map +1 -0
  87. package/dist/components/Contractor/Submit/SubmitDone.d.ts +5 -0
  88. package/dist/components/Contractor/Submit/SubmitDone.js +18 -0
  89. package/dist/components/Contractor/Submit/SubmitDone.js.map +1 -0
  90. package/dist/components/Contractor/Submit/index.d.ts +6 -0
  91. package/dist/components/Contractor/Submit/index.js +18 -0
  92. package/dist/components/Contractor/Submit/index.js.map +1 -0
  93. package/dist/components/Contractor/Submit/index.module.scss.js +8 -0
  94. package/dist/components/Contractor/Submit/index.module.scss.js.map +1 -0
  95. package/dist/components/Contractor/index.d.ts +2 -0
  96. package/dist/components/Contractor/index.js +10 -6
  97. package/dist/components/Contractor/index.js.map +1 -1
  98. package/dist/components/Employee/Compensation/Compensation.d.ts +0 -6
  99. package/dist/components/Employee/Compensation/Compensation.js +97 -102
  100. package/dist/components/Employee/Compensation/Compensation.js.map +1 -1
  101. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.d.ts +0 -5
  102. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js +25 -28
  103. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  104. package/dist/components/Employee/DocumentSigner/DocumentSigner.d.ts +1 -7
  105. package/dist/components/Employee/DocumentSigner/DocumentSigner.js +16 -20
  106. package/dist/components/Employee/DocumentSigner/DocumentSigner.js.map +1 -1
  107. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.d.ts +0 -7
  108. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js +40 -44
  109. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
  110. package/dist/components/Employee/EmployeeList/EmployeeList.d.ts +0 -5
  111. package/dist/components/Employee/EmployeeList/EmployeeList.js +56 -59
  112. package/dist/components/Employee/EmployeeList/EmployeeList.js.map +1 -1
  113. package/dist/components/Employee/Profile/AdminPersonalDetails.d.ts +3 -3
  114. package/dist/components/Employee/Profile/PersonalDetailsInputs.d.ts +2 -2
  115. package/dist/components/Employee/Profile/Profile.d.ts +0 -8
  116. package/dist/components/Employee/Profile/Profile.js +131 -138
  117. package/dist/components/Employee/Profile/Profile.js.map +1 -1
  118. package/dist/components/Employee/Taxes/Taxes.d.ts +0 -6
  119. package/dist/components/Employee/Taxes/Taxes.js +76 -81
  120. package/dist/components/Employee/Taxes/Taxes.js.map +1 -1
  121. package/dist/i18n/I18n.js +1 -1
  122. package/dist/i18n/I18n.js.map +1 -1
  123. package/dist/i18n/en/Contractor.ContractorSubmit.json.js +22 -0
  124. package/dist/i18n/en/Contractor.ContractorSubmit.json.js.map +1 -0
  125. package/dist/i18n/en/Contractor.Profile.json.js +73 -0
  126. package/dist/i18n/en/Contractor.Profile.json.js.map +1 -0
  127. package/dist/shared/constants.d.ts +14 -0
  128. package/dist/shared/constants.js +33 -26
  129. package/dist/shared/constants.js.map +1 -1
  130. package/dist/style.css +1 -1
  131. package/dist/types/i18next.d.ts +77 -1
  132. package/package.json +2 -2
  133. package/dist/components/Company/StateTaxes/stateTaxesStateMachine.d.ts +0 -5
  134. package/dist/components/Company/StateTaxes/stateTaxesStateMachine.js +0 -48
  135. package/dist/components/Company/StateTaxes/stateTaxesStateMachine.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"PaySchedule.js","sources":["../../../../src/components/Company/PaySchedule/PaySchedule.tsx"],"sourcesContent":["import type { SubmitHandler } from 'react-hook-form'\nimport { FormProvider, useForm } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { useEffect, useState } from 'react'\nimport { usePaySchedulesGetPreview } from '@gusto/embedded-api/react-query/paySchedulesGetPreview'\nimport { usePaySchedulesUpdateMutation } from '@gusto/embedded-api/react-query/paySchedulesUpdate'\nimport { usePaySchedulesGetAllSuspense } from '@gusto/embedded-api/react-query/paySchedulesGetAll'\nimport { usePaySchedulesCreateMutation } from '@gusto/embedded-api/react-query/paySchedulesCreate'\nimport type { PayScheduleObject as PayScheduleType } from '@gusto/embedded-api/models/components/payscheduleobject'\nimport type { Frequency } from '@gusto/embedded-api/models/operations/postv1companiescompanyidpayschedules'\nimport type { MODE, PayScheduleInputs, PayScheduleOutputs } from './usePaySchedule'\nimport {\n PayScheduleProvider,\n PayScheduleSchema,\n type PayScheduleDefaultValues,\n} from './usePaySchedule'\nimport { Actions, Edit, Head, List } from './_parts'\nimport { Form } from '@/components/Common/Form'\nimport type { BaseComponentInterface, CommonComponentInterface } from '@/components/Base'\nimport { BaseComponent, useBase } from '@/components/Base'\nimport { Flex } from '@/components/Common'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { formatDateToStringDate } from '@/helpers/dateFormatting'\nimport { useComponentDictionary } from '@/i18n/I18n'\n\ninterface PayScheduleProps extends CommonComponentInterface<'Company.PaySchedule'> {\n companyId: string\n defaultValues?: PayScheduleDefaultValues\n}\n\nexport const PaySchedule = ({\n companyId,\n defaultValues,\n dictionary,\n ...props\n}: PayScheduleProps & BaseComponentInterface) => {\n useI18n('Company.PaySchedule')\n useComponentDictionary('Company.PaySchedule', dictionary)\n return (\n <BaseComponent {...props}>\n <Root companyId={companyId} defaultValues={defaultValues}>\n {props.children}\n </Root>\n </BaseComponent>\n )\n}\n\nconst Root = ({ companyId, children, defaultValues }: PayScheduleProps) => {\n const { baseSubmitHandler, onEvent, fieldErrors, setError: setBaseError } = useBase()\n const [mode, setMode] = useState<MODE>('LIST_PAY_SCHEDULES')\n const [currentPaySchedule, setCurrentPaySchedule] = useState<PayScheduleType | null>(null)\n const transformedDefaultValues: PayScheduleInputs = {\n frequency: defaultValues?.frequency ?? 'Every week',\n anchorPayDate: defaultValues?.anchorPayDate ? new Date(defaultValues.anchorPayDate) : undefined,\n anchorEndOfPayPeriod: defaultValues?.anchorEndOfPayPeriod\n ? new Date(defaultValues.anchorEndOfPayPeriod)\n : undefined,\n day1: defaultValues?.day1 ?? undefined,\n day2: defaultValues?.day2 ?? undefined,\n customName: defaultValues?.customName ?? '',\n customTwicePerMonth: 'false',\n payPeriodPreviewRange: 0,\n }\n\n const { data: paySchedules } = usePaySchedulesGetAllSuspense({\n companyId,\n })\n\n const createPayScheduleMutation = usePaySchedulesCreateMutation()\n const updatePayScheduleMutation = usePaySchedulesUpdateMutation()\n\n const formMethods = useForm<PayScheduleInputs, unknown, PayScheduleOutputs>({\n resolver: zodResolver(PayScheduleSchema),\n defaultValues: transformedDefaultValues,\n })\n const { watch, setValue, reset, clearErrors, setError } = formMethods\n\n useEffect(() => {\n if (fieldErrors) {\n // TODO: These error messages are not being localized correctly\n fieldErrors.forEach(error => {\n setError(error.key as keyof PayScheduleInputs, { message: error.message })\n })\n }\n }, [setError, fieldErrors])\n\n const allValues = watch()\n\n const formattedAnchorPayDate = allValues.anchorPayDate\n ? formatDateToStringDate(allValues.anchorPayDate) || ''\n : ''\n const formattedAnchorEndOfPayPeriod = allValues.anchorEndOfPayPeriod\n ? formatDateToStringDate(allValues.anchorEndOfPayPeriod) || ''\n : ''\n\n const { data: payPreviewData, isLoading } = usePaySchedulesGetPreview(\n {\n companyId,\n frequency: allValues.frequency,\n anchorPayDate: formattedAnchorPayDate,\n anchorEndOfPayPeriod: formattedAnchorEndOfPayPeriod,\n day1: allValues.day1 ?? undefined,\n day2: allValues.day2 ?? undefined,\n },\n {\n enabled: Boolean(\n allValues.anchorPayDate &&\n allValues.anchorEndOfPayPeriod &&\n (mode === 'ADD_PAY_SCHEDULE' || mode === 'EDIT_PAY_SCHEDULE'),\n ),\n },\n )\n\n // Set the custom_twice_per_month value based on the frequency and day_1 and day_2 values as it is not set by the API call\n useEffect(() => {\n if (\n allValues.frequency === 'Twice per month' &&\n allValues.day1 === 15 &&\n allValues.day2 === 31 &&\n allValues.customTwicePerMonth === undefined\n ) {\n setValue('customTwicePerMonth', `1st15th`)\n } else if (\n allValues.frequency === 'Twice per month' &&\n allValues.customTwicePerMonth === undefined\n ) {\n setValue('customTwicePerMonth', `custom`)\n }\n }, [allValues.frequency, allValues.day1, allValues.day2, setValue, allValues.customTwicePerMonth])\n\n const handleAdd = () => {\n setMode('ADD_PAY_SCHEDULE')\n reset({})\n }\n const handleCancel = () => {\n setMode('LIST_PAY_SCHEDULES')\n reset({})\n clearErrors()\n setBaseError(null)\n }\n const handleEdit = (schedule: PayScheduleType) => {\n reset({\n frequency: schedule.frequency as Frequency,\n anchorPayDate: schedule.anchorPayDate ? new Date(schedule.anchorPayDate) : undefined,\n anchorEndOfPayPeriod: schedule.anchorEndOfPayPeriod\n ? new Date(schedule.anchorEndOfPayPeriod)\n : undefined,\n day1: schedule.day1 ?? undefined,\n day2: schedule.day2 ?? undefined,\n customName: schedule.customName ?? '',\n })\n setCurrentPaySchedule(schedule)\n setMode('EDIT_PAY_SCHEDULE')\n }\n const handleContinue = () => {\n onEvent(componentEvents.PAY_SCHEDULE_DONE)\n }\n const onSubmit: SubmitHandler<PayScheduleOutputs> = async data => {\n await baseSubmitHandler(data, async payload => {\n const formatPayloadDate = (date: Date | undefined): string => {\n return date ? formatDateToStringDate(date) || '' : ''\n }\n\n if (mode === 'ADD_PAY_SCHEDULE') {\n const createPayScheduleResponse = await createPayScheduleMutation.mutateAsync({\n request: {\n companyId,\n requestBody: {\n frequency: payload.frequency,\n anchorPayDate: formatPayloadDate(payload.anchorPayDate),\n anchorEndOfPayPeriod: formatPayloadDate(payload.anchorEndOfPayPeriod),\n customName: payload.customName,\n day1: payload.day1,\n day2: payload.day2,\n },\n },\n })\n onEvent(componentEvents.PAY_SCHEDULE_CREATED, createPayScheduleResponse)\n reset()\n } else if (mode === 'EDIT_PAY_SCHEDULE') {\n const version = currentPaySchedule?.version\n const updatePayScheduleResponse = await updatePayScheduleMutation.mutateAsync({\n request: {\n payScheduleId: currentPaySchedule?.uuid as string,\n companyId,\n requestBody: {\n frequency: payload.frequency,\n anchorPayDate: formatPayloadDate(payload.anchorPayDate),\n anchorEndOfPayPeriod: formatPayloadDate(payload.anchorEndOfPayPeriod),\n customName: payload.customName,\n day1: payload.day1,\n day2: payload.day2,\n version: version as string,\n },\n },\n })\n onEvent(componentEvents.PAY_SCHEDULE_UPDATED, updatePayScheduleResponse)\n reset()\n }\n setMode('LIST_PAY_SCHEDULES')\n })\n }\n\n return (\n <PayScheduleProvider\n value={{\n companyId,\n handleAdd,\n handleEdit,\n handleCancel,\n handleContinue,\n mode,\n paySchedules: paySchedules.payScheduleList,\n payPeriodPreview: payPreviewData?.object?.payPeriods,\n payPreviewLoading: isLoading,\n currentPaySchedule,\n }}\n >\n <span data-testid=\"pay-schedule-edit-form\">\n <FormProvider {...formMethods}>\n <Form onSubmit={formMethods.handleSubmit(onSubmit)}>\n {children ? (\n children\n ) : (\n <Flex flexDirection=\"column\">\n <Head />\n <List />\n <Edit />\n <Actions />\n </Flex>\n )}\n </Form>\n </FormProvider>\n </span>\n </PayScheduleProvider>\n )\n}\n\nPaySchedule.Head = Head\nPaySchedule.List = List\nPaySchedule.Edit = Edit\nPaySchedule.Actions = Actions\n"],"names":["PaySchedule","companyId","defaultValues","dictionary","props","useI18n","useComponentDictionary","jsx","BaseComponent","Root","children","baseSubmitHandler","onEvent","fieldErrors","setBaseError","useBase","mode","setMode","useState","currentPaySchedule","setCurrentPaySchedule","transformedDefaultValues","paySchedules","usePaySchedulesGetAllSuspense","createPayScheduleMutation","usePaySchedulesCreateMutation","updatePayScheduleMutation","usePaySchedulesUpdateMutation","formMethods","useForm","zodResolver","PayScheduleSchema","watch","setValue","reset","clearErrors","setError","useEffect","error","allValues","formattedAnchorPayDate","formatDateToStringDate","formattedAnchorEndOfPayPeriod","payPreviewData","isLoading","usePaySchedulesGetPreview","handleAdd","handleCancel","handleEdit","schedule","handleContinue","componentEvents","onSubmit","data","payload","formatPayloadDate","date","createPayScheduleResponse","version","updatePayScheduleResponse","PayScheduleProvider","FormProvider","Form","jsxs","Flex","Head","List","Edit","Actions"],"mappings":";;;;;;;;;;;;;;;;;;;;AA+BO,MAAMA,IAAc,CAAC;AAAA,EAC1B,WAAAC;AAAA,EACA,eAAAC;AAAA,EACA,YAAAC;AAAA,EACA,GAAGC;AACL,OACEC,GAAQ,qBAAqB,GAC7BC,GAAuB,uBAAuBH,CAAU,GAEtD,gBAAAI,EAACC,IAAe,EAAA,GAAGJ,GACjB,UAAA,gBAAAG,EAACE,MAAK,WAAAR,GAAsB,eAAAC,GACzB,UAAME,EAAA,SAAA,CACT,EACF,CAAA,IAIEK,KAAO,CAAC,EAAE,WAAAR,GAAW,UAAAS,GAAU,eAAAR,QAAsC;AACzE,QAAM,EAAE,mBAAAS,GAAmB,SAAAC,GAAS,aAAAC,GAAa,UAAUC,MAAiBC,GAAQ,GAC9E,CAACC,GAAMC,CAAO,IAAIC,EAAe,oBAAoB,GACrD,CAACC,GAAoBC,CAAqB,IAAIF,EAAiC,IAAI,GACnFG,IAA8C;AAAA,IAClD,WAAWnB,GAAe,aAAa;AAAA,IACvC,eAAeA,GAAe,gBAAgB,IAAI,KAAKA,EAAc,aAAa,IAAI;AAAA,IACtF,sBAAsBA,GAAe,uBACjC,IAAI,KAAKA,EAAc,oBAAoB,IAC3C;AAAA,IACJ,MAAMA,GAAe,QAAQ;AAAA,IAC7B,MAAMA,GAAe,QAAQ;AAAA,IAC7B,YAAYA,GAAe,cAAc;AAAA,IACzC,qBAAqB;AAAA,IACrB,uBAAuB;AAAA,EACzB,GAEM,EAAE,MAAMoB,EAAa,IAAIC,EAA8B;AAAA,IAC3D,WAAAtB;AAAA,EAA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AAAA,EACF;AAEJ;AAEApE,EAAY,OAAOiE;AACnBjE,EAAY,OAAOkE;AACnBlE,EAAY,OAAOmE;AACnBnE,EAAY,UAAUoE;"}
1
+ {"version":3,"file":"PaySchedule.js","sources":["../../../../src/components/Company/PaySchedule/PaySchedule.tsx"],"sourcesContent":["import type { SubmitHandler } from 'react-hook-form'\nimport { FormProvider, useForm } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { useEffect, useState } from 'react'\nimport { usePaySchedulesGetPreview } from '@gusto/embedded-api/react-query/paySchedulesGetPreview'\nimport { usePaySchedulesUpdateMutation } from '@gusto/embedded-api/react-query/paySchedulesUpdate'\nimport { usePaySchedulesGetAllSuspense } from '@gusto/embedded-api/react-query/paySchedulesGetAll'\nimport { usePaySchedulesCreateMutation } from '@gusto/embedded-api/react-query/paySchedulesCreate'\nimport type { PayScheduleObject as PayScheduleType } from '@gusto/embedded-api/models/components/payscheduleobject'\nimport type { Frequency } from '@gusto/embedded-api/models/operations/postv1companiescompanyidpayschedules'\nimport type { MODE, PayScheduleInputs, PayScheduleOutputs } from './usePaySchedule'\nimport {\n PayScheduleProvider,\n PayScheduleSchema,\n type PayScheduleDefaultValues,\n} from './usePaySchedule'\nimport { Actions, Edit, Head, List } from './_parts'\nimport { Form } from '@/components/Common/Form'\nimport type { BaseComponentInterface, CommonComponentInterface } from '@/components/Base'\nimport { BaseComponent, useBase } from '@/components/Base'\nimport { Flex } from '@/components/Common'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { formatDateToStringDate } from '@/helpers/dateFormatting'\nimport { useComponentDictionary } from '@/i18n/I18n'\n\ninterface PayScheduleProps extends CommonComponentInterface<'Company.PaySchedule'> {\n companyId: string\n defaultValues?: PayScheduleDefaultValues\n}\n\nexport const PaySchedule = ({\n companyId,\n defaultValues,\n dictionary,\n ...props\n}: PayScheduleProps & BaseComponentInterface) => {\n useI18n('Company.PaySchedule')\n useComponentDictionary('Company.PaySchedule', dictionary)\n return (\n <BaseComponent {...props}>\n <Root companyId={companyId} defaultValues={defaultValues}>\n {props.children}\n </Root>\n </BaseComponent>\n )\n}\n\nconst Root = ({ companyId, children, defaultValues }: PayScheduleProps) => {\n const { baseSubmitHandler, onEvent, fieldErrors, setError: setBaseError } = useBase()\n const [mode, setMode] = useState<MODE>('LIST_PAY_SCHEDULES')\n const [currentPaySchedule, setCurrentPaySchedule] = useState<PayScheduleType | null>(null)\n const transformedDefaultValues: PayScheduleInputs = {\n frequency: defaultValues?.frequency ?? 'Every week',\n anchorPayDate: defaultValues?.anchorPayDate ? new Date(defaultValues.anchorPayDate) : undefined,\n anchorEndOfPayPeriod: defaultValues?.anchorEndOfPayPeriod\n ? new Date(defaultValues.anchorEndOfPayPeriod)\n : undefined,\n day1: defaultValues?.day1 ?? undefined,\n day2: defaultValues?.day2 ?? undefined,\n customName: defaultValues?.customName ?? '',\n customTwicePerMonth: 'false',\n payPeriodPreviewRange: 0,\n }\n\n const { data: paySchedules } = usePaySchedulesGetAllSuspense({\n companyId,\n })\n\n const createPayScheduleMutation = usePaySchedulesCreateMutation()\n const updatePayScheduleMutation = usePaySchedulesUpdateMutation()\n\n const formMethods = useForm<PayScheduleInputs, unknown, PayScheduleOutputs>({\n resolver: zodResolver(PayScheduleSchema),\n defaultValues: transformedDefaultValues,\n })\n const { watch, setValue, reset, clearErrors, setError } = formMethods\n\n useEffect(() => {\n if (fieldErrors) {\n // TODO: These error messages are not being localized correctly\n fieldErrors.forEach(error => {\n setError(error.key as keyof PayScheduleInputs, { message: error.message })\n })\n }\n }, [setError, fieldErrors])\n\n const allValues = watch()\n\n const formattedAnchorPayDate = allValues.anchorPayDate\n ? formatDateToStringDate(allValues.anchorPayDate) || ''\n : ''\n const formattedAnchorEndOfPayPeriod = allValues.anchorEndOfPayPeriod\n ? formatDateToStringDate(allValues.anchorEndOfPayPeriod) || ''\n : ''\n\n const { data: payPreviewData, isLoading } = usePaySchedulesGetPreview(\n {\n companyId,\n frequency: allValues.frequency,\n anchorPayDate: formattedAnchorPayDate,\n anchorEndOfPayPeriod: formattedAnchorEndOfPayPeriod,\n day1: allValues.day1 ?? undefined,\n day2: allValues.day2 ?? undefined,\n },\n {\n enabled: Boolean(\n allValues.anchorPayDate &&\n allValues.anchorEndOfPayPeriod &&\n (mode === 'ADD_PAY_SCHEDULE' || mode === 'EDIT_PAY_SCHEDULE'),\n ),\n },\n )\n\n // Set the custom_twice_per_month value based on the frequency and day_1 and day_2 values as it is not set by the API call\n useEffect(() => {\n if (\n allValues.frequency === 'Twice per month' &&\n allValues.day1 === 15 &&\n allValues.day2 === 31 &&\n allValues.customTwicePerMonth === undefined\n ) {\n setValue('customTwicePerMonth', `1st15th`)\n } else if (\n allValues.frequency === 'Twice per month' &&\n allValues.customTwicePerMonth === undefined\n ) {\n setValue('customTwicePerMonth', `custom`)\n }\n }, [allValues.frequency, allValues.day1, allValues.day2, setValue, allValues.customTwicePerMonth])\n\n const handleAdd = () => {\n setMode('ADD_PAY_SCHEDULE')\n reset({})\n }\n const handleCancel = () => {\n setMode('LIST_PAY_SCHEDULES')\n reset({})\n clearErrors()\n setBaseError(null)\n }\n const handleEdit = (schedule: PayScheduleType) => {\n reset({\n frequency: schedule.frequency as Frequency,\n anchorPayDate: schedule.anchorPayDate ? new Date(schedule.anchorPayDate) : undefined,\n anchorEndOfPayPeriod: schedule.anchorEndOfPayPeriod\n ? new Date(schedule.anchorEndOfPayPeriod)\n : undefined,\n day1: schedule.day1 ?? undefined,\n day2: schedule.day2 ?? undefined,\n customName: schedule.customName ?? '',\n })\n setCurrentPaySchedule(schedule)\n setMode('EDIT_PAY_SCHEDULE')\n }\n const handleContinue = () => {\n onEvent(componentEvents.PAY_SCHEDULE_DONE)\n }\n const onSubmit: SubmitHandler<PayScheduleOutputs> = async data => {\n await baseSubmitHandler(data, async payload => {\n const formatPayloadDate = (date: Date | undefined): string => {\n return date ? formatDateToStringDate(date) || '' : ''\n }\n\n if (mode === 'ADD_PAY_SCHEDULE') {\n const createPayScheduleResponse = await createPayScheduleMutation.mutateAsync({\n request: {\n companyId,\n requestBody: {\n frequency: payload.frequency,\n anchorPayDate: formatPayloadDate(payload.anchorPayDate),\n anchorEndOfPayPeriod: formatPayloadDate(payload.anchorEndOfPayPeriod),\n customName: payload.customName,\n day1: payload.day1,\n day2: payload.day2,\n },\n },\n })\n onEvent(componentEvents.PAY_SCHEDULE_CREATED, createPayScheduleResponse)\n reset()\n } else if (mode === 'EDIT_PAY_SCHEDULE') {\n const version = currentPaySchedule?.version\n const updatePayScheduleResponse = await updatePayScheduleMutation.mutateAsync({\n request: {\n payScheduleId: currentPaySchedule?.uuid as string,\n companyId,\n requestBody: {\n frequency: payload.frequency,\n anchorPayDate: formatPayloadDate(payload.anchorPayDate),\n anchorEndOfPayPeriod: formatPayloadDate(payload.anchorEndOfPayPeriod),\n customName: payload.customName,\n day1: payload.day1,\n day2: payload.day2,\n version: version as string,\n },\n },\n })\n onEvent(componentEvents.PAY_SCHEDULE_UPDATED, updatePayScheduleResponse)\n reset()\n }\n setMode('LIST_PAY_SCHEDULES')\n })\n }\n\n return (\n <PayScheduleProvider\n value={{\n companyId,\n handleAdd,\n handleEdit,\n handleCancel,\n handleContinue,\n mode,\n paySchedules: paySchedules.payScheduleList,\n payPeriodPreview: payPreviewData?.object?.payPeriods,\n payPreviewLoading: isLoading,\n currentPaySchedule,\n }}\n >\n <span data-testid=\"pay-schedule-edit-form\">\n <FormProvider {...formMethods}>\n <Form onSubmit={formMethods.handleSubmit(onSubmit)}>\n {children ? (\n children\n ) : (\n <Flex flexDirection=\"column\">\n <Head />\n <List />\n <Edit />\n <Actions />\n </Flex>\n )}\n </Form>\n </FormProvider>\n </span>\n </PayScheduleProvider>\n )\n}\n"],"names":["PaySchedule","companyId","defaultValues","dictionary","props","useI18n","useComponentDictionary","jsx","BaseComponent","Root","children","baseSubmitHandler","onEvent","fieldErrors","setBaseError","useBase","mode","setMode","useState","currentPaySchedule","setCurrentPaySchedule","transformedDefaultValues","paySchedules","usePaySchedulesGetAllSuspense","createPayScheduleMutation","usePaySchedulesCreateMutation","updatePayScheduleMutation","usePaySchedulesUpdateMutation","formMethods","useForm","zodResolver","PayScheduleSchema","watch","setValue","reset","clearErrors","setError","useEffect","error","allValues","formattedAnchorPayDate","formatDateToStringDate","formattedAnchorEndOfPayPeriod","payPreviewData","isLoading","usePaySchedulesGetPreview","handleAdd","handleCancel","handleEdit","schedule","handleContinue","componentEvents","onSubmit","data","payload","formatPayloadDate","date","createPayScheduleResponse","version","updatePayScheduleResponse","PayScheduleProvider","FormProvider","Form","jsxs","Flex","Head","List","Edit","Actions"],"mappings":";;;;;;;;;;;;;;;;;;;;AA+BO,MAAMA,KAAc,CAAC;AAAA,EAC1B,WAAAC;AAAA,EACA,eAAAC;AAAA,EACA,YAAAC;AAAA,EACA,GAAGC;AACL,OACEC,GAAQ,qBAAqB,GAC7BC,GAAuB,uBAAuBH,CAAU,GAEtD,gBAAAI,EAACC,GAAe,EAAA,GAAGJ,GACjB,UAAA,gBAAAG,EAACE,MAAK,WAAAR,GAAsB,eAAAC,GACzB,UAAME,EAAA,SAAA,CACT,EACF,CAAA,IAIEK,KAAO,CAAC,EAAE,WAAAR,GAAW,UAAAS,GAAU,eAAAR,QAAsC;AACzE,QAAM,EAAE,mBAAAS,GAAmB,SAAAC,GAAS,aAAAC,GAAa,UAAUC,MAAiBC,EAAQ,GAC9E,CAACC,GAAMC,CAAO,IAAIC,EAAe,oBAAoB,GACrD,CAACC,GAAoBC,CAAqB,IAAIF,EAAiC,IAAI,GACnFG,IAA8C;AAAA,IAClD,WAAWnB,GAAe,aAAa;AAAA,IACvC,eAAeA,GAAe,gBAAgB,IAAI,KAAKA,EAAc,aAAa,IAAI;AAAA,IACtF,sBAAsBA,GAAe,uBACjC,IAAI,KAAKA,EAAc,oBAAoB,IAC3C;AAAA,IACJ,MAAMA,GAAe,QAAQ;AAAA,IAC7B,MAAMA,GAAe,QAAQ;AAAA,IAC7B,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AA;AAAA,0BACLC,IAAK,EAAA;AAAA,0BACLC,IAAK,EAAA;AAAA,0BACLC,IAAQ,CAAA,CAAA;AAAA,MAAA,GACX,EAAA,CAEJ,GACF,EACF,CAAA;AAAA,IAAA;AAAA,EACF;AAEJ;"}
@@ -3,7 +3,3 @@ export interface StateTaxesProps extends BaseComponentInterface<'Company.StateTa
3
3
  companyId: string;
4
4
  }
5
5
  export declare function StateTaxes({ companyId, onEvent, dictionary }: StateTaxesProps): import("react/jsx-runtime").JSX.Element;
6
- export declare namespace StateTaxes {
7
- var StateTaxesList: typeof import("./StateTaxesList/StateTaxesList").StateTaxesList;
8
- var StateTaxesForm: typeof import("./StateTaxesForm/StateTaxesForm").StateTaxesForm;
9
- }
@@ -1,27 +1,44 @@
1
1
  import { jsx as i } from "react/jsx-runtime";
2
- import { createMachine as s } from "robot3";
3
- import { stateTaxesStateMachine as n } from "./stateTaxesStateMachine.js";
4
- import { StateTaxesListContextual as x } from "./StateTaxesComponents.js";
5
- import { StateTaxesList as p } from "./StateTaxesList/StateTaxesList.js";
6
- import { StateTaxesForm as S } from "./StateTaxesForm/StateTaxesForm.js";
7
- import { Flow as T } from "../../Flow/Flow.js";
8
- import { useComponentDictionary as f } from "../../../i18n/I18n.js";
9
- function t({ companyId: e, onEvent: a, dictionary: o }) {
10
- f("Company.StateTaxes", o);
11
- const m = s(
12
- "viewStateTaxes",
13
- n,
14
- (r) => ({
15
- ...r,
16
- component: x,
17
- companyId: e
18
- })
19
- );
20
- return /* @__PURE__ */ i(T, { machine: m, onEvent: a });
2
+ import { useReducer as x } from "react";
3
+ import { stateTaxesReducer as T, initialState as p } from "./stateTaxesReducer.js";
4
+ import { StateTaxesListContextual as u, StateTaxesFormContextual as A } from "./StateTaxesComponents.js";
5
+ import { useComponentDictionary as E } from "../../../i18n/I18n.js";
6
+ import { componentEvents as e } from "../../../shared/constants.js";
7
+ function b({ companyId: m, onEvent: s, dictionary: n }) {
8
+ E("Company.StateTaxes", n);
9
+ const [r, a] = x(T, p), c = {
10
+ companyId: m,
11
+ stateData: r,
12
+ onEvent: (t, o) => {
13
+ switch (t) {
14
+ case e.COMPANY_STATE_TAX_EDIT:
15
+ a({ type: t, payload: o });
16
+ break;
17
+ case e.COMPANY_STATE_TAX_UPDATED:
18
+ a({ type: t });
19
+ break;
20
+ case e.COMPANY_STATE_TAX_DONE:
21
+ a({ type: t });
22
+ break;
23
+ case e.CANCEL:
24
+ a({ type: t });
25
+ break;
26
+ default:
27
+ s(t, o);
28
+ break;
29
+ }
30
+ s(t, o);
31
+ }
32
+ };
33
+ switch (r.state) {
34
+ case "editStateTaxes":
35
+ return /* @__PURE__ */ i(A, { ...c });
36
+ case "viewStateTaxes":
37
+ default:
38
+ return /* @__PURE__ */ i(u, { ...c });
39
+ }
21
40
  }
22
- t.StateTaxesList = p;
23
- t.StateTaxesForm = S;
24
41
  export {
25
- t as StateTaxes
42
+ b as StateTaxes
26
43
  };
27
44
  //# sourceMappingURL=StateTaxes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"StateTaxes.js","sources":["../../../../src/components/Company/StateTaxes/StateTaxes.tsx"],"sourcesContent":["import { createMachine } from 'robot3'\nimport { stateTaxesStateMachine } from './stateTaxesStateMachine'\nimport type { StateTaxesContextInterface } from './StateTaxesComponents'\nimport { StateTaxesListContextual } from './StateTaxesComponents'\nimport { StateTaxesList } from './StateTaxesList/StateTaxesList'\nimport { StateTaxesForm } from './StateTaxesForm/StateTaxesForm'\nimport { Flow } from '@/components/Flow/Flow'\nimport type { BaseComponentInterface } from '@/components/Base'\nimport { useComponentDictionary } from '@/i18n/I18n'\n\nexport interface StateTaxesProps extends BaseComponentInterface<'Company.StateTaxes'> {\n companyId: string\n}\n\nexport function StateTaxes({ companyId, onEvent, dictionary }: StateTaxesProps) {\n useComponentDictionary('Company.StateTaxes', dictionary)\n const manageStateTaxes = createMachine(\n 'viewStateTaxes',\n stateTaxesStateMachine,\n (initialContext: StateTaxesContextInterface) => ({\n ...initialContext,\n component: StateTaxesListContextual,\n companyId,\n }),\n )\n return <Flow machine={manageStateTaxes} onEvent={onEvent} />\n}\n\nStateTaxes.StateTaxesList = StateTaxesList\nStateTaxes.StateTaxesForm = StateTaxesForm\n"],"names":["StateTaxes","companyId","onEvent","dictionary","useComponentDictionary","manageStateTaxes","createMachine","stateTaxesStateMachine","initialContext","StateTaxesListContextual","jsx","Flow","StateTaxesList","StateTaxesForm"],"mappings":";;;;;;;;AAcO,SAASA,EAAW,EAAE,WAAAC,GAAW,SAAAC,GAAS,YAAAC,KAA+B;AAC9E,EAAAC,EAAuB,sBAAsBD,CAAU;AACvD,QAAME,IAAmBC;AAAA,IACvB;AAAA,IACAC;AAAA,IACA,CAACC,OAAgD;AAAA,MAC/C,GAAGA;AAAA,MACH,WAAWC;AAAA,MACX,WAAAR;AAAA,IACF;AAAA,EACF;AACA,SAAQ,gBAAAS,EAAAC,GAAA,EAAK,SAASN,GAAkB,SAAAH,EAAkB,CAAA;AAC5D;AAEAF,EAAW,iBAAiBY;AAC5BZ,EAAW,iBAAiBa;"}
1
+ {"version":3,"file":"StateTaxes.js","sources":["../../../../src/components/Company/StateTaxes/StateTaxes.tsx"],"sourcesContent":["import { useReducer } from 'react'\nimport { stateTaxesReducer, initialState } from './stateTaxesReducer'\nimport type { StateTaxesContextInterface } from './StateTaxesComponents'\nimport { StateTaxesListContextual, StateTaxesFormContextual } from './StateTaxesComponents'\nimport type { BaseComponentInterface } from '@/components/Base'\nimport { useComponentDictionary } from '@/i18n/I18n'\nimport { componentEvents } from '@/shared/constants'\nimport type { OnEventType } from '@/components/Base/useBase'\nimport type { EventType } from '@/shared/constants'\n\nexport interface StateTaxesProps extends BaseComponentInterface<'Company.StateTaxes'> {\n companyId: string\n}\n\nexport function StateTaxes({ companyId, onEvent, dictionary }: StateTaxesProps) {\n useComponentDictionary('Company.StateTaxes', dictionary)\n\n const [stateData, dispatch] = useReducer(stateTaxesReducer, initialState)\n\n const handleEvent: OnEventType<EventType, unknown> = (eventType, data) => {\n // Handle the event and dispatch to reducer\n switch (eventType) {\n case componentEvents.COMPANY_STATE_TAX_EDIT:\n dispatch({ type: eventType, payload: data as { state: string } })\n break\n case componentEvents.COMPANY_STATE_TAX_UPDATED:\n dispatch({ type: eventType })\n break\n case componentEvents.COMPANY_STATE_TAX_DONE:\n dispatch({ type: eventType })\n break\n case componentEvents.CANCEL:\n dispatch({ type: eventType })\n break\n default:\n // Pass through other events to parent\n onEvent(eventType, data)\n break\n }\n\n onEvent(eventType, data)\n }\n\n const contextProps: StateTaxesContextInterface = {\n companyId,\n stateData,\n onEvent: handleEvent,\n }\n\n // Render the appropriate component based on state\n switch (stateData.state) {\n case 'editStateTaxes':\n return <StateTaxesFormContextual {...contextProps} />\n case 'viewStateTaxes':\n default:\n return <StateTaxesListContextual {...contextProps} />\n }\n}\n"],"names":["StateTaxes","companyId","onEvent","dictionary","useComponentDictionary","stateData","dispatch","useReducer","stateTaxesReducer","initialState","contextProps","eventType","data","componentEvents","jsx","StateTaxesFormContextual","StateTaxesListContextual"],"mappings":";;;;;;AAcO,SAASA,EAAW,EAAE,WAAAC,GAAW,SAAAC,GAAS,YAAAC,KAA+B;AAC9E,EAAAC,EAAuB,sBAAsBD,CAAU;AAEvD,QAAM,CAACE,GAAWC,CAAQ,IAAIC,EAAWC,GAAmBC,CAAY,GA0BlEC,IAA2C;AAAA,IAC/C,WAAAT;AAAA,IACA,WAAAI;AAAA,IACA,SA3BmD,CAACM,GAAWC,MAAS;AAExE,cAAQD,GAAW;AAAA,QACjB,KAAKE,EAAgB;AACnB,UAAAP,EAAS,EAAE,MAAMK,GAAW,SAASC,GAA2B;AAChE;AAAA,QACF,KAAKC,EAAgB;AACV,UAAAP,EAAA,EAAE,MAAMK,GAAW;AAC5B;AAAA,QACF,KAAKE,EAAgB;AACV,UAAAP,EAAA,EAAE,MAAMK,GAAW;AAC5B;AAAA,QACF,KAAKE,EAAgB;AACV,UAAAP,EAAA,EAAE,MAAMK,GAAW;AAC5B;AAAA,QACF;AAEE,UAAAT,EAAQS,GAAWC,CAAI;AACvB;AAAA,MAAA;AAGJ,MAAAV,EAAQS,GAAWC,CAAI;AAAA,IACzB;AAAA,EAMA;AAGA,UAAQP,EAAU,OAAO;AAAA,IACvB,KAAK;AACI,aAAA,gBAAAS,EAACC,GAA0B,EAAA,GAAGL,EAAc,CAAA;AAAA,IACrD,KAAK;AAAA,IACL;AACS,aAAA,gBAAAI,EAACE,GAA0B,EAAA,GAAGN,EAAc,CAAA;AAAA,EAAA;AAEzD;"}
@@ -1,8 +1,10 @@
1
- import { FlowContextInterface } from '../../Flow/useFlow';
2
- export interface StateTaxesContextInterface extends FlowContextInterface {
1
+ import { StateTaxesStateData } from './stateTaxesReducer';
2
+ import { OnEventType } from '../../Base/useBase';
3
+ import { EventType } from '../../../shared/constants';
4
+ export interface StateTaxesContextInterface {
3
5
  companyId: string;
4
- state?: string;
5
- component: React.ComponentType | null;
6
+ stateData: StateTaxesStateData;
7
+ onEvent: OnEventType<EventType, unknown>;
6
8
  }
7
- export declare function StateTaxesListContextual(): import("react/jsx-runtime").JSX.Element;
8
- export declare function StateTaxesFormContextual(): import("react/jsx-runtime").JSX.Element;
9
+ export declare function StateTaxesListContextual({ companyId, onEvent }: StateTaxesContextInterface): import("react/jsx-runtime").JSX.Element;
10
+ export declare function StateTaxesFormContextual({ companyId, stateData, onEvent, }: StateTaxesContextInterface): import("react/jsx-runtime").JSX.Element;
@@ -1,25 +1,26 @@
1
- import { jsx as n } from "react/jsx-runtime";
1
+ import { jsx as r } from "react/jsx-runtime";
2
2
  import { StateTaxesList as m } from "./StateTaxesList/StateTaxesList.js";
3
- import { StateTaxesForm as s } from "./StateTaxesForm/StateTaxesForm.js";
4
- import { useFlow as r } from "../../Flow/useFlow.js";
5
- import { ensureRequired as e } from "../../../helpers/ensureRequired.js";
6
- function f() {
7
- const { companyId: t, onEvent: o } = r();
8
- return /* @__PURE__ */ n(m, { onEvent: o, companyId: e(t) });
3
+ import { StateTaxesForm as n } from "./StateTaxesForm/StateTaxesForm.js";
4
+ import { ensureRequired as o } from "../../../helpers/ensureRequired.js";
5
+ function p({ companyId: t, onEvent: e }) {
6
+ return /* @__PURE__ */ r(m, { onEvent: e, companyId: o(t) });
9
7
  }
10
- function d() {
11
- const { companyId: t, state: o, onEvent: a } = r();
12
- return /* @__PURE__ */ n(
13
- s,
8
+ function f({
9
+ companyId: t,
10
+ stateData: e,
11
+ onEvent: a
12
+ }) {
13
+ return /* @__PURE__ */ r(
14
+ n,
14
15
  {
15
- companyId: e(t),
16
- state: e(o),
16
+ companyId: o(t),
17
+ state: o(e.selectedState),
17
18
  onEvent: a
18
19
  }
19
20
  );
20
21
  }
21
22
  export {
22
- d as StateTaxesFormContextual,
23
- f as StateTaxesListContextual
23
+ f as StateTaxesFormContextual,
24
+ p as StateTaxesListContextual
24
25
  };
25
26
  //# sourceMappingURL=StateTaxesComponents.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"StateTaxesComponents.js","sources":["../../../../src/components/Company/StateTaxes/StateTaxesComponents.tsx"],"sourcesContent":["import { StateTaxesList } from './StateTaxesList/StateTaxesList'\nimport { StateTaxesForm } from './StateTaxesForm/StateTaxesForm'\nimport { useFlow, type FlowContextInterface } from '@/components/Flow/useFlow'\nimport { ensureRequired } from '@/helpers/ensureRequired'\n\nexport interface StateTaxesContextInterface extends FlowContextInterface {\n companyId: string\n state?: string\n component: React.ComponentType | null\n}\n\nexport function StateTaxesListContextual() {\n const { companyId, onEvent } = useFlow<StateTaxesContextInterface>()\n return <StateTaxesList onEvent={onEvent} companyId={ensureRequired(companyId)} />\n}\n\nexport function StateTaxesFormContextual() {\n const { companyId, state, onEvent } = useFlow<StateTaxesContextInterface>()\n return (\n <StateTaxesForm\n companyId={ensureRequired(companyId)}\n state={ensureRequired(state)}\n onEvent={onEvent}\n />\n )\n}\n"],"names":["StateTaxesListContextual","companyId","onEvent","useFlow","StateTaxesList","ensureRequired","StateTaxesFormContextual","state","jsx","StateTaxesForm"],"mappings":";;;;;AAWO,SAASA,IAA2B;AACzC,QAAM,EAAE,WAAAC,GAAW,SAAAC,EAAQ,IAAIC,EAAoC;AACnE,2BAAQC,GAAe,EAAA,SAAAF,GAAkB,WAAWG,EAAeJ,CAAS,GAAG;AACjF;AAEO,SAASK,IAA2B;AACzC,QAAM,EAAE,WAAAL,GAAW,OAAAM,GAAO,SAAAL,EAAA,IAAYC,EAAoC;AAExE,SAAA,gBAAAK;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,WAAWJ,EAAeJ,CAAS;AAAA,MACnC,OAAOI,EAAeE,CAAK;AAAA,MAC3B,SAAAL;AAAA,IAAA;AAAA,EACF;AAEJ;"}
1
+ {"version":3,"file":"StateTaxesComponents.js","sources":["../../../../src/components/Company/StateTaxes/StateTaxesComponents.tsx"],"sourcesContent":["import { StateTaxesList } from './StateTaxesList/StateTaxesList'\nimport { StateTaxesForm } from './StateTaxesForm/StateTaxesForm'\nimport type { StateTaxesStateData } from './stateTaxesReducer'\nimport { ensureRequired } from '@/helpers/ensureRequired'\nimport type { OnEventType } from '@/components/Base/useBase'\nimport type { EventType } from '@/shared/constants'\n\nexport interface StateTaxesContextInterface {\n companyId: string\n stateData: StateTaxesStateData\n onEvent: OnEventType<EventType, unknown>\n}\n\nexport function StateTaxesListContextual({ companyId, onEvent }: StateTaxesContextInterface) {\n return <StateTaxesList onEvent={onEvent} companyId={ensureRequired(companyId)} />\n}\n\nexport function StateTaxesFormContextual({\n companyId,\n stateData,\n onEvent,\n}: StateTaxesContextInterface) {\n return (\n <StateTaxesForm\n companyId={ensureRequired(companyId)}\n state={ensureRequired(stateData.selectedState)}\n onEvent={onEvent}\n />\n )\n}\n"],"names":["StateTaxesListContextual","companyId","onEvent","StateTaxesList","ensureRequired","StateTaxesFormContextual","stateData","jsx","StateTaxesForm"],"mappings":";;;;AAaO,SAASA,EAAyB,EAAE,WAAAC,GAAW,SAAAC,KAAuC;AAC3F,2BAAQC,GAAe,EAAA,SAAAD,GAAkB,WAAWE,EAAeH,CAAS,GAAG;AACjF;AAEO,SAASI,EAAyB;AAAA,EACvC,WAAAJ;AAAA,EACA,WAAAK;AAAA,EACA,SAAAJ;AACF,GAA+B;AAE3B,SAAA,gBAAAK;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,WAAWJ,EAAeH,CAAS;AAAA,MACnC,OAAOG,EAAeE,EAAU,aAAa;AAAA,MAC7C,SAAAJ;AAAA,IAAA;AAAA,EACF;AAEJ;"}
@@ -4,9 +4,4 @@ interface StateTaxesFormProps extends CommonComponentInterface {
4
4
  state: string;
5
5
  }
6
6
  export declare function StateTaxesForm(props: StateTaxesFormProps & BaseComponentInterface): import("react/jsx-runtime").JSX.Element;
7
- export declare namespace StateTaxesForm {
8
- var Head: typeof import("./Head").Head;
9
- var Form: typeof import("./Form").Form;
10
- var Actions: typeof import("./Actions").Actions;
11
- }
12
7
  export {};
@@ -1,35 +1,35 @@
1
- import { jsx as a, jsxs as D, Fragment as H } from "react/jsx-runtime";
2
- import { useForm as K, FormProvider as M } from "react-hook-form";
3
- import { zodResolver as w } from "@hookform/resolvers/zod";
4
- import { useTaxRequirementsUpdateStateMutation as z } from "@gusto/embedded-api/react-query/taxRequirementsUpdateState";
5
- import { useTaxRequirementsGetSuspense as G } from "@gusto/embedded-api/react-query/taxRequirementsGet";
1
+ import { jsx as a, jsxs as V, Fragment as O } from "react/jsx-runtime";
2
+ import { useForm as U, FormProvider as B } from "react-hook-form";
3
+ import { zodResolver as D } from "@hookform/resolvers/zod";
4
+ import { useTaxRequirementsUpdateStateMutation as K } from "@gusto/embedded-api/react-query/taxRequirementsUpdateState";
5
+ import { useTaxRequirementsGetSuspense as M } from "@gusto/embedded-api/react-query/taxRequirementsGet";
6
6
  import { z as r } from "zod";
7
- import { useMemo as L } from "react";
8
- import { useTranslation as X } from "react-i18next";
9
- import { Head as k } from "./Head.js";
10
- import { StateTaxesFormProvider as Y } from "./context.js";
11
- import { Form as A } from "./Form.js";
12
- import { Actions as P } from "./Actions.js";
13
- import { BaseComponent as $ } from "../../../Base/Base.js";
14
- import { useI18n as I } from "../../../../i18n/I18n.js";
15
- import { Flex as J } from "../../../Common/Flex/Flex.js";
16
- import { Form as Q } from "../../../Common/Form/Form.js";
17
- import { componentEvents as q } from "../../../../shared/constants.js";
18
- import { useBase as W } from "../../../Base/useBase.js";
19
- function h(i) {
20
- return /* @__PURE__ */ a($, { ...i, children: /* @__PURE__ */ a(Z, { ...i, children: i.children }) });
7
+ import { useMemo as w } from "react";
8
+ import { useTranslation as z } from "react-i18next";
9
+ import { Head as H } from "./Head.js";
10
+ import { StateTaxesFormProvider as G } from "./context.js";
11
+ import { Form as L } from "./Form.js";
12
+ import { Actions as X } from "./Actions.js";
13
+ import { BaseComponent as Y } from "../../../Base/Base.js";
14
+ import { useI18n as $ } from "../../../../i18n/I18n.js";
15
+ import { Flex as I } from "../../../Common/Flex/Flex.js";
16
+ import { Form as J } from "../../../Common/Form/Form.js";
17
+ import { componentEvents as g } from "../../../../shared/constants.js";
18
+ import { useBase as Q } from "../../../Base/useBase.js";
19
+ function Se(i) {
20
+ return /* @__PURE__ */ a(Y, { ...i, children: /* @__PURE__ */ a(W, { ...i, children: i.children }) });
21
21
  }
22
- function Z({ companyId: i, state: y, className: _, children: x }) {
23
- I("Company.StateTaxes");
24
- const { onEvent: F, baseSubmitHandler: j } = W(), { t: o } = X("Company.StateTaxes", { keyPrefix: "form" }), { data: C } = G({ companyUuid: i, state: y }), l = C.taxRequirementsState, { mutateAsync: E, isPending: N } = z(), { dynamicSchema: R, defaultValues: V } = L(() => {
22
+ function W({ companyId: i, state: y, className: q, children: h }) {
23
+ $("Company.StateTaxes");
24
+ const { onEvent: x, baseSubmitHandler: k } = Q(), { t: o } = z("Company.StateTaxes", { keyPrefix: "form" }), { data: P } = M({ companyUuid: i, state: y }), l = P.taxRequirementsState, { mutateAsync: _, isPending: j } = K(), { dynamicSchema: A, defaultValues: C } = w(() => {
25
25
  const f = {}, s = {};
26
26
  return l.requirementSets?.forEach((t) => {
27
27
  if (!t.key) return;
28
28
  const m = t.key, c = {}, p = {};
29
29
  t.requirements?.forEach((e) => {
30
30
  if (!e.key) return;
31
- const g = e.key;
32
- p[g] = e.metadata?.type === "radio" ? e.value ?? void 0 : e.value ? String(e.value) : "";
31
+ const b = e.key;
32
+ p[b] = e.metadata?.type === "radio" ? e.value ?? void 0 : e.value ? String(e.value) : "";
33
33
  let v = r.string({
34
34
  required_error: o("validations.required")
35
35
  }).min(1, o("validations.required"));
@@ -51,18 +51,18 @@ function Z({ companyId: i, state: y, className: _, children: x }) {
51
51
  }
52
52
  e.metadata?.type === "radio" && (v = r.boolean({
53
53
  required_error: o("validations.required")
54
- })), c[g] = v;
54
+ })), c[b] = v;
55
55
  }), Object.keys(c).length > 0 && (f[m] = r.object(c), s[m] = p);
56
56
  }), {
57
57
  dynamicSchema: r.object(f),
58
58
  defaultValues: s
59
59
  };
60
- }, [l, o]), { control: O, ...T } = K({
61
- resolver: w(R),
62
- defaultValues: V
63
- }), U = async (f) => {
64
- await j(f, async (s) => {
65
- const b = l.requirementSets?.filter((t) => t.key && s[t.key]).map((t) => {
60
+ }, [l, o]), { control: E, ...F } = U({
61
+ resolver: D(A),
62
+ defaultValues: C
63
+ }), N = async (f) => {
64
+ await k(f, async (s) => {
65
+ const T = l.requirementSets?.filter((t) => t.key && s[t.key]).map((t) => {
66
66
  const m = t.key, c = s[m];
67
67
  return {
68
68
  state: t.state,
@@ -74,33 +74,30 @@ function Z({ companyId: i, state: y, className: _, children: x }) {
74
74
  }))
75
75
  };
76
76
  });
77
- await E({
77
+ await _({
78
78
  request: {
79
79
  companyUuid: i,
80
- requestBody: { requirementSets: b },
80
+ requestBody: { requirementSets: T },
81
81
  state: y
82
82
  }
83
- }), F(q.COMPANY_STATE_TAX_UPDATED);
83
+ }), x(g.COMPANY_STATE_TAX_UPDATED);
84
84
  });
85
- }, B = () => {
86
- F(q.CANCEL);
85
+ }, R = () => {
86
+ x(g.CANCEL);
87
87
  };
88
- return /* @__PURE__ */ a("section", { className: _, children: /* @__PURE__ */ a(M, { ...T, control: O, children: /* @__PURE__ */ a(Q, { onSubmit: T.handleSubmit(U), children: /* @__PURE__ */ a(
89
- Y,
88
+ return /* @__PURE__ */ a("section", { className: q, children: /* @__PURE__ */ a(B, { ...F, control: E, children: /* @__PURE__ */ a(J, { onSubmit: F.handleSubmit(N), children: /* @__PURE__ */ a(
89
+ G,
90
90
  {
91
- value: { stateTaxRequirements: l, isPending: N, state: y, handleCancel: B },
92
- children: /* @__PURE__ */ a(J, { flexDirection: "column", gap: 32, children: x || /* @__PURE__ */ D(H, { children: [
93
- /* @__PURE__ */ a(k, {}),
94
- /* @__PURE__ */ a(A, {}),
95
- /* @__PURE__ */ a(P, {})
91
+ value: { stateTaxRequirements: l, isPending: j, state: y, handleCancel: R },
92
+ children: /* @__PURE__ */ a(I, { flexDirection: "column", gap: 32, children: h || /* @__PURE__ */ V(O, { children: [
93
+ /* @__PURE__ */ a(H, {}),
94
+ /* @__PURE__ */ a(L, {}),
95
+ /* @__PURE__ */ a(X, {})
96
96
  ] }) })
97
97
  }
98
98
  ) }) }) });
99
99
  }
100
- h.Head = k;
101
- h.Form = A;
102
- h.Actions = P;
103
100
  export {
104
- h as StateTaxesForm
101
+ Se as StateTaxesForm
105
102
  };
106
103
  //# sourceMappingURL=StateTaxesForm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"StateTaxesForm.js","sources":["../../../../../src/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.tsx"],"sourcesContent":["import { FormProvider, useForm } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { useTaxRequirementsUpdateStateMutation } from '@gusto/embedded-api/react-query/taxRequirementsUpdateState'\nimport { useTaxRequirementsGetSuspense } from '@gusto/embedded-api/react-query/taxRequirementsGet'\nimport { z } from 'zod'\nimport { useMemo } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { Head } from './Head'\nimport { StateTaxesFormProvider } from './context'\nimport { Form } from './Form'\nimport { Actions } from './Actions'\nimport type { BaseComponentInterface, CommonComponentInterface } from '@/components/Base/Base'\nimport { BaseComponent } from '@/components/Base/Base'\nimport { useI18n } from '@/i18n/I18n'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { Form as HtmlForm } from '@/components/Common/Form'\nimport { componentEvents } from '@/shared/constants'\nimport { useBase } from '@/components/Base'\n\ninterface StateTaxesFormProps extends CommonComponentInterface {\n companyId: string\n state: string\n}\n\nexport function StateTaxesForm(props: StateTaxesFormProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ companyId, state, className, children }: StateTaxesFormProps) {\n useI18n('Company.StateTaxes')\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Company.StateTaxes', { keyPrefix: 'form' })\n const { data } = useTaxRequirementsGetSuspense({ companyUuid: companyId, state })\n const stateTaxRequirements = data.taxRequirementsState!\n\n const { mutateAsync: updateStateTax, isPending: isPendingUpdate } =\n useTaxRequirementsUpdateStateMutation()\n\n // Schema and default value generation\n const { dynamicSchema, defaultValues } = useMemo(() => {\n const schemaShape: Record<string, z.ZodObject<Record<string, z.ZodTypeAny>>> = {}\n const values: Partial<Record<string, Record<string, string | boolean | number | undefined>>> =\n {}\n\n //Looping through each requirement set\n stateTaxRequirements.requirementSets?.forEach(requirementSet => {\n if (!requirementSet.key) return\n\n const requirementSetKey = requirementSet.key\n const requirementShape: Record<string, z.ZodTypeAny> = {}\n const requirementValues: Record<string, string | boolean | number | undefined> = {}\n\n requirementSet.requirements?.forEach(requirement => {\n if (!requirement.key) return\n\n const requirementKey = requirement.key\n\n // --- Default Value Logic ---\n requirementValues[requirementKey] =\n requirement.metadata?.type === 'radio'\n ? (requirement.value ?? undefined)\n : requirement.value\n ? String(requirement.value)\n : ''\n\n // --- Schema Logic ---\n // Start with a basic string schema\n let fieldSchema: z.ZodTypeAny = z\n .string({\n required_error: t('validations.required'),\n })\n .min(1, t('validations.required'))\n\n const validation = requirement.metadata?.validation\n // Not all requirements have validation\n if (validation) {\n if (requirement.metadata?.type === 'tax_rate') {\n if (validation.type === 'min_max') {\n const min = parseFloat(validation.min as string)\n const max = parseFloat(validation.max as string)\n\n if (!isNaN(min) && !isNaN(max)) {\n fieldSchema = z.preprocess(\n val => Number(val),\n z\n .number()\n .min(min, t('validations.minValue', { min }))\n .max(max, t('validations.maxValue', { max }))\n .transform(num => String(num)),\n )\n }\n } else {\n //Type is one_of\n const oneOfValues = validation.rates as string[]\n fieldSchema = z\n .string({\n required_error: t('validations.required'),\n })\n .min(1, t('validations.required'))\n .refine(val => oneOfValues.includes(val), {\n message: t('validations.oneOf', { values: oneOfValues.join(', ') }),\n })\n }\n }\n }\n if (requirement.metadata?.type === 'radio') {\n fieldSchema = z.boolean({\n required_error: t('validations.required'),\n })\n }\n requirementShape[requirementKey] = fieldSchema\n // --- End Schema Logic ---\n })\n\n if (Object.keys(requirementShape).length > 0) {\n schemaShape[requirementSetKey] = z.object(requirementShape)\n values[requirementSetKey] = requirementValues\n }\n })\n\n const finalSchema = z.object(schemaShape)\n\n // Return both the schema and the default values\n return {\n dynamicSchema: finalSchema,\n defaultValues: values as z.infer<typeof finalSchema>,\n }\n }, [stateTaxRequirements, t])\n\n // Infer the type from the schema\n type InferredFormInputs = z.infer<typeof dynamicSchema>\n\n const { control, ...methods } = useForm<InferredFormInputs>({\n resolver: zodResolver(dynamicSchema),\n defaultValues,\n })\n\n const onSubmit = async (formData: InferredFormInputs) => {\n await baseSubmitHandler(formData, async payload => {\n const requirementSets = stateTaxRequirements.requirementSets\n ?.filter(rs => rs.key && payload[rs.key])\n .map(requirementSet => {\n const requirementSetKey = requirementSet.key as string\n const payloadSet = payload[requirementSetKey] as Record<string, unknown>\n return {\n state: requirementSet.state,\n key: requirementSetKey,\n effectiveFrom: requirementSet.effectiveFrom,\n requirements: Object.entries(payloadSet).map(([key, value]) => ({\n key,\n value: String(value),\n })),\n }\n })\n await updateStateTax({\n request: {\n companyUuid: companyId,\n requestBody: { requirementSets },\n state,\n },\n })\n onEvent(componentEvents.COMPANY_STATE_TAX_UPDATED)\n })\n }\n\n const handleCancel = () => {\n onEvent(componentEvents.CANCEL)\n }\n\n return (\n <section className={className}>\n <FormProvider {...methods} control={control}>\n <HtmlForm onSubmit={methods.handleSubmit(onSubmit)}>\n <StateTaxesFormProvider\n value={{ stateTaxRequirements, isPending: isPendingUpdate, state, handleCancel }}\n >\n <Flex flexDirection=\"column\" gap={32}>\n {children ? (\n children\n ) : (\n <>\n <Head />\n <Form />\n <Actions />\n </>\n )}\n </Flex>\n </StateTaxesFormProvider>\n </HtmlForm>\n </FormProvider>\n </section>\n )\n}\n\nStateTaxesForm.Head = Head\nStateTaxesForm.Form = Form\nStateTaxesForm.Actions = Actions\n"],"names":["StateTaxesForm","props","jsx","BaseComponent","Root","companyId","state","className","children","useI18n","onEvent","baseSubmitHandler","useBase","t","useTranslation","data","useTaxRequirementsGetSuspense","stateTaxRequirements","updateStateTax","isPendingUpdate","useTaxRequirementsUpdateStateMutation","dynamicSchema","defaultValues","useMemo","schemaShape","values","requirementSet","requirementSetKey","requirementShape","requirementValues","requirement","requirementKey","fieldSchema","z","validation","min","max","val","num","oneOfValues","control","methods","useForm","zodResolver","onSubmit","formData","payload","requirementSets","rs","payloadSet","key","value","componentEvents","handleCancel","FormProvider","HtmlForm","StateTaxesFormProvider","Flex","jsxs","Fragment","Head","Form","Actions"],"mappings":";;;;;;;;;;;;;;;;;;AAwBO,SAASA,EAAeC,GAAqD;AAEhF,SAAA,gBAAAC,EAACC,GAAe,EAAA,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAMA,EAAA,SAAA,CAAS,EACnC,CAAA;AAEJ;AAEA,SAASG,EAAK,EAAE,WAAAC,GAAW,OAAAC,GAAO,WAAAC,GAAW,UAAAC,KAAiC;AAC5E,EAAAC,EAAQ,oB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AO4D;AACtB5D,EAAe,OAAO6D;AACtB7D,EAAe,UAAU8D;"}
1
+ {"version":3,"file":"StateTaxesForm.js","sources":["../../../../../src/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.tsx"],"sourcesContent":["import { FormProvider, useForm } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { useTaxRequirementsUpdateStateMutation } from '@gusto/embedded-api/react-query/taxRequirementsUpdateState'\nimport { useTaxRequirementsGetSuspense } from '@gusto/embedded-api/react-query/taxRequirementsGet'\nimport { z } from 'zod'\nimport { useMemo } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { Head } from './Head'\nimport { StateTaxesFormProvider } from './context'\nimport { Form } from './Form'\nimport { Actions } from './Actions'\nimport type { BaseComponentInterface, CommonComponentInterface } from '@/components/Base/Base'\nimport { BaseComponent } from '@/components/Base/Base'\nimport { useI18n } from '@/i18n/I18n'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { Form as HtmlForm } from '@/components/Common/Form'\nimport { componentEvents } from '@/shared/constants'\nimport { useBase } from '@/components/Base'\n\ninterface StateTaxesFormProps extends CommonComponentInterface {\n companyId: string\n state: string\n}\n\nexport function StateTaxesForm(props: StateTaxesFormProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ companyId, state, className, children }: StateTaxesFormProps) {\n useI18n('Company.StateTaxes')\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Company.StateTaxes', { keyPrefix: 'form' })\n const { data } = useTaxRequirementsGetSuspense({ companyUuid: companyId, state })\n const stateTaxRequirements = data.taxRequirementsState!\n\n const { mutateAsync: updateStateTax, isPending: isPendingUpdate } =\n useTaxRequirementsUpdateStateMutation()\n\n // Schema and default value generation\n const { dynamicSchema, defaultValues } = useMemo(() => {\n const schemaShape: Record<string, z.ZodObject<Record<string, z.ZodTypeAny>>> = {}\n const values: Partial<Record<string, Record<string, string | boolean | number | undefined>>> =\n {}\n\n //Looping through each requirement set\n stateTaxRequirements.requirementSets?.forEach(requirementSet => {\n if (!requirementSet.key) return\n\n const requirementSetKey = requirementSet.key\n const requirementShape: Record<string, z.ZodTypeAny> = {}\n const requirementValues: Record<string, string | boolean | number | undefined> = {}\n\n requirementSet.requirements?.forEach(requirement => {\n if (!requirement.key) return\n\n const requirementKey = requirement.key\n\n // --- Default Value Logic ---\n requirementValues[requirementKey] =\n requirement.metadata?.type === 'radio'\n ? (requirement.value ?? undefined)\n : requirement.value\n ? String(requirement.value)\n : ''\n\n // --- Schema Logic ---\n // Start with a basic string schema\n let fieldSchema: z.ZodTypeAny = z\n .string({\n required_error: t('validations.required'),\n })\n .min(1, t('validations.required'))\n\n const validation = requirement.metadata?.validation\n // Not all requirements have validation\n if (validation) {\n if (requirement.metadata?.type === 'tax_rate') {\n if (validation.type === 'min_max') {\n const min = parseFloat(validation.min as string)\n const max = parseFloat(validation.max as string)\n\n if (!isNaN(min) && !isNaN(max)) {\n fieldSchema = z.preprocess(\n val => Number(val),\n z\n .number()\n .min(min, t('validations.minValue', { min }))\n .max(max, t('validations.maxValue', { max }))\n .transform(num => String(num)),\n )\n }\n } else {\n //Type is one_of\n const oneOfValues = validation.rates as string[]\n fieldSchema = z\n .string({\n required_error: t('validations.required'),\n })\n .min(1, t('validations.required'))\n .refine(val => oneOfValues.includes(val), {\n message: t('validations.oneOf', { values: oneOfValues.join(', ') }),\n })\n }\n }\n }\n if (requirement.metadata?.type === 'radio') {\n fieldSchema = z.boolean({\n required_error: t('validations.required'),\n })\n }\n requirementShape[requirementKey] = fieldSchema\n // --- End Schema Logic ---\n })\n\n if (Object.keys(requirementShape).length > 0) {\n schemaShape[requirementSetKey] = z.object(requirementShape)\n values[requirementSetKey] = requirementValues\n }\n })\n\n const finalSchema = z.object(schemaShape)\n\n // Return both the schema and the default values\n return {\n dynamicSchema: finalSchema,\n defaultValues: values as z.infer<typeof finalSchema>,\n }\n }, [stateTaxRequirements, t])\n\n // Infer the type from the schema\n type InferredFormInputs = z.infer<typeof dynamicSchema>\n\n const { control, ...methods } = useForm<InferredFormInputs>({\n resolver: zodResolver(dynamicSchema),\n defaultValues,\n })\n\n const onSubmit = async (formData: InferredFormInputs) => {\n await baseSubmitHandler(formData, async payload => {\n const requirementSets = stateTaxRequirements.requirementSets\n ?.filter(rs => rs.key && payload[rs.key])\n .map(requirementSet => {\n const requirementSetKey = requirementSet.key as string\n const payloadSet = payload[requirementSetKey] as Record<string, unknown>\n return {\n state: requirementSet.state,\n key: requirementSetKey,\n effectiveFrom: requirementSet.effectiveFrom,\n requirements: Object.entries(payloadSet).map(([key, value]) => ({\n key,\n value: String(value),\n })),\n }\n })\n await updateStateTax({\n request: {\n companyUuid: companyId,\n requestBody: { requirementSets },\n state,\n },\n })\n onEvent(componentEvents.COMPANY_STATE_TAX_UPDATED)\n })\n }\n\n const handleCancel = () => {\n onEvent(componentEvents.CANCEL)\n }\n\n return (\n <section className={className}>\n <FormProvider {...methods} control={control}>\n <HtmlForm onSubmit={methods.handleSubmit(onSubmit)}>\n <StateTaxesFormProvider\n value={{ stateTaxRequirements, isPending: isPendingUpdate, state, handleCancel }}\n >\n <Flex flexDirection=\"column\" gap={32}>\n {children ? (\n children\n ) : (\n <>\n <Head />\n <Form />\n <Actions />\n </>\n )}\n </Flex>\n </StateTaxesFormProvider>\n </HtmlForm>\n </FormProvider>\n </section>\n )\n}\n"],"names":["StateTaxesForm","props","jsx","BaseComponent","Root","companyId","state","className","children","useI18n","onEvent","baseSubmitHandler","useBase","t","useTranslation","data","useTaxRequirementsGetSuspense","stateTaxRequirements","updateStateTax","isPendingUpdate","useTaxRequirementsUpdateStateMutation","dynamicSchema","defaultValues","useMemo","schemaShape","values","requirementSet","requirementSetKey","requirementShape","requirementValues","requirement","requirementKey","fieldSchema","z","validation","min","max","val","num","oneOfValues","control","methods","useForm","zodResolver","onSubmit","formData","payload","requirementSets","rs","payloadSet","key","value","componentEvents","handleCanc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,OAAAb,GAAO,cAAA+C,EAAa;AAAA,MAE/E,UAAA,gBAAAnD,EAACuD,KAAK,eAAc,UAAS,KAAK,IAC/B,UAAAjD,KAIG,gBAAAkD,EAAAC,GAAA,EAAA,UAAA;AAAA,QAAA,gBAAAzD,EAAC0D,GAAK,EAAA;AAAA,0BACLC,GAAK,EAAA;AAAA,0BACLC,GAAQ,CAAA,CAAA;AAAA,MAAA,EAAA,CACX,EAEJ,CAAA;AAAA,IAAA;AAAA,EAAA,EAEJ,CAAA,EACF,CAAA,GACF;AAEJ;"}
@@ -3,9 +3,4 @@ interface StateTaxesListProps extends BaseComponentInterface {
3
3
  companyId: string;
4
4
  }
5
5
  export declare function StateTaxesList(props: StateTaxesListProps): import("react/jsx-runtime").JSX.Element;
6
- export declare namespace StateTaxesList {
7
- var Head: typeof import("./Head").Head;
8
- var List: () => import("react/jsx-runtime").JSX.Element;
9
- var Actions: typeof import("./Actions").Actions;
10
- }
11
6
  export {};
@@ -1,45 +1,42 @@
1
- import { jsx as e, jsxs as p, Fragment as u } from "react/jsx-runtime";
2
- import { useTaxRequirementsGetAllSuspense as h } from "@gusto/embedded-api/react-query/taxRequirementsGetAll";
3
- import { Head as s } from "./Head.js";
4
- import { StateTaxesListProvider as T } from "./context.js";
5
- import { Actions as m } from "./Actions.js";
6
- import { List as a } from "./List.js";
7
- import { BaseComponent as x } from "../../../Base/Base.js";
8
- import { useI18n as A } from "../../../../i18n/I18n.js";
9
- import { Flex as C } from "../../../Common/Flex/Flex.js";
10
- import { componentEvents as i } from "../../../../shared/constants.js";
11
- import { useBase as E } from "../../../Base/useBase.js";
12
- function t(n) {
13
- return /* @__PURE__ */ e(x, { ...n, children: /* @__PURE__ */ e(S, { ...n, children: n.children }) });
1
+ import { jsx as e, jsxs as c, Fragment as l } from "react/jsx-runtime";
2
+ import { useTaxRequirementsGetAllSuspense as d } from "@gusto/embedded-api/react-query/taxRequirementsGetAll";
3
+ import { Head as f } from "./Head.js";
4
+ import { StateTaxesListProvider as p } from "./context.js";
5
+ import { Actions as u } from "./Actions.js";
6
+ import { List as h } from "./List.js";
7
+ import { BaseComponent as T } from "../../../Base/Base.js";
8
+ import { useI18n as x } from "../../../../i18n/I18n.js";
9
+ import { Flex as A } from "../../../Common/Flex/Flex.js";
10
+ import { componentEvents as r } from "../../../../shared/constants.js";
11
+ import { useBase as C } from "../../../Base/useBase.js";
12
+ function y(n) {
13
+ return /* @__PURE__ */ e(T, { ...n, children: /* @__PURE__ */ e(E, { ...n, children: n.children }) });
14
14
  }
15
- function S({ className: n, children: o, companyId: c }) {
16
- A("Company.StateTaxes");
17
- const { onEvent: r } = E(), { data: d } = h({ companyUuid: c }), l = d.responseBodies;
15
+ function E({ className: n, children: t, companyId: i }) {
16
+ x("Company.StateTaxes");
17
+ const { onEvent: o } = C(), { data: m } = d({ companyUuid: i }), s = m.responseBodies;
18
18
  return /* @__PURE__ */ e("section", { className: n, children: /* @__PURE__ */ e(
19
- T,
19
+ p,
20
20
  {
21
21
  value: {
22
22
  isPending: !1,
23
- stateTaxRequirements: l,
23
+ stateTaxRequirements: s,
24
24
  handleContinue: () => {
25
- r(i.COMPANY_STATE_TAX_DONE);
25
+ o(r.COMPANY_STATE_TAX_DONE);
26
26
  },
27
- handleChange: (f) => {
28
- r(i.COMPANY_STATE_TAX_EDIT, { state: f });
27
+ handleChange: (a) => {
28
+ o(r.COMPANY_STATE_TAX_EDIT, { state: a });
29
29
  }
30
30
  },
31
- children: /* @__PURE__ */ e(C, { flexDirection: "column", gap: 32, children: o || /* @__PURE__ */ p(u, { children: [
32
- /* @__PURE__ */ e(s, {}),
33
- /* @__PURE__ */ e(a, {}),
34
- /* @__PURE__ */ e(m, {})
31
+ children: /* @__PURE__ */ e(A, { flexDirection: "column", gap: 32, children: t || /* @__PURE__ */ c(l, { children: [
32
+ /* @__PURE__ */ e(f, {}),
33
+ /* @__PURE__ */ e(h, {}),
34
+ /* @__PURE__ */ e(u, {})
35
35
  ] }) })
36
36
  }
37
37
  ) });
38
38
  }
39
- t.Head = s;
40
- t.List = a;
41
- t.Actions = m;
42
39
  export {
43
- t as StateTaxesList
40
+ y as StateTaxesList
44
41
  };
45
42
  //# sourceMappingURL=StateTaxesList.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"StateTaxesList.js","sources":["../../../../../src/components/Company/StateTaxes/StateTaxesList/StateTaxesList.tsx"],"sourcesContent":["import { useTaxRequirementsGetAllSuspense } from '@gusto/embedded-api/react-query/taxRequirementsGetAll'\nimport { Head } from './Head'\nimport { StateTaxesListProvider } from './context'\nimport { Actions } from './Actions'\nimport { List } from './List'\nimport type { BaseComponentInterface } from '@/components/Base/Base'\nimport { BaseComponent } from '@/components/Base/Base'\nimport { useI18n } from '@/i18n/I18n'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { componentEvents } from '@/shared/constants'\nimport { useBase } from '@/components/Base'\n\ninterface StateTaxesListProps extends BaseComponentInterface {\n companyId: string\n}\n\nexport function StateTaxesList(props: StateTaxesListProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ className, children, companyId }: StateTaxesListProps) {\n useI18n('Company.StateTaxes')\n const { onEvent } = useBase()\n const { data } = useTaxRequirementsGetAllSuspense({ companyUuid: companyId })\n const stateTaxRequirements = data.responseBodies!\n\n const handleContinue = () => {\n onEvent(componentEvents.COMPANY_STATE_TAX_DONE)\n }\n\n const handleChange = (state: string) => {\n onEvent(componentEvents.COMPANY_STATE_TAX_EDIT, { state })\n }\n\n return (\n <section className={className}>\n <StateTaxesListProvider\n value={{\n isPending: false,\n stateTaxRequirements,\n handleContinue,\n handleChange,\n }}\n >\n <Flex flexDirection=\"column\" gap={32}>\n {children ? (\n children\n ) : (\n <>\n <Head />\n <List />\n <Actions />\n </>\n )}\n </Flex>\n </StateTaxesListProvider>\n </section>\n )\n}\n\nStateTaxesList.Head = Head\nStateTaxesList.List = List\nStateTaxesList.Actions = Actions\n"],"names":["StateTaxesList","props","jsx","BaseComponent","Root","className","children","companyId","useI18n","onEvent","useBase","data","useTaxRequirementsGetAllSuspense","stateTaxRequirements","StateTaxesListProvider","componentEvents","state","Flex","jsxs","Fragment","Head","List","Actions"],"mappings":";;;;;;;;;;;AAgBO,SAASA,EAAeC,GAA4B;AAEvD,SAAA,gBAAAC,EAACC,GAAe,EAAA,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAMA,EAAA,SAAA,CAAS,EACnC,CAAA;AAEJ;AAEA,SAASG,EAAK,EAAE,WAAAC,GAAW,UAAAC,GAAU,WAAAC,KAAkC;AACrE,EAAAC,EAAQ,oBAAoB;AACtB,QAAA,EAAE,SAAAC,EAAQ,IAAIC,EAAQ,GACtB,EAAE,MAAAC,EAAK,IAAIC,EAAiC,EAAE,aAAaL,GAAW,GACtEM,IAAuBF,EAAK;AAWhC,SAAA,gBAAAT,EAAC,aAAQ,WAAAG,GACP,UAAA,gBAAAH;AAAA,IAACY;AAAA,IAAA;AAAA,MACC,OAAO;AAAA,QACL,WAAW;AAAA,QACX,sBAAAD;AAAA,QACA,gBAde,MAAM;AAC3B,UAAAJ,EAAQM,EAAgB,sBAAsB;AAAA,QAChD;AAAA,QAaQ,cAXa,CAACC,MAAkB;AACtC,UAAAP,EAAQM,EAAgB,wBAAwB,EAAE,OAAAC,EAAA,CAAO;AAAA,QAC3D;AAAA,MAUM;AAAA,MAEA,UAAA,gBAAAd,EAACe,KAAK,eAAc,UAAS,KAAK,IAC/B,UAAAX,KAIG,gBAAAY,EAAAC,GAAA,EAAA,UAAA;AAAA,QAAA,gBAAAjB,EAACkB,GAAK,EAAA;AAAA,0BACLC,GAAK,EAAA;AAAA,0BACLC,GAAQ,CAAA,CAAA;AAAA,MAAA,EAAA,CACX,EAEJ,CAAA;AAAA,IAAA;AAAA,EAAA,GAEJ;AAEJ;AAEAtB,EAAe,OAAOoB;AACtBpB,EAAe,OAAOqB;AACtBrB,EAAe,UAAUsB;"}
1
+ {"version":3,"file":"StateTaxesList.js","sources":["../../../../../src/components/Company/StateTaxes/StateTaxesList/StateTaxesList.tsx"],"sourcesContent":["import { useTaxRequirementsGetAllSuspense } from '@gusto/embedded-api/react-query/taxRequirementsGetAll'\nimport { Head } from './Head'\nimport { StateTaxesListProvider } from './context'\nimport { Actions } from './Actions'\nimport { List } from './List'\nimport type { BaseComponentInterface } from '@/components/Base/Base'\nimport { BaseComponent } from '@/components/Base/Base'\nimport { useI18n } from '@/i18n/I18n'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { componentEvents } from '@/shared/constants'\nimport { useBase } from '@/components/Base'\n\ninterface StateTaxesListProps extends BaseComponentInterface {\n companyId: string\n}\n\nexport function StateTaxesList(props: StateTaxesListProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ className, children, companyId }: StateTaxesListProps) {\n useI18n('Company.StateTaxes')\n const { onEvent } = useBase()\n const { data } = useTaxRequirementsGetAllSuspense({ companyUuid: companyId })\n const stateTaxRequirements = data.responseBodies!\n\n const handleContinue = () => {\n onEvent(componentEvents.COMPANY_STATE_TAX_DONE)\n }\n\n const handleChange = (state: string) => {\n onEvent(componentEvents.COMPANY_STATE_TAX_EDIT, { state })\n }\n\n return (\n <section className={className}>\n <StateTaxesListProvider\n value={{\n isPending: false,\n stateTaxRequirements,\n handleContinue,\n handleChange,\n }}\n >\n <Flex flexDirection=\"column\" gap={32}>\n {children ? (\n children\n ) : (\n <>\n <Head />\n <List />\n <Actions />\n </>\n )}\n </Flex>\n </StateTaxesListProvider>\n </section>\n )\n}\n"],"names":["StateTaxesList","props","jsx","BaseComponent","Root","className","children","companyId","useI18n","onEvent","useBase","data","useTaxRequirementsGetAllSuspense","stateTaxRequirements","StateTaxesListProvider","componentEvents","state","Flex","jsxs","Fragment","Head","List","Actions"],"mappings":";;;;;;;;;;;AAgBO,SAASA,EAAeC,GAA4B;AAEvD,SAAA,gBAAAC,EAACC,GAAe,EAAA,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAMA,EAAA,SAAA,CAAS,EACnC,CAAA;AAEJ;AAEA,SAASG,EAAK,EAAE,WAAAC,GAAW,UAAAC,GAAU,WAAAC,KAAkC;AACrE,EAAAC,EAAQ,oBAAoB;AACtB,QAAA,EAAE,SAAAC,EAAQ,IAAIC,EAAQ,GACtB,EAAE,MAAAC,EAAK,IAAIC,EAAiC,EAAE,aAAaL,GAAW,GACtEM,IAAuBF,EAAK;AAWhC,SAAA,gBAAAT,EAAC,aAAQ,WAAAG,GACP,UAAA,gBAAAH;AAAA,IAACY;AAAA,IAAA;AAAA,MACC,OAAO;AAAA,QACL,WAAW;AAAA,QACX,sBAAAD;AAAA,QACA,gBAde,MAAM;AAC3B,UAAAJ,EAAQM,EAAgB,sBAAsB;AAAA,QAChD;AAAA,QAaQ,cAXa,CAACC,MAAkB;AACtC,UAAAP,EAAQM,EAAgB,wBAAwB,EAAE,OAAAC,EAAA,CAAO;AAAA,QAC3D;AAAA,MAUM;AAAA,MAEA,UAAA,gBAAAd,EAACe,KAAK,eAAc,UAAS,KAAK,IAC/B,UAAAX,KAIG,gBAAAY,EAAAC,GAAA,EAAA,UAAA;AAAA,QAAA,gBAAAjB,EAACkB,GAAK,EAAA;AAAA,0BACLC,GAAK,EAAA;AAAA,0BACLC,GAAQ,CAAA,CAAA;AAAA,MAAA,EAAA,CACX,EAEJ,CAAA;AAAA,IAAA;AAAA,EAAA,GAEJ;AAEJ;"}
@@ -0,0 +1,20 @@
1
+ import { componentEvents } from '../../../shared/constants';
2
+ export type StateTaxesState = 'viewStateTaxes' | 'editStateTaxes' | 'done';
3
+ export interface StateTaxesStateData {
4
+ state: StateTaxesState;
5
+ selectedState?: string;
6
+ }
7
+ export type StateTaxesAction = {
8
+ type: typeof componentEvents.COMPANY_STATE_TAX_EDIT;
9
+ payload: {
10
+ state: string;
11
+ };
12
+ } | {
13
+ type: typeof componentEvents.COMPANY_STATE_TAX_UPDATED;
14
+ } | {
15
+ type: typeof componentEvents.COMPANY_STATE_TAX_DONE;
16
+ } | {
17
+ type: typeof componentEvents.CANCEL;
18
+ };
19
+ export declare const initialState: StateTaxesStateData;
20
+ export declare function stateTaxesReducer(state: StateTaxesStateData, action: StateTaxesAction): StateTaxesStateData;