UNPKG

@sheerid/jslib-nightly

Version:

SheerID JavaScript Library

273 lines (271 loc) • 9.35 kB
/** * VERSION: 2.113.0-alpha.0 * BUILD_TIMESTAMP: 1750184600854 * BUILD_DATE: Tue Jun 17 2025 18:23:20 GMT+0000 (Coordinated Universal Time) * BUILD_COMMIT: 896154e79f58fffa6d52f3ed37f2db760a63df88 */ import { i as A, h as G, j as a, t as Q, P as U, a8 as J, E as z, g as n, u as d, b as g, d as m, v as X, w as Y, Q as Z, a2 as _, aa as $, ab as S, ac as c, ad as v, ae as ee, m as D, x as se, y as ae, W as oe, e as ne, D as te, B as de, G as le, M as re, H as me, f as pe, V as ie } from "../sheerid.js"; import { u as ue, E as ge } from "./useEmailFirstExperiment-CgU-itQI.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 = X(), O = o.localeChoice.value, l = (e, u) => { const r = D( o, (q) => { q[e] = u; } ); s.updateViewModel(r); }, { isEmailUpTop: i, isEmailValidationLoading: T, showFormFields: w, emailLookupResponse: b, emailOnBlur: B, emailOnKeyDown: f, handleResendClick: V, showEmailLookupResponseMessages: H, enableFormFields: K, handleOnClickProceedHere: W } = ue( s.programId, o.email, s.verificationResponse.segment ); return /* @__PURE__ */ a.jsxs( Q, { verificationService: s, step: p.currentStep, children: [ /* @__PURE__ */ a.jsx( U, { 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: [ T && /* @__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: f, onBlur: B, disabled: (h = n("email")) == null ? void 0 : h.disabled } ) ] }) }), H && b && /* @__PURE__ */ a.jsx( ge, { emailLookupResponse: b, onResendClick: V, onHandleClickLink: W } ), w && /* @__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: S( C, o.status, c ) }, 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: O, 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, { verificationService: s, 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 };