| @@ -44,14 +44,24 @@ | ||
| 44 | 44 | $new_links = []; |
| 45 | 45 | $demo_url = 'https://shopbuilderwp.com/'; |
| 46 | 46 | $new_links[] = '<a href="' . admin_url( 'admin.php?page=rtsb-settings' ) . '">' . esc_html__( 'Settings', 'shopbuilder' ) . '</a>'; |
| 47 | 47 | $new_links[] = '<a target="_blank" href="' . esc_url( $demo_url ) . '">' . esc_html__( 'Demo', 'shopbuilder' ) . '</a>'; |
| 48 | - $new_links[] = '<a target="_blank" href="' . esc_url( 'https://www.radiustheme.com/docs/shopbuilder/getting-started/requirements/' ) . '">' . esc_html__( 'Documentation', 'shopbuilder' ) . '</a>'; | |
| 48 | + $new_links[] = '<a target="_blank" href="' . esc_url( 'https://shopbuilderwp.com/docs/' ) . '">' . esc_html__( 'Documentation', 'shopbuilder' ) . '</a>'; | |
| 49 | 49 | |
| 50 | 50 | $links = array_merge( $new_links, $links ); |
| 51 | 51 | |
| 52 | + $current = time(); | |
| 53 | + // Check if current date is within promotional period (Sept 19 - Jan 5). | |
| 54 | + $start_date = strtotime( '2025-11-12 00:00:00' ); | |
| 55 | + $end_date = strtotime( '2025-12-30 23:59:59' ); | |
| 56 | + $is_promo_period = $start_date <= $current && $current <= $end_date; | |
| 57 | + $text = esc_html__( 'Get Pro', 'shopbuilder' ); | |
| 58 | + if ( $is_promo_period ) { | |
| 59 | + $text = esc_html__( 'Get 60% off', 'shopbuilder' ); | |
| 60 | + } | |
| 61 | + | |
| 52 | 62 | if ( ! rtsb()->has_pro() ) { |
| 53 | - $links['shopbuilder_pro'] = '<a href="' . esc_url( rtsb()->pro_version_link() ) . '" target="_blank" style="color: #39b54a; font-weight: bold;">' . esc_html__( 'Go Pro', 'shopbuilder' ) . '</a>'; | |
| 63 | + $links['shopbuilder_pro'] = '<a href="' . esc_url( rtsb()->pro_version_link() ) . '" target="_blank" style="color: #39b54a; font-weight: bold;">' . $text . '</a>'; | |
| 54 | 64 | } |
| 55 | 65 | |
| 56 | 66 | return $links; |
| 57 | 67 | } |
| @@ -68,8 +78,9 @@ | ||
| 68 | 78 | |
| 69 | 79 | if ( RTSB_ACTIVE_FILE_NAME === $file ) { |
| 70 | 80 | $report_url = 'https://www.radiustheme.com/contact/'; |
| 71 | 81 | $row_meta['issues'] = sprintf( |
| 82 | + /* translators: %1$s: Report URL, %2$s: Facing issue?, %3$s: Please open a support ticket. */ | |
| 72 | 83 | '%2$s <a target="_blank" href="%1$s"><span style="color: red">%3$s</span></a>', |
| 73 | 84 | esc_url( $report_url ), |
| 74 | 85 | esc_html__( 'Facing issue?', 'shopbuilder' ), |
| 75 | 86 | esc_html__( 'Please open a support ticket.', 'shopbuilder' ) |
| @@ -80,13 +91,9 @@ | ||
| 80 | 91 | |
| 81 | 92 | return (array) $links; |
| 82 | 93 | } |
| 83 | 94 | |
| 84 | - // Servay | |
| 85 | - | |
| 86 | 95 | /*** |
| 87 | - * @param $mimes | |
| 88 | - * | |
| 89 | 96 | * @return mixed |
| 90 | 97 | */ |
| 91 | 98 | public function deactivation_popup() { |
| 92 | 99 | global $pagenow; |
| @@ -100,10 +107,17 @@ | ||
| 100 | 107 | <div id="deactivation-dialog-<?php echo esc_attr( $this->textdomain ); ?>" title="Quick Feedback"> |
| 101 | 108 | <!-- Modal content --> |
| 102 | 109 | <div class="modal-content"> |
| 103 | 110 | <div id="feedback-form-body-<?php echo esc_attr( $this->textdomain ); ?>"> |
| 111 | + <p class="rtsb-deactivate-intro" style="margin: 0 0 15px 0;"> | |
| 112 | + Having trouble? <br/> | |
| 113 | + For faster and more accurate support, please | |
| 114 | + <a target="_blank" href="https://www.radiustheme.com/contact/" class="rtsb-support-link">open a support ticket</a> | |
| 115 | + — our support agent will personally review and resolve your issue. | |
| 116 | + </p> | |
| 117 | + | |
| 104 | 118 | <div class="feedback-input-header"> |
| 105 | - <?php echo esc_html__( 'If you have a moment, please share why you are deactivating ShopBuilder:', 'shopbuilder' ); ?> | |
| 119 | + <?php echo esc_html__( 'If you’d prefer not to open a support ticket, please take a moment to share why you’re deactivating ShopBuilder:', 'shopbuilder' ); ?> | |
| 106 | 120 | </div> |
| 107 | 121 | |
| 108 | 122 | <div class="feedback-input-wrapper"> |
| 109 | 123 | <input id="feedback-deactivate-<?php echo esc_attr( $this->textdomain ); ?>-bug_issue_detected" class="feedback-input" |
| @@ -139,16 +153,18 @@ | ||
| 139 | 153 | temporary deactivation</label> |
| 140 | 154 | </div> |
| 141 | 155 | <span style="color:red;font-size: 13px;"></span> |
| 142 | 156 | </div> |
| 143 | - <p style="margin: 10px 0 15px 0;"> | |
| 144 | - Please let us know about any issues you are facing with the plugin. | |
| 145 | - How can we improve the plugin? | |
| 146 | - </p> | |
| 147 | - <div class="feedback-text-wrapper-<?php echo esc_attr( $this->textdomain ); ?>"> | |
| 148 | - <textarea id="deactivation-feedback-<?php echo esc_attr( $this->textdomain ); ?>" rows="4" cols="40" | |
| 149 | - placeholder=" Write something here. How can we improve the plugin?"></textarea> | |
| 150 | - <span style="display: block;color:red;font-size: 13px;margin-top: 5px;"></span> | |
| 157 | + <div class="rtsb-feedback-extra" style="display:none;"> | |
| 158 | + <p style="margin: 10px 0 15px 0;"> | |
| 159 | + Please let us know about any issues you are facing with the plugin. | |
| 160 | + How can we improve the plugin? | |
| 161 | + </p> | |
| 162 | + <div class="feedback-text-wrapper-<?php echo esc_attr( $this->textdomain ); ?>"> | |
| 163 | + <textarea id="deactivation-feedback-<?php echo esc_attr( $this->textdomain ); ?>" rows="2" cols="40" | |
| 164 | + placeholder=" Write something here. How can we improve the plugin?"></textarea> | |
| 165 | + <span style="display: block;color:red;font-size: 13px;margin-top: 5px;"></span> | |
| 166 | + </div> | |
| 151 | 167 | </div> |
| 152 | 168 | </div> |
| 153 | 169 | </div> |
| 154 | 170 | <?php |
| @@ -154,10 +170,8 @@ | ||
| 154 | 170 | <?php |
| 155 | 171 | } |
| 156 | 172 | |
| 157 | 173 | /*** |
| 158 | - * @param $mimes | |
| 159 | - * | |
| 160 | 174 | * @return mixed |
| 161 | 175 | */ |
| 162 | 176 | public function dialog_box_style() { |
| 163 | 177 | ?> |
| @@ -212,41 +226,19 @@ | ||
| 212 | 226 | margin: auto; |
| 213 | 227 | padding: 0; |
| 214 | 228 | } |
| 215 | 229 | |
| 216 | - /*#deactivation-dialog-*/<?php // echo esc_attr( $this->textdomain ); ?>/* .feedback-label {*/ | |
| 217 | - /* font-size: 15px;*/ | |
| 218 | - /*}*/ | |
| 219 | - | |
| 220 | - div#deactivation-dialog-<?php echo esc_attr( $this->textdomain ); ?> p { | |
| 221 | - font-size: 15px; | |
| 222 | - } | |
| 223 | - | |
| 224 | 230 | #deactivation-dialog-<?php echo esc_attr( $this->textdomain ); ?> .modal-content > * { |
| 225 | 231 | width: 100%; |
| 226 | 232 | overflow: hidden; |
| 227 | 233 | } |
| 228 | 234 | |
| 229 | - #deactivation-dialog-<?php echo esc_attr( $this->textdomain ); ?> .modal-content textarea { | |
| 230 | - border: 1px solid rgba(0, 0, 0, 0.3); | |
| 231 | - padding: 15px; | |
| 232 | - width: 100%; | |
| 233 | - } | |
| 234 | - | |
| 235 | - #deactivation-dialog-<?php echo esc_attr( $this->textdomain ); ?> .modal-content textarea:focus { | |
| 236 | - border-color: #2271b1; | |
| 237 | - } | |
| 238 | - | |
| 239 | 235 | #deactivation-dialog-<?php echo esc_attr( $this->textdomain ); ?> .modal-content input.feedback-feedback-text { |
| 240 | - border: 1px solid rgba(0, 0, 0, 0.3); | |
| 236 | + border: 1px solid #cbd5e1; | |
| 241 | 237 | min-width: 250px; |
| 238 | + border-radius: 6px; | |
| 242 | 239 | } |
| 243 | 240 | |
| 244 | - /* The Close Button */ | |
| 245 | - #deactivation-dialog-<?php echo esc_attr( $this->textdomain ); ?> input[type="radio"] { | |
| 246 | - margin: 0; | |
| 247 | - } | |
| 248 | - | |
| 249 | 241 | .ui-dialog-title { |
| 250 | 242 | font-size: 18px; |
| 251 | 243 | font-weight: 600; |
| 252 | 244 | } |
| @@ -292,9 +284,15 @@ | ||
| 292 | 284 | |
| 293 | 285 | .ui-dialog[aria-describedby="deactivation-dialog-<?php echo esc_attr( $this->textdomain ); ?>"] { |
| 294 | 286 | background-color: #fefefe; |
| 295 | 287 | box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); |
| 296 | - z-index: 99; | |
| 288 | + z-index: 9999; | |
| 289 | + position: fixed !important; | |
| 290 | + top: 50% !important; | |
| 291 | + left: 50% !important; | |
| 292 | + transform: translate(-50%, -50%) !important; | |
| 293 | + max-height: 90vh; | |
| 294 | + overflow-y: auto; | |
| 297 | 295 | } |
| 298 | 296 | |
| 299 | 297 | .ui-dialog[aria-describedby="deactivation-dialog-<?php echo esc_attr( $this->textdomain ); ?>"] .ui-dialog-title { |
| 300 | 298 | text-transform: uppercase; |
| @@ -307,15 +305,44 @@ | ||
| 307 | 305 | #deactivation-dialog-<?php echo esc_attr( $this->textdomain ); ?> { |
| 308 | 306 | padding: 30px !important; |
| 309 | 307 | } |
| 310 | 308 | |
| 309 | + #deactivation-dialog-<?php echo esc_attr( $this->textdomain ); ?> .rtsb-support-link { | |
| 310 | + display: inline-block; | |
| 311 | + padding: 2px 8px; | |
| 312 | + margin: 0 2px; | |
| 313 | + background: rgba(216, 14, 14, 0.08); | |
| 314 | + color: #d80e0e; | |
| 315 | + font-weight: 600; | |
| 316 | + border-radius: 4px; | |
| 317 | + text-decoration: none; | |
| 318 | + border: 1px solid rgba(216, 14, 14, 0.25); | |
| 319 | + transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease; | |
| 320 | + } | |
| 321 | + | |
| 322 | + #deactivation-dialog-<?php echo esc_attr( $this->textdomain ); ?> .rtsb-support-link:hover, | |
| 323 | + #deactivation-dialog-<?php echo esc_attr( $this->textdomain ); ?> .rtsb-support-link:focus { | |
| 324 | + background: #d80e0e; | |
| 325 | + color: #fff; | |
| 326 | + border-color: #d80e0e; | |
| 327 | + text-decoration: none; | |
| 328 | + outline: none; | |
| 329 | + } | |
| 330 | + | |
| 311 | 331 | #deactivation-dialog-<?php echo esc_attr( $this->textdomain ); ?> .feedback-input-header { |
| 312 | 332 | font-weight: 600; |
| 313 | - font-size: 15px; | |
| 314 | - line-height: 1.4; | |
| 315 | - margin-bottom: 20px; | |
| 333 | + font-size: 14px; | |
| 334 | + line-height: 1.5; | |
| 335 | + margin-bottom: 16px; | |
| 336 | + color: #1f2937; | |
| 316 | 337 | } |
| 317 | 338 | |
| 339 | + div#deactivation-dialog-<?php echo esc_attr( $this->textdomain ); ?> p { | |
| 340 | + font-size: 14px; | |
| 341 | + color: #4b5563; | |
| 342 | + line-height: 1.55; | |
| 343 | + } | |
| 344 | + | |
| 318 | 345 | div#deactivation-dialog-<?php echo esc_attr( $this->textdomain ); ?>, |
| 319 | 346 | .ui-draggable .ui-dialog-titlebar { |
| 320 | 347 | padding: 18px 15px; |
| 321 | 348 | box-shadow: 0 0 3px rgba(0, 0, 0, 0.1); |
| @@ -322,33 +349,143 @@ | ||
| 322 | 349 | text-align: left; |
| 323 | 350 | } |
| 324 | 351 | |
| 325 | 352 | div#deactivation-dialog-<?php echo esc_attr( $this->textdomain ); ?> .modal-content .feedback-input-wrapper { |
| 326 | - margin-bottom: 8px; | |
| 353 | + margin-bottom: 6px; | |
| 327 | 354 | display: flex; |
| 328 | 355 | align-items: center; |
| 329 | - gap: 8px; | |
| 330 | - /*line-height: 2;*/ | |
| 331 | - padding: 0 1px; | |
| 356 | + gap: 10px; | |
| 357 | + padding: 10px 12px; | |
| 332 | 358 | font-size: 14px; |
| 359 | + border: 1px solid #e5e7eb; | |
| 360 | + border-radius: 8px; | |
| 361 | + background: #fff; | |
| 362 | + cursor: pointer; | |
| 363 | + transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease; | |
| 333 | 364 | } |
| 334 | 365 | |
| 366 | + div#deactivation-dialog-<?php echo esc_attr( $this->textdomain ); ?> .modal-content .feedback-input-wrapper:hover { | |
| 367 | + border-color: #4360ef; | |
| 368 | + background: rgba(67, 96, 239, 0.04); | |
| 369 | + } | |
| 370 | + | |
| 371 | + div#deactivation-dialog-<?php echo esc_attr( $this->textdomain ); ?> .modal-content .feedback-input-wrapper:has(input[type="radio"]:checked) { | |
| 372 | + border-color: #4360ef; | |
| 373 | + background: rgba(67, 96, 239, 0.06); | |
| 374 | + } | |
| 375 | + | |
| 376 | + div#deactivation-dialog-<?php echo esc_attr( $this->textdomain ); ?> .modal-content .feedback-input-wrapper .feedback-label { | |
| 377 | + flex: 1; | |
| 378 | + cursor: pointer; | |
| 379 | + user-select: none; | |
| 380 | + color: #1f2937; | |
| 381 | + font-weight: 500; | |
| 382 | + line-height: 1.4; | |
| 383 | + } | |
| 384 | + | |
| 385 | + #deactivation-dialog-<?php echo esc_attr( $this->textdomain ); ?> input[type="radio"] { | |
| 386 | + appearance: none; | |
| 387 | + -webkit-appearance: none; | |
| 388 | + width: 18px; | |
| 389 | + height: 18px; | |
| 390 | + border: 1.5px solid #cbd5e1; | |
| 391 | + border-radius: 50%; | |
| 392 | + background: #fff; | |
| 393 | + cursor: pointer; | |
| 394 | + position: relative; | |
| 395 | + flex: 0 0 auto; | |
| 396 | + box-sizing: border-box; | |
| 397 | + outline: none; | |
| 398 | + box-shadow: none; | |
| 399 | + transition: border-color 0.15s ease; | |
| 400 | + } | |
| 401 | + | |
| 402 | + #deactivation-dialog-<?php echo esc_attr( $this->textdomain ); ?> input[type="radio"]:hover, | |
| 403 | + #deactivation-dialog-<?php echo esc_attr( $this->textdomain ); ?> input[type="radio"]:focus, | |
| 404 | + #deactivation-dialog-<?php echo esc_attr( $this->textdomain ); ?> input[type="radio"]:focus-visible, | |
| 405 | + #deactivation-dialog-<?php echo esc_attr( $this->textdomain ); ?> input[type="radio"]:active { | |
| 406 | + outline: none; | |
| 407 | + box-shadow: none; | |
| 408 | + } | |
| 409 | + | |
| 410 | + #deactivation-dialog-<?php echo esc_attr( $this->textdomain ); ?> input[type="radio"]:hover { | |
| 411 | + border-color: #94a3b8; | |
| 412 | + } | |
| 413 | + | |
| 414 | + #deactivation-dialog-<?php echo esc_attr( $this->textdomain ); ?> input[type="radio"]:checked { | |
| 415 | + border-color: #4360ef; | |
| 416 | + outline: none; | |
| 417 | + box-shadow: none; | |
| 418 | + } | |
| 419 | + | |
| 420 | + #deactivation-dialog-<?php echo esc_attr( $this->textdomain ); ?> input[type="radio"]:checked::after { | |
| 421 | + content: ''; | |
| 422 | + position: absolute; | |
| 423 | + top: 50%; | |
| 424 | + left: 50%; | |
| 425 | + transform: translate(-50%, -50%); | |
| 426 | + width: 8px; | |
| 427 | + height: 8px; | |
| 428 | + border-radius: 50%; | |
| 429 | + background: #4360ef; | |
| 430 | + } | |
| 431 | + | |
| 335 | 432 | div#deactivation-dialog-<?php echo esc_attr( $this->textdomain ); ?> .modal-content .feedback-input-wrapper.conditional { |
| 336 | 433 | flex-wrap: wrap; |
| 337 | 434 | } |
| 338 | 435 | |
| 339 | 436 | div#deactivation-dialog-<?php echo esc_attr( $this->textdomain ); ?> .modal-content .feedback-input-wrapper.conditional .feedback-feedback-text { |
| 340 | - flex: 0 0 calc(100% - 24px); | |
| 341 | - margin: 5px 0 10px 24px; | |
| 342 | - min-height: 40px; | |
| 343 | - border: 1px solid rgba(0, 0, 0, 0.3); | |
| 344 | - padding: 0 15px; | |
| 437 | + flex: 0 0 calc(100% - 28px); | |
| 438 | + margin: 8px 0 0 28px; | |
| 439 | + min-height: 38px; | |
| 440 | + border: 1px solid #cbd5e1; | |
| 441 | + border-radius: 6px; | |
| 442 | + padding: 0 12px; | |
| 443 | + font-size: 13px; | |
| 444 | + transition: border-color 0.15s ease, box-shadow 0.15s ease; | |
| 345 | 445 | } |
| 346 | 446 | |
| 347 | 447 | div#deactivation-dialog-<?php echo esc_attr( $this->textdomain ); ?> .modal-content .feedback-input-wrapper.conditional .feedback-feedback-text:focus { |
| 348 | - border-color: #2271b1; | |
| 448 | + border-color: #4360ef; | |
| 449 | + outline: none; | |
| 450 | + box-shadow: 0 0 0 3px rgba(67, 96, 239, 0.15); | |
| 349 | 451 | } |
| 350 | 452 | |
| 453 | + #deactivation-dialog-<?php echo esc_attr( $this->textdomain ); ?> .rtsb-feedback-extra { | |
| 454 | + margin: 6px 0 10px; | |
| 455 | + padding: 12px 14px; | |
| 456 | + background: #f8fafc; | |
| 457 | + border: 1px dashed #cbd5e1; | |
| 458 | + border-radius: 8px; | |
| 459 | + } | |
| 460 | + | |
| 461 | + #deactivation-dialog-<?php echo esc_attr( $this->textdomain ); ?> .rtsb-feedback-extra p { | |
| 462 | + margin: 0 0 8px !important; | |
| 463 | + font-size: 13px !important; | |
| 464 | + font-weight: 500; | |
| 465 | + color: #4b5563; | |
| 466 | + line-height: 1.4; | |
| 467 | + } | |
| 468 | + | |
| 469 | + #deactivation-dialog-<?php echo esc_attr( $this->textdomain ); ?> .modal-content textarea { | |
| 470 | + border: 1px solid #cbd5e1; | |
| 471 | + border-radius: 6px; | |
| 472 | + padding: 8px 10px; | |
| 473 | + width: 100%; | |
| 474 | + min-height: 56px; | |
| 475 | + max-height: 120px; | |
| 476 | + font-size: 13px; | |
| 477 | + line-height: 1.45; | |
| 478 | + resize: vertical; | |
| 479 | + transition: border-color 0.15s ease, box-shadow 0.15s ease; | |
| 480 | + } | |
| 481 | + | |
| 482 | + #deactivation-dialog-<?php echo esc_attr( $this->textdomain ); ?> .modal-content textarea:focus { | |
| 483 | + border-color: #4360ef; | |
| 484 | + outline: none; | |
| 485 | + box-shadow: 0 0 0 3px rgba(67, 96, 239, 0.15); | |
| 486 | + } | |
| 487 | + | |
| 351 | 488 | .ui-widget-overlay.ui-front { |
| 352 | 489 | position: fixed; |
| 353 | 490 | top: 0; |
| 354 | 491 | left: 0; |
| @@ -400,8 +537,35 @@ | ||
| 400 | 537 | .ui-dialog[aria-describedby="deactivation-dialog-shopbuilder"] .ui-dialog-buttonset .ui-button:last-child:hover { |
| 401 | 538 | background: #d80e0e; |
| 402 | 539 | color: #fff; |
| 403 | 540 | } |
| 541 | + | |
| 542 | + /* Loading overlay shown while submitting feedback / deactivating. */ | |
| 543 | + .rtsb-deactivate-loader { | |
| 544 | + position: absolute; | |
| 545 | + inset: 0; | |
| 546 | + display: flex; | |
| 547 | + align-items: center; | |
| 548 | + justify-content: center; | |
| 549 | + background: rgba(255, 255, 255, 0.72); | |
| 550 | + z-index: 100; | |
| 551 | + border-radius: inherit; | |
| 552 | + } | |
| 553 | + | |
| 554 | + .rtsb-deactivate-loader .rtsb-deactivate-spinner { | |
| 555 | + width: 40px; | |
| 556 | + height: 40px; | |
| 557 | + border: 3px solid rgba(67, 96, 239, 0.2); | |
| 558 | + border-top-color: #4360ef; | |
| 559 | + border-radius: 50%; | |
| 560 | + animation: rtsb-deactivate-spin 0.8s linear infinite; | |
| 561 | + } | |
| 562 | + | |
| 563 | + @keyframes rtsb-deactivate-spin { | |
| 564 | + to { | |
| 565 | + transform: rotate(360deg); | |
| 566 | + } | |
| 567 | + } | |
| 404 | 568 | </style> |
| 405 | 569 | |
| 406 | 570 | <?php |
| 407 | 571 | } |
| @@ -406,11 +570,9 @@ | ||
| 406 | 570 | <?php |
| 407 | 571 | } |
| 408 | 572 | |
| 409 | 573 | /*** |
| 410 | - * @param $mimes | |
| 411 | - * | |
| 412 | - * @return mixed | |
| 574 | + * @return void | |
| 413 | 575 | */ |
| 414 | 576 | public function deactivation_scripts() { |
| 415 | 577 | wp_enqueue_script( 'jquery-ui-dialog' ); |
| 416 | 578 | ?> |
| @@ -424,8 +586,9 @@ | ||
| 424 | 586 | $('#deactivation-dialog-<?php echo esc_attr( $this->textdomain ); ?> .modal-content input[name="reason_found_a_better_plugin"]').hide(); |
| 425 | 587 | var dialogbox = $('#deactivation-dialog-<?php echo esc_attr( $this->textdomain ); ?>').dialog({ |
| 426 | 588 | modal: true, |
| 427 | 589 | width: 550, |
| 590 | + position: { my: "center", at: "center", of: window }, | |
| 428 | 591 | show: { |
| 429 | 592 | effect: "fadeIn", |
| 430 | 593 | duration: 400 |
| 431 | 594 | }, |
| @@ -438,18 +601,49 @@ | ||
| 438 | 601 | Submit: function () { |
| 439 | 602 | submitFeedback(); |
| 440 | 603 | }, |
| 441 | 604 | Cancel: function () { |
| 442 | - $(this).dialog('close'); | |
| 605 | + showDeactivateLoader(); | |
| 443 | 606 | window.location.href = href; |
| 444 | 607 | } |
| 445 | 608 | } |
| 446 | 609 | }); |
| 447 | 610 | |
| 611 | + // Keep the dialog centered on window resize. | |
| 612 | + $(window).off('resize.rtsbDeactivate').on('resize.rtsbDeactivate', function () { | |
| 613 | + if ( dialogbox.dialog('instance') ) { | |
| 614 | + dialogbox.dialog('option', 'position', { my: 'center', at: 'center', of: window }); | |
| 615 | + } | |
| 616 | + }); | |
| 448 | 617 | |
| 618 | + | |
| 619 | + // Make the entire feedback-input-wrapper card clickable to select its radio. | |
| 620 | + dialogbox.on('click', '.feedback-input-wrapper', function (event) { | |
| 621 | + // Ignore clicks on the inner radio/label (native behavior handles them) and the | |
| 622 | + // "Found a better plugin" name input so typing inside it doesn't re-toggle. | |
| 623 | + if ( $(event.target).is('input, label') ) { | |
| 624 | + return; | |
| 625 | + } | |
| 626 | + var $radio = $(this).find('input[type="radio"]'); | |
| 627 | + if ( $radio.length && ! $radio.prop('checked') ) { | |
| 628 | + $radio.prop('checked', true).trigger('change'); | |
| 629 | + } | |
| 630 | + }); | |
| 631 | + | |
| 449 | 632 | // Close the dialog when clicking outside of it |
| 450 | 633 | dialogbox.on('change', 'input[type="radio"]', function (event) { |
| 451 | - var reasons = $('#deactivation-dialog-<?php echo esc_attr( $this->textdomain ); ?> input[type="radio"]:checked').val(); | |
| 634 | + var $extra = $('#deactivation-dialog-<?php echo esc_attr( $this->textdomain ); ?> .rtsb-feedback-extra'); | |
| 635 | + var $selectedRow = $(this).closest('.feedback-input-wrapper'); | |
| 636 | + var reasons = $('#deactivation-dialog-<?php echo esc_attr( $this->textdomain ); ?> input[type="radio"]:checked').val(); | |
| 637 | + // Temporary deactivation does not need a feedback message — keep the textarea hidden. | |
| 638 | + if ( 'temporary_deactivation' === reasons ) { | |
| 639 | + $extra.stop( true, true ).slideUp(200); | |
| 640 | + } else if ( $selectedRow.length ) { | |
| 641 | + // Move the feedback textarea so it appears directly below the selected radio. | |
| 642 | + $extra.hide().insertAfter( $selectedRow ).slideDown(200); | |
| 643 | + } else { | |
| 644 | + $extra.slideDown(200); | |
| 645 | + } | |
| 452 | 646 | if( 'found_a_better_plugin' === reasons ){ |
| 453 | 647 | $('#deactivation-dialog-<?php echo esc_attr( $this->textdomain ); ?> .modal-content input[name="reason_found_a_better_plugin"]').show(); |
| 454 | 648 | } else { |
| 455 | 649 | $('#deactivation-dialog-<?php echo esc_attr( $this->textdomain ); ?> .modal-content input[name="reason_found_a_better_plugin"]').hide(); |
| @@ -467,8 +661,22 @@ | ||
| 467 | 661 | $('.ui-dialog-buttonpane button:contains("Submit")').text('Submit & Deactivate'); |
| 468 | 662 | $('.ui-dialog-buttonpane button:contains("Cancel")').text('Skip & Deactivate'); |
| 469 | 663 | }); |
| 470 | 664 | |
| 665 | + // Show a loading spinner over the dialog while submitting / | |
| 666 | + // deactivating, and lock the footer buttons to avoid double clicks. | |
| 667 | + function showDeactivateLoader() { | |
| 668 | + var $content = $('#deactivation-dialog-<?php echo esc_attr( $this->textdomain ); ?>'); | |
| 669 | + if ( ! $content.length || ! $content.hasClass('ui-dialog-content') ) { | |
| 670 | + return; | |
| 671 | + } | |
| 672 | + var $widget = $content.dialog('widget'); | |
| 673 | + if ( ! $widget.find('.rtsb-deactivate-loader').length ) { | |
| 674 | + $widget.append('<div class="rtsb-deactivate-loader"><span class="rtsb-deactivate-spinner"></span></div>'); | |
| 675 | + } | |
| 676 | + $widget.find('.ui-dialog-buttonpane button').prop('disabled', true); | |
| 677 | + } | |
| 678 | + | |
| 471 | 679 | // Submit the feedback |
| 472 | 680 | function submitFeedback() { |
| 473 | 681 | var href = $('.deactivate #deactivate-shopbuilder').attr('href'); |
| 474 | 682 | var reasons = $('#deactivation-dialog-<?php echo esc_attr( $this->textdomain ); ?> input[type="radio"]:checked').val(); |
| @@ -477,9 +685,9 @@ | ||
| 477 | 685 | // Perform AJAX request to submit feedback |
| 478 | 686 | if (!reasons && !feedback && !better_plugin) { |
| 479 | 687 | // Define flag variables |
| 480 | 688 | $('#feedback-form-body-<?php echo esc_attr( $this->textdomain ); ?> span').text('Choose The Reason'); |
| 481 | - $('.feedback-text-wrapper-<?php echo esc_attr( $this->textdomain ); ?> span').text('Please provide me with some advice.'); | |
| 689 | + $('.feedback-text-wrapper-<?php echo esc_attr( $this->textdomain ); ?> span').text('Please provide more details regarding the issue so we can address it in future updates.'); | |
| 482 | 690 | return; |
| 483 | 691 | } |
| 484 | 692 | |
| 485 | 693 | if (!reasons ) { |
| @@ -484,9 +692,9 @@ | ||
| 484 | 692 | |
| 485 | 693 | if (!reasons ) { |
| 486 | 694 | // Define flag variables |
| 487 | 695 | $('#feedback-form-body-<?php echo esc_attr( $this->textdomain ); ?> span').text('Choose The Reason'); |
| 488 | - $('.feedback-text-wrapper-<?php echo esc_attr( $this->textdomain ); ?> span').text('Please provide me with some advice.'); | |
| 696 | + $('.feedback-text-wrapper-<?php echo esc_attr( $this->textdomain ); ?> span').text('Please provide more details regarding the issue so we can address it in future updates.'); | |
| 489 | 697 | return; |
| 490 | 698 | } |
| 491 | 699 | |
| 492 | 700 | if ( 'bug_issue_detected' === reasons && !feedback ) { |
| @@ -494,23 +702,43 @@ | ||
| 494 | 702 | $('.feedback-text-wrapper-<?php echo esc_attr( $this->textdomain ); ?> span').text('Please provide more details regarding the issue so we can address it in future updates.'); |
| 495 | 703 | return; |
| 496 | 704 | } |
| 497 | 705 | |
| 498 | - if ('temporary_deactivation' === reasons && !feedback) { | |
| 706 | + if ('temporary_deactivation' === reasons || ! feedback ) { | |
| 707 | + showDeactivateLoader(); | |
| 499 | 708 | window.location.href = href; |
| 500 | 709 | return; |
| 501 | 710 | } |
| 502 | 711 | |
| 712 | + if ( ! feedback.length > 0 ) { | |
| 713 | + showDeactivateLoader(); | |
| 714 | + window.location.href = href; | |
| 715 | + return; | |
| 716 | + } | |
| 717 | + var websiteUrl = '<?php echo esc_url( home_url() ); ?>'; | |
| 718 | + if ( ! websiteUrl.length > 0 ) { | |
| 719 | + showDeactivateLoader(); | |
| 720 | + window.location.href = href; | |
| 721 | + return; | |
| 722 | + } | |
| 723 | + showDeactivateLoader(); | |
| 503 | 724 | $.ajax({ |
| 504 | 725 | url: 'https://shopbuilderwp.com/wp-json/RadiusTheme/pluginSurvey/v1/Survey/appendToSheet', |
| 505 | 726 | method: 'GET', |
| 506 | 727 | dataType: 'json', |
| 728 | + // Feedback is best-effort: if the endpoint is slow/unreachable, | |
| 729 | + // fail fast so the user isn't stuck on the loader. `complete` | |
| 730 | + // runs on success, error and timeout, so deactivation always | |
| 731 | + // proceeds (redirects to the deactivate link) regardless. | |
| 732 | + timeout: 5000, | |
| 507 | 733 | data: { |
| 508 | - website: '<?php echo esc_url( home_url() ); ?>', | |
| 734 | + website: websiteUrl, | |
| 509 | 735 | reasons: reasons ? reasons : '', |
| 510 | 736 | better_plugin: better_plugin, |
| 511 | 737 | feedback: feedback, |
| 512 | 738 | wpplugin: 'ShopBuilder', |
| 739 | + version: '<?php echo esc_js( defined( 'RTSB_VERSION' ) ? RTSB_VERSION : '' ); ?>', | |
| 740 | + date: '<?php echo esc_js( gmdate( 'M j, Y' ) ); ?>', | |
| 513 | 741 | }, |
| 514 | 742 | success: function (response) { |
| 515 | 743 | }, |
| 516 | 744 | error: function (xhr, status, error) { |