@gusto/embedded-react-sdk 0.10.2 → 0.10.3-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 +8 -0
- package/dist/components/Base/Base.d.ts +3 -2
- package/dist/components/Base/Base.js +31 -31
- package/dist/components/Base/Base.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountComponents.js +16 -9
- package/dist/components/Company/BankAccount/BankAccountComponents.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/Actions.js +22 -8
- package/dist/components/Company/BankAccount/BankAccountForm/Actions.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/BankAccountForm.d.ts +1 -0
- package/dist/components/Company/BankAccount/BankAccountForm/BankAccountForm.js +23 -25
- package/dist/components/Company/BankAccount/BankAccountForm/BankAccountForm.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/context.d.ts +4 -0
- package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountList/AccountView.js +14 -13
- package/dist/components/Company/BankAccount/BankAccountList/AccountView.js.map +1 -1
- package/dist/components/Company/BankAccount/stateMachine.d.ts +1 -1
- package/dist/components/Company/BankAccount/stateMachine.js +13 -5
- package/dist/components/Company/BankAccount/stateMachine.js.map +1 -1
- package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js +41 -42
- package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
- package/dist/components/Company/FederalTaxes/Head.js +11 -11
- package/dist/components/Company/FederalTaxes/Head.js.map +1 -1
- package/dist/components/Company/Industry/Industry.js +30 -31
- package/dist/components/Company/Industry/Industry.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/LocationForm.js +34 -37
- package/dist/components/Company/Locations/LocationForm/LocationForm.js.map +1 -1
- package/dist/components/Company/Locations/Locations.d.ts +1 -1
- package/dist/components/Company/Locations/Locations.js +19 -17
- package/dist/components/Company/Locations/Locations.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/List.js +5 -2
- package/dist/components/Company/Locations/LocationsList/List.js.map +1 -1
- package/dist/components/Company/PaySchedule/PaySchedule.js +70 -71
- package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
- package/dist/components/Contractor/Address/Address.js +37 -38
- package/dist/components/Contractor/Address/Address.js.map +1 -1
- package/dist/components/Contractor/List/index.js +47 -50
- package/dist/components/Contractor/List/index.js.map +1 -1
- package/dist/components/Contractor/NewHireReport/NewHireReport.js +57 -58
- package/dist/components/Contractor/NewHireReport/NewHireReport.js.map +1 -1
- package/dist/components/Employee/Compensation/Compensation.js +123 -132
- package/dist/components/Employee/Compensation/Compensation.js.map +1 -1
- package/dist/components/Employee/Deductions/Deductions.js +74 -79
- package/dist/components/Employee/Deductions/Deductions.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js +36 -42
- package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
- package/dist/components/Employee/EmployeeList/EmployeeList.js +57 -58
- package/dist/components/Employee/EmployeeList/EmployeeList.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/PaymentMethod.js +95 -97
- package/dist/components/Employee/PaymentMethod/PaymentMethod.js.map +1 -1
- package/dist/components/Employee/Profile/Profile.js +118 -124
- package/dist/components/Employee/Profile/Profile.js.map +1 -1
- package/dist/components/Employee/Taxes/FederalForm.js +4 -4
- package/dist/components/Employee/Taxes/FederalForm.js.map +1 -1
- package/dist/components/Employee/Taxes/Taxes.js +59 -60
- package/dist/components/Employee/Taxes/Taxes.js.map +1 -1
- package/dist/contexts/ApiProvider/ApiProvider.js +16 -14
- package/dist/contexts/ApiProvider/ApiProvider.js.map +1 -1
- package/dist/contexts/ComponentAdapter/componentAdapterTypes.d.ts +5 -0
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.d.ts +2 -0
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +19 -17
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
- package/dist/contexts/LoadingIndicatorProvider/LoadingIndicatorProvider.d.ts +7 -0
- package/dist/contexts/LoadingIndicatorProvider/LoadingIndicatorProvider.js +10 -0
- package/dist/contexts/LoadingIndicatorProvider/LoadingIndicatorProvider.js.map +1 -0
- package/dist/contexts/LoadingIndicatorProvider/useLoadingIndicator.d.ts +6 -0
- package/dist/contexts/LoadingIndicatorProvider/useLoadingIndicator.js +11 -0
- package/dist/contexts/LoadingIndicatorProvider/useLoadingIndicator.js.map +1 -0
- package/dist/i18n/en/Company.Locations.json.js +2 -2
- package/dist/shared/constants.d.ts +2 -0
- package/dist/shared/constants.js +10 -9
- package/dist/shared/constants.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/i18next.d.ts +1 -1
- package/package.json +8 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/Contractor/List/index.tsx"],"sourcesContent":["import { type Contractor } from '@gusto/embedded-api/models/components/contractor'\nimport { useTranslation } from 'react-i18next'\nimport { useContractors } from './useContractorList'\nimport { DataView, EmptyData, Flex, useDataView } from '@/components/Common'\nimport { firstLastName } from '@/helpers/formattedStrings'\nimport { HamburgerMenu } from '@/components/Common/HamburgerMenu/HamburgerMenu'\nimport PencilSvg from '@/assets/icons/pencil.svg?react'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { ContractorOnboardingStatusBadge } from '@/components/Common/OnboardingStatusBadge'\nimport { useI18n } from '@/i18n'\n\nexport type ContractorListDisplay = Pick<\n Contractor,\n 'onboardingStatus' | 'firstName' | 'lastName' | 'onboarded'\n>\n\nexport interface HeadProps {\n count: number\n handleAdd: () => void\n}\nexport function Head({ count, handleAdd }: HeadProps) {\n const {
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/Contractor/List/index.tsx"],"sourcesContent":["import { type Contractor } from '@gusto/embedded-api/models/components/contractor'\nimport { useTranslation } from 'react-i18next'\nimport { useContractors } from './useContractorList'\nimport { ActionsLayout, DataView, EmptyData, Flex, Grid, useDataView } from '@/components/Common'\nimport { firstLastName } from '@/helpers/formattedStrings'\nimport { HamburgerMenu } from '@/components/Common/HamburgerMenu/HamburgerMenu'\nimport PencilSvg from '@/assets/icons/pencil.svg?react'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { ContractorOnboardingStatusBadge } from '@/components/Common/OnboardingStatusBadge'\nimport { useI18n } from '@/i18n'\n\nexport type ContractorListDisplay = Pick<\n Contractor,\n 'onboardingStatus' | 'firstName' | 'lastName' | 'onboarded'\n>\n\nexport interface HeadProps {\n count: number\n handleAdd: () => void\n}\nexport function Head({ count, handleAdd }: HeadProps) {\n const { Button, Heading } = useComponentContext()\n const { t } = useTranslation('Contractor.ContractorList')\n\n return (\n <Flex alignItems=\"center\" justifyContent=\"space-between\">\n <Heading as=\"h2\">{t('title')}</Heading>\n\n {count !== 0 && (\n <Button variant=\"secondary\" onClick={handleAdd}>\n {t('addAnotherCTA')}\n </Button>\n )}\n </Flex>\n )\n}\n\nexport interface EmptyDataContractorsListProps {\n handleAdd: () => void\n}\nexport function EmptyDataContractorsList({ handleAdd }: EmptyDataContractorsListProps) {\n const { Button } = useComponentContext()\n const { t } = useTranslation('Contractor.ContractorList')\n\n return (\n <EmptyData title={t('emptyTableTitle')} description={t('emptyTableDescription')}>\n <ActionsLayout justifyContent=\"center\">\n <Button onClick={handleAdd}>{t('addContractorCTA')}</Button>\n </ActionsLayout>\n </EmptyData>\n )\n}\n\nexport interface ContractorListProps {\n contractors: ContractorListDisplay[]\n handleAdd: () => void\n handleEdit: () => void\n totalCount: number\n}\n\nexport function ContractorList({\n contractors,\n handleAdd,\n handleEdit,\n totalCount,\n}: ContractorListProps) {\n useI18n('Contractor.ContractorList')\n const { t } = useTranslation('Contractor.ContractorList')\n\n const dataViewProps = useDataView<ContractorListDisplay>({\n columns: [\n {\n title: t('listHeaders.name'),\n render: contractor =>\n firstLastName({ first_name: contractor.firstName, last_name: contractor.lastName }),\n },\n {\n title: t('listHeaders.status'),\n render: ({ onboarded, onboardingStatus }) => (\n <ContractorOnboardingStatusBadge\n onboarded={onboarded}\n onboardingStatus={onboardingStatus}\n />\n ),\n },\n ],\n data: contractors,\n itemMenu: () => (\n <HamburgerMenu\n items={[{ label: t('editCTA'), icon: <PencilSvg aria-hidden />, onClick: handleEdit }]}\n triggerLabel={t('editCTA')}\n isLoading={false}\n />\n ),\n emptyState: () => <EmptyDataContractorsList handleAdd={handleAdd} />,\n })\n\n return (\n <Grid gap={20}>\n <Head count={totalCount} handleAdd={handleAdd} />\n <DataView label={t('contractorListLabel')} {...dataViewProps} />\n </Grid>\n )\n}\n\nexport interface ContractorListWithApiProps {\n companyId: string\n handleAdd: () => void\n handleEdit: () => void\n}\n\nexport function ContractorListWithApi({\n companyId,\n handleAdd,\n handleEdit,\n}: ContractorListWithApiProps) {\n const contractorProps = useContractors({ companyUuid: companyId, handleAdd })\n\n return <ContractorList handleEdit={handleEdit} {...contractorProps} />\n}\n"],"names":["Head","count","handleAdd","Button","Heading","useComponentContext","t","useTranslation","jsxs","Flex","jsx","EmptyDataContractorsList","EmptyData","ActionsLayout","ContractorList","contractors","handleEdit","totalCount","useI18n","dataViewProps","useDataView","contractor","firstLastName","onboarded","onboardingStatus","ContractorOnboardingStatusBadge","HamburgerMenu","PencilSvg","Grid","DataView","ContractorListWithApi","companyId","contractorProps","useContractors"],"mappings":";;;;;;;;;;;;;;;AAoBO,SAASA,EAAK,EAAE,OAAAC,GAAO,WAAAC,KAAwB;AACpD,QAAM,EAAE,QAAAC,GAAQ,SAAAC,EAAQ,IAAIC,EAAoB,GAC1C,EAAE,GAAAC,EAAA,IAAMC,EAAe,2BAA2B;AAExD,SACG,gBAAAC,EAAAC,GAAA,EAAK,YAAW,UAAS,gBAAe,iBACvC,UAAA;AAAA,IAAA,gBAAAC,EAACN,GAAQ,EAAA,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AAE,OAAOpB,EAAE,SAAS,GAAG,MAAM,gBAAAI,EAACiB,KAAU,eAAW,GAAA,CAAC,GAAI,SAASX,GAAY;AAAA,QACrF,cAAcV,EAAE,SAAS;AAAA,QACzB,WAAW;AAAA,MAAA;AAAA,IACb;AAAA,IAEF,YAAY,MAAO,gBAAAI,EAAAC,GAAA,EAAyB,WAAAT,EAAsB,CAAA;AAAA,EAAA,CACnE;AAGC,SAAA,gBAAAM,EAACoB,GAAK,EAAA,KAAK,IACT,UAAA;AAAA,IAAC,gBAAAlB,EAAAV,GAAA,EAAK,OAAOiB,GAAY,WAAAf,EAAsB,CAAA;AAAA,sBAC9C2B,GAAS,EAAA,OAAOvB,EAAE,qBAAqB,GAAI,GAAGa,EAAe,CAAA;AAAA,EAAA,GAChE;AAEJ;AAQO,SAASW,EAAsB;AAAA,EACpC,WAAAC;AAAA,EACA,WAAA7B;AAAA,EACA,YAAAc;AACF,GAA+B;AAC7B,QAAMgB,IAAkBC,EAAe,EAAE,aAAaF,GAAW,WAAA7B,GAAW;AAE5E,SAAQ,gBAAAQ,EAAAI,GAAA,EAAe,YAAAE,GAAyB,GAAGgB,EAAiB,CAAA;AACtE;"}
|
|
@@ -1,111 +1,110 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useTranslation as
|
|
3
|
-
import { useForm as
|
|
1
|
+
import { jsx as e, jsxs as c } from "react/jsx-runtime";
|
|
2
|
+
import { useTranslation as v } from "react-i18next";
|
|
3
|
+
import { useForm as S, useWatch as E, FormProvider as T } from "react-hook-form";
|
|
4
4
|
import { useMemo as O } from "react";
|
|
5
5
|
import r from "zod";
|
|
6
6
|
import { zodResolver as _ } from "@hookform/resolvers/zod";
|
|
7
|
-
import { useContractorsGetSuspense as
|
|
8
|
-
import { useContractorsUpdateMutation as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
const z = r.union([
|
|
7
|
+
import { useContractorsGetSuspense as y } from "@gusto/embedded-api/react-query/contractorsGet";
|
|
8
|
+
import { useContractorsUpdateMutation as D } from "@gusto/embedded-api/react-query/contractorsUpdate";
|
|
9
|
+
import { useComponentDictionary as F, useI18n as x } from "../../../i18n/I18n.js";
|
|
10
|
+
import { BaseComponent as g } from "../../Base/Base.js";
|
|
11
|
+
import { useBase as A } from "../../Base/useBase.js";
|
|
12
|
+
import { useComponentContext as B } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
13
|
+
import { Form as P } from "../../Common/Form/Form.js";
|
|
14
|
+
import { STATES_ABBR as j, componentEvents as u } from "../../../shared/constants.js";
|
|
15
|
+
import { ActionsLayout as L } from "../../Common/ActionsLayout/ActionsLayout.js";
|
|
16
|
+
import { Flex as M } from "../../Common/Flex/Flex.js";
|
|
17
|
+
import { RadioGroupField as U } from "../../Common/Fields/RadioGroupField/RadioGroupField.js";
|
|
18
|
+
import { SelectField as q } from "../../Common/Fields/SelectField/SelectField.js";
|
|
19
|
+
const W = r.union([
|
|
21
20
|
r.object({
|
|
22
|
-
fileNewHireReport: r.boolean().refine((
|
|
21
|
+
fileNewHireReport: r.boolean().refine((o) => o),
|
|
23
22
|
state: r.string().min(1)
|
|
24
23
|
}),
|
|
25
24
|
r.object({
|
|
26
|
-
fileNewHireReport: r.boolean().refine((
|
|
25
|
+
fileNewHireReport: r.boolean().refine((o) => !o)
|
|
27
26
|
})
|
|
28
27
|
]);
|
|
29
|
-
function
|
|
30
|
-
return /* @__PURE__ */
|
|
28
|
+
function ae(o) {
|
|
29
|
+
return /* @__PURE__ */ e(g, { ...o, children: /* @__PURE__ */ e(k, { ...o, children: o.children }) });
|
|
31
30
|
}
|
|
32
|
-
function
|
|
33
|
-
|
|
34
|
-
const { t
|
|
35
|
-
data: { contractor:
|
|
36
|
-
} =
|
|
31
|
+
function k({ contractorId: o, className: p, dictionary: d }) {
|
|
32
|
+
F("Contractor.NewHireReport", d), x("Contractor.NewHireReport");
|
|
33
|
+
const { t } = v("Contractor.NewHireReport"), { onEvent: m, baseSubmitHandler: f } = A(), s = B(), {
|
|
34
|
+
data: { contractor: R }
|
|
35
|
+
} = y({ contractorUuid: o }), n = R, { mutateAsync: h, isPending: H } = D(), w = O(
|
|
37
36
|
() => ({
|
|
38
|
-
fileNewHireReport:
|
|
39
|
-
state:
|
|
37
|
+
fileNewHireReport: n.fileNewHireReport || !1,
|
|
38
|
+
state: n.workState || null
|
|
40
39
|
}),
|
|
41
|
-
[
|
|
42
|
-
),
|
|
43
|
-
resolver: _(
|
|
44
|
-
defaultValues:
|
|
45
|
-
}), N =
|
|
46
|
-
await f(
|
|
47
|
-
const
|
|
40
|
+
[n]
|
|
41
|
+
), a = S({
|
|
42
|
+
resolver: _(W),
|
|
43
|
+
defaultValues: w
|
|
44
|
+
}), N = E({ control: a.control, name: "fileNewHireReport" }), b = async (i) => {
|
|
45
|
+
await f(i, async (l) => {
|
|
46
|
+
const C = await h({
|
|
48
47
|
request: {
|
|
49
|
-
contractorUuid:
|
|
48
|
+
contractorUuid: o,
|
|
50
49
|
requestBody: {
|
|
51
50
|
fileNewHireReport: l.fileNewHireReport,
|
|
52
51
|
workState: "state" in l ? l.state : null,
|
|
53
|
-
version:
|
|
52
|
+
version: n.version
|
|
54
53
|
}
|
|
55
54
|
}
|
|
56
55
|
});
|
|
57
|
-
|
|
56
|
+
m(u.CONTRACTOR_NEW_HIRE_REPORT_UPDATED, C), m(u.CONTRACTOR_NEW_HIRE_REPORT_DONE);
|
|
58
57
|
});
|
|
59
58
|
};
|
|
60
|
-
return /* @__PURE__ */
|
|
59
|
+
return /* @__PURE__ */ e("section", { className: p, children: /* @__PURE__ */ e(T, { ...a, children: /* @__PURE__ */ e(P, { onSubmit: a.handleSubmit(b), children: /* @__PURE__ */ c(M, { flexDirection: "column", children: [
|
|
61
60
|
/* @__PURE__ */ c("header", { children: [
|
|
62
|
-
/* @__PURE__ */
|
|
63
|
-
/* @__PURE__ */
|
|
61
|
+
/* @__PURE__ */ e(s.Heading, { as: "h2", children: t("title") }),
|
|
62
|
+
/* @__PURE__ */ e(s.Text, { children: t("description") })
|
|
64
63
|
] }),
|
|
65
|
-
/* @__PURE__ */
|
|
66
|
-
|
|
64
|
+
/* @__PURE__ */ e(
|
|
65
|
+
U,
|
|
67
66
|
{
|
|
68
67
|
name: "fileNewHireReport",
|
|
69
|
-
label:
|
|
68
|
+
label: t("doFileLegend"),
|
|
70
69
|
shouldVisuallyHideLabel: !0,
|
|
71
70
|
options: [
|
|
72
71
|
{
|
|
73
72
|
value: !0,
|
|
74
|
-
label:
|
|
73
|
+
label: t("yesOption")
|
|
75
74
|
},
|
|
76
75
|
{
|
|
77
76
|
value: !1,
|
|
78
|
-
label:
|
|
77
|
+
label: t("noOption")
|
|
79
78
|
}
|
|
80
79
|
]
|
|
81
80
|
}
|
|
82
81
|
),
|
|
83
|
-
N && /* @__PURE__ */
|
|
84
|
-
|
|
82
|
+
N && /* @__PURE__ */ e(
|
|
83
|
+
q,
|
|
85
84
|
{
|
|
86
85
|
name: "state",
|
|
87
|
-
options:
|
|
88
|
-
label:
|
|
89
|
-
value:
|
|
86
|
+
options: j.map((i) => ({
|
|
87
|
+
label: t(`statesHash.${i}`, { ns: "common" }),
|
|
88
|
+
value: i
|
|
90
89
|
})),
|
|
91
|
-
label:
|
|
90
|
+
label: t("stateSelectionLabel"),
|
|
92
91
|
placeholder: "",
|
|
93
|
-
errorMessage:
|
|
92
|
+
errorMessage: t("validations.state"),
|
|
94
93
|
isRequired: !0
|
|
95
94
|
}
|
|
96
95
|
),
|
|
97
|
-
/* @__PURE__ */
|
|
98
|
-
|
|
96
|
+
/* @__PURE__ */ e(L, { children: /* @__PURE__ */ e(
|
|
97
|
+
s.Button,
|
|
99
98
|
{
|
|
100
99
|
type: "submit",
|
|
101
100
|
variant: "primary",
|
|
102
|
-
isDisabled:
|
|
103
|
-
children:
|
|
101
|
+
isDisabled: H,
|
|
102
|
+
children: t("submitCta")
|
|
104
103
|
}
|
|
105
104
|
) })
|
|
106
105
|
] }) }) }) });
|
|
107
106
|
}
|
|
108
107
|
export {
|
|
109
|
-
|
|
108
|
+
ae as NewHireReport
|
|
110
109
|
};
|
|
111
110
|
//# sourceMappingURL=NewHireReport.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NewHireReport.js","sources":["../../../../src/components/Contractor/NewHireReport/NewHireReport.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport type { SubmitHandler } from 'react-hook-form'\nimport { FormProvider, useForm, useWatch } from 'react-hook-form'\nimport { useMemo } from 'react'\nimport z from 'zod'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport {
|
|
1
|
+
{"version":3,"file":"NewHireReport.js","sources":["../../../../src/components/Contractor/NewHireReport/NewHireReport.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport type { SubmitHandler } from 'react-hook-form'\nimport { FormProvider, useForm, useWatch } from 'react-hook-form'\nimport { useMemo } from 'react'\nimport z from 'zod'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { useContractorsGetSuspense } from '@gusto/embedded-api/react-query/contractorsGet'\nimport { useContractorsUpdateMutation } from '@gusto/embedded-api/react-query/contractorsUpdate'\nimport type { NewHireReportProps } from './types'\nimport { useI18n } from '@/i18n'\nimport { BaseComponent, useBase } from '@/components/Base'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { Form } from '@/components/Common/Form'\nimport { useComponentDictionary } from '@/i18n/I18n'\nimport { componentEvents, STATES_ABBR } from '@/shared/constants'\nimport { ActionsLayout } from '@/components/Common/ActionsLayout'\nimport { Flex, RadioGroupField, SelectField } from '@/components/Common'\n\nconst NewHireReportSchema = z.union([\n z.object({\n fileNewHireReport: z.boolean().refine(v => v),\n state: z.string().min(1),\n }),\n z.object({\n fileNewHireReport: z.boolean().refine(v => !v),\n }),\n])\n\nexport type NewHireReportSchemaInputs = z.input<typeof NewHireReportSchema>\n\nexport function NewHireReport(props: NewHireReportProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ contractorId, className, dictionary }: NewHireReportProps) {\n useComponentDictionary('Contractor.NewHireReport', dictionary)\n useI18n('Contractor.NewHireReport')\n const { t } = useTranslation('Contractor.NewHireReport')\n const { onEvent, baseSubmitHandler } = useBase()\n const Components = useComponentContext()\n\n const {\n data: { contractor },\n } = useContractorsGetSuspense({ contractorUuid: contractorId })\n const contractorDetails = contractor!\n\n const { mutateAsync: updateContractor, isPending: updateContractorPending } =\n useContractorsUpdateMutation()\n\n const defaultValues = useMemo(\n () => ({\n fileNewHireReport: contractorDetails.fileNewHireReport || false,\n state: contractorDetails.workState || null,\n }),\n [contractorDetails],\n )\n\n const formMethods = useForm({\n resolver: zodResolver(NewHireReportSchema),\n defaultValues: defaultValues,\n })\n\n const watchedDoFile = useWatch({ control: formMethods.control, name: 'fileNewHireReport' })\n const onSubmit: SubmitHandler<NewHireReportSchemaInputs> = async data => {\n await baseSubmitHandler(data, async payload => {\n const contractorResponse = await updateContractor({\n request: {\n contractorUuid: contractorId,\n requestBody: {\n fileNewHireReport: payload.fileNewHireReport,\n workState: 'state' in payload ? payload.state : null,\n version: contractorDetails.version!,\n },\n },\n })\n onEvent(componentEvents.CONTRACTOR_NEW_HIRE_REPORT_UPDATED, contractorResponse)\n onEvent(componentEvents.CONTRACTOR_NEW_HIRE_REPORT_DONE)\n })\n }\n\n return (\n <section className={className}>\n <FormProvider {...formMethods}>\n <Form onSubmit={formMethods.handleSubmit(onSubmit)}>\n <Flex flexDirection={'column'}>\n <header>\n <Components.Heading as=\"h2\">{t('title')}</Components.Heading>\n <Components.Text>{t('description')}</Components.Text>\n </header>\n <RadioGroupField\n name=\"fileNewHireReport\"\n label={t('doFileLegend')}\n shouldVisuallyHideLabel\n options={[\n {\n value: true,\n label: t('yesOption'),\n },\n {\n value: false,\n label: t('noOption'),\n },\n ]}\n />\n {watchedDoFile && (\n <SelectField\n name=\"state\"\n options={STATES_ABBR.map((stateAbbr: (typeof STATES_ABBR)[number]) => ({\n label: t(`statesHash.${stateAbbr}`, { ns: 'common' }),\n value: stateAbbr,\n }))}\n label={t('stateSelectionLabel')}\n placeholder={''}\n errorMessage={t('validations.state')}\n isRequired\n />\n )}\n <ActionsLayout>\n <Components.Button\n type=\"submit\"\n variant=\"primary\"\n isDisabled={updateContractorPending}\n >\n {t('submitCta')}\n </Components.Button>\n </ActionsLayout>\n </Flex>\n </Form>\n </FormProvider>\n </section>\n )\n}\n"],"names":["NewHireReportSchema","z","v","NewHireReport","props","jsx","BaseComponent","Root","contractorId","className","dictionary","useComponentDictionary","useI18n","useTranslation","onEvent","baseSubmitHandler","useBase","Components","useComponentContext","contractor","useContractorsGetSuspense","contractorDetails","updateContractor","updateContractorPending","useContractorsUpdateMutation","defaultValues","useMemo","formMethods","useForm","zodResolver","watchedDoFile","useWatch","onSubmit","data","payload","contractorResponse","componentEvents","FormProvider","Form","jsxs","Flex","RadioGroupField","SelectField","STATES_ABBR","stateAbbr","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,MAAMA,IAAsBC,EAAE,MAAM;AAAA,EAClCA,EAAE,OAAO;AAAA,IACP,mBAAmBA,EAAE,QAAA,EAAU,OAAO,OAAKC,CAAC;AAAA,IAC5C,OAAOD,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EAAA,CACxB;AAAA,EACDA,EAAE,OAAO;AAAA,IACP,mBAAmBA,EAAE,QAAA,EAAU,OAAO,CAAAC,MAAK,CAACA,CAAC;AAAA,EAC9C,CAAA;AACH,CAAC;AAIM,SAASC,GAAcC,GAA2B;AAErD,SAAA,gBAAAC,EAACC,GAAe,EAAA,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAMA,EAAA,SAAA,C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+1,134 @@
|
|
|
1
|
-
import { jsx as s, jsxs as
|
|
2
|
-
import { zodResolver as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { useForm as
|
|
5
|
-
import { useTranslation as
|
|
6
|
-
import { useJobsAndCompensationsGetJobsSuspense as
|
|
7
|
-
import { useJobsAndCompensationsCreateJobMutation as
|
|
8
|
-
import { useJobsAndCompensationsUpdateMutation as
|
|
9
|
-
import { useJobsAndCompensationsDeleteMutation as
|
|
10
|
-
import { useJobsAndCompensationsUpdateCompensationMutation as
|
|
11
|
-
import { useLocationsGetMinimumWagesSuspense as
|
|
12
|
-
import { useEmployeeAddressesGetWorkAddressesSuspense as
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return We("Employee.Compensation", e.dictionary), /* @__PURE__ */ s(Ne, { ...e, children: /* @__PURE__ */ s(Je, { ...e, children: e.children }) });
|
|
1
|
+
import { jsx as s, jsxs as re, Fragment as ie } from "react/jsx-runtime";
|
|
2
|
+
import { zodResolver as me } from "@hookform/resolvers/zod";
|
|
3
|
+
import { useState as W, useMemo as F, useEffect as ue } from "react";
|
|
4
|
+
import { useForm as de, FormProvider as le } from "react-hook-form";
|
|
5
|
+
import { useTranslation as ce } from "react-i18next";
|
|
6
|
+
import { useJobsAndCompensationsGetJobsSuspense as pe } from "@gusto/embedded-api/react-query/jobsAndCompensationsGetJobs";
|
|
7
|
+
import { useJobsAndCompensationsCreateJobMutation as fe } from "@gusto/embedded-api/react-query/jobsAndCompensationsCreateJob";
|
|
8
|
+
import { useJobsAndCompensationsUpdateMutation as Ee } from "@gusto/embedded-api/react-query/jobsAndCompensationsUpdate";
|
|
9
|
+
import { useJobsAndCompensationsDeleteMutation as Ce } from "@gusto/embedded-api/react-query/jobsAndCompensationsDelete";
|
|
10
|
+
import { useJobsAndCompensationsUpdateCompensationMutation as he } from "@gusto/embedded-api/react-query/jobsAndCompensationsUpdateCompensation";
|
|
11
|
+
import { useLocationsGetMinimumWagesSuspense as Ae } from "@gusto/embedded-api/react-query/locationsGetMinimumWages";
|
|
12
|
+
import { useEmployeeAddressesGetWorkAddressesSuspense as De } from "@gusto/embedded-api/react-query/employeeAddressesGetWorkAddresses";
|
|
13
|
+
import { useFederalTaxDetailsGetSuspense as Oe } from "@gusto/embedded-api/react-query/federalTaxDetailsGet";
|
|
14
|
+
import { useEmployeesGetSuspense as Se } from "@gusto/embedded-api/react-query/employeesGet";
|
|
15
|
+
import { List as j } from "./List.js";
|
|
16
|
+
import { Head as V } from "./Head.js";
|
|
17
|
+
import { Edit as Y } from "./Edit.js";
|
|
18
|
+
import { Actions as k } from "./Actions.js";
|
|
19
|
+
import { CompensationSchema as ye, CompensationProvider as Ie } from "./useCompensation.js";
|
|
20
|
+
import { Form as Te } from "../../Common/Form/Form.js";
|
|
21
|
+
import { FlsaStatus as h, componentEvents as E } from "../../../shared/constants.js";
|
|
22
|
+
import { useComponentDictionary as be, useI18n as Me } from "../../../i18n/I18n.js";
|
|
23
|
+
import { BaseComponent as Pe } from "../../Base/Base.js";
|
|
24
|
+
import { useBase as We } from "../../Base/useBase.js";
|
|
25
|
+
import { useFlow as ge } from "../../Flow/useFlow.js";
|
|
26
|
+
function A(t) {
|
|
27
|
+
return be("Employee.Compensation", t.dictionary), /* @__PURE__ */ s(Pe, { ...t, children: /* @__PURE__ */ s(Ne, { ...t, children: t.children }) });
|
|
29
28
|
}
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
const { baseSubmitHandler:
|
|
33
|
-
data: { minimumWageList:
|
|
34
|
-
} =
|
|
35
|
-
locationUuid:
|
|
36
|
-
}),
|
|
37
|
-
data: { employee:
|
|
38
|
-
} =
|
|
39
|
-
if (!
|
|
29
|
+
const B = (t) => t?.compensations?.find((l) => l.uuid === t.currentCompensationUuid), Ne = ({ employeeId: t, startDate: l, className: D, children: O, ...m }) => {
|
|
30
|
+
Me("Employee.Compensation");
|
|
31
|
+
const { baseSubmitHandler: x, onEvent: c } = We(), { data: q } = pe({ employeeId: t }), n = q.jobList, { data: G } = De({ employeeId: t }), g = G.employeeWorkAddressesList.find((e) => e.active), {
|
|
32
|
+
data: { minimumWageList: R }
|
|
33
|
+
} = Ae({
|
|
34
|
+
locationUuid: g.locationUuid
|
|
35
|
+
}), H = R, {
|
|
36
|
+
data: { employee: N }
|
|
37
|
+
} = Se({ employeeId: t });
|
|
38
|
+
if (!N)
|
|
40
39
|
throw new Error("Employee not found");
|
|
41
|
-
const { data:
|
|
42
|
-
onSettled: () => T(O, [e])
|
|
43
|
-
}), v = Ee({
|
|
44
|
-
onSettled: () => T(O, [e])
|
|
45
|
-
}), w = Se({
|
|
46
|
-
onSettled: () => T(O, [e])
|
|
47
|
-
}), U = he({
|
|
48
|
-
onSettled: () => T(O, [e])
|
|
49
|
-
}), [o, y] = N(
|
|
40
|
+
const { data: X } = Oe({ companyId: N.companyUuid }), z = X.federalTaxDetails.taxPayerType === "S-Corporation", _ = he(), L = fe(), J = Ee(), w = Ce(), [o, S] = W(
|
|
50
41
|
n.length === 1 ? n[0] ?? null : null
|
|
51
|
-
), [I,
|
|
42
|
+
), [I, p] = W(() => {
|
|
52
43
|
if (!n.length)
|
|
53
44
|
return "ADD_INITIAL_JOB";
|
|
54
|
-
const
|
|
55
|
-
return n.length === 1 &&
|
|
56
|
-
}), [
|
|
57
|
-
const
|
|
58
|
-
(
|
|
45
|
+
const e = B(n[0]);
|
|
46
|
+
return n.length === 1 && e?.flsaStatus !== h.NONEXEMPT ? "EDIT_INITIAL_JOB" : "LIST";
|
|
47
|
+
}), [K, v] = W(!1), a = B(o), T = F(() => n.reduce((e, r) => {
|
|
48
|
+
const u = r.compensations?.find(
|
|
49
|
+
(y) => y.uuid === r.currentCompensationUuid
|
|
59
50
|
);
|
|
60
|
-
return !r.primary || !
|
|
61
|
-
}, void 0), [n]),
|
|
62
|
-
jobTitle: o?.title && o.title !== "" ? o.title :
|
|
63
|
-
flsaStatus: a?.flsaStatus ??
|
|
64
|
-
rate: Number(a?.rate ??
|
|
51
|
+
return !r.primary || !u ? e : u.flsaStatus ?? e;
|
|
52
|
+
}, void 0), [n]), f = F(() => ({
|
|
53
|
+
jobTitle: o?.title && o.title !== "" ? o.title : m.defaultValues?.title ?? "",
|
|
54
|
+
flsaStatus: a?.flsaStatus ?? T ?? m.defaultValues?.flsaStatus,
|
|
55
|
+
rate: Number(a?.rate ?? m.defaultValues?.rate ?? 0),
|
|
65
56
|
adjustForMinimumWage: a?.adjustForMinimumWage ?? !1,
|
|
66
57
|
minimumWageId: a?.minimumWages?.[0]?.uuid ?? "",
|
|
67
|
-
paymentUnit: a?.paymentUnit ??
|
|
58
|
+
paymentUnit: a?.paymentUnit ?? m.defaultValues?.paymentUnit ?? "Hour",
|
|
68
59
|
stateWcCovered: o?.stateWcCovered ?? !1,
|
|
69
60
|
stateWcClassCode: o?.stateWcClassCode ?? ""
|
|
70
|
-
}), [o, a,
|
|
71
|
-
resolver:
|
|
72
|
-
defaultValues:
|
|
73
|
-
}), { resetField:
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}, [o,
|
|
77
|
-
const
|
|
78
|
-
if (I === "LIST" &&
|
|
79
|
-
c(
|
|
61
|
+
}), [o, a, T, m.defaultValues]), U = de({
|
|
62
|
+
resolver: me(ye),
|
|
63
|
+
defaultValues: f
|
|
64
|
+
}), { resetField: b, setValue: M, handleSubmit: Q, reset: C } = U;
|
|
65
|
+
ue(() => {
|
|
66
|
+
C(f);
|
|
67
|
+
}, [o, f, C]);
|
|
68
|
+
const Z = async (e) => {
|
|
69
|
+
if (I === "LIST" && e === "PROCEED") {
|
|
70
|
+
c(E.EMPLOYEE_COMPENSATION_DONE);
|
|
80
71
|
return;
|
|
81
72
|
}
|
|
82
73
|
if (!o && I === "LIST") {
|
|
83
|
-
|
|
74
|
+
p("ADD_ADDITIONAL_JOB");
|
|
84
75
|
return;
|
|
85
76
|
}
|
|
86
|
-
await
|
|
87
|
-
switch (await
|
|
77
|
+
await Q(async (r) => {
|
|
78
|
+
switch (await se(r), e) {
|
|
88
79
|
case "LIST":
|
|
89
|
-
|
|
80
|
+
p("LIST"), S(null), C(f);
|
|
90
81
|
break;
|
|
91
82
|
default:
|
|
92
|
-
c(
|
|
83
|
+
c(E.EMPLOYEE_COMPENSATION_DONE);
|
|
93
84
|
}
|
|
94
85
|
})();
|
|
95
|
-
},
|
|
96
|
-
|
|
97
|
-
},
|
|
98
|
-
n.length > 0 ?
|
|
99
|
-
},
|
|
100
|
-
const r = n.find((
|
|
101
|
-
r && (
|
|
102
|
-
},
|
|
103
|
-
await
|
|
104
|
-
},
|
|
105
|
-
a?.flsaStatus ===
|
|
106
|
-
},
|
|
107
|
-
await
|
|
108
|
-
const { jobTitle:
|
|
86
|
+
}, $ = () => {
|
|
87
|
+
p("ADD_ADDITIONAL_JOB"), S(null), C(f);
|
|
88
|
+
}, ee = () => {
|
|
89
|
+
n.length > 0 ? p("LIST") : p("ADD_INITIAL_JOB"), S(null), C(f);
|
|
90
|
+
}, te = (e) => {
|
|
91
|
+
const r = n.find((u) => e === u.uuid);
|
|
92
|
+
r && (p("EDIT_ADDITIONAL_JOB"), S(r));
|
|
93
|
+
}, oe = async (e) => {
|
|
94
|
+
await w.mutateAsync({ request: { jobId: e } }), c(E.EMPLOYEE_JOB_DELETED);
|
|
95
|
+
}, ne = (e) => {
|
|
96
|
+
a?.flsaStatus === h.NONEXEMPT && n.length > 1 && v(!0), e === h.OWNER ? (M("paymentUnit", "Paycheck"), b("rate", { defaultValue: Number(a?.rate) })) : e === h.COMMISSION_ONLY_NONEXEMPT || e === h.COMMISSION_ONLY_EXEMPT ? (M("paymentUnit", "Year"), M("rate", 0)) : (b("paymentUnit", { defaultValue: a?.paymentUnit }), b("rate", { defaultValue: Number(a?.rate) }));
|
|
97
|
+
}, se = async (e) => {
|
|
98
|
+
await x(e, async (r) => {
|
|
99
|
+
const { jobTitle: u, twoPercentShareholder: y, ...i } = r;
|
|
109
100
|
let d;
|
|
110
|
-
o ? (d = (await
|
|
101
|
+
o ? (d = (await J.mutateAsync({
|
|
111
102
|
request: {
|
|
112
103
|
jobId: o.uuid,
|
|
113
104
|
requestBody: {
|
|
114
|
-
title:
|
|
105
|
+
title: u,
|
|
115
106
|
version: o.version,
|
|
116
107
|
hireDate: l,
|
|
117
108
|
stateWcClassCode: i.stateWcCovered ? i.stateWcClassCode : null,
|
|
118
109
|
stateWcCovered: i.stateWcCovered,
|
|
119
|
-
twoPercentShareholder:
|
|
110
|
+
twoPercentShareholder: y ?? !1
|
|
120
111
|
}
|
|
121
112
|
}
|
|
122
|
-
})).job, c(
|
|
113
|
+
})).job, c(E.EMPLOYEE_JOB_UPDATED, d)) : (d = (await L.mutateAsync({
|
|
123
114
|
request: {
|
|
124
|
-
employeeId:
|
|
115
|
+
employeeId: t,
|
|
125
116
|
requestBody: {
|
|
126
|
-
title:
|
|
117
|
+
title: u,
|
|
127
118
|
hireDate: l,
|
|
128
119
|
stateWcCovered: i.stateWcCovered,
|
|
129
120
|
stateWcClassCode: i.stateWcCovered ? i.stateWcClassCode : null,
|
|
130
|
-
twoPercentShareholder:
|
|
121
|
+
twoPercentShareholder: y ?? !1
|
|
131
122
|
}
|
|
132
123
|
}
|
|
133
|
-
})).job, c(
|
|
134
|
-
const { compensation:
|
|
124
|
+
})).job, c(E.EMPLOYEE_JOB_CREATED, d));
|
|
125
|
+
const { compensation: ae } = await _.mutateAsync({
|
|
135
126
|
request: {
|
|
136
127
|
compensationId: d.currentCompensationUuid,
|
|
137
128
|
requestBody: {
|
|
138
129
|
// eslint-disable-next-line @typescript-eslint/no-non-null-asserted-optional-chain
|
|
139
130
|
version: d.compensations?.find(
|
|
140
|
-
(
|
|
131
|
+
(P) => P.uuid === d.currentCompensationUuid
|
|
141
132
|
)?.version,
|
|
142
133
|
...i,
|
|
143
134
|
rate: String(i.rate),
|
|
@@ -145,64 +136,64 @@ const V = (e) => e?.compensations?.find((l) => l.uuid === e.currentCompensationU
|
|
|
145
136
|
}
|
|
146
137
|
}
|
|
147
138
|
});
|
|
148
|
-
|
|
139
|
+
v(!1), c(E.EMPLOYEE_COMPENSATION_UPDATED, ae);
|
|
149
140
|
});
|
|
150
141
|
};
|
|
151
|
-
return /* @__PURE__ */ s("section", { className:
|
|
152
|
-
|
|
142
|
+
return /* @__PURE__ */ s("section", { className: D, children: /* @__PURE__ */ s(
|
|
143
|
+
Ie,
|
|
153
144
|
{
|
|
154
145
|
value: {
|
|
155
146
|
employeeJobs: n,
|
|
156
147
|
currentJob: o,
|
|
157
|
-
primaryFlsaStatus:
|
|
158
|
-
showFlsaChangeWarning:
|
|
148
|
+
primaryFlsaStatus: T,
|
|
149
|
+
showFlsaChangeWarning: K,
|
|
159
150
|
mode: I,
|
|
160
|
-
minimumWages:
|
|
161
|
-
handleFlsaChange:
|
|
162
|
-
handleDelete:
|
|
163
|
-
handleEdit:
|
|
164
|
-
handleAdd:
|
|
165
|
-
submitWithEffect:
|
|
166
|
-
handleCancelAddJob:
|
|
167
|
-
isPending:
|
|
168
|
-
state:
|
|
169
|
-
showTwoPercentStakeholder:
|
|
151
|
+
minimumWages: H,
|
|
152
|
+
handleFlsaChange: ne,
|
|
153
|
+
handleDelete: oe,
|
|
154
|
+
handleEdit: te,
|
|
155
|
+
handleAdd: $,
|
|
156
|
+
submitWithEffect: Z,
|
|
157
|
+
handleCancelAddJob: ee,
|
|
158
|
+
isPending: _.isPending || L.isPending || J.isPending || w.isPending,
|
|
159
|
+
state: g.state,
|
|
160
|
+
showTwoPercentStakeholder: z
|
|
170
161
|
},
|
|
171
|
-
children: /* @__PURE__ */ s(
|
|
172
|
-
/* @__PURE__ */ s(
|
|
162
|
+
children: /* @__PURE__ */ s(le, { ...U, children: /* @__PURE__ */ s(Te, { children: O || /* @__PURE__ */ re(ie, { children: [
|
|
163
|
+
/* @__PURE__ */ s(V, {}),
|
|
164
|
+
/* @__PURE__ */ s(j, {}),
|
|
173
165
|
/* @__PURE__ */ s(Y, {}),
|
|
174
|
-
/* @__PURE__ */ s(
|
|
175
|
-
/* @__PURE__ */ s(x, {})
|
|
166
|
+
/* @__PURE__ */ s(k, {})
|
|
176
167
|
] }) }) })
|
|
177
168
|
}
|
|
178
169
|
) });
|
|
179
170
|
};
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
const
|
|
185
|
-
const { employeeId:
|
|
186
|
-
if (!
|
|
171
|
+
A.Head = V;
|
|
172
|
+
A.List = j;
|
|
173
|
+
A.Actions = k;
|
|
174
|
+
A.Edit = Y;
|
|
175
|
+
const nt = () => {
|
|
176
|
+
const { employeeId: t, onEvent: l, startDate: D, defaultValues: O } = ge(), { t: m } = ce("common");
|
|
177
|
+
if (!t || !D)
|
|
187
178
|
throw new Error(
|
|
188
|
-
|
|
179
|
+
m("errors.missingParamsOrContext", {
|
|
189
180
|
component: "Compensation",
|
|
190
|
-
param:
|
|
181
|
+
param: t ? "startDate" : "employeeId",
|
|
191
182
|
provider: "FlowProvider"
|
|
192
183
|
})
|
|
193
184
|
);
|
|
194
185
|
return /* @__PURE__ */ s(
|
|
195
|
-
|
|
186
|
+
A,
|
|
196
187
|
{
|
|
197
|
-
employeeId:
|
|
198
|
-
startDate:
|
|
188
|
+
employeeId: t,
|
|
189
|
+
startDate: D,
|
|
199
190
|
onEvent: l,
|
|
200
|
-
defaultValues:
|
|
191
|
+
defaultValues: O?.compensation
|
|
201
192
|
}
|
|
202
193
|
);
|
|
203
194
|
};
|
|
204
195
|
export {
|
|
205
|
-
|
|
206
|
-
|
|
196
|
+
A as Compensation,
|
|
197
|
+
nt as CompensationContextual
|
|
207
198
|
};
|
|
208
199
|
//# sourceMappingURL=Compensation.js.map
|