@gusto/embedded-react-sdk 0.44.0 → 0.44.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/components/Base/useBaseSubmit.js +6 -6
  3. package/dist/components/Base/useBaseSubmit.js.map +1 -1
  4. package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js +1 -1
  5. package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js +1 -1
  6. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +1 -1
  7. package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js +1 -1
  8. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +1 -1
  9. package/dist/components/Company/AssignSignatory/TitleSelect.js +1 -1
  10. package/dist/components/Company/AssignSignatory/useAssignSignatory.js +1 -1
  11. package/dist/components/Company/BankAccount/BankAccountForm/Actions.js +1 -1
  12. package/dist/components/Company/BankAccount/BankAccountForm/context.js +1 -1
  13. package/dist/components/Company/BankAccount/BankAccountList/Actions.js +1 -1
  14. package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js +1 -1
  15. package/dist/components/Company/DocumentSigner/DocumentList/Actions.js +1 -1
  16. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js +9 -9
  17. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  18. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +1 -1
  19. package/dist/components/Company/FederalTaxes/Actions.js +1 -1
  20. package/dist/components/Company/FederalTaxes/useFederalTaxes.js +1 -1
  21. package/dist/components/Company/Industry/Actions.js +1 -1
  22. package/dist/components/Company/Industry/Context.js +1 -1
  23. package/dist/components/Company/Industry/Edit.js +1 -1
  24. package/dist/components/Company/Locations/LocationForm/Actions.js +1 -1
  25. package/dist/components/Company/Locations/LocationForm/useLocationForm.js +1 -1
  26. package/dist/components/Company/Locations/LocationsList/Actions.js +1 -1
  27. package/dist/components/Company/Locations/LocationsList/List.js +1 -1
  28. package/dist/components/Company/Locations/LocationsList/useLocationsList.js +1 -1
  29. package/dist/components/Company/OnboardingOverview/context.js +1 -1
  30. package/dist/components/Company/PaySchedule/PaySchedule.d.ts +2 -2
  31. package/dist/components/Company/PaySchedule/PaySchedule.js +6 -6
  32. package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
  33. package/dist/components/Company/PaySchedule/PayScheduleList.js +8 -8
  34. package/dist/components/Company/PaySchedule/PayScheduleList.js.map +1 -1
  35. package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/usePayScheduleForm.d.ts +3 -3
  36. package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/usePayScheduleForm.js +12 -12
  37. package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/usePayScheduleForm.js.map +1 -1
  38. package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js +1 -1
  39. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +1 -1
  40. package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js +1 -1
  41. package/dist/components/Company/StateTaxes/StateTaxesList/context.js +1 -1
  42. package/dist/components/Contractor/Address/Address.js +16 -16
  43. package/dist/components/Contractor/Address/Address.js.map +1 -1
  44. package/dist/components/Contractor/Address/Form.js +4 -4
  45. package/dist/components/Contractor/Address/useAddress.js +1 -1
  46. package/dist/components/Contractor/PaymentMethod/PaymentMethod.js +8 -8
  47. package/dist/components/Contractor/PaymentMethod/PaymentMethod.js.map +1 -1
  48. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js +1 -1
  49. package/dist/components/Contractor/Payments/PaymentsList/PaymentsList.js +5 -5
  50. package/dist/components/Contractor/Payments/PaymentsList/PaymentsList.js.map +1 -1
  51. package/dist/components/Contractor/Profile/useContractorProfile.js +1 -1
  52. package/dist/components/Contractor/Submit/Submit.js +22 -20
  53. package/dist/components/Contractor/Submit/Submit.js.map +1 -1
  54. package/dist/components/Employee/Dashboard/hooks/useEmployeeCompensation.d.ts +1 -1
  55. package/dist/components/Employee/Dashboard/hooks/useEmployeeCompensation.js +6 -6
  56. package/dist/components/Employee/Dashboard/hooks/useEmployeeCompensation.js.map +1 -1
  57. package/dist/components/Employee/Dashboard/hooks/useEmployeeForms.js +3 -3
  58. package/dist/components/Employee/Dashboard/hooks/useEmployeeForms.js.map +1 -1
  59. package/dist/components/Employee/Deductions/Deductions.js +7 -7
  60. package/dist/components/Employee/Deductions/Deductions.js.map +1 -1
  61. package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js +24 -24
  62. package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js.map +1 -1
  63. package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js +13 -9
  64. package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js.map +1 -1
  65. package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.js +2 -2
  66. package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.js.map +1 -1
  67. package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.d.ts +1 -2
  68. package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js +17 -17
  69. package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js.map +1 -1
  70. package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js +30 -30
  71. package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js.map +1 -1
  72. package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js +1 -1
  73. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js +8 -8
  74. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  75. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +1 -1
  76. package/dist/components/Employee/DocumentSigner/DocumentSigner.js +1 -1
  77. package/dist/components/Employee/DocumentSigner/DocumentSigner.js.map +1 -1
  78. package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilityPresentation.js +12 -12
  79. package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilityPresentation.js.map +1 -1
  80. package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilitySchema.js +1 -1
  81. package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilitySchema.js.map +1 -1
  82. package/dist/components/Employee/FederalTaxes/management/FederalTaxes.js +1 -1
  83. package/dist/components/Employee/FederalTaxes/onboarding/FederalTaxes.js +1 -1
  84. package/dist/components/Employee/PaymentMethod/Actions.js +1 -1
  85. package/dist/components/Employee/PaymentMethod/BankAccountEdit.js +1 -1
  86. package/dist/components/Employee/PaymentMethod/BankAccountsList.js +1 -1
  87. package/dist/components/Employee/PaymentMethod/PaymentMethod.js +14 -14
  88. package/dist/components/Employee/PaymentMethod/PaymentMethod.js.map +1 -1
  89. package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js +1 -1
  90. package/dist/components/Employee/PaymentMethod/Split.js +1 -1
  91. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +1 -1
  92. package/dist/components/Employee/Profile/management/Profile.js +1 -1
  93. package/dist/components/Employee/Profile/onboarding/AdminProfile.js +1 -1
  94. package/dist/components/Employee/Profile/onboarding/EmployeeProfile.js +1 -1
  95. package/dist/components/Employee/StateTaxes/management/StateTaxes.js +1 -1
  96. package/dist/components/Employee/StateTaxes/onboarding/StateTaxes.js +1 -1
  97. package/dist/components/Employee/StateTaxes/shared/EmployeeStateTaxesView.js +19 -17
  98. package/dist/components/Employee/StateTaxes/shared/EmployeeStateTaxesView.js.map +1 -1
  99. package/dist/components/Employee/StateTaxes/shared/EmployeeStateTaxesView.module.scss.js +8 -0
  100. package/dist/components/Employee/StateTaxes/shared/EmployeeStateTaxesView.module.scss.js.map +1 -0
  101. package/dist/components/Employee/Taxes/Actions.js +1 -1
  102. package/dist/components/Employee/Taxes/FederalForm.js +1 -1
  103. package/dist/components/Employee/Taxes/useTaxes.js +1 -1
  104. package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployee.js +11 -11
  105. package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployee.js.map +1 -1
  106. package/dist/components/Employee/Terminations/TerminationSummary/TerminationSummary.js +3 -3
  107. package/dist/components/Employee/Terminations/TerminationSummary/TerminationSummary.js.map +1 -1
  108. package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.js +40 -45
  109. package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.js.map +1 -1
  110. package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.js +1 -1
  111. package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.js.map +1 -1
  112. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js +17 -17
  113. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js.map +1 -1
  114. package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelection.js +7 -7
  115. package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelection.js.map +1 -1
  116. package/dist/components/Payroll/GrossUpModal/GrossUpModal.js +1 -1
  117. package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.js +1 -1
  118. package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelectionPresentation.js +1 -1
  119. package/dist/components/Payroll/OffCycleTaxWithholdingModal/OffCycleTaxWithholdingModal.js +1 -1
  120. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js +10 -10
  121. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js.map +1 -1
  122. package/dist/components/Payroll/PayrollBlocker/payrollHelpers.d.ts +2 -2
  123. package/dist/components/Payroll/PayrollBlocker/payrollHelpers.js +21 -25
  124. package/dist/components/Payroll/PayrollBlocker/payrollHelpers.js.map +1 -1
  125. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.d.ts +1 -1
  126. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
  127. package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.d.ts +2 -2
  128. package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js +1 -1
  129. package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js.map +1 -1
  130. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js +4 -4
  131. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js.map +1 -1
  132. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.d.ts +1 -1
  133. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
  134. package/dist/components/Payroll/PayrollList/PayrollList.js +4 -4
  135. package/dist/components/Payroll/PayrollList/PayrollList.js.map +1 -1
  136. package/dist/components/Payroll/PayrollList/PayrollListPresentation.d.ts +2 -2
  137. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
  138. package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.js +5 -5
  139. package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.js.map +1 -1
  140. package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/RecoveryCasesResubmit.js +1 -1
  141. package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/RecoveryCasesResubmit.js.map +1 -1
  142. package/dist/components/Payroll/TransitionCreation/TransitionCreation.js +7 -7
  143. package/dist/components/Payroll/TransitionCreation/TransitionCreation.js.map +1 -1
  144. package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlert.d.ts +1 -1
  145. package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlert.js +70 -53
  146. package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlert.js.map +1 -1
  147. package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlertPresentation.d.ts +1 -1
  148. package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlertPresentation.js.map +1 -1
  149. package/dist/components/Payroll/helpers.d.ts +1 -1
  150. package/dist/components/Payroll/helpers.js.map +1 -1
  151. package/dist/components/Payroll/usePreparedPayrollData.d.ts +2 -2
  152. package/dist/components/Payroll/usePreparedPayrollData.js +10 -10
  153. package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
  154. package/dist/components/TimeOff/HolidayPolicyDetail/HolidayPolicyDetailPresentation.js +1 -1
  155. package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesTimeOff.js +41 -41
  156. package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesTimeOff.js.map +1 -1
  157. package/dist/components/TimeOff/shared/EmployeeTable/EmployeeTable.js +1 -1
  158. package/dist/components/TimeOff/shared/PolicyDetailLayout/PolicyDetailLayout.js +1 -1
  159. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +1 -1
  160. package/dist/helpers/dateFormatting.js +52 -56
  161. package/dist/helpers/dateFormatting.js.map +1 -1
  162. package/dist/partner-hook-utils/form/fields/CheckboxHookField.js +1 -1
  163. package/dist/partner-hook-utils/form/fields/NumberInputHookField.js +1 -1
  164. package/dist/partner-hook-utils/form/fields/RadioGroupHookField.js +1 -1
  165. package/dist/partner-hook-utils/form/fields/SelectHookField.js +1 -1
  166. package/dist/partner-hook-utils/form/fields/SwitchHookField.js +1 -1
  167. package/dist/partner-hook-utils/form/fields/TextInputHookField.js +1 -1
  168. package/dist/style.css +1 -1
  169. package/dist/test-utils/assertions.d.ts +4 -0
  170. package/package.json +13 -10
@@ -3,9 +3,9 @@ import { useRef as $, useCallback as u, useMemo as y, useState as T } from "reac
3
3
  import { useTimeOffPoliciesAddEmployeesMutation as J } from "@gusto/embedded-api/react-query/timeOffPoliciesAddEmployees";
4
4
  import { useTimeOffPoliciesRemoveEmployeesMutation as X } from "@gusto/embedded-api/react-query/timeOffPoliciesRemoveEmployees";
5
5
  import { useTimeOffPoliciesGetSuspense as Z } from "@gusto/embedded-api/react-query/timeOffPoliciesGet";
6
- import { UnprocessableEntityErrorObject as ee } from "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
7
- import { useQueryClient as te } from "@tanstack/react-query";
8
- import { useTranslation as ne } from "react-i18next";
6
+ import { UnprocessableEntityError as ee } from "@gusto/embedded-api/models/errors/unprocessableentityerror";
7
+ import { useQueryClient as ne } from "@tanstack/react-query";
8
+ import { useTranslation as te } from "react-i18next";
9
9
  import { SelectEmployeesPresentation as oe } from "./SelectEmployeesPresentation.js";
10
10
  import { useSelectEmployeesData as re } from "./useSelectEmployeesData.js";
11
11
  import { useBase as se } from "../../../Base/useBase.js";
@@ -18,14 +18,14 @@ const ce = {
18
18
  };
19
19
  function R(a, l) {
20
20
  if (!a) return;
21
- const r = ce[l], n = a.eligiblePaidTimeOff?.find((f) => f.name === r)?.accrualBalance;
22
- return n && n.length > 0 ? n : void 0;
21
+ const r = ce[l], t = a.eligiblePaidTimeOff?.find((f) => f.name === r)?.accrualBalance;
22
+ return t && t.length > 0 ? t : void 0;
23
23
  }
24
24
  function le(a, l) {
25
25
  const r = {};
26
26
  for (const m of a) {
27
- const n = R(m, l);
28
- n && (r[m.uuid] = n);
27
+ const t = R(m, l);
28
+ t && (r[m.uuid] = t);
29
29
  }
30
30
  return r;
31
31
  }
@@ -42,7 +42,7 @@ function me(a) {
42
42
  for (const i of r.employees)
43
43
  i.uuid && f.add(i.uuid);
44
44
  return f;
45
- }, [r.employees]), n = y(() => {
45
+ }, [r.employees]), t = y(() => {
46
46
  const f = {};
47
47
  for (const i of r.employees)
48
48
  i.uuid && (f[i.uuid] = i.balance ?? "0");
@@ -54,7 +54,7 @@ function me(a) {
54
54
  ...a,
55
55
  mode: "standalone",
56
56
  originalUuids: m,
57
- originalBalances: n
57
+ originalBalances: t
58
58
  }
59
59
  );
60
60
  }
@@ -63,11 +63,11 @@ function F({
63
63
  policyId: l,
64
64
  policyType: r,
65
65
  mode: m = "standalone",
66
- originalUuids: n,
66
+ originalUuids: t,
67
67
  originalBalances: f
68
68
  }) {
69
69
  ie("Company.TimeOff.SelectEmployees");
70
- const { t: i } = ne("Company.TimeOff.SelectEmployees"), { onEvent: d, baseSubmitHandler: P } = se(), _ = te(), {
70
+ const { t: i } = te("Company.TimeOff.SelectEmployees"), { onEvent: d, baseSubmitHandler: P } = se(), _ = ne(), {
71
71
  filteredEmployees: C,
72
72
  selectedUuids: c,
73
73
  searchValue: L,
@@ -77,16 +77,16 @@ function F({
77
77
  handleSelectAll: b,
78
78
  handleSearchChange: N,
79
79
  handleSearchClear: Y
80
- } = re(a, n), p = $(/* @__PURE__ */ new Map()), x = u(
81
- (e, t) => {
82
- t ? p.current.set(e.uuid, e) : p.current.delete(e.uuid), w(e, t);
80
+ } = re(a, t), p = $(/* @__PURE__ */ new Map()), x = u(
81
+ (e, n) => {
82
+ n ? p.current.set(e.uuid, e) : p.current.delete(e.uuid), w(e, n);
83
83
  },
84
84
  [w]
85
85
  ), k = u(
86
- (e, t) => {
87
- for (const o of t)
86
+ (e, n) => {
87
+ for (const o of n)
88
88
  e ? p.current.set(o.uuid, o) : p.current.delete(o.uuid);
89
- b(e, t);
89
+ b(e, n);
90
90
  },
91
91
  [b]
92
92
  ), B = y(
@@ -95,26 +95,26 @@ function F({
95
95
  ), [h, z] = T({}), H = y(
96
96
  () => ({ ...B, ...h }),
97
97
  [B, h]
98
- ), { mutateAsync: A } = J(), { mutateAsync: D, isPending: V } = X(), [W, v] = T(!1), j = u((e, t) => {
99
- z((o) => ({ ...o, [e]: t }));
98
+ ), { mutateAsync: A } = J(), { mutateAsync: D, isPending: V } = X(), [W, v] = T(!1), K = u((e, n) => {
99
+ z((o) => ({ ...o, [e]: n }));
100
100
  }, []), M = u(
101
- (e) => e.map((t) => {
102
- const o = h[t], s = R(
103
- p.current.get(t),
101
+ (e) => e.map((n) => {
102
+ const o = h[n], s = R(
103
+ p.current.get(n),
104
104
  r
105
105
  ), O = o && o.length > 0 ? o : s;
106
- return O ? { uuid: t, balance: O } : { uuid: t };
106
+ return O ? { uuid: n, balance: O } : { uuid: n };
107
107
  }),
108
108
  [h, r]
109
109
  ), E = u(
110
- async (e, t) => {
110
+ async (e, n) => {
111
111
  await P({}, async () => {
112
- if (t.length > 0)
112
+ if (n.length > 0)
113
113
  try {
114
114
  await D({
115
115
  request: {
116
116
  timeOffPolicyUuid: l,
117
- requestBody: { employees: t.map((s) => ({ uuid: s })) }
117
+ requestBody: { employees: n.map((s) => ({ uuid: s })) }
118
118
  }
119
119
  });
120
120
  } catch (s) {
@@ -148,15 +148,15 @@ function F({
148
148
  d,
149
149
  i
150
150
  ]
151
- ), K = u(async () => {
151
+ ), Q = u(async () => {
152
152
  if (m === "wizard") {
153
153
  d(S.TIME_OFF_ADD_EMPLOYEES_DONE, {
154
154
  employeeUuids: [...c]
155
155
  });
156
156
  return;
157
157
  }
158
- const e = n ?? /* @__PURE__ */ new Set(), t = [...c].filter((s) => !e.has(s)), o = [...e].filter((s) => !c.has(s));
159
- if (t.length === 0 && o.length === 0) {
158
+ const e = t ?? /* @__PURE__ */ new Set(), n = [...c].filter((s) => !e.has(s)), o = [...e].filter((s) => !c.has(s));
159
+ if (n.length === 0 && o.length === 0) {
160
160
  d(S.TIME_OFF_ADD_EMPLOYEES_DONE);
161
161
  return;
162
162
  }
@@ -164,16 +164,16 @@ function F({
164
164
  v(!0);
165
165
  return;
166
166
  }
167
- await E(t, o);
168
- }, [m, n, c, d, E]), Q = u(async () => {
169
- const e = n ?? /* @__PURE__ */ new Set(), t = [...c].filter((s) => !e.has(s)), o = [...e].filter((s) => !c.has(s));
170
- v(!1), await E(t, o);
171
- }, [n, c, E]), G = y(() => {
172
- if (!n) return 0;
167
+ await E(n, o);
168
+ }, [m, t, c, d, E]), j = u(async () => {
169
+ const e = t ?? /* @__PURE__ */ new Set(), n = [...c].filter((s) => !e.has(s)), o = [...e].filter((s) => !c.has(s));
170
+ v(!1), await E(n, o);
171
+ }, [t, c, E]), G = y(() => {
172
+ if (!t) return 0;
173
173
  let e = 0;
174
- for (const t of n) c.has(t) || (e += 1);
174
+ for (const n of t) c.has(n) || (e += 1);
175
175
  return e;
176
- }, [n, c]), U = u(() => {
176
+ }, [t, c]), U = u(() => {
177
177
  d(S.CANCEL);
178
178
  }, [d]);
179
179
  return /* @__PURE__ */ g(
@@ -187,20 +187,20 @@ function F({
187
187
  onSearchChange: N,
188
188
  onSearchClear: Y,
189
189
  onBack: U,
190
- onContinue: K,
190
+ onContinue: Q,
191
191
  showReassignmentWarning: !0,
192
192
  policyTypeLabel: i(`policyTypeLabel_${r}`),
193
193
  balances: H,
194
- onBalanceChange: j,
194
+ onBalanceChange: K,
195
195
  pagination: I,
196
196
  isFetching: q,
197
- originallyOnPolicyUuids: n,
197
+ originallyOnPolicyUuids: t,
198
198
  originalBalances: f,
199
199
  removeConfirmDialog: m === "standalone" ? {
200
200
  isOpen: W,
201
201
  count: G,
202
202
  onConfirm: () => {
203
- Q();
203
+ j();
204
204
  },
205
205
  onClose: () => {
206
206
  v(!1);
@@ -1 +1 @@
1
- {"version":3,"file":"SelectEmployeesTimeOff.js","sources":["../../../../../src/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesTimeOff.tsx"],"sourcesContent":["import { useCallback, useMemo, useRef, useState } from 'react'\nimport { useTimeOffPoliciesAddEmployeesMutation } from '@gusto/embedded-api/react-query/timeOffPoliciesAddEmployees'\nimport { useTimeOffPoliciesRemoveEmployeesMutation } from '@gusto/embedded-api/react-query/timeOffPoliciesRemoveEmployees'\nimport { useTimeOffPoliciesGetSuspense } from '@gusto/embedded-api/react-query/timeOffPoliciesGet'\nimport { UnprocessableEntityErrorObject } from '@gusto/embedded-api/models/errors/unprocessableentityerrorobject'\nimport { useQueryClient } from '@tanstack/react-query'\nimport { useTranslation } from 'react-i18next'\nimport type { CreatableTimeOffPolicyType } from '../../TimeOffFlow/timeOffPolicyTypes'\nimport { SelectEmployeesPresentation } from './SelectEmployeesPresentation'\nimport { useSelectEmployeesData } from './useSelectEmployeesData'\nimport type { EmployeeItem } from './SelectEmployeesPresentationTypes'\nimport { useBase } from '@/components/Base/useBase'\nimport { SDKInternalError } from '@/types/sdkError'\nimport { componentEvents } from '@/shared/constants'\nimport { useI18n } from '@/i18n'\n\ninterface SelectEmployeesTimeOffProps {\n companyId: string\n policyId: string\n policyType: CreatableTimeOffPolicyType\n mode?: 'standalone' | 'wizard'\n}\n\nconst PAID_TIME_OFF_NAME_BY_POLICY_TYPE: Record<CreatableTimeOffPolicyType, string> = {\n vacation: 'Vacation Hours',\n sick: 'Sick Hours',\n}\n\nfunction extractCarryOverBalance(\n employee: EmployeeItem | undefined,\n policyType: CreatableTimeOffPolicyType,\n): string | undefined {\n if (!employee) return undefined\n const targetName = PAID_TIME_OFF_NAME_BY_POLICY_TYPE[policyType]\n const matching = employee.eligiblePaidTimeOff?.find(pto => pto.name === targetName)\n const balance = matching?.accrualBalance\n return balance && balance.length > 0 ? balance : undefined\n}\n\nfunction deriveCarryOverBalances(\n employees: EmployeeItem[],\n policyType: CreatableTimeOffPolicyType,\n): Record<string, string> {\n const map: Record<string, string> = {}\n for (const employee of employees) {\n const balance = extractCarryOverBalance(employee, policyType)\n if (balance) {\n map[employee.uuid] = balance\n }\n }\n return map\n}\n\nexport function SelectEmployeesTimeOff(props: SelectEmployeesTimeOffProps) {\n if (props.mode === 'wizard') {\n return <SelectEmployeesTimeOffInner {...props} mode=\"wizard\" />\n }\n return <StandaloneLoader {...props} />\n}\n\nfunction StandaloneLoader(props: SelectEmployeesTimeOffProps) {\n const { data: policyResponse } = useTimeOffPoliciesGetSuspense({\n timeOffPolicyUuid: props.policyId,\n })\n const policy = policyResponse.timeOffPolicy\n if (!policy) throw new Error('Unexpected response: missing timeOffPolicy')\n\n const originalUuids = useMemo(() => {\n const set = new Set<string>()\n for (const e of policy.employees) {\n if (e.uuid) set.add(e.uuid)\n }\n return set\n }, [policy.employees])\n\n const originalBalances = useMemo(() => {\n const map: Record<string, string> = {}\n for (const e of policy.employees) {\n if (e.uuid) map[e.uuid] = e.balance ?? '0'\n }\n return map\n }, [policy.employees])\n\n return (\n <SelectEmployeesTimeOffInner\n {...props}\n mode=\"standalone\"\n originalUuids={originalUuids}\n originalBalances={originalBalances}\n />\n )\n}\n\ninterface InnerProps extends SelectEmployeesTimeOffProps {\n originalUuids?: Set<string>\n originalBalances?: Record<string, string>\n}\n\nfunction SelectEmployeesTimeOffInner({\n companyId,\n policyId,\n policyType,\n mode = 'standalone',\n originalUuids,\n originalBalances,\n}: InnerProps) {\n useI18n('Company.TimeOff.SelectEmployees')\n const { t } = useTranslation('Company.TimeOff.SelectEmployees')\n const { onEvent, baseSubmitHandler } = useBase()\n const queryClient = useQueryClient()\n const {\n filteredEmployees,\n selectedUuids,\n searchValue,\n pagination,\n isFetching,\n handleSelect,\n handleSelectAll,\n handleSearchChange,\n handleSearchClear,\n } = useSelectEmployeesData(companyId, originalUuids)\n\n // Captures the full Employee record at the moment a row is selected so\n // their carry-over balance is still available at submit time even if the\n // user has since searched/paginated the row out of view. Without this,\n // `selectedUuids` would point at UUIDs we no longer have data for.\n const selectedEmployeesRef = useRef(new Map<string, EmployeeItem>())\n\n const handleSelectWithCapture = useCallback(\n (item: EmployeeItem, checked: boolean) => {\n if (checked) {\n selectedEmployeesRef.current.set(item.uuid, item)\n } else {\n selectedEmployeesRef.current.delete(item.uuid)\n }\n handleSelect(item, checked)\n },\n [handleSelect],\n )\n\n const handleSelectAllWithCapture = useCallback(\n (checked: boolean, visibleItems: EmployeeItem[]) => {\n for (const item of visibleItems) {\n if (checked) {\n selectedEmployeesRef.current.set(item.uuid, item)\n } else {\n selectedEmployeesRef.current.delete(item.uuid)\n }\n }\n handleSelectAll(checked, visibleItems)\n },\n [handleSelectAll],\n )\n\n const carryOverBalances = useMemo(\n () => deriveCarryOverBalances(filteredEmployees, policyType),\n [filteredEmployees, policyType],\n )\n\n const [balances, setBalances] = useState<Record<string, string>>({})\n\n const effectiveBalances = useMemo<Record<string, string>>(\n () => ({ ...carryOverBalances, ...balances }),\n [carryOverBalances, balances],\n )\n\n const { mutateAsync: addEmployees } = useTimeOffPoliciesAddEmployeesMutation()\n const { mutateAsync: removeEmployees, isPending: isRemovePending } =\n useTimeOffPoliciesRemoveEmployeesMutation()\n\n const [confirmRemoveOpen, setConfirmRemoveOpen] = useState(false)\n\n const handleBalanceChange = useCallback((uuid: string, value: string) => {\n setBalances(prev => ({ ...prev, [uuid]: value }))\n }, [])\n\n const buildAddPayload = useCallback(\n (uuids: string[]) =>\n uuids.map(uuid => {\n const userValue = balances[uuid]\n const carryOver = extractCarryOverBalance(\n selectedEmployeesRef.current.get(uuid),\n policyType,\n )\n // Per design review: do not zero out balances accidentally.\n // Prefer user input → fall back to carry-over → omit `balance`\n // entirely (backend defaults the row to 0) when neither is set.\n const balance = userValue && userValue.length > 0 ? userValue : carryOver\n return balance ? { uuid, balance } : { uuid }\n }),\n [balances, policyType],\n )\n\n const submitDiff = useCallback(\n async (toAdd: string[], toRemove: string[]) => {\n await baseSubmitHandler({}, async () => {\n if (toRemove.length > 0) {\n try {\n await removeEmployees({\n request: {\n timeOffPolicyUuid: policyId,\n requestBody: { employees: toRemove.map(uuid => ({ uuid })) },\n },\n })\n } catch (err) {\n if (err instanceof UnprocessableEntityErrorObject) {\n const apiMessage = err.errors[0]?.message ?? ''\n throw new SDKInternalError(\n t('errors.removeEmployeesFailed', { details: apiMessage }),\n 'api_error',\n )\n }\n throw err\n }\n }\n let policyResult: unknown\n if (toAdd.length > 0) {\n const response = await addEmployees({\n request: {\n timeOffPolicyUuid: policyId,\n requestBody: { employees: buildAddPayload(toAdd) },\n },\n })\n policyResult = response.timeOffPolicy\n }\n void queryClient.invalidateQueries({\n queryKey: ['@gusto/embedded-api', 'timeOffPolicies', 'get'],\n })\n onEvent(componentEvents.TIME_OFF_ADD_EMPLOYEES_DONE, policyResult)\n })\n },\n [\n baseSubmitHandler,\n removeEmployees,\n addEmployees,\n buildAddPayload,\n policyId,\n queryClient,\n onEvent,\n t,\n ],\n )\n\n const handleContinue = useCallback(async () => {\n if (mode === 'wizard') {\n onEvent(componentEvents.TIME_OFF_ADD_EMPLOYEES_DONE, {\n employeeUuids: [...selectedUuids],\n })\n return\n }\n\n const original = originalUuids ?? new Set<string>()\n const toAdd = [...selectedUuids].filter(uuid => !original.has(uuid))\n const toRemove = [...original].filter(uuid => !selectedUuids.has(uuid))\n\n if (toAdd.length === 0 && toRemove.length === 0) {\n onEvent(componentEvents.TIME_OFF_ADD_EMPLOYEES_DONE)\n return\n }\n\n if (toRemove.length > 0) {\n setConfirmRemoveOpen(true)\n return\n }\n\n await submitDiff(toAdd, toRemove)\n }, [mode, originalUuids, selectedUuids, onEvent, submitDiff])\n\n const handleConfirmRemove = useCallback(async () => {\n const original = originalUuids ?? new Set<string>()\n const toAdd = [...selectedUuids].filter(uuid => !original.has(uuid))\n const toRemove = [...original].filter(uuid => !selectedUuids.has(uuid))\n setConfirmRemoveOpen(false)\n await submitDiff(toAdd, toRemove)\n }, [originalUuids, selectedUuids, submitDiff])\n\n const removeCount = useMemo(() => {\n if (!originalUuids) return 0\n let count = 0\n for (const uuid of originalUuids) if (!selectedUuids.has(uuid)) count += 1\n return count\n }, [originalUuids, selectedUuids])\n\n const handleBack = useCallback(() => {\n onEvent(componentEvents.CANCEL)\n }, [onEvent])\n\n return (\n <SelectEmployeesPresentation\n employees={filteredEmployees}\n selectedUuids={selectedUuids}\n searchValue={searchValue}\n onSelect={handleSelectWithCapture}\n onSelectAll={handleSelectAllWithCapture}\n onSearchChange={handleSearchChange}\n onSearchClear={handleSearchClear}\n onBack={handleBack}\n onContinue={handleContinue}\n showReassignmentWarning\n policyTypeLabel={t(`policyTypeLabel_${policyType}`)}\n balances={effectiveBalances}\n onBalanceChange={handleBalanceChange}\n pagination={pagination}\n isFetching={isFetching}\n originallyOnPolicyUuids={originalUuids}\n originalBalances={originalBalances}\n removeConfirmDialog={\n mode === 'standalone'\n ? {\n isOpen: confirmRemoveOpen,\n count: removeCount,\n onConfirm: () => {\n void handleConfirmRemove()\n },\n onClose: () => {\n setConfirmRemoveOpen(false)\n },\n isPending: isRemovePending,\n }\n : undefined\n }\n />\n )\n}\n"],"names":["PAID_TIME_OFF_NAME_BY_POLICY_TYPE","extractCarryOverBalance","employee","policyType","targetName","balance","pto","deriveCarryOverBalances","employees","map","SelectEmployeesTimeOff","props","jsx","SelectEmployeesTimeOffInner","StandaloneLoader","policyResponse","useTimeOffPoliciesGetSuspense","policy","originalUuids","useMemo","set","e","originalBalances","companyId","policyId","mode","useI18n","t","useTranslation","onEvent","baseSubmitHandler","useBase","queryClient","useQueryClient","filteredEmployees","selectedUuids","searchValue","pagination","isFetching","handleSelect","handleSelectAll","handleSearchChange","handleSearchClear","useSelectEmployeesData","selectedEmployeesRef","useRef","handleSelectWithCapture","useCallback","item","checked","handleSelectAllWithCapture","visibleItems","carryOverBalances","balances","setBalances","useState","effectiveBalances","addEmployees","useTimeOffPoliciesAddEmployeesMutation","removeEmployees","isRemovePending","useTimeOffPoliciesRemoveEmployeesMutation","confirmRemoveOpen","setConfirmRemoveOpen","handleBalanceChange","uuid","value","prev","buildAddPayload","uuids","userValue","carryOver","submitDiff","toAdd","toRemove","err","UnprocessableEntityErrorObject","apiMessage","SDKInternalError","policyResult","componentEvents","handleContinue","original","handleConfirmRemove","removeCount","count","handleBack","SelectEmployeesPresentation"],"mappings":";;;;;;;;;;;;;;AAuBA,MAAMA,KAAgF;AAAA,EACpF,UAAU;AAAA,EACV,MAAM;AACR;AAEA,SAASC,EACPC,GACAC,GACoB;AACpB,MAAI,CAACD,EAAU;AACf,QAAME,IAAaJ,GAAkCG,CAAU,GAEzDE,IADWH,EAAS,qBAAqB,KAAK,CAAAI,MAAOA,EAAI,SAASF,CAAU,GACxD;AAC1B,SAAOC,KAAWA,EAAQ,SAAS,IAAIA,IAAU;AACnD;AAEA,SAASE,GACPC,GACAL,GAC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AA;AAIZ;"}
1
+ {"version":3,"file":"SelectEmployeesTimeOff.js","sources":["../../../../../src/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesTimeOff.tsx"],"sourcesContent":["import { useCallback, useMemo, useRef, useState } from 'react'\nimport { useTimeOffPoliciesAddEmployeesMutation } from '@gusto/embedded-api/react-query/timeOffPoliciesAddEmployees'\nimport { useTimeOffPoliciesRemoveEmployeesMutation } from '@gusto/embedded-api/react-query/timeOffPoliciesRemoveEmployees'\nimport { useTimeOffPoliciesGetSuspense } from '@gusto/embedded-api/react-query/timeOffPoliciesGet'\nimport { UnprocessableEntityError } from '@gusto/embedded-api/models/errors/unprocessableentityerror'\nimport { useQueryClient } from '@tanstack/react-query'\nimport { useTranslation } from 'react-i18next'\nimport type { CreatableTimeOffPolicyType } from '../../TimeOffFlow/timeOffPolicyTypes'\nimport { SelectEmployeesPresentation } from './SelectEmployeesPresentation'\nimport { useSelectEmployeesData } from './useSelectEmployeesData'\nimport type { EmployeeItem } from './SelectEmployeesPresentationTypes'\nimport { useBase } from '@/components/Base/useBase'\nimport { SDKInternalError } from '@/types/sdkError'\nimport { componentEvents } from '@/shared/constants'\nimport { useI18n } from '@/i18n'\n\ninterface SelectEmployeesTimeOffProps {\n companyId: string\n policyId: string\n policyType: CreatableTimeOffPolicyType\n mode?: 'standalone' | 'wizard'\n}\n\nconst PAID_TIME_OFF_NAME_BY_POLICY_TYPE: Record<CreatableTimeOffPolicyType, string> = {\n vacation: 'Vacation Hours',\n sick: 'Sick Hours',\n}\n\nfunction extractCarryOverBalance(\n employee: EmployeeItem | undefined,\n policyType: CreatableTimeOffPolicyType,\n): string | undefined {\n if (!employee) return undefined\n const targetName = PAID_TIME_OFF_NAME_BY_POLICY_TYPE[policyType]\n const matching = employee.eligiblePaidTimeOff?.find(pto => pto.name === targetName)\n const balance = matching?.accrualBalance\n return balance && balance.length > 0 ? balance : undefined\n}\n\nfunction deriveCarryOverBalances(\n employees: EmployeeItem[],\n policyType: CreatableTimeOffPolicyType,\n): Record<string, string> {\n const map: Record<string, string> = {}\n for (const employee of employees) {\n const balance = extractCarryOverBalance(employee, policyType)\n if (balance) {\n map[employee.uuid] = balance\n }\n }\n return map\n}\n\nexport function SelectEmployeesTimeOff(props: SelectEmployeesTimeOffProps) {\n if (props.mode === 'wizard') {\n return <SelectEmployeesTimeOffInner {...props} mode=\"wizard\" />\n }\n return <StandaloneLoader {...props} />\n}\n\nfunction StandaloneLoader(props: SelectEmployeesTimeOffProps) {\n const { data: policyResponse } = useTimeOffPoliciesGetSuspense({\n timeOffPolicyUuid: props.policyId,\n })\n const policy = policyResponse.timeOffPolicy\n if (!policy) throw new Error('Unexpected response: missing timeOffPolicy')\n\n const originalUuids = useMemo(() => {\n const set = new Set<string>()\n for (const e of policy.employees) {\n if (e.uuid) set.add(e.uuid)\n }\n return set\n }, [policy.employees])\n\n const originalBalances = useMemo(() => {\n const map: Record<string, string> = {}\n for (const e of policy.employees) {\n if (e.uuid) map[e.uuid] = e.balance ?? '0'\n }\n return map\n }, [policy.employees])\n\n return (\n <SelectEmployeesTimeOffInner\n {...props}\n mode=\"standalone\"\n originalUuids={originalUuids}\n originalBalances={originalBalances}\n />\n )\n}\n\ninterface InnerProps extends SelectEmployeesTimeOffProps {\n originalUuids?: Set<string>\n originalBalances?: Record<string, string>\n}\n\nfunction SelectEmployeesTimeOffInner({\n companyId,\n policyId,\n policyType,\n mode = 'standalone',\n originalUuids,\n originalBalances,\n}: InnerProps) {\n useI18n('Company.TimeOff.SelectEmployees')\n const { t } = useTranslation('Company.TimeOff.SelectEmployees')\n const { onEvent, baseSubmitHandler } = useBase()\n const queryClient = useQueryClient()\n const {\n filteredEmployees,\n selectedUuids,\n searchValue,\n pagination,\n isFetching,\n handleSelect,\n handleSelectAll,\n handleSearchChange,\n handleSearchClear,\n } = useSelectEmployeesData(companyId, originalUuids)\n\n // Captures the full Employee record at the moment a row is selected so\n // their carry-over balance is still available at submit time even if the\n // user has since searched/paginated the row out of view. Without this,\n // `selectedUuids` would point at UUIDs we no longer have data for.\n const selectedEmployeesRef = useRef(new Map<string, EmployeeItem>())\n\n const handleSelectWithCapture = useCallback(\n (item: EmployeeItem, checked: boolean) => {\n if (checked) {\n selectedEmployeesRef.current.set(item.uuid, item)\n } else {\n selectedEmployeesRef.current.delete(item.uuid)\n }\n handleSelect(item, checked)\n },\n [handleSelect],\n )\n\n const handleSelectAllWithCapture = useCallback(\n (checked: boolean, visibleItems: EmployeeItem[]) => {\n for (const item of visibleItems) {\n if (checked) {\n selectedEmployeesRef.current.set(item.uuid, item)\n } else {\n selectedEmployeesRef.current.delete(item.uuid)\n }\n }\n handleSelectAll(checked, visibleItems)\n },\n [handleSelectAll],\n )\n\n const carryOverBalances = useMemo(\n () => deriveCarryOverBalances(filteredEmployees, policyType),\n [filteredEmployees, policyType],\n )\n\n const [balances, setBalances] = useState<Record<string, string>>({})\n\n const effectiveBalances = useMemo<Record<string, string>>(\n () => ({ ...carryOverBalances, ...balances }),\n [carryOverBalances, balances],\n )\n\n const { mutateAsync: addEmployees } = useTimeOffPoliciesAddEmployeesMutation()\n const { mutateAsync: removeEmployees, isPending: isRemovePending } =\n useTimeOffPoliciesRemoveEmployeesMutation()\n\n const [confirmRemoveOpen, setConfirmRemoveOpen] = useState(false)\n\n const handleBalanceChange = useCallback((uuid: string, value: string) => {\n setBalances(prev => ({ ...prev, [uuid]: value }))\n }, [])\n\n const buildAddPayload = useCallback(\n (uuids: string[]) =>\n uuids.map(uuid => {\n const userValue = balances[uuid]\n const carryOver = extractCarryOverBalance(\n selectedEmployeesRef.current.get(uuid),\n policyType,\n )\n // Per design review: do not zero out balances accidentally.\n // Prefer user input → fall back to carry-over → omit `balance`\n // entirely (backend defaults the row to 0) when neither is set.\n const balance = userValue && userValue.length > 0 ? userValue : carryOver\n return balance ? { uuid, balance } : { uuid }\n }),\n [balances, policyType],\n )\n\n const submitDiff = useCallback(\n async (toAdd: string[], toRemove: string[]) => {\n await baseSubmitHandler({}, async () => {\n if (toRemove.length > 0) {\n try {\n await removeEmployees({\n request: {\n timeOffPolicyUuid: policyId,\n requestBody: { employees: toRemove.map(uuid => ({ uuid })) },\n },\n })\n } catch (err) {\n if (err instanceof UnprocessableEntityError) {\n const apiMessage = err.errors[0]?.message ?? ''\n throw new SDKInternalError(\n t('errors.removeEmployeesFailed', { details: apiMessage }),\n 'api_error',\n )\n }\n throw err\n }\n }\n let policyResult: unknown\n if (toAdd.length > 0) {\n const response = await addEmployees({\n request: {\n timeOffPolicyUuid: policyId,\n requestBody: { employees: buildAddPayload(toAdd) },\n },\n })\n policyResult = response.timeOffPolicy\n }\n void queryClient.invalidateQueries({\n queryKey: ['@gusto/embedded-api', 'timeOffPolicies', 'get'],\n })\n onEvent(componentEvents.TIME_OFF_ADD_EMPLOYEES_DONE, policyResult)\n })\n },\n [\n baseSubmitHandler,\n removeEmployees,\n addEmployees,\n buildAddPayload,\n policyId,\n queryClient,\n onEvent,\n t,\n ],\n )\n\n const handleContinue = useCallback(async () => {\n if (mode === 'wizard') {\n onEvent(componentEvents.TIME_OFF_ADD_EMPLOYEES_DONE, {\n employeeUuids: [...selectedUuids],\n })\n return\n }\n\n const original = originalUuids ?? new Set<string>()\n const toAdd = [...selectedUuids].filter(uuid => !original.has(uuid))\n const toRemove = [...original].filter(uuid => !selectedUuids.has(uuid))\n\n if (toAdd.length === 0 && toRemove.length === 0) {\n onEvent(componentEvents.TIME_OFF_ADD_EMPLOYEES_DONE)\n return\n }\n\n if (toRemove.length > 0) {\n setConfirmRemoveOpen(true)\n return\n }\n\n await submitDiff(toAdd, toRemove)\n }, [mode, originalUuids, selectedUuids, onEvent, submitDiff])\n\n const handleConfirmRemove = useCallback(async () => {\n const original = originalUuids ?? new Set<string>()\n const toAdd = [...selectedUuids].filter(uuid => !original.has(uuid))\n const toRemove = [...original].filter(uuid => !selectedUuids.has(uuid))\n setConfirmRemoveOpen(false)\n await submitDiff(toAdd, toRemove)\n }, [originalUuids, selectedUuids, submitDiff])\n\n const removeCount = useMemo(() => {\n if (!originalUuids) return 0\n let count = 0\n for (const uuid of originalUuids) if (!selectedUuids.has(uuid)) count += 1\n return count\n }, [originalUuids, selectedUuids])\n\n const handleBack = useCallback(() => {\n onEvent(componentEvents.CANCEL)\n }, [onEvent])\n\n return (\n <SelectEmployeesPresentation\n employees={filteredEmployees}\n selectedUuids={selectedUuids}\n searchValue={searchValue}\n onSelect={handleSelectWithCapture}\n onSelectAll={handleSelectAllWithCapture}\n onSearchChange={handleSearchChange}\n onSearchClear={handleSearchClear}\n onBack={handleBack}\n onContinue={handleContinue}\n showReassignmentWarning\n policyTypeLabel={t(`policyTypeLabel_${policyType}`)}\n balances={effectiveBalances}\n onBalanceChange={handleBalanceChange}\n pagination={pagination}\n isFetching={isFetching}\n originallyOnPolicyUuids={originalUuids}\n originalBalances={originalBalances}\n removeConfirmDialog={\n mode === 'standalone'\n ? {\n isOpen: confirmRemoveOpen,\n count: removeCount,\n onConfirm: () => {\n void handleConfirmRemove()\n },\n onClose: () => {\n setConfirmRemoveOpen(false)\n },\n isPending: isRemovePending,\n }\n : undefined\n }\n />\n )\n}\n"],"names":["PAID_TIME_OFF_NAME_BY_POLICY_TYPE","extractCarryOverBalance","employee","policyType","targetName","balance","pto","deriveCarryOverBalances","employees","map","SelectEmployeesTimeOff","props","jsx","SelectEmployeesTimeOffInner","StandaloneLoader","policyResponse","useTimeOffPoliciesGetSuspense","policy","originalUuids","useMemo","set","e","originalBalances","companyId","policyId","mode","useI18n","t","useTranslation","onEvent","baseSubmitHandler","useBase","queryClient","useQueryClient","filteredEmployees","selectedUuids","searchValue","pagination","isFetching","handleSelect","handleSelectAll","handleSearchChange","handleSearchClear","useSelectEmployeesData","selectedEmployeesRef","useRef","handleSelectWithCapture","useCallback","item","checked","handleSelectAllWithCapture","visibleItems","carryOverBalances","balances","setBalances","useState","effectiveBalances","addEmployees","useTimeOffPoliciesAddEmployeesMutation","removeEmployees","isRemovePending","useTimeOffPoliciesRemoveEmployeesMutation","confirmRemoveOpen","setConfirmRemoveOpen","handleBalanceChange","uuid","value","prev","buildAddPayload","uuids","userValue","carryOver","submitDiff","toAdd","toRemove","err","UnprocessableEntityError","apiMessage","SDKInternalError","policyResult","componentEvents","handleContinue","original","handleConfirmRemove","removeCount","count","handleBack","SelectEmployeesPresentation"],"mappings":";;;;;;;;;;;;;;AAuBA,MAAMA,KAAgF;AAAA,EACpF,UAAU;AAAA,EACV,MAAM;AACR;AAEA,SAASC,EACPC,GACAC,GACoB;AACpB,MAAI,CAACD,EAAU;AACf,QAAME,IAAaJ,GAAkCG,CAAU,GAEzDE,IADWH,EAAS,qBAAqB,KAAK,CAAAI,MAAOA,EAAI,SAASF,CAAU,GACxD;AAC1B,SAAOC,KAAWA,EAAQ,SAAS,IAAIA,IAAU;AACnD;AAEA,SAASE,GACPC,GACAL,GACwB;AACxB,QAAMM,IAA8B,CAAA;AACpC,aAAWP,KAAYM,GAAW;AAChC,UAAMH,IAAUJ,EAAwBC,GAAUC,CAAU;AAC5D,IAAIE,MACFI,EAAIP,EAAS,IAAI,IAAIG;AAAA,EAEzB;AACA,SAAOI;AACT;AAEO,SAASC,GAAuBC,GAAoC;AACzE,SAAIA,EAAM,SAAS,WACV,gBAAAC,EAACC,GAAA,EAA6B,GAAGF,GAAO,MAAK,UAAS,IAExD,gBAAAC,EAACE,IAAA,EAAkB,GAAGH,EAAA,CAAO;AACtC;AAEA,SAASG,GAAiBH,GAAoC;AAC5D,QAAM,EAAE,MAAMI,EAAA,IAAmBC,EAA8B;AAAA,IAC7D,mBAAmBL,EAAM;AAAA,EAAA,CAC1B,GACKM,IAASF,EAAe;AAC9B,MAAI,CAACE,EAAQ,OAAM,IAAI,MAAM,4CAA4C;AAEzE,QAAMC,IAAgBC,EAAQ,MAAM;AAClC,UAAMC,wBAAU,IAAA;AAChB,eAAWC,KAAKJ,EAAO;AACrB,MAAII,EAAE,QAAMD,EAAI,IAAIC,EAAE,IAAI;AAE5B,WAAOD;AAAA,EACT,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AA,MACV,aAAaI;AAAA,MACb,gBAAgBT;AAAA,MAChB,eAAeC;AAAA,MACf,QAAQ4C;AAAA,MACR,YAAYL;AAAA,MACZ,yBAAuB;AAAA,MACvB,iBAAiBtD,EAAE,mBAAmBxB,CAAU,EAAE;AAAA,MAClD,UAAUqD;AAAA,MACV,iBAAiBQ;AAAA,MACjB,YAAA3B;AAAA,MACA,YAAAC;AAAA,MACA,yBAAyBpB;AAAA,MACzB,kBAAAI;AAAA,MACA,qBACEG,MAAS,eACL;AAAA,QACE,QAAQqC;AAAA,QACR,OAAOsB;AAAA,QACP,WAAW,MAAM;AACf,UAAKD,EAAA;AAAA,QACP;AAAA,QACA,SAAS,MAAM;AACb,UAAApB,EAAqB,EAAK;AAAA,QAC5B;AAAA,QACA,WAAWH;AAAA,MAAA,IAEb;AAAA,IAAA;AAAA,EAAA;AAIZ;"}
@@ -2,8 +2,8 @@ import { jsx as r, jsxs as R } from "react/jsx-runtime";
2
2
  import { useMemo as l } from "react";
3
3
  import { useTranslation as V } from "react-i18next";
4
4
  import y from "./EmployeeTable.module.scss.js";
5
- import "../../../../shared/constants.js";
6
5
  import "classnames";
6
+ import "../../../../shared/constants.js";
7
7
  import { useComponentContext as b } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
8
8
  import { useI18n as I } from "../../../../i18n/I18n.js";
9
9
  import { firstLastName as O } from "../../../../helpers/formattedStrings.js";
@@ -1,8 +1,8 @@
1
1
  import { jsx as n, jsxs as g, Fragment as P } from "react/jsx-runtime";
2
2
  import { useTranslation as b } from "react-i18next";
3
3
  import { EmployeeTable as E } from "../EmployeeTable/EmployeeTable.js";
4
- import "../../../../shared/constants.js";
5
4
  import "classnames";
5
+ import "../../../../shared/constants.js";
6
6
  import { useComponentContext as D } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
7
7
  import { useI18n as S } from "../../../../i18n/I18n.js";
8
8
  import { DetailViewLayout as L } from "../../../Common/DetailViewLayout/DetailViewLayout.js";
@@ -7,8 +7,8 @@ import { ApiProvider as I } from "../ApiProvider/ApiProvider.js";
7
7
  import { LoadingIndicatorProvider as L } from "../LoadingIndicatorProvider/LoadingIndicatorProvider.js";
8
8
  import { sanitizeError as x } from "../ObservabilityProvider/sanitization.js";
9
9
  import { SDKI18next as m } from "./SDKI18next.js";
10
- import "../../shared/constants.js";
11
10
  import "classnames";
11
+ import "../../shared/constants.js";
12
12
  import { InternalError as z } from "../../components/Common/InternalError/InternalError.js";
13
13
  import { LocaleProvider as D } from "../LocaleProvider/LocaleProvider.js";
14
14
  import "../LocaleProvider/useLocale.js";
@@ -4,40 +4,40 @@ const s = (t) => {
4
4
  if (/^\d{4}-\d{2}-\d{2}$/.test(t)) {
5
5
  const n = t.split("-");
6
6
  if (n.length !== 3) return null;
7
- const r = n.map(Number), o = r[0], i = r[1], a = r[2];
8
- return o === void 0 || i === void 0 || a === void 0 || isNaN(o) || isNaN(i) || isNaN(a) || i < 1 || i > 12 || a < 1 || a > 31 ? null : new Date(o, i - 1, a);
7
+ const r = n.map(Number), o = r[0], a = r[1], i = r[2];
8
+ return o === void 0 || a === void 0 || i === void 0 || isNaN(o) || isNaN(a) || isNaN(i) || a < 1 || a > 12 || i < 1 || i > 31 ? null : new Date(o, a - 1, i);
9
9
  }
10
10
  const e = new Date(t);
11
11
  return isNaN(e.getTime()) ? null : e;
12
12
  }
13
13
  return t instanceof Date ? isNaN(t.getTime()) ? null : t : null;
14
- }, u = (t) => (e, n) => {
14
+ }, c = (t) => (e, n) => {
15
15
  const r = s(e);
16
16
  return r ? r.toLocaleDateString(n, t) : "";
17
- }, g = u({
17
+ }, h = c({
18
18
  weekday: "short",
19
19
  month: "short",
20
20
  day: "numeric"
21
- }), h = u({
21
+ }), f = c({
22
22
  weekday: "short",
23
23
  month: "short",
24
24
  day: "numeric",
25
25
  year: "numeric"
26
- }), y = u({
26
+ }), y = c({
27
27
  month: "short",
28
28
  day: "numeric"
29
- }), S = u({
29
+ }), S = c({
30
30
  month: "short",
31
31
  day: "numeric",
32
32
  year: "numeric"
33
- }), N = u({
33
+ }), N = c({
34
34
  month: "long",
35
35
  day: "numeric"
36
- }), T = u({
36
+ }), w = c({
37
37
  month: "long",
38
38
  day: "numeric",
39
39
  year: "numeric"
40
- }), w = (t, e) => {
40
+ }), T = (t, e) => {
41
41
  const n = s(t);
42
42
  if (!n) return { time: "", date: "" };
43
43
  const r = n.toLocaleTimeString(e, {
@@ -51,98 +51,94 @@ const s = (t) => {
51
51
  day: "numeric"
52
52
  });
53
53
  return { time: r, date: o };
54
- }, L = (t, e, n) => {
54
+ }, M = (t, e, n) => {
55
55
  const r = s(t), o = s(e);
56
56
  if (!r || !o)
57
57
  return { startDate: "", endDate: "" };
58
- const i = r.toLocaleDateString(n, {
58
+ const a = r.toLocaleDateString(n, {
59
59
  month: "long",
60
60
  day: "numeric"
61
- }), a = o.toLocaleDateString(n, {
61
+ }), i = o.toLocaleDateString(n, {
62
62
  month: "short",
63
63
  day: "numeric",
64
64
  year: "numeric"
65
65
  });
66
- return { startDate: i, endDate: a };
67
- }, M = (t, e, n, r) => {
68
- const o = s(t), i = s(e);
69
- if (!o || !i) return "";
70
- const a = r?.useShortMonth ? "short" : "long", c = o.toLocaleDateString(n, {
71
- month: a,
66
+ return { startDate: a, endDate: i };
67
+ }, $ = (t, e, n, r) => {
68
+ const o = s(t), a = s(e);
69
+ if (!o || !a) return "";
70
+ const i = r?.useShortMonth ? "short" : "long", u = o.toLocaleDateString(n, {
71
+ month: i,
72
72
  day: "numeric"
73
- }), l = i.toLocaleDateString(n, {
74
- month: a,
73
+ }), D = a.toLocaleDateString(n, {
74
+ month: i,
75
75
  day: "numeric",
76
76
  year: "numeric"
77
77
  });
78
- return `${c}–${l}`;
79
- }, p = (t) => isNaN(t.getTime()) ? null : t.toISOString().split("T")[0] || null, W = (t) => {
78
+ return `${u}–${D}`;
79
+ }, L = (t) => {
80
+ if (isNaN(t.getTime()))
81
+ return null;
82
+ const e = String(t.getFullYear()).padStart(4, "0"), n = String(t.getMonth() + 1).padStart(2, "0"), r = String(t.getDate()).padStart(2, "0");
83
+ return `${e}-${n}-${r}`;
84
+ }, F = (t) => {
80
85
  if (!t) return "";
81
86
  const e = s(t);
82
87
  if (!e) return "";
83
88
  const n = e.getFullYear(), r = String(e.getMonth() + 1).padStart(2, "0"), o = String(e.getDate()).padStart(2, "0");
84
89
  return `${n}-${r}-${o}`;
85
- }, $ = (t) => {
86
- if (!t || isNaN(t.getTime()))
87
- return null;
88
- const e = t.toISOString(), [n] = e.split("T");
89
- if (!n) return null;
90
- const r = n.split("-");
91
- if (r.length !== 3) return null;
92
- const o = r.map(Number), i = o[0], a = o[1], c = o[2];
93
- return isNaN(i) || isNaN(a) || isNaN(c) || a < 1 || a > 12 || c < 1 || c > 31 ? null : new Date(i, a - 1, c);
94
- }, m = 1e3 * 60 * 60, d = m * 24, F = (t) => {
90
+ }, W = (t) => !t || isNaN(t.getTime()) ? null : new Date(t.getFullYear(), t.getMonth(), t.getDate()), m = 1e3 * 60 * 60, d = m * 24, Y = (t) => {
95
91
  const e = s(t);
96
92
  if (!e) return null;
97
93
  const n = /* @__PURE__ */ new Date();
98
94
  return (e.getTime() - n.getTime()) / m;
99
- }, P = (t) => {
95
+ }, k = (t) => {
100
96
  const e = s(t);
101
97
  if (!e) return null;
102
98
  const n = /* @__PURE__ */ new Date();
103
99
  return (e.getTime() - n.getTime()) / d;
104
- }, D = (t) => {
100
+ }, g = (t) => {
105
101
  const e = t.getDay();
106
102
  return e === 0 || e === 6;
107
- }, f = (t, e) => {
103
+ }, l = (t, e) => {
108
104
  const n = new Date(t);
109
105
  return n.setDate(n.getDate() + e), n;
110
- }, k = (t, e) => {
106
+ }, p = (t, e) => {
111
107
  let n = new Date(t);
112
108
  n.setHours(0, 0, 0, 0);
113
109
  let r = 0;
114
110
  for (; r < e; )
115
- n = f(n, 1), D(n) || r++;
111
+ n = l(n, 1), g(n) || r++;
116
112
  return n;
117
113
  };
118
- function Y(t, e) {
114
+ function P(t, e) {
119
115
  if (!(t == null || e == null))
120
116
  return `${String(t).padStart(2, "0")}-${String(e).padStart(2, "0")}`;
121
117
  }
122
- function b(t) {
118
+ function R(t) {
123
119
  return new Date(2023, t, 0).getDate();
124
120
  }
125
121
  export {
126
122
  m as MS_PER_HOUR,
127
- k as addBusinessDays,
128
- f as addDays,
123
+ p as addBusinessDays,
124
+ l as addDays,
129
125
  N as formatDateLong,
130
- T as formatDateLongWithYear,
126
+ w as formatDateLongWithYear,
131
127
  y as formatDateShort,
132
- g as formatDateShortWithWeekday,
133
- h as formatDateShortWithWeekdayAndYear,
128
+ h as formatDateShortWithWeekday,
129
+ f as formatDateShortWithWeekdayAndYear,
134
130
  S as formatDateShortWithYear,
135
- p as formatDateToStringDate,
136
- w as formatDateWithTime,
137
- Y as formatMonthDay,
138
- L as formatPayPeriod,
139
- M as formatPayPeriodRange,
140
- b as getDaysInMonth,
141
- P as getDaysUntil,
142
- F as getHoursUntil,
143
- D as isWeekend,
144
- $ as normalizeDateToLocal,
131
+ L as formatDateToStringDate,
132
+ T as formatDateWithTime,
133
+ P as formatMonthDay,
134
+ M as formatPayPeriod,
135
+ $ as formatPayPeriodRange,
136
+ R as getDaysInMonth,
137
+ k as getDaysUntil,
138
+ Y as getHoursUntil,
139
+ g as isWeekend,
140
+ W as normalizeDateToLocal,
145
141
  s as normalizeToDate,
146
- W as normalizeToISOString
142
+ F as normalizeToISOString
147
143
  };
148
144
  //# sourceMappingURL=dateFormatting.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dateFormatting.js","sources":["../../src/helpers/dateFormatting.ts"],"sourcesContent":["/**\n * Normalizes any date input (string, Date, or undefined) to a Date object.\n * Handles YYYY-MM-DD strings by parsing them in local timezone to avoid timezone issues.\n * Also handles ISO timestamp strings for compatibility.\n * Returns null for invalid inputs.\n */\nexport const normalizeToDate = (dateInput?: string | Date | null): Date | null => {\n if (!dateInput) return null\n\n if (typeof dateInput === 'string') {\n if (/^\\d{4}-\\d{2}-\\d{2}$/.test(dateInput)) {\n const parts = dateInput.split('-')\n if (parts.length !== 3) return null\n\n const numbers = parts.map(Number)\n const year = numbers[0]\n const month = numbers[1]\n const day = numbers[2]\n if (year === undefined || month === undefined || day === undefined) {\n return null\n }\n\n if (\n isNaN(year) ||\n isNaN(month) ||\n isNaN(day) ||\n month < 1 ||\n month > 12 ||\n day < 1 ||\n day > 31\n ) {\n return null\n }\n\n return new Date(year, month - 1, day)\n }\n\n const parsedDate = new Date(dateInput)\n return isNaN(parsedDate.getTime()) ? null : parsedDate\n }\n\n if (dateInput instanceof Date) {\n return isNaN(dateInput.getTime()) ? null : dateInput\n }\n\n return null\n}\n\n/**\n * Creates a date formatter function that handles both string and Date inputs.\n */\nconst createDateFormatter =\n (options: Intl.DateTimeFormatOptions) =>\n (dateInput?: string | Date | null, locale?: string): string => {\n const date = normalizeToDate(dateInput)\n if (!date) return ''\n return date.toLocaleDateString(locale, options)\n }\n\nexport const formatDateShortWithWeekday = createDateFormatter({\n weekday: 'short',\n month: 'short',\n day: 'numeric',\n})\n\nexport const formatDateShortWithWeekdayAndYear = createDateFormatter({\n weekday: 'short',\n month: 'short',\n day: 'numeric',\n year: 'numeric',\n})\n\nexport const formatDateShort = createDateFormatter({\n month: 'short',\n day: 'numeric',\n})\n\nexport const formatDateShortWithYear = createDateFormatter({\n month: 'short',\n day: 'numeric',\n year: 'numeric',\n})\n\nexport const formatDateLong = createDateFormatter({\n month: 'long',\n day: 'numeric',\n})\n\nexport const formatDateLongWithYear = createDateFormatter({\n month: 'long',\n day: 'numeric',\n year: 'numeric',\n})\n\nexport const formatDateWithTime = (\n dateInput?: string | Date | null,\n locale?: string,\n): { time: string; date: string } => {\n const date = normalizeToDate(dateInput)\n if (!date) return { time: '', date: '' }\n\n const time = date.toLocaleTimeString(locale, {\n hour: 'numeric',\n minute: '2-digit',\n hour12: true,\n timeZoneName: 'short',\n })\n\n const dateString = date.toLocaleDateString(locale, {\n weekday: 'short',\n month: 'short',\n day: 'numeric',\n })\n\n return { time, date: dateString }\n}\n\nexport const formatPayPeriod = (\n startDateInput?: string | Date | null,\n endDateInput?: string | Date | null,\n locale?: string,\n): { startDate: string; endDate: string } => {\n const startDate = normalizeToDate(startDateInput)\n const endDate = normalizeToDate(endDateInput)\n\n if (!startDate || !endDate) {\n return { startDate: '', endDate: '' }\n }\n\n const startFormatted = startDate.toLocaleDateString(locale, {\n month: 'long',\n day: 'numeric',\n })\n\n const endFormatted = endDate.toLocaleDateString(locale, {\n month: 'short',\n day: 'numeric',\n year: 'numeric',\n })\n\n return { startDate: startFormatted, endDate: endFormatted }\n}\n\nexport const formatPayPeriodRange = (\n startDateInput?: string | Date | null,\n endDateInput?: string | Date | null,\n locale?: string,\n options?: { useShortMonth?: boolean },\n): string => {\n const startDate = normalizeToDate(startDateInput)\n const endDate = normalizeToDate(endDateInput)\n\n if (!startDate || !endDate) return ''\n\n const monthFormat = options?.useShortMonth ? 'short' : 'long'\n\n const startFormatted = startDate.toLocaleDateString(locale, {\n month: monthFormat,\n day: 'numeric',\n })\n\n const endFormatted = endDate.toLocaleDateString(locale, {\n month: monthFormat,\n day: 'numeric',\n year: 'numeric',\n })\n\n return `${startFormatted}–${endFormatted}`\n}\n\nexport const formatDateToStringDate = (date: Date): string | null => {\n if (isNaN(date.getTime())) {\n return null\n }\n return date.toISOString().split('T')[0] || null\n}\n\n/**\n * Converts any parseable date string to a `YYYY-MM-DD` ISO string using local\n * time, so the calendar date is preserved regardless of the runtime timezone.\n *\n * Unlike `formatDateToStringDate` (which reads UTC), this function reads the\n * local year/month/day — safe for dates parsed from locale-format strings\n * (e.g. \"4/16/1998\") or ISO strings, both of which `normalizeToDate` lands at\n * local midnight.\n *\n * Returns `''` for null, undefined, empty, or unparseable input.\n */\nexport const normalizeToISOString = (value?: string | null): string => {\n if (!value) return ''\n const date = normalizeToDate(value)\n if (!date) return ''\n const year = date.getFullYear()\n const month = String(date.getMonth() + 1).padStart(2, '0')\n const day = String(date.getDate()).padStart(2, '0')\n return `${year}-${month}-${day}`\n}\n\n/**\n * Normalizes Date to local midnight, handling timezone issues from any adapter.\n */\nexport const normalizeDateToLocal = (date: Date | null): Date | null => {\n if (!date || isNaN(date.getTime())) {\n return null\n }\n\n const isoString = date.toISOString()\n const [datePart] = isoString.split('T')\n if (!datePart) return null\n\n const parts = datePart.split('-')\n if (parts.length !== 3) return null\n const numbers = parts.map(Number)\n const year = numbers[0]!\n const month = numbers[1]!\n const day = numbers[2]!\n if (isNaN(year) || isNaN(month) || isNaN(day) || month < 1 || month > 12 || day < 1 || day > 31) {\n return null\n }\n\n return new Date(year, month - 1, day)\n}\n\nexport const MS_PER_HOUR = 1000 * 60 * 60\nconst MS_PER_DAY = MS_PER_HOUR * 24\n\nexport const getHoursUntil = (deadline?: Date | string | null): number | null => {\n const deadlineDate = normalizeToDate(deadline)\n if (!deadlineDate) return null\n\n const now = new Date()\n const timeDiffMs = deadlineDate.getTime() - now.getTime()\n return timeDiffMs / MS_PER_HOUR\n}\n\nexport const getDaysUntil = (deadline?: Date | string | null): number | null => {\n const deadlineDate = normalizeToDate(deadline)\n if (!deadlineDate) return null\n\n const now = new Date()\n const timeDiffMs = deadlineDate.getTime() - now.getTime()\n return timeDiffMs / MS_PER_DAY\n}\n\nexport const isWeekend = (date: Date): boolean => {\n const day = date.getDay()\n return day === 0 || day === 6\n}\n\nexport const addDays = (date: Date, days: number): Date => {\n const result = new Date(date)\n result.setDate(result.getDate() + days)\n return result\n}\n\nexport const addBusinessDays = (startDate: Date, businessDays: number): Date => {\n let currentDate = new Date(startDate)\n currentDate.setHours(0, 0, 0, 0)\n let daysAdded = 0\n\n while (daysAdded < businessDays) {\n currentDate = addDays(currentDate, 1)\n if (!isWeekend(currentDate)) {\n daysAdded++\n }\n }\n\n return currentDate\n}\n\n/** Formats numeric month and day as a zero-padded `MM-DD` string. */\nexport function formatMonthDay(month?: number, day?: number): string | undefined {\n if (month == null || day == null) return undefined\n return `${String(month).padStart(2, '0')}-${String(day).padStart(2, '0')}`\n}\n\n/** Returns the number of days in a given month (1-indexed). Uses a non-leap year so February always returns 28. */\nexport function getDaysInMonth(month: number): number {\n return new Date(2023, month, 0).getDate()\n}\n"],"names":["normalizeToDate","dateInput","parts","numbers","year","month","day","parsedDate","createDateFormatter","options","locale","date","formatDateShortWithWeekday","formatDateShortWithWeekdayAndYear","formatDateShort","formatDateShortWithYear","formatDateLong","formatDateLongWithYear","formatDateWithTime","time","dateString","formatPayPeriod","startDateInput","endDateInput","startDate","endDate","startFormatted","endFormatted","formatPayPeriodRange","monthFormat","formatDateToStringDate","normalizeToISOString","value","normalizeDateToLocal","isoString","datePart","MS_PER_HOUR","MS_PER_DAY","getHoursUntil","deadline","deadlineDate","now","getDaysUntil","isWeekend","addDays","days","result","addBusinessDays","businessDays","currentDate","daysAdded","formatMonthDay","getDaysInMonth"],"mappings":"AAMO,MAAMA,IAAkB,CAACC,MAAkD;AAChF,MAAI,CAACA,EAAW,QAAO;AAEvB,MAAI,OAAOA,KAAc,UAAU;AACjC,QAAI,sBAAsB,KAAKA,CAAS,GAAG;AACzC,YAAMC,IAAQD,EAAU,MAAM,GAAG;AACjC,UAAIC,EAAM,WAAW,EAAG,QAAO;AAE/B,YAAMC,IAAUD,EAAM,IAAI,MAAM,GAC1BE,IAAOD,EAAQ,CAAC,GAChBE,IAAQF,EAAQ,CAAC,GACjBG,IAAMH,EAAQ,CAAC;AAKrB,aAJIC,MAAS,UAAaC,MAAU,UAAaC,MAAQ,UAKvD,MAAMF,CAAI,KACV,MAAMC,CAAK,KACX,MAAMC,CAAG,KACTD,IAAQ,KACRA,IAAQ,MACRC,IAAM,KACNA,IAAM,KAEC,OAGF,IAAI,KAAKF,GAAMC,IAAQ,GAAGC,CAAG;AAAA,IACtC;AAEA,UAAMC,IAAa,IAAI,KAAKN,CAAS;AACrC,WAAO,MAAMM,EAAW,QAAA,CAAS,IAAI,OAAOA;AAAA,EAC9C;AAEA,SAAIN,aAAqB,OAChB,MAAMA,EAAU,QAAA,CAAS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,IAAkB,CAACvB,GAAiBwB,MAA+B;AAC9E,MAAIC,IAAc,IAAI,KAAKzB,CAAS;AACpC,EAAAyB,EAAY,SAAS,GAAG,GAAG,GAAG,CAAC;AAC/B,MAAIC,IAAY;AAEhB,SAAOA,IAAYF;AACjB,IAAAC,IAAcL,EAAQK,GAAa,CAAC,GAC/BN,EAAUM,CAAW,KACxBC;AAIJ,SAAOD;AACT;AAGO,SAASE,EAAe9C,GAAgBC,GAAkC;AAC/E,MAAI,EAAAD,KAAS,QAAQC,KAAO;AAC5B,WAAO,GAAG,OAAOD,CAAK,EAAE,SAAS,GAAG,GAAG,CAAC,IAAI,OAAOC,CAAG,EAAE,SAAS,GAAG,GAAG,CAAC;AAC1E;AAGO,SAAS8C,EAAe/C,GAAuB;AACpD,SAAO,IAAI,KAAK,MAAMA,GAAO,CAAC,EAAE,QAAA;AAClC;"}
1
+ {"version":3,"file":"dateFormatting.js","sources":["../../src/helpers/dateFormatting.ts"],"sourcesContent":["/**\n * Normalizes any date input (string, Date, or undefined) to a Date object.\n * Handles YYYY-MM-DD strings by parsing them in local timezone to avoid timezone issues.\n * Also handles ISO timestamp strings for compatibility.\n * Returns null for invalid inputs.\n */\nexport const normalizeToDate = (dateInput?: string | Date | null): Date | null => {\n if (!dateInput) return null\n\n if (typeof dateInput === 'string') {\n if (/^\\d{4}-\\d{2}-\\d{2}$/.test(dateInput)) {\n const parts = dateInput.split('-')\n if (parts.length !== 3) return null\n\n const numbers = parts.map(Number)\n const year = numbers[0]\n const month = numbers[1]\n const day = numbers[2]\n if (year === undefined || month === undefined || day === undefined) {\n return null\n }\n\n if (\n isNaN(year) ||\n isNaN(month) ||\n isNaN(day) ||\n month < 1 ||\n month > 12 ||\n day < 1 ||\n day > 31\n ) {\n return null\n }\n\n return new Date(year, month - 1, day)\n }\n\n const parsedDate = new Date(dateInput)\n return isNaN(parsedDate.getTime()) ? null : parsedDate\n }\n\n if (dateInput instanceof Date) {\n return isNaN(dateInput.getTime()) ? null : dateInput\n }\n\n return null\n}\n\n/**\n * Creates a date formatter function that handles both string and Date inputs.\n */\nconst createDateFormatter =\n (options: Intl.DateTimeFormatOptions) =>\n (dateInput?: string | Date | null, locale?: string): string => {\n const date = normalizeToDate(dateInput)\n if (!date) return ''\n return date.toLocaleDateString(locale, options)\n }\n\nexport const formatDateShortWithWeekday = createDateFormatter({\n weekday: 'short',\n month: 'short',\n day: 'numeric',\n})\n\nexport const formatDateShortWithWeekdayAndYear = createDateFormatter({\n weekday: 'short',\n month: 'short',\n day: 'numeric',\n year: 'numeric',\n})\n\nexport const formatDateShort = createDateFormatter({\n month: 'short',\n day: 'numeric',\n})\n\nexport const formatDateShortWithYear = createDateFormatter({\n month: 'short',\n day: 'numeric',\n year: 'numeric',\n})\n\nexport const formatDateLong = createDateFormatter({\n month: 'long',\n day: 'numeric',\n})\n\nexport const formatDateLongWithYear = createDateFormatter({\n month: 'long',\n day: 'numeric',\n year: 'numeric',\n})\n\nexport const formatDateWithTime = (\n dateInput?: string | Date | null,\n locale?: string,\n): { time: string; date: string } => {\n const date = normalizeToDate(dateInput)\n if (!date) return { time: '', date: '' }\n\n const time = date.toLocaleTimeString(locale, {\n hour: 'numeric',\n minute: '2-digit',\n hour12: true,\n timeZoneName: 'short',\n })\n\n const dateString = date.toLocaleDateString(locale, {\n weekday: 'short',\n month: 'short',\n day: 'numeric',\n })\n\n return { time, date: dateString }\n}\n\nexport const formatPayPeriod = (\n startDateInput?: string | Date | null,\n endDateInput?: string | Date | null,\n locale?: string,\n): { startDate: string; endDate: string } => {\n const startDate = normalizeToDate(startDateInput)\n const endDate = normalizeToDate(endDateInput)\n\n if (!startDate || !endDate) {\n return { startDate: '', endDate: '' }\n }\n\n const startFormatted = startDate.toLocaleDateString(locale, {\n month: 'long',\n day: 'numeric',\n })\n\n const endFormatted = endDate.toLocaleDateString(locale, {\n month: 'short',\n day: 'numeric',\n year: 'numeric',\n })\n\n return { startDate: startFormatted, endDate: endFormatted }\n}\n\nexport const formatPayPeriodRange = (\n startDateInput?: string | Date | null,\n endDateInput?: string | Date | null,\n locale?: string,\n options?: { useShortMonth?: boolean },\n): string => {\n const startDate = normalizeToDate(startDateInput)\n const endDate = normalizeToDate(endDateInput)\n\n if (!startDate || !endDate) return ''\n\n const monthFormat = options?.useShortMonth ? 'short' : 'long'\n\n const startFormatted = startDate.toLocaleDateString(locale, {\n month: monthFormat,\n day: 'numeric',\n })\n\n const endFormatted = endDate.toLocaleDateString(locale, {\n month: monthFormat,\n day: 'numeric',\n year: 'numeric',\n })\n\n return `${startFormatted}–${endFormatted}`\n}\n\nexport const formatDateToStringDate = (date: Date): string | null => {\n if (isNaN(date.getTime())) {\n return null\n }\n const year = String(date.getFullYear()).padStart(4, '0')\n const month = String(date.getMonth() + 1).padStart(2, '0')\n const day = String(date.getDate()).padStart(2, '0')\n return `${year}-${month}-${day}`\n}\n\n/**\n * Converts any parseable date string to a `YYYY-MM-DD` ISO string using local\n * time, so the calendar date is preserved regardless of the runtime timezone.\n *\n * Unlike `formatDateToStringDate` (which reads UTC), this function reads the\n * local year/month/day — safe for dates parsed from locale-format strings\n * (e.g. \"4/16/1998\") or ISO strings, both of which `normalizeToDate` lands at\n * local midnight.\n *\n * Returns `''` for null, undefined, empty, or unparseable input.\n */\nexport const normalizeToISOString = (value?: string | null): string => {\n if (!value) return ''\n const date = normalizeToDate(value)\n if (!date) return ''\n const year = date.getFullYear()\n const month = String(date.getMonth() + 1).padStart(2, '0')\n const day = String(date.getDate()).padStart(2, '0')\n return `${year}-${month}-${day}`\n}\n\n/**\n * Normalizes Date to local midnight, handling timezone issues from any adapter.\n */\nexport const normalizeDateToLocal = (date: Date | null): Date | null => {\n if (!date || isNaN(date.getTime())) {\n return null\n }\n return new Date(date.getFullYear(), date.getMonth(), date.getDate())\n}\n\nexport const MS_PER_HOUR = 1000 * 60 * 60\nconst MS_PER_DAY = MS_PER_HOUR * 24\n\nexport const getHoursUntil = (deadline?: Date | string | null): number | null => {\n const deadlineDate = normalizeToDate(deadline)\n if (!deadlineDate) return null\n\n const now = new Date()\n const timeDiffMs = deadlineDate.getTime() - now.getTime()\n return timeDiffMs / MS_PER_HOUR\n}\n\nexport const getDaysUntil = (deadline?: Date | string | null): number | null => {\n const deadlineDate = normalizeToDate(deadline)\n if (!deadlineDate) return null\n\n const now = new Date()\n const timeDiffMs = deadlineDate.getTime() - now.getTime()\n return timeDiffMs / MS_PER_DAY\n}\n\nexport const isWeekend = (date: Date): boolean => {\n const day = date.getDay()\n return day === 0 || day === 6\n}\n\nexport const addDays = (date: Date, days: number): Date => {\n const result = new Date(date)\n result.setDate(result.getDate() + days)\n return result\n}\n\nexport const addBusinessDays = (startDate: Date, businessDays: number): Date => {\n let currentDate = new Date(startDate)\n currentDate.setHours(0, 0, 0, 0)\n let daysAdded = 0\n\n while (daysAdded < businessDays) {\n currentDate = addDays(currentDate, 1)\n if (!isWeekend(currentDate)) {\n daysAdded++\n }\n }\n\n return currentDate\n}\n\n/** Formats numeric month and day as a zero-padded `MM-DD` string. */\nexport function formatMonthDay(month?: number, day?: number): string | undefined {\n if (month == null || day == null) return undefined\n return `${String(month).padStart(2, '0')}-${String(day).padStart(2, '0')}`\n}\n\n/** Returns the number of days in a given month (1-indexed). Uses a non-leap year so February always returns 28. */\nexport function getDaysInMonth(month: number): number {\n return new Date(2023, month, 0).getDate()\n}\n"],"names":["normalizeToDate","dateInput","parts","numbers","year","month","day","parsedDate","createDateFormatter","options","locale","date","formatDateShortWithWeekday","formatDateShortWithWeekdayAndYear","formatDateShort","formatDateShortWithYear","formatDateLong","formatDateLongWithYear","formatDateWithTime","time","dateString","formatPayPeriod","startDateInput","endDateInput","startDate","endDate","startFormatted","endFormatted","formatPayPeriodRange","monthFormat","formatDateToStringDate","normalizeToISOString","value","normalizeDateToLocal","MS_PER_HOUR","MS_PER_DAY","getHoursUntil","deadline","deadlineDate","now","getDaysUntil","isWeekend","addDays","days","result","addBusinessDays","businessDays","currentDate","daysAdded","formatMonthDay","getDaysInMonth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AU,KAAA;AAEhB,UADmBD,EAAa,QAAA,IAAYC,EAAI,QAAA,KAC5BL;AACtB,GAEaM,IAAe,CAACH,MAAmD;AAC9E,QAAMC,IAAetC,EAAgBqC,CAAQ;AAC7C,MAAI,CAACC,EAAc,QAAO;AAE1B,QAAMC,wBAAU,KAAA;AAEhB,UADmBD,EAAa,QAAA,IAAYC,EAAI,QAAA,KAC5BJ;AACtB,GAEaM,IAAY,CAAC9B,MAAwB;AAChD,QAAML,IAAMK,EAAK,OAAA;AACjB,SAAOL,MAAQ,KAAKA,MAAQ;AAC9B,GAEaoC,IAAU,CAAC/B,GAAYgC,MAAuB;AACzD,QAAMC,IAAS,IAAI,KAAKjC,CAAI;AAC5B,SAAAiC,EAAO,QAAQA,EAAO,QAAA,IAAYD,CAAI,GAC/BC;AACT,GAEaC,IAAkB,CAACrB,GAAiBsB,MAA+B;AAC9E,MAAIC,IAAc,IAAI,KAAKvB,CAAS;AACpC,EAAAuB,EAAY,SAAS,GAAG,GAAG,GAAG,CAAC;AAC/B,MAAIC,IAAY;AAEhB,SAAOA,IAAYF;AACjB,IAAAC,IAAcL,EAAQK,GAAa,CAAC,GAC/BN,EAAUM,CAAW,KACxBC;AAIJ,SAAOD;AACT;AAGO,SAASE,EAAe5C,GAAgBC,GAAkC;AAC/E,MAAI,EAAAD,KAAS,QAAQC,KAAO;AAC5B,WAAO,GAAG,OAAOD,CAAK,EAAE,SAAS,GAAG,GAAG,CAAC,IAAI,OAAOC,CAAG,EAAE,SAAS,GAAG,GAAG,CAAC;AAC1E;AAGO,SAAS4C,EAAe7C,GAAuB;AACpD,SAAO,IAAI,KAAK,MAAMA,GAAO,CAAC,EAAE,QAAA;AAClC;"}
@@ -1,8 +1,8 @@
1
1
  import { jsx as n } from "react/jsx-runtime";
2
2
  import { useHookFieldResolution as p } from "../useHookFieldResolution.js";
3
3
  import { withFieldElementRegistry as c } from "./withFieldElementRegistry.js";
4
- import "../../../shared/constants.js";
5
4
  import "classnames";
5
+ import "../../../shared/constants.js";
6
6
  import { CheckboxField as u } from "../../../components/Common/Fields/CheckboxField/CheckboxField.js";
7
7
  function h({
8
8
  name: e,
@@ -1,8 +1,8 @@
1
1
  import { jsx as R } from "react/jsx-runtime";
2
2
  import { useHookFieldResolution as b } from "../useHookFieldResolution.js";
3
3
  import { withFieldElementRegistry as c } from "./withFieldElementRegistry.js";
4
- import "../../../shared/constants.js";
5
4
  import "classnames";
5
+ import "../../../shared/constants.js";
6
6
  import { NumberInputField as F } from "../../../components/Common/Fields/NumberInputField/NumberInputField.js";
7
7
  function E({
8
8
  name: e,
@@ -2,8 +2,8 @@ import { jsx as F } from "react/jsx-runtime";
2
2
  import { useHookFieldResolution as g } from "../useHookFieldResolution.js";
3
3
  import { getFieldWithOptions as b } from "../getFieldWithOptions.js";
4
4
  import { withFieldElementRegistry as h } from "./withFieldElementRegistry.js";
5
- import "../../../shared/constants.js";
6
5
  import "classnames";
6
+ import "../../../shared/constants.js";
7
7
  import { RadioGroupField as k } from "../../../components/Common/Fields/RadioGroupField/RadioGroupField.js";
8
8
  function H({
9
9
  name: i,
@@ -2,8 +2,8 @@ import { jsx as b } from "react/jsx-runtime";
2
2
  import { useHookFieldResolution as h } from "../useHookFieldResolution.js";
3
3
  import { getFieldWithOptions as k } from "../getFieldWithOptions.js";
4
4
  import { withFieldElementRegistry as q } from "./withFieldElementRegistry.js";
5
- import "../../../shared/constants.js";
6
5
  import "classnames";
6
+ import "../../../shared/constants.js";
7
7
  import { SelectField as v } from "../../../components/Common/Fields/SelectField/SelectField.js";
8
8
  function j({
9
9
  name: t,
@@ -1,8 +1,8 @@
1
1
  import { jsx as n } from "react/jsx-runtime";
2
2
  import { useHookFieldResolution as p } from "../useHookFieldResolution.js";
3
3
  import { withFieldElementRegistry as c } from "./withFieldElementRegistry.js";
4
- import "../../../shared/constants.js";
5
4
  import "classnames";
5
+ import "../../../shared/constants.js";
6
6
  import { SwitchField as u } from "../../../components/Common/Fields/SwitchField/SwitchField.js";
7
7
  function k({
8
8
  name: i,