@gusto/embedded-react-sdk 0.55.4 → 0.55.6

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 (354) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/components/Common/DataView/DataTable/DataTable.js +44 -41
  3. package/dist/components/Common/DataView/DataTable/DataTable.js.map +1 -1
  4. package/dist/components/Common/RequirementsList/RequirementsList.js +21 -12
  5. package/dist/components/Common/RequirementsList/RequirementsList.js.map +1 -1
  6. package/dist/components/Common/UI/Table/Table.module.scss.js +1 -1
  7. package/dist/components/Company/PaySchedule/PaySchedule.js +21 -15
  8. package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
  9. package/dist/components/Company/StateTaxes/TaxRateManagement/TaxRateHistorySection.js +1 -0
  10. package/dist/components/Company/StateTaxes/TaxRateManagement/TaxRateHistorySection.js.map +1 -1
  11. package/dist/components/Contractor/Compensation/management/CompensationEditForm.js +20 -17
  12. package/dist/components/Contractor/Compensation/management/CompensationEditForm.js.map +1 -1
  13. package/dist/components/Contractor/Compensation/shared/useContractorPayForm/contractorPaySchema.d.ts +1 -0
  14. package/dist/components/Contractor/Compensation/shared/useContractorPayForm/contractorPaySchema.js +21 -17
  15. package/dist/components/Contractor/Compensation/shared/useContractorPayForm/contractorPaySchema.js.map +1 -1
  16. package/dist/components/Contractor/Compensation/shared/useContractorPayForm/fields.d.ts +7 -1
  17. package/dist/components/Contractor/Compensation/shared/useContractorPayForm/fields.js.map +1 -1
  18. package/dist/components/Contractor/Compensation/shared/useContractorPayForm/index.d.ts +1 -1
  19. package/dist/components/Contractor/ContractorList/management/ManagementContractorListView.js +112 -100
  20. package/dist/components/Contractor/ContractorList/management/ManagementContractorListView.js.map +1 -1
  21. package/dist/components/Contractor/ContractorList/onboarding/ContractorListView.js +46 -40
  22. package/dist/components/Contractor/ContractorList/onboarding/ContractorListView.js.map +1 -1
  23. package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js +10 -9
  24. package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js.map +1 -1
  25. package/dist/components/Contractor/Profile/onboarding/ContractorProfile.js +22 -19
  26. package/dist/components/Contractor/Profile/onboarding/ContractorProfile.js.map +1 -1
  27. package/dist/components/Contractor/Profile/shared/useContractorDetailsForm/contractorDetailsSchema.d.ts +1 -0
  28. package/dist/components/Contractor/Profile/shared/useContractorDetailsForm/contractorDetailsSchema.js +34 -30
  29. package/dist/components/Contractor/Profile/shared/useContractorDetailsForm/contractorDetailsSchema.js.map +1 -1
  30. package/dist/components/Contractor/Profile/shared/useContractorDetailsForm/fields.d.ts +7 -1
  31. package/dist/components/Contractor/Profile/shared/useContractorDetailsForm/fields.js.map +1 -1
  32. package/dist/components/Contractor/Profile/shared/useContractorDetailsForm/index.d.ts +1 -1
  33. package/dist/components/Contractor/Profile/shared/useContractorDetailsForm/useContractorDetailsForm.js +32 -32
  34. package/dist/components/Contractor/Profile/shared/useContractorDetailsForm/useContractorDetailsForm.js.map +1 -1
  35. package/dist/components/Employee/Compensation/onboarding/JobsList/JobsListPresentation.js +1 -0
  36. package/dist/components/Employee/Compensation/onboarding/JobsList/JobsListPresentation.js.map +1 -1
  37. package/dist/components/Employee/Deductions/management/DeductionsCard/DeductionsCard.js +11 -10
  38. package/dist/components/Employee/Deductions/management/DeductionsCard/DeductionsCard.js.map +1 -1
  39. package/dist/components/Employee/Deductions/onboarding/DeductionsList/DeductionsList.js +7 -6
  40. package/dist/components/Employee/Deductions/onboarding/DeductionsList/DeductionsList.js.map +1 -1
  41. package/dist/components/Employee/PaymentMethod/onboarding/ListView.js +20 -19
  42. package/dist/components/Employee/PaymentMethod/onboarding/ListView.js.map +1 -1
  43. package/dist/components/Employee/Paystubs/management/PaystubsCard/PaystubsCard.js +12 -10
  44. package/dist/components/Employee/Paystubs/management/PaystubsCard/PaystubsCard.js.map +1 -1
  45. package/dist/components/InformationRequests/InformationRequests.js +63 -64
  46. package/dist/components/InformationRequests/InformationRequests.js.map +1 -1
  47. package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.js +13 -12
  48. package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.js.map +1 -1
  49. package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTable.module.scss.js +1 -1
  50. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +200 -195
  51. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
  52. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js +93 -85
  53. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
  54. package/dist/components/Payroll/PayrollConfiguration/useCalculationPoll.d.ts +50 -0
  55. package/dist/components/Payroll/PayrollConfiguration/useCalculationPoll.js +52 -0
  56. package/dist/components/Payroll/PayrollConfiguration/useCalculationPoll.js.map +1 -0
  57. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js +52 -50
  58. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js.map +1 -1
  59. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +259 -255
  60. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
  61. package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/fields.d.ts +278 -0
  62. package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/index.d.ts +1 -0
  63. package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/payrollEditEmployeeHelpers.d.ts +108 -0
  64. package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/payrollEditEmployeeHelpers.test.d.ts +1 -0
  65. package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/payrollEditEmployeeSchema.d.ts +95 -0
  66. package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/payrollEditEmployeeSchema.test.d.ts +1 -0
  67. package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/usePayrollEditEmployeeForm.d.ts +126 -0
  68. package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js +1 -0
  69. package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js.map +1 -1
  70. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +191 -183
  71. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js.map +1 -1
  72. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +117 -107
  73. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
  74. package/dist/components/Payroll/PayrollOverview/useSubmissionPoll.d.ts +39 -0
  75. package/dist/components/Payroll/PayrollOverview/useSubmissionPoll.js +46 -0
  76. package/dist/components/Payroll/PayrollOverview/useSubmissionPoll.js.map +1 -0
  77. package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js +40 -34
  78. package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js.map +1 -1
  79. package/dist/components/Payroll/PrintChecks/PrintChecksForm/PrintChecksForm.js +72 -87
  80. package/dist/components/Payroll/PrintChecks/PrintChecksForm/PrintChecksForm.js.map +1 -1
  81. package/dist/components/Payroll/PrintChecks/PrintChecksForm/useGenerationPoll.d.ts +17 -0
  82. package/dist/components/Payroll/PrintChecks/PrintChecksForm/useGenerationPoll.js +55 -0
  83. package/dist/components/Payroll/PrintChecks/PrintChecksForm/useGenerationPoll.js.map +1 -0
  84. package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.js +2 -0
  85. package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.js.map +1 -1
  86. package/dist/components/Payroll/UNSTABLE_PayrollEditEmployee/UNSTABLE_PayrollEditEmployee.d.ts +13 -0
  87. package/dist/components/Payroll/UNSTABLE_PayrollEditEmployee/UNSTABLE_PayrollEditEmployee.js +58 -0
  88. package/dist/components/Payroll/UNSTABLE_PayrollEditEmployee/UNSTABLE_PayrollEditEmployee.js.map +1 -0
  89. package/dist/components/Payroll/UNSTABLE_PayrollEditEmployee/UNSTABLE_PayrollEditEmployee.module.scss.js +8 -0
  90. package/dist/components/Payroll/UNSTABLE_PayrollEditEmployee/UNSTABLE_PayrollEditEmployee.module.scss.js.map +1 -0
  91. package/dist/components/Payroll/helpers.d.ts +15 -0
  92. package/dist/components/Payroll/helpers.js.map +1 -1
  93. package/dist/components/TimeOff/shared/EmployeeTable/EmployeeTable.js +35 -35
  94. package/dist/components/TimeOff/shared/EmployeeTable/EmployeeTable.js.map +1 -1
  95. package/dist/components/TimeOff/shared/EmployeeTable/EmployeeTable.module.scss.js +4 -4
  96. package/dist/contexts/UnstableFeaturesProvider/useUnstableFeature.d.ts +2 -0
  97. package/dist/contexts/UnstableFeaturesProvider/useUnstableFeature.js.map +1 -1
  98. package/dist/hooks/usePollingTask/usePollingTask.d.ts +101 -0
  99. package/dist/hooks/usePollingTask/usePollingTask.js +50 -0
  100. package/dist/hooks/usePollingTask/usePollingTask.js.map +1 -0
  101. package/dist/hooks/usePollingTask/usePollingTask.test.d.ts +1 -0
  102. package/dist/i18n/I18n.js +147 -30
  103. package/dist/i18n/I18n.js.map +1 -1
  104. package/dist/i18n/en/Contractor.ContractorList.json.js +14 -12
  105. package/dist/i18n/en/Contractor.ContractorList.json.js.map +1 -1
  106. package/dist/i18n/en/Contractor.Management.Compensation.json.js +6 -6
  107. package/dist/i18n/en/Contractor.ManagementContractorList.json.js +8 -8
  108. package/dist/i18n/en/Contractor.Profile.json.js +5 -5
  109. package/dist/i18n/en/Payroll.OffCyclePayPeriodDateForm.json.js +7 -5
  110. package/dist/i18n/en/Payroll.OffCyclePayPeriodDateForm.json.js.map +1 -1
  111. package/dist/i18n/en/Payroll.PayrollHistory.json.js +8 -8
  112. package/dist/i18n/en/Payroll.PayrollOverview.json.js +16 -16
  113. package/dist/i18n/en/Payroll.UNSTABLE_PayrollEditEmployee.json.js +98 -0
  114. package/dist/i18n/en/Payroll.UNSTABLE_PayrollEditEmployee.json.js.map +1 -0
  115. package/dist/i18n/en/common.json.d.ts +1 -0
  116. package/dist/i18n/en/common.json.js +1 -1
  117. package/dist/i18n/es_US/Company.Addresses.json.js +8 -0
  118. package/dist/i18n/es_US/Company.Addresses.json.js.map +1 -0
  119. package/dist/i18n/es_US/Company.AssignSignatory.json.js +22 -0
  120. package/dist/i18n/es_US/Company.AssignSignatory.json.js.map +1 -0
  121. package/dist/i18n/es_US/Company.BankAccount.json.js +20 -0
  122. package/dist/i18n/es_US/Company.BankAccount.json.js.map +1 -0
  123. package/dist/i18n/es_US/Company.DocumentList.json.js +28 -0
  124. package/dist/i18n/es_US/Company.DocumentList.json.js.map +1 -0
  125. package/dist/i18n/es_US/Company.FederalTaxes.json.js +28 -0
  126. package/dist/i18n/es_US/Company.FederalTaxes.json.js.map +1 -0
  127. package/dist/i18n/es_US/Company.Industry.json.js +12 -0
  128. package/dist/i18n/es_US/Company.Industry.json.js.map +1 -0
  129. package/dist/i18n/es_US/Company.Locations.json.js +44 -0
  130. package/dist/i18n/es_US/Company.Locations.json.js.map +1 -0
  131. package/dist/i18n/es_US/Company.OnboardingOverview.json.js +24 -0
  132. package/dist/i18n/es_US/Company.OnboardingOverview.json.js.map +1 -0
  133. package/dist/i18n/es_US/Company.PaySchedule.json.js +36 -0
  134. package/dist/i18n/es_US/Company.PaySchedule.json.js.map +1 -0
  135. package/dist/i18n/es_US/Company.SignatureForm.json.js +20 -0
  136. package/dist/i18n/es_US/Company.SignatureForm.json.js.map +1 -0
  137. package/dist/i18n/es_US/Company.StateTaxes.json.js +12 -0
  138. package/dist/i18n/es_US/Company.StateTaxes.json.js.map +1 -0
  139. package/dist/i18n/es_US/Company.TimeOff.CreateTimeOffPolicy.json.js +18 -0
  140. package/dist/i18n/es_US/Company.TimeOff.CreateTimeOffPolicy.json.js.map +1 -0
  141. package/dist/i18n/es_US/Company.TimeOff.EmployeeTable.json.js +26 -0
  142. package/dist/i18n/es_US/Company.TimeOff.EmployeeTable.json.js.map +1 -0
  143. package/dist/i18n/es_US/Company.TimeOff.HolidayPolicy.json.js +26 -0
  144. package/dist/i18n/es_US/Company.TimeOff.HolidayPolicy.json.js.map +1 -0
  145. package/dist/i18n/es_US/Company.TimeOff.PolicyDetail.json.js +14 -0
  146. package/dist/i18n/es_US/Company.TimeOff.PolicyDetail.json.js.map +1 -0
  147. package/dist/i18n/es_US/Company.TimeOff.SelectEmployees.json.js +22 -0
  148. package/dist/i18n/es_US/Company.TimeOff.SelectEmployees.json.js.map +1 -0
  149. package/dist/i18n/es_US/Company.TimeOff.SelectPolicyType.json.js +26 -0
  150. package/dist/i18n/es_US/Company.TimeOff.SelectPolicyType.json.js.map +1 -0
  151. package/dist/i18n/es_US/Company.TimeOff.TimeOffPolicies.json.js +40 -0
  152. package/dist/i18n/es_US/Company.TimeOff.TimeOffPolicies.json.js.map +1 -0
  153. package/dist/i18n/es_US/Company.TimeOff.TimeOffPolicyDetails.json.js +52 -0
  154. package/dist/i18n/es_US/Company.TimeOff.TimeOffPolicyDetails.json.js.map +1 -0
  155. package/dist/i18n/es_US/Company.TimeOff.TimeOffRequests.json.js +21 -0
  156. package/dist/i18n/es_US/Company.TimeOff.TimeOffRequests.json.js.map +1 -0
  157. package/dist/i18n/es_US/Contractor.Address.json.js +22 -0
  158. package/dist/i18n/es_US/Contractor.Address.json.js.map +1 -0
  159. package/dist/i18n/es_US/Contractor.BankAccountFields.json.js +12 -0
  160. package/dist/i18n/es_US/Contractor.BankAccountFields.json.js.map +1 -0
  161. package/dist/i18n/es_US/Contractor.ContractorList.json.js +24 -0
  162. package/dist/i18n/es_US/Contractor.ContractorList.json.js.map +1 -0
  163. package/dist/i18n/es_US/Contractor.Dashboard.json.js +14 -0
  164. package/dist/i18n/es_US/Contractor.Dashboard.json.js.map +1 -0
  165. package/dist/i18n/es_US/Contractor.DocumentsList.json.js +18 -0
  166. package/dist/i18n/es_US/Contractor.DocumentsList.json.js.map +1 -0
  167. package/dist/i18n/es_US/Contractor.Landing.json.js +18 -0
  168. package/dist/i18n/es_US/Contractor.Landing.json.js.map +1 -0
  169. package/dist/i18n/es_US/Contractor.Management.Address.json.js +14 -0
  170. package/dist/i18n/es_US/Contractor.Management.Address.json.js.map +1 -0
  171. package/dist/i18n/es_US/Contractor.Management.Compensation.json.js +22 -0
  172. package/dist/i18n/es_US/Contractor.Management.Compensation.json.js.map +1 -0
  173. package/dist/i18n/es_US/Contractor.Management.Documents.json.js +16 -0
  174. package/dist/i18n/es_US/Contractor.Management.Documents.json.js.map +1 -0
  175. package/dist/i18n/es_US/Contractor.Management.PaymentMethod.json.js +24 -0
  176. package/dist/i18n/es_US/Contractor.Management.PaymentMethod.json.js.map +1 -0
  177. package/dist/i18n/es_US/Contractor.Management.Profile.json.js +20 -0
  178. package/dist/i18n/es_US/Contractor.Management.Profile.json.js.map +1 -0
  179. package/dist/i18n/es_US/Contractor.ManagementContractorList.json.js +48 -0
  180. package/dist/i18n/es_US/Contractor.ManagementContractorList.json.js.map +1 -0
  181. package/dist/i18n/es_US/Contractor.NewHireReport.json.js +22 -0
  182. package/dist/i18n/es_US/Contractor.NewHireReport.json.js.map +1 -0
  183. package/dist/i18n/es_US/Contractor.OnboardingSummary.json.js +10 -0
  184. package/dist/i18n/es_US/Contractor.OnboardingSummary.json.js.map +1 -0
  185. package/dist/i18n/es_US/Contractor.PaymentMethod.json.js +20 -0
  186. package/dist/i18n/es_US/Contractor.PaymentMethod.json.js.map +1 -0
  187. package/dist/i18n/es_US/Contractor.Payments.CreateHistoricalPayment.json.js +34 -0
  188. package/dist/i18n/es_US/Contractor.Payments.CreateHistoricalPayment.json.js.map +1 -0
  189. package/dist/i18n/es_US/Contractor.Payments.CreatePayment.json.js +42 -0
  190. package/dist/i18n/es_US/Contractor.Payments.CreatePayment.json.js.map +1 -0
  191. package/dist/i18n/es_US/Contractor.Payments.HistoricalPaymentSummary.json.js +42 -0
  192. package/dist/i18n/es_US/Contractor.Payments.HistoricalPaymentSummary.json.js.map +1 -0
  193. package/dist/i18n/es_US/Contractor.Payments.PaymentHistory.json.js +26 -0
  194. package/dist/i18n/es_US/Contractor.Payments.PaymentHistory.json.js.map +1 -0
  195. package/dist/i18n/es_US/Contractor.Payments.PaymentStatement.json.js +22 -0
  196. package/dist/i18n/es_US/Contractor.Payments.PaymentStatement.json.js.map +1 -0
  197. package/dist/i18n/es_US/Contractor.Payments.PaymentSummary.json.js +54 -0
  198. package/dist/i18n/es_US/Contractor.Payments.PaymentSummary.json.js.map +1 -0
  199. package/dist/i18n/es_US/Contractor.Payments.PaymentsList.json.js +32 -0
  200. package/dist/i18n/es_US/Contractor.Payments.PaymentsList.json.js.map +1 -0
  201. package/dist/i18n/es_US/Contractor.Profile.json.js +18 -0
  202. package/dist/i18n/es_US/Contractor.Profile.json.js.map +1 -0
  203. package/dist/i18n/es_US/Contractor.SelectContractors.json.js +18 -0
  204. package/dist/i18n/es_US/Contractor.SelectContractors.json.js.map +1 -0
  205. package/dist/i18n/es_US/Contractor.SignatureForm.json.js +34 -0
  206. package/dist/i18n/es_US/Contractor.SignatureForm.json.js.map +1 -0
  207. package/dist/i18n/es_US/Contractor.Submit.json.js +26 -0
  208. package/dist/i18n/es_US/Contractor.Submit.json.js.map +1 -0
  209. package/dist/i18n/es_US/Employee.BankAccount.json.js +14 -0
  210. package/dist/i18n/es_US/Employee.BankAccount.json.js.map +1 -0
  211. package/dist/i18n/es_US/Employee.BankFormBody.json.js +12 -0
  212. package/dist/i18n/es_US/Employee.BankFormBody.json.js.map +1 -0
  213. package/dist/i18n/es_US/Employee.Compensation.json.js +68 -0
  214. package/dist/i18n/es_US/Employee.Compensation.json.js.map +1 -0
  215. package/dist/i18n/es_US/Employee.Dashboard.json.js +12 -0
  216. package/dist/i18n/es_US/Employee.Dashboard.json.js.map +1 -0
  217. package/dist/i18n/es_US/Employee.Deductions.json.js +142 -0
  218. package/dist/i18n/es_US/Employee.Deductions.json.js.map +1 -0
  219. package/dist/i18n/es_US/Employee.DeductionsForm.json.js +24 -0
  220. package/dist/i18n/es_US/Employee.DeductionsForm.json.js.map +1 -0
  221. package/dist/i18n/es_US/Employee.DocumentManager.json.js +10 -0
  222. package/dist/i18n/es_US/Employee.DocumentManager.json.js.map +1 -0
  223. package/dist/i18n/es_US/Employee.DocumentSigner.json.js +28 -0
  224. package/dist/i18n/es_US/Employee.DocumentSigner.json.js.map +1 -0
  225. package/dist/i18n/es_US/Employee.EmployeeDocuments.json.js +10 -0
  226. package/dist/i18n/es_US/Employee.EmployeeDocuments.json.js.map +1 -0
  227. package/dist/i18n/es_US/Employee.EmployeeList.json.js +30 -0
  228. package/dist/i18n/es_US/Employee.EmployeeList.json.js.map +1 -0
  229. package/dist/i18n/es_US/Employee.EmploymentEligibility.json.js +22 -0
  230. package/dist/i18n/es_US/Employee.EmploymentEligibility.json.js.map +1 -0
  231. package/dist/i18n/es_US/Employee.FederalTaxes.json.js +46 -0
  232. package/dist/i18n/es_US/Employee.FederalTaxes.json.js.map +1 -0
  233. package/dist/i18n/es_US/Employee.FederalTaxesView.json.js +38 -0
  234. package/dist/i18n/es_US/Employee.FederalTaxesView.json.js.map +1 -0
  235. package/dist/i18n/es_US/Employee.HomeAddress.json.js +24 -0
  236. package/dist/i18n/es_US/Employee.HomeAddress.json.js.map +1 -0
  237. package/dist/i18n/es_US/Employee.I9SignatureForm.json.js +64 -0
  238. package/dist/i18n/es_US/Employee.I9SignatureForm.json.js.map +1 -0
  239. package/dist/i18n/es_US/Employee.Landing.json.js +16 -0
  240. package/dist/i18n/es_US/Employee.Landing.json.js.map +1 -0
  241. package/dist/i18n/es_US/Employee.Management.Compensation.json.js +66 -0
  242. package/dist/i18n/es_US/Employee.Management.Compensation.json.js.map +1 -0
  243. package/dist/i18n/es_US/Employee.Management.Deductions.json.js +26 -0
  244. package/dist/i18n/es_US/Employee.Management.Deductions.json.js.map +1 -0
  245. package/dist/i18n/es_US/Employee.Management.Documents.json.js +18 -0
  246. package/dist/i18n/es_US/Employee.Management.Documents.json.js.map +1 -0
  247. package/dist/i18n/es_US/Employee.Management.FederalTaxes.json.js +42 -0
  248. package/dist/i18n/es_US/Employee.Management.FederalTaxes.json.js.map +1 -0
  249. package/dist/i18n/es_US/Employee.Management.HomeAddress.json.js +56 -0
  250. package/dist/i18n/es_US/Employee.Management.HomeAddress.json.js.map +1 -0
  251. package/dist/i18n/es_US/Employee.Management.PaymentMethod.json.js +24 -0
  252. package/dist/i18n/es_US/Employee.Management.PaymentMethod.json.js.map +1 -0
  253. package/dist/i18n/es_US/Employee.Management.PaymentMethodBankForm.json.js +12 -0
  254. package/dist/i18n/es_US/Employee.Management.PaymentMethodBankForm.json.js.map +1 -0
  255. package/dist/i18n/es_US/Employee.Management.PaymentMethodSplitForm.json.js +22 -0
  256. package/dist/i18n/es_US/Employee.Management.PaymentMethodSplitForm.json.js.map +1 -0
  257. package/dist/i18n/es_US/Employee.Management.Paystubs.json.js +28 -0
  258. package/dist/i18n/es_US/Employee.Management.Paystubs.json.js.map +1 -0
  259. package/dist/i18n/es_US/Employee.Management.Profile.json.js +16 -0
  260. package/dist/i18n/es_US/Employee.Management.Profile.json.js.map +1 -0
  261. package/dist/i18n/es_US/Employee.Management.StateTaxes.json.js +16 -0
  262. package/dist/i18n/es_US/Employee.Management.StateTaxes.json.js.map +1 -0
  263. package/dist/i18n/es_US/Employee.Management.WorkAddress.json.js +52 -0
  264. package/dist/i18n/es_US/Employee.Management.WorkAddress.json.js.map +1 -0
  265. package/dist/i18n/es_US/Employee.ManagementEmployeeList.json.js +26 -0
  266. package/dist/i18n/es_US/Employee.ManagementEmployeeList.json.js.map +1 -0
  267. package/dist/i18n/es_US/Employee.OnboardingSummary.json.js +22 -0
  268. package/dist/i18n/es_US/Employee.OnboardingSummary.json.js.map +1 -0
  269. package/dist/i18n/es_US/Employee.PaySchedules.json.js +12 -0
  270. package/dist/i18n/es_US/Employee.PaySchedules.json.js.map +1 -0
  271. package/dist/i18n/es_US/Employee.PaymentMethod.json.js +68 -0
  272. package/dist/i18n/es_US/Employee.PaymentMethod.json.js.map +1 -0
  273. package/dist/i18n/es_US/Employee.Profile.json.js +32 -0
  274. package/dist/i18n/es_US/Employee.Profile.json.js.map +1 -0
  275. package/dist/i18n/es_US/Employee.SplitPaycheck.json.js +26 -0
  276. package/dist/i18n/es_US/Employee.SplitPaycheck.json.js.map +1 -0
  277. package/dist/i18n/es_US/Employee.SplitPaymentsFormBody.json.js +22 -0
  278. package/dist/i18n/es_US/Employee.SplitPaymentsFormBody.json.js.map +1 -0
  279. package/dist/i18n/es_US/Employee.StateTaxes.json.js +14 -0
  280. package/dist/i18n/es_US/Employee.StateTaxes.json.js.map +1 -0
  281. package/dist/i18n/es_US/Employee.StateTaxesView.json.js +12 -0
  282. package/dist/i18n/es_US/Employee.StateTaxesView.json.js.map +1 -0
  283. package/dist/i18n/es_US/Employee.Terminations.TerminateEmployee.json.js +18 -0
  284. package/dist/i18n/es_US/Employee.Terminations.TerminateEmployee.json.js.map +1 -0
  285. package/dist/i18n/es_US/Employee.Terminations.TerminationFlow.json.js +12 -0
  286. package/dist/i18n/es_US/Employee.Terminations.TerminationFlow.json.js.map +1 -0
  287. package/dist/i18n/es_US/Employee.Terminations.TerminationSummary.json.js +20 -0
  288. package/dist/i18n/es_US/Employee.Terminations.TerminationSummary.json.js.map +1 -0
  289. package/dist/i18n/es_US/InformationRequests.InformationRequestForm.json.js +20 -0
  290. package/dist/i18n/es_US/InformationRequests.InformationRequestForm.json.js.map +1 -0
  291. package/dist/i18n/es_US/InformationRequests.InformationRequestList.json.js +18 -0
  292. package/dist/i18n/es_US/InformationRequests.InformationRequestList.json.js.map +1 -0
  293. package/dist/i18n/es_US/InformationRequests.json.js +8 -0
  294. package/dist/i18n/es_US/InformationRequests.json.js.map +1 -0
  295. package/dist/i18n/es_US/Payroll.Common.json.js +8 -0
  296. package/dist/i18n/es_US/Payroll.Common.json.js.map +1 -0
  297. package/dist/i18n/es_US/Payroll.ConfirmWireDetailsBanner.json.js +14 -0
  298. package/dist/i18n/es_US/Payroll.ConfirmWireDetailsBanner.json.js.map +1 -0
  299. package/dist/i18n/es_US/Payroll.ConfirmWireDetailsForm.json.js +26 -0
  300. package/dist/i18n/es_US/Payroll.ConfirmWireDetailsForm.json.js.map +1 -0
  301. package/dist/i18n/es_US/Payroll.Dismissal.json.js +16 -0
  302. package/dist/i18n/es_US/Payroll.Dismissal.json.js.map +1 -0
  303. package/dist/i18n/es_US/Payroll.EmployeeSelection.json.js +8 -0
  304. package/dist/i18n/es_US/Payroll.EmployeeSelection.json.js.map +1 -0
  305. package/dist/i18n/es_US/Payroll.GrossUpModal.json.js +26 -0
  306. package/dist/i18n/es_US/Payroll.GrossUpModal.json.js.map +1 -0
  307. package/dist/i18n/es_US/Payroll.OffCycle.json.js +8 -0
  308. package/dist/i18n/es_US/Payroll.OffCycle.json.js.map +1 -0
  309. package/dist/i18n/es_US/Payroll.OffCycleCreation.json.js +16 -0
  310. package/dist/i18n/es_US/Payroll.OffCycleCreation.json.js.map +1 -0
  311. package/dist/i18n/es_US/Payroll.OffCycleDeductionsSetting.json.js +8 -0
  312. package/dist/i18n/es_US/Payroll.OffCycleDeductionsSetting.json.js.map +1 -0
  313. package/dist/i18n/es_US/Payroll.OffCyclePayPeriodDateForm.json.js +14 -0
  314. package/dist/i18n/es_US/Payroll.OffCyclePayPeriodDateForm.json.js.map +1 -0
  315. package/dist/i18n/es_US/Payroll.OffCycleReasonSelection.json.js +12 -0
  316. package/dist/i18n/es_US/Payroll.OffCycleReasonSelection.json.js.map +1 -0
  317. package/dist/i18n/es_US/Payroll.OffCycleTaxWithholding.json.js +16 -0
  318. package/dist/i18n/es_US/Payroll.OffCycleTaxWithholding.json.js.map +1 -0
  319. package/dist/i18n/es_US/Payroll.PayrollBlocker.json.js +34 -0
  320. package/dist/i18n/es_US/Payroll.PayrollBlocker.json.js.map +1 -0
  321. package/dist/i18n/es_US/Payroll.PayrollConfiguration.json.js +44 -0
  322. package/dist/i18n/es_US/Payroll.PayrollConfiguration.json.js.map +1 -0
  323. package/dist/i18n/es_US/Payroll.PayrollEditEmployee.json.js +66 -0
  324. package/dist/i18n/es_US/Payroll.PayrollEditEmployee.json.js.map +1 -0
  325. package/dist/i18n/es_US/Payroll.PayrollHistory.json.js +22 -0
  326. package/dist/i18n/es_US/Payroll.PayrollHistory.json.js.map +1 -0
  327. package/dist/i18n/es_US/Payroll.PayrollLanding.json.js +16 -0
  328. package/dist/i18n/es_US/Payroll.PayrollLanding.json.js.map +1 -0
  329. package/dist/i18n/es_US/Payroll.PayrollList.json.js +38 -0
  330. package/dist/i18n/es_US/Payroll.PayrollList.json.js.map +1 -0
  331. package/dist/i18n/es_US/Payroll.PayrollOverview.json.js +70 -0
  332. package/dist/i18n/es_US/Payroll.PayrollOverview.json.js.map +1 -0
  333. package/dist/i18n/es_US/Payroll.PayrollReceipts.json.js +20 -0
  334. package/dist/i18n/es_US/Payroll.PayrollReceipts.json.js.map +1 -0
  335. package/dist/i18n/es_US/Payroll.RecoveryCasesList.json.js +20 -0
  336. package/dist/i18n/es_US/Payroll.RecoveryCasesList.json.js.map +1 -0
  337. package/dist/i18n/es_US/Payroll.RecoveryCasesResubmit.json.js +8 -0
  338. package/dist/i18n/es_US/Payroll.RecoveryCasesResubmit.json.js.map +1 -0
  339. package/dist/i18n/es_US/Payroll.Transition.json.js +8 -0
  340. package/dist/i18n/es_US/Payroll.Transition.json.js.map +1 -0
  341. package/dist/i18n/es_US/Payroll.TransitionCreation.json.js +20 -0
  342. package/dist/i18n/es_US/Payroll.TransitionCreation.json.js.map +1 -0
  343. package/dist/i18n/es_US/Payroll.TransitionPayrollAlert.json.js +18 -0
  344. package/dist/i18n/es_US/Payroll.TransitionPayrollAlert.json.js.map +1 -0
  345. package/dist/i18n/es_US/Payroll.WireInstructions.json.js +30 -0
  346. package/dist/i18n/es_US/Payroll.WireInstructions.json.js.map +1 -0
  347. package/dist/i18n/es_US/common.json.js +44 -0
  348. package/dist/i18n/es_US/common.json.js.map +1 -0
  349. package/dist/i18n/types.d.ts +262 -6
  350. package/dist/index.d.ts +2 -2
  351. package/dist/models/external.d.ts +23 -0
  352. package/dist/style.css +1 -1
  353. package/docs/guides/endpoint-inventory.json +5 -0
  354. package/package.json +10 -10
@@ -0,0 +1,58 @@
1
+ import { jsx as e, jsxs as n } from "react/jsx-runtime";
2
+ import { useEmployeesGetSuspense as _ } from "@gusto/embedded-api/react-query/employeesGet";
3
+ import { useMemo as A } from "react";
4
+ import { useTranslation as g } from "react-i18next";
5
+ import { usePreparedPayrollData as x } from "../usePreparedPayrollData.js";
6
+ import T from "./UNSTABLE_PayrollEditEmployee.module.scss.js";
7
+ import { componentEvents as m } from "../../../shared/constants.js";
8
+ import { BaseComponent as B } from "../../Base/Base.js";
9
+ import { useBase as D } from "../../Base/useBase.js";
10
+ import { useComponentDictionary as S, useI18n as U } from "../../../i18n/I18n.js";
11
+ import { useComponentContext as O } from "../../../contexts/ComponentAdapter/useComponentContext.js";
12
+ import { Flex as a } from "../../Common/Flex/Flex.js";
13
+ import { firstLastName as v } from "../../../helpers/formattedStrings.js";
14
+ function J(o) {
15
+ return /* @__PURE__ */ e(B, { ...o, children: /* @__PURE__ */ e(R, { ...o, children: o.children }) });
16
+ }
17
+ const R = ({
18
+ employeeId: o,
19
+ companyId: c,
20
+ payrollId: p,
21
+ onEvent: l,
22
+ dictionary: d
23
+ }) => {
24
+ S("Payroll.UNSTABLE_PayrollEditEmployee", d), U("Payroll.UNSTABLE_PayrollEditEmployee");
25
+ const { t } = g("Payroll.UNSTABLE_PayrollEditEmployee"), { LoadingIndicator: y } = D(), { Button: i, Heading: s, Text: f } = O(), { data: E } = _({ employeeId: o }), u = A(() => [o], [o]), { preparedPayroll: h, isLoading: L } = x({
26
+ companyId: c,
27
+ payrollId: p,
28
+ employeeUuids: u
29
+ }), r = E.employee, P = () => {
30
+ l(m.RUN_PAYROLL_EMPLOYEE_SAVED, {
31
+ payrollPrepared: h,
32
+ employee: r
33
+ });
34
+ }, C = () => {
35
+ l(m.RUN_PAYROLL_EMPLOYEE_CANCELLED);
36
+ };
37
+ if (L || !r)
38
+ return /* @__PURE__ */ e(y, {});
39
+ const N = v({
40
+ first_name: r.firstName,
41
+ last_name: r.lastName
42
+ });
43
+ return /* @__PURE__ */ e("div", { className: T.container, children: /* @__PURE__ */ n(a, { justifyContent: "space-between", alignItems: "flex-start", gap: 12, children: [
44
+ /* @__PURE__ */ n(a, { flexDirection: "column", gap: 8, children: [
45
+ /* @__PURE__ */ e(s, { as: "h1", styledAs: "h2", children: t("pageTitle", { employeeName: N }) }),
46
+ /* @__PURE__ */ e(s, { as: "h2", styledAs: "h3", children: "TODO: Gross pay calculation" }),
47
+ /* @__PURE__ */ e(f, { children: t("grossPayLabel") })
48
+ ] }),
49
+ /* @__PURE__ */ n(a, { justifyContent: "flex-end", gap: 12, children: [
50
+ /* @__PURE__ */ e(i, { variant: "secondary", onClick: C, title: t("cancelCta"), children: t("cancelCta") }),
51
+ /* @__PURE__ */ e(i, { onClick: P, title: t("saveCta"), children: t("saveCta") })
52
+ ] })
53
+ ] }) });
54
+ };
55
+ export {
56
+ J as UNSTABLE_PayrollEditEmployee
57
+ };
58
+ //# sourceMappingURL=UNSTABLE_PayrollEditEmployee.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UNSTABLE_PayrollEditEmployee.js","sources":["../../../../src/components/Payroll/UNSTABLE_PayrollEditEmployee/UNSTABLE_PayrollEditEmployee.tsx"],"sourcesContent":["import { useEmployeesGetSuspense } from '@gusto/embedded-api/react-query/employeesGet'\nimport { useMemo } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport type { PayrollEditEmployeeProps } from '../PayrollEditEmployee/PayrollEditEmployee'\nimport { usePreparedPayrollData } from '../usePreparedPayrollData'\nimport styles from './UNSTABLE_PayrollEditEmployee.module.scss'\nimport { componentEvents } from '@/shared/constants'\nimport { BaseComponent } from '@/components/Base/Base'\nimport { useBase } from '@/components/Base/useBase'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { Flex } from '@/components/Common'\nimport { firstLastName } from '@/helpers/formattedStrings'\n\n/**\n * In-development regular-rate-of-pay rebuild of {@link PayrollEditEmployee}.\n *\n * @remarks\n * Gated behind the `payrollRegularRateOfPay` unstable feature flag and not part of the public\n * SDK surface. `PayrollEditEmployee` renders this in place of the stable editor when the flag is\n * enabled. Currently a scaffold: the header, `Cancel`, and `Save` controls only. `Cancel` and\n * `Save` emit the same events as the stable component so the surrounding flow behaves identically.\n *\n * @internal\n */\nexport function UNSTABLE_PayrollEditEmployee(props: PayrollEditEmployeeProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nconst Root = ({\n employeeId,\n companyId,\n payrollId,\n onEvent,\n dictionary,\n}: PayrollEditEmployeeProps) => {\n useComponentDictionary('Payroll.UNSTABLE_PayrollEditEmployee', dictionary)\n useI18n('Payroll.UNSTABLE_PayrollEditEmployee')\n const { t } = useTranslation('Payroll.UNSTABLE_PayrollEditEmployee')\n\n const { LoadingIndicator } = useBase()\n const { Button, Heading, Text } = useComponentContext()\n\n const { data: employeeData } = useEmployeesGetSuspense({ employeeId })\n const memoizedEmployeeId = useMemo(() => [employeeId], [employeeId])\n const { preparedPayroll, isLoading } = usePreparedPayrollData({\n companyId,\n payrollId,\n employeeUuids: memoizedEmployeeId,\n })\n\n const employee = employeeData.employee\n\n const onSave = () => {\n // TODO: Once the save mutation is wired up, emit the updated payroll returned by the update\n // response here instead of the current prepared payroll from the query.\n onEvent(componentEvents.RUN_PAYROLL_EMPLOYEE_SAVED, {\n payrollPrepared: preparedPayroll,\n employee,\n })\n }\n\n const onCancel = () => {\n onEvent(componentEvents.RUN_PAYROLL_EMPLOYEE_CANCELLED)\n }\n\n if (isLoading || !employee) {\n return <LoadingIndicator />\n }\n\n const employeeName = firstLastName({\n first_name: employee.firstName,\n last_name: employee.lastName,\n })\n\n return (\n <div className={styles.container}>\n <Flex justifyContent=\"space-between\" alignItems=\"flex-start\" gap={12}>\n <Flex flexDirection=\"column\" gap={8}>\n <Heading as=\"h1\" styledAs=\"h2\">\n {t('pageTitle', { employeeName })}\n </Heading>\n <Heading as=\"h2\" styledAs=\"h3\">\n {/* TODO: Gross pay calculation pending decision on client-side RRoP calculation. */}\n TODO: Gross pay calculation\n </Heading>\n <Text>{t('grossPayLabel')}</Text>\n </Flex>\n <Flex justifyContent=\"flex-end\" gap={12}>\n <Button variant=\"secondary\" onClick={onCancel} title={t('cancelCta')}>\n {t('cancelCta')}\n </Button>\n <Button onClick={onSave} title={t('saveCta')}>\n {t('saveCta')}\n </Button>\n </Flex>\n </Flex>\n </div>\n )\n}\n"],"names":["UNSTABLE_PayrollEditEmployee","props","jsx","BaseComponent","Root","employeeId","companyId","payrollId","onEvent","dictionary","useComponentDictionary","useI18n","useTranslation","LoadingIndicator","useBase","Button","Heading","Text","useComponentContext","employeeData","useEmployeesGetSuspense","memoizedEmployeeId","useMemo","preparedPayroll","isLoading","usePreparedPayrollData","employee","onSave","componentEvents","onCancel","employeeName","firstLastName","styles","jsxs","Flex"],"mappings":";;;;;;;;;;;;;AAyBO,SAASA,EAA6BC,GAAiC;AAC5E,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAEA,MAAMG,IAAO,CAAC;AAAA,EACZ,YAAAC;AAAA,EACA,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,SAAAC;AAAA,EACA,YAAAC;AACF,MAAgC;AAC9B,EAAAC,EAAuB,wCAAwCD,CAAU,GACzEE,EAAQ,sCAAsC;AAC9C,QAAM,EAAE,EAAA,I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AAA,IACA,gBAAAgB,EAACC,GAAA,EAAK,gBAAe,YAAW,KAAK,IACnC,UAAA;AAAA,MAAA,gBAAAhC,EAACa,GAAA,EAAO,SAAQ,aAAY,SAASc,GAAU,OAAO,EAAE,WAAW,GAChE,UAAA,EAAE,WAAW,EAAA,CAChB;AAAA,MACA,gBAAA3B,EAACa,GAAA,EAAO,SAASY,GAAQ,OAAO,EAAE,SAAS,GACxC,UAAA,EAAE,SAAS,EAAA,CACd;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,EAAA,CACF,EAAA,CACF;AAEJ;"}
@@ -0,0 +1,8 @@
1
+ const n = "_container_15e3y_1", t = {
2
+ container: n
3
+ };
4
+ export {
5
+ n as container,
6
+ t as default
7
+ };
8
+ //# sourceMappingURL=UNSTABLE_PayrollEditEmployee.module.scss.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UNSTABLE_PayrollEditEmployee.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
@@ -117,6 +117,21 @@ export declare const cleanupReimbursements: (reimbursements: Reimbursement[]) =>
117
117
  * @internal
118
118
  */
119
119
  export declare const formatHoursDisplay: (hours: number) => string;
120
+ /**
121
+ * Whether an FLSA status is eligible for regular-rate-of-pay overtime.
122
+ *
123
+ * @remarks
124
+ * Only the nonexempt family (`Nonexempt`, `Salaried Nonexempt`,
125
+ * `Commission Only Nonexempt`) earns overtime premiums, so only those statuses
126
+ * warrant per-workweek breakdowns. `Exempt`, `Owner`, and
127
+ * `Commission Only Exempt` are never overtime-eligible. An unknown status
128
+ * returns `false` (treat as flat, never show meaningless workweek columns).
129
+ *
130
+ * @param flsaStatus - The employee's FLSA status, e.g. from `hourlyCompensations[].flsaStatus`.
131
+ * @returns `true` only for the three nonexempt statuses.
132
+ * @internal
133
+ */
134
+ export declare const isOvertimeEligibleFlsaStatus: (flsaStatus: string | undefined) => boolean;
120
135
  /**
121
136
  * Calculates an employee's gross pay for a payroll, combining regular and overtime pay,
122
137
  * additional earnings, PTO pay, and any minimum-wage adjustment.
@@ -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'\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\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\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 * Determines whether a payroll can be cancelled based on its status, deadline, and the 4:00 PM PT cutoff.\n *\n * @remarks\n * Returns `true` only when the payroll has been processed, `payrollStatusMeta.cancellable` is not explicitly `false`,\n * the payroll has a `payrollDeadline`, and the current time is before 4:00 PM Pacific Time on that deadline date.\n *\n * @param payroll - The payroll to evaluate.\n * @returns `true` if the payroll is still cancellable, `false` otherwise.\n * @internal\n */\nexport const canCancelPayroll = (payroll: Payroll): boolean => {\n if (payroll.payrollStatusMeta?.cancellable === false) {\n return false\n }\n\n if (!payroll.processed) {\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","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","OFF_CYCLE_REASON_LABELS","getPayrollTypeLabel","payroll","getAdditionalEarningsCompensations","flsaStatus","existingFixedCompensations","primaryJobUuid","fixedCompensationTypes","excludedTypes","allFixedCompensations","FlsaStatus","type","comp","calculateTotalPayroll","payrollData","getPacificTimeOffset","date","year","secondSundayMarch","firstSundayNovember","canCancelPayroll","now","deadline","nowInPT","MS_PER_HOUR","deadlineInPT","cutoffTime"],"mappings":";;;;;;;;AAwBA,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,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K,YAAA,GAEZE,IAAoB,IAAI,KAAKD,GAAM,GAAG,CAAC;AAC7C,EAAAC,EAAkB,QAAQ,KAAK,IAAIA,EAAkB,OAAA,KAAY,CAAC;AAElE,QAAMC,IAAsB,IAAI,KAAKF,GAAM,IAAI,CAAC;AAChD,SAAAE,EAAoB,QAAQ,KAAM,IAAIA,EAAoB,OAAA,KAAY,CAAE,GAE1DH,KAAQE,KAAqBF,IAAOG,IACnC,KAAK;AACtB,GAaaC,KAAmB,CAAClB,MAA8B;AAS7D,MARIA,EAAQ,mBAAmB,gBAAgB,MAI3C,CAACA,EAAQ,aAIT,CAACA,EAAQ;AACX,WAAO;AAGT,QAAMmB,wBAAU,KAAA,GACVC,IAAW,IAAI,KAAKpB,EAAQ,eAAe,GAE3CqB,IAAU,IAAI,KAAKF,EAAI,YAAYN,EAAqBM,CAAG,IAAIG,CAAW,GAC1EC,IAAe,IAAI,KAAKH,EAAS,YAAYP,EAAqBO,CAAQ,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/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'\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\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 * Determines whether a payroll can be cancelled based on its status, deadline, and the 4:00 PM PT cutoff.\n *\n * @remarks\n * Returns `true` only when the payroll has been processed, `payrollStatusMeta.cancellable` is not explicitly `false`,\n * the payroll has a `payrollDeadline`, and the current time is before 4:00 PM Pacific Time on that deadline date.\n *\n * @param payroll - The payroll to evaluate.\n * @returns `true` if the payroll is still cancellable, `false` otherwise.\n * @internal\n */\nexport const canCancelPayroll = (payroll: Payroll): boolean => {\n if (payroll.payrollStatusMeta?.cancellable === false) {\n return false\n }\n\n if (!payroll.processed) {\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","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","OFF_CYCLE_REASON_LABELS","getPayrollTypeLabel","payroll","getAdditionalEarningsCompensations","flsaStatus","existingFixedCompensations","primaryJobUuid","fixedCompensationTypes","excludedTypes","allFixedCompensations","FlsaStatus","type","comp","calculateTotalPayroll","payrollData","getPacificTimeOffset","date","year","secondSundayMarch","firstSundayNovember","canCancelPayroll","now","deadline","nowInPT","MS_PER_HOUR","deadlineInPT","cutoffTime"],"mappings":";;;;;;;;AAwBA,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,m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AAM,GAAG,CAAC;AAC7C,EAAAC,EAAkB,QAAQ,KAAK,IAAIA,EAAkB,OAAA,KAAY,CAAC;AAElE,QAAMC,IAAsB,IAAI,KAAKF,GAAM,IAAI,CAAC;AAChD,SAAAE,EAAoB,QAAQ,KAAM,IAAIA,EAAoB,OAAA,KAAY,CAAE,GAE1DH,KAAQE,KAAqBF,IAAOG,IACnC,KAAK;AACtB,GAaaC,KAAmB,CAAClB,MAA8B;AAS7D,MARIA,EAAQ,mBAAmB,gBAAgB,MAI3C,CAACA,EAAQ,aAIT,CAACA,EAAQ;AACX,WAAO;AAGT,QAAMmB,wBAAU,KAAA,GACVC,IAAW,IAAI,KAAKpB,EAAQ,eAAe,GAE3CqB,IAAU,IAAI,KAAKF,EAAI,YAAYN,EAAqBM,CAAG,IAAIG,CAAW,GAC1EC,IAAe,IAAI,KAAKH,EAAS,YAAYP,EAAqBO,CAAQ,IAAIE,CAAW,GAEzFE,IAAa,IAAI,KAAKD,CAAY;AAGxC,SAFAC,EAAW,YAAY,IAAI,GAAG,GAAG,CAAC,GAE9B,EAAAH,KAAWG;AAKjB;"}
@@ -1,45 +1,45 @@
1
1
  import { jsx as r, jsxs as V } from "react/jsx-runtime";
2
- import { useMemo as s } from "react";
2
+ import { useMemo as m } from "react";
3
3
  import { useTranslation as F } from "react-i18next";
4
- import h from "./EmployeeTable.module.scss.js";
4
+ import f from "./EmployeeTable.module.scss.js";
5
5
  import { EmptyData as I } from "../../../Common/EmptyData/EmptyData.js";
6
6
  import { useComponentContext as O } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
7
7
  import { useI18n as P } from "../../../../i18n/I18n.js";
8
8
  import { firstLastName as _ } from "../../../../helpers/formattedStrings.js";
9
9
  import H from "../../../../assets/icons/search-lg.svg.js";
10
- import { useDataView as W } from "../../../Common/DataView/useDataView.js";
11
- import { DataView as $ } from "../../../Common/DataView/DataView.js";
10
+ import { useDataView as M } from "../../../Common/DataView/useDataView.js";
11
+ import { DataView as W } from "../../../Common/DataView/DataView.js";
12
12
  function ee({
13
13
  data: o,
14
- label: d,
15
- additionalColumns: m = [],
14
+ label: h,
15
+ additionalColumns: s = [],
16
16
  hideJobTitle: l,
17
17
  searchValue: i,
18
- onSearchChange: y,
19
- onSearchClear: b,
20
- searchPlaceholder: E,
21
- hideSearch: T,
22
- selectionMode: g,
18
+ onSearchChange: d,
19
+ onSearchClear: y,
20
+ searchPlaceholder: b,
21
+ hideSearch: E,
22
+ selectionMode: T,
23
23
  onSelect: c,
24
- onSelectAll: C,
25
- getIsItemSelected: S,
26
- hideSelectAll: N,
27
- itemMenu: p,
24
+ onSelectAll: g,
25
+ getIsItemSelected: C,
26
+ hideSelectAll: S,
27
+ itemMenu: N,
28
28
  pagination: j,
29
29
  isFetching: k,
30
- emptyState: u,
30
+ emptyState: p,
31
31
  emptySearchState: a,
32
- footer: v
32
+ footer: x
33
33
  }) {
34
34
  P("Company.TimeOff.EmployeeTable");
35
- const { t } = F("Company.TimeOff.EmployeeTable"), x = O(), n = i.length > 0 && o.length === 0, L = (e) => {
36
- y(e), e || b();
37
- }, f = s(() => {
35
+ const { t } = F("Company.TimeOff.EmployeeTable"), L = O(), n = i.length > 0 && o.length === 0, v = (e) => {
36
+ d(e), e || y();
37
+ }, u = m(() => {
38
38
  const e = t("noSearchResults");
39
39
  return function() {
40
- return /* @__PURE__ */ r(q, { message: e });
40
+ return /* @__PURE__ */ r($, { message: e });
41
41
  };
42
- }, [t]), w = s(() => n && a ? a : n ? f : u, [n, a, u, f]), D = s(
42
+ }, [t]), w = m(() => n && a ? a : n ? u : p, [n, a, p, u]), D = m(
43
43
  () => [
44
44
  {
45
45
  key: "name",
@@ -56,37 +56,37 @@ function ee({
56
56
  render: (e) => e.jobTitle ?? ""
57
57
  }
58
58
  ],
59
- ...m
59
+ ...s
60
60
  ],
61
- [t, m, l]
62
- ), R = W({
61
+ [t, s, l]
62
+ ), R = M({
63
63
  data: o,
64
64
  columns: D,
65
- itemMenu: p,
65
+ itemMenu: N,
66
66
  pagination: j,
67
67
  isFetching: k,
68
68
  emptyState: w,
69
- footer: v,
70
- ...c && { selectionMode: g, onSelect: c, onSelectAll: C, getIsItemSelected: S, hideSelectAll: N }
69
+ footer: x,
70
+ ...c && { selectionMode: T, onSelect: c, onSelectAll: g, getIsItemSelected: C, hideSelectAll: S }
71
71
  });
72
- return /* @__PURE__ */ V("div", { className: h.root, "data-has-menu": p ? !0 : void 0, children: [
73
- !T && /* @__PURE__ */ r("div", { className: h.searchContainer, children: /* @__PURE__ */ r(
74
- x.TextInput,
72
+ return /* @__PURE__ */ V("div", { className: f.root, children: [
73
+ !E && /* @__PURE__ */ r("div", { className: f.searchContainer, children: /* @__PURE__ */ r(
74
+ L.TextInput,
75
75
  {
76
76
  name: "employee-search",
77
77
  type: "search",
78
78
  label: t("searchLabel"),
79
79
  shouldVisuallyHideLabel: !0,
80
- placeholder: E ?? t("searchPlaceholder"),
80
+ placeholder: b ?? t("searchPlaceholder"),
81
81
  value: i,
82
- onChange: L,
82
+ onChange: v,
83
83
  adornmentStart: /* @__PURE__ */ r(H, { "aria-hidden": !0 })
84
84
  }
85
85
  ) }),
86
- /* @__PURE__ */ r($, { label: d ?? t("tableLabel"), ...R })
86
+ /* @__PURE__ */ r(W, { label: h ?? t("tableLabel"), ...R })
87
87
  ] });
88
88
  }
89
- function q({ message: o }) {
89
+ function $({ message: o }) {
90
90
  return /* @__PURE__ */ r(I, { title: o });
91
91
  }
92
92
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"EmployeeTable.js","sources":["../../../../../src/components/TimeOff/shared/EmployeeTable/EmployeeTable.tsx"],"sourcesContent":["import { useMemo } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport type { EmployeeTableItem, EmployeeTableProps } from './EmployeeTableTypes'\nimport styles from './EmployeeTable.module.scss'\nimport { DataView, EmptyData, useDataView } from '@/components/Common'\nimport type { useDataViewProp } from '@/components/Common/DataView/useDataView'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n/I18n'\nimport { firstLastName } from '@/helpers/formattedStrings'\nimport SearchIcon from '@/assets/icons/search-lg.svg?react'\n\n/** @internal */\nexport function EmployeeTable<T extends EmployeeTableItem>({\n data,\n label,\n additionalColumns = [],\n hideJobTitle,\n searchValue,\n onSearchChange,\n onSearchClear,\n searchPlaceholder,\n hideSearch,\n selectionMode,\n onSelect,\n onSelectAll,\n getIsItemSelected,\n hideSelectAll,\n itemMenu,\n pagination,\n isFetching,\n emptyState,\n emptySearchState,\n footer,\n}: EmployeeTableProps<T>) {\n useI18n('Company.TimeOff.EmployeeTable')\n const { t } = useTranslation('Company.TimeOff.EmployeeTable')\n const Components = useComponentContext()\n\n const isSearchWithNoResults = searchValue.length > 0 && data.length === 0\n\n const handleSearchChange = (value: string) => {\n onSearchChange(value)\n if (!value) onSearchClear()\n }\n\n const defaultEmptySearch = useMemo(() => {\n const noSearchResults = t('noSearchResults')\n return function EmptySearchFallback() {\n return <DefaultEmptySearchState message={noSearchResults} />\n }\n }, [t])\n\n const resolvedEmptyState = useMemo(() => {\n if (isSearchWithNoResults && emptySearchState) {\n return emptySearchState\n }\n if (isSearchWithNoResults) {\n return defaultEmptySearch\n }\n return emptyState\n }, [isSearchWithNoResults, emptySearchState, emptyState, defaultEmptySearch])\n\n const columns = useMemo(\n () => [\n {\n key: 'name',\n title: t('name'),\n render: (item: T) => (\n <span id={`employee-name-${item.uuid}`}>\n {firstLastName({\n first_name: item.firstName,\n last_name: item.lastName,\n }) || t('unknownEmployeeFallback')}\n </span>\n ),\n },\n ...(hideJobTitle\n ? []\n : [\n {\n key: 'jobTitle' as keyof T,\n title: t('jobTitle'),\n render: (item: T) => item.jobTitle ?? '',\n },\n ]),\n ...additionalColumns,\n ],\n [t, additionalColumns, hideJobTitle],\n )\n\n const dataViewProps = useDataView<T>({\n data,\n columns,\n itemMenu,\n pagination,\n isFetching,\n emptyState: resolvedEmptyState,\n footer,\n ...(onSelect && { selectionMode, onSelect, onSelectAll, getIsItemSelected, hideSelectAll }),\n } as useDataViewProp<T>)\n\n return (\n <div className={styles.root} data-has-menu={itemMenu ? true : undefined}>\n {!hideSearch && (\n <div className={styles.searchContainer}>\n <Components.TextInput\n name=\"employee-search\"\n type=\"search\"\n label={t('searchLabel')}\n shouldVisuallyHideLabel\n placeholder={searchPlaceholder ?? t('searchPlaceholder')}\n value={searchValue}\n onChange={handleSearchChange}\n adornmentStart={<SearchIcon aria-hidden />}\n />\n </div>\n )}\n <DataView label={label ?? t('tableLabel')} {...dataViewProps} />\n </div>\n )\n}\n\nfunction DefaultEmptySearchState({ message }: { message: string }) {\n return <EmptyData title={message} />\n}\n"],"names":["EmployeeTable","data","label","additionalColumns","hideJobTitle","searchValue","onSearchChange","onSearchClear","searchPlaceholder","hideSearch","selectionMode","onSelect","onSelectAll","getIsItemSelected","hideSelectAll","itemMenu","pagination","isFetching","emptyState","emptySearchState","footer","useI18n","useTranslation","Components","useComponentContext","isSearchWithNoResults","handleSearchChange","value","defaultEmptySearch","useMemo","noSearchResults","jsx","DefaultEmptySearchState","resolvedEmptyState","columns","item","firstLastName","dataViewProps","useDataView","jsxs","styles","SearchIcon","DataView","message","EmptyData"],"mappings":";;;;;;;;;;;AAYO,SAASA,GAA2C;AAAA,EACzD,MAAAC;AAAA,EACA,OAAAC;AAAA,EACA,mBAAAC,IAAoB,CAAA;AAAA,EACpB,cAAAC;AAAA,EACA,aAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,eAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,YAAAC;AAAA,EACA,eAAAC;AAAA,EACA,UAAAC;AAAA,EACA,aAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,eAAAC;AAAA,EACA,UAAAC;AAAA,EACA,YAAAC;AAAA,EACA,YAAAC;AAAA,EACA,YAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,QAAAC;AACF,GAA0B;AACxB,EAAAC,EAAQ,+BAA+B;AACvC,QAAM,EAAE,EAAA,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AAAD,GAAe,UAAAC,GAAU,aAAAC,GAAa,mBAAAC,GAAmB,eAAAC,EAAA;AAAA,EAAc,CACpE;AAEvB,SACE,gBAAAyB,EAAC,SAAI,WAAWC,EAAO,MAAM,iBAAezB,IAAW,KAAO,QAC3D,UAAA;AAAA,IAAA,CAACN,KACA,gBAAAsB,EAAC,OAAA,EAAI,WAAWS,EAAO,iBACrB,UAAA,gBAAAT;AAAA,MAACR,EAAW;AAAA,MAAX;AAAA,QACC,MAAK;AAAA,QACL,MAAK;AAAA,QACL,OAAO,EAAE,aAAa;AAAA,QACtB,yBAAuB;AAAA,QACvB,aAAaf,KAAqB,EAAE,mBAAmB;AAAA,QACvD,OAAOH;AAAA,QACP,UAAUqB;AAAA,QACV,gBAAgB,gBAAAK,EAACU,GAAA,EAAW,eAAW,GAAA,CAAC;AAAA,MAAA;AAAA,IAAA,GAE5C;AAAA,IAEF,gBAAAV,EAACW,KAAS,OAAOxC,KAAS,EAAE,YAAY,GAAI,GAAGmC,EAAA,CAAe;AAAA,EAAA,GAChE;AAEJ;AAEA,SAASL,EAAwB,EAAE,SAAAW,KAAgC;AACjE,SAAO,gBAAAZ,EAACa,GAAA,EAAU,OAAOD,EAAA,CAAS;AACpC;"}
1
+ {"version":3,"file":"EmployeeTable.js","sources":["../../../../../src/components/TimeOff/shared/EmployeeTable/EmployeeTable.tsx"],"sourcesContent":["import { useMemo } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport type { EmployeeTableItem, EmployeeTableProps } from './EmployeeTableTypes'\nimport styles from './EmployeeTable.module.scss'\nimport { DataView, EmptyData, useDataView } from '@/components/Common'\nimport type { useDataViewProp } from '@/components/Common/DataView/useDataView'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n/I18n'\nimport { firstLastName } from '@/helpers/formattedStrings'\nimport SearchIcon from '@/assets/icons/search-lg.svg?react'\n\n/** @internal */\nexport function EmployeeTable<T extends EmployeeTableItem>({\n data,\n label,\n additionalColumns = [],\n hideJobTitle,\n searchValue,\n onSearchChange,\n onSearchClear,\n searchPlaceholder,\n hideSearch,\n selectionMode,\n onSelect,\n onSelectAll,\n getIsItemSelected,\n hideSelectAll,\n itemMenu,\n pagination,\n isFetching,\n emptyState,\n emptySearchState,\n footer,\n}: EmployeeTableProps<T>) {\n useI18n('Company.TimeOff.EmployeeTable')\n const { t } = useTranslation('Company.TimeOff.EmployeeTable')\n const Components = useComponentContext()\n\n const isSearchWithNoResults = searchValue.length > 0 && data.length === 0\n\n const handleSearchChange = (value: string) => {\n onSearchChange(value)\n if (!value) onSearchClear()\n }\n\n const defaultEmptySearch = useMemo(() => {\n const noSearchResults = t('noSearchResults')\n return function EmptySearchFallback() {\n return <DefaultEmptySearchState message={noSearchResults} />\n }\n }, [t])\n\n const resolvedEmptyState = useMemo(() => {\n if (isSearchWithNoResults && emptySearchState) {\n return emptySearchState\n }\n if (isSearchWithNoResults) {\n return defaultEmptySearch\n }\n return emptyState\n }, [isSearchWithNoResults, emptySearchState, emptyState, defaultEmptySearch])\n\n const columns = useMemo(\n () => [\n {\n key: 'name',\n title: t('name'),\n render: (item: T) => (\n <span id={`employee-name-${item.uuid}`}>\n {firstLastName({\n first_name: item.firstName,\n last_name: item.lastName,\n }) || t('unknownEmployeeFallback')}\n </span>\n ),\n },\n ...(hideJobTitle\n ? []\n : [\n {\n key: 'jobTitle' as keyof T,\n title: t('jobTitle'),\n render: (item: T) => item.jobTitle ?? '',\n },\n ]),\n ...additionalColumns,\n ],\n [t, additionalColumns, hideJobTitle],\n )\n\n const dataViewProps = useDataView<T>({\n data,\n columns,\n itemMenu,\n pagination,\n isFetching,\n emptyState: resolvedEmptyState,\n footer,\n ...(onSelect && { selectionMode, onSelect, onSelectAll, getIsItemSelected, hideSelectAll }),\n } as useDataViewProp<T>)\n\n return (\n <div className={styles.root}>\n {!hideSearch && (\n <div className={styles.searchContainer}>\n <Components.TextInput\n name=\"employee-search\"\n type=\"search\"\n label={t('searchLabel')}\n shouldVisuallyHideLabel\n placeholder={searchPlaceholder ?? t('searchPlaceholder')}\n value={searchValue}\n onChange={handleSearchChange}\n adornmentStart={<SearchIcon aria-hidden />}\n />\n </div>\n )}\n <DataView label={label ?? t('tableLabel')} {...dataViewProps} />\n </div>\n )\n}\n\nfunction DefaultEmptySearchState({ message }: { message: string }) {\n return <EmptyData title={message} />\n}\n"],"names":["EmployeeTable","data","label","additionalColumns","hideJobTitle","searchValue","onSearchChange","onSearchClear","searchPlaceholder","hideSearch","selectionMode","onSelect","onSelectAll","getIsItemSelected","hideSelectAll","itemMenu","pagination","isFetching","emptyState","emptySearchState","footer","useI18n","useTranslation","Components","useComponentContext","isSearchWithNoResults","handleSearchChange","value","defaultEmptySearch","useMemo","noSearchResults","jsx","DefaultEmptySearchState","resolvedEmptyState","columns","item","firstLastName","dataViewProps","useDataView","jsxs","styles","SearchIcon","DataView","message","EmptyData"],"mappings":";;;;;;;;;;;AAYO,SAASA,GAA2C;AAAA,EACzD,MAAAC;AAAA,EACA,OAAAC;AAAA,EACA,mBAAAC,IAAoB,CAAA;AAAA,EACpB,cAAAC;AAAA,EACA,aAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,eAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,YAAAC;AAAA,EACA,eAAAC;AAAA,EACA,UAAAC;AAAA,EACA,aAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,eAAAC;AAAA,EACA,UAAAC;AAAA,EACA,YAAAC;AAAA,EACA,YAAAC;AAAA,EACA,YAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,QAAAC;AACF,GAA0B;AACxB,EAAAC,EAAQ,+BAA+B;AACvC,QAAM,EAAE,EAAA,IAAMC,EAAe,+BAA+B,GACtDC,IAAaC,EAAA,GAEbC,IAAwBpB,EAAY,SAAS,KAAKJ,EAAK,WAAW,GAElEyB,IAAqB,CAACC,MAAkB;AAC5C,IAAArB,EAAeqB,CAAK,GACfA,KAAOpB,EAAA;AAAA,EACd,G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sB,EAAC,OAAA,EAAI,WAAWS,EAAO,iBACrB,UAAA,gBAAAT;AAAA,MAACR,EAAW;AAAA,MAAX;AAAA,QACC,MAAK;AAAA,QACL,MAAK;AAAA,QACL,OAAO,EAAE,aAAa;AAAA,QACtB,yBAAuB;AAAA,QACvB,aAAaf,KAAqB,EAAE,mBAAmB;AAAA,QACvD,OAAOH;AAAA,QACP,UAAUqB;AAAA,QACV,gBAAgB,gBAAAK,EAACU,GAAA,EAAW,eAAW,GAAA,CAAC;AAAA,MAAA;AAAA,IAAA,GAE5C;AAAA,IAEF,gBAAAV,EAACW,KAAS,OAAOxC,KAAS,EAAE,YAAY,GAAI,GAAGmC,EAAA,CAAe;AAAA,EAAA,GAChE;AAEJ;AAEA,SAASL,EAAwB,EAAE,SAAAW,KAAgC;AACjE,SAAO,gBAAAZ,EAACa,GAAA,EAAU,OAAOD,EAAA,CAAS;AACpC;"}
@@ -1,10 +1,10 @@
1
- const o = "_root_1m6sr_1", r = "_searchContainer_1m6sr_12", t = {
1
+ const o = "_root_fokkf_1", t = "_searchContainer_fokkf_8", r = {
2
2
  root: o,
3
- searchContainer: r
3
+ searchContainer: t
4
4
  };
5
5
  export {
6
- t as default,
6
+ r as default,
7
7
  o as root,
8
- r as searchContainer
8
+ t as searchContainer
9
9
  };
10
10
  //# sourceMappingURL=EmployeeTable.module.scss.js.map
@@ -14,6 +14,8 @@
14
14
  export interface UnstableFeatures {
15
15
  /** Enables recording past payments to contractors within the `ContractorManagement` flows. */
16
16
  historicalPayments?: boolean;
17
+ /** Enables the in-development regular-rate-of-pay experience for editing an employee's payroll. */
18
+ payrollRegularRateOfPay?: boolean;
17
19
  }
18
20
  /**
19
21
  * React context backing {@link useUnstableFeature}.
@@ -1 +1 @@
1
- {"version":3,"file":"useUnstableFeature.js","sources":["../../../src/contexts/UnstableFeaturesProvider/useUnstableFeature.ts"],"sourcesContent":["import { createContext, useContext } from 'react'\n\n/**\n * Opt-in flags for SDK functionality that is still in active development.\n *\n * @remarks\n * Pass to {@link GustoProvider} via the `unstableFeatures` prop to enable a feature ahead of its\n * public release. Every flag defaults to disabled when omitted. When a feature graduates to\n * public release, its flag is deleted from this interface along with the conditional checks that\n * read it — there is no deprecation step. This interface may have no flags at all at any given\n * time — e.g. immediately after the last active flag graduates and before the next one is added —\n * the opt-in mechanism itself is permanent even when nothing is currently gated behind it.\n *\n * @alpha\n */\nexport interface UnstableFeatures {\n /** Enables recording past payments to contractors within the `ContractorManagement` flows. */\n historicalPayments?: boolean\n}\n\n/**\n * React context backing {@link useUnstableFeature}.\n *\n * @internal\n */\nexport const UnstableFeaturesContext = createContext<UnstableFeatures>({})\n\n/**\n * Reads whether `feature` is enabled via {@link GustoProvider}'s `unstableFeatures` prop.\n *\n * @remarks\n * With `throwIfDisabled: true`, call unconditionally at the top of an alpha component's body —\n * not inside {@link WithUnstableFeature} — so mounting the component without opting in fails\n * loudly and immediately. This throws in every environment, including production: using an alpha\n * component without its flag is an integration mistake, not a runtime state, the same as\n * {@link useComponentContext} throwing when called outside a `ComponentsProvider`.\n *\n * @param feature - The {@link UnstableFeatures} flag to read.\n * @param options - Set `throwIfDisabled` to throw instead of returning `false` when `feature` is disabled.\n * @throws When `options.throwIfDisabled` is set and `feature` is not enabled.\n * @internal\n */\nexport const useUnstableFeature = (\n feature: keyof UnstableFeatures,\n options: { throwIfDisabled?: boolean } = { throwIfDisabled: false },\n): boolean => {\n const features = useContext(UnstableFeaturesContext)\n const isEnabled = !!features[feature]\n\n if (options.throwIfDisabled && !isEnabled) {\n throw new Error(\n `This component requires the unstable feature flag \"${feature}\" to be enabled via GustoProvider's \\`unstableFeatures\\` prop.`,\n )\n }\n\n return isEnabled\n}\n"],"names":["UnstableFeaturesContext","createContext","useUnstableFeature","feature","options","isEnabled","useContext"],"mappings":";AAyBO,MAAMA,IAA0BC,EAAgC,CAAA,CAAE,GAiB5DC,IAAqB,CAChCC,GACAC,IAAyC,EAAE,iBAAiB,SAChD;AAEZ,QAAMC,IAAY,CAAC,CADFC,EAAWN,CAAuB,EACtBG,CAAO;AAEpC,MAAIC,EAAQ,mBAAmB,CAACC;AAC9B,UAAM,IAAI;AAAA,MACR,sDAAsDF,CAAO;AAAA,IAAA;AAIjE,SAAOE;AACT;"}
1
+ {"version":3,"file":"useUnstableFeature.js","sources":["../../../src/contexts/UnstableFeaturesProvider/useUnstableFeature.ts"],"sourcesContent":["import { createContext, useContext } from 'react'\n\n/**\n * Opt-in flags for SDK functionality that is still in active development.\n *\n * @remarks\n * Pass to {@link GustoProvider} via the `unstableFeatures` prop to enable a feature ahead of its\n * public release. Every flag defaults to disabled when omitted. When a feature graduates to\n * public release, its flag is deleted from this interface along with the conditional checks that\n * read it — there is no deprecation step. This interface may have no flags at all at any given\n * time — e.g. immediately after the last active flag graduates and before the next one is added —\n * the opt-in mechanism itself is permanent even when nothing is currently gated behind it.\n *\n * @alpha\n */\nexport interface UnstableFeatures {\n /** Enables recording past payments to contractors within the `ContractorManagement` flows. */\n historicalPayments?: boolean\n /** Enables the in-development regular-rate-of-pay experience for editing an employee's payroll. */\n payrollRegularRateOfPay?: boolean\n}\n\n/**\n * React context backing {@link useUnstableFeature}.\n *\n * @internal\n */\nexport const UnstableFeaturesContext = createContext<UnstableFeatures>({})\n\n/**\n * Reads whether `feature` is enabled via {@link GustoProvider}'s `unstableFeatures` prop.\n *\n * @remarks\n * With `throwIfDisabled: true`, call unconditionally at the top of an alpha component's body —\n * not inside {@link WithUnstableFeature} — so mounting the component without opting in fails\n * loudly and immediately. This throws in every environment, including production: using an alpha\n * component without its flag is an integration mistake, not a runtime state, the same as\n * {@link useComponentContext} throwing when called outside a `ComponentsProvider`.\n *\n * @param feature - The {@link UnstableFeatures} flag to read.\n * @param options - Set `throwIfDisabled` to throw instead of returning `false` when `feature` is disabled.\n * @throws When `options.throwIfDisabled` is set and `feature` is not enabled.\n * @internal\n */\nexport const useUnstableFeature = (\n feature: keyof UnstableFeatures,\n options: { throwIfDisabled?: boolean } = { throwIfDisabled: false },\n): boolean => {\n const features = useContext(UnstableFeaturesContext)\n const isEnabled = !!features[feature]\n\n if (options.throwIfDisabled && !isEnabled) {\n throw new Error(\n `This component requires the unstable feature flag \"${feature}\" to be enabled via GustoProvider's \\`unstableFeatures\\` prop.`,\n )\n }\n\n return isEnabled\n}\n"],"names":["UnstableFeaturesContext","createContext","useUnstableFeature","feature","options","isEnabled","useContext"],"mappings":";AA2BO,MAAMA,IAA0BC,EAAgC,CAAA,CAAE,GAiB5DC,IAAqB,CAChCC,GACAC,IAAyC,EAAE,iBAAiB,SAChD;AAEZ,QAAMC,IAAY,CAAC,CADFC,EAAWN,CAAuB,EACtBG,CAAO;AAEpC,MAAIC,EAAQ,mBAAmB,CAACC;AAC9B,UAAM,IAAI;AAAA,MACR,sDAAsDF,CAAO;AAAA,IAAA;AAIjE,SAAOE;AACT;"}
@@ -0,0 +1,101 @@
1
+ /**
2
+ * The outcome of evaluating a single poll tick.
3
+ *
4
+ * @typeParam TValue - The terminal value handed to `onDone`.
5
+ * @internal
6
+ */
7
+ export type PollTickResult<TValue> = {
8
+ done: true;
9
+ value: TValue;
10
+ } | {
11
+ done: false;
12
+ };
13
+ /**
14
+ * Configuration for {@link usePollingTask}.
15
+ *
16
+ * @typeParam TData - The value each poll read resolves to.
17
+ * @typeParam TValue - The terminal value produced by `evaluate` and handed to `onDone`.
18
+ * @internal
19
+ */
20
+ export interface UsePollingTaskOptions<TData, TValue> {
21
+ /** Reads the current server state for one tick. Rejections are tolerated and retried next tick. */
22
+ fetch: (signal: AbortSignal) => Promise<TData>;
23
+ /**
24
+ * Decides whether the operation has reached a terminal state, from the data this tick just
25
+ * read. Must not depend on rendered state — that dependency is the bug this hook exists to
26
+ * avoid.
27
+ */
28
+ evaluate: (data: TData) => PollTickResult<TValue>;
29
+ /** Called once, from the poll loop, when `evaluate` reports a terminal state. */
30
+ onDone: (value: TValue) => void;
31
+ /**
32
+ * Called once when `deadlineMs` elapses without a terminal state, with the most recent data
33
+ * successfully read (or `null` if no read ever succeeded). Verify against that data before
34
+ * reporting a failure.
35
+ */
36
+ onDeadline: (lastData: TData | null) => void;
37
+ /** Delay between the end of one tick and the start of the next. Defaults to {@link DEFAULT_POLL_INTERVAL_MS}. */
38
+ intervalMs?: number;
39
+ /** How long the task may run before `onDeadline` is called. Defaults to {@link DEFAULT_POLL_DEADLINE_MS}. */
40
+ deadlineMs?: number;
41
+ }
42
+ /**
43
+ * Default delay between polling reads.
44
+ *
45
+ * @internal
46
+ */
47
+ export declare const DEFAULT_POLL_INTERVAL_MS = 5000;
48
+ /**
49
+ * Default duration a polling task may run before its deadline fires.
50
+ *
51
+ * @internal
52
+ */
53
+ export declare const DEFAULT_POLL_DEADLINE_MS: number;
54
+ /**
55
+ * An imperative handle to a polling task.
56
+ *
57
+ * @internal
58
+ */
59
+ export interface PollingTask {
60
+ /** Begins polling, reading once immediately. Restarts the task if one is already running. */
61
+ start: () => void;
62
+ /** Stops polling without calling `onDone` or `onDeadline`. */
63
+ stop: () => void;
64
+ /** Whether the task is currently running. Safe to render; not used to decide completion. */
65
+ isPolling: boolean;
66
+ }
67
+ /**
68
+ * Polls an async operation to completion in a self-contained loop that owns its own timer and
69
+ * decides the terminal state from the data it reads.
70
+ *
71
+ * @remarks
72
+ * Use this instead of driving a poll from a query's `refetchInterval` and reacting to the result
73
+ * in an effect. That pattern makes completion depend on a render arriving — if the query
74
+ * observer never notifies the component, the operation finishes on the server and the screen
75
+ * never advances (SDK-1291). Here the loop reads the server directly and evaluates the result in
76
+ * its own closure, so the terminal decision does not depend on the component rendering.
77
+ *
78
+ * Behavior worth knowing:
79
+ *
80
+ * - `start()` reads immediately, then every `intervalMs` after the previous read settles, so a
81
+ * slow read never stacks up overlapping requests.
82
+ * - A rejected read is not a failed task. It is ignored and retried on the next tick, which
83
+ * matters because SDK queries are configured with `retry: false`. Note that when `fetch` reads
84
+ * through a shared query key, the failure is still recorded on that key, so observers of it
85
+ * see the error state even though the task carries on.
86
+ * - A terminal result on the deadline tick wins over the deadline, and `onDeadline` receives the
87
+ * last data read so the caller can verify before declaring failure.
88
+ * - Each tick bumps internal state, which gives the calling component a render source
89
+ * independent of any query observer. Fresh cache data is then picked up on that render.
90
+ * - `stop()` and unmount abort the in-flight read and guarantee no further callbacks fire.
91
+ *
92
+ * Callbacks are read through a ref, so changing their identity between renders never restarts
93
+ * the loop.
94
+ *
95
+ * @typeParam TData - The value each poll read resolves to.
96
+ * @typeParam TValue - The terminal value produced by `evaluate` and handed to `onDone`.
97
+ * @param options - See {@link UsePollingTaskOptions}.
98
+ * @returns The {@link PollingTask} handle.
99
+ * @internal
100
+ */
101
+ export declare function usePollingTask<TData, TValue>(options: UsePollingTaskOptions<TData, TValue>): PollingTask;