@sheerid/jslib-nightly
Version:
SheerID JavaScript Library
299 lines (297 loc) • 9.99 kB
JavaScript
/**
* VERSION: 2.130.0-alpha.4
* BUILD_TIMESTAMP: 1759000305348
* BUILD_DATE: Sat Sep 27 2025 19:11:45 GMT+0000 (Coordinated Universal Time)
* BUILD_COMMIT: be6ef87ab40e8747994d32363389cf39e36a4326
*/
import { i as $, aj as B, g as o, j as e, Q as S, b as i, R as g, h as v, n as ee, v as ae, P as se, a9 as ne, E as R, f as r, w as te, x as oe, T as le, ak as de, W as w, y as re, z as ie, X as me, e as ue, G as pe, H as be, M as ce, I as Ce, k as ge, V as he } from "../sheerid.js";
import { u as xe, E as Ne, a as L } from "./useEmailFirstExperiment-DH410dM-.js";
const Ee = ({
value: a,
isErrored: n,
onChange: l,
intl: c,
explanation: h,
placeholder: p = "",
isRequired: b = !1
}) => {
var t;
const m = B("include-cvec-field-france-student"), x = () => m === "labeled-optional" ? /* @__PURE__ */ e.jsx(
i,
{
id: "cvecNumberExplanation",
defaultMessage: "Optional - Add your CVEC number to increase your chances of being verified instantly."
}
) : /* @__PURE__ */ e.jsx(
i,
{
id: "_EXPERIMENTAL.cvecNumberExplanation",
defaultMessage: "Add your CVEC number to increase your chances of being verified instantly."
}
);
return ((t = o("cvecNumber")) == null ? void 0 : t.hidden) ? null : /* @__PURE__ */ e.jsx(
S,
{
fieldId: "cvecNumber",
value: a,
onChange: l,
placeholder: p || c.formatHTMLMessage({
id: "cvecNumberPlaceholder",
defaultMessage: "CVEC certificate number"
}),
label: /* @__PURE__ */ e.jsx(i, { id: "cvecNumber", defaultMessage: "CVEC certificate number" }),
errorMessage: n && /* @__PURE__ */ e.jsx(
i,
{
id: "errorId.invalidCvecNumber",
defaultMessage: "Invalid CVEC certificate number"
}
),
showPlaceholderAndHideLabel: !!p,
required: b,
explanation: h || x()
}
);
}, fe = $(Ee), je = ({
verificationService: a
}) => {
var f, j, M, F, y, I, O, V, D, T, k, P;
const n = a.viewModel, { fieldValidationErrors: l } = a, c = a.verificationResponse, h = te(), p = B("include-cvec-field-france-student"), b = p !== "control" && p !== "default" && ((f = n == null ? void 0 : n.countryChoice) == null ? void 0 : f.value) === "FR";
g.useEffect(() => {
b ? d("fieldsToSkipValidation", []) : d("fieldsToSkipValidation", ["cvecNumber"]);
}, [b]);
const {
isEmailUpTop: m,
isEmailValidationLoading: x,
showFormFields: N,
emailLookupResponse: t,
emailOnBlur: z,
emailOnKeyDown: H,
handleResendClick: q,
showEmailLookupResponseMessages: A,
enableFormFields: K,
isValidEmail: C,
getOrgByDomain: W,
handleOnClickProceedHere: U
} = xe(
a.programId,
n.email,
a.verificationResponse.segment
), [_, E] = g.useState(null), [X, G] = g.useState(null);
g.useEffect(() => {
C && t && (async () => {
if (n.email && C && t && t.status === L.NOT_FOUND) {
const u = await W(a);
u && (E(u), w(u, a), r("organization", u, a));
} else
E(null);
})();
}, [n.email, C, t == null ? void 0 : t.status]);
const Q = v(c), d = (s, u) => {
const Y = ee(
n,
(Z) => {
Z[s] = u;
}
);
a.updateViewModel(Y);
}, J = n.localeChoice.value;
return /* @__PURE__ */ e.jsxs(
ae,
{
verificationService: a,
step: c.currentStep,
children: [
/* @__PURE__ */ e.jsx(
se,
{
verificationService: a,
classNameIdentifier: "student-personal-info"
}
),
// #region email-first-experiment
m && /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs("div", { className: "email-input-wrapper", children: [
x && /* @__PURE__ */ e.jsx("div", { className: "email-input-wrapper-frame", children: /* @__PURE__ */ e.jsx("div", { className: "sid-spinner scaled", children: /* @__PURE__ */ e.jsx(ne, {}) }) }),
/* @__PURE__ */ e.jsx(
R,
{
value: n.email,
isErrored: !!l.email,
explanation: /* @__PURE__ */ e.jsx(
i,
{
id: "emailExplanation",
defaultMessage: "Personal or school email is fine"
}
),
onChange: (s) => {
d("email", s), r("email", s, a);
},
onKeyDown: H,
onBlur: z,
disabled: (j = o("email")) == null ? void 0 : j.disabled
}
)
] }) }),
A && t && C && /* @__PURE__ */ e.jsx(
Ne,
{
emailLookupResponse: t,
onResendClick: q,
onHandleClickLink: U
}
),
N && /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs("div", { className: K || !m ? "" : "sid-disable-elements", children: [
" ",
/* @__PURE__ */ e.jsx(oe, { verificationService: a }),
/* @__PURE__ */ e.jsx(
le,
{
verificationService: a,
disabled: (M = o("country")) == null ? void 0 : M.disabled
}
),
/* @__PURE__ */ e.jsx(
de,
{
value: X || m && (t == null ? void 0 : t.status) === L.NOT_FOUND && _ || a.viewModel.organization,
verificationService: a,
isErrored: !!l.organization,
isRequired: !0,
disabled: (F = o("organization")) == null ? void 0 : F.disabled,
onChange: (s) => {
G(s), w(s, a), r("organization", s, a);
}
}
),
b && /* @__PURE__ */ e.jsx(
fe,
{
isRequired: (y = o("cvecNumber")) == null ? void 0 : y.requireIfOptional,
value: n.cvecNumber,
isErrored: !!l.cvecNumber,
disabled: (I = o("cvecNumber")) == null ? void 0 : I.disabled,
onChange: (s) => {
d("cvecNumber", s), r("cvecNumber", s, a);
}
}
),
/* @__PURE__ */ e.jsxs("div", { className: "sid-names", children: [
/* @__PURE__ */ e.jsx(
re,
{
value: n.firstName,
isErrored: !!l.firstName,
disabled: (O = o("firstName")) == null ? void 0 : O.disabled,
onChange: (s) => {
d("firstName", s), r("firstName", s, a);
}
}
),
/* @__PURE__ */ e.jsx(
ie,
{
value: n.lastName,
isErrored: !!l.lastName,
disabled: (V = o("lastName")) == null ? void 0 : V.disabled,
onChange: (s) => {
d("lastName", s), r("lastName", s, a);
}
}
)
] }),
/* @__PURE__ */ e.jsx(
me,
{
value: n.birthDate,
errorId: l.birthDate,
locale: J,
isRequired: !0,
disabled: (D = o("birthDate")) == null ? void 0 : D.disabled,
onChange: (s) => {
d("birthDate", s), r("birthDate", s, a);
}
}
),
!m && /* @__PURE__ */ e.jsx(
R,
{
value: n.email,
isErrored: !!l.email,
explanation: /* @__PURE__ */ e.jsx(
i,
{
id: "emailExplanation",
defaultMessage: "Personal or school email is fine"
}
),
onChange: (s) => {
d("email", s), r("email", s, a);
},
onKeyDown: (s) => ue(s),
disabled: (T = o("email")) == null ? void 0 : T.disabled
}
),
a.programTheme.isSmsNotifierConfigured || a.programTheme.smsLoopEnabled ? /* @__PURE__ */ e.jsx(
pe,
{
isRequired: !!a.programTheme.smsLoopEnabled,
value: n.phoneNumber,
isErrored: !!l.phoneNumber,
disabled: (k = o("phoneNumber")) == null ? void 0 : k.disabled,
onChange: (s) => {
d("phoneNumber", s), r(
"phoneNumber",
s,
a
);
},
selectedCountryCode: n.countryChoice && n.countryChoice.value
}
) : null,
(h.customFormFields || []).map((s) => /* @__PURE__ */ e.jsx(be, { config: s, verificationService: a })),
" ",
/* @__PURE__ */ e.jsx(
ce,
{
verificationService: a,
isErrored: !!l.marketConsentValue,
disabled: (P = o("marketConsentValue")) == null ? void 0 : P.disabled,
onChange: (s) => {
d("metadata", {
...a.viewModel.metadata,
marketConsentValue: s
}), r(
"marketConsentValue",
s,
a
);
},
viewModel: n
}
),
/* @__PURE__ */ e.jsx(Ce, { suffix: "CollectAboveSubmit" }),
/* @__PURE__ */ e.jsx(
ge,
{
step: he.collectStudentPersonalInfo,
verificationService: a,
viewModel: n,
failedInstantMatch: Q,
buttonText: /* @__PURE__ */ e.jsx(
i,
{
id: "step.personalInfo.submitButtonText",
defaultMessage: "Verify My Student Status"
}
)
}
)
] }) })
]
}
);
}, ye = je;
export {
ye as default
};