UNPKG

@sheerid/jslib-nightly

Version:

SheerID JavaScript Library

42 lines (40 loc) 1.36 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.113.0-alpha.0 * BUILD_TIMESTAMP: 1750184650058 * BUILD_DATE: Tue Jun 17 2025 18:24:10 GMT+0000 (Coordinated Universal Time) * BUILD_COMMIT: 896154e79f58fffa6d52f3ed37f2db760a63df88 */ import { R as o, c as m, d as r, l as q } from "../_mysheerid-preview.js"; const b = ({ verificationId: n, currentStep: l, viewModel: s, defaultRequiredFields: a = [] }) => { var i; const c = "status" in s ? s.status : void 0, [d, u] = o.useState(a), [F, f] = o.useState([]), p = (t) => d.some((e) => e.key === t), C = (t) => F.some((e) => e.key === t); return o.useEffect(() => { const t = new AbortController(); return (async () => { try { const e = await m( n, l, s ), R = r(() => e.fieldsToCollect.required, []), g = r(() => e.fieldsToCollect.optional, []); t.signal.aborted || (u(R), f(g)); } catch (e) { q.error(`Failed to determine fields to collect: ${e}`, l); } })(), () => { t.abort(); }; }, [(i = s.countryChoice) == null ? void 0 : i.value, c]), { isFieldRequired: p, isFieldOptional: C }; }; export { b as u };