@sheerid/jslib-nightly
Version:
SheerID JavaScript Library
274 lines (272 loc) • 9.42 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 A, j as a, M as U, m as X, al as Y, E as z, f as n, u as d, i as m, N as Z, w as _, a1 as G, ab as J, ao as Q, ap as $, aq as S, ar as c, q as L, O as v, T as ee, a4 as se, n as ae, X as oe, W as ne, Y as te, Z as de, _ as le, o as re, V as me, as as pe } from "./es6-B9qAIX4x.js";
import { injectIntl as ie, FormattedHTMLMessage as g } from "react-intl";
import { u as ue, E as ge } from "./useEmailFirstExperiment-BOHCZCqy.js";
const Ce = ({
intl: C,
verificationService: s
}) => {
var h, x, E, j, F, N, M, R, I, k, y;
const o = s.viewModel, { fieldValidationErrors: t } = s, p = s.verificationResponse, D = A(p), O = Z(), P = o.localeChoice.value, l = (e, u) => {
const r = L(
o,
(W) => {
W[e] = u;
}
);
s.updateViewModel(r);
}, {
isEmailUpTop: i,
isEmailValidationLoading: T,
showFormFields: w,
emailLookupResponse: b,
emailOnBlur: f,
emailOnKeyDown: B,
handleResendClick: V,
showEmailLookupResponseMessages: q,
enableFormFields: H,
handleOnClickProceedHere: K
} = ue(
s.programId,
o.email,
s.verificationResponse.segment
);
return /* @__PURE__ */ a.jsxs(
U,
{
verificationService: s,
step: p.currentStep,
children: [
/* @__PURE__ */ a.jsx(
X,
{
verificationService: s,
classNameIdentifier: "first-responder"
}
),
// #region email-first-experiment
i && /* @__PURE__ */ a.jsx(a.Fragment, { children: /* @__PURE__ */ a.jsxs("div", { className: "email-input-wrapper", children: [
T && /* @__PURE__ */ a.jsx("div", { className: "email-input-wrapper-frame", children: /* @__PURE__ */ a.jsx("div", { className: "sid-spinner scaled", children: /* @__PURE__ */ a.jsx(Y, {}) }) }),
/* @__PURE__ */ a.jsx(
z,
{
value: o.email,
isErrored: !!t.email,
explanation: /* @__PURE__ */ a.jsx(
g,
{
id: "emailExplanation",
defaultMessage: "Personal email address is recommended"
}
),
onChange: (e) => {
l("email", e), d("email", e, s);
},
onKeyDown: B,
onBlur: f,
disabled: (h = n("email")) == null ? void 0 : h.disabled
}
)
] }) }),
q && b && /* @__PURE__ */ a.jsx(
ge,
{
emailLookupResponse: b,
onResendClick: V,
onHandleClickLink: K
}
),
w && /* @__PURE__ */ a.jsx(a.Fragment, { children: /* @__PURE__ */ a.jsxs("div", { className: H || !i ? "" : "sid-disable-elements", children: [
/* @__PURE__ */ a.jsx(_, { verificationService: s }),
/* @__PURE__ */ a.jsx(
G,
{
verificationService: s,
disabled: (x = n("country")) == null ? void 0 : x.disabled
}
),
/* @__PURE__ */ a.jsx(
J,
{
segmentId: "first-responder",
value: {
value: o.status,
label: $(
C,
o.status,
pe
)
},
isErrored: !!t.status,
errorId: "invalidFirstResponderStatus",
disabled: (E = n("status")) == null ? void 0 : E.disabled,
options: Q(
C,
p.availableStatuses
),
onChange: (e) => {
l("status", e ? e.value : ""), d(
"status",
e ? e.value : "",
s
);
}
}
),
/* @__PURE__ */ a.jsx(
S,
{
isErrored: !!t.organization,
onChange: (e = c.organization) => {
const u = L(o, (r) => {
r.organization = {
id: e.id,
idExtended: e.idExtended,
name: e.name,
source: e.source
}, o.organization && o.organization.source !== void 0 && (r.organization.source = o.organization.source), m(() => s.programTheme.openOrgSearchEnabled) && m(() => e.id) === 0 && m(() => e.name, "").length > 0 ? r.postalCode = o.postalCode ? o.postalCode : "" : (o.postalCode || o.postalCode === "") && delete r.postalCode;
});
s.updateViewModel(u), d("organization", e, s);
},
value: s.viewModel.organization,
verificationService: s,
disabled: (j = n("organization")) == null ? void 0 : j.disabled
}
),
/* @__PURE__ */ a.jsxs("div", { className: "sid-names", children: [
/* @__PURE__ */ a.jsx(
v,
{
value: o.firstName,
isErrored: !!t.firstName,
disabled: (F = n("firstName")) == null ? void 0 : F.disabled,
onChange: (e) => {
l("firstName", e), d("firstName", e, s);
}
}
),
/* @__PURE__ */ a.jsx(
ee,
{
value: o.lastName,
isErrored: !!t.lastName,
disabled: (N = n("lastName")) == null ? void 0 : N.disabled,
onChange: (e) => {
l("lastName", e), d("lastName", e, s);
}
}
)
] }),
/* @__PURE__ */ a.jsx(
se,
{
errorId: t.birthDate,
locale: P,
onChange: (e) => {
l("birthDate", e), d("birthDate", e, s);
},
value: o.birthDate,
disabled: (M = n("birthDate")) == null ? void 0 : M.disabled
}
),
!i && /* @__PURE__ */ a.jsx(
z,
{
value: o.email,
isErrored: !!t.email,
explanation: /* @__PURE__ */ a.jsx(
g,
{
id: "emailExplanation",
defaultMessage: "Needed to send you your unique code"
}
),
onChange: (e) => {
l("email", e), d("email", e, s);
},
onKeyDown: (e) => ae(e),
disabled: (R = n("email")) == null ? void 0 : R.disabled
}
),
s.programTheme.isSmsNotifierConfigured || s.programTheme.smsLoopEnabled ? /* @__PURE__ */ a.jsx(
oe,
{
isRequired: !!s.programTheme.smsLoopEnabled,
value: o.phoneNumber,
isErrored: !!t.phoneNumber,
onChange: (e) => {
l("phoneNumber", e), d(
"phoneNumber",
e,
s
);
},
selectedCountryCode: o.countryChoice && o.countryChoice.value,
disabled: (I = n("phoneNumber")) == null ? void 0 : I.disabled
}
) : null,
m(() => s.programTheme.openOrgSearchEnabled) && m(() => o.organization.id) === 0 && m(() => o.organization.name, "").length > 0 && /* @__PURE__ */ a.jsx(
ne,
{
isErrored: !!t.postalCode,
onChange: (e) => {
l("postalCode", e), d(
"postalCode",
e,
s
);
},
value: o.postalCode,
disabled: (k = n("postalCode")) == null ? void 0 : k.disabled
}
),
O.customFormFields.map((e) => /* @__PURE__ */ a.jsx(te, { config: e, verificationService: s })),
/* @__PURE__ */ a.jsx(
de,
{
verificationService: s,
isErrored: !!t.marketConsentValue,
onChange: (e) => {
l("metadata", {
...s.viewModel.metadata,
marketConsentValue: e
}), d(
"marketConsentValue",
e,
s
);
},
viewModel: o,
disabled: (y = n("marketConsentValue")) == null ? void 0 : y.disabled
}
),
/* @__PURE__ */ a.jsx(le, { verificationService: s, suffix: "CollectAboveSubmit" }),
/* @__PURE__ */ a.jsx(
re,
{
step: me.collectFirstResponderPersonalInfo,
verificationService: s,
viewModel: o,
failedInstantMatch: D,
buttonText: /* @__PURE__ */ a.jsx(
g,
{
id: "step.personalInfo.submitButtonText",
defaultMessage: "Verify My First Responder Status"
}
)
}
)
] }) })
]
}
);
}, Ee = ie(Ce);
export {
Ee as default
};