UNPKG

@sheerid/jslib-nightly

Version:

SheerID JavaScript Library

462 lines (460 loc) • 15.7 kB
/** * VERSION: 2.130.0-alpha.4 * BUILD_TIMESTAMP: 1759000305348 * BUILD_DATE: Sat Sep 27 2025 19:11:45 GMT+0000 (Coordinated Universal Time) * BUILD_COMMIT: be6ef87ab40e8747994d32363389cf39e36a4326 */ import { i as da, R as N, h as na, aM as m, aN as ra, N as la, V as f, j as s, w as ua, P as ma, T as ia, g as d, a3 as ba, aO as ga, ac as Ca, f as n, y as pa, z as ha, X as Ea, E as Na, e as Ia, G as xa, B as Ma, a1 as za, aD as Da, aP as ja, aQ as Ra, Y as ya, b as D, D as Fa, S as La, J as Oa, a6 as Ta, a7 as qa, aC as Pa, H as Aa, M as wa, I as Ba, k as ka, m as Wa, aR as _a, d as j, l as Ya, aS as Ha, aT as Ua, W as C, an as Va, ae as Ka, aB as $a, U as Ga, aa as Ja, ak as Qa, n as Xa, aU as Za } from "../sheerid.js"; import { L as ca } from "./LicensedProfessionalOrganizationComponent-CiYU-2dW.js"; const fa = ({ intl: I, verificationService: e }) => { var F, L, O, T, q, P, A, w, B, k, W, _, Y, H, U, V, K, $, G, J; const t = e.viewModel, { updateViewModel: R, 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 = na(h), l = (a, i) => { const g = Xa( t, (E) => { E[a] = i; } ); R(g); }, ea = (a) => { const i = Za( t, a ); R(i); }, x = t.localeChoice.value, sa = ua(), { segment: b, availableStatuses: M } = h, ta = b.charAt(0).toUpperCase() + b.slice(1), y = () => 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), z = (a) => (async () => { try { const i = await _a( h.verificationId, h.currentStep, a ), g = j(() => i.fieldsToCollect.required, []); y() && g.push({ key: "status" }), ea(g), v(g); } catch (i) { Ya.error(`Failed to determine fields to collect: ${i}`); } })(), oa = () => { var a, i, g, E, Q, X, Z, 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( Ja, { 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( Ga, { 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: j( () => e.viewModel.organization.id ), label: j( () => e.viewModel.organization.name ) }, verificationService: e, disabled: (E = d("organization")) == null ? void 0 : E.disabled } ); case m.FIRST_RESPONDER: return /* @__PURE__ */ s.jsx( Ka, { isErrored: !!o.organization, onChange: (r) => { C(r, e), n("organization", r, e); }, value: e.viewModel.organization, verificationService: e, disabled: (Q = d("organization")) == null ? void 0 : Q.disabled } ); case m.MEDICAL: return /* @__PURE__ */ s.jsx( Va, { isErrored: !!o.organization, onChange: (r) => { C(r, e), n("organization", r, e); }, value: e.viewModel.organization, verificationService: e, disabled: (X = d("organization")) == null ? void 0 : X.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: (Z = d("organization")) == null ? void 0 : Z.disabled } ); case m.LOW_INCOME: return /* @__PURE__ */ s.jsx( Ha, { isErrored: !!o.organization, onChange: (r) => { C(r, e), n("organization", r, e); }, value: Ua( 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 ? z({ statuses: [] }) : z({}); }, []), N.useEffect(() => { !ra(S).enabled && p && p.length === 0 && la(t, e, f.collectPersonalInfo); }, [p]), N.useEffect(() => { t.status && z({ 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( ma, { verificationService: e, classNameIdentifier: "personal-info" } ), /* @__PURE__ */ s.jsx( ia, { verificationService: e, disabled: (F = d("country")) == null ? void 0 : F.disabled } ), y() && /* @__PURE__ */ s.jsx( ba, { segmentId: b, value: { value: t.status, label: Ca(I, t.status, null) }, isErrored: !!o.status, errorId: `invalid${ta}Status`, options: ga(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( pa, { 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( ha, { 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( Ea, { 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( Na, { value: t.email, isErrored: !!o.email, explanation: " ", onChange: (a) => { l("email", a), n("email", a, e); }, onKeyDown: (a) => Ia(a), disabled: (P = d("email")) == null ? void 0 : P.disabled } ), u("phoneNumber") && /* @__PURE__ */ s.jsx( xa, { 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( Ma, { 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( za, { 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( Da, { errorId: o.dischargeDate, locale: x, onChange: (a) => { l("dischargeDate", a), n("dischargeDate", a, e); }, value: t.dischargeDate, disabled: (k = d("dischargeDate")) == null ? void 0 : k.disabled } ), u("driverLicenseNumber") && /* @__PURE__ */ s.jsx( ja, { value: t.driverLicenseNumber, isErrored: !!o.driverLicenseNumber, isRequired: !0, disabled: (W = d("driverLicenseNumber")) == null ? void 0 : W.disabled, onChange: (a) => { l("driverLicenseNumber", a), n( "driverLicenseNumber", a, e ); } } ), u("ebtCardNumber") && /* @__PURE__ */ s.jsx( Ra, { value: t.ebtCardNumber, isErrored: !!o.ebtCardNumber, disabled: (_ = d("ebtCardNumber")) == null ? void 0 : _.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: (H = d("memberId")) == null ? void 0 : H.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( Fa, { 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( La, { value: t.socialSecurityNumber, onChange: (a) => { l("socialSecurityNumber", a), n( "socialSecurityNumber", a, e ); }, isErrored: !!o[Oa.socialSecurityNumber], placeholder: "000-00-0000", disabled: (V = d("socialSecurityNumber")) == null ? void 0 : V.disabled } ) }), u("state") && /* @__PURE__ */ s.jsx( Ta, { isRequired: !0, options: qa(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( Pa, { errorId: o.activeDutyStartDate, locale: x, onChange: (a) => { l("activeDutyStartDate", a), n( "activeDutyStartDate", a, e ); }, value: t.activeDutyStartDate, disabled: ($ = d("activeDutyStartDate")) == null ? void 0 : $.disabled } ), (G = sa.customFormFields) == null ? void 0 : G.map((a) => /* @__PURE__ */ s.jsx(Aa, { config: a, verificationService: e })), /* @__PURE__ */ s.jsx( wa, { verificationService: e, isErrored: !!o.marketConsentValue, onChange: (a) => { l("metadata", { ...e.viewModel.metadata, marketConsentValue: a }), n( "marketConsentValue", a, e ); }, viewModel: t, disabled: (J = d("marketConsentValue")) == null ? void 0 : J.disabled } ), /* @__PURE__ */ s.jsx(Ba, { 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(Wa, { verificationService: e }) ] } ); }, ae = da(fa); export { ae as default };