@gusto/embedded-react-sdk 0.13.0 → 0.13.1

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 +6 -0
  2. package/dist/_virtual/dynamic-import-helper.js +8 -1
  3. package/dist/_virtual/dynamic-import-helper.js.map +1 -1
  4. package/dist/components/Base/Base.js +4 -4
  5. package/dist/components/Common/FieldDescription/FieldDescription.js +7 -14
  6. package/dist/components/Common/FieldDescription/FieldDescription.js.map +1 -1
  7. package/dist/components/Common/Fields/hooks/useField.d.ts +4 -1
  8. package/dist/components/Common/Fields/hooks/useField.js +31 -24
  9. package/dist/components/Common/Fields/hooks/useField.js.map +1 -1
  10. package/dist/components/Common/SignatureForm/SignatureForm.js +3 -4
  11. package/dist/components/Common/SignatureForm/SignatureForm.js.map +1 -1
  12. package/dist/components/Common/SignatureForm/SignatureFormActions.js +6 -7
  13. package/dist/components/Common/SignatureForm/SignatureFormActions.js.map +1 -1
  14. package/dist/components/Common/SignatureForm/SignatureFormFields.js +7 -8
  15. package/dist/components/Common/SignatureForm/SignatureFormFields.js.map +1 -1
  16. package/dist/components/Common/UI/CalendarPreview/CalendarPreview.js +1 -1
  17. package/dist/components/Common/UI/DatePicker/DatePicker.js +1 -1
  18. package/dist/components/Common/UI/Tabs/Tabs.d.ts +7 -0
  19. package/dist/components/Common/UI/Tabs/Tabs.js +25 -0
  20. package/dist/components/Common/UI/Tabs/Tabs.js.map +1 -0
  21. package/dist/components/Common/UI/Tabs/Tabs.module.scss.js +8 -0
  22. package/dist/components/Common/UI/Tabs/Tabs.module.scss.js.map +1 -0
  23. package/dist/components/Common/UI/Tabs/TabsTypes.d.ts +51 -0
  24. package/dist/components/Common/UI/Tabs/index.d.ts +3 -0
  25. package/dist/components/Common/hooks/useNumberFormatter.js +1 -1
  26. package/dist/components/Company/AssignSignatory/AssignSignatory.js +6 -7
  27. package/dist/components/Company/AssignSignatory/AssignSignatory.js.map +1 -1
  28. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js +7 -8
  29. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js.map +1 -1
  30. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js +2 -3
  31. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js.map +1 -1
  32. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +8 -3
  33. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
  34. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js +9 -10
  35. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js.map +1 -1
  36. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js +9 -10
  37. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js.map +1 -1
  38. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +8 -3
  39. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
  40. package/dist/components/Company/AssignSignatory/useAssignSignatory.js +10 -5
  41. package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
  42. package/dist/components/Company/BankAccount/BankAccount.js +1 -1
  43. package/dist/components/Company/BankAccount/BankAccountForm/BankAccountForm.js +2 -2
  44. package/dist/components/Company/BankAccount/BankAccountForm/context.js +8 -3
  45. package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
  46. package/dist/components/Company/BankAccount/BankAccountList/BankAccountList.js +1 -1
  47. package/dist/components/Company/BankAccount/BankAccountVerify/BankAccountVerify.js +2 -2
  48. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js +10 -11
  49. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  50. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +8 -3
  51. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  52. package/dist/components/Company/DocumentSigner/DocumentSigner.js +1 -1
  53. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js +9 -10
  54. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
  55. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js +8 -3
  56. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
  57. package/dist/components/Company/FederalTaxes/FederalTaxes.js +15 -16
  58. package/dist/components/Company/FederalTaxes/FederalTaxes.js.map +1 -1
  59. package/dist/components/Company/FederalTaxes/Form.js +1 -1
  60. package/dist/components/Company/FederalTaxes/useFederalTaxes.js +14 -9
  61. package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
  62. package/dist/components/Company/Industry/Context.js +11 -6
  63. package/dist/components/Company/Industry/Context.js.map +1 -1
  64. package/dist/components/Company/Industry/Industry.js +2 -2
  65. package/dist/components/Company/Locations/LocationForm/Form.js +4 -5
  66. package/dist/components/Company/Locations/LocationForm/Form.js.map +1 -1
  67. package/dist/components/Company/Locations/LocationForm/LocationForm.js +13 -14
  68. package/dist/components/Company/Locations/LocationForm/LocationForm.js.map +1 -1
  69. package/dist/components/Company/Locations/LocationForm/useLocationForm.js +8 -3
  70. package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
  71. package/dist/components/Company/Locations/LocationsList/LocationsList.js +7 -8
  72. package/dist/components/Company/Locations/LocationsList/LocationsList.js.map +1 -1
  73. package/dist/components/Company/Locations/LocationsList/useLocationsList.js +8 -3
  74. package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
  75. package/dist/components/Company/OnboardingOverview/OnboardingOverview.js +3 -4
  76. package/dist/components/Company/OnboardingOverview/OnboardingOverview.js.map +1 -1
  77. package/dist/components/Company/OnboardingOverview/context.js +8 -3
  78. package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
  79. package/dist/components/Company/PaySchedule/PaySchedule.js +37 -38
  80. package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
  81. package/dist/components/Company/PaySchedule/_parts/Edit.js +2 -3
  82. package/dist/components/Company/PaySchedule/_parts/Edit.js.map +1 -1
  83. package/dist/components/Company/PaySchedule/usePaySchedule.js +11 -6
  84. package/dist/components/Company/PaySchedule/usePaySchedule.js.map +1 -1
  85. package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js +3 -3
  86. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +8 -3
  87. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
  88. package/dist/components/Company/StateTaxes/StateTaxesList/StateTaxesList.js +1 -1
  89. package/dist/components/Company/StateTaxes/StateTaxesList/context.js +8 -3
  90. package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
  91. package/dist/components/Contractor/Address/Address.js +7 -8
  92. package/dist/components/Contractor/Address/Address.js.map +1 -1
  93. package/dist/components/Contractor/Address/Form.js +2 -3
  94. package/dist/components/Contractor/Address/Form.js.map +1 -1
  95. package/dist/components/Contractor/Address/useAddress.js +10 -5
  96. package/dist/components/Contractor/Address/useAddress.js.map +1 -1
  97. package/dist/components/Contractor/ContractorList/index.js +1 -1
  98. package/dist/components/Contractor/ContractorList/useContractorList.js +1 -1
  99. package/dist/components/Contractor/NewHireReport/NewHireReport.js +3 -3
  100. package/dist/components/Contractor/PaymentMethod/PaymentMethod.js +7 -7
  101. package/dist/components/Contractor/Profile/ContractorProfile.js +1 -1
  102. package/dist/components/Contractor/Profile/useContractorProfile.js +39 -34
  103. package/dist/components/Contractor/Profile/useContractorProfile.js.map +1 -1
  104. package/dist/components/Contractor/Submit/Submit.js +3 -3
  105. package/dist/components/Employee/Compensation/Compensation.js +10 -10
  106. package/dist/components/Employee/Deductions/Deductions.js +1 -1
  107. package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.js +4 -4
  108. package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js +2 -2
  109. package/dist/components/Employee/Deductions/IncludeDeductionsForm/IncludeDeductionsForm.js +1 -1
  110. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js +8 -9
  111. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  112. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +8 -3
  113. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  114. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js +12 -13
  115. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
  116. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +8 -3
  117. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
  118. package/dist/components/Employee/EmployeeList/EmployeeList.js +4 -4
  119. package/dist/components/Employee/EmployeeList/useEmployeeList.js +8 -3
  120. package/dist/components/Employee/EmployeeList/useEmployeeList.js.map +1 -1
  121. package/dist/components/Employee/FederalTaxes/FederalTaxes.js +3 -3
  122. package/dist/components/Employee/FederalTaxes/useFederalTaxes.js +8 -3
  123. package/dist/components/Employee/FederalTaxes/useFederalTaxes.js.map +1 -1
  124. package/dist/components/Employee/Landing/Landing.js +2 -2
  125. package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js +2 -2
  126. package/dist/components/Employee/PaymentMethod/PaymentMethod.js +8 -8
  127. package/dist/components/Employee/PaymentMethod/Split.js +1 -1
  128. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +14 -9
  129. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
  130. package/dist/components/Employee/Profile/HomeAddress.js +4 -5
  131. package/dist/components/Employee/Profile/HomeAddress.js.map +1 -1
  132. package/dist/components/Employee/Profile/PersonalDetailsInputs.js +20 -21
  133. package/dist/components/Employee/Profile/PersonalDetailsInputs.js.map +1 -1
  134. package/dist/components/Employee/Profile/Profile.js +13 -13
  135. package/dist/components/Employee/Profile/useProfile.js +8 -3
  136. package/dist/components/Employee/Profile/useProfile.js.map +1 -1
  137. package/dist/components/Employee/StateTaxes/StateTaxes.js +3 -3
  138. package/dist/components/Employee/StateTaxes/useStateTaxes.js +8 -3
  139. package/dist/components/Employee/StateTaxes/useStateTaxes.js.map +1 -1
  140. package/dist/components/Employee/Taxes/Taxes.js +5 -5
  141. package/dist/components/Employee/Taxes/useTaxes.js +8 -3
  142. package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
  143. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +60 -65
  144. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
  145. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js +60 -57
  146. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
  147. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.d.ts +5 -2
  148. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js +64 -13
  149. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js.map +1 -1
  150. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.d.ts +18 -2
  151. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +117 -19
  152. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
  153. package/dist/components/Payroll/PayrollList/PayrollList.js +3 -3
  154. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +8 -8
  155. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
  156. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +1 -1
  157. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +42 -36
  158. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
  159. package/dist/components/Payroll/helpers.d.ts +7 -6
  160. package/dist/components/Payroll/helpers.js +44 -43
  161. package/dist/components/Payroll/helpers.js.map +1 -1
  162. package/dist/components/Payroll/usePreparedPayrollData.d.ts +14 -0
  163. package/dist/components/Payroll/usePreparedPayrollData.js +39 -0
  164. package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -0
  165. package/dist/contexts/ApiProvider/ApiProvider.js +4 -4
  166. package/dist/contexts/ComponentAdapter/adapters/defaultComponentAdapter.js +28 -26
  167. package/dist/contexts/ComponentAdapter/adapters/defaultComponentAdapter.js.map +1 -1
  168. package/dist/contexts/ComponentAdapter/useComponentContext.d.ts +2 -0
  169. package/dist/contexts/ComponentAdapter/useComponentContext.js.map +1 -1
  170. package/dist/i18n/I18n.js +5 -5
  171. package/dist/i18n/I18n.js.map +1 -1
  172. package/dist/i18n/en/Payroll.PayrollConfiguration.json.js +20 -18
  173. package/dist/i18n/en/Payroll.PayrollConfiguration.json.js.map +1 -1
  174. package/dist/i18n/en/Payroll.PayrollEditEmployee.json.js +20 -0
  175. package/dist/i18n/en/Payroll.PayrollEditEmployee.json.js.map +1 -0
  176. package/dist/i18n/en/Payroll.PayrollOverview.json.js +18 -0
  177. package/dist/i18n/en/Payroll.PayrollOverview.json.js.map +1 -0
  178. package/dist/shared/constants.d.ts +6 -0
  179. package/dist/shared/constants.js +43 -34
  180. package/dist/shared/constants.js.map +1 -1
  181. package/dist/style.css +1 -1
  182. package/dist/types/i18next.d.ts +52 -1
  183. package/package.json +14 -13
@@ -1,146 +1,149 @@
1
1
  import { jsxs as m, jsx as e } from "react/jsx-runtime";
2
2
  import { useTranslation as B } from "react-i18next";
3
- import { useFormatEmployeePayRate as H, getRegularHours as L, formatHoursDisplay as C, getTotalPtoHours as M, getAdditionalEarnings as v, getReimbursements as R, calculateGrossPay as S } from "../helpers.js";
3
+ import { useFormatEmployeePayRate as H, getRegularHours as L, formatHoursDisplay as C, getTotalPtoHours as M, getAdditionalEarnings as R, getReimbursements as F, calculateGrossPay as S } from "../helpers.js";
4
+ import { useI18n as j } from "../../../i18n/I18n.js";
4
5
  import { Flex as p } from "../../Common/Flex/Flex.js";
5
6
  import "classnames";
6
7
  import "../../../shared/constants.js";
7
- import { useComponentContext as F } from "../../../contexts/ComponentAdapter/useComponentContext.js";
8
- import { HamburgerMenu as j } from "../../Common/HamburgerMenu/HamburgerMenu.js";
8
+ import { useComponentContext as v } from "../../../contexts/ComponentAdapter/useComponentContext.js";
9
+ import { HamburgerMenu as V } from "../../Common/HamburgerMenu/HamburgerMenu.js";
9
10
  import G from "../../../assets/icons/pencil.svg.js";
10
- import { formatNumberAsCurrency as y, firstLastName as _ } from "../../../helpers/formattedStrings.js";
11
- import { parseDateStringToLocal as w } from "../../../helpers/dateFormatting.js";
12
- import { useLocale as I } from "../../../contexts/LocaleProvider/useLocale.js";
11
+ import { formatNumberAsCurrency as y, firstLastName as I } from "../../../helpers/formattedStrings.js";
12
+ import { parseDateStringToLocal as P } from "../../../helpers/dateFormatting.js";
13
+ import { useLocale as _ } from "../../../contexts/LocaleProvider/useLocale.js";
13
14
  import { DataView as O } from "../../Common/DataView/DataView.js";
14
- const V = ({
15
- payPeriod: i,
15
+ const q = ({
16
+ payPeriod: a,
16
17
  locale: c,
17
18
  t: s
18
19
  }) => {
19
- if (i?.startDate && i.endDate) {
20
- const d = w(i.startDate), u = w(i.endDate);
20
+ if (a?.startDate && a.endDate) {
21
+ const d = P(a.startDate), u = P(a.endDate);
21
22
  if (d && u) {
22
- const h = d.toLocaleDateString(c, {
23
+ const g = d.toLocaleDateString(c, {
23
24
  month: "long",
24
25
  day: "numeric"
25
- }), g = u.toLocaleDateString(c, {
26
+ }), h = u.toLocaleDateString(c, {
26
27
  month: "short",
27
28
  day: "numeric",
28
29
  year: "numeric"
29
30
  });
30
- return s("pageTitle", { startDate: h, endDate: g });
31
+ return s("pageTitle", { startDate: g, endDate: h });
31
32
  }
32
33
  }
33
34
  return s("pageTitle", { startDate: "", endDate: "" });
34
- }, ne = ({
35
- employeeCompensations: i,
35
+ }, oe = ({
36
+ employeeCompensations: a,
36
37
  employeeDetails: c,
37
38
  payPeriod: s,
38
39
  paySchedule: d,
39
40
  onBack: u,
40
- onEdit: h,
41
- onCalculatePayroll: g,
42
- isOffCycle: P = !1
41
+ onEdit: g,
42
+ onCalculatePayroll: h,
43
+ isOffCycle: w = !1
43
44
  }) => {
44
- const { Alert: f, Button: b, Heading: D, Text: l, Badge: T } = F(), { t: n } = B("Payroll.PayrollConfiguration"), { locale: x } = I(), E = H(), o = new Map(c.map((t) => [t.uuid, t])), N = (t) => {
45
+ const { Alert: f, Button: b, Heading: D, Text: n, Badge: N } = v();
46
+ j("Payroll.PayrollConfiguration");
47
+ const { t: l } = B("Payroll.PayrollConfiguration"), { locale: T } = _(), x = H(), o = new Map(c.map((t) => [t.uuid, t])), E = (t) => {
45
48
  const r = o.get(t);
46
- return r ? _({ first_name: r.firstName, last_name: r.lastName }) : null;
49
+ return r ? I({ first_name: r.firstName, last_name: r.lastName }) : null;
47
50
  };
48
51
  return /* @__PURE__ */ m(p, { flexDirection: "column", gap: 16, children: [
49
52
  /* @__PURE__ */ m(p, { justifyContent: "space-between", alignItems: "center", children: [
50
- /* @__PURE__ */ e(D, { as: "h1", children: V({ payPeriod: s, locale: x, t: n }) }),
51
- /* @__PURE__ */ e(b, { title: n("calculatePayrollTitle"), onClick: g, children: n("calculatePayroll") })
53
+ /* @__PURE__ */ e(D, { as: "h1", children: q({ payPeriod: s, locale: T, t: l }) }),
54
+ /* @__PURE__ */ e(b, { title: l("calculatePayrollTitle"), onClick: h, children: l("calculatePayroll") })
52
55
  ] }),
53
- /* @__PURE__ */ e(l, { children: n("regularPayroll") }),
56
+ /* @__PURE__ */ e(n, { children: l("regularPayroll") }),
54
57
  /* @__PURE__ */ m(p, { flexDirection: "column", gap: 16, children: [
55
- /* @__PURE__ */ e(f, { label: "Payroll Deadline", status: "info", children: "To pay your employees with direct deposit on the check date, you'll need to run payroll by the deadline." }),
56
- /* @__PURE__ */ e(f, { label: "Skipped Employees", status: "warning", children: /* @__PURE__ */ m("ul", { children: [
57
- /* @__PURE__ */ e("li", { children: "Employee address not verified" }),
58
- /* @__PURE__ */ e("li", { children: "Employee address not verified" })
58
+ /* @__PURE__ */ e(f, { label: l("alerts.payrollDeadline.label"), status: "info", children: l("alerts.payrollDeadline.message") }),
59
+ /* @__PURE__ */ e(f, { label: l("alerts.skippedEmployees.label"), status: "warning", children: /* @__PURE__ */ m("ul", { children: [
60
+ /* @__PURE__ */ e("li", { children: l("alerts.skippedEmployees.employeeAddressNotVerified") }),
61
+ /* @__PURE__ */ e("li", { children: l("alerts.skippedEmployees.employeeAddressNotVerified") })
59
62
  ] }) })
60
63
  ] }),
61
- /* @__PURE__ */ e(D, { as: "h3", children: n("hoursAndEarningsTitle") }),
62
- /* @__PURE__ */ e(l, { children: n("hoursAndEarningsDescription") }),
64
+ /* @__PURE__ */ e(D, { as: "h3", children: l("hoursAndEarningsTitle") }),
65
+ /* @__PURE__ */ e(n, { children: l("hoursAndEarningsDescription") }),
63
66
  /* @__PURE__ */ e(
64
67
  O,
65
68
  {
66
- label: n("employeeCompensationsTitle"),
69
+ label: l("employeeCompensationsTitle"),
67
70
  columns: [
68
71
  {
69
- title: /* @__PURE__ */ e(l, { weight: "semibold", children: n("tableColumns.employees") }),
72
+ title: /* @__PURE__ */ e(n, { weight: "semibold", children: l("tableColumns.employees") }),
70
73
  render: (t) => {
71
- const r = o.get(t.employeeUuid || ""), a = E(r);
74
+ const r = o.get(t.employeeUuid || ""), i = x(r);
72
75
  return /* @__PURE__ */ m(p, { flexDirection: "column", gap: 8, children: [
73
- /* @__PURE__ */ e(l, { weight: "semibold", children: N(t.employeeUuid || "") }),
74
- a && /* @__PURE__ */ e(l, { variant: "supporting", children: a }),
75
- t.excluded && /* @__PURE__ */ e(T, { status: "warning", children: n("skippedBadge") })
76
+ /* @__PURE__ */ e(n, { weight: "semibold", children: E(t.employeeUuid || "") }),
77
+ i && /* @__PURE__ */ e(n, { variant: "supporting", children: i }),
78
+ t.excluded && /* @__PURE__ */ e(N, { status: "warning", children: l("skippedBadge") })
76
79
  ] });
77
80
  }
78
81
  },
79
82
  {
80
- title: /* @__PURE__ */ e(l, { weight: "semibold", children: n("tableColumns.hours") }),
83
+ title: /* @__PURE__ */ e(n, { weight: "semibold", children: l("tableColumns.hours") }),
81
84
  render: (t) => {
82
85
  const r = L(t);
83
- return /* @__PURE__ */ e(l, { children: C(r) });
86
+ return /* @__PURE__ */ e(n, { children: C(r) });
84
87
  }
85
88
  },
86
89
  {
87
- title: /* @__PURE__ */ e(l, { weight: "semibold", children: n("tableColumns.timeOff") }),
90
+ title: /* @__PURE__ */ e(n, { weight: "semibold", children: l("tableColumns.timeOff") }),
88
91
  render: (t) => {
89
92
  const r = M(t);
90
- return /* @__PURE__ */ e(l, { children: C(r) });
93
+ return /* @__PURE__ */ e(n, { children: C(r) });
91
94
  }
92
95
  },
93
96
  {
94
- title: /* @__PURE__ */ e(l, { weight: "semibold", children: n("tableColumns.additionalEarnings") }),
97
+ title: /* @__PURE__ */ e(n, { weight: "semibold", children: l("tableColumns.additionalEarnings") }),
95
98
  render: (t) => {
96
- const r = v(t);
97
- return /* @__PURE__ */ e(l, { children: y(r) });
99
+ const r = R(t);
100
+ return /* @__PURE__ */ e(n, { children: y(r) });
98
101
  }
99
102
  },
100
103
  {
101
- title: /* @__PURE__ */ e(l, { weight: "semibold", children: n("tableColumns.reimbursements") }),
104
+ title: /* @__PURE__ */ e(n, { weight: "semibold", children: l("tableColumns.reimbursements") }),
102
105
  render: (t) => {
103
- const r = R(t);
104
- return /* @__PURE__ */ e(l, { children: y(r) });
106
+ const r = F(t);
107
+ return /* @__PURE__ */ e(n, { children: y(r) });
105
108
  }
106
109
  },
107
110
  {
108
- title: /* @__PURE__ */ e(l, { weight: "semibold", children: n("tableColumns.totalPay") }),
111
+ title: /* @__PURE__ */ e(n, { weight: "semibold", children: l("tableColumns.totalPay") }),
109
112
  render: (t) => {
110
- const r = o.get(t.employeeUuid || ""), a = r ? S(t, r, s?.startDate, d, P) : 0;
111
- return /* @__PURE__ */ e(l, { children: y(a) });
113
+ const r = o.get(t.employeeUuid || ""), i = r ? S(t, r, s?.startDate, d, w) : 0;
114
+ return /* @__PURE__ */ e(n, { children: y(i) });
112
115
  }
113
116
  }
114
117
  ],
115
- data: i.filter((t) => {
118
+ data: a.filter((t) => {
116
119
  const r = t.employeeUuid;
117
120
  return r ? o.has(r) : !1;
118
121
  }).sort((t, r) => {
119
- const a = o.get(t.employeeUuid || ""), k = o.get(r.employeeUuid || ""), U = a?.lastName || "", A = k?.lastName || "";
120
- return U.localeCompare(A);
122
+ const i = o.get(t.employeeUuid || ""), k = o.get(r.employeeUuid || ""), A = i?.lastName || "", U = k?.lastName || "";
123
+ return A.localeCompare(U);
121
124
  }),
122
125
  itemMenu: (t) => /* @__PURE__ */ e(
123
- j,
126
+ V,
124
127
  {
125
128
  items: [
126
129
  {
127
- label: n("editMenu.edit"),
130
+ label: l("editMenu.edit"),
128
131
  icon: /* @__PURE__ */ e(G, { "aria-hidden": !0 }),
129
132
  onClick: () => {
130
133
  const r = o.get(t.employeeUuid || "");
131
- r && h(r);
134
+ r && g(r);
132
135
  }
133
136
  }
134
137
  ],
135
- triggerLabel: n("editMenu.edit")
138
+ triggerLabel: l("editMenu.edit")
136
139
  }
137
140
  )
138
141
  }
139
142
  ),
140
- /* @__PURE__ */ e(b, { title: n("backButtonTitle"), onClick: u, variant: "secondary", children: n("backButton") })
143
+ /* @__PURE__ */ e(b, { title: l("backButtonTitle"), onClick: u, variant: "secondary", children: l("backButton") })
141
144
  ] });
142
145
  };
143
146
  export {
144
- ne as PayrollConfigurationPresentation
147
+ oe as PayrollConfigurationPresentation
145
148
  };
146
149
  //# sourceMappingURL=PayrollConfigurationPresentation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PayrollConfigurationPresentation.js","sources":["../../../../src/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.tsx"],"sourcesContent":["import type { EmployeeCompensations } from '@gusto/embedded-api/models/components/payrollshow'\nimport type { Employee } from '@gusto/embedded-api/models/components/employee'\nimport type { PayrollPayPeriodType } from '@gusto/embedded-api/models/components/payrollpayperiodtype'\nimport type { PayScheduleObject } from '@gusto/embedded-api/models/components/payscheduleobject'\nimport { useTranslation } from 'react-i18next'\nimport type { TFunction } from 'i18next'\nimport {\n useFormatEmployeePayRate,\n getRegularHours,\n getTotalPtoHours,\n getAdditionalEarnings,\n getReimbursements,\n formatHoursDisplay,\n calculateGrossPay,\n} from '../helpers'\nimport { DataView, Flex } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { HamburgerMenu } from '@/components/Common/HamburgerMenu'\nimport PencilSvg from '@/assets/icons/pencil.svg?react'\nimport { firstLastName, formatNumberAsCurrency } from '@/helpers/formattedStrings'\nimport { parseDateStringToLocal } from '@/helpers/dateFormatting'\nimport { useLocale } from '@/contexts/LocaleProvider/useLocale'\n\ninterface PayrollConfigurationPresentationProps {\n employeeCompensations: EmployeeCompensations[]\n employeeDetails: Employee[]\n payPeriod?: PayrollPayPeriodType\n paySchedule?: PayScheduleObject\n onBack: () => void\n onCalculatePayroll: () => void\n onEdit: (employee: Employee) => void\n isOffCycle?: boolean\n}\n\nconst getPayrollConfigurationTitle = ({\n payPeriod,\n locale,\n t,\n}: {\n payPeriod?: PayrollPayPeriodType\n locale: string\n t: TFunction<'Payroll.PayrollConfiguration'>\n}) => {\n if (payPeriod?.startDate && payPeriod.endDate) {\n const startDate = parseDateStringToLocal(payPeriod.startDate)\n const endDate = parseDateStringToLocal(payPeriod.endDate)\n\n if (startDate && endDate) {\n const startFormatted = startDate.toLocaleDateString(locale, {\n month: 'long',\n day: 'numeric',\n })\n const endFormatted = endDate.toLocaleDateString(locale, {\n month: 'short',\n day: 'numeric',\n year: 'numeric',\n })\n return t('pageTitle', { startDate: startFormatted, endDate: endFormatted })\n }\n }\n return t('pageTitle', { startDate: '', endDate: '' })\n}\n\nexport const PayrollConfigurationPresentation = ({\n employeeCompensations,\n employeeDetails,\n payPeriod,\n paySchedule,\n onBack,\n onEdit,\n onCalculatePayroll,\n isOffCycle = false,\n}: PayrollConfigurationPresentationProps) => {\n const { Alert, Button, Heading, Text, Badge } = useComponentContext()\n const { t } = useTranslation('Payroll.PayrollConfiguration')\n const { locale } = useLocale()\n const formatEmployeePayRate = useFormatEmployeePayRate()\n\n const employeeMap = new Map(employeeDetails.map(employee => [employee.uuid, employee]))\n\n const getEmployeeName = (employeeUuid: string) => {\n const employee = employeeMap.get(employeeUuid)\n return employee\n ? firstLastName({ first_name: employee.firstName, last_name: employee.lastName })\n : null\n }\n\n return (\n <Flex flexDirection=\"column\" gap={16}>\n <Flex justifyContent=\"space-between\" alignItems=\"center\">\n <Heading as=\"h1\">{getPayrollConfigurationTitle({ payPeriod, locale, t })}</Heading>\n <Button title={t('calculatePayrollTitle')} onClick={onCalculatePayroll}>\n {t('calculatePayroll')}\n </Button>\n </Flex>\n\n <Text>{t('regularPayroll')}</Text>\n\n <Flex flexDirection=\"column\" gap={16}>\n {/* TODO: Replace with actual deadline information from payroll data */}\n <Alert label=\"Payroll Deadline\" status=\"info\">\n To pay your employees with direct deposit on the check date, you&apos;ll need to run\n payroll by the deadline.\n </Alert>\n\n {/* TODO: Replace with actual skipped employees list from payroll data */}\n <Alert label=\"Skipped Employees\" status=\"warning\">\n <ul>\n <li>Employee address not verified</li>\n <li>Employee address not verified</li>\n </ul>\n </Alert>\n </Flex>\n\n <Heading as=\"h3\">{t('hoursAndEarningsTitle')}</Heading>\n <Text>{t('hoursAndEarningsDescription')}</Text>\n\n <DataView\n label={t('employeeCompensationsTitle')}\n columns={[\n {\n title: <Text weight=\"semibold\">{t('tableColumns.employees')}</Text>,\n render: (item: EmployeeCompensations) => {\n const employee = employeeMap.get(item.employeeUuid || '')\n const payRateDisplay = formatEmployeePayRate(employee)\n return (\n <Flex flexDirection=\"column\" gap={8 as const}>\n <Text weight=\"semibold\">{getEmployeeName(item.employeeUuid || '')}</Text>\n {payRateDisplay && <Text variant=\"supporting\">{payRateDisplay}</Text>}\n {item.excluded && <Badge status=\"warning\">{t('skippedBadge')}</Badge>}\n </Flex>\n )\n },\n },\n {\n title: <Text weight=\"semibold\">{t('tableColumns.hours')}</Text>,\n render: (item: EmployeeCompensations) => {\n const hours = getRegularHours(item)\n return <Text>{formatHoursDisplay(hours)}</Text>\n },\n },\n {\n title: <Text weight=\"semibold\">{t('tableColumns.timeOff')}</Text>,\n render: (item: EmployeeCompensations) => {\n const ptoHours = getTotalPtoHours(item)\n return <Text>{formatHoursDisplay(ptoHours)}</Text>\n },\n },\n {\n title: <Text weight=\"semibold\">{t('tableColumns.additionalEarnings')}</Text>,\n render: (item: EmployeeCompensations) => {\n const earnings = getAdditionalEarnings(item)\n return <Text>{formatNumberAsCurrency(earnings)}</Text>\n },\n },\n {\n title: <Text weight=\"semibold\">{t('tableColumns.reimbursements')}</Text>,\n render: (item: EmployeeCompensations) => {\n const reimbursements = getReimbursements(item)\n return <Text>{formatNumberAsCurrency(reimbursements)}</Text>\n },\n },\n {\n title: <Text weight=\"semibold\">{t('tableColumns.totalPay')}</Text>,\n render: (item: EmployeeCompensations) => {\n const employee = employeeMap.get(item.employeeUuid || '')\n const calculatedGrossPay = employee\n ? calculateGrossPay(item, employee, payPeriod?.startDate, paySchedule, isOffCycle)\n : 0\n return <Text>{formatNumberAsCurrency(calculatedGrossPay)}</Text>\n },\n },\n ]}\n data={employeeCompensations\n .filter(compensation => {\n const employeeUuid = compensation.employeeUuid\n if (!employeeUuid) return false\n return employeeMap.has(employeeUuid)\n })\n .sort((a, b) => {\n const employeeA = employeeMap.get(a.employeeUuid || '')\n const employeeB = employeeMap.get(b.employeeUuid || '')\n const lastNameA = employeeA?.lastName || ''\n const lastNameB = employeeB?.lastName || ''\n return lastNameA.localeCompare(lastNameB)\n })}\n itemMenu={(item: EmployeeCompensations) => (\n <HamburgerMenu\n items={[\n {\n label: t('editMenu.edit'),\n icon: <PencilSvg aria-hidden />,\n onClick: () => {\n const employee = employeeMap.get(item.employeeUuid || '')\n if (employee) {\n onEdit(employee)\n }\n },\n },\n ]}\n triggerLabel={t('editMenu.edit')}\n />\n )}\n />\n\n <Button title={t('backButtonTitle')} onClick={onBack} variant=\"secondary\">\n {t('backButton')}\n </Button>\n </Flex>\n )\n}\n"],"names":["getPayrollConfigurationTitle","payPeriod","locale","t","startDate","parseDateStringToLocal","endDate","startFormatted","endFormatted","PayrollConfigurationPresentation","employeeCompensations","employeeDetails","paySchedule","onBack","onEdit","onCalculatePayroll","isOffCycle","Alert","Button","Heading","Text","Badge","useComponentContext","useTranslation","useLocale","formatEmployeePayRate","useFormatEmployeePayRate","employeeMap","employee","getEmployeeName","employeeUuid","firstLastName","jsxs","Flex","jsx","DataView","item","payRateDisplay","hours","getRegularHours","formatHoursDisplay","ptoHours","getTotalPtoHours","earnings","getAdditionalEarnings","formatNumberAsCurrency","reimbursements","getReimbursements","calculatedGrossPay","calculateGrossPay","compensation","a","b","employeeA","employeeB","lastNameA","lastNameB","HamburgerMenu","PencilSvg"],"mappings":";;;;;;;;;;;;;AAkCA,MAAMA,IAA+B,CAAC;AAAA,EACpC,WAAAC;AAAA,EACA,QAAAC;AAAA,EACA,GAAAC;AACF,MAIM;AACJ,MAAIF,GAAW,aAAaA,EAAU,SAAS;AAC7C,UAAMG,IAAYC,EAAuBJ,EAAU,SAAS,GACtDK,IAAUD,EAAuBJ,EAAU,OAAO;AAExD,QAAIG,KAAaE,GAAS;AACxB,YAAMC,IAAiBH,EAAU,mBAAmBF,GAAQ;AAAA,QAC1D,OAAO;AAAA,QACP,KAAK;AAAA,MAAA,CACN,GACKM,IAAeF,EAAQ,mBAAmBJ,GAAQ;AAAA,QACtD,OAAO;AAAA,QACP,KAAK;AAAA,QACL,MAAM;AAAA,MAAA,CACP;AACD,aAAOC,EAAE,aAAa,EAAE,WAAWI,GAAgB,SAASC,GAAc;AAAA,IAC5E;AAAA,EACF;AACA,SAAOL,EAAE,aAAa,EAAE,WAAW,IAAI,SA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AO,gBAAAkB,EAACd,GAAA,EAAM,UAAAyB,EAAuBG,CAAkB,GAAE;AAAA,YAC3D;AAAA,UAAA;AAAA,QACF;AAAA,QAEF,MAAMtC,EACH,OAAO,CAAAwC,MAAgB;AACtB,gBAAMpB,IAAeoB,EAAa;AAClC,iBAAKpB,IACEH,EAAY,IAAIG,CAAY,IADT;AAAA,QAE5B,CAAC,EACA,KAAK,CAACqB,GAAGC,MAAM;AACd,gBAAMC,IAAY1B,EAAY,IAAIwB,EAAE,gBAAgB,EAAE,GAChDG,IAAY3B,EAAY,IAAIyB,EAAE,gBAAgB,EAAE,GAChDG,IAAYF,GAAW,YAAY,IACnCG,IAAYF,GAAW,YAAY;AACzC,iBAAOC,EAAU,cAAcC,CAAS;AAAA,QAC1C,CAAC;AAAA,QACH,UAAU,CAACpB,MACT,gBAAAF;AAAA,UAACuB;AAAA,UAAA;AAAA,YACC,OAAO;AAAA,cACL;AAAA,gBACE,OAAOtD,EAAE,eAAe;AAAA,gBACxB,MAAM,gBAAA+B,EAACwB,GAAA,EAAU,eAAW,GAAA,CAAC;AAAA,gBAC7B,SAAS,MAAM;AACb,wBAAM9B,IAAWD,EAAY,IAAIS,EAAK,gBAAgB,EAAE;AACxD,kBAAIR,KACFd,EAAOc,CAAQ;AAAA,gBAEnB;AAAA,cAAA;AAAA,YACF;AAAA,YAEF,cAAczB,EAAE,eAAe;AAAA,UAAA;AAAA,QAAA;AAAA,MACjC;AAAA,IAAA;AAAA,IAIJ,gBAAA+B,EAAChB,GAAA,EAAO,OAAOf,EAAE,iBAAiB,GAAG,SAASU,GAAQ,SAAQ,aAC3D,UAAAV,EAAE,YAAY,EAAA,CACjB;AAAA,EAAA,GACF;AAEJ;"}
1
+ {"version":3,"file":"PayrollConfigurationPresentation.js","sources":["../../../../src/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.tsx"],"sourcesContent":["import type { EmployeeCompensations } from '@gusto/embedded-api/models/components/payrollshow'\nimport type { Employee } from '@gusto/embedded-api/models/components/employee'\nimport type { PayrollPayPeriodType } from '@gusto/embedded-api/models/components/payrollpayperiodtype'\nimport type { PayScheduleObject } from '@gusto/embedded-api/models/components/payscheduleobject'\nimport { useTranslation } from 'react-i18next'\nimport type { TFunction } from 'i18next'\nimport type { PayrollEmployeeCompensationsType } from '@gusto/embedded-api/models/components/payrollemployeecompensationstype'\nimport {\n useFormatEmployeePayRate,\n getRegularHours,\n getTotalPtoHours,\n getAdditionalEarnings,\n getReimbursements,\n formatHoursDisplay,\n calculateGrossPay,\n} from '../helpers'\nimport { useI18n } from '@/i18n'\nimport { DataView, Flex } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { HamburgerMenu } from '@/components/Common/HamburgerMenu'\nimport PencilSvg from '@/assets/icons/pencil.svg?react'\nimport { firstLastName, formatNumberAsCurrency } from '@/helpers/formattedStrings'\nimport { parseDateStringToLocal } from '@/helpers/dateFormatting'\nimport { useLocale } from '@/contexts/LocaleProvider/useLocale'\n\ninterface PayrollConfigurationPresentationProps {\n employeeCompensations: EmployeeCompensations[]\n employeeDetails: Employee[]\n payPeriod?: PayrollPayPeriodType\n paySchedule?: PayScheduleObject\n onBack: () => void\n onCalculatePayroll: () => void\n onEdit: (employee: Employee) => void\n isOffCycle?: boolean\n}\n\nconst getPayrollConfigurationTitle = ({\n payPeriod,\n locale,\n t,\n}: {\n payPeriod?: PayrollPayPeriodType\n locale: string\n t: TFunction<'Payroll.PayrollConfiguration'>\n}) => {\n if (payPeriod?.startDate && payPeriod.endDate) {\n const startDate = parseDateStringToLocal(payPeriod.startDate)\n const endDate = parseDateStringToLocal(payPeriod.endDate)\n\n if (startDate && endDate) {\n const startFormatted = startDate.toLocaleDateString(locale, {\n month: 'long',\n day: 'numeric',\n })\n const endFormatted = endDate.toLocaleDateString(locale, {\n month: 'short',\n day: 'numeric',\n year: 'numeric',\n })\n return t('pageTitle', { startDate: startFormatted, endDate: endFormatted })\n }\n }\n return t('pageTitle', { startDate: '', endDate: '' })\n}\n\nexport const PayrollConfigurationPresentation = ({\n employeeCompensations,\n employeeDetails,\n payPeriod,\n paySchedule,\n onBack,\n onEdit,\n onCalculatePayroll,\n isOffCycle = false,\n}: PayrollConfigurationPresentationProps) => {\n const { Alert, Button, Heading, Text, Badge } = useComponentContext()\n useI18n('Payroll.PayrollConfiguration')\n const { t } = useTranslation('Payroll.PayrollConfiguration')\n const { locale } = useLocale()\n const formatEmployeePayRate = useFormatEmployeePayRate()\n\n const employeeMap = new Map(employeeDetails.map(employee => [employee.uuid, employee]))\n\n const getEmployeeName = (employeeUuid: string) => {\n const employee = employeeMap.get(employeeUuid)\n return employee\n ? firstLastName({ first_name: employee.firstName, last_name: employee.lastName })\n : null\n }\n\n return (\n <Flex flexDirection=\"column\" gap={16}>\n <Flex justifyContent=\"space-between\" alignItems=\"center\">\n <Heading as=\"h1\">{getPayrollConfigurationTitle({ payPeriod, locale, t })}</Heading>\n <Button title={t('calculatePayrollTitle')} onClick={onCalculatePayroll}>\n {t('calculatePayroll')}\n </Button>\n </Flex>\n\n <Text>{t('regularPayroll')}</Text>\n\n <Flex flexDirection=\"column\" gap={16}>\n {/* TODO: Replace with actual deadline information from payroll data */}\n <Alert label={t('alerts.payrollDeadline.label')} status=\"info\">\n {t('alerts.payrollDeadline.message')}\n </Alert>\n\n {/* TODO: Replace with actual skipped employees list from payroll data */}\n <Alert label={t('alerts.skippedEmployees.label')} status=\"warning\">\n <ul>\n <li>{t('alerts.skippedEmployees.employeeAddressNotVerified')}</li>\n <li>{t('alerts.skippedEmployees.employeeAddressNotVerified')}</li>\n </ul>\n </Alert>\n </Flex>\n\n <Heading as=\"h3\">{t('hoursAndEarningsTitle')}</Heading>\n <Text>{t('hoursAndEarningsDescription')}</Text>\n\n <DataView\n label={t('employeeCompensationsTitle')}\n columns={[\n {\n title: <Text weight=\"semibold\">{t('tableColumns.employees')}</Text>,\n render: (item: EmployeeCompensations) => {\n const employee = employeeMap.get(item.employeeUuid || '')\n const payRateDisplay = formatEmployeePayRate(employee)\n return (\n <Flex flexDirection=\"column\" gap={8 as const}>\n <Text weight=\"semibold\">{getEmployeeName(item.employeeUuid || '')}</Text>\n {payRateDisplay && <Text variant=\"supporting\">{payRateDisplay}</Text>}\n {item.excluded && <Badge status=\"warning\">{t('skippedBadge')}</Badge>}\n </Flex>\n )\n },\n },\n {\n title: <Text weight=\"semibold\">{t('tableColumns.hours')}</Text>,\n render: (item: EmployeeCompensations) => {\n const hours = getRegularHours(item)\n return <Text>{formatHoursDisplay(hours)}</Text>\n },\n },\n {\n title: <Text weight=\"semibold\">{t('tableColumns.timeOff')}</Text>,\n render: (item: EmployeeCompensations) => {\n const ptoHours = getTotalPtoHours(item)\n return <Text>{formatHoursDisplay(ptoHours)}</Text>\n },\n },\n {\n title: <Text weight=\"semibold\">{t('tableColumns.additionalEarnings')}</Text>,\n render: (item: EmployeeCompensations) => {\n const earnings = getAdditionalEarnings(item)\n return <Text>{formatNumberAsCurrency(earnings)}</Text>\n },\n },\n {\n title: <Text weight=\"semibold\">{t('tableColumns.reimbursements')}</Text>,\n render: (item: EmployeeCompensations) => {\n const reimbursements = getReimbursements(item)\n return <Text>{formatNumberAsCurrency(reimbursements)}</Text>\n },\n },\n {\n title: <Text weight=\"semibold\">{t('tableColumns.totalPay')}</Text>,\n render: (item: PayrollEmployeeCompensationsType) => {\n const employee = employeeMap.get(item.employeeUuid || '')\n const calculatedGrossPay = employee\n ? calculateGrossPay(item, employee, payPeriod?.startDate, paySchedule, isOffCycle)\n : 0\n return <Text>{formatNumberAsCurrency(calculatedGrossPay)}</Text>\n },\n },\n ]}\n data={employeeCompensations\n .filter(compensation => {\n const employeeUuid = compensation.employeeUuid\n if (!employeeUuid) return false\n return employeeMap.has(employeeUuid)\n })\n .sort((a, b) => {\n const employeeA = employeeMap.get(a.employeeUuid || '')\n const employeeB = employeeMap.get(b.employeeUuid || '')\n const lastNameA = employeeA?.lastName || ''\n const lastNameB = employeeB?.lastName || ''\n return lastNameA.localeCompare(lastNameB)\n })}\n itemMenu={(item: EmployeeCompensations) => (\n <HamburgerMenu\n items={[\n {\n label: t('editMenu.edit'),\n icon: <PencilSvg aria-hidden />,\n onClick: () => {\n const employee = employeeMap.get(item.employeeUuid || '')\n if (employee) {\n onEdit(employee)\n }\n },\n },\n ]}\n triggerLabel={t('editMenu.edit')}\n />\n )}\n />\n\n <Button title={t('backButtonTitle')} onClick={onBack} variant=\"secondary\">\n {t('backButton')}\n </Button>\n </Flex>\n )\n}\n"],"names":["getPayrollConfigurationTitle","payPeriod","locale","t","startDate","parseDateStringToLocal","endDate","startFormatted","endFormatted","PayrollConfigurationPresentation","employeeCompensations","employeeDetails","paySchedule","onBack","onEdit","onCalculatePayroll","isOffCycle","Alert","Button","Heading","Text","Badge","useComponentContext","useI18n","useTranslation","useLocale","formatEmployeePayRate","useFormatEmployeePayRate","employeeMap","employee","getEmployeeName","employeeUuid","firstLastName","jsxs","Flex","jsx","DataView","item","payRateDisplay","hours","getRegularHours","formatHoursDisplay","ptoHours","getTotalPtoHours","earnings","getAdditionalEarnings","formatNumberAsCurrency","reimbursements","getReimbursements","calculatedGrossPay","calculateGrossPay","compensation","a","b","employeeA","employeeB","lastNameA","lastNameB","HamburgerMenu","PencilSvg"],"mappings":";;;;;;;;;;;;;;AAoCA,MAAMA,IAA+B,CAAC;AAAA,EACpC,WAAAC;AAAA,EACA,QAAAC;AAAA,EACA,GAAAC;AACF,MAIM;AACJ,MAAIF,GAAW,aAAaA,EAAU,SAAS;AAC7C,UAAMG,IAAYC,EAAuBJ,EAAU,SAAS,GACtDK,IAAUD,EAAuBJ,EAAU,OAAO;AAExD,QAAIG,KAAaE,GAAS;AACxB,YAAMC,IAAiBH,EAAU,mBAAmBF,GAAQ;AAAA,QAC1D,OAAO;AAAA,QACP,KAAK;AAAA,MAAA,CACN,GACKM,IAAeF,EAAQ,mBAAmBJ,GAAQ;AAAA,QACtD,OAAO;AAAA,QACP,KAAK;AAAA,QACL,MAAM;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,EAAO,OAAOf,EAAE,iBAAiB,GAAG,SAASU,GAAQ,SAAQ,aAC3D,UAAAV,EAAE,YAAY,EAAA,CACjB;AAAA,EAAA,GACF;AAEJ;"}
@@ -1,6 +1,9 @@
1
1
  import { BaseComponentInterface } from '../../Base/Base';
2
- interface PayrollEditEmployeeProps extends BaseComponentInterface {
2
+ interface PayrollEditEmployeeProps extends BaseComponentInterface<'Payroll.PayrollEditEmployee'> {
3
3
  employeeId: string;
4
+ companyId: string;
5
+ payrollId: string;
4
6
  }
5
- export declare const PayrollEditEmployee: ({ employeeId, onEvent, ...baseProps }: PayrollEditEmployeeProps) => import("react/jsx-runtime").JSX.Element;
7
+ export declare function PayrollEditEmployee(props: PayrollEditEmployeeProps & BaseComponentInterface): import("react/jsx-runtime").JSX.Element;
8
+ export declare const Root: ({ employeeId, companyId, payrollId, onEvent, dictionary, }: PayrollEditEmployeeProps) => import("react/jsx-runtime").JSX.Element;
6
9
  export {};
@@ -1,19 +1,70 @@
1
- import { jsx as e } from "react/jsx-runtime";
2
- import { PayrollEditEmployeePresentation as r } from "./PayrollEditEmployeePresentation.js";
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { useEmployeesGetSuspense as A } from "@gusto/embedded-api/react-query/employeesGet";
3
+ import { usePayrollsUpdateMutation as R } from "@gusto/embedded-api/react-query/payrollsUpdate";
4
+ import { calculateGrossPay as U } from "../helpers.js";
5
+ import { usePreparedPayrollData as g } from "../usePreparedPayrollData.js";
6
+ import { PayrollEditEmployeePresentation as O } from "./PayrollEditEmployeePresentation.js";
3
7
  import { componentEvents as p } from "../../../shared/constants.js";
4
- import { BaseComponent as s } from "../../Base/Base.js";
5
- const a = ({ employeeId: t }) => ({ mutate: async () => {
6
- } }), u = ({
7
- employeeId: t,
8
- onEvent: o,
9
- ...n
8
+ import { BaseComponent as S } from "../../Base/Base.js";
9
+ import { useComponentDictionary as Y } from "../../../i18n/I18n.js";
10
+ import { useBase as N } from "../../Base/useBase.js";
11
+ function b(e) {
12
+ return /* @__PURE__ */ r(S, { ...e, children: /* @__PURE__ */ r(h, { ...e, children: e.children }) });
13
+ }
14
+ const h = ({
15
+ employeeId: e,
16
+ companyId: s,
17
+ payrollId: m,
18
+ onEvent: i,
19
+ dictionary: c
10
20
  }) => {
11
- const { mutate: m } = a({ employeeId: t });
12
- return /* @__PURE__ */ e(s, { ...n, onEvent: o, children: /* @__PURE__ */ e(r, { onDone: async () => {
13
- await m(), o(p.RUN_PAYROLL_EMPLOYEE_SAVED);
14
- } }) });
21
+ Y("Payroll.PayrollEditEmployee", c);
22
+ const { LoadingIndicator: y } = N(), { data: u } = A({ employeeId: e }), { preparedPayroll: n, paySchedule: P, isLoading: d } = g({
23
+ companyId: s,
24
+ payrollId: m
25
+ }), { mutateAsync: f, isPending: E } = R(), l = u.employee, a = n?.employeeCompensations?.find(
26
+ (o) => o.employeeUuid === e
27
+ ), C = ({
28
+ paymentMethod: o,
29
+ ...t
30
+ }) => ({
31
+ ...t,
32
+ ...o && o !== "Historical" ? { paymentMethod: o } : {},
33
+ memo: t.memo || void 0
34
+ }), L = async (o) => {
35
+ const t = C(o), _ = await f({
36
+ request: {
37
+ companyId: s,
38
+ payrollId: m,
39
+ payrollUpdate: {
40
+ employeeCompensations: [t]
41
+ }
42
+ }
43
+ });
44
+ i(p.RUN_PAYROLL_EMPLOYEE_SAVED, _.payrollPrepared);
45
+ }, D = () => {
46
+ i(p.RUN_PAYROLL_EMPLOYEE_CANCELLED);
47
+ };
48
+ return d ? /* @__PURE__ */ r(y, {}) : /* @__PURE__ */ r(
49
+ O,
50
+ {
51
+ onSave: L,
52
+ onCancel: D,
53
+ employee: l,
54
+ isPending: E,
55
+ grossPay: a ? U(
56
+ a,
57
+ l,
58
+ n?.payPeriod?.startDate,
59
+ P,
60
+ n?.offCycle
61
+ ) : 0,
62
+ employeeCompensation: a
63
+ }
64
+ );
15
65
  };
16
66
  export {
17
- u as PayrollEditEmployee
67
+ b as PayrollEditEmployee,
68
+ h as Root
18
69
  };
19
70
  //# sourceMappingURL=PayrollEditEmployee.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PayrollEditEmployee.js","sources":["../../../../src/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.tsx"],"sourcesContent":["import { PayrollEditEmployeePresentation } from './PayrollEditEmployeePresentation'\nimport { componentEvents } from '@/shared/constants'\nimport type { BaseComponentInterface } from '@/components/Base/Base'\nimport { BaseComponent } from '@/components/Base/Base'\n\n//TODO: Use Speakeasy type\ninterface Employee {\n employeeId: string\n}\n\n// TODO: Replace this hook with call to Speakeasy instead\nconst useEditEmployeeApi = ({ employeeId }: Employee) => {\n const mutate = async () => {}\n return { mutate }\n}\n\ninterface PayrollEditEmployeeProps extends BaseComponentInterface {\n employeeId: string\n}\n\nexport const PayrollEditEmployee = ({\n employeeId,\n onEvent,\n ...baseProps\n}: PayrollEditEmployeeProps) => {\n const { mutate } = useEditEmployeeApi({ employeeId })\n const onDone = async () => {\n await mutate()\n onEvent(componentEvents.RUN_PAYROLL_EMPLOYEE_SAVED)\n }\n return (\n <BaseComponent {...baseProps} onEvent={onEvent}>\n <PayrollEditEmployeePresentation onDone={onDone} />\n </BaseComponent>\n )\n}\n"],"names":["useEditEmployeeApi","employeeId","PayrollEditEmployee","onEvent","baseProps","mutate","jsx","BaseComponent","PayrollEditEmployeePresentation","componentEvents"],"mappings":";;;;AAWA,MAAMA,IAAqB,CAAC,EAAE,YAAAC,SAErB,EAAE,QADM,YAAY;AAAC,EACnB,IAOEC,IAAsB,CAAC;AAAA,EAClC,YAAAD;AAAA,EACA,SAAAE;AAAA,EACA,GAAGC;AACL,MAAgC;AAC9B,QAAM,EAAE,QAAAC,EAAA,IAAWL,EAAmB,EAAE,YAAAC,GAAY;AAKpD,SACE,gBAAAK,EAACC,KAAe,GAAGH,GAAW,SAAAD,GAC5B,UAAA,gBAAAG,EAACE,GAAA,EAAgC,QANtB,YAAY;AACzB,UAAMH,EAAA,GACNF,EAAQM,EAAgB,0BAA0B;AAAA,EACpD,GAGqD,EAAA,CACnD;AAEJ;"}
1
+ {"version":3,"file":"PayrollEditEmployee.js","sources":["../../../../src/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.tsx"],"sourcesContent":["import { useEmployeesGetSuspense } from '@gusto/embedded-api/react-query/employeesGet'\nimport { usePayrollsUpdateMutation } from '@gusto/embedded-api/react-query/payrollsUpdate'\nimport type { PayrollEmployeeCompensationsType } from '@gusto/embedded-api/models/components/payrollemployeecompensationstype'\nimport type { PayrollUpdateEmployeeCompensations } from '@gusto/embedded-api/models/components/payrollupdate'\nimport { calculateGrossPay } from '../helpers'\nimport { usePreparedPayrollData } from '../usePreparedPayrollData'\nimport { PayrollEditEmployeePresentation } from './PayrollEditEmployeePresentation'\nimport { componentEvents } from '@/shared/constants'\nimport type { BaseComponentInterface } from '@/components/Base/Base'\nimport { BaseComponent } from '@/components/Base/Base'\nimport { useComponentDictionary } from '@/i18n'\nimport { useBase } from '@/components/Base/useBase'\n\ninterface PayrollEditEmployeeProps extends BaseComponentInterface<'Payroll.PayrollEditEmployee'> {\n employeeId: string\n companyId: string\n payrollId: string\n}\n\nexport function PayrollEditEmployee(props: PayrollEditEmployeeProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nexport const Root = ({\n employeeId,\n companyId,\n payrollId,\n onEvent,\n dictionary,\n}: PayrollEditEmployeeProps) => {\n useComponentDictionary('Payroll.PayrollEditEmployee', dictionary)\n\n const { LoadingIndicator } = useBase()\n\n const { data: employeeData } = useEmployeesGetSuspense({ employeeId })\n const { preparedPayroll, paySchedule, isLoading } = usePreparedPayrollData({\n companyId,\n payrollId,\n })\n\n const { mutateAsync: updatePayroll, isPending } = usePayrollsUpdateMutation()\n\n const employee = employeeData.employee!\n\n const employeeCompensation = preparedPayroll?.employeeCompensations?.find(\n compensation => compensation.employeeUuid === employeeId,\n )\n\n const transformEmployeeCompensation = ({\n paymentMethod,\n ...compensation\n }: PayrollEmployeeCompensationsType): PayrollUpdateEmployeeCompensations => {\n return {\n ...compensation,\n ...(paymentMethod && paymentMethod !== 'Historical' ? { paymentMethod } : {}),\n memo: compensation.memo || undefined,\n }\n }\n\n const onSave = async (updatedCompensation: PayrollEmployeeCompensationsType) => {\n const transformedCompensation = transformEmployeeCompensation(updatedCompensation)\n\n const result = await updatePayroll({\n request: {\n companyId,\n payrollId,\n payrollUpdate: {\n employeeCompensations: [transformedCompensation],\n },\n },\n })\n\n onEvent(componentEvents.RUN_PAYROLL_EMPLOYEE_SAVED, result.payrollPrepared)\n }\n\n const onCancel = () => {\n onEvent(componentEvents.RUN_PAYROLL_EMPLOYEE_CANCELLED)\n }\n\n if (isLoading) {\n return <LoadingIndicator />\n }\n\n return (\n <PayrollEditEmployeePresentation\n onSave={onSave}\n onCancel={onCancel}\n employee={employee}\n isPending={isPending}\n grossPay={\n employeeCompensation\n ? calculateGrossPay(\n employeeCompensation,\n employee,\n preparedPayroll?.payPeriod?.startDate,\n paySchedule,\n preparedPayroll?.offCycle,\n )\n : 0\n }\n employeeCompensation={employeeCompensation}\n />\n )\n}\n"],"names":["PayrollEditEmployee","props","jsx","BaseComponent","Root","employeeId","companyId","payrollId","onEvent","dictionary","useComponentDictionary","LoadingIndicator","useBase","employeeData","useEmployeesGetSuspense","preparedPayroll","paySchedule","isLoading","usePreparedPayrollData","updatePayroll","isPending","usePayrollsUpdateMutation","employee","employeeCompensation","compensation","transformEmployeeCompensation","paymentMethod","onSave","updatedCompensation","transformedCompensation","result","componentEvents","onCancel","PayrollEditEmployeePresentation","calculateGrossPay"],"mappings":";;;;;;;;;;AAmBO,SAASA,EAAoBC,GAA0D;AAC5F,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAEO,MAAMG,IAAO,CAAC;AAAA,EACnB,YAAAC;AA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AA,MACA,WAAAF;AAAA,MACA,UACEG,IACIW;AAAA,QACEX;AAAA,QACAD;AAAA,QACAP,GAAiB,WAAW;AAAA,QAC5BC;AAAA,QACAD,GAAiB;AAAA,MAAA,IAEnB;AAAA,MAEN,sBAAAQ;AAAA,IAAA;AAAA,EAAA;AAGN;"}
@@ -1,5 +1,21 @@
1
+ import { Employee } from '@gusto/embedded-api/models/components/employee';
2
+ import { PayrollEmployeeCompensationsType } from '@gusto/embedded-api/models/components/payrollemployeecompensationstype';
3
+ import { z } from 'zod';
1
4
  interface PayrollEditEmployeeProps {
2
- onDone: () => void;
5
+ onSave: (updatedCompensation: PayrollEmployeeCompensationsType) => void;
6
+ onCancel: () => void;
7
+ employee: Employee;
8
+ employeeCompensation?: PayrollEmployeeCompensationsType;
9
+ grossPay: number;
10
+ isPending?: boolean;
3
11
  }
4
- export declare const PayrollEditEmployeePresentation: ({ onDone }: PayrollEditEmployeeProps) => import("react/jsx-runtime").JSX.Element;
12
+ export declare const PayrollEditEmployeeFormSchema: z.ZodObject<{
13
+ hourlyCompensations: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodString>>>;
14
+ }, "strip", z.ZodTypeAny, {
15
+ hourlyCompensations: Record<string, Record<string, string | undefined>>;
16
+ }, {
17
+ hourlyCompensations: Record<string, Record<string, string | undefined>>;
18
+ }>;
19
+ export type PayrollEditEmployeeFormValues = z.infer<typeof PayrollEditEmployeeFormSchema>;
20
+ export declare const PayrollEditEmployeePresentation: ({ onSave, onCancel, employee, grossPay, employeeCompensation, isPending, }: PayrollEditEmployeeProps) => import("react/jsx-runtime").JSX.Element;
5
21
  export {};
@@ -1,24 +1,122 @@
1
- import { jsxs as l, jsx as r } from "react/jsx-runtime";
2
- import { useForm as m, FormProvider as s } from "react-hook-form";
3
- import { Flex as a } from "../../Common/Flex/Flex.js";
4
- import "classnames";
5
- import "../../../shared/constants.js";
6
- import "react-i18next";
7
- import { NumberInputField as d } from "../../Common/Fields/NumberInputField/NumberInputField.js";
8
- import { useComponentContext as p } from "../../../contexts/ComponentAdapter/useComponentContext.js";
9
- import { Form as u } from "../../Common/Form/Form.js";
10
- const D = ({ onDone: e }) => {
11
- const { Button: t, Heading: o, Text: n } = p(), i = m();
12
- return /* @__PURE__ */ l(a, { flexDirection: "column", gap: 20, children: [
13
- /* @__PURE__ */ r(o, { as: "h2", children: "Edit Hannah Arendt's payroll" }),
14
- /* @__PURE__ */ r(o, { as: "h1", children: "$1,173.08" }),
15
- /* @__PURE__ */ r(n, { children: "Gross pay" }),
16
- /* @__PURE__ */ r(o, { as: "h3", children: "Regular hours" }),
17
- /* @__PURE__ */ r(s, { ...i, children: /* @__PURE__ */ r(u, { children: /* @__PURE__ */ r(d, { defaultValue: 40, isRequired: !0, label: "Hours", name: "hours" }) }) }),
18
- /* @__PURE__ */ r(t, { onClick: e, title: "Done", children: "Done" })
1
+ import { jsxs as a, jsx as n } from "react/jsx-runtime";
2
+ import { useForm as x, FormProvider as M } from "react-hook-form";
3
+ import { useTranslation as S } from "react-i18next";
4
+ import { z as s } from "zod";
5
+ import { zodResolver as A } from "@hookform/resolvers/zod";
6
+ import { Flex as u } from "../../Common/Flex/Flex.js";
7
+ import { Grid as v } from "../../Common/Grid/Grid.js";
8
+ import { TextInputField as U } from "../../Common/Fields/TextInputField/TextInputField.js";
9
+ import { useComponentContext as I } from "../../../contexts/ComponentAdapter/useComponentContext.js";
10
+ import { useI18n as L } from "../../../i18n/I18n.js";
11
+ import { Form as R } from "../../Common/Form/Form.js";
12
+ import { firstLastName as F, formatNumberAsCurrency as H } from "../../../helpers/formattedStrings.js";
13
+ import { HOURS_COMPENSATION_NAMES as C, COMPENSATION_NAME_DOUBLE_OVERTIME as B, COMPENSATION_NAME_OVERTIME as w, COMPENSATION_NAME_REGULAR_HOURS as D } from "../../../shared/constants.js";
14
+ const V = s.object({
15
+ hourlyCompensations: s.record(s.string(), s.record(s.string(), s.string().optional()))
16
+ }), or = ({
17
+ onSave: g,
18
+ onCancel: y,
19
+ employee: l,
20
+ grossPay: N,
21
+ employeeCompensation: m,
22
+ isPending: b = !1
23
+ }) => {
24
+ const { Button: f, Heading: d, Text: O } = I(), { t } = S("Payroll.PayrollEditEmployee");
25
+ L("Payroll.PayrollEditEmployee");
26
+ const p = l.jobs?.find((r) => r.primary), c = p ? [p] : [];
27
+ m?.hourlyCompensations?.forEach((r) => {
28
+ const e = l.jobs?.find((o) => o.uuid === r.jobUuid);
29
+ e && !c.find((o) => o.uuid === e.uuid) && c.push(e);
30
+ });
31
+ const h = (r, e) => m?.hourlyCompensations?.find(
32
+ (o) => o.jobUuid === r && o.name?.toLowerCase() === e.toLowerCase()
33
+ ), P = (r) => {
34
+ switch (r) {
35
+ case D:
36
+ return t("compensationNames.regularHours");
37
+ case w:
38
+ return t("compensationNames.overtime");
39
+ case B:
40
+ return t("compensationNames.doubleOvertime");
41
+ default:
42
+ return r;
43
+ }
44
+ }, j = {
45
+ hourlyCompensations: (() => {
46
+ const r = {};
47
+ return c.forEach((e) => {
48
+ C.forEach((o) => {
49
+ const i = h(e.uuid, o);
50
+ i && (r[e.uuid] || (r[e.uuid] = {}), r[e.uuid][i.name] = i.hours ? parseFloat(i.hours).toString() : "");
51
+ });
52
+ }), r;
53
+ })()
54
+ }, E = x({
55
+ resolver: A(V),
56
+ defaultValues: j
57
+ }), T = F({
58
+ first_name: l.firstName,
59
+ last_name: l.lastName
60
+ }), _ = (r) => {
61
+ const e = {
62
+ ...m
63
+ };
64
+ e.hourlyCompensations = m?.hourlyCompensations?.map(
65
+ (o) => {
66
+ const i = o.jobUuid && o.name ? r.hourlyCompensations[o.jobUuid]?.[o.name] : void 0;
67
+ return i ? {
68
+ ...o,
69
+ hours: i
70
+ } : o;
71
+ }
72
+ ), g(e);
73
+ };
74
+ return /* @__PURE__ */ a(u, { flexDirection: "column", gap: 20, children: [
75
+ /* @__PURE__ */ a(u, { justifyContent: "space-between", children: [
76
+ /* @__PURE__ */ a(u, { flexDirection: "column", gap: 8, children: [
77
+ /* @__PURE__ */ n(d, { as: "h2", children: t("pageTitle", { employeeName: T }) }),
78
+ /* @__PURE__ */ n(d, { as: "h1", children: H(N || 0) }),
79
+ /* @__PURE__ */ n(O, { children: t("grossPayLabel") })
80
+ ] }),
81
+ /* @__PURE__ */ a(u, { gap: 12, justifyContent: "flex-end", children: [
82
+ /* @__PURE__ */ n(f, { variant: "secondary", onClick: y, title: t("cancelButton"), children: t("cancelButton") }),
83
+ /* @__PURE__ */ n(
84
+ f,
85
+ {
86
+ onClick: E.handleSubmit(_),
87
+ title: t("saveButton"),
88
+ isLoading: b,
89
+ children: t("saveButton")
90
+ }
91
+ )
92
+ ] })
93
+ ] }),
94
+ /* @__PURE__ */ n(d, { as: "h3", children: t("regularHoursTitle") }),
95
+ /* @__PURE__ */ n(M, { ...E, children: /* @__PURE__ */ n(R, { children: c.map((r) => /* @__PURE__ */ a(u, { flexDirection: "column", gap: 8, children: [
96
+ /* @__PURE__ */ n(d, { as: "h4", children: r.title }),
97
+ /* @__PURE__ */ n(v, { gridTemplateColumns: { base: "1fr", small: [320, 320] }, gap: 20, children: C.map((e) => {
98
+ const o = h(
99
+ r.uuid,
100
+ e
101
+ );
102
+ if (o)
103
+ return /* @__PURE__ */ n(
104
+ U,
105
+ {
106
+ type: "number",
107
+ adornmentEnd: t("hoursUnit"),
108
+ isRequired: !0,
109
+ label: P(e),
110
+ name: `hourlyCompensations.${r.uuid}.${o.name}`
111
+ },
112
+ e
113
+ );
114
+ }) })
115
+ ] }, r.uuid)) }) })
19
116
  ] });
20
117
  };
21
118
  export {
22
- D as PayrollEditEmployeePresentation
119
+ V as PayrollEditEmployeeFormSchema,
120
+ or as PayrollEditEmployeePresentation
23
121
  };
24
122
  //# sourceMappingURL=PayrollEditEmployeePresentation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PayrollEditEmployeePresentation.js","sources":["../../../../src/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.tsx"],"sourcesContent":["import { FormProvider, useForm } from 'react-hook-form'\nimport { Flex, NumberInputField } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { Form } from '@/components/Common/Form'\n\ninterface PayrollEditEmployeeProps {\n onDone: () => void\n}\n\nexport const PayrollEditEmployeePresentation = ({ onDone }: PayrollEditEmployeeProps) => {\n const { Button, Heading, Text } = useComponentContext()\n const formHandlers = useForm()\n return (\n <Flex flexDirection=\"column\" gap={20}>\n <Heading as=\"h2\">{`Edit Hannah Arendt's payroll`}</Heading>\n <Heading as=\"h1\">$1,173.08</Heading>\n <Text>Gross pay</Text>\n <Heading as=\"h3\">Regular hours</Heading>\n <FormProvider {...formHandlers}>\n <Form>\n <NumberInputField defaultValue={40} isRequired label=\"Hours\" name=\"hours\" />\n </Form>\n </FormProvider>\n\n <Button onClick={onDone} title=\"Done\">\n Done\n </Button>\n </Flex>\n )\n}\n"],"names":["PayrollEditEmployeePresentation","onDone","Button","Heading","Text","useComponentContext","formHandlers","useForm","jsxs","Flex","jsx","FormProvider","Form","NumberInputField"],"mappings":";;;;;;;;;AASO,MAAMA,IAAkC,CAAC,EAAE,QAAAC,QAAuC;AACvF,QAAM,EAAE,QAAAC,GAAQ,SAAAC,GAAS,MAAAC,EAAA,IAASC,EAAA,GAC5BC,IAAeC,EAAA;AACrB,SACE,gBAAAC,EAACC,GAAA,EAAK,eAAc,UAAS,KAAK,IAChC,UAAA;AAAA,IAAA,gBAAAC,EAACP,GAAA,EAAQ,IAAG,MAAM,UAAA,gCAA+B;AAAA,IACjD,gBAAAO,EAACP,GAAA,EAAQ,IAAG,MAAK,UAAA,aAAS;AAAA,IAC1B,gBAAAO,EAACN,KAAK,UAAA,YAAA,CAAS;AAAA,IACf,gBAAAM,EAACP,GAAA,EAAQ,IAAG,MAAK,UAAA,iBAAa;AAAA,sBAC7BQ,GAAA,EAAc,GAAGL,GAChB,UAAA,gBAAAI,EAACE,KACC,UAAA,gBAAAF,EAACG,GAAA,EAAiB,cAAc,IAAI,YAAU,IAAC,OAAM,SAAQ,MAAK,QAAA,CAAQ,GAC5E,GACF;AAAA,sBAECX,GAAA,EAAO,SAASD,GAAQ,OAAM,QAAO,UAAA,OAAA,CAEtC;AAAA,EAAA,GACF;AAEJ;"}
1
+ {"version":3,"file":"PayrollEditEmployeePresentation.js","sources":["../../../../src/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.tsx"],"sourcesContent":["import { FormProvider, useForm } from 'react-hook-form'\nimport type { Employee } from '@gusto/embedded-api/models/components/employee'\nimport { useTranslation } from 'react-i18next'\nimport type { PayrollEmployeeCompensationsType } from '@gusto/embedded-api/models/components/payrollemployeecompensationstype'\nimport { z } from 'zod'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { Flex, Grid, TextInputField } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\nimport { Form } from '@/components/Common/Form'\nimport { formatNumberAsCurrency, firstLastName } from '@/helpers/formattedStrings'\nimport {\n COMPENSATION_NAME_DOUBLE_OVERTIME,\n COMPENSATION_NAME_OVERTIME,\n COMPENSATION_NAME_REGULAR_HOURS,\n HOURS_COMPENSATION_NAMES,\n} from '@/shared/constants'\n\ninterface PayrollEditEmployeeProps {\n onSave: (updatedCompensation: PayrollEmployeeCompensationsType) => void\n onCancel: () => void\n employee: Employee\n employeeCompensation?: PayrollEmployeeCompensationsType\n grossPay: number\n isPending?: boolean\n}\n\nexport const PayrollEditEmployeeFormSchema = z.object({\n hourlyCompensations: z.record(z.string(), z.record(z.string(), z.string().optional())),\n})\n\nexport type PayrollEditEmployeeFormValues = z.infer<typeof PayrollEditEmployeeFormSchema>\n\nexport const PayrollEditEmployeePresentation = ({\n onSave,\n onCancel,\n employee,\n grossPay,\n employeeCompensation,\n isPending = false,\n}: PayrollEditEmployeeProps) => {\n const { Button, Heading, Text } = useComponentContext()\n\n const { t } = useTranslation('Payroll.PayrollEditEmployee')\n useI18n('Payroll.PayrollEditEmployee')\n\n const primaryJob = employee.jobs?.find(job => job.primary)\n const hourlyJobs = primaryJob ? [primaryJob] : []\n\n employeeCompensation?.hourlyCompensations?.forEach(compensation => {\n const job = employee.jobs?.find(job => job.uuid === compensation.jobUuid)\n if (job && !hourlyJobs.find(hourlyJob => hourlyJob.uuid === job.uuid)) {\n hourlyJobs.push(job)\n }\n })\n\n const findMatchingCompensation = (jobUuid: string, compensationName: string) => {\n return employeeCompensation?.hourlyCompensations?.find(\n compensation =>\n compensation.jobUuid === jobUuid &&\n compensation.name?.toLowerCase() === compensationName.toLowerCase(),\n )\n }\n\n const getCompensationLabel = (compensationName: string) => {\n switch (compensationName) {\n case COMPENSATION_NAME_REGULAR_HOURS:\n return t('compensationNames.regularHours')\n case COMPENSATION_NAME_OVERTIME:\n return t('compensationNames.overtime')\n case COMPENSATION_NAME_DOUBLE_OVERTIME:\n return t('compensationNames.doubleOvertime')\n default:\n return compensationName\n }\n }\n\n const defaultValues = {\n hourlyCompensations: (() => {\n const compensations: PayrollEditEmployeeFormValues['hourlyCompensations'] = {}\n\n hourlyJobs.forEach(hourlyJob => {\n HOURS_COMPENSATION_NAMES.forEach(compensationName => {\n const matchingCompensation = findMatchingCompensation(hourlyJob.uuid, compensationName)\n if (matchingCompensation) {\n if (!compensations[hourlyJob.uuid]) {\n compensations[hourlyJob.uuid] = {}\n }\n compensations[hourlyJob.uuid]![matchingCompensation.name!] = matchingCompensation.hours\n ? parseFloat(matchingCompensation.hours).toString()\n : ''\n }\n })\n })\n\n return compensations\n })(),\n }\n\n const formHandlers = useForm<PayrollEditEmployeeFormValues>({\n resolver: zodResolver(PayrollEditEmployeeFormSchema),\n defaultValues,\n })\n\n const employeeName = firstLastName({\n first_name: employee.firstName,\n last_name: employee.lastName,\n })\n\n const onSubmit = (data: PayrollEditEmployeeFormValues) => {\n const updatedCompensation = {\n ...employeeCompensation,\n }\n\n updatedCompensation.hourlyCompensations = employeeCompensation?.hourlyCompensations?.map(\n compensation => {\n const hours =\n compensation.jobUuid && compensation.name\n ? data.hourlyCompensations[compensation.jobUuid]?.[compensation.name]\n : undefined\n return hours\n ? {\n ...compensation,\n hours,\n }\n : compensation\n },\n )\n\n onSave(updatedCompensation)\n }\n\n return (\n <Flex flexDirection=\"column\" gap={20}>\n <Flex justifyContent=\"space-between\">\n <Flex flexDirection=\"column\" gap={8}>\n <Heading as=\"h2\">{t('pageTitle', { employeeName })}</Heading>\n <Heading as=\"h1\">{formatNumberAsCurrency(grossPay || 0)}</Heading>\n <Text>{t('grossPayLabel')}</Text>\n </Flex>\n <Flex gap={12} justifyContent=\"flex-end\">\n <Button variant=\"secondary\" onClick={onCancel} title={t('cancelButton')}>\n {t('cancelButton')}\n </Button>\n <Button\n onClick={formHandlers.handleSubmit(onSubmit)}\n title={t('saveButton')}\n isLoading={isPending}\n >\n {t('saveButton')}\n </Button>\n </Flex>\n </Flex>\n <Heading as=\"h3\">{t('regularHoursTitle')}</Heading>\n <FormProvider {...formHandlers}>\n <Form>\n {hourlyJobs.map(hourlyJob => (\n <Flex key={hourlyJob.uuid} flexDirection=\"column\" gap={8}>\n <Heading as=\"h4\">{hourlyJob.title}</Heading>\n <Grid gridTemplateColumns={{ base: '1fr', small: [320, 320] }} gap={20}>\n {HOURS_COMPENSATION_NAMES.map(compensationName => {\n const employeeHourlyCompensation = findMatchingCompensation(\n hourlyJob.uuid,\n compensationName,\n )\n if (employeeHourlyCompensation) {\n return (\n <TextInputField\n key={compensationName}\n type=\"number\"\n adornmentEnd={t('hoursUnit')}\n isRequired\n label={getCompensationLabel(compensationName)}\n name={`hourlyCompensations.${hourlyJob.uuid}.${employeeHourlyCompensation.name}`}\n />\n )\n }\n })}\n </Grid>\n </Flex>\n ))}\n </Form>\n </FormProvider>\n </Flex>\n )\n}\n"],"names":["PayrollEditEmployeeFormSchema","z","PayrollEditEmployeePresentation","onSave","onCancel","employee","grossPay","employeeCompensation","isPending","Button","Heading","Text","useComponentContext","useTranslation","useI18n","primaryJob","job","hourlyJobs","compensation","hourlyJob","findMatchingCompensation","jobUuid","compensationName","getCompensationLabel","COMPENSATION_NAME_REGULAR_HOURS","COMPENSATION_NAME_OVERTIME","COMPENSATION_NAME_DOUBLE_OVERTIME","defaultValues","compensations","HOURS_COMPENSATION_NAMES","matchingCompensation","formHandlers","useForm","zodResolver","employeeName","firstLastName","onSubmit","data","updatedCompensation","hours","jsxs","Flex","jsx","formatNumberAsCurrency","FormProvider","Form","Grid","employeeHourlyCompensation","TextInputField"],"mappings":";;;;;;;;;;;;;AA2BO,MAAMA,IAAgCC,EAAE,OAAO;AAAA,EACpD,qBAAqBA,EAAE,OAAOA,EAAE,OAAA,GAAUA,EAAE,OAAOA,EAAE,OAAA,GAAUA,EAAE,OAAA,EAAS,SAAA,CAAU,CAAC;AACvF,CAAC,GAIYC,KAAkC,CAAC;AAAA,EAC9C,QAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,sBAAAC;AAAA,EACA,WAAAC,IAAY;AACd,MAAgC;AAC9B,QAAM,EAAE,QAAAC,GAAQ,SAAAC,GAAS,MAAAC,EAAA,IAASC,EAAA,GAE5B,EAAE,EAAA,IAAMC,EAAe,6BAA6B;AAC1D,EAAAC,EAAQ,6BAA6B;AAErC,QAAMC,IAAaV,EAAS,MAAM,KAAK,CAAAW,MAAOA,EAAI,OAAO,GACnDC,IAAaF,IAAa,CAACA,CAAU,IAAI,CAAA;AAE/C,EAAAR,GAAsB,qBAAqB,QAAQ,CAAAW,MAAgB;AACjE,UAAMF,IAAMX,EAAS,MAAM,KAAK,CAAAW,MAAOA,EAAI,SAASE,EAAa,OAAO;AACxE,IAAIF,KAAO,CAACC,EAAW,KAAK,OAAaE,EAAU,SAASH,EAAI,IAAI,KAClEC,EAAW,KAAKD,CAAG;AAAA,EAEvB,CAAC;AAED,QAAMI,IAA2B,CAACC,GAAiBC,MAC1Cf,GAAsB,qBAAqB;AAAA,IAChD,CAAA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