UNPKG

@sheerid/jslib-nightly

Version:

SheerID JavaScript Library

460 lines (458 loc) • 14.9 kB
/** * VERSION: 2.154.0-alpha.1 * BUILD_TIMESTAMP: 1763401515326 * BUILD_DATE: Mon Nov 17 2025 17:45:15 GMT+0000 (Coordinated Universal Time) * BUILD_COMMIT: 73f4468155aaed0f31ab0d59dc3394018b939b6d */ import { i as w, R as h, h as k, aO as u, aP as B, U as _, V as R, j as s, y as W, P as V, Y, a as d, a9 as H, aQ as U, ab as K, k as n, B as $, D as G, $ as J, E as Q, f as Z, J as X, G as c, a7 as f, au as S, aR as v, aS as aa, a0 as ea, c as M, H as sa, S as ta, O as oa, aj as da, ak as na, at as ra, K as la, M as ua, N as ma, m as ia, n as ba, aT as ga, e as j, l as Ca, aU as pa, aV as ha, _ as b, ao as Ea, ad as Na, as as Ia, Z as xa, a1 as Ma, ag as ja, o as za, aW as Da } from "../sheerid.js"; import { L as Ra } from "./LicensedProfessionalOrganizationComponent-C8XqJ4_r.js"; const ya = ({ intl: E, verificationService: e }) => { const t = e.viewModel, { updateViewModel: z, programTheme: y } = e, [g, F] = h.useState(void 0), l = (a) => g && g.some((i) => i.key === a), { fieldValidationErrors: o } = e, p = e.verificationResponse, L = k(p), r = (a, i) => { const C = za( t, (A) => { A[a] = i; } ); z(C); }, O = (a) => { const i = Da( t, a ); z(i); }, N = t.localeChoice.value, T = W(), { segment: m, availableStatuses: I } = p, q = m.charAt(0).toUpperCase() + m.slice(1), D = () => I && (m === u.FIRST_RESPONDER || m === u.MEDICAL || m === u.LOW_INCOME || m === u.LICENSED_PROFESSIONAL || m === u.EMPLOYMENT || m === u.RECENT_MOVER || m === u.MILITARY), x = (a) => (async () => { try { const i = await ga( p.verificationId, p.currentStep, a ), C = j(() => i.fieldsToCollect.required, []); D() && C.push({ key: "status" }), O(C), F(C); } catch (i) { Ca.error(`Failed to determine fields to collect: ${i}`); } })(), P = () => { switch (m) { case u.STUDENT: return /* @__PURE__ */ s.jsx( ja, { value: e.viewModel.organization, verificationService: e, isErrored: !!o.organization, isRequired: !0, disabled: d("organization")?.disabled, onChange: (a) => { b(a, e), n("organization", a, e); } } ); case u.TEACHER: return /* @__PURE__ */ s.jsx( Ma, { value: e.viewModel.organization, verificationService: e, isErrored: !!o.organization, disabled: d("organization")?.disabled, onChange: (a) => { b(a, e), n("organization", a, e); } } ); case u.MEMBER: return /* @__PURE__ */ s.jsx( xa, { value: e.viewModel.organization, verificationService: e, isErrored: !!o.organization, disabled: d("organization")?.disabled, onChange: (a) => { b(a, e), n("organization", a, e); } } ); case u.MILITARY: return /* @__PURE__ */ s.jsx( Ia, { isErrored: !!o.organization, onChange: (a) => { b(a, e), n("organization", a, e); }, value: { value: j( () => e.viewModel.organization.id ), label: j( () => e.viewModel.organization.name ) }, verificationService: e, disabled: d("organization")?.disabled } ); case u.FIRST_RESPONDER: return /* @__PURE__ */ s.jsx( Na, { isErrored: !!o.organization, onChange: (a) => { b(a, e), n("organization", a, e); }, value: e.viewModel.organization, verificationService: e, disabled: d("organization")?.disabled } ); case u.MEDICAL: return /* @__PURE__ */ s.jsx( Ea, { isErrored: !!o.organization, onChange: (a) => { b(a, e), n("organization", a, e); }, value: e.viewModel.organization, verificationService: e, disabled: d("organization")?.disabled } ); case u.LICENSED_PROFESSIONAL: return /* @__PURE__ */ s.jsx( Ra, { isErrored: !!o.organization, onChange: (a) => { b(a, e), n("organization", a, e); }, value: e.viewModel.organization, verificationService: e, disabled: d("organization")?.disabled } ); case u.LOW_INCOME: return /* @__PURE__ */ s.jsx( pa, { isErrored: !!o.organization, onChange: (a) => { b(a, e), n("organization", a, e); }, value: ha( e.viewModel.organization ), verificationService: e, isRequired: !0, disabled: d("organization")?.disabled } ); default: return null; } }; return h.useEffect(() => { I && m === u.MILITARY ? x({ statuses: [] }) : x({}); }, []), h.useEffect(() => { !B(y).enabled && g && g.length === 0 && _(t, e, R.collectPersonalInfo); }, [g]), h.useEffect(() => { t.status && x({ 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( V, { verificationService: e, classNameIdentifier: "personal-info" } ), /* @__PURE__ */ s.jsx( Y, { verificationService: e, disabled: d("country")?.disabled } ), D() && /* @__PURE__ */ s.jsx( H, { segmentId: m, value: { value: t.status, label: K(E, t.status, null) }, isErrored: !!o.status, errorId: `invalid${q}Status`, options: U(E, I), disabled: d("status")?.disabled, onChange: (a) => { r("status", a ? a.value : ""), n( "status", a ? a.value : "", e ); } } ), l("organization") && P(), /* @__PURE__ */ s.jsxs("div", { className: "sid-names", children: [ l("firstName") && /* @__PURE__ */ s.jsx( $, { value: t.firstName, isErrored: !!o.firstName, disabled: d("firstName")?.disabled, onChange: (a) => { r("firstName", a), n("firstName", a, e); } } ), l("lastName") && /* @__PURE__ */ s.jsx( G, { value: t.lastName, isErrored: !!o.lastName, disabled: d("lastName")?.disabled, onChange: (a) => { r("lastName", a), n("lastName", a, e); } } ) ] }), l("birthDate") && /* @__PURE__ */ s.jsx( J, { value: t.birthDate, errorId: o.birthDate, locale: N, isRequired: !0, disabled: d("birthDate")?.disabled, onChange: (a) => { r("birthDate", a), n("birthDate", a, e); } } ), l("email") && /* @__PURE__ */ s.jsx( Q, { value: t.email, isErrored: !!o.email, explanation: " ", onChange: (a) => { r("email", a), n("email", a, e); }, onKeyDown: (a) => Z(a), disabled: d("email")?.disabled } ), l("phoneNumber") && /* @__PURE__ */ s.jsx( X, { isRequired: !!e.programTheme.smsLoopEnabled, value: t.phoneNumber, isErrored: !!o.phoneNumber, onChange: (a) => { r("phoneNumber", a), n("phoneNumber", a, e); }, selectedCountryCode: t.countryChoice && t.countryChoice.value, disabled: d("phoneNumber")?.disabled } ), l("address1") && /* @__PURE__ */ s.jsx( c, { value: t.address1, isRequired: !0, isErrored: !!o.address1, errorId: o.address1, disabled: d("address1")?.disabled, onChange: (a) => { r("address1", a), n("address1", a, e); } } ), l("city") && /* @__PURE__ */ s.jsx( f, { value: t.city, isRequired: !0, isErrored: !!o.city, errorId: o.city, disabled: d("city")?.disabled, onChange: (a) => { r("city", a), n("city", a, e); } } ), l("dischargeDate") && /* @__PURE__ */ s.jsx( S, { errorId: o.dischargeDate, locale: N, onChange: (a) => { r("dischargeDate", a), n("dischargeDate", a, e); }, value: t.dischargeDate, disabled: d("dischargeDate")?.disabled } ), l("driverLicenseNumber") && /* @__PURE__ */ s.jsx( v, { value: t.driverLicenseNumber, isErrored: !!o.driverLicenseNumber, isRequired: !0, disabled: d("driverLicenseNumber")?.disabled, onChange: (a) => { r("driverLicenseNumber", a), n( "driverLicenseNumber", a, e ); } } ), l("ebtCardNumber") && /* @__PURE__ */ s.jsx( aa, { value: t.ebtCardNumber, isErrored: !!o.ebtCardNumber, disabled: d("ebtCardNumber")?.disabled, onChange: (a) => { r("ebtCardNumber", a), n("ebtCardNumber", a, e); } } ), l("memberId") && /* @__PURE__ */ s.jsx( ea, { value: t.memberId, isErrored: !!o.memberId, isRequired: d("memberId")?.requireIfOptional, disabled: d("memberId")?.disabled, onChange: (a) => { r("memberId", a), n("memberId", a, e); }, label: /* @__PURE__ */ s.jsx( M, { id: "step.collectMedicalPersonalInfo.registrationNumberLabel", defaultMessage: "Registration Number" } ) } ), l("postalCode") && /* @__PURE__ */ s.jsx( sa, { isErrored: !!o.postalCode, onChange: (a) => { r("postalCode", a), n("postalCode", a, e); }, value: t.postalCode, disabled: d("postalCode")?.disabled } ), l("socialSecurityNumber") && /* @__PURE__ */ s.jsx("div", { className: "sid-ssn-wrapper", children: /* @__PURE__ */ s.jsx( ta, { value: t.socialSecurityNumber, onChange: (a) => { r("socialSecurityNumber", a), n( "socialSecurityNumber", a, e ); }, isErrored: !!o[oa.socialSecurityNumber], placeholder: "000-00-0000", disabled: d("socialSecurityNumber")?.disabled } ) }), l("state") && /* @__PURE__ */ s.jsx( da, { isRequired: !0, options: na(e.programTheme, E), value: t.state || void 0, isErrored: !!o.state, onChange: async (a) => { const i = a ? a.value : void 0; r("state", i), n("state", i, e); }, label: /* @__PURE__ */ s.jsx(M, { id: "state", defaultMessage: "State" }), disabled: d("state")?.disabled } ), l("activeDutyStartDate") && e.programTheme.strictMilitaryValidationEnabled && /* @__PURE__ */ s.jsx( ra, { errorId: o.activeDutyStartDate, locale: N, onChange: (a) => { r("activeDutyStartDate", a), n( "activeDutyStartDate", a, e ); }, value: t.activeDutyStartDate, disabled: d("activeDutyStartDate")?.disabled } ), T.customFormFields?.map((a) => /* @__PURE__ */ s.jsx(la, { config: a, verificationService: e })), /* @__PURE__ */ s.jsx( ua, { verificationService: e, isErrored: !!o.marketConsentValue, onChange: (a) => { r("metadata", { ...e.viewModel.metadata, marketConsentValue: a }), n( "marketConsentValue", a, e ); }, viewModel: t, disabled: d("marketConsentValue")?.disabled } ), /* @__PURE__ */ s.jsx(ma, { verificationService: e, suffix: "CollectAboveSubmit" }), /* @__PURE__ */ s.jsx( ia, { step: R.collectPersonalInfo, verificationService: e, viewModel: t, failedInstantMatch: L, buttonText: /* @__PURE__ */ s.jsx( M, { id: "step.personalInfo.submitButtonText", defaultMessage: "Verify and continue" } ) } ) ] }), /* @__PURE__ */ s.jsx(ba, { verificationService: e }) ] } ); }, Oa = w(ya); export { Oa as default };