@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,36 +1,36 @@
1
- import { jsx as t, jsxs as J, Fragment as X } from "react/jsx-runtime";
2
- import { zodResolver as q } from "@hookform/resolvers/zod";
3
- import { useForm as B, FormProvider as V } from "react-hook-form";
4
- import { useTranslation as W } from "react-i18next";
5
- import { useEffect as Y } from "react";
6
- import { useEmployeeTaxSetupGetFederalTaxesSuspense as j } from "@gusto/embedded-api/react-query/employeeTaxSetupGetFederalTaxes";
7
- import { useEmployeeTaxSetupUpdateFederalTaxesMutation as G } from "@gusto/embedded-api/react-query/employeeTaxSetupUpdateFederalTaxes";
8
- import { useEmployeeTaxSetupGetStateTaxesSuspense as z } from "@gusto/embedded-api/react-query/employeeTaxSetupGetStateTaxes";
9
- import { useEmployeeTaxSetupUpdateStateTaxesMutation as Q } from "@gusto/embedded-api/react-query/employeeTaxSetupUpdateStateTaxes";
10
- import { Actions as w } from "./Actions.js";
11
- import { FederalFormSchema as K, FederalForm as P } from "./FederalForm.js";
12
- import { FederalHead as b } from "./FederalHead.js";
13
- import { StateFormSchema as Z, StateForm as _ } from "./StateForm.js";
14
- import { TaxesProvider as $ } from "./useTaxes.js";
15
- import { BaseComponent as ee } from "../../Base/Base.js";
16
- import { useBase as te } from "../../Base/useBase.js";
17
- import { useFlow as oe } from "../../Flow/useFlow.js";
18
- import { useI18n as se, useComponentDictionary as re } from "../../../i18n/I18n.js";
1
+ import { jsx as t, jsxs as C, Fragment as L } from "react/jsx-runtime";
2
+ import { zodResolver as M } from "@hookform/resolvers/zod";
3
+ import { useForm as O, FormProvider as J } from "react-hook-form";
4
+ import { useTranslation as X } from "react-i18next";
5
+ import { useEffect as q } from "react";
6
+ import { useEmployeeTaxSetupGetFederalTaxesSuspense as B } from "@gusto/embedded-api/react-query/employeeTaxSetupGetFederalTaxes";
7
+ import { useEmployeeTaxSetupUpdateFederalTaxesMutation as H } from "@gusto/embedded-api/react-query/employeeTaxSetupUpdateFederalTaxes";
8
+ import { useEmployeeTaxSetupGetStateTaxesSuspense as V } from "@gusto/embedded-api/react-query/employeeTaxSetupGetStateTaxes";
9
+ import { useEmployeeTaxSetupUpdateStateTaxesMutation as W } from "@gusto/embedded-api/react-query/employeeTaxSetupUpdateStateTaxes";
10
+ import { Actions as Y } from "./Actions.js";
11
+ import { FederalFormSchema as j, FederalForm as G } from "./FederalForm.js";
12
+ import { FederalHead as z } from "./FederalHead.js";
13
+ import { StateFormSchema as Q, StateForm as K } from "./StateForm.js";
14
+ import { TaxesProvider as Z } from "./useTaxes.js";
15
+ import { BaseComponent as $ } from "../../Base/Base.js";
16
+ import { useBase as ee } from "../../Base/useBase.js";
17
+ import { useFlow as te } from "../../Flow/useFlow.js";
18
+ import { useI18n as oe, useComponentDictionary as se } from "../../../i18n/I18n.js";
19
19
  import { componentEvents as S } from "../../../shared/constants.js";
20
- import { snakeCaseToCamelCase as g } from "../../../helpers/formattedStrings.js";
21
- import { Form as ae } from "../../Common/Form/Form.js";
20
+ import { snakeCaseToCamelCase as A } from "../../../helpers/formattedStrings.js";
21
+ import { Form as re } from "../../Common/Form/Form.js";
22
22
  const ne = "2010-01-01";
23
- function u(o) {
24
- return /* @__PURE__ */ t(ee, { ...o, children: /* @__PURE__ */ t(me, { ...o, children: o.children }) });
23
+ function ae(o) {
24
+ return /* @__PURE__ */ t($, { ...o, children: /* @__PURE__ */ t(ie, { ...o, children: o.children }) });
25
25
  }
26
- const me = (o) => {
27
- const { employeeId: m, className: y, children: p, isAdmin: h = !1, dictionary: D } = o, { onEvent: T, fieldErrors: c, baseSubmitHandler: U } = te();
28
- se("Employee.Taxes"), re("Employee.Taxes", D);
29
- const { data: N } = j({
30
- employeeUuid: m
31
- }), e = N.employeeFederalTax, { mutateAsync: k, isPending: I } = G(), { data: R } = z({
32
- employeeUuid: m
33
- }), E = R.employeeStateTaxesList, { mutateAsync: C, isPending: L } = Q(), M = {
26
+ const ie = (o) => {
27
+ const { employeeId: i, className: f, children: u, isAdmin: h = !1, dictionary: g } = o, { onEvent: y, fieldErrors: p, baseSubmitHandler: w } = ee();
28
+ oe("Employee.Taxes"), se("Employee.Taxes", g);
29
+ const { data: P } = B({
30
+ employeeUuid: i
31
+ }), e = P.employeeFederalTax, { mutateAsync: b, isPending: _ } = H(), { data: D } = V({
32
+ employeeUuid: i
33
+ }), T = D.employeeStateTaxesList, { mutateAsync: U, isPending: N } = W(), k = {
34
34
  ...e,
35
35
  filingStatus: e.filingStatus ?? void 0,
36
36
  twoJobs: e.twoJobs ? "true" : "false",
@@ -38,32 +38,32 @@ const me = (o) => {
38
38
  dependentsAmount: e.dependentsAmount ? Number(e.dependentsAmount) : 0,
39
39
  otherIncome: e.otherIncome ? Number(e.otherIncome) : 0,
40
40
  extraWithholding: e.extraWithholding ? Number(e.extraWithholding) : 0,
41
- states: E.reduce((s, r) => (r.state && (s[r.state] = r.questions?.reduce((a, l) => {
42
- const d = l.answers[0]?.value, i = g(l.key);
43
- return i === "fileNewHireReport" ? a[i] = typeof d > "u" ? !0 : d : a[i] = d, a;
41
+ states: T.reduce((s, r) => (r.state && (s[r.state] = r.questions?.reduce((n, l) => {
42
+ const d = l.answers[0]?.value, m = A(l.key);
43
+ return m === "fileNewHireReport" ? n[m] = typeof d > "u" ? !0 : d : n[m] = d, n;
44
44
  }, {})), s), {})
45
- }, v = B({
46
- resolver: q(K.merge(Z)),
47
- defaultValues: M
48
- }), { handleSubmit: O, setError: A } = v;
49
- return Y(() => {
50
- c && c.length > 0 && c.forEach((s) => {
45
+ }, F = O({
46
+ resolver: M(j.merge(Q)),
47
+ defaultValues: k
48
+ }), { handleSubmit: I, setError: v } = F;
49
+ return q(() => {
50
+ p && p.length > 0 && p.forEach((s) => {
51
51
  const r = s.key.replace(".value", "");
52
- A(r, { type: "custom", message: s.message });
52
+ v(r, { type: "custom", message: s.message });
53
53
  });
54
- }, [c, A]), /* @__PURE__ */ t("section", { className: y, children: /* @__PURE__ */ t(
55
- $,
54
+ }, [p, v]), /* @__PURE__ */ t("section", { className: f, children: /* @__PURE__ */ t(
55
+ Z,
56
56
  {
57
57
  value: {
58
- employeeStateTaxes: E,
58
+ employeeStateTaxes: T,
59
59
  isAdmin: h,
60
- isPending: I || L
60
+ isPending: _ || N
61
61
  },
62
- children: /* @__PURE__ */ t(V, { ...v, children: /* @__PURE__ */ t(ae, { onSubmit: O(async (s) => {
63
- await U(s, async (r) => {
64
- const { states: a, ...l } = r, d = await k({
62
+ children: /* @__PURE__ */ t(J, { ...F, children: /* @__PURE__ */ t(re, { onSubmit: I(async (s) => {
63
+ await w(s, async (r) => {
64
+ const { states: n, ...l } = r, d = await b({
65
65
  request: {
66
- employeeUuid: m,
66
+ employeeUuid: i,
67
67
  requestBody: {
68
68
  ...l,
69
69
  twoJobs: l.twoJobs === "true",
@@ -71,64 +71,59 @@ const me = (o) => {
71
71
  }
72
72
  }
73
73
  });
74
- if (T(S.EMPLOYEE_FEDERAL_TAXES_UPDATED, d), a && Object.keys(a).length > 0) {
75
- const i = [];
76
- for (const x of E) {
77
- const F = x.state;
78
- F && x.questions !== void 0 && i.push({
79
- state: F,
80
- questions: x.questions.map((n) => {
81
- if (n.isQuestionForAdminOnly && !h)
74
+ if (y(S.EMPLOYEE_FEDERAL_TAXES_UPDATED, d), n && Object.keys(n).length > 0) {
75
+ const m = [];
76
+ for (const E of T) {
77
+ const x = E.state;
78
+ x && E.questions !== void 0 && m.push({
79
+ state: x,
80
+ questions: E.questions.map((a) => {
81
+ if (a.isQuestionForAdminOnly && !h)
82
82
  return null;
83
- const f = a[F]?.[g(n.key)];
83
+ const c = n[x]?.[A(a.key)];
84
84
  return {
85
- key: n.key,
85
+ key: a.key,
86
86
  answers: [
87
87
  {
88
- validFrom: n.answers[0]?.validFrom ?? ne,
89
- validUpTo: n.answers[0]?.validUpTo ?? null,
90
- value: f == null || typeof f == "number" && isNaN(f) ? "" : f
88
+ validFrom: a.answers[0]?.validFrom ?? ne,
89
+ validUpTo: a.answers[0]?.validUpTo ?? null,
90
+ value: c == null || typeof c == "number" && isNaN(c) ? "" : c
91
91
  }
92
92
  ]
93
93
  };
94
- }).filter((n) => n !== null)
94
+ }).filter((a) => a !== null)
95
95
  //Filtering out questions in non-admin setup
96
96
  });
97
97
  }
98
- const H = await C({
99
- request: { employeeUuid: m, employeeStateTaxesRequest: { states: i } }
98
+ const R = await U({
99
+ request: { employeeUuid: i, employeeStateTaxesRequest: { states: m } }
100
100
  });
101
- T(S.EMPLOYEE_STATE_TAXES_UPDATED, H);
101
+ y(S.EMPLOYEE_STATE_TAXES_UPDATED, R);
102
102
  }
103
- T(S.EMPLOYEE_TAXES_DONE);
103
+ y(S.EMPLOYEE_TAXES_DONE);
104
104
  });
105
- }), children: p || /* @__PURE__ */ J(X, { children: [
106
- /* @__PURE__ */ t(b, {}),
107
- /* @__PURE__ */ t(P, {}),
108
- /* @__PURE__ */ t(_, {}),
109
- /* @__PURE__ */ t(w, {})
105
+ }), children: u || /* @__PURE__ */ C(L, { children: [
106
+ /* @__PURE__ */ t(z, {}),
107
+ /* @__PURE__ */ t(G, {}),
108
+ /* @__PURE__ */ t(K, {}),
109
+ /* @__PURE__ */ t(Y, {})
110
110
  ] }) }) })
111
111
  }
112
112
  ) });
113
- };
114
- u.FederalHead = b;
115
- u.FederalForm = P;
116
- u.StateForm = _;
117
- u.Actions = w;
118
- const Ue = () => {
119
- const { employeeId: o, onEvent: m, isAdmin: y } = oe(), { t: p } = W();
113
+ }, Ue = () => {
114
+ const { employeeId: o, onEvent: i, isAdmin: f } = te(), { t: u } = X();
120
115
  if (!o)
121
116
  throw new Error(
122
- p("errors.missingParamsOrContext", {
117
+ u("errors.missingParamsOrContext", {
123
118
  component: "EmployeeTaxes",
124
119
  param: "employeeId",
125
120
  provider: "FlowProvider"
126
121
  })
127
122
  );
128
- return /* @__PURE__ */ t(u, { employeeId: o, onEvent: m, isAdmin: y ?? !1 });
123
+ return /* @__PURE__ */ t(ae, { employeeId: o, onEvent: i, isAdmin: f ?? !1 });
129
124
  };
130
125
  export {
131
- u as Taxes,
126
+ ae as Taxes,
132
127
  Ue as TaxesContextual
133
128
  };
134
129
  //# sourceMappingURL=Taxes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Taxes.js","sources":["../../../../src/components/Employee/Taxes/Taxes.tsx"],"sourcesContent":["import { zodResolver } from '@hookform/resolvers/zod'\nimport { FormProvider, useForm, type SubmitHandler } from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport { useEffect } from 'react'\nimport { useEmployeeTaxSetupGetFederalTaxesSuspense } from '@gusto/embedded-api/react-query/employeeTaxSetupGetFederalTaxes'\nimport { useEmployeeTaxSetupUpdateFederalTaxesMutation } from '@gusto/embedded-api/react-query/employeeTaxSetupUpdateFederalTaxes'\nimport { useEmployeeTaxSetupGetStateTaxesSuspense } from '@gusto/embedded-api/react-query/employeeTaxSetupGetStateTaxes'\nimport { useEmployeeTaxSetupUpdateStateTaxesMutation } from '@gusto/embedded-api/react-query/employeeTaxSetupUpdateStateTaxes'\nimport type { OnboardingContextInterface } from '../OnboardingFlow/OnboardingFlow'\nimport { Actions } from './Actions'\nimport {\n FederalForm,\n FederalFormSchema,\n type FederalFormInputs,\n type FederalFormPayload,\n} from './FederalForm'\nimport { FederalHead } from './FederalHead'\nimport { StateForm, StateFormSchema, type StateFormPayload } from './StateForm'\nimport { TaxesProvider } from './useTaxes'\nimport {\n useBase,\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n} from '@/components/Base'\nimport { useFlow } from '@/components/Flow/useFlow'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { snakeCaseToCamelCase } from '@/helpers/formattedStrings'\nimport { Form } from '@/components/Common/Form'\nimport { useComponentDictionary } from '@/i18n/I18n'\n\nconst DEFAULT_TAX_VALID_FROM = '2010-01-01'\n\ninterface TaxesProps extends CommonComponentInterface<'Employee.Taxes'> {\n employeeId: string\n isAdmin?: boolean\n}\n\nexport function Taxes(props: TaxesProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nconst Root = (props: TaxesProps) => {\n const { employeeId, className, children, isAdmin = false, dictionary } = props\n const { onEvent, fieldErrors, baseSubmitHandler } = useBase()\n useI18n('Employee.Taxes')\n useComponentDictionary('Employee.Taxes', dictionary)\n\n const { data: fedData } = useEmployeeTaxSetupGetFederalTaxesSuspense({\n employeeUuid: employeeId,\n })\n const employeeFederalTax = fedData.employeeFederalTax!\n\n const { mutateAsync: updateFederalTaxes, isPending: isPendingFederalTaxes } =\n useEmployeeTaxSetupUpdateFederalTaxesMutation()\n\n const { data: stateData } = useEmployeeTaxSetupGetStateTaxesSuspense({\n employeeUuid: employeeId,\n })\n const employeeStateTaxes = stateData.employeeStateTaxesList!\n const { mutateAsync: updateStateTaxes, isPending: isPendingStateTaxes } =\n useEmployeeTaxSetupUpdateStateTaxesMutation()\n\n const defaultValues = {\n ...employeeFederalTax,\n filingStatus: employeeFederalTax.filingStatus ?? undefined,\n twoJobs: employeeFederalTax.twoJobs ? 'true' : 'false',\n deductions: employeeFederalTax.deductions ? Number(employeeFederalTax.deductions) : 0,\n dependentsAmount: employeeFederalTax.dependentsAmount\n ? Number(employeeFederalTax.dependentsAmount)\n : 0,\n otherIncome: employeeFederalTax.otherIncome ? Number(employeeFederalTax.otherIncome) : 0,\n extraWithholding: employeeFederalTax.extraWithholding\n ? Number(employeeFederalTax.extraWithholding)\n : 0,\n states: employeeStateTaxes.reduce((acc: Record<string, unknown>, state) => {\n if (state.state) {\n acc[state.state] = state.questions?.reduce((acc: Record<string, unknown>, question) => {\n const value = question.answers[0]?.value\n const key = snakeCaseToCamelCase(question.key)\n // Default new hire report to true if not specified\n if (key === 'fileNewHireReport') {\n acc[key] = typeof value === 'undefined' ? true : value\n } else {\n acc[key] = value\n }\n return acc\n }, {})\n }\n return acc\n }, {}),\n }\n\n const formMethods = useForm<FederalFormInputs, unknown, FederalFormPayload & StateFormPayload>({\n resolver: zodResolver(FederalFormSchema.merge(StateFormSchema)),\n defaultValues,\n })\n const { handleSubmit, setError: _setError } = formMethods\n\n useEffect(() => {\n //If list of field specific errors from API is present, mark corresponding fields as invalid\n if (fieldErrors && fieldErrors.length > 0) {\n fieldErrors.forEach(msgObject => {\n const key = msgObject.key.replace('.value', '')\n _setError(key as keyof FederalFormInputs, { type: 'custom', message: msgObject.message })\n })\n }\n }, [fieldErrors, _setError])\n\n const onSubmit: SubmitHandler<FederalFormPayload & StateFormPayload> = async data => {\n await baseSubmitHandler(data, async payload => {\n const { states: statesPayload, ...federalPayload } = payload\n\n const federalTaxesResponse = await updateFederalTaxes({\n request: {\n employeeUuid: employeeId,\n requestBody: {\n ...federalPayload,\n twoJobs: federalPayload.twoJobs === 'true',\n version: employeeFederalTax.version,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_FEDERAL_TAXES_UPDATED, federalTaxesResponse)\n\n //State Taxes - only process if statesPayload exists\n if (statesPayload && Object.keys(statesPayload).length > 0) {\n const states = []\n\n for (const state of employeeStateTaxes) {\n const stateName = state.state\n\n if (stateName && state.questions !== undefined) {\n states.push({\n state: stateName,\n questions: state.questions\n .map(question => {\n if (question.isQuestionForAdminOnly && !isAdmin) {\n return null\n }\n const formValue = statesPayload[stateName]?.[snakeCaseToCamelCase(question.key)]\n return {\n key: question.key,\n answers: [\n {\n validFrom: question.answers[0]?.validFrom ?? DEFAULT_TAX_VALID_FROM,\n validUpTo: question.answers[0]?.validUpTo ?? null,\n value:\n formValue == null || (typeof formValue === 'number' && isNaN(formValue))\n ? ''\n : (formValue as string | number | boolean),\n },\n ],\n }\n })\n .filter(q => q !== null), //Filtering out questions in non-admin setup\n })\n }\n }\n\n const stateTaxesResponse = await updateStateTaxes({\n request: { employeeUuid: employeeId, employeeStateTaxesRequest: { states } },\n })\n onEvent(componentEvents.EMPLOYEE_STATE_TAXES_UPDATED, stateTaxesResponse)\n }\n\n onEvent(componentEvents.EMPLOYEE_TAXES_DONE)\n })\n }\n\n return (\n <section className={className}>\n <TaxesProvider\n value={{\n employeeStateTaxes,\n isAdmin: isAdmin,\n isPending: isPendingFederalTaxes || isPendingStateTaxes,\n }}\n >\n <FormProvider {...formMethods}>\n <Form onSubmit={handleSubmit(onSubmit)}>\n {children ? (\n children\n ) : (\n <>\n <FederalHead />\n <FederalForm />\n <StateForm />\n <Actions />\n </>\n )}\n </Form>\n </FormProvider>\n </TaxesProvider>\n </section>\n )\n}\nTaxes.FederalHead = FederalHead\nTaxes.FederalForm = FederalForm\nTaxes.StateForm = StateForm\nTaxes.Actions = Actions\n\nexport const TaxesContextual = () => {\n const { employeeId, onEvent, isAdmin } = useFlow<OnboardingContextInterface>()\n const { t } = useTranslation()\n if (!employeeId) {\n throw new Error(\n t('errors.missingParamsOrContext', {\n component: 'EmployeeTaxes',\n param: 'employeeId',\n provider: 'FlowProvider',\n }),\n )\n }\n return <Taxes employeeId={employeeId} onEvent={onEvent} isAdmin={isAdmin ?? false} />\n}\n"],"names":["DEFAULT_TAX_VALID_FROM","Taxes","props","jsx","BaseComponent","Root","employeeId","className","children","isAdmin","dictionary","onEvent","fieldErrors","baseSubmitHandler","useBase","useI18n","useComponentDictionary","fedData","useEmployeeTaxSetupGetFederalTaxesSuspense","employeeFederalTax","updateFederalTaxes","isPendingFederalTaxes","useEmployeeTaxSetupUpdateFederalTaxesMutation","stateData","useEmployeeTaxSetupGetStateTaxesSuspense","employeeStateTaxes","updateStateTaxes","isPendingStateTaxes","useEmployeeTaxSetupUpdateStateTaxesMutation","defaultValues","acc","state","question","value","key","snakeCaseToCamelCase","formMethods","useForm","zodResolver","FederalFormSchema","StateFormSchema","handleSubmit","_setError","useEffect","msgObject","TaxesProvider","FormProvider","Form","data","payload","statesPayload","federalPayload","federalTaxesResponse","componentEvents","states","stateName","formValue","q","stateTaxesResponse","jsxs","Fragment","FederalHead","FederalForm","StateForm","Actions","TaxesContextual","useFlow","t","useTranslation"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAgCA,MAAMA,KAAyB;AAOxB,SAASC,EAAMC,GAA4C;AAE9D,SAAA,gBAAAC,EAACC,IAAe,EAAA,GAAGF,GACjB,UAAA,gBAAAC,EAACE,MAAM,GAAGH,GAAQ,UAAMA,EAAA,SAAA,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A,EAAA,GAEJ;AAEJ;AACA/D,EAAM,cAAc4D;AACpB5D,EAAM,cAAc6D;AACpB7D,EAAM,YAAY8D;AAClB9D,EAAM,UAAU+D;AAET,MAAMC,KAAkB,MAAM;AACnC,QAAM,EAAE,YAAA3D,GAAY,SAAAK,GAAS,SAAAF,EAAA,IAAYyD,GAAoC,GACvE,EAAE,GAAAC,EAAE,IAAIC,EAAe;AAC7B,MAAI,CAAC9D;AACH,UAAM,IAAI;AAAA,MACR6D,EAAE,iCAAiC;AAAA,QACjC,WAAW;AAAA,QACX,OAAO;AAAA,QACP,UAAU;AAAA,MACX,CAAA;AAAA,IACH;AAEF,2BAAQlE,GAAM,EAAA,YAAAK,GAAwB,SAAAK,GAAkB,SAASF,KAAW,IAAO;AACrF;"}
1
+ {"version":3,"file":"Taxes.js","sources":["../../../../src/components/Employee/Taxes/Taxes.tsx"],"sourcesContent":["import { zodResolver } from '@hookform/resolvers/zod'\nimport { FormProvider, useForm, type SubmitHandler } from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport { useEffect } from 'react'\nimport { useEmployeeTaxSetupGetFederalTaxesSuspense } from '@gusto/embedded-api/react-query/employeeTaxSetupGetFederalTaxes'\nimport { useEmployeeTaxSetupUpdateFederalTaxesMutation } from '@gusto/embedded-api/react-query/employeeTaxSetupUpdateFederalTaxes'\nimport { useEmployeeTaxSetupGetStateTaxesSuspense } from '@gusto/embedded-api/react-query/employeeTaxSetupGetStateTaxes'\nimport { useEmployeeTaxSetupUpdateStateTaxesMutation } from '@gusto/embedded-api/react-query/employeeTaxSetupUpdateStateTaxes'\nimport type { OnboardingContextInterface } from '../OnboardingFlow/OnboardingFlow'\nimport { Actions } from './Actions'\nimport {\n FederalForm,\n FederalFormSchema,\n type FederalFormInputs,\n type FederalFormPayload,\n} from './FederalForm'\nimport { FederalHead } from './FederalHead'\nimport { StateForm, StateFormSchema, type StateFormPayload } from './StateForm'\nimport { TaxesProvider } from './useTaxes'\nimport {\n useBase,\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n} from '@/components/Base'\nimport { useFlow } from '@/components/Flow/useFlow'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { snakeCaseToCamelCase } from '@/helpers/formattedStrings'\nimport { Form } from '@/components/Common/Form'\nimport { useComponentDictionary } from '@/i18n/I18n'\n\nconst DEFAULT_TAX_VALID_FROM = '2010-01-01'\n\ninterface TaxesProps extends CommonComponentInterface<'Employee.Taxes'> {\n employeeId: string\n isAdmin?: boolean\n}\n\nexport function Taxes(props: TaxesProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nconst Root = (props: TaxesProps) => {\n const { employeeId, className, children, isAdmin = false, dictionary } = props\n const { onEvent, fieldErrors, baseSubmitHandler } = useBase()\n useI18n('Employee.Taxes')\n useComponentDictionary('Employee.Taxes', dictionary)\n\n const { data: fedData } = useEmployeeTaxSetupGetFederalTaxesSuspense({\n employeeUuid: employeeId,\n })\n const employeeFederalTax = fedData.employeeFederalTax!\n\n const { mutateAsync: updateFederalTaxes, isPending: isPendingFederalTaxes } =\n useEmployeeTaxSetupUpdateFederalTaxesMutation()\n\n const { data: stateData } = useEmployeeTaxSetupGetStateTaxesSuspense({\n employeeUuid: employeeId,\n })\n const employeeStateTaxes = stateData.employeeStateTaxesList!\n const { mutateAsync: updateStateTaxes, isPending: isPendingStateTaxes } =\n useEmployeeTaxSetupUpdateStateTaxesMutation()\n\n const defaultValues = {\n ...employeeFederalTax,\n filingStatus: employeeFederalTax.filingStatus ?? undefined,\n twoJobs: employeeFederalTax.twoJobs ? 'true' : 'false',\n deductions: employeeFederalTax.deductions ? Number(employeeFederalTax.deductions) : 0,\n dependentsAmount: employeeFederalTax.dependentsAmount\n ? Number(employeeFederalTax.dependentsAmount)\n : 0,\n otherIncome: employeeFederalTax.otherIncome ? Number(employeeFederalTax.otherIncome) : 0,\n extraWithholding: employeeFederalTax.extraWithholding\n ? Number(employeeFederalTax.extraWithholding)\n : 0,\n states: employeeStateTaxes.reduce((acc: Record<string, unknown>, state) => {\n if (state.state) {\n acc[state.state] = state.questions?.reduce((acc: Record<string, unknown>, question) => {\n const value = question.answers[0]?.value\n const key = snakeCaseToCamelCase(question.key)\n // Default new hire report to true if not specified\n if (key === 'fileNewHireReport') {\n acc[key] = typeof value === 'undefined' ? true : value\n } else {\n acc[key] = value\n }\n return acc\n }, {})\n }\n return acc\n }, {}),\n }\n\n const formMethods = useForm<FederalFormInputs, unknown, FederalFormPayload & StateFormPayload>({\n resolver: zodResolver(FederalFormSchema.merge(StateFormSchema)),\n defaultValues,\n })\n const { handleSubmit, setError: _setError } = formMethods\n\n useEffect(() => {\n //If list of field specific errors from API is present, mark corresponding fields as invalid\n if (fieldErrors && fieldErrors.length > 0) {\n fieldErrors.forEach(msgObject => {\n const key = msgObject.key.replace('.value', '')\n _setError(key as keyof FederalFormInputs, { type: 'custom', message: msgObject.message })\n })\n }\n }, [fieldErrors, _setError])\n\n const onSubmit: SubmitHandler<FederalFormPayload & StateFormPayload> = async data => {\n await baseSubmitHandler(data, async payload => {\n const { states: statesPayload, ...federalPayload } = payload\n\n const federalTaxesResponse = await updateFederalTaxes({\n request: {\n employeeUuid: employeeId,\n requestBody: {\n ...federalPayload,\n twoJobs: federalPayload.twoJobs === 'true',\n version: employeeFederalTax.version,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_FEDERAL_TAXES_UPDATED, federalTaxesResponse)\n\n //State Taxes - only process if statesPayload exists\n if (statesPayload && Object.keys(statesPayload).length > 0) {\n const states = []\n\n for (const state of employeeStateTaxes) {\n const stateName = state.state\n\n if (stateName && state.questions !== undefined) {\n states.push({\n state: stateName,\n questions: state.questions\n .map(question => {\n if (question.isQuestionForAdminOnly && !isAdmin) {\n return null\n }\n const formValue = statesPayload[stateName]?.[snakeCaseToCamelCase(question.key)]\n return {\n key: question.key,\n answers: [\n {\n validFrom: question.answers[0]?.validFrom ?? DEFAULT_TAX_VALID_FROM,\n validUpTo: question.answers[0]?.validUpTo ?? null,\n value:\n formValue == null || (typeof formValue === 'number' && isNaN(formValue))\n ? ''\n : (formValue as string | number | boolean),\n },\n ],\n }\n })\n .filter(q => q !== null), //Filtering out questions in non-admin setup\n })\n }\n }\n\n const stateTaxesResponse = await updateStateTaxes({\n request: { employeeUuid: employeeId, employeeStateTaxesRequest: { states } },\n })\n onEvent(componentEvents.EMPLOYEE_STATE_TAXES_UPDATED, stateTaxesResponse)\n }\n\n onEvent(componentEvents.EMPLOYEE_TAXES_DONE)\n })\n }\n\n return (\n <section className={className}>\n <TaxesProvider\n value={{\n employeeStateTaxes,\n isAdmin: isAdmin,\n isPending: isPendingFederalTaxes || isPendingStateTaxes,\n }}\n >\n <FormProvider {...formMethods}>\n <Form onSubmit={handleSubmit(onSubmit)}>\n {children ? (\n children\n ) : (\n <>\n <FederalHead />\n <FederalForm />\n <StateForm />\n <Actions />\n </>\n )}\n </Form>\n </FormProvider>\n </TaxesProvider>\n </section>\n )\n}\n\nexport const TaxesContextual = () => {\n const { employeeId, onEvent, isAdmin } = useFlow<OnboardingContextInterface>()\n const { t } = useTranslation()\n if (!employeeId) {\n throw new Error(\n t('errors.missingParamsOrContext', {\n component: 'EmployeeTaxes',\n param: 'employeeId',\n provider: 'FlowProvider',\n }),\n )\n }\n return <Taxes employeeId={employeeId} onEvent={onEvent} isAdmin={isAdmin ?? false} />\n}\n"],"names":["DEFAULT_TAX_VALID_FROM","Taxes","props","jsx","BaseComponent","Root","employeeId","className","children","isAdmin","dictionary","onEvent","fieldErrors","baseSubmitHandler","useBase","useI18n","useComponentDictionary","fedData","useEmployeeTaxSetupGetFederalTaxesSuspense","employeeFederalTax","updateFederalTaxes","isPendingFederalTaxes","useEmployeeTaxSetupUpdateFederalTaxesMutation","stateData","useEmployeeTaxSetupGetStateTaxesSuspense","employeeStateTaxes","updateStateTaxes","isPendingStateTaxes","useEmployeeTaxSetupUpdateStateTaxesMutation","defaultValues","acc","state","question","value","key","snakeCaseToCamelCase","formMethods","useForm","zodResolver","FederalFormSchema","StateFormSchema","handleSubmit","_setError","useEffect","msgObject","TaxesProvider","FormProvider","Form","data","payload","statesPayload","federalPayload","federalTaxesResponse","componentEvents","states","stateName","formValue","q","stateTaxesResponse","jsxs","Fragment","FederalHead","FederalForm","StateForm","Actions","TaxesContextual","useFlow","t","useTranslation"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAgCA,MAAMA,KAAyB;AAOxB,SAASC,GAAMC,GAA4C;AAE9D,SAAA,gBAAAC,EAACC,GAAe,EAAA,GAAGF,GACjB,UAAA,gBAAAC,EAACE,MAAM,GAAGH,GAAQ,UAAMA,EAAA,SAAA,CAAS,EACnC,CAAA;AAEJ;AAEA,MAAMG,KAAO,CAACH,MAAsB;AAClC,QAAM,EAAE,YAAAI,GAAY,WAAAC,GAAW,UAAAC,GAAU,SAAAC,IAAU,IAAO,YAAAC,MAAeR,GACnE,EAAE,SAAAS,GAAS,aAAAC,GAAa,mBAAAC,EAAA,IAAsBC,GAAQ;AAC5D,EAAAC,GAAQ,gBAAgB,GACxBC,GAAuB,kBAAkBN,CAAU;AAEnD,QAAM,EAAE,MAAMO,EAAQ,IAAIC,EAA2C;AAAA,IACnE,cAAcZ;AAAA,EAAA,CACf,GACKa,IAAqBF,EAAQ,oBAE7B,EAAE,aAAaG,GAAoB,WAAWC,EAAA,IAClDC,EAA8C,GAE1C,EAAE,MAAMC,EAAU,IAAIC,EAAyC;AAAA,IACnE,cAAclB;AAAA,EAAA,CACf,GACKmB,IAAqBF,EAAU,wBAC/B,EAAE,aAAaG,GAAkB,WAAWC,EAAA,IAChDC,EAA4C,GAExCC,IAAgB;AAAA,IACpB,GAAGV;AAAA,IACH,cAAcA,EAAmB,gBAAgB;AAAA,IACjD,SAASA,EAAmB,UAAU,SAAS;AAAA,IAC/C,YAAYA,EAAmB,aAAa,OAAOA,EAAmB,UAAU,IAAI;AAAA,IACpF,kBAAkB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AAE,cAAcpB,GAAY,2BAA2B,EAAE,QAAAgD,EAAS,EAAA;AAAA,YAAA,CAC5E;AACO,YAAA3C,EAAA0C,EAAgB,8BAA8BK,CAAkB;AAAA,UAAA;AAG1E,UAAA/C,EAAQ0C,EAAgB,mBAAmB;AAAA,QAAA,CAC5C;AAAA,MACH,CAY6C,GAClC,UACC7C,KAGE,gBAAAmD,EAAAC,GAAA,EAAA,UAAA;AAAA,QAAA,gBAAAzD,EAAC0D,GAAY,EAAA;AAAA,0BACZC,GAAY,EAAA;AAAA,0BACZC,GAAU,EAAA;AAAA,0BACVC,GAAQ,CAAA,CAAA;AAAA,MAAA,EACX,CAAA,EAEJ,CAAA,EACF,CAAA;AAAA,IAAA;AAAA,EAAA,GAEJ;AAEJ,GAEaC,KAAkB,MAAM;AACnC,QAAM,EAAE,YAAA3D,GAAY,SAAAK,GAAS,SAAAF,EAAA,IAAYyD,GAAoC,GACvE,EAAE,GAAAC,EAAE,IAAIC,EAAe;AAC7B,MAAI,CAAC9D;AACH,UAAM,IAAI;AAAA,MACR6D,EAAE,iCAAiC;AAAA,QACjC,WAAW;AAAA,QACX,OAAO;AAAA,QACP,UAAU;AAAA,MACX,CAAA;AAAA,IACH;AAEF,2BAAQlE,IAAM,EAAA,YAAAK,GAAwB,SAAAK,GAAkB,SAASF,KAAW,IAAO;AACrF;"}
package/dist/i18n/I18n.js CHANGED
@@ -5,7 +5,7 @@ const C = "common", s = new l(50), c = ({ lng: n = "en", ns: o }) => {
5
5
  let e = !0, t = !1, r;
6
6
  const i = (async () => {
7
7
  try {
8
- r = (await p(/* @__PURE__ */ Object.assign({ "./en/Company.AddBank.json": () => import("./en/Company.AddBank.json.js"), "./en/Company.Addresses.json": () => import("./en/Company.Addresses.json.js"), "./en/Company.AssignSignatory.json": () => import("./en/Company.AssignSignatory.json.js"), "./en/Company.BankAccount.json": () => import("./en/Company.BankAccount.json.js"), "./en/Company.DocumentList.json": () => import("./en/Company.DocumentList.json.js"), "./en/Company.FederalTaxes.json": () => import("./en/Company.FederalTaxes.json.js"), "./en/Company.Industry.json": () => import("./en/Company.Industry.json.js"), "./en/Company.Locations.json": () => import("./en/Company.Locations.json.js"), "./en/Company.OnboardingOverview.json": () => import("./en/Company.OnboardingOverview.json.js"), "./en/Company.PaySchedule.json": () => import("./en/Company.PaySchedule.json.js"), "./en/Company.SignatureForm.json": () => import("./en/Company.SignatureForm.json.js"), "./en/Company.StateTaxes.json": () => import("./en/Company.StateTaxes.json.js"), "./en/Contractor.Address.json": () => import("./en/Contractor.Address.json.js"), "./en/Contractor.ContractorList.json": () => import("./en/Contractor.ContractorList.json.js"), "./en/Contractor.NewHireReport.json": () => import("./en/Contractor.NewHireReport.json.js"), "./en/Contractor.PaymentMethod.json": () => import("./en/Contractor.PaymentMethod.json.js"), "./en/Employee.BankAccount.json": () => import("./en/Employee.BankAccount.json.js"), "./en/Employee.Compensation.json": () => import("./en/Employee.Compensation.json.js"), "./en/Employee.Deductions.json": () => import("./en/Employee.Deductions.json.js"), "./en/Employee.DocumentSigner.json": () => import("./en/Employee.DocumentSigner.json.js"), "./en/Employee.EmployeeList.json": () => import("./en/Employee.EmployeeList.json.js"), "./en/Employee.HomeAddress.json": () => import("./en/Employee.HomeAddress.json.js"), "./en/Employee.Landing.json": () => import("./en/Employee.Landing.json.js"), "./en/Employee.OnboardingSummary.json": () => import("./en/Employee.OnboardingSummary.json.js"), "./en/Employee.PaySchedules.json": () => import("./en/Employee.PaySchedules.json.js"), "./en/Employee.PaymentMethod.json": () => import("./en/Employee.PaymentMethod.json.js"), "./en/Employee.Profile.json": () => import("./en/Employee.Profile.json.js"), "./en/Employee.SplitPaycheck.json": () => import("./en/Employee.SplitPaycheck.json.js"), "./en/Employee.StateTaxes.json": () => import("./en/Employee.StateTaxes.json.js"), "./en/Employee.Taxes.json": () => import("./en/Employee.Taxes.json.js"), "./en/Payroll.PayrollHistoryList.json": () => import("./en/Payroll.PayrollHistoryList.json.js"), "./en/Payroll.PayrollSchedule.json": () => import("./en/Payroll.PayrollSchedule.json.js"), "./en/common.json": () => import("./en/common.json.js") }), `./${n}/${o}.json`, 3)).default, e = !1;
8
+ r = (await p(/* @__PURE__ */ Object.assign({ "./en/Company.AddBank.json": () => import("./en/Company.AddBank.json.js"), "./en/Company.Addresses.json": () => import("./en/Company.Addresses.json.js"), "./en/Company.AssignSignatory.json": () => import("./en/Company.AssignSignatory.json.js"), "./en/Company.BankAccount.json": () => import("./en/Company.BankAccount.json.js"), "./en/Company.DocumentList.json": () => import("./en/Company.DocumentList.json.js"), "./en/Company.FederalTaxes.json": () => import("./en/Company.FederalTaxes.json.js"), "./en/Company.Industry.json": () => import("./en/Company.Industry.json.js"), "./en/Company.Locations.json": () => import("./en/Company.Locations.json.js"), "./en/Company.OnboardingOverview.json": () => import("./en/Company.OnboardingOverview.json.js"), "./en/Company.PaySchedule.json": () => import("./en/Company.PaySchedule.json.js"), "./en/Company.SignatureForm.json": () => import("./en/Company.SignatureForm.json.js"), "./en/Company.StateTaxes.json": () => import("./en/Company.StateTaxes.json.js"), "./en/Contractor.Address.json": () => import("./en/Contractor.Address.json.js"), "./en/Contractor.ContractorList.json": () => import("./en/Contractor.ContractorList.json.js"), "./en/Contractor.ContractorSubmit.json": () => import("./en/Contractor.ContractorSubmit.json.js"), "./en/Contractor.NewHireReport.json": () => import("./en/Contractor.NewHireReport.json.js"), "./en/Contractor.PaymentMethod.json": () => import("./en/Contractor.PaymentMethod.json.js"), "./en/Contractor.Profile.json": () => import("./en/Contractor.Profile.json.js"), "./en/Employee.BankAccount.json": () => import("./en/Employee.BankAccount.json.js"), "./en/Employee.Compensation.json": () => import("./en/Employee.Compensation.json.js"), "./en/Employee.Deductions.json": () => import("./en/Employee.Deductions.json.js"), "./en/Employee.DocumentSigner.json": () => import("./en/Employee.DocumentSigner.json.js"), "./en/Employee.EmployeeList.json": () => import("./en/Employee.EmployeeList.json.js"), "./en/Employee.HomeAddress.json": () => import("./en/Employee.HomeAddress.json.js"), "./en/Employee.Landing.json": () => import("./en/Employee.Landing.json.js"), "./en/Employee.OnboardingSummary.json": () => import("./en/Employee.OnboardingSummary.json.js"), "./en/Employee.PaySchedules.json": () => import("./en/Employee.PaySchedules.json.js"), "./en/Employee.PaymentMethod.json": () => import("./en/Employee.PaymentMethod.json.js"), "./en/Employee.Profile.json": () => import("./en/Employee.Profile.json.js"), "./en/Employee.SplitPaycheck.json": () => import("./en/Employee.SplitPaycheck.json.js"), "./en/Employee.StateTaxes.json": () => import("./en/Employee.StateTaxes.json.js"), "./en/Employee.Taxes.json": () => import("./en/Employee.Taxes.json.js"), "./en/Payroll.PayrollHistoryList.json": () => import("./en/Payroll.PayrollHistoryList.json.js"), "./en/Payroll.PayrollSchedule.json": () => import("./en/Payroll.PayrollSchedule.json.js"), "./en/common.json": () => import("./en/common.json.js") }), `./${n}/${o}.json`, 3)).default, e = !1;
9
9
  } catch {
10
10
  t = !0, e = !1;
11
11
  }
@@ -1 +1 @@
1
- {"version":3,"file":"I18n.js","sources":["../../src/i18n/I18n.ts"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport type { CustomTypeOptions } from 'i18next'\nimport { LRUCache } from '@/helpers/LRUCache'\nimport type { ResourceDictionary, Resources } from '@/types/Helpers'\n\nexport const defaultNS = 'common'\n\n//LRU cache holding requested resources\nconst resourceCache = new LRUCache(50)\n/**\n * Dynamic loading of translation resources - works with Suspence to prevent early access to loadable strings\n * @param lng(string): resource language\n * @param ns(string): Namespace/name of the component/resource\n * @returns Promise<Translation resource>\n */\nconst loadResource = ({ lng = 'en', ns }: { ns: string; lng?: string }) => {\n let isLoading = true\n let isError = false\n let resource: Record<string, string>\n\n const importResources = async () => {\n try {\n const module = await import(`@/i18n/${lng}/${ns}.json`)\n\n resource = module.default\n isLoading = false\n } catch (err) {\n isError = true\n isLoading = false\n }\n }\n const promise = importResources()\n return () => {\n if (isLoading) {\n // eslint-disable-next-line @typescript-eslint/only-throw-error\n throw promise // Throw the promise to indicate Suspense should suspend.\n } else if (isError) {\n throw new Error(`Error loading translation for component: ${ns}`) // Handle error\n } else {\n return resource // Return the resource when loading is complete\n }\n }\n}\n\n/**\n * Hook that allows component to load custom dictionary\n * @param @private {string} ns - Namespace - should match component name exactly - not exposed to consumers\n */\nexport const useI18n = (ns: keyof CustomTypeOptions['resources'] | null) => {\n //Getting our instance of i18n -> supplied by the provider set in GustoApiProvider\n const { i18n: i18nInstance } = useTranslation()\n //Abort when namespace is not provided\n if (!ns) return\n const key = `${i18nInstance.resolvedLanguage}:${ns}`\n //Skip loading default resource if it is already in cache\n if (resourceCache.get(key) === null) {\n //If resource not in cache, initiate loading and add getter to cache\n resourceCache.put(key, loadResource({ lng: i18nInstance.resolvedLanguage, ns: ns }))\n }\n //Get resourceGetter from cache\n const resourceGetter = resourceCache.get(key)\n if (resourceGetter) {\n const resource = resourceGetter()\n i18nInstance.addResourceBundle(i18nInstance.resolvedLanguage ?? 'en', ns, resource, true, false) //Last argument is set to false to prevent override of keys provided by partners on GustoApiProvider level through dictionary prop\n }\n}\n\n//Used by individual components to override their dictionaries with partner provided resources\nexport const useComponentDictionary = <K extends keyof Resources>(\n ns: keyof CustomTypeOptions['resources'],\n resource?: ResourceDictionary<K> | null,\n) => {\n const { i18n: i18nInstance } = useTranslation()\n if (resource) {\n for (const lang in resource) {\n i18nInstance.addResourceBundle(lang, ns, resource[lang], true, true)\n }\n }\n}\n"],"names":["defaultNS","resourceCache","LRUCache","loadResource","lng","ns","isLoading","isError","resource","promise","__variableDynamicImportRuntimeHelper","useI18n","i18nInstance","useTranslation","key","resourceGetter","useComponentDictionary","lang"],"mappings":";;;AAKO,MAAMA,IAAY,UAGnBC,IAAgB,IAAIC,EAAS,EAAE,GAO/BC,IAAe,CAAC,EAAE,KAAAC,IAAM,MAAM,IAAAC,QAAuC;AACzE,MAAIC,IAAY,IACZC,IAAU,IACVC;AAaJ,QAAMC,KAXkB,YAAY;AAC9B,QAAA;AAGF,MAAAD,KAFe,MAAME,4yFAEH,SACNJ,IAAA;AAAA,YACA;AACF,MAAAC,IAAA,IACED,IAAA;AAAA,IAAA;AAAA,EAEhB,GACgC;AAChC,SAAO,MAAM;AACX,QAAIA;AAEI,YAAAG;QACGF;AACT,YAAM,IAAI,MAAM,4CAA4CF,CAAE,EAAE;AAEzD,WAAAG;AAAA,EAEX;AACF,GAMaG,IAAU,CAACN,MAAoD;AAE1E,QAAM,EAAE,MAAMO,EAAa,IAAIC,EAAe;AAE9C,MAAI,CAACR,EAAI;AACT,QAAMS,IAAM,GAAGF,EAAa,gBAAgB,IAAIP,CAAE;AAElD,EAAIJ,EAAc,IAAIa,CAAG,MAAM,QAEfb,EAAA,IAAIa,GAAKX,EAAa,EAAE,KAAKS,EAAa,kBAAkB,IAAAP,EAAO,CAAC,CAAC;AAG/E,QAAAU,IAAiBd,EAAc,IAAIa,CAAG;AAC5C,MAAIC,GAAgB;AAClB,UAAMP,IAAWO,EAAe;AAChC,IAAAH,EAAa,kBAAkBA,EAAa,oBAAoB,MAAMP,GAAIG,GAAU,IAAM,EAAK;AAAA,EAAA;AAEnG,GAGaQ,IAAyB,CACpCX,GACAG,MACG;AACH,QAAM,EAAE,MAAMI,EAAa,IAAIC,EAAe;AAC9C,MAAIL;AACF,eAAWS,KAAQT;AACjB,MAAAI,EAAa,kBAAkBK,GAAMZ,GAAIG,EAASS,CAAI,GAAG,IAAM,EAAI;AAGzE;"}
1
+ {"version":3,"file":"I18n.js","sources":["../../src/i18n/I18n.ts"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport type { CustomTypeOptions } from 'i18next'\nimport { LRUCache } from '@/helpers/LRUCache'\nimport type { ResourceDictionary, Resources } from '@/types/Helpers'\n\nexport const defaultNS = 'common'\n\n//LRU cache holding requested resources\nconst resourceCache = new LRUCache(50)\n/**\n * Dynamic loading of translation resources - works with Suspence to prevent early access to loadable strings\n * @param lng(string): resource language\n * @param ns(string): Namespace/name of the component/resource\n * @returns Promise<Translation resource>\n */\nconst loadResource = ({ lng = 'en', ns }: { ns: string; lng?: string }) => {\n let isLoading = true\n let isError = false\n let resource: Record<string, string>\n\n const importResources = async () => {\n try {\n const module = await import(`@/i18n/${lng}/${ns}.json`)\n\n resource = module.default\n isLoading = false\n } catch (err) {\n isError = true\n isLoading = false\n }\n }\n const promise = importResources()\n return () => {\n if (isLoading) {\n // eslint-disable-next-line @typescript-eslint/only-throw-error\n throw promise // Throw the promise to indicate Suspense should suspend.\n } else if (isError) {\n throw new Error(`Error loading translation for component: ${ns}`) // Handle error\n } else {\n return resource // Return the resource when loading is complete\n }\n }\n}\n\n/**\n * Hook that allows component to load custom dictionary\n * @param @private {string} ns - Namespace - should match component name exactly - not exposed to consumers\n */\nexport const useI18n = (ns: keyof CustomTypeOptions['resources'] | null) => {\n //Getting our instance of i18n -> supplied by the provider set in GustoApiProvider\n const { i18n: i18nInstance } = useTranslation()\n //Abort when namespace is not provided\n if (!ns) return\n const key = `${i18nInstance.resolvedLanguage}:${ns}`\n //Skip loading default resource if it is already in cache\n if (resourceCache.get(key) === null) {\n //If resource not in cache, initiate loading and add getter to cache\n resourceCache.put(key, loadResource({ lng: i18nInstance.resolvedLanguage, ns: ns }))\n }\n //Get resourceGetter from cache\n const resourceGetter = resourceCache.get(key)\n if (resourceGetter) {\n const resource = resourceGetter()\n i18nInstance.addResourceBundle(i18nInstance.resolvedLanguage ?? 'en', ns, resource, true, false) //Last argument is set to false to prevent override of keys provided by partners on GustoApiProvider level through dictionary prop\n }\n}\n\n//Used by individual components to override their dictionaries with partner provided resources\nexport const useComponentDictionary = <K extends keyof Resources>(\n ns: keyof CustomTypeOptions['resources'],\n resource?: ResourceDictionary<K> | null,\n) => {\n const { i18n: i18nInstance } = useTranslation()\n if (resource) {\n for (const lang in resource) {\n i18nInstance.addResourceBundle(lang, ns, resource[lang], true, true)\n }\n }\n}\n"],"names":["defaultNS","resourceCache","LRUCache","loadResource","lng","ns","isLoading","isError","resource","promise","__variableDynamicImportRuntimeHelper","useI18n","i18nInstance","useTranslation","key","resourceGetter","useComponentDictionary","lang"],"mappings":";;;AAKO,MAAMA,IAAY,UAGnBC,IAAgB,IAAIC,EAAS,EAAE,GAO/BC,IAAe,CAAC,EAAE,KAAAC,IAAM,MAAM,IAAAC,QAAuC;AACzE,MAAIC,IAAY,IACZC,IAAU,IACVC;AAaJ,QAAMC,KAXkB,YAAY;AAC9B,QAAA;AAGF,MAAAD,KAFe,MAAME,g+FAEH,SACNJ,IAAA;AAAA,YACA;AACF,MAAAC,IAAA,IACED,IAAA;AAAA,IAAA;AAAA,EAEhB,GACgC;AAChC,SAAO,MAAM;AACX,QAAIA;AAEI,YAAAG;QACGF;AACT,YAAM,IAAI,MAAM,4CAA4CF,CAAE,EAAE;AAEzD,WAAAG;AAAA,EAEX;AACF,GAMaG,IAAU,CAACN,MAAoD;AAE1E,QAAM,EAAE,MAAMO,EAAa,IAAIC,EAAe;AAE9C,MAAI,CAACR,EAAI;AACT,QAAMS,IAAM,GAAGF,EAAa,gBAAgB,IAAIP,CAAE;AAElD,EAAIJ,EAAc,IAAIa,CAAG,MAAM,QAEfb,EAAA,IAAIa,GAAKX,EAAa,EAAE,KAAKS,EAAa,kBAAkB,IAAAP,EAAO,CAAC,CAAC;AAG/E,QAAAU,IAAiBd,EAAc,IAAIa,CAAG;AAC5C,MAAIC,GAAgB;AAClB,UAAMP,IAAWO,EAAe;AAChC,IAAAH,EAAa,kBAAkBA,EAAa,oBAAoB,MAAMP,GAAIG,GAAU,IAAM,EAAK;AAAA,EAAA;AAEnG,GAGaQ,IAAyB,CACpCX,GACAG,MACG;AACH,QAAM,EAAE,MAAMI,EAAa,IAAIC,EAAe;AAC9C,MAAIL;AACF,eAAWS,KAAQT;AACjB,MAAAI,EAAa,kBAAkBK,GAAMZ,GAAIG,EAASS,CAAI,GAAG,IAAM,EAAI;AAGzE;"}
@@ -0,0 +1,22 @@
1
+ const t = "Contractor Onboarded", e = "This contractor has been successfully onboarded.", n = "Done", o = "Submit and complete onboarding", a = "Please note that after submitting", s = [
2
+ "The contractor type cannot be changed.",
3
+ "The new hire report cannot be modified.",
4
+ "This contractor has unsigned documents and will need to manually complete and submit those documents to you separately."
5
+ ], c = {
6
+ doneTitle: t,
7
+ doneText: e,
8
+ doneCTA: n,
9
+ submitCTA: o,
10
+ title: a,
11
+ warningItems: s
12
+ };
13
+ export {
14
+ c as default,
15
+ n as doneCTA,
16
+ e as doneText,
17
+ t as doneTitle,
18
+ o as submitCTA,
19
+ a as title,
20
+ s as warningItems
21
+ };
22
+ //# sourceMappingURL=Contractor.ContractorSubmit.json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Contractor.ContractorSubmit.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
@@ -0,0 +1,73 @@
1
+ const e = "Contractor profile", t = "This information will be used for payments and on tax documents, so double-check that it's accurate.", a = {
2
+ inviteContractor: {
3
+ label: "Invite this contractor to enter some of their own details online",
4
+ description: "Your contractor will be invited to enter their information on their own time."
5
+ },
6
+ email: {
7
+ label: "Contractor's email address"
8
+ },
9
+ contractorType: {
10
+ label: "Type"
11
+ },
12
+ firstName: {
13
+ label: "First Name"
14
+ },
15
+ lastName: {
16
+ label: "Last Name"
17
+ },
18
+ middleInitial: {
19
+ label: "Middle Initial"
20
+ },
21
+ ssn: {
22
+ label: "Social Security Number",
23
+ placeholder: "XXX-XX-XXXX"
24
+ },
25
+ businessName: {
26
+ label: "Business Name"
27
+ },
28
+ startDate: {
29
+ label: "Start Date",
30
+ description: "Your contractor's first day of work at your company"
31
+ },
32
+ wageType: {
33
+ label: "Wage Type"
34
+ },
35
+ hourlyRate: {
36
+ label: "Hourly Rate"
37
+ },
38
+ ein: {
39
+ label: "EIN",
40
+ placeholder: "XX-XXXXXXX"
41
+ }
42
+ }, r = {
43
+ email: "Email is required when inviting contractor",
44
+ firstName: "First name is required for individual contractors",
45
+ lastName: "Last name is required for individual contractors",
46
+ ssn: "SSN is required for individual contractors",
47
+ ssnFormat: "SSN must be valid format",
48
+ businessName: "Business name is required for business contractors",
49
+ ein: "EIN is required for business contractors",
50
+ einFormat: "EIN must be valid format (XX-XXXXXXX)",
51
+ hourlyRate: "Hourly rate is required for hourly contractors"
52
+ }, i = {
53
+ cancel: "Cancel",
54
+ create: "Create Contractor",
55
+ update: "Update Contractor",
56
+ creating: "Creating...",
57
+ updating: "Updating..."
58
+ }, o = {
59
+ title: e,
60
+ subtitle: t,
61
+ fields: a,
62
+ validations: r,
63
+ buttons: i
64
+ };
65
+ export {
66
+ i as buttons,
67
+ o as default,
68
+ a as fields,
69
+ t as subtitle,
70
+ e as title,
71
+ r as validations
72
+ };
73
+ //# sourceMappingURL=Contractor.Profile.json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Contractor.Profile.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -84,6 +84,13 @@ export declare const contractorEvents: {
84
84
  readonly CONTRACTOR_PAYMENT_METHOD_UPDATED: "contractor/paymentMethod/updated";
85
85
  readonly CONTRACTOR_BANK_ACCOUNT_CREATED: "contractor/bankAccount/created";
86
86
  readonly CONTRACTOR_PAYMENT_METHOD_DONE: "contractor/paymentMethod/done";
87
+ readonly CONTRACTOR_CREATE: "contractor/create";
88
+ readonly CONTRACTOR_CREATED: "contractor/created";
89
+ readonly CONTRACTOR_UPDATE: "contractor/update";
90
+ readonly CONTRACTOR_UPDATED: "contractor/updated";
91
+ readonly CONTRACTOR_DELETED: "contractor/deleted";
92
+ readonly CONTRACTOR_PROFILE_DONE: "contractor/profile/done";
93
+ readonly CONTRACTOR_PROFILE_SUBMITTED: "contractor/profile/submitted";
87
94
  readonly CONTRACTOR_NEW_HIRE_REPORT_UPDATED: "contractor/newHireReport/updated";
88
95
  readonly CONTRACTOR_NEW_HIRE_REPORT_DONE: "contractor/newHireReport/done";
89
96
  };
@@ -102,6 +109,13 @@ export declare const componentEvents: {
102
109
  readonly CONTRACTOR_PAYMENT_METHOD_UPDATED: "contractor/paymentMethod/updated";
103
110
  readonly CONTRACTOR_BANK_ACCOUNT_CREATED: "contractor/bankAccount/created";
104
111
  readonly CONTRACTOR_PAYMENT_METHOD_DONE: "contractor/paymentMethod/done";
112
+ readonly CONTRACTOR_CREATE: "contractor/create";
113
+ readonly CONTRACTOR_CREATED: "contractor/created";
114
+ readonly CONTRACTOR_UPDATE: "contractor/update";
115
+ readonly CONTRACTOR_UPDATED: "contractor/updated";
116
+ readonly CONTRACTOR_DELETED: "contractor/deleted";
117
+ readonly CONTRACTOR_PROFILE_DONE: "contractor/profile/done";
118
+ readonly CONTRACTOR_PROFILE_SUBMITTED: "contractor/profile/submitted";
105
119
  readonly CONTRACTOR_NEW_HIRE_REPORT_UPDATED: "contractor/newHireReport/updated";
106
120
  readonly CONTRACTOR_NEW_HIRE_REPORT_DONE: "contractor/newHireReport/done";
107
121
  readonly PAY_SCHEDULE_CREATE: "paySchedule/create";
@@ -1,5 +1,5 @@
1
1
  import { OnboardingStatus as E } from "@gusto/embedded-api/models/operations/putv1employeesemployeeidonboardingstatus";
2
- const O = {
2
+ const _ = {
3
3
  EMPLOYEE_CREATE: "employee/create",
4
4
  EMPLOYEE_CREATED: "employee/created",
5
5
  EMPLOYEE_UPDATE: "employee/update",
@@ -83,6 +83,13 @@ const O = {
83
83
  CONTRACTOR_PAYMENT_METHOD_UPDATED: "contractor/paymentMethod/updated",
84
84
  CONTRACTOR_BANK_ACCOUNT_CREATED: "contractor/bankAccount/created",
85
85
  CONTRACTOR_PAYMENT_METHOD_DONE: "contractor/paymentMethod/done",
86
+ CONTRACTOR_CREATE: "contractor/create",
87
+ CONTRACTOR_CREATED: "contractor/created",
88
+ CONTRACTOR_UPDATE: "contractor/update",
89
+ CONTRACTOR_UPDATED: "contractor/updated",
90
+ CONTRACTOR_DELETED: "contractor/deleted",
91
+ CONTRACTOR_PROFILE_DONE: "contractor/profile/done",
92
+ CONTRACTOR_PROFILE_SUBMITTED: "contractor/profile/submitted",
86
93
  CONTRACTOR_NEW_HIRE_REPORT_UPDATED: "contractor/newHireReport/updated",
87
94
  CONTRACTOR_NEW_HIRE_REPORT_DONE: "contractor/newHireReport/done"
88
95
  }, n = {
@@ -98,11 +105,11 @@ const O = {
98
105
  //This is internal Robot event thrown when machine transitions to final state
99
106
  ERROR: "ERROR",
100
107
  CANCEL: "CANCEL",
101
- ...O,
108
+ ..._,
102
109
  ...o,
103
110
  ...n,
104
111
  ...A
105
- }, _ = {
112
+ }, O = {
106
113
  ADMIN_ONBOARDING_INCOMPLETE: E.AdminOnboardingIncomplete,
107
114
  SELF_ONBOARDING_PENDING_INVITE: E.SelfOnboardingPendingInvite,
108
115
  SELF_ONBOARDING_INVITED: E.SelfOnboardingInvited,
@@ -111,18 +118,18 @@ const O = {
111
118
  SELF_ONBOARDING_COMPLETED_BY_EMPLOYEE: E.SelfOnboardingCompletedByEmployee,
112
119
  SELF_ONBOARDING_AWAITING_ADMIN_REVIEW: E.SelfOnboardingAwaitingAdminReview,
113
120
  ONBOARDING_COMPLETED: E.OnboardingCompleted
114
- }, a = /* @__PURE__ */ new Set([
115
- _.SELF_ONBOARDING_INVITED,
116
- _.SELF_ONBOARDING_INVITED_STARTED,
117
- _.SELF_ONBOARDING_INVITED_OVERDUE
118
- ]), T = {
121
+ }, T = /* @__PURE__ */ new Set([
122
+ O.SELF_ONBOARDING_INVITED,
123
+ O.SELF_ONBOARDING_INVITED_STARTED,
124
+ O.SELF_ONBOARDING_INVITED_OVERDUE
125
+ ]), a = {
119
126
  EXEMPT: "Exempt",
120
127
  SALARIED_NONEXEMPT: "Salaried Nonexempt",
121
128
  NONEXEMPT: "Nonexempt",
122
129
  OWNER: "Owner",
123
130
  COMMISSION_ONLY_EXEMPT: "Commission Only Exempt",
124
131
  COMMISSION_ONLY_NONEXEMPT: "Commission Only Nonexempt"
125
- }, D = 43888, d = 40, P = 173.333333, c = 2080, M = [
132
+ }, D = 43888, d = 40, c = 173.333333, R = 2080, P = [
126
133
  "AL",
127
134
  "AK",
128
135
  "AZ",
@@ -173,7 +180,7 @@ const O = {
173
180
  "WV",
174
181
  "WI",
175
182
  "WY"
176
- ], R = {
183
+ ], C = {
177
184
  OWNER: "owner",
178
185
  PRESIDENT: "president",
179
186
  VICE_PRESIDENT: "vice_president",
@@ -181,7 +188,7 @@ const O = {
181
188
  CORPORATE_OFFICER: "corporate_officer",
182
189
  PARTNER: "partner",
183
190
  MEMBER: "member"
184
- }, p = {
191
+ }, M = {
185
192
  HOUR: "Hour",
186
193
  WEEK: "Week",
187
194
  MONTH: "Month",
@@ -192,37 +199,37 @@ const O = {
192
199
  SMALL: "small",
193
200
  MEDIUM: "medium",
194
201
  LARGE: "large"
195
- }, C = {
202
+ }, p = {
196
203
  [e.BASE]: "0rem",
197
204
  [e.SMALL]: "40rem",
198
205
  [e.MEDIUM]: "48rem",
199
206
  [e.LARGE]: "64rem"
200
- }, S = {
207
+ }, r = {
201
208
  check: "Check",
202
209
  directDeposit: "Direct Deposit"
203
- }, m = {
210
+ }, S = {
204
211
  percentage: "Percentage",
205
212
  amount: "Amount"
206
213
  };
207
214
  export {
208
215
  e as BREAKPOINTS,
209
- C as BREAKPOINTS_VALUES,
210
- _ as EmployeeOnboardingStatus,
211
- a as EmployeeSelfOnboardingStatuses,
216
+ p as BREAKPOINTS_VALUES,
217
+ O as EmployeeOnboardingStatus,
218
+ T as EmployeeSelfOnboardingStatuses,
212
219
  D as FLSA_OVERTIME_SALARY_LIMIT,
213
- T as FlsaStatus,
214
- c as HOURS_PER_PAY_PERIOD_ANNUALLY,
215
- P as HOURS_PER_PAY_PERIOD_MONTHLY,
220
+ a as FlsaStatus,
221
+ R as HOURS_PER_PAY_PERIOD_ANNUALLY,
222
+ c as HOURS_PER_PAY_PERIOD_MONTHLY,
216
223
  d as HOURS_PER_PAY_PERIOD_WEEKLY,
217
- S as PAYMENT_METHODS,
218
- p as PAY_PERIODS,
219
- R as SIGNATORY_TITLES,
220
- m as SPLIT_BY,
221
- M as STATES_ABBR,
224
+ r as PAYMENT_METHODS,
225
+ M as PAY_PERIODS,
226
+ C as SIGNATORY_TITLES,
227
+ S as SPLIT_BY,
228
+ P as STATES_ABBR,
222
229
  o as companyEvents,
223
230
  t as componentEvents,
224
231
  A as contractorEvents,
225
- O as employeeEvents,
232
+ _ as employeeEvents,
226
233
  n as payScheduleEvents
227
234
  };
228
235
  //# sourceMappingURL=constants.js.map