@incodetech/welcome 1.85.0-20251121102600.0 → 1.85.0-20251121112935.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-20251121112935.0";
8378
8378
  function e$2(Be, Le) {
8379
8379
  return function(Ye, tt) {
8380
8380
  return Object.prototype.hasOwnProperty.call(Ye, tt);
@@ -363506,14 +363506,13 @@ function getErrorKey(Be) {
363506
363506
  return notificationMessages[Be] || "notifications.error";
363507
363507
  }
363508
363508
  async function faceCapture({
363509
- encryptedImage: Be,
363509
+ canvas: Be,
363510
363510
  session: Le,
363511
363511
  t: Ye,
363512
363512
  videoSelfieAsSelfie: tt,
363513
- faceCoordinates: nt,
363514
- performLiveness: ft
363513
+ faceCoordinates: nt
363515
363514
  }) {
363516
- var ht;
363515
+ var ft;
363517
363516
  addScreenEvent({
363518
363517
  module: eventModuleNames.videoSelfie,
363519
363518
  screen: eventScreenNames.videoSelfieFaceCapture,
@@ -363526,39 +363525,21 @@ async function faceCapture({
363526
363525
  shouldOpen: !0
363527
363526
  });
363528
363527
  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,
363528
+ if (await sendFaceImage({
363529
+ canvas: Be,
363539
363530
  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({
363531
+ sessionToken: Le.token,
363532
+ imageType: tt ? "selfie" : "videoSelfie"
363533
+ }), !(((await processFace({
363553
363534
  token: Le.token,
363554
363535
  imageType: tt ? "selfie" : "videoSelfie"
363555
363536
  })).confidence ?? 1) > 0.3)) {
363556
- const yt = new Error("No match!");
363557
- throw yt.cause = {
363537
+ const Et = new Error("No match!");
363538
+ throw Et.cause = {
363558
363539
  data: {
363559
363540
  errorMessage: "no-match"
363560
363541
  }
363561
- }, yt;
363542
+ }, Et;
363562
363543
  }
363563
363544
  addScreenEvent({
363564
363545
  module: eventModuleNames.videoSelfie,
@@ -363571,8 +363552,8 @@ async function faceCapture({
363571
363552
  token: Le.token,
363572
363553
  shouldOpen: !0
363573
363554
  });
363574
- } catch (gt) {
363575
- addScreenEvent({
363555
+ } catch (ht) {
363556
+ if (addScreenEvent({
363576
363557
  module: eventModuleNames.videoSelfie,
363577
363558
  screen: eventScreenNames.videoSelfieFaceUploadProgress,
363578
363559
  token: Le.token,
@@ -363582,9 +363563,12 @@ async function faceCapture({
363582
363563
  screen: eventScreenNames.videoSelfieFaceAttemptFailed,
363583
363564
  token: Le.token,
363584
363565
  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));
363566
+ }), ht.message) {
363567
+ const Et = Ye(errorContent[ht.message].title);
363568
+ throw new Error(Et ?? Ye("notifications.serverError"));
363569
+ }
363570
+ 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);
363571
+ throw new Error(Ye(xt));
363588
363572
  }
363589
363573
  }
363590
363574
  const useDetectSelfie = ({
@@ -363599,10 +363583,7 @@ const useDetectSelfie = ({
363599
363583
  async function yt(bt, It) {
363600
363584
  xt.current = !1, (Be == null ? void 0 : Be.streamUnlocked) != null && (Be.streamUnlocked.current = !1);
363601
363585
  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();
363586
+ 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
363587
  } catch (wt) {
363607
363588
  if (MlWasmJSApi$1.reset(), gt("error"), ft(wt.message), await sleep(3e3), gt("idle"), ft(""), At.current === Le) {
363608
363589
  await tt.onNoAttemptsLeft();
@@ -363706,9 +363687,9 @@ const useDetectSelfie = ({
363706
363687
  const { t: ft } = useTranslation$1(), { status: ht, notification: gt } = useDetectSelfie(
363707
363688
  { webcam: Le, numberOfTries: tt.numberOfTries, session: Ye },
363708
363689
  {
363709
- onCapturing: async ({ encryptedImage: Ct, faceCoordinates: yt }) => {
363690
+ onCapturing: async (Ct, yt) => {
363710
363691
  await faceCapture({
363711
- encryptedImage: Ct,
363692
+ canvas: Ct,
363712
363693
  session: Ye,
363713
363694
  t: ft,
363714
363695
  videoSelfieAsSelfie: tt.videoSelfieAsSelfie,