@gusto/embedded-react-sdk 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +82 -2
- package/dist/components/Common/OnboardingStatusBadge/index.d.ts +21 -0
- package/dist/components/Common/OnboardingStatusBadge/index.js +17 -0
- package/dist/components/Common/OnboardingStatusBadge/index.js.map +1 -0
- package/dist/components/Common/SignatureForm/SignatureFormActions.js +8 -7
- package/dist/components/Common/SignatureForm/SignatureFormActions.js.map +1 -1
- package/dist/components/Common/SignatureForm/SignatureFormFields.js +5 -4
- package/dist/components/Common/SignatureForm/SignatureFormFields.js.map +1 -1
- package/dist/components/Common/TaxInputs/TaxInputs.js +42 -36
- package/dist/components/Common/TaxInputs/TaxInputs.js.map +1 -1
- package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js +7 -6
- package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js +9 -8
- package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js +7 -6
- package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/Actions.js +3 -2
- package/dist/components/Company/BankAccount/BankAccountForm/Actions.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountList/Actions.js +7 -6
- package/dist/components/Company/BankAccount/BankAccountList/Actions.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js +8 -7
- package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/Actions.js +6 -5
- package/dist/components/Company/DocumentSigner/DocumentList/Actions.js.map +1 -1
- package/dist/components/Company/FederalTaxes/Actions.js +7 -6
- package/dist/components/Company/FederalTaxes/Actions.js.map +1 -1
- package/dist/components/Company/Industry/Actions.js +6 -5
- package/dist/components/Company/Industry/Actions.js.map +1 -1
- package/dist/components/Company/Industry/Edit.js +11 -10
- package/dist/components/Company/Industry/Edit.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/Actions.js +3 -2
- package/dist/components/Company/Locations/LocationForm/Actions.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/Actions.js +3 -2
- package/dist/components/Company/Locations/LocationsList/Actions.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/List.js +7 -6
- package/dist/components/Company/Locations/LocationsList/List.js.map +1 -1
- package/dist/components/Company/PaySchedule/_parts/Actions.js +11 -10
- package/dist/components/Company/PaySchedule/_parts/Actions.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js +6 -5
- package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js +7 -6
- package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/List.js +6 -5
- package/dist/components/Company/StateTaxes/StateTaxesList/List.js.map +1 -1
- package/dist/components/Contractor/Address/Form.js +4 -4
- package/dist/components/Contractor/List/index.d.ts +25 -0
- package/dist/components/Contractor/List/index.js +84 -0
- package/dist/components/Contractor/List/index.js.map +1 -0
- package/dist/components/Contractor/List/useContractorList.d.ts +20 -0
- package/dist/components/Contractor/List/useContractorList.js +31 -0
- package/dist/components/Contractor/List/useContractorList.js.map +1 -0
- package/dist/components/Contractor/PaymentMethod/BankAccountForm.d.ts +2 -0
- package/dist/components/Contractor/PaymentMethod/BankAccountForm.js +53 -0
- package/dist/components/Contractor/PaymentMethod/BankAccountForm.js.map +1 -0
- package/dist/components/Contractor/PaymentMethod/PaymentMethod.d.ts +31 -0
- package/dist/components/Contractor/PaymentMethod/PaymentMethod.js +108 -0
- package/dist/components/Contractor/PaymentMethod/PaymentMethod.js.map +1 -0
- package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.d.ts +11 -0
- package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js +35 -0
- package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js.map +1 -0
- package/dist/components/Contractor/PaymentMethod/types.d.ts +8 -0
- package/dist/components/Contractor/index.d.ts +2 -0
- package/dist/components/Contractor/index.js +6 -2
- package/dist/components/Contractor/index.js.map +1 -1
- package/dist/components/Employee/Compensation/Actions.js +1 -1
- package/dist/components/Employee/Compensation/Edit.js +59 -56
- package/dist/components/Employee/Compensation/Edit.js.map +1 -1
- package/dist/components/Employee/Compensation/List.js +6 -5
- package/dist/components/Employee/Compensation/List.js.map +1 -1
- package/dist/components/Employee/Compensation/useCompensation.d.ts +2 -0
- package/dist/components/Employee/Compensation/useCompensation.js +16 -14
- package/dist/components/Employee/Compensation/useCompensation.js.map +1 -1
- package/dist/components/Employee/Deductions/Actions.js +9 -8
- package/dist/components/Employee/Deductions/Actions.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionForm.js +14 -5
- package/dist/components/Employee/Deductions/DeductionForm.js.map +1 -1
- package/dist/components/Employee/Deductions/Deductions.js +25 -25
- package/dist/components/Employee/Deductions/Deductions.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsList.js +3 -2
- package/dist/components/Employee/Deductions/DeductionsList.js.map +1 -1
- package/dist/components/Employee/Deductions/IncludeDeductionsForm.js +3 -2
- package/dist/components/Employee/Deductions/IncludeDeductionsForm.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js +5 -4
- package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js.map +1 -1
- package/dist/components/Employee/EmployeeList/Actions.js +5 -4
- package/dist/components/Employee/EmployeeList/Actions.js.map +1 -1
- package/dist/components/Employee/EmployeeList/List.js +58 -53
- package/dist/components/Employee/EmployeeList/List.js.map +1 -1
- package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js +48 -43
- package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/Actions.js +6 -5
- package/dist/components/Employee/PaymentMethod/Actions.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/BankAccountEdit.js +1 -1
- package/dist/components/Employee/PaymentMethod/BankAccountEdit.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/BankAccountsList.js +3 -2
- package/dist/components/Employee/PaymentMethod/BankAccountsList.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/PaymentMethod.js +3 -4
- package/dist/components/Employee/PaymentMethod/PaymentMethod.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js +1 -1
- package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/Split.js +88 -76
- package/dist/components/Employee/PaymentMethod/Split.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.d.ts +2 -2
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +29 -25
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
- package/dist/components/Employee/Profile/Actions.js +7 -6
- package/dist/components/Employee/Profile/Actions.js.map +1 -1
- package/dist/components/Employee/Profile/AdminPersonalDetails.d.ts +49 -20
- package/dist/components/Employee/Profile/AdminPersonalDetails.js +27 -25
- package/dist/components/Employee/Profile/AdminPersonalDetails.js.map +1 -1
- package/dist/components/Employee/Profile/PersonalDetailsInputs.js +10 -9
- package/dist/components/Employee/Profile/PersonalDetailsInputs.js.map +1 -1
- package/dist/components/Employee/Profile/Profile.js +124 -120
- package/dist/components/Employee/Profile/Profile.js.map +1 -1
- package/dist/components/Employee/Taxes/Actions.js +8 -7
- package/dist/components/Employee/Taxes/Actions.js.map +1 -1
- package/dist/components/Employee/Taxes/FederalForm.js +5 -4
- package/dist/components/Employee/Taxes/FederalForm.js.map +1 -1
- package/dist/components/Employee/Taxes/StateForm.d.ts +1 -1
- package/dist/components/Employee/Taxes/StateForm.js +27 -25
- package/dist/components/Employee/Taxes/StateForm.js.map +1 -1
- package/dist/components/Employee/Taxes/Taxes.d.ts +1 -1
- package/dist/components/Employee/Taxes/Taxes.js +77 -73
- package/dist/components/Employee/Taxes/Taxes.js.map +1 -1
- package/dist/components/index.d.ts +1 -1
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +8 -7
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
- package/dist/i18n/I18n.js +15 -15
- package/dist/i18n/I18n.js.map +1 -1
- package/dist/i18n/en/Contractor.ContractorList.json.js +25 -0
- package/dist/i18n/en/Contractor.ContractorList.json.js.map +1 -0
- package/dist/i18n/en/Contractor.PaymentMethod.json.js +35 -0
- package/dist/i18n/en/Contractor.PaymentMethod.json.js.map +1 -0
- package/dist/i18n/en/Employee.Compensation.json.js +22 -20
- package/dist/i18n/en/Employee.Compensation.json.js.map +1 -1
- package/dist/i18n/en/Employee.PaymentMethod.json.js +18 -17
- package/dist/i18n/en/Employee.PaymentMethod.json.js.map +1 -1
- package/dist/i18n/en/common.json.d.ts +21 -9
- package/dist/i18n/en/common.json.js +35 -23
- package/dist/i18n/en/common.json.js.map +1 -1
- package/dist/index.js +4 -4
- package/dist/shared/constants.d.ts +14 -0
- package/dist/shared/constants.js +26 -15
- package/dist/shared/constants.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/i18next.d.ts +52 -1
- package/package.json +4 -3
- package/dist/components/Employee/PaymentMethod/Constants.d.ts +0 -8
- package/dist/components/Employee/PaymentMethod/Constants.js +0 -6
- package/dist/components/Employee/PaymentMethod/Constants.js.map +0 -1
|
@@ -1,45 +1,47 @@
|
|
|
1
1
|
import { jsxs as a, Fragment as s, jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect as
|
|
3
|
-
import { useFormContext as
|
|
2
|
+
import { useEffect as g } from "react";
|
|
3
|
+
import { useFormContext as h } from "react-hook-form";
|
|
4
4
|
import { useTranslation as O } from "react-i18next";
|
|
5
|
-
import { z as
|
|
6
|
-
import {
|
|
5
|
+
import { z as t } from "zod";
|
|
6
|
+
import { AdminInputsSchema as D, SocialSecurityNumberSchema as I, DateOfBirthSchema as l, NameInputsSchema as A, NameInputs as N, AdminInputs as E, SocialSecurityNumberInput as x, DateOfBirthInput as y } from "./PersonalDetailsInputs.js";
|
|
7
7
|
import { useProfile as P } from "./useProfile.js";
|
|
8
|
-
import { EmployeeOnboardingStatus as
|
|
9
|
-
import { CheckboxField as
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
import { EmployeeOnboardingStatus as m } from "../../../shared/constants.js";
|
|
9
|
+
import { CheckboxField as F } from "../../Common/Fields/CheckboxField/CheckboxField.js";
|
|
10
|
+
const d = D.merge(
|
|
11
|
+
A
|
|
12
|
+
).extend({
|
|
13
|
+
selfOnboarding: t.boolean()
|
|
14
|
+
}), M = t.discriminatedUnion("enableSsn", [
|
|
15
|
+
d.merge(I).merge(l).extend({
|
|
16
|
+
enableSsn: t.literal(!0)
|
|
15
17
|
}),
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
selfOnboarding: o.literal(!1)
|
|
18
|
+
d.merge(l).extend({
|
|
19
|
+
enableSsn: t.literal(!1)
|
|
19
20
|
})
|
|
20
21
|
]), V = () => {
|
|
21
|
-
const { companyLocations:
|
|
22
|
-
return
|
|
23
|
-
r ?
|
|
24
|
-
}, [r, e?.hasSsn, i,
|
|
25
|
-
/* @__PURE__ */ n(
|
|
26
|
-
/* @__PURE__ */ n(
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
const { companyLocations: c, employee: e, isAdmin: f, isSelfOnboardingEnabled: S } = P(), { t: b } = O("Employee.Profile"), { watch: u, setValue: o, getFieldState: p } = h(), r = u("selfOnboarding"), { isDirty: i } = p("ssn");
|
|
23
|
+
return g(() => {
|
|
24
|
+
r ? o("enableSsn", !1) : o("enableSsn", i ? !0 : !e?.hasSsn);
|
|
25
|
+
}, [r, e?.hasSsn, i, o]), f ? /* @__PURE__ */ a(s, { children: [
|
|
26
|
+
/* @__PURE__ */ n(N, {}),
|
|
27
|
+
/* @__PURE__ */ n(E, { companyLocations: c }),
|
|
28
|
+
S && /* @__PURE__ */ n(
|
|
29
|
+
F,
|
|
29
30
|
{
|
|
30
31
|
name: "selfOnboarding",
|
|
31
32
|
label: b("selfOnboardingLabel"),
|
|
32
|
-
isDisabled: e?.onboarded || e?.onboardingStatus ===
|
|
33
|
+
isDisabled: e?.onboarded || e?.onboardingStatus === m.ONBOARDING_COMPLETED || e?.onboardingStatus === m.SELF_ONBOARDING_AWAITING_ADMIN_REVIEW
|
|
33
34
|
}
|
|
34
35
|
),
|
|
35
36
|
!r && /* @__PURE__ */ a(s, { children: [
|
|
36
|
-
/* @__PURE__ */ n(
|
|
37
|
+
/* @__PURE__ */ n(x, { employee: e }),
|
|
37
38
|
/* @__PURE__ */ n(y, {})
|
|
38
39
|
] })
|
|
39
40
|
] }) : null;
|
|
40
41
|
};
|
|
41
42
|
export {
|
|
42
43
|
V as AdminPersonalDetails,
|
|
43
|
-
M as AdminPersonalDetailsSchema
|
|
44
|
+
M as AdminPersonalDetailsSchema,
|
|
45
|
+
d as AdminSelfOnboardingPersonalDetailsSchema
|
|
44
46
|
};
|
|
45
47
|
//# sourceMappingURL=AdminPersonalDetails.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AdminPersonalDetails.js","sources":["../../../../src/components/Employee/Profile/AdminPersonalDetails.tsx"],"sourcesContent":["import { useEffect } from 'react'\nimport { useFormContext } from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport { z } from 'zod'\nimport {\n AdminInputs,\n AdminInputsSchema,\n NameInputs,\n NameInputsSchema,\n SocialSecurityNumberInput,\n SocialSecurityNumberSchema,\n DateOfBirthInput,\n DateOfBirthSchema,\n type PersonalDetailsInputs,\n} from './PersonalDetailsInputs'\nimport { useProfile } from './useProfile'\nimport { EmployeeOnboardingStatus } from '@/shared/constants'\nimport { CheckboxField } from '@/components/Common'\n\
|
|
1
|
+
{"version":3,"file":"AdminPersonalDetails.js","sources":["../../../../src/components/Employee/Profile/AdminPersonalDetails.tsx"],"sourcesContent":["import { useEffect } from 'react'\nimport { useFormContext } from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport { z } from 'zod'\nimport {\n AdminInputs,\n AdminInputsSchema,\n NameInputs,\n NameInputsSchema,\n SocialSecurityNumberInput,\n SocialSecurityNumberSchema,\n DateOfBirthInput,\n DateOfBirthSchema,\n type PersonalDetailsInputs,\n} from './PersonalDetailsInputs'\nimport { useProfile } from './useProfile'\nimport { EmployeeOnboardingStatus } from '@/shared/constants'\nimport { CheckboxField } from '@/components/Common'\n\nexport const AdminSelfOnboardingPersonalDetailsSchema = AdminInputsSchema.merge(\n NameInputsSchema,\n).extend({\n selfOnboarding: z.boolean(),\n})\n\nexport const AdminPersonalDetailsSchema = z.discriminatedUnion('enableSsn', [\n AdminSelfOnboardingPersonalDetailsSchema.merge(SocialSecurityNumberSchema)\n .merge(DateOfBirthSchema)\n .extend({\n enableSsn: z.literal(true),\n }),\n AdminSelfOnboardingPersonalDetailsSchema.merge(DateOfBirthSchema).extend({\n enableSsn: z.literal(false),\n }),\n])\n\nexport const AdminPersonalDetails = () => {\n const { companyLocations, employee, isAdmin, isSelfOnboardingEnabled } = useProfile()\n const { t } = useTranslation('Employee.Profile')\n const { watch, setValue, getFieldState } = useFormContext<PersonalDetailsInputs>()\n\n const isSelfOnboardingChecked = watch('selfOnboarding')\n const { isDirty: isSsnDirty } = getFieldState('ssn')\n\n useEffect(() => {\n if (isSelfOnboardingChecked) {\n setValue('enableSsn', false)\n } else {\n setValue('enableSsn', isSsnDirty ? true : !employee?.hasSsn)\n }\n }, [isSelfOnboardingChecked, employee?.hasSsn, isSsnDirty, setValue])\n\n if (!isAdmin) {\n return null\n }\n\n return (\n <>\n <NameInputs />\n <AdminInputs companyLocations={companyLocations} />\n {isSelfOnboardingEnabled && (\n <CheckboxField\n name=\"selfOnboarding\"\n label={t('selfOnboardingLabel')}\n isDisabled={\n employee?.onboarded ||\n employee?.onboardingStatus === EmployeeOnboardingStatus.ONBOARDING_COMPLETED ||\n employee?.onboardingStatus ===\n EmployeeOnboardingStatus.SELF_ONBOARDING_AWAITING_ADMIN_REVIEW\n }\n />\n )}\n\n {!isSelfOnboardingChecked && (\n <>\n <SocialSecurityNumberInput employee={employee} />\n <DateOfBirthInput />\n </>\n )}\n </>\n )\n}\n"],"names":["AdminSelfOnboardingPersonalDetailsSchema","AdminInputsSchema","NameInputsSchema","z","AdminPersonalDetailsSchema","SocialSecurityNumberSchema","DateOfBirthSchema","AdminPersonalDetails","companyLocations","employee","isAdmin","isSelfOnboardingEnabled","useProfile","t","useTranslation","watch","setValue","getFieldState","useFormContext","isSelfOnboardingChecked","isSsnDirty","useEffect","jsxs","Fragment","jsx","NameInputs","AdminInputs","CheckboxField","EmployeeOnboardingStatus","SocialSecurityNumberInput","DateOfBirthInput"],"mappings":";;;;;;;;;AAmBO,MAAMA,IAA2CC,EAAkB;AAAA,EACxEC;AACF,EAAE,OAAO;AAAA,EACP,gBAAgBC,EAAE,QAAQ;AAC5B,CAAC,GAEYC,IAA6BD,EAAE,mBAAmB,aAAa;AAAA,EAC1EH,EAAyC,MAAMK,CAA0B,EACtE,MAAMC,CAAiB,EACvB,OAAO;AAAA,IACN,WAAWH,EAAE,QAAQ,EAAI;AAAA,EAAA,CAC1B;AAAA,EACHH,EAAyC,MAAMM,CAAiB,EAAE,OAAO;AAAA,IACvE,WAAWH,EAAE,QAAQ,EAAK;AAAA,EAC3B,CAAA;AACH,CAAC,GAEYI,IAAuB,MAAM;AACxC,QAAM,EAAE,kBAAAC,GAAkB,UAAAC,GAAU,SAAAC,GAAS,yBAAAC,EAAA,IAA4BC,EAAW,GAC9E,EAAE,GAAAC,EAAA,IAAMC,EAAe,kBAAkB,GACzC,EAAE,OAAAC,GAAO,UAAAC,GAAU,eAAAC,EAAA,IAAkBC,EAAsC,GAE3EC,IAA0BJ,EAAM,gBAAgB,GAChD,EAAE,SAASK,MAAeH,EAAc,KAAK;AAUnD,SARAI,EAAU,MAAM;AACd,IAAIF,IACFH,EAAS,aAAa,EAAK,IAE3BA,EAAS,aAAaI,IAAa,KAAO,CAACX,GAAU,MAAM;AAAA,EAC7D,GACC,CAACU,GAAyBV,GAAU,QAAQW,GAAYJ,CAAQ,CAAC,GAE/DN,IAMD,gBAAAY,EAAAC,GAAA,EAAA,UAAA;AAAA,IAAA,gBAAAC,EAACC,GAAW,EAAA;AAAA,IACZ,gBAAAD,EAACE,KAAY,kBAAAlB,GAAoC;AAAA,IAChDG,KACC,gBAAAa;AAAA,MAACG;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,OAAOd,EAAE,qBAAqB;AAAA,QAC9B,YACEJ,GAAU,aACVA,GAAU,qBAAqBmB,EAAyB,wBACxDnB,GAAU,qBACRmB,EAAyB;AAAA,MAAA;AAAA,IAE/B;AAAA,IAGD,CAACT,KAEE,gBAAAG,EAAAC,GAAA,EAAA,UAAA;AAAA,MAAA,gBAAAC,EAACK,KAA0B,UAAApB,GAAoB;AAAA,wBAC9CqB,GAAiB,CAAA,CAAA;AAAA,IAAA,EACpB,CAAA;AAAA,EAAA,GAEJ,IA1BO;AA4BX;"}
|
|
@@ -2,10 +2,11 @@ import { jsxs as l, Fragment as d, jsx as a } from "react/jsx-runtime";
|
|
|
2
2
|
import { z as r } from "zod";
|
|
3
3
|
import { useFormContext as c } from "react-hook-form";
|
|
4
4
|
import { useTranslation as i } from "react-i18next";
|
|
5
|
+
import "../../../shared/constants.js";
|
|
5
6
|
import { Grid as b } from "../../Common/Grid/Grid.js";
|
|
6
7
|
import { removeNonDigits as S, addressInline as g } from "../../../helpers/formattedStrings.js";
|
|
7
8
|
import { usePlaceholderSSN as h, normalizeSSN as N } from "../../../helpers/ssn.js";
|
|
8
|
-
import {
|
|
9
|
+
import { SSN_REGEX as D, nameValidation as m } from "../../../helpers/validations.js";
|
|
9
10
|
import { TextInputField as s } from "../../Common/Fields/TextInputField/TextInputField.js";
|
|
10
11
|
import { SelectField as I } from "../../Common/Fields/SelectField/SelectField.js";
|
|
11
12
|
import { DatePickerField as p } from "../../Common/Fields/DatePickerField/DatePickerField.js";
|
|
@@ -14,7 +15,7 @@ const v = r.object({
|
|
|
14
15
|
middleInitial: r.string().optional(),
|
|
15
16
|
lastName: m
|
|
16
17
|
});
|
|
17
|
-
function
|
|
18
|
+
function C() {
|
|
18
19
|
const { t: e } = i("Employee.Profile");
|
|
19
20
|
return /* @__PURE__ */ l(d, { children: [
|
|
20
21
|
/* @__PURE__ */ l(b, { gap: { base: 20, small: 8 }, gridTemplateColumns: { base: "1fr", small: ["1fr", 200] }, children: [
|
|
@@ -45,7 +46,7 @@ const O = r.object({
|
|
|
45
46
|
startDate: r.date().transform((e) => e.toISOString().split("T")[0]),
|
|
46
47
|
email: r.string().email()
|
|
47
48
|
});
|
|
48
|
-
function
|
|
49
|
+
function L({ companyLocations: e }) {
|
|
49
50
|
const { t } = i("Employee.Profile"), {
|
|
50
51
|
formState: { errors: n }
|
|
51
52
|
} = c();
|
|
@@ -91,7 +92,7 @@ const y = r.object({
|
|
|
91
92
|
ssn: r.string().transform((e) => S(e)).refine((e) => D.test(e)),
|
|
92
93
|
enableSsn: r.boolean()
|
|
93
94
|
});
|
|
94
|
-
function
|
|
95
|
+
function z({ employee: e, onChange: t }) {
|
|
95
96
|
const { setValue: n } = c(), { t: o } = i("Employee.Profile"), u = h(e?.hasSsn);
|
|
96
97
|
return /* @__PURE__ */ a(
|
|
97
98
|
s,
|
|
@@ -111,7 +112,7 @@ function L({ employee: e, onChange: t }) {
|
|
|
111
112
|
const A = r.object({
|
|
112
113
|
dateOfBirth: r.date().transform((e) => e.toISOString().split("T")[0])
|
|
113
114
|
});
|
|
114
|
-
function
|
|
115
|
+
function G() {
|
|
115
116
|
const { t: e } = i("Employee.Profile");
|
|
116
117
|
return /* @__PURE__ */ a(
|
|
117
118
|
p,
|
|
@@ -127,13 +128,13 @@ v.merge(O).merge(y).merge(A).extend({
|
|
|
127
128
|
enableSsn: r.boolean()
|
|
128
129
|
});
|
|
129
130
|
export {
|
|
130
|
-
|
|
131
|
+
L as AdminInputs,
|
|
131
132
|
O as AdminInputsSchema,
|
|
132
|
-
|
|
133
|
+
G as DateOfBirthInput,
|
|
133
134
|
A as DateOfBirthSchema,
|
|
134
|
-
|
|
135
|
+
C as NameInputs,
|
|
135
136
|
v as NameInputsSchema,
|
|
136
|
-
|
|
137
|
+
z as SocialSecurityNumberInput,
|
|
137
138
|
y as SocialSecurityNumberSchema
|
|
138
139
|
};
|
|
139
140
|
//# sourceMappingURL=PersonalDetailsInputs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PersonalDetailsInputs.js","sources":["../../../../src/components/Employee/Profile/PersonalDetailsInputs.tsx"],"sourcesContent":["import { z } from 'zod'\nimport { useFormContext } from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport { type Location } from '@gusto/embedded-api/models/components/location'\nimport { type Employee } from '@gusto/embedded-api/models/components/employee'\nimport { SelectField, TextInputField, Grid, DatePickerField } from '@/components/Common'\nimport { addressInline, removeNonDigits } from '@/helpers/formattedStrings'\nimport { normalizeSSN, usePlaceholderSSN } from '@/helpers/ssn'\nimport { nameValidation, SSN_REGEX } from '@/helpers/validations'\n\nexport const NameInputsSchema = z.object({\n firstName: nameValidation,\n middleInitial: z.string().optional(),\n lastName: nameValidation,\n})\n\nexport function NameInputs() {\n const { t } = useTranslation('Employee.Profile')\n\n return (\n <>\n <Grid gap={{ base: 20, small: 8 }} gridTemplateColumns={{ base: '1fr', small: ['1fr', 200] }}>\n <TextInputField\n name=\"firstName\"\n isRequired\n label={t('firstName')}\n errorMessage={t('validations.firstName')}\n />\n <TextInputField name=\"middleInitial\" label={t('middleInitial')} />\n </Grid>\n <TextInputField\n name=\"lastName\"\n isRequired\n label={t('lastName')}\n errorMessage={t('validations.lastName')}\n />\n </>\n )\n}\n\nexport const AdminInputsSchema = z.object({\n workAddress: z.string().min(1),\n startDate: z.date().transform(date => date.toISOString().split('T')[0]),\n email: z.string().email(),\n})\n\ntype AdminInputsSchemaType = z.infer<typeof AdminInputsSchema>\n\ninterface AdminInputsProps {\n companyLocations: Location[]\n}\n\nexport function AdminInputs({ companyLocations }: AdminInputsProps) {\n const { t } = useTranslation('Employee.Profile')\n const {\n formState: { errors },\n } = useFormContext<AdminInputsSchemaType>()\n\n return (\n <>\n <SelectField\n name=\"workAddress\"\n options={companyLocations.map(location => ({\n value: location.uuid,\n label: addressInline(location),\n }))}\n label={t('workAddress')}\n description={t('workAddressDescription')}\n placeholder={t('workAddressPlaceholder')}\n errorMessage={t('validations.location', { ns: 'common' })}\n isRequired\n />\n <DatePickerField\n name=\"startDate\"\n label={t('startDateLabel')}\n description={t('startDateDescription')}\n errorMessage={\n errors.startDate?.type === 'custom'\n ? t('validations.startDateOutOfRange')\n : t('validations.startDate')\n }\n />\n <TextInputField\n name=\"email\"\n label={t('email')}\n description={t('emailDescription')}\n errorMessage={t('validations.email')}\n isRequired\n type=\"email\"\n />\n </>\n )\n}\n\nexport const SocialSecurityNumberSchema = z.object({\n ssn: z\n .string()\n .transform(input => removeNonDigits(input))\n .refine(input => SSN_REGEX.test(input)),\n enableSsn: z.boolean(),\n})\n\ntype SocialSecurityNumberSchemaType = z.infer<typeof SocialSecurityNumberSchema>\n\ninterface SocialSecurityNumberInputProps {\n employee?: Employee\n onChange?: (updatedValue: string) => void\n}\n\nexport function SocialSecurityNumberInput({ employee, onChange }: SocialSecurityNumberInputProps) {\n const { setValue } = useFormContext<SocialSecurityNumberSchemaType>()\n const { t } = useTranslation('Employee.Profile')\n const placeholderSSN = usePlaceholderSSN(employee?.hasSsn)\n return (\n <TextInputField\n isRequired\n name=\"ssn\"\n label={t('ssnLabel')}\n errorMessage={t('validations.ssn', { ns: 'common' })}\n placeholder={placeholderSSN}\n transform={normalizeSSN}\n onChange={updatedValue => {\n setValue('enableSsn', true)\n onChange?.(updatedValue)\n }}\n />\n )\n}\n\nexport const DateOfBirthSchema = z.object({\n dateOfBirth: z.date().transform(date => date.toISOString().split('T')[0]),\n})\n\nexport function DateOfBirthInput() {\n const { t } = useTranslation('Employee.Profile')\n return (\n <DatePickerField\n name=\"dateOfBirth\"\n label={t('dobLabel')}\n errorMessage={t('validations.dob', { ns: 'common' })}\n />\n )\n}\n\n// All possible inputs for PersonalDetails forms\nconst PersonalDetailsTotalSchema = NameInputsSchema.merge(AdminInputsSchema)\n .merge(SocialSecurityNumberSchema)\n .merge(DateOfBirthSchema)\n .extend({\n selfOnboarding: z.boolean(),\n enableSsn: z.boolean(),\n })\n\ntype NullableDatesMapper<Source> = {\n [Property in keyof Source]: Source[Property] extends Date\n ? Source[Property] | null\n : Source[Property]\n}\n\nexport type PersonalDetailsPayload = z.infer<typeof PersonalDetailsTotalSchema>\n\n//Typescript magic to mark date fields as nullable for correct defaultvalues\nexport type PersonalDetailsInputs = NullableDatesMapper<z.input<typeof PersonalDetailsTotalSchema>>\n"],"names":["NameInputsSchema","z","nameValidation","NameInputs","t","useTranslation","jsxs","Fragment","Grid","jsx","TextInputField","AdminInputsSchema","date","AdminInputs","companyLocations","errors","useFormContext","SelectField","location","addressInline","DatePickerField","SocialSecurityNumberSchema","input","removeNonDigits","SSN_REGEX","SocialSecurityNumberInput","employee","onChange","setValue","placeholderSSN","usePlaceholderSSN","normalizeSSN","updatedValue","DateOfBirthSchema","DateOfBirthInput"],"mappings":"
|
|
1
|
+
{"version":3,"file":"PersonalDetailsInputs.js","sources":["../../../../src/components/Employee/Profile/PersonalDetailsInputs.tsx"],"sourcesContent":["import { z } from 'zod'\nimport { useFormContext } from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport { type Location } from '@gusto/embedded-api/models/components/location'\nimport { type Employee } from '@gusto/embedded-api/models/components/employee'\nimport { SelectField, TextInputField, Grid, DatePickerField } from '@/components/Common'\nimport { addressInline, removeNonDigits } from '@/helpers/formattedStrings'\nimport { normalizeSSN, usePlaceholderSSN } from '@/helpers/ssn'\nimport { nameValidation, SSN_REGEX } from '@/helpers/validations'\n\nexport const NameInputsSchema = z.object({\n firstName: nameValidation,\n middleInitial: z.string().optional(),\n lastName: nameValidation,\n})\n\nexport function NameInputs() {\n const { t } = useTranslation('Employee.Profile')\n\n return (\n <>\n <Grid gap={{ base: 20, small: 8 }} gridTemplateColumns={{ base: '1fr', small: ['1fr', 200] }}>\n <TextInputField\n name=\"firstName\"\n isRequired\n label={t('firstName')}\n errorMessage={t('validations.firstName')}\n />\n <TextInputField name=\"middleInitial\" label={t('middleInitial')} />\n </Grid>\n <TextInputField\n name=\"lastName\"\n isRequired\n label={t('lastName')}\n errorMessage={t('validations.lastName')}\n />\n </>\n )\n}\n\nexport const AdminInputsSchema = z.object({\n workAddress: z.string().min(1),\n startDate: z.date().transform(date => date.toISOString().split('T')[0]),\n email: z.string().email(),\n})\n\ntype AdminInputsSchemaType = z.infer<typeof AdminInputsSchema>\n\ninterface AdminInputsProps {\n companyLocations: Location[]\n}\n\nexport function AdminInputs({ companyLocations }: AdminInputsProps) {\n const { t } = useTranslation('Employee.Profile')\n const {\n formState: { errors },\n } = useFormContext<AdminInputsSchemaType>()\n\n return (\n <>\n <SelectField\n name=\"workAddress\"\n options={companyLocations.map(location => ({\n value: location.uuid,\n label: addressInline(location),\n }))}\n label={t('workAddress')}\n description={t('workAddressDescription')}\n placeholder={t('workAddressPlaceholder')}\n errorMessage={t('validations.location', { ns: 'common' })}\n isRequired\n />\n <DatePickerField\n name=\"startDate\"\n label={t('startDateLabel')}\n description={t('startDateDescription')}\n errorMessage={\n errors.startDate?.type === 'custom'\n ? t('validations.startDateOutOfRange')\n : t('validations.startDate')\n }\n />\n <TextInputField\n name=\"email\"\n label={t('email')}\n description={t('emailDescription')}\n errorMessage={t('validations.email')}\n isRequired\n type=\"email\"\n />\n </>\n )\n}\n\nexport const SocialSecurityNumberSchema = z.object({\n ssn: z\n .string()\n .transform(input => removeNonDigits(input))\n .refine(input => SSN_REGEX.test(input)),\n enableSsn: z.boolean(),\n})\n\ntype SocialSecurityNumberSchemaType = z.infer<typeof SocialSecurityNumberSchema>\n\ninterface SocialSecurityNumberInputProps {\n employee?: Employee\n onChange?: (updatedValue: string) => void\n}\n\nexport function SocialSecurityNumberInput({ employee, onChange }: SocialSecurityNumberInputProps) {\n const { setValue } = useFormContext<SocialSecurityNumberSchemaType>()\n const { t } = useTranslation('Employee.Profile')\n const placeholderSSN = usePlaceholderSSN(employee?.hasSsn)\n return (\n <TextInputField\n isRequired\n name=\"ssn\"\n label={t('ssnLabel')}\n errorMessage={t('validations.ssn', { ns: 'common' })}\n placeholder={placeholderSSN}\n transform={normalizeSSN}\n onChange={updatedValue => {\n setValue('enableSsn', true)\n onChange?.(updatedValue)\n }}\n />\n )\n}\n\nexport const DateOfBirthSchema = z.object({\n dateOfBirth: z.date().transform(date => date.toISOString().split('T')[0]),\n})\n\nexport function DateOfBirthInput() {\n const { t } = useTranslation('Employee.Profile')\n return (\n <DatePickerField\n name=\"dateOfBirth\"\n label={t('dobLabel')}\n errorMessage={t('validations.dob', { ns: 'common' })}\n />\n )\n}\n\n// All possible inputs for PersonalDetails forms\nconst PersonalDetailsTotalSchema = NameInputsSchema.merge(AdminInputsSchema)\n .merge(SocialSecurityNumberSchema)\n .merge(DateOfBirthSchema)\n .extend({\n selfOnboarding: z.boolean(),\n enableSsn: z.boolean(),\n })\n\ntype NullableDatesMapper<Source> = {\n [Property in keyof Source]: Source[Property] extends Date\n ? Source[Property] | null\n : Source[Property]\n}\n\nexport type PersonalDetailsPayload = z.infer<typeof PersonalDetailsTotalSchema>\n\n//Typescript magic to mark date fields as nullable for correct defaultvalues\nexport type PersonalDetailsInputs = NullableDatesMapper<z.input<typeof PersonalDetailsTotalSchema>>\n"],"names":["NameInputsSchema","z","nameValidation","NameInputs","t","useTranslation","jsxs","Fragment","Grid","jsx","TextInputField","AdminInputsSchema","date","AdminInputs","companyLocations","errors","useFormContext","SelectField","location","addressInline","DatePickerField","SocialSecurityNumberSchema","input","removeNonDigits","SSN_REGEX","SocialSecurityNumberInput","employee","onChange","setValue","placeholderSSN","usePlaceholderSSN","normalizeSSN","updatedValue","DateOfBirthSchema","DateOfBirthInput"],"mappings":"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"}
|
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import { zodResolver as
|
|
3
|
-
import { useRef as
|
|
4
|
-
import { useForm as
|
|
5
|
-
import { useLocationsGetSuspense as
|
|
6
|
-
import { useEmployeesCreateMutation as
|
|
7
|
-
import { useEmployeesGetSuspense as
|
|
8
|
-
import { useEmployeeAddressesGetSuspense as
|
|
9
|
-
import { useEmployeeAddressesCreateMutation as
|
|
10
|
-
import { useEmployeeAddressesUpdateMutation as
|
|
11
|
-
import { useEmployeeAddressesUpdateWorkAddressMutation as
|
|
12
|
-
import { useEmployeesUpdateMutation as
|
|
13
|
-
import { useEmployeeAddressesGetWorkAddressesSuspense as
|
|
14
|
-
import { useEmployeeAddressesCreateWorkAddressMutation as
|
|
15
|
-
import { RFCDate as
|
|
16
|
-
import { useEmployeesUpdateOnboardingStatusMutation as
|
|
17
|
-
import { invalidateEmployeesList as
|
|
18
|
-
import { useQueryClient as
|
|
19
|
-
import { AdminPersonalDetailsSchema as
|
|
20
|
-
import { SelfPersonalDetailsSchema as
|
|
21
|
-
import { Head as
|
|
22
|
-
import { Actions as
|
|
23
|
-
import { HomeAddressSchema as
|
|
24
|
-
import { WorkAddress as
|
|
25
|
-
import { ProfileProvider as
|
|
26
|
-
import { getEmployeeAddressForProfile as
|
|
27
|
-
import { Form as
|
|
28
|
-
import { BaseComponent as
|
|
29
|
-
import { useBase as
|
|
30
|
-
import { useI18n as
|
|
31
|
-
import { EmployeeOnboardingStatus as l, EmployeeSelfOnboardingStatuses as
|
|
32
|
-
import { useFlow as
|
|
33
|
-
import { ensureRequired as
|
|
1
|
+
import { jsx as t, jsxs as Ee, Fragment as he } from "react/jsx-runtime";
|
|
2
|
+
import { zodResolver as De } from "@hookform/resolvers/zod";
|
|
3
|
+
import { useState as Se, useRef as Oe, useEffect as Pe } from "react";
|
|
4
|
+
import { useForm as ge, useWatch as be, FormProvider as Ne } from "react-hook-form";
|
|
5
|
+
import { useLocationsGetSuspense as Ie } from "@gusto/embedded-api/react-query/locationsGet";
|
|
6
|
+
import { useEmployeesCreateMutation as _e } from "@gusto/embedded-api/react-query/employeesCreate";
|
|
7
|
+
import { useEmployeesGetSuspense as we } from "@gusto/embedded-api/react-query/employeesGet";
|
|
8
|
+
import { useEmployeeAddressesGetSuspense as ke } from "@gusto/embedded-api/react-query/employeeAddressesGet";
|
|
9
|
+
import { useEmployeeAddressesCreateMutation as Me } from "@gusto/embedded-api/react-query/employeeAddressesCreate";
|
|
10
|
+
import { useEmployeeAddressesUpdateMutation as Be } from "@gusto/embedded-api/react-query/employeeAddressesUpdate";
|
|
11
|
+
import { useEmployeeAddressesUpdateWorkAddressMutation as Re } from "@gusto/embedded-api/react-query/employeeAddressesUpdateWorkAddress";
|
|
12
|
+
import { useEmployeesUpdateMutation as Le } from "@gusto/embedded-api/react-query/employeesUpdate";
|
|
13
|
+
import { useEmployeeAddressesGetWorkAddressesSuspense as ve } from "@gusto/embedded-api/react-query/employeeAddressesGetWorkAddresses";
|
|
14
|
+
import { useEmployeeAddressesCreateWorkAddressMutation as Ce } from "@gusto/embedded-api/react-query/employeeAddressesCreateWorkAddress";
|
|
15
|
+
import { RFCDate as R } from "@gusto/embedded-api/types/rfcdate";
|
|
16
|
+
import { useEmployeesUpdateOnboardingStatusMutation as We } from "@gusto/embedded-api/react-query/employeesUpdateOnboardingStatus";
|
|
17
|
+
import { invalidateEmployeesList as Ue } from "@gusto/embedded-api/react-query/employeesList";
|
|
18
|
+
import { useQueryClient as qe } from "@tanstack/react-query";
|
|
19
|
+
import { AdminPersonalDetailsSchema as L, AdminSelfOnboardingPersonalDetailsSchema as Te, AdminPersonalDetails as C } from "./AdminPersonalDetails.js";
|
|
20
|
+
import { SelfPersonalDetailsSchema as He, SelfPersonalDetails as W } from "./SelfPersonalDetails.js";
|
|
21
|
+
import { Head as U } from "./Head.js";
|
|
22
|
+
import { Actions as q } from "./Actions.js";
|
|
23
|
+
import { HomeAddressSchema as Ge, HomeAddress as T } from "./HomeAddress.js";
|
|
24
|
+
import { WorkAddress as H } from "./WorkAddress.js";
|
|
25
|
+
import { ProfileProvider as Fe } from "./useProfile.js";
|
|
26
|
+
import { getEmployeeAddressForProfile as Ve } from "./getEmployeeAddressForProfile.js";
|
|
27
|
+
import { Form as Ye } from "../../Common/Form/Form.js";
|
|
28
|
+
import { BaseComponent as xe } from "../../Base/Base.js";
|
|
29
|
+
import { useBase as ze } from "../../Base/useBase.js";
|
|
30
|
+
import { useI18n as v, useComponentDictionary as je } from "../../../i18n/I18n.js";
|
|
31
|
+
import { EmployeeOnboardingStatus as l, EmployeeSelfOnboardingStatuses as Ke, componentEvents as d } from "../../../shared/constants.js";
|
|
32
|
+
import { useFlow as Qe } from "../../Flow/useFlow.js";
|
|
33
|
+
import { ensureRequired as Je } from "../../../helpers/ensureRequired.js";
|
|
34
34
|
function m(r) {
|
|
35
|
-
return /* @__PURE__ */ t(
|
|
35
|
+
return /* @__PURE__ */ t(xe, { ...r, children: r.employeeId ? /* @__PURE__ */ t(Xe, { ...r, employeeId: r.employeeId, children: r.children }) : /* @__PURE__ */ t(G, { ...r, children: r.children }) });
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function Xe({ employeeId: r, ...a }) {
|
|
38
38
|
const {
|
|
39
39
|
data: { employee: u }
|
|
40
|
-
} =
|
|
40
|
+
} = we({ employeeId: r }), {
|
|
41
41
|
data: { employeeAddressList: c }
|
|
42
|
-
} =
|
|
42
|
+
} = ke({ employeeId: r }), {
|
|
43
43
|
data: { employeeWorkAddressesList: i }
|
|
44
|
-
} =
|
|
44
|
+
} = ve({ employeeId: r });
|
|
45
45
|
return /* @__PURE__ */ t(
|
|
46
|
-
|
|
46
|
+
G,
|
|
47
47
|
{
|
|
48
48
|
...a,
|
|
49
49
|
employee: u,
|
|
@@ -52,31 +52,31 @@ function ze({ employeeId: r, ...a }) {
|
|
|
52
52
|
}
|
|
53
53
|
);
|
|
54
54
|
}
|
|
55
|
-
const
|
|
55
|
+
const G = ({
|
|
56
56
|
isAdmin: r = !1,
|
|
57
57
|
isSelfOnboardingEnabled: a = !0,
|
|
58
58
|
dictionary: u,
|
|
59
59
|
...c
|
|
60
60
|
}) => {
|
|
61
|
-
|
|
61
|
+
v("Employee.Profile"), v("Employee.HomeAddress"), je("Employee.Profile", u);
|
|
62
62
|
const {
|
|
63
63
|
companyId: i,
|
|
64
|
-
employee:
|
|
65
|
-
homeAddresses:
|
|
66
|
-
workAddresses:
|
|
67
|
-
children:
|
|
68
|
-
className:
|
|
64
|
+
employee: D,
|
|
65
|
+
homeAddresses: F,
|
|
66
|
+
workAddresses: g,
|
|
67
|
+
children: b,
|
|
68
|
+
className: V = "",
|
|
69
69
|
defaultValues: s
|
|
70
|
-
} = c, { onEvent: n, baseSubmitHandler:
|
|
71
|
-
mutateAsync:
|
|
72
|
-
isPending:
|
|
73
|
-
} =
|
|
74
|
-
onSettled: () =>
|
|
75
|
-
}),
|
|
76
|
-
employee:
|
|
77
|
-
homeAddress:
|
|
78
|
-
workAddress:
|
|
79
|
-
}),
|
|
70
|
+
} = c, { onEvent: n, baseSubmitHandler: Y } = ze(), x = qe(), [z, N] = Se(L), { data: j } = Ie({ companyId: i }), K = j.locationList, { mutateAsync: Q, isPending: J } = _e(), { mutateAsync: X, isPending: Z } = Le(), { mutateAsync: $, isPending: ee } = Ce(), { mutateAsync: re, isPending: te } = Re(), { mutateAsync: oe, isPending: se } = Me(), { mutateAsync: ne, isPending: de } = Be(), {
|
|
71
|
+
mutateAsync: ie,
|
|
72
|
+
isPending: me
|
|
73
|
+
} = We({
|
|
74
|
+
onSettled: () => Ue(x, [i])
|
|
75
|
+
}), I = { employee: D, workAddresses: g }, ae = Ve(F), le = I.workAddresses?.find((P) => P.active), e = Oe({
|
|
76
|
+
employee: I.employee,
|
|
77
|
+
homeAddress: ae,
|
|
78
|
+
workAddress: le
|
|
79
|
+
}), S = {
|
|
80
80
|
firstName: e.current.employee?.firstName ?? s?.employee?.firstName ?? "",
|
|
81
81
|
middleInitial: e.current.employee?.middleInitial ?? s?.employee?.middleInitial ?? "",
|
|
82
82
|
lastName: e.current.employee?.lastName ?? s?.employee?.lastName ?? "",
|
|
@@ -91,33 +91,37 @@ const T = ({
|
|
|
91
91
|
zip: e.current.homeAddress?.zip ?? s?.homeAddress?.zip ?? "",
|
|
92
92
|
state: e.current.homeAddress?.state ?? s?.homeAddress?.state ?? "",
|
|
93
93
|
courtesyWithholding: e.current.homeAddress?.courtesyWithholding ?? !1
|
|
94
|
-
},
|
|
95
|
-
...
|
|
94
|
+
}, ue = e.current.employee?.onboarded || e.current.employee?.onboardingStatus === l.ONBOARDING_COMPLETED || e.current.employee?.onboardingStatus !== void 0 && e.current.employee.onboardingStatus !== l.ADMIN_ONBOARDING_INCOMPLETE ? { ...S, enableSsn: !1, selfOnboarding: !0 } : {
|
|
95
|
+
...S,
|
|
96
96
|
selfOnboarding: a && e.current.employee?.onboardingStatus ? (
|
|
97
97
|
// @ts-expect-error: onboarding_status during runtime can be one of self onboarding statuses
|
|
98
|
-
|
|
98
|
+
Ke.has(e.current.employee.onboarding_status)
|
|
99
99
|
) : !1,
|
|
100
100
|
enableSsn: !e.current.employee?.hasSsn,
|
|
101
101
|
ssn: ""
|
|
102
|
-
},
|
|
103
|
-
...
|
|
102
|
+
}, ce = {
|
|
103
|
+
...S,
|
|
104
104
|
enableSsn: !e.current.employee?.hasSsn,
|
|
105
105
|
ssn: ""
|
|
106
|
-
}, O =
|
|
107
|
-
resolver:
|
|
108
|
-
(r ?
|
|
106
|
+
}, O = ge({
|
|
107
|
+
resolver: De(
|
|
108
|
+
(r ? z : He).and(Ge)
|
|
109
109
|
),
|
|
110
|
-
defaultValues: r ?
|
|
111
|
-
}), { handleSubmit:
|
|
112
|
-
|
|
113
|
-
|
|
110
|
+
defaultValues: r ? ue : ce
|
|
111
|
+
}), { handleSubmit: pe } = O, A = be({ control: O.control, name: "selfOnboarding" });
|
|
112
|
+
Pe(() => {
|
|
113
|
+
r && N(A ? Te : L);
|
|
114
|
+
}, [A, r]);
|
|
115
|
+
const ye = async (P) => {
|
|
116
|
+
await Y(P, async (f) => {
|
|
117
|
+
const { workAddress: _, startDate: fe, selfOnboarding: E, ...h } = f;
|
|
114
118
|
if (e.current.employee) {
|
|
115
|
-
if (
|
|
116
|
-
const { employeeOnboardingStatus: p } = await
|
|
119
|
+
if (E && e.current.employee.onboardingStatus === l.ADMIN_ONBOARDING_INCOMPLETE || !E && e.current.employee.onboardingStatus === l.SELF_ONBOARDING_PENDING_INVITE) {
|
|
120
|
+
const { employeeOnboardingStatus: p } = await ie({
|
|
117
121
|
request: {
|
|
118
122
|
employeeId: e.current.employee.uuid,
|
|
119
123
|
requestBody: {
|
|
120
|
-
onboardingStatus:
|
|
124
|
+
onboardingStatus: E ? l.SELF_ONBOARDING_PENDING_INVITE : l.ADMIN_ONBOARDING_INCOMPLETE
|
|
121
125
|
}
|
|
122
126
|
}
|
|
123
127
|
});
|
|
@@ -126,21 +130,21 @@ const T = ({
|
|
|
126
130
|
onboardingStatus: p.onboardingStatus
|
|
127
131
|
}, n(d.EMPLOYEE_ONBOARDING_STATUS_UPDATED, p);
|
|
128
132
|
}
|
|
129
|
-
const { employee: o } = await
|
|
133
|
+
const { employee: o } = await X({
|
|
130
134
|
request: {
|
|
131
135
|
employeeId: e.current.employee.uuid,
|
|
132
|
-
requestBody: { ...
|
|
136
|
+
requestBody: { ...h, version: e.current.employee.version }
|
|
133
137
|
}
|
|
134
138
|
});
|
|
135
139
|
e.current = { ...e.current, employee: o }, n(d.EMPLOYEE_UPDATED, o);
|
|
136
140
|
} else {
|
|
137
|
-
const { employee: o } = await
|
|
141
|
+
const { employee: o } = await Q({
|
|
138
142
|
request: {
|
|
139
143
|
companyId: i,
|
|
140
144
|
requestBody: {
|
|
141
|
-
...
|
|
142
|
-
selfOnboarding:
|
|
143
|
-
dateOfBirth:
|
|
145
|
+
...h,
|
|
146
|
+
selfOnboarding: E,
|
|
147
|
+
dateOfBirth: h.dateOfBirth ? new R(h.dateOfBirth) : void 0
|
|
144
148
|
}
|
|
145
149
|
}
|
|
146
150
|
});
|
|
@@ -148,35 +152,35 @@ const T = ({
|
|
|
148
152
|
}
|
|
149
153
|
if (typeof e.current.employee?.uuid != "string")
|
|
150
154
|
throw new Error("Employee id is not available");
|
|
151
|
-
if ((!
|
|
152
|
-
const { street1: o, street2: p, city:
|
|
155
|
+
if ((!A || !r) && !f.selfOnboarding) {
|
|
156
|
+
const { street1: o, street2: p, city: w, state: k, zip: M, courtesyWithholding: B } = f;
|
|
153
157
|
if (e.current.homeAddress) {
|
|
154
|
-
const { employeeAddress: y } = await
|
|
158
|
+
const { employeeAddress: y } = await ne({
|
|
155
159
|
request: {
|
|
156
160
|
homeAddressUuid: e.current.homeAddress.uuid,
|
|
157
161
|
requestBody: {
|
|
158
162
|
version: e.current.homeAddress.version,
|
|
159
163
|
street1: o,
|
|
160
164
|
street2: p,
|
|
161
|
-
city:
|
|
162
|
-
state:
|
|
163
|
-
zip:
|
|
164
|
-
courtesyWithholding:
|
|
165
|
+
city: w,
|
|
166
|
+
state: k,
|
|
167
|
+
zip: M,
|
|
168
|
+
courtesyWithholding: B
|
|
165
169
|
}
|
|
166
170
|
}
|
|
167
171
|
});
|
|
168
172
|
e.current = { ...e.current, homeAddress: y }, n(d.EMPLOYEE_HOME_ADDRESS_UPDATED, y);
|
|
169
173
|
} else {
|
|
170
|
-
const { employeeAddress: y } = await
|
|
174
|
+
const { employeeAddress: y } = await oe({
|
|
171
175
|
request: {
|
|
172
176
|
employeeId: e.current.employee.uuid,
|
|
173
177
|
requestBody: {
|
|
174
178
|
street1: o,
|
|
175
179
|
street2: p,
|
|
176
|
-
city:
|
|
177
|
-
state:
|
|
178
|
-
zip:
|
|
179
|
-
courtesyWithholding:
|
|
180
|
+
city: w,
|
|
181
|
+
state: k,
|
|
182
|
+
zip: M,
|
|
183
|
+
courtesyWithholding: B
|
|
180
184
|
}
|
|
181
185
|
}
|
|
182
186
|
});
|
|
@@ -185,23 +189,23 @@ const T = ({
|
|
|
185
189
|
}
|
|
186
190
|
if (r)
|
|
187
191
|
if (e.current.workAddress) {
|
|
188
|
-
const { employeeWorkAddress: o } = await
|
|
192
|
+
const { employeeWorkAddress: o } = await re({
|
|
189
193
|
request: {
|
|
190
194
|
workAddressUuid: e.current.workAddress.uuid,
|
|
191
195
|
requestBody: {
|
|
192
196
|
version: e.current.workAddress.version,
|
|
193
|
-
locationUuid:
|
|
197
|
+
locationUuid: _
|
|
194
198
|
}
|
|
195
199
|
}
|
|
196
200
|
});
|
|
197
201
|
e.current = { ...e.current, workAddress: o }, n(d.EMPLOYEE_WORK_ADDRESS_UPDATED, o);
|
|
198
202
|
} else {
|
|
199
|
-
const { employeeWorkAddress: o } = await
|
|
203
|
+
const { employeeWorkAddress: o } = await $({
|
|
200
204
|
request: {
|
|
201
205
|
employeeId: e.current.employee?.uuid,
|
|
202
206
|
requestBody: {
|
|
203
|
-
locationUuid:
|
|
204
|
-
effectiveDate: new
|
|
207
|
+
locationUuid: _,
|
|
208
|
+
effectiveDate: new R(f.startDate || /* @__PURE__ */ new Date())
|
|
205
209
|
}
|
|
206
210
|
}
|
|
207
211
|
});
|
|
@@ -209,58 +213,58 @@ const T = ({
|
|
|
209
213
|
}
|
|
210
214
|
n(d.EMPLOYEE_PROFILE_DONE, {
|
|
211
215
|
...e.current.employee,
|
|
212
|
-
startDate:
|
|
216
|
+
startDate: fe
|
|
213
217
|
});
|
|
214
218
|
});
|
|
215
|
-
},
|
|
219
|
+
}, Ae = () => {
|
|
216
220
|
n(d.CANCEL);
|
|
217
221
|
};
|
|
218
|
-
return /* @__PURE__ */ t("section", { className:
|
|
219
|
-
|
|
222
|
+
return /* @__PURE__ */ t("section", { className: V, children: /* @__PURE__ */ t(
|
|
223
|
+
Fe,
|
|
220
224
|
{
|
|
221
225
|
value: {
|
|
222
|
-
companyLocations:
|
|
223
|
-
workAddresses:
|
|
226
|
+
companyLocations: K,
|
|
227
|
+
workAddresses: g,
|
|
224
228
|
employee: e.current.employee ?? void 0,
|
|
225
|
-
isSelfOnboardingIntended:
|
|
226
|
-
handleCancel:
|
|
229
|
+
isSelfOnboardingIntended: A,
|
|
230
|
+
handleCancel: Ae,
|
|
227
231
|
isAdmin: r,
|
|
228
232
|
isSelfOnboardingEnabled: a,
|
|
229
|
-
isPending:
|
|
233
|
+
isPending: Z || te || se || de || J || ee || me
|
|
230
234
|
},
|
|
231
|
-
children: /* @__PURE__ */ t(
|
|
232
|
-
/* @__PURE__ */ t(C, {}),
|
|
233
|
-
/* @__PURE__ */ t(L, {}),
|
|
234
|
-
/* @__PURE__ */ t(v, {}),
|
|
235
|
+
children: /* @__PURE__ */ t(Ne, { ...O, children: /* @__PURE__ */ t(Ye, { onSubmit: pe(ye), children: b || /* @__PURE__ */ Ee(he, { children: [
|
|
235
236
|
/* @__PURE__ */ t(U, {}),
|
|
236
|
-
/* @__PURE__ */ t(
|
|
237
|
-
/* @__PURE__ */ t(W, {})
|
|
237
|
+
/* @__PURE__ */ t(C, {}),
|
|
238
|
+
/* @__PURE__ */ t(W, {}),
|
|
239
|
+
/* @__PURE__ */ t(T, {}),
|
|
240
|
+
/* @__PURE__ */ t(H, {}),
|
|
241
|
+
/* @__PURE__ */ t(q, {})
|
|
238
242
|
] }) }) })
|
|
239
243
|
}
|
|
240
244
|
) });
|
|
241
245
|
};
|
|
242
|
-
m.Head =
|
|
243
|
-
m.Actions =
|
|
244
|
-
m.AdminPersonalDetails =
|
|
245
|
-
m.SelfPersonalDetails =
|
|
246
|
-
m.HomeAddress =
|
|
247
|
-
m.WorkAddress =
|
|
248
|
-
const
|
|
249
|
-
const { companyId: r, employeeId: a, onEvent: u, isAdmin: c, defaultValues: i, isSelfOnboardingEnabled:
|
|
246
|
+
m.Head = U;
|
|
247
|
+
m.Actions = q;
|
|
248
|
+
m.AdminPersonalDetails = C;
|
|
249
|
+
m.SelfPersonalDetails = W;
|
|
250
|
+
m.HomeAddress = T;
|
|
251
|
+
m.WorkAddress = H;
|
|
252
|
+
const Br = () => {
|
|
253
|
+
const { companyId: r, employeeId: a, onEvent: u, isAdmin: c, defaultValues: i, isSelfOnboardingEnabled: D } = Qe();
|
|
250
254
|
return /* @__PURE__ */ t(
|
|
251
255
|
m,
|
|
252
256
|
{
|
|
253
|
-
companyId:
|
|
257
|
+
companyId: Je(r),
|
|
254
258
|
employeeId: a,
|
|
255
259
|
onEvent: u,
|
|
256
260
|
isAdmin: c,
|
|
257
261
|
defaultValues: i?.profile,
|
|
258
|
-
isSelfOnboardingEnabled:
|
|
262
|
+
isSelfOnboardingEnabled: D
|
|
259
263
|
}
|
|
260
264
|
);
|
|
261
265
|
};
|
|
262
266
|
export {
|
|
263
267
|
m as Profile,
|
|
264
|
-
|
|
268
|
+
Br as ProfileContextual
|
|
265
269
|
};
|
|
266
270
|
//# sourceMappingURL=Profile.js.map
|