@tsocial/tvweb-sdk.tcb.bss 5.11.3 → 5.12.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.
- package/build/tvweb-sdk.tcb.bss.cjs.min.js +6 -6
- package/build/tvweb-sdk.tcb.bss.standalone.min.js +10 -10
- package/examples/.DS_Store +0 -0
- package/examples/extract-id-info-and-liveness-detection/.DS_Store +0 -0
- package/examples/extract-id-info-and-liveness-detection/index.html +34 -39
- package/examples/extract-id-info-and-liveness-detection/style.css +8 -0
- package/examples/native-camera/index.html +1 -1
- package/package.json +5 -5
|
Binary file
|
|
Binary file
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
|
|
6
|
+
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-eval' 'unsafe-inline' https: data:; worker-src blob:">
|
|
6
7
|
<meta name="description" content="Vanilla JS demo" />
|
|
7
8
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
8
9
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
@@ -36,19 +37,19 @@
|
|
|
36
37
|
<div style="margin-bottom: 10px">
|
|
37
38
|
<label>
|
|
38
39
|
Access key
|
|
39
|
-
<input id="access-key"
|
|
40
|
+
<input id="access-key" class="key-input" />
|
|
40
41
|
</label>
|
|
41
42
|
</div>
|
|
42
43
|
<div style="margin-bottom: 10px">
|
|
43
44
|
<label>
|
|
44
45
|
Secret key
|
|
45
|
-
<input id="secret-key"
|
|
46
|
+
<input id="secret-key" class="key-input" />
|
|
46
47
|
</label>
|
|
47
48
|
</div>
|
|
48
49
|
<div style="margin-bottom: 10px">
|
|
49
50
|
<label>
|
|
50
51
|
API URL
|
|
51
|
-
<input id="api-url"
|
|
52
|
+
<input id="api-url" class="key-input" />
|
|
52
53
|
</label>
|
|
53
54
|
</div>
|
|
54
55
|
<div>
|
|
@@ -75,25 +76,18 @@
|
|
|
75
76
|
<option value="1">Engineering test (...9fe5)</option>
|
|
76
77
|
</select>
|
|
77
78
|
</div>
|
|
78
|
-
<textarea cols="
|
|
79
|
+
<textarea cols="40" rows="8" id="tracking-config"></textarea>
|
|
79
80
|
</div>
|
|
80
81
|
|
|
81
82
|
<hr />
|
|
82
83
|
<h4>Extract ID Info</h4>
|
|
83
84
|
<div style="display: none; margin-right: 20px;">
|
|
84
85
|
<div>Settings (notice that if <strong>Api check: true</strong>, settings from api will overwrite these settings)</div>
|
|
85
|
-
<textarea cols="
|
|
86
|
+
<textarea cols="40" rows="15" id="id-card-settings"></textarea>
|
|
86
87
|
</div>
|
|
87
88
|
<div style="display: none">
|
|
88
89
|
<div>Steps</div>
|
|
89
|
-
<textarea cols="
|
|
90
|
-
</div>
|
|
91
|
-
<div style="margin-bottom: 10px">
|
|
92
|
-
<button onclick="runPreloadEKYCResources()">Preload Resources</button>
|
|
93
|
-
</div>
|
|
94
|
-
<div style="margin-bottom: 10px">
|
|
95
|
-
<button onclick="runWarmUpReadIDCard()">Warm up</button>
|
|
96
|
-
<span id="status-warmup-read-id-card"></span>
|
|
90
|
+
<textarea cols="40" rows="15" id="id-card-steps"></textarea>
|
|
97
91
|
</div>
|
|
98
92
|
<button onclick="startExtractIDInfo()">Start</button>
|
|
99
93
|
<pre id="result-extract-id-info"></pre>
|
|
@@ -105,7 +99,7 @@
|
|
|
105
99
|
<hr />
|
|
106
100
|
|
|
107
101
|
<h4>Liveness detection</h4>
|
|
108
|
-
|
|
102
|
+
<div>
|
|
109
103
|
Mode:
|
|
110
104
|
<select id="select-mode"></select>
|
|
111
105
|
</div>
|
|
@@ -116,7 +110,7 @@
|
|
|
116
110
|
<option value="false">Back</option>
|
|
117
111
|
</select>
|
|
118
112
|
</div>
|
|
119
|
-
<button onclick="startLivenessDetection()" id="btn-start-liveness">
|
|
113
|
+
<button onclick="startLivenessDetection()" id="btn-start-liveness" style="margin-top: 10px">
|
|
120
114
|
Liveness detection
|
|
121
115
|
</button>
|
|
122
116
|
<div id="liveness-loading" style="padding-top: 10px; display: none;">
|
|
@@ -124,7 +118,6 @@
|
|
|
124
118
|
<div class="dot-windmill"></div>
|
|
125
119
|
</div>
|
|
126
120
|
<div id="result-liveness-detection"></div>
|
|
127
|
-
<div style="height: 100px;"></div>
|
|
128
121
|
</div>
|
|
129
122
|
|
|
130
123
|
<script src="https://cdn.jsdelivr.net/npm/lodash@4.17.21/lodash.min.js"></script>
|
|
@@ -149,6 +142,7 @@
|
|
|
149
142
|
secretKey: "CkoyKslrfBGv4m53LIlH0Q8yJYf4O56e",
|
|
150
143
|
},
|
|
151
144
|
];
|
|
145
|
+
let listObjUrls = [];
|
|
152
146
|
function onSelectKey() {
|
|
153
147
|
const selectedKey = document.getElementById("select-api-key").value;
|
|
154
148
|
const { accessKey, secretKey } = keys[selectedKey];
|
|
@@ -160,6 +154,16 @@
|
|
|
160
154
|
localStorage.setItem('lang', langEle?.value);
|
|
161
155
|
location.reload();
|
|
162
156
|
}
|
|
157
|
+
function createObjectURL(blob) {
|
|
158
|
+
const objUrl = URL.createObjectURL(blob);
|
|
159
|
+
listObjUrls.push(objUrl);
|
|
160
|
+
return objUrl;
|
|
161
|
+
}
|
|
162
|
+
function revokeObjectURL() {
|
|
163
|
+
if (listObjUrls.length === 0) return;
|
|
164
|
+
listObjUrls.map((item) => URL.revokeObjectURL(item));
|
|
165
|
+
listObjUrls = [];
|
|
166
|
+
}
|
|
163
167
|
</script>
|
|
164
168
|
<script type="text/javascript">
|
|
165
169
|
const lang = localStorage.getItem('lang');
|
|
@@ -170,11 +174,11 @@
|
|
|
170
174
|
const tv = new TVWebSDK.SDK({
|
|
171
175
|
container: document.getElementById("container"),
|
|
172
176
|
lang: lang || "vi",
|
|
173
|
-
|
|
174
|
-
assetRoot: "../../assets",
|
|
177
|
+
assetRoot: "https://unpkg.com/@tsocial/tvweb-sdk.tcb.bss@latest/assets",
|
|
175
178
|
enableAntiDebug: false,
|
|
176
179
|
});
|
|
177
180
|
window.tv = tv;
|
|
181
|
+
tv.runPreloadEKYCResources();
|
|
178
182
|
const resultExtractIdInfoEl = document.getElementById(
|
|
179
183
|
"result-extract-id-info"
|
|
180
184
|
);
|
|
@@ -230,17 +234,6 @@
|
|
|
230
234
|
userIdEl.value = JSON.parse(localStorage.getItem("user-id"));
|
|
231
235
|
}
|
|
232
236
|
|
|
233
|
-
function runWarmUpReadIDCard() {
|
|
234
|
-
statusWarmupReadIDCardEl.innerHTML = "..."
|
|
235
|
-
tv.runWarmUpReadIDCard().then(function() {
|
|
236
|
-
statusWarmupReadIDCardEl.innerHTML = "...done"
|
|
237
|
-
})
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
function runPreloadEKYCResources() {
|
|
241
|
-
tv.runPreloadEKYCResources();
|
|
242
|
-
}
|
|
243
|
-
|
|
244
237
|
function handleStepDoneIDCard ({ stepNumber, image, qrScannedResult, recordedVideos, apiResult }) {
|
|
245
238
|
const steps = JSON.parse(idCardStepsEl.value)
|
|
246
239
|
console.log('image', image)
|
|
@@ -251,7 +244,7 @@
|
|
|
251
244
|
|
|
252
245
|
const imgEl = document.createElement("img");
|
|
253
246
|
imgEl.width = "300";
|
|
254
|
-
imgEl.src =
|
|
247
|
+
imgEl.src = createObjectURL(image.blob);
|
|
255
248
|
resultExtractIdInfoEl.appendChild(imgEl);
|
|
256
249
|
resultExtractIdInfoEl.appendChild(document.createElement("br"));
|
|
257
250
|
resultExtractIdInfoEl.appendChild(document.createTextNode(`Recorded videos: ${recordedVideos.length}\n`));
|
|
@@ -259,10 +252,12 @@
|
|
|
259
252
|
if (qrScannedResult) {
|
|
260
253
|
const { result, image } = qrScannedResult
|
|
261
254
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
255
|
+
if (image && image.blob) {
|
|
256
|
+
const qrImgEl = document.createElement("img");
|
|
257
|
+
qrImgEl.width = "200";
|
|
258
|
+
qrImgEl.src = URL.createObjectURL(image.blob);
|
|
259
|
+
resultExtractIdInfoEl.appendChild(qrImgEl);
|
|
260
|
+
}
|
|
266
261
|
resultExtractIdInfoEl.appendChild(document.createTextNode(`\n${result}\n`));
|
|
267
262
|
}
|
|
268
263
|
|
|
@@ -300,6 +295,7 @@
|
|
|
300
295
|
}
|
|
301
296
|
|
|
302
297
|
function startExtractIDInfo() {
|
|
298
|
+
revokeObjectURL();
|
|
303
299
|
const apiCheck = selectApiCheckEl.value === "true";
|
|
304
300
|
resultExtractIdInfoEl.innerHTML = "";
|
|
305
301
|
document.body.style.height = 0;
|
|
@@ -322,7 +318,6 @@
|
|
|
322
318
|
onStepDone: handleStepDoneIDCard,
|
|
323
319
|
steps: JSON.parse(idCardStepsEl.value),
|
|
324
320
|
tracking: JSON.parse(trackingConfigEl.value),
|
|
325
|
-
outputEncryptionSettings: { key: 'abc123' },
|
|
326
321
|
}
|
|
327
322
|
|
|
328
323
|
if (apiCheck) {
|
|
@@ -342,6 +337,7 @@
|
|
|
342
337
|
}
|
|
343
338
|
|
|
344
339
|
function startLivenessDetection() {
|
|
340
|
+
revokeObjectURL();
|
|
345
341
|
const livenessDetectionMode = selectModeEl.value;
|
|
346
342
|
const apiCheck = selectApiCheckEl.value === "true";
|
|
347
343
|
const cameraSelected = document.getElementById("select-camera");
|
|
@@ -361,7 +357,6 @@
|
|
|
361
357
|
framesIntervalTime: 180,
|
|
362
358
|
framesBatchLength: 15,
|
|
363
359
|
},
|
|
364
|
-
outputEncryptionSettings: { key: 'abc123' },
|
|
365
360
|
onError: (e) => {
|
|
366
361
|
livenessLoadingEl.style.display = "none";
|
|
367
362
|
startLivenessBtn.disabled = false;
|
|
@@ -389,7 +384,7 @@
|
|
|
389
384
|
|
|
390
385
|
const imgEl = document.createElement("img");
|
|
391
386
|
imgEl.width = "200";
|
|
392
|
-
imgEl.src =
|
|
387
|
+
imgEl.src = createObjectURL(image);
|
|
393
388
|
resultExtractIdInfoEl.appendChild(imgEl);
|
|
394
389
|
resultExtractIdInfoEl.appendChild(document.createElement("br"));
|
|
395
390
|
resultExtractIdInfoEl.appendChild(document.createTextNode(`Recorded videos: ${recordedVideos.length}\n`));
|
|
@@ -424,7 +419,7 @@
|
|
|
424
419
|
const imgEl = document.createElement("img");
|
|
425
420
|
imgEl.width = "200";
|
|
426
421
|
imgEl.style.marginRight = "5px";
|
|
427
|
-
imgEl.src =
|
|
422
|
+
imgEl.src = createObjectURL(blob);
|
|
428
423
|
resultLivenessDetectionEl.appendChild(imgEl);
|
|
429
424
|
});
|
|
430
425
|
resultLivenessDetectionEl.appendChild(document.createElement("br"));
|
|
@@ -436,7 +431,7 @@
|
|
|
436
431
|
const imgEl = document.createElement("img");
|
|
437
432
|
imgEl.width = "200";
|
|
438
433
|
imgEl.style.marginRight = "5px";
|
|
439
|
-
imgEl.src =
|
|
434
|
+
imgEl.src = createObjectURL(s.image.blob);
|
|
440
435
|
resultLivenessDetectionEl.appendChild(imgEl);
|
|
441
436
|
});
|
|
442
437
|
resultLivenessDetectionEl.appendChild(document.createElement("br"));
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
const tv = new TVWebSDK.SDK({
|
|
17
17
|
container: document.getElementById('container'),
|
|
18
18
|
lang: 'vi',
|
|
19
|
-
assetRoot: 'https://unpkg.com/@tsocial/tvweb-sdk@latest/assets',
|
|
19
|
+
assetRoot: 'https://unpkg.com/@tsocial/tvweb-sdk.tcb.bss@latest/assets',
|
|
20
20
|
})
|
|
21
21
|
const buttonOpenCamera = document.getElementById('btn-open-camera')
|
|
22
22
|
const imgResultEl = document.getElementById('img-result')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsocial/tvweb-sdk.tcb.bss",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.12.0",
|
|
4
4
|
"description": "TV Web SDK - The Standalone SDK",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "ISC",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@tsocial/trustvision-sdk": "2.10.1",
|
|
26
|
-
"@tsocial/tvweb-core": "^5.
|
|
27
|
-
"@tsocial/tvweb-ui": "^5.
|
|
26
|
+
"@tsocial/tvweb-core": "^5.12.0",
|
|
27
|
+
"@tsocial/tvweb-ui": "^5.12.0",
|
|
28
28
|
"invariant": "^2.2.4",
|
|
29
29
|
"react": "^16.14.0",
|
|
30
30
|
"react-app-polyfill": "^2.0.0",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"styled-components": "^5.2.1"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@tsocial/tvweb-builder": "^5.
|
|
35
|
+
"@tsocial/tvweb-builder": "^5.12.0"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "9ca20d4a4b41967541d96c1834740dae6ac162ff"
|
|
38
38
|
}
|