@tsocial/tvweb-sdk.vib 5.1.2 → 5.4.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.
@@ -45,13 +45,32 @@
|
|
45
45
|
</label>
|
46
46
|
</div>
|
47
47
|
<div>
|
48
|
-
Api check
|
48
|
+
Api check
|
49
49
|
<select id="select-api-check">
|
50
50
|
<option value="false">false</option>
|
51
51
|
<option value="true" selected>true</option>
|
52
52
|
</select>
|
53
53
|
</div>
|
54
54
|
|
55
|
+
<div style="margin-top: 10px;">
|
56
|
+
<label>
|
57
|
+
Cached User ID
|
58
|
+
<input id="user-id" readonly style="width: 300px" />
|
59
|
+
</label>
|
60
|
+
<button onclick="clearUserId()">Clear user id (x-request-id)</button>
|
61
|
+
</div>
|
62
|
+
|
63
|
+
<div style="display: inline-block; margin-top: 10px;">
|
64
|
+
<div>
|
65
|
+
Tracking config
|
66
|
+
<select id="select-tracking-config-template" onchange="onSelectTrackingConfigTemplate()">
|
67
|
+
<option value="0" selected>default</option>
|
68
|
+
<option value="1">Engineering test (...9fe5)</option>
|
69
|
+
</select>
|
70
|
+
</div>
|
71
|
+
<textarea cols="55" rows="8" id="tracking-config"></textarea>
|
72
|
+
</div>
|
73
|
+
|
55
74
|
<hr />
|
56
75
|
<h4>Extract ID Info</h4>
|
57
76
|
<div style="display: inline-block; margin-right: 20px;">
|
@@ -147,6 +166,8 @@
|
|
147
166
|
const inputAccessKey = document.getElementById("access-key");
|
148
167
|
const inputSecretKey = document.getElementById("secret-key");
|
149
168
|
const inputApiUrl = document.getElementById("api-url");
|
169
|
+
const userIdEl = document.getElementById("user-id");
|
170
|
+
const trackingConfigEl = document.getElementById("tracking-config");
|
150
171
|
const readIdCardLoadingEl = document.getElementById("read-id-card-loading");
|
151
172
|
const customStepTimeConstraintsEl = document.getElementById("custom-step-time-constraints");
|
152
173
|
const statusWarmupReadIDCardEl = document.getElementById("status-warmup-read-id-card");
|
@@ -157,6 +178,22 @@
|
|
157
178
|
inputAccessKey.value = "f051dfd3-8a6e-4a15-a4e8-7ea8cdc84a31";
|
158
179
|
inputSecretKey.value = "vgiKCenoKvhPq79KABbFmxCBu6WX1tdw";
|
159
180
|
inputApiUrl.value = "https://tv-testing.trustingsocial.com/api";
|
181
|
+
userIdEl.value = JSON.parse(localStorage.getItem("user-id"));
|
182
|
+
|
183
|
+
const trackingConfigTemplates = [
|
184
|
+
TVWebSDK.TrackingContext.defaultTrackingConfig,
|
185
|
+
{
|
186
|
+
"enable": true,
|
187
|
+
"accessKey": "4df5f9b9-f34d-4ffa-829f-aa4889bc9fe5",
|
188
|
+
"secretKey": "dQDfxkVYXfAxpdReqdOd1zJP4pJ088Y7",
|
189
|
+
"apiUrl": "https://tv-testing.trustingsocial.com/api",
|
190
|
+
"userId": ""
|
191
|
+
},
|
192
|
+
];
|
193
|
+
function onSelectTrackingConfigTemplate() {
|
194
|
+
const selected = document.getElementById("select-tracking-config-template").value;
|
195
|
+
trackingConfigEl.value = JSON.stringify(trackingConfigTemplates[selected], null, 2);
|
196
|
+
}
|
160
197
|
|
161
198
|
Object.keys(TVWebSDK.Constants.Mode).forEach((k) => {
|
162
199
|
const option = document.createElement("option");
|
@@ -175,6 +212,12 @@
|
|
175
212
|
customStepTimeConstraintsEl.value = JSON.stringify(customStepTimeConstraintsData, null, 2);
|
176
213
|
idCardSettingsEl.value = JSON.stringify(TVWebSDK.defaultClientSettings, null, 2);
|
177
214
|
idCardStepsEl.value = JSON.stringify(TVWebSDK.defaultReadIDCardSteps, null, 2);
|
215
|
+
trackingConfigEl.value = JSON.stringify(TVWebSDK.TrackingContext.defaultTrackingConfig, null, 2);
|
216
|
+
|
217
|
+
function clearUserId() {
|
218
|
+
window.localStorage.removeItem('user-id');
|
219
|
+
userIdEl.value = JSON.parse(localStorage.getItem("user-id"));
|
220
|
+
}
|
178
221
|
|
179
222
|
function runWarmUpReadIDCard() {
|
180
223
|
statusWarmupReadIDCardEl.innerHTML = "..."
|
@@ -196,11 +239,11 @@
|
|
196
239
|
resultExtractIdInfoEl.appendChild(document.createTextNode(`Recorded videos: ${recordedVideos.length}\n`));
|
197
240
|
|
198
241
|
if (qrScannedResult) {
|
199
|
-
const { result,
|
242
|
+
const { result, image } = qrScannedResult
|
200
243
|
|
201
244
|
const qrImgEl = document.createElement("img");
|
202
245
|
qrImgEl.width = "200";
|
203
|
-
qrImgEl.src = URL.createObjectURL(
|
246
|
+
qrImgEl.src = URL.createObjectURL(image.blob);
|
204
247
|
resultExtractIdInfoEl.appendChild(qrImgEl);
|
205
248
|
resultExtractIdInfoEl.appendChild(document.createTextNode(`\n${result}\n`));
|
206
249
|
}
|
@@ -222,10 +265,10 @@
|
|
222
265
|
}
|
223
266
|
|
224
267
|
async function handleDetectIdCard (props) {
|
225
|
-
const { cardType,
|
268
|
+
const { cardType, image, cardSide } = props
|
226
269
|
const apiClient = new trustvisionSdk.default(inputAccessKey.value, inputSecretKey.value, inputApiUrl.value);
|
227
270
|
const resultUpload = await apiClient.uploadImage({
|
228
|
-
file:
|
271
|
+
file: image.blob,
|
229
272
|
label: `id_card.${cardType}.${cardSide}`,
|
230
273
|
});
|
231
274
|
const imageId = resultUpload.data.image_id
|
@@ -254,14 +297,17 @@
|
|
254
297
|
detectIdCard: handleDetectIdCard,
|
255
298
|
onStepDone: handleStepDoneIDCard,
|
256
299
|
steps: JSON.parse(idCardStepsEl.value),
|
300
|
+
tracking: JSON.parse(trackingConfigEl.value),
|
257
301
|
}
|
258
302
|
|
259
303
|
if (apiCheck) {
|
260
304
|
console.log('With api call')
|
261
305
|
tv.readIDCardWithApiCall({
|
262
|
-
|
263
|
-
|
264
|
-
|
306
|
+
apiCredentials: {
|
307
|
+
accessKey: inputAccessKey.value,
|
308
|
+
secretKey: inputSecretKey.value,
|
309
|
+
apiUrl: inputApiUrl.value,
|
310
|
+
},
|
265
311
|
...commonProps,
|
266
312
|
})
|
267
313
|
} else {
|
@@ -283,7 +329,11 @@
|
|
283
329
|
apiUrl: inputApiUrl.value,
|
284
330
|
onLivenessDetectionDone: handleLivenessDetectionDone,
|
285
331
|
customStepTimeConstraints: JSON.parse(customStepTimeConstraintsEl.value),
|
286
|
-
|
332
|
+
captureFrameSettings: {
|
333
|
+
enable: true,
|
334
|
+
framesIntervalTime: 180,
|
335
|
+
framesBatchLength: 0,
|
336
|
+
},
|
287
337
|
onError: (e) => {
|
288
338
|
livenessLoadingEl.style.display = "none";
|
289
339
|
startLivenessBtn.disabled = false;
|
@@ -331,7 +381,7 @@
|
|
331
381
|
}
|
332
382
|
|
333
383
|
function handleLivenessDetectionDone(result) {
|
334
|
-
const { frontalFaces, apiCheckPassed, steps
|
384
|
+
const { frontalFaces, apiCheckPassed, steps } = result;
|
335
385
|
const apiCheck = selectApiCheckEl.value === "true";
|
336
386
|
resultLivenessDetectionEl.innerHTML = "";
|
337
387
|
|
@@ -365,13 +415,6 @@
|
|
365
415
|
resultLivenessDetectionEl.appendChild(
|
366
416
|
document.createTextNode("Video:")
|
367
417
|
);
|
368
|
-
if (videoRecord.length) {
|
369
|
-
const videoEl = document.createElement("video");
|
370
|
-
videoEl.width = "200";
|
371
|
-
videoEl.controls = "controls";
|
372
|
-
videoEl.src = URL.createObjectURL(videoRecord[0]);
|
373
|
-
resultLivenessDetectionEl.appendChild(videoEl);
|
374
|
-
}
|
375
418
|
} else {
|
376
419
|
livenessLoadingEl.style.display = "none";
|
377
420
|
startLivenessBtn.disabled = false;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@tsocial/tvweb-sdk.vib",
|
3
|
-
"version": "5.
|
3
|
+
"version": "5.4.0",
|
4
4
|
"description": "TV Web SDK - The Standalone VIB SDK",
|
5
5
|
"keywords": [],
|
6
6
|
"author": "Nha Hoang <nha.hoang@trustingsocial.com>, Son T. Ng <son.nguyen.thai@trustingsocial.com>",
|
@@ -23,9 +23,9 @@
|
|
23
23
|
"test": "echo \"Error: run tests from root\" && exit 1"
|
24
24
|
},
|
25
25
|
"dependencies": {
|
26
|
-
"@tsocial/trustvision-sdk": "2.10.
|
27
|
-
"@tsocial/tvweb-core": "^5.
|
28
|
-
"@tsocial/tvweb-ui": "^5.
|
26
|
+
"@tsocial/trustvision-sdk": "2.10.1",
|
27
|
+
"@tsocial/tvweb-core": "^5.4.0",
|
28
|
+
"@tsocial/tvweb-ui": "^5.4.0",
|
29
29
|
"invariant": "^2.2.4",
|
30
30
|
"react": "^16.14.0",
|
31
31
|
"react-app-polyfill": "^2.0.0",
|
@@ -33,7 +33,7 @@
|
|
33
33
|
"styled-components": "^5.2.1"
|
34
34
|
},
|
35
35
|
"devDependencies": {
|
36
|
-
"@tsocial/tvweb-builder": "^5.
|
36
|
+
"@tsocial/tvweb-builder": "^5.4.0"
|
37
37
|
},
|
38
|
-
"gitHead": "
|
38
|
+
"gitHead": "c2aedb28f04afe4cb63281fe17fff6baaceb560a"
|
39
39
|
}
|
package/assets/ic_loading.png
DELETED
Binary file
|