Changeset 3379252
- Timestamp:
- 10/16/2025 06:27:26 AM (5 months ago)
- Location:
- nexron-ai-chat
- Files:
-
- 12 added
- 4 edited
-
tags/2.0.3 (added)
-
tags/2.0.3/images (added)
-
tags/2.0.3/images/nexron-blue.png (added)
-
tags/2.0.3/images/nexron-icon.png (added)
-
tags/2.0.3/images/nexron-loading.png (added)
-
tags/2.0.3/nexron-ai-chat-admin-script.js (added)
-
tags/2.0.3/nexron-ai-chat-config.php (added)
-
tags/2.0.3/nexron-ai-chat-options.php (added)
-
tags/2.0.3/nexron-ai-chat-products.php (added)
-
tags/2.0.3/nexron-ai-chat-settings.php (added)
-
tags/2.0.3/nexron-ai-chat.php (added)
-
tags/2.0.3/readme.txt (added)
-
trunk/nexron-ai-chat-admin-script.js (modified) (1 diff)
-
trunk/nexron-ai-chat-settings.php (modified) (6 diffs)
-
trunk/nexron-ai-chat.php (modified) (8 diffs)
-
trunk/readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
nexron-ai-chat/trunk/nexron-ai-chat-admin-script.js
r3370872 r3379252 133 133 } 134 134 135 async function toggle_test_mode() { 136 // document.getElementById("nexron_ai_chat_test_mode_button_container").disabled = true; 137 // document.getElementById("nexron_ai_chat_test_mode_button").innerText = 'Please wait...'; 138 const nexron_ai_chat_test_mode_button = document.getElementById("nexron_ai_chat_test_mode_button"); 139 nexron_ai_chat_test_mode_button.innerText = 'Please wait...'; 140 141 // Remove click handler 142 nexron_ai_chat_test_mode_button.onclick = null; 143 144 // Optional: prevent default behavior (if needed) 145 nexron_ai_chat_test_mode_button.addEventListener('click', function(e) { e.preventDefault(); }); 146 147 // Make it look disabled 148 nexron_ai_chat_test_mode_button.classList.add('disabled'); 149 nexron_ai_chat_test_mode_button.style.pointerEvents = 'none'; 150 nexron_ai_chat_test_mode_button.style.opacity = '0.5'; 151 nexron_ai_chat_test_mode_button.style.cursor = 'not-allowed'; 152 153 // Step 2: Force UI update before continuing 154 await sleep(50); // small delay to let browser render the disabled state 155 156 await sendToNexronAIChatPlugin('toggle-test-mode', ''); 157 await sleep(2000); 158 get_nexron_ai_chat_test_mode_card() 159 } 160 161 async function get_nexron_ai_chat_test_mode_card() { 162 var contents = ""; 163 if ((await sendToNexronAIChatPlugin('get-test-mode', '')).data) { 164 contents = `<div> 165 <span class="dashicons dashicons-hammer" style = "font-size: 75px; width: 75px; height: 75px; margin-right: 10px; color: #963232;"></span> 166 </div > 167 <div> 168 <h2>Mode : <span style="color: #963232;">TEST</span></h2> 169 <p>Test mode is currently active. ONLY administrators will be able to see and interact with the Nexron AI Chatbot on the website.</p> 170 </div> 171 <div id="nexron_ai_chat_test_mode_button_container" style="display: flex; justify-content: right;"> 172 <a id="nexron_ai_chat_test_mode_button" class="button button-primary" onclick="toggle_test_mode()">Live Mode</a> 173 </div>` 174 } else { 175 contents = `<div> 176 <span class="dashicons dashicons-yes-alt" style = "font-size: 75px; width: 75px; height: 75px; margin-right: 10px; color: #329632;"></span> 177 </div > 178 <div> 179 <h2>Mode : <span style="color: #329632;">Live</span></h2> 180 <p>Live mode is currently active. ALL website visitors will be able to see and interact with the Nexron AI Chatbot on the website.</p> 181 </div> 182 <div id="nexron_ai_chat_test_mode_button_container" style="display: flex; justify-content: right;"> 183 <a id="nexron_ai_chat_test_mode_button" class="button button-primary" onclick="toggle_test_mode()">Test Mode</a> 184 </div>` 185 } 186 document.getElementById("nexron_ai_chat_test_mode_card").innerHTML = contents; 187 } 188 135 189 function initiate_sync() { 136 190 sendToNexronAIChatPlugin('initiate-sync', ''); -
nexron-ai-chat/trunk/nexron-ai-chat-settings.php
r3376061 r3379252 34 34 gap: 20px; 35 35 flex-wrap: wrap; 36 /* padding: 10px;*/36 padding: 10px; /**/ 37 37 max-width: 100%; 38 38 } … … 58 58 59 59 .nexron_ai_chat_card { 60 /* padding: 20px;*/60 padding: 20px; /**/ 61 61 background-color: white; 62 62 flex-grow: 1; … … 73 73 74 74 </style> 75 76 77 <div class="nexron_ai_chat_row"> 78 <div class="nexron_ai_chat_1_column"> 79 <div class="nexron_ai_chat_card"> 80 <div id="nexron_ai_chat_test_mode_card" class="inside" style="display: grid; grid-template-columns: 1fr 3fr 1fr; grid-auto-rows: minmax(30px, auto); column-gap: 16px; align-items: center; min-height: 90px;"> 81 82 </div> 83 </div> 84 </div> 85 86 </div> 87 75 88 76 89 <?php if(nexron_ai_chat_retrieve('nexron_ai_chat_ecommerce_addon')) : ?> … … 107 120 <div class="nexron_ai_chat_1_column"> 108 121 <div class="nexron_ai_chat_card"> 109 <div id="nexron_ai_chat_dashboard" style="overflow:hidden; height:calc(78vh - 32px); min-height: 620px;width:100%" class="inside">122 <div id="nexron_ai_chat_dashboard" style="overflow:hidden; width:100%" class="inside"> 110 123 <?php 111 124 echo '<object data="' . esc_url(nexron_ai_chat_retrieve('nexron_ai_chat_dashboard')) . '" style="overflow:hidden; height:calc(78vh - 32px); min-height: 620px; width:100%" title="Nexron AI Chat" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen type="text/html"> Alternative Content </object>'; … … 118 131 119 132 <?php 133 $inline_script = "window.onload = function() { 134 get_nexron_ai_chat_test_mode_card(); 135 }"; 120 136 if(nexron_ai_chat_retrieve('nexron_ai_chat_ecommerce_addon')) { 121 $inline_script = "137 $inline_script = $inline_script + " 122 138 function nexron_ai_chat_dashboard_refresh() { 123 139 get_nexron_ai_chat_wc_status_card(); … … 126 142 setInterval(nexron_ai_chat_dashboard_refresh, 2000); 127 143 "; 128 wp_register_script('nexron_admin_dashboard_scripts', '', [], nexron_ai_chat_version, true);129 wp_enqueue_script('nexron_admin_dashboard_scripts');130 wp_add_inline_script('nexron_admin_dashboard_scripts', $inline_script);131 144 } 145 wp_register_script('nexron_admin_dashboard_scripts', '', [], nexron_ai_chat_version, true); 146 wp_enqueue_script('nexron_admin_dashboard_scripts'); 147 wp_add_inline_script('nexron_admin_dashboard_scripts', $inline_script); 148 132 149 } -
nexron-ai-chat/trunk/nexron-ai-chat.php
r3376061 r3379252 3 3 * Plugin Name: Nexron AI Chat 4 4 * Description: Enhance your WooCommerce store with Nexron AI Chat, a conversational product search plugin. Engage your customers in interactive conversations to find products easily. 5 * Version: 2.0. 35 * Version: 2.0.4 6 6 * Author: Nexron LLC 7 7 * Author URI: https://www.nexron.ai … … 15 15 */ 16 16 17 define( 'nexron_ai_chat_version', '2.0. 3' );17 define( 'nexron_ai_chat_version', '2.0.4' ); 18 18 19 19 /* … … 25 25 exit; 26 26 } 27 28 function nexron_ai_chat_enqueue_admin_scripts() 29 { 30 wp_enqueue_script( 31 'nexron_ai_chat_script', 32 plugins_url('/nexron-ai-chat-admin-script.js', __FILE__), 33 array(), 34 nexron_ai_chat_version, 35 true 36 ); 37 38 $nexron_ai_chat_ajax_data = array( 39 'ajax_url' => admin_url('admin-ajax.php'), 40 'nonce' => wp_create_nonce('nexron_ai_chat_ajax_nonce') 41 ); 42 43 wp_localize_script('nexron_ai_chat_script', 'nexron_ai_chat_plugin_data', $nexron_ai_chat_ajax_data); 44 } 45 add_action('admin_enqueue_scripts', 'nexron_ai_chat_enqueue_admin_scripts'); 27 46 28 47 // Include the nexron-ai-chat files … … 53 72 54 73 // TEMP FOR TESTING 55 foreach (wp_load_alloptions() as $option => $value) {56 if (strpos($option, 'nexron_ai_chat_') !== false) {57 delete_option($option);58 }59 }74 // foreach (wp_load_alloptions() as $option => $value) { 75 // if (strpos($option, 'nexron_ai_chat_') !== false) { 76 // delete_option($option); 77 // } 78 // } 60 79 } 61 80 register_deactivation_hook(__FILE__, 'nexron_ai_chat_plugin_deactivation'); … … 69 88 nexron_ai_chat_store('nexron_ai_chat_plugin_verify_url', nexron_ai_chat_get_plugin_verify_url()); 70 89 nexron_ai_chat_store('nexron_ai_chat_dashboard', nexron_ai_chat_get_dashboard_url()); 90 nexron_ai_chat_store('nexron_ai_chat_test_mode', false); 71 91 nexron_ai_chat_store('nexron_ai_chat_product_status', 'AWAITING CONFIG'); 72 92 nexron_ai_chat_store('nexron_ai_chat_product_progress', 0); … … 154 174 } 155 175 156 157 function nexron_ai_chat_enqueue_admin_scripts()158 {159 wp_enqueue_script(160 'nexron_ai_chat_script',161 plugins_url('/nexron-ai-chat-admin-script.js', __FILE__),162 array(),163 nexron_ai_chat_version,164 true165 );166 167 $nexron_ai_chat_ajax_data = array(168 'ajax_url' => admin_url('admin-ajax.php'),169 'nonce' => wp_create_nonce('nexron_ai_chat_ajax_nonce')170 );171 172 wp_localize_script('nexron_ai_chat_script', 'nexron_ai_chat_plugin_data', $nexron_ai_chat_ajax_data);173 }174 add_action('admin_enqueue_scripts', 'nexron_ai_chat_enqueue_admin_scripts');175 176 176 function nexron_ai_chat_handle_ajax() 177 177 { … … 285 285 break; 286 286 287 case 'toggle-test-mode': 288 $nexron_ai_chat_test_mode = nexron_ai_chat_retrieve("nexron_ai_chat_test_mode"); 289 nexron_ai_chat_store("nexron_ai_chat_test_mode", !$nexron_ai_chat_test_mode); 290 $response = array('message' => 'Test mode toggled.'); 291 break; 292 293 case 'get-test-mode': 294 $nexron_ai_chat_test_mode = nexron_ai_chat_retrieve("nexron_ai_chat_test_mode"); 295 $response = array('message' => 'Test mode retrieved.', 'data' => $nexron_ai_chat_test_mode); 296 break; 297 287 298 default: 288 299 $response = array('message' => 'Unknown type.'); … … 301 312 function nexron_ai_chat_add_chatbot_to_frontend() 302 313 { 314 // Check if test mode is enabled 315 $test_mode = nexron_ai_chat_retrieve('nexron_ai_chat_test_mode'); 316 317 // If test mode is enabled and the current user is not an admin, exit the function 318 if ($test_mode && !current_user_can('administrator')) { 319 return; 320 } 321 322 // Verify plugin 303 323 if (nexron_ai_chat_verify_plugin()) { 304 324 $nexron_ai_chat_chatbot_script_url = esc_url(nexron_ai_chat_retrieve('nexron_ai_chat_chatbot_script_url')); -
nexron-ai-chat/trunk/readme.txt
r3376061 r3379252 1 1 === Nexron AI Chat === 2 Tags: chatbot, customer service, virtual assistant, AI , SaaS2 Tags: chatbot, customer service, virtual assistant, AI 3 3 Requires at least: 5.0 4 4 Tested up to: 6.8 5 Stable tag: 2.0. 35 Stable tag: 2.0.4 6 6 License: GPLv2 or later 7 7 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 58 58 == Frequently Asked Questions == 59 59 60 = Can I test the plugin website visitors seeing the Nexron AI Chat? = 61 62 Yes, setting the plugin mode to "Test" allows admin users to view and test the full functionality of the chatbot before releasing it to website visitors and users. Toggling between "Test" and "Live" mode can be done at any time on the plugin settings page. 63 60 64 = Do I need a Nexron account to use this plugin? = 61 65 … … 95 99 96 100 == Changelog == 101 102 = 2.0.4 - 2025-10-16 = 103 * Improvement: Add test mode (sandbox) so that admin users can toggle the chatbot ON/OFF for website visitors. 104 * Modification: Nexron settings page stylistic updates. 97 105 98 106 = 2.0.3 - 2025-10-10 =
Note: See TracChangeset
for help on using the changeset viewer.