import { useEffect, useState } from 'react'; import IDCapture from './IDCapture'; import processNode from './processNode'; import { WorkflowNode } from './types'; import ProcessId from './ProcessID'; import Selfie from './Selfie'; import DefaultComponent from '@incodetech/welcome/DefaultComponent'; import FaceMatch from './FaceMatch'; import Finish from './Finish'; type WorkflowProps = { token: string; workflowId: string; initialNode: WorkflowNode; }; const getModule = ( currentNode: WorkflowNode, token: string, onNext: () => void, ) => { if (currentNode.nodeType === 'FINISH') { return ( ); } switch (currentNode.moduleKey) { case 'ID_CAPTURE': { return ( ); } case 'ID_OCR': { return

Id OCR

; } case 'ID': { return ; } case 'SELFIE': { return ( ); } case 'FACE_MATCH': { return ( ); } default: { return

Default {currentNode.moduleKey}

; } } }; const Workflow = (props: WorkflowProps) => { const [currentNode, setCurrentNode] = useState( props.initialNode, ); useEffect(() => { document.body.style.overflow = 'hidden'; document.body.scrollTop = 0; document.documentElement.scrollTop = 0; return () => { document.body.style.overflow = 'auto'; }; }, []); async function changeNode() { const nextNode = await processNode({ token: props.token }); console.log(nextNode); setCurrentNode(nextNode); } return (
{getModule(currentNode, props.token, changeNode)}
); }; export default Workflow;