@tsocial/tvweb-sdk.platform 0.0.0-beta.20251215-093759 → 0.0.0-beta.20251215-165409

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.
@@ -19095,7 +19095,7 @@
19095
19095
  t.decode = t.parse = w, t.encode = t.stringify = k;
19096
19096
  }), A = (E.decode, E.parse, E.encode, E.stringify), B = function() {
19097
19097
  function e(e) {
19098
- this.authorizer = e.authorizer, this.domain = e.domain, this.onError = e.onError, this.configHeaders = e.headers, this.fallbackUrls = e.fallbackUrls;
19098
+ this.authorizer = e.authorizer, this.domain = e.domain, this.onError = e.onError, this.configHeaders = e.headers, this.fallbackUrls = e.fallbackUrls, this.requestTimeoutMs = e.requestTimeoutMs;
19099
19099
  }
19100
19100
  return e.prototype.get = function(e, t, r) {
19101
19101
  var n = new URL(this.resolveUrl(e));
@@ -19155,13 +19155,24 @@
19155
19155
  requestPath: e,
19156
19156
  method: "GET"
19157
19157
  }, "blob");
19158
+ }, e.prototype.setupTimeout = function() {
19159
+ if (!this.requestTimeoutMs || this.requestTimeoutMs <= 0) return {};
19160
+ var e = new AbortController, t = setTimeout(function() {
19161
+ e.abort();
19162
+ }, this.requestTimeoutMs);
19163
+ return {
19164
+ abortController: e,
19165
+ timeoutId: t
19166
+ };
19167
+ }, e.prototype.cleanupTimeout = function(e) {
19168
+ e && clearTimeout(e);
19158
19169
  }, e.prototype.request = function(e, t, r) {
19159
19170
  return void 0 === r && (r = "json"), s(this, void 0, void 0, function() {
19160
- var n, a, o, s, l, u;
19171
+ var n, a, o, s, l, u, d, f, h;
19161
19172
  return c(this, function(c) {
19162
19173
  switch(c.label){
19163
19174
  case 0:
19164
- n = {}, a = {}, this.authorizer && (n = this.authorizer.getHeaders(t)), this.configHeaders && (a = this.configHeaders), t.headers = i(i(i({}, t.headers), n), a), c.label = 1;
19175
+ n = {}, a = {}, this.authorizer && (n = this.authorizer.getHeaders(t)), this.configHeaders && (a = this.configHeaders), t.headers = i(i(i({}, t.headers), n), a), s = (o = this.setupTimeout()).abortController, l = o.timeoutId, s && (t.signal = s.signal), c.label = 1;
19165
19176
  case 1:
19166
19177
  return c.trys.push([
19167
19178
  1,
@@ -19173,22 +19184,22 @@
19173
19184
  fetch(e, t)
19174
19185
  ];
19175
19186
  case 2:
19176
- return o = c.sent(), [
19187
+ return u = c.sent(), this.cleanupTimeout(l), [
19177
19188
  4,
19178
- "blob" === r ? o.blob() : o.json()
19189
+ "blob" === r ? u.blob() : u.json()
19179
19190
  ];
19180
19191
  case 3:
19181
- if ((s = c.sent()).errors && this.onError) throw this.onError(s.errors), s;
19192
+ if ((d = c.sent()).errors && this.onError) throw this.onError(d.errors), d;
19182
19193
  return [
19183
19194
  2,
19184
- s
19195
+ d
19185
19196
  ];
19186
19197
  case 4:
19187
- if (l = c.sent(), this.shouldRetryWithFallback(l) && Array.isArray(this.fallbackUrls) && this.fallbackUrls.length > 0) return u = "GET" === t.method ? new URL(e).searchParams : null, [
19198
+ if (f = c.sent(), this.cleanupTimeout(l), this.shouldRetryWithFallback(f) && Array.isArray(this.fallbackUrls) && this.fallbackUrls.length > 0) return h = "GET" === t.method ? new URL(e).searchParams : null, [
19188
19199
  2,
19189
- this.retryWithFallback(t.requestPath, t, u, r)
19200
+ this.retryWithFallback(t.requestPath, t, h, r)
19190
19201
  ];
19191
- throw l;
19202
+ throw f;
19192
19203
  case 5:
19193
19204
  return [
19194
19205
  2
@@ -19204,41 +19215,41 @@
19204
19215
  return "AbortError" === e.name ? (console.error("Request timed out"), !0) : e instanceof TypeError && (console.error("Network error occurred:", e.message), !0);
19205
19216
  }, e.prototype.retryWithFallback = function(e, t, r, n) {
19206
19217
  return void 0 === r && (r = null), void 0 === n && (n = "json"), s(this, void 0, void 0, function() {
19207
- var i, a, o, s, l, u;
19218
+ var a, o, s, l, u, d, f, h, p, m;
19208
19219
  return c(this, function(c) {
19209
19220
  switch(c.label){
19210
19221
  case 0:
19211
19222
  if (!Array.isArray(this.fallbackUrls) || 0 === this.fallbackUrls.length) throw Error("No fallback URLs available");
19212
- i = null, a = 0, c.label = 1;
19223
+ a = null, o = 0, c.label = 1;
19213
19224
  case 1:
19214
- if (!(a < this.fallbackUrls.length)) return [
19225
+ if (!(o < this.fallbackUrls.length)) return [
19215
19226
  3,
19216
19227
  7
19217
19228
  ];
19218
- c.label = 2;
19229
+ l = (s = this.setupTimeout()).abortController, u = s.timeoutId, c.label = 2;
19219
19230
  case 2:
19220
19231
  return c.trys.push([
19221
19232
  2,
19222
19233
  5,
19223
19234
  ,
19224
19235
  6
19225
- ]), o = new URL(this.resolveFallbackUrl(e, this.fallbackUrls[a])), r && "GET" === t.method && (o.search = r.toString()), [
19236
+ ]), d = new URL(this.resolveFallbackUrl(e, this.fallbackUrls[o])), r && "GET" === t.method && (d.search = r.toString()), f = i({}, t), l && (f.signal = l.signal), [
19226
19237
  4,
19227
- fetch(o.toString(), t)
19238
+ fetch(d.toString(), f)
19228
19239
  ];
19229
19240
  case 3:
19230
- return s = c.sent(), [
19241
+ return h = c.sent(), this.cleanupTimeout(u), [
19231
19242
  4,
19232
- "blob" === n ? s.blob() : s.json()
19243
+ "blob" === n ? h.blob() : h.json()
19233
19244
  ];
19234
19245
  case 4:
19235
- if ((l = c.sent()).errors && this.onError) throw this.onError(l.errors), l;
19246
+ if ((p = c.sent()).errors && this.onError) throw this.onError(p.errors), p;
19236
19247
  return [
19237
19248
  2,
19238
- l
19249
+ p
19239
19250
  ];
19240
19251
  case 5:
19241
- return i = u = c.sent(), this.shouldRetryWithFallback(u) ? [
19252
+ return m = c.sent(), this.cleanupTimeout(u), a = m, this.shouldRetryWithFallback(m) ? [
19242
19253
  3,
19243
19254
  6
19244
19255
  ] : [
@@ -19246,12 +19257,12 @@
19246
19257
  7
19247
19258
  ];
19248
19259
  case 6:
19249
- return a++, [
19260
+ return o++, [
19250
19261
  3,
19251
19262
  1
19252
19263
  ];
19253
19264
  case 7:
19254
- throw i;
19265
+ throw a;
19255
19266
  }
19256
19267
  });
19257
19268
  });
@@ -19570,12 +19581,13 @@
19570
19581
  }
19571
19582
  function L(e, t, r, n) {
19572
19583
  void 0 === r && (r = "production");
19573
- var i = void 0 === n ? {} : n, a = i.headers, o = i.fallbackUrls;
19584
+ var i = void 0 === n ? {} : n, a = i.headers, o = i.fallbackUrls, s = i.requestTimeoutMs;
19574
19585
  return new B({
19575
19586
  authorizer: new M(e, t),
19576
19587
  domain: N(r),
19577
19588
  headers: a,
19578
- fallbackUrls: o
19589
+ fallbackUrls: o,
19590
+ requestTimeoutMs: s
19579
19591
  });
19580
19592
  }
19581
19593
  var D = function() {
@@ -30444,7 +30456,8 @@
30444
30456
  }), this.transactionEnabled = i.supportTransaction || !1, this.encryptionEnabled = i.enableEncryption || !1;
30445
30457
  var a = L(e, t, r, {
30446
30458
  headers: i.httpHeaders,
30447
- fallbackUrls: i.fallbackUrls
30459
+ fallbackUrls: i.fallbackUrls,
30460
+ requestTimeoutMs: i.requestTimeoutMs
30448
30461
  });
30449
30462
  this.transactionManager = new j(a), this.encryptionService = new rq(t), this.compareFaceService = new d(a), this.clientSettingsService = new f(a), this.convertPDFService = new b(a), this.ekycPDFService = new v(a), this.readIDCardService = new n(a), this.requestVerifyIDCardService = new p(a), this.requestVerifyPortraitSerivce = new m(a), this.imagesService = new l(a), this.fileService = new u(a), this.verifyFaceLivenessService = new h(a), this.searchFaceService = new y(a), this.detectIDTamperingService = new g(a), this.httpClient = a;
30450
30463
  }
@@ -33770,7 +33783,7 @@
33770
33783
  }, nS$1;
33771
33784
  }();
33772
33785
  function nB$1() {
33773
- return "0.0.0-beta.20251215-093759";
33786
+ return "0.0.0-beta.20251215-165409";
33774
33787
  }
33775
33788
  function nI$1() {
33776
33789
  return {
@@ -41246,49 +41259,56 @@
41246
41259
  }, uz;
41247
41260
  }(), uG);
41248
41261
  }();
41249
- function dm() {
41262
+ let dm = d_, dg = d_, dy = db();
41263
+ for(;;)try {
41264
+ if (parseInt(dg(378)) / 1 + -parseInt(dg(391)) / 2 * (-parseInt(dg(386)) / 3) + parseInt(dg(380)) / 4 * (parseInt(dg(384)) / 5) + -parseInt(dg(381)) / 6 + -parseInt(dg(383)) / 7 * (-parseInt(dg(377)) / 8) + -parseInt(dg(379)) / 9 + -parseInt(dg(367)) / 10 * (-parseInt(dg(372)) / 11) === 229615) break;
41265
+ dy.push(dy.shift());
41266
+ } catch (e) {
41267
+ dy.push(dy.shift());
41268
+ }
41269
+ function db() {
41250
41270
  let e = [
41251
- "391796qAHBQP",
41252
- "2a8648ce3d",
41253
- "ZIzj0CAQYI",
41271
+ "25310HBUOBg",
41272
+ "DepBO8t60S",
41273
+ "MFkwEwYHKo",
41274
+ "3059301306",
41275
+ "+faHkP3QC3",
41276
+ "407Ilvdnt",
41277
+ "44P0rKKsZK",
41278
+ "3d02010608",
41254
41279
  "ytJdcsPxrD",
41255
- "44160GNFAeO",
41256
- "758970ENfGty",
41280
+ "D9EKOWS+U4",
41281
+ "14552FNqEza",
41282
+ "101165gbwSGf",
41283
+ "3599838cBdphG",
41284
+ "96444qpbkcR",
41285
+ "671448TAUmcs",
41286
+ "072a8648ce",
41287
+ "532kymtpA",
41288
+ "45uWuFYC",
41257
41289
  "MfPrcYTM70",
41258
- "44P0rKKsZK",
41259
- "MFkwEwYHKo",
41290
+ "6ocbIJZ",
41260
41291
  "000",
41261
- "120612DuHKxu",
41262
- "DepBO8t60S",
41263
- "3059301306",
41264
- "ssRdXLZEX8",
41292
+ "0301070342",
41293
+ "KoZIzj0DAQ",
41294
+ "ZIzj0CAQYI",
41295
+ "191450lvsUWR",
41296
+ "2a8648ce3d",
41265
41297
  "cDQgAE9h6Z",
41266
- "2919fSUnYj",
41267
- "9720kJycIQ",
41268
- "+faHkP3QC3",
41269
- "212094GlWFgW",
41270
- "KA==",
41271
- "315786GasSwN"
41298
+ "KA=="
41272
41299
  ];
41273
- return (dm = function() {
41300
+ return (db = function() {
41274
41301
  return e;
41275
41302
  })();
41276
41303
  }
41277
- let dg = d_, dy = d_, db = dm();
41278
- for(;;)try {
41279
- if (parseInt(dy(292)) / 1 + parseInt(dy(295)) / 2 + -parseInt(dy(299)) / 3 + parseInt(dy(305)) / 4 + parseInt(dy(300)) / 5 + parseInt(dy(294)) / 6 + parseInt(dy(289)) / 7 * (-parseInt(dy(290)) / 8) === 121195) break;
41280
- db.push(db.shift());
41281
- } catch (e) {
41282
- db.push(db.shift());
41283
- }
41284
- let dv = dg(307) + "072a8648ce3d02010608" + dg(296) + "0301070342" + dg(304);
41304
+ let dv = dm(370) + dm(382) + dm(374) + dm(392) + dm(388) + dm(387);
41285
41305
  function d_(e, t) {
41286
- let r = dm();
41306
+ let r = db();
41287
41307
  return (d_ = function(e, t) {
41288
- return r[e -= 288];
41308
+ return r[e -= 366];
41289
41309
  })(e, t);
41290
41310
  }
41291
- let dx = dg(303) + dg(297) + "KoZIzj0DAQ" + dg(288) + dg(306) + dg(298) + dg(291) + dg(302) + "Mjci1ul8mmD9EKOWS+U4" + dg(301) + dg(308) + dg(293);
41311
+ let dx = dm(369) + dm(390) + dm(389) + dm(393) + dm(368) + dm(375) + dm(371) + dm(373) + "Mjci1ul8mm" + dm(376) + dm(385) + "ssRdXLZEX8" + dm(366);
41292
41312
  async function dC(e) {
41293
41313
  let t = new TextEncoder().encode(e);
41294
41314
  return Array.from(new Uint8Array(await crypto.subtle.digest("SHA-256", t))).map((e)=>e.toString(16).padStart(2, "0")).join("");
@@ -43355,7 +43375,8 @@
43355
43375
  "x-request-id": e,
43356
43376
  ...r
43357
43377
  },
43358
- fallbackUrls: c
43378
+ fallbackUrls: c,
43379
+ requestTimeoutMs: 6e4
43359
43380
  }), {
43360
43381
  onDone: n
43361
43382
  });
@@ -43384,7 +43405,8 @@
43384
43405
  "x-request-id": l,
43385
43406
  ...r
43386
43407
  },
43387
- fallbackUrls: s
43408
+ fallbackUrls: s,
43409
+ requestTimeoutMs: 6e4
43388
43410
  }), {
43389
43411
  onDone: ()=>{}
43390
43412
  });
@@ -90527,7 +90549,7 @@
90527
90549
  }
90528
90550
  };
90529
90551
 
90530
- const videoSettings$3 = libExports.isMobile ? {
90552
+ const videoSettings$5 = libExports.isMobile ? {
90531
90553
  // aspectRatio: 16 / 9,
90532
90554
  width: {
90533
90555
  ideal: 640
@@ -91306,7 +91328,7 @@
91306
91328
  flipHorizontal: frontCamera,
91307
91329
  ref: videoRef,
91308
91330
  onError: onErrorCallback,
91309
- videoSettings: videoSettings$3,
91331
+ videoSettings: videoSettings$5,
91310
91332
  closeButton: /*#__PURE__*/ jsxRuntimeExports.jsx(CloseIcon, {}),
91311
91333
  children: /*#__PURE__*/ jsxRuntimeExports.jsxs(WarmUpOverlay, {
91312
91334
  overlay: !warmupDone || !isPlaying,
@@ -91868,11 +91890,11 @@
91868
91890
  extraConfig: null
91869
91891
  };
91870
91892
 
91871
- const DirectionalIcon = dt$1.img`
91893
+ const DirectionalIcon$1 = dt$1.img`
91872
91894
  width: ${({ width })=>width};
91873
91895
  `;
91874
91896
  // eslint-disable-next-line react/require-default-props
91875
- function DirectionIcon({ type }) {
91897
+ function DirectionIcon$1({ type }) {
91876
91898
  const theme = nt$2();
91877
91899
  // default icons and widths based on version
91878
91900
  const iconDirection = useThemeIcon(`Selfie.Active.directionIcon.${type}`, `${type}_arrow.gif`);
@@ -91889,7 +91911,7 @@
91889
91911
  if (type === ra$1.FaceDirection.FRONTAL) {
91890
91912
  // For frontal direction, use the SVG icon if available
91891
91913
  if (frontalIcon) {
91892
- return /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionalIcon, {
91914
+ return /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionalIcon$1, {
91893
91915
  src: frontalIcon,
91894
91916
  width: iconWidth,
91895
91917
  alt: ""
@@ -91897,20 +91919,20 @@
91897
91919
  }
91898
91920
  }
91899
91921
  if (directionIconSrc && directionIconSrc !== null) {
91900
- return /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionalIcon, {
91922
+ return /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionalIcon$1, {
91901
91923
  src: get(theme, `Selfie.Active.directionIcon.${type}`),
91902
91924
  width: iconWidth,
91903
91925
  alt: ""
91904
91926
  });
91905
91927
  }
91906
91928
  // fallback to default icons and width
91907
- return /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionalIcon, {
91929
+ return /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionalIcon$1, {
91908
91930
  src: iconDirection,
91909
91931
  alt: "",
91910
91932
  width: iconWidth
91911
91933
  });
91912
91934
  }
91913
- DirectionIcon.propTypes = {
91935
+ DirectionIcon$1.propTypes = {
91914
91936
  type: PropTypes.oneOf([
91915
91937
  ra$1.FaceDirection.LEFT,
91916
91938
  ra$1.FaceDirection.RIGHT,
@@ -91918,12 +91940,12 @@
91918
91940
  ra$1.FaceDirection.FRONTAL
91919
91941
  ])
91920
91942
  };
91921
- DirectionIcon.defaultProps = {
91943
+ DirectionIcon$1.defaultProps = {
91922
91944
  type: ra$1.FaceDirection.LEFT
91923
91945
  };
91924
91946
 
91925
91947
  // To reduce the calculation for blazeface
91926
- const videoSettings$2 = libExports.isMobile ? {
91948
+ const videoSettings$4 = libExports.isMobile ? {
91927
91949
  width: {
91928
91950
  ideal: 640
91929
91951
  }
@@ -92048,7 +92070,7 @@
92048
92070
  onClose: onCloseCallback,
92049
92071
  flipHorizontal: flipVideoHorizontal ?? frontCamera,
92050
92072
  ref: refVideo,
92051
- videoSettings: videoSettings$2,
92073
+ videoSettings: videoSettings$4,
92052
92074
  onError: onErrorCallback,
92053
92075
  scale: cameraScale,
92054
92076
  defaultCameraId: defaultCameraId,
@@ -92159,16 +92181,16 @@
92159
92181
  isLoading: false,
92160
92182
  flipVideoHorizontal: null,
92161
92183
  customDirectionIcon: {
92162
- [ra$1.FaceDirection.LEFT]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon, {
92184
+ [ra$1.FaceDirection.LEFT]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon$1, {
92163
92185
  type: ra$1.FaceDirection.LEFT
92164
92186
  }),
92165
- [ra$1.FaceDirection.RIGHT]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon, {
92187
+ [ra$1.FaceDirection.RIGHT]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon$1, {
92166
92188
  type: ra$1.FaceDirection.RIGHT
92167
92189
  }),
92168
- [ra$1.FaceDirection.UP]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon, {
92190
+ [ra$1.FaceDirection.UP]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon$1, {
92169
92191
  type: ra$1.FaceDirection.UP
92170
92192
  }),
92171
- [ra$1.FaceDirection.FRONTAL]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon, {
92193
+ [ra$1.FaceDirection.FRONTAL]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon$1, {
92172
92194
  type: ra$1.FaceDirection.FRONTAL
92173
92195
  })
92174
92196
  },
@@ -92546,7 +92568,7 @@
92546
92568
  });
92547
92569
  }
92548
92570
 
92549
- const videoSettings$1 = libExports.isMobile ? {
92571
+ const videoSettings$3 = libExports.isMobile ? {
92550
92572
  // aspectRatio: 16 / 9,
92551
92573
  width: {
92552
92574
  ideal: 640
@@ -93079,7 +93101,7 @@
93079
93101
  flipHorizontal: frontCamera,
93080
93102
  ref: videoRef,
93081
93103
  onError: onErrorCallback,
93082
- videoSettings: videoSettings$1,
93104
+ videoSettings: videoSettings$3,
93083
93105
  closeButton: /*#__PURE__*/ jsxRuntimeExports.jsx(CloseIcon, {}),
93084
93106
  children: /*#__PURE__*/ jsxRuntimeExports.jsxs(WarmUpOverlay, {
93085
93107
  overlay: !warmupDone || !isPlaying,
@@ -93421,13 +93443,13 @@
93421
93443
  };
93422
93444
 
93423
93445
  // To reduce the calculation for blazeface
93424
- const videoSettings = libExports.isMobile ? {
93446
+ const videoSettings$2 = libExports.isMobile ? {
93425
93447
  width: {
93426
93448
  ideal: 640
93427
93449
  }
93428
93450
  } : null;
93429
93451
  // eslint-disable-next-line react/prop-types, consistent-return
93430
- const SelfieStepImageHolder = ({ stepNumber, type, theme })=>{
93452
+ const SelfieStepImageHolder$1 = ({ stepNumber, type, theme })=>{
93431
93453
  const imageHolderIcon = useDefaultThemeIcon(`instruction_${type}.svg`);
93432
93454
  // prioritize custom theme icons
93433
93455
  const customHolderSrc = get(theme, `Selfie.Active.imageHolder.${type}`);
@@ -93452,7 +93474,7 @@
93452
93474
  alt: ""
93453
93475
  });
93454
93476
  };
93455
- function renderDirectionIcon(directionIcon, directionIconAnimation) {
93477
+ function renderDirectionIcon$1(directionIcon, directionIconAnimation) {
93456
93478
  if (!directionIcon) return null;
93457
93479
  if (typeof directionIcon === 'string') {
93458
93480
  return /*#__PURE__*/ jsxRuntimeExports.jsx("img", {
@@ -93597,7 +93619,7 @@
93597
93619
  onClose: onCloseCallback,
93598
93620
  flipHorizontal: flipVideoHorizontal ?? frontCamera,
93599
93621
  ref: refVideo,
93600
- videoSettings: videoSettings,
93622
+ videoSettings: videoSettings$2,
93601
93623
  onError: onErrorCallback,
93602
93624
  scale: cameraScale,
93603
93625
  defaultCameraId: defaultCameraId,
@@ -93622,7 +93644,7 @@
93622
93644
  showErrorRing: !!faceDetectionError
93623
93645
  }),
93624
93646
  /*#__PURE__*/ jsxRuntimeExports.jsx(InstructionsOverlay, {
93625
- children: renderDirectionIcon(directionIcon, directionIconAnimation)
93647
+ children: renderDirectionIcon$1(directionIcon, directionIconAnimation)
93626
93648
  }),
93627
93649
  activeCapturing && /*#__PURE__*/ jsxRuntimeExports.jsx(CapturingOverlay, {})
93628
93650
  ]
@@ -93645,7 +93667,7 @@
93645
93667
  className: "image_preview",
93646
93668
  src: objUrl,
93647
93669
  alt: ""
93648
- }) : /*#__PURE__*/ jsxRuntimeExports.jsx(SelfieStepImageHolder, {
93670
+ }) : /*#__PURE__*/ jsxRuntimeExports.jsx(SelfieStepImageHolder$1, {
93649
93671
  stepNumber: index + 1,
93650
93672
  type: name,
93651
93673
  theme: theme
@@ -93736,16 +93758,16 @@
93736
93758
  frontCamera: true,
93737
93759
  isLoading: false,
93738
93760
  customDirectionIcon: {
93739
- [ra$1.FaceDirection.LEFT]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon, {
93761
+ [ra$1.FaceDirection.LEFT]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon$1, {
93740
93762
  type: ra$1.FaceDirection.LEFT
93741
93763
  }),
93742
- [ra$1.FaceDirection.RIGHT]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon, {
93764
+ [ra$1.FaceDirection.RIGHT]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon$1, {
93743
93765
  type: ra$1.FaceDirection.RIGHT
93744
93766
  }),
93745
- [ra$1.FaceDirection.UP]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon, {
93767
+ [ra$1.FaceDirection.UP]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon$1, {
93746
93768
  type: ra$1.FaceDirection.UP
93747
93769
  }),
93748
- [ra$1.FaceDirection.FRONTAL]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon, {
93770
+ [ra$1.FaceDirection.FRONTAL]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon$1, {
93749
93771
  type: ra$1.FaceDirection.FRONTAL
93750
93772
  })
93751
93773
  },
@@ -93873,6 +93895,706 @@
93873
93895
  };
93874
93896
  const useWrapIndicator = ()=>reactExports.useContext(WrapIndicatorContext);
93875
93897
 
93898
+ const DirectionalIcon = dt$1.img`
93899
+ width: ${({ width })=>width};
93900
+ `;
93901
+ // eslint-disable-next-line react/require-default-props
93902
+ function DirectionIcon({ type }) {
93903
+ const theme = nt$2();
93904
+ // default icons and widths based on version
93905
+ const iconDirection = useThemeIcon(`Selfie.Active.directionIcon.${type}`, `${type}_arrow.gif`);
93906
+ const iconWidth = getTheme(`Selfie.Active.directionIcon.${type}Width`)({
93907
+ theme
93908
+ });
93909
+ // prioritize custom theme icons
93910
+ const directionIconSrc = get(theme, `Selfie.Active.directionIcon.${type}`);
93911
+ if (directionIconSrc === null) {
93912
+ // eslint-disable-next-line react/jsx-no-useless-fragment
93913
+ return /*#__PURE__*/ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {});
93914
+ }
93915
+ if (directionIconSrc && directionIconSrc !== null) {
93916
+ return /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionalIcon, {
93917
+ src: get(theme, `Selfie.Active.directionIcon.${type}`),
93918
+ width: iconWidth,
93919
+ alt: ""
93920
+ });
93921
+ }
93922
+ // fallback to default icons and width
93923
+ return /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionalIcon, {
93924
+ src: iconDirection,
93925
+ alt: "",
93926
+ width: iconWidth
93927
+ });
93928
+ }
93929
+ DirectionIcon.propTypes = {
93930
+ type: PropTypes.oneOf([
93931
+ ra$1.FaceDirection.LEFT,
93932
+ ra$1.FaceDirection.RIGHT,
93933
+ ra$1.FaceDirection.UP,
93934
+ ra$1.FaceDirection.FRONTAL
93935
+ ])
93936
+ };
93937
+ DirectionIcon.defaultProps = {
93938
+ type: ra$1.FaceDirection.LEFT
93939
+ };
93940
+
93941
+ // To reduce the calculation for blazeface
93942
+ const videoSettings$1 = libExports.isMobile ? {
93943
+ width: {
93944
+ ideal: 640
93945
+ }
93946
+ } : null;
93947
+ // eslint-disable-next-line react/prop-types, consistent-return
93948
+ const SelfieStepImageHolder = ({ stepNumber, type, theme })=>{
93949
+ const imageHolderIcon = useDefaultThemeIcon(`instruction_${type}.svg`);
93950
+ // prioritize custom theme icons
93951
+ const customHolderSrc = get(theme, `Selfie.Active.imageHolder.${type}`);
93952
+ if (customHolderSrc === null) {
93953
+ // eslint-disable-next-line react/jsx-no-useless-fragment
93954
+ return /*#__PURE__*/ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {});
93955
+ }
93956
+ if (typeof customHolderSrc === 'string' && customHolderSrc !== '') {
93957
+ return /*#__PURE__*/ jsxRuntimeExports.jsx("img", {
93958
+ src: customHolderSrc,
93959
+ alt: ""
93960
+ });
93961
+ }
93962
+ // v1: use step number
93963
+ if (get(theme, 'themeVersion') === 'v1') {
93964
+ return /*#__PURE__*/ jsxRuntimeExports.jsx("span", {
93965
+ children: stepNumber
93966
+ });
93967
+ }
93968
+ return /*#__PURE__*/ jsxRuntimeExports.jsx("img", {
93969
+ src: imageHolderIcon,
93970
+ alt: ""
93971
+ });
93972
+ };
93973
+ function renderDirectionIcon(directionIcon, directionIconAnimation) {
93974
+ if (!directionIcon) return null;
93975
+ if (typeof directionIcon === 'string') {
93976
+ return /*#__PURE__*/ jsxRuntimeExports.jsx("img", {
93977
+ className: directionIconAnimation,
93978
+ src: directionIcon,
93979
+ alt: "",
93980
+ style: {
93981
+ maxWidth: '98px',
93982
+ maxHeight: '98px',
93983
+ marginBottom: '25px'
93984
+ }
93985
+ });
93986
+ }
93987
+ return directionIcon;
93988
+ }
93989
+ // eslint-disable-next-line react/require-default-props
93990
+ function ActiveLivenessV1(props) {
93991
+ const { apiCheck, onLivenessDetectionDone, captureFrameSettings, onFramesCaptured, frontCamera, flipVideoHorizontal, customDirectionIcon, customStepTimeConstraints, onProcessing, customErrors, apiCredentials, outputEncryptionSettings, cameraScale, defaultCameraId, offsetFaceY, styledComponent, isLoading, serviceSettings, onReset } = props;
93992
+ const theme = nt$2();
93993
+ const { onErrorCallback, onCloseCallback } = useSDKCallback();
93994
+ const bgCameraMask = iH.useAsset('bg_camera_mask.png');
93995
+ const bgCameraMaskRed = iH.useAsset('bg_camera_mask_red.png');
93996
+ const icLoading = useThemeIcon('IDCapturing.loadingIcon.src', 'ic_loading.gif');
93997
+ const [uiSpacing, setUISpacing] = reactExports.useState({});
93998
+ const { yFaceVerificationStepsWrapper, yFaceDetectionError } = uiSpacing;
93999
+ const [remainingTime, setRemainingTime] = reactExports.useState('');
94000
+ const [currentOrientation, setCurrentOrientation] = reactExports.useState();
94001
+ const surroundStyle = reactExports.useMemo(()=>({
94002
+ backgroundColor: getTheme('Selfie.backgroundColor')({
94003
+ theme
94004
+ })
94005
+ }), [
94006
+ theme
94007
+ ]);
94008
+ // preload icons
94009
+ usePreloadThemeAsset(get(theme, 'themeVersion'), 'up_arrow.gif');
94010
+ usePreloadThemeAsset(get(theme, 'themeVersion'), 'left_arrow.gif');
94011
+ usePreloadThemeAsset(get(theme, 'themeVersion'), 'right_arrow.gif');
94012
+ usePreloadThemeAsset(get(theme, 'themeVersion'), 'frontal_arrow.gif');
94013
+ usePreloadThemeAsset(get(theme, 'themeVersion'), 'instruction_up.svg');
94014
+ usePreloadThemeAsset(get(theme, 'themeVersion'), 'instruction_left.svg');
94015
+ usePreloadThemeAsset(get(theme, 'themeVersion'), 'instruction_right.svg');
94016
+ usePreloadThemeAsset(get(theme, 'themeVersion'), 'instruction_frontal.svg');
94017
+ const cropAreaDimension = reactExports.useCallback(({ clientHeight, videoAreaWidth, videoAreaHeight, lostX, lostY })=>{
94018
+ let width;
94019
+ let height;
94020
+ if (libExports.isMobile) {
94021
+ width = videoAreaWidth;
94022
+ height = width;
94023
+ } else {
94024
+ height = videoAreaHeight - 200;
94025
+ width = height;
94026
+ }
94027
+ const x = Math.floor((videoAreaWidth - width) / 2) + lostX;
94028
+ let y = 5 + lostY;
94029
+ const yFaceDetectionErrorNew = lostY + 25;
94030
+ const yCropAreaNew = yFaceDetectionErrorNew + 30;
94031
+ const yFaceVerificationStepsWrapperNew = yCropAreaNew + height + 20;
94032
+ setUISpacing({
94033
+ yFaceDetectionError: yFaceDetectionErrorNew,
94034
+ yFaceVerificationStepsWrapper: yFaceVerificationStepsWrapperNew
94035
+ });
94036
+ const topLimit = Math.floor(lostY);
94037
+ const botLimit = Math.floor(clientHeight - lostY);
94038
+ y = Math.floor(yCropAreaNew); // floor the y value to avoid blur line on ios safari
94039
+ if (offsetFaceY !== 0 && (y + offsetFaceY < topLimit || y + offsetFaceY + height > botLimit)) {
94040
+ onErrorCallback({
94041
+ code: `offsetFaceY must be in [-${y - topLimit}, ${botLimit - height - y}]`
94042
+ });
94043
+ } else {
94044
+ y += offsetFaceY;
94045
+ }
94046
+ return {
94047
+ x,
94048
+ y,
94049
+ width,
94050
+ height
94051
+ };
94052
+ }, [
94053
+ offsetFaceY,
94054
+ onErrorCallback
94055
+ ]);
94056
+ const { shouldResetFlowOnOrientationChange, cropArea, curStepIndex, directionIcon, directionIconAnimation, faceDetectionError, resetFlow, handleVideoPlayed, instructions, refVideo, refIsReseting, steps, videoPlayed, activeCapturing, warmupDone, showLoading } = useActiveLiveness({
94057
+ currentOrientation,
94058
+ apiCheck,
94059
+ bgCameraMask,
94060
+ bgCameraMaskRed,
94061
+ surroundStyle,
94062
+ onLivenessDetectionDone,
94063
+ onError: onErrorCallback,
94064
+ cropAreaDimension,
94065
+ customDirectionIcon,
94066
+ captureFrameSettings,
94067
+ onFramesCaptured,
94068
+ setRemainingTime,
94069
+ customStepTimeConstraints,
94070
+ onProcessing,
94071
+ customErrors,
94072
+ apiCredentials,
94073
+ outputEncryptionSettings,
94074
+ cameraScale,
94075
+ serviceSettings,
94076
+ onReset
94077
+ });
94078
+ reactExports.useEffect(()=>{
94079
+ if (typeof steps[0]?.directionIcon === 'string') {
94080
+ Promise.all(steps.map((step)=>preloadImage(step.directionIcon)));
94081
+ }
94082
+ }, [
94083
+ steps
94084
+ ]);
94085
+ const { CloseCameraButton } = styledComponent;
94086
+ const progressCircleProps = getProgressCircleProps(props, theme);
94087
+ const currentProgress = !refIsReseting.current ? curStepIndex / steps.length * 100 : 0;
94088
+ // for error text
94089
+ const { lang } = no$1.useSDKSettings();
94090
+ const timer = reactExports.useRef(0);
94091
+ const lastError = reactExports.useRef({});
94092
+ const duration = reactExports.useRef(ra$1.ErrorDuration.SHORT);
94093
+ const lastErrorMsg = reactExports.useMemo(()=>{
94094
+ const { msg, duration: errorDuration = ra$1.ErrorDuration.SHORT } = faceDetectionError || {};
94095
+ const errorMsg = msg?.[lang];
94096
+ if (Date.now() - timer.current >= duration.current) {
94097
+ timer.current = Date.now();
94098
+ duration.current = errorDuration;
94099
+ lastError.current = errorMsg;
94100
+ }
94101
+ return lastError.current;
94102
+ // eslint-disable-next-line react-hooks/exhaustive-deps
94103
+ }, [
94104
+ faceDetectionError,
94105
+ curStepIndex
94106
+ ]); // curStepIndex is used to get the latest error when reset flow
94107
+ const onOrientationChange = reactExports.useCallback((curOrientation)=>{
94108
+ setCurrentOrientation(curOrientation);
94109
+ if (!shouldResetFlowOnOrientationChange) {
94110
+ if (curOrientation === MODE.LANDSCAPE) {
94111
+ refVideo.current?.pause();
94112
+ } else {
94113
+ refVideo.current?.play();
94114
+ }
94115
+ } else {
94116
+ resetFlow();
94117
+ }
94118
+ }, [
94119
+ refVideo,
94120
+ resetFlow,
94121
+ shouldResetFlowOnOrientationChange
94122
+ ]);
94123
+ return /*#__PURE__*/ jsxRuntimeExports.jsx(OrientationDetection, {
94124
+ onOrientationChange: onOrientationChange,
94125
+ children: /*#__PURE__*/ jsxRuntimeExports.jsxs(Camera$1, {
94126
+ frontCamera: frontCamera,
94127
+ onVideoPlayed: handleVideoPlayed,
94128
+ onClose: onCloseCallback,
94129
+ flipHorizontal: flipVideoHorizontal ?? frontCamera,
94130
+ ref: refVideo,
94131
+ videoSettings: videoSettings$1,
94132
+ onError: onErrorCallback,
94133
+ scale: cameraScale,
94134
+ defaultCameraId: defaultCameraId,
94135
+ closeButton: CloseCameraButton || null,
94136
+ children: [
94137
+ !warmupDone && /*#__PURE__*/ jsxRuntimeExports.jsx(WarmupPopup, {}),
94138
+ videoPlayed ? /*#__PURE__*/ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
94139
+ children: [
94140
+ cropArea.current ? /*#__PURE__*/ jsxRuntimeExports.jsxs(CropAreaOverlayWrapper, {
94141
+ x: `${cropArea.current.x}px`,
94142
+ y: `${cropArea.current.y}px`,
94143
+ width: `${cropArea.current.width}px`,
94144
+ height: `${cropArea.current.height}px`,
94145
+ surroundStyle: cropArea.current.surroundStyle,
94146
+ children: [
94147
+ /*#__PURE__*/ jsxRuntimeExports.jsx(StyledCameraMark, {}),
94148
+ /*#__PURE__*/ jsxRuntimeExports.jsx(OverlayProgressCircle, {
94149
+ ...progressCircleProps,
94150
+ progress: currentProgress,
94151
+ showErrorRing: !!faceDetectionError && getTheme('Selfie.progressCircle.showErrorRing')({
94152
+ theme
94153
+ })
94154
+ }),
94155
+ /*#__PURE__*/ jsxRuntimeExports.jsx(InstructionsOverlay, {
94156
+ children: renderDirectionIcon(directionIcon, directionIconAnimation)
94157
+ }),
94158
+ activeCapturing && /*#__PURE__*/ jsxRuntimeExports.jsx(CapturingOverlay, {})
94159
+ ]
94160
+ }) : null,
94161
+ instructions ? /*#__PURE__*/ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
94162
+ children: [
94163
+ /*#__PURE__*/ jsxRuntimeExports.jsx(FaceVerificationInstructions, {
94164
+ top: yFaceVerificationStepsWrapper + 5,
94165
+ className: "instructions",
94166
+ children: instructions
94167
+ }),
94168
+ /*#__PURE__*/ jsxRuntimeExports.jsx(FaceVerificationStepsWrapper, {
94169
+ top: yFaceVerificationStepsWrapper + 35,
94170
+ children: steps.map((step, index)=>{
94171
+ const { name, image: { objUrl } } = step;
94172
+ return /*#__PURE__*/ jsxRuntimeExports.jsx(StepItem, {
94173
+ active: curStepIndex >= index,
94174
+ className: "step-item",
94175
+ children: objUrl ? /*#__PURE__*/ jsxRuntimeExports.jsx("img", {
94176
+ className: "image_preview",
94177
+ src: objUrl,
94178
+ alt: ""
94179
+ }) : /*#__PURE__*/ jsxRuntimeExports.jsx(SelfieStepImageHolder, {
94180
+ stepNumber: index + 1,
94181
+ type: name,
94182
+ theme: theme
94183
+ })
94184
+ }, name);
94185
+ })
94186
+ })
94187
+ ]
94188
+ }) : null
94189
+ ]
94190
+ }) : null,
94191
+ (showLoading || isLoading) && /*#__PURE__*/ jsxRuntimeExports.jsx(LoadingIcon$2, {
94192
+ children: /*#__PURE__*/ jsxRuntimeExports.jsx("img", {
94193
+ src: icLoading,
94194
+ alt: "",
94195
+ className: "spin"
94196
+ })
94197
+ }),
94198
+ remainingTime && /*#__PURE__*/ jsxRuntimeExports.jsx(CountdownTime, {
94199
+ top: yFaceVerificationStepsWrapper - 30,
94200
+ children: remainingTime
94201
+ }),
94202
+ typeof lastErrorMsg === 'string' ? /*#__PURE__*/ jsxRuntimeExports.jsx(SimpleFaceDetectionError, {
94203
+ top: yFaceDetectionError - 15,
94204
+ className: "face-detection-error",
94205
+ children: lastErrorMsg
94206
+ }) : null
94207
+ ]
94208
+ })
94209
+ });
94210
+ }
94211
+ ActiveLivenessV1.propTypes = {
94212
+ apiCheck: PropTypes.bool,
94213
+ onLivenessDetectionDone: PropTypes.func,
94214
+ onClose: PropTypes.func,
94215
+ onError: PropTypes.func,
94216
+ onReset: PropTypes.func,
94217
+ captureFrameSettings: PropTypes.shape({}),
94218
+ onFramesCaptured: PropTypes.func,
94219
+ flipVideoHorizontal: PropTypes.bool,
94220
+ frontCamera: PropTypes.bool,
94221
+ isLoading: PropTypes.bool,
94222
+ customDirectionIcon: PropTypes.shape({}),
94223
+ customStepTimeConstraints: PropTypes.shape({}),
94224
+ onProcessing: PropTypes.func,
94225
+ customErrors: PropTypes.shape({}),
94226
+ apiCredentials: PropTypes.shape({
94227
+ accessKey: PropTypes.string,
94228
+ secretKey: PropTypes.string,
94229
+ apiUrl: PropTypes.string
94230
+ }),
94231
+ outputEncryptionSettings: PropTypes.shape({}),
94232
+ cameraScale: PropTypes.number,
94233
+ defaultCameraId: PropTypes.string,
94234
+ offsetFaceY: PropTypes.number,
94235
+ styledComponent: PropTypes.shape({
94236
+ CloseCameraButton: PropTypes.node
94237
+ }),
94238
+ serviceSettings: PropTypes.shape({})
94239
+ };
94240
+ ActiveLivenessV1.defaultProps = {
94241
+ apiCheck: false,
94242
+ onLivenessDetectionDone: null,
94243
+ onClose: null,
94244
+ onError: ()=>{},
94245
+ onReset: ()=>{},
94246
+ captureFrameSettings: {
94247
+ enable: false,
94248
+ framesIntervalTime: 180,
94249
+ framesBatchLength: 0
94250
+ },
94251
+ onFramesCaptured: ()=>{},
94252
+ flipVideoHorizontal: null,
94253
+ frontCamera: true,
94254
+ isLoading: false,
94255
+ customDirectionIcon: {
94256
+ [ra$1.FaceDirection.LEFT]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon, {
94257
+ type: ra$1.FaceDirection.LEFT
94258
+ }),
94259
+ [ra$1.FaceDirection.RIGHT]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon, {
94260
+ type: ra$1.FaceDirection.RIGHT
94261
+ }),
94262
+ [ra$1.FaceDirection.UP]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon, {
94263
+ type: ra$1.FaceDirection.UP
94264
+ }),
94265
+ [ra$1.FaceDirection.FRONTAL]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon, {
94266
+ type: ra$1.FaceDirection.FRONTAL
94267
+ })
94268
+ },
94269
+ customStepTimeConstraints: {
94270
+ [ra$1.FaceDirection.UP]: {
94271
+ delayTime: 0
94272
+ },
94273
+ [ra$1.FaceDirection.LEFT]: {
94274
+ delayTime: 0
94275
+ },
94276
+ [ra$1.FaceDirection.RIGHT]: {
94277
+ delayTime: 0
94278
+ },
94279
+ [ra$1.FaceDirection.FRONTAL]: {
94280
+ delayTime: 2000
94281
+ }
94282
+ },
94283
+ onProcessing: ()=>{},
94284
+ customErrors: null,
94285
+ apiCredentials: {
94286
+ accessKey: '',
94287
+ secretKey: '',
94288
+ apiUrl: ''
94289
+ },
94290
+ outputEncryptionSettings: null,
94291
+ cameraScale: 1,
94292
+ defaultCameraId: undefined,
94293
+ offsetFaceY: 0,
94294
+ styledComponent: {
94295
+ CloseCameraButton: null
94296
+ },
94297
+ serviceSettings: {
94298
+ enableUploadFrames: true,
94299
+ enableUploadImages: true,
94300
+ enableVerifySanityPortrait: true,
94301
+ enableVerifySanityIDCard: true,
94302
+ enableVerifyFaceLiveness: true,
94303
+ enableDetectIDCardTampering: true,
94304
+ enableReadIDCardInfo: true
94305
+ }
94306
+ };
94307
+
94308
+ // To reduce the calculation for blazeface
94309
+ const videoSettings = libExports.isMobile ? {
94310
+ width: {
94311
+ ideal: 640
94312
+ }
94313
+ } : null;
94314
+ // eslint-disable-next-line react/require-default-props
94315
+ function PassiveLivenessOldV1(props) {
94316
+ const { apiCheck, onLivenessDetectionDone, captureFrameSettings, onFramesCaptured, frontCamera, flipVideoHorizontal, customDirectionIcon, customStepTimeConstraints, onProcessing, customErrors, apiCredentials, outputEncryptionSettings, cameraScale, defaultCameraId, passiveModeAuto, offsetFaceY, styledComponent, serviceSettings, onReset, isLoading } = props;
94317
+ const theme = nt$2();
94318
+ const { onErrorCallback, onCloseCallback } = useSDKCallback();
94319
+ const bgCameraMask = iH.useAsset('bg_camera_mask.png');
94320
+ const bgCameraMaskRed = iH.useAsset('bg_camera_mask_red.png');
94321
+ const icLoading = useThemeIcon('IDCapturing.loadingIcon.src', 'ic_loading.gif');
94322
+ const [uiSpacing, setUISpacing] = reactExports.useState({});
94323
+ const { yFaceDetectionError, yFaceVerificationStepsWrapper } = uiSpacing;
94324
+ const [remainingTime, setRemainingTime] = reactExports.useState('');
94325
+ const [currentOrientation, setCurrentOrientation] = reactExports.useState();
94326
+ const surroundStyle = reactExports.useMemo(()=>({
94327
+ backgroundColor: getTheme('Selfie.backgroundColor')({
94328
+ theme
94329
+ })
94330
+ }), [
94331
+ theme
94332
+ ]);
94333
+ const cropAreaDimension = reactExports.useCallback(({ lostY, height, clientHeight })=>{
94334
+ const yFaceDetectionErrorNew = lostY + 25;
94335
+ const yCropAreaNew = yFaceDetectionErrorNew + 30;
94336
+ const yFaceVerificationStepsWrapperNew = yCropAreaNew + height + 20;
94337
+ setUISpacing({
94338
+ yFaceDetectionError: yFaceDetectionErrorNew,
94339
+ yFaceVerificationStepsWrapper: yFaceVerificationStepsWrapperNew
94340
+ });
94341
+ const topLimit = Math.floor(lostY);
94342
+ const botLimit = Math.floor(clientHeight - lostY);
94343
+ let y = Math.floor(yCropAreaNew); // floor the y value to avoid blur line on ios safari
94344
+ if (offsetFaceY !== 0 && (y + offsetFaceY < topLimit || y + offsetFaceY + height > botLimit)) {
94345
+ onErrorCallback({
94346
+ code: `offsetFaceY must be in [-${y - topLimit}, ${botLimit - height - y}]`
94347
+ });
94348
+ } else {
94349
+ y += offsetFaceY;
94350
+ }
94351
+ return {
94352
+ y
94353
+ };
94354
+ }, [
94355
+ offsetFaceY,
94356
+ onErrorCallback
94357
+ ]);
94358
+ const { shouldResetFlowOnOrientationChange, countdownToTakePicture, cropArea, curStepIndex, faceDetectionError, resetFlow, handleTriggerPassiveMode, handleVideoPlayed, refVideo, showCountdown, steps, refIsReseting, videoPlayed, warmupDone, showCaptureButton, shouldShowCountdown, showLoading } = usePassiveLiveness({
94359
+ currentOrientation,
94360
+ apiCheck,
94361
+ bgCameraMask,
94362
+ bgCameraMaskRed,
94363
+ surroundStyle,
94364
+ onLivenessDetectionDone,
94365
+ onError: onErrorCallback,
94366
+ cropAreaDimension,
94367
+ customDirectionIcon,
94368
+ captureFrameSettings,
94369
+ onFramesCaptured,
94370
+ setRemainingTime,
94371
+ customStepTimeConstraints,
94372
+ onProcessing,
94373
+ customErrors,
94374
+ apiCredentials,
94375
+ outputEncryptionSettings,
94376
+ cameraScale,
94377
+ passiveModeAuto,
94378
+ serviceSettings,
94379
+ onReset
94380
+ });
94381
+ reactExports.useEffect(()=>{
94382
+ if (typeof steps[0]?.directionIcon === 'string') {
94383
+ Promise.all(steps.map((step)=>preloadImage(step.directionIcon)));
94384
+ }
94385
+ }, [
94386
+ steps
94387
+ ]);
94388
+ const { CloseCameraButton } = styledComponent;
94389
+ const progressCircleProps = getProgressCircleProps(props, theme);
94390
+ const currentProgress = !refIsReseting.current ? curStepIndex / steps.length * 100 : 0;
94391
+ // for error text
94392
+ const { lang } = no$1.useSDKSettings();
94393
+ const timer = reactExports.useRef(0);
94394
+ const lastError = reactExports.useRef({});
94395
+ const duration = reactExports.useRef(ra$1.ErrorDuration.SHORT);
94396
+ const lastErrorMsg = reactExports.useMemo(()=>{
94397
+ const { msg, duration: errorDuration = ra$1.ErrorDuration.SHORT } = faceDetectionError || {};
94398
+ const errorMsg = msg?.[lang];
94399
+ if (Date.now() - timer.current >= duration.current) {
94400
+ timer.current = Date.now();
94401
+ duration.current = errorDuration;
94402
+ lastError.current = errorMsg;
94403
+ }
94404
+ return lastError.current;
94405
+ // eslint-disable-next-line react-hooks/exhaustive-deps
94406
+ }, [
94407
+ faceDetectionError,
94408
+ curStepIndex
94409
+ ]); // curStepIndex is used to get the latest error when reset flow
94410
+ const onOrientationChange = reactExports.useCallback((curOrientation)=>{
94411
+ setCurrentOrientation(curOrientation);
94412
+ if (!shouldResetFlowOnOrientationChange) {
94413
+ if (curOrientation === MODE.LANDSCAPE) {
94414
+ refVideo.current?.pause();
94415
+ } else {
94416
+ refVideo.current?.play();
94417
+ }
94418
+ } else {
94419
+ resetFlow();
94420
+ }
94421
+ }, [
94422
+ refVideo,
94423
+ resetFlow,
94424
+ shouldResetFlowOnOrientationChange
94425
+ ]);
94426
+ return /*#__PURE__*/ jsxRuntimeExports.jsx(OrientationDetection, {
94427
+ onOrientationChange: onOrientationChange,
94428
+ children: /*#__PURE__*/ jsxRuntimeExports.jsxs(Camera$1, {
94429
+ frontCamera: frontCamera,
94430
+ onVideoPlayed: handleVideoPlayed,
94431
+ onClose: onCloseCallback,
94432
+ flipHorizontal: flipVideoHorizontal ?? frontCamera,
94433
+ ref: refVideo,
94434
+ videoSettings: videoSettings,
94435
+ onError: onErrorCallback,
94436
+ scale: cameraScale,
94437
+ defaultCameraId: defaultCameraId,
94438
+ closeButton: CloseCameraButton || null,
94439
+ children: [
94440
+ !warmupDone && /*#__PURE__*/ jsxRuntimeExports.jsx(WarmupPopup, {}),
94441
+ videoPlayed ? /*#__PURE__*/ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
94442
+ children: [
94443
+ typeof lastErrorMsg === 'string' ? /*#__PURE__*/ jsxRuntimeExports.jsx(SimpleFaceDetectionError, {
94444
+ top: yFaceDetectionError - 15,
94445
+ className: "face-detection-error",
94446
+ children: lastErrorMsg
94447
+ }) : null,
94448
+ cropArea.current ? /*#__PURE__*/ jsxRuntimeExports.jsxs(CropAreaOverlayWrapper, {
94449
+ x: `${cropArea.current.x}px`,
94450
+ y: `${cropArea.current.y}px`,
94451
+ width: `${cropArea.current.width}px`,
94452
+ height: `${cropArea.current.height}px`,
94453
+ surroundStyle: cropArea.current.surroundStyle,
94454
+ children: [
94455
+ /*#__PURE__*/ jsxRuntimeExports.jsx(StyledCameraMark, {}),
94456
+ /*#__PURE__*/ jsxRuntimeExports.jsx(OverlayProgressCircle, {
94457
+ ...progressCircleProps,
94458
+ progress: currentProgress,
94459
+ showErrorRing: !!faceDetectionError && getTheme('Selfie.progressCircle.showErrorRing')({
94460
+ theme
94461
+ })
94462
+ }),
94463
+ shouldShowCountdown ? /*#__PURE__*/ jsxRuntimeExports.jsx(CountDownOverlay, {
94464
+ children: countdownToTakePicture
94465
+ }) : null,
94466
+ faceDetectionError && /*#__PURE__*/ jsxRuntimeExports.jsx(ErrorOverlay$1, {})
94467
+ ]
94468
+ }) : null,
94469
+ remainingTime && /*#__PURE__*/ jsxRuntimeExports.jsx(CountdownTime, {
94470
+ top: yFaceVerificationStepsWrapper - 30,
94471
+ children: remainingTime
94472
+ }),
94473
+ showCaptureButton ? /*#__PURE__*/ jsxRuntimeExports.jsx(BottomButtonsOverlay, {
94474
+ children: /*#__PURE__*/ jsxRuntimeExports.jsx(Button$4, {
94475
+ onClick: handleTriggerPassiveMode,
94476
+ disabled: showCountdown,
94477
+ children: get(theme, 'Selfie.captureIcon.src') ? /*#__PURE__*/ jsxRuntimeExports.jsx("img", {
94478
+ src: get(theme, 'Selfie.captureIcon.src'),
94479
+ alt: ""
94480
+ }) : /*#__PURE__*/ jsxRuntimeExports.jsx(CameraIcon, {
94481
+ fillColor: "rgba(193, 197, 204, 1)"
94482
+ })
94483
+ })
94484
+ }) : null
94485
+ ]
94486
+ }) : null,
94487
+ (showLoading || isLoading) && /*#__PURE__*/ jsxRuntimeExports.jsx(LoadingIcon$2, {
94488
+ children: /*#__PURE__*/ jsxRuntimeExports.jsx("img", {
94489
+ src: icLoading,
94490
+ alt: ""
94491
+ })
94492
+ })
94493
+ ]
94494
+ })
94495
+ });
94496
+ }
94497
+ PassiveLivenessOldV1.propTypes = {
94498
+ apiCheck: PropTypes.bool,
94499
+ mode: PropTypes.string,
94500
+ onLivenessDetectionDone: PropTypes.func,
94501
+ onClose: PropTypes.func,
94502
+ onError: PropTypes.func,
94503
+ onReset: PropTypes.func,
94504
+ captureFrameSettings: PropTypes.shape({}),
94505
+ onFramesCaptured: PropTypes.func,
94506
+ frontCamera: PropTypes.bool,
94507
+ isLoading: PropTypes.bool,
94508
+ flipVideoHorizontal: PropTypes.bool,
94509
+ customDirectionIcon: PropTypes.shape({}),
94510
+ customStepTimeConstraints: PropTypes.shape({}),
94511
+ onProcessing: PropTypes.func,
94512
+ customErrors: PropTypes.shape({}),
94513
+ apiCredentials: PropTypes.shape({
94514
+ accessKey: PropTypes.string,
94515
+ secretKey: PropTypes.string,
94516
+ apiUrl: PropTypes.string
94517
+ }),
94518
+ outputEncryptionSettings: PropTypes.shape({}),
94519
+ cameraScale: PropTypes.number,
94520
+ defaultCameraId: PropTypes.string,
94521
+ passiveModeAuto: PropTypes.bool,
94522
+ offsetFaceY: PropTypes.number,
94523
+ styledComponent: PropTypes.shape({
94524
+ CloseCameraButton: PropTypes.node
94525
+ }),
94526
+ serviceSettings: PropTypes.shape({})
94527
+ };
94528
+ PassiveLivenessOldV1.defaultProps = {
94529
+ apiCheck: false,
94530
+ mode: null,
94531
+ onLivenessDetectionDone: null,
94532
+ onClose: null,
94533
+ onError: ()=>{},
94534
+ onReset: ()=>{},
94535
+ captureFrameSettings: {
94536
+ enable: false,
94537
+ framesIntervalTime: 180,
94538
+ framesBatchLength: 0
94539
+ },
94540
+ onFramesCaptured: ()=>{},
94541
+ frontCamera: true,
94542
+ isLoading: false,
94543
+ flipVideoHorizontal: null,
94544
+ customDirectionIcon: {
94545
+ [ra$1.FaceDirection.LEFT]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon$1, {
94546
+ type: ra$1.FaceDirection.LEFT
94547
+ }),
94548
+ [ra$1.FaceDirection.RIGHT]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon$1, {
94549
+ type: ra$1.FaceDirection.RIGHT
94550
+ }),
94551
+ [ra$1.FaceDirection.UP]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon$1, {
94552
+ type: ra$1.FaceDirection.UP
94553
+ }),
94554
+ [ra$1.FaceDirection.FRONTAL]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon$1, {
94555
+ type: ra$1.FaceDirection.FRONTAL
94556
+ })
94557
+ },
94558
+ customStepTimeConstraints: {
94559
+ [ra$1.FaceDirection.UP]: {
94560
+ delayTime: 0
94561
+ },
94562
+ [ra$1.FaceDirection.LEFT]: {
94563
+ delayTime: 0
94564
+ },
94565
+ [ra$1.FaceDirection.RIGHT]: {
94566
+ delayTime: 0
94567
+ },
94568
+ [ra$1.FaceDirection.FRONTAL]: {
94569
+ delayTime: 2000
94570
+ }
94571
+ },
94572
+ onProcessing: ()=>{},
94573
+ customErrors: null,
94574
+ apiCredentials: {
94575
+ accessKey: '',
94576
+ secretKey: '',
94577
+ apiUrl: ''
94578
+ },
94579
+ outputEncryptionSettings: null,
94580
+ cameraScale: 1,
94581
+ defaultCameraId: undefined,
94582
+ passiveModeAuto: false,
94583
+ offsetFaceY: 0,
94584
+ styledComponent: {
94585
+ CloseCameraButton: null
94586
+ },
94587
+ serviceSettings: {
94588
+ enableUploadFrames: true,
94589
+ enableUploadImages: true,
94590
+ enableVerifySanityPortrait: true,
94591
+ enableVerifySanityIDCard: true,
94592
+ enableVerifyFaceLiveness: true,
94593
+ enableDetectIDCardTampering: true,
94594
+ enableReadIDCardInfo: true
94595
+ }
94596
+ };
94597
+
93876
94598
  const withClientSettings$1 = (Component)=>{
93877
94599
  return function WrappedComponent(props) {
93878
94600
  const { apiCheck, apiCredentials, serviceSettings, flowId, clientSettings } = props;
@@ -93888,16 +94610,20 @@
93888
94610
  });
93889
94611
  };
93890
94612
  };
93891
- const getLivenessModeComponent = (mode, CustomLivenessDetection)=>{
94613
+ const getLivenessModeComponent = (mode, CustomLivenessDetection, themeVersion)=>{
93892
94614
  let LivenessDetectionComponent = ActiveLiveness;
93893
94615
  if (mode === ra$1.Mode.ACTIVE) {
93894
- LivenessDetectionComponent = CustomLivenessDetection?.ActiveLiveness ?? ActiveLiveness;
94616
+ const DefaultActiveLiveness = themeVersion === 'v1' ? ActiveLivenessV1 : ActiveLiveness;
94617
+ LivenessDetectionComponent = CustomLivenessDetection?.ActiveLiveness ?? DefaultActiveLiveness;
93895
94618
  }
93896
94619
  if (mode === ra$1.Mode.PASSIVE_V2) {
93897
94620
  LivenessDetectionComponent = CustomLivenessDetection?.PassiveLivenessV2 ?? PassiveLiveness;
93898
94621
  }
93899
94622
  if (mode === ra$1.Mode.PASSIVE) {
93900
- LivenessDetectionComponent = CustomLivenessDetection?.PassiveLiveness ?? PassiveLiveness$1;
94623
+ // PassiveLivenessOldV1 to not be confused with PassiveLivenessV2 (which is totally new mode)
94624
+ // PassiveLivenessOldV1 refers to PassiveLiveness with themeVersion = "v1"
94625
+ const DefaultPassiveLiveness = themeVersion === 'v1' ? PassiveLivenessOldV1 : PassiveLiveness$1;
94626
+ LivenessDetectionComponent = CustomLivenessDetection?.PassiveLiveness ?? DefaultPassiveLiveness;
93901
94627
  }
93902
94628
  if (typeof mode === 'string' && mode.startsWith('flash')) {
93903
94629
  LivenessDetectionComponent = CustomLivenessDetection?.FlashLiveness ?? FlashLiveness;
@@ -93910,7 +94636,7 @@
93910
94636
  }, livenessComponent: CustomLivenessDetection, customTheme = {}, customTexts, ...props } = livenessProps;
93911
94637
  const { mode, flowId, onError: onErrorFromProp, onClose: onCloseFromProp, debug, onLivenessDetectionDone } = props;
93912
94638
  const clientSettings = useClientSettings();
93913
- const { billingSettings: clientBillingSettings, enableBilling } = no$1.useSDKSettings();
94639
+ const { billingSettings: clientBillingSettings, enableBilling, themeVersion } = no$1.useSDKSettings();
93914
94640
  const billingSettingsFromSdkSettings = dD.getWebSetting(clientSettings, 'data.settings.sdk_settings.billing_settings.billing_config');
93915
94641
  const billingUrl = dD.getWebSetting(clientSettings, 'data.settings.sdk_settings.billing_settings.url');
93916
94642
  const { submitBilling } = gR({
@@ -93996,7 +94722,7 @@
93996
94722
  billingInput,
93997
94723
  onCloseFromProp
93998
94724
  ]);
93999
- const LivenessDetectionComponent = getLivenessModeComponent(mode, CustomLivenessDetection);
94725
+ const LivenessDetectionComponent = getLivenessModeComponent(mode, CustomLivenessDetection, themeVersion);
94000
94726
  return /*#__PURE__*/ jsxRuntimeExports.jsx(DebugProvider, {
94001
94727
  debug: debug,
94002
94728
  children: /*#__PURE__*/ jsxRuntimeExports.jsx(SDKCallbackProvider, {
@@ -112760,7 +113486,7 @@
112760
113486
  };
112761
113487
  };
112762
113488
 
112763
- const defaultAssetRoot = "https://vision-cdn.trustingsocial.com/tvweb-sdk.platform/0.0.0-beta.20251215-093759/assets";
113489
+ const defaultAssetRoot = "https://vision-cdn.trustingsocial.com/tvweb-sdk.platform/0.0.0-beta.20251215-165409/assets";
112764
113490
  class TVWebSDK extends gU {
112765
113491
  constructor(props){
112766
113492
  super({