@sheerid/jslib-nightly
Version:
SheerID JavaScript Library
228 lines (226 loc) • 6.94 kB
JavaScript
/**
* VERSION: 2.154.0-alpha.1
* BUILD_TIMESTAMP: 1763401626706
* BUILD_DATE: Mon Nov 17 2025 17:47:06 GMT+0000 (Coordinated Universal Time)
* BUILD_COMMIT: 73f4468155aaed0f31ab0d59dc3394018b939b6d
*/
import { ak as c, f as o, j as s, a1 as f, k as g, r as E, N as j, O as M, m as I, x as y, a2 as F, al as V, a4 as T, o as l, T as P, U as R, a5 as k, E as D, n as L, Y as q, Z as w, _ as H, $ as O, p as z, V as A } from "./es6-OV3Jb0XZ.js";
import B from "react";
import { injectIntl as _, FormattedHTMLMessage as r } from "react-intl";
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()
}
);
}, K = _(W), U = ({
verificationService: e
}) => {
const t = e.viewModel, { fieldValidationErrors: d } = e, i = e.verificationResponse, p = M(), u = c("include-cvec-field-france-student"), m = u !== "control" && u !== "default" && t?.countryChoice?.value === "FR";
B.useEffect(() => {
m ? n("fieldsToSkipValidation", []) : n("fieldsToSkipValidation", ["cvecNumber"]);
}, [m]);
const b = g(i), n = (a, h) => {
const N = E(
t,
(x) => {
x[a] = h;
}
);
e.updateViewModel(N);
}, C = t.localeChoice.value;
return /* @__PURE__ */ s.jsxs(
j,
{
verificationService: e,
step: i.currentStep,
children: [
/* @__PURE__ */ s.jsx(
I,
{
verificationService: e,
classNameIdentifier: "student-personal-info"
}
),
/* @__PURE__ */ s.jsx(y, { verificationService: e }),
/* @__PURE__ */ s.jsx(
F,
{
verificationService: e,
disabled: o("country")?.disabled
}
),
/* @__PURE__ */ s.jsx(
V,
{
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(
K,
{
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(
P,
{
value: t.firstName,
isErrored: !!d.firstName,
disabled: o("firstName")?.disabled,
onChange: (a) => {
n("firstName", a), l("firstName", a, e);
}
}
),
/* @__PURE__ */ s.jsx(
R,
{
value: t.lastName,
isErrored: !!d.lastName,
disabled: o("lastName")?.disabled,
onChange: (a) => {
n("lastName", a), l("lastName", a, e);
}
}
)
] }),
/* @__PURE__ */ s.jsx(
k,
{
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(
D,
{
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) => L(a),
disabled: o("email")?.disabled
}
),
e.programTheme.isSmsNotifierConfigured || e.programTheme.smsLoopEnabled ? /* @__PURE__ */ s.jsx(
q,
{
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(w, { 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(O, { verificationService: e, suffix: "CollectAboveSubmit" }),
/* @__PURE__ */ s.jsx(
z,
{
step: A.collectStudentPersonalInfo,
verificationService: e,
viewModel: t,
failedInstantMatch: b,
buttonText: /* @__PURE__ */ s.jsx(
r,
{
id: "step.personalInfo.submitButtonText",
defaultMessage: "Verify My Student Status"
}
)
}
)
]
}
);
}, $ = U;
export {
$ as default
};