2024-10-31 14:44:45 +01:00
|
|
|
import Container from '../../ReusableComponents/Container';
|
2024-11-20 16:56:44 +01:00
|
|
|
import { OnboardingHooks } from '../../../data';
|
2024-10-31 15:11:36 +01:00
|
|
|
|
2025-01-10 13:30:06 +01:00
|
|
|
import { getSteps, getCurrentStep } from './Steps';
|
2025-01-10 15:16:05 +01:00
|
|
|
import OnboardingNavigation from './Components/Navigation';
|
2024-10-31 15:11:36 +01:00
|
|
|
|
2025-01-10 13:38:47 +01:00
|
|
|
const OnboardingScreen = () => {
|
2024-12-03 16:06:41 +01:00
|
|
|
const { step, setStep, flags } = OnboardingHooks.useSteps();
|
2025-02-05 12:41:54 +01:00
|
|
|
|
2025-02-07 19:01:40 +01:00
|
|
|
const Steps = getSteps( flags );
|
2024-12-02 17:46:07 +01:00
|
|
|
const currentStep = getCurrentStep( step, Steps );
|
|
|
|
|
2025-04-04 13:59:53 +02:00
|
|
|
if ( ! currentStep?.StepComponent ) {
|
|
|
|
console.error( 'Invalid Onboarding State', {
|
|
|
|
step,
|
|
|
|
flags,
|
|
|
|
Steps,
|
|
|
|
currentStep,
|
|
|
|
} );
|
|
|
|
}
|
|
|
|
|
2025-06-06 13:33:32 +02:00
|
|
|
const handleNext = () => setStep( currentStep.nextStep, 'user' );
|
|
|
|
const handlePrev = () => setStep( currentStep.prevStep, 'user' );
|
2024-10-24 06:35:48 +02:00
|
|
|
|
2024-10-23 15:24:52 +02:00
|
|
|
return (
|
2024-11-12 15:01:29 +01:00
|
|
|
<>
|
2025-01-10 15:16:05 +01:00
|
|
|
<OnboardingNavigation
|
2024-12-02 17:46:07 +01:00
|
|
|
stepDetails={ currentStep }
|
|
|
|
onNext={ handleNext }
|
|
|
|
onPrev={ handlePrev }
|
2024-11-12 15:01:29 +01:00
|
|
|
/>
|
2024-12-02 17:46:07 +01:00
|
|
|
|
2024-11-12 15:01:29 +01:00
|
|
|
<Container page="onboarding">
|
|
|
|
<div className="ppcp-r-card">
|
2024-12-02 17:46:07 +01:00
|
|
|
<currentStep.StepComponent
|
2024-11-12 15:01:29 +01:00
|
|
|
setStep={ setStep }
|
|
|
|
currentStep={ step }
|
2024-12-02 15:51:26 +01:00
|
|
|
stepperOrder={ Steps }
|
2024-11-12 15:01:29 +01:00
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</Container>
|
|
|
|
</>
|
2024-10-23 15:24:52 +02:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2025-01-10 13:38:47 +01:00
|
|
|
export default OnboardingScreen;
|