UNPKG

@sheerid/jslib-nightly

Version:

SheerID JavaScript Library

248 lines (246 loc) • 7.77 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.230.0-alpha.0 * BUILD_TIMESTAMP: 1778694697559 * BUILD_DATE: Wed May 13 2026 17:51:37 GMT+0000 (Coordinated Universal Time) * BUILD_COMMIT: 7af1c105d5485ac4ed1190c56d492bb4590667a9 */ import { i as N, a4 as h, g as d, j as s, F as r, R as g, m as E, p as j, P as M, _ as I, o as l, n as F, U as y, V, e as P } from "../_mysheerid-preview.js"; import { C as T } from "./ChangeLocaleComponent-Cu2DR-Q3.js"; import { F as R, L as k, P as D, a as L, M as w, C as q } from "./CaptchaComponent-CnWyxiTy.js"; import { C as B } from "./CollegeNameComponent-DaTimEqC.js"; import { E as H, P as z } from "./PersonalInfoStepSubmitButton-v_kWLmEw.js"; import { B as A } from "./militaryStepHelpers-jW2_4c1l.js"; import { C as O } from "./CountryComponentWrapper--2UQ7mXP.js"; import { P as W } from "./PersonalInfoStepWrapper-BOBNCgik.js"; import { F as K } from "./FormFieldText-CJ-GVpZE.js"; const _ = ({ value: a, isErrored: o, onChange: t, intl: i, explanation: p, placeholder: m = "", isRequired: u = !1 }) => { const b = h("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 d("cvecNumber")?.hidden ? null : /* @__PURE__ */ s.jsx( K, { fieldId: "cvecNumber", value: a, onChange: t, placeholder: m || i.formatHTMLMessage({ id: "cvecNumberPlaceholder", defaultMessage: "CVEC certificate number" }), label: /* @__PURE__ */ s.jsx(r, { id: "cvecNumber", defaultMessage: "CVEC certificate number" }), errorMessage: o && /* @__PURE__ */ s.jsx( r, { id: "errorId.invalidCvecNumber", defaultMessage: "Invalid CVEC certificate number" } ), showPlaceholderAndHideLabel: !!m, required: u, explanation: p || n() } ); }, U = N(_), X = ({ verificationService: a }) => { const o = a.viewModel, { fieldValidationErrors: t } = a, i = a.verificationResponse, p = P(), m = h("include-cvec-field-france-student"), u = m !== "control" && m !== "default" && o?.countryChoice?.value === "FR"; g.useEffect(() => { const e = (a.viewModel?.fieldsToSkipValidation || []).filter( (C) => C !== "cvecNumber" ); u ? n("fieldsToSkipValidation", e) : n("fieldsToSkipValidation", [...e, "cvecNumber"]); }, [u]); const b = E(i), n = (e, C) => { const f = j( o, (x) => { x[e] = C; } ); a.updateViewModel(f); }, c = o.localeChoice.value; return /* @__PURE__ */ s.jsxs( W, { verificationService: a, step: i.currentStep, children: [ /* @__PURE__ */ s.jsx( M, { verificationService: a, classNameIdentifier: "student-personal-info" } ), /* @__PURE__ */ s.jsx(T, { verificationService: a }), /* @__PURE__ */ s.jsx( O, { verificationService: a, disabled: d("country")?.disabled } ), /* @__PURE__ */ s.jsx( B, { value: a.viewModel.organization, verificationService: a, isErrored: !!t.organization, isRequired: !0, disabled: d("organization")?.disabled, onChange: (e) => { I(e, a), l("organization", e, a); } } ), u && /* @__PURE__ */ s.jsx( U, { isRequired: d("cvecNumber")?.requireIfOptional, value: o.cvecNumber, isErrored: !!t.cvecNumber, disabled: d("cvecNumber")?.disabled, onChange: (e) => { n("cvecNumber", e), l("cvecNumber", e, a); } } ), /* @__PURE__ */ s.jsxs("div", { className: "sid-names", children: [ /* @__PURE__ */ s.jsx( R, { value: o.firstName, isErrored: !!t.firstName, disabled: d("firstName")?.disabled, onChange: (e) => { n("firstName", e), l("firstName", e, a); } } ), /* @__PURE__ */ s.jsx( k, { value: o.lastName, isErrored: !!t.lastName, disabled: d("lastName")?.disabled, onChange: (e) => { n("lastName", e), l("lastName", e, a); } } ) ] }), /* @__PURE__ */ s.jsx( A, { value: o.birthDate, errorId: t.birthDate, locale: c, isRequired: !0, disabled: d("birthDate")?.disabled, onChange: (e) => { n("birthDate", e), l("birthDate", e, a); } } ), /* @__PURE__ */ s.jsx( H, { value: o.email, isErrored: !!t.email, explanation: /* @__PURE__ */ s.jsx( r, { id: "emailExplanation", defaultMessage: "Personal or school email is fine" } ), onChange: (e) => { n("email", e), l("email", e, a); }, onKeyDown: (e) => F(e), disabled: d("email")?.disabled } ), a.programTheme.isSmsNotifierConfigured || a.programTheme.smsLoopEnabled ? /* @__PURE__ */ s.jsx( D, { isRequired: !!a.programTheme.smsLoopEnabled, value: o.phoneNumber, isErrored: !!t.phoneNumber, disabled: d("phoneNumber")?.disabled, onChange: (e) => { n("phoneNumber", e), l("phoneNumber", e, a); }, selectedCountryCode: o.countryChoice && o.countryChoice.value } ) : null, (p.customFormFields || []).map((e) => /* @__PURE__ */ s.jsx(L, { config: e, verificationService: a })), " ", /* @__PURE__ */ s.jsx( w, { verificationService: a, isErrored: !!t.marketConsentValue, disabled: d("marketConsentValue")?.disabled, onChange: (e) => { n("metadata", { ...a.viewModel.metadata, marketConsentValue: e }), l("marketConsentValue", e, a); }, viewModel: o } ), /* @__PURE__ */ s.jsx(y, { verificationService: a, suffix: "CollectAboveSubmit" }), /* @__PURE__ */ s.jsx( q, { verificationService: a, isErrored: !!t.captchaToken } ), /* @__PURE__ */ s.jsx( z, { step: V.collectStudentPersonalInfo, verificationService: a, viewModel: o, failedInstantMatch: b, buttonText: /* @__PURE__ */ s.jsx( r, { id: "step.personalInfo.submitButtonText", defaultMessage: "Verify My Student Status" } ) } ) ] } ); }, ae = X; export { ae as default };