PluginProbe
MxChat – AI Chatbot & Content Generation for WordPress / 2.4.6
MxChat – AI Chatbot & Content Generation for WordPress v2.4.6
3.2.21 3.2.20 3.2.19 3.2.18 3.2.17 3.2.16 3.2.15 3.2.14 3.2.12 3.2.13 3.2.11 3.2.10 3.2.9 3.2.8 3.2.7 3.2.6 3.2.5 3.2.4 3.2.3 3.2.2 3.2.1 2.0.3 2.0.4 2.0.5 2.0.6 All 152 releases
← All changes | js/activation-script.js +23 -49 3.2.32.4.6 View file →
@@ -15,35 +15,8 @@
15 15 const spinner = $('#mxchat-activation-spinner');
16 16 const submitButton = $('#activate_license_button');
17 17 const licenseStatus = $('#mxchat-license-status');
18 18
19 - // Create or get status message element
20 - var $statusMessage = $('<div id="mxchat-activation-status" style="margin-top: 12px; padding: 12px 16px; border-radius: 8px; font-size: 14px; display: none;"></div>');
21 - if ($('#mxchat-activation-status').length === 0) {
22 - spinner.after($statusMessage);
23 - } else {
24 - $statusMessage = $('#mxchat-activation-status');
25 - }
26 -
27 - function showStatus(message, type) {
28 - var bgColor = type === 'success' ? 'rgba(16, 185, 129, 0.1)' :
29 - type === 'error' ? 'rgba(239, 68, 68, 0.1)' :
30 - 'rgba(120, 115, 245, 0.1)';
31 - var textColor = type === 'success' ? '#059669' :
32 - type === 'error' ? '#dc2626' :
33 - '#7873f5';
34 - var icon = type === 'success' ? '✓' :
35 - type === 'error' ? '✗' :
36 - '<span class="dashicons dashicons-update spin" style="font-size: 14px; width: 14px; height: 14px; margin-right: 4px;"></span>';
37 -
38 - $statusMessage.html(icon + ' ' + message)
39 - .css({
40 - 'background': bgColor,
41 - 'color': textColor,
42 - 'display': 'block'
43 - });
44 - }
45 -
46 19 // Activation handling
47 20 if (form.length && licenseStatus.length && submitButton.length) {
48 21 function handleActivationResponse(response) {
49 22 if (response.success) {
@@ -48,40 +21,38 @@
48 21 function handleActivationResponse(response) {
49 22 if (response.success) {
50 23 licenseStatus.text('Active');
51 24 licenseStatus.removeClass('inactive').addClass('active');
52 -
53 - // Show linking status - keep spinner visible
54 - showStatus('License verified! Linking domain...', 'loading');
55 -
25 + form.hide();
26 +
56 27 // Track domain BEFORE showing success
57 28 trackDomainActivation()
58 29 .done(function(trackResponse) {
59 30 console.log('Domain tracking successful:', trackResponse);
60 31 spinner.hide();
61 - showStatus('License activated and domain linked successfully!', 'success');
62 -
63 - // Wait before reload
32 + alert('License activated and domain linked successfully!');
33 +
34 + // Wait longer before reload to ensure all processes complete
64 35 setTimeout(function() {
65 36 location.reload();
66 - }, 2000);
37 + }, 3000);
67 38 })
68 39 .fail(function(jqXHR, textStatus, errorThrown) {
69 40 console.error('Domain tracking failed:', textStatus, errorThrown);
70 41 spinner.hide();
71 -
42 +
72 43 // Still show success but warn about domain linking
73 - showStatus('License activated! Domain linking failed - you can link it manually after reload.', 'success');
74 -
75 - // Wait before reload
44 + alert('License activated successfully!\n\nNote: Domain linking failed. You may need to use the "Link Domain" button after the page reloads.');
45 +
46 + // Wait longer before reload to ensure all cleanup is done
76 47 setTimeout(function() {
77 48 location.reload();
78 - }, 3000);
49 + }, 4000);
79 50 });
80 51 } else {
81 52 spinner.hide();
82 53 licenseStatus.text('Inactive');
83 - showStatus(response.data || 'Activation failed. Please check your input.', 'error');
54 + alert(response.data || 'Activation failed. Please check your input.');
84 55 submitButton.prop('disabled', false);
85 56 }
86 57 }
87 58
@@ -159,10 +130,9 @@
159 130 form.on('submit', function(event) {
160 131 event.preventDefault();
161 132 spinner.show();
162 133 submitButton.prop('disabled', true);
163 - showStatus('Validating license key...', 'loading');
164 -
134 +
165 135 var formData = {
166 136 action: 'mxchat_handle_activate_license',
167 137 mxchat_pro_email: $('#mxchat_pro_email').val(),
168 138 mxchat_activation_key: $('#mxchat_activation_key').val(),
@@ -167,9 +137,9 @@
167 137 mxchat_pro_email: $('#mxchat_pro_email').val(),
168 138 mxchat_activation_key: $('#mxchat_activation_key').val(),
169 139 security: NONCE
170 140 };
171 -
141 +
172 142 $.ajax({
173 143 type: 'POST',
174 144 url: AJAX_URL,
175 145 data: formData,
@@ -177,13 +147,17 @@
177 147 success: function(response) {
178 148 handleActivationResponse(response);
179 149 },
180 150 error: function(jqXHR, textStatus) {
181 - // On any error, check if the license was actually saved successfully
182 - // This handles cases where the response format caused a parse error
183 - // but the activation actually worked
184 - showStatus('Verifying activation status...', 'loading');
185 - checkActivationStatus();
151 + if (textStatus === 'timeout') {
152 + spinner.hide();
153 + alert('Activation is taking longer than expected. Checking status...');
154 + checkActivationStatus();
155 + } else {
156 + alert('Activation failed due to a server error: ' + (jqXHR.responseText || textStatus));
157 + spinner.hide();
158 + submitButton.prop('disabled', false);
159 + }
186 160 }
187 161 });
188 162 });
189 163 }