@sheerid/jslib-nightly
Version:
SheerID JavaScript Library
245 lines (243 loc) • 8.77 kB
JavaScript
/**
* 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.113.0-alpha.0
* BUILD_TIMESTAMP: 1750184650058
* BUILD_DATE: Tue Jun 17 2025 18:24:10 GMT+0000 (Coordinated Universal Time)
* BUILD_COMMIT: 896154e79f58fffa6d52f3ed37f2db760a63df88
*/
import { d as h, h as Q, R as i, s as J, j as e, t as X, P as Y, a8 as Z, E as k, g as t, u as d, b as g, v as $, w as S, Q as v, a9 as aa, U as I, x as sa, y as ea, W as oa, e as la, D as na, B as ta, G as da, M as ma, H as ra, f as pa, V as ua } from "../_mysheerid-preview.js";
import { u as ha, E as ia, a as f } from "./useEmailFirstExperiment-BbDrKQEs.js";
const ga = (a, o) => h(() => a.openOrgSearchEnabled) && h(() => o.organization.id) === 0 && h(() => 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, B = Q(C), P = $(), z = 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: w,
handleResendClick: c,
showEmailLookupResponseMessages: H,
isValidEmail: u,
getOrgByDomain: A,
enableFormFields: K,
handleOnClickProceedHere: U
} = ha(
a.programId,
o.email,
a.verificationResponse.segment
), [W, b] = i.useState(null), [_, q] = i.useState(null);
return i.useEffect(() => {
u && n && (async () => {
if (o.email && u && 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, u, n == null ? void 0 : n.status]), J.useEffect(() => {
a.programTheme.idCheckAddOnEnabled ? l("fieldsToSkipValidation", []) : (l("birthDate", ""), l("fieldsToSkipValidation", ["birthDate"]));
}, [a.programTheme.idCheckAddOnEnabled]), /* @__PURE__ */ e.jsxs(
X,
{
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: w,
onBlur: R,
disabled: (x = t("email")) == null ? void 0 : x.disabled
}
)
] }) }),
H && n && u && /* @__PURE__ */ e.jsx(
ia,
{
emailLookupResponse: n,
onResendClick: c,
onHandleClickLink: U
}
),
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 && W || 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: z,
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, { verificationService: a, suffix: "CollectAboveSubmit" }),
/* @__PURE__ */ e.jsx(
pa,
{
step: ua.collectTeacherPersonalInfo,
verificationService: a,
viewModel: o,
failedInstantMatch: B,
buttonText: /* @__PURE__ */ e.jsx(
g,
{
id: "step.personalInfo.submitButtonText",
defaultMessage: "Verify My Teacher Status"
}
)
}
)
] }) })
]
}
);
}, Ea = Ca;
export {
Ea as default
};