Skip to content

Commit e1c36d3

Browse files
committed
fix: spc stopping wizard flow
1 parent 9148401 commit e1c36d3

3 files changed

Lines changed: 24 additions & 24 deletions

File tree

classes/Visualizer/Module/Wizard.php

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,7 @@ private function setup_wizard_install_plugin() {
586586
// Update wizard data.
587587
$wizard_data['enable_page_cache'] = true;
588588
$wizard_data_updated = true;
589+
update_option( 'swcfpc_dashboard_redirect', false );
589590
}
590591
if ( $wizard_data_updated ) {
591592
$this->update_wizard_data( $wizard_data );
@@ -640,16 +641,17 @@ private function setup_wizard_subscribe_process() {
640641
}
641642

642643
if ( $with_subscribe && is_email( $email ) ) {
643-
$request_res = wp_remote_post(
644+
wp_remote_post(
644645
VISUALIZER_SUBSCRIBE_API,
645646
array(
646-
'timeout' => 100,
647-
'headers' => array(
647+
'timeout' => 5,
648+
'blocking' => false,
649+
'headers' => array(
648650
'Content-Type' => 'application/json',
649651
'Cache-Control' => 'no-cache',
650652
'Accept' => 'application/json, */*;q=0.1',
651653
),
652-
'body' => wp_json_encode(
654+
'body' => wp_json_encode(
653655
array(
654656
'slug' => 'visualizer',
655657
'site' => home_url(),
@@ -661,24 +663,10 @@ private function setup_wizard_subscribe_process() {
661663
),
662664
)
663665
);
664-
if ( ! is_wp_error( $request_res ) ) {
665-
$body = json_decode( wp_remote_retrieve_body( $request_res ) );
666-
if ( 'success' === $body->code ) {
667-
$this->dismissWizard( false );
668-
wp_send_json( $response );
669-
}
670-
}
671-
wp_send_json(
672-
array(
673-
'status' => 0,
674-
'redirect_to' => '',
675-
'message' => '',
676-
)
677-
);
678-
} else {
679-
$this->dismissWizard( false );
680-
wp_send_json( $response );
681666
}
667+
668+
$this->dismissWizard( false );
669+
wp_send_json( $response );
682670
}
683671

684672
/**

css/style-wizard.css

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,23 +1335,24 @@ display: none;
13351335
top: 0;
13361336
width: 100%;
13371337
height: 100%;
1338-
padding: 12px 12px 20px;
13391338
z-index: 2;
13401339
opacity: 0;
13411340
visibility: hidden;
13421341
transition: all .3s ease-in-out;
13431342
}
13441343
.vz-pro-option .pro-overlay .pro-box{
13451344
padding-bottom: 58.88%;
1346-
background: rgba(255,255,255,.5);
1345+
background: rgba(185, 185, 185, 0.5);
13471346
backdrop-filter: blur(2px);
1347+
height: 100%;
13481348
}
13491349
.vz-pro-option .pro-overlay .pro-box .btn {
13501350
position: absolute;
13511351
top: 50%;
13521352
left: 50%;
13531353
white-space: nowrap;
13541354
transform: translate(-50%, -50%);
1355+
font-size: 14px;
13551356
}
13561357

13571358
.vz-power-pro{

js/setup-wizard.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,15 @@ jQuery(function ($) {
288288
// Enable performance feature.
289289
// Step: 4 Skip and subscribe process.
290290
$(document).on( 'click', '.vz-subscribe', function (e) {
291-
var withSubscribe = $(this).data("vz_subscribe");
291+
var $btn = $(this);
292+
293+
// Prevent double-clicks while the async flow is running.
294+
if ( $btn.prop('disabled') ) {
295+
e.preventDefault();
296+
return;
297+
}
298+
299+
var withSubscribe = $btn.data("vz_subscribe");
292300
var postData = {
293301
action: "visualizer_wizard_step_process",
294302
security: visualizerSetupWizardData.ajax.security,
@@ -319,6 +327,8 @@ jQuery(function ($) {
319327
} else {
320328
postData.with_subscribe = false;
321329
}
330+
331+
$btn.prop('disabled', true);
322332
var $step = $('#step-3');
323333
$step.find(".spinner").addClass("is-active");
324334
var $error = $step.find('.vz-error-notice').first();
@@ -331,6 +341,7 @@ jQuery(function ($) {
331341
$error.html('<p>' + message + '</p>').removeClass('hidden');
332342
}
333343
$step.find(".spinner").removeClass("is-active");
344+
$btn.prop('disabled', false);
334345
return;
335346
}
336347
goToDraftPage(postData);

0 commit comments

Comments
 (0)