@gusto/embedded-react-sdk 0.31.0 → 0.31.1-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 (387) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/assets/icons/icon-arrow-right.svg.js +10 -0
  3. package/dist/assets/icons/icon-arrow-right.svg.js.map +1 -0
  4. package/dist/components/Base/Base.js +12 -13
  5. package/dist/components/Base/Base.js.map +1 -1
  6. package/dist/components/Common/DataView/DataView.js +1 -1
  7. package/dist/components/Common/DocumentList/DocumentList.js +1 -1
  8. package/dist/components/Common/DocumentViewer/DocumentViewer.js +1 -1
  9. package/dist/components/Common/FlowBreadcrumbs/FlowBreadcrumbs.js +1 -1
  10. package/dist/components/Common/RequirementsList/RequirementsList.js +1 -1
  11. package/dist/components/Common/RequirementsList/RequirementsList.js.map +1 -1
  12. package/dist/components/Common/RequirementsList/RequirementsList.module.scss.js +1 -1
  13. package/dist/components/Common/SignatureForm/SignatureForm.js +10 -12
  14. package/dist/components/Common/SignatureForm/SignatureForm.js.map +1 -1
  15. package/dist/components/Common/SignatureForm/SignatureFormActions.js +2 -3
  16. package/dist/components/Common/SignatureForm/SignatureFormActions.js.map +1 -1
  17. package/dist/components/Common/SignatureForm/SignatureFormFields.js +6 -7
  18. package/dist/components/Common/SignatureForm/SignatureFormFields.js.map +1 -1
  19. package/dist/components/Common/UI/Box/Box.d.ts +2 -0
  20. package/dist/components/Common/UI/Box/Box.js +13 -0
  21. package/dist/components/Common/UI/Box/Box.js.map +1 -0
  22. package/dist/components/Common/UI/Box/Box.module.scss.js +12 -0
  23. package/dist/components/Common/UI/Box/Box.module.scss.js.map +1 -0
  24. package/dist/components/Common/UI/Box/BoxTypes.d.ts +15 -0
  25. package/dist/components/Common/UI/Box/index.d.ts +2 -0
  26. package/dist/components/Common/UI/Breadcrumbs/Breadcrumbs.js +1 -1
  27. package/dist/components/Common/UI/Dialog/Dialog.js +1 -1
  28. package/dist/components/Common/UI/FileInput/FileInput.js +1 -1
  29. package/dist/components/Common/UI/Input/InputTypes.d.ts +1 -1
  30. package/dist/components/Common/UI/Input/InputTypes.js.map +1 -1
  31. package/dist/components/Common/UI/List/List.module.scss.js +1 -1
  32. package/dist/components/Common/UI/Modal/Modal.js +1 -1
  33. package/dist/components/Common/UI/ProgressBar/ProgressBar.js +4 -4
  34. package/dist/components/Common/UI/Tabs/Tabs.js +1 -1
  35. package/dist/components/Common/UI/TextInput/TextInput.js +30 -28
  36. package/dist/components/Common/UI/TextInput/TextInput.js.map +1 -1
  37. package/dist/components/Common/UI/TextInput/TextInputTypes.d.ts +1 -1
  38. package/dist/components/Common/UI/TextInput/TextInputTypes.js.map +1 -1
  39. package/dist/components/Company/AssignSignatory/AssignSignatory.js +2 -3
  40. package/dist/components/Company/AssignSignatory/AssignSignatory.js.map +1 -1
  41. package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js +3 -4
  42. package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js.map +1 -1
  43. package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js +2 -3
  44. package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js.map +1 -1
  45. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js +1 -1
  46. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js +12 -12
  47. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +3 -4
  48. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
  49. package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js +2 -3
  50. package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js.map +1 -1
  51. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js +1 -1
  52. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js +1 -1
  53. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +3 -4
  54. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
  55. package/dist/components/Company/AssignSignatory/TitleSelect.js +4 -6
  56. package/dist/components/Company/AssignSignatory/TitleSelect.js.map +1 -1
  57. package/dist/components/Company/AssignSignatory/useAssignSignatory.js +5 -6
  58. package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
  59. package/dist/components/Company/BankAccount/BankAccountForm/Actions.js +8 -9
  60. package/dist/components/Company/BankAccount/BankAccountForm/Actions.js.map +1 -1
  61. package/dist/components/Company/BankAccount/BankAccountForm/Form.js +5 -7
  62. package/dist/components/Company/BankAccount/BankAccountForm/Form.js.map +1 -1
  63. package/dist/components/Company/BankAccount/BankAccountForm/context.js +3 -4
  64. package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
  65. package/dist/components/Company/BankAccount/BankAccountList/Actions.js +2 -3
  66. package/dist/components/Company/BankAccount/BankAccountList/Actions.js.map +1 -1
  67. package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js +6 -7
  68. package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js.map +1 -1
  69. package/dist/components/Company/BankAccount/BankAccountVerify/Form.js +5 -7
  70. package/dist/components/Company/BankAccount/BankAccountVerify/Form.js.map +1 -1
  71. package/dist/components/Company/DocumentSigner/DocumentList/Actions.js +2 -3
  72. package/dist/components/Company/DocumentSigner/DocumentList/Actions.js.map +1 -1
  73. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js +8 -9
  74. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  75. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +3 -4
  76. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  77. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js +3 -4
  78. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
  79. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js +3 -4
  80. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
  81. package/dist/components/Company/FederalTaxes/Actions.js +6 -7
  82. package/dist/components/Company/FederalTaxes/Actions.js.map +1 -1
  83. package/dist/components/Company/FederalTaxes/FederalTaxes.js +3 -4
  84. package/dist/components/Company/FederalTaxes/FederalTaxes.js.map +1 -1
  85. package/dist/components/Company/FederalTaxes/Form.js +3 -5
  86. package/dist/components/Company/FederalTaxes/Form.js.map +1 -1
  87. package/dist/components/Company/FederalTaxes/useFederalTaxes.js +5 -6
  88. package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
  89. package/dist/components/Company/Industry/Actions.js +7 -8
  90. package/dist/components/Company/Industry/Actions.js.map +1 -1
  91. package/dist/components/Company/Industry/Context.js +6 -7
  92. package/dist/components/Company/Industry/Context.js.map +1 -1
  93. package/dist/components/Company/Industry/Edit.js +2 -3
  94. package/dist/components/Company/Industry/Edit.js.map +1 -1
  95. package/dist/components/Company/Locations/LocationForm/Actions.js +6 -7
  96. package/dist/components/Company/Locations/LocationForm/Actions.js.map +1 -1
  97. package/dist/components/Company/Locations/LocationForm/Form.js +1 -1
  98. package/dist/components/Company/Locations/LocationForm/LocationForm.js +3 -4
  99. package/dist/components/Company/Locations/LocationForm/LocationForm.js.map +1 -1
  100. package/dist/components/Company/Locations/LocationForm/useLocationForm.js +3 -4
  101. package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
  102. package/dist/components/Company/Locations/LocationsList/Actions.js +2 -3
  103. package/dist/components/Company/Locations/LocationsList/Actions.js.map +1 -1
  104. package/dist/components/Company/Locations/LocationsList/List.js +6 -7
  105. package/dist/components/Company/Locations/LocationsList/List.js.map +1 -1
  106. package/dist/components/Company/Locations/LocationsList/LocationsList.js +3 -4
  107. package/dist/components/Company/Locations/LocationsList/LocationsList.js.map +1 -1
  108. package/dist/components/Company/Locations/LocationsList/useLocationsList.js +3 -4
  109. package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
  110. package/dist/components/Company/OnboardingOverview/Completed.js +10 -12
  111. package/dist/components/Company/OnboardingOverview/Completed.js.map +1 -1
  112. package/dist/components/Company/OnboardingOverview/MissingRequirements.js +37 -28
  113. package/dist/components/Company/OnboardingOverview/MissingRequirements.js.map +1 -1
  114. package/dist/components/Company/OnboardingOverview/OnboardingOverview.js +7 -8
  115. package/dist/components/Company/OnboardingOverview/OnboardingOverview.js.map +1 -1
  116. package/dist/components/Company/OnboardingOverview/context.js +3 -4
  117. package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
  118. package/dist/components/Company/PaySchedule/PaySchedule.js +3 -4
  119. package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
  120. package/dist/components/Company/PaySchedule/_parts/Actions.js +2 -3
  121. package/dist/components/Company/PaySchedule/_parts/Actions.js.map +1 -1
  122. package/dist/components/Company/PaySchedule/_parts/Edit.js +15 -15
  123. package/dist/components/Company/PaySchedule/_parts/Head.js +11 -13
  124. package/dist/components/Company/PaySchedule/_parts/Head.js.map +1 -1
  125. package/dist/components/Company/PaySchedule/_parts/List.js +13 -15
  126. package/dist/components/Company/PaySchedule/_parts/List.js.map +1 -1
  127. package/dist/components/Company/PaySchedule/usePaySchedule.js +5 -6
  128. package/dist/components/Company/PaySchedule/usePaySchedule.js.map +1 -1
  129. package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js +2 -3
  130. package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js.map +1 -1
  131. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +3 -4
  132. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
  133. package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js +2 -3
  134. package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js.map +1 -1
  135. package/dist/components/Company/StateTaxes/StateTaxesList/List.js +2 -3
  136. package/dist/components/Company/StateTaxes/StateTaxesList/List.js.map +1 -1
  137. package/dist/components/Company/StateTaxes/StateTaxesList/context.js +3 -4
  138. package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
  139. package/dist/components/Company/index.js +20 -20
  140. package/dist/components/Contractor/Address/Address.js +6 -8
  141. package/dist/components/Contractor/Address/Address.js.map +1 -1
  142. package/dist/components/Contractor/Address/Form.js +1 -1
  143. package/dist/components/Contractor/Address/useAddress.js +5 -6
  144. package/dist/components/Contractor/Address/useAddress.js.map +1 -1
  145. package/dist/components/Contractor/ContractorList/index.js +31 -32
  146. package/dist/components/Contractor/ContractorList/index.js.map +1 -1
  147. package/dist/components/Contractor/NewHireReport/NewHireReport.js +13 -14
  148. package/dist/components/Contractor/NewHireReport/NewHireReport.js.map +1 -1
  149. package/dist/components/Contractor/PaymentMethod/BankAccountForm.js +11 -12
  150. package/dist/components/Contractor/PaymentMethod/BankAccountForm.js.map +1 -1
  151. package/dist/components/Contractor/PaymentMethod/PaymentMethod.js +2 -3
  152. package/dist/components/Contractor/PaymentMethod/PaymentMethod.js.map +1 -1
  153. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js +3 -4
  154. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js.map +1 -1
  155. package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js +2 -4
  156. package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js.map +1 -1
  157. package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentPresentation.js +10 -10
  158. package/dist/components/Contractor/Payments/CreatePayment/FastAchSubmissionBlockerBanner.js +7 -9
  159. package/dist/components/Contractor/Payments/CreatePayment/FastAchSubmissionBlockerBanner.js.map +1 -1
  160. package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.js +3 -4
  161. package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.js.map +1 -1
  162. package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlowComponents.js +0 -1
  163. package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlowComponents.js.map +1 -1
  164. package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js +2 -4
  165. package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js.map +1 -1
  166. package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js +6 -8
  167. package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js.map +1 -1
  168. package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummaryPresentation.js +2 -4
  169. package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummaryPresentation.js.map +1 -1
  170. package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js +2 -4
  171. package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js.map +1 -1
  172. package/dist/components/Contractor/Profile/ContractorProfileForm.js +15 -15
  173. package/dist/components/Contractor/Profile/useContractorProfile.js +2 -3
  174. package/dist/components/Contractor/Profile/useContractorProfile.js.map +1 -1
  175. package/dist/components/Contractor/Submit/Submit.js +20 -21
  176. package/dist/components/Contractor/Submit/Submit.js.map +1 -1
  177. package/dist/components/Employee/Compensation/Actions.js +12 -13
  178. package/dist/components/Employee/Compensation/Actions.js.map +1 -1
  179. package/dist/components/Employee/Compensation/Edit.js +16 -17
  180. package/dist/components/Employee/Compensation/Edit.js.map +1 -1
  181. package/dist/components/Employee/Compensation/List.js +22 -23
  182. package/dist/components/Employee/Compensation/List.js.map +1 -1
  183. package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js +10 -11
  184. package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js.map +1 -1
  185. package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js +11 -12
  186. package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js.map +1 -1
  187. package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js +11 -12
  188. package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js.map +1 -1
  189. package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js +7 -8
  190. package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js.map +1 -1
  191. package/dist/components/Employee/Deductions/stateMachine.js +1 -1
  192. package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js +5 -6
  193. package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js.map +1 -1
  194. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js +2 -3
  195. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  196. package/dist/components/Employee/DocumentSigner/DocumentList/List.js +2 -4
  197. package/dist/components/Employee/DocumentSigner/DocumentList/List.js.map +1 -1
  198. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +3 -4
  199. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  200. package/dist/components/Employee/DocumentSigner/DocumentSigner.js +25 -37
  201. package/dist/components/Employee/DocumentSigner/DocumentSigner.js.map +1 -1
  202. package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilityPresentation.js +47 -45
  203. package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilityPresentation.js.map +1 -1
  204. package/dist/components/Employee/DocumentSigner/I9SignatureForm/I9SignatureForm.js +146 -109
  205. package/dist/components/Employee/DocumentSigner/I9SignatureForm/I9SignatureForm.js.map +1 -1
  206. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js +2 -3
  207. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
  208. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +3 -4
  209. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
  210. package/dist/components/Employee/DocumentSigner/documentSignerStateMachine.d.ts +1 -0
  211. package/dist/components/Employee/DocumentSigner/documentSignerStateMachine.js.map +1 -1
  212. package/dist/components/Employee/DocumentSigner/stateMachine.js +34 -22
  213. package/dist/components/Employee/DocumentSigner/stateMachine.js.map +1 -1
  214. package/dist/components/Employee/EmployeeDocuments/EmployeeDocumentsPresentation.js +2 -4
  215. package/dist/components/Employee/EmployeeDocuments/EmployeeDocumentsPresentation.js.map +1 -1
  216. package/dist/components/Employee/EmployeeList/Actions.js +6 -7
  217. package/dist/components/Employee/EmployeeList/Actions.js.map +1 -1
  218. package/dist/components/Employee/EmployeeList/EmployeeList.js +3 -4
  219. package/dist/components/Employee/EmployeeList/EmployeeList.js.map +1 -1
  220. package/dist/components/Employee/EmployeeList/Head.js +5 -7
  221. package/dist/components/Employee/EmployeeList/Head.js.map +1 -1
  222. package/dist/components/Employee/EmployeeList/List.js +2 -3
  223. package/dist/components/Employee/EmployeeList/List.js.map +1 -1
  224. package/dist/components/Employee/EmployeeList/useEmployeeList.js +3 -4
  225. package/dist/components/Employee/EmployeeList/useEmployeeList.js.map +1 -1
  226. package/dist/components/Employee/FederalTaxes/Actions.js +5 -6
  227. package/dist/components/Employee/FederalTaxes/Actions.js.map +1 -1
  228. package/dist/components/Employee/FederalTaxes/FederalForm.js +11 -12
  229. package/dist/components/Employee/FederalTaxes/FederalForm.js.map +1 -1
  230. package/dist/components/Employee/FederalTaxes/useFederalTaxes.js +3 -4
  231. package/dist/components/Employee/FederalTaxes/useFederalTaxes.js.map +1 -1
  232. package/dist/components/Employee/Landing/Landing.js +49 -45
  233. package/dist/components/Employee/Landing/Landing.js.map +1 -1
  234. package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js +7 -7
  235. package/dist/components/Employee/PaymentMethod/Actions.js +5 -6
  236. package/dist/components/Employee/PaymentMethod/Actions.js.map +1 -1
  237. package/dist/components/Employee/PaymentMethod/BankAccountEdit.js +4 -5
  238. package/dist/components/Employee/PaymentMethod/BankAccountEdit.js.map +1 -1
  239. package/dist/components/Employee/PaymentMethod/BankAccountsList.js +2 -3
  240. package/dist/components/Employee/PaymentMethod/BankAccountsList.js.map +1 -1
  241. package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js +6 -7
  242. package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js.map +1 -1
  243. package/dist/components/Employee/PaymentMethod/Split.js +10 -11
  244. package/dist/components/Employee/PaymentMethod/Split.js.map +1 -1
  245. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +5 -6
  246. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
  247. package/dist/components/Employee/Profile/Actions.js +5 -6
  248. package/dist/components/Employee/Profile/Actions.js.map +1 -1
  249. package/dist/components/Employee/Profile/AdminPersonalDetails.js +8 -9
  250. package/dist/components/Employee/Profile/AdminPersonalDetails.js.map +1 -1
  251. package/dist/components/Employee/Profile/HomeAddress.js +1 -1
  252. package/dist/components/Employee/Profile/PersonalDetailsInputs.js +2 -2
  253. package/dist/components/Employee/Profile/useProfile.js +3 -4
  254. package/dist/components/Employee/Profile/useProfile.js.map +1 -1
  255. package/dist/components/Employee/StateTaxes/Actions.js +5 -6
  256. package/dist/components/Employee/StateTaxes/Actions.js.map +1 -1
  257. package/dist/components/Employee/StateTaxes/useStateTaxes.js +3 -4
  258. package/dist/components/Employee/StateTaxes/useStateTaxes.js.map +1 -1
  259. package/dist/components/Employee/Taxes/Actions.js +6 -7
  260. package/dist/components/Employee/Taxes/Actions.js.map +1 -1
  261. package/dist/components/Employee/Taxes/FederalForm.js +13 -14
  262. package/dist/components/Employee/Taxes/FederalForm.js.map +1 -1
  263. package/dist/components/Employee/Taxes/useTaxes.js +3 -4
  264. package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
  265. package/dist/components/Employee/index.js +22 -22
  266. package/dist/components/Flow/Flow.js +7 -9
  267. package/dist/components/Flow/Flow.js.map +1 -1
  268. package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.js +16 -17
  269. package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.js.map +1 -1
  270. package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.d.ts +0 -1
  271. package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.js +36 -43
  272. package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.js.map +1 -1
  273. package/dist/components/InformationRequests/InformationRequests.d.ts +1 -2
  274. package/dist/components/InformationRequests/InformationRequests.js +37 -46
  275. package/dist/components/InformationRequests/InformationRequests.js.map +1 -1
  276. package/dist/components/InformationRequests/index.js +4 -4
  277. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js +9 -10
  278. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js.map +1 -1
  279. package/dist/components/Payroll/OffCycle/OffCycleFlowComponents.js +23 -21
  280. package/dist/components/Payroll/OffCycle/OffCycleFlowComponents.js.map +1 -1
  281. package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.d.ts +2 -0
  282. package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js +70 -0
  283. package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js.map +1 -0
  284. package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.d.ts +2 -0
  285. package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.js +25 -0
  286. package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.js.map +1 -0
  287. package/dist/components/Payroll/OffCycleCreation/OffCycleCreationTypes.d.ts +13 -0
  288. package/dist/components/Payroll/OffCycleCreation/index.d.ts +3 -0
  289. package/dist/components/Payroll/OffCycleDeductionsSetting/OffCycleDeductionsSetting.d.ts +2 -0
  290. package/dist/components/Payroll/OffCycleDeductionsSetting/OffCycleDeductionsSetting.js +50 -0
  291. package/dist/components/Payroll/OffCycleDeductionsSetting/OffCycleDeductionsSetting.js.map +1 -0
  292. package/dist/components/Payroll/OffCycleDeductionsSetting/index.d.ts +3 -0
  293. package/dist/components/Payroll/OffCycleDeductionsSetting/types.d.ts +11 -0
  294. package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.d.ts +1 -2
  295. package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.js +36 -0
  296. package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.js.map +1 -0
  297. package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.module.scss.js +12 -0
  298. package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.module.scss.js.map +1 -0
  299. package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormTypes.d.ts +0 -4
  300. package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormTypes.js +48 -0
  301. package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormTypes.js.map +1 -0
  302. package/dist/components/Payroll/OffCyclePayPeriodDateForm/useOffCyclePayPeriodDateValidation.js +18 -0
  303. package/dist/components/Payroll/OffCyclePayPeriodDateForm/useOffCyclePayPeriodDateValidation.js.map +1 -0
  304. package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelection.js +26 -27
  305. package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelection.js.map +1 -1
  306. package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelectionPresentation.d.ts +3 -3
  307. package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelectionPresentation.js +18 -18
  308. package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelectionPresentation.js.map +1 -1
  309. package/dist/components/Payroll/OffCycleTaxWithholdingModal/OffCycleTaxWithholdingModal.d.ts +2 -0
  310. package/dist/components/Payroll/OffCycleTaxWithholdingModal/OffCycleTaxWithholdingModalTypes.d.ts +8 -0
  311. package/dist/components/Payroll/OffCycleTaxWithholdingModal/index.d.ts +3 -0
  312. package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTable.d.ts +2 -0
  313. package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTableTypes.d.ts +17 -0
  314. package/dist/components/Payroll/OffCycleTaxWithholdingTable/index.d.ts +3 -0
  315. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.d.ts +3 -8
  316. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js +38 -39
  317. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js.map +1 -1
  318. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js +25 -33
  319. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js.map +1 -1
  320. package/dist/components/Payroll/PayrollBlocker/payrollHelpers.d.ts +1 -0
  321. package/dist/components/Payroll/PayrollBlocker/payrollHelpers.js +22 -19
  322. package/dist/components/Payroll/PayrollBlocker/payrollHelpers.js.map +1 -1
  323. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js +26 -26
  324. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
  325. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +36 -36
  326. package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js +19 -21
  327. package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js.map +1 -1
  328. package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js +15 -17
  329. package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js.map +1 -1
  330. package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.js +32 -32
  331. package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.js.map +1 -1
  332. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +18 -20
  333. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
  334. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +2 -3
  335. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js.map +1 -1
  336. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +1 -1
  337. package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchSubmissionBlockerBanner.js +2 -4
  338. package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchSubmissionBlockerBanner.js.map +1 -1
  339. package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js +3 -4
  340. package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js.map +1 -1
  341. package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.js +3 -4
  342. package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.js.map +1 -1
  343. package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/RecoveryCasesResubmit.js +11 -12
  344. package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/RecoveryCasesResubmit.js.map +1 -1
  345. package/dist/components/Payroll/RecoveryCases/useRecoveryCaseErrorCode.js +3 -5
  346. package/dist/components/Payroll/RecoveryCases/useRecoveryCaseErrorCode.js.map +1 -1
  347. package/dist/components/Payroll/index.d.ts +4 -0
  348. package/dist/components/Payroll/index.js +22 -18
  349. package/dist/components/Payroll/index.js.map +1 -1
  350. package/dist/components/Payroll/usePreparedPayrollData.js +2 -3
  351. package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
  352. package/dist/contexts/ComponentAdapter/adapters/defaultComponentAdapter.js +48 -46
  353. package/dist/contexts/ComponentAdapter/adapters/defaultComponentAdapter.js.map +1 -1
  354. package/dist/contexts/ComponentAdapter/componentAdapterTypes.d.ts +1 -0
  355. package/dist/contexts/ComponentAdapter/useComponentContext.d.ts +2 -0
  356. package/dist/contexts/ComponentAdapter/useComponentContext.js.map +1 -1
  357. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +2 -3
  358. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
  359. package/dist/contexts/ThemeProvider/theme.d.ts +1 -0
  360. package/dist/contexts/ThemeProvider/theme.js +1 -0
  361. package/dist/contexts/ThemeProvider/theme.js.map +1 -1
  362. package/dist/helpers/dateFormatting.js +61 -45
  363. package/dist/helpers/dateFormatting.js.map +1 -1
  364. package/dist/hooks/useOverflowDetection/useOverflowDetection.js +5 -6
  365. package/dist/i18n/I18n.js +7 -7
  366. package/dist/i18n/I18n.js.map +1 -1
  367. package/dist/i18n/en/Employee.EmployeeDocuments.json.js +1 -1
  368. package/dist/i18n/en/Employee.I9SignatureForm.json.js +83 -65
  369. package/dist/i18n/en/Employee.I9SignatureForm.json.js.map +1 -1
  370. package/dist/i18n/en/Employee.Landing.json.js +7 -9
  371. package/dist/i18n/en/Employee.Landing.json.js.map +1 -1
  372. package/dist/i18n/en/Payroll.OffCycleCreation.json.js +14 -0
  373. package/dist/i18n/en/Payroll.OffCycleCreation.json.js.map +1 -0
  374. package/dist/i18n/en/Payroll.OffCycleDeductionsSetting.json.js +12 -0
  375. package/dist/i18n/en/Payroll.OffCycleDeductionsSetting.json.js.map +1 -0
  376. package/dist/i18n/en/Payroll.OffCycleTaxWithholding.json.js +18 -0
  377. package/dist/i18n/en/Payroll.OffCycleTaxWithholding.json.js.map +1 -0
  378. package/dist/i18n/en/Payroll.PayrollBlocker.json.js +21 -19
  379. package/dist/i18n/en/Payroll.PayrollBlocker.json.js.map +1 -1
  380. package/dist/shared/constants.d.ts +4 -0
  381. package/dist/shared/constants.js +6 -4
  382. package/dist/shared/constants.js.map +1 -1
  383. package/dist/style.css +1 -1
  384. package/dist/types/i18next.d.ts +72 -2
  385. package/package.json +19 -7
  386. package/dist/components/Employee/Landing/Landing.module.scss.js +0 -8
  387. package/dist/components/Employee/Landing/Landing.module.scss.js.map +0 -1
@@ -15,13 +15,12 @@ import { useComponentContext as S } from "../../../../contexts/ComponentAdapter/
15
15
  import { useComponentDictionary as z, useI18n as g } from "../../../../i18n/I18n.js";
16
16
  import { Flex as p, FlexItem as f } from "../../../Common/Flex/Flex.js";
17
17
  import { payrollWireEvents as N } from "../../../../shared/constants.js";
18
- import "classnames";
19
- import { TextInputField as V } from "../../../Common/Fields/TextInputField/TextInputField.js";
20
- import { DatePickerField as J } from "../../../Common/Fields/DatePickerField/DatePickerField.js";
21
- import { NumberInputField as Q } from "../../../Common/Fields/NumberInputField/NumberInputField.js";
22
18
  import "react";
23
- import { TextAreaField as X } from "../../../Common/Fields/TextAreaField/TextAreaField.js";
24
- import { useDateFormatter as Z } from "../../../../hooks/useDateFormatter.js";
19
+ import { TextAreaField as V } from "../../../Common/Fields/TextAreaField/TextAreaField.js";
20
+ import { useDateFormatter as J } from "../../../../hooks/useDateFormatter.js";
21
+ import { NumberInputField as Q } from "../../../Common/Fields/NumberInputField/NumberInputField.js";
22
+ import { TextInputField as X } from "../../../Common/Fields/TextInputField/TextInputField.js";
23
+ import { DatePickerField as Z } from "../../../Common/Fields/DatePickerField/DatePickerField.js";
25
24
  const $ = r.object({
26
25
  amountSent: r.number().positive(),
27
26
  dateSent: r.date(),
@@ -43,7 +42,7 @@ const oe = ({
43
42
  modalContainerRef: y
44
43
  }) => {
45
44
  z("Payroll.ConfirmWireDetailsForm", i), g("Payroll.ConfirmWireDetailsForm");
46
- const { onEvent: a, baseSubmitHandler: I } = Y(), { t } = F("Payroll.ConfirmWireDetailsForm"), { Heading: v, Text: b } = S(), R = Z(), { data: P } = U({
45
+ const { onEvent: a, baseSubmitHandler: I } = Y(), { t } = F("Payroll.ConfirmWireDetailsForm"), { Heading: v, Text: b } = S(), R = J(), { data: P } = U({
47
46
  wireInRequestUuid: o
48
47
  }), W = P.wireInRequest, { data: q } = G({
49
48
  companyId: n,
@@ -95,7 +94,7 @@ const oe = ({
95
94
  }
96
95
  ),
97
96
  /* @__PURE__ */ e(
98
- J,
97
+ Z,
99
98
  {
100
99
  name: "dateSent",
101
100
  label: t("dateLabel"),
@@ -105,7 +104,7 @@ const oe = ({
105
104
  }
106
105
  ),
107
106
  /* @__PURE__ */ e(
108
- V,
107
+ X,
109
108
  {
110
109
  name: "bankName",
111
110
  label: t("bankNameLabel"),
@@ -115,7 +114,7 @@ const oe = ({
115
114
  errorMessage: t("validations.bankName")
116
115
  }
117
116
  ),
118
- /* @__PURE__ */ e(X, { name: "additionalNotes", label: t("notesLabel"), rows: 3 })
117
+ /* @__PURE__ */ e(V, { name: "additionalNotes", label: t("notesLabel"), rows: 3 })
119
118
  ] })
120
119
  }
121
120
  ) })
@@ -1 +1 @@
1
- {"version":3,"file":"ConfirmWireDetailsForm.js","sources":["../../../../../src/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.tsx"],"sourcesContent":["import { Trans, useTranslation } from 'react-i18next'\nimport z from 'zod'\nimport { FormProvider, useForm } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { useIsMutating } from '@tanstack/react-query'\nimport {\n useWireInRequestsSubmitMutation,\n mutationKeyWireInRequestsSubmit,\n} from '@gusto/embedded-api/react-query/wireInRequestsSubmit'\nimport { useWireInRequestsGetSuspense } from '@gusto/embedded-api/react-query/wireInRequestsGet'\nimport type { PutWireInRequestsWireInRequestUuidRequest } from '@gusto/embedded-api/models/operations/putwireinrequestswireinrequestuuid'\nimport { usePayrollsListSuspense } from '@gusto/embedded-api/react-query/payrollsList'\nimport styles from './ConfirmWireDetailsForm.module.scss'\nimport { Form as HtmlForm } from '@/components/Common/Form'\nimport { BaseComponent, useBase, type BaseComponentInterface } from '@/components/Base'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { Flex, FlexItem } from '@/components/Common/Flex/Flex'\nimport { payrollWireEvents, type EventType } from '@/shared/constants'\nimport { DatePickerField, NumberInputField, TextInputField } from '@/components/Common'\nimport { TextAreaField } from '@/components/Common/Fields/TextAreaField'\nimport type { OnEventType } from '@/components/Base/useBase'\nimport { useDateFormatter } from '@/hooks/useDateFormatter'\n\ninterface ConfirmWireDetailsFormProps extends BaseComponentInterface<'Payroll.ConfirmWireDetailsForm'> {\n wireInId: string\n companyId: string\n modalContainerRef?: React.RefObject<HTMLDivElement | null>\n}\n\nexport const ConfirmWireDetailsFormSchema = z.object({\n amountSent: z.number().positive(),\n dateSent: z.date(),\n bankName: z.string().nonempty(),\n additionalNotes: z.string().optional(),\n})\n\nexport type ConfirmWireDetailsFormValues = z.infer<typeof ConfirmWireDetailsFormSchema>\n\nconst CONFIRM_WIRE_FORM_ID = 'confirm-wire-details-form'\n\nconst transformFormDataToPayload = (\n data: ConfirmWireDetailsFormValues,\n): PutWireInRequestsWireInRequestUuidRequest['requestBody'] => {\n return {\n amountSent: String(data.amountSent),\n dateSent: data.dateSent.toISOString().split('T')[0] || '',\n bankName: data.bankName,\n additionalNotes: data.additionalNotes || undefined,\n }\n}\n\nexport function ConfirmWireDetailsForm(props: ConfirmWireDetailsFormProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nconst Root = ({\n wireInId,\n companyId,\n dictionary,\n modalContainerRef,\n}: ConfirmWireDetailsFormProps) => {\n useComponentDictionary('Payroll.ConfirmWireDetailsForm', dictionary)\n useI18n('Payroll.ConfirmWireDetailsForm')\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Payroll.ConfirmWireDetailsForm')\n const { Heading, Text } = useComponentContext()\n const dateFormatter = useDateFormatter()\n const { data } = useWireInRequestsGetSuspense({\n wireInRequestUuid: wireInId,\n })\n const wireInRequest = data.wireInRequest\n\n const { data: payrollsData } = usePayrollsListSuspense({\n companyId,\n processed: true,\n })\n\n const payrollData = payrollsData.payrollList?.find(\n payroll => payroll.payrollUuid === wireInRequest?.paymentUuid,\n )\n const payPeriod = payrollData?.payPeriod\n const payPeriodRange =\n payPeriod?.startDate && payPeriod.endDate\n ? dateFormatter.formatPayPeriodRange(payPeriod.startDate, payPeriod.endDate)\n : undefined\n\n const checkDate = payrollData\n ? dateFormatter.formatShortWithYear(payrollData.checkDate)\n : undefined\n\n const formHandlers = useForm<ConfirmWireDetailsFormValues>({\n resolver: zodResolver(ConfirmWireDetailsFormSchema),\n defaultValues: {\n bankName: '',\n },\n })\n\n const { mutateAsync: submitWireInRequest } = useWireInRequestsSubmitMutation()\n\n const onSubmit = async (data: ConfirmWireDetailsFormValues) => {\n await baseSubmitHandler(data, async innerData => {\n const payload = transformFormDataToPayload(innerData)\n const response = await submitWireInRequest({\n request: {\n wireInRequestUuid: wireInId,\n requestBody: payload,\n },\n })\n onEvent(payrollWireEvents.PAYROLL_WIRE_FORM_DONE, {\n wireInRequest: response.wireInRequest,\n confirmationAlert: {\n title: payPeriodRange\n ? t('confirmationAlert.title', { payrollRange: payPeriodRange })\n : t('confirmationAlert.emptyTitle'),\n content: checkDate ? (\n <Text>{t('confirmationAlert.content', { checkDate })}</Text>\n ) : undefined,\n },\n })\n })\n }\n\n return (\n <Flex flexDirection=\"column\" gap={24}>\n <FlexItem>\n <Heading as=\"h2\">\n <Trans i18nKey=\"title\" t={t} values={{ payrollRange: payPeriodRange }} />\n </Heading>\n <Text>{t('description')}</Text>\n </FlexItem>\n\n <FormProvider {...formHandlers}>\n <HtmlForm\n id={CONFIRM_WIRE_FORM_ID}\n onSubmit={formHandlers.handleSubmit(onSubmit)}\n className={styles.form}\n >\n <Flex flexDirection=\"column\" gap={20}>\n <NumberInputField\n name=\"amountSent\"\n label={t('amountLabel')}\n isRequired\n format=\"currency\"\n errorMessage={t('validations.amount')}\n />\n <DatePickerField\n name=\"dateSent\"\n label={t('dateLabel')}\n isRequired\n errorMessage={t('validations.date')}\n portalContainer={modalContainerRef?.current || undefined}\n />\n <TextInputField\n name=\"bankName\"\n label={t('bankNameLabel')}\n isRequired\n description={t('bankNameDescription')}\n placeholder={t('bankNamePlaceholder')}\n errorMessage={t('validations.bankName')}\n />\n <TextAreaField name=\"additionalNotes\" label={t('notesLabel')} rows={3} />\n </Flex>\n </HtmlForm>\n </FormProvider>\n </Flex>\n )\n}\n\nconst Footer = ({ onEvent }: { onEvent: OnEventType<EventType, unknown> }) => {\n useI18n('Payroll.ConfirmWireDetailsForm')\n const { t } = useTranslation('Payroll.ConfirmWireDetailsForm')\n const { Button } = useComponentContext()\n const isMutating = useIsMutating({\n mutationKey: mutationKeyWireInRequestsSubmit(),\n })\n const isPending = isMutating > 0\n\n return (\n <Flex gap={12} justifyContent=\"space-evenly\">\n <FlexItem flexGrow={1}>\n <Button\n variant=\"secondary\"\n onClick={() => {\n onEvent(payrollWireEvents.PAYROLL_WIRE_FORM_CANCEL)\n }}\n isDisabled={isPending}\n className={styles.button}\n >\n {t('cancelCta')}\n </Button>\n </FlexItem>\n <FlexItem flexGrow={1}>\n <Button\n variant=\"primary\"\n type=\"submit\"\n form={CONFIRM_WIRE_FORM_ID}\n isLoading={isPending}\n className={styles.button}\n >\n {t('submitCta')}\n </Button>\n </FlexItem>\n </Flex>\n )\n}\nConfirmWireDetailsForm.Footer = Footer\n"],"names":["ConfirmWireDetailsFormSchema","z","CONFIRM_WIRE_FORM_ID","transformFormDataToPayload","data","ConfirmWireDetailsForm","props","jsx","BaseComponent","Root","wireInId","companyId","dictionary","modalContainerRef","useComponentDictionary","useI18n","onEvent","baseSubmitHandler","useBase","useTranslation","Heading","Text","useComponentContext","dateFormatter","useDateFormatter","useWireInRequestsGetSuspense","wireInRequest","payrollsData","usePayrollsListSuspense","payrollData","payroll","payPeriod","payPeriodRange","checkDate","formHandlers","useForm","zodResolver","submitWireInRequest","useWireInRequestsSubmitMutation","onSubmit","innerData","payload","response","payrollWireEvents","jsxs","Flex","FlexItem","Trans","FormProvider","HtmlForm","styles","NumberInputField","DatePickerField","TextInputField","TextAreaField","Footer","t","Button","isPending","useIsMutating","mutationKeyWireInRequestsSubmit"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA8BO,MAAMA,IAA+BC,EAAE,OAAO;AAAA,EACnD,YAAYA,EAAE,OAAA,EAAS,SAAA;AAAA,EACvB,UAAUA,EAAE,KAAA;AAAA,EACZ,UAAUA,EAAE,OAAA,EAAS,SAAA;AAAA,EACrB,iBAAiBA,EAAE,OAA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AAU,GAClB,UAAA,gBAAAvC;AAAA,MAACkD;AAAA,MAAA;AAAA,QACC,SAAQ;AAAA,QACR,SAAS,MAAM;AACb,UAAAzC,EAAQ2B,EAAkB,wBAAwB;AAAA,QACpD;AAAA,QACA,YAAYe;AAAA,QACZ,WAAWR,EAAO;AAAA,QAEjB,YAAE,WAAW;AAAA,MAAA;AAAA,IAAA,GAElB;AAAA,IACA,gBAAA3C,EAACuC,GAAA,EAAS,UAAU,GAClB,UAAA,gBAAAvC;AAAA,MAACkD;AAAA,MAAA;AAAA,QACC,SAAQ;AAAA,QACR,MAAK;AAAA,QACL,MAAMvD;AAAA,QACN,WAAWwD;AAAA,QACX,WAAWR,EAAO;AAAA,QAEjB,YAAE,WAAW;AAAA,MAAA;AAAA,IAAA,EAChB,CACF;AAAA,EAAA,GACF;AAEJ;AACA7C,GAAuB,SAASkD;"}
1
+ {"version":3,"file":"ConfirmWireDetailsForm.js","sources":["../../../../../src/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.tsx"],"sourcesContent":["import { Trans, useTranslation } from 'react-i18next'\nimport z from 'zod'\nimport { FormProvider, useForm } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { useIsMutating } from '@tanstack/react-query'\nimport {\n useWireInRequestsSubmitMutation,\n mutationKeyWireInRequestsSubmit,\n} from '@gusto/embedded-api/react-query/wireInRequestsSubmit'\nimport { useWireInRequestsGetSuspense } from '@gusto/embedded-api/react-query/wireInRequestsGet'\nimport type { PutWireInRequestsWireInRequestUuidRequest } from '@gusto/embedded-api/models/operations/putwireinrequestswireinrequestuuid'\nimport { usePayrollsListSuspense } from '@gusto/embedded-api/react-query/payrollsList'\nimport styles from './ConfirmWireDetailsForm.module.scss'\nimport { Form as HtmlForm } from '@/components/Common/Form'\nimport { BaseComponent, useBase, type BaseComponentInterface } from '@/components/Base'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { Flex, FlexItem } from '@/components/Common/Flex/Flex'\nimport { payrollWireEvents, type EventType } from '@/shared/constants'\nimport { DatePickerField, NumberInputField, TextInputField } from '@/components/Common'\nimport { TextAreaField } from '@/components/Common/Fields/TextAreaField'\nimport type { OnEventType } from '@/components/Base/useBase'\nimport { useDateFormatter } from '@/hooks/useDateFormatter'\n\ninterface ConfirmWireDetailsFormProps extends BaseComponentInterface<'Payroll.ConfirmWireDetailsForm'> {\n wireInId: string\n companyId: string\n modalContainerRef?: React.RefObject<HTMLDivElement | null>\n}\n\nexport const ConfirmWireDetailsFormSchema = z.object({\n amountSent: z.number().positive(),\n dateSent: z.date(),\n bankName: z.string().nonempty(),\n additionalNotes: z.string().optional(),\n})\n\nexport type ConfirmWireDetailsFormValues = z.infer<typeof ConfirmWireDetailsFormSchema>\n\nconst CONFIRM_WIRE_FORM_ID = 'confirm-wire-details-form'\n\nconst transformFormDataToPayload = (\n data: ConfirmWireDetailsFormValues,\n): PutWireInRequestsWireInRequestUuidRequest['requestBody'] => {\n return {\n amountSent: String(data.amountSent),\n dateSent: data.dateSent.toISOString().split('T')[0] || '',\n bankName: data.bankName,\n additionalNotes: data.additionalNotes || undefined,\n }\n}\n\nexport function ConfirmWireDetailsForm(props: ConfirmWireDetailsFormProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nconst Root = ({\n wireInId,\n companyId,\n dictionary,\n modalContainerRef,\n}: ConfirmWireDetailsFormProps) => {\n useComponentDictionary('Payroll.ConfirmWireDetailsForm', dictionary)\n useI18n('Payroll.ConfirmWireDetailsForm')\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Payroll.ConfirmWireDetailsForm')\n const { Heading, Text } = useComponentContext()\n const dateFormatter = useDateFormatter()\n const { data } = useWireInRequestsGetSuspense({\n wireInRequestUuid: wireInId,\n })\n const wireInRequest = data.wireInRequest\n\n const { data: payrollsData } = usePayrollsListSuspense({\n companyId,\n processed: true,\n })\n\n const payrollData = payrollsData.payrollList?.find(\n payroll => payroll.payrollUuid === wireInRequest?.paymentUuid,\n )\n const payPeriod = payrollData?.payPeriod\n const payPeriodRange =\n payPeriod?.startDate && payPeriod.endDate\n ? dateFormatter.formatPayPeriodRange(payPeriod.startDate, payPeriod.endDate)\n : undefined\n\n const checkDate = payrollData\n ? dateFormatter.formatShortWithYear(payrollData.checkDate)\n : undefined\n\n const formHandlers = useForm<ConfirmWireDetailsFormValues>({\n resolver: zodResolver(ConfirmWireDetailsFormSchema),\n defaultValues: {\n bankName: '',\n },\n })\n\n const { mutateAsync: submitWireInRequest } = useWireInRequestsSubmitMutation()\n\n const onSubmit = async (data: ConfirmWireDetailsFormValues) => {\n await baseSubmitHandler(data, async innerData => {\n const payload = transformFormDataToPayload(innerData)\n const response = await submitWireInRequest({\n request: {\n wireInRequestUuid: wireInId,\n requestBody: payload,\n },\n })\n onEvent(payrollWireEvents.PAYROLL_WIRE_FORM_DONE, {\n wireInRequest: response.wireInRequest,\n confirmationAlert: {\n title: payPeriodRange\n ? t('confirmationAlert.title', { payrollRange: payPeriodRange })\n : t('confirmationAlert.emptyTitle'),\n content: checkDate ? (\n <Text>{t('confirmationAlert.content', { checkDate })}</Text>\n ) : undefined,\n },\n })\n })\n }\n\n return (\n <Flex flexDirection=\"column\" gap={24}>\n <FlexItem>\n <Heading as=\"h2\">\n <Trans i18nKey=\"title\" t={t} values={{ payrollRange: payPeriodRange }} />\n </Heading>\n <Text>{t('description')}</Text>\n </FlexItem>\n\n <FormProvider {...formHandlers}>\n <HtmlForm\n id={CONFIRM_WIRE_FORM_ID}\n onSubmit={formHandlers.handleSubmit(onSubmit)}\n className={styles.form}\n >\n <Flex flexDirection=\"column\" gap={20}>\n <NumberInputField\n name=\"amountSent\"\n label={t('amountLabel')}\n isRequired\n format=\"currency\"\n errorMessage={t('validations.amount')}\n />\n <DatePickerField\n name=\"dateSent\"\n label={t('dateLabel')}\n isRequired\n errorMessage={t('validations.date')}\n portalContainer={modalContainerRef?.current || undefined}\n />\n <TextInputField\n name=\"bankName\"\n label={t('bankNameLabel')}\n isRequired\n description={t('bankNameDescription')}\n placeholder={t('bankNamePlaceholder')}\n errorMessage={t('validations.bankName')}\n />\n <TextAreaField name=\"additionalNotes\" label={t('notesLabel')} rows={3} />\n </Flex>\n </HtmlForm>\n </FormProvider>\n </Flex>\n )\n}\n\nconst Footer = ({ onEvent }: { onEvent: OnEventType<EventType, unknown> }) => {\n useI18n('Payroll.ConfirmWireDetailsForm')\n const { t } = useTranslation('Payroll.ConfirmWireDetailsForm')\n const { Button } = useComponentContext()\n const isMutating = useIsMutating({\n mutationKey: mutationKeyWireInRequestsSubmit(),\n })\n const isPending = isMutating > 0\n\n return (\n <Flex gap={12} justifyContent=\"space-evenly\">\n <FlexItem flexGrow={1}>\n <Button\n variant=\"secondary\"\n onClick={() => {\n onEvent(payrollWireEvents.PAYROLL_WIRE_FORM_CANCEL)\n }}\n isDisabled={isPending}\n className={styles.button}\n >\n {t('cancelCta')}\n </Button>\n </FlexItem>\n <FlexItem flexGrow={1}>\n <Button\n variant=\"primary\"\n type=\"submit\"\n form={CONFIRM_WIRE_FORM_ID}\n isLoading={isPending}\n className={styles.button}\n >\n {t('submitCta')}\n </Button>\n </FlexItem>\n </Flex>\n )\n}\nConfirmWireDetailsForm.Footer = Footer\n"],"names":["ConfirmWireDetailsFormSchema","z","CONFIRM_WIRE_FORM_ID","transformFormDataToPayload","data","ConfirmWireDetailsForm","props","jsx","BaseComponent","Root","wireInId","companyId","dictionary","modalContainerRef","useComponentDictionary","useI18n","onEvent","baseSubmitHandler","useBase","useTranslation","Heading","Text","useComponentContext","dateFormatter","useDateFormatter","useWireInRequestsGetSuspense","wireInRequest","payrollsData","usePayrollsListSuspense","payrollData","payroll","payPeriod","payPeriodRange","checkDate","formHandlers","useForm","zodResolver","submitWireInRequest","useWireInRequestsSubmitMutation","onSubmit","innerData","payload","response","payrollWireEvents","jsxs","Flex","FlexItem","Trans","FormProvider","HtmlForm","styles","NumberInputField","DatePickerField","TextInputField","TextAreaField","Footer","t","Button","isPending","useIsMutating","mutationKeyWireInRequestsSubmit"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA8BO,MAAMA,IAA+BC,EAAE,OAAO;AAAA,EACnD,YAAYA,EAAE,OAAA,EAAS,SAAA;AAAA,EACvB,UAAUA,EAAE,KAAA;AAAA,EACZ,UAAUA,EAAE,OAAA,EAAS,SAAA;AAAA,EACrB,iBAAiBA,EAAE,OAAA,EAAS,SAAA;AAC9B,CAAC,GAIKC,IAAuB,6BAEvBC,KAA6B,CACjCC,OAEO;AAAA,EACL,YAAY,OAAOA,EAAK,UAAU;AAAA,EAClC,UAAUA,EAAK,SAAS,YAAA,EAAc,MAAM,GAAG,EAAE,CAAC,KAAK;AAAA,EACvD,UAAUA,EAAK;AAAA,EACf,iBAAiBA,EAAK,mBAAmB;AAAA;AAItC,SAASC,GAAuBC,GAAoC;AACzE,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,MAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAEA,MAAMG,KAAO,CAAC;AAAA,EACZ,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,mBAAAC;AACF,MAAmC;AACjC,EAAAC,EAAuB,kCAAkCF,CAAU,GACnEG,EAAQ,gCAAgC;AACxC,QAAM,EAAE,SAAAC,GAAS,mBAAAC,EAAA,IAAsBC,EAAA,GACjC,EAAE,EAAA,IAAMC,EAAe,gCAAgC,GACvD,EAAE,SAAAC,GAAS,MAAAC,EAAA,IAASC,EAAA,GACpBC,IAAgBC,EAAA,GAChB,EAAE,MAAApB,EAAA,IAASqB,EAA6B;AAAA,IAC5C,mBAAmBf;AAAA,EAAA,CACpB,GACKgB,IAAgBtB,EAAK,eAErB,EAAE,MAAMuB,EAAA,IAAiBC,EAAw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E,SAAAvC,QAA4D;AAC5E,EAAAD,EAAQ,gCAAgC;AACxC,QAAM,EAAE,GAAAyC,EAAA,IAAMrC,EAAe,gCAAgC,GACvD,EAAE,QAAAsC,EAAA,IAAWnC,EAAA,GAIboC,IAHaC,EAAc;AAAA,IAC/B,aAAaC,EAAA;AAAA,EAAgC,CAC9C,IAC8B;AAE/B,SACE,gBAAAhB,EAACC,GAAA,EAAK,KAAK,IAAI,gBAAe,gBAC5B,UAAA;AAAA,IAAA,gBAAAtC,EAACuC,GAAA,EAAS,UAAU,GAClB,UAAA,gBAAAvC;AAAA,MAACkD;AAAA,MAAA;AAAA,QACC,SAAQ;AAAA,QACR,SAAS,MAAM;AACb,UAAAzC,EAAQ2B,EAAkB,wBAAwB;AAAA,QACpD;AAAA,QACA,YAAYe;AAAA,QACZ,WAAWR,EAAO;AAAA,QAEjB,YAAE,WAAW;AAAA,MAAA;AAAA,IAAA,GAElB;AAAA,IACA,gBAAA3C,EAACuC,GAAA,EAAS,UAAU,GAClB,UAAA,gBAAAvC;AAAA,MAACkD;AAAA,MAAA;AAAA,QACC,SAAQ;AAAA,QACR,MAAK;AAAA,QACL,MAAMvD;AAAA,QACN,WAAWwD;AAAA,QACX,WAAWR,EAAO;AAAA,QAEjB,YAAE,WAAW;AAAA,MAAA;AAAA,IAAA,EAChB,CACF;AAAA,EAAA,GACF;AAEJ;AACA7C,GAAuB,SAASkD;"}
@@ -1,45 +1,47 @@
1
1
  import { jsx as t } from "react/jsx-runtime";
2
- import { useMemo as f, Suspense as s } from "react";
3
- import { usePayrollsGetSuspense as d } from "@gusto/embedded-api/react-query/payrollsGet";
4
- import { PayrollExecutionFlow as m } from "../PayrollExecutionFlow/PayrollExecutionFlow.js";
5
- import { useFlow as p } from "../../Flow/useFlow.js";
6
- import { ensureRequired as c } from "../../../helpers/ensureRequired.js";
7
- function b() {
8
- return /* @__PURE__ */ t("div", { children: "Off-Cycle Creation placeholder" });
2
+ import { useMemo as m, Suspense as s } from "react";
3
+ import { usePayrollsGetSuspense as p } from "@gusto/embedded-api/react-query/payrollsGet";
4
+ import { PayrollExecutionFlow as y } from "../PayrollExecutionFlow/PayrollExecutionFlow.js";
5
+ import { useFlow as l } from "../../Flow/useFlow.js";
6
+ import { ensureRequired as i } from "../../../helpers/ensureRequired.js";
7
+ import { OffCycleCreation as d } from "../OffCycleCreation/OffCycleCreation.js";
8
+ function h() {
9
+ const { companyId: o, onEvent: e } = l();
10
+ return /* @__PURE__ */ t(d, { companyId: i(o), onEvent: e });
9
11
  }
10
- function E() {
11
- const { companyId: o, payrollUuid: e, onEvent: n, breadcrumbs: r } = p(), l = f(() => {
12
- const i = r?.createOffCyclePayroll?.[0];
13
- return i ? [i] : void 0;
14
- }, [r]), a = c(o), u = c(e);
12
+ function w() {
13
+ const { companyId: o, payrollUuid: e, onEvent: n, breadcrumbs: r } = l(), c = m(() => {
14
+ const a = r?.createOffCyclePayroll?.[0];
15
+ return a ? [a] : void 0;
16
+ }, [r]), f = i(o), u = i(e);
15
17
  return /* @__PURE__ */ t(s, { children: /* @__PURE__ */ t(
16
- y,
18
+ C,
17
19
  {
18
- companyId: a,
20
+ companyId: f,
19
21
  payrollId: u,
20
22
  onEvent: n,
21
- prefixBreadcrumbs: l
23
+ prefixBreadcrumbs: c
22
24
  }
23
25
  ) });
24
26
  }
25
- function y({
27
+ function C({
26
28
  companyId: o,
27
29
  payrollId: e,
28
30
  ...n
29
31
  }) {
30
- const { data: r } = d({ companyId: o, payrollId: e }), l = r.payrollShow?.payPeriod;
32
+ const { data: r } = p({ companyId: o, payrollId: e }), c = r.payrollShow?.payPeriod;
31
33
  return /* @__PURE__ */ t(
32
- m,
34
+ y,
33
35
  {
34
36
  companyId: o,
35
37
  payrollId: e,
36
- initialPayPeriod: l,
38
+ initialPayPeriod: c,
37
39
  ...n
38
40
  }
39
41
  );
40
42
  }
41
43
  export {
42
- b as OffCycleCreationContextual,
43
- E as OffCycleExecutionContextual
44
+ h as OffCycleCreationContextual,
45
+ w as OffCycleExecutionContextual
44
46
  };
45
47
  //# sourceMappingURL=OffCycleFlowComponents.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"OffCycleFlowComponents.js","sources":["../../../../src/components/Payroll/OffCycle/OffCycleFlowComponents.tsx"],"sourcesContent":["import { Suspense, useMemo } from 'react'\nimport { usePayrollsGetSuspense } from '@gusto/embedded-api/react-query/payrollsGet'\nimport {\n PayrollExecutionFlow,\n type PayrollExecutionFlowProps,\n} from '../PayrollExecutionFlow/PayrollExecutionFlow'\nimport { useFlow, type FlowContextInterface } from '@/components/Flow/useFlow'\nimport type { OnEventType } from '@/components/Base/useBase'\nimport type { EventType } from '@/shared/constants'\nimport { ensureRequired } from '@/helpers/ensureRequired'\n\nexport interface OffCycleFlowContextInterface extends FlowContextInterface {\n companyId: string\n payrollUuid?: string\n}\n\nexport interface OffCycleFlowProps {\n companyId: string\n onEvent: OnEventType<EventType, unknown>\n}\n\n// TODO: Wire to OffCycleCreation component in follow-up PR\nexport function OffCycleCreationContextual() {\n return <div>Off-Cycle Creation placeholder</div>\n}\n\nexport function OffCycleExecutionContextual() {\n const { companyId, payrollUuid, onEvent, breadcrumbs } = useFlow<OffCycleFlowContextInterface>()\n\n const prefixBreadcrumbs = useMemo(() => {\n const offCycleCreationBreadcrumb = breadcrumbs?.['createOffCyclePayroll']?.[0]\n return offCycleCreationBreadcrumb ? [offCycleCreationBreadcrumb] : undefined\n }, [breadcrumbs])\n\n const resolvedCompanyId = ensureRequired(companyId)\n const resolvedPayrollId = ensureRequired(payrollUuid)\n\n return (\n <Suspense>\n <OffCycleExecutionWithData\n companyId={resolvedCompanyId}\n payrollId={resolvedPayrollId}\n onEvent={onEvent}\n prefixBreadcrumbs={prefixBreadcrumbs}\n />\n </Suspense>\n )\n}\n\ntype OffCycleExecutionWithDataProps = Pick<\n PayrollExecutionFlowProps,\n 'companyId' | 'payrollId' | 'onEvent' | 'prefixBreadcrumbs'\n>\n\nfunction OffCycleExecutionWithData({\n companyId,\n payrollId,\n ...rest\n}: OffCycleExecutionWithDataProps) {\n const { data } = usePayrollsGetSuspense({ companyId, payrollId })\n const initialPayPeriod = data.payrollShow?.payPeriod\n\n return (\n <PayrollExecutionFlow\n companyId={companyId}\n payrollId={payrollId}\n initialPayPeriod={initialPayPeriod}\n {...rest}\n />\n )\n}\n"],"names":["OffCycleCreationContextual","jsx","OffCycleExecutionContextual","companyId","payrollUuid","onEvent","breadcrumbs","useFlow","prefixBreadcrumbs","useMemo","offCycleCreationBreadcrumb","resolvedCompanyId","ensureRequired","resolvedPayrollId","Suspense","OffCycleExecutionWithData","payrollId","rest","data","usePayrollsGetSuspense","initialPayPeriod","PayrollExecutionFlow"],"mappings":";;;;;;AAsBO,SAASA,IAA6B;AAC3C,SAAO,gBAAAC,EAAC,SAAI,UAAA,iCAAA,CAA8B;AAC5C;AAEO,SAASC,IAA8B;AAC5C,QAAM,EAAE,WAAAC,GAAW,aAAAC,GAAa,SAAAC,GAAS,aAAAC,EAAA,IAAgBC,EAAA,GAEnDC,IAAoBC,EAAQ,MAAM;AACtC,UAAMC,IAA6BJ,GAAc,wBAA2B,CAAC;AAC7E,WAAOI,IAA6B,CAACA,CAA0B,IAAI;AAAA,EACrE,GAAG,CAACJ,CAAW,CAAC,GAEVK,IAAoBC,EAAeT,CAAS,GAC5CU,IAAoBD,EAAeR,CAAW;AAEpD,2BACGU,GAAA,EACC,UAAA,gBAAAb;AAAA,IAACc;AAAA,IAAA;AAAA,MACC,WAAWJ;AAAA,MACX,WAAWE;AAAA,MACX,SAAAR;AAAA,MACA,mBAAAG;AAAA,IAAA;AAAA,EAAA,GAEJ;AAEJ;AAOA,SAASO,EAA0B;AAAA,EACjC,WAAAZ;AAAA,EACA,WAAAa;AAAA,EACA,GAAGC;AACL,GAAmC;AACjC,QAAM,EAAE,MAAAC,EAAA,IAASC,EAAuB,EAAE,WAAAhB,GAAW,WAAAa,GAAW,GAC1DI,IAAmBF,EAAK,aAAa;AAE3C,SACE,gBAAAjB;AAAA,IAACoB;AAAA,IAAA;AAAA,MACC,WAAAlB;AAAA,MACA,WAAAa;AAAA,MACA,kBAAAI;AAAA,MACC,GAAGH;AAAA,IAAA;AAAA,EAAA;AAGV;"}
1
+ {"version":3,"file":"OffCycleFlowComponents.js","sources":["../../../../src/components/Payroll/OffCycle/OffCycleFlowComponents.tsx"],"sourcesContent":["import { Suspense, useMemo } from 'react'\nimport { usePayrollsGetSuspense } from '@gusto/embedded-api/react-query/payrollsGet'\nimport { OffCycleCreation } from '../OffCycleCreation'\nimport {\n PayrollExecutionFlow,\n type PayrollExecutionFlowProps,\n} from '../PayrollExecutionFlow/PayrollExecutionFlow'\nimport { useFlow, type FlowContextInterface } from '@/components/Flow/useFlow'\nimport type { OnEventType } from '@/components/Base/useBase'\nimport type { EventType } from '@/shared/constants'\nimport { ensureRequired } from '@/helpers/ensureRequired'\n\nexport interface OffCycleFlowContextInterface extends FlowContextInterface {\n companyId: string\n payrollUuid?: string\n}\n\nexport interface OffCycleFlowProps {\n companyId: string\n onEvent: OnEventType<EventType, unknown>\n}\n\nexport function OffCycleCreationContextual() {\n const { companyId, onEvent } = useFlow<OffCycleFlowContextInterface>()\n return <OffCycleCreation companyId={ensureRequired(companyId)} onEvent={onEvent} />\n}\n\nexport function OffCycleExecutionContextual() {\n const { companyId, payrollUuid, onEvent, breadcrumbs } = useFlow<OffCycleFlowContextInterface>()\n\n const prefixBreadcrumbs = useMemo(() => {\n const offCycleCreationBreadcrumb = breadcrumbs?.['createOffCyclePayroll']?.[0]\n return offCycleCreationBreadcrumb ? [offCycleCreationBreadcrumb] : undefined\n }, [breadcrumbs])\n\n const resolvedCompanyId = ensureRequired(companyId)\n const resolvedPayrollId = ensureRequired(payrollUuid)\n\n return (\n <Suspense>\n <OffCycleExecutionWithData\n companyId={resolvedCompanyId}\n payrollId={resolvedPayrollId}\n onEvent={onEvent}\n prefixBreadcrumbs={prefixBreadcrumbs}\n />\n </Suspense>\n )\n}\n\ntype OffCycleExecutionWithDataProps = Pick<\n PayrollExecutionFlowProps,\n 'companyId' | 'payrollId' | 'onEvent' | 'prefixBreadcrumbs'\n>\n\nfunction OffCycleExecutionWithData({\n companyId,\n payrollId,\n ...rest\n}: OffCycleExecutionWithDataProps) {\n const { data } = usePayrollsGetSuspense({ companyId, payrollId })\n const initialPayPeriod = data.payrollShow?.payPeriod\n\n return (\n <PayrollExecutionFlow\n companyId={companyId}\n payrollId={payrollId}\n initialPayPeriod={initialPayPeriod}\n {...rest}\n />\n )\n}\n"],"names":["OffCycleCreationContextual","companyId","onEvent","useFlow","OffCycleCreation","ensureRequired","OffCycleExecutionContextual","payrollUuid","breadcrumbs","prefixBreadcrumbs","useMemo","offCycleCreationBreadcrumb","resolvedCompanyId","resolvedPayrollId","Suspense","jsx","OffCycleExecutionWithData","payrollId","rest","data","usePayrollsGetSuspense","initialPayPeriod","PayrollExecutionFlow"],"mappings":";;;;;;;AAsBO,SAASA,IAA6B;AAC3C,QAAM,EAAE,WAAAC,GAAW,SAAAC,EAAA,IAAYC,EAAA;AAC/B,2BAAQC,GAAA,EAAiB,WAAWC,EAAeJ,CAAS,GAAG,SAAAC,GAAkB;AACnF;AAEO,SAASI,IAA8B;AAC5C,QAAM,EAAE,WAAAL,GAAW,aAAAM,GAAa,SAAAL,GAAS,aAAAM,EAAA,IAAgBL,EAAA,GAEnDM,IAAoBC,EAAQ,MAAM;AACtC,UAAMC,IAA6BH,GAAc,wBAA2B,CAAC;AAC7E,WAAOG,IAA6B,CAACA,CAA0B,IAAI;AAAA,EACrE,GAAG,CAACH,CAAW,CAAC,GAEVI,IAAoBP,EAAeJ,CAAS,GAC5CY,IAAoBR,EAAeE,CAAW;AAEpD,2BACGO,GAAA,EACC,UAAA,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,WAAWJ;AAAA,MACX,WAAWC;AAAA,MACX,SAAAX;AAAA,MACA,mBAAAO;AAAA,IAAA;AAAA,EAAA,GAEJ;AAEJ;AAOA,SAASO,EAA0B;AAAA,EACjC,WAAAf;AAAA,EACA,WAAAgB;AAAA,EACA,GAAGC;AACL,GAAmC;AACjC,QAAM,EAAE,MAAAC,EAAA,IAASC,EAAuB,EAAE,WAAAnB,GAAW,WAAAgB,GAAW,GAC1DI,IAAmBF,EAAK,aAAa;AAE3C,SACE,gBAAAJ;AAAA,IAACO;AAAA,IAAA;AAAA,MACC,WAAArB;AAAA,MACA,WAAAgB;AAAA,MACA,kBAAAI;AAAA,MACC,GAAGH;AAAA,IAAA;AAAA,EAAA;AAGV;"}
@@ -0,0 +1,2 @@
1
+ import { OffCycleCreationProps } from './OffCycleCreationTypes';
2
+ export declare function OffCycleCreation(props: OffCycleCreationProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,70 @@
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { useForm as v, FormProvider as w } from "react-hook-form";
3
+ import { zodResolver as A } from "@hookform/resolvers/zod";
4
+ import { z as u } from "zod";
5
+ import { useTranslation as d } from "react-i18next";
6
+ import { usePayrollsCreateOffCycleMutation as L } from "@gusto/embedded-api/react-query/payrollsCreateOffCycle";
7
+ import { OffCycleReason as p } from "@gusto/embedded-api/models/operations/postv1companiescompanyidpayrolls";
8
+ import { RFCDate as i } from "@gusto/embedded-api/types/rfcdate";
9
+ import { createOffCyclePayPeriodDateFormSchema as T } from "../OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormTypes.js";
10
+ import { useOffCyclePayPeriodDateValidation as B } from "../OffCyclePayPeriodDateForm/useOffCyclePayPeriodDateValidation.js";
11
+ import { OffCycleCreationPresentation as g } from "./OffCycleCreationPresentation.js";
12
+ import { BaseComponent as I } from "../../Base/Base.js";
13
+ import { useBase as U } from "../../Base/useBase.js";
14
+ import { useComponentDictionary as V, useI18n as m } from "../../../i18n/I18n.js";
15
+ import { componentEvents as j } from "../../../shared/constants.js";
16
+ import { Form as q } from "../../Common/Form/Form.js";
17
+ import { OFF_CYCLE_REASON_DEFAULTS as x } from "../OffCycleReasonSelection/types.js";
18
+ const z = {
19
+ bonus: p.Bonus,
20
+ correction: p.Correction
21
+ };
22
+ function ae(t) {
23
+ return /* @__PURE__ */ r(I, { ...t, children: /* @__PURE__ */ r(N, { ...t }) });
24
+ }
25
+ function N({ dictionary: t, companyId: O, payrollType: f = "bonus" }) {
26
+ V("Payroll.OffCycleCreation", t), m("Payroll.OffCycleCreation"), m("Payroll.OffCycleReasonSelection"), m("Payroll.OffCyclePayPeriodDateForm");
27
+ const { t: P } = d("Payroll.OffCyclePayPeriodDateForm"), { t: D } = d("Payroll.OffCycleCreation"), { onEvent: h, baseSubmitHandler: k } = U(), { minCheckDate: F, today: R } = B(), { mutateAsync: E, isPending: S } = L(), b = (e) => P(e), y = v({
28
+ resolver: (e, n, a) => {
29
+ const o = e.reason, l = e.isCheckOnly, s = T(
30
+ b,
31
+ o === "correction" ? "correction" : f,
32
+ l ? R : F
33
+ ), c = u.object({ reason: u.enum(["bonus", "correction"]) }).and(s);
34
+ return A(c)(e, n, a);
35
+ },
36
+ defaultValues: {
37
+ reason: f,
38
+ isCheckOnly: !1,
39
+ startDate: null,
40
+ endDate: null,
41
+ checkDate: null
42
+ }
43
+ }), _ = async (e) => {
44
+ const n = e.reason, a = x[n], o = e.checkDate, l = e.isCheckOnly ? o : e.startDate, C = e.isCheckOnly ? o : e.endDate;
45
+ await k(e, async () => {
46
+ const s = await E({
47
+ request: {
48
+ companyId: O,
49
+ requestBody: {
50
+ offCycle: !0,
51
+ offCycleReason: z[n],
52
+ startDate: new i(l),
53
+ endDate: new i(C),
54
+ checkDate: new i(o),
55
+ skipRegularDeductions: a.skipDeductions,
56
+ isCheckOnlyPayroll: e.isCheckOnly
57
+ }
58
+ }
59
+ }), c = s.payrollPrepared?.payrollUuid ?? s.payrollPrepared?.uuid;
60
+ if (!c)
61
+ throw new Error(D("errors.missingPayrollId"));
62
+ h(j.OFF_CYCLE_CREATED, { payrollUuid: c });
63
+ });
64
+ };
65
+ return /* @__PURE__ */ r(w, { ...y, children: /* @__PURE__ */ r(q, { onSubmit: y.handleSubmit(_), children: /* @__PURE__ */ r(g, { isPending: S }) }) });
66
+ }
67
+ export {
68
+ ae as OffCycleCreation
69
+ };
70
+ //# sourceMappingURL=OffCycleCreation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OffCycleCreation.js","sources":["../../../../src/components/Payroll/OffCycleCreation/OffCycleCreation.tsx"],"sourcesContent":["import { FormProvider, useForm, type Resolver } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { z } from 'zod'\nimport { useTranslation } from 'react-i18next'\nimport { usePayrollsCreateOffCycleMutation } from '@gusto/embedded-api/react-query/payrollsCreateOffCycle'\nimport { OffCycleReason as ApiOffCycleReason } from '@gusto/embedded-api/models/operations/postv1companiescompanyidpayrolls'\nimport { RFCDate } from '@gusto/embedded-api/types/rfcdate'\nimport { OFF_CYCLE_REASON_DEFAULTS, type OffCycleReason } from '../OffCycleReasonSelection'\nimport {\n createOffCyclePayPeriodDateFormSchema,\n type OffCyclePayrollDateType,\n} from '../OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormTypes'\nimport { useOffCyclePayPeriodDateValidation } from '../OffCyclePayPeriodDateForm/useOffCyclePayPeriodDateValidation'\nimport type { OffCycleCreationFormData, OffCycleCreationProps } from './OffCycleCreationTypes'\nimport { OffCycleCreationPresentation } from './OffCycleCreationPresentation'\nimport { BaseComponent } from '@/components/Base/Base'\nimport { useBase } from '@/components/Base/useBase'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { Form } from '@/components/Common/Form'\n\nconst LOCAL_TO_API_REASON: Record<OffCycleReason, ApiOffCycleReason> = {\n bonus: ApiOffCycleReason.Bonus,\n correction: ApiOffCycleReason.Correction,\n}\n\nexport function OffCycleCreation(props: OffCycleCreationProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props} />\n </BaseComponent>\n )\n}\n\nfunction Root({ dictionary, companyId, payrollType = 'bonus' }: OffCycleCreationProps) {\n useComponentDictionary('Payroll.OffCycleCreation', dictionary)\n useI18n('Payroll.OffCycleCreation')\n useI18n('Payroll.OffCycleReasonSelection')\n useI18n('Payroll.OffCyclePayPeriodDateForm')\n\n const { t } = useTranslation('Payroll.OffCyclePayPeriodDateForm')\n const { t: tCreation } = useTranslation('Payroll.OffCycleCreation')\n const { onEvent, baseSubmitHandler } = useBase()\n\n const { minCheckDate, today } = useOffCyclePayPeriodDateValidation()\n const { mutateAsync: createOffCyclePayroll, isPending } = usePayrollsCreateOffCycleMutation()\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const translateValidation = (key: string): string => t(key as any) as string\n\n const dynamicResolver: Resolver<OffCycleCreationFormData> = (values, context, options) => {\n const reason = values.reason\n const isCheckOnly = values.isCheckOnly\n const resolvedPayrollType: OffCyclePayrollDateType =\n reason === 'correction' ? 'correction' : payrollType\n\n const dateSchema = createOffCyclePayPeriodDateFormSchema(\n translateValidation,\n resolvedPayrollType,\n isCheckOnly ? today : minCheckDate,\n )\n const schema = z.object({ reason: z.enum(['bonus', 'correction']) }).and(dateSchema)\n\n return zodResolver(schema)(values, context, options)\n }\n\n const methods = useForm<OffCycleCreationFormData>({\n resolver: dynamicResolver,\n defaultValues: {\n reason: payrollType,\n isCheckOnly: false,\n startDate: null,\n endDate: null,\n checkDate: null,\n },\n })\n\n const onSubmit = async (data: OffCycleCreationFormData) => {\n const reason = data.reason\n const defaults = OFF_CYCLE_REASON_DEFAULTS[reason]\n const checkDate = data.checkDate!\n const startDate = data.isCheckOnly ? checkDate : data.startDate!\n const endDate = data.isCheckOnly ? checkDate : data.endDate!\n\n await baseSubmitHandler(data, async () => {\n const response = await createOffCyclePayroll({\n request: {\n companyId,\n requestBody: {\n offCycle: true,\n offCycleReason: LOCAL_TO_API_REASON[reason],\n startDate: new RFCDate(startDate),\n endDate: new RFCDate(endDate),\n checkDate: new RFCDate(checkDate),\n skipRegularDeductions: defaults.skipDeductions,\n isCheckOnlyPayroll: data.isCheckOnly,\n },\n },\n })\n\n const payrollUuid = response.payrollPrepared?.payrollUuid ?? response.payrollPrepared?.uuid\n\n if (!payrollUuid) {\n throw new Error(tCreation('errors.missingPayrollId'))\n }\n\n onEvent(componentEvents.OFF_CYCLE_CREATED, { payrollUuid })\n })\n }\n\n return (\n <FormProvider {...methods}>\n <Form onSubmit={methods.handleSubmit(onSubmit)}>\n <OffCycleCreationPresentation isPending={isPending} />\n </Form>\n </FormProvider>\n )\n}\n"],"names":["LOCAL_TO_API_REASON","ApiOffCycleReason","OffCycleCreation","props","jsx","BaseComponent","Root","dictionary","companyId","payrollType","useComponentDictionary","useI18n","t","useTranslation","tCreation","onEvent","baseSubmitHandler","useBase","minCheckDate","today","useOffCyclePayPeriodDateValidation","createOffCyclePayroll","isPending","usePayrollsCreateOffCycleMutation","translateValidation","key","methods","useForm","values","context","options","reason","isCheckOnly","dateSchema","createOffCyclePayPeriodDateFormSchema","schema","z","zodResolver","onSubmit","data","defaults","OFF_CYCLE_REASON_DEFAULTS","checkDate","startDate","endDate","response","RFCDate","payrollUuid","componentEvents","FormProvider","Form","OffCycleCreationPresentation"],"mappings":";;;;;;;;;;;;;;;;;AAqBA,MAAMA,IAAiE;AAAA,EACrE,OAAOC,EAAkB;AAAA,EACzB,YAAYA,EAAkB;AAChC;AAEO,SAASC,GAAiBC,GAA8B;AAC7D,SACE,gBAAAC,EAACC,KAAe,GAAGF,GACjB,4BAACG,GAAA,EAAM,GAAGH,GAAO,EAAA,CACnB;AAEJ;AAEA,SAASG,EAAK,EAAE,YAAAC,GAAY,WAAAC,GAAW,aAAAC,IAAc,WAAkC;AACrF,EAAAC,EAAuB,4BAA4BH,CAAU,GAC7DI,EAAQ,0BAA0B,GAClCA,EAAQ,iCAAiC,GACzCA,EAAQ,mCAAmC;AAE3C,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,mCAAmC,GAC1D,EAAE,GAAGC,MAAcD,EAAe,0BAA0B,GAC5D,EAAE,SAAAE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YAChC,oBAAoBD,EAAK;AAAA,UAAA;AAAA,QAC3B;AAAA,MACF,CACD,GAEKQ,IAAcF,EAAS,iBAAiB,eAAeA,EAAS,iBAAiB;AAEvF,UAAI,CAACE;AACH,cAAM,IAAI,MAAMjC,EAAU,yBAAyB,CAAC;AAGtD,MAAAC,EAAQiC,EAAgB,mBAAmB,EAAE,aAAAD,EAAA,CAAa;AAAA,IAC5D,CAAC;AAAA,EACH;AAEA,SACE,gBAAA3C,EAAC6C,GAAA,EAAc,GAAGvB,GAChB,4BAACwB,GAAA,EAAK,UAAUxB,EAAQ,aAAaY,CAAQ,GAC3C,UAAA,gBAAAlC,EAAC+C,GAAA,EAA6B,WAAA7B,EAAA,CAAsB,GACtD,GACF;AAEJ;"}
@@ -0,0 +1,2 @@
1
+ import { OffCycleCreationPresentationProps } from './OffCycleCreationTypes';
2
+ export declare function OffCycleCreationPresentation({ isPending }: OffCycleCreationPresentationProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,25 @@
1
+ import { jsxs as i, jsx as e } from "react/jsx-runtime";
2
+ import { useTranslation as c } from "react-i18next";
3
+ import { OffCyclePayPeriodDateFormPresentation as f } from "../OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.js";
4
+ import { useI18n as m } from "../../../i18n/I18n.js";
5
+ import { useComponentContext as p } from "../../../contexts/ComponentAdapter/useComponentContext.js";
6
+ import { Flex as o } from "../../Common/Flex/Flex.js";
7
+ import "react";
8
+ import { OffCycleReasonSelectionPresentation as s } from "../OffCycleReasonSelection/OffCycleReasonSelectionPresentation.js";
9
+ function P({ isPending: t }) {
10
+ m("Payroll.OffCycleCreation");
11
+ const { t: n } = c("Payroll.OffCycleCreation"), { Heading: r, Text: l, Button: a } = p();
12
+ return /* @__PURE__ */ i(o, { flexDirection: "column", gap: 32, children: [
13
+ /* @__PURE__ */ i(o, { flexDirection: "column", gap: 4, children: [
14
+ /* @__PURE__ */ e(r, { as: "h2", children: n("pageTitle") }),
15
+ /* @__PURE__ */ e(l, { variant: "supporting", children: n("pageDescription") })
16
+ ] }),
17
+ /* @__PURE__ */ e(o, { flexDirection: "column", gap: 20, children: /* @__PURE__ */ e(f, {}) }),
18
+ /* @__PURE__ */ e(o, { flexDirection: "column", gap: 20, children: /* @__PURE__ */ e(s, { name: "reason" }) }),
19
+ /* @__PURE__ */ e(o, { justifyContent: "flex-end", gap: 12, children: /* @__PURE__ */ e(a, { type: "submit", isLoading: t, isDisabled: t, children: n("continueCta") }) })
20
+ ] });
21
+ }
22
+ export {
23
+ P as OffCycleCreationPresentation
24
+ };
25
+ //# sourceMappingURL=OffCycleCreationPresentation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OffCycleCreationPresentation.js","sources":["../../../../src/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { OffCycleReasonSelectionPresentation } from '../OffCycleReasonSelection'\nimport { OffCyclePayPeriodDateFormPresentation } from '../OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation'\nimport type { OffCycleCreationPresentationProps } from './OffCycleCreationTypes'\nimport { useI18n } from '@/i18n'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { Flex } from '@/components/Common'\n\nexport function OffCycleCreationPresentation({ isPending }: OffCycleCreationPresentationProps) {\n useI18n('Payroll.OffCycleCreation')\n const { t } = useTranslation('Payroll.OffCycleCreation')\n const { Heading, Text, Button } = useComponentContext()\n\n return (\n <Flex flexDirection=\"column\" gap={32}>\n <Flex flexDirection=\"column\" gap={4}>\n <Heading as=\"h2\">{t('pageTitle')}</Heading>\n <Text variant=\"supporting\">{t('pageDescription')}</Text>\n </Flex>\n\n <Flex flexDirection=\"column\" gap={20}>\n <OffCyclePayPeriodDateFormPresentation />\n </Flex>\n\n <Flex flexDirection=\"column\" gap={20}>\n <OffCycleReasonSelectionPresentation name=\"reason\" />\n </Flex>\n\n {/* TODO: EmployeeSelection section — will compose EmployeeSelectionPresentation */}\n\n {/* TODO: Deductions section — will compose DeductionsPresentation */}\n\n {/* TODO: TaxWithholdingRates section — will compose TaxWithholdingRatesPresentation */}\n\n <Flex justifyContent=\"flex-end\" gap={12}>\n <Button type=\"submit\" isLoading={isPending} isDisabled={isPending}>\n {t('continueCta')}\n </Button>\n </Flex>\n </Flex>\n )\n}\n"],"names":["OffCycleCreationPresentation","isPending","useI18n","t","useTranslation","Heading","Text","Button","useComponentContext","jsxs","Flex","jsx","OffCyclePayPeriodDateFormPresentation","OffCycleReasonSelectionPresentation"],"mappings":";;;;;;;;AAQO,SAASA,EAA6B,EAAE,WAAAC,KAAgD;AAC7F,EAAAC,EAAQ,0BAA0B;AAClC,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,0BAA0B,GACjD,EAAE,SAAAC,GAAS,MAAAC,GAAM,QAAAC,EAAA,IAAWC,EAAA;AAElC,SACE,gBAAAC,EAACC,GAAA,EAAK,eAAc,UAAS,KAAK,IAChC,UAAA;AAAA,IAAA,gBAAAD,EAACC,GAAA,EAAK,eAAc,UAAS,KAAK,GAChC,UAAA;AAAA,MAAA,gBAAAC,EAACN,GAAA,EAAQ,IAAG,MAAM,UAAAF,EAAE,WAAW,GAAE;AAAA,wBAChCG,GAAA,EAAK,SAAQ,cAAc,UAAAH,EAAE,iBAAiB,EAAA,CAAE;AAAA,IAAA,GACnD;AAAA,IAEA,gBAAAQ,EAACD,KAAK,eAAc,UAAS,KAAK,IAChC,UAAA,gBAAAC,EAACC,KAAsC,EAAA,CACzC;AAAA,IAEA,gBAAAD,EAACD,GAAA,EAAK,eAAc,UAAS,KAAK,IAChC,UAAA,gBAAAC,EAACE,GAAA,EAAoC,MAAK,SAAA,CAAS,EAAA,CACrD;AAAA,sBAQCH,GAAA,EAAK,gBAAe,YAAW,KAAK,IACnC,UAAA,gBAAAC,EAACJ,GAAA,EAAO,MAAK,UAAS,WAAWN,GAAW,YAAYA,GACrD,UAAAE,EAAE,aAAa,GAClB,EAAA,CACF;AAAA,EAAA,GACF;AAEJ;"}
@@ -0,0 +1,13 @@
1
+ import { OffCycleReason } from '../OffCycleReasonSelection';
2
+ import { OffCyclePayPeriodDateFormData, OffCyclePayrollDateType } from '../OffCyclePayPeriodDateForm';
3
+ import { BaseComponentInterface } from '../../Base/Base';
4
+ export interface OffCycleCreationProps extends BaseComponentInterface<'Payroll.OffCycleCreation'> {
5
+ companyId: string;
6
+ payrollType?: OffCyclePayrollDateType;
7
+ }
8
+ export interface OffCycleCreationFormData extends OffCyclePayPeriodDateFormData {
9
+ reason: OffCycleReason;
10
+ }
11
+ export interface OffCycleCreationPresentationProps {
12
+ isPending?: boolean;
13
+ }
@@ -0,0 +1,3 @@
1
+ import "./types/i18next.d.ts"
2
+ export { OffCycleCreation } from './OffCycleCreation';
3
+ export type { OffCycleCreationProps, OffCycleCreationFormData, OffCycleCreationPresentationProps, } from './OffCycleCreationTypes';
@@ -0,0 +1,2 @@
1
+ import { OffCycleDeductionsSettingProps } from './types';
2
+ export declare function OffCycleDeductionsSetting({ dictionary, offCycleReason, onEvent, }: OffCycleDeductionsSettingProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,50 @@
1
+ import { jsx as f } from "react/jsx-runtime";
2
+ import { useState as C, useEffect as D, useMemo as k } from "react";
3
+ import { useTranslation as S } from "react-i18next";
4
+ import { useComponentDictionary as g, useI18n as E } from "../../../i18n/I18n.js";
5
+ import { componentEvents as O } from "../../../shared/constants.js";
6
+ import { useComponentContext as y } from "../../../contexts/ComponentAdapter/useComponentContext.js";
7
+ import { OFF_CYCLE_REASON_DEFAULTS as n } from "../OffCycleReasonSelection/types.js";
8
+ function L({
9
+ dictionary: s,
10
+ offCycleReason: e,
11
+ onEvent: l
12
+ }) {
13
+ g("Payroll.OffCycleDeductionsSetting", s), E("Payroll.OffCycleDeductionsSetting");
14
+ const { t } = S("Payroll.OffCycleDeductionsSetting"), { RadioGroup: u } = y(), c = n[e].skipDeductions, [p, o] = C(c);
15
+ D(() => {
16
+ o(n[e].skipDeductions);
17
+ }, [e]);
18
+ const r = k(
19
+ () => [
20
+ {
21
+ value: "include",
22
+ label: t("options.include.label")
23
+ },
24
+ {
25
+ value: "skip",
26
+ label: t("options.skip.label")
27
+ }
28
+ ],
29
+ [t]
30
+ ), a = (m) => {
31
+ const i = m === "skip";
32
+ o(i), l(O.OFF_CYCLE_DEDUCTIONS_CHANGE, {
33
+ skipRegularDeductions: i
34
+ });
35
+ }, d = p ? "skip" : "include";
36
+ return /* @__PURE__ */ f(
37
+ u,
38
+ {
39
+ label: t("title"),
40
+ description: t("description"),
41
+ options: r,
42
+ value: d,
43
+ onChange: a
44
+ }
45
+ );
46
+ }
47
+ export {
48
+ L as OffCycleDeductionsSetting
49
+ };
50
+ //# sourceMappingURL=OffCycleDeductionsSetting.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OffCycleDeductionsSetting.js","sources":["../../../../src/components/Payroll/OffCycleDeductionsSetting/OffCycleDeductionsSetting.tsx"],"sourcesContent":["import { useEffect, useMemo, useState } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { OFF_CYCLE_REASON_DEFAULTS } from '../OffCycleReasonSelection'\nimport type { OffCycleDeductionsSettingProps } from './types'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\ntype DeductionsValue = 'include' | 'skip'\n\nexport function OffCycleDeductionsSetting({\n dictionary,\n offCycleReason,\n onEvent,\n}: OffCycleDeductionsSettingProps) {\n useComponentDictionary('Payroll.OffCycleDeductionsSetting', dictionary)\n useI18n('Payroll.OffCycleDeductionsSetting')\n\n const { t } = useTranslation('Payroll.OffCycleDeductionsSetting')\n const { RadioGroup } = useComponentContext()\n\n const defaultSkip = OFF_CYCLE_REASON_DEFAULTS[offCycleReason].skipDeductions\n const [skipRegularDeductions, setSkipRegularDeductions] = useState(defaultSkip)\n\n useEffect(() => {\n setSkipRegularDeductions(OFF_CYCLE_REASON_DEFAULTS[offCycleReason].skipDeductions)\n }, [offCycleReason])\n\n const options = useMemo(\n () => [\n {\n value: 'include' as const,\n label: t('options.include.label'),\n },\n {\n value: 'skip' as const,\n label: t('options.skip.label'),\n },\n ],\n [t],\n )\n\n const handleChange = (value: string) => {\n const shouldSkip = value === 'skip'\n setSkipRegularDeductions(shouldSkip)\n onEvent(componentEvents.OFF_CYCLE_DEDUCTIONS_CHANGE, {\n skipRegularDeductions: shouldSkip,\n })\n }\n\n const selectedValue: DeductionsValue = skipRegularDeductions ? 'skip' : 'include'\n\n return (\n <RadioGroup\n label={t('title')}\n description={t('description')}\n options={options}\n value={selectedValue}\n onChange={handleChange}\n />\n )\n}\n"],"names":["OffCycleDeductionsSetting","dictionary","offCycleReason","onEvent","useComponentDictionary","useI18n","useTranslation","RadioGroup","useComponentContext","defaultSkip","OFF_CYCLE_REASON_DEFAULTS","skipRegularDeductions","setSkipRegularDeductions","useState","useEffect","options","useMemo","handleChange","value","shouldSkip","componentEvents","selectedValue","jsx"],"mappings":";;;;;;;AAUO,SAASA,EAA0B;AAAA,EACxC,YAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,SAAAC;AACF,GAAmC;AACjC,EAAAC,EAAuB,qCAAqCH,CAAU,GACtEI,EAAQ,mCAAmC;AAE3C,QAAM,EAAE,EAAA,IAAMC,EAAe,mCAAmC,GAC1D,EAAE,YAAAC,EAAA,IAAeC,EAAA,GAEjBC,IAAcC,EAA0BR,CAAc,EAAE,gBACxD,CAACS,GAAuBC,CAAwB,IAAIC,EAASJ,CAAW;AAE9E,EAAAK,EAAU,MAAM;AACd,IAAAF,EAAyBF,EAA0BR,CAAc,EAAE,cAAc;AAAA,EACnF,GAAG,CAACA,CAAc,CAAC;AAEnB,QAAMa,IAAUC;AAAA,IACd,MAAM;AAAA,MACJ;AAAA,QACE,OAAO;AAAA,QACP,OAAO,EAAE,uBAAuB;AAAA,MAAA;AAAA,MAElC;AAAA,QACE,OAAO;AAAA,QACP,OAAO,EAAE,oBAAoB;AAAA,MAAA;AAAA,IAC/B;AAAA,IAEF,CAAC,CAAC;AAAA,EAAA,GAGEC,IAAe,CAACC,MAAkB;AACtC,UAAMC,IAAaD,MAAU;AAC7B,IAAAN,EAAyBO,CAAU,GACnChB,EAAQiB,EAAgB,6BAA6B;AAAA,MACnD,uBAAuBD;AAAA,IAAA,CACxB;AAAA,EACH,GAEME,IAAiCV,IAAwB,SAAS;AAExE,SACE,gBAAAW;AAAA,IAACf;AAAA,IAAA;AAAA,MACC,OAAO,EAAE,OAAO;AAAA,MAChB,aAAa,EAAE,aAAa;AAAA,MAC5B,SAAAQ;AAAA,MACA,OAAOM;AAAA,MACP,UAAUJ;AAAA,IAAA;AAAA,EAAA;AAGhB;"}
@@ -0,0 +1,3 @@
1
+ import "./types/i18next.d.ts"
2
+ export { OffCycleDeductionsSetting } from './OffCycleDeductionsSetting';
3
+ export type { OffCycleDeductionsSettingProps, OffCycleDeductionsSettingChangePayload, } from './types';
@@ -0,0 +1,11 @@
1
+ import { OffCycleReason } from '../OffCycleReasonSelection';
2
+ import { CommonComponentInterface } from '../../Base/Base';
3
+ import { OnEventType } from '../../Base/useBase';
4
+ import { EventType } from '../../../shared/constants';
5
+ export interface OffCycleDeductionsSettingProps extends CommonComponentInterface<'Payroll.OffCycleDeductionsSetting'> {
6
+ offCycleReason: OffCycleReason;
7
+ onEvent: OnEventType<EventType, unknown>;
8
+ }
9
+ export interface OffCycleDeductionsSettingChangePayload {
10
+ skipRegularDeductions: boolean;
11
+ }
@@ -1,2 +1 @@
1
- import { OffCyclePayPeriodDateFormPresentationProps } from './OffCyclePayPeriodDateFormTypes';
2
- export declare function OffCyclePayPeriodDateFormPresentation({ isCheckOnly, onCheckOnlyChange, }: OffCyclePayPeriodDateFormPresentationProps): import("react/jsx-runtime").JSX.Element;
1
+ export declare function OffCyclePayPeriodDateFormPresentation(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,36 @@
1
+ import { jsxs as o, jsx as t } from "react/jsx-runtime";
2
+ import { useFormContext as m, useWatch as d } from "react-hook-form";
3
+ import { useTranslation as h } from "react-i18next";
4
+ import a from "./OffCyclePayPeriodDateFormPresentation.module.scss.js";
5
+ import { useI18n as f } from "../../../i18n/I18n.js";
6
+ import "../../../shared/constants.js";
7
+ import "../../../contexts/ComponentAdapter/useComponentContext.js";
8
+ import "react";
9
+ import { CheckboxField as u } from "../../Common/Fields/CheckboxField/CheckboxField.js";
10
+ import { DatePickerField as r } from "../../Common/Fields/DatePickerField/DatePickerField.js";
11
+ function L() {
12
+ f("Payroll.OffCyclePayPeriodDateForm");
13
+ const { t: e } = h("Payroll.OffCyclePayPeriodDateForm"), { control: i, setValue: l } = m(), n = d({ control: i, name: "isCheckOnly" }), c = (s) => {
14
+ s && (l("startDate", null), l("endDate", null));
15
+ };
16
+ return /* @__PURE__ */ o("div", { className: a.root, children: [
17
+ !n && /* @__PURE__ */ o("div", { className: a.dateFields, children: [
18
+ /* @__PURE__ */ t(r, { name: "startDate", label: e("startDateLabel"), isRequired: !0 }),
19
+ /* @__PURE__ */ t(r, { name: "endDate", label: e("endDateLabel"), isRequired: !0 })
20
+ ] }),
21
+ /* @__PURE__ */ t("div", { className: a.checkDateField, children: /* @__PURE__ */ t(r, { name: "checkDate", label: e("checkDateLabel"), isRequired: !0 }) }),
22
+ /* @__PURE__ */ t(
23
+ u,
24
+ {
25
+ name: "isCheckOnly",
26
+ label: e("checkOnlyLabel"),
27
+ description: e("checkOnlyDescription"),
28
+ onChange: c
29
+ }
30
+ )
31
+ ] });
32
+ }
33
+ export {
34
+ L as OffCyclePayPeriodDateFormPresentation
35
+ };
36
+ //# sourceMappingURL=OffCyclePayPeriodDateFormPresentation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OffCyclePayPeriodDateFormPresentation.js","sources":["../../../../src/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.tsx"],"sourcesContent":["import { useFormContext, useWatch } from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport styles from './OffCyclePayPeriodDateFormPresentation.module.scss'\nimport type { OffCyclePayPeriodDateFormData } from './OffCyclePayPeriodDateFormTypes'\nimport { useI18n } from '@/i18n'\nimport { CheckboxField, DatePickerField } from '@/components/Common'\n\nexport function OffCyclePayPeriodDateFormPresentation() {\n useI18n('Payroll.OffCyclePayPeriodDateForm')\n const { t } = useTranslation('Payroll.OffCyclePayPeriodDateForm')\n const { control, setValue } = useFormContext<OffCyclePayPeriodDateFormData>()\n const isCheckOnly = useWatch({ control, name: 'isCheckOnly' })\n\n const handleCheckOnlyChange = (checked: boolean) => {\n if (checked) {\n setValue('startDate', null)\n setValue('endDate', null)\n }\n }\n\n return (\n <div className={styles.root}>\n {!isCheckOnly && (\n <div className={styles.dateFields}>\n <DatePickerField name=\"startDate\" label={t('startDateLabel')} isRequired />\n <DatePickerField name=\"endDate\" label={t('endDateLabel')} isRequired />\n </div>\n )}\n\n <div className={styles.checkDateField}>\n <DatePickerField name=\"checkDate\" label={t('checkDateLabel')} isRequired />\n </div>\n\n <CheckboxField\n name=\"isCheckOnly\"\n label={t('checkOnlyLabel')}\n description={t('checkOnlyDescription')}\n onChange={handleCheckOnlyChange}\n />\n </div>\n )\n}\n"],"names":["OffCyclePayPeriodDateFormPresentation","useI18n","t","useTranslation","control","setValue","useFormContext","isCheckOnly","useWatch","handleCheckOnlyChange","checked","jsxs","styles","jsx","DatePickerField","CheckboxField"],"mappings":";;;;;;;;;;AAOO,SAASA,IAAwC;AACtD,EAAAC,EAAQ,mCAAmC;AAC3C,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,mCAAmC,GAC1D,EAAE,SAAAC,GAAS,UAAAC,EAAA,IAAaC,EAAA,GACxBC,IAAcC,EAAS,EAAE,SAAAJ,GAAS,MAAM,eAAe,GAEvDK,IAAwB,CAACC,MAAqB;AAClD,IAAIA,MACFL,EAAS,aAAa,IAAI,GAC1BA,EAAS,WAAW,IAAI;AAAA,EAE5B;AAEA,SACE,gBAAAM,EAAC,OAAA,EAAI,WAAWC,EAAO,MACpB,UAAA;AAAA,IAAA,CAACL,KACA,gBAAAI,EAAC,OAAA,EAAI,WAAWC,EAAO,YACrB,UAAA;AAAA,MAAA,gBAAAC,EAACC,GAAA,EAAgB,MAAK,aAAY,OAAOZ,EAAE,gBAAgB,GAAG,YAAU,IAAC;AAAA,MACzE,gBAAAW,EAACC,KAAgB,MAAK,WAAU,OAAOZ,EAAE,cAAc,GAAG,YAAU,GAAA,CAAC;AAAA,IAAA,GACvE;AAAA,IAGF,gBAAAW,EAAC,OAAA,EAAI,WAAWD,EAAO,gBACrB,UAAA,gBAAAC,EAACC,GAAA,EAAgB,MAAK,aAAY,OAAOZ,EAAE,gBAAgB,GAAG,YAAU,IAAC,GAC3E;AAAA,IAEA,gBAAAW;AAAA,MAACE;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,OAAOb,EAAE,gBAAgB;AAAA,QACzB,aAAaA,EAAE,sBAAsB;AAAA,QACrC,UAAUO;AAAA,MAAA;AAAA,IAAA;AAAA,EACZ,GACF;AAEJ;"}
@@ -0,0 +1,12 @@
1
+ const e = "_root_erc2u_1", t = "_dateFields_erc2u_7", c = "_checkDateField_erc2u_16", o = {
2
+ root: e,
3
+ dateFields: t,
4
+ checkDateField: c
5
+ };
6
+ export {
7
+ c as checkDateField,
8
+ t as dateFields,
9
+ o as default,
10
+ e as root
11
+ };
12
+ //# sourceMappingURL=OffCyclePayPeriodDateFormPresentation.module.scss.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OffCyclePayPeriodDateFormPresentation.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
@@ -1,9 +1,5 @@
1
1
  import { z } from 'zod';
2
2
  export type OffCyclePayrollDateType = 'bonus' | 'correction';
3
- export interface OffCyclePayPeriodDateFormPresentationProps {
4
- isCheckOnly: boolean;
5
- onCheckOnlyChange: (value: boolean) => void;
6
- }
7
3
  export interface OffCyclePayPeriodDateFormData {
8
4
  isCheckOnly: boolean;
9
5
  startDate: Date | null;
@@ -0,0 +1,48 @@
1
+ import { z as s } from "zod";
2
+ const r = (t, c, i) => s.object({
3
+ isCheckOnly: s.boolean(),
4
+ startDate: s.date().nullable(),
5
+ endDate: s.date().nullable(),
6
+ checkDate: s.date().nullable()
7
+ }).superRefine((e, a) => {
8
+ if (!e.isCheckOnly && (e.startDate || a.addIssue({
9
+ code: s.ZodIssueCode.custom,
10
+ path: ["startDate"],
11
+ message: t("validations.startDateRequired")
12
+ }), e.endDate || a.addIssue({
13
+ code: s.ZodIssueCode.custom,
14
+ path: ["endDate"],
15
+ message: t("validations.endDateRequired")
16
+ }), e.startDate && e.endDate && e.endDate < e.startDate && a.addIssue({
17
+ code: s.ZodIssueCode.custom,
18
+ path: ["endDate"],
19
+ message: t("validations.endDateAfterStart")
20
+ }), c === "correction" && e.startDate)) {
21
+ const o = /* @__PURE__ */ new Date();
22
+ o.setHours(0, 0, 0, 0), e.startDate > o && a.addIssue({
23
+ code: s.ZodIssueCode.custom,
24
+ path: ["startDate"],
25
+ message: t("validations.startDateNotFuture")
26
+ });
27
+ }
28
+ if (!e.checkDate)
29
+ a.addIssue({
30
+ code: s.ZodIssueCode.custom,
31
+ path: ["checkDate"],
32
+ message: t("validations.checkDateRequired")
33
+ });
34
+ else if (!e.isCheckOnly) {
35
+ const o = new Date(e.checkDate);
36
+ o.setHours(0, 0, 0, 0);
37
+ const d = new Date(i);
38
+ d.setHours(0, 0, 0, 0), o < d && a.addIssue({
39
+ code: s.ZodIssueCode.custom,
40
+ path: ["checkDate"],
41
+ message: t("validations.checkDateAchLeadTime")
42
+ });
43
+ }
44
+ });
45
+ export {
46
+ r as createOffCyclePayPeriodDateFormSchema
47
+ };
48
+ //# sourceMappingURL=OffCyclePayPeriodDateFormTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OffCyclePayPeriodDateFormTypes.js","sources":["../../../../src/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormTypes.ts"],"sourcesContent":["import { z } from 'zod'\n\nexport type OffCyclePayrollDateType = 'bonus' | 'correction'\n\nexport interface OffCyclePayPeriodDateFormData {\n isCheckOnly: boolean\n startDate: Date | null\n endDate: Date | null\n checkDate: Date | null\n}\n\nexport const createOffCyclePayPeriodDateFormSchema = (\n t: (key: string) => string,\n payrollType: OffCyclePayrollDateType,\n minCheckDate: Date,\n) => {\n return z\n .object({\n isCheckOnly: z.boolean(),\n startDate: z.date().nullable(),\n endDate: z.date().nullable(),\n checkDate: z.date().nullable(),\n })\n .superRefine((data, ctx) => {\n if (!data.isCheckOnly) {\n if (!data.startDate) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['startDate'],\n message: t('validations.startDateRequired'),\n })\n }\n\n if (!data.endDate) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['endDate'],\n message: t('validations.endDateRequired'),\n })\n }\n\n if (data.startDate && data.endDate && data.endDate < data.startDate) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['endDate'],\n message: t('validations.endDateAfterStart'),\n })\n }\n\n if (payrollType === 'correction' && data.startDate) {\n const today = new Date()\n today.setHours(0, 0, 0, 0)\n if (data.startDate > today) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['startDate'],\n message: t('validations.startDateNotFuture'),\n })\n }\n }\n }\n\n if (!data.checkDate) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['checkDate'],\n message: t('validations.checkDateRequired'),\n })\n } else if (!data.isCheckOnly) {\n const checkDateNormalized = new Date(data.checkDate)\n checkDateNormalized.setHours(0, 0, 0, 0)\n const minCheckDateNormalized = new Date(minCheckDate)\n minCheckDateNormalized.setHours(0, 0, 0, 0)\n\n if (checkDateNormalized < minCheckDateNormalized) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['checkDate'],\n message: t('validations.checkDateAchLeadTime'),\n })\n }\n }\n })\n}\n\nexport type OffCyclePayPeriodDateFormSchema = ReturnType<\n typeof createOffCyclePayPeriodDateFormSchema\n>\n"],"names":["createOffCyclePayPeriodDateFormSchema","payrollType","minCheckDate","z","data","ctx","today","checkDateNormalized","minCheckDateNormalized"],"mappings":";AAWO,MAAMA,IAAwC,CACnD,GACAC,GACAC,MAEOC,EACJ,OAAO;AAAA,EACN,aAAaA,EAAE,QAAA;AAAA,EACf,WAAWA,EAAE,KAAA,EAAO,SAAA;AAAA,EACpB,SAASA,EAAE,KAAA,EAAO,SAAA;AAAA,EAClB,WAAWA,EAAE,KAAA,EAAO,SAAA;AAAS,CAC9B,EACA,YAAY,CAACC,GAAMC,MAAQ;AAC1B,MAAI,CAACD,EAAK,gBACHA,EAAK,aACRC,EAAI,SAAS;AAAA,IACX,MAAMF,EAAE,aAAa;AAAA,IACrB,MAAM,CAAC,WAAW;AAAA,IAClB,SAAS,EAAE,+BAA+B;AAAA,EAAA,CAC3C,GAGEC,EAAK,WACRC,EAAI,SAAS;AAAA,IACX,MAAMF,EAAE,aAAa;AAAA,IACrB,MAAM,CAAC,SAAS;AAAA,IAChB,SAAS,EAAE,6BAA6B;AAAA,EAAA,CACzC,GAGCC,EAAK,aAAaA,EAAK,WAAWA,EAAK,UAAUA,EAAK,aACxDC,EAAI,SAAS;AAAA,IACX,MAAMF,EAAE,aAAa;AAAA,IACrB,MAAM,CAAC,SAAS;AAAA,IAChB,SAAS,EAAE,+BAA+B;AAAA,EAAA,CAC3C,GAGCF,MAAgB,gBAAgBG,EAAK,YAAW;AAClD,UAAME,wBAAY,KAAA;AAClB,IAAAA,EAAM,SAAS,GAAG,GAAG,GAAG,CAAC,GACrBF,EAAK,YAAYE,KACnBD,EAAI,SAAS;AAAA,MACX,MAAMF,EAAE,aAAa;AAAA,MACrB,MAAM,CAAC,WAAW;AAAA,MAClB,SAAS,EAAE,gCAAgC;AAAA,IAAA,CAC5C;AAAA,EAEL;AAGF,MAAI,CAACC,EAAK;AACR,IAAAC,EAAI,SAAS;AAAA,MACX,MAAMF,EAAE,aAAa;AAAA,MACrB,MAAM,CAAC,WAAW;AAAA,MAClB,SAAS,EAAE,+BAA+B;AAAA,IAAA,CAC3C;AAAA,WACQ,CAACC,EAAK,aAAa;AAC5B,UAAMG,IAAsB,IAAI,KAAKH,EAAK,SAAS;AACnD,IAAAG,EAAoB,SAAS,GAAG,GAAG,GAAG,CAAC;AACvC,UAAMC,IAAyB,IAAI,KAAKN,CAAY;AACpD,IAAAM,EAAuB,SAAS,GAAG,GAAG,GAAG,CAAC,GAEtCD,IAAsBC,KACxBH,EAAI,SAAS;AAAA,MACX,MAAMF,EAAE,aAAa;AAAA,MACrB,MAAM,CAAC,WAAW;AAAA,MAClB,SAAS,EAAE,kCAAkC;AAAA,IAAA,CAC9C;AAAA,EAEL;AACF,CAAC;"}
@@ -0,0 +1,18 @@
1
+ import { useMemo as o } from "react";
2
+ import { addBusinessDays as r } from "../../../helpers/dateFormatting.js";
3
+ const s = 2;
4
+ function u() {
5
+ const e = o(() => {
6
+ const t = /* @__PURE__ */ new Date();
7
+ return t.setHours(0, 0, 0, 0), t;
8
+ }, []), n = o(() => r(e, s), [e]);
9
+ return {
10
+ today: e,
11
+ minCheckDate: n,
12
+ achLeadTimeBusinessDays: s
13
+ };
14
+ }
15
+ export {
16
+ u as useOffCyclePayPeriodDateValidation
17
+ };
18
+ //# sourceMappingURL=useOffCyclePayPeriodDateValidation.js.map