UNPKG

@sheerid/jslib-nightly

Version:

SheerID JavaScript Library

187 lines (185 loc) • 6.29 kB
/** * WARNING: This file is intended to be used within MySheerID. * This file is not intended for use in other contexts and there are no guarantees about its behavior outside of MySheerID. */ /** * VERSION: 2.130.0-alpha.4 * BUILD_TIMESTAMP: 1759000347595 * BUILD_DATE: Sat Sep 27 2025 19:12:27 GMT+0000 (Coordinated Universal Time) * BUILD_COMMIT: be6ef87ab40e8747994d32363389cf39e36a4326 */ import { i as V, h as k, $ as A, a0 as q, d as B, R as L, f as d, j as o, v as w, w as H, P as U, x as W, T as K, g as l, y as O, z, X as G, a1 as X, B as $, D as J, E as Q, e as Y, G as Z, H as _, M as S, I as v, k as ee, V as se, b as ae, a2 as oe } from "../_mysheerid-preview.js"; import { u as te } from "./useCollectFieldsEndpoint-DPX8CT4Y.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 = k(r), I = A( s.programTheme, j ), c = q(I), m = B(() => a.countryChoice.value, c.value), F = m === "US" ? [{ key: "postalCode" }] : [], f = m !== "US" || s.programTheme.isSmsNotifierConfigured || s.programTheme.smsLoopEnabled, M = m !== "US" || s.programTheme.smsLoopEnabled, P = a.localeChoice.value, D = H(); !t.phoneNumber && r.errorIds && r.errorIds.includes("invalidPhoneNumber") && s.updateFieldValidationErrors({ ...t, phoneNumber: "invalidPhoneNumber" }); const n = (e, R) => { const T = oe(a, e, R); s.updateViewModel(T); }, { isFieldRequired: u } = te({ verificationId: r.verificationId, currentStep: r.currentStep, viewModel: a, defaultRequiredFields: F }); return L.useEffect(() => { d("phoneNumber", a.phoneNumber, s); }, [a.country]), /* @__PURE__ */ o.jsxs( w, { verificationService: s, step: r.currentStep, children: [ /* @__PURE__ */ o.jsx(U, { verificationService: s, classNameIdentifier: "age" }), /* @__PURE__ */ o.jsx(W, { 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( X, { 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( J, { 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( Q, { value: a.email, isErrored: !!t.email, onChange: (e) => { n("email", e), d("email", e, s); }, onKeyDown: (e) => Y(e), disabled: (N = l("email")) == null ? void 0 : N.disabled } ), f ? /* @__PURE__ */ o.jsx( Z, { isRequired: M, 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(_, { 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, { 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 = V(de); export { re as default };