@tsocial/tvweb-sdk.platform 0.0.0-beta.20251211-162126 → 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.20251211-162126";
33786
+ return "0.0.0-beta.20251215-165409";
33774
33787
  }
33775
33788
  function nI$1() {
33776
33789
  return {
@@ -41246,51 +41259,56 @@
41246
41259
  }, uz;
41247
41260
  }(), uG);
41248
41261
  }();
41249
- let dm = d_, dg = d_, dy = dv();
41262
+ let dm = d_, dg = d_, dy = db();
41250
41263
  for(;;)try {
41251
- if (parseInt(dg(329)) / 1 * (parseInt(dg(331)) / 2) + parseInt(dg(345)) / 3 * (-parseInt(dg(328)) / 4) + -parseInt(dg(335)) / 5 * (-parseInt(dg(334)) / 6) + -parseInt(dg(337)) / 7 + -parseInt(dg(341)) / 8 + parseInt(dg(326)) / 9 * (-parseInt(dg(342)) / 10) + parseInt(dg(343)) / 11 === 926605) break;
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;
41252
41265
  dy.push(dy.shift());
41253
41266
  } catch (e) {
41254
41267
  dy.push(dy.shift());
41255
41268
  }
41256
- let db = dm(332) + dm(323) + "3d02010608" + dm(327) + "0301070342" + dm(338);
41257
- function dv() {
41269
+ function db() {
41258
41270
  let e = [
41259
- "ytJdcsPxrD",
41260
- "892gXnWfr",
41271
+ "25310HBUOBg",
41272
+ "DepBO8t60S",
41273
+ "MFkwEwYHKo",
41261
41274
  "3059301306",
41262
- "KoZIzj0DAQ",
41263
- "6gYYqrS",
41264
- "7198670NThCRv",
41265
- "KA==",
41266
- "3402308atSQXs",
41267
- "000",
41268
- "44P0rKKsZK",
41269
41275
  "+faHkP3QC3",
41270
- "5680280JMopum",
41271
- "2872500ddCxtO",
41272
- "16501958bhReDg",
41273
- "Mjci1ul8mm",
41274
- "16662hltSgm",
41276
+ "407Ilvdnt",
41277
+ "44P0rKKsZK",
41278
+ "3d02010608",
41279
+ "ytJdcsPxrD",
41280
+ "D9EKOWS+U4",
41281
+ "14552FNqEza",
41282
+ "101165gbwSGf",
41283
+ "3599838cBdphG",
41284
+ "96444qpbkcR",
41285
+ "671448TAUmcs",
41275
41286
  "072a8648ce",
41276
- "MFkwEwYHKo",
41277
- "DepBO8t60S",
41278
- "27iLFafB",
41287
+ "532kymtpA",
41288
+ "45uWuFYC",
41289
+ "MfPrcYTM70",
41290
+ "6ocbIJZ",
41291
+ "000",
41292
+ "0301070342",
41293
+ "KoZIzj0DAQ",
41294
+ "ZIzj0CAQYI",
41295
+ "191450lvsUWR",
41279
41296
  "2a8648ce3d",
41280
- "240FENsBj",
41281
- "847jLaCrU"
41297
+ "cDQgAE9h6Z",
41298
+ "KA=="
41282
41299
  ];
41283
- return (dv = function() {
41300
+ return (db = function() {
41284
41301
  return e;
41285
41302
  })();
41286
41303
  }
41304
+ let dv = dm(370) + dm(382) + dm(374) + dm(392) + dm(388) + dm(387);
41287
41305
  function d_(e, t) {
41288
- let r = dv();
41306
+ let r = db();
41289
41307
  return (d_ = function(e, t) {
41290
- return r[e -= 323];
41308
+ return r[e -= 366];
41291
41309
  })(e, t);
41292
41310
  }
41293
- let dx = dm(324) + "ZIzj0CAQYI" + dm(333) + "cDQgAE9h6Z" + dm(325) + dm(330) + dm(340) + dm(339) + dm(344) + "D9EKOWS+U4MfPrcYTM70ssRdXLZEX8" + dm(336);
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);
41294
41312
  async function dC(e) {
41295
41313
  let t = new TextEncoder().encode(e);
41296
41314
  return Array.from(new Uint8Array(await crypto.subtle.digest("SHA-256", t))).map((e)=>e.toString(16).padStart(2, "0")).join("");
@@ -41395,7 +41413,7 @@
41395
41413
  isValid: !1,
41396
41414
  error: i0$1.invalid_license
41397
41415
  };
41398
- let { mode: a, license: o, signature: s } = dS(e), c = dw(i4$1(o)), l = (r = t || dx, n = i4$1(r).replace(db, ""), i = new dp.ec("p256").keyFromPublic(n, "hex"), {
41416
+ let { mode: a, license: o, signature: s } = dS(e), c = dw(i4$1(o)), l = (r = t || dx, n = i4$1(r).replace(dv, ""), i = new dp.ec("p256").keyFromPublic(n, "hex"), {
41399
41417
  verifySignature: async (e, t)=>{
41400
41418
  try {
41401
41419
  let r = await dC(e), n = i4$1(t);
@@ -43357,7 +43375,8 @@
43357
43375
  "x-request-id": e,
43358
43376
  ...r
43359
43377
  },
43360
- fallbackUrls: c
43378
+ fallbackUrls: c,
43379
+ requestTimeoutMs: 6e4
43361
43380
  }), {
43362
43381
  onDone: n
43363
43382
  });
@@ -43386,7 +43405,8 @@
43386
43405
  "x-request-id": l,
43387
43406
  ...r
43388
43407
  },
43389
- fallbackUrls: s
43408
+ fallbackUrls: s,
43409
+ requestTimeoutMs: 6e4
43390
43410
  }), {
43391
43411
  onDone: ()=>{}
43392
43412
  });
@@ -90529,7 +90549,7 @@
90529
90549
  }
90530
90550
  };
90531
90551
 
90532
- const videoSettings$3 = libExports.isMobile ? {
90552
+ const videoSettings$5 = libExports.isMobile ? {
90533
90553
  // aspectRatio: 16 / 9,
90534
90554
  width: {
90535
90555
  ideal: 640
@@ -91308,7 +91328,7 @@
91308
91328
  flipHorizontal: frontCamera,
91309
91329
  ref: videoRef,
91310
91330
  onError: onErrorCallback,
91311
- videoSettings: videoSettings$3,
91331
+ videoSettings: videoSettings$5,
91312
91332
  closeButton: /*#__PURE__*/ jsxRuntimeExports.jsx(CloseIcon, {}),
91313
91333
  children: /*#__PURE__*/ jsxRuntimeExports.jsxs(WarmUpOverlay, {
91314
91334
  overlay: !warmupDone || !isPlaying,
@@ -91870,11 +91890,11 @@
91870
91890
  extraConfig: null
91871
91891
  };
91872
91892
 
91873
- const DirectionalIcon = dt$1.img`
91893
+ const DirectionalIcon$1 = dt$1.img`
91874
91894
  width: ${({ width })=>width};
91875
91895
  `;
91876
91896
  // eslint-disable-next-line react/require-default-props
91877
- function DirectionIcon({ type }) {
91897
+ function DirectionIcon$1({ type }) {
91878
91898
  const theme = nt$2();
91879
91899
  // default icons and widths based on version
91880
91900
  const iconDirection = useThemeIcon(`Selfie.Active.directionIcon.${type}`, `${type}_arrow.gif`);
@@ -91891,7 +91911,7 @@
91891
91911
  if (type === ra$1.FaceDirection.FRONTAL) {
91892
91912
  // For frontal direction, use the SVG icon if available
91893
91913
  if (frontalIcon) {
91894
- return /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionalIcon, {
91914
+ return /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionalIcon$1, {
91895
91915
  src: frontalIcon,
91896
91916
  width: iconWidth,
91897
91917
  alt: ""
@@ -91899,20 +91919,20 @@
91899
91919
  }
91900
91920
  }
91901
91921
  if (directionIconSrc && directionIconSrc !== null) {
91902
- return /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionalIcon, {
91922
+ return /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionalIcon$1, {
91903
91923
  src: get(theme, `Selfie.Active.directionIcon.${type}`),
91904
91924
  width: iconWidth,
91905
91925
  alt: ""
91906
91926
  });
91907
91927
  }
91908
91928
  // fallback to default icons and width
91909
- return /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionalIcon, {
91929
+ return /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionalIcon$1, {
91910
91930
  src: iconDirection,
91911
91931
  alt: "",
91912
91932
  width: iconWidth
91913
91933
  });
91914
91934
  }
91915
- DirectionIcon.propTypes = {
91935
+ DirectionIcon$1.propTypes = {
91916
91936
  type: PropTypes.oneOf([
91917
91937
  ra$1.FaceDirection.LEFT,
91918
91938
  ra$1.FaceDirection.RIGHT,
@@ -91920,12 +91940,12 @@
91920
91940
  ra$1.FaceDirection.FRONTAL
91921
91941
  ])
91922
91942
  };
91923
- DirectionIcon.defaultProps = {
91943
+ DirectionIcon$1.defaultProps = {
91924
91944
  type: ra$1.FaceDirection.LEFT
91925
91945
  };
91926
91946
 
91927
91947
  // To reduce the calculation for blazeface
91928
- const videoSettings$2 = libExports.isMobile ? {
91948
+ const videoSettings$4 = libExports.isMobile ? {
91929
91949
  width: {
91930
91950
  ideal: 640
91931
91951
  }
@@ -92050,7 +92070,7 @@
92050
92070
  onClose: onCloseCallback,
92051
92071
  flipHorizontal: flipVideoHorizontal ?? frontCamera,
92052
92072
  ref: refVideo,
92053
- videoSettings: videoSettings$2,
92073
+ videoSettings: videoSettings$4,
92054
92074
  onError: onErrorCallback,
92055
92075
  scale: cameraScale,
92056
92076
  defaultCameraId: defaultCameraId,
@@ -92161,16 +92181,16 @@
92161
92181
  isLoading: false,
92162
92182
  flipVideoHorizontal: null,
92163
92183
  customDirectionIcon: {
92164
- [ra$1.FaceDirection.LEFT]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon, {
92184
+ [ra$1.FaceDirection.LEFT]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon$1, {
92165
92185
  type: ra$1.FaceDirection.LEFT
92166
92186
  }),
92167
- [ra$1.FaceDirection.RIGHT]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon, {
92187
+ [ra$1.FaceDirection.RIGHT]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon$1, {
92168
92188
  type: ra$1.FaceDirection.RIGHT
92169
92189
  }),
92170
- [ra$1.FaceDirection.UP]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon, {
92190
+ [ra$1.FaceDirection.UP]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon$1, {
92171
92191
  type: ra$1.FaceDirection.UP
92172
92192
  }),
92173
- [ra$1.FaceDirection.FRONTAL]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon, {
92193
+ [ra$1.FaceDirection.FRONTAL]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon$1, {
92174
92194
  type: ra$1.FaceDirection.FRONTAL
92175
92195
  })
92176
92196
  },
@@ -92548,7 +92568,7 @@
92548
92568
  });
92549
92569
  }
92550
92570
 
92551
- const videoSettings$1 = libExports.isMobile ? {
92571
+ const videoSettings$3 = libExports.isMobile ? {
92552
92572
  // aspectRatio: 16 / 9,
92553
92573
  width: {
92554
92574
  ideal: 640
@@ -93081,7 +93101,7 @@
93081
93101
  flipHorizontal: frontCamera,
93082
93102
  ref: videoRef,
93083
93103
  onError: onErrorCallback,
93084
- videoSettings: videoSettings$1,
93104
+ videoSettings: videoSettings$3,
93085
93105
  closeButton: /*#__PURE__*/ jsxRuntimeExports.jsx(CloseIcon, {}),
93086
93106
  children: /*#__PURE__*/ jsxRuntimeExports.jsxs(WarmUpOverlay, {
93087
93107
  overlay: !warmupDone || !isPlaying,
@@ -93423,13 +93443,13 @@
93423
93443
  };
93424
93444
 
93425
93445
  // To reduce the calculation for blazeface
93426
- const videoSettings = libExports.isMobile ? {
93446
+ const videoSettings$2 = libExports.isMobile ? {
93427
93447
  width: {
93428
93448
  ideal: 640
93429
93449
  }
93430
93450
  } : null;
93431
93451
  // eslint-disable-next-line react/prop-types, consistent-return
93432
- const SelfieStepImageHolder = ({ stepNumber, type, theme })=>{
93452
+ const SelfieStepImageHolder$1 = ({ stepNumber, type, theme })=>{
93433
93453
  const imageHolderIcon = useDefaultThemeIcon(`instruction_${type}.svg`);
93434
93454
  // prioritize custom theme icons
93435
93455
  const customHolderSrc = get(theme, `Selfie.Active.imageHolder.${type}`);
@@ -93454,7 +93474,7 @@
93454
93474
  alt: ""
93455
93475
  });
93456
93476
  };
93457
- function renderDirectionIcon(directionIcon, directionIconAnimation) {
93477
+ function renderDirectionIcon$1(directionIcon, directionIconAnimation) {
93458
93478
  if (!directionIcon) return null;
93459
93479
  if (typeof directionIcon === 'string') {
93460
93480
  return /*#__PURE__*/ jsxRuntimeExports.jsx("img", {
@@ -93599,7 +93619,7 @@
93599
93619
  onClose: onCloseCallback,
93600
93620
  flipHorizontal: flipVideoHorizontal ?? frontCamera,
93601
93621
  ref: refVideo,
93602
- videoSettings: videoSettings,
93622
+ videoSettings: videoSettings$2,
93603
93623
  onError: onErrorCallback,
93604
93624
  scale: cameraScale,
93605
93625
  defaultCameraId: defaultCameraId,
@@ -93624,7 +93644,7 @@
93624
93644
  showErrorRing: !!faceDetectionError
93625
93645
  }),
93626
93646
  /*#__PURE__*/ jsxRuntimeExports.jsx(InstructionsOverlay, {
93627
- children: renderDirectionIcon(directionIcon, directionIconAnimation)
93647
+ children: renderDirectionIcon$1(directionIcon, directionIconAnimation)
93628
93648
  }),
93629
93649
  activeCapturing && /*#__PURE__*/ jsxRuntimeExports.jsx(CapturingOverlay, {})
93630
93650
  ]
@@ -93647,7 +93667,7 @@
93647
93667
  className: "image_preview",
93648
93668
  src: objUrl,
93649
93669
  alt: ""
93650
- }) : /*#__PURE__*/ jsxRuntimeExports.jsx(SelfieStepImageHolder, {
93670
+ }) : /*#__PURE__*/ jsxRuntimeExports.jsx(SelfieStepImageHolder$1, {
93651
93671
  stepNumber: index + 1,
93652
93672
  type: name,
93653
93673
  theme: theme
@@ -93738,16 +93758,16 @@
93738
93758
  frontCamera: true,
93739
93759
  isLoading: false,
93740
93760
  customDirectionIcon: {
93741
- [ra$1.FaceDirection.LEFT]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon, {
93761
+ [ra$1.FaceDirection.LEFT]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon$1, {
93742
93762
  type: ra$1.FaceDirection.LEFT
93743
93763
  }),
93744
- [ra$1.FaceDirection.RIGHT]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon, {
93764
+ [ra$1.FaceDirection.RIGHT]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon$1, {
93745
93765
  type: ra$1.FaceDirection.RIGHT
93746
93766
  }),
93747
- [ra$1.FaceDirection.UP]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon, {
93767
+ [ra$1.FaceDirection.UP]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon$1, {
93748
93768
  type: ra$1.FaceDirection.UP
93749
93769
  }),
93750
- [ra$1.FaceDirection.FRONTAL]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon, {
93770
+ [ra$1.FaceDirection.FRONTAL]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon$1, {
93751
93771
  type: ra$1.FaceDirection.FRONTAL
93752
93772
  })
93753
93773
  },
@@ -93875,6 +93895,706 @@
93875
93895
  };
93876
93896
  const useWrapIndicator = ()=>reactExports.useContext(WrapIndicatorContext);
93877
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
+
93878
94598
  const withClientSettings$1 = (Component)=>{
93879
94599
  return function WrappedComponent(props) {
93880
94600
  const { apiCheck, apiCredentials, serviceSettings, flowId, clientSettings } = props;
@@ -93890,16 +94610,20 @@
93890
94610
  });
93891
94611
  };
93892
94612
  };
93893
- const getLivenessModeComponent = (mode, CustomLivenessDetection)=>{
94613
+ const getLivenessModeComponent = (mode, CustomLivenessDetection, themeVersion)=>{
93894
94614
  let LivenessDetectionComponent = ActiveLiveness;
93895
94615
  if (mode === ra$1.Mode.ACTIVE) {
93896
- LivenessDetectionComponent = CustomLivenessDetection?.ActiveLiveness ?? ActiveLiveness;
94616
+ const DefaultActiveLiveness = themeVersion === 'v1' ? ActiveLivenessV1 : ActiveLiveness;
94617
+ LivenessDetectionComponent = CustomLivenessDetection?.ActiveLiveness ?? DefaultActiveLiveness;
93897
94618
  }
93898
94619
  if (mode === ra$1.Mode.PASSIVE_V2) {
93899
94620
  LivenessDetectionComponent = CustomLivenessDetection?.PassiveLivenessV2 ?? PassiveLiveness;
93900
94621
  }
93901
94622
  if (mode === ra$1.Mode.PASSIVE) {
93902
- 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;
93903
94627
  }
93904
94628
  if (typeof mode === 'string' && mode.startsWith('flash')) {
93905
94629
  LivenessDetectionComponent = CustomLivenessDetection?.FlashLiveness ?? FlashLiveness;
@@ -93912,7 +94636,7 @@
93912
94636
  }, livenessComponent: CustomLivenessDetection, customTheme = {}, customTexts, ...props } = livenessProps;
93913
94637
  const { mode, flowId, onError: onErrorFromProp, onClose: onCloseFromProp, debug, onLivenessDetectionDone } = props;
93914
94638
  const clientSettings = useClientSettings();
93915
- const { billingSettings: clientBillingSettings, enableBilling } = no$1.useSDKSettings();
94639
+ const { billingSettings: clientBillingSettings, enableBilling, themeVersion } = no$1.useSDKSettings();
93916
94640
  const billingSettingsFromSdkSettings = dD.getWebSetting(clientSettings, 'data.settings.sdk_settings.billing_settings.billing_config');
93917
94641
  const billingUrl = dD.getWebSetting(clientSettings, 'data.settings.sdk_settings.billing_settings.url');
93918
94642
  const { submitBilling } = gR({
@@ -93998,7 +94722,7 @@
93998
94722
  billingInput,
93999
94723
  onCloseFromProp
94000
94724
  ]);
94001
- const LivenessDetectionComponent = getLivenessModeComponent(mode, CustomLivenessDetection);
94725
+ const LivenessDetectionComponent = getLivenessModeComponent(mode, CustomLivenessDetection, themeVersion);
94002
94726
  return /*#__PURE__*/ jsxRuntimeExports.jsx(DebugProvider, {
94003
94727
  debug: debug,
94004
94728
  children: /*#__PURE__*/ jsxRuntimeExports.jsx(SDKCallbackProvider, {
@@ -112762,7 +113486,7 @@
112762
113486
  };
112763
113487
  };
112764
113488
 
112765
- const defaultAssetRoot = "https://vision-cdn.trustingsocial.com/tvweb-sdk.platform/0.0.0-beta.20251211-162126/assets";
113489
+ const defaultAssetRoot = "https://vision-cdn.trustingsocial.com/tvweb-sdk.platform/0.0.0-beta.20251215-165409/assets";
112766
113490
  class TVWebSDK extends gU {
112767
113491
  constructor(props){
112768
113492
  super({