.
4 | *
5 | * `sumamry` is a string or children to show inside the accordion next to the collapse.
6 | * `classname` is passed to the top-level details element.
7 | * `children` is put inside the accordion.
8 | * `isOpen` is a boolean to set the default state for the accordion.
9 | *
10 | * @param {object} props
11 | * @returns WPComponent
12 | */
13 | const Accordion = ({ summary, className, children, isOpen = false }) => {
14 | return (
15 |
19 |
20 | {summary}
21 |
22 | {children}
23 |
24 | );
25 | };
26 |
27 | export default Accordion;
28 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Accordion/stylesheet.scss:
--------------------------------------------------------------------------------
1 | .nfd-onboarding-accordion {
2 | border: $border-width solid var(--nfd-onboarding-contrast);
3 | margin-bottom: $grid-unit-05;
4 | margin-top: $grid-unit-05;
5 | opacity: 0.8;
6 | padding: $border-width;
7 | transition: opacity 233ms ease;
8 |
9 | @include reduce-motion("transition");
10 |
11 | &:hover,
12 | &:focus,
13 | &[open] {
14 | opacity: 1;
15 | }
16 |
17 | &__summary {
18 | background-color: var(--nfd-onboarding-base);
19 | color: var(--nfd-onboarding-contrast);
20 | cursor: pointer;
21 | font-weight: 700;
22 | padding: $grid-unit-05 $grid-unit-10;
23 |
24 | p {
25 | display: inline;
26 | }
27 | }
28 |
29 | &__content {
30 | margin: 0 $grid-unit-20;
31 | padding: $grid-unit-10 0;
32 | color: var(--nfd-onboarding-contrast);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/AdminBar/stylesheet.scss:
--------------------------------------------------------------------------------
1 | $light-grey : #a0a5aa;
2 |
3 | .nfd-onboarding-header {
4 |
5 | &__admin-bar {
6 | height: 32px;
7 | background-color: var(--nfd-onboarding-admin-bar-background);
8 | width: 100%;
9 | color: var(--nfd-onboarding-admin-bar-color);
10 | font-size: 13px;
11 | font-weight: 400;
12 | margin: 0;
13 | padding: 5px 7px;
14 | display: flex;
15 | justify-content: space-between;
16 | align-items: center;
17 | box-sizing: border-box;
18 |
19 | &__wplogo {
20 | display: flex;
21 | align-items: center;
22 |
23 | span {
24 | margin-left: 7px;
25 |
26 | &:first-of-type {
27 | color: $light-grey;
28 | margin-left: 0;
29 | }
30 | }
31 | }
32 |
33 | &__profile {
34 | display: flex;
35 | align-items: center;
36 | margin-right: 2.5px;
37 |
38 | &__greeting {
39 | margin-right: 6px;
40 | }
41 |
42 | &__avatar {
43 | height: 16px;
44 | width: 16px;
45 | display: inline-block;
46 |
47 | img {
48 | border: 1px solid #8c8f94;
49 | width: 100%;
50 | height: 100%;
51 | object-fit: contain;
52 | }
53 | }
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/App/index.js:
--------------------------------------------------------------------------------
1 | // WordPress
2 | import { FullscreenMode } from '@wordpress/interface';
3 | import { SlotFillProvider } from '@wordpress/components';
4 | import { Fragment } from '@wordpress/element';
5 |
6 | // Components
7 | import { FlowStateHandler } from '../StateHandlers';
8 |
9 | const App = () => {
10 | return (
11 |
12 |
13 |
14 |
15 |
16 |
17 | );
18 | };
19 | export default App;
20 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Button/ButtonDark/index.js:
--------------------------------------------------------------------------------
1 | import { Button } from '@wordpress/components';
2 | import classNames from 'classnames';
3 |
4 | const ButtonDark = ( { children, onClick } ) => {
5 | return (
6 |
12 | );
13 | };
14 |
15 | export default ButtonDark;
16 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Button/ButtonDark/stylesheet.scss:
--------------------------------------------------------------------------------
1 | .nfd-onboarding-button {
2 |
3 | &--dark {
4 | background-color: var(--nfd-onboarding-navigation-back-background);
5 | height: 36px;
6 | color: var(--nfd-onboarding-primary);
7 | border-radius: 8px;
8 | padding: 0, 13px, 0 13px;
9 |
10 | &:hover {
11 | background-color: #fff;
12 | color: #272d30;
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Button/ButtonNext/stylesheet.scss:
--------------------------------------------------------------------------------
1 | .nfd-onboarding-button {
2 |
3 | &--next {
4 | background-color: var(--nfd-onboarding-primary);
5 | color: var(--nfd-onboarding-secondary);
6 | width: 80px;
7 | height: 50px;
8 | font-size: clamp(0.5rem, 0.3864rem + 0.5682vw, 1.75rem);
9 | border-radius: 8px;
10 | padding: 16px;
11 |
12 | &--disabled {
13 | background-color: rgba(var(--nfd-onboarding-primary-rgb), 0.4);
14 |
15 | &:hover {
16 | cursor: not-allowed;
17 | color: var(--nfd-onboarding-secondary);
18 | }
19 | }
20 |
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Button/ButtonWhite/index.js:
--------------------------------------------------------------------------------
1 | import { Button } from '@wordpress/components';
2 | import { Icon } from '@wordpress/icons';
3 | import classNames from 'classnames';
4 |
5 | const ButtonWhite = ( { className, text, onClick, icon } ) => {
6 | return (
7 |
19 | );
20 | };
21 |
22 | export default ButtonWhite;
23 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Button/ButtonWhite/stylesheet.scss:
--------------------------------------------------------------------------------
1 |
2 | .nfd-onboarding-button {
3 |
4 | &--white {
5 | justify-content: center;
6 | align-items: center;
7 | width: 100%;
8 | background: var(--nfd-onboarding-white);
9 | color: var(--wp-admin-theme-color);
10 | border: 1px solid var(--wp-admin-theme-color);
11 | height: 40px;
12 | border-radius: 2px;
13 | margin: 10px 0;
14 |
15 | &:hover {
16 | color: var(--wp-admin-theme-color-darker-20);
17 | border: 1px solid var(--wp-admin-theme-color-darker-20);
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Button/ButtonWithBackground/index.js:
--------------------------------------------------------------------------------
1 | import { Button } from '@wordpress/components';
2 | import classNames from 'classnames';
3 |
4 | const ButtonWithBackground = ( { className, text, onClick = false } ) => {
5 | return (
6 |
16 | );
17 | };
18 |
19 | export default ButtonWithBackground;
20 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Button/ButtonWithBackground/stylesheet.scss:
--------------------------------------------------------------------------------
1 |
2 | .nfd-onboarding-button {
3 |
4 | &--background {
5 | justify-content: center;
6 | align-items: center;
7 | width: 100%;
8 | color: var(--nfd-onboarding-white);
9 | height: 40px;
10 | border: none;
11 | margin: 10px 0;
12 | white-space: normal !important;
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Button/NavCardButton/stylesheet.scss:
--------------------------------------------------------------------------------
1 | .nfd-nav-card-button {
2 | display: flex;
3 | justify-content: center;
4 | align-items: center;
5 | color: var(--nfd-onboarding-white);
6 | background-color: var(--wp-admin-theme-color-darker-10);
7 | padding: 16px;
8 | width: 90%;
9 | font-size: clamp(1rem, 0.91rem + 0.43vw, 2rem);
10 | font-weight: 500;
11 | border-radius: 4px;
12 | border: none;
13 | outline: 1px solid transparent;
14 |
15 | &__icon {
16 | fill: var(--nfd-onboarding-white);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Button/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Common Button Component
3 | * Different variants can be added later based on our requirements
4 | *
5 | * @return Button
6 | */
7 |
8 | const Button = ( { children, handleClick, disabled, className } ) => {
9 | const handleBtnClick = () => {
10 | if ( typeof handleClick === 'function' ) {
11 | handleClick();
12 | }
13 | };
14 |
15 | return (
16 |
24 | );
25 | };
26 |
27 | export default Button;
28 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Button/stylesheet.scss:
--------------------------------------------------------------------------------
1 | @import "./ButtonWithBackground/stylesheet";
2 | @import "./ButtonWhite/stylesheet";
3 |
4 | .nfd-card-button {
5 | cursor: pointer;
6 |
7 | &:disabled {
8 | cursor: default;
9 | opacity: 0.3;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/CardHeader/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Common Heading Component for Card Header
3 | * Includes one heading, one sub-heading and one question
4 | * More text types can be added later based on requirements
5 | *
6 | * @return CardHeader
7 | */
8 |
9 | import { memo } from '@wordpress/element';
10 |
11 | const CardHeader = ( { heading, subHeading, question } ) => {
12 | return (
13 |
14 | { heading && (
15 |
{ heading }
16 | ) }
17 |
18 | { subHeading && (
19 |
26 | { subHeading }
27 |
28 | ) }
29 |
30 | { question && (
31 | { question }
32 | ) }
33 |
34 | );
35 | };
36 |
37 | export default memo( CardHeader );
38 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/CardHeader/stylesheet.scss:
--------------------------------------------------------------------------------
1 | .nfd-step-card-heading {
2 | margin: 5px;
3 | font-weight: 700;
4 | line-height: 1.25;
5 | text-align: center;
6 | font-size: clamp(1rem, 0.81rem + 0.92vw, 3.125rem);
7 | }
8 |
9 | .nfd-step-card-subheading {
10 | margin: 5px;
11 | font-weight: 700;
12 | color: var(--wp-admin-theme-color);
13 | font-size: clamp(1rem, 0.91rem + 0.43vw, 2rem);
14 | text-align: center;
15 | line-height: 1;
16 | }
17 |
18 | .nfd-step-card-subheading-other {
19 | font-weight: 700;
20 | margin-top: 35px;
21 | color: var(--wp-admin-theme-color);
22 | font-size: clamp(1rem, 0.93rem + 0.32vw, 1.75rem);
23 | }
24 |
25 | .nfd-step-card-question {
26 | margin: 18px;
27 | font-size: clamp(1.3125rem, 1.2rem + 0.5vw, 2.5rem);
28 | line-height: 1.2;
29 | }
30 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/CardWithOptions/index.js:
--------------------------------------------------------------------------------
1 | import { memo } from '@wordpress/element';
2 | import OptionWithHeadingSubHeading from '../OptionWithHeadingSubHeading';
3 |
4 | const CardWithOptions = ( { title, options, selection, callback } ) => {
5 | const buildCardOptions = () => {
6 | return options.map( ( data, idx ) => {
7 | return (
8 |
16 | );
17 | } );
18 | };
19 |
20 | return (
21 |
22 |
{ title }
23 |
{ buildCardOptions() }
24 |
25 | );
26 | };
27 |
28 | export default memo( CardWithOptions );
29 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/CardWithOptions/stylesheet.scss:
--------------------------------------------------------------------------------
1 | $background-color: var(--nfd-onboarding-card-background);
2 |
3 | .nfd-sg-card {
4 |
5 | margin: 8px;
6 | max-width: 90vw;
7 | padding: 24px 16px;
8 | border-radius: 12px;
9 | background-color: $background-color;
10 | width: clamp(18.75rem, 22.6136rem + 5.6818vw, 31.25rem);
11 | box-shadow: 3px 3px 5px rgba(var(--nfd-onboarding-primary-rgb), $alpha: 0.05);
12 |
13 | @media (max-width: #{ ($break-large) }) {
14 | margin: 12px;
15 | padding: 12px 6px;
16 | }
17 |
18 | &__title {
19 | color: var(--nfd-onboarding-primary);
20 | margin: 16px;
21 | line-height: 1.5;
22 | font-size: 18px;
23 | text-align: center;
24 | margin-bottom: 30px;
25 | font-weight: 400;
26 | letter-spacing: 1.5;
27 | }
28 |
29 | &__data {
30 | margin: 12px;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/CheckboxTemplate/CheckboxList/stylesheet.scss:
--------------------------------------------------------------------------------
1 | .checkbox-list {
2 | display: flex;
3 | justify-content: center;
4 | align-items: flex-start;
5 |
6 | @media (max-width: #{ ($break-medium) }) {
7 | flex-direction: column;
8 | justify-content: center;
9 | align-items: center;
10 | }
11 |
12 | &-col {
13 | display: flex;
14 | align-items: center;
15 | flex-direction: column;
16 | justify-content: center;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/CheckboxTemplate/CheckboxListSkeleton/stylesheet.scss:
--------------------------------------------------------------------------------
1 | .checkbox-skeleton-item {
2 | height: 45px;
3 | margin: 12px;
4 | padding: 16px;
5 | margin-top: 16px;
6 | border: 0.5px solid var(--nfd-onboarding-light-gray-6);
7 | cursor: not-allowed;
8 | width: clamp(15rem, 25vw, 35rem);
9 | box-shadow: 0 2px 8px 2px rgba(204, 204, 204, 0.175295);
10 | background: var(--nfd-onboarding-light-gray-7);
11 | background-repeat: no-repeat;
12 | background-image: linear-gradient(to right, var(--nfd-onboarding-light-gray-7) 0%, var(--nfd-onboarding-light-gray) 20%, var(--nfd-onboarding-light-gray-7) 40%, var(--nfd-onboarding-light-gray-7) 100%);
13 | }
14 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/CheckboxTemplate/index.js:
--------------------------------------------------------------------------------
1 | export { default as CheckboxItem } from './CheckboxItem';
2 | export { default as CheckboxList } from './CheckboxList';
3 | export { default as CheckboxListSkeleton } from './CheckboxListSkeleton';
4 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/ComingSoon/contents.js:
--------------------------------------------------------------------------------
1 | import { __, sprintf } from '@wordpress/i18n';
2 |
3 | import { translations } from '../../utils/locales/translations';
4 |
5 | const getContents = () => {
6 | return {
7 | title: __( 'Coming Soon', 'wp-module-onboarding' ),
8 | subtitle: sprintf(
9 | /* translators: %s: site or store */
10 | __(
11 | 'Keep your %s private until you click launch',
12 | 'wp-module-onboarding'
13 | ),
14 | translations( 'site' )
15 | ),
16 | desc: sprintf(
17 | /* translators: %s: site or store */
18 | __(
19 | "We'll show a placeholder page to logged-out visitors while you build your %s.",
20 | 'wp-module-onboarding'
21 | ),
22 | translations( 'site' )
23 | ),
24 | };
25 | };
26 |
27 | export default getContents;
28 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/ComingSoon/stylesheet.scss:
--------------------------------------------------------------------------------
1 | .coming_soon {
2 |
3 | &__wrapper {
4 | width: 100%;
5 | display: flex;
6 | justify-content: center;
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Content/index.js:
--------------------------------------------------------------------------------
1 | import { Route, Routes } from 'react-router-dom';
2 | import { Fragment, memo, Suspense, useCallback } from '@wordpress/element';
3 | import { useSelect } from '@wordpress/data';
4 |
5 | import { store as nfdOnboardingStore } from '../../store';
6 |
7 | /**
8 | * Primary content area within the .
9 | *
10 | * @return WPComponent
11 | */
12 |
13 | const Content = () => {
14 | const { routes } = useSelect( ( select ) => {
15 | return {
16 | routes: select( nfdOnboardingStore ).getRoutes(),
17 | };
18 | } );
19 |
20 | const getMappedPages = useCallback( () => {
21 | return routes?.map( ( route ) => (
22 | }
27 | />
28 | ) );
29 | }, [ routes ] );
30 |
31 | return (
32 |
33 | }>
34 | { getMappedPages( routes ) }
35 |
36 |
37 | );
38 | };
39 |
40 | const ContentMemo = memo( Content );
41 | export default ContentMemo;
42 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Content/stylesheet.scss:
--------------------------------------------------------------------------------
1 | .interface-interface-skeleton__content {
2 | background-color: var(--nfd-onboarding-content-base);
3 | color: var(--nfd-onboarding-content-contrast);
4 | }
5 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Drawer/DrawerPanel/DesignHomepageMenu.js:
--------------------------------------------------------------------------------
1 | import { __ } from '@wordpress/i18n';
2 |
3 | const DesignHomepageMenu = () => {
4 | return (
5 |
6 |
{__('Pick a Homepage Design', 'wp-module-onboarding')}
7 |
8 | {__(
9 | 'Panel will show a few Homepage Patterns.',
10 | 'wp-module-onboarding'
11 | )}
12 |
13 |
14 | );
15 | };
16 |
17 | export default DesignHomepageMenu;
18 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Drawer/DrawerPanel/DesignThemeStylesMenu.js:
--------------------------------------------------------------------------------
1 | import { __ } from '@wordpress/i18n';
2 |
3 | const DesignThemeStylesMenu = () => {
4 | return (
5 |
6 |
{ __( 'Pick a Theme Style', 'wp-module-onboarding' ) }
7 |
{ __( 'No Style Selected', 'wp-module-onboarding' ) }
8 |
9 | { __(
10 | 'Panel will show Theme details',
11 | 'wp-module-onboarding'
12 | ) }
13 |
14 |
{ __( 'With Style Selected', 'wp-module-onboarding' ) }
15 |
16 | { __(
17 | 'Panel will show single-column of other Styles.',
18 | 'wp-module-onboarding'
19 | ) }
20 |
21 |
22 | );
23 | };
24 |
25 | export default DesignThemeStylesMenu;
26 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Drawer/DrawerPanel/DesignThemes.js:
--------------------------------------------------------------------------------
1 | import { __ } from '@wordpress/i18n';
2 |
3 | const DesignThemes = () => {
4 | return (
5 |
6 |
{__('Pick a Theme', 'wp-module-onboarding')}
7 |
{__('No Theme Selected', 'wp-module-onboarding')}
8 |
9 | {__('Panel will show contextual help', 'wp-module-onboarding')}
10 |
11 |
{__('With Theme Selected', 'wp-module-onboarding')}
12 |
13 | {__(
14 | 'Panel will show single-column of other Themes.',
15 | 'wp-module-onboarding'
16 | )}
17 |
18 |
19 | );
20 | };
21 |
22 | export default DesignThemes;
23 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Drawer/DrawerPanel/NavPage.js:
--------------------------------------------------------------------------------
1 | import { chevronLeft } from '@wordpress/icons';
2 |
3 | import { Button } from '@wordpress/components';
4 | import { VIEW_NAV_PRIMARY } from '../../../../constants';
5 | import { __ } from '@wordpress/i18n';
6 | import { store as nfdOnboardingStore } from '../../../store';
7 | import { useDispatch } from '@wordpress/data';
8 | import Animate from '../../Animate';
9 |
10 | const NavPage = () => {
11 | const { setDrawerActiveView } = useDispatch( nfdOnboardingStore );
12 |
13 | return (
14 |
15 |
23 |
24 | );
25 | };
26 |
27 | export default NavPage;
28 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Drawer/DrawerPanel/WithDesignBack.js:
--------------------------------------------------------------------------------
1 | import { Button } from '@wordpress/components';
2 | import { __ } from '@wordpress/i18n';
3 | import { chevronLeft } from '@wordpress/icons';
4 | import { useDispatch } from '@wordpress/data';
5 |
6 | import { store as nfdOnboardingStore } from '../../../store';
7 | import { VIEW_NAV_DESIGN } from '../../../../constants';
8 | import Animate from '../../Animate';
9 |
10 | const WithDesignBack = ( { children } ) => {
11 | const { setDrawerActiveView } = useDispatch( nfdOnboardingStore );
12 |
13 | return (
14 |
15 |
23 | { children }
24 |
25 | );
26 | };
27 |
28 | export default WithDesignBack;
29 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Drawer/index.js:
--------------------------------------------------------------------------------
1 | import { useDispatch } from '@wordpress/data';
2 | import { useViewportMatch } from '@wordpress/compose';
3 | import { Fragment, useEffect, memo } from '@wordpress/element';
4 |
5 | import DrawerPanel from './DrawerPanel';
6 | import DrawerToggle from './DrawerToggle';
7 | import { store as nfdOnboardingStore } from '../../store';
8 |
9 | /**
10 | * Off-canvas drawer to left of viewport.
11 | *
12 | * @param {*} param0
13 | * @return
14 | */
15 | const Drawer = ( { isDefaultOpen = false } ) => {
16 | const isDesktopViewport = useViewportMatch( 'medium' );
17 | const { setIsDrawerOpened } = useDispatch( nfdOnboardingStore );
18 |
19 | useEffect( () => {
20 | setIsDrawerOpened( isDefaultOpen && isDesktopViewport );
21 | }, [ isDefaultOpen, isDesktopViewport, setIsDrawerOpened ] );
22 |
23 | return (
24 |
25 |
26 |
27 |
28 | );
29 | };
30 |
31 | export default memo( Drawer );
32 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/ErrorModal/stylesheet.scss:
--------------------------------------------------------------------------------
1 | .components-modal__frame {
2 | max-width: 40%;
3 |
4 | @media (max-width: #{ ($break-medium) }) {
5 | max-width: 100%;
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/ErrorState/Step/index.js:
--------------------------------------------------------------------------------
1 | import CommonLayout from '../../Layouts/Common';
2 | import HeadingWithSubHeading from '../../Heading/HeadingWithSubHeading';
3 | import NeedHelpTag from '../../NeedHelpTag';
4 |
5 | const StepErrorState = ( { title, subtitle, error } ) => {
6 | return (
7 |
8 |
9 |
10 | { error }
11 |
12 |
13 | );
14 | };
15 |
16 | export default StepErrorState;
17 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/ErrorState/Step/stylesheet.scss:
--------------------------------------------------------------------------------
1 | .step-error-state {
2 | justify-content: center;
3 |
4 | &__logo {
5 | background-image: var(--nfd-onboarding-step-error-icon);
6 | background-size: contain;
7 | background-repeat: no-repeat;
8 | background-position: center;
9 | width: 50vw;
10 | height: 400px;
11 |
12 | @media (max-width: #{($break-medium)}) {
13 | width: 100vw;
14 | height: 30vh;
15 | }
16 | }
17 |
18 | &__error {
19 | padding: 0;
20 | margin-bottom: 20px;
21 | font-weight: 400;
22 | text-align: center;
23 | font-size: clamp(0.85rem, 3.2vw, 1.7rem);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/ErrorState/index.js:
--------------------------------------------------------------------------------
1 | export { default as StepErrorState } from './Step';
2 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/ErrorState/stylesheet.scss:
--------------------------------------------------------------------------------
1 | @import "./Step/stylesheet";
2 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/ExitToWordPress/stylesheet.scss:
--------------------------------------------------------------------------------
1 | .nfd-onboarding-etw__buttons {
2 | display: flex;
3 | margin-top: $grid-unit-30;
4 | column-gap: $grid-unit-20;
5 | .components-button {
6 | width: 50%;
7 | justify-content: center;
8 | }
9 | }
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Footer/stylesheet.scss:
--------------------------------------------------------------------------------
1 | .nfd-onboarding-footer {
2 | position: absolute;
3 | bottom: 0;
4 | left: 0;
5 | z-index: 1;
6 |
7 | display: flex;
8 | flex-direction: row;
9 |
10 | height: auto;
11 | width: 20%;
12 | border: none;
13 |
14 | &__end {
15 | position: absolute;
16 | right: 25px;
17 | bottom: 25px;
18 | display: flex;
19 | align-items: center;
20 | justify-content: center;
21 |
22 | @media (max-width: #{ ($break-small) }) {
23 | right: 16px;
24 | bottom: 20px;
25 | }
26 | }
27 |
28 | &--background {
29 | background-color: rgba(var(--nfd-onboarding-secondary-rgb), 0.75);
30 | }
31 |
32 | @media (max-width: #{ ($break-small) }) {
33 | width: 100%;
34 | backdrop-filter: blur(2px);
35 | background: rgba(var(--nfd-onboarding-secondary-rgb), 0.5);
36 | border-top: 1px solid rgba(var(--nfd-onboarding-primary-rgb), 0.25);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Grid/index.js:
--------------------------------------------------------------------------------
1 | import classNames from 'classnames';
2 |
3 | /**
4 | * Grid Component
5 | * Shows the components in a grid view
6 | *
7 | * @param {Object} root0
8 | * @param {string} root0.className
9 | * @param {number} root0.size
10 | * @param {number} root0.colGap
11 | * @param {Object} root0.children
12 | * @return {WPComponent} NFDOnboarding Grid
13 | */
14 | const Grid = ( { className = '', size, colGap = 0, children } ) => {
15 | return (
16 |
23 | { children }
24 |
25 | );
26 | };
27 |
28 | export default Grid;
29 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Grid/stylesheet.scss:
--------------------------------------------------------------------------------
1 | .nfd-onboarding-grid {
2 | width: 100%;
3 | display: grid;
4 | justify-content: center;
5 |
6 | @media (max-width: #{ ($break-huge) }) {
7 | grid-template-columns: repeat(2, 1fr) !important;
8 | }
9 |
10 | @media (max-width: #{ ($break-small) }) {
11 | grid-template-columns: 1fr !important;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Header/components/SiteBuildHeader/HeaderEnd.js:
--------------------------------------------------------------------------------
1 | import { Fragment } from '@wordpress/element';
2 | import { Slot } from '@wordpress/components';
3 | import { useSelect } from '@wordpress/data';
4 |
5 | import StepNavigation from './step-navigation';
6 | import { store as nfdOnboardingStore } from '../../../../store';
7 | import { SIDEBAR_MENU_SLOTFILL_PREFIX } from '../../../../../constants';
8 |
9 | const HeaderEnd = () => {
10 | const { sidebars, isHeaderNavigationEnabled } = useSelect( ( select ) => {
11 | return {
12 | sidebars: select( nfdOnboardingStore ).getSidebars(),
13 | isHeaderNavigationEnabled:
14 | select( nfdOnboardingStore ).isHeaderNavigationEnabled(),
15 | };
16 | } );
17 |
18 | return (
19 |
20 | { isHeaderNavigationEnabled && }
21 | { sidebars.map( ( sidebar ) => {
22 | return (
23 |
27 | );
28 | } ) }
29 |
30 | );
31 | };
32 |
33 | export default HeaderEnd;
34 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Heading/AIHeading/index.js:
--------------------------------------------------------------------------------
1 | import { memo } from '@wordpress/element';
2 | import OrbAnimation from '../../OrbAnimation';
3 | const AIHeading = ( { title } ) => {
4 | return (
5 |
9 | );
10 | };
11 |
12 | export default memo( AIHeading );
13 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Heading/AIHeading/stylesheet.scss:
--------------------------------------------------------------------------------
1 | .ai-heading {
2 |
3 | width: 100%;
4 | display: flex;
5 | margin: 16px;
6 | align-items: center;
7 |
8 | .wnd-ai-logo {
9 | margin-right: 5px;
10 | }
11 |
12 | &--title {
13 | margin: 10px;
14 | line-height: 1.5;
15 | font-weight: 500;
16 | color: var(--nfd-onboarding-primary);
17 | font-size: clamp(1.2rem, 1.1rem + 0.273vw, 2.5rem);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Heading/HeadingWithSubHeading/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Interface Cards with standard design.
3 | *
4 | * @param {Object} root0
5 | * @param {string} root0.title
6 | * @param {string} root0.subtitle
7 | * @param {Object} root0.children
8 | */
9 | const HeadingWithSubHeading = ( { title, subtitle, children } ) => {
10 | return (
11 |
12 |
{ title }
13 | { subtitle && (
14 | { subtitle }
15 | ) }
16 | { children }
17 |
18 | );
19 | };
20 |
21 | export default HeadingWithSubHeading;
22 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Heading/HeadingWithSubHeading/stylesheet.scss:
--------------------------------------------------------------------------------
1 |
2 | .nfd-main-heading {
3 | width: 96%;
4 | margin: 50px 0 50px;
5 | line-height: 1;
6 |
7 | &__title {
8 | font-weight: 700;
9 | text-align: center;
10 | color: var(--nfd-onboarding-primary);
11 | margin: 35px !important;
12 | font-size: clamp(1.6rem, 4vw, 3.6rem);
13 | }
14 |
15 | &__subtitle {
16 | color: var(--nfd-onboarding-black);
17 | font-weight: 400;
18 | text-align: center;
19 | font-size: clamp(0.85rem, 3.2vw, 1.7rem);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/LanguageSelection/index.js:
--------------------------------------------------------------------------------
1 | import { memo } from '@wordpress/element';
2 |
3 | const LanguageSelection = ( {
4 | languageSelectionLabel,
5 | languageList,
6 | selectedLocale,
7 | setSelectedLocale,
8 | } ) => {
9 | return
10 |
11 |
27 |
;
28 | };
29 |
30 | export default memo( LanguageSelection );
31 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/LanguageSelection/stylesheet.scss:
--------------------------------------------------------------------------------
1 | .nfd-sg-language {
2 | width: 100% !important;
3 | display: flex;
4 | flex-direction: column;
5 |
6 | &__label {
7 | font-size: 0.87rem;
8 | margin-top: 2%;
9 | color: var(--nfd-onboarding-primary);
10 | padding-left: 2px;
11 | }
12 |
13 | &__select {
14 | margin-top: 1%;
15 | border-radius: 8px !important;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Layouts/Base.js:
--------------------------------------------------------------------------------
1 | import classNames from 'classnames';
2 | import { speak } from '@wordpress/a11y';
3 | import { useEffect } from '@wordpress/element';
4 | import { useLocation } from 'react-router-dom';
5 |
6 | const BaseLayout = ( {
7 | className = 'nfd-onboarding-layout__base',
8 | children,
9 | } ) => {
10 | const location = useLocation();
11 | const mainContainer = document.querySelector( '.nfd-onboard-content' );
12 |
13 | const speakRouteTitle = ( title = 'Showing new Onboarding Page' ) => {
14 | // [TODO]: Determine if some routes should not speak the title
15 | speak( title, 'assertive' );
16 | };
17 |
18 | useEffect( () => {
19 | mainContainer?.focus( { preventScroll: true } );
20 | speakRouteTitle( 'Override' );
21 | }, [ location.pathname ] );
22 |
23 | return (
24 |
25 | { children }
26 |
27 | );
28 | };
29 |
30 | export default BaseLayout;
31 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Layouts/stylesheet.scss:
--------------------------------------------------------------------------------
1 | .nfd-onboarding-layout__common {
2 | min-height: calc(100vh - #{$header-height} - #{$border-width} - #{$admin-bar-height-big});
3 | @include break-medium {
4 | min-height: calc(100vh - #{$header-height} - #{$border-width});
5 | }
6 | &.is-padded {
7 | min-height: calc(100vw - #{$header-height} - #{$border-width} - #{$grid-unit * 18} - #{$admin-bar-height-big});
8 | @include break-medium {
9 | min-height: calc(100vh - #{$header-height} - #{$border-width} - #{$grid-unit * 18});
10 | }
11 | padding: #{$grid-unit * 9};
12 | }
13 | > .is-contained {
14 | width: 100%;
15 | max-width: $break-huge;
16 | }
17 | }
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/LivePreview/SelectableCardWithInfo/stylesheet.scss:
--------------------------------------------------------------------------------
1 |
2 | .live-preview--selectable-card {
3 | flex: 1;
4 | width: 100%;
5 | margin: 24px;
6 | display: flex;
7 | overflow: hidden;
8 | align-items: center;
9 | flex-direction: column;
10 | justify-content: center;
11 |
12 |
13 | &__live-preview-container {
14 | position: relative;
15 | width: 90%;
16 | overflow: hidden;
17 | align-items: center;
18 | border: 1px solid #e3dfdf;
19 |
20 | &:hover {
21 | cursor: pointer;
22 | }
23 |
24 | .live-preview {
25 |
26 | &__container {
27 |
28 | &-custom {
29 | width: 100%;
30 | overflow: hidden;
31 | height: 300px;
32 | }
33 | }
34 | }
35 |
36 | }
37 | }
38 |
39 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/LivePreview/index.js:
--------------------------------------------------------------------------------
1 | export { default as LivePreview } from './BlockPreview';
2 | export { default as LivePreviewSkeleton } from './LivePreviewSkeleton';
3 | export { default as LivePreviewSelectableCard } from './SelectableCard';
4 | export { default as LivePreviewSelectableCardWithInfo } from './SelectableCardWithInfo';
5 | export { default as GlobalStylesProvider } from './GlobalStylesProvider';
6 | export { default as SiteGenPreviewSelectableCard } from './SiteGenPreviewSelectableCard';
7 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/LivePreview/stylesheet.scss:
--------------------------------------------------------------------------------
1 | @import "./BlockPreview/stylesheet";
2 | @import "./SelectableCard/stylesheet";
3 | @import "./SelectableCardWithInfo/stylesheet";
4 | @import "./SiteGenPreviewSelectableCard/stylesheet";
5 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Loaders/ImageUpload/index.js:
--------------------------------------------------------------------------------
1 | import Animate from '../../Animate';
2 |
3 | const ImageUploadLoader = () => {
4 | return (
5 |
11 | );
12 | };
13 |
14 | export default ImageUploadLoader;
15 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Loaders/ImageUpload/stylesheet.scss:
--------------------------------------------------------------------------------
1 | .image-upload-loader {
2 |
3 | &--loading-box {
4 | width: 200px;
5 | height: 25px;
6 | position: relative;
7 | border-radius: 50px;
8 | overflow: hidden;
9 | border: 2px solid #ededed;
10 |
11 | &__loader {
12 | width: 100%;
13 | height: 100%;
14 | position: absolute;
15 | border-radius: 50px;
16 | background: linear-gradient(45deg, var(--nfd-onboarding-loader-start), var(--nfd-onboarding-loader-end));
17 | left: -100%;
18 | }
19 | }
20 |
21 | }
22 |
23 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Loaders/SiteGenLoader/contents.js:
--------------------------------------------------------------------------------
1 | import { __ } from '@wordpress/i18n';
2 |
3 | const getContents = () => {
4 | return {
5 | title: __( 'Building Website', 'wp-module-onboarding' ),
6 | status: [
7 | {
8 | title: __( 'Generating Website', 'wp-module-onboarding' ),
9 | },
10 | {
11 | title: __( 'Finding Font Pairings', 'wp-module-onboarding' ),
12 | },
13 | {
14 | title: __(
15 | 'Building Custom Color Palettes',
16 | 'wp-module-onboarding'
17 | ),
18 | },
19 | {
20 | title: __( 'Populating Images', 'wp-module-onboarding' ),
21 | },
22 | {
23 | title: __( 'Finalizing Previews', 'wp-module-onboarding' ),
24 | },
25 | {
26 | title: __( 'Packaging Website', 'wp-module-onboarding' ),
27 | },
28 | ],
29 | };
30 | };
31 |
32 | export default getContents;
33 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Loaders/Spinner/index.js:
--------------------------------------------------------------------------------
1 | import classNames from 'classnames';
2 |
3 | const Spinner = ( { className } ) => {
4 | return (
5 |
11 | );
12 | };
13 |
14 | export default Spinner;
15 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Loaders/Spinner/stylesheet.scss:
--------------------------------------------------------------------------------
1 | .nfd-onboarding-loader {
2 |
3 | &--spinner {
4 | border-radius: 50%;
5 | width: 10em;
6 | height: 10em;
7 | font-size: 8px;
8 | border-top: 1.1em solid rgba(var(--nfd-onboarding-primary-rgb), 0.2);
9 | border-right: 1.1em solid rgba(var(--nfd-onboarding-primary-rgb), 0.2);
10 | border-bottom: 1.1em solid rgba(var(--nfd-onboarding-primary-rgb), 0.2);
11 | border-left: 1.1em solid var(--nfd-onboarding-primary);
12 | -webkit-transform: translateZ(0);
13 | -ms-transform: translateZ(0);
14 | transform: translateZ(0);
15 | -webkit-animation: spin 1.1s infinite linear;
16 | animation: spin 1.1s infinite linear;
17 | display: flex;
18 | align-items: center;
19 | justify-content: center;
20 |
21 | @media (prefers-reduced-motion) {
22 | animation: none !important;
23 | }
24 | }
25 |
26 | &::after {
27 | border-radius: 50%;
28 | width: 10em;
29 | height: 10em;
30 | }
31 | }
32 |
33 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Loaders/Step/Ecommerce/contents.js:
--------------------------------------------------------------------------------
1 | import { __, sprintf } from '@wordpress/i18n';
2 | import { translations } from '../../../../utils/locales/translations';
3 |
4 | const getContents = ( brandName ) => {
5 | return {
6 | title: sprintf(
7 | /* translators: 1: Brand 2: Site or Store */
8 | __(
9 | 'Making the keys to your %1$s Online %2$s',
10 | 'wp-module-onboarding'
11 | ),
12 | brandName,
13 | translations( 'Site' )
14 | ),
15 | subtitle: __(
16 | 'We’re installing WooCommerce for you to fill with your amazing products & services!',
17 | 'wp-module-onboarding'
18 | ),
19 | };
20 | };
21 |
22 | export default getContents;
23 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Loaders/Step/Ecommerce/index.js:
--------------------------------------------------------------------------------
1 | import StepLoader from '..';
2 | import getContents from './contents';
3 | import { useSelect } from '@wordpress/data';
4 |
5 | import { store as nfdOnboardingStore } from '../../../../store';
6 |
7 | const EcommerceStepLoader = () => {
8 | const { brandName } = useSelect( ( select ) => {
9 | return {
10 | brandName: select( nfdOnboardingStore ).getNewfoldBrandName(),
11 | };
12 | }, [] );
13 | const contents = getContents( brandName );
14 | return (
15 |
16 | );
17 | };
18 |
19 | export default EcommerceStepLoader;
20 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Loaders/Step/index.js:
--------------------------------------------------------------------------------
1 | import CommonLayout from '../../Layouts/Common';
2 | import HeadingWithSubHeading from '../../Heading/HeadingWithSubHeading';
3 | import NeedHelpTag from '../../NeedHelpTag';
4 |
5 | const StepLoader = ( { title, subtitle } ) => {
6 | return (
7 |
8 |
9 |
12 |
13 |
14 | );
15 | };
16 |
17 | export default StepLoader;
18 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Loaders/Step/stylesheet.scss:
--------------------------------------------------------------------------------
1 | .step-loader {
2 |
3 | cursor: wait;
4 | justify-content: space-evenly;
5 |
6 | @media (max-width: #{($break-medium)}) {
7 | justify-content: center;
8 | }
9 |
10 | &__logo {
11 | max-width: 256px;
12 | height: 256px;
13 | width: 50vw;
14 | background-image: var(--nfd-onboarding-step-loader-icon);
15 | background-size: contain;
16 | background-repeat: no-repeat;
17 | background-position: center;
18 |
19 | @media (max-width: #{($break-medium)}) {
20 | max-width: 256px;
21 | max-height: 256px;
22 | height: 30vh;
23 | width: 100vw;
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Loaders/index.js:
--------------------------------------------------------------------------------
1 | export { default as StepLoader } from "./Step";
2 | export { default as ImageUploadLoader } from "./ImageUpload";
3 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Loaders/stylesheet.scss:
--------------------------------------------------------------------------------
1 | @import "./ImageUpload/stylesheet";
2 | @import "./Step/stylesheet";
3 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/MiniPreview/contents.js:
--------------------------------------------------------------------------------
1 | import { __, sprintf } from '@wordpress/i18n';
2 |
3 | import { translations } from '../../utils/locales/translations';
4 |
5 | const getContents = () => {
6 | return {
7 | heading: __( 'Preview', 'wp-module-onboarding' ),
8 | defaultTitle: sprintf(
9 | /* translators: %s: Site or Store */
10 | __( 'WordPress %s', 'wp-module-onboarding' ),
11 | translations( 'Site' )
12 | ),
13 | defaultDesc: sprintf(
14 | /* translators: %s: Site */
15 | __( 'Just another WordPress %s', 'wp-module-onboarding' ),
16 | translations( 'Site' )
17 | ),
18 | };
19 | };
20 |
21 | export default getContents;
22 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/NeedHelpTag/index.js:
--------------------------------------------------------------------------------
1 | import { store as nfdOnboardingStore } from '../../store';
2 | import { select } from '@wordpress/data';
3 | import { __ } from '@wordpress/i18n';
4 |
5 | /**
6 | * Need Help Label and URL rendering component for most of the onboarding steps
7 | * Pass any Label and URL redirect which we want as is to display on the UI
8 | *
9 | * @param content
10 | * @return NeedHelpTag
11 | */
12 |
13 | const NeedHelpTag = ( {
14 | question = __( 'Need Help?', 'wp-module-onboarding' ),
15 | urlLabel = __( 'Hire our Experts', 'wp-module-onboarding' ),
16 | } ) => {
17 | const hireExpertsUrl = select( nfdOnboardingStore ).getHireExpertsUrl();
18 |
19 | return (
20 | hireExpertsUrl && (
21 |
27 | )
28 | );
29 | };
30 |
31 | export default NeedHelpTag;
32 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/NeedHelpTag/stylesheet.scss:
--------------------------------------------------------------------------------
1 | .nfd-card-need-help-tag {
2 | color: var(--nfd-onboarding-black);
3 | padding: 20px;
4 | font-weight: 200;
5 | text-align: center;
6 | font-style: italic;
7 | font-size: clamp(0.6rem, 1.5vw, 0.9rem);
8 |
9 | a {
10 | text-decoration: none;
11 | padding: 0 0.4rem;
12 | }
13 |
14 | @media (max-width: #{($break-medium)}) {
15 | padding: 9px;
16 | }
17 |
18 | @media (min-width: 2600px) {
19 | font-size: clamp(1.6rem, -0.09vw + 1rem, 1.78rem);
20 | font-weight: 450;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/NewfoldInterfaceSkeleton/themeToggleHOC.js:
--------------------------------------------------------------------------------
1 | import { useContext } from '@wordpress/element';
2 | import { ThemeContext } from '../ThemeContextProvider';
3 | import classNames from 'classnames';
4 | import { THEME_DARK } from '../../../constants';
5 |
6 | const themeToggleHOC = (
7 | WrappedComponent,
8 | darkClass,
9 | lightClass,
10 | isForkStep = true
11 | ) => {
12 | return ( props ) => {
13 | const { theme } = useContext( ThemeContext );
14 | const isDarkMode = theme === THEME_DARK;
15 | const shouldApply = isForkStep !== undefined ? isForkStep : true;
16 | const className = classNames( props.className, {
17 | [ darkClass ]: isDarkMode && shouldApply,
18 | [ lightClass ]: ! isDarkMode && shouldApply,
19 | } );
20 |
21 | return ;
22 | };
23 | };
24 |
25 | export default themeToggleHOC;
26 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/NewfoldLargeCard/index.js:
--------------------------------------------------------------------------------
1 | import classNames from 'classnames';
2 |
3 | const NewfoldLargeCard = ( { className = '', children } ) => {
4 | return (
5 |
9 | );
10 | };
11 |
12 | export default NewfoldLargeCard;
13 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/ProgressBar/index.js:
--------------------------------------------------------------------------------
1 | const ProgressBar = ( { progress = 20 } ) => {
2 | return (
3 |
9 | );
10 | };
11 |
12 | export default ProgressBar;
13 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/ProgressBar/stylesheet.scss:
--------------------------------------------------------------------------------
1 | .nfd-onboarding-header {
2 |
3 | &__progress-bar {
4 | width: 100%;
5 | background-color: var(--nfd-onboarding-progress-bar-background);
6 | height: 16px;
7 |
8 | &__progress {
9 | height: 16px;
10 | transition: width 2s ease-in-out;
11 | background-color: var(--nfd-onboarding-progress-bar-fill);
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/SelectableCardList/selectable-card-list.js:
--------------------------------------------------------------------------------
1 | import Card from '../SelectableCard';
2 |
3 | const SelectableCardList = ({ contents, selected, onSelectedChange }) => {
4 | const cardList = contents.map((content, idx) => {
5 | return (
6 |
15 | );
16 | });
17 |
18 | return {cardList}
;
19 | };
20 |
21 | export default SelectableCardList;
22 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/SelectableCardList/stylesheet.scss:
--------------------------------------------------------------------------------
1 | .selectable_cards {
2 | gap: 1.5rem;
3 | width: 100%;
4 | display: flex;
5 | justify-content: center;
6 |
7 | @media (max-width: #{ ($break-large) }) {
8 | flex-direction: column;
9 | align-items: center;
10 | }
11 | }
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Sidebar/components/Customize/DesignColorsPanel/ColorPaletteIcon/stylesheet.scss:
--------------------------------------------------------------------------------
1 | .nfd-onboarding-sidebar--customize__color-palette-icon {
2 |
3 | &__container {
4 | text-align: center;
5 |
6 | &__icon {
7 | box-sizing: border-box;
8 | width: 45px;
9 | height: 45px;
10 | border-radius: 50%;
11 | cursor: pointer;
12 | box-shadow: "none";
13 | }
14 |
15 | &__icon__selected {
16 | box-sizing: border-box;
17 | width: 45px;
18 | height: 45px;
19 | border-radius: 50%;
20 | cursor: pointer;
21 | box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--nfd-onboarding-sitegen-customize-icon-selected);
22 | }
23 |
24 | p {
25 | margin-top: 8px;
26 | color: var(--nfd-onboarding-sitegen-customize-default-text-color);
27 | }
28 | }
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Sidebar/components/Customize/DesignColorsPanel/CustomColorPalette/index.js:
--------------------------------------------------------------------------------
1 | import { useState } from '@wordpress/element';
2 | import { ColorPalette, Popover } from '@wordpress/components';
3 | import './stylesheet.scss';
4 | import { __ } from '@wordpress/i18n';
5 |
6 | const CustomColorPalette = ( { onChange, palettePrimaryColors } ) => {
7 | const [ color, setColor ] = useState( palettePrimaryColors[ 0 ].color );
8 | const baseClassName =
9 | 'nfd-onboarding-sidebar--customize__custom-color-palette';
10 | const colors = [
11 | {
12 | colors: palettePrimaryColors,
13 | name: __( 'THEME', 'wp-module-onboarding' ),
14 | },
15 | ];
16 | const handleColorChange = ( newColor ) => {
17 | setColor( newColor );
18 | onChange( newColor );
19 | };
20 | return (
21 |
22 |
23 |
28 |
29 |
30 | );
31 | };
32 |
33 | export default CustomColorPalette;
34 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Sidebar/components/Customize/DesignColorsPanel/CustomColorPalette/stylesheet.scss:
--------------------------------------------------------------------------------
1 | .nfd-onboarding-sidebar {
2 |
3 | &--customize {
4 |
5 | &__custom-color-palette {
6 |
7 | &__container {
8 | padding: 16px;
9 | width: 260px;
10 | }
11 | }
12 | }
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Sidebar/components/Customize/stylesheet.scss:
--------------------------------------------------------------------------------
1 | @import "./HeadingWithDescription/stylesheet";
2 | @import "./StepIntroPanel/stylesheet";
3 | @import "./IllustrationPanel/stylesheet";
4 | @import "./InfoPanel/stylesheet";
5 | @import "./HelpPanel/stylesheet";
6 | @import "./SupportLink/stylesheet";
7 |
8 | .components-button:focus:not(:disabled),
9 | .components-button.is-pressed:focus:not(:disabled) {
10 | box-shadow: none;
11 | }
12 |
13 | .nfd-onboarding-sidebar-learn-more {
14 | background: #fff;
15 | padding: 0 !important;
16 | border: none;
17 | overflow-y: auto;
18 | width: 100%;
19 | height: 100%;
20 |
21 | &__header {
22 |
23 | &__icon {
24 | width: 24px;
25 | height: 24px;
26 | display: flex;
27 | align-items: center;
28 | justify-content: center;
29 | }
30 | }
31 |
32 | &__menu-button {
33 | margin: 0 5px;
34 | min-height: 40px;
35 | }
36 | }
37 |
38 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Sidebar/components/LearnMore/HeadingWithDescription/index.js:
--------------------------------------------------------------------------------
1 | import { Fragment } from '@wordpress/element';
2 |
3 | const HeadingWithDescription = ( {
4 | heading,
5 | description,
6 | baseClassName = 'nfd-onboarding-sidebar-learn-more--heading-with-description',
7 | } ) => {
8 | return (
9 |
10 | { heading }
11 |
12 | { description }
13 |
14 |
15 | );
16 | };
17 |
18 | export default HeadingWithDescription;
19 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Sidebar/components/LearnMore/HeadingWithDescription/stylesheet.scss:
--------------------------------------------------------------------------------
1 | .nfd-onboarding-sidebar-learn-more {
2 |
3 | &--heading-with-description {
4 |
5 | &__heading {
6 | font-size: 14px;
7 | font-weight: 600;
8 | color: #1e1e1e;
9 | line-height: 20px;
10 | }
11 |
12 | &__description {
13 | line-height: 16px;
14 | font-size: 12px;
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Sidebar/components/LearnMore/HelpPanel/index.js:
--------------------------------------------------------------------------------
1 | const HelpPanel = ( {
2 | children,
3 | baseClassName = 'nfd-onboarding-sidebar-learn-more--help-panel',
4 | } ) => {
5 | return { children }
;
6 | };
7 |
8 | export default HelpPanel;
9 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Sidebar/components/LearnMore/HelpPanel/stylesheet.scss:
--------------------------------------------------------------------------------
1 | .nfd-onboarding-sidebar-learn-more {
2 |
3 | &--help-panel {
4 |
5 | &__links {
6 | display: flex;
7 | flex-direction: column;
8 | justify-content: center;
9 | align-items: center;
10 | margin: 0 10px;
11 | }
12 | }
13 | }
14 |
15 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Sidebar/components/LearnMore/IllustrationPanel/index.js:
--------------------------------------------------------------------------------
1 | import { PanelBody } from '@wordpress/components';
2 |
3 | const IllustrationPanel = ( {
4 | cssIcon = 'nfd-onboarding-sidebar-learn-more-get-started-welcome-illustration',
5 | baseClassName = 'nfd-onboarding-sidebar-learn-more--illustration-panel',
6 | backgroundPosition = 'center',
7 | } ) => {
8 | const iconExists =
9 | window
10 | .getComputedStyle( document.body )
11 | .getPropertyValue( `--${ cssIcon }` ) !== '';
12 |
13 | return (
14 | iconExists && (
15 |
19 |
30 |
31 | )
32 | );
33 | };
34 |
35 | export default IllustrationPanel;
36 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Sidebar/components/LearnMore/IllustrationPanel/stylesheet.scss:
--------------------------------------------------------------------------------
1 | .nfd-onboarding-sidebar-learn-more {
2 |
3 | &--illustration-panel {
4 |
5 | &__container {
6 | display: flex;
7 | align-items: center;
8 | justify-content: center;
9 | height: 200px;
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Sidebar/components/LearnMore/InfoPanel/index.js:
--------------------------------------------------------------------------------
1 | import { PanelBody } from '@wordpress/components';
2 |
3 | import HeadingWithDescription from '../HeadingWithDescription';
4 |
5 | const InfoPanel = ( {
6 | baseClassName = 'nfd-onboarding-sidebar-learn-more--info-panel',
7 | headingWithDescriptions,
8 | } ) => {
9 | return (
10 |
11 | { headingWithDescriptions.map( ( headingWithDescription, idx ) => {
12 | return (
13 |
18 | );
19 | } ) }
20 |
21 | );
22 | };
23 |
24 | export default InfoPanel;
25 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Sidebar/components/LearnMore/InfoPanel/stylesheet.scss:
--------------------------------------------------------------------------------
1 | .nfd-onboarding-sidebar-learn-more {
2 |
3 | &--info-panel {
4 | border-bottom: none;
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Sidebar/components/LearnMore/StepIntroPanel/index.js:
--------------------------------------------------------------------------------
1 | import { PanelBody, PanelRow } from '@wordpress/components';
2 |
3 | import { Icon } from '@wordpress/icons';
4 |
5 | const StepIntroPanel = ( {
6 | baseClassName = 'nfd-onboarding-sidebar-learn-more--step-intro-panel',
7 | heading,
8 | subheading,
9 | icon,
10 | } ) => {
11 | return (
12 |
13 |
14 |
15 |
16 | { }
17 |
18 |
19 |
22 | { heading }
23 |
24 |
27 | { subheading }
28 |
29 |
30 |
31 |
32 |
33 | );
34 | };
35 |
36 | export default StepIntroPanel;
37 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Sidebar/components/LearnMore/StepIntroPanel/stylesheet.scss:
--------------------------------------------------------------------------------
1 | .nfd-onboarding-sidebar-learn-more {
2 |
3 | &--step-intro-panel {
4 | border: none;
5 |
6 | &__container {
7 | display: flex;
8 |
9 | &__text {
10 | align-items: center;
11 |
12 | &__heading,
13 | &__subheading {
14 | margin-top: 2px;
15 | line-height: 16px;
16 | }
17 | }
18 |
19 | &__icon {
20 | margin-right: 5%;
21 | }
22 |
23 | }
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Sidebar/components/LearnMore/SupportLink/index.js:
--------------------------------------------------------------------------------
1 | const SupportLink = ( {
2 | baseClassName = 'nfd-onboarding-sidebar-learn-more--support-link',
3 | link = '#',
4 | text,
5 | } ) => {
6 | return (
7 | link !== '' && (
8 |
14 | { text }
15 |
16 | )
17 | );
18 | };
19 |
20 | export default SupportLink;
21 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Sidebar/components/LearnMore/SupportLink/stylesheet.scss:
--------------------------------------------------------------------------------
1 | .nfd-onboarding-sidebar-learn-more {
2 |
3 | &--support-link {
4 | border-radius: 2px;
5 | text-decoration: none;
6 | color: var(--wp-admin-theme-color);
7 | margin: 10px 0;
8 |
9 | &:hover {
10 | color: var(--wp-admin-theme-color-darker-20);
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Sidebar/components/LearnMore/stylesheet.scss:
--------------------------------------------------------------------------------
1 | @import "./HeadingWithDescription/stylesheet";
2 | @import "./StepIntroPanel/stylesheet";
3 | @import "./IllustrationPanel/stylesheet";
4 | @import "./InfoPanel/stylesheet";
5 | @import "./HelpPanel/stylesheet";
6 | @import "./SupportLink/stylesheet";
7 |
8 | .components-button:focus:not(:disabled),
9 | .components-button.is-pressed:focus:not(:disabled) {
10 | box-shadow: none;
11 | }
12 |
13 | .nfd-onboarding-sidebar-learn-more {
14 | padding: 0 !important;
15 | border: none;
16 | overflow-y: auto;
17 | width: 100%;
18 | height: 100%;
19 |
20 | &__header {
21 |
22 | &__icon {
23 | width: 24px;
24 | height: 24px;
25 | display: flex;
26 | align-items: center;
27 | justify-content: center;
28 | }
29 | }
30 |
31 | &__menu-button {
32 | margin: 0 5px;
33 | min-height: 40px;
34 | }
35 | }
36 |
37 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Sidebar/stylesheet.scss:
--------------------------------------------------------------------------------
1 | .interface-interface-skeleton__sidebar {
2 | height: 100%;
3 | position: relative;
4 | overflow: hidden;
5 | }
6 |
7 | .nfd-onboarding-sidebar__panel {
8 | background: var(--nfd-onboarding-base);
9 | height: 100%;
10 | position: relative;
11 | width: 0;
12 | overflow: hidden;
13 | transition: width 100ms linear;
14 |
15 | @include reduce-motion("transition");
16 |
17 | &-inner {
18 | position: relative;
19 | width: 100%;
20 | height: 100%;
21 | overflow: hidden;
22 | visibility: hidden;
23 | transition: visibility 100ms linear;
24 |
25 | @include reduce-motion("transition");
26 | }
27 | }
28 |
29 | .nfd-onboarding-sidebar__panel.is-open {
30 | width: $nav-sidebar-width;
31 | border-left: 1px solid var(--nfd-onboarding-sidebar-border-left);
32 |
33 | .nfd-onboarding-sidebar__panel-inner,
34 | .interface-interface-skeleton__sidebar {
35 | visibility: visible;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/SiteGenPlaceholder/index.js:
--------------------------------------------------------------------------------
1 | import NextButtonSiteGen from '../Button/NextButtonSiteGen';
2 |
3 | const SiteGenPlaceholder = ( { heading } ) => {
4 | return (
5 |
6 |
7 | { heading }
8 |
9 |
10 |
11 | );
12 | };
13 |
14 | export default SiteGenPlaceholder;
15 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/SiteGenPlaceholder/stylesheet.scss:
--------------------------------------------------------------------------------
1 | .nfd-onboarding-placeholder {
2 |
3 | &--site-gen {
4 | display: flex;
5 | flex-direction: column;
6 | justify-content: center;
7 | align-items: center;
8 |
9 | &__heading {
10 | color: var(--nfd-onboarding-primary);
11 | font-size: 70px;
12 | }
13 |
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/SkipButton/stylesheet.scss:
--------------------------------------------------------------------------------
1 | $primary-color: var(--nfd-onboarding-primary);
2 |
3 | .skip-button {
4 | padding: 10px;
5 | cursor: pointer;
6 | font-weight: 200;
7 | font-style: italic;
8 | color: $primary-color;
9 | }
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/SocialMediaForm/utils.js:
--------------------------------------------------------------------------------
1 | // eslint-disable-next-line import/no-extraneous-dependencies
2 | import { transform } from 'lodash';
3 |
4 | // Types of Social Media Errors
5 | export const ERROR_TYPES = {
6 | NONE: 'none',
7 | AD_LINK_ERROR: 'ad-link-error',
8 | INVALID_LINK_ERROR: 'invalid-link-error',
9 | };
10 |
11 | const socialMediaStoreToStateMap = {
12 | facebook_site: 'facebook',
13 | twitter_site: 'twitter',
14 | instagram_url: 'instagram',
15 | youtube_url: 'youtube',
16 | linkedin_url: 'linkedin',
17 | yelp_url: 'yelp',
18 | tiktok_url: 'tiktok',
19 | };
20 |
21 | export const socialMediaStoreToState = ( socialMediaStore ) => {
22 | return transform( socialMediaStoreToStateMap, ( result, value, key ) => {
23 | const url =
24 | socialMediaStore?.[ key ] ||
25 | socialMediaStore?.other_social_urls?.[ key ];
26 | if ( url ) {
27 | result[ value ] = url;
28 | }
29 | } );
30 | };
31 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/StateHandlers/SiteGen/contents.js:
--------------------------------------------------------------------------------
1 | import { __, sprintf } from '@wordpress/i18n';
2 |
3 | const getContents = ( brandName ) => {
4 | return {
5 | loader: {
6 | title: sprintf(
7 | /* translators: %s: Brand */
8 | __( 'Preparing your %s design studio', 'wp-module-onboarding' ),
9 | brandName
10 | ),
11 | subtitle: __(
12 | 'Hang tight while we show you some of the best WordPress has to offer!',
13 | 'wp-module-onboarding'
14 | ),
15 | },
16 | errorState: {
17 | title: sprintf(
18 | /* translators: %s: Brand */
19 | __( 'Preparing your %s design studio', 'wp-module-onboarding' ),
20 | brandName
21 | ),
22 | subtitle: __(
23 | 'Hang tight while we show you some of the best WordPress has to offer!',
24 | 'wp-module-onboarding'
25 | ),
26 | error: __(
27 | 'Uh-oh, something went wrong. Please contact support.',
28 | 'wp-module-onboarding'
29 | ),
30 | },
31 | };
32 | };
33 |
34 | export default getContents;
35 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/StateHandlers/SiteGen/index.js:
--------------------------------------------------------------------------------
1 | // WordPress
2 | import { Fragment } from '@wordpress/element';
3 | import { useSelect } from '@wordpress/data';
4 |
5 | // Classes and functions
6 |
7 | // Components
8 | import SiteGenStepErrorState from '../../ErrorState/Step/SiteGen';
9 |
10 | // Misc
11 | import { store as nfdOnboardingStore } from '../../../store';
12 |
13 | const SiteGenStateHandler = ( { children } ) => {
14 | const { siteGenErrorStatus } = useSelect( ( select ) => {
15 | return {
16 | currentStepPath: select( nfdOnboardingStore ).getCurrentStepPath(),
17 | siteGenErrorStatus:
18 | select( nfdOnboardingStore ).getSiteGenErrorStatus(),
19 | };
20 | } );
21 |
22 | const handleRender = () => {
23 | if ( siteGenErrorStatus ) {
24 | return ;
25 | }
26 |
27 | return children;
28 | };
29 | return { handleRender() };
30 | };
31 |
32 | export default SiteGenStateHandler;
33 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/StateHandlers/index.js:
--------------------------------------------------------------------------------
1 | export { default as DesignStateHandler } from './Design';
2 | export { default as FlowStateHandler } from './Flow';
3 | export { default as SiteGenStateHandler } from './SiteGen';
4 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Tab/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Common Tab Component
3 | *
4 | * @return Tab
5 | */
6 |
7 | import Animate from '../Animate';
8 |
9 | const Tab = ( { title, text, imgType, className, animationName } ) => {
10 | return (
11 |
12 |
13 |
{ title }
14 | { text }
15 |
16 |
23 |
24 | );
25 | };
26 |
27 | export default Tab;
28 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/TabPanelHover/navigableContainer.js:
--------------------------------------------------------------------------------
1 | // @ts-nocheck
2 | /**
3 | * Internal Dependencies
4 | */
5 | export { default as NavigableMenu } from './menu';
6 | export { default as TabbableContainer } from './tabbable';
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/TextInput/TextAreaSiteGenDetails/index.js:
--------------------------------------------------------------------------------
1 | import { useRef, memo } from '@wordpress/element';
2 |
3 | const TextAreaSiteGenDetails = ( {
4 | labelText,
5 | placeholder,
6 | customerInput,
7 | callback = null,
8 | } ) => {
9 | const textareaRef = useRef( null );
10 |
11 | return (
12 |
13 |
14 |
15 |
27 |
28 | );
29 | };
30 |
31 | export default memo( TextAreaSiteGenDetails );
32 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/TextInput/TextAreaSiteGenDetails/stylesheet.scss:
--------------------------------------------------------------------------------
1 |
2 |
3 | .nfd-sg-simple-input {
4 | margin-top: 20px;
5 |
6 | }
7 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/TextInput/TextInputSiteBuild/contents.js:
--------------------------------------------------------------------------------
1 | import { __, sprintf } from '@wordpress/i18n';
2 |
3 | const getContents = ( charactersLeft ) => {
4 | return {
5 | charactersLeftPrompt: {
6 | text: sprintf(
7 | /* translators: %d: Character count */
8 | __( '(%d characters left)', 'wp-module-onboarding' ),
9 | charactersLeft
10 | ),
11 | },
12 | };
13 | };
14 |
15 | export default getContents;
16 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/TextInput/TextInputSiteGenDetails/index.js:
--------------------------------------------------------------------------------
1 | import { memo } from '@wordpress/element';
2 |
3 | const TextInputSiteGenDetails = ( {
4 | labelText,
5 | placeholder,
6 | customerInput,
7 | callback = null,
8 | } ) => {
9 | return (
10 |
11 |
12 |
13 | {
18 | if ( callback && typeof callback === 'function' ) {
19 | callback( e );
20 | }
21 | } }
22 | />
23 |
24 |
25 | );
26 | };
27 |
28 | export default memo( TextInputSiteGenDetails );
29 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/TextInput/TextInputSiteGenDetails/stylesheet.scss:
--------------------------------------------------------------------------------
1 |
2 |
3 | .nfd-sg-simple-input {
4 | margin-top: 20px;
5 |
6 | }
7 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/ToggleDarkMode/contents.js:
--------------------------------------------------------------------------------
1 | import { __ } from '@wordpress/i18n';
2 |
3 | const getContents = () => {
4 | return {
5 | label: __( 'Dark Mode', 'wp-module-onboarding' ),
6 | };
7 | };
8 |
9 | export default getContents;
10 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/ToggleDarkMode/stylesheet.scss:
--------------------------------------------------------------------------------
1 | .nfd-onboarding-toggle__theme {
2 | margin-left: 25px;
3 | margin-top: 10px;
4 | margin-bottom: 25px;
5 |
6 | &__button {
7 | width: 60px;
8 | height: 60px;
9 | cursor: pointer;
10 |
11 | &__light {
12 | background: var(--sitegen-toggle-theme-icon-light);
13 | }
14 |
15 | &__dark {
16 | background: var(--sitegen-toggle-theme-icon-dark);
17 | }
18 | }
19 |
20 | @media (max-width: #{ ($break-small) }) {
21 | margin-left: 16px;
22 | margin-bottom: 16px;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/components/Tooltip/index.js:
--------------------------------------------------------------------------------
1 | import React, { useState } from "react";
2 |
3 | const Tooltip = (props) => {
4 | let timeout;
5 | const [active, setActive] = useState(true);
6 |
7 | const showTip = () => {
8 | timeout = setTimeout(() => {
9 | setActive(true);
10 | }, props.delay || 400);
11 | };
12 |
13 | const hideTip = () => {
14 | clearInterval(timeout);
15 | setActive(false);
16 | };
17 | if (props.content == 'hide')
18 | return ({props.children}
);
19 |
20 | return (
21 |
27 | {/* Wrapping */}
28 | {props.children}
29 | {active && (
30 |
31 | {/* Content */}
32 | {props.content}
33 |
34 | )}
35 |
36 | );
37 | };
38 |
39 | export default Tooltip;
40 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/data/flows/constants.js:
--------------------------------------------------------------------------------
1 | export const DEFAULT_FLOW = 'wp-setup';
2 | export const ECOMMERCE_FLOW = 'ecommerce';
3 | export const SITEGEN_FLOW = 'sitegen';
4 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/data/footers/index.js:
--------------------------------------------------------------------------------
1 | import { lazy } from '@wordpress/element';
2 |
3 | import { FOOTER_SITEGEN } from '../../../constants';
4 |
5 | const SiteGenFooter = lazy( () =>
6 | import( '../../components/Footer/components/SiteGenFooter' )
7 | );
8 |
9 | export const footers = [
10 | {
11 | id: FOOTER_SITEGEN,
12 | footer: SiteGenFooter,
13 | enabled: true,
14 | },
15 | ];
16 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/data/headers/index.js:
--------------------------------------------------------------------------------
1 | import { lazy } from '@wordpress/element';
2 |
3 | import { HEADER_SITEBUILD, HEADER_SITEGEN } from '../../../constants';
4 |
5 | const SiteGenHeader = lazy( () =>
6 | import( '../../components/Header/components/SiteGenHeader' )
7 | );
8 |
9 | const SiteBuildHeader = lazy( () =>
10 | import( '../../components/Header/components/SiteBuildHeader' )
11 | );
12 |
13 | export const headers = [
14 | {
15 | id: HEADER_SITEGEN,
16 | header: SiteGenHeader,
17 | enabled: true,
18 | },
19 | {
20 | id: HEADER_SITEBUILD,
21 | header: SiteBuildHeader,
22 | enabled: true,
23 | },
24 | ];
25 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/data/models/Chapter.js:
--------------------------------------------------------------------------------
1 | export class Chapter {
2 | constructor( {
3 | id,
4 | name,
5 | steps,
6 | conditionalSteps = [],
7 | initialSteps = [],
8 | topSteps = [],
9 | interstitialSteps = [],
10 | } ) {
11 | this.id = id;
12 | this.name = name;
13 | this.steps = steps.map( ( step ) => {
14 | step.chapter = this.id;
15 | return step;
16 | } );
17 | this.conditionalSteps = conditionalSteps.map( ( step ) => {
18 | step.chapter = this.id;
19 | return step;
20 | } );
21 | this.initialSteps = initialSteps;
22 | this.topSteps = topSteps;
23 | this.interstitialSteps = interstitialSteps;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/data/models/Flow.js:
--------------------------------------------------------------------------------
1 | export class Flow {
2 | constructor( steps, routes, pages, topSteps ) {
3 | this.steps = steps;
4 | this.routes = routes;
5 | this.pages = pages;
6 | this.topSteps = topSteps;
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/data/models/Page.js:
--------------------------------------------------------------------------------
1 | export class Page {
2 | constructor( { path, title, Component, icon } ) {
3 | this.path = path;
4 | this.title = title;
5 | this.Component = Component;
6 | this.icon = icon;
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/data/models/PseudoStep.js:
--------------------------------------------------------------------------------
1 | import { Step } from './Step';
2 |
3 | export class PseudoStep extends Step {
4 | constructor( { path, title, icon, drawerView, sidebars, data } ) {
5 | super( {
6 | path,
7 | title,
8 | Component: null,
9 | icon,
10 | drawerView,
11 | sidebars,
12 | data,
13 | } );
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/data/models/Step.js:
--------------------------------------------------------------------------------
1 | export class Step {
2 | constructor( {
3 | slug,
4 | path,
5 | title,
6 | Component,
7 | icon,
8 | drawerView,
9 | sidebars,
10 | header,
11 | data,
12 | drawerNavigation,
13 | } ) {
14 | this.slug = slug;
15 | this.path = path;
16 | this.title = title;
17 | this.Component = Component;
18 | this.icon = icon;
19 | this.drawerView = drawerView;
20 | this.sidebars = sidebars;
21 | this.data = data;
22 | this.header = header;
23 | this.drawerNavigation = drawerNavigation ?? true;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/data/translations/index.js:
--------------------------------------------------------------------------------
1 | import { _x } from '@wordpress/i18n';
2 | import { DEFAULT_FLOW, ECOMMERCE_FLOW, SITEGEN_FLOW } from '../flows/constants';
3 |
4 | export const translationMap = {
5 | [ DEFAULT_FLOW ]: {
6 | site: {
7 | noun: _x( 'site', 'noun', 'wp-module-onboarding' ),
8 | },
9 | website: {
10 | noun: _x( 'website', 'noun', 'wp-module-onboarding' ),
11 | },
12 | },
13 | [ ECOMMERCE_FLOW ]: {
14 | site: {
15 | noun: _x( 'store', 'noun', 'wp-module-onboarding' ),
16 | },
17 | website: {
18 | noun: _x( 'store', 'noun', 'wp-module-onboarding' ),
19 | },
20 | },
21 | [ SITEGEN_FLOW ]: {
22 | site: {
23 | noun: _x( 'site', 'noun', 'wp-module-onboarding' ),
24 | },
25 | website: {
26 | noun: _x( 'website', 'noun', 'wp-module-onboarding' ),
27 | },
28 | },
29 | };
30 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/pages/ErrorPage/contents.js:
--------------------------------------------------------------------------------
1 | import { __ } from '@wordpress/i18n';
2 |
3 | const getContents = () => {
4 | return {
5 | heading: __( 'Error 404', 'wp-module-onboarding' ),
6 | subheading: __( 'Please Check Again!', 'wp-module-onboarding' ),
7 | };
8 | };
9 |
10 | export default getContents;
11 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/pages/ErrorPage/page.js:
--------------------------------------------------------------------------------
1 | import { __ } from '@wordpress/i18n';
2 | import { redo } from '@wordpress/icons';
3 | import ErrorPage from '.';
4 | import { Page } from '../../data/models/Page';
5 |
6 | export const errorPage = new Page( {
7 | path: '*',
8 | title: __( 'Error 404', 'wp-module-onboarding' ),
9 | Component: ErrorPage,
10 | Icon: redo,
11 | } );
12 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/pages/IndexPage/index.js:
--------------------------------------------------------------------------------
1 | import { Fragment, useEffect } from '@wordpress/element';
2 |
3 | import { store as nfdOnboardingStore } from '../../store';
4 | import { useNavigate } from 'react-router-dom';
5 | import { useSelect } from '@wordpress/data';
6 |
7 | const IndexPage = () => {
8 | const navigate = useNavigate();
9 | const { firstStep } = useSelect( ( select ) => {
10 | return {
11 | firstStep: select( nfdOnboardingStore ).getFirstStep(),
12 | };
13 | }, [] );
14 |
15 | useEffect( () => {
16 | navigate( firstStep.path, {
17 | replace: true,
18 | state: { origin: 'index-redirect' },
19 | } );
20 | } );
21 |
22 | return ;
23 | };
24 |
25 | export default IndexPage;
26 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/pages/IndexPage/page.js:
--------------------------------------------------------------------------------
1 | import IndexPage from '.';
2 | import { Page } from '../../data/models/Page';
3 |
4 | export const indexPage = new Page( {
5 | path: '/',
6 | title: '',
7 | Component: IndexPage,
8 | Icon: <>>,
9 | } );
10 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/static/icons/back.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/static/icons/chevron-down.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/static/icons/chevron-left.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/static/icons/chevron-right.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/static/icons/chevron-up.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/static/icons/design.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/static/icons/equalizer.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/static/icons/forward.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/static/icons/more.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/static/icons/publish.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/static/icons/reload.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/static/icons/site-features/bookingcalendar.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/static/icons/site-features/comingsoon.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/static/icons/site-features/email.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/static/icons/site-features/filter.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/static/icons/site-features/search.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/static/icons/site-features/wishlist.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/static/icons/sitegen/favorite-filled.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/static/icons/sitegen/heart-filled.svg:
--------------------------------------------------------------------------------
1 |
11 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/static/icons/sitegen/image-upload.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/static/icons/sitegen/radio-checked.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/static/icons/sitegen/radio-unchecked.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/static/icons/sitegen/settings-dark.svg:
--------------------------------------------------------------------------------
1 |
9 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/static/icons/sitegen/settings.svg:
--------------------------------------------------------------------------------
1 |
9 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/static/icons/sitegen/sitegen-ai-icon.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/static/icons/sitegen/toggle-light-mode.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/newfold-labs/wp-module-onboarding/65fbf5135aa97d87653d5b5ba9e52d6f5dfa43ab/src/OnboardingSPA/static/icons/sitegen/toggle-light-mode.png
--------------------------------------------------------------------------------
/src/OnboardingSPA/static/icons/social/facebook.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/static/icons/social/linkedin.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/static/icons/social/tiktok.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/static/icons/social/twitter.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/static/icons/social/youtube.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/static/images/content.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/newfold-labs/wp-module-onboarding/65fbf5135aa97d87653d5b5ba9e52d6f5dfa43ab/src/OnboardingSPA/static/images/content.png
--------------------------------------------------------------------------------
/src/OnboardingSPA/static/images/design.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/newfold-labs/wp-module-onboarding/65fbf5135aa97d87653d5b5ba9e52d6f5dfa43ab/src/OnboardingSPA/static/images/design.png
--------------------------------------------------------------------------------
/src/OnboardingSPA/static/images/features.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/newfold-labs/wp-module-onboarding/65fbf5135aa97d87653d5b5ba9e52d6f5dfa43ab/src/OnboardingSPA/static/images/features.png
--------------------------------------------------------------------------------
/src/OnboardingSPA/static/images/help.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/newfold-labs/wp-module-onboarding/65fbf5135aa97d87653d5b5ba9e52d6f5dfa43ab/src/OnboardingSPA/static/images/help.png
--------------------------------------------------------------------------------
/src/OnboardingSPA/static/images/sitegen/ai_bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/newfold-labs/wp-module-onboarding/65fbf5135aa97d87653d5b5ba9e52d6f5dfa43ab/src/OnboardingSPA/static/images/sitegen/ai_bg.png
--------------------------------------------------------------------------------
/src/OnboardingSPA/static/images/sitegen/ai_bg_low.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/newfold-labs/wp-module-onboarding/65fbf5135aa97d87653d5b5ba9e52d6f5dfa43ab/src/OnboardingSPA/static/images/sitegen/ai_bg_low.png
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/BasicInfo/step.js:
--------------------------------------------------------------------------------
1 | import { info } from '@wordpress/icons';
2 | import { Step } from '../../data/models/Step';
3 | import { lazy } from '@wordpress/element';
4 | import LearnMore from './Sidebar/LearnMore';
5 | import { __, sprintf } from '@wordpress/i18n';
6 | import { translations } from '../../utils/locales/translations';
7 | import { VIEW_NAV_PRIMARY } from '../../../constants';
8 |
9 | const StepBasicInfo = lazy( () => import( './index' ) );
10 |
11 | export const stepBasicInfo = new Step( {
12 | slug: 'basic-info',
13 | path: '/wp-setup/step/basic-info',
14 | title: __( 'Basic Info', 'wp-module-onboarding' ),
15 | Component: StepBasicInfo,
16 | icon: info,
17 | drawerView: VIEW_NAV_PRIMARY,
18 | sidebars: {
19 | LearnMore: {
20 | SidebarComponents: [ LearnMore ],
21 | },
22 | },
23 | data: {
24 | tooltipText: sprintf(
25 | /* translators: %s: website or store */
26 | __( 'Introduce us to this %s', 'wp-module-onboarding' ),
27 | translations( 'website' )
28 | ),
29 | },
30 | } );
31 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/BasicInfo/stylesheet.scss:
--------------------------------------------------------------------------------
1 | .basic-info {
2 | display: flex;
3 | align-items: center;
4 | flex-direction: column;
5 | justify-content: center;
6 |
7 | &-form {
8 | width: 90vw;
9 | display: flex;
10 | padding-top: 20px;
11 | flex-direction: column;
12 |
13 | &__left {
14 | flex: 1;
15 | margin: 3vw;
16 | }
17 |
18 | &__right {
19 | flex: 1;
20 | margin: 3vw;
21 | }
22 |
23 | @include break-xlarge() {
24 | width: 70vw;
25 | flex-direction: row;
26 | justify-content: center;
27 | }
28 | }
29 | }
30 |
31 | .error {
32 |
33 | &__show {
34 | display: inline-block;
35 | text-align: center;
36 | border-radius: 6px;
37 | padding: 20px;
38 | background-color: rgba(255, 0, 0, 0.3);
39 | }
40 |
41 | &__hide {
42 | display: none;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/Complete/step.js:
--------------------------------------------------------------------------------
1 | import { lazy } from '@wordpress/element';
2 | import { Step } from '../../data/models/Step';
3 |
4 | const StepComplete = lazy( () => import( './index' ) );
5 |
6 | export const stepComplete = new Step( {
7 | slug: 'complete',
8 | path: '/wp-setup/step/complete',
9 | Component: StepComplete,
10 | } );
11 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/DesignColors/step.js:
--------------------------------------------------------------------------------
1 | import { lazy } from '@wordpress/element';
2 | import { __ } from '@wordpress/i18n';
3 | import { Step } from '../../data/models/Step';
4 | import { color } from '@wordpress/icons';
5 | import LearnMore from './Sidebar/LearnMore';
6 | import { VIEW_DESIGN_COLORS } from '../../../constants';
7 |
8 | const StepDesignColors = lazy( () => import( './index' ) );
9 |
10 | export const stepDesignColors = new Step( {
11 | slug: 'design-colors',
12 | path: '/wp-setup/step/design/colors',
13 | title: __( 'Colors', 'wp-module-onboarding' ),
14 | Component: StepDesignColors,
15 | icon: color,
16 | drawerView: VIEW_DESIGN_COLORS,
17 | sidebars: {
18 | LearnMore: {
19 | SidebarComponents: [ LearnMore ],
20 | },
21 | },
22 | data: {
23 | tooltipText: __( "What's your color palette?", 'wp-module-onboarding' ),
24 | patternId: 'theme-styles',
25 | },
26 | } );
27 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/DesignColors/stylesheet.scss:
--------------------------------------------------------------------------------
1 | .theme-colors-preview {
2 | flex: 1;
3 | width: 100%;
4 | display: flex;
5 | align-items: center;
6 | flex-direction: column;
7 | justify-content: center;
8 | background-color: var(--nfd-onboarding-light-gray-5);
9 | padding-top: 20px;
10 |
11 | &__title-bar {
12 | width: 70%;
13 | height: 15px;
14 | display: flex;
15 | align-items: center;
16 | background-color: var(--nfd-onboarding-light-gray-8);
17 | justify-content: space-between;
18 | border: 1px solid transparent;
19 |
20 | &__browser {
21 | display: flex;
22 | align-items: center;
23 | justify-content: center;
24 |
25 | &__dot {
26 | background-color: #989ea7;
27 | width: 8px;
28 | margin: 3px;
29 | height: 8px;
30 | border-radius: 50%;
31 | display: inline-block;
32 | }
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/DesignFonts/step.js:
--------------------------------------------------------------------------------
1 | import { lazy } from '@wordpress/element';
2 | import { __ } from '@wordpress/i18n';
3 | import { Step } from '../../data/models/Step';
4 | import { typography as fonts } from '@wordpress/icons';
5 | import LearnMore from './Sidebar/LearnMore';
6 | import { VIEW_DESIGN_FONTS } from '../../../constants';
7 |
8 | const StepDesignFonts = lazy( () => import( './index' ) );
9 |
10 | export const stepDesignFonts = new Step( {
11 | slug: 'design-typography',
12 | path: '/wp-setup/step/design/typography',
13 | title: __( 'Fonts', 'wp-module-onboarding' ),
14 | Component: StepDesignFonts,
15 | icon: fonts,
16 | drawerView: VIEW_DESIGN_FONTS,
17 | sidebars: {
18 | LearnMore: {
19 | SidebarComponents: [ LearnMore ],
20 | },
21 | },
22 | data: {
23 | tooltipText: __( "What's your font style?", 'wp-module-onboarding' ),
24 | patternId: 'theme-styles',
25 | },
26 | } );
27 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/DesignFonts/stylesheet.scss:
--------------------------------------------------------------------------------
1 | .theme-fonts-preview {
2 | flex: 1;
3 | width: 100%;
4 | display: flex;
5 | align-items: center;
6 | flex-direction: column;
7 | justify-content: center;
8 | background-color: var(--nfd-onboarding-light-gray-5);
9 | padding-top: 20px;
10 |
11 | &__title-bar {
12 | width: 70%;
13 | height: 15px;
14 | display: flex;
15 | align-items: center;
16 | background-color: var(--nfd-onboarding-light-gray-8);
17 | justify-content: space-between;
18 | border: 1px solid transparent;
19 |
20 | &__browser {
21 | display: flex;
22 | align-items: center;
23 | justify-content: center;
24 |
25 | &__dot {
26 | background-color: #989ea7;
27 | width: 8px;
28 | margin: 3px;
29 | height: 8px;
30 | border-radius: 50%;
31 | display: inline-block;
32 | }
33 | }
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/DesignHeaderMenu/step.js:
--------------------------------------------------------------------------------
1 | import { header } from '@wordpress/icons';
2 | import { lazy } from '@wordpress/element';
3 | import { __ } from '@wordpress/i18n';
4 | import { Step } from '../../data/models/Step';
5 | import LearnMore from './Sidebar/LearnMore';
6 | import { VIEW_DESIGN_HEADER_MENU } from '../../../constants';
7 |
8 | const StepDesignHeaderMenu = lazy( () => import( './index' ) );
9 |
10 | export const stepDesignHeaderMenu = new Step( {
11 | slug: 'design-header-menu',
12 | path: '/wp-setup/step/design/header-menu',
13 | title: __( 'Header & Menu', 'wp-module-onboarding' ),
14 | Component: StepDesignHeaderMenu,
15 | icon: header,
16 | drawerView: VIEW_DESIGN_HEADER_MENU,
17 | sidebars: {
18 | LearnMore: {
19 | SidebarComponents: [ LearnMore ],
20 | },
21 | },
22 | data: {
23 | tooltipText: __(
24 | "Let's make the right things visible",
25 | 'wp-module-onboarding'
26 | ),
27 | patternId: 'header-menu',
28 | },
29 | } );
30 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/DesignHeaderMenu/stylesheet.scss:
--------------------------------------------------------------------------------
1 | .theme-header-menu-preview {
2 | flex: 1;
3 | width: 100%;
4 | display: flex;
5 | align-items: center;
6 | flex-direction: column;
7 | justify-content: center;
8 | background-color: var(--nfd-onboarding-light-gray-5);
9 | padding-top: 20px;
10 |
11 | &__title-bar {
12 | width: 70%;
13 | height: 15px;
14 | display: flex;
15 | align-items: center;
16 | background-color: var(--nfd-onboarding-light-gray-8);
17 | justify-content: space-between;
18 | border: 1px solid transparent;
19 |
20 | &__browser {
21 | display: flex;
22 | align-items: center;
23 | justify-content: center;
24 |
25 | &__dot {
26 | background-color: #989ea7;
27 | width: 8px;
28 | margin: 3px;
29 | height: 8px;
30 | border-radius: 50%;
31 | display: inline-block;
32 | }
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/DesignHomepageMenu/contents.js:
--------------------------------------------------------------------------------
1 | import { __ } from '@wordpress/i18n';
2 |
3 | const getContents = () => {
4 | return {
5 | heading: __(
6 | 'There’s no place like a great home page',
7 | 'wp-module-onboarding'
8 | ),
9 | subheading: __(
10 | 'Pick a starter layout you can refine and remix with your content',
11 | 'wp-module-onboarding'
12 | ),
13 | };
14 | };
15 |
16 | export default getContents;
17 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/DesignHomepageMenu/step.js:
--------------------------------------------------------------------------------
1 | import { pages } from '@wordpress/icons';
2 | import { lazy } from '@wordpress/element';
3 | import { __ } from '@wordpress/i18n';
4 | import { Step } from '../../data/models/Step';
5 | import LearnMore from './Sidebar/LearnMore';
6 | import { VIEW_NAV_DESIGN } from '../../../constants';
7 |
8 | const StepDesignHomepageMenu = lazy( () => import( './index' ) );
9 |
10 | export const stepDesignHomepageMenu = new Step( {
11 | slug: 'design-homepage-menu',
12 | path: '/wp-setup/step/design/homepage-menu',
13 | title: __( 'Homepage Layouts', 'wp-module-onboarding' ),
14 | Component: StepDesignHomepageMenu,
15 | icon: pages,
16 | drawerView: VIEW_NAV_DESIGN,
17 | sidebars: {
18 | LearnMore: {
19 | SidebarComponents: [ LearnMore ],
20 | },
21 | },
22 | data: {
23 | patternId: 'homepage-styles',
24 | tooltipText: __(
25 | 'There’s no place like a great home page',
26 | 'wp-module-onboarding'
27 | ),
28 | },
29 | } );
30 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/DesignThemeStyles/Menu/step.js:
--------------------------------------------------------------------------------
1 | import { styles } from '@wordpress/icons';
2 | import { lazy } from '@wordpress/element';
3 | import { __ } from '@wordpress/i18n';
4 | import { Step } from '../../../data/models/Step';
5 | import LearnMore from './Sidebar/LearnMore';
6 | import { VIEW_NAV_DESIGN } from '../../../../constants';
7 |
8 | const StepDesignThemeStylesMenu = lazy( () => import( './index' ) );
9 |
10 | export const stepDesignThemeStylesMenu = new Step( {
11 | slug: 'design-theme-styles-menu',
12 | path: '/wp-setup/step/design/theme-styles/menu',
13 | title: __( 'Theme Styles', 'wp-module-onboarding' ),
14 | Component: StepDesignThemeStylesMenu,
15 | icon: styles,
16 | drawerView: VIEW_NAV_DESIGN,
17 | sidebars: {
18 | LearnMore: {
19 | SidebarComponents: [ LearnMore ],
20 | },
21 | },
22 | data: {
23 | designDrawerActiveLinkIncludes: '/wp-setup/step/design/theme-styles/',
24 | patternId: 'theme-styles',
25 | },
26 | } );
27 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/DesignThemeStyles/Preview/step.js:
--------------------------------------------------------------------------------
1 | import { styles } from '@wordpress/icons';
2 | import { lazy } from '@wordpress/element';
3 | import { __ } from '@wordpress/i18n';
4 | import { Step } from '../../../data/models/Step';
5 | import LearnMore from './Sidebar/LearnMore';
6 | import { VIEW_DESIGN_THEME_STYLES_PREVIEW } from '../../../../constants';
7 |
8 | const StepDesignThemeStylesPreview = lazy( () => import( './index' ) );
9 |
10 | export const stepDesignThemeStylesPreview = new Step( {
11 | slug: 'design-theme-styles-preview',
12 | path: '/wp-setup/step/design/theme-styles/preview',
13 | title: __( 'Theme Styles', 'wp-module-onboarding' ),
14 | Component: StepDesignThemeStylesPreview,
15 | icon: styles,
16 | drawerView: VIEW_DESIGN_THEME_STYLES_PREVIEW,
17 | sidebars: {
18 | LearnMore: {
19 | SidebarComponents: [ LearnMore ],
20 | },
21 | },
22 | data: {
23 | designDrawerActiveLinkIncludes: '/wp-setup/step/design/theme-styles/',
24 | patternId: 'theme-styles',
25 | },
26 | } );
27 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/DesignThemeStyles/contents.js:
--------------------------------------------------------------------------------
1 | import { __ } from '@wordpress/i18n';
2 |
3 | const getContents = () => {
4 | return {
5 | heading: __(
6 | 'Lets tailor your theme for the perfect fit',
7 | 'wp-module-onboarding'
8 | ),
9 | subheading: __(
10 | 'Start with a style preset or',
11 | 'wp-module-onboarding'
12 | ),
13 | /* translators: build a custom design is a link, this would be concatenated with "Start with a style preset or" making it
14 | "Start with a style preset or build a custom design."*/
15 | subheading_link: __( 'build a custom design.', 'wp-module-onboarding' ),
16 | checkbox_label: __(
17 | 'Customize Colors & Fonts?',
18 | 'wp-module-onboarding'
19 | ),
20 | checkbox_hint: __(
21 | 'Check to customize in the next few steps (or leave empty and use the Site Editor later)',
22 | 'wp-module-onboarding'
23 | ),
24 | };
25 | };
26 |
27 | export default getContents;
28 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/DesignThemeStyles/stylesheet.scss:
--------------------------------------------------------------------------------
1 | @import "./Menu/stylesheet";
2 | @import "./Preview/stylesheet";
3 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/Ecommerce/StepAddress/contents.js:
--------------------------------------------------------------------------------
1 | import { __ } from '@wordpress/i18n';
2 |
3 | const getContents = () => {
4 | return {
5 | heading: __(
6 | 'Confirm your business or store address',
7 | 'wp-module-onboarding'
8 | ),
9 | subheading: __(
10 | 'We’ll use this information to help you setup your online store',
11 | 'wp-module-onboarding'
12 | ),
13 | countryInputLabel: __(
14 | 'Where is your store based?',
15 | 'wp-module-onboarding'
16 | ),
17 | addressInputLabel: __( 'Address', 'wp-module-onboarding' ),
18 | cityInputLabel: __( 'City', 'wp-module-onboarding' ),
19 | stateInputLabel: __( 'State', 'wp-module-onboarding' ),
20 | postalCodeInputLabel: __( 'Postal Code', 'wp-module-onboarding' ),
21 | emailInputLabel: __( 'Email', 'wp-module-onboarding' ),
22 | currencyInputLabel: __(
23 | 'What currency do you want to display in your store?',
24 | 'wp-module-onboarding'
25 | ),
26 | requiredText: __( '* required', 'wp-module-onboarding' ),
27 | buttonText: __( 'Continue Setup', 'wp-module-onboarding' ),
28 | };
29 | };
30 |
31 | export default getContents;
32 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/Ecommerce/StepAddress/step.js:
--------------------------------------------------------------------------------
1 | import { store } from '@wordpress/icons';
2 | import { lazy } from '@wordpress/element';
3 | import { __ } from '@wordpress/i18n';
4 | import { Step } from '../../../data/models/Step';
5 | import LearnMore from './Sidebar/LearnMore';
6 | import { VIEW_NAV_ECOMMERCE_STORE_INFO } from '../../../../constants';
7 |
8 | const StepAddress = lazy( () => import( './index' ) );
9 |
10 | export const stepAddress = new Step( {
11 | slug: 'ecommerce-address',
12 | path: '/ecommerce/step/address',
13 | title: __( 'Street Address', 'wp-module-onboarding' ),
14 | Component: StepAddress,
15 | icon: store,
16 | drawerView: VIEW_NAV_ECOMMERCE_STORE_INFO,
17 | sidebars: {
18 | LearnMore: {
19 | SidebarComponents: [ LearnMore ],
20 | },
21 | },
22 | data: {
23 | tooltipText: __( 'Street Address', 'wp-module-onboarding' ),
24 | },
25 | } );
26 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/Ecommerce/StepProducts/step.js:
--------------------------------------------------------------------------------
1 | import { shipping } from '@wordpress/icons';
2 | import { lazy } from '@wordpress/element';
3 | import { __ } from '@wordpress/i18n';
4 | import { Step } from '../../../data/models/Step';
5 | import LearnMore from './Sidebar/LearnMore';
6 | import { VIEW_NAV_ECOMMERCE_STORE_INFO } from '../../../../constants';
7 |
8 | const StepProducts = lazy( () => import( './index' ) );
9 |
10 | export const stepProducts = new Step( {
11 | slug: 'ecommerce-products',
12 | path: '/ecommerce/step/products',
13 | title: __( 'Product Info', 'wp-module-onboarding' ),
14 | Component: StepProducts,
15 | icon: shipping,
16 | drawerView: VIEW_NAV_ECOMMERCE_STORE_INFO,
17 | sidebars: {
18 | LearnMore: {
19 | SidebarComponents: [ LearnMore ],
20 | },
21 | },
22 | data: {
23 | tooltipText: __( 'Product Info', 'wp-module-onboarding' ),
24 | },
25 | } );
26 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/Ecommerce/StepTax/step.js:
--------------------------------------------------------------------------------
1 | import { institution } from '@wordpress/icons';
2 | import { lazy } from '@wordpress/element';
3 | import { __ } from '@wordpress/i18n';
4 | import { Step } from '../../../data/models/Step';
5 | import LearnMore from './Sidebar/LearnMore';
6 | import { VIEW_NAV_ECOMMERCE_STORE_INFO } from '../../../../constants';
7 |
8 | const StepTax = lazy( () => import( './index' ) );
9 |
10 | export const stepTax = new Step( {
11 | slug: 'ecommerce-tax',
12 | path: '/ecommerce/step/tax',
13 | title: __( 'Tax Info', 'wp-module-onboarding' ),
14 | Component: StepTax,
15 | icon: institution,
16 | drawerView: VIEW_NAV_ECOMMERCE_STORE_INFO,
17 | sidebars: {
18 | LearnMore: {
19 | SidebarComponents: [ LearnMore ],
20 | },
21 | },
22 | data: {
23 | tooltipText: __( 'Tax Info', 'wp-module-onboarding' ),
24 | },
25 | } );
26 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/Ecommerce/useWPSettings.js:
--------------------------------------------------------------------------------
1 | import { fetchWPSettings } from '../../utils/api/ecommerce';
2 |
3 | export async function useWPSettings() {
4 | const settings = await fetchWPSettings().catch( () => ( {} ) );
5 | return settings;
6 | }
7 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/GetStarted/GetStartedExperience/contents.js:
--------------------------------------------------------------------------------
1 | import { __, sprintf } from '@wordpress/i18n';
2 |
3 | import { translations } from '../../../utils/locales/translations';
4 |
5 | const getContents = () => {
6 | return {
7 | heading: sprintf(
8 | /* translators: %s: website or store */
9 | __(
10 | 'Help us tailor this setup to your %s',
11 | 'wp-module-onboarding'
12 | ),
13 | translations( 'site' )
14 | ),
15 | subheading: __( 'ABOUT YOU', 'wp-module-onboarding' ),
16 | question: __(
17 | 'What is your experience with WordPress?',
18 | 'wp-module-onboarding'
19 | ),
20 | buttonText: __( 'Continue Setup', 'wp-module-onboarding' ),
21 | options: [
22 | {
23 | label: __( 'Never used it', 'wp-module-onboarding' ),
24 | slug: 'novice',
25 | value: '1',
26 | },
27 | {
28 | label: __( 'Used it some', 'wp-module-onboarding' ),
29 | slug: 'intermediate',
30 | value: '3',
31 | },
32 | {
33 | label: __( "I'm an expert", 'wp-module-onboarding' ),
34 | slug: 'expert',
35 | value: '5',
36 | },
37 | ],
38 | };
39 | };
40 |
41 | export default getContents;
42 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/GetStarted/GetStartedExperience/step.js:
--------------------------------------------------------------------------------
1 | import { home } from '@wordpress/icons';
2 | import { lazy } from '@wordpress/element';
3 | import LearnMore from './Sidebar/LearnMore';
4 | import { __ } from '@wordpress/i18n';
5 | import { Step } from '../../../data/models/Step';
6 | import { VIEW_NAV_GET_STARTED } from '../../../../constants';
7 |
8 | const GetStartedExperience = lazy( () => import( './index' ) );
9 |
10 | export const stepExperience = new Step( {
11 | slug: 'get-started-experience',
12 | path: '/wp-setup/step/get-started/experience',
13 | title: __( 'WordPress Experience', 'wp-module-onboarding' ),
14 | Component: GetStartedExperience,
15 | icon: home,
16 | drawerView: VIEW_NAV_GET_STARTED,
17 | sidebars: {
18 | LearnMore: {
19 | SidebarComponents: [ LearnMore ],
20 | },
21 | },
22 | } );
23 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/GetStarted/GetStartedExperience/stylesheet.scss:
--------------------------------------------------------------------------------
1 | .nfd-onboarding-experience-step {
2 | display: flex;
3 | align-items: center;
4 | width: 100%;
5 | flex-direction: column;
6 |
7 | &-tabs label {
8 | border: 1px solid var(--nfd-onboarding-base-gray);
9 | display: flex;
10 | justify-content: flex-start;
11 | padding: 10px 190px 10px 15px;
12 | color: var(--nfd-onboarding-black);
13 | background: var(--nfd-onboarding-base-gray);
14 | font-weight: 350;
15 | font-size: clamp(1rem, 0.92rem + 0.38vw, 1.875rem);
16 | line-height: 1.5;
17 | margin: 5px;
18 | white-space: nowrap;
19 |
20 | @media (max-width: #{ ($break-medium) - 1 }) {
21 | padding-right: 100px;
22 | }
23 |
24 | }
25 |
26 | &-tabs input:checked + label {
27 | color: var(--nfd-onboarding-white);
28 | background: var(--wp-admin-theme-color-darker-10);
29 | border: none;
30 | }
31 |
32 | .components-radio-control {
33 |
34 | &__input input {
35 | display: none !important;
36 | }
37 | margin: 32px 0 48px;
38 | align-items: center;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/GetStarted/SiteTypeSetup/PrimarySite/step.js:
--------------------------------------------------------------------------------
1 | import { moveTo } from '@wordpress/icons';
2 | import { lazy } from '@wordpress/element';
3 | import LearnMore from './Sidebar/LearnMore';
4 | import { __, sprintf } from '@wordpress/i18n';
5 | import { Step } from '../../../../data/models/Step';
6 | import { translations } from '../../../../utils/locales/translations';
7 |
8 | const StepPrimarySetup = lazy( () => import( './index' ) );
9 |
10 | export const stepPrimarySetup = new Step( {
11 | slug: 'get-started-site-primary',
12 | path: '/wp-setup/step/get-started/site-primary',
13 | title: sprintf(
14 | /* translators: %s: website or store */
15 | __( 'Primary %s Setup', 'wp-module-onboarding' ),
16 | translations( 'Site' )
17 | ),
18 | Component: StepPrimarySetup,
19 | icon: moveTo,
20 | sidebars: {
21 | LearnMore: {
22 | SidebarComponents: [ LearnMore ],
23 | },
24 | },
25 | } );
26 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/GetStarted/SiteTypeSetup/SecondarySite/step.js:
--------------------------------------------------------------------------------
1 | import { moveTo } from '@wordpress/icons';
2 | import { lazy } from '@wordpress/element';
3 | import LearnMore from './Sidebar/LearnMore';
4 | import { __, sprintf } from '@wordpress/i18n';
5 | import { Step } from '../../../../data/models/Step';
6 | import { translations } from '../../../../utils/locales/translations';
7 |
8 | const StepSecondaryStep = lazy( () => import( './index' ) );
9 |
10 | export const stepSecondarySetup = new Step( {
11 | slug: 'get-started-site-secondary',
12 | path: '/wp-setup/step/get-started/site-secondary',
13 | title: sprintf(
14 | /* translators: %s: website or store */
15 | __( 'Secondary %s Setup', 'wp-module-onboarding' ),
16 | translations( 'Site' )
17 | ),
18 | Component: StepSecondaryStep,
19 | icon: moveTo,
20 | sidebars: {
21 | LearnMore: {
22 | SidebarComponents: [ LearnMore ],
23 | },
24 | },
25 | } );
26 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/GetStarted/SiteTypeSetup/contents.js:
--------------------------------------------------------------------------------
1 | import { __, sprintf } from '@wordpress/i18n';
2 |
3 | import { translations } from '../../../utils/locales/translations';
4 |
5 | const getContents = () => {
6 | return {
7 | heading: sprintf(
8 | /* translators: %s: website or store */
9 | __(
10 | 'Help us tailor this setup to your %s',
11 | 'wp-module-onboarding'
12 | ),
13 | translations( 'site' )
14 | ),
15 | subheading: sprintf(
16 | /* translators: %s: SITE or STORE */
17 | __( 'ABOUT YOUR %s', 'wp-module-onboarding' ),
18 | translations( 'SITE' )
19 | ),
20 | question: sprintf(
21 | /* translators: %s: site or store */
22 | __( 'What type of %s is it?', 'wp-module-onboarding' ),
23 | translations( 'site' )
24 | ),
25 | buttonText: __( 'Continue Setup', 'wp-module-onboarding' ),
26 | customInputPlaceholderText: sprintf(
27 | /* translators: %s: site or store */
28 | __( 'Enter to search your %s type', 'wp-module-onboarding' ),
29 | translations( 'site' )
30 | ),
31 | customInputLabel: __( 'or tell us here:', 'wp-module-onboarding' ),
32 | };
33 | };
34 |
35 | export default getContents;
36 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/GetStarted/Welcome/step.js:
--------------------------------------------------------------------------------
1 | import { home } from '@wordpress/icons';
2 | import { lazy } from '@wordpress/element';
3 | import LearnMore from './Sidebar/LearnMore';
4 | import { __ } from '@wordpress/i18n';
5 | import { Step } from '../../../data/models/Step';
6 | import { VIEW_NAV_GET_STARTED } from '../../../../constants';
7 |
8 | const StepWelcome = lazy( () => import( './index' ) );
9 |
10 | export const stepWelcome = new Step( {
11 | slug: 'get-started-welcome',
12 | path: '/wp-setup/step/get-started/welcome',
13 | title: __( 'Welcome', 'wp-module-onboarding' ),
14 | Component: StepWelcome,
15 | icon: home,
16 | drawerView: VIEW_NAV_GET_STARTED,
17 | sidebars: {
18 | LearnMore: {
19 | SidebarComponents: [ LearnMore ],
20 | },
21 | },
22 | data: {
23 | tooltipText: __( 'Welcome', 'wp-module-onboarding' ),
24 | },
25 | } );
26 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/GetStarted/index.js:
--------------------------------------------------------------------------------
1 | import { useEffect } from '@wordpress/element';
2 | import { useLocation } from 'react-router-dom';
3 | import { useDispatch } from '@wordpress/data';
4 |
5 | import { store as nfdOnboardingStore } from '../../store';
6 | import CommonLayout from '../../components/Layouts/Common';
7 | import NewfoldLargeCard from '../../components/NewfoldLargeCard';
8 | import { SIDEBAR_LEARN_MORE, VIEW_NAV_GET_STARTED } from '../../../constants';
9 |
10 | const StepGetStarted = () => {
11 | const location = useLocation();
12 |
13 | const { setSidebarActiveView } = useDispatch( nfdOnboardingStore );
14 |
15 | useEffect( () => {
16 | setSidebarActiveView( SIDEBAR_LEARN_MORE );
17 | }, [] );
18 |
19 | useEffect( () => {}, [ location ] );
20 |
21 | const { setDrawerActiveView, setIsDrawerOpened } =
22 | useDispatch( nfdOnboardingStore );
23 |
24 | useEffect( () => {
25 | setIsDrawerOpened( false );
26 | setDrawerActiveView( VIEW_NAV_GET_STARTED );
27 | }, [] );
28 |
29 | return (
30 |
31 |
32 |
33 | );
34 | };
35 |
36 | export default StepGetStarted;
37 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/SiteFeatures/contents.js:
--------------------------------------------------------------------------------
1 | import { __ } from '@wordpress/i18n';
2 |
3 | const getContents = () => {
4 | return {
5 | heading: __(
6 | 'Key features to supercharge your site',
7 | 'wp-module-onboarding'
8 | ),
9 | subheading: __(
10 | 'Our toolbox of Plugins & Services is your toolbox.',
11 | 'wp-module-onboarding'
12 | ),
13 | };
14 | };
15 |
16 | export default getContents;
17 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/SiteFeatures/step.js:
--------------------------------------------------------------------------------
1 | import { plugins } from '@wordpress/icons';
2 | import { lazy } from '@wordpress/element';
3 | import { __ } from '@wordpress/i18n';
4 | import { Step } from '../../data/models/Step';
5 | import LearnMore from './Sidebar/LearnMore';
6 |
7 | const StepSiteFeatures = lazy( () => import( './index' ) );
8 |
9 | export const stepSiteFeatures = new Step( {
10 | slug: 'site-features',
11 | path: '/wp-setup/step/site-features',
12 | title: __( 'Features', 'wp-module-onboarding' ),
13 | Component: StepSiteFeatures,
14 | icon: plugins,
15 | sidebars: {
16 | LearnMore: {
17 | SidebarComponents: [ LearnMore ],
18 | },
19 | },
20 | data: {
21 | tooltipText: __(
22 | 'Key features to supercharge your site',
23 | 'wp-module-onboarding'
24 | ),
25 | patternId: 'site-features',
26 | },
27 | } );
28 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/SiteFeatures/stylesheet.scss:
--------------------------------------------------------------------------------
1 | .site-features__heading {
2 | margin: 100px;
3 |
4 | @media (max-width: #{ ($break-medium) }) {
5 | margin: 0;
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/SiteGen/Editor/Sidebar/Customize/contents.js:
--------------------------------------------------------------------------------
1 | import { __ } from '@wordpress/i18n';
2 |
3 | const getContents = () => {
4 | return {
5 | introduction: {
6 | heading: __( 'Colors', 'wp-module-onboarding' ),
7 | },
8 | };
9 | };
10 |
11 | export default getContents;
12 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/SiteGen/Editor/step.js:
--------------------------------------------------------------------------------
1 | import { copy } from '@wordpress/icons';
2 | import { lazy } from '@wordpress/element';
3 | import { __ } from '@wordpress/i18n';
4 | import { Step } from '../../../data/models/Step';
5 | import StepSiteGenEditorHeader from './Header';
6 | import Customize from './Sidebar/Customize';
7 |
8 | const StepSiteGenEditor = lazy( () => import( './index' ) );
9 |
10 | export const stepSiteGenEditor = new Step( {
11 | slug: 'sitegen-editor',
12 | path: '/sitegen/step/editor',
13 | title: __( 'Page Layouts', 'wp-module-onboarding' ),
14 | Component: StepSiteGenEditor,
15 | icon: copy,
16 | sidebars: {
17 | Customize: {
18 | SidebarComponents: [ Customize ],
19 | },
20 | },
21 | header: StepSiteGenEditorHeader,
22 | } );
23 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/SiteGen/Experience/contents.js:
--------------------------------------------------------------------------------
1 | import { __ } from '@wordpress/i18n';
2 |
3 | const getContents = () => {
4 | return {
5 | heading: __(
6 | 'How familiar are you with using WordPress?',
7 | 'wp-module-onboarding'
8 | ),
9 | options: [
10 | {
11 | key: 1,
12 | title: __( 'Beginner', 'wp-module-onboarding' ),
13 | desc: __(
14 | 'First time building a website using WordPress',
15 | 'wp-module-onboarding'
16 | ),
17 | },
18 | {
19 | key: 2,
20 | title: __( 'Intermediate', 'wp-module-onboarding' ),
21 | desc: __(
22 | 'I’ve built a few sites for myself or others',
23 | 'wp-module-onboarding'
24 | ),
25 | },
26 | {
27 | key: 3,
28 | title: __( 'Expert', 'wp-module-onboarding' ),
29 | desc: __( 'I do this frequently', 'wp-module-onboarding' ),
30 | },
31 | ],
32 | };
33 | };
34 |
35 | export default getContents;
36 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/SiteGen/Experience/step.js:
--------------------------------------------------------------------------------
1 | import { copy } from '@wordpress/icons';
2 | import { lazy } from '@wordpress/element';
3 | import { __ } from '@wordpress/i18n';
4 | import { Step } from '../../../data/models/Step';
5 |
6 | const SiteGenExperience = lazy( () => import( './index' ) );
7 |
8 | export const stepSiteGenExperience = new Step( {
9 | slug: 'sitegen-experience',
10 | path: '/sitegen/step/experience',
11 | title: __( 'Page Layouts', 'wp-module-onboarding' ),
12 | Component: SiteGenExperience,
13 | icon: copy,
14 | sidebars: {
15 | LearnMore: {
16 | SidebarComponents: [],
17 | },
18 | },
19 | } );
20 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/SiteGen/Experience/stylesheet.scss:
--------------------------------------------------------------------------------
1 | .nfd-sg-experience-level {
2 | display: flex;
3 | align-items: center;
4 | flex-direction: column;
5 | justify-content: center;
6 |
7 | @media (max-width: #{ ($break-large) }) {
8 | margin-bottom: 70px;
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/SiteGen/Migration/contents.js:
--------------------------------------------------------------------------------
1 | import { __, sprintf } from '@wordpress/i18n';
2 |
3 | const getContents = ( currentBrandName ) => {
4 | return {
5 | heading: sprintf(
6 | /* translators: %s: to replace Brand name */
7 | __(
8 | "Let's migrate your existing site to %s",
9 | 'wp-module-onboarding'
10 | ),
11 | currentBrandName
12 | ),
13 | description: __(
14 | 'Please wait a few seconds while we get your new account ready to import your existing WordPress site. ',
15 | 'wp-module-onboarding'
16 | ),
17 | importText: __( 'Preparing your account', 'wp-module-onboarding' ),
18 | };
19 | };
20 |
21 | export default getContents;
22 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/SiteGen/Migration/step.js:
--------------------------------------------------------------------------------
1 | import { copy } from '@wordpress/icons';
2 | import { lazy } from '@wordpress/element';
3 | import { __ } from '@wordpress/i18n';
4 | import { Step } from '../../../data/models/Step';
5 |
6 | const StepSiteGenMigration = lazy( () => import( './index' ) );
7 |
8 | export const stepSiteGenMigration = new Step( {
9 | slug: 'sitegen-migration',
10 | path: '/sitegen/step/migration',
11 | title: __( 'Migration', 'wp-module-onboarding' ),
12 | Component: StepSiteGenMigration,
13 | icon: copy,
14 | drawerNavigation: false,
15 | sidebars: {
16 | LearnMore: {
17 | SidebarComponents: [],
18 | },
19 | },
20 | } );
21 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/SiteGen/Preview/contents.js:
--------------------------------------------------------------------------------
1 | import { __ } from '@wordpress/i18n';
2 |
3 | const getContents = () => {
4 | return {
5 | heading: __( 'Presto, here are 3 versions', 'wp-module-onboarding' ),
6 | subheading: __(
7 | "We've created 3 unique website designs for you to start with, preview click around or start over.",
8 | 'wp-module-onboarding'
9 | ),
10 | favouriteNote: __(
11 | 'Favorite a generated version to find and use again in the future.',
12 | 'wp-module-onboarding'
13 | ),
14 | generating: __( 'Generating Site', 'wp-module-onboarding' ),
15 | regenerating: __( 'Regenerating Site', 'wp-module-onboarding' ),
16 | };
17 | };
18 |
19 | export default getContents;
20 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/SiteGen/Preview/heartAnimation.js:
--------------------------------------------------------------------------------
1 | const HeartAnimation = () => {
2 | return (
3 |
19 | );
20 | };
21 |
22 | export default HeartAnimation;
23 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/SiteGen/Preview/regeneratingCard.js:
--------------------------------------------------------------------------------
1 | import { __ } from '@wordpress/i18n';
2 |
3 | function RegeneratingSiteCard( { count = 1, isRegenerating } ) {
4 | const cards = [];
5 | for ( let i = 0; i < count; i++ ) {
6 | cards.push(
7 |
8 |
9 |
10 | { isRegenerating
11 | ? __( 'Regenerating Site', 'wp-module-onboarding' )
12 | : __( 'Generating Site', 'wp-module-onboarding' ) }
13 |
14 |
15 | { /* Math.random() * (max - min) + min, Just depicting the max and min values */ }
16 |
24 |
25 |
26 |
27 | );
28 | }
29 |
30 | return <>{ cards }>;
31 | }
32 |
33 | export default RegeneratingSiteCard;
34 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/SiteGen/Preview/step.js:
--------------------------------------------------------------------------------
1 | import { copy } from '@wordpress/icons';
2 | import { lazy } from '@wordpress/element';
3 | import { __ } from '@wordpress/i18n';
4 | import { Step } from '../../../data/models/Step';
5 |
6 | const SiteGenPreview = lazy( () => import( './index' ) );
7 |
8 | export const stepSiteGenPreview = new Step( {
9 | slug: 'sitegen-preview',
10 | path: '/sitegen/step/preview',
11 | title: __( 'Page Layouts', 'wp-module-onboarding' ),
12 | Component: SiteGenPreview,
13 | icon: copy,
14 | sidebars: {
15 | LearnMore: {
16 | SidebarComponents: [],
17 | },
18 | },
19 | } );
20 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/SiteGen/SiteDetails/step.js:
--------------------------------------------------------------------------------
1 | import { copy } from '@wordpress/icons';
2 | import { lazy } from '@wordpress/element';
3 | import { __ } from '@wordpress/i18n';
4 | import { Step } from '../../../data/models/Step';
5 |
6 | const SiteGenSiteDetails = lazy( () => import( './index' ) );
7 |
8 | export const stepSiteGenSiteDetails = new Step( {
9 | slug: 'sitegen-site-details',
10 | path: '/sitegen/step/site-details',
11 | title: __( 'Site Details', 'wp-module-onboarding' ),
12 | Component: SiteGenSiteDetails,
13 | icon: copy,
14 | sidebars: {
15 | LearnMore: {
16 | SidebarComponents: [],
17 | },
18 | },
19 | } );
20 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/SiteGen/SiteLogo/contents.js:
--------------------------------------------------------------------------------
1 | import { __ } from '@wordpress/i18n';
2 |
3 | const getContents = () => {
4 | return {
5 | heading: __(
6 | 'Do you have a logo you would like to use for this site?',
7 | 'wp-module-onboarding'
8 | ),
9 | imageUploader: {
10 | subHeading: __(
11 | 'supports .jpg, .png, .svg',
12 | 'wp-module-onboarding'
13 | ),
14 | },
15 | buttons: {
16 | skip: __( 'Skip for now', 'wp-module-onboarding' ),
17 | next: __( 'Next', 'wp-module-onboarding' ),
18 | },
19 | };
20 | };
21 |
22 | export default getContents;
23 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/SiteGen/SiteLogo/step.js:
--------------------------------------------------------------------------------
1 | import { copy } from '@wordpress/icons';
2 | import { lazy } from '@wordpress/element';
3 | import { __ } from '@wordpress/i18n';
4 | import { Step } from '../../../data/models/Step';
5 |
6 | const SiteGenSiteLogo = lazy( () => import( './index' ) );
7 |
8 | export const stepSiteGenSiteLogo = new Step( {
9 | slug: 'sitegen-site-logo',
10 | path: '/sitegen/step/site-logo',
11 | title: __( 'Page Layouts', 'wp-module-onboarding' ),
12 | Component: SiteGenSiteLogo,
13 | icon: copy,
14 | sidebars: {
15 | LearnMore: {
16 | SidebarComponents: [],
17 | },
18 | },
19 | } );
20 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/SiteGen/SocialMedia/contents.js:
--------------------------------------------------------------------------------
1 | import { __ } from '@wordpress/i18n';
2 |
3 | const getContents = () => {
4 | return {
5 | heading: __(
6 | 'Do you want to include any content from Facebook?',
7 | 'wp-module-onboarding'
8 | ),
9 | facebookTitle: __(
10 | 'Connect a Facebook Account',
11 | 'wp-module-onboarding'
12 | ),
13 | facebookDesc: __(
14 | 'By connecting a Facebook profile, we can fetch relevant data to increase the accuracy of your AI generated site.',
15 | 'wp-module-onboarding'
16 | ),
17 | facebookButton: __( 'Connect Facebook', 'wp-module-onboarding' ),
18 | buttons: {
19 | skip: __( 'Skip for now', 'wp-module-onboarding' ),
20 | next: __( 'Next', 'wp-module-onboarding' ),
21 | },
22 | };
23 | };
24 |
25 | export default getContents;
26 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/SiteGen/SocialMedia/step.js:
--------------------------------------------------------------------------------
1 | import { copy } from '@wordpress/icons';
2 | import { lazy } from '@wordpress/element';
3 | import { __ } from '@wordpress/i18n';
4 | import { Step } from '../../../data/models/Step';
5 |
6 | const SiteGenSiteSocialMedia = lazy( () => import( './index' ) );
7 |
8 | export const stepSiteGenSocialMedia = new Step( {
9 | slug: 'sitegen-social-media',
10 | path: '/sitegen/step/social-media',
11 | title: __( 'Page Layouts', 'wp-module-onboarding' ),
12 | Component: SiteGenSiteSocialMedia,
13 | icon: copy,
14 | sidebars: {
15 | LearnMore: {
16 | SidebarComponents: [],
17 | },
18 | },
19 | } );
20 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/SiteGen/Welcome/contents.js:
--------------------------------------------------------------------------------
1 | import { __ } from '@wordpress/i18n';
2 |
3 | const getContents = () => {
4 | return {
5 | heading: __( 'Website Creator for WordPress', 'wp-module-onboarding' ),
6 | subHeading: __(
7 | 'Tell our AI engine what kind of site you want to make and let it handle the content and design for you.',
8 | 'wp-module-onboarding'
9 | ),
10 | buttonText: __( 'Get Started', 'wp-module-onboarding' ),
11 | };
12 | };
13 |
14 | export default getContents;
15 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/SiteGen/Welcome/step.js:
--------------------------------------------------------------------------------
1 | import { copy } from '@wordpress/icons';
2 | import { lazy } from '@wordpress/element';
3 | import { __ } from '@wordpress/i18n';
4 | import { Step } from '../../../data/models/Step';
5 |
6 | const SiteGenWelcome = lazy( () => import( './index' ) );
7 |
8 | export const stepSiteGenWelcome = new Step( {
9 | slug: 'sitegen-welcome',
10 | path: '/sitegen/step/welcome',
11 | title: __( 'Welcome', 'wp-module-onboarding' ),
12 | Component: SiteGenWelcome,
13 | icon: copy,
14 | sidebars: {
15 | LearnMore: {
16 | SidebarComponents: [],
17 | },
18 | },
19 | } );
20 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/SitePages/contents.js:
--------------------------------------------------------------------------------
1 | import { __ } from '@wordpress/i18n';
2 |
3 | const getContents = () => {
4 | return {
5 | heading: __(
6 | 'You have ideas, we have page templates',
7 | 'wp-module-onboarding'
8 | ),
9 | subheading: __(
10 | 'Begin closer to the finish line than a blank canvas.',
11 | 'wp-module-onboarding'
12 | ),
13 | };
14 | };
15 |
16 | export default getContents;
17 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/SitePages/step.js:
--------------------------------------------------------------------------------
1 | import { copy } from '@wordpress/icons';
2 | import { lazy } from '@wordpress/element';
3 | import { __ } from '@wordpress/i18n';
4 | import { Step } from '../../data/models/Step';
5 | import LearnMore from './Sidebar/LearnMore';
6 |
7 | const StepSitePages = lazy( () => import( './index' ) );
8 |
9 | export const stepSitePages = new Step( {
10 | slug: 'design-site-pages',
11 | path: '/wp-setup/step/design/site-pages',
12 | title: __( 'Page Layouts', 'wp-module-onboarding' ),
13 | Component: StepSitePages,
14 | icon: copy,
15 | sidebars: {
16 | LearnMore: {
17 | SidebarComponents: [ LearnMore ],
18 | },
19 | },
20 | data: {
21 | tooltipText: __(
22 | 'You have ideas, we have page templates',
23 | 'wp-module-onboarding'
24 | ),
25 | patternId: 'site-pages',
26 | },
27 | } );
28 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/TheFork/step.js:
--------------------------------------------------------------------------------
1 | import { copy } from '@wordpress/icons';
2 | import { lazy } from '@wordpress/element';
3 | import { __ } from '@wordpress/i18n';
4 | import { Step } from '../../data/models/Step';
5 |
6 | const StepTheFork = lazy( () => import( './index' ) );
7 |
8 | export const stepTheFork = new Step( {
9 | slug: 'fork',
10 | path: '/wp-setup/step/fork',
11 | title: __( 'The Fork', 'wp-module-onboarding' ),
12 | Component: StepTheFork,
13 | icon: copy,
14 | drawerNavigation: false,
15 | sidebars: {
16 | LearnMore: {
17 | SidebarComponents: [],
18 | },
19 | },
20 | } );
21 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/TopPriority/step.js:
--------------------------------------------------------------------------------
1 | import { lazy } from '@wordpress/element';
2 | import { __ } from '@wordpress/i18n';
3 | import { Step } from '../../data/models/Step';
4 | import { navigation } from '@wordpress/icons';
5 |
6 | const StepTopPriority = lazy( () => import( './index' ) );
7 |
8 | export const stepTopPriority = new Step( {
9 | slug: 'top-priority',
10 | path: '/wp-setup/step/top-priority',
11 | title: __( 'Top Priority', 'wp-module-onboarding' ),
12 | tooltipText: __( 'Tell us your top priority', 'wp-module-onboarding' ),
13 | Component: StepTopPriority,
14 | icon: navigation,
15 | } );
16 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/TopPriority/stylesheet.scss:
--------------------------------------------------------------------------------
1 | .info-top-priority {
2 | width: 250px;
3 | }
4 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/WhatNext/Sidebar/LearnMore/stylesheet.scss:
--------------------------------------------------------------------------------
1 | .nfd-onboarding-sidebar-learn-more {
2 |
3 | &__what-next {
4 |
5 | &__container {
6 | height: 232px;
7 |
8 | &.is-opened {
9 | padding: 0;
10 | }
11 |
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/WhatNext/step.js:
--------------------------------------------------------------------------------
1 | import { lazy } from '@wordpress/element';
2 | import { __ } from '@wordpress/i18n';
3 | import { Step } from '../../data/models/Step';
4 | import { moveTo } from '@wordpress/icons';
5 | import LearnMore from './Sidebar/LearnMore';
6 |
7 | const StepWhatNext = lazy( () => import( './index' ) );
8 |
9 | export const stepWhatNext = new Step( {
10 | slug: 'what-next',
11 | path: '/wp-setup/step/what-next',
12 | title: __( 'What Next', 'wp-module-onboarding' ),
13 | Component: StepWhatNext,
14 | icon: moveTo,
15 | sidebars: {
16 | LearnMore: {
17 | SidebarComponents: [ LearnMore ],
18 | },
19 | },
20 | data: {
21 | tooltipText: __( 'How else can we help?', 'wp-module-onboarding' ),
22 | },
23 | } );
24 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/steps/index.js:
--------------------------------------------------------------------------------
1 | import CommonLayout from '../components/Layouts/Common';
2 |
3 | const StepBase = () => {
4 | return StepBase;
5 | };
6 |
7 | export default StepBase;
8 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/store/constants.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Identifier for Newfold Onboarding data store.
3 | *
4 | * @type {string}
5 | */
6 | export const STORE_NAME = 'newfold/onboarding';
7 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/store/index.js:
--------------------------------------------------------------------------------
1 | import * as actions from './actions';
2 | import * as selectors from './selectors';
3 |
4 | import { createReduxStore, register } from '@wordpress/data';
5 |
6 | import { STORE_NAME } from './constants';
7 | import reducer from './reducer';
8 |
9 | export const nfdOnboardingStoreConfig = {
10 | reducer,
11 | actions,
12 | selectors,
13 | };
14 |
15 | export const store = createReduxStore( STORE_NAME, nfdOnboardingStoreConfig );
16 | register( store );
17 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/styles/_utilities.scss:
--------------------------------------------------------------------------------
1 | .is-centered {
2 | display: flex;
3 | place-content: center;
4 | place-items: center;
5 | }
6 |
7 | .is-vertically-centered {
8 | display: flex;
9 | align-items: center;
10 | justify-content: space-evenly;
11 | flex-direction: column;
12 | }
13 |
14 | .is-bg-primary {
15 | background-color: var(--nfd-onboarding-primary);
16 | color: var(--nfd-onboarding-base);
17 | }
18 |
19 | .center {
20 | text-align: center;
21 | }
22 |
23 | input::placeholder {
24 | font-size: 0.75rem;
25 | color: var(--nfd-onboarding-light-gray-4);
26 | }
27 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/styles/_wordpress.scss:
--------------------------------------------------------------------------------
1 | /**
2 | * Initialize all WordPress Sass
3 | * -----------------------------
4 | * @import @wordpress/base-styles
5 | * @import @wordpress/interface
6 | */
7 |
8 | @import '@wordpress/base-styles/breakpoints';
9 | @import '@wordpress/base-styles/colors';
10 | @import '@wordpress/base-styles/mixins';
11 | @import '@wordpress/base-styles/variables';
12 | @import '@wordpress/base-styles/z-index';
13 |
14 | @import '@wordpress/interface/src/style.scss';
15 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/utils/analytics/hiive/OnboardingEvent.js:
--------------------------------------------------------------------------------
1 | import { HiiveEvent } from '@newfold/js-utility-ui-analytics';
2 | import { getLabelKeyFromAction } from '.';
3 | import { CATEGORY } from './constants';
4 |
5 | export class OnboardingEvent extends HiiveEvent {
6 | constructor( action, value, additionalData, page, category = CATEGORY ) {
7 | const labelKey = getLabelKeyFromAction( action );
8 | super(
9 | category,
10 | action,
11 | {
12 | label_key: labelKey,
13 | [ labelKey ]: value,
14 | ...additionalData,
15 | page: page ? page : window.location.href,
16 | },
17 | category
18 | );
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/utils/analytics/hiive/index.js:
--------------------------------------------------------------------------------
1 | import { HiiveAnalytics } from '@newfold/js-utility-ui-analytics';
2 | import { default as wpData } from '@wordpress/data';
3 | import { default as wpApiFetch } from '@wordpress/api-fetch';
4 | import { ACTION_TO_LABEL_KEY_MAP } from './constants';
5 |
6 | export const trackOnboardingEvent = ( onboardingEvent ) => {
7 | return HiiveAnalytics.track( onboardingEvent );
8 | };
9 |
10 | export const sendOnboardingEvent = ( onboardingEvent ) => {
11 | return HiiveAnalytics.send( onboardingEvent );
12 | };
13 |
14 | export const getLabelKeyFromAction = ( action ) => {
15 | if ( action in ACTION_TO_LABEL_KEY_MAP ) {
16 | return ACTION_TO_LABEL_KEY_MAP[ action ];
17 | }
18 | return undefined;
19 | };
20 |
21 | // passing dependencies to HiiveAnalytics solely for build purposes
22 | HiiveAnalytics.dependencies = {
23 | wpData,
24 | wpApiFetch,
25 | };
26 |
27 | export * from './OnboardingEvent';
28 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/utils/api-queuer/api-queue-executor.js:
--------------------------------------------------------------------------------
1 | /* eslint no-console: ["error", { allow: ["error"] }] */
2 | import { MAX_RETRIES_API_QUEUER } from '../../../constants';
3 |
4 | // This Executer is responsible to execute API requests in a sequence
5 | const apiQueueExecutor = async ( requests ) => {
6 | const items = requests;
7 |
8 | const dequeue = async ( retryCount = 1 ) => {
9 | // Queue Empty
10 | if ( ! items[ 0 ] ) return;
11 |
12 | await items[ 0 ][ 1 ]()
13 | .then( ( e ) => {
14 | if ( e.error && retryCount < MAX_RETRIES_API_QUEUER ) {
15 | dequeue( retryCount + 1 );
16 | }
17 | } )
18 | .then( () => items.shift() )
19 | .then( dequeue );
20 | };
21 | await dequeue();
22 | return items;
23 | };
24 |
25 | export default apiQueueExecutor;
26 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/utils/api/blockRender.js:
--------------------------------------------------------------------------------
1 | import apiFetch from '@wordpress/api-fetch';
2 |
3 | import { onboardingRestURL } from './common';
4 | import { resolve } from './resolve.js';
5 |
6 | export async function blockRenderScreenshot( content ) {
7 | return await resolve(
8 | apiFetch( {
9 | url: onboardingRestURL( 'block-render/screenshot' ),
10 | method: 'POST',
11 | data: {
12 | width: 1200,
13 | height: 900,
14 | content,
15 | },
16 | } ).then()
17 | );
18 | }
19 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/utils/api/buildRequestUrl.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Build a request URL for the Newfold Onboarding API.
3 | *
4 | * @param {string} endpoint - The API endpoint.
5 | * @return {string} The fully-qualified API URL.
6 | */
7 | const buildRequestUrl = ( endpoint ) => {
8 | // Remove leading slash if it exists
9 | if ( endpoint.startsWith( '/' ) ) {
10 | endpoint = endpoint.substring( 1 );
11 | }
12 |
13 | // Get the WordPress site URL
14 | const wpApiSettings = window.wpApiSettings || {};
15 | const apiRoot = wpApiSettings.root || '/wp-json/';
16 |
17 | // Build the full API URL
18 | return `${ apiRoot }newfold-onboarding/v1/${ endpoint }`;
19 | };
20 |
21 | export default buildRequestUrl;
22 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/utils/api/common.js:
--------------------------------------------------------------------------------
1 | import {
2 | onboardingRestBase,
3 | wpRestBase,
4 | installerRestBase,
5 | migrateRestBase,
6 | } from '../../../constants';
7 |
8 | export const onboardingRestURL = ( api, includeFlow = true ) => {
9 | return (
10 | `${ onboardingRestBase }/${ api }` +
11 | ( includeFlow && window.nfdOnboarding?.currentFlow
12 | ? `&flow=${ window.nfdOnboarding.currentFlow }`
13 | : '' )
14 | );
15 | };
16 |
17 | export const installerRestURL = ( api ) => {
18 | return `${ installerRestBase }/${ api }`;
19 | };
20 |
21 | export const migrateRestURL = ( api ) => {
22 | return `${ migrateRestBase }/${ api }`;
23 | };
24 |
25 | export const wpRestURL = ( api ) => {
26 | return `${ wpRestBase }/${ api }`;
27 | };
28 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/utils/api/cronTrigger.js:
--------------------------------------------------------------------------------
1 | import apiFetch from '@wordpress/api-fetch';
2 | import { wpSiteUrl } from '../../../constants';
3 |
4 | export const trigger = () => {
5 | apiFetch( {
6 | url: `${ wpSiteUrl }/wp-cron.php`,
7 | method: 'GET',
8 | parse: false,
9 | } ).catch( ( error ) => {
10 | console.error( error );
11 | } );
12 | };
13 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/utils/api/ecommerce.js:
--------------------------------------------------------------------------------
1 | import apiFetch from '@wordpress/api-fetch';
2 | import { wpRestURL } from './common';
3 |
4 | export const isEmpty = ( object ) => Object.keys( object ).length === 0;
5 |
6 | export async function fetchWPSettings() {
7 | return apiFetch( { url: wpRestURL( 'settings' ) } );
8 | }
9 |
10 | export async function updateWPSettings( data ) {
11 | return apiFetch( { url: wpRestURL( 'settings' ), method: 'POST', data } );
12 | }
13 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/utils/api/patterns.js:
--------------------------------------------------------------------------------
1 | import { resolve } from './resolve';
2 | import { onboardingRestURL } from './common';
3 |
4 | import apiFetch from '@wordpress/api-fetch';
5 |
6 | export async function getPatterns( step = false, squash = false ) {
7 | return await resolve(
8 | apiFetch( {
9 | url: onboardingRestURL(
10 | `patterns` +
11 | ( step ? `&step=${ step }&squash=${ squash }` : '' )
12 | ),
13 | } ).then()
14 | );
15 | }
16 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/utils/api/resolve.js:
--------------------------------------------------------------------------------
1 | export async function resolve(promise) {
2 | const resolved = {
3 | body: null,
4 | error: null
5 | };
6 |
7 | try {
8 | resolved.body = await promise;
9 | } catch (e) {
10 | resolved.error = e;
11 | }
12 |
13 | return resolved;
14 | }
15 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/utils/api/settings.js:
--------------------------------------------------------------------------------
1 | import apiFetch from '@wordpress/api-fetch';
2 |
3 | import { resolve } from './resolve.js';
4 | import { MAX_RETRIES_SETTINGS_INIT } from '../../../constants';
5 | import { onboardingRestURL } from './common';
6 |
7 | export async function getSettings() {
8 | return await resolve(
9 | apiFetch( { url: onboardingRestURL( 'settings' ) } ).then()
10 | );
11 | }
12 |
13 | export async function setSettings( data ) {
14 | return await resolve(
15 | apiFetch( {
16 | url: onboardingRestURL( 'settings' ),
17 | method: 'POST',
18 | data,
19 | } ).then()
20 | );
21 | }
22 |
23 | export const initialize = ( retries = 0 ) => {
24 | if ( retries >= MAX_RETRIES_SETTINGS_INIT ) {
25 | return false;
26 | }
27 | return apiFetch( {
28 | url: onboardingRestURL( 'settings/initialize' ),
29 | method: 'POST',
30 | } ).catch( () => {
31 | retries = retries + 1;
32 | initialize( retries );
33 | } );
34 | };
35 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/utils/api/siteClassification.js:
--------------------------------------------------------------------------------
1 | import { resolve } from './resolve';
2 | import { onboardingRestURL } from './common';
3 | import siteClassificationData from './siteClassification.json';
4 |
5 | import apiFetch from '@wordpress/api-fetch';
6 |
7 | export async function getSiteClassification() {
8 | const data = await resolve(
9 | apiFetch( {
10 | url: onboardingRestURL( 'site-classification' ),
11 | } )
12 | );
13 | if ( data.body.length === 0 ) {
14 | return siteClassificationData;
15 | }
16 |
17 | return data;
18 | }
19 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/utils/api/uploader.js:
--------------------------------------------------------------------------------
1 | import { resolve } from './resolve';
2 | import { wpRestURL } from './common';
3 |
4 | import apiFetch from '@wordpress/api-fetch';
5 |
6 | function readFileDataAsBase64( file ) {
7 | return new Promise( ( resolve, reject ) => {
8 | // Create file reader
9 | const reader = new FileReader();
10 |
11 | // Register event listeners
12 | reader.addEventListener( 'loadend', ( e ) =>
13 | resolve( e.target.result )
14 | );
15 | reader.addEventListener( 'error', reject );
16 |
17 | // Read file
18 | reader.readAsArrayBuffer( file );
19 | } );
20 | }
21 |
22 | export async function uploadImage( file ) {
23 | const data = await readFileDataAsBase64( file );
24 |
25 | const headers = {};
26 | headers[ 'Content-Type' ] = 'image/png';
27 | headers[ 'Content-Disposition' ] = 'attachment; filename=' + file.name;
28 |
29 | return await resolve(
30 | apiFetch( {
31 | url: wpRestURL( 'media' ),
32 | method: 'POST',
33 | headers,
34 | body: data,
35 | } )
36 | );
37 | }
38 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/utils/api/utils.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Retries a given API function until the specified retry count is reached.
3 | *
4 | * @param {Function} func - The API function to be retried. It should return a promise.
5 | * @param {number} retryCount - The number of times to retry the function before giving up.
6 | * @return {Promise} - Resolves with the data returned by the API function if successful, or `false` if all retries fail.
7 | */
8 | export async function functionRetryHandler( func, retryCount ) {
9 | let attempts = 0;
10 | while ( attempts < retryCount ) {
11 | try {
12 | const data = await func();
13 | attempts++;
14 | if ( data.error === null ) {
15 | return data;
16 | }
17 | } catch ( error ) {
18 | attempts++;
19 | // eslint-disable-next-line no-console
20 | console.error( 'Failed to retrieve data', error );
21 |
22 | if ( attempts >= retryCount ) {
23 | return false;
24 | }
25 | }
26 | }
27 | return false;
28 | }
29 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/utils/index.js:
--------------------------------------------------------------------------------
1 | import { removeQueryArgs, hasQueryArg } from '@wordpress/url';
2 | // eslint-disable-next-line import/no-extraneous-dependencies
3 | import { transform, snakeCase } from 'lodash';
4 |
5 | export const getQueryParam = ( paramName ) => {
6 | const urlParams = new URLSearchParams( window.location.search );
7 | return urlParams.get( paramName );
8 | };
9 |
10 | export const removeQueryParam = ( url, paramName ) => {
11 | if ( hasQueryArg( url, paramName ) ) {
12 | return removeQueryArgs( url, paramName );
13 | }
14 | return url;
15 | };
16 |
17 | export const convertObjectKeysToSnakeCase = ( object ) => {
18 | return transform( object, ( result, value, key ) => {
19 | result[ snakeCase( key ) ] = value;
20 | } );
21 | };
22 |
23 | /**
24 | * Checks if the code is running in a Cypress test environment.
25 | */
26 | export const isEnvironmentCypress = () => {
27 | return !! window.Cypress;
28 | };
29 |
--------------------------------------------------------------------------------
/src/OnboardingSPA/utils/locales/translations.js:
--------------------------------------------------------------------------------
1 | import { DEFAULT_FLOW } from '../../data/flows/constants';
2 | import { translationMap } from '../../data/translations';
3 |
4 | export const translations = ( word, context = 'noun' ) => {
5 | const flow = window?.nfdOnboarding?.currentFlow || DEFAULT_FLOW;
6 | const translatedWord =
7 | translationMap[ flow ][ word.toLowerCase() ][ context ];
8 | if ( word === word.toUpperCase() ) {
9 | return translatedWord.toUpperCase();
10 | }
11 |
12 | if ( word[ 0 ] === word[ 0 ].toUpperCase() ) {
13 | return (
14 | translatedWord[ 0 ].toUpperCase() + translatedWord.substring( 1 )
15 | );
16 | }
17 |
18 | return translatedWord;
19 | };
20 |
--------------------------------------------------------------------------------
/src/Scripts/sitegen-theme-marker/sitegen-theme-marker.css:
--------------------------------------------------------------------------------
1 | .theme-name {
2 | display: flex;
3 | flex-direction: row;
4 | align-items: center;
5 |
6 | svg {
7 | margin-left: 8px;
8 | }
9 | }
10 |
11 | .nfd-onboarding-sitegen-theme-marker-filled {
12 | fill: #1d2327;
13 | }
14 |
15 | .theme.active {
16 |
17 | .nfd-onboarding-sitegen-theme-marker-filled {
18 | fill: none;
19 | }
20 | }
21 |
22 | .nfd-onboarding-sitegen-theme-marker-title {
23 | margin-left: 8px;
24 | width: 120px;
25 | text-overflow: ellipsis;
26 | overflow: hidden;
27 | }
28 |
--------------------------------------------------------------------------------
/src/webpack-public-path.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Set webpack's public path (default is root directory of URI resource) to Plugin's build directory.
3 | * This helps lazy-loading work correctly. This value is set in `/includes/Data.php` in Data::runtime().
4 | */
5 | import { runtimeDataExists } from './constants';
6 |
7 | const webpackPublicPath = () => {
8 | if (runtimeDataExists) {
9 | __webpack_public_path__ = window.nfdOnboarding.buildUrl;
10 | }
11 | };
12 |
13 | export default webpackPublicPath;
14 |
--------------------------------------------------------------------------------
/tests/cypress/fixtures/content-structure.json:
--------------------------------------------------------------------------------
1 | {
2 | "content_structures": [
3 | {
4 | "structure": [
5 | "header",
6 | "hero",
7 | "headings",
8 | "team",
9 | "features",
10 | "gallery",
11 | "call-to-action",
12 | "footer"
13 | ]
14 | },
15 | {
16 | "structure": [
17 | "header",
18 | "hero",
19 | "headings",
20 | "team",
21 | "gallery",
22 | "call-to-action",
23 | "faq",
24 | "footer"
25 | ]
26 | },
27 | {
28 | "structure": [
29 | "header",
30 | "hero",
31 | "headings",
32 | "team",
33 | "features",
34 | "testimonials",
35 | "blog",
36 | "footer"
37 | ]
38 | }
39 | ]
40 | }
41 |
--------------------------------------------------------------------------------
/tests/cypress/fixtures/content-tones.json:
--------------------------------------------------------------------------------
1 | {
2 | "tone": "Professional",
3 | "undertone": "Positive",
4 | "verbosity": 50,
5 | "reading_level": 60
6 | }
7 |
--------------------------------------------------------------------------------
/tests/cypress/fixtures/image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/newfold-labs/wp-module-onboarding/65fbf5135aa97d87653d5b5ba9e52d6f5dfa43ab/tests/cypress/fixtures/image.png
--------------------------------------------------------------------------------
/tests/cypress/fixtures/migrate-connect.json:
--------------------------------------------------------------------------------
1 | {
2 | "success": true,
3 | "data": {
4 | "message": "Connect plugin is installed and ready to start the migration.",
5 | "response": true,
6 | "redirect_url": "https:\/\/app.instawp.io\/migrate\/bluehost?d_id=1bb9623e-5208-40f7-9383-cd91df2fe58c"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/tests/cypress/fixtures/site-classification.json:
--------------------------------------------------------------------------------
1 | {
2 | "primaryType": "health-wellness",
3 | "slug": "gym",
4 | "emoji": "💪",
5 | "wooType": "health-beauty",
6 | "keywords": [
7 | "fitness",
8 | "group",
9 | "weight loss",
10 | "muscle",
11 | "cardio",
12 | "strength",
13 | "yoga",
14 | "pilates",
15 | "crossfit",
16 | "bodybuilding",
17 | "weight",
18 | "treadmill",
19 | "elliptical",
20 | "interval"
21 | ],
22 | "label": "Gym"
23 | }
24 |
--------------------------------------------------------------------------------
/tests/cypress/fixtures/site-config.json:
--------------------------------------------------------------------------------
1 | {
2 | "site_title": "Asana Yoga Studio",
3 | "tagline": "Elevate Your Practice with Sustainable Yoga Mats and Curated Attire"
4 | }
5 |
--------------------------------------------------------------------------------
/tests/cypress/fixtures/target-audience.json:
--------------------------------------------------------------------------------
1 | {
2 | "location": "Cocoa Beach, Florida",
3 | "interests": [
4 | "yoga",
5 | "sustainability",
6 | "eco-consciousness"
7 | ],
8 | "age": {
9 | "min": 18,
10 | "max": 65
11 | },
12 | "gender": "All",
13 | "income": {
14 | "min": 0,
15 | "max": 100000,
16 | "currency": "USD"
17 | },
18 | "education": "All"
19 | }
20 |
--------------------------------------------------------------------------------
/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/8-restart-onboarding.cy.js:
--------------------------------------------------------------------------------
1 | //
2 |
3 | const {
4 | SingleEventsAPI,
5 | } = require('../wp-module-support/single-events-track.cy');
6 |
7 | describe.skip('Restart Onboarding', function () {
8 | before(() => {
9 | // Create the option for Restarting Onboarding
10 | cy.exec(
11 | `npx wp-env run cli wp option set nfd_module_onboarding_can_restart true`
12 | );
13 | cy.visit('wp-admin/themes.php');
14 | cy.wait(5000);
15 | });
16 |
17 | it('Check for the Build with AI Button', () => {
18 | cy.get('.theme.build-with-ai', { timeout: 30000 })
19 | .scrollIntoView()
20 | .should('be.visible');
21 | });
22 |
23 | it('Check if onboarding restarts', () => {
24 | cy.get('.theme.build-with-ai', { timeout: 10000 })
25 | .scrollIntoView()
26 | .click();
27 | cy.url().should('include', '?page=nfd-onboarding', { timeout: 10000 });
28 | });
29 |
30 | it('Check if Event triggers', () => {
31 | SingleEventsAPI('onboarding_restarted', 'location', 'theme');
32 | });
33 | });
34 |
--------------------------------------------------------------------------------
/tests/cypress/integration/wp-module-support/header.cy.js:
--------------------------------------------------------------------------------
1 | //
2 |
3 | export const CheckCardHeadingSubheading = ( question = false ) => {
4 | cy.get( '.nfd-step-card-heading' ).scrollIntoView().should( 'be.visible' );
5 | if ( question ) {
6 | cy.get( '.nfd-step-card-subheading-other' ).should( 'be.visible' );
7 | cy.get( '.nfd-step-card-question' ).should( 'be.visible' );
8 | } else {
9 | cy.get( '.nfd-step-card-subheading' ).should( 'be.visible' );
10 | }
11 | };
12 |
13 | export const CheckHeadingSubheading = () => {
14 | cy.get( '.nfd-main-heading__title', { timeout:15000 } ).should( 'be.visible' );
15 | cy.get( '.nfd-main-heading__subtitle' ).should( 'be.visible' );
16 | };
17 |
--------------------------------------------------------------------------------
/tests/cypress/integration/wp-module-support/pluginID.cy.js:
--------------------------------------------------------------------------------
1 | //
2 | export const GetPluginId = () => {
3 | return Cypress.env( 'pluginId' );
4 | };
5 |
6 | export const GetPluginName = () => {
7 | if ( GetPluginId() == 'bluehost' ) {
8 | cy.get( '.nfd-step-card-subheading', { timeout: 20000 } ).should(
9 | 'contain',
10 | 'Bluehost'
11 | );
12 | }
13 | if ( GetPluginId() == 'hostgator' ) {
14 | cy.get( '.nfd-step-card-subheading', { timeout: 20000 } ).should(
15 | 'contain',
16 | 'HostGator'
17 | );
18 | }
19 | if ( GetPluginId() == 'crazy-domains' ) {
20 | cy.get( '.nfd-step-card-subheading', { timeout: 20000 } ).should(
21 | 'contain',
22 | 'Crazy Domains'
23 | );
24 | }
25 | };
26 |
27 | export const getAppId = () => {
28 | return Cypress.env( 'appId' );
29 | };
30 |
--------------------------------------------------------------------------------
/tests/cypress/plugins/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | module.exports = (on, config) => {
4 |
5 | if (config.env && config.env.baseUrl) {
6 | config.baseUrl = config.env.baseUrl;
7 | }
8 |
9 | return config;
10 | };
11 |
--------------------------------------------------------------------------------
/tests/cypress/support/index.js:
--------------------------------------------------------------------------------
1 | // ***********************************************************
2 | // This example support/index.js is processed and
3 | // loaded automatically before your test files.
4 | //
5 | // This is a great place to put global configuration and
6 | // behavior that modifies Cypress.
7 | //
8 | // You can change the location of this file or turn off
9 | // automatically serving support files with the
10 | // 'supportFile' configuration option.
11 | //
12 | // You can read more here:
13 | // https://on.cypress.io/configuration
14 | // ***********************************************************
15 |
16 | import 'cypress-axe';
17 | import './commands';
18 |
19 | Cypress.Cookies.defaults({
20 | preserve: /wp|wordpress/,
21 | });
22 |
23 | before(() => {
24 | cy.login(Cypress.env('wpUsername'), Cypress.env('wpPassword'));
25 | });
26 |
--------------------------------------------------------------------------------
/tests/phpunit/ExampleTest.php:
--------------------------------------------------------------------------------
1 | assertEquals( true, true );
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/tests/phpunit/bootstrap.php:
--------------------------------------------------------------------------------
1 |