@gusto/embedded-react-sdk 0.57.2 → 0.57.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (183) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/components/Common/DateRangeFilter/DateRangeFilter.js +32 -32
  3. package/dist/components/Common/DateRangeFilter/DateRangeFilter.js.map +1 -1
  4. package/dist/components/Common/OnboardingStatusBadge/index.js.map +1 -1
  5. package/dist/components/Company/PaySchedule/management/AutoPilotDialog/AutoPilotDialog.js.map +1 -1
  6. package/dist/components/Company/PaySchedule/management/AutoPilotDialog/useAutoPilotDialog.js.map +1 -1
  7. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentCompensationStepPresentation.js +34 -14
  8. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentCompensationStepPresentation.js.map +1 -1
  9. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentDepartmentStepPresentation.js +106 -0
  10. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentDepartmentStepPresentation.js.map +1 -0
  11. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentEmployeeStepPresentation.js +136 -0
  12. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentEmployeeStepPresentation.js.map +1 -0
  13. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentScheduleStepPresentation.js +38 -20
  14. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentScheduleStepPresentation.js.map +1 -1
  15. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentTypeStepPresentation.js +78 -44
  16. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentTypeStepPresentation.js.map +1 -1
  17. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/PayScheduleAssignment.js +45 -37
  18. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/PayScheduleAssignment.js.map +1 -1
  19. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/PayScheduleAssignmentComponents.js +244 -95
  20. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/PayScheduleAssignmentComponents.js.map +1 -1
  21. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/departmentAccess.js +22 -0
  22. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/departmentAccess.js.map +1 -0
  23. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/employeeJob.js +13 -0
  24. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/employeeJob.js.map +1 -0
  25. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/payScheduleAssignmentStateMachine.js +48 -43
  26. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/payScheduleAssignmentStateMachine.js.map +1 -1
  27. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/scheduleLabel.js.map +1 -1
  28. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/useAssignableEmployees.js +57 -0
  29. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/useAssignableEmployees.js.map +1 -0
  30. package/dist/components/Company/PaySchedule/management/PayScheduleCompensationOverviewPresentation.js.map +1 -1
  31. package/dist/components/Company/PaySchedule/management/PayScheduleDepartmentOverviewPresentation.js +83 -0
  32. package/dist/components/Company/PaySchedule/management/PayScheduleDepartmentOverviewPresentation.js.map +1 -0
  33. package/dist/components/Company/PaySchedule/management/PayScheduleEmployeeOverviewPresentation.js +84 -0
  34. package/dist/components/Company/PaySchedule/management/PayScheduleEmployeeOverviewPresentation.js.map +1 -0
  35. package/dist/components/Company/PaySchedule/management/PayScheduleManagementComponents.js.map +1 -1
  36. package/dist/components/Company/PaySchedule/management/PayScheduleOverview.js +109 -39
  37. package/dist/components/Company/PaySchedule/management/PayScheduleOverview.js.map +1 -1
  38. package/dist/components/Company/PaySchedule/management/PayScheduleOverviewPresentation.js.map +1 -1
  39. package/dist/components/Company/PaySchedule/management/payScheduleManagementStateMachine.js.map +1 -1
  40. package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/usePayScheduleForm.js.map +1 -1
  41. package/dist/components/Contractor/Address/shared/useContractorAddressForm/useContractorAddressForm.js +5 -5
  42. package/dist/components/Contractor/Address/shared/useContractorAddressForm/useContractorAddressForm.js.map +1 -1
  43. package/dist/components/Contractor/Address/shared/useContractorAddressSummary/useContractorAddressSummary.js +1 -1
  44. package/dist/components/Contractor/Address/shared/useContractorAddressSummary/useContractorAddressSummary.js.map +1 -1
  45. package/dist/components/Contractor/Compensation/shared/useContractorCompensationSummary/useContractorCompensationSummary.js +4 -4
  46. package/dist/components/Contractor/Compensation/shared/useContractorCompensationSummary/useContractorCompensationSummary.js.map +1 -1
  47. package/dist/components/Contractor/Compensation/shared/useContractorPayForm/useContractorPayForm.js +3 -3
  48. package/dist/components/Contractor/Compensation/shared/useContractorPayForm/useContractorPayForm.js.map +1 -1
  49. package/dist/components/Contractor/ContractorList/shared/useContractorList.js +6 -6
  50. package/dist/components/Contractor/ContractorList/shared/useContractorList.js.map +1 -1
  51. package/dist/components/Contractor/Dashboard/Dashboard.js +20 -20
  52. package/dist/components/Contractor/Dashboard/Dashboard.js.map +1 -1
  53. package/dist/components/Contractor/Dismissal/useDismissal/useDismissal.js +10 -10
  54. package/dist/components/Contractor/Dismissal/useDismissal/useDismissal.js.map +1 -1
  55. package/dist/components/Contractor/Landing/Landing.js +43 -39
  56. package/dist/components/Contractor/Landing/Landing.js.map +1 -1
  57. package/dist/components/Contractor/NewHireReport/NewHireReport.js +3 -3
  58. package/dist/components/Contractor/NewHireReport/NewHireReport.js.map +1 -1
  59. package/dist/components/Contractor/Payments/CreateHistoricalPayment/CreateHistoricalPayment.js +1 -1
  60. package/dist/components/Contractor/Payments/CreateHistoricalPayment/CreateHistoricalPayment.js.map +1 -1
  61. package/dist/components/Contractor/Payments/CreatePayment/CreatePayment.js +10 -10
  62. package/dist/components/Contractor/Payments/CreatePayment/CreatePayment.js.map +1 -1
  63. package/dist/components/Contractor/Payments/HistoricalPaymentSummary/HistoricalPaymentSummary.js +4 -4
  64. package/dist/components/Contractor/Payments/HistoricalPaymentSummary/HistoricalPaymentSummary.js.map +1 -1
  65. package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistory.js +8 -8
  66. package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistory.js.map +1 -1
  67. package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatement.js +5 -5
  68. package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatement.js.map +1 -1
  69. package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummary.js +3 -3
  70. package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummary.js.map +1 -1
  71. package/dist/components/Contractor/Profile/onboarding/SelfOnboardingContractorProfile.js +1 -1
  72. package/dist/components/Contractor/Profile/onboarding/SelfOnboardingContractorProfile.js.map +1 -1
  73. package/dist/components/Contractor/Profile/shared/useContractorDetailsForm/useContractorDetailsForm.js +1 -1
  74. package/dist/components/Contractor/Profile/shared/useContractorDetailsForm/useContractorDetailsForm.js.map +1 -1
  75. package/dist/components/Contractor/Profile/shared/useContractorProfileSummary/useContractorProfileSummary.js +1 -1
  76. package/dist/components/Contractor/Profile/shared/useContractorProfileSummary/useContractorProfileSummary.js.map +1 -1
  77. package/dist/components/Contractor/SelfOnboardingFlow/SelfOnboardingComponents.js +2 -9
  78. package/dist/components/Contractor/SelfOnboardingFlow/SelfOnboardingComponents.js.map +1 -1
  79. package/dist/components/Contractor/Submit/Submit.js +18 -18
  80. package/dist/components/Contractor/Submit/Submit.js.map +1 -1
  81. package/dist/components/Contractor/shared/SelectContractors/useSelectContractors.js +6 -6
  82. package/dist/components/Contractor/shared/SelectContractors/useSelectContractors.js.map +1 -1
  83. package/dist/components/Employee/Compensation/shared/useCompensationForm/useCompensationForm.js +25 -25
  84. package/dist/components/Employee/Compensation/shared/useCompensationForm/useCompensationForm.js.map +1 -1
  85. package/dist/components/Employee/Compensation/shared/useCompensationManagement/useCompensationManagement.js +15 -15
  86. package/dist/components/Employee/Compensation/shared/useCompensationManagement/useCompensationManagement.js.map +1 -1
  87. package/dist/components/Employee/Compensation/shared/useJobForm/useJobForm.js +1 -1
  88. package/dist/components/Employee/Compensation/shared/useJobForm/useJobForm.js.map +1 -1
  89. package/dist/components/Employee/Dashboard/Dashboard.js +25 -25
  90. package/dist/components/Employee/Dashboard/Dashboard.js.map +1 -1
  91. package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentSigner.js +7 -7
  92. package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentSigner.js.map +1 -1
  93. package/dist/components/Employee/Documents/onboarding/EmployeeDocuments/EmployeeDocuments.js +1 -1
  94. package/dist/components/Employee/Documents/onboarding/EmployeeDocuments/EmployeeDocuments.js.map +1 -1
  95. package/dist/components/Employee/HomeAddress/management/useHomeAddressManagement.js +6 -6
  96. package/dist/components/Employee/HomeAddress/management/useHomeAddressManagement.js.map +1 -1
  97. package/dist/components/Employee/Landing/Landing.js +37 -33
  98. package/dist/components/Employee/Landing/Landing.js.map +1 -1
  99. package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js +27 -27
  100. package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js.map +1 -1
  101. package/dist/components/Employee/Profile/shared/useEmployeeDetailsForm/useEmployeeDetailsForm.js +6 -6
  102. package/dist/components/Employee/Profile/shared/useEmployeeDetailsForm/useEmployeeDetailsForm.js.map +1 -1
  103. package/dist/components/Employee/Profile/shared/useEmployeeProfileSummary/useEmployeeProfileSummary.js +1 -1
  104. package/dist/components/Employee/Profile/shared/useEmployeeProfileSummary/useEmployeeProfileSummary.js.map +1 -1
  105. package/dist/components/Employee/SelfOnboardingFlow/SelfOnboardingComponents.js +8 -15
  106. package/dist/components/Employee/SelfOnboardingFlow/SelfOnboardingComponents.js.map +1 -1
  107. package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployee.js +11 -11
  108. package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployee.js.map +1 -1
  109. package/dist/components/Employee/Terminations/TerminationSummary/TerminationSummary.js +12 -12
  110. package/dist/components/Employee/Terminations/TerminationSummary/TerminationSummary.js.map +1 -1
  111. package/dist/components/Employee/WorkAddress/management/useWorkAddressManagement.js +26 -26
  112. package/dist/components/Employee/WorkAddress/management/useWorkAddressManagement.js.map +1 -1
  113. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js +66 -64
  114. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
  115. package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js +1 -1
  116. package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js.map +1 -1
  117. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js +6 -6
  118. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js.map +1 -1
  119. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
  120. package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/usePayrollEditEmployeeForm.js +1 -1
  121. package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/usePayrollEditEmployeeForm.js.map +1 -1
  122. package/dist/components/Payroll/PayrollHistory/PayrollHistory.js.map +1 -1
  123. package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js +6 -6
  124. package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js.map +1 -1
  125. package/dist/components/Payroll/PayrollList/PayrollList.js.map +1 -1
  126. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +9 -9
  127. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
  128. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
  129. package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js.map +1 -1
  130. package/dist/components/Payroll/helpers.js +1 -1
  131. package/dist/components/Payroll/helpers.js.map +1 -1
  132. package/dist/components/Payroll/payrollTypes.js +1 -1
  133. package/dist/components/Payroll/payrollTypes.js.map +1 -1
  134. package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
  135. package/dist/contexts/ApiProvider/payrollOffCycleReasonEnumHook.js +1 -1
  136. package/dist/contexts/ApiProvider/payrollOffCycleReasonEnumHook.js.map +1 -1
  137. package/dist/i18n/en/Company.Management.PaySchedule.json.js +31 -13
  138. package/dist/i18n/en/Company.Management.PaySchedule.json.js.map +1 -1
  139. package/dist/i18n/en/Company.Management.PayScheduleAssignment.json.js +20 -12
  140. package/dist/i18n/en/Company.Management.PayScheduleAssignment.json.js.map +1 -1
  141. package/dist/i18n/en/Payroll.PayrollHistory.json.js +1 -1
  142. package/dist/i18n/en/Payroll.PayrollList.json.js +5 -5
  143. package/dist/package.json.js +1 -1
  144. package/dist/shared/constants.js +5 -5
  145. package/dist/shared/constants.js.map +1 -1
  146. package/dist/src/components/Common/DateRangeFilter/DateRangeFilter.d.ts +2 -2
  147. package/dist/src/components/Common/OnboardingStatusBadge/index.d.ts +1 -1
  148. package/dist/src/components/Company/PaySchedule/management/AutoPilotDialog/AutoPilotDialog.d.ts +1 -1
  149. package/dist/src/components/Company/PaySchedule/management/AutoPilotDialog/useAutoPilotDialog.d.ts +1 -1
  150. package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentCompensationStepPresentation.d.ts +10 -3
  151. package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentDepartmentStepPresentation.d.ts +21 -0
  152. package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentEmployeeStepPresentation.d.ts +34 -0
  153. package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentScheduleStepPresentation.d.ts +9 -3
  154. package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentTypeStepPresentation.d.ts +5 -1
  155. package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/PayScheduleAssignment.d.ts +10 -10
  156. package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/PayScheduleAssignmentComponents.d.ts +12 -4
  157. package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/departmentAccess.d.ts +19 -0
  158. package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/employeeJob.d.ts +17 -0
  159. package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/scheduleLabel.d.ts +1 -1
  160. package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/useAssignableEmployees.d.ts +34 -0
  161. package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/usePayScheduleAssignment.d.ts +16 -3
  162. package/dist/src/components/Company/PaySchedule/management/PayScheduleCompensationOverviewPresentation.d.ts +1 -1
  163. package/dist/src/components/Company/PaySchedule/management/PayScheduleDepartmentOverviewPresentation.d.ts +23 -0
  164. package/dist/src/components/Company/PaySchedule/management/PayScheduleEmployeeOverviewPresentation.d.ts +25 -0
  165. package/dist/src/components/Company/PaySchedule/management/PayScheduleManagementComponents.d.ts +1 -1
  166. package/dist/src/components/Company/PaySchedule/management/PayScheduleOverviewPresentation.d.ts +1 -1
  167. package/dist/src/components/Company/PaySchedule/shared/usePayScheduleForm/usePayScheduleForm.d.ts +1 -1
  168. package/dist/src/components/Contractor/Landing/Landing.d.ts +5 -2
  169. package/dist/src/components/Employee/Landing/Landing.d.ts +5 -2
  170. package/dist/src/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.d.ts +1 -1
  171. package/dist/src/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.d.ts +1 -1
  172. package/dist/src/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.d.ts +1 -1
  173. package/dist/src/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/usePayrollEditEmployeeForm.d.ts +2 -2
  174. package/dist/src/components/Payroll/PayrollHistory/PayrollHistoryPresentation.d.ts +1 -1
  175. package/dist/src/components/Payroll/PayrollList/PayrollListPresentation.d.ts +2 -2
  176. package/dist/src/components/Payroll/PayrollOverview/PayrollOverviewPresentation.d.ts +1 -1
  177. package/dist/src/components/Payroll/helpers.d.ts +2 -2
  178. package/dist/src/components/Payroll/usePreparedPayrollData.d.ts +2 -2
  179. package/dist/src/i18n/types.d.ts +82 -4
  180. package/dist/src/models/external.d.ts +63 -48
  181. package/dist/src/shared/constants.d.ts +1 -1
  182. package/docs/guides/endpoint-inventory.json +33 -13
  183. package/package.json +18 -18
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.57.3](https://github.com/Gusto/embedded-react-sdk/compare/v0.57.2...v0.57.3) (2026-10-27)
4
+
5
+ ### Features & Enhancements
6
+
7
+ - Add department- and employee-level pay schedule assignment to the in-development `CompanyManagement.PaySchedule` flow. Released as `@alpha` behind the existing `managePaySchedules` flag in `UnstableFeatures` ([#2949](https://github.com/Gusto/embedded-react-sdk/issues/2949), [#2956](https://github.com/Gusto/embedded-react-sdk/issues/2956))
8
+
9
+ ### Fixes
10
+
11
+ - Include reimbursements in the Total pay column shown before payroll calculation ([#3010](https://github.com/Gusto/embedded-react-sdk/issues/3010))
12
+ - Preserve pay schedule assignment selections when navigating back and forth between steps ([#2948](https://github.com/Gusto/embedded-react-sdk/issues/2948))
13
+ - Include the visible filter text, not just the icon label, in the date filter trigger's accessible name ([#2985](https://github.com/Gusto/embedded-react-sdk/issues/2985))
14
+ - Reduce redundant API calls on the contractor/employee self-onboarding `Landing` screen ([#2989](https://github.com/Gusto/embedded-react-sdk/issues/2989))
15
+
16
+ ### Chores & Maintenance
17
+
18
+ - Bump `@gusto/embedded-api` from `0.3.1` to `0.3.2` ([#2988](https://github.com/Gusto/embedded-react-sdk/issues/2988))
19
+ - Bump `@hookform/resolvers` from `5.9.1` to `6.0.0` ([#2979](https://github.com/Gusto/embedded-react-sdk/issues/2979))
20
+ - Bump runtime dependencies (`i18next`, `react-i18next`, `react-hook-form`) ([#2983](https://github.com/Gusto/embedded-react-sdk/issues/2983), [#3003](https://github.com/Gusto/embedded-react-sdk/issues/3003), [#2993](https://github.com/Gusto/embedded-react-sdk/issues/2993), [#3004](https://github.com/Gusto/embedded-react-sdk/issues/3004), [#3015](https://github.com/Gusto/embedded-react-sdk/issues/3015), [#3014](https://github.com/Gusto/embedded-react-sdk/issues/3014))
21
+ - Bump dev dependencies (`storybook`, `typescript-eslint`, `dotenv`, `sass-embedded`, `vite`, `globals`, `@storybook/addon-onboarding`, docs site `vitest`, `postcss-selector-parser`, docs site `qs`)
22
+
3
23
  ## [0.57.2](https://github.com/Gusto/embedded-react-sdk/compare/v0.57.1...v0.57.2) (2026-10-22)
4
24
 
5
25
  ### Fixes
@@ -1,13 +1,13 @@
1
- import { jsxs as a, Fragment as H, jsx as e } from "react/jsx-runtime";
2
- import { useState as y, useRef as I, useCallback as t, useMemo as M } from "react";
3
- import { Popover as _, Dialog as q } from "react-aria-components";
1
+ import { jsx as e, jsxs as a, Fragment as H } from "react/jsx-runtime";
2
+ import { useState as x, useRef as I, useCallback as l, useMemo as L } from "react";
3
+ import { Popover as M, Dialog as _ } from "react-aria-components";
4
4
  import s from "./DateRangeFilter.module.scss.js";
5
5
  import { Flex as R } from "../Flex/Flex.js";
6
- import { useComponentContext as z } from "../../../contexts/ComponentAdapter/useComponentContext.js";
7
- import { useTheme as E } from "../../../contexts/ThemeProvider/useTheme.js";
6
+ import { useComponentContext as q } from "../../../contexts/ComponentAdapter/useComponentContext.js";
7
+ import { useTheme as z } from "../../../contexts/ThemeProvider/useTheme.js";
8
8
  /* empty css */
9
- import G from "../../../assets/icons/filter-funnel.svg.js";
10
- const x = (n) => n.toLocaleDateString("en-US", { month: "short", day: "numeric" }), ee = ({
9
+ import E from "../../../assets/icons/filter-funnel.svg.js";
10
+ const F = (n) => n.toLocaleDateString("en-US", { month: "short", day: "numeric" }), ne = ({
11
11
  startDate: n,
12
12
  endDate: o,
13
13
  onStartDateChange: d,
@@ -15,44 +15,44 @@ const x = (n) => n.toLocaleDateString("en-US", { month: "short", day: "numeric"
15
15
  onClear: h,
16
16
  startDateLabel: c,
17
17
  endDateLabel: u,
18
- applyLabel: F,
18
+ applyLabel: b,
19
19
  cancelLabel: k,
20
20
  resetLabel: $,
21
- selectDatesLabel: b,
22
- triggerLabel: N,
23
- maxEndDate: j,
24
- minStartDate: B
21
+ selectDatesLabel: N,
22
+ getTriggerLabel: j,
23
+ maxEndDate: B,
24
+ minStartDate: O
25
25
  }) => {
26
- const { Button: i, DateRangePicker: O } = z(), { container: S } = E(), [g, m] = y(!1), [l, p] = y(null), v = I(null), P = t(() => {
26
+ const { Button: i, DateRangePicker: S } = q(), { container: P } = z(), [g, m] = x(!1), [t, p] = x(null), v = I(null), T = l(() => {
27
27
  p(n && o ? { start: n, end: o } : null), m(!0);
28
- }, [n, o]), C = t(() => {
28
+ }, [n, o]), C = l(() => {
29
29
  m(!1);
30
- }, []), U = t(() => {
31
- l ? (d(l.start), f(l.end)) : h(), m(!1);
32
- }, [l, d, f, h]), V = t(() => {
30
+ }, []), U = l(() => {
31
+ t ? (d(t.start), f(t.end)) : h(), m(!1);
32
+ }, [t, d, f, h]), V = l(() => {
33
33
  p(null);
34
- }, []), A = t((r) => {
34
+ }, []), A = l((r) => {
35
35
  p(r?.start && r.end ? r : null);
36
- }, []), T = M(() => !n || !o ? null : `${x(n)} – ${x(o)}`, [n, o]), w = /* @__PURE__ */ e(
36
+ }, []), y = L(() => !n || !o ? null : `${F(n)} – ${F(o)}`, [n, o]) ?? N, w = /* @__PURE__ */ e(
37
37
  i,
38
38
  {
39
39
  buttonRef: v,
40
- "aria-label": N,
40
+ "aria-label": j(y),
41
41
  "aria-haspopup": "dialog",
42
42
  "aria-expanded": g,
43
- onClick: P,
43
+ onClick: T,
44
44
  variant: "secondary",
45
- icon: /* @__PURE__ */ e(G, {}),
45
+ icon: /* @__PURE__ */ e(E, {}),
46
46
  className: s.triggerButton,
47
- children: T ?? b
47
+ children: y
48
48
  }
49
49
  );
50
50
  return /* @__PURE__ */ a(H, { children: [
51
51
  w,
52
52
  /* @__PURE__ */ e(
53
- _,
53
+ M,
54
54
  {
55
- UNSTABLE_portalContainer: S.current ?? void 0,
55
+ UNSTABLE_portalContainer: P.current ?? void 0,
56
56
  isOpen: g,
57
57
  onOpenChange: (r) => {
58
58
  r || C();
@@ -61,25 +61,25 @@ const x = (n) => n.toLocaleDateString("en-US", { month: "short", day: "numeric"
61
61
  placement: "bottom end",
62
62
  offset: 8,
63
63
  shouldUpdatePosition: !0,
64
- children: /* @__PURE__ */ a(q, { className: s.dialog, "aria-label": `${c} – ${u}`, children: [
64
+ children: /* @__PURE__ */ a(_, { className: s.dialog, "aria-label": `${c} – ${u}`, children: [
65
65
  /* @__PURE__ */ e("div", { className: s.popoverContent, children: /* @__PURE__ */ e(
66
- O,
66
+ S,
67
67
  {
68
68
  label: `${c} – ${u}`,
69
69
  shouldVisuallyHideLabel: !0,
70
- value: l,
70
+ value: t,
71
71
  onChange: A,
72
72
  startDateLabel: c,
73
73
  endDateLabel: u,
74
- minValue: B,
75
- maxValue: j
74
+ minValue: O,
75
+ maxValue: B
76
76
  }
77
77
  ) }),
78
78
  /* @__PURE__ */ e("div", { className: s.popoverFooter, children: /* @__PURE__ */ a(R, { gap: 8, justifyContent: "space-between", children: [
79
79
  /* @__PURE__ */ e(i, { variant: "tertiary", onClick: V, children: $ }),
80
80
  /* @__PURE__ */ a(R, { gap: 8, justifyContent: "flex-end", children: [
81
81
  /* @__PURE__ */ e(i, { variant: "secondary", onClick: C, children: k }),
82
- /* @__PURE__ */ e(i, { variant: "primary", onClick: U, children: F })
82
+ /* @__PURE__ */ e(i, { variant: "primary", onClick: U, children: b })
83
83
  ] })
84
84
  ] }) })
85
85
  ] })
@@ -88,6 +88,6 @@ const x = (n) => n.toLocaleDateString("en-US", { month: "short", day: "numeric"
88
88
  ] });
89
89
  };
90
90
  export {
91
- ee as DateRangeFilter
91
+ ne as DateRangeFilter
92
92
  };
93
93
  //# sourceMappingURL=DateRangeFilter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DateRangeFilter.js","sources":["../../../../src/components/Common/DateRangeFilter/DateRangeFilter.tsx"],"sourcesContent":["import { useState, useRef, useCallback, useMemo } from 'react'\nimport { Dialog, Popover } from 'react-aria-components'\nimport styles from './DateRangeFilter.module.scss'\nimport type { DateRange } from '@/components/Common/UI/DateRangePicker/DateRangePickerTypes'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useTheme } from '@/contexts/ThemeProvider'\nimport FilterFunnelIcon from '@/assets/icons/filter-funnel.svg?react'\n\nconst formatFilterDate = (date: Date): string =>\n date.toLocaleDateString('en-US', { month: 'short', day: 'numeric' })\n\ninterface DateRangeFilterProps {\n startDate: Date | null\n endDate: Date | null\n onStartDateChange: (date: Date | null) => void\n onEndDateChange: (date: Date | null) => void\n onClear: () => void\n startDateLabel: string\n endDateLabel: string\n applyLabel: string\n cancelLabel: string\n resetLabel: string\n selectDatesLabel: string\n triggerLabel: string\n maxEndDate?: Date\n minStartDate?: Date\n}\n\n/** @internal */\nexport const DateRangeFilter = ({\n startDate,\n endDate,\n onStartDateChange,\n onEndDateChange,\n onClear,\n startDateLabel,\n endDateLabel,\n applyLabel,\n cancelLabel,\n resetLabel,\n selectDatesLabel,\n triggerLabel,\n maxEndDate,\n minStartDate,\n}: DateRangeFilterProps) => {\n const { Button, DateRangePicker } = useComponentContext()\n const { container } = useTheme()\n\n const [isOpen, setIsOpen] = useState(false)\n const [draftRange, setDraftRange] = useState<DateRange | null>(null)\n const triggerRef = useRef<HTMLButtonElement>(null)\n\n const handleOpen = useCallback(() => {\n const range = startDate && endDate ? { start: startDate, end: endDate } : null\n setDraftRange(range)\n setIsOpen(true)\n }, [startDate, endDate])\n\n const handleClose = useCallback(() => {\n setIsOpen(false)\n }, [])\n\n const handleApply = useCallback(() => {\n if (draftRange) {\n onStartDateChange(draftRange.start)\n onEndDateChange(draftRange.end)\n } else {\n onClear()\n }\n setIsOpen(false)\n }, [draftRange, onStartDateChange, onEndDateChange, onClear])\n\n const handleReset = useCallback(() => {\n setDraftRange(null)\n }, [])\n\n const handleRangeChange = useCallback((range: DateRange | null) => {\n // A custom DateRangePicker adapter could emit a one-sided range at runtime\n // even though the type guarantees both sides -- never apply a partial one.\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n setDraftRange(range?.start && range.end ? range : null)\n }, [])\n\n const filterDateLabel = useMemo(() => {\n if (!startDate || !endDate) return null\n return `${formatFilterDate(startDate)} – ${formatFilterDate(endDate)}`\n }, [startDate, endDate])\n\n const triggerButton = (\n <Button\n buttonRef={triggerRef}\n aria-label={triggerLabel}\n aria-haspopup=\"dialog\"\n aria-expanded={isOpen}\n onClick={handleOpen}\n variant=\"secondary\"\n icon={<FilterFunnelIcon />}\n className={styles.triggerButton}\n >\n {filterDateLabel ?? selectDatesLabel}\n </Button>\n )\n\n return (\n <>\n {triggerButton}\n\n <Popover\n UNSTABLE_portalContainer={container.current ?? undefined}\n isOpen={isOpen}\n onOpenChange={open => {\n if (!open) handleClose()\n }}\n triggerRef={triggerRef}\n placement=\"bottom end\"\n offset={8}\n shouldUpdatePosition\n >\n <Dialog className={styles.dialog} aria-label={`${startDateLabel} – ${endDateLabel}`}>\n <div className={styles.popoverContent}>\n <DateRangePicker\n label={`${startDateLabel} – ${endDateLabel}`}\n shouldVisuallyHideLabel\n value={draftRange}\n onChange={handleRangeChange}\n startDateLabel={startDateLabel}\n endDateLabel={endDateLabel}\n minValue={minStartDate}\n maxValue={maxEndDate}\n />\n </div>\n\n <div className={styles.popoverFooter}>\n <Flex gap={8} justifyContent=\"space-between\">\n <Button variant=\"tertiary\" onClick={handleReset}>\n {resetLabel}\n </Button>\n <Flex gap={8} justifyContent=\"flex-end\">\n <Button variant=\"secondary\" onClick={handleClose}>\n {cancelLabel}\n </Button>\n <Button variant=\"primary\" onClick={handleApply}>\n {applyLabel}\n </Button>\n </Flex>\n </Flex>\n </div>\n </Dialog>\n </Popover>\n </>\n )\n}\n"],"names":["formatFilterDate","date","DateRangeFilter","startDate","endDate","onStartDateChange","onEndDateChange","onClear","startDateLabel","endDateLabel","applyLabel","cancelLabel","resetLabel","selectDatesLabel","triggerLabel","maxEndDate","minStartDate","Button","DateRangePicker","useComponentContext","container","useTheme","isOpen","setIsOpen","useState","draftRange","setDraftRange","triggerRef","useRef","handleOpen","useCallback","handleClose","handleApply","handleReset","handleRangeChange","range","filterDateLabel","useMemo","triggerButton","jsx","FilterFunnelIcon","styles","jsxs","Fragment","Popover","open","Dialog","Flex"],"mappings":";;;;;;;;;AASA,MAAMA,IAAmB,CAACC,MACxBA,EAAK,mBAAmB,SAAS,EAAE,OAAO,SAAS,KAAK,WAAW,GAoBxDC,KAAkB,CAAC;AAAA,EAC9B,WAAAC;AAAA,EACA,SAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,SAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,cAAAC;AAAA,EACA,YAAAC;AAAA,EACA,aAAAC;AAAA,EACA,YAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,cAAAC;AAAA,EACA,YAAAC;AAAA,EACA,cAAAC;AACF,MAA4B;AAC1B,QAAM,EAAE,QAAAC,GAAQ,iBAAAC,EAAA,IAAoBC,EAAA,GAC9B,EAAE,WAAAC,EAAA,IAAcC,EAAA,GAEhB,CAACC,GAAQC,CAAS,IAAIC,EAAS,EAAK,GACpC,CAACC,GAAYC,CAAa,IAAIF,EAA2B,IAAI,GAC7DG,IAAaC,EAA0B,IAAI,GAE3CC,IAAaC,EAAY,MAAM;AAEnC,IAAAJ,EADcvB,KAAaC,IAAU,EAAE,OAAOD,GAAW,KAAKC,MAAY,IACvD,GACnBmB,EAAU,EAAI;AAAA,EAChB,GAAG,CAACpB,GAAWC,CAAO,CAAC,GAEjB2B,IAAcD,EAAY,MAAM;AACpC,IAAAP,EAAU,EAAK;AAAA,EACjB,GAAG,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C,CAAY,IAC/E,UAAA;AAAA,UAAA,gBAAA8B,EAAC,OAAA,EAAI,WAAWE,EAAO,gBACrB,UAAA,gBAAAF;AAAA,YAACrB;AAAA,YAAA;AAAA,cACC,OAAO,GAAGV,CAAc,MAAMC,CAAY;AAAA,cAC1C,yBAAuB;AAAA,cACvB,OAAOgB;AAAA,cACP,UAAUS;AAAA,cACV,gBAAA1B;AAAA,cACA,cAAAC;AAAA,cACA,UAAUO;AAAA,cACV,UAAUD;AAAA,YAAA;AAAA,UAAA,GAEd;AAAA,UAEA,gBAAAwB,EAAC,OAAA,EAAI,WAAWE,EAAO,eACrB,4BAACM,GAAA,EAAK,KAAK,GAAG,gBAAe,iBAC3B,UAAA;AAAA,YAAA,gBAAAR,EAACtB,GAAA,EAAO,SAAQ,YAAW,SAASgB,GACjC,UAAArB,GACH;AAAA,YACA,gBAAA8B,EAACK,GAAA,EAAK,KAAK,GAAG,gBAAe,YAC3B,UAAA;AAAA,cAAA,gBAAAR,EAACtB,GAAA,EAAO,SAAQ,aAAY,SAASc,GAClC,UAAApB,GACH;AAAA,gCACCM,GAAA,EAAO,SAAQ,WAAU,SAASe,GAChC,UAAAtB,EAAA,CACH;AAAA,YAAA,EAAA,CACF;AAAA,UAAA,EAAA,CACF,EAAA,CACF;AAAA,QAAA,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,GACF;AAEJ;"}
1
+ {"version":3,"file":"DateRangeFilter.js","sources":["../../../../src/components/Common/DateRangeFilter/DateRangeFilter.tsx"],"sourcesContent":["import { useState, useRef, useCallback, useMemo } from 'react'\nimport { Dialog, Popover } from 'react-aria-components'\nimport styles from './DateRangeFilter.module.scss'\nimport type { DateRange } from '@/components/Common/UI/DateRangePicker/DateRangePickerTypes'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useTheme } from '@/contexts/ThemeProvider'\nimport FilterFunnelIcon from '@/assets/icons/filter-funnel.svg?react'\n\nconst formatFilterDate = (date: Date): string =>\n date.toLocaleDateString('en-US', { month: 'short', day: 'numeric' })\n\ninterface DateRangeFilterProps {\n startDate: Date | null\n endDate: Date | null\n onStartDateChange: (date: Date | null) => void\n onEndDateChange: (date: Date | null) => void\n onClear: () => void\n startDateLabel: string\n endDateLabel: string\n applyLabel: string\n cancelLabel: string\n resetLabel: string\n selectDatesLabel: string\n getTriggerLabel: (selection: string) => string\n maxEndDate?: Date\n minStartDate?: Date\n}\n\n/** @internal */\nexport const DateRangeFilter = ({\n startDate,\n endDate,\n onStartDateChange,\n onEndDateChange,\n onClear,\n startDateLabel,\n endDateLabel,\n applyLabel,\n cancelLabel,\n resetLabel,\n selectDatesLabel,\n getTriggerLabel,\n maxEndDate,\n minStartDate,\n}: DateRangeFilterProps) => {\n const { Button, DateRangePicker } = useComponentContext()\n const { container } = useTheme()\n\n const [isOpen, setIsOpen] = useState(false)\n const [draftRange, setDraftRange] = useState<DateRange | null>(null)\n const triggerRef = useRef<HTMLButtonElement>(null)\n\n const handleOpen = useCallback(() => {\n const range = startDate && endDate ? { start: startDate, end: endDate } : null\n setDraftRange(range)\n setIsOpen(true)\n }, [startDate, endDate])\n\n const handleClose = useCallback(() => {\n setIsOpen(false)\n }, [])\n\n const handleApply = useCallback(() => {\n if (draftRange) {\n onStartDateChange(draftRange.start)\n onEndDateChange(draftRange.end)\n } else {\n onClear()\n }\n setIsOpen(false)\n }, [draftRange, onStartDateChange, onEndDateChange, onClear])\n\n const handleReset = useCallback(() => {\n setDraftRange(null)\n }, [])\n\n const handleRangeChange = useCallback((range: DateRange | null) => {\n // A custom DateRangePicker adapter could emit a one-sided range at runtime\n // even though the type guarantees both sides -- never apply a partial one.\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n setDraftRange(range?.start && range.end ? range : null)\n }, [])\n\n const filterDateLabel = useMemo(() => {\n if (!startDate || !endDate) return null\n return `${formatFilterDate(startDate)} – ${formatFilterDate(endDate)}`\n }, [startDate, endDate])\n\n const triggerText = filterDateLabel ?? selectDatesLabel\n\n const triggerButton = (\n <Button\n buttonRef={triggerRef}\n aria-label={getTriggerLabel(triggerText)}\n aria-haspopup=\"dialog\"\n aria-expanded={isOpen}\n onClick={handleOpen}\n variant=\"secondary\"\n icon={<FilterFunnelIcon />}\n className={styles.triggerButton}\n >\n {triggerText}\n </Button>\n )\n\n return (\n <>\n {triggerButton}\n\n <Popover\n UNSTABLE_portalContainer={container.current ?? undefined}\n isOpen={isOpen}\n onOpenChange={open => {\n if (!open) handleClose()\n }}\n triggerRef={triggerRef}\n placement=\"bottom end\"\n offset={8}\n shouldUpdatePosition\n >\n <Dialog className={styles.dialog} aria-label={`${startDateLabel} – ${endDateLabel}`}>\n <div className={styles.popoverContent}>\n <DateRangePicker\n label={`${startDateLabel} – ${endDateLabel}`}\n shouldVisuallyHideLabel\n value={draftRange}\n onChange={handleRangeChange}\n startDateLabel={startDateLabel}\n endDateLabel={endDateLabel}\n minValue={minStartDate}\n maxValue={maxEndDate}\n />\n </div>\n\n <div className={styles.popoverFooter}>\n <Flex gap={8} justifyContent=\"space-between\">\n <Button variant=\"tertiary\" onClick={handleReset}>\n {resetLabel}\n </Button>\n <Flex gap={8} justifyContent=\"flex-end\">\n <Button variant=\"secondary\" onClick={handleClose}>\n {cancelLabel}\n </Button>\n <Button variant=\"primary\" onClick={handleApply}>\n {applyLabel}\n </Button>\n </Flex>\n </Flex>\n </div>\n </Dialog>\n </Popover>\n </>\n )\n}\n"],"names":["formatFilterDate","date","DateRangeFilter","startDate","endDate","onStartDateChange","onEndDateChange","onClear","startDateLabel","endDateLabel","applyLabel","cancelLabel","resetLabel","selectDatesLabel","getTriggerLabel","maxEndDate","minStartDate","Button","DateRangePicker","useComponentContext","container","useTheme","isOpen","setIsOpen","useState","draftRange","setDraftRange","triggerRef","useRef","handleOpen","useCallback","handleClose","handleApply","handleReset","handleRangeChange","range","triggerText","useMemo","triggerButton","jsx","FilterFunnelIcon","styles","jsxs","Frag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BAAAwB,EAAC,OAAA,EAAI,WAAWE,EAAO,eACrB,4BAACM,GAAA,EAAK,KAAK,GAAG,gBAAe,iBAC3B,UAAA;AAAA,YAAA,gBAAAR,EAACtB,GAAA,EAAO,SAAQ,YAAW,SAASgB,GACjC,UAAArB,GACH;AAAA,YACA,gBAAA8B,EAACK,GAAA,EAAK,KAAK,GAAG,gBAAe,YAC3B,UAAA;AAAA,cAAA,gBAAAR,EAACtB,GAAA,EAAO,SAAQ,aAAY,SAASc,GAClC,UAAApB,GACH;AAAA,gCACCM,GAAA,EAAO,SAAQ,WAAU,SAASe,GAChC,UAAAtB,EAAA,CACH;AAAA,YAAA,EAAA,CACF;AAAA,UAAA,EAAA,CACF,EAAA,CACF;AAAA,QAAA,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,GACF;AAEJ;"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/components/Common/OnboardingStatusBadge/index.tsx"],"sourcesContent":["import type { OnboardingStatus as ContractorOnboardingStatus1 } from '@gusto/embedded-api/models/components/contractor'\nimport type { OnboardingStatus } from '@gusto/embedded-api/models/operations/putv1employeesemployeeidonboardingstatus'\nimport { useTranslation } from 'react-i18next'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\ntype OnboardingStatuses = ContractorOnboardingStatus1 | OnboardingStatus\n\ninterface OnboardingStatusBadgeProps<T extends OnboardingStatuses> {\n onboarded?: boolean\n onboardingEntity: 'contractor' | 'employee'\n onboardingStatus?: T | null\n}\n/** @internal */\nexport const OnboardingStatusBadge = <T extends OnboardingStatuses>({\n onboarded,\n onboardingEntity,\n onboardingStatus,\n}: OnboardingStatusBadgeProps<T>) => {\n const { Badge } = useComponentContext()\n const { t } = useTranslation()\n\n //HACK: `never` should instead be a better type\n return (\n <Badge status={onboarded ? 'success' : 'warning'}>\n {t(`onboardingStatus.${onboardingEntity}.${onboardingStatus ?? 'undefined'}` as never)}\n </Badge>\n )\n}\n\ninterface ContractorOnboardingStatusBadgeProps {\n onboarded?: boolean\n onboardingStatus?: ContractorOnboardingStatus1 | null\n}\n/** @internal */\nexport const ContractorOnboardingStatusBadge = (props: ContractorOnboardingStatusBadgeProps) => (\n <OnboardingStatusBadge {...props} onboardingEntity=\"contractor\" />\n)\n\ninterface EmployeeOnboardingStatusBadgeProps {\n onboarded?: boolean\n onboardingStatus?: OnboardingStatus | null\n}\n/** @internal */\nexport const EmployeeOnboardingStatusBadge = (props: EmployeeOnboardingStatusBadgeProps) => (\n <OnboardingStatusBadge {...props} onboardingEntity=\"employee\" />\n)\n"],"names":["OnboardingStatusBadge","onboarded","onboardingEntity","onboardingStatus","Badge","useComponentContext","t","useTranslation","jsx","ContractorOnboardingStatusBadge","props","EmployeeOnboardingStatusBadge"],"mappings":";;;AAaO,MAAMA,IAAwB,CAA+B;AAAA,EAClE,WAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,kBAAAC;AACF,MAAqC;AACnC,QAAM,EAAE,OAAAC,EAAA,IAAUC,EAAA,GACZ,EAAE,GAAAC,EAAA,IAAMC,EAAA;AAGd,SACE,gBAAAC,EAACJ,GAAA,EAAM,QAAQH,IAAY,YAAY,WACpC,UAAAK,EAAE,oBAAoBJ,CAAgB,IAAIC,KAAoB,WAAW,EAAW,GACvF;AAEJ,GAOaM,IAAkC,CAACC,MAC9C,gBAAAF,EAACR,KAAuB,GAAGU,GAAO,kBAAiB,aAAA,CAAa,GAQrDC,IAAgC,CAACD,MAC5C,gBAAAF,EAACR,KAAuB,GAAGU,GAAO,kBAAiB,WAAA,CAAW;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/Common/OnboardingStatusBadge/index.tsx"],"sourcesContent":["import type { ContractorOnboardingStatus1 } from '@gusto/embedded-api/models/components/contractor'\nimport type { OnboardingStatus } from '@gusto/embedded-api/models/operations/putv1employeesemployeeidonboardingstatus'\nimport { useTranslation } from 'react-i18next'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\ntype OnboardingStatuses = ContractorOnboardingStatus1 | OnboardingStatus\n\ninterface OnboardingStatusBadgeProps<T extends OnboardingStatuses> {\n onboarded?: boolean\n onboardingEntity: 'contractor' | 'employee'\n onboardingStatus?: T | null\n}\n/** @internal */\nexport const OnboardingStatusBadge = <T extends OnboardingStatuses>({\n onboarded,\n onboardingEntity,\n onboardingStatus,\n}: OnboardingStatusBadgeProps<T>) => {\n const { Badge } = useComponentContext()\n const { t } = useTranslation()\n\n //HACK: `never` should instead be a better type\n return (\n <Badge status={onboarded ? 'success' : 'warning'}>\n {t(`onboardingStatus.${onboardingEntity}.${onboardingStatus ?? 'undefined'}` as never)}\n </Badge>\n )\n}\n\ninterface ContractorOnboardingStatusBadgeProps {\n onboarded?: boolean\n onboardingStatus?: ContractorOnboardingStatus1 | null\n}\n/** @internal */\nexport const ContractorOnboardingStatusBadge = (props: ContractorOnboardingStatusBadgeProps) => (\n <OnboardingStatusBadge {...props} onboardingEntity=\"contractor\" />\n)\n\ninterface EmployeeOnboardingStatusBadgeProps {\n onboarded?: boolean\n onboardingStatus?: OnboardingStatus | null\n}\n/** @internal */\nexport const EmployeeOnboardingStatusBadge = (props: EmployeeOnboardingStatusBadgeProps) => (\n <OnboardingStatusBadge {...props} onboardingEntity=\"employee\" />\n)\n"],"names":["OnboardingStatusBadge","onboarded","onboardingEntity","onboardingStatus","Badge","useComponentContext","t","useTranslation","jsx","ContractorOnboardingStatusBadge","props","EmployeeOnboardingStatusBadge"],"mappings":";;;AAaO,MAAMA,IAAwB,CAA+B;AAAA,EAClE,WAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,kBAAAC;AACF,MAAqC;AACnC,QAAM,EAAE,OAAAC,EAAA,IAAUC,EAAA,GACZ,EAAE,GAAAC,EAAA,IAAMC,EAAA;AAGd,SACE,gBAAAC,EAACJ,GAAA,EAAM,QAAQH,IAAY,YAAY,WACpC,UAAAK,EAAE,oBAAoBJ,CAAgB,IAAIC,KAAoB,WAAW,EAAW,GACvF;AAEJ,GAOaM,IAAkC,CAACC,MAC9C,gBAAAF,EAACR,KAAuB,GAAGU,GAAO,kBAAiB,aAAA,CAAa,GAQrDC,IAAgC,CAACD,MAC5C,gBAAAF,EAACR,KAAuB,GAAGU,GAAO,kBAAiB,WAAA,CAAW;"}
@@ -1 +1 @@
1
- {"version":3,"file":"AutoPilotDialog.js","sources":["../../../../../../src/components/Company/PaySchedule/management/AutoPilotDialog/AutoPilotDialog.tsx"],"sourcesContent":["import type { PayScheduleShow } from '@gusto/embedded-api/models/components/payscheduleshow'\nimport { AutoPilotDialogPresentation } from './AutoPilotDialogPresentation'\nimport { useAutoPilotDialog } from './useAutoPilotDialog'\nimport type { EventType } from '@/shared/constants'\nimport type { OnEventType } from '@/components/Base/useBase'\n\ninterface AutoPilotDialogProps {\n companyId: string\n schedule: PayScheduleShow\n onEvent: OnEventType<EventType, unknown>\n}\n\n/** @internal */\nexport function AutoPilotDialog({ companyId, schedule, onEvent }: AutoPilotDialogProps) {\n const {\n nextEnabled,\n setNextEnabled,\n blockers,\n isEnableBlocked,\n isLoadingBlockers,\n isSaving,\n hasGenericError,\n errorMessage,\n onSave,\n onClose,\n } = useAutoPilotDialog({ companyId, schedule, onEvent })\n\n return (\n <AutoPilotDialogPresentation\n scheduleName={schedule.customName ?? schedule.name ?? ''}\n blockers={blockers}\n isEnableBlocked={isEnableBlocked}\n isLoadingBlockers={isLoadingBlockers}\n nextEnabled={nextEnabled}\n isSaving={isSaving}\n hasGenericError={hasGenericError}\n errorMessage={errorMessage}\n onToggle={setNextEnabled}\n onSave={() => void onSave()}\n onClose={onClose}\n />\n )\n}\n"],"names":["AutoPilotDialog","companyId","schedule","onEvent","nextEnabled","setNextEnabled","blockers","isEnableBlocked","isLoadingBlockers","isSaving","hasGenericError","errorMessage","onSave","onClose","useAutoPilotDialog","jsx","AutoPilotDialogPresentation"],"mappings":";;;AAaO,SAASA,EAAgB,EAAE,WAAAC,GAAW,UAAAC,GAAU,SAAAC,KAAiC;AACtF,QAAM;AAAA,IACJ,aAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,UAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,UAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,QAAAC;AAAA,IACA,SAAAC;AAAA,EAAA,IACEC,EAAmB,EAAE,WAAAb,GAAW,UAAAC,GAAU,SAAAC,GAAS;AAEvD,SACE,gBAAAY;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,cAAcd,EAAS,cAAcA,EAAS,QAAQ;AAAA,MACtD,UAAAI;AAAA,MACA,iBAAAC;AAAA,MACA,mBAAAC;AAAA,MACA,aAAAJ;AAAA,MACA,UAAAK;AAAA,MACA,iBAAAC;AAAA,MACA,cAAAC;AAAA,MACA,UAAUN;AAAA,MACV,QAAQ,MAAA;AAAM,QAAKO,EAAA;AAAA;AAAA,MACnB,SAAAC;AAAA,IAAA;AAAA,EAAA;AAGN;"}
1
+ {"version":3,"file":"AutoPilotDialog.js","sources":["../../../../../../src/components/Company/PaySchedule/management/AutoPilotDialog/AutoPilotDialog.tsx"],"sourcesContent":["import type { PayScheduleShow } from '@gusto/embedded-api/models/components/payschedulelistitem'\nimport { AutoPilotDialogPresentation } from './AutoPilotDialogPresentation'\nimport { useAutoPilotDialog } from './useAutoPilotDialog'\nimport type { EventType } from '@/shared/constants'\nimport type { OnEventType } from '@/components/Base/useBase'\n\ninterface AutoPilotDialogProps {\n companyId: string\n schedule: PayScheduleShow\n onEvent: OnEventType<EventType, unknown>\n}\n\n/** @internal */\nexport function AutoPilotDialog({ companyId, schedule, onEvent }: AutoPilotDialogProps) {\n const {\n nextEnabled,\n setNextEnabled,\n blockers,\n isEnableBlocked,\n isLoadingBlockers,\n isSaving,\n hasGenericError,\n errorMessage,\n onSave,\n onClose,\n } = useAutoPilotDialog({ companyId, schedule, onEvent })\n\n return (\n <AutoPilotDialogPresentation\n scheduleName={schedule.customName ?? schedule.name ?? ''}\n blockers={blockers}\n isEnableBlocked={isEnableBlocked}\n isLoadingBlockers={isLoadingBlockers}\n nextEnabled={nextEnabled}\n isSaving={isSaving}\n hasGenericError={hasGenericError}\n errorMessage={errorMessage}\n onToggle={setNextEnabled}\n onSave={() => void onSave()}\n onClose={onClose}\n />\n )\n}\n"],"names":["AutoPilotDialog","companyId","schedule","onEvent","nextEnabled","setNextEnabled","blockers","isEnableBlocked","isLoadingBlockers","isSaving","hasGenericError","errorMessage","onSave","onClose","useAutoPilotDialog","jsx","AutoPilotDialogPresentation"],"mappings":";;;AAaO,SAASA,EAAgB,EAAE,WAAAC,GAAW,UAAAC,GAAU,SAAAC,KAAiC;AACtF,QAAM;AAAA,IACJ,aAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,UAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,UAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,QAAAC;AAAA,IACA,SAAAC;AAAA,EAAA,IACEC,EAAmB,EAAE,WAAAb,GAAW,UAAAC,GAAU,SAAAC,GAAS;AAEvD,SACE,gBAAAY;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,cAAcd,EAAS,cAAcA,EAAS,QAAQ;AAAA,MACtD,UAAAI;AAAA,MACA,iBAAAC;AAAA,MACA,mBAAAC;AAAA,MACA,aAAAJ;AAAA,MACA,UAAAK;AAAA,MACA,iBAAAC;AAAA,MACA,cAAAC;AAAA,MACA,UAAUN;AAAA,MACV,QAAQ,MAAA;AAAM,QAAKO,EAAA;AAAA;AAAA,MACnB,SAAAC;AAAA,IAAA;AAAA,EAAA;AAGN;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useAutoPilotDialog.js","sources":["../../../../../../src/components/Company/PaySchedule/management/AutoPilotDialog/useAutoPilotDialog.ts"],"sourcesContent":["import { useState } from 'react'\nimport { usePaySchedulesGet } from '@gusto/embedded-api/react-query/paySchedulesGet'\nimport { usePaySchedulesUpdateMutation } from '@gusto/embedded-api/react-query/paySchedulesUpdate'\nimport type { PayScheduleShow } from '@gusto/embedded-api/models/components/payscheduleshow'\nimport { componentEvents, type EventType } from '@/shared/constants'\nimport type { OnEventType } from '@/components/Base/useBase'\nimport { normalizeToSDKError } from '@/types/sdkError'\n\ninterface UseAutoPilotDialogProps {\n companyId: string\n schedule: PayScheduleShow\n onEvent: OnEventType<EventType, unknown>\n}\n\n/** @internal */\nexport function useAutoPilotDialog({ companyId, schedule, onEvent }: UseAutoPilotDialogProps) {\n const [nextEnabled, setNextEnabled] = useState(Boolean(schedule.autoPayroll))\n const [hasGenericError, setHasGenericError] = useState(false)\n const [errorMessage, setErrorMessage] = useState<string | undefined>()\n const { mutateAsync: updatePaySchedule, isPending: isSaving } = usePaySchedulesUpdateMutation()\n\n // The list call never returns `autoPayrollEnablementBlockers` -- only the show call does.\n // Blockers only gate enabling, so skip the fetch entirely when the schedule is already on.\n const shouldCheckBlockers = !schedule.autoPayroll\n const {\n data: scheduleDetails,\n isLoading: isLoadingBlockers,\n isError: hasBlockersError,\n } = usePaySchedulesGet(\n { companyId, payScheduleId: schedule.uuid },\n { enabled: shouldCheckBlockers },\n )\n\n const blockers = scheduleDetails?.payScheduleShow?.autoPayrollEnablementBlockers ?? []\n // Named blockers only gate enabling; a schedule already enabled can always be disabled.\n // A failed eligibility check also blocks enabling -- we can't confirm blockers are clear,\n // so default to the safe outcome instead of letting the user bypass an unchecked blocker.\n const isEnableBlocked =\n shouldCheckBlockers && (isLoadingBlockers || hasBlockersError || blockers.length > 0)\n\n const hasChanges = nextEnabled !== Boolean(schedule.autoPayroll)\n\n const onSave = async () => {\n if (!hasChanges) {\n onEvent(componentEvents.PAY_SCHEDULE_AUTO_PILOT_DISMISSED, null)\n return\n }\n\n setHasGenericError(false)\n setErrorMessage(undefined)\n\n try {\n await updatePaySchedule({\n request: {\n companyId,\n payScheduleId: schedule.uuid,\n payScheduleUpdateRequest: {\n version: schedule.version,\n autoPayroll: nextEnabled,\n },\n },\n })\n onEvent(\n nextEnabled\n ? componentEvents.PAY_SCHEDULE_AUTO_PILOT_ENABLED\n : componentEvents.PAY_SCHEDULE_AUTO_PILOT_DISABLED,\n null,\n )\n } catch (err) {\n // The API returns this as a single error keyed `auto_payroll` with a human-readable\n // message (e.g. which blocker tripped). Fall back to the canned copy only when the\n // error can't be parsed into that shape at all.\n setErrorMessage(normalizeToSDKError(err).fieldErrors[0]?.message)\n setHasGenericError(true)\n }\n }\n\n const onClose = () => {\n onEvent(componentEvents.PAY_SCHEDULE_AUTO_PILOT_DISMISSED, null)\n }\n\n return {\n nextEnabled,\n setNextEnabled,\n blockers,\n isEnableBlocked,\n isLoadingBlockers: shouldCheckBlockers && isLoadingBlockers,\n isSaving,\n hasGenericError,\n errorMessage,\n onSave,\n onClose,\n }\n}\n"],"names":["useAutoPilotDialog","companyId","schedule","onEvent","nextEnabled","setNextEnabled","useState","hasGenericError","setHasGenericError","errorMessage","setErrorMessage","updatePaySchedule","isSaving","usePaySchedulesUpdateMutation","shouldCheckBlockers","scheduleDetails","isLoadingBlockers","hasBlockersError","usePaySchedulesGet","blockers","isEnableBlocked","hasChanges","componentEvents","err","normalizeToSDKError"],"mappings":";;;;;AAeO,SAASA,EAAmB,EAAE,WAAAC,GAAW,UAAAC,GAAU,SAAAC,KAAoC;AAC5F,QAAM,CAACC,GAAaC,CAAc,IAAIC,EAAS,EAAQJ,EAAS,WAAY,GACtE,CAACK,GAAiBC,CAAkB,IAAIF,EAAS,EAAK,GACtD,CAACG,GAAcC,CAAe,IAAIJ,EAAA,GAClC,EAAE,aAAaK,GAAmB,WAAWC,EAAA,IAAaC,EAAA,GAI1DC,IAAsB,CAACZ,EAAS,aAChC;AAAA,IACJ,MAAMa;AAAA,IACN,WAAWC;AAAA,IACX,SAASC;AAAA,EAAA,IACPC;AAAA,IACF,EAAE,WAAAjB,GAAW,eAAeC,EAAS,KAAA;AAAA,IACrC,EAAE,SAASY,EAAA;AAAA,EAAoB,GAG3BK,IAAWJ,GAAiB,iBAAiB,iCAAiC,CAAA,GAI9EK,IACJN,MAAwBE,KAAqBC,KAAoBE,EAAS,SAAS,IAE/EE,IAAajB,MAAgB,EAAQF,EAAS;AAyCpD,SAAO;AAAA,IACL,aAAAE;AAAA,IACA,gBAAAC;AAAA,IACA,UAAAc;AAAA,IACA,iBAAAC;AAAA,IACA,mBAAmBN,KAAuBE;AAAA,IAC1C,UAAAJ;AAAA,IACA,iBAAAL;AAAA,IACA,cAAAE;AAAA,IACA,QAhDa,YAAY;AACzB,UAAI,CAACY,GAAY;AACf,QAAAlB,EAAQmB,EAAgB,mCAAmC,IAAI;AAC/D;AAAA,MACF;AAEA,MAAAd,EAAmB,EAAK,GACxBE,EAAgB,MAAS;AAEzB,UAAI;AACF,cAAMC,EAAkB;AAAA,UACtB,SAAS;AAAA,YACP,WAAAV;AAAA,YACA,eAAeC,EAAS;AAAA,YACxB,0BAA0B;AAAA,cACxB,SAASA,EAAS;AAAA,cAClB,aAAaE;AAAA,YAAA;AAAA,UACf;AAAA,QACF,CACD,GACDD;AAAA,UACEC,IACIkB,EAAgB,kCAChBA,EAAgB;AAAA,UACpB;AAAA,QAAA;AAAA,MAEJ,SAASC,GAAK;AAIZ,QAAAb,EAAgBc,EAAoBD,CAAG,EAAE,YAAY,CAAC,GAAG,OAAO,GAChEf,EAAmB,EAAI;AAAA,MACzB;AAAA,IACF;AAAA,IAgBE,SAdc,MAAM;AACpB,MAAAL,EAAQmB,EAAgB,mCAAmC,IAAI;AAAA,IACjE;AAAA,EAYE;AAEJ;"}
1
+ {"version":3,"file":"useAutoPilotDialog.js","sources":["../../../../../../src/components/Company/PaySchedule/management/AutoPilotDialog/useAutoPilotDialog.ts"],"sourcesContent":["import { useState } from 'react'\nimport { usePaySchedulesGet } from '@gusto/embedded-api/react-query/paySchedulesGet'\nimport { usePaySchedulesUpdateMutation } from '@gusto/embedded-api/react-query/paySchedulesUpdate'\nimport type { PayScheduleShow } from '@gusto/embedded-api/models/components/payschedulelistitem'\nimport { componentEvents, type EventType } from '@/shared/constants'\nimport type { OnEventType } from '@/components/Base/useBase'\nimport { normalizeToSDKError } from '@/types/sdkError'\n\ninterface UseAutoPilotDialogProps {\n companyId: string\n schedule: PayScheduleShow\n onEvent: OnEventType<EventType, unknown>\n}\n\n/** @internal */\nexport function useAutoPilotDialog({ companyId, schedule, onEvent }: UseAutoPilotDialogProps) {\n const [nextEnabled, setNextEnabled] = useState(Boolean(schedule.autoPayroll))\n const [hasGenericError, setHasGenericError] = useState(false)\n const [errorMessage, setErrorMessage] = useState<string | undefined>()\n const { mutateAsync: updatePaySchedule, isPending: isSaving } = usePaySchedulesUpdateMutation()\n\n // The list call never returns `autoPayrollEnablementBlockers` -- only the show call does.\n // Blockers only gate enabling, so skip the fetch entirely when the schedule is already on.\n const shouldCheckBlockers = !schedule.autoPayroll\n const {\n data: scheduleDetails,\n isLoading: isLoadingBlockers,\n isError: hasBlockersError,\n } = usePaySchedulesGet(\n { companyId, payScheduleId: schedule.uuid },\n { enabled: shouldCheckBlockers },\n )\n\n const blockers = scheduleDetails?.payScheduleShow?.autoPayrollEnablementBlockers ?? []\n // Named blockers only gate enabling; a schedule already enabled can always be disabled.\n // A failed eligibility check also blocks enabling -- we can't confirm blockers are clear,\n // so default to the safe outcome instead of letting the user bypass an unchecked blocker.\n const isEnableBlocked =\n shouldCheckBlockers && (isLoadingBlockers || hasBlockersError || blockers.length > 0)\n\n const hasChanges = nextEnabled !== Boolean(schedule.autoPayroll)\n\n const onSave = async () => {\n if (!hasChanges) {\n onEvent(componentEvents.PAY_SCHEDULE_AUTO_PILOT_DISMISSED, null)\n return\n }\n\n setHasGenericError(false)\n setErrorMessage(undefined)\n\n try {\n await updatePaySchedule({\n request: {\n companyId,\n payScheduleId: schedule.uuid,\n payScheduleUpdateRequest: {\n version: schedule.version,\n autoPayroll: nextEnabled,\n },\n },\n })\n onEvent(\n nextEnabled\n ? componentEvents.PAY_SCHEDULE_AUTO_PILOT_ENABLED\n : componentEvents.PAY_SCHEDULE_AUTO_PILOT_DISABLED,\n null,\n )\n } catch (err) {\n // The API returns this as a single error keyed `auto_payroll` with a human-readable\n // message (e.g. which blocker tripped). Fall back to the canned copy only when the\n // error can't be parsed into that shape at all.\n setErrorMessage(normalizeToSDKError(err).fieldErrors[0]?.message)\n setHasGenericError(true)\n }\n }\n\n const onClose = () => {\n onEvent(componentEvents.PAY_SCHEDULE_AUTO_PILOT_DISMISSED, null)\n }\n\n return {\n nextEnabled,\n setNextEnabled,\n blockers,\n isEnableBlocked,\n isLoadingBlockers: shouldCheckBlockers && isLoadingBlockers,\n isSaving,\n hasGenericError,\n errorMessage,\n onSave,\n onClose,\n }\n}\n"],"names":["useAutoPilotDialog","companyId","schedule","onEvent","nextEnabled","setNextEnabled","useState","hasGenericError","setHasGenericError","errorMessage","setErrorMessage","updatePaySchedule","isSaving","usePaySchedulesUpdateMutation","shouldCheckBlockers","scheduleDetails","isLoadingBlockers","hasBlockersError","usePaySchedulesGet","blockers","isEnableBlocked","hasChanges","componentEvents","err","normalizeToSDKError"],"mappings":";;;;;AAeO,SAASA,EAAmB,EAAE,WAAAC,GAAW,UAAAC,GAAU,SAAAC,KAAoC;AAC5F,QAAM,CAACC,GAAaC,CAAc,IAAIC,EAAS,EAAQJ,EAAS,WAAY,GACtE,CAACK,GAAiBC,CAAkB,IAAIF,EAAS,EAAK,GACtD,CAACG,GAAcC,CAAe,IAAIJ,EAAA,GAClC,EAAE,aAAaK,GAAmB,WAAWC,EAAA,IAAaC,EAAA,GAI1DC,IAAsB,CAACZ,EAAS,aAChC;AAAA,IACJ,MAAMa;AAAA,IACN,WAAWC;AAAA,IACX,SAASC;AAAA,EAAA,IACPC;AAAA,IACF,EAAE,WAAAjB,GAAW,eAAeC,EAAS,KAAA;AAAA,IACrC,EAAE,SAASY,EAAA;AAAA,EAAoB,GAG3BK,IAAWJ,GAAiB,iBAAiB,iCAAiC,CAAA,GAI9EK,IACJN,MAAwBE,KAAqBC,KAAoBE,EAAS,SAAS,IAE/EE,IAAajB,MAAgB,EAAQF,EAAS;AAyCpD,SAAO;AAAA,IACL,aAAAE;AAAA,IACA,gBAAAC;AAAA,IACA,UAAAc;AAAA,IACA,iBAAAC;AAAA,IACA,mBAAmBN,KAAuBE;AAAA,IAC1C,UAAAJ;AAAA,IACA,iBAAAL;AAAA,IACA,cAAAE;AAAA,IACA,QAhDa,YAAY;AACzB,UAAI,CAACY,GAAY;AACf,QAAAlB,EAAQmB,EAAgB,mCAAmC,IAAI;AAC/D;AAAA,MACF;AAEA,MAAAd,EAAmB,EAAK,GACxBE,EAAgB,MAAS;AAEzB,UAAI;AACF,cAAMC,EAAkB;AAAA,UACtB,SAAS;AAAA,YACP,WAAAV;AAAA,YACA,eAAeC,EAAS;AAAA,YACxB,0BAA0B;AAAA,cACxB,SAASA,EAAS;AAAA,cAClB,aAAaE;AAAA,YAAA;AAAA,UACf;AAAA,QACF,CACD,GACDD;AAAA,UACEC,IACIkB,EAAgB,kCAChBA,EAAgB;AAAA,UACpB;AAAA,QAAA;AAAA,MAEJ,SAASC,GAAK;AAIZ,QAAAb,EAAgBc,EAAoBD,CAAG,EAAE,YAAY,CAAC,GAAG,OAAO,GAChEf,EAAmB,EAAI;AAAA,MACzB;AAAA,IACF;AAAA,IAgBE,SAdc,MAAM;AACpB,MAAAL,EAAQmB,EAAgB,mCAAmC,IAAI;AAAA,IACjE;AAAA,EAYE;AAEJ;"}
@@ -1,9 +1,9 @@
1
- import { jsx as e, jsxs as t } from "react/jsx-runtime";
1
+ import { jsx as e, jsxs as r } from "react/jsx-runtime";
2
2
  import { z as a } from "zod";
3
3
  import { useForm as f, FormProvider as P } from "react-hook-form";
4
4
  import { zodResolver as b } from "@hookform/resolvers/zod";
5
- import { useTranslation as C } from "react-i18next";
6
- import { scheduleLabel as g } from "./scheduleLabel.js";
5
+ import { useTranslation as g } from "react-i18next";
6
+ import { scheduleLabel as C } from "./scheduleLabel.js";
7
7
  import { Flex as m } from "../../../../Common/Flex/Flex.js";
8
8
  import { ActionsLayout as v } from "../../../../Common/ActionsLayout/ActionsLayout.js";
9
9
  import { Form as x } from "../../../../Common/Form/Form.js";
@@ -13,7 +13,7 @@ const D = a.object({
13
13
  hourlyPayScheduleUuid: a.string().min(1),
14
14
  salariedPayScheduleUuid: a.string().min(1)
15
15
  });
16
- function V({
16
+ function H({
17
17
  schedules: i,
18
18
  hourlyPayScheduleUuid: u,
19
19
  salariedPayScheduleUuid: s,
@@ -21,27 +21,28 @@ function V({
21
21
  onAddPaySchedule: h,
22
22
  onContinue: S
23
23
  }) {
24
- const { t: o } = C("Company.Management.PayScheduleAssignment"), n = U(), r = f({
24
+ const { t: o } = g("Company.Management.PayScheduleAssignment"), n = U(), t = f({
25
25
  resolver: b(D),
26
26
  defaultValues: {
27
27
  hourlyPayScheduleUuid: u ?? i[0]?.uuid ?? "",
28
28
  salariedPayScheduleUuid: s ?? i[0]?.uuid ?? ""
29
29
  }
30
- }), y = r.handleSubmit(S), l = i.map((d) => ({
30
+ }), y = t.handleSubmit(S), l = i.map((d) => ({
31
31
  value: d.uuid,
32
- label: g(d)
32
+ label: C(d)
33
33
  }));
34
- return /* @__PURE__ */ e(P, { ...r, children: /* @__PURE__ */ e(x, { onSubmit: () => {
34
+ return /* @__PURE__ */ e(P, { ...t, children: /* @__PURE__ */ e(x, { onSubmit: () => {
35
35
  y();
36
- }, children: /* @__PURE__ */ t(m, { flexDirection: "column", gap: 32, children: [
36
+ }, children: /* @__PURE__ */ r(m, { flexDirection: "column", gap: 32, children: [
37
37
  /* @__PURE__ */ e(n.Heading, { as: "h2", children: o("compensationStep.heading") }),
38
- /* @__PURE__ */ t(m, { flexDirection: "column", gap: 12, children: [
38
+ /* @__PURE__ */ r(m, { flexDirection: "column", gap: 12, children: [
39
39
  /* @__PURE__ */ e(
40
40
  c,
41
41
  {
42
42
  name: "hourlyPayScheduleUuid",
43
43
  label: o("compensationStep.hourlyPayScheduleLabel"),
44
44
  description: o("compensationStep.hourlyPayScheduleDescription"),
45
+ isRequired: !0,
45
46
  placeholder: "",
46
47
  options: l
47
48
  }
@@ -52,19 +53,38 @@ function V({
52
53
  name: "salariedPayScheduleUuid",
53
54
  label: o("compensationStep.salariedPayScheduleLabel"),
54
55
  description: o("compensationStep.salariedPayScheduleDescription"),
56
+ isRequired: !0,
55
57
  placeholder: "",
56
58
  options: l
57
59
  }
58
60
  ),
59
- /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(n.Button, { variant: "secondary", onClick: h, children: o("compensationStep.addPayScheduleCta") }) })
61
+ /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
62
+ n.Button,
63
+ {
64
+ variant: "secondary",
65
+ onClick: () => {
66
+ h(t.getValues());
67
+ },
68
+ children: o("compensationStep.addPayScheduleCta")
69
+ }
70
+ ) })
60
71
  ] }),
61
- /* @__PURE__ */ t(v, { children: [
62
- /* @__PURE__ */ e(n.Button, { variant: "secondary", onClick: p, children: o("backCta") }),
72
+ /* @__PURE__ */ r(v, { children: [
73
+ /* @__PURE__ */ e(
74
+ n.Button,
75
+ {
76
+ variant: "secondary",
77
+ onClick: () => {
78
+ p(t.getValues());
79
+ },
80
+ children: o("backCta")
81
+ }
82
+ ),
63
83
  /* @__PURE__ */ e(n.Button, { variant: "primary", type: "submit", isDisabled: i.length === 0, children: o("continueCta") })
64
84
  ] })
65
85
  ] }) }) });
66
86
  }
67
87
  export {
68
- V as AssignmentCompensationStepPresentation
88
+ H as AssignmentCompensationStepPresentation
69
89
  };
70
90
  //# sourceMappingURL=AssignmentCompensationStepPresentation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AssignmentCompensationStepPresentation.js","sources":["../../../../../../src/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentCompensationStepPresentation.tsx"],"sourcesContent":["import { z } from 'zod'\nimport { useForm, FormProvider } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { useTranslation } from 'react-i18next'\nimport type { PayScheduleShow } from '@gusto/embedded-api/models/components/payscheduleshow'\nimport { scheduleLabel } from './scheduleLabel'\nimport { Flex, SelectField, ActionsLayout } from '@/components/Common'\nimport { Form } from '@/components/Common/Form'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\n/** @internal */\nexport interface AssignmentCompensationStepPresentationProps {\n schedules: PayScheduleShow[]\n hourlyPayScheduleUuid?: string\n salariedPayScheduleUuid?: string\n onBack: () => void\n onAddPaySchedule: () => void\n onContinue: (selection: {\n hourlyPayScheduleUuid: string\n salariedPayScheduleUuid: string\n }) => void\n}\n\nconst CompensationStepSchema = z.object({\n hourlyPayScheduleUuid: z.string().min(1),\n salariedPayScheduleUuid: z.string().min(1),\n})\n\ntype CompensationStepInputs = z.infer<typeof CompensationStepSchema>\n\n/** @internal */\nexport function AssignmentCompensationStepPresentation({\n schedules,\n hourlyPayScheduleUuid,\n salariedPayScheduleUuid,\n onBack,\n onAddPaySchedule,\n onContinue,\n}: AssignmentCompensationStepPresentationProps) {\n const { t } = useTranslation('Company.Management.PayScheduleAssignment')\n const Components = useComponentContext()\n\n const formMethods = useForm<CompensationStepInputs>({\n resolver: zodResolver(CompensationStepSchema),\n defaultValues: {\n hourlyPayScheduleUuid: hourlyPayScheduleUuid ?? schedules[0]?.uuid ?? '',\n salariedPayScheduleUuid: salariedPayScheduleUuid ?? schedules[0]?.uuid ?? '',\n },\n })\n\n const handleSubmit = formMethods.handleSubmit(onContinue)\n\n const options = schedules.map(schedule => ({\n value: schedule.uuid,\n label: scheduleLabel(schedule),\n }))\n\n return (\n <FormProvider {...formMethods}>\n <Form onSubmit={() => void handleSubmit()}>\n <Flex flexDirection=\"column\" gap={32}>\n <Components.Heading as=\"h2\">{t('compensationStep.heading')}</Components.Heading>\n <Flex flexDirection=\"column\" gap={12}>\n <SelectField\n name=\"hourlyPayScheduleUuid\"\n label={t('compensationStep.hourlyPayScheduleLabel')}\n description={t('compensationStep.hourlyPayScheduleDescription')}\n placeholder=\"\"\n options={options}\n />\n <SelectField\n name=\"salariedPayScheduleUuid\"\n label={t('compensationStep.salariedPayScheduleLabel')}\n description={t('compensationStep.salariedPayScheduleDescription')}\n placeholder=\"\"\n options={options}\n />\n <div>\n <Components.Button variant=\"secondary\" onClick={onAddPaySchedule}>\n {t('compensationStep.addPayScheduleCta')}\n </Components.Button>\n </div>\n </Flex>\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={onBack}>\n {t('backCta')}\n </Components.Button>\n <Components.Button variant=\"primary\" type=\"submit\" isDisabled={schedules.length === 0}>\n {t('continueCta')}\n </Components.Button>\n </ActionsLayout>\n </Flex>\n </Form>\n </FormProvider>\n )\n}\n"],"names":["CompensationStepSchema","z","AssignmentCompensationStepPresentation","schedules","hourlyPayScheduleUuid","salariedPayScheduleUuid","onBack","onAddPaySchedule","onContinue","t","useTranslation","Components","useComponentContext","formMethods","useForm","zodResolver","handleSubmit","options","schedule","scheduleLabel","FormProvider","jsx","Form","jsxs","Flex","SelectField","ActionsLayout"],"mappings":";;;;;;;;;;;AAuBA,MAAMA,IAAyBC,EAAE,OAAO;AAAA,EACtC,uBAAuBA,EAAE,SAAS,IAAI,CAAC;AAAA,EACvC,yBAAyBA,EAAE,OAAA,EAAS,IAAI,CAAC;AAC3C,CAAC;AAKM,SAASC,EAAuC;AAAA,EACrD,WAAAC;AAAA,EACA,uBAAAC;AAAA,EACA,yBAAAC;AAAA,EACA,QAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,YAAAC;AACF,GAAgD;AAC9C,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,0CAA0C,GACjEC,IAAaC,EAAA,GAEbC,IAAcC,EAAgC;AAAA,IAClD,UAAUC,EAAYf,CAAsB;AAAA,IAC5C,eAAe;AAAA,MACb,uBAAuBI,KAAyBD,EAAU,CAAC,GAAG,QAAQ;AAAA,MACtE,yBAAyBE,KAA2BF,EAAU,CAAC,GAAG,QAAQ;AAAA,IAAA;AAAA,EAC5E,CACD,GAEKa,IAAeH,EAAY,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aAAa,EAAA,CAClB;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,EAAA,CACF,GACF,GACF;AAEJ;"}
1
+ {"version":3,"file":"AssignmentCompensationStepPresentation.js","sources":["../../../../../../src/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentCompensationStepPresentation.tsx"],"sourcesContent":["import { z } from 'zod'\nimport { useForm, FormProvider } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { useTranslation } from 'react-i18next'\nimport type { PayScheduleShow } from '@gusto/embedded-api/models/components/payschedulelistitem'\nimport { scheduleLabel } from './scheduleLabel'\nimport { Flex, SelectField, ActionsLayout } from '@/components/Common'\nimport { Form } from '@/components/Common/Form'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\n/** @internal */\nexport interface AssignmentCompensationStepPresentationProps {\n schedules: PayScheduleShow[]\n hourlyPayScheduleUuid?: string\n salariedPayScheduleUuid?: string\n onBack: (selection: CompensationStepInputs) => void\n onAddPaySchedule: (selection: CompensationStepInputs) => void\n onContinue: (selection: {\n hourlyPayScheduleUuid: string\n salariedPayScheduleUuid: string\n }) => void\n}\n\nconst CompensationStepSchema = z.object({\n hourlyPayScheduleUuid: z.string().min(1),\n salariedPayScheduleUuid: z.string().min(1),\n})\n\ntype CompensationStepInputs = z.infer<typeof CompensationStepSchema>\n\n/** @internal */\nexport function AssignmentCompensationStepPresentation({\n schedules,\n hourlyPayScheduleUuid,\n salariedPayScheduleUuid,\n onBack,\n onAddPaySchedule,\n onContinue,\n}: AssignmentCompensationStepPresentationProps) {\n const { t } = useTranslation('Company.Management.PayScheduleAssignment')\n const Components = useComponentContext()\n\n const formMethods = useForm<CompensationStepInputs>({\n resolver: zodResolver(CompensationStepSchema),\n defaultValues: {\n hourlyPayScheduleUuid: hourlyPayScheduleUuid ?? schedules[0]?.uuid ?? '',\n salariedPayScheduleUuid: salariedPayScheduleUuid ?? schedules[0]?.uuid ?? '',\n },\n })\n\n const handleSubmit = formMethods.handleSubmit(onContinue)\n\n const options = schedules.map(schedule => ({\n value: schedule.uuid,\n label: scheduleLabel(schedule),\n }))\n\n return (\n <FormProvider {...formMethods}>\n <Form onSubmit={() => void handleSubmit()}>\n <Flex flexDirection=\"column\" gap={32}>\n <Components.Heading as=\"h2\">{t('compensationStep.heading')}</Components.Heading>\n <Flex flexDirection=\"column\" gap={12}>\n <SelectField\n name=\"hourlyPayScheduleUuid\"\n label={t('compensationStep.hourlyPayScheduleLabel')}\n description={t('compensationStep.hourlyPayScheduleDescription')}\n isRequired\n placeholder=\"\"\n options={options}\n />\n <SelectField\n name=\"salariedPayScheduleUuid\"\n label={t('compensationStep.salariedPayScheduleLabel')}\n description={t('compensationStep.salariedPayScheduleDescription')}\n isRequired\n placeholder=\"\"\n options={options}\n />\n <div>\n <Components.Button\n variant=\"secondary\"\n onClick={() => {\n onAddPaySchedule(formMethods.getValues())\n }}\n >\n {t('compensationStep.addPayScheduleCta')}\n </Components.Button>\n </div>\n </Flex>\n <ActionsLayout>\n <Components.Button\n variant=\"secondary\"\n onClick={() => {\n onBack(formMethods.getValues())\n }}\n >\n {t('backCta')}\n </Components.Button>\n <Components.Button variant=\"primary\" type=\"submit\" isDisabled={schedules.length === 0}>\n {t('continueCta')}\n </Components.Button>\n </ActionsLayout>\n </Flex>\n </Form>\n </FormProvider>\n )\n}\n"],"names":["CompensationStepSchema","z","AssignmentCompensationStepPresentation","schedules","hourlyPayScheduleUuid","salariedPayScheduleUuid","onBack","onAddPaySchedule","onContinue","t","useTranslation","Components","useComponentContext","formMethods","useForm","zodResolver","handleSubmit","options","schedule","scheduleLabel","FormProvider","jsx","Form","jsxs","Flex","SelectField","ActionsLayout"],"mappings":";;;;;;;;;;;AAuBA,MAAMA,IAAyBC,EAAE,OAAO;AAAA,EACtC,uBAAuBA,EAAE,SAAS,IAAI,CAAC;AAAA,EACvC,yBAAyBA,EAAE,OAAA,EAAS,IAAI,CAAC;AAC3C,CAAC;AAKM,SAASC,EAAuC;AA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U;AAAA,UACV,aAAY;AAAA,UACZ,SAAAQ;AAAA,QAAA;AAAA,MAAA;AAAA,wBAED,OAAA,EACC,UAAA,gBAAAI;AAAA,QAACV,EAAW;AAAA,QAAX;AAAA,UACC,SAAQ;AAAA,UACR,SAAS,MAAM;AACb,YAAAJ,EAAiBM,EAAY,WAAW;AAAA,UAC1C;AAAA,UAEC,YAAE,oCAAoC;AAAA,QAAA;AAAA,MAAA,EACzC,CACF;AAAA,IAAA,GACF;AAAA,sBACCa,GAAA,EACC,UAAA;AAAA,MAAA,gBAAAL;AAAA,QAACV,EAAW;AAAA,QAAX;AAAA,UACC,SAAQ;AAAA,UACR,SAAS,MAAM;AACb,YAAAL,EAAOO,EAAY,WAAW;AAAA,UAChC;AAAA,UAEC,YAAE,SAAS;AAAA,QAAA;AAAA,MAAA;AAAA,MAEd,gBAAAQ,EAACV,EAAW,QAAX,EAAkB,SAAQ,WAAU,MAAK,UAAS,YAAYR,EAAU,WAAW,GACjF,UAAAM,EAAE,aAAa,EAAA,CAClB;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,EAAA,CACF,GACF,GACF;AAEJ;"}
@@ -0,0 +1,106 @@
1
+ import { jsx as t, jsxs as l } from "react/jsx-runtime";
2
+ import { z as d } from "zod";
3
+ import { useForm as b, FormProvider as U } from "react-hook-form";
4
+ import { zodResolver as P } from "@hookform/resolvers/zod";
5
+ import { useTranslation as D } from "react-i18next";
6
+ import { scheduleLabel as C } from "./scheduleLabel.js";
7
+ import { Flex as s } from "../../../../Common/Flex/Flex.js";
8
+ import { ActionsLayout as v } from "../../../../Common/ActionsLayout/ActionsLayout.js";
9
+ import { Form as x } from "../../../../Common/Form/Form.js";
10
+ import { useComponentContext as B } from "../../../../../contexts/ComponentAdapter/useComponentContext.js";
11
+ import { SelectField as h } from "../../../../Common/Fields/SelectField/SelectField.js";
12
+ const F = d.object({
13
+ defaultPayScheduleUuid: d.string().min(1),
14
+ payScheduleByDepartment: d.record(d.string(), d.string().min(1))
15
+ });
16
+ function O({
17
+ departments: m,
18
+ schedules: p,
19
+ selection: u,
20
+ onBack: S,
21
+ onAddPaySchedule: f,
22
+ onContinue: y
23
+ }) {
24
+ const { t: a } = D("Company.Management.PayScheduleAssignment"), n = B(), r = b({
25
+ resolver: P(F),
26
+ shouldUnregister: !0,
27
+ defaultValues: {
28
+ defaultPayScheduleUuid: u.defaultPayScheduleUuid,
29
+ payScheduleByDepartment: Object.fromEntries(
30
+ u.departments.map((e) => [e.departmentUuid, e.payScheduleUuid])
31
+ )
32
+ }
33
+ }), o = (e) => ({
34
+ defaultPayScheduleUuid: e.defaultPayScheduleUuid,
35
+ departments: m.flatMap(
36
+ (i) => i.uuid ? [
37
+ {
38
+ departmentUuid: i.uuid,
39
+ payScheduleUuid: e.payScheduleByDepartment[i.uuid] ?? ""
40
+ }
41
+ ] : []
42
+ )
43
+ }), g = r.handleSubmit((e) => {
44
+ y(o(e));
45
+ }), c = p.map((e) => ({
46
+ value: e.uuid,
47
+ label: C(e)
48
+ }));
49
+ return /* @__PURE__ */ t(U, { ...r, children: /* @__PURE__ */ t(x, { onSubmit: () => {
50
+ g();
51
+ }, children: /* @__PURE__ */ l(s, { flexDirection: "column", gap: 32, children: [
52
+ /* @__PURE__ */ t(n.Heading, { as: "h2", children: a("departmentStep.heading") }),
53
+ /* @__PURE__ */ l(s, { flexDirection: "column", gap: 12, children: [
54
+ m.map((e) => /* @__PURE__ */ t(
55
+ h,
56
+ {
57
+ name: `payScheduleByDepartment.${e.uuid}`,
58
+ defaultValue: u.departments.find((i) => i.departmentUuid === e.uuid)?.payScheduleUuid ?? "",
59
+ label: e.title ?? a("departmentStep.unnamedDepartment"),
60
+ isRequired: !0,
61
+ placeholder: "",
62
+ options: c
63
+ },
64
+ e.uuid
65
+ )),
66
+ /* @__PURE__ */ t(
67
+ h,
68
+ {
69
+ name: "defaultPayScheduleUuid",
70
+ label: a("departmentStep.defaultPayScheduleLabel"),
71
+ description: a("departmentStep.defaultPayScheduleDescription"),
72
+ isRequired: !0,
73
+ placeholder: "",
74
+ options: c
75
+ }
76
+ ),
77
+ /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(
78
+ n.Button,
79
+ {
80
+ variant: "secondary",
81
+ onClick: () => {
82
+ f(o(r.getValues()));
83
+ },
84
+ children: a("departmentStep.addPayScheduleCta")
85
+ }
86
+ ) })
87
+ ] }),
88
+ /* @__PURE__ */ l(v, { children: [
89
+ /* @__PURE__ */ t(
90
+ n.Button,
91
+ {
92
+ variant: "secondary",
93
+ onClick: () => {
94
+ S(o(r.getValues()));
95
+ },
96
+ children: a("backCta")
97
+ }
98
+ ),
99
+ /* @__PURE__ */ t(n.Button, { variant: "primary", type: "submit", isDisabled: p.length === 0, children: a("continueCta") })
100
+ ] })
101
+ ] }) }) });
102
+ }
103
+ export {
104
+ O as AssignmentDepartmentStepPresentation
105
+ };
106
+ //# sourceMappingURL=AssignmentDepartmentStepPresentation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AssignmentDepartmentStepPresentation.js","sources":["../../../../../../src/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentDepartmentStepPresentation.tsx"],"sourcesContent":["import { z } from 'zod'\nimport { useForm, FormProvider } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { useTranslation } from 'react-i18next'\nimport type { Department } from '@gusto/embedded-api/models/components/department'\nimport type { PayScheduleShow } from '@gusto/embedded-api/models/components/payschedulelistitem'\nimport { scheduleLabel } from './scheduleLabel'\nimport { Flex, SelectField, ActionsLayout } from '@/components/Common'\nimport { Form } from '@/components/Common/Form'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\nconst DepartmentStepSchema = z.object({\n defaultPayScheduleUuid: z.string().min(1),\n payScheduleByDepartment: z.record(z.string(), z.string().min(1)),\n})\n\n/** @internal */\nexport type DepartmentSelection = {\n defaultPayScheduleUuid: string\n departments: { departmentUuid: string; payScheduleUuid: string }[]\n}\n\n/** @internal */\nexport interface AssignmentDepartmentStepPresentationProps {\n departments: Department[]\n schedules: PayScheduleShow[]\n selection: DepartmentSelection\n onBack: (selection: DepartmentSelection) => void\n onAddPaySchedule: (selection: DepartmentSelection) => void\n onContinue: (selection: DepartmentSelection) => void\n}\n\n/** @internal */\nexport function AssignmentDepartmentStepPresentation({\n departments,\n schedules,\n selection,\n onBack,\n onAddPaySchedule,\n onContinue,\n}: AssignmentDepartmentStepPresentationProps) {\n const { t } = useTranslation('Company.Management.PayScheduleAssignment')\n const Components = useComponentContext()\n const formMethods = useForm<z.infer<typeof DepartmentStepSchema>>({\n resolver: zodResolver(DepartmentStepSchema),\n shouldUnregister: true,\n defaultValues: {\n defaultPayScheduleUuid: selection.defaultPayScheduleUuid,\n payScheduleByDepartment: Object.fromEntries(\n selection.departments.map(entry => [entry.departmentUuid, entry.payScheduleUuid]),\n ),\n },\n })\n const toSelection = (values: z.infer<typeof DepartmentStepSchema>): DepartmentSelection => ({\n defaultPayScheduleUuid: values.defaultPayScheduleUuid,\n departments: departments.flatMap(department =>\n department.uuid\n ? [\n {\n departmentUuid: department.uuid,\n payScheduleUuid: values.payScheduleByDepartment[department.uuid] ?? '',\n },\n ]\n : [],\n ),\n })\n const handleSubmit = formMethods.handleSubmit(values => {\n onContinue(toSelection(values))\n })\n const options = schedules.map(schedule => ({\n value: schedule.uuid,\n label: scheduleLabel(schedule),\n }))\n\n return (\n <FormProvider {...formMethods}>\n <Form onSubmit={() => void handleSubmit()}>\n <Flex flexDirection=\"column\" gap={32}>\n <Components.Heading as=\"h2\">{t('departmentStep.heading')}</Components.Heading>\n <Flex flexDirection=\"column\" gap={12}>\n {departments.map(department => (\n <SelectField\n key={department.uuid}\n name={`payScheduleByDepartment.${department.uuid}`}\n defaultValue={\n selection.departments.find(entry => entry.departmentUuid === department.uuid)\n ?.payScheduleUuid ?? ''\n }\n label={department.title ?? t('departmentStep.unnamedDepartment')}\n isRequired\n placeholder=\"\"\n options={options}\n />\n ))}\n <SelectField\n name=\"defaultPayScheduleUuid\"\n label={t('departmentStep.defaultPayScheduleLabel')}\n description={t('departmentStep.defaultPayScheduleDescription')}\n isRequired\n placeholder=\"\"\n options={options}\n />\n <div>\n <Components.Button\n variant=\"secondary\"\n onClick={() => {\n onAddPaySchedule(toSelection(formMethods.getValues()))\n }}\n >\n {t('departmentStep.addPayScheduleCta')}\n </Components.Button>\n </div>\n </Flex>\n <ActionsLayout>\n <Components.Button\n variant=\"secondary\"\n onClick={() => {\n onBack(toSelection(formMethods.getValues()))\n }}\n >\n {t('backCta')}\n </Components.Button>\n <Components.Button variant=\"primary\" type=\"submit\" isDisabled={schedules.length === 0}>\n {t('continueCta')}\n </Components.Button>\n </ActionsLayout>\n </Flex>\n </Form>\n </FormProvider>\n )\n}\n"],"names":["DepartmentStepSchema","z","AssignmentDepartmentStepPresentation","departments","schedules","selection","onBack","onAddPaySchedule","onContinue","t","useTranslation","Components","useComponentContext","formMethods","useForm","zodResolver","entry","toSelection","values","department","handleSubmit","options","schedule","scheduleLabel","FormProvider","jsx","Form","jsxs","Flex","SelectField","ActionsLayout"],"mappings":";;;;;;;;;;;AAWA,MAAMA,IAAuBC,EAAE,OAAO;AAAA,EACpC,wBAAwBA,EAAE,SAAS,IAAI,CAAC;AAAA,EACxC,yBAAyBA,EAAE,OAAOA,EAAE,UAAUA,EAAE,OAAA,EAAS,IAAI,CAAC,CAAC;AACjE,CAAC;AAmBM,SAASC,EAAqC;AAAA,EACnD,aAAAC;AAAA,EACA,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,QAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,YAAAC;AACF,GAA8C;AAC5C,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,0CAA0C,GACjEC,IAAaC,EAAA,GACbC,IAAcC,EAA8C;AAAA,IAChE,UAAUC,EAAYf,CAAoB;AAAA,IAC1C,kBAAkB;AAAA,IAClB,eAAe;AAAA,MACb,wBAAwBK,EAAU;AAAA,MAClC,yBAAyB,OAAO;A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