@gusto/embedded-react-sdk 0.8.1 → 0.9.0

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 (374) hide show
  1. package/CHANGELOG.md +20 -3
  2. package/dist/components/Base/Base.d.ts +6 -5
  3. package/dist/components/Base/Base.js +40 -39
  4. package/dist/components/Base/Base.js.map +1 -1
  5. package/dist/components/Base/index.d.ts +1 -0
  6. package/dist/components/Common/ActionsLayout/index.d.ts +1 -0
  7. package/dist/components/Common/DataView/DataCards/DataCards.js +21 -21
  8. package/dist/components/Common/DataView/DataCards/DataCards.js.map +1 -1
  9. package/dist/components/Common/DataView/DataCards/index.d.ts +1 -0
  10. package/dist/components/Common/DataView/index.d.ts +1 -0
  11. package/dist/components/Common/DocumentList/index.d.ts +1 -0
  12. package/dist/components/Common/DocumentViewer/index.d.ts +1 -0
  13. package/dist/components/Common/FieldCaption/index.d.ts +1 -0
  14. package/dist/components/Common/FieldDescription/index.d.ts +1 -0
  15. package/dist/components/Common/FieldErrorMessage/index.d.ts +1 -0
  16. package/dist/components/Common/FieldLayout/index.d.ts +1 -0
  17. package/dist/components/Common/Fields/CheckboxField/index.d.ts +1 -0
  18. package/dist/components/Common/Fields/CheckboxGroupField/index.d.ts +1 -0
  19. package/dist/components/Common/Fields/ComboBoxField/index.d.ts +1 -0
  20. package/dist/components/Common/Fields/DatePickerField/index.d.ts +1 -0
  21. package/dist/components/Common/Fields/NumberInputField/index.d.ts +1 -0
  22. package/dist/components/Common/Fields/RadioGroupField/index.d.ts +1 -0
  23. package/dist/components/Common/Fields/SelectField/index.d.ts +1 -0
  24. package/dist/components/Common/Fields/SwitchField/index.d.ts +1 -0
  25. package/dist/components/Common/Fields/TextInputField/index.d.ts +1 -0
  26. package/dist/components/Common/Fieldset/index.d.ts +1 -0
  27. package/dist/components/Common/Flex/index.d.ts +1 -0
  28. package/dist/components/Common/Form/index.d.ts +1 -0
  29. package/dist/components/Common/HamburgerMenu/index.d.ts +1 -0
  30. package/dist/components/Common/HorizontalFieldLayout/index.d.ts +1 -0
  31. package/dist/components/Common/PaginationControl/index.d.ts +1 -0
  32. package/dist/components/Common/ReorderableList/index.d.ts +1 -0
  33. package/dist/components/Common/SignatureForm/index.d.ts +1 -0
  34. package/dist/components/Common/TaxInputs/index.d.ts +1 -0
  35. package/dist/components/Common/UI/Alert/index.d.ts +1 -0
  36. package/dist/components/Common/UI/Button/index.d.ts +1 -0
  37. package/dist/components/Common/UI/CalendarPreview/index.d.ts +1 -0
  38. package/dist/components/Common/UI/Checkbox/index.d.ts +1 -0
  39. package/dist/components/Common/UI/CheckboxGroup/index.d.ts +1 -0
  40. package/dist/components/Common/UI/ComboBox/ComboBox.js +28 -27
  41. package/dist/components/Common/UI/ComboBox/ComboBox.js.map +1 -1
  42. package/dist/components/Common/UI/ComboBox/ComboBox.module.scss.js +6 -6
  43. package/dist/components/Common/UI/DatePicker/index.d.ts +1 -0
  44. package/dist/components/Common/UI/Heading/index.d.ts +1 -0
  45. package/dist/components/Common/UI/Input/index.d.ts +1 -0
  46. package/dist/components/Common/UI/Link/index.d.ts +1 -0
  47. package/dist/components/Common/UI/List/index.d.ts +1 -0
  48. package/dist/components/Common/UI/Menu/index.d.ts +1 -0
  49. package/dist/components/Common/UI/NumberInput/index.d.ts +1 -0
  50. package/dist/components/Common/UI/ProgressBar/index.d.ts +1 -0
  51. package/dist/components/Common/UI/Radio/index.d.ts +1 -0
  52. package/dist/components/Common/UI/RadioGroup/index.d.ts +1 -0
  53. package/dist/components/Common/UI/Select/index.d.ts +1 -0
  54. package/dist/components/Common/UI/Switch/index.d.ts +1 -0
  55. package/dist/components/Common/UI/Table/index.d.ts +1 -0
  56. package/dist/components/Common/UI/Text/index.d.ts +1 -0
  57. package/dist/components/Common/UI/TextInput/index.d.ts +1 -0
  58. package/dist/components/Common/VisuallyHidden/index.d.ts +1 -0
  59. package/dist/components/Common/index.d.ts +1 -0
  60. package/dist/components/Company/AssignSignatory/AssignSignatory.d.ts +3 -3
  61. package/dist/components/Company/AssignSignatory/AssignSignatory.js +20 -19
  62. package/dist/components/Company/AssignSignatory/AssignSignatory.js.map +1 -1
  63. package/dist/components/Company/AssignSignatory/CreateSignatory/index.d.ts +1 -0
  64. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +4 -3
  65. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
  66. package/dist/components/Company/AssignSignatory/InviteSignatory/index.d.ts +1 -0
  67. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +4 -3
  68. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
  69. package/dist/components/Company/AssignSignatory/index.d.ts +1 -0
  70. package/dist/components/Company/AssignSignatory/useAssignSignatory.js +6 -5
  71. package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
  72. package/dist/components/Company/BankAccount/BankAccount.d.ts +10 -0
  73. package/dist/components/Company/BankAccount/BankAccount.js +32 -0
  74. package/dist/components/Company/BankAccount/BankAccount.js.map +1 -0
  75. package/dist/components/Company/BankAccount/BankAccountForm/context.js +4 -3
  76. package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
  77. package/dist/components/Company/DocumentSigner/DocumentList/Actions.js.map +1 -0
  78. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.d.ts +13 -0
  79. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js +63 -0
  80. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js.map +1 -0
  81. package/dist/components/Company/DocumentSigner/DocumentList/Head.js.map +1 -0
  82. package/dist/components/Company/DocumentSigner/DocumentList/List.js.map +1 -0
  83. package/dist/components/Company/DocumentSigner/DocumentList/ManageSignatories.js.map +1 -0
  84. package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/DocumentList/index.d.ts +1 -0
  85. package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/DocumentList/useDocumentList.js +4 -3
  86. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -0
  87. package/dist/components/Company/DocumentSigner/DocumentSigner.d.ts +12 -0
  88. package/dist/components/Company/DocumentSigner/DocumentSigner.js +41 -0
  89. package/dist/components/Company/DocumentSigner/DocumentSigner.js.map +1 -0
  90. package/dist/components/Company/DocumentSigner/SignatureForm/Actions.js.map +1 -0
  91. package/dist/components/Company/DocumentSigner/SignatureForm/Form.js.map +1 -0
  92. package/dist/components/Company/DocumentSigner/SignatureForm/Head.js.map +1 -0
  93. package/dist/components/Company/DocumentSigner/SignatureForm/Preview.js.map +1 -0
  94. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.d.ts +14 -0
  95. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js +72 -0
  96. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -0
  97. package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/SignatureForm/index.d.ts +1 -0
  98. package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/SignatureForm/useSignatureForm.js +4 -3
  99. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -0
  100. package/dist/components/Company/DocumentSigner/assignSignatoryState.js.map +1 -0
  101. package/dist/components/Company/DocumentSigner/documentSignerStateMachine.js.map +1 -0
  102. package/dist/components/Company/DocumentSigner/index.d.ts +2 -0
  103. package/dist/components/Company/DocumentSigner/stateMachine.js.map +1 -0
  104. package/dist/components/Company/FederalTaxes/FederalTaxes.d.ts +1 -4
  105. package/dist/components/Company/FederalTaxes/FederalTaxes.js +27 -27
  106. package/dist/components/Company/FederalTaxes/FederalTaxes.js.map +1 -1
  107. package/dist/components/Company/FederalTaxes/index.d.ts +1 -0
  108. package/dist/components/Company/FederalTaxes/useFederalTaxes.js +6 -5
  109. package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
  110. package/dist/components/Company/Industry/Context.js +7 -6
  111. package/dist/components/Company/Industry/Context.js.map +1 -1
  112. package/dist/components/Company/Industry/Industry.d.ts +1 -1
  113. package/dist/components/Company/Industry/Industry.js +29 -28
  114. package/dist/components/Company/Industry/Industry.js.map +1 -1
  115. package/dist/components/Company/Industry/index.d.ts +1 -0
  116. package/dist/components/Company/Locations/LocationForm/useLocationForm.js +4 -3
  117. package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
  118. package/dist/components/Company/Locations/Locations.d.ts +9 -0
  119. package/dist/components/Company/Locations/Locations.js +27 -0
  120. package/dist/components/Company/Locations/Locations.js.map +1 -0
  121. package/dist/components/Company/Locations/LocationsList/LocationsList.d.ts +3 -3
  122. package/dist/components/Company/Locations/LocationsList/LocationsList.js +27 -32
  123. package/dist/components/Company/Locations/LocationsList/LocationsList.js.map +1 -1
  124. package/dist/components/Company/Locations/LocationsList/index.d.ts +1 -0
  125. package/dist/components/Company/Locations/LocationsList/useLocationsList.js +4 -3
  126. package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
  127. package/dist/components/Company/OnboardingFlow/OnboardingFlowComponents.d.ts +2 -2
  128. package/dist/components/Company/OnboardingFlow/OnboardingFlowComponents.js +13 -13
  129. package/dist/components/Company/OnboardingFlow/OnboardingFlowComponents.js.map +1 -1
  130. package/dist/components/Company/OnboardingFlow/onboardingStateMachine.js +3 -3
  131. package/dist/components/Company/OnboardingFlow/onboardingStateMachine.js.map +1 -1
  132. package/dist/components/Company/OnboardingOverview/OnboardingOverview.d.ts +1 -1
  133. package/dist/components/Company/OnboardingOverview/OnboardingOverview.js +15 -15
  134. package/dist/components/Company/OnboardingOverview/OnboardingOverview.js.map +1 -1
  135. package/dist/components/Company/OnboardingOverview/context.js +4 -3
  136. package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
  137. package/dist/components/Company/PaySchedule/PaySchedule.d.ts +2 -2
  138. package/dist/components/Company/PaySchedule/PaySchedule.js +63 -62
  139. package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
  140. package/dist/components/Company/PaySchedule/_parts/index.d.ts +1 -0
  141. package/dist/components/Company/PaySchedule/index.d.ts +1 -0
  142. package/dist/components/Company/PaySchedule/usePaySchedule.js +6 -5
  143. package/dist/components/Company/PaySchedule/usePaySchedule.js.map +1 -1
  144. package/dist/components/Company/StateTaxes/StateTaxes.d.ts +9 -0
  145. package/dist/components/Company/StateTaxes/StateTaxes.js +27 -0
  146. package/dist/components/Company/StateTaxes/StateTaxes.js.map +1 -0
  147. package/dist/components/Company/StateTaxes/{StateTaxesFlowComponents.js → StateTaxesComponents.js} +1 -1
  148. package/dist/components/Company/StateTaxes/StateTaxesComponents.js.map +1 -0
  149. package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js +10 -10
  150. package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js.map +1 -1
  151. package/dist/components/Company/StateTaxes/StateTaxesForm/Form.js +1 -1
  152. package/dist/components/Company/StateTaxes/StateTaxesForm/Form.js.map +1 -1
  153. package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js +29 -29
  154. package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js.map +1 -1
  155. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +4 -3
  156. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
  157. package/dist/components/Company/StateTaxes/StateTaxesList/StateTaxesList.d.ts +3 -3
  158. package/dist/components/Company/StateTaxes/StateTaxesList/StateTaxesList.js.map +1 -1
  159. package/dist/components/Company/StateTaxes/StateTaxesList/context.js +4 -3
  160. package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
  161. package/dist/components/Company/StateTaxes/stateTaxesStateMachine.js +1 -1
  162. package/dist/components/Company/StateTaxes/stateTaxesStateMachine.js.map +1 -1
  163. package/dist/components/Company/index.d.ts +7 -6
  164. package/dist/components/Company/index.js +18 -18
  165. package/dist/components/Contractor/Address/Actions.d.ts +1 -0
  166. package/dist/components/Contractor/Address/Actions.js +13 -0
  167. package/dist/components/Contractor/Address/Actions.js.map +1 -0
  168. package/dist/components/Contractor/Address/Address.d.ts +16 -0
  169. package/dist/components/Contractor/Address/Address.js +74 -0
  170. package/dist/components/Contractor/Address/Address.js.map +1 -0
  171. package/dist/components/Contractor/Address/Form.d.ts +1 -0
  172. package/dist/components/Contractor/Address/Form.js +57 -0
  173. package/dist/components/Contractor/Address/Form.js.map +1 -0
  174. package/dist/components/Contractor/Address/Head.d.ts +1 -0
  175. package/dist/components/Contractor/Address/Head.js +15 -0
  176. package/dist/components/Contractor/Address/Head.js.map +1 -0
  177. package/dist/components/Contractor/Address/index.d.ts +2 -0
  178. package/dist/components/Contractor/Address/useAddress.d.ts +33 -0
  179. package/dist/components/Contractor/Address/useAddress.js +28 -0
  180. package/dist/components/Contractor/Address/useAddress.js.map +1 -0
  181. package/dist/components/Contractor/index.d.ts +2 -0
  182. package/dist/components/Contractor/index.js +5 -0
  183. package/dist/components/{Flow → Contractor}/index.js.map +1 -1
  184. package/dist/components/Employee/Compensation/Compensation.d.ts +1 -1
  185. package/dist/components/Employee/Compensation/Compensation.js +45 -44
  186. package/dist/components/Employee/Compensation/Compensation.js.map +1 -1
  187. package/dist/components/Employee/Compensation/Edit.js +17 -16
  188. package/dist/components/Employee/Compensation/Edit.js.map +1 -1
  189. package/dist/components/Employee/Compensation/index.d.ts +1 -0
  190. package/dist/components/Employee/Compensation/useCompensation.d.ts +6 -46
  191. package/dist/components/Employee/Compensation/useCompensation.js +60 -45
  192. package/dist/components/Employee/Compensation/useCompensation.js.map +1 -1
  193. package/dist/components/Employee/Deductions/Deductions.d.ts +2 -2
  194. package/dist/components/Employee/Deductions/Deductions.js +73 -71
  195. package/dist/components/Employee/Deductions/Deductions.js.map +1 -1
  196. package/dist/components/Employee/Deductions/index.d.ts +1 -0
  197. package/dist/components/Employee/Deductions/useDeductions.js +6 -5
  198. package/dist/components/Employee/Deductions/useDeductions.js.map +1 -1
  199. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +4 -3
  200. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  201. package/dist/components/Employee/DocumentSigner/DocumentSigner.d.ts +11 -0
  202. package/dist/components/Employee/DocumentSigner/DocumentSigner.js +27 -0
  203. package/dist/components/Employee/DocumentSigner/DocumentSigner.js.map +1 -0
  204. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +4 -3
  205. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
  206. package/dist/components/Employee/DocumentSigner/index.d.ts +2 -1
  207. package/dist/components/Employee/EmployeeList/EmployeeList.d.ts +1 -1
  208. package/dist/components/Employee/EmployeeList/EmployeeList.js +38 -38
  209. package/dist/components/Employee/EmployeeList/EmployeeList.js.map +1 -1
  210. package/dist/components/Employee/EmployeeList/List.js +9 -9
  211. package/dist/components/Employee/EmployeeList/List.js.map +1 -1
  212. package/dist/components/Employee/EmployeeList/useEmployeeList.d.ts +2 -1
  213. package/dist/components/Employee/EmployeeList/useEmployeeList.js +4 -3
  214. package/dist/components/Employee/EmployeeList/useEmployeeList.js.map +1 -1
  215. package/dist/components/Employee/Landing/Landing.d.ts +1 -1
  216. package/dist/components/Employee/Landing/Landing.js +5 -5
  217. package/dist/components/Employee/Landing/Landing.js.map +1 -1
  218. package/dist/components/Employee/Landing/index.d.ts +1 -0
  219. package/dist/components/Employee/OnboardingFlow/OnboardingFlow.d.ts +27 -0
  220. package/dist/components/Employee/OnboardingFlow/OnboardingFlow.js +29 -0
  221. package/dist/components/Employee/OnboardingFlow/OnboardingFlow.js.map +1 -0
  222. package/dist/components/Employee/OnboardingFlow/onboardingStateMachine.js +107 -0
  223. package/dist/components/Employee/OnboardingFlow/onboardingStateMachine.js.map +1 -0
  224. package/dist/components/Employee/OnboardingSummary/OnboardingSummary.d.ts +1 -1
  225. package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js +30 -30
  226. package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js.map +1 -1
  227. package/dist/components/Employee/OnboardingSummary/index.d.ts +1 -0
  228. package/dist/components/Employee/PaymentMethod/PaymentMethod.d.ts +1 -1
  229. package/dist/components/Employee/PaymentMethod/PaymentMethod.js +68 -68
  230. package/dist/components/Employee/PaymentMethod/PaymentMethod.js.map +1 -1
  231. package/dist/components/Employee/PaymentMethod/index.d.ts +1 -0
  232. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +9 -8
  233. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
  234. package/dist/components/Employee/Profile/AdminPersonalDetails.d.ts +1 -1
  235. package/dist/components/Employee/Profile/PersonalDetailsInputs.d.ts +1 -1
  236. package/dist/components/Employee/Profile/Profile.d.ts +1 -1
  237. package/dist/components/Employee/Profile/Profile.js +117 -112
  238. package/dist/components/Employee/Profile/Profile.js.map +1 -1
  239. package/dist/components/Employee/Profile/SelfPersonalDetails.d.ts +2 -2
  240. package/dist/components/Employee/Profile/index.d.ts +1 -0
  241. package/dist/components/Employee/Profile/useProfile.js +4 -3
  242. package/dist/components/Employee/Profile/useProfile.js.map +1 -1
  243. package/dist/components/Employee/SelfOnboardingFlow/SelfOnboardingComponents.d.ts +17 -0
  244. package/dist/components/{Flow/EmployeeSelfOnboardingFlow/EmployeeSelfOnboardingComponents.js → Employee/SelfOnboardingFlow/SelfOnboardingComponents.js} +7 -7
  245. package/dist/components/Employee/SelfOnboardingFlow/SelfOnboardingComponents.js.map +1 -0
  246. package/dist/components/Employee/SelfOnboardingFlow/SelfOnboardingFlow.d.ts +2 -0
  247. package/dist/components/Employee/SelfOnboardingFlow/SelfOnboardingFlow.js +22 -0
  248. package/dist/components/Employee/SelfOnboardingFlow/SelfOnboardingFlow.js.map +1 -0
  249. package/dist/components/{Flow/StateMachines/employeeSelfOnboarding.js → Employee/SelfOnboardingFlow/selfOnboardingMachine.js} +4 -4
  250. package/dist/components/Employee/SelfOnboardingFlow/selfOnboardingMachine.js.map +1 -0
  251. package/dist/components/Employee/Taxes/StateForm.d.ts +3 -3
  252. package/dist/components/Employee/Taxes/StateForm.js +2 -2
  253. package/dist/components/Employee/Taxes/StateForm.js.map +1 -1
  254. package/dist/components/Employee/Taxes/Taxes.d.ts +1 -1
  255. package/dist/components/Employee/Taxes/Taxes.js +93 -86
  256. package/dist/components/Employee/Taxes/Taxes.js.map +1 -1
  257. package/dist/components/Employee/Taxes/index.d.ts +1 -0
  258. package/dist/components/Employee/Taxes/useTaxes.d.ts +2 -2
  259. package/dist/components/Employee/Taxes/useTaxes.js +4 -3
  260. package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
  261. package/dist/components/Employee/index.d.ts +4 -1
  262. package/dist/components/Employee/index.js +20 -16
  263. package/dist/components/Employee/index.js.map +1 -1
  264. package/dist/components/Flow/useFlow.d.ts +2 -1
  265. package/dist/components/Flow/useFlow.js.map +1 -1
  266. package/dist/components/index.d.ts +2 -1
  267. package/dist/contexts/ApiProvider/ApiProvider.d.ts +1 -1
  268. package/dist/contexts/ApiProvider/ApiProvider.js +17 -17
  269. package/dist/contexts/ApiProvider/ApiProvider.js.map +1 -1
  270. package/dist/contexts/GustoApiProvider/index.d.ts +1 -0
  271. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.d.ts +2 -7
  272. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +16 -14
  273. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
  274. package/dist/contexts/GustoProvider/index.d.ts +2 -1
  275. package/dist/contexts/LocaleProvider/index.d.ts +1 -0
  276. package/dist/contexts/ThemeProvider/index.d.ts +1 -0
  277. package/dist/contexts/index.d.ts +1 -0
  278. package/dist/hooks/useForkRef/index.d.ts +1 -0
  279. package/dist/i18n/I18n.d.ts +2 -0
  280. package/dist/i18n/I18n.js +23 -17
  281. package/dist/i18n/I18n.js.map +1 -1
  282. package/dist/i18n/en/Contractor.Address.json.js +35 -0
  283. package/dist/i18n/en/Contractor.Address.json.js.map +1 -0
  284. package/dist/i18n/index.d.ts +1 -0
  285. package/dist/index.d.ts +1 -2
  286. package/dist/index.js +7 -11
  287. package/dist/index.js.map +1 -1
  288. package/dist/shared/constants.d.ts +7 -1
  289. package/dist/shared/constants.js +52 -46
  290. package/dist/shared/constants.js.map +1 -1
  291. package/dist/style.css +1 -1
  292. package/dist/types/Helpers.d.ts +14 -0
  293. package/dist/types/i18next.d.ts +80 -62
  294. package/package.json +5 -2
  295. package/dist/components/Company/BankAccount/BankAccountFlow.d.ts +0 -5
  296. package/dist/components/Company/BankAccount/BankAccountFlow.js +0 -24
  297. package/dist/components/Company/BankAccount/BankAccountFlow.js.map +0 -1
  298. package/dist/components/Company/DocumentSignerFlow/DocumentList/Actions.js.map +0 -1
  299. package/dist/components/Company/DocumentSignerFlow/DocumentList/DocumentList.d.ts +0 -13
  300. package/dist/components/Company/DocumentSignerFlow/DocumentList/DocumentList.js +0 -69
  301. package/dist/components/Company/DocumentSignerFlow/DocumentList/DocumentList.js.map +0 -1
  302. package/dist/components/Company/DocumentSignerFlow/DocumentList/Head.js.map +0 -1
  303. package/dist/components/Company/DocumentSignerFlow/DocumentList/List.js.map +0 -1
  304. package/dist/components/Company/DocumentSignerFlow/DocumentList/ManageSignatories.js.map +0 -1
  305. package/dist/components/Company/DocumentSignerFlow/DocumentList/useDocumentList.js.map +0 -1
  306. package/dist/components/Company/DocumentSignerFlow/DocumentSignerFlow.d.ts +0 -6
  307. package/dist/components/Company/DocumentSignerFlow/DocumentSignerFlow.js +0 -35
  308. package/dist/components/Company/DocumentSignerFlow/DocumentSignerFlow.js.map +0 -1
  309. package/dist/components/Company/DocumentSignerFlow/SignatureForm/Actions.js.map +0 -1
  310. package/dist/components/Company/DocumentSignerFlow/SignatureForm/Form.js.map +0 -1
  311. package/dist/components/Company/DocumentSignerFlow/SignatureForm/Head.js.map +0 -1
  312. package/dist/components/Company/DocumentSignerFlow/SignatureForm/Preview.js.map +0 -1
  313. package/dist/components/Company/DocumentSignerFlow/SignatureForm/SignatureForm.d.ts +0 -17
  314. package/dist/components/Company/DocumentSignerFlow/SignatureForm/SignatureForm.js +0 -78
  315. package/dist/components/Company/DocumentSignerFlow/SignatureForm/SignatureForm.js.map +0 -1
  316. package/dist/components/Company/DocumentSignerFlow/SignatureForm/useSignatureForm.js.map +0 -1
  317. package/dist/components/Company/DocumentSignerFlow/assignSignatoryState.js.map +0 -1
  318. package/dist/components/Company/DocumentSignerFlow/documentSignerStateMachine.js.map +0 -1
  319. package/dist/components/Company/DocumentSignerFlow/index.d.ts +0 -1
  320. package/dist/components/Company/DocumentSignerFlow/stateMachine.js.map +0 -1
  321. package/dist/components/Company/Locations/LocationsFlow.d.ts +0 -5
  322. package/dist/components/Company/Locations/LocationsFlow.js +0 -21
  323. package/dist/components/Company/Locations/LocationsFlow.js.map +0 -1
  324. package/dist/components/Company/StateTaxes/StateTaxesFlow.d.ts +0 -5
  325. package/dist/components/Company/StateTaxes/StateTaxesFlow.js +0 -21
  326. package/dist/components/Company/StateTaxes/StateTaxesFlow.js.map +0 -1
  327. package/dist/components/Company/StateTaxes/StateTaxesFlowComponents.js.map +0 -1
  328. package/dist/components/Employee/DocumentSigner/DocumentSignerFlow.d.ts +0 -5
  329. package/dist/components/Employee/DocumentSigner/DocumentSignerFlow.js +0 -21
  330. package/dist/components/Employee/DocumentSigner/DocumentSignerFlow.js.map +0 -1
  331. package/dist/components/Flow/EmployeeOnboardingFlow.d.ts +0 -27
  332. package/dist/components/Flow/EmployeeOnboardingFlow.js +0 -29
  333. package/dist/components/Flow/EmployeeOnboardingFlow.js.map +0 -1
  334. package/dist/components/Flow/EmployeeSelfOnboardingFlow/EmployeeSelfOnboardingComponents.d.ts +0 -5
  335. package/dist/components/Flow/EmployeeSelfOnboardingFlow/EmployeeSelfOnboardingComponents.js.map +0 -1
  336. package/dist/components/Flow/EmployeeSelfOnboardingFlow/EmployeeSelfOnboardingFlow.d.ts +0 -13
  337. package/dist/components/Flow/EmployeeSelfOnboardingFlow/EmployeeSelfOnboardingFlow.js +0 -26
  338. package/dist/components/Flow/EmployeeSelfOnboardingFlow/EmployeeSelfOnboardingFlow.js.map +0 -1
  339. package/dist/components/Flow/StateMachines/employeeOnboarding.js +0 -136
  340. package/dist/components/Flow/StateMachines/employeeOnboarding.js.map +0 -1
  341. package/dist/components/Flow/StateMachines/employeeSelfOnboarding.js.map +0 -1
  342. package/dist/components/Flow/StateMachines/index.d.ts +0 -2
  343. package/dist/components/Flow/index.d.ts +0 -2
  344. package/dist/components/Flow/index.js +0 -7
  345. /package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/DocumentList/Actions.d.ts +0 -0
  346. /package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/DocumentList/Actions.js +0 -0
  347. /package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/DocumentList/Head.d.ts +0 -0
  348. /package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/DocumentList/Head.js +0 -0
  349. /package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/DocumentList/List.d.ts +0 -0
  350. /package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/DocumentList/List.js +0 -0
  351. /package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/DocumentList/ManageSignatories.d.ts +0 -0
  352. /package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/DocumentList/ManageSignatories.js +0 -0
  353. /package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/DocumentList/ManageSignatories.module.scss.js +0 -0
  354. /package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/DocumentList/ManageSignatories.module.scss.js.map +0 -0
  355. /package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/DocumentList/useDocumentList.d.ts +0 -0
  356. /package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/SignatureForm/Actions.d.ts +0 -0
  357. /package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/SignatureForm/Actions.js +0 -0
  358. /package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/SignatureForm/Form.d.ts +0 -0
  359. /package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/SignatureForm/Form.js +0 -0
  360. /package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/SignatureForm/Head.d.ts +0 -0
  361. /package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/SignatureForm/Head.js +0 -0
  362. /package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/SignatureForm/Preview.d.ts +0 -0
  363. /package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/SignatureForm/Preview.js +0 -0
  364. /package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/SignatureForm/useSignatureForm.d.ts +0 -0
  365. /package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/assignSignatoryState.d.ts +0 -0
  366. /package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/assignSignatoryState.js +0 -0
  367. /package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/documentSignerStateMachine.d.ts +0 -0
  368. /package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/documentSignerStateMachine.js +0 -0
  369. /package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/stateMachine.d.ts +0 -0
  370. /package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/stateMachine.js +0 -0
  371. /package/dist/components/Company/{DocumentSignerFlow/useDocumentSignerFlow.d.ts → DocumentSigner/useDocumentSigner.d.ts} +0 -0
  372. /package/dist/components/Company/StateTaxes/{StateTaxesFlowComponents.d.ts → StateTaxesComponents.d.ts} +0 -0
  373. /package/dist/components/{Flow/StateMachines/employeeOnboarding.d.ts → Employee/OnboardingFlow/onboardingStateMachine.d.ts} +0 -0
  374. /package/dist/components/{Flow/StateMachines/employeeSelfOnboarding.d.ts → Employee/SelfOnboardingFlow/selfOnboardingMachine.d.ts} +0 -0
@@ -1,39 +1,40 @@
1
1
  import { jsx as t, jsxs as k } from "react/jsx-runtime";
2
2
  import { useForm as z, FormProvider as Q } from "react-hook-form";
3
3
  import { zodResolver as J } from "@hookform/resolvers/zod";
4
- import { useState as v, useEffect as p } from "react";
4
+ import { useState as p, useEffect as w } from "react";
5
5
  import { usePaySchedulesGetPreview as K } from "@gusto/embedded-api/react-query/paySchedulesGetPreview";
6
6
  import { usePaySchedulesUpdateMutation as W } from "@gusto/embedded-api/react-query/paySchedulesUpdate";
7
7
  import { usePaySchedulesGetAllSuspense as X, invalidateAllPaySchedulesGetAll as Z } from "@gusto/embedded-api/react-query/paySchedulesGetAll";
8
8
  import { usePaySchedulesCreateMutation as $ } from "@gusto/embedded-api/react-query/paySchedulesCreate";
9
9
  import { useQueryClient as V } from "@tanstack/react-query";
10
10
  import { PayScheduleSchema as ee, PayScheduleProvider as oe } from "./usePaySchedule.js";
11
- import { Form as re } from "../../Common/Form/Form.js";
12
- import { BaseComponent as ae } from "../../Base/Base.js";
11
+ import { Form as ae } from "../../Common/Form/Form.js";
12
+ import { BaseComponent as re } from "../../Base/Base.js";
13
13
  import { useBase as te } from "../../Base/useBase.js";
14
14
  import { Flex as ne } from "../../Common/Flex/Flex.js";
15
- import { useI18n as ce } from "../../../i18n/I18n.js";
16
- import { componentEvents as w } from "../../../shared/constants.js";
17
- import { formatDateToStringDate as ie } from "../../../helpers/dateFormatting.js";
18
- import { Head as q } from "./_parts/Head.js";
15
+ import { useI18n as ce, useComponentDictionary as ie } from "../../../i18n/I18n.js";
16
+ import { componentEvents as A } from "../../../shared/constants.js";
17
+ import { formatDateToStringDate as de } from "../../../helpers/dateFormatting.js";
18
+ import { Head as C } from "./_parts/Head.js";
19
19
  import { List as _ } from "./_parts/List.js";
20
- import { Edit as C } from "./_parts/Edit.js";
21
- import { Actions as L } from "./_parts/Actions.js";
22
- const h = ({
20
+ import { Edit as L } from "./_parts/Edit.js";
21
+ import { Actions as O } from "./_parts/Actions.js";
22
+ const f = ({
23
23
  companyId: n,
24
24
  defaultValues: P,
25
- ...a
26
- }) => (ce("Company.PaySchedule"), /* @__PURE__ */ t(ae, { ...a, children: /* @__PURE__ */ t(de, { companyId: n, defaultValues: P, children: a.children }) })), de = ({ companyId: n, children: P, defaultValues: a }) => {
27
- const O = V(), { baseSubmitHandler: T, onEvent: f, fieldErrors: E } = te(), [D, m] = v("LIST_PAY_SCHEDULES"), [i, H] = v(null), M = {
28
- frequency: a?.frequency ?? "Every week",
29
- anchorPayDate: a?.anchorPayDate ? new Date(a.anchorPayDate) : void 0,
30
- anchorEndOfPayPeriod: a?.anchorEndOfPayPeriod ? new Date(a.anchorEndOfPayPeriod) : void 0,
31
- day1: a?.day1 ?? void 0,
32
- day2: a?.day2 ?? void 0,
33
- customName: a?.customName ?? "",
25
+ dictionary: r,
26
+ ...m
27
+ }) => (ce("Company.PaySchedule"), ie("Company.PaySchedule", r), /* @__PURE__ */ t(re, { ...m, children: /* @__PURE__ */ t(ye, { companyId: n, defaultValues: P, children: m.children }) })), ye = ({ companyId: n, children: P, defaultValues: r }) => {
28
+ const m = V(), { baseSubmitHandler: T, onEvent: E, fieldErrors: D } = te(), [S, u] = p("LIST_PAY_SCHEDULES"), [i, H] = p(null), M = {
29
+ frequency: r?.frequency ?? "Every week",
30
+ anchorPayDate: r?.anchorPayDate ? new Date(r.anchorPayDate) : void 0,
31
+ anchorEndOfPayPeriod: r?.anchorEndOfPayPeriod ? new Date(r.anchorEndOfPayPeriod) : void 0,
32
+ day1: r?.day1 ?? void 0,
33
+ day2: r?.day2 ?? void 0,
34
+ customName: r?.customName ?? "",
34
35
  customTwicePerMonth: "false",
35
36
  payPeriodPreviewRange: 0
36
- }, [d, y] = v(null), { data: U, isLoading: Y } = K(
37
+ }, [d, y] = p(null), { data: U, isLoading: Y } = K(
37
38
  {
38
39
  companyId: n,
39
40
  frequency: d?.frequency,
@@ -48,19 +49,19 @@ const h = ({
48
49
  // Casting to non-null because we know it's not null from the enabled prop
49
50
  ), { data: N } = X({
50
51
  companyId: n
51
- }), g = $(), b = W(), S = z({
52
+ }), g = $(), b = W(), l = z({
52
53
  resolver: J(ee),
53
54
  defaultValues: M
54
- }), { watch: R, setValue: l, reset: s, setError: A } = S;
55
- p(() => {
56
- E && E.forEach((o) => {
57
- A(o.key, { message: o.message });
55
+ }), { watch: R, setValue: v, reset: s, setError: q } = l;
56
+ w(() => {
57
+ D && D.forEach((o) => {
58
+ q(o.key, { message: o.message });
58
59
  });
59
- }, [A, E]);
60
+ }, [q, D]);
60
61
  const e = R();
61
- p(() => {
62
- e.frequency === "Twice per month" && e.day1 === 15 && e.day2 === 31 && e.customTwicePerMonth === void 0 ? l("customTwicePerMonth", "1st15th") : e.frequency === "Twice per month" && e.customTwicePerMonth === void 0 && l("customTwicePerMonth", "custom");
63
- }, [e.frequency, e.day1, e.day2, l, e.customTwicePerMonth]), p(() => {
62
+ w(() => {
63
+ e.frequency === "Twice per month" && e.day1 === 15 && e.day2 === 31 && e.customTwicePerMonth === void 0 ? v("customTwicePerMonth", "1st15th") : e.frequency === "Twice per month" && e.customTwicePerMonth === void 0 && v("customTwicePerMonth", "custom");
64
+ }, [e.frequency, e.day1, e.day2, v, e.customTwicePerMonth]), w(() => {
64
65
  !e.anchorPayDate || !e.anchorEndOfPayPeriod || y({
65
66
  frequency: e.frequency,
66
67
  anchorPayDate: e.anchorPayDate.toString(),
@@ -81,9 +82,9 @@ const h = ({
81
82
  y
82
83
  ]);
83
84
  const x = () => {
84
- m("ADD_PAY_SCHEDULE"), s({});
85
+ u("ADD_PAY_SCHEDULE"), s({});
85
86
  }, B = () => {
86
- m("LIST_PAY_SCHEDULES"), s({}), y(null);
87
+ u("LIST_PAY_SCHEDULES"), s({}), y(null);
87
88
  }, F = (o) => {
88
89
  s({
89
90
  frequency: o.frequency,
@@ -92,46 +93,46 @@ const h = ({
92
93
  day1: o.day1 ?? void 0,
93
94
  day2: o.day2 ?? void 0,
94
95
  customName: o.customName ?? ""
95
- }), H(o), m("EDIT_PAY_SCHEDULE");
96
+ }), H(o), u("EDIT_PAY_SCHEDULE");
96
97
  }, j = () => {
97
- f(w.PAY_SCHEDULE_DONE);
98
+ E(A.PAY_SCHEDULE_DONE);
98
99
  }, G = async (o) => {
99
- await T(o, async (r) => {
100
- const u = (c) => c && ie(c) || "";
101
- if (D === "ADD_PAY_SCHEDULE") {
100
+ await T(o, async (a) => {
101
+ const h = (c) => c && de(c) || "";
102
+ if (S === "ADD_PAY_SCHEDULE") {
102
103
  const c = await g.mutateAsync({
103
104
  request: {
104
105
  companyId: n,
105
106
  requestBody: {
106
- frequency: r.frequency,
107
- anchorPayDate: u(r.anchorPayDate),
108
- anchorEndOfPayPeriod: u(r.anchorEndOfPayPeriod),
109
- customName: r.customName,
110
- day1: r.day1,
111
- day2: r.day2
107
+ frequency: a.frequency,
108
+ anchorPayDate: h(a.anchorPayDate),
109
+ anchorEndOfPayPeriod: h(a.anchorEndOfPayPeriod),
110
+ customName: a.customName,
111
+ day1: a.day1,
112
+ day2: a.day2
112
113
  }
113
114
  }
114
115
  });
115
- f(w.PAY_SCHEDULE_CREATED, c), s(), y(null);
116
- } else if (D === "EDIT_PAY_SCHEDULE") {
116
+ E(A.PAY_SCHEDULE_CREATED, c), s(), y(null);
117
+ } else if (S === "EDIT_PAY_SCHEDULE") {
117
118
  const c = i?.version, I = await b.mutateAsync({
118
119
  request: {
119
120
  payScheduleId: i?.uuid,
120
121
  companyId: n,
121
122
  requestBody: {
122
- frequency: r.frequency,
123
- anchorPayDate: u(r.anchorPayDate),
124
- anchorEndOfPayPeriod: u(r.anchorEndOfPayPeriod),
125
- customName: r.customName,
126
- day1: r.day1,
127
- day2: r.day2,
123
+ frequency: a.frequency,
124
+ anchorPayDate: h(a.anchorPayDate),
125
+ anchorEndOfPayPeriod: h(a.anchorEndOfPayPeriod),
126
+ customName: a.customName,
127
+ day1: a.day1,
128
+ day2: a.day2,
128
129
  version: c
129
130
  }
130
131
  }
131
132
  });
132
- f(w.PAY_SCHEDULE_UPDATED, I), s(), y(null);
133
+ E(A.PAY_SCHEDULE_UPDATED, I), s(), y(null);
133
134
  }
134
- await Z(O), m("LIST_PAY_SCHEDULES");
135
+ await Z(m), u("LIST_PAY_SCHEDULES");
135
136
  });
136
137
  };
137
138
  return /* @__PURE__ */ t(
@@ -143,26 +144,26 @@ const h = ({
143
144
  handleEdit: F,
144
145
  handleCancel: B,
145
146
  handleContinue: j,
146
- mode: D,
147
+ mode: S,
147
148
  paySchedules: N.payScheduleList,
148
149
  payPeriodPreview: U?.object?.payPeriods,
149
150
  payPreviewLoading: Y,
150
151
  currentPaySchedule: i
151
152
  },
152
- children: /* @__PURE__ */ t("span", { "data-testid": "pay-schedule-edit-form", children: /* @__PURE__ */ t(Q, { ...S, children: /* @__PURE__ */ t(re, { onSubmit: S.handleSubmit(G), children: P || /* @__PURE__ */ k(ne, { flexDirection: "column", children: [
153
- /* @__PURE__ */ t(q, {}),
154
- /* @__PURE__ */ t(_, {}),
153
+ children: /* @__PURE__ */ t("span", { "data-testid": "pay-schedule-edit-form", children: /* @__PURE__ */ t(Q, { ...l, children: /* @__PURE__ */ t(ae, { onSubmit: l.handleSubmit(G), children: P || /* @__PURE__ */ k(ne, { flexDirection: "column", children: [
155
154
  /* @__PURE__ */ t(C, {}),
156
- /* @__PURE__ */ t(L, {})
155
+ /* @__PURE__ */ t(_, {}),
156
+ /* @__PURE__ */ t(L, {}),
157
+ /* @__PURE__ */ t(O, {})
157
158
  ] }) }) }) })
158
159
  }
159
160
  );
160
161
  };
161
- h.Head = q;
162
- h.List = _;
163
- h.Edit = C;
164
- h.Actions = L;
162
+ f.Head = C;
163
+ f.List = _;
164
+ f.Edit = L;
165
+ f.Actions = O;
165
166
  export {
166
- h as PaySchedule
167
+ f as PaySchedule
167
168
  };
168
169
  //# sourceMappingURL=PaySchedule.js.map
@@ -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 {\n usePaySchedulesGetAllSuspense,\n invalidateAllPaySchedulesGetAll,\n} 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 { useQueryClient } from '@tanstack/react-query'\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'\n\ninterface PayScheduleProps extends CommonComponentInterface {\n companyId: string\n defaultValues?: PayScheduleDefaultValues\n}\n\nexport const PaySchedule = ({\n companyId,\n defaultValues,\n ...props\n}: PayScheduleProps & BaseComponentInterface) => {\n useI18n('Company.PaySchedule')\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 queryClient = useQueryClient()\n const { baseSubmitHandler, onEvent, fieldErrors } = 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 [payScheduleDraft, setPayScheduleDraft] = useState<PayScheduleType | null>(null)\n const { data: payPreviewData, isLoading } = usePaySchedulesGetPreview(\n {\n companyId,\n frequency: payScheduleDraft?.frequency as Frequency,\n anchorPayDate: payScheduleDraft?.anchorPayDate ?? '',\n anchorEndOfPayPeriod: payScheduleDraft?.anchorEndOfPayPeriod ?? '',\n day1: payScheduleDraft?.day1 ?? undefined,\n day2: payScheduleDraft?.day2 ?? undefined,\n },\n {\n enabled: true,\n }, // Casting to non-null because we know it's not null from the enabled prop\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, 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 // 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 useEffect(() => {\n // Don't update if dates are not set\n if (!allValues.anchorPayDate || !allValues.anchorEndOfPayPeriod) {\n return\n }\n\n setPayScheduleDraft({\n frequency: allValues.frequency,\n anchorPayDate: allValues.anchorPayDate.toString(),\n anchorEndOfPayPeriod: allValues.anchorEndOfPayPeriod.toString(),\n day1: allValues.day1 || undefined,\n day2: allValues.day2 || undefined,\n uuid: '',\n version: currentPaySchedule?.version || '', //TODO: This needs to be set to something\n })\n }, [\n allValues.anchorEndOfPayPeriod,\n allValues.anchorPayDate,\n allValues.day1,\n allValues.day2,\n allValues.frequency,\n currentPaySchedule?.version,\n setPayScheduleDraft,\n ])\n\n // Custom effect to show/hide pay schedule preview errors\n\n const handleAdd = () => {\n setMode('ADD_PAY_SCHEDULE')\n reset({})\n }\n const handleCancel = () => {\n setMode('LIST_PAY_SCHEDULES')\n reset({})\n setPayScheduleDraft(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: 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 setPayScheduleDraft(null)\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: 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 setPayScheduleDraft(null)\n }\n await invalidateAllPaySchedulesGetAll(queryClient)\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","props","useI18n","jsx","BaseComponent","Root","children","queryClient","useQueryClient","baseSubmitHandler","onEvent","fieldErrors","useBase","mode","setMode","useState","currentPaySchedule","setCurrentPaySchedule","transformedDefaultValues","payScheduleDraft","setPayScheduleDraft","payPreviewData","isLoading","usePaySchedulesGetPreview","paySchedules","usePaySchedulesGetAllSuspense","createPayScheduleMutation","usePaySchedulesCreateMutation","updatePayScheduleMutation","usePaySchedulesUpdateMutation","formMethods","useForm","zodResolver","PayScheduleSchema","watch","setValue","reset","setError","useEffect","error","allValues","handleAdd","handleCancel","handleEdit","schedule","handleContinue","componentEvents","onSubmit","data","payload","formatPayloadDate","date","formatDateToStringDate","createPayScheduleResponse","version","updatePayScheduleResponse","invalidateAllPaySchedulesGetAll","PayScheduleProvider","FormProvider","Form","jsxs","Flex","Head","List","Edit","Actions"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAkCO,MAAMA,IAAc,CAAC;AAAA,EAC1B,WAAAC;AAAA,EACA,eAAAC;AAAA,EACA,GAAGC;AACL,OACEC,GAAQ,qBAAqB,GAE3B,gBAAAC,EAACC,IAAe,EAAA,GAAGH,GACjB,UAAA,gBAAAE,EAACE,MAAK,WAAAN,GAAsB,eAAAC,GACzB,UAAMC,EAAA,SAAA,CACT,EACF,CAAA,IAIEI,KAAO,CAAC,EAAE,WAAAN,GAAW,UAAAO,GAAU,eAAAN,QAAsC;AACzE,QAAMO,IAAcC,EAAe,GAC7B,EAAE,mBAAAC,GAAmB,SAAAC,GAAS,aAAAC,EAAA,IAAgBC,GAAQ,GACtD,CAACC,GAAMC,CAAO,IAAIC,EAAe,oBAAoB,GACrD,CAACC,GAAoBC,CAAqB,IAAIF,EAAiC,IAAI,GACnFG,IAA8C;AAAA,IAClD,WAAWlB,GAAe,aAAa;AAAA,IACvC,eAAeA,GAAe,gBAAgB,IAAI,KAAKA,EAAc,aAAa,IAAI;AAAA,IACtF,sBAAsBA,GAAe,uBACjC,IAAI,KAAKA,EAAc,oBAAoB,IAC3C;AAAA,IAC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AAAA,IAAA;AAAA,MACC,OAAO;AAAA,QACL,WAAA1D;AAAA,QACA,WAAA0C;AAAA,QACA,YAAAE;AAAA,QACA,cAAAD;AAAA,QACA,gBAAAG;AAAA,QACA,MAAAhC;AAAA,QACA,cAAcW,EAAa;AAAA,QAC3B,kBAAkBH,GAAgB,QAAQ;AAAA,QAC1C,mBAAmBC;AAAA,QACnB,oBAAAN;AAAA,MACF;AAAA,MAEA,UAAA,gBAAAb,EAAC,UAAK,eAAY,0BAChB,4BAACuD,GAAc,EAAA,GAAG5B,GAChB,UAAC,gBAAA3B,EAAAwD,IAAA,EAAK,UAAU7B,EAAY,aAAaiB,CAAQ,GAC9C,UAAAzC,KAGE,gBAAAsD,EAAAC,IAAA,EAAK,eAAc,UAClB,UAAA;AAAA,QAAA,gBAAA1D,EAAC2D,GAAK,EAAA;AAAA,0BACLC,GAAK,EAAA;AAAA,0BACLC,GAAK,EAAA;AAAA,0BACLC,GAAQ,CAAA,CAAA;AAAA,MAAA,GACX,EAAA,CAEJ,GACF,EACF,CAAA;AAAA,IAAA;AAAA,EACF;AAEJ;AAEAnE,EAAY,OAAOgE;AACnBhE,EAAY,OAAOiE;AACnBjE,EAAY,OAAOkE;AACnBlE,EAAY,UAAUmE;"}
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 {\n usePaySchedulesGetAllSuspense,\n invalidateAllPaySchedulesGetAll,\n} 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 { useQueryClient } from '@tanstack/react-query'\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 queryClient = useQueryClient()\n const { baseSubmitHandler, onEvent, fieldErrors } = 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 [payScheduleDraft, setPayScheduleDraft] = useState<PayScheduleType | null>(null)\n const { data: payPreviewData, isLoading } = usePaySchedulesGetPreview(\n {\n companyId,\n frequency: payScheduleDraft?.frequency as Frequency,\n anchorPayDate: payScheduleDraft?.anchorPayDate ?? '',\n anchorEndOfPayPeriod: payScheduleDraft?.anchorEndOfPayPeriod ?? '',\n day1: payScheduleDraft?.day1 ?? undefined,\n day2: payScheduleDraft?.day2 ?? undefined,\n },\n {\n enabled: true,\n }, // Casting to non-null because we know it's not null from the enabled prop\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, 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 // 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 useEffect(() => {\n // Don't update if dates are not set\n if (!allValues.anchorPayDate || !allValues.anchorEndOfPayPeriod) {\n return\n }\n\n setPayScheduleDraft({\n frequency: allValues.frequency,\n anchorPayDate: allValues.anchorPayDate.toString(),\n anchorEndOfPayPeriod: allValues.anchorEndOfPayPeriod.toString(),\n day1: allValues.day1 || undefined,\n day2: allValues.day2 || undefined,\n uuid: '',\n version: currentPaySchedule?.version || '', //TODO: This needs to be set to something\n })\n }, [\n allValues.anchorEndOfPayPeriod,\n allValues.anchorPayDate,\n allValues.day1,\n allValues.day2,\n allValues.frequency,\n currentPaySchedule?.version,\n setPayScheduleDraft,\n ])\n\n // Custom effect to show/hide pay schedule preview errors\n\n const handleAdd = () => {\n setMode('ADD_PAY_SCHEDULE')\n reset({})\n }\n const handleCancel = () => {\n setMode('LIST_PAY_SCHEDULES')\n reset({})\n setPayScheduleDraft(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: 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 setPayScheduleDraft(null)\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: 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 setPayScheduleDraft(null)\n }\n await invalidateAllPaySchedulesGetAll(queryClient)\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","queryClient","useQueryClient","baseSubmitHandler","onEvent","fieldErrors","useBase","mode","setMode","useState","currentPaySchedule","setCurrentPaySchedule","transformedDefaultValues","payScheduleDraft","setPayScheduleDraft","payPreviewData","isLoading","usePaySchedulesGetPreview","paySchedules","usePaySchedulesGetAllSuspense","createPayScheduleMutation","usePaySchedulesCreateMutation","updatePayScheduleMutation","usePaySchedulesUpdateMutation","formMethods","useForm","zodResolver","PayScheduleSchema","watch","setValue","reset","setError","useEffect","error","allValues","handleAdd","handleCancel","handleEdit","schedule","handleContinue","componentEvents","onSubmit","data","payload","formatPayloadDate","date","formatDateToStringDate","createPayScheduleResponse","version","updatePayScheduleResponse","invalidateAllPaySchedulesGetAll","PayScheduleProvider","FormProvider","Form","jsxs","Flex","Head","List","Edit","Actions"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAmCO,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,QAAMS,IAAcC,EAAe,GAC7B,EAAE,mBAAAC,GAAmB,SAAAC,GAAS,aAAAC,EAAA,IAAgBC,GAAQ,GACtD,CAACC,GAAMC,CAAO,IAAIC,EAAe,oBAAoB,GACrD,CAACC,GAAoBC,CAAqB,IAAIF,EAAiC,IAAI,GACnFG,IAA8C;AAAA,IAClD,WAAWpB,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,uBAAu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QACA,MAAAhC;AAAA,QACA,cAAcW,EAAa;AAAA,QAC3B,kBAAkBH,GAAgB,QAAQ;AAAA,QAC1C,mBAAmBC;AAAA,QACnB,oBAAAN;AAAA,MACF;AAAA,MAEA,UAAA,gBAAAb,EAAC,UAAK,eAAY,0BAChB,4BAACuD,GAAc,EAAA,GAAG5B,GAChB,UAAC,gBAAA3B,EAAAwD,IAAA,EAAK,UAAU7B,EAAY,aAAaiB,CAAQ,GAC9C,UAAAzC,KAGE,gBAAAsD,EAAAC,IAAA,EAAK,eAAc,UAClB,UAAA;AAAA,QAAA,gBAAA1D,EAAC2D,GAAK,EAAA;AAAA,0BACLC,GAAK,EAAA;AAAA,0BACLC,GAAK,EAAA;AAAA,0BACLC,GAAQ,CAAA,CAAA;AAAA,MAAA,GACX,EAAA,CAEJ,GACF,EACF,CAAA;AAAA,IAAA;AAAA,EACF;AAEJ;AAEArE,EAAY,OAAOkE;AACnBlE,EAAY,OAAOmE;AACnBnE,EAAY,OAAOoE;AACnBpE,EAAY,UAAUqE;"}
@@ -1,3 +1,4 @@
1
+ import "./types/i18next.d.ts"
1
2
  export * from './List';
2
3
  export * from './Edit';
3
4
  export * from './Head';
@@ -1 +1,2 @@
1
+ import "./types/i18next.d.ts"
1
2
  export * from './PaySchedule';
@@ -7,10 +7,11 @@ import "@gusto/embedded-api/models/errors/apierror";
7
7
  import "@gusto/embedded-api/models/errors/sdkvalidationerror";
8
8
  import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
9
9
  import "../../Base/useBase.js";
10
+ import "../../../shared/constants.js";
10
11
  import "dompurify";
11
12
  import "../../../contexts/ComponentAdapter/useComponentContext.js";
12
13
  import { createCompoundContext as e } from "../../Base/createCompoundContext.js";
13
- const h = o.object({
14
+ const P = o.object({
14
15
  frequency: o.enum(["Every week", "Every other week", "Twice per month", "Monthly"]),
15
16
  anchorPayDate: o.date().optional(),
16
17
  anchorEndOfPayPeriod: o.date().optional(),
@@ -19,10 +20,10 @@ const h = o.object({
19
20
  customName: o.string().optional(),
20
21
  customTwicePerMonth: o.string().optional(),
21
22
  payPeriodPreviewRange: o.number().optional()
22
- }), [P, s] = e("PayScheduleContext");
23
+ }), [s, w] = e("PayScheduleContext");
23
24
  export {
24
- s as PayScheduleProvider,
25
- h as PayScheduleSchema,
26
- P as usePaySchedule
25
+ w as PayScheduleProvider,
26
+ P as PayScheduleSchema,
27
+ s as usePaySchedule
27
28
  };
28
29
  //# sourceMappingURL=usePaySchedule.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"usePaySchedule.js","sources":["../../../../src/components/Company/PaySchedule/usePaySchedule.ts"],"sourcesContent":["import type { PayScheduleCreateUpdate } from '@gusto/embedded-api/models/components/payschedulecreateupdate'\nimport type { PayScheduleList } from '@gusto/embedded-api/models/components/payschedulelist'\nimport type { PayScheduleObject as PayScheduleType } from '@gusto/embedded-api/models/components/payscheduleobject'\nimport type { PayPeriods } from '@gusto/embedded-api/models/operations/getv1companiescompanyidpayschedulespreview'\nimport { z } from 'zod'\nimport type { RequireAtLeastOne } from '@/types/Helpers'\nimport { createCompoundContext } from '@/components/Base'\n\nexport type MODE =\n | 'LIST_PAY_SCHEDULES'\n | 'ADD_PAY_SCHEDULE'\n | 'EDIT_PAY_SCHEDULE'\n | 'PREVIEW_PAY_SCHEDULE'\n\ntype PayScheduleContextType = {\n companyId: string\n handleAdd: () => void\n handleEdit: (schedule: PayScheduleType) => void\n handleCancel: () => void\n handleContinue: () => void\n mode: MODE\n paySchedules: PayScheduleList[] | undefined | null\n currentPaySchedule: PayScheduleType | undefined | null\n payPeriodPreview?: PayPeriods[]\n payPreviewLoading?: boolean\n}\n\nexport const PayScheduleSchema = z.object({\n frequency: z.enum(['Every week', 'Every other week', 'Twice per month', 'Monthly']),\n anchorPayDate: z.date().optional(),\n anchorEndOfPayPeriod: z.date().optional(),\n day1: z.number().min(1).max(31).optional(),\n day2: z.number().min(1).max(31).optional(),\n customName: z.string().optional(),\n customTwicePerMonth: z.string().optional(),\n payPeriodPreviewRange: z.number().optional(),\n})\n\nexport type PayScheduleInputs = z.input<typeof PayScheduleSchema>\nexport type PayScheduleOutputs = z.output<typeof PayScheduleSchema>\n\nexport type PayScheduleDefaultValues = RequireAtLeastOne<\n Partial<\n Pick<\n PayScheduleCreateUpdate,\n 'anchorPayDate' | 'anchorEndOfPayPeriod' | 'day1' | 'day2' | 'customName' | 'frequency'\n >\n >\n>\n\nconst [usePaySchedule, PayScheduleProvider] =\n createCompoundContext<PayScheduleContextType>('PayScheduleContext')\nexport { usePaySchedule, PayScheduleProvider }\n"],"names":["PayScheduleSchema","z","usePaySchedule","PayScheduleProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;AA2Ba,MAAAA,IAAoBC,EAAE,OAAO;AAAA,EACxC,WAAWA,EAAE,KAAK,CAAC,cAAc,oBAAoB,mBAAmB,SAAS,CAAC;AAAA,EAClF,eAAeA,EAAE,KAAK,EAAE,SAAS;AAAA,EACjC,sBAAsBA,EAAE,KAAK,EAAE,SAAS;AAAA,EACxC,MAAMA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,SAAS;AAAA,EACzC,MAAMA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,SAAS;AAAA,EACzC,YAAYA,EAAE,OAAO,EAAE,SAAS;AAAA,EAChC,qBAAqBA,EAAE,OAAO,EAAE,SAAS;AAAA,EACzC,uBAAuBA,EAAE,OAAO,EAAE,SAAS;AAC7C,CAAC,GAcK,CAACC,GAAgBC,CAAmB,IACxCC,EAA8C,oBAAoB;"}
1
+ {"version":3,"file":"usePaySchedule.js","sources":["../../../../src/components/Company/PaySchedule/usePaySchedule.ts"],"sourcesContent":["import type { PayScheduleCreateUpdate } from '@gusto/embedded-api/models/components/payschedulecreateupdate'\nimport type { PayScheduleList } from '@gusto/embedded-api/models/components/payschedulelist'\nimport type { PayScheduleObject as PayScheduleType } from '@gusto/embedded-api/models/components/payscheduleobject'\nimport type { PayPeriods } from '@gusto/embedded-api/models/operations/getv1companiescompanyidpayschedulespreview'\nimport { z } from 'zod'\nimport type { RequireAtLeastOne } from '@/types/Helpers'\nimport { createCompoundContext } from '@/components/Base'\n\nexport type MODE =\n | 'LIST_PAY_SCHEDULES'\n | 'ADD_PAY_SCHEDULE'\n | 'EDIT_PAY_SCHEDULE'\n | 'PREVIEW_PAY_SCHEDULE'\n\ntype PayScheduleContextType = {\n companyId: string\n handleAdd: () => void\n handleEdit: (schedule: PayScheduleType) => void\n handleCancel: () => void\n handleContinue: () => void\n mode: MODE\n paySchedules: PayScheduleList[] | undefined | null\n currentPaySchedule: PayScheduleType | undefined | null\n payPeriodPreview?: PayPeriods[]\n payPreviewLoading?: boolean\n}\n\nexport const PayScheduleSchema = z.object({\n frequency: z.enum(['Every week', 'Every other week', 'Twice per month', 'Monthly']),\n anchorPayDate: z.date().optional(),\n anchorEndOfPayPeriod: z.date().optional(),\n day1: z.number().min(1).max(31).optional(),\n day2: z.number().min(1).max(31).optional(),\n customName: z.string().optional(),\n customTwicePerMonth: z.string().optional(),\n payPeriodPreviewRange: z.number().optional(),\n})\n\nexport type PayScheduleInputs = z.input<typeof PayScheduleSchema>\nexport type PayScheduleOutputs = z.output<typeof PayScheduleSchema>\n\nexport type PayScheduleDefaultValues = RequireAtLeastOne<\n Partial<\n Pick<\n PayScheduleCreateUpdate,\n 'anchorPayDate' | 'anchorEndOfPayPeriod' | 'day1' | 'day2' | 'customName' | 'frequency'\n >\n >\n>\n\nconst [usePaySchedule, PayScheduleProvider] =\n createCompoundContext<PayScheduleContextType>('PayScheduleContext')\nexport { usePaySchedule, PayScheduleProvider }\n"],"names":["PayScheduleSchema","z","usePaySchedule","PayScheduleProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;AA2Ba,MAAAA,IAAoBC,EAAE,OAAO;AAAA,EACxC,WAAWA,EAAE,KAAK,CAAC,cAAc,oBAAoB,mBAAmB,SAAS,CAAC;AAAA,EAClF,eAAeA,EAAE,KAAK,EAAE,SAAS;AAAA,EACjC,sBAAsBA,EAAE,KAAK,EAAE,SAAS;AAAA,EACxC,MAAMA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,SAAS;AAAA,EACzC,MAAMA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,SAAS;AAAA,EACzC,YAAYA,EAAE,OAAO,EAAE,SAAS;AAAA,EAChC,qBAAqBA,EAAE,OAAO,EAAE,SAAS;AAAA,EACzC,uBAAuBA,EAAE,OAAO,EAAE,SAAS;AAC7C,CAAC,GAcK,CAACC,GAAgBC,CAAmB,IACxCC,EAA8C,oBAAoB;"}
@@ -0,0 +1,9 @@
1
+ import { BaseComponentInterface } from '../../Base';
2
+ export interface StateTaxesProps extends BaseComponentInterface<'Company.StateTaxes'> {
3
+ companyId: string;
4
+ }
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
+ }
@@ -0,0 +1,27 @@
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 });
21
+ }
22
+ t.StateTaxesList = p;
23
+ t.StateTaxesForm = S;
24
+ export {
25
+ t as StateTaxes
26
+ };
27
+ //# sourceMappingURL=StateTaxes.js.map
@@ -0,0 +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;"}
@@ -22,4 +22,4 @@ export {
22
22
  d as StateTaxesFormContextual,
23
23
  f as StateTaxesListContextual
24
24
  };
25
- //# sourceMappingURL=StateTaxesFlowComponents.js.map
25
+ //# sourceMappingURL=StateTaxesComponents.js.map
@@ -0,0 +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,16 +1,16 @@
1
- import { jsxs as e, jsx as n } from "react/jsx-runtime";
1
+ import { jsxs as i, jsx as n } from "react/jsx-runtime";
2
2
  import { useTranslation as a } from "react-i18next";
3
- import { useStateTaxesForm as i } from "./context.js";
4
- import { ActionsLayout as s } from "../../../Common/ActionsLayout/ActionsLayout.js";
5
- import { useComponentContext as m } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
6
- function C() {
7
- const { t } = a("Company.StateTaxes", { keyPrefix: "form" }), { handleCancel: r } = i(), o = m();
8
- return /* @__PURE__ */ e(s, { children: [
9
- /* @__PURE__ */ n(o.Button, { variant: "secondary", onClick: r, children: t("cancelCta") }),
10
- /* @__PURE__ */ n(o.Button, { variant: "primary", type: "submit", children: t("saveCta") })
3
+ import { useStateTaxesForm as s } from "./context.js";
4
+ import { ActionsLayout as m } from "../../../Common/ActionsLayout/ActionsLayout.js";
5
+ import { useComponentContext as c } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
6
+ function d() {
7
+ const { t } = a("Company.StateTaxes", { keyPrefix: "form" }), { handleCancel: e, isPending: r } = s(), o = c();
8
+ return /* @__PURE__ */ i(m, { children: [
9
+ /* @__PURE__ */ n(o.Button, { variant: "secondary", onClick: e, children: t("cancelCta") }),
10
+ /* @__PURE__ */ n(o.Button, { variant: "primary", type: "submit", isDisabled: r, children: t("saveCta") })
11
11
  ] });
12
12
  }
13
13
  export {
14
- C as Actions
14
+ d as Actions
15
15
  };
16
16
  //# sourceMappingURL=Actions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Actions.js","sources":["../../../../../src/components/Company/StateTaxes/StateTaxesForm/Actions.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useStateTaxesForm } from './context'\nimport { ActionsLayout } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\nexport function Actions() {\n const { t } = useTranslation('Company.StateTaxes', { keyPrefix: 'form' })\n const { handleCancel } = useStateTaxesForm()\n const Components = useComponentContext()\n\n return (\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleCancel}>\n {t('cancelCta')}\n </Components.Button>\n <Components.Button variant=\"primary\" type=\"submit\">\n {t('saveCta')}\n </Components.Button>\n </ActionsLayout>\n )\n}\n"],"names":["Actions","useTranslation","handleCancel","useStateTaxesForm","Components","useComponentContext","ActionsLayout","jsx"],"mappings":";;;;;AAKO,SAASA,IAAU;AAClB,QAAA,EAAE,MAAMC,EAAe,sBAAsB,EAAE,WAAW,QAAQ,GAClE,EAAE,cAAAC,EAAa,IAAIC,EAAkB,GACrCC,IAAaC,EAAoB;AAEvC,2BACGC,GACC,EAAA,UAAA;AAAA,IAAC,gBAAAC,EAAAH,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASF,GAC7C,UAAE,EAAA,WAAW,EAChB,CAAA;AAAA,IACA,gBAAAK,EAACH,EAAW,QAAX,EAAkB,SAAQ,WAAU,MAAK,UACvC,UAAE,EAAA,SAAS,EACd,CAAA;AAAA,EAAA,GACF;AAEJ;"}
1
+ {"version":3,"file":"Actions.js","sources":["../../../../../src/components/Company/StateTaxes/StateTaxesForm/Actions.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useStateTaxesForm } from './context'\nimport { ActionsLayout } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\nexport function Actions() {\n const { t } = useTranslation('Company.StateTaxes', { keyPrefix: 'form' })\n const { handleCancel, isPending } = useStateTaxesForm()\n const Components = useComponentContext()\n\n return (\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleCancel}>\n {t('cancelCta')}\n </Components.Button>\n <Components.Button variant=\"primary\" type=\"submit\" isDisabled={isPending}>\n {t('saveCta')}\n </Components.Button>\n </ActionsLayout>\n )\n}\n"],"names":["Actions","useTranslation","handleCancel","isPending","useStateTaxesForm","Components","useComponentContext","ActionsLayout","jsx"],"mappings":";;;;;AAKO,SAASA,IAAU;AAClB,QAAA,EAAE,MAAMC,EAAe,sBAAsB,EAAE,WAAW,QAAQ,GAClE,EAAE,cAAAC,GAAc,WAAAC,EAAU,IAAIC,EAAkB,GAChDC,IAAaC,EAAoB;AAEvC,2BACGC,GACC,EAAA,UAAA;AAAA,IAAC,gBAAAC,EAAAH,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASH,GAC7C,UAAE,EAAA,WAAW,EAChB,CAAA;AAAA,IACC,gBAAAM,EAAAH,EAAW,QAAX,EAAkB,SAAQ,WAAU,MAAK,UAAS,YAAYF,GAC5D,UAAE,EAAA,SAAS,EACd,CAAA;AAAA,EAAA,GACF;AAEJ;"}
@@ -11,7 +11,7 @@ function w() {
11
11
  return p.requirementSets?.map(
12
12
  ({ requirements: c, label: d, effectiveFrom: n, key: a }) => /* @__PURE__ */ m(f, { children: [
13
13
  /* @__PURE__ */ m("div", { children: [
14
- /* @__PURE__ */ o(r.Heading, { as: "h4", children: d }),
14
+ /* @__PURE__ */ o(r.Heading, { as: "h3", children: d }),
15
15
  n && /* @__PURE__ */ o(r.Text, { className: "lightText", children: s("effectiveFromLabel", { date: i.format(new Date(n)) }) })
16
16
  ] }),
17
17
  c?.map((e) => /* @__PURE__ */ o(
@@ -1 +1 @@
1
- {"version":3,"file":"Form.js","sources":["../../../../../src/components/Company/StateTaxes/StateTaxesForm/Form.tsx"],"sourcesContent":["import { z } from 'zod'\nimport { useTranslation } from 'react-i18next'\nimport { Fragment } from 'react/jsx-runtime'\nimport { useStateTaxesForm } from './context'\nimport { QuestionInput } from '@/components/Common/TaxInputs/TaxInputs'\nimport { useLocaleDateFormatter } from '@/contexts/LocaleProvider/useLocale'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\nexport const StateFormSchema = z.record(z.string(), z.record(z.string(), z.unknown()))\n\nexport type StateFormInputs = z.infer<typeof StateFormSchema>\n\nexport function Form() {\n const { t } = useTranslation('Company.StateTaxes', { keyPrefix: 'form' })\n const dateFormatter = useLocaleDateFormatter()\n const { stateTaxRequirements } = useStateTaxesForm()\n const Components = useComponentContext()\n\n return stateTaxRequirements.requirementSets?.map(\n ({ requirements, label, effectiveFrom, key }) => (\n <Fragment key={key}>\n <div>\n <Components.Heading as=\"h4\">{label}</Components.Heading>\n {effectiveFrom && (\n <Components.Text className=\"lightText\">\n {t('effectiveFromLabel', { date: dateFormatter.format(new Date(effectiveFrom)) })}\n </Components.Text>\n )}\n </div>\n {requirements?.map(requirement => {\n return (\n <QuestionInput\n requirement={{\n ...requirement,\n key: `${key}.${requirement.key as string}`,\n }}\n questionType={requirement.metadata?.type ?? 'Text'}\n key={requirement.key}\n />\n )\n })}\n </Fragment>\n ),\n )\n}\n"],"names":["z","Form","t","useTranslation","dateFormatter","useLocaleDateFormatter","stateTaxRequirements","useStateTaxesForm","Components","useComponentContext","requirements","label","effectiveFrom","key","Fragment","jsxs","jsx","requirement","QuestionInput"],"mappings":";;;;;;;AAQ+BA,EAAE,OAAOA,EAAE,UAAUA,EAAE,OAAOA,EAAE,OAAO,GAAGA,EAAE,QAAA,CAAS,CAAC;AAI9E,SAASC,IAAO;AACf,QAAA,EAAE,GAAAC,MAAMC,EAAe,sBAAsB,EAAE,WAAW,QAAQ,GAClEC,IAAgBC,EAAuB,GACvC,EAAE,sBAAAC,EAAqB,IAAIC,EAAkB,GAC7CC,IAAaC,EAAoB;AAEvC,SAAOH,EAAqB,iBAAiB;AAAA,IAC3C,CAAC,EAAE,cAAAI,GAAc,OAAAC,GAAO,eAAAC,GAAe,KAAAC,EAAI,wBACxCC,GACC,EAAA,UAAA;AAAA,MAAA,gBAAAC,EAAC,OACC,EAAA,UAAA;AAAA,QAAA,gBAAAC,EAACR,EAAW,SAAX,EAAmB,IAAG,MAAM,UAAMG,GAAA;AAAA,QAClCC,KACE,gBAAAI,EAAAR,EAAW,MAAX,EAAgB,WAAU,aACxB,UAAEN,EAAA,sBAAsB,EAAE,MAAME,EAAc,OAAO,IAAI,KAAKQ,CAAa,CAAC,EAAA,CAAG,EAClF,CAAA;AAAA,MAAA,GAEJ;AAAA,MACCF,GAAc,IAAI,CAAeO,MAE9B,gBAAAD;AAAA,QAACE;AAAA,QAAA;AAAA,UACC,aAAa;AAAA,YACX,GAAGD;AAAA,YACH,KAAK,GAAGJ,CAAG,IAAII,EAAY,GAAa;AAAA,UAC1C;AAAA,UACA,cAAcA,EAAY,UAAU,QAAQ;AAAA,QAAA;AAAA,QACvCA,EAAY;AAAA,MACnB,CAEH;AAAA,IAAA,EAAA,GApBYJ,CAqBf;AAAA,EAEJ;AACF;"}
1
+ {"version":3,"file":"Form.js","sources":["../../../../../src/components/Company/StateTaxes/StateTaxesForm/Form.tsx"],"sourcesContent":["import { z } from 'zod'\nimport { useTranslation } from 'react-i18next'\nimport { Fragment } from 'react/jsx-runtime'\nimport { useStateTaxesForm } from './context'\nimport { QuestionInput } from '@/components/Common/TaxInputs/TaxInputs'\nimport { useLocaleDateFormatter } from '@/contexts/LocaleProvider/useLocale'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\nexport const StateFormSchema = z.record(z.string(), z.record(z.string(), z.unknown()))\n\nexport type StateFormInputs = z.infer<typeof StateFormSchema>\n\nexport function Form() {\n const { t } = useTranslation('Company.StateTaxes', { keyPrefix: 'form' })\n const dateFormatter = useLocaleDateFormatter()\n const { stateTaxRequirements } = useStateTaxesForm()\n const Components = useComponentContext()\n\n return stateTaxRequirements.requirementSets?.map(\n ({ requirements, label, effectiveFrom, key }) => (\n <Fragment key={key}>\n <div>\n <Components.Heading as=\"h3\">{label}</Components.Heading>\n {effectiveFrom && (\n <Components.Text className=\"lightText\">\n {t('effectiveFromLabel', { date: dateFormatter.format(new Date(effectiveFrom)) })}\n </Components.Text>\n )}\n </div>\n {requirements?.map(requirement => {\n return (\n <QuestionInput\n requirement={{\n ...requirement,\n key: `${key}.${requirement.key as string}`,\n }}\n questionType={requirement.metadata?.type ?? 'Text'}\n key={requirement.key}\n />\n )\n })}\n </Fragment>\n ),\n )\n}\n"],"names":["z","Form","t","useTranslation","dateFormatter","useLocaleDateFormatter","stateTaxRequirements","useStateTaxesForm","Components","useComponentContext","requirements","label","effectiveFrom","key","Fragment","jsxs","jsx","requirement","QuestionInput"],"mappings":";;;;;;;AAQ+BA,EAAE,OAAOA,EAAE,UAAUA,EAAE,OAAOA,EAAE,OAAO,GAAGA,EAAE,QAAA,CAAS,CAAC;AAI9E,SAASC,IAAO;AACf,QAAA,EAAE,GAAAC,MAAMC,EAAe,sBAAsB,EAAE,WAAW,QAAQ,GAClEC,IAAgBC,EAAuB,GACvC,EAAE,sBAAAC,EAAqB,IAAIC,EAAkB,GAC7CC,IAAaC,EAAoB;AAEvC,SAAOH,EAAqB,iBAAiB;AAAA,IAC3C,CAAC,EAAE,cAAAI,GAAc,OAAAC,GAAO,eAAAC,GAAe,KAAAC,EAAI,wBACxCC,GACC,EAAA,UAAA;AAAA,MAAA,gBAAAC,EAAC,OACC,EAAA,UAAA;AAAA,QAAA,gBAAAC,EAACR,EAAW,SAAX,EAAmB,IAAG,MAAM,UAAMG,GAAA;AAAA,QAClCC,KACE,gBAAAI,EAAAR,EAAW,MAAX,EAAgB,WAAU,aACxB,UAAEN,EAAA,sBAAsB,EAAE,MAAME,EAAc,OAAO,IAAI,KAAKQ,CAAa,CAAC,EAAA,CAAG,EAClF,CAAA;AAAA,MAAA,GAEJ;AAAA,MACCF,GAAc,IAAI,CAAeO,MAE9B,gBAAAD;AAAA,QAACE;AAAA,QAAA;AAAA,UACC,aAAa;AAAA,YACX,GAAGD;AAAA,YACH,KAAK,GAAGJ,CAAG,IAAII,EAAY,GAAa;AAAA,UAC1C;AAAA,UACA,cAAcA,EAAY,UAAU,QAAQ;AAAA,QAAA;AAAA,QACvCA,EAAY;AAAA,MACnB,CAEH;AAAA,IAAA,EAAA,GApBYJ,CAqBf;AAAA,EAEJ;AACF;"}
@@ -3,52 +3,52 @@ import { useForm as K, FormProvider as M } from "react-hook-form";
3
3
  import { zodResolver as w } from "@hookform/resolvers/zod";
4
4
  import { useTaxRequirementsUpdateStateMutation as z } from "@gusto/embedded-api/react-query/taxRequirementsUpdateState";
5
5
  import { useTaxRequirementsGetSuspense as G } from "@gusto/embedded-api/react-query/taxRequirementsGet";
6
- import { z as r } from "zod";
6
+ import { z as n } from "zod";
7
7
  import { useMemo as L } from "react";
8
8
  import { useTranslation as X } from "react-i18next";
9
- import { Head as q } from "./Head.js";
9
+ import { Head as A } from "./Head.js";
10
10
  import { StateTaxesFormProvider as Y } from "./context.js";
11
- import { Form as A } from "./Form.js";
12
- import { Actions as P } from "./Actions.js";
11
+ import { Form as P } from "./Form.js";
12
+ import { Actions as j } from "./Actions.js";
13
13
  import { BaseComponent as $ } from "../../../Base/Base.js";
14
14
  import { useI18n as I } from "../../../../i18n/I18n.js";
15
15
  import { Flex as J } from "../../../Common/Flex/Flex.js";
16
16
  import { Form as Q } from "../../../Common/Form/Form.js";
17
17
  import { componentEvents as k } from "../../../../shared/constants.js";
18
18
  import { useBase as W } from "../../../Base/useBase.js";
19
- function x(n) {
20
- return /* @__PURE__ */ t($, { ...n, children: /* @__PURE__ */ t(Z, { ...n, children: n.children }) });
19
+ function x(a) {
20
+ return /* @__PURE__ */ t($, { ...a, children: /* @__PURE__ */ t(Z, { ...a, children: a.children }) });
21
21
  }
22
- function Z({ companyId: n, state: S, className: j, children: v }) {
22
+ function Z({ companyId: a, state: S, className: q, children: v }) {
23
23
  I("Company.StateTaxes");
24
- const { onEvent: F, baseSubmitHandler: C } = W(), { t: l } = X("Company.StateTaxes", { keyPrefix: "form" }), { data: E } = G({ companyUuid: n, state: S }), f = E.taxRequirementsState, { mutateAsync: N, isPending: R } = z(), { dynamicSchema: V, defaultValues: O } = L(() => {
24
+ const { onEvent: F, baseSubmitHandler: C } = W(), { t: l } = X("Company.StateTaxes", { keyPrefix: "form" }), { data: E } = G({ companyUuid: a, state: S }), f = E.taxRequirementsState, { mutateAsync: N, isPending: R } = z(), { dynamicSchema: V, defaultValues: O } = L(() => {
25
25
  const d = {}, i = {};
26
26
  return f.requirementSets?.forEach((e) => {
27
27
  if (!e.key) return;
28
28
  const m = e.key, s = {}, p = {};
29
29
  e.requirements?.forEach((o) => {
30
30
  if (!o.key) return;
31
- const b = o.key;
32
- p[b] = String(o.value ?? "");
33
- let y = r.string().min(1);
31
+ const g = o.key;
32
+ p[g] = String(o.value ?? "");
33
+ let y = n.string().min(1);
34
34
  const c = o.metadata?.validation;
35
35
  if (c && o.metadata?.type === "tax_rate")
36
36
  if (c.type === "min_max") {
37
- const a = parseFloat(c.min), u = parseFloat(c.max);
38
- !isNaN(a) && !isNaN(u) && (y = r.preprocess(
37
+ const r = parseFloat(c.min), u = parseFloat(c.max);
38
+ !isNaN(r) && !isNaN(u) && (y = n.preprocess(
39
39
  (h) => Number(h),
40
- r.number().min(a, l("validations.minValue", { min: a })).max(u, l("validations.maxValue", { max: u })).transform((h) => String(h))
40
+ n.number().min(r, l("validations.minValue", { min: r })).max(u, l("validations.maxValue", { max: u })).transform((h) => String(h))
41
41
  ));
42
42
  } else {
43
- const a = c.rates;
44
- y = r.string().min(1).refine((u) => a.includes(u), {
45
- message: l("validations.oneOf", { values: a.join(", ") })
43
+ const r = c.rates;
44
+ y = n.string().min(1).refine((u) => r.includes(u), {
45
+ message: l("validations.oneOf", { values: r.join(", ") })
46
46
  });
47
47
  }
48
- s[b] = y;
49
- }), Object.keys(s).length > 0 && (d[m] = r.object(s), i[m] = p);
48
+ o.metadata?.type === "radio" && (y = n.boolean()), s[g] = y;
49
+ }), Object.keys(s).length > 0 && (d[m] = n.object(s), i[m] = p);
50
50
  }), {
51
- dynamicSchema: r.object(d),
51
+ dynamicSchema: n.object(d),
52
52
  defaultValues: i
53
53
  };
54
54
  }, [f, l]), { control: U, ...T } = K({
@@ -56,7 +56,7 @@ function Z({ companyId: n, state: S, className: j, children: v }) {
56
56
  defaultValues: O
57
57
  }), _ = async (d) => {
58
58
  await C(d, async (i) => {
59
- const g = f.requirementSets?.filter((e) => e.key && i[e.key]).map((e) => {
59
+ const b = f.requirementSets?.filter((e) => e.key && i[e.key]).map((e) => {
60
60
  const m = e.key, s = i[m];
61
61
  return {
62
62
  state: e.state,
@@ -70,8 +70,8 @@ function Z({ companyId: n, state: S, className: j, children: v }) {
70
70
  });
71
71
  await N({
72
72
  request: {
73
- companyUuid: n,
74
- requestBody: { requirementSets: g },
73
+ companyUuid: a,
74
+ requestBody: { requirementSets: b },
75
75
  state: S
76
76
  }
77
77
  }), F(k.COMPANY_STATE_TAX_UPDATED);
@@ -79,21 +79,21 @@ function Z({ companyId: n, state: S, className: j, children: v }) {
79
79
  }, B = () => {
80
80
  F(k.CANCEL);
81
81
  };
82
- return /* @__PURE__ */ t("section", { className: j, children: /* @__PURE__ */ t(M, { ...T, control: U, children: /* @__PURE__ */ t(Q, { onSubmit: T.handleSubmit(_), children: /* @__PURE__ */ t(
82
+ return /* @__PURE__ */ t("section", { className: q, children: /* @__PURE__ */ t(M, { ...T, control: U, children: /* @__PURE__ */ t(Q, { onSubmit: T.handleSubmit(_), children: /* @__PURE__ */ t(
83
83
  Y,
84
84
  {
85
85
  value: { stateTaxRequirements: f, isPending: R, state: S, handleCancel: B },
86
86
  children: /* @__PURE__ */ t(J, { flexDirection: "column", gap: 32, children: v || /* @__PURE__ */ D(H, { children: [
87
- /* @__PURE__ */ t(q, {}),
88
87
  /* @__PURE__ */ t(A, {}),
89
- /* @__PURE__ */ t(P, {})
88
+ /* @__PURE__ */ t(P, {}),
89
+ /* @__PURE__ */ t(j, {})
90
90
  ] }) })
91
91
  }
92
92
  ) }) }) });
93
93
  }
94
- x.Head = q;
95
- x.Form = A;
96
- x.Actions = P;
94
+ x.Head = A;
95
+ x.Form = P;
96
+ x.Actions = j;
97
97
  export {
98
98
  x as StateTaxesForm
99
99
  };