@gusto/embedded-react-sdk 0.17.0 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (364) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/dist/components/Base/Base.js +50 -65
  3. package/dist/components/Base/Base.js.map +1 -1
  4. package/dist/components/Base/useBase.d.ts +2 -5
  5. package/dist/components/Base/useBase.js.map +1 -1
  6. package/dist/components/Common/FlowBreadcrumbs/FlowBreadcrumbs.js +42 -36
  7. package/dist/components/Common/FlowBreadcrumbs/FlowBreadcrumbs.js.map +1 -1
  8. package/dist/components/Common/HamburgerMenu/HamburgerMenu.js +1 -1
  9. package/dist/components/Common/HamburgerMenu/HamburgerMenu.js.map +1 -1
  10. package/dist/components/Common/SignatureForm/SignatureForm.js +4 -7
  11. package/dist/components/Common/SignatureForm/SignatureForm.js.map +1 -1
  12. package/dist/components/Common/SignatureForm/SignatureFormActions.js +10 -13
  13. package/dist/components/Common/SignatureForm/SignatureFormActions.js.map +1 -1
  14. package/dist/components/Common/SignatureForm/SignatureFormFields.js +10 -13
  15. package/dist/components/Common/SignatureForm/SignatureFormFields.js.map +1 -1
  16. package/dist/components/Common/UI/DatePicker/DatePicker.module.scss.js +8 -8
  17. package/dist/components/Common/UI/Dialog/Dialog.js +50 -76
  18. package/dist/components/Common/UI/Dialog/Dialog.js.map +1 -1
  19. package/dist/components/Common/UI/Dialog/Dialog.module.scss.js +8 -14
  20. package/dist/components/Common/UI/Dialog/Dialog.module.scss.js.map +1 -1
  21. package/dist/components/Common/UI/Link/LinkTypes.d.ts +7 -6
  22. package/dist/components/Common/UI/Modal/Modal.d.ts +2 -0
  23. package/dist/components/Common/UI/Modal/Modal.js +90 -0
  24. package/dist/components/Common/UI/Modal/Modal.js.map +1 -0
  25. package/dist/components/Common/UI/Modal/Modal.module.scss.js +26 -0
  26. package/dist/components/Common/UI/Modal/Modal.module.scss.js.map +1 -0
  27. package/dist/components/Common/UI/Modal/ModalTypes.d.ts +34 -0
  28. package/dist/components/Common/UI/Modal/ModalTypes.js +8 -0
  29. package/dist/components/Common/UI/Modal/ModalTypes.js.map +1 -0
  30. package/dist/components/Common/UI/Modal/index.d.ts +3 -0
  31. package/dist/components/Common/UI/Tabs/Tabs.d.ts +0 -5
  32. package/dist/components/Common/UI/Tabs/Tabs.js +45 -16
  33. package/dist/components/Common/UI/Tabs/Tabs.js.map +1 -1
  34. package/dist/components/Common/UI/Tabs/Tabs.module.scss.js +8 -4
  35. package/dist/components/Common/UI/Tabs/Tabs.module.scss.js.map +1 -1
  36. package/dist/components/Common/UI/Tabs/TabsTypes.d.ts +7 -0
  37. package/dist/components/Common/index.d.ts +0 -1
  38. package/dist/components/Company/AssignSignatory/AssignSignatory.js +6 -8
  39. package/dist/components/Company/AssignSignatory/AssignSignatory.js.map +1 -1
  40. package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js +6 -8
  41. package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js.map +1 -1
  42. package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js +8 -10
  43. package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js.map +1 -1
  44. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js +2 -3
  45. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js.map +1 -1
  46. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js +2 -3
  47. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js.map +1 -1
  48. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +4 -6
  49. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
  50. package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js +6 -8
  51. package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js.map +1 -1
  52. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js +5 -6
  53. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js.map +1 -1
  54. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js +9 -10
  55. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js.map +1 -1
  56. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +4 -6
  57. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
  58. package/dist/components/Company/AssignSignatory/TitleSelect.js +7 -8
  59. package/dist/components/Company/AssignSignatory/TitleSelect.js.map +1 -1
  60. package/dist/components/Company/AssignSignatory/useAssignSignatory.js +6 -8
  61. package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
  62. package/dist/components/Company/BankAccount/BankAccountForm/Actions.js +8 -9
  63. package/dist/components/Company/BankAccount/BankAccountForm/Actions.js.map +1 -1
  64. package/dist/components/Company/BankAccount/BankAccountForm/Form.js +9 -11
  65. package/dist/components/Company/BankAccount/BankAccountForm/Form.js.map +1 -1
  66. package/dist/components/Company/BankAccount/BankAccountForm/context.js +4 -6
  67. package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
  68. package/dist/components/Company/BankAccount/BankAccountList/Actions.js +10 -12
  69. package/dist/components/Company/BankAccount/BankAccountList/Actions.js.map +1 -1
  70. package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js +11 -13
  71. package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js.map +1 -1
  72. package/dist/components/Company/BankAccount/BankAccountVerify/Form.js +4 -6
  73. package/dist/components/Company/BankAccount/BankAccountVerify/Form.js.map +1 -1
  74. package/dist/components/Company/DocumentSigner/DocumentList/Actions.js +5 -7
  75. package/dist/components/Company/DocumentSigner/DocumentList/Actions.js.map +1 -1
  76. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js +11 -13
  77. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  78. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +4 -6
  79. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  80. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js +6 -8
  81. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
  82. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js +4 -6
  83. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
  84. package/dist/components/Company/FederalTaxes/Actions.js +7 -9
  85. package/dist/components/Company/FederalTaxes/Actions.js.map +1 -1
  86. package/dist/components/Company/FederalTaxes/FederalTaxes.js +15 -17
  87. package/dist/components/Company/FederalTaxes/FederalTaxes.js.map +1 -1
  88. package/dist/components/Company/FederalTaxes/Form.js +2 -4
  89. package/dist/components/Company/FederalTaxes/Form.js.map +1 -1
  90. package/dist/components/Company/FederalTaxes/useFederalTaxes.js +9 -11
  91. package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
  92. package/dist/components/Company/Industry/Actions.js +5 -7
  93. package/dist/components/Company/Industry/Actions.js.map +1 -1
  94. package/dist/components/Company/Industry/Context.js +7 -9
  95. package/dist/components/Company/Industry/Context.js.map +1 -1
  96. package/dist/components/Company/Industry/Edit.js +10 -12
  97. package/dist/components/Company/Industry/Edit.js.map +1 -1
  98. package/dist/components/Company/Locations/LocationForm/Actions.js +6 -8
  99. package/dist/components/Company/Locations/LocationForm/Actions.js.map +1 -1
  100. package/dist/components/Company/Locations/LocationForm/Form.js +4 -5
  101. package/dist/components/Company/Locations/LocationForm/Form.js.map +1 -1
  102. package/dist/components/Company/Locations/LocationForm/LocationForm.js +10 -12
  103. package/dist/components/Company/Locations/LocationForm/LocationForm.js.map +1 -1
  104. package/dist/components/Company/Locations/LocationForm/useLocationForm.js +4 -6
  105. package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
  106. package/dist/components/Company/Locations/LocationsList/Actions.js +6 -8
  107. package/dist/components/Company/Locations/LocationsList/Actions.js.map +1 -1
  108. package/dist/components/Company/Locations/LocationsList/List.js +6 -8
  109. package/dist/components/Company/Locations/LocationsList/List.js.map +1 -1
  110. package/dist/components/Company/Locations/LocationsList/LocationsList.js +12 -14
  111. package/dist/components/Company/Locations/LocationsList/LocationsList.js.map +1 -1
  112. package/dist/components/Company/Locations/LocationsList/useLocationsList.js +4 -6
  113. package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
  114. package/dist/components/Company/OnboardingOverview/Completed.js +12 -14
  115. package/dist/components/Company/OnboardingOverview/Completed.js.map +1 -1
  116. package/dist/components/Company/OnboardingOverview/MissingRequirements.js +6 -8
  117. package/dist/components/Company/OnboardingOverview/MissingRequirements.js.map +1 -1
  118. package/dist/components/Company/OnboardingOverview/OnboardingOverview.js +2 -4
  119. package/dist/components/Company/OnboardingOverview/OnboardingOverview.js.map +1 -1
  120. package/dist/components/Company/OnboardingOverview/context.js +4 -6
  121. package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
  122. package/dist/components/Company/PaySchedule/PaySchedule.js +40 -42
  123. package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
  124. package/dist/components/Company/PaySchedule/_parts/Actions.js +10 -12
  125. package/dist/components/Company/PaySchedule/_parts/Actions.js.map +1 -1
  126. package/dist/components/Company/PaySchedule/_parts/Edit.js +35 -37
  127. package/dist/components/Company/PaySchedule/_parts/Edit.js.map +1 -1
  128. package/dist/components/Company/PaySchedule/_parts/Head.js +17 -19
  129. package/dist/components/Company/PaySchedule/_parts/Head.js.map +1 -1
  130. package/dist/components/Company/PaySchedule/_parts/List.js +13 -15
  131. package/dist/components/Company/PaySchedule/_parts/List.js.map +1 -1
  132. package/dist/components/Company/PaySchedule/usePaySchedule.js +6 -8
  133. package/dist/components/Company/PaySchedule/usePaySchedule.js.map +1 -1
  134. package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js +5 -7
  135. package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js.map +1 -1
  136. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +4 -6
  137. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
  138. package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js +6 -8
  139. package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js.map +1 -1
  140. package/dist/components/Company/StateTaxes/StateTaxesList/List.js +5 -7
  141. package/dist/components/Company/StateTaxes/StateTaxesList/List.js.map +1 -1
  142. package/dist/components/Company/StateTaxes/StateTaxesList/context.js +4 -6
  143. package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
  144. package/dist/components/Contractor/Address/Address.js +4 -6
  145. package/dist/components/Contractor/Address/Address.js.map +1 -1
  146. package/dist/components/Contractor/Address/Form.js +2 -3
  147. package/dist/components/Contractor/Address/Form.js.map +1 -1
  148. package/dist/components/Contractor/Address/useAddress.js +6 -8
  149. package/dist/components/Contractor/Address/useAddress.js.map +1 -1
  150. package/dist/components/Contractor/ContractorList/index.js +30 -31
  151. package/dist/components/Contractor/ContractorList/index.js.map +1 -1
  152. package/dist/components/Contractor/NewHireReport/NewHireReport.js +13 -14
  153. package/dist/components/Contractor/NewHireReport/NewHireReport.js.map +1 -1
  154. package/dist/components/Contractor/PaymentMethod/BankAccountForm.js +4 -6
  155. package/dist/components/Contractor/PaymentMethod/BankAccountForm.js.map +1 -1
  156. package/dist/components/Contractor/PaymentMethod/PaymentMethod.js +2 -3
  157. package/dist/components/Contractor/PaymentMethod/PaymentMethod.js.map +1 -1
  158. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js +2 -3
  159. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js.map +1 -1
  160. package/dist/components/Contractor/Profile/useContractorProfile.js +3 -4
  161. package/dist/components/Contractor/Profile/useContractorProfile.js.map +1 -1
  162. package/dist/components/Contractor/Submit/Submit.js +3 -4
  163. package/dist/components/Contractor/Submit/Submit.js.map +1 -1
  164. package/dist/components/Employee/Compensation/Actions.js +5 -6
  165. package/dist/components/Employee/Compensation/Actions.js.map +1 -1
  166. package/dist/components/Employee/Compensation/Edit.js +10 -9
  167. package/dist/components/Employee/Compensation/Edit.js.map +1 -1
  168. package/dist/components/Employee/Compensation/List.js +23 -25
  169. package/dist/components/Employee/Compensation/List.js.map +1 -1
  170. package/dist/components/Employee/Deductions/DeductionsComponents.js +1 -1
  171. package/dist/components/Employee/Deductions/DeductionsComponents.js.map +1 -1
  172. package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.d.ts +6 -6
  173. package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.d.ts +2 -2
  174. package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.js +3 -4
  175. package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.js.map +1 -1
  176. package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js +44 -40
  177. package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js.map +1 -1
  178. package/dist/components/Employee/Deductions/IncludeDeductionsForm/IncludeDeductionsForm.js +3 -4
  179. package/dist/components/Employee/Deductions/IncludeDeductionsForm/IncludeDeductionsForm.js.map +1 -1
  180. package/dist/components/Employee/Deductions/useDeductions.d.ts +2 -2
  181. package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js +6 -8
  182. package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js.map +1 -1
  183. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js +9 -11
  184. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  185. package/dist/components/Employee/DocumentSigner/DocumentList/List.js +2 -4
  186. package/dist/components/Employee/DocumentSigner/DocumentList/List.js.map +1 -1
  187. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +4 -6
  188. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  189. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js +11 -13
  190. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
  191. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +4 -6
  192. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
  193. package/dist/components/Employee/EmployeeList/Actions.js +4 -6
  194. package/dist/components/Employee/EmployeeList/Actions.js.map +1 -1
  195. package/dist/components/Employee/EmployeeList/EmployeeList.js +3 -4
  196. package/dist/components/Employee/EmployeeList/EmployeeList.js.map +1 -1
  197. package/dist/components/Employee/EmployeeList/Head.js +5 -7
  198. package/dist/components/Employee/EmployeeList/Head.js.map +1 -1
  199. package/dist/components/Employee/EmployeeList/List.js +18 -19
  200. package/dist/components/Employee/EmployeeList/List.js.map +1 -1
  201. package/dist/components/Employee/EmployeeList/useEmployeeList.js +4 -6
  202. package/dist/components/Employee/EmployeeList/useEmployeeList.js.map +1 -1
  203. package/dist/components/Employee/FederalTaxes/Actions.js +6 -8
  204. package/dist/components/Employee/FederalTaxes/Actions.js.map +1 -1
  205. package/dist/components/Employee/FederalTaxes/FederalForm.js +11 -13
  206. package/dist/components/Employee/FederalTaxes/FederalForm.js.map +1 -1
  207. package/dist/components/Employee/FederalTaxes/FederalTaxes.js +8 -8
  208. package/dist/components/Employee/FederalTaxes/FederalTaxes.js.map +1 -1
  209. package/dist/components/Employee/FederalTaxes/Head.js +6 -6
  210. package/dist/components/Employee/FederalTaxes/Head.js.map +1 -1
  211. package/dist/components/Employee/FederalTaxes/useFederalTaxes.js +4 -6
  212. package/dist/components/Employee/FederalTaxes/useFederalTaxes.js.map +1 -1
  213. package/dist/components/Employee/Landing/Landing.js +12 -13
  214. package/dist/components/Employee/Landing/Landing.js.map +1 -1
  215. package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js +7 -7
  216. package/dist/components/Employee/PaymentMethod/Actions.js +7 -9
  217. package/dist/components/Employee/PaymentMethod/Actions.js.map +1 -1
  218. package/dist/components/Employee/PaymentMethod/BankAccountEdit.js +4 -5
  219. package/dist/components/Employee/PaymentMethod/BankAccountEdit.js.map +1 -1
  220. package/dist/components/Employee/PaymentMethod/BankAccountsList.js +9 -11
  221. package/dist/components/Employee/PaymentMethod/BankAccountsList.js.map +1 -1
  222. package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js +6 -7
  223. package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js.map +1 -1
  224. package/dist/components/Employee/PaymentMethod/Split.js +3 -4
  225. package/dist/components/Employee/PaymentMethod/Split.js.map +1 -1
  226. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +6 -8
  227. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
  228. package/dist/components/Employee/Profile/Actions.js +7 -9
  229. package/dist/components/Employee/Profile/Actions.js.map +1 -1
  230. package/dist/components/Employee/Profile/AdminPersonalDetails.js +38 -35
  231. package/dist/components/Employee/Profile/AdminPersonalDetails.js.map +1 -1
  232. package/dist/components/Employee/Profile/HomeAddress.d.ts +52 -0
  233. package/dist/components/Employee/Profile/HomeAddress.js +63 -44
  234. package/dist/components/Employee/Profile/HomeAddress.js.map +1 -1
  235. package/dist/components/Employee/Profile/PersonalDetailsInputs.js +20 -21
  236. package/dist/components/Employee/Profile/PersonalDetailsInputs.js.map +1 -1
  237. package/dist/components/Employee/Profile/Profile.js +150 -143
  238. package/dist/components/Employee/Profile/Profile.js.map +1 -1
  239. package/dist/components/Employee/Profile/useProfile.d.ts +1 -0
  240. package/dist/components/Employee/Profile/useProfile.js +4 -6
  241. package/dist/components/Employee/Profile/useProfile.js.map +1 -1
  242. package/dist/components/Employee/StateTaxes/Actions.js +8 -10
  243. package/dist/components/Employee/StateTaxes/Actions.js.map +1 -1
  244. package/dist/components/Employee/StateTaxes/StateTaxes.js +4 -4
  245. package/dist/components/Employee/StateTaxes/StateTaxes.js.map +1 -1
  246. package/dist/components/Employee/StateTaxes/useStateTaxes.js +4 -6
  247. package/dist/components/Employee/StateTaxes/useStateTaxes.js.map +1 -1
  248. package/dist/components/Employee/Taxes/Actions.js +8 -10
  249. package/dist/components/Employee/Taxes/Actions.js.map +1 -1
  250. package/dist/components/Employee/Taxes/FederalForm.js +9 -11
  251. package/dist/components/Employee/Taxes/FederalForm.js.map +1 -1
  252. package/dist/components/Employee/Taxes/FederalHead.js +6 -6
  253. package/dist/components/Employee/Taxes/FederalHead.js.map +1 -1
  254. package/dist/components/Employee/Taxes/Taxes.js +5 -5
  255. package/dist/components/Employee/Taxes/Taxes.js.map +1 -1
  256. package/dist/components/Employee/Taxes/useTaxes.js +4 -6
  257. package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
  258. package/dist/components/Flow/Flow.js +16 -18
  259. package/dist/components/Flow/Flow.js.map +1 -1
  260. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js +9 -11
  261. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js.map +1 -1
  262. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js +6 -7
  263. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js.map +1 -1
  264. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +64 -64
  265. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
  266. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js +133 -135
  267. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
  268. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.module.scss.js +5 -3
  269. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.module.scss.js.map +1 -1
  270. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +127 -119
  271. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
  272. package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js +5 -7
  273. package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js.map +1 -1
  274. package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.d.ts +3 -1
  275. package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.js +22 -22
  276. package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.js.map +1 -1
  277. package/dist/components/Payroll/PayrollFlow/payrollStateMachine.js +40 -27
  278. package/dist/components/Payroll/PayrollFlow/payrollStateMachine.js.map +1 -1
  279. package/dist/components/Payroll/PayrollHistory/PayrollHistory.js +50 -72
  280. package/dist/components/Payroll/PayrollHistory/PayrollHistory.js.map +1 -1
  281. package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js +2 -4
  282. package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js.map +1 -1
  283. package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.d.ts +1 -1
  284. package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.js +4 -4
  285. package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.js.map +1 -1
  286. package/dist/components/Payroll/PayrollLanding/payrollLandingStateMachine.js +20 -20
  287. package/dist/components/Payroll/PayrollLanding/payrollLandingStateMachine.js.map +1 -1
  288. package/dist/components/Payroll/PayrollList/PayrollList.js +24 -21
  289. package/dist/components/Payroll/PayrollList/PayrollList.js.map +1 -1
  290. package/dist/components/Payroll/PayrollList/PayrollListPresentation.d.ts +3 -9
  291. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +117 -129
  292. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
  293. package/dist/components/Payroll/PayrollList/PayrollListPresentation.module.scss.js +6 -6
  294. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +89 -78
  295. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js.map +1 -1
  296. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +192 -211
  297. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
  298. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.module.scss.js +8 -0
  299. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.module.scss.js.map +1 -0
  300. package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js +2 -3
  301. package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js.map +1 -1
  302. package/dist/components/Payroll/usePreparedPayrollData.js +8 -10
  303. package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
  304. package/dist/contexts/ComponentAdapter/adapters/defaultComponentAdapter.js +40 -38
  305. package/dist/contexts/ComponentAdapter/adapters/defaultComponentAdapter.js.map +1 -1
  306. package/dist/contexts/ComponentAdapter/componentAdapterTypes.d.ts +1 -0
  307. package/dist/contexts/ComponentAdapter/useComponentContext.d.ts +2 -0
  308. package/dist/contexts/ComponentAdapter/useComponentContext.js.map +1 -1
  309. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +5 -8
  310. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
  311. package/dist/helpers/apiErrorToList.d.ts +7 -0
  312. package/dist/helpers/apiErrorToList.js +23 -0
  313. package/dist/helpers/apiErrorToList.js.map +1 -0
  314. package/dist/helpers/breadcrumbHelpers.js +30 -30
  315. package/dist/helpers/breadcrumbHelpers.js.map +1 -1
  316. package/dist/helpers/dateFormatting.d.ts +15 -7
  317. package/dist/helpers/dateFormatting.js +88 -35
  318. package/dist/helpers/dateFormatting.js.map +1 -1
  319. package/dist/helpers/formattedStrings.js +11 -12
  320. package/dist/helpers/formattedStrings.js.map +1 -1
  321. package/dist/hooks/useAsyncError.js.map +1 -0
  322. package/dist/hooks/useDateFormatter.d.ts +19 -0
  323. package/dist/hooks/useDateFormatter.js +24 -0
  324. package/dist/hooks/useDateFormatter.js.map +1 -0
  325. package/dist/hooks/useMenu.js.map +1 -0
  326. package/dist/{components/Common/hooks → hooks}/useNumberFormatter.js +1 -1
  327. package/dist/hooks/useNumberFormatter.js.map +1 -0
  328. package/dist/hooks/useOverflowDetection/index.d.ts +3 -0
  329. package/dist/hooks/useOverflowDetection/useOverflowDetection.d.ts +7 -0
  330. package/dist/hooks/useOverflowDetection/useOverflowDetection.js +28 -0
  331. package/dist/hooks/useOverflowDetection/useOverflowDetection.js.map +1 -0
  332. package/dist/i18n/en/Company.PaySchedule.json.js +9 -9
  333. package/dist/i18n/en/Employee.Compensation.json.js +15 -15
  334. package/dist/i18n/en/Employee.Deductions.json.js +131 -105
  335. package/dist/i18n/en/Employee.Deductions.json.js.map +1 -1
  336. package/dist/i18n/en/Employee.FederalTaxes.json.js +9 -9
  337. package/dist/i18n/en/Employee.HomeAddress.json.js +1 -1
  338. package/dist/i18n/en/Employee.Taxes.json.js +25 -27
  339. package/dist/i18n/en/Employee.Taxes.json.js.map +1 -1
  340. package/dist/i18n/en/Payroll.PayrollConfiguration.json.js +1 -1
  341. package/dist/i18n/en/Payroll.PayrollOverview.json.js +23 -23
  342. package/dist/i18n/en/common.json.d.ts +2 -1
  343. package/dist/i18n/en/common.json.js +4 -4
  344. package/dist/style.css +1 -1
  345. package/dist/types/i18next.d.ts +16 -1
  346. package/package.json +9 -9
  347. package/dist/components/Common/hooks/useAsyncError.js.map +0 -1
  348. package/dist/components/Common/hooks/useMenu.js.map +0 -1
  349. package/dist/components/Common/hooks/useNumberFormatter.js.map +0 -1
  350. package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js +0 -221
  351. package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js.map +0 -1
  352. package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.module.scss.js +0 -8
  353. package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.module.scss.js.map +0 -1
  354. package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js +0 -132
  355. package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js.map +0 -1
  356. package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.module.scss.js +0 -14
  357. package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.module.scss.js.map +0 -1
  358. package/dist/components/Employee/Deductions/DeductionsForm/UNSTABLE_DeductionsForm.js +0 -98
  359. package/dist/components/Employee/Deductions/DeductionsForm/UNSTABLE_DeductionsForm.js.map +0 -1
  360. /package/dist/{components/Common/hooks → hooks}/useAsyncError.d.ts +0 -0
  361. /package/dist/{components/Common/hooks → hooks}/useAsyncError.js +0 -0
  362. /package/dist/{components/Common/hooks → hooks}/useMenu.d.ts +0 -0
  363. /package/dist/{components/Common/hooks → hooks}/useMenu.js +0 -0
  364. /package/dist/{components/Common/hooks → hooks}/useNumberFormatter.d.ts +0 -0
@@ -25,6 +25,7 @@ import { ProgressBarProps } from '../../components/Common/UI/ProgressBar/Progres
25
25
  import { BreadcrumbsProps } from '../../components/Common/UI/Breadcrumbs/BreadcrumbsTypes';
26
26
  import { TabsProps } from '../../components/Common/UI/Tabs/TabsTypes';
27
27
  import { DialogProps } from '../../components/Common/UI/Dialog/DialogTypes';
28
+ import { ModalProps } from '../../components/Common/UI/Modal/ModalTypes';
28
29
  import { LoadingSpinnerProps } from '../../components/Common/UI/LoadingSpinner/LoadingSpinnerTypes';
29
30
  import { DescriptionListProps } from '../../components/Common/UI/DescriptionList/DescriptionListTypes';
30
31
  export interface ComponentsContextType {
@@ -56,6 +57,7 @@ export interface ComponentsContextType {
56
57
  Breadcrumbs: (props: BreadcrumbsProps) => JSX.Element | null;
57
58
  Tabs: (props: TabsProps) => JSX.Element | null;
58
59
  Dialog: (props: DialogProps) => JSX.Element | null;
60
+ Modal: (props: ModalProps) => JSX.Element | null;
59
61
  LoadingSpinner: (props: LoadingSpinnerProps) => JSX.Element | null;
60
62
  DescriptionList: (props: DescriptionListProps) => JSX.Element | null;
61
63
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useComponentContext.js","sources":["../../../src/contexts/ComponentAdapter/useComponentContext.ts"],"sourcesContent":["import { createContext, useContext } from 'react'\nimport type { JSX } from 'react'\nimport type { TextInputProps } from '@/components/Common/UI/TextInput/TextInputTypes'\nimport type { NumberInputProps } from '@/components/Common/UI/NumberInput/NumberInputTypes'\nimport type { CheckboxGroupProps } from '@/components/Common/UI/CheckboxGroup/CheckboxGroupTypes'\nimport type { ComboBoxProps } from '@/components/Common/UI/ComboBox/ComboBoxTypes'\nimport type { CheckboxProps } from '@/components/Common/UI/Checkbox/CheckboxTypes'\nimport type { DatePickerProps } from '@/components/Common/UI/DatePicker/DatePickerTypes'\nimport type { RadioProps } from '@/components/Common/UI/Radio/RadioTypes'\nimport type { RadioGroupProps } from '@/components/Common/UI/RadioGroup/RadioGroupTypes'\nimport type { SelectProps } from '@/components/Common/UI/Select/SelectTypes'\nimport type { SwitchProps } from '@/components/Common/UI/Switch/SwitchTypes'\nimport type { ButtonIconProps, ButtonProps } from '@/components/Common/UI/Button/ButtonTypes'\nimport type { AlertProps } from '@/components/Common/UI/Alert/AlertTypes'\nimport type { CardProps } from '@/components/Common/UI/Card/CardTypes'\nimport type { LinkProps } from '@/components/Common/UI/Link/LinkTypes'\nimport type { BadgeProps } from '@/components/Common/UI/Badge/BadgeTypes'\nimport type { MenuProps } from '@/components/Common/UI/Menu/MenuTypes'\nimport type { TableProps } from '@/components/Common/UI/Table/TableTypes'\nimport type { OrderedListProps, UnorderedListProps } from '@/components/Common/UI/List/ListTypes'\nimport type { HeadingProps } from '@/components/Common/UI/Heading/HeadingTypes'\nimport type { PaginationControlProps } from '@/components/Common/PaginationControl/PaginationControlTypes'\nimport type { TextProps } from '@/components/Common/UI/Text/TextTypes'\nimport type { CalendarPreviewProps } from '@/components/Common/UI/CalendarPreview/CalendarPreviewTypes'\nimport type { ProgressBarProps } from '@/components/Common/UI/ProgressBar/ProgressBarTypes'\nimport type { BreadcrumbsProps } from '@/components/Common/UI/Breadcrumbs/BreadcrumbsTypes'\nimport type { TabsProps } from '@/components/Common/UI/Tabs/TabsTypes'\nimport type { DialogProps } from '@/components/Common/UI/Dialog/DialogTypes'\nimport type { LoadingSpinnerProps } from '@/components/Common/UI/LoadingSpinner/LoadingSpinnerTypes'\nimport type { DescriptionListProps } from '@/components/Common/UI/DescriptionList/DescriptionListTypes'\n\nexport interface ComponentsContextType {\n Alert: (props: AlertProps) => JSX.Element | null\n Badge: (props: BadgeProps) => JSX.Element | null\n Button: (props: ButtonProps) => JSX.Element | null\n ButtonIcon: (props: ButtonIconProps) => JSX.Element | null\n Card: (props: CardProps) => JSX.Element | null\n Checkbox: (props: CheckboxProps) => JSX.Element | null\n CheckboxGroup: (props: CheckboxGroupProps) => JSX.Element | null\n ComboBox: (props: ComboBoxProps) => JSX.Element | null\n DatePicker: (props: DatePickerProps) => JSX.Element | null\n OrderedList: (props: OrderedListProps) => JSX.Element | null\n UnorderedList: (props: UnorderedListProps) => JSX.Element | null\n NumberInput: (props: NumberInputProps) => JSX.Element | null\n Radio: (props: RadioProps) => JSX.Element | null\n RadioGroup: (props: RadioGroupProps) => JSX.Element | null\n Select: (props: SelectProps) => JSX.Element | null\n Switch: (props: SwitchProps) => JSX.Element | null\n TextInput: (props: TextInputProps) => JSX.Element | null\n Link: (props: LinkProps) => JSX.Element | null\n Menu: (props: MenuProps) => JSX.Element | null\n Table: (props: TableProps) => JSX.Element | null\n Heading: (props: HeadingProps) => JSX.Element | null\n PaginationControl?: (props: PaginationControlProps) => JSX.Element | null\n Text: (props: TextProps) => JSX.Element | null\n CalendarPreview: (props: CalendarPreviewProps) => JSX.Element | null\n ProgressBar: (props: ProgressBarProps) => JSX.Element | null\n Breadcrumbs: (props: BreadcrumbsProps) => JSX.Element | null\n Tabs: (props: TabsProps) => JSX.Element | null\n Dialog: (props: DialogProps) => JSX.Element | null\n LoadingSpinner: (props: LoadingSpinnerProps) => JSX.Element | null\n DescriptionList: (props: DescriptionListProps) => JSX.Element | null\n}\n\nexport const ComponentsContext = createContext<ComponentsContextType | null>(null)\n\nexport const useComponentContext = () => {\n const context = useContext(ComponentsContext)\n if (!context) {\n throw new Error('useComponentContext must be used within a ComponentsProvider')\n }\n return context\n}\n"],"names":["ComponentsContext","createContext","useComponentContext","context","useContext"],"mappings":";AAgEO,MAAMA,IAAoBC,EAA4C,IAAI,GAEpEC,IAAsB,MAAM;AACvC,QAAMC,IAAUC,EAAWJ,CAAiB;AAC5C,MAAI,CAACG;AACH,UAAM,IAAI,MAAM,8DAA8D;AAEhF,SAAOA;AACT;"}
1
+ {"version":3,"file":"useComponentContext.js","sources":["../../../src/contexts/ComponentAdapter/useComponentContext.ts"],"sourcesContent":["import { createContext, useContext } from 'react'\nimport type { JSX } from 'react'\nimport type { TextInputProps } from '@/components/Common/UI/TextInput/TextInputTypes'\nimport type { NumberInputProps } from '@/components/Common/UI/NumberInput/NumberInputTypes'\nimport type { CheckboxGroupProps } from '@/components/Common/UI/CheckboxGroup/CheckboxGroupTypes'\nimport type { ComboBoxProps } from '@/components/Common/UI/ComboBox/ComboBoxTypes'\nimport type { CheckboxProps } from '@/components/Common/UI/Checkbox/CheckboxTypes'\nimport type { DatePickerProps } from '@/components/Common/UI/DatePicker/DatePickerTypes'\nimport type { RadioProps } from '@/components/Common/UI/Radio/RadioTypes'\nimport type { RadioGroupProps } from '@/components/Common/UI/RadioGroup/RadioGroupTypes'\nimport type { SelectProps } from '@/components/Common/UI/Select/SelectTypes'\nimport type { SwitchProps } from '@/components/Common/UI/Switch/SwitchTypes'\nimport type { ButtonIconProps, ButtonProps } from '@/components/Common/UI/Button/ButtonTypes'\nimport type { AlertProps } from '@/components/Common/UI/Alert/AlertTypes'\nimport type { CardProps } from '@/components/Common/UI/Card/CardTypes'\nimport type { LinkProps } from '@/components/Common/UI/Link/LinkTypes'\nimport type { BadgeProps } from '@/components/Common/UI/Badge/BadgeTypes'\nimport type { MenuProps } from '@/components/Common/UI/Menu/MenuTypes'\nimport type { TableProps } from '@/components/Common/UI/Table/TableTypes'\nimport type { OrderedListProps, UnorderedListProps } from '@/components/Common/UI/List/ListTypes'\nimport type { HeadingProps } from '@/components/Common/UI/Heading/HeadingTypes'\nimport type { PaginationControlProps } from '@/components/Common/PaginationControl/PaginationControlTypes'\nimport type { TextProps } from '@/components/Common/UI/Text/TextTypes'\nimport type { CalendarPreviewProps } from '@/components/Common/UI/CalendarPreview/CalendarPreviewTypes'\nimport type { ProgressBarProps } from '@/components/Common/UI/ProgressBar/ProgressBarTypes'\nimport type { BreadcrumbsProps } from '@/components/Common/UI/Breadcrumbs/BreadcrumbsTypes'\nimport type { TabsProps } from '@/components/Common/UI/Tabs/TabsTypes'\nimport type { DialogProps } from '@/components/Common/UI/Dialog/DialogTypes'\nimport type { ModalProps } from '@/components/Common/UI/Modal/ModalTypes'\nimport type { LoadingSpinnerProps } from '@/components/Common/UI/LoadingSpinner/LoadingSpinnerTypes'\nimport type { DescriptionListProps } from '@/components/Common/UI/DescriptionList/DescriptionListTypes'\n\nexport interface ComponentsContextType {\n Alert: (props: AlertProps) => JSX.Element | null\n Badge: (props: BadgeProps) => JSX.Element | null\n Button: (props: ButtonProps) => JSX.Element | null\n ButtonIcon: (props: ButtonIconProps) => JSX.Element | null\n Card: (props: CardProps) => JSX.Element | null\n Checkbox: (props: CheckboxProps) => JSX.Element | null\n CheckboxGroup: (props: CheckboxGroupProps) => JSX.Element | null\n ComboBox: (props: ComboBoxProps) => JSX.Element | null\n DatePicker: (props: DatePickerProps) => JSX.Element | null\n OrderedList: (props: OrderedListProps) => JSX.Element | null\n UnorderedList: (props: UnorderedListProps) => JSX.Element | null\n NumberInput: (props: NumberInputProps) => JSX.Element | null\n Radio: (props: RadioProps) => JSX.Element | null\n RadioGroup: (props: RadioGroupProps) => JSX.Element | null\n Select: (props: SelectProps) => JSX.Element | null\n Switch: (props: SwitchProps) => JSX.Element | null\n TextInput: (props: TextInputProps) => JSX.Element | null\n Link: (props: LinkProps) => JSX.Element | null\n Menu: (props: MenuProps) => JSX.Element | null\n Table: (props: TableProps) => JSX.Element | null\n Heading: (props: HeadingProps) => JSX.Element | null\n PaginationControl?: (props: PaginationControlProps) => JSX.Element | null\n Text: (props: TextProps) => JSX.Element | null\n CalendarPreview: (props: CalendarPreviewProps) => JSX.Element | null\n ProgressBar: (props: ProgressBarProps) => JSX.Element | null\n Breadcrumbs: (props: BreadcrumbsProps) => JSX.Element | null\n Tabs: (props: TabsProps) => JSX.Element | null\n Dialog: (props: DialogProps) => JSX.Element | null\n Modal: (props: ModalProps) => JSX.Element | null\n LoadingSpinner: (props: LoadingSpinnerProps) => JSX.Element | null\n DescriptionList: (props: DescriptionListProps) => JSX.Element | null\n}\n\nexport const ComponentsContext = createContext<ComponentsContextType | null>(null)\n\nexport const useComponentContext = () => {\n const context = useContext(ComponentsContext)\n if (!context) {\n throw new Error('useComponentContext must be used within a ComponentsProvider')\n }\n return context\n}\n"],"names":["ComponentsContext","createContext","useComponentContext","context","useContext"],"mappings":";AAkEO,MAAMA,IAAoBC,EAA4C,IAAI,GAEpEC,IAAsB,MAAM;AACvC,QAAMC,IAAUC,EAAWJ,CAAiB;AAC5C,MAAI,CAACG;AACH,UAAM,IAAI,MAAM,8DAA8D;AAEhF,SAAOA;AACT;"}
@@ -7,21 +7,18 @@ import { createComponents as C } from "../ComponentAdapter/createComponentsWithD
7
7
  import { ApiProvider as I } from "../ApiProvider/ApiProvider.js";
8
8
  import { LoadingIndicatorProvider as x } from "../LoadingIndicatorProvider/LoadingIndicatorProvider.js";
9
9
  import { SDKI18next as t } from "./SDKI18next.js";
10
- import "classnames";
11
- import "../../shared/constants.js";
12
10
  import { InternalError as y } from "../../components/Common/InternalError/InternalError.js";
13
11
  import { LocaleProvider as L } from "../LocaleProvider/LocaleProvider.js";
14
- import "../LocaleProvider/useLocale.js";
15
12
  import { ThemeProvider as U } from "../ThemeProvider/ThemeProvider.js";
16
- const z = (a) => {
13
+ const R = (a) => {
17
14
  const {
18
15
  children: c,
19
16
  config: e,
20
17
  dictionary: o,
21
18
  lng: n = "en",
22
19
  locale: d = "en-US",
23
- currency: p = "USD",
24
- theme: l,
20
+ currency: l = "USD",
21
+ theme: p,
25
22
  components: s,
26
23
  LoaderComponent: f
27
24
  } = a;
@@ -39,9 +36,9 @@ const z = (a) => {
39
36
  }
40
37
  return g(() => {
41
38
  (async () => await t.changeLanguage(n))();
42
- }, [n]), /* @__PURE__ */ r(P, { value: C(s), children: /* @__PURE__ */ r(x, { value: f, children: /* @__PURE__ */ r(h, { FallbackComponent: y, children: /* @__PURE__ */ r(U, { theme: l, children: /* @__PURE__ */ r(L, { locale: d, currency: p, children: /* @__PURE__ */ r(v, { i18n: t, children: /* @__PURE__ */ r(I, { url: e.baseUrl, headers: e.headers, hooks: e.hooks, children: c }) }, n) }) }) }) }) });
39
+ }, [n]), /* @__PURE__ */ r(P, { value: C(s), children: /* @__PURE__ */ r(x, { value: f, children: /* @__PURE__ */ r(h, { FallbackComponent: y, children: /* @__PURE__ */ r(U, { theme: p, children: /* @__PURE__ */ r(L, { locale: d, currency: l, children: /* @__PURE__ */ r(v, { i18n: t, children: /* @__PURE__ */ r(I, { url: e.baseUrl, headers: e.headers, hooks: e.hooks, children: c }) }, n) }) }) }) }) });
43
40
  };
44
41
  export {
45
- z as GustoProviderCustomUIAdapter
42
+ R as GustoProviderCustomUIAdapter
46
43
  };
47
44
  //# sourceMappingURL=GustoProviderCustomUIAdapter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GustoProviderCustomUIAdapter.js","sources":["../../../src/contexts/GustoProvider/GustoProviderCustomUIAdapter.tsx"],"sourcesContent":["import type React from 'react'\nimport { ErrorBoundary } from 'react-error-boundary'\nimport { I18nextProvider } from 'react-i18next'\nimport type { QueryClient } from '@tanstack/react-query'\nimport { useEffect } from 'react'\nimport { ComponentsProvider } from '../ComponentAdapter/ComponentsProvider'\nimport type { ComponentsContextType } from '../ComponentAdapter/useComponentContext'\nimport { createComponents } from '../ComponentAdapter/createComponentsWithDefaults'\nimport { ApiProvider } from '../ApiProvider/ApiProvider'\nimport { LoadingIndicatorProvider } from '../LoadingIndicatorProvider/LoadingIndicatorProvider'\nimport type { LoadingIndicatorContextProps } from '../LoadingIndicatorProvider/useLoadingIndicator'\nimport { SDKI18next } from './SDKI18next'\nimport { InternalError } from '@/components/Common'\nimport { LocaleProvider } from '@/contexts/LocaleProvider'\nimport { ThemeProvider } from '@/contexts/ThemeProvider'\nimport type { GustoSDKTheme } from '@/contexts/ThemeProvider/theme'\nimport type { ResourceDictionary, SupportedLanguages } from '@/types/Helpers'\nimport type { SDKHooks } from '@/types/hooks'\n\nexport interface APIConfig {\n baseUrl: string\n headers?: HeadersInit\n hooks?: SDKHooks\n}\n\nexport interface GustoProviderProps {\n config: APIConfig\n dictionary?: ResourceDictionary\n lng?: string\n locale?: string\n currency?: string\n theme?: GustoSDKTheme\n queryClient?: QueryClient\n components: ComponentsContextType\n LoaderComponent?: LoadingIndicatorContextProps['LoadingIndicator']\n}\n\nexport interface GustoProviderCustomUIAdapterProps extends GustoProviderProps {\n children?: React.ReactNode\n}\n\n/**\n * A provider that accepts UI component adapters through the components prop\n */\nconst GustoProviderCustomUIAdapter: React.FC<GustoProviderCustomUIAdapterProps> = props => {\n const {\n children,\n config,\n dictionary,\n lng = 'en',\n locale = 'en-US',\n currency = 'USD',\n theme,\n components,\n LoaderComponent,\n } = props\n\n // Handle dictionary resources\n if (dictionary) {\n for (const language in dictionary) {\n const lang = language as SupportedLanguages\n for (const ns in dictionary[lang]) {\n // Adding resources overrides to i18next instance - initial load will override common namespace and add component specific dictionaries provided by partners\n SDKI18next.addResourceBundle(\n lang,\n ns,\n (dictionary[lang] as Record<string, unknown>)[ns],\n true,\n true,\n )\n }\n }\n }\n\n // Handle language change\n useEffect(() => {\n void (async () => {\n await SDKI18next.changeLanguage(lng)\n })()\n }, [lng])\n\n return (\n <ComponentsProvider value={createComponents(components)}>\n <LoadingIndicatorProvider value={LoaderComponent}>\n <ErrorBoundary FallbackComponent={InternalError}>\n <ThemeProvider theme={theme}>\n <LocaleProvider locale={locale} currency={currency}>\n <I18nextProvider i18n={SDKI18next} key={lng}>\n <ApiProvider url={config.baseUrl} headers={config.headers} hooks={config.hooks}>\n {children}\n </ApiProvider>\n </I18nextProvider>\n </LocaleProvider>\n </ThemeProvider>\n </ErrorBoundary>\n </LoadingIndicatorProvider>\n </ComponentsProvider>\n )\n}\n\nexport { GustoProviderCustomUIAdapter }\n"],"names":["GustoProviderCustomUIAdapter","props","children","config","dictionary","lng","locale","currency","theme","components","LoaderComponent","language","lang","ns","SDKI18next","useEffect","ComponentsProvider","createComponents","LoadingIndicatorProvider","jsx","ErrorBoundary","InternalError","ThemeProvider","LocaleProvider","I18nextProvider","ApiProvider"],"mappings":";;;;;;;;;;;;;;;AA4CA,MAAMA,IAA4E,CAAAC,MAAS;AACzF,QAAM;AAAA,IACJ,UAAAC;AAAA,IACA,QAAAC;AAAA,IACA,YAAAC;AAAA,IACA,KAAAC,IAAM;AAAA,IACN,QAAAC,IAAS;AAAA,IACT,UAAAC,IAAW;AAAA,IACX,OAAAC;AAAA,IACA,YAAAC;AAAA,IACA,iBAAAC;AAAA,EAAA,IACET;AAGJ,MAAIG;AACF,eAAWO,KAAYP,GAAY;AACjC,YAAMQ,IAAOD;AACb,iBAAWE,KAAMT,EAAWQ,CAAI;AAE9B,QAAAE,EAAW;AAAA,UACTF;AAAA,UACAC;AAAA,UACCT,EAAWQ,CAAI,EAA8BC,CAAE;AAAA,UAChD;AAAA,UACA;AAAA,QAAA;AAAA,IAGN;AAIF,SAAAE,EAAU,MAAM;AACd,KAAM,YACJ,MAAMD,EAAW,eAAeT,CAAG;AAAA,EAEvC,GAAG,CAACA,CAAG,CAAC,qBAGLW,GAAA,EAAmB,OAAOC,EAAiBR,CAAU,GACpD,4BAACS,GAAA,EAAyB,OAAOR,GAC/B,UAAA,gBAAAS,EAACC,GAAA,EAAc,mBAAmBC,GAChC,UAAA,gBAAAF,EAACG,KAAc,OAAAd,GACb,UAAA,gBAAAW,EAACI,KAAe,QAAAjB,GAAgB,UAAAC,GAC9B,4BAACiB,GAAA,EAAgB,MAAMV,GACrB,UAAA,gBAAAK,EAACM,GAAA,EAAY,KAAKtB,EAAO,SAAS,SAASA,EAAO,SAAS,OAAOA,EAAO,OACtE,UAAAD,GACH,EAAA,GAHsCG,CAIxC,GACF,EAAA,CACF,GACF,GACF,EAAA,CACF;AAEJ;"}
1
+ {"version":3,"file":"GustoProviderCustomUIAdapter.js","sources":["../../../src/contexts/GustoProvider/GustoProviderCustomUIAdapter.tsx"],"sourcesContent":["import type React from 'react'\nimport { ErrorBoundary } from 'react-error-boundary'\nimport { I18nextProvider } from 'react-i18next'\nimport type { QueryClient } from '@tanstack/react-query'\nimport { useEffect } from 'react'\nimport { ComponentsProvider } from '../ComponentAdapter/ComponentsProvider'\nimport type { ComponentsContextType } from '../ComponentAdapter/useComponentContext'\nimport { createComponents } from '../ComponentAdapter/createComponentsWithDefaults'\nimport { ApiProvider } from '../ApiProvider/ApiProvider'\nimport { LoadingIndicatorProvider } from '../LoadingIndicatorProvider/LoadingIndicatorProvider'\nimport type { LoadingIndicatorContextProps } from '../LoadingIndicatorProvider/useLoadingIndicator'\nimport { SDKI18next } from './SDKI18next'\nimport { InternalError } from '@/components/Common'\nimport { LocaleProvider } from '@/contexts/LocaleProvider'\nimport { ThemeProvider } from '@/contexts/ThemeProvider'\nimport type { GustoSDKTheme } from '@/contexts/ThemeProvider/theme'\nimport type { ResourceDictionary, SupportedLanguages } from '@/types/Helpers'\nimport type { SDKHooks } from '@/types/hooks'\n\nexport interface APIConfig {\n baseUrl: string\n headers?: HeadersInit\n hooks?: SDKHooks\n}\n\nexport interface GustoProviderProps {\n config: APIConfig\n dictionary?: ResourceDictionary\n lng?: string\n locale?: string\n currency?: string\n theme?: GustoSDKTheme\n queryClient?: QueryClient\n components: ComponentsContextType\n LoaderComponent?: LoadingIndicatorContextProps['LoadingIndicator']\n}\n\nexport interface GustoProviderCustomUIAdapterProps extends GustoProviderProps {\n children?: React.ReactNode\n}\n\n/**\n * A provider that accepts UI component adapters through the components prop\n */\nconst GustoProviderCustomUIAdapter: React.FC<GustoProviderCustomUIAdapterProps> = props => {\n const {\n children,\n config,\n dictionary,\n lng = 'en',\n locale = 'en-US',\n currency = 'USD',\n theme,\n components,\n LoaderComponent,\n } = props\n\n // Handle dictionary resources\n if (dictionary) {\n for (const language in dictionary) {\n const lang = language as SupportedLanguages\n for (const ns in dictionary[lang]) {\n // Adding resources overrides to i18next instance - initial load will override common namespace and add component specific dictionaries provided by partners\n SDKI18next.addResourceBundle(\n lang,\n ns,\n (dictionary[lang] as Record<string, unknown>)[ns],\n true,\n true,\n )\n }\n }\n }\n\n // Handle language change\n useEffect(() => {\n void (async () => {\n await SDKI18next.changeLanguage(lng)\n })()\n }, [lng])\n\n return (\n <ComponentsProvider value={createComponents(components)}>\n <LoadingIndicatorProvider value={LoaderComponent}>\n <ErrorBoundary FallbackComponent={InternalError}>\n <ThemeProvider theme={theme}>\n <LocaleProvider locale={locale} currency={currency}>\n <I18nextProvider i18n={SDKI18next} key={lng}>\n <ApiProvider url={config.baseUrl} headers={config.headers} hooks={config.hooks}>\n {children}\n </ApiProvider>\n </I18nextProvider>\n </LocaleProvider>\n </ThemeProvider>\n </ErrorBoundary>\n </LoadingIndicatorProvider>\n </ComponentsProvider>\n )\n}\n\nexport { GustoProviderCustomUIAdapter }\n"],"names":["GustoProviderCustomUIAdapter","props","children","config","dictionary","lng","locale","currency","theme","components","LoaderComponent","language","lang","ns","SDKI18next","useEffect","ComponentsProvider","createComponents","LoadingIndicatorProvider","jsx","ErrorBoundary","InternalError","ThemeProvider","LocaleProvider","I18nextProvider","ApiProvider"],"mappings":";;;;;;;;;;;;AA4CA,MAAMA,IAA4E,CAAAC,MAAS;AACzF,QAAM;AAAA,IACJ,UAAAC;AAAA,IACA,QAAAC;AAAA,IACA,YAAAC;AAAA,IACA,KAAAC,IAAM;AAAA,IACN,QAAAC,IAAS;AAAA,IACT,UAAAC,IAAW;AAAA,IACX,OAAAC;AAAA,IACA,YAAAC;AAAA,IACA,iBAAAC;AAAA,EAAA,IACET;AAGJ,MAAIG;AACF,eAAWO,KAAYP,GAAY;AACjC,YAAMQ,IAAOD;AACb,iBAAWE,KAAMT,EAAWQ,CAAI;AAE9B,QAAAE,EAAW;AAAA,UACTF;AAAA,UACAC;AAAA,UACCT,EAAWQ,CAAI,EAA8BC,CAAE;AAAA,UAChD;AAAA,UACA;AAAA,QAAA;AAAA,IAGN;AAIF,SAAAE,EAAU,MAAM;AACd,KAAM,YACJ,MAAMD,EAAW,eAAeT,CAAG;AAAA,EAEvC,GAAG,CAACA,CAAG,CAAC,qBAGLW,GAAA,EAAmB,OAAOC,EAAiBR,CAAU,GACpD,4BAACS,GAAA,EAAyB,OAAOR,GAC/B,UAAA,gBAAAS,EAACC,GAAA,EAAc,mBAAmBC,GAChC,UAAA,gBAAAF,EAACG,KAAc,OAAAd,GACb,UAAA,gBAAAW,EAACI,KAAe,QAAAjB,GAAgB,UAAAC,GAC9B,4BAACiB,GAAA,EAAgB,MAAMV,GACrB,UAAA,gBAAAK,EAACM,GAAA,EAAY,KAAKtB,EAAO,SAAS,SAASA,EAAO,SAAS,OAAOA,EAAO,OACtE,UAAAD,GACH,EAAA,GAHsCG,CAIxC,GACF,EAAA,CACF,GACF,GACF,EAAA,CACF;AAEJ;"}
@@ -0,0 +1,7 @@
1
+ import { EntityErrorObject } from '@gusto/embedded-api/models/components/entityerrorobject';
2
+ /**Traverses errorList and finds items with message properties */
3
+ export declare const renderErrorList: (errorList: Array<EntityErrorObject>) => React.ReactNode[];
4
+ /**Recuresively parses error list and constructs an array of objects containing attribute value error messages associated with form fields. Nested errors construct '.' separated keys
5
+ * metadata.state is a special case for state taxes validation errors
6
+ */
7
+ export declare const getFieldErrors: (error: EntityErrorObject, parentKey?: string) => Array<EntityErrorObject>;
@@ -0,0 +1,23 @@
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import { snakeCaseToCamelCase as y } from "./formattedStrings.js";
3
+ const g = (e) => e.map((t) => t.message ? /* @__PURE__ */ n("span", { children: t.message }, t.errorKey) : null), f = (e, t) => {
4
+ const s = t ? t + "." : "";
5
+ if (e.category === "invalid_attribute_value" || e.category === "invalid_operation")
6
+ return [
7
+ {
8
+ errorKey: y(s + e.errorKey),
9
+ message: e.message ?? "",
10
+ category: e.category
11
+ }
12
+ ];
13
+ if (e.category === "nested_errors" && e.errors !== void 0) {
14
+ let a = "";
15
+ return e.metadata?.key && typeof e.metadata.key == "string" ? a = e.metadata.key : e.metadata?.state && typeof e.metadata.state == "string" ? a = e.metadata.state : e.errorKey && (a = e.errorKey), e.errors.flatMap((i) => f(i, s + a));
16
+ }
17
+ return [];
18
+ };
19
+ export {
20
+ f as getFieldErrors,
21
+ g as renderErrorList
22
+ };
23
+ //# sourceMappingURL=apiErrorToList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apiErrorToList.js","sources":["../../src/helpers/apiErrorToList.tsx"],"sourcesContent":["import type { EntityErrorObject } from '@gusto/embedded-api/models/components/entityerrorobject'\nimport { snakeCaseToCamelCase } from './formattedStrings'\n\n/**Traverses errorList and finds items with message properties */\nexport const renderErrorList = (errorList: Array<EntityErrorObject>): React.ReactNode[] => {\n return errorList.map(errorFromList => {\n if (errorFromList.message) {\n return <span key={errorFromList.errorKey}>{errorFromList.message}</span>\n }\n return null\n })\n}\n/**Recuresively parses error list and constructs an array of objects containing attribute value error messages associated with form fields. Nested errors construct '.' separated keys\n * metadata.state is a special case for state taxes validation errors\n */\nexport const getFieldErrors = (\n error: EntityErrorObject,\n parentKey?: string,\n): Array<EntityErrorObject> => {\n const keyPrefix = parentKey ? parentKey + '.' : ''\n if (error.category === 'invalid_attribute_value' || error.category === 'invalid_operation') {\n return [\n {\n errorKey: snakeCaseToCamelCase(keyPrefix + error.errorKey),\n message: error.message ?? '',\n category: error.category,\n },\n ]\n }\n if (error.category === 'nested_errors' && error.errors !== undefined) {\n //TODO: clean this up once Metadata type is fixed in openapi spec\n let keySuffix = ''\n //@ts-expect-error: Metadata in speakeasy is incorrectly typed\n if (error.metadata?.key && typeof error.metadata.key === 'string') {\n //@ts-expect-error: Metadata in speakeasy is incorrectly typed\n keySuffix = error.metadata.key as string\n //@ts-expect-error: Metadata in speakeasy is incorrectly typed\n } else if (error.metadata?.state && typeof error.metadata.state === 'string') {\n //@ts-expect-error: Metadata in speakeasy is incorrectly typed\n keySuffix = error.metadata.state as string\n } else if (error.errorKey) {\n keySuffix = error.errorKey\n }\n return error.errors.flatMap(err => getFieldErrors(err, keyPrefix + keySuffix))\n }\n return []\n}\n"],"names":["renderErrorList","errorList","errorFromList","jsx","getFieldErrors","error","parentKey","keyPrefix","snakeCaseToCamelCase","keySuffix","err"],"mappings":";;AAIO,MAAMA,IAAkB,CAACC,MACvBA,EAAU,IAAI,CAAAC,MACfA,EAAc,UACT,gBAAAC,EAAC,QAAA,EAAmC,UAAAD,EAAc,QAAA,GAAvCA,EAAc,QAAiC,IAE5D,IACR,GAKUE,IAAiB,CAC5BC,GACAC,MAC6B;AAC7B,QAAMC,IAAYD,IAAYA,IAAY,MAAM;AAChD,MAAID,EAAM,aAAa,6BAA6BA,EAAM,aAAa;AACrE,WAAO;AAAA,MACL;AAAA,QACE,UAAUG,EAAqBD,IAAYF,EAAM,QAAQ;AAAA,QACzD,SAASA,EAAM,WAAW;AAAA,QAC1B,UAAUA,EAAM;AAAA,MAAA;AAAA,IAClB;AAGJ,MAAIA,EAAM,aAAa,mBAAmBA,EAAM,WAAW,QAAW;AAEpE,QAAII,IAAY;AAEhB,WAAIJ,EAAM,UAAU,OAAO,OAAOA,EAAM,SAAS,OAAQ,WAEvDI,IAAYJ,EAAM,SAAS,MAElBA,EAAM,UAAU,SAAS,OAAOA,EAAM,SAAS,SAAU,WAElEI,IAAYJ,EAAM,SAAS,QAClBA,EAAM,aACfI,IAAYJ,EAAM,WAEbA,EAAM,OAAO,QAAQ,CAAAK,MAAON,EAAeM,GAAKH,IAAYE,CAAS,CAAC;AAAA,EAC/E;AACA,SAAO,CAAA;AACT;"}
@@ -1,46 +1,46 @@
1
- const l = (r) => {
2
- const e = {};
3
- for (const [n, s] of Object.entries(r)) {
4
- const o = [];
5
- let t = s;
6
- for (; t; ) {
7
- o.unshift(t.item);
8
- const c = t.parent;
9
- t = c ? r[c] ?? null : null;
1
+ const a = (r) => {
2
+ const t = {};
3
+ for (const [c, n] of Object.entries(r)) {
4
+ const s = [];
5
+ let e = n;
6
+ for (; e; ) {
7
+ s.unshift(e.item);
8
+ const o = e.parent;
9
+ e = o ? r[o] ?? null : null;
10
10
  }
11
- e[n] = o;
11
+ t[c] = s;
12
12
  }
13
- return e;
14
- }, u = (r, e) => {
13
+ return t;
14
+ }, u = (r, t) => {
15
15
  if (!r)
16
16
  return {};
17
- const n = {};
18
- for (const [s, o] of Object.entries(r)) {
19
- const t = o.match(/{{(.*?)}}/);
20
- if (t?.[1]) {
21
- const c = t[1].trim();
22
- n[s] = e[c] ?? "";
17
+ const c = {};
18
+ for (const [n, s] of Object.entries(r)) {
19
+ const e = s.match(/{{(.*?)}}/);
20
+ if (e?.[1]) {
21
+ const o = e[1].trim();
22
+ c[n] = t[o] ?? "";
23
23
  } else
24
- n[s] = o;
24
+ c[n] = s;
25
25
  }
26
- return n;
27
- }, i = (r, e, n) => {
28
- const s = e.breadcrumbs ?? {}, t = (s[r] ?? []).map((c) => c.id === r && n ? {
29
- ...c,
30
- variables: u(n, e)
31
- } : c);
26
+ return c;
27
+ }, l = (r, t, c) => {
28
+ const n = t.breadcrumbs ?? {}, e = (n[r] ?? []).map((o) => ({
29
+ ...o,
30
+ variables: u(c, t)
31
+ }));
32
32
  return {
33
- ...e,
33
+ ...t,
34
34
  breadcrumbs: {
35
- ...s,
36
- [r]: t
35
+ ...n,
36
+ [r]: e
37
37
  },
38
38
  currentBreadcrumbId: r
39
39
  };
40
40
  };
41
41
  export {
42
- l as buildBreadcrumbs,
42
+ a as buildBreadcrumbs,
43
43
  u as resolveBreadcrumbVariables,
44
- i as updateBreadcrumbs
44
+ l as updateBreadcrumbs
45
45
  };
46
46
  //# sourceMappingURL=breadcrumbHelpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"breadcrumbHelpers.js","sources":["../../src/helpers/breadcrumbHelpers.ts"],"sourcesContent":["import type {\n BreadcrumbNode,\n BreadcrumbNodes,\n BreadcrumbTrail,\n FlowBreadcrumb,\n} from '@/components/Common/FlowBreadcrumbs/FlowBreadcrumbsTypes'\n\n/**\n * Builds a complete breadcrumb trail map from a hierarchical node structure.\n *\n * Takes a tree structure of breadcrumb nodes and generates a map where each state\n * has its complete breadcrumb trail from root to that state. This is useful for\n * initializing breadcrumb navigation in state machines or multi-step flows.\n */\nexport const buildBreadcrumbs = (nodes: BreadcrumbNodes): BreadcrumbTrail => {\n const map: Record<string, FlowBreadcrumb[]> = {}\n\n for (const [state, node] of Object.entries(nodes)) {\n const trail: FlowBreadcrumb[] = []\n let current: BreadcrumbNode | null = node\n\n while (current) {\n trail.unshift(current.item)\n const parentKey: string | null = current.parent\n current = parentKey ? (nodes[parentKey] ?? null) : null\n }\n\n map[state] = trail\n }\n\n return map\n}\n\n/**\n * Resolves template variables in breadcrumb labels using values from a context object.\n *\n * Supports Handlebars-style template syntax ({{variableName}}) for dynamic breadcrumb labels.\n * Variables enclosed in double braces are replaced with their corresponding values from the context.\n * Non-template strings are returned as-is.\n */\nexport const resolveBreadcrumbVariables = (\n variables: Record<string, string> | undefined,\n context: Record<string, unknown>,\n): Record<string, unknown> => {\n if (!variables) {\n return {}\n }\n\n const resolved: Record<string, unknown> = {}\n for (const [key, value] of Object.entries(variables)) {\n const match = value.match(/{{(.*?)}}/)\n if (match?.[1]) {\n const ctxKey = match[1].trim()\n resolved[key] = context[ctxKey] ?? ''\n } else {\n resolved[key] = value\n }\n }\n return resolved\n}\n\n/**\n * Updates the breadcrumb trail for a specific state with resolved variables.\n *\n * This function is typically used in state machine transitions to update breadcrumb\n * navigation when moving between states. It preserves all existing breadcrumb trails\n * for other states and only updates the trail for the specified state by resolving\n * any template variables for that state's breadcrumb.\n\n */\nexport const updateBreadcrumbs = <\n T extends { breadcrumbs?: BreadcrumbTrail; currentBreadcrumb?: string },\n>(\n stateName: string,\n context: T,\n variables?: Record<string, string>,\n): Omit<T, 'breadcrumbs' | 'currentBreadcrumb'> & {\n breadcrumbs: BreadcrumbTrail\n currentBreadcrumbId: string\n} => {\n const allBreadcrumbs = context.breadcrumbs ?? {}\n const trail = allBreadcrumbs[stateName] ?? []\n const resolvedTrail = trail.map(breadcrumb => {\n if (breadcrumb.id === stateName && variables) {\n return {\n ...breadcrumb,\n variables: resolveBreadcrumbVariables(variables, context as Record<string, unknown>),\n }\n }\n return breadcrumb\n })\n return {\n ...context,\n breadcrumbs: {\n ...allBreadcrumbs,\n [stateName]: resolvedTrail,\n },\n currentBreadcrumbId: stateName,\n }\n}\n"],"names":["buildBreadcrumbs","nodes","map","state","node","trail","current","parentKey","resolveBreadcrumbVariables","variables","context","resolved","key","value","match","ctxKey","updateBreadcrumbs","stateName","allBreadcrumbs","resolvedTrail","breadcrumb"],"mappings":"AAcO,MAAMA,IAAmB,CAACC,MAA4C;AAC3E,QAAMC,IAAwC,CAAA;AAE9C,aAAW,CAACC,GAAOC,CAAI,KAAK,OAAO,QAAQH,CAAK,GAAG;AACjD,UAAMI,IAA0B,CAAA;AAChC,QAAIC,IAAiCF;AAErC,WAAOE,KAAS;AACd,MAAAD,EAAM,QAAQC,EAAQ,IAAI;AAC1B,YAAMC,IAA2BD,EAAQ;AACzC,MAAAA,IAAUC,IAAaN,EAAMM,CAAS,KAAK,OAAQ;AAAA,IACrD;AAEA,IAAAL,EAAIC,CAAK,IAAIE;AAAA,EACf;AAEA,SAAOH;AACT,GASaM,IAA6B,CACxCC,GACAC,MAC4B;AAC5B,MAAI,CAACD;AACH,WAAO,CAAA;AAGT,QAAME,IAAoC,CAAA;AAC1C,aAAW,CAACC,GAAKC,CAAK,KAAK,OAAO,QAAQJ,CAAS,GAAG;AACpD,UAAMK,IAAQD,EAAM,MAAM,WAAW;AACrC,QAAIC,IAAQ,CAAC,GAAG;AACd,YAAMC,IAASD,EAAM,CAAC,EAAE,KAAA;AACxB,MAAAH,EAASC,CAAG,IAAIF,EAAQK,CAAM,KAAK;AAAA,IACrC;AACE,MAAAJ,EAASC,CAAG,IAAIC;AAAA,EAEpB;AACA,SAAOF;AACT,GAWaK,IAAoB,CAG/BC,GACAP,GACAD,MAIG;AACH,QAAMS,IAAiBR,EAAQ,eAAe,CAAA,GAExCS,KADQD,EAAeD,CAAS,KAAK,CAAA,GACf,IAAI,CAAAG,MAC1BA,EAAW,OAAOH,KAAaR,IAC1B;AAAA,IACL,GAAGW;AAAA,IACH,WAAWZ,EAA2BC,GAAWC,CAAkC;AAAA,EAAA,IAGhFU,CACR;AACD,SAAO;AAAA,IACL,GAAGV;AAAA,IACH,aAAa;AAAA,MACX,GAAGQ;AAAA,MACH,CAACD,CAAS,GAAGE;AAAA,IAAA;AAAA,IAEf,qBAAqBF;AAAA,EAAA;AAEzB;"}
1
+ {"version":3,"file":"breadcrumbHelpers.js","sources":["../../src/helpers/breadcrumbHelpers.ts"],"sourcesContent":["import type {\n BreadcrumbNode,\n BreadcrumbNodes,\n BreadcrumbTrail,\n FlowBreadcrumb,\n} from '@/components/Common/FlowBreadcrumbs/FlowBreadcrumbsTypes'\n\n/**\n * Builds a complete breadcrumb trail map from a hierarchical node structure.\n *\n * Takes a tree structure of breadcrumb nodes and generates a map where each state\n * has its complete breadcrumb trail from root to that state. This is useful for\n * initializing breadcrumb navigation in state machines or multi-step flows.\n */\nexport const buildBreadcrumbs = (nodes: BreadcrumbNodes): BreadcrumbTrail => {\n const map: Record<string, FlowBreadcrumb[]> = {}\n\n for (const [state, node] of Object.entries(nodes)) {\n const trail: FlowBreadcrumb[] = []\n let current: BreadcrumbNode | null = node\n\n while (current) {\n trail.unshift(current.item)\n const parentKey: string | null = current.parent\n current = parentKey ? (nodes[parentKey] ?? null) : null\n }\n\n map[state] = trail\n }\n\n return map\n}\n\n/**\n * Resolves template variables in breadcrumb labels using values from a context object.\n *\n * Supports Handlebars-style template syntax ({{variableName}}) for dynamic breadcrumb labels.\n * Variables enclosed in double braces are replaced with their corresponding values from the context.\n * Non-template strings are returned as-is.\n */\nexport const resolveBreadcrumbVariables = (\n variables: Record<string, string> | undefined,\n context: Record<string, unknown>,\n): Record<string, unknown> => {\n if (!variables) {\n return {}\n }\n\n const resolved: Record<string, unknown> = {}\n for (const [key, value] of Object.entries(variables)) {\n const match = value.match(/{{(.*?)}}/)\n if (match?.[1]) {\n const ctxKey = match[1].trim()\n resolved[key] = context[ctxKey] ?? ''\n } else {\n resolved[key] = value\n }\n }\n return resolved\n}\n\n/**\n * Updates the breadcrumb trail for a specific state with resolved variables.\n *\n * This function is typically used in state machine transitions to update breadcrumb\n * navigation when moving between states. It preserves all existing breadcrumb trails\n * for other states and only updates the trail for the specified state by resolving\n * any template variables for that state's breadcrumb.\n\n */\nexport const updateBreadcrumbs = <\n T extends { breadcrumbs?: BreadcrumbTrail; currentBreadcrumb?: string },\n>(\n stateName: string,\n context: T,\n variables?: Record<string, string>,\n): Omit<T, 'breadcrumbs' | 'currentBreadcrumb'> & {\n breadcrumbs: BreadcrumbTrail\n currentBreadcrumbId: string\n} => {\n const allBreadcrumbs = context.breadcrumbs ?? {}\n const trail = allBreadcrumbs[stateName] ?? []\n const resolvedTrail = trail.map(breadcrumb => {\n return {\n ...breadcrumb,\n variables: resolveBreadcrumbVariables(variables, context as Record<string, unknown>),\n }\n })\n return {\n ...context,\n breadcrumbs: {\n ...allBreadcrumbs,\n [stateName]: resolvedTrail,\n },\n currentBreadcrumbId: stateName,\n }\n}\n"],"names":["buildBreadcrumbs","nodes","map","state","node","trail","current","parentKey","resolveBreadcrumbVariables","variables","context","resolved","key","value","match","ctxKey","updateBreadcrumbs","stateName","allBreadcrumbs","resolvedTrail","breadcrumb"],"mappings":"AAcO,MAAMA,IAAmB,CAACC,MAA4C;AAC3E,QAAMC,IAAwC,CAAA;AAE9C,aAAW,CAACC,GAAOC,CAAI,KAAK,OAAO,QAAQH,CAAK,GAAG;AACjD,UAAMI,IAA0B,CAAA;AAChC,QAAIC,IAAiCF;AAErC,WAAOE,KAAS;AACd,MAAAD,EAAM,QAAQC,EAAQ,IAAI;AAC1B,YAAMC,IAA2BD,EAAQ;AACzC,MAAAA,IAAUC,IAAaN,EAAMM,CAAS,KAAK,OAAQ;AAAA,IACrD;AAEA,IAAAL,EAAIC,CAAK,IAAIE;AAAA,EACf;AAEA,SAAOH;AACT,GASaM,IAA6B,CACxCC,GACAC,MAC4B;AAC5B,MAAI,CAACD;AACH,WAAO,CAAA;AAGT,QAAME,IAAoC,CAAA;AAC1C,aAAW,CAACC,GAAKC,CAAK,KAAK,OAAO,QAAQJ,CAAS,GAAG;AACpD,UAAMK,IAAQD,EAAM,MAAM,WAAW;AACrC,QAAIC,IAAQ,CAAC,GAAG;AACd,YAAMC,IAASD,EAAM,CAAC,EAAE,KAAA;AACxB,MAAAH,EAASC,CAAG,IAAIF,EAAQK,CAAM,KAAK;AAAA,IACrC;AACE,MAAAJ,EAASC,CAAG,IAAIC;AAAA,EAEpB;AACA,SAAOF;AACT,GAWaK,IAAoB,CAG/BC,GACAP,GACAD,MAIG;AACH,QAAMS,IAAiBR,EAAQ,eAAe,CAAA,GAExCS,KADQD,EAAeD,CAAS,KAAK,CAAA,GACf,IAAI,CAAAG,OACvB;AAAA,IACL,GAAGA;AAAA,IACH,WAAWZ,EAA2BC,GAAWC,CAAkC;AAAA,EAAA,EAEtF;AACD,SAAO;AAAA,IACL,GAAGA;AAAA,IACH,aAAa;AAAA,MACX,GAAGQ;AAAA,MACH,CAACD,CAAS,GAAGE;AAAA,IAAA;AAAA,IAEf,qBAAqBF;AAAA,EAAA;AAEzB;"}
@@ -1,13 +1,21 @@
1
- export declare const formatDateNamedWeekdayShortPlusDate: (date?: string, locale?: string) => string;
2
- export declare const formatDateTimeWithTimezone: (date?: string | Date, locale?: string) => {
1
+ export declare const formatDateShortWithWeekday: (dateInput?: string | Date | null, locale?: string) => string;
2
+ export declare const formatDateShortWithWeekdayAndYear: (dateInput?: string | Date | null, locale?: string) => string;
3
+ export declare const formatDateShort: (dateInput?: string | Date | null, locale?: string) => string;
4
+ export declare const formatDateShortWithYear: (dateInput?: string | Date | null, locale?: string) => string;
5
+ export declare const formatDateLong: (dateInput?: string | Date | null, locale?: string) => string;
6
+ export declare const formatDateLongWithYear: (dateInput?: string | Date | null, locale?: string) => string;
7
+ export declare const formatDateWithTime: (dateInput?: string | Date | null, locale?: string) => {
3
8
  time: string;
4
9
  date: string;
5
10
  };
6
- export declare const formatDateToStringDate: (date: Date) => string | null | undefined;
7
- /**
8
- * Parses YYYY-MM-DD string to local Date, avoiding timezone issues from `new Date(dateString)`.
9
- */
10
- export declare const parseDateStringToLocal: (dateString: string) => Date | null;
11
+ export declare const formatPayPeriod: (startDateInput?: string | Date | null, endDateInput?: string | Date | null, locale?: string) => {
12
+ startDate: string;
13
+ endDate: string;
14
+ };
15
+ export declare const formatPayPeriodRange: (startDateInput?: string | Date | null, endDateInput?: string | Date | null, locale?: string, options?: {
16
+ useShortMonth?: boolean;
17
+ }) => string;
18
+ export declare const formatDateToStringDate: (date: Date) => string | null;
11
19
  /**
12
20
  * Normalizes Date to local midnight, handling timezone issues from any adapter.
13
21
  */
@@ -1,49 +1,102 @@
1
- const m = (t, r) => {
2
- if (!t) return "";
3
- const e = u(t);
4
- return e ? e.toLocaleDateString(r, {
5
- weekday: "short",
6
- month: "short",
7
- day: "numeric"
8
- }) : "";
9
- }, l = (t, r) => {
10
- if (!t) return { time: "", date: "" };
11
- const e = typeof t == "string" ? new Date(t) : t;
12
- if (isNaN(e.getTime())) return { time: "", date: "" };
13
- const o = e.toLocaleTimeString(r, {
1
+ const m = (t) => {
2
+ if (!t) return null;
3
+ if (typeof t == "string") {
4
+ if (/^\d{4}-\d{2}-\d{2}$/.test(t)) {
5
+ const r = t.split("-");
6
+ if (r.length !== 3) return null;
7
+ const e = r.map(Number), n = e[0], i = e[1], o = e[2];
8
+ return n === void 0 || i === void 0 || o === void 0 || isNaN(n) || isNaN(i) || isNaN(o) || i < 1 || i > 12 || o < 1 || o > 31 ? null : new Date(n, i - 1, o);
9
+ }
10
+ const a = new Date(t);
11
+ return isNaN(a.getTime()) ? null : a;
12
+ }
13
+ return t instanceof Date ? isNaN(t.getTime()) ? null : t : null;
14
+ }, c = (t) => (a, r) => {
15
+ const e = m(a);
16
+ return e ? e.toLocaleDateString(r, t) : "";
17
+ }, h = c({
18
+ weekday: "short",
19
+ month: "short",
20
+ day: "numeric"
21
+ }), l = c({
22
+ weekday: "short",
23
+ month: "short",
24
+ day: "numeric",
25
+ year: "numeric"
26
+ }), d = c({
27
+ month: "short",
28
+ day: "numeric"
29
+ }), D = c({
30
+ month: "short",
31
+ day: "numeric",
32
+ year: "numeric"
33
+ }), f = c({
34
+ month: "long",
35
+ day: "numeric"
36
+ }), y = c({
37
+ month: "long",
38
+ day: "numeric",
39
+ year: "numeric"
40
+ }), g = (t, a) => {
41
+ const r = m(t);
42
+ if (!r) return { time: "", date: "" };
43
+ const e = r.toLocaleTimeString(a, {
14
44
  hour: "numeric",
15
45
  minute: "2-digit",
16
46
  hour12: !0,
17
47
  timeZoneName: "short"
18
- }), n = e.toLocaleDateString(r, {
48
+ }), n = r.toLocaleDateString(a, {
19
49
  weekday: "short",
20
50
  month: "short",
21
51
  day: "numeric"
22
52
  });
23
- return { time: o, date: n };
24
- }, c = (t) => isNaN(t.getTime()) ? null : t.toISOString().split("T")[0], u = (t) => {
25
- if (!t || !/^\d{4}-\d{2}-\d{2}$/.test(t))
26
- return null;
27
- const r = t.split("-");
28
- if (r.length !== 3)
29
- return null;
30
- const e = r.map(Number), o = e[0], n = e[1], i = e[2];
31
- return o === void 0 || n === void 0 || i === void 0 || isNaN(o) || isNaN(n) || isNaN(i) || n < 1 || n > 12 || i < 1 || i > 31 ? null : new Date(o, n - 1, i);
32
- }, N = (t) => {
53
+ return { time: e, date: n };
54
+ }, N = (t, a, r) => {
55
+ const e = m(t), n = m(a);
56
+ if (!e || !n)
57
+ return { startDate: "", endDate: "" };
58
+ const i = e.toLocaleDateString(r, {
59
+ month: "long",
60
+ day: "numeric"
61
+ }), o = n.toLocaleDateString(r, {
62
+ month: "short",
63
+ day: "numeric",
64
+ year: "numeric"
65
+ });
66
+ return { startDate: i, endDate: o };
67
+ }, S = (t, a, r, e) => {
68
+ const n = m(t), i = m(a);
69
+ if (!n || !i) return "";
70
+ const o = e?.useShortMonth ? "short" : "long", s = n.toLocaleDateString(r, {
71
+ month: o,
72
+ day: "numeric"
73
+ }), u = i.toLocaleDateString(r, {
74
+ month: o,
75
+ day: "numeric",
76
+ year: "numeric"
77
+ });
78
+ return `${s}–${u}`;
79
+ }, T = (t) => isNaN(t.getTime()) ? null : t.toISOString().split("T")[0] || null, L = (t) => {
33
80
  if (!t || isNaN(t.getTime()))
34
81
  return null;
35
- const r = t.toISOString(), [e] = r.split("T");
36
- if (!e) return null;
37
- const o = e.split("-");
38
- if (o.length !== 3) return null;
39
- const n = o.map(Number), i = n[0], s = n[1], a = n[2];
40
- return isNaN(i) || isNaN(s) || isNaN(a) || s < 1 || s > 12 || a < 1 || a > 31 ? null : new Date(i, s - 1, a);
82
+ const a = t.toISOString(), [r] = a.split("T");
83
+ if (!r) return null;
84
+ const e = r.split("-");
85
+ if (e.length !== 3) return null;
86
+ const n = e.map(Number), i = n[0], o = n[1], s = n[2];
87
+ return isNaN(i) || isNaN(o) || isNaN(s) || o < 1 || o > 12 || s < 1 || s > 31 ? null : new Date(i, o - 1, s);
41
88
  };
42
89
  export {
43
- m as formatDateNamedWeekdayShortPlusDate,
44
- l as formatDateTimeWithTimezone,
45
- c as formatDateToStringDate,
46
- N as normalizeDateToLocal,
47
- u as parseDateStringToLocal
90
+ f as formatDateLong,
91
+ y as formatDateLongWithYear,
92
+ d as formatDateShort,
93
+ h as formatDateShortWithWeekday,
94
+ l as formatDateShortWithWeekdayAndYear,
95
+ D as formatDateShortWithYear,
96
+ T as formatDateToStringDate,
97
+ g as formatDateWithTime,
98
+ N as formatPayPeriod,
99
+ S as formatPayPeriodRange,
100
+ L as normalizeDateToLocal
48
101
  };
49
102
  //# sourceMappingURL=dateFormatting.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dateFormatting.js","sources":["../../src/helpers/dateFormatting.ts"],"sourcesContent":["export const formatDateNamedWeekdayShortPlusDate = (date?: string, locale?: string) => {\n if (!date) return ''\n const parsedDate = parseDateStringToLocal(date)\n if (!parsedDate) return ''\n return parsedDate.toLocaleDateString(locale, {\n weekday: 'short',\n month: 'short',\n day: 'numeric',\n })\n}\n\nexport const formatDateTimeWithTimezone = (date?: string | Date, locale?: string) => {\n if (!date) return { time: '', date: '' }\n const parsedDate = typeof date === 'string' ? new Date(date) : date\n if (isNaN(parsedDate.getTime())) return { time: '', date: '' }\n\n const time = parsedDate.toLocaleTimeString(locale, {\n hour: 'numeric',\n minute: '2-digit',\n hour12: true,\n timeZoneName: 'short',\n })\n\n const dateString = parsedDate.toLocaleDateString(locale, {\n weekday: 'short',\n month: 'short',\n day: 'numeric',\n })\n\n return { time, date: dateString }\n}\n\nexport const formatDateToStringDate = (date: Date) => {\n // Handle invalid dates gracefully\n if (isNaN(date.getTime())) {\n return null\n }\n return date.toISOString().split('T')[0]\n}\n\n/**\n * Parses YYYY-MM-DD string to local Date, avoiding timezone issues from `new Date(dateString)`.\n */\nexport const parseDateStringToLocal = (dateString: string): Date | null => {\n if (!dateString || !/^\\d{4}-\\d{2}-\\d{2}$/.test(dateString)) {\n return null\n }\n\n const parts = dateString.split('-')\n if (parts.length !== 3) {\n return null\n }\n\n const numbers = parts.map(Number)\n const year = numbers[0]\n const month = numbers[1]\n const day = numbers[2]\n if (year === undefined || month === undefined || day === undefined) {\n return null\n }\n\n // Validate date components\n if (isNaN(year) || isNaN(month) || isNaN(day) || month < 1 || month > 12 || day < 1 || day > 31) {\n return null\n }\n\n // Create Date in local timezone (month is 0-indexed)\n return new Date(year, month - 1, day)\n}\n\n/**\n * Normalizes Date to local midnight, handling timezone issues from any adapter.\n */\nexport const normalizeDateToLocal = (date: Date | null): Date | null => {\n if (!date || isNaN(date.getTime())) {\n return null\n }\n\n // Use ISO string to get the intended date, then parse components\n const isoString = date.toISOString()\n const [datePart] = isoString.split('T')\n if (!datePart) return null\n\n const parts = datePart.split('-')\n if (parts.length !== 3) return null\n const numbers = parts.map(Number)\n const year = numbers[0]!\n const month = numbers[1]!\n const day = numbers[2]!\n if (isNaN(year) || isNaN(month) || isNaN(day) || month < 1 || month > 12 || day < 1 || day > 31) {\n return null\n }\n\n return new Date(year, month - 1, day)\n}\n"],"names":["formatDateNamedWeekdayShortPlusDate","date","locale","parsedDate","parseDateStringToLocal","formatDateTimeWithTimezone","time","dateString","formatDateToStringDate","parts","numbers","year","month","day","normalizeDateToLocal","isoString","datePart"],"mappings":"AAAO,MAAMA,IAAsC,CAACC,GAAeC,MAAoB;AACrF,MAAI,CAACD,EAAM,QAAO;AAClB,QAAME,IAAaC,EAAuBH,CAAI;AAC9C,SAAKE,IACEA,EAAW,mBAAmBD,GAAQ;AAAA,IAC3C,SAAS;AAAA,IACT,OAAO;AAAA,IACP,KAAK;AAAA,EAAA,CACN,IALuB;AAM1B,GAEaG,IAA6B,CAACJ,GAAsBC,MAAoB;AACnF,MAAI,CAACD,EAAM,QAAO,EAAE,MAAM,IAAI,MAAM,GAAA;AACpC,QAAME,IAAa,OAAOF,KAAS,WAAW,IAAI,KAAKA,CAAI,IAAIA;AAC/D,MAAI,MAAME,EAAW,SAAS,UAAU,EAAE,MAAM,IAAI,MAAM,GAAA;AAE1D,QAAMG,IAAOH,EAAW,mBAAmBD,GAAQ;AAAA,IACjD,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,cAAc;AAAA,EAAA,CACf,GAEKK,IAAaJ,EAAW,mBAAmBD,GAAQ;AAAA,IACvD,SAAS;AAAA,IACT,OAAO;AAAA,IACP,KAAK;AAAA,EAAA,CACN;AAED,SAAO,EAAE,MAAAI,GAAM,MAAMC,EAAA;AACvB,GAEaC,IAAyB,CAACP,MAEjC,MAAMA,EAAK,QAAA,CAAS,IACf,OAEFA,EAAK,YAAA,EAAc,MAAM,GAAG,EAAE,CAAC,GAM3BG,IAAyB,CAACG,MAAoC;AACzE,MAAI,CAACA,KAAc,CAAC,sBAAsB,KAAKA,CAAU;AACvD,WAAO;AAGT,QAAME,IAAQF,EAAW,MAAM,GAAG;AAClC,MAAIE,EAAM,WAAW;AACnB,WAAO;AAGT,QAAMC,IAAUD,EAAM,IAAI,MAAM,GAC1BE,IAAOD,EAAQ,CAAC,GAChBE,IAAQF,EAAQ,CAAC,GACjBG,IAAMH,EAAQ,CAAC;AAMrB,SALIC,MAAS,UAAaC,MAAU,UAAaC,MAAQ,UAKrD,MAAMF,CAAI,KAAK,MAAMC,CAAK,KAAK,MAAMC,CAAG,KAAKD,IAAQ,KAAKA,IAAQ,MAAMC,IAAM,KAAKA,IAAM,KACpF,OAIF,IAAI,KAAKF,GAAMC,IAAQ,GAAGC,CAAG;AACtC,GAKaC,IAAuB,CAACb,MAAmC;AACtE,MAAI,CAACA,KAAQ,MAAMA,EAAK,QAAA,CAAS;AAC/B,WAAO;AAIT,QAAMc,IAAYd,EAAK,YAAA,GACjB,CAACe,CAAQ,IAAID,EAAU,MAAM,GAAG;AACtC,MAAI,CAACC,EAAU,QAAO;AAEtB,QAAMP,IAAQO,EAAS,MAAM,GAAG;AAChC,MAAIP,EAAM,WAAW,EAAG,QAAO;AAC/B,QAAMC,IAAUD,EAAM,IAAI,MAAM,GAC1BE,IAAOD,EAAQ,CAAC,GAChBE,IAAQF,EAAQ,CAAC,GACjBG,IAAMH,EAAQ,CAAC;AACrB,SAAI,MAAMC,CAAI,KAAK,MAAMC,CAAK,KAAK,MAAMC,CAAG,KAAKD,IAAQ,KAAKA,IAAQ,MAAMC,IAAM,KAAKA,IAAM,KACpF,OAGF,IAAI,KAAKF,GAAMC,IAAQ,GAAGC,CAAG;AACtC;"}
1
+ {"version":3,"file":"dateFormatting.js","sources":["../../src/helpers/dateFormatting.ts"],"sourcesContent":["/**\n * Normalizes any date input (string, Date, or undefined) to a Date object.\n * Handles YYYY-MM-DD strings by parsing them in local timezone to avoid timezone issues.\n * Also handles ISO timestamp strings for compatibility.\n * Returns null for invalid inputs.\n */\nconst normalizeToDate = (dateInput?: string | Date | null): Date | null => {\n if (!dateInput) return null\n\n if (typeof dateInput === 'string') {\n if (/^\\d{4}-\\d{2}-\\d{2}$/.test(dateInput)) {\n const parts = dateInput.split('-')\n if (parts.length !== 3) return null\n\n const numbers = parts.map(Number)\n const year = numbers[0]\n const month = numbers[1]\n const day = numbers[2]\n if (year === undefined || month === undefined || day === undefined) {\n return null\n }\n\n if (\n isNaN(year) ||\n isNaN(month) ||\n isNaN(day) ||\n month < 1 ||\n month > 12 ||\n day < 1 ||\n day > 31\n ) {\n return null\n }\n\n return new Date(year, month - 1, day)\n }\n\n const parsedDate = new Date(dateInput)\n return isNaN(parsedDate.getTime()) ? null : parsedDate\n }\n\n if (dateInput instanceof Date) {\n return isNaN(dateInput.getTime()) ? null : dateInput\n }\n\n return null\n}\n\n/**\n * Creates a date formatter function that handles both string and Date inputs.\n */\nconst createDateFormatter =\n (options: Intl.DateTimeFormatOptions) =>\n (dateInput?: string | Date | null, locale?: string): string => {\n const date = normalizeToDate(dateInput)\n if (!date) return ''\n return date.toLocaleDateString(locale, options)\n }\n\nexport const formatDateShortWithWeekday = createDateFormatter({\n weekday: 'short',\n month: 'short',\n day: 'numeric',\n})\n\nexport const formatDateShortWithWeekdayAndYear = createDateFormatter({\n weekday: 'short',\n month: 'short',\n day: 'numeric',\n year: 'numeric',\n})\n\nexport const formatDateShort = createDateFormatter({\n month: 'short',\n day: 'numeric',\n})\n\nexport const formatDateShortWithYear = createDateFormatter({\n month: 'short',\n day: 'numeric',\n year: 'numeric',\n})\n\nexport const formatDateLong = createDateFormatter({\n month: 'long',\n day: 'numeric',\n})\n\nexport const formatDateLongWithYear = createDateFormatter({\n month: 'long',\n day: 'numeric',\n year: 'numeric',\n})\n\nexport const formatDateWithTime = (\n dateInput?: string | Date | null,\n locale?: string,\n): { time: string; date: string } => {\n const date = normalizeToDate(dateInput)\n if (!date) return { time: '', date: '' }\n\n const time = date.toLocaleTimeString(locale, {\n hour: 'numeric',\n minute: '2-digit',\n hour12: true,\n timeZoneName: 'short',\n })\n\n const dateString = date.toLocaleDateString(locale, {\n weekday: 'short',\n month: 'short',\n day: 'numeric',\n })\n\n return { time, date: dateString }\n}\n\nexport const formatPayPeriod = (\n startDateInput?: string | Date | null,\n endDateInput?: string | Date | null,\n locale?: string,\n): { startDate: string; endDate: string } => {\n const startDate = normalizeToDate(startDateInput)\n const endDate = normalizeToDate(endDateInput)\n\n if (!startDate || !endDate) {\n return { startDate: '', endDate: '' }\n }\n\n const startFormatted = startDate.toLocaleDateString(locale, {\n month: 'long',\n day: 'numeric',\n })\n\n const endFormatted = endDate.toLocaleDateString(locale, {\n month: 'short',\n day: 'numeric',\n year: 'numeric',\n })\n\n return { startDate: startFormatted, endDate: endFormatted }\n}\n\nexport const formatPayPeriodRange = (\n startDateInput?: string | Date | null,\n endDateInput?: string | Date | null,\n locale?: string,\n options?: { useShortMonth?: boolean },\n): string => {\n const startDate = normalizeToDate(startDateInput)\n const endDate = normalizeToDate(endDateInput)\n\n if (!startDate || !endDate) return ''\n\n const monthFormat = options?.useShortMonth ? 'short' : 'long'\n\n const startFormatted = startDate.toLocaleDateString(locale, {\n month: monthFormat,\n day: 'numeric',\n })\n\n const endFormatted = endDate.toLocaleDateString(locale, {\n month: monthFormat,\n day: 'numeric',\n year: 'numeric',\n })\n\n return `${startFormatted}–${endFormatted}`\n}\n\nexport const formatDateToStringDate = (date: Date): string | null => {\n if (isNaN(date.getTime())) {\n return null\n }\n return date.toISOString().split('T')[0] || null\n}\n\n/**\n * Normalizes Date to local midnight, handling timezone issues from any adapter.\n */\nexport const normalizeDateToLocal = (date: Date | null): Date | null => {\n if (!date || isNaN(date.getTime())) {\n return null\n }\n\n const isoString = date.toISOString()\n const [datePart] = isoString.split('T')\n if (!datePart) return null\n\n const parts = datePart.split('-')\n if (parts.length !== 3) return null\n const numbers = parts.map(Number)\n const year = numbers[0]!\n const month = numbers[1]!\n const day = numbers[2]!\n if (isNaN(year) || isNaN(month) || isNaN(day) || month < 1 || month > 12 || day < 1 || day > 31) {\n return null\n }\n\n return new Date(year, month - 1, day)\n}\n"],"names":["normalizeToDate","dateInput","parts","numbers","year","month","day","parsedDate","createDateFormatter","options","locale","date","formatDateShortWithWeekday","formatDateShortWithWeekdayAndYear","formatDateShort","formatDateShortWithYear","formatDateLong","formatDateLongWithYear","formatDateWithTime","time","dateString","formatPayPeriod","startDateInput","endDateInput","startDate","endDate","startFormatted","endFormatted","formatPayPeriodRange","monthFormat","formatDateToStringDate","normalizeDateToLocal","isoString","datePart"],"mappings":"AAMA,MAAMA,IAAkB,CAACC,MAAkD;AACzE,MAAI,CAACA,EAAW,QAAO;AAEvB,MAAI,OAAOA,KAAc,UAAU;AACjC,QAAI,sBAAsB,KAAKA,CAAS,GAAG;AACzC,YAAMC,IAAQD,EAAU,MAAM,GAAG;AACjC,UAAIC,EAAM,WAAW,EAAG,QAAO;AAE/B,YAAMC,IAAUD,EAAM,IAAI,MAAM,GAC1BE,IAAOD,EAAQ,CAAC,GAChBE,IAAQF,EAAQ,CAAC,GACjBG,IAAMH,EAAQ,CAAC;AAKrB,aAJIC,MAAS,UAAaC,MAAU,UAAaC,MAAQ,UAKvD,MAAMF,CAAI,KACV,MAAMC,CAAK,KACX,MAAMC,CAAG,KACTD,IAAQ,KACRA,IAAQ,MACRC,IAAM,KACNA,IAAM,KAEC,OAGF,IAAI,KAAKF,GAAMC,IAAQ,GAAGC,CAAG;AAAA,IACtC;AAEA,UAAMC,IAAa,IAAI,KAAKN,CAAS;AACrC,WAAO,MAAMM,EAAW,QAAA,CAAS,IAAI,OAAOA;AAAA,EAC9C;AAEA,SAAIN,aAAqB,OAChB,MAAMA,EAAU,QAAA,CAAS,IAAI,OAAOA,IAGtC;AACT,GAKMO,IACJ,CAACC,MACD,CAACR,GAAkCS,MAA4B;AAC7D,QAAMC,IAAOX,EAAgBC,CAAS;AACtC,SAAKU,IACEA,EAAK,mBAAmBD,GAAQD,CAAO,IAD5B;AAEpB,GAEWG,IAA6BJ,EAAoB;AAAA,EAC5D,SAAS;AAAA,EACT,OAAO;AAAA,EACP,KAAK;AACP,CAAC,GAEYK,IAAoCL,EAAoB;AAAA,EACnE,SAAS;AAAA,EACT,OAAO;AAAA,EACP,KAAK;AAAA,EACL,MAAM;AACR,CAAC,GAEYM,IAAkBN,EAAoB;AAAA,EACjD,OAAO;AAAA,EACP,KAAK;AACP,CAAC,GAEYO,IAA0BP,EAAoB;AAAA,EACzD,OAAO;AAAA,EACP,KAAK;AAAA,EACL,MAAM;AACR,CAAC,GAEYQ,IAAiBR,EAAoB;AAAA,EAChD,OAAO;AAAA,EACP,KAAK;AACP,CAAC,GAEYS,IAAyBT,EAAoB;AAAA,EACxD,OAAO;AAAA,EACP,KAAK;AAAA,EACL,MAAM;AACR,CAAC,GAEYU,IAAqB,CAChCjB,GACAS,MACmC;AACnC,QAAMC,IAAOX,EAAgBC,CAAS;AACtC,MAAI,CAACU,EAAM,QAAO,EAAE,MAAM,IAAI,MAAM,GAAA;AAEpC,QAAMQ,IAAOR,EAAK,mBAAmBD,GAAQ;AAAA,IAC3C,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,cAAc;AAAA,EAAA,CACf,GAEKU,IAAaT,EAAK,mBAAmBD,GAAQ;AAAA,IACjD,SAAS;AAAA,IACT,OAAO;AAAA,IACP,KAAK;AAAA,EAAA,CACN;AAED,SAAO,EAAE,MAAAS,GAAM,MAAMC,EAAA;AACvB,GAEaC,IAAkB,CAC7BC,GACAC,GACAb,MAC2C;AAC3C,QAAMc,IAAYxB,EAAgBsB,CAAc,GAC1CG,IAAUzB,EAAgBuB,CAAY;AAE5C,MAAI,CAACC,KAAa,CAACC;AACjB,WAAO,EAAE,WAAW,IAAI,SAAS,GAAA;AAGnC,QAAMC,IAAiBF,EAAU,mBAAmBd,GAAQ;AAAA,IAC1D,OAAO;AAAA,IACP,KAAK;AAAA,EAAA,CACN,GAEKiB,IAAeF,EAAQ,mBAAmBf,GAAQ;AAAA,IACtD,OAAO;AAAA,IACP,KAAK;AAAA,IACL,MAAM;AAAA,EAAA,CACP;AAED,SAAO,EAAE,WAAWgB,GAAgB,SAASC,EAAA;AAC/C,GAEaC,IAAuB,CAClCN,GACAC,GACAb,GACAD,MACW;AACX,QAAMe,IAAYxB,EAAgBsB,CAAc,GAC1CG,IAAUzB,EAAgBuB,CAAY;AAE5C,MAAI,CAACC,KAAa,CAACC,EAAS,QAAO;AAEnC,QAAMI,IAAcpB,GAAS,gBAAgB,UAAU,QAEjDiB,IAAiBF,EAAU,mBAAmBd,GAAQ;AAAA,IAC1D,OAAOmB;AAAA,IACP,KAAK;AAAA,EAAA,CACN,GAEKF,IAAeF,EAAQ,mBAAmBf,GAAQ;AAAA,IACtD,OAAOmB;AAAA,IACP,KAAK;AAAA,IACL,MAAM;AAAA,EAAA,CACP;AAED,SAAO,GAAGH,CAAc,IAAIC,CAAY;AAC1C,GAEaG,IAAyB,CAACnB,MACjC,MAAMA,EAAK,QAAA,CAAS,IACf,OAEFA,EAAK,cAAc,MAAM,GAAG,EAAE,CAAC,KAAK,MAMhCoB,IAAuB,CAACpB,MAAmC;AACtE,MAAI,CAACA,KAAQ,MAAMA,EAAK,QAAA,CAAS;AAC/B,WAAO;AAGT,QAAMqB,IAAYrB,EAAK,YAAA,GACjB,CAACsB,CAAQ,IAAID,EAAU,MAAM,GAAG;AACtC,MAAI,CAACC,EAAU,QAAO;AAEtB,QAAM/B,IAAQ+B,EAAS,MAAM,GAAG;AAChC,MAAI/B,EAAM,WAAW,EAAG,QAAO;AAC/B,QAAMC,IAAUD,EAAM,IAAI,MAAM,GAC1BE,IAAOD,EAAQ,CAAC,GAChBE,IAAQF,EAAQ,CAAC,GACjBG,IAAMH,EAAQ,CAAC;AACrB,SAAI,MAAMC,CAAI,KAAK,MAAMC,CAAK,KAAK,MAAMC,CAAG,KAAKD,IAAQ,KAAKA,IAAQ,MAAMC,IAAM,KAAKA,IAAM,KACpF,OAGF,IAAI,KAAKF,GAAMC,IAAQ,GAAGC,CAAG;AACtC;"}
@@ -1,20 +1,19 @@
1
1
  import m from "dompurify";
2
2
  import "react-i18next";
3
3
  import "react";
4
- import "../contexts/LocaleProvider/useLocale.js";
5
- const c = (t) => t.charAt(0).toLocaleUpperCase() + t.slice(1), h = ({
4
+ const c = (t) => t.charAt(0).toLocaleUpperCase() + t.slice(1), l = ({
6
5
  first_name: t,
7
6
  last_name: e
8
7
  }) => `${t ? c(t) : ""}${e ? n(c(e)) : ""}`, n = (t) => t ? ` ${t}` : "", i = (t) => {
9
8
  const e = n(t.street1), r = n(t.street2);
10
9
  return `${e},${r}`;
11
- }, u = (t) => `${n(t.city)}, ${n(t.state)} ${n(t.zip)}`, C = (t) => `${i(t)} ${u(t)}`, p = (t, e) => e ? `${t}%` : `$${t}`, s = (t, e = "en-US") => {
10
+ }, u = (t) => `${n(t.city)}, ${n(t.state)} ${n(t.zip)}`, h = (t) => `${i(t)} ${u(t)}`, p = (t, e) => e ? `${t}%` : `$${t}`, s = (t, e = "en-US") => {
12
11
  const r = t.toLocaleString(e, {
13
12
  minimumFractionDigits: 2,
14
13
  maximumFractionDigits: 2
15
14
  });
16
15
  return p(r, !1);
17
- }, S = ({
16
+ }, C = ({
18
17
  rate: t,
19
18
  paymentUnit: e,
20
19
  t: r,
@@ -42,20 +41,20 @@ const c = (t) => t.charAt(0).toLocaleUpperCase() + t.slice(1), h = ({
42
41
  return o;
43
42
  }
44
43
  }, y = { ALLOWED_TAGS: ["a", "b", "strong"], ALLOWED_ATTR: ["href", "target"] };
45
- function D(t) {
44
+ function S(t) {
46
45
  return t ? { __html: m.sanitize(t, y) } : { __html: "" };
47
46
  }
48
- const F = (t) => t.replace(/\D/g, ""), L = (t) => t.replace(/_([a-z])/g, (e, r) => r.toUpperCase());
47
+ const D = (t) => t.replace(/\D/g, ""), F = (t) => t.replace(/_([a-z])/g, (e, r) => r.toUpperCase());
49
48
  export {
50
- C as addressInline,
49
+ h as addressInline,
51
50
  p as amountStr,
52
- D as createMarkup,
53
- h as firstLastName,
51
+ S as createMarkup,
52
+ l as firstLastName,
54
53
  s as formatNumberAsCurrency,
55
- S as formatPayRate,
54
+ C as formatPayRate,
56
55
  u as getCityStateZip,
57
56
  i as getStreet,
58
- F as removeNonDigits,
59
- L as snakeCaseToCamelCase
57
+ D as removeNonDigits,
58
+ F as snakeCaseToCamelCase
60
59
  };
61
60
  //# sourceMappingURL=formattedStrings.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"formattedStrings.js","sources":["../../src/helpers/formattedStrings.ts"],"sourcesContent":["import DOMPurify from 'dompurify'\nimport { type Location } from '@gusto/embedded-api/models/components/location'\nimport { type EmployeeAddress } from '@gusto/embedded-api/models/components/employeeaddress'\nimport { type TFunction } from 'i18next'\nimport { useTranslation } from 'react-i18next'\nimport { useCallback } from 'react'\nimport { useLocale } from '@/contexts/LocaleProvider/useLocale'\n\nconst capitalize = (word: string) => word.charAt(0).toLocaleUpperCase() + word.slice(1)\n\nexport const firstLastName = ({\n first_name,\n last_name,\n}: {\n first_name?: string | null\n last_name?: string | null\n}) =>\n `${first_name ? capitalize(first_name) : ''}${last_name ? maybeString(capitalize(last_name)) : ''}`\n\nconst maybeString = (str: string | null | undefined) => {\n return str ? ` ${str}` : ''\n}\n\nexport const getStreet = (address: EmployeeAddress | Location) => {\n const street1 = maybeString(address.street1)\n const street2 = maybeString(address.street2)\n\n return `${street1},${street2}`\n}\n\nexport const getCityStateZip = (address: EmployeeAddress | Location) =>\n `${maybeString(address.city)}, ${maybeString(address.state)} ${maybeString(address.zip)}`\n\nexport const addressInline = (address: EmployeeAddress | Location) =>\n `${getStreet(address)} ${getCityStateZip(address)}`\n\nexport const currentDateString = () => {\n const d = new Date()\n const dateString = `${String(d.getFullYear())}-${('0' + String(d.getMonth() + 1)).slice(-2)}-${('0' + String(d.getDate())).slice(-2)}`\n return dateString\n}\n\nexport function isNumberKey({ which, keyCode }: KeyboardEvent) {\n const charCode = which ? which : keyCode\n if (charCode > 31 && charCode != 46 && (charCode < 48 || charCode > 57)) return false\n return true\n}\n\nexport const booleanToString = (value: boolean) => (value ? 'true' : 'false')\n\nexport const amountStr = (amount: string, isPercentage: boolean) =>\n isPercentage ? `${amount}%` : `$${amount}`\n\nexport const formatNumberAsCurrency = (amount: number, locale: string = 'en-US') => {\n const formattedNumber = amount.toLocaleString(locale, {\n minimumFractionDigits: 2,\n maximumFractionDigits: 2,\n })\n return amountStr(formattedNumber, false)\n}\n\nexport const formatPayRate = ({\n rate,\n paymentUnit,\n t,\n locale = 'en-US',\n}: {\n rate: number\n paymentUnit: string\n t: TFunction\n locale?: string\n}) => {\n const amount = formatNumberAsCurrency(rate, locale)\n\n switch (paymentUnit) {\n case 'Hour':\n return t('payRateFormats.hourly', { amount, ns: 'common' })\n case 'Week':\n return t('payRateFormats.weekly', {\n amount: formatNumberAsCurrency(rate * 52, locale),\n ns: 'common',\n })\n case 'Month':\n return t('payRateFormats.monthly', {\n amount: formatNumberAsCurrency(rate * 12, locale),\n ns: 'common',\n })\n case 'Year':\n return t('payRateFormats.yearly', { amount, ns: 'common' })\n case 'Paycheck':\n return t('payRateFormats.paycheck', { amount, ns: 'common' })\n default:\n return amount\n }\n}\n\nexport const useFormatPayRate = () => {\n const { t } = useTranslation('common')\n const { locale } = useLocale()\n\n return useCallback(\n (rate: number, paymentUnit: string) => {\n return formatPayRate({ rate, paymentUnit, t, locale })\n },\n [t, locale],\n )\n}\n\nconst dompurifyConfig = { ALLOWED_TAGS: ['a', 'b', 'strong'], ALLOWED_ATTR: ['href', 'target'] }\nexport function createMarkup(dirty: string) {\n if (!dirty) return { __html: '' }\n return { __html: DOMPurify.sanitize(dirty, dompurifyConfig) }\n}\n\nexport const removeNonDigits = (value: string): string => {\n return value.replace(/\\D/g, '')\n}\n\nexport const snakeCaseToCamelCase = (s: string) => {\n return s.replace(/_([a-z])/g, (_: string, char: string) => char.toUpperCase())\n}\n\nexport const camelCaseToSnakeCase = (s: string) => {\n return s\n .replace(\n /([a-z0-9])([A-Z])/g,\n (_: string, group1: string, group2: string) => `${group1}_${group2.toLowerCase()}`,\n )\n .replace(\n /([A-Z])([A-Z])(?=[a-z])/g,\n (_: string, group1: string, group2: string) =>\n `${group1.toLowerCase()}_${group2.toLowerCase()}`,\n )\n .toLowerCase()\n}\n"],"names":["capitalize","word","firstLastName","first_name","last_name","maybeString","str","getStreet","address","street1","street2","getCityStateZip","addressInline","amountStr","amount","isPercentage","formatNumberAsCurrency","locale","formattedNumber","formatPayRate","rate","paymentUnit","t","dompurifyConfig","createMarkup","dirty","DOMPurify","removeNonDigits","value","snakeCaseToCamelCase","s","_","char"],"mappings":";;;;AAQA,MAAMA,IAAa,CAACC,MAAiBA,EAAK,OAAO,CAAC,EAAE,sBAAsBA,EAAK,MAAM,CAAC,GAEzEC,IAAgB,CAAC;AAAA,EAC5B,YAAAC;AAAA,EACA,WAAAC;AACF,MAIE,GAAGD,IAAaH,EAAWG,CAAU,IAAI,EAAE,GAAGC,IAAYC,EAAYL,EAAWI,CAAS,CAAC,IAAI,EAAE,IAE7FC,IAAc,CAACC,MACZA,IAAM,IAAIA,CAAG,KAAK,IAGdC,IAAY,CAACC,MAAwC;AAChE,QAAMC,IAAUJ,EAAYG,EAAQ,OAAO,GACrCE,IAAUL,EAAYG,EAAQ,OAAO;AAE3C,SAAO,GAAGC,CAAO,IAAIC,CAAO;AAC9B,GAEaC,IAAkB,CAACH,MAC9B,GAAGH,EAAYG,EAAQ,IAAI,CAAC,KAAKH,EAAYG,EAAQ,KAAK,CAAC,IAAIH,EAAYG,EAAQ,GAAG,CAAC,IAE5EI,IAAgB,CAACJ,MAC5B,GAAGD,EAAUC,CAAO,CAAC,IAAIG,EAAgBH,CAAO,CAAC,IAgBtCK,IAAY,CAACC,GAAgBC,MACxCA,IAAe,GAAGD,CAAM,MAAM,IAAIA,CAAM,IAE7BE,IAAyB,CAACF,GAAgBG,IAAiB,YAAY;AAClF,QAAMC,IAAkBJ,EAAO,eAAeG,GAAQ;AAAA,IACpD,uBAAuB;AAAA,IACvB,uBAAuB;AAAA,EAAA,CACxB;AACD,SAAOJ,EAAUK,GAAiB,EAAK;AACzC,GAEaC,IAAgB,CAAC;AAAA,EAC5B,MAAAC;AAAA,EACA,aAAAC;AAAA,EACA,GAAAC;AAAA,EACA,QAAAL,IAAS;AACX,MAKM;AACJ,QAAMH,IAASE,EAAuBI,GAAMH,CAAM;AAElD,UAAQI,GAAA;AAAA,IACN,KAAK;AACH,aAAOC,EAAE,yBAAyB,EAAE,QAAAR,GAAQ,IAAI,UAAU;AAAA,IAC5D,KAAK;AACH,aAAOQ,EAAE,yBAAyB;AAAA,QAChC,QAAQN,EAAuBI,IAAO,IAAIH,CAAM;AAAA,QAChD,IAAI;AAAA,MAAA,CACL;AAAA,IACH,KAAK;AACH,aAAOK,EAAE,0BAA0B;AAAA,QACjC,QAAQN,EAAuBI,IAAO,IAAIH,CAAM;AAAA,QAChD,IAAI;AAAA,MAAA,CACL;AAAA,IACH,KAAK;AACH,aAAOK,EAAE,yBAAyB,EAAE,QAAAR,GAAQ,IAAI,UAAU;AAAA,IAC5D,KAAK;AACH,aAAOQ,EAAE,2BAA2B,EAAE,QAAAR,GAAQ,IAAI,UAAU;AAAA,IAC9D;AACE,aAAOA;AAAA,EAAA;AAEb,GAcMS,IAAkB,EAAE,cAAc,CAAC,KAAK,KAAK,QAAQ,GAAG,cAAc,CAAC,QAAQ,QAAQ,EAAA;AACtF,SAASC,EAAaC,GAAe;AAC1C,SAAKA,IACE,EAAE,QAAQC,EAAU,SAASD,GAAOF,CAAe,EAAA,IADvC,EAAE,QAAQ,GAAA;AAE/B;AAEO,MAAMI,IAAkB,CAACC,MACvBA,EAAM,QAAQ,OAAO,EAAE,GAGnBC,IAAuB,CAACC,MAC5BA,EAAE,QAAQ,aAAa,CAACC,GAAWC,MAAiBA,EAAK,aAAa;"}
1
+ {"version":3,"file":"formattedStrings.js","sources":["../../src/helpers/formattedStrings.ts"],"sourcesContent":["import DOMPurify from 'dompurify'\nimport { type Location } from '@gusto/embedded-api/models/components/location'\nimport { type EmployeeAddress } from '@gusto/embedded-api/models/components/employeeaddress'\nimport { type TFunction } from 'i18next'\nimport { useTranslation } from 'react-i18next'\nimport { useCallback } from 'react'\nimport { useLocale } from '@/contexts/LocaleProvider/useLocale'\n\nconst capitalize = (word: string) => word.charAt(0).toLocaleUpperCase() + word.slice(1)\n\nexport const firstLastName = ({\n first_name,\n last_name,\n}: {\n first_name?: string | null\n last_name?: string | null\n}) =>\n `${first_name ? capitalize(first_name) : ''}${last_name ? maybeString(capitalize(last_name)) : ''}`\n\nconst maybeString = (str: string | null | undefined) => {\n return str ? ` ${str}` : ''\n}\n\nexport const getStreet = (address: EmployeeAddress | Location) => {\n const street1 = maybeString(address.street1)\n const street2 = maybeString(address.street2)\n\n return `${street1},${street2}`\n}\n\nexport const getCityStateZip = (address: EmployeeAddress | Location) =>\n `${maybeString(address.city)}, ${maybeString(address.state)} ${maybeString(address.zip)}`\n\nexport const addressInline = (address: EmployeeAddress | Location) =>\n `${getStreet(address)} ${getCityStateZip(address)}`\n\nexport const currentDateString = () => {\n const d = new Date()\n const dateString = `${String(d.getFullYear())}-${('0' + String(d.getMonth() + 1)).slice(-2)}-${('0' + String(d.getDate())).slice(-2)}`\n return dateString\n}\n\nexport function isNumberKey({ which, keyCode }: KeyboardEvent) {\n const charCode = which ? which : keyCode\n if (charCode > 31 && charCode != 46 && (charCode < 48 || charCode > 57)) return false\n return true\n}\n\nexport const booleanToString = (value: boolean) => (value ? 'true' : 'false')\n\nexport const amountStr = (amount: string, isPercentage: boolean) =>\n isPercentage ? `${amount}%` : `$${amount}`\n\nexport const formatNumberAsCurrency = (amount: number, locale: string = 'en-US') => {\n const formattedNumber = amount.toLocaleString(locale, {\n minimumFractionDigits: 2,\n maximumFractionDigits: 2,\n })\n return amountStr(formattedNumber, false)\n}\n\nexport const formatPayRate = ({\n rate,\n paymentUnit,\n t,\n locale = 'en-US',\n}: {\n rate: number\n paymentUnit: string\n t: TFunction\n locale?: string\n}) => {\n const amount = formatNumberAsCurrency(rate, locale)\n\n switch (paymentUnit) {\n case 'Hour':\n return t('payRateFormats.hourly', { amount, ns: 'common' })\n case 'Week':\n return t('payRateFormats.weekly', {\n amount: formatNumberAsCurrency(rate * 52, locale),\n ns: 'common',\n })\n case 'Month':\n return t('payRateFormats.monthly', {\n amount: formatNumberAsCurrency(rate * 12, locale),\n ns: 'common',\n })\n case 'Year':\n return t('payRateFormats.yearly', { amount, ns: 'common' })\n case 'Paycheck':\n return t('payRateFormats.paycheck', { amount, ns: 'common' })\n default:\n return amount\n }\n}\n\nexport const useFormatPayRate = () => {\n const { t } = useTranslation('common')\n const { locale } = useLocale()\n\n return useCallback(\n (rate: number, paymentUnit: string) => {\n return formatPayRate({ rate, paymentUnit, t, locale })\n },\n [t, locale],\n )\n}\n\nconst dompurifyConfig = { ALLOWED_TAGS: ['a', 'b', 'strong'], ALLOWED_ATTR: ['href', 'target'] }\nexport function createMarkup(dirty: string) {\n if (!dirty) return { __html: '' }\n return { __html: DOMPurify.sanitize(dirty, dompurifyConfig) }\n}\n\nexport const removeNonDigits = (value: string): string => {\n return value.replace(/\\D/g, '')\n}\n\nexport const snakeCaseToCamelCase = (s: string) => {\n return s.replace(/_([a-z])/g, (_: string, char: string) => char.toUpperCase())\n}\n\nexport const camelCaseToSnakeCase = (s: string) => {\n return s\n .replace(\n /([a-z0-9])([A-Z])/g,\n (_: string, group1: string, group2: string) => `${group1}_${group2.toLowerCase()}`,\n )\n .replace(\n /([A-Z])([A-Z])(?=[a-z])/g,\n (_: string, group1: string, group2: string) =>\n `${group1.toLowerCase()}_${group2.toLowerCase()}`,\n )\n .toLowerCase()\n}\n"],"names":["capitalize","word","firstLastName","first_name","last_name","maybeString","str","getStreet","address","street1","street2","getCityStateZip","addressInline","amountStr","amount","isPercentage","formatNumberAsCurrency","locale","formattedNumber","formatPayRate","rate","paymentUnit","t","dompurifyConfig","createMarkup","dirty","DOMPurify","removeNonDigits","value","snakeCaseToCamelCase","s","_","char"],"mappings":";;;AAQA,MAAMA,IAAa,CAACC,MAAiBA,EAAK,OAAO,CAAC,EAAE,sBAAsBA,EAAK,MAAM,CAAC,GAEzEC,IAAgB,CAAC;AAAA,EAC5B,YAAAC;AAAA,EACA,WAAAC;AACF,MAIE,GAAGD,IAAaH,EAAWG,CAAU,IAAI,EAAE,GAAGC,IAAYC,EAAYL,EAAWI,CAAS,CAAC,IAAI,EAAE,IAE7FC,IAAc,CAACC,MACZA,IAAM,IAAIA,CAAG,KAAK,IAGdC,IAAY,CAACC,MAAwC;AAChE,QAAMC,IAAUJ,EAAYG,EAAQ,OAAO,GACrCE,IAAUL,EAAYG,EAAQ,OAAO;AAE3C,SAAO,GAAGC,CAAO,IAAIC,CAAO;AAC9B,GAEaC,IAAkB,CAACH,MAC9B,GAAGH,EAAYG,EAAQ,IAAI,CAAC,KAAKH,EAAYG,EAAQ,KAAK,CAAC,IAAIH,EAAYG,EAAQ,GAAG,CAAC,IAE5EI,IAAgB,CAACJ,MAC5B,GAAGD,EAAUC,CAAO,CAAC,IAAIG,EAAgBH,CAAO,CAAC,IAgBtCK,IAAY,CAACC,GAAgBC,MACxCA,IAAe,GAAGD,CAAM,MAAM,IAAIA,CAAM,IAE7BE,IAAyB,CAACF,GAAgBG,IAAiB,YAAY;AAClF,QAAMC,IAAkBJ,EAAO,eAAeG,GAAQ;AAAA,IACpD,uBAAuB;AAAA,IACvB,uBAAuB;AAAA,EAAA,CACxB;AACD,SAAOJ,EAAUK,GAAiB,EAAK;AACzC,GAEaC,IAAgB,CAAC;AAAA,EAC5B,MAAAC;AAAA,EACA,aAAAC;AAAA,EACA,GAAAC;AAAA,EACA,QAAAL,IAAS;AACX,MAKM;AACJ,QAAMH,IAASE,EAAuBI,GAAMH,CAAM;AAElD,UAAQI,GAAA;AAAA,IACN,KAAK;AACH,aAAOC,EAAE,yBAAyB,EAAE,QAAAR,GAAQ,IAAI,UAAU;AAAA,IAC5D,KAAK;AACH,aAAOQ,EAAE,yBAAyB;AAAA,QAChC,QAAQN,EAAuBI,IAAO,IAAIH,CAAM;AAAA,QAChD,IAAI;AAAA,MAAA,CACL;AAAA,IACH,KAAK;AACH,aAAOK,EAAE,0BAA0B;AAAA,QACjC,QAAQN,EAAuBI,IAAO,IAAIH,CAAM;AAAA,QAChD,IAAI;AAAA,MAAA,CACL;AAAA,IACH,KAAK;AACH,aAAOK,EAAE,yBAAyB,EAAE,QAAAR,GAAQ,IAAI,UAAU;AAAA,IAC5D,KAAK;AACH,aAAOQ,EAAE,2BAA2B,EAAE,QAAAR,GAAQ,IAAI,UAAU;AAAA,IAC9D;AACE,aAAOA;AAAA,EAAA;AAEb,GAcMS,IAAkB,EAAE,cAAc,CAAC,KAAK,KAAK,QAAQ,GAAG,cAAc,CAAC,QAAQ,QAAQ,EAAA;AACtF,SAASC,EAAaC,GAAe;AAC1C,SAAKA,IACE,EAAE,QAAQC,EAAU,SAASD,GAAOF,CAAe,EAAA,IADvC,EAAE,QAAQ,GAAA;AAE/B;AAEO,MAAMI,IAAkB,CAACC,MACvBA,EAAM,QAAQ,OAAO,EAAE,GAGnBC,IAAuB,CAACC,MAC5BA,EAAE,QAAQ,aAAa,CAACC,GAAWC,MAAiBA,EAAK,aAAa;"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAsyncError.js","sources":["../../src/hooks/useAsyncError.tsx"],"sourcesContent":["import React from 'react'\n/**\n * Triggers re-render of a component to allow ErrorBoundary to catch a thrown error - that way we can handle all exceptions from asynchrounous functions in the same way and catch them in react boundary\n * @returns Function\n */\nexport const useAsyncError = () => {\n const [_, setError] = React.useState()\n return React.useCallback(\n (e: unknown) => {\n const err = e instanceof Error ? e : new Error(typeof e === 'string' ? e : 'Unknown error')\n setError(() => {\n throw err\n })\n },\n [setError],\n )\n}\n"],"names":["useAsyncError","_","setError","React","e","err"],"mappings":";AAKO,MAAMA,IAAgB,MAAM;AACjC,QAAM,CAACC,GAAGC,CAAQ,IAAIC,EAAM,SAAA;AAC5B,SAAOA,EAAM;AAAA,IACX,CAACC,MAAe;AACd,YAAMC,IAAMD,aAAa,QAAQA,IAAI,IAAI,MAAM,OAAOA,KAAM,WAAWA,IAAI,eAAe;AAC1F,MAAAF,EAAS,MAAM;AACb,cAAMG;AAAA,MACR,CAAC;AAAA,IACH;AAAA,IACA,CAACH,CAAQ;AAAA,EAAA;AAEb;"}
@@ -0,0 +1,19 @@
1
+ export declare const useDateFormatter: () => {
2
+ formatShortWithWeekday: (date?: string | Date | null) => string;
3
+ formatShortWithWeekdayAndYear: (date?: string | Date | null) => string;
4
+ formatShort: (date?: string | Date | null) => string;
5
+ formatShortWithYear: (date?: string | Date | null) => string;
6
+ formatLong: (date?: string | Date | null) => string;
7
+ formatLongWithYear: (date?: string | Date | null) => string;
8
+ formatWithTime: (date?: string | Date | null) => {
9
+ time: string;
10
+ date: string;
11
+ };
12
+ formatPayPeriod: (startDate?: string | Date | null, endDate?: string | Date | null) => {
13
+ startDate: string;
14
+ endDate: string;
15
+ };
16
+ formatPayPeriodRange: (startDate?: string | Date | null, endDate?: string | Date | null, options?: {
17
+ useShortMonth?: boolean;
18
+ }) => string;
19
+ };