UNPKG

@sheerid/jslib-nightly

Version:

SheerID JavaScript Library

185 lines (183 loc) • 6.19 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 V, a7 as k, a8 as A, i as q, u as d, j as o, M as B, N as L, m as U, w as W, a1 as w, f as r, O, T as _, a4 as H, a9 as K, U as X, W as Y, E as Z, n as z, X as G, Y as J, Z as Q, _ as $, o as S, V as v, aa as ee } from "./es6-B9qAIX4x.js"; import se from "react"; import { injectIntl as ae, FormattedHTMLMessage as oe } from "react-intl"; import { u as te } from "./useCollectFieldsEndpoint-Df4fm8kA.js"; const de = ({ verificationService: s, intl: j }) => { var p, C, h, b, i, N, g, x, y; const a = s.viewModel, { fieldValidationErrors: t } = s, l = s.verificationResponse, E = V(l), I = k( s.programTheme, j ), f = A(I), m = q(() => a.countryChoice.value, f.value), F = m === "US" ? [{ key: "postalCode" }] : [], M = m !== "US" || s.programTheme.isSmsNotifierConfigured || s.programTheme.smsLoopEnabled, c = m !== "US" || s.programTheme.smsLoopEnabled, P = a.localeChoice.value, D = L(); !t.phoneNumber && l.errorIds && l.errorIds.includes("invalidPhoneNumber") && s.updateFieldValidationErrors({ ...t, phoneNumber: "invalidPhoneNumber" }); const n = (e, R) => { const T = ee(a, e, R); s.updateViewModel(T); }, { isFieldRequired: u } = te({ verificationId: l.verificationId, currentStep: l.currentStep, viewModel: a, defaultRequiredFields: F }); return se.useEffect(() => { d("phoneNumber", a.phoneNumber, s); }, [a.country]), /* @__PURE__ */ o.jsxs( B, { verificationService: s, step: l.currentStep, children: [ /* @__PURE__ */ o.jsx(U, { verificationService: s, classNameIdentifier: "age" }), /* @__PURE__ */ o.jsx(W, { verificationService: s }), /* @__PURE__ */ o.jsx( w, { verificationService: s, disabled: (p = r("country")) == null ? void 0 : p.disabled } ), /* @__PURE__ */ o.jsxs("div", { className: "sid-names", children: [ /* @__PURE__ */ o.jsx( O, { value: a.firstName, isErrored: !!t.firstName, disabled: (C = r("firstName")) == null ? void 0 : C.disabled, onChange: (e) => { n("firstName", e), d("firstName", e, s); } } ), /* @__PURE__ */ o.jsx( _, { value: a.lastName, isErrored: !!t.lastName, disabled: (h = r("lastName")) == null ? void 0 : h.disabled, onChange: (e) => { n("lastName", e), d("lastName", e, s); } } ) ] }), /* @__PURE__ */ o.jsx( H, { errorId: t.birthDate, locale: P, onChange: (e) => { n("birthDate", e), d("birthDate", e, s); }, value: a.birthDate, disabled: (b = r("birthDate")) == null ? void 0 : b.disabled } ), u("city") && /* @__PURE__ */ o.jsx( K, { value: a.city, isRequired: !0, isErrored: !!t.city, errorId: t.city, disabled: (i = r("city")) == null ? void 0 : i.disabled, onChange: (e) => { n("city", e), d("city", e, s); } } ), u("address1") && /* @__PURE__ */ o.jsx( X, { value: a.address1, isRequired: !0, isErrored: !!t.address1, errorId: t.address1, onChange: (e) => { n("address1", e), d("address1", e, s); } } ), u("postalCode") && /* @__PURE__ */ o.jsx( Y, { isErrored: !!t.postalCode, onChange: (e) => { n("postalCode", e), d("postalCode", e, s); }, value: a.postalCode, disabled: (N = r("postalCode")) == null ? void 0 : N.disabled } ), /* @__PURE__ */ o.jsx( Z, { value: a.email, isErrored: !!t.email, onChange: (e) => { n("email", e), d("email", e, s); }, onKeyDown: (e) => z(e), disabled: (g = r("email")) == null ? void 0 : g.disabled } ), M ? /* @__PURE__ */ o.jsx( G, { isRequired: c, value: a.phoneNumber, isErrored: !!t.phoneNumber, onChange: (e) => { n("phoneNumber", e), d("phoneNumber", e, s); }, selectedCountryCode: a.countryChoice && a.countryChoice.value, disabled: (x = r("phoneNumber")) == null ? void 0 : x.disabled } ) : null, D.customFormFields.map((e) => /* @__PURE__ */ o.jsx(J, { config: e, verificationService: s })), /* @__PURE__ */ o.jsx( Q, { verificationService: s, isErrored: !!t.marketConsentValue, onChange: (e) => { n("metadata", { ...s.viewModel.metadata, marketConsentValue: e }), d("marketConsentValue", e, s); }, viewModel: a, disabled: (y = r("marketConsentValue")) == null ? void 0 : y.disabled } ), /* @__PURE__ */ o.jsx($, { verificationService: s, suffix: "CollectAboveSubmit" }), /* @__PURE__ */ o.jsx( S, { step: v.collectAgePersonalInfo, verificationService: s, viewModel: a, failedInstantMatch: E, buttonText: /* @__PURE__ */ o.jsx( oe, { id: "step.personalInfo.submitButtonText", defaultMessage: "Verify and continue" } ) } ) ] } ); }, ue = ae(de); export { ue as default };