@sheerid/jslib-nightly
Version:
SheerID JavaScript Library
183 lines (181 loc) • 5.93 kB
JavaScript
/**
* VERSION: 2.154.0-alpha.1
* BUILD_TIMESTAMP: 1763401515326
* BUILD_DATE: Mon Nov 17 2025 17:45:15 GMT+0000 (Coordinated Universal Time)
* BUILD_COMMIT: 73f4468155aaed0f31ab0d59dc3394018b939b6d
*/
import { i as F, h as M, a5 as c, a6 as f, e as P, R as D, k as d, j as a, x as R, y as V, P as k, z as A, Y as T, a as l, B as q, D as B, $ as L, a7 as H, G as K, H as U, E as W, f as w, c as p, J as O, K as z, M as G, N as J, m as Y, V as $, a8 as Q } from "../sheerid.js";
import { u as X } from "./useCollectFieldsEndpoint-D0VXzWyt.js";
const Z = ({ verificationService: s, intl: C }) => {
const o = s.viewModel, { fieldValidationErrors: t } = s, r = s.verificationResponse, h = M(r), b = c(
s.programTheme,
C
), i = f(b), m = P(() => o.countryChoice.value, i.value), g = m === "US" ? [{ key: "postalCode" }] : [], x = m !== "US" || s.programTheme.isSmsNotifierConfigured || s.programTheme.smsLoopEnabled, N = m !== "US" || s.programTheme.smsLoopEnabled, y = o.localeChoice.value, j = V();
!t.phoneNumber && r.errorIds && r.errorIds.includes("invalidPhoneNumber") && s.updateFieldValidationErrors({
...t,
phoneNumber: "invalidPhoneNumber"
});
const n = (e, E) => {
const I = Q(o, e, E);
s.updateViewModel(I);
}, { isFieldRequired: u } = X({
verificationId: r.verificationId,
currentStep: r.currentStep,
viewModel: o,
defaultRequiredFields: g
});
return D.useEffect(() => {
d("phoneNumber", o.phoneNumber, s);
}, [o.country]), /* @__PURE__ */ a.jsxs(
R,
{
verificationService: s,
step: r.currentStep,
children: [
/* @__PURE__ */ a.jsx(k, { verificationService: s, classNameIdentifier: "age" }),
/* @__PURE__ */ a.jsx(A, { verificationService: s }),
/* @__PURE__ */ a.jsx(
T,
{
verificationService: s,
disabled: l("country")?.disabled
}
),
/* @__PURE__ */ a.jsxs("div", { className: "sid-names", children: [
/* @__PURE__ */ a.jsx(
q,
{
value: o.firstName,
isErrored: !!t.firstName,
disabled: l("firstName")?.disabled,
onChange: (e) => {
n("firstName", e), d("firstName", e, s);
}
}
),
/* @__PURE__ */ a.jsx(
B,
{
value: o.lastName,
isErrored: !!t.lastName,
disabled: l("lastName")?.disabled,
onChange: (e) => {
n("lastName", e), d("lastName", e, s);
}
}
)
] }),
/* @__PURE__ */ a.jsx(
L,
{
errorId: t.birthDate,
locale: y,
onChange: (e) => {
n("birthDate", e), d("birthDate", e, s);
},
value: o.birthDate,
disabled: l("birthDate")?.disabled
}
),
u("city") && /* @__PURE__ */ a.jsx(
H,
{
value: o.city,
isRequired: !0,
isErrored: !!t.city,
errorId: t.city,
disabled: l("city")?.disabled,
onChange: (e) => {
n("city", e), d("city", e, s);
}
}
),
u("address1") && /* @__PURE__ */ a.jsx(
K,
{
value: o.address1,
isRequired: !0,
isErrored: !!t.address1,
errorId: t.address1,
onChange: (e) => {
n("address1", e), d("address1", e, s);
}
}
),
u("postalCode") && /* @__PURE__ */ a.jsx(
U,
{
isErrored: !!t.postalCode,
onChange: (e) => {
n("postalCode", e), d("postalCode", e, s);
},
value: o.postalCode,
disabled: l("postalCode")?.disabled
}
),
/* @__PURE__ */ a.jsx(
W,
{
value: o.email,
isErrored: !!t.email,
explanation: /* @__PURE__ */ a.jsx(p, { id: "emailExplanation", defaultMessage: " " }),
onChange: (e) => {
n("email", e), d("email", e, s);
},
onKeyDown: (e) => w(e),
disabled: l("email")?.disabled
}
),
x ? /* @__PURE__ */ a.jsx(
O,
{
isRequired: N,
value: o.phoneNumber,
isErrored: !!t.phoneNumber,
onChange: (e) => {
n("phoneNumber", e), d("phoneNumber", e, s);
},
selectedCountryCode: o.countryChoice && o.countryChoice.value,
disabled: l("phoneNumber")?.disabled
}
) : null,
j.customFormFields.map((e) => /* @__PURE__ */ a.jsx(z, { config: e, verificationService: s })),
/* @__PURE__ */ a.jsx(
G,
{
verificationService: s,
isErrored: !!t.marketConsentValue,
onChange: (e) => {
n("metadata", {
...s.viewModel.metadata,
marketConsentValue: e
}), d("marketConsentValue", e, s);
},
viewModel: o,
disabled: l("marketConsentValue")?.disabled
}
),
/* @__PURE__ */ a.jsx(J, { verificationService: s, suffix: "CollectAboveSubmit" }),
/* @__PURE__ */ a.jsx(
Y,
{
step: $.collectAgePersonalInfo,
verificationService: s,
viewModel: o,
failedInstantMatch: h,
buttonText: /* @__PURE__ */ a.jsx(
p,
{
id: "step.personalInfo.submitButtonText",
defaultMessage: "Verify and continue"
}
)
}
)
]
}
);
}, v = F(Z);
export {
v as default
};