@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.
- package/CHANGELOG.md +38 -0
- package/dist/components/Base/Base.d.ts +6 -2
- package/dist/components/Base/Base.js +105 -59
- package/dist/components/Base/Base.js.map +1 -1
- package/dist/components/Base/useBase.d.ts +1 -0
- package/dist/components/Base/useBase.js.map +1 -1
- package/dist/components/Base/useBaseSubmit.d.ts +1 -1
- package/dist/components/Base/useBaseSubmit.js +60 -33
- package/dist/components/Base/useBaseSubmit.js.map +1 -1
- package/dist/components/Common/HamburgerMenu/HamburgerMenu.d.ts +1 -1
- package/dist/components/Common/HamburgerMenu/HamburgerMenu.js +15 -13
- package/dist/components/Common/HamburgerMenu/HamburgerMenu.js.map +1 -1
- package/dist/components/Common/HamburgerMenu/HamburgerMenuTypes.d.ts +1 -0
- package/dist/components/Common/UI/Breadcrumbs/Breadcrumbs.js +1 -1
- package/dist/components/Common/UI/FileInput/FileInput.js +1 -1
- package/dist/components/Common/UI/Menu/Menu.js +26 -25
- package/dist/components/Common/UI/Menu/Menu.js.map +1 -1
- package/dist/components/Common/UI/Menu/Menu.module.scss.js +7 -7
- package/dist/components/Common/UI/Menu/MenuTypes.d.ts +5 -0
- package/dist/components/Common/UI/Menu/MenuTypes.js +4 -3
- package/dist/components/Common/UI/Menu/MenuTypes.js.map +1 -1
- package/dist/components/Common/UI/ProgressBar/ProgressBar.js +4 -4
- package/dist/components/Common/UI/Table/Table.module.scss.js +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/CreatePayment.js +119 -113
- package/dist/components/Contractor/Payments/CreatePayment/CreatePayment.js.map +1 -1
- package/dist/components/Contractor/Profile/ContractorProfileForm.js +15 -15
- package/dist/components/Employee/Compensation/Edit.js +70 -70
- package/dist/components/Employee/Compensation/Edit.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/SignatureForm/Form.js +5 -5
- package/dist/components/Employee/DocumentSigner/SignatureForm/Form.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/SignatureForm/Preview.js +8 -8
- package/dist/components/Employee/DocumentSigner/SignatureForm/Preview.js.map +1 -1
- package/dist/components/Employee/StateTaxes/StateTaxes.js +69 -61
- package/dist/components/Employee/StateTaxes/StateTaxes.js.map +1 -1
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.d.ts +2 -0
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.js +101 -0
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.js.map +1 -0
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.module.scss.js +16 -0
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.module.scss.js.map +1 -0
- package/dist/components/Payroll/GrossUpModal/GrossUpModalTypes.d.ts +7 -0
- package/dist/components/Payroll/GrossUpModal/index.d.ts +3 -0
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js +86 -67
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js.map +1 -1
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.d.ts +1 -1
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.js +83 -49
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.js.map +1 -1
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreationTypes.d.ts +6 -0
- package/dist/components/Payroll/OffCycleTaxWithholdingModal/OffCycleTaxWithholdingModal.js +102 -0
- package/dist/components/Payroll/OffCycleTaxWithholdingModal/OffCycleTaxWithholdingModal.js.map +1 -0
- package/dist/components/Payroll/OffCycleTaxWithholdingModal/OffCycleTaxWithholdingModal.module.scss.js +14 -0
- package/dist/components/Payroll/OffCycleTaxWithholdingModal/OffCycleTaxWithholdingModal.module.scss.js.map +1 -0
- package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTable.js +52 -0
- package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTable.js.map +1 -0
- package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTable.module.scss.js +16 -0
- package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTable.module.scss.js.map +1 -0
- package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTableTypes.d.ts +12 -2
- package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTableTypes.js +15 -0
- package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTableTypes.js.map +1 -0
- package/dist/components/Payroll/OffCycleTaxWithholdingTable/index.d.ts +2 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +212 -120
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.d.ts +3 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js +76 -64
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/grossUpHelpers.d.ts +2 -0
- package/dist/components/Payroll/PayrollConfiguration/grossUpHelpers.js +11 -0
- package/dist/components/Payroll/PayrollConfiguration/grossUpHelpers.js.map +1 -0
- package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js +67 -57
- package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js.map +1 -1
- package/dist/components/Payroll/usePreparedPayrollData.js +44 -43
- package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.d.ts +2 -0
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +58 -38
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
- package/dist/contexts/ObservabilityProvider/ObservabilityContext.d.ts +5 -0
- package/dist/contexts/ObservabilityProvider/ObservabilityContext.js +6 -0
- package/dist/contexts/ObservabilityProvider/ObservabilityContext.js.map +1 -0
- package/dist/contexts/ObservabilityProvider/ObservabilityProvider.d.ts +7 -0
- package/dist/contexts/ObservabilityProvider/ObservabilityProvider.js +11 -0
- package/dist/contexts/ObservabilityProvider/ObservabilityProvider.js.map +1 -0
- package/dist/contexts/ObservabilityProvider/index.d.ts +5 -0
- package/dist/contexts/ObservabilityProvider/observabilityUtils.d.ts +5 -0
- package/dist/contexts/ObservabilityProvider/observabilityUtils.js +45 -0
- package/dist/contexts/ObservabilityProvider/observabilityUtils.js.map +1 -0
- package/dist/contexts/ObservabilityProvider/sanitization.d.ts +19 -0
- package/dist/contexts/ObservabilityProvider/sanitization.js +95 -0
- package/dist/contexts/ObservabilityProvider/sanitization.js.map +1 -0
- package/dist/contexts/ObservabilityProvider/sanitization.test.d.ts +1 -0
- package/dist/contexts/ObservabilityProvider/useObservability.d.ts +2 -0
- package/dist/contexts/ObservabilityProvider/useObservability.js +11 -0
- package/dist/contexts/ObservabilityProvider/useObservability.js.map +1 -0
- package/dist/contexts/ObservabilityProvider/useSanitizedObservability.d.ts +8 -0
- package/dist/contexts/ObservabilityProvider/useSanitizedObservability.js +28 -0
- package/dist/contexts/ObservabilityProvider/useSanitizedObservability.js.map +1 -0
- package/dist/contexts/index.d.ts +2 -0
- package/dist/helpers/rem.d.ts +7 -3
- package/dist/helpers/rem.js +14 -10
- package/dist/helpers/rem.js.map +1 -1
- package/dist/helpers/rem.test.d.ts +1 -0
- package/dist/helpers/retryAsync.d.ts +7 -0
- package/dist/helpers/retryAsync.js +18 -0
- package/dist/helpers/retryAsync.js.map +1 -0
- package/dist/i18n/I18n.js +15 -15
- package/dist/i18n/I18n.js.map +1 -1
- package/dist/i18n/en/Company.PaySchedule.json.js +1 -1
- package/dist/i18n/en/Payroll.GrossUpModal.json.js +24 -0
- package/dist/i18n/en/Payroll.GrossUpModal.json.js.map +1 -0
- package/dist/i18n/en/Payroll.OffCycleTaxWithholding.json.js +13 -11
- package/dist/i18n/en/Payroll.OffCycleTaxWithholding.json.js.map +1 -1
- package/dist/i18n/en/Payroll.PayrollConfiguration.json.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +19 -13
- package/dist/index.js.map +1 -1
- package/dist/shared/constants.d.ts +5 -0
- package/dist/shared/constants.js +11 -8
- package/dist/shared/constants.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/i18next.d.ts +26 -1
- package/dist/types/observability.d.ts +145 -0
- package/docs/reference/endpoint-inventory.json +10 -1
- package/package.json +21 -21
|
@@ -1,90 +1,98 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { zodResolver as
|
|
3
|
-
import { useForm as
|
|
4
|
-
import { useEffect as
|
|
5
|
-
import { useEmployeeTaxSetupGetStateTaxesSuspense as
|
|
6
|
-
import { useEmployeeTaxSetupUpdateStateTaxesMutation as
|
|
7
|
-
import { StateFormSchema as
|
|
8
|
-
import { Actions as
|
|
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
|
|
11
|
-
import { useBase as
|
|
12
|
-
import { useI18n as
|
|
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
|
|
16
|
-
const
|
|
17
|
-
function
|
|
18
|
-
return /* @__PURE__ */
|
|
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
|
|
21
|
-
const { employeeId: c, className: h, children:
|
|
22
|
-
|
|
23
|
-
const { data:
|
|
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
|
-
}),
|
|
26
|
-
states:
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
-
}, [
|
|
46
|
+
}, [p, v]), /* @__PURE__ */ r("section", { className: h, children: /* @__PURE__ */ r(
|
|
40
47
|
X,
|
|
41
48
|
{
|
|
42
49
|
value: {
|
|
43
|
-
employeeStateTaxes:
|
|
44
|
-
isAdmin:
|
|
45
|
-
isPending:
|
|
50
|
+
employeeStateTaxes: d,
|
|
51
|
+
isAdmin: S,
|
|
52
|
+
isPending: g
|
|
46
53
|
},
|
|
47
|
-
children: /* @__PURE__ */
|
|
48
|
-
await
|
|
49
|
-
const { states: e } =
|
|
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
|
|
52
|
-
for (const
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
state:
|
|
56
|
-
questions:
|
|
57
|
-
if (
|
|
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
|
|
60
|
-
|
|
61
|
-
|
|
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:
|
|
65
|
-
validUpTo:
|
|
66
|
-
value:
|
|
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((
|
|
78
|
+
}).filter((t) => t !== null)
|
|
71
79
|
});
|
|
72
80
|
}
|
|
73
|
-
const
|
|
74
|
-
request: { employeeUuid: c, employeeStateTaxesRequest: { states:
|
|
81
|
+
const n = await _({
|
|
82
|
+
request: { employeeUuid: c, employeeStateTaxesRequest: { states: m } }
|
|
75
83
|
});
|
|
76
|
-
|
|
84
|
+
T(x.EMPLOYEE_STATE_TAXES_UPDATED, n);
|
|
77
85
|
}
|
|
78
|
-
|
|
86
|
+
T(x.EMPLOYEE_STATE_TAXES_DONE);
|
|
79
87
|
});
|
|
80
|
-
}), children:
|
|
81
|
-
/* @__PURE__ */
|
|
82
|
-
/* @__PURE__ */
|
|
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
|
-
|
|
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,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,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es/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,GAA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,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,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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
|
+
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":";;;;;;;"}
|
|
@@ -1,107 +1,126 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import { useForm as
|
|
4
|
-
import { zodResolver as
|
|
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
|
|
7
|
-
import { usePayrollsCreateOffCycleMutation as
|
|
8
|
-
import { OffCycleReason as
|
|
9
|
-
import { RFCDate as
|
|
10
|
-
import { useEmployeesListSuspense as
|
|
11
|
-
import { createOffCyclePayPeriodDateFormSchema as
|
|
12
|
-
import { useOffCyclePayPeriodDateValidation as
|
|
13
|
-
import { OffCycleCreationPresentation as
|
|
14
|
-
import { BaseComponent as
|
|
15
|
-
import { useBase as
|
|
16
|
-
import { useComponentDictionary as
|
|
17
|
-
import { componentEvents as
|
|
18
|
-
import { Form as
|
|
19
|
-
import { OFF_CYCLE_REASON_DEFAULTS as
|
|
20
|
-
const
|
|
21
|
-
bonus:
|
|
22
|
-
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
|
|
25
|
-
return /* @__PURE__ */
|
|
24
|
+
function Te(r) {
|
|
25
|
+
return /* @__PURE__ */ s(oe, { ...r, children: /* @__PURE__ */ s(re, { ...r }) });
|
|
26
26
|
}
|
|
27
|
-
function
|
|
28
|
-
|
|
29
|
-
const { t:
|
|
30
|
-
|
|
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
|
-
}),
|
|
41
|
+
}), I = z(() => (E.showEmployees ?? []).map((o) => ({
|
|
33
42
|
label: [o.firstName, o.lastName].filter(Boolean).join(" "),
|
|
34
43
|
value: o.uuid
|
|
35
|
-
})), [
|
|
36
|
-
resolver: (e, o,
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
),
|
|
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((
|
|
47
|
-
!
|
|
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:
|
|
59
|
+
message: D("errors.noEmployeesSelected")
|
|
51
60
|
});
|
|
52
61
|
});
|
|
53
|
-
return
|
|
62
|
+
return G(d)(e, o, n);
|
|
54
63
|
},
|
|
55
64
|
defaultValues: {
|
|
56
|
-
reason:
|
|
65
|
+
reason: a,
|
|
57
66
|
isCheckOnly: !1,
|
|
58
67
|
startDate: null,
|
|
59
68
|
endDate: null,
|
|
60
69
|
checkDate: null,
|
|
61
|
-
skipRegularDeductions:
|
|
70
|
+
skipRegularDeductions: m[a].skipDeductions,
|
|
62
71
|
includeAllEmployees: !0,
|
|
63
72
|
selectedEmployeeUuids: []
|
|
64
73
|
}
|
|
65
|
-
}),
|
|
66
|
-
|
|
67
|
-
|
|
74
|
+
}), h = l.watch("reason");
|
|
75
|
+
Y(() => {
|
|
76
|
+
l.setValue(
|
|
68
77
|
"skipRegularDeductions",
|
|
69
|
-
|
|
70
|
-
)
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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:
|
|
89
|
+
companyId: P,
|
|
78
90
|
requestBody: {
|
|
79
91
|
offCycle: !0,
|
|
80
|
-
offCycleReason:
|
|
81
|
-
startDate: new f
|
|
82
|
-
endDate: new
|
|
83
|
-
checkDate: new
|
|
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:
|
|
98
|
+
employeeUuids: k,
|
|
99
|
+
withholdingPayPeriod: u.withholdingPayPeriod,
|
|
100
|
+
fixedWithholdingRate: u.withholdingRate === "supplemental"
|
|
87
101
|
}
|
|
88
102
|
}
|
|
89
|
-
}),
|
|
90
|
-
if (!
|
|
91
|
-
throw new Error(
|
|
92
|
-
|
|
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__ */
|
|
96
|
-
|
|
109
|
+
return /* @__PURE__ */ s(Z, { ...l, children: /* @__PURE__ */ s(ie, { onSubmit: l.handleSubmit(j), children: /* @__PURE__ */ s(
|
|
110
|
+
ee,
|
|
97
111
|
{
|
|
98
|
-
employees:
|
|
99
|
-
isLoadingEmployees:
|
|
100
|
-
isPending:
|
|
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
|
-
|
|
124
|
+
Te as OffCycleCreation
|
|
106
125
|
};
|
|
107
126
|
//# sourceMappingURL=OffCycleCreation.js.map
|