UNPKG

@sheerid/jslib-nightly

Version:

SheerID JavaScript Library

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