@unissey-web/web-components 5.0.0-rc.3 → 5.0.0-rc.4
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/dist/{_commonjsHelpers-cef27602.js → _commonjsHelpers-02146103.js} +1 -1
- package/dist/button.js +2 -2
- package/dist/{direction-card-df682b7a.js → direction-card-143ab05d.js} +2 -2
- package/dist/{en-e76ed5a0.js → en-066d960b.js} +4 -1
- package/dist/file-upload.js +20 -21
- package/dist/full-capture.js +6 -6
- package/dist/image-capture-directions.js +4 -4
- package/dist/index.d.ts +26 -13
- package/dist/index.js +18 -8
- package/dist/{lit-element-ac3d3a27.js → lit-element-83035a6f.js} +101 -294
- package/dist/picture-editor.js +47 -54
- package/dist/picture-recorder.js +5 -5
- package/dist/reference-capture.js +6 -6
- package/dist/retry-result.js +6 -6
- package/dist/selfie-capture.js +6 -6
- package/dist/variables-be2b795f.js +99 -0
- package/dist/video-record-directions.js +4 -4
- package/dist/{video-recorder-4f57f554.js → video-recorder-74d5f262.js} +248 -223
- package/dist/video-recorder.js +5 -5
- package/package.json +1 -1
- package/dist/variables-b4a2d316.js +0 -99
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { i, d as _taggedTemplateLiteral, _ as _inherits, a as _createClass, x as x$2, s as s$1, b as _classCallCheck, c as _callSuper, e as _objectSpread2,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { E as EN } from './en-
|
|
1
|
+
import { i, d as _taggedTemplateLiteral, _ as _inherits, a as _createClass, x as x$2, s as s$1, b as _classCallCheck, c as _callSuper, e as _objectSpread2, h as _superPropGet, f as _asyncToGenerator, g as _regenerator } from './lit-element-83035a6f.js';
|
|
2
|
+
import { a as commonjsRequire, c as commonjsGlobal } from './_commonjsHelpers-02146103.js';
|
|
3
|
+
import { b as recorderVars, d as defaultVars } from './variables-be2b795f.js';
|
|
4
|
+
import { E as EN } from './en-066d960b.js';
|
|
5
5
|
import './button.js';
|
|
6
6
|
|
|
7
7
|
var name = "@unissey-web/web-components";
|
|
8
|
-
var version = "5.0.0-rc.
|
|
8
|
+
var version = "5.0.0-rc.4";
|
|
9
9
|
var description = "";
|
|
10
10
|
var module = "./dist/index.js";
|
|
11
11
|
var typings = "./dist/index.d.ts";
|
|
@@ -71,7 +71,7 @@ var buildPacked = {exports: {}};
|
|
|
71
71
|
}(buildPacked, buildPacked.exports));
|
|
72
72
|
|
|
73
73
|
var _templateObject$f;
|
|
74
|
-
var cameraStyle = i(_templateObject$f || (_templateObject$f = _taggedTemplateLiteral(["\n .container {\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n align-items: center;\n width: 100%;\n }\n\n .wrapper {\n position: relative;\n top: 0;\n left: 0;\n }\n\n .video,\n .hints,\n .instructions,\n .errors,\n .flip-icon-container,\n .canvas,\n .face-hints
|
|
74
|
+
var cameraStyle = i(_templateObject$f || (_templateObject$f = _taggedTemplateLiteral(["\n .container {\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n align-items: center;\n width: 100%;\n }\n\n .wrapper {\n position: relative;\n top: 0;\n left: 0;\n }\n\n .video,\n .hints,\n .instructions,\n .errors,\n .flip-icon-container,\n .canvas,\n .face-hints {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n border-radius: ", ";\n }\n\n .face-hints {\n width: 100%;\n height: 100%;\n z-index: 5;\n }\n\n .top-hints {\n margin-bottom: 20px;\n }\n\n .bottom-hints {\n margin-top: 20px;\n }\n\n .spinner {\n z-index: -1;\n width: 100%;\n height: 400px;\n }\n\n .canvas {\n z-index: 2;\n }\n\n .video {\n z-index: 1;\n height: 0;\n box-shadow: ", ";\n filter: ", ";\n }\n\n .flip-icon-container {\n z-index: 4;\n display: none;\n }\n\n .flip-icon {\n position: absolute;\n bottom: 5%;\n left: 5d%;\n }\n\n .hints {\n z-index: 3;\n }\n\n .instructions {\n z-index: 4;\n }\n\n .errors {\n display: none;\n justify-content: center;\n align-items: center;\n z-index: 3;\n\n border-radius: 10px;\n }\n\n .errors .message {\n display: inline-block;\n width: 70%;\n background-color: ", ";\n color: var(--uni-light-color, #fff);\n padding: 7px 15px;\n border-radius: 5px;\n text-align: center;\n }\n\n .item-center {\n display: flex;\n justify-content: center;\n align-items: center;\n }\n\n .buttons {\n text-align: center;\n width: 100%;\n\n margin: ", ";\n }\n\n .buttons-item {\n display: inline-block;\n padding: 7px;\n }\n\n @media screen and (max-width: 576px) {\n .buttons-item {\n width: 95%;\n }\n\n .buttons {\n margin-top: 15px;\n }\n }\n"])), recorderVars.borderRadius, recorderVars.boxShadow, recorderVars.videoFilter, defaultVars.colors.error, recorderVars.buttonsMargin);
|
|
75
75
|
|
|
76
76
|
var _templateObject$e;
|
|
77
77
|
var fadeAnimation = i(_templateObject$e || (_templateObject$e = _taggedTemplateLiteral(["\n @keyframes fade {\n from {\n width: 25px;\n margin-left: 0%;\n margin-top: 0%;\n opacity: 1;\n }\n to {\n width: 30px;\n margin-left: -2%;\n margin-top: -2%;\n opacity: 0;\n }\n }\n\n .icon {\n width: 25px;\n animation-name: fade;\n animation-duration: 1s;\n animation-iteration-count: infinite;\n }\n"])));
|
|
@@ -191,7 +191,7 @@ var HandIcon = /*#__PURE__*/function (_LitElement) {
|
|
|
191
191
|
HandIcon.styles = [fadeAnimation];
|
|
192
192
|
customElements.define("uni-hand-icon", HandIcon);
|
|
193
193
|
|
|
194
|
-
var _templateObject$6, _templateObject2$3, _templateObject3$1, _templateObject4$1, _templateObject5$1, _templateObject6$1, _templateObject7
|
|
194
|
+
var _templateObject$6, _templateObject2$3, _templateObject3$1, _templateObject4$1, _templateObject5$1, _templateObject6$1, _templateObject7, _templateObject8, _templateObject9, _templateObject0, _templateObject1, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14;
|
|
195
195
|
var defaultStrings = EN.videoRecorder.hints;
|
|
196
196
|
var OverlayHints = /*#__PURE__*/function (_LitElement) {
|
|
197
197
|
function OverlayHints() {
|
|
@@ -210,7 +210,7 @@ var OverlayHints = /*#__PURE__*/function (_LitElement) {
|
|
|
210
210
|
return _createClass(OverlayHints, [{
|
|
211
211
|
key: "render",
|
|
212
212
|
value: function render() {
|
|
213
|
-
return x$2(_templateObject$6 || (_templateObject$6 = _taggedTemplateLiteral(["\n <div class=\"container\">\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n <div class=\"direction\"
|
|
213
|
+
return x$2(_templateObject$6 || (_templateObject$6 = _taggedTemplateLiteral(["\n <div class=\"container\">\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n <div class=\"direction\"></div>\n </div>\n "])), this.hint === "up" ? x$2(_templateObject2$3 || (_templateObject2$3 = _taggedTemplateLiteral(["<div class=\"up\"><uni-up-arrow-icon></uni-up-arrow-icon></div>"]))) : x$2(_templateObject3$1 || (_templateObject3$1 = _taggedTemplateLiteral([""]))), this.hint === "down" ? x$2(_templateObject4$1 || (_templateObject4$1 = _taggedTemplateLiteral(["<div class=\"down\"><uni-down-arrow-icon></uni-down-arrow-icon></div>"]))) : x$2(_templateObject5$1 || (_templateObject5$1 = _taggedTemplateLiteral([""]))), this.hint === "left" ? x$2(_templateObject6$1 || (_templateObject6$1 = _taggedTemplateLiteral(["<div class=\"left\"><uni-left-arrow-icon></uni-left-arrow-icon></div>"]))) : x$2(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral([""]))), this.hint === "right" ? x$2(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["<div class=\"right\"><uni-right-arrow-icon></uni-right-arrow-icon></div>"]))) : x$2(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral([""]))), this.hint === "perfect" ? x$2(_templateObject0 || (_templateObject0 = _taggedTemplateLiteral(["<div class=\"perfect\"><uni-hand-icon></uni-hand-icon></div>"]))) : x$2(_templateObject1 || (_templateObject1 = _taggedTemplateLiteral([""]))), this.hint === "closer" ? x$2(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["<div class=\"closer\"><uni-expand-arrow-icon></uni-expand-arrow-icon></div>"]))) : x$2(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral([""]))), this.hint === "record" ? x$2(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["<div class=\"record\"><uni-camera-video-icon></uni-camera-video-icon></div>"]))) : x$2(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral([""]))));
|
|
214
214
|
}
|
|
215
215
|
}]);
|
|
216
216
|
}(s$1);
|
|
@@ -227,7 +227,7 @@ OverlayHints.properties = {
|
|
|
227
227
|
type: Object
|
|
228
228
|
}
|
|
229
229
|
};
|
|
230
|
-
OverlayHints.styles = i(
|
|
230
|
+
OverlayHints.styles = i(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n :host {\n text-align: center;\n }\n\n @keyframes up {\n from {\n top: 17%;\n }\n to {\n top: 15%;\n }\n }\n\n @keyframes down {\n from {\n bottom: 27%;\n }\n to {\n bottom: 25%;\n }\n }\n\n @keyframes left {\n from {\n left: 32%;\n }\n to {\n left: 30%;\n }\n }\n\n @keyframes right {\n from {\n right: 32%;\n }\n to {\n right: 30%;\n }\n }\n\n .up {\n position: absolute;\n top: 15%;\n left: 49%;\n animation-name: up;\n }\n\n .down {\n position: absolute;\n bottom: 25%;\n left: 49%;\n animation-name: down;\n }\n\n .left {\n position: absolute;\n top: 45%;\n left: 30%;\n animation-name: left;\n }\n\n .right {\n position: absolute;\n top: 45%;\n right: 32%;\n animation-name: right;\n }\n\n .perfect,\n .record,\n .closer {\n position: absolute;\n top: 43%;\n left: 47%;\n }\n\n .direction {\n position: absolute;\n top: 85%;\n width: 100%;\n\n text-align: center;\n font-size: ", ";\n color: ", ";\n }\n\n .up,\n .down,\n .left,\n .right,\n .closer,\n .record,\n .perfect {\n animation-duration: 0.8s;\n animation-iteration-count: infinite;\n }\n\n .container {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n }\n "])), recorderVars.hintsFontSize, recorderVars.hintsFontColor);
|
|
231
231
|
customElements.define("uni-overlay-hints", OverlayHints);
|
|
232
232
|
|
|
233
233
|
/**
|
|
@@ -376,7 +376,7 @@ function isMobileDevice() {
|
|
|
376
376
|
return check;
|
|
377
377
|
}
|
|
378
378
|
|
|
379
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6
|
|
379
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
|
|
380
380
|
var Recorder = /*#__PURE__*/function (_LitElement) {
|
|
381
381
|
function Recorder() {
|
|
382
382
|
var _this;
|
|
@@ -400,10 +400,7 @@ var Recorder = /*#__PURE__*/function (_LitElement) {
|
|
|
400
400
|
// default value of face checker attribute
|
|
401
401
|
_this.faceChecker = "disabled-on-retry";
|
|
402
402
|
// Instruction messages disaplayed for active challenges
|
|
403
|
-
_this.instructionMessage = "";
|
|
404
|
-
_this.instructionTimer = 0;
|
|
405
403
|
_this.instructions = [];
|
|
406
|
-
_this.instructionNumber = 1;
|
|
407
404
|
// Default strings for translation
|
|
408
405
|
_this.defaultStrings = EN.videoRecorder;
|
|
409
406
|
// Custom overridden strings
|
|
@@ -428,9 +425,9 @@ var Recorder = /*#__PURE__*/function (_LitElement) {
|
|
|
428
425
|
_this.isCameraFlipped = false;
|
|
429
426
|
// Does the latest session fails to find a face ? Used to disable the face detection on retry (depending on 'faceChecker' property value')
|
|
430
427
|
_this.faceDetectionFails = false;
|
|
428
|
+
_this.activeChallengeFails = false;
|
|
431
429
|
// Enable / disable the debugger hook
|
|
432
430
|
_this.disableDebugMode = false;
|
|
433
|
-
_this.actionToDisplay = undefined;
|
|
434
431
|
_this.actionState = undefined;
|
|
435
432
|
_this.sdkJsListener_status = function (status) {
|
|
436
433
|
var _this$shadowRoot, _this$shadowRoot2;
|
|
@@ -479,12 +476,33 @@ var Recorder = /*#__PURE__*/function (_LitElement) {
|
|
|
479
476
|
break;
|
|
480
477
|
}
|
|
481
478
|
};
|
|
479
|
+
_this.handleError = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
480
|
+
var _this$shadowRoot3, _this$session;
|
|
481
|
+
var captureButton, recorderInterruptedEvent;
|
|
482
|
+
return _regenerator().w(function (_context) {
|
|
483
|
+
while (1) switch (_context.n) {
|
|
484
|
+
case 0:
|
|
485
|
+
_this.willRetryCapture = true;
|
|
486
|
+
captureButton = (_this$shadowRoot3 = _this.shadowRoot) === null || _this$shadowRoot3 === void 0 ? void 0 : _this$shadowRoot3.getElementById("capture");
|
|
487
|
+
if (captureButton) captureButton.disabled = false;
|
|
488
|
+
recorderInterruptedEvent = new CustomEvent("recordInterrupted");
|
|
489
|
+
_this.dispatchEvent(recorderInterruptedEvent);
|
|
490
|
+
_context.n = 1;
|
|
491
|
+
return (_this$session = _this.session) === null || _this$session === void 0 ? void 0 : _this$session.release();
|
|
492
|
+
case 1:
|
|
493
|
+
// Note: we release the current session, but we doesn't wait for the completion. This is not an issue because createSession now waits for release completion.
|
|
494
|
+
_this.session = null;
|
|
495
|
+
_this.resetHints();
|
|
496
|
+
case 2:
|
|
497
|
+
return _context.a(2);
|
|
498
|
+
}
|
|
499
|
+
}, _callee);
|
|
500
|
+
}));
|
|
482
501
|
_this.sdkJsListener_issue = /*#__PURE__*/function () {
|
|
483
|
-
var
|
|
484
|
-
var
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
while (1) switch (_context.prev = _context.next) {
|
|
502
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(type, value) {
|
|
503
|
+
var forbiddenActionMessages, cameraErrorMessages, _t;
|
|
504
|
+
return _regenerator().w(function (_context2) {
|
|
505
|
+
while (1) switch (_context2.n) {
|
|
488
506
|
case 0:
|
|
489
507
|
forbiddenActionMessages = {
|
|
490
508
|
"1": _this.getString(["forbiddenActionMessages", "visibility"]),
|
|
@@ -496,110 +514,119 @@ var Recorder = /*#__PURE__*/function (_LitElement) {
|
|
|
496
514
|
"1": _this.getString(["cameraErrorMessages", "permissionDenied"]),
|
|
497
515
|
"2": _this.getString(["cameraErrorMessages", "openFailed"])
|
|
498
516
|
};
|
|
499
|
-
|
|
500
|
-
|
|
517
|
+
_t = type;
|
|
518
|
+
_context2.n = _t === buildPacked.exports.IssueType.NO_FACE ? 1 : _t === buildPacked.exports.IssueType.FORBIDDEN_ACTION ? 2 : _t === buildPacked.exports.IssueType.CAMERA_ERROR ? 3 : _t === buildPacked.exports.IssueType.MOVE ? 4 : _t === buildPacked.exports.IssueType.UNSUPPORTED_FACE_DETECTOR ? 5 : 6;
|
|
501
519
|
break;
|
|
502
|
-
case
|
|
520
|
+
case 1:
|
|
503
521
|
_this.displayError(_this.getString(["errors", "noFace"]));
|
|
504
522
|
_this.faceDetectionFails = true;
|
|
505
|
-
return
|
|
506
|
-
case
|
|
523
|
+
return _context2.a(3, 6);
|
|
524
|
+
case 2:
|
|
507
525
|
if (Object.keys(forbiddenActionMessages).includes("".concat(value))) {
|
|
508
526
|
_this.displayError(forbiddenActionMessages["".concat(value)]);
|
|
509
527
|
} else {
|
|
510
528
|
_this.displayError(_this.getString(["forbiddenActionMessages", "default"]));
|
|
511
529
|
}
|
|
512
|
-
return
|
|
513
|
-
case
|
|
530
|
+
return _context2.a(3, 6);
|
|
531
|
+
case 3:
|
|
514
532
|
if (Object.keys(cameraErrorMessages).includes("".concat(value))) {
|
|
515
533
|
_this.displayError(cameraErrorMessages["".concat(value)]);
|
|
516
534
|
} else {
|
|
517
535
|
_this.displayError(_this.getString(["cameraErrorMessages", "default"]));
|
|
518
536
|
}
|
|
519
|
-
return
|
|
520
|
-
case
|
|
537
|
+
return _context2.a(3, 6);
|
|
538
|
+
case 4:
|
|
521
539
|
if (value === 7) {
|
|
522
540
|
_this.displayError(_this.getString(["rotationWhileCapturingErrorMessage"]));
|
|
523
541
|
}
|
|
524
|
-
return
|
|
525
|
-
case
|
|
526
|
-
_this.
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
_this.
|
|
531
|
-
|
|
532
|
-
return
|
|
533
|
-
case 21:
|
|
534
|
-
// Note: we release the current session, but we doesn't wait for the completion. This is not an issue because createSession now waits for release completion.
|
|
535
|
-
_this.session = null;
|
|
536
|
-
_this.resetHints();
|
|
537
|
-
case 23:
|
|
538
|
-
case "end":
|
|
539
|
-
return _context.stop();
|
|
542
|
+
return _context2.a(3, 6);
|
|
543
|
+
case 5:
|
|
544
|
+
_this.displayError(_this.getString(["errors", "unsupportedFaceDetector"]));
|
|
545
|
+
return _context2.a(3, 6);
|
|
546
|
+
case 6:
|
|
547
|
+
_context2.n = 7;
|
|
548
|
+
return _this.handleError();
|
|
549
|
+
case 7:
|
|
550
|
+
return _context2.a(2);
|
|
540
551
|
}
|
|
541
|
-
},
|
|
552
|
+
}, _callee2);
|
|
542
553
|
}));
|
|
543
554
|
return function (_x, _x2) {
|
|
544
|
-
return
|
|
555
|
+
return _ref2.apply(this, arguments);
|
|
556
|
+
};
|
|
557
|
+
}();
|
|
558
|
+
_this.sdkJsListener_activeChallenge = /*#__PURE__*/function () {
|
|
559
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(activeChallengeEventType, value, value2) {
|
|
560
|
+
var actions, actionId, roundedActionId, detail, activeChallengeEvent, _detail, _activeChallengeEvent, _detail2, _activeChallengeEvent2, _t2;
|
|
561
|
+
return _regenerator().w(function (_context3) {
|
|
562
|
+
while (1) switch (_context3.n) {
|
|
563
|
+
case 0:
|
|
564
|
+
actions = ["left", "right", "up", "down", "custom"];
|
|
565
|
+
if (!(_this.instructions.length < 1)) {
|
|
566
|
+
_context3.n = 1;
|
|
567
|
+
break;
|
|
568
|
+
}
|
|
569
|
+
return _context3.a(2);
|
|
570
|
+
case 1:
|
|
571
|
+
_t2 = activeChallengeEventType;
|
|
572
|
+
_context3.n = _t2 === buildPacked.exports.ActiveChallengeEventType.ACTION ? 2 : _t2 === buildPacked.exports.ActiveChallengeEventType.REMAINING_SECONDS ? 3 : _t2 === buildPacked.exports.ActiveChallengeEventType.ACTION_ERROR ? 4 : _t2 === buildPacked.exports.ActiveChallengeEventType.COMPLETED ? 7 : 8;
|
|
573
|
+
break;
|
|
574
|
+
case 2:
|
|
575
|
+
actionId = value;
|
|
576
|
+
roundedActionId = actionId >= 4 ? 4 : actionId;
|
|
577
|
+
if (actionId >= 0) {
|
|
578
|
+
detail = {
|
|
579
|
+
action: actions[roundedActionId]
|
|
580
|
+
};
|
|
581
|
+
activeChallengeEvent = new CustomEvent("activeChallenge", {
|
|
582
|
+
detail: detail
|
|
583
|
+
});
|
|
584
|
+
_this.dispatchEvent(activeChallengeEvent);
|
|
585
|
+
_this.actionState = undefined;
|
|
586
|
+
} else {
|
|
587
|
+
_this.actionState = !_this.actionState ? "success" : _this.actionState;
|
|
588
|
+
_detail = {
|
|
589
|
+
status: _this.actionState
|
|
590
|
+
};
|
|
591
|
+
_activeChallengeEvent = new CustomEvent("activeChallenge", {
|
|
592
|
+
detail: _detail
|
|
593
|
+
});
|
|
594
|
+
if (actions[roundedActionId] !== "custom") _this.dispatchEvent(_activeChallengeEvent);
|
|
595
|
+
}
|
|
596
|
+
return _context3.a(3, 8);
|
|
597
|
+
case 3:
|
|
598
|
+
return _context3.a(3, 8);
|
|
599
|
+
case 4:
|
|
600
|
+
if (_this.activeChallengeFails) {
|
|
601
|
+
_context3.n = 6;
|
|
602
|
+
break;
|
|
603
|
+
}
|
|
604
|
+
_this.displayError(_this.getString(["errors", "activeChallenge"]));
|
|
605
|
+
_context3.n = 5;
|
|
606
|
+
return _this.handleError();
|
|
607
|
+
case 5:
|
|
608
|
+
_this.activeChallengeFails = true;
|
|
609
|
+
case 6:
|
|
610
|
+
return _context3.a(3, 8);
|
|
611
|
+
case 7:
|
|
612
|
+
_detail2 = {
|
|
613
|
+
status: "completed"
|
|
614
|
+
};
|
|
615
|
+
_activeChallengeEvent2 = new CustomEvent("activeChallenge", {
|
|
616
|
+
detail: _detail2
|
|
617
|
+
});
|
|
618
|
+
_this.dispatchEvent(_activeChallengeEvent2);
|
|
619
|
+
_this.actionState = undefined;
|
|
620
|
+
return _context3.a(3, 8);
|
|
621
|
+
case 8:
|
|
622
|
+
return _context3.a(2);
|
|
623
|
+
}
|
|
624
|
+
}, _callee3);
|
|
625
|
+
}));
|
|
626
|
+
return function (_x3, _x4, _x5) {
|
|
627
|
+
return _ref3.apply(this, arguments);
|
|
545
628
|
};
|
|
546
629
|
}();
|
|
547
|
-
_this.sdkJsListener_activeChallenge = function (activeChallengeEventType, value, value2) {
|
|
548
|
-
var actions = ["left", "right", "up", "down", "custom"];
|
|
549
|
-
if (_this.instructions.length < 1) return; //we shouln't receive this event !
|
|
550
|
-
if (activeChallengeEventType === buildPacked.exports.ActiveChallengeEventType.ACTION) {
|
|
551
|
-
var actionId = value;
|
|
552
|
-
var roundedActionId = actionId >= 4 ? 4 : actionId;
|
|
553
|
-
if (actionId >= 0) {
|
|
554
|
-
var detail = {
|
|
555
|
-
action: actions[roundedActionId]
|
|
556
|
-
};
|
|
557
|
-
var activeChallengeEvent = new CustomEvent("activeChallenge", {
|
|
558
|
-
detail: detail
|
|
559
|
-
});
|
|
560
|
-
_this.dispatchEvent(activeChallengeEvent);
|
|
561
|
-
_this.instructionMessage = "".concat(_this.instructionNumber, ". ").concat(_this.instructions[actionId]);
|
|
562
|
-
_this.instructionNumber++;
|
|
563
|
-
_this.actionState = undefined;
|
|
564
|
-
_this.actionToDisplay = actionId < _this.instructions.length ? actions[actionId] : undefined;
|
|
565
|
-
} else {
|
|
566
|
-
_this.instructionMessage = ""; // a negative actionId is for erasing the current message (actionId should always be < instructions.length)
|
|
567
|
-
_this.instructionTimer = 0;
|
|
568
|
-
_this.actionState = !_this.actionState ? "success" : _this.actionState;
|
|
569
|
-
var _detail = {
|
|
570
|
-
status: _this.actionState
|
|
571
|
-
};
|
|
572
|
-
var _activeChallengeEvent = new CustomEvent("activeChallenge", {
|
|
573
|
-
detail: _detail
|
|
574
|
-
});
|
|
575
|
-
if (actions[roundedActionId] !== "custom") _this.dispatchEvent(_activeChallengeEvent);
|
|
576
|
-
}
|
|
577
|
-
//console.log("active action:", actionId);
|
|
578
|
-
}
|
|
579
|
-
if (activeChallengeEventType === buildPacked.exports.ActiveChallengeEventType.REMAINING_SECONDS) {
|
|
580
|
-
var remainingSeconds = value;
|
|
581
|
-
//console.log("remaining Seconds:", remainingSeconds);
|
|
582
|
-
_this.instructionTimer = remainingSeconds;
|
|
583
|
-
}
|
|
584
|
-
if (activeChallengeEventType === buildPacked.exports.ActiveChallengeEventType.ACTION_ERROR) {
|
|
585
|
-
_this.actionState = "error";
|
|
586
|
-
// console.log("action error:", expectedActionId, detectedActionId);
|
|
587
|
-
// TODO : UI and retry !!
|
|
588
|
-
}
|
|
589
|
-
if (activeChallengeEventType === buildPacked.exports.ActiveChallengeEventType.COMPLETED) {
|
|
590
|
-
var _detail2 = {
|
|
591
|
-
status: "completed"
|
|
592
|
-
};
|
|
593
|
-
var _activeChallengeEvent2 = new CustomEvent("activeChallenge", {
|
|
594
|
-
detail: _detail2
|
|
595
|
-
});
|
|
596
|
-
_this.dispatchEvent(_activeChallengeEvent2);
|
|
597
|
-
//console.log("success:", success);
|
|
598
|
-
_this.instructionMessage = "";
|
|
599
|
-
_this.actionToDisplay = undefined;
|
|
600
|
-
_this.actionState = undefined;
|
|
601
|
-
}
|
|
602
|
-
};
|
|
603
630
|
_this.addEventListener("startCapture", _this.capture.bind(_this));
|
|
604
631
|
return _this;
|
|
605
632
|
}
|
|
@@ -607,19 +634,18 @@ var Recorder = /*#__PURE__*/function (_LitElement) {
|
|
|
607
634
|
return _createClass(Recorder, [{
|
|
608
635
|
key: "retryCapture",
|
|
609
636
|
value: function () {
|
|
610
|
-
var _retryCapture = _asyncToGenerator(
|
|
611
|
-
return
|
|
612
|
-
while (1) switch (
|
|
637
|
+
var _retryCapture = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
|
|
638
|
+
return _regenerator().w(function (_context4) {
|
|
639
|
+
while (1) switch (_context4.n) {
|
|
613
640
|
case 0:
|
|
614
641
|
this.hideError();
|
|
615
642
|
this.willRetryCapture = false;
|
|
616
|
-
|
|
643
|
+
_context4.n = 1;
|
|
617
644
|
return this.callInitSession();
|
|
618
|
-
case
|
|
619
|
-
|
|
620
|
-
return _context2.stop();
|
|
645
|
+
case 1:
|
|
646
|
+
return _context4.a(2);
|
|
621
647
|
}
|
|
622
|
-
},
|
|
648
|
+
}, _callee4, this);
|
|
623
649
|
}));
|
|
624
650
|
function retryCapture() {
|
|
625
651
|
return _retryCapture.apply(this, arguments);
|
|
@@ -629,32 +655,32 @@ var Recorder = /*#__PURE__*/function (_LitElement) {
|
|
|
629
655
|
}, {
|
|
630
656
|
key: "capture",
|
|
631
657
|
value: function () {
|
|
632
|
-
var _capture = _asyncToGenerator(
|
|
658
|
+
var _capture = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
|
|
633
659
|
var _this$config$recordin;
|
|
634
660
|
var faceCheckerOptions, captureConfig, _yield$this$session$c, media, metadata, error, detail, recordCompletedEvent, recordEvent;
|
|
635
|
-
return
|
|
636
|
-
while (1) switch (
|
|
661
|
+
return _regenerator().w(function (_context5) {
|
|
662
|
+
while (1) switch (_context5.n) {
|
|
637
663
|
case 0:
|
|
638
664
|
if (!this.sessionPromise) {
|
|
639
|
-
|
|
665
|
+
_context5.n = 1;
|
|
640
666
|
break;
|
|
641
667
|
}
|
|
642
|
-
|
|
668
|
+
_context5.n = 1;
|
|
643
669
|
return this.sessionPromise;
|
|
644
|
-
case
|
|
670
|
+
case 1:
|
|
645
671
|
if (this.session) {
|
|
646
|
-
|
|
672
|
+
_context5.n = 3;
|
|
647
673
|
break;
|
|
648
674
|
}
|
|
649
675
|
if (!this.willRetryCapture) {
|
|
650
|
-
|
|
676
|
+
_context5.n = 2;
|
|
651
677
|
break;
|
|
652
678
|
}
|
|
653
|
-
|
|
679
|
+
_context5.n = 2;
|
|
654
680
|
return this.retryCapture();
|
|
655
|
-
case
|
|
656
|
-
return
|
|
657
|
-
case
|
|
681
|
+
case 2:
|
|
682
|
+
return _context5.a(2);
|
|
683
|
+
case 3:
|
|
658
684
|
faceCheckerOptions = this.faceChecker === "disabled" ? undefined : this.faceChecker === "disabled-on-retry" && this.faceDetectionFails ? {
|
|
659
685
|
check: "disabled"
|
|
660
686
|
} : {
|
|
@@ -664,15 +690,29 @@ var Recorder = /*#__PURE__*/function (_LitElement) {
|
|
|
664
690
|
captureConfig = faceCheckerOptions ? {
|
|
665
691
|
faceCheckerOptions: faceCheckerOptions
|
|
666
692
|
} : undefined;
|
|
667
|
-
|
|
693
|
+
_context5.n = 4;
|
|
668
694
|
return this.session.capture(captureConfig);
|
|
669
|
-
case
|
|
670
|
-
_yield$this$session$c =
|
|
695
|
+
case 4:
|
|
696
|
+
_yield$this$session$c = _context5.v;
|
|
671
697
|
media = _yield$this$session$c.media;
|
|
672
698
|
metadata = _yield$this$session$c.metadata;
|
|
673
699
|
error = _yield$this$session$c.error;
|
|
674
700
|
this.resetHints();
|
|
675
|
-
if (error)
|
|
701
|
+
if (!error) {
|
|
702
|
+
_context5.n = 6;
|
|
703
|
+
break;
|
|
704
|
+
}
|
|
705
|
+
console.log(error);
|
|
706
|
+
if (this.error) {
|
|
707
|
+
_context5.n = 5;
|
|
708
|
+
break;
|
|
709
|
+
}
|
|
710
|
+
this.displayError("".concat(this.getString(["errors", "sdkError"]), ": ").concat(error));
|
|
711
|
+
_context5.n = 5;
|
|
712
|
+
return this.handleError();
|
|
713
|
+
case 5:
|
|
714
|
+
return _context5.a(2);
|
|
715
|
+
case 6:
|
|
676
716
|
detail = {};
|
|
677
717
|
detail[this.resultEvent.mediaPropertyName] = media;
|
|
678
718
|
if (this.resultEvent.includeMetadata) detail["metadata"] = metadata;
|
|
@@ -687,11 +727,10 @@ var Recorder = /*#__PURE__*/function (_LitElement) {
|
|
|
687
727
|
detail: detail
|
|
688
728
|
});
|
|
689
729
|
this.dispatchEvent(recordEvent);
|
|
690
|
-
case
|
|
691
|
-
|
|
692
|
-
return _context3.stop();
|
|
730
|
+
case 7:
|
|
731
|
+
return _context5.a(2);
|
|
693
732
|
}
|
|
694
|
-
},
|
|
733
|
+
}, _callee5, this);
|
|
695
734
|
}));
|
|
696
735
|
function capture() {
|
|
697
736
|
return _capture.apply(this, arguments);
|
|
@@ -701,28 +740,27 @@ var Recorder = /*#__PURE__*/function (_LitElement) {
|
|
|
701
740
|
}, {
|
|
702
741
|
key: "flipCamera",
|
|
703
742
|
value: function () {
|
|
704
|
-
var _flipCamera = _asyncToGenerator(
|
|
705
|
-
return
|
|
706
|
-
while (1) switch (
|
|
743
|
+
var _flipCamera = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6() {
|
|
744
|
+
return _regenerator().w(function (_context6) {
|
|
745
|
+
while (1) switch (_context6.n) {
|
|
707
746
|
case 0:
|
|
708
747
|
this.isCameraFlipped = !this.isCameraFlipped;
|
|
709
748
|
if (!this.willRetryCapture) {
|
|
710
|
-
|
|
749
|
+
_context6.n = 2;
|
|
711
750
|
break;
|
|
712
751
|
}
|
|
713
|
-
|
|
752
|
+
_context6.n = 1;
|
|
714
753
|
return this.retryCapture();
|
|
715
|
-
case
|
|
716
|
-
|
|
754
|
+
case 1:
|
|
755
|
+
_context6.n = 3;
|
|
717
756
|
break;
|
|
718
|
-
case
|
|
719
|
-
|
|
757
|
+
case 2:
|
|
758
|
+
_context6.n = 3;
|
|
720
759
|
return this.callInitSession();
|
|
721
|
-
case
|
|
722
|
-
|
|
723
|
-
return _context4.stop();
|
|
760
|
+
case 3:
|
|
761
|
+
return _context6.a(2);
|
|
724
762
|
}
|
|
725
|
-
},
|
|
763
|
+
}, _callee6, this);
|
|
726
764
|
}));
|
|
727
765
|
function flipCamera() {
|
|
728
766
|
return _flipCamera.apply(this, arguments);
|
|
@@ -779,14 +817,13 @@ var Recorder = /*#__PURE__*/function (_LitElement) {
|
|
|
779
817
|
}, {
|
|
780
818
|
key: "getString",
|
|
781
819
|
value: function getString(keys) {
|
|
782
|
-
var _customString;
|
|
783
820
|
var customString = this.strings;
|
|
784
821
|
var defaultString = this.defaultStrings;
|
|
785
822
|
keys.forEach(function (key) {
|
|
786
823
|
customString = customString != undefined && key in customString ? customString[key] : undefined;
|
|
787
824
|
defaultString = defaultString != undefined && key in defaultString ? defaultString[key] : undefined;
|
|
788
825
|
});
|
|
789
|
-
return
|
|
826
|
+
return customString !== null && customString !== void 0 ? customString : defaultString;
|
|
790
827
|
}
|
|
791
828
|
}, {
|
|
792
829
|
key: "initSdkJs",
|
|
@@ -832,7 +869,7 @@ var Recorder = /*#__PURE__*/function (_LitElement) {
|
|
|
832
869
|
check: faceCheckerValue
|
|
833
870
|
};
|
|
834
871
|
if (((_sessionConfig$iadCon = sessionConfig.iadConfig) === null || _sessionConfig$iadCon === void 0 ? void 0 : _sessionConfig$iadCon.mode) === buildPacked.exports.IadMode.SUBSTANTIAL || !!((_sessionConfig$iadCon2 = sessionConfig.iadConfig) !== null && _sessionConfig$iadCon2 !== void 0 && _sessionConfig$iadCon2.activeChallengeConfig)) {
|
|
835
|
-
var _this$getString, _this$getString2, _this$getString3, _this$getString4, _sessionConfig$iadCon3, _sessionConfig$iadCon4, _sessionConfig$iadCon5, _sessionConfig$iadCon6, _sessionConfig$iadCon7, _sessionConfig$iadCon8, _sessionConfig$iadCon9, _sessionConfig$
|
|
872
|
+
var _this$getString, _this$getString2, _this$getString3, _this$getString4, _sessionConfig$iadCon3, _sessionConfig$iadCon4, _sessionConfig$iadCon5, _sessionConfig$iadCon6, _sessionConfig$iadCon7, _sessionConfig$iadCon8, _sessionConfig$iadCon9, _sessionConfig$iadCon0, _sessionConfig$iadCon1;
|
|
836
873
|
// configure active challenge
|
|
837
874
|
this.instructions = [(_this$getString = this.getString(["activeChallengeMessages", "rotateLeft"])) !== null && _this$getString !== void 0 ? _this$getString : "undefined action", (_this$getString2 = this.getString(["activeChallengeMessages", "rotateRight"])) !== null && _this$getString2 !== void 0 ? _this$getString2 : "undefined action", (_this$getString3 = this.getString(["activeChallengeMessages", "rotateUp"])) !== null && _this$getString3 !== void 0 ? _this$getString3 : "undefined action", (_this$getString4 = this.getString(["activeChallengeMessages", "rotateDown"])) !== null && _this$getString4 !== void 0 ? _this$getString4 : "undefined action"];
|
|
838
875
|
sessionConfig.iadConfig.activeChallengeConfig = {
|
|
@@ -844,9 +881,9 @@ var Recorder = /*#__PURE__*/function (_LitElement) {
|
|
|
844
881
|
// true, except if force by client application
|
|
845
882
|
selfieBeforeAction: (_sessionConfig$iadCon9 = sessionConfig.iadConfig.activeChallengeConfig) === null || _sessionConfig$iadCon9 === void 0 ? void 0 : _sessionConfig$iadCon9.selfieBeforeAction,
|
|
846
883
|
// default : Selfie is recorded between two actions of the scenario
|
|
847
|
-
customActions: (_sessionConfig$
|
|
884
|
+
customActions: (_sessionConfig$iadCon0 = sessionConfig.iadConfig.activeChallengeConfig) === null || _sessionConfig$iadCon0 === void 0 ? void 0 : _sessionConfig$iadCon0.customActions
|
|
848
885
|
};
|
|
849
|
-
(_sessionConfig$
|
|
886
|
+
(_sessionConfig$iadCon1 = sessionConfig.iadConfig.activeChallengeConfig.customActions) === null || _sessionConfig$iadCon1 === void 0 || _sessionConfig$iadCon1.map(function (action) {
|
|
850
887
|
_this2.instructions.push(action.message);
|
|
851
888
|
});
|
|
852
889
|
}
|
|
@@ -868,20 +905,19 @@ var Recorder = /*#__PURE__*/function (_LitElement) {
|
|
|
868
905
|
}, {
|
|
869
906
|
key: "callInitSession",
|
|
870
907
|
value: function () {
|
|
871
|
-
var _callInitSession = _asyncToGenerator(
|
|
872
|
-
return
|
|
873
|
-
while (1) switch (
|
|
908
|
+
var _callInitSession = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7() {
|
|
909
|
+
return _regenerator().w(function (_context7) {
|
|
910
|
+
while (1) switch (_context7.n) {
|
|
874
911
|
case 0:
|
|
875
912
|
this.sessionPromise = this.initSession();
|
|
876
|
-
|
|
913
|
+
_context7.n = 1;
|
|
877
914
|
return this.sessionPromise;
|
|
878
|
-
case
|
|
915
|
+
case 1:
|
|
879
916
|
this.sessionPromise = null;
|
|
880
|
-
case
|
|
881
|
-
|
|
882
|
-
return _context5.stop();
|
|
917
|
+
case 2:
|
|
918
|
+
return _context7.a(2);
|
|
883
919
|
}
|
|
884
|
-
},
|
|
920
|
+
}, _callee7, this);
|
|
885
921
|
}));
|
|
886
922
|
function callInitSession() {
|
|
887
923
|
return _callInitSession.apply(this, arguments);
|
|
@@ -891,25 +927,25 @@ var Recorder = /*#__PURE__*/function (_LitElement) {
|
|
|
891
927
|
}, {
|
|
892
928
|
key: "initSession",
|
|
893
929
|
value: function () {
|
|
894
|
-
var _initSession = _asyncToGenerator(
|
|
930
|
+
var _initSession = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8() {
|
|
895
931
|
var _this$shadowRoot6,
|
|
896
932
|
_this$shadowRoot7,
|
|
897
933
|
_this3 = this;
|
|
898
|
-
var cvs, video, _this$shadowRoot8, _this$shadowRoot9, _this$session3, sessionConfig, _this$session4, acquisitionTime, canvasElem, videoElem, recorderReadyEvent;
|
|
899
|
-
return
|
|
900
|
-
while (1) switch (
|
|
934
|
+
var cvs, video, _this$shadowRoot8, _this$shadowRoot9, _this$session3, sessionConfig, _this$session4, sessionInfos, acquisitionTime, activeChallengeNumActions, canvasElem, videoElem, recorderReadyEvent;
|
|
935
|
+
return _regenerator().w(function (_context8) {
|
|
936
|
+
while (1) switch (_context8.n) {
|
|
901
937
|
case 0:
|
|
902
938
|
cvs = (_this$shadowRoot6 = this.shadowRoot) === null || _this$shadowRoot6 === void 0 ? void 0 : _this$shadowRoot6.getElementById("cvs");
|
|
903
939
|
video = (_this$shadowRoot7 = this.shadowRoot) === null || _this$shadowRoot7 === void 0 ? void 0 : _this$shadowRoot7.getElementById("vid");
|
|
904
940
|
if (!this.initSessionInprogress) {
|
|
905
|
-
|
|
941
|
+
_context8.n = 1;
|
|
906
942
|
break;
|
|
907
943
|
}
|
|
908
944
|
console.debug("A session is currently in creation. The new creation request is ignored");
|
|
909
|
-
return
|
|
910
|
-
case
|
|
945
|
+
return _context8.a(2);
|
|
946
|
+
case 1:
|
|
911
947
|
if (!(video && cvs)) {
|
|
912
|
-
|
|
948
|
+
_context8.n = 8;
|
|
913
949
|
break;
|
|
914
950
|
}
|
|
915
951
|
this.displaySpinner();
|
|
@@ -917,41 +953,43 @@ var Recorder = /*#__PURE__*/function (_LitElement) {
|
|
|
917
953
|
|
|
918
954
|
// Release any active session before create a new one
|
|
919
955
|
if (!this.session) {
|
|
920
|
-
|
|
956
|
+
_context8.n = 3;
|
|
921
957
|
break;
|
|
922
958
|
}
|
|
923
|
-
|
|
959
|
+
_context8.n = 2;
|
|
924
960
|
return (_this$session3 = this.session) === null || _this$session3 === void 0 ? void 0 : _this$session3.release();
|
|
925
|
-
case
|
|
961
|
+
case 2:
|
|
926
962
|
this.session = null; // Note: Should be already set to null by sdkJsListener_status()
|
|
927
|
-
case
|
|
963
|
+
case 3:
|
|
928
964
|
sessionConfig = this.buildSessionConfig();
|
|
929
|
-
|
|
965
|
+
_context8.n = 4;
|
|
930
966
|
return buildPacked.exports.UnisseySdk.createSession(video, this.preset, cvs, sessionConfig)["catch"](function (e) {
|
|
931
967
|
_this3.resetHints();
|
|
932
968
|
return null;
|
|
933
969
|
})["finally"](function () {
|
|
934
970
|
_this3.hideSpinner();
|
|
935
971
|
});
|
|
936
|
-
case
|
|
937
|
-
this.session =
|
|
972
|
+
case 4:
|
|
973
|
+
this.session = _context8.v;
|
|
938
974
|
this.initSessionInprogress = false;
|
|
939
975
|
if (!this.disconnected) {
|
|
940
|
-
|
|
976
|
+
_context8.n = 6;
|
|
941
977
|
break;
|
|
942
978
|
}
|
|
943
|
-
|
|
979
|
+
_context8.n = 5;
|
|
944
980
|
return (_this$session4 = this.session) === null || _this$session4 === void 0 ? void 0 : _this$session4.release();
|
|
945
|
-
case
|
|
981
|
+
case 5:
|
|
946
982
|
this.session = null; // Note: Should be already set to null by sdkJsListener_status()
|
|
947
|
-
case
|
|
983
|
+
case 6:
|
|
948
984
|
if (this.session) {
|
|
949
|
-
|
|
985
|
+
_context8.n = 7;
|
|
950
986
|
break;
|
|
951
987
|
}
|
|
952
|
-
return
|
|
953
|
-
case
|
|
954
|
-
|
|
988
|
+
return _context8.a(2);
|
|
989
|
+
case 7:
|
|
990
|
+
sessionInfos = this.session.getInfo();
|
|
991
|
+
acquisitionTime = sessionInfos.acquisition_length;
|
|
992
|
+
activeChallengeNumActions = sessionInfos.active_challenge_num_actions;
|
|
955
993
|
canvasElem = (_this$shadowRoot8 = this.shadowRoot) === null || _this$shadowRoot8 === void 0 ? void 0 : _this$shadowRoot8.getElementById("cvs");
|
|
956
994
|
videoElem = (_this$shadowRoot9 = this.shadowRoot) === null || _this$shadowRoot9 === void 0 ? void 0 : _this$shadowRoot9.getElementById("vid");
|
|
957
995
|
recorderReadyEvent = new CustomEvent("recorderReady", {
|
|
@@ -960,15 +998,15 @@ var Recorder = /*#__PURE__*/function (_LitElement) {
|
|
|
960
998
|
canvasElmt: canvasElem,
|
|
961
999
|
videoElmt: videoElem,
|
|
962
1000
|
mediaType: this.mediaType,
|
|
963
|
-
acquisitionTime: acquisitionTime
|
|
1001
|
+
acquisitionTime: acquisitionTime,
|
|
1002
|
+
activeChallengeNumActions: activeChallengeNumActions
|
|
964
1003
|
}
|
|
965
1004
|
});
|
|
966
1005
|
this.dispatchEvent(recorderReadyEvent);
|
|
967
|
-
case
|
|
968
|
-
|
|
969
|
-
return _context6.stop();
|
|
1006
|
+
case 8:
|
|
1007
|
+
return _context8.a(2);
|
|
970
1008
|
}
|
|
971
|
-
},
|
|
1009
|
+
}, _callee8, this);
|
|
972
1010
|
}));
|
|
973
1011
|
function initSession() {
|
|
974
1012
|
return _initSession.apply(this, arguments);
|
|
@@ -1009,9 +1047,6 @@ var Recorder = /*#__PURE__*/function (_LitElement) {
|
|
|
1009
1047
|
value: function resetHints() {
|
|
1010
1048
|
this.adjustContainerSize();
|
|
1011
1049
|
this.hints = "nil";
|
|
1012
|
-
this.instructionMessage = "";
|
|
1013
|
-
this.instructionTimer = 0;
|
|
1014
|
-
this.instructionNumber = 1;
|
|
1015
1050
|
}
|
|
1016
1051
|
}, {
|
|
1017
1052
|
key: "setDimensionsToElement",
|
|
@@ -1022,14 +1057,14 @@ var Recorder = /*#__PURE__*/function (_LitElement) {
|
|
|
1022
1057
|
}, {
|
|
1023
1058
|
key: "adjustContainerSize",
|
|
1024
1059
|
value: function adjustContainerSize() {
|
|
1025
|
-
var _this$
|
|
1026
|
-
var cvs = (_this$
|
|
1027
|
-
var video = (_this$
|
|
1028
|
-
var container = (_this$
|
|
1029
|
-
var wrapper = (_this$
|
|
1030
|
-
var hints = (_this$
|
|
1031
|
-
var instructions = (_this$
|
|
1032
|
-
var flipIconContainer = (_this$
|
|
1060
|
+
var _this$shadowRoot0, _this$shadowRoot1, _this$shadowRoot10, _this$shadowRoot11, _this$shadowRoot12, _this$shadowRoot13, _this$shadowRoot14;
|
|
1061
|
+
var cvs = (_this$shadowRoot0 = this.shadowRoot) === null || _this$shadowRoot0 === void 0 ? void 0 : _this$shadowRoot0.getElementById("cvs");
|
|
1062
|
+
var video = (_this$shadowRoot1 = this.shadowRoot) === null || _this$shadowRoot1 === void 0 ? void 0 : _this$shadowRoot1.getElementById("vid");
|
|
1063
|
+
var container = (_this$shadowRoot10 = this.shadowRoot) === null || _this$shadowRoot10 === void 0 ? void 0 : _this$shadowRoot10.querySelector("#container");
|
|
1064
|
+
var wrapper = (_this$shadowRoot11 = this.shadowRoot) === null || _this$shadowRoot11 === void 0 ? void 0 : _this$shadowRoot11.querySelector("#wrapper");
|
|
1065
|
+
var hints = (_this$shadowRoot12 = this.shadowRoot) === null || _this$shadowRoot12 === void 0 ? void 0 : _this$shadowRoot12.querySelector(".hints");
|
|
1066
|
+
var instructions = (_this$shadowRoot13 = this.shadowRoot) === null || _this$shadowRoot13 === void 0 ? void 0 : _this$shadowRoot13.querySelector(".instructions");
|
|
1067
|
+
var flipIconContainer = (_this$shadowRoot14 = this.shadowRoot) === null || _this$shadowRoot14 === void 0 ? void 0 : _this$shadowRoot14.querySelector("#flip-icon-container");
|
|
1033
1068
|
|
|
1034
1069
|
// Width of the HTML element that contains the recorder
|
|
1035
1070
|
var boxWidth = container.offsetWidth;
|
|
@@ -1058,38 +1093,37 @@ var Recorder = /*#__PURE__*/function (_LitElement) {
|
|
|
1058
1093
|
}, {
|
|
1059
1094
|
key: "displaySpinner",
|
|
1060
1095
|
value: function displaySpinner() {
|
|
1061
|
-
var _this$
|
|
1062
|
-
var spinner = (_this$
|
|
1096
|
+
var _this$shadowRoot15;
|
|
1097
|
+
var spinner = (_this$shadowRoot15 = this.shadowRoot) === null || _this$shadowRoot15 === void 0 ? void 0 : _this$shadowRoot15.querySelector("#spinner");
|
|
1063
1098
|
spinner.style.display = "flex";
|
|
1064
1099
|
spinner.style.height = "100%";
|
|
1065
1100
|
}
|
|
1066
1101
|
}, {
|
|
1067
1102
|
key: "hideSpinner",
|
|
1068
1103
|
value: function hideSpinner() {
|
|
1069
|
-
var _this$
|
|
1070
|
-
var spinner = (_this$
|
|
1104
|
+
var _this$shadowRoot16;
|
|
1105
|
+
var spinner = (_this$shadowRoot16 = this.shadowRoot) === null || _this$shadowRoot16 === void 0 ? void 0 : _this$shadowRoot16.querySelector("#spinner");
|
|
1071
1106
|
spinner.style.display = "none";
|
|
1072
1107
|
}
|
|
1073
1108
|
}, {
|
|
1074
1109
|
key: "displayError",
|
|
1075
1110
|
value: function () {
|
|
1076
|
-
var _displayError = _asyncToGenerator(
|
|
1077
|
-
var _this$
|
|
1111
|
+
var _displayError = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(message) {
|
|
1112
|
+
var _this$shadowRoot17;
|
|
1078
1113
|
var errors;
|
|
1079
|
-
return
|
|
1080
|
-
while (1) switch (
|
|
1114
|
+
return _regenerator().w(function (_context9) {
|
|
1115
|
+
while (1) switch (_context9.n) {
|
|
1081
1116
|
case 0:
|
|
1082
1117
|
this.error = message !== null && message !== void 0 ? message : "Error";
|
|
1083
|
-
errors = (_this$
|
|
1118
|
+
errors = (_this$shadowRoot17 = this.shadowRoot) === null || _this$shadowRoot17 === void 0 ? void 0 : _this$shadowRoot17.querySelector("#errors");
|
|
1084
1119
|
errors.style.display = "flex";
|
|
1085
1120
|
errors.style.height = "100%";
|
|
1086
|
-
case
|
|
1087
|
-
|
|
1088
|
-
return _context7.stop();
|
|
1121
|
+
case 1:
|
|
1122
|
+
return _context9.a(2);
|
|
1089
1123
|
}
|
|
1090
|
-
},
|
|
1124
|
+
}, _callee9, this);
|
|
1091
1125
|
}));
|
|
1092
|
-
function displayError(
|
|
1126
|
+
function displayError(_x6) {
|
|
1093
1127
|
return _displayError.apply(this, arguments);
|
|
1094
1128
|
}
|
|
1095
1129
|
return displayError;
|
|
@@ -1097,8 +1131,8 @@ var Recorder = /*#__PURE__*/function (_LitElement) {
|
|
|
1097
1131
|
}, {
|
|
1098
1132
|
key: "hideError",
|
|
1099
1133
|
value: function hideError() {
|
|
1100
|
-
var _this$
|
|
1101
|
-
var errors = (_this$
|
|
1134
|
+
var _this$shadowRoot18;
|
|
1135
|
+
var errors = (_this$shadowRoot18 = this.shadowRoot) === null || _this$shadowRoot18 === void 0 ? void 0 : _this$shadowRoot18.querySelector("#errors");
|
|
1102
1136
|
errors.style.display = "none";
|
|
1103
1137
|
this.error = "";
|
|
1104
1138
|
}
|
|
@@ -1106,9 +1140,9 @@ var Recorder = /*#__PURE__*/function (_LitElement) {
|
|
|
1106
1140
|
key: "render",
|
|
1107
1141
|
value: function render() {
|
|
1108
1142
|
// not necessary : this.strings = { ...this.defaultStrings, ...this.strings };
|
|
1109
|
-
return x$2(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n <div class=\"container\" id=\"container\">\n <div class=\"wrapper\" id=\"wrapper\">\n <canvas id=\"cvs\" class=\"canvas\"></canvas>\n <video id=\"vid\" class=\"video\" autoplay muted playsinline></video>\n\n <div
|
|
1143
|
+
return x$2(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n <div class=\"container\" id=\"container\">\n <div id=\"top-hints\" class=\"top-hints\">\n <slot name=\"ac-top-hints\"></slot>\n </div>\n <div class=\"wrapper\" id=\"wrapper\">\n <canvas id=\"cvs\" class=\"canvas\"></canvas>\n <video id=\"vid\" class=\"video\" autoplay muted playsinline></video>\n\n <div id=\"face-hints\" class=\"face-hints\">\n <slot name=\"ac-face-hints\"></slot>\n </div>\n\n ", "\n\n <uni-overlay-hints\n class=\"hints\"\n hints=\"", "\"\n strings=\"", "\"\n ></uni-overlay-hints>\n\n <div id=\"spinner\" class=\"spinner item-center\" style=\"display: none\">\n <uni-spinner></uni-spinner>\n </div>\n <div class=\"errors\" id=\"errors\">\n <span class=\"message\">", "</span>\n </div>\n </div>\n <div id=\"bottom-hints\" class=\"bottom-hints\">\n <slot name=\"ac-bottom-hints\"></slot>\n <div class=\"ac-bottom-hints\">", "</div>\n </div>\n <div class=\"buttons\" id=\"buttons\">\n <div class=\"buttons-item\">\n <slot name=\"left\"></slot>\n </div>\n\n <div class=\"buttons-item\">\n <!-- Display record/retry button -->\n ", "\n </div>\n </div>\n </div>\n "])), isMobileDevice() && (
|
|
1110
1144
|
// eslint-disable-next-line no-extra-boolean-cast
|
|
1111
|
-
!!this.displayFlipCameraBtn ? this.displayFlipCameraBtn : this.preset === buildPacked.exports.AcquisitionPreset.DOC_VIDEO || this.preset === buildPacked.exports.AcquisitionPreset.DOC_IMAGE) && !this.isRunning() ? x$2(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral([" <div id=\"flip-icon-container\" class=\"flip-icon-container\">\n <uni-flip-camera-icon @click=\"", "\" class=\"flip-icon\"> </uni-flip-camera-icon>\n </div>"])), this.flipCamera) : x$2(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral([""]))), this.hints, JSON.stringify(this.getString(["hints"])), this.
|
|
1145
|
+
!!this.displayFlipCameraBtn ? this.displayFlipCameraBtn : this.preset === buildPacked.exports.AcquisitionPreset.DOC_VIDEO || this.preset === buildPacked.exports.AcquisitionPreset.DOC_IMAGE) && !this.isRunning() ? x$2(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral([" <div id=\"flip-icon-container\" class=\"flip-icon-container\">\n <uni-flip-camera-icon @click=\"", "\" class=\"flip-icon\"> </uni-flip-camera-icon>\n </div>"])), this.flipCamera) : x$2(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral([""]))), this.hints, JSON.stringify(this.getString(["hints"])), this.error, this.getString(["hints", this.hints]), !this.hideCaptureBtn || this.willRetryCapture ? x$2(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["<uni-button id=\"capture\" @click=\"", "\">\n <div slot=\"icon\">", "</div>\n ", "\n </uni-button>"])), this.capture, this.captureButtonPicto, this.willRetryCapture ? this.getString(["retry"]) : this.getString(["capture"])) : x$2(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral([""]))));
|
|
1112
1146
|
}
|
|
1113
1147
|
}]);
|
|
1114
1148
|
}(s$1);
|
|
@@ -1170,15 +1204,6 @@ Recorder.properties = {
|
|
|
1170
1204
|
instructions: {
|
|
1171
1205
|
state: true
|
|
1172
1206
|
},
|
|
1173
|
-
instructionMessage: {
|
|
1174
|
-
state: true
|
|
1175
|
-
},
|
|
1176
|
-
instructionTimer: {
|
|
1177
|
-
state: true
|
|
1178
|
-
},
|
|
1179
|
-
actionToDisplay: {
|
|
1180
|
-
state: true
|
|
1181
|
-
},
|
|
1182
1207
|
isActionSuccessful: {
|
|
1183
1208
|
state: true
|
|
1184
1209
|
}
|