| 1 |
import { useEffect, useCallback } from '@wordpress/element'; |
| 2 |
import { useHistory } from 'react-router-dom'; |
| 3 |
import { __ } from '@wordpress/i18n'; |
| 4 |
import { useStateValue } from '../utils/StateProvider'; |
| 5 |
// import CartFlowsLogo from '@WizardImages/cartflows-logo.svg'; |
| 6 |
import { ArrowRightIcon } from '@heroicons/react/24/outline'; |
| 7 |
|
| 8 |
function WelcomeStep() { |
| 9 |
const history = useHistory(); |
| 10 |
const [ { action_button }, dispatch ] = useStateValue(); |
| 11 |
|
| 12 |
const redirectNextStep = useCallback( () => { |
| 13 |
history.push( { |
| 14 |
pathname: 'index.php', |
| 15 |
search: `?page=cartflow-setup&step=page-builder`, |
| 16 |
} ); |
| 17 |
}, [] ); |
| 18 |
|
| 19 |
useEffect( () => { |
| 20 |
dispatch( { |
| 21 |
status: 'SET_NEXT_STEP', |
| 22 |
action_button: { |
| 23 |
button_text: __( "Let's Start", 'cartflows' ), |
| 24 |
button_class: 'wcf-start-setup', |
| 25 |
}, |
| 26 |
} ); |
| 27 |
|
| 28 |
const startOnboardingEvent = function () { |
| 29 |
redirectNextStep(); |
| 30 |
}; |
| 31 |
|
| 32 |
document.addEventListener( |
| 33 |
'wcf-redirect-page-builder-step', |
| 34 |
startOnboardingEvent, |
| 35 |
false |
| 36 |
); |
| 37 |
|
| 38 |
return () => { |
| 39 |
document.removeEventListener( |
| 40 |
'wcf-redirect-page-builder-step', |
| 41 |
startOnboardingEvent |
| 42 |
); |
| 43 |
}; |
| 44 |
}, [ redirectNextStep ] ); |
| 45 |
|
| 46 |
return ( |
| 47 |
<div className="wcf-container"> |
| 48 |
<div className="wcf-row mt-16"> |
| 49 |
<div className="bg-white rounded mx-auto px-11"> |
| 50 |
<span className="text-sm font-medium text-primary-600 mb-10 text-center block tracking-[.24em] uppercase"> |
| 51 |
{ __( 'Step 1 of 6', 'cartflows' ) } |
| 52 |
</span> |
| 53 |
<h1 className="wcf-step-heading mb-4"> |
| 54 |
{ __( 'Welcome to CartFlows', 'cartflows' ) } |
| 55 |
</h1> |
| 56 |
|
| 57 |
<p className="text-center overflow-hidden max-w-2xl mb-10 mx-auto text-lg font-normal text-slate-500"> |
| 58 |
{ __( |
| 59 |
"You're only minutes away from having a more profitable WooCommerce store! This short setup wizard will help you get started with CartFlows.", |
| 60 |
'cartflows' |
| 61 |
) } |
| 62 |
</p> |
| 63 |
|
| 64 |
<div className="flex justify-center"> |
| 65 |
<div |
| 66 |
className={ `wcf-wizard--button ${ |
| 67 |
action_button.button_class |
| 68 |
? action_button.button_class |
| 69 |
: '' |
| 70 |
}` } |
| 71 |
> |
| 72 |
{ action_button.button_text } |
| 73 |
<ArrowRightIcon |
| 74 |
className="w-5 mt-0.5 ml-1.5 stroke-2" |
| 75 |
aria-hidden="true" |
| 76 |
/> |
| 77 |
</div> |
| 78 |
</div> |
| 79 |
</div> |
| 80 |
</div> |
| 81 |
</div> |
| 82 |
); |
| 83 |
} |
| 84 |
|
| 85 |
export default WelcomeStep; |
| 86 |
|