2023-10-05 12:36:08 +00:00
|
|
|
/* eslint-disable @woocommerce/dependency-group */
|
|
|
|
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
2023-09-15 04:01:02 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
2023-10-05 12:36:08 +00:00
|
|
|
import classNames from 'classnames';
|
2023-09-15 04:01:02 +00:00
|
|
|
import { __ } from '@wordpress/i18n';
|
|
|
|
import { getSetting } from '@woocommerce/settings';
|
2023-09-18 11:01:12 +00:00
|
|
|
import { recordEvent } from '@woocommerce/tracks';
|
2023-09-15 04:01:02 +00:00
|
|
|
import {
|
|
|
|
Button,
|
|
|
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
|
|
// @ts-ignore No types for this exist yet.
|
|
|
|
__unstableMotion as motion,
|
|
|
|
} from '@wordpress/components';
|
2023-10-05 12:36:08 +00:00
|
|
|
// @ts-ignore No types for this exist yet.
|
|
|
|
import { useIsSiteEditorLoading } from '@wordpress/edit-site/build-module/components/layout/hooks';
|
2023-09-15 04:01:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
|
|
|
import { SiteHub } from '../assembler-hub/site-hub';
|
|
|
|
import { ADMIN_URL } from '~/utils/admin-settings';
|
2023-10-05 12:36:08 +00:00
|
|
|
|
2023-09-15 04:01:02 +00:00
|
|
|
import './style.scss';
|
2023-10-26 08:46:50 +00:00
|
|
|
import { navigateOrParent } from '../utils';
|
2023-09-15 04:01:02 +00:00
|
|
|
|
|
|
|
export type events = { type: 'GO_BACK_TO_HOME' };
|
|
|
|
|
|
|
|
export const Transitional = ( {
|
2023-10-05 12:36:08 +00:00
|
|
|
editor,
|
2023-09-15 04:01:02 +00:00
|
|
|
sendEvent,
|
|
|
|
}: {
|
2023-10-05 12:36:08 +00:00
|
|
|
editor: React.ReactNode;
|
2023-09-15 04:01:02 +00:00
|
|
|
sendEvent: ( event: events ) => void;
|
|
|
|
} ) => {
|
|
|
|
const homeUrl: string = getSetting( 'homeUrl', '' );
|
2023-10-05 12:36:08 +00:00
|
|
|
const isEditorLoading = useIsSiteEditorLoading();
|
2023-09-15 04:01:02 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="woocommerce-customize-store__transitional">
|
|
|
|
<SiteHub
|
|
|
|
as={ motion.div }
|
|
|
|
variants={ {
|
|
|
|
view: { x: 0 },
|
|
|
|
} }
|
|
|
|
isTransparent={ false }
|
|
|
|
className="edit-site-layout__hub"
|
|
|
|
/>
|
|
|
|
|
|
|
|
<div className="woocommerce-customize-store__transitional-content">
|
|
|
|
<h1 className="woocommerce-customize-store__transitional-heading">
|
|
|
|
{ __( 'Your store looks great!', 'woocommerce' ) }
|
|
|
|
</h1>
|
|
|
|
<h2 className="woocommerce-customize-store__transitional-subheading">
|
|
|
|
{ __(
|
|
|
|
"Your store is a reflection of your unique style and personality, and we're thrilled to see it come to life.",
|
|
|
|
'woocommerce'
|
|
|
|
) }
|
|
|
|
</h2>
|
|
|
|
<Button
|
|
|
|
className="woocommerce-customize-store__transitional-preview-button"
|
|
|
|
variant="primary"
|
2023-09-18 11:01:12 +00:00
|
|
|
onClick={ () => {
|
|
|
|
recordEvent(
|
|
|
|
'customize_your_store_transitional_preview_store_click'
|
|
|
|
);
|
|
|
|
window.open( homeUrl, '_blank' );
|
|
|
|
} }
|
2023-09-15 04:01:02 +00:00
|
|
|
>
|
|
|
|
{ __( 'Preview store', 'woocommerce' ) }
|
|
|
|
</Button>
|
|
|
|
|
2023-10-05 12:36:08 +00:00
|
|
|
<div
|
|
|
|
className={ classNames(
|
|
|
|
'woocommerce-customize-store__transitional-site-preview-container',
|
|
|
|
{
|
|
|
|
'is-loading': isEditorLoading,
|
|
|
|
}
|
|
|
|
) }
|
|
|
|
>
|
|
|
|
{ editor }
|
2023-09-15 04:01:02 +00:00
|
|
|
</div>
|
|
|
|
<div className="woocommerce-customize-store__transitional-actions">
|
|
|
|
<div className="woocommerce-customize-store__transitional-action">
|
|
|
|
<h3>
|
|
|
|
{ __( 'Fine-tune your design', 'woocommerce' ) }
|
|
|
|
</h3>
|
|
|
|
<p>
|
|
|
|
{ __(
|
|
|
|
'Head to the Editor to change your images and text, add more pages, and make any further customizations.',
|
|
|
|
'woocommerce'
|
|
|
|
) }
|
|
|
|
</p>
|
|
|
|
<Button
|
|
|
|
variant="tertiary"
|
2023-09-18 11:01:12 +00:00
|
|
|
onClick={ () => {
|
|
|
|
recordEvent(
|
|
|
|
'customize_your_store_transitional_editor_click'
|
|
|
|
);
|
2023-10-26 08:46:50 +00:00
|
|
|
navigateOrParent(
|
|
|
|
window,
|
|
|
|
`${ ADMIN_URL }site-editor.php`
|
|
|
|
);
|
2023-09-18 11:01:12 +00:00
|
|
|
} }
|
2023-09-15 04:01:02 +00:00
|
|
|
>
|
|
|
|
{ __( 'Go to the Editor', 'woocommerce' ) }
|
|
|
|
</Button>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div className="woocommerce-customize-store__transitional-action">
|
|
|
|
<h3>
|
|
|
|
{ __(
|
|
|
|
'Continue setting up your store',
|
|
|
|
'woocommerce'
|
|
|
|
) }
|
|
|
|
</h3>
|
|
|
|
<p>
|
|
|
|
{ __(
|
|
|
|
'Go back to the Home screen to complete your store setup and start selling',
|
|
|
|
'woocommerce'
|
|
|
|
) }
|
|
|
|
</p>
|
|
|
|
<Button
|
|
|
|
variant="tertiary"
|
2023-09-18 11:01:12 +00:00
|
|
|
onClick={ () => {
|
|
|
|
recordEvent(
|
|
|
|
'customize_your_store_transitional_home_click'
|
|
|
|
);
|
2023-09-15 04:01:02 +00:00
|
|
|
sendEvent( {
|
|
|
|
type: 'GO_BACK_TO_HOME',
|
2023-09-18 11:01:12 +00:00
|
|
|
} );
|
|
|
|
} }
|
2023-09-15 04:01:02 +00:00
|
|
|
>
|
|
|
|
{ __( 'Back to Home', 'woocommerce' ) }
|
|
|
|
</Button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|