@sheerid/jslib-nightly
Version:
SheerID JavaScript Library
243 lines (241 loc) • 8.5 kB
JavaScript
/**
* VERSION: 2.113.0-alpha.0
* BUILD_TIMESTAMP: 1750184680813
* BUILD_DATE: Tue Jun 17 2025 18:24:40 GMT+0000 (Coordinated Universal Time)
* BUILD_COMMIT: 896154e79f58fffa6d52f3ed37f2db760a63df88
*/
import { k as X, j as e, M as Y, m as Z, al as G, E as D, f as t, u as d, N as J, w as Q, a1 as $, am as S, a3 as k, O as v, T as aa, a4 as sa, n as ea, X as oa, an as la, W as na, Y as ta, Z as da, _ as ma, o as ra, V as pa } from "./es6-B9qAIX4x.js";
import h, { useEffect as ua } from "react";
import { FormattedHTMLMessage as i } from "react-intl";
import { u as ha, E as ia, a as I } from "./useEmailFirstExperiment-BOHCZCqy.js";
const Ca = ({
verificationService: a
}) => {
var b, x, E, j, N, T, M, F, O, y;
const { viewModel: o } = a, { fieldValidationErrors: m } = a, C = a.verificationResponse, f = X(C), B = J(), P = o.localeChoice.value, l = (s, r) => {
const q = {
[s]: r
};
a.updateViewModel(q, { partial: !0 });
}, {
isEmailUpTop: p,
isEmailValidationLoading: V,
showFormFields: w,
emailLookupResponse: n,
emailOnBlur: z,
emailOnKeyDown: L,
handleResendClick: R,
showEmailLookupResponseMessages: _,
isValidEmail: u,
getOrgByDomain: A,
enableFormFields: H,
handleOnClickProceedHere: K
} = ha(
a.programId,
o.email,
a.verificationResponse.segment
), [W, g] = h.useState(null), [U, c] = h.useState(null);
return h.useEffect(() => {
u && n && (async () => {
if (o.email && u && n && n.status === I.NOT_FOUND) {
const r = await A(a);
r && (g(r), k(r, a), d("organization", r, a));
} else
g(null);
})();
}, [o.email, u, n == null ? void 0 : n.status]), ua(() => {
a.programTheme.idCheckAddOnEnabled ? l("fieldsToSkipValidation", []) : (l("birthDate", ""), l("fieldsToSkipValidation", ["birthDate"]));
}, [a.programTheme.idCheckAddOnEnabled]), /* @__PURE__ */ e.jsxs(
Y,
{
verificationService: a,
step: C.currentStep,
children: [
/* @__PURE__ */ e.jsx(
Z,
{
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(G, {}) }) }),
/* @__PURE__ */ e.jsx(
D,
{
value: o.email,
isErrored: !!m.email,
explanation: /* @__PURE__ */ e.jsx(
i,
{
id: "emailExplanation",
defaultMessage: "Must be your school-issued email address"
}
),
onChange: (s) => {
l("email", s), d("email", s, a);
},
onKeyDown: L,
onBlur: z,
disabled: (b = t("email")) == null ? void 0 : b.disabled
}
)
] }) }),
_ && n && u && /* @__PURE__ */ e.jsx(
ia,
{
emailLookupResponse: n,
onResendClick: R,
onHandleClickLink: K
}
),
w && /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs("div", { className: H || !p ? "" : "sid-disable-elements", children: [
/* @__PURE__ */ e.jsx(Q, { verificationService: a }),
/* @__PURE__ */ e.jsx(
$,
{
verificationService: a,
disabled: (x = t("country")) == null ? void 0 : x.disabled
}
),
/* @__PURE__ */ e.jsx(
S,
{
value: U || p && (n == null ? void 0 : n.status) === I.NOT_FOUND && W || a.viewModel.organization,
verificationService: a,
isErrored: !!m.organization,
disabled: (E = t("organization")) == null ? void 0 : E.disabled,
onChange: (s) => {
c(s), k(s, a), d("organization", s, a);
}
}
),
/* @__PURE__ */ e.jsxs("div", { className: "sid-names", children: [
/* @__PURE__ */ e.jsx(
v,
{
value: o.firstName,
isErrored: !!m.firstName,
disabled: (j = t("firstName")) == null ? void 0 : j.disabled,
onChange: (s) => {
l("firstName", s), d("firstName", s, a);
}
}
),
/* @__PURE__ */ e.jsx(
aa,
{
value: o.lastName,
isErrored: !!m.lastName,
disabled: (N = t("lastName")) == null ? void 0 : N.disabled,
onChange: (s) => {
l("lastName", s), d("lastName", s, a);
}
}
)
] }),
a.programTheme.idCheckAddOnEnabled ? /* @__PURE__ */ e.jsx(
sa,
{
errorId: m.birthDate,
locale: P,
disabled: (T = t("birthDate")) == null ? void 0 : T.disabled,
onChange: (s) => {
l("birthDate", s), d("birthDate", s, a);
},
value: o.birthDate
}
) : null,
!p && /* @__PURE__ */ e.jsx(
D,
{
value: o.email,
isErrored: !!m.email,
explanation: /* @__PURE__ */ e.jsx(
i,
{
id: "emailExplanation",
defaultMessage: "Must be your school-issued email address"
}
),
onChange: (s) => {
l("email", s), d("email", s, a);
},
onKeyDown: (s) => ea(s),
disabled: (M = t("email")) == null ? void 0 : M.disabled
}
),
a.programTheme.isSmsNotifierConfigured || a.programTheme.smsLoopEnabled ? /* @__PURE__ */ e.jsx(
oa,
{
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: (F = t("phoneNumber")) == null ? void 0 : F.disabled
}
) : null,
la(a.programTheme, o) ? /* @__PURE__ */ e.jsx(
na,
{
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,
B.customFormFields.map((s) => /* @__PURE__ */ e.jsx(ta, { config: s, verificationService: a })),
/* @__PURE__ */ e.jsx(
da,
{
verificationService: a,
isErrored: !!m.marketConsentValue,
onChange: (s) => {
l("metadata", {
...a.viewModel.metadata,
marketConsentValue: s
}), d(
"marketConsentValue",
s,
a
);
},
viewModel: o,
disabled: (y = t("marketConsentValue")) == null ? void 0 : y.disabled
}
),
/* @__PURE__ */ e.jsx(ma, { verificationService: a, suffix: "CollectAboveSubmit" }),
/* @__PURE__ */ e.jsx(
ra,
{
step: pa.collectTeacherPersonalInfo,
verificationService: a,
viewModel: o,
failedInstantMatch: f,
buttonText: /* @__PURE__ */ e.jsx(
i,
{
id: "step.personalInfo.submitButtonText",
defaultMessage: "Verify My Teacher Status"
}
)
}
)
] }) })
]
}
);
}, ja = Ca;
export {
ja as default
};