@tsocial/tvweb-sdk 5.2.0 → 5.4.2-alpha.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.
|
@@ -224,9 +224,12 @@
|
|
|
224
224
|
|
|
225
225
|
function handleStepDoneIDCard ({ stepNumber, image, qrScannedResult, recordedVideos, apiResult }) {
|
|
226
226
|
const steps = JSON.parse(idCardStepsEl.value)
|
|
227
|
+
console.log('image', image)
|
|
227
228
|
|
|
228
229
|
resultExtractIdInfoEl.appendChild(document.createTextNode(`\n-----------------------------------------\n`))
|
|
229
230
|
resultExtractIdInfoEl.appendChild(document.createTextNode(`\nSTEP NUMBER ${stepNumber}:\n`));
|
|
231
|
+
|
|
232
|
+
|
|
230
233
|
const imgEl = document.createElement("img");
|
|
231
234
|
imgEl.width = "300";
|
|
232
235
|
imgEl.src = URL.createObjectURL(image.blob);
|
|
@@ -235,11 +238,11 @@
|
|
|
235
238
|
resultExtractIdInfoEl.appendChild(document.createTextNode(`Recorded videos: ${recordedVideos.length}\n`));
|
|
236
239
|
|
|
237
240
|
if (qrScannedResult) {
|
|
238
|
-
const { result,
|
|
241
|
+
const { result, image } = qrScannedResult
|
|
239
242
|
|
|
240
243
|
const qrImgEl = document.createElement("img");
|
|
241
244
|
qrImgEl.width = "200";
|
|
242
|
-
qrImgEl.src = URL.createObjectURL(
|
|
245
|
+
qrImgEl.src = URL.createObjectURL(image.blob);
|
|
243
246
|
resultExtractIdInfoEl.appendChild(qrImgEl);
|
|
244
247
|
resultExtractIdInfoEl.appendChild(document.createTextNode(`\n${result}\n`));
|
|
245
248
|
}
|
|
@@ -261,10 +264,10 @@
|
|
|
261
264
|
}
|
|
262
265
|
|
|
263
266
|
async function handleDetectIdCard (props) {
|
|
264
|
-
const { cardType,
|
|
267
|
+
const { cardType, image, cardSide } = props
|
|
265
268
|
const apiClient = new trustvisionSdk.default(inputAccessKey.value, inputSecretKey.value, inputApiUrl.value);
|
|
266
269
|
const resultUpload = await apiClient.uploadImage({
|
|
267
|
-
file:
|
|
270
|
+
file: image.blob,
|
|
268
271
|
label: `id_card.${cardType}.${cardSide}`,
|
|
269
272
|
});
|
|
270
273
|
const imageId = resultUpload.data.image_id
|
|
@@ -294,6 +297,7 @@
|
|
|
294
297
|
onStepDone: handleStepDoneIDCard,
|
|
295
298
|
steps: JSON.parse(idCardStepsEl.value),
|
|
296
299
|
tracking: JSON.parse(trackingConfigEl.value),
|
|
300
|
+
outputEncryptionSettings: { key: 'abc123' },
|
|
297
301
|
}
|
|
298
302
|
|
|
299
303
|
if (apiCheck) {
|
|
@@ -325,7 +329,11 @@
|
|
|
325
329
|
apiUrl: inputApiUrl.value,
|
|
326
330
|
onLivenessDetectionDone: handleLivenessDetectionDone,
|
|
327
331
|
customStepTimeConstraints: JSON.parse(customStepTimeConstraintsEl.value),
|
|
328
|
-
|
|
332
|
+
captureFrameSettings: {
|
|
333
|
+
enable: true,
|
|
334
|
+
framesIntervalTime: 180,
|
|
335
|
+
framesBatchLength: 0,
|
|
336
|
+
},
|
|
329
337
|
onError: (e) => {
|
|
330
338
|
livenessLoadingEl.style.display = "none";
|
|
331
339
|
startLivenessBtn.disabled = false;
|
|
@@ -373,7 +381,7 @@
|
|
|
373
381
|
}
|
|
374
382
|
|
|
375
383
|
function handleLivenessDetectionDone(result) {
|
|
376
|
-
const { frontalFaces, apiCheckPassed, steps
|
|
384
|
+
const { frontalFaces, apiCheckPassed, steps } = result;
|
|
377
385
|
const apiCheck = selectApiCheckEl.value === "true";
|
|
378
386
|
resultLivenessDetectionEl.innerHTML = "";
|
|
379
387
|
|
|
@@ -407,13 +415,6 @@
|
|
|
407
415
|
resultLivenessDetectionEl.appendChild(
|
|
408
416
|
document.createTextNode("Video:")
|
|
409
417
|
);
|
|
410
|
-
if (videoRecord.length) {
|
|
411
|
-
const videoEl = document.createElement("video");
|
|
412
|
-
videoEl.width = "200";
|
|
413
|
-
videoEl.controls = "controls";
|
|
414
|
-
videoEl.src = URL.createObjectURL(videoRecord[0]);
|
|
415
|
-
resultLivenessDetectionEl.appendChild(videoEl);
|
|
416
|
-
}
|
|
417
418
|
} else {
|
|
418
419
|
livenessLoadingEl.style.display = "none";
|
|
419
420
|
startLivenessBtn.disabled = false;
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<h2>Native Camera</h2>
|
|
11
11
|
<button id="btn-open-camera">Open camera</button>
|
|
12
12
|
<div id="container"></div>
|
|
13
|
-
<img id="img-result" width="300"
|
|
13
|
+
<img id="img-result" width="300"/>
|
|
14
14
|
<script src="../../build/tvweb-sdk.standalone.min.js"></script>
|
|
15
15
|
<script type="text/javascript">
|
|
16
16
|
const tv = new TVWebSDK.SDK({
|
|
@@ -21,14 +21,22 @@
|
|
|
21
21
|
const buttonOpenCamera = document.getElementById('btn-open-camera')
|
|
22
22
|
const imgResultEl = document.getElementById('img-result')
|
|
23
23
|
|
|
24
|
-
function handleCaptureDone ({ file }) {
|
|
24
|
+
function handleCaptureDone ({ file, encrypted }) {
|
|
25
25
|
imgResultEl.src = URL.createObjectURL(file)
|
|
26
26
|
imgResultEl.onload = function () {
|
|
27
27
|
URL.revokeObjectURL(this.src)
|
|
28
28
|
}
|
|
29
|
+
if (encrypted) {
|
|
30
|
+
alert(JSON.stringify(encrypted))
|
|
31
|
+
}
|
|
29
32
|
}
|
|
30
33
|
|
|
31
|
-
const { openCamera } = tv.initNativeCamera({
|
|
34
|
+
const { openCamera } = tv.initNativeCamera({
|
|
35
|
+
frontCamera: false,
|
|
36
|
+
onCaptureDone: handleCaptureDone,
|
|
37
|
+
useFileBrowse: true,
|
|
38
|
+
outputEncryptionSettings: { key: '123' }
|
|
39
|
+
})
|
|
32
40
|
|
|
33
41
|
buttonOpenCamera.onclick = openCamera
|
|
34
42
|
</script>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsocial/tvweb-sdk",
|
|
3
|
-
"version": "5.2.0",
|
|
3
|
+
"version": "5.4.2-alpha.0",
|
|
4
4
|
"description": "TV Web SDK - The Standalone SDK",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "Nha Hoang <nha.hoang@trustingsocial.com>",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@tsocial/trustvision-sdk": "2.10.1",
|
|
27
|
-
"@tsocial/tvweb-core": "^5.
|
|
28
|
-
"@tsocial/tvweb-ui": "^5.
|
|
27
|
+
"@tsocial/tvweb-core": "^5.4.0",
|
|
28
|
+
"@tsocial/tvweb-ui": "^5.4.0",
|
|
29
29
|
"http-server": "0.12.3",
|
|
30
30
|
"invariant": "^2.2.4",
|
|
31
31
|
"react": "^16.14.0",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"styled-components": "^5.2.1"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@tsocial/tvweb-builder": "^5.
|
|
37
|
+
"@tsocial/tvweb-builder": "^5.4.0"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "8de5736043aeb63960d60e1d3b1f47eca0ae2876"
|
|
40
40
|
}
|