Skip to content

Commit db4b654

Browse files
committed
* added user consent
*removed facematch
1 parent 8906abb commit db4b654

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

vite-web-sdk/main.js

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const container = document.getElementById("camera-container");
99
async function startOnboardingSession() {
1010
const urlParams = new URLSearchParams(window.location.search);
1111
const uuid = urlParams.get('uuid');
12-
12+
1313
let sessionStartUrl = `${tokenServerURL}/start`
1414
if (uuid) sessionStartUrl +=`?uuid=${uuid}`;
1515

@@ -18,7 +18,7 @@ async function startOnboardingSession() {
1818
const sessionData = await response.json();
1919
throw new Error(sessionData.error);
2020
}
21-
21+
2222
return await response.json();
2323
}
2424

@@ -37,10 +37,17 @@ function renderRedirectToMobile(){
3737
url: `${localServerUrl}?uuid=${session.uuid}`
3838
});
3939
} else {
40-
renderFrontIDCamera();
40+
renderUserConsent();
4141
}
4242
}
4343

44+
function renderUserConsent(){
45+
incode.renderUserConsent(container, {
46+
session: session,
47+
onSuccess: renderFrontIDCamera,
48+
});
49+
}
50+
4451
function renderFrontIDCamera() {
4552
incode.renderCamera("front", container, {
4653
onSuccess: renderBackIDCamera,
@@ -71,29 +78,20 @@ async function processID() {
7178

7279
function renderSelfieCamera() {
7380
incode.renderCamera("selfie", container, {
74-
onSuccess: faceMatch,
81+
onSuccess: finish,
7582
onError: showError,
7683
token: session,
7784
numberOfTries: -1,
7885
noWait: true
7986
});
8087
}
81-
function faceMatch() {
82-
incode.renderFaceMatch(container, {
83-
onSuccess: finish,
84-
onError: showError,
85-
token: session,
86-
liveness: true,
87-
existingUser: false,
88-
});
89-
}
88+
9089

9190
function finish() {
9291
// Finishing the session works along with the configuration in the flow
9392
// webhooks and business rules are ran here.
9493
const response = incode.getFinishStatus(import.meta.env.VITE_FLOW_ID, session);
95-
console.log(response);
96-
94+
9795
const container = document.getElementById("finish-container");
9896
container.innerHTML = "<h1>Finished</h1>";
9997
}

0 commit comments

Comments
 (0)