@sheerid/jslib-nightly
Version:
SheerID JavaScript Library
241 lines (239 loc) • 8.53 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 { d as u, h as X, R as h, t as J, j as e, v as Q, P as Y, a9 as Z, E as k, g as t, f as d, b as g, w as $, x as S, T as v, aa, W as I, y as sa, z as ea, X as oa, e as la, G as na, D as ta, H as da, M as ma, I as ra, k as pa, V as ia } from "../sheerid.js";
import { u as ua, E as ha, a as f } from "./useEmailFirstExperiment-DH410dM-.js";
const ga = (a, o) => u(() => a.openOrgSearchEnabled) && u(() => o.organization.id) === 0 && u(() => o.organization.name, "").length > 0, Ca = ({
verificationService: a
}) => {
var x, E, j, N, T, y, F, M, O, D;
const { viewModel: o } = a, { fieldValidationErrors: m } = a, C = a.verificationResponse, z = X(C), P = $(), B = o.localeChoice.value, l = (s, r) => {
const G = {
[s]: r
};
a.updateViewModel(G, { partial: !0 });
}, {
isEmailUpTop: p,
isEmailValidationLoading: V,
showFormFields: L,
emailLookupResponse: n,
emailOnBlur: R,
emailOnKeyDown: c,
handleResendClick: w,
showEmailLookupResponseMessages: H,
isValidEmail: i,
getOrgByDomain: A,
enableFormFields: K,
handleOnClickProceedHere: W
} = ua(
a.programId,
o.email,
a.verificationResponse.segment
), [U, b] = h.useState(null), [_, q] = h.useState(null);
return h.useEffect(() => {
i && n && (async () => {
if (o.email && i && n && n.status === f.NOT_FOUND) {
const r = await A(a);
r && (b(r), I(r, a), d("organization", r, a));
} else
b(null);
})();
}, [o.email, i, n == null ? void 0 : n.status]), J.useEffect(() => {
a.programTheme.idCheckAddOnEnabled ? l("fieldsToSkipValidation", []) : (l("birthDate", ""), l("fieldsToSkipValidation", ["birthDate"]));
}, [a.programTheme.idCheckAddOnEnabled]), /* @__PURE__ */ e.jsxs(
Q,
{
verificationService: a,
step: C.currentStep,
children: [
/* @__PURE__ */ e.jsx(
Y,
{
verificationService: a,
classNameIdentifier: "teacher-personal-info"
}
),
// #region email-first-experiment
p && /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs("div", { className: "email-input-wrapper", children: [
V && /* @__PURE__ */ e.jsx("div", { className: "email-input-wrapper-frame", children: /* @__PURE__ */ e.jsx("div", { className: "sid-spinner scaled", children: /* @__PURE__ */ e.jsx(Z, {}) }) }),
/* @__PURE__ */ e.jsx(
k,
{
value: o.email,
isErrored: !!m.email,
explanation: /* @__PURE__ */ e.jsx(
g,
{
id: "emailExplanation",
defaultMessage: "Must be your school-issued email address"
}
),
onChange: (s) => {
l("email", s), d("email", s, a);
},
onKeyDown: c,
onBlur: R,
disabled: (x = t("email")) == null ? void 0 : x.disabled
}
)
] }) }),
H && n && i && /* @__PURE__ */ e.jsx(
ha,
{
emailLookupResponse: n,
onResendClick: w,
onHandleClickLink: W
}
),
L && /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs("div", { className: K || !p ? "" : "sid-disable-elements", children: [
/* @__PURE__ */ e.jsx(S, { verificationService: a }),
/* @__PURE__ */ e.jsx(
v,
{
verificationService: a,
disabled: (E = t("country")) == null ? void 0 : E.disabled
}
),
/* @__PURE__ */ e.jsx(
aa,
{
value: _ || p && (n == null ? void 0 : n.status) === f.NOT_FOUND && U || a.viewModel.organization,
verificationService: a,
isErrored: !!m.organization,
disabled: (j = t("organization")) == null ? void 0 : j.disabled,
onChange: (s) => {
q(s), I(s, a), d("organization", s, a);
}
}
),
/* @__PURE__ */ e.jsxs("div", { className: "sid-names", children: [
/* @__PURE__ */ e.jsx(
sa,
{
value: o.firstName,
isErrored: !!m.firstName,
disabled: (N = t("firstName")) == null ? void 0 : N.disabled,
onChange: (s) => {
l("firstName", s), d("firstName", s, a);
}
}
),
/* @__PURE__ */ e.jsx(
ea,
{
value: o.lastName,
isErrored: !!m.lastName,
disabled: (T = t("lastName")) == null ? void 0 : T.disabled,
onChange: (s) => {
l("lastName", s), d("lastName", s, a);
}
}
)
] }),
a.programTheme.idCheckAddOnEnabled ? /* @__PURE__ */ e.jsx(
oa,
{
errorId: m.birthDate,
locale: B,
disabled: (y = t("birthDate")) == null ? void 0 : y.disabled,
onChange: (s) => {
l("birthDate", s), d("birthDate", s, a);
},
value: o.birthDate
}
) : null,
!p && /* @__PURE__ */ e.jsx(
k,
{
value: o.email,
isErrored: !!m.email,
explanation: /* @__PURE__ */ e.jsx(
g,
{
id: "emailExplanation",
defaultMessage: "Must be your school-issued email address"
}
),
onChange: (s) => {
l("email", s), d("email", s, a);
},
onKeyDown: (s) => la(s),
disabled: (F = t("email")) == null ? void 0 : F.disabled
}
),
a.programTheme.isSmsNotifierConfigured || a.programTheme.smsLoopEnabled ? /* @__PURE__ */ e.jsx(
na,
{
isRequired: !!a.programTheme.smsLoopEnabled,
value: o.phoneNumber,
isErrored: !!m.phoneNumber,
onChange: (s) => {
l("phoneNumber", s), d(
"phoneNumber",
s,
a
);
},
selectedCountryCode: o.countryChoice && o.countryChoice.value,
disabled: (M = t("phoneNumber")) == null ? void 0 : M.disabled
}
) : null,
ga(a.programTheme, o) ? /* @__PURE__ */ e.jsx(
ta,
{
isErrored: !!m.postalCode,
onChange: (s) => {
l("postalCode", s), d("postalCode", s, a);
},
value: o.postalCode,
disabled: (O = t("postalCode")) == null ? void 0 : O.disabled
}
) : null,
P.customFormFields.map((s) => /* @__PURE__ */ e.jsx(da, { config: s, verificationService: a })),
/* @__PURE__ */ e.jsx(
ma,
{
verificationService: a,
isErrored: !!m.marketConsentValue,
onChange: (s) => {
l("metadata", {
...a.viewModel.metadata,
marketConsentValue: s
}), d(
"marketConsentValue",
s,
a
);
},
viewModel: o,
disabled: (D = t("marketConsentValue")) == null ? void 0 : D.disabled
}
),
/* @__PURE__ */ e.jsx(ra, { suffix: "CollectAboveSubmit" }),
/* @__PURE__ */ e.jsx(
pa,
{
step: ia.collectTeacherPersonalInfo,
verificationService: a,
viewModel: o,
failedInstantMatch: z,
buttonText: /* @__PURE__ */ e.jsx(
g,
{
id: "step.personalInfo.submitButtonText",
defaultMessage: "Verify My Teacher Status"
}
)
}
)
] }) })
]
}
);
}, Ea = Ca;
export {
Ea as default
};