UNPKG

@sheerid/jslib-nightly

Version:

SheerID JavaScript Library

464 lines (462 loc) • 15.8 kB
/** * VERSION: 2.113.0-alpha.0 * BUILD_TIMESTAMP: 1750184680813 * BUILD_DATE: Tue Jun 17 2025 18:24:40 GMT+0000 (Coordinated Universal Time) * BUILD_COMMIT: 896154e79f58fffa6d52f3ed37f2db760a63df88 */ import { k as da, aP as m, aQ as na, B as ra, V as f, j as s, N as la, m as ua, a1 as ma, f as d, ab as ia, aR as ba, ap as ga, u as n, O as Ca, T as pa, a4 as ha, E as Ea, n as Na, X as Ia, U as xa, a9 as Ma, aM as ja, aS as za, aT as Da, a5 as ya, W as Ra, x as Fa, y as La, ai as Oa, aj as Ta, aL as qa, Y as Pa, Z as Aa, _ as wa, o as Ba, p as _a, aU as ka, i as z, l as Wa, aV as Va, aW as Ya, a3 as C, aw as Ua, aq as Ha, aK as Ka, a2 as Xa, am as $a, au as Qa, q as Za, aX as Ga } from "./es6-B9qAIX4x.js"; import N from "react"; import { injectIntl as Ja, FormattedHTMLMessage as D } from "react-intl"; import { L as ca } from "./LicensedProfessionalOrganizationComponent-H9w53uDB.js"; const fa = ({ intl: I, verificationService: e }) => { var F, L, O, T, q, P, A, w, B, _, k, W, V, Y, 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 ka( 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( $a, { 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( Xa, { 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( Ka, { 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( Va, { isErrored: !!o.organization, onChange: (r) => { C(r, e), n("organization", r, e); }, value: Ya( 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: (P = d("email")) == null ? void 0 : P.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: (A = d("phoneNumber")) == null ? void 0 : A.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: (B = d("city")) == null ? void 0 : B.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: (k = d("driverLicenseNumber")) == null ? void 0 : k.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: (V = d("memberId")) == null ? void 0 : V.requireIfOptional, disabled: (Y = d("memberId")) == null ? void 0 : Y.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: (K = d("state")) == null ? void 0 : K.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: (X = d("activeDutyStartDate")) == null ? void 0 : X.disabled } ), ($ = sa.customFormFields) == null ? void 0 : $.map((a) => /* @__PURE__ */ s.jsx(Pa, { config: a, verificationService: e })), /* @__PURE__ */ s.jsx( Aa, { 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, { verificationService: e, suffix: "CollectAboveSubmit" }), /* @__PURE__ */ s.jsx( Ba, { 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 };