@incodetech/welcome 1.85.0-20251216190848.0 → 1.85.0-20251216195123.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,6 +1,7 @@
1
1
  import { IncodeCanvas } from '../../camera/IncodeCanvas';
2
2
  import { FaceCoordinates } from '../../detection/detectFace';
3
3
  export declare const FACE_ERROR_CODES: {
4
+ readonly FACE_OCCLUDED: "FACE_OCCLUDED";
4
5
  readonly LIVENESS: "LIVENESS_ERROR";
5
6
  readonly BRIGHTNESS: "BRIGHTNESS_ERROR";
6
7
  readonly LENSES: "LENSES_ERROR";
@@ -351,7 +351,11 @@ tokboxApiKey, darkMode, hostingApp, unsafeMode, customHeaders, fingerprintApiKey
351
351
  token: string;
352
352
  interviewId: string;
353
353
  isSandbox?: boolean;
354
- }) => Promise<any>;
354
+ }) => Promise<{
355
+ updateConfig: (config: {
356
+ flow: string;
357
+ }) => void;
358
+ }>;
355
359
  getDeviceRiskModuleConfiguration: (token: string) => Promise<import('./risk/services').DeviceRiskResponse>;
356
360
  collectDeviceRiskResults: (token: string) => Promise<void>;
357
361
  addBankInfo: ({ token, bankData, }: {
@@ -4,5 +4,11 @@ type EnableDeviceRiskModuleParams = {
4
4
  interviewId: string;
5
5
  isSandbox?: boolean;
6
6
  };
7
- export declare const enableDeviceRiskModule: ({ token, isSandbox, interviewId, }: EnableDeviceRiskModuleParams) => Promise<any>;
7
+ type SardineContext = {
8
+ updateConfig: (config: {
9
+ flow: string;
10
+ }) => void;
11
+ };
12
+ export declare const getSardineContext: () => SardineContext | null;
13
+ export declare const enableDeviceRiskModule: ({ token, isSandbox, interviewId, }: EnableDeviceRiskModuleParams) => Promise<SardineContext>;
8
14
  export {};
@@ -1 +1 @@
1
- export { enableDeviceRiskModule } from './enableDeviceRiskModule';
1
+ export { enableDeviceRiskModule, getSardineContext, } from './enableDeviceRiskModule';
@@ -8282,7 +8282,7 @@ class MlWasmJSApi {
8282
8282
  );
8283
8283
  }
8284
8284
  }
8285
- const MlWasmJSApi$1 = MlWasmJSApi.getInstance(), version$4 = "1.85.0-20251216190848.0";
8285
+ const MlWasmJSApi$1 = MlWasmJSApi.getInstance(), version$4 = "1.85.0-20251216195123.0";
8286
8286
  function e$2(Be, Le) {
8287
8287
  return function(Ye, tt) {
8288
8288
  return Object.prototype.hasOwnProperty.call(Ye, tt);
@@ -151303,7 +151303,118 @@ function preloadScript$6(Be) {
151303
151303
  loadingDelegate: /* @__PURE__ */ jsxRuntimeExports.jsx("div", {})
151304
151304
  }, Le;
151305
151305
  }
151306
- const eventModuleNames = {
151306
+ const getCustomFields = ({ token: Be }) => api.get("/omni/get/custom-fields", {
151307
+ headers: {
151308
+ "X-Incode-Hardware-Id": Be
151309
+ }
151310
+ }).then((Le) => Le.data).catch((Le) => Promise.reject(Le.response.data)), getDeviceRiskModuleConfiguration = async (Be) => api.get("/omni/device-risk-client-id", {
151311
+ headers: {
151312
+ "X-Incode-Hardware-Id": Be
151313
+ }
151314
+ }).then((Ye) => Ye.data).catch(() => ({ enabled: !1 })), collectDeviceRiskResults = async (Be) => api.post(
151315
+ "/omni/collect-device-risk-results",
151316
+ null,
151317
+ // no data/body is required
151318
+ {
151319
+ headers: {
151320
+ "X-Incode-Hardware-Id": Be
151321
+ }
151322
+ }
151323
+ ).then((Ye) => Ye.data).catch(() => ({})), shouldDoSardineContextFromSardine = (Be) => Be === void 0 ? !1 : typeof Be.SardineClientID == "string" && typeof Be.SardineSessionKey == "string" && typeof Be.SardineUserID == "string", loadSardineSDK = async (Be) => {
151324
+ const Le = Be ? "api.sandbox.sardine.ai" : "api.sardine.ai", Ye = document.createElement("script");
151325
+ return Ye.type = "text/javascript", Ye.async = !0, Ye.src = `https://${Le}/assets/loader.min.js`, new Promise((tt) => {
151326
+ Ye.onload = () => tt();
151327
+ const nt = document.getElementsByTagName("script")[0];
151328
+ nt.parentNode.insertBefore(Ye, nt);
151329
+ });
151330
+ };
151331
+ let sardineContext = null;
151332
+ const getSardineContext = () => sardineContext, createSardineContextFromSardine = ({
151333
+ sardineClientId: Be,
151334
+ sardineSessionKey: Le,
151335
+ sardineUserId: Ye,
151336
+ isSandbox: tt,
151337
+ token: nt,
151338
+ interviewId: ft
151339
+ }) => window._Sardine.createContext({
151340
+ clientId: Be,
151341
+ sessionKey: ft,
151342
+ flow: `Landing page ${location.pathname}`,
151343
+ environment: tt ? "sandbox" : "production",
151344
+ parentElement: document.body,
151345
+ parentSessionKey: Le,
151346
+ userIdHash: Ye,
151347
+ // called when sardine generates/restores deviceID for given device.
151348
+ onDeviceResponse(ht) {
151349
+ addEvent({
151350
+ code: "externalRiskSDKInitialized",
151351
+ payload: {
151352
+ sardineData: {
151353
+ deviceId: ht.deviceId,
151354
+ uuid: ht.uuid
151355
+ },
151356
+ interviewId: ft,
151357
+ sardineClientId: Be,
151358
+ sardineSessionKey: Le,
151359
+ sardineUserId: Ye
151360
+ },
151361
+ token: nt
151362
+ });
151363
+ }
151364
+ }), createSardineContextIncode = ({
151365
+ sardineClientId: Be,
151366
+ isSandbox: Le,
151367
+ token: Ye,
151368
+ interviewId: tt
151369
+ }) => window._Sardine.createContext({
151370
+ clientId: Be,
151371
+ sessionKey: tt,
151372
+ flow: `Landing page ${location.pathname}`,
151373
+ environment: "production",
151374
+ parentElement: document.body,
151375
+ userIdHash: tt,
151376
+ onDeviceResponse(nt) {
151377
+ addEvent({
151378
+ code: "externalRiskSDKInitialized",
151379
+ payload: {
151380
+ sardineData: {
151381
+ deviceId: nt.deviceId,
151382
+ uuid: nt.uuid
151383
+ },
151384
+ interviewId: tt,
151385
+ sardineClientId: Be
151386
+ },
151387
+ token: Ye
151388
+ });
151389
+ }
151390
+ }), enableDeviceRiskModule = async ({
151391
+ token: Be,
151392
+ isSandbox: Le = !0,
151393
+ interviewId: Ye
151394
+ }) => {
151395
+ const { customFields: tt } = await getCustomFields({ token: Be }).catch(() => ({
151396
+ customFields: {
151397
+ SardineClientID: void 0,
151398
+ SardineSessionKey: void 0,
151399
+ SardineUserID: void 0
151400
+ }
151401
+ }));
151402
+ shouldDoSardineContextFromSardine(tt) && (await loadSardineSDK(Le), sardineContext = createSardineContextFromSardine({
151403
+ sardineClientId: tt.SardineClientID,
151404
+ sardineSessionKey: tt.SardineSessionKey,
151405
+ sardineUserId: tt.SardineUserID,
151406
+ isSandbox: Le,
151407
+ token: Be,
151408
+ interviewId: Ye
151409
+ }));
151410
+ const nt = await getDeviceRiskModuleConfiguration(Be);
151411
+ return nt.enabled && nt.riskClientId && (await loadSardineSDK(!1), sardineContext = createSardineContextIncode({
151412
+ sardineClientId: nt.riskClientId,
151413
+ isSandbox: !1,
151414
+ token: Be,
151415
+ interviewId: Ye
151416
+ })), sardineContext;
151417
+ }, eventModuleNames = {
151307
151418
  selfie: "SELFIE",
151308
151419
  authFace: "AUTH_FACE",
151309
151420
  mlConsent: "ML_CONSENT",
@@ -151516,36 +151627,39 @@ function useModuleEvents({
151516
151627
  token: Ye,
151517
151628
  screen: tt
151518
151629
  }) {
151519
- useLayoutEffect(() => ((async () => {
151520
- const ft = await getModuleFeatureFlags(Be);
151521
- screenEvent({
151522
- module: Be,
151523
- screen: tt,
151524
- payload: {
151525
- ...Le,
151526
- ...ft
151527
- },
151528
- code: "moduleOpened",
151529
- token: Ye
151530
- });
151531
- })(), () => {
151532
- const ft = async () => {
151630
+ useLayoutEffect(() => {
151631
+ const nt = async () => {
151533
151632
  const ht = await getModuleFeatureFlags(Be);
151534
151633
  screenEvent({
151535
151634
  module: Be,
151635
+ screen: tt,
151536
151636
  payload: {
151537
151637
  ...Le,
151538
151638
  ...ht
151539
151639
  },
151540
- screen: tt,
151541
- code: "moduleClosed",
151640
+ code: "moduleOpened",
151542
151641
  token: Ye
151543
151642
  });
151643
+ }, ft = getSardineContext();
151644
+ return ft && ft.updateConfig({ flow: Be }), nt(), () => {
151645
+ const ht = async () => {
151646
+ const gt = await getModuleFeatureFlags(Be);
151647
+ screenEvent({
151648
+ module: Be,
151649
+ payload: {
151650
+ ...Le,
151651
+ ...gt
151652
+ },
151653
+ screen: tt,
151654
+ code: "moduleClosed",
151655
+ token: Ye
151656
+ });
151657
+ };
151658
+ setTimeout(() => {
151659
+ ht();
151660
+ }, 0);
151544
151661
  };
151545
- setTimeout(() => {
151546
- ft();
151547
- }, 0);
151548
- }), []);
151662
+ }, []);
151549
151663
  }
151550
151664
  const addScreenEvent = ({
151551
151665
  module: Be,
@@ -172405,6 +172519,7 @@ const faceFlowManager = new FaceFlowManager(), useFaceFlowState = () => {
172405
172519
  }
172406
172520
  );
172407
172521
  }, FACE_ERROR_CODES = {
172522
+ FACE_OCCLUDED: "FACE_OCCLUDED",
172408
172523
  LIVENESS: "LIVENESS_ERROR",
172409
172524
  BRIGHTNESS: "BRIGHTNESS_ERROR",
172410
172525
  LENSES: "LENSES_ERROR",
@@ -172498,8 +172613,10 @@ const faceFlowManager = new FaceFlowManager(), useFaceFlowState = () => {
172498
172613
  // More than one face detected
172499
172614
  4019: FACE_ERROR_CODES.FACE_NOT_FOUND,
172500
172615
  // Face not found
172501
- 4077: FACE_ERROR_CODES.BAD_PHOTO_QUALITY
172616
+ 4077: FACE_ERROR_CODES.BAD_PHOTO_QUALITY,
172502
172617
  // Bad photo quality
172618
+ 4078: FACE_ERROR_CODES.FACE_OCCLUDED
172619
+ // Face occluded
172503
172620
  }, Ct = Et ? yt[Et] : null;
172504
172621
  throw Ct && handleError$1(Ye, Ct), new Error(FACE_ERROR_CODES.SERVER);
172505
172622
  }
@@ -172808,6 +172925,10 @@ const FaceFlowPage = (Be) => {
172808
172925
  title: "Something went wrong",
172809
172926
  description: "Please try again later"
172810
172927
  }, errorContent = {
172928
+ FACE_OCCLUDED: {
172929
+ title: "notifications.faceOccluded",
172930
+ description: "notifications.faceOccludedDescription"
172931
+ },
172811
172932
  MASK_ERROR: {
172812
172933
  title: "notifications.mask",
172813
172934
  description: "notifications.maskDescription"
@@ -365769,11 +365890,6 @@ function renderForms(Be, { onSuccess: Le, onError: Ye, token: tt, interviewId: n
365769
365890
  function getConnectionDetails(Be) {
365770
365891
  return api.get(`/omni/queue/conference/connection-details?uuid=${Be}`).then((Le) => Le.data).catch((Le) => ({ error: `Error: ${Le}` }));
365771
365892
  }
365772
- const getCustomFields = ({ token: Be }) => api.get("/omni/get/custom-fields", {
365773
- headers: {
365774
- "X-Incode-Hardware-Id": Be
365775
- }
365776
- }).then((Le) => Le.data).catch((Le) => Promise.reject(Le.response.data));
365777
365893
  async function getInstantVerifyMissingModules({
365778
365894
  token: Be
365779
365895
  }) {
@@ -374575,113 +374691,6 @@ function renderRetrySteps(Be, {
374575
374691
  At
374576
374692
  );
374577
374693
  }
374578
- const getDeviceRiskModuleConfiguration = async (Be) => api.get("/omni/device-risk-client-id", {
374579
- headers: {
374580
- "X-Incode-Hardware-Id": Be
374581
- }
374582
- }).then((Ye) => Ye.data).catch(() => ({ enabled: !1 })), collectDeviceRiskResults = async (Be) => api.post(
374583
- "/omni/collect-device-risk-results",
374584
- null,
374585
- // no data/body is required
374586
- {
374587
- headers: {
374588
- "X-Incode-Hardware-Id": Be
374589
- }
374590
- }
374591
- ).then((Ye) => Ye.data).catch(() => ({})), shouldDoSardineContextFromSardine = (Be) => Be === void 0 ? !1 : typeof Be.SardineClientID == "string" && typeof Be.SardineSessionKey == "string" && typeof Be.SardineUserID == "string", loadSardineSDK = async (Be) => {
374592
- const Le = Be ? "api.sandbox.sardine.ai" : "api.sardine.ai", Ye = document.createElement("script");
374593
- return Ye.type = "text/javascript", Ye.async = !0, Ye.src = `https://${Le}/assets/loader.min.js`, new Promise((tt) => {
374594
- Ye.onload = () => tt();
374595
- const nt = document.getElementsByTagName("script")[0];
374596
- nt.parentNode.insertBefore(Ye, nt);
374597
- });
374598
- }, createSardineContextFromSardine = ({
374599
- sardineClientId: Be,
374600
- sardineSessionKey: Le,
374601
- sardineUserId: Ye,
374602
- isSandbox: tt,
374603
- token: nt,
374604
- interviewId: ft
374605
- }) => window._Sardine.createContext({
374606
- clientId: Be,
374607
- sessionKey: ft,
374608
- flow: `Landing page ${location.pathname}`,
374609
- environment: tt ? "sandbox" : "production",
374610
- parentElement: document.body,
374611
- parentSessionKey: Le,
374612
- userIdHash: Ye,
374613
- // called when sardine generates/restores deviceID for given device.
374614
- onDeviceResponse(ht) {
374615
- addEvent({
374616
- code: "externalRiskSDKInitialized",
374617
- payload: {
374618
- sardineData: {
374619
- deviceId: ht.deviceId,
374620
- uuid: ht.uuid
374621
- },
374622
- interviewId: ft,
374623
- sardineClientId: Be,
374624
- sardineSessionKey: Le,
374625
- sardineUserId: Ye
374626
- },
374627
- token: nt
374628
- });
374629
- }
374630
- }), createSardineContextIncode = ({
374631
- sardineClientId: Be,
374632
- isSandbox: Le,
374633
- token: Ye,
374634
- interviewId: tt
374635
- }) => window._Sardine.createContext({
374636
- clientId: Be,
374637
- sessionKey: tt,
374638
- flow: `Landing page ${location.pathname}`,
374639
- environment: "production",
374640
- parentElement: document.body,
374641
- userIdHash: tt,
374642
- onDeviceResponse(nt) {
374643
- addEvent({
374644
- code: "externalRiskSDKInitialized",
374645
- payload: {
374646
- sardineData: {
374647
- deviceId: nt.deviceId,
374648
- uuid: nt.uuid
374649
- },
374650
- interviewId: tt,
374651
- sardineClientId: Be
374652
- },
374653
- token: Ye
374654
- });
374655
- }
374656
- }), enableDeviceRiskModule = async ({
374657
- token: Be,
374658
- isSandbox: Le = !0,
374659
- interviewId: Ye
374660
- }) => {
374661
- const { customFields: tt } = await getCustomFields({ token: Be }).catch(() => ({
374662
- customFields: {
374663
- SardineClientID: void 0,
374664
- SardineSessionKey: void 0,
374665
- SardineUserID: void 0
374666
- }
374667
- }));
374668
- if (shouldDoSardineContextFromSardine(tt))
374669
- return await loadSardineSDK(Le), createSardineContextFromSardine({
374670
- sardineClientId: tt.SardineClientID,
374671
- sardineSessionKey: tt.SardineSessionKey,
374672
- sardineUserId: tt.SardineUserID,
374673
- isSandbox: Le,
374674
- token: Be,
374675
- interviewId: Ye
374676
- });
374677
- const nt = await getDeviceRiskModuleConfiguration(Be);
374678
- return nt.enabled && nt.riskClientId ? (await loadSardineSDK(!1), createSardineContextIncode({
374679
- sardineClientId: nt.riskClientId,
374680
- isSandbox: !1,
374681
- token: Be,
374682
- interviewId: Ye
374683
- })) : null;
374684
- };
374685
374694
  function sendEmail({ status: Be, token: Le }) {
374686
374695
  return api.post(
374687
374696
  "/omni/fanid/send-email",