| @@ -22,10 +22,16 @@ | ||
| 22 | 22 | $license_email = get_option('mxchat_pro_email', ''); |
| 23 | 23 | $license_key = get_option('mxchat_activation_key', ''); |
| 24 | 24 | $current_domain = parse_url(home_url(), PHP_URL_HOST); |
| 25 | 25 | $is_domain_linked = $admin_instance->is_current_activation_linked($current_domain); |
| 26 | - $license_management_url = 'https://mxchat.ai/my-account/orders/'; | |
| 26 | + $license_management_url = 'https://mxchat.ai/my-account/licenses/'; | |
| 27 | 27 | |
| 28 | + // Licence domain check (c93ede): what mxchat.ai last said about this domain, | |
| 29 | + // and whether Pro is paused because the licence holder switched it off. | |
| 30 | + $has_license_check = class_exists('MxChat_License_Check'); | |
| 31 | + $license_check = $has_license_check ? MxChat_License_Check::view_model() : null; | |
| 32 | + $license_revoked = $has_license_check && MxChat_License_Check::is_revoked(); | |
| 33 | + | |
| 28 | 34 | // Mask the license key for display |
| 29 | 35 | $masked_key = ''; |
| 30 | 36 | if (!empty($license_key)) { |
| 31 | 37 | $masked_key = str_repeat('•', max(0, strlen($license_key) - 4)) . substr($license_key, -4); |
| @@ -216,8 +222,17 @@ | ||
| 216 | 222 | <span class="mxch-license-info-value"> |
| 217 | 223 | <code class="mxch-license-key-code"><?php echo esc_html($license_key); ?></code> |
| 218 | 224 | </span> |
| 219 | 225 | </div> |
| 226 | + <?php if ($license_check) : ?> | |
| 227 | + <div class="mxch-license-info-item mxch-license-check-item"> | |
| 228 | + <span class="mxch-license-info-label"><?php esc_html_e('Domain check', 'mxchat'); ?></span> | |
| 229 | + <span class="mxch-license-info-value"> | |
| 230 | + <span id="mxchat-license-check-pill" class="mxch-status-pill <?php echo esc_attr($license_check['pill_class']); ?>"><span class="mxch-status-dot"></span><span class="mxchat-license-check-pill-text"><?php echo esc_html($license_check['pill_text']); ?></span></span> | |
| 231 | + <span id="mxchat-license-check-msg" class="mxch-license-check-sentence mxchat-license-check-msg" role="status"><?php echo esc_html($license_check['sentence']); ?></span> | |
| 232 | + </span> | |
| 233 | + </div> | |
| 234 | + <?php endif; ?> | |
| 220 | 235 | </div> |
| 221 | 236 | |
| 222 | 237 | <div class="mxch-license-footer-actions"> |
| 223 | 238 | <a href="<?php echo esc_url($license_management_url); ?>" target="_blank" class="mxch-btn mxch-btn-secondary"> |
| @@ -223,8 +238,14 @@ | ||
| 223 | 238 | <a href="<?php echo esc_url($license_management_url); ?>" target="_blank" class="mxch-btn mxch-btn-secondary"> |
| 224 | 239 | <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg> |
| 225 | 240 | <?php esc_html_e('Manage Account', 'mxchat'); ?> |
| 226 | 241 | </a> |
| 242 | + <?php if ($license_check) : ?> | |
| 243 | + <button type="button" id="mxchat-license-check-button" class="mxch-btn mxch-btn-secondary mxchat-license-check-now"> | |
| 244 | + <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="23 4 23 10 17 10"/><polyline points="1 20 1 14 7 14"/><path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"/></svg> | |
| 245 | + <?php esc_html_e('Check license now', 'mxchat'); ?> | |
| 246 | + </button> | |
| 247 | + <?php endif; ?> | |
| 227 | 248 | <button type="button" id="deactivate-license-button" class="mxch-btn mxch-btn-danger"> |
| 228 | 249 | <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/></svg> |
| 229 | 250 | <?php esc_html_e('Deactivate License', 'mxchat'); ?> |
| 230 | 251 | </button> |
| @@ -230,8 +251,23 @@ | ||
| 230 | 251 | </button> |
| 231 | 252 | <span id="deactivate-status"></span> |
| 232 | 253 | </div> |
| 233 | 254 | <?php else: ?> |
| 255 | + <?php if ($license_revoked && $license_check) : ?> | |
| 256 | + <!-- Pro paused by the licence domain check (c93ede): the licence holder switched this domain off --> | |
| 257 | + <div class="mxch-notice mxch-notice-warning mxch-notice-block mxch-license-check-panel"> | |
| 258 | + <svg class="mxch-notice-icon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg> | |
| 259 | + <div class="mxch-license-check-panel-body"> | |
| 260 | + <strong><?php esc_html_e('Pro is paused on this site', 'mxchat'); ?></strong> | |
| 261 | + <p><?php echo esc_html($license_check['sentence']); ?></p> | |
| 262 | + <div class="mxch-license-check-panel-actions"> | |
| 263 | + <button type="button" class="mxch-btn mxch-btn-secondary mxch-btn-sm mxchat-license-check-now"><?php esc_html_e('Check license now', 'mxchat'); ?></button> | |
| 264 | + <a href="<?php echo esc_url($license_management_url); ?>" target="_blank" class="mxch-btn mxch-btn-ghost mxch-btn-sm"><?php esc_html_e('Open My Account', 'mxchat'); ?></a> | |
| 265 | + <span class="mxchat-license-check-msg" role="status"></span> | |
| 266 | + </div> | |
| 267 | + </div> | |
| 268 | + </div> | |
| 269 | + <?php endif; ?> | |
| 234 | 270 | <!-- Activation Form --> |
| 235 | 271 | <form id="mxchat-activation-form" class="mxch-activation-form"> |
| 236 | 272 | <div class="mxch-form-row"> |
| 237 | 273 | <div class="mxch-field"> |
| @@ -252,8 +288,15 @@ | ||
| 252 | 288 | <?php esc_html_e('Activate License', 'mxchat'); ?> |
| 253 | 289 | </button> |
| 254 | 290 | <div id="mxchat-activation-spinner" class="mxch-spinner" style="display: none;"></div> |
| 255 | 291 | </div> |
| 292 | + <?php if ($has_license_check && !$license_revoked && ($license_refusal = MxChat_License_Check::last_refusal()) !== '') : ?> | |
| 293 | + <!-- The last Activate click was refused by the licence owner (c93ede): say who controls it --> | |
| 294 | + <p class="mxch-field-hint mxch-license-refusal" data-mxchat-license-refusal="1"> | |
| 295 | + <strong><?php esc_html_e('Managed by the licence owner.', 'mxchat'); ?></strong> | |
| 296 | + <?php echo esc_html($license_refusal); ?> | |
| 297 | + </p> | |
| 298 | + <?php endif; ?> | |
| 256 | 299 | <p class="mxch-field-hint"> |
| 257 | 300 | <?php esc_html_e("Don't have a license?", 'mxchat'); ?> |
| 258 | 301 | <a href="https://mxchat.ai/" target="_blank"><?php esc_html_e('Get MxChat Pro', 'mxchat'); ?></a> |
| 259 | 302 | </p> |
| @@ -348,12 +391,11 @@ | ||
| 348 | 391 | <a href="<?php echo esc_url($status['action_url']); ?>" class="mxch-btn mxch-btn-primary mxch-btn-lg"> |
| 349 | 392 | <?php esc_html_e('Activate Extension', 'mxchat'); ?> |
| 350 | 393 | </a> |
| 351 | 394 | <?php elseif ($is_activated): ?> |
| 352 | - <!-- Has Pro license but extension not installed - Download --> | |
| 353 | - <?php $download_link = !empty($addon['download_url']) ? $addon['download_url'] : $addon['url']; ?> | |
| 354 | - <a href="<?php echo esc_url($download_link); ?>" target="_blank" class="mxch-btn mxch-btn-primary mxch-btn-lg"> | |
| 355 | - <?php esc_html_e('Download Add-on', 'mxchat'); ?> | |
| 395 | + <!-- Has Pro license but extension not installed - the installable ZIPs live on My Account > Downloads --> | |
| 396 | + <a href="https://mxchat.ai/my-account/downloads/" target="_blank" class="mxch-btn mxch-btn-primary mxch-btn-lg"> | |
| 397 | + <?php esc_html_e('Get the ZIP from My Account', 'mxchat'); ?> | |
| 356 | 398 | </a> |
| 357 | 399 | <?php else: ?> |
| 358 | 400 | <!-- No Pro license - Purchase --> |
| 359 | 401 | <a href="https://mxchat.ai/" target="_blank" class="mxch-btn mxch-btn-primary mxch-btn-lg"> |