@baas-id/react 0.2.2 → 0.2.9
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.
- package/LICENSE.md +1 -3
- package/README.md +10 -6
- package/THIRD_PARTY_NOTICES.md +7 -5
- package/dist/esm/baas-id-react.css +1 -1
- package/dist/esm/chunks/ContinueFlow-APeYfGFQ.js +8359 -0
- package/dist/esm/continue.js +1 -1
- package/dist/esm/index.js +129 -147
- package/dist/esm/preview.js +183 -225
- package/dist/types/continue.d.ts +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/preview.d.ts +2 -1
- package/dist/types/react/DocumentCapture.d.ts +1 -0
- package/dist/types/react/capture/api.d.ts +5 -0
- package/dist/types/react/capture/camera.d.ts +1 -0
- package/dist/types/react/capture/index.d.ts +2 -2
- package/dist/types/react/document/cornerOrder.d.ts +29 -0
- package/dist/types/react/document/gate.d.ts +5 -1
- package/dist/types/react/document/stats.d.ts +20 -0
- package/dist/types/react/document/steady.d.ts +89 -0
- package/dist/types/react/document/upright.d.ts +5 -0
- package/dist/types/react/document/useDocumentCapture.d.ts +2 -0
- package/dist/types/react/face/FaceGuide.d.ts +1 -3
- package/dist/types/react/face/scanState.d.ts +0 -1
- package/dist/types/react/flows/FlowResult.d.ts +3 -2
- package/dist/types/react/flows/FlowShell.d.ts +6 -3
- package/dist/types/react/flows/types.d.ts +5 -1
- package/dist/types/react/flows/useFlowSession.d.ts +2 -1
- package/dist/types/react/handoff/ContinueFlow.d.ts +5 -2
- package/dist/types/react/handoff/ContinueOnPhone.d.ts +7 -0
- package/dist/types/react/handoff/api.d.ts +8 -3
- package/dist/types/react/i18n/es-419-formal.d.ts +3 -0
- package/dist/types/react/i18n/index.d.ts +6 -4
- package/dist/types/react/i18n/types.d.ts +6 -1
- package/dist/types/react/preview/FlowPreview.d.ts +4 -1
- package/dist/types/react/telemetry/bus.d.ts +1 -1
- package/dist/types/react/theme/appearance.d.ts +4 -2
- package/dist/types/react/theme/scheme.d.ts +23 -0
- package/dist/types/react/version.d.ts +1 -1
- package/dist/types/react/vision/cardEvidence.d.ts +29 -0
- package/dist/types/react/vision/modelsCdn.d.ts +2 -2
- package/dist/types/react/vision/types.d.ts +2 -0
- package/package.json +7 -7
- package/dist/esm/chunks/ContinueFlow-YFSpSOio.js +0 -7500
- package/dist/types/react/face/faceMesh.d.ts +0 -68
- package/dist/types/react/face/meshBench.d.ts +0 -7
- package/dist/types/react/face/meshCanvas.d.ts +0 -20
package/dist/esm/preview.js
CHANGED
|
@@ -1,187 +1,179 @@
|
|
|
1
1
|
import "./baas-id-react.css";
|
|
2
2
|
/* empty css */
|
|
3
|
-
import { jsxs as
|
|
4
|
-
import { useMemo as
|
|
5
|
-
import { t as
|
|
6
|
-
import {
|
|
7
|
-
function
|
|
8
|
-
let
|
|
9
|
-
return () => (
|
|
3
|
+
import { jsxs as R, jsx as p } from "react/jsx-runtime";
|
|
4
|
+
import { useMemo as E, useRef as M, useState as W, useEffect as U } from "react";
|
|
5
|
+
import { t as $, n as K, a as Q, m as Y, b as J, g as O, f as X, i as Z, c as ee, F as B, H as te, d as oe, e as ne, S as re, E as se, h as ie, j as ae, k as le, l as ce, o as L, p as de, q as G, s as fe, G as H, u as ue, v as pe, w as he, x as ye } from "./chunks/ContinueFlow-APeYfGFQ.js";
|
|
6
|
+
import { y as we, z as xe, A as De, B as Oe, I as Be, L as Le, J as Ne, K as Ue, N as Ge, O as He, P as je, Q as qe, R as Ve, T as ze } from "./chunks/ContinueFlow-APeYfGFQ.js";
|
|
7
|
+
function me(e) {
|
|
8
|
+
let r = e >>> 0;
|
|
9
|
+
return () => (r = r * 1664525 + 1013904223 >>> 0, r / 4294967296);
|
|
10
10
|
}
|
|
11
|
-
function
|
|
12
|
-
const n =
|
|
11
|
+
function j(e, r) {
|
|
12
|
+
const n = $(e, r, 0.8), s = 0.012;
|
|
13
13
|
return [
|
|
14
|
-
{ x: n[0].x +
|
|
15
|
-
{ x: n[1].x -
|
|
16
|
-
{ x: n[2].x, y: n[2].y -
|
|
17
|
-
{ x: n[3].x +
|
|
14
|
+
{ x: n[0].x + s, y: n[0].y + s * 0.6 },
|
|
15
|
+
{ x: n[1].x - s * 0.4, y: n[1].y },
|
|
16
|
+
{ x: n[2].x, y: n[2].y - s * 0.3 },
|
|
17
|
+
{ x: n[3].x + s * 0.5, y: n[3].y - s * 0.8 }
|
|
18
18
|
];
|
|
19
19
|
}
|
|
20
|
-
function
|
|
21
|
-
e.beginPath(), e.moveTo(
|
|
20
|
+
function A(e, r, n, s, i, t) {
|
|
21
|
+
e.beginPath(), e.moveTo(r + t, n), e.arcTo(r + s, n, r + s, n + i, t), e.arcTo(r + s, n + i, r, n + i, t), e.arcTo(r, n + i, r, n, t), e.arcTo(r, n, r + s, n, t), e.closePath();
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function q(e, r, n, s) {
|
|
24
24
|
const i = n * 0.037;
|
|
25
|
-
|
|
26
|
-
const t = e.createLinearGradient(0, 0, n,
|
|
27
|
-
t.addColorStop(0, "#E8EEEC"), t.addColorStop(1, "#D5DFDC"), e.fillStyle = t, e.fillRect(0, 0, n,
|
|
25
|
+
A(e, 0, 0, n, s, i), e.save(), e.clip();
|
|
26
|
+
const t = e.createLinearGradient(0, 0, n, s);
|
|
27
|
+
t.addColorStop(0, "#E8EEEC"), t.addColorStop(1, "#D5DFDC"), e.fillStyle = t, e.fillRect(0, 0, n, s), e.strokeStyle = "rgba(19, 94, 110, 0.13)", e.lineWidth = Math.max(0.6, n * 16e-4);
|
|
28
28
|
for (let o = 0; o < 26; o++)
|
|
29
|
-
e.beginPath(), e.ellipse(n * 0.72,
|
|
30
|
-
e.fillStyle = "#135E6E", e.fillRect(0, 0, n,
|
|
31
|
-
const
|
|
32
|
-
if (
|
|
33
|
-
const o = n * 0.05, a =
|
|
34
|
-
e.fillStyle = "#B9C7CE",
|
|
35
|
-
const
|
|
36
|
-
[[0.24, 0.3], [0.32, 0.45], [0.44, 0.2], [0.52, 0.38], [0.64, 0.22], [0.72, 0.42]].forEach(([
|
|
37
|
-
e.globalAlpha =
|
|
29
|
+
e.beginPath(), e.ellipse(n * 0.72, s * 0.55, n * (0.08 + o * 0.012), s * (0.12 + o * 0.016), o * 0.11, 0, Math.PI * 2), e.stroke();
|
|
30
|
+
e.fillStyle = "#135E6E", e.fillRect(0, 0, n, s * 0.13), e.fillStyle = "rgba(255,255,255,0.9)", e.font = `600 ${Math.round(s * 0.06)}px system-ui, sans-serif`, e.textBaseline = "middle", e.fillText(r === "front" ? "IDENTITY CARD · SPECIMEN" : "SPECIMEN", n * 0.05, s * 0.066);
|
|
31
|
+
const l = "rgba(22, 35, 44, 0.55)";
|
|
32
|
+
if (r === "front") {
|
|
33
|
+
const o = n * 0.05, a = s * 0.2, c = n * 0.27, d = s * 0.62;
|
|
34
|
+
e.fillStyle = "#B9C7CE", A(e, o, a, c, d, n * 0.012), e.fill(), e.fillStyle = "#8EA2AC", e.beginPath(), e.ellipse(o + c / 2, a + d * 0.38, c * 0.22, d * 0.2, 0, 0, Math.PI * 2), e.fill(), e.beginPath(), e.ellipse(o + c / 2, a + d * 0.98, c * 0.42, d * 0.3, 0, Math.PI, 0), e.fill(), e.fillStyle = l;
|
|
35
|
+
const u = n * 0.37;
|
|
36
|
+
[[0.24, 0.3], [0.32, 0.45], [0.44, 0.2], [0.52, 0.38], [0.64, 0.22], [0.72, 0.42]].forEach(([m, g], h) => {
|
|
37
|
+
e.globalAlpha = h % 2 ? 1 : 0.55, e.fillRect(u, s * m, n * g, s * (h % 2 ? 0.045 : 0.03));
|
|
38
38
|
}), e.globalAlpha = 1;
|
|
39
39
|
} else {
|
|
40
|
-
const o =
|
|
40
|
+
const o = me(41), a = n * 0.05, c = s * 0.2, d = n * 0.9, u = s * 0.3;
|
|
41
41
|
e.fillStyle = "#16232C";
|
|
42
|
-
const
|
|
43
|
-
for (let
|
|
44
|
-
o() > 0.5 && e.fillRect(a +
|
|
45
|
-
e.fillStyle =
|
|
46
|
-
for (let
|
|
42
|
+
const m = 64, g = 10;
|
|
43
|
+
for (let h = 0; h < m; h++) for (let f = 0; f < g; f++)
|
|
44
|
+
o() > 0.5 && e.fillRect(a + h * d / m, c + f * u / g, d / m + 0.4, u / g + 0.4);
|
|
45
|
+
e.fillStyle = l;
|
|
46
|
+
for (let h = 0; h < 3; h++) e.fillRect(n * 0.05, s * (0.62 + h * 0.11), n * 0.9, s * 0.055);
|
|
47
47
|
}
|
|
48
|
-
e.save(), e.translate(n / 2,
|
|
48
|
+
e.save(), e.translate(n / 2, s / 2), e.rotate(-0.2), e.fillStyle = "rgba(178, 67, 78, 0.22)", e.font = `800 ${Math.round(s * 0.2)}px system-ui, sans-serif`, e.textAlign = "center", e.textBaseline = "middle", e.fillText("SPECIMEN", 0, 0), e.restore(), e.restore();
|
|
49
49
|
}
|
|
50
|
-
function
|
|
51
|
-
const n = e.getBoundingClientRect(),
|
|
52
|
-
e.width = Math.round(
|
|
53
|
-
const
|
|
54
|
-
if (!
|
|
55
|
-
|
|
56
|
-
const o =
|
|
57
|
-
o.addColorStop(0, "#2B3A44"), o.addColorStop(1, "#141D23"),
|
|
58
|
-
const a =
|
|
59
|
-
|
|
50
|
+
function ve(e, r) {
|
|
51
|
+
const n = e.getBoundingClientRect(), s = Math.max(1, n.width || 390), i = Math.max(1, n.height || 300), t = Math.min(2, typeof devicePixelRatio == "number" ? devicePixelRatio : 1);
|
|
52
|
+
e.width = Math.round(s * t), e.height = Math.round(i * t);
|
|
53
|
+
const l = e.getContext("2d");
|
|
54
|
+
if (!l) return;
|
|
55
|
+
l.setTransform(t, 0, 0, t, 0, 0);
|
|
56
|
+
const o = l.createRadialGradient(s * 0.5, i * 0.2, 10, s * 0.5, i * 0.6, s);
|
|
57
|
+
o.addColorStop(0, "#2B3A44"), o.addColorStop(1, "#141D23"), l.fillStyle = o, l.fillRect(0, 0, s, i);
|
|
58
|
+
const a = j(s, i).map((u) => ({ x: u.x * s, y: u.y * i })), c = Math.hypot(a[1].x - a[0].x, a[1].y - a[0].y), d = Math.hypot(a[3].x - a[0].x, a[3].y - a[0].y);
|
|
59
|
+
l.save(), l.transform((a[1].x - a[0].x) / c, (a[1].y - a[0].y) / c, (a[3].x - a[0].x) / d, (a[3].y - a[0].y) / d, a[0].x, a[0].y), l.shadowColor = "rgba(0,0,0,0.45)", l.shadowBlur = 18, l.shadowOffsetY = 6, l.fillStyle = "#000", A(l, 0, 0, c, d, c * 0.037), l.fill(), l.shadowColor = "transparent", q(l, r, c, d), l.restore();
|
|
60
60
|
}
|
|
61
|
-
function
|
|
61
|
+
function N(e) {
|
|
62
62
|
if (typeof document > "u") return;
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
const n =
|
|
63
|
+
const r = document.createElement("canvas");
|
|
64
|
+
r.width = 254, r.height = 160;
|
|
65
|
+
const n = r.getContext("2d");
|
|
66
66
|
if (n) {
|
|
67
|
-
|
|
67
|
+
q(n, e, 254, 160);
|
|
68
68
|
try {
|
|
69
|
-
return
|
|
69
|
+
return r.toDataURL("image/png");
|
|
70
70
|
} catch {
|
|
71
71
|
return;
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
const
|
|
76
|
-
function
|
|
77
|
-
const { w: n, h:
|
|
75
|
+
const b = { w: 720, h: 1280 };
|
|
76
|
+
function ge(e = 0, r = 1) {
|
|
77
|
+
const { w: n, h: s } = b, i = n / 2 + e * 26, t = s * 0.44, l = 160 * r, o = 205 * r, a = e * l * 0.32;
|
|
78
78
|
return {
|
|
79
79
|
cx: i,
|
|
80
80
|
cy: t,
|
|
81
|
-
rx:
|
|
81
|
+
rx: l,
|
|
82
82
|
ry: o,
|
|
83
|
-
eyes: [{ x: i -
|
|
83
|
+
eyes: [{ x: i - l * 0.36 + a, y: t - o * 0.12 }, { x: i + l * 0.36 + a, y: t - o * 0.12 }],
|
|
84
84
|
nose: { x: i + a * 1.25, y: t + o * 0.12 },
|
|
85
85
|
mouth: { x: i + a * 1.1, y: t + o * 0.43 },
|
|
86
|
-
ears: [{ x: i -
|
|
86
|
+
ears: [{ x: i - l * 0.98 + a * 0.3, y: t }, { x: i + l * 0.98 + a * 0.3, y: t }]
|
|
87
87
|
};
|
|
88
88
|
}
|
|
89
|
-
function Se(e = 0,
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
r({ x: n.cx - n.rx, y: n.cy - n.ry }),
|
|
93
|
-
r({ x: n.cx + n.rx, y: n.cy + n.ry }),
|
|
94
|
-
r(n.eyes[0]),
|
|
95
|
-
r(n.eyes[1]),
|
|
96
|
-
r(n.nose),
|
|
97
|
-
r(n.mouth),
|
|
98
|
-
r(n.ears[0]),
|
|
99
|
-
r(n.ears[1])
|
|
100
|
-
];
|
|
101
|
-
}
|
|
102
|
-
function Ce(e, s = 0, n = 1) {
|
|
103
|
-
const { w: r, h: i } = C;
|
|
104
|
-
e.width = r, e.height = i;
|
|
89
|
+
function Se(e, r = 0, n = 1) {
|
|
90
|
+
const { w: s, h: i } = b;
|
|
91
|
+
e.width = s, e.height = i;
|
|
105
92
|
const t = e.getContext("2d");
|
|
106
93
|
if (!t) return;
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
const o =
|
|
110
|
-
t.fillStyle = "#24343E", t.beginPath(), t.ellipse(
|
|
94
|
+
const l = t.createLinearGradient(0, 0, 0, i);
|
|
95
|
+
l.addColorStop(0, "#5D6E77"), l.addColorStop(1, "#2E3B43"), t.fillStyle = l, t.fillRect(0, 0, s, i);
|
|
96
|
+
const o = ge(r, n);
|
|
97
|
+
t.fillStyle = "#24343E", t.beginPath(), t.ellipse(s / 2 + r * 10, i * 0.98, s * 0.56 * n, i * 0.28 * n, 0, Math.PI, 0), t.fill(), t.fillStyle = "#B88C73", t.fillRect(o.cx - o.rx * 0.36, o.cy + o.ry * 0.6, o.rx * 0.72, o.ry * 0.65);
|
|
111
98
|
const a = t.createRadialGradient(o.cx - o.rx * 0.3, o.cy - o.ry * 0.3, 10, o.cx, o.cy, o.ry * 1.1);
|
|
112
99
|
a.addColorStop(0, "#D8AE92"), a.addColorStop(1, "#B98A6E"), t.fillStyle = a, t.beginPath(), t.ellipse(o.cx, o.cy, o.rx, o.ry, 0, 0, Math.PI * 2), t.fill(), t.fillStyle = "#B4856A";
|
|
113
|
-
for (const
|
|
114
|
-
t.beginPath(), t.ellipse(
|
|
100
|
+
for (const c of o.ears)
|
|
101
|
+
t.beginPath(), t.ellipse(c.x, c.y, o.rx * 0.11, o.ry * 0.14, 0, 0, Math.PI * 2), t.fill();
|
|
115
102
|
t.fillStyle = "#2A211C", t.beginPath(), t.ellipse(o.cx, o.cy - o.ry * 0.42, o.rx * 1.04, o.ry * 0.62, 0, Math.PI * 1.02, Math.PI * 1.98), t.fill(), t.strokeStyle = "#3A2B22", t.lineWidth = 9, t.lineCap = "round";
|
|
116
|
-
for (const
|
|
117
|
-
t.beginPath(), t.moveTo(
|
|
103
|
+
for (const c of o.eyes)
|
|
104
|
+
t.beginPath(), t.moveTo(c.x - 30, c.y - 34), t.quadraticCurveTo(c.x, c.y - 46, c.x + 30, c.y - 34), t.stroke();
|
|
118
105
|
t.fillStyle = "#F4F1EC";
|
|
119
|
-
for (const
|
|
120
|
-
t.beginPath(), t.ellipse(
|
|
106
|
+
for (const c of o.eyes)
|
|
107
|
+
t.beginPath(), t.ellipse(c.x, c.y, 24, 13, 0, 0, Math.PI * 2), t.fill();
|
|
121
108
|
t.fillStyle = "#3B2A20";
|
|
122
|
-
for (const
|
|
123
|
-
t.beginPath(), t.arc(
|
|
109
|
+
for (const c of o.eyes)
|
|
110
|
+
t.beginPath(), t.arc(c.x + r * 6, c.y, 9, 0, Math.PI * 2), t.fill();
|
|
124
111
|
t.strokeStyle = "rgba(120, 78, 58, 0.7)", t.lineWidth = 6, t.beginPath(), t.moveTo(o.nose.x - 4, o.nose.y - 60), t.quadraticCurveTo(o.nose.x + 10, o.nose.y, o.nose.x - 12, o.nose.y + 6), t.stroke(), t.strokeStyle = "#8A4C42", t.lineWidth = 8, t.beginPath(), t.moveTo(o.mouth.x - 46, o.mouth.y), t.quadraticCurveTo(o.mouth.x, o.mouth.y + 22, o.mouth.x + 46, o.mouth.y), t.stroke();
|
|
125
112
|
}
|
|
126
|
-
const
|
|
127
|
-
function
|
|
128
|
-
const
|
|
129
|
-
if (!
|
|
130
|
-
const n =
|
|
131
|
-
if (!n) return
|
|
132
|
-
const
|
|
113
|
+
const P = "k7qxm2dpa4vbn6tr3hsy5ecwz2";
|
|
114
|
+
function Ce(e) {
|
|
115
|
+
const r = e && typeof e == "object" ? e : null;
|
|
116
|
+
if (!r) return;
|
|
117
|
+
const n = r.reasons && typeof r.reasons == "object" ? r.reasons : null;
|
|
118
|
+
if (!n) return L(r);
|
|
119
|
+
const s = {};
|
|
133
120
|
for (const [i, t] of Object.entries(n))
|
|
134
|
-
for (const [
|
|
135
|
-
return
|
|
121
|
+
for (const [l, o] of Object.entries(t ?? {})) (s[l] ?? (s[l] = {}))[i] = o;
|
|
122
|
+
return L(s);
|
|
136
123
|
}
|
|
137
|
-
const
|
|
124
|
+
const be = {
|
|
138
125
|
enrollment: { verdict: "VERIFIED", purpose: "enrollment", reason: null, score: 0.8412, assurance: "pilot", policy_version: "preview" },
|
|
139
126
|
signin: { verdict: "VERIFIED", purpose: "signin", reason: null, score: 0.8806, assurance: "pilot", policy_version: "preview" },
|
|
140
127
|
reverification: { verdict: "VERIFIED", purpose: "reverification", reason: null, score: 0.8517, assurance: "pilot", policy_version: "preview" },
|
|
141
128
|
identify: { verdict: "VERIFIED", purpose: "identify", reason: null, score: 0.8633, assurance: "pilot", policy_version: "preview" }
|
|
142
129
|
};
|
|
143
|
-
function
|
|
130
|
+
function Fe(e) {
|
|
144
131
|
const {
|
|
145
|
-
screen:
|
|
132
|
+
screen: r,
|
|
146
133
|
step: n = "front",
|
|
147
|
-
challenge:
|
|
134
|
+
challenge: s = "center",
|
|
148
135
|
purpose: i = "enrollment",
|
|
149
136
|
locale: t,
|
|
150
|
-
errorCode:
|
|
137
|
+
errorCode: l = "FACE_MISMATCH",
|
|
151
138
|
documentSides: o,
|
|
152
139
|
document: a = !0,
|
|
153
|
-
challenges:
|
|
154
|
-
privacyNote:
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
140
|
+
challenges: c = 2,
|
|
141
|
+
privacyNote: d,
|
|
142
|
+
formality: u = "informal"
|
|
143
|
+
} = e, m = E(() => K(e.appearance), [e.appearance]), g = E(() => Q(e.instructions), [e.instructions]), h = E(() => Ce(e.messages), [e.messages]), f = E(() => {
|
|
144
|
+
const y = Y(
|
|
145
|
+
X(t, u),
|
|
146
|
+
J(h, t, O(t, void 0, u))
|
|
147
|
+
);
|
|
148
|
+
return { t: O(t, y, u), overrides: y };
|
|
149
|
+
}, [h, t, u]), C = de(i, { document: a, documentSides: o }), S = C.includes(n) ? n : C[0], v = r === "success" ? { k: "done", result: be[i] } : r === "error" ? { k: "failed", reason: l } : S === "face" ? { k: "face" } : { k: "doc", side: S }, k = r === "intro" && Z(S, g), F = ee(S, t, f.t, g), T = v.k === "doc" || v.k === "face", _ = C.length > 1, I = E(() => ({
|
|
150
|
+
front: S !== "front" && C.includes("front") ? N("front") : void 0,
|
|
151
|
+
back: S === "face" && C.includes("back") ? N("back") : void 0
|
|
152
|
+
}), [S, C.join()]);
|
|
153
|
+
if (r === "handoff" || r === "continue" || r === "continueDone") {
|
|
154
|
+
const y = e.handoff ?? {}, w = y.copy?.[t] ?? null, x = y.tenant || "Acme", D = P.slice(-4).toUpperCase(), V = y.continueUrl ? y.continueUrl.includes("{code}") ? y.continueUrl.replace("{code}", P) : `${y.continueUrl}${y.continueUrl.includes("?") ? "&" : "?"}h=${P}` : `https://baaslatam.com/c/${P}`, z = r === "handoff" ? w?.title || f.t.handoff.title : r === "continue" ? f.t.handoff.phoneTitle : f.t.handoff.doneTitle;
|
|
155
|
+
return /* @__PURE__ */ R(
|
|
165
156
|
B,
|
|
166
157
|
{
|
|
167
158
|
step: { k: "opening" },
|
|
168
159
|
purpose: i,
|
|
169
|
-
t:
|
|
170
|
-
privacy:
|
|
171
|
-
appearance:
|
|
160
|
+
t: f.t,
|
|
161
|
+
privacy: d,
|
|
162
|
+
appearance: m,
|
|
172
163
|
forceAppearance: !0,
|
|
173
164
|
manageFocus: !1,
|
|
174
|
-
|
|
165
|
+
colorScheme: e.colorScheme,
|
|
166
|
+
screen: r === "handoff" ? "handoff" : r === "continue" ? "confirm" : "done",
|
|
175
167
|
title: z,
|
|
176
168
|
children: [
|
|
177
|
-
|
|
169
|
+
r === "handoff" && /* @__PURE__ */ p(
|
|
178
170
|
te,
|
|
179
171
|
{
|
|
180
|
-
t:
|
|
181
|
-
mode:
|
|
172
|
+
t: f.t,
|
|
173
|
+
mode: y.mode ?? "suggest",
|
|
182
174
|
copy: w,
|
|
183
|
-
link: { url: V, codeHint:
|
|
184
|
-
leftMs: (
|
|
175
|
+
link: { url: V, codeHint: D, tenant: x },
|
|
176
|
+
leftMs: (y.ttlMinutes ?? 10) * 6e4 - 18e3,
|
|
185
177
|
expired: !1,
|
|
186
178
|
failed: !1,
|
|
187
179
|
phase: null,
|
|
@@ -191,178 +183,144 @@ function _e(e) {
|
|
|
191
183
|
}
|
|
192
184
|
}
|
|
193
185
|
),
|
|
194
|
-
|
|
195
|
-
|
|
186
|
+
r === "continue" && /* @__PURE__ */ p(oe, { t: f.t, tenant: x, codeHint: D }),
|
|
187
|
+
r === "continueDone" && /* @__PURE__ */ p(ne, { t: f.t })
|
|
196
188
|
]
|
|
197
189
|
}
|
|
198
190
|
);
|
|
199
191
|
}
|
|
200
|
-
return /* @__PURE__ */
|
|
192
|
+
return /* @__PURE__ */ R(
|
|
201
193
|
B,
|
|
202
194
|
{
|
|
203
|
-
step:
|
|
195
|
+
step: v,
|
|
204
196
|
purpose: i,
|
|
205
|
-
t:
|
|
206
|
-
privacy:
|
|
207
|
-
appearance:
|
|
197
|
+
t: f.t,
|
|
198
|
+
privacy: d,
|
|
199
|
+
appearance: m,
|
|
208
200
|
forceAppearance: !0,
|
|
209
201
|
manageFocus: !1,
|
|
210
|
-
|
|
211
|
-
|
|
202
|
+
colorScheme: e.colorScheme,
|
|
203
|
+
screen: k ? "intro" : void 0,
|
|
204
|
+
title: k ? F.title : ce(v, i, f.t),
|
|
212
205
|
children: [
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
206
|
+
T && _ && /* @__PURE__ */ p(re, { step: v, t: f.t, plan: C }),
|
|
207
|
+
T && _ && (I.front || I.back) && /* @__PURE__ */ p(se, { thumbs: I, t: f.t, plan: C }),
|
|
208
|
+
k && /* @__PURE__ */ p(
|
|
216
209
|
ie,
|
|
217
210
|
{
|
|
218
|
-
step:
|
|
219
|
-
body:
|
|
220
|
-
t:
|
|
221
|
-
movements:
|
|
222
|
-
sessionMinutes:
|
|
211
|
+
step: S,
|
|
212
|
+
body: F.body,
|
|
213
|
+
t: f.t,
|
|
214
|
+
movements: S === "face" ? c : void 0,
|
|
215
|
+
sessionMinutes: C.indexOf(S) === 0 ? 15 : null,
|
|
223
216
|
onStart: () => {
|
|
224
217
|
}
|
|
225
218
|
}
|
|
226
219
|
),
|
|
227
|
-
!
|
|
228
|
-
!
|
|
229
|
-
|
|
230
|
-
|
|
220
|
+
!k && v.k === "doc" && /* @__PURE__ */ p(Ee, { side: v.side, t: f.t }),
|
|
221
|
+
!k && v.k === "face" && /* @__PURE__ */ p(Re, { challenge: s, count: c, t: f.t }),
|
|
222
|
+
v.k === "done" && /* @__PURE__ */ p(ae, { result: v.result, t: f.t }),
|
|
223
|
+
v.k === "failed" && /* @__PURE__ */ p(le, { reason: l, locale: t, t: f.t, overrides: f.overrides, onRestart: () => {
|
|
231
224
|
}, takeFocus: !1 })
|
|
232
225
|
]
|
|
233
226
|
}
|
|
234
227
|
);
|
|
235
228
|
}
|
|
236
|
-
function
|
|
237
|
-
const n =
|
|
229
|
+
function Ee({ side: e, t: r }) {
|
|
230
|
+
const n = M(null), s = M(null), [i, t] = W({ w: 0, h: 0 });
|
|
238
231
|
U(() => {
|
|
239
|
-
const o =
|
|
232
|
+
const o = s.current;
|
|
240
233
|
if (!o) return;
|
|
241
234
|
const a = () => {
|
|
242
|
-
const
|
|
243
|
-
t((
|
|
235
|
+
const d = o.getBoundingClientRect();
|
|
236
|
+
t((u) => Math.abs(u.w - d.width) < 0.5 && Math.abs(u.h - d.height) < 0.5 ? u : { w: d.width, h: d.height }), ve(o, e);
|
|
244
237
|
};
|
|
245
238
|
if (a(), typeof ResizeObserver > "u") return;
|
|
246
|
-
const
|
|
247
|
-
return
|
|
239
|
+
const c = new ResizeObserver(a);
|
|
240
|
+
return c.observe(o), () => c.disconnect();
|
|
248
241
|
}, [e]);
|
|
249
|
-
const
|
|
250
|
-
const o =
|
|
242
|
+
const l = E(() => {
|
|
243
|
+
const o = j(i.w || 4, i.h || 3);
|
|
251
244
|
return { at: () => o, info: () => ({ kind: "edges", locks: [!0, !0, !0, !0] }) };
|
|
252
245
|
}, [i.w, i.h]);
|
|
253
|
-
return /* @__PURE__ */
|
|
246
|
+
return /* @__PURE__ */ p("div", { className: "baas-id-scope rpid-doc-capture", "data-rpid-preview": !0, children: /* @__PURE__ */ R(
|
|
254
247
|
G,
|
|
255
248
|
{
|
|
256
249
|
className: "rpid-viewport rpid-doc rpid-locked",
|
|
257
250
|
attrs: { "data-rpid-side": e, "data-rpid-frame": "holding" },
|
|
258
251
|
source: "demo",
|
|
259
252
|
videoRef: n,
|
|
260
|
-
canvasRef:
|
|
253
|
+
canvasRef: s,
|
|
261
254
|
children: [
|
|
262
|
-
/* @__PURE__ */
|
|
263
|
-
/* @__PURE__ */
|
|
255
|
+
/* @__PURE__ */ p(fe, { source: i.w ? l : null, pct: 0.62, state: "holding", t: r }),
|
|
256
|
+
/* @__PURE__ */ p(H, { tone: "ok", children: /* @__PURE__ */ p("span", { className: "rpid-guide-line", children: r.guide.steady }) })
|
|
264
257
|
]
|
|
265
258
|
}
|
|
266
259
|
) });
|
|
267
260
|
}
|
|
268
|
-
const
|
|
261
|
+
const ke = {
|
|
269
262
|
center: ["turn_left", "move_closer"],
|
|
270
263
|
turn_left: ["turn_left", "move_closer"],
|
|
271
264
|
turn_right: ["turn_right", "move_closer"],
|
|
272
265
|
move_closer: ["turn_left", "move_closer"]
|
|
273
266
|
};
|
|
274
|
-
function
|
|
275
|
-
const
|
|
267
|
+
function Re({ challenge: e, count: r, t: n }) {
|
|
268
|
+
const s = M(null), i = M(null), t = ke[e].slice(0, Math.max(1, Math.min(3, r)));
|
|
276
269
|
e !== "center" && !t.includes(e) && (t[t.length - 1] = e);
|
|
277
|
-
const
|
|
270
|
+
const l = e === "center" ? -1 : t.indexOf(e), o = e === "turn_left" ? -0.55 : e === "turn_right" ? 0.55 : 0, a = e === "move_closer" ? 1.12 : 1;
|
|
278
271
|
U(() => {
|
|
279
|
-
i.current &&
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
}, [o, a, l]);
|
|
285
|
-
const u = pe({ videoWidth: C.w, videoHeight: C.h }), p = e === "center" ? null : e, g = e === "center" ? "perfect" : e === "move_closer" ? "closer_more" : e, S = e === "center" ? 0 : 0.45, d = ye({ step: c, total: t.length, hold: 0.65, progress: S, done: !1 }), y = { "--rpid-video-ar": (C.w / C.h).toFixed(4) };
|
|
286
|
-
return /* @__PURE__ */ k("div", { className: "baas-id-scope", "data-rpid-preview": !0, children: [
|
|
287
|
-
/* @__PURE__ */ k(
|
|
272
|
+
i.current && Se(i.current, o, a);
|
|
273
|
+
}, [o, a]);
|
|
274
|
+
const c = ue({ videoWidth: b.w, videoHeight: b.h }), d = e === "center" ? null : e, u = e === "center" ? "perfect" : e === "move_closer" ? "closer_more" : e, m = e === "center" ? 0 : 0.45, g = pe({ step: l, total: t.length, hold: 0.65, progress: m, done: !1 }), h = { "--rpid-video-ar": (b.w / b.h).toFixed(4) };
|
|
275
|
+
return /* @__PURE__ */ R("div", { className: "baas-id-scope", "data-rpid-preview": !0, children: [
|
|
276
|
+
/* @__PURE__ */ R(
|
|
288
277
|
G,
|
|
289
278
|
{
|
|
290
279
|
className: `rpid-viewport rpid-face rpid-${e === "center" ? "searching" : "locked"}`,
|
|
291
280
|
attrs: { "data-rpid-guide-state": e === "center" ? "aligned" : "capturing" },
|
|
292
|
-
style:
|
|
281
|
+
style: h,
|
|
293
282
|
source: "demo",
|
|
294
|
-
videoRef:
|
|
283
|
+
videoRef: s,
|
|
295
284
|
canvasRef: i,
|
|
296
285
|
mirror: !0,
|
|
297
286
|
children: [
|
|
298
|
-
/* @__PURE__ */
|
|
287
|
+
/* @__PURE__ */ p(
|
|
299
288
|
he,
|
|
300
289
|
{
|
|
301
|
-
src:
|
|
302
|
-
oval:
|
|
303
|
-
motion: l,
|
|
290
|
+
src: b,
|
|
291
|
+
oval: c,
|
|
304
292
|
state: e === "center" ? "aligned" : "capturing",
|
|
305
293
|
scan: e === "center" ? "aligned" : "challenge",
|
|
306
|
-
fills:
|
|
307
|
-
progress:
|
|
308
|
-
cue:
|
|
309
|
-
guide:
|
|
294
|
+
fills: g,
|
|
295
|
+
progress: m,
|
|
296
|
+
cue: d,
|
|
297
|
+
guide: u,
|
|
310
298
|
t: n
|
|
311
299
|
}
|
|
312
300
|
),
|
|
313
|
-
/* @__PURE__ */
|
|
301
|
+
/* @__PURE__ */ p(H, { tone: "ok", marker: !0, children: e === "center" ? n.guide.perfect : n.guide[u] })
|
|
314
302
|
]
|
|
315
303
|
}
|
|
316
304
|
),
|
|
317
|
-
/* @__PURE__ */
|
|
305
|
+
/* @__PURE__ */ p(ye, { script: t, step: l, t: n })
|
|
318
306
|
] });
|
|
319
307
|
}
|
|
320
|
-
const Me = {
|
|
321
|
-
primary: "#135E6E",
|
|
322
|
-
positive: "#177E54",
|
|
323
|
-
caution: "#99671C",
|
|
324
|
-
danger: "#B2434E",
|
|
325
|
-
surface: "#FFFFFF",
|
|
326
|
-
text: "#16232C",
|
|
327
|
-
overlay: "#080D11"
|
|
328
|
-
}, De = 12, Pe = [
|
|
329
|
-
{ fg: "text", bg: "surface", min: 4.5 },
|
|
330
|
-
{ fg: "primary", bg: "surface", min: 4.5 },
|
|
331
|
-
{ fg: "danger", bg: "surface", min: 4.5 },
|
|
332
|
-
{ fg: "positive", bg: "surface", min: 3 },
|
|
333
|
-
{ fg: "caution", bg: "surface", min: 3 }
|
|
334
|
-
];
|
|
335
|
-
function N(e) {
|
|
336
|
-
const s = (n) => {
|
|
337
|
-
const r = parseInt(e.slice(n, n + 2), 16) / 255;
|
|
338
|
-
return r <= 0.04045 ? r / 12.92 : ((r + 0.055) / 1.055) ** 2.4;
|
|
339
|
-
};
|
|
340
|
-
return 0.2126 * s(1) + 0.7152 * s(3) + 0.0722 * s(5);
|
|
341
|
-
}
|
|
342
|
-
function xe(e, s) {
|
|
343
|
-
const [n, r] = [N(e), N(s)].sort((i, t) => t - i);
|
|
344
|
-
return Math.round((n + 0.05) / (r + 0.05) * 100) / 100;
|
|
345
|
-
}
|
|
346
|
-
function Be(e) {
|
|
347
|
-
const s = { ...Me, ...e?.colors ?? {} };
|
|
348
|
-
return Pe.map(({ fg: n, bg: r, min: i }) => {
|
|
349
|
-
const t = /^#[0-9a-fA-F]{6}$/.test(s[n]) && /^#[0-9a-fA-F]{6}$/.test(s[r]) ? xe(s[n], s[r]) : 21;
|
|
350
|
-
return { fg: n, bg: r, ratio: t, min: i, pass: t >= i };
|
|
351
|
-
});
|
|
352
|
-
}
|
|
353
308
|
export {
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
De as
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
309
|
+
we as CONTRAST_PAIRS,
|
|
310
|
+
xe as DARK,
|
|
311
|
+
De as DEFAULT_COLORS,
|
|
312
|
+
Oe as DEFAULT_RADIUS,
|
|
313
|
+
Be as FONT_STACKS,
|
|
314
|
+
Fe as FlowPreview,
|
|
315
|
+
Le as LOCALES,
|
|
316
|
+
Ne as SDK_DEFAULTS,
|
|
317
|
+
Ue as appearanceGroups,
|
|
318
|
+
Ge as appearanceStyle,
|
|
319
|
+
He as contrastChecks,
|
|
320
|
+
je as contrastRatio,
|
|
321
|
+
qe as darkPalette,
|
|
322
|
+
O as getStrings,
|
|
366
323
|
ee as introFor,
|
|
367
|
-
|
|
324
|
+
Ve as liftOn,
|
|
325
|
+
ze as parseIntroBody
|
|
368
326
|
};
|
package/dist/types/continue.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { ContinueFlow, readHandoffCode, type ContinueFlowProps } from "./react/handoff/ContinueFlow";
|
|
2
2
|
export { DEFAULT_MODELS_URL, MODELS_VERSION } from "./react/vision/modelsCdn";
|
|
3
|
-
export { getStrings, LOCALES, type Locale, type Strings, type StringOverrides } from "./react/i18n";
|
|
3
|
+
export { getStrings, LOCALES, type Locale, type Strings, type StringOverrides, type Formality } from "./react/i18n";
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { EnrollmentFlow, SignInFlow, ReverificationFlow, IdentifyFlow, normalizeSession, captureNonceOf, type ApiSessionBody, type EnrollmentFlowProps, type SignInFlowProps, type ReverificationFlowProps, type IdentifyFlowProps, type Purpose, type IdentifyCandidate, type DuplicateCandidate, type VerificationFlowProps, type RpidSession, type SessionFlow, type VerificationResult, type VerificationAssessment, type DocumentAuthenticity, type RpidFlowEvent, type ExtractionRecord, type ExtractionField, type Appearance, type TenantInstructions, type TenantMessages, type SessionHandoff, type HandoffOption, } from "./react/flows";
|
|
2
|
+
export type { ColorScheme } from "./react/theme/scheme";
|
|
2
3
|
export { ContinueOnPhone, HandoffPanel, HandoffView, type ContinueOnPhoneProps, type HandoffMode, type HandoffCopy, } from "./react/handoff/ContinueOnPhone";
|
|
3
4
|
export { ContinueFlow, readHandoffCode, type ContinueFlowProps } from "./react/handoff/ContinueFlow";
|
|
4
5
|
export { createHandoff, handoffStatus, revokeHandoff, peekHandoff, claimHandoff, type HandoffCode, type HandoffStatus, type HandoffPhase, type HandoffPeek, } from "./react/handoff/api";
|
|
@@ -15,5 +16,4 @@ export { webAttestation, nativeAttestation, requestHash, type AttestationProvide
|
|
|
15
16
|
export { preload, loadDocumentEngine, loadFaceEngine, cropQuality, DEFAULT_DETECTOR, type DetectorChoice, DEFAULT_MODELS_URL, MODELS_VERSION, modelsUrlOf, specularSignature, gridPeriodicity, cornerRadius, type PixelData, type CropSample, type CardOutline, type SpecularSignature, type CardDetection, type SideResult, type CropQuality, type FaceCentering, type EngineProgress, type ProgressFn, } from "./react/vision";
|
|
16
17
|
export { EngineLoading, ProcessingOverlay, ProximityMeter, TurnGauge, YawDial, turnGaugeFrom, } from "./react/capture";
|
|
17
18
|
export { proximityOf, distanceHintOf, distanceTrackPos, centeringFrom, centerBlocker, YAW_TARGET, CENTER_MIN, CONTAIN_MIN, FACE_W_MIN, FACE_W_MAX, FACE_W_COMFORT_MIN, FACE_W_COMFORT_MAX, faceWidthOf, type Proximity, type CenterBlocker, } from "./react/liveness";
|
|
18
|
-
export { getStrings, reasonEntry, resolveLocale, browserLocale, DEFAULT_LOCALE, LOCALES, type Locale, type Strings, type StringOverrides, type Reason, type ClientReason, type ServerReason, type ReasonEntry, type Recovery, type GuideKey, type EngineStage, type DistanceHint, } from "./react/i18n";
|
|
19
|
-
export { meshBenchmark, type MeshBench } from "./react/face/meshBench";
|
|
19
|
+
export { getStrings, reasonEntry, resolveLocale, browserLocale, DEFAULT_LOCALE, LOCALES, formalityOverrides, ES_FORMAL, type Formality, type Locale, type Strings, type StringOverrides, type Reason, type ClientReason, type ServerReason, type ReasonEntry, type Recovery, type GuideKey, type EngineStage, type DistanceHint, } from "./react/i18n";
|
package/dist/types/preview.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { FlowPreview, type FlowPreviewProps, type PreviewScreen, type PreviewChallenge, type PreviewHandoff, } from "./react/preview/FlowPreview";
|
|
2
2
|
export { appearanceStyle, appearanceGroups, FONT_STACKS, SDK_DEFAULTS, type Appearance, type ColorKey, type SafeFont, } from "./react/theme/appearance";
|
|
3
|
+
export { darkPalette, liftOn, DARK, type ColorScheme } from "./react/theme/scheme";
|
|
3
4
|
export { contrastChecks, contrastRatio, DEFAULT_COLORS, DEFAULT_RADIUS, CONTRAST_PAIRS, type ContrastCheck, } from "./react/preview/contrast";
|
|
4
5
|
export { parseIntroBody, introFor, type TenantInstructions, type TenantMessages } from "./react/flows/experience";
|
|
5
|
-
export { getStrings, LOCALES, type Locale, type Strings } from "./react/i18n";
|
|
6
|
+
export { getStrings, LOCALES, type Locale, type Strings, type Formality } from "./react/i18n";
|
|
@@ -19,6 +19,7 @@ export interface DocumentCaptureProps {
|
|
|
19
19
|
documentFrames?: number;
|
|
20
20
|
captureNonce?: string | null;
|
|
21
21
|
confirmCapture?: boolean;
|
|
22
|
+
flip?: boolean;
|
|
22
23
|
detector?: "tiny" | "legacy";
|
|
23
24
|
onCaptured: (serverResult: unknown, thumbnailDataUrl?: string) => void;
|
|
24
25
|
onRejected?: (reason: string, detail?: unknown) => void;
|
|
@@ -3,7 +3,12 @@ export interface RpidClientConfig {
|
|
|
3
3
|
apiUrl: string;
|
|
4
4
|
sessionId: string;
|
|
5
5
|
captureToken: string;
|
|
6
|
+
locale?: string;
|
|
7
|
+
formality?: "formal" | "informal";
|
|
6
8
|
}
|
|
9
|
+
export declare function apiHeaders(cfg: Pick<RpidClientConfig, "captureToken" | "locale" | "formality">): Record<string, string>;
|
|
10
|
+
export declare function langHeaders(locale?: string, formality?: "formal" | "informal"): Record<string, string>;
|
|
11
|
+
export declare const withLanguage: (cfg: RpidClientConfig, locale?: string, formality?: "formal" | "informal") => RpidClientConfig;
|
|
7
12
|
export type Json = Record<string, unknown>;
|
|
8
13
|
export interface CaptureUpload {
|
|
9
14
|
side?: "front" | "back";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export type CameraProfile = "default" | "document";
|
|
2
2
|
export declare function cameraConstraints(facing: "environment" | "user", profile: CameraProfile): MediaTrackConstraints;
|
|
3
|
+
export declare function parkCamera(stream: MediaStream, facing: "environment" | "user", profile: CameraProfile, graceMs?: number): void;
|
|
3
4
|
export declare function openCamera(video: HTMLVideoElement, facing?: "environment" | "user", profile?: CameraProfile): Promise<MediaStream>;
|
|
4
5
|
export declare function stopStream(stream: MediaStream | null | undefined): void;
|