@gusto/embedded-react-sdk 0.31.0-rc.1 → 0.31.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/dist/components/Common/UI/Breadcrumbs/Breadcrumbs.js +1 -1
- package/dist/components/Common/UI/FileInput/FileInput.js +1 -1
- package/dist/components/Common/UI/ProgressBar/ProgressBar.js +4 -4
- package/dist/components/Contractor/Profile/ContractorProfileForm.js +15 -15
- package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibility.js +55 -42
- package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibility.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as l } from "react/jsx-runtime";
|
|
2
2
|
import h from "classnames";
|
|
3
|
+
import { Flex as u } from "../../Flex/Flex.js";
|
|
3
4
|
import { BreadcrumbsDefaults as k } from "./BreadcrumbsTypes.js";
|
|
4
5
|
import r from "./Breadcrumbs.module.scss.js";
|
|
5
6
|
import { applyMissingDefaults as x } from "../../../../helpers/applyMissingDefaults.js";
|
|
6
|
-
import { Flex as u } from "../../Flex/Flex.js";
|
|
7
7
|
function I(p) {
|
|
8
8
|
const f = x(p, k), {
|
|
9
9
|
className: s,
|
|
@@ -7,13 +7,13 @@ import { FileInputDefaults as K } from "./FileInputTypes.js";
|
|
|
7
7
|
import n from "./FileInput.module.scss.js";
|
|
8
8
|
import { applyMissingDefaults as L } from "../../../../helpers/applyMissingDefaults.js";
|
|
9
9
|
import { FieldLayout as O } from "../../FieldLayout/FieldLayout.js";
|
|
10
|
+
import { Flex as y } from "../../Flex/Flex.js";
|
|
10
11
|
import { ButtonIcon as R } from "../Button/ButtonIcon.js";
|
|
11
12
|
import W from "../../../../assets/icons/icon-trashcan.svg.js";
|
|
12
13
|
import Z from "../../../../assets/icons/icon-file-outline.svg.js";
|
|
13
14
|
import $ from "../../../../assets/icons/icon-file-pdf.svg.js";
|
|
14
15
|
import H from "../../../../assets/icons/icon-file-png.svg.js";
|
|
15
16
|
import V from "../../../../assets/icons/icon-file-jpg.svg.js";
|
|
16
|
-
import { Flex as y } from "../../Flex/Flex.js";
|
|
17
17
|
function Q(i) {
|
|
18
18
|
return i === "application/pdf" ? $ : i === "image/png" ? H : i === "image/jpeg" || i === "image/jpg" ? V : Z;
|
|
19
19
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as t, jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import c from "classnames";
|
|
3
|
-
import n from "
|
|
4
|
-
import
|
|
3
|
+
import { Flex as n } from "../../Flex/Flex.js";
|
|
4
|
+
import p from "./ProgressBar.module.scss.js";
|
|
5
5
|
import { VisuallyHidden as d } from "../../VisuallyHidden/VisuallyHidden.js";
|
|
6
6
|
function y({
|
|
7
7
|
className: i,
|
|
@@ -13,9 +13,9 @@ function y({
|
|
|
13
13
|
const s = Math.max(1, Math.min(m, e)), l = {
|
|
14
14
|
"--g-progress-bar-width": `${s * 100 / e}%`
|
|
15
15
|
};
|
|
16
|
-
return /* @__PURE__ */ t(
|
|
16
|
+
return /* @__PURE__ */ t(n, { flexDirection: "column", children: [
|
|
17
17
|
o && /* @__PURE__ */ r(o, {}),
|
|
18
|
-
/* @__PURE__ */ r("div", { className: c(
|
|
18
|
+
/* @__PURE__ */ r("div", { className: c(p.root, i), style: l, children: /* @__PURE__ */ r(d, { children: /* @__PURE__ */ r("progress", { "aria-label": a, value: s, max: e }) }) })
|
|
19
19
|
] });
|
|
20
20
|
}
|
|
21
21
|
export {
|
|
@@ -6,15 +6,15 @@ import { useComponentContext as D } from "../../../contexts/ComponentAdapter/use
|
|
|
6
6
|
import { useI18n as I } from "../../../i18n/I18n.js";
|
|
7
7
|
import { Form as O } from "../../Common/Form/Form.js";
|
|
8
8
|
import { Grid as n } from "../../Common/Grid/Grid.js";
|
|
9
|
+
import { Flex as x } from "../../Common/Flex/Flex.js";
|
|
9
10
|
import { TextInputField as l } from "../../Common/Fields/TextInputField/TextInputField.js";
|
|
10
|
-
import { NumberInputField as
|
|
11
|
+
import { NumberInputField as w } from "../../Common/Fields/NumberInputField/NumberInputField.js";
|
|
11
12
|
import { RadioGroupField as d } from "../../Common/Fields/RadioGroupField/RadioGroupField.js";
|
|
12
|
-
import { SwitchField as
|
|
13
|
-
import { DatePickerField as
|
|
14
|
-
import { usePlaceholderSSN as
|
|
15
|
-
import { usePlaceholderEin as
|
|
16
|
-
import { ContractorOnboardingStatus as
|
|
17
|
-
import { Flex as B } from "../../Common/Flex/Flex.js";
|
|
13
|
+
import { SwitchField as E } from "../../Common/Fields/SwitchField/SwitchField.js";
|
|
14
|
+
import { DatePickerField as j } from "../../Common/Fields/DatePickerField/DatePickerField.js";
|
|
15
|
+
import { usePlaceholderSSN as v, normalizeSSN as G } from "../../../helpers/ssn.js";
|
|
16
|
+
import { usePlaceholderEin as z, normalizeEin as A } from "../../../helpers/federalEin.js";
|
|
17
|
+
import { ContractorOnboardingStatus as B } from "../../../shared/constants.js";
|
|
18
18
|
function re({
|
|
19
19
|
formMethods: u,
|
|
20
20
|
handleSubmit: f,
|
|
@@ -33,7 +33,7 @@ function re({
|
|
|
33
33
|
}) {
|
|
34
34
|
const a = D();
|
|
35
35
|
I("Contractor.Profile");
|
|
36
|
-
const { t: e } = T("Contractor.Profile"), q =
|
|
36
|
+
const { t: e } = T("Contractor.Profile"), q = v(t?.hasSsn ?? !1), P = z(t?.hasEin ?? !1);
|
|
37
37
|
return /* @__PURE__ */ i("section", { className: F, children: /* @__PURE__ */ i(S, { ...u, children: /* @__PURE__ */ r(O, { onSubmit: f, children: [
|
|
38
38
|
/* @__PURE__ */ r(n, { gridTemplateColumns: "1fr", gap: 24, className: "mb-8", children: [
|
|
39
39
|
/* @__PURE__ */ r("header", { children: [
|
|
@@ -42,12 +42,12 @@ function re({
|
|
|
42
42
|
] }),
|
|
43
43
|
/* @__PURE__ */ i("div", { className: C.switchFieldContainer, children: /* @__PURE__ */ r(n, { gap: 16, children: [
|
|
44
44
|
/* @__PURE__ */ i(
|
|
45
|
-
|
|
45
|
+
E,
|
|
46
46
|
{
|
|
47
47
|
name: "selfOnboarding",
|
|
48
48
|
label: e("fields.selfOnboarding.label"),
|
|
49
49
|
description: e("fields.selfOnboarding.description"),
|
|
50
|
-
isDisabled: t && t.onboardingStatus !==
|
|
50
|
+
isDisabled: t && t.onboardingStatus !== B.ADMIN_ONBOARDING_INCOMPLETE
|
|
51
51
|
}
|
|
52
52
|
),
|
|
53
53
|
p && /* @__PURE__ */ i(
|
|
@@ -81,7 +81,7 @@ function re({
|
|
|
81
81
|
name: "ssn",
|
|
82
82
|
label: e("fields.ssn.label"),
|
|
83
83
|
placeholder: q,
|
|
84
|
-
transform:
|
|
84
|
+
transform: G,
|
|
85
85
|
isRequired: !0
|
|
86
86
|
}
|
|
87
87
|
)
|
|
@@ -101,7 +101,7 @@ function re({
|
|
|
101
101
|
name: "ein",
|
|
102
102
|
label: e("fields.ein.label"),
|
|
103
103
|
placeholder: P,
|
|
104
|
-
transform:
|
|
104
|
+
transform: A,
|
|
105
105
|
isRequired: !0
|
|
106
106
|
}
|
|
107
107
|
)
|
|
@@ -116,7 +116,7 @@ function re({
|
|
|
116
116
|
}
|
|
117
117
|
),
|
|
118
118
|
h && /* @__PURE__ */ i(
|
|
119
|
-
|
|
119
|
+
w,
|
|
120
120
|
{
|
|
121
121
|
name: "hourlyRate",
|
|
122
122
|
label: e("fields.hourlyRate.label"),
|
|
@@ -126,7 +126,7 @@ function re({
|
|
|
126
126
|
}
|
|
127
127
|
),
|
|
128
128
|
/* @__PURE__ */ i(
|
|
129
|
-
|
|
129
|
+
j,
|
|
130
130
|
{
|
|
131
131
|
name: "startDate",
|
|
132
132
|
label: e("fields.startDate.label"),
|
|
@@ -135,7 +135,7 @@ function re({
|
|
|
135
135
|
}
|
|
136
136
|
)
|
|
137
137
|
] }),
|
|
138
|
-
/* @__PURE__ */ i(
|
|
138
|
+
/* @__PURE__ */ i(x, { gap: 12, justifyContent: "flex-end", children: /* @__PURE__ */ i(a.Button, { type: "submit", variant: "primary", isDisabled: o.isSubmitting, children: o.isSubmitting ? e(s ? "buttons.updating" : "buttons.creating") : e(s ? "buttons.update" : "buttons.create") }) })
|
|
139
139
|
] }) }) });
|
|
140
140
|
}
|
|
141
141
|
export {
|
package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibility.js
CHANGED
|
@@ -1,52 +1,65 @@
|
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
import { APIError as I } from "@gusto/embedded-api/models/errors/apierror";
|
|
3
|
+
import { useI9VerificationGetAuthorization as A } from "@gusto/embedded-api/react-query/i9VerificationGetAuthorization";
|
|
4
|
+
import { useI9VerificationUpdateMutation as _ } from "@gusto/embedded-api/react-query/i9VerificationUpdate";
|
|
5
|
+
import { EmploymentEligibilityPresentation as v } from "./EmploymentEligibilityPresentation.js";
|
|
6
|
+
import { BaseComponent as x } from "../../../Base/Base.js";
|
|
7
|
+
import { useBase as z } from "../../../Base/useBase.js";
|
|
8
|
+
import { useComponentDictionary as L, useI18n as S } from "../../../../i18n/I18n.js";
|
|
9
|
+
import { componentEvents as T } from "../../../../shared/constants.js";
|
|
10
|
+
function G(o) {
|
|
11
|
+
return /* @__PURE__ */ r(x, { ...o, children: /* @__PURE__ */ r(M, { ...o }) });
|
|
10
12
|
}
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
const { onEvent:
|
|
14
|
-
|
|
15
|
-
f,
|
|
13
|
+
const M = ({ employeeId: o, dictionary: s }) => {
|
|
14
|
+
L("Employee.EmploymentEligibility", s), S("Employee.EmploymentEligibility");
|
|
15
|
+
const { onEvent: m, baseSubmitHandler: c, LoadingIndicator: p } = z(), { data: l, isLoading: y } = A(
|
|
16
|
+
{ employeeId: o },
|
|
16
17
|
{
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
18
|
+
retry: !1,
|
|
19
|
+
throwOnError: (i) => !(i instanceof I && i.httpMeta.response.status === 404)
|
|
20
|
+
}
|
|
21
|
+
), t = l?.i9Authorization, { mutateAsync: d, isPending: u } = _(), E = async (i) => {
|
|
22
|
+
await c(i, async (h) => {
|
|
23
|
+
const { authorizationStatus: n, documentType: a, documentNumber: e, expirationDate: b, country: g } = h;
|
|
24
|
+
if (!n) return;
|
|
25
|
+
const D = await d({
|
|
26
|
+
request: {
|
|
27
|
+
employeeId: o,
|
|
28
|
+
requestBody: {
|
|
29
|
+
authorizationStatus: n,
|
|
30
|
+
version: t?.version,
|
|
31
|
+
...n === "permanent_resident" && e && {
|
|
32
|
+
documentType: "uscis_alien_registration_number",
|
|
33
|
+
documentNumber: e
|
|
34
|
+
},
|
|
35
|
+
...n === "alien" && {
|
|
36
|
+
...e && a && { documentType: a, documentNumber: e },
|
|
37
|
+
expirationDate: b,
|
|
38
|
+
...a === "foreign_passport" && { country: g }
|
|
37
39
|
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
m(T.EMPLOYEE_EMPLOYMENT_ELIGIBILITY_DONE, D.i9Authorization);
|
|
44
|
+
});
|
|
45
|
+
}, f = t ? {
|
|
46
|
+
authorizationStatus: t.authorizationStatus,
|
|
47
|
+
documentType: t.documentType ?? void 0,
|
|
48
|
+
expirationDate: t.expirationDate ? new Date(t.expirationDate) : void 0,
|
|
49
|
+
country: t.country ?? void 0
|
|
50
|
+
} : {};
|
|
51
|
+
return !u && y ? /* @__PURE__ */ r(p, {}) : /* @__PURE__ */ r(
|
|
52
|
+
v,
|
|
53
|
+
{
|
|
54
|
+
onSubmit: E,
|
|
55
|
+
defaultValues: f,
|
|
56
|
+
hasDocumentNumber: t?.hasDocumentNumber,
|
|
57
|
+
isPending: u
|
|
45
58
|
},
|
|
46
|
-
|
|
59
|
+
t?.uuid
|
|
47
60
|
);
|
|
48
61
|
};
|
|
49
62
|
export {
|
|
50
|
-
|
|
63
|
+
G as EmploymentEligibility
|
|
51
64
|
};
|
|
52
65
|
//# sourceMappingURL=EmploymentEligibility.js.map
|
package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibility.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmploymentEligibility.js","sources":["../../../../../src/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibility.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"EmploymentEligibility.js","sources":["../../../../../src/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibility.tsx"],"sourcesContent":["import { APIError } from '@gusto/embedded-api/models/errors/apierror'\nimport { useI9VerificationGetAuthorization } from '@gusto/embedded-api/react-query/i9VerificationGetAuthorization'\nimport { useI9VerificationUpdateMutation } from '@gusto/embedded-api/react-query/i9VerificationUpdate'\nimport { EmploymentEligibilityPresentation } from './EmploymentEligibilityPresentation'\nimport type {\n EmploymentEligibilityInputs,\n EmploymentEligibilityPayload,\n} from './EmploymentEligibilitySchema'\nimport type { BaseComponentInterface } from '@/components/Base/Base'\nimport { BaseComponent } from '@/components/Base/Base'\nimport { useBase } from '@/components/Base'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\n\nexport interface EmploymentEligibilityProps extends BaseComponentInterface<'Employee.EmploymentEligibility'> {\n employeeId: string\n}\n\nexport function EmploymentEligibility(props: EmploymentEligibilityProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props} />\n </BaseComponent>\n )\n}\n\nconst Root = ({ employeeId, dictionary }: EmploymentEligibilityProps) => {\n useComponentDictionary('Employee.EmploymentEligibility', dictionary)\n useI18n('Employee.EmploymentEligibility')\n const { onEvent, baseSubmitHandler, LoadingIndicator } = useBase()\n\n const { data: i9AuthData, isLoading } = useI9VerificationGetAuthorization(\n { employeeId },\n {\n retry: false,\n throwOnError: (error: Error) => {\n return !(error instanceof APIError && error.httpMeta.response.status === 404)\n },\n },\n )\n\n const existingAuth = i9AuthData?.i9Authorization\n\n const { mutateAsync: updateI9Authorization, isPending } = useI9VerificationUpdateMutation()\n\n const handleSubmit = async (data: EmploymentEligibilityPayload) => {\n await baseSubmitHandler(data, async payload => {\n const { authorizationStatus, documentType, documentNumber, expirationDate, country } = payload\n\n if (!authorizationStatus) return\n\n const result = await updateI9Authorization({\n request: {\n employeeId,\n requestBody: {\n authorizationStatus,\n version: existingAuth?.version,\n ...(authorizationStatus === 'permanent_resident' &&\n documentNumber && {\n documentType: 'uscis_alien_registration_number',\n documentNumber,\n }),\n ...(authorizationStatus === 'alien' && {\n ...(documentNumber && documentType && { documentType, documentNumber }),\n expirationDate,\n ...(documentType === 'foreign_passport' && { country }),\n }),\n },\n },\n })\n\n onEvent(componentEvents.EMPLOYEE_EMPLOYMENT_ELIGIBILITY_DONE, result.i9Authorization)\n })\n }\n\n const defaultValues: Partial<EmploymentEligibilityInputs> = existingAuth\n ? {\n authorizationStatus: existingAuth.authorizationStatus,\n documentType: existingAuth.documentType ?? undefined,\n expirationDate: existingAuth.expirationDate\n ? new Date(existingAuth.expirationDate)\n : undefined,\n country: existingAuth.country ?? undefined,\n }\n : {}\n\n if (!isPending && isLoading) return <LoadingIndicator />\n\n return (\n <EmploymentEligibilityPresentation\n key={existingAuth?.uuid}\n onSubmit={handleSubmit}\n defaultValues={defaultValues}\n hasDocumentNumber={existingAuth?.hasDocumentNumber}\n isPending={isPending}\n />\n )\n}\n"],"names":["EmploymentEligibility","props","jsx","BaseComponent","Root","employeeId","dictionary","useComponentDictionary","useI18n","onEvent","baseSubmitHandler","LoadingIndicator","useBase","i9AuthData","isLoading","useI9VerificationGetAuthorization","error","APIError","existingAuth","updateI9Authorization","isPending","useI9VerificationUpdateMutation","handleSubmit","data","payload","authorizationStatus","documentType","documentNumber","expirationDate","country","result","componentEvents","defaultValues","EmploymentEligibilityPresentation"],"mappings":";;;;;;;;;AAkBO,SAASA,EAAsBC,GAAmC;AACvE,SACE,gBAAAC,EAACC,KAAe,GAAGF,GACjB,4BAACG,GAAA,EAAM,GAAGH,GAAO,EAAA,CACnB;AAEJ;AAEA,MAAMG,IAAO,CAAC,EAAE,YAAAC,GAAY,YAAAC,QAA6C;AACvE,EAAAC,EAAuB,kCAAkCD,CAAU,GACnEE,EAAQ,gCAAgC;AACxC,QAAM,EAAE,SAAAC,GAAS,mBAAAC,GAAmB,kBAAAC,EAAA,IAAqBC,EAAA,GAEnD,EAAE,MAAMC,GAAY,WAAAC,EAAA,IAAcC;AAAA,IACtC,EAAE,YAAAV,EAAA;AAAA,IACF;AAAA,MACE,OAAO;AAAA,MACP,cAAc,CAACW,MACN,EAAEA,aAAiBC,KAAYD,EAAM,SAAS,SAAS,WAAW;AAAA,IAC3E;AAAA,EACF,GAGIE,IAAeL,GAAY,iBAE3B,EAAE,aAAaM,GAAuB,WAAAC,EAAA,IAAcC,EAAA,GAEpDC,IAAe,OAAOC,MAAuC;AACjE,UAAMb,EAAkBa,GAAM,OAAMC,MAAW;AAC7C,YAAM,EAAE,qBAAAC,GAAqB,cAAAC,GAAc,gBAAAC,GAAgB,gBAAAC,GAAgB,SAAAC,MAAYL;AAEvF,UAAI,CAACC,EAAqB;AAE1B,YAAMK,IAAS,MAAMX,EAAsB;AAAA,QACzC,SAAS;AAAA,UACP,YAAAd;AAAA,UACA,aAAa;AAAA,YACX,qBAAAoB;AAAA,YACA,SAASP,GAAc;AAAA,YACvB,GAAIO,MAAwB,wBAC1BE,KAAkB;AAAA,cAChB,cAAc;AAAA,cACd,gBAAAA;AAAA,YAAA;AAAA,YAEJ,GAAIF,MAAwB,WAAW;AAAA,cACrC,GAAIE,KAAkBD,KAAgB,EAAE,cAAAA,GAAc,gBAAAC,EAAA;AAAA,cACtD,gBAAAC;AAAA,cACA,GAAIF,MAAiB,sBAAsB,EAAE,SAAAG,EAAA;AAAA,YAAQ;AAAA,UACvD;AAAA,QACF;AAAA,MACF,CACD;AAED,MAAApB,EAAQsB,EAAgB,sCAAsCD,EAAO,eAAe;AAAA,IACtF,CAAC;AAAA,EACH,GAEME,IAAsDd,IACxD;AAAA,IACE,qBAAqBA,EAAa;AAAA,IAClC,cAAcA,EAAa,gBAAgB;AAAA,IAC3C,gBAAgBA,EAAa,iBACzB,IAAI,KAAKA,EAAa,cAAc,IACpC;AAAA,IACJ,SAASA,EAAa,WAAW;AAAA,EAAA,IAEnC,CAAA;AAEJ,SAAI,CAACE,KAAaN,sBAAmBH,GAAA,CAAA,CAAiB,IAGpD,gBAAAT;AAAA,IAAC+B;AAAA,IAAA;AAAA,MAEC,UAAUX;AAAA,MACV,eAAAU;AAAA,MACA,mBAAmBd,GAAc;AAAA,MACjC,WAAAE;AAAA,IAAA;AAAA,IAJKF,GAAc;AAAA,EAAA;AAOzB;"}
|