@gusto/embedded-react-sdk 0.18.0 → 0.19.0

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 (156) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/assets/icons/icon-error-outline.svg.js +10 -0
  3. package/dist/assets/icons/icon-error-outline.svg.js.map +1 -0
  4. package/dist/assets/icons/icon-info-outline.svg.js +10 -0
  5. package/dist/assets/icons/icon-info-outline.svg.js.map +1 -0
  6. package/dist/assets/icons/icon-zap-fast.svg.js +10 -0
  7. package/dist/assets/icons/icon-zap-fast.svg.js.map +1 -0
  8. package/dist/components/Common/Fieldset/Fieldset.module.scss.js +1 -1
  9. package/dist/components/Common/PaginationControl/PaginationControl.js +6 -6
  10. package/dist/components/Common/PaginationControl/PaginationControl.js.map +1 -1
  11. package/dist/components/Common/RequirementsList/RequirementsList.js +19 -13
  12. package/dist/components/Common/RequirementsList/RequirementsList.js.map +1 -1
  13. package/dist/components/Common/RequirementsList/RequirementsList.module.scss.js +1 -1
  14. package/dist/components/Common/UI/Badge/index.d.ts +2 -0
  15. package/dist/components/Common/UI/Banner/Banner.d.ts +3 -0
  16. package/dist/components/Common/UI/Banner/Banner.js +31 -0
  17. package/dist/components/Common/UI/Banner/Banner.js.map +1 -0
  18. package/dist/components/Common/UI/Banner/Banner.module.scss.js +14 -0
  19. package/dist/components/Common/UI/Banner/Banner.module.scss.js.map +1 -0
  20. package/dist/components/Common/UI/Banner/BannerTypes.d.ts +21 -0
  21. package/dist/components/Common/UI/Banner/BannerTypes.js +7 -0
  22. package/dist/components/Common/UI/Banner/BannerTypes.js.map +1 -0
  23. package/dist/components/Common/UI/Banner/index.d.ts +4 -0
  24. package/dist/components/Common/UI/Breadcrumbs/Breadcrumbs.js +1 -1
  25. package/dist/components/Common/UI/List/List.module.scss.js +2 -2
  26. package/dist/components/Common/UI/ProgressBar/ProgressBar.js +4 -4
  27. package/dist/components/Company/DocumentSigner/DocumentList/ManageSignatories.js +13 -13
  28. package/dist/components/Company/DocumentSigner/DocumentList/ManageSignatories.js.map +1 -1
  29. package/dist/components/Company/FederalTaxes/Form.js +29 -29
  30. package/dist/components/Company/FederalTaxes/Form.js.map +1 -1
  31. package/dist/components/Company/FederalTaxes/Head.js +5 -5
  32. package/dist/components/Company/FederalTaxes/Head.js.map +1 -1
  33. package/dist/components/Contractor/ContractorList/index.js +32 -32
  34. package/dist/components/Contractor/ContractorList/index.js.map +1 -1
  35. package/dist/components/Contractor/Profile/ContractorProfileForm.js +11 -11
  36. package/dist/components/Contractor/Submit/Submit.js +6 -6
  37. package/dist/components/Contractor/Submit/Submit.js.map +1 -1
  38. package/dist/components/Contractor/Submit/SubmitDone.js +8 -8
  39. package/dist/components/Contractor/Submit/SubmitDone.js.map +1 -1
  40. package/dist/components/Employee/Compensation/Edit.js +16 -16
  41. package/dist/components/Employee/Compensation/Edit.js.map +1 -1
  42. package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.d.ts +3 -3
  43. package/dist/components/Employee/EmployeeList/List.js +23 -23
  44. package/dist/components/Employee/EmployeeList/List.js.map +1 -1
  45. package/dist/components/Employee/FederalTaxes/Head.js +1 -1
  46. package/dist/components/Employee/FederalTaxes/Head.js.map +1 -1
  47. package/dist/components/Employee/Landing/Landing.js +17 -16
  48. package/dist/components/Employee/Landing/Landing.js.map +1 -1
  49. package/dist/components/Employee/PaymentMethod/BankAccountsList.js +1 -1
  50. package/dist/components/Employee/PaymentMethod/BankAccountsList.js.map +1 -1
  51. package/dist/components/Employee/Profile/HomeAddress.js +1 -1
  52. package/dist/components/Employee/Profile/HomeAddress.js.map +1 -1
  53. package/dist/components/Employee/Taxes/FederalHead.js +1 -1
  54. package/dist/components/Employee/Taxes/FederalHead.js.map +1 -1
  55. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetails.d.ts +6 -0
  56. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetails.js +57 -0
  57. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetails.js.map +1 -0
  58. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsBanner/ConfirmWireDetailsBanner.d.ts +8 -0
  59. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsBanner/ConfirmWireDetailsBanner.js +79 -0
  60. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsBanner/ConfirmWireDetailsBanner.js.map +1 -0
  61. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsBanner/index.d.ts +2 -0
  62. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsComponents.d.ts +7 -0
  63. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsComponents.js +25 -0
  64. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsComponents.js.map +1 -0
  65. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.d.ts +10 -0
  66. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js +30 -0
  67. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js.map +1 -0
  68. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/index.d.ts +2 -0
  69. package/dist/components/Payroll/ConfirmWireDetails/WireInstructions/WireInstructions.d.ts +10 -0
  70. package/dist/components/Payroll/ConfirmWireDetails/WireInstructions/WireInstructions.js +30 -0
  71. package/dist/components/Payroll/ConfirmWireDetails/WireInstructions/WireInstructions.js.map +1 -0
  72. package/dist/components/Payroll/ConfirmWireDetails/WireInstructions/index.d.ts +2 -0
  73. package/dist/components/Payroll/ConfirmWireDetails/confirmWireDetailsStateMachine.d.ts +13 -0
  74. package/dist/components/Payroll/ConfirmWireDetails/confirmWireDetailsStateMachine.js +63 -0
  75. package/dist/components/Payroll/ConfirmWireDetails/confirmWireDetailsStateMachine.js.map +1 -0
  76. package/dist/components/Payroll/ConfirmWireDetails/index.d.ts +3 -0
  77. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js +1 -1
  78. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js.map +1 -1
  79. package/dist/components/Payroll/PayrollBlocker/payrollHelpers.js +1 -1
  80. package/dist/components/Payroll/PayrollBlocker/payrollHelpers.js.map +1 -1
  81. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +60 -59
  82. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
  83. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js +30 -29
  84. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js.map +1 -1
  85. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +75 -75
  86. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
  87. package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.js +41 -36
  88. package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.js.map +1 -1
  89. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +25 -25
  90. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
  91. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +109 -89
  92. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js.map +1 -1
  93. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.d.ts +6 -1
  94. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +179 -147
  95. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
  96. package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchThresholdExceeded.d.ts +8 -0
  97. package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchThresholdExceeded.js +49 -0
  98. package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchThresholdExceeded.js.map +1 -0
  99. package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/GenericBlocker.d.ts +6 -0
  100. package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/GenericBlocker.js +18 -0
  101. package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/GenericBlocker.js.map +1 -0
  102. package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/index.d.ts +3 -0
  103. package/dist/components/Payroll/index.d.ts +1 -0
  104. package/dist/components/Payroll/index.js +8 -6
  105. package/dist/components/Payroll/index.js.map +1 -1
  106. package/dist/contexts/ComponentAdapter/adapters/defaultComponentAdapter.js +54 -52
  107. package/dist/contexts/ComponentAdapter/adapters/defaultComponentAdapter.js.map +1 -1
  108. package/dist/contexts/ComponentAdapter/componentAdapterTypes.d.ts +1 -0
  109. package/dist/contexts/ComponentAdapter/createComponentsWithDefaults.d.ts +5 -0
  110. package/dist/contexts/ComponentAdapter/createComponentsWithDefaults.js +27 -25
  111. package/dist/contexts/ComponentAdapter/createComponentsWithDefaults.js.map +1 -1
  112. package/dist/contexts/ComponentAdapter/useComponentContext.d.ts +2 -0
  113. package/dist/contexts/ComponentAdapter/useComponentContext.js +3 -3
  114. package/dist/contexts/ComponentAdapter/useComponentContext.js.map +1 -1
  115. package/dist/contexts/ThemeProvider/theme.d.ts +1 -0
  116. package/dist/contexts/ThemeProvider/theme.js +5 -4
  117. package/dist/contexts/ThemeProvider/theme.js.map +1 -1
  118. package/dist/i18n/I18n.js +1 -1
  119. package/dist/i18n/I18n.js.map +1 -1
  120. package/dist/i18n/en/Company.BankAccount.json.js +1 -1
  121. package/dist/i18n/en/Company.DocumentList.json.js +16 -16
  122. package/dist/i18n/en/Company.FederalTaxes.json.js +22 -22
  123. package/dist/i18n/en/Contractor.ContractorList.json.js +8 -8
  124. package/dist/i18n/en/Contractor.Submit.json.js +6 -6
  125. package/dist/i18n/en/Employee.Compensation.json.js +8 -8
  126. package/dist/i18n/en/Employee.Deductions.json.js +51 -51
  127. package/dist/i18n/en/Employee.EmployeeList.json.js +6 -6
  128. package/dist/i18n/en/Employee.FederalTaxes.json.js +3 -3
  129. package/dist/i18n/en/Employee.HomeAddress.json.js +2 -2
  130. package/dist/i18n/en/Employee.OnboardingSummary.json.js +1 -1
  131. package/dist/i18n/en/Employee.PaymentMethod.json.js +11 -11
  132. package/dist/i18n/en/Employee.Taxes.json.js +2 -2
  133. package/dist/i18n/en/Payroll.ConfirmWireDetailsBanner.json.js +14 -0
  134. package/dist/i18n/en/Payroll.ConfirmWireDetailsBanner.json.js.map +1 -0
  135. package/dist/i18n/en/Payroll.ConfirmWireDetailsForm.json.js +10 -0
  136. package/dist/i18n/en/Payroll.ConfirmWireDetailsForm.json.js.map +1 -0
  137. package/dist/i18n/en/Payroll.PayrollBlocker.json.js +3 -3
  138. package/dist/i18n/en/Payroll.PayrollEditEmployee.json.js +4 -4
  139. package/dist/i18n/en/Payroll.PayrollList.json.js +7 -7
  140. package/dist/i18n/en/Payroll.PayrollOverview.json.js +35 -33
  141. package/dist/i18n/en/Payroll.PayrollOverview.json.js.map +1 -1
  142. package/dist/i18n/en/Payroll.PayrollReceipts.json.js +7 -7
  143. package/dist/i18n/en/Payroll.WireInstructions.json.js +10 -0
  144. package/dist/i18n/en/Payroll.WireInstructions.json.js.map +1 -0
  145. package/dist/i18n/en/common.json.d.ts +1 -1
  146. package/dist/i18n/en/common.json.js +1 -1
  147. package/dist/shared/constants.d.ts +13 -0
  148. package/dist/shared/constants.js +56 -47
  149. package/dist/shared/constants.js.map +1 -1
  150. package/dist/style.css +1 -1
  151. package/dist/types/i18next.d.ts +113 -98
  152. package/package.json +9 -10
  153. package/dist/i18n/en/Company.AddBank.json.js +0 -28
  154. package/dist/i18n/en/Company.AddBank.json.js.map +0 -1
  155. package/dist/i18n/en/Payroll.PayrollSchedule.json.js +0 -27
  156. package/dist/i18n/en/Payroll.PayrollSchedule.json.js.map +0 -1
@@ -1,66 +1,67 @@
1
- import { jsx as a } from "react/jsx-runtime";
1
+ import { jsx as n } from "react/jsx-runtime";
2
2
  import { useEmployeesGetSuspense as O } from "@gusto/embedded-api/react-query/employeesGet";
3
3
  import { usePayrollsUpdateMutation as R } from "@gusto/embedded-api/react-query/payrollsUpdate";
4
4
  import { useMemo as U } from "react";
5
5
  import { usePreparedPayrollData as x } from "../usePreparedPayrollData.js";
6
6
  import { PayrollEditEmployeePresentation as Y } from "./PayrollEditEmployeePresentation.js";
7
- import { componentEvents as l } from "../../../shared/constants.js";
8
- import { BaseComponent as g } from "../../Base/Base.js";
9
- import { useComponentDictionary as N } from "../../../i18n/I18n.js";
10
- import { useBase as b } from "../../Base/useBase.js";
7
+ import { componentEvents as p } from "../../../shared/constants.js";
8
+ import { BaseComponent as b } from "../../Base/Base.js";
9
+ import { useComponentDictionary as g } from "../../../i18n/I18n.js";
10
+ import { useBase as N } from "../../Base/useBase.js";
11
11
  function V(e) {
12
- return /* @__PURE__ */ a(g, { ...e, children: /* @__PURE__ */ a(h, { ...e, children: e.children }) });
12
+ return /* @__PURE__ */ n(b, { ...e, children: /* @__PURE__ */ n(h, { ...e, children: e.children }) });
13
13
  }
14
14
  const h = ({
15
15
  employeeId: e,
16
- companyId: n,
16
+ companyId: a,
17
17
  payrollId: s,
18
18
  onEvent: m,
19
- dictionary: p
19
+ dictionary: y
20
20
  }) => {
21
- N("Payroll.PayrollEditEmployee", p);
22
- const { LoadingIndicator: y, baseSubmitHandler: c } = b(), { data: d } = O({ employeeId: e }), u = U(() => [e], []), { preparedPayroll: t, paySchedule: f, isLoading: P } = x({
23
- companyId: n,
21
+ g("Payroll.PayrollEditEmployee", y);
22
+ const { LoadingIndicator: c, baseSubmitHandler: d } = N(), { data: u } = O({ employeeId: e }), f = U(() => [e], []), { preparedPayroll: t, paySchedule: P, isLoading: E } = x({
23
+ companyId: a,
24
24
  payrollId: s,
25
- employeeUuids: u
26
- }), { mutateAsync: E, isPending: C } = R(), i = d.employee, L = t?.employeeCompensations?.at(0), D = ({
25
+ employeeUuids: f
26
+ }), { mutateAsync: C, isPending: L } = R(), i = u.employee, D = t?.employeeCompensations?.at(0), S = ({
27
27
  paymentMethod: o,
28
+ reimbursements: l,
28
29
  ...r
29
30
  }) => ({
30
31
  ...r,
31
32
  ...o && o !== "Historical" ? { paymentMethod: o } : {},
32
33
  memo: r.memo || void 0
33
- }), S = async (o) => {
34
- const r = D(o);
35
- await c(null, async () => {
36
- const A = await E({
34
+ }), _ = async (o) => {
35
+ const l = S(o);
36
+ await d(null, async () => {
37
+ const r = await C({
37
38
  request: {
38
- companyId: n,
39
+ companyId: a,
39
40
  payrollId: s,
40
41
  payrollUpdate: {
41
- employeeCompensations: [r]
42
+ employeeCompensations: [l]
42
43
  }
43
44
  }
44
45
  });
45
- m(l.RUN_PAYROLL_EMPLOYEE_SAVED, {
46
- payrollPrepared: A.payrollPrepared,
46
+ m(p.RUN_PAYROLL_EMPLOYEE_SAVED, {
47
+ payrollPrepared: r.payrollPrepared,
47
48
  employee: i
48
49
  });
49
50
  });
50
- }, _ = () => {
51
- m(l.RUN_PAYROLL_EMPLOYEE_CANCELLED);
51
+ }, A = () => {
52
+ m(p.RUN_PAYROLL_EMPLOYEE_CANCELLED);
52
53
  };
53
- return P ? /* @__PURE__ */ a(y, {}) : /* @__PURE__ */ a(
54
+ return E ? /* @__PURE__ */ n(c, {}) : /* @__PURE__ */ n(
54
55
  Y,
55
56
  {
56
- onSave: S,
57
- onCancel: _,
57
+ onSave: _,
58
+ onCancel: A,
58
59
  employee: i,
59
- isPending: C,
60
- employeeCompensation: L,
60
+ isPending: L,
61
+ employeeCompensation: D,
61
62
  fixedCompensationTypes: t?.fixedCompensationTypes || [],
62
63
  payPeriodStartDate: t?.payPeriod?.startDate,
63
- paySchedule: f,
64
+ paySchedule: P,
64
65
  isOffCycle: t?.offCycle
65
66
  }
66
67
  );
@@ -1 +1 @@
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 { useMemo } from 'react'\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, baseSubmitHandler } = useBase()\n\n const { data: employeeData } = useEmployeesGetSuspense({ employeeId })\n const memoizedEmployeeId = useMemo(() => [employeeId], [])\n const { preparedPayroll, paySchedule, isLoading } = usePreparedPayrollData({\n companyId,\n payrollId,\n employeeUuids: memoizedEmployeeId,\n })\n\n const { mutateAsync: updatePayroll, isPending } = usePayrollsUpdateMutation()\n\n const employee = employeeData.employee!\n const employeeCompensation = preparedPayroll?.employeeCompensations?.at(0)\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 await baseSubmitHandler(null, async () => {\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, {\n payrollPrepared: result.payrollPrepared,\n employee,\n })\n })\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 employeeCompensation={employeeCompensation}\n fixedCompensationTypes={preparedPayroll?.fixedCompensationTypes || []}\n payPeriodStartDate={preparedPayroll?.payPeriod?.startDate}\n paySchedule={paySchedule}\n isOffCycle={preparedPayroll?.offCycle}\n />\n )\n}\n"],"names":["PayrollEditEmployee","props","jsx","BaseComponent","Root","employeeId","companyId","payrollId","onEvent","dictionary","useComponentDictionary","LoadingIndicator","baseSubmitHandler","useBase","employeeData","useEmployeesGetSuspense","memoizedEmployeeId","useMemo","preparedPayroll","paySchedule","isLoading","usePreparedPayrollData","updatePayroll","isPending","usePayrollsUpdateMutation","employee","employeeCompensation","transformEmployeeCompensation","paymentMethod","compensation","onSave","updatedCompensation","transformedCompensation","result","componentEvents","onCancel","PayrollEditEmployeePresentation"],"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;AAAA,EACA,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,SAAAC;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AiB,IAIzB,gBAAAT;AAAA,IAACkC;AAAA,IAAA;AAAA,MACC,QAAAN;AAAA,MACA,UAAAK;AAAA,MACA,UAAAV;AAAA,MACA,WAAAF;AAAA,MACA,sBAAAG;AAAA,MACA,wBAAwBR,GAAiB,0BAA0B,CAAA;AAAA,MACnE,oBAAoBA,GAAiB,WAAW;AAAA,MAChD,aAAAC;AAAA,MACA,YAAYD,GAAiB;AAAA,IAAA;AAAA,EAAA;AAGnC;"}
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 { useMemo } from 'react'\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, baseSubmitHandler } = useBase()\n\n const { data: employeeData } = useEmployeesGetSuspense({ employeeId })\n const memoizedEmployeeId = useMemo(() => [employeeId], [])\n const { preparedPayroll, paySchedule, isLoading } = usePreparedPayrollData({\n companyId,\n payrollId,\n employeeUuids: memoizedEmployeeId,\n })\n\n const { mutateAsync: updatePayroll, isPending } = usePayrollsUpdateMutation()\n\n const employee = employeeData.employee!\n const employeeCompensation = preparedPayroll?.employeeCompensations?.at(0)\n\n const transformEmployeeCompensation = ({\n paymentMethod,\n reimbursements,\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 await baseSubmitHandler(null, async () => {\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, {\n payrollPrepared: result.payrollPrepared,\n employee,\n })\n })\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 employeeCompensation={employeeCompensation}\n fixedCompensationTypes={preparedPayroll?.fixedCompensationTypes || []}\n payPeriodStartDate={preparedPayroll?.payPeriod?.startDate}\n paySchedule={paySchedule}\n isOffCycle={preparedPayroll?.offCycle}\n />\n )\n}\n"],"names":["PayrollEditEmployee","props","jsx","BaseComponent","Root","employeeId","companyId","payrollId","onEvent","dictionary","useComponentDictionary","LoadingIndicator","baseSubmitHandler","useBase","employeeData","useEmployeesGetSuspense","memoizedEmployeeId","useMemo","preparedPayroll","paySchedule","isLoading","usePreparedPayrollData","updatePayroll","isPending","usePayrollsUpdateMutation","employee","employeeCompensation","transformEmployeeCompensation","paymentMethod","reimbursements","compensation","onSave","updatedCompensation","transformedCompensation","result","componentEvents","onCancel","PayrollEditEmployeePresentation"],"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;AAAA,EACA,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,SAAAC;AAAA,EACA,YAAAC;AACF,MAAgC;AAC9B,EAAAC,EAAuB,+BAA+BD,CAAU;AAEhE,QAAM,EAAE,kBAAAE,GAAkB,mBAAAC,EAAA,IAAsBC,EAAA,GAE1C,EAAE,MAAMC,EAAA,IAAiBC,EAAwB,EAAE,YAAAV,GAAY,GAC/DW,IAAqBC,EAAQ,MAAM,CAACZ,CAAU,GAAG,CAAA,CAAE,GACnD,EAAE,iBAAAa,GAAiB,aAAAC,GAAa,WAAAC,EAAA,IAAcC,EAAuB;AAAA,IACzE,WAAAf;AAAA,IACA,WAAAC;AAAA,IACA,eAAeS;AAAA,EAAA,CAChB,GAEK,EAAE,aAAaM,GAAe,WAAAC,EAAA,IAAcC,EAAA,GAE5CC,IAAWX,EAAa,UACxBY,IAAuBR,GAAiB,uBAAuB,GAAG,CAAC,GAEnES,IAAgC,CAAC;AAAA,IACrC,eAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,OAEI;AAAA,IACL,GAAGA;AAAA,IACH,GAAIF,KAAiBA,MAAkB,eAAe,EAAE,eAAAA,EAAA,IAAkB,CAAA;AAAA,IAC1E,MAAME,EAAa,QAAQ;AAAA,EAAA,IAIzBC,IAAS,OAAOC,MAA0D;AAC9E,UAAMC,IAA0BN,EAA8BK,CAAmB;AACjF,UAAMpB,EAAkB,MAAM,YAAY;AACxC,YAAMsB,IAAS,MAAMZ,EAAc;AAAA,QACjC,SAAS;AAAA,UACP,WAAAhB;AAAA,UACA,WAAAC;AAAA,UACA,eAAe;AAAA,YACb,uBAAuB,CAAC0B,CAAuB;AAAA,UAAA;AAAA,QACjD;AAAA,MACF,CACD;AAED,MAAAzB,EAAQ2B,EAAgB,4BAA4B;AAAA,QAClD,iBAAiBD,EAAO;AAAA,QACxB,UAAAT;AAAA,MAAA,CACD;AAAA,IACH,CAAC;AAAA,EACH,GAEMW,IAAW,MAAM;AACrB,IAAA5B,EAAQ2B,EAAgB,8BAA8B;AAAA,EACxD;AAEA,SAAIf,sBACMT,GAAA,EAAiB,IAIzB,gBAAAT;AAAA,IAACmC;AAAA,IAAA;AAAA,MACC,QAAAN;AAAA,MACA,UAAAK;AAAA,MACA,UAAAX;AAAA,MACA,WAAAF;AAAA,MACA,sBAAAG;AAAA,MACA,wBAAwBR,GAAiB,0BAA0B,CAAA;AAAA,MACnE,oBAAoBA,GAAiB,WAAW;AAAA,MAChD,aAAAC;AAAA,MACA,YAAYD,GAAiB;AAAA,IAAA;AAAA,EAAA;AAGnC;"}
@@ -1,4 +1,4 @@
1
- import { jsxs as a, jsx as o } from "react/jsx-runtime";
1
+ import { jsxs as a, jsx as r } from "react/jsx-runtime";
2
2
  import { useForm as W, useWatch as Y, FormProvider as K } from "react-hook-form";
3
3
  import { useRef as X, useMemo as Q } from "react";
4
4
  import { PayrollEmployeeCompensationsTypePaymentMethod as A } from "@gusto/embedded-api/models/components/payrollemployeecompensationstype";
@@ -11,9 +11,9 @@ import { Flex as y } from "../../Common/Flex/Flex.js";
11
11
  import { Grid as S } from "../../Common/Grid/Grid.js";
12
12
  import { useComponentContext as te } from "../../../contexts/ComponentAdapter/useComponentContext.js";
13
13
  import { useI18n as ne } from "../../../i18n/I18n.js";
14
- import { Form as oe } from "../../Common/Form/Form.js";
15
- import { firstLastName as re, formatNumberAsCurrency as se } from "../../../helpers/formattedStrings.js";
16
- import { getAdditionalEarningsCompensations as ie, getReimbursementCompensation as ae, calculateGrossPay as G } from "../helpers.js";
14
+ import { Form as re } from "../../Common/Form/Form.js";
15
+ import { firstLastName as se, formatNumberAsCurrency as ie } from "../../../helpers/formattedStrings.js";
16
+ import { getAdditionalEarningsCompensations as oe, getReimbursementCompensation as ae, calculateGrossPay as G } from "../helpers.js";
17
17
  import { HOURS_COMPENSATION_NAMES as k, EXCLUDED_ADDITIONAL_EARNINGS as me, COMPENSATION_NAME_DOUBLE_OVERTIME as le, COMPENSATION_NAME_OVERTIME as de, COMPENSATION_NAME_REGULAR_HOURS as ue, COMPENSATION_NAME_REIMBURSEMENT as ce, COMPENSATION_NAME_CASH_TIPS as pe, COMPENSATION_NAME_COMMISSION as fe, COMPENSATION_NAME_CORRECTION_PAYMENT as he, COMPENSATION_NAME_PAYCHECK_TIPS as Ce, COMPENSATION_NAME_BONUS as Ne } from "../../../shared/constants.js";
18
18
  import { useContainerBreakpoints as Ee } from "../../../hooks/useContainerBreakpoints/useContainerBreakpoints.js";
19
19
  import { TextInputField as R } from "../../Common/Fields/TextInputField/TextInputField.js";
@@ -23,71 +23,71 @@ const be = m.object({
23
23
  timeOffCompensations: m.record(m.string(), m.string().optional()),
24
24
  fixedCompensations: m.record(m.string(), m.string().optional()),
25
25
  paymentMethod: m.nativeEnum(A).optional()
26
- }), w = (E, O, d, s) => {
26
+ }), w = (E, O, d, i) => {
27
27
  const g = {
28
28
  ...O,
29
29
  paymentMethod: E.paymentMethod
30
30
  };
31
31
  g.hourlyCompensations = O?.hourlyCompensations?.map(
32
- (r) => {
33
- const l = r.jobUuid && r.name ? E.hourlyCompensations[r.jobUuid]?.[r.name] : void 0;
32
+ (s) => {
33
+ const l = s.jobUuid && s.name ? E.hourlyCompensations[s.jobUuid]?.[s.name] : void 0;
34
34
  return l ? {
35
- ...r,
35
+ ...s,
36
36
  hours: l
37
- } : r;
37
+ } : s;
38
38
  }
39
- ), g.paidTimeOff = d.map((r) => ({
40
- ...r,
41
- hours: E.timeOffCompensations[r.name]
39
+ ), g.paidTimeOff = d.map((s) => ({
40
+ ...s,
41
+ hours: E.timeOffCompensations[s.name]
42
42
  }));
43
43
  const b = [];
44
- return Object.entries(E.fixedCompensations).forEach(([r, l]) => {
44
+ return Object.entries(E.fixedCompensations).forEach(([s, l]) => {
45
45
  const C = O?.fixedCompensations?.find(
46
- (x) => x.name?.toLowerCase() === r.toLowerCase()
46
+ (x) => x.name?.toLowerCase() === s.toLowerCase()
47
47
  );
48
48
  l && (C ? b.push({
49
49
  name: C.name,
50
50
  jobUuid: C.jobUuid,
51
51
  amount: l
52
52
  }) : parseFloat(l) !== 0 && b.push({
53
- name: r,
54
- jobUuid: s,
53
+ name: s,
54
+ jobUuid: i,
55
55
  amount: l
56
56
  }));
57
57
  }), g.fixedCompensations = b, g;
58
- }, He = ({
58
+ }, $e = ({
59
59
  onSave: E,
60
60
  onCancel: O,
61
61
  employee: d,
62
- employeeCompensation: s,
62
+ employeeCompensation: i,
63
63
  isPending: g = !1,
64
64
  fixedCompensationTypes: b,
65
- payPeriodStartDate: r,
65
+ payPeriodStartDate: s,
66
66
  paySchedule: l,
67
67
  isOffCycle: C = !1
68
68
  }) => {
69
- const { Button: x, Heading: c, Text: B } = te(), { t } = Z("Payroll.PayrollEditEmployee");
69
+ const { Button: x, Heading: c, Text: H } = te(), { t } = Z("Payroll.PayrollEditEmployee");
70
70
  ne("Payroll.PayrollEditEmployee");
71
71
  const f = d.jobs?.find((e) => e.primary), T = f ? [f] : [], v = X(null), p = Ee({
72
72
  ref: v
73
73
  }).includes("small");
74
- s?.hourlyCompensations?.forEach((e) => {
75
- const n = d.jobs?.find((i) => i.uuid === e.jobUuid);
76
- n && !T.find((i) => i.uuid === n.uuid) && T.push(n);
74
+ i?.hourlyCompensations?.forEach((e) => {
75
+ const n = d.jobs?.find((o) => o.uuid === e.jobUuid);
76
+ n && !T.find((o) => o.uuid === n.uuid) && T.push(n);
77
77
  });
78
- const P = (s?.paidTimeOff || []).filter((e) => e.name), _ = ie({
78
+ const P = (i?.paidTimeOff || []).filter((e) => e.name), _ = oe({
79
79
  flsaStatus: f?.compensations?.[0]?.flsaStatus,
80
- existingFixedCompensations: s?.fixedCompensations || [],
80
+ existingFixedCompensations: i?.fixedCompensations || [],
81
81
  primaryJobUuid: f?.uuid,
82
82
  fixedCompensationTypes: b,
83
83
  excludedTypes: me
84
84
  }), N = ae(
85
- s?.fixedCompensations || [],
85
+ i?.fixedCompensations || [],
86
86
  b,
87
87
  f?.uuid
88
- ), F = (e, n) => s?.hourlyCompensations?.find(
89
- (i) => i.jobUuid === e && i.name?.toLowerCase() === n.toLowerCase()
90
- ), H = (e) => {
88
+ ), F = (e, n) => i?.hourlyCompensations?.find(
89
+ (o) => o.jobUuid === e && o.name?.toLowerCase() === n.toLowerCase()
90
+ ), $ = (e) => {
91
91
  switch (e) {
92
92
  case ue:
93
93
  return t("compensationNames.regularHours");
@@ -115,12 +115,12 @@ const be = m.object({
115
115
  default:
116
116
  return e;
117
117
  }
118
- }, $ = {
118
+ }, B = {
119
119
  hourlyCompensations: (() => {
120
120
  const e = {};
121
121
  return T.forEach((n) => {
122
- k.forEach((i) => {
123
- const h = F(n.uuid, i);
122
+ k.forEach((o) => {
123
+ const h = F(n.uuid, o);
124
124
  h && (e[n.uuid] || (e[n.uuid] = {}), e[n.uuid][h.name] = h.hours ? parseFloat(h.hours).toString() : "");
125
125
  });
126
126
  }), e;
@@ -137,10 +137,10 @@ const be = m.object({
137
137
  e[n.name] = n.amount ? n.amount : "";
138
138
  }), N && (e[N.name] = N.amount ? N.amount : ""), e;
139
139
  })(),
140
- paymentMethod: s?.paymentMethod || A.DirectDeposit
140
+ paymentMethod: i?.paymentMethod || A.DirectDeposit
141
141
  }, I = W({
142
142
  resolver: J(be),
143
- defaultValues: $
143
+ defaultValues: B
144
144
  }), M = Y({
145
145
  control: I.control
146
146
  }), q = Q(() => {
@@ -154,48 +154,48 @@ const be = m.object({
154
154
  timeOffCompensations: M.timeOffCompensations || {},
155
155
  fixedCompensations: M.fixedCompensations || {},
156
156
  paymentMethod: M.paymentMethod
157
- }, i = w(
157
+ }, o = w(
158
158
  n,
159
- s,
160
- (s?.paidTimeOff || []).filter((h) => h.name),
159
+ i,
160
+ (i?.paidTimeOff || []).filter((h) => h.name),
161
161
  f?.uuid
162
162
  );
163
163
  return G(
164
- i,
164
+ o,
165
165
  d,
166
- r,
166
+ s,
167
167
  l,
168
168
  C
169
169
  );
170
170
  } catch {
171
- return s ? G(
172
- s,
171
+ return i ? G(
172
+ i,
173
173
  d,
174
- r,
174
+ s,
175
175
  l,
176
176
  C
177
177
  ) : 0;
178
178
  }
179
179
  }, [
180
180
  M,
181
- s,
181
+ i,
182
182
  f?.uuid,
183
183
  d,
184
- r,
184
+ s,
185
185
  l,
186
186
  C
187
- ]), V = re({
187
+ ]), V = se({
188
188
  first_name: d.firstName,
189
189
  last_name: d.lastName
190
190
  }), z = (e) => {
191
191
  const n = w(
192
192
  e,
193
- s,
193
+ i,
194
194
  P,
195
195
  f?.uuid
196
196
  );
197
197
  E(n);
198
- }, L = se(q || 0), U = /* @__PURE__ */ a(
198
+ }, L = ie(q || 0), U = /* @__PURE__ */ a(
199
199
  y,
200
200
  {
201
201
  flexDirection: p ? "row" : "column",
@@ -203,56 +203,56 @@ const be = m.object({
203
203
  alignItems: p ? "flex-start" : "stretch",
204
204
  gap: 12,
205
205
  children: [
206
- /* @__PURE__ */ o(x, { variant: "secondary", onClick: O, title: t("cancelButton"), children: t("cancelButton") }),
207
- /* @__PURE__ */ o(
206
+ /* @__PURE__ */ r(x, { variant: "secondary", onClick: O, title: t("cancelCta"), children: t("cancelCta") }),
207
+ /* @__PURE__ */ r(
208
208
  x,
209
209
  {
210
210
  onClick: I.handleSubmit(z),
211
- title: t("saveButton"),
211
+ title: t("saveCta"),
212
212
  isLoading: g,
213
- children: t("saveButton")
213
+ children: t("saveCta")
214
214
  }
215
215
  )
216
216
  ]
217
217
  }
218
218
  );
219
219
  return /* @__PURE__ */ a("div", { ref: v, className: u.container, children: [
220
- /* @__PURE__ */ o(
220
+ /* @__PURE__ */ r(
221
221
  "div",
222
222
  {
223
223
  className: `${u.headerSection} ${p ? "" : u.headerSectionSticky}`,
224
224
  children: /* @__PURE__ */ a(y, { justifyContent: "space-between", children: [
225
225
  /* @__PURE__ */ a(y, { flexDirection: "column", gap: p ? 8 : 2, children: [
226
- /* @__PURE__ */ o(c, { as: "h1", styledAs: p ? "h2" : "h4", children: t("pageTitle", { employeeName: V }) }),
226
+ /* @__PURE__ */ r(c, { as: "h1", styledAs: p ? "h2" : "h4", children: t("pageTitle", { employeeName: V }) }),
227
227
  p ? /* @__PURE__ */ a(y, { flexDirection: "column", gap: 6, children: [
228
- /* @__PURE__ */ o(c, { as: "h2", styledAs: "h3", children: L }),
229
- /* @__PURE__ */ o(B, { className: u.grossPayLabel, children: t("grossPayLabel") })
230
- ] }) : /* @__PURE__ */ o(c, { as: "h2", styledAs: "h6", className: u.grossPayLabel, children: t("grossPayLabelMobile", { grossPay: L }) })
228
+ /* @__PURE__ */ r(c, { as: "h2", styledAs: "h3", children: L }),
229
+ /* @__PURE__ */ r(H, { className: u.grossPayLabel, children: t("grossPayLabel") })
230
+ ] }) : /* @__PURE__ */ r(c, { as: "h2", styledAs: "h6", className: u.grossPayLabel, children: t("grossPayLabelMobile", { grossPay: L }) })
231
231
  ] }),
232
232
  p && U
233
233
  ] })
234
234
  }
235
235
  ),
236
236
  /* @__PURE__ */ a(K, { ...I, children: [
237
- /* @__PURE__ */ a(oe, { children: [
237
+ /* @__PURE__ */ a(re, { children: [
238
238
  T.length > 0 && /* @__PURE__ */ a("div", { className: u.fieldGroup, children: [
239
- /* @__PURE__ */ o(c, { as: "h3", children: t("regularHoursTitle") }),
239
+ /* @__PURE__ */ r(c, { as: "h3", children: t("regularHoursTitle") }),
240
240
  T.map((e) => /* @__PURE__ */ a(y, { flexDirection: "column", gap: 8, children: [
241
- /* @__PURE__ */ o(c, { as: "h4", children: e.title }),
242
- /* @__PURE__ */ o(S, { gridTemplateColumns: { base: "1fr", small: [320, 320] }, gap: 20, children: k.map((n) => {
243
- const i = F(
241
+ /* @__PURE__ */ r(c, { as: "h4", children: e.title }),
242
+ /* @__PURE__ */ r(S, { gridTemplateColumns: { base: "1fr", small: [320, 320] }, gap: 20, children: k.map((n) => {
243
+ const o = F(
244
244
  e.uuid,
245
245
  n
246
246
  );
247
- if (i)
248
- return /* @__PURE__ */ o(
247
+ if (o)
248
+ return /* @__PURE__ */ r(
249
249
  R,
250
250
  {
251
251
  type: "number",
252
252
  adornmentEnd: t("hoursUnit"),
253
253
  isRequired: !0,
254
- label: H(n),
255
- name: `hourlyCompensations.${e.uuid}.${i.name}`
254
+ label: $(n),
255
+ name: `hourlyCompensations.${e.uuid}.${o.name}`
256
256
  },
257
257
  n
258
258
  );
@@ -260,8 +260,8 @@ const be = m.object({
260
260
  ] }, e.uuid))
261
261
  ] }),
262
262
  P.length > 0 && /* @__PURE__ */ a("div", { className: u.fieldGroup, children: [
263
- /* @__PURE__ */ o(c, { as: "h4", children: t("timeOffTitle") }),
264
- /* @__PURE__ */ o(S, { gridTemplateColumns: { base: "1fr", small: [320, 320] }, gap: 20, children: P.map((e) => /* @__PURE__ */ o(
263
+ /* @__PURE__ */ r(c, { as: "h4", children: t("timeOffTitle") }),
264
+ /* @__PURE__ */ r(S, { gridTemplateColumns: { base: "1fr", small: [320, 320] }, gap: 20, children: P.map((e) => /* @__PURE__ */ r(
265
265
  ee,
266
266
  {
267
267
  timeOff: e,
@@ -271,13 +271,13 @@ const be = m.object({
271
271
  )) })
272
272
  ] }),
273
273
  _.length > 0 && /* @__PURE__ */ a("div", { className: u.fieldGroup, children: [
274
- /* @__PURE__ */ o(c, { as: "h4", children: t("additionalEarningsTitle") }),
275
- /* @__PURE__ */ o(
274
+ /* @__PURE__ */ r(c, { as: "h4", children: t("additionalEarningsTitle") }),
275
+ /* @__PURE__ */ r(
276
276
  S,
277
277
  {
278
278
  gridTemplateColumns: { base: "1fr", small: [320, 320], large: [320, 320, 320] },
279
279
  gap: 20,
280
- children: _.map((e) => /* @__PURE__ */ o(
280
+ children: _.map((e) => /* @__PURE__ */ r(
281
281
  R,
282
282
  {
283
283
  type: "number",
@@ -292,8 +292,8 @@ const be = m.object({
292
292
  )
293
293
  ] }),
294
294
  N && /* @__PURE__ */ a("div", { className: u.fieldGroup, children: [
295
- /* @__PURE__ */ o(c, { as: "h4", children: t("reimbursementTitle") }),
296
- /* @__PURE__ */ o(S, { gridTemplateColumns: { base: "1fr", small: [320, 320] }, gap: 20, children: /* @__PURE__ */ o(
295
+ /* @__PURE__ */ r(c, { as: "h4", children: t("reimbursementTitle") }),
296
+ /* @__PURE__ */ r(S, { gridTemplateColumns: { base: "1fr", small: [320, 320] }, gap: 20, children: /* @__PURE__ */ r(
297
297
  R,
298
298
  {
299
299
  type: "number",
@@ -305,8 +305,8 @@ const be = m.object({
305
305
  ) })
306
306
  ] }),
307
307
  /* @__PURE__ */ a("div", { className: u.fieldGroup, children: [
308
- /* @__PURE__ */ o(c, { as: "h4", children: t("paymentMethodTitle") }),
309
- /* @__PURE__ */ o(
308
+ /* @__PURE__ */ r(c, { as: "h4", children: t("paymentMethodTitle") }),
309
+ /* @__PURE__ */ r(
310
310
  ge,
311
311
  {
312
312
  name: "paymentMethod",
@@ -333,6 +333,6 @@ const be = m.object({
333
333
  };
334
334
  export {
335
335
  be as PayrollEditEmployeeFormSchema,
336
- He as PayrollEditEmployeePresentation
336
+ $e as PayrollEditEmployeePresentation
337
337
  };
338
338
  //# sourceMappingURL=PayrollEditEmployeePresentation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PayrollEditEmployeePresentation.js","sources":["../../../../src/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.tsx"],"sourcesContent":["import { FormProvider, useForm, useWatch } from 'react-hook-form'\nimport { useMemo, useRef } from 'react'\nimport type { Employee } from '@gusto/embedded-api/models/components/employee'\nimport type {\n FixedCompensations,\n PayrollEmployeeCompensationsType,\n} from '@gusto/embedded-api/models/components/payrollemployeecompensationstype'\nimport { PayrollEmployeeCompensationsTypePaymentMethod } from '@gusto/embedded-api/models/components/payrollemployeecompensationstype'\nimport type { PayrollFixedCompensationTypesType } from '@gusto/embedded-api/models/components/payrollfixedcompensationtypestype'\nimport type { PayScheduleObject } from '@gusto/embedded-api/models/components/payscheduleobject'\nimport { useTranslation } from 'react-i18next'\nimport { z } from 'zod'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport styles from './PayrollEditEmployeePresentation.module.scss'\nimport { TimeOffField } from './TimeOffField'\nimport { Flex, Grid, TextInputField, RadioGroupField } 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 getAdditionalEarningsCompensations,\n getReimbursementCompensation,\n calculateGrossPay,\n} from '@/components/Payroll/helpers'\nimport {\n COMPENSATION_NAME_DOUBLE_OVERTIME,\n COMPENSATION_NAME_OVERTIME,\n COMPENSATION_NAME_REGULAR_HOURS,\n HOURS_COMPENSATION_NAMES,\n EXCLUDED_ADDITIONAL_EARNINGS,\n COMPENSATION_NAME_REIMBURSEMENT,\n COMPENSATION_NAME_BONUS,\n COMPENSATION_NAME_PAYCHECK_TIPS,\n COMPENSATION_NAME_CORRECTION_PAYMENT,\n COMPENSATION_NAME_COMMISSION,\n COMPENSATION_NAME_CASH_TIPS,\n} from '@/shared/constants'\nimport useContainerBreakpoints from '@/hooks/useContainerBreakpoints/useContainerBreakpoints'\n\ninterface PayrollEditEmployeeProps {\n onSave: (updatedCompensation: PayrollEmployeeCompensationsType) => void\n onCancel: () => void\n employee: Employee\n employeeCompensation?: PayrollEmployeeCompensationsType\n isPending?: boolean\n fixedCompensationTypes: PayrollFixedCompensationTypesType[]\n payPeriodStartDate?: string\n paySchedule?: PayScheduleObject\n isOffCycle?: boolean\n}\n\nexport const PayrollEditEmployeeFormSchema = z.object({\n hourlyCompensations: z.record(z.string(), z.record(z.string(), z.string().optional())),\n timeOffCompensations: z.record(z.string(), z.string().optional()),\n fixedCompensations: z.record(z.string(), z.string().optional()),\n paymentMethod: z.nativeEnum(PayrollEmployeeCompensationsTypePaymentMethod).optional(),\n})\n\nexport type PayrollEditEmployeeFormValues = z.infer<typeof PayrollEditEmployeeFormSchema>\n\nconst buildCompensationFromFormData = (\n formData: PayrollEditEmployeeFormValues,\n employeeCompensation: PayrollEmployeeCompensationsType | undefined,\n timeOff: Array<{ name?: string; hours?: string }>,\n primaryJobUuid?: string,\n): PayrollEmployeeCompensationsType => {\n const updatedCompensation = {\n ...employeeCompensation,\n paymentMethod: formData.paymentMethod,\n }\n\n updatedCompensation.hourlyCompensations = employeeCompensation?.hourlyCompensations?.map(\n compensation => {\n const hours =\n compensation.jobUuid && compensation.name\n ? formData.hourlyCompensations[compensation.jobUuid]?.[compensation.name]\n : undefined\n return hours\n ? {\n ...compensation,\n hours,\n }\n : compensation\n },\n )\n\n updatedCompensation.paidTimeOff = timeOff.map(timeOffEntry => {\n return {\n ...timeOffEntry,\n hours: formData.timeOffCompensations[timeOffEntry.name!],\n }\n })\n\n const updatedFixedCompensations: FixedCompensations[] = []\n\n Object.entries(formData.fixedCompensations).forEach(([fixedCompensationName, formAmount]) => {\n const existingFixedCompensation = employeeCompensation?.fixedCompensations?.find(\n fixedCompensation =>\n fixedCompensation.name?.toLowerCase() === fixedCompensationName.toLowerCase(),\n )\n\n if (formAmount) {\n if (existingFixedCompensation) {\n updatedFixedCompensations.push({\n name: existingFixedCompensation.name,\n jobUuid: existingFixedCompensation.jobUuid,\n amount: formAmount,\n })\n } else if (parseFloat(formAmount) !== 0) {\n updatedFixedCompensations.push({\n name: fixedCompensationName,\n jobUuid: primaryJobUuid,\n amount: formAmount,\n })\n }\n }\n })\n\n updatedCompensation.fixedCompensations = updatedFixedCompensations\n\n return updatedCompensation\n}\n\nexport const PayrollEditEmployeePresentation = ({\n onSave,\n onCancel,\n employee,\n employeeCompensation,\n isPending = false,\n fixedCompensationTypes,\n payPeriodStartDate,\n paySchedule,\n isOffCycle = 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 const containerRef = useRef<HTMLDivElement>(null)\n const breakpoints = useContainerBreakpoints({\n ref: containerRef,\n })\n const isSmallOrGreater = breakpoints.includes('small')\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 timeOff = (employeeCompensation?.paidTimeOff || []).filter(entry => entry.name)\n\n const additionalEarnings = getAdditionalEarningsCompensations({\n flsaStatus: primaryJob?.compensations?.[0]?.flsaStatus,\n existingFixedCompensations: employeeCompensation?.fixedCompensations || [],\n primaryJobUuid: primaryJob?.uuid,\n fixedCompensationTypes,\n excludedTypes: EXCLUDED_ADDITIONAL_EARNINGS,\n })\n\n const reimbursement = getReimbursementCompensation(\n employeeCompensation?.fixedCompensations || [],\n fixedCompensationTypes,\n primaryJob?.uuid,\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 getFixedCompensationLabel = (compensationName?: string) => {\n switch (compensationName) {\n case COMPENSATION_NAME_BONUS:\n return t('fixedCompensationNames.bonus')\n case COMPENSATION_NAME_PAYCHECK_TIPS:\n return t('fixedCompensationNames.paycheckTips')\n case COMPENSATION_NAME_CORRECTION_PAYMENT:\n return t('fixedCompensationNames.correctionPayment')\n case COMPENSATION_NAME_COMMISSION:\n return t('fixedCompensationNames.commission')\n case COMPENSATION_NAME_CASH_TIPS:\n return t('fixedCompensationNames.cashTips')\n case COMPENSATION_NAME_REIMBURSEMENT:\n return t('fixedCompensationNames.reimbursement')\n default:\n return compensationName\n }\n }\n\n const defaultValues = {\n hourlyCompensations: (() => {\n const hourlyCompensations: 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 (!hourlyCompensations[hourlyJob.uuid]) {\n hourlyCompensations[hourlyJob.uuid] = {}\n }\n hourlyCompensations[hourlyJob.uuid]![matchingCompensation.name!] =\n matchingCompensation.hours ? parseFloat(matchingCompensation.hours).toString() : ''\n }\n })\n })\n\n return hourlyCompensations\n })(),\n\n timeOffCompensations: (() => {\n const timeOffCompensations: PayrollEditEmployeeFormValues['timeOffCompensations'] = {}\n\n timeOff.forEach(timeOffCompensation => {\n timeOffCompensations[timeOffCompensation.name!] = timeOffCompensation.hours\n ? parseFloat(timeOffCompensation.hours).toString()\n : ''\n })\n\n return timeOffCompensations\n })(),\n\n fixedCompensations: (() => {\n const fixedCompensations: PayrollEditEmployeeFormValues['fixedCompensations'] = {}\n\n additionalEarnings.forEach(fixedComp => {\n fixedCompensations[fixedComp.name!] = fixedComp.amount ? fixedComp.amount : ''\n })\n\n if (reimbursement) {\n fixedCompensations[reimbursement.name!] = reimbursement.amount ? reimbursement.amount : ''\n }\n\n return fixedCompensations\n })(),\n\n paymentMethod:\n employeeCompensation?.paymentMethod ||\n PayrollEmployeeCompensationsTypePaymentMethod.DirectDeposit,\n }\n\n const formHandlers = useForm<PayrollEditEmployeeFormValues>({\n resolver: zodResolver(PayrollEditEmployeeFormSchema),\n defaultValues,\n })\n\n const watchedFormData = useWatch({\n control: formHandlers.control,\n })\n\n const currentGrossPay = useMemo(() => {\n try {\n // Build form data, filtering out undefined nested objects\n const hourlyCompensations: Record<string, Record<string, string | undefined>> = {}\n if (watchedFormData.hourlyCompensations) {\n Object.entries(watchedFormData.hourlyCompensations).forEach(([jobId, compensations]) => {\n if (compensations) {\n hourlyCompensations[jobId] = compensations\n }\n })\n }\n\n const formDataWithDefaults: PayrollEditEmployeeFormValues = {\n hourlyCompensations,\n timeOffCompensations: watchedFormData.timeOffCompensations || {},\n fixedCompensations: watchedFormData.fixedCompensations || {},\n paymentMethod: watchedFormData.paymentMethod,\n }\n\n const updatedCompensation = buildCompensationFromFormData(\n formDataWithDefaults,\n employeeCompensation,\n (employeeCompensation?.paidTimeOff || []).filter(entry => entry.name),\n primaryJob?.uuid,\n )\n\n return calculateGrossPay(\n updatedCompensation,\n employee,\n payPeriodStartDate,\n paySchedule,\n isOffCycle,\n )\n } catch {\n // Fallback to original compensation on error\n return employeeCompensation\n ? calculateGrossPay(\n employeeCompensation,\n employee,\n payPeriodStartDate,\n paySchedule,\n isOffCycle,\n )\n : 0\n }\n }, [\n watchedFormData,\n employeeCompensation,\n primaryJob?.uuid,\n employee,\n payPeriodStartDate,\n paySchedule,\n isOffCycle,\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 = buildCompensationFromFormData(\n data,\n employeeCompensation,\n timeOff,\n primaryJob?.uuid,\n )\n onSave(updatedCompensation)\n }\n\n const formattedCurrentGrossPay = formatNumberAsCurrency(currentGrossPay || 0)\n\n const actions = (\n <Flex\n flexDirection={isSmallOrGreater ? 'row' : 'column'}\n justifyContent={isSmallOrGreater ? 'flex-end' : 'normal'}\n alignItems={isSmallOrGreater ? 'flex-start' : 'stretch'}\n gap={12}\n >\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 )\n\n return (\n <div ref={containerRef} className={styles.container}>\n <div\n className={`${styles.headerSection} ${!isSmallOrGreater ? styles.headerSectionSticky : ''}`}\n >\n <Flex justifyContent=\"space-between\">\n <Flex flexDirection=\"column\" gap={isSmallOrGreater ? 8 : 2}>\n <Heading as=\"h1\" styledAs={isSmallOrGreater ? 'h2' : 'h4'}>\n {t('pageTitle', { employeeName })}\n </Heading>\n {isSmallOrGreater ? (\n <Flex flexDirection=\"column\" gap={6}>\n <Heading as=\"h2\" styledAs=\"h3\">\n {formattedCurrentGrossPay}\n </Heading>\n <Text className={styles.grossPayLabel}>{t('grossPayLabel')}</Text>\n </Flex>\n ) : (\n <Heading as=\"h2\" styledAs=\"h6\" className={styles.grossPayLabel}>\n {t('grossPayLabelMobile', { grossPay: formattedCurrentGrossPay })}\n </Heading>\n )}\n </Flex>\n {isSmallOrGreater && actions}\n </Flex>\n </div>\n <FormProvider {...formHandlers}>\n <Form>\n {hourlyJobs.length > 0 && (\n <div className={styles.fieldGroup}>\n <Heading as=\"h3\">{t('regularHoursTitle')}</Heading>\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 </div>\n )}\n {timeOff.length > 0 && (\n <div className={styles.fieldGroup}>\n <Heading as=\"h4\">{t('timeOffTitle')}</Heading>\n <Grid gridTemplateColumns={{ base: '1fr', small: [320, 320] }} gap={20}>\n {timeOff.map(timeOffEntry => (\n <TimeOffField\n key={timeOffEntry.name}\n timeOff={timeOffEntry}\n employee={employee}\n />\n ))}\n </Grid>\n </div>\n )}\n {additionalEarnings.length > 0 && (\n <div className={styles.fieldGroup}>\n <Heading as=\"h4\">{t('additionalEarningsTitle')}</Heading>\n <Grid\n gridTemplateColumns={{ base: '1fr', small: [320, 320], large: [320, 320, 320] }}\n gap={20}\n >\n {additionalEarnings.map(fixedCompensation => (\n <TextInputField\n key={fixedCompensation.name}\n type=\"number\"\n adornmentStart=\"$\"\n isRequired\n label={getFixedCompensationLabel(fixedCompensation.name)}\n name={`fixedCompensations.${fixedCompensation.name}`}\n />\n ))}\n </Grid>\n </div>\n )}\n {reimbursement && (\n <div className={styles.fieldGroup}>\n <Heading as=\"h4\">{t('reimbursementTitle')}</Heading>\n <Grid gridTemplateColumns={{ base: '1fr', small: [320, 320] }} gap={20}>\n <TextInputField\n type=\"number\"\n adornmentStart=\"$\"\n isRequired\n label={getFixedCompensationLabel(reimbursement.name)}\n name={`fixedCompensations.${reimbursement.name}`}\n />\n </Grid>\n </div>\n )}\n <div className={styles.fieldGroup}>\n <Heading as=\"h4\">{t('paymentMethodTitle')}</Heading>\n <RadioGroupField\n name=\"paymentMethod\"\n isRequired\n label={t('paymentMethodLabel')}\n description={t('paymentMethodDescription')}\n options={[\n {\n value: PayrollEmployeeCompensationsTypePaymentMethod.DirectDeposit,\n label: t('paymentMethodOptions.directDeposit'),\n },\n {\n value: PayrollEmployeeCompensationsTypePaymentMethod.Check,\n label: t('paymentMethodOptions.check'),\n },\n ]}\n />\n </div>\n </Form>\n {!isSmallOrGreater && actions}\n </FormProvider>\n </div>\n )\n}\n"],"names":["PayrollEditEmployeeFormSchema","z","PayrollEmployeeCompensationsTypePaymentMethod","buildCompensationFromFormData","formData","employeeCompensation","timeOff","primaryJobUuid","updatedCompensation","compensation","hours","timeOffEntry","updatedFixedCompensations","fixedCompensationName","formAmount","existingFixedCompensation","fixedCompensation","PayrollEditEmployeePresentation","onSave","onCancel","employee","isPending","fixedCompensationTypes","payPeriodStartDate","paySchedule","isOffCycle","Button","Heading","Text","useComponentContext","useTranslation","useI18n","primaryJob","job","hourlyJobs","containerRef","useRef","isSmallOrGreater","useContainerBreakpoints","hourlyJob","entry","additionalEarnings","getAdditionalEarningsCompensations","EXCLUDED_ADDITIONAL_EARNINGS","reimbursement","getReimbursementCompensation","findMatchingCompensation","jobUuid","compensationName","getCompensationLabel","COMPENSATION_NAME_REGULAR_HOURS","COMPENSATION_NAME_OVERTIME","COMPENSATION_NAME_DOUBLE_OVERTIME","getFixedCompensationLabel","COMPENSATION_NAME_BONUS","COMPENSATION_NAME_PAYCHECK_TIPS","COMPENSATION_NAME_CORRECTION_PAYMENT","COMPENSATION_NAME_COMMISSION","COMPENSATION_NAME_CASH_TIPS","COMPENSATION_NAME_REIMBURSEMENT","defaultValues","hourlyCompensations","HOURS_COMPENSATION_NAMES","matchingCompensation","timeOffCompensations","timeOffCompensation","fixedCompensations","fixedComp","formHandlers","useForm","zodResolver","watchedFormData","useWatch","currentGrossPay","useMemo","jobId","compensations","formDataWithDefaults","calculateGrossPay","employeeName","firstLastName","onSubmit","data","formattedCurrentGrossPay","formatNumberAsCurrency","actions","jsxs","Flex","jsx","styles","FormProvider","Form","Grid","employeeHourlyCompensation","TextInputField","TimeOffField","RadioGroupField"],"mappings":";;;;;;;;;;;;;;;;;;;;AAoDO,MAAMA,KAAgCC,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,IAAG,MAAM,UAAA,EAAE,oBAAoB,GAAE;AAAA,UAC1C,gBAAA6D;AAAA,YAACQ;AAAA,YAAA;AAAA,cACC,MAAK;AAAA,cACL,YAAU;AAAA,cACV,OAAO,EAAE,oBAAoB;AAAA,cAC7B,aAAa,EAAE,0BAA0B;AAAA,cACzC,SAAS;AAAA,gBACP;AAAA,kBACE,OAAO9F,EAA8C;AAAA,kBACrD,OAAO,EAAE,oCAAoC;AAAA,gBAAA;AAAA,gBAE/C;AAAA,kBACE,OAAOA,EAA8C;AAAA,kBACrD,OAAO,EAAE,4BAA4B;AAAA,gBAAA;AAAA,cACvC;AAAA,YACF;AAAA,UAAA;AAAA,QACF,EAAA,CACF;AAAA,MAAA,GACF;AAAA,MACC,CAACmC,KAAoBgD;AAAA,IAAA,EAAA,CACxB;AAAA,EAAA,GACF;AAEJ;"}
1
+ {"version":3,"file":"PayrollEditEmployeePresentation.js","sources":["../../../../src/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.tsx"],"sourcesContent":["import { FormProvider, useForm, useWatch } from 'react-hook-form'\nimport { useMemo, useRef } from 'react'\nimport type { Employee } from '@gusto/embedded-api/models/components/employee'\nimport type {\n FixedCompensations,\n PayrollEmployeeCompensationsType,\n} from '@gusto/embedded-api/models/components/payrollemployeecompensationstype'\nimport { PayrollEmployeeCompensationsTypePaymentMethod } from '@gusto/embedded-api/models/components/payrollemployeecompensationstype'\nimport type { PayrollFixedCompensationTypesType } from '@gusto/embedded-api/models/components/payrollfixedcompensationtypestype'\nimport type { PayScheduleObject } from '@gusto/embedded-api/models/components/payscheduleobject'\nimport { useTranslation } from 'react-i18next'\nimport { z } from 'zod'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport styles from './PayrollEditEmployeePresentation.module.scss'\nimport { TimeOffField } from './TimeOffField'\nimport { Flex, Grid, TextInputField, RadioGroupField } 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 getAdditionalEarningsCompensations,\n getReimbursementCompensation,\n calculateGrossPay,\n} from '@/components/Payroll/helpers'\nimport {\n COMPENSATION_NAME_DOUBLE_OVERTIME,\n COMPENSATION_NAME_OVERTIME,\n COMPENSATION_NAME_REGULAR_HOURS,\n HOURS_COMPENSATION_NAMES,\n EXCLUDED_ADDITIONAL_EARNINGS,\n COMPENSATION_NAME_REIMBURSEMENT,\n COMPENSATION_NAME_BONUS,\n COMPENSATION_NAME_PAYCHECK_TIPS,\n COMPENSATION_NAME_CORRECTION_PAYMENT,\n COMPENSATION_NAME_COMMISSION,\n COMPENSATION_NAME_CASH_TIPS,\n} from '@/shared/constants'\nimport useContainerBreakpoints from '@/hooks/useContainerBreakpoints/useContainerBreakpoints'\n\ninterface PayrollEditEmployeeProps {\n onSave: (updatedCompensation: PayrollEmployeeCompensationsType) => void\n onCancel: () => void\n employee: Employee\n employeeCompensation?: PayrollEmployeeCompensationsType\n isPending?: boolean\n fixedCompensationTypes: PayrollFixedCompensationTypesType[]\n payPeriodStartDate?: string\n paySchedule?: PayScheduleObject\n isOffCycle?: boolean\n}\n\nexport const PayrollEditEmployeeFormSchema = z.object({\n hourlyCompensations: z.record(z.string(), z.record(z.string(), z.string().optional())),\n timeOffCompensations: z.record(z.string(), z.string().optional()),\n fixedCompensations: z.record(z.string(), z.string().optional()),\n paymentMethod: z.nativeEnum(PayrollEmployeeCompensationsTypePaymentMethod).optional(),\n})\n\nexport type PayrollEditEmployeeFormValues = z.infer<typeof PayrollEditEmployeeFormSchema>\n\nconst buildCompensationFromFormData = (\n formData: PayrollEditEmployeeFormValues,\n employeeCompensation: PayrollEmployeeCompensationsType | undefined,\n timeOff: Array<{ name?: string; hours?: string }>,\n primaryJobUuid?: string,\n): PayrollEmployeeCompensationsType => {\n const updatedCompensation = {\n ...employeeCompensation,\n paymentMethod: formData.paymentMethod,\n }\n\n updatedCompensation.hourlyCompensations = employeeCompensation?.hourlyCompensations?.map(\n compensation => {\n const hours =\n compensation.jobUuid && compensation.name\n ? formData.hourlyCompensations[compensation.jobUuid]?.[compensation.name]\n : undefined\n return hours\n ? {\n ...compensation,\n hours,\n }\n : compensation\n },\n )\n\n updatedCompensation.paidTimeOff = timeOff.map(timeOffEntry => {\n return {\n ...timeOffEntry,\n hours: formData.timeOffCompensations[timeOffEntry.name!],\n }\n })\n\n const updatedFixedCompensations: FixedCompensations[] = []\n\n Object.entries(formData.fixedCompensations).forEach(([fixedCompensationName, formAmount]) => {\n const existingFixedCompensation = employeeCompensation?.fixedCompensations?.find(\n fixedCompensation =>\n fixedCompensation.name?.toLowerCase() === fixedCompensationName.toLowerCase(),\n )\n\n if (formAmount) {\n if (existingFixedCompensation) {\n updatedFixedCompensations.push({\n name: existingFixedCompensation.name,\n jobUuid: existingFixedCompensation.jobUuid,\n amount: formAmount,\n })\n } else if (parseFloat(formAmount) !== 0) {\n updatedFixedCompensations.push({\n name: fixedCompensationName,\n jobUuid: primaryJobUuid,\n amount: formAmount,\n })\n }\n }\n })\n\n updatedCompensation.fixedCompensations = updatedFixedCompensations\n\n return updatedCompensation\n}\n\nexport const PayrollEditEmployeePresentation = ({\n onSave,\n onCancel,\n employee,\n employeeCompensation,\n isPending = false,\n fixedCompensationTypes,\n payPeriodStartDate,\n paySchedule,\n isOffCycle = 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 const containerRef = useRef<HTMLDivElement>(null)\n const breakpoints = useContainerBreakpoints({\n ref: containerRef,\n })\n const isSmallOrGreater = breakpoints.includes('small')\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 timeOff = (employeeCompensation?.paidTimeOff || []).filter(entry => entry.name)\n\n const additionalEarnings = getAdditionalEarningsCompensations({\n flsaStatus: primaryJob?.compensations?.[0]?.flsaStatus,\n existingFixedCompensations: employeeCompensation?.fixedCompensations || [],\n primaryJobUuid: primaryJob?.uuid,\n fixedCompensationTypes,\n excludedTypes: EXCLUDED_ADDITIONAL_EARNINGS,\n })\n\n const reimbursement = getReimbursementCompensation(\n employeeCompensation?.fixedCompensations || [],\n fixedCompensationTypes,\n primaryJob?.uuid,\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 getFixedCompensationLabel = (compensationName?: string) => {\n switch (compensationName) {\n case COMPENSATION_NAME_BONUS:\n return t('fixedCompensationNames.bonus')\n case COMPENSATION_NAME_PAYCHECK_TIPS:\n return t('fixedCompensationNames.paycheckTips')\n case COMPENSATION_NAME_CORRECTION_PAYMENT:\n return t('fixedCompensationNames.correctionPayment')\n case COMPENSATION_NAME_COMMISSION:\n return t('fixedCompensationNames.commission')\n case COMPENSATION_NAME_CASH_TIPS:\n return t('fixedCompensationNames.cashTips')\n case COMPENSATION_NAME_REIMBURSEMENT:\n return t('fixedCompensationNames.reimbursement')\n default:\n return compensationName\n }\n }\n\n const defaultValues = {\n hourlyCompensations: (() => {\n const hourlyCompensations: 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 (!hourlyCompensations[hourlyJob.uuid]) {\n hourlyCompensations[hourlyJob.uuid] = {}\n }\n hourlyCompensations[hourlyJob.uuid]![matchingCompensation.name!] =\n matchingCompensation.hours ? parseFloat(matchingCompensation.hours).toString() : ''\n }\n })\n })\n\n return hourlyCompensations\n })(),\n\n timeOffCompensations: (() => {\n const timeOffCompensations: PayrollEditEmployeeFormValues['timeOffCompensations'] = {}\n\n timeOff.forEach(timeOffCompensation => {\n timeOffCompensations[timeOffCompensation.name!] = timeOffCompensation.hours\n ? parseFloat(timeOffCompensation.hours).toString()\n : ''\n })\n\n return timeOffCompensations\n })(),\n\n fixedCompensations: (() => {\n const fixedCompensations: PayrollEditEmployeeFormValues['fixedCompensations'] = {}\n\n additionalEarnings.forEach(fixedComp => {\n fixedCompensations[fixedComp.name!] = fixedComp.amount ? fixedComp.amount : ''\n })\n\n if (reimbursement) {\n fixedCompensations[reimbursement.name!] = reimbursement.amount ? reimbursement.amount : ''\n }\n\n return fixedCompensations\n })(),\n\n paymentMethod:\n employeeCompensation?.paymentMethod ||\n PayrollEmployeeCompensationsTypePaymentMethod.DirectDeposit,\n }\n\n const formHandlers = useForm<PayrollEditEmployeeFormValues>({\n resolver: zodResolver(PayrollEditEmployeeFormSchema),\n defaultValues,\n })\n\n const watchedFormData = useWatch({\n control: formHandlers.control,\n })\n\n const currentGrossPay = useMemo(() => {\n try {\n // Build form data, filtering out undefined nested objects\n const hourlyCompensations: Record<string, Record<string, string | undefined>> = {}\n if (watchedFormData.hourlyCompensations) {\n Object.entries(watchedFormData.hourlyCompensations).forEach(([jobId, compensations]) => {\n if (compensations) {\n hourlyCompensations[jobId] = compensations\n }\n })\n }\n\n const formDataWithDefaults: PayrollEditEmployeeFormValues = {\n hourlyCompensations,\n timeOffCompensations: watchedFormData.timeOffCompensations || {},\n fixedCompensations: watchedFormData.fixedCompensations || {},\n paymentMethod: watchedFormData.paymentMethod,\n }\n\n const updatedCompensation = buildCompensationFromFormData(\n formDataWithDefaults,\n employeeCompensation,\n (employeeCompensation?.paidTimeOff || []).filter(entry => entry.name),\n primaryJob?.uuid,\n )\n\n return calculateGrossPay(\n updatedCompensation,\n employee,\n payPeriodStartDate,\n paySchedule,\n isOffCycle,\n )\n } catch {\n // Fallback to original compensation on error\n return employeeCompensation\n ? calculateGrossPay(\n employeeCompensation,\n employee,\n payPeriodStartDate,\n paySchedule,\n isOffCycle,\n )\n : 0\n }\n }, [\n watchedFormData,\n employeeCompensation,\n primaryJob?.uuid,\n employee,\n payPeriodStartDate,\n paySchedule,\n isOffCycle,\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 = buildCompensationFromFormData(\n data,\n employeeCompensation,\n timeOff,\n primaryJob?.uuid,\n )\n onSave(updatedCompensation)\n }\n\n const formattedCurrentGrossPay = formatNumberAsCurrency(currentGrossPay || 0)\n\n const actions = (\n <Flex\n flexDirection={isSmallOrGreater ? 'row' : 'column'}\n justifyContent={isSmallOrGreater ? 'flex-end' : 'normal'}\n alignItems={isSmallOrGreater ? 'flex-start' : 'stretch'}\n gap={12}\n >\n <Button variant=\"secondary\" onClick={onCancel} title={t('cancelCta')}>\n {t('cancelCta')}\n </Button>\n <Button\n onClick={formHandlers.handleSubmit(onSubmit)}\n title={t('saveCta')}\n isLoading={isPending}\n >\n {t('saveCta')}\n </Button>\n </Flex>\n )\n\n return (\n <div ref={containerRef} className={styles.container}>\n <div\n className={`${styles.headerSection} ${!isSmallOrGreater ? styles.headerSectionSticky : ''}`}\n >\n <Flex justifyContent=\"space-between\">\n <Flex flexDirection=\"column\" gap={isSmallOrGreater ? 8 : 2}>\n <Heading as=\"h1\" styledAs={isSmallOrGreater ? 'h2' : 'h4'}>\n {t('pageTitle', { employeeName })}\n </Heading>\n {isSmallOrGreater ? (\n <Flex flexDirection=\"column\" gap={6}>\n <Heading as=\"h2\" styledAs=\"h3\">\n {formattedCurrentGrossPay}\n </Heading>\n <Text className={styles.grossPayLabel}>{t('grossPayLabel')}</Text>\n </Flex>\n ) : (\n <Heading as=\"h2\" styledAs=\"h6\" className={styles.grossPayLabel}>\n {t('grossPayLabelMobile', { grossPay: formattedCurrentGrossPay })}\n </Heading>\n )}\n </Flex>\n {isSmallOrGreater && actions}\n </Flex>\n </div>\n <FormProvider {...formHandlers}>\n <Form>\n {hourlyJobs.length > 0 && (\n <div className={styles.fieldGroup}>\n <Heading as=\"h3\">{t('regularHoursTitle')}</Heading>\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 </div>\n )}\n {timeOff.length > 0 && (\n <div className={styles.fieldGroup}>\n <Heading as=\"h4\">{t('timeOffTitle')}</Heading>\n <Grid gridTemplateColumns={{ base: '1fr', small: [320, 320] }} gap={20}>\n {timeOff.map(timeOffEntry => (\n <TimeOffField\n key={timeOffEntry.name}\n timeOff={timeOffEntry}\n employee={employee}\n />\n ))}\n </Grid>\n </div>\n )}\n {additionalEarnings.length > 0 && (\n <div className={styles.fieldGroup}>\n <Heading as=\"h4\">{t('additionalEarningsTitle')}</Heading>\n <Grid\n gridTemplateColumns={{ base: '1fr', small: [320, 320], large: [320, 320, 320] }}\n gap={20}\n >\n {additionalEarnings.map(fixedCompensation => (\n <TextInputField\n key={fixedCompensation.name}\n type=\"number\"\n adornmentStart=\"$\"\n isRequired\n label={getFixedCompensationLabel(fixedCompensation.name)}\n name={`fixedCompensations.${fixedCompensation.name}`}\n />\n ))}\n </Grid>\n </div>\n )}\n {reimbursement && (\n <div className={styles.fieldGroup}>\n <Heading as=\"h4\">{t('reimbursementTitle')}</Heading>\n <Grid gridTemplateColumns={{ base: '1fr', small: [320, 320] }} gap={20}>\n <TextInputField\n type=\"number\"\n adornmentStart=\"$\"\n isRequired\n label={getFixedCompensationLabel(reimbursement.name)}\n name={`fixedCompensations.${reimbursement.name}`}\n />\n </Grid>\n </div>\n )}\n <div className={styles.fieldGroup}>\n <Heading as=\"h4\">{t('paymentMethodTitle')}</Heading>\n <RadioGroupField\n name=\"paymentMethod\"\n isRequired\n label={t('paymentMethodLabel')}\n description={t('paymentMethodDescription')}\n options={[\n {\n value: PayrollEmployeeCompensationsTypePaymentMethod.DirectDeposit,\n label: t('paymentMethodOptions.directDeposit'),\n },\n {\n value: PayrollEmployeeCompensationsTypePaymentMethod.Check,\n label: t('paymentMethodOptions.check'),\n },\n ]}\n />\n </div>\n </Form>\n {!isSmallOrGreater && actions}\n </FormProvider>\n </div>\n )\n}\n"],"names":["PayrollEditEmployeeFormSchema","z","PayrollEmployeeCompensationsTypePaymentMethod","buildCompensationFromFormData","formData","employeeCompensation","timeOff","primaryJobUuid","updatedCompensation","compensation","hours","timeOffEntry","updatedFixedCompensations","fixedCompensationName","formAmount","existingFixedCompensation","fixedCompensation","PayrollEditEmployeePresentation","onSave","onCancel","employee","isPending","fixedCompensationTypes","payPeriodStartDate","paySchedule","isOffCycle","Button","Heading","Text","useComponentContext","useTranslation","useI18n","primaryJob","job","hourlyJobs","containerRef","useRef","isSmallOrGreater","useContainerBreakpoints","hourlyJob","entry","additionalEarnings","getAdditionalEarningsCompensations","EXCLUDED_ADDITIONAL_EARNINGS","reimbursement","getReimbursementCompensation","findMatchingCompensation","jobUuid","compensationName","getCompensationLabel","COMPENSATION_NAME_REGULAR_HOURS","COMPENSATION_NAME_OVERTIME","COMPENSATION_NAME_DOUBLE_OVERTIME","getFixedCompensationLabel","COMPENSATION_NAME_BONUS","COMPENSATION_NAME_PAYCHECK_TIPS","COMPENSATION_NAME_CORRECTION_PAYMENT","COMPENSATION_NAME_COMMISSION","COMPENSATION_NAME_CASH_TIPS","COMPENSATION_NAME_REIMBURSEMENT","defaultValues","hourlyCompensations","HOURS_COMPENSATION_NAMES","matchingCompensation","timeOffCompensations","timeOffCompensation","fixedCompensations","fixedComp","formHandlers","useForm","zodResolver","watchedFormData","useWatch","currentGrossPay","useMemo","jobId","compensations","formDataWithDefaults","calculateGrossPay","employeeName","firstLastName","onSubmit","data","formattedCurrentGrossPay","formatNumberAsCurrency","actions","jsxs","Flex","jsx","styles","FormProvider","Form","Grid","employeeHourlyCompensation","TextInputField","TimeOffField","RadioGroupField"],"mappings":";;;;;;;;;;;;;;;;;;;;AAoDO,MAAMA,KAAgCC,EAAE,OAAO;AAAA,EACpD,qBAAqBA,EAAE,OAAOA,EAAE,OAAA,GAAUA,EAAE,OAAOA,EAAE,OAAA,GAAUA,EAAE,OAAA,EAAS,SAAA,CAAU,CAAC;AAAA,EACrF,sBAAsBA,EAAE,OAAOA,EAAE,OAAA,GAAUA,EAAE,SAAS,UAAU;AAAA,EAChE,oBAAoBA,EAAE,OAAOA,EAAE,OAAA,GAAUA,EAAE,SAAS,UAAU;AAAA,EAC9D,eAAeA,EAAE,WAAWC,CAA6C,EAAE,SAAA;AAC7E,CAAC,GAIKC,IAAgC,CACpCC,GACAC,GACAC,GACAC,MACqC;AACrC,QAAMC,IAAsB;AAAA,IAC1B,GAAGH;AAAA,IACH,eAAeD,EAAS;AAAA,EAAA;AAG1B,EAAAI,EAAoB,sBAAsBH,GAAsB,qBAAqB;AAA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