@sheerid/jslib-nightly
Version:
SheerID JavaScript Library
185 lines (183 loc) • 6.01 kB
JavaScript
/**
* VERSION: 2.154.0-alpha.1
* BUILD_TIMESTAMP: 1763401626706
* BUILD_DATE: Mon Nov 17 2025 17:47:06 GMT+0000 (Coordinated Universal Time)
* BUILD_COMMIT: 73f4468155aaed0f31ab0d59dc3394018b939b6d
*/
import { k as f, aa as F, ab as c, i as M, o as d, j as a, N as P, O as D, m as R, x as T, a2 as V, f as l, T as k, U as A, a5 as q, ac as B, W as L, X as U, E as W, n as O, Y as _, Z as w, _ as H, $ as K, p as X, V as Y, ad as Z } from "./es6-OV3Jb0XZ.js";
import $ from "react";
import { injectIntl as z, FormattedHTMLMessage as p } from "react-intl";
import { u as G } from "./useCollectFieldsEndpoint-BDmlArxx.js";
const J = ({ verificationService: s, intl: C }) => {
const o = s.viewModel, { fieldValidationErrors: t } = s, r = s.verificationResponse, h = f(r), b = F(
s.programTheme,
C
), i = c(b), m = M(() => 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 = D();
!t.phoneNumber && r.errorIds && r.errorIds.includes("invalidPhoneNumber") && s.updateFieldValidationErrors({
...t,
phoneNumber: "invalidPhoneNumber"
});
const n = (e, E) => {
const I = Z(o, e, E);
s.updateViewModel(I);
}, { isFieldRequired: u } = G({
verificationId: r.verificationId,
currentStep: r.currentStep,
viewModel: o,
defaultRequiredFields: g
});
return $.useEffect(() => {
d("phoneNumber", o.phoneNumber, s);
}, [o.country]), /* @__PURE__ */ a.jsxs(
P,
{
verificationService: s,
step: r.currentStep,
children: [
/* @__PURE__ */ a.jsx(R, { verificationService: s, classNameIdentifier: "age" }),
/* @__PURE__ */ a.jsx(T, { verificationService: s }),
/* @__PURE__ */ a.jsx(
V,
{
verificationService: s,
disabled: l("country")?.disabled
}
),
/* @__PURE__ */ a.jsxs("div", { className: "sid-names", children: [
/* @__PURE__ */ a.jsx(
k,
{
value: o.firstName,
isErrored: !!t.firstName,
disabled: l("firstName")?.disabled,
onChange: (e) => {
n("firstName", e), d("firstName", e, s);
}
}
),
/* @__PURE__ */ a.jsx(
A,
{
value: o.lastName,
isErrored: !!t.lastName,
disabled: l("lastName")?.disabled,
onChange: (e) => {
n("lastName", e), d("lastName", e, s);
}
}
)
] }),
/* @__PURE__ */ a.jsx(
q,
{
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(
B,
{
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(
L,
{
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) => O(e),
disabled: l("email")?.disabled
}
),
x ? /* @__PURE__ */ a.jsx(
_,
{
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(w, { config: e, verificationService: s })),
/* @__PURE__ */ a.jsx(
H,
{
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(K, { verificationService: s, suffix: "CollectAboveSubmit" }),
/* @__PURE__ */ a.jsx(
X,
{
step: Y.collectAgePersonalInfo,
verificationService: s,
viewModel: o,
failedInstantMatch: h,
buttonText: /* @__PURE__ */ a.jsx(
p,
{
id: "step.personalInfo.submitButtonText",
defaultMessage: "Verify and continue"
}
)
}
)
]
}
);
}, se = z(J);
export {
se as default
};