@tsocial/tvweb-sdk.omg 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
  });
@@ -90591,7 +90611,7 @@
90591
90611
  }
90592
90612
  };
90593
90613
 
90594
- const videoSettings$5 = libExports.isMobile ? {
90614
+ const videoSettings$7 = libExports.isMobile ? {
90595
90615
  // aspectRatio: 16 / 9,
90596
90616
  width: {
90597
90617
  ideal: 640
@@ -91370,7 +91390,7 @@
91370
91390
  flipHorizontal: frontCamera,
91371
91391
  ref: videoRef,
91372
91392
  onError: onErrorCallback,
91373
- videoSettings: videoSettings$5,
91393
+ videoSettings: videoSettings$7,
91374
91394
  closeButton: /*#__PURE__*/ jsxRuntimeExports.jsx(CloseIcon, {}),
91375
91395
  children: /*#__PURE__*/ jsxRuntimeExports.jsxs(WarmUpOverlay, {
91376
91396
  overlay: !warmupDone || !isPlaying,
@@ -91932,11 +91952,11 @@
91932
91952
  extraConfig: null
91933
91953
  };
91934
91954
 
91935
- const DirectionalIcon = dt$1.img`
91955
+ const DirectionalIcon$1 = dt$1.img`
91936
91956
  width: ${({ width })=>width};
91937
91957
  `;
91938
91958
  // eslint-disable-next-line react/require-default-props
91939
- function DirectionIcon$1({ type }) {
91959
+ function DirectionIcon$2({ type }) {
91940
91960
  const theme = nt$2();
91941
91961
  // default icons and widths based on version
91942
91962
  const iconDirection = useThemeIcon(`Selfie.Active.directionIcon.${type}`, `${type}_arrow.gif`);
@@ -91953,7 +91973,7 @@
91953
91973
  if (type === ra$1.FaceDirection.FRONTAL) {
91954
91974
  // For frontal direction, use the SVG icon if available
91955
91975
  if (frontalIcon) {
91956
- return /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionalIcon, {
91976
+ return /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionalIcon$1, {
91957
91977
  src: frontalIcon,
91958
91978
  width: iconWidth,
91959
91979
  alt: ""
@@ -91961,20 +91981,20 @@
91961
91981
  }
91962
91982
  }
91963
91983
  if (directionIconSrc && directionIconSrc !== null) {
91964
- return /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionalIcon, {
91984
+ return /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionalIcon$1, {
91965
91985
  src: get(theme, `Selfie.Active.directionIcon.${type}`),
91966
91986
  width: iconWidth,
91967
91987
  alt: ""
91968
91988
  });
91969
91989
  }
91970
91990
  // fallback to default icons and width
91971
- return /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionalIcon, {
91991
+ return /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionalIcon$1, {
91972
91992
  src: iconDirection,
91973
91993
  alt: "",
91974
91994
  width: iconWidth
91975
91995
  });
91976
91996
  }
91977
- DirectionIcon$1.propTypes = {
91997
+ DirectionIcon$2.propTypes = {
91978
91998
  type: PropTypes.oneOf([
91979
91999
  ra$1.FaceDirection.LEFT,
91980
92000
  ra$1.FaceDirection.RIGHT,
@@ -91982,12 +92002,12 @@
91982
92002
  ra$1.FaceDirection.FRONTAL
91983
92003
  ])
91984
92004
  };
91985
- DirectionIcon$1.defaultProps = {
92005
+ DirectionIcon$2.defaultProps = {
91986
92006
  type: ra$1.FaceDirection.LEFT
91987
92007
  };
91988
92008
 
91989
92009
  // To reduce the calculation for blazeface
91990
- const videoSettings$4 = libExports.isMobile ? {
92010
+ const videoSettings$6 = libExports.isMobile ? {
91991
92011
  width: {
91992
92012
  ideal: 640
91993
92013
  }
@@ -92112,7 +92132,7 @@
92112
92132
  onClose: onCloseCallback,
92113
92133
  flipHorizontal: flipVideoHorizontal ?? frontCamera,
92114
92134
  ref: refVideo,
92115
- videoSettings: videoSettings$4,
92135
+ videoSettings: videoSettings$6,
92116
92136
  onError: onErrorCallback,
92117
92137
  scale: cameraScale,
92118
92138
  defaultCameraId: defaultCameraId,
@@ -92223,16 +92243,16 @@
92223
92243
  isLoading: false,
92224
92244
  flipVideoHorizontal: null,
92225
92245
  customDirectionIcon: {
92226
- [ra$1.FaceDirection.LEFT]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon$1, {
92246
+ [ra$1.FaceDirection.LEFT]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon$2, {
92227
92247
  type: ra$1.FaceDirection.LEFT
92228
92248
  }),
92229
- [ra$1.FaceDirection.RIGHT]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon$1, {
92249
+ [ra$1.FaceDirection.RIGHT]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon$2, {
92230
92250
  type: ra$1.FaceDirection.RIGHT
92231
92251
  }),
92232
- [ra$1.FaceDirection.UP]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon$1, {
92252
+ [ra$1.FaceDirection.UP]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon$2, {
92233
92253
  type: ra$1.FaceDirection.UP
92234
92254
  }),
92235
- [ra$1.FaceDirection.FRONTAL]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon$1, {
92255
+ [ra$1.FaceDirection.FRONTAL]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon$2, {
92236
92256
  type: ra$1.FaceDirection.FRONTAL
92237
92257
  })
92238
92258
  },
@@ -92610,7 +92630,7 @@
92610
92630
  });
92611
92631
  }
92612
92632
 
92613
- const videoSettings$3 = libExports.isMobile ? {
92633
+ const videoSettings$5 = libExports.isMobile ? {
92614
92634
  // aspectRatio: 16 / 9,
92615
92635
  width: {
92616
92636
  ideal: 640
@@ -93143,7 +93163,7 @@
93143
93163
  flipHorizontal: frontCamera,
93144
93164
  ref: videoRef,
93145
93165
  onError: onErrorCallback,
93146
- videoSettings: videoSettings$3,
93166
+ videoSettings: videoSettings$5,
93147
93167
  closeButton: /*#__PURE__*/ jsxRuntimeExports.jsx(CloseIcon, {}),
93148
93168
  children: /*#__PURE__*/ jsxRuntimeExports.jsxs(WarmUpOverlay, {
93149
93169
  overlay: !warmupDone || !isPlaying,
@@ -93485,13 +93505,13 @@
93485
93505
  };
93486
93506
 
93487
93507
  // To reduce the calculation for blazeface
93488
- const videoSettings$2 = libExports.isMobile ? {
93508
+ const videoSettings$4 = libExports.isMobile ? {
93489
93509
  width: {
93490
93510
  ideal: 640
93491
93511
  }
93492
93512
  } : null;
93493
93513
  // eslint-disable-next-line react/prop-types, consistent-return
93494
- const SelfieStepImageHolder$1 = ({ stepNumber, type, theme })=>{
93514
+ const SelfieStepImageHolder$2 = ({ stepNumber, type, theme })=>{
93495
93515
  const imageHolderIcon = useDefaultThemeIcon(`instruction_${type}.svg`);
93496
93516
  // prioritize custom theme icons
93497
93517
  const customHolderSrc = get(theme, `Selfie.Active.imageHolder.${type}`);
@@ -93516,7 +93536,7 @@
93516
93536
  alt: ""
93517
93537
  });
93518
93538
  };
93519
- function renderDirectionIcon$1(directionIcon, directionIconAnimation) {
93539
+ function renderDirectionIcon$2(directionIcon, directionIconAnimation) {
93520
93540
  if (!directionIcon) return null;
93521
93541
  if (typeof directionIcon === 'string') {
93522
93542
  return /*#__PURE__*/ jsxRuntimeExports.jsx("img", {
@@ -93661,7 +93681,7 @@
93661
93681
  onClose: onCloseCallback,
93662
93682
  flipHorizontal: flipVideoHorizontal ?? frontCamera,
93663
93683
  ref: refVideo,
93664
- videoSettings: videoSettings$2,
93684
+ videoSettings: videoSettings$4,
93665
93685
  onError: onErrorCallback,
93666
93686
  scale: cameraScale,
93667
93687
  defaultCameraId: defaultCameraId,
@@ -93686,7 +93706,7 @@
93686
93706
  showErrorRing: !!faceDetectionError
93687
93707
  }),
93688
93708
  /*#__PURE__*/ jsxRuntimeExports.jsx(InstructionsOverlay$2, {
93689
- children: renderDirectionIcon$1(directionIcon, directionIconAnimation)
93709
+ children: renderDirectionIcon$2(directionIcon, directionIconAnimation)
93690
93710
  }),
93691
93711
  activeCapturing && /*#__PURE__*/ jsxRuntimeExports.jsx(CapturingOverlay$1, {})
93692
93712
  ]
@@ -93709,7 +93729,7 @@
93709
93729
  className: "image_preview",
93710
93730
  src: objUrl,
93711
93731
  alt: ""
93712
- }) : /*#__PURE__*/ jsxRuntimeExports.jsx(SelfieStepImageHolder$1, {
93732
+ }) : /*#__PURE__*/ jsxRuntimeExports.jsx(SelfieStepImageHolder$2, {
93713
93733
  stepNumber: index + 1,
93714
93734
  type: name,
93715
93735
  theme: theme
@@ -93800,16 +93820,16 @@
93800
93820
  frontCamera: true,
93801
93821
  isLoading: false,
93802
93822
  customDirectionIcon: {
93803
- [ra$1.FaceDirection.LEFT]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon$1, {
93823
+ [ra$1.FaceDirection.LEFT]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon$2, {
93804
93824
  type: ra$1.FaceDirection.LEFT
93805
93825
  }),
93806
- [ra$1.FaceDirection.RIGHT]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon$1, {
93826
+ [ra$1.FaceDirection.RIGHT]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon$2, {
93807
93827
  type: ra$1.FaceDirection.RIGHT
93808
93828
  }),
93809
- [ra$1.FaceDirection.UP]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon$1, {
93829
+ [ra$1.FaceDirection.UP]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon$2, {
93810
93830
  type: ra$1.FaceDirection.UP
93811
93831
  }),
93812
- [ra$1.FaceDirection.FRONTAL]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon$1, {
93832
+ [ra$1.FaceDirection.FRONTAL]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon$2, {
93813
93833
  type: ra$1.FaceDirection.FRONTAL
93814
93834
  })
93815
93835
  },
@@ -93937,6 +93957,706 @@
93937
93957
  };
93938
93958
  const useWrapIndicator = ()=>reactExports.useContext(WrapIndicatorContext);
93939
93959
 
93960
+ const DirectionalIcon = dt$1.img`
93961
+ width: ${({ width })=>width};
93962
+ `;
93963
+ // eslint-disable-next-line react/require-default-props
93964
+ function DirectionIcon$1({ type }) {
93965
+ const theme = nt$2();
93966
+ // default icons and widths based on version
93967
+ const iconDirection = useThemeIcon(`Selfie.Active.directionIcon.${type}`, `${type}_arrow.gif`);
93968
+ const iconWidth = getTheme(`Selfie.Active.directionIcon.${type}Width`)({
93969
+ theme
93970
+ });
93971
+ // prioritize custom theme icons
93972
+ const directionIconSrc = get(theme, `Selfie.Active.directionIcon.${type}`);
93973
+ if (directionIconSrc === null) {
93974
+ // eslint-disable-next-line react/jsx-no-useless-fragment
93975
+ return /*#__PURE__*/ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {});
93976
+ }
93977
+ if (directionIconSrc && directionIconSrc !== null) {
93978
+ return /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionalIcon, {
93979
+ src: get(theme, `Selfie.Active.directionIcon.${type}`),
93980
+ width: iconWidth,
93981
+ alt: ""
93982
+ });
93983
+ }
93984
+ // fallback to default icons and width
93985
+ return /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionalIcon, {
93986
+ src: iconDirection,
93987
+ alt: "",
93988
+ width: iconWidth
93989
+ });
93990
+ }
93991
+ DirectionIcon$1.propTypes = {
93992
+ type: PropTypes.oneOf([
93993
+ ra$1.FaceDirection.LEFT,
93994
+ ra$1.FaceDirection.RIGHT,
93995
+ ra$1.FaceDirection.UP,
93996
+ ra$1.FaceDirection.FRONTAL
93997
+ ])
93998
+ };
93999
+ DirectionIcon$1.defaultProps = {
94000
+ type: ra$1.FaceDirection.LEFT
94001
+ };
94002
+
94003
+ // To reduce the calculation for blazeface
94004
+ const videoSettings$3 = libExports.isMobile ? {
94005
+ width: {
94006
+ ideal: 640
94007
+ }
94008
+ } : null;
94009
+ // eslint-disable-next-line react/prop-types, consistent-return
94010
+ const SelfieStepImageHolder$1 = ({ stepNumber, type, theme })=>{
94011
+ const imageHolderIcon = useDefaultThemeIcon(`instruction_${type}.svg`);
94012
+ // prioritize custom theme icons
94013
+ const customHolderSrc = get(theme, `Selfie.Active.imageHolder.${type}`);
94014
+ if (customHolderSrc === null) {
94015
+ // eslint-disable-next-line react/jsx-no-useless-fragment
94016
+ return /*#__PURE__*/ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {});
94017
+ }
94018
+ if (typeof customHolderSrc === 'string' && customHolderSrc !== '') {
94019
+ return /*#__PURE__*/ jsxRuntimeExports.jsx("img", {
94020
+ src: customHolderSrc,
94021
+ alt: ""
94022
+ });
94023
+ }
94024
+ // v1: use step number
94025
+ if (get(theme, 'themeVersion') === 'v1') {
94026
+ return /*#__PURE__*/ jsxRuntimeExports.jsx("span", {
94027
+ children: stepNumber
94028
+ });
94029
+ }
94030
+ return /*#__PURE__*/ jsxRuntimeExports.jsx("img", {
94031
+ src: imageHolderIcon,
94032
+ alt: ""
94033
+ });
94034
+ };
94035
+ function renderDirectionIcon$1(directionIcon, directionIconAnimation) {
94036
+ if (!directionIcon) return null;
94037
+ if (typeof directionIcon === 'string') {
94038
+ return /*#__PURE__*/ jsxRuntimeExports.jsx("img", {
94039
+ className: directionIconAnimation,
94040
+ src: directionIcon,
94041
+ alt: "",
94042
+ style: {
94043
+ maxWidth: '98px',
94044
+ maxHeight: '98px',
94045
+ marginBottom: '25px'
94046
+ }
94047
+ });
94048
+ }
94049
+ return directionIcon;
94050
+ }
94051
+ // eslint-disable-next-line react/require-default-props
94052
+ function ActiveLivenessV1(props) {
94053
+ const { apiCheck, onLivenessDetectionDone, captureFrameSettings, onFramesCaptured, frontCamera, flipVideoHorizontal, customDirectionIcon, customStepTimeConstraints, onProcessing, customErrors, apiCredentials, outputEncryptionSettings, cameraScale, defaultCameraId, offsetFaceY, styledComponent, isLoading, serviceSettings, onReset } = props;
94054
+ const theme = nt$2();
94055
+ const { onErrorCallback, onCloseCallback } = useSDKCallback();
94056
+ const bgCameraMask = iH.useAsset('bg_camera_mask.png');
94057
+ const bgCameraMaskRed = iH.useAsset('bg_camera_mask_red.png');
94058
+ const icLoading = useThemeIcon('IDCapturing.loadingIcon.src', 'ic_loading.gif');
94059
+ const [uiSpacing, setUISpacing] = reactExports.useState({});
94060
+ const { yFaceVerificationStepsWrapper, yFaceDetectionError } = uiSpacing;
94061
+ const [remainingTime, setRemainingTime] = reactExports.useState('');
94062
+ const [currentOrientation, setCurrentOrientation] = reactExports.useState();
94063
+ const surroundStyle = reactExports.useMemo(()=>({
94064
+ backgroundColor: getTheme('Selfie.backgroundColor')({
94065
+ theme
94066
+ })
94067
+ }), [
94068
+ theme
94069
+ ]);
94070
+ // preload icons
94071
+ usePreloadThemeAsset(get(theme, 'themeVersion'), 'up_arrow.gif');
94072
+ usePreloadThemeAsset(get(theme, 'themeVersion'), 'left_arrow.gif');
94073
+ usePreloadThemeAsset(get(theme, 'themeVersion'), 'right_arrow.gif');
94074
+ usePreloadThemeAsset(get(theme, 'themeVersion'), 'frontal_arrow.gif');
94075
+ usePreloadThemeAsset(get(theme, 'themeVersion'), 'instruction_up.svg');
94076
+ usePreloadThemeAsset(get(theme, 'themeVersion'), 'instruction_left.svg');
94077
+ usePreloadThemeAsset(get(theme, 'themeVersion'), 'instruction_right.svg');
94078
+ usePreloadThemeAsset(get(theme, 'themeVersion'), 'instruction_frontal.svg');
94079
+ const cropAreaDimension = reactExports.useCallback(({ clientHeight, videoAreaWidth, videoAreaHeight, lostX, lostY })=>{
94080
+ let width;
94081
+ let height;
94082
+ if (libExports.isMobile) {
94083
+ width = videoAreaWidth;
94084
+ height = width;
94085
+ } else {
94086
+ height = videoAreaHeight - 200;
94087
+ width = height;
94088
+ }
94089
+ const x = Math.floor((videoAreaWidth - width) / 2) + lostX;
94090
+ let y = 5 + lostY;
94091
+ const yFaceDetectionErrorNew = lostY + 25;
94092
+ const yCropAreaNew = yFaceDetectionErrorNew + 30;
94093
+ const yFaceVerificationStepsWrapperNew = yCropAreaNew + height + 20;
94094
+ setUISpacing({
94095
+ yFaceDetectionError: yFaceDetectionErrorNew,
94096
+ yFaceVerificationStepsWrapper: yFaceVerificationStepsWrapperNew
94097
+ });
94098
+ const topLimit = Math.floor(lostY);
94099
+ const botLimit = Math.floor(clientHeight - lostY);
94100
+ y = Math.floor(yCropAreaNew); // floor the y value to avoid blur line on ios safari
94101
+ if (offsetFaceY !== 0 && (y + offsetFaceY < topLimit || y + offsetFaceY + height > botLimit)) {
94102
+ onErrorCallback({
94103
+ code: `offsetFaceY must be in [-${y - topLimit}, ${botLimit - height - y}]`
94104
+ });
94105
+ } else {
94106
+ y += offsetFaceY;
94107
+ }
94108
+ return {
94109
+ x,
94110
+ y,
94111
+ width,
94112
+ height
94113
+ };
94114
+ }, [
94115
+ offsetFaceY,
94116
+ onErrorCallback
94117
+ ]);
94118
+ const { shouldResetFlowOnOrientationChange, cropArea, curStepIndex, directionIcon, directionIconAnimation, faceDetectionError, resetFlow, handleVideoPlayed, instructions, refVideo, refIsReseting, steps, videoPlayed, activeCapturing, warmupDone, showLoading } = useActiveLiveness$1({
94119
+ currentOrientation,
94120
+ apiCheck,
94121
+ bgCameraMask,
94122
+ bgCameraMaskRed,
94123
+ surroundStyle,
94124
+ onLivenessDetectionDone,
94125
+ onError: onErrorCallback,
94126
+ cropAreaDimension,
94127
+ customDirectionIcon,
94128
+ captureFrameSettings,
94129
+ onFramesCaptured,
94130
+ setRemainingTime,
94131
+ customStepTimeConstraints,
94132
+ onProcessing,
94133
+ customErrors,
94134
+ apiCredentials,
94135
+ outputEncryptionSettings,
94136
+ cameraScale,
94137
+ serviceSettings,
94138
+ onReset
94139
+ });
94140
+ reactExports.useEffect(()=>{
94141
+ if (typeof steps[0]?.directionIcon === 'string') {
94142
+ Promise.all(steps.map((step)=>preloadImage$2(step.directionIcon)));
94143
+ }
94144
+ }, [
94145
+ steps
94146
+ ]);
94147
+ const { CloseCameraButton } = styledComponent;
94148
+ const progressCircleProps = getProgressCircleProps$2(props, theme);
94149
+ const currentProgress = !refIsReseting.current ? curStepIndex / steps.length * 100 : 0;
94150
+ // for error text
94151
+ const { lang } = no$1.useSDKSettings();
94152
+ const timer = reactExports.useRef(0);
94153
+ const lastError = reactExports.useRef({});
94154
+ const duration = reactExports.useRef(ra$1.ErrorDuration.SHORT);
94155
+ const lastErrorMsg = reactExports.useMemo(()=>{
94156
+ const { msg, duration: errorDuration = ra$1.ErrorDuration.SHORT } = faceDetectionError || {};
94157
+ const errorMsg = msg?.[lang];
94158
+ if (Date.now() - timer.current >= duration.current) {
94159
+ timer.current = Date.now();
94160
+ duration.current = errorDuration;
94161
+ lastError.current = errorMsg;
94162
+ }
94163
+ return lastError.current;
94164
+ // eslint-disable-next-line react-hooks/exhaustive-deps
94165
+ }, [
94166
+ faceDetectionError,
94167
+ curStepIndex
94168
+ ]); // curStepIndex is used to get the latest error when reset flow
94169
+ const onOrientationChange = reactExports.useCallback((curOrientation)=>{
94170
+ setCurrentOrientation(curOrientation);
94171
+ if (!shouldResetFlowOnOrientationChange) {
94172
+ if (curOrientation === MODE.LANDSCAPE) {
94173
+ refVideo.current?.pause();
94174
+ } else {
94175
+ refVideo.current?.play();
94176
+ }
94177
+ } else {
94178
+ resetFlow();
94179
+ }
94180
+ }, [
94181
+ refVideo,
94182
+ resetFlow,
94183
+ shouldResetFlowOnOrientationChange
94184
+ ]);
94185
+ return /*#__PURE__*/ jsxRuntimeExports.jsx(OrientationDetection, {
94186
+ onOrientationChange: onOrientationChange,
94187
+ children: /*#__PURE__*/ jsxRuntimeExports.jsxs(Camera$3, {
94188
+ frontCamera: frontCamera,
94189
+ onVideoPlayed: handleVideoPlayed,
94190
+ onClose: onCloseCallback,
94191
+ flipHorizontal: flipVideoHorizontal ?? frontCamera,
94192
+ ref: refVideo,
94193
+ videoSettings: videoSettings$3,
94194
+ onError: onErrorCallback,
94195
+ scale: cameraScale,
94196
+ defaultCameraId: defaultCameraId,
94197
+ closeButton: CloseCameraButton || null,
94198
+ children: [
94199
+ !warmupDone && /*#__PURE__*/ jsxRuntimeExports.jsx(WarmupPopup, {}),
94200
+ videoPlayed ? /*#__PURE__*/ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
94201
+ children: [
94202
+ cropArea.current ? /*#__PURE__*/ jsxRuntimeExports.jsxs(CropAreaOverlayWrapper, {
94203
+ x: `${cropArea.current.x}px`,
94204
+ y: `${cropArea.current.y}px`,
94205
+ width: `${cropArea.current.width}px`,
94206
+ height: `${cropArea.current.height}px`,
94207
+ surroundStyle: cropArea.current.surroundStyle,
94208
+ children: [
94209
+ /*#__PURE__*/ jsxRuntimeExports.jsx(StyledCameraMark$2, {}),
94210
+ /*#__PURE__*/ jsxRuntimeExports.jsx(OverlayProgressCircle$2, {
94211
+ ...progressCircleProps,
94212
+ progress: currentProgress,
94213
+ showErrorRing: !!faceDetectionError && getTheme('Selfie.progressCircle.showErrorRing')({
94214
+ theme
94215
+ })
94216
+ }),
94217
+ /*#__PURE__*/ jsxRuntimeExports.jsx(InstructionsOverlay$2, {
94218
+ children: renderDirectionIcon$1(directionIcon, directionIconAnimation)
94219
+ }),
94220
+ activeCapturing && /*#__PURE__*/ jsxRuntimeExports.jsx(CapturingOverlay$1, {})
94221
+ ]
94222
+ }) : null,
94223
+ instructions ? /*#__PURE__*/ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
94224
+ children: [
94225
+ /*#__PURE__*/ jsxRuntimeExports.jsx(FaceVerificationInstructions$1, {
94226
+ top: yFaceVerificationStepsWrapper + 5,
94227
+ className: "instructions",
94228
+ children: instructions
94229
+ }),
94230
+ /*#__PURE__*/ jsxRuntimeExports.jsx(FaceVerificationStepsWrapper$2, {
94231
+ top: yFaceVerificationStepsWrapper + 35,
94232
+ children: steps.map((step, index)=>{
94233
+ const { name, image: { objUrl } } = step;
94234
+ return /*#__PURE__*/ jsxRuntimeExports.jsx(StepItem$2, {
94235
+ active: curStepIndex >= index,
94236
+ className: "step-item",
94237
+ children: objUrl ? /*#__PURE__*/ jsxRuntimeExports.jsx("img", {
94238
+ className: "image_preview",
94239
+ src: objUrl,
94240
+ alt: ""
94241
+ }) : /*#__PURE__*/ jsxRuntimeExports.jsx(SelfieStepImageHolder$1, {
94242
+ stepNumber: index + 1,
94243
+ type: name,
94244
+ theme: theme
94245
+ })
94246
+ }, name);
94247
+ })
94248
+ })
94249
+ ]
94250
+ }) : null
94251
+ ]
94252
+ }) : null,
94253
+ (showLoading || isLoading) && /*#__PURE__*/ jsxRuntimeExports.jsx(LoadingIcon$5, {
94254
+ children: /*#__PURE__*/ jsxRuntimeExports.jsx("img", {
94255
+ src: icLoading,
94256
+ alt: "",
94257
+ className: "spin"
94258
+ })
94259
+ }),
94260
+ remainingTime && /*#__PURE__*/ jsxRuntimeExports.jsx(CountdownTime$1, {
94261
+ top: yFaceVerificationStepsWrapper - 30,
94262
+ children: remainingTime
94263
+ }),
94264
+ typeof lastErrorMsg === 'string' ? /*#__PURE__*/ jsxRuntimeExports.jsx(SimpleFaceDetectionError, {
94265
+ top: yFaceDetectionError - 15,
94266
+ className: "face-detection-error",
94267
+ children: lastErrorMsg
94268
+ }) : null
94269
+ ]
94270
+ })
94271
+ });
94272
+ }
94273
+ ActiveLivenessV1.propTypes = {
94274
+ apiCheck: PropTypes.bool,
94275
+ onLivenessDetectionDone: PropTypes.func,
94276
+ onClose: PropTypes.func,
94277
+ onError: PropTypes.func,
94278
+ onReset: PropTypes.func,
94279
+ captureFrameSettings: PropTypes.shape({}),
94280
+ onFramesCaptured: PropTypes.func,
94281
+ flipVideoHorizontal: PropTypes.bool,
94282
+ frontCamera: PropTypes.bool,
94283
+ isLoading: PropTypes.bool,
94284
+ customDirectionIcon: PropTypes.shape({}),
94285
+ customStepTimeConstraints: PropTypes.shape({}),
94286
+ onProcessing: PropTypes.func,
94287
+ customErrors: PropTypes.shape({}),
94288
+ apiCredentials: PropTypes.shape({
94289
+ accessKey: PropTypes.string,
94290
+ secretKey: PropTypes.string,
94291
+ apiUrl: PropTypes.string
94292
+ }),
94293
+ outputEncryptionSettings: PropTypes.shape({}),
94294
+ cameraScale: PropTypes.number,
94295
+ defaultCameraId: PropTypes.string,
94296
+ offsetFaceY: PropTypes.number,
94297
+ styledComponent: PropTypes.shape({
94298
+ CloseCameraButton: PropTypes.node
94299
+ }),
94300
+ serviceSettings: PropTypes.shape({})
94301
+ };
94302
+ ActiveLivenessV1.defaultProps = {
94303
+ apiCheck: false,
94304
+ onLivenessDetectionDone: null,
94305
+ onClose: null,
94306
+ onError: ()=>{},
94307
+ onReset: ()=>{},
94308
+ captureFrameSettings: {
94309
+ enable: false,
94310
+ framesIntervalTime: 180,
94311
+ framesBatchLength: 0
94312
+ },
94313
+ onFramesCaptured: ()=>{},
94314
+ flipVideoHorizontal: null,
94315
+ frontCamera: true,
94316
+ isLoading: false,
94317
+ customDirectionIcon: {
94318
+ [ra$1.FaceDirection.LEFT]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon$1, {
94319
+ type: ra$1.FaceDirection.LEFT
94320
+ }),
94321
+ [ra$1.FaceDirection.RIGHT]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon$1, {
94322
+ type: ra$1.FaceDirection.RIGHT
94323
+ }),
94324
+ [ra$1.FaceDirection.UP]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon$1, {
94325
+ type: ra$1.FaceDirection.UP
94326
+ }),
94327
+ [ra$1.FaceDirection.FRONTAL]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon$1, {
94328
+ type: ra$1.FaceDirection.FRONTAL
94329
+ })
94330
+ },
94331
+ customStepTimeConstraints: {
94332
+ [ra$1.FaceDirection.UP]: {
94333
+ delayTime: 0
94334
+ },
94335
+ [ra$1.FaceDirection.LEFT]: {
94336
+ delayTime: 0
94337
+ },
94338
+ [ra$1.FaceDirection.RIGHT]: {
94339
+ delayTime: 0
94340
+ },
94341
+ [ra$1.FaceDirection.FRONTAL]: {
94342
+ delayTime: 2000
94343
+ }
94344
+ },
94345
+ onProcessing: ()=>{},
94346
+ customErrors: null,
94347
+ apiCredentials: {
94348
+ accessKey: '',
94349
+ secretKey: '',
94350
+ apiUrl: ''
94351
+ },
94352
+ outputEncryptionSettings: null,
94353
+ cameraScale: 1,
94354
+ defaultCameraId: undefined,
94355
+ offsetFaceY: 0,
94356
+ styledComponent: {
94357
+ CloseCameraButton: null
94358
+ },
94359
+ serviceSettings: {
94360
+ enableUploadFrames: true,
94361
+ enableUploadImages: true,
94362
+ enableVerifySanityPortrait: true,
94363
+ enableVerifySanityIDCard: true,
94364
+ enableVerifyFaceLiveness: true,
94365
+ enableDetectIDCardTampering: true,
94366
+ enableReadIDCardInfo: true
94367
+ }
94368
+ };
94369
+
94370
+ // To reduce the calculation for blazeface
94371
+ const videoSettings$2 = libExports.isMobile ? {
94372
+ width: {
94373
+ ideal: 640
94374
+ }
94375
+ } : null;
94376
+ // eslint-disable-next-line react/require-default-props
94377
+ function PassiveLivenessOldV1(props) {
94378
+ const { apiCheck, onLivenessDetectionDone, captureFrameSettings, onFramesCaptured, frontCamera, flipVideoHorizontal, customDirectionIcon, customStepTimeConstraints, onProcessing, customErrors, apiCredentials, outputEncryptionSettings, cameraScale, defaultCameraId, passiveModeAuto, offsetFaceY, styledComponent, serviceSettings, onReset, isLoading } = props;
94379
+ const theme = nt$2();
94380
+ const { onErrorCallback, onCloseCallback } = useSDKCallback();
94381
+ const bgCameraMask = iH.useAsset('bg_camera_mask.png');
94382
+ const bgCameraMaskRed = iH.useAsset('bg_camera_mask_red.png');
94383
+ const icLoading = useThemeIcon('IDCapturing.loadingIcon.src', 'ic_loading.gif');
94384
+ const [uiSpacing, setUISpacing] = reactExports.useState({});
94385
+ const { yFaceDetectionError, yFaceVerificationStepsWrapper } = uiSpacing;
94386
+ const [remainingTime, setRemainingTime] = reactExports.useState('');
94387
+ const [currentOrientation, setCurrentOrientation] = reactExports.useState();
94388
+ const surroundStyle = reactExports.useMemo(()=>({
94389
+ backgroundColor: getTheme('Selfie.backgroundColor')({
94390
+ theme
94391
+ })
94392
+ }), [
94393
+ theme
94394
+ ]);
94395
+ const cropAreaDimension = reactExports.useCallback(({ lostY, height, clientHeight })=>{
94396
+ const yFaceDetectionErrorNew = lostY + 25;
94397
+ const yCropAreaNew = yFaceDetectionErrorNew + 30;
94398
+ const yFaceVerificationStepsWrapperNew = yCropAreaNew + height + 20;
94399
+ setUISpacing({
94400
+ yFaceDetectionError: yFaceDetectionErrorNew,
94401
+ yFaceVerificationStepsWrapper: yFaceVerificationStepsWrapperNew
94402
+ });
94403
+ const topLimit = Math.floor(lostY);
94404
+ const botLimit = Math.floor(clientHeight - lostY);
94405
+ let y = Math.floor(yCropAreaNew); // floor the y value to avoid blur line on ios safari
94406
+ if (offsetFaceY !== 0 && (y + offsetFaceY < topLimit || y + offsetFaceY + height > botLimit)) {
94407
+ onErrorCallback({
94408
+ code: `offsetFaceY must be in [-${y - topLimit}, ${botLimit - height - y}]`
94409
+ });
94410
+ } else {
94411
+ y += offsetFaceY;
94412
+ }
94413
+ return {
94414
+ y
94415
+ };
94416
+ }, [
94417
+ offsetFaceY,
94418
+ onErrorCallback
94419
+ ]);
94420
+ const { shouldResetFlowOnOrientationChange, countdownToTakePicture, cropArea, curStepIndex, faceDetectionError, resetFlow, handleTriggerPassiveMode, handleVideoPlayed, refVideo, showCountdown, steps, refIsReseting, videoPlayed, warmupDone, showCaptureButton, shouldShowCountdown, showLoading } = usePassiveLiveness$1({
94421
+ currentOrientation,
94422
+ apiCheck,
94423
+ bgCameraMask,
94424
+ bgCameraMaskRed,
94425
+ surroundStyle,
94426
+ onLivenessDetectionDone,
94427
+ onError: onErrorCallback,
94428
+ cropAreaDimension,
94429
+ customDirectionIcon,
94430
+ captureFrameSettings,
94431
+ onFramesCaptured,
94432
+ setRemainingTime,
94433
+ customStepTimeConstraints,
94434
+ onProcessing,
94435
+ customErrors,
94436
+ apiCredentials,
94437
+ outputEncryptionSettings,
94438
+ cameraScale,
94439
+ passiveModeAuto,
94440
+ serviceSettings,
94441
+ onReset
94442
+ });
94443
+ reactExports.useEffect(()=>{
94444
+ if (typeof steps[0]?.directionIcon === 'string') {
94445
+ Promise.all(steps.map((step)=>preloadImage$2(step.directionIcon)));
94446
+ }
94447
+ }, [
94448
+ steps
94449
+ ]);
94450
+ const { CloseCameraButton } = styledComponent;
94451
+ const progressCircleProps = getProgressCircleProps$2(props, theme);
94452
+ const currentProgress = !refIsReseting.current ? curStepIndex / steps.length * 100 : 0;
94453
+ // for error text
94454
+ const { lang } = no$1.useSDKSettings();
94455
+ const timer = reactExports.useRef(0);
94456
+ const lastError = reactExports.useRef({});
94457
+ const duration = reactExports.useRef(ra$1.ErrorDuration.SHORT);
94458
+ const lastErrorMsg = reactExports.useMemo(()=>{
94459
+ const { msg, duration: errorDuration = ra$1.ErrorDuration.SHORT } = faceDetectionError || {};
94460
+ const errorMsg = msg?.[lang];
94461
+ if (Date.now() - timer.current >= duration.current) {
94462
+ timer.current = Date.now();
94463
+ duration.current = errorDuration;
94464
+ lastError.current = errorMsg;
94465
+ }
94466
+ return lastError.current;
94467
+ // eslint-disable-next-line react-hooks/exhaustive-deps
94468
+ }, [
94469
+ faceDetectionError,
94470
+ curStepIndex
94471
+ ]); // curStepIndex is used to get the latest error when reset flow
94472
+ const onOrientationChange = reactExports.useCallback((curOrientation)=>{
94473
+ setCurrentOrientation(curOrientation);
94474
+ if (!shouldResetFlowOnOrientationChange) {
94475
+ if (curOrientation === MODE.LANDSCAPE) {
94476
+ refVideo.current?.pause();
94477
+ } else {
94478
+ refVideo.current?.play();
94479
+ }
94480
+ } else {
94481
+ resetFlow();
94482
+ }
94483
+ }, [
94484
+ refVideo,
94485
+ resetFlow,
94486
+ shouldResetFlowOnOrientationChange
94487
+ ]);
94488
+ return /*#__PURE__*/ jsxRuntimeExports.jsx(OrientationDetection, {
94489
+ onOrientationChange: onOrientationChange,
94490
+ children: /*#__PURE__*/ jsxRuntimeExports.jsxs(Camera$3, {
94491
+ frontCamera: frontCamera,
94492
+ onVideoPlayed: handleVideoPlayed,
94493
+ onClose: onCloseCallback,
94494
+ flipHorizontal: flipVideoHorizontal ?? frontCamera,
94495
+ ref: refVideo,
94496
+ videoSettings: videoSettings$2,
94497
+ onError: onErrorCallback,
94498
+ scale: cameraScale,
94499
+ defaultCameraId: defaultCameraId,
94500
+ closeButton: CloseCameraButton || null,
94501
+ children: [
94502
+ !warmupDone && /*#__PURE__*/ jsxRuntimeExports.jsx(WarmupPopup, {}),
94503
+ videoPlayed ? /*#__PURE__*/ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
94504
+ children: [
94505
+ typeof lastErrorMsg === 'string' ? /*#__PURE__*/ jsxRuntimeExports.jsx(SimpleFaceDetectionError, {
94506
+ top: yFaceDetectionError - 15,
94507
+ className: "face-detection-error",
94508
+ children: lastErrorMsg
94509
+ }) : null,
94510
+ cropArea.current ? /*#__PURE__*/ jsxRuntimeExports.jsxs(CropAreaOverlayWrapper, {
94511
+ x: `${cropArea.current.x}px`,
94512
+ y: `${cropArea.current.y}px`,
94513
+ width: `${cropArea.current.width}px`,
94514
+ height: `${cropArea.current.height}px`,
94515
+ surroundStyle: cropArea.current.surroundStyle,
94516
+ children: [
94517
+ /*#__PURE__*/ jsxRuntimeExports.jsx(StyledCameraMark$2, {}),
94518
+ /*#__PURE__*/ jsxRuntimeExports.jsx(OverlayProgressCircle$2, {
94519
+ ...progressCircleProps,
94520
+ progress: currentProgress,
94521
+ showErrorRing: !!faceDetectionError && getTheme('Selfie.progressCircle.showErrorRing')({
94522
+ theme
94523
+ })
94524
+ }),
94525
+ shouldShowCountdown ? /*#__PURE__*/ jsxRuntimeExports.jsx(CountDownOverlay$3, {
94526
+ children: countdownToTakePicture
94527
+ }) : null,
94528
+ faceDetectionError && /*#__PURE__*/ jsxRuntimeExports.jsx(ErrorOverlay$1, {})
94529
+ ]
94530
+ }) : null,
94531
+ remainingTime && /*#__PURE__*/ jsxRuntimeExports.jsx(CountdownTime$1, {
94532
+ top: yFaceVerificationStepsWrapper - 30,
94533
+ children: remainingTime
94534
+ }),
94535
+ showCaptureButton ? /*#__PURE__*/ jsxRuntimeExports.jsx(BottomButtonsOverlay$2, {
94536
+ children: /*#__PURE__*/ jsxRuntimeExports.jsx(Button$7, {
94537
+ onClick: handleTriggerPassiveMode,
94538
+ disabled: showCountdown,
94539
+ children: get(theme, 'Selfie.captureIcon.src') ? /*#__PURE__*/ jsxRuntimeExports.jsx("img", {
94540
+ src: get(theme, 'Selfie.captureIcon.src'),
94541
+ alt: ""
94542
+ }) : /*#__PURE__*/ jsxRuntimeExports.jsx(CameraIcon$1, {
94543
+ fillColor: "rgba(193, 197, 204, 1)"
94544
+ })
94545
+ })
94546
+ }) : null
94547
+ ]
94548
+ }) : null,
94549
+ (showLoading || isLoading) && /*#__PURE__*/ jsxRuntimeExports.jsx(LoadingIcon$5, {
94550
+ children: /*#__PURE__*/ jsxRuntimeExports.jsx("img", {
94551
+ src: icLoading,
94552
+ alt: ""
94553
+ })
94554
+ })
94555
+ ]
94556
+ })
94557
+ });
94558
+ }
94559
+ PassiveLivenessOldV1.propTypes = {
94560
+ apiCheck: PropTypes.bool,
94561
+ mode: PropTypes.string,
94562
+ onLivenessDetectionDone: PropTypes.func,
94563
+ onClose: PropTypes.func,
94564
+ onError: PropTypes.func,
94565
+ onReset: PropTypes.func,
94566
+ captureFrameSettings: PropTypes.shape({}),
94567
+ onFramesCaptured: PropTypes.func,
94568
+ frontCamera: PropTypes.bool,
94569
+ isLoading: PropTypes.bool,
94570
+ flipVideoHorizontal: PropTypes.bool,
94571
+ customDirectionIcon: PropTypes.shape({}),
94572
+ customStepTimeConstraints: PropTypes.shape({}),
94573
+ onProcessing: PropTypes.func,
94574
+ customErrors: PropTypes.shape({}),
94575
+ apiCredentials: PropTypes.shape({
94576
+ accessKey: PropTypes.string,
94577
+ secretKey: PropTypes.string,
94578
+ apiUrl: PropTypes.string
94579
+ }),
94580
+ outputEncryptionSettings: PropTypes.shape({}),
94581
+ cameraScale: PropTypes.number,
94582
+ defaultCameraId: PropTypes.string,
94583
+ passiveModeAuto: PropTypes.bool,
94584
+ offsetFaceY: PropTypes.number,
94585
+ styledComponent: PropTypes.shape({
94586
+ CloseCameraButton: PropTypes.node
94587
+ }),
94588
+ serviceSettings: PropTypes.shape({})
94589
+ };
94590
+ PassiveLivenessOldV1.defaultProps = {
94591
+ apiCheck: false,
94592
+ mode: null,
94593
+ onLivenessDetectionDone: null,
94594
+ onClose: null,
94595
+ onError: ()=>{},
94596
+ onReset: ()=>{},
94597
+ captureFrameSettings: {
94598
+ enable: false,
94599
+ framesIntervalTime: 180,
94600
+ framesBatchLength: 0
94601
+ },
94602
+ onFramesCaptured: ()=>{},
94603
+ frontCamera: true,
94604
+ isLoading: false,
94605
+ flipVideoHorizontal: null,
94606
+ customDirectionIcon: {
94607
+ [ra$1.FaceDirection.LEFT]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon$2, {
94608
+ type: ra$1.FaceDirection.LEFT
94609
+ }),
94610
+ [ra$1.FaceDirection.RIGHT]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon$2, {
94611
+ type: ra$1.FaceDirection.RIGHT
94612
+ }),
94613
+ [ra$1.FaceDirection.UP]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon$2, {
94614
+ type: ra$1.FaceDirection.UP
94615
+ }),
94616
+ [ra$1.FaceDirection.FRONTAL]: /*#__PURE__*/ jsxRuntimeExports.jsx(DirectionIcon$2, {
94617
+ type: ra$1.FaceDirection.FRONTAL
94618
+ })
94619
+ },
94620
+ customStepTimeConstraints: {
94621
+ [ra$1.FaceDirection.UP]: {
94622
+ delayTime: 0
94623
+ },
94624
+ [ra$1.FaceDirection.LEFT]: {
94625
+ delayTime: 0
94626
+ },
94627
+ [ra$1.FaceDirection.RIGHT]: {
94628
+ delayTime: 0
94629
+ },
94630
+ [ra$1.FaceDirection.FRONTAL]: {
94631
+ delayTime: 2000
94632
+ }
94633
+ },
94634
+ onProcessing: ()=>{},
94635
+ customErrors: null,
94636
+ apiCredentials: {
94637
+ accessKey: '',
94638
+ secretKey: '',
94639
+ apiUrl: ''
94640
+ },
94641
+ outputEncryptionSettings: null,
94642
+ cameraScale: 1,
94643
+ defaultCameraId: undefined,
94644
+ passiveModeAuto: false,
94645
+ offsetFaceY: 0,
94646
+ styledComponent: {
94647
+ CloseCameraButton: null
94648
+ },
94649
+ serviceSettings: {
94650
+ enableUploadFrames: true,
94651
+ enableUploadImages: true,
94652
+ enableVerifySanityPortrait: true,
94653
+ enableVerifySanityIDCard: true,
94654
+ enableVerifyFaceLiveness: true,
94655
+ enableDetectIDCardTampering: true,
94656
+ enableReadIDCardInfo: true
94657
+ }
94658
+ };
94659
+
93940
94660
  const withClientSettings$1 = (Component)=>{
93941
94661
  return function WrappedComponent(props) {
93942
94662
  const { apiCheck, apiCredentials, serviceSettings, flowId, clientSettings } = props;
@@ -93952,16 +94672,20 @@
93952
94672
  });
93953
94673
  };
93954
94674
  };
93955
- const getLivenessModeComponent = (mode, CustomLivenessDetection)=>{
94675
+ const getLivenessModeComponent = (mode, CustomLivenessDetection, themeVersion)=>{
93956
94676
  let LivenessDetectionComponent = ActiveLiveness;
93957
94677
  if (mode === ra$1.Mode.ACTIVE) {
93958
- LivenessDetectionComponent = CustomLivenessDetection?.ActiveLiveness ?? ActiveLiveness;
94678
+ const DefaultActiveLiveness = themeVersion === 'v1' ? ActiveLivenessV1 : ActiveLiveness;
94679
+ LivenessDetectionComponent = CustomLivenessDetection?.ActiveLiveness ?? DefaultActiveLiveness;
93959
94680
  }
93960
94681
  if (mode === ra$1.Mode.PASSIVE_V2) {
93961
94682
  LivenessDetectionComponent = CustomLivenessDetection?.PassiveLivenessV2 ?? PassiveLiveness;
93962
94683
  }
93963
94684
  if (mode === ra$1.Mode.PASSIVE) {
93964
- LivenessDetectionComponent = CustomLivenessDetection?.PassiveLiveness ?? PassiveLiveness$1;
94685
+ // PassiveLivenessOldV1 to not be confused with PassiveLivenessV2 (which is totally new mode)
94686
+ // PassiveLivenessOldV1 refers to PassiveLiveness with themeVersion = "v1"
94687
+ const DefaultPassiveLiveness = themeVersion === 'v1' ? PassiveLivenessOldV1 : PassiveLiveness$1;
94688
+ LivenessDetectionComponent = CustomLivenessDetection?.PassiveLiveness ?? DefaultPassiveLiveness;
93965
94689
  }
93966
94690
  if (typeof mode === 'string' && mode.startsWith('flash')) {
93967
94691
  LivenessDetectionComponent = CustomLivenessDetection?.FlashLiveness ?? FlashLiveness;
@@ -93974,7 +94698,7 @@
93974
94698
  }, livenessComponent: CustomLivenessDetection, customTheme = {}, customTexts, ...props } = livenessProps;
93975
94699
  const { mode, flowId, onError: onErrorFromProp, onClose: onCloseFromProp, debug, onLivenessDetectionDone } = props;
93976
94700
  const clientSettings = useClientSettings();
93977
- const { billingSettings: clientBillingSettings, enableBilling } = no$1.useSDKSettings();
94701
+ const { billingSettings: clientBillingSettings, enableBilling, themeVersion } = no$1.useSDKSettings();
93978
94702
  const billingSettingsFromSdkSettings = dD.getWebSetting(clientSettings, 'data.settings.sdk_settings.billing_settings.billing_config');
93979
94703
  const billingUrl = dD.getWebSetting(clientSettings, 'data.settings.sdk_settings.billing_settings.url');
93980
94704
  const { submitBilling } = gR({
@@ -94060,7 +94784,7 @@
94060
94784
  billingInput,
94061
94785
  onCloseFromProp
94062
94786
  ]);
94063
- const LivenessDetectionComponent = getLivenessModeComponent(mode, CustomLivenessDetection);
94787
+ const LivenessDetectionComponent = getLivenessModeComponent(mode, CustomLivenessDetection, themeVersion);
94064
94788
  return /*#__PURE__*/ jsxRuntimeExports.jsx(DebugProvider, {
94065
94789
  debug: debug,
94066
94790
  children: /*#__PURE__*/ jsxRuntimeExports.jsx(SDKCallbackProvider, {
@@ -116698,7 +117422,7 @@
116698
117422
  CONFIRM_POPUP_INVALID_QR: 'Không quét được mã QR'
116699
117423
  };
116700
117424
 
116701
- const defaultAssetRoot = "https://vision-cdn.trustingsocial.com/tvweb-sdk.omg/0.0.0-beta.20251211-162126/assets";
117425
+ const defaultAssetRoot = "https://vision-cdn.trustingsocial.com/tvweb-sdk.omg/0.0.0-beta.20251215-165409/assets";
116702
117426
  class TVWebSDK extends gU {
116703
117427
  constructor(props){
116704
117428
  super({