@realeyes/verifeye-sdk 1.7.0 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,9 @@
1
- import { jsx as _, jsxs as j, Fragment as tn } from "react/jsx-runtime";
1
+ import { jsx as _, jsxs as j, Fragment as rn } from "react/jsx-runtime";
2
2
  import { Fragment as qn, createContext as Un, useContext as Fn, useRef as k, useEffect as Z, useState as w, lazy as Bn, useMemo as Gn, Suspense as Hn } from "react";
3
- import { useMediaQuery as Wn, Box as Re, Link as We, CircularProgress as Ie, createTheme as Zn, Dialog as Ze, DialogTitle as Ye, DialogContent as Je, DialogContentText as Qe, DialogActions as Yn, Button as Jn, ThemeProvider as Qn, ScopedCssBaseline as Xn, Container as es } from "@mui/material";
3
+ import { useMediaQuery as Wn, Box as Re, Link as Ze, CircularProgress as Ie, createTheme as Zn, Dialog as Ye, DialogTitle as Je, DialogContent as Qe, DialogContentText as Xe, DialogActions as Yn, Button as Jn, ThemeProvider as Qn, ScopedCssBaseline as Xn, Container as es } from "@mui/material";
4
4
  import Y from "@mui/material/DialogContent";
5
5
  import ns from "@mui/material/IconButton";
6
- import rn from "@mui/material/SvgIcon";
6
+ import on from "@mui/material/SvgIcon";
7
7
  import M from "@mui/material/Stack";
8
8
  import z from "@mui/material/Typography";
9
9
  import { useTheme as J, responsiveFontSizes as re } from "@mui/material/styles";
@@ -27,7 +27,7 @@ import './index.css';class rs {
27
27
  this.onCompleted(e.sessionId);
28
28
  }
29
29
  }
30
- const on = "1.7.0", an = ["eu", "us"];
30
+ const Te = "1.8.0", an = ["eu", "us"];
31
31
  function os(i) {
32
32
  return typeof i == "string" && an.includes(i);
33
33
  }
@@ -50,10 +50,10 @@ class as {
50
50
  }
51
51
  }
52
52
  }
53
- const _s = ({ size: i = 16, color: e }) => /* @__PURE__ */ _(rn, { children: /* @__PURE__ */ j("svg", { xmlns: "http://www.w3.org/2000/svg", style: { height: i, width: i }, viewBox: "0 0 24 24", fill: e || "currentColor", children: [
53
+ const _s = ({ size: i = 16, color: e }) => /* @__PURE__ */ _(on, { children: /* @__PURE__ */ j("svg", { xmlns: "http://www.w3.org/2000/svg", style: { height: i, width: i }, viewBox: "0 0 24 24", fill: e || "currentColor", children: [
54
54
  /* @__PURE__ */ _("path", { d: "M0 0h24v24H0V0z", fill: "none" }),
55
55
  /* @__PURE__ */ _("path", { d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z" })
56
- ] }) }), Xe = /<b>|<\/b>|<br\s*\/?>|\{(\w+)\}/g, cs = (i) => !i.includes("<") && !i.includes("{");
56
+ ] }) }), en = /<b>|<\/b>|<br\s*\/?>|\{(\w+)\}/g, cs = (i) => !i.includes("<") && !i.includes("{");
57
57
  function ls(i, e = {}) {
58
58
  if (cs(i)) return i;
59
59
  const n = [];
@@ -61,9 +61,9 @@ function ls(i, e = {}) {
61
61
  const a = (o) => {
62
62
  o && t.push(o);
63
63
  };
64
- Xe.lastIndex = 0;
64
+ en.lastIndex = 0;
65
65
  let r;
66
- for (; (r = Xe.exec(i)) !== null; ) {
66
+ for (; (r = en.exec(i)) !== null; ) {
67
67
  a(i.slice(l, r.index)), l = r.index + r[0].length;
68
68
  const o = r[0];
69
69
  if (o === "<b>")
@@ -77,9 +77,9 @@ function ls(i, e = {}) {
77
77
  Object.hasOwn(e, c) ? t.push(/* @__PURE__ */ _(qn, { children: e[c] }, d++)) : a(o);
78
78
  }
79
79
  }
80
- return a(i.slice(l)), s && n.push(/* @__PURE__ */ _("b", { children: s }, d++)), /* @__PURE__ */ _(tn, { children: n });
80
+ return a(i.slice(l)), s && n.push(/* @__PURE__ */ _("b", { children: s }, d++)), /* @__PURE__ */ _(rn, { children: n });
81
81
  }
82
- function en(i, e = {}) {
82
+ function nn(i, e = {}) {
83
83
  return i.includes("{") ? i.replace(
84
84
  /\{(\w+)\}/g,
85
85
  (n, s) => Object.hasOwn(e, s) ? String(e[s]) : n
@@ -2979,7 +2979,7 @@ function ln(i, e) {
2979
2979
  const t = (a) => s[a] ?? _n[a] ?? a, l = e ? Object.entries(e).some(([a, r]) => a.startsWith("consent_") && typeof r == "string") : !1, d = () => [
2980
2980
  t("consent_title"),
2981
2981
  t("consent_body"),
2982
- en(t("consent_notice"), {
2982
+ nn(t("consent_notice"), {
2983
2983
  privacyPolicy: t("consent_notice_privacy_policy_link"),
2984
2984
  terms: t("consent_notice_terms_link")
2985
2985
  })
@@ -2987,7 +2987,7 @@ function ln(i, e) {
2987
2987
 
2988
2988
  `).replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g, "").trim();
2989
2989
  return {
2990
- t: (a, r) => en(t(a), r),
2990
+ t: (a, r) => nn(t(a), r),
2991
2991
  tr: (a, r) => ls(t(a), r),
2992
2992
  locale: YU(i),
2993
2993
  consentCustomized: l,
@@ -2996,7 +2996,7 @@ function ln(i, e) {
2996
2996
  }
2997
2997
  const mn = Un(ln()), B = () => Fn(mn), _e = ({ uniqueId: i, visible: e = !1 }) => {
2998
2998
  const { tr: n } = B();
2999
- return e ? /* @__PURE__ */ _(tn, { children: i && /* @__PURE__ */ _(
2999
+ return e ? /* @__PURE__ */ _(rn, { children: i && /* @__PURE__ */ _(
3000
3000
  z,
3001
3001
  {
3002
3002
  variant: "body2",
@@ -3036,7 +3036,7 @@ const mn = Un(ln()), B = () => Fn(mn), _e = ({ uniqueId: i, visible: e = !1 }) =
3036
3036
  children: e
3037
3037
  }
3038
3038
  ) : null;
3039
- }, QU = (i) => /* @__PURE__ */ _(rn, { ...i, children: /* @__PURE__ */ _("path", { d: "M11 7h2v2h-2zm0 4h2v6h-2zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8" }) }), he = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20id='Layer_1'%20xmlns='http://www.w3.org/2000/svg'%20version='1.1'%20viewBox='0%200%20147%20147'%3e%3c!--%20Generator:%20Adobe%20Illustrator%2030.2.0,%20SVG%20Export%20Plug-In%20.%20SVG%20Version:%202.1.1%20Build%20105)%20--%3e%3cdefs%3e%3cstyle%3e%20.st0%20{%20fill:%20%23263235;%20}%20.st1%20{%20fill:%20%2327eabf;%20}%20%3c/style%3e%3c/defs%3e%3ccircle%20class='st1'%20cx='73.2500001'%20cy='73.7499999'%20r='59.9414062'/%3e%3cpath%20class='st0'%20d='M73,73.5c-2.55,0-4.6875001-.8625-6.4125001-2.5875s-2.5875-3.8625001-2.5875-6.4125001c0-2.4999985.8625-4.6250016,2.5875-6.3750001s3.8625001-2.625,6.4125001-2.625c2.4999985,0,4.6250016.8750015,6.3750001,2.625s2.625,3.8750016,2.625,6.3750001c0,2.55-.8750015,4.6875001-2.625,6.4125001s-3.8750016,2.5875-6.3750001,2.5875ZM54.9999997,88.5000002v-2.7c0-1.05.2625-2.0374993.7875-2.9625s1.2375-1.6624993,2.1375-2.2125c2.2999993-1.35,4.7125008-2.3749993,7.2375001-3.075s5.1375001-1.05,7.8375001-1.05,5.3124986.3499992,7.8375001,1.05,4.9374985,1.725,7.2375001,3.075c.9.5500008,1.6125,1.2874993,2.1375,2.2125s.7875,1.9125.7875,2.9625v2.7c0,.8500008-.2874985,1.5625008-.8625,2.1375-.5750015.5750004-1.2875015.8625-2.1375.8625h-30.0000004c-.8500008,0-1.5625008-.2874996-2.1375-.8625-.5750004-.5749992-.8625-1.2874993-.8625-2.1375ZM48.9999996,103.5000004c-1.65,0-3.0625002-.5875002-4.2375001-1.7625s-1.7625-2.5875-1.7625-4.2375001v-9.0000001c0-.8500008.2875002-1.5625008.8625-2.1375s1.2874998-.8625,2.1375-.8625c.8499996,0,1.5624996.2875008,2.1375.8625s.8625,1.2874993.8625,2.1375v9.0000001h9.0000001c.8500008,0,1.5625008.2874996,2.1375.8625s.8625,1.2875004.8625,2.1375c0,.8500002-.2875008,1.5625002-.8625,2.1375s-1.2874993.8625-2.1375.8625h-9.0000001ZM42.9999996,58.4999998v-9.0000001c0-1.65.5875002-3.0624985,1.7625-4.2375001s2.5875-1.7625,4.2375001-1.7625h9.0000001c.8500008,0,1.5625008.2874985,2.1375.8625s.8625,1.2875015.8625,2.1375-.2875008,1.5624985-.8625,2.1375-1.2874993.8625-2.1375.8625h-9.0000001v9.0000001c0,.8499985-.2874996,1.5624985-.8625,2.1375s-1.2875004.8625-2.1375.8625c-.8500002,0-1.5625002-.2874985-2.1375-.8625s-.8625-1.2875015-.8625-2.1375ZM97.0000004,103.5000004h-9.0000001c-.8499985,0-1.5624985-.2875002-2.1375-.8625s-.8625-1.2874998-.8625-2.1375c0-.8499996.2874985-1.5624996.8625-2.1375s1.2875015-.8625,2.1375-.8625h9.0000001v-9.0000001c0-.8500008.2874985-1.5625008.8625-2.1375s1.2875015-.8625,2.1375-.8625,1.5624985.2875008,2.1375.8625.8625,1.2874993.8625,2.1375v9.0000001c0,1.65-.5874985,3.0625002-1.7625,4.2375001s-2.5875,1.7625-4.2375001,1.7625ZM97.0000004,58.4999998v-9.0000001h-9.0000001c-.8499985,0-1.5624985-.2874985-2.1375-.8625s-.8625-1.2875015-.8625-2.1375.2874985-1.5624985.8625-2.1375,1.2875015-.8625,2.1375-.8625h9.0000001c1.65,0,3.0624985.5874985,4.2375001,1.7625s1.7625,2.5875,1.7625,4.2375001v9.0000001c0,.8499985-.2874985,1.5624985-.8625,2.1375s-1.2875015.8625-2.1375.8625-1.5624985-.2874985-2.1375-.8625-.8625-1.2875015-.8625-2.1375Z'/%3e%3c/svg%3e", dn = "https://realeyes.ai/privacy-policy/", vn = "https://realeyes.ai/terms-for-users/", XU = ({
3039
+ }, QU = (i) => /* @__PURE__ */ _(on, { ...i, children: /* @__PURE__ */ _("path", { d: "M11 7h2v2h-2zm0 4h2v6h-2zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8" }) }), he = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20id='Layer_1'%20xmlns='http://www.w3.org/2000/svg'%20version='1.1'%20viewBox='0%200%20147%20147'%3e%3c!--%20Generator:%20Adobe%20Illustrator%2030.2.0,%20SVG%20Export%20Plug-In%20.%20SVG%20Version:%202.1.1%20Build%20105)%20--%3e%3cdefs%3e%3cstyle%3e%20.st0%20{%20fill:%20%23263235;%20}%20.st1%20{%20fill:%20%2327eabf;%20}%20%3c/style%3e%3c/defs%3e%3ccircle%20class='st1'%20cx='73.2500001'%20cy='73.7499999'%20r='59.9414062'/%3e%3cpath%20class='st0'%20d='M73,73.5c-2.55,0-4.6875001-.8625-6.4125001-2.5875s-2.5875-3.8625001-2.5875-6.4125001c0-2.4999985.8625-4.6250016,2.5875-6.3750001s3.8625001-2.625,6.4125001-2.625c2.4999985,0,4.6250016.8750015,6.3750001,2.625s2.625,3.8750016,2.625,6.3750001c0,2.55-.8750015,4.6875001-2.625,6.4125001s-3.8750016,2.5875-6.3750001,2.5875ZM54.9999997,88.5000002v-2.7c0-1.05.2625-2.0374993.7875-2.9625s1.2375-1.6624993,2.1375-2.2125c2.2999993-1.35,4.7125008-2.3749993,7.2375001-3.075s5.1375001-1.05,7.8375001-1.05,5.3124986.3499992,7.8375001,1.05,4.9374985,1.725,7.2375001,3.075c.9.5500008,1.6125,1.2874993,2.1375,2.2125s.7875,1.9125.7875,2.9625v2.7c0,.8500008-.2874985,1.5625008-.8625,2.1375-.5750015.5750004-1.2875015.8625-2.1375.8625h-30.0000004c-.8500008,0-1.5625008-.2874996-2.1375-.8625-.5750004-.5749992-.8625-1.2874993-.8625-2.1375ZM48.9999996,103.5000004c-1.65,0-3.0625002-.5875002-4.2375001-1.7625s-1.7625-2.5875-1.7625-4.2375001v-9.0000001c0-.8500008.2875002-1.5625008.8625-2.1375s1.2874998-.8625,2.1375-.8625c.8499996,0,1.5624996.2875008,2.1375.8625s.8625,1.2874993.8625,2.1375v9.0000001h9.0000001c.8500008,0,1.5625008.2874996,2.1375.8625s.8625,1.2875004.8625,2.1375c0,.8500002-.2875008,1.5625002-.8625,2.1375s-1.2874993.8625-2.1375.8625h-9.0000001ZM42.9999996,58.4999998v-9.0000001c0-1.65.5875002-3.0624985,1.7625-4.2375001s2.5875-1.7625,4.2375001-1.7625h9.0000001c.8500008,0,1.5625008.2874985,2.1375.8625s.8625,1.2875015.8625,2.1375-.2875008,1.5624985-.8625,2.1375-1.2874993.8625-2.1375.8625h-9.0000001v9.0000001c0,.8499985-.2874996,1.5624985-.8625,2.1375s-1.2875004.8625-2.1375.8625c-.8500002,0-1.5625002-.2874985-2.1375-.8625s-.8625-1.2875015-.8625-2.1375ZM97.0000004,103.5000004h-9.0000001c-.8499985,0-1.5624985-.2875002-2.1375-.8625s-.8625-1.2874998-.8625-2.1375c0-.8499996.2874985-1.5624996.8625-2.1375s1.2875015-.8625,2.1375-.8625h9.0000001v-9.0000001c0-.8500008.2874985-1.5625008.8625-2.1375s1.2875015-.8625,2.1375-.8625,1.5624985.2875008,2.1375.8625.8625,1.2874993.8625,2.1375v9.0000001c0,1.65-.5874985,3.0625002-1.7625,4.2375001s-2.5875,1.7625-4.2375001,1.7625ZM97.0000004,58.4999998v-9.0000001h-9.0000001c-.8499985,0-1.5624985-.2874985-2.1375-.8625s-.8625-1.2875015-.8625-2.1375.2874985-1.5624985.8625-2.1375,1.2875015-.8625,2.1375-.8625h9.0000001c1.65,0,3.0624985.5874985,4.2375001,1.7625s1.7625,2.5875,1.7625,4.2375001v9.0000001c0,.8499985-.2874985,1.5624985-.8625,2.1375s-1.2875015.8625-2.1375.8625-1.5624985-.2874985-2.1375-.8625-.8625-1.2875015-.8625-2.1375Z'/%3e%3c/svg%3e", dn = "https://realeyes.ai/privacy-policy/", vn = "https://realeyes.ai/terms-for-users/", XU = ({
3040
3040
  isOpen: i,
3041
3041
  onAccept: e,
3042
3042
  onClose: n,
@@ -3142,7 +3142,7 @@ const mn = Un(ln()), B = () => Fn(mn), _e = ({ uniqueId: i, visible: e = !1 }) =
3142
3142
  sx: { fontSize: "0.8rem", color: "#666666", lineHeight: 1.5 },
3143
3143
  children: o("consent_notice", {
3144
3144
  privacyPolicy: /* @__PURE__ */ _(
3145
- We,
3145
+ Ze,
3146
3146
  {
3147
3147
  href: dn,
3148
3148
  target: "_blank",
@@ -3152,7 +3152,7 @@ const mn = Un(ln()), B = () => Fn(mn), _e = ({ uniqueId: i, visible: e = !1 }) =
3152
3152
  }
3153
3153
  ),
3154
3154
  terms: /* @__PURE__ */ _(
3155
- We,
3155
+ Ze,
3156
3156
  {
3157
3157
  href: vn,
3158
3158
  target: "_blank",
@@ -3205,7 +3205,7 @@ class pe extends Error {
3205
3205
  super(e), this.name = "PermanentSessionError", this.status = n, Object.setPrototypeOf(this, new.target.prototype);
3206
3206
  }
3207
3207
  }
3208
- async function nn(i, e) {
3208
+ async function sn(i, e) {
3209
3209
  if (i.status === 429) throw new te();
3210
3210
  const s = (await i.text()).trim() || e;
3211
3211
  throw i.status >= 400 && i.status < 500 ? new pe(s, i.status) : new Error(s);
@@ -3959,16 +3959,16 @@ class q {
3959
3959
  this.cameraAccessResult = e, this.isGranted = e === O.GRANTED, this.detailedCameraAccessResult = n;
3960
3960
  }
3961
3961
  }
3962
- function Te() {
3962
+ function De() {
3963
3963
  return crypto.randomUUID ? crypto.randomUUID() : `${Date.now()}-${Math.random().toString(16).slice(2)}`;
3964
3964
  }
3965
3965
  const ae = "verify-correlation-id";
3966
3966
  function oe() {
3967
3967
  let i = sessionStorage.getItem(ae);
3968
- return i || (i = Te(), i = i.replaceAll("-", ""), sessionStorage.setItem(ae, i)), i;
3968
+ return i || (i = De(), i = i.replaceAll("-", ""), sessionStorage.setItem(ae, i)), i;
3969
3969
  }
3970
3970
  function dF() {
3971
- const i = Te().replaceAll("-", "");
3971
+ const i = De().replaceAll("-", "");
3972
3972
  return sessionStorage.setItem(ae, i), i;
3973
3973
  }
3974
3974
  function vF() {
@@ -3996,17 +3996,18 @@ class fF {
3996
3996
  serverTimeOffset = 0;
3997
3997
  eventQueue = [];
3998
3998
  environment;
3999
+ authToken = void 0;
3999
4000
  constructor(e) {
4000
4001
  this.environment = e.getCurrentEnvironment();
4001
4002
  }
4002
- initialize(e) {
4003
- if (!e) {
4003
+ initialize(e, n) {
4004
+ if (this.authToken = n, !e) {
4004
4005
  this.logMessage("warn", "Kinesis configuration not available - events will not be sent"), this.kinesisClient = null, this.kinesisConfig = null;
4005
4006
  return;
4006
4007
  }
4007
4008
  this.kinesisConfig = e;
4008
- const n = Date.now(), s = new Date(e.serverTime).getTime();
4009
- this.serverTimeOffset = s - n, this.logMessage("log", `Server time offset: ${this.serverTimeOffset}ms`), this.kinesisClient = new is({
4009
+ const s = Date.now(), t = new Date(e.serverTime).getTime();
4010
+ this.serverTimeOffset = t - s, this.logMessage("log", `Server time offset: ${this.serverTimeOffset}ms`), this.kinesisClient = new is({
4010
4011
  region: e.region,
4011
4012
  credentials: {
4012
4013
  accessKeyId: e.accessKeyId,
@@ -4033,12 +4034,12 @@ class fF {
4033
4034
  let m = !0;
4034
4035
  for (; this.eventQueue.length > 0; ) {
4035
4036
  const p = this.eventQueue.shift();
4036
- p.source_id = n, p.account_hash = c.accountHash, p.region = this.kinesisConfig.logicalRegion, p.host = this.kinesisConfig.domain, p.pid = oe();
4037
+ p.source_id = n, p.account_hash = c.accountHash, p.region = this.kinesisConfig.logicalRegion, p.host = this.kinesisConfig.domain, p.pid = oe(), p.sdk_version = Te;
4037
4038
  try {
4038
4039
  const u = new ts({
4039
4040
  StreamName: this.kinesisConfig.streamName,
4040
4041
  PartitionKey: p.source_id,
4041
- Data: new TextEncoder().encode(JSON.stringify(p))
4042
+ Data: new TextEncoder().encode(JSON.stringify({ ...p, auth_token: this.authToken }))
4042
4043
  }), h = await this.kinesisClient.send(u);
4043
4044
  this.logMessage("log", `Event '${p.type}' sent to Kinesis:`, {
4044
4045
  sequenceNumber: h.SequenceNumber,
@@ -4143,7 +4144,7 @@ class gF {
4143
4144
  // to apply the side effects that belong to the core service (liveness type,
4144
4145
  // camera init, kinesis bootstrap).
4145
4146
  async applyInitSessionResponse(e, n) {
4146
- return e.sessionToken && (this.accessToken = e.sessionToken), this.livenessCheckType = e.livenessCheckType?.toLowerCase(), console.log(`Liveness check type: ${this.livenessCheckType}`), (this.livenessCheckType === "disabled" || this.livenessCheckType === "basic") && await this.cameraSdk.init(), uF({ accountHash: e.accountHash ?? "", verificationSessionId: e.verificationSessionId }), this.kinesisService.initialize(e.kinesisConfig), this.kinesisService.sendEvent("SessionInitialized", e.verificationSessionId, {
4147
+ return e.sessionToken && (this.accessToken = e.sessionToken), this.livenessCheckType = e.livenessCheckType?.toLowerCase(), console.log(`Liveness check type: ${this.livenessCheckType}`), (this.livenessCheckType === "disabled" || this.livenessCheckType === "basic") && await this.cameraSdk.init(), uF({ accountHash: e.accountHash ?? "", verificationSessionId: e.verificationSessionId }), this.kinesisService.initialize(e.kinesisConfig, this.accessToken), this.kinesisService.sendEvent("SessionInitialized", e.verificationSessionId, {
4147
4148
  duration: performance.now() - n
4148
4149
  }), e;
4149
4150
  }
@@ -4233,7 +4234,7 @@ class gF {
4233
4234
  }
4234
4235
  resolveTechUserId() {
4235
4236
  let n = new URL(window.location.href).searchParams.get("reTechUserId");
4236
- return n != null ? localStorage.setItem("verify-tech-user-id", n) : (n = localStorage.getItem("verify-tech-user-id"), n == null && (n = Te(), localStorage.setItem("verify-tech-user-id", n))), n;
4237
+ return n != null ? localStorage.setItem("verify-tech-user-id", n) : (n = localStorage.getItem("verify-tech-user-id"), n == null && (n = De(), localStorage.setItem("verify-tech-user-id", n))), n;
4237
4238
  }
4238
4239
  async callInitCoreSession(e, n, s) {
4239
4240
  const t = await fetch(
@@ -4248,7 +4249,7 @@ class gF {
4248
4249
  // user agent. Additive: a session from an SDK that predates this header is recorded
4249
4250
  // as "unknown", which is a fact, not a failure.
4250
4251
  "x-verify-client-platform": "web-sdk",
4251
- "x-verify-client-version": on,
4252
+ "x-verify-client-version": Te,
4252
4253
  Authorization: `Bearer ${n}`
4253
4254
  },
4254
4255
  body: JSON.stringify({ verificationSessionId: e, localTime: (/* @__PURE__ */ new Date()).toISOString(), isHeadless: s }),
@@ -4258,7 +4259,7 @@ class gF {
4258
4259
  return this.parseInitResponse(t);
4259
4260
  }
4260
4261
  async parseInitResponse(e) {
4261
- return e.ok || await nn(e, "An error occurred during initializing the session!"), e.json();
4262
+ return e.ok || await sn(e, "An error occurred during initializing the session!"), e.json();
4262
4263
  }
4263
4264
  async callVerify(e, n, s) {
4264
4265
  let t = `${this.apiBaseUrl}/api/v1/verification/verify`;
@@ -4274,7 +4275,7 @@ class gF {
4274
4275
  body: JSON.stringify({ verificationSessionId: e, failedReason: n }),
4275
4276
  signal: s ?? this.abortSignal
4276
4277
  });
4277
- l.ok || await nn(l, "Verification failed");
4278
+ l.ok || await sn(l, "Verification failed");
4278
4279
  }
4279
4280
  async callCaptureImage(e) {
4280
4281
  const n = await fetch(
@@ -4861,7 +4862,7 @@ const $F = ({
4861
4862
  )
4862
4863
  }
4863
4864
  ) }) : null;
4864
- }, SF = Bn(() => import("./livenessCheckDialog-BZJC0fMz.js")), EF = Zn({
4865
+ }, SF = Bn(() => import("./livenessCheckDialog-DKoq_n1T.js")), EF = Zn({
4865
4866
  palette: {
4866
4867
  mode: "light"
4867
4868
  },
@@ -4893,7 +4894,7 @@ const $F = ({
4893
4894
  }
4894
4895
  }
4895
4896
  }
4896
- }), xF = 300 * 1e3, sn = {
4897
+ }), xF = 300 * 1e3, tn = {
4897
4898
  SkipIfCameraGranted: "1",
4898
4899
  AlwaysSkip: "2"
4899
4900
  }, ue = {
@@ -4902,19 +4903,19 @@ const $F = ({
4902
4903
  Auto: "Auto",
4903
4904
  Headless: "Headless"
4904
4905
  }, CF = ({ strategy: i, config: e, consentSkipMode: n, headless: s = !1, onServiceError: t, headlessCallbacks: l, showVerificationSessionId: d = !1, mediaStream: a, lang: r, langOverrides: o }) => {
4905
- const [c, m] = w(!1), [p, u] = w(!1), [h, x] = w(!1), [ge, ce] = w(!1), [un, De] = w(!1), [ye, X] = w(!1), [pn, be] = w(!1), [Ve, Oe] = w(!1), [Me, fn] = w(!0), [hn, Ne] = w(!1), [Ke, $e] = w(!1), [ke, E] = w(""), [gn, ze] = w(!0), [je, we] = w(null), le = k(2), Se = k(3), Le = k(0), qe = k(0), [yn, bn] = w(""), [ee, $n] = w("..."), kn = JSON.stringify(o ?? null), P = Gn(
4906
+ const [c, m] = w(!1), [p, u] = w(!1), [h, x] = w(!1), [ge, ce] = w(!1), [un, Ve] = w(!1), [ye, X] = w(!1), [pn, be] = w(!1), [Oe, Me] = w(!1), [Ne, fn] = w(!0), [hn, Ke] = w(!1), [Le, $e] = w(!1), [ke, E] = w(""), [gn, ze] = w(!0), [je, we] = w(null), le = k(2), Se = k(3), qe = k(0), Ue = k(0), [yn, bn] = w(""), [ee, $n] = w("..."), kn = JSON.stringify(o ?? null), P = Gn(
4906
4907
  () => ln(r, o),
4907
4908
  // langOverrides is keyed via langOverridesKey — stable across identical inline objects
4908
4909
  // eslint-disable-next-line react-hooks/exhaustive-deps
4909
4910
  [r, kn]
4910
4911
  ), D = k(P);
4911
4912
  D.current = P;
4912
- const ne = k(!1), G = k(null), Ee = k(!1), b = k("..."), Ue = k(""), Fe = k(""), $ = k(new fF(e)).current, f = k(new hF($, b)).current, S = k(new gF($, e)).current;
4913
+ const ne = k(!1), G = k(null), Ee = k(!1), b = k("..."), Fe = k(""), Be = k(""), $ = k(new fF(e)).current, f = k(new hF($, b)).current, S = k(new gF($, e)).current;
4913
4914
  S.statsService = f;
4914
- const Be = k(t);
4915
- Be.current = t;
4915
+ const Ge = k(t);
4916
+ Ge.current = t;
4916
4917
  const N = (v) => {
4917
- console.error(`Error during ${v}`), Be.current?.(v);
4918
+ console.error(`Error during ${v}`), Ge.current?.(v);
4918
4919
  }, me = k(l);
4919
4920
  me.current = l;
4920
4921
  const de = k(a);
@@ -4930,16 +4931,16 @@ const $F = ({
4930
4931
  const A = T.detectBrowser(window);
4931
4932
  $.sendEvent("EnvironmentDetected", null, {
4932
4933
  platform: "web",
4933
- sdk_version: on,
4934
+ sdk_version: Te,
4934
4935
  browser: A.browser,
4935
4936
  browser_version: A.version,
4936
4937
  user_agent: window.navigator.userAgent
4937
- }), s || zn(), G.current = Ge(
4938
+ }), s || zn(), G.current = He(
4938
4939
  () => wn(),
4939
4940
  1e3,
4940
4941
  4,
4941
4942
  (se) => {
4942
- Le.current = se;
4943
+ qe.current = se;
4943
4944
  }
4944
4945
  ).finally(() => {
4945
4946
  S.setAbortSignal(Ce.current?.signal);
@@ -4951,7 +4952,7 @@ const $F = ({
4951
4952
  if (!Ee.current) {
4952
4953
  f.stopTimer("consentDuration", !1), f.stopTimer("permissionDuration", !1), f.stopTimer("livenessDuration", !1), f.stopTimer("captureImageDuration", !1), f.stopTimer("initDuration", !1);
4953
4954
  const y = window.__pageLoadStart;
4954
- y !== void 0 && f.addStat("sessionDuration", performance.now() - y, !1), await f.forceSendStats(), $.sendEvent("ClientSideFailed", b.current, { reason: "session_timeout" }), Oe(!0), C("SESSION_TIMEOUT", { status: "timeout" });
4955
+ y !== void 0 && f.addStat("sessionDuration", performance.now() - y, !1), await f.forceSendStats(), $.sendEvent("ClientSideFailed", b.current, { reason: "session_timeout" }), Me(!0), C("SESSION_TIMEOUT", { status: "timeout" });
4955
4956
  }
4956
4957
  }, xF);
4957
4958
  return () => {
@@ -5002,12 +5003,12 @@ const $F = ({
5002
5003
  });
5003
5004
  }, zn = async () => {
5004
5005
  switch (fn(!1), n) {
5005
- case sn.SkipIfCameraGranted: {
5006
+ case tn.SkipIfCameraGranted: {
5006
5007
  const v = await S.checkCameraAccess();
5007
5008
  v !== "granted" ? ($.sendEvent("ConsentShown", b.current, { consentMode: n, cameraAccess: v }), u(!0)) : ($.sendEvent("ConsentSkipped", b.current, { consentMode: n, cameraAccess: v }), ve(ue.Auto), X(!0));
5008
5009
  break;
5009
5010
  }
5010
- case sn.AlwaysSkip:
5011
+ case tn.AlwaysSkip:
5011
5012
  $.sendEvent("ConsentSkipped", b.current, { consentMode: n }), ve(ue.Skipped), X(!0);
5012
5013
  break;
5013
5014
  default:
@@ -5033,13 +5034,13 @@ const $F = ({
5033
5034
  }
5034
5035
  }
5035
5036
  me.current?.onAfterCameraAccess?.(), $.sendEvent("CameraPermissionGranted", b.current, {}), f.startTimer("captureImageDuration");
5036
- const v = await He();
5037
+ const v = await We();
5037
5038
  f.stopTimer("captureImageDuration"), v.faceDetected ? await C() : ($.sendEvent("ClientSideFailed", b.current, { reason: "no_face" }), await C());
5038
5039
  } catch {
5039
5040
  N("unknown");
5040
5041
  }
5041
5042
  }
5042
- }, Ge = async (v, g = 1e3, y = 4, A) => {
5043
+ }, He = async (v, g = 1e3, y = 4, A) => {
5043
5044
  const se = Date.now();
5044
5045
  let K = g, V = 1;
5045
5046
  for (; ; )
@@ -5068,7 +5069,7 @@ const $F = ({
5068
5069
  try {
5069
5070
  const g = await i.initSession(S);
5070
5071
  if (b.current = g.verificationSessionId, $n(g.verificationSessionId), S.livenessCheckType = g.livenessCheckType?.toLowerCase(), g.livenessCheckConfig) {
5071
- m(!0), xe.current = !0, Fe.current = g.livenessCheckConfig.aws_project_region, Ue.current = g.livenessCheckSessionId;
5072
+ m(!0), xe.current = !0, Be.current = g.livenessCheckConfig.aws_project_region, Fe.current = g.livenessCheckSessionId;
5072
5073
  const { Amplify: y } = await import("aws-amplify");
5073
5074
  y.configure(g.livenessCheckConfig);
5074
5075
  } else
@@ -5079,7 +5080,7 @@ const $F = ({
5079
5080
  throw g;
5080
5081
  g instanceof DOMException && g.name === "AbortError" || (g instanceof pe ? (E(g.message), ze(!1), N("init-session")) : g instanceof Error ? (E(g.message), N("init-session")) : (E(D.current.t("error_init_session")), N("init-session")));
5081
5082
  }
5082
- }, He = async () => {
5083
+ }, We = async () => {
5083
5084
  E("");
5084
5085
  try {
5085
5086
  return await S.detectFace(b.current);
@@ -5093,7 +5094,7 @@ const $F = ({
5093
5094
  if (!Ee.current) {
5094
5095
  f.startTimer("getResultDuration"), Ee.current = !0, $e(!0);
5095
5096
  try {
5096
- await Ge(
5097
+ await He(
5097
5098
  async () => {
5098
5099
  try {
5099
5100
  const y = await i.fetchResult(
@@ -5106,7 +5107,7 @@ const $F = ({
5106
5107
  const A = f.getAllStatsAsObject(), se = (A.consentDuration ?? 0) + (A.permissionDuration ?? 0) + (A.livenessDuration ?? 0), K = (A.initDuration ?? 0) + (A.pageLoadDuration ?? 0) + (A.getResultDuration ?? 0) + (A.captureImageDuration ?? 0);
5107
5108
  f.addStat("totalUserInteractionDuration", se, !1), f.addStat("totalDuration", se + K, !1);
5108
5109
  const V = window.__pageLoadStart;
5109
- V !== void 0 && f.addStatIfMissing("sessionDuration", performance.now() - V, !1), f.addStat("throttlingInitRetryCount", Le.current, !1), f.addStat("throttlingGetResultRetryCount", qe.current, !1), f.addStat("cameraPermissionRetryCount", 3 - Se.current, !1), f.addStat("noFaceRetryCount", 2 - le.current, !1), await f.forceSendStats() || console.error("[StatsService] forceSendStats failed - StatsCollected event not sent to Kinesis"), await $.sendEvent(
5110
+ V !== void 0 && f.addStatIfMissing("sessionDuration", performance.now() - V, !1), f.addStat("throttlingInitRetryCount", qe.current, !1), f.addStat("throttlingGetResultRetryCount", Ue.current, !1), f.addStat("cameraPermissionRetryCount", 3 - Se.current, !1), f.addStat("noFaceRetryCount", 2 - le.current, !1), await f.forceSendStats() || console.error("[StatsService] forceSendStats failed - StatsCollected event not sent to Kinesis"), await $.sendEvent(
5110
5111
  "VerificationCompleted",
5111
5112
  b.current,
5112
5113
  y.logPayload ?? {}
@@ -5119,7 +5120,7 @@ const $F = ({
5119
5120
  1e3,
5120
5121
  4,
5121
5122
  (y) => {
5122
- qe.current = y;
5123
+ Ue.current = y;
5123
5124
  }
5124
5125
  );
5125
5126
  } catch (y) {
@@ -5129,7 +5130,7 @@ const $F = ({
5129
5130
  }
5130
5131
  }
5131
5132
  }, Sn = async () => {
5132
- ne.current || (Ne(!0), await G.current, Ne(!1)), f.stopTimer("consentDuration"), $.sendEvent("ConsentClosed", b.current, { result: "accepted" }), ve(ue.ExplicitGranted), u(!1), X(!0);
5133
+ ne.current || (Ke(!0), await G.current, Ke(!1)), f.stopTimer("consentDuration"), $.sendEvent("ConsentClosed", b.current, { result: "accepted" }), ve(ue.ExplicitGranted), u(!1), X(!0);
5133
5134
  }, En = async () => {
5134
5135
  ne.current || await G.current, f.stopTimer("consentDuration"), $.sendEvent("ConsentClosed", b.current, { result: "declined" }), $.sendEvent("ClientSideFailed", b.current, { reason: "no_consent" }), u(!1), await C("CONSENT_DECLINED", { status: "consent_declined" });
5135
5136
  }, xn = async () => {
@@ -5145,9 +5146,9 @@ const $F = ({
5145
5146
  }, Pn = async () => {
5146
5147
  f.stopTimer("captureImageDuration"), ce(!1), await C();
5147
5148
  }, Rn = async (v) => {
5148
- f.stopTimer("captureImageDuration"), ce(!1), bn(v), le.current <= 0 ? ($.sendEvent("ClientSideFailed", b.current, { reason: "no_face" }), await C()) : (le.current -= 1, De(!0));
5149
+ f.stopTimer("captureImageDuration"), ce(!1), bn(v), le.current <= 0 ? ($.sendEvent("ClientSideFailed", b.current, { reason: "no_face" }), await C()) : (le.current -= 1, Ve(!0));
5149
5150
  }, In = async () => {
5150
- De(!1), le.current >= 0 ? (f.startTimer("captureImageDuration"), ce(!0)) : await C();
5151
+ Ve(!1), le.current >= 0 ? (f.startTimer("captureImageDuration"), ce(!0)) : await C();
5151
5152
  }, Tn = async () => {
5152
5153
  console.log("Liveness check completed"), f.stopTimer("livenessDuration"), $.sendEvent("LivenessCheckPassed", b.current, {}), x(!1), await C();
5153
5154
  }, Dn = async (v) => {
@@ -5163,19 +5164,19 @@ const $F = ({
5163
5164
  }, Vn = async () => {
5164
5165
  f.stopTimer("livenessDuration"), $.sendEvent("ClientSideFailed", b.current, { reason: "liveness_cancelled" }), x(!1), await C("LIVENESS_CANCELED", { status: "liveness_canceled" });
5165
5166
  }, On = async () => {
5166
- Oe(!1), i.onSessionTimeout?.(b.current);
5167
+ Me(!1), i.onSessionTimeout?.(b.current);
5167
5168
  };
5168
5169
  if (s)
5169
5170
  return null;
5170
5171
  let H;
5171
- return je ? H = /* @__PURE__ */ j(Ze, { open: !!je, maxWidth: "xs", fullWidth: !0, children: [
5172
- /* @__PURE__ */ _(Ye, { children: P.tr("server_busy_title") }),
5173
- /* @__PURE__ */ _(Je, { children: /* @__PURE__ */ _(Qe, { children: je }) })
5174
- ] }) : ke ? H = /* @__PURE__ */ j(Ze, { open: !!ke, maxWidth: "xs", fullWidth: !0, children: [
5175
- /* @__PURE__ */ _(Ye, { children: P.tr("error_title") }),
5176
- /* @__PURE__ */ _(Je, { children: /* @__PURE__ */ _(Qe, { children: ke }) }),
5172
+ return je ? H = /* @__PURE__ */ j(Ye, { open: !!je, maxWidth: "xs", fullWidth: !0, children: [
5173
+ /* @__PURE__ */ _(Je, { children: P.tr("server_busy_title") }),
5174
+ /* @__PURE__ */ _(Qe, { children: /* @__PURE__ */ _(Xe, { children: je }) })
5175
+ ] }) : ke ? H = /* @__PURE__ */ j(Ye, { open: !!ke, maxWidth: "xs", fullWidth: !0, children: [
5176
+ /* @__PURE__ */ _(Je, { children: P.tr("error_title") }),
5177
+ /* @__PURE__ */ _(Qe, { children: /* @__PURE__ */ _(Xe, { children: ke }) }),
5177
5178
  gn && /* @__PURE__ */ _(Yn, { children: /* @__PURE__ */ _(Jn, { onClick: () => window.location.reload(), variant: "contained", color: "primary", children: P.tr("error_retry_button") }) })
5178
- ] }) : Ve ? H = /* @__PURE__ */ _(wF, { isOpen: Ve, onOk: On }) : Me ? H = /* @__PURE__ */ _(Pe, { isOpen: Me }) : Ke ? H = /* @__PURE__ */ _(Pe, { isOpen: Ke, text: P.t("loading_verifying_text") }) : H = /* @__PURE__ */ j(Re, { children: [
5179
+ ] }) : Oe ? H = /* @__PURE__ */ _(wF, { isOpen: Oe, onOk: On }) : Ne ? H = /* @__PURE__ */ _(Pe, { isOpen: Ne }) : Le ? H = /* @__PURE__ */ _(Pe, { isOpen: Le, text: P.t("loading_verifying_text") }) : H = /* @__PURE__ */ j(Re, { children: [
5179
5180
  /* @__PURE__ */ _(
5180
5181
  XU,
5181
5182
  {
@@ -5210,7 +5211,7 @@ const $F = ({
5210
5211
  {
5211
5212
  isOpen: ge,
5212
5213
  uniqueId: ee,
5213
- detectFace: He,
5214
+ detectFace: We,
5214
5215
  onFaceDetected: Pn,
5215
5216
  onNoFaceDetected: Rn
5216
5217
  }
@@ -5229,8 +5230,8 @@ const $F = ({
5229
5230
  {
5230
5231
  isOpen: h,
5231
5232
  uniqueId: ee,
5232
- livenessSessionId: Ue.current,
5233
- livenessRegion: Fe.current,
5233
+ livenessSessionId: Fe.current,
5234
+ livenessRegion: Be.current,
5234
5235
  onLivenessComplete: Tn,
5235
5236
  onLivenessError: Dn,
5236
5237
  onClose: Vn
@@ -5258,7 +5259,7 @@ export {
5258
5259
  Q as R,
5259
5260
  cn as S,
5260
5261
  FF as V,
5261
- sn as a,
5262
+ tn as a,
5262
5263
  ie as b,
5263
5264
  an as c,
5264
5265
  B as u
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as s, b as r, c as A, S as E, V as G } from "./index-D_z4opzN.js";
1
+ import { a as s, b as r, c as A, S as E, V as G } from "./index-CVZVPyqC.js";
2
2
  export {
3
3
  s as ConsentSkipMode,
4
4
  r as DEFAULT_LANGUAGE,
@@ -1,7 +1,7 @@
1
1
  import { jsx as t, jsxs as c } from "react/jsx-runtime";
2
2
  import m from "@mui/material/DialogContent";
3
3
  import h from "@mui/material/IconButton";
4
- import { u as x, R as v, C as d, D as T } from "./index-D_z4opzN.js";
4
+ import { u as x, R as v, C as d, D as T } from "./index-CVZVPyqC.js";
5
5
  import { useMemo as f } from "react";
6
6
  import { Box as g, Stack as u } from "@mui/material";
7
7
  import { FaceLivenessDetector as p } from "@aws-amplify/ui-react-liveness";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@realeyes/verifeye-sdk",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "description": "React component library for embedding the VerifEye identity-verification flow into your web application.",
5
5
  "keywords": [
6
6
  "verifeye",