woocommerce-paypal-payments/modules/ppcp-settings/resources/js/Components/Screens/Onboarding/index.js

47 lines
1.1 KiB
JavaScript
Raw Normal View History

import Container from '../../ReusableComponents/Container';
import { OnboardingHooks } from '../../../data';
2025-01-10 13:30:06 +01:00
import { getSteps, getCurrentStep } from './Steps';
import OnboardingNavigation from './Components/Navigation';
2025-01-10 13:38:47 +01:00
const OnboardingScreen = () => {
const { step, setStep, flags } = OnboardingHooks.useSteps();
const Steps = getSteps( flags );
const currentStep = getCurrentStep( step, Steps );
if ( ! currentStep?.StepComponent ) {
console.error( 'Invalid Onboarding State', {
step,
flags,
Steps,
currentStep,
} );
}
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
<>
<OnboardingNavigation
stepDetails={ currentStep }
onNext={ handleNext }
onPrev={ handlePrev }
2024-11-12 15:01:29 +01:00
/>
2024-11-12 15:01:29 +01:00
<Container page="onboarding">
<div className="ppcp-r-card">
<currentStep.StepComponent
2024-11-12 15:01:29 +01:00
setStep={ setStep }
currentStep={ step }
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;