CYS - AI flow: keep persisted query param when redirecting (#46820)

* CYS - set flowType when the state machine is instantiated

* remove not necessary code

* Add changefile(s) from automation for the following project(s): woocommerce

* fix action

* improve logic

* Add changefile(s) from automation for the following project(s): woocommerce

* CYS - AI Flow: hide X button on the entrepreneur flow

* CYS - AI flow: keep persisted query param when redirect

* Add changefile(s) from automation for the following project(s): woocommerce

---------

Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
Luigi Teschio 2024-04-23 17:52:29 +02:00 committed by GitHub
parent dae1c963da
commit cce1e224ad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 19 additions and 4 deletions

View File

@ -33,6 +33,8 @@ import {
updateQueryString, updateQueryString,
useQuery, useQuery,
} from '@woocommerce/navigation'; } from '@woocommerce/navigation';
// In some cases, the assembler is loaded in an iframe, so we have to re-apply the filter.
import '~/customize-store/design-with-ai/entrepreneur-flow';
function isSubset( function isSubset(
subset: { subset: {

View File

@ -31,6 +31,7 @@ import { GoBackWarningModal } from '../go-back-warning-modal';
*/ */
import { CustomizeStoreContext } from '../'; import { CustomizeStoreContext } from '../';
import { isAIFlow } from '~/customize-store/guards'; import { isAIFlow } from '~/customize-store/guards';
import { isEntrepreneurFlow } from '~/customize-store/design-with-ai/entrepreneur-flow';
const { useLocation } = unlock( routerPrivateApis ); const { useLocation } = unlock( routerPrivateApis );
export const SidebarNavigationScreen = ( { export const SidebarNavigationScreen = ( {
@ -98,7 +99,7 @@ export const SidebarNavigationScreen = ( {
showTooltip={ false } showTooltip={ false }
/> />
) } ) }
{ isRoot && ( { isRoot && ! isEntrepreneurFlow() && (
<SidebarButton <SidebarButton
onClick={ () => { onClick={ () => {
setOpenWarningModal( true ); setOpenWarningModal( true );
@ -110,6 +111,9 @@ export const SidebarNavigationScreen = ( {
) } ) }
<Heading <Heading
className="edit-site-sidebar-navigation-screen__title" className="edit-site-sidebar-navigation-screen__title"
style={
isEntrepreneurFlow() ? { padding: '0 16px' } : {}
}
color={ '#e0e0e0' /* $gray-200 */ } color={ '#e0e0e0' /* $gray-200 */ }
level={ 1 } level={ 1 }
size={ 20 } size={ 20 }

View File

@ -21,7 +21,7 @@ import { decodeEntities } from '@wordpress/html-entities';
import { forwardRef } from '@wordpress/element'; import { forwardRef } from '@wordpress/element';
// @ts-ignore No types for this exist yet. // @ts-ignore No types for this exist yet.
import SiteIcon from '@wordpress/edit-site/build-module/components/site-icon'; import SiteIcon from '@wordpress/edit-site/build-module/components/site-icon';
import { getNewPath } from '@woocommerce/navigation'; import { getNewPath, getPersistedQuery } from '@woocommerce/navigation';
import { Link } from '@woocommerce/components'; import { Link } from '@woocommerce/components';
/** /**
* Internal dependencies * Internal dependencies
@ -87,7 +87,11 @@ export const SiteHub = forwardRef(
) } ) }
> >
<Link <Link
href={ getNewPath( {}, '/', {} ) } href={ getNewPath(
getPersistedQuery(),
'/',
{}
) }
type="wp-admin" type="wp-admin"
> >
<SiteIcon className="edit-site-layout__view-mode-toggle-icon" /> <SiteIcon className="edit-site-layout__view-mode-toggle-icon" />

View File

@ -12,6 +12,7 @@ import {
getQuery, getQuery,
updateQueryString, updateQueryString,
getHistory, getHistory,
getPersistedQuery,
} from '@woocommerce/navigation'; } from '@woocommerce/navigation';
import { OPTIONS_STORE_NAME } from '@woocommerce/data'; import { OPTIONS_STORE_NAME } from '@woocommerce/data';
import { dispatch, resolveSelect } from '@wordpress/data'; import { dispatch, resolveSelect } from '@wordpress/data';
@ -81,7 +82,7 @@ const updateQueryStep = (
}; };
const redirectToWooHome = () => { const redirectToWooHome = () => {
const url = getNewPath( {}, '/', {} ); const url = getNewPath( getPersistedQuery(), '/', {} );
navigateOrParent( window, url ); navigateOrParent( window, url );
}; };

View File

@ -0,0 +1,4 @@
Significance: minor
Type: tweak
CYS - AI flow: keep persisted query param when redirecting.