@sheerid/jslib-nightly
Version:
SheerID JavaScript Library
464 lines (462 loc) • 15.8 kB
JavaScript
/**
* VERSION: 2.130.0-alpha.4
* BUILD_TIMESTAMP: 1759000374473
* BUILD_DATE: Sat Sep 27 2025 19:12:54 GMT+0000 (Coordinated Universal Time)
* BUILD_COMMIT: be6ef87ab40e8747994d32363389cf39e36a4326
*/
import { k as da, aQ as m, aR as na, D as ra, V as f, j as s, O as la, m as ua, a2 as ma, f as d, ac as ia, aS as ba, aq as ga, o as n, T as Ca, U as pa, a5 as ha, E as Ea, n as Na, Y as Ia, W as xa, aa as Ma, aN as ja, aT as za, aU as Da, a6 as ya, X as Ra, y as Fa, z as La, aj as Oa, ak as Ta, aM as qa, Z as Aa, _ as Pa, $ as wa, p as ka, q as _a, aV as Ba, i as z, l as Wa, aW as Ya, aX as Va, a4 as C, ax as Ua, ar as Ha, aL as $a, a3 as Ka, an as Xa, av as Qa, r as Za, aY as Ga } from "./es6-N0LU_o1K.js";
import N from "react";
import { injectIntl as Ja, FormattedHTMLMessage as D } from "react-intl";
import { L as ca } from "./LicensedProfessionalOrganizationComponent-CFfFH2gr.js";
const fa = ({
intl: I,
verificationService: e
}) => {
var F, L, O, T, q, A, P, w, k, _, B, W, Y, V, U, H, $, K, X, Q;
const t = e.viewModel, { updateViewModel: y, programTheme: S } = e, [p, v] = N.useState(void 0), u = (a) => p && p.some((i) => i.key === a), { fieldValidationErrors: o } = e, h = e.verificationResponse, aa = da(h), l = (a, i) => {
const g = Za(
t,
(E) => {
E[a] = i;
}
);
y(g);
}, ea = (a) => {
const i = Ga(
t,
a
);
y(i);
}, x = t.localeChoice.value, sa = la(), { segment: b, availableStatuses: M } = h, ta = b.charAt(0).toUpperCase() + b.slice(1), R = () => M && (b === m.FIRST_RESPONDER || b === m.MEDICAL || b === m.LOW_INCOME || b === m.LICENSED_PROFESSIONAL || b === m.EMPLOYMENT || b === m.RECENT_MOVER || b === m.MILITARY), j = (a) => (async () => {
try {
const i = await Ba(
h.verificationId,
h.currentStep,
a
), g = z(() => i.fieldsToCollect.required, []);
R() && g.push({ key: "status" }), ea(g), v(g);
} catch (i) {
Wa.error(`Failed to determine fields to collect: ${i}`);
}
})(), oa = () => {
var a, i, g, E, Z, G, J, c;
switch (b) {
case m.STUDENT:
return /* @__PURE__ */ s.jsx(
Qa,
{
value: e.viewModel.organization,
verificationService: e,
isErrored: !!o.organization,
isRequired: !0,
disabled: (a = d("organization")) == null ? void 0 : a.disabled,
onChange: (r) => {
C(r, e), n("organization", r, e);
}
}
);
case m.TEACHER:
return /* @__PURE__ */ s.jsx(
Xa,
{
value: e.viewModel.organization,
verificationService: e,
isErrored: !!o.organization,
disabled: (i = d("organization")) == null ? void 0 : i.disabled,
onChange: (r) => {
C(r, e), n("organization", r, e);
}
}
);
case m.MEMBER:
return /* @__PURE__ */ s.jsx(
Ka,
{
value: e.viewModel.organization,
verificationService: e,
isErrored: !!o.organization,
disabled: (g = d("organization")) == null ? void 0 : g.disabled,
onChange: (r) => {
C(r, e), n("organization", r, e);
}
}
);
case m.MILITARY:
return /* @__PURE__ */ s.jsx(
$a,
{
isErrored: !!o.organization,
onChange: (r) => {
C(r, e), n("organization", r, e);
},
value: {
value: z(
() => e.viewModel.organization.id
),
label: z(
() => e.viewModel.organization.name
)
},
verificationService: e,
disabled: (E = d("organization")) == null ? void 0 : E.disabled
}
);
case m.FIRST_RESPONDER:
return /* @__PURE__ */ s.jsx(
Ha,
{
isErrored: !!o.organization,
onChange: (r) => {
C(r, e), n("organization", r, e);
},
value: e.viewModel.organization,
verificationService: e,
disabled: (Z = d("organization")) == null ? void 0 : Z.disabled
}
);
case m.MEDICAL:
return /* @__PURE__ */ s.jsx(
Ua,
{
isErrored: !!o.organization,
onChange: (r) => {
C(r, e), n("organization", r, e);
},
value: e.viewModel.organization,
verificationService: e,
disabled: (G = d("organization")) == null ? void 0 : G.disabled
}
);
case m.LICENSED_PROFESSIONAL:
return /* @__PURE__ */ s.jsx(
ca,
{
isErrored: !!o.organization,
onChange: (r) => {
C(r, e), n("organization", r, e);
},
value: e.viewModel.organization,
verificationService: e,
disabled: (J = d("organization")) == null ? void 0 : J.disabled
}
);
case m.LOW_INCOME:
return /* @__PURE__ */ s.jsx(
Ya,
{
isErrored: !!o.organization,
onChange: (r) => {
C(r, e), n("organization", r, e);
},
value: Va(
e.viewModel.organization
),
verificationService: e,
isRequired: !0,
disabled: (c = d("organization")) == null ? void 0 : c.disabled
}
);
default:
return null;
}
};
return N.useEffect(() => {
M && b === m.MILITARY ? j({ statuses: [] }) : j({});
}, []), N.useEffect(() => {
!na(S).enabled && p && p.length === 0 && ra(t, e, f.collectPersonalInfo);
}, [p]), N.useEffect(() => {
t.status && j({ statuses: [t.status] });
}, [t.status]), /* @__PURE__ */ s.jsxs(
"div",
{
id: "sid-step-personal-info-personal-info",
className: "sid-personal-info-container sid-l-container",
children: [
/* @__PURE__ */ s.jsxs("div", { role: "main", children: [
/* @__PURE__ */ s.jsx(
ua,
{
verificationService: e,
classNameIdentifier: "personal-info"
}
),
/* @__PURE__ */ s.jsx(
ma,
{
verificationService: e,
disabled: (F = d("country")) == null ? void 0 : F.disabled
}
),
R() && /* @__PURE__ */ s.jsx(
ia,
{
segmentId: b,
value: {
value: t.status,
label: ga(I, t.status, null)
},
isErrored: !!o.status,
errorId: `invalid${ta}Status`,
options: ba(I, M),
disabled: (L = d("status")) == null ? void 0 : L.disabled,
onChange: (a) => {
l("status", a ? a.value : ""), n(
"status",
a ? a.value : "",
e
);
}
}
),
u("organization") && oa(),
/* @__PURE__ */ s.jsxs("div", { className: "sid-names", children: [
u("firstName") && /* @__PURE__ */ s.jsx(
Ca,
{
value: t.firstName,
isErrored: !!o.firstName,
disabled: (O = d("firstName")) == null ? void 0 : O.disabled,
onChange: (a) => {
l("firstName", a), n("firstName", a, e);
}
}
),
u("lastName") && /* @__PURE__ */ s.jsx(
pa,
{
value: t.lastName,
isErrored: !!o.lastName,
disabled: (T = d("lastName")) == null ? void 0 : T.disabled,
onChange: (a) => {
l("lastName", a), n("lastName", a, e);
}
}
)
] }),
u("birthDate") && /* @__PURE__ */ s.jsx(
ha,
{
value: t.birthDate,
errorId: o.birthDate,
locale: x,
isRequired: !0,
disabled: (q = d("birthDate")) == null ? void 0 : q.disabled,
onChange: (a) => {
l("birthDate", a), n("birthDate", a, e);
}
}
),
u("email") && /* @__PURE__ */ s.jsx(
Ea,
{
value: t.email,
isErrored: !!o.email,
explanation: " ",
onChange: (a) => {
l("email", a), n("email", a, e);
},
onKeyDown: (a) => Na(a),
disabled: (A = d("email")) == null ? void 0 : A.disabled
}
),
u("phoneNumber") && /* @__PURE__ */ s.jsx(
Ia,
{
isRequired: !!e.programTheme.smsLoopEnabled,
value: t.phoneNumber,
isErrored: !!o.phoneNumber,
onChange: (a) => {
l("phoneNumber", a), n("phoneNumber", a, e);
},
selectedCountryCode: t.countryChoice && t.countryChoice.value,
disabled: (P = d("phoneNumber")) == null ? void 0 : P.disabled
}
),
u("address1") && /* @__PURE__ */ s.jsx(
xa,
{
value: t.address1,
isRequired: !0,
isErrored: !!o.address1,
errorId: o.address1,
disabled: (w = d("address1")) == null ? void 0 : w.disabled,
onChange: (a) => {
l("address1", a), n("address1", a, e);
}
}
),
u("city") && /* @__PURE__ */ s.jsx(
Ma,
{
value: t.city,
isRequired: !0,
isErrored: !!o.city,
errorId: o.city,
disabled: (k = d("city")) == null ? void 0 : k.disabled,
onChange: (a) => {
l("city", a), n("city", a, e);
}
}
),
u("dischargeDate") && /* @__PURE__ */ s.jsx(
ja,
{
errorId: o.dischargeDate,
locale: x,
onChange: (a) => {
l("dischargeDate", a), n("dischargeDate", a, e);
},
value: t.dischargeDate,
disabled: (_ = d("dischargeDate")) == null ? void 0 : _.disabled
}
),
u("driverLicenseNumber") && /* @__PURE__ */ s.jsx(
za,
{
value: t.driverLicenseNumber,
isErrored: !!o.driverLicenseNumber,
isRequired: !0,
disabled: (B = d("driverLicenseNumber")) == null ? void 0 : B.disabled,
onChange: (a) => {
l("driverLicenseNumber", a), n(
"driverLicenseNumber",
a,
e
);
}
}
),
u("ebtCardNumber") && /* @__PURE__ */ s.jsx(
Da,
{
value: t.ebtCardNumber,
isErrored: !!o.ebtCardNumber,
disabled: (W = d("ebtCardNumber")) == null ? void 0 : W.disabled,
onChange: (a) => {
l("ebtCardNumber", a), n("ebtCardNumber", a, e);
}
}
),
u("memberId") && /* @__PURE__ */ s.jsx(
ya,
{
value: t.memberId,
isErrored: !!o.memberId,
isRequired: (Y = d("memberId")) == null ? void 0 : Y.requireIfOptional,
disabled: (V = d("memberId")) == null ? void 0 : V.disabled,
onChange: (a) => {
l("memberId", a), n("memberId", a, e);
},
label: /* @__PURE__ */ s.jsx(
D,
{
id: "step.collectMedicalPersonalInfo.registrationNumberLabel",
defaultMessage: "Registration Number"
}
)
}
),
u("postalCode") && /* @__PURE__ */ s.jsx(
Ra,
{
isErrored: !!o.postalCode,
onChange: (a) => {
l("postalCode", a), n("postalCode", a, e);
},
value: t.postalCode,
disabled: (U = d("postalCode")) == null ? void 0 : U.disabled
}
),
u("socialSecurityNumber") && /* @__PURE__ */ s.jsx("div", { className: "sid-ssn-wrapper", children: /* @__PURE__ */ s.jsx(
Fa,
{
value: t.socialSecurityNumber,
onChange: (a) => {
l("socialSecurityNumber", a), n(
"socialSecurityNumber",
a,
e
);
},
isErrored: !!o[La.socialSecurityNumber],
placeholder: "000-00-0000",
disabled: (H = d("socialSecurityNumber")) == null ? void 0 : H.disabled
}
) }),
u("state") && /* @__PURE__ */ s.jsx(
Oa,
{
isRequired: !0,
options: Ta(e.programTheme, I),
value: t.state || void 0,
isErrored: !!o.state,
onChange: async (a) => {
const i = a ? a.value : void 0;
l("state", i), n("state", i, e);
},
label: /* @__PURE__ */ s.jsx(D, { id: "state", defaultMessage: "State" }),
disabled: ($ = d("state")) == null ? void 0 : $.disabled
}
),
u("activeDutyStartDate") && e.programTheme.strictMilitaryValidationEnabled && /* @__PURE__ */ s.jsx(
qa,
{
errorId: o.activeDutyStartDate,
locale: x,
onChange: (a) => {
l("activeDutyStartDate", a), n(
"activeDutyStartDate",
a,
e
);
},
value: t.activeDutyStartDate,
disabled: (K = d("activeDutyStartDate")) == null ? void 0 : K.disabled
}
),
(X = sa.customFormFields) == null ? void 0 : X.map((a) => /* @__PURE__ */ s.jsx(Aa, { config: a, verificationService: e })),
/* @__PURE__ */ s.jsx(
Pa,
{
verificationService: e,
isErrored: !!o.marketConsentValue,
onChange: (a) => {
l("metadata", {
...e.viewModel.metadata,
marketConsentValue: a
}), n(
"marketConsentValue",
a,
e
);
},
viewModel: t,
disabled: (Q = d("marketConsentValue")) == null ? void 0 : Q.disabled
}
),
/* @__PURE__ */ s.jsx(wa, { suffix: "CollectAboveSubmit" }),
/* @__PURE__ */ s.jsx(
ka,
{
step: f.collectPersonalInfo,
verificationService: e,
viewModel: t,
failedInstantMatch: aa,
buttonText: /* @__PURE__ */ s.jsx(
D,
{
id: "step.personalInfo.submitButtonText",
defaultMessage: "Verify and continue"
}
)
}
)
] }),
/* @__PURE__ */ s.jsx(_a, { verificationService: e })
]
}
);
}, se = Ja(fa);
export {
se as default
};