Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
98faa21
WIP
ilicfilip Dec 5, 2025
c908127
apply stashed changes
ilicfilip Dec 5, 2025
8fce770
always init debug tools, while developing
ilicfilip Dec 5, 2025
b2a7cd6
use our enqueue methods
ilicfilip Dec 5, 2025
4b0ad25
cmd + s
ilicfilip Dec 5, 2025
81dc10a
new page for onboarding
ilicfilip Dec 5, 2025
6143996
redirect user back to the origin page
ilicfilip Dec 5, 2025
184bb20
Merge branch 'filip/new-onboard' into filip/new-onboard-full-screen
ilicfilip Dec 9, 2025
958844b
hide X button
ilicfilip Dec 9, 2025
eeb7881
Revert "hide X button"
ilicfilip Dec 9, 2025
8f81263
replace X with "close tour"
ilicfilip Dec 9, 2025
fcebfea
Merge branch 'filip/new-onboard' into filip/new-onboard-full-screen
ilicfilip Dec 12, 2025
0f68896
Merge branch 'filip/new-onboard' into filip/new-onboard-full-screen
ilicfilip Dec 12, 2025
449a870
Merge branch 'filip/new-onboard' into filip/new-onboard-full-screen
ilicfilip Dec 12, 2025
120a5a4
Merge branch 'filip/new-onboard' into filip/new-onboard-full-screen
ilicfilip Dec 12, 2025
316fa38
Merge branch 'filip/new-onboard' into filip/new-onboard-full-screen
ilicfilip Dec 12, 2025
82594ce
Merge branch 'filip/new-onboard' into filip/new-onboard-full-screen
ilicfilip Dec 15, 2025
e457907
Merge branch 'filip/new-onboard' into filip/new-onboard-full-screen
ilicfilip Dec 15, 2025
1af3e67
Merge branch 'filip/new-onboard' into filip/new-onboard-full-screen
ilicfilip Dec 15, 2025
af482c8
Merge branch 'filip/new-onboard' into filip/new-onboard-full-screen
ilicfilip Dec 16, 2025
8967b6b
Merge branch 'develop' into filip/new-onboard-full-screen
ilicfilip Dec 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions assets/css/onboarding/onboarding.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,46 @@
/* Full-screen takeover mode */
.prpl-onboarding-fullscreen {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: #f9fafb;
z-index: 999999;
display: flex;
align-items: center;
justify-content: center;
padding: 20px;
box-sizing: border-box;
}

/* Hide WordPress admin elements when in fullscreen onboarding */
body.prpl-onboarding-active #adminmenumain,
body.prpl-onboarding-active #wpadminbar,
body.prpl-onboarding-active #wpfooter,
body.prpl-onboarding-active #wpcontent {
display: none !important;
}

body.prpl-onboarding-active {
margin: 0 !important;
padding: 0 !important;
overflow: hidden;
}

/* When in fullscreen mode, the popover becomes the centered card */

/* Override the popover attribute's default hidden state */
.prpl-onboarding-fullscreen .prpl-popover-onboarding.prpl-popover-visible {
display: block;
position: relative;
inset: auto;
margin: 0;
max-height: 90vh;
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
border: none;
}

.prpl-popover-onboarding {

--prpl-color-text: #4b5563;
Expand Down
38 changes: 36 additions & 2 deletions assets/js/onboarding/onboarding.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ class ProgressPlannerOnboardWizard {
// Store previously focused element for accessibility
this.previouslyFocusedElement = null;

// Fullscreen mode flag
this.isFullscreenMode = config.fullscreenMode || false;

// Restore saved progress if available
this.restoreSavedProgress();

Expand All @@ -31,6 +34,9 @@ class ProgressPlannerOnboardWizard {

// Set DOM related properties FIRST.
this.popover = document.getElementById( this.config.popoverId );
this.fullscreenWrapper = document.getElementById(
'prpl-onboarding-fullscreen'
);
this.contentWrapper = this.popover.querySelector(
'.tour-content-wrapper'
);
Expand All @@ -43,6 +49,11 @@ class ProgressPlannerOnboardWizard {

// Setup event listeners after DOM is ready
this.setupEventListeners();

// Auto-start onboarding if on the dedicated onboarding page
if ( this.config.isOnboardingPage ) {
this.startOnboarding();
}
}

/**
Expand Down Expand Up @@ -225,10 +236,12 @@ class ProgressPlannerOnboardWizard {
this.closeTour();

// Redirect to the Progress Planner dashboard
// Wait for save to complete before redirecting to prevent re-triggering
if (
this.config.lastStepRedirectUrl &&
this.config.lastStepRedirectUrl.length > 0
) {
await this.saveProgressToServer();
window.location.href = this.config.lastStepRedirectUrl;
}
}
Expand All @@ -248,16 +261,28 @@ class ProgressPlannerOnboardWizard {
* Close the tour
*/
closeTour() {
if ( this.popover ) {
// If fullscreen mode, hide the wrapper and remove body class
if ( this.isFullscreenMode && this.fullscreenWrapper ) {
this.fullscreenWrapper.style.display = 'none';
document.body.classList.remove( 'prpl-onboarding-active' );
this.popover.classList.remove( 'prpl-popover-visible' );
} else if ( this.popover ) {
this.popover.hidePopover();
}

this.saveProgressToServer();

// Cleanup active step
if ( this.state.cleanup ) {
this.state.cleanup();
}

// If on the onboarding page and not finishing, redirect back
if ( this.config.isOnboardingPage && this.config.cancelUrl && ! this.state.data.finished ) {
window.location.href = this.config.cancelUrl;
return;
}

// Reset cleanup
this.state.cleanup = null;

Expand All @@ -280,7 +305,16 @@ class ProgressPlannerOnboardWizard {
this.previouslyFocusedElement =
this.popover.ownerDocument.activeElement;

this.popover.showPopover();
// If fullscreen mode, show the wrapper and add body class
// Don't use popover API in fullscreen mode - it moves to top layer and breaks positioning
if ( this.isFullscreenMode && this.fullscreenWrapper ) {
this.fullscreenWrapper.style.display = 'flex';
document.body.classList.add( 'prpl-onboarding-active' );
this.popover.classList.add( 'prpl-popover-visible' );
} else {
this.popover.showPopover();
}

this.updateStepNavigation();
this.renderStep();

Expand Down
70 changes: 68 additions & 2 deletions classes/class-onboard-wizard.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@
*/
class Onboard_Wizard {

/**
* The onboarding page slug.
*
* @var string
*/
const PAGE_SLUG = 'progress-planner-onboarding';

/**
* Steps and their order.
*
Expand Down Expand Up @@ -69,6 +76,9 @@ public function maybe_register_popover_hooks() {
return;
}

// Register onboarding admin page (always, so it's accessible).
\add_action( 'admin_menu', [ $this, 'add_onboarding_page' ] );

// Add popover on front end.
\add_action( 'wp_footer', [ $this, 'add_popover' ] );
\add_action( 'wp_footer', [ $this, 'add_popover_step_templates' ] );
Expand Down Expand Up @@ -276,6 +286,13 @@ public function add_popover_scripts() {
// Get saved progress from user meta.
$saved_progress = $this->get_saved_progress();

// Check if we're on the onboarding page.
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
$is_onboarding_page = \is_admin() && isset( $_GET['page'] ) && self::PAGE_SLUG === $_GET['page'];

// Check if onboarding was already completed.
$onboarding_completed = \get_option( 'prpl_onboarding_completed', false );

// Enqueue main onboarding.js (depends on all step components).
\progress_planner()->get_admin__enqueue()->enqueue_script(
'onboarding/onboarding',
Expand All @@ -292,6 +309,9 @@ public function add_popover_scripts() {
'timezone_offset' => (float) ( \wp_timezone()->getOffset( new \DateTime( 'midnight' ) ) / 3600 ),
'savedProgress' => $saved_progress,
'lastStepRedirectUrl' => \esc_url_raw( admin_url( 'admin.php?page=progress-planner' ) ),
'cancelUrl' => $is_onboarding_page ? \esc_url_raw( \wp_get_referer() ? \wp_get_referer() : admin_url( 'admin.php?page=progress-planner' ) ) : '',
'isOnboardingPage' => $is_onboarding_page,
'onboardingCompleted' => (bool) $onboarding_completed,
'fullscreenMode' => true, // Enable fullscreen takeover mode.
'hasLicense' => false !== \progress_planner()->get_license_key(),
'l10n' => [
Expand Down Expand Up @@ -319,7 +339,7 @@ protected function get_saved_progress() {
return null;
}

$onboarding_progress = \get_option( 'prpl_onboard_progress', true );
$onboarding_progress = \get_option( 'prpl_onboard_progress', false );
if ( ! $onboarding_progress ) {
return null;
}
Expand All @@ -332,6 +352,50 @@ protected function get_saved_progress() {
return $decoded;
}

/**
* Add the onboarding admin page.
*
* @return void
*/
public function add_onboarding_page() {
// Use 'options.php' as parent to create a hidden page (common WordPress pattern).
\add_submenu_page(
'options.php',
\esc_html__( 'Setup Wizard', 'progress-planner' ),
\esc_html__( 'Setup Wizard', 'progress-planner' ),
'manage_options',
self::PAGE_SLUG,
[ $this, 'render_onboarding_page' ]
);
}

/**
* Render the onboarding admin page.
*
* @return void
*/
public function render_onboarding_page() {
\progress_planner()->the_view( 'onboarding-page.php' );
}

/**
* Get the onboarding page URL.
*
* @return string
*/
public static function get_onboarding_page_url() {
return \admin_url( 'options.php?page=' . self::PAGE_SLUG );
}

/**
* Add admin toolbar item.
*
* @return void
*/
public function add_admin_toolbar_items() {
\add_action( 'admin_bar_menu', [ $this, 'add_admin_toolbar_items_callback' ], 100 );
}

/**
* Verify AJAX security (capability and nonce).
*
Expand Down Expand Up @@ -505,6 +569,7 @@ public function trigger_onboarding() {
*/
public function add_popover() {
?>
<div id="prpl-onboarding-fullscreen" class="prpl-onboarding-fullscreen" style="display: none;">
<div id="prpl-popover-onboarding" class="prpl-popover-onboarding" data-prpl-step="0" popover="manual" tabindex="-1">
<div class="prpl-onboarding-layout">
<!-- Left column: Step navigation -->
Expand Down Expand Up @@ -543,9 +608,10 @@ public function add_popover() {
</div>

<button id="prpl-tour-close-btn" class="prpl-popover-close" popovertarget="prpl-popover-onboarding" popovertargetaction="hide">
<span class="dashicons dashicons-no-alt"></span>
<?php echo \esc_html__( 'Close tour', 'progress-planner' ); ?>
</button>
</div>
</div><!-- /#prpl-onboarding-fullscreen -->
<?php
}

Expand Down
2 changes: 1 addition & 1 deletion classes/utils/class-onboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function on_activate_plugin( $plugin ) {
}

if ( ! \defined( 'WP_CLI' ) || ! \WP_CLI ) {
\wp_safe_redirect( \admin_url( 'admin.php?page=progress-planner' ) );
\wp_safe_redirect( \Progress_Planner\Onboard_Wizard::get_onboarding_page_url() );
exit;
}
}
Expand Down
4 changes: 2 additions & 2 deletions views/admin-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
<div class="prpl-start-onboarding-graphic">
<?php \progress_planner()->the_file( 'assets/images/onboarding/thumbs_up_ravi_rtl.svg' ); ?>
</div>
<button class="prpl-button-primary" id="prpl-start-onboarding-button" onclick="window.prplOnboardWizard.startOnboarding();return false;">
<a class="prpl-button-primary" id="prpl-start-onboarding-button" href="<?php echo \esc_url( \Progress_Planner\Onboard_Wizard::get_onboarding_page_url() ); ?>">
<?php \esc_html_e( 'Are you ready to work on your site?', 'progress-planner' ); ?>
</button>
</a>
</div>
<?php endif; ?>
</div>
Expand Down
18 changes: 18 additions & 0 deletions views/onboarding-page.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php
/**
* The onboarding wizard page.
*
* This is a minimal page that serves as a container for the fullscreen onboarding wizard.
* The wizard will auto-start when this page loads.
*
* @package Progress_Planner
*/

// Exit if accessed directly.
if ( ! \defined( 'ABSPATH' ) ) {
exit;
}
?>
<div class="wrap prpl-onboarding-page-wrap">
<!-- The fullscreen onboarding wizard will render here via JS -->
</div>
Loading