UNPKG

@sheerid/jslib-nightly

Version:

SheerID JavaScript Library

230 lines (228 loc) • 7.07 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.154.0-alpha.1 * BUILD_TIMESTAMP: 1763401584959 * BUILD_DATE: Mon Nov 17 2025 17:46:24 GMT+0000 (Coordinated Universal Time) * BUILD_COMMIT: 73f4468155aaed0f31ab0d59dc3394018b939b6d */ import { i as g, af as c, a as o, j as s, X as f, c as r, R as E, h as j, o as M, x as I, y, P as F, z as V, Y as P, ag as R, _ as T, k as l, B as D, D as k, $ as L, E as q, f as w, J as z, K as B, M as H, N as A, m as O, V as K } from "../_mysheerid-preview.js"; const W = ({ value: e, isErrored: t, onChange: d, intl: i, explanation: p, placeholder: u = "", isRequired: m = !1 }) => { const b = c("include-cvec-field-france-student"), n = () => b === "labeled-optional" ? /* @__PURE__ */ s.jsx( r, { id: "cvecNumberExplanation", defaultMessage: "Optional - Add your CVEC number to increase your chances of being verified instantly." } ) : /* @__PURE__ */ s.jsx( r, { id: "_EXPERIMENTAL.cvecNumberExplanation", defaultMessage: "Add your CVEC number to increase your chances of being verified instantly." } ); return o("cvecNumber")?.hidden ? null : /* @__PURE__ */ s.jsx( f, { fieldId: "cvecNumber", value: e, onChange: d, placeholder: u || i.formatHTMLMessage({ id: "cvecNumberPlaceholder", defaultMessage: "CVEC certificate number" }), label: /* @__PURE__ */ s.jsx(r, { id: "cvecNumber", defaultMessage: "CVEC certificate number" }), errorMessage: t && /* @__PURE__ */ s.jsx( r, { id: "errorId.invalidCvecNumber", defaultMessage: "Invalid CVEC certificate number" } ), showPlaceholderAndHideLabel: !!u, required: m, explanation: p || n() } ); }, X = g(W), _ = ({ verificationService: e }) => { const t = e.viewModel, { fieldValidationErrors: d } = e, i = e.verificationResponse, p = y(), u = c("include-cvec-field-france-student"), m = u !== "control" && u !== "default" && t?.countryChoice?.value === "FR"; E.useEffect(() => { m ? n("fieldsToSkipValidation", []) : n("fieldsToSkipValidation", ["cvecNumber"]); }, [m]); const b = j(i), n = (a, h) => { const N = M( t, (x) => { x[a] = h; } ); e.updateViewModel(N); }, C = t.localeChoice.value; return /* @__PURE__ */ s.jsxs( I, { verificationService: e, step: i.currentStep, children: [ /* @__PURE__ */ s.jsx( F, { verificationService: e, classNameIdentifier: "student-personal-info" } ), /* @__PURE__ */ s.jsx(V, { verificationService: e }), /* @__PURE__ */ s.jsx( P, { verificationService: e, disabled: o("country")?.disabled } ), /* @__PURE__ */ s.jsx( R, { value: e.viewModel.organization, verificationService: e, isErrored: !!d.organization, isRequired: !0, disabled: o("organization")?.disabled, onChange: (a) => { T(a, e), l("organization", a, e); } } ), m && /* @__PURE__ */ s.jsx( X, { isRequired: o("cvecNumber")?.requireIfOptional, value: t.cvecNumber, isErrored: !!d.cvecNumber, disabled: o("cvecNumber")?.disabled, onChange: (a) => { n("cvecNumber", a), l("cvecNumber", a, e); } } ), /* @__PURE__ */ s.jsxs("div", { className: "sid-names", children: [ /* @__PURE__ */ s.jsx( D, { value: t.firstName, isErrored: !!d.firstName, disabled: o("firstName")?.disabled, onChange: (a) => { n("firstName", a), l("firstName", a, e); } } ), /* @__PURE__ */ s.jsx( k, { value: t.lastName, isErrored: !!d.lastName, disabled: o("lastName")?.disabled, onChange: (a) => { n("lastName", a), l("lastName", a, e); } } ) ] }), /* @__PURE__ */ s.jsx( L, { value: t.birthDate, errorId: d.birthDate, locale: C, isRequired: !0, disabled: o("birthDate")?.disabled, onChange: (a) => { n("birthDate", a), l("birthDate", a, e); } } ), /* @__PURE__ */ s.jsx( q, { value: t.email, isErrored: !!d.email, explanation: /* @__PURE__ */ s.jsx( r, { id: "emailExplanation", defaultMessage: "Personal or school email is fine" } ), onChange: (a) => { n("email", a), l("email", a, e); }, onKeyDown: (a) => w(a), disabled: o("email")?.disabled } ), e.programTheme.isSmsNotifierConfigured || e.programTheme.smsLoopEnabled ? /* @__PURE__ */ s.jsx( z, { isRequired: !!e.programTheme.smsLoopEnabled, value: t.phoneNumber, isErrored: !!d.phoneNumber, disabled: o("phoneNumber")?.disabled, onChange: (a) => { n("phoneNumber", a), l("phoneNumber", a, e); }, selectedCountryCode: t.countryChoice && t.countryChoice.value } ) : null, (p.customFormFields || []).map((a) => /* @__PURE__ */ s.jsx(B, { config: a, verificationService: e })), " ", /* @__PURE__ */ s.jsx( H, { verificationService: e, isErrored: !!d.marketConsentValue, disabled: o("marketConsentValue")?.disabled, onChange: (a) => { n("metadata", { ...e.viewModel.metadata, marketConsentValue: a }), l("marketConsentValue", a, e); }, viewModel: t } ), /* @__PURE__ */ s.jsx(A, { verificationService: e, suffix: "CollectAboveSubmit" }), /* @__PURE__ */ s.jsx( O, { step: K.collectStudentPersonalInfo, verificationService: e, viewModel: t, failedInstantMatch: b, buttonText: /* @__PURE__ */ s.jsx( r, { id: "step.personalInfo.submitButtonText", defaultMessage: "Verify My Student Status" } ) } ) ] } ); }, Y = _; export { Y as default };