@gusto/embedded-react-sdk 0.45.0 → 0.46.2

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 (233) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/dist/components/Common/DataView/DataCards/DataCards.d.ts +2 -1
  3. package/dist/components/Common/DataView/DataCards/DataCards.js +14 -13
  4. package/dist/components/Common/DataView/DataCards/DataCards.js.map +1 -1
  5. package/dist/components/Common/DataView/DataTable/DataTable.d.ts +2 -1
  6. package/dist/components/Common/DataView/DataTable/DataTable.js +51 -50
  7. package/dist/components/Common/DataView/DataTable/DataTable.js.map +1 -1
  8. package/dist/components/Common/DataView/DataView.d.ts +1 -0
  9. package/dist/components/Common/DataView/DataView.js.map +1 -1
  10. package/dist/components/Common/DataView/useDataView.d.ts +8 -1
  11. package/dist/components/Common/DataView/useDataView.js +20 -17
  12. package/dist/components/Common/DataView/useDataView.js.map +1 -1
  13. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +20 -4
  14. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
  15. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +20 -4
  16. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
  17. package/dist/components/Company/AssignSignatory/useAssignSignatory.js +22 -6
  18. package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
  19. package/dist/components/Company/BankAccount/BankAccountForm/context.js +20 -4
  20. package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
  21. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +20 -4
  22. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  23. package/dist/components/Company/DocumentSigner/shared/useSignCompanyForm/fields.js +4 -4
  24. package/dist/components/Company/FederalTaxes/useFederalTaxes.js +28 -12
  25. package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
  26. package/dist/components/Company/Industry/Context.js +23 -7
  27. package/dist/components/Company/Industry/Context.js.map +1 -1
  28. package/dist/components/Company/Locations/LocationForm/useLocationForm.js +20 -4
  29. package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
  30. package/dist/components/Company/Locations/LocationsList/useLocationsList.js +20 -4
  31. package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
  32. package/dist/components/Company/OnboardingOverview/context.js +20 -4
  33. package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
  34. package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/fields.js +5 -5
  35. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +20 -4
  36. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
  37. package/dist/components/Company/StateTaxes/StateTaxesList/context.js +20 -4
  38. package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
  39. package/dist/components/Contractor/Address/useAddress.js +22 -6
  40. package/dist/components/Contractor/Address/useAddress.js.map +1 -1
  41. package/dist/components/Contractor/Profile/useContractorProfile.js +52 -42
  42. package/dist/components/Contractor/Profile/useContractorProfile.js.map +1 -1
  43. package/dist/components/Employee/Compensation/management/AddAnotherJob/AddAnotherJob.d.ts +9 -0
  44. package/dist/components/Employee/Compensation/management/AddAnotherJob/AddAnotherJob.js +76 -0
  45. package/dist/components/Employee/Compensation/management/AddAnotherJob/AddAnotherJob.js.map +1 -0
  46. package/dist/components/Employee/Compensation/management/AddAnotherJob/AddAnotherJob.module.scss.js +8 -0
  47. package/dist/components/Employee/Compensation/management/AddAnotherJob/AddAnotherJob.module.scss.js.map +1 -0
  48. package/dist/components/Employee/Compensation/management/EditCompensation/EditCompensation.d.ts +11 -0
  49. package/dist/components/Employee/Compensation/management/EditCompensation/EditCompensation.js +85 -0
  50. package/dist/components/Employee/Compensation/management/EditCompensation/EditCompensation.js.map +1 -0
  51. package/dist/components/Employee/Compensation/management/EditCompensation/EditCompensation.module.scss.js +8 -0
  52. package/dist/components/Employee/Compensation/management/EditCompensation/EditCompensation.module.scss.js.map +1 -0
  53. package/dist/components/Employee/Compensation/management/EditCompensation/index.d.ts +3 -0
  54. package/dist/components/Employee/Compensation/management/EditPendingCompensation/EditPendingCompensation.d.ts +25 -0
  55. package/dist/components/Employee/Compensation/management/EditPendingCompensation/EditPendingCompensation.js +81 -0
  56. package/dist/components/Employee/Compensation/management/EditPendingCompensation/EditPendingCompensation.js.map +1 -0
  57. package/dist/components/Employee/Compensation/management/EditPendingCompensation/EditPendingCompensation.module.scss.js +8 -0
  58. package/dist/components/Employee/Compensation/management/EditPendingCompensation/EditPendingCompensation.module.scss.js.map +1 -0
  59. package/dist/components/Employee/Compensation/management/ManagementCompensationFormBody.d.ts +18 -0
  60. package/dist/components/Employee/Compensation/management/ManagementCompensationFormBody.js +171 -0
  61. package/dist/components/Employee/Compensation/management/ManagementCompensationFormBody.js.map +1 -0
  62. package/dist/components/Employee/Compensation/management/index.d.ts +6 -0
  63. package/dist/components/Employee/Compensation/onboarding/EditCompensation/EditCompensation.d.ts +6 -1
  64. package/dist/components/Employee/Compensation/onboarding/EditCompensation/EditCompensation.js +67 -209
  65. package/dist/components/Employee/Compensation/onboarding/EditCompensation/EditCompensation.js.map +1 -1
  66. package/dist/components/Employee/Compensation/shared/AddCompensationFormBody.d.ts +18 -0
  67. package/dist/components/Employee/Compensation/shared/AddCompensationFormBody.js +169 -0
  68. package/dist/components/Employee/Compensation/shared/AddCompensationFormBody.js.map +1 -0
  69. package/dist/components/Employee/Compensation/shared/useCompensationForm/compensationSchema.d.ts +16 -0
  70. package/dist/components/Employee/Compensation/shared/useCompensationForm/compensationSchema.js +36 -30
  71. package/dist/components/Employee/Compensation/shared/useCompensationForm/compensationSchema.js.map +1 -1
  72. package/dist/components/Employee/Compensation/shared/useCompensationForm/fields.d.ts +1 -1
  73. package/dist/components/Employee/Compensation/shared/useCompensationForm/fields.js +4 -4
  74. package/dist/components/Employee/Compensation/shared/useCompensationForm/fields.js.map +1 -1
  75. package/dist/components/Employee/Compensation/shared/useCompensationForm/useCompensationForm.js +212 -187
  76. package/dist/components/Employee/Compensation/shared/useCompensationForm/useCompensationForm.js.map +1 -1
  77. package/dist/components/Employee/Compensation/shared/useJobForm/fields.js +6 -6
  78. package/dist/components/Employee/Compensation/shared/useJobForm/jobSchema.d.ts +8 -0
  79. package/dist/components/Employee/Compensation/shared/useJobForm/jobSchema.js +22 -17
  80. package/dist/components/Employee/Compensation/shared/useJobForm/jobSchema.js.map +1 -1
  81. package/dist/components/Employee/Compensation/shared/useJobForm/useJobForm.d.ts +12 -2
  82. package/dist/components/Employee/Compensation/shared/useJobForm/useJobForm.js +115 -110
  83. package/dist/components/Employee/Compensation/shared/useJobForm/useJobForm.js.map +1 -1
  84. package/dist/components/Employee/Dashboard/BasicDetailsView.d.ts +8 -3
  85. package/dist/components/Employee/Dashboard/BasicDetailsView.js +108 -84
  86. package/dist/components/Employee/Dashboard/BasicDetailsView.js.map +1 -1
  87. package/dist/components/Employee/Dashboard/Dashboard.d.ts +2 -0
  88. package/dist/components/Employee/Dashboard/Dashboard.js +86 -68
  89. package/dist/components/Employee/Dashboard/Dashboard.js.map +1 -1
  90. package/dist/components/Employee/Dashboard/DashboardComponents.d.ts +8 -4
  91. package/dist/components/Employee/Dashboard/DashboardComponents.js +147 -93
  92. package/dist/components/Employee/Dashboard/DashboardComponents.js.map +1 -1
  93. package/dist/components/Employee/Dashboard/DocumentsView.js +18 -11
  94. package/dist/components/Employee/Dashboard/DocumentsView.js.map +1 -1
  95. package/dist/components/Employee/Dashboard/JobAndPayView.js +304 -264
  96. package/dist/components/Employee/Dashboard/JobAndPayView.js.map +1 -1
  97. package/dist/components/Employee/Dashboard/JobAndPayView.module.scss.js +10 -0
  98. package/dist/components/Employee/Dashboard/JobAndPayView.module.scss.js.map +1 -0
  99. package/dist/components/Employee/Dashboard/TaxesView.d.ts +7 -2
  100. package/dist/components/Employee/Dashboard/TaxesView.js +68 -54
  101. package/dist/components/Employee/Dashboard/TaxesView.js.map +1 -1
  102. package/dist/components/Employee/Dashboard/dashboardStateMachine.js +152 -142
  103. package/dist/components/Employee/Dashboard/dashboardStateMachine.js.map +1 -1
  104. package/dist/components/Employee/Dashboard/getPendingCompensationChanges.d.ts +6 -0
  105. package/dist/components/Employee/Dashboard/getPendingCompensationChanges.js +13 -12
  106. package/dist/components/Employee/Dashboard/getPendingCompensationChanges.js.map +1 -1
  107. package/dist/components/Employee/Dashboard/hooks/useEmployeeBasicDetails.d.ts +12 -5
  108. package/dist/components/Employee/Dashboard/hooks/useEmployeeBasicDetails.js +21 -21
  109. package/dist/components/Employee/Dashboard/hooks/useEmployeeBasicDetails.js.map +1 -1
  110. package/dist/components/Employee/Dashboard/hooks/useEmployeeCompensation.d.ts +13 -3
  111. package/dist/components/Employee/Dashboard/hooks/useEmployeeCompensation.js +53 -55
  112. package/dist/components/Employee/Dashboard/hooks/useEmployeeCompensation.js.map +1 -1
  113. package/dist/components/Employee/Dashboard/hooks/useEmployeeForms.d.ts +10 -4
  114. package/dist/components/Employee/Dashboard/hooks/useEmployeeForms.js +10 -12
  115. package/dist/components/Employee/Dashboard/hooks/useEmployeeForms.js.map +1 -1
  116. package/dist/components/Employee/Dashboard/hooks/useEmployeeTaxes.d.ts +10 -3
  117. package/dist/components/Employee/Dashboard/hooks/useEmployeeTaxes.js +19 -14
  118. package/dist/components/Employee/Dashboard/hooks/useEmployeeTaxes.js.map +1 -1
  119. package/dist/components/Employee/Deductions/shared/useChildSupportGarnishmentForm/fields.js +8 -8
  120. package/dist/components/Employee/Deductions/shared/useDeductionForm/fields.js +4 -4
  121. package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js +20 -4
  122. package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  123. package/dist/components/Employee/Documents/shared/useSignEmployeeForm/fields.js +1 -1
  124. package/dist/components/Employee/EmployeeList/management/ManagementEmployeeList.js +37 -40
  125. package/dist/components/Employee/EmployeeList/management/ManagementEmployeeList.js.map +1 -1
  126. package/dist/components/Employee/EmployeeList/management/ManagementEmployeeListView.d.ts +1 -2
  127. package/dist/components/Employee/EmployeeList/management/ManagementEmployeeListView.js +64 -71
  128. package/dist/components/Employee/EmployeeList/management/ManagementEmployeeListView.js.map +1 -1
  129. package/dist/components/Employee/EmployeeListFlow/EmployeeListFlow.d.ts +2 -0
  130. package/dist/components/Employee/EmployeeListFlow/EmployeeListFlow.js +25 -0
  131. package/dist/components/Employee/EmployeeListFlow/EmployeeListFlow.js.map +1 -0
  132. package/dist/components/Employee/EmployeeListFlow/EmployeeListFlowComponents.d.ts +13 -0
  133. package/dist/components/Employee/EmployeeListFlow/EmployeeListFlowComponents.js +37 -0
  134. package/dist/components/Employee/EmployeeListFlow/EmployeeListFlowComponents.js.map +1 -0
  135. package/dist/components/Employee/EmployeeListFlow/employeeListStateMachine.d.ts +6 -0
  136. package/dist/components/Employee/EmployeeListFlow/employeeListStateMachine.js +69 -0
  137. package/dist/components/Employee/EmployeeListFlow/employeeListStateMachine.js.map +1 -0
  138. package/dist/components/Employee/EmployeeListFlow/index.d.ts +3 -0
  139. package/dist/components/Employee/FederalTaxes/shared/useFederalTaxesForm/fields.js +4 -4
  140. package/dist/components/Employee/HomeAddress/management/HomeAddress.js +15 -12
  141. package/dist/components/Employee/HomeAddress/management/HomeAddress.js.map +1 -1
  142. package/dist/components/Employee/HomeAddress/management/HomeAddressView.d.ts +2 -1
  143. package/dist/components/Employee/HomeAddress/management/HomeAddressView.js +86 -83
  144. package/dist/components/Employee/HomeAddress/management/HomeAddressView.js.map +1 -1
  145. package/dist/components/Employee/PaymentMethod/shared/useBankForm/fields.js +1 -1
  146. package/dist/components/Employee/PaymentMethod/shared/useSplitPaymentsForm/splitFieldFactory.js +4 -4
  147. package/dist/components/Employee/Profile/shared/useEmployeeDetailsForm/fields.js +8 -8
  148. package/dist/components/Employee/Profile/shared/useHomeAddressForm/fields.js +5 -5
  149. package/dist/components/Employee/Profile/shared/useWorkAddressForm/fields.js +4 -4
  150. package/dist/components/Employee/StateTaxes/shared/useEmployeeStateTaxesForm/fieldComponents.js +8 -8
  151. package/dist/components/Employee/Taxes/useTaxes.js +20 -4
  152. package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
  153. package/dist/components/Employee/WorkAddress/management/WorkAddress.js +14 -11
  154. package/dist/components/Employee/WorkAddress/management/WorkAddress.js.map +1 -1
  155. package/dist/components/Employee/WorkAddress/management/WorkAddressView.d.ts +2 -1
  156. package/dist/components/Employee/WorkAddress/management/WorkAddressView.js +92 -89
  157. package/dist/components/Employee/WorkAddress/management/WorkAddressView.js.map +1 -1
  158. package/dist/components/Employee/exports/employeeManagement.d.ts +2 -0
  159. package/dist/components/Employee/exports/employeeManagement.js +18 -16
  160. package/dist/components/Employee/exports/employeeManagement.js.map +1 -1
  161. package/dist/components/Employee/index.d.ts +2 -0
  162. package/dist/components/Employee/index.js +32 -30
  163. package/dist/components/Employee/index.js.map +1 -1
  164. package/dist/components/Flow/FlowHeader.js +34 -31
  165. package/dist/components/Flow/FlowHeader.js.map +1 -1
  166. package/dist/components/Flow/useFlow.d.ts +12 -0
  167. package/dist/components/Flow/useFlow.js.map +1 -1
  168. package/dist/components/Payroll/GrossUpModal/GrossUpModal.js +34 -26
  169. package/dist/components/Payroll/GrossUpModal/GrossUpModal.js.map +1 -1
  170. package/dist/components/Payroll/usePreparedPayrollData.js +36 -22
  171. package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
  172. package/dist/components/TimeOff/PolicyList/PolicyList.js +92 -69
  173. package/dist/components/TimeOff/PolicyList/PolicyList.js.map +1 -1
  174. package/dist/components/TimeOff/PolicyList/PolicyListPresentation.js +23 -23
  175. package/dist/components/TimeOff/PolicyList/PolicyListPresentation.js.map +1 -1
  176. package/dist/components/TimeOff/PolicySettings/PolicySettingsPresentation.js +52 -40
  177. package/dist/components/TimeOff/PolicySettings/PolicySettingsPresentation.js.map +1 -1
  178. package/dist/components/TimeOff/TimeOffFlow/TimeOffFlowComponents.d.ts +1 -1
  179. package/dist/components/TimeOff/TimeOffFlow/TimeOffFlowComponents.js.map +1 -1
  180. package/dist/components/TimeOff/TimeOffFlow/timeOffStateMachine.js +73 -56
  181. package/dist/components/TimeOff/TimeOffFlow/timeOffStateMachine.js.map +1 -1
  182. package/dist/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationForm.js +58 -58
  183. package/dist/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationForm.js.map +1 -1
  184. package/dist/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationFormPresentation.d.ts +1 -1
  185. package/dist/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationFormPresentation.js +91 -87
  186. package/dist/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationFormPresentation.js.map +1 -1
  187. package/dist/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationFormTypes.d.ts +2 -0
  188. package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesHoliday.js +91 -124
  189. package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesHoliday.js.map +1 -1
  190. package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesPresentation.d.ts +1 -1
  191. package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesPresentation.js +72 -87
  192. package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesPresentation.js.map +1 -1
  193. package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesPresentationTypes.d.ts +1 -6
  194. package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesTimeOff.js +160 -220
  195. package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesTimeOff.js.map +1 -1
  196. package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/useSelectEmployeesData.d.ts +7 -3
  197. package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/useSelectEmployeesData.js +77 -54
  198. package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/useSelectEmployeesData.js.map +1 -1
  199. package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/useSelectEmployeesData.test.d.ts +1 -0
  200. package/dist/components/TimeOff/TimeOffPolicyDetail/EditEmployeeBalanceModal.js +12 -11
  201. package/dist/components/TimeOff/TimeOffPolicyDetail/EditEmployeeBalanceModal.js.map +1 -1
  202. package/dist/components/TimeOff/TimeOffPolicyDetail/TimeOffPolicyDetail.js +177 -147
  203. package/dist/components/TimeOff/TimeOffPolicyDetail/TimeOffPolicyDetail.js.map +1 -1
  204. package/dist/components/TimeOff/shared/EmployeeTable/EmployeeTable.d.ts +1 -1
  205. package/dist/components/TimeOff/shared/EmployeeTable/EmployeeTable.js +38 -36
  206. package/dist/components/TimeOff/shared/EmployeeTable/EmployeeTable.js.map +1 -1
  207. package/dist/components/TimeOff/shared/EmployeeTable/EmployeeTableTypes.d.ts +2 -0
  208. package/dist/i18n/en/Company.TimeOff.SelectEmployees.json.js +10 -10
  209. package/dist/i18n/en/Company.TimeOff.TimeOffPolicies.json.js +17 -15
  210. package/dist/i18n/en/Company.TimeOff.TimeOffPolicies.json.js.map +1 -1
  211. package/dist/i18n/en/Company.TimeOff.TimeOffPolicyDetails.json.js +9 -9
  212. package/dist/i18n/en/Employee.Compensation.json.js +68 -56
  213. package/dist/i18n/en/Employee.Compensation.json.js.map +1 -1
  214. package/dist/i18n/en/Employee.Dashboard.json.js +26 -24
  215. package/dist/i18n/en/Employee.Dashboard.json.js.map +1 -1
  216. package/dist/i18n/en/Employee.DocumentManager.json.js +1 -1
  217. package/dist/i18n/en/Employee.HomeAddress.Management.json.js +12 -10
  218. package/dist/i18n/en/Employee.HomeAddress.Management.json.js.map +1 -1
  219. package/dist/i18n/en/Employee.ManagementEmployeeList.json.js +32 -30
  220. package/dist/i18n/en/Employee.ManagementEmployeeList.json.js.map +1 -1
  221. package/dist/i18n/en/Employee.WorkAddress.Management.json.js +16 -14
  222. package/dist/i18n/en/Employee.WorkAddress.Management.json.js.map +1 -1
  223. package/dist/i18n/en/common.json.d.ts +21 -0
  224. package/dist/partner-hook-utils/form/fields/DatePickerHookField.js +33 -32
  225. package/dist/partner-hook-utils/form/fields/DatePickerHookField.js.map +1 -1
  226. package/dist/partner-hook-utils/types.d.ts +4 -0
  227. package/dist/shared/constants.d.ts +4 -0
  228. package/dist/shared/constants.js +20 -18
  229. package/dist/shared/constants.js.map +1 -1
  230. package/dist/style.css +1 -1
  231. package/dist/types/i18next.d.ts +45 -11
  232. package/docs/reference/endpoint-inventory.json +24 -8
  233. package/package.json +1 -1
@@ -2,44 +2,46 @@ import { EmployeeList as e } from "./EmployeeList/onboarding/EmployeeList.js";
2
2
  import { Profile as t } from "./Profile/onboarding/Profile.js";
3
3
  import { OnboardingFlow as x } from "./OnboardingFlow/OnboardingFlow.js";
4
4
  import { SelfOnboardingFlow as n } from "./SelfOnboardingFlow/SelfOnboardingFlow.js";
5
- import { HomeAddress as i } from "./HomeAddress/management/HomeAddress.js";
6
- import { TerminateEmployee as d } from "./Terminations/TerminateEmployee/TerminateEmployee.js";
5
+ import { HomeAddress as a } from "./HomeAddress/management/HomeAddress.js";
6
+ import { TerminateEmployee as s } from "./Terminations/TerminateEmployee/TerminateEmployee.js";
7
7
  import { TerminationSummary as y } from "./Terminations/TerminationSummary/TerminationSummary.js";
8
- import { TerminationFlow as T } from "./Terminations/TerminationFlow/TerminationFlow.js";
9
- import { WorkAddress as u } from "./WorkAddress/management/WorkAddress.js";
10
- import { Compensation as F } from "./Compensation/onboarding/Compensation.js";
11
- import { DashboardFlow as w } from "./Dashboard/DashboardFlow.js";
8
+ import { TerminationFlow as E } from "./Terminations/TerminationFlow/TerminationFlow.js";
9
+ import { WorkAddress as T } from "./WorkAddress/management/WorkAddress.js";
10
+ import { Compensation as u } from "./Compensation/onboarding/Compensation.js";
11
+ import { DashboardFlow as S } from "./Dashboard/DashboardFlow.js";
12
12
  import { Deductions as c } from "./Deductions/Deductions.js";
13
- import { DocumentSigner as h } from "./Documents/onboarding/DocumentSigner/DocumentSigner.js";
14
- import { EmployeeDocuments as L } from "./Documents/onboarding/EmployeeDocuments/EmployeeDocuments.js";
15
- import { EmploymentEligibility as k } from "./Documents/onboarding/DocumentSigner/EmploymentEligibility/EmploymentEligibility.js";
16
- import { FederalTaxes as H } from "./FederalTaxes/management/FederalTaxes.js";
17
- import { Landing as W } from "./Landing/Landing.js";
18
- import { OnboardingSummary as q } from "./OnboardingSummary/OnboardingSummary.js";
19
- import { PaymentMethod as z } from "./PaymentMethod/onboarding/PaymentMethod.js";
20
- import { StateTaxes as G } from "./StateTaxes/management/StateTaxes.js";
21
- import { Taxes as J } from "./Taxes/Taxes.js";
13
+ import { DocumentSigner as O } from "./Documents/onboarding/DocumentSigner/DocumentSigner.js";
14
+ import { EmployeeDocuments as A } from "./Documents/onboarding/EmployeeDocuments/EmployeeDocuments.js";
15
+ import { EmployeeListFlow as k } from "./EmployeeListFlow/EmployeeListFlow.js";
16
+ import { EmploymentEligibility as H } from "./Documents/onboarding/DocumentSigner/EmploymentEligibility/EmploymentEligibility.js";
17
+ import { FederalTaxes as W } from "./FederalTaxes/management/FederalTaxes.js";
18
+ import { Landing as q } from "./Landing/Landing.js";
19
+ import { OnboardingSummary as z } from "./OnboardingSummary/OnboardingSummary.js";
20
+ import { PaymentMethod as G } from "./PaymentMethod/onboarding/PaymentMethod.js";
21
+ import { StateTaxes as J } from "./StateTaxes/management/StateTaxes.js";
22
+ import { Taxes as N } from "./Taxes/Taxes.js";
22
23
  export {
23
- F as Compensation,
24
- w as DashboardFlow,
24
+ u as Compensation,
25
+ S as DashboardFlow,
25
26
  c as Deductions,
26
- h as DocumentSigner,
27
- L as EmployeeDocuments,
27
+ O as DocumentSigner,
28
+ A as EmployeeDocuments,
28
29
  e as EmployeeList,
29
- k as EmploymentEligibility,
30
- H as FederalTaxes,
31
- i as HomeAddress,
32
- W as Landing,
30
+ k as EmployeeListFlow,
31
+ H as EmploymentEligibility,
32
+ W as FederalTaxes,
33
+ a as HomeAddress,
34
+ q as Landing,
33
35
  x as OnboardingFlow,
34
- q as OnboardingSummary,
35
- z as PaymentMethod,
36
+ z as OnboardingSummary,
37
+ G as PaymentMethod,
36
38
  t as Profile,
37
39
  n as SelfOnboardingFlow,
38
- G as StateTaxes,
39
- J as Taxes,
40
- d as TerminateEmployee,
41
- T as TerminationFlow,
40
+ J as StateTaxes,
41
+ N as Taxes,
42
+ s as TerminateEmployee,
43
+ E as TerminationFlow,
42
44
  y as TerminationSummary,
43
- u as WorkAddress
45
+ T as WorkAddress
44
46
  };
45
47
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,21 +1,21 @@
1
- import { jsx as r, jsxs as s } from "react/jsx-runtime";
2
- import { useTranslation as i } from "react-i18next";
3
- import { FlowBreadcrumbs as d } from "../Common/FlowBreadcrumbs/FlowBreadcrumbs.js";
4
- import { Flex as m, FlexItem as c } from "../Common/Flex/Flex.js";
1
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
2
+ import { useTranslation as m } from "react-i18next";
3
+ import { FlowBreadcrumbs as f } from "../Common/FlowBreadcrumbs/FlowBreadcrumbs.js";
4
+ import { Flex as l, FlexItem as a } from "../Common/Flex/Flex.js";
5
5
  import "classnames";
6
- import { componentEvents as p } from "../../shared/constants.js";
7
- import { useFlow as a } from "./useFlow.js";
6
+ import { componentEvents as b } from "../../shared/constants.js";
7
+ import { useFlow as s } from "./useFlow.js";
8
8
  import { useComponentContext as u } from "../../contexts/ComponentAdapter/useComponentContext.js";
9
- import f from "../../assets/icons/caret-left.svg.js";
10
- function H() {
11
- const { header: e, component: t } = a();
9
+ import h from "../../assets/icons/caret-left.svg.js";
10
+ function L() {
11
+ const { header: e, component: t } = s();
12
12
  if (!e || !t) return null;
13
13
  switch (e.type) {
14
14
  case "minimal":
15
- return /* @__PURE__ */ r(b, { cta: e.cta });
15
+ return /* @__PURE__ */ r(w, { back: e.back, cta: e.cta });
16
16
  case "progress":
17
17
  return /* @__PURE__ */ r(
18
- h,
18
+ x,
19
19
  {
20
20
  currentStep: e.currentStep,
21
21
  totalSteps: e.totalSteps,
@@ -24,7 +24,7 @@ function H() {
24
24
  );
25
25
  case "breadcrumbs":
26
26
  return e.currentBreadcrumbId ? /* @__PURE__ */ r(
27
- w,
27
+ v,
28
28
  {
29
29
  currentBreadcrumbId: e.currentBreadcrumbId,
30
30
  breadcrumbs: e.breadcrumbs,
@@ -33,58 +33,61 @@ function H() {
33
33
  ) : null;
34
34
  }
35
35
  }
36
- function b({ cta: e }) {
37
- const { onEvent: t } = a(), n = u(), { t: o } = i();
38
- return /* @__PURE__ */ s(m, { flexDirection: "row", justifyContent: "space-between", alignItems: "center", children: [
39
- /* @__PURE__ */ r(c, { children: /* @__PURE__ */ r(
40
- n.Button,
36
+ function w({
37
+ back: e,
38
+ cta: t
39
+ }) {
40
+ const { onEvent: n } = s(), o = u(), { t: c } = m(e?.namespace), d = c(e ? e.labelKey : "back"), p = e?.event ?? b.CANCEL;
41
+ return /* @__PURE__ */ i(l, { flexDirection: "row", justifyContent: "space-between", alignItems: "center", children: [
42
+ /* @__PURE__ */ r(a, { children: /* @__PURE__ */ r(
43
+ o.Button,
41
44
  {
42
45
  variant: "secondary",
43
- icon: /* @__PURE__ */ r(f, { "aria-hidden": "true" }),
46
+ icon: /* @__PURE__ */ r(h, { "aria-hidden": "true" }),
44
47
  onClick: () => {
45
- t(p.CANCEL, void 0);
48
+ n(p, void 0);
46
49
  },
47
- children: o("back")
50
+ children: d
48
51
  }
49
52
  ) }),
50
- e && /* @__PURE__ */ r(c, { children: /* @__PURE__ */ r(e, {}) })
53
+ t && /* @__PURE__ */ r(a, { children: /* @__PURE__ */ r(t, {}) })
51
54
  ] });
52
55
  }
53
- function h({
56
+ function x({
54
57
  currentStep: e,
55
58
  totalSteps: t,
56
59
  cta: n
57
60
  }) {
58
- const o = u(), { t: l } = i();
61
+ const o = u(), { t: c } = m();
59
62
  return /* @__PURE__ */ r(
60
63
  o.ProgressBar,
61
64
  {
62
65
  totalSteps: t,
63
66
  currentStep: e,
64
- label: l("progressBarLabel", { totalSteps: t, currentStep: e }),
67
+ label: c("progressBarLabel", { totalSteps: t, currentStep: e }),
65
68
  cta: n
66
69
  }
67
70
  );
68
71
  }
69
- function w({
72
+ function v({
70
73
  currentBreadcrumbId: e,
71
74
  breadcrumbs: t = {},
72
75
  cta: n
73
76
  }) {
74
- const { onEvent: o } = a();
75
- return /* @__PURE__ */ s(m, { flexDirection: "row", justifyContent: "space-between", alignItems: "center", children: [
76
- /* @__PURE__ */ r(c, { flexGrow: 1, children: /* @__PURE__ */ r(
77
- d,
77
+ const { onEvent: o } = s();
78
+ return /* @__PURE__ */ i(l, { flexDirection: "row", justifyContent: "space-between", alignItems: "center", children: [
79
+ /* @__PURE__ */ r(a, { flexGrow: 1, children: /* @__PURE__ */ r(
80
+ f,
78
81
  {
79
82
  breadcrumbs: e ? t[e] ?? [] : [],
80
83
  currentBreadcrumbId: e,
81
84
  onEvent: o
82
85
  }
83
86
  ) }),
84
- /* @__PURE__ */ r(c, { children: n && /* @__PURE__ */ r(n, {}) })
87
+ /* @__PURE__ */ r(a, { children: n && /* @__PURE__ */ r(n, {}) })
85
88
  ] });
86
89
  }
87
90
  export {
88
- H as FlowHeader
91
+ L as FlowHeader
89
92
  };
90
93
  //# sourceMappingURL=FlowHeader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FlowHeader.js","sources":["../../../src/components/Flow/FlowHeader.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { FlowBreadcrumbs } from '../Common/FlowBreadcrumbs/FlowBreadcrumbs'\nimport type { BreadcrumbTrail } from '../Common/FlowBreadcrumbs/FlowBreadcrumbsTypes'\nimport { Flex } from '../Common/Flex'\nimport { FlexItem } from '../Common'\nimport { useFlow } from './useFlow'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport CaretLeftIcon from '@/assets/icons/caret-left.svg?react'\n\n/**\n * Renders the chrome above the active flow component (back affordance,\n * progress bar, breadcrumbs, ...). Layout is driven by a single\n * discriminated `header` field on the flow context. Each variant maps to a\n * focused renderer below:\n *\n * header.type === 'minimal' → MinimalHeader\n * header.type === 'progress' → ProgressHeader\n * header.type === 'breadcrumbs' → BreadcrumbsHeader\n *\n * To add a new piece of chrome:\n * 1. Add a new variant to `FlowHeaderConfig` in `useFlow.ts`.\n * 2. Add a new renderer function below.\n * 3. Branch on it in `FlowHeader`.\n */\nexport function FlowHeader() {\n const { header, component } = useFlow()\n\n if (!header || !component) return null\n\n switch (header.type) {\n case 'minimal':\n return <MinimalHeader cta={header.cta} />\n case 'progress':\n return (\n <ProgressHeader\n currentStep={header.currentStep}\n totalSteps={header.totalSteps}\n cta={header.cta}\n />\n )\n case 'breadcrumbs':\n // The breadcrumb trail is intentionally persisted across \"passive\"\n // states (e.g. landing screens) so that subsequent transitions can\n // pick up where they left off without rebuilding it. We render the\n // bar only when there's an active breadcrumb to show; otherwise\n // we treat the flow as \"no chrome\" for this state.\n if (!header.currentBreadcrumbId) return null\n return (\n <BreadcrumbsHeader\n currentBreadcrumbId={header.currentBreadcrumbId}\n breadcrumbs={header.breadcrumbs}\n cta={header.cta}\n />\n )\n }\n}\n\nfunction MinimalHeader({ cta: Cta }: { cta?: React.ComponentType }) {\n const { onEvent } = useFlow()\n const Components = useComponentContext()\n const { t } = useTranslation()\n\n return (\n <Flex flexDirection=\"row\" justifyContent=\"space-between\" alignItems=\"center\">\n <FlexItem>\n <Components.Button\n variant=\"secondary\"\n icon={<CaretLeftIcon aria-hidden=\"true\" />}\n onClick={() => {\n onEvent(componentEvents.CANCEL, undefined)\n }}\n >\n {t('back')}\n </Components.Button>\n </FlexItem>\n {Cta && (\n <FlexItem>\n <Cta />\n </FlexItem>\n )}\n </Flex>\n )\n}\n\nfunction ProgressHeader({\n currentStep,\n totalSteps,\n cta: Cta,\n}: {\n currentStep: number\n totalSteps: number\n cta?: React.ComponentType\n}) {\n const Components = useComponentContext()\n const { t } = useTranslation()\n\n return (\n <Components.ProgressBar\n totalSteps={totalSteps}\n currentStep={currentStep}\n label={t('progressBarLabel', { totalSteps, currentStep })}\n cta={Cta}\n />\n )\n}\n\nfunction BreadcrumbsHeader({\n currentBreadcrumbId,\n breadcrumbs = {},\n cta: Cta,\n}: {\n currentBreadcrumbId?: string\n breadcrumbs?: BreadcrumbTrail\n cta?: React.ComponentType\n}) {\n const { onEvent } = useFlow()\n\n return (\n <Flex flexDirection=\"row\" justifyContent=\"space-between\" alignItems=\"center\">\n <FlexItem flexGrow={1}>\n <FlowBreadcrumbs\n breadcrumbs={currentBreadcrumbId ? (breadcrumbs[currentBreadcrumbId] ?? []) : []}\n currentBreadcrumbId={currentBreadcrumbId}\n onEvent={onEvent}\n />\n </FlexItem>\n <FlexItem>{Cta && <Cta />}</FlexItem>\n </Flex>\n )\n}\n"],"names":["FlowHeader","header","component","useFlow","jsx","MinimalHeader","ProgressHeader","BreadcrumbsHeader","Cta","onEvent","Components","useComponentContext","t","useTranslation","Flex","FlexItem","CaretLeftIcon","componentEvents","currentStep","totalSteps","currentBreadcrumbId","breadcrumbs","FlowBreadcrumbs"],"mappings":";;;;;;;;;AAyBO,SAASA,IAAa;AAC3B,QAAM,EAAE,QAAAC,GAAQ,WAAAC,EAAA,IAAcC,EAAA;AAE9B,MAAI,CAACF,KAAU,CAACC,EAAW,QAAO;AAElC,UAAQD,EAAO,MAAA;AAAA,IACb,KAAK;AACH,aAAO,gBAAAG,EAACC,GAAA,EAAc,KAAKJ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,MACA,OAAON,EAAE,oBAAoB,EAAE,YAAAO,GAAY,aAAAD,GAAa;AAAA,MACxD,KAAKV;AAAA,IAAA;AAAA,EAAA;AAGX;AAEA,SAASD,EAAkB;AAAA,EACzB,qBAAAa;AAAA,EACA,aAAAC,IAAc,CAAA;AAAA,EACd,KAAKb;AACP,GAIG;AACD,QAAM,EAAE,SAAAC,EAAA,IAAYN,EAAA;AAEpB,2BACGW,GAAA,EAAK,eAAc,OAAM,gBAAe,iBAAgB,YAAW,UAClE,UAAA;AAAA,IAAA,gBAAAV,EAACW,GAAA,EAAS,UAAU,GAClB,UAAA,gBAAAX;AAAA,MAACkB;AAAA,MAAA;AAAA,QACC,aAAaF,IAAuBC,EAAYD,CAAmB,KAAK,CAAA,IAAM,CAAA;AAAA,QAC9E,qBAAAA;AAAA,QACA,SAAAX;AAAA,MAAA;AAAA,IAAA,GAEJ;AAAA,IACA,gBAAAL,EAACW,GAAA,EAAU,UAAAP,KAAO,gBAAAJ,EAACI,KAAI,EAAA,CAAG;AAAA,EAAA,GAC5B;AAEJ;"}
1
+ {"version":3,"file":"FlowHeader.js","sources":["../../../src/components/Flow/FlowHeader.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport type { CustomTypeOptions } from 'i18next'\nimport { FlowBreadcrumbs } from '../Common/FlowBreadcrumbs/FlowBreadcrumbs'\nimport type { BreadcrumbTrail } from '../Common/FlowBreadcrumbs/FlowBreadcrumbsTypes'\nimport { Flex } from '../Common/Flex'\nimport { FlexItem } from '../Common'\nimport { useFlow } from './useFlow'\nimport { componentEvents, type EventType } from '@/shared/constants'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport CaretLeftIcon from '@/assets/icons/caret-left.svg?react'\n\n/**\n * Renders the chrome above the active flow component (back affordance,\n * progress bar, breadcrumbs, ...). Layout is driven by a single\n * discriminated `header` field on the flow context. Each variant maps to a\n * focused renderer below:\n *\n * header.type === 'minimal' → MinimalHeader\n * header.type === 'progress' → ProgressHeader\n * header.type === 'breadcrumbs' → BreadcrumbsHeader\n *\n * To add a new piece of chrome:\n * 1. Add a new variant to `FlowHeaderConfig` in `useFlow.ts`.\n * 2. Add a new renderer function below.\n * 3. Branch on it in `FlowHeader`.\n */\nexport function FlowHeader() {\n const { header, component } = useFlow()\n\n if (!header || !component) return null\n\n switch (header.type) {\n case 'minimal':\n return <MinimalHeader back={header.back} cta={header.cta} />\n case 'progress':\n return (\n <ProgressHeader\n currentStep={header.currentStep}\n totalSteps={header.totalSteps}\n cta={header.cta}\n />\n )\n case 'breadcrumbs':\n // The breadcrumb trail is intentionally persisted across \"passive\"\n // states (e.g. landing screens) so that subsequent transitions can\n // pick up where they left off without rebuilding it. We render the\n // bar only when there's an active breadcrumb to show; otherwise\n // we treat the flow as \"no chrome\" for this state.\n if (!header.currentBreadcrumbId) return null\n return (\n <BreadcrumbsHeader\n currentBreadcrumbId={header.currentBreadcrumbId}\n breadcrumbs={header.breadcrumbs}\n cta={header.cta}\n />\n )\n }\n}\n\nfunction MinimalHeader({\n back,\n cta: Cta,\n}: {\n back?: {\n labelKey: string\n namespace: keyof CustomTypeOptions['resources']\n event: EventType\n }\n cta?: React.ComponentType\n}) {\n const { onEvent } = useFlow()\n const Components = useComponentContext()\n const { t } = useTranslation(back?.namespace)\n\n const label = back ? t(back.labelKey as never) : t('back')\n const event = back?.event ?? componentEvents.CANCEL\n\n return (\n <Flex flexDirection=\"row\" justifyContent=\"space-between\" alignItems=\"center\">\n <FlexItem>\n <Components.Button\n variant=\"secondary\"\n icon={<CaretLeftIcon aria-hidden=\"true\" />}\n onClick={() => {\n onEvent(event, undefined)\n }}\n >\n {label}\n </Components.Button>\n </FlexItem>\n {Cta && (\n <FlexItem>\n <Cta />\n </FlexItem>\n )}\n </Flex>\n )\n}\n\nfunction ProgressHeader({\n currentStep,\n totalSteps,\n cta: Cta,\n}: {\n currentStep: number\n totalSteps: number\n cta?: React.ComponentType\n}) {\n const Components = useComponentContext()\n const { t } = useTranslation()\n\n return (\n <Components.ProgressBar\n totalSteps={totalSteps}\n currentStep={currentStep}\n label={t('progressBarLabel', { totalSteps, currentStep })}\n cta={Cta}\n />\n )\n}\n\nfunction BreadcrumbsHeader({\n currentBreadcrumbId,\n breadcrumbs = {},\n cta: Cta,\n}: {\n currentBreadcrumbId?: string\n breadcrumbs?: BreadcrumbTrail\n cta?: React.ComponentType\n}) {\n const { onEvent } = useFlow()\n\n return (\n <Flex flexDirection=\"row\" justifyContent=\"space-between\" alignItems=\"center\">\n <FlexItem flexGrow={1}>\n <FlowBreadcrumbs\n breadcrumbs={currentBreadcrumbId ? (breadcrumbs[currentBreadcrumbId] ?? []) : []}\n currentBreadcrumbId={currentBreadcrumbId}\n onEvent={onEvent}\n />\n </FlexItem>\n <FlexItem>{Cta && <Cta />}</FlexItem>\n </Flex>\n )\n}\n"],"names":["FlowHeader","header","component","useFlow","MinimalHeader","jsx","ProgressHeader","BreadcrumbsHeader","back","Cta","onEvent","Components","useComponentContext","t","useTranslation","label","event","componentEvents","Flex","FlexItem","CaretLeftIcon","currentStep","totalSteps","currentBreadcrumbId","breadcrumbs","FlowBreadcrumbs"],"mappings":";;;;;;;;;AA0BO,SAASA,IAAa;AAC3B,QAAM,EAAE,QAAAC,GAAQ,WAAAC,EAAA,IAAcC,EAAA;AAE9B,MAAI,CAACF,KAAU,CAACC,EAAW,QAAO;AAElC,UAAQD,EAAO,MAAA;AAAA,IACb,KAAK;AACH,+BAAQG,GAAA,EAAc,MAAMH,EAAO,MAAM,KAAKA,EAAO,KAAK;AAAA,IAC5D,KAAK;AACH,aACE,gBAAAI;AAAA,QAACC;AAAA,QAAA;AAAA,UACC,aAAaL,EAAO;AAAA,UACpB,YAAYA,EAAO;AAAA,UACnB,KAAKA,EAAO;AAAA,QAAA;AAAA,MAAA;AAAA,IAGlB,KAAK;AAMH,aAAKA,EAAO,sBAEV,gBAAAI;AAAA,QAACE;AAAA,QAAA;AAAA,UACC,qBAAqBN,EAAO;AAAA,UAC5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AA,EACd,KAAKf;AACP,GAIG;AACD,QAAM,EAAE,SAAAC,EAAA,IAAYP,EAAA;AAEpB,2BACGe,GAAA,EAAK,eAAc,OAAM,gBAAe,iBAAgB,YAAW,UAClE,UAAA;AAAA,IAAA,gBAAAb,EAACc,GAAA,EAAS,UAAU,GAClB,UAAA,gBAAAd;AAAA,MAACoB;AAAA,MAAA;AAAA,QACC,aAAaF,IAAuBC,EAAYD,CAAmB,KAAK,CAAA,IAAM,CAAA;AAAA,QAC9E,qBAAAA;AAAA,QACA,SAAAb;AAAA,MAAA;AAAA,IAAA,GAEJ;AAAA,IACA,gBAAAL,EAACc,GAAA,EAAU,UAAAV,KAAO,gBAAAJ,EAACI,KAAI,EAAA,CAAG;AAAA,EAAA,GAC5B;AAEJ;"}
@@ -23,6 +23,18 @@ export interface CtaConfig {
23
23
  */
24
24
  export type FlowHeaderConfig = {
25
25
  type: 'minimal';
26
+ /**
27
+ * Optional override for the default back button (defaults to
28
+ * `t('back')` + `componentEvents.CANCEL`). Provide both `label` and
29
+ * `event` to render a flow-specific affordance — e.g. "Back to
30
+ * employees" routed to a dedicated state-machine transition so nested
31
+ * flows don't intercept it as a generic cancel.
32
+ */
33
+ back?: {
34
+ labelKey: string;
35
+ namespace: keyof CustomTypeOptions['resources'];
36
+ event: EventType;
37
+ };
26
38
  cta?: React.ComponentType;
27
39
  } | {
28
40
  type: 'progress';
@@ -1 +1 @@
1
- {"version":3,"file":"useFlow.js","sources":["../../../src/components/Flow/useFlow.ts"],"sourcesContent":["import { createContext, useContext } from 'react'\nimport type { CustomTypeOptions } from 'i18next'\nimport type { OnEventType } from '../Base/useBase'\nimport type { CommonComponentInterface } from '../Base'\nimport type { BreadcrumbTrail } from '../Common/FlowBreadcrumbs/FlowBreadcrumbsTypes'\nimport type { EventType } from '@/shared/constants'\n\nexport interface CtaConfig {\n labelKey: string\n namespace?: keyof CustomTypeOptions['resources']\n}\n\n/**\n * Discriminated union describing the chrome rendered above the active flow\n * component. Each variant declares only the data it needs:\n * - `minimal` → Back button. Optional `cta` for an extra control next to it.\n * - `progress` → Step indicator. Requires `currentStep` / `totalSteps`,\n * plus optional `cta`.\n * - `breadcrumbs` → Breadcrumb trail. Optional `currentBreadcrumbId` /\n * `breadcrumbs` (typically populated via\n * `buildBreadcrumbs` + `updateBreadcrumbs`), plus optional\n * `cta`.\n *\n * `cta` carries the same meaning across every variant: an optional component\n * rendered as part of the header chrome.\n */\nexport type FlowHeaderConfig =\n | {\n type: 'minimal'\n cta?: React.ComponentType\n }\n | {\n type: 'progress'\n currentStep: number\n totalSteps: number\n cta?: React.ComponentType\n }\n | {\n type: 'breadcrumbs'\n currentBreadcrumbId?: string\n breadcrumbs?: BreadcrumbTrail\n cta?: React.ComponentType\n }\n\nexport interface FlowContextInterface {\n component: React.ComponentType<CommonComponentInterface> | null\n onEvent: OnEventType<EventType, unknown>\n defaultValues?: Record<string, unknown>\n ctaConfig?: CtaConfig | null\n /**\n * Optional chrome rendered above the active flow component. When omitted\n * (or set to `null`), no header is shown.\n */\n header?: FlowHeaderConfig | null\n}\n\nexport const FlowContext = createContext<FlowContextInterface | null>(null)\n\n//TODO: This is hiding the fact that the callsite for useFlow\n// destructures a `companyId` that doesn't seem to exist\n// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters\nexport function useFlow<C extends FlowContextInterface>() {\n // When used outside provider, this is expected to return undefined - consumers must fallback to params\n const values = useContext<C>(FlowContext as unknown as React.Context<C>)\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (!values) {\n throw new Error('useFlow used outside provider')\n }\n return values\n}\n"],"names":["FlowContext","createContext","useFlow","values","useContext"],"mappings":";AAwDO,MAAMA,IAAcC,EAA2C,IAAI;AAKnE,SAASC,IAA0C;AAExD,QAAMC,IAASC,EAAcJ,CAA0C;AAEvE,MAAI,CAACG;AACH,UAAM,IAAI,MAAM,+BAA+B;AAEjD,SAAOA;AACT;"}
1
+ {"version":3,"file":"useFlow.js","sources":["../../../src/components/Flow/useFlow.ts"],"sourcesContent":["import { createContext, useContext } from 'react'\nimport type { CustomTypeOptions } from 'i18next'\nimport type { OnEventType } from '../Base/useBase'\nimport type { CommonComponentInterface } from '../Base'\nimport type { BreadcrumbTrail } from '../Common/FlowBreadcrumbs/FlowBreadcrumbsTypes'\nimport type { EventType } from '@/shared/constants'\n\nexport interface CtaConfig {\n labelKey: string\n namespace?: keyof CustomTypeOptions['resources']\n}\n\n/**\n * Discriminated union describing the chrome rendered above the active flow\n * component. Each variant declares only the data it needs:\n * - `minimal` → Back button. Optional `cta` for an extra control next to it.\n * - `progress` → Step indicator. Requires `currentStep` / `totalSteps`,\n * plus optional `cta`.\n * - `breadcrumbs` → Breadcrumb trail. Optional `currentBreadcrumbId` /\n * `breadcrumbs` (typically populated via\n * `buildBreadcrumbs` + `updateBreadcrumbs`), plus optional\n * `cta`.\n *\n * `cta` carries the same meaning across every variant: an optional component\n * rendered as part of the header chrome.\n */\nexport type FlowHeaderConfig =\n | {\n type: 'minimal'\n /**\n * Optional override for the default back button (defaults to\n * `t('back')` + `componentEvents.CANCEL`). Provide both `label` and\n * `event` to render a flow-specific affordance — e.g. \"Back to\n * employees\" routed to a dedicated state-machine transition so nested\n * flows don't intercept it as a generic cancel.\n */\n back?: {\n labelKey: string\n namespace: keyof CustomTypeOptions['resources']\n event: EventType\n }\n cta?: React.ComponentType\n }\n | {\n type: 'progress'\n currentStep: number\n totalSteps: number\n cta?: React.ComponentType\n }\n | {\n type: 'breadcrumbs'\n currentBreadcrumbId?: string\n breadcrumbs?: BreadcrumbTrail\n cta?: React.ComponentType\n }\n\nexport interface FlowContextInterface {\n component: React.ComponentType<CommonComponentInterface> | null\n onEvent: OnEventType<EventType, unknown>\n defaultValues?: Record<string, unknown>\n ctaConfig?: CtaConfig | null\n /**\n * Optional chrome rendered above the active flow component. When omitted\n * (or set to `null`), no header is shown.\n */\n header?: FlowHeaderConfig | null\n}\n\nexport const FlowContext = createContext<FlowContextInterface | null>(null)\n\n//TODO: This is hiding the fact that the callsite for useFlow\n// destructures a `companyId` that doesn't seem to exist\n// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters\nexport function useFlow<C extends FlowContextInterface>() {\n // When used outside provider, this is expected to return undefined - consumers must fallback to params\n const values = useContext<C>(FlowContext as unknown as React.Context<C>)\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (!values) {\n throw new Error('useFlow used outside provider')\n }\n return values\n}\n"],"names":["FlowContext","createContext","useFlow","values","useContext"],"mappings":";AAoEO,MAAMA,IAAcC,EAA2C,IAAI;AAKnE,SAASC,IAA0C;AAExD,QAAMC,IAASC,EAAcJ,CAA0C;AAEvE,MAAI,CAACG;AACH,UAAM,IAAI,MAAM,+BAA+B;AAEjD,SAAOA;AACT;"}
@@ -1,31 +1,39 @@
1
- import { jsx as e, jsxs as a, Fragment as I } from "react/jsx-runtime";
2
- import { useRef as R, useState as n, useEffect as S } from "react";
1
+ import { jsx as e, jsxs as t, Fragment as I } from "react/jsx-runtime";
2
+ import { useRef as R, useState as o, useEffect as S } from "react";
3
3
  import { useForm as U, FormProvider as j } from "react-hook-form";
4
4
  import { useTranslation as k } from "react-i18next";
5
5
  import { z as P } from "zod";
6
6
  import { zodResolver as z } from "@hookform/resolvers/zod";
7
- import l from "./GrossUpModal.module.scss.js";
7
+ import a from "./GrossUpModal.module.scss.js";
8
8
  import { Flex as B } from "../../Common/Flex/Flex.js";
9
9
  import "classnames";
10
10
  import "../../../shared/constants.js";
11
11
  import { ActionsLayout as D } from "../../Common/ActionsLayout/ActionsLayout.js";
12
+ import "react-error-boundary";
13
+ import "@tanstack/react-query";
12
14
  import { useBase as H } from "../../Base/useBase.js";
13
- import { useComponentContext as L } from "../../../contexts/ComponentAdapter/useComponentContext.js";
14
- import { useI18n as V } from "../../../i18n/I18n.js";
15
- import { formatNumberAsCurrency as E } from "../../../helpers/formattedStrings.js";
15
+ import "@gusto/embedded-api/models/errors/apierror";
16
+ import "@gusto/embedded-api/models/errors/gustoembeddederror";
17
+ import "@gusto/embedded-api/models/errors/sdkvalidationerror";
18
+ import "@gusto/embedded-api/models/errors/unprocessableentityerror";
19
+ import "@gusto/embedded-api/models/errors/httpclienterrors";
20
+ import { formatNumberAsCurrency as L } from "../../../helpers/formattedStrings.js";
21
+ import { useComponentContext as V } from "../../../contexts/ComponentAdapter/useComponentContext.js";
22
+ import "../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
23
+ import { useI18n as E } from "../../../i18n/I18n.js";
16
24
  import { NumberInputField as T } from "../../Common/Fields/NumberInputField/NumberInputField.js";
17
25
  const q = P.object({
18
26
  netPay: P.number().positive()
19
27
  });
20
- function oe({ isOpen: o, onCalculateGrossUp: w, onApply: A, onCancel: d }) {
21
- V("Payroll.GrossUpModal");
22
- const { t: r } = k("Payroll.GrossUpModal"), { Modal: M, Heading: u, Text: p, Button: i, Alert: f } = L(), { baseSubmitHandler: y } = H(), N = R(null), [t, c] = n(null), [h, m] = n(null), [g, b] = n(!1), [x, v] = n(!1), s = U({
28
+ function ye({ isOpen: n, onCalculateGrossUp: w, onApply: A, onCancel: d }) {
29
+ E("Payroll.GrossUpModal");
30
+ const { t: r } = k("Payroll.GrossUpModal"), { Modal: M, Heading: u, Text: p, Button: i, Alert: f } = V(), { baseSubmitHandler: y } = H(), N = R(null), [l, c] = o(null), [h, m] = o(null), [g, b] = o(!1), [x, v] = o(!1), s = U({
23
31
  resolver: z(q),
24
32
  defaultValues: { netPay: 0 }
25
33
  });
26
34
  S(() => {
27
- o || (s.reset({ netPay: 0 }), c(null), m(null));
28
- }, [o, s.reset]);
35
+ n || (s.reset({ netPay: 0 }), c(null), m(null));
36
+ }, [n, s.reset]);
29
37
  const F = async (G) => {
30
38
  m(null), c(null), b(!0), await y(null, async () => {
31
39
  try {
@@ -39,19 +47,19 @@ function oe({ isOpen: o, onCalculateGrossUp: w, onApply: A, onCancel: d }) {
39
47
  return /* @__PURE__ */ e(
40
48
  M,
41
49
  {
42
- isOpen: o,
50
+ isOpen: n,
43
51
  onClose: d,
44
52
  containerRef: N,
45
- footer: /* @__PURE__ */ a(D, { children: [
53
+ footer: /* @__PURE__ */ t(D, { children: [
46
54
  /* @__PURE__ */ e(
47
55
  i,
48
56
  {
49
57
  variant: "primary",
50
- isDisabled: !t,
58
+ isDisabled: !l,
51
59
  onClick: async () => {
52
- t && (v(!0), await y(null, async () => {
60
+ l && (v(!0), await y(null, async () => {
53
61
  try {
54
- await A(t);
62
+ await A(l);
55
63
  } finally {
56
64
  v(!1);
57
65
  }
@@ -63,15 +71,15 @@ function oe({ isOpen: o, onCalculateGrossUp: w, onApply: A, onCancel: d }) {
63
71
  ),
64
72
  /* @__PURE__ */ e(i, { variant: "secondary", onClick: d, children: r("cancelCta") })
65
73
  ] }),
66
- children: /* @__PURE__ */ a(j, { ...s, children: [
67
- /* @__PURE__ */ a("div", { className: l.header, children: [
74
+ children: /* @__PURE__ */ t(j, { ...s, children: [
75
+ /* @__PURE__ */ t("div", { className: a.header, children: [
68
76
  /* @__PURE__ */ e(u, { as: "h2", styledAs: "h3", children: r("title") }),
69
77
  /* @__PURE__ */ e(p, { variant: "supporting", as: "p", children: r("description") })
70
78
  ] }),
71
- /* @__PURE__ */ a("div", { className: l.content, children: [
72
- h && /* @__PURE__ */ e("div", { className: l.alert, children: /* @__PURE__ */ e(f, { label: h, status: "error", disableScrollIntoView: !0 }) }),
73
- /* @__PURE__ */ e("div", { className: l.alert, children: /* @__PURE__ */ e(f, { label: r("warning"), status: "warning", disableScrollIntoView: !0 }) }),
74
- /* @__PURE__ */ a(B, { flexDirection: "row", gap: 8, children: [
79
+ /* @__PURE__ */ t("div", { className: a.content, children: [
80
+ h && /* @__PURE__ */ e("div", { className: a.alert, children: /* @__PURE__ */ e(f, { label: h, status: "error", disableScrollIntoView: !0 }) }),
81
+ /* @__PURE__ */ e("div", { className: a.alert, children: /* @__PURE__ */ e(f, { label: r("warning"), status: "warning", disableScrollIntoView: !0 }) }),
82
+ /* @__PURE__ */ t(B, { flexDirection: "row", gap: 8, children: [
75
83
  /* @__PURE__ */ e(
76
84
  T,
77
85
  {
@@ -87,16 +95,16 @@ function oe({ isOpen: o, onCalculateGrossUp: w, onApply: A, onCancel: d }) {
87
95
  i,
88
96
  {
89
97
  variant: "secondary",
90
- className: l.calculateButton,
98
+ className: a.calculateButton,
91
99
  isDisabled: g,
92
100
  onClick: s.handleSubmit(F),
93
101
  children: r(g ? "calculatingCta" : "calculateCta")
94
102
  }
95
103
  )
96
104
  ] }),
97
- t && /* @__PURE__ */ e(I, { children: /* @__PURE__ */ a("div", { className: l.result, children: [
105
+ l && /* @__PURE__ */ e(I, { children: /* @__PURE__ */ t("div", { className: a.result, children: [
98
106
  /* @__PURE__ */ e(p, { size: "sm", variant: "supporting", weight: "semibold", children: r("grossPayResult") }),
99
- /* @__PURE__ */ e(u, { as: "h3", children: E(parseFloat(t)) })
107
+ /* @__PURE__ */ e(u, { as: "h3", children: L(parseFloat(l)) })
100
108
  ] }) })
101
109
  ] })
102
110
  ] })
@@ -104,6 +112,6 @@ function oe({ isOpen: o, onCalculateGrossUp: w, onApply: A, onCancel: d }) {
104
112
  );
105
113
  }
106
114
  export {
107
- oe as GrossUpModal
115
+ ye as GrossUpModal
108
116
  };
109
117
  //# sourceMappingURL=GrossUpModal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GrossUpModal.js","sources":["../../../../src/components/Payroll/GrossUpModal/GrossUpModal.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react'\nimport { FormProvider, useForm } from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport { z } from 'zod'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport type { GrossUpModalProps } from './GrossUpModalTypes'\nimport styles from './GrossUpModal.module.scss'\nimport { ActionsLayout, Flex, NumberInputField } from '@/components/Common'\nimport { useBase } from '@/components/Base'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\nimport { formatNumberAsCurrency } from '@/helpers/formattedStrings'\n\nconst GrossUpFormSchema = z.object({\n netPay: z.number().positive(),\n})\n\ntype GrossUpFormValues = z.infer<typeof GrossUpFormSchema>\n\nexport function GrossUpModal({ isOpen, onCalculateGrossUp, onApply, onCancel }: GrossUpModalProps) {\n useI18n('Payroll.GrossUpModal')\n const { t } = useTranslation('Payroll.GrossUpModal')\n const { Modal, Heading, Text, Button, Alert } = useComponentContext()\n const { baseSubmitHandler } = useBase()\n const modalContainerRef = useRef<HTMLDivElement>(null)\n\n const [calculatedGrossUp, setCalculatedGrossUp] = useState<string | null>(null)\n const [errorMessage, setErrorMessage] = useState<string | null>(null)\n const [isCalculating, setIsCalculating] = useState(false)\n const [isApplying, setIsApplying] = useState(false)\n\n const formHandlers = useForm<GrossUpFormValues>({\n resolver: zodResolver(GrossUpFormSchema),\n defaultValues: { netPay: 0 },\n })\n\n useEffect(() => {\n if (!isOpen) {\n formHandlers.reset({ netPay: 0 })\n setCalculatedGrossUp(null)\n setErrorMessage(null)\n }\n }, [isOpen, formHandlers.reset])\n\n const handleCalculate = async (data: GrossUpFormValues) => {\n setErrorMessage(null)\n setCalculatedGrossUp(null)\n setIsCalculating(true)\n\n await baseSubmitHandler(null, async () => {\n try {\n const result = await onCalculateGrossUp(data.netPay)\n\n if (result) {\n setCalculatedGrossUp(result)\n } else {\n setErrorMessage(t('errorMessage'))\n }\n } finally {\n setIsCalculating(false)\n }\n })\n }\n\n const handleApply = async () => {\n if (calculatedGrossUp) {\n setIsApplying(true)\n await baseSubmitHandler(null, async () => {\n try {\n await onApply(calculatedGrossUp)\n } finally {\n setIsApplying(false)\n }\n })\n }\n }\n\n return (\n <Modal\n isOpen={isOpen}\n onClose={onCancel}\n containerRef={modalContainerRef}\n footer={\n <ActionsLayout>\n <Button\n variant=\"primary\"\n isDisabled={!calculatedGrossUp}\n onClick={handleApply}\n isLoading={isApplying}\n >\n {t('applyCta')}\n </Button>\n <Button variant=\"secondary\" onClick={onCancel}>\n {t('cancelCta')}\n </Button>\n </ActionsLayout>\n }\n >\n <FormProvider {...formHandlers}>\n <div className={styles.header}>\n <Heading as=\"h2\" styledAs=\"h3\">\n {t('title')}\n </Heading>\n <Text variant=\"supporting\" as=\"p\">\n {t('description')}\n </Text>\n </div>\n\n <div className={styles.content}>\n {errorMessage && (\n <div className={styles.alert}>\n <Alert label={errorMessage} status=\"error\" disableScrollIntoView />\n </div>\n )}\n\n <div className={styles.alert}>\n <Alert label={t('warning')} status=\"warning\" disableScrollIntoView />\n </div>\n\n <Flex flexDirection=\"row\" gap={8}>\n <NumberInputField\n name=\"netPay\"\n label={t('netPayLabel')}\n format=\"currency\"\n errorMessage={t('validations.netPay')}\n min={0}\n isRequired\n />\n <Button\n variant=\"secondary\"\n className={styles.calculateButton}\n isDisabled={isCalculating}\n onClick={formHandlers.handleSubmit(handleCalculate)}\n >\n {isCalculating ? t('calculatingCta') : t('calculateCta')}\n </Button>\n </Flex>\n\n {calculatedGrossUp && (\n <>\n <div className={styles.result}>\n <Text size=\"sm\" variant=\"supporting\" weight=\"semibold\">\n {t('grossPayResult')}\n </Text>\n <Heading as=\"h3\">{formatNumberAsCurrency(parseFloat(calculatedGrossUp))}</Heading>\n </div>\n </>\n )}\n </div>\n </FormProvider>\n </Modal>\n )\n}\n"],"names":["GrossUpFormSchema","z","GrossUpModal","isOpen","onCalculateGrossUp","onApply","onCancel","useI18n","t","useTranslation","Modal","Heading","Text","Button","Alert","useComponentContext","baseSubmitHandler","useBase","modalContainerRef","useRef","calculatedGrossUp","setCalculatedGrossUp","useState","errorMessage","setErrorMessage","isCalculating","setIsCalculating","isApplying","setIsApplying","formHandlers","useForm","zodResolver","useEffect","handleCalculate","data","result","jsx","ActionsLayout","jsxs","FormProvider","styles","Flex","NumberInputField","Fragment"],"mappings":";;;;;;;;;;;;;;;;AAaA,MAAMA,IAAoBC,EAAE,OAAO;AAAA,EACjC,QAAQA,EAAE,OAAA,EAAS,SAAA;AACrB,CAAC;AAIM,SAASC,GAAa,E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,EAACG,GAAA,EAAK,eAAc,OAAM,KAAK,GAC7B,UAAA;AAAA,YAAA,gBAAAL;AAAA,cAACM;AAAA,cAAA;AAAA,gBACC,MAAK;AAAA,gBACL,OAAOlC,EAAE,aAAa;AAAA,gBACtB,QAAO;AAAA,gBACP,cAAcA,EAAE,oBAAoB;AAAA,gBACpC,KAAK;AAAA,gBACL,YAAU;AAAA,cAAA;AAAA,YAAA;AAAA,YAEZ,gBAAA4B;AAAA,cAACvB;AAAA,cAAA;AAAA,gBACC,SAAQ;AAAA,gBACR,WAAW2B,EAAO;AAAA,gBAClB,YAAYf;AAAA,gBACZ,SAASI,EAAa,aAAaI,CAAe;AAAA,gBAEjD,UAAgBzB,EAAhBiB,IAAkB,mBAAsB,cAAN;AAAA,cAAoB;AAAA,YAAA;AAAA,UACzD,GACF;AAAA,UAECL,KACC,gBAAAgB,EAAAO,GAAA,EACE,UAAA,gBAAAL,EAAC,OAAA,EAAI,WAAWE,EAAO,QACrB,UAAA;AAAA,YAAA,gBAAAJ,EAACxB,GAAA,EAAK,MAAK,MAAK,SAAQ,cAAa,QAAO,YACzC,UAAAJ,EAAE,gBAAgB,EAAA,CACrB;AAAA,YACA,gBAAA4B,EAACzB,KAAQ,IAAG,MAAM,YAAuB,WAAWS,CAAiB,CAAC,EAAA,CAAE;AAAA,UAAA,EAAA,CAC1E,EAAA,CACF;AAAA,QAAA,EAAA,CAEJ;AAAA,MAAA,EAAA,CACF;AAAA,IAAA;AAAA,EAAA;AAGN;"}
1
+ {"version":3,"file":"GrossUpModal.js","sources":["../../../../src/components/Payroll/GrossUpModal/GrossUpModal.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react'\nimport { FormProvider, useForm } from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport { z } from 'zod'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport type { GrossUpModalProps } from './GrossUpModalTypes'\nimport styles from './GrossUpModal.module.scss'\nimport { ActionsLayout, Flex, NumberInputField } from '@/components/Common'\nimport { useBase } from '@/components/Base'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\nimport { formatNumberAsCurrency } from '@/helpers/formattedStrings'\n\nconst GrossUpFormSchema = z.object({\n netPay: z.number().positive(),\n})\n\ntype GrossUpFormValues = z.infer<typeof GrossUpFormSchema>\n\nexport function GrossUpModal({ isOpen, onCalculateGrossUp, onApply, onCancel }: GrossUpModalProps) {\n useI18n('Payroll.GrossUpModal')\n const { t } = useTranslation('Payroll.GrossUpModal')\n const { Modal, Heading, Text, Button, Alert } = useComponentContext()\n const { baseSubmitHandler } = useBase()\n const modalContainerRef = useRef<HTMLDivElement>(null)\n\n const [calculatedGrossUp, setCalculatedGrossUp] = useState<string | null>(null)\n const [errorMessage, setErrorMessage] = useState<string | null>(null)\n const [isCalculating, setIsCalculating] = useState(false)\n const [isApplying, setIsApplying] = useState(false)\n\n const formHandlers = useForm<GrossUpFormValues>({\n resolver: zodResolver(GrossUpFormSchema),\n defaultValues: { netPay: 0 },\n })\n\n useEffect(() => {\n if (!isOpen) {\n formHandlers.reset({ netPay: 0 })\n setCalculatedGrossUp(null)\n setErrorMessage(null)\n }\n }, [isOpen, formHandlers.reset])\n\n const handleCalculate = async (data: GrossUpFormValues) => {\n setErrorMessage(null)\n setCalculatedGrossUp(null)\n setIsCalculating(true)\n\n await baseSubmitHandler(null, async () => {\n try {\n const result = await onCalculateGrossUp(data.netPay)\n\n if (result) {\n setCalculatedGrossUp(result)\n } else {\n setErrorMessage(t('errorMessage'))\n }\n } finally {\n setIsCalculating(false)\n }\n })\n }\n\n const handleApply = async () => {\n if (calculatedGrossUp) {\n setIsApplying(true)\n await baseSubmitHandler(null, async () => {\n try {\n await onApply(calculatedGrossUp)\n } finally {\n setIsApplying(false)\n }\n })\n }\n }\n\n return (\n <Modal\n isOpen={isOpen}\n onClose={onCancel}\n containerRef={modalContainerRef}\n footer={\n <ActionsLayout>\n <Button\n variant=\"primary\"\n isDisabled={!calculatedGrossUp}\n onClick={handleApply}\n isLoading={isApplying}\n >\n {t('applyCta')}\n </Button>\n <Button variant=\"secondary\" onClick={onCancel}>\n {t('cancelCta')}\n </Button>\n </ActionsLayout>\n }\n >\n <FormProvider {...formHandlers}>\n <div className={styles.header}>\n <Heading as=\"h2\" styledAs=\"h3\">\n {t('title')}\n </Heading>\n <Text variant=\"supporting\" as=\"p\">\n {t('description')}\n </Text>\n </div>\n\n <div className={styles.content}>\n {errorMessage && (\n <div className={styles.alert}>\n <Alert label={errorMessage} status=\"error\" disableScrollIntoView />\n </div>\n )}\n\n <div className={styles.alert}>\n <Alert label={t('warning')} status=\"warning\" disableScrollIntoView />\n </div>\n\n <Flex flexDirection=\"row\" gap={8}>\n <NumberInputField\n name=\"netPay\"\n label={t('netPayLabel')}\n format=\"currency\"\n errorMessage={t('validations.netPay')}\n min={0}\n isRequired\n />\n <Button\n variant=\"secondary\"\n className={styles.calculateButton}\n isDisabled={isCalculating}\n onClick={formHandlers.handleSubmit(handleCalculate)}\n >\n {isCalculating ? t('calculatingCta') : t('calculateCta')}\n </Button>\n </Flex>\n\n {calculatedGrossUp && (\n <>\n <div className={styles.result}>\n <Text size=\"sm\" variant=\"supporting\" weight=\"semibold\">\n {t('grossPayResult')}\n </Text>\n <Heading as=\"h3\">{formatNumberAsCurrency(parseFloat(calculatedGrossUp))}</Heading>\n </div>\n </>\n )}\n </div>\n </FormProvider>\n </Modal>\n )\n}\n"],"names":["GrossUpFormSchema","z","GrossUpModal","isOpen","onCalculateGrossUp","onApply","onCancel","useI18n","t","useTranslation","Modal","Heading","Text","Button","Alert","useComponentContext","baseSubmitHandler","useBase","modalContainerRef","useRef","calculatedGrossUp","setCalculatedGrossUp","useState","errorMessage","setErrorMessage","isCalculating","setIsCalculating","isApplying","setIsApplying","formHandlers","useForm","zodResolver","useEffect","handleCalculate","data","result","jsx","ActionsLayout","jsxs","FormProvider","styles","Flex","NumberInputField","Fragment"],"mappings":";;;;;;;;;;;;;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AO,OACrB,UAAA,gBAAAJ,EAACtB,GAAA,EAAM,OAAON,EAAE,SAAS,GAAG,QAAO,WAAU,uBAAqB,IAAC,GACrE;AAAA,UAEA,gBAAA8B,EAACG,GAAA,EAAK,eAAc,OAAM,KAAK,GAC7B,UAAA;AAAA,YAAA,gBAAAL;AAAA,cAACM;AAAA,cAAA;AAAA,gBACC,MAAK;AAAA,gBACL,OAAOlC,EAAE,aAAa;AAAA,gBACtB,QAAO;AAAA,gBACP,cAAcA,EAAE,oBAAoB;AAAA,gBACpC,KAAK;AAAA,gBACL,YAAU;AAAA,cAAA;AAAA,YAAA;AAAA,YAEZ,gBAAA4B;AAAA,cAACvB;AAAA,cAAA;AAAA,gBACC,SAAQ;AAAA,gBACR,WAAW2B,EAAO;AAAA,gBAClB,YAAYf;AAAA,gBACZ,SAASI,EAAa,aAAaI,CAAe;AAAA,gBAEjD,UAAgBzB,EAAhBiB,IAAkB,mBAAsB,cAAN;AAAA,cAAoB;AAAA,YAAA;AAAA,UACzD,GACF;AAAA,UAECL,KACC,gBAAAgB,EAAAO,GAAA,EACE,UAAA,gBAAAL,EAAC,OAAA,EAAI,WAAWE,EAAO,QACrB,UAAA;AAAA,YAAA,gBAAAJ,EAACxB,GAAA,EAAK,MAAK,MAAK,SAAQ,cAAa,QAAO,YACzC,UAAAJ,EAAE,gBAAgB,EAAA,CACrB;AAAA,YACA,gBAAA4B,EAACzB,KAAQ,IAAG,MAAM,YAAuB,WAAWS,CAAiB,CAAC,EAAA,CAAE;AAAA,UAAA,EAAA,CAC1E,EAAA,CACF;AAAA,QAAA,EAAA,CAEJ;AAAA,MAAA,EAAA,CACF;AAAA,IAAA;AAAA,EAAA;AAGN;"}
@@ -1,38 +1,52 @@
1
- import { useState as M, useRef as y, useMemo as _, useCallback as f, useEffect as b } from "react";
1
+ import { useState as M, useRef as m, useMemo as _, useCallback as y, useEffect as b } from "react";
2
2
  import { usePayrollsPrepareMutation as L } from "@gusto/embedded-api/react-query/payrollsPrepare";
3
3
  import { usePaySchedulesGet as D } from "@gusto/embedded-api/react-query/paySchedulesGet";
4
4
  import { UnprocessableEntityError as T } from "@gusto/embedded-api/models/errors/unprocessableentityerror";
5
+ import "react/jsx-runtime";
6
+ import "react-error-boundary";
7
+ import "react-i18next";
8
+ import "@tanstack/react-query";
5
9
  import { useBase as w } from "../Base/useBase.js";
10
+ import "@gusto/embedded-api/models/errors/apierror";
11
+ import "@gusto/embedded-api/models/errors/gustoembeddederror";
12
+ import "@gusto/embedded-api/models/errors/sdkvalidationerror";
13
+ import "@gusto/embedded-api/models/errors/httpclienterrors";
14
+ import "dompurify";
15
+ import "../../contexts/LocaleProvider/useLocale.js";
16
+ import "../../shared/constants.js";
17
+ import "classnames";
18
+ import "../../contexts/ComponentAdapter/useComponentContext.js";
19
+ import "../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
6
20
  import { retryAsync as x } from "../../helpers/retryAsync.js";
7
- const q = 4, v = 1500, B = (e) => e instanceof T ? e.errors.some((r) => r.category === "invalid_operation") : !1, G = ({
21
+ const q = 4, v = 1500, B = (e) => e instanceof T ? e.errors.some((r) => r.category === "invalid_operation") : !1, ee = ({
8
22
  companyId: e,
9
23
  payrollId: r,
10
- employeeUuids: t,
11
- sortBy: i,
24
+ employeeUuids: a,
25
+ sortBy: n,
12
26
  onDataReady: l
13
27
  }) => {
14
- const { mutateAsync: c, isPending: u } = L(), [s, m] = M(), a = y(!1), d = y(!1), { baseSubmitHandler: p } = w(), h = _(() => t?.join(",") ?? "", [t]), { data: S, isLoading: E } = D(
28
+ const { mutateAsync: p, isPending: c } = L(), [o, f] = M(), t = m(!1), u = m(!1), { baseSubmitHandler: d } = w(), h = _(() => a?.join(",") ?? "", [a]), { data: S, isLoading: E } = D(
15
29
  {
16
30
  companyId: e,
17
- payScheduleId: s?.payPeriod?.payScheduleUuid || ""
31
+ payScheduleId: o?.payPeriod?.payScheduleUuid || ""
18
32
  },
19
33
  {
20
- enabled: !!s?.payPeriod?.payScheduleUuid
34
+ enabled: !!o?.payPeriod?.payScheduleUuid
21
35
  }
22
- ), P = f(async () => {
23
- const n = await c({
36
+ ), P = y(async () => {
37
+ const s = await p({
24
38
  request: {
25
39
  companyId: e,
26
40
  payrollId: r,
27
- sortBy: i,
41
+ sortBy: n,
28
42
  requestBody: {
29
- employeeUuids: t
43
+ employeeUuids: a
30
44
  }
31
45
  }
32
46
  });
33
- m(n.payrollPrepared), n.payrollPrepared && (a.current = !0, l?.(n.payrollPrepared));
34
- }, [e, r, c, h, i, l]), o = f(async () => {
35
- await p(
47
+ f(s.payrollPrepared), s.payrollPrepared && (t.current = !0, l?.(s.payrollPrepared));
48
+ }, [e, r, p, h, n, l]), i = y(async () => {
49
+ await d(
36
50
  null,
37
51
  () => x(P, {
38
52
  maxAttempts: q,
@@ -40,21 +54,21 @@ const q = 4, v = 1500, B = (e) => e instanceof T ? e.errors.some((r) => r.catego
40
54
  shouldRetry: B
41
55
  })
42
56
  );
43
- }, [p, P]);
57
+ }, [d, P]);
44
58
  b(() => {
45
- d.current || (d.current = !0, o());
46
- }, [o]);
47
- const g = u && !a.current, R = u && a.current, A = g || E;
59
+ u.current || (u.current = !0, i());
60
+ }, [i]);
61
+ const g = c && !t.current, R = c && t.current, A = g || E;
48
62
  return {
49
- handlePreparePayroll: o,
50
- preparedPayroll: s,
63
+ handlePreparePayroll: i,
64
+ preparedPayroll: o,
51
65
  paySchedule: S?.payScheduleShow,
52
66
  isLoading: A,
53
67
  isPaginating: R,
54
- hasInitialData: a.current
68
+ hasInitialData: t.current
55
69
  };
56
70
  };
57
71
  export {
58
- G as usePreparedPayrollData
72
+ ee as usePreparedPayrollData
59
73
  };
60
74
  //# sourceMappingURL=usePreparedPayrollData.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"usePreparedPayrollData.js","sources":["../../../src/components/Payroll/usePreparedPayrollData.ts"],"sourcesContent":["import { useState, useEffect, useCallback, useRef, useMemo } from 'react'\nimport { usePayrollsPrepareMutation } from '@gusto/embedded-api/react-query/payrollsPrepare'\nimport { usePaySchedulesGet } from '@gusto/embedded-api/react-query/paySchedulesGet'\nimport type { PayrollPrepared } from '@gusto/embedded-api/models/components/payroll'\nimport type { PayScheduleShow } from '@gusto/embedded-api/models/components/payscheduleshow'\nimport type { QueryParamSortBy } from '@gusto/embedded-api/models/operations/putv1companiescompanyidpayrollspayrollidprepare'\nimport { UnprocessableEntityError } from '@gusto/embedded-api/models/errors/unprocessableentityerror'\nimport { useBase } from '../Base'\nimport { retryAsync } from '@/helpers/retryAsync'\n\ninterface UsePreparedPayrollDataParams {\n companyId: string\n payrollId: string\n employeeUuids?: string[]\n sortBy?: QueryParamSortBy\n onDataReady?: (preparedPayroll: PayrollPrepared) => void\n}\n\ninterface UsePreparedPayrollDataReturn {\n handlePreparePayroll: () => Promise<void>\n preparedPayroll: PayrollPrepared | undefined\n paySchedule: PayScheduleShow | undefined\n isLoading: boolean\n isPaginating: boolean\n hasInitialData: boolean\n}\n\nconst PREPARE_MAX_ATTEMPTS = 4\nconst PREPARE_RETRY_DELAY_MS = 1500\n\nconst isPayrollBeingProcessedError = (error: unknown): boolean => {\n if (!(error instanceof UnprocessableEntityError)) return false\n return error.errors.some(e => e.category === 'invalid_operation')\n}\n\nexport const usePreparedPayrollData = ({\n companyId,\n payrollId,\n employeeUuids,\n sortBy,\n onDataReady,\n}: UsePreparedPayrollDataParams): UsePreparedPayrollDataReturn => {\n const { mutateAsync: preparePayroll, isPending: isPreparePayrollPending } =\n usePayrollsPrepareMutation()\n const [preparedPayroll, setPreparedPayroll] = useState<PayrollPrepared | undefined>()\n const hasInitialDataRef = useRef(false)\n const hasFiredRef = useRef(false)\n const { baseSubmitHandler } = useBase()\n\n const employeeUuidsKey = useMemo(() => employeeUuids?.join(',') ?? '', [employeeUuids])\n\n const { data: payScheduleData, isLoading: isPayScheduleLoading } = usePaySchedulesGet(\n {\n companyId,\n payScheduleId: preparedPayroll?.payPeriod?.payScheduleUuid || '',\n },\n {\n enabled: !!preparedPayroll?.payPeriod?.payScheduleUuid,\n },\n )\n\n const executePrepare = useCallback(async () => {\n const result = await preparePayroll({\n request: {\n companyId,\n payrollId,\n sortBy,\n requestBody: {\n employeeUuids,\n },\n },\n })\n setPreparedPayroll(result.payrollPrepared)\n if (result.payrollPrepared) {\n hasInitialDataRef.current = true\n onDataReady?.(result.payrollPrepared)\n }\n }, [companyId, payrollId, preparePayroll, employeeUuidsKey, sortBy, onDataReady])\n\n const handlePreparePayroll = useCallback(async () => {\n await baseSubmitHandler(null, () =>\n retryAsync(executePrepare, {\n maxAttempts: PREPARE_MAX_ATTEMPTS,\n delayMs: PREPARE_RETRY_DELAY_MS,\n shouldRetry: isPayrollBeingProcessedError,\n }),\n )\n }, [baseSubmitHandler, executePrepare])\n\n useEffect(() => {\n if (hasFiredRef.current) return\n hasFiredRef.current = true\n void handlePreparePayroll()\n }, [handlePreparePayroll])\n\n const isInitialLoading = isPreparePayrollPending && !hasInitialDataRef.current\n const isPaginating = isPreparePayrollPending && hasInitialDataRef.current\n const isLoading = isInitialLoading || isPayScheduleLoading\n\n return {\n handlePreparePayroll,\n preparedPayroll,\n paySchedule: payScheduleData?.payScheduleShow,\n isLoading,\n isPaginating,\n hasInitialData: hasInitialDataRef.current,\n }\n}\n"],"names":["PREPARE_MAX_ATTEMPTS","PREPARE_RETRY_DELAY_MS","isPayrollBeingProcessedError","error","UnprocessableEntityError","e","usePreparedPayrollData","companyId","payrollId","employeeUuids","sortBy","onDataReady","preparePayroll","isPreparePayrollPending","usePayrollsPrepareMutation","preparedPayroll","setPreparedPayroll","useState","hasInitialDataRef","useRef","hasFiredRef","baseSubmitHandler","useBase","employeeUuidsKey","useMemo","payScheduleData","isPayScheduleLoading","usePaySchedulesGet","executePrepare","useCallback","result","handlePreparePayroll","retryAsync","useEffect","isInitialLoading","isPaginating","isLoading"],"mappings":";;;;;;AA2BA,MAAMA,IAAuB,GACvBC,IAAyB,MAEzBC,IAA+B,CAACC,MAC9BA,aAAiBC,IAChBD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L,GAAG,CAACmB,GAAmBO,CAAc,CAAC;AAEtC,EAAAK,EAAU,MAAM;AACd,IAAIb,EAAY,YAChBA,EAAY,UAAU,IACjBW,EAAA;AAAA,EACP,GAAG,CAACA,CAAoB,CAAC;AAEzB,QAAMG,IAAmBrB,KAA2B,CAACK,EAAkB,SACjEiB,IAAetB,KAA2BK,EAAkB,SAC5DkB,IAAYF,KAAoBR;AAEtC,SAAO;AAAA,IACL,sBAAAK;AAAA,IACA,iBAAAhB;AAAA,IACA,aAAaU,GAAiB;AAAA,IAC9B,WAAAW;AAAA,IACA,cAAAD;AAAA,IACA,gBAAgBjB,EAAkB;AAAA,EAAA;AAEtC;"}
1
+ {"version":3,"file":"usePreparedPayrollData.js","sources":["../../../src/components/Payroll/usePreparedPayrollData.ts"],"sourcesContent":["import { useState, useEffect, useCallback, useRef, useMemo } from 'react'\nimport { usePayrollsPrepareMutation } from '@gusto/embedded-api/react-query/payrollsPrepare'\nimport { usePaySchedulesGet } from '@gusto/embedded-api/react-query/paySchedulesGet'\nimport type { PayrollPrepared } from '@gusto/embedded-api/models/components/payroll'\nimport type { PayScheduleShow } from '@gusto/embedded-api/models/components/payscheduleshow'\nimport type { QueryParamSortBy } from '@gusto/embedded-api/models/operations/putv1companiescompanyidpayrollspayrollidprepare'\nimport { UnprocessableEntityError } from '@gusto/embedded-api/models/errors/unprocessableentityerror'\nimport { useBase } from '../Base'\nimport { retryAsync } from '@/helpers/retryAsync'\n\ninterface UsePreparedPayrollDataParams {\n companyId: string\n payrollId: string\n employeeUuids?: string[]\n sortBy?: QueryParamSortBy\n onDataReady?: (preparedPayroll: PayrollPrepared) => void\n}\n\ninterface UsePreparedPayrollDataReturn {\n handlePreparePayroll: () => Promise<void>\n preparedPayroll: PayrollPrepared | undefined\n paySchedule: PayScheduleShow | undefined\n isLoading: boolean\n isPaginating: boolean\n hasInitialData: boolean\n}\n\nconst PREPARE_MAX_ATTEMPTS = 4\nconst PREPARE_RETRY_DELAY_MS = 1500\n\nconst isPayrollBeingProcessedError = (error: unknown): boolean => {\n if (!(error instanceof UnprocessableEntityError)) return false\n return error.errors.some(e => e.category === 'invalid_operation')\n}\n\nexport const usePreparedPayrollData = ({\n companyId,\n payrollId,\n employeeUuids,\n sortBy,\n onDataReady,\n}: UsePreparedPayrollDataParams): UsePreparedPayrollDataReturn => {\n const { mutateAsync: preparePayroll, isPending: isPreparePayrollPending } =\n usePayrollsPrepareMutation()\n const [preparedPayroll, setPreparedPayroll] = useState<PayrollPrepared | undefined>()\n const hasInitialDataRef = useRef(false)\n const hasFiredRef = useRef(false)\n const { baseSubmitHandler } = useBase()\n\n const employeeUuidsKey = useMemo(() => employeeUuids?.join(',') ?? '', [employeeUuids])\n\n const { data: payScheduleData, isLoading: isPayScheduleLoading } = usePaySchedulesGet(\n {\n companyId,\n payScheduleId: preparedPayroll?.payPeriod?.payScheduleUuid || '',\n },\n {\n enabled: !!preparedPayroll?.payPeriod?.payScheduleUuid,\n },\n )\n\n const executePrepare = useCallback(async () => {\n const result = await preparePayroll({\n request: {\n companyId,\n payrollId,\n sortBy,\n requestBody: {\n employeeUuids,\n },\n },\n })\n setPreparedPayroll(result.payrollPrepared)\n if (result.payrollPrepared) {\n hasInitialDataRef.current = true\n onDataReady?.(result.payrollPrepared)\n }\n }, [companyId, payrollId, preparePayroll, employeeUuidsKey, sortBy, onDataReady])\n\n const handlePreparePayroll = useCallback(async () => {\n await baseSubmitHandler(null, () =>\n retryAsync(executePrepare, {\n maxAttempts: PREPARE_MAX_ATTEMPTS,\n delayMs: PREPARE_RETRY_DELAY_MS,\n shouldRetry: isPayrollBeingProcessedError,\n }),\n )\n }, [baseSubmitHandler, executePrepare])\n\n useEffect(() => {\n if (hasFiredRef.current) return\n hasFiredRef.current = true\n void handlePreparePayroll()\n }, [handlePreparePayroll])\n\n const isInitialLoading = isPreparePayrollPending && !hasInitialDataRef.current\n const isPaginating = isPreparePayrollPending && hasInitialDataRef.current\n const isLoading = isInitialLoading || isPayScheduleLoading\n\n return {\n handlePreparePayroll,\n preparedPayroll,\n paySchedule: payScheduleData?.payScheduleShow,\n isLoading,\n isPaginating,\n hasInitialData: hasInitialDataRef.current,\n }\n}\n"],"names":["PREPARE_MAX_ATTEMPTS","PREPARE_RETRY_DELAY_MS","isPayrollBeingProcessedError","error","UnprocessableEntityError","e","usePreparedPayrollData","companyId","payrollId","employeeUuids","sortBy","onDataReady","preparePayroll","isPreparePayrollPending","usePayrollsPrepareMutation","preparedPayroll","setPreparedPayroll","useState","hasInitialDataRef","useRef","hasFiredRef","baseSubmitHandler","useBase","employeeUuidsKey","useMemo","payScheduleData","isPayScheduleLoading","usePaySchedulesGet","executePrepare","useCallback","result","handlePreparePayroll","retryAsync","useEffect","isInitialLoading","isPaginating","isLoading"],"mappings":";;;;;;;;;;;;;;;;;;;;AA2BA,MAAMA,IAAuB,GACvBC,IAAyB,MAEzBC,IAA+B,CAACC,MAC9BA,aAAiBC,IAChBD,EAAM,OAAO,KAAK,CAAAE,MAAKA,EAAE,aAAa,mBAAmB,IADP,IAI9CC,KAAyB,CAAC;AAAA,EACrC,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,eAAAC;AAAA,EACA,QAAAC;AAAA,EACA,aAAAC;AACF,MAAkE;AAChE,QAAM,EAAE,aAAaC,GAAgB,WAAWC,EAAA,IAC9CC,EAAA,GACI,CAACC,GAAiBC,CAAkB,IAAIC,EAAA,GACxCC,IAAoBC,EAAO,EAAK,GAChCC,IAAcD,EAAO,EAAK,GAC1B,EAAE,mBAAAE,EAAA,IAAsBC,EAAA,GAExBC,IAAmBC,EAAQ,MAAMf,GAAe,KAAK,GAAG,KAAK,IAAI,CAACA,CAAa,CAAC,GAEhF,EAAE,MAAMgB,GAAiB,WAAWC,MAAyBC;AAAA,IACjE;AAAA,MACE,WAAApB;AAAA,MACA,eAAeQ,GAAiB,WAAW,mBAAmB;AAAA,IAAA;AAAA,IAEhE;AAAA,MACE,SAAS,CAAC,CAACA,GAAiB,WAAW;AAAA,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