UNPKG

@sheerid/jslib-nightly

Version:

SheerID JavaScript Library

45 lines (43 loc) 1.45 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.230.0-alpha.0 * BUILD_TIMESTAMP: 1778694697559 * BUILD_DATE: Wed May 13 2026 17:51:37 GMT+0000 (Coordinated Universal Time) * BUILD_COMMIT: 7af1c105d5485ac4ed1190c56d492bb4590667a9 */ import { u as R, R as o, f as g, h as n, l as h } from "../_mysheerid-preview.js"; const A = ({ verificationId: r, currentStep: l, viewModel: s, defaultRequiredFields: a = [] }) => { const d = R(), u = "status" in s ? s.status : void 0, [F, p] = o.useState(a), [f, C] = o.useState([]), q = (t) => F.some((e) => e.key === t), y = (t) => f.some((e) => e.key === t); return o.useEffect(() => { const t = new AbortController(); return (async () => { try { const e = await g( r, l, s ), i = n(() => e.fieldsToCollect.required, []), c = n(() => e.fieldsToCollect.optional, []); t.signal.aborted || (p(i), C(c), d({ type: "COLLECT_FIELDS", requiredFields: i, optionalFields: c })); } catch (e) { h.error(`Failed to determine fields to collect: ${e}`, l); } })(), () => { t.abort(); }; }, [s.countryChoice?.value, u]), { isFieldRequired: q, isFieldOptional: y }; }; export { A as u };