UNPKG

@sheerid/jslib-nightly

Version:

SheerID JavaScript Library

46 lines (44 loc) 1.48 kB
/** * 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.130.0-alpha.4 * BUILD_TIMESTAMP: 1759000347595 * BUILD_DATE: Sat Sep 27 2025 19:12:27 GMT+0000 (Coordinated Universal Time) * BUILD_COMMIT: be6ef87ab40e8747994d32363389cf39e36a4326 */ import { u as g, R as o, c as m, d as r, l as b } from "../_mysheerid-preview.js"; const E = ({ verificationId: a, currentStep: l, viewModel: s, defaultRequiredFields: d = [] }) => { var i; const u = g(), F = "status" in s ? s.status : void 0, [p, C] = o.useState(d), [f, q] = o.useState([]), y = (t) => p.some((e) => e.key === t), R = (t) => f.some((e) => e.key === t); return o.useEffect(() => { const t = new AbortController(); return (async () => { try { const e = await m( a, l, s ), c = r(() => e.fieldsToCollect.required, []), n = r(() => e.fieldsToCollect.optional, []); t.signal.aborted || (C(c), q(n), u({ type: "COLLECT_FIELDS", requiredFields: c, optionalFields: n })); } catch (e) { b.error(`Failed to determine fields to collect: ${e}`, l); } })(), () => { t.abort(); }; }, [(i = s.countryChoice) == null ? void 0 : i.value, F]), { isFieldRequired: y, isFieldOptional: R }; }; export { E as u };