Skip to content

Commit 55f7d02

Browse files
authored
release: new version
- New Onboarding experience - Remove legacy notice for the Neve theme
2 parents 1f8fe86 + 7b338bd commit 55f7d02

25 files changed

Lines changed: 744 additions & 306 deletions

docker-compose.ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version: '3.3'
33

44
services:
55
mysql:
6-
image: mysql:5.7
6+
image: mariadb:latest
77
restart: always
88
environment:
99
MYSQL_ROOT_PASSWORD: wordpress

includes/Admin.php

Lines changed: 48 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ public function init() {
7272
add_action( 'after_switch_theme', array( $this, 'get_previous_theme' ) );
7373
add_filter( 'neve_dashboard_page_data', array( $this, 'localize_sites_library' ) );
7474
add_action( 'admin_menu', array( $this, 'register' ) );
75-
add_filter( 'submenu_file', array( $this, 'hide_onboarding' ) );
7675
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue' ) );
7776
add_filter( 'ti_tpc_editor_data', array( $this, 'add_tpc_editor_data' ), 20 );
7877
add_action( 'admin_init', array( $this, 'activation_redirect' ) );
@@ -398,7 +397,15 @@ public function activation_redirect() {
398397
}
399398

400399
delete_option( 'tpc_maybe_run_onboarding' );
401-
wp_safe_redirect( admin_url( 'admin.php?page=neve-onboarding' ) );
400+
wp_safe_redirect(
401+
add_query_arg(
402+
array(
403+
'page' => 'neve-onboarding',
404+
'show' => 'welcome',
405+
),
406+
admin_url( 'admin.php' )
407+
)
408+
);
402409
exit();
403410
}
404411

@@ -514,10 +521,6 @@ public function register() {
514521
}
515522

516523
$this->register_starter_sites_page();
517-
518-
if ( $this->should_load_onboarding() ) {
519-
$this->register_onboarding_page();
520-
}
521524
}
522525

523526
private function register_starter_sites_page( $in_appearance = false ) {
@@ -528,12 +531,12 @@ private function register_starter_sites_page( $in_appearance = false ) {
528531

529532
$starter_site_data = array(
530533
'page_title' => __( 'Starter Sites', 'templates-patterns-collection' ),
531-
'menu_title' => $this->get_prefix_for_menu_item() . __( 'Starter Sites', 'templates-patterns-collection' ),
532-
'capability' => 'activate_plugins',
533-
'menu_slug' => $this->page_slug,
534+
'menu_title' => $this->get_prefix_for_menu_item() . __( 'Onboarding', 'templates-patterns-collection' ),
535+
'capability' => 'install_plugins',
536+
'menu_slug' => 'neve-onboarding',
534537
'callback' => array(
535538
$this,
536-
'render_starter_sites',
539+
'render_onboarding',
537540
),
538541
);
539542

@@ -553,25 +556,6 @@ private function register_starter_sites_page( $in_appearance = false ) {
553556
$this->add_theme_page_for_tiob( $starter_site_data, 2 );
554557
}
555558

556-
/**
557-
* Registers the onboarding page. Used for Neve onboarding, but hidden in the admin.
558-
*
559-
* @return void
560-
*/
561-
private function register_onboarding_page() {
562-
$onboarding_data = array(
563-
'page_title' => __( 'Onboarding', 'templates-patterns-collection' ),
564-
'menu_title' => $this->get_prefix_for_menu_item() . __( 'Onboarding', 'templates-patterns-collection' ),
565-
'capability' => 'install_plugins',
566-
'menu_slug' => 'neve-onboarding',
567-
'callback' => array(
568-
$this,
569-
'render_onboarding',
570-
),
571-
);
572-
$this->add_theme_page_for_tiob( $onboarding_data, 4 );
573-
}
574-
575559
/**
576560
* Legacy template cloud pages.
577561
*
@@ -636,29 +620,13 @@ public function register_legacy_template_cloud_pages() {
636620
}
637621
$this->register_starter_sites_page();
638622

639-
if ( $this->should_load_onboarding() ) {
640-
$this->register_onboarding_page();
641-
}
642-
643623
if ( $this->is_library_disabled() ) {
644624
return false;
645625
}
646626
$this->add_subpage_for_tiob( $library_data );
647627
$this->add_subpage_for_tiob( $settings_data );
648628
}
649629

650-
/**
651-
* Hide the onboarding item from Neve menu.
652-
*
653-
* @param $submenu_file string The submenu file.
654-
*
655-
* @return string
656-
*/
657-
public function hide_onboarding( $submenu_file ) {
658-
remove_submenu_page( 'neve-welcome', 'neve-onboarding' );
659-
return $submenu_file;
660-
}
661-
662630
/**
663631
* Map license plan from Neve if available.
664632
*
@@ -672,19 +640,6 @@ private function neve_license_plan() {
672640
return $category > -1 && isset( $category_mapping[ $category ] ) ? $category_mapping[ $category ] : -1;
673641
}
674642

675-
/**
676-
* Check if current subscription is agency
677-
* or if we have a valid license for the standalone product.
678-
*
679-
* @return bool
680-
*/
681-
private function is_agency_plan() {
682-
$plan = $this->neve_license_plan();
683-
$plan = License::get_license_tier( $plan );
684-
685-
return $plan === 3;
686-
}
687-
688643
/**
689644
* Render method for the starter sites page.
690645
*/
@@ -738,7 +693,7 @@ public function enqueue() {
738693
return;
739694
}
740695

741-
if ( $this->should_load_onboarding() && strpos( $screen->id, '_page_neve-onboarding' ) ) {
696+
if ( strpos( $screen->id, '_page_neve-onboarding' ) ) {
742697

743698
wp_enqueue_media();
744699

@@ -816,57 +771,57 @@ private function get_localization() {
816771
}
817772

818773
return array(
819-
'version' => TIOB_VERSION,
820-
'nonce' => wp_create_nonce( 'wp_rest' ),
821-
'assets' => TIOB_URL . 'assets/',
822-
'upgradeURL' => $upgrade_url,
823-
'upgradeURLTpc' => $upgrade_url_tpc,
824-
'siteUrl' => trailingslashit( get_site_url() ),
825-
'strings' => array(
774+
'version' => TIOB_VERSION,
775+
'nonce' => wp_create_nonce( 'wp_rest' ),
776+
'assets' => TIOB_URL . 'assets/',
777+
'upgradeURL' => $upgrade_url,
778+
'upgradeURLTpc' => $upgrade_url_tpc,
779+
'siteUrl' => trailingslashit( get_site_url() ),
780+
'strings' => array(
826781
/* translators: %s - Theme name */
827782
'starterSitesTabDescription' => __( 'Choose from multiple unique demos, specially designed for you, that can be installed with a single click. You just need to choose your favorite, and we will take care of everything else.', 'templates-patterns-collection' ),
828783
),
829-
'cleanupAllowed' => ( ! empty( get_transient( Active_State::STATE_NAME ) ) ) ? 'yes' : 'no',
830-
'onboarding' => array(),
831-
'hasFileSystem' => WP_Filesystem(),
832-
'themesURL' => admin_url( 'themes.php' ),
833-
'themeAction' => $this->get_theme_action(),
834-
'brandedTheme' => $this->get_whitelabel_name(),
835-
'hideStarterSites' => $this->is_starter_sites_disabled(),
836-
'hideMyLibrary' => $this->is_library_disabled(),
837-
'fontParings' => $this->font_pairs_neve,
838-
'endpoint' => ( defined( 'TPC_TEMPLATES_CLOUD_ENDPOINT' ) ) ? TPC_TEMPLATES_CLOUD_ENDPOINT : self::get_templates_cloud_endpoint(),
839-
'params' => array(
784+
'cleanupAllowed' => ( ! empty( get_transient( Active_State::STATE_NAME ) ) ) ? 'yes' : 'no',
785+
'onboarding' => array(),
786+
'hasFileSystem' => WP_Filesystem(),
787+
'themesURL' => admin_url( 'themes.php' ),
788+
'themeAction' => $this->get_theme_action(),
789+
'brandedTheme' => $this->get_whitelabel_name(),
790+
'hideStarterSites' => $this->is_starter_sites_disabled(),
791+
'hideMyLibrary' => $this->is_library_disabled(),
792+
'fontParings' => $this->font_pairs_neve,
793+
'endpoint' => ( defined( 'TPC_TEMPLATES_CLOUD_ENDPOINT' ) ) ? TPC_TEMPLATES_CLOUD_ENDPOINT : self::get_templates_cloud_endpoint(),
794+
'params' => array(
840795
'site_url' => get_site_url(),
841796
'license_id' => License::get_license_data()->key,
842797
),
843-
'upsellNotifications' => $this->get_upsell_notifications(),
844-
'isValidLicense' => $this->has_valid_addons(),
845-
'licenseTIOB' => License::get_license_data(),
846-
'emailSubscribe' => array(
798+
'upsellNotifications' => $this->get_upsell_notifications(),
799+
'isValidLicense' => $this->has_valid_addons(),
800+
'licenseTIOB' => License::get_license_data(),
801+
'emailSubscribe' => array(
847802
'ajaxURL' => esc_url( admin_url( 'admin-ajax.php' ) ),
848803
'nonce' => wp_create_nonce( 'skip_subscribe_nonce' ),
849804
'skipStatus' => $this->get_skip_subscribe_status() ? 'yes' : 'no',
850805
'email' => ( ! empty( $user->user_email ) ) ? $user->user_email : '',
851806
),
852-
'onboardingDone' => array(
807+
'onboardingDone' => array(
853808
'ajaxURL' => esc_url( admin_url( 'admin-ajax.php' ) ),
854809
'nonce' => wp_create_nonce( 'onboarding_done_nonce' ),
855810
),
856-
'feedback' => array(
811+
'feedback' => array(
857812
'count' => get_option( self::IMPORTED_TEMPLATES_COUNT_OPT, 0 ),
858813
'dismissed' => get_option( self::FEEDBACK_DISMISSED_OPT, false ),
859814
),
860-
'onboardingUpsell' => array(
815+
'onboardingUpsell' => array(
861816
'dashboard' => tsdk_translate_link( tsdk_utmify( 'https://store.themeisle.com/', 'onboarding_upsell' ), 'query' ),
862817
'contact' => tsdk_translate_link( tsdk_utmify( 'https://themeisle.com/contact/', 'onboarding_upsell' ), 'query' ),
863818
'upgrade' => tsdk_translate_link( tsdk_utmify( 'https://themeisle.com/themes/neve/upgrade/', 'onboarding_upsell' ), 'query' ),
864819
'upgradeToast' => tsdk_translate_link( tsdk_utmify( 'https://themeisle.com/themes/neve/upgrade/', 'onboarding_toast' ), 'query' ),
865820
),
866-
'onboardingAllowed' => $this->should_load_onboarding(),
867-
'onboardingRedirect' => admin_url( 'admin.php?page=neve-onboarding' ),
868-
'tiobSettings' => admin_url( 'admin.php?page=tiob-plugin#settings' ),
869-
'links' => array(
821+
'onboardingAllowed' => $this->should_load_onboarding(),
822+
'onboardingRedirect' => admin_url( 'admin.php?page=neve-onboarding' ),
823+
'tiobSettings' => admin_url( 'admin.php?page=tiob-plugin#settings' ),
824+
'links' => array(
870825
array(
871826
'label' => __( 'Support', 'templates-patterns-collection' ),
872827
'is_external' => true,
@@ -888,12 +843,15 @@ private function get_localization() {
888843
'is_button' => true,
889844
),
890845
),
891-
'isFSETheme' => self::is_fse_theme(),
892-
'newTCNotice' => array(
846+
'isFSETheme' => self::is_fse_theme(),
847+
'newTCNotice' => array(
893848
'show' => get_option( self::TC_NEW_NOTICE_DISMISSED, 'no' ) !== 'yes' && self::has_legacy_template_cloud(),
894849
'ajaxURL' => esc_url( admin_url( 'admin-ajax.php' ) ),
895850
'nonce' => wp_create_nonce( 'dismiss_new_tc_notice' ),
896851
),
852+
'onboardingPluginCompatibility' => array(
853+
'hyve-lite' => is_php_version_compatible( '8.1' ),
854+
),
897855
);
898856
}
899857

@@ -1183,32 +1141,6 @@ public function localize_sites_library( $array ) {
11831141

11841142
$array['onboarding'] = $api;
11851143

1186-
// Do not display the notification if starter sites are disabled
1187-
if ( $this->is_starter_sites_disabled() ) {
1188-
return $array;
1189-
}
1190-
1191-
// Previously the library was visited check was stored in a transient. To ensure the notification is not displayed anymore once the user has visited the library
1192-
// the transient was moved to an option and here we check that if the transient is set and we also update the option.
1193-
$visited_transient = (bool) get_transient( self::VISITED_LIBRARY_OPT );
1194-
$page_was_visited = get_option( self::VISITED_LIBRARY_OPT, false );
1195-
if ( $visited_transient && $page_was_visited === false ) {
1196-
update_option( self::VISITED_LIBRARY_OPT, 'yes' );
1197-
$page_was_visited = 'yes';
1198-
}
1199-
if ( $this->is_agency_plan() && $page_was_visited !== 'yes' ) {
1200-
1201-
$array['notifications']['template-cloud'] = array(
1202-
'text' => __( 'Great news! Now you can export your own custom designs to the cloud and then reuse them on other sites.', 'templates-patterns-collection' ),
1203-
'cta' => sprintf(
1204-
// translators: %s: Templates Cloud
1205-
__( 'Open %s', 'templates-patterns-collection' ),
1206-
'Templates Cloud'
1207-
),
1208-
'url' => ( $this->neve_theme_has_support( 'theme_dedicated_menu' ) ? 'admin.php' : 'themes.php' ) . '?page=' . $this->page_slug . '&dismiss_notice=yes#library',
1209-
);
1210-
}
1211-
12121144
return $array;
12131145
}
12141146

includes/Importers/Plugin_Importer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ class Plugin_Importer {
5454
'restrict-content' => 'restrictcontent.php',
5555
'pods' => 'init.php',
5656
'wp-full-stripe-free' => 'wp-full-stripe.php',
57+
'wp-cloudflare-page-cache' => 'wp-cloudflare-super-page-cache.php',
5758
);
5859

5960
public function __construct() {

onboarding/src/Components/CategoryButtons.js

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,33 @@
22
import { useSelect, useDispatch } from '@wordpress/data';
33
import classnames from 'classnames';
44
import { track } from '../utils/rest';
5+
import { useMemo, useEffect } from '@wordpress/element';
56

67
const CategoryButtons = ( { categories, style } ) => {
78
const data = useSelect( ( select ) => ( {
89
category: select( 'ti-onboarding' ).getCurrentCategory(),
910
query: select( 'ti-onboarding' ).getSearchQuery(),
1011
trackingId: select( 'ti-onboarding' ).getTrackingId(),
1112
step: select( 'ti-onboarding' ).getCurrentStep(),
13+
sitesMetadata: select( 'ti-onboarding' ).getSites(),
14+
editor: select( 'ti-onboarding' ).getCurrentEditor(),
1215
} ) );
1316

1417
const { setOnboardingStep, setCategory } = useDispatch( 'ti-onboarding' );
1518

19+
const availableCategories = useMemo(() => {
20+
return Object.keys(categories).filter((key) =>
21+
// Show "All" and "Free" categories after user selection.
22+
data.category || (key !== 'all' && key !== 'free')
23+
).filter((key) => {
24+
// Hide "Free" is there is not free template available on the selected editor.
25+
if ( key !== 'free' ) {
26+
return true;
27+
}
28+
return Object.values(data.sitesMetadata.sites?.[data.editor])?.some( (s) => ! s?.upsell);
29+
});
30+
}, [categories, data.category, data.sitesMetadata, data.editor]);
31+
1632
const onClick = ( newCategory ) => {
1733
setCategory( newCategory );
1834

@@ -36,22 +52,31 @@ const CategoryButtons = ( { categories, style } ) => {
3652
}
3753
};
3854

55+
/**
56+
* Default the category to 'all' when the current category is unavailable.
57+
*/
58+
useEffect(() => {
59+
if (data.category && !availableCategories.includes(data.category)) {
60+
setCategory('all');
61+
}
62+
}, [data.category, availableCategories, setCategory]);
63+
3964
return (
4065
<div className="ob-cat-wrap" style={ style }>
41-
{ Object.keys( categories ).map( ( key, index ) => {
66+
{ availableCategories.map( ( catSlug ) => {
4267
const classes = classnames( {
4368
cat: true,
44-
[ key ]: true,
45-
active: key === data.category,
69+
[ catSlug ]: true,
70+
active: catSlug === data.category,
4671
} );
4772

4873
return (
4974
<button
5075
className={ classes }
51-
key={ index }
52-
onClick={ () => onClick( key ) }
76+
key={ catSlug }
77+
onClick={ () => onClick( catSlug ) }
5378
>
54-
{ categories[ key ] }
79+
{ categories[ catSlug ] }
5580
</button>
5681
);
5782
} ) }

0 commit comments

Comments
 (0)