@gusto/embedded-react-sdk 0.48.2 → 0.48.3

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 (371) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/components/Company/AssignSignatory/AssignSignatory.d.ts +33 -2
  3. package/dist/components/Company/AssignSignatory/AssignSignatory.js.map +1 -1
  4. package/dist/components/Company/AssignSignatory/AssignSignatorySelection.d.ts +1 -0
  5. package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js.map +1 -1
  6. package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.d.ts +1 -0
  7. package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js.map +1 -1
  8. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.d.ts +23 -2
  9. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js.map +1 -1
  10. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.d.ts +2 -0
  11. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js.map +1 -1
  12. package/dist/components/Company/AssignSignatory/CreateSignatory/Schema.d.ts +1 -0
  13. package/dist/components/Company/AssignSignatory/CreateSignatory/Schema.js.map +1 -1
  14. package/dist/components/Company/AssignSignatory/CreateSignatory/index.d.ts +2 -2
  15. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.d.ts +10 -1
  16. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +4 -5
  17. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
  18. package/dist/components/Company/AssignSignatory/Head.d.ts +1 -0
  19. package/dist/components/Company/AssignSignatory/Head.js.map +1 -1
  20. package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.d.ts +1 -0
  21. package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js.map +1 -1
  22. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.d.ts +24 -2
  23. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js.map +1 -1
  24. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.d.ts +3 -0
  25. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js.map +1 -1
  26. package/dist/components/Company/AssignSignatory/InviteSignatory/index.d.ts +2 -2
  27. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.d.ts +6 -0
  28. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +4 -5
  29. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
  30. package/dist/components/Company/AssignSignatory/SignatoryForm.d.ts +1 -0
  31. package/dist/components/Company/AssignSignatory/SignatoryForm.js.map +1 -1
  32. package/dist/components/Company/AssignSignatory/TitleSelect.d.ts +1 -1
  33. package/dist/components/Company/AssignSignatory/TitleSelect.js.map +1 -1
  34. package/dist/components/Company/AssignSignatory/index.d.ts +2 -5
  35. package/dist/components/Company/AssignSignatory/useAssignSignatory.d.ts +9 -0
  36. package/dist/components/Company/AssignSignatory/useAssignSignatory.js +6 -7
  37. package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
  38. package/dist/components/Company/BankAccount/BankAccount.d.ts +26 -0
  39. package/dist/components/Company/BankAccount/BankAccount.js.map +1 -1
  40. package/dist/components/Company/BankAccount/BankAccountComponents.d.ts +8 -0
  41. package/dist/components/Company/BankAccount/BankAccountComponents.js.map +1 -1
  42. package/dist/components/Company/BankAccount/BankAccountForm/Actions.d.ts +1 -0
  43. package/dist/components/Company/BankAccount/BankAccountForm/Actions.js.map +1 -1
  44. package/dist/components/Company/BankAccount/BankAccountForm/BankAccountForm.d.ts +1 -0
  45. package/dist/components/Company/BankAccount/BankAccountForm/BankAccountForm.js.map +1 -1
  46. package/dist/components/Company/BankAccount/BankAccountForm/Form.d.ts +3 -0
  47. package/dist/components/Company/BankAccount/BankAccountForm/Form.js.map +1 -1
  48. package/dist/components/Company/BankAccount/BankAccountForm/Head.d.ts +1 -0
  49. package/dist/components/Company/BankAccount/BankAccountForm/Head.js.map +1 -1
  50. package/dist/components/Company/BankAccount/BankAccountForm/context.js +4 -5
  51. package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
  52. package/dist/components/Company/BankAccount/BankAccountList/AccountView.d.ts +1 -0
  53. package/dist/components/Company/BankAccount/BankAccountList/AccountView.js.map +1 -1
  54. package/dist/components/Company/BankAccount/BankAccountList/Actions.d.ts +1 -0
  55. package/dist/components/Company/BankAccount/BankAccountList/Actions.js.map +1 -1
  56. package/dist/components/Company/BankAccount/BankAccountList/BankAccountList.d.ts +1 -0
  57. package/dist/components/Company/BankAccount/BankAccountList/BankAccountList.js.map +1 -1
  58. package/dist/components/Company/BankAccount/BankAccountList/Head.d.ts +1 -0
  59. package/dist/components/Company/BankAccount/BankAccountList/Head.js.map +1 -1
  60. package/dist/components/Company/BankAccount/BankAccountVerify/Actions.d.ts +1 -0
  61. package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js.map +1 -1
  62. package/dist/components/Company/BankAccount/BankAccountVerify/BankAccountVerify.d.ts +1 -0
  63. package/dist/components/Company/BankAccount/BankAccountVerify/BankAccountVerify.js.map +1 -1
  64. package/dist/components/Company/BankAccount/BankAccountVerify/Form.d.ts +3 -0
  65. package/dist/components/Company/BankAccount/BankAccountVerify/Form.js.map +1 -1
  66. package/dist/components/Company/BankAccount/BankAccountVerify/Head.d.ts +1 -0
  67. package/dist/components/Company/BankAccount/BankAccountVerify/Head.js.map +1 -1
  68. package/dist/components/Company/BankAccount/stateMachine.d.ts +1 -0
  69. package/dist/components/Company/BankAccount/stateMachine.js.map +1 -1
  70. package/dist/components/Company/DocumentSigner/DocumentList/Actions.d.ts +1 -0
  71. package/dist/components/Company/DocumentSigner/DocumentList/Actions.js.map +1 -1
  72. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.d.ts +21 -0
  73. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  74. package/dist/components/Company/DocumentSigner/DocumentList/Head.d.ts +1 -0
  75. package/dist/components/Company/DocumentSigner/DocumentList/Head.js.map +1 -1
  76. package/dist/components/Company/DocumentSigner/DocumentList/List.d.ts +1 -0
  77. package/dist/components/Company/DocumentSigner/DocumentList/List.js.map +1 -1
  78. package/dist/components/Company/DocumentSigner/DocumentList/ManageSignatories.d.ts +1 -0
  79. package/dist/components/Company/DocumentSigner/DocumentList/ManageSignatories.js.map +1 -1
  80. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +4 -5
  81. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  82. package/dist/components/Company/DocumentSigner/DocumentSigner.d.ts +37 -0
  83. package/dist/components/Company/DocumentSigner/DocumentSigner.js.map +1 -1
  84. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.d.ts +31 -2
  85. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
  86. package/dist/components/Company/DocumentSigner/assignSignatoryState.d.ts +1 -0
  87. package/dist/components/Company/DocumentSigner/assignSignatoryState.js.map +1 -1
  88. package/dist/components/Company/DocumentSigner/documentSignerStateMachine.d.ts +4 -0
  89. package/dist/components/Company/DocumentSigner/documentSignerStateMachine.js.map +1 -1
  90. package/dist/components/Company/DocumentSigner/shared/useSignCompanyForm/fields.d.ts +41 -0
  91. package/dist/components/Company/DocumentSigner/shared/useSignCompanyForm/fields.js.map +1 -1
  92. package/dist/components/Company/DocumentSigner/shared/useSignCompanyForm/signCompanyFormSchema.d.ts +40 -10
  93. package/dist/components/Company/DocumentSigner/shared/useSignCompanyForm/signCompanyFormSchema.js.map +1 -1
  94. package/dist/components/Company/DocumentSigner/shared/useSignCompanyForm/useSignCompanyForm.d.ts +111 -0
  95. package/dist/components/Company/DocumentSigner/shared/useSignCompanyForm/useSignCompanyForm.js.map +1 -1
  96. package/dist/components/Company/DocumentSigner/stateMachine.d.ts +1 -0
  97. package/dist/components/Company/DocumentSigner/stateMachine.js.map +1 -1
  98. package/dist/components/Company/DocumentSigner/useDocumentSigner.d.ts +1 -0
  99. package/dist/components/Company/FederalTaxes/Actions.d.ts +1 -0
  100. package/dist/components/Company/FederalTaxes/Actions.js.map +1 -1
  101. package/dist/components/Company/FederalTaxes/FederalTaxes.d.ts +13 -0
  102. package/dist/components/Company/FederalTaxes/FederalTaxes.js.map +1 -1
  103. package/dist/components/Company/FederalTaxes/Form.d.ts +1 -0
  104. package/dist/components/Company/FederalTaxes/Form.js.map +1 -1
  105. package/dist/components/Company/FederalTaxes/Head.d.ts +1 -0
  106. package/dist/components/Company/FederalTaxes/Head.js.map +1 -1
  107. package/dist/components/Company/FederalTaxes/useFederalTaxes.d.ts +3 -0
  108. package/dist/components/Company/FederalTaxes/useFederalTaxes.js +9 -10
  109. package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
  110. package/dist/components/Company/Industry/Actions.d.ts +1 -0
  111. package/dist/components/Company/Industry/Actions.js.map +1 -1
  112. package/dist/components/Company/Industry/Context.js +7 -8
  113. package/dist/components/Company/Industry/Context.js.map +1 -1
  114. package/dist/components/Company/Industry/Edit.d.ts +3 -0
  115. package/dist/components/Company/Industry/Edit.js.map +1 -1
  116. package/dist/components/Company/Industry/Head.d.ts +1 -0
  117. package/dist/components/Company/Industry/Head.js.map +1 -1
  118. package/dist/components/Company/Industry/Industry.d.ts +21 -0
  119. package/dist/components/Company/Industry/Industry.js.map +1 -1
  120. package/dist/components/Company/Industry/IndustrySelect.d.ts +1 -0
  121. package/dist/components/Company/Industry/IndustrySelect.js.map +1 -1
  122. package/dist/components/Company/Industry/index.d.ts +1 -1
  123. package/dist/components/Company/Locations/LocationForm/Actions.d.ts +1 -0
  124. package/dist/components/Company/Locations/LocationForm/Actions.js.map +1 -1
  125. package/dist/components/Company/Locations/LocationForm/Form.d.ts +3 -0
  126. package/dist/components/Company/Locations/LocationForm/Form.js.map +1 -1
  127. package/dist/components/Company/Locations/LocationForm/Head.d.ts +1 -0
  128. package/dist/components/Company/Locations/LocationForm/Head.js.map +1 -1
  129. package/dist/components/Company/Locations/LocationForm/LocationForm.d.ts +16 -0
  130. package/dist/components/Company/Locations/LocationForm/LocationForm.js.map +1 -1
  131. package/dist/components/Company/Locations/LocationForm/useLocationForm.js +4 -5
  132. package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
  133. package/dist/components/Company/Locations/Locations.d.ts +26 -0
  134. package/dist/components/Company/Locations/Locations.js.map +1 -1
  135. package/dist/components/Company/Locations/LocationsList/Actions.d.ts +1 -0
  136. package/dist/components/Company/Locations/LocationsList/Actions.js.map +1 -1
  137. package/dist/components/Company/Locations/LocationsList/Head.d.ts +1 -0
  138. package/dist/components/Company/Locations/LocationsList/Head.js.map +1 -1
  139. package/dist/components/Company/Locations/LocationsList/List.d.ts +1 -1
  140. package/dist/components/Company/Locations/LocationsList/List.js.map +1 -1
  141. package/dist/components/Company/Locations/LocationsList/LocationsList.d.ts +23 -2
  142. package/dist/components/Company/Locations/LocationsList/LocationsList.js.map +1 -1
  143. package/dist/components/Company/Locations/LocationsList/index.d.ts +1 -1
  144. package/dist/components/Company/Locations/LocationsList/useLocationsList.js +4 -5
  145. package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
  146. package/dist/components/Company/Locations/locationsStateMachine.d.ts +4 -0
  147. package/dist/components/Company/Locations/locationsStateMachine.js.map +1 -1
  148. package/dist/components/Company/Locations/stateMachine.d.ts +1 -1
  149. package/dist/components/Company/Locations/stateMachine.js +0 -1
  150. package/dist/components/Company/Locations/stateMachine.js.map +1 -1
  151. package/dist/components/Company/OnboardingFlow/OnboardingFlow.d.ts +25 -0
  152. package/dist/components/Company/OnboardingFlow/OnboardingFlow.js.map +1 -1
  153. package/dist/components/Company/OnboardingFlow/OnboardingFlowComponents.d.ts +19 -1
  154. package/dist/components/Company/OnboardingFlow/OnboardingFlowComponents.js.map +1 -1
  155. package/dist/components/Company/OnboardingFlow/onboardingStateMachine.d.ts +1 -0
  156. package/dist/components/Company/OnboardingFlow/onboardingStateMachine.js.map +1 -1
  157. package/dist/components/Company/OnboardingOverview/Completed.d.ts +1 -0
  158. package/dist/components/Company/OnboardingOverview/Completed.js.map +1 -1
  159. package/dist/components/Company/OnboardingOverview/MissingRequirements.d.ts +1 -0
  160. package/dist/components/Company/OnboardingOverview/MissingRequirements.js.map +1 -1
  161. package/dist/components/Company/OnboardingOverview/OnboardingOverview.d.ts +18 -0
  162. package/dist/components/Company/OnboardingOverview/OnboardingOverview.js.map +1 -1
  163. package/dist/components/Company/OnboardingOverview/context.js +4 -5
  164. package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
  165. package/dist/components/Company/PaySchedule/PaySchedule.d.ts +36 -3
  166. package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
  167. package/dist/components/Company/PaySchedule/PayScheduleComponents.d.ts +3 -0
  168. package/dist/components/Company/PaySchedule/PayScheduleComponents.js.map +1 -1
  169. package/dist/components/Company/PaySchedule/PayScheduleForm.d.ts +1 -0
  170. package/dist/components/Company/PaySchedule/PayScheduleForm.js.map +1 -1
  171. package/dist/components/Company/PaySchedule/PayScheduleList.d.ts +1 -0
  172. package/dist/components/Company/PaySchedule/PayScheduleList.js.map +1 -1
  173. package/dist/components/Company/PaySchedule/payScheduleStateMachine.d.ts +1 -0
  174. package/dist/components/Company/PaySchedule/payScheduleStateMachine.js.map +1 -1
  175. package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/fields.d.ts +136 -0
  176. package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/fields.js.map +1 -1
  177. package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/index.d.ts +2 -1
  178. package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/payScheduleSchema.d.ts +48 -26
  179. package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/payScheduleSchema.js.map +1 -1
  180. package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/usePayScheduleForm.d.ts +134 -0
  181. package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/usePayScheduleForm.js.map +1 -1
  182. package/dist/components/Company/StateTaxes/StateTaxes.d.ts +25 -0
  183. package/dist/components/Company/StateTaxes/StateTaxes.js.map +1 -1
  184. package/dist/components/Company/StateTaxes/StateTaxesComponents.d.ts +6 -0
  185. package/dist/components/Company/StateTaxes/StateTaxesComponents.js.map +1 -1
  186. package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.d.ts +1 -0
  187. package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js.map +1 -1
  188. package/dist/components/Company/StateTaxes/StateTaxesForm/Form.d.ts +1 -3
  189. package/dist/components/Company/StateTaxes/StateTaxesForm/Form.js +16 -18
  190. package/dist/components/Company/StateTaxes/StateTaxesForm/Form.js.map +1 -1
  191. package/dist/components/Company/StateTaxes/StateTaxesForm/Head.d.ts +1 -0
  192. package/dist/components/Company/StateTaxes/StateTaxesForm/Head.js.map +1 -1
  193. package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.d.ts +31 -0
  194. package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js.map +1 -1
  195. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +4 -5
  196. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
  197. package/dist/components/Company/StateTaxes/StateTaxesForm/rhfKey.d.ts +2 -0
  198. package/dist/components/Company/StateTaxes/StateTaxesForm/rhfKey.js.map +1 -1
  199. package/dist/components/Company/StateTaxes/StateTaxesList/Actions.d.ts +1 -0
  200. package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js.map +1 -1
  201. package/dist/components/Company/StateTaxes/StateTaxesList/Head.d.ts +1 -0
  202. package/dist/components/Company/StateTaxes/StateTaxesList/Head.js.map +1 -1
  203. package/dist/components/Company/StateTaxes/StateTaxesList/List.d.ts +1 -0
  204. package/dist/components/Company/StateTaxes/StateTaxesList/List.js.map +1 -1
  205. package/dist/components/Company/StateTaxes/StateTaxesList/StateTaxesList.d.ts +16 -0
  206. package/dist/components/Company/StateTaxes/StateTaxesList/StateTaxesList.js.map +1 -1
  207. package/dist/components/Company/StateTaxes/StateTaxesList/context.js +4 -5
  208. package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
  209. package/dist/components/Company/StateTaxes/stateTaxesStateMachine.d.ts +1 -0
  210. package/dist/components/Company/StateTaxes/stateTaxesStateMachine.js.map +1 -1
  211. package/dist/components/Company/exports/companyOnboarding.d.ts +7 -6
  212. package/dist/components/Company/exports/companyOnboarding.js +18 -16
  213. package/dist/components/Company/exports/companyOnboarding.js.map +1 -1
  214. package/dist/components/Company/index.d.ts +1 -17
  215. package/dist/components/Contractor/Address/Actions.d.ts +1 -0
  216. package/dist/components/Contractor/Address/Actions.js.map +1 -1
  217. package/dist/components/Contractor/Address/Address.d.ts +36 -1
  218. package/dist/components/Contractor/Address/Address.js.map +1 -1
  219. package/dist/components/Contractor/Address/Form.d.ts +1 -0
  220. package/dist/components/Contractor/Address/Form.js.map +1 -1
  221. package/dist/components/Contractor/Address/Head.d.ts +1 -0
  222. package/dist/components/Contractor/Address/Head.js.map +1 -1
  223. package/dist/components/Contractor/Address/index.d.ts +1 -1
  224. package/dist/components/Contractor/Address/useAddress.d.ts +8 -1
  225. package/dist/components/Contractor/Address/useAddress.js +6 -7
  226. package/dist/components/Contractor/Address/useAddress.js.map +1 -1
  227. package/dist/components/Contractor/ContractorList/index.d.ts +22 -9
  228. package/dist/components/Contractor/ContractorList/index.js +1 -3
  229. package/dist/components/Contractor/ContractorList/index.js.map +1 -1
  230. package/dist/components/Contractor/ContractorList/useContractorList.d.ts +3 -5
  231. package/dist/components/Contractor/ContractorList/useContractorList.js.map +1 -1
  232. package/dist/components/Contractor/NewHireReport/NewHireReport.d.ts +33 -9
  233. package/dist/components/Contractor/NewHireReport/NewHireReport.js.map +1 -1
  234. package/dist/components/Contractor/NewHireReport/types.d.ts +7 -0
  235. package/dist/components/Contractor/OnboardingFlow/OnboardingFlow.d.ts +58 -0
  236. package/dist/components/Contractor/OnboardingFlow/OnboardingFlow.js.map +1 -1
  237. package/dist/components/Contractor/OnboardingFlow/OnboardingFlowComponents.d.ts +28 -2
  238. package/dist/components/Contractor/OnboardingFlow/OnboardingFlowComponents.js.map +1 -1
  239. package/dist/components/Contractor/OnboardingFlow/onboardingStateMachine.d.ts +1 -0
  240. package/dist/components/Contractor/OnboardingFlow/onboardingStateMachine.js.map +1 -1
  241. package/dist/components/Contractor/PaymentMethod/BankAccountForm.d.ts +1 -0
  242. package/dist/components/Contractor/PaymentMethod/BankAccountForm.js.map +1 -1
  243. package/dist/components/Contractor/PaymentMethod/PaymentMethod.d.ts +33 -16
  244. package/dist/components/Contractor/PaymentMethod/PaymentMethod.js.map +1 -1
  245. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.d.ts +1 -9
  246. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js +11 -15
  247. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js.map +1 -1
  248. package/dist/components/Contractor/PaymentMethod/types.d.ts +7 -0
  249. package/dist/components/Contractor/Payments/CreatePayment/CreatePayment.d.ts +40 -3
  250. package/dist/components/Contractor/Payments/CreatePayment/CreatePayment.js +1 -2
  251. package/dist/components/Contractor/Payments/CreatePayment/CreatePayment.js.map +1 -1
  252. package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.d.ts +1 -0
  253. package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js.map +1 -1
  254. package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentFormSchema.d.ts +4 -18
  255. package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentFormSchema.js +0 -1
  256. package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentFormSchema.js.map +1 -1
  257. package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentPresentation.d.ts +1 -0
  258. package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentPresentation.js.map +1 -1
  259. package/dist/components/Contractor/Payments/CreatePayment/FastAchSubmissionBlockerBanner.d.ts +1 -0
  260. package/dist/components/Contractor/Payments/CreatePayment/FastAchSubmissionBlockerBanner.js.map +1 -1
  261. package/dist/components/Contractor/Payments/CreatePayment/GenericBlocker.d.ts +1 -0
  262. package/dist/components/Contractor/Payments/CreatePayment/GenericBlocker.js.map +1 -1
  263. package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.d.ts +1 -0
  264. package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.js.map +1 -1
  265. package/dist/components/Contractor/Payments/CreatePayment/helpers.d.ts +1 -0
  266. package/dist/components/Contractor/Payments/CreatePayment/helpers.js.map +1 -1
  267. package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlow.d.ts +40 -0
  268. package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlow.js.map +1 -1
  269. package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlowComponents.d.ts +13 -0
  270. package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlowComponents.js.map +1 -1
  271. package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.d.ts +2 -0
  272. package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.js.map +1 -1
  273. package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistory.d.ts +30 -3
  274. package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistory.js +1 -2
  275. package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistory.js.map +1 -1
  276. package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.d.ts +1 -0
  277. package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js.map +1 -1
  278. package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatement.d.ts +15 -3
  279. package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatement.js +1 -2
  280. package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatement.js.map +1 -1
  281. package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.d.ts +1 -0
  282. package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js.map +1 -1
  283. package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummary.d.ts +25 -2
  284. package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummary.js.map +1 -1
  285. package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummaryPresentation.d.ts +1 -0
  286. package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummaryPresentation.js.map +1 -1
  287. package/dist/components/Contractor/Payments/PaymentSummary/index.d.ts +1 -2
  288. package/dist/components/Contractor/Payments/PaymentsList/PaymentsList.d.ts +28 -3
  289. package/dist/components/Contractor/Payments/PaymentsList/PaymentsList.js +1 -2
  290. package/dist/components/Contractor/Payments/PaymentsList/PaymentsList.js.map +1 -1
  291. package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.d.ts +1 -0
  292. package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js.map +1 -1
  293. package/dist/components/Contractor/Payments/types.d.ts +8 -4
  294. package/dist/components/Contractor/Profile/ContractorProfile.d.ts +30 -6
  295. package/dist/components/Contractor/Profile/ContractorProfile.js +5 -9
  296. package/dist/components/Contractor/Profile/ContractorProfile.js.map +1 -1
  297. package/dist/components/Contractor/Profile/ContractorProfileForm.d.ts +2 -0
  298. package/dist/components/Contractor/Profile/ContractorProfileForm.js.map +1 -1
  299. package/dist/components/Contractor/Profile/index.d.ts +1 -2
  300. package/dist/components/Contractor/Profile/useContractorProfile.d.ts +16 -2
  301. package/dist/components/Contractor/Profile/useContractorProfile.js +28 -26
  302. package/dist/components/Contractor/Profile/useContractorProfile.js.map +1 -1
  303. package/dist/components/Contractor/Submit/Submit.d.ts +21 -1
  304. package/dist/components/Contractor/Submit/Submit.js +1 -2
  305. package/dist/components/Contractor/Submit/Submit.js.map +1 -1
  306. package/dist/components/Contractor/Submit/SubmitDone.d.ts +1 -0
  307. package/dist/components/Contractor/Submit/SubmitDone.js.map +1 -1
  308. package/dist/components/Contractor/exports/contractorManagement.d.ts +6 -6
  309. package/dist/components/Contractor/exports/contractorOnboarding.d.ts +9 -4
  310. package/dist/components/Employee/Compensation/shared/useCompensationForm/compensationSchema.d.ts +29 -61
  311. package/dist/components/Employee/Compensation/shared/useJobForm/jobSchema.d.ts +19 -23
  312. package/dist/components/Employee/Compensation/shared/useJobForm/jobSchema.js +5 -0
  313. package/dist/components/Employee/Compensation/shared/useJobForm/jobSchema.js.map +1 -1
  314. package/dist/components/Employee/Deductions/onboarding/Deductions.d.ts +1 -3
  315. package/dist/components/Employee/Deductions/onboarding/Deductions.js +21 -26
  316. package/dist/components/Employee/Deductions/onboarding/Deductions.js.map +1 -1
  317. package/dist/components/Employee/Deductions/onboarding/DeductionsList/DeductionsList.js +55 -50
  318. package/dist/components/Employee/Deductions/onboarding/DeductionsList/DeductionsList.js.map +1 -1
  319. package/dist/components/Employee/Deductions/onboarding/deductionsContextualComponents.d.ts +0 -4
  320. package/dist/components/Employee/Deductions/onboarding/deductionsContextualComponents.js +33 -43
  321. package/dist/components/Employee/Deductions/onboarding/deductionsContextualComponents.js.map +1 -1
  322. package/dist/components/Employee/Deductions/onboarding/stateMachine.d.ts +0 -1
  323. package/dist/components/Employee/Deductions/onboarding/stateMachine.js +36 -60
  324. package/dist/components/Employee/Deductions/onboarding/stateMachine.js.map +1 -1
  325. package/dist/components/Employee/Deductions/shared/DeductionsForm/DeductionsForm.js +63 -61
  326. package/dist/components/Employee/Deductions/shared/DeductionsForm/DeductionsForm.js.map +1 -1
  327. package/dist/components/Employee/Deductions/shared/useChildSupportGarnishmentForm/childSupportGarnishmentFormSchema.d.ts +1 -18
  328. package/dist/components/Employee/Deductions/shared/useDeductionForm/deductionFormSchema.d.ts +2 -25
  329. package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js +4 -5
  330. package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  331. package/dist/components/Employee/Documents/onboarding/EmployeeDocuments/EmployeeDocumentsPresentation.d.ts +1 -4
  332. package/dist/components/Employee/Documents/shared/useSignEmployeeForm/signEmployeeFormSchema.d.ts +2 -48
  333. package/dist/components/Employee/Documents/shared/useSignEmployeeForm/useSignEmployeeForm.d.ts +22 -14
  334. package/dist/components/Employee/Documents/shared/useSignEmployeeForm/useSignEmployeeForm.js.map +1 -1
  335. package/dist/components/Employee/FederalTaxes/shared/useFederalTaxesForm/federalTaxesSchema.d.ts +3 -20
  336. package/dist/components/Employee/PaymentMethod/shared/useBankForm/useBankFormSchema.d.ts +3 -15
  337. package/dist/components/Employee/PaymentMethod/shared/usePaymentMethodForm/usePaymentMethodFormSchema.d.ts +3 -12
  338. package/dist/components/Employee/PaymentMethod/shared/useSplitPaymentsForm/useSplitPaymentsFormSchema.d.ts +2 -11
  339. package/dist/components/Employee/Profile/shared/useEmployeeDetailsForm/employeeDetailsSchema.d.ts +3 -22
  340. package/dist/components/Employee/Profile/shared/useHomeAddressForm/homeAddressSchema.d.ts +3 -17
  341. package/dist/components/Employee/Profile/shared/useWorkAddressForm/workAddressSchema.d.ts +3 -10
  342. package/dist/components/Payroll/GrossUpModal/GrossUpModal.js +3 -2
  343. package/dist/components/Payroll/GrossUpModal/GrossUpModal.js.map +1 -1
  344. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.d.ts +2 -18
  345. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +144 -131
  346. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js.map +1 -1
  347. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.d.ts +3 -3
  348. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +167 -167
  349. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
  350. package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js +40 -35
  351. package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js.map +1 -1
  352. package/dist/components/Payroll/usePreparedPayrollData.js +3 -4
  353. package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
  354. package/dist/components/TimeOff/TimeOffFlow/timeOffPolicyTypes.d.ts +1 -2
  355. package/dist/index.d.ts +2 -2
  356. package/dist/index.js +90 -82
  357. package/dist/index.js.map +1 -1
  358. package/dist/partner-hook-utils/form/buildFormSchema.d.ts +27 -4
  359. package/dist/partner-hook-utils/form/buildFormSchema.js.map +1 -1
  360. package/dist/shared/constants.d.ts +0 -4
  361. package/dist/shared/constants.js +0 -2
  362. package/dist/shared/constants.js.map +1 -1
  363. package/dist/style.css +1 -1
  364. package/docs/reference/endpoint-inventory.json +11 -4
  365. package/package.json +6 -6
  366. package/dist/components/Contractor/index.d.ts +0 -14
  367. package/dist/components/Employee/Deductions/onboarding/IncludeDeductions/IncludeDeductions.d.ts +0 -8
  368. package/dist/components/Employee/Deductions/onboarding/IncludeDeductions/IncludeDeductions.js +0 -44
  369. package/dist/components/Employee/Deductions/onboarding/IncludeDeductions/IncludeDeductions.js.map +0 -1
  370. package/dist/components/Employee/Deductions/onboarding/IncludeDeductions/IncludeDeductions.module.scss.js +0 -12
  371. package/dist/components/Employee/Deductions/onboarding/IncludeDeductions/IncludeDeductions.module.scss.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"fields.js","sources":["../../../../../../src/components/Company/PaySchedule/shared/usePayScheduleForm/fields.tsx"],"sourcesContent":["import type { PayScheduleErrorCodes, PayScheduleFrequency } from './payScheduleSchema'\nimport type { TextInputHookFieldProps } from '@/partner-hook-utils/form/fields/TextInputHookField'\nimport type { SelectHookFieldProps } from '@/partner-hook-utils/form/fields/SelectHookField'\nimport type { RadioGroupHookFieldProps } from '@/partner-hook-utils/form/fields/RadioGroupHookField'\nimport type { DatePickerHookFieldProps } from '@/partner-hook-utils/form/fields/DatePickerHookField'\nimport type { NumberInputHookFieldProps } from '@/partner-hook-utils/form/fields/NumberInputHookField'\nimport {\n TextInputHookField,\n SelectHookField,\n RadioGroupHookField,\n DatePickerHookField,\n NumberInputHookField,\n} from '@/partner-hook-utils/form/fields'\nimport type { HookFieldProps } from '@/partner-hook-utils/types'\n\nexport type RequiredValidation = typeof PayScheduleErrorCodes.REQUIRED\nexport type DayValidation = (typeof PayScheduleErrorCodes)['REQUIRED' | 'DAY_RANGE']\n\nexport type CustomNameFieldProps = HookFieldProps<TextInputHookFieldProps<RequiredValidation>>\n\nexport function CustomNameField(props: CustomNameFieldProps) {\n return <TextInputHookField {...props} name=\"customName\" />\n}\n\nexport type FrequencyFieldProps = HookFieldProps<\n SelectHookFieldProps<RequiredValidation, PayScheduleFrequency>\n>\n\nexport function FrequencyField(props: FrequencyFieldProps) {\n return <SelectHookField {...props} name=\"frequency\" />\n}\n\nexport type CustomTwicePerMonthFieldProps = HookFieldProps<RadioGroupHookFieldProps<never, string>>\n\nexport function CustomTwicePerMonthField(props: CustomTwicePerMonthFieldProps) {\n return <RadioGroupHookField {...props} name=\"customTwicePerMonth\" />\n}\n\nexport type AnchorPayDateFieldProps = HookFieldProps<DatePickerHookFieldProps<RequiredValidation>>\n\nexport function AnchorPayDateField(props: AnchorPayDateFieldProps) {\n return <DatePickerHookField {...props} name=\"anchorPayDate\" />\n}\n\nexport type AnchorEndOfPayPeriodFieldProps = HookFieldProps<\n DatePickerHookFieldProps<RequiredValidation>\n>\n\nexport function AnchorEndOfPayPeriodField(props: AnchorEndOfPayPeriodFieldProps) {\n return <DatePickerHookField {...props} name=\"anchorEndOfPayPeriod\" />\n}\n\nexport type Day1FieldProps = HookFieldProps<NumberInputHookFieldProps<DayValidation>>\n\nexport function Day1Field(props: Day1FieldProps) {\n return <NumberInputHookField {...props} name=\"day1\" min={1} max={31} />\n}\n\nexport type Day2FieldProps = HookFieldProps<NumberInputHookFieldProps<DayValidation>>\n\nexport function Day2Field(props: Day2FieldProps) {\n return <NumberInputHookField {...props} name=\"day2\" min={1} max={31} />\n}\n"],"names":["CustomNameField","props","jsx","TextInputHookField","FrequencyField","SelectHookField","CustomTwicePerMonthField","RadioGroupHookField","AnchorPayDateField","DatePickerHookField","AnchorEndOfPayPeriodField","Day1Field","NumberInputHookField","Day2Field"],"mappings":";;;;;;AAoBO,SAASA,EAAgBC,GAA6B;AAC3D,SAAO,gBAAAC,EAACC,GAAA,EAAoB,GAAGF,GAAO,MAAK,cAAa;AAC1D;AAMO,SAASG,EAAeH,GAA4B;AACzD,SAAO,gBAAAC,EAACG,GAAA,EAAiB,GAAGJ,GAAO,MAAK,aAAY;AACtD;AAIO,SAASK,EAAyBL,GAAsC;AAC7E,SAAO,gBAAAC,EAACK,GAAA,EAAqB,GAAGN,GAAO,MAAK,uBAAsB;AACpE;AAIO,SAASO,EAAmBP,GAAgC;AACjE,SAAO,gBAAAC,EAACO,GAAA,EAAqB,GAAGR,GAAO,MAAK,iBAAgB;AAC9D;AAMO,SAASS,EAA0BT,GAAuC;AAC/E,SAAO,gBAAAC,EAACO,GAAA,EAAqB,GAAGR,GAAO,MAAK,wBAAuB;AACrE;AAIO,SAASU,EAAUV,GAAuB;AAC/C,SAAO,gBAAAC,EAACU,KAAsB,GAAGX,GAAO,MAAK,QAAO,KAAK,GAAG,KAAK,GAAA,CAAI;AACvE;AAIO,SAASY,EAAUZ,GAAuB;AAC/C,SAAO,gBAAAC,EAACU,KAAsB,GAAGX,GAAO,MAAK,QAAO,KAAK,GAAG,KAAK,GAAA,CAAI;AACvE;"}
1
+ {"version":3,"file":"fields.js","sources":["../../../../../../src/components/Company/PaySchedule/shared/usePayScheduleForm/fields.tsx"],"sourcesContent":["import type { PayScheduleErrorCodes, PayScheduleFrequency } from './payScheduleSchema'\nimport type { TextInputHookFieldProps } from '@/partner-hook-utils/form/fields/TextInputHookField'\nimport type { SelectHookFieldProps } from '@/partner-hook-utils/form/fields/SelectHookField'\nimport type { RadioGroupHookFieldProps } from '@/partner-hook-utils/form/fields/RadioGroupHookField'\nimport type { DatePickerHookFieldProps } from '@/partner-hook-utils/form/fields/DatePickerHookField'\nimport type { NumberInputHookFieldProps } from '@/partner-hook-utils/form/fields/NumberInputHookField'\nimport {\n TextInputHookField,\n SelectHookField,\n RadioGroupHookField,\n DatePickerHookField,\n NumberInputHookField,\n} from '@/partner-hook-utils/form/fields'\nimport type { HookFieldProps } from '@/partner-hook-utils/types'\n\n/**\n * The required-field error code produced by {@link usePayScheduleForm} fields that only emit `REQUIRED`.\n *\n * @remarks\n * Used as the `validationMessages` key for the custom name, frequency, anchor\n * pay date, and anchor end-of-pay-period fields. See {@link PayScheduleErrorCodes}.\n *\n * @public\n */\nexport type RequiredValidation = typeof PayScheduleErrorCodes.REQUIRED\n\n/**\n * Validation error codes emitted by the `day1` and `day2` fields of {@link usePayScheduleForm}.\n *\n * @remarks\n * Use these as keys in `validationMessages` on `Fields.Day1` and `Fields.Day2`.\n * See {@link PayScheduleErrorCodes}.\n *\n * @public\n */\nexport type DayValidation = (typeof PayScheduleErrorCodes)['REQUIRED' | 'DAY_RANGE']\n\n/**\n * Props accepted by {@link usePayScheduleForm}'s `Fields.CustomName` component.\n *\n * @public\n */\nexport type CustomNameFieldProps = HookFieldProps<TextInputHookFieldProps<RequiredValidation>>\n\n/**\n * Text input bound to the `customName` field of {@link usePayScheduleForm}.\n *\n * @remarks\n * Available on the hook result as `form.Fields.CustomName`. Always required.\n *\n * @param props - {@link CustomNameFieldProps} — accepts the standard hook field props (label, description, validationMessages, FieldComponent override).\n * @returns The rendered text input bound to `customName`.\n * @public\n */\nexport function CustomNameField(props: CustomNameFieldProps) {\n return <TextInputHookField {...props} name=\"customName\" />\n}\n\n/**\n * Props accepted by {@link usePayScheduleForm}'s `Fields.Frequency` component.\n *\n * @public\n */\nexport type FrequencyFieldProps = HookFieldProps<\n SelectHookFieldProps<RequiredValidation, PayScheduleFrequency>\n>\n\n/**\n * Select dropdown bound to the `frequency` field of {@link usePayScheduleForm}.\n *\n * @remarks\n * Available on the hook result as `form.Fields.Frequency`. Always required.\n * Options are `'Every week'`, `'Every other week'`, `'Twice per month'`, and\n * `'Monthly'`. Pass `getOptionLabel` to customize how options are displayed.\n *\n * @param props - {@link FrequencyFieldProps} — accepts the standard hook field props plus `getOptionLabel`.\n * @returns The rendered select bound to `frequency`.\n * @public\n */\nexport function FrequencyField(props: FrequencyFieldProps) {\n return <SelectHookField {...props} name=\"frequency\" />\n}\n\n/**\n * Props accepted by {@link usePayScheduleForm}'s `Fields.CustomTwicePerMonth` component.\n *\n * @public\n */\nexport type CustomTwicePerMonthFieldProps = HookFieldProps<RadioGroupHookFieldProps<never, string>>\n\n/**\n * Radio group bound to the `customTwicePerMonth` field of {@link usePayScheduleForm}.\n *\n * @remarks\n * Available on the hook result as `form.Fields.CustomTwicePerMonth`. Only present\n * when the selected frequency is `'Twice per month'`; otherwise the entry on\n * `Fields` is `undefined`. Options are `'1st15th'` (15th and last day of the\n * month) and `'custom'` (manual day entry via `Day1` and `Day2`).\n *\n * @param props - {@link CustomTwicePerMonthFieldProps} — accepts the standard hook field props.\n * @returns The rendered radio group bound to `customTwicePerMonth`.\n * @public\n */\nexport function CustomTwicePerMonthField(props: CustomTwicePerMonthFieldProps) {\n return <RadioGroupHookField {...props} name=\"customTwicePerMonth\" />\n}\n\n/**\n * Props accepted by {@link usePayScheduleForm}'s `Fields.AnchorPayDate` component.\n *\n * @public\n */\nexport type AnchorPayDateFieldProps = HookFieldProps<DatePickerHookFieldProps<RequiredValidation>>\n\n/**\n * Date picker bound to the `anchorPayDate` field of {@link usePayScheduleForm}.\n *\n * @remarks\n * Available on the hook result as `form.Fields.AnchorPayDate`. Always required.\n * Represents the date of the first paycheck under this schedule.\n *\n * @param props - {@link AnchorPayDateFieldProps} — accepts the standard hook field props.\n * @returns The rendered date picker bound to `anchorPayDate`.\n * @public\n */\nexport function AnchorPayDateField(props: AnchorPayDateFieldProps) {\n return <DatePickerHookField {...props} name=\"anchorPayDate\" />\n}\n\n/**\n * Props accepted by {@link usePayScheduleForm}'s `Fields.AnchorEndOfPayPeriod` component.\n *\n * @public\n */\nexport type AnchorEndOfPayPeriodFieldProps = HookFieldProps<\n DatePickerHookFieldProps<RequiredValidation>\n>\n\n/**\n * Date picker bound to the `anchorEndOfPayPeriod` field of {@link usePayScheduleForm}.\n *\n * @remarks\n * Available on the hook result as `form.Fields.AnchorEndOfPayPeriod`. Always\n * required. Represents the end date of the first pay period and is used to\n * calculate future pay periods. May be the same date as the first pay date.\n *\n * @param props - {@link AnchorEndOfPayPeriodFieldProps} — accepts the standard hook field props.\n * @returns The rendered date picker bound to `anchorEndOfPayPeriod`.\n * @public\n */\nexport function AnchorEndOfPayPeriodField(props: AnchorEndOfPayPeriodFieldProps) {\n return <DatePickerHookField {...props} name=\"anchorEndOfPayPeriod\" />\n}\n\n/**\n * Props accepted by {@link usePayScheduleForm}'s `Fields.Day1` component.\n *\n * @public\n */\nexport type Day1FieldProps = HookFieldProps<NumberInputHookFieldProps<DayValidation>>\n\n/**\n * Number input bound to the `day1` field of {@link usePayScheduleForm}.\n *\n * @remarks\n * Available on the hook result as `form.Fields.Day1`. Only present when the\n * frequency is `'Monthly'`, or when the frequency is `'Twice per month'` and\n * `customTwicePerMonth` is `'custom'`; otherwise the entry on `Fields` is\n * `undefined`. Accepts integers in the range 1–31.\n *\n * @param props - {@link Day1FieldProps} — accepts the standard hook field props.\n * @returns The rendered number input bound to `day1`.\n * @public\n */\nexport function Day1Field(props: Day1FieldProps) {\n return <NumberInputHookField {...props} name=\"day1\" min={1} max={31} />\n}\n\n/**\n * Props accepted by {@link usePayScheduleForm}'s `Fields.Day2` component.\n *\n * @public\n */\nexport type Day2FieldProps = HookFieldProps<NumberInputHookFieldProps<DayValidation>>\n\n/**\n * Number input bound to the `day2` field of {@link usePayScheduleForm}.\n *\n * @remarks\n * Available on the hook result as `form.Fields.Day2`. Only present when the\n * frequency is `'Twice per month'` and `customTwicePerMonth` is `'custom'`;\n * otherwise the entry on `Fields` is `undefined`. Accepts integers in the range 1–31.\n *\n * @param props - {@link Day2FieldProps} — accepts the standard hook field props.\n * @returns The rendered number input bound to `day2`.\n * @public\n */\nexport function Day2Field(props: Day2FieldProps) {\n return <NumberInputHookField {...props} name=\"day2\" min={1} max={31} />\n}\n"],"names":["CustomNameField","props","jsx","TextInputHookField","FrequencyField","SelectHookField","CustomTwicePerMonthField","RadioGroupHookField","AnchorPayDateField","DatePickerHookField","AnchorEndOfPayPeriodField","Day1Field","NumberInputHookField","Day2Field"],"mappings":";;;;;;AAsDO,SAASA,EAAgBC,GAA6B;AAC3D,SAAO,gBAAAC,EAACC,GAAA,EAAoB,GAAGF,GAAO,MAAK,cAAa;AAC1D;AAuBO,SAASG,EAAeH,GAA4B;AACzD,SAAO,gBAAAC,EAACG,GAAA,EAAiB,GAAGJ,GAAO,MAAK,aAAY;AACtD;AAsBO,SAASK,EAAyBL,GAAsC;AAC7E,SAAO,gBAAAC,EAACK,GAAA,EAAqB,GAAGN,GAAO,MAAK,uBAAsB;AACpE;AAoBO,SAASO,EAAmBP,GAAgC;AACjE,SAAO,gBAAAC,EAACO,GAAA,EAAqB,GAAGR,GAAO,MAAK,iBAAgB;AAC9D;AAuBO,SAASS,EAA0BT,GAAuC;AAC/E,SAAO,gBAAAC,EAACO,GAAA,EAAqB,GAAGR,GAAO,MAAK,wBAAuB;AACrE;AAsBO,SAASU,EAAUV,GAAuB;AAC/C,SAAO,gBAAAC,EAACU,KAAsB,GAAGX,GAAO,MAAK,QAAO,KAAK,GAAG,KAAK,GAAA,CAAI;AACvE;AAqBO,SAASY,EAAUZ,GAAuB;AAC/C,SAAO,gBAAAC,EAACU,KAAsB,GAAGX,GAAO,MAAK,QAAO,KAAK,GAAG,KAAK,GAAA,CAAI;AACvE;"}
@@ -1,5 +1,6 @@
1
1
  import "./types/i18next.d.ts"
2
2
  export { usePayScheduleForm } from './usePayScheduleForm';
3
- export type { PayScheduleOptionalFieldsToRequire, UsePayScheduleFormProps, UsePayScheduleFormResult, UsePayScheduleFormReady, PayScheduleFieldsMetadata, PayScheduleFormFields, } from './usePayScheduleForm';
3
+ export type { PayScheduleOptionalFieldsToRequire, UsePayScheduleFormProps, UsePayScheduleFormResult, UsePayScheduleFormReady, PayScheduleFieldsMetadata, PayScheduleFormFields, PayScheduleFields, } from './usePayScheduleForm';
4
4
  export { createPayScheduleSchema, PayScheduleErrorCodes, type PayScheduleErrorCode, type PayScheduleFormData, type PayScheduleFormOutputs, type PayScheduleField, type PayScheduleFrequency, } from './payScheduleSchema';
5
5
  export type { RequiredValidation as PayScheduleRequiredValidation, DayValidation, CustomNameFieldProps, FrequencyFieldProps, CustomTwicePerMonthFieldProps, AnchorPayDateFieldProps, AnchorEndOfPayPeriodFieldProps, Day1FieldProps, Day2FieldProps, } from './fields';
6
+ export { CustomNameField, FrequencyField, CustomTwicePerMonthField, AnchorPayDateField, AnchorEndOfPayPeriodField, Day1Field, Day2Field, } from './fields';
@@ -1,43 +1,65 @@
1
1
  import { z } from 'zod';
2
2
  import { OptionalFieldsToRequire } from '../../../../../partner-hook-utils/form/buildFormSchema';
3
+ /**
4
+ * Validation error codes emitted by {@link usePayScheduleForm} fields.
5
+ *
6
+ * @remarks
7
+ * Use these as `validationMessages` keys on the corresponding `Fields.*` components.
8
+ *
9
+ * @public
10
+ */
3
11
  export declare const PayScheduleErrorCodes: {
4
12
  readonly REQUIRED: "REQUIRED";
5
13
  readonly DAY_RANGE: "DAY_RANGE";
6
14
  };
15
+ /**
16
+ * Union of validation error code strings emitted by the pay schedule form.
17
+ *
18
+ * @public
19
+ */
7
20
  export type PayScheduleErrorCode = (typeof PayScheduleErrorCodes)[keyof typeof PayScheduleErrorCodes];
8
- declare const FREQUENCY_VALUES: readonly ["Every week", "Every other week", "Twice per month", "Monthly"];
9
- export type PayScheduleFrequency = (typeof FREQUENCY_VALUES)[number];
10
- declare const fieldValidators: {
11
- customName: z.ZodString;
12
- frequency: z.ZodEnum<{
13
- "Every week": "Every week";
14
- "Every other week": "Every other week";
15
- "Twice per month": "Twice per month";
16
- Monthly: "Monthly";
17
- }>;
18
- customTwicePerMonth: z.ZodString;
19
- anchorPayDate: z.ZodPipe<z.ZodTransform<string | null, unknown>, z.ZodNullable<z.ZodISODate>>;
20
- anchorEndOfPayPeriod: z.ZodPipe<z.ZodTransform<string | null, unknown>, z.ZodNullable<z.ZodISODate>>;
21
- day1: z.ZodPipe<z.ZodTransform<number, unknown>, z.ZodNumber>;
22
- day2: z.ZodPipe<z.ZodTransform<number, unknown>, z.ZodNumber>;
23
- };
24
- export type PayScheduleField = keyof typeof fieldValidators;
25
- export type PayScheduleFormData = {
26
- [K in keyof typeof fieldValidators]: z.infer<(typeof fieldValidators)[K]>;
27
- };
21
+ /**
22
+ * Pay schedule frequency values accepted by {@link usePayScheduleForm}.
23
+ *
24
+ * @public
25
+ */
26
+ export type PayScheduleFrequency = "Every week" | "Every other week" | "Twice per month" | "Monthly";
27
+ /**
28
+ * Union of field names managed by the pay schedule form.
29
+ *
30
+ * @public
31
+ */
32
+ export type PayScheduleField = "customName" | "frequency" | "customTwicePerMonth" | "anchorPayDate" | "anchorEndOfPayPeriod" | "day1" | "day2";
33
+ /**
34
+ * Shape of the values managed by the pay schedule form.
35
+ *
36
+ * @public
37
+ */
38
+ export type PayScheduleFormData = { customName: string; frequency: "Every week" | "Every other week" | "Twice per month" | "Monthly"; customTwicePerMonth: string; anchorPayDate: string | null; anchorEndOfPayPeriod: string | null; day1: number; day2: number; };
39
+ /**
40
+ * Shape of the validated values produced by the pay schedule form on submit.
41
+ *
42
+ * @public
43
+ */
28
44
  export type PayScheduleFormOutputs = PayScheduleFormData;
29
45
  declare function needsDay1(data: PayScheduleFormData): boolean;
30
46
  declare function needsDay2(data: PayScheduleFormData): boolean;
31
- declare const requiredFieldsConfig: {
32
- customTwicePerMonth: "never";
33
- day1: typeof needsDay1;
34
- day2: typeof needsDay2;
35
- };
36
- export type PayScheduleOptionalFieldsToRequire = OptionalFieldsToRequire<typeof requiredFieldsConfig>;
47
+ /**
48
+ * Configuration for promoting optional pay schedule fields to required in a given mode.
49
+ *
50
+ * @remarks
51
+ * Only fields that are optional by default can be promoted. Currently
52
+ * `customTwicePerMonth` is the only configurable field.
53
+ *
54
+ * @public
55
+ */
56
+ export type PayScheduleOptionalFieldsToRequire = { create?: "customTwicePerMonth"[] | undefined; update?: "customTwicePerMonth"[] | undefined; };
57
+ /** @internal */
37
58
  interface PayScheduleSchemaOptions {
38
59
  mode?: 'create' | 'update';
39
60
  optionalFieldsToRequire?: PayScheduleOptionalFieldsToRequire;
40
61
  }
62
+ /** @internal */
41
63
  export declare function createPayScheduleSchema(options?: PayScheduleSchemaOptions): import('../../../../../partner-hook-utils/form/buildFormSchema').BuildFormSchemaResult<{
42
64
  customName: z.ZodString;
43
65
  frequency: z.ZodEnum<{
@@ -1 +1 @@
1
- {"version":3,"file":"payScheduleSchema.js","sources":["../../../../../../src/components/Company/PaySchedule/shared/usePayScheduleForm/payScheduleSchema.ts"],"sourcesContent":["import { z } from 'zod'\nimport {\n buildFormSchema,\n type RequiredFieldConfig,\n type OptionalFieldsToRequire,\n} from '@/partner-hook-utils/form/buildFormSchema'\nimport { coerceNaN, coerceToISODate } from '@/partner-hook-utils/form/preprocessors'\n\n// ── Error codes ────────────────────────────────────────────────────────\n\nexport const PayScheduleErrorCodes = {\n REQUIRED: 'REQUIRED',\n DAY_RANGE: 'DAY_RANGE',\n} as const\n\nexport type PayScheduleErrorCode =\n (typeof PayScheduleErrorCodes)[keyof typeof PayScheduleErrorCodes]\n\n// ── Field validators ───────────────────────────────────────────────────\n\nconst FREQUENCY_VALUES = ['Every week', 'Every other week', 'Twice per month', 'Monthly'] as const\nexport type PayScheduleFrequency = (typeof FREQUENCY_VALUES)[number]\n\nconst fieldValidators = {\n customName: z.string(),\n frequency: z.enum(FREQUENCY_VALUES),\n customTwicePerMonth: z.string(),\n anchorPayDate: z.preprocess(coerceToISODate, z.iso.date().nullable()),\n anchorEndOfPayPeriod: z.preprocess(coerceToISODate, z.iso.date().nullable()),\n day1: z.preprocess(coerceNaN(0), z.number()),\n day2: z.preprocess(coerceNaN(0), z.number()),\n}\n\nexport type PayScheduleField = keyof typeof fieldValidators\n\nexport type PayScheduleFormData = {\n [K in keyof typeof fieldValidators]: z.infer<(typeof fieldValidators)[K]>\n}\nexport type PayScheduleFormOutputs = PayScheduleFormData\n\n// ── Required fields config ─────────────────────────────────────────────\n\nfunction needsDay1(data: PayScheduleFormData): boolean {\n const freq = data.frequency\n const custom = data.customTwicePerMonth\n return freq === 'Monthly' || (freq === 'Twice per month' && custom === 'custom')\n}\n\nfunction needsDay2(data: PayScheduleFormData): boolean {\n const freq = data.frequency\n const custom = data.customTwicePerMonth\n return freq === 'Twice per month' && custom === 'custom'\n}\n\nconst requiredFieldsConfig = {\n customTwicePerMonth: 'never',\n day1: needsDay1,\n day2: needsDay2,\n} satisfies RequiredFieldConfig<typeof fieldValidators>\n\n/**\n * coerceNaN(0) maps empty inputs to 0, which `isEmpty` does not catch\n * (it only recognizes undefined/null/blank-string). This superRefine\n * enforces the 1–31 range when the field is applicable, which also\n * rejects the 0 sentinel from empty inputs.\n */\nfunction validateDayRanges(data: PayScheduleFormData, ctx: z.RefinementCtx) {\n if (needsDay1(data) && (data.day1 < 1 || data.day1 > 31)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['day1'],\n message: data.day1 < 1 ? PayScheduleErrorCodes.REQUIRED : PayScheduleErrorCodes.DAY_RANGE,\n })\n }\n if (needsDay2(data) && (data.day2 < 1 || data.day2 > 31)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['day2'],\n message: data.day2 < 1 ? PayScheduleErrorCodes.REQUIRED : PayScheduleErrorCodes.DAY_RANGE,\n })\n }\n}\n\n// ── Schema factory ─────────────────────────────────────────────────────\n\nexport type PayScheduleOptionalFieldsToRequire = OptionalFieldsToRequire<\n typeof requiredFieldsConfig\n>\n\ninterface PayScheduleSchemaOptions {\n mode?: 'create' | 'update'\n optionalFieldsToRequire?: PayScheduleOptionalFieldsToRequire\n}\n\nexport function createPayScheduleSchema(options: PayScheduleSchemaOptions = {}) {\n const { mode = 'create', optionalFieldsToRequire } = options\n\n return buildFormSchema(fieldValidators, {\n requiredFieldsConfig,\n requiredErrorCode: PayScheduleErrorCodes.REQUIRED,\n mode,\n optionalFieldsToRequire,\n superRefine: validateDayRanges,\n })\n}\n"],"names":["PayScheduleErrorCodes","FREQUENCY_VALUES","fieldValidators","z","coerceToISODate","coerceNaN","needsDay1","data","freq","custom","needsDay2","requiredFieldsConfig","validateDayRanges","ctx","createPayScheduleSchema","options","mode","optionalFieldsToRequire","buildFormSchema"],"mappings":";;;AAUO,MAAMA,IAAwB;AAAA,EACnC,UAAU;AAAA,EACV,WAAW;AACb,GAOMC,IAAmB,CAAC,cAAc,oBAAoB,mBAAmB,SAAS,GAGlFC,IAAkB;AAAA,EACtB,YAAYC,EAAE,OAAA;AAAA,EACd,WAAWA,EAAE,KAAKF,CAAgB;AAAA,EAClC,qBAAqBE,EAAE,OAAA;AAAA,EACvB,eAAeA,EAAE,WAAWC,GAAiBD,EAAE,IAAI,OAAO,UAAU;AAAA,EACpE,sBAAsBA,EAAE,WAAWC,GAAiBD,EAAE,IAAI,OAAO,UAAU;AAAA,EAC3E,MAAMA,EAAE,WAAWE,EAAU,CAAC,GAAGF,EAAE,QAAQ;AAAA,EAC3C,MAAMA,EAAE,WAAWE,EAAU,CAAC,GAAGF,EAAE,QAAQ;AAC7C;AAWA,SAASG,EAAUC,GAAoC;AACrD,QAAMC,IAAOD,EAAK,WACZE,IAASF,EAAK;AACpB,SAAOC,MAAS,aAAcA,MAAS,qBAAqBC,MAAW;AACzE;AAEA,SAASC,EAAUH,GAAoC;AACrD,QAAMC,IAAOD,EAAK,WACZE,IAASF,EAAK;AACpB,SAAOC,MAAS,qBAAqBC,MAAW;AAClD;AAEA,MAAME,IAAuB;AAAA,EAC3B,qBAAqB;AAAA,EACrB,MAAML;AAAA,EACN,MAAMI;AACR;AAQA,SAASE,EAAkBL,GAA2BM,GAAsB;AAC1E,EAAIP,EAAUC,CAAI,MAAMA,EAAK,OAAO,KAAKA,EAAK,OAAO,OACnDM,EAAI,SAAS;AAAA,IACX,MAAMV,EAAE,aAAa;AAAA,IACrB,MAAM,CAAC,MAAM;AAAA,IACb,SAASI,EAAK,OAAO,IAAIP,EAAsB,WAAWA,EAAsB;AAAA,EAAA,CACjF,GAECU,EAAUH,CAAI,MAAMA,EAAK,OAAO,KAAKA,EAAK,OAAO,OACnDM,EAAI,SAAS;AAAA,IACX,MAAMV,EAAE,aAAa;AAAA,IACrB,MAAM,CAAC,MAAM;AAAA,IACb,SAASI,EAAK,OAAO,IAAIP,EAAsB,WAAWA,EAAsB;AAAA,EAAA,CACjF;AAEL;AAaO,SAASc,EAAwBC,IAAoC,IAAI;AAC9E,QAAM,EAAE,MAAAC,IAAO,UAAU,yBAAAC,EAAA,IAA4BF;AAErD,SAAOG,EAAgBhB,GAAiB;AAAA,IACtC,sBAAAS;AAAA,IACA,mBAAmBX,EAAsB;AAAA,IACzC,MAAAgB;AAAA,IACA,yBAAAC;AAAA,IACA,aAAaL;AAAA,EAAA,CACd;AACH;"}
1
+ {"version":3,"file":"payScheduleSchema.js","sources":["../../../../../../src/components/Company/PaySchedule/shared/usePayScheduleForm/payScheduleSchema.ts"],"sourcesContent":["import { z } from 'zod'\nimport {\n buildFormSchema,\n type RequiredFieldConfig,\n type OptionalFieldsToRequire,\n} from '@/partner-hook-utils/form/buildFormSchema'\nimport { coerceNaN, coerceToISODate } from '@/partner-hook-utils/form/preprocessors'\n\n// ── Error codes ────────────────────────────────────────────────────────\n\n/**\n * Validation error codes emitted by {@link usePayScheduleForm} fields.\n *\n * @remarks\n * Use these as `validationMessages` keys on the corresponding `Fields.*` components.\n *\n * @public\n */\nexport const PayScheduleErrorCodes = {\n REQUIRED: 'REQUIRED',\n DAY_RANGE: 'DAY_RANGE',\n} as const\n\n/**\n * Union of validation error code strings emitted by the pay schedule form.\n *\n * @public\n */\nexport type PayScheduleErrorCode =\n (typeof PayScheduleErrorCodes)[keyof typeof PayScheduleErrorCodes]\n\n// ── Field validators ───────────────────────────────────────────────────\n\nconst FREQUENCY_VALUES = ['Every week', 'Every other week', 'Twice per month', 'Monthly'] as const\n/**\n * Pay schedule frequency values accepted by {@link usePayScheduleForm}.\n *\n * @public\n */\nexport type PayScheduleFrequency = (typeof FREQUENCY_VALUES)[number]\n\nconst fieldValidators = {\n customName: z.string(),\n frequency: z.enum(FREQUENCY_VALUES),\n customTwicePerMonth: z.string(),\n anchorPayDate: z.preprocess(coerceToISODate, z.iso.date().nullable()),\n anchorEndOfPayPeriod: z.preprocess(coerceToISODate, z.iso.date().nullable()),\n day1: z.preprocess(coerceNaN(0), z.number()),\n day2: z.preprocess(coerceNaN(0), z.number()),\n}\n\n/**\n * Union of field names managed by the pay schedule form.\n *\n * @public\n */\nexport type PayScheduleField = keyof typeof fieldValidators\n\n/**\n * Shape of the values managed by the pay schedule form.\n *\n * @public\n */\nexport type PayScheduleFormData = {\n [K in keyof typeof fieldValidators]: z.infer<(typeof fieldValidators)[K]>\n}\n/**\n * Shape of the validated values produced by the pay schedule form on submit.\n *\n * @public\n */\nexport type PayScheduleFormOutputs = PayScheduleFormData\n\n// ── Required fields config ─────────────────────────────────────────────\n\nfunction needsDay1(data: PayScheduleFormData): boolean {\n const freq = data.frequency\n const custom = data.customTwicePerMonth\n return freq === 'Monthly' || (freq === 'Twice per month' && custom === 'custom')\n}\n\nfunction needsDay2(data: PayScheduleFormData): boolean {\n const freq = data.frequency\n const custom = data.customTwicePerMonth\n return freq === 'Twice per month' && custom === 'custom'\n}\n\nconst requiredFieldsConfig = {\n customTwicePerMonth: 'never',\n day1: needsDay1,\n day2: needsDay2,\n} satisfies RequiredFieldConfig<typeof fieldValidators>\n\n/**\n * coerceNaN(0) maps empty inputs to 0, which `isEmpty` does not catch\n * (it only recognizes undefined/null/blank-string). This superRefine\n * enforces the 1–31 range when the field is applicable, which also\n * rejects the 0 sentinel from empty inputs.\n */\nfunction validateDayRanges(data: PayScheduleFormData, ctx: z.RefinementCtx) {\n if (needsDay1(data) && (data.day1 < 1 || data.day1 > 31)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['day1'],\n message: data.day1 < 1 ? PayScheduleErrorCodes.REQUIRED : PayScheduleErrorCodes.DAY_RANGE,\n })\n }\n if (needsDay2(data) && (data.day2 < 1 || data.day2 > 31)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['day2'],\n message: data.day2 < 1 ? PayScheduleErrorCodes.REQUIRED : PayScheduleErrorCodes.DAY_RANGE,\n })\n }\n}\n\n// ── Schema factory ─────────────────────────────────────────────────────\n\n/**\n * Configuration for promoting optional pay schedule fields to required in a given mode.\n *\n * @remarks\n * Only fields that are optional by default can be promoted. Currently\n * `customTwicePerMonth` is the only configurable field.\n *\n * @public\n */\nexport type PayScheduleOptionalFieldsToRequire = OptionalFieldsToRequire<\n typeof requiredFieldsConfig\n>\n\n/** @internal */\ninterface PayScheduleSchemaOptions {\n mode?: 'create' | 'update'\n optionalFieldsToRequire?: PayScheduleOptionalFieldsToRequire\n}\n\n/** @internal */\nexport function createPayScheduleSchema(options: PayScheduleSchemaOptions = {}) {\n const { mode = 'create', optionalFieldsToRequire } = options\n\n return buildFormSchema(fieldValidators, {\n requiredFieldsConfig,\n requiredErrorCode: PayScheduleErrorCodes.REQUIRED,\n mode,\n optionalFieldsToRequire,\n superRefine: validateDayRanges,\n })\n}\n"],"names":["PayScheduleErrorCodes","FREQUENCY_VALUES","fieldValidators","z","coerceToISODate","coerceNaN","needsDay1","data","freq","custom","needsDay2","requiredFieldsConfig","validateDayRanges","ctx","createPayScheduleSchema","options","mode","optionalFieldsToRequire","buildFormSchema"],"mappings":";;;AAkBO,MAAMA,IAAwB;AAAA,EACnC,UAAU;AAAA,EACV,WAAW;AACb,GAYMC,IAAmB,CAAC,cAAc,oBAAoB,mBAAmB,SAAS,GAQlFC,IAAkB;AAAA,EACtB,YAAYC,E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,EAAA,IAA4BF;AAErD,SAAOG,EAAgBhB,GAAiB;AAAA,IACtC,sBAAAS;AAAA,IACA,mBAAmBX,EAAsB;AAAA,IACzC,MAAAgB;AAAA,IACA,yBAAAC;AAAA,IACA,aAAaL;AAAA,EAAA,CACd;AACH;"}
@@ -5,39 +5,173 @@ import { PayScheduleOptionalFieldsToRequire, PayScheduleFormData } from './paySc
5
5
  import { CustomNameField, FrequencyField, CustomTwicePerMonthField, AnchorPayDateField, AnchorEndOfPayPeriodField, Day1Field, Day2Field } from './fields';
6
6
  import { BaseFormHookReady, FieldsMetadata, HookLoadingResult, HookSubmitResult } from '../../../../../partner-hook-utils/types';
7
7
  export type { PayScheduleOptionalFieldsToRequire } from './payScheduleSchema';
8
+ /**
9
+ * Configuration options for {@link usePayScheduleForm}.
10
+ *
11
+ * @remarks
12
+ * Presence or absence of `payScheduleId` selects between update and create mode.
13
+ *
14
+ * @public
15
+ */
8
16
  export interface UsePayScheduleFormProps {
17
+ /** UUID of the company that owns the pay schedule. */
9
18
  companyId: string;
19
+ /**
20
+ * When set, loads that pay schedule and updates it on submit. When omitted,
21
+ * the form is in create mode and creates a new schedule on submit.
22
+ */
10
23
  payScheduleId?: string;
24
+ /** Override fields that are optional on a given mode to be required. See `PayScheduleOptionalFieldsToRequire`. */
11
25
  optionalFieldsToRequire?: PayScheduleOptionalFieldsToRequire;
26
+ /** Pre-fill form values. Server data takes precedence on update. */
12
27
  defaultValues?: Partial<PayScheduleFormData>;
28
+ /** Passed through to react-hook-form. Defaults to `'onSubmit'`. */
13
29
  validationMode?: UseFormProps['mode'];
30
+ /** Auto-focus the first invalid field on submit. Set to `false` when using `composeSubmitHandler` so submit-time focus is coordinated across multiple forms. Defaults to `true`. */
14
31
  shouldFocusError?: boolean;
15
32
  }
33
+ /**
34
+ * Pre-bound field components exposed on `usePayScheduleForm().form.Fields`.
35
+ *
36
+ * @remarks
37
+ * `CustomTwicePerMonth`, `Day1`, and `Day2` are conditionally `undefined` based
38
+ * on the selected frequency and twice-per-month strategy — always null-check them
39
+ * before rendering.
40
+ *
41
+ * @public
42
+ */
16
43
  export interface PayScheduleFields {
44
+ /** Display name text input. Always available. */
17
45
  CustomName: typeof CustomNameField;
46
+ /** Frequency selector. Always available. */
18
47
  Frequency: typeof FrequencyField;
48
+ /** Twice-per-month strategy radio group. Only available when frequency is `'Twice per month'`. */
19
49
  CustomTwicePerMonth: typeof CustomTwicePerMonthField | undefined;
50
+ /** First pay date picker. Always available. */
20
51
  AnchorPayDate: typeof AnchorPayDateField;
52
+ /** First pay period end date picker. Always available. */
21
53
  AnchorEndOfPayPeriod: typeof AnchorEndOfPayPeriodField;
54
+ /** First-pay-day-of-month number input. Available when frequency is `'Monthly'`, or `'Twice per month'` with `'custom'` strategy. */
22
55
  Day1: typeof Day1Field | undefined;
56
+ /** Last-pay-day-of-month number input. Available when frequency is `'Twice per month'` with `'custom'` strategy. */
23
57
  Day2: typeof Day2Field | undefined;
24
58
  }
59
+ /**
60
+ * Ready-state shape returned by {@link usePayScheduleForm} once data has loaded.
61
+ *
62
+ * @remarks
63
+ * Discriminated by `isLoading: false`. Extends {@link BaseFormHookReady} with the
64
+ * pay-schedule-specific `data`, `status`, `actions`, and `form.Fields` shape.
65
+ *
66
+ * @public
67
+ */
25
68
  export interface UsePayScheduleFormReady extends BaseFormHookReady<FieldsMetadata, PayScheduleFormData, PayScheduleFields> {
69
+ /** Static entity data resolved from the API. */
26
70
  data: {
71
+ /** The pay schedule loaded for update; `null` in create mode. */
27
72
  paySchedule: PayScheduleShow | null;
73
+ /** Upcoming pay periods previewed from current form values; `null` until the anchor date fields are complete. */
28
74
  payPeriodPreview: PaySchedulePreviewPayPeriod[] | null;
75
+ /** `true` while the pay period preview request is in flight. */
29
76
  payPreviewLoading: boolean;
77
+ /** Business days the company needs to process payroll, derived from payment configs; `null` if unavailable. */
30
78
  paymentSpeedDays: number | null;
31
79
  };
80
+ /** Reactive status flags. */
32
81
  status: {
82
+ /** `true` while the create or update mutation is in flight. */
33
83
  isPending: boolean;
84
+ /** Whether the form is creating a new schedule or updating an existing one. */
34
85
  mode: 'create' | 'update';
35
86
  };
87
+ /** Available actions. */
36
88
  actions: {
89
+ /** Validates the form and dispatches the create or update mutation. Returns the saved schedule, or `undefined` if validation failed. */
37
90
  onSubmit: () => Promise<HookSubmitResult<PayScheduleShow> | undefined>;
38
91
  };
39
92
  }
93
+ /**
94
+ * Form hook for creating or updating a company pay schedule.
95
+ *
96
+ * @remarks
97
+ * When `payScheduleId` is supplied the hook loads that schedule and issues an
98
+ * update on submit; when omitted it operates in create mode. While both anchor
99
+ * date fields are filled in, the hook fetches a live pay period calendar
100
+ * preview exposed on `data.payPeriodPreview`. `data.paymentSpeedDays` reflects
101
+ * the company's payment configuration and is useful for surfacing UI hints
102
+ * about how far ahead the first pay date must be.
103
+ *
104
+ * @param props - See {@link UsePayScheduleFormProps}.
105
+ * @returns A {@link HookLoadingResult} while loading, or a {@link UsePayScheduleFormReady} once ready.
106
+ * @public
107
+ *
108
+ * @example
109
+ * ```tsx
110
+ * import {
111
+ * usePayScheduleForm,
112
+ * SDKFormProvider,
113
+ * type UsePayScheduleFormReady,
114
+ * } from '@gusto/embedded-react-sdk'
115
+ *
116
+ * function PaySchedulePage({ companyId }: { companyId: string }) {
117
+ * const paySchedule = usePayScheduleForm({ companyId })
118
+ *
119
+ * if (paySchedule.isLoading) return <div>Loading...</div>
120
+ *
121
+ * return <PayScheduleFormReady paySchedule={paySchedule} />
122
+ * }
123
+ *
124
+ * function PayScheduleFormReady({ paySchedule }: { paySchedule: UsePayScheduleFormReady }) {
125
+ * const { Fields } = paySchedule.form
126
+ *
127
+ * return (
128
+ * <SDKFormProvider formHookResult={paySchedule}>
129
+ * <form
130
+ * onSubmit={e => {
131
+ * e.preventDefault()
132
+ * void paySchedule.actions.onSubmit()
133
+ * }}
134
+ * >
135
+ * <Fields.CustomName label="Name" validationMessages={{ REQUIRED: 'Name is required' }} />
136
+ * <Fields.Frequency label="Frequency" validationMessages={{ REQUIRED: 'Frequency is required' }} />
137
+ * {Fields.CustomTwicePerMonth && <Fields.CustomTwicePerMonth label="Frequency Options" />}
138
+ * <Fields.AnchorPayDate label="First pay date" validationMessages={{ REQUIRED: 'Required' }} />
139
+ * <Fields.AnchorEndOfPayPeriod label="First pay period end" validationMessages={{ REQUIRED: 'Required' }} />
140
+ * {Fields.Day1 && (
141
+ * <Fields.Day1
142
+ * label="First pay day of the month"
143
+ * validationMessages={{ REQUIRED: 'Required', DAY_RANGE: 'Must be 1–31' }}
144
+ * />
145
+ * )}
146
+ * {Fields.Day2 && (
147
+ * <Fields.Day2
148
+ * label="Last pay day of the month"
149
+ * validationMessages={{ REQUIRED: 'Required', DAY_RANGE: 'Must be 1–31' }}
150
+ * />
151
+ * )}
152
+ * <button type="submit" disabled={paySchedule.status.isPending}>Save</button>
153
+ * </form>
154
+ * </SDKFormProvider>
155
+ * )
156
+ * }
157
+ * ```
158
+ */
40
159
  export declare function usePayScheduleForm({ companyId, payScheduleId, optionalFieldsToRequire, defaultValues: partnerDefaults, validationMode, shouldFocusError, }: UsePayScheduleFormProps): HookLoadingResult | UsePayScheduleFormReady;
160
+ /**
161
+ * Discriminated union returned by {@link usePayScheduleForm}.
162
+ *
163
+ * @public
164
+ */
41
165
  export type UsePayScheduleFormResult = HookLoadingResult | UsePayScheduleFormReady;
166
+ /**
167
+ * Type of `form.fieldsMetadata` returned by {@link usePayScheduleForm}.
168
+ *
169
+ * @public
170
+ */
42
171
  export type PayScheduleFieldsMetadata = UsePayScheduleFormReady['form']['fieldsMetadata'];
172
+ /**
173
+ * Type of `form.Fields` returned by {@link usePayScheduleForm}.
174
+ *
175
+ * @public
176
+ */
43
177
  export type PayScheduleFormFields = UsePayScheduleFormReady['form']['Fields'];
@@ -1 +1 @@
1
- {"version":3,"file":"usePayScheduleForm.js","sources":["../../../../../../src/components/Company/PaySchedule/shared/usePayScheduleForm/usePayScheduleForm.tsx"],"sourcesContent":["import { useEffect, useMemo } from 'react'\nimport { useForm, useWatch } from 'react-hook-form'\nimport type { UseFormProps } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport type { PayScheduleShow } from '@gusto/embedded-api-v-2025-11-15/models/components/payscheduleshow'\nimport type { PaySchedulePreviewPayPeriod } from '@gusto/embedded-api-v-2025-11-15/models/components/payschedulepreviewpayperiod'\nimport { usePaySchedulesGet } from '@gusto/embedded-api-v-2025-11-15/react-query/paySchedulesGet'\nimport { usePaySchedulesGetPreview } from '@gusto/embedded-api-v-2025-11-15/react-query/paySchedulesGetPreview'\nimport { usePaySchedulesCreateMutation } from '@gusto/embedded-api-v-2025-11-15/react-query/paySchedulesCreate'\nimport { usePaySchedulesUpdateMutation } from '@gusto/embedded-api-v-2025-11-15/react-query/paySchedulesUpdate'\nimport { usePaymentConfigsGet } from '@gusto/embedded-api-v-2025-11-15/react-query/paymentConfigsGet'\nimport { RFCDate } from '@gusto/embedded-api-v-2025-11-15/types/rfcdate'\nimport {\n createPayScheduleSchema,\n type PayScheduleOptionalFieldsToRequire,\n type PayScheduleFormData,\n type PayScheduleFormOutputs,\n type PayScheduleFrequency,\n} from './payScheduleSchema'\nimport {\n CustomNameField,\n FrequencyField,\n CustomTwicePerMonthField,\n AnchorPayDateField,\n AnchorEndOfPayPeriodField,\n Day1Field,\n Day2Field,\n} from './fields'\nimport { useDeriveFieldsMetadata } from '@/partner-hook-utils/form/useDeriveFieldsMetadata'\nimport { useHookFormInternals } from '@/partner-hook-utils/form/useHookFormInternals'\nimport { createGetFormSubmissionValues } from '@/partner-hook-utils/form/getFormSubmissionValues'\nimport { withOptions } from '@/partner-hook-utils/form/withOptions'\nimport { composeErrorHandler } from '@/partner-hook-utils/composeErrorHandler'\nimport type {\n BaseFormHookReady,\n FieldsMetadata,\n HookLoadingResult,\n HookSubmitResult,\n} from '@/partner-hook-utils/types'\nimport { useBaseSubmit } from '@/components/Base/useBaseSubmit'\nimport { parsePaymentSpeedDays } from '@/hooks/useCompanyPaymentSpeed'\nimport { formatDateToStringDate } from '@/helpers/dateFormatting'\n\nexport type { PayScheduleOptionalFieldsToRequire } from './payScheduleSchema'\n\nexport interface UsePayScheduleFormProps {\n companyId: string\n payScheduleId?: string\n optionalFieldsToRequire?: PayScheduleOptionalFieldsToRequire\n defaultValues?: Partial<PayScheduleFormData>\n validationMode?: UseFormProps['mode']\n shouldFocusError?: boolean\n}\n\nexport interface PayScheduleFields {\n CustomName: typeof CustomNameField\n Frequency: typeof FrequencyField\n CustomTwicePerMonth: typeof CustomTwicePerMonthField | undefined\n AnchorPayDate: typeof AnchorPayDateField\n AnchorEndOfPayPeriod: typeof AnchorEndOfPayPeriodField\n Day1: typeof Day1Field | undefined\n Day2: typeof Day2Field | undefined\n}\n\nexport interface UsePayScheduleFormReady extends BaseFormHookReady<\n FieldsMetadata,\n PayScheduleFormData,\n PayScheduleFields\n> {\n data: {\n paySchedule: PayScheduleShow | null\n payPeriodPreview: PaySchedulePreviewPayPeriod[] | null\n payPreviewLoading: boolean\n paymentSpeedDays: number | null\n }\n status: { isPending: boolean; mode: 'create' | 'update' }\n actions: {\n onSubmit: () => Promise<HookSubmitResult<PayScheduleShow> | undefined>\n }\n}\n\nconst FREQUENCY_OPTIONS: Array<{ value: PayScheduleFrequency; label: string }> = [\n { value: 'Every week', label: 'Every week' },\n { value: 'Every other week', label: 'Every other week' },\n { value: 'Twice per month', label: 'Twice per month' },\n { value: 'Monthly', label: 'Monthly' },\n]\n\nconst FREQUENCY_ENTRIES: PayScheduleFrequency[] = FREQUENCY_OPTIONS.map(o => o.value)\n\nconst TWICE_PER_MONTH_OPTIONS = [\n { value: '1st15th', label: '15th and Last day of the month' },\n { value: 'custom', label: 'Custom' },\n]\n\nconst TWICE_PER_MONTH_ENTRIES = TWICE_PER_MONTH_OPTIONS.map(o => o.value)\n\nfunction formatWatchedDate(value: unknown): string {\n if (value instanceof Date) return formatDateToStringDate(value) || ''\n if (typeof value === 'string' && value) return value\n return ''\n}\n\nfunction deriveCustomTwicePerMonth(\n frequency: string | undefined,\n day1: number | undefined,\n day2: number | undefined,\n): string {\n if (frequency !== 'Twice per month') return ''\n if (day1 === 15 && day2 === 31) return '1st15th'\n return 'custom'\n}\n\nexport function usePayScheduleForm({\n companyId,\n payScheduleId,\n optionalFieldsToRequire,\n defaultValues: partnerDefaults,\n validationMode = 'onSubmit',\n shouldFocusError = true,\n}: UsePayScheduleFormProps): HookLoadingResult | UsePayScheduleFormReady {\n const payScheduleQuery = usePaySchedulesGet(\n { companyId, payScheduleId: payScheduleId ?? '' },\n { enabled: !!payScheduleId },\n )\n\n const paymentConfigsQuery = usePaymentConfigsGet({ companyUuid: companyId })\n\n const currentPaySchedule = payScheduleQuery.data?.payScheduleShow ?? null\n const paymentSpeed = paymentConfigsQuery.data?.paymentConfigs?.paymentSpeed\n const paymentSpeedDays = parsePaymentSpeedDays(paymentSpeed)\n\n const isCreateMode = !currentPaySchedule\n const mode = isCreateMode ? 'create' : 'update'\n\n const [schema, metadataConfig] = useMemo(\n () => createPayScheduleSchema({ mode, optionalFieldsToRequire }),\n [mode, optionalFieldsToRequire],\n )\n\n const resolvedDefaults: PayScheduleFormData = {\n customName: currentPaySchedule?.customName ?? partnerDefaults?.customName ?? '',\n frequency: (currentPaySchedule?.frequency ??\n partnerDefaults?.frequency ??\n 'Every week') as PayScheduleFrequency,\n customTwicePerMonth: deriveCustomTwicePerMonth(\n currentPaySchedule?.frequency ?? partnerDefaults?.frequency,\n currentPaySchedule?.day1 ?? partnerDefaults?.day1 ?? undefined,\n currentPaySchedule?.day2 ?? partnerDefaults?.day2 ?? undefined,\n ),\n anchorPayDate:\n currentPaySchedule?.anchorPayDate?.toString() ?? partnerDefaults?.anchorPayDate ?? null,\n anchorEndOfPayPeriod:\n currentPaySchedule?.anchorEndOfPayPeriod?.toString() ??\n partnerDefaults?.anchorEndOfPayPeriod ??\n null,\n day1: currentPaySchedule?.day1 ?? partnerDefaults?.day1 ?? NaN,\n day2: currentPaySchedule?.day2 ?? partnerDefaults?.day2 ?? NaN,\n }\n\n const formMethods = useForm<PayScheduleFormData, unknown, PayScheduleFormOutputs>({\n resolver: zodResolver(schema),\n mode: validationMode,\n shouldFocusError,\n defaultValues: resolvedDefaults,\n values: resolvedDefaults,\n resetOptions: { keepDirtyValues: true },\n })\n\n const watchedFrequency = useWatch({ control: formMethods.control, name: 'frequency' })\n const watchedCustomTwicePerMonth = useWatch({\n control: formMethods.control,\n name: 'customTwicePerMonth',\n })\n const watchedAnchorPayDate = useWatch({ control: formMethods.control, name: 'anchorPayDate' })\n const watchedAnchorEndOfPayPeriod = useWatch({\n control: formMethods.control,\n name: 'anchorEndOfPayPeriod',\n })\n const watchedDay1 = useWatch({ control: formMethods.control, name: 'day1' })\n const watchedDay2 = useWatch({ control: formMethods.control, name: 'day2' })\n\n useEffect(() => {\n if (watchedFrequency === 'Twice per month' && watchedCustomTwicePerMonth === '1st15th') {\n formMethods.setValue('day1', 15)\n formMethods.setValue('day2', 31)\n }\n }, [watchedFrequency, watchedCustomTwicePerMonth, formMethods.setValue])\n\n const formattedAnchorPayDate = formatWatchedDate(watchedAnchorPayDate)\n const formattedAnchorEndOfPayPeriod = formatWatchedDate(watchedAnchorEndOfPayPeriod)\n\n const previewEnabled = Boolean(formattedAnchorPayDate && formattedAnchorEndOfPayPeriod)\n\n const previewQuery = usePaySchedulesGetPreview(\n {\n companyId,\n frequency: watchedFrequency,\n ...(formattedAnchorPayDate && { anchorPayDate: new RFCDate(formattedAnchorPayDate) }),\n ...(formattedAnchorEndOfPayPeriod && {\n anchorEndOfPayPeriod: new RFCDate(formattedAnchorEndOfPayPeriod),\n }),\n day1: watchedDay1 || undefined,\n day2: watchedDay2 || undefined,\n } as Parameters<typeof usePaySchedulesGetPreview>[0],\n { enabled: previewEnabled },\n )\n\n const payPeriodPreview: PaySchedulePreviewPayPeriod[] | undefined =\n previewQuery.data?.paySchedulePreview?.payPeriods\n const payPreviewLoading = previewQuery.isLoading && previewEnabled\n\n const createPayScheduleMutation = usePaySchedulesCreateMutation()\n const updatePayScheduleMutation = usePaySchedulesUpdateMutation()\n\n const isPending = createPayScheduleMutation.isPending || updatePayScheduleMutation.isPending\n\n const {\n baseSubmitHandler,\n error: submitError,\n setError: setSubmitError,\n } = useBaseSubmit('PayScheduleForm')\n\n const queries = payScheduleId ? [payScheduleQuery, paymentConfigsQuery] : [paymentConfigsQuery]\n const errorHandling = composeErrorHandler(queries, { submitError, setSubmitError })\n\n const showCustomTwicePerMonth = watchedFrequency === 'Twice per month'\n const showDay1 =\n watchedFrequency === 'Monthly' ||\n (watchedFrequency === 'Twice per month' && watchedCustomTwicePerMonth === 'custom')\n const showDay2 = watchedFrequency === 'Twice per month' && watchedCustomTwicePerMonth === 'custom'\n\n const baseMetadata = useDeriveFieldsMetadata(metadataConfig, formMethods.control)\n const fieldsMetadata = {\n customName: baseMetadata.customName,\n frequency: withOptions<PayScheduleFrequency>(\n baseMetadata.frequency,\n FREQUENCY_OPTIONS,\n FREQUENCY_ENTRIES,\n ),\n customTwicePerMonth: withOptions<string>(\n baseMetadata.customTwicePerMonth,\n TWICE_PER_MONTH_OPTIONS,\n TWICE_PER_MONTH_ENTRIES,\n ),\n anchorPayDate: baseMetadata.anchorPayDate,\n anchorEndOfPayPeriod: baseMetadata.anchorEndOfPayPeriod,\n day1: baseMetadata.day1,\n day2: baseMetadata.day2,\n }\n\n const onSubmit = async (): Promise<HookSubmitResult<PayScheduleShow> | undefined> => {\n let submitResult: HookSubmitResult<PayScheduleShow> | undefined\n\n await new Promise<void>(resolve => {\n void formMethods.handleSubmit(\n async (data: PayScheduleFormOutputs) => {\n await baseSubmitHandler(data, async payload => {\n const anchorPayDate = payload.anchorPayDate ?? ''\n const anchorEndOfPayPeriod = payload.anchorEndOfPayPeriod ?? ''\n\n if (isCreateMode) {\n const result = await createPayScheduleMutation.mutateAsync({\n request: {\n companyId,\n payScheduleCreateRequest: {\n frequency: payload.frequency,\n anchorPayDate: new RFCDate(anchorPayDate),\n anchorEndOfPayPeriod: new RFCDate(anchorEndOfPayPeriod),\n customName: payload.customName,\n day1: payload.day1 || undefined,\n day2: payload.day2 || undefined,\n },\n },\n })\n\n submitResult = { mode: 'create', data: result.payScheduleShow! }\n } else {\n const result = await updatePayScheduleMutation.mutateAsync({\n request: {\n payScheduleId: currentPaySchedule.uuid,\n companyId,\n payScheduleUpdateRequest: {\n frequency: payload.frequency,\n anchorPayDate: new RFCDate(anchorPayDate),\n anchorEndOfPayPeriod: new RFCDate(anchorEndOfPayPeriod),\n customName: payload.customName,\n day1: payload.day1 || undefined,\n day2: payload.day2 || undefined,\n version: currentPaySchedule.version!,\n },\n },\n })\n\n submitResult = { mode: 'update', data: result.payScheduleShow! }\n }\n })\n resolve()\n },\n () => {\n resolve()\n },\n )()\n })\n\n return submitResult\n }\n\n const hookFormInternals = useHookFormInternals(formMethods)\n\n const isDataLoading =\n paymentConfigsQuery.isLoading || (payScheduleId ? payScheduleQuery.isLoading : false)\n\n if (isDataLoading) {\n return { isLoading: true as const, errorHandling }\n }\n\n return {\n isLoading: false as const,\n data: {\n paySchedule: currentPaySchedule,\n payPeriodPreview: payPeriodPreview ?? null,\n payPreviewLoading,\n paymentSpeedDays,\n },\n status: {\n isPending,\n mode: isCreateMode ? ('create' as const) : ('update' as const),\n },\n actions: { onSubmit },\n errorHandling,\n form: {\n Fields: {\n CustomName: CustomNameField,\n Frequency: FrequencyField,\n CustomTwicePerMonth: showCustomTwicePerMonth ? CustomTwicePerMonthField : undefined,\n AnchorPayDate: AnchorPayDateField,\n AnchorEndOfPayPeriod: AnchorEndOfPayPeriodField,\n Day1: showDay1 ? Day1Field : undefined,\n Day2: showDay2 ? Day2Field : undefined,\n },\n fieldsMetadata,\n hookFormInternals,\n getFormSubmissionValues: createGetFormSubmissionValues(formMethods, schema),\n },\n }\n}\n\nexport type UsePayScheduleFormResult = HookLoadingResult | UsePayScheduleFormReady\nexport type PayScheduleFieldsMetadata = UsePayScheduleFormReady['form']['fieldsMetadata']\nexport type PayScheduleFormFields = UsePayScheduleFormReady['form']['Fields']\n"],"names":["FREQUENCY_OPTIONS","FREQUENCY_ENTRIES","o","TWICE_PER_MONTH_OPTIONS","TWICE_PER_MONTH_ENTRIES","formatWatchedDate","value","formatDateToStringDate","deriveCustomTwicePerMonth","frequency","day1","day2","usePayScheduleForm","companyId","payScheduleId","optionalFieldsToRequire","partnerDefaults","validationMode","shouldFocusError","payScheduleQuery","usePaySchedulesGet","paymentConfigsQuery","usePaymentConfigsGet","currentPaySchedule","paymentSpeed","paymentSpeedDays","parsePaymentSpeedDays","isCreateMode","mode","schema","metadataConfig","useMemo","createPayScheduleSchema","resolvedDefaults","formMethods","useForm","zodResolver","watchedFrequency","useWatch","watchedCustomTwicePerMonth","watchedAnchorPayDate","watchedAnchorEndOfPayPeriod","watchedDay1","watchedDay2","useEffect","formattedAnchorPayDate","formattedAnchorEndOfPayPeriod","previewEnabled","previewQuery","usePaySchedulesGetPreview","RFCDate","payPeriodPreview","payPreviewLoading","createPayScheduleMutation","usePaySchedulesCreateMutation","updatePayScheduleMutation","usePaySchedulesUpdateMutation","isPending","baseSubmitHandler","submitError","setSubmitError","useBaseSubmit","errorHandling","composeErrorHandler","showCustomTwicePerMonth","showDay1","showDay2","baseMetadata","useDeriveFieldsMetadata","fieldsMetadata","withOptions","onSubmit","submitResult","resolve","data","payload","anchorPayDate","anchorEndOfPayPeriod","hookFormInternals","useHookFormInternals","CustomNameField","FrequencyField","CustomTwicePerMonthField","AnchorPayDateField","AnchorEndOfPayPeriodField","Day1Field","Day2Field","createGetFormSubmissionValues"],"mappings":";;;;;;;;;;;;;;;;;;;AAiFA,MAAMA,IAA2E;AAAA,EAC/E,EAAE,OAAO,cAAc,OAAO,aAAA;AAAA,EAC9B,EAAE,OAAO,oBAAoB,OAAO,mBAAA;AAAA,EACpC,EAAE,OAAO,mBAAmB,OAAO,kBAAA;AAAA,EACnC,EAAE,OAAO,WAAW,OAAO,UAAA;AAC7B,GAEMC,KAA4CD,EAAkB,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AGxE,EAAE,WAAW,IAAe,eAAA2C,EAAA,IAG9B;AAAA,IACL,WAAW;AAAA,IACX,MAAM;AAAA,MACJ,aAAavC;AAAA,MACb,kBAAkB4B,KAAoB;AAAA,MACtC,mBAAAC;AAAA,MACA,kBAAA3B;AAAA,IAAA;AAAA,IAEF,QAAQ;AAAA,MACN,WAAAgC;AAAA,MACA,MAAM9B,IAAgB,WAAsB;AAAA,IAAA;AAAA,IAE9C,SAAS,EAAE,UAAA4C,EAAA;AAAA,IACX,eAAAT;AAAA,IACA,MAAM;AAAA,MACJ,QAAQ;AAAA,QACN,YAAYkB;AAAA,QACZ,WAAWC;AAAA,QACX,qBAAqBjB,IAA0BkB,KAA2B;AAAA,QAC1E,eAAeC;AAAA,QACf,sBAAsBC;AAAA,QACtB,MAAMnB,IAAWoB,KAAY;AAAA,QAC7B,MAAMnB,IAAWoB,KAAY;AAAA,MAAA;AAAA,MAE/B,gBAAAjB;AAAA,MACA,mBAAAS;AAAA,MACA,yBAAyBS,GAA8BrD,GAAaL,CAAM;AAAA,IAAA;AAAA,EAC5E;AAEJ;"}
1
+ {"version":3,"file":"usePayScheduleForm.js","sources":["../../../../../../src/components/Company/PaySchedule/shared/usePayScheduleForm/usePayScheduleForm.tsx"],"sourcesContent":["import { useEffect, useMemo } from 'react'\nimport { useForm, useWatch } from 'react-hook-form'\nimport type { UseFormProps } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport type { PayScheduleShow } from '@gusto/embedded-api-v-2025-11-15/models/components/payscheduleshow'\nimport type { PaySchedulePreviewPayPeriod } from '@gusto/embedded-api-v-2025-11-15/models/components/payschedulepreviewpayperiod'\nimport { usePaySchedulesGet } from '@gusto/embedded-api-v-2025-11-15/react-query/paySchedulesGet'\nimport { usePaySchedulesGetPreview } from '@gusto/embedded-api-v-2025-11-15/react-query/paySchedulesGetPreview'\nimport { usePaySchedulesCreateMutation } from '@gusto/embedded-api-v-2025-11-15/react-query/paySchedulesCreate'\nimport { usePaySchedulesUpdateMutation } from '@gusto/embedded-api-v-2025-11-15/react-query/paySchedulesUpdate'\nimport { usePaymentConfigsGet } from '@gusto/embedded-api-v-2025-11-15/react-query/paymentConfigsGet'\nimport { RFCDate } from '@gusto/embedded-api-v-2025-11-15/types/rfcdate'\nimport {\n createPayScheduleSchema,\n type PayScheduleOptionalFieldsToRequire,\n type PayScheduleFormData,\n type PayScheduleFormOutputs,\n type PayScheduleFrequency,\n} from './payScheduleSchema'\nimport {\n CustomNameField,\n FrequencyField,\n CustomTwicePerMonthField,\n AnchorPayDateField,\n AnchorEndOfPayPeriodField,\n Day1Field,\n Day2Field,\n} from './fields'\nimport { useDeriveFieldsMetadata } from '@/partner-hook-utils/form/useDeriveFieldsMetadata'\nimport { useHookFormInternals } from '@/partner-hook-utils/form/useHookFormInternals'\nimport { createGetFormSubmissionValues } from '@/partner-hook-utils/form/getFormSubmissionValues'\nimport { withOptions } from '@/partner-hook-utils/form/withOptions'\nimport { composeErrorHandler } from '@/partner-hook-utils/composeErrorHandler'\nimport type {\n BaseFormHookReady,\n FieldsMetadata,\n HookLoadingResult,\n HookSubmitResult,\n} from '@/partner-hook-utils/types'\nimport { useBaseSubmit } from '@/components/Base/useBaseSubmit'\nimport { parsePaymentSpeedDays } from '@/hooks/useCompanyPaymentSpeed'\nimport { formatDateToStringDate } from '@/helpers/dateFormatting'\n\nexport type { PayScheduleOptionalFieldsToRequire } from './payScheduleSchema'\n\n/**\n * Configuration options for {@link usePayScheduleForm}.\n *\n * @remarks\n * Presence or absence of `payScheduleId` selects between update and create mode.\n *\n * @public\n */\nexport interface UsePayScheduleFormProps {\n /** UUID of the company that owns the pay schedule. */\n companyId: string\n /**\n * When set, loads that pay schedule and updates it on submit. When omitted,\n * the form is in create mode and creates a new schedule on submit.\n */\n payScheduleId?: string\n /** Override fields that are optional on a given mode to be required. See `PayScheduleOptionalFieldsToRequire`. */\n optionalFieldsToRequire?: PayScheduleOptionalFieldsToRequire\n /** Pre-fill form values. Server data takes precedence on update. */\n defaultValues?: Partial<PayScheduleFormData>\n /** Passed through to react-hook-form. Defaults to `'onSubmit'`. */\n validationMode?: UseFormProps['mode']\n /** Auto-focus the first invalid field on submit. Set to `false` when using `composeSubmitHandler` so submit-time focus is coordinated across multiple forms. Defaults to `true`. */\n shouldFocusError?: boolean\n}\n\n/**\n * Pre-bound field components exposed on `usePayScheduleForm().form.Fields`.\n *\n * @remarks\n * `CustomTwicePerMonth`, `Day1`, and `Day2` are conditionally `undefined` based\n * on the selected frequency and twice-per-month strategy — always null-check them\n * before rendering.\n *\n * @public\n */\nexport interface PayScheduleFields {\n /** Display name text input. Always available. */\n CustomName: typeof CustomNameField\n /** Frequency selector. Always available. */\n Frequency: typeof FrequencyField\n /** Twice-per-month strategy radio group. Only available when frequency is `'Twice per month'`. */\n CustomTwicePerMonth: typeof CustomTwicePerMonthField | undefined\n /** First pay date picker. Always available. */\n AnchorPayDate: typeof AnchorPayDateField\n /** First pay period end date picker. Always available. */\n AnchorEndOfPayPeriod: typeof AnchorEndOfPayPeriodField\n /** First-pay-day-of-month number input. Available when frequency is `'Monthly'`, or `'Twice per month'` with `'custom'` strategy. */\n Day1: typeof Day1Field | undefined\n /** Last-pay-day-of-month number input. Available when frequency is `'Twice per month'` with `'custom'` strategy. */\n Day2: typeof Day2Field | undefined\n}\n\n/**\n * Ready-state shape returned by {@link usePayScheduleForm} once data has loaded.\n *\n * @remarks\n * Discriminated by `isLoading: false`. Extends {@link BaseFormHookReady} with the\n * pay-schedule-specific `data`, `status`, `actions`, and `form.Fields` shape.\n *\n * @public\n */\nexport interface UsePayScheduleFormReady extends BaseFormHookReady<\n FieldsMetadata,\n PayScheduleFormData,\n PayScheduleFields\n> {\n /** Static entity data resolved from the API. */\n data: {\n /** The pay schedule loaded for update; `null` in create mode. */\n paySchedule: PayScheduleShow | null\n /** Upcoming pay periods previewed from current form values; `null` until the anchor date fields are complete. */\n payPeriodPreview: PaySchedulePreviewPayPeriod[] | null\n /** `true` while the pay period preview request is in flight. */\n payPreviewLoading: boolean\n /** Business days the company needs to process payroll, derived from payment configs; `null` if unavailable. */\n paymentSpeedDays: number | null\n }\n /** Reactive status flags. */\n status: {\n /** `true` while the create or update mutation is in flight. */\n isPending: boolean\n /** Whether the form is creating a new schedule or updating an existing one. */\n mode: 'create' | 'update'\n }\n /** Available actions. */\n actions: {\n /** Validates the form and dispatches the create or update mutation. Returns the saved schedule, or `undefined` if validation failed. */\n onSubmit: () => Promise<HookSubmitResult<PayScheduleShow> | undefined>\n }\n}\n\nconst FREQUENCY_OPTIONS: Array<{ value: PayScheduleFrequency; label: string }> = [\n { value: 'Every week', label: 'Every week' },\n { value: 'Every other week', label: 'Every other week' },\n { value: 'Twice per month', label: 'Twice per month' },\n { value: 'Monthly', label: 'Monthly' },\n]\n\nconst FREQUENCY_ENTRIES: PayScheduleFrequency[] = FREQUENCY_OPTIONS.map(o => o.value)\n\nconst TWICE_PER_MONTH_OPTIONS = [\n { value: '1st15th', label: '15th and Last day of the month' },\n { value: 'custom', label: 'Custom' },\n]\n\nconst TWICE_PER_MONTH_ENTRIES = TWICE_PER_MONTH_OPTIONS.map(o => o.value)\n\nfunction formatWatchedDate(value: unknown): string {\n if (value instanceof Date) return formatDateToStringDate(value) || ''\n if (typeof value === 'string' && value) return value\n return ''\n}\n\nfunction deriveCustomTwicePerMonth(\n frequency: string | undefined,\n day1: number | undefined,\n day2: number | undefined,\n): string {\n if (frequency !== 'Twice per month') return ''\n if (day1 === 15 && day2 === 31) return '1st15th'\n return 'custom'\n}\n\n/**\n * Form hook for creating or updating a company pay schedule.\n *\n * @remarks\n * When `payScheduleId` is supplied the hook loads that schedule and issues an\n * update on submit; when omitted it operates in create mode. While both anchor\n * date fields are filled in, the hook fetches a live pay period calendar\n * preview exposed on `data.payPeriodPreview`. `data.paymentSpeedDays` reflects\n * the company's payment configuration and is useful for surfacing UI hints\n * about how far ahead the first pay date must be.\n *\n * @param props - See {@link UsePayScheduleFormProps}.\n * @returns A {@link HookLoadingResult} while loading, or a {@link UsePayScheduleFormReady} once ready.\n * @public\n *\n * @example\n * ```tsx\n * import {\n * usePayScheduleForm,\n * SDKFormProvider,\n * type UsePayScheduleFormReady,\n * } from '@gusto/embedded-react-sdk'\n *\n * function PaySchedulePage({ companyId }: { companyId: string }) {\n * const paySchedule = usePayScheduleForm({ companyId })\n *\n * if (paySchedule.isLoading) return <div>Loading...</div>\n *\n * return <PayScheduleFormReady paySchedule={paySchedule} />\n * }\n *\n * function PayScheduleFormReady({ paySchedule }: { paySchedule: UsePayScheduleFormReady }) {\n * const { Fields } = paySchedule.form\n *\n * return (\n * <SDKFormProvider formHookResult={paySchedule}>\n * <form\n * onSubmit={e => {\n * e.preventDefault()\n * void paySchedule.actions.onSubmit()\n * }}\n * >\n * <Fields.CustomName label=\"Name\" validationMessages={{ REQUIRED: 'Name is required' }} />\n * <Fields.Frequency label=\"Frequency\" validationMessages={{ REQUIRED: 'Frequency is required' }} />\n * {Fields.CustomTwicePerMonth && <Fields.CustomTwicePerMonth label=\"Frequency Options\" />}\n * <Fields.AnchorPayDate label=\"First pay date\" validationMessages={{ REQUIRED: 'Required' }} />\n * <Fields.AnchorEndOfPayPeriod label=\"First pay period end\" validationMessages={{ REQUIRED: 'Required' }} />\n * {Fields.Day1 && (\n * <Fields.Day1\n * label=\"First pay day of the month\"\n * validationMessages={{ REQUIRED: 'Required', DAY_RANGE: 'Must be 1–31' }}\n * />\n * )}\n * {Fields.Day2 && (\n * <Fields.Day2\n * label=\"Last pay day of the month\"\n * validationMessages={{ REQUIRED: 'Required', DAY_RANGE: 'Must be 1–31' }}\n * />\n * )}\n * <button type=\"submit\" disabled={paySchedule.status.isPending}>Save</button>\n * </form>\n * </SDKFormProvider>\n * )\n * }\n * ```\n */\nexport function usePayScheduleForm({\n companyId,\n payScheduleId,\n optionalFieldsToRequire,\n defaultValues: partnerDefaults,\n validationMode = 'onSubmit',\n shouldFocusError = true,\n}: UsePayScheduleFormProps): HookLoadingResult | UsePayScheduleFormReady {\n const payScheduleQuery = usePaySchedulesGet(\n { companyId, payScheduleId: payScheduleId ?? '' },\n { enabled: !!payScheduleId },\n )\n\n const paymentConfigsQuery = usePaymentConfigsGet({ companyUuid: companyId })\n\n const currentPaySchedule = payScheduleQuery.data?.payScheduleShow ?? null\n const paymentSpeed = paymentConfigsQuery.data?.paymentConfigs?.paymentSpeed\n const paymentSpeedDays = parsePaymentSpeedDays(paymentSpeed)\n\n const isCreateMode = !currentPaySchedule\n const mode = isCreateMode ? 'create' : 'update'\n\n const [schema, metadataConfig] = useMemo(\n () => createPayScheduleSchema({ mode, optionalFieldsToRequire }),\n [mode, optionalFieldsToRequire],\n )\n\n const resolvedDefaults: PayScheduleFormData = {\n customName: currentPaySchedule?.customName ?? partnerDefaults?.customName ?? '',\n frequency: (currentPaySchedule?.frequency ??\n partnerDefaults?.frequency ??\n 'Every week') as PayScheduleFrequency,\n customTwicePerMonth: deriveCustomTwicePerMonth(\n currentPaySchedule?.frequency ?? partnerDefaults?.frequency,\n currentPaySchedule?.day1 ?? partnerDefaults?.day1 ?? undefined,\n currentPaySchedule?.day2 ?? partnerDefaults?.day2 ?? undefined,\n ),\n anchorPayDate:\n currentPaySchedule?.anchorPayDate?.toString() ?? partnerDefaults?.anchorPayDate ?? null,\n anchorEndOfPayPeriod:\n currentPaySchedule?.anchorEndOfPayPeriod?.toString() ??\n partnerDefaults?.anchorEndOfPayPeriod ??\n null,\n day1: currentPaySchedule?.day1 ?? partnerDefaults?.day1 ?? NaN,\n day2: currentPaySchedule?.day2 ?? partnerDefaults?.day2 ?? NaN,\n }\n\n const formMethods = useForm<PayScheduleFormData, unknown, PayScheduleFormOutputs>({\n resolver: zodResolver(schema),\n mode: validationMode,\n shouldFocusError,\n defaultValues: resolvedDefaults,\n values: resolvedDefaults,\n resetOptions: { keepDirtyValues: true },\n })\n\n const watchedFrequency = useWatch({ control: formMethods.control, name: 'frequency' })\n const watchedCustomTwicePerMonth = useWatch({\n control: formMethods.control,\n name: 'customTwicePerMonth',\n })\n const watchedAnchorPayDate = useWatch({ control: formMethods.control, name: 'anchorPayDate' })\n const watchedAnchorEndOfPayPeriod = useWatch({\n control: formMethods.control,\n name: 'anchorEndOfPayPeriod',\n })\n const watchedDay1 = useWatch({ control: formMethods.control, name: 'day1' })\n const watchedDay2 = useWatch({ control: formMethods.control, name: 'day2' })\n\n useEffect(() => {\n if (watchedFrequency === 'Twice per month' && watchedCustomTwicePerMonth === '1st15th') {\n formMethods.setValue('day1', 15)\n formMethods.setValue('day2', 31)\n }\n }, [watchedFrequency, watchedCustomTwicePerMonth, formMethods.setValue])\n\n const formattedAnchorPayDate = formatWatchedDate(watchedAnchorPayDate)\n const formattedAnchorEndOfPayPeriod = formatWatchedDate(watchedAnchorEndOfPayPeriod)\n\n const previewEnabled = Boolean(formattedAnchorPayDate && formattedAnchorEndOfPayPeriod)\n\n const previewQuery = usePaySchedulesGetPreview(\n {\n companyId,\n frequency: watchedFrequency,\n ...(formattedAnchorPayDate && { anchorPayDate: new RFCDate(formattedAnchorPayDate) }),\n ...(formattedAnchorEndOfPayPeriod && {\n anchorEndOfPayPeriod: new RFCDate(formattedAnchorEndOfPayPeriod),\n }),\n day1: watchedDay1 || undefined,\n day2: watchedDay2 || undefined,\n } as Parameters<typeof usePaySchedulesGetPreview>[0],\n { enabled: previewEnabled },\n )\n\n const payPeriodPreview: PaySchedulePreviewPayPeriod[] | undefined =\n previewQuery.data?.paySchedulePreview?.payPeriods\n const payPreviewLoading = previewQuery.isLoading && previewEnabled\n\n const createPayScheduleMutation = usePaySchedulesCreateMutation()\n const updatePayScheduleMutation = usePaySchedulesUpdateMutation()\n\n const isPending = createPayScheduleMutation.isPending || updatePayScheduleMutation.isPending\n\n const {\n baseSubmitHandler,\n error: submitError,\n setError: setSubmitError,\n } = useBaseSubmit('PayScheduleForm')\n\n const queries = payScheduleId ? [payScheduleQuery, paymentConfigsQuery] : [paymentConfigsQuery]\n const errorHandling = composeErrorHandler(queries, { submitError, setSubmitError })\n\n const showCustomTwicePerMonth = watchedFrequency === 'Twice per month'\n const showDay1 =\n watchedFrequency === 'Monthly' ||\n (watchedFrequency === 'Twice per month' && watchedCustomTwicePerMonth === 'custom')\n const showDay2 = watchedFrequency === 'Twice per month' && watchedCustomTwicePerMonth === 'custom'\n\n const baseMetadata = useDeriveFieldsMetadata(metadataConfig, formMethods.control)\n const fieldsMetadata = {\n customName: baseMetadata.customName,\n frequency: withOptions<PayScheduleFrequency>(\n baseMetadata.frequency,\n FREQUENCY_OPTIONS,\n FREQUENCY_ENTRIES,\n ),\n customTwicePerMonth: withOptions<string>(\n baseMetadata.customTwicePerMonth,\n TWICE_PER_MONTH_OPTIONS,\n TWICE_PER_MONTH_ENTRIES,\n ),\n anchorPayDate: baseMetadata.anchorPayDate,\n anchorEndOfPayPeriod: baseMetadata.anchorEndOfPayPeriod,\n day1: baseMetadata.day1,\n day2: baseMetadata.day2,\n }\n\n const onSubmit = async (): Promise<HookSubmitResult<PayScheduleShow> | undefined> => {\n let submitResult: HookSubmitResult<PayScheduleShow> | undefined\n\n await new Promise<void>(resolve => {\n void formMethods.handleSubmit(\n async (data: PayScheduleFormOutputs) => {\n await baseSubmitHandler(data, async payload => {\n const anchorPayDate = payload.anchorPayDate ?? ''\n const anchorEndOfPayPeriod = payload.anchorEndOfPayPeriod ?? ''\n\n if (isCreateMode) {\n const result = await createPayScheduleMutation.mutateAsync({\n request: {\n companyId,\n payScheduleCreateRequest: {\n frequency: payload.frequency,\n anchorPayDate: new RFCDate(anchorPayDate),\n anchorEndOfPayPeriod: new RFCDate(anchorEndOfPayPeriod),\n customName: payload.customName,\n day1: payload.day1 || undefined,\n day2: payload.day2 || undefined,\n },\n },\n })\n\n submitResult = { mode: 'create', data: result.payScheduleShow! }\n } else {\n const result = await updatePayScheduleMutation.mutateAsync({\n request: {\n payScheduleId: currentPaySchedule.uuid,\n companyId,\n payScheduleUpdateRequest: {\n frequency: payload.frequency,\n anchorPayDate: new RFCDate(anchorPayDate),\n anchorEndOfPayPeriod: new RFCDate(anchorEndOfPayPeriod),\n customName: payload.customName,\n day1: payload.day1 || undefined,\n day2: payload.day2 || undefined,\n version: currentPaySchedule.version!,\n },\n },\n })\n\n submitResult = { mode: 'update', data: result.payScheduleShow! }\n }\n })\n resolve()\n },\n () => {\n resolve()\n },\n )()\n })\n\n return submitResult\n }\n\n const hookFormInternals = useHookFormInternals(formMethods)\n\n const isDataLoading =\n paymentConfigsQuery.isLoading || (payScheduleId ? payScheduleQuery.isLoading : false)\n\n if (isDataLoading) {\n return { isLoading: true as const, errorHandling }\n }\n\n return {\n isLoading: false as const,\n data: {\n paySchedule: currentPaySchedule,\n payPeriodPreview: payPeriodPreview ?? null,\n payPreviewLoading,\n paymentSpeedDays,\n },\n status: {\n isPending,\n mode: isCreateMode ? ('create' as const) : ('update' as const),\n },\n actions: { onSubmit },\n errorHandling,\n form: {\n Fields: {\n CustomName: CustomNameField,\n Frequency: FrequencyField,\n CustomTwicePerMonth: showCustomTwicePerMonth ? CustomTwicePerMonthField : undefined,\n AnchorPayDate: AnchorPayDateField,\n AnchorEndOfPayPeriod: AnchorEndOfPayPeriodField,\n Day1: showDay1 ? Day1Field : undefined,\n Day2: showDay2 ? Day2Field : undefined,\n },\n fieldsMetadata,\n hookFormInternals,\n getFormSubmissionValues: createGetFormSubmissionValues(formMethods, schema),\n },\n }\n}\n\n/**\n * Discriminated union returned by {@link usePayScheduleForm}.\n *\n * @public\n */\nexport type UsePayScheduleFormResult = HookLoadingResult | UsePayScheduleFormReady\n/**\n * Type of `form.fieldsMetadata` returned by {@link usePayScheduleForm}.\n *\n * @public\n */\nexport type PayScheduleFieldsMetadata = UsePayScheduleFormReady['form']['fieldsMetadata']\n/**\n * Type of `form.Fields` returned by {@link usePayScheduleForm}.\n *\n * @public\n */\nexport type PayScheduleFormFields = UsePayScheduleFormReady['form']['Fields']\n"],"names":["FREQUENCY_OPTIONS","FREQUENCY_ENTRIES","o","TWICE_PER_MONTH_OPTIONS","TWICE_PER_MONTH_ENTRIES","formatWatchedDate","value","formatDateToStringDate","deriveCustomTwicePerMonth","frequency","day1","day2","usePayScheduleForm","companyId","payScheduleId","optionalFieldsToRequire","partnerDefaults","validationMode","shouldFocusError","payScheduleQuery","usePaySchedulesGet","paymentConfigsQuery","usePaymentConfigsGet","currentPaySchedule","paymentSpeed","paymentSpeedDays","parsePaymentSpeedDays","isCreateMode","mode","schema","metadataConfig","useMemo","createPayScheduleSchema","resolvedDefaults","formMethods","useForm","zodResolver","watchedFrequency","useWatch","watchedCustomTwicePerMonth","watchedAnchorPayDate","watchedAnchorEndOfPayPeriod","watchedDay1","watchedDay2","useEffect","formattedAnchorPayDate","formattedAnchorEndOfPayPeriod","previewEnabled","previewQuery","usePaySchedulesGetPreview","RFCDate","payPeriodPreview","payPreviewLoading","createPayScheduleMutation","usePaySchedulesCreateMutation","updatePayScheduleMutation","usePaySchedulesUpdateMutation","isPending","baseSubmitHandler","submitError","setSubmitError","useBaseSubmit","errorHandling","composeErrorHandler","showCustomTwicePerMonth","showDay1","showDay2","baseMetadata","useDeriveFieldsMetadata","fieldsMetadata","withOptions","onSubmit","submitResult","resolve","data","payload","anchorPayDate","anchorEndOfPayPeriod","hookFormInternals","useHookFormInternals","CustomNameField","FrequencyField","CustomTwicePerMonthField","AnchorPayDateField","AnchorEndOfPayPeriodField","Day1Field","Day2Field","createGetFormSubmissionValues"],"mappings":";;;;;;;;;;;;;;;;;;;AAyIA,MAAMA,IAA2E;AAAA,EAC/E,EAAE,OAAO,cAAc,OAAO,aAAA;AAAA,EAC9B,EAAE,OAAO,oBAAoB,OAAO,mBAAA;AAAA,EACpC,EAAE,OAAO,mBAAmB,OAAO,kBAAA;AAAA,EACnC,EAAE,OAAO,WAAW,OAAO,UAAA;AAC7B,GAEMC,KAA4CD,EAAkB,IAAI,CAAAE,MAAKA,EAAE,KAAK,GAE9EC,IAA0B;AAAA,EAC9B,EAAE,OAAO,WAAW,OAAO,iCAAA;AAAA,EAC3B,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MACb,kBAAkB4B,KAAoB;AAAA,MACtC,mBAAAC;AAAA,MACA,kBAAA3B;AAAA,IAAA;AAAA,IAEF,QAAQ;AAAA,MACN,WAAAgC;AAAA,MACA,MAAM9B,IAAgB,WAAsB;AAAA,IAAA;AAAA,IAE9C,SAAS,EAAE,UAAA4C,EAAA;AAAA,IACX,eAAAT;AAAA,IACA,MAAM;AAAA,MACJ,QAAQ;AAAA,QACN,YAAYkB;AAAA,QACZ,WAAWC;AAAA,QACX,qBAAqBjB,IAA0BkB,KAA2B;AAAA,QAC1E,eAAeC;AAAA,QACf,sBAAsBC;AAAA,QACtB,MAAMnB,IAAWoB,KAAY;AAAA,QAC7B,MAAMnB,IAAWoB,KAAY;AAAA,MAAA;AAAA,MAE/B,gBAAAjB;AAAA,MACA,mBAAAS;AAAA,MACA,yBAAyBS,GAA8BrD,GAAaL,CAAM;AAAA,IAAA;AAAA,EAC5E;AAEJ;"}
@@ -1,5 +1,30 @@
1
1
  import { BaseComponentInterface } from '../../Base';
2
+ /**
3
+ * Props for the {@link StateTaxes} flow.
4
+ *
5
+ * @public
6
+ */
2
7
  export interface StateTaxesProps extends BaseComponentInterface<'Company.StateTaxes'> {
8
+ /** UUID of the company whose state taxes are being managed. */
3
9
  companyId: string;
4
10
  }
11
+ /**
12
+ * Orchestrated flow for managing a company's state tax setup.
13
+ *
14
+ * @remarks
15
+ * Switches internally between a list of states with tax requirements and a per-state edit form.
16
+ * For finer-grained control over navigation, use the standalone {@link StateTaxesList} and
17
+ * {@link StateTaxesForm} building blocks directly.
18
+ *
19
+ * | Event | Description | Data |
20
+ * | ----- | ----------- | ---- |
21
+ * | `company/stateTaxes/edit` | A state row was selected for editing | `{ state: string }` |
22
+ * | `company/stateTaxes/updated` | State tax requirements were saved | — |
23
+ * | `company/stateTaxes/done` | The list view was completed | — |
24
+ * | `CANCEL` | Editing was cancelled and the form was closed | — |
25
+ *
26
+ * @param props - {@link StateTaxesProps}
27
+ * @returns The rendered state taxes flow.
28
+ * @public
29
+ */
5
30
  export declare function StateTaxes({ companyId, onEvent, dictionary }: StateTaxesProps): import("react").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"StateTaxes.js","sources":["../../../../src/components/Company/StateTaxes/StateTaxes.tsx"],"sourcesContent":["import { createMachine } from 'robot3'\nimport { useMemo } from 'react'\nimport { stateTaxesStateMachine } from './stateTaxesStateMachine'\nimport type { StateTaxesContextInterface } from './StateTaxesComponents'\nimport { StateTaxesListContextual } from './StateTaxesComponents'\nimport { Flow } from '@/components/Flow/Flow'\nimport type { BaseComponentInterface } from '@/components/Base'\nimport { useComponentDictionary } from '@/i18n/I18n'\n\nexport interface StateTaxesProps extends BaseComponentInterface<'Company.StateTaxes'> {\n companyId: string\n}\n\nexport function StateTaxes({ companyId, onEvent, dictionary }: StateTaxesProps) {\n useComponentDictionary('Company.StateTaxes', dictionary)\n const manageStateTaxes = useMemo(\n () =>\n createMachine(\n 'viewStateTaxes',\n stateTaxesStateMachine,\n (initialContext: StateTaxesContextInterface) => ({\n ...initialContext,\n component: StateTaxesListContextual,\n companyId,\n }),\n ),\n [companyId],\n )\n return <Flow machine={manageStateTaxes} onEvent={onEvent} />\n}\n"],"names":["StateTaxes","companyId","onEvent","dictionary","useComponentDictionary","manageStateTaxes","useMemo","createMachine","stateTaxesStateMachine","initialContext","StateTaxesListContextual","jsx","Flow"],"mappings":";;;;;;;AAaO,SAASA,EAAW,EAAE,WAAAC,GAAW,SAAAC,GAAS,YAAAC,KAA+B;AAC9E,EAAAC,EAAuB,sBAAsBD,CAAU;AACvD,QAAME,IAAmBC;AAAA,IACvB,MACEC;AAAA,MACE;AAAA,MACAC;AAAA,MACA,CAACC,OAAgD;AAAA,QAC/C,GAAGA;AAAA,QACH,WAAWC;AAAA,QACX,WAAAT;AAAA,MAAA;AAAA,IACF;AAAA,IAEJ,CAACA,CAAS;AAAA,EAAA;AAEZ,SAAO,gBAAAU,EAACC,GAAA,EAAK,SAASP,GAAkB,SAAAH,EAAA,CAAkB;AAC5D;"}
1
+ {"version":3,"file":"StateTaxes.js","sources":["../../../../src/components/Company/StateTaxes/StateTaxes.tsx"],"sourcesContent":["import { createMachine } from 'robot3'\nimport { useMemo } from 'react'\nimport { stateTaxesStateMachine } from './stateTaxesStateMachine'\nimport type { StateTaxesContextInterface } from './StateTaxesComponents'\nimport { StateTaxesListContextual } from './StateTaxesComponents'\nimport { Flow } from '@/components/Flow/Flow'\nimport type { BaseComponentInterface } from '@/components/Base'\nimport { useComponentDictionary } from '@/i18n/I18n'\n\n/**\n * Props for the {@link StateTaxes} flow.\n *\n * @public\n */\nexport interface StateTaxesProps extends BaseComponentInterface<'Company.StateTaxes'> {\n /** UUID of the company whose state taxes are being managed. */\n companyId: string\n}\n\n/**\n * Orchestrated flow for managing a company's state tax setup.\n *\n * @remarks\n * Switches internally between a list of states with tax requirements and a per-state edit form.\n * For finer-grained control over navigation, use the standalone {@link StateTaxesList} and\n * {@link StateTaxesForm} building blocks directly.\n *\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `company/stateTaxes/edit` | A state row was selected for editing | `{ state: string }` |\n * | `company/stateTaxes/updated` | State tax requirements were saved | — |\n * | `company/stateTaxes/done` | The list view was completed | — |\n * | `CANCEL` | Editing was cancelled and the form was closed | — |\n *\n * @param props - {@link StateTaxesProps}\n * @returns The rendered state taxes flow.\n * @public\n */\nexport function StateTaxes({ companyId, onEvent, dictionary }: StateTaxesProps) {\n useComponentDictionary('Company.StateTaxes', dictionary)\n const manageStateTaxes = useMemo(\n () =>\n createMachine(\n 'viewStateTaxes',\n stateTaxesStateMachine,\n (initialContext: StateTaxesContextInterface) => ({\n ...initialContext,\n component: StateTaxesListContextual,\n companyId,\n }),\n ),\n [companyId],\n )\n return <Flow machine={manageStateTaxes} onEvent={onEvent} />\n}\n"],"names":["StateTaxes","companyId","onEvent","dictionary","useComponentDictionary","manageStateTaxes","useMemo","createMachine","stateTaxesStateMachine","initialContext","StateTaxesListContextual","jsx","Flow"],"mappings":";;;;;;;AAsCO,SAASA,EAAW,EAAE,WAAAC,GAAW,SAAAC,GAAS,YAAAC,KAA+B;AAC9E,EAAAC,EAAuB,sBAAsBD,CAAU;AACvD,QAAME,IAAmBC;AAAA,IACvB,MACEC;AAAA,MACE;AAAA,MACAC;AAAA,MACA,CAACC,OAAgD;AAAA,QAC/C,GAAGA;AAAA,QACH,WAAWC;AAAA,QACX,WAAAT;AAAA,MAAA;AAAA,IACF;AAAA,IAEJ,CAACA,CAAS;AAAA,EAAA;AAEZ,SAAO,gBAAAU,EAACC,GAAA,EAAK,SAASP,GAAkB,SAAAH,EAAA,CAAkB;AAC5D;"}
@@ -1,8 +1,14 @@
1
1
  import { FlowContextInterface } from '../../Flow/useFlow';
2
+ /** @internal */
2
3
  export interface StateTaxesContextInterface extends FlowContextInterface {
4
+ /** UUID of the company whose state taxes are being managed. */
3
5
  companyId: string;
6
+ /** Two-letter state code currently being edited, when in the form view. */
4
7
  state?: string;
8
+ /** Current step component rendered by the flow machine. */
5
9
  component: React.ComponentType | null;
6
10
  }
11
+ /** @internal */
7
12
  export declare function StateTaxesListContextual(): import("react").JSX.Element;
13
+ /** @internal */
8
14
  export declare function StateTaxesFormContextual(): import("react").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"StateTaxesComponents.js","sources":["../../../../src/components/Company/StateTaxes/StateTaxesComponents.tsx"],"sourcesContent":["import { StateTaxesList } from './StateTaxesList/StateTaxesList'\nimport { StateTaxesForm } from './StateTaxesForm/StateTaxesForm'\nimport { useFlow, type FlowContextInterface } from '@/components/Flow/useFlow'\nimport { ensureRequired } from '@/helpers/ensureRequired'\n\nexport interface StateTaxesContextInterface extends FlowContextInterface {\n companyId: string\n state?: string\n component: React.ComponentType | null\n}\n\nexport function StateTaxesListContextual() {\n const { companyId, onEvent } = useFlow<StateTaxesContextInterface>()\n return <StateTaxesList onEvent={onEvent} companyId={ensureRequired(companyId)} />\n}\n\nexport function StateTaxesFormContextual() {\n const { companyId, state, onEvent } = useFlow<StateTaxesContextInterface>()\n return (\n <StateTaxesForm\n companyId={ensureRequired(companyId)}\n state={ensureRequired(state)}\n onEvent={onEvent}\n />\n )\n}\n"],"names":["StateTaxesListContextual","companyId","onEvent","useFlow","StateTaxesList","ensureRequired","StateTaxesFormContextual","state","jsx","StateTaxesForm"],"mappings":";;;;;AAWO,SAASA,IAA2B;AACzC,QAAM,EAAE,WAAAC,GAAW,SAAAC,EAAA,IAAYC,EAAA;AAC/B,2BAAQC,GAAA,EAAe,SAAAF,GAAkB,WAAWG,EAAeJ,CAAS,GAAG;AACjF;AAEO,SAASK,IAA2B;AACzC,QAAM,EAAE,WAAAL,GAAW,OAAAM,GAAO,SAAAL,EAAA,IAAYC,EAAA;AACtC,SACE,gBAAAK;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,WAAWJ,EAAeJ,CAAS;AAAA,MACnC,OAAOI,EAAeE,CAAK;AAAA,MAC3B,SAAAL;AAAA,IAAA;AAAA,EAAA;AAGN;"}
1
+ {"version":3,"file":"StateTaxesComponents.js","sources":["../../../../src/components/Company/StateTaxes/StateTaxesComponents.tsx"],"sourcesContent":["import { StateTaxesList } from './StateTaxesList/StateTaxesList'\nimport { StateTaxesForm } from './StateTaxesForm/StateTaxesForm'\nimport { useFlow, type FlowContextInterface } from '@/components/Flow/useFlow'\nimport { ensureRequired } from '@/helpers/ensureRequired'\n\n/** @internal */\nexport interface StateTaxesContextInterface extends FlowContextInterface {\n /** UUID of the company whose state taxes are being managed. */\n companyId: string\n /** Two-letter state code currently being edited, when in the form view. */\n state?: string\n /** Current step component rendered by the flow machine. */\n component: React.ComponentType | null\n}\n\n/** @internal */\nexport function StateTaxesListContextual() {\n const { companyId, onEvent } = useFlow<StateTaxesContextInterface>()\n return <StateTaxesList onEvent={onEvent} companyId={ensureRequired(companyId)} />\n}\n\n/** @internal */\nexport function StateTaxesFormContextual() {\n const { companyId, state, onEvent } = useFlow<StateTaxesContextInterface>()\n return (\n <StateTaxesForm\n companyId={ensureRequired(companyId)}\n state={ensureRequired(state)}\n onEvent={onEvent}\n />\n )\n}\n"],"names":["StateTaxesListContextual","companyId","onEvent","useFlow","StateTaxesList","ensureRequired","StateTaxesFormContextual","state","jsx","StateTaxesForm"],"mappings":";;;;;AAgBO,SAASA,IAA2B;AACzC,QAAM,EAAE,WAAAC,GAAW,SAAAC,EAAA,IAAYC,EAAA;AAC/B,2BAAQC,GAAA,EAAe,SAAAF,GAAkB,WAAWG,EAAeJ,CAAS,GAAG;AACjF;AAGO,SAASK,IAA2B;AACzC,QAAM,EAAE,WAAAL,GAAW,OAAAM,GAAO,SAAAL,EAAA,IAAYC,EAAA;AACtC,SACE,gBAAAK;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,WAAWJ,EAAeJ,CAAS;AAAA,MACnC,OAAOI,EAAeE,CAAK;AAAA,MAC3B,SAAAL;AAAA,IAAA;AAAA,EAAA;AAGN;"}
@@ -1 +1,2 @@
1
+ /** @internal */
1
2
  export declare function Actions(): import("react").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"Actions.js","sources":["../../../../../src/components/Company/StateTaxes/StateTaxesForm/Actions.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useStateTaxesForm } from './context'\nimport { ActionsLayout } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\nexport function Actions() {\n const { t } = useTranslation('Company.StateTaxes', { keyPrefix: 'form' })\n const { handleCancel, isPending } = useStateTaxesForm()\n const Components = useComponentContext()\n\n return (\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleCancel}>\n {t('cancelCta')}\n </Components.Button>\n <Components.Button variant=\"primary\" type=\"submit\" isDisabled={isPending}>\n {t('saveCta')}\n </Components.Button>\n </ActionsLayout>\n )\n}\n"],"names":["Actions","useTranslation","handleCancel","isPending","useStateTaxesForm","Components","useComponentContext","ActionsLayout","jsx"],"mappings":";;;;;;AAKO,SAASA,IAAU;AACxB,QAAM,EAAE,MAAMC,EAAe,sBAAsB,EAAE,WAAW,QAAQ,GAClE,EAAE,cAAAC,GAAc,WAAAC,EAAA,IAAcC,EAAA,GAC9BC,IAAaC,EAAA;AAEnB,2BACGC,GAAA,EACC,UAAA;AAAA,IAAA,gBAAAC,EAACH,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASH,GAC7C,UAAA,EAAE,WAAW,EAAA,CAChB;AAAA,IACA,gBAAAM,EAACH,EAAW,QAAX,EAAkB,SAAQ,WAAU,MAAK,UAAS,YAAYF,GAC5D,UAAA,EAAE,SAAS,EAAA,CACd;AAAA,EAAA,GACF;AAEJ;"}
1
+ {"version":3,"file":"Actions.js","sources":["../../../../../src/components/Company/StateTaxes/StateTaxesForm/Actions.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useStateTaxesForm } from './context'\nimport { ActionsLayout } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\n/** @internal */\nexport function Actions() {\n const { t } = useTranslation('Company.StateTaxes', { keyPrefix: 'form' })\n const { handleCancel, isPending } = useStateTaxesForm()\n const Components = useComponentContext()\n\n return (\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleCancel}>\n {t('cancelCta')}\n </Components.Button>\n <Components.Button variant=\"primary\" type=\"submit\" isDisabled={isPending}>\n {t('saveCta')}\n </Components.Button>\n </ActionsLayout>\n )\n}\n"],"names":["Actions","useTranslation","handleCancel","isPending","useStateTaxesForm","Components","useComponentContext","ActionsLayout","jsx"],"mappings":";;;;;;AAMO,SAASA,IAAU;AACxB,QAAM,EAAE,MAAMC,EAAe,sBAAsB,EAAE,WAAW,QAAQ,GAClE,EAAE,cAAAC,GAAc,WAAAC,EAAA,IAAcC,EAAA,GAC9BC,IAAaC,EAAA;AAEnB,2BACGC,GAAA,EACC,UAAA;AAAA,IAAA,gBAAAC,EAACH,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASH,GAC7C,UAAA,EAAE,WAAW,EAAA,CAChB;AAAA,IACA,gBAAAM,EAACH,EAAW,QAAX,EAAkB,SAAQ,WAAU,MAAK,UAAS,YAAYF,GAC5D,UAAA,EAAE,SAAS,EAAA,CACd;AAAA,EAAA,GACF;AAEJ;"}
@@ -1,4 +1,2 @@
1
- import { z } from 'zod';
2
- export declare const StateFormSchema: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>;
3
- export type StateFormInputs = z.infer<typeof StateFormSchema>;
1
+ /** @internal */
4
2
  export declare function Form(): import("react").JSX.Element[] | undefined;
@@ -1,30 +1,28 @@
1
- import { jsxs as a, Fragment as d, jsx as o } from "react/jsx-runtime";
2
- import { z as t } from "zod";
1
+ import { jsxs as a, Fragment as c, jsx as e } from "react/jsx-runtime";
3
2
  import { useTranslation as u } from "react-i18next";
4
3
  import { useStateTaxesForm as x } from "./context.js";
5
- import { toRhfKey as l } from "./rhfKey.js";
6
- import { QuestionInput as y } from "../../../Common/TaxInputs/TaxInputs.js";
7
- import { useLocaleDateFormatter as T } from "../../../../contexts/LocaleProvider/useLocale.js";
8
- import { useComponentContext as h } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
9
- t.record(t.string(), t.record(t.string(), t.unknown()));
4
+ import { toRhfKey as d } from "./rhfKey.js";
5
+ import { QuestionInput as l } from "../../../Common/TaxInputs/TaxInputs.js";
6
+ import { useLocaleDateFormatter as y } from "../../../../contexts/LocaleProvider/useLocale.js";
7
+ import { useComponentContext as T } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
10
8
  function D() {
11
- const { t: s } = u("Company.StateTaxes", { keyPrefix: "form" }), i = T(), { stateTaxRequirements: p } = x(), r = h();
12
- return p.requirementSets?.map(
13
- ({ requirements: f, label: c, effectiveFrom: n, key: m }) => /* @__PURE__ */ a(d, { children: [
9
+ const { t: n } = u("Company.StateTaxes", { keyPrefix: "form" }), s = y(), { stateTaxRequirements: i } = x(), o = T();
10
+ return i.requirementSets?.map(
11
+ ({ requirements: p, label: f, effectiveFrom: r, key: m }) => /* @__PURE__ */ a(c, { children: [
14
12
  /* @__PURE__ */ a("div", { children: [
15
- /* @__PURE__ */ o(r.Heading, { as: "h3", children: c }),
16
- n && /* @__PURE__ */ o(r.Text, { size: "sm", children: s("effectiveFromLabel", { date: i.format(new Date(n)) }) })
13
+ /* @__PURE__ */ e(o.Heading, { as: "h3", children: f }),
14
+ r && /* @__PURE__ */ e(o.Text, { size: "sm", children: n("effectiveFromLabel", { date: s.format(new Date(r)) }) })
17
15
  ] }),
18
- f?.map((e) => /* @__PURE__ */ o(
19
- y,
16
+ p?.map((t) => /* @__PURE__ */ e(
17
+ l,
20
18
  {
21
19
  requirement: {
22
- ...e,
23
- key: `${m}.${l(e.key)}`
20
+ ...t,
21
+ key: `${m}.${d(t.key)}`
24
22
  },
25
- questionType: e.metadata?.type ?? "Text"
23
+ questionType: t.metadata?.type ?? "Text"
26
24
  },
27
- e.key
25
+ t.key
28
26
  ))
29
27
  ] }, m)
30
28
  );