@gusto/embedded-react-sdk 0.10.7-rc.2 → 0.11.0-rc.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 (135) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/components/Common/HamburgerMenu/HamburgerMenu.js +20 -19
  3. package/dist/components/Common/HamburgerMenu/HamburgerMenu.js.map +1 -1
  4. package/dist/components/Common/ReorderableList/ReorderableItem.js +1 -1
  5. package/dist/components/Common/ReorderableList/ReorderableItem.js.map +1 -1
  6. package/dist/components/Common/UI/Button/Button.d.ts +1 -1
  7. package/dist/components/Common/UI/Button/Button.js +4 -4
  8. package/dist/components/Common/UI/Button/Button.js.map +1 -1
  9. package/dist/components/Common/UI/Button/ButtonTypes.d.ts +1 -1
  10. package/dist/components/Company/AssignSignatory/AssignSignatory.d.ts +0 -5
  11. package/dist/components/Company/AssignSignatory/AssignSignatory.js +39 -42
  12. package/dist/components/Company/AssignSignatory/AssignSignatory.js.map +1 -1
  13. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.d.ts +0 -4
  14. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js +51 -53
  15. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js.map +1 -1
  16. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.d.ts +0 -4
  17. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js +40 -42
  18. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js.map +1 -1
  19. package/dist/components/Company/AssignSignatory/index.d.ts +0 -1
  20. package/dist/components/Company/BankAccount/BankAccount.d.ts +0 -5
  21. package/dist/components/Company/BankAccount/BankAccount.js +17 -23
  22. package/dist/components/Company/BankAccount/BankAccount.js.map +1 -1
  23. package/dist/components/Company/BankAccount/BankAccountForm/BankAccountForm.d.ts +0 -5
  24. package/dist/components/Company/BankAccount/BankAccountForm/BankAccountForm.js +28 -31
  25. package/dist/components/Company/BankAccount/BankAccountForm/BankAccountForm.js.map +1 -1
  26. package/dist/components/Company/BankAccount/BankAccountList/BankAccountList.d.ts +0 -5
  27. package/dist/components/Company/BankAccount/BankAccountList/BankAccountList.js +25 -28
  28. package/dist/components/Company/BankAccount/BankAccountList/BankAccountList.js.map +1 -1
  29. package/dist/components/Company/BankAccount/BankAccountVerify/BankAccountVerify.d.ts +0 -5
  30. package/dist/components/Company/BankAccount/BankAccountVerify/BankAccountVerify.js +33 -36
  31. package/dist/components/Company/BankAccount/BankAccountVerify/BankAccountVerify.js.map +1 -1
  32. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.d.ts +0 -6
  33. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js +37 -41
  34. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  35. package/dist/components/Company/DocumentSigner/DocumentSigner.d.ts +0 -4
  36. package/dist/components/Company/DocumentSigner/DocumentSigner.js +23 -26
  37. package/dist/components/Company/DocumentSigner/DocumentSigner.js.map +1 -1
  38. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.d.ts +0 -6
  39. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js +40 -44
  40. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
  41. package/dist/components/Company/Industry/Industry.d.ts +0 -5
  42. package/dist/components/Company/Industry/Industry.js +23 -29
  43. package/dist/components/Company/Industry/Industry.js.map +1 -1
  44. package/dist/components/Company/Locations/LocationForm/LocationForm.d.ts +0 -5
  45. package/dist/components/Company/Locations/LocationForm/LocationForm.js +41 -44
  46. package/dist/components/Company/Locations/LocationForm/LocationForm.js.map +1 -1
  47. package/dist/components/Company/Locations/Locations.d.ts +0 -4
  48. package/dist/components/Company/Locations/Locations.js +14 -18
  49. package/dist/components/Company/Locations/Locations.js.map +1 -1
  50. package/dist/components/Company/Locations/LocationsList/LocationsList.d.ts +0 -5
  51. package/dist/components/Company/Locations/LocationsList/LocationsList.js +28 -31
  52. package/dist/components/Company/Locations/LocationsList/LocationsList.js.map +1 -1
  53. package/dist/components/Company/PaySchedule/PaySchedule.d.ts +1 -7
  54. package/dist/components/Company/PaySchedule/PaySchedule.js +67 -71
  55. package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
  56. package/dist/components/Company/StateTaxes/StateTaxes.d.ts +0 -4
  57. package/dist/components/Company/StateTaxes/StateTaxes.js +39 -22
  58. package/dist/components/Company/StateTaxes/StateTaxes.js.map +1 -1
  59. package/dist/components/Company/StateTaxes/StateTaxesComponents.d.ts +8 -6
  60. package/dist/components/Company/StateTaxes/StateTaxesComponents.js +16 -15
  61. package/dist/components/Company/StateTaxes/StateTaxesComponents.js.map +1 -1
  62. package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.d.ts +0 -5
  63. package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js +44 -47
  64. package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js.map +1 -1
  65. package/dist/components/Company/StateTaxes/StateTaxesList/StateTaxesList.d.ts +0 -5
  66. package/dist/components/Company/StateTaxes/StateTaxesList/StateTaxesList.js +26 -29
  67. package/dist/components/Company/StateTaxes/StateTaxesList/StateTaxesList.js.map +1 -1
  68. package/dist/components/Company/StateTaxes/stateTaxesReducer.d.ts +20 -0
  69. package/dist/components/Company/StateTaxes/stateTaxesReducer.js +40 -0
  70. package/dist/components/Company/StateTaxes/stateTaxesReducer.js.map +1 -0
  71. package/dist/components/Contractor/Address/Address.d.ts +0 -5
  72. package/dist/components/Contractor/Address/Address.js +35 -38
  73. package/dist/components/Contractor/Address/Address.js.map +1 -1
  74. package/dist/components/Contractor/Profile/ContractorProfile.d.ts +11 -0
  75. package/dist/components/Contractor/Profile/ContractorProfile.js +24 -0
  76. package/dist/components/Contractor/Profile/ContractorProfile.js.map +1 -0
  77. package/dist/components/Contractor/Profile/ContractorProfileForm.d.ts +5 -0
  78. package/dist/components/Contractor/Profile/ContractorProfileForm.js +140 -0
  79. package/dist/components/Contractor/Profile/ContractorProfileForm.js.map +1 -0
  80. package/dist/components/Contractor/Profile/index.d.ts +3 -0
  81. package/dist/components/Contractor/Profile/useContractorProfile.d.ts +254 -0
  82. package/dist/components/Contractor/Profile/useContractorProfile.js +223 -0
  83. package/dist/components/Contractor/Profile/useContractorProfile.js.map +1 -0
  84. package/dist/components/Contractor/Submit/ContractorSubmitWithApi.d.ts +6 -0
  85. package/dist/components/Contractor/Submit/ContractorSubmitWithApi.js +27 -0
  86. package/dist/components/Contractor/Submit/ContractorSubmitWithApi.js.map +1 -0
  87. package/dist/components/Contractor/Submit/SubmitDone.d.ts +5 -0
  88. package/dist/components/Contractor/Submit/SubmitDone.js +18 -0
  89. package/dist/components/Contractor/Submit/SubmitDone.js.map +1 -0
  90. package/dist/components/Contractor/Submit/index.d.ts +6 -0
  91. package/dist/components/Contractor/Submit/index.js +18 -0
  92. package/dist/components/Contractor/Submit/index.js.map +1 -0
  93. package/dist/components/Contractor/Submit/index.module.scss.js +8 -0
  94. package/dist/components/Contractor/Submit/index.module.scss.js.map +1 -0
  95. package/dist/components/Contractor/index.d.ts +2 -0
  96. package/dist/components/Contractor/index.js +10 -6
  97. package/dist/components/Contractor/index.js.map +1 -1
  98. package/dist/components/Employee/Compensation/Compensation.d.ts +0 -6
  99. package/dist/components/Employee/Compensation/Compensation.js +97 -102
  100. package/dist/components/Employee/Compensation/Compensation.js.map +1 -1
  101. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.d.ts +0 -5
  102. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js +25 -28
  103. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  104. package/dist/components/Employee/DocumentSigner/DocumentSigner.d.ts +1 -7
  105. package/dist/components/Employee/DocumentSigner/DocumentSigner.js +16 -20
  106. package/dist/components/Employee/DocumentSigner/DocumentSigner.js.map +1 -1
  107. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.d.ts +0 -7
  108. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js +40 -44
  109. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
  110. package/dist/components/Employee/EmployeeList/EmployeeList.d.ts +0 -5
  111. package/dist/components/Employee/EmployeeList/EmployeeList.js +56 -59
  112. package/dist/components/Employee/EmployeeList/EmployeeList.js.map +1 -1
  113. package/dist/components/Employee/Profile/AdminPersonalDetails.d.ts +3 -3
  114. package/dist/components/Employee/Profile/PersonalDetailsInputs.d.ts +2 -2
  115. package/dist/components/Employee/Profile/Profile.d.ts +0 -8
  116. package/dist/components/Employee/Profile/Profile.js +131 -138
  117. package/dist/components/Employee/Profile/Profile.js.map +1 -1
  118. package/dist/components/Employee/Taxes/Taxes.d.ts +0 -6
  119. package/dist/components/Employee/Taxes/Taxes.js +76 -81
  120. package/dist/components/Employee/Taxes/Taxes.js.map +1 -1
  121. package/dist/i18n/I18n.js +1 -1
  122. package/dist/i18n/I18n.js.map +1 -1
  123. package/dist/i18n/en/Contractor.ContractorSubmit.json.js +22 -0
  124. package/dist/i18n/en/Contractor.ContractorSubmit.json.js.map +1 -0
  125. package/dist/i18n/en/Contractor.Profile.json.js +73 -0
  126. package/dist/i18n/en/Contractor.Profile.json.js.map +1 -0
  127. package/dist/shared/constants.d.ts +14 -0
  128. package/dist/shared/constants.js +33 -26
  129. package/dist/shared/constants.js.map +1 -1
  130. package/dist/style.css +1 -1
  131. package/dist/types/i18next.d.ts +77 -1
  132. package/package.json +2 -2
  133. package/dist/components/Company/StateTaxes/stateTaxesStateMachine.d.ts +0 -5
  134. package/dist/components/Company/StateTaxes/stateTaxesStateMachine.js +0 -48
  135. package/dist/components/Company/StateTaxes/stateTaxesStateMachine.js.map +0 -1
@@ -1,11 +1,15 @@
1
1
  import { PaymentMethod as t } from "./PaymentMethod/PaymentMethod.js";
2
- import { ContractorListWithApi as p } from "./List/index.js";
3
- import { NewHireReport as m } from "./NewHireReport/NewHireReport.js";
4
- import { Address as a } from "./Address/Address.js";
2
+ import { ContractorListWithApi as i } from "./List/index.js";
3
+ import { NewHireReport as p } from "./NewHireReport/NewHireReport.js";
4
+ import { ContractorSubmitWithApi as f } from "./Submit/ContractorSubmitWithApi.js";
5
+ import { Address as s } from "./Address/Address.js";
6
+ import { ContractorProfile as c } from "./Profile/ContractorProfile.js";
5
7
  export {
6
- a as Address,
7
- p as ContractorList,
8
- m as NewHireReport,
8
+ s as Address,
9
+ i as ContractorList,
10
+ c as ContractorProfile,
11
+ f as ContractorSubmit,
12
+ p as NewHireReport,
9
13
  t as PaymentMethod
10
14
  };
11
15
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
@@ -15,11 +15,5 @@ interface CompensationProps extends CommonComponentInterface<'Employee.Compensat
15
15
  defaultValues?: CompensationDefaultValues;
16
16
  }
17
17
  export declare function Compensation(props: CompensationProps & BaseComponentInterface): import("react/jsx-runtime").JSX.Element;
18
- export declare namespace Compensation {
19
- var Head: () => import("react/jsx-runtime").JSX.Element;
20
- var List: () => import("react/jsx-runtime").JSX.Element | undefined;
21
- var Actions: () => import("react/jsx-runtime").JSX.Element;
22
- var Edit: () => import("react/jsx-runtime").JSX.Element | undefined;
23
- }
24
18
  export declare const CompensationContextual: () => import("react/jsx-runtime").JSX.Element;
25
19
  export {};
@@ -1,104 +1,104 @@
1
- import { jsx as s, jsxs as re, Fragment as ie } from "react/jsx-runtime";
2
- import { zodResolver as me } from "@hookform/resolvers/zod";
3
- import { useState as W, useMemo as F, useEffect as ue } from "react";
4
- import { useForm as de, FormProvider as le } from "react-hook-form";
5
- import { useTranslation as ce } from "react-i18next";
6
- import { useJobsAndCompensationsGetJobsSuspense as pe } from "@gusto/embedded-api/react-query/jobsAndCompensationsGetJobs";
7
- import { useJobsAndCompensationsCreateJobMutation as fe } from "@gusto/embedded-api/react-query/jobsAndCompensationsCreateJob";
8
- import { useJobsAndCompensationsUpdateMutation as Ee } from "@gusto/embedded-api/react-query/jobsAndCompensationsUpdate";
9
- import { useJobsAndCompensationsDeleteMutation as Ce } from "@gusto/embedded-api/react-query/jobsAndCompensationsDelete";
10
- import { useJobsAndCompensationsUpdateCompensationMutation as he } from "@gusto/embedded-api/react-query/jobsAndCompensationsUpdateCompensation";
11
- import { useLocationsGetMinimumWagesSuspense as Ae } from "@gusto/embedded-api/react-query/locationsGetMinimumWages";
12
- import { useEmployeeAddressesGetWorkAddressesSuspense as De } from "@gusto/embedded-api/react-query/employeeAddressesGetWorkAddresses";
13
- import { useFederalTaxDetailsGetSuspense as Oe } from "@gusto/embedded-api/react-query/federalTaxDetailsGet";
14
- import { useEmployeesGetSuspense as Se } from "@gusto/embedded-api/react-query/employeesGet";
15
- import { List as j } from "./List.js";
16
- import { Head as V } from "./Head.js";
17
- import { Edit as Y } from "./Edit.js";
18
- import { Actions as k } from "./Actions.js";
19
- import { CompensationSchema as ye, CompensationProvider as Ie } from "./useCompensation.js";
20
- import { Form as Te } from "../../Common/Form/Form.js";
21
- import { FlsaStatus as h, componentEvents as E } from "../../../shared/constants.js";
22
- import { useComponentDictionary as be, useI18n as Me } from "../../../i18n/I18n.js";
23
- import { BaseComponent as Pe } from "../../Base/Base.js";
24
- import { useBase as We } from "../../Base/useBase.js";
25
- import { useFlow as ge } from "../../Flow/useFlow.js";
26
- function A(t) {
27
- return be("Employee.Compensation", t.dictionary), /* @__PURE__ */ s(Pe, { ...t, children: /* @__PURE__ */ s(Ne, { ...t, children: t.children }) });
1
+ import { jsx as s, jsxs as te, Fragment as oe } from "react/jsx-runtime";
2
+ import { zodResolver as ne } from "@hookform/resolvers/zod";
3
+ import { useState as P, useMemo as U, useEffect as se } from "react";
4
+ import { useForm as ae, FormProvider as re } from "react-hook-form";
5
+ import { useTranslation as ie } from "react-i18next";
6
+ import { useJobsAndCompensationsGetJobsSuspense as me } from "@gusto/embedded-api/react-query/jobsAndCompensationsGetJobs";
7
+ import { useJobsAndCompensationsCreateJobMutation as ue } from "@gusto/embedded-api/react-query/jobsAndCompensationsCreateJob";
8
+ import { useJobsAndCompensationsUpdateMutation as de } from "@gusto/embedded-api/react-query/jobsAndCompensationsUpdate";
9
+ import { useJobsAndCompensationsDeleteMutation as le } from "@gusto/embedded-api/react-query/jobsAndCompensationsDelete";
10
+ import { useJobsAndCompensationsUpdateCompensationMutation as ce } from "@gusto/embedded-api/react-query/jobsAndCompensationsUpdateCompensation";
11
+ import { useLocationsGetMinimumWagesSuspense as pe } from "@gusto/embedded-api/react-query/locationsGetMinimumWages";
12
+ import { useEmployeeAddressesGetWorkAddressesSuspense as fe } from "@gusto/embedded-api/react-query/employeeAddressesGetWorkAddresses";
13
+ import { useFederalTaxDetailsGetSuspense as Ce } from "@gusto/embedded-api/react-query/federalTaxDetailsGet";
14
+ import { useEmployeesGetSuspense as Ee } from "@gusto/embedded-api/react-query/employeesGet";
15
+ import { List as he } from "./List.js";
16
+ import { Head as De } from "./Head.js";
17
+ import { Edit as Oe } from "./Edit.js";
18
+ import { Actions as Se } from "./Actions.js";
19
+ import { CompensationSchema as ye, CompensationProvider as Ae } from "./useCompensation.js";
20
+ import { Form as Ie } from "../../Common/Form/Form.js";
21
+ import { FlsaStatus as h, componentEvents as C } from "../../../shared/constants.js";
22
+ import { useComponentDictionary as Te, useI18n as be } from "../../../i18n/I18n.js";
23
+ import { BaseComponent as Me } from "../../Base/Base.js";
24
+ import { useBase as Pe } from "../../Base/useBase.js";
25
+ import { useFlow as We } from "../../Flow/useFlow.js";
26
+ function ge(t) {
27
+ return Te("Employee.Compensation", t.dictionary), /* @__PURE__ */ s(Me, { ...t, children: /* @__PURE__ */ s(Ne, { ...t, children: t.children }) });
28
28
  }
29
- const B = (t) => t?.compensations?.find((l) => l.uuid === t.currentCompensationUuid), Ne = ({ employeeId: t, startDate: l, className: D, children: O, ...m }) => {
30
- Me("Employee.Compensation");
31
- const { baseSubmitHandler: x, onEvent: c } = We(), { data: q } = pe({ employeeId: t }), n = q.jobList, { data: G } = De({ employeeId: t }), g = G.employeeWorkAddressesList.find((e) => e.active), {
32
- data: { minimumWageList: R }
33
- } = Ae({
34
- locationUuid: g.locationUuid
35
- }), H = R, {
36
- data: { employee: N }
37
- } = Se({ employeeId: t });
38
- if (!N)
29
+ const F = (t) => t?.compensations?.find((l) => l.uuid === t.currentCompensationUuid), Ne = ({ employeeId: t, startDate: l, className: D, children: O, ...m }) => {
30
+ be("Employee.Compensation");
31
+ const { baseSubmitHandler: B, onEvent: c } = Pe(), { data: j } = me({ employeeId: t }), n = j.jobList, { data: V } = fe({ employeeId: t }), W = V.employeeWorkAddressesList.find((e) => e.active), {
32
+ data: { minimumWageList: Y }
33
+ } = pe({
34
+ locationUuid: W.locationUuid
35
+ }), k = Y, {
36
+ data: { employee: g }
37
+ } = Ee({ employeeId: t });
38
+ if (!g)
39
39
  throw new Error("Employee not found");
40
- const { data: X } = Oe({ companyId: N.companyUuid }), z = X.federalTaxDetails.taxPayerType === "S-Corporation", _ = he(), L = fe(), J = Ee(), w = Ce(), [o, S] = W(
40
+ const { data: x } = Ce({ companyId: g.companyUuid }), q = x.federalTaxDetails.taxPayerType === "S-Corporation", N = ce(), _ = ue(), L = de(), J = le(), [o, S] = P(
41
41
  n.length === 1 ? n[0] ?? null : null
42
- ), [I, p] = W(() => {
42
+ ), [A, p] = P(() => {
43
43
  if (!n.length)
44
44
  return "ADD_INITIAL_JOB";
45
- const e = B(n[0]);
45
+ const e = F(n[0]);
46
46
  return n.length === 1 && e?.flsaStatus !== h.NONEXEMPT ? "EDIT_INITIAL_JOB" : "LIST";
47
- }), [K, v] = W(!1), a = B(o), T = F(() => n.reduce((e, r) => {
47
+ }), [G, w] = P(!1), a = F(o), I = U(() => n.reduce((e, r) => {
48
48
  const u = r.compensations?.find(
49
49
  (y) => y.uuid === r.currentCompensationUuid
50
50
  );
51
51
  return !r.primary || !u ? e : u.flsaStatus ?? e;
52
- }, void 0), [n]), f = F(() => ({
52
+ }, void 0), [n]), f = U(() => ({
53
53
  jobTitle: o?.title && o.title !== "" ? o.title : m.defaultValues?.title ?? "",
54
- flsaStatus: a?.flsaStatus ?? T ?? m.defaultValues?.flsaStatus,
54
+ flsaStatus: a?.flsaStatus ?? I ?? m.defaultValues?.flsaStatus,
55
55
  rate: Number(a?.rate ?? m.defaultValues?.rate ?? 0),
56
56
  adjustForMinimumWage: a?.adjustForMinimumWage ?? !1,
57
57
  minimumWageId: a?.minimumWages?.[0]?.uuid ?? "",
58
58
  paymentUnit: a?.paymentUnit ?? m.defaultValues?.paymentUnit ?? "Hour",
59
59
  stateWcCovered: o?.stateWcCovered ?? !1,
60
60
  stateWcClassCode: o?.stateWcClassCode ?? ""
61
- }), [o, a, T, m.defaultValues]), U = de({
62
- resolver: me(ye),
61
+ }), [o, a, I, m.defaultValues]), v = ae({
62
+ resolver: ne(ye),
63
63
  defaultValues: f
64
- }), { resetField: b, setValue: M, handleSubmit: Q, reset: C } = U;
65
- ue(() => {
66
- C(f);
67
- }, [o, f, C]);
68
- const Z = async (e) => {
69
- if (I === "LIST" && e === "PROCEED") {
70
- c(E.EMPLOYEE_COMPENSATION_DONE);
64
+ }), { resetField: T, setValue: b, handleSubmit: R, reset: E } = v;
65
+ se(() => {
66
+ E(f);
67
+ }, [o, f, E]);
68
+ const X = async (e) => {
69
+ if (A === "LIST" && e === "PROCEED") {
70
+ c(C.EMPLOYEE_COMPENSATION_DONE);
71
71
  return;
72
72
  }
73
- if (!o && I === "LIST") {
73
+ if (!o && A === "LIST") {
74
74
  p("ADD_ADDITIONAL_JOB");
75
75
  return;
76
76
  }
77
- await Q(async (r) => {
78
- switch (await se(r), e) {
77
+ await R(async (r) => {
78
+ switch (await $(r), e) {
79
79
  case "LIST":
80
- p("LIST"), S(null), C(f);
80
+ p("LIST"), S(null), E(f);
81
81
  break;
82
82
  default:
83
- c(E.EMPLOYEE_COMPENSATION_DONE);
83
+ c(C.EMPLOYEE_COMPENSATION_DONE);
84
84
  }
85
85
  })();
86
- }, $ = () => {
87
- p("ADD_ADDITIONAL_JOB"), S(null), C(f);
88
- }, ee = () => {
89
- n.length > 0 ? p("LIST") : p("ADD_INITIAL_JOB"), S(null), C(f);
90
- }, te = (e) => {
86
+ }, H = () => {
87
+ p("ADD_ADDITIONAL_JOB"), S(null), E(f);
88
+ }, z = () => {
89
+ n.length > 0 ? p("LIST") : p("ADD_INITIAL_JOB"), S(null), E(f);
90
+ }, K = (e) => {
91
91
  const r = n.find((u) => e === u.uuid);
92
92
  r && (p("EDIT_ADDITIONAL_JOB"), S(r));
93
- }, oe = async (e) => {
94
- await w.mutateAsync({ request: { jobId: e } }), c(E.EMPLOYEE_JOB_DELETED);
95
- }, ne = (e) => {
96
- a?.flsaStatus === h.NONEXEMPT && n.length > 1 && v(!0), e === h.OWNER ? (M("paymentUnit", "Paycheck"), b("rate", { defaultValue: Number(a?.rate) })) : e === h.COMMISSION_ONLY_NONEXEMPT || e === h.COMMISSION_ONLY_EXEMPT ? (M("paymentUnit", "Year"), M("rate", 0)) : (b("paymentUnit", { defaultValue: a?.paymentUnit }), b("rate", { defaultValue: Number(a?.rate) }));
97
- }, se = async (e) => {
98
- await x(e, async (r) => {
93
+ }, Q = async (e) => {
94
+ await J.mutateAsync({ request: { jobId: e } }), c(C.EMPLOYEE_JOB_DELETED);
95
+ }, Z = (e) => {
96
+ a?.flsaStatus === h.NONEXEMPT && n.length > 1 && w(!0), e === h.OWNER ? (b("paymentUnit", "Paycheck"), T("rate", { defaultValue: Number(a?.rate) })) : e === h.COMMISSION_ONLY_NONEXEMPT || e === h.COMMISSION_ONLY_EXEMPT ? (b("paymentUnit", "Year"), b("rate", 0)) : (T("paymentUnit", { defaultValue: a?.paymentUnit }), T("rate", { defaultValue: Number(a?.rate) }));
97
+ }, $ = async (e) => {
98
+ await B(e, async (r) => {
99
99
  const { jobTitle: u, twoPercentShareholder: y, ...i } = r;
100
100
  let d;
101
- o ? (d = (await J.mutateAsync({
101
+ o ? (d = (await L.mutateAsync({
102
102
  request: {
103
103
  jobId: o.uuid,
104
104
  requestBody: {
@@ -110,7 +110,7 @@ const B = (t) => t?.compensations?.find((l) => l.uuid === t.currentCompensationU
110
110
  twoPercentShareholder: y ?? !1
111
111
  }
112
112
  }
113
- })).job, c(E.EMPLOYEE_JOB_UPDATED, d)) : (d = (await L.mutateAsync({
113
+ })).job, c(C.EMPLOYEE_JOB_UPDATED, d)) : (d = (await _.mutateAsync({
114
114
  request: {
115
115
  employeeId: t,
116
116
  requestBody: {
@@ -121,14 +121,14 @@ const B = (t) => t?.compensations?.find((l) => l.uuid === t.currentCompensationU
121
121
  twoPercentShareholder: y ?? !1
122
122
  }
123
123
  }
124
- })).job, c(E.EMPLOYEE_JOB_CREATED, d));
125
- const { compensation: ae } = await _.mutateAsync({
124
+ })).job, c(C.EMPLOYEE_JOB_CREATED, d));
125
+ const { compensation: ee } = await N.mutateAsync({
126
126
  request: {
127
127
  compensationId: d.currentCompensationUuid,
128
128
  requestBody: {
129
129
  // eslint-disable-next-line @typescript-eslint/no-non-null-asserted-optional-chain
130
130
  version: d.compensations?.find(
131
- (P) => P.uuid === d.currentCompensationUuid
131
+ (M) => M.uuid === d.currentCompensationUuid
132
132
  )?.version,
133
133
  ...i,
134
134
  rate: String(i.rate),
@@ -136,44 +136,39 @@ const B = (t) => t?.compensations?.find((l) => l.uuid === t.currentCompensationU
136
136
  }
137
137
  }
138
138
  });
139
- v(!1), c(E.EMPLOYEE_COMPENSATION_UPDATED, ae);
139
+ w(!1), c(C.EMPLOYEE_COMPENSATION_UPDATED, ee);
140
140
  });
141
141
  };
142
142
  return /* @__PURE__ */ s("section", { className: D, children: /* @__PURE__ */ s(
143
- Ie,
143
+ Ae,
144
144
  {
145
145
  value: {
146
146
  employeeJobs: n,
147
147
  currentJob: o,
148
- primaryFlsaStatus: T,
149
- showFlsaChangeWarning: K,
150
- mode: I,
151
- minimumWages: H,
152
- handleFlsaChange: ne,
153
- handleDelete: oe,
154
- handleEdit: te,
155
- handleAdd: $,
156
- submitWithEffect: Z,
157
- handleCancelAddJob: ee,
158
- isPending: _.isPending || L.isPending || J.isPending || w.isPending,
159
- state: g.state,
160
- showTwoPercentStakeholder: z
148
+ primaryFlsaStatus: I,
149
+ showFlsaChangeWarning: G,
150
+ mode: A,
151
+ minimumWages: k,
152
+ handleFlsaChange: Z,
153
+ handleDelete: Q,
154
+ handleEdit: K,
155
+ handleAdd: H,
156
+ submitWithEffect: X,
157
+ handleCancelAddJob: z,
158
+ isPending: N.isPending || _.isPending || L.isPending || J.isPending,
159
+ state: W.state,
160
+ showTwoPercentStakeholder: q
161
161
  },
162
- children: /* @__PURE__ */ s(le, { ...U, children: /* @__PURE__ */ s(Te, { children: O || /* @__PURE__ */ re(ie, { children: [
163
- /* @__PURE__ */ s(V, {}),
164
- /* @__PURE__ */ s(j, {}),
165
- /* @__PURE__ */ s(Y, {}),
166
- /* @__PURE__ */ s(k, {})
162
+ children: /* @__PURE__ */ s(re, { ...v, children: /* @__PURE__ */ s(Ie, { children: O || /* @__PURE__ */ te(oe, { children: [
163
+ /* @__PURE__ */ s(De, {}),
164
+ /* @__PURE__ */ s(he, {}),
165
+ /* @__PURE__ */ s(Oe, {}),
166
+ /* @__PURE__ */ s(Se, {})
167
167
  ] }) }) })
168
168
  }
169
169
  ) });
170
- };
171
- A.Head = V;
172
- A.List = j;
173
- A.Actions = k;
174
- A.Edit = Y;
175
- const nt = () => {
176
- const { employeeId: t, onEvent: l, startDate: D, defaultValues: O } = ge(), { t: m } = ce("common");
170
+ }, nt = () => {
171
+ const { employeeId: t, onEvent: l, startDate: D, defaultValues: O } = We(), { t: m } = ie("common");
177
172
  if (!t || !D)
178
173
  throw new Error(
179
174
  m("errors.missingParamsOrContext", {
@@ -183,7 +178,7 @@ const nt = () => {
183
178
  })
184
179
  );
185
180
  return /* @__PURE__ */ s(
186
- A,
181
+ ge,
187
182
  {
188
183
  employeeId: t,
189
184
  startDate: D,
@@ -193,7 +188,7 @@ const nt = () => {
193
188
  );
194
189
  };
195
190
  export {
196
- A as Compensation,
191
+ ge as Compensation,
197
192
  nt as CompensationContextual
198
193
  };
199
194
  //# sourceMappingURL=Compensation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Compensation.js","sources":["../../../../src/components/Employee/Compensation/Compensation.tsx"],"sourcesContent":["import { zodResolver } from '@hookform/resolvers/zod'\nimport { useEffect, useMemo, useState } from 'react'\nimport { FormProvider, useForm, type SubmitHandler } from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport { useJobsAndCompensationsGetJobsSuspense } from '@gusto/embedded-api/react-query/jobsAndCompensationsGetJobs'\nimport { useJobsAndCompensationsCreateJobMutation } from '@gusto/embedded-api/react-query/jobsAndCompensationsCreateJob'\nimport { useJobsAndCompensationsUpdateMutation } from '@gusto/embedded-api/react-query/jobsAndCompensationsUpdate'\nimport { useJobsAndCompensationsDeleteMutation } from '@gusto/embedded-api/react-query/jobsAndCompensationsDelete'\nimport { useJobsAndCompensationsUpdateCompensationMutation } from '@gusto/embedded-api/react-query/jobsAndCompensationsUpdateCompensation'\nimport { useLocationsGetMinimumWagesSuspense } from '@gusto/embedded-api/react-query/locationsGetMinimumWages'\nimport { useEmployeeAddressesGetWorkAddressesSuspense } from '@gusto/embedded-api/react-query/employeeAddressesGetWorkAddresses'\nimport { type Job } from '@gusto/embedded-api/models/components/job'\nimport type { FlsaStatusType } from '@gusto/embedded-api/models/components/flsastatustype'\nimport { useFederalTaxDetailsGetSuspense } from '@gusto/embedded-api/react-query/federalTaxDetailsGet'\nimport { useEmployeesGetSuspense } from '@gusto/embedded-api/react-query/employeesGet'\nimport type { OnboardingContextInterface } from '../OnboardingFlow/OnboardingFlow'\nimport { List } from './List'\nimport { Head } from './Head'\nimport { Edit } from './Edit'\nimport { Actions } from './Actions'\nimport {\n type CompensationInputs,\n type CompensationOutputs,\n CompensationProvider,\n CompensationSchema,\n type MODE,\n} from './useCompensation'\nimport { Form } from '@/components/Common/Form'\nimport type { RequireAtLeastOne } from '@/types/Helpers'\nimport type { PAY_PERIODS } from '@/shared/constants'\nimport { componentEvents, FlsaStatus } from '@/shared/constants'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport {\n BaseComponent,\n type BaseComponentInterface,\n useBase,\n type CommonComponentInterface,\n} from '@/components/Base'\nimport { useFlow } from '@/components/Flow/useFlow'\n\nexport type CompensationDefaultValues = RequireAtLeastOne<{\n rate?: Job['rate']\n title?: Job['title']\n paymentUnit?: (typeof PAY_PERIODS)[keyof typeof PAY_PERIODS]\n flsaStatus?: FlsaStatusType\n}>\n\ninterface CompensationProps extends CommonComponentInterface<'Employee.Compensation'> {\n employeeId: string\n startDate: string\n defaultValues?: CompensationDefaultValues\n}\n\nexport function Compensation(props: CompensationProps & BaseComponentInterface) {\n useComponentDictionary('Employee.Compensation', props.dictionary)\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nconst findCurrentCompensation = (employeeJob?: Job | null) => {\n return employeeJob?.compensations?.find(comp => comp.uuid === employeeJob.currentCompensationUuid)\n}\n\nconst Root = ({ employeeId, startDate, className, children, ...props }: CompensationProps) => {\n useI18n('Employee.Compensation')\n const { baseSubmitHandler, onEvent } = useBase()\n\n const { data: jobsData } = useJobsAndCompensationsGetJobsSuspense({ employeeId })\n const employeeJobs = jobsData.jobList!\n\n const { data: addressesData } = useEmployeeAddressesGetWorkAddressesSuspense({ employeeId })\n const workAddresses = addressesData.employeeWorkAddressesList!\n\n const currentWorkAddress = workAddresses.find(address => address.active)!\n\n const {\n data: { minimumWageList },\n } = useLocationsGetMinimumWagesSuspense({\n locationUuid: currentWorkAddress.locationUuid!,\n })\n const minimumWages = minimumWageList!\n\n const {\n data: { employee },\n } = useEmployeesGetSuspense({ employeeId })\n\n if (!employee) {\n throw new Error('Employee not found')\n }\n\n const { data } = useFederalTaxDetailsGetSuspense({ companyId: employee.companyUuid! })\n const showTwoPercentStakeholder = data.federalTaxDetails!.taxPayerType === 'S-Corporation'\n\n const updateCompensationMutation = useJobsAndCompensationsUpdateCompensationMutation()\n const createEmployeeJobMutation = useJobsAndCompensationsCreateJobMutation()\n const updateEmployeeJobMutation = useJobsAndCompensationsUpdateMutation()\n const deleteEmployeeJobMutation = useJobsAndCompensationsDeleteMutation()\n\n //Job being edited/created\n const [currentJob, setCurrentJob] = useState<Job | null>(\n employeeJobs.length === 1 ? (employeeJobs[0] ?? null) : null,\n )\n\n const [mode, setMode] = useState<MODE>(() => {\n if (!employeeJobs.length) {\n return 'ADD_INITIAL_JOB'\n }\n\n const currentCompensation = findCurrentCompensation(employeeJobs[0])\n\n if (employeeJobs.length === 1 && currentCompensation?.flsaStatus !== FlsaStatus.NONEXEMPT) {\n return 'EDIT_INITIAL_JOB'\n }\n\n return 'LIST'\n })\n\n const [showFlsaChangeWarning, setShowFlsaChangeWarning] = useState(false)\n //Getting current compensation for a job -> the one with the most recent effective date\n const currentCompensation = findCurrentCompensation(currentJob)\n /** Returns FLSA status of a current compensation of a primary job:\n * Employees can have multiple jobs, with multiple compensations, but only 1 job is primary with 1 current compensation\n */\n const primaryFlsaStatus = useMemo<string | undefined>(() => {\n return employeeJobs.reduce<string | undefined>((prev, curr) => {\n const compensation = curr.compensations?.find(\n comp => comp.uuid === curr.currentCompensationUuid,\n )\n if (!curr.primary || !compensation) return prev\n return compensation.flsaStatus ?? prev\n }, undefined)\n }, [employeeJobs])\n\n const defaultValues: CompensationInputs = useMemo(() => {\n return {\n jobTitle:\n currentJob?.title && currentJob.title !== ''\n ? currentJob.title\n : (props.defaultValues?.title ?? ''),\n flsaStatus:\n currentCompensation?.flsaStatus ?? primaryFlsaStatus ?? props.defaultValues?.flsaStatus,\n rate: Number(currentCompensation?.rate ?? props.defaultValues?.rate ?? 0),\n adjustForMinimumWage: currentCompensation?.adjustForMinimumWage ?? false,\n minimumWageId: currentCompensation?.minimumWages?.[0]?.uuid ?? '',\n paymentUnit: currentCompensation?.paymentUnit ?? props.defaultValues?.paymentUnit ?? 'Hour',\n stateWcCovered: currentJob?.stateWcCovered ?? false,\n stateWcClassCode: currentJob?.stateWcClassCode ?? '',\n } as CompensationInputs\n }, [currentJob, currentCompensation, primaryFlsaStatus, props.defaultValues])\n\n const formMethods = useForm<CompensationInputs, unknown, CompensationOutputs>({\n resolver: zodResolver(CompensationSchema),\n defaultValues,\n })\n const { resetField, setValue, handleSubmit, reset } = formMethods\n useEffect(() => {\n reset(defaultValues)\n }, [currentJob, defaultValues, reset])\n\n const submitWithEffect = async (newMode?: MODE) => {\n if (mode === 'LIST' && newMode === 'PROCEED') {\n onEvent(componentEvents.EMPLOYEE_COMPENSATION_DONE)\n return\n }\n //If no job has been modified, switch to edit mode\n if (!currentJob && mode === 'LIST') {\n setMode('ADD_ADDITIONAL_JOB')\n return\n }\n //Performing post-submit state setting only on success\n await handleSubmit(async (data: CompensationOutputs) => {\n await onSubmit(data)\n switch (newMode) {\n case 'LIST':\n setMode('LIST')\n setCurrentJob(null)\n reset(defaultValues)\n break\n default:\n onEvent(componentEvents.EMPLOYEE_COMPENSATION_DONE)\n }\n })()\n }\n const handleAdd = () => {\n setMode('ADD_ADDITIONAL_JOB')\n setCurrentJob(null)\n reset(defaultValues)\n }\n\n const handleCancelAddJob = () => {\n if (employeeJobs.length > 0) {\n setMode('LIST')\n } else {\n setMode('ADD_INITIAL_JOB')\n }\n\n setCurrentJob(null)\n reset(defaultValues)\n }\n\n const handleEdit = (uuid: string) => {\n const selectedJob = employeeJobs.find(job => uuid === job.uuid)\n if (selectedJob) {\n setMode('EDIT_ADDITIONAL_JOB')\n setCurrentJob(selectedJob)\n }\n }\n\n const handleDelete = async (jobId: string) => {\n await deleteEmployeeJobMutation.mutateAsync({ request: { jobId } })\n onEvent(componentEvents.EMPLOYEE_JOB_DELETED)\n }\n\n /**Update dependent field values upon change in FLSA type */\n const handleFlsaChange = (value: string | number) => {\n //Attempting to change flsa status from nonexempt should prompt user about deletion of other jobs associated with the employee\n if (currentCompensation?.flsaStatus === FlsaStatus.NONEXEMPT && employeeJobs.length > 1) {\n setShowFlsaChangeWarning(true)\n }\n if (value === FlsaStatus.OWNER) {\n setValue('paymentUnit', 'Paycheck')\n resetField('rate', { defaultValue: Number(currentCompensation?.rate) })\n } else if (\n value === FlsaStatus.COMMISSION_ONLY_NONEXEMPT ||\n value === FlsaStatus.COMMISSION_ONLY_EXEMPT\n ) {\n setValue('paymentUnit', 'Year')\n setValue('rate', 0)\n } else {\n //reset fields\n resetField('paymentUnit', { defaultValue: currentCompensation?.paymentUnit })\n resetField('rate', { defaultValue: Number(currentCompensation?.rate) })\n }\n }\n\n const onSubmit: SubmitHandler<CompensationOutputs> = async data => {\n await baseSubmitHandler(data, async payload => {\n const { jobTitle, twoPercentShareholder, ...compensationData } = payload\n let updatedJobData\n //Note: some of the type fixes below are due to the fact that API incorrectly defines current_compensation_uuid as optional\n if (!currentJob) {\n //Adding new job for NONEXEMPT\n const data = await createEmployeeJobMutation.mutateAsync({\n request: {\n employeeId,\n requestBody: {\n title: jobTitle,\n hireDate: startDate,\n stateWcCovered: compensationData.stateWcCovered,\n stateWcClassCode: compensationData.stateWcCovered\n ? compensationData.stateWcClassCode\n : null,\n twoPercentShareholder: twoPercentShareholder ?? false,\n },\n },\n })\n updatedJobData = data.job!\n onEvent(componentEvents.EMPLOYEE_JOB_CREATED, updatedJobData)\n } else {\n const data = await updateEmployeeJobMutation.mutateAsync({\n request: {\n jobId: currentJob.uuid,\n requestBody: {\n title: jobTitle,\n version: currentJob.version as string,\n hireDate: startDate,\n stateWcClassCode: compensationData.stateWcCovered\n ? compensationData.stateWcClassCode\n : null,\n stateWcCovered: compensationData.stateWcCovered,\n twoPercentShareholder: twoPercentShareholder ?? false,\n },\n },\n })\n updatedJobData = data.job!\n onEvent(componentEvents.EMPLOYEE_JOB_UPDATED, updatedJobData)\n }\n\n const { compensation } = await updateCompensationMutation.mutateAsync({\n request: {\n compensationId: updatedJobData.currentCompensationUuid!,\n requestBody: {\n // eslint-disable-next-line @typescript-eslint/no-non-null-asserted-optional-chain\n version: updatedJobData.compensations?.find(\n comp => comp.uuid === updatedJobData.currentCompensationUuid,\n )?.version!,\n ...compensationData,\n rate: String(compensationData.rate),\n minimumWages: compensationData.adjustForMinimumWage\n ? [{ uuid: compensationData.minimumWageId }]\n : [],\n },\n },\n })\n setShowFlsaChangeWarning(false)\n onEvent(componentEvents.EMPLOYEE_COMPENSATION_UPDATED, compensation)\n })\n }\n return (\n <section className={className}>\n <CompensationProvider\n value={{\n employeeJobs,\n currentJob,\n primaryFlsaStatus,\n showFlsaChangeWarning,\n mode,\n minimumWages,\n handleFlsaChange,\n handleDelete,\n handleEdit,\n handleAdd,\n submitWithEffect,\n handleCancelAddJob,\n isPending:\n updateCompensationMutation.isPending ||\n createEmployeeJobMutation.isPending ||\n updateEmployeeJobMutation.isPending ||\n deleteEmployeeJobMutation.isPending,\n state: currentWorkAddress.state,\n showTwoPercentStakeholder,\n }}\n >\n <FormProvider {...formMethods}>\n <Form>\n {children ? (\n children\n ) : (\n <>\n <Head />\n <List />\n <Edit />\n <Actions />\n </>\n )}\n </Form>\n </FormProvider>\n </CompensationProvider>\n </section>\n )\n}\n\nCompensation.Head = Head\nCompensation.List = List\nCompensation.Actions = Actions\nCompensation.Edit = Edit\n\nexport const CompensationContextual = () => {\n const { employeeId, onEvent, startDate, defaultValues } = useFlow<OnboardingContextInterface>()\n const { t } = useTranslation('common')\n\n if (!employeeId || !startDate) {\n throw new Error(\n t('errors.missingParamsOrContext', {\n component: 'Compensation',\n param: !employeeId ? 'employeeId' : 'startDate',\n provider: 'FlowProvider',\n }),\n )\n }\n return (\n <Compensation\n employeeId={employeeId}\n startDate={startDate}\n onEvent={onEvent}\n defaultValues={defaultValues?.compensation}\n />\n )\n}\n"],"names":["Compensation","props","useComponentDictionary","jsx","BaseComponent","Root","findCurrentCompensation","employeeJob","comp","employeeId","startDate","className","children","useI18n","baseSubmitHandler","onEvent","useBase","jobsData","useJobsAndCompensationsGetJobsSuspense","employeeJobs","addressesData","useEmployeeAddressesGetWorkAddressesSuspense","currentWorkAddress","address","minimumWageList","useLocationsGetMinimumWagesSuspense","minimumWages","employee","useEmployeesGetSuspense","data","useFederalTaxDetailsGetSuspense","showTwoPercentStakeholder","updateCompensationMutation","useJobsAndCompensationsUpdateCompensationMutation","createEmployeeJobMutation","useJobsAndCompensationsCreateJobMutation","updateEmployeeJobMutation","useJobsAndCompensationsUpdateMutation","deleteEmployeeJobMutation","useJobsAndCompensationsDeleteMutation","currentJob","setCurrentJob","useState","mode","setMode","currentCompensation","FlsaStatus","showFlsaChangeWarning","setShowFlsaChangeWarning","primaryFlsaStatus","useMemo","prev","curr","compensation","defaultValues","formMethods","useForm","zodResolver","CompensationSchema","resetField","setValue","handleSubmit","reset","useEffect","submitWithEffect","newMode","componentEvents","onSubmit","handleAdd","handleCancelAddJob","handleEdit","uuid","selectedJob","job","handleDelete","jobId","handleFlsaChange","value","payload","jobTitle","twoPercentShareholder","compensationData","updatedJobData","CompensationProvider","FormProvider","Form","jsxs","Fragment","Head","List","Edit","Actions","CompensationContextual","useFlow","t","useTranslation"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAqDO,SAASA,EAAaC,GAAmD;AACvD,SAAAC,GAAA,yBAAyBD,EAAM,UAAU,GAE9D,gBAAAE,EAACC,IAAe,EAAA,GAAGH,GACjB,UAAA,gBAAAE,EAACE,MAAM,GAAGJ,GAAQ,UAAMA,EAAA,SAAA,CAAS,EACnC,CAAA;AAEJ;AAEA,MAAMK,IAA0B,CAACC,MACxBA,GAAa,eAAe,KAAK,OAAQC,EAAK,SAASD,EAAY,uBAAuB,GAG7FF,KAAO,CAAC,EAAE,YAAAI,GAAY,WAAAC,GAAW,WAAAC,GAAW,UAAAC,GAAU,GAAGX,QAA+B;AAC5F,EAAAY,GAAQ,uBAAuB;AAC/B,QAAM,EAA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jC,WAAW;AAAA,QACX,OAAQrF,IAA4B,cAAf;AAAA,QACrB,UAAU;AAAA,MACX,CAAA;AAAA,IACH;AAGA,SAAA,gBAAAN;AAAA,IAACH;AAAA,IAAA;AAAA,MACC,YAAAS;AAAA,MACA,WAAAC;AAAA,MACA,SAAAK;AAAA,MACA,eAAeuC,GAAe;AAAA,IAAA;AAAA,EAChC;AAEJ;"}
1
+ {"version":3,"file":"Compensation.js","sources":["../../../../src/components/Employee/Compensation/Compensation.tsx"],"sourcesContent":["import { zodResolver } from '@hookform/resolvers/zod'\nimport { useEffect, useMemo, useState } from 'react'\nimport { FormProvider, useForm, type SubmitHandler } from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport { useJobsAndCompensationsGetJobsSuspense } from '@gusto/embedded-api/react-query/jobsAndCompensationsGetJobs'\nimport { useJobsAndCompensationsCreateJobMutation } from '@gusto/embedded-api/react-query/jobsAndCompensationsCreateJob'\nimport { useJobsAndCompensationsUpdateMutation } from '@gusto/embedded-api/react-query/jobsAndCompensationsUpdate'\nimport { useJobsAndCompensationsDeleteMutation } from '@gusto/embedded-api/react-query/jobsAndCompensationsDelete'\nimport { useJobsAndCompensationsUpdateCompensationMutation } from '@gusto/embedded-api/react-query/jobsAndCompensationsUpdateCompensation'\nimport { useLocationsGetMinimumWagesSuspense } from '@gusto/embedded-api/react-query/locationsGetMinimumWages'\nimport { useEmployeeAddressesGetWorkAddressesSuspense } from '@gusto/embedded-api/react-query/employeeAddressesGetWorkAddresses'\nimport { type Job } from '@gusto/embedded-api/models/components/job'\nimport type { FlsaStatusType } from '@gusto/embedded-api/models/components/flsastatustype'\nimport { useFederalTaxDetailsGetSuspense } from '@gusto/embedded-api/react-query/federalTaxDetailsGet'\nimport { useEmployeesGetSuspense } from '@gusto/embedded-api/react-query/employeesGet'\nimport type { OnboardingContextInterface } from '../OnboardingFlow/OnboardingFlow'\nimport { List } from './List'\nimport { Head } from './Head'\nimport { Edit } from './Edit'\nimport { Actions } from './Actions'\nimport {\n type CompensationInputs,\n type CompensationOutputs,\n CompensationProvider,\n CompensationSchema,\n type MODE,\n} from './useCompensation'\nimport { Form } from '@/components/Common/Form'\nimport type { RequireAtLeastOne } from '@/types/Helpers'\nimport type { PAY_PERIODS } from '@/shared/constants'\nimport { componentEvents, FlsaStatus } from '@/shared/constants'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport {\n BaseComponent,\n type BaseComponentInterface,\n useBase,\n type CommonComponentInterface,\n} from '@/components/Base'\nimport { useFlow } from '@/components/Flow/useFlow'\n\nexport type CompensationDefaultValues = RequireAtLeastOne<{\n rate?: Job['rate']\n title?: Job['title']\n paymentUnit?: (typeof PAY_PERIODS)[keyof typeof PAY_PERIODS]\n flsaStatus?: FlsaStatusType\n}>\n\ninterface CompensationProps extends CommonComponentInterface<'Employee.Compensation'> {\n employeeId: string\n startDate: string\n defaultValues?: CompensationDefaultValues\n}\n\nexport function Compensation(props: CompensationProps & BaseComponentInterface) {\n useComponentDictionary('Employee.Compensation', props.dictionary)\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nconst findCurrentCompensation = (employeeJob?: Job | null) => {\n return employeeJob?.compensations?.find(comp => comp.uuid === employeeJob.currentCompensationUuid)\n}\n\nconst Root = ({ employeeId, startDate, className, children, ...props }: CompensationProps) => {\n useI18n('Employee.Compensation')\n const { baseSubmitHandler, onEvent } = useBase()\n\n const { data: jobsData } = useJobsAndCompensationsGetJobsSuspense({ employeeId })\n const employeeJobs = jobsData.jobList!\n\n const { data: addressesData } = useEmployeeAddressesGetWorkAddressesSuspense({ employeeId })\n const workAddresses = addressesData.employeeWorkAddressesList!\n\n const currentWorkAddress = workAddresses.find(address => address.active)!\n\n const {\n data: { minimumWageList },\n } = useLocationsGetMinimumWagesSuspense({\n locationUuid: currentWorkAddress.locationUuid!,\n })\n const minimumWages = minimumWageList!\n\n const {\n data: { employee },\n } = useEmployeesGetSuspense({ employeeId })\n\n if (!employee) {\n throw new Error('Employee not found')\n }\n\n const { data } = useFederalTaxDetailsGetSuspense({ companyId: employee.companyUuid! })\n const showTwoPercentStakeholder = data.federalTaxDetails!.taxPayerType === 'S-Corporation'\n\n const updateCompensationMutation = useJobsAndCompensationsUpdateCompensationMutation()\n const createEmployeeJobMutation = useJobsAndCompensationsCreateJobMutation()\n const updateEmployeeJobMutation = useJobsAndCompensationsUpdateMutation()\n const deleteEmployeeJobMutation = useJobsAndCompensationsDeleteMutation()\n\n //Job being edited/created\n const [currentJob, setCurrentJob] = useState<Job | null>(\n employeeJobs.length === 1 ? (employeeJobs[0] ?? null) : null,\n )\n\n const [mode, setMode] = useState<MODE>(() => {\n if (!employeeJobs.length) {\n return 'ADD_INITIAL_JOB'\n }\n\n const currentCompensation = findCurrentCompensation(employeeJobs[0])\n\n if (employeeJobs.length === 1 && currentCompensation?.flsaStatus !== FlsaStatus.NONEXEMPT) {\n return 'EDIT_INITIAL_JOB'\n }\n\n return 'LIST'\n })\n\n const [showFlsaChangeWarning, setShowFlsaChangeWarning] = useState(false)\n //Getting current compensation for a job -> the one with the most recent effective date\n const currentCompensation = findCurrentCompensation(currentJob)\n /** Returns FLSA status of a current compensation of a primary job:\n * Employees can have multiple jobs, with multiple compensations, but only 1 job is primary with 1 current compensation\n */\n const primaryFlsaStatus = useMemo<string | undefined>(() => {\n return employeeJobs.reduce<string | undefined>((prev, curr) => {\n const compensation = curr.compensations?.find(\n comp => comp.uuid === curr.currentCompensationUuid,\n )\n if (!curr.primary || !compensation) return prev\n return compensation.flsaStatus ?? prev\n }, undefined)\n }, [employeeJobs])\n\n const defaultValues: CompensationInputs = useMemo(() => {\n return {\n jobTitle:\n currentJob?.title && currentJob.title !== ''\n ? currentJob.title\n : (props.defaultValues?.title ?? ''),\n flsaStatus:\n currentCompensation?.flsaStatus ?? primaryFlsaStatus ?? props.defaultValues?.flsaStatus,\n rate: Number(currentCompensation?.rate ?? props.defaultValues?.rate ?? 0),\n adjustForMinimumWage: currentCompensation?.adjustForMinimumWage ?? false,\n minimumWageId: currentCompensation?.minimumWages?.[0]?.uuid ?? '',\n paymentUnit: currentCompensation?.paymentUnit ?? props.defaultValues?.paymentUnit ?? 'Hour',\n stateWcCovered: currentJob?.stateWcCovered ?? false,\n stateWcClassCode: currentJob?.stateWcClassCode ?? '',\n } as CompensationInputs\n }, [currentJob, currentCompensation, primaryFlsaStatus, props.defaultValues])\n\n const formMethods = useForm<CompensationInputs, unknown, CompensationOutputs>({\n resolver: zodResolver(CompensationSchema),\n defaultValues,\n })\n const { resetField, setValue, handleSubmit, reset } = formMethods\n useEffect(() => {\n reset(defaultValues)\n }, [currentJob, defaultValues, reset])\n\n const submitWithEffect = async (newMode?: MODE) => {\n if (mode === 'LIST' && newMode === 'PROCEED') {\n onEvent(componentEvents.EMPLOYEE_COMPENSATION_DONE)\n return\n }\n //If no job has been modified, switch to edit mode\n if (!currentJob && mode === 'LIST') {\n setMode('ADD_ADDITIONAL_JOB')\n return\n }\n //Performing post-submit state setting only on success\n await handleSubmit(async (data: CompensationOutputs) => {\n await onSubmit(data)\n switch (newMode) {\n case 'LIST':\n setMode('LIST')\n setCurrentJob(null)\n reset(defaultValues)\n break\n default:\n onEvent(componentEvents.EMPLOYEE_COMPENSATION_DONE)\n }\n })()\n }\n const handleAdd = () => {\n setMode('ADD_ADDITIONAL_JOB')\n setCurrentJob(null)\n reset(defaultValues)\n }\n\n const handleCancelAddJob = () => {\n if (employeeJobs.length > 0) {\n setMode('LIST')\n } else {\n setMode('ADD_INITIAL_JOB')\n }\n\n setCurrentJob(null)\n reset(defaultValues)\n }\n\n const handleEdit = (uuid: string) => {\n const selectedJob = employeeJobs.find(job => uuid === job.uuid)\n if (selectedJob) {\n setMode('EDIT_ADDITIONAL_JOB')\n setCurrentJob(selectedJob)\n }\n }\n\n const handleDelete = async (jobId: string) => {\n await deleteEmployeeJobMutation.mutateAsync({ request: { jobId } })\n onEvent(componentEvents.EMPLOYEE_JOB_DELETED)\n }\n\n /**Update dependent field values upon change in FLSA type */\n const handleFlsaChange = (value: string | number) => {\n //Attempting to change flsa status from nonexempt should prompt user about deletion of other jobs associated with the employee\n if (currentCompensation?.flsaStatus === FlsaStatus.NONEXEMPT && employeeJobs.length > 1) {\n setShowFlsaChangeWarning(true)\n }\n if (value === FlsaStatus.OWNER) {\n setValue('paymentUnit', 'Paycheck')\n resetField('rate', { defaultValue: Number(currentCompensation?.rate) })\n } else if (\n value === FlsaStatus.COMMISSION_ONLY_NONEXEMPT ||\n value === FlsaStatus.COMMISSION_ONLY_EXEMPT\n ) {\n setValue('paymentUnit', 'Year')\n setValue('rate', 0)\n } else {\n //reset fields\n resetField('paymentUnit', { defaultValue: currentCompensation?.paymentUnit })\n resetField('rate', { defaultValue: Number(currentCompensation?.rate) })\n }\n }\n\n const onSubmit: SubmitHandler<CompensationOutputs> = async data => {\n await baseSubmitHandler(data, async payload => {\n const { jobTitle, twoPercentShareholder, ...compensationData } = payload\n let updatedJobData\n //Note: some of the type fixes below are due to the fact that API incorrectly defines current_compensation_uuid as optional\n if (!currentJob) {\n //Adding new job for NONEXEMPT\n const data = await createEmployeeJobMutation.mutateAsync({\n request: {\n employeeId,\n requestBody: {\n title: jobTitle,\n hireDate: startDate,\n stateWcCovered: compensationData.stateWcCovered,\n stateWcClassCode: compensationData.stateWcCovered\n ? compensationData.stateWcClassCode\n : null,\n twoPercentShareholder: twoPercentShareholder ?? false,\n },\n },\n })\n updatedJobData = data.job!\n onEvent(componentEvents.EMPLOYEE_JOB_CREATED, updatedJobData)\n } else {\n const data = await updateEmployeeJobMutation.mutateAsync({\n request: {\n jobId: currentJob.uuid,\n requestBody: {\n title: jobTitle,\n version: currentJob.version as string,\n hireDate: startDate,\n stateWcClassCode: compensationData.stateWcCovered\n ? compensationData.stateWcClassCode\n : null,\n stateWcCovered: compensationData.stateWcCovered,\n twoPercentShareholder: twoPercentShareholder ?? false,\n },\n },\n })\n updatedJobData = data.job!\n onEvent(componentEvents.EMPLOYEE_JOB_UPDATED, updatedJobData)\n }\n\n const { compensation } = await updateCompensationMutation.mutateAsync({\n request: {\n compensationId: updatedJobData.currentCompensationUuid!,\n requestBody: {\n // eslint-disable-next-line @typescript-eslint/no-non-null-asserted-optional-chain\n version: updatedJobData.compensations?.find(\n comp => comp.uuid === updatedJobData.currentCompensationUuid,\n )?.version!,\n ...compensationData,\n rate: String(compensationData.rate),\n minimumWages: compensationData.adjustForMinimumWage\n ? [{ uuid: compensationData.minimumWageId }]\n : [],\n },\n },\n })\n setShowFlsaChangeWarning(false)\n onEvent(componentEvents.EMPLOYEE_COMPENSATION_UPDATED, compensation)\n })\n }\n return (\n <section className={className}>\n <CompensationProvider\n value={{\n employeeJobs,\n currentJob,\n primaryFlsaStatus,\n showFlsaChangeWarning,\n mode,\n minimumWages,\n handleFlsaChange,\n handleDelete,\n handleEdit,\n handleAdd,\n submitWithEffect,\n handleCancelAddJob,\n isPending:\n updateCompensationMutation.isPending ||\n createEmployeeJobMutation.isPending ||\n updateEmployeeJobMutation.isPending ||\n deleteEmployeeJobMutation.isPending,\n state: currentWorkAddress.state,\n showTwoPercentStakeholder,\n }}\n >\n <FormProvider {...formMethods}>\n <Form>\n {children ? (\n children\n ) : (\n <>\n <Head />\n <List />\n <Edit />\n <Actions />\n </>\n )}\n </Form>\n </FormProvider>\n </CompensationProvider>\n </section>\n )\n}\n\nexport const CompensationContextual = () => {\n const { employeeId, onEvent, startDate, defaultValues } = useFlow<OnboardingContextInterface>()\n const { t } = useTranslation('common')\n\n if (!employeeId || !startDate) {\n throw new Error(\n t('errors.missingParamsOrContext', {\n component: 'Compensation',\n param: !employeeId ? 'employeeId' : 'startDate',\n provider: 'FlowProvider',\n }),\n )\n }\n return (\n <Compensation\n employeeId={employeeId}\n startDate={startDate}\n onEvent={onEvent}\n defaultValues={defaultValues?.compensation}\n />\n )\n}\n"],"names":["Compensation","props","useComponentDictionary","jsx","BaseComponent","Root","findCurrentCompensation","employeeJob","comp","employeeId","startDate","className","children","useI18n","baseSubmitHandler","onEvent","useBase","jobsData","useJobsAndCompensationsGetJobsSuspense","employeeJobs","addressesData","useEmployeeAddressesGetWorkAddressesSuspense","currentWorkAddress","address","minimumWageList","useLocationsGetMinimumWagesSuspense","minimumWages","employee","useEmployeesGetSuspense","data","useFederalTaxDetailsGetSuspense","showTwoPercentStakeholder","updateCompensationMutation","useJobsAndCompensationsUpdateCompensationMutation","createEmployeeJobMutation","useJobsAndCompensationsCreateJobMutation","updateEmployeeJobMutation","useJobsAndCompensationsUpdateMutation","deleteEmployeeJobMutation","useJobsAndCompensationsDeleteMutation","currentJob","setCurrentJob","useState","mode","setMode","currentCompensation","FlsaStatus","showFlsaChangeWarning","setShowFlsaChangeWarning","primaryFlsaStatus","useMemo","prev","curr","compensation","defaultValues","formMethods","useForm","zodResolver","CompensationSchema","resetField","setValue","handleSubmit","reset","useEffect","submitWithEffect","newMode","componentEvents","onSubmit","handleAdd","handleCancelAddJob","handleEdit","uuid","selectedJob","job","handleDelete","jobId","handleFlsaChange","value","payload","jobTitle","twoPercentShareholder","compensationData","updatedJobData","CompensationProvider","FormProvider","Form","jsxs","Fragment","Head","List","Edit","Actions","CompensationContextual","useFlow","t","useTranslation"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAqDO,SAASA,GAAaC,GAAmD;AACvD,SAAAC,GAAA,yBAAyBD,EAAM,UAAU,GAE9D,gBAAAE,EAACC,IAAe,EAAA,GAAGH,GACjB,UAAA,gBAAAE,EAACE,MAAM,GAAGJ,GAAQ,UAAMA,EAAA,SAAA,CAAS,EACnC,CAAA;AAEJ;AAEA,MAAMK,IAA0B,CAACC,MACxBA,GAAa,eAAe,KAAK,OAAQC,EAAK,SAASD,EAAY,uBAAuB,GAG7FF,KAAO,CAAC,EAAE,YAAAI,GAAY,WAAAC,GAAW,WAAAC,GAAW,UAAAC,GAAU,GAAGX,QAA+B;AAC5F,EAAAY,GAAQ,uBAAuB;AAC/B,QAAM,EAAE,mBAAAC,GAAmB,SAAAC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AAAA,IAAA;AAAA,MACC,YAAAS;AAAA,MACA,WAAAC;AAAA,MACA,SAAAK;AAAA,MACA,eAAeuC,GAAe;AAAA,IAAA;AAAA,EAChC;AAEJ;"}
@@ -3,9 +3,4 @@ interface DocumentListProps extends CommonComponentInterface {
3
3
  employeeId: string;
4
4
  }
5
5
  export declare function DocumentList(props: DocumentListProps & BaseComponentInterface): import("react/jsx-runtime").JSX.Element;
6
- export declare namespace DocumentList {
7
- var Head: typeof import("./Head").Head;
8
- var List: typeof import("./List").List;
9
- var Actions: typeof import("./Actions").Actions;
10
- }
11
6
  export {};
@@ -1,46 +1,43 @@
1
- import { jsx as o, jsxs as a } from "react/jsx-runtime";
2
- import { useEmployeeFormsListSuspense as L } from "@gusto/embedded-api/react-query/employeeFormsList";
3
- import { Head as u } from "./Head.js";
4
- import { List as c } from "./List.js";
5
- import { Actions as l } from "./Actions.js";
1
+ import { jsx as o, jsxs as p } from "react/jsx-runtime";
2
+ import { useEmployeeFormsListSuspense as f } from "@gusto/embedded-api/react-query/employeeFormsList";
3
+ import { Head as d } from "./Head.js";
4
+ import { List as E } from "./List.js";
5
+ import { Actions as a } from "./Actions.js";
6
6
  import { DocumentListProvider as h } from "./useDocumentList.js";
7
7
  import { BaseComponent as F } from "../../../Base/Base.js";
8
- import { useBase as S } from "../../../Base/useBase.js";
9
- import { useI18n as g } from "../../../../i18n/I18n.js";
10
- import { componentEvents as s } from "../../../../shared/constants.js";
11
- import { Flex as O } from "../../../Common/Flex/Flex.js";
12
- function n(e) {
13
- return /* @__PURE__ */ o(F, { ...e, children: /* @__PURE__ */ o(_, { ...e }) });
8
+ import { useBase as L } from "../../../Base/useBase.js";
9
+ import { useI18n as S } from "../../../../i18n/I18n.js";
10
+ import { componentEvents as m } from "../../../../shared/constants.js";
11
+ import { Flex as g } from "../../../Common/Flex/Flex.js";
12
+ function A(e) {
13
+ return /* @__PURE__ */ o(F, { ...e, children: /* @__PURE__ */ o(O, { ...e }) });
14
14
  }
15
- function _({ employeeId: e, className: p, children: t }) {
16
- g("Employee.DocumentSigner");
17
- const { onEvent: i } = S(), { data: d, error: f } = L({ employeeId: e }), m = d.formList, E = m.every((r) => !r.requiresSigning);
18
- return /* @__PURE__ */ o("section", { className: p, children: /* @__PURE__ */ o(
15
+ function O({ employeeId: e, className: s, children: n }) {
16
+ S("Employee.DocumentSigner");
17
+ const { onEvent: t } = L(), { data: u, error: c } = f({ employeeId: e }), i = u.formList, l = i.every((r) => !r.requiresSigning);
18
+ return /* @__PURE__ */ o("section", { className: s, children: /* @__PURE__ */ o(
19
19
  h,
20
20
  {
21
21
  value: {
22
- employeeForms: m,
23
- hasSignedAllForms: E,
22
+ employeeForms: i,
23
+ hasSignedAllForms: l,
24
24
  handleContinue: () => {
25
- i(s.EMPLOYEE_FORMS_DONE);
25
+ t(m.EMPLOYEE_FORMS_DONE);
26
26
  },
27
27
  handleRequestFormToSign: (r) => {
28
- i(s.EMPLOYEE_VIEW_FORM_TO_SIGN, { uuid: r.uuid });
28
+ t(m.EMPLOYEE_VIEW_FORM_TO_SIGN, { uuid: r.uuid });
29
29
  },
30
- documentListError: f
30
+ documentListError: c
31
31
  },
32
- children: t || /* @__PURE__ */ a(O, { flexDirection: "column", children: [
33
- /* @__PURE__ */ o(u, {}),
34
- /* @__PURE__ */ o(c, {}),
35
- /* @__PURE__ */ o(l, {})
32
+ children: n || /* @__PURE__ */ p(g, { flexDirection: "column", children: [
33
+ /* @__PURE__ */ o(d, {}),
34
+ /* @__PURE__ */ o(E, {}),
35
+ /* @__PURE__ */ o(a, {})
36
36
  ] })
37
37
  }
38
38
  ) });
39
39
  }
40
- n.Head = u;
41
- n.List = c;
42
- n.Actions = l;
43
40
  export {
44
- n as DocumentList
41
+ A as DocumentList
45
42
  };
46
43
  //# sourceMappingURL=DocumentList.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DocumentList.js","sources":["../../../../../src/components/Employee/DocumentSigner/DocumentList/DocumentList.tsx"],"sourcesContent":["import { useEmployeeFormsListSuspense } from '@gusto/embedded-api/react-query/employeeFormsList'\nimport { type Form } from '@gusto/embedded-api/models/components/form'\nimport { Head } from './Head'\nimport { List } from './List'\nimport { Actions } from './Actions'\nimport { DocumentListProvider } from './useDocumentList'\nimport {\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n} from '@/components/Base/Base'\nimport { useBase } from '@/components/Base/useBase'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { Flex } from '@/components/Common'\n\ninterface DocumentListProps extends CommonComponentInterface {\n employeeId: string\n}\n\nexport function DocumentList(props: DocumentListProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props} />\n </BaseComponent>\n )\n}\n\nfunction Root({ employeeId, className, children }: DocumentListProps) {\n useI18n('Employee.DocumentSigner')\n const { onEvent } = useBase()\n\n const { data, error: documentListError } = useEmployeeFormsListSuspense({ employeeId })\n const employeeForms = data.formList!\n\n const hasSignedAllForms = employeeForms.every(employeeForm => !employeeForm.requiresSigning)\n\n const handleRequestFormToSign = (data: Form) => {\n onEvent(componentEvents.EMPLOYEE_VIEW_FORM_TO_SIGN, { uuid: data.uuid })\n }\n\n const handleContinue = () => {\n onEvent(componentEvents.EMPLOYEE_FORMS_DONE)\n }\n\n return (\n <section className={className}>\n <DocumentListProvider\n value={{\n employeeForms,\n hasSignedAllForms,\n handleContinue,\n handleRequestFormToSign,\n documentListError,\n }}\n >\n {children ? (\n children\n ) : (\n <Flex flexDirection=\"column\">\n <Head />\n <List />\n <Actions />\n </Flex>\n )}\n </DocumentListProvider>\n </section>\n )\n}\n\nDocumentList.Head = Head\nDocumentList.List = List\nDocumentList.Actions = Actions\n"],"names":["DocumentList","props","jsx","BaseComponent","Root","employeeId","className","children","useI18n","onEvent","useBase","data","documentListError","useEmployeeFormsListSuspense","employeeForms","hasSignedAllForms","employeeForm","DocumentListProvider","componentEvents","jsxs","Flex","Head","List","Actions"],"mappings":";;;;;;;;;;;AAoBO,SAASA,EAAaC,GAAmD;AAE5E,SAAA,gBAAAC,EAACC,KAAe,GAAGF,GACjB,4BAACG,GAAM,EAAA,GAAGH,GAAO,EACnB,CAAA;AAEJ;AAEA,SAASG,EAAK,EAAE,YAAAC,GAAY,WAAAC,GAAW,UAAAC,KAA+B;AACpE,EAAAC,EAAQ,yBAAyB;AAC3B,QAAA,EAAE,SAAAC,EAAQ,IAAIC,EAAQ,GAEtB,EAAE,MAAAC,GAAM,OAAOC,MAAsBC,EAA6B,EAAE,YAAAR,GAAY,GAChFS,IAAgBH,EAAK,UAErBI,IAAoBD,EAAc,MAAM,CAAgBE,MAAA,CAACA,EAAa,eAAe;AAWzF,SAAA,gBAAAd,EAAC,aAAQ,WAAAI,GACP,UAAA,gBAAAJ;AAAA,IAACe;AAAA,IAAA;AAAA,MACC,OAAO;AAAA,QACL,eAAAH;AAAA,QACA,mBAAAC;AAAA,QACA,gBAVe,MAAM;AAC3B,UAAAN,EAAQS,EAAgB,mBAAmB;AAAA,QAC7C;AAAA,QASQ,yBAfwB,CAACP,MAAe;AAC9C,UAAAF,EAAQS,EAAgB,4BAA4B,EAAE,MAAMP,EAAK,MAAM;AAAA,QACzE;AAAA,QAcQ,mBAAAC;AAAA,MACF;AAAA,MAEC,UACCL,KAEC,gBAAAY,EAAAC,GAAA,EAAK,eAAc,UAClB,UAAA;AAAA,QAAA,gBAAAlB,EAACmB,GAAK,EAAA;AAAA,0BACLC,GAAK,EAAA;AAAA,0BACLC,GAAQ,CAAA,CAAA;AAAA,MAAA,EACX,CAAA;AAAA,IAAA;AAAA,EAAA,GAGN;AAEJ;AAEAvB,EAAa,OAAOqB;AACpBrB,EAAa,OAAOsB;AACpBtB,EAAa,UAAUuB;"}
1
+ {"version":3,"file":"DocumentList.js","sources":["../../../../../src/components/Employee/DocumentSigner/DocumentList/DocumentList.tsx"],"sourcesContent":["import { useEmployeeFormsListSuspense } from '@gusto/embedded-api/react-query/employeeFormsList'\nimport { type Form } from '@gusto/embedded-api/models/components/form'\nimport { Head } from './Head'\nimport { List } from './List'\nimport { Actions } from './Actions'\nimport { DocumentListProvider } from './useDocumentList'\nimport {\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n} from '@/components/Base/Base'\nimport { useBase } from '@/components/Base/useBase'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { Flex } from '@/components/Common'\n\ninterface DocumentListProps extends CommonComponentInterface {\n employeeId: string\n}\n\nexport function DocumentList(props: DocumentListProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props} />\n </BaseComponent>\n )\n}\n\nfunction Root({ employeeId, className, children }: DocumentListProps) {\n useI18n('Employee.DocumentSigner')\n const { onEvent } = useBase()\n\n const { data, error: documentListError } = useEmployeeFormsListSuspense({ employeeId })\n const employeeForms = data.formList!\n\n const hasSignedAllForms = employeeForms.every(employeeForm => !employeeForm.requiresSigning)\n\n const handleRequestFormToSign = (data: Form) => {\n onEvent(componentEvents.EMPLOYEE_VIEW_FORM_TO_SIGN, { uuid: data.uuid })\n }\n\n const handleContinue = () => {\n onEvent(componentEvents.EMPLOYEE_FORMS_DONE)\n }\n\n return (\n <section className={className}>\n <DocumentListProvider\n value={{\n employeeForms,\n hasSignedAllForms,\n handleContinue,\n handleRequestFormToSign,\n documentListError,\n }}\n >\n {children ? (\n children\n ) : (\n <Flex flexDirection=\"column\">\n <Head />\n <List />\n <Actions />\n </Flex>\n )}\n </DocumentListProvider>\n </section>\n )\n}\n"],"names":["DocumentList","props","jsx","BaseComponent","Root","employeeId","className","children","useI18n","onEvent","useBase","data","documentListError","useEmployeeFormsListSuspense","employeeForms","hasSignedAllForms","employeeForm","DocumentListProvider","componentEvents","jsxs","Flex","Head","List","Actions"],"mappings":";;;;;;;;;;;AAoBO,SAASA,EAAaC,GAAmD;AAE5E,SAAA,gBAAAC,EAACC,KAAe,GAAGF,GACjB,4BAACG,GAAM,EAAA,GAAGH,GAAO,EACnB,CAAA;AAEJ;AAEA,SAASG,EAAK,EAAE,YAAAC,GAAY,WAAAC,GAAW,UAAAC,KAA+B;AACpE,EAAAC,EAAQ,yBAAyB;AAC3B,QAAA,EAAE,SAAAC,EAAQ,IAAIC,EAAQ,GAEtB,EAAE,MAAAC,GAAM,OAAOC,MAAsBC,EAA6B,EAAE,YAAAR,GAAY,GAChFS,IAAgBH,EAAK,UAErBI,IAAoBD,EAAc,MAAM,CAAgBE,MAAA,CAACA,EAAa,eAAe;AAWzF,SAAA,gBAAAd,EAAC,aAAQ,WAAAI,GACP,UAAA,gBAAAJ;AAAA,IAACe;AAAA,IAAA;AAAA,MACC,OAAO;AAAA,QACL,eAAAH;AAAA,QACA,mBAAAC;AAAA,QACA,gBAVe,MAAM;AAC3B,UAAAN,EAAQS,EAAgB,mBAAmB;AAAA,QAC7C;AAAA,QASQ,yBAfwB,CAACP,MAAe;AAC9C,UAAAF,EAAQS,EAAgB,4BAA4B,EAAE,MAAMP,EAAK,MAAM;AAAA,QACzE;AAAA,QAcQ,mBAAAC;AAAA,MACF;AAAA,MAEC,UACCL,KAEC,gBAAAY,EAAAC,GAAA,EAAK,eAAc,UAClB,UAAA;AAAA,QAAA,gBAAAlB,EAACmB,GAAK,EAAA;AAAA,0BACLC,GAAK,EAAA;AAAA,0BACLC,GAAQ,CAAA,CAAA;AAAA,MAAA,EACX,CAAA;AAAA,IAAA;AAAA,EAAA,GAGN;AAEJ;"}
@@ -1,11 +1,5 @@
1
- import { DocumentList } from './DocumentList/DocumentList';
2
- import { SignatureForm } from './SignatureForm/SignatureForm';
3
1
  import { BaseComponentInterface } from '../../Base';
4
2
  export interface DocumentSignerProps extends BaseComponentInterface<'Employee.DocumentSigner'> {
5
3
  employeeId: string;
6
4
  }
7
- export declare const DocumentSigner: {
8
- ({ employeeId, onEvent, dictionary }: DocumentSignerProps): import("react/jsx-runtime").JSX.Element;
9
- DocumentList: typeof DocumentList;
10
- SignatureForm: typeof SignatureForm;
11
- };
5
+ export declare const DocumentSigner: ({ employeeId, onEvent, dictionary }: DocumentSignerProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,27 +1,23 @@
1
- import { jsx as i } from "react/jsx-runtime";
2
- import { createMachine as c } from "robot3";
3
- import { DocumentListContextual as p } from "./documentSignerStateMachine.js";
4
- import { documentSignerMachine as u } from "./stateMachine.js";
5
- import { DocumentList as a } from "./DocumentList/DocumentList.js";
6
- import { SignatureForm as f } from "./SignatureForm/SignatureForm.js";
7
- import { Flow as s } from "../../Flow/Flow.js";
8
- import { useComponentDictionary as g } from "../../../i18n/I18n.js";
9
- const o = ({ employeeId: t, onEvent: m, dictionary: r }) => {
10
- g("Employee.DocumentSigner", r);
11
- const e = c(
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { createMachine as i } from "robot3";
3
+ import { DocumentListContextual as c } from "./documentSignerStateMachine.js";
4
+ import { documentSignerMachine as p } from "./stateMachine.js";
5
+ import { Flow as u } from "../../Flow/Flow.js";
6
+ import { useComponentDictionary as a } from "../../../i18n/I18n.js";
7
+ const d = ({ employeeId: o, onEvent: e, dictionary: n }) => {
8
+ a("Employee.DocumentSigner", n);
9
+ const t = i(
12
10
  "index",
13
- u,
14
- (n) => ({
15
- ...n,
16
- component: p,
17
- employeeId: t
11
+ p,
12
+ (m) => ({
13
+ ...m,
14
+ component: c,
15
+ employeeId: o
18
16
  })
19
17
  );
20
- return /* @__PURE__ */ i(s, { machine: e, onEvent: m });
18
+ return /* @__PURE__ */ r(u, { machine: t, onEvent: e });
21
19
  };
22
- o.DocumentList = a;
23
- o.SignatureForm = f;
24
20
  export {
25
- o as DocumentSigner
21
+ d as DocumentSigner
26
22
  };
27
23
  //# sourceMappingURL=DocumentSigner.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DocumentSigner.js","sources":["../../../../src/components/Employee/DocumentSigner/DocumentSigner.tsx"],"sourcesContent":["import { createMachine } from 'robot3'\nimport {\n DocumentListContextual,\n type DocumentSignerContextInterface,\n} from './documentSignerStateMachine'\nimport { documentSignerMachine } from './stateMachine'\nimport { DocumentList } from './DocumentList/DocumentList'\nimport { SignatureForm } from './SignatureForm/SignatureForm'\nimport { Flow } from '@/components/Flow/Flow'\nimport type { BaseComponentInterface } from '@/components/Base'\nimport { useComponentDictionary } from '@/i18n/I18n'\n\nexport interface DocumentSignerProps extends BaseComponentInterface<'Employee.DocumentSigner'> {\n employeeId: string\n}\n\nexport const DocumentSigner = ({ employeeId, onEvent, dictionary }: DocumentSignerProps) => {\n useComponentDictionary('Employee.DocumentSigner', dictionary)\n\n const documentSigner = createMachine(\n 'index',\n documentSignerMachine,\n (initialContext: DocumentSignerContextInterface) => ({\n ...initialContext,\n component: DocumentListContextual,\n employeeId,\n }),\n )\n return <Flow machine={documentSigner} onEvent={onEvent} />\n}\n\nDocumentSigner.DocumentList = DocumentList\nDocumentSigner.SignatureForm = SignatureForm\n"],"names":["DocumentSigner","employeeId","onEvent","dictionary","useComponentDictionary","documentSigner","createMachine","documentSignerMachine","initialContext","DocumentListContextual","jsx","Flow","DocumentList","SignatureForm"],"mappings":";;;;;;;;AAgBO,MAAMA,IAAiB,CAAC,EAAE,YAAAC,GAAY,SAAAC,GAAS,YAAAC,QAAsC;AAC1F,EAAAC,EAAuB,2BAA2BD,CAAU;AAE5D,QAAME,IAAiBC;AAAA,IACrB;AAAA,IACAC;AAAA,IACA,CAACC,OAAoD;AAAA,MACnD,GAAGA;AAAA,MACH,WAAWC;AAAA,MACX,YAAAR;AAAA,IACF;AAAA,EACF;AACA,SAAQ,gBAAAS,EAAAC,GAAA,EAAK,SAASN,GAAgB,SAAAH,EAAkB,CAAA;AAC1D;AAEAF,EAAe,eAAeY;AAC9BZ,EAAe,gBAAgBa;"}
1
+ {"version":3,"file":"DocumentSigner.js","sources":["../../../../src/components/Employee/DocumentSigner/DocumentSigner.tsx"],"sourcesContent":["import { createMachine } from 'robot3'\nimport {\n DocumentListContextual,\n type DocumentSignerContextInterface,\n} from './documentSignerStateMachine'\nimport { documentSignerMachine } from './stateMachine'\nimport { Flow } from '@/components/Flow/Flow'\nimport type { BaseComponentInterface } from '@/components/Base'\nimport { useComponentDictionary } from '@/i18n/I18n'\n\nexport interface DocumentSignerProps extends BaseComponentInterface<'Employee.DocumentSigner'> {\n employeeId: string\n}\n\nexport const DocumentSigner = ({ employeeId, onEvent, dictionary }: DocumentSignerProps) => {\n useComponentDictionary('Employee.DocumentSigner', dictionary)\n\n const documentSigner = createMachine(\n 'index',\n documentSignerMachine,\n (initialContext: DocumentSignerContextInterface) => ({\n ...initialContext,\n component: DocumentListContextual,\n employeeId,\n }),\n )\n return <Flow machine={documentSigner} onEvent={onEvent} />\n}\n"],"names":["DocumentSigner","employeeId","onEvent","dictionary","useComponentDictionary","documentSigner","createMachine","documentSignerMachine","initialContext","DocumentListContextual","jsx","Flow"],"mappings":";;;;;;AAcO,MAAMA,IAAiB,CAAC,EAAE,YAAAC,GAAY,SAAAC,GAAS,YAAAC,QAAsC;AAC1F,EAAAC,EAAuB,2BAA2BD,CAAU;AAE5D,QAAME,IAAiBC;AAAA,IACrB;AAAA,IACAC;AAAA,IACA,CAACC,OAAoD;AAAA,MACnD,GAAGA;AAAA,MACH,WAAWC;AAAA,MACX,YAAAR;AAAA,IACF;AAAA,EACF;AACA,SAAQ,gBAAAS,EAAAC,GAAA,EAAK,SAASN,GAAgB,SAAAH,EAAkB,CAAA;AAC1D;"}