@gusto/embedded-react-sdk 0.8.2 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/components/Common/DataView/DataCards/DataCards.js +21 -21
  3. package/dist/components/Common/DataView/DataCards/DataCards.js.map +1 -1
  4. package/dist/components/Common/UI/ComboBox/ComboBox.js +28 -27
  5. package/dist/components/Common/UI/ComboBox/ComboBox.js.map +1 -1
  6. package/dist/components/Common/UI/ComboBox/ComboBox.module.scss.js +6 -6
  7. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +5 -3
  8. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
  9. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +5 -3
  10. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
  11. package/dist/components/Company/AssignSignatory/useAssignSignatory.js +7 -5
  12. package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
  13. package/dist/components/Company/BankAccount/BankAccountForm/context.js +5 -3
  14. package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
  15. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +5 -3
  16. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  17. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js +5 -3
  18. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
  19. package/dist/components/Company/FederalTaxes/useFederalTaxes.js +13 -11
  20. package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
  21. package/dist/components/Company/Industry/Context.js +8 -6
  22. package/dist/components/Company/Industry/Context.js.map +1 -1
  23. package/dist/components/Company/Locations/LocationForm/useLocationForm.js +5 -3
  24. package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
  25. package/dist/components/Company/Locations/LocationsList/useLocationsList.js +5 -3
  26. package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
  27. package/dist/components/Company/OnboardingOverview/context.js +5 -3
  28. package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
  29. package/dist/components/Company/PaySchedule/usePaySchedule.js +7 -5
  30. package/dist/components/Company/PaySchedule/usePaySchedule.js.map +1 -1
  31. package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js +10 -10
  32. package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js.map +1 -1
  33. package/dist/components/Company/StateTaxes/StateTaxesForm/Form.js +1 -1
  34. package/dist/components/Company/StateTaxes/StateTaxesForm/Form.js.map +1 -1
  35. package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js +29 -29
  36. package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js.map +1 -1
  37. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +5 -3
  38. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
  39. package/dist/components/Company/StateTaxes/StateTaxesList/context.js +5 -3
  40. package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
  41. package/dist/components/Contractor/Address/Actions.d.ts +1 -0
  42. package/dist/components/Contractor/Address/Actions.js +13 -0
  43. package/dist/components/Contractor/Address/Actions.js.map +1 -0
  44. package/dist/components/Contractor/Address/Address.d.ts +16 -0
  45. package/dist/components/Contractor/Address/Address.js +74 -0
  46. package/dist/components/Contractor/Address/Address.js.map +1 -0
  47. package/dist/components/Contractor/Address/Form.d.ts +1 -0
  48. package/dist/components/Contractor/Address/Form.js +57 -0
  49. package/dist/components/Contractor/Address/Form.js.map +1 -0
  50. package/dist/components/Contractor/Address/Head.d.ts +1 -0
  51. package/dist/components/Contractor/Address/Head.js +15 -0
  52. package/dist/components/Contractor/Address/Head.js.map +1 -0
  53. package/dist/components/Contractor/Address/index.d.ts +2 -0
  54. package/dist/components/Contractor/Address/useAddress.d.ts +33 -0
  55. package/dist/components/Contractor/Address/useAddress.js +28 -0
  56. package/dist/components/Contractor/Address/useAddress.js.map +1 -0
  57. package/dist/components/Contractor/index.d.ts +2 -0
  58. package/dist/components/Contractor/index.js +5 -0
  59. package/dist/components/Contractor/index.js.map +1 -0
  60. package/dist/components/Employee/Compensation/Compensation.js +1 -1
  61. package/dist/components/Employee/Compensation/Compensation.js.map +1 -1
  62. package/dist/components/Employee/Deductions/useDeductions.js +8 -6
  63. package/dist/components/Employee/Deductions/useDeductions.js.map +1 -1
  64. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +5 -3
  65. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  66. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +5 -3
  67. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
  68. package/dist/components/Employee/EmployeeList/EmployeeList.js +1 -1
  69. package/dist/components/Employee/EmployeeList/EmployeeList.js.map +1 -1
  70. package/dist/components/Employee/EmployeeList/List.js +9 -9
  71. package/dist/components/Employee/EmployeeList/List.js.map +1 -1
  72. package/dist/components/Employee/EmployeeList/useEmployeeList.d.ts +2 -1
  73. package/dist/components/Employee/EmployeeList/useEmployeeList.js +5 -3
  74. package/dist/components/Employee/EmployeeList/useEmployeeList.js.map +1 -1
  75. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +10 -8
  76. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
  77. package/dist/components/Employee/Profile/Profile.js +92 -88
  78. package/dist/components/Employee/Profile/Profile.js.map +1 -1
  79. package/dist/components/Employee/Profile/useProfile.js +5 -3
  80. package/dist/components/Employee/Profile/useProfile.js.map +1 -1
  81. package/dist/components/Employee/Taxes/StateForm.js +1 -1
  82. package/dist/components/Employee/Taxes/StateForm.js.map +1 -1
  83. package/dist/components/Employee/Taxes/Taxes.js +78 -75
  84. package/dist/components/Employee/Taxes/Taxes.js.map +1 -1
  85. package/dist/components/Employee/Taxes/useTaxes.d.ts +2 -2
  86. package/dist/components/Employee/Taxes/useTaxes.js +5 -3
  87. package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
  88. package/dist/components/index.d.ts +1 -0
  89. package/dist/i18n/I18n.js +11 -11
  90. package/dist/i18n/I18n.js.map +1 -1
  91. package/dist/i18n/en/Contractor.Address.json.js +35 -0
  92. package/dist/i18n/en/Contractor.Address.json.js.map +1 -0
  93. package/dist/index.js +9 -7
  94. package/dist/index.js.map +1 -1
  95. package/dist/shared/constants.d.ts +6 -0
  96. package/dist/shared/constants.js +51 -45
  97. package/dist/shared/constants.js.map +1 -1
  98. package/dist/style.css +1 -1
  99. package/dist/types/i18next.d.ts +20 -1
  100. package/package.json +5 -2
@@ -1,36 +1,36 @@
1
- import { jsx as t, jsxs as B, Fragment as H } from "react/jsx-runtime";
2
- import { zodResolver as J } from "@hookform/resolvers/zod";
3
- import { useForm as X, FormProvider as q } from "react-hook-form";
4
- import { useTranslation as V } from "react-i18next";
5
- import { useEffect as W } from "react";
6
- import { useEmployeeTaxSetupGetFederalTaxesSuspense as Y } from "@gusto/embedded-api/react-query/employeeTaxSetupGetFederalTaxes";
7
- import { useEmployeeTaxSetupUpdateFederalTaxesMutation as j } from "@gusto/embedded-api/react-query/employeeTaxSetupUpdateFederalTaxes";
8
- import { useEmployeeTaxSetupGetStateTaxesSuspense as G } from "@gusto/embedded-api/react-query/employeeTaxSetupGetStateTaxes";
9
- import { useEmployeeTaxSetupUpdateStateTaxesMutation as z } from "@gusto/embedded-api/react-query/employeeTaxSetupUpdateStateTaxes";
10
- import { Actions as A } from "./Actions.js";
11
- import { FederalFormSchema as K, FederalForm as b } from "./FederalForm.js";
12
- import { FederalHead as g } from "./FederalHead.js";
13
- import { StateFormSchema as Q, StateForm as w } 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 re } from "../../../i18n/I18n.js";
19
- import { componentEvents as F } from "../../../shared/constants.js";
20
- import { snakeCaseToCamelCase as v } from "../../../helpers/formattedStrings.js";
21
- import { Form as se } from "../../Common/Form/Form.js";
22
- const ae = "2010-01-01";
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 K } from "@gusto/embedded-api/react-query/employeeTaxSetupUpdateStateTaxes";
10
+ import { Actions as g } from "./Actions.js";
11
+ import { FederalFormSchema as Q, FederalForm as w } from "./FederalForm.js";
12
+ import { FederalHead as P } from "./FederalHead.js";
13
+ import { StateFormSchema as Z, StateForm as b } 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";
19
+ import { componentEvents as S } from "../../../shared/constants.js";
20
+ import { snakeCaseToCamelCase as A } from "../../../helpers/formattedStrings.js";
21
+ import { Form as ae } from "../../Common/Form/Form.js";
22
+ const ne = "2010-01-01";
23
23
  function l(o) {
24
- return /* @__PURE__ */ t($, { ...o, children: /* @__PURE__ */ t(ne, { ...o, children: o.children }) });
24
+ return /* @__PURE__ */ t(ee, { ...o, children: /* @__PURE__ */ t(me, { ...o, children: o.children }) });
25
25
  }
26
- const ne = (o) => {
27
- const { employeeId: a, className: y, children: u, isAdmin: P = !1, dictionary: _ } = o, { onEvent: T, fieldErrors: p, baseSubmitHandler: D } = ee();
28
- oe("Employee.Taxes"), re("Employee.Taxes", _);
29
- const { data: U } = Y({
30
- employeeUuid: a
31
- }), e = U.employeeFederalTax, { mutateAsync: k, isPending: N } = j(), { data: I } = G({
32
- employeeUuid: a
33
- }), E = I.employeeStateTaxesList, { mutateAsync: C, isPending: L } = z(), M = {
26
+ const me = (o) => {
27
+ const { employeeId: n, className: y, children: u, isAdmin: _ = !1, dictionary: D } = o, { onEvent: T, fieldErrors: p, baseSubmitHandler: U } = te();
28
+ se("Employee.Taxes"), re("Employee.Taxes", D);
29
+ const { data: N } = j({
30
+ employeeUuid: n
31
+ }), e = N.employeeFederalTax, { mutateAsync: k, isPending: I } = G(), { data: R } = z({
32
+ employeeUuid: n
33
+ }), E = R.employeeStateTaxesList, { mutateAsync: C, isPending: L } = K(), M = {
34
34
  ...e,
35
35
  filingStatus: e.filingStatus ?? void 0,
36
36
  twoJobs: e.twoJobs ? "true" : "false",
@@ -38,79 +38,82 @@ const ne = (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((r, n) => (r[n.state] = n.questions.reduce((s, m) => {
42
- const i = m.answers[0]?.value, d = v(m.key);
43
- return d === "fileNewHireReport" ? s[d] = typeof i > "u" ? !0 : i : s[d] = i ?? "", s;
44
- }, {}), r), {})
45
- }, S = X({
46
- resolver: J(K.merge(Q)),
41
+ states: E.reduce((s, r) => (r.state && (s[r.state] = r.questions?.reduce((a, i) => {
42
+ const d = i.answers[0]?.value, m = A(i.key);
43
+ return m === "fileNewHireReport" ? a[m] = typeof d > "u" ? !0 : d : a[m] = d ?? "", a;
44
+ }, {})), s), {})
45
+ }, F = B({
46
+ resolver: q(Q.merge(Z)),
47
47
  defaultValues: M
48
- }), { handleSubmit: R, setError: h } = S;
49
- return W(() => {
50
- p && p.length > 0 && p.forEach((r) => {
51
- const n = r.key.replace(".value", "");
52
- h(n, { type: "custom", message: r.message });
48
+ }), { handleSubmit: O, setError: h } = F;
49
+ return Y(() => {
50
+ p && p.length > 0 && p.forEach((s) => {
51
+ const r = s.key.replace(".value", "");
52
+ h(r, { type: "custom", message: s.message });
53
53
  });
54
54
  }, [p, h]), /* @__PURE__ */ t("section", { className: y, children: /* @__PURE__ */ t(
55
- Z,
55
+ $,
56
56
  {
57
57
  value: {
58
58
  employeeStateTaxes: E,
59
- isAdmin: P,
60
- isPending: N || L
59
+ isAdmin: _,
60
+ isPending: I || L
61
61
  },
62
- children: /* @__PURE__ */ t(q, { ...S, children: /* @__PURE__ */ t(se, { onSubmit: R(async (r) => {
63
- await D(r, async (n) => {
64
- const { states: s, ...m } = n, i = await k({
62
+ children: /* @__PURE__ */ t(V, { ...F, children: /* @__PURE__ */ t(ae, { onSubmit: O(async (s) => {
63
+ await U(s, async (r) => {
64
+ const { states: a, ...i } = r, d = await k({
65
65
  request: {
66
- employeeUuid: a,
66
+ employeeUuid: n,
67
67
  requestBody: {
68
- ...m,
69
- twoJobs: m.twoJobs === "true",
68
+ ...i,
69
+ twoJobs: i.twoJobs === "true",
70
70
  version: e.version
71
71
  }
72
72
  }
73
73
  });
74
- if (T(F.EMPLOYEE_FEDERAL_TAXES_UPDATED, i), s && Object.keys(s).length > 0) {
75
- const d = {
76
- states: E.map((x) => ({
77
- state: x.state,
78
- questions: x.questions.map((c) => {
79
- const f = s[x.state]?.[v(c.key)];
74
+ if (T(S.EMPLOYEE_FEDERAL_TAXES_UPDATED, d), a && Object.keys(a).length > 0) {
75
+ const m = [];
76
+ for (const v of E) {
77
+ const x = v.state;
78
+ x && m.push({
79
+ state: x,
80
+ questions: v.questions?.map((c) => {
81
+ const f = a[x]?.[A(c.key)];
80
82
  return {
81
83
  key: c.key,
82
84
  answers: [
83
85
  {
84
- validFrom: c.answers[0]?.validFrom ?? ae,
86
+ validFrom: c.answers[0]?.validFrom ?? ne,
85
87
  validUpTo: c.answers[0]?.validUpTo ?? null,
86
88
  value: f == null || typeof f == "number" && isNaN(f) ? "" : f
87
89
  }
88
90
  ]
89
91
  };
90
92
  })
91
- }))
92
- }, O = await C({
93
- request: { employeeUuid: a, requestBody: d }
93
+ });
94
+ }
95
+ const H = await C({
96
+ request: { employeeUuid: n, employeeStateTaxesRequest: { states: m } }
94
97
  });
95
- T(F.EMPLOYEE_STATE_TAXES_UPDATED, O);
98
+ T(S.EMPLOYEE_STATE_TAXES_UPDATED, H);
96
99
  }
97
- T(F.EMPLOYEE_TAXES_DONE);
100
+ T(S.EMPLOYEE_TAXES_DONE);
98
101
  });
99
- }), children: u || /* @__PURE__ */ B(H, { children: [
100
- /* @__PURE__ */ t(g, {}),
101
- /* @__PURE__ */ t(b, {}),
102
+ }), children: u || /* @__PURE__ */ J(X, { children: [
103
+ /* @__PURE__ */ t(P, {}),
102
104
  /* @__PURE__ */ t(w, {}),
103
- /* @__PURE__ */ t(A, {})
105
+ /* @__PURE__ */ t(b, {}),
106
+ /* @__PURE__ */ t(g, {})
104
107
  ] }) }) })
105
108
  }
106
109
  ) });
107
110
  };
108
- l.FederalHead = g;
109
- l.FederalForm = b;
110
- l.StateForm = w;
111
- l.Actions = A;
112
- const De = () => {
113
- const { employeeId: o, onEvent: a, isAdmin: y } = te(), { t: u } = V();
111
+ l.FederalHead = P;
112
+ l.FederalForm = w;
113
+ l.StateForm = b;
114
+ l.Actions = g;
115
+ const Ue = () => {
116
+ const { employeeId: o, onEvent: n, isAdmin: y } = oe(), { t: u } = W();
114
117
  if (!o)
115
118
  throw new Error(
116
119
  u("errors.missingParamsOrContext", {
@@ -119,10 +122,10 @@ const De = () => {
119
122
  provider: "FlowProvider"
120
123
  })
121
124
  );
122
- return /* @__PURE__ */ t(l, { employeeId: o, onEvent: a, isAdmin: y ?? !1 });
125
+ return /* @__PURE__ */ t(l, { employeeId: o, onEvent: n, isAdmin: y ?? !1 });
123
126
  };
124
127
  export {
125
128
  l as Taxes,
126
- De as TaxesContextual
129
+ Ue as TaxesContextual
127
130
  };
128
131
  //# 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 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 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 body = {\n states: employeeStateTaxes.map(state => ({\n state: state.state,\n questions: state.questions.map(question => {\n const formValue = statesPayload[state.state]?.[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 })),\n }\n\n const stateTaxesResponse = await updateStateTaxes({\n request: { employeeUuid: employeeId, requestBody: body },\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","body","formValue","stateTaxesResponse","jsxs","Fragment","FederalHead","FederalForm","StateForm","Act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AA,EACF,CAAA;AAAA,IAAA;AAAA,EAAA,GAEJ;AAEJ;AACA7D,EAAM,cAAc0D;AACpB1D,EAAM,cAAc2D;AACpB3D,EAAM,YAAY4D;AAClB5D,EAAM,UAAU6D;AAET,MAAMC,KAAkB,MAAM;AACnC,QAAM,EAAE,YAAAzD,GAAY,SAAAK,GAAS,SAAAF,EAAA,IAAYuD,GAAoC,GACvE,EAAE,GAAAC,EAAE,IAAIC,EAAe;AAC7B,MAAI,CAAC5D;AACH,UAAM,IAAI;AAAA,MACR2D,EAAE,iCAAiC;AAAA,QACjC,WAAW;AAAA,QACX,OAAO;AAAA,QACP,UAAU;AAAA,MACX,CAAA;AAAA,IACH;AAEF,2BAAQhE,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) {\n states.push({\n state: stateName,\n questions: state.questions?.map(question => {\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 })\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","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,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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A3C,EAAA0C,EAAgB,8BAA8BI,CAAkB;AAAA,UAAA;AAG1E,UAAA9C,EAAQ0C,EAAgB,mBAAmB;AAAA,QAAA,CAC5C;AAAA,MACH,CAY6C,GAClC,UACC7C,KAGE,gBAAAkD,EAAAC,GAAA,EAAA,UAAA;AAAA,QAAA,gBAAAxD,EAACyD,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;AACA9D,EAAM,cAAc2D;AACpB3D,EAAM,cAAc4D;AACpB5D,EAAM,YAAY6D;AAClB7D,EAAM,UAAU8D;AAET,MAAMC,KAAkB,MAAM;AACnC,QAAM,EAAE,YAAA1D,GAAY,SAAAK,GAAS,SAAAF,EAAA,IAAYwD,GAAoC,GACvE,EAAE,GAAAC,EAAE,IAAIC,EAAe;AAC7B,MAAI,CAAC7D;AACH,UAAM,IAAI;AAAA,MACR4D,EAAE,iCAAiC;AAAA,QACjC,WAAW;AAAA,QACX,OAAO;AAAA,QACP,UAAU;AAAA,MACX,CAAA;AAAA,IACH;AAEF,2BAAQjE,GAAM,EAAA,YAAAK,GAAwB,SAAAK,GAAkB,SAASF,KAAW,IAAO;AACrF;"}
@@ -1,6 +1,6 @@
1
- import { EmployeeStateTax } from '@gusto/embedded-api/models/components/employeestatetax';
1
+ import { EmployeeStateTaxesList } from '@gusto/embedded-api/models/components/employeestatetaxeslist';
2
2
  type TaxesContextType = {
3
- employeeStateTaxes: EmployeeStateTax[];
3
+ employeeStateTaxes: EmployeeStateTaxesList[];
4
4
  isPending: boolean;
5
5
  isAdmin: boolean;
6
6
  };
@@ -6,11 +6,13 @@ import "@gusto/embedded-api/models/errors/apierror";
6
6
  import "@gusto/embedded-api/models/errors/sdkvalidationerror";
7
7
  import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
8
8
  import "../../Base/useBase.js";
9
+ import "../../../shared/constants.js";
9
10
  import "dompurify";
11
+ import "../../../contexts/ComponentAdapter/useComponentContext.js";
10
12
  import { createCompoundContext as o } from "../../Base/createCompoundContext.js";
11
- const [C, T] = o("TaxesContext");
13
+ const [c, d] = o("TaxesContext");
12
14
  export {
13
- T as TaxesProvider,
14
- C as useTaxes
15
+ d as TaxesProvider,
16
+ c as useTaxes
15
17
  };
16
18
  //# sourceMappingURL=useTaxes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useTaxes.js","sources":["../../../../src/components/Employee/Taxes/useTaxes.ts"],"sourcesContent":["import type { EmployeeStateTax } from '@gusto/embedded-api/models/components/employeestatetax'\nimport { createCompoundContext } from '@/components/Base'\n\ntype TaxesContextType = {\n employeeStateTaxes: EmployeeStateTax[]\n isPending: boolean\n isAdmin: boolean\n}\n\nconst [useTaxes, TaxesProvider] = createCompoundContext<TaxesContextType>('TaxesContext')\nexport { useTaxes, TaxesProvider }\n"],"names":["useTaxes","TaxesProvider","createCompoundContext"],"mappings":";;;;;;;;;;AASA,MAAM,CAACA,GAAUC,CAAa,IAAIC,EAAwC,cAAc;"}
1
+ {"version":3,"file":"useTaxes.js","sources":["../../../../src/components/Employee/Taxes/useTaxes.ts"],"sourcesContent":["import type { EmployeeStateTaxesList } from '@gusto/embedded-api/models/components/employeestatetaxeslist'\nimport { createCompoundContext } from '@/components/Base'\n\ntype TaxesContextType = {\n employeeStateTaxes: EmployeeStateTaxesList[]\n isPending: boolean\n isAdmin: boolean\n}\n\nconst [useTaxes, TaxesProvider] = createCompoundContext<TaxesContextType>('TaxesContext')\nexport { useTaxes, TaxesProvider }\n"],"names":["useTaxes","TaxesProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;AASA,MAAM,CAACA,GAAUC,CAAa,IAAIC,EAAwC,cAAc;"}
@@ -1,3 +1,4 @@
1
1
  import "./types/i18next.d.ts"
2
2
  export * as Company from './Company';
3
3
  export * as Employee from './Employee';
4
+ export * as Contractor from './Contractor';
package/dist/i18n/I18n.js CHANGED
@@ -2,36 +2,36 @@ import p from "../_virtual/dynamic-import-helper.js";
2
2
  import { useTranslation as m } from "react-i18next";
3
3
  import { LRUCache as l } from "../helpers/LRUCache.js";
4
4
  const g = "common", s = new l(50), c = ({ lng: n = "en", ns: o }) => {
5
- let e = !0, t = !1, r;
5
+ let e = !0, r = !1, t;
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/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
+ t = (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/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
- t = !0, e = !1;
10
+ r = !0, e = !1;
11
11
  }
12
12
  })();
13
13
  return () => {
14
14
  if (e)
15
15
  throw i;
16
- if (t)
16
+ if (r)
17
17
  throw new Error(`Error loading translation for component: ${o}`);
18
- return r;
18
+ return t;
19
19
  };
20
20
  }, f = (n) => {
21
21
  const { i18n: o } = m();
22
22
  if (!n) return;
23
23
  const e = `${o.resolvedLanguage}:${n}`;
24
24
  s.get(e) === null && s.put(e, c({ lng: o.resolvedLanguage, ns: n }));
25
- const t = s.get(e);
26
- if (t) {
27
- const r = t();
28
- o.addResourceBundle(o.resolvedLanguage ?? "en", n, r, !0, !1);
25
+ const r = s.get(e);
26
+ if (r) {
27
+ const t = r();
28
+ o.addResourceBundle(o.resolvedLanguage ?? "en", n, t, !0, !1);
29
29
  }
30
30
  }, E = (n, o) => {
31
31
  const { i18n: e } = m();
32
32
  if (o)
33
- for (const t in o)
34
- e.addResourceBundle(t, n, o[t], !0, !0);
33
+ for (const r in o)
34
+ e.addResourceBundle(r, n, o[r], !0, !0);
35
35
  };
36
36
  export {
37
37
  g as defaultNS,
@@ -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,k8EAEH,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,mhFAEH,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,35 @@
1
+ const s = "Business address", e = "Contractor's business address, within the United States.", t = "Home address", i = "Contractor's home mailing address, within the United States.", d = "Street 1", r = "Street 2", o = "City", n = "State", a = "Select state...", c = "Zip", l = "Continue", p = {
2
+ street1: "Street address is required",
3
+ city: "Please provide valid city name",
4
+ state: "Please select a state",
5
+ zip: "Please provide valid zip code"
6
+ }, h = {
7
+ businessAddressTitle: s,
8
+ businessAddressDescription: e,
9
+ homeAddressTitle: t,
10
+ homeAddressDescription: i,
11
+ street1: d,
12
+ street2: r,
13
+ city: o,
14
+ state: n,
15
+ statePlaceholder: a,
16
+ zip: c,
17
+ submit: l,
18
+ validations: p
19
+ };
20
+ export {
21
+ e as businessAddressDescription,
22
+ s as businessAddressTitle,
23
+ o as city,
24
+ h as default,
25
+ i as homeAddressDescription,
26
+ t as homeAddressTitle,
27
+ n as state,
28
+ a as statePlaceholder,
29
+ d as street1,
30
+ r as street2,
31
+ l as submit,
32
+ p as validations,
33
+ c as zip
34
+ };
35
+ //# sourceMappingURL=Contractor.Address.json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Contractor.Address.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;"}
package/dist/index.js CHANGED
@@ -1,14 +1,16 @@
1
1
  import * as o from "./components/Company/index.js";
2
2
  import * as r from "./components/Employee/index.js";
3
- import { componentEvents as p } from "./shared/constants.js";
4
- import { GustoApiProvider as s, GustoProvider as i } from "./contexts/GustoProvider/GustoProvider.js";
5
- import { GustoProviderCustomUIAdapter as a } from "./contexts/GustoProvider/GustoProviderCustomUIAdapter.js";
3
+ import * as t from "./components/Contractor/index.js";
4
+ import { componentEvents as m } from "./shared/constants.js";
5
+ import { GustoApiProvider as i, GustoProvider as a } from "./contexts/GustoProvider/GustoProvider.js";
6
+ import { GustoProviderCustomUIAdapter as n } from "./contexts/GustoProvider/GustoProviderCustomUIAdapter.js";
6
7
  export {
7
8
  o as Company,
9
+ t as Contractor,
8
10
  r as Employee,
9
- s as GustoApiProvider,
10
- i as GustoProvider,
11
- a as GustoProviderCustomUIAdapter,
12
- p as componentEvents
11
+ i as GustoApiProvider,
12
+ a as GustoProvider,
13
+ n as GustoProviderCustomUIAdapter,
14
+ m as componentEvents
13
15
  };
14
16
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
@@ -77,6 +77,10 @@ export declare const companyEvents: {
77
77
  readonly COMPANY_OVERVIEW_DONE: "company/overview/done";
78
78
  readonly COMPANY_OVERVIEW_CONTINUE: "company/overview/continue";
79
79
  };
80
+ export declare const contractorEvents: {
81
+ readonly CONTRACTOR_ADDRESS_UPDATED: "contractor/address/updated";
82
+ readonly CONTRACTOR_ADDRESS_DONE: "contractor/address/done";
83
+ };
80
84
  export declare const payScheduleEvents: {
81
85
  readonly PAY_SCHEDULE_CREATE: "paySchedule/create";
82
86
  readonly PAY_SCHEDULE_CREATED: "paySchedule/created";
@@ -87,6 +91,8 @@ export declare const payScheduleEvents: {
87
91
  readonly PAY_SCHEDULE_DONE: "paySchedule/done";
88
92
  };
89
93
  export declare const componentEvents: {
94
+ readonly CONTRACTOR_ADDRESS_UPDATED: "contractor/address/updated";
95
+ readonly CONTRACTOR_ADDRESS_DONE: "contractor/address/done";
90
96
  readonly PAY_SCHEDULE_CREATE: "paySchedule/create";
91
97
  readonly PAY_SCHEDULE_CREATED: "paySchedule/created";
92
98
  readonly PAY_SCHEDULE_UPDATE: "paySchedule/update";