From f9454b197c92bee4c67b111b5166e790c3c1d2cc Mon Sep 17 00:00:00 2001 From: incodecota Date: Mon, 3 Jun 2024 15:26:33 -0600 Subject: [PATCH 1/2] update to module import --- app/incode/incode.tsx | 30 ++++++++++++++++++++++-------- app/page.tsx | 7 ------- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/app/incode/incode.tsx b/app/incode/incode.tsx index 0502d86..ccea085 100644 --- a/app/incode/incode.tsx +++ b/app/incode/incode.tsx @@ -1,5 +1,6 @@ 'use client'; -import { useEffect, useRef } from "react" +import { useEffect, useRef } from "react"; +import { create } from "@incodetech/welcome"; function Incode({ session, baseUrl }:UserConsentPropTypes) { @@ -10,12 +11,10 @@ function Incode({ session, baseUrl }:UserConsentPropTypes) { let incode: any; useEffect(() => { - if (window && window.OnBoarding) { - // Initialize the SDK - incode = window.OnBoarding.create({ + incode = create({ apiURL: baseUrl - }); - } + }); + console.log(incode) if (incode && isMounted.current) { return; @@ -41,6 +40,21 @@ function Incode({ session, baseUrl }:UserConsentPropTypes) { }) } + function captureDocument() { + incode.renderCamera("document", containerRef.current, { + onSuccess: (evt: any) => { + console.log(evt); + finishOnboarding(); + }, + onError: console.log, + token: session, + showTutorial: true, + onLog: console.log, + numberOfTries: 3, + nativeCamera:true + }); + } + function processId() { return incode.processId({ token: session.token }) .then(() => { @@ -55,14 +69,13 @@ function Incode({ session, baseUrl }:UserConsentPropTypes) { incode.renderCamera("selfie", containerRef.current, { token: session, numberOfTries: 3, - onSuccess: finishOnboarding, + onSuccess: captureDocument, onError: console.log, showTutorial: true, }); } function finishOnboarding() { - console.log("faceMatch") incode .getFinishStatus(null, { token: session.token }) .then((response: any) => { @@ -74,6 +87,7 @@ function Incode({ session, baseUrl }:UserConsentPropTypes) { } function saveDeviceData() { + console.log('incode:', incode) incode.sendGeolocation({ token: session.token }); incode.sendFingerprint({ token: session.token }); captureIdFrontSide(); diff --git a/app/page.tsx b/app/page.tsx index 040bac5..6cbf296 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -15,13 +15,6 @@ export default async function Home() { return ( <> - { - /* Load the sdk library using "beforeInteractive" strategy */ -