@incodetech/welcome 1.85.0-20251121102600.0 → 1.85.0-20251121161338.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,9 @@
1
1
  import { LooseSession } from '../../../types/src';
2
+ import { IncodeCanvas } from '../camera/IncodeCanvas';
2
3
  import { FaceCoordinates } from '../detection/detectFace';
3
4
 
4
- export declare function faceCapture({ encryptedImage, session, t, videoSelfieAsSelfie, faceCoordinates, performLiveness, }: {
5
- encryptedImage: string;
5
+ export declare function faceCapture({ canvas, session, t, videoSelfieAsSelfie, faceCoordinates, }: {
6
+ canvas: IncodeCanvas;
6
7
  session: LooseSession;
7
8
  videoSelfieAsSelfie: boolean;
8
9
  t: (key: string) => string;
@@ -1,4 +1,5 @@
1
1
  import { LooseSession } from '../../../types/src';
2
+ import { IncodeCanvas } from '../camera/IncodeCanvas';
2
3
  import { WebcamRef } from '../camera/Webcam.types';
3
4
  import { FaceCoordinates } from '../detection/detectFace';
4
5
 
@@ -7,10 +8,7 @@ export declare const useDetectSelfie: ({ webcam, numberOfTries, session, }: {
7
8
  numberOfTries: number;
8
9
  session: LooseSession;
9
10
  }, callbacks: {
10
- onCapturing: ({ encryptedImage, faceCoordinates, }: {
11
- encryptedImage: string;
12
- faceCoordinates: FaceCoordinates;
13
- }) => void | Promise<void>;
11
+ onCapturing: (canvas: IncodeCanvas, faceCoordinates: FaceCoordinates) => void | Promise<void>;
14
12
  onSuccessfulCapture: () => void | Promise<void>;
15
13
  onNoAttemptsLeft: () => void | Promise<void>;
16
14
  }) => {
@@ -8374,7 +8374,7 @@ class MlWasmJSApi {
8374
8374
  );
8375
8375
  }
8376
8376
  }
8377
- const MlWasmJSApi$1 = MlWasmJSApi.getInstance(), version$4 = "1.85.0-20251121102600.0";
8377
+ const MlWasmJSApi$1 = MlWasmJSApi.getInstance(), version$4 = "1.85.0-20251121161338.0";
8378
8378
  function e$2(Be, Le) {
8379
8379
  return function(Ye, tt) {
8380
8380
  return Object.prototype.hasOwnProperty.call(Ye, tt);
@@ -353369,22 +353369,21 @@ function NativeCamera({
353369
353369
  shouldOpen: !0
353370
353370
  });
353371
353371
  let n0;
353372
- const g0 = multiPageDocumentTypes.includes(ft) ? ft : "otherDocument1";
353373
353372
  return gt ? n0 = {
353374
353373
  token: Et,
353375
353374
  image: p0.imageBase64.split(",")[1],
353376
- docType: g0,
353375
+ docType: ft,
353377
353376
  format: p0 == null ? void 0 : p0.fullImage.type,
353378
353377
  onProgress: bt
353379
353378
  } : n0 = {
353380
353379
  token: Et,
353381
353380
  file: p0.fullImage,
353382
- docType: g0,
353381
+ docType: ft,
353383
353382
  onProgress: bt,
353384
353383
  format: p0.fullImage.type
353385
- }, addAddressStatement(n0).then(async (E0) => {
353386
- const { success: a0, status: r0 } = E0;
353387
- if (a0 || ["ADD_NEXT_PAGE", "SUCCESS"].includes(r0))
353384
+ }, addAddressStatement(n0).then(async (g0) => {
353385
+ const { success: E0, status: a0 } = g0;
353386
+ if (E0 || ["ADD_NEXT_PAGE", "SUCCESS"].includes(a0))
353388
353387
  addScreenEvent({
353389
353388
  module: eventModuleNames.document,
353390
353389
  screen: eventScreenNames.documentUploadProgress,
@@ -353404,7 +353403,7 @@ function NativeCamera({
353404
353403
  screen: eventScreenNames.documentUploadSuccess,
353405
353404
  token: Et,
353406
353405
  shouldOpen: !1
353407
- }), r0 === "ADD_NEXT_PAGE" ? (Gt(), Vt(V5C_STEPS$1.secondPage)) : _t(p0);
353406
+ }), a0 === "ADD_NEXT_PAGE" ? (Gt(), Vt(V5C_STEPS$1.secondPage)) : _t(p0);
353408
353407
  else {
353409
353408
  addScreenEvent({
353410
353409
  module: eventModuleNames.document,
@@ -353417,14 +353416,14 @@ function NativeCamera({
353417
353416
  token: Et,
353418
353417
  shouldOpen: !0
353419
353418
  });
353420
- const Yt = kt("notifications.badProofOfAddress");
353419
+ const r0 = kt("notifications.badProofOfAddress");
353421
353420
  Kt.current += 1, Le(
353422
353421
  getLogObject("attemptFailed", {
353423
- response: { success: a0 },
353424
- message: Yt,
353422
+ response: { success: E0 },
353423
+ message: r0,
353425
353424
  attempt: Kt.current
353426
353425
  })
353427
- ), Dt(!1), Rt(!0), wt(Yt), await sleep(1500), addScreenEvent({
353426
+ ), Dt(!1), Rt(!0), wt(r0), await sleep(1500), addScreenEvent({
353428
353427
  module: eventModuleNames.document,
353429
353428
  screen: eventScreenNames.documentAttemptFailed,
353430
353429
  token: Et,
@@ -353436,7 +353435,7 @@ function NativeCamera({
353436
353435
  shouldOpen: !0
353437
353436
  });
353438
353437
  }
353439
- }).catch(async (E0) => {
353438
+ }).catch(async (g0) => {
353440
353439
  addScreenEvent({
353441
353440
  module: eventModuleNames.document,
353442
353441
  screen: eventScreenNames.documentUploadProgress,
@@ -353448,14 +353447,14 @@ function NativeCamera({
353448
353447
  token: Et,
353449
353448
  shouldOpen: !0
353450
353449
  });
353451
- const a0 = kt("notifications.badProofOfAddress");
353450
+ const E0 = kt("notifications.badProofOfAddress");
353452
353451
  Kt.current += 1, Le(
353453
353452
  getLogObject("attemptFailed", {
353454
- response: { error: E0 },
353455
- message: E0.message,
353453
+ response: { error: g0 },
353454
+ message: g0.message,
353456
353455
  attempt: Kt.current
353457
353456
  })
353458
- ), Dt(!1), Rt(!0), wt(a0), await sleep(1500), addScreenEvent({
353457
+ ), Dt(!1), Rt(!0), wt(E0), await sleep(1500), addScreenEvent({
353459
353458
  module: eventModuleNames.document,
353460
353459
  screen: eventScreenNames.documentAttemptFailed,
353461
353460
  token: Et,
@@ -363506,14 +363505,13 @@ function getErrorKey(Be) {
363506
363505
  return notificationMessages[Be] || "notifications.error";
363507
363506
  }
363508
363507
  async function faceCapture({
363509
- encryptedImage: Be,
363508
+ canvas: Be,
363510
363509
  session: Le,
363511
363510
  t: Ye,
363512
363511
  videoSelfieAsSelfie: tt,
363513
- faceCoordinates: nt,
363514
- performLiveness: ft
363512
+ faceCoordinates: nt
363515
363513
  }) {
363516
- var ht;
363514
+ var ft;
363517
363515
  addScreenEvent({
363518
363516
  module: eventModuleNames.videoSelfie,
363519
363517
  screen: eventScreenNames.videoSelfieFaceCapture,
@@ -363526,39 +363524,21 @@ async function faceCapture({
363526
363524
  shouldOpen: !0
363527
363525
  });
363528
363526
  try {
363529
- const gt = await capture({
363530
- token: Le.token,
363531
- image: Be,
363532
- type: "selfie",
363533
- encrypted: !0,
363534
- imageType: tt ? "selfie" : "videoSelfie",
363535
- sendBase64: !0,
363536
- isRetry: !1,
363537
- isSecondId: !1,
363538
- onlyFront: !1,
363527
+ if (await sendFaceImage({
363528
+ canvas: Be,
363539
363529
  faceCoordinates: nt,
363540
- onProgress: () => {
363541
- },
363542
- metadata: MlWasmJSApi$1.getMetadata()
363543
- });
363544
- if (!(ft ? gt.confidence < 0.6 : !0)) {
363545
- const yt = new Error("Liveness failed");
363546
- throw yt.cause = {
363547
- data: {
363548
- errorMessage: "liveness-failed"
363549
- }
363550
- }, yt;
363551
- }
363552
- if (!(((await processFace({
363530
+ sessionToken: Le.token,
363531
+ imageType: tt ? "selfie" : "videoSelfie"
363532
+ }), !(((await processFace({
363553
363533
  token: Le.token,
363554
363534
  imageType: tt ? "selfie" : "videoSelfie"
363555
363535
  })).confidence ?? 1) > 0.3)) {
363556
- const yt = new Error("No match!");
363557
- throw yt.cause = {
363536
+ const Et = new Error("No match!");
363537
+ throw Et.cause = {
363558
363538
  data: {
363559
363539
  errorMessage: "no-match"
363560
363540
  }
363561
- }, yt;
363541
+ }, Et;
363562
363542
  }
363563
363543
  addScreenEvent({
363564
363544
  module: eventModuleNames.videoSelfie,
@@ -363571,8 +363551,8 @@ async function faceCapture({
363571
363551
  token: Le.token,
363572
363552
  shouldOpen: !0
363573
363553
  });
363574
- } catch (gt) {
363575
- addScreenEvent({
363554
+ } catch (ht) {
363555
+ if (addScreenEvent({
363576
363556
  module: eventModuleNames.videoSelfie,
363577
363557
  screen: eventScreenNames.videoSelfieFaceUploadProgress,
363578
363558
  token: Le.token,
@@ -363582,9 +363562,12 @@ async function faceCapture({
363582
363562
  screen: eventScreenNames.videoSelfieFaceAttemptFailed,
363583
363563
  token: Le.token,
363584
363564
  shouldOpen: !0
363585
- });
363586
- const At = ((ht = gt.response) == null ? void 0 : ht.data) ?? Ye("notifications.serverError"), xt = (At == null ? void 0 : At.errorMessage) ?? (At == null ? void 0 : At.message) ?? (At == null ? void 0 : At.reason), Et = getErrorKey(xt);
363587
- throw new Error(Ye(Et));
363565
+ }), ht.message) {
363566
+ const Et = Ye(errorContent[ht.message].title);
363567
+ throw new Error(Et ?? Ye("notifications.serverError"));
363568
+ }
363569
+ const gt = ((ft = ht.response) == null ? void 0 : ft.data) ?? Ye("notifications.serverError"), At = (gt == null ? void 0 : gt.errorMessage) ?? (gt == null ? void 0 : gt.message) ?? (gt == null ? void 0 : gt.reason), xt = getErrorKey(At);
363570
+ throw new Error(Ye(xt));
363588
363571
  }
363589
363572
  }
363590
363573
  const useDetectSelfie = ({
@@ -363599,10 +363582,7 @@ const useDetectSelfie = ({
363599
363582
  async function yt(bt, It) {
363600
363583
  xt.current = !1, (Be == null ? void 0 : Be.streamUnlocked) != null && (Be.streamUnlocked.current = !1);
363601
363584
  try {
363602
- const wt = bt.getBase64Image();
363603
- gt("loading"), ft(Ct("videoSelfie.processingSelfie"));
363604
- const Tt = await MlWasmJSApi$1.encryptImage(wt);
363605
- await tt.onCapturing({ encryptedImage: Tt, faceCoordinates: It }), gt("capturing"), ft(Ct("videoSelfie.allGood")), await sleep(3e3), gt("success"), tt.onSuccessfulCapture();
363585
+ gt("loading"), ft(Ct("videoSelfie.processingSelfie")), await tt.onCapturing(bt, It), gt("capturing"), ft(Ct("videoSelfie.allGood")), await sleep(3e3), gt("success"), tt.onSuccessfulCapture();
363606
363586
  } catch (wt) {
363607
363587
  if (MlWasmJSApi$1.reset(), gt("error"), ft(wt.message), await sleep(3e3), gt("idle"), ft(""), At.current === Le) {
363608
363588
  await tt.onNoAttemptsLeft();
@@ -363706,9 +363686,9 @@ const useDetectSelfie = ({
363706
363686
  const { t: ft } = useTranslation$1(), { status: ht, notification: gt } = useDetectSelfie(
363707
363687
  { webcam: Le, numberOfTries: tt.numberOfTries, session: Ye },
363708
363688
  {
363709
- onCapturing: async ({ encryptedImage: Ct, faceCoordinates: yt }) => {
363689
+ onCapturing: async (Ct, yt) => {
363710
363690
  await faceCapture({
363711
- encryptedImage: Ct,
363691
+ canvas: Ct,
363712
363692
  session: Ye,
363713
363693
  t: ft,
363714
363694
  videoSelfieAsSelfie: tt.videoSelfieAsSelfie,