Plugin Directory

Changeset 3397037


Ignore:
Timestamp:
11/17/2025 09:54:42 AM (5 months ago)
Author:
lenochat
Message:

Version 1.0.3: Added WordPress integration activation endpoint call when widget visibility is enabled

Location:
lenochat
Files:
5 edited
7 copied

Legend:

Unmodified
Added
Removed
  • lenochat/tags/1.0.3/admin/views/lenochat-login.php

    r3295761 r3397037  
    7979                if (isset($arr["success"]) && $arr["success"]) {
    8080                    update_option("lenochat_license", $arr["data"][0]["license"]);
     81                    if (isset($arr["data"][0]["company_id"])) {
     82                        update_option("lenochat_company_id", $arr["data"][0]["company_id"]);
     83                    }
    8184                    $encodedToken = json_encode($arr["data"]);
    8285                    $license = get_option("lenochat_license");
     
    108111            update_option("lenochat_status", $widgetStatus);
    109112            $status = $widgetStatus;
     113           
     114            // If widget is being activated (status = "1"), call activation endpoint
     115            if ($widgetStatus == "1") {
     116                try {
     117                    $env = lenochat_load_env_func();
     118                    $activate_url = isset($env["LENOCHAT_ACTIVATE_WORDPRESS_INTEGRATION"]) ? $env["LENOCHAT_ACTIVATE_WORDPRESS_INTEGRATION"] : null;
     119                   
     120                    if ($activate_url) {
     121                        $license = get_option("lenochat_license");
     122                        $company_id = get_option("lenochat_company_id");
     123                       
     124                        if (!empty($license) && !empty($company_id)) {
     125                            $request_body = [
     126                                "license" => intval($license),
     127                                "platform" => 20,
     128                                "companyId" => intval($company_id)
     129                            ];
     130                           
     131                            $response = wp_remote_post($activate_url, [
     132                                "body" => json_encode($request_body),
     133                                "headers" => ["Content-Type" => "application/json"],
     134                                "timeout" => 30,
     135                            ]);
     136                           
     137                            if (is_wp_error($response)) {
     138                                // Log error but don't block the toggle
     139                                error_log("LenoChat activation error: " . $response->get_error_message());
     140                            }
     141                        }
     142                    }
     143                } catch (Exception $e) {
     144                    // Log error but don't block the toggle
     145                    error_log("LenoChat activation exception: " . $e->getMessage());
     146                }
     147            }
     148           
    110149            $lenochat_needs_redirect = true;
    111150        }
  • lenochat/tags/1.0.3/data-env.php

    r3395661 r3397037  
    33return [
    44    "LENOCHAT_JS_URL" => "https://my-cdn.lenochat.com/lenochat.js",
    5     "AUTH_URL" => "https://8twcxgmmjb.execute-api.us-east-1.amazonaws.com/prod/v1/public/auth",
     5    "AUTH_URL" => "https://my-sls.lenochat.com/prod/v1/public/auth",
    66    "LENOCHAT_URL" => "https://www.lenochat.com/",
    77    "LENOCHAT_APP_URL" => "https://my.lenochat.com/",
    88    "LENOCHAT_LOGO_URL" => "https://my-cdn.lenochat.com/assets/lenochat/lenochatbanner.svg",
    99    "LENOCHAT_MENU_ICON_URL" => "https://my-cdn.lenochat.com/assets/lenochat/lenochaticon-blue.png",
     10    "LENOCHAT_ACTIVATE_WORDPRESS_INTEGRATION" => "https://my-api.lenochat.com/request/public/platform/activate",
    1011];
  • lenochat/tags/1.0.3/lenochat.php

    r3395661 r3397037  
    44 *
    55 * @link              http://www.lenochat.com
    6  * @since             1.0.2
     6 * @since             1.0.3
    77 * @package           LenoChat
    88 *
     
    1111 * Plugin URI:        http://www.lenochat.com
    1212 * Description:       Real-Time Conversations Made Simple! Enjoy engaging with your website visitors in real-time using LenoChat. Max out Customer Experience & Skyrocket Your Business Growth Deliver better support, faster responses, and stronger connections.
    13  * Version:           1.0.2
     13 * Version:           1.0.3
    1414 * Author:            LenoChat
    1515 * Author URI:        https://www.lenochat.com
     
    2424
    2525// Define constants for the plugin
    26 define("LENOCHAT_VERSION", "1.0.2");
     26define("LENOCHAT_VERSION", "1.0.3");
    2727define("LENOCHAT_PLUGIN_DIR", plugin_dir_path(__FILE__));
    2828define("LENOCHAT_PLUGIN_URL", plugin_dir_url(__FILE__));
  • lenochat/tags/1.0.3/readme.txt

    r3395661 r3397037  
    55Requires PHP: 7.2
    66Tested up to: 6.8
    7 Stable tag: 1.0.2
     7Stable tag: 1.0.3
    88Donate link: https://www.lenochat.com
    99License: GPL-2.0+
     
    113113
    114114== Changelog ==
     115= 1.0.3 =
     116* Added WordPress integration activation endpoint call when widget visibility is enabled
     117
    115118= 1.0.2 =
    116119* Added custom menu icon with styling
     
    124127
    125128== Upgrade Notice ==
     129= 1.0.3 =
     130Added automatic WordPress integration activation when widget is enabled. Fixed API request validation issues.
     131
    126132= 1.0.2 =
    127133Added custom menu icon and moved LenoChat to top-level admin menu.
  • lenochat/trunk/admin/views/lenochat-login.php

    r3295761 r3397037  
    7979                if (isset($arr["success"]) && $arr["success"]) {
    8080                    update_option("lenochat_license", $arr["data"][0]["license"]);
     81                    if (isset($arr["data"][0]["company_id"])) {
     82                        update_option("lenochat_company_id", $arr["data"][0]["company_id"]);
     83                    }
    8184                    $encodedToken = json_encode($arr["data"]);
    8285                    $license = get_option("lenochat_license");
     
    108111            update_option("lenochat_status", $widgetStatus);
    109112            $status = $widgetStatus;
     113           
     114            // If widget is being activated (status = "1"), call activation endpoint
     115            if ($widgetStatus == "1") {
     116                try {
     117                    $env = lenochat_load_env_func();
     118                    $activate_url = isset($env["LENOCHAT_ACTIVATE_WORDPRESS_INTEGRATION"]) ? $env["LENOCHAT_ACTIVATE_WORDPRESS_INTEGRATION"] : null;
     119                   
     120                    if ($activate_url) {
     121                        $license = get_option("lenochat_license");
     122                        $company_id = get_option("lenochat_company_id");
     123                       
     124                        if (!empty($license) && !empty($company_id)) {
     125                            $request_body = [
     126                                "license" => intval($license),
     127                                "platform" => 20,
     128                                "companyId" => intval($company_id)
     129                            ];
     130                           
     131                            $response = wp_remote_post($activate_url, [
     132                                "body" => json_encode($request_body),
     133                                "headers" => ["Content-Type" => "application/json"],
     134                                "timeout" => 30,
     135                            ]);
     136                           
     137                            if (is_wp_error($response)) {
     138                                // Log error but don't block the toggle
     139                                error_log("LenoChat activation error: " . $response->get_error_message());
     140                            }
     141                        }
     142                    }
     143                } catch (Exception $e) {
     144                    // Log error but don't block the toggle
     145                    error_log("LenoChat activation exception: " . $e->getMessage());
     146                }
     147            }
     148           
    110149            $lenochat_needs_redirect = true;
    111150        }
  • lenochat/trunk/data-env.php

    r3395661 r3397037  
    33return [
    44    "LENOCHAT_JS_URL" => "https://my-cdn.lenochat.com/lenochat.js",
    5     "AUTH_URL" => "https://8twcxgmmjb.execute-api.us-east-1.amazonaws.com/prod/v1/public/auth",
     5    "AUTH_URL" => "https://my-sls.lenochat.com/prod/v1/public/auth",
    66    "LENOCHAT_URL" => "https://www.lenochat.com/",
    77    "LENOCHAT_APP_URL" => "https://my.lenochat.com/",
    88    "LENOCHAT_LOGO_URL" => "https://my-cdn.lenochat.com/assets/lenochat/lenochatbanner.svg",
    99    "LENOCHAT_MENU_ICON_URL" => "https://my-cdn.lenochat.com/assets/lenochat/lenochaticon-blue.png",
     10    "LENOCHAT_ACTIVATE_WORDPRESS_INTEGRATION" => "https://my-api.lenochat.com/request/public/platform/activate",
    1011];
  • lenochat/trunk/lenochat.php

    r3395661 r3397037  
    44 *
    55 * @link              http://www.lenochat.com
    6  * @since             1.0.2
     6 * @since             1.0.3
    77 * @package           LenoChat
    88 *
     
    1111 * Plugin URI:        http://www.lenochat.com
    1212 * Description:       Real-Time Conversations Made Simple! Enjoy engaging with your website visitors in real-time using LenoChat. Max out Customer Experience & Skyrocket Your Business Growth Deliver better support, faster responses, and stronger connections.
    13  * Version:           1.0.2
     13 * Version:           1.0.3
    1414 * Author:            LenoChat
    1515 * Author URI:        https://www.lenochat.com
     
    2424
    2525// Define constants for the plugin
    26 define("LENOCHAT_VERSION", "1.0.2");
     26define("LENOCHAT_VERSION", "1.0.3");
    2727define("LENOCHAT_PLUGIN_DIR", plugin_dir_path(__FILE__));
    2828define("LENOCHAT_PLUGIN_URL", plugin_dir_url(__FILE__));
  • lenochat/trunk/readme.txt

    r3395661 r3397037  
    55Requires PHP: 7.2
    66Tested up to: 6.8
    7 Stable tag: 1.0.2
     7Stable tag: 1.0.3
    88Donate link: https://www.lenochat.com
    99License: GPL-2.0+
     
    113113
    114114== Changelog ==
     115= 1.0.3 =
     116* Added WordPress integration activation endpoint call when widget visibility is enabled
     117
    115118= 1.0.2 =
    116119* Added custom menu icon with styling
     
    124127
    125128== Upgrade Notice ==
     129= 1.0.3 =
     130Added automatic WordPress integration activation when widget is enabled. Fixed API request validation issues.
     131
    126132= 1.0.2 =
    127133Added custom menu icon and moved LenoChat to top-level admin menu.
Note: See TracChangeset for help on using the changeset viewer.