@gusto/embedded-react-sdk 0.34.0 → 0.35.0-rc.2

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 (121) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/dist/components/Base/Base.d.ts +6 -2
  3. package/dist/components/Base/Base.js +105 -59
  4. package/dist/components/Base/Base.js.map +1 -1
  5. package/dist/components/Base/useBase.d.ts +1 -0
  6. package/dist/components/Base/useBase.js.map +1 -1
  7. package/dist/components/Base/useBaseSubmit.d.ts +1 -1
  8. package/dist/components/Base/useBaseSubmit.js +60 -33
  9. package/dist/components/Base/useBaseSubmit.js.map +1 -1
  10. package/dist/components/Common/HamburgerMenu/HamburgerMenu.d.ts +1 -1
  11. package/dist/components/Common/HamburgerMenu/HamburgerMenu.js +15 -13
  12. package/dist/components/Common/HamburgerMenu/HamburgerMenu.js.map +1 -1
  13. package/dist/components/Common/HamburgerMenu/HamburgerMenuTypes.d.ts +1 -0
  14. package/dist/components/Common/UI/Breadcrumbs/Breadcrumbs.js +1 -1
  15. package/dist/components/Common/UI/FileInput/FileInput.js +1 -1
  16. package/dist/components/Common/UI/Menu/Menu.js +26 -25
  17. package/dist/components/Common/UI/Menu/Menu.js.map +1 -1
  18. package/dist/components/Common/UI/Menu/Menu.module.scss.js +7 -7
  19. package/dist/components/Common/UI/Menu/MenuTypes.d.ts +5 -0
  20. package/dist/components/Common/UI/Menu/MenuTypes.js +4 -3
  21. package/dist/components/Common/UI/Menu/MenuTypes.js.map +1 -1
  22. package/dist/components/Common/UI/ProgressBar/ProgressBar.js +4 -4
  23. package/dist/components/Common/UI/Table/Table.module.scss.js +1 -1
  24. package/dist/components/Contractor/Payments/CreatePayment/CreatePayment.js +119 -113
  25. package/dist/components/Contractor/Payments/CreatePayment/CreatePayment.js.map +1 -1
  26. package/dist/components/Contractor/Profile/ContractorProfileForm.js +15 -15
  27. package/dist/components/Employee/Compensation/Edit.js +70 -70
  28. package/dist/components/Employee/Compensation/Edit.js.map +1 -1
  29. package/dist/components/Employee/DocumentSigner/SignatureForm/Form.js +5 -5
  30. package/dist/components/Employee/DocumentSigner/SignatureForm/Form.js.map +1 -1
  31. package/dist/components/Employee/DocumentSigner/SignatureForm/Preview.js +8 -8
  32. package/dist/components/Employee/DocumentSigner/SignatureForm/Preview.js.map +1 -1
  33. package/dist/components/Employee/StateTaxes/StateTaxes.js +69 -61
  34. package/dist/components/Employee/StateTaxes/StateTaxes.js.map +1 -1
  35. package/dist/components/Payroll/GrossUpModal/GrossUpModal.d.ts +2 -0
  36. package/dist/components/Payroll/GrossUpModal/GrossUpModal.js +101 -0
  37. package/dist/components/Payroll/GrossUpModal/GrossUpModal.js.map +1 -0
  38. package/dist/components/Payroll/GrossUpModal/GrossUpModal.module.scss.js +16 -0
  39. package/dist/components/Payroll/GrossUpModal/GrossUpModal.module.scss.js.map +1 -0
  40. package/dist/components/Payroll/GrossUpModal/GrossUpModalTypes.d.ts +7 -0
  41. package/dist/components/Payroll/GrossUpModal/index.d.ts +3 -0
  42. package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js +86 -67
  43. package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js.map +1 -1
  44. package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.d.ts +1 -1
  45. package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.js +83 -49
  46. package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.js.map +1 -1
  47. package/dist/components/Payroll/OffCycleCreation/OffCycleCreationTypes.d.ts +6 -0
  48. package/dist/components/Payroll/OffCycleTaxWithholdingModal/OffCycleTaxWithholdingModal.js +102 -0
  49. package/dist/components/Payroll/OffCycleTaxWithholdingModal/OffCycleTaxWithholdingModal.js.map +1 -0
  50. package/dist/components/Payroll/OffCycleTaxWithholdingModal/OffCycleTaxWithholdingModal.module.scss.js +14 -0
  51. package/dist/components/Payroll/OffCycleTaxWithholdingModal/OffCycleTaxWithholdingModal.module.scss.js.map +1 -0
  52. package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTable.js +52 -0
  53. package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTable.js.map +1 -0
  54. package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTable.module.scss.js +16 -0
  55. package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTable.module.scss.js.map +1 -0
  56. package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTableTypes.d.ts +12 -2
  57. package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTableTypes.js +15 -0
  58. package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTableTypes.js.map +1 -0
  59. package/dist/components/Payroll/OffCycleTaxWithholdingTable/index.d.ts +2 -1
  60. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +212 -120
  61. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
  62. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.d.ts +3 -1
  63. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js +76 -64
  64. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
  65. package/dist/components/Payroll/PayrollConfiguration/grossUpHelpers.d.ts +2 -0
  66. package/dist/components/Payroll/PayrollConfiguration/grossUpHelpers.js +11 -0
  67. package/dist/components/Payroll/PayrollConfiguration/grossUpHelpers.js.map +1 -0
  68. package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js +67 -57
  69. package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js.map +1 -1
  70. package/dist/components/Payroll/usePreparedPayrollData.js +44 -43
  71. package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
  72. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.d.ts +2 -0
  73. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +58 -38
  74. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
  75. package/dist/contexts/ObservabilityProvider/ObservabilityContext.d.ts +5 -0
  76. package/dist/contexts/ObservabilityProvider/ObservabilityContext.js +6 -0
  77. package/dist/contexts/ObservabilityProvider/ObservabilityContext.js.map +1 -0
  78. package/dist/contexts/ObservabilityProvider/ObservabilityProvider.d.ts +7 -0
  79. package/dist/contexts/ObservabilityProvider/ObservabilityProvider.js +11 -0
  80. package/dist/contexts/ObservabilityProvider/ObservabilityProvider.js.map +1 -0
  81. package/dist/contexts/ObservabilityProvider/index.d.ts +5 -0
  82. package/dist/contexts/ObservabilityProvider/observabilityUtils.d.ts +5 -0
  83. package/dist/contexts/ObservabilityProvider/observabilityUtils.js +45 -0
  84. package/dist/contexts/ObservabilityProvider/observabilityUtils.js.map +1 -0
  85. package/dist/contexts/ObservabilityProvider/sanitization.d.ts +19 -0
  86. package/dist/contexts/ObservabilityProvider/sanitization.js +95 -0
  87. package/dist/contexts/ObservabilityProvider/sanitization.js.map +1 -0
  88. package/dist/contexts/ObservabilityProvider/sanitization.test.d.ts +1 -0
  89. package/dist/contexts/ObservabilityProvider/useObservability.d.ts +2 -0
  90. package/dist/contexts/ObservabilityProvider/useObservability.js +11 -0
  91. package/dist/contexts/ObservabilityProvider/useObservability.js.map +1 -0
  92. package/dist/contexts/ObservabilityProvider/useSanitizedObservability.d.ts +8 -0
  93. package/dist/contexts/ObservabilityProvider/useSanitizedObservability.js +28 -0
  94. package/dist/contexts/ObservabilityProvider/useSanitizedObservability.js.map +1 -0
  95. package/dist/contexts/index.d.ts +2 -0
  96. package/dist/helpers/rem.d.ts +7 -3
  97. package/dist/helpers/rem.js +14 -10
  98. package/dist/helpers/rem.js.map +1 -1
  99. package/dist/helpers/rem.test.d.ts +1 -0
  100. package/dist/helpers/retryAsync.d.ts +7 -0
  101. package/dist/helpers/retryAsync.js +18 -0
  102. package/dist/helpers/retryAsync.js.map +1 -0
  103. package/dist/i18n/I18n.js +15 -15
  104. package/dist/i18n/I18n.js.map +1 -1
  105. package/dist/i18n/en/Company.PaySchedule.json.js +1 -1
  106. package/dist/i18n/en/Payroll.GrossUpModal.json.js +24 -0
  107. package/dist/i18n/en/Payroll.GrossUpModal.json.js.map +1 -0
  108. package/dist/i18n/en/Payroll.OffCycleTaxWithholding.json.js +13 -11
  109. package/dist/i18n/en/Payroll.OffCycleTaxWithholding.json.js.map +1 -1
  110. package/dist/i18n/en/Payroll.PayrollConfiguration.json.js +1 -1
  111. package/dist/index.d.ts +2 -0
  112. package/dist/index.js +19 -13
  113. package/dist/index.js.map +1 -1
  114. package/dist/shared/constants.d.ts +5 -0
  115. package/dist/shared/constants.js +11 -8
  116. package/dist/shared/constants.js.map +1 -1
  117. package/dist/style.css +1 -1
  118. package/dist/types/i18next.d.ts +26 -1
  119. package/dist/types/observability.d.ts +145 -0
  120. package/docs/reference/endpoint-inventory.json +10 -1
  121. package/package.json +21 -21
@@ -1,90 +1,98 @@
1
- import { jsx as o, jsxs as P, Fragment as b } from "react/jsx-runtime";
2
- import { zodResolver as g } from "@hookform/resolvers/zod";
3
- import { useForm as N, FormProvider as R } from "react-hook-form";
4
- import { useEffect as C } from "react";
5
- import { useEmployeeTaxSetupGetStateTaxesSuspense as L } from "@gusto/embedded-api/react-query/employeeTaxSetupGetStateTaxes";
6
- import { useEmployeeTaxSetupUpdateStateTaxesMutation as M } from "@gusto/embedded-api/react-query/employeeTaxSetupUpdateStateTaxes";
7
- import { StateFormSchema as O, StateForm as I } from "./StateForm.js";
8
- import { Actions as V } from "./Actions.js";
1
+ import { jsx as r, jsxs as U, Fragment as P } from "react/jsx-runtime";
2
+ import { zodResolver as b } from "@hookform/resolvers/zod";
3
+ import { useForm as C, FormProvider as L } from "react-hook-form";
4
+ import { useEffect as R } from "react";
5
+ import { useEmployeeTaxSetupGetStateTaxesSuspense as M } from "@gusto/embedded-api/react-query/employeeTaxSetupGetStateTaxes";
6
+ import { useEmployeeTaxSetupUpdateStateTaxesMutation as O } from "@gusto/embedded-api/react-query/employeeTaxSetupUpdateStateTaxes";
7
+ import { StateFormSchema as V, StateForm as I } from "./StateForm.js";
8
+ import { Actions as z } from "./Actions.js";
9
9
  import { StateTaxesProvider as X } from "./useStateTaxes.js";
10
- import { BaseComponent as z } from "../../Base/Base.js";
11
- import { useBase as B } from "../../Base/useBase.js";
12
- import { useI18n as H, useComponentDictionary as K } from "../../../i18n/I18n.js";
10
+ import { BaseComponent as B } from "../../Base/Base.js";
11
+ import { useBase as H } from "../../Base/useBase.js";
12
+ import { useI18n as K, useComponentDictionary as Q } from "../../../i18n/I18n.js";
13
13
  import { componentEvents as x } from "../../../shared/constants.js";
14
14
  import { Form as Y } from "../../Common/Form/Form.js";
15
- import { snakeCaseToCamelCase as v, normalizeErrorKeyForForm as j } from "../../../helpers/formattedStrings.js";
16
- const q = "2010-01-01";
17
- function pe(i) {
18
- return /* @__PURE__ */ o(z, { ...i, children: /* @__PURE__ */ o(G, { ...i }) });
15
+ import { snakeCaseToCamelCase as F, normalizeErrorKeyForForm as j } from "../../../helpers/formattedStrings.js";
16
+ const G = "2010-01-01";
17
+ function fe(u) {
18
+ return /* @__PURE__ */ r(B, { ...u, children: /* @__PURE__ */ r(q, { ...u }) });
19
19
  }
20
- const G = (i) => {
21
- const { employeeId: c, className: h, children: d, isAdmin: y = !1, dictionary: F } = i, { onEvent: E, fieldErrors: l, baseSubmitHandler: A } = B();
22
- H("Employee.StateTaxes"), K("Employee.StateTaxes", F);
23
- const { data: _ } = L({
20
+ const q = (u) => {
21
+ const { employeeId: c, className: h, children: y, isAdmin: S = !1, dictionary: A } = u, { onEvent: T, fieldErrors: p, baseSubmitHandler: w } = H();
22
+ K("Employee.StateTaxes"), Q("Employee.StateTaxes", A);
23
+ const { data: D } = M({
24
24
  employeeUuid: c
25
- }), p = _.employeeStateTaxesList, { mutateAsync: k, isPending: w } = M(), U = {
26
- states: p.reduce((t, s) => (s.state && (t[s.state] = s.questions?.reduce((e, n) => {
27
- const m = n.answers[0]?.value, r = v(n.key);
28
- return r === "fileNewHireReport" ? e[r] = typeof m > "u" ? !0 : m : e[r] = m, e;
29
- }, {})), t), {})
30
- }, S = N({
31
- resolver: g(O),
32
- defaultValues: U
33
- }), { handleSubmit: D, setError: T } = S;
34
- return C(() => {
35
- l && l.length > 0 && l.forEach((t) => {
36
- const s = j(t.errorKey), e = typeof t.message == "string" ? t.message : "Unknown error";
37
- T(s, { type: "custom", message: e });
25
+ }), d = D.employeeStateTaxesList, { mutateAsync: _, isPending: g } = O(), k = {
26
+ states: d.reduce((o, a) => (a.state && (o[a.state] = a.questions?.reduce((e, m) => {
27
+ const n = m.answers[0]?.value, s = F(m.key), l = m.inputQuestionFormat.type.toLowerCase() === "date";
28
+ if (s === "fileNewHireReport")
29
+ e[s] = typeof n > "u" ? !0 : n;
30
+ else if (l && typeof n == "string") {
31
+ const t = n.trim();
32
+ e[s] = t === "" ? void 0 : new Date(t);
33
+ } else
34
+ e[s] = n;
35
+ return e;
36
+ }, {})), o), {})
37
+ }, E = C({
38
+ resolver: b(V),
39
+ defaultValues: k
40
+ }), { handleSubmit: N, setError: v } = E;
41
+ return R(() => {
42
+ p && p.length > 0 && p.forEach((o) => {
43
+ const a = j(o.errorKey), e = typeof o.message == "string" ? o.message : "Unknown error";
44
+ v(a, { type: "custom", message: e });
38
45
  });
39
- }, [l, T]), /* @__PURE__ */ o("section", { className: h, children: /* @__PURE__ */ o(
46
+ }, [p, v]), /* @__PURE__ */ r("section", { className: h, children: /* @__PURE__ */ r(
40
47
  X,
41
48
  {
42
49
  value: {
43
- employeeStateTaxes: p,
44
- isAdmin: y,
45
- isPending: w
50
+ employeeStateTaxes: d,
51
+ isAdmin: S,
52
+ isPending: g
46
53
  },
47
- children: /* @__PURE__ */ o(R, { ...S, children: /* @__PURE__ */ o(Y, { onSubmit: D(async (t) => {
48
- await A(t, async (s) => {
49
- const { states: e } = s;
54
+ children: /* @__PURE__ */ r(L, { ...E, children: /* @__PURE__ */ r(Y, { onSubmit: N(async (o) => {
55
+ await w(o, async (a) => {
56
+ const { states: e } = a;
50
57
  if (e && Object.keys(e).length > 0) {
51
- const n = [];
52
- for (const r of p) {
53
- const f = r.state;
54
- f && r.questions !== void 0 && n.push({
55
- state: f,
56
- questions: r.questions.map((a) => {
57
- if (a.isQuestionForAdminOnly && !y)
58
+ const m = [];
59
+ for (const s of d) {
60
+ const l = s.state;
61
+ l && s.questions !== void 0 && m.push({
62
+ state: l,
63
+ questions: s.questions.map((t) => {
64
+ if (t.isQuestionForAdminOnly && !S)
58
65
  return null;
59
- const u = e[f]?.[v(a.key)];
60
- return {
61
- key: a.key,
66
+ const i = e[l]?.[F(t.key)];
67
+ let f;
68
+ return i == null || typeof i == "number" && isNaN(i) ? f = "" : i instanceof Date ? f = isNaN(i.getTime()) ? "" : i.toISOString().split("T")[0] ?? "" : f = i, {
69
+ key: t.key,
62
70
  answers: [
63
71
  {
64
- validFrom: a.answers[0]?.validFrom ?? q,
65
- validUpTo: a.answers[0]?.validUpTo ?? null,
66
- value: u == null || typeof u == "number" && isNaN(u) ? "" : u
72
+ validFrom: t.answers[0]?.validFrom ?? G,
73
+ validUpTo: t.answers[0]?.validUpTo ?? null,
74
+ value: f
67
75
  }
68
76
  ]
69
77
  };
70
- }).filter((a) => a !== null)
78
+ }).filter((t) => t !== null)
71
79
  });
72
80
  }
73
- const m = await k({
74
- request: { employeeUuid: c, employeeStateTaxesRequest: { states: n } }
81
+ const n = await _({
82
+ request: { employeeUuid: c, employeeStateTaxesRequest: { states: m } }
75
83
  });
76
- E(x.EMPLOYEE_STATE_TAXES_UPDATED, m);
84
+ T(x.EMPLOYEE_STATE_TAXES_UPDATED, n);
77
85
  }
78
- E(x.EMPLOYEE_STATE_TAXES_DONE);
86
+ T(x.EMPLOYEE_STATE_TAXES_DONE);
79
87
  });
80
- }), children: d || /* @__PURE__ */ P(b, { children: [
81
- /* @__PURE__ */ o(I, {}),
82
- /* @__PURE__ */ o(V, {})
88
+ }), children: y || /* @__PURE__ */ U(P, { children: [
89
+ /* @__PURE__ */ r(I, {}),
90
+ /* @__PURE__ */ r(z, {})
83
91
  ] }) }) })
84
92
  }
85
93
  ) });
86
94
  };
87
95
  export {
88
- pe as StateTaxes
96
+ fe as StateTaxes
89
97
  };
90
98
  //# sourceMappingURL=StateTaxes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"StateTaxes.js","sources":["../../../../src/components/Employee/StateTaxes/StateTaxes.tsx"],"sourcesContent":["import { zodResolver } from '@hookform/resolvers/zod'\nimport { FormProvider, useForm, type SubmitHandler } from 'react-hook-form'\nimport { useEffect } from 'react'\nimport { useEmployeeTaxSetupGetStateTaxesSuspense } from '@gusto/embedded-api/react-query/employeeTaxSetupGetStateTaxes'\nimport { useEmployeeTaxSetupUpdateStateTaxesMutation } from '@gusto/embedded-api/react-query/employeeTaxSetupUpdateStateTaxes'\nimport { StateForm } from './StateForm'\nimport { StateFormSchema, type StateFormPayload } from './StateForm'\nimport { Actions } from './Actions'\nimport { StateTaxesProvider } from './useStateTaxes'\nimport {\n useBase,\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n} from '@/components/Base'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { Form } from '@/components/Common/Form'\nimport { useComponentDictionary } from '@/i18n/I18n'\nimport { snakeCaseToCamelCase, normalizeErrorKeyForForm } from '@/helpers/formattedStrings'\n\nconst DEFAULT_TAX_VALID_FROM = '2010-01-01'\n\ninterface StateTaxesProps extends CommonComponentInterface<'Employee.StateTaxes'> {\n employeeId: string\n isAdmin?: boolean\n}\n\nexport function StateTaxes(props: StateTaxesProps & BaseComponentInterface) {\n return (\n <BaseComponent<'Employee.StateTaxes'> {...props}>\n <Root {...props} />\n </BaseComponent>\n )\n}\n\nconst Root = (props: StateTaxesProps) => {\n const { employeeId, className, children, isAdmin = false, dictionary } = props\n const { onEvent, fieldErrors, baseSubmitHandler } = useBase()\n useI18n('Employee.StateTaxes')\n useComponentDictionary('Employee.StateTaxes', dictionary)\n\n const { data: stateData } = useEmployeeTaxSetupGetStateTaxesSuspense({\n employeeUuid: employeeId,\n })\n const employeeStateTaxes = stateData.employeeStateTaxesList!\n const { mutateAsync: updateStateTaxes, isPending } = useEmployeeTaxSetupUpdateStateTaxesMutation()\n\n const defaultValues = {\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<Record<string, unknown>, unknown, StateFormPayload>({\n resolver: zodResolver(StateFormSchema),\n defaultValues,\n })\n const { handleSubmit, setError: _setError } = formMethods\n\n useEffect(() => {\n if (fieldErrors && fieldErrors.length > 0) {\n fieldErrors.forEach(msgObject => {\n const key = normalizeErrorKeyForForm(msgObject.errorKey)\n const message = typeof msgObject.message === 'string' ? msgObject.message : 'Unknown error'\n _setError(key, { type: 'custom', message })\n })\n }\n }, [fieldErrors, _setError])\n\n const onSubmit: SubmitHandler<StateFormPayload> = async data => {\n await baseSubmitHandler(data, async payload => {\n const { states: statesPayload } = payload\n\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),\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_STATE_TAXES_DONE)\n })\n }\n\n return (\n <section className={className}>\n <StateTaxesProvider\n value={{\n employeeStateTaxes,\n isAdmin: isAdmin,\n isPending,\n }}\n >\n <FormProvider {...formMethods}>\n <Form onSubmit={handleSubmit(onSubmit)}>\n {children ? (\n children\n ) : (\n <>\n <StateForm />\n <Actions />\n </>\n )}\n </Form>\n </FormProvider>\n </StateTaxesProvider>\n </section>\n )\n}\n"],"names":["DEFAULT_TAX_VALID_FROM","StateTaxes","props","jsx","BaseComponent","Root","employeeId","className","children","isAdmin","dictionary","onEvent","fieldErrors","baseSubmitHandler","useBase","useI18n","useComponentDictionary","stateData","useEmployeeTaxSetupGetStateTaxesSuspense","employeeStateTaxes","updateStateTaxes","isPending","useEmployeeTaxSetupUpdateStateTaxesMutation","defaultValues","acc","state","question","value","key","snakeCaseToCamelCase","formMethods","useForm","zodResolver","StateFormSchema","handleSubmit","_setError","useEffect","msgObject","normalizeErrorKeyForForm","message","StateTaxesProvider","FormProvider","Form","data","payload","statesPayload","states","stateName","formValue","q","stateTaxesResponse","componentEvents","jsxs","Fragment","StateForm","Actions"],"mappings":";;;;;;;;;;;;;;;AAqBA,MAAMA,IAAyB;AAOxB,SAASC,GAAWC,GAAiD;AAC1E,SACE,gBAAAC,EAACC,KAAsC,GAAGF,GACxC,4BAACG,GAAA,EAAM,GAAGH,GAAO,EAAA,CACnB;AAEJ;AAEA,MAAMG,IAAO,CAACH,MAA2B;AACvC,QAAM,EAAE,YAAAI,GAAY,WAAAC,GAAW,UAAAC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EAAQwC,EAAgB,8BAA8BD,CAAkB;AAAA,UAC1E;AAEA,UAAAvC,EAAQwC,EAAgB,yBAAyB;AAAA,QACnD,CAAC;AAAA,MACH,CAY6C,GAClC,UAAA3C,KAGC,gBAAA4C,EAAAC,GAAA,EACE,UAAA;AAAA,QAAA,gBAAAlD,EAACmD,GAAA,EAAU;AAAA,0BACVC,GAAA,CAAA,CAAQ;AAAA,MAAA,EAAA,CACX,GAEJ,EAAA,CACF;AAAA,IAAA;AAAA,EAAA,GAEJ;AAEJ;"}
1
+ {"version":3,"file":"StateTaxes.js","sources":["../../../../src/components/Employee/StateTaxes/StateTaxes.tsx"],"sourcesContent":["import { zodResolver } from '@hookform/resolvers/zod'\nimport { FormProvider, useForm, type SubmitHandler } from 'react-hook-form'\nimport { useEffect } from 'react'\nimport { useEmployeeTaxSetupGetStateTaxesSuspense } from '@gusto/embedded-api/react-query/employeeTaxSetupGetStateTaxes'\nimport { useEmployeeTaxSetupUpdateStateTaxesMutation } from '@gusto/embedded-api/react-query/employeeTaxSetupUpdateStateTaxes'\nimport { StateForm } from './StateForm'\nimport { StateFormSchema, type StateFormPayload } from './StateForm'\nimport { Actions } from './Actions'\nimport { StateTaxesProvider } from './useStateTaxes'\nimport {\n useBase,\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n} from '@/components/Base'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { Form } from '@/components/Common/Form'\nimport { useComponentDictionary } from '@/i18n/I18n'\nimport { snakeCaseToCamelCase, normalizeErrorKeyForForm } from '@/helpers/formattedStrings'\n\nconst DEFAULT_TAX_VALID_FROM = '2010-01-01'\n\ninterface StateTaxesProps extends CommonComponentInterface<'Employee.StateTaxes'> {\n employeeId: string\n isAdmin?: boolean\n}\n\nexport function StateTaxes(props: StateTaxesProps & BaseComponentInterface) {\n return (\n <BaseComponent<'Employee.StateTaxes'> {...props}>\n <Root {...props} />\n </BaseComponent>\n )\n}\n\nconst Root = (props: StateTaxesProps) => {\n const { employeeId, className, children, isAdmin = false, dictionary } = props\n const { onEvent, fieldErrors, baseSubmitHandler } = useBase()\n useI18n('Employee.StateTaxes')\n useComponentDictionary('Employee.StateTaxes', dictionary)\n\n const { data: stateData } = useEmployeeTaxSetupGetStateTaxesSuspense({\n employeeUuid: employeeId,\n })\n const employeeStateTaxes = stateData.employeeStateTaxesList!\n const { mutateAsync: updateStateTaxes, isPending } = useEmployeeTaxSetupUpdateStateTaxesMutation()\n\n const defaultValues = {\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 const isDateField = question.inputQuestionFormat.type.toLowerCase() === 'date'\n\n if (key === 'fileNewHireReport') {\n acc[key] = typeof value === 'undefined' ? true : value\n } else if (isDateField && typeof value === 'string') {\n const trimmedValue = value.trim()\n acc[key] = trimmedValue === '' ? undefined : new Date(trimmedValue)\n } else {\n acc[key] = value\n }\n return acc\n }, {})\n }\n return acc\n }, {}),\n }\n\n const formMethods = useForm<Record<string, unknown>, unknown, StateFormPayload>({\n resolver: zodResolver(StateFormSchema),\n defaultValues,\n })\n const { handleSubmit, setError: _setError } = formMethods\n\n useEffect(() => {\n if (fieldErrors && fieldErrors.length > 0) {\n fieldErrors.forEach(msgObject => {\n const key = normalizeErrorKeyForForm(msgObject.errorKey)\n const message = typeof msgObject.message === 'string' ? msgObject.message : 'Unknown error'\n _setError(key, { type: 'custom', message })\n })\n }\n }, [fieldErrors, _setError])\n\n const onSubmit: SubmitHandler<StateFormPayload> = async data => {\n await baseSubmitHandler(data, async payload => {\n const { states: statesPayload } = payload\n\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\n let serializedValue: string | number | boolean\n if (formValue == null || (typeof formValue === 'number' && isNaN(formValue))) {\n serializedValue = ''\n } else if (formValue instanceof Date) {\n serializedValue = isNaN(formValue.getTime())\n ? ''\n : (formValue.toISOString().split('T')[0] ?? '')\n } else {\n serializedValue = formValue as string | number | boolean\n }\n\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: serializedValue,\n },\n ],\n }\n })\n .filter(q => q !== null),\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_STATE_TAXES_DONE)\n })\n }\n\n return (\n <section className={className}>\n <StateTaxesProvider\n value={{\n employeeStateTaxes,\n isAdmin: isAdmin,\n isPending,\n }}\n >\n <FormProvider {...formMethods}>\n <Form onSubmit={handleSubmit(onSubmit)}>\n {children ? (\n children\n ) : (\n <>\n <StateForm />\n <Actions />\n </>\n )}\n </Form>\n </FormProvider>\n </StateTaxesProvider>\n </section>\n )\n}\n"],"names":["DEFAULT_TAX_VALID_FROM","StateTaxes","props","jsx","BaseComponent","Root","employeeId","className","children","isAdmin","dictionary","onEvent","fieldErrors","baseSubmitHandler","useBase","useI18n","useComponentDictionary","stateData","useEmployeeTaxSetupGetStateTaxesSuspense","employeeStateTaxes","updateStateTaxes","isPending","useEmployeeTaxSetupUpdateStateTaxesMutation","defaultValues","acc","state","question","value","key","snakeCaseToCamelCase","isDateField","trimmedValue","formMethods","useForm","zodResolver","StateFormSchema","handleSubmit","_setError","useEffect","msgObject","normalizeErrorKeyForForm","message","StateTaxesProvider","FormProvider","Form","data","payload","statesPayload","states","stateName","formValue","serializedValue","q","stateTaxesResponse","componentEvents","jsxs","Fragment","StateForm","Actions"],"mappings":";;;;;;;;;;;;;;;AAqBA,MAAMA,IAAyB;AAOxB,SAASC,GAAWC,GAAiD;AAC1E,SACE,gBAAAC,EAACC,KAAsC,GAAGF,GACxC,4BAACG,GAAA,EAAM,GAAGH,GAAO,EAAA,CACnB;AAEJ;AAEA,MAAMG,IAAO,CAACH,MAA2B;AACvC,QAAM,EAAE,YAAAI,GAAY,WAAAC,GAAW,UAAAC,GAAU,SAAAC,IAAU,IAAO,YAAAC,MAAeR,GACnE,EAAE,SAAAS,GAAS,aAAAC,GAAa,mBAAAC,EAAA,IAAsBC,EAAA;AACpD,EAAAC,EAAQ,qBAAqB,GAC7BC,EAAuB,uBAAuBN,CAAU;AAExD,QAAM,EAAE,MAAMO,EAAA,IAAcC,EAAyC;AAAA,IACnE,cAAcZ;AAAA,EAAA,CACf,GACKa,IAAqBF,EAAU,wBAC/B,EAAE,aAAaG,GAAkB,WAAAC,EAAA,IAAcC,EAAA,GAE/CC,IAAgB;AAAA,IACpB,QAAQJ,EAAmB,OAAO,CAACK,GAA8BC,OAC3DA,EAAM,UACRD,EAAIC,EAAM,KAAK,IAAIA,EAAM,WAAW,OAAO,CAACD,GAA8BE,MAAa;AACrF,YAAMC,IAAQD,EAAS,QAAQ,CAAC,GAAG,OAC7BE,IAAMC,EAAqBH,EAAS,GAAG,GACvCI,IAAcJ,EAAS,oBAAoB,KAAK,kBAAkB;AAExE,UAAIE,MAAQ;AACVJ,QAAAA,EAAII,CAAG,IAAI,OAAOD,IAAU,MAAc,KAAOA;AAAA,eACxCG,KAAe,OAAOH,KAAU,UAAU;AACnD,cAAMI,IAAeJ,EAAM,KAAA;AAC3BH,QAAAA,EAAII,CAAG,IAAIG,MAAiB,KAAK,SAAY,IAAI,KAAKA,CAAY;AAAA,MACpE;AACEP,QAAAA,EAAII,CAAG,IAAID;AAEb,aAAOH;AAAAA,IACT,GAAG,CAAA,CAA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EAAqBH,EAAS,GAAG,CAAC;AAE/E,sBAAIyB;AACJ,yBAAID,KAAa,QAAS,OAAOA,KAAc,YAAY,MAAMA,CAAS,IACxEC,IAAkB,KACTD,aAAqB,OAC9BC,IAAkB,MAAMD,EAAU,QAAA,CAAS,IACvC,KACCA,EAAU,YAAA,EAAc,MAAM,GAAG,EAAE,CAAC,KAAK,KAE9CC,IAAkBD,GAGb;AAAA,oBACL,KAAKxB,EAAS;AAAA,oBACd,SAAS;AAAA,sBACP;AAAA,wBACE,WAAWA,EAAS,QAAQ,CAAC,GAAG,aAAa1B;AAAA,wBAC7C,WAAW0B,EAAS,QAAQ,CAAC,GAAG,aAAa;AAAA,wBAC7C,OAAOyB;AAAA,sBAAA;AAAA,oBACT;AAAA,kBACF;AAAA,gBAEJ,CAAC,EACA,OAAO,CAAAC,MAAKA,MAAM,IAAI;AAAA,cAAA,CAC1B;AAAA,YAEL;AAEA,kBAAMC,IAAqB,MAAMjC,EAAiB;AAAA,cAChD,SAAS,EAAE,cAAcd,GAAY,2BAA2B,EAAE,QAAA0C,IAAO;AAAA,YAAE,CAC5E;AACD,YAAArC,EAAQ2C,EAAgB,8BAA8BD,CAAkB;AAAA,UAC1E;AAEA,UAAA1C,EAAQ2C,EAAgB,yBAAyB;AAAA,QACnD,CAAC;AAAA,MACH,CAY6C,GAClC,UAAA9C,KAGC,gBAAA+C,EAAAC,GAAA,EACE,UAAA;AAAA,QAAA,gBAAArD,EAACsD,GAAA,EAAU;AAAA,0BACVC,GAAA,CAAA,CAAQ;AAAA,MAAA,EAAA,CACX,GAEJ,EAAA,CACF;AAAA,IAAA;AAAA,EAAA,GAEJ;AAEJ;"}
@@ -0,0 +1,2 @@
1
+ import { GrossUpModalProps } from './GrossUpModalTypes';
2
+ export declare function GrossUpModal({ isOpen, onCalculateGrossUp, isPending, onApply, onCancel, }: GrossUpModalProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,101 @@
1
+ import { jsx as e, jsxs as a, Fragment as R } from "react/jsx-runtime";
2
+ import { useRef as U, useState as m, useEffect as x } from "react";
3
+ import { useForm as I, FormProvider as L } from "react-hook-form";
4
+ import { useTranslation as j } from "react-i18next";
5
+ import { z as v } from "zod";
6
+ import { zodResolver as k } from "@hookform/resolvers/zod";
7
+ import t from "./GrossUpModal.module.scss.js";
8
+ import "../../../shared/constants.js";
9
+ import "classnames";
10
+ import { ActionsLayout as H } from "../../Common/ActionsLayout/ActionsLayout.js";
11
+ import { NumberInputField as V } from "../../Common/Fields/NumberInputField/NumberInputField.js";
12
+ import { useComponentContext as z } from "../../../contexts/ComponentAdapter/useComponentContext.js";
13
+ import "react-error-boundary";
14
+ import "@gusto/embedded-api/models/errors/gustoembeddederror";
15
+ import "@gusto/embedded-api/models/errors/sdkvalidationerror";
16
+ import "@tanstack/react-query";
17
+ import { useBase as B } from "../../Base/useBase.js";
18
+ import "../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
19
+ import { formatNumberAsCurrency as E } from "../../../helpers/formattedStrings.js";
20
+ import { useI18n as T } from "../../../i18n/I18n.js";
21
+ const q = v.object({
22
+ netPay: v.number().positive()
23
+ });
24
+ function ce({
25
+ isOpen: s,
26
+ onCalculateGrossUp: C,
27
+ isPending: P,
28
+ onApply: w,
29
+ onCancel: d
30
+ }) {
31
+ T("Payroll.GrossUpModal");
32
+ const { t: r } = j("Payroll.GrossUpModal"), { Modal: A, Heading: u, Text: p, Button: n, Alert: f } = z(), { baseSubmitHandler: y } = B(), N = U(null), [l, i] = m(null), [h, c] = m(null), [M, b] = m(!1), o = I({
33
+ resolver: k(q),
34
+ defaultValues: { netPay: 0 }
35
+ });
36
+ x(() => {
37
+ s || (o.reset({ netPay: 0 }), i(null), c(null));
38
+ }, [s, o.reset]);
39
+ const S = async (G) => {
40
+ c(null), i(null), await y(null, async () => {
41
+ const g = await C(G.netPay);
42
+ g ? i(g) : c(r("errorMessage"));
43
+ });
44
+ }, F = async () => {
45
+ l && (b(!0), await y(null, async () => {
46
+ try {
47
+ await w(l);
48
+ } finally {
49
+ b(!1);
50
+ }
51
+ }));
52
+ };
53
+ return /* @__PURE__ */ e(
54
+ A,
55
+ {
56
+ isOpen: s,
57
+ onClose: d,
58
+ containerRef: N,
59
+ footer: /* @__PURE__ */ a(H, { children: [
60
+ /* @__PURE__ */ e(n, { variant: "secondary", onClick: d, children: r("cancelCta") }),
61
+ l ? /* @__PURE__ */ e(n, { variant: "primary", onClick: F, isLoading: M, children: r("applyCta") }) : /* @__PURE__ */ e(
62
+ n,
63
+ {
64
+ variant: "primary",
65
+ onClick: o.handleSubmit(S),
66
+ isLoading: P,
67
+ children: r("calculateCta")
68
+ }
69
+ )
70
+ ] }),
71
+ children: /* @__PURE__ */ e(L, { ...o, children: /* @__PURE__ */ a("div", { className: t.content, children: [
72
+ /* @__PURE__ */ a("div", { className: t.header, children: [
73
+ /* @__PURE__ */ e(u, { as: "h2", styledAs: "h3", children: r("title") }),
74
+ /* @__PURE__ */ e(p, { children: r("description") })
75
+ ] }),
76
+ h && /* @__PURE__ */ e("div", { className: t.alert, children: /* @__PURE__ */ e(f, { label: h, status: "error", disableScrollIntoView: !0 }) }),
77
+ /* @__PURE__ */ e("div", { className: t.inputSection, children: /* @__PURE__ */ e(
78
+ V,
79
+ {
80
+ name: "netPay",
81
+ label: r("netPayLabel"),
82
+ format: "currency",
83
+ min: 0,
84
+ isRequired: !0
85
+ }
86
+ ) }),
87
+ l && /* @__PURE__ */ a(R, { children: [
88
+ /* @__PURE__ */ e("div", { className: t.alert, children: /* @__PURE__ */ e(f, { label: r("warning"), status: "warning", disableScrollIntoView: !0 }) }),
89
+ /* @__PURE__ */ a("div", { className: t.result, children: [
90
+ /* @__PURE__ */ e(p, { weight: "semibold", children: r("grossPayResult") }),
91
+ /* @__PURE__ */ e(u, { as: "h3", styledAs: "h2", children: E(parseFloat(l)) })
92
+ ] })
93
+ ] })
94
+ ] }) })
95
+ }
96
+ );
97
+ }
98
+ export {
99
+ ce as GrossUpModal
100
+ };
101
+ //# sourceMappingURL=GrossUpModal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GrossUpModal.js","sources":["../../../../src/components/Payroll/GrossUpModal/GrossUpModal.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react'\nimport { FormProvider, useForm } from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport { z } from 'zod'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport type { GrossUpModalProps } from './GrossUpModalTypes'\nimport styles from './GrossUpModal.module.scss'\nimport { ActionsLayout, NumberInputField } from '@/components/Common'\nimport { useBase } from '@/components/Base'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\nimport { formatNumberAsCurrency } from '@/helpers/formattedStrings'\n\nconst GrossUpFormSchema = z.object({\n netPay: z.number().positive(),\n})\n\ntype GrossUpFormValues = z.infer<typeof GrossUpFormSchema>\n\nexport function GrossUpModal({\n isOpen,\n onCalculateGrossUp,\n isPending,\n onApply,\n onCancel,\n}: GrossUpModalProps) {\n useI18n('Payroll.GrossUpModal')\n const { t } = useTranslation('Payroll.GrossUpModal')\n const { Modal, Heading, Text, Button, Alert } = useComponentContext()\n const { baseSubmitHandler } = useBase()\n const modalContainerRef = useRef<HTMLDivElement>(null)\n\n const [calculatedGrossUp, setCalculatedGrossUp] = useState<string | null>(null)\n const [errorMessage, setErrorMessage] = useState<string | null>(null)\n const [isApplying, setIsApplying] = useState(false)\n\n const formHandlers = useForm<GrossUpFormValues>({\n resolver: zodResolver(GrossUpFormSchema),\n defaultValues: { netPay: 0 },\n })\n\n useEffect(() => {\n if (!isOpen) {\n formHandlers.reset({ netPay: 0 })\n setCalculatedGrossUp(null)\n setErrorMessage(null)\n }\n }, [isOpen, formHandlers.reset])\n\n const handleCalculate = async (data: GrossUpFormValues) => {\n setErrorMessage(null)\n setCalculatedGrossUp(null)\n\n await baseSubmitHandler(null, async () => {\n const result = await onCalculateGrossUp(data.netPay)\n\n if (result) {\n setCalculatedGrossUp(result)\n } else {\n setErrorMessage(t('errorMessage'))\n }\n })\n }\n\n const handleApply = async () => {\n if (calculatedGrossUp) {\n setIsApplying(true)\n await baseSubmitHandler(null, async () => {\n try {\n await onApply(calculatedGrossUp)\n } finally {\n setIsApplying(false)\n }\n })\n }\n }\n\n return (\n <Modal\n isOpen={isOpen}\n onClose={onCancel}\n containerRef={modalContainerRef}\n footer={\n <ActionsLayout>\n <Button variant=\"secondary\" onClick={onCancel}>\n {t('cancelCta')}\n </Button>\n {calculatedGrossUp ? (\n <Button variant=\"primary\" onClick={handleApply} isLoading={isApplying}>\n {t('applyCta')}\n </Button>\n ) : (\n <Button\n variant=\"primary\"\n onClick={formHandlers.handleSubmit(handleCalculate)}\n isLoading={isPending}\n >\n {t('calculateCta')}\n </Button>\n )}\n </ActionsLayout>\n }\n >\n <FormProvider {...formHandlers}>\n <div className={styles.content}>\n <div className={styles.header}>\n <Heading as=\"h2\" styledAs=\"h3\">\n {t('title')}\n </Heading>\n <Text>{t('description')}</Text>\n </div>\n\n {errorMessage && (\n <div className={styles.alert}>\n <Alert label={errorMessage} status=\"error\" disableScrollIntoView />\n </div>\n )}\n\n <div className={styles.inputSection}>\n <NumberInputField\n name=\"netPay\"\n label={t('netPayLabel')}\n format=\"currency\"\n min={0}\n isRequired\n />\n </div>\n\n {calculatedGrossUp && (\n <>\n <div className={styles.alert}>\n <Alert label={t('warning')} status=\"warning\" disableScrollIntoView />\n </div>\n <div className={styles.result}>\n <Text weight=\"semibold\">{t('grossPayResult')}</Text>\n <Heading as=\"h3\" styledAs=\"h2\">\n {formatNumberAsCurrency(parseFloat(calculatedGrossUp))}\n </Heading>\n </div>\n </>\n )}\n </div>\n </FormProvider>\n </Modal>\n )\n}\n"],"names":["GrossUpFormSchema","z","GrossUpModal","isOpen","onCalculateGrossUp","isPending","onApply","onCancel","useI18n","t","useTranslation","Modal","Heading","Text","Button","Alert","useComponentContext","baseSubmitHandler","useBase","modalContainerRef","useRef","calculatedGrossUp","setCalculatedGrossUp","useState","errorMessage","setErrorMessage","isApplying","setIsApplying","formHandlers","useForm","zodResolver","useEffect","handleCalculate","data","result","handleApply","jsx","ActionsLayout","FormProvider","styles","jsxs","NumberInputField","Fragment","formatNumberAsCurrency"],"mappings":";;;;;;;;;;;;;;;;;;;;AAaA,MAAMA,IAAoBC,EAAE,OAAO;AAAA,EACjC,QAAQA,EAAE,OAAA,EAAS,SAAA;AACrB,CAAC;AAIM,SAASC,GAAa;AAAA,EAC3B,QAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC;AACF,GAAsB;AACpB,EAAAC,EAAQ,sBAAsB;AAC9B,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,sBAAsB,GAC7C,EAAE,OAAAC,GAAO,SAAAC,GAAS,MAAAC,GAAM,QAAAC,GAAQ,OAAAC,EAAA,IAAUC,EAAA,GAC1C,EAAE,mBAAAC,EAAA,IAAsBC,EAAA,GACxBC,IAAoBC,EAAuB,IAAI,GAE/C,CAACC,GAAmBC,CAAoB,IAAIC,EAAwB,IAAI,GACxE,CAACC,GAAcC,CAAe,IAAIF,EAAwB,IAAI,GAC9D,CAACG,GAAYC,CAAa,IAAIJ,EAAS,EAAK,GAE5CK,IAAeC,EAA2B;AAAA,IAC9C,UAAUC,EAAY9B,CAAiB;AAAA,IACvC,eAAe,EAAE,QAAQ,EAAA;AAAA,EAAE,CAC5B;AAED,EAAA+B,EAAU,MAAM;AACd,IAAK5B,MACHyB,EAAa,MAAM,EAAE,QAAQ,EAAA,CAAG,GAChCN,EAAqB,IAAI,GACzBG,EAAgB,IAAI;AAAA,EAExB,GAAG,CAACtB,GAAQyB,EAAa,KAAK,CAAC;AAE/B,QAAMI,IAAkB,OAAOC,MAA4B;AACzD,IAAAR,EAAgB,IAAI,GACpBH,EAAqB,IAAI,GAEzB,MAAML,EAAkB,MAAM,YAAY;AACxC,YAAMiB,IAAS,MAAM9B,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EAAO,OACrB,UAAA,gBAAAH,EAACrB,GAAA,EAAM,OAAOS,GAAc,QAAO,SAAQ,uBAAqB,IAAC,GACnE;AAAA,QAGF,gBAAAY,EAAC,OAAA,EAAI,WAAWG,EAAO,cACrB,UAAA,gBAAAH;AAAA,UAACK;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,OAAOhC,EAAE,aAAa;AAAA,YACtB,QAAO;AAAA,YACP,KAAK;AAAA,YACL,YAAU;AAAA,UAAA;AAAA,QAAA,GAEd;AAAA,QAECY,KACC,gBAAAmB,EAAAE,GAAA,EACE,UAAA;AAAA,UAAA,gBAAAN,EAAC,OAAA,EAAI,WAAWG,EAAO,OACrB,4BAACxB,GAAA,EAAM,OAAON,EAAE,SAAS,GAAG,QAAO,WAAU,uBAAqB,IAAC,GACrE;AAAA,UACA,gBAAA+B,EAAC,OAAA,EAAI,WAAWD,EAAO,QACrB,UAAA;AAAA,YAAA,gBAAAH,EAACvB,GAAA,EAAK,QAAO,YAAY,UAAAJ,EAAE,gBAAgB,GAAE;AAAA,YAC7C,gBAAA2B,EAACxB,GAAA,EAAQ,IAAG,MAAK,UAAS,MACvB,UAAA+B,EAAuB,WAAWtB,CAAiB,CAAC,EAAA,CACvD;AAAA,UAAA,EAAA,CACF;AAAA,QAAA,EAAA,CACF;AAAA,MAAA,EAAA,CAEJ,EAAA,CACF;AAAA,IAAA;AAAA,EAAA;AAGN;"}
@@ -0,0 +1,16 @@
1
+ const t = "_content_1b9sr_1", e = "_header_1b9sr_7", n = "_inputSection_1b9sr_13", s = "_alert_1b9sr_17", r = "_result_1b9sr_24", _ = {
2
+ content: t,
3
+ header: e,
4
+ inputSection: n,
5
+ alert: s,
6
+ result: r
7
+ };
8
+ export {
9
+ s as alert,
10
+ t as content,
11
+ _ as default,
12
+ e as header,
13
+ n as inputSection,
14
+ r as result
15
+ };
16
+ //# sourceMappingURL=GrossUpModal.module.scss.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GrossUpModal.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -0,0 +1,7 @@
1
+ export interface GrossUpModalProps {
2
+ isOpen: boolean;
3
+ onCalculateGrossUp: (netPay: number) => Promise<string | null>;
4
+ isPending: boolean;
5
+ onApply: (grossAmount: string) => void | Promise<void>;
6
+ onCancel: () => void;
7
+ }
@@ -0,0 +1,3 @@
1
+ import "./types/i18next.d.ts"
2
+ export { GrossUpModal } from './GrossUpModal';
3
+ export type { GrossUpModalProps } from './GrossUpModalTypes';
@@ -1,107 +1,126 @@
1
- import { jsx as l } from "react/jsx-runtime";
2
- import { useMemo as B, useEffect as I } from "react";
3
- import { useForm as T, FormProvider as V } from "react-hook-form";
4
- import { zodResolver as j } from "@hookform/resolvers/zod";
1
+ import { jsx as s } from "react/jsx-runtime";
2
+ import { useState as w, useCallback as C, useMemo as z, useEffect as Y } from "react";
3
+ import { useForm as H, FormProvider as Z } from "react-hook-form";
4
+ import { zodResolver as G } from "@hookform/resolvers/zod";
5
5
  import { z as t } from "zod";
6
- import { useTranslation as O } from "react-i18next";
7
- import { usePayrollsCreateOffCycleMutation as q } from "@gusto/embedded-api/react-query/payrollsCreateOffCycle";
8
- import { OffCycleReason as E } from "@gusto/embedded-api/models/operations/postv1companiescompanyidpayrolls";
9
- import { RFCDate as f } from "@gusto/embedded-api/types/rfcdate";
10
- import { useEmployeesListSuspense as x } from "@gusto/embedded-api/react-query/employeesList";
11
- import { createOffCyclePayPeriodDateFormSchema as z } from "../OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormTypes.js";
12
- import { useOffCyclePayPeriodDateValidation as M } from "../OffCyclePayPeriodDateForm/useOffCyclePayPeriodDateValidation.js";
13
- import { OffCycleCreationPresentation as Y } from "./OffCycleCreationPresentation.js";
14
- import { BaseComponent as H } from "../../Base/Base.js";
15
- import { useBase as Z } from "../../Base/useBase.js";
16
- import { useComponentDictionary as G, useI18n as n } from "../../../i18n/I18n.js";
17
- import { componentEvents as J } from "../../../shared/constants.js";
18
- import { Form as K } from "../../Common/Form/Form.js";
19
- import { OFF_CYCLE_REASON_DEFAULTS as k } from "../OffCycleReasonSelection/types.js";
20
- const Q = {
21
- bonus: E.Bonus,
22
- correction: E.Correction
6
+ import { useTranslation as S } from "react-i18next";
7
+ import { usePayrollsCreateOffCycleMutation as J } from "@gusto/embedded-api/react-query/payrollsCreateOffCycle";
8
+ import { WithholdingPayPeriod as K, OffCycleReason as b } from "@gusto/embedded-api/models/operations/postv1companiescompanyidpayrolls";
9
+ import { RFCDate as g } from "@gusto/embedded-api/types/rfcdate";
10
+ import { useEmployeesListSuspense as Q } from "@gusto/embedded-api/react-query/employeesList";
11
+ import { createOffCyclePayPeriodDateFormSchema as X } from "../OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormTypes.js";
12
+ import { useOffCyclePayPeriodDateValidation as $ } from "../OffCyclePayPeriodDateForm/useOffCyclePayPeriodDateValidation.js";
13
+ import { OffCycleCreationPresentation as ee } from "./OffCycleCreationPresentation.js";
14
+ import { BaseComponent as oe } from "../../Base/Base.js";
15
+ import { useBase as te } from "../../Base/useBase.js";
16
+ import { useComponentDictionary as ne, useI18n as i } from "../../../i18n/I18n.js";
17
+ import { componentEvents as le } from "../../../shared/constants.js";
18
+ import { Form as ie } from "../../Common/Form/Form.js";
19
+ import { OFF_CYCLE_REASON_DEFAULTS as m } from "../OffCycleReasonSelection/types.js";
20
+ const se = {
21
+ bonus: b.Bonus,
22
+ correction: b.Correction
23
23
  };
24
- function Pe(i) {
25
- return /* @__PURE__ */ l(H, { ...i, children: /* @__PURE__ */ l(W, { ...i }) });
24
+ function Te(r) {
25
+ return /* @__PURE__ */ s(oe, { ...r, children: /* @__PURE__ */ s(re, { ...r }) });
26
26
  }
27
- function W({ dictionary: i, companyId: d, payrollType: m = "bonus" }) {
28
- G("Payroll.OffCycleCreation", i), n("Payroll.OffCycleCreation"), n("Payroll.OffCycleReasonSelection"), n("Payroll.OffCyclePayPeriodDateForm"), n("Payroll.OffCycleDeductionsSetting"), n("Payroll.EmployeeSelection");
29
- const { t: R } = O("Payroll.OffCyclePayPeriodDateForm"), { t: p } = O("Payroll.OffCycleCreation"), { onEvent: g, baseSubmitHandler: S } = Z(), { minCheckDate: b, today: A } = M(), { mutateAsync: F, isPending: v } = q(), { data: C, isLoading: w } = x({
30
- companyId: d,
27
+ function re({ dictionary: r, companyId: P, payrollType: a = "bonus" }) {
28
+ ne("Payroll.OffCycleCreation", r), i("Payroll.OffCycleCreation"), i("Payroll.OffCycleReasonSelection"), i("Payroll.OffCyclePayPeriodDateForm"), i("Payroll.OffCycleDeductionsSetting"), i("Payroll.EmployeeSelection");
29
+ const { t: T } = S("Payroll.OffCyclePayPeriodDateForm"), { t: D } = S("Payroll.OffCycleCreation"), { onEvent: x, baseSubmitHandler: W } = te(), { minCheckDate: A, today: F } = $(), { mutateAsync: v, isPending: L } = J(), [u, O] = w({
30
+ withholdingPayPeriod: K.EveryOtherWeek,
31
+ withholdingRate: m[a].withholdingType
32
+ }), [U, y] = w(!1), M = C(() => {
33
+ y(!0);
34
+ }, []), _ = C((e) => {
35
+ O(e), y(!1);
36
+ }, []), N = C(() => {
37
+ y(!1);
38
+ }, []), { data: E, isLoading: B } = Q({
39
+ companyId: P,
31
40
  onboardedActive: !0
32
- }), L = B(() => (C.showEmployees ?? []).map((o) => ({
41
+ }), I = z(() => (E.showEmployees ?? []).map((o) => ({
33
42
  label: [o.firstName, o.lastName].filter(Boolean).join(" "),
34
43
  value: o.uuid
35
- })), [C]), U = (e) => R(e), s = T({
36
- resolver: (e, o, r) => {
37
- const u = e.reason, y = e.isCheckOnly, c = z(
38
- U,
39
- u === "correction" ? "correction" : m,
40
- y ? A : b
41
- ), a = t.object({
44
+ })), [E]), V = (e) => T(e), l = H({
45
+ resolver: (e, o, n) => {
46
+ const f = e.reason, p = e.isCheckOnly, c = X(
47
+ V,
48
+ f === "correction" ? "correction" : a,
49
+ p ? F : A
50
+ ), d = t.object({
42
51
  reason: t.enum(["bonus", "correction"]),
43
52
  skipRegularDeductions: t.boolean(),
44
53
  includeAllEmployees: t.boolean(),
45
54
  selectedEmployeeUuids: t.array(t.string())
46
- }).and(c).superRefine((h, N) => {
47
- !h.includeAllEmployees && h.selectedEmployeeUuids.length === 0 && N.addIssue({
55
+ }).and(c).superRefine((R, q) => {
56
+ !R.includeAllEmployees && R.selectedEmployeeUuids.length === 0 && q.addIssue({
48
57
  code: t.ZodIssueCode.custom,
49
58
  path: ["selectedEmployeeUuids"],
50
- message: p("errors.noEmployeesSelected")
59
+ message: D("errors.noEmployeesSelected")
51
60
  });
52
61
  });
53
- return j(a)(e, o, r);
62
+ return G(d)(e, o, n);
54
63
  },
55
64
  defaultValues: {
56
- reason: m,
65
+ reason: a,
57
66
  isCheckOnly: !1,
58
67
  startDate: null,
59
68
  endDate: null,
60
69
  checkDate: null,
61
- skipRegularDeductions: k[m].skipDeductions,
70
+ skipRegularDeductions: m[a].skipDeductions,
62
71
  includeAllEmployees: !0,
63
72
  selectedEmployeeUuids: []
64
73
  }
65
- }), D = s.watch("reason");
66
- I(() => {
67
- s.setValue(
74
+ }), h = l.watch("reason");
75
+ Y(() => {
76
+ l.setValue(
68
77
  "skipRegularDeductions",
69
- k[D].skipDeductions
70
- );
71
- }, [D, s]);
72
- const _ = async (e) => {
73
- const o = e.reason, r = e.checkDate, u = e.isCheckOnly ? r : e.startDate, y = e.isCheckOnly ? r : e.endDate, P = !e.includeAllEmployees && e.selectedEmployeeUuids.length > 0 ? e.selectedEmployeeUuids : void 0;
74
- await S(e, async () => {
75
- const c = await F({
78
+ m[h].skipDeductions
79
+ ), O((e) => ({
80
+ ...e,
81
+ withholdingRate: m[h].withholdingType
82
+ }));
83
+ }, [h, l]);
84
+ const j = async (e) => {
85
+ const o = e.reason, n = e.checkDate, f = e.isCheckOnly ? n : e.startDate, p = e.isCheckOnly ? n : e.endDate, k = !e.includeAllEmployees && e.selectedEmployeeUuids.length > 0 ? e.selectedEmployeeUuids : void 0;
86
+ await W(e, async () => {
87
+ const c = await v({
76
88
  request: {
77
- companyId: d,
89
+ companyId: P,
78
90
  requestBody: {
79
91
  offCycle: !0,
80
- offCycleReason: Q[o],
81
- startDate: new f(u),
82
- endDate: new f(y),
83
- checkDate: new f(r),
92
+ offCycleReason: se[o],
93
+ startDate: new g(f),
94
+ endDate: new g(p),
95
+ checkDate: new g(n),
84
96
  skipRegularDeductions: e.skipRegularDeductions,
85
97
  isCheckOnlyPayroll: e.isCheckOnly,
86
- employeeUuids: P
98
+ employeeUuids: k,
99
+ withholdingPayPeriod: u.withholdingPayPeriod,
100
+ fixedWithholdingRate: u.withholdingRate === "supplemental"
87
101
  }
88
102
  }
89
- }), a = c.payrollPrepared?.payrollUuid ?? c.payrollPrepared?.uuid;
90
- if (!a)
91
- throw new Error(p("errors.missingPayrollId"));
92
- g(J.OFF_CYCLE_CREATED, { payrollUuid: a });
103
+ }), d = c.payrollPrepared?.payrollUuid ?? c.payrollPrepared?.uuid;
104
+ if (!d)
105
+ throw new Error(D("errors.missingPayrollId"));
106
+ x(le.OFF_CYCLE_CREATED, { payrollUuid: d });
93
107
  });
94
108
  };
95
- return /* @__PURE__ */ l(V, { ...s, children: /* @__PURE__ */ l(K, { onSubmit: s.handleSubmit(_), children: /* @__PURE__ */ l(
96
- Y,
109
+ return /* @__PURE__ */ s(Z, { ...l, children: /* @__PURE__ */ s(ie, { onSubmit: l.handleSubmit(j), children: /* @__PURE__ */ s(
110
+ ee,
97
111
  {
98
- employees: L,
99
- isLoadingEmployees: w,
100
- isPending: v
112
+ employees: I,
113
+ isLoadingEmployees: B,
114
+ isPending: L,
115
+ taxWithholdingConfig: u,
116
+ isTaxWithholdingModalOpen: U,
117
+ onTaxWithholdingEditClick: M,
118
+ onTaxWithholdingModalDone: _,
119
+ onTaxWithholdingModalCancel: N
101
120
  }
102
121
  ) }) });
103
122
  }
104
123
  export {
105
- Pe as OffCycleCreation
124
+ Te as OffCycleCreation
106
125
  };
107
126
  //# sourceMappingURL=OffCycleCreation.js.map