UNPKG

@sheerid/jslib-nightly

Version:

SheerID JavaScript Library

273 lines (271 loc) • 9.33 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 A, h as G, j as a, v as U, P as X, a9 as J, E as z, g as n, f as d, b as g, d as m, w as Q, x as Y, T as Z, a3 as _, ab as $, ac as c, ad as S, ae as v, af as ee, n as D, y as se, z as ae, X as oe, e as ne, G as te, D as de, H as le, M as re, I as me, k as pe, V as ie } from "../sheerid.js"; import { u as ue, E as ge } from "./useEmailFirstExperiment-DH410dM-.js"; const Ce = ({ intl: C, verificationService: s }) => { var h, x, E, j, F, N, M, R, I, y, k; const o = s.viewModel, { fieldValidationErrors: t } = s, p = s.verificationResponse, L = G(p), P = Q(), T = o.localeChoice.value, l = (e, u) => { const r = D( o, (q) => { q[e] = u; } ); s.updateViewModel(r); }, { isEmailUpTop: i, isEmailValidationLoading: O, showFormFields: f, emailLookupResponse: b, emailOnBlur: w, emailOnKeyDown: B, handleResendClick: V, showEmailLookupResponseMessages: H, enableFormFields: K, handleOnClickProceedHere: W } = ue( s.programId, o.email, s.verificationResponse.segment ); return /* @__PURE__ */ a.jsxs( U, { verificationService: s, step: p.currentStep, children: [ /* @__PURE__ */ a.jsx( X, { verificationService: s, classNameIdentifier: "first-responder" } ), // #region email-first-experiment i && /* @__PURE__ */ a.jsx(a.Fragment, { children: /* @__PURE__ */ a.jsxs("div", { className: "email-input-wrapper", children: [ O && /* @__PURE__ */ a.jsx("div", { className: "email-input-wrapper-frame", children: /* @__PURE__ */ a.jsx("div", { className: "sid-spinner scaled", children: /* @__PURE__ */ a.jsx(J, {}) }) }), /* @__PURE__ */ a.jsx( z, { value: o.email, isErrored: !!t.email, explanation: /* @__PURE__ */ a.jsx( g, { id: "emailExplanation", defaultMessage: "Personal email address is recommended" } ), onChange: (e) => { l("email", e), d("email", e, s); }, onKeyDown: B, onBlur: w, disabled: (h = n("email")) == null ? void 0 : h.disabled } ) ] }) }), H && b && /* @__PURE__ */ a.jsx( ge, { emailLookupResponse: b, onResendClick: V, onHandleClickLink: W } ), f && /* @__PURE__ */ a.jsx(a.Fragment, { children: /* @__PURE__ */ a.jsxs("div", { className: K || !i ? "" : "sid-disable-elements", children: [ /* @__PURE__ */ a.jsx(Y, { verificationService: s }), /* @__PURE__ */ a.jsx( Z, { verificationService: s, disabled: (x = n("country")) == null ? void 0 : x.disabled } ), /* @__PURE__ */ a.jsx( _, { segmentId: "first-responder", value: { value: o.status, label: c( C, o.status, S ) }, isErrored: !!t.status, errorId: "invalidFirstResponderStatus", disabled: (E = n("status")) == null ? void 0 : E.disabled, options: $( C, p.availableStatuses ), onChange: (e) => { l("status", e ? e.value : ""), d( "status", e ? e.value : "", s ); } } ), /* @__PURE__ */ a.jsx( v, { isErrored: !!t.organization, onChange: (e = ee.organization) => { const u = D(o, (r) => { r.organization = { id: e.id, idExtended: e.idExtended, name: e.name, source: e.source }, o.organization && o.organization.source !== void 0 && (r.organization.source = o.organization.source), m(() => s.programTheme.openOrgSearchEnabled) && m(() => e.id) === 0 && m(() => e.name, "").length > 0 ? r.postalCode = o.postalCode ? o.postalCode : "" : (o.postalCode || o.postalCode === "") && delete r.postalCode; }); s.updateViewModel(u), d("organization", e, s); }, value: s.viewModel.organization, verificationService: s, disabled: (j = n("organization")) == null ? void 0 : j.disabled } ), /* @__PURE__ */ a.jsxs("div", { className: "sid-names", children: [ /* @__PURE__ */ a.jsx( se, { value: o.firstName, isErrored: !!t.firstName, disabled: (F = n("firstName")) == null ? void 0 : F.disabled, onChange: (e) => { l("firstName", e), d("firstName", e, s); } } ), /* @__PURE__ */ a.jsx( ae, { value: o.lastName, isErrored: !!t.lastName, disabled: (N = n("lastName")) == null ? void 0 : N.disabled, onChange: (e) => { l("lastName", e), d("lastName", e, s); } } ) ] }), /* @__PURE__ */ a.jsx( oe, { errorId: t.birthDate, locale: T, onChange: (e) => { l("birthDate", e), d("birthDate", e, s); }, value: o.birthDate, disabled: (M = n("birthDate")) == null ? void 0 : M.disabled } ), !i && /* @__PURE__ */ a.jsx( z, { value: o.email, isErrored: !!t.email, explanation: /* @__PURE__ */ a.jsx( g, { id: "emailExplanation", defaultMessage: "Needed to send you your unique code" } ), onChange: (e) => { l("email", e), d("email", e, s); }, onKeyDown: (e) => ne(e), disabled: (R = n("email")) == null ? void 0 : R.disabled } ), s.programTheme.isSmsNotifierConfigured || s.programTheme.smsLoopEnabled ? /* @__PURE__ */ a.jsx( te, { isRequired: !!s.programTheme.smsLoopEnabled, value: o.phoneNumber, isErrored: !!t.phoneNumber, onChange: (e) => { l("phoneNumber", e), d( "phoneNumber", e, s ); }, selectedCountryCode: o.countryChoice && o.countryChoice.value, disabled: (I = n("phoneNumber")) == null ? void 0 : I.disabled } ) : null, m(() => s.programTheme.openOrgSearchEnabled) && m(() => o.organization.id) === 0 && m(() => o.organization.name, "").length > 0 && /* @__PURE__ */ a.jsx( de, { isErrored: !!t.postalCode, onChange: (e) => { l("postalCode", e), d( "postalCode", e, s ); }, value: o.postalCode, disabled: (y = n("postalCode")) == null ? void 0 : y.disabled } ), P.customFormFields.map((e) => /* @__PURE__ */ a.jsx(le, { config: e, verificationService: s })), /* @__PURE__ */ a.jsx( re, { verificationService: s, isErrored: !!t.marketConsentValue, onChange: (e) => { l("metadata", { ...s.viewModel.metadata, marketConsentValue: e }), d( "marketConsentValue", e, s ); }, viewModel: o, disabled: (k = n("marketConsentValue")) == null ? void 0 : k.disabled } ), /* @__PURE__ */ a.jsx(me, { suffix: "CollectAboveSubmit" }), /* @__PURE__ */ a.jsx( pe, { step: ie.collectFirstResponderPersonalInfo, verificationService: s, viewModel: o, failedInstantMatch: L, buttonText: /* @__PURE__ */ a.jsx( g, { id: "step.personalInfo.submitButtonText", defaultMessage: "Verify My First Responder Status" } ) } ) ] }) }) ] } ); }, xe = A(Ce); export { xe as default };