@@ -7,19 +7,26 @@ import classnames from 'classnames';
77 * WordPress dependencies.
88 */
99import { useSelect } from '@wordpress/data' ;
10- import { useEffect , useState } from '@wordpress/element' ;
10+ import { useState } from '@wordpress/element' ;
1111import { __ } from '@wordpress/i18n' ;
1212import { category } from '@wordpress/icons' ;
1313
1414/**
1515 * Internal dependencies
1616 */
17- import { Footer , Notice , Button , NewspackIcon , TabbedNavigation , PluginInstaller } from '../' ;
17+ import {
18+ Footer ,
19+ Notice ,
20+ Button ,
21+ NewspackIcon ,
22+ TabbedNavigation ,
23+ PluginInstaller ,
24+ HandoffMessage ,
25+ } from '../' ;
1826import Router from '../proxied-imports/router' ;
1927import registerStore , { WIZARD_STORE_NAMESPACE } from './store' ;
2028import { useWizardData } from './store/utils' ;
2129import WizardError from './components/WizardError' ;
22- import { HANDOFF_KEY } from '../consts' ;
2330
2431registerStore ( ) ;
2532
@@ -35,22 +42,13 @@ const Wizard = ( {
3542 renderAboveSections,
3643 requiredPlugins = [ ] ,
3744} ) => {
38- const [ handoffMessage , setHandoffMessage ] = useState ( false ) ;
3945 const isLoading = useSelect ( select => select ( WIZARD_STORE_NAMESPACE ) . isLoading ( ) ) ;
4046 const isQuietLoading = useSelect ( select => select ( WIZARD_STORE_NAMESPACE ) . isQuietLoading ( ) ) ;
4147
4248 // Trigger initial data fetch. Some sections might not use the wizard data,
4349 // but for consistency, fetching is triggered regardless of the section.
4450 useSelect ( select => select ( WIZARD_STORE_NAMESPACE ) . getWizardAPIData ( apiSlug ) ) ;
4551
46- useEffect ( ( ) => {
47- const handoff = JSON . parse ( localStorage . getItem ( HANDOFF_KEY ) ) ;
48-
49- if ( handoff ?. message ) {
50- setHandoffMessage ( handoff . message ) ;
51- }
52- } , [ ] ) ;
53-
5452 let displayedSections = sections . filter ( section => ! section . isHidden ) ;
5553
5654 const [ pluginRequirementsSatisfied , setPluginRequirementsSatisfied ] = useState (
@@ -112,9 +110,7 @@ const Wizard = ( {
112110 < WizardError />
113111 </ TabbedNavigation >
114112 ) }
115- { handoffMessage && (
116- < Notice isHandoff isDismissible = { false } rawHTML noticeText = { handoffMessage } />
117- ) }
113+ < HandoffMessage />
118114
119115 < Switch >
120116 { displayedSections . map ( ( section , index ) => {
0 commit comments