@smileid/web-components 11.0.3 → 11.2.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.
Files changed (93) hide show
  1. package/README.md +61 -0
  2. package/dist/components/smart-camera-web/src/README.md +0 -1
  3. package/dist/esm/{DocumentCaptureScreens-C5BhNB-0.js → DocumentCaptureScreens-BbtA-WkX.js} +199 -193
  4. package/dist/esm/DocumentCaptureScreens-BbtA-WkX.js.map +1 -0
  5. package/dist/esm/{EndUserConsent-D4fd1ovG.js → EndUserConsent-HVufMamg.js} +65 -63
  6. package/dist/esm/EndUserConsent-HVufMamg.js.map +1 -0
  7. package/dist/esm/{Navigation-CTjK6tLU.js → Navigation-B-dqPkZj.js} +17 -9
  8. package/dist/esm/Navigation-B-dqPkZj.js.map +1 -0
  9. package/dist/esm/{SelfieCaptureScreens-KoQpCxtc.js → SelfieCaptureScreens-ChAMfKi3.js} +3274 -3329
  10. package/dist/esm/SelfieCaptureScreens-ChAMfKi3.js.map +1 -0
  11. package/dist/esm/{TotpConsent-CQU5jQi4.js → TotpConsent-XxR8TNxy.js} +13 -9
  12. package/dist/esm/TotpConsent-XxR8TNxy.js.map +1 -0
  13. package/dist/esm/combobox.js +20 -19
  14. package/dist/esm/combobox.js.map +1 -1
  15. package/dist/esm/document.js +1 -1
  16. package/dist/esm/end-user-consent.js +1 -1
  17. package/dist/esm/index-B_ozpejI.js +1360 -0
  18. package/dist/esm/index-B_ozpejI.js.map +1 -0
  19. package/dist/esm/localisation.js +21 -0
  20. package/dist/esm/localisation.js.map +1 -0
  21. package/dist/esm/main.js +34 -17
  22. package/dist/esm/main.js.map +1 -1
  23. package/dist/esm/navigation.js +1 -1
  24. package/dist/esm/{package-B-UwEdv7.js → package-u3FEJ3Fm.js} +25 -40
  25. package/dist/esm/package-u3FEJ3Fm.js.map +1 -0
  26. package/dist/esm/selfie.js +1 -1
  27. package/dist/esm/smart-camera-web.js +32 -23
  28. package/dist/esm/smart-camera-web.js.map +1 -1
  29. package/dist/esm/totp-consent.js +1 -1
  30. package/dist/package.json +1 -1
  31. package/dist/smart-camera-web.js +144 -160
  32. package/dist/smart-camera-web.js.map +1 -1
  33. package/dist/src/components/combobox/src/index.js +424 -1
  34. package/dist/src/components/document/src/index.js +1422 -1
  35. package/dist/src/components/end-user-consent/src/index.js +1573 -1
  36. package/dist/src/components/selfie/src/index.js +1220 -1
  37. package/dist/src/components/signature-pad/src/index.js +787 -1
  38. package/dist/src/components/smart-camera-web/src/SmartCameraWeb.js +2753 -1
  39. package/dist/src/components/totp-consent/src/index.js +1292 -1
  40. package/dist/types/combobox.d.ts +2 -2
  41. package/dist/types/document.d.ts +2 -2
  42. package/dist/types/end-user-consent.d.ts +2 -2
  43. package/dist/types/locale.d.ts +19 -0
  44. package/dist/types/localisation.d.ts +21 -0
  45. package/dist/types/main.d.ts +35 -26
  46. package/dist/types/navigation.d.ts +2 -2
  47. package/dist/types/selfie.d.ts +2 -2
  48. package/dist/types/signature-pad.d.ts +2 -2
  49. package/dist/types/smart-camera-web.d.ts +2 -2
  50. package/dist/types/totp-consent.d.ts +2 -2
  51. package/lib/components/camera-permission/CameraPermission.js +9 -4
  52. package/lib/components/combobox/src/Combobox.js +4 -2
  53. package/lib/components/document/src/DocumentCaptureScreens.js +4 -3
  54. package/lib/components/document/src/DocumentCaptureScreens.stories.js +37 -13
  55. package/lib/components/document/src/document-capture/DocumentCapture.js +23 -17
  56. package/lib/components/document/src/document-capture/DocumentCapture.stories.js +11 -2
  57. package/lib/components/document/src/document-capture-instructions/DocumentCaptureInstructions.js +19 -14
  58. package/lib/components/document/src/document-capture-instructions/DocumentCaptureInstructions.stories.js +14 -5
  59. package/lib/components/document/src/document-capture-review/DocumentCaptureReview.js +14 -10
  60. package/lib/components/document/src/document-capture-review/DocumentCaptureReview.stories.js +14 -5
  61. package/lib/components/end-user-consent/src/EndUserConsent.js +30 -29
  62. package/lib/components/end-user-consent/src/EndUserConsent.stories.js +12 -2
  63. package/lib/components/navigation/src/Navigation.js +15 -2
  64. package/lib/components/navigation/src/Navigation.stories.js +20 -4
  65. package/lib/components/selfie/src/SelfieCaptureScreens.js +12 -8
  66. package/lib/components/selfie/src/SelfieCaptureScreens.stories.js +16 -4
  67. package/lib/components/selfie/src/selfie-capture/SelfieCapture.js +25 -18
  68. package/lib/components/selfie/src/selfie-capture/SelfieCapture.stories.js +19 -7
  69. package/lib/components/selfie/src/selfie-capture-instructions/SelfieCaptureInstructions.js +19 -14
  70. package/lib/components/selfie/src/selfie-capture-instructions/SelfieCaptureInstructions.stories.js +14 -5
  71. package/lib/components/selfie/src/selfie-capture-review/SelfieCaptureReview.js +13 -8
  72. package/lib/components/selfie/src/selfie-capture-review/SelfieCaptureReview.stories.js +14 -5
  73. package/lib/components/selfie/src/selfie-capture-wrapper/SelfieCaptureWrapper.tsx +98 -47
  74. package/lib/components/selfie/src/smartselfie-capture/SmartSelfieCapture.tsx +2 -2
  75. package/lib/components/selfie/src/smartselfie-capture/components/CaptureControls.tsx +5 -2
  76. package/lib/components/selfie/src/smartselfie-capture/hooks/useCamera.ts +4 -4
  77. package/lib/components/selfie/src/smartselfie-capture/hooks/useFaceCapture.ts +6 -5
  78. package/lib/components/selfie/src/smartselfie-capture/utils/alertMessages.ts +11 -9
  79. package/lib/components/selfie/src/smartselfie-capture/utils/imageCapture.ts +3 -1
  80. package/lib/components/signature-pad/package.json +1 -1
  81. package/lib/components/smart-camera-web/src/SmartCameraWeb.js +9 -1
  82. package/lib/components/totp-consent/src/TotpConsent.js +8 -3
  83. package/lib/domain/camera/src/SmartCamera.js +7 -22
  84. package/lib/domain/constants/src/Constants.js +28 -0
  85. package/lib/domain/file-upload/src/SmartFileUpload.js +9 -10
  86. package/lib/domain/localisation/index.js +456 -0
  87. package/package.json +13 -7
  88. package/dist/esm/DocumentCaptureScreens-C5BhNB-0.js.map +0 -1
  89. package/dist/esm/EndUserConsent-D4fd1ovG.js.map +0 -1
  90. package/dist/esm/Navigation-CTjK6tLU.js.map +0 -1
  91. package/dist/esm/SelfieCaptureScreens-KoQpCxtc.js.map +0 -1
  92. package/dist/esm/TotpConsent-CQU5jQi4.js.map +0 -1
  93. package/dist/esm/package-B-UwEdv7.js.map +0 -1
@@ -1,14 +1,15 @@
1
- import { S as c, p as M, I as w } from "./package-B-UwEdv7.js";
2
- import { s as C } from "./styles-BOEZtbuc.js";
3
- import "./Navigation-CTjK6tLU.js";
4
- function A(l, e = 16) {
1
+ import { S as h, J as C, p as L, I as b } from "./package-u3FEJ3Fm.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-B_ozpejI.js";
4
+ import "./Navigation-B-dqPkZj.js";
5
+ function D(u, e = 16) {
5
6
  const t = /* @__PURE__ */ new Set();
6
- for (let i = 0; i < Math.min(l.length, 1e4); i += 4)
7
- if (t.add(l[i] << 16 | l[i + 1] << 8 | l[i + 2]), t.size > e)
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 H() {
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
- ${C(this.themeColor)}
158
- <div id='document-capture-screen' class='flow center flex-column'>
159
- <smileid-navigation theme-color='${this.themeColor}' ${this.showNavigation ? "show-navigation" : ""} ${this.hideBack ? "hide-back" : ""}></smileid-navigation>
158
+ ${y(this.themeColor)}
159
+ <div id='document-capture-screen' class='flow center flex-column' dir='${this.direction}'>
160
+ ${this.showNavigation ? `<smileid-navigation theme-color='${this.themeColor}' 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>` : '<p style="--flow-space: 4rem">Checking permissions</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'>Make sure all corners are visible and there is no glare.</h4>
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'>Capture Document</span>
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 v = 0.6;
188
- class L extends HTMLElement {
188
+ const w = 0.6;
189
+ class V extends HTMLElement {
189
190
  constructor() {
190
- super(), this.templateString = H.bind(this), this.render = () => this.templateString(), this.attachShadow({ mode: "open" }), this.IdSides = {
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 (!c.stream && this.hasAttribute("data-camera-error")) {
201
+ if (!h.stream && this.hasAttribute("data-camera-error")) {
201
202
  try {
202
- await c.getMedia({
203
+ await h.getMedia({
203
204
  audio: !1,
204
205
  video: {
205
- ...c.environmentOptions,
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(c.stream);
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 s = document.createElement("canvas");
230
- s.width = t.width, s.height = t.height, this.updatePortraitId(t, e, 1, 1), this.updatePortraitId(s, e);
231
- const n = t.toDataURL("image/jpeg"), h = s.toDataURL("image/jpeg");
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: n,
234
+ image: d,
234
235
  originalHeight: t.height,
235
236
  originalWidth: t.width,
236
- previewImage: h,
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 s = document.createElement("canvas");
246
- o.height = t.width / 1.75, t.width = 2240, t.height = t.width / 1.77, this._capturePortraitToLandscapeImage(s, e), this._drawLandscapeImageFromCanvas(t, s, 1, 1), this._drawLandscapeImageFromCanvas(o, s);
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 r = t.toDataURL("image/jpeg"), d = o.toDataURL("image/jpeg");
250
+ const a = t.toDataURL("image/jpeg", C), c = o.toDataURL("image/jpeg", C);
250
251
  return {
251
- image: r,
252
+ image: a,
252
253
  originalHeight: t.height,
253
254
  originalWidth: t.width,
254
- previewImage: d,
255
+ previewImage: c,
255
256
  ...this.idCardRegion
256
257
  };
257
258
  }
258
- _drawImage(e, t = !0, i = c.stream) {
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 a = o.getImageData(0, 0, e.width, e.height);
273
- if (A(a.data))
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 a = this.shadowRoot.querySelector(
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 = a.clientWidth, o.height = a.clientWidth * 9 / 16, this.isPortraitCaptureView && (o.height = a.clientWidth * 16 / 9), i.onloadedmetadata = () => {
291
- i.play(), this.shadowRoot.querySelector("#loader").hidden = !0, this.shadowRoot.querySelector(".id-video").hidden = !1, this.shadowRoot.querySelector(".actions").hidden = !1, t || a.prepend(o);
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 r = () => {
294
+ const a = () => {
294
295
  if (i.paused || i.ended) return;
295
- i.removeEventListener("playing", r);
296
- const s = i.videoWidth / i.videoHeight < 1;
296
+ i.removeEventListener("playing", a);
297
+ const n = i.videoWidth / i.videoHeight < 1;
297
298
  if (this.isPortraitCaptureView) {
298
- this.updatePortraitId(o, i), requestAnimationFrame(r);
299
+ this.updatePortraitId(o, i), requestAnimationFrame(a);
299
300
  return;
300
301
  }
301
- if (s) {
302
- a.classList.add("mobile-camera-screen");
303
- const n = document.createElement("canvas");
304
- this._capturePortraitToLandscapeImage(n, i), this._drawLandscapeImageFromCanvas(o, n);
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(r);
308
+ requestAnimationFrame(a);
308
309
  };
309
- i.addEventListener("playing", r), this._IDStream = e, this._IDVideo = i;
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
- c.handleCameraError(t)
314
- ), t.name !== "AbortError" && console.error(t), c.stopMedia();
314
+ h.handleCameraError(t)
315
+ ), t.name !== "AbortError" && console.error(t), h.stopMedia();
315
316
  }
316
317
  }
317
- _drawLandscapeImage(e, t = this._IDVideo, i = v, o = v) {
318
- const a = this.height ? this.height / t.videoHeight : i, r = this.width ? this.width / t.videoWidth : o, d = (1 - i) / 2, s = (1 - o) / 2, n = t.videoWidth * r, h = t.videoHeight * a, m = t.videoWidth * s, g = t.videoHeight * d;
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
- n,
324
- h,
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, a = o, r = o * 9 / 16, d = 0, s = (i - r) / 2;
333
- e.width = a, e.height = r, e.getContext("2d").drawImage(
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
- d,
336
- s,
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 = v, o = v) {
346
- const a = this.height ? this.height / t.height : i, r = this.width ? this.width / t.width : o, d = (1 - i) / 2, s = (1 - o) / 2, n = t.width * r, h = t.height * a, m = t.width * s, g = t.height * d;
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
- n,
352
- h,
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, a = 600, r = 400;
361
- e.width = a, e.height = r;
362
- const d = (o - a) / 2, s = (i - r) / 2;
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
- d,
366
- s,
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 = v, o = v) {
376
- const { videoWidth: a, videoHeight: r } = t;
377
- if (a && r) {
378
- const d = document.createElement("canvas"), s = 9 / 16;
379
- let n, h, m, g;
380
- a / r > s ? (h = r, n = h * s, m = (a - n) / 2, g = 0) : (n = a, h = n, m = 0, g = 0), d.height = h, d.width = n, d.getContext("2d").drawImage(
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
- n,
385
- h,
384
+ f,
385
+ d,
386
+ l,
386
387
  0,
387
388
  0,
388
- d.width,
389
- d.height
389
+ c.width,
390
+ c.height
390
391
  );
391
- const b = this.height ? this.height / n : i, y = this.width ? this.width / h : o, x = (1 - i) / 2, E = (1 - o) / 2, k = n * y, _ = h * b, I = n * E, B = h * x;
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
- d,
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,9 +407,9 @@ 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"), c.stream && this.handleIDStream(c.stream), this.navigation.addEventListener("navigation.back", () => {
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
- }), this.navigation.addEventListener("navigation.close", () => {
412
+ }), this.navigation?.addEventListener("navigation.close", () => {
412
413
  this.handleCloseEvents();
413
414
  }), this.captureIDImage.addEventListener("click", () => {
414
415
  this._captureIDImage();
@@ -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") || "Document";
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")), c.stopMedia();
498
+ this.dispatchEvent(new CustomEvent("document-capture.cancelled")), h.stopMedia();
495
499
  }
496
500
  handleCloseEvents() {
497
- this.dispatchEvent(new CustomEvent("document-capture.close")), c.stopMedia();
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", L);
501
- function S() {
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
- ${C(this.themeColor)}
718
- <div id='document-capture-review-screen' class='flow center'>
719
- <smileid-navigation ${this.showNavigation ? "show-navigation" : ""} hide-back></smileid-navigation>
721
+ ${y(this.themeColor)}
722
+ <div id='document-capture-review-screen' class='flow center' dir='${this.direction}'>
723
+ ${this.showNavigation ? "<smileid-navigation show-navigation hide-back></smileid-navigation>" : ""}
720
724
  <h1 class="header-title title-color">
721
- Is the document clear and readable?
725
+ ${s("document.review.question")}
722
726
  </h1>
723
- <p class="description">Make sure all corners of the document
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
- Yes, my ID is readable
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
- No, retake photo
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 D extends HTMLElement {
751
+ class R extends HTMLElement {
749
752
  constructor() {
750
- super(), this.templateString = S.bind(this), this.render = () => this.templateString(), this.attachShadow({ mode: "open" });
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") || "Submit Front of ID";
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"));
@@ -792,9 +798,9 @@ class D extends HTMLElement {
792
798
  setUpEventListeners() {
793
799
  this.selectIDImage = this.shadowRoot.querySelector("#select-id-image"), this.reCaptureIDImage = this.shadowRoot.querySelector(
794
800
  "#re-capture-id-image"
795
- ), this.navigation = this.shadowRoot.querySelector("smileid-navigation"), this.navigation.addEventListener("navigation.back", () => {
801
+ ), this.navigation = this.shadowRoot.querySelector("smileid-navigation"), this.navigation?.addEventListener("navigation.back", () => {
796
802
  this.handleBackEvents();
797
- }), this.navigation.addEventListener("navigation.close", () => {
803
+ }), this.navigation?.addEventListener("navigation.close", () => {
798
804
  this.handleCloseEvents();
799
805
  }), this.selectIDImage.addEventListener("click", () => {
800
806
  this.dispatchEvent(
@@ -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", D);
815
- class f {
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 = (a) => {
829
- t(a.target.result);
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("Only one file upload is permitted at a time");
843
+ throw new Error(s("fileUpload.error.multipleFiles"));
842
844
  const t = e[0];
843
- if (!f.supportedTypes.includes(t.type))
844
- throw new Error(
845
- "Unsupported file format. Please ensure that you are providing a JPG or PNG image"
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
- `${t.name} is too large. Please ensure that the file is less than ${f.getHumanSize(f.memoryLimit)}.`
849
+ S("fileUpload.error.fileTooLarge", {
850
+ filename: t.name,
851
+ size: v.getHumanSize(v.memoryLimit)
852
+ })
850
853
  );
851
- return await f.getData(t);
854
+ return await v.getData(t);
852
855
  }
853
856
  }
854
- function F() {
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 V() {
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
- <smileid-navigation theme-color='${this.themeColor}' ${this.showNavigation ? "show-navigation" : ""} ${this.hideBack ? "hide-back" : ""}></smileid-navigation>
1047
+ ${this.showNavigation ? `<smileid-navigation theme-color='${this.themeColor}' show-navigation ${this.hideBack ? "hide-back" : ""}></smileid-navigation>` : ""}
1045
1048
  </div>
1046
1049
  <div class="content-body">
1047
1050
  <header>
1048
- ${this.isFrontOfId ? F() : $()}
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
- We'll use it to verify your identity.
1054
+ ${s("document.instructions.description")}
1052
1055
  </p>
1053
1056
  <p class="description padding-bottom-2">
1054
- Please follow the instructions below.
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">Good Light</p>
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
- Make sure the image is taken in a well-lit environment where the ID document is easy to read.
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">Clear Image</p>
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
- Hold your camera steady so the words on the ID are not blurry.
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
- Take Photo
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>Upload Photo</span>
1243
+ <span>${s("document.instructions.uploadPhotoButton")}</span>
1241
1244
  </label>
1242
1245
  ` : ""}
1243
1246
  </div>
@@ -1249,18 +1252,18 @@ ${this.hideAttribution ? "" : `
1249
1252
  </div>
1250
1253
  </div>
1251
1254
  </div>
1252
- ${C(this.themeColor)}
1255
+ ${y(this.themeColor)}
1253
1256
  `;
1254
1257
  }
1255
- class Z extends HTMLElement {
1258
+ class G extends HTMLElement {
1256
1259
  constructor() {
1257
- super(), this.templateString = V.bind(this), this.render = () => this.templateString(), this.attachShadow({ mode: "open" });
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");
1261
- e.innerHTML = this.render(), this.shadowRoot.appendChild(e.content.cloneNode(!0)), this.navigation = this.shadowRoot.querySelector("smileid-navigation"), this.takeDocumentPhotoButton = this.shadowRoot.querySelector("#take-photo"), this.uploadDocumentPhotoButton = this.shadowRoot.querySelector("#upload-photo"), this.navigation.addEventListener("navigation.back", () => {
1264
+ e.innerHTML = this.render(), this.shadowRoot.appendChild(e.content.cloneNode(!0)), this.navigation = this.shadowRoot.querySelector("smileid-navigation"), this.takeDocumentPhotoButton = this.shadowRoot.querySelector("#take-photo"), this.uploadDocumentPhotoButton = this.shadowRoot.querySelector("#upload-photo"), this.navigation?.addEventListener("navigation.back", () => {
1262
1265
  this.handleBackEvents();
1263
- }), this.navigation.addEventListener("navigation.close", () => {
1266
+ }), this.navigation?.addEventListener("navigation.close", () => {
1264
1267
  this.handleCloseEvents();
1265
1268
  }), this.takeDocumentPhotoButton && this.takeDocumentPhotoButton.addEventListener("click", () => {
1266
1269
  this.dispatchEvent(
@@ -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 f.retrieve(i);
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") || "Submit Front of ID";
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
- Z
1334
+ G
1329
1335
  );
1330
- const R = M.version, u = document.querySelector("smart-camera-web");
1331
- async function p(l) {
1336
+ const T = L.version, p = document.querySelector("smart-camera-web");
1337
+ async function m(u) {
1332
1338
  try {
1333
- const e = await c.getMedia({
1339
+ const e = await h.getMedia({
1334
1340
  audio: !1,
1335
- video: c.environmentOptions
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
- u?.dispatchEvent(
1345
+ p?.dispatchEvent(
1340
1346
  new CustomEvent("metadata.camera-name", {
1341
1347
  detail: { cameraName: i?.label }
1342
1348
  })
1343
- ), l.removeAttribute("data-camera-error"), l.setAttribute("data-camera-ready", !0);
1349
+ ), u.removeAttribute("data-camera-error"), u.setAttribute("data-camera-ready", !0);
1344
1350
  } catch (e) {
1345
- l.removeAttribute("data-camera-ready"), l.setAttribute(
1351
+ u.removeAttribute("data-camera-ready"), u.setAttribute(
1346
1352
  "data-camera-error",
1347
- c.handleCameraError(e)
1353
+ h.handleCameraError(e)
1348
1354
  );
1349
1355
  }
1350
1356
  }
1351
- class O extends HTMLElement {
1357
+ class j extends HTMLElement {
1352
1358
  constructor() {
1353
- super(), this.activeScreen = null, this.smartCameraWeb = this.closest("smart-camera-web"), u?.dispatchEvent(new CustomEvent("metadata.initialize"));
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
- ${C(this.themeColor)}
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='Submit Back of ID'
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} ${this.showNavigation}
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: R
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 ? (p(this.idCapture), this.setActiveScreen(this.idCapture)) : this.setActiveScreen(this.documentInstruction), this.setUpEventListeners();
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
- c.stopMedia(), u?.dispatchEvent(new CustomEvent("metadata.cleanup")), this.activeScreen && this.activeScreen.removeAttribute("hidden"), this.activeScreen = null, this.innerHTML = "";
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
- u?.dispatchEvent(
1408
+ p?.dispatchEvent(
1403
1409
  new CustomEvent("metadata.document-front-capture-start")
1404
- ), u?.dispatchEvent(
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 p(this.idCapture);
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
- u?.dispatchEvent(
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: w.ID_CARD_IMAGE_BASE64
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
- u?.dispatchEvent(
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: w.ID_CARD_IMAGE_BASE64
1428
- }), c.stopMedia(), this.setActiveScreen(this.idReview);
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
- u?.dispatchEvent(
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 p(this.idCapture)) : this.setActiveScreen(this.documentInstruction);
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 p(this.idCaptureBack)) : this.setActiveScreen(this.documentInstructionBack);
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
- u?.dispatchEvent(
1452
+ p?.dispatchEvent(
1447
1453
  new CustomEvent("metadata.document-back-capture-start")
1448
- ), u?.dispatchEvent(
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 p(this.idCaptureBack);
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 p(this.idCapture)) : this.setActiveScreen(this.documentInstruction);
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
- u?.dispatchEvent(
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: w.ID_CARD_BACK_IMAGE_BASE64
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
- u?.dispatchEvent(
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: w.ID_CARD_BACK_IMAGE_BASE64
1477
- }), this.setActiveScreen(this.backOfIdReview), c.stopMedia();
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 p(this.idCapture)) : this.setActiveScreen(this.documentInstructionBack);
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
- u?.dispatchEvent(
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 p(this.idCaptureBack)) : this.setActiveScreen(this.documentInstructionBack);
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", O);
1576
+ "customElements" in window && !customElements.get("document-capture-screens") && customElements.define("document-capture-screens", j);
1571
1577
  export {
1572
- O as D
1578
+ j as D
1573
1579
  };
1574
- //# sourceMappingURL=DocumentCaptureScreens-C5BhNB-0.js.map
1580
+ //# sourceMappingURL=DocumentCaptureScreens-BbtA-WkX.js.map