2023-10-05 12:36:08 +00:00
|
|
|
/* eslint-disable @woocommerce/dependency-group */
|
|
|
|
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
2023-11-07 09:34:20 +00:00
|
|
|
|
2023-09-15 04:01:02 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
import { __ } from '@wordpress/i18n';
|
|
|
|
import { getSetting } from '@woocommerce/settings';
|
|
|
|
import {
|
|
|
|
Button,
|
2023-11-07 09:34:20 +00:00
|
|
|
Modal,
|
2023-09-15 04:01:02 +00:00
|
|
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
|
|
// @ts-ignore No types for this exist yet.
|
|
|
|
__unstableMotion as motion,
|
|
|
|
} from '@wordpress/components';
|
2024-03-15 11:27:08 +00:00
|
|
|
|
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-11-01 11:40:12 +00:00
|
|
|
import { WooCYSSecondaryButtonSlot } from './secondary-button-slot';
|
2023-11-07 09:34:20 +00:00
|
|
|
import { SurveyForm } from './survey-form';
|
2024-03-15 11:27:08 +00:00
|
|
|
import lessonPlan from '../assets/icons/lesson-plan.js';
|
|
|
|
import { Icon, brush, tag } from '@wordpress/icons';
|
2024-04-23 17:38:06 +00:00
|
|
|
import { trackEvent } from '../tracking';
|
2024-05-21 13:56:26 +00:00
|
|
|
import { isEntrepreneurFlow } from '~/customize-store/design-with-ai/entrepreneur-flow';
|
2023-09-15 04:01:02 +00:00
|
|
|
|
2023-11-10 08:35:46 +00:00
|
|
|
export * as actions from './actions';
|
|
|
|
export * as services from './services';
|
|
|
|
|
|
|
|
export type events = { type: 'GO_BACK_TO_HOME' } | { type: 'COMPLETE_SURVEY' };
|
2023-09-15 04:01:02 +00:00
|
|
|
|
|
|
|
export const Transitional = ( {
|
|
|
|
sendEvent,
|
2023-11-10 08:35:46 +00:00
|
|
|
hasCompleteSurvey,
|
2024-01-30 08:58:05 +00:00
|
|
|
isWooExpress,
|
2023-11-07 09:34:20 +00:00
|
|
|
isSurveyOpen,
|
|
|
|
setSurveyOpen,
|
2023-11-29 14:00:40 +00:00
|
|
|
aiOnline,
|
2023-09-15 04:01:02 +00:00
|
|
|
}: {
|
|
|
|
sendEvent: ( event: events ) => void;
|
2023-11-10 08:35:46 +00:00
|
|
|
hasCompleteSurvey: boolean;
|
2024-01-30 08:58:05 +00:00
|
|
|
isWooExpress: boolean;
|
2023-11-07 09:34:20 +00:00
|
|
|
isSurveyOpen: boolean;
|
|
|
|
setSurveyOpen: ( isOpen: boolean ) => void;
|
2023-11-29 14:00:40 +00:00
|
|
|
aiOnline: boolean;
|
2023-09-15 04:01:02 +00:00
|
|
|
} ) => {
|
|
|
|
const homeUrl: string = getSetting( 'homeUrl', '' );
|
2023-11-07 09:34:20 +00:00
|
|
|
const closeSurvey = () => {
|
|
|
|
setSurveyOpen( false );
|
|
|
|
};
|
|
|
|
|
2024-05-21 13:56:26 +00:00
|
|
|
const showSurveyButton = ! hasCompleteSurvey && ! isEntrepreneurFlow();
|
2024-01-30 08:58:05 +00:00
|
|
|
const showAISurvey = isWooExpress && aiOnline;
|
|
|
|
|
2023-09-15 04:01:02 +00:00
|
|
|
return (
|
|
|
|
<div className="woocommerce-customize-store__transitional">
|
2024-01-30 08:58:05 +00:00
|
|
|
{ isSurveyOpen && (
|
2023-11-07 09:34:20 +00:00
|
|
|
<Modal
|
|
|
|
title={ __( 'Share feedback', 'woocommerce' ) }
|
|
|
|
onRequestClose={ () => closeSurvey() }
|
|
|
|
shouldCloseOnClickOutside={ false }
|
|
|
|
className="woocommerce-ai-survey-modal"
|
|
|
|
>
|
2023-11-10 08:35:46 +00:00
|
|
|
<SurveyForm
|
2024-01-30 08:58:05 +00:00
|
|
|
showAISurvey={ showAISurvey }
|
2023-11-10 08:35:46 +00:00
|
|
|
onSend={ () => {
|
|
|
|
sendEvent( {
|
|
|
|
type: 'COMPLETE_SURVEY',
|
|
|
|
} );
|
|
|
|
closeSurvey();
|
|
|
|
} }
|
|
|
|
closeFunction={ closeSurvey }
|
|
|
|
/>
|
2023-11-07 09:34:20 +00:00
|
|
|
</Modal>
|
|
|
|
) }
|
2023-09-15 04:01:02 +00:00
|
|
|
<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">
|
2024-05-21 13:56:26 +00:00
|
|
|
{ isEntrepreneurFlow()
|
|
|
|
? __(
|
2024-07-11 03:24:11 +00:00
|
|
|
"Congratulations! You've successfully designed your store. Now you can go back to the Home screen to complete your store setup and start selling.",
|
2024-05-21 13:56:26 +00:00
|
|
|
'woocommerce'
|
|
|
|
)
|
|
|
|
: __(
|
|
|
|
"Congratulations! You've successfully designed your store. Take a look at your hard work before continuing to set up your store.",
|
|
|
|
'woocommerce'
|
|
|
|
) }
|
2023-09-15 04:01:02 +00:00
|
|
|
</h2>
|
2023-11-01 11:40:12 +00:00
|
|
|
|
2024-03-15 11:27:08 +00:00
|
|
|
<WooCYSSecondaryButtonSlot />
|
|
|
|
<div className="woocommerce-customize-store__transitional-buttons">
|
2024-01-30 08:58:05 +00:00
|
|
|
{ showSurveyButton && (
|
2023-11-10 08:35:46 +00:00
|
|
|
<Button
|
2024-03-15 11:27:08 +00:00
|
|
|
className="woocommerce-customize-store__transitional-preview-buttonwoocommerce-customize-store__transitional-preview-button"
|
2023-11-10 08:35:46 +00:00
|
|
|
variant="secondary"
|
|
|
|
onClick={ () => {
|
2024-04-23 17:38:06 +00:00
|
|
|
trackEvent(
|
2024-01-30 08:58:05 +00:00
|
|
|
isWooExpress
|
|
|
|
? 'customize_your_store_transitional_survey_click'
|
|
|
|
: 'customize_your_store_on_core_transitional_survey_click'
|
2023-11-10 08:35:46 +00:00
|
|
|
);
|
|
|
|
setSurveyOpen( true );
|
|
|
|
} }
|
|
|
|
>
|
|
|
|
{ __( 'Share feedback', 'woocommerce' ) }
|
|
|
|
</Button>
|
|
|
|
) }
|
2023-11-07 09:34:20 +00:00
|
|
|
|
2023-11-01 11:40:12 +00:00
|
|
|
<Button
|
|
|
|
className="woocommerce-customize-store__transitional-preview-button"
|
2024-05-21 13:56:26 +00:00
|
|
|
variant={
|
|
|
|
isEntrepreneurFlow() ? 'secondary' : 'primary'
|
|
|
|
}
|
2023-11-01 11:40:12 +00:00
|
|
|
onClick={ () => {
|
2024-04-23 17:38:06 +00:00
|
|
|
trackEvent(
|
2023-11-01 11:40:12 +00:00
|
|
|
'customize_your_store_transitional_preview_store_click'
|
|
|
|
);
|
|
|
|
window.open( homeUrl, '_blank' );
|
|
|
|
} }
|
|
|
|
>
|
2024-03-15 11:27:08 +00:00
|
|
|
{ __( 'View store', 'woocommerce' ) }
|
2023-11-01 11:40:12 +00:00
|
|
|
</Button>
|
2024-05-21 13:56:26 +00:00
|
|
|
|
|
|
|
{ isEntrepreneurFlow() && (
|
|
|
|
<Button
|
|
|
|
variant="primary"
|
|
|
|
onClick={ () => {
|
|
|
|
trackEvent(
|
|
|
|
'customize_your_store_entrepreneur_home_click'
|
|
|
|
);
|
|
|
|
sendEvent( {
|
|
|
|
type: 'GO_BACK_TO_HOME',
|
|
|
|
} );
|
|
|
|
} }
|
|
|
|
>
|
|
|
|
{ __( 'Back to Home', 'woocommerce' ) }
|
|
|
|
</Button>
|
|
|
|
) }
|
2023-11-01 11:40:12 +00:00
|
|
|
</div>
|
2024-05-21 13:56:26 +00:00
|
|
|
{ ! isEntrepreneurFlow() && (
|
|
|
|
<>
|
|
|
|
<h2 className="woocommerce-customize-store__transitional-main-actions-title">
|
|
|
|
{ __( "What's next?", 'woocommerce' ) }
|
|
|
|
</h2>
|
|
|
|
<div className="woocommerce-customize-store__transitional-main-actions">
|
|
|
|
<div className="woocommerce-customize-store__transitional-action">
|
|
|
|
<Icon
|
|
|
|
className={
|
|
|
|
'woocommerce-customize-store__transitional-action__icon'
|
|
|
|
}
|
|
|
|
icon={ tag }
|
|
|
|
/>
|
|
|
|
<div className="woocommerce-customize-store__transitional-action__content">
|
|
|
|
<h3>
|
|
|
|
{ __(
|
|
|
|
'Add your products',
|
|
|
|
'woocommerce'
|
|
|
|
) }
|
|
|
|
</h3>
|
|
|
|
<p>
|
|
|
|
{ __(
|
|
|
|
'Start stocking your virtual shelves by adding or importing your products, or edit the sample products.',
|
|
|
|
'woocommerce'
|
|
|
|
) }
|
|
|
|
</p>
|
|
|
|
<Button
|
|
|
|
variant="link"
|
|
|
|
onClick={ () => {
|
|
|
|
trackEvent(
|
|
|
|
'customize_your_store_transitional_product_list_click'
|
|
|
|
);
|
|
|
|
navigateOrParent(
|
|
|
|
window,
|
|
|
|
`${ ADMIN_URL }edit.php?post_type=product`
|
|
|
|
);
|
|
|
|
} }
|
|
|
|
>
|
|
|
|
{ __(
|
|
|
|
'Go to Products',
|
|
|
|
'woocommerce'
|
|
|
|
) }
|
|
|
|
</Button>
|
|
|
|
</div>
|
|
|
|
</div>
|
2023-09-15 04:01:02 +00:00
|
|
|
|
2024-05-21 13:56:26 +00:00
|
|
|
<div className="woocommerce-customize-store__transitional-action">
|
|
|
|
<Icon
|
|
|
|
className={
|
|
|
|
'woocommerce-customize-store__transitional-action__icon'
|
|
|
|
}
|
|
|
|
icon={ brush }
|
|
|
|
/>
|
|
|
|
<div className="woocommerce-customize-store__transitional-action__content">
|
|
|
|
<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="link"
|
|
|
|
onClick={ () => {
|
|
|
|
trackEvent(
|
|
|
|
'customize_your_store_transitional_editor_click'
|
|
|
|
);
|
|
|
|
navigateOrParent(
|
|
|
|
window,
|
|
|
|
`${ ADMIN_URL }site-editor.php`
|
|
|
|
);
|
|
|
|
} }
|
|
|
|
>
|
|
|
|
{ __(
|
|
|
|
'Go to the Editor',
|
|
|
|
'woocommerce'
|
|
|
|
) }
|
|
|
|
</Button>
|
|
|
|
</div>
|
|
|
|
</div>
|
2023-09-15 04:01:02 +00:00
|
|
|
|
2024-05-21 13:56:26 +00:00
|
|
|
<div className="woocommerce-customize-store__transitional-action">
|
|
|
|
<Icon
|
|
|
|
className={
|
|
|
|
'woocommerce-customize-store__transitional-action__icon'
|
|
|
|
}
|
|
|
|
icon={ lessonPlan }
|
|
|
|
/>
|
|
|
|
<div className="woocommerce-customize-store__transitional-action__content">
|
|
|
|
<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="link"
|
|
|
|
onClick={ () => {
|
|
|
|
trackEvent(
|
|
|
|
'customize_your_store_transitional_home_click'
|
|
|
|
);
|
|
|
|
sendEvent( {
|
|
|
|
type: 'GO_BACK_TO_HOME',
|
|
|
|
} );
|
|
|
|
} }
|
|
|
|
>
|
|
|
|
{ __( 'Back to Home', 'woocommerce' ) }
|
|
|
|
</Button>
|
|
|
|
</div>
|
|
|
|
</div>
|
2024-03-15 11:27:08 +00:00
|
|
|
</div>
|
2024-05-21 13:56:26 +00:00
|
|
|
</>
|
|
|
|
) }
|
2023-09-15 04:01:02 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|