diff --git a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/focused-launch.ts b/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/focused-launch.ts deleted file mode 100644 index 241668391e387..0000000000000 --- a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/focused-launch.ts +++ /dev/null @@ -1,2 +0,0 @@ -import './src/stores'; -import './src/attach-focused-launch'; diff --git a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/gutenboarding-launch.ts b/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/gutenboarding-launch.ts deleted file mode 100644 index e3ef68c2164f4..0000000000000 --- a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/gutenboarding-launch.ts +++ /dev/null @@ -1,2 +0,0 @@ -import './src/stores'; -import './src/attach-launch-sidebar'; diff --git a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/index.php b/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/index.php deleted file mode 100644 index 9f74e48e2299c..0000000000000 --- a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/index.php +++ /dev/null @@ -1,136 +0,0 @@ - $site_launch_options['site_slug'], - 'launchUrl' => $site_launch_options['launch_url'], - 'launchFlow' => $site_launch_options['launch_flow'], - 'locale' => determine_locale(), - ); - - $is_gutenboarding = $site_launch_options['is_gutenboarding']; - if ( $is_gutenboarding ) { - // The isGutenboarding prop either exists with the value '1' or does not exist at all. - // The value `true` gets typecasted to '1' by `wp_localize_script` anyway. - $options['isGutenboarding'] = '1'; - } - - $anchor_podcast = $site_launch_options['anchor_podcast']; - if ( ! empty( $anchor_podcast ) ) { - $options['anchorFmPodcastId'] = $anchor_podcast; - } - - // Pass site launch options to client side here. - // This is accessible via window.wpcomEditorSiteLaunch. - wp_localize_script( - 'a8c-fse-editor-site-launch-button-script', - 'wpcomEditorSiteLaunch', - $options - ); -} - -/** - * Enqueue launch flow assets - * - * @param array $site_launch_options Site launch options. - */ -function enqueue_launch_flow_script_and_style( $site_launch_options ) { - $anchor_podcast = $site_launch_options['anchor_podcast']; - - if ( ! empty( $anchor_podcast ) ) { - // AnchorFM flow runs on focused-launch. - $script_name = 'focused-launch'; - } else { - // For redirect or non-AnchorFM sites, skip & exit early. - return; - } - - $asset_file = include plugin_dir_path( __FILE__ ) . 'dist/' . $script_name . '.asset.php'; - $script_dependencies = isset( $asset_file['dependencies'] ) ? $asset_file['dependencies'] : array(); - $script_file = 'dist/' . $script_name . '.min.js'; - $script_version = isset( $asset_file['version'] ) ? $asset_file['version'] : filemtime( plugin_dir_path( __FILE__ ) . $script_file ); - - wp_enqueue_script( - 'a8c-fse-editor-site-launch-script', - plugins_url( $script_file, __FILE__ ), - $script_dependencies, - $script_version, - true - ); - - wp_set_script_translations( 'a8c-fse-editor-site-launch-script', 'full-site-editing' ); - - $style_file = 'dist/' . $script_name . ( is_rtl() ? '.rtl.css' : '.css' ); - $style_version = isset( $asset_file['version'] ) ? $asset_file['version'] : filemtime( plugin_dir_path( __FILE__ ) . $style_file ); - - wp_enqueue_style( - 'a8c-fse-editor-site-launch-style', - plugins_url( $style_file, __FILE__ ), - array(), - $style_version - ); -} - -/** - * Enqueue assets - */ -function enqueue_script_and_style() { - // Avoid loading assets if possible. - if ( ! \A8C\FSE\Common\is_block_editor_screen() ) { - return; - } - - // Get site launch options. - $site_launch_options = apply_filters( 'a8c_enable_editor_site_launch', false ); - - // If no site launch options, skip. - // This could mean site is already launched or editing toolkit plugin is running on non-wpcom sites. - if ( false === $site_launch_options ) { - return; - } - - enqueue_launch_button_script_and_style( $site_launch_options ); - enqueue_launch_flow_script_and_style( $site_launch_options ); -} -add_action( 'enqueue_block_editor_assets', __NAMESPACE__ . '\enqueue_script_and_style' ); diff --git a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/launch-button.ts b/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/launch-button.ts deleted file mode 100644 index b4c796b74ca25..0000000000000 --- a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/launch-button.ts +++ /dev/null @@ -1 +0,0 @@ -import './src/launch-button'; diff --git a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/attach-focused-launch.tsx b/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/attach-focused-launch.tsx deleted file mode 100644 index 677878d31e109..0000000000000 --- a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/attach-focused-launch.tsx +++ /dev/null @@ -1,61 +0,0 @@ -import FocusedLaunchModal from '@automattic/launch'; -import { useSelect, useDispatch } from '@wordpress/data'; -import { registerPlugin as originalRegisterPlugin, PluginSettings } from '@wordpress/plugins'; -import { hasQueryArg } from '@wordpress/url'; -import { useEffect } from 'react'; -import { inIframe } from '../../block-inserter-modifications/contextual-tips/utils'; -import { IMMEDIATE_LAUNCH_QUERY_ARG } from './constants'; -import { LAUNCH_STORE, SITE_STORE } from './stores'; -import { openCheckout, redirectToWpcomPath, getCurrentLaunchFlowUrl } from './utils'; -import type { LaunchSelect, SiteSelect } from '@automattic/data-stores'; - -const registerPlugin = ( name: string, settings: Omit< PluginSettings, 'icon' > ) => - // eslint-disable-next-line @typescript-eslint/no-explicit-any - originalRegisterPlugin( name, settings as any ); - -registerPlugin( 'a8c-editor-editor-focused-launch', { - render: function LaunchSidebar() { - const currentSiteId = window._currentSiteId; - - const isSiteLaunched = useSelect( - ( select ) => ( select( SITE_STORE ) as SiteSelect ).isSiteLaunched( currentSiteId ), - [ currentSiteId ] - ); - - const { isFocusedLaunchOpen, isAnchorFm } = useSelect( - ( select ) => ( select( LAUNCH_STORE ) as LaunchSelect ).getState(), - [] - ); - - const { openFocusedLaunch } = useDispatch( LAUNCH_STORE ); - - // Add a class to hide the Launch button from editor bar when site is launched - useEffect( () => { - if ( isSiteLaunched ) { - document.body.classList.add( 'is-focused-launch-complete' ); - } - }, [ isSiteLaunched ] ); - - // '?should_launch' query arg is used when the mandatory checkout step - // is redirecting to an external payment processing page (eg: Paypal) - const shouldLaunch = hasQueryArg( getCurrentLaunchFlowUrl(), IMMEDIATE_LAUNCH_QUERY_ARG ); - - useEffect( () => { - if ( shouldLaunch && ! isSiteLaunched ) { - openFocusedLaunch(); - } - }, [ shouldLaunch, isSiteLaunched, openFocusedLaunch ] ); - - return isFocusedLaunchOpen ? ( - - ) : null; - }, -} ); diff --git a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/attach-launch-sidebar.tsx b/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/attach-launch-sidebar.tsx deleted file mode 100644 index 3a5c45eabfed3..0000000000000 --- a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/attach-launch-sidebar.tsx +++ /dev/null @@ -1,60 +0,0 @@ -import { LocaleProvider, i18nDefaultLocaleSlug } from '@automattic/i18n-utils'; -import { LaunchContext } from '@automattic/launch'; -import { useDispatch, useSelect } from '@wordpress/data'; -import { doAction, hasAction } from '@wordpress/hooks'; -import { registerPlugin as originalRegisterPlugin, PluginSettings } from '@wordpress/plugins'; -import { useEffect } from 'react'; -import { inIframe } from '../../block-inserter-modifications/contextual-tips/utils'; -import { FLOW_ID } from './constants'; -import LaunchModal from './launch-modal'; -import { LAUNCH_STORE } from './stores'; -import { openCheckout, redirectToWpcomPath, getCurrentLaunchFlowUrl } from './utils'; -import type { LaunchSelect } from '@automattic/data-stores'; - -const registerPlugin = ( name: string, settings: Omit< PluginSettings, 'icon' > ) => - // eslint-disable-next-line @typescript-eslint/no-explicit-any - originalRegisterPlugin( name, settings as any ); - -registerPlugin( 'a8c-editor-site-launch', { - render: function LaunchSidebar() { - const { isSidebarOpen } = useSelect( - ( select ) => ( select( LAUNCH_STORE ) as LaunchSelect ).getState(), - [] - ); - const { closeSidebar, setSidebarFullscreen, unsetSidebarFullscreen } = - useDispatch( LAUNCH_STORE ); - - useEffect( () => { - // @automattic/viewport doesn't have a breakpoint for medium (782px) - window.innerWidth < 782 ? setSidebarFullscreen() : unsetSidebarFullscreen(); - }, [ isSidebarOpen, setSidebarFullscreen, unsetSidebarFullscreen ] ); - - useEffect( () => { - const TOGGLE_INLINE_HELP_BUTTON_ACTION = 'a8c.wpcom-block-editor.toggleInlineHelpButton'; - if ( hasAction( TOGGLE_INLINE_HELP_BUTTON_ACTION ) ) { - doAction( TOGGLE_INLINE_HELP_BUTTON_ACTION, { hidden: isSidebarOpen } ); - } - }, [ isSidebarOpen ] ); - - if ( ! isSidebarOpen ) { - return null; - } - - return ( - - - - - - ); - }, -} ); diff --git a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/constants.ts b/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/constants.ts deleted file mode 100644 index f242cf2f55a97..0000000000000 --- a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/constants.ts +++ /dev/null @@ -1,5 +0,0 @@ -export const FLOW_ID = 'gutenboarding'; -export const GUTENBOARDING_LAUNCH_FLOW = 'gutenboarding-launch'; -export const FOCUSED_LAUNCH_FLOW = 'focused-launch'; -export const SITE_LAUNCH_FLOW = 'launch-site'; -export const IMMEDIATE_LAUNCH_QUERY_ARG = 'should_launch'; diff --git a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-button/index.ts b/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-button/index.ts deleted file mode 100644 index d622055145e9d..0000000000000 --- a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-button/index.ts +++ /dev/null @@ -1,102 +0,0 @@ -import { recordTracksEvent } from '@automattic/calypso-analytics'; -import { dispatch } from '@wordpress/data'; -import domReady from '@wordpress/dom-ready'; -import { __ } from '@wordpress/i18n'; -import { inIframe } from '../../../block-inserter-modifications/contextual-tips/utils'; -import { GUTENBOARDING_LAUNCH_FLOW } from '../constants'; - -import 'a8c-fse-common-data-stores'; -import '@wordpress/editor'; -import './styles.scss'; - -let handled = false; - -domReady( () => { - // If site launch options does not exist, stop. - const siteLaunchOptions = window.wpcomEditorSiteLaunch; - if ( ! siteLaunchOptions ) { - return; - } - - // Don't proceed if this function has already run - if ( handled ) { - return; - } - handled = true; - - const awaitSettingsBar = setInterval( () => { - const settingsBar = document.querySelector( '.edit-post-header__settings' ); - if ( ! settingsBar ) { - return; - } - clearInterval( awaitSettingsBar ); - - const body = document.querySelector( 'body' ); - if ( ! body ) { - return; - } - - const { launchFlow, isGutenboarding, anchorFmPodcastId } = siteLaunchOptions; - // Enable anchor-flavoured features (the launch button works immediately). - const isAnchorFm = !! anchorFmPodcastId; - - // Display the Launch button only for the AnchorFM flow - if ( launchFlow !== GUTENBOARDING_LAUNCH_FLOW || ! isAnchorFm ) { - return; - } - - // Wrap 'Launch' button link to control launch flow. - const launchButton = document.createElement( 'button' ); - launchButton.className = 'editor-gutenberg-launch__launch-button components-button is-primary'; - launchButton.addEventListener( 'click', ( e: Event ) => { - // Prevent default behaviour - e.preventDefault(); - - recordTracksEvent( 'calypso_newsite_editor_launch_click', { - is_new_site: !! isGutenboarding, - launch_flow: launchFlow, - is_in_iframe: inIframe(), - } ); - - if ( isAnchorFm ) { - dispatch( 'automattic/launch' ).enableAnchorFm(); - } - - const { savePost } = dispatch( 'core/editor' ); - const delayedSavePost = () => setTimeout( () => savePost(), 1000 ); - - switch ( launchFlow ) { - case GUTENBOARDING_LAUNCH_FLOW: - // @TODO: remove this temporary solution once backend returns correct launch flow value - if ( isAnchorFm ) { - dispatch( 'automattic/launch' ).openFocusedLaunch(); - break; - } - // Save post in the background while step-by-step flow opens - dispatch( 'automattic/launch' ).openSidebar(); - delayedSavePost(); - break; - } - } ); - - /* - * translators: "Launch" here refers to launching a whole site. - * Please translate differently from "Publish", which intstead - * refers to publishing a page. - */ - const textContent = document.createTextNode( __( 'Launch', 'full-site-editing' ) ); - launchButton.appendChild( textContent ); - - body.classList.add( 'editor-gutenberg-launch__fse-overrides' ); - - // 'Update'/'Publish' primary button to become 'Save' tertiary button. - const saveButton = settingsBar.querySelector( '.editor-post-publish-button__button' ); - // This line causes a reconciliation error in React and a page bork - // leaving it in there until we can decide on the UX for this component - // saveButton && ( saveButton.innerText = __( 'Save' ) ); - - // Put 'Launch' and 'Save' back on bar in desired order. - settingsBar.prepend( launchButton ); - saveButton && settingsBar.prepend( saveButton ); - } ); -} ); diff --git a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-button/styles.scss b/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-button/styles.scss deleted file mode 100644 index 7ee68499b44c9..0000000000000 --- a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-button/styles.scss +++ /dev/null @@ -1,21 +0,0 @@ -// Added to body to allow general overrides -.editor-gutenberg-launch__fse-overrides { - // Override 'Save' button to have tertiary styles. - .edit-post-header__settings { - .editor-post-publish-button__button { - color: #007cba !important; - background: none !important; - border: none !important; - box-shadow: none !important; - - &[aria-disabled="true"] { - opacity: 0.3 !important; - } - } - } -} - -.editor-gutenberg-launch__launch-button { - padding: 0 12px; - margin: 0 12px 0 3px; -} diff --git a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-menu/index.tsx b/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-menu/index.tsx deleted file mode 100644 index 2a17f711cfc59..0000000000000 --- a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-menu/index.tsx +++ /dev/null @@ -1,65 +0,0 @@ -import { useSelect, useDispatch } from '@wordpress/data'; -import { useI18n } from '@wordpress/react-i18n'; -import * as React from 'react'; -import { LAUNCH_STORE } from '../stores'; -import LaunchMenuItem from './item'; -import type { LaunchStepType } from '../../../common/data-stores/launch'; -import type { LaunchSelect } from '@automattic/data-stores'; - -import './styles.scss'; - -interface Props { - onMenuItemClick: ( step: LaunchStepType ) => void; -} - -const LaunchMenu: React.FunctionComponent< Props > = ( { onMenuItemClick } ) => { - const { __ } = useI18n(); - - const { currentStep, LaunchStep, LaunchSequence, isStepCompleted, isFlowCompleted } = useSelect( - ( select ) => { - const launchStore: LaunchSelect = select( LAUNCH_STORE ); - return { - currentStep: launchStore.getCurrentStep(), - LaunchStep: launchStore.getLaunchStep(), - LaunchSequence: launchStore.getLaunchSequence(), - isStepCompleted: launchStore.isStepCompleted, - isFlowCompleted: launchStore.isFlowCompleted(), - }; - }, - [] - ); - - const LaunchStepMenuItemTitles = { - [ LaunchStep.Name ]: __( 'Name your site', 'full-site-editing' ), - [ LaunchStep.Domain ]: __( 'Select a domain', 'full-site-editing' ), - [ LaunchStep.Plan ]: __( 'Select a plan', 'full-site-editing' ), - [ LaunchStep.Final ]: __( 'Launch your site', 'full-site-editing' ), - }; - - const { setStep } = useDispatch( LAUNCH_STORE ); - - const handleClick = ( step: string ) => { - setStep( step ); - onMenuItemClick( step ); - }; - - return ( -
-

{ __( 'Site Launch Steps', 'full-site-editing' ) }

-
- { LaunchSequence.map( ( step ) => ( - handleClick( step ) } - isDisabled={ step === LaunchStep.Final && ! isFlowCompleted } - /> - ) ) } -
-
- ); -}; - -export default LaunchMenu; diff --git a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-menu/item.tsx b/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-menu/item.tsx deleted file mode 100644 index 1aa26f4d52819..0000000000000 --- a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-menu/item.tsx +++ /dev/null @@ -1,43 +0,0 @@ -import { Button, SVG, Circle } from '@wordpress/components'; -import { Icon, check } from '@wordpress/icons'; -import classnames from 'classnames'; -import * as React from 'react'; - -const circle = ( - - - -); - -interface Props { - title: string; - isCompleted: boolean; - isCurrent: boolean; - isDisabled: boolean; - onClick: () => void; -} - -const LaunchMenuItem: React.FunctionComponent< Props > = ( { - title, - isCompleted, - isCurrent, - isDisabled, - onClick, -} ) => { - return ( - - ); -}; - -export default LaunchMenuItem; diff --git a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-menu/styles.scss b/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-menu/styles.scss deleted file mode 100644 index 0fa8ca4395de2..0000000000000 --- a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-menu/styles.scss +++ /dev/null @@ -1,59 +0,0 @@ -@import "@automattic/onboarding/styles/mixins"; - -.nux-launch-menu { - h4 { - text-transform: uppercase; - margin-bottom: 16px; - } -} - -.nux-launch-menu__item-group { - margin: 0 -12px; -} - -.nux-launch-menu__item.components-button.is-link { - @include onboarding-medium-text; - display: flex; - color: var(--studio-gray-30); - width: 100%; - text-align: left; - text-decoration: none; - padding: 16px 14px; - - &:hover { - color: initial; - } - - &:focus { - box-shadow: none; - } - - svg { - margin-right: 10px; - color: var(--studio-gray-10); - // cosmetic alignment - position: relative; - top: 1px; - left: -1px; - } - - // This is only highlighted when sidebar is not fullscreen - @include break-medium { - &.is-current { - background: var(--studio-blue-0); - color: initial; - - svg { - color: initial; - } - } - } - - &.is-completed { - svg { - color: var(--studio-green-40); - top: 0; - left: 0; - } - } -} diff --git a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-modal/index.tsx b/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-modal/index.tsx deleted file mode 100644 index 38395bea0cca4..0000000000000 --- a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-modal/index.tsx +++ /dev/null @@ -1,126 +0,0 @@ -import { useLocale } from '@automattic/i18n-utils'; -import { LaunchContext, useOnLaunch } from '@automattic/launch'; -import { Modal, Button } from '@wordpress/components'; -import { useDispatch, useSelect } from '@wordpress/data'; -import { __ } from '@wordpress/i18n'; -import { Icon, wordpress, close } from '@wordpress/icons'; -import classnames from 'classnames'; -import * as React from 'react'; -import Launch from '../launch'; -import LaunchProgress from '../launch-progress'; -import LaunchSidebar from '../launch-sidebar'; -import { LAUNCH_STORE, SITE_STORE, PLANS_STORE } from '../stores'; -import type { LaunchSelect, PlansSelect } from '@automattic/data-stores'; - -import './styles.scss'; - -interface Props { - onClose: () => void; - isLaunchImmediately?: boolean; -} - -const LaunchModal: React.FunctionComponent< Props > = ( { onClose, isLaunchImmediately } ) => { - const { siteId } = React.useContext( LaunchContext ); - - const { step: currentStep, isSidebarFullscreen } = useSelect( - ( select ) => ( select( LAUNCH_STORE ) as LaunchSelect ).getState(), - [] - ); - const [ isLaunching, setIsLaunching ] = React.useState( false ); - const [ isImmediateLaunchStarted, setIsImmediateLaunchStarted ] = React.useState( false ); - - const { launchSite } = useDispatch( SITE_STORE ); - const { savePost } = useDispatch( 'core/editor' ); - - const locale = useLocale(); - const { setPlanProductId } = useDispatch( LAUNCH_STORE ); - const defaultFreePlan = useSelect( - ( select ) => ( select( PLANS_STORE ) as PlansSelect ).getDefaultFreePlan( locale ), - [ locale ] - ); - - const handleLaunch = React.useCallback( () => { - launchSite( siteId ); - setIsLaunching( true ); - }, [ launchSite, setIsLaunching, siteId ] ); - - // When isLaunchImmediately: Show the "Hooray! Launching your site..." screen as soon as possible. - React.useEffect( () => { - if ( isLaunchImmediately && ! isLaunching ) { - setIsLaunching( true ); - } - }, [ isLaunching, isLaunchImmediately ] ); - - // When isLaunchImmediately: Begin the launch process after the free plan has loaded - // and if we haven't already started it (isImmediateLaunchStarted). - React.useEffect( () => { - const asyncSavePost = async () => { - await savePost(); - }; - if ( isLaunchImmediately && ! isImmediateLaunchStarted && defaultFreePlan?.productIds[ 0 ] ) { - setPlanProductId( defaultFreePlan?.productIds[ 0 ] ); - setIsImmediateLaunchStarted( true ); - asyncSavePost(); - handleLaunch(); - } - }, [ - isLaunchImmediately, - isImmediateLaunchStarted, - handleLaunch, - savePost, - defaultFreePlan, - setPlanProductId, - ] ); - - // handle redirects to checkout / my home after launch - useOnLaunch(); - - return ( - - { isLaunching ? ( -
- { __( 'Hooray! Your site will be ready shortly.', 'full-site-editing' ) } -
- ) : ( - <> -
-
-
- -
- -
- -
-
- -
- - - ) } -
- ); -}; - -export default LaunchModal; diff --git a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-modal/styles.scss b/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-modal/styles.scss deleted file mode 100644 index 9f27977f000b9..0000000000000 --- a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-modal/styles.scss +++ /dev/null @@ -1,187 +0,0 @@ -@import "@wordpress/base-styles/mixins"; -@import "@wordpress/base-styles/variables"; -@import "@wordpress/base-styles/breakpoints"; -@import "@wordpress/base-styles/z-index"; -@import "@automattic/typography/styles/variables"; -@import "@automattic/onboarding/styles/variables"; -@import "@automattic/onboarding/styles/mixins"; - -body.has-nux-launch-modal { - overflow: hidden; -} - -.nux-launch-modal { - &.components-modal__frame { - transform: none; - } - - .components-modal__header { - display: none; - } - - .components-modal__content { - position: fixed; - top: 0; - left: 0; - display: flex; - background: var(--studio-white); - width: 100%; - height: 100%; - padding: 0; - // Using overflow-y: scroll for consistent viewport width has an unintended - // consequence where if the content height is shorter than the viewport height - // the modal header overlaps the scrollbar on Chrome. - overflow: auto; - } -} - -.nux-launch-modal-header { - @include onboarding-block-edge2edge; - display: flex; - - // Modal header uses position: fixed instead of position: sticky because: - // - no scrollbar overlap issue. close button is another sticky element outside of header. - // - using position: sticky causes the header to pushed out in plans step when scrolling down. - position: fixed; - top: 0; - width: 100%; - height: $onboarding-header-height; - border-bottom: 1px solid $gray-200; - background: var(--studio-white); - z-index: z-index(".components-modal__header"); - - // On desktop, do not show bottom border. - @include break-medium { - position: relative; - border-bottom: none; - } - - .nux-launch-progress { - height: $onboarding-header-height; - - @include break-medium { - display: none; - } - } -} - -.nux-launch-modal-header__wp-logo { - display: flex; - align-items: center; - justify-content: center; - width: 60px; - height: 60px; -} - -.nux-launch-modal-body { - position: relative; - flex-grow: 1; - min-width: 0; - display: flex; - flex-direction: column; - @include onboarding-block-margin; - - .nux-launch-step__body { - flex-grow: 1; - } - - .is-sidebar-fullscreen & { - // Instead of display: none, this clips the modal body when - // fullscreen sidebar is showing, this is to prevents "Go Back" button - // from disappearing when clicked, causing the modal to blur - // itself out and abruptly closes the modal. - overflow: hidden; - } - - // To accomodate fixed .nux-launch-modal-header - padding-top: $onboarding-header-height; - - @include break-medium { - // Modal header is not sticky on desktop. - padding-top: 0; - } -} - -.nux-launch-modal-aside { - // Instead of display: none, the sidebar hides off-screen - // on mobile view, this is to prevents "Get Started" button - // from disappearing when clicked, causing the modal to blur - // itself out and abruptly closes the modal. - position: absolute; - top: 0; - left: -200%; - width: 100%; - height: 100%; - background: var(--studio-white); - z-index: z-index(".components-modal__header") + 2; - - @media ( max-width: $break-medium ) { - // This brings the sidebar that is hiding offscreen into view. - .is-sidebar-fullscreen & { - left: 0; - } - } - - @include break-medium { - // Use sticky or relative positioning because fixed or absolute - // positioning causes the vertical scrollbar from the parent element - // to overlap the content on the sidebar. - position: sticky; - top: 0; - left: auto; - width: $sidebar-width; - min-width: $sidebar-width; - max-width: $sidebar-width; - border-left: 1px solid var(--studio-gray-5); - } -} - -.nux-launch-modal__close-button.components-button.is-link { - // This keeps the button on the top right corner even when scrolled down - position: sticky; - top: 0; - z-index: z-index(".components-modal__header") + 3; - - // Give it no dimension so it doesn't take any flex space - // but overflow it so the close button is visible - width: 0; - height: 0; - overflow: visible; - - // Anchor the inline content to the top right (instead of middle). - display: flex; - align-items: flex-start; - - // Close button icon color - color: var(--studio-gray-50); - &:hover { - color: var(--studio-gray-40); - } - - > span { - // Push the icon back out from the right side - position: relative; - right: $onboarding-header-height; - - // Use padding to create width - // (18px left padding + 24px icon width + 18px right padding = 60px width) - padding: 0 #{( $onboarding-header-height - 24px ) * 0.5}; - height: $onboarding-header-height; - - // Vertically align icon - display: flex; - align-items: center; - } -} - -.nux-launch-modal-body__launching { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - display: flex; - justify-content: center; - align-items: center; - font-size: $font-body; -} diff --git a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-progress/index.tsx b/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-progress/index.tsx deleted file mode 100644 index ee0c77968c3fd..0000000000000 --- a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-progress/index.tsx +++ /dev/null @@ -1,30 +0,0 @@ -import { useSelect } from '@wordpress/data'; -import { sprintf } from '@wordpress/i18n'; -import { useI18n } from '@wordpress/react-i18n'; -import * as React from 'react'; -import { LAUNCH_STORE } from '../stores'; -import type { LaunchSelect } from '@automattic/data-stores'; - -import './styles.scss'; - -const LaunchProgress: React.FunctionComponent = () => { - const { __ } = useI18n(); - - const { currentStep, LaunchSequence } = useSelect( ( select ) => { - const launchStore: LaunchSelect = select( LAUNCH_STORE ); - return { - currentStep: launchStore.getCurrentStep(), - LaunchSequence: launchStore.getLaunchSequence(), - }; - }, [] ); - - const current = LaunchSequence.indexOf( currentStep ) + 1; - const total = LaunchSequence.length; - - /* translators: current progress in launch flow, eg: "2 of 4" */ - const summary = sprintf( __( '%1$d of %2$d', 'full-site-editing' ), current, total ); - - return
{ summary }
; -}; - -export default LaunchProgress; diff --git a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-progress/styles.scss b/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-progress/styles.scss deleted file mode 100644 index cf2b13f282d49..0000000000000 --- a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-progress/styles.scss +++ /dev/null @@ -1,5 +0,0 @@ -.nux-launch-progress { - display: flex; - align-items: center; - font-weight: 600; -} diff --git a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-sidebar/index.tsx b/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-sidebar/index.tsx deleted file mode 100644 index 01c17958b3e71..0000000000000 --- a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-sidebar/index.tsx +++ /dev/null @@ -1,52 +0,0 @@ -import { Title, SubTitle, ActionButtons, NextButton } from '@automattic/onboarding'; -import { useSelect, useDispatch } from '@wordpress/data'; -import { __ } from '@wordpress/i18n'; -import * as React from 'react'; -import LaunchMenu from '../launch-menu'; -import { LAUNCH_STORE } from '../stores'; -import type { LaunchSelect } from '@automattic/data-stores'; -import './styles.scss'; - -const LaunchSidebar: React.FunctionComponent = () => { - const { setStep, unsetSidebarFullscreen } = useDispatch( LAUNCH_STORE ); - - const LaunchSequence = useSelect( - ( select ) => ( select( LAUNCH_STORE ) as LaunchSelect ).getLaunchSequence(), - [] - ); - - const handleStart = () => { - setStep( LaunchSequence[ 0 ] ); - unsetSidebarFullscreen(); - }; - - const handleMenuItemClick = () => { - unsetSidebarFullscreen(); - }; - - return ( -
-
- { __( "You're almost there!", 'full-site-editing' ) } - - { __( - 'Complete the following steps to launch your site. Your site will remain private until you Launch.', - 'full-site-editing' - ) } - -
-
- -
-
- - - { __( 'Get Started', 'full-site-editing' ) } - - -
-
- ); -}; - -export default LaunchSidebar; diff --git a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-sidebar/styles.scss b/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-sidebar/styles.scss deleted file mode 100644 index 7e7eae96c6588..0000000000000 --- a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-sidebar/styles.scss +++ /dev/null @@ -1,58 +0,0 @@ -@import "@wordpress/base-styles/breakpoints"; -@import "@automattic/onboarding/styles/mixins"; - -.nux-launch-sidebar { - @include onboarding-block-margin; - display: flex; - flex-direction: column; - height: 100%; - background: var(--studio-white); - padding-top: $onboarding-header-height; - - @include break-medium { - display: block; - height: auto; - margin: 0 24px; - padding-top: 0; - - // On mobile & tablet, inherit onboarding title & subtitle styling. - // On desktop, use designated title & subtitle styling. - h1.onboarding-title { - font-size: $font-title-medium; - } - - h2.onboarding-subtitle { - font-family: $default-font; - font-weight: normal; - font-size: $font-body-small; - line-height: 1.5; - color: var(--studio-gray-60); - } - } -} - -.nux-launch-sidebar__header { - @include onboarding-heading-padding; -} - -.nux-launch-sidebar__body { - flex-grow: 1; - @include onboarding-body-margin; -} - -.nux-launch-sidebar__footer { - // On mobile & tablet, show sidebar footer, sticky at bottom. - @include onboarding-block-edge2edge; - position: sticky; - bottom: 0; - - .action-buttons { - position: relative; - justify-content: flex-end; - } - - // On desktop, hide sidebar footer. - @include break-medium { - display: none; - } -} diff --git a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-step/index.tsx b/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-step/index.tsx deleted file mode 100644 index e3fc45e118678..0000000000000 --- a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-step/index.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import * as React from 'react'; - -import './styles.scss'; - -export interface Props { - onPrevStep?: () => void; - onNextStep?: () => void; -} - -const LaunchStep: React.FunctionComponent< Props > = ( { children } ) => { - return <>{ children }; -}; - -export default LaunchStep; diff --git a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-step/styles.scss b/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-step/styles.scss deleted file mode 100644 index 8953e7d8e973b..0000000000000 --- a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-step/styles.scss +++ /dev/null @@ -1,41 +0,0 @@ -@import "@wordpress/base-styles/variables"; -@import "@wordpress/base-styles/breakpoints"; -@import "@automattic/typography/styles/fonts"; -@import "@automattic/onboarding/styles/mixins"; - -.nux-launch-step__header { - @include onboarding-heading-padding; - display: flex; - justify-content: space-between; - align-items: center; - - // On mobile, show header action buttons. - // On desktop, hide header action buttons. - .action-buttons { - display: none; - - @include break-medium { - display: block; - } - } -} - -.nux-launch-step__body { - @include onboarding-body-margin; -} - -.nux-launch-step__footer { - // On mobile & tablet, show step footer, sticky at bottom. - @include onboarding-block-edge2edge; - position: sticky; - bottom: 0; - - .action-buttons { - position: relative; - } - - // On desktop, hide step footer. - @include break-medium { - display: none; - } -} diff --git a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-steps/domain-step/index.tsx b/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-steps/domain-step/index.tsx deleted file mode 100644 index 9a493a3301091..0000000000000 --- a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-steps/domain-step/index.tsx +++ /dev/null @@ -1,89 +0,0 @@ -import { recordTracksEvent } from '@automattic/calypso-analytics'; -import DomainPicker, { mockDomainSuggestion } from '@automattic/domain-picker'; -import { useLocale } from '@automattic/i18n-utils'; -import { useDomainSelection, useSiteDomains, useDomainSearch } from '@automattic/launch'; -import { Title, SubTitle, ActionButtons, BackButton, NextButton } from '@automattic/onboarding'; -import { useDispatch } from '@wordpress/data'; -import { useI18n } from '@wordpress/react-i18n'; -import * as React from 'react'; -import { FLOW_ID } from '../../constants'; -import LaunchStepContainer, { Props as LaunchStepProps } from '../../launch-step'; -import { LAUNCH_STORE } from '../../stores'; - -const DomainStep: React.FunctionComponent< LaunchStepProps > = ( { onPrevStep, onNextStep } ) => { - const { __, hasTranslation } = useI18n(); - const locale = useLocale(); - - const { onDomainSelect, onExistingSubdomainSelect, currentDomain } = useDomainSelection(); - const { siteSubdomain } = useSiteDomains(); - const { domainSearch, setDomainSearch } = useDomainSearch(); - - const { confirmDomainSelection } = useDispatch( LAUNCH_STORE ); - - const handleNext = () => { - confirmDomainSelection(); - onNextStep?.(); - }; - - const handlePrev = () => { - onPrevStep?.(); - }; - - const trackDomainSearchInteraction = ( query: string ) => { - recordTracksEvent( 'calypso_newsite_domain_search_blur', { - flow: FLOW_ID, - query, - where: 'editor_domain_modal', - } ); - }; - - const fallbackSubtitleText = __( - 'Free for the first year with any paid plan.', - 'full-site-editing' - ); - const newSubtitleText = __( - 'Free for the first year with any annual plan.', - 'full-site-editing' - ); - const subtitleText = - locale === 'en' || hasTranslation?.( 'Free for the first year with any annual plan.' ) - ? newSubtitleText - : fallbackSubtitleText; - - return ( - -
-
- { __( 'Choose a domain', 'full-site-editing' ) } - { subtitleText } -
- - - -
-
- -
-
- - - - -
-
- ); -}; - -export default DomainStep; diff --git a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-steps/final-step/index.tsx b/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-steps/final-step/index.tsx deleted file mode 100644 index 8d27de61995c5..0000000000000 --- a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-steps/final-step/index.tsx +++ /dev/null @@ -1,282 +0,0 @@ -import { - CheckoutStepBody, - checkoutTheme, - CheckoutSummaryArea, - CheckoutSummaryCard, - MainContentWrapper, - CheckoutStepAreaWrapper, - SubmitButtonWrapper, - FormStatus, -} from '@automattic/composite-checkout'; -import { useLocale, useLocalizeUrl } from '@automattic/i18n-utils'; -import { useSiteDomains, useDomainSuggestion, useDomainSearch, useTitle } from '@automattic/launch'; -import { Title, SubTitle, ActionButtons, BackButton } from '@automattic/onboarding'; -import { ThemeProvider } from '@emotion/react'; -import { Button, Tip } from '@wordpress/components'; -import { useDispatch, useSelect } from '@wordpress/data'; -import { createInterpolateElement } from '@wordpress/element'; -import { sprintf } from '@wordpress/i18n'; -import { Icon, check } from '@wordpress/icons'; -import { useI18n } from '@wordpress/react-i18n'; -import classnames from 'classnames'; -import * as React from 'react'; -import LaunchStepContainer, { Props as LaunchStepProps } from '../../launch-step'; -import { LAUNCH_STORE, PLANS_STORE } from '../../stores'; -import type { LaunchSelect, PlansSelect } from '@automattic/data-stores'; - -import './styles.scss'; - -const TickIcon = ; - -const FinalStep: React.FunctionComponent< LaunchStepProps > = ( { onNextStep, onPrevStep } ) => { - const { domain, LaunchStep, isStepCompleted, isFlowCompleted, planProductId } = useSelect( - ( select ) => { - const launchStore: LaunchSelect = select( LAUNCH_STORE ); - return { - domain: launchStore.getSelectedDomain(), - LaunchStep: launchStore.getLaunchStep(), - isStepCompleted: launchStore.isStepCompleted, - isFlowCompleted: launchStore.isFlowCompleted(), - planProductId: launchStore.getSelectedPlanProductId(), - }; - }, - [] - ); - - const { __, hasTranslation } = useI18n(); - const locale = useLocale(); - - const { plan, planProduct } = useSelect( - ( select ) => ( { - plan: ( select( PLANS_STORE ) as PlansSelect ).getPlanByProductId( planProductId, locale ), - planProduct: ( select( PLANS_STORE ) as PlansSelect ).getPlanProductById( planProductId ), - } ), - [ planProductId, locale ] - ); - - const { title } = useTitle(); - const { siteSubdomain } = useSiteDomains(); - const domainSuggestion = useDomainSuggestion(); - const { domainSearch } = useDomainSearch(); - - const { setStep } = useDispatch( LAUNCH_STORE ); - - const localizeUrl = useLocalizeUrl(); - - const nameSummary = ( -
-

- { __( 'Site', 'full-site-editing' ) }: { title } -

-
- ); - - const domainSummary = ( -
- { domain?.domain_name ? ( -

- { __( 'Custom domain', 'full-site-editing' ) }: { domain.domain_name } - { planProduct?.billingPeriod === 'MONTHLY' && ( - <> -
- - { __( 'Domain Registration', 'full-site-editing' ) }:{ ' ' } - { sprintf( - // translators: %s is the price with currency. Eg: $15/year - __( '%s/year', 'full-site-editing' ), - domain.cost - ) } - - - ) } -

- ) : ( - <> -

- { __( 'Free site address', 'full-site-editing' ) }: { siteSubdomain?.domain } -

- - { domainSearch - ? createInterpolateElement( - /* translators: is the suggested custom domain name; will redirect users to domain selection step */ - __( - 'A custom site address like (now available!) is more unique and can help with your SEO ranking.', - 'full-site-editing' - ), - { - DomainName: ( - - { domainSuggestion?.domain_name || 'loading-example.com' } - - ), - Link:
- ); - - const fallbackPlanSummaryCostLabelAnnually = __( 'billed annually', 'full-site-editing' ); - // translators: %s is the cost per year (e.g "billed as 96$ annually") - const newPlanSummaryCostLabelAnnually = __( - 'per month, billed as %s annually', - 'full-site-editing' - ); - const planSummaryCostLabelAnnually = - locale === 'en' || hasTranslation?.( 'per month, billed as %s annually' ) - ? sprintf( newPlanSummaryCostLabelAnnually, planProduct?.annualPrice ) - : fallbackPlanSummaryCostLabelAnnually; - - const planSummaryCostLabelMonthly = __( 'per month, billed monthly', 'full-site-editing' ); - - const planSummary = ( -
- { plan && planProduct && ! plan.isFree ? ( - <> -

WordPress.com { plan.title }

- { __( 'Plan subscription', 'full-site-editing' ) }: { planProduct.price }{ ' ' } - { planProduct.billingPeriod === 'ANNUALLY' - ? planSummaryCostLabelAnnually - : planSummaryCostLabelMonthly } - - ) : ( - <> -

WordPress.com Free

-

{ __( 'Plan subscription: Free forever', 'full-site-editing' ) }

- - { createInterpolateElement( - sprintf( - /* translators: pressing will redirect user to plan selection step; %1$d is the number of days */ - __( - 'Upgrade to Premium to get access to 13GB storage space, payment collection options, 24/7 Live Chat support, and more. Not sure? Give it a spin—we offer %1$d-day full-refunds, guaranteed.', - 'full-site-editing' - ), - 14 - ), - { - Link:
- ); - - const handlePrev = () => { - onPrevStep?.(); - }; - - return ( - -
-
- { __( 'Launch your site', 'full-site-editing' ) } - - { __( - 'Your site will be made public and ready to share with others.', - 'full-site-editing' - ) } - -
-
-
- - - { isStepCompleted( LaunchStep.Plan ) && ( - - -

- { __( 'Included in your plan', 'full-site-editing' ) } -

-
    - { plan?.features - // Some features are only available for the - // annually-billed version of a plan - .filter( - ( feature ) => - planProduct?.billingPeriod === 'ANNUALLY' || - ! feature.requiresAnnuallyBilledPlan - ) - .map( ( feature, i ) => ( -
  • - { TickIcon } { feature.name } -
  • - ) ) } -
-

- { __( 'Questions?', 'full-site-editing' ) }{ ' ' } - -

-
-
- ) } - - setStep( LaunchStep.Name ) } - completeStepContent={ nameSummary } - stepId="name" - formStatus={ FormStatus.READY } - /> - setStep( LaunchStep.Domain ) } - completeStepContent={ domainSummary } - stepId="domain" - formStatus={ FormStatus.READY } - /> - setStep( LaunchStep.Plan ) } - completeStepContent={ planSummary } - stepId="plan" - formStatus={ FormStatus.READY } - /> - - - - -
-
-
-
- - - -
-
- ); -}; - -export default FinalStep; diff --git a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-steps/final-step/styles.scss b/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-steps/final-step/styles.scss deleted file mode 100644 index b4848dcbdf50a..0000000000000 --- a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-steps/final-step/styles.scss +++ /dev/null @@ -1,92 +0,0 @@ -@import "@automattic/typography/styles/variables"; -@import "@automattic/onboarding/styles/mixins"; - -// TODO: This is former dark-gray-500 from @wordpress/base-styles. -// Replace with a color from the standard palette. -$nux-text-color: #555d66; - -.nux-launch__feature-list { - padding: 20px; - - p { - margin: 10px 0 0; - } -} -.nux-launch__feature-list-title { - margin: 0 0 10px; - color: $nux-text-color; - font-weight: 400; -} -ul.nux-launch__feature-item-group { - margin: 0; -} -.nux-launch__feature-item { - font-size: $font-body-small; - line-height: 20px; - letter-spacing: 0.2px; - margin: 4px 0; - vertical-align: middle; - color: $nux-text-color; - display: flex; - align-items: flex-start; - - svg { - display: block; - margin-right: 6px; - margin-top: 2px; - flex-shrink: 0; - } - - // the tick - svg path { - fill: var(--studio-green-40); - stroke: var(--studio-green-40); - } -} -.nux-launch__submit-button.components-button.is-primary { - background: var(--color-accent); - border: 1px solid var(--color-accent-dark); - width: 100%; - justify-content: center; - - &:hover, - &:active { - background: var(--color-accent-dark); - } - - &:disabled { - color: $white; - opacity: 0.5; - - &:hover { - background: var(--color-accent); - } - } -} - -.nux-launch__summary-item { - p { - margin: 0; - word-break: break-word; - } - .components-tip { - margin-top: 10px; - - svg { - align-self: flex-start; - } - } - &__plan-name { - color: var(--color-text); - } - &__domain-name { - font-weight: 600; - - &.is-loading { - @include onboarding-placeholder(); - } - } - &__domain-price { - font-size: $font-body-small; - } -} diff --git a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-steps/name-step/index.tsx b/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-steps/name-step/index.tsx deleted file mode 100644 index cea690dd2007c..0000000000000 --- a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-steps/name-step/index.tsx +++ /dev/null @@ -1,61 +0,0 @@ -import { useTitle } from '@automattic/launch'; -import { Title, SubTitle, ActionButtons, BackButton, NextButton } from '@automattic/onboarding'; -import { TextControl, Tip } from '@wordpress/components'; -import { __ } from '@wordpress/i18n'; -import * as React from 'react'; -import LaunchStepContainer, { Props as LaunchStepProps } from '../../launch-step'; - -import './styles.scss'; - -const NameStep: React.FunctionComponent< LaunchStepProps > = ( { onPrevStep, onNextStep } ) => { - const { title, updateTitle } = useTitle(); - - const handleNext = () => { - onNextStep?.(); - }; - - const handlePrev = () => { - onPrevStep?.(); - }; - - return ( - -
-
- { __( 'Name your site', 'full-site-editing' ) } - { __( 'Pick a name for your site.', 'full-site-editing' ) } -
- - - -
-
-
- -
- - { /* translators: The "it" here refers to the site title. */ } - { __( "Don't worry, you can change it later.", 'full-site-editing' ) } -
- -
-
- - - - -
-
- ); -}; - -export default NameStep; diff --git a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-steps/name-step/styles.scss b/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-steps/name-step/styles.scss deleted file mode 100644 index f745c9a537eea..0000000000000 --- a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-steps/name-step/styles.scss +++ /dev/null @@ -1,42 +0,0 @@ -@import "@automattic/onboarding/styles/variables"; - -.nux-launch-step__input { - position: relative; - margin-bottom: 20px; - - input[type="text"].components-text-control__input { - padding: 6px 40px 6px 16px; - height: 38px; - background: $gray-100; - border: none; - - &::placeholder { - color: var(--studio-black); - } - - &:focus { - box-shadow: 0 0 0 2px var(--studio-blue-30); - background: var(--studio-white); - } - } - - svg { - position: absolute; - top: 6px; - right: 8px; - } -} - -.nux-launch-step__input-hint { - display: flex; - align-items: center; - color: var(--studio-gray-50); - font-family: $default-font; - /* stylelint-disable-next-line declaration-property-unit-allowed-list */ - font-size: 14px; - line-height: 14px; - - & > .components-tip svg { - margin-right: 10px; - } -} diff --git a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-steps/plan-step/index.tsx b/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-steps/plan-step/index.tsx deleted file mode 100644 index baad84195aa18..0000000000000 --- a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-steps/plan-step/index.tsx +++ /dev/null @@ -1,86 +0,0 @@ -import { useSite } from '@automattic/launch'; -import { Title, SubTitle, ActionButtons, BackButton } from '@automattic/onboarding'; -import PlansGrid from '@automattic/plans-grid'; -import { useSelect, useDispatch } from '@wordpress/data'; -import { __, sprintf } from '@wordpress/i18n'; -import * as React from 'react'; -import LaunchStepContainer, { Props as LaunchStepProps } from '../../launch-step'; -import { LAUNCH_STORE } from '../../stores'; -import type { LaunchSelect } from '@automattic/data-stores'; - -import './styles.scss'; - -const PlanStep: React.FunctionComponent< LaunchStepProps > = ( { onPrevStep, onNextStep } ) => { - const { domain, LaunchStep, selectedPlanProductId } = useSelect( ( select ) => { - const launchStore: LaunchSelect = select( LAUNCH_STORE ); - return { - domain: launchStore.getSelectedDomain(), - LaunchStep: launchStore.getLaunchStep(), - selectedPlanProductId: launchStore.getSelectedPlanProductId(), - }; - }, [] ); - - const { setPlanProductId, setStep } = useDispatch( LAUNCH_STORE ); - - const { selectedFeatures } = useSite(); - - const hasPaidDomain = domain && ! domain.is_free; - - const handleSelect = ( planProductId: number | undefined ) => { - setPlanProductId( planProductId ); - onNextStep?.(); - }; - - const handlePrev = () => { - onPrevStep?.(); - }; - - const handlePickDomain = () => { - setStep( LaunchStep.Domain ); - }; - - return ( - -
-
- { __( 'Select a plan', 'full-site-editing' ) } - - { sprintf( - /* translators: number of days */ - __( - 'Pick a plan that’s right for you. Switch plans as your needs change. There’s no risk, you can cancel for a full refund within %1$d days.', - 'full-site-editing' - ), - 14 - ) } - -
-
-
- -
-
- - - -
-
- ); -}; - -export default PlanStep; diff --git a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-steps/plan-step/styles.scss b/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-steps/plan-step/styles.scss deleted file mode 100644 index fc42fb5232815..0000000000000 --- a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-steps/plan-step/styles.scss +++ /dev/null @@ -1,20 +0,0 @@ -@import "@automattic/onboarding/styles/mixins"; -@import "@automattic/plans-grid/src/variables"; - -.nux-launch-modal.step-plan { - // Remove extraneous whitespace after plans details. - .nux-launch-step__body, - .plans-grid { - margin-bottom: 0; - } - - .plans-grid__details-container { - position: relative; - @include onboarding-block-edge2edge-container; - - @media ( min-width: $plans-grid-max-page-width ) { - margin-left: 0; - margin-right: 0; - } - } -} diff --git a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch/index.tsx b/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch/index.tsx deleted file mode 100644 index 6873521232977..0000000000000 --- a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch/index.tsx +++ /dev/null @@ -1,74 +0,0 @@ -import { useSelect, useDispatch } from '@wordpress/data'; -import * as React from 'react'; -import DomainStep from '../launch-steps/domain-step'; -import FinalStep from '../launch-steps/final-step'; -import NameStep from '../launch-steps/name-step'; -import PlanStep from '../launch-steps/plan-step'; -import { LAUNCH_STORE } from '../stores'; -import type { LaunchSelect } from '@automattic/data-stores'; - -interface Props { - onSubmit?: () => void; -} - -const Launch: React.FunctionComponent< Props > = ( { onSubmit } ) => { - const { step: currentStep } = useSelect( - ( select ) => ( select( LAUNCH_STORE ) as LaunchSelect ).getState(), - [] - ); - const LaunchStep = useSelect( - ( select ) => ( select( LAUNCH_STORE ) as LaunchSelect ).getLaunchStep(), - [] - ); - const LaunchSequence = useSelect( - ( select ) => ( select( LAUNCH_STORE ) as LaunchSelect ).getLaunchSequence(), - [] - ); - const firstIncompleteStep = useSelect( - ( select ) => ( select( LAUNCH_STORE ) as LaunchSelect ).getFirstIncompleteStep(), - [] - ); - - const { setStep, setSidebarFullscreen, unsetSidebarFullscreen } = useDispatch( LAUNCH_STORE ); - - const LaunchStepComponents = { - [ LaunchStep.Name ]: NameStep, - [ LaunchStep.Domain ]: DomainStep, - [ LaunchStep.Plan ]: PlanStep, - [ LaunchStep.Final ]: FinalStep, - }; - - const currentSequence = LaunchSequence.indexOf( currentStep ); - - const handlePrevStep = () => { - let prevSequence = currentSequence - 1; - if ( prevSequence < 0 ) { - prevSequence = 0; - setSidebarFullscreen(); - } - setStep( LaunchSequence[ prevSequence ] ); - }; - - const handleNextStep = () => { - const nextSequence = currentSequence + 1; - const maxSequence = LaunchSequence.length - 1; - if ( nextSequence > maxSequence ) { - onSubmit?.(); - } - unsetSidebarFullscreen(); - setStep( LaunchSequence[ nextSequence ] ); - }; - - const CurrentLaunchStep = LaunchStepComponents[ currentStep ]; - - React.useEffect( () => { - if ( firstIncompleteStep && firstIncompleteStep !== LaunchStep.Name ) { - setStep( firstIncompleteStep ); - } - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [] ); - - return ; -}; - -export default Launch; diff --git a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/stores/index.ts b/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/stores/index.ts deleted file mode 100644 index 701f61b138152..0000000000000 --- a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/stores/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -import 'a8c-fse-common-data-stores'; - -export const SITE_STORE = 'automattic/site'; -export const LAUNCH_STORE = 'automattic/launch'; -export const PLANS_STORE = 'automattic/onboard/plans'; -export const DOMAINS_STORE = 'automattic/domains/suggestions'; diff --git a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/utils.ts b/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/utils.ts deleted file mode 100644 index e3a1bab05a85e..0000000000000 --- a/apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/utils.ts +++ /dev/null @@ -1,73 +0,0 @@ -import { doAction, hasAction } from '@wordpress/hooks'; -import { addQueryArgs } from '@wordpress/url'; -import { FOCUSED_LAUNCH_FLOW, IMMEDIATE_LAUNCH_QUERY_ARG } from './constants'; - -// When running in Calypso, currentCalypsoUrl is used. -// When running in WP-Admin, window.location.href is used. -export const getCurrentLaunchFlowUrl = (): string => - window?.calypsoifyGutenberg?.currentCalypsoUrl ?? window.location.href; - -export const redirectParentWindow = ( url: string ): void => { - ( window.top as Window ).location.href = url; -}; - -export const redirectToWpcomPath = ( url: string ): void => { - let origin = 'https://wordpress.com'; - - try { - origin = new URL( window?.calypsoifyGutenberg?.currentCalypsoUrl || '' ).origin; - } catch { - // do nothing, since origin already has a fallback value - } - - const path = url.startsWith( '/' ) ? url : `/${ url }`; - redirectParentWindow( `${ origin }${ path }` ); -}; - -/** - * Opens the checkout. - * - * If possible, the checkout is opened as a modal without a page redirect (for Focused Launch). - * Otherwise, as a fallback, the user is redirected to the /checkout page or the /home page - * (in this case, `siteSlug` and `isEcommerce` params are used to construct the redirect url) - * - * IMPORTANT NOTE: onSuccessCallback will not be called for redirect payment - * methods like PayPal. They will redirect directly to the post-checkout page - * decided by `getThankYouUrl`. - * - * @param siteSlug The slug (id) of the current site. - * @param isEcommerce True if the eCommerce plan is going to be in the checkout. - * @param onSuccessCallback Called when the checkout opens as a modal and is completed successfully. Not called for redirect payment methods. - */ -export const openCheckout = ( - siteSlug = window._currentSiteId.toString(), - isEcommerce = false, - onSuccessCallback?: () => void -): void => { - const HOOK_OPEN_CHECKOUT_MODAL = 'a8c.wpcom-block-editor.openCheckoutModal'; - const isFocusedLaunchFlow = window?.wpcomEditorSiteLaunch?.launchFlow === FOCUSED_LAUNCH_FLOW; - const urlWithoutArgs = getCurrentLaunchFlowUrl().split( '?' )[ 0 ]; - - // Use Checkout Modal as a progressive enhancement if: - // - we are in Calypso, within the iframed editor where HOOK_OPEN_CHECKOUT_MODAL exists - // - we are in Focused Launch flow - // - selected plan is not eCommerce - if ( hasAction( HOOK_OPEN_CHECKOUT_MODAL ) && isFocusedLaunchFlow && ! isEcommerce ) { - // open Checkout Modal without passing cartData, assuming the cart is already updated - doAction( HOOK_OPEN_CHECKOUT_MODAL, { - checkoutOnSuccessCallback: onSuccessCallback, - isFocusedLaunch: true, - redirectTo: addQueryArgs( urlWithoutArgs, { - [ IMMEDIATE_LAUNCH_QUERY_ARG ]: true, - } ), - } ); - return; - } - - // fallback: redirect to /checkout page - const checkoutUrl = addQueryArgs( `/checkout/${ siteSlug }`, { - // Redirect to My Home after checkout only if the selected plan is not eCommerce - ...( ! isEcommerce && { redirect_to: `/home/${ siteSlug }` } ), - } ); - redirectToWpcomPath( checkoutUrl ); -}; diff --git a/apps/editing-toolkit/package.json b/apps/editing-toolkit/package.json index f24f40e129478..3f3db173c9b2b 100644 --- a/apps/editing-toolkit/package.json +++ b/apps/editing-toolkit/package.json @@ -53,7 +53,6 @@ "@automattic/components": "workspace:^", "@automattic/composite-checkout": "workspace:^", "@automattic/data-stores": "workspace:^", - "@automattic/domain-picker": "workspace:^", "@automattic/format-currency": "workspace:^", "@automattic/happychat-connection": "workspace:^", "@automattic/help-center": "workspace:^", diff --git a/apps/editing-toolkit/tsconfig.json b/apps/editing-toolkit/tsconfig.json index 3effc384e76b9..5427872baae3e 100644 --- a/apps/editing-toolkit/tsconfig.json +++ b/apps/editing-toolkit/tsconfig.json @@ -37,7 +37,6 @@ { "path": "../../packages/calypso-analytics" }, { "path": "../../packages/composite-checkout" }, { "path": "../../packages/data-stores" }, - { "path": "../../packages/domain-picker" }, { "path": "../../packages/happychat-connection" }, { "path": "../../packages/help-center" }, { "path": "../../packages/i18n-utils" }, diff --git a/apps/editing-toolkit/typings/index.d.ts b/apps/editing-toolkit/typings/index.d.ts index bc7ccf6e9bd39..c77933e89d651 100644 --- a/apps/editing-toolkit/typings/index.d.ts +++ b/apps/editing-toolkit/typings/index.d.ts @@ -10,14 +10,6 @@ declare module '*.svg' { declare global { interface Window { - wpcomEditorSiteLaunch?: { - launchFlow: string; - // property does not exist when not isGutenboarding - // property holds the value '1' when isGutenboarding - isGutenboarding?: '1'; - anchorFmPodcastId?: string; - locale?: string; - }; _currentSiteId: number; calypsoifyGutenberg?: { isGutenboarding?: boolean; diff --git a/yarn.lock b/yarn.lock index 48645dcc5caa3..a4d939689a1b7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1837,7 +1837,6 @@ __metadata: "@automattic/components": "workspace:^" "@automattic/composite-checkout": "workspace:^" "@automattic/data-stores": "workspace:^" - "@automattic/domain-picker": "workspace:^" "@automattic/format-currency": "workspace:^" "@automattic/happychat-connection": "workspace:^" "@automattic/help-center": "workspace:^"