diff --git a/src/App.tsx b/src/App.tsx index 8d237e2..9169acf 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -16,8 +16,12 @@ function App() { } /> + } + > }> - } /> + } /> } @@ -26,10 +30,6 @@ function App() { path="/onboarding-success/:cosmosAddress" element={} > - } - > } /> diff --git a/src/pages/UserVerification.tsx b/src/pages/UserVerification.tsx index be77363..b528234 100644 --- a/src/pages/UserVerification.tsx +++ b/src/pages/UserVerification.tsx @@ -1,14 +1,18 @@ -import React from 'react' +import React, { useState } from 'react' +import { useNavigate } from 'react-router-dom'; import { Box, Typography } from '@mui/material' import SumsubWebSdk from '@sumsub/websdk-react' + const UserVerification = () => { + const [userId, setUserId] = useState(''); + + const navigate = useNavigate(); + const config = { lang: "en", //language of WebSDK texts and comments (ISO 639-1 format) - // email: applicantEmail, - // phone: applicantPhone, theme: "light", } @@ -17,15 +21,31 @@ const UserVerification = () => { adaptIframeHeight: true } + // TODO: Implement const accessTokenExpirationHandler = async () => { + alert("Please renew token"); return "Token expired"; } const accessToken = { - "token": process.env.REACT_APP_SUMSUB_TOKEN, + "token": process.env.REACT_APP_SUMSUB_TOKEN!, "userId": "deepstack1234" } + const messageHandler = (event: any, payload: any ) => { + if (event === 'idCheck.onApplicantLoaded'){ + setUserId(payload.applicantId) + } + + if (event === 'idCheck.onApplicantSubmitted'){ + console.log('Application is submitted'); + navigate(`/sign-with-nitro-key/${userId}`); + } + + console.log(event); + console.log("Payload is ", payload); + } + return ( <> { expirationHandler={accessTokenExpirationHandler} config={config} options={options} + onMessage={messageHandler} /> )