onfido-sdk-ui 14.59.0 → 14.60.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/LICENSE CHANGED
@@ -26,7 +26,7 @@ Description: A shared library to use in various capture packages
26
26
  ---
27
27
 
28
28
  Name: @onfido/sdk-analytics
29
- Version: 0.0.141
29
+ Version: 0.0.147
30
30
  License: null
31
31
  Private: false
32
32
  Description: Contracts for Onfido in-house analytics
@@ -252,7 +252,7 @@ SOFTWARE.
252
252
  ---
253
253
 
254
254
  Name: capture-module
255
- Version: 3.14.0
255
+ Version: 3.15.0
256
256
  License: null
257
257
  Private: false
258
258
 
@@ -293,7 +293,7 @@ SOFTWARE.
293
293
  ---
294
294
 
295
295
  Name: @onfido/capture-contract
296
- Version: 0.0.0-master.2163212
296
+ Version: 0.0.0-master.2215141
297
297
  License: null
298
298
  Private: false
299
299
  Description: Contracts for the SDKs and modules
package/Onfido.js CHANGED
@@ -1,82 +1,397 @@
1
- var d = Object.defineProperty;
2
- var h = (i, t, e) => t in i ? d(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
3
- var o = (i, t, e) => (h(i, typeof t != "symbol" ? t + "" : t, e), e);
4
- class l {
1
+ var U = Object.defineProperty;
2
+ var E = (e, i, n) => i in e ? U(e, i, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[i] = n;
3
+ var k = (e, i, n) => (E(e, typeof i != "symbol" ? i + "" : i, n), n);
4
+ class B {
5
5
  constructor() {
6
6
  this.eventListener = {};
7
7
  }
8
- addEventListener(t, e) {
9
- return this.eventListener[t] = this.eventListener[t] || [], this.eventListener[t].push(e), this;
8
+ addEventListener(i, n) {
9
+ return this.eventListener[i] = this.eventListener[i] || [], this.eventListener[i].push(n), this;
10
10
  }
11
- removeEventListener(t, e) {
12
- const n = this.eventListener[t];
13
- if (n) {
14
- let s;
15
- for (; (s = n.indexOf(e)) !== -1; )
16
- n.splice(s, 1);
11
+ removeEventListener(i, n) {
12
+ const r = this.eventListener[i];
13
+ if (r) {
14
+ let o;
15
+ for (; (o = r.indexOf(n)) !== -1; )
16
+ r.splice(o, 1);
17
17
  }
18
18
  }
19
- trigger(t, e) {
20
- (this.eventListener[t] || []).forEach((n) => {
21
- n == null || n(e);
19
+ trigger(i, n) {
20
+ (this.eventListener[i] || []).forEach((r) => {
21
+ r == null || r(n);
22
22
  });
23
23
  }
24
24
  }
25
- const v = "v14";
25
+ function L(e) {
26
+ return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
27
+ }
28
+ function O(e) {
29
+ if (e.__esModule)
30
+ return e;
31
+ var i = e.default;
32
+ if (typeof i == "function") {
33
+ var n = function r() {
34
+ return this instanceof r ? Reflect.construct(i, arguments, this.constructor) : i.apply(this, arguments);
35
+ };
36
+ n.prototype = i.prototype;
37
+ } else
38
+ n = {};
39
+ return Object.defineProperty(n, "__esModule", { value: !0 }), Object.keys(e).forEach(function(r) {
40
+ var o = Object.getOwnPropertyDescriptor(e, r);
41
+ Object.defineProperty(n, r, o.get ? o : {
42
+ enumerable: !0,
43
+ get: function() {
44
+ return e[r];
45
+ }
46
+ });
47
+ }), n;
48
+ }
49
+ function R(e) {
50
+ throw new Error('Could not dynamically require "' + e + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
51
+ }
52
+ var D = { exports: {} };
53
+ const N = {}, V = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
54
+ __proto__: null,
55
+ default: N
56
+ }, Symbol.toStringTag, { value: "Module" })), M = /* @__PURE__ */ O(V);
57
+ (function(e) {
58
+ (function() {
59
+ var i, n = 0, r = [], o;
60
+ for (o = 0; o < 256; o++)
61
+ r[o] = (o + 256).toString(16).substr(1);
62
+ d.BUFFER_SIZE = 4096, d.bin = l, d.clearBuffer = function() {
63
+ i = null, n = 0;
64
+ }, d.test = function(t) {
65
+ return typeof t == "string" ? /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(t) : !1;
66
+ };
67
+ var s;
68
+ typeof crypto < "u" ? s = crypto : typeof window < "u" && typeof window.msCrypto < "u" && (s = window.msCrypto), typeof R == "function" ? (s = s || M, e.exports = d) : typeof window < "u" && (window.uuid = d), d.randomBytes = function() {
69
+ if (s) {
70
+ if (s.randomBytes)
71
+ return s.randomBytes;
72
+ if (s.getRandomValues)
73
+ return typeof Uint8Array.prototype.slice != "function" ? function(t) {
74
+ var c = new Uint8Array(t);
75
+ return s.getRandomValues(c), Array.from(c);
76
+ } : function(t) {
77
+ var c = new Uint8Array(t);
78
+ return s.getRandomValues(c), c;
79
+ };
80
+ }
81
+ return function(t) {
82
+ var c, f = [];
83
+ for (c = 0; c < t; c++)
84
+ f.push(Math.floor(Math.random() * 256));
85
+ return f;
86
+ };
87
+ }();
88
+ function p(t) {
89
+ return (!i || n + t > d.BUFFER_SIZE) && (n = 0, i = d.randomBytes(d.BUFFER_SIZE)), i.slice(n, n += t);
90
+ }
91
+ function l() {
92
+ var t = p(16);
93
+ return t[6] = t[6] & 15 | 64, t[8] = t[8] & 63 | 128, t;
94
+ }
95
+ function d() {
96
+ var t = l();
97
+ return r[t[0]] + r[t[1]] + r[t[2]] + r[t[3]] + "-" + r[t[4]] + r[t[5]] + "-" + r[t[6]] + r[t[7]] + "-" + r[t[8]] + r[t[9]] + "-" + r[t[10]] + r[t[11]] + r[t[12]] + r[t[13]] + r[t[14]] + r[t[15]];
98
+ }
99
+ })();
100
+ })(D);
101
+ var P = D.exports;
102
+ const _ = /* @__PURE__ */ L(P);
103
+ var a;
104
+ (function(e) {
105
+ e.MicrophonePermissionDenied = "MicrophonePermissionDenied", e.CameraPermissionDenied = "CameraPermissionDenied", e.PermissionsUnavailable = "PermissionsUnavailable", e.CameraNotDetected = "CameraNotDetected", e.CameraException = "CameraException", e.FailedToWriteToDisk = "FailedToWriteToDisk", e.InvalidImageData = "InvalidImageData", e.WorkflowTaskAbandoned = "WorkflowTaskAbandoned", e.WorkflowTaskError = "WorkflowTaskError", e.BiometricTokenRetrievalException = "BiometricTokenRetrievalException", e.WorkflowBiometricTokenStorageException = "WorkflowBiometricTokenStorageException", e.CrossDeviceRestartError = "CrossDeviceRestartError", e.CrossDeviceDesktopError = "CrossDeviceDesktopError", e.CrossDeviceVerificationInvalidError = "CrossDeviceVerificationInvalidError", e.CrossDeviceVerificationAbortError = "CrossDeviceVerificationAbortError", e.InvalidToken = "InvalidToken", e.ExpiredToken = "ExpiredToken", e.ExpiredTrial = "ExpiredTrial", e.NetworkException = "NetworkException", e.UploadError = "UploadError", e.InitialisationInvalid = "InitialisationInvalid", e.SdkVersionInsufficient = "SdkVersionInsufficient", e.UnsupportedError = "UnsupportedError", e.UnsupportedFeatureError = "UnsupportedFeatureError", e.InvalidSdkParameter = "InvalidSdkParameter", e.FeaturesNotAuthorized = "FeaturesNotAuthorized", e.MissingSteps = "MissingSteps", e.DuplicateStep = "DuplicateStep", e.WelcomeMustBeFirstStep = "WelcomeMustBeFirstStep", e.WorkflowVersionMismatch = "WorkflowVersionMismatch", e.WorkflowInputError = "WorkflowInputError", e.MissingLogoCobrandingParameter = "MissingLogoCobrandingParameter", e.InvalidCustomTranslations = "InvalidCustomTranslations", e.InvalidCountryCode = "InvalidCountryCode", e.InvalidDocumentFormatAndCountryCombination = "InvalidDocumentFormatAndCountryCombination", e.InvalidDocumentTypeException = "InvalidDocumentTypeException", e.InvalidDocumentTitle = "InvalidDocumentTitle", e.DuplicateGenericDocument = "DuplicateGenericDocument", e.NfcInputNotAvailable = "NfcInputNotAvailable", e.AppTerminated = "AppTerminated", e.GenericException = "GenericException", e.GeoBlocked = "GeoBlocked", e.ModuleLoadError = "ModuleLoadError";
106
+ })(a || (a = {}));
107
+ var b;
108
+ (function(e) {
109
+ e.UserExit = "UserExit", e.ConsentDenied = "ConsentDenied", e.RequiredNfcNotCompleted = "RequiredNfcNotCompleted";
110
+ })(b || (b = {}));
111
+ var x;
112
+ (function(e) {
113
+ e.AppInBackground = "AppInBackground", e.AppInactive = "AppInactive";
114
+ })(x || (x = {}));
115
+ var C;
116
+ (function(e) {
117
+ e.AppBackInForeground = "AppBackInForeground", e.AppBackToActive = "AppBackToActive";
118
+ })(C || (C = {}));
119
+ a.CrossDeviceRestartError;
120
+ a.CrossDeviceDesktopError;
121
+ a.CrossDeviceVerificationInvalidError;
122
+ a.CrossDeviceVerificationAbortError;
123
+ const I = {
124
+ type: "invalid_token",
125
+ message: "The token is invalid.",
126
+ level: "external"
127
+ /* EXTERNAL */
128
+ // does not exist in analytics types
129
+ };
130
+ a.WorkflowTaskAbandoned;
131
+ a.WorkflowInputError;
132
+ a.ExpiredToken;
133
+ a.ExpiredTrial;
134
+ a.GeoBlocked;
135
+ a.PermissionsUnavailable;
136
+ a.GenericException;
137
+ a.UnsupportedError;
138
+ a.UnsupportedFeatureError;
139
+ a.InitialisationInvalid;
140
+ a.SdkVersionInsufficient;
141
+ a.CameraNotDetected;
142
+ a.ModuleLoadError;
143
+ class h extends Error {
144
+ constructor({
145
+ type: i,
146
+ message: n,
147
+ level: r,
148
+ exception: o,
149
+ stack: s,
150
+ body: p,
151
+ httpCode: l,
152
+ analyticsError: d
153
+ }) {
154
+ super(n), this.name = "SdkError", this.type = i, this.level = r, this.exception = o, this.body = p, this.httpCode = l, this.analyticsError = d, s && (this.stack = s);
155
+ }
156
+ encode() {
157
+ return {
158
+ name: this.name,
159
+ type: this.type,
160
+ message: this.message,
161
+ level: this.level,
162
+ stack: this.stack,
163
+ exception: this.exception,
164
+ body: this.body,
165
+ httpCode: this.httpCode,
166
+ analyticsError: this.analyticsError
167
+ };
168
+ }
169
+ static decode(i) {
170
+ return i.name === "SdkError" ? new h({
171
+ type: i.type,
172
+ message: i.message,
173
+ level: i.level,
174
+ exception: i.exception,
175
+ stack: i.stack,
176
+ body: i.body,
177
+ httpCode: i.httpCode,
178
+ analyticsError: i.analyticsError
179
+ }) : i;
180
+ }
181
+ }
182
+ const W = (e) => {
183
+ const { payload: i, urls: n } = e;
184
+ return {
185
+ sub: e.sub,
186
+ type: e.iss === "studio" ? "studio" : "sdk",
187
+ enterpriseFeatures: e.enterprise_features,
188
+ urls: {
189
+ authUrl: n.auth_url,
190
+ detectDocumentUrl: n.detect_document_url,
191
+ hostedSdkUrl: n.hosted_sdk_url,
192
+ syncUrl: n.sync_url,
193
+ onfidoApiUrl: n.onfido_api_url,
194
+ telephonyUrl: n.telephony_url,
195
+ crossDeviceUrl: n.cross_device_url
196
+ },
197
+ exp: e.exp,
198
+ payload: {
199
+ applicantUuid: i.app,
200
+ applicationId: i.application_id,
201
+ clientUuid: i.client_uuid,
202
+ isSandbox: i.is_sandbox,
203
+ isTrial: i.is_trial
204
+ }
205
+ };
206
+ }, j = (e) => {
207
+ if (!e)
208
+ throw new h(I);
209
+ try {
210
+ return W(JSON.parse(atob(e.split(".")[1])));
211
+ } catch {
212
+ throw new h(I);
213
+ }
214
+ }, T = "14", q = "14.45.0";
215
+ var v = /* @__PURE__ */ ((e) => (e.Npm = "Npm", e.Evergreen = "Evergreen", e))(v || {}), y = /* @__PURE__ */ ((e) => (e.Started = "Started", e.Error = "Error", e.Retry = "Retry", e.Fallback = "Fallback", e.Completed = "Completed", e))(y || {});
216
+ const G = (e) => `v${(e || T).replace(/^v/, "")}`, m = (e) => `${e || T}`.replace(/^v/g, ""), $ = (e) => e.charAt(0).toUpperCase() + e.slice(1), g = (e, i, n = {}, r, o) => {
217
+ var s, p;
218
+ try {
219
+ if ("token" in e) {
220
+ const l = e.token, d = j(l);
221
+ let t = "Light";
222
+ (s = e.theme) != null && s.name && (t = $((p = e.theme) == null ? void 0 : p.name));
223
+ const c = e.language || "en-GB";
224
+ let f = [];
225
+ "steps" in e && (f = e.steps.map((u) => typeof u == "object" && "type" in u ? u.type : u)), fetch(`${d.urls.onfidoApiUrl}/v4/sdk/analytics`, {
226
+ method: "POST",
227
+ // @ts-ignore wip
228
+ headers: {
229
+ "Content-Type": "application/json",
230
+ authorization: `Bearer ${l}`,
231
+ "x-onfido-sdk-platform": "web",
232
+ "x-onfido-sdk-version": n == null ? void 0 : n.version
233
+ },
234
+ body: JSON.stringify({
235
+ context: {
236
+ device: {
237
+ deviceType: "Desktop",
238
+ hardware: {},
239
+ os: {
240
+ deviceLanguages: []
241
+ },
242
+ browser: {
243
+ userAgent: navigator.userAgent
244
+ }
245
+ },
246
+ runtimeInfo: {
247
+ client: {
248
+ clientId: d.payload.clientUuid
249
+ },
250
+ identifiers: {
251
+ sessionId: _(),
252
+ applicantId: d.payload.applicantUuid
253
+ },
254
+ appInfo: {
255
+ referrer: ""
256
+ },
257
+ emittedAt: (/* @__PURE__ */ new Date()).toISOString(),
258
+ crossDevice: !1
259
+ },
260
+ sdkInfo: {
261
+ library: {
262
+ sdk: "Web",
263
+ version: (n == null ? void 0 : n.version) || m(q),
264
+ pinnedVersion: m(e.version),
265
+ variant: "Bundled",
266
+ analyticsLibraryVersion: "0.0.141"
267
+ }
268
+ },
269
+ configuration: {
270
+ analytics: {
271
+ loggingLevel: []
272
+ },
273
+ callback: {},
274
+ ui: {
275
+ themeConfigured: t
276
+ },
277
+ orchestration: {
278
+ steps: f
279
+ },
280
+ languageInformation: {
281
+ displayedLocaleCode: c
282
+ },
283
+ clientDomain: location == null ? void 0 : location.href,
284
+ scriptHostname: "sdk.onfido.com"
285
+ },
286
+ dynamicRuntimeInfo: []
287
+ },
288
+ events: [
289
+ {
290
+ ...i,
291
+ errorInfo: r,
292
+ duration: o,
293
+ eventMetadata: {
294
+ runtimeId: _(),
295
+ generatedAt: (/* @__PURE__ */ new Date()).toISOString()
296
+ }
297
+ }
298
+ ]
299
+ })
300
+ }).catch((u) => {
301
+ console.error(u);
302
+ });
303
+ }
304
+ } catch (l) {
305
+ console.error(l);
306
+ }
307
+ };
26
308
  window.OnfidoDistribution = { name: "NPM" };
27
- class c extends l {
309
+ class z extends B {
28
310
  constructor() {
29
311
  super(...arguments);
30
- o(this, "_handle");
31
- o(this, "_handleSetCallbacks", []);
312
+ k(this, "_handle");
313
+ k(this, "_handleSetCallbacks", []);
32
314
  }
33
- _setHandle(e) {
34
- this._handle = e, this._handleSetCallbacks.forEach((n) => n(e)), this._handleSetCallbacks = [], Object.entries(this.eventListener).forEach(([n, s]) => {
35
- e.addEventListener(n, s);
315
+ _setHandle(n) {
316
+ this._handle = n, this._handleSetCallbacks.forEach((r) => r(n)), this._handleSetCallbacks = [], Object.entries(this.eventListener).forEach(([r, o]) => {
317
+ n.addEventListener(r, o);
36
318
  }), this.eventListener = {};
37
319
  }
38
- addEventListener(e, n) {
39
- return this._handle ? (this._handle.addEventListener(e, n), this) : super.addEventListener(e, n);
320
+ addEventListener(n, r) {
321
+ return this._handle ? (this._handle.addEventListener(n, r), this) : super.addEventListener(n, r);
40
322
  }
41
- removeEventListener(e, n) {
323
+ removeEventListener(n, r) {
42
324
  if (this._handle)
43
- return this._handle.removeEventListener(e, n), this;
44
- super.removeEventListener(e, n);
325
+ return this._handle.removeEventListener(n, r), this;
326
+ super.removeEventListener(n, r);
45
327
  }
46
328
  async tearDown() {
47
- var e;
329
+ var n;
48
330
  if (this._handle)
49
- await ((e = this._handle) == null ? void 0 : e.tearDown());
331
+ await ((n = this._handle) == null ? void 0 : n.tearDown());
50
332
  else
51
333
  return this._handleSetCallbacks.push(() => {
52
334
  this.tearDown();
53
335
  }), Promise.resolve();
54
336
  }
55
337
  get version() {
56
- var e;
57
- return (e = this._handle) == null ? void 0 : e.version;
338
+ var n;
339
+ return (n = this._handle) == null ? void 0 : n.version;
58
340
  }
59
341
  }
60
- const a = (i) => `v${(i || v).replace(/^v/, "")}`, r = {
61
- init(i) {
62
- const t = new c();
63
- return import(/* webpackIgnore: true */ /* @vite-ignore */ i.sdkUrl || `https://sdk.onfido.com/${a(i.version)}/Onfido.js`).then((n) => {
64
- const { Onfido: s } = n;
65
- t._setHandle(s.init(i));
66
- }).catch((n) => {
342
+ const A = {
343
+ init(e) {
344
+ const i = new z(), n = m(e.version), r = e.sdkUrl || `https://sdk.onfido.com/${G(e.version)}/Onfido.js`;
345
+ return g(
346
+ e,
347
+ {
348
+ identifier: "LoaderStateEvent",
349
+ state: y.Started,
350
+ loaderSource: v.Npm
351
+ },
352
+ {
353
+ version: n
354
+ }
355
+ ), import(/* webpackIgnore: true */ /* @vite-ignore */ r).then((o) => {
356
+ g(
357
+ e,
358
+ {
359
+ identifier: "LoaderStateEvent",
360
+ state: y.Completed,
361
+ loaderSource: v.Npm
362
+ },
363
+ {
364
+ version: n
365
+ }
366
+ );
367
+ const { Onfido: s } = o;
368
+ i._setHandle(s.init(e));
369
+ }).catch((o) => {
67
370
  var s;
68
- t.trigger("error", { error: n }), (s = i.onError) == null || s.call(i, n);
69
- }), t;
371
+ g(
372
+ e,
373
+ {
374
+ identifier: "LoaderStateEvent",
375
+ state: y.Error,
376
+ loaderSource: v.Npm
377
+ },
378
+ {
379
+ version: n
380
+ },
381
+ {
382
+ message: o == null ? void 0 : o.message
383
+ }
384
+ ), i.trigger("error", { error: o }), (s = e.onError) == null || s.call(e, o);
385
+ }), i;
70
386
  }
71
387
  };
72
- Object.defineProperty(r, "environment", {
388
+ Object.defineProperty(A, "environment", {
73
389
  get: () => window == null ? void 0 : window.Onfido.environment,
74
- set: (i) => {
75
- window.Onfido = window.Onfido || {}, window.Onfido.environment = i;
390
+ set: (e) => {
391
+ window.Onfido = window.Onfido || {}, window.Onfido.environment = e;
76
392
  }
77
393
  });
78
- const L = r;
394
+ const K = A;
79
395
  export {
80
- L as Onfido,
81
- a as prefixVersion
396
+ K as Onfido
82
397
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "onfido-sdk-ui",
3
- "version": "14.59.0",
3
+ "version": "14.60.0",
4
4
  "description": "JavaScript SDK view layer for Onfido identity verification",
5
5
  "author": "Onfido Customer Support <support@onfido.com> (https://documentation.onfido.com/sdk/web/)",
6
6
  "repository": {
@@ -2,6 +2,7 @@ export type FaceMotionModuleConfiguration = {
2
2
  recordAudio?: boolean;
3
3
  showIntro?: boolean;
4
4
  randomizeChallenge?: boolean;
5
+ livenessType?: 'two_head_turns' | 'four_random_head_turns' | 'passive';
5
6
  };
6
7
  type FaceMotionVariantType = 'motion';
7
8
  export type EncryptedBiometricTokenType = {
@@ -25,7 +25,9 @@ export type CommonSdkParameters = {
25
25
  enterpriseFeatures?: EnterpriseFeatureParameter;
26
26
  language?: string | LegacyLanguageParameter;
27
27
  translations?: Translations;
28
- theme?: CaptureTheme;
28
+ theme?: CaptureTheme & {
29
+ name?: string;
30
+ };
29
31
  navigation?: CaptureNavigation;
30
32
  };
31
33
  export type LegacyLanguageParameter = {
@@ -31,6 +31,7 @@ export type Configuration<T = unknown> = {
31
31
  };
32
32
  language?: string;
33
33
  workflowRunId?: string;
34
+ taskId?: string | null;
34
35
  };
35
36
  export type Input = Record<string, unknown>;
36
37
  export type Empty = Record<string, never>;
@@ -103,6 +104,7 @@ export type ClientConfiguration = {
103
104
  sessionUuid: string;
104
105
  workflowRunId: string | undefined;
105
106
  steps: LegacyStepDefinition[];
107
+ roomId?: string;
106
108
  referrer?: string;
107
109
  domain?: string;
108
110
  };