UNPKG

@seontechnologies/seon-id-verification

Version:

An advanced SDK featuring web components for natural person identification through document scanning, facial recognition, hand gesture, and face turning detection, designed for secure and efficient user verification.

103 lines (102 loc) 5.2 kB
import { l as e, t as j, c as f, a as S, j as i, L as N, S as y, B as D, i as I } from "./index-oGnhSncZ.mjs"; import * as v from "react"; import { useState as u, useCallback as w, useEffect as L } from "react"; import { c as A } from "./SessionDetails-D7H83xOl.mjs"; import P from "./OngoingSession-Bl4-7jhK.mjs"; const R = (l) => /* @__PURE__ */ v.createElement("svg", { width: 80, height: 80, viewBox: "0 0 80 80", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...l }, /* @__PURE__ */ v.createElement("path", { d: "M40 10C44.2188 10 47.9688 12.4609 49.8438 16.0938C53.7109 14.8047 58.1641 15.7422 61.2109 18.7891C64.2578 21.8359 65.1953 26.2891 63.9062 30.1562C67.5391 32.0312 70 35.7812 70 40C70 44.3359 67.5391 48.0859 63.9062 49.9609C65.1953 53.8281 64.2578 58.1641 61.2109 61.2109C58.1641 64.2578 53.7109 65.1953 49.8438 64.0234C47.9688 67.6562 44.2188 70 40 70C35.6641 70 31.9141 67.6562 30.0391 64.0234C26.1719 65.1953 21.8359 64.2578 18.7891 61.2109C15.7422 58.1641 14.8047 53.8281 15.9766 49.9609C12.3438 48.0859 10 44.3359 10 40C10 35.7812 12.3438 32.0312 15.9766 30.1562C14.8047 26.2891 15.7422 21.8359 18.7891 18.7891C21.8359 15.7422 26.1719 14.8047 30.0391 16.0938C31.9141 12.4609 35.6641 10 40 10ZM53.2422 34.4922C54.2969 33.4375 54.2969 31.6797 53.2422 30.625C52.0703 29.4531 50.3125 29.4531 49.2578 30.625L36.25 43.6328L30.7422 38.125C29.5703 36.9531 27.8125 36.9531 26.7578 38.125C25.5859 39.1797 25.5859 40.9375 26.7578 41.9922L34.2578 49.4922C35.3125 50.6641 37.0703 50.6641 38.2422 49.4922L53.2422 34.4922Z", fill: "currentColor" })), r = S.config, _ = I(), m = r.responseMethod === "ASYNC" ? !0 : _, { verification_completed_title: T, verification_completed_description: F } = e; let o = 0; const Z = ({ isTransferred: l = !1 }) => { const [a, c] = u(!m), [x, C] = u(T), [g, h] = u(F), d = w(({ title: t = e.verification_completed_title, description: n = e.verification_completed_description, interval: p }) => { C(t), h(n), clearInterval(p), c(!1); }, []), s = w(({ title: t = e.verification_denied_title, description: n = e.verification_denied_description, interval: p, event: E, logo: b }) => { j({ title: t, btnText: e.done_button, description: n, btnAction() { f(E); }, logo: b }), clearInterval(p), c(!1); }, []); L(() => { if (_) { d({ title: e.upload_completed_title, description: e.upload_completed_description }); return; } if (m || o > r.resultPollingCount) return; c(!0); const t = setInterval(async () => { const n = await A(!1); switch (n == null ? void 0 : n.sessionStatus) { case "APPROVED": d({ title: e.verification_success_title, description: e.verification_success_description, interval: t }); break; case "ABANDONED": s({ title: e.verification_denied_title, description: e.verification_denied_description, interval: t, event: "completedFailed" }); break; case "INVALIDATED": s({ title: e.verification_denied_title, description: e.verification_denied_description, interval: t, event: "completedFailed" }); break; case "REJECTED": s({ title: e.verification_denied_title, description: e.verification_denied_description, interval: t, event: "completedFailed" }); break; case "REVIEW": s({ title: e.verification_review_title, description: e.verification_review_description, interval: t, event: "completedPending", logo: "pending" }); break; default: o > r.resultPollingCount && (clearInterval(t), c(!1)); break; } o++; }, r.resultPollingInterval * 1e3); return () => { clearInterval(t), o = 0; }; }, [s, d]); const k = () => { if (o > r.resultPollingCount) { f("completed"); return; } f(m ? "completed" : "completedSuccess"); }; return i.jsxs(i.Fragment, { children: [a && l && i.jsx(P, { onNext: () => { }, isPolling: !1, data: {}, hardRefresh: () => { }, onBack: () => { }, onError: () => { }, setData: () => { } }), a && !l && i.jsx(N, {}), !a && i.jsx(y, { className: "tw-w-full", children: i.jsxs("div", { className: "tw-flex tw-flex-col tw-justify-center tw-items-center", children: [i.jsx(R, { width: 60, height: 60, className: "tw-text-positive dark:tw-text-positive-dark" }), i.jsxs("div", { className: "tw-flex tw-flex-col tw-justify-center tw-items-center tw-gap-[6px] tw-pt-4 tw-pb-8", children: [i.jsx("h1", { id: "title", className: "tw-text-primary-on-light-100 dark:tw-text-primary-on-light-100-dark", children: x }), i.jsx("p", { id: "subtitle", className: "tw-text-secondary-on-light-60 dark:tw-text-secondary-on-light-60-dark", children: g })] }), _ ? null : i.jsx(D, { id: "action_button", onClick: k, text: e.done_button })] }) })] }); }; export { Z as default };