@smileid/web-components 11.0.3 → 11.1.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/README.md +61 -0
- package/dist/components/smart-camera-web/src/README.md +0 -1
- package/dist/esm/{DocumentCaptureScreens-C5BhNB-0.js → DocumentCaptureScreens-DHAfE8VG.js} +191 -185
- package/dist/esm/DocumentCaptureScreens-DHAfE8VG.js.map +1 -0
- package/dist/esm/{EndUserConsent-D4fd1ovG.js → EndUserConsent-DE6OBSGG.js} +65 -63
- package/dist/esm/EndUserConsent-DE6OBSGG.js.map +1 -0
- package/dist/esm/{Navigation-CTjK6tLU.js → Navigation-kjll5SgE.js} +17 -9
- package/dist/esm/Navigation-kjll5SgE.js.map +1 -0
- package/dist/esm/{SelfieCaptureScreens-KoQpCxtc.js → SelfieCaptureScreens-DaREKFi4.js} +3087 -3159
- package/dist/esm/SelfieCaptureScreens-DaREKFi4.js.map +1 -0
- package/dist/esm/{TotpConsent-CQU5jQi4.js → TotpConsent-DsMJhXD8.js} +13 -9
- package/dist/esm/TotpConsent-DsMJhXD8.js.map +1 -0
- package/dist/esm/combobox.js +20 -19
- package/dist/esm/combobox.js.map +1 -1
- package/dist/esm/document.js +1 -1
- package/dist/esm/end-user-consent.js +1 -1
- package/dist/esm/index-LJce6hoU.js +1360 -0
- package/dist/esm/index-LJce6hoU.js.map +1 -0
- package/dist/esm/localisation.js +21 -0
- package/dist/esm/localisation.js.map +1 -0
- package/dist/esm/main.js +34 -17
- package/dist/esm/main.js.map +1 -1
- package/dist/esm/navigation.js +1 -1
- package/dist/esm/{package-B-UwEdv7.js → package-BoRHLVSv.js} +25 -40
- package/dist/esm/package-BoRHLVSv.js.map +1 -0
- package/dist/esm/selfie.js +1 -1
- package/dist/esm/smart-camera-web.js +22 -18
- package/dist/esm/smart-camera-web.js.map +1 -1
- package/dist/esm/totp-consent.js +1 -1
- package/dist/smart-camera-web.js +136 -152
- package/dist/smart-camera-web.js.map +1 -1
- package/dist/src/components/combobox/src/index.js +424 -1
- package/dist/src/components/document/src/index.js +1422 -1
- package/dist/src/components/end-user-consent/src/index.js +1573 -1
- package/dist/src/components/selfie/src/index.js +1220 -1
- package/dist/src/components/signature-pad/src/index.js +787 -1
- package/dist/src/components/smart-camera-web/src/SmartCameraWeb.js +2753 -1
- package/dist/src/components/totp-consent/src/index.js +1292 -1
- package/dist/types/combobox.d.ts +2 -2
- package/dist/types/document.d.ts +2 -2
- package/dist/types/end-user-consent.d.ts +2 -2
- package/dist/types/locale.d.ts +19 -0
- package/dist/types/localisation.d.ts +21 -0
- package/dist/types/main.d.ts +35 -26
- package/dist/types/navigation.d.ts +2 -2
- package/dist/types/selfie.d.ts +2 -2
- package/dist/types/signature-pad.d.ts +2 -2
- package/dist/types/smart-camera-web.d.ts +2 -2
- package/dist/types/totp-consent.d.ts +2 -2
- package/lib/components/camera-permission/CameraPermission.js +8 -3
- package/lib/components/combobox/src/Combobox.js +4 -2
- package/lib/components/document/src/DocumentCaptureScreens.js +4 -3
- package/lib/components/document/src/DocumentCaptureScreens.stories.js +37 -13
- package/lib/components/document/src/document-capture/DocumentCapture.js +20 -14
- package/lib/components/document/src/document-capture/DocumentCapture.stories.js +11 -2
- package/lib/components/document/src/document-capture-instructions/DocumentCaptureInstructions.js +16 -11
- package/lib/components/document/src/document-capture-instructions/DocumentCaptureInstructions.stories.js +14 -5
- package/lib/components/document/src/document-capture-review/DocumentCaptureReview.js +11 -7
- package/lib/components/document/src/document-capture-review/DocumentCaptureReview.stories.js +14 -5
- package/lib/components/end-user-consent/src/EndUserConsent.js +30 -29
- package/lib/components/end-user-consent/src/EndUserConsent.stories.js +12 -2
- package/lib/components/navigation/src/Navigation.js +15 -2
- package/lib/components/navigation/src/Navigation.stories.js +20 -4
- package/lib/components/selfie/src/SelfieCaptureScreens.js +3 -7
- package/lib/components/selfie/src/SelfieCaptureScreens.stories.js +16 -4
- package/lib/components/selfie/src/selfie-capture/SelfieCapture.js +23 -16
- package/lib/components/selfie/src/selfie-capture/SelfieCapture.stories.js +19 -7
- package/lib/components/selfie/src/selfie-capture-instructions/SelfieCaptureInstructions.js +16 -11
- package/lib/components/selfie/src/selfie-capture-instructions/SelfieCaptureInstructions.stories.js +14 -5
- package/lib/components/selfie/src/selfie-capture-review/SelfieCaptureReview.js +10 -5
- package/lib/components/selfie/src/selfie-capture-review/SelfieCaptureReview.stories.js +14 -5
- package/lib/components/selfie/src/selfie-capture-wrapper/SelfieCaptureWrapper.tsx +2 -2
- package/lib/components/selfie/src/smartselfie-capture/SmartSelfieCapture.stories.js +47 -0
- package/lib/components/selfie/src/smartselfie-capture/SmartSelfieCapture.tsx +2 -2
- package/lib/components/selfie/src/smartselfie-capture/components/CaptureControls.tsx +5 -2
- package/lib/components/selfie/src/smartselfie-capture/hooks/useCamera.ts +4 -4
- package/lib/components/selfie/src/smartselfie-capture/hooks/useFaceCapture.ts +6 -5
- package/lib/components/selfie/src/smartselfie-capture/utils/alertMessages.ts +11 -9
- package/lib/components/selfie/src/smartselfie-capture/utils/imageCapture.ts +3 -1
- package/lib/components/signature-pad/package.json +1 -1
- package/lib/components/totp-consent/src/TotpConsent.js +8 -3
- package/lib/domain/camera/src/SmartCamera.js +7 -22
- package/lib/domain/constants/src/Constants.js +28 -0
- package/lib/domain/file-upload/src/SmartFileUpload.js +9 -10
- package/lib/domain/localisation/index.js +456 -0
- package/package.json +12 -6
- package/dist/esm/DocumentCaptureScreens-C5BhNB-0.js.map +0 -1
- package/dist/esm/EndUserConsent-D4fd1ovG.js.map +0 -1
- package/dist/esm/Navigation-CTjK6tLU.js.map +0 -1
- package/dist/esm/SelfieCaptureScreens-KoQpCxtc.js.map +0 -1
- package/dist/esm/TotpConsent-CQU5jQi4.js.map +0 -1
- package/dist/esm/package-B-UwEdv7.js.map +0 -1
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { S as
|
|
2
|
-
import { s as
|
|
3
|
-
import "./
|
|
4
|
-
|
|
1
|
+
import { S as h, J as C, p as L, I as b } from "./package-BoRHLVSv.js";
|
|
2
|
+
import { s as y } from "./styles-BOEZtbuc.js";
|
|
3
|
+
import { k as x, t as s, c as S, e as $ } from "./index-LJce6hoU.js";
|
|
4
|
+
import "./Navigation-kjll5SgE.js";
|
|
5
|
+
function D(u, e = 16) {
|
|
5
6
|
const t = /* @__PURE__ */ new Set();
|
|
6
|
-
for (let i = 0; i < Math.min(
|
|
7
|
-
if (t.add(
|
|
7
|
+
for (let i = 0; i < Math.min(u.length, 1e4); i += 4)
|
|
8
|
+
if (t.add(u[i] << 16 | u[i + 1] << 8 | u[i + 2]), t.size > e)
|
|
8
9
|
return !0;
|
|
9
10
|
return !1;
|
|
10
11
|
}
|
|
11
|
-
function
|
|
12
|
+
function F() {
|
|
12
13
|
return `
|
|
13
14
|
<style>
|
|
14
15
|
.visually-hidden {
|
|
@@ -41,7 +42,7 @@ function H() {
|
|
|
41
42
|
overflow: visible;
|
|
42
43
|
margin: 0 auto;
|
|
43
44
|
}
|
|
44
|
-
|
|
45
|
+
|
|
45
46
|
@media (max-width: 600px) {
|
|
46
47
|
.section {
|
|
47
48
|
width: 99%;
|
|
@@ -74,7 +75,7 @@ function H() {
|
|
|
74
75
|
-webkit-tap-highlight-color: transparent;
|
|
75
76
|
content: normal;
|
|
76
77
|
}
|
|
77
|
-
|
|
78
|
+
|
|
78
79
|
.id-video {
|
|
79
80
|
width: 99%;
|
|
80
81
|
text-align: center;
|
|
@@ -105,7 +106,7 @@ function H() {
|
|
|
105
106
|
box-sizing: border-box;
|
|
106
107
|
inset: 0px;
|
|
107
108
|
}
|
|
108
|
-
|
|
109
|
+
|
|
109
110
|
.video-overlay .inner-border {
|
|
110
111
|
position: absolute;
|
|
111
112
|
border-width: 0.25rem;
|
|
@@ -121,7 +122,7 @@ function H() {
|
|
|
121
122
|
border-style: solid;
|
|
122
123
|
border-radius: 0.25rem;
|
|
123
124
|
}
|
|
124
|
-
|
|
125
|
+
|
|
125
126
|
.description {
|
|
126
127
|
align-self: center;
|
|
127
128
|
padding-bottom: 1.75rem;
|
|
@@ -135,7 +136,7 @@ function H() {
|
|
|
135
136
|
.id-side {
|
|
136
137
|
padding-bottom: 0.5rem;
|
|
137
138
|
}
|
|
138
|
-
|
|
139
|
+
|
|
139
140
|
.circle-progress {
|
|
140
141
|
display: flex;
|
|
141
142
|
flex-direction: column;
|
|
@@ -154,13 +155,13 @@ function H() {
|
|
|
154
155
|
padding-top: 10px;
|
|
155
156
|
}
|
|
156
157
|
</style>
|
|
157
|
-
${
|
|
158
|
-
<div id='document-capture-screen' class='flow center flex-column'>
|
|
158
|
+
${y(this.themeColor)}
|
|
159
|
+
<div id='document-capture-screen' class='flow center flex-column' dir='${this.direction}'>
|
|
159
160
|
<smileid-navigation theme-color='${this.themeColor}' ${this.showNavigation ? "show-navigation" : ""} ${this.hideBack ? "hide-back" : ""}></smileid-navigation>
|
|
160
161
|
<h2 class='text-base font-bold title-color'>${this.documentName}</h2>
|
|
161
162
|
<div class="circle-progress" id="loader">
|
|
162
163
|
${this.cameraError ? "" : '<p class="spinner"></p>'}
|
|
163
|
-
${this.cameraError ? `<p style="--flow-space: 4rem" class='color-red | center'>${this.cameraError}</p>` :
|
|
164
|
+
${this.cameraError ? `<p style="--flow-space: 4rem" class='color-red | center'>${this.cameraError}</p>` : `<p style="--flow-space: 4rem">${s("document.capture.checkingPermissions")}</p>`}
|
|
164
165
|
</div>
|
|
165
166
|
<div class='section | flow ${this.isPortraitCaptureView ? "portrait" : "landscape"}' ${this.cameraError ? "hidden" : ""}>
|
|
166
167
|
<div class='id-video-container'>
|
|
@@ -168,13 +169,13 @@ function H() {
|
|
|
168
169
|
</div>
|
|
169
170
|
<div class='video-footer sticky'>
|
|
170
171
|
<h2 class='text-base font-bold title-color reset-margin-block id-side'>${this.title}</h2>
|
|
171
|
-
<h4 class='text-base font-normal title-color description reset-margin-block'
|
|
172
|
+
<h4 class='text-base font-normal title-color description reset-margin-block'>${s("document.capture.instructionText")}</h4>
|
|
172
173
|
<div class='actions' hidden>
|
|
173
174
|
<button id='capture-id-image' class='button icon-btn | center' type='button'>
|
|
174
175
|
<svg xmlns="http://www.w3.org/2000/svg" width="70" height="70" viewBox="0 0 70 70" fill="none" aria-hidden="true" focusable="false">
|
|
175
176
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M35 70C54.33 70 70 54.33 70 35C70 15.67 54.33 0 35 0C15.67 0 0 15.67 0 35C0 54.33 15.67 70 35 70ZM61 35C61 49.3594 49.3594 61 35 61C20.6406 61 9 49.3594 9 35C9 20.6406 20.6406 9 35 9C49.3594 9 61 20.6406 61 35ZM65 35C65 51.5685 51.5685 65 35 65C18.4315 65 5 51.5685 5 35C5 18.4315 18.4315 5 35 5C51.5685 5 65 18.4315 65 35Z" fill="${this.themeColor}"/>
|
|
176
177
|
</svg>
|
|
177
|
-
<span class='visually-hidden'
|
|
178
|
+
<span class='visually-hidden'>${s("document.capture.captureButton")}</span>
|
|
178
179
|
</button>
|
|
179
180
|
</div>
|
|
180
181
|
${this.hideAttribution ? "" : "<powered-by-smile-id></powered-by-smile-id>"}
|
|
@@ -184,10 +185,10 @@ function H() {
|
|
|
184
185
|
</div>
|
|
185
186
|
`;
|
|
186
187
|
}
|
|
187
|
-
const
|
|
188
|
-
class
|
|
188
|
+
const w = 0.6;
|
|
189
|
+
class V extends HTMLElement {
|
|
189
190
|
constructor() {
|
|
190
|
-
super(), this.templateString =
|
|
191
|
+
super(), this.templateString = F.bind(this), this.render = () => this.templateString(), this.attachShadow({ mode: "open" }), this.IdSides = {
|
|
191
192
|
back: "Back",
|
|
192
193
|
front: "Front"
|
|
193
194
|
};
|
|
@@ -197,19 +198,19 @@ class L extends HTMLElement {
|
|
|
197
198
|
e.innerHTML = this.render(), this.shadowRoot.innerHTML = "", this.shadowRoot.appendChild(e.content.cloneNode(!0)), this.setUpEventListeners();
|
|
198
199
|
}
|
|
199
200
|
async getUserMedia() {
|
|
200
|
-
if (!
|
|
201
|
+
if (!h.stream && this.hasAttribute("data-camera-error")) {
|
|
201
202
|
try {
|
|
202
|
-
await
|
|
203
|
+
await h.getMedia({
|
|
203
204
|
audio: !1,
|
|
204
205
|
video: {
|
|
205
|
-
...
|
|
206
|
+
...h.environmentOptions,
|
|
206
207
|
aspectRatio: { ideal: 16 / 9 }
|
|
207
208
|
}
|
|
208
209
|
});
|
|
209
210
|
} catch (e) {
|
|
210
211
|
console.error(e.constraint), console.error(e.message);
|
|
211
212
|
}
|
|
212
|
-
this.handleIDStream(
|
|
213
|
+
this.handleIDStream(h.stream);
|
|
213
214
|
}
|
|
214
215
|
}
|
|
215
216
|
_captureIDImage() {
|
|
@@ -226,14 +227,14 @@ class L extends HTMLElement {
|
|
|
226
227
|
const t = document.createElement("canvas");
|
|
227
228
|
if (this.isPortraitCaptureView) {
|
|
228
229
|
t.width = e.videoWidth, t.height = t.width * 16 / 9;
|
|
229
|
-
const
|
|
230
|
-
|
|
231
|
-
const
|
|
230
|
+
const n = document.createElement("canvas");
|
|
231
|
+
n.width = t.width, n.height = t.height, this.updatePortraitId(t, e, 1, 1), this.updatePortraitId(n, e);
|
|
232
|
+
const d = t.toDataURL("image/jpeg", C), l = n.toDataURL("image/jpeg", C);
|
|
232
233
|
return {
|
|
233
|
-
image:
|
|
234
|
+
image: d,
|
|
234
235
|
originalHeight: t.height,
|
|
235
236
|
originalWidth: t.width,
|
|
236
|
-
previewImage:
|
|
237
|
+
previewImage: l,
|
|
237
238
|
...this.idCardRegion
|
|
238
239
|
};
|
|
239
240
|
}
|
|
@@ -242,20 +243,20 @@ class L extends HTMLElement {
|
|
|
242
243
|
t.height = i;
|
|
243
244
|
const o = document.createElement("canvas");
|
|
244
245
|
if (o.height = t.height, o.width = t.width, e.videoWidth < e.videoHeight) {
|
|
245
|
-
const
|
|
246
|
-
o.height = t.width / 1.75, t.width = 2240, t.height = t.width / 1.77, this._capturePortraitToLandscapeImage(
|
|
246
|
+
const n = document.createElement("canvas");
|
|
247
|
+
o.height = t.width / 1.75, t.width = 2240, t.height = t.width / 1.77, this._capturePortraitToLandscapeImage(n, e), this._drawLandscapeImageFromCanvas(t, n, 1, 1), this._drawLandscapeImageFromCanvas(o, n);
|
|
247
248
|
} else
|
|
248
249
|
this._drawLandscapeImage(t, e, 1, 1), this._drawLandscapeImage(o, e);
|
|
249
|
-
const
|
|
250
|
+
const a = t.toDataURL("image/jpeg", C), c = o.toDataURL("image/jpeg", C);
|
|
250
251
|
return {
|
|
251
|
-
image:
|
|
252
|
+
image: a,
|
|
252
253
|
originalHeight: t.height,
|
|
253
254
|
originalWidth: t.width,
|
|
254
|
-
previewImage:
|
|
255
|
+
previewImage: c,
|
|
255
256
|
...this.idCardRegion
|
|
256
257
|
};
|
|
257
258
|
}
|
|
258
|
-
_drawImage(e, t = !0, i =
|
|
259
|
+
_drawImage(e, t = !0, i = h.stream) {
|
|
259
260
|
this.resetErrorMessage();
|
|
260
261
|
const o = e.getContext("2d");
|
|
261
262
|
if (o.drawImage(
|
|
@@ -269,8 +270,8 @@ class L extends HTMLElement {
|
|
|
269
270
|
e.width,
|
|
270
271
|
e.height
|
|
271
272
|
), t) {
|
|
272
|
-
const
|
|
273
|
-
if (
|
|
273
|
+
const r = o.getImageData(0, 0, e.width, e.height);
|
|
274
|
+
if (D(r.data))
|
|
274
275
|
return o;
|
|
275
276
|
throw new Error(
|
|
276
277
|
"Unable to capture webcam images - Please try another device"
|
|
@@ -284,44 +285,44 @@ class L extends HTMLElement {
|
|
|
284
285
|
t && t.remove();
|
|
285
286
|
let i = null, o = null;
|
|
286
287
|
i = document.createElement("video"), o = document.createElement("canvas");
|
|
287
|
-
const
|
|
288
|
+
const r = this.shadowRoot.querySelector(
|
|
288
289
|
".id-video-container"
|
|
289
290
|
);
|
|
290
|
-
i.muted = !0, i.setAttribute("muted", "true"), i.autoplay = !0, i.playsInline = !0, "srcObject" in i ? i.srcObject = e : i.src = window.URL.createObjectURL(e), o.width =
|
|
291
|
-
i.play(), this.shadowRoot.querySelector("#loader").hidden = !0, this.shadowRoot.querySelector(".id-video").hidden = !1, this.shadowRoot.querySelector(".actions").hidden = !1, t ||
|
|
291
|
+
i.muted = !0, i.setAttribute("muted", "true"), i.autoplay = !0, i.playsInline = !0, "srcObject" in i ? i.srcObject = e : i.src = window.URL.createObjectURL(e), o.width = r.clientWidth, o.height = r.clientWidth * 9 / 16, this.isPortraitCaptureView && (o.height = r.clientWidth * 16 / 9), i.onloadedmetadata = () => {
|
|
292
|
+
i.play(), this.shadowRoot.querySelector("#loader").hidden = !0, this.shadowRoot.querySelector(".id-video").hidden = !1, this.shadowRoot.querySelector(".actions").hidden = !1, t || r.prepend(o);
|
|
292
293
|
};
|
|
293
|
-
const
|
|
294
|
+
const a = () => {
|
|
294
295
|
if (i.paused || i.ended) return;
|
|
295
|
-
i.removeEventListener("playing",
|
|
296
|
-
const
|
|
296
|
+
i.removeEventListener("playing", a);
|
|
297
|
+
const n = i.videoWidth / i.videoHeight < 1;
|
|
297
298
|
if (this.isPortraitCaptureView) {
|
|
298
|
-
this.updatePortraitId(o, i), requestAnimationFrame(
|
|
299
|
+
this.updatePortraitId(o, i), requestAnimationFrame(a);
|
|
299
300
|
return;
|
|
300
301
|
}
|
|
301
|
-
if (
|
|
302
|
-
|
|
303
|
-
const
|
|
304
|
-
this._capturePortraitToLandscapeImage(
|
|
302
|
+
if (n) {
|
|
303
|
+
r.classList.add("mobile-camera-screen");
|
|
304
|
+
const d = document.createElement("canvas");
|
|
305
|
+
this._capturePortraitToLandscapeImage(d, i), this._drawLandscapeImageFromCanvas(o, d);
|
|
305
306
|
} else
|
|
306
307
|
this._drawLandscapeImage(o, i);
|
|
307
|
-
requestAnimationFrame(
|
|
308
|
+
requestAnimationFrame(a);
|
|
308
309
|
};
|
|
309
|
-
i.addEventListener("playing",
|
|
310
|
+
i.addEventListener("playing", a), this._IDStream = e, this._IDVideo = i;
|
|
310
311
|
} catch (t) {
|
|
311
312
|
this.setAttribute(
|
|
312
313
|
"data-camera-error",
|
|
313
|
-
|
|
314
|
-
), t.name !== "AbortError" && console.error(t),
|
|
314
|
+
h.handleCameraError(t)
|
|
315
|
+
), t.name !== "AbortError" && console.error(t), h.stopMedia();
|
|
315
316
|
}
|
|
316
317
|
}
|
|
317
|
-
_drawLandscapeImage(e, t = this._IDVideo, i =
|
|
318
|
-
const
|
|
318
|
+
_drawLandscapeImage(e, t = this._IDVideo, i = w, o = w) {
|
|
319
|
+
const r = this.height ? this.height / t.videoHeight : i, a = this.width ? this.width / t.videoWidth : o, c = (1 - i) / 2, n = (1 - o) / 2, d = t.videoWidth * a, l = t.videoHeight * r, g = t.videoWidth * n, f = t.videoHeight * c;
|
|
319
320
|
e.getContext("2d").drawImage(
|
|
320
321
|
t,
|
|
321
|
-
m,
|
|
322
322
|
g,
|
|
323
|
-
|
|
324
|
-
|
|
323
|
+
f,
|
|
324
|
+
d,
|
|
325
|
+
l,
|
|
325
326
|
0,
|
|
326
327
|
0,
|
|
327
328
|
e.width,
|
|
@@ -329,27 +330,27 @@ class L extends HTMLElement {
|
|
|
329
330
|
);
|
|
330
331
|
}
|
|
331
332
|
_capturePortraitToLandscapeImage(e, t = this._IDVideo) {
|
|
332
|
-
const { videoHeight: i, videoWidth: o } = t,
|
|
333
|
-
e.width =
|
|
333
|
+
const { videoHeight: i, videoWidth: o } = t, r = o, a = o * 9 / 16, c = 0, n = (i - a) / 2;
|
|
334
|
+
e.width = r, e.height = a, e.getContext("2d").drawImage(
|
|
334
335
|
t,
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
a,
|
|
336
|
+
c,
|
|
337
|
+
n,
|
|
338
338
|
r,
|
|
339
|
+
a,
|
|
339
340
|
0,
|
|
340
341
|
0,
|
|
341
342
|
e.width,
|
|
342
343
|
e.height
|
|
343
344
|
);
|
|
344
345
|
}
|
|
345
|
-
_drawLandscapeImageFromCanvas(e, t, i =
|
|
346
|
-
const
|
|
346
|
+
_drawLandscapeImageFromCanvas(e, t, i = w, o = w) {
|
|
347
|
+
const r = this.height ? this.height / t.height : i, a = this.width ? this.width / t.width : o, c = (1 - i) / 2, n = (1 - o) / 2, d = t.width * a, l = t.height * r, g = t.width * n, f = t.height * c;
|
|
347
348
|
e.getContext("2d").drawImage(
|
|
348
349
|
t,
|
|
349
|
-
m,
|
|
350
350
|
g,
|
|
351
|
-
|
|
352
|
-
|
|
351
|
+
f,
|
|
352
|
+
d,
|
|
353
|
+
l,
|
|
353
354
|
0,
|
|
354
355
|
0,
|
|
355
356
|
e.width,
|
|
@@ -357,44 +358,44 @@ class L extends HTMLElement {
|
|
|
357
358
|
);
|
|
358
359
|
}
|
|
359
360
|
_drawPortraitToLandscapeImage(e, t = this._IDVideo) {
|
|
360
|
-
const { videoHeight: i, videoWidth: o } = t,
|
|
361
|
-
e.width =
|
|
362
|
-
const
|
|
361
|
+
const { videoHeight: i, videoWidth: o } = t, r = 600, a = 400;
|
|
362
|
+
e.width = r, e.height = a;
|
|
363
|
+
const c = (o - r) / 2, n = (i - a) / 2;
|
|
363
364
|
e.getContext("2d").drawImage(
|
|
364
365
|
t,
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
a,
|
|
366
|
+
c,
|
|
367
|
+
n,
|
|
368
368
|
r,
|
|
369
|
+
a,
|
|
369
370
|
0,
|
|
370
371
|
0,
|
|
371
372
|
e.width,
|
|
372
373
|
e.height
|
|
373
374
|
);
|
|
374
375
|
}
|
|
375
|
-
updatePortraitId(e, t = this._IDVideo, i =
|
|
376
|
-
const { videoWidth:
|
|
377
|
-
if (
|
|
378
|
-
const
|
|
379
|
-
let
|
|
380
|
-
|
|
376
|
+
updatePortraitId(e, t = this._IDVideo, i = w, o = w) {
|
|
377
|
+
const { videoWidth: r, videoHeight: a } = t;
|
|
378
|
+
if (r && a) {
|
|
379
|
+
const c = document.createElement("canvas"), n = 9 / 16;
|
|
380
|
+
let d, l, g, f;
|
|
381
|
+
r / a > n ? (l = a, d = l * n, g = (r - d) / 2, f = 0) : (d = r, l = d, g = 0, f = 0), c.height = l, c.width = d, c.getContext("2d").drawImage(
|
|
381
382
|
t,
|
|
382
|
-
m,
|
|
383
383
|
g,
|
|
384
|
-
|
|
385
|
-
|
|
384
|
+
f,
|
|
385
|
+
d,
|
|
386
|
+
l,
|
|
386
387
|
0,
|
|
387
388
|
0,
|
|
388
|
-
|
|
389
|
-
|
|
389
|
+
c.width,
|
|
390
|
+
c.height
|
|
390
391
|
);
|
|
391
|
-
const
|
|
392
|
+
const E = this.height ? this.height / d : i, k = this.width ? this.width / l : o, _ = (1 - i) / 2, B = (1 - o) / 2, A = d * k, I = l * E, M = d * B, H = l * _;
|
|
392
393
|
e.getContext("2d").drawImage(
|
|
393
|
-
|
|
394
|
+
c,
|
|
395
|
+
M,
|
|
396
|
+
H,
|
|
397
|
+
A,
|
|
394
398
|
I,
|
|
395
|
-
B,
|
|
396
|
-
k,
|
|
397
|
-
_,
|
|
398
399
|
0,
|
|
399
400
|
0,
|
|
400
401
|
e.width,
|
|
@@ -406,7 +407,7 @@ class L extends HTMLElement {
|
|
|
406
407
|
e.getTracks().forEach((t) => t.stop());
|
|
407
408
|
}
|
|
408
409
|
setUpEventListeners() {
|
|
409
|
-
this.captureIDImage = this.shadowRoot.querySelector("#capture-id-image"), this.navigation = this.shadowRoot.querySelector("smileid-navigation"),
|
|
410
|
+
this.captureIDImage = this.shadowRoot.querySelector("#capture-id-image"), this.navigation = this.shadowRoot.querySelector("smileid-navigation"), h.stream && this.handleIDStream(h.stream), this.navigation.addEventListener("navigation.back", () => {
|
|
410
411
|
this.handleBackEvents();
|
|
411
412
|
}), this.navigation.addEventListener("navigation.close", () => {
|
|
412
413
|
this.handleCloseEvents();
|
|
@@ -454,11 +455,14 @@ class L extends HTMLElement {
|
|
|
454
455
|
get isBackOfId() {
|
|
455
456
|
return !this.isFrontOfId;
|
|
456
457
|
}
|
|
458
|
+
get direction() {
|
|
459
|
+
return this.getAttribute("dir") || x() || "ltr";
|
|
460
|
+
}
|
|
457
461
|
get documentType() {
|
|
458
462
|
return this.getAttribute("document-type") || "";
|
|
459
463
|
}
|
|
460
464
|
get documentName() {
|
|
461
|
-
return this.getAttribute("document-name") || "
|
|
465
|
+
return this.getAttribute("document-name") || s("document.name.default");
|
|
462
466
|
}
|
|
463
467
|
get isPortraitCaptureView() {
|
|
464
468
|
return this.getAttribute("document-type") === "GREEN_BOOK";
|
|
@@ -491,14 +495,14 @@ class L extends HTMLElement {
|
|
|
491
495
|
}
|
|
492
496
|
}
|
|
493
497
|
handleBackEvents() {
|
|
494
|
-
this.dispatchEvent(new CustomEvent("document-capture.cancelled")),
|
|
498
|
+
this.dispatchEvent(new CustomEvent("document-capture.cancelled")), h.stopMedia();
|
|
495
499
|
}
|
|
496
500
|
handleCloseEvents() {
|
|
497
|
-
this.dispatchEvent(new CustomEvent("document-capture.close")),
|
|
501
|
+
this.dispatchEvent(new CustomEvent("document-capture.close")), h.stopMedia();
|
|
498
502
|
}
|
|
499
503
|
}
|
|
500
|
-
"customElements" in window && !customElements.get("document-capture") && window.customElements.define("document-capture",
|
|
501
|
-
function
|
|
504
|
+
"customElements" in window && !customElements.get("document-capture") && window.customElements.define("document-capture", V);
|
|
505
|
+
function Z() {
|
|
502
506
|
return `
|
|
503
507
|
<style>
|
|
504
508
|
.retake-photo.button[data-variant~="ghost"] {
|
|
@@ -714,14 +718,13 @@ function S() {
|
|
|
714
718
|
line-height: 1.5rem;
|
|
715
719
|
}
|
|
716
720
|
</style>
|
|
717
|
-
${
|
|
718
|
-
<div id='document-capture-review-screen' class='flow center'>
|
|
721
|
+
${y(this.themeColor)}
|
|
722
|
+
<div id='document-capture-review-screen' class='flow center' dir='${this.direction}'>
|
|
719
723
|
<smileid-navigation ${this.showNavigation ? "show-navigation" : ""} hide-back></smileid-navigation>
|
|
720
724
|
<h1 class="header-title title-color">
|
|
721
|
-
|
|
725
|
+
${s("document.review.question")}
|
|
722
726
|
</h1>
|
|
723
|
-
<p class="description">
|
|
724
|
-
are visible and there is no glare</p>
|
|
727
|
+
<p class="description">${s("document.review.description")}</p>
|
|
725
728
|
<div class='section | flow'>
|
|
726
729
|
<div class='id-image-container'>
|
|
727
730
|
<div class='id-image'>
|
|
@@ -730,10 +733,10 @@ function S() {
|
|
|
730
733
|
</div>
|
|
731
734
|
<div class='flow action-buttons'>
|
|
732
735
|
<button data-variant='solid full-width' class='button' type='button' id='select-id-image'>
|
|
733
|
-
|
|
736
|
+
${s("document.review.acceptButton")}
|
|
734
737
|
</button>
|
|
735
738
|
<button data-variant='ghost full-width' class='button retake-photo' type='button' id='re-capture-id-image'>
|
|
736
|
-
|
|
739
|
+
${s("document.review.retakeButton")}
|
|
737
740
|
</button>
|
|
738
741
|
</div>
|
|
739
742
|
</div>
|
|
@@ -745,9 +748,9 @@ function S() {
|
|
|
745
748
|
</div>
|
|
746
749
|
`;
|
|
747
750
|
}
|
|
748
|
-
class
|
|
751
|
+
class R extends HTMLElement {
|
|
749
752
|
constructor() {
|
|
750
|
-
super(), this.templateString =
|
|
753
|
+
super(), this.templateString = Z.bind(this), this.render = () => this.templateString(), this.attachShadow({ mode: "open" });
|
|
751
754
|
}
|
|
752
755
|
connectedCallback() {
|
|
753
756
|
const e = document.createElement("template");
|
|
@@ -772,7 +775,10 @@ class D extends HTMLElement {
|
|
|
772
775
|
return this.getAttribute("data-image");
|
|
773
776
|
}
|
|
774
777
|
get title() {
|
|
775
|
-
return this.getAttribute("title") || "
|
|
778
|
+
return this.getAttribute("title") || s("document.title.front");
|
|
779
|
+
}
|
|
780
|
+
get direction() {
|
|
781
|
+
return this.getAttribute("dir") || x() || "ltr";
|
|
776
782
|
}
|
|
777
783
|
handleBackEvents() {
|
|
778
784
|
this.dispatchEvent(new CustomEvent("document-capture-review.cancelled"));
|
|
@@ -811,8 +817,8 @@ class D extends HTMLElement {
|
|
|
811
817
|
});
|
|
812
818
|
}
|
|
813
819
|
}
|
|
814
|
-
"customElements" in window && !customElements.get("document-capture-review") && window.customElements.define("document-capture-review",
|
|
815
|
-
class
|
|
820
|
+
"customElements" in window && !customElements.get("document-capture-review") && window.customElements.define("document-capture-review", R);
|
|
821
|
+
class v {
|
|
816
822
|
static memoryLimit = 1024e4;
|
|
817
823
|
static supportedTypes = ["image/jpeg", "image/png"];
|
|
818
824
|
static getHumanSize(e) {
|
|
@@ -825,33 +831,30 @@ class f {
|
|
|
825
831
|
static getData(e) {
|
|
826
832
|
return new Promise((t, i) => {
|
|
827
833
|
const o = new FileReader();
|
|
828
|
-
o.onload = (
|
|
829
|
-
t(
|
|
834
|
+
o.onload = (r) => {
|
|
835
|
+
t(r.target.result);
|
|
830
836
|
}, o.onerror = () => {
|
|
831
|
-
i(
|
|
832
|
-
new Error(
|
|
833
|
-
"An error occurred reading the file. Please check the file, and try again"
|
|
834
|
-
)
|
|
835
|
-
);
|
|
837
|
+
i(new Error(s("fileUpload.error.readingFile")));
|
|
836
838
|
}, o.readAsDataURL(e);
|
|
837
839
|
});
|
|
838
840
|
}
|
|
839
841
|
static async retrieve(e) {
|
|
840
842
|
if (e.length > 1)
|
|
841
|
-
throw new Error("
|
|
843
|
+
throw new Error(s("fileUpload.error.multipleFiles"));
|
|
842
844
|
const t = e[0];
|
|
843
|
-
if (!
|
|
844
|
-
throw new Error(
|
|
845
|
-
|
|
846
|
-
);
|
|
847
|
-
if (t.size > f.memoryLimit)
|
|
845
|
+
if (!v.supportedTypes.includes(t.type))
|
|
846
|
+
throw new Error(s("fileUpload.error.unsupportedFormat"));
|
|
847
|
+
if (t.size > v.memoryLimit)
|
|
848
848
|
throw new Error(
|
|
849
|
-
|
|
849
|
+
S("fileUpload.error.fileTooLarge", {
|
|
850
|
+
filename: t.name,
|
|
851
|
+
size: v.getHumanSize(v.memoryLimit)
|
|
852
|
+
})
|
|
850
853
|
);
|
|
851
|
-
return await
|
|
854
|
+
return await v.getData(t);
|
|
852
855
|
}
|
|
853
856
|
}
|
|
854
|
-
function
|
|
857
|
+
function O() {
|
|
855
858
|
return `<svg xmlns="http://www.w3.org/2000/svg" width="173" height="103" viewBox="0 0 173 103" fill="none">
|
|
856
859
|
<path d="M15.3799 21.2759C15.3799 16.8576 18.9616 13.2759 23.3799 13.2759H64.2764C68.6947 13.2759 72.2764 16.8576 72.2764 21.2759V73.5517C72.2764 77.97 68.6947 81.5517 64.2764 81.5517H23.3799C18.9616 81.5517 15.3799 77.97 15.3799 73.5517V21.2759Z" fill="#F6C969"/>
|
|
857
860
|
<g filter="url(#filter0_d_1281_4127)">
|
|
@@ -962,7 +965,7 @@ function F() {
|
|
|
962
965
|
</defs>
|
|
963
966
|
</svg>`;
|
|
964
967
|
}
|
|
965
|
-
function
|
|
968
|
+
function U() {
|
|
966
969
|
return `<svg xmlns="http://www.w3.org/2000/svg" width="182" height="108" viewBox="0 0 182 108" fill="none">
|
|
967
970
|
<path d="M143 68C143 65.7909 144.791 64 147 64H164C166.209 64 168 65.7909 168 68V89C168 91.2091 166.209 93 164 93H147C144.791 93 143 91.2091 143 89V68Z" fill="#F6C969"/>
|
|
968
971
|
<g filter="url(#filter0_d_1281_4284)">
|
|
@@ -1000,7 +1003,7 @@ function $() {
|
|
|
1000
1003
|
</defs>
|
|
1001
1004
|
</svg>`;
|
|
1002
1005
|
}
|
|
1003
|
-
function
|
|
1006
|
+
function P() {
|
|
1004
1007
|
return `
|
|
1005
1008
|
<style>
|
|
1006
1009
|
h1 {
|
|
@@ -1038,20 +1041,20 @@ function V() {
|
|
|
1038
1041
|
margin-top: 1rem;
|
|
1039
1042
|
}
|
|
1040
1043
|
</style>
|
|
1041
|
-
<div id="document-capture-instructions-screen" class="flow center">
|
|
1044
|
+
<div id="document-capture-instructions-screen" class="flow center" dir="${this.direction}">
|
|
1042
1045
|
<div class="content-root">
|
|
1043
1046
|
<div class="content-header">
|
|
1044
1047
|
<smileid-navigation theme-color='${this.themeColor}' ${this.showNavigation ? "show-navigation" : ""} ${this.hideBack ? "hide-back" : ""}></smileid-navigation>
|
|
1045
1048
|
</div>
|
|
1046
1049
|
<div class="content-body">
|
|
1047
1050
|
<header>
|
|
1048
|
-
${this.isFrontOfId ?
|
|
1049
|
-
<h1 class='title-color font-bold'>${this.title}</h1>
|
|
1051
|
+
${this.isFrontOfId ? O() : U()}
|
|
1052
|
+
<h1 class='title-color font-bold'>${$(this.title)}</h1>
|
|
1050
1053
|
<p class="description text-sm font-normal">
|
|
1051
|
-
|
|
1054
|
+
${s("document.instructions.description")}
|
|
1052
1055
|
</p>
|
|
1053
1056
|
<p class="description padding-bottom-2">
|
|
1054
|
-
|
|
1057
|
+
${s("document.instructions.followInstructions")}
|
|
1055
1058
|
</p>
|
|
1056
1059
|
</header>
|
|
1057
1060
|
<div class="instructions-wrapper">
|
|
@@ -1131,9 +1134,9 @@ function V() {
|
|
|
1131
1134
|
</defs>
|
|
1132
1135
|
</svg>
|
|
1133
1136
|
<div class="instruction">
|
|
1134
|
-
<p class="instruction-header font-bold text-base"
|
|
1137
|
+
<p class="instruction-header font-bold text-base">${s("document.instructions.goodLight.header")}</p>
|
|
1135
1138
|
<p class="instruction-body text-xs font-medium">
|
|
1136
|
-
|
|
1139
|
+
${s("document.instructions.goodLight.body")}
|
|
1137
1140
|
</p>
|
|
1138
1141
|
</div>
|
|
1139
1142
|
</div>
|
|
@@ -1219,9 +1222,9 @@ function V() {
|
|
|
1219
1222
|
</defs>
|
|
1220
1223
|
</svg>
|
|
1221
1224
|
<div>
|
|
1222
|
-
<p class="instruction-header font-bold text-base"
|
|
1225
|
+
<p class="instruction-header font-bold text-base">${s("document.instructions.clearImage.header")}</p>
|
|
1223
1226
|
<p class="instruction-body text-xs font-medium">
|
|
1224
|
-
|
|
1227
|
+
${s("document.instructions.clearImage.body")}
|
|
1225
1228
|
</p>
|
|
1226
1229
|
</div>
|
|
1227
1230
|
</div>
|
|
@@ -1231,13 +1234,13 @@ function V() {
|
|
|
1231
1234
|
<div class='controls'>
|
|
1232
1235
|
${this.supportBothCaptureModes || this.documentCaptureModes === "camera" ? `
|
|
1233
1236
|
<button data-variant='solid full-width' class='button' type='button' id='take-photo'>
|
|
1234
|
-
|
|
1237
|
+
${s("document.instructions.takePhotoButton")}
|
|
1235
1238
|
</button>
|
|
1236
1239
|
` : ""}
|
|
1237
1240
|
${this.supportBothCaptureModes || this.documentCaptureModes === "upload" ? `
|
|
1238
1241
|
<label id='upload-photo-label' data-variant='${this.supportBothCaptureModes ? "outline" : "solid"}' class='button'>
|
|
1239
1242
|
<input type='file' hidden onclick='this.value=null;' id='upload-photo' name='document' accept='image/png, image/jpeg' />
|
|
1240
|
-
<span
|
|
1243
|
+
<span>${s("document.instructions.uploadPhotoButton")}</span>
|
|
1241
1244
|
</label>
|
|
1242
1245
|
` : ""}
|
|
1243
1246
|
</div>
|
|
@@ -1249,12 +1252,12 @@ ${this.hideAttribution ? "" : `
|
|
|
1249
1252
|
</div>
|
|
1250
1253
|
</div>
|
|
1251
1254
|
</div>
|
|
1252
|
-
${
|
|
1255
|
+
${y(this.themeColor)}
|
|
1253
1256
|
`;
|
|
1254
1257
|
}
|
|
1255
|
-
class
|
|
1258
|
+
class G extends HTMLElement {
|
|
1256
1259
|
constructor() {
|
|
1257
|
-
super(), this.templateString =
|
|
1260
|
+
super(), this.templateString = P.bind(this), this.render = () => this.templateString(), this.attachShadow({ mode: "open" });
|
|
1258
1261
|
}
|
|
1259
1262
|
connectedCallback() {
|
|
1260
1263
|
const e = document.createElement("template");
|
|
@@ -1271,7 +1274,7 @@ class Z extends HTMLElement {
|
|
|
1271
1274
|
async (t) => {
|
|
1272
1275
|
this.shadowRoot.querySelector("#error").innerHTML = "";
|
|
1273
1276
|
try {
|
|
1274
|
-
const { files: i } = t.target, o = await
|
|
1277
|
+
const { files: i } = t.target, o = await v.retrieve(i);
|
|
1275
1278
|
this.dispatchEvent(
|
|
1276
1279
|
new CustomEvent("document-capture-instructions.upload", {
|
|
1277
1280
|
detail: { image: o, previewImage: o }
|
|
@@ -1303,7 +1306,7 @@ class Z extends HTMLElement {
|
|
|
1303
1306
|
return e.includes("camera") && e.includes("upload");
|
|
1304
1307
|
}
|
|
1305
1308
|
get title() {
|
|
1306
|
-
return this.getAttribute("title") || "
|
|
1309
|
+
return this.getAttribute("title") || s("document.title.front");
|
|
1307
1310
|
}
|
|
1308
1311
|
get sideOfId() {
|
|
1309
1312
|
return (this.getAttribute("side-of-id") || "front").toLowerCase();
|
|
@@ -1314,6 +1317,9 @@ class Z extends HTMLElement {
|
|
|
1314
1317
|
get isBackOfId() {
|
|
1315
1318
|
return !this.isFrontOfId;
|
|
1316
1319
|
}
|
|
1320
|
+
get direction() {
|
|
1321
|
+
return this.getAttribute("dir") || x() || "ltr";
|
|
1322
|
+
}
|
|
1317
1323
|
handleBackEvents() {
|
|
1318
1324
|
this.dispatchEvent(
|
|
1319
1325
|
new CustomEvent("document-capture-instructions.cancelled")
|
|
@@ -1325,49 +1331,49 @@ class Z extends HTMLElement {
|
|
|
1325
1331
|
}
|
|
1326
1332
|
"customElements" in window && !customElements.get("document-capture-instructions") && window.customElements.define(
|
|
1327
1333
|
"document-capture-instructions",
|
|
1328
|
-
|
|
1334
|
+
G
|
|
1329
1335
|
);
|
|
1330
|
-
const
|
|
1331
|
-
async function
|
|
1336
|
+
const T = L.version, p = document.querySelector("smart-camera-web");
|
|
1337
|
+
async function m(u) {
|
|
1332
1338
|
try {
|
|
1333
|
-
const e = await
|
|
1339
|
+
const e = await h.getMedia({
|
|
1334
1340
|
audio: !1,
|
|
1335
|
-
video:
|
|
1341
|
+
video: h.environmentOptions
|
|
1336
1342
|
}), i = (await navigator.mediaDevices.enumerateDevices()).find(
|
|
1337
1343
|
(o) => o.kind === "videoinput" && e.getVideoTracks()[0].getSettings().deviceId === o.deviceId
|
|
1338
1344
|
);
|
|
1339
|
-
|
|
1345
|
+
p?.dispatchEvent(
|
|
1340
1346
|
new CustomEvent("metadata.camera-name", {
|
|
1341
1347
|
detail: { cameraName: i?.label }
|
|
1342
1348
|
})
|
|
1343
|
-
),
|
|
1349
|
+
), u.removeAttribute("data-camera-error"), u.setAttribute("data-camera-ready", !0);
|
|
1344
1350
|
} catch (e) {
|
|
1345
|
-
|
|
1351
|
+
u.removeAttribute("data-camera-ready"), u.setAttribute(
|
|
1346
1352
|
"data-camera-error",
|
|
1347
|
-
|
|
1353
|
+
h.handleCameraError(e)
|
|
1348
1354
|
);
|
|
1349
1355
|
}
|
|
1350
1356
|
}
|
|
1351
|
-
class
|
|
1357
|
+
class j extends HTMLElement {
|
|
1352
1358
|
constructor() {
|
|
1353
|
-
super(), this.activeScreen = null, this.smartCameraWeb = this.closest("smart-camera-web"),
|
|
1359
|
+
super(), this.activeScreen = null, this.smartCameraWeb = this.closest("smart-camera-web"), p?.dispatchEvent(new CustomEvent("metadata.initialize"));
|
|
1354
1360
|
}
|
|
1355
1361
|
connectedCallback() {
|
|
1356
1362
|
this.innerHTML = `
|
|
1357
|
-
${
|
|
1363
|
+
${y(this.themeColor)}
|
|
1358
1364
|
<div style="height: 100%;">
|
|
1359
1365
|
<document-capture-instructions theme-color='${this.themeColor}' id='document-capture-instructions-front' ${this.title}
|
|
1360
1366
|
${this.documentCaptureModes} ${this.showNavigation} ${this.hideInstructions ? "hidden" : ""}
|
|
1361
1367
|
${this.hideAttribution}
|
|
1362
1368
|
></document-capture-instructions>
|
|
1363
1369
|
<document-capture id='document-capture-front' side-of-id='Front'
|
|
1364
|
-
${this.title} ${this.showNavigation} ${this.hideInstructions ? "" : "hidden"} ${this.hideAttribution}
|
|
1370
|
+
${this.title || `title='${s("document.title.front")}'`} ${this.showNavigation} ${this.hideInstructions ? "" : "hidden"} ${this.hideAttribution}
|
|
1365
1371
|
${this.documentCaptureModes} ${this.documentType} theme-color='${this.themeColor}'
|
|
1366
1372
|
></document-capture>
|
|
1367
|
-
<document-capture-instructions id='document-capture-instructions-back' side-of-id='Back' title='
|
|
1373
|
+
<document-capture-instructions id='document-capture-instructions-back' side-of-id='Back' title='${s("document.title.back")}'
|
|
1368
1374
|
${this.documentCaptureModes} ${this.showNavigation} theme-color='${this.themeColor}' ${this.hideAttribution} hidden
|
|
1369
1375
|
></document-capture-instructions>
|
|
1370
|
-
<document-capture id='document-capture-back' side-of-id='Back' ${this.title
|
|
1376
|
+
<document-capture id='document-capture-back' side-of-id='Back' ${this.title || `title='${s("document.title.back")}'`} ${this.showNavigation}
|
|
1371
1377
|
${this.documentCaptureModes} theme-color='${this.themeColor}' ${this.hideAttribution}
|
|
1372
1378
|
hidden
|
|
1373
1379
|
></document-capture>
|
|
@@ -1377,7 +1383,7 @@ class O extends HTMLElement {
|
|
|
1377
1383
|
`, this._data = {
|
|
1378
1384
|
images: [],
|
|
1379
1385
|
meta: {
|
|
1380
|
-
libraryVersion:
|
|
1386
|
+
libraryVersion: T
|
|
1381
1387
|
}
|
|
1382
1388
|
}, this.documentInstruction = this.querySelector(
|
|
1383
1389
|
"document-capture-instructions"
|
|
@@ -1385,10 +1391,10 @@ class O extends HTMLElement {
|
|
|
1385
1391
|
"#document-capture-instructions-back"
|
|
1386
1392
|
), this.idCapture = this.querySelector("#document-capture-front"), this.idReview = this.querySelector("#front-of-document-capture-review"), this.idCaptureBack = this.querySelector("#document-capture-back"), this.backOfIdReview = this.querySelector(
|
|
1387
1393
|
"#back-of-document-capture-review"
|
|
1388
|
-
), this.thankYouScreen = this.querySelector("thank-you"), this.hideInstructions ? (
|
|
1394
|
+
), this.thankYouScreen = this.querySelector("thank-you"), this.hideInstructions ? (m(this.idCapture), this.setActiveScreen(this.idCapture)) : this.setActiveScreen(this.documentInstruction), this.setUpEventListeners();
|
|
1389
1395
|
}
|
|
1390
1396
|
disconnectedCallback() {
|
|
1391
|
-
|
|
1397
|
+
h.stopMedia(), p?.dispatchEvent(new CustomEvent("metadata.cleanup")), this.activeScreen && this.activeScreen.removeAttribute("hidden"), this.activeScreen = null, this.innerHTML = "";
|
|
1392
1398
|
}
|
|
1393
1399
|
setUpEventListeners() {
|
|
1394
1400
|
this.documentInstruction.addEventListener(
|
|
@@ -1399,93 +1405,93 @@ class O extends HTMLElement {
|
|
|
1399
1405
|
), this.documentInstruction.addEventListener(
|
|
1400
1406
|
"document-capture-instructions.capture",
|
|
1401
1407
|
async () => {
|
|
1402
|
-
|
|
1408
|
+
p?.dispatchEvent(
|
|
1403
1409
|
new CustomEvent("metadata.document-front-capture-start")
|
|
1404
|
-
),
|
|
1410
|
+
), p?.dispatchEvent(
|
|
1405
1411
|
new CustomEvent("metadata.document-front-origin", {
|
|
1406
1412
|
detail: { imageOrigin: "camera_manual_capture" }
|
|
1407
1413
|
})
|
|
1408
|
-
), this.setActiveScreen(this.idCapture), await
|
|
1414
|
+
), this.setActiveScreen(this.idCapture), await m(this.idCapture);
|
|
1409
1415
|
}
|
|
1410
1416
|
), this.documentInstruction.addEventListener(
|
|
1411
1417
|
"document-capture-instructions.upload",
|
|
1412
1418
|
async (t) => {
|
|
1413
|
-
|
|
1419
|
+
p?.dispatchEvent(
|
|
1414
1420
|
new CustomEvent("metadata.document-front-origin", {
|
|
1415
1421
|
detail: { imageOrigin: "gallery" }
|
|
1416
1422
|
})
|
|
1417
1423
|
), this.idReview.setAttribute("data-image", t.detail.previewImage), this._data.images.push({
|
|
1418
1424
|
image: t.detail.image.split(",")[1],
|
|
1419
|
-
image_type_id:
|
|
1425
|
+
image_type_id: b.ID_CARD_IMAGE_BASE64
|
|
1420
1426
|
}), this.setActiveScreen(this.idReview);
|
|
1421
1427
|
}
|
|
1422
1428
|
), this.idCapture.addEventListener("document-capture.publish", (t) => {
|
|
1423
|
-
|
|
1429
|
+
p?.dispatchEvent(
|
|
1424
1430
|
new CustomEvent("metadata.document-front-capture-end")
|
|
1425
1431
|
), this.idReview.setAttribute("data-image", t.detail.previewImage), this._data.images.push({
|
|
1426
1432
|
image: t.detail.image.split(",")[1],
|
|
1427
|
-
image_type_id:
|
|
1428
|
-
}),
|
|
1433
|
+
image_type_id: b.ID_CARD_IMAGE_BASE64
|
|
1434
|
+
}), h.stopMedia(), this.setActiveScreen(this.idReview);
|
|
1429
1435
|
}), this.idCapture.addEventListener("document-capture.cancelled", () => {
|
|
1430
1436
|
this.hideInstructions ? this.handleBackEvents() : this.setActiveScreen(this.documentInstruction);
|
|
1431
1437
|
}), this.idReview.addEventListener(
|
|
1432
1438
|
"document-capture-review.rejected",
|
|
1433
1439
|
async () => {
|
|
1434
|
-
|
|
1440
|
+
p?.dispatchEvent(
|
|
1435
1441
|
new CustomEvent("metadata.document-front-capture-retry")
|
|
1436
|
-
), this.idReview.removeAttribute("data-image"), this._data.images.pop(), this.hideInstructions ? (this.setActiveScreen(this.idCapture), await
|
|
1442
|
+
), this.idReview.removeAttribute("data-image"), this._data.images.pop(), this.hideInstructions ? (this.setActiveScreen(this.idCapture), await m(this.idCapture)) : this.setActiveScreen(this.documentInstruction);
|
|
1437
1443
|
}
|
|
1438
1444
|
), this.idReview.addEventListener(
|
|
1439
1445
|
"document-capture-review.accepted",
|
|
1440
1446
|
async () => {
|
|
1441
|
-
this.hideBackOfId ? this._publishSelectedImages() : this.hideInstructions ? (this.setActiveScreen(this.idCaptureBack), await
|
|
1447
|
+
this.hideBackOfId ? this._publishSelectedImages() : this.hideInstructions ? (this.setActiveScreen(this.idCaptureBack), await m(this.idCaptureBack)) : this.setActiveScreen(this.documentInstructionBack);
|
|
1442
1448
|
}
|
|
1443
1449
|
), this.documentInstructionBack.addEventListener(
|
|
1444
1450
|
"document-capture-instructions.capture",
|
|
1445
1451
|
async () => {
|
|
1446
|
-
|
|
1452
|
+
p?.dispatchEvent(
|
|
1447
1453
|
new CustomEvent("metadata.document-back-capture-start")
|
|
1448
|
-
),
|
|
1454
|
+
), p?.dispatchEvent(
|
|
1449
1455
|
new CustomEvent("metadata.document-back-origin", {
|
|
1450
1456
|
detail: { imageOrigin: "camera_manual_capture" }
|
|
1451
1457
|
})
|
|
1452
|
-
), this.setActiveScreen(this.idCaptureBack), await
|
|
1458
|
+
), this.setActiveScreen(this.idCaptureBack), await m(this.idCaptureBack);
|
|
1453
1459
|
}
|
|
1454
1460
|
), this.documentInstructionBack.addEventListener(
|
|
1455
1461
|
"document-capture-instructions.cancelled",
|
|
1456
1462
|
async () => {
|
|
1457
|
-
this.idReview.removeAttribute("data-image"), this._data.images.pop(), this.hideInstructions ? (this.setActiveScreen(this.idCapture), await
|
|
1463
|
+
this.idReview.removeAttribute("data-image"), this._data.images.pop(), this.hideInstructions ? (this.setActiveScreen(this.idCapture), await m(this.idCapture)) : this.setActiveScreen(this.documentInstruction);
|
|
1458
1464
|
}
|
|
1459
1465
|
), this.documentInstructionBack.addEventListener(
|
|
1460
1466
|
"document-capture-instructions.upload",
|
|
1461
1467
|
async (t) => {
|
|
1462
|
-
|
|
1468
|
+
p?.dispatchEvent(
|
|
1463
1469
|
new CustomEvent("metadata.document-back-origin", {
|
|
1464
1470
|
detail: { imageOrigin: "gallery" }
|
|
1465
1471
|
})
|
|
1466
1472
|
), this.backOfIdReview.setAttribute("data-image", t.detail.image), this._data.images.push({
|
|
1467
1473
|
image: t.detail.image.split(",")[1],
|
|
1468
|
-
image_type_id:
|
|
1474
|
+
image_type_id: b.ID_CARD_BACK_IMAGE_BASE64
|
|
1469
1475
|
}), this.setActiveScreen(this.backOfIdReview);
|
|
1470
1476
|
}
|
|
1471
1477
|
), this.idCaptureBack.addEventListener("document-capture.publish", (t) => {
|
|
1472
|
-
|
|
1478
|
+
p?.dispatchEvent(
|
|
1473
1479
|
new CustomEvent("metadata.document-back-capture-end")
|
|
1474
1480
|
), this.backOfIdReview.setAttribute("data-image", t.detail.previewImage), this._data.images.push({
|
|
1475
1481
|
image: t.detail.image.split(",")[1],
|
|
1476
|
-
image_type_id:
|
|
1477
|
-
}), this.setActiveScreen(this.backOfIdReview),
|
|
1482
|
+
image_type_id: b.ID_CARD_BACK_IMAGE_BASE64
|
|
1483
|
+
}), this.setActiveScreen(this.backOfIdReview), h.stopMedia();
|
|
1478
1484
|
}), this.idCaptureBack.addEventListener(
|
|
1479
1485
|
"document-capture.cancelled",
|
|
1480
1486
|
async () => {
|
|
1481
|
-
this.hideInstructions ? (this.setActiveScreen(this.idCapture), await
|
|
1487
|
+
this.hideInstructions ? (this.setActiveScreen(this.idCapture), await m(this.idCapture)) : this.setActiveScreen(this.documentInstructionBack);
|
|
1482
1488
|
}
|
|
1483
1489
|
), this.backOfIdReview.addEventListener(
|
|
1484
1490
|
"document-capture-review.rejected",
|
|
1485
1491
|
async () => {
|
|
1486
|
-
|
|
1492
|
+
p?.dispatchEvent(
|
|
1487
1493
|
new CustomEvent("metadata.document-back-capture-retry")
|
|
1488
|
-
), this.backOfIdReview.removeAttribute("data-image"), this._data.images.pop(), this.hideInstructions ? (this.setActiveScreen(this.idCaptureBack), await
|
|
1494
|
+
), this.backOfIdReview.removeAttribute("data-image"), this._data.images.pop(), this.hideInstructions ? (this.setActiveScreen(this.idCaptureBack), await m(this.idCaptureBack)) : this.setActiveScreen(this.documentInstructionBack);
|
|
1489
1495
|
}
|
|
1490
1496
|
), this.backOfIdReview.addEventListener(
|
|
1491
1497
|
"document-capture-review.accepted",
|
|
@@ -1567,8 +1573,8 @@ class O extends HTMLElement {
|
|
|
1567
1573
|
}
|
|
1568
1574
|
}
|
|
1569
1575
|
}
|
|
1570
|
-
"customElements" in window && !customElements.get("document-capture-screens") && customElements.define("document-capture-screens",
|
|
1576
|
+
"customElements" in window && !customElements.get("document-capture-screens") && customElements.define("document-capture-screens", j);
|
|
1571
1577
|
export {
|
|
1572
|
-
|
|
1578
|
+
j as D
|
|
1573
1579
|
};
|
|
1574
|
-
//# sourceMappingURL=DocumentCaptureScreens-
|
|
1580
|
+
//# sourceMappingURL=DocumentCaptureScreens-DHAfE8VG.js.map
|