Plugin Directory

Changeset 3379252


Ignore:
Timestamp:
10/16/2025 06:27:26 AM (5 months ago)
Author:
nexron
Message:

Release 2.0.4

Location:
nexron-ai-chat
Files:
12 added
4 edited

Legend:

Unmodified
Added
Removed
  • nexron-ai-chat/trunk/nexron-ai-chat-admin-script.js

    r3370872 r3379252  
    133133
    134134
     135async 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
     161async 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
    135189function initiate_sync() {
    136190    sendToNexronAIChatPlugin('initiate-sync', '');
  • nexron-ai-chat/trunk/nexron-ai-chat-settings.php

    r3376061 r3379252  
    3434                gap: 20px;
    3535                flex-wrap: wrap;
    36                 /* padding: 10px;  */
     36                padding: 10px; /**/
    3737                max-width: 100%;
    3838            }
     
    5858
    5959            .nexron_ai_chat_card {
    60                 /* padding: 20px; */
     60                padding: 20px; /**/
    6161                background-color: white;
    6262                flex-grow: 1;
     
    7373
    7474        </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       
    7588
    7689        <?php if(nexron_ai_chat_retrieve('nexron_ai_chat_ecommerce_addon')) : ?>
     
    107120            <div class="nexron_ai_chat_1_column">
    108121                <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">
    110123                        <?php
    111124                            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>';
     
    118131
    119132    <?php
     133    $inline_script = "window.onload = function() {
     134                            get_nexron_ai_chat_test_mode_card();
     135                        }";
    120136    if(nexron_ai_chat_retrieve('nexron_ai_chat_ecommerce_addon')) {
    121         $inline_script = "
     137        $inline_script = $inline_script + "
    122138            function nexron_ai_chat_dashboard_refresh() {
    123139                get_nexron_ai_chat_wc_status_card();
     
    126142            setInterval(nexron_ai_chat_dashboard_refresh, 2000);
    127143            ";
    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);
    131144    }
     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   
    132149}
  • nexron-ai-chat/trunk/nexron-ai-chat.php

    r3376061 r3379252  
    33 * Plugin Name:  Nexron AI Chat
    44 * 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.3
     5 * Version:      2.0.4
    66 * Author:       Nexron LLC
    77 * Author URI:   https://www.nexron.ai
     
    1515*/
    1616
    17 define( 'nexron_ai_chat_version', '2.0.3' );
     17define( 'nexron_ai_chat_version', '2.0.4' );
    1818
    1919/*
     
    2525    exit;
    2626}
     27
     28function 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}
     45add_action('admin_enqueue_scripts', 'nexron_ai_chat_enqueue_admin_scripts');
    2746
    2847// Include the nexron-ai-chat files
     
    5372
    5473    // 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    // }
    6079}
    6180register_deactivation_hook(__FILE__, 'nexron_ai_chat_plugin_deactivation');
     
    6988    nexron_ai_chat_store('nexron_ai_chat_plugin_verify_url', nexron_ai_chat_get_plugin_verify_url());
    7089    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);
    7191    nexron_ai_chat_store('nexron_ai_chat_product_status', 'AWAITING CONFIG');
    7292    nexron_ai_chat_store('nexron_ai_chat_product_progress', 0);
     
    154174}
    155175
    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         true
    165     );
    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 
    176176function nexron_ai_chat_handle_ajax()
    177177{
     
    285285                    break;
    286286
     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
    287298                default:
    288299                    $response = array('message' => 'Unknown type.');
     
    301312function nexron_ai_chat_add_chatbot_to_frontend()
    302313{
     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
    303323    if (nexron_ai_chat_verify_plugin()) {
    304324        $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  
    11=== Nexron AI Chat ===
    2 Tags: chatbot, customer service, virtual assistant, AI, SaaS
     2Tags: chatbot, customer service, virtual assistant, AI
    33Requires at least: 5.0
    44Tested up to: 6.8
    5 Stable tag: 2.0.3
     5Stable tag: 2.0.4
    66License: GPLv2 or later
    77License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    5858== Frequently Asked Questions ==
    5959
     60= Can I test the plugin website visitors seeing the Nexron AI Chat? =
     61
     62Yes, 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
    6064= Do I need a Nexron account to use this plugin? =
    6165
     
    9599
    96100== 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.
    97105
    98106= 2.0.3 - 2025-10-10 =
Note: See TracChangeset for help on using the changeset viewer.