@gusto/embedded-react-sdk 0.57.1 → 0.57.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (323) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/dist/components/Base/Base.js +2 -3
  3. package/dist/components/Base/Base.js.map +1 -1
  4. package/dist/components/Common/DateRangeFilter/DateRangeFilter.js +32 -32
  5. package/dist/components/Common/DateRangeFilter/DateRangeFilter.js.map +1 -1
  6. package/dist/components/Common/OnboardingStatusBadge/index.js.map +1 -1
  7. package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js +6 -8
  8. package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js.map +1 -1
  9. package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js +8 -10
  10. package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js.map +1 -1
  11. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +3 -6
  12. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
  13. package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js +6 -8
  14. package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js.map +1 -1
  15. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +3 -6
  16. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
  17. package/dist/components/Company/AssignSignatory/TitleSelect.js +10 -11
  18. package/dist/components/Company/AssignSignatory/TitleSelect.js.map +1 -1
  19. package/dist/components/Company/AssignSignatory/useAssignSignatory.js +5 -8
  20. package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
  21. package/dist/components/Company/BankAccount/BankAccountForm/Actions.js +8 -9
  22. package/dist/components/Company/BankAccount/BankAccountForm/Actions.js.map +1 -1
  23. package/dist/components/Company/BankAccount/BankAccountForm/context.js +3 -6
  24. package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
  25. package/dist/components/Company/BankAccount/BankAccountList/Actions.js +10 -12
  26. package/dist/components/Company/BankAccount/BankAccountList/Actions.js.map +1 -1
  27. package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js +11 -13
  28. package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js.map +1 -1
  29. package/dist/components/Company/DocumentSigner/DocumentList/Actions.js +5 -7
  30. package/dist/components/Company/DocumentSigner/DocumentList/Actions.js.map +1 -1
  31. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +3 -6
  32. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  33. package/dist/components/Company/FederalTaxes/Actions.js +7 -9
  34. package/dist/components/Company/FederalTaxes/Actions.js.map +1 -1
  35. package/dist/components/Company/FederalTaxes/useFederalTaxes.js +8 -11
  36. package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
  37. package/dist/components/Company/Industry/Actions.js +5 -7
  38. package/dist/components/Company/Industry/Actions.js.map +1 -1
  39. package/dist/components/Company/Industry/Context.js +6 -9
  40. package/dist/components/Company/Industry/Context.js.map +1 -1
  41. package/dist/components/Company/Industry/Edit.js +10 -12
  42. package/dist/components/Company/Industry/Edit.js.map +1 -1
  43. package/dist/components/Company/Locations/LocationForm/Actions.js +8 -10
  44. package/dist/components/Company/Locations/LocationForm/Actions.js.map +1 -1
  45. package/dist/components/Company/Locations/LocationForm/useLocationForm.js +3 -6
  46. package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
  47. package/dist/components/Company/Locations/LocationsList/Actions.js +6 -8
  48. package/dist/components/Company/Locations/LocationsList/Actions.js.map +1 -1
  49. package/dist/components/Company/Locations/LocationsList/List.js +11 -13
  50. package/dist/components/Company/Locations/LocationsList/List.js.map +1 -1
  51. package/dist/components/Company/Locations/LocationsList/useLocationsList.js +3 -6
  52. package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
  53. package/dist/components/Company/OnboardingOverview/context.js +3 -6
  54. package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
  55. package/dist/components/Company/PaySchedule/PayScheduleForm.js +66 -62
  56. package/dist/components/Company/PaySchedule/PayScheduleForm.js.map +1 -1
  57. package/dist/components/Company/PaySchedule/PayScheduleForm.module.scss.js +2 -2
  58. package/dist/components/Company/PaySchedule/management/AutoPilotDialog/AutoPilotDialog.js.map +1 -1
  59. package/dist/components/Company/PaySchedule/management/AutoPilotDialog/useAutoPilotDialog.js.map +1 -1
  60. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentCompensationStepPresentation.js +34 -14
  61. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentCompensationStepPresentation.js.map +1 -1
  62. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentDepartmentStepPresentation.js +106 -0
  63. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentDepartmentStepPresentation.js.map +1 -0
  64. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentEmployeeStepPresentation.js +136 -0
  65. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentEmployeeStepPresentation.js.map +1 -0
  66. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentScheduleStepPresentation.js +38 -20
  67. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentScheduleStepPresentation.js.map +1 -1
  68. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentTypeStepPresentation.js +78 -44
  69. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentTypeStepPresentation.js.map +1 -1
  70. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/PayScheduleAssignment.js +45 -37
  71. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/PayScheduleAssignment.js.map +1 -1
  72. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/PayScheduleAssignmentComponents.js +253 -92
  73. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/PayScheduleAssignmentComponents.js.map +1 -1
  74. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/departmentAccess.js +22 -0
  75. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/departmentAccess.js.map +1 -0
  76. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/employeeJob.js +13 -0
  77. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/employeeJob.js.map +1 -0
  78. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/payScheduleAssignmentStateMachine.js +48 -43
  79. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/payScheduleAssignmentStateMachine.js.map +1 -1
  80. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/scheduleLabel.js.map +1 -1
  81. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/useAssignableEmployees.js +57 -0
  82. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/useAssignableEmployees.js.map +1 -0
  83. package/dist/components/Company/PaySchedule/management/PayScheduleCompensationOverviewPresentation.js +11 -13
  84. package/dist/components/Company/PaySchedule/management/PayScheduleCompensationOverviewPresentation.js.map +1 -1
  85. package/dist/components/Company/PaySchedule/management/PayScheduleDepartmentOverviewPresentation.js +83 -0
  86. package/dist/components/Company/PaySchedule/management/PayScheduleDepartmentOverviewPresentation.js.map +1 -0
  87. package/dist/components/Company/PaySchedule/management/PayScheduleEmployeeOverviewPresentation.js +84 -0
  88. package/dist/components/Company/PaySchedule/management/PayScheduleEmployeeOverviewPresentation.js.map +1 -0
  89. package/dist/components/Company/PaySchedule/management/PayScheduleManagementComponents.js +49 -44
  90. package/dist/components/Company/PaySchedule/management/PayScheduleManagementComponents.js.map +1 -1
  91. package/dist/components/Company/PaySchedule/management/PayScheduleOverview.js +109 -39
  92. package/dist/components/Company/PaySchedule/management/PayScheduleOverview.js.map +1 -1
  93. package/dist/components/Company/PaySchedule/management/PayScheduleOverviewPresentation.js.map +1 -1
  94. package/dist/components/Company/PaySchedule/management/payScheduleManagementStateMachine.js.map +1 -1
  95. package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/usePayScheduleForm.js.map +1 -1
  96. package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js +5 -7
  97. package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js.map +1 -1
  98. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +3 -6
  99. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
  100. package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js +6 -8
  101. package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js.map +1 -1
  102. package/dist/components/Company/StateTaxes/StateTaxesList/context.js +3 -6
  103. package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
  104. package/dist/components/Company/StateTaxes/TaxRateManagement/context.js +3 -6
  105. package/dist/components/Company/StateTaxes/TaxRateManagement/context.js.map +1 -1
  106. package/dist/components/Contractor/Address/shared/useContractorAddressForm/useContractorAddressForm.js +5 -5
  107. package/dist/components/Contractor/Address/shared/useContractorAddressForm/useContractorAddressForm.js.map +1 -1
  108. package/dist/components/Contractor/Address/shared/useContractorAddressSummary/useContractorAddressSummary.js +1 -1
  109. package/dist/components/Contractor/Address/shared/useContractorAddressSummary/useContractorAddressSummary.js.map +1 -1
  110. package/dist/components/Contractor/Compensation/management/CompensationCard/CompensationCard.js +16 -17
  111. package/dist/components/Contractor/Compensation/management/CompensationCard/CompensationCard.js.map +1 -1
  112. package/dist/components/Contractor/Compensation/shared/useContractorCompensationSummary/useContractorCompensationSummary.js +4 -4
  113. package/dist/components/Contractor/Compensation/shared/useContractorCompensationSummary/useContractorCompensationSummary.js.map +1 -1
  114. package/dist/components/Contractor/Compensation/shared/useContractorPayForm/useContractorPayForm.js +3 -3
  115. package/dist/components/Contractor/Compensation/shared/useContractorPayForm/useContractorPayForm.js.map +1 -1
  116. package/dist/components/Contractor/ContractorList/shared/useContractorList.js +6 -6
  117. package/dist/components/Contractor/ContractorList/shared/useContractorList.js.map +1 -1
  118. package/dist/components/Contractor/Dashboard/Dashboard.js +20 -20
  119. package/dist/components/Contractor/Dashboard/Dashboard.js.map +1 -1
  120. package/dist/components/Contractor/Dismissal/useDismissal/useDismissal.js +10 -10
  121. package/dist/components/Contractor/Dismissal/useDismissal/useDismissal.js.map +1 -1
  122. package/dist/components/Contractor/Documents/management/DocumentsCard/DocumentsCard.js +8 -9
  123. package/dist/components/Contractor/Documents/management/DocumentsCard/DocumentsCard.js.map +1 -1
  124. package/dist/components/Contractor/Landing/Landing.js +43 -39
  125. package/dist/components/Contractor/Landing/Landing.js.map +1 -1
  126. package/dist/components/Contractor/NewHireReport/NewHireReport.js +3 -3
  127. package/dist/components/Contractor/NewHireReport/NewHireReport.js.map +1 -1
  128. package/dist/components/Contractor/PaymentMethod/shared/ContractorBankAccountFormBody/ContractorBankAccountFormBody.js +6 -8
  129. package/dist/components/Contractor/PaymentMethod/shared/ContractorBankAccountFormBody/ContractorBankAccountFormBody.js.map +1 -1
  130. package/dist/components/Contractor/Payments/CreateHistoricalPayment/CreateHistoricalPayment.js +1 -1
  131. package/dist/components/Contractor/Payments/CreateHistoricalPayment/CreateHistoricalPayment.js.map +1 -1
  132. package/dist/components/Contractor/Payments/CreatePayment/CreatePayment.js +10 -10
  133. package/dist/components/Contractor/Payments/CreatePayment/CreatePayment.js.map +1 -1
  134. package/dist/components/Contractor/Payments/HistoricalPaymentSummary/HistoricalPaymentSummary.js +4 -4
  135. package/dist/components/Contractor/Payments/HistoricalPaymentSummary/HistoricalPaymentSummary.js.map +1 -1
  136. package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistory.js +8 -8
  137. package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistory.js.map +1 -1
  138. package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatement.js +5 -5
  139. package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatement.js.map +1 -1
  140. package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummary.js +3 -3
  141. package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummary.js.map +1 -1
  142. package/dist/components/Contractor/Profile/management/ProfileCard/ProfileCard.js +26 -27
  143. package/dist/components/Contractor/Profile/management/ProfileCard/ProfileCard.js.map +1 -1
  144. package/dist/components/Contractor/Profile/management/ProfileEditForm.js +11 -11
  145. package/dist/components/Contractor/Profile/onboarding/SelfOnboardingContractorProfile.js +1 -1
  146. package/dist/components/Contractor/Profile/onboarding/SelfOnboardingContractorProfile.js.map +1 -1
  147. package/dist/components/Contractor/Profile/shared/useContractorDetailsForm/useContractorDetailsForm.js +1 -1
  148. package/dist/components/Contractor/Profile/shared/useContractorDetailsForm/useContractorDetailsForm.js.map +1 -1
  149. package/dist/components/Contractor/Profile/shared/useContractorProfileSummary/useContractorProfileSummary.js +1 -1
  150. package/dist/components/Contractor/Profile/shared/useContractorProfileSummary/useContractorProfileSummary.js.map +1 -1
  151. package/dist/components/Contractor/SelfOnboardingFlow/SelfOnboardingComponents.js +2 -9
  152. package/dist/components/Contractor/SelfOnboardingFlow/SelfOnboardingComponents.js.map +1 -1
  153. package/dist/components/Contractor/Submit/Submit.js +18 -18
  154. package/dist/components/Contractor/Submit/Submit.js.map +1 -1
  155. package/dist/components/Contractor/shared/SelectContractors/useSelectContractors.js +6 -6
  156. package/dist/components/Contractor/shared/SelectContractors/useSelectContractors.js.map +1 -1
  157. package/dist/components/Employee/Compensation/shared/useCompensationForm/useCompensationForm.js +25 -25
  158. package/dist/components/Employee/Compensation/shared/useCompensationForm/useCompensationForm.js.map +1 -1
  159. package/dist/components/Employee/Compensation/shared/useCompensationManagement/useCompensationManagement.js +15 -15
  160. package/dist/components/Employee/Compensation/shared/useCompensationManagement/useCompensationManagement.js.map +1 -1
  161. package/dist/components/Employee/Compensation/shared/useJobForm/useJobForm.js +1 -1
  162. package/dist/components/Employee/Compensation/shared/useJobForm/useJobForm.js.map +1 -1
  163. package/dist/components/Employee/Dashboard/Dashboard.js +25 -25
  164. package/dist/components/Employee/Dashboard/Dashboard.js.map +1 -1
  165. package/dist/components/Employee/Deductions/management/DeductionsCard/DeductionsCard.js +12 -13
  166. package/dist/components/Employee/Deductions/management/DeductionsCard/DeductionsCard.js.map +1 -1
  167. package/dist/components/Employee/Documents/management/DocumentsCard/DocumentsCard.js +12 -13
  168. package/dist/components/Employee/Documents/management/DocumentsCard/DocumentsCard.js.map +1 -1
  169. package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/Actions.js +6 -8
  170. package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/Actions.js.map +1 -1
  171. package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js +3 -6
  172. package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  173. package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentSigner.js +7 -7
  174. package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentSigner.js.map +1 -1
  175. package/dist/components/Employee/Documents/onboarding/EmployeeDocuments/EmployeeDocuments.js +1 -1
  176. package/dist/components/Employee/Documents/onboarding/EmployeeDocuments/EmployeeDocuments.js.map +1 -1
  177. package/dist/components/Employee/FederalTaxes/management/FederalTaxesEditForm.js +3 -4
  178. package/dist/components/Employee/FederalTaxes/management/FederalTaxesEditForm.js.map +1 -1
  179. package/dist/components/Employee/FederalTaxes/onboarding/FederalTaxes.js +3 -4
  180. package/dist/components/Employee/FederalTaxes/onboarding/FederalTaxes.js.map +1 -1
  181. package/dist/components/Employee/HomeAddress/management/useHomeAddressManagement.js +6 -6
  182. package/dist/components/Employee/HomeAddress/management/useHomeAddressManagement.js.map +1 -1
  183. package/dist/components/Employee/Landing/Landing.js +37 -33
  184. package/dist/components/Employee/Landing/Landing.js.map +1 -1
  185. package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js +27 -27
  186. package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js.map +1 -1
  187. package/dist/components/Employee/PaymentMethod/shared/BankFormBody/BankFormBody.js +22 -24
  188. package/dist/components/Employee/PaymentMethod/shared/BankFormBody/BankFormBody.js.map +1 -1
  189. package/dist/components/Employee/Paystubs/management/PaystubsCard/PaystubsCard.js +8 -9
  190. package/dist/components/Employee/Paystubs/management/PaystubsCard/PaystubsCard.js.map +1 -1
  191. package/dist/components/Employee/Profile/management/ProfileCard/ProfileCard.js +14 -15
  192. package/dist/components/Employee/Profile/management/ProfileCard/ProfileCard.js.map +1 -1
  193. package/dist/components/Employee/Profile/management/ProfileEditForm.js +1 -1
  194. package/dist/components/Employee/Profile/onboarding/EmployeeProfile.js +1 -1
  195. package/dist/components/Employee/Profile/shared/useEmployeeDetailsForm/useEmployeeDetailsForm.js +6 -6
  196. package/dist/components/Employee/Profile/shared/useEmployeeDetailsForm/useEmployeeDetailsForm.js.map +1 -1
  197. package/dist/components/Employee/Profile/shared/useEmployeeProfileSummary/useEmployeeProfileSummary.js +1 -1
  198. package/dist/components/Employee/Profile/shared/useEmployeeProfileSummary/useEmployeeProfileSummary.js.map +1 -1
  199. package/dist/components/Employee/SelfOnboardingFlow/SelfOnboardingComponents.js +8 -15
  200. package/dist/components/Employee/SelfOnboardingFlow/SelfOnboardingComponents.js.map +1 -1
  201. package/dist/components/Employee/StateTaxes/management/StateTaxesEditForm.js +7 -8
  202. package/dist/components/Employee/StateTaxes/management/StateTaxesEditForm.js.map +1 -1
  203. package/dist/components/Employee/StateTaxes/onboarding/StateTaxes.js +7 -8
  204. package/dist/components/Employee/StateTaxes/onboarding/StateTaxes.js.map +1 -1
  205. package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployee.js +11 -11
  206. package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployee.js.map +1 -1
  207. package/dist/components/Employee/Terminations/TerminationSummary/TerminationSummary.js +12 -12
  208. package/dist/components/Employee/Terminations/TerminationSummary/TerminationSummary.js.map +1 -1
  209. package/dist/components/Employee/WorkAddress/management/useWorkAddressManagement.js +26 -26
  210. package/dist/components/Employee/WorkAddress/management/useWorkAddressManagement.js.map +1 -1
  211. package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js +56 -54
  212. package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js.map +1 -1
  213. package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.js +14 -16
  214. package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.js.map +1 -1
  215. package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelectionPresentation.js +6 -8
  216. package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelectionPresentation.js.map +1 -1
  217. package/dist/components/Payroll/OffCycleTaxWithholdingModal/OffCycleTaxWithholdingModal.js +9 -11
  218. package/dist/components/Payroll/OffCycleTaxWithholdingModal/OffCycleTaxWithholdingModal.js.map +1 -1
  219. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js +66 -64
  220. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
  221. package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js +1 -1
  222. package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js.map +1 -1
  223. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js +6 -6
  224. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js.map +1 -1
  225. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
  226. package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/usePayrollEditEmployeeForm.js +1 -1
  227. package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/usePayrollEditEmployeeForm.js.map +1 -1
  228. package/dist/components/Payroll/PayrollHistory/PayrollHistory.js.map +1 -1
  229. package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js +75 -89
  230. package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js.map +1 -1
  231. package/dist/components/Payroll/PayrollList/PayrollList.js.map +1 -1
  232. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +9 -9
  233. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
  234. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +44 -46
  235. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
  236. package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js.map +1 -1
  237. package/dist/components/Payroll/TransitionCreation/TransitionCreation.js +63 -61
  238. package/dist/components/Payroll/TransitionCreation/TransitionCreation.js.map +1 -1
  239. package/dist/components/Payroll/TransitionPayroll/useResolveTransitionPayroll.js +14 -13
  240. package/dist/components/Payroll/TransitionPayroll/useResolveTransitionPayroll.js.map +1 -1
  241. package/dist/components/Payroll/helpers.js +53 -49
  242. package/dist/components/Payroll/helpers.js.map +1 -1
  243. package/dist/components/Payroll/payrollTypes.js +1 -1
  244. package/dist/components/Payroll/payrollTypes.js.map +1 -1
  245. package/dist/components/Payroll/usePreparedPayrollData.js +13 -16
  246. package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
  247. package/dist/components/Payroll/useUnprocessedTransitionPayPeriods.js +2 -2
  248. package/dist/components/Payroll/useUnprocessedTransitionPayPeriods.js.map +1 -1
  249. package/dist/components/TimeOff/HolidayPolicyDetail/HolidayPolicyDetailPresentation.js +2 -4
  250. package/dist/components/TimeOff/HolidayPolicyDetail/HolidayPolicyDetailPresentation.js.map +1 -1
  251. package/dist/components/TimeOff/shared/EmployeeTable/EmployeeTable.js +6 -8
  252. package/dist/components/TimeOff/shared/EmployeeTable/EmployeeTable.js.map +1 -1
  253. package/dist/components/TimeOff/shared/PolicyDetailLayout/PolicyDetailLayout.js +28 -30
  254. package/dist/components/TimeOff/shared/PolicyDetailLayout/PolicyDetailLayout.js.map +1 -1
  255. package/dist/contexts/ApiProvider/payrollOffCycleReasonEnumHook.js +1 -1
  256. package/dist/contexts/ApiProvider/payrollOffCycleReasonEnumHook.js.map +1 -1
  257. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +2 -4
  258. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
  259. package/dist/helpers/dateFormatting.js +47 -40
  260. package/dist/helpers/dateFormatting.js.map +1 -1
  261. package/dist/i18n/en/Company.Management.PaySchedule.json.js +37 -17
  262. package/dist/i18n/en/Company.Management.PaySchedule.json.js.map +1 -1
  263. package/dist/i18n/en/Company.Management.PayScheduleAssignment.json.js +20 -10
  264. package/dist/i18n/en/Company.Management.PayScheduleAssignment.json.js.map +1 -1
  265. package/dist/i18n/en/Payroll.PayrollHistory.json.js +5 -5
  266. package/dist/i18n/en/Payroll.PayrollList.json.js +5 -5
  267. package/dist/i18n/en/Payroll.PayrollOverview.json.js +1 -1
  268. package/dist/package.json.js +1 -1
  269. package/dist/partner-hook-utils/form/fields/CheckboxHookField.js +8 -10
  270. package/dist/partner-hook-utils/form/fields/CheckboxHookField.js.map +1 -1
  271. package/dist/partner-hook-utils/form/fields/NumberInputHookField.js +12 -14
  272. package/dist/partner-hook-utils/form/fields/NumberInputHookField.js.map +1 -1
  273. package/dist/partner-hook-utils/form/fields/RadioGroupHookField.js +13 -15
  274. package/dist/partner-hook-utils/form/fields/RadioGroupHookField.js.map +1 -1
  275. package/dist/partner-hook-utils/form/fields/SelectHookField.js +10 -12
  276. package/dist/partner-hook-utils/form/fields/SelectHookField.js.map +1 -1
  277. package/dist/partner-hook-utils/form/fields/SwitchHookField.js +14 -16
  278. package/dist/partner-hook-utils/form/fields/SwitchHookField.js.map +1 -1
  279. package/dist/partner-hook-utils/form/fields/TextInputHookField.js +8 -10
  280. package/dist/partner-hook-utils/form/fields/TextInputHookField.js.map +1 -1
  281. package/dist/shared/constants.js +5 -5
  282. package/dist/shared/constants.js.map +1 -1
  283. package/dist/src/components/Common/DateRangeFilter/DateRangeFilter.d.ts +2 -2
  284. package/dist/src/components/Common/OnboardingStatusBadge/index.d.ts +1 -1
  285. package/dist/src/components/Company/PaySchedule/PayScheduleForm.d.ts +6 -0
  286. package/dist/src/components/Company/PaySchedule/management/AutoPilotDialog/AutoPilotDialog.d.ts +1 -1
  287. package/dist/src/components/Company/PaySchedule/management/AutoPilotDialog/useAutoPilotDialog.d.ts +1 -1
  288. package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentCompensationStepPresentation.d.ts +10 -3
  289. package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentDepartmentStepPresentation.d.ts +21 -0
  290. package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentEmployeeStepPresentation.d.ts +34 -0
  291. package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentScheduleStepPresentation.d.ts +9 -3
  292. package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentTypeStepPresentation.d.ts +5 -1
  293. package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/PayScheduleAssignment.d.ts +10 -10
  294. package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/PayScheduleAssignmentComponents.d.ts +12 -4
  295. package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/departmentAccess.d.ts +19 -0
  296. package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/employeeJob.d.ts +17 -0
  297. package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/scheduleLabel.d.ts +1 -1
  298. package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/useAssignableEmployees.d.ts +34 -0
  299. package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/usePayScheduleAssignment.d.ts +16 -3
  300. package/dist/src/components/Company/PaySchedule/management/PayScheduleCompensationOverviewPresentation.d.ts +1 -1
  301. package/dist/src/components/Company/PaySchedule/management/PayScheduleDepartmentOverviewPresentation.d.ts +23 -0
  302. package/dist/src/components/Company/PaySchedule/management/PayScheduleEmployeeOverviewPresentation.d.ts +25 -0
  303. package/dist/src/components/Company/PaySchedule/management/PayScheduleManagementComponents.d.ts +1 -1
  304. package/dist/src/components/Company/PaySchedule/management/PayScheduleOverviewPresentation.d.ts +1 -1
  305. package/dist/src/components/Company/PaySchedule/shared/usePayScheduleForm/usePayScheduleForm.d.ts +1 -1
  306. package/dist/src/components/Contractor/Landing/Landing.d.ts +5 -2
  307. package/dist/src/components/Employee/Landing/Landing.d.ts +5 -2
  308. package/dist/src/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.d.ts +1 -1
  309. package/dist/src/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.d.ts +1 -1
  310. package/dist/src/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.d.ts +1 -1
  311. package/dist/src/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/usePayrollEditEmployeeForm.d.ts +2 -2
  312. package/dist/src/components/Payroll/PayrollHistory/PayrollHistoryPresentation.d.ts +1 -1
  313. package/dist/src/components/Payroll/PayrollList/PayrollListPresentation.d.ts +2 -2
  314. package/dist/src/components/Payroll/PayrollOverview/PayrollOverviewPresentation.d.ts +1 -1
  315. package/dist/src/components/Payroll/helpers.d.ts +22 -2
  316. package/dist/src/components/Payroll/usePreparedPayrollData.d.ts +2 -2
  317. package/dist/src/helpers/dateFormatting.d.ts +13 -0
  318. package/dist/src/i18n/types.d.ts +96 -6
  319. package/dist/src/models/external.d.ts +63 -48
  320. package/dist/src/shared/constants.d.ts +1 -1
  321. package/dist/style.css +1 -1
  322. package/docs/guides/endpoint-inventory.json +33 -13
  323. package/package.json +21 -21
@@ -1,28 +1,29 @@
1
- import { usePayrollsListSuspense as i } from "@gusto/embedded-api/react-query/payrollsList";
1
+ import { usePayrollsListSuspense as l } from "@gusto/embedded-api/react-query/payrollsList";
2
2
  import { QueryParamPayrollTypes as a, ProcessingStatuses as u } from "@gusto/embedded-api/models/operations/getv1companiescompanyidpayrolls";
3
- const c = 28, p = "Transition from old pay schedule";
4
- function d() {
3
+ import { toRFCDate as c } from "../../../helpers/dateFormatting.js";
4
+ const p = 28, d = "Transition from old pay schedule";
5
+ function y() {
5
6
  const e = /* @__PURE__ */ new Date();
6
- return e.setDate(e.getDate() + c), e.toISOString().split("T")[0];
7
+ return e.setDate(e.getDate() + p), c(e).toString();
7
8
  }
8
- function S({
9
+ function R({
9
10
  companyId: e,
10
- startDate: o,
11
- endDate: r,
11
+ startDate: r,
12
+ endDate: s,
12
13
  payScheduleUuid: n
13
14
  }) {
14
- const { data: l } = i({
15
+ const { data: i } = l({
15
16
  companyId: e,
16
17
  processingStatuses: [u.Unprocessed],
17
- endDate: d(),
18
+ endDate: y(),
18
19
  payrollTypes: [a.Regular, a.OffCycle]
19
20
  });
20
- return l.payrollList?.find((s) => {
21
- const t = s.payPeriod;
22
- return s.offCycleReason === p && t?.startDate === o && t.endDate === r && t.payScheduleUuid === n;
21
+ return i.payrollList?.find((o) => {
22
+ const t = o.payPeriod;
23
+ return o.offCycleReason === d && t?.startDate === r && t.endDate === s && t.payScheduleUuid === n;
23
24
  })?.payrollUuid;
24
25
  }
25
26
  export {
26
- S as useResolveTransitionPayroll
27
+ R as useResolveTransitionPayroll
27
28
  };
28
29
  //# sourceMappingURL=useResolveTransitionPayroll.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useResolveTransitionPayroll.js","sources":["../../../../src/components/Payroll/TransitionPayroll/useResolveTransitionPayroll.ts"],"sourcesContent":["import { usePayrollsListSuspense } from '@gusto/embedded-api/react-query/payrollsList'\nimport {\n ProcessingStatuses,\n QueryParamPayrollTypes,\n} from '@gusto/embedded-api/models/operations/getv1companiescompanyidpayrolls'\n\nconst FUTURE_LOOKAHEAD_DAYS = 28\n\nconst TRANSITION_OFF_CYCLE_REASON = 'Transition from old pay schedule'\n\nfunction getFutureEndDate(): string {\n const date = new Date()\n date.setDate(date.getDate() + FUTURE_LOOKAHEAD_DAYS)\n return date.toISOString().split('T')[0]!\n}\n\n/**\n * Arguments describing the transition pay period to resolve.\n *\n * @internal\n */\nexport interface ResolveTransitionPayrollArgs {\n companyId: string\n startDate: string\n endDate: string\n payScheduleUuid: string\n}\n\n/**\n * Looks up an existing unprocessed transition payroll for the given pay period.\n *\n * @remarks\n * A transition payroll is an unprocessed off-cycle payroll whose `offCycleReason` is\n * `\"Transition from old pay schedule\"` and whose pay period matches the supplied\n * `startDate`, `endDate`, and `payScheduleUuid`. When the company changed its pay schedule\n * the platform creates exactly one such payroll for the coverage gap; this hook finds it so\n * the caller can resume it instead of creating a duplicate.\n *\n * Backed by a suspense query, so callers must render it under a suspense boundary.\n *\n * @param args - The pay period to match. See {@link ResolveTransitionPayrollArgs}.\n * @returns The matching payroll's UUID, or `undefined` when none exists yet.\n * @internal\n */\nexport function useResolveTransitionPayroll({\n companyId,\n startDate,\n endDate,\n payScheduleUuid,\n}: ResolveTransitionPayrollArgs): string | undefined {\n const { data: payrollsData } = usePayrollsListSuspense({\n companyId,\n processingStatuses: [ProcessingStatuses.Unprocessed],\n endDate: getFutureEndDate(),\n payrollTypes: [QueryParamPayrollTypes.Regular, QueryParamPayrollTypes.OffCycle],\n })\n\n const match = payrollsData.payrollList?.find(payroll => {\n const period = payroll.payPeriod\n return (\n payroll.offCycleReason === TRANSITION_OFF_CYCLE_REASON &&\n period?.startDate === startDate &&\n period.endDate === endDate &&\n period.payScheduleUuid === payScheduleUuid\n )\n })\n\n return match?.payrollUuid\n}\n"],"names":["FUTURE_LOOKAHEAD_DAYS","TRANSITION_OFF_CYCLE_REASON","getFutureEndDate","date","useResolveTransitionPayroll","companyId","startDate","endDate","payScheduleUuid","payrollsData","usePayrollsListSuspense","ProcessingStatuses","QueryParamPayrollTypes","payroll","period"],"mappings":";;AAMA,MAAMA,IAAwB,IAExBC,IAA8B;AAEpC,SAASC,IAA2B;AAClC,QAAMC,wBAAW,KAAA;AACjB,SAAAA,EAAK,QAAQA,EAAK,QAAA,IAAYH,CAAqB,GAC5CG,EAAK,YAAA,EAAc,MAAM,GAAG,EAAE,CAAC;AACxC;AA8BO,SAASC,EAA4B;AAAA,EAC1C,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,SAAAC;AAAA,EACA,iBAAAC;AACF,GAAqD;AACnD,QAAM,EAAE,MAAMC,EAAA,IAAiBC,EAAwB;AAAA,IACrD,WAAAL;AAAA,IACA,oBAAoB,CAACM,EAAmB,WAAW;AAAA,IACnD,SAAST,EAAA;AAAA,IACT,cAAc,CAACU,EAAuB,SAASA,EAAuB,QAAQ;AAAA,EAAA,CAC/E;AAYD,SAVcH,EAAa,aAAa,KAAK,CAAAI,MAAW;AACtD,UAAMC,IAASD,EAAQ;AACvB,WACEA,EAAQ,mBAAmBZ,KAC3Ba,GAAQ,cAAcR,KACtBQ,EAAO,YAAYP,KACnBO,EAAO,oBAAoBN;AAAA,EAE/B,CAAC,GAEa;AAChB;"}
1
+ {"version":3,"file":"useResolveTransitionPayroll.js","sources":["../../../../src/components/Payroll/TransitionPayroll/useResolveTransitionPayroll.ts"],"sourcesContent":["import { usePayrollsListSuspense } from '@gusto/embedded-api/react-query/payrollsList'\nimport {\n ProcessingStatuses,\n QueryParamPayrollTypes,\n} from '@gusto/embedded-api/models/operations/getv1companiescompanyidpayrolls'\nimport { toRFCDate } from '@/helpers/dateFormatting'\n\nconst FUTURE_LOOKAHEAD_DAYS = 28\n\nconst TRANSITION_OFF_CYCLE_REASON = 'Transition from old pay schedule'\n\nfunction getFutureEndDate(): string {\n const date = new Date()\n date.setDate(date.getDate() + FUTURE_LOOKAHEAD_DAYS)\n return toRFCDate(date).toString()\n}\n\n/**\n * Arguments describing the transition pay period to resolve.\n *\n * @internal\n */\nexport interface ResolveTransitionPayrollArgs {\n companyId: string\n startDate: string\n endDate: string\n payScheduleUuid: string\n}\n\n/**\n * Looks up an existing unprocessed transition payroll for the given pay period.\n *\n * @remarks\n * A transition payroll is an unprocessed off-cycle payroll whose `offCycleReason` is\n * `\"Transition from old pay schedule\"` and whose pay period matches the supplied\n * `startDate`, `endDate`, and `payScheduleUuid`. When the company changed its pay schedule\n * the platform creates exactly one such payroll for the coverage gap; this hook finds it so\n * the caller can resume it instead of creating a duplicate.\n *\n * Backed by a suspense query, so callers must render it under a suspense boundary.\n *\n * @param args - The pay period to match. See {@link ResolveTransitionPayrollArgs}.\n * @returns The matching payroll's UUID, or `undefined` when none exists yet.\n * @internal\n */\nexport function useResolveTransitionPayroll({\n companyId,\n startDate,\n endDate,\n payScheduleUuid,\n}: ResolveTransitionPayrollArgs): string | undefined {\n const { data: payrollsData } = usePayrollsListSuspense({\n companyId,\n processingStatuses: [ProcessingStatuses.Unprocessed],\n endDate: getFutureEndDate(),\n payrollTypes: [QueryParamPayrollTypes.Regular, QueryParamPayrollTypes.OffCycle],\n })\n\n const match = payrollsData.payrollList?.find(payroll => {\n const period = payroll.payPeriod\n return (\n payroll.offCycleReason === TRANSITION_OFF_CYCLE_REASON &&\n period?.startDate === startDate &&\n period.endDate === endDate &&\n period.payScheduleUuid === payScheduleUuid\n )\n })\n\n return match?.payrollUuid\n}\n"],"names":["FUTURE_LOOKAHEAD_DAYS","TRANSITION_OFF_CYCLE_REASON","getFutureEndDate","date","toRFCDate","useResolveTransitionPayroll","companyId","startDate","endDate","payScheduleUuid","payrollsData","usePayrollsListSuspense","ProcessingStatuses","QueryParamPayrollTypes","payroll","period"],"mappings":";;;AAOA,MAAMA,IAAwB,IAExBC,IAA8B;AAEpC,SAASC,IAA2B;AAClC,QAAMC,wBAAW,KAAA;AACjB,SAAAA,EAAK,QAAQA,EAAK,QAAA,IAAYH,CAAqB,GAC5CI,EAAUD,CAAI,EAAE,SAAA;AACzB;AA8BO,SAASE,EAA4B;AAAA,EAC1C,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,SAAAC;AAAA,EACA,iBAAAC;AACF,GAAqD;AACnD,QAAM,EAAE,MAAMC,EAAA,IAAiBC,EAAwB;AAAA,IACrD,WAAAL;AAAA,IACA,oBAAoB,CAACM,EAAmB,WAAW;AAAA,IACnD,SAASV,EAAA;AAAA,IACT,cAAc,CAACW,EAAuB,SAASA,EAAuB,QAAQ;AAAA,EAAA,CAC/E;AAYD,SAVcH,EAAa,aAAa,KAAK,CAAAI,MAAW;AACtD,UAAMC,IAASD,EAAQ;AACvB,WACEA,EAAQ,mBAAmBb,KAC3Bc,GAAQ,cAAcR,KACtBQ,EAAO,YAAYP,KACnBO,EAAO,oBAAoBN;AAAA,EAE/B,CAAC,GAEa;AAChB;"}
@@ -1,4 +1,4 @@
1
- import { OffCycleReasonType as f } from "@gusto/embedded-api/models/components/payrollshow";
1
+ import { OffCycleReasonType as f } from "@gusto/embedded-api/models/components/unprocessedpayroll";
2
2
  import { useCallback as S } from "react";
3
3
  import { useTranslation as v } from "react-i18next";
4
4
  import { PayrollCategory as M, isOffCyclePayroll as N } from "./payrollTypes.js";
@@ -6,7 +6,7 @@ import { formatPayRate as x } from "../../helpers/formattedStrings.js";
6
6
  import { useLocale as A } from "../../contexts/LocaleProvider/useLocale.js";
7
7
  import { FlsaStatus as p } from "../../shared/constants.js";
8
8
  import { MS_PER_HOUR as D } from "../../helpers/dateFormatting.js";
9
- const L = "regular hours", P = (e) => e.jobs?.find((t) => t.primary) || e.jobs?.[0] || null, _ = (e) => Math.round(e * 1e6) / 1e6, R = (e) => Math.round(e * 100) / 100, E = (e) => e.toLowerCase() === L, j = {
9
+ const L = "regular hours", h = (e) => e.jobs?.find((t) => t.primary) || e.jobs?.[0] || null, _ = (e) => Math.round(e * 1e6) / 1e6, R = (e) => Math.round(e * 100) / 100, E = (e) => e.toLowerCase() === L, W = {
10
10
  Daily: 8,
11
11
  "Every week": 40,
12
12
  "Every other week": 80,
@@ -15,14 +15,14 @@ const L = "regular hours", P = (e) => e.jobs?.find((t) => t.primary) || e.jobs?.
15
15
  Quarterly: 520,
16
16
  Semiannually: 1040,
17
17
  Annually: 2080
18
- }, I = ({
18
+ }, j = ({
19
19
  employee: e,
20
20
  t,
21
21
  locale: r = "en-US"
22
22
  }) => {
23
23
  if (!e?.jobs)
24
24
  return null;
25
- const n = P(e);
25
+ const n = h(e);
26
26
  if (!n?.compensations)
27
27
  return null;
28
28
  const o = n.compensations[0];
@@ -33,14 +33,14 @@ const L = "regular hours", P = (e) => e.jobs?.find((t) => t.primary) || e.jobs?.
33
33
  }, ie = () => {
34
34
  const { t: e } = v("common"), { locale: t } = A();
35
35
  return S(
36
- (r) => I({ employee: r, t: e, locale: t }),
36
+ (r) => j({ employee: r, t: e, locale: t }),
37
37
  [e, t]
38
38
  );
39
- }, ce = (e) => e.hourlyCompensations ? e.hourlyCompensations.filter((t) => t.name?.toLowerCase() === "regular hours").reduce((t, r) => t + parseFloat(r.hours || "0"), 0) : 0;
40
- function le(e) {
39
+ }, le = (e) => e.hourlyCompensations ? e.hourlyCompensations.filter((t) => t.name?.toLowerCase() === "regular hours").reduce((t, r) => t + parseFloat(r.hours || "0"), 0) : 0;
40
+ function ce(e) {
41
41
  return !e.hourlyCompensations || e.excluded ? 0 : e.hourlyCompensations.filter((t) => Number(t.compensationMultiplier) > 1).reduce((t, r) => t + parseFloat(r.hours || "0"), 0);
42
42
  }
43
- const U = (e) => e.paidTimeOff ? e.paidTimeOff.reduce((t, r) => t + parseFloat(r.hours || "0"), 0) : 0, W = (e) => e.fixedCompensations ? e.fixedCompensations.filter((t) => {
43
+ const I = (e) => e.paidTimeOff ? e.paidTimeOff.reduce((t, r) => t + parseFloat(r.hours || "0"), 0) : 0, U = (e) => e.fixedCompensations ? e.fixedCompensations.filter((t) => {
44
44
  const r = t.name?.toLowerCase() || "", n = parseFloat(t.amount || "0");
45
45
  return r !== "reimbursement" && r !== "minimum wage adjustment" && n > 0;
46
46
  }).reduce((t, r) => t + parseFloat(r.amount || "0"), 0) : 0, fe = (e) => {
@@ -75,7 +75,7 @@ const U = (e) => e.paidTimeOff ? e.paidTimeOff.reduce((t, r) => t + parseFloat(r
75
75
  }, de = (e) => {
76
76
  const t = R(e);
77
77
  return t % 1 === 0 ? `${t}.0` : t.toString();
78
- }, B = (e) => e.frequency && j[e.frequency] || 0, h = (e, t) => {
78
+ }, B = (e) => e.frequency && W[e.frequency] || 0, P = (e, t) => {
79
79
  if (!e.length) return null;
80
80
  const r = [...e].sort(
81
81
  (n, o) => (n.effectiveDate ? new Date(n.effectiveDate).getTime() : 0) - (o.effectiveDate ? new Date(o.effectiveDate).getTime() : 0)
@@ -122,25 +122,25 @@ const U = (e) => e.paidTimeOff ? e.paidTimeOff.reduce((t, r) => t + parseFloat(r
122
122
  const n = e.jobs?.find((s) => s.uuid === t);
123
123
  if (!n?.compensations)
124
124
  return 0;
125
- const o = h(n.compensations, r);
125
+ const o = P(n.compensations, r);
126
126
  return o ? C(o) : 0;
127
127
  }, H = (e, t) => {
128
- const r = P(e);
128
+ const r = h(e);
129
129
  if (!r?.compensations)
130
130
  return 0;
131
- const n = h(r.compensations, t);
131
+ const n = P(r.compensations, t);
132
132
  return n ? C(n) : 0;
133
133
  }, X = (e) => e.paidTimeOff ? e.paidTimeOff.reduce(
134
134
  (t, r) => t + parseFloat(r.finalPayoutUnusedHoursInput || "0"),
135
135
  0
136
136
  ) : 0, b = (e, t, r, n) => {
137
- const o = U(e);
137
+ const o = I(e);
138
138
  if (n) {
139
139
  const s = X(e);
140
140
  return o + s;
141
141
  }
142
142
  return t ? Math.min(r, o) : o;
143
- }, q = (e, t, r) => {
143
+ }, $ = (e, t, r) => {
144
144
  if (!e.adjustForMinimumWage) return 0;
145
145
  const n = k(
146
146
  e.minimumWages || [],
@@ -149,26 +149,26 @@ const U = (e) => e.paidTimeOff ? e.paidTimeOff.reduce((t, r) => t + parseFloat(r
149
149
  if (!n)
150
150
  return 0;
151
151
  const o = t.hourlyCompensations?.reduce(
152
- (m, c) => m + parseFloat(c.hours || "0"),
152
+ (m, l) => m + parseFloat(l.hours || "0"),
153
153
  0
154
154
  ) || 0, s = C(e), u = (parseFloat(n.wage || "0") - s) * o, a = J(t.fixedCompensations || []);
155
155
  return Math.max(0, u - a);
156
- }, Q = (e, t, r, n, o, s, u) => {
156
+ }, q = (e, t, r, n, o, s, u) => {
157
157
  if (!u && n)
158
158
  return H(t, r) * (o - s);
159
159
  if (!e.hourlyCompensations || !t.jobs)
160
160
  return 0;
161
- const a = e.hourlyCompensations.reduce((i, l) => {
162
- const y = parseFloat(l.hours || "0"), g = G(t, l.jobUuid || "", r);
161
+ const a = e.hourlyCompensations.reduce((i, c) => {
162
+ const y = parseFloat(c.hours || "0"), g = G(t, c.jobUuid || "", r);
163
163
  return i + y * g;
164
- }, 0), m = e.hourlyCompensations.reduce((i, l) => i + parseFloat(l.hours || "0"), 0);
164
+ }, 0), m = e.hourlyCompensations.reduce((i, c) => i + parseFloat(c.hours || "0"), 0);
165
165
  if (m === 0) return a;
166
- const c = _(a / m), d = e.hourlyCompensations.filter((i) => !E(i.name || "")).reduce((i, l) => {
167
- const y = parseFloat(l.hours || "0"), g = l.compensationMultiplier || 1;
168
- return i + y * c * (g - 1);
166
+ const l = _(a / m), d = e.hourlyCompensations.filter((i) => !E(i.name || "")).reduce((i, c) => {
167
+ const y = parseFloat(c.hours || "0"), g = c.compensationMultiplier || 1;
168
+ return i + y * l * (g - 1);
169
169
  }, 0);
170
170
  return a + d;
171
- }, $ = (e, t, r, n, o, s) => {
171
+ }, Q = (e, t, r, n, o, s) => {
172
172
  const u = b(
173
173
  e,
174
174
  n,
@@ -176,7 +176,7 @@ const U = (e) => e.paidTimeOff ? e.paidTimeOff.reduce((t, r) => t + parseFloat(r
176
176
  s
177
177
  ), a = H(t, r);
178
178
  return u * a;
179
- }, z = (e, t, r) => {
179
+ }, V = (e, t, r) => {
180
180
  if (!t) return !1;
181
181
  const n = e.hourlyCompensations?.find(
182
182
  (s) => E(s.name || "")
@@ -185,49 +185,49 @@ const U = (e) => e.paidTimeOff ? e.paidTimeOff.reduce((t, r) => t + parseFloat(r
185
185
  }, ge = (e, t, r, n, o = M.Regular) => {
186
186
  if (e.excluded)
187
187
  return 0;
188
- const s = r ? new Date(r) : /* @__PURE__ */ new Date(), u = P(t);
188
+ const s = r ? new Date(r) : /* @__PURE__ */ new Date(), u = h(t);
189
189
  if (!u?.compensations)
190
190
  return 0;
191
- const a = h(
191
+ const a = P(
192
192
  u.compensations,
193
193
  s
194
194
  );
195
195
  if (!a)
196
196
  return 0;
197
- const m = Y(a), c = n ? B(n) : 0, d = z(
197
+ const m = Y(a), l = n ? B(n) : 0, d = V(
198
198
  e,
199
199
  m,
200
- c
201
- ), i = N(o), l = b(
200
+ l
201
+ ), i = N(o), c = b(
202
202
  e,
203
203
  d,
204
- c,
204
+ l,
205
205
  i
206
- ), y = Q(
206
+ ), y = q(
207
207
  e,
208
208
  t,
209
209
  s,
210
210
  d,
211
- c,
212
211
  l,
212
+ c,
213
213
  i
214
- ), g = W(e), w = $(
214
+ ), g = U(e), w = Q(
215
215
  e,
216
216
  t,
217
217
  s,
218
218
  d,
219
- c,
219
+ l,
220
220
  i
221
- ), F = q(
221
+ ), F = $(
222
222
  a,
223
223
  e,
224
224
  s
225
225
  ), O = y + g + w + F;
226
226
  return R(O);
227
- }, pe = (e) => e === f.DismissedEmployee, Pe = (e, t) => t.formatPayPeriodRange(
227
+ }, pe = (e) => e === f.DismissedEmployee, he = (e, t) => t.formatPayPeriodRange(
228
228
  e.payPeriod?.startDate,
229
229
  e.payPeriod?.endDate
230
- ) || t.formatShortWithYear(e.checkDate), K = {
230
+ ) || t.formatShortWithYear(e.checkDate), z = {
231
231
  Bonus: "Bonus",
232
232
  Correction: "Correction",
233
233
  "Transition from old pay schedule": "Transition",
@@ -238,7 +238,7 @@ const U = (e) => e.paidTimeOff ? e.paidTimeOff.reduce((t, r) => t + parseFloat(r
238
238
  "Tax reconciliation": "Tax Reconciliation",
239
239
  Reversal: "Reversal",
240
240
  "Disability insurance distribution": "Disability Insurance"
241
- }, he = (e) => e.external ? "External" : e.offCycle && e.offCycleReason ? K[e.offCycleReason] ?? e.offCycleReason : e.offCycle ? "Off-Cycle" : "Regular", Ce = ({
241
+ }, Pe = (e) => e.external ? "External" : e.offCycle && e.offCycleReason ? z[e.offCycleReason] ?? e.offCycleReason : e.offCycle ? "Off-Cycle" : "Regular", Ce = ({
242
242
  flsaStatus: e,
243
243
  existingFixedCompensations: t = [],
244
244
  primaryJobUuid: r,
@@ -248,7 +248,7 @@ const U = (e) => e.paidTimeOff ? e.paidTimeOff.reduce((t, r) => t + parseFloat(r
248
248
  const s = [...t];
249
249
  return e !== p.OWNER && r && n.length > 0 && n.map((a) => a.name).filter(Boolean).forEach((a) => {
250
250
  s.some(
251
- (c) => c.name?.toLowerCase() === a.toLowerCase()
251
+ (l) => l.name?.toLowerCase() === a.toLowerCase()
252
252
  ) || s.push({
253
253
  name: a,
254
254
  amount: "0.00",
@@ -260,7 +260,7 @@ const U = (e) => e.paidTimeOff ? e.paidTimeOff.reduce((t, r) => t + parseFloat(r
260
260
  r.setDate(1 + (7 - r.getDay()) + 7);
261
261
  const n = new Date(t, 10, 1);
262
262
  return n.setDate(1 + (7 - n.getDay()) % 7), e >= r && e < n ? -7 : -8;
263
- }, V = /* @__PURE__ */ new Set([
263
+ }, K = /* @__PURE__ */ new Set([
264
264
  f.Bonus,
265
265
  f.Correction,
266
266
  f.Adhoc,
@@ -268,7 +268,10 @@ const U = (e) => e.paidTimeOff ? e.paidTimeOff.reduce((t, r) => t + parseFloat(r
268
268
  f.HiredEmployee,
269
269
  f.DismissedEmployee,
270
270
  f.TransitionFromOldPaySchedule
271
- ]), Z = (e) => e.external ? !1 : e.offCycle ? !!e.offCycleReason && V.has(e.offCycleReason) : !0, Te = (e) => {
271
+ ]), Z = (e) => e.external ? !1 : e.offCycle ? !!e.offCycleReason && K.has(e.offCycleReason) : !0, Te = (e, t) => {
272
+ const { time: r, date: n } = t.formatWithTime(e.payrollDeadline);
273
+ return { time: r, date: n, deadline: n ? `${r} on ${n}` : r };
274
+ }, Re = (e) => {
272
275
  if (e.payrollStatusMeta?.cancellable !== !0 || !e.processed || !Z(e) || !e.payrollDeadline)
273
276
  return !1;
274
277
  const t = /* @__PURE__ */ new Date(), r = new Date(e.payrollDeadline), n = new Date(t.getTime() + T(t) * D), o = new Date(r.getTime() + T(r) * D), s = new Date(o);
@@ -277,18 +280,19 @@ const U = (e) => e.paidTimeOff ? e.paidTimeOff.reduce((t, r) => t + parseFloat(r
277
280
  export {
278
281
  ge as calculateGrossPay,
279
282
  De as calculateTotalPayroll,
280
- Te as canCancelPayroll,
283
+ Re as canCancelPayroll,
281
284
  me as cleanupReimbursements,
282
- I as formatEmployeePayRate,
285
+ j as formatEmployeePayRate,
283
286
  de as formatHoursDisplay,
284
- W as getAdditionalEarnings,
287
+ U as getAdditionalEarnings,
285
288
  Ce as getAdditionalEarningsCompensations,
286
- le as getOvertimeHours,
287
- Pe as getPayPeriodOrCheckDateLabel,
288
- he as getPayrollTypeLabel,
289
- ce as getRegularHours,
289
+ Te as getCancelDeadlineValues,
290
+ ce as getOvertimeHours,
291
+ he as getPayPeriodOrCheckDateLabel,
292
+ Pe as getPayrollTypeLabel,
293
+ le as getRegularHours,
290
294
  fe as getReimbursements,
291
- U as getTotalPtoHours,
295
+ I as getTotalPtoHours,
292
296
  pe as isDismissalPayroll,
293
297
  ye as isOvertimeEligibleFlsaStatus,
294
298
  ie as useFormatEmployeePayRate
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","sources":["../../../src/components/Payroll/helpers.ts"],"sourcesContent":["import type { Employee } from '@gusto/embedded-api/models/components/employee'\nimport {\n type PayrollShowFixedCompensations,\n OffCycleReasonType,\n} from '@gusto/embedded-api/models/components/payrollshow'\nimport type {\n FixedCompensations,\n Reimbursements as Reimbursement,\n} from '@gusto/embedded-api/models/components/payrollemployeecompensationstype'\nimport type { PayrollUpdateReimbursements } from '@gusto/embedded-api/models/components/payrollupdate'\nimport type { PayrollFixedCompensationTypesType } from '@gusto/embedded-api/models/components/payrollfixedcompensationtypestype'\nimport { useCallback } from 'react'\nimport type { TFunction } from 'i18next'\nimport { useTranslation } from 'react-i18next'\nimport type { PayScheduleShow as PayScheduleObject } from '@gusto/embedded-api/models/components/payscheduleshow'\nimport type { Compensation, MinimumWages } from '@gusto/embedded-api/models/components/compensation'\nimport type { PayrollEmployeeCompensationsType } from '@gusto/embedded-api/models/components/payrollemployeecompensationstype'\nimport type { Payroll } from '@gusto/embedded-api/models/components/payrollshow'\nimport type { PayrollType } from './PayrollList/types'\nimport { PayrollCategory, isOffCyclePayroll } from './payrollTypes'\nimport { formatPayRate } from '@/helpers/formattedStrings'\nimport { useLocale } from '@/contexts/LocaleProvider/useLocale'\nimport { FlsaStatus } from '@/shared/constants'\nimport { MS_PER_HOUR } from '@/helpers/dateFormatting'\nimport type { useDateFormatter } from '@/hooks/useDateFormatter'\nconst REGULAR_HOURS_NAME = 'regular hours'\n\n/**\n * The compensation fields the payroll math helpers operate on.\n *\n * @remarks\n * These helpers run over both compensation representations the API returns: the\n * prepared (base) shape used when editing a payroll and the calculated (show)\n * shape rendered after calculation. The two are interchangeable for every field\n * read here and differ only on `deductions`, which no helper touches. Omitting\n * `deductions` lets a single input type accept either shape without a cast.\n *\n * @internal\n */\ntype EmployeeCompensationInput = Omit<PayrollEmployeeCompensationsType, 'deductions'>\n\n// Utility to get the primary job from an employee\nconst getPrimaryJob = (employee: Employee) => {\n return employee.jobs?.find(job => job.primary) || employee.jobs?.[0] || null\n}\n\nconst roundToSixDecimals = (value: number): number => {\n return Math.round(value * 1_000_000) / 1_000_000\n}\n\nconst roundToTwoDecimals = (value: number): number => {\n return Math.round(value * 100) / 100\n}\n\nconst isRegularHours = (compensationName: string): boolean => {\n return compensationName.toLowerCase() === REGULAR_HOURS_NAME\n}\n\nconst PAY_PERIOD_HOURS_MAPPINGS: Record<string, number> = {\n Daily: 8.0,\n 'Every week': 40.0,\n 'Every other week': 80.0,\n 'Twice per month': 86.666667,\n Monthly: 173.333333,\n Quarterly: 520.0,\n Semiannually: 1040.0,\n Annually: 2080.0,\n}\n\n/**\n * Formats an employee's primary-job pay rate into a localized display string.\n *\n * @remarks\n * Returns `null` when the employee has no jobs, the primary job has no compensations, or the rate is missing\n * or zero.\n *\n * @param args - The employee, translation function, and locale to format against.\n * @returns The formatted pay-rate string, or `null` when no usable rate is available.\n * @internal\n */\nexport const formatEmployeePayRate = ({\n employee,\n t,\n locale = 'en-US',\n}: {\n employee?: Employee\n t: TFunction\n locale?: string\n}) => {\n if (!employee?.jobs) {\n return null\n }\n\n const primaryJob = getPrimaryJob(employee)\n if (!primaryJob?.compensations) {\n return null\n }\n\n const jobCompensation = primaryJob.compensations[0]\n if (!jobCompensation) {\n return null\n }\n if (!jobCompensation.rate || parseFloat(jobCompensation.rate) === 0) {\n return null\n }\n\n const rate = parseFloat(jobCompensation.rate)\n const paymentUnit = jobCompensation.paymentUnit || 'Hour'\n\n return formatPayRate({ rate, paymentUnit, t, locale })\n}\n\n/**\n * Returns a memoized formatter that produces a localized pay-rate string from an employee's primary job.\n *\n * @returns A callback that takes an `Employee` and returns the formatted pay-rate string, or `null` when the\n * employee has no usable primary-job compensation.\n * @internal\n */\nexport const useFormatEmployeePayRate = () => {\n const { t } = useTranslation('common')\n const { locale } = useLocale()\n\n return useCallback(\n (employee?: Employee) => {\n return formatEmployeePayRate({ employee, t, locale })\n },\n [t, locale],\n )\n}\n\n/**\n * Sums hourly-compensation rows named `'regular hours'`.\n *\n * @param compensation - The employee compensation entry.\n * @returns The total regular hours worked, or `0` when none are recorded.\n * @internal\n */\nexport const getRegularHours = (compensation: EmployeeCompensationInput) => {\n if (!compensation.hourlyCompensations) return 0\n\n return compensation.hourlyCompensations\n .filter(hourlyCompensation => hourlyCompensation.name?.toLowerCase() === 'regular hours')\n .reduce((sum, hourlyCompensation) => sum + parseFloat(hourlyCompensation.hours || '0'), 0)\n}\n\n/**\n * Sums the overtime hours (multiplier greater than `1`) from an employee compensation.\n *\n * @param compensation - The employee compensation entry.\n * @returns The total overtime hours, or `0` when the compensation is excluded or has none.\n * @internal\n */\nexport function getOvertimeHours(compensation: EmployeeCompensationInput) {\n if (!compensation.hourlyCompensations || compensation.excluded) {\n return 0\n }\n\n return compensation.hourlyCompensations\n .filter(hourlyCompensation => Number(hourlyCompensation.compensationMultiplier) > 1)\n .reduce((sum, hourlyCompensation) => sum + parseFloat(hourlyCompensation.hours || '0'), 0)\n}\n\n/**\n * Sums the paid-time-off hours from an employee compensation.\n *\n * @param compensation - The employee compensation entry.\n * @returns The total PTO hours, or `0` when none are recorded.\n * @internal\n */\nexport const getTotalPtoHours = (compensation: EmployeeCompensationInput) => {\n if (!compensation.paidTimeOff) {\n return 0\n }\n return compensation.paidTimeOff.reduce((sum, pto) => sum + parseFloat(pto.hours || '0'), 0)\n}\n\n/**\n * Sums fixed-compensation amounts excluding reimbursements and minimum-wage adjustments.\n *\n * @param compensation - The employee compensation entry.\n * @returns The total additional earnings amount, or `0` when none qualify.\n * @internal\n */\nexport const getAdditionalEarnings = (compensation: EmployeeCompensationInput) => {\n if (!compensation.fixedCompensations) {\n return 0\n }\n\n return compensation.fixedCompensations\n .filter(fixedCompensation => {\n const name = fixedCompensation.name?.toLowerCase() || ''\n const amount = parseFloat(fixedCompensation.amount || '0')\n return name !== 'reimbursement' && name !== 'minimum wage adjustment' && amount > 0\n })\n .reduce((sum, fixedCompensation) => sum + parseFloat(fixedCompensation.amount || '0'), 0)\n}\n\n/**\n * Returns the total reimbursement amount for an employee compensation.\n *\n * @remarks\n * Prefers the explicit `reimbursements` array when present; falls back to a fixed-compensation row named\n * `'Reimbursement'` for older payroll shapes.\n *\n * @param compensation - The employee compensation entry.\n * @returns The summed reimbursement amount, or `0` when none.\n * @internal\n */\nexport const getReimbursements = (compensation: EmployeeCompensationInput) => {\n if (compensation.reimbursements && compensation.reimbursements.length > 0) {\n return compensation.reimbursements.reduce(\n (sum, reimbursement) => sum + parseFloat(reimbursement.amount || '0'),\n 0,\n )\n }\n\n if (!compensation.fixedCompensations) {\n return 0\n }\n\n const reimbursementComp = compensation.fixedCompensations.find(\n fixedCompensation => fixedCompensation.name?.toLowerCase() === 'reimbursement',\n )\n return reimbursementComp ? parseFloat(reimbursementComp.amount || '0') : 0\n}\n\n/**\n * Normalizes a reimbursement list for submission to the v2025-11-15 API.\n *\n * @remarks\n * - Drops named rows that would be no-ops on the server (zero amount with no existing uuid).\n * - Drops named rows with an existing uuid and zero amount — these are removals, and the backend's\n * `replace_itemized_reimbursements` deletes any persisted reimbursement whose uuid is omitted from the\n * incoming list.\n * - Consolidates multiple unnamed (description-less) rows into a single unnamed entry, since the API rejects\n * more than one unnamed reimbursement per employee.\n * - When the consolidated unnamed total is zero, sends no unnamed entry at all. The backend's full-replace\n * semantics then delete any persisted unnamed entry (unnamed entries never have uuids, so this is the only\n * way to remove them).\n * - Maps the read shape (`description: string | null`) to the write shape (`description?: string`), omitting\n * the field when there is no description.\n *\n * @param reimbursements - The reimbursements pulled from the prepared payroll.\n * @returns The normalized reimbursements ready to send on a payroll update.\n * @internal\n */\nexport const cleanupReimbursements = (\n reimbursements: Reimbursement[],\n): PayrollUpdateReimbursements[] => {\n const consolidated: PayrollUpdateReimbursements[] = []\n let unnamedTotal = 0\n\n reimbursements.forEach(reimbursement => {\n const amount = reimbursement.amount\n const numericAmount = parseFloat(amount || '0')\n const description = reimbursement.description?.trim() || ''\n const uuid = reimbursement.uuid ?? undefined\n\n if (description === '') {\n unnamedTotal += numericAmount\n return\n }\n\n if (numericAmount === 0 && !uuid) {\n return\n }\n\n consolidated.push({\n amount,\n description,\n ...(uuid ? { uuid } : {}),\n })\n })\n\n if (unnamedTotal > 0) {\n consolidated.push({\n amount: unnamedTotal.toFixed(2),\n })\n }\n\n return consolidated\n}\n\n/**\n * Formats an hours value for display, rounding to two decimals and ensuring whole numbers render with `.0`.\n *\n * @param hours - The hours value to format.\n * @returns A string like `'40.0'` or `'37.25'`.\n * @internal\n */\nexport const formatHoursDisplay = (hours: number): string => {\n const rounded = roundToTwoDecimals(hours)\n\n if (rounded % 1 === 0) {\n return `${rounded}.0`\n }\n\n return rounded.toString()\n}\n\nconst getHoursInPayPeriod = (paySchedule: PayScheduleObject): number => {\n if (!paySchedule.frequency) {\n return 0\n }\n\n return PAY_PERIOD_HOURS_MAPPINGS[paySchedule.frequency] || 0\n}\n\nconst getEffectiveCompensation = (\n compensations: Compensation[],\n effectiveDate: Date,\n): Compensation | null => {\n if (!compensations.length) return null\n\n const sorted = [...compensations].sort(\n (a, b) =>\n (a.effectiveDate ? new Date(a.effectiveDate).getTime() : 0) -\n (b.effectiveDate ? new Date(b.effectiveDate).getTime() : 0),\n )\n\n for (let i = sorted.length - 1; i >= 0; i--) {\n const currentDateString = sorted[i]?.effectiveDate\n const currentDate = currentDateString ? new Date(currentDateString) : null\n if (currentDate && currentDate <= effectiveDate) {\n return sorted[i] || null\n }\n }\n\n return sorted[0] || null\n}\n\nconst getEffectiveMinimumWage = (\n minimumWages: MinimumWages[],\n effectiveDate: Date,\n): MinimumWages | null => {\n if (!minimumWages.length) return null\n\n const sorted = [...minimumWages].sort(\n (a, b) =>\n (a.effectiveDate ? new Date(a.effectiveDate).getTime() : 0) -\n (b.effectiveDate ? new Date(b.effectiveDate).getTime() : 0),\n )\n\n for (let i = sorted.length - 1; i >= 0; i--) {\n const currentDateString = sorted[i]?.effectiveDate\n const currentDate = currentDateString ? new Date(currentDateString) : null\n if (currentDate && currentDate <= effectiveDate) {\n return sorted[i] || null\n }\n }\n\n return sorted[0] || null\n}\n\nconst isSalaried = (compensation: Compensation): boolean => {\n return compensation.flsaStatus === 'Exempt' || compensation.flsaStatus === 'Salaried Nonexempt'\n}\n\n/**\n * Whether an FLSA status is eligible for regular-rate-of-pay overtime.\n *\n * @remarks\n * Only the nonexempt family (`Nonexempt`, `Salaried Nonexempt`,\n * `Commission Only Nonexempt`) earns overtime premiums, so only those statuses\n * warrant per-workweek breakdowns. `Exempt`, `Owner`, and\n * `Commission Only Exempt` are never overtime-eligible. An unknown status\n * returns `false` (treat as flat, never show meaningless workweek columns).\n *\n * @param flsaStatus - The employee's FLSA status, e.g. from `hourlyCompensations[].flsaStatus`.\n * @returns `true` only for the three nonexempt statuses.\n * @internal\n */\nexport const isOvertimeEligibleFlsaStatus = (flsaStatus: string | undefined): boolean =>\n flsaStatus === FlsaStatus.NONEXEMPT ||\n flsaStatus === FlsaStatus.SALARIED_NONEXEMPT ||\n flsaStatus === FlsaStatus.COMMISSION_ONLY_NONEXEMPT\n\nconst getTotalTipCompensations = (fixedCompensations: PayrollShowFixedCompensations[]): number => {\n if (!fixedCompensations.length) return 0\n\n return fixedCompensations\n .filter(fixedCompensation => {\n const name = fixedCompensation.name?.toLowerCase()\n const amount = parseFloat(fixedCompensation.amount || '0')\n return (name === 'paycheck tips' || name === 'cash tips') && amount > 0\n })\n .reduce((sum, fixedCompensation) => sum + parseFloat(fixedCompensation.amount || '0'), 0)\n}\n\nconst calculateHourlyRate = (compensation: Compensation): number => {\n const rate = parseFloat(compensation.rate || '0')\n const paymentUnit = compensation.paymentUnit || 'Hour'\n\n switch (paymentUnit) {\n case 'Hour':\n return rate\n case 'Year':\n return rate / 2080 // 52 weeks * 40 hours\n case 'Month':\n return rate / 173.333333\n case 'Week':\n return rate / 40\n case 'Paycheck':\n return 0 // Paycheck rate is 0 for hourly calculation\n default:\n return rate\n }\n}\n\nconst getHourlyRateForJob = (employee: Employee, jobUuid: string, effectiveDate: Date): number => {\n const job = employee.jobs?.find(j => j.uuid === jobUuid)\n if (!job?.compensations) {\n return 0\n }\n\n const compensation = getEffectiveCompensation(job.compensations, effectiveDate)\n return compensation ? calculateHourlyRate(compensation) : 0\n}\n\nconst getPrimaryHourlyRate = (employee: Employee, effectiveDate: Date): number => {\n const primaryJob = getPrimaryJob(employee)\n if (!primaryJob?.compensations) {\n return 0\n }\n\n const compensation = getEffectiveCompensation(primaryJob.compensations, effectiveDate)\n return compensation ? calculateHourlyRate(compensation) : 0\n}\n\nconst getTotalOutstandingPtoHours = (compensation: EmployeeCompensationInput): number => {\n if (!compensation.paidTimeOff) {\n return 0\n }\n\n return compensation.paidTimeOff.reduce(\n (sum, paidTimeOff) => sum + parseFloat(paidTimeOff.finalPayoutUnusedHoursInput || '0'),\n 0,\n )\n}\n\nconst getPtoHours = (\n compensation: EmployeeCompensationInput,\n isSalariedWithExpectedHours: boolean,\n hoursInPayPeriod: number,\n offCycle: boolean,\n): number => {\n const regularPtoHours = getTotalPtoHours(compensation)\n\n if (offCycle) {\n const outstandingPtoHours = getTotalOutstandingPtoHours(compensation)\n return regularPtoHours + outstandingPtoHours\n }\n\n if (isSalariedWithExpectedHours) {\n return Math.min(hoursInPayPeriod, regularPtoHours)\n }\n\n return regularPtoHours\n}\n\nconst calculateMinimumWageAdjustment = (\n primaryCompensation: Compensation,\n compensation: EmployeeCompensationInput,\n effectiveDate: Date,\n): number => {\n if (!primaryCompensation.adjustForMinimumWage) return 0\n\n const effectiveMinWage = getEffectiveMinimumWage(\n primaryCompensation.minimumWages || [],\n effectiveDate,\n )\n if (!effectiveMinWage) {\n return 0\n }\n\n const totalHours =\n compensation.hourlyCompensations?.reduce(\n (sum, hourlyCompensation) => sum + parseFloat(hourlyCompensation.hours || '0'),\n 0,\n ) || 0\n\n const hourlyRate = calculateHourlyRate(primaryCompensation)\n\n const totalTipCredit = (parseFloat(effectiveMinWage.wage || '0') - hourlyRate) * totalHours\n const totalTips = getTotalTipCompensations(compensation.fixedCompensations || [])\n\n return Math.max(0, totalTipCredit - totalTips)\n}\n\nconst calculateRegularPlusOvertimePay = (\n compensation: EmployeeCompensationInput,\n employee: Employee,\n effectiveDate: Date,\n isSalariedWithExpectedHours: boolean,\n hoursInPayPeriod: number,\n ptoHours: number,\n isOffCycle: boolean,\n): number => {\n if (!isOffCycle && isSalariedWithExpectedHours) {\n const primaryHourlyRate = getPrimaryHourlyRate(employee, effectiveDate)\n return primaryHourlyRate * (hoursInPayPeriod - ptoHours)\n }\n\n if (!compensation.hourlyCompensations || !employee.jobs) {\n return 0\n }\n\n const regularRatePay = compensation.hourlyCompensations.reduce((sum, hc) => {\n const hours = parseFloat(hc.hours || '0')\n const hourlyRate = getHourlyRateForJob(employee, hc.jobUuid || '', effectiveDate)\n return sum + hours * hourlyRate\n }, 0)\n\n const totalHours = compensation.hourlyCompensations.reduce((sum, hc) => {\n return sum + parseFloat(hc.hours || '0')\n }, 0)\n\n if (totalHours === 0) return regularRatePay\n\n const overtimeWeightedRate = roundToSixDecimals(regularRatePay / totalHours)\n\n // Calculate overtime pay for non-regular hours\n const overtimePay = compensation.hourlyCompensations\n .filter(hc => !isRegularHours(hc.name || ''))\n .reduce((sum, hc) => {\n const hours = parseFloat(hc.hours || '0')\n const multiplier = hc.compensationMultiplier || 1\n return sum + hours * overtimeWeightedRate * (multiplier - 1)\n }, 0)\n\n return regularRatePay + overtimePay\n}\n\nconst calculatePtoPay = (\n compensation: EmployeeCompensationInput,\n employee: Employee,\n effectiveDate: Date,\n isSalariedWithExpectedHours: boolean,\n hoursInPayPeriod: number,\n offCycle: boolean,\n): number => {\n const ptoHours = getPtoHours(\n compensation,\n isSalariedWithExpectedHours,\n hoursInPayPeriod,\n offCycle,\n )\n const primaryHourlyRate = getPrimaryHourlyRate(employee, effectiveDate)\n return ptoHours * primaryHourlyRate\n}\n\nconst isSalariedWithPayPeriodExpectedHours = (\n compensation: EmployeeCompensationInput,\n isSalaried: boolean,\n hoursInPayPeriod: number,\n): boolean => {\n if (!isSalaried) return false\n\n const regularHourlyCompensation = compensation.hourlyCompensations?.find(hourlyCompensation =>\n isRegularHours(hourlyCompensation.name || ''),\n )\n\n if (!regularHourlyCompensation) return false\n\n const regularHours = parseFloat(regularHourlyCompensation.hours || '0')\n return regularHours === hoursInPayPeriod\n}\n\n/**\n * Calculates an employee's gross pay for a payroll, combining regular and overtime pay,\n * additional earnings, PTO pay, and any minimum-wage adjustment.\n *\n * @remarks\n * Returns `0` when the compensation is excluded or the employee has no primary job compensation effective\n * on the given date. The result is rounded to two decimal places.\n *\n * @param compensation - The employee compensation entry from the payroll.\n * @param employee - The employee record (used to look up jobs and effective compensations).\n * @param compensationEffectiveDateString - ISO date used to resolve the effective compensation; defaults to now.\n * @param paySchedule - The pay schedule, used to derive expected hours per pay period.\n * @param payrollCategory - The payroll category; off-cycle categories change how PTO hours are summed.\n * @returns The gross pay amount.\n * @internal\n */\nexport const calculateGrossPay = (\n compensation: EmployeeCompensationInput,\n employee: Employee,\n compensationEffectiveDateString?: string,\n paySchedule?: PayScheduleObject,\n payrollCategory: PayrollCategory = PayrollCategory.Regular,\n): number => {\n if (compensation.excluded) {\n return 0\n }\n\n const compensationEffectiveDate = compensationEffectiveDateString\n ? new Date(compensationEffectiveDateString)\n : new Date()\n\n const primaryJob = getPrimaryJob(employee)\n if (!primaryJob?.compensations) {\n return 0\n }\n\n const primaryCompensation = getEffectiveCompensation(\n primaryJob.compensations,\n compensationEffectiveDate,\n )\n\n if (!primaryCompensation) {\n return 0\n }\n\n const salaried = isSalaried(primaryCompensation)\n const hoursInPayPeriod = paySchedule ? getHoursInPayPeriod(paySchedule) : 0\n\n const isSalariedWithExpectedHours = isSalariedWithPayPeriodExpectedHours(\n compensation,\n salaried,\n hoursInPayPeriod,\n )\n\n const offCycle = isOffCyclePayroll(payrollCategory)\n\n const ptoHours = getPtoHours(\n compensation,\n isSalariedWithExpectedHours,\n hoursInPayPeriod,\n offCycle,\n )\n\n const regularPlusOvertimePay = calculateRegularPlusOvertimePay(\n compensation,\n employee,\n compensationEffectiveDate,\n isSalariedWithExpectedHours,\n hoursInPayPeriod,\n ptoHours,\n offCycle,\n )\n\n const fixedPay = getAdditionalEarnings(compensation)\n const ptoPay = calculatePtoPay(\n compensation,\n employee,\n compensationEffectiveDate,\n isSalariedWithExpectedHours,\n hoursInPayPeriod,\n offCycle,\n )\n const minimumWageAdjustment = calculateMinimumWageAdjustment(\n primaryCompensation,\n compensation,\n compensationEffectiveDate,\n )\n\n const total = regularPlusOvertimePay + fixedPay + ptoPay + minimumWageAdjustment\n return roundToTwoDecimals(total)\n}\n\n/**\n * Returns the high-level payroll type — `'External'`, `'Off-Cycle'`, or `'Regular'`.\n *\n * @param payroll - The payroll whose type to classify.\n * @returns The payroll type string.\n * @internal\n */\nexport const getPayrollType = (payroll: {\n external?: boolean\n offCycle?: boolean\n}): PayrollType => {\n if (payroll.external) return 'External'\n if (payroll.offCycle) return 'Off-Cycle'\n return 'Regular'\n}\n\n/**\n * Returns whether an off-cycle reason indicates a dismissal payroll.\n *\n * @param offCycleReason - The payroll's off-cycle reason string.\n * @returns `true` when the reason matches the dismissed-employee reason.\n * @internal\n */\nexport const isDismissalPayroll = (offCycleReason?: string | null): boolean =>\n offCycleReason === OffCycleReasonType.DismissedEmployee\n\n/**\n * Returns a formatted pay-period range, falling back to the formatted check date when the\n * payroll has no pay period.\n *\n * @remarks\n * Tax reconciliation payrolls always have a null `pay_period`, so anywhere a pay-period date\n * is used to identify a payroll on screen needs this fallback to avoid rendering blank space.\n *\n * @param payroll - The payroll to derive a date label for.\n * @param dateFormatter - The date formatter returned by {@link useDateFormatter}.\n * @returns The formatted pay-period range, or the formatted check date when no pay period exists.\n * @internal\n */\nexport const getPayPeriodOrCheckDateLabel = (\n payroll: {\n payPeriod?: { startDate?: string | null; endDate?: string | null } | null\n checkDate?: string | Date | null\n },\n dateFormatter: ReturnType<typeof useDateFormatter>,\n): string => {\n const range = dateFormatter.formatPayPeriodRange(\n payroll.payPeriod?.startDate,\n payroll.payPeriod?.endDate,\n )\n return range || dateFormatter.formatShortWithYear(payroll.checkDate)\n}\n\nconst OFF_CYCLE_REASON_LABELS: Record<string, string> = {\n Bonus: 'Bonus',\n Correction: 'Correction',\n 'Transition from old pay schedule': 'Transition',\n 'Dismissed employee': 'Dismissal',\n 'Hired employee': 'New Hire',\n 'Benefit reversal': 'Benefit Reversal',\n 'Wage correction': 'Wage Correction',\n 'Tax reconciliation': 'Tax Reconciliation',\n Reversal: 'Reversal',\n 'Disability insurance distribution': 'Disability Insurance',\n}\n\n/**\n * Returns a human-readable label describing the payroll type, mapping off-cycle reasons to display strings.\n *\n * @param payroll - The payroll whose type to describe.\n * @returns `'External'`, `'Regular'`, `'Off-Cycle'`, or a label derived from the off-cycle reason\n * (e.g. `'Bonus'`, `'Dismissal'`).\n * @internal\n */\nexport const getPayrollTypeLabel = (payroll: {\n external?: boolean\n offCycle?: boolean\n offCycleReason?: string | null\n}): string => {\n if (payroll.external) return 'External'\n if (payroll.offCycle && payroll.offCycleReason) {\n return OFF_CYCLE_REASON_LABELS[payroll.offCycleReason] ?? payroll.offCycleReason\n }\n if (payroll.offCycle) return 'Off-Cycle'\n return 'Regular'\n}\n\n/**\n * Merges existing fixed compensations with placeholder entries for any compensation types the employee\n * doesn't yet have, then filters out excluded types and sorts the result alphabetically.\n *\n * @remarks\n * Owners (FLSA status `Owner`) never receive placeholder entries. Placeholders are added with `amount: '0.00'`\n * and the supplied `primaryJobUuid`.\n *\n * @param options - Inputs controlling which placeholder entries to add and which types to exclude.\n * @returns The merged, filtered, and sorted list of fixed compensations.\n * @internal\n */\nexport const getAdditionalEarningsCompensations = ({\n flsaStatus,\n existingFixedCompensations = [],\n primaryJobUuid,\n fixedCompensationTypes = [],\n excludedTypes = [],\n}: {\n flsaStatus: string | undefined\n existingFixedCompensations?: FixedCompensations[]\n primaryJobUuid?: string\n fixedCompensationTypes?: PayrollFixedCompensationTypesType[]\n excludedTypes?: string[]\n}): FixedCompensations[] => {\n const allFixedCompensations = [...existingFixedCompensations]\n\n if (flsaStatus !== FlsaStatus.OWNER && primaryJobUuid && fixedCompensationTypes.length > 0) {\n const compensationTypeNames = fixedCompensationTypes\n .map(type => type.name)\n .filter(Boolean) as string[]\n\n compensationTypeNames.forEach(compensationName => {\n const exists = allFixedCompensations.some(\n comp => comp.name?.toLowerCase() === compensationName.toLowerCase(),\n )\n\n if (!exists) {\n allFixedCompensations.push({\n name: compensationName,\n amount: '0.00',\n jobUuid: primaryJobUuid,\n })\n }\n })\n }\n\n // Filter and sort additional earnings (exclude specified types)\n return allFixedCompensations\n .filter(comp => comp.name && !excludedTypes.includes(comp.name))\n .sort((a, b) => (a.name || '').localeCompare(b.name || ''))\n}\n\n/**\n * Sums gross pay, employer taxes, reimbursements, and benefits from a payroll's totals.\n *\n * @param payrollData - The payroll whose totals to sum.\n * @returns The total payroll cost, or `0` when `payrollData.totals` is missing.\n * @internal\n */\nexport const calculateTotalPayroll = (payrollData: Payroll) => {\n const totalPayroll = payrollData.totals\n ? Number(payrollData.totals.grossPay ?? 0) +\n Number(payrollData.totals.employerTaxes ?? 0) +\n Number(payrollData.totals.reimbursements ?? 0) +\n Number(payrollData.totals.benefits ?? 0)\n : 0\n\n return totalPayroll\n}\n\n/**\n * Converts a Date to Pacific Time considering Daylight Saving Time.\n * Returns the UTC offset in hours (e.g., -7 for PDT, -8 for PST).\n *\n * DST rules for Pacific Time:\n * - Starts: Second Sunday in March at 2:00 AM\n * - Ends: First Sunday in November at 2:00 AM\n */\nconst getPacificTimeOffset = (date: Date): number => {\n const year = date.getFullYear()\n\n const secondSundayMarch = new Date(year, 2, 1)\n secondSundayMarch.setDate(1 + (7 - secondSundayMarch.getDay()) + 7)\n\n const firstSundayNovember = new Date(year, 10, 1)\n firstSundayNovember.setDate(1 + ((7 - firstSundayNovember.getDay()) % 7))\n\n const isDST = date >= secondSundayMarch && date < firstSundayNovember\n return isDST ? -7 : -8\n}\n\n/**\n * Off-cycle reasons the cancel endpoint accepts. The API rejects any other reason, even when\n * `payrollStatusMeta.cancellable` is `true`.\n *\n * TODO: remove once the API's `cancellable` flag also checks the payroll type.\n */\nconst API_EDITABLE_OFF_CYCLE_REASONS = new Set<string>([\n OffCycleReasonType.Bonus,\n OffCycleReasonType.Correction,\n OffCycleReasonType.Adhoc,\n OffCycleReasonType.BenefitReversal,\n OffCycleReasonType.HiredEmployee,\n OffCycleReasonType.DismissedEmployee,\n OffCycleReasonType.TransitionFromOldPaySchedule,\n])\n\nconst isApiEditablePayrollType = (payroll: Payroll): boolean => {\n if (payroll.external) return false\n if (!payroll.offCycle) return true\n return !!payroll.offCycleReason && API_EDITABLE_OFF_CYCLE_REASONS.has(payroll.offCycleReason)\n}\n\n/**\n * Returns whether to show the cancel action for a payroll.\n *\n * @remarks\n * Shows cancel only when the API will accept it:\n *\n * - `payrollStatusMeta.cancellable` is `true`. A missing flag hides cancel, so fetch the payroll\n * with `payroll_status_meta`.\n * - The payroll is processed and not external.\n * - It is a regular payroll, or an off-cycle payroll with one of the reasons listed above. The\n * `cancellable` flag does not check the payroll type yet, so this helper does.\n * - It is before 4:00 PM PT on the `payrollDeadline` date, so a page left open past the cutoff\n * stops offering cancel.\n *\n * The API can still refuse if a tax filing was already sent. The payroll data doesn't show that.\n *\n * @param payroll - The payroll to check, fetched with `payroll_status_meta`.\n * @returns `true` if cancel should be shown.\n * @internal\n */\nexport const canCancelPayroll = (payroll: Payroll): boolean => {\n if (payroll.payrollStatusMeta?.cancellable !== true) {\n return false\n }\n\n if (!payroll.processed) {\n return false\n }\n\n if (!isApiEditablePayrollType(payroll)) {\n return false\n }\n\n if (!payroll.payrollDeadline) {\n return false\n }\n\n const now = new Date()\n const deadline = new Date(payroll.payrollDeadline)\n\n const nowInPT = new Date(now.getTime() + getPacificTimeOffset(now) * MS_PER_HOUR)\n const deadlineInPT = new Date(deadline.getTime() + getPacificTimeOffset(deadline) * MS_PER_HOUR)\n\n const cutoffTime = new Date(deadlineInPT)\n cutoffTime.setUTCHours(16, 0, 0, 0)\n\n if (nowInPT >= cutoffTime) {\n return false\n }\n\n return true\n}\n"],"names":["REGULAR_HOURS_NAME","getPrimaryJob","employee","job","roundToSixDecimals","value","roundToTwoDecimals","isRegularHours","compensationName","PAY_PERIOD_HOURS_MAPPINGS","formatEmployeePayRate","locale","primaryJob","jobCompensation","rate","paymentUnit","formatPayRate","useFormatEmployeePayRate","t","useTranslation","useLocale","useCallback","getRegularHours","compensation","hourlyCompensation","sum","getOvertimeHours","getTotalPtoHours","pto","getAdditionalEarnings","fixedCompensation","name","amount","getReimbursements","reimbursement","reimbursementComp","cleanupReimbursements","reimbursements","consolidated","unnamedTotal","numericAmount","description","uuid","formatHoursDisplay","hours","rounded","getHoursInPayPeriod","paySchedule","getEffectiveCompensation","compensations","effectiveDate","sorted","a","b","i","currentDateString","currentDate","getEffectiveMinimumWage","minimumWages","isSalaried","isOvertimeEligibleFlsaStatus","flsaStatus","FlsaStatus","getTotalTipCompensations","fixedCompensations","calculateHourlyRate","getHourlyRateForJob","jobUuid","j","getPrimaryHourlyRate","getTotalOutstandingPtoHours","paidTimeOff","getPtoHours","isSalariedWithExpectedHours","hoursInPayPeriod","offCycle","regularPtoHours","outstandingPtoHours","calculateMinimumWageAdjustment","primaryCompensation","effectiveMinWage","totalHours","hourlyRate","totalTipCredit","totalTips","calculateRegularPlusOvertimePay","ptoHours","isOffCycle","regularRatePay","hc","overtimeWeightedRate","overtimePay","multiplier","calculatePtoPay","primaryHourlyRate","isSalariedWithPayPeriodExpectedHours","regularHourlyCompensation","calculateGrossPay","compensationEffectiveDateString","payrollCategory","PayrollCategory","compensationEffectiveDate","salaried","isOffCyclePayroll","regularPlusOvertimePay","fixedPay","ptoPay","minimumWageAdjustment","total","isDismissalPayroll","offCycleReason","OffCycleReasonType","getPayPeriodOrCheckDateLabel","payroll","dateFormatter","OFF_CYCLE_REASON_LABELS","getPayrollTypeLabel","getAdditionalEarningsCompensations","existingFixedCompensations","primaryJobUuid","fixedCompensationTypes","excludedTypes","allFixedCompensations","type","comp","calculateTotalPayroll","payrollData","getPacificTimeOffset","date","year","secondSundayMarch","firstSundayNovember","API_EDITABLE_OFF_CYCLE_REASONS","isApiEditablePayrollType","canCancelPayroll","now","deadline","nowInPT","MS_PER_HOUR","deadlineInPT","cutoffTime"],"mappings":";;;;;;;;AAyBA,MAAMA,IAAqB,iBAiBrBC,IAAgB,CAACC,MACdA,EAAS,MAAM,KAAK,CAAAC,MAAOA,EAAI,OAAO,KAAKD,EAAS,OAAO,CAAC,KAAK,MAGpEE,IAAqB,CAACC,MACnB,KAAK,MAAMA,IAAQ,GAAS,IAAI,KAGnCC,IAAqB,CAACD,MACnB,KAAK,MAAMA,IAAQ,GAAG,IAAI,KAG7BE,IAAiB,CAACC,MACfA,EA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,IAAIE,CAAW,GAEzFE,IAAa,IAAI,KAAKD,CAAY;AAGxC,SAFAC,EAAW,YAAY,IAAI,GAAG,GAAG,CAAC,GAE9B,EAAAH,KAAWG;AAKjB;"}
1
+ {"version":3,"file":"helpers.js","sources":["../../../src/components/Payroll/helpers.ts"],"sourcesContent":["import type { Employee } from '@gusto/embedded-api/models/components/employee'\nimport {\n type PayrollShowFixedCompensations,\n OffCycleReasonType,\n} from '@gusto/embedded-api/models/components/unprocessedpayroll'\nimport type {\n FixedCompensations,\n Reimbursements as Reimbursement,\n} from '@gusto/embedded-api/models/components/payrollemployeecompensationstype'\nimport type { PayrollUpdateReimbursements } from '@gusto/embedded-api/models/components/payrollupdate'\nimport type { PayrollFixedCompensationTypesType } from '@gusto/embedded-api/models/components/payrollfixedcompensationtypestype'\nimport { useCallback } from 'react'\nimport type { TFunction } from 'i18next'\nimport { useTranslation } from 'react-i18next'\nimport type { PayScheduleShow as PayScheduleObject } from '@gusto/embedded-api/models/components/payschedulelistitem'\nimport type { Compensation, MinimumWages } from '@gusto/embedded-api/models/components/compensation'\nimport type { PayrollEmployeeCompensationsType } from '@gusto/embedded-api/models/components/payrollemployeecompensationstype'\nimport type { Payroll } from '@gusto/embedded-api/models/components/unprocessedpayroll'\nimport type { PayrollType } from './PayrollList/types'\nimport { PayrollCategory, isOffCyclePayroll } from './payrollTypes'\nimport { formatPayRate } from '@/helpers/formattedStrings'\nimport { useLocale } from '@/contexts/LocaleProvider/useLocale'\nimport { FlsaStatus } from '@/shared/constants'\nimport { MS_PER_HOUR } from '@/helpers/dateFormatting'\nimport type { useDateFormatter } from '@/hooks/useDateFormatter'\nconst REGULAR_HOURS_NAME = 'regular hours'\n\n/**\n * The compensation fields the payroll math helpers operate on.\n *\n * @remarks\n * These helpers run over both compensation representations the API returns: the\n * prepared (base) shape used when editing a payroll and the calculated (show)\n * shape rendered after calculation. The two are interchangeable for every field\n * read here and differ only on `deductions`, which no helper touches. Omitting\n * `deductions` lets a single input type accept either shape without a cast.\n *\n * @internal\n */\ntype EmployeeCompensationInput = Omit<PayrollEmployeeCompensationsType, 'deductions'>\n\n// Utility to get the primary job from an employee\nconst getPrimaryJob = (employee: Employee) => {\n return employee.jobs?.find(job => job.primary) || employee.jobs?.[0] || null\n}\n\nconst roundToSixDecimals = (value: number): number => {\n return Math.round(value * 1_000_000) / 1_000_000\n}\n\nconst roundToTwoDecimals = (value: number): number => {\n return Math.round(value * 100) / 100\n}\n\nconst isRegularHours = (compensationName: string): boolean => {\n return compensationName.toLowerCase() === REGULAR_HOURS_NAME\n}\n\nconst PAY_PERIOD_HOURS_MAPPINGS: Record<string, number> = {\n Daily: 8.0,\n 'Every week': 40.0,\n 'Every other week': 80.0,\n 'Twice per month': 86.666667,\n Monthly: 173.333333,\n Quarterly: 520.0,\n Semiannually: 1040.0,\n Annually: 2080.0,\n}\n\n/**\n * Formats an employee's primary-job pay rate into a localized display string.\n *\n * @remarks\n * Returns `null` when the employee has no jobs, the primary job has no compensations, or the rate is missing\n * or zero.\n *\n * @param args - The employee, translation function, and locale to format against.\n * @returns The formatted pay-rate string, or `null` when no usable rate is available.\n * @internal\n */\nexport const formatEmployeePayRate = ({\n employee,\n t,\n locale = 'en-US',\n}: {\n employee?: Employee\n t: TFunction\n locale?: string\n}) => {\n if (!employee?.jobs) {\n return null\n }\n\n const primaryJob = getPrimaryJob(employee)\n if (!primaryJob?.compensations) {\n return null\n }\n\n const jobCompensation = primaryJob.compensations[0]\n if (!jobCompensation) {\n return null\n }\n if (!jobCompensation.rate || parseFloat(jobCompensation.rate) === 0) {\n return null\n }\n\n const rate = parseFloat(jobCompensation.rate)\n const paymentUnit = jobCompensation.paymentUnit || 'Hour'\n\n return formatPayRate({ rate, paymentUnit, t, locale })\n}\n\n/**\n * Returns a memoized formatter that produces a localized pay-rate string from an employee's primary job.\n *\n * @returns A callback that takes an `Employee` and returns the formatted pay-rate string, or `null` when the\n * employee has no usable primary-job compensation.\n * @internal\n */\nexport const useFormatEmployeePayRate = () => {\n const { t } = useTranslation('common')\n const { locale } = useLocale()\n\n return useCallback(\n (employee?: Employee) => {\n return formatEmployeePayRate({ employee, t, locale })\n },\n [t, locale],\n )\n}\n\n/**\n * Sums hourly-compensation rows named `'regular hours'`.\n *\n * @param compensation - The employee compensation entry.\n * @returns The total regular hours worked, or `0` when none are recorded.\n * @internal\n */\nexport const getRegularHours = (compensation: EmployeeCompensationInput) => {\n if (!compensation.hourlyCompensations) return 0\n\n return compensation.hourlyCompensations\n .filter(hourlyCompensation => hourlyCompensation.name?.toLowerCase() === 'regular hours')\n .reduce((sum, hourlyCompensation) => sum + parseFloat(hourlyCompensation.hours || '0'), 0)\n}\n\n/**\n * Sums the overtime hours (multiplier greater than `1`) from an employee compensation.\n *\n * @param compensation - The employee compensation entry.\n * @returns The total overtime hours, or `0` when the compensation is excluded or has none.\n * @internal\n */\nexport function getOvertimeHours(compensation: EmployeeCompensationInput) {\n if (!compensation.hourlyCompensations || compensation.excluded) {\n return 0\n }\n\n return compensation.hourlyCompensations\n .filter(hourlyCompensation => Number(hourlyCompensation.compensationMultiplier) > 1)\n .reduce((sum, hourlyCompensation) => sum + parseFloat(hourlyCompensation.hours || '0'), 0)\n}\n\n/**\n * Sums the paid-time-off hours from an employee compensation.\n *\n * @param compensation - The employee compensation entry.\n * @returns The total PTO hours, or `0` when none are recorded.\n * @internal\n */\nexport const getTotalPtoHours = (compensation: EmployeeCompensationInput) => {\n if (!compensation.paidTimeOff) {\n return 0\n }\n return compensation.paidTimeOff.reduce((sum, pto) => sum + parseFloat(pto.hours || '0'), 0)\n}\n\n/**\n * Sums fixed-compensation amounts excluding reimbursements and minimum-wage adjustments.\n *\n * @param compensation - The employee compensation entry.\n * @returns The total additional earnings amount, or `0` when none qualify.\n * @internal\n */\nexport const getAdditionalEarnings = (compensation: EmployeeCompensationInput) => {\n if (!compensation.fixedCompensations) {\n return 0\n }\n\n return compensation.fixedCompensations\n .filter(fixedCompensation => {\n const name = fixedCompensation.name?.toLowerCase() || ''\n const amount = parseFloat(fixedCompensation.amount || '0')\n return name !== 'reimbursement' && name !== 'minimum wage adjustment' && amount > 0\n })\n .reduce((sum, fixedCompensation) => sum + parseFloat(fixedCompensation.amount || '0'), 0)\n}\n\n/**\n * Returns the total reimbursement amount for an employee compensation.\n *\n * @remarks\n * Prefers the explicit `reimbursements` array when present; falls back to a fixed-compensation row named\n * `'Reimbursement'` for older payroll shapes.\n *\n * @param compensation - The employee compensation entry.\n * @returns The summed reimbursement amount, or `0` when none.\n * @internal\n */\nexport const getReimbursements = (compensation: EmployeeCompensationInput) => {\n if (compensation.reimbursements && compensation.reimbursements.length > 0) {\n return compensation.reimbursements.reduce(\n (sum, reimbursement) => sum + parseFloat(reimbursement.amount || '0'),\n 0,\n )\n }\n\n if (!compensation.fixedCompensations) {\n return 0\n }\n\n const reimbursementComp = compensation.fixedCompensations.find(\n fixedCompensation => fixedCompensation.name?.toLowerCase() === 'reimbursement',\n )\n return reimbursementComp ? parseFloat(reimbursementComp.amount || '0') : 0\n}\n\n/**\n * Normalizes a reimbursement list for submission to the v2025-11-15 API.\n *\n * @remarks\n * - Drops named rows that would be no-ops on the server (zero amount with no existing uuid).\n * - Drops named rows with an existing uuid and zero amount — these are removals, and the backend's\n * `replace_itemized_reimbursements` deletes any persisted reimbursement whose uuid is omitted from the\n * incoming list.\n * - Consolidates multiple unnamed (description-less) rows into a single unnamed entry, since the API rejects\n * more than one unnamed reimbursement per employee.\n * - When the consolidated unnamed total is zero, sends no unnamed entry at all. The backend's full-replace\n * semantics then delete any persisted unnamed entry (unnamed entries never have uuids, so this is the only\n * way to remove them).\n * - Maps the read shape (`description: string | null`) to the write shape (`description?: string`), omitting\n * the field when there is no description.\n *\n * @param reimbursements - The reimbursements pulled from the prepared payroll.\n * @returns The normalized reimbursements ready to send on a payroll update.\n * @internal\n */\nexport const cleanupReimbursements = (\n reimbursements: Reimbursement[],\n): PayrollUpdateReimbursements[] => {\n const consolidated: PayrollUpdateReimbursements[] = []\n let unnamedTotal = 0\n\n reimbursements.forEach(reimbursement => {\n const amount = reimbursement.amount\n const numericAmount = parseFloat(amount || '0')\n const description = reimbursement.description?.trim() || ''\n const uuid = reimbursement.uuid ?? undefined\n\n if (description === '') {\n unnamedTotal += numericAmount\n return\n }\n\n if (numericAmount === 0 && !uuid) {\n return\n }\n\n consolidated.push({\n amount,\n description,\n ...(uuid ? { uuid } : {}),\n })\n })\n\n if (unnamedTotal > 0) {\n consolidated.push({\n amount: unnamedTotal.toFixed(2),\n })\n }\n\n return consolidated\n}\n\n/**\n * Formats an hours value for display, rounding to two decimals and ensuring whole numbers render with `.0`.\n *\n * @param hours - The hours value to format.\n * @returns A string like `'40.0'` or `'37.25'`.\n * @internal\n */\nexport const formatHoursDisplay = (hours: number): string => {\n const rounded = roundToTwoDecimals(hours)\n\n if (rounded % 1 === 0) {\n return `${rounded}.0`\n }\n\n return rounded.toString()\n}\n\nconst getHoursInPayPeriod = (paySchedule: PayScheduleObject): number => {\n if (!paySchedule.frequency) {\n return 0\n }\n\n return PAY_PERIOD_HOURS_MAPPINGS[paySchedule.frequency] || 0\n}\n\nconst getEffectiveCompensation = (\n compensations: Compensation[],\n effectiveDate: Date,\n): Compensation | null => {\n if (!compensations.length) return null\n\n const sorted = [...compensations].sort(\n (a, b) =>\n (a.effectiveDate ? new Date(a.effectiveDate).getTime() : 0) -\n (b.effectiveDate ? new Date(b.effectiveDate).getTime() : 0),\n )\n\n for (let i = sorted.length - 1; i >= 0; i--) {\n const currentDateString = sorted[i]?.effectiveDate\n const currentDate = currentDateString ? new Date(currentDateString) : null\n if (currentDate && currentDate <= effectiveDate) {\n return sorted[i] || null\n }\n }\n\n return sorted[0] || null\n}\n\nconst getEffectiveMinimumWage = (\n minimumWages: MinimumWages[],\n effectiveDate: Date,\n): MinimumWages | null => {\n if (!minimumWages.length) return null\n\n const sorted = [...minimumWages].sort(\n (a, b) =>\n (a.effectiveDate ? new Date(a.effectiveDate).getTime() : 0) -\n (b.effectiveDate ? new Date(b.effectiveDate).getTime() : 0),\n )\n\n for (let i = sorted.length - 1; i >= 0; i--) {\n const currentDateString = sorted[i]?.effectiveDate\n const currentDate = currentDateString ? new Date(currentDateString) : null\n if (currentDate && currentDate <= effectiveDate) {\n return sorted[i] || null\n }\n }\n\n return sorted[0] || null\n}\n\nconst isSalaried = (compensation: Compensation): boolean => {\n return compensation.flsaStatus === 'Exempt' || compensation.flsaStatus === 'Salaried Nonexempt'\n}\n\n/**\n * Whether an FLSA status is eligible for regular-rate-of-pay overtime.\n *\n * @remarks\n * Only the nonexempt family (`Nonexempt`, `Salaried Nonexempt`,\n * `Commission Only Nonexempt`) earns overtime premiums, so only those statuses\n * warrant per-workweek breakdowns. `Exempt`, `Owner`, and\n * `Commission Only Exempt` are never overtime-eligible. An unknown status\n * returns `false` (treat as flat, never show meaningless workweek columns).\n *\n * @param flsaStatus - The employee's FLSA status, e.g. from `hourlyCompensations[].flsaStatus`.\n * @returns `true` only for the three nonexempt statuses.\n * @internal\n */\nexport const isOvertimeEligibleFlsaStatus = (flsaStatus: string | undefined): boolean =>\n flsaStatus === FlsaStatus.NONEXEMPT ||\n flsaStatus === FlsaStatus.SALARIED_NONEXEMPT ||\n flsaStatus === FlsaStatus.COMMISSION_ONLY_NONEXEMPT\n\nconst getTotalTipCompensations = (fixedCompensations: PayrollShowFixedCompensations[]): number => {\n if (!fixedCompensations.length) return 0\n\n return fixedCompensations\n .filter(fixedCompensation => {\n const name = fixedCompensation.name?.toLowerCase()\n const amount = parseFloat(fixedCompensation.amount || '0')\n return (name === 'paycheck tips' || name === 'cash tips') && amount > 0\n })\n .reduce((sum, fixedCompensation) => sum + parseFloat(fixedCompensation.amount || '0'), 0)\n}\n\nconst calculateHourlyRate = (compensation: Compensation): number => {\n const rate = parseFloat(compensation.rate || '0')\n const paymentUnit = compensation.paymentUnit || 'Hour'\n\n switch (paymentUnit) {\n case 'Hour':\n return rate\n case 'Year':\n return rate / 2080 // 52 weeks * 40 hours\n case 'Month':\n return rate / 173.333333\n case 'Week':\n return rate / 40\n case 'Paycheck':\n return 0 // Paycheck rate is 0 for hourly calculation\n default:\n return rate\n }\n}\n\nconst getHourlyRateForJob = (employee: Employee, jobUuid: string, effectiveDate: Date): number => {\n const job = employee.jobs?.find(j => j.uuid === jobUuid)\n if (!job?.compensations) {\n return 0\n }\n\n const compensation = getEffectiveCompensation(job.compensations, effectiveDate)\n return compensation ? calculateHourlyRate(compensation) : 0\n}\n\nconst getPrimaryHourlyRate = (employee: Employee, effectiveDate: Date): number => {\n const primaryJob = getPrimaryJob(employee)\n if (!primaryJob?.compensations) {\n return 0\n }\n\n const compensation = getEffectiveCompensation(primaryJob.compensations, effectiveDate)\n return compensation ? calculateHourlyRate(compensation) : 0\n}\n\nconst getTotalOutstandingPtoHours = (compensation: EmployeeCompensationInput): number => {\n if (!compensation.paidTimeOff) {\n return 0\n }\n\n return compensation.paidTimeOff.reduce(\n (sum, paidTimeOff) => sum + parseFloat(paidTimeOff.finalPayoutUnusedHoursInput || '0'),\n 0,\n )\n}\n\nconst getPtoHours = (\n compensation: EmployeeCompensationInput,\n isSalariedWithExpectedHours: boolean,\n hoursInPayPeriod: number,\n offCycle: boolean,\n): number => {\n const regularPtoHours = getTotalPtoHours(compensation)\n\n if (offCycle) {\n const outstandingPtoHours = getTotalOutstandingPtoHours(compensation)\n return regularPtoHours + outstandingPtoHours\n }\n\n if (isSalariedWithExpectedHours) {\n return Math.min(hoursInPayPeriod, regularPtoHours)\n }\n\n return regularPtoHours\n}\n\nconst calculateMinimumWageAdjustment = (\n primaryCompensation: Compensation,\n compensation: EmployeeCompensationInput,\n effectiveDate: Date,\n): number => {\n if (!primaryCompensation.adjustForMinimumWage) return 0\n\n const effectiveMinWage = getEffectiveMinimumWage(\n primaryCompensation.minimumWages || [],\n effectiveDate,\n )\n if (!effectiveMinWage) {\n return 0\n }\n\n const totalHours =\n compensation.hourlyCompensations?.reduce(\n (sum, hourlyCompensation) => sum + parseFloat(hourlyCompensation.hours || '0'),\n 0,\n ) || 0\n\n const hourlyRate = calculateHourlyRate(primaryCompensation)\n\n const totalTipCredit = (parseFloat(effectiveMinWage.wage || '0') - hourlyRate) * totalHours\n const totalTips = getTotalTipCompensations(compensation.fixedCompensations || [])\n\n return Math.max(0, totalTipCredit - totalTips)\n}\n\nconst calculateRegularPlusOvertimePay = (\n compensation: EmployeeCompensationInput,\n employee: Employee,\n effectiveDate: Date,\n isSalariedWithExpectedHours: boolean,\n hoursInPayPeriod: number,\n ptoHours: number,\n isOffCycle: boolean,\n): number => {\n if (!isOffCycle && isSalariedWithExpectedHours) {\n const primaryHourlyRate = getPrimaryHourlyRate(employee, effectiveDate)\n return primaryHourlyRate * (hoursInPayPeriod - ptoHours)\n }\n\n if (!compensation.hourlyCompensations || !employee.jobs) {\n return 0\n }\n\n const regularRatePay = compensation.hourlyCompensations.reduce((sum, hc) => {\n const hours = parseFloat(hc.hours || '0')\n const hourlyRate = getHourlyRateForJob(employee, hc.jobUuid || '', effectiveDate)\n return sum + hours * hourlyRate\n }, 0)\n\n const totalHours = compensation.hourlyCompensations.reduce((sum, hc) => {\n return sum + parseFloat(hc.hours || '0')\n }, 0)\n\n if (totalHours === 0) return regularRatePay\n\n const overtimeWeightedRate = roundToSixDecimals(regularRatePay / totalHours)\n\n // Calculate overtime pay for non-regular hours\n const overtimePay = compensation.hourlyCompensations\n .filter(hc => !isRegularHours(hc.name || ''))\n .reduce((sum, hc) => {\n const hours = parseFloat(hc.hours || '0')\n const multiplier = hc.compensationMultiplier || 1\n return sum + hours * overtimeWeightedRate * (multiplier - 1)\n }, 0)\n\n return regularRatePay + overtimePay\n}\n\nconst calculatePtoPay = (\n compensation: EmployeeCompensationInput,\n employee: Employee,\n effectiveDate: Date,\n isSalariedWithExpectedHours: boolean,\n hoursInPayPeriod: number,\n offCycle: boolean,\n): number => {\n const ptoHours = getPtoHours(\n compensation,\n isSalariedWithExpectedHours,\n hoursInPayPeriod,\n offCycle,\n )\n const primaryHourlyRate = getPrimaryHourlyRate(employee, effectiveDate)\n return ptoHours * primaryHourlyRate\n}\n\nconst isSalariedWithPayPeriodExpectedHours = (\n compensation: EmployeeCompensationInput,\n isSalaried: boolean,\n hoursInPayPeriod: number,\n): boolean => {\n if (!isSalaried) return false\n\n const regularHourlyCompensation = compensation.hourlyCompensations?.find(hourlyCompensation =>\n isRegularHours(hourlyCompensation.name || ''),\n )\n\n if (!regularHourlyCompensation) return false\n\n const regularHours = parseFloat(regularHourlyCompensation.hours || '0')\n return regularHours === hoursInPayPeriod\n}\n\n/**\n * Calculates an employee's gross pay for a payroll, combining regular and overtime pay,\n * additional earnings, PTO pay, and any minimum-wage adjustment.\n *\n * @remarks\n * Returns `0` when the compensation is excluded or the employee has no primary job compensation effective\n * on the given date. The result is rounded to two decimal places.\n *\n * @param compensation - The employee compensation entry from the payroll.\n * @param employee - The employee record (used to look up jobs and effective compensations).\n * @param compensationEffectiveDateString - ISO date used to resolve the effective compensation; defaults to now.\n * @param paySchedule - The pay schedule, used to derive expected hours per pay period.\n * @param payrollCategory - The payroll category; off-cycle categories change how PTO hours are summed.\n * @returns The gross pay amount.\n * @internal\n */\nexport const calculateGrossPay = (\n compensation: EmployeeCompensationInput,\n employee: Employee,\n compensationEffectiveDateString?: string,\n paySchedule?: PayScheduleObject,\n payrollCategory: PayrollCategory = PayrollCategory.Regular,\n): number => {\n if (compensation.excluded) {\n return 0\n }\n\n const compensationEffectiveDate = compensationEffectiveDateString\n ? new Date(compensationEffectiveDateString)\n : new Date()\n\n const primaryJob = getPrimaryJob(employee)\n if (!primaryJob?.compensations) {\n return 0\n }\n\n const primaryCompensation = getEffectiveCompensation(\n primaryJob.compensations,\n compensationEffectiveDate,\n )\n\n if (!primaryCompensation) {\n return 0\n }\n\n const salaried = isSalaried(primaryCompensation)\n const hoursInPayPeriod = paySchedule ? getHoursInPayPeriod(paySchedule) : 0\n\n const isSalariedWithExpectedHours = isSalariedWithPayPeriodExpectedHours(\n compensation,\n salaried,\n hoursInPayPeriod,\n )\n\n const offCycle = isOffCyclePayroll(payrollCategory)\n\n const ptoHours = getPtoHours(\n compensation,\n isSalariedWithExpectedHours,\n hoursInPayPeriod,\n offCycle,\n )\n\n const regularPlusOvertimePay = calculateRegularPlusOvertimePay(\n compensation,\n employee,\n compensationEffectiveDate,\n isSalariedWithExpectedHours,\n hoursInPayPeriod,\n ptoHours,\n offCycle,\n )\n\n const fixedPay = getAdditionalEarnings(compensation)\n const ptoPay = calculatePtoPay(\n compensation,\n employee,\n compensationEffectiveDate,\n isSalariedWithExpectedHours,\n hoursInPayPeriod,\n offCycle,\n )\n const minimumWageAdjustment = calculateMinimumWageAdjustment(\n primaryCompensation,\n compensation,\n compensationEffectiveDate,\n )\n\n const total = regularPlusOvertimePay + fixedPay + ptoPay + minimumWageAdjustment\n return roundToTwoDecimals(total)\n}\n\n/**\n * Returns the high-level payroll type — `'External'`, `'Off-Cycle'`, or `'Regular'`.\n *\n * @param payroll - The payroll whose type to classify.\n * @returns The payroll type string.\n * @internal\n */\nexport const getPayrollType = (payroll: {\n external?: boolean\n offCycle?: boolean\n}): PayrollType => {\n if (payroll.external) return 'External'\n if (payroll.offCycle) return 'Off-Cycle'\n return 'Regular'\n}\n\n/**\n * Returns whether an off-cycle reason indicates a dismissal payroll.\n *\n * @param offCycleReason - The payroll's off-cycle reason string.\n * @returns `true` when the reason matches the dismissed-employee reason.\n * @internal\n */\nexport const isDismissalPayroll = (offCycleReason?: string | null): boolean =>\n offCycleReason === OffCycleReasonType.DismissedEmployee\n\n/**\n * Returns a formatted pay-period range, falling back to the formatted check date when the\n * payroll has no pay period.\n *\n * @remarks\n * Tax reconciliation payrolls always have a null `pay_period`, so anywhere a pay-period date\n * is used to identify a payroll on screen needs this fallback to avoid rendering blank space.\n *\n * @param payroll - The payroll to derive a date label for.\n * @param dateFormatter - The date formatter returned by {@link useDateFormatter}.\n * @returns The formatted pay-period range, or the formatted check date when no pay period exists.\n * @internal\n */\nexport const getPayPeriodOrCheckDateLabel = (\n payroll: {\n payPeriod?: { startDate?: string | null; endDate?: string | null } | null\n checkDate?: string | Date | null\n },\n dateFormatter: ReturnType<typeof useDateFormatter>,\n): string => {\n const range = dateFormatter.formatPayPeriodRange(\n payroll.payPeriod?.startDate,\n payroll.payPeriod?.endDate,\n )\n return range || dateFormatter.formatShortWithYear(payroll.checkDate)\n}\n\nconst OFF_CYCLE_REASON_LABELS: Record<string, string> = {\n Bonus: 'Bonus',\n Correction: 'Correction',\n 'Transition from old pay schedule': 'Transition',\n 'Dismissed employee': 'Dismissal',\n 'Hired employee': 'New Hire',\n 'Benefit reversal': 'Benefit Reversal',\n 'Wage correction': 'Wage Correction',\n 'Tax reconciliation': 'Tax Reconciliation',\n Reversal: 'Reversal',\n 'Disability insurance distribution': 'Disability Insurance',\n}\n\n/**\n * Returns a human-readable label describing the payroll type, mapping off-cycle reasons to display strings.\n *\n * @param payroll - The payroll whose type to describe.\n * @returns `'External'`, `'Regular'`, `'Off-Cycle'`, or a label derived from the off-cycle reason\n * (e.g. `'Bonus'`, `'Dismissal'`).\n * @internal\n */\nexport const getPayrollTypeLabel = (payroll: {\n external?: boolean\n offCycle?: boolean\n offCycleReason?: string | null\n}): string => {\n if (payroll.external) return 'External'\n if (payroll.offCycle && payroll.offCycleReason) {\n return OFF_CYCLE_REASON_LABELS[payroll.offCycleReason] ?? payroll.offCycleReason\n }\n if (payroll.offCycle) return 'Off-Cycle'\n return 'Regular'\n}\n\n/**\n * Merges existing fixed compensations with placeholder entries for any compensation types the employee\n * doesn't yet have, then filters out excluded types and sorts the result alphabetically.\n *\n * @remarks\n * Owners (FLSA status `Owner`) never receive placeholder entries. Placeholders are added with `amount: '0.00'`\n * and the supplied `primaryJobUuid`.\n *\n * @param options - Inputs controlling which placeholder entries to add and which types to exclude.\n * @returns The merged, filtered, and sorted list of fixed compensations.\n * @internal\n */\nexport const getAdditionalEarningsCompensations = ({\n flsaStatus,\n existingFixedCompensations = [],\n primaryJobUuid,\n fixedCompensationTypes = [],\n excludedTypes = [],\n}: {\n flsaStatus: string | undefined\n existingFixedCompensations?: FixedCompensations[]\n primaryJobUuid?: string\n fixedCompensationTypes?: PayrollFixedCompensationTypesType[]\n excludedTypes?: string[]\n}): FixedCompensations[] => {\n const allFixedCompensations = [...existingFixedCompensations]\n\n if (flsaStatus !== FlsaStatus.OWNER && primaryJobUuid && fixedCompensationTypes.length > 0) {\n const compensationTypeNames = fixedCompensationTypes\n .map(type => type.name)\n .filter(Boolean) as string[]\n\n compensationTypeNames.forEach(compensationName => {\n const exists = allFixedCompensations.some(\n comp => comp.name?.toLowerCase() === compensationName.toLowerCase(),\n )\n\n if (!exists) {\n allFixedCompensations.push({\n name: compensationName,\n amount: '0.00',\n jobUuid: primaryJobUuid,\n })\n }\n })\n }\n\n // Filter and sort additional earnings (exclude specified types)\n return allFixedCompensations\n .filter(comp => comp.name && !excludedTypes.includes(comp.name))\n .sort((a, b) => (a.name || '').localeCompare(b.name || ''))\n}\n\n/**\n * Sums gross pay, employer taxes, reimbursements, and benefits from a payroll's totals.\n *\n * @param payrollData - The payroll whose totals to sum.\n * @returns The total payroll cost, or `0` when `payrollData.totals` is missing.\n * @internal\n */\nexport const calculateTotalPayroll = (payrollData: Payroll) => {\n const totalPayroll = payrollData.totals\n ? Number(payrollData.totals.grossPay ?? 0) +\n Number(payrollData.totals.employerTaxes ?? 0) +\n Number(payrollData.totals.reimbursements ?? 0) +\n Number(payrollData.totals.benefits ?? 0)\n : 0\n\n return totalPayroll\n}\n\n/**\n * Converts a Date to Pacific Time considering Daylight Saving Time.\n * Returns the UTC offset in hours (e.g., -7 for PDT, -8 for PST).\n *\n * DST rules for Pacific Time:\n * - Starts: Second Sunday in March at 2:00 AM\n * - Ends: First Sunday in November at 2:00 AM\n */\nconst getPacificTimeOffset = (date: Date): number => {\n const year = date.getFullYear()\n\n const secondSundayMarch = new Date(year, 2, 1)\n secondSundayMarch.setDate(1 + (7 - secondSundayMarch.getDay()) + 7)\n\n const firstSundayNovember = new Date(year, 10, 1)\n firstSundayNovember.setDate(1 + ((7 - firstSundayNovember.getDay()) % 7))\n\n const isDST = date >= secondSundayMarch && date < firstSundayNovember\n return isDST ? -7 : -8\n}\n\n/**\n * Off-cycle reasons the cancel endpoint accepts. The API rejects any other reason, even when\n * `payrollStatusMeta.cancellable` is `true`.\n *\n * TODO: remove once the API's `cancellable` flag also checks the payroll type.\n */\nconst API_EDITABLE_OFF_CYCLE_REASONS = new Set<string>([\n OffCycleReasonType.Bonus,\n OffCycleReasonType.Correction,\n OffCycleReasonType.Adhoc,\n OffCycleReasonType.BenefitReversal,\n OffCycleReasonType.HiredEmployee,\n OffCycleReasonType.DismissedEmployee,\n OffCycleReasonType.TransitionFromOldPaySchedule,\n])\n\nconst isApiEditablePayrollType = (payroll: Payroll): boolean => {\n if (payroll.external) return false\n if (!payroll.offCycle) return true\n return !!payroll.offCycleReason && API_EDITABLE_OFF_CYCLE_REASONS.has(payroll.offCycleReason)\n}\n\n/**\n * Returns the interpolation values for the cancel dialog's deadline sentence.\n *\n * @remarks\n * Translations place `time` and `date` themselves, so word order and the joining word stay\n * localizable. `deadline` is the legacy pre-joined English string, kept so existing\n * translations and partner overrides that use `{{deadline}}` keep rendering.\n *\n * @param payroll - The payroll whose `payrollDeadline` is shown.\n * @param dateFormatter - The date formatter returned by {@link useDateFormatter}.\n * @returns The `time`, `date`, and legacy `deadline` values in the user's local time zone.\n * @internal\n */\nexport const getCancelDeadlineValues = (\n payroll: { payrollDeadline?: string | Date | null },\n dateFormatter: ReturnType<typeof useDateFormatter>,\n): { time: string; date: string; deadline: string } => {\n const { time, date } = dateFormatter.formatWithTime(payroll.payrollDeadline)\n return { time, date, deadline: date ? `${time} on ${date}` : time }\n}\n\n/**\n * Returns whether to show the cancel action for a payroll.\n *\n * @remarks\n * Shows cancel only when the API will accept it:\n *\n * - `payrollStatusMeta.cancellable` is `true`. A missing flag hides cancel, so fetch the payroll\n * with `payroll_status_meta`.\n * - The payroll is processed and not external.\n * - It is a regular payroll, or an off-cycle payroll with one of the reasons listed above. The\n * `cancellable` flag does not check the payroll type yet, so this helper does.\n * - It is before 4:00 PM PT on the `payrollDeadline` date, so a page left open past the cutoff\n * stops offering cancel.\n *\n * The API can still refuse if a tax filing was already sent. The payroll data doesn't show that.\n *\n * @param payroll - The payroll to check, fetched with `payroll_status_meta`.\n * @returns `true` if cancel should be shown.\n * @internal\n */\nexport const canCancelPayroll = (payroll: Payroll): boolean => {\n if (payroll.payrollStatusMeta?.cancellable !== true) {\n return false\n }\n\n if (!payroll.processed) {\n return false\n }\n\n if (!isApiEditablePayrollType(payroll)) {\n return false\n }\n\n if (!payroll.payrollDeadline) {\n return false\n }\n\n const now = new Date()\n const deadline = new Date(payroll.payrollDeadline)\n\n const nowInPT = new Date(now.getTime() + getPacificTimeOffset(now) * MS_PER_HOUR)\n const deadlineInPT = new Date(deadline.getTime() + getPacificTimeOffset(deadline) * MS_PER_HOUR)\n\n const cutoffTime = new Date(deadlineInPT)\n cutoffTime.setUTCHours(16, 0, 0, 0)\n\n if (nowInPT >= cutoffTime) {\n return false\n }\n\n return true\n}\n"],"names":["REGULAR_HOURS_NAME","getPrimaryJob","employee","job","roundToSixDecimals","value","roundToTwoDecimals","isRegularHours","compensationName","PAY_PERIOD_HOURS_MAPPINGS","formatEmployeePayRate","locale","primaryJob","jobCompensation","rate","paymentUnit","formatPayRate","useFormatEmployeePayRate","t","useTranslation","useLocale","useCallback","getRegularHours","compensation","hourlyCompensation","sum","getOvertimeHours","getTotalPtoHours","pto","getAdditionalEarnings","fixedCompensation","name","amount","getReimbursements","reimbursement","reimbursementComp","cleanupReimbursements","reimbursements","consolidated","unnamedTotal","numericAmount","description","uuid","formatHoursDisplay","hours","rounded","getHoursInPayPeriod","paySchedule","getEffectiveCompensation","compensations","effectiveDate","sorted","a","b","i","currentDateString","currentDate","getEffectiveMinimumWage","minimumWages","isSalaried","isOvertimeEligibleFlsaStatus","flsaStatus","FlsaStatus","getTotalTipCompensations","fixedCompensations","calculateHourlyRate","getHourlyRateForJob","jobUuid","j","getPrimaryHourlyRate","getTotalOutstandingPtoHours","paidTimeOff","getPtoHours","isSalariedWithExpectedHours","hoursInPayPeriod","offCycle","regularPtoHours","outstandingPtoHours","calculateMinimumWageAdjustment","primaryCompensation","effectiveMinWage","totalHours","hourlyRate","totalTipCredit","totalTips","calculateRegularPlusOvertimePay","ptoHours","isOffCycle","regularRatePay","hc","overtimeWeightedRate","overtimePay","multiplier","calculatePtoPay","primaryHourlyRate","isSalariedWithPayPeriodExpectedHours","regularHourlyCompensation","calculateGrossPay","compensationEffectiveDateString","payrollCategory","PayrollCategory","compensationEffectiveDate","salaried","isOffCyclePayroll","regularPlusOvertimePay","fixedPay","ptoPay","minimumWageAdjustment","total","isDismissalPayroll","offCycleReason","OffCycleReasonType","getPayPeriodOrCheckDateLabel","payroll","dateFormatter","OFF_CYCLE_REASON_LABELS","getPayrollTypeLabel","getAdditionalEarningsCompensations","existingFixedCompensations","primaryJobUuid","fixedCompensationTypes","excludedTypes","allFixedCompensations","type","comp","calculateTotalPayroll","payrollData","getPacificTimeOffset","date","year","secondSundayMarch","firstSundayNovember","API_EDITABLE_OFF_CYCLE_REASONS","isApiEditablePayrollType","getCancelDeadlineValues","time","canCancelPayroll","now","deadline","nowInPT","MS_PER_HOUR","deadlineInPT","cutoffTime"],"mappings":";;;;;;;;AAyBA,MAAMA,IAAqB,iBAiBrBC,IAAgB,CAACC,MACdA,EAAS,MAAM,KAAK,CAAAC,MAAOA,EAAI,OAAO,KAAKD,EAAS,OAAO,CAAC,KAAK,MAGpEE,IAAqB,CAACC,MACnB,KAAK,MAAMA,IAAQ,GAAS,IAAI,KAGnCC,IAAqB,CAACD,MACnB,KAAK,MAAMA,IAAQ,GAAG,IAAI,KAG7BE,IAAiB,CAACC,MACfA,EAAiB,kBAAkBR,GAGtCS,IAAoD;AAAA,EACxD,OAAO;AAAA,EACP,cAAc;AAAA,EACd,oBAAoB;AAAA,EACpB,mBAAmB;AAAA,E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AAI,KAAKF,EAAI,YAAYV,EAAqBU,CAAG,IAAIG,CAAW,GAC1EC,IAAe,IAAI,KAAKH,EAAS,YAAYX,EAAqBW,CAAQ,IAAIE,CAAW,GAEzFE,IAAa,IAAI,KAAKD,CAAY;AAGxC,SAFAC,EAAW,YAAY,IAAI,GAAG,GAAG,CAAC,GAE9B,EAAAH,KAAWG;AAKjB;"}
@@ -1,4 +1,4 @@
1
- import { OffCycleReasonType as e } from "@gusto/embedded-api/models/components/payrollshow";
1
+ import { OffCycleReasonType as e } from "@gusto/embedded-api/models/components/unprocessedpayroll";
2
2
  const r = {
3
3
  Regular: "Regular",
4
4
  External: "External",
@@ -1 +1 @@
1
- {"version":3,"file":"payrollTypes.js","sources":["../../../src/components/Payroll/payrollTypes.ts"],"sourcesContent":["import { OffCycleReasonType } from '@gusto/embedded-api/models/components/payrollshow'\n\n/**\n * Enum-like map of payroll categories combining `Regular`, `External`, and every off-cycle reason.\n *\n * @internal\n */\nexport const PayrollCategory = {\n Regular: 'Regular',\n External: 'External',\n Bonus: OffCycleReasonType.Bonus,\n Correction: OffCycleReasonType.Correction,\n Dismissal: OffCycleReasonType.DismissedEmployee,\n HiredEmployee: OffCycleReasonType.HiredEmployee,\n Transition: OffCycleReasonType.TransitionFromOldPaySchedule,\n BenefitReversal: OffCycleReasonType.BenefitReversal,\n WageCorrection: OffCycleReasonType.WageCorrection,\n TaxReconciliation: OffCycleReasonType.TaxReconciliation,\n Reversal: OffCycleReasonType.Reversal,\n DisabilityInsurance: OffCycleReasonType.DisabilityInsuranceDistribution,\n} as const\n\n/**\n * Union of payroll category string values from {@link PayrollCategory}.\n *\n * @internal\n */\nexport type PayrollCategory = (typeof PayrollCategory)[keyof typeof PayrollCategory]\n\nconst VALID_PAYROLL_CATEGORIES = new Set<string>(Object.values(PayrollCategory))\n\n/**\n * Derives a {@link PayrollCategory} from a payroll's `external`, `offCycle`, and `offCycleReason` flags.\n *\n * @param payroll - The payroll whose category to derive.\n * @returns The matching category, falling back to `Regular` when nothing else applies.\n * @internal\n */\nexport function derivePayrollCategory(payroll: {\n offCycle?: boolean\n offCycleReason?: string | null\n external?: boolean\n}): PayrollCategory {\n if (payroll.external) return PayrollCategory.External\n if (\n payroll.offCycle &&\n payroll.offCycleReason &&\n VALID_PAYROLL_CATEGORIES.has(payroll.offCycleReason)\n ) {\n return payroll.offCycleReason as PayrollCategory\n }\n return PayrollCategory.Regular\n}\n\n/**\n * Returns whether a payroll category represents an off-cycle payroll.\n *\n * @param category - The payroll category to check.\n * @returns `true` for any category other than `Regular` or `External`.\n * @internal\n */\nexport function isOffCyclePayroll(category: PayrollCategory): boolean {\n return category !== PayrollCategory.Regular && category !== PayrollCategory.External\n}\n"],"names":["PayrollCategory","OffCycleReasonType","VALID_PAYROLL_CATEGORIES","derivePayrollCategory","payroll","isOffCyclePayroll","category"],"mappings":";AAOO,MAAMA,IAAkB;AAAA,EAC7B,SAAS;AAAA,EACT,UAAU;AAAA,EACV,OAAOC,EAAmB;AAAA,EAC1B,YAAYA,EAAmB;AAAA,EAC/B,WAAWA,EAAmB;AAAA,EAC9B,eAAeA,EAAmB;AAAA,EAClC,YAAYA,EAAmB;AAAA,EAC/B,iBAAiBA,EAAmB;AAAA,EACpC,gBAAgBA,EAAmB;AAAA,EACnC,mBAAmBA,EAAmB;AAAA,EACtC,UAAUA,EAAmB;AAAA,EAC7B,qBAAqBA,EAAmB;AAC1C,GASMC,IAA2B,IAAI,IAAY,OAAO,OAAOF,CAAe,CAAC;AASxE,SAASG,EAAsBC,GAIlB;AAClB,SAAIA,EAAQ,WAAiBJ,EAAgB,WAE3CI,EAAQ,YACRA,EAAQ,kBACRF,EAAyB,IAAIE,EAAQ,cAAc,IAE5CA,EAAQ,iBAEVJ,EAAgB;AACzB;AASO,SAASK,EAAkBC,GAAoC;AACpE,SAAOA,MAAaN,EAAgB,WAAWM,MAAaN,EAAgB;AAC9E;"}
1
+ {"version":3,"file":"payrollTypes.js","sources":["../../../src/components/Payroll/payrollTypes.ts"],"sourcesContent":["import { OffCycleReasonType } from '@gusto/embedded-api/models/components/unprocessedpayroll'\n\n/**\n * Enum-like map of payroll categories combining `Regular`, `External`, and every off-cycle reason.\n *\n * @internal\n */\nexport const PayrollCategory = {\n Regular: 'Regular',\n External: 'External',\n Bonus: OffCycleReasonType.Bonus,\n Correction: OffCycleReasonType.Correction,\n Dismissal: OffCycleReasonType.DismissedEmployee,\n HiredEmployee: OffCycleReasonType.HiredEmployee,\n Transition: OffCycleReasonType.TransitionFromOldPaySchedule,\n BenefitReversal: OffCycleReasonType.BenefitReversal,\n WageCorrection: OffCycleReasonType.WageCorrection,\n TaxReconciliation: OffCycleReasonType.TaxReconciliation,\n Reversal: OffCycleReasonType.Reversal,\n DisabilityInsurance: OffCycleReasonType.DisabilityInsuranceDistribution,\n} as const\n\n/**\n * Union of payroll category string values from {@link PayrollCategory}.\n *\n * @internal\n */\nexport type PayrollCategory = (typeof PayrollCategory)[keyof typeof PayrollCategory]\n\nconst VALID_PAYROLL_CATEGORIES = new Set<string>(Object.values(PayrollCategory))\n\n/**\n * Derives a {@link PayrollCategory} from a payroll's `external`, `offCycle`, and `offCycleReason` flags.\n *\n * @param payroll - The payroll whose category to derive.\n * @returns The matching category, falling back to `Regular` when nothing else applies.\n * @internal\n */\nexport function derivePayrollCategory(payroll: {\n offCycle?: boolean\n offCycleReason?: string | null\n external?: boolean\n}): PayrollCategory {\n if (payroll.external) return PayrollCategory.External\n if (\n payroll.offCycle &&\n payroll.offCycleReason &&\n VALID_PAYROLL_CATEGORIES.has(payroll.offCycleReason)\n ) {\n return payroll.offCycleReason as PayrollCategory\n }\n return PayrollCategory.Regular\n}\n\n/**\n * Returns whether a payroll category represents an off-cycle payroll.\n *\n * @param category - The payroll category to check.\n * @returns `true` for any category other than `Regular` or `External`.\n * @internal\n */\nexport function isOffCyclePayroll(category: PayrollCategory): boolean {\n return category !== PayrollCategory.Regular && category !== PayrollCategory.External\n}\n"],"names":["PayrollCategory","OffCycleReasonType","VALID_PAYROLL_CATEGORIES","derivePayrollCategory","payroll","isOffCyclePayroll","category"],"mappings":";AAOO,MAAMA,IAAkB;AAAA,EAC7B,SAAS;AAAA,EACT,UAAU;AAAA,EACV,OAAOC,EAAmB;AAAA,EAC1B,YAAYA,EAAmB;AAAA,EAC/B,WAAWA,EAAmB;AAAA,EAC9B,eAAeA,EAAmB;AAAA,EAClC,YAAYA,EAAmB;AAAA,EAC/B,iBAAiBA,EAAmB;AAAA,EACpC,gBAAgBA,EAAmB;AAAA,EACnC,mBAAmBA,EAAmB;AAAA,EACtC,UAAUA,EAAmB;AAAA,EAC7B,qBAAqBA,EAAmB;AAC1C,GASMC,IAA2B,IAAI,IAAY,OAAO,OAAOF,CAAe,CAAC;AASxE,SAASG,EAAsBC,GAIlB;AAClB,SAAIA,EAAQ,WAAiBJ,EAAgB,WAE3CI,EAAQ,YACRA,EAAQ,kBACRF,EAAyB,IAAIE,EAAQ,cAAc,IAE5CA,EAAQ,iBAEVJ,EAAgB;AACzB;AASO,SAASK,EAAkBC,GAAoC;AACpE,SAAOA,MAAaN,EAAgB,WAAWM,MAAaN,EAAgB;AAC9E;"}