Plugin Directory

Changeset 3750286


Ignore:
Timestamp:
10/16/2026 11:17:27 AM (2 days ago)
Author:
sabitali
Message:

Release 1.0.1: native async loading, HTML API script attributes, dismissible setup notice, connection status, load_widget filter, privacy policy text, multisite uninstall, readme cleanup and screenshots

Location:
bitsa-ai-chatbot
Files:
2 added
2 deleted
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • bitsa-ai-chatbot/tags/1.0.1/bitsa-ai-chatbot.php

    r3750113 r3750286  
    44 * Plugin URI:        https://www.bitsaai.com/wordpress-ai-chatbot-plugin/
    55 * Description:       Add your Bitsa AI chatbot to every page of your site. It answers visitor questions 24/7 from your own content and captures leads. Paste your Client ID under Bitsa AI Chatbot in the admin menu.
    6  * Version:           1.0.0
     6 * Version:           1.0.1
    77 * Requires at least: 5.0
    88 * Requires PHP:      7.4
    … …  
    1212 * License URI:       https://www.gnu.org/licenses/gpl-2.0.html
    1313 * Text Domain:       bitsa-ai-chatbot
     14 *
     15 * @package Bitsa_AI_Chatbot
    1416 */
    1517
    … …  
    1820}
    1921
    20 define( 'BITSAAI_CHATBOT_VERSION', '1.0.0' );
     22define( 'BITSAAI_CHATBOT_VERSION', '1.0.1' );
    2123define( 'BITSAAI_CHATBOT_OPTION', 'bitsaai_chatbot_settings' );
     24define( 'BITSAAI_CHATBOT_HANDLE', 'bitsaai-chatbot' );
     25define( 'BITSAAI_CHATBOT_PAGE', 'bitsaai-chatbot' );
    2226define( 'BITSAAI_CHATBOT_SNIPPET_URL', 'https://www.bitsaai.com/embed-snippet.js' );
     27define( 'BITSAAI_CHATBOT_SIGNUP_URL', 'https://www.bitsaai.com/signup' );
    2328define( 'BITSAAI_CHATBOT_DASHBOARD_URL', 'https://www.bitsaai.com/login' );
    2429define( 'BITSAAI_CHATBOT_DOMAINS_URL', 'https://www.bitsaai.com/client/domains' );
     30define( 'BITSAAI_CHATBOT_PRIVACY_URL', 'https://www.bitsaai.com/privacy/' );
    2531
    2632/**
    … …  
    3137 */
    3238function bitsaai_chatbot_site_domain() {
    33         $host = wp_parse_url( home_url(), PHP_URL_HOST );
    34         $host = strtolower( (string) $host );
     39        $host = strtolower( (string) wp_parse_url( home_url(), PHP_URL_HOST ) );
    3540        if ( 0 === strpos( $host, 'www.' ) ) {
    3641                $host = substr( $host, 4 );
    … …  
    4045
    4146/**
    42  * Saved settings merged with defaults.
     47 * Saved settings merged with defaults and cast to their expected types, so a
     48 * hand-edited or corrupted option can never reach the page as something else.
    4349 *
    4450 * @return array{client_id: string, enabled: bool}
    … …  
    4652function bitsaai_chatbot_get_settings() {
    4753        $saved = get_option( BITSAAI_CHATBOT_OPTION, array() );
    48         return wp_parse_args(
    49                 is_array( $saved ) ? $saved : array(),
    50                 array(
    51                         'client_id' => '',
    52                         'enabled'   => true,
    53                 )
     54        $saved = is_array( $saved ) ? $saved : array();
     55
     56        return array(
     57                'client_id' => isset( $saved['client_id'] ) ? bitsaai_chatbot_extract_client_id( $saved['client_id'] ) : '',
     58                'enabled'   => isset( $saved['enabled'] ) ? (bool) $saved['enabled'] : true,
    5459        );
    5560}
    … …  
    5964 * embed code copied from the Bitsa AI dashboard.
    6065 *
    61  * @param string $raw Pasted value.
     66 * @param mixed $raw Pasted value.
    6267 * @return string 24-character Client ID, or '' if none found.
    6368 */
    6469function bitsaai_chatbot_extract_client_id( $raw ) {
     70        if ( ! is_scalar( $raw ) ) {
     71                return '';
     72        }
    6573        if ( preg_match( '/\b([a-f0-9]{24})\b/i', (string) $raw, $m ) ) {
    6674                return strtolower( $m[1] );
    … …  
    6977}
    7078
    71 /* -------------------------------------------------------------------------
     79/**
     80 * HTML allowed in translatable admin strings that embed a link.
     81 *
     82 * @return array
     83 */
     84function bitsaai_chatbot_allowed_html() {
     85        return array(
     86                'a'      => array(
     87                        'href'   => true,
     88                        'target' => true,
     89                        'rel'    => true,
     90                ),
     91                'strong' => array(),
     92        );
     93}
     94
     95/**
     96 * Markup for a link that opens the Bitsa AI dashboard in a new tab.
     97 *
     98 * @param string $url  Destination.
     99 * @param string $text Link text (unescaped).
     100 * @return string
     101 */
     102function bitsaai_chatbot_external_link( $url, $text ) {
     103        return '<a href="' . esc_url( $url ) . '" target="_blank" rel="noopener noreferrer">' . esc_html( $text ) . '</a>';
     104}
     105
     106/*
    72107 * Front end: load the widget.
    73  * ---------------------------------------------------------------------- */
     108 */
    74109
    75110/**
    … …  
    78113function bitsaai_chatbot_enqueue() {
    79114        $settings = bitsaai_chatbot_get_settings();
    80         if ( empty( $settings['enabled'] ) || '' === $settings['client_id'] ) {
    81                 return;
    82         }
    83         wp_enqueue_script( 'bitsaai-chatbot', BITSAAI_CHATBOT_SNIPPET_URL, array(), BITSAAI_CHATBOT_VERSION, true );
     115        if ( ! $settings['enabled'] || '' === $settings['client_id'] ) {
     116                return;
     117        }
     118
     119        /**
     120         * Filters whether the chatbot loads on the current request. Return false to
     121         * hide it on specific pages, e.g. checkout or a landing page.
     122         *
     123         * @param bool $load Whether to load the widget. Default true.
     124         */
     125        if ( ! apply_filters( 'bitsaai_chatbot_load_widget', true ) ) {
     126                return;
     127        }
     128
     129        // The snippet URL is unversioned on our side, so no ?ver= is appended. The
     130        // array form gives native async on WP 6.3+; older versions read it as
     131        // in_footer = true and the async attribute is added in the tag filter below.
     132        wp_enqueue_script(
     133                BITSAAI_CHATBOT_HANDLE,
     134                BITSAAI_CHATBOT_SNIPPET_URL,
     135                array(),
     136                null, // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.MissingVersion -- remote file, versioned by the service.
     137                array(
     138                        'in_footer' => true,
     139                        'strategy'  => 'async',
     140                )
     141        );
    84142}
    85143add_action( 'wp_enqueue_scripts', 'bitsaai_chatbot_enqueue' );
    86144
    87145/**
    88  * Add the async flag and the data attributes the loader reads to our script tag only.
     146 * Add the data attributes the loader reads to our script tag only.
    89147 *
    90148 * @param string $tag    Script tag HTML.
    … …  
    93151 */
    94152function bitsaai_chatbot_script_tag( $tag, $handle ) {
    95         if ( 'bitsaai-chatbot' !== $handle ) {
     153        if ( BITSAAI_CHATBOT_HANDLE !== $handle ) {
    96154                return $tag;
    97155        }
    98         $settings = bitsaai_chatbot_get_settings();
    99         $attrs    = sprintf(
    100                 ' data-client-id="%s" data-mode="ai" async',
    101                 esc_attr( $settings['client_id'] )
    102         );
    103         return str_replace( ' src=', $attrs . ' src=', $tag );
     156        $client_id = bitsaai_chatbot_get_settings()['client_id'];
     157        if ( '' === $client_id ) {
     158                return $tag;
     159        }
     160        $script_id = BITSAAI_CHATBOT_HANDLE . '-js';
     161
     162        // WP 6.2+: edit the tag with the HTML API instead of string surgery, so
     163        // before/after inline scripts and attribute quoting styles don't matter.
     164        if ( class_exists( 'WP_HTML_Tag_Processor' ) ) {
     165                $processor = new WP_HTML_Tag_Processor( $tag );
     166                while ( $processor->next_tag( 'script' ) ) {
     167                        if ( $script_id !== $processor->get_attribute( 'id' ) ) {
     168                                continue;
     169                        }
     170                        $processor->set_attribute( 'data-client-id', $client_id );
     171                        $processor->set_attribute( 'data-mode', 'ai' );
     172                        // Keep Cloudflare Rocket Loader from rewriting the tag: the loader needs
     173                        // document.currentScript to read its data attributes.
     174                        $processor->set_attribute( 'data-cfasync', 'false' );
     175                        $processor->set_attribute( 'async', true );
     176                        return $processor->get_updated_html();
     177                }
     178                return $tag;
     179        }
     180
     181        $attrs = sprintf(
     182                ' data-client-id="%s" data-mode="ai" data-cfasync="false"%s',
     183                esc_attr( $client_id ),
     184                preg_match( '/\sasync\b/i', $tag ) ? '' : ' async'
     185        );
     186        return (string) preg_replace(
     187                '/<script\b(?=[^>]*\bid=["\']' . preg_quote( $script_id, '/' ) . '["\'])/i',
     188                '<script' . $attrs,
     189                $tag,
     190                1
     191        );
    104192}
    105193add_filter( 'script_loader_tag', 'bitsaai_chatbot_script_tag', 10, 2 );
    106194
    107 /* -------------------------------------------------------------------------
     195/*
    108196 * Admin: settings page.
    109  * ---------------------------------------------------------------------- */
     197 */
    110198
    111199/**
    … …  
    119207                        'type'              => 'array',
    120208                        'sanitize_callback' => 'bitsaai_chatbot_sanitize_settings',
     209                        'show_in_rest'      => false,
    121210                        'default'           => array(
    122211                                'client_id' => '',
    … …  
    126215        );
    127216
    128         add_settings_section( 'bitsaai_chatbot_main', '', '__return_false', 'bitsaai-chatbot' );
     217        add_settings_section( 'bitsaai_chatbot_main', '', '__return_false', BITSAAI_CHATBOT_PAGE );
    129218
    130219        add_settings_field(
    … …  
    132221                __( 'Client ID', 'bitsa-ai-chatbot' ),
    133222                'bitsaai_chatbot_field_client_id',
    134                 'bitsaai-chatbot',
     223                BITSAAI_CHATBOT_PAGE,
    135224                'bitsaai_chatbot_main',
    136225                array( 'label_for' => 'bitsaai_chatbot_client_id' )
    … …  
    141230                __( 'Show chatbot', 'bitsa-ai-chatbot' ),
    142231                'bitsaai_chatbot_field_enabled',
    143                 'bitsaai-chatbot',
     232                BITSAAI_CHATBOT_PAGE,
    144233                'bitsaai_chatbot_main'
    145234        );
    … …  
    156245        $input     = is_array( $input ) ? $input : array();
    157246        $raw_id    = isset( $input['client_id'] ) ? wp_unslash( $input['client_id'] ) : '';
     247        $raw_id    = is_scalar( $raw_id ) ? trim( (string) $raw_id ) : null; // null: malformed request.
    158248        $client_id = bitsaai_chatbot_extract_client_id( $raw_id );
    159249
    160         if ( '' !== trim( (string) $raw_id ) && '' === $client_id ) {
     250        if ( '' !== $raw_id && '' === $client_id ) {
    161251                add_settings_error(
    162252                        BITSAAI_CHATBOT_OPTION,
    … …  
    164254                        __( 'That does not look like a Bitsa AI Client ID. Copy it from Branding → Embed code in your Bitsa AI dashboard.', 'bitsa-ai-chatbot' )
    165255                );
     256                // Keep the last good ID rather than wiping a working setup.
    166257                $client_id = bitsaai_chatbot_get_settings()['client_id'];
    167258        }
    … …  
    179270        $settings = bitsaai_chatbot_get_settings();
    180271        printf(
    181                 '<input type="text" id="bitsaai_chatbot_client_id" name="%1$s[client_id]" value="%2$s" class="regular-text code" placeholder="e.g. 64f1c2a9b3e4d5f6a7b8c9d0" autocomplete="off" />',
     272                '<input type="text" id="bitsaai_chatbot_client_id" name="%1$s[client_id]" value="%2$s" class="regular-text code" placeholder="%3$s" autocomplete="off" spellcheck="false" />',
    182273                esc_attr( BITSAAI_CHATBOT_OPTION ),
    183                 esc_attr( $settings['client_id'] )
     274                esc_attr( $settings['client_id'] ),
     275                esc_attr__( 'e.g. 64f1c2a9b3e4d5f6a7b8c9d0', 'bitsa-ai-chatbot' )
    184276        );
    185277        echo '<p class="description">';
    186         printf(
    187                 /* translators: %s: link to the Bitsa AI dashboard */
    188                 esc_html__( 'Find it in your %s under Branding → Embed code. You can paste the whole embed code here; the ID is picked out automatically.', 'bitsa-ai-chatbot' ),
    189                 '<a href="' . esc_url( BITSAAI_CHATBOT_DASHBOARD_URL ) . '" target="_blank" rel="noopener noreferrer">' . esc_html__( 'Bitsa AI dashboard', 'bitsa-ai-chatbot' ) . '</a>'
     278        echo wp_kses(
     279                sprintf(
     280                        /* translators: %s: link to the Bitsa AI dashboard */
     281                        esc_html__( 'Find it in your %s under Branding → Embed code. You can paste the whole embed code here; the ID is picked out automatically.', 'bitsa-ai-chatbot' ),
     282                        bitsaai_chatbot_external_link( BITSAAI_CHATBOT_DASHBOARD_URL, __( 'Bitsa AI dashboard', 'bitsa-ai-chatbot' ) )
     283                ),
     284                bitsaai_chatbot_allowed_html()
    190285        );
    191286        echo '</p>';
    … …  
    200295                '<label><input type="checkbox" name="%1$s[enabled]" value="1" %2$s /> %3$s</label>',
    201296                esc_attr( BITSAAI_CHATBOT_OPTION ),
    202                 checked( ! empty( $settings['enabled'] ), true, false ),
     297                checked( $settings['enabled'], true, false ),
    203298                esc_html__( 'Display the chatbot on the front end of this site', 'bitsa-ai-chatbot' )
    204299        );
    … …  
    213308                __( 'Bitsa AI Chatbot', 'bitsa-ai-chatbot' ),
    214309                'manage_options',
    215                 'bitsaai-chatbot',
     310                BITSAAI_CHATBOT_PAGE,
    216311                'bitsaai_chatbot_render_settings_page',
    217312                'dashicons-format-chat',
    … …  
    220315}
    221316add_action( 'admin_menu', 'bitsaai_chatbot_admin_menu' );
     317
     318/**
     319 * One-line connection status for the top of the settings page.
     320 */
     321function bitsaai_chatbot_render_status() {
     322        $settings = bitsaai_chatbot_get_settings();
     323        if ( '' === $settings['client_id'] ) {
     324                $class = 'notice-warning';
     325                $text  = __( 'Not connected yet. Complete the two steps below.', 'bitsa-ai-chatbot' );
     326        } elseif ( ! $settings['enabled'] ) {
     327                $class = 'notice-info';
     328                $text  = __( 'Connected, but the chatbot is switched off. Tick "Show chatbot" below to display it.', 'bitsa-ai-chatbot' );
     329        } else {
     330                $class = 'notice-success';
     331                $text  = __( 'Connected. The chatbot loads on your site as long as this domain is on your Bitsa AI whitelist.', 'bitsa-ai-chatbot' );
     332        }
     333        printf(
     334                '<div class="notice inline %1$s"><p><strong>%2$s</strong> %3$s</p></div>',
     335                esc_attr( $class ),
     336                esc_html__( 'Status:', 'bitsa-ai-chatbot' ),
     337                esc_html( $text )
     338        );
     339}
    222340
    223341/**
    … …  
    236354                settings_errors( BITSAAI_CHATBOT_OPTION );
    237355                settings_errors( 'general' );
     356                bitsaai_chatbot_render_status();
    238357                ?>
    239358                <p>
    … …  
    242361                <p>
    243362                        <?php
    244                         printf(
    245                                 /* translators: %s: link to sign up for Bitsa AI */
    246                                 esc_html__( 'No account yet? %s (7-day free trial, no card required).', 'bitsa-ai-chatbot' ),
    247                                 '<a href="' . esc_url( 'https://www.bitsaai.com/signup' ) . '" target="_blank" rel="noopener noreferrer">' . esc_html__( 'Create one at bitsaai.com', 'bitsa-ai-chatbot' ) . '</a>'
     363                        echo wp_kses(
     364                                sprintf(
     365                                        /* translators: %s: link to sign up for Bitsa AI */
     366                                        esc_html__( 'No account yet? %s (7-day free trial, no card required).', 'bitsa-ai-chatbot' ),
     367                                        bitsaai_chatbot_external_link( BITSAAI_CHATBOT_SIGNUP_URL, __( 'Create one at bitsaai.com', 'bitsa-ai-chatbot' ) )
     368                                ),
     369                                bitsaai_chatbot_allowed_html()
    248370                        );
    249371                        ?>
    … …  
    261383                        <li>
    262384                                <?php
    263                                 printf(
    264                                         /* translators: %s: link to the Domain Access page of the Bitsa AI dashboard */
    265                                         esc_html__( 'Log in to your Bitsa AI dashboard and open %s from the left menu.', 'bitsa-ai-chatbot' ),
    266                                         '<a href="' . esc_url( BITSAAI_CHATBOT_DOMAINS_URL ) . '" target="_blank" rel="noopener noreferrer"><strong>' . esc_html__( 'Domain Access', 'bitsa-ai-chatbot' ) . '</strong></a>'
     385                                echo wp_kses(
     386                                        sprintf(
     387                                                /* translators: %s: link to the Domain Access page of the Bitsa AI dashboard */
     388                                                esc_html__( 'Log in to your Bitsa AI dashboard and open %s from the left menu.', 'bitsa-ai-chatbot' ),
     389                                                '<strong>' . bitsaai_chatbot_external_link( BITSAAI_CHATBOT_DOMAINS_URL, __( 'Domain Access', 'bitsa-ai-chatbot' ) ) . '</strong>'
     390                                        ),
     391                                        bitsaai_chatbot_allowed_html()
    267392                                );
    268393                                ?>
    … …  
    272397                </ol>
    273398                <p class="description">
    274                         <?php esc_html_e( 'Tips: enter only the domain, e.g. example.com (no https:// or www.). Adding example.com also covers www.example.com and every subdomain such as shop.example.com. A staging or local site with a different domain (e.g. mysite.local) needs its own entry.', 'bitsa-ai-chatbot' ); ?>
     399                        <?php esc_html_e( 'Tips: enter only the domain, e.g. example.com (no https:// or www.). Adding example.com also covers www.example.com and every subdomain such as shop.example.com. A staging or local site with a different domain (e.g. mysite.local) needs its own entry. If you use a page-cache or optimisation plugin, clear its cache after saving.', 'bitsa-ai-chatbot' ); ?>
    275400                </p>
    276401
    … …  
    279404                        <?php
    280405                        settings_fields( 'bitsaai_chatbot' );
    281                         do_settings_sections( 'bitsaai-chatbot' );
     406                        do_settings_sections( BITSAAI_CHATBOT_PAGE );
    282407                        submit_button();
    283408                        ?>
    … …  
    294419 */
    295420function bitsaai_chatbot_action_links( $links ) {
    296         $url = admin_url( 'admin.php?page=bitsaai-chatbot' );
     421        $url = admin_url( 'admin.php?page=' . BITSAAI_CHATBOT_PAGE );
    297422        array_unshift( $links, '<a href="' . esc_url( $url ) . '">' . esc_html__( 'Settings', 'bitsa-ai-chatbot' ) . '</a>' );
    298423        return $links;
    … …  
    301426
    302427/**
    303  * Remind admins to finish setup until a Client ID is saved.
     428 * Remind admins to finish setup until a Client ID is saved. Shown only on the
     429 * Dashboard and Plugins screens, and dismissible, so it never nags elsewhere.
    304430 */
    305431function bitsaai_chatbot_setup_notice() {
    … …  
    308434        }
    309435        $screen = get_current_screen();
    310         if ( $screen && 'toplevel_page_bitsaai-chatbot' === $screen->id ) {
     436        if ( ! $screen || ! in_array( $screen->id, array( 'dashboard', 'plugins' ), true ) ) {
    311437                return;
    312438        }
    … …  
    314440                return;
    315441        }
    316         $url = admin_url( 'admin.php?page=bitsaai-chatbot' );
    317442        printf(
    318                 '<div class="notice notice-info"><p>%1$s <a href="%2$s">%3$s</a></p></div>',
     443                '<div class="notice notice-info is-dismissible"><p>%1$s <a href="%2$s">%3$s</a></p></div>',
    319444                esc_html__( 'Bitsa AI Chatbot is almost ready.', 'bitsa-ai-chatbot' ),
    320                 esc_url( $url ),
     445                esc_url( admin_url( 'admin.php?page=' . BITSAAI_CHATBOT_PAGE ) ),
    321446                esc_html__( 'Add your Client ID to switch it on.', 'bitsa-ai-chatbot' )
    322447        );
    323448}
    324449add_action( 'admin_notices', 'bitsaai_chatbot_setup_notice' );
     450
     451/**
     452 * Suggest text for the site's privacy policy (Settings → Privacy → Policy Guide).
     453 */
     454function bitsaai_chatbot_privacy_policy_content() {
     455        if ( ! function_exists( 'wp_add_privacy_policy_content' ) ) {
     456                return;
     457        }
     458        $content = '<p>' . esc_html__( 'This site uses the Bitsa AI chatbot. When a visitor opens the chat, their messages, any contact details they choose to share (such as name, email address or phone number), the website domain, and standard technical data (IP address, browser user agent) are sent to Bitsa AI to generate replies and record enquiries for the site owner.', 'bitsa-ai-chatbot' ) . '</p>'
     459                . '<p>' . wp_kses(
     460                        sprintf(
     461                                /* translators: %s: link to the Bitsa AI privacy policy */
     462                                esc_html__( 'See the %s for how this data is handled.', 'bitsa-ai-chatbot' ),
     463                                bitsaai_chatbot_external_link( BITSAAI_CHATBOT_PRIVACY_URL, __( 'Bitsa AI privacy policy', 'bitsa-ai-chatbot' ) )
     464                        ),
     465                        bitsaai_chatbot_allowed_html()
     466                ) . '</p>';
     467
     468        wp_add_privacy_policy_content( __( 'Bitsa AI Chatbot', 'bitsa-ai-chatbot' ), wp_kses_post( $content ) );
     469}
     470add_action( 'admin_init', 'bitsaai_chatbot_privacy_policy_content' );
  • bitsa-ai-chatbot/tags/1.0.1/readme.txt

    r3750149 r3750286  
    1 === Bitsa AI Chatbot – 24/7 AI Sales Assistant, Live Chat & Smart Lead Generation ===
     1=== Bitsa AI Chatbot ===
    22Contributors: sabitali
    3 Donate link: https://www.bitsaai.com/
    43Tags: chatbot, ai chatbot, customer support, live chat, lead generation
    54Requires at least: 5.0
    65Tested up to: 7.1
    76Requires PHP: 7.4
    8 Stable tag: 1.0.0
     7Stable tag: 1.0.1
    98License: GPLv2 or later
    109License URI: https://www.gnu.org/licenses/gpl-2.0.html
    1110
    12 Autonomous 24/7 AI chatbot trained on your website content. Answers visitor queries instantly, captures qualified leads, and drives sales.
     1124/7 AI chatbot and live chat trained on your website content. Answers visitor questions instantly and captures qualified leads.
    1312
    1413== Description ==
    1514
    16 **Bitsa AI Chatbot** is a next-generation conversational AI assistant designed to turn casual website visitors into loyal customers. Powered by custom large language models, Bitsa AI learns your business inside and out—answering support queries in real time, capturing high-intent leads, and guiding shoppers toward purchasing decisions around the clock.
     15**Bitsa AI Chatbot** is a conversational AI assistant that helps turn website visitors into customers. Bitsa AI learns your business from the content you give it, answers support questions in real time, captures high-intent leads, and guides shoppers toward a purchase around the clock.
    1716
    18 Unlike traditional static rule-based bots that frustrate visitors with rigid menus, Bitsa AI understands natural human intent, context, and nuance. It answers queries directly from your approved knowledge base (website pages, FAQs, documentation, and product catalogs) with zero hallucinations.
     17Unlike rule-based bots with rigid menus, Bitsa AI understands natural language, context and intent. It answers from your own approved knowledge base (website pages, FAQs, documentation and product catalogues) instead of generic internet content.
    1918
    20 ---
     19= Key features =
    2120
    22 ### 🚀 Key Features
     21* **Fast knowledge base setup:** Train your AI in minutes from your website URLs, sitemaps, PDFs, text documents or FAQs inside your Bitsa AI dashboard.
     22* **Lead capture and qualification:** Collect visitor names, phone numbers, email addresses and requirements inside the conversation, then hand warm leads to your sales team.
     23* **WooCommerce aware:** Helps shoppers discover products, check details and add items to their cart through the official WooCommerce Store API.
     24* **Multilingual, including Hinglish:** Understands and replies in 50+ languages, including English, Hindi and Hinglish.
     25* **Lightweight and non-blocking:** A single small loader (about 16 KB gzipped) loads asynchronously in the footer, and the chat window itself loads only after the page has finished loading or when a visitor reaches for the chat. It does not block page rendering.
     26* **Brand customisation:** Change the theme, launcher icon, welcome greeting and bubble position from your Bitsa AI dashboard without touching code.
     27* **Domain whitelisting:** Your chatbot only runs on domains you explicitly authorise, so nobody else can use your AI quota.
    2328
    24 * **Instant Knowledge Base Ingestion:** Train your AI in minutes by connecting your website URLs, sitemaps, PDFs, text documents, or FAQs inside your Bitsa AI dashboard.
    25 * **Autonomous Lead Capture & Qualification:** Collect visitor names, phone numbers, email addresses, and specific requirements right inside the conversation before handing warm leads to your sales team.
    26 * **Seamless WooCommerce Intelligence:** WooCommerce-aware chatbot that helps shoppers discover products, checks stock/details, and allows visitors to add products directly to their cart via the official WooCommerce Store API.
    27 * **True Multilingual & Hinglish Support:** Understands and replies naturally in over 50+ languages, including fluent English, Hindi, and natural Hinglish.
    28 * **Asynchronous & Ultra-Lightweight:** Loads non-blockingly in your website footer (<15 KB footprint). Guaranteed zero impact on your Core Web Vitals, PageSpeed Insights, or SEO scores.
    29 * **Full Brand Customization:** Tailor the chatbot theme, launcher icons, welcome greetings, and chat bubble position directly from your cloud dashboard without touching a single line of code.
    30 * **Multi-Domain Whitelisting & Security:** Strict origin verification ensures your chatbot only runs on domains you explicitly authorize.
     29= Built for e-commerce and service businesses =
    3130
    32 ---
     31Whether you run a WooCommerce store, a digital agency, a healthcare practice or a real estate consultancy, Bitsa AI acts as a 24/7 front desk. It handles repetitive customer questions automatically and routes high-value prospects straight into your pipeline.
    3332
    34 ### 🛒 Built for E-Commerce & Service Businesses
     33= How it works =
    3534
    36 Whether you run a high-volume WooCommerce store, a digital agency, a healthcare practice, or a real estate consultancy, Bitsa AI acts as your dedicated 24/7 front-desk executive. It resolves up to 80% of repetitive customer support inquiries automatically and routes high-value sales prospects straight into your pipeline.
     35This plugin is a lightweight connector between your WordPress site and your Bitsa AI dashboard. AI responses, knowledge base training and lead management run on Bitsa AI's cloud service.
    3736
    38 ---
     37A Bitsa AI account is required. Every new account includes a **7-day free trial** (no credit card required). Paid plans start at ₹299/month. See [Bitsa AI Pricing](https://www.bitsaai.com/chatbot-pricing-india/).
    3938
    40 ### ⚙️ How It Works
     39= For developers =
    4140
    42 This plugin serves as a secure, lightweight connector between your WordPress site and your Bitsa AI cloud dashboard. The AI inference, knowledge base training, and lead management are handled on Bitsa AI's optimized cloud infrastructure.
     41Hide the chatbot on specific pages with the `bitsaai_chatbot_load_widget` filter:
    4342
    44 A Bitsa AI account is required. Every new account includes an unrestricted **7-day free trial** (no credit card required). Affordable paid plans start at just ₹299/month. Explore plans at [Bitsa AI Pricing](https://www.bitsaai.com/chatbot-pricing-india/).
    45 
    46 ---
     43`add_filter( 'bitsaai_chatbot_load_widget', function ( $load ) { return is_checkout() ? false : $load; } );`
    4744
    4845== External services ==
    4946
    50 This plugin securely connects your WordPress website to the Bitsa AI cloud service to deliver conversational AI and live chat capabilities. No external scripts or styles are loaded until you input and save your authorized Client ID in the plugin settings.
     47This plugin connects your website to the Bitsa AI cloud service to provide the chatbot. Nothing is loaded from Bitsa AI until you save a Client ID in the plugin settings, and nothing is loaded while the "Show chatbot" option is switched off.
    5148
    52 1. **Bitsa AI Embed Widget (`www.bitsaai.com`)**
    53    * **Purpose:** Delivers the chat launcher interface and real-time messaging UI to front-end visitors.
     491. **Bitsa AI embed widget (`www.bitsaai.com`)**
     50   * **Purpose:** Delivers the chat launcher and chat window to visitors on the front end of your site.
     51   * **When:** On every front-end page view once a Client ID is saved and the chatbot is switched on.
    5452   * **Script URL:** `https://www.bitsaai.com/embed-snippet.js`
    55    * **Chat Frame URL:** `https://www.bitsaai.com/embed/`
    56    * **Data Transmitted:** Your account Client ID, browser technical metadata (standard IP address and user-agent string for session persistence), and visitor chat messages (including name, email, or contact number if voluntarily provided).
     53   * **Chat window URL:** `https://www.bitsaai.com/embed/`
     54   * **Data sent:** Your Client ID, your website's domain (to check it against your whitelist), and standard request data any web request carries (visitor IP address and browser user agent).
    5755
    58 2. **Bitsa AI Inference & Orchestration API (`production-backend-w1e8.onrender.com`)**
    59    * **Purpose:** Processes incoming user queries against your trained knowledge base, generates conversational responses, and logs captured leads in your dashboard.
    60    * **Data Transmitted:** Client ID and chat conversational text.
     562. **Bitsa AI chat API (`production-backend-w1e8.onrender.com`)**
     57   * **Purpose:** Loads your chatbot's branding, answers visitor questions from your knowledge base, and records captured leads in your dashboard.
     58   * **When:** When the widget loads and whenever a visitor uses the chat.
     59   * **Data sent:** Your Client ID, your website's domain, the visitor's chat messages, and any contact details the visitor chooses to share (such as name, email address or phone number), plus the visitor's IP address and browser user agent.
    6160
    62 3. **Local WooCommerce Store API**
    63    * For WooCommerce stores, cart operations requested by visitors are executed directly against your own website's native REST API (`/wp-json/wc/store/v1/`). Customer purchase data remains strictly within your WordPress installation.
     613. **Your own WooCommerce Store API**
     62   * On WooCommerce stores, cart actions a visitor asks for are sent to your own site's REST API (`/wp-json/wc/store/v1/`), not to Bitsa AI.
    6463
    65 * **Privacy Policy:** [https://www.bitsaai.com/privacy/](https://www.bitsaai.com/privacy/)
    66 * **Terms of Service:** [https://www.bitsaai.com/terms/](https://www.bitsaai.com/terms/)
     64Bitsa AI [Privacy Policy](https://www.bitsaai.com/privacy/) and [Terms of Service](https://www.bitsaai.com/terms/).
    6765
    68 ---
     66The plugin also adds suggested text to your site's privacy policy guide (Settings → Privacy → Policy Guide).
    6967
    7068== Installation ==
    7169
    72 Setting up Bitsa AI Chatbot requires zero coding knowledge and takes less than 2 minutes:
     701. In your WordPress admin, go to **Plugins → Add New**.
     712. Search for `Bitsa AI Chatbot`, click **Install Now**, then **Activate**.
     723. Create a free account or log in at [bitsaai.com](https://www.bitsaai.com/signup).
     734. In the Bitsa AI dashboard, open **Knowledge Base** and train your AI on your website content or documents.
     745. Under **Domain Access**, add your website's domain (e.g. `example.com`, without `https://`).
     756. Open **Branding → Embed code** and copy your **Client ID**.
     767. In WordPress, click **Bitsa AI Chatbot** in the left menu, paste your Client ID and click **Save Changes**.
    7377
    74 1. In your WordPress Admin, navigate to **Plugins → Add New**.
    75 2. Search for `Bitsa AI Chatbot`, click **Install Now**, and then **Activate**.
    76 3. Create your free account or log in at [Bitsa AI Dashboard](https://www.bitsaai.com/signup).
    77 4. In the Bitsa AI dashboard, go to **Knowledge Base** to train your AI on your website content or documents.
    78 5. Under **Domain Access**, add your website's domain name (e.g., `example.com` without `https://`).
    79 6. Navigate to **Branding → Embed code** and copy your unique **Client ID**.
    80 7. In your WordPress admin, click on **Bitsa AI Chatbot** in the left menu, paste your Client ID, and click **Save Changes**.
    81 
    82 Your intelligent assistant is now live on your site!
    83 
    84 ---
     78Your assistant is now live on your site.
    8579
    8680== Frequently Asked Questions ==
    8781
    88 = Do I need an account with Bitsa AI to use this plugin? =
    89 Yes. The plugin connects your WordPress frontend to your custom-trained Bitsa AI brain. You can sign up at [bitsaai.com](https://www.bitsaai.com/) in 30 seconds for a full 7-day free trial without entering payment details.
     82= Do I need a Bitsa AI account to use this plugin? =
     83
     84Yes. The plugin connects your site to your Bitsa AI chatbot. You can sign up at [bitsaai.com](https://www.bitsaai.com/) for a 7-day free trial without entering payment details.
    9085
    9186= Where do I find my Client ID? =
    92 Log in to your Bitsa AI dashboard, go to **Branding → Embed code**, and copy the Client ID. You can also paste the entire `<script>` embed snippet into the plugin settings; the plugin will automatically extract your Client ID.
     87
     88Log in to your Bitsa AI dashboard, go to **Branding → Embed code** and copy the Client ID. You can also paste the entire `<script>` embed code into the plugin settings; the plugin picks out the Client ID automatically.
    9389
    9490= I saved my Client ID, but the chat bubble does not appear. Why? =
    95 For enterprise security, Bitsa AI enforces strict domain whitelisting to prevent unauthorized third parties from using your AI quota. Open your Bitsa AI dashboard, click **Domain Access**, and add your domain (e.g., `yourwebsite.com`). Whitelisting `yourwebsite.com` automatically authorizes all subdomains including `www.yourwebsite.com`.
    9691
    97 = Can Bitsa AI understand and respond in Hindi or Hinglish? =
    98 Yes! Bitsa AI natively supports Hindi, Hinglish (Hindi written in Latin script), and over 50 global languages. It automatically detects the language your visitor uses and responds fluently in that same language.
     92Bitsa AI only shows your chatbot on domains you have whitelisted, so that nobody else can use your AI quota. Open your Bitsa AI dashboard, click **Domain Access** and add your domain (e.g. `yourwebsite.com`). Whitelisting `yourwebsite.com` also covers `www.yourwebsite.com` and every subdomain. If you use a caching or optimisation plugin, clear its cache afterwards.
     93
     94= Can Bitsa AI respond in Hindi or Hinglish? =
     95
     96Yes. Bitsa AI supports Hindi, Hinglish (Hindi written in Latin script) and 50+ other languages. It detects the language your visitor uses and replies in the same language.
    9997
    10098= Can the chatbot help customers on my WooCommerce store? =
    101 Absolutely. When active on a WooCommerce store, Bitsa AI can answer product queries, help shoppers find relevant items, and assist with adding items directly to their shopping cart via native WooCommerce endpoints.
    10299
    103 = Will Bitsa AI slow down my website loading time? =
    104 No. The Bitsa AI script loads 100% asynchronously at the bottom of the page footer. It never blocks DOM construction, CSS parsing, or page rendering.
     100Yes. On a WooCommerce store, Bitsa AI can answer product questions, help shoppers find items and add products to their cart through WooCommerce's own Store API.
    105101
    106 = How do I customize the chatbot appearance (colors, avatar, greeting)? =
    107 All visual branding is managed centrally inside your Bitsa AI cloud dashboard. Any updates you make to colors, launcher position, welcome messages, or bot avatar reflect instantly on your WordPress site without requiring plugin updates.
     102= Will Bitsa AI slow down my website? =
    108103
    109 = Can I temporarily disable the chatbot on my site? =
    110 Yes. You can uncheck the "Show chatbot" checkbox on the Bitsa AI Chatbot settings page and click Save Changes, or simply deactivate the plugin.
     104The loader script is small and loads asynchronously in the footer, so it does not block page rendering, and the chat window loads only after the page has finished loading. As with any third-party widget, we recommend checking your own pages with PageSpeed Insights after installing.
    111105
    112 ---
     106= How do I customise the chatbot's appearance (colours, avatar, greeting)? =
     107
     108All branding is managed in your Bitsa AI dashboard. Changes to colours, launcher position, welcome message or avatar appear on your WordPress site automatically, with no plugin update needed.
     109
     110= Can I temporarily disable the chatbot? =
     111
     112Yes. Untick **Show chatbot** on the Bitsa AI Chatbot settings page and click **Save Changes**, or deactivate the plugin.
     113
     114= Can I hide the chatbot on certain pages? =
     115
     116Yes. Use the `bitsaai_chatbot_load_widget` filter shown in the "For developers" section above.
     117
     118= What happens to my settings when I delete the plugin? =
     119
     120Deleting the plugin from the Plugins screen removes its saved settings, including on every site of a multisite network.
    113121
    114122== Screenshots ==
    115123
    116 1. The intelligent Bitsa AI assistant interacting with a visitor in real-time.
    117 2. Clean, single-click WordPress settings panel for instant Client ID activation.
    118 
    119 ---
     1241. The Bitsa AI chatbot answering a visitor's question on a WordPress site.
     1252. The plugin settings page: whitelist your domain, paste your Client ID and you are connected.
    120126
    121127== Changelog ==
    122128
     129= 1.0.1 =
     130* Improved: The widget now uses WordPress's native async script loading (WordPress 6.3+) and no longer adds an unused version query string to the script URL.
     131* Improved: Script attributes are added with the WordPress HTML API, which is more robust with optimisation plugins. Added compatibility with Cloudflare Rocket Loader.
     132* Improved: The setup reminder now appears only on the Dashboard and Plugins screens and can be dismissed.
     133* Improved: Settings page shows the connection status.
     134* New: `bitsaai_chatbot_load_widget` filter to hide the chatbot on specific pages.
     135* New: Suggested privacy policy text under Settings → Privacy.
     136* Fixed: Settings are now removed from every site when the plugin is deleted on a multisite network.
     137* Hardening: Stricter validation of saved settings and stricter escaping of admin links.
     138
    123139= 1.0.0 =
    124 * Initial official release on the WordPress Plugin Directory.
    125 * Added seamless Client ID integration.
    126 * Added native WooCommerce Store API cart support.
    127 * Added asynchronous non-blocking script loader.
     140* Initial release on the WordPress Plugin Directory.
     141* Connect your site with a Client ID (or by pasting the whole embed code).
     142* Asynchronous, non-blocking widget loader.
     143
     144== Upgrade Notice ==
     145
     146= 1.0.1 =
     147Faster native async loading, a dismissible setup reminder, a new filter to hide the chatbot on specific pages, and multisite cleanup on delete.
  • bitsa-ai-chatbot/tags/1.0.1/uninstall.php

    r3750113 r3750286  
    1010}
    1111
    12 delete_option( 'bitsaai_chatbot_settings' );
     12if ( is_multisite() && function_exists( 'get_sites' ) ) {
     13        // A network-activated plugin stores its settings on every site.
     14        $bitsaai_site_ids = get_sites(
     15                array(
     16                        'fields' => 'ids',
     17                        'number' => 0,
     18                )
     19        );
     20        foreach ( $bitsaai_site_ids as $bitsaai_site_id ) {
     21                switch_to_blog( $bitsaai_site_id );
     22                delete_option( 'bitsaai_chatbot_settings' );
     23                restore_current_blog();
     24        }
     25} else {
     26        delete_option( 'bitsaai_chatbot_settings' );
     27}
  • bitsa-ai-chatbot/trunk/bitsa-ai-chatbot.php

    r3750113 r3750286  
    44 * Plugin URI:        https://www.bitsaai.com/wordpress-ai-chatbot-plugin/
    55 * Description:       Add your Bitsa AI chatbot to every page of your site. It answers visitor questions 24/7 from your own content and captures leads. Paste your Client ID under Bitsa AI Chatbot in the admin menu.
    6  * Version:           1.0.0
     6 * Version:           1.0.1
    77 * Requires at least: 5.0
    88 * Requires PHP:      7.4
    … …  
    1212 * License URI:       https://www.gnu.org/licenses/gpl-2.0.html
    1313 * Text Domain:       bitsa-ai-chatbot
     14 *
     15 * @package Bitsa_AI_Chatbot
    1416 */
    1517
    … …  
    1820}
    1921
    20 define( 'BITSAAI_CHATBOT_VERSION', '1.0.0' );
     22define( 'BITSAAI_CHATBOT_VERSION', '1.0.1' );
    2123define( 'BITSAAI_CHATBOT_OPTION', 'bitsaai_chatbot_settings' );
     24define( 'BITSAAI_CHATBOT_HANDLE', 'bitsaai-chatbot' );
     25define( 'BITSAAI_CHATBOT_PAGE', 'bitsaai-chatbot' );
    2226define( 'BITSAAI_CHATBOT_SNIPPET_URL', 'https://www.bitsaai.com/embed-snippet.js' );
     27define( 'BITSAAI_CHATBOT_SIGNUP_URL', 'https://www.bitsaai.com/signup' );
    2328define( 'BITSAAI_CHATBOT_DASHBOARD_URL', 'https://www.bitsaai.com/login' );
    2429define( 'BITSAAI_CHATBOT_DOMAINS_URL', 'https://www.bitsaai.com/client/domains' );
     30define( 'BITSAAI_CHATBOT_PRIVACY_URL', 'https://www.bitsaai.com/privacy/' );
    2531
    2632/**
    … …  
    3137 */
    3238function bitsaai_chatbot_site_domain() {
    33         $host = wp_parse_url( home_url(), PHP_URL_HOST );
    34         $host = strtolower( (string) $host );
     39        $host = strtolower( (string) wp_parse_url( home_url(), PHP_URL_HOST ) );
    3540        if ( 0 === strpos( $host, 'www.' ) ) {
    3641                $host = substr( $host, 4 );
    … …  
    4045
    4146/**
    42  * Saved settings merged with defaults.
     47 * Saved settings merged with defaults and cast to their expected types, so a
     48 * hand-edited or corrupted option can never reach the page as something else.
    4349 *
    4450 * @return array{client_id: string, enabled: bool}
    … …  
    4652function bitsaai_chatbot_get_settings() {
    4753        $saved = get_option( BITSAAI_CHATBOT_OPTION, array() );
    48         return wp_parse_args(
    49                 is_array( $saved ) ? $saved : array(),
    50                 array(
    51                         'client_id' => '',
    52                         'enabled'   => true,
    53                 )
     54        $saved = is_array( $saved ) ? $saved : array();
     55
     56        return array(
     57                'client_id' => isset( $saved['client_id'] ) ? bitsaai_chatbot_extract_client_id( $saved['client_id'] ) : '',
     58                'enabled'   => isset( $saved['enabled'] ) ? (bool) $saved['enabled'] : true,
    5459        );
    5560}
    … …  
    5964 * embed code copied from the Bitsa AI dashboard.
    6065 *
    61  * @param string $raw Pasted value.
     66 * @param mixed $raw Pasted value.
    6267 * @return string 24-character Client ID, or '' if none found.
    6368 */
    6469function bitsaai_chatbot_extract_client_id( $raw ) {
     70        if ( ! is_scalar( $raw ) ) {
     71                return '';
     72        }
    6573        if ( preg_match( '/\b([a-f0-9]{24})\b/i', (string) $raw, $m ) ) {
    6674                return strtolower( $m[1] );
    … …  
    6977}
    7078
    71 /* -------------------------------------------------------------------------
     79/**
     80 * HTML allowed in translatable admin strings that embed a link.
     81 *
     82 * @return array
     83 */
     84function bitsaai_chatbot_allowed_html() {
     85        return array(
     86                'a'      => array(
     87                        'href'   => true,
     88                        'target' => true,
     89                        'rel'    => true,
     90                ),
     91                'strong' => array(),
     92        );
     93}
     94
     95/**
     96 * Markup for a link that opens the Bitsa AI dashboard in a new tab.
     97 *
     98 * @param string $url  Destination.
     99 * @param string $text Link text (unescaped).
     100 * @return string
     101 */
     102function bitsaai_chatbot_external_link( $url, $text ) {
     103        return '<a href="' . esc_url( $url ) . '" target="_blank" rel="noopener noreferrer">' . esc_html( $text ) . '</a>';
     104}
     105
     106/*
    72107 * Front end: load the widget.
    73  * ---------------------------------------------------------------------- */
     108 */
    74109
    75110/**
    … …  
    78113function bitsaai_chatbot_enqueue() {
    79114        $settings = bitsaai_chatbot_get_settings();
    80         if ( empty( $settings['enabled'] ) || '' === $settings['client_id'] ) {
    81                 return;
    82         }
    83         wp_enqueue_script( 'bitsaai-chatbot', BITSAAI_CHATBOT_SNIPPET_URL, array(), BITSAAI_CHATBOT_VERSION, true );
     115        if ( ! $settings['enabled'] || '' === $settings['client_id'] ) {
     116                return;
     117        }
     118
     119        /**
     120         * Filters whether the chatbot loads on the current request. Return false to
     121         * hide it on specific pages, e.g. checkout or a landing page.
     122         *
     123         * @param bool $load Whether to load the widget. Default true.
     124         */
     125        if ( ! apply_filters( 'bitsaai_chatbot_load_widget', true ) ) {
     126                return;
     127        }
     128
     129        // The snippet URL is unversioned on our side, so no ?ver= is appended. The
     130        // array form gives native async on WP 6.3+; older versions read it as
     131        // in_footer = true and the async attribute is added in the tag filter below.
     132        wp_enqueue_script(
     133                BITSAAI_CHATBOT_HANDLE,
     134                BITSAAI_CHATBOT_SNIPPET_URL,
     135                array(),
     136                null, // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.MissingVersion -- remote file, versioned by the service.
     137                array(
     138                        'in_footer' => true,
     139                        'strategy'  => 'async',
     140                )
     141        );
    84142}
    85143add_action( 'wp_enqueue_scripts', 'bitsaai_chatbot_enqueue' );
    86144
    87145/**
    88  * Add the async flag and the data attributes the loader reads to our script tag only.
     146 * Add the data attributes the loader reads to our script tag only.
    89147 *
    90148 * @param string $tag    Script tag HTML.
    … …  
    93151 */
    94152function bitsaai_chatbot_script_tag( $tag, $handle ) {
    95         if ( 'bitsaai-chatbot' !== $handle ) {
     153        if ( BITSAAI_CHATBOT_HANDLE !== $handle ) {
    96154                return $tag;
    97155        }
    98         $settings = bitsaai_chatbot_get_settings();
    99         $attrs    = sprintf(
    100                 ' data-client-id="%s" data-mode="ai" async',
    101                 esc_attr( $settings['client_id'] )
    102         );
    103         return str_replace( ' src=', $attrs . ' src=', $tag );
     156        $client_id = bitsaai_chatbot_get_settings()['client_id'];
     157        if ( '' === $client_id ) {
     158                return $tag;
     159        }
     160        $script_id = BITSAAI_CHATBOT_HANDLE . '-js';
     161
     162        // WP 6.2+: edit the tag with the HTML API instead of string surgery, so
     163        // before/after inline scripts and attribute quoting styles don't matter.
     164        if ( class_exists( 'WP_HTML_Tag_Processor' ) ) {
     165                $processor = new WP_HTML_Tag_Processor( $tag );
     166                while ( $processor->next_tag( 'script' ) ) {
     167                        if ( $script_id !== $processor->get_attribute( 'id' ) ) {
     168                                continue;
     169                        }
     170                        $processor->set_attribute( 'data-client-id', $client_id );
     171                        $processor->set_attribute( 'data-mode', 'ai' );
     172                        // Keep Cloudflare Rocket Loader from rewriting the tag: the loader needs
     173                        // document.currentScript to read its data attributes.
     174                        $processor->set_attribute( 'data-cfasync', 'false' );
     175                        $processor->set_attribute( 'async', true );
     176                        return $processor->get_updated_html();
     177                }
     178                return $tag;
     179        }
     180
     181        $attrs = sprintf(
     182                ' data-client-id="%s" data-mode="ai" data-cfasync="false"%s',
     183                esc_attr( $client_id ),
     184                preg_match( '/\sasync\b/i', $tag ) ? '' : ' async'
     185        );
     186        return (string) preg_replace(
     187                '/<script\b(?=[^>]*\bid=["\']' . preg_quote( $script_id, '/' ) . '["\'])/i',
     188                '<script' . $attrs,
     189                $tag,
     190                1
     191        );
    104192}
    105193add_filter( 'script_loader_tag', 'bitsaai_chatbot_script_tag', 10, 2 );
    106194
    107 /* -------------------------------------------------------------------------
     195/*
    108196 * Admin: settings page.
    109  * ---------------------------------------------------------------------- */
     197 */
    110198
    111199/**
    … …  
    119207                        'type'              => 'array',
    120208                        'sanitize_callback' => 'bitsaai_chatbot_sanitize_settings',
     209                        'show_in_rest'      => false,
    121210                        'default'           => array(
    122211                                'client_id' => '',
    … …  
    126215        );
    127216
    128         add_settings_section( 'bitsaai_chatbot_main', '', '__return_false', 'bitsaai-chatbot' );
     217        add_settings_section( 'bitsaai_chatbot_main', '', '__return_false', BITSAAI_CHATBOT_PAGE );
    129218
    130219        add_settings_field(
    … …  
    132221                __( 'Client ID', 'bitsa-ai-chatbot' ),
    133222                'bitsaai_chatbot_field_client_id',
    134                 'bitsaai-chatbot',
     223                BITSAAI_CHATBOT_PAGE,
    135224                'bitsaai_chatbot_main',
    136225                array( 'label_for' => 'bitsaai_chatbot_client_id' )
    … …  
    141230                __( 'Show chatbot', 'bitsa-ai-chatbot' ),
    142231                'bitsaai_chatbot_field_enabled',
    143                 'bitsaai-chatbot',
     232                BITSAAI_CHATBOT_PAGE,
    144233                'bitsaai_chatbot_main'
    145234        );
    … …  
    156245        $input     = is_array( $input ) ? $input : array();
    157246        $raw_id    = isset( $input['client_id'] ) ? wp_unslash( $input['client_id'] ) : '';
     247        $raw_id    = is_scalar( $raw_id ) ? trim( (string) $raw_id ) : null; // null: malformed request.
    158248        $client_id = bitsaai_chatbot_extract_client_id( $raw_id );
    159249
    160         if ( '' !== trim( (string) $raw_id ) && '' === $client_id ) {
     250        if ( '' !== $raw_id && '' === $client_id ) {
    161251                add_settings_error(
    162252                        BITSAAI_CHATBOT_OPTION,
    … …  
    164254                        __( 'That does not look like a Bitsa AI Client ID. Copy it from Branding → Embed code in your Bitsa AI dashboard.', 'bitsa-ai-chatbot' )
    165255                );
     256                // Keep the last good ID rather than wiping a working setup.
    166257                $client_id = bitsaai_chatbot_get_settings()['client_id'];
    167258        }
    … …  
    179270        $settings = bitsaai_chatbot_get_settings();
    180271        printf(
    181                 '<input type="text" id="bitsaai_chatbot_client_id" name="%1$s[client_id]" value="%2$s" class="regular-text code" placeholder="e.g. 64f1c2a9b3e4d5f6a7b8c9d0" autocomplete="off" />',
     272                '<input type="text" id="bitsaai_chatbot_client_id" name="%1$s[client_id]" value="%2$s" class="regular-text code" placeholder="%3$s" autocomplete="off" spellcheck="false" />',
    182273                esc_attr( BITSAAI_CHATBOT_OPTION ),
    183                 esc_attr( $settings['client_id'] )
     274                esc_attr( $settings['client_id'] ),
     275                esc_attr__( 'e.g. 64f1c2a9b3e4d5f6a7b8c9d0', 'bitsa-ai-chatbot' )
    184276        );
    185277        echo '<p class="description">';
    186         printf(
    187                 /* translators: %s: link to the Bitsa AI dashboard */
    188                 esc_html__( 'Find it in your %s under Branding → Embed code. You can paste the whole embed code here; the ID is picked out automatically.', 'bitsa-ai-chatbot' ),
    189                 '<a href="' . esc_url( BITSAAI_CHATBOT_DASHBOARD_URL ) . '" target="_blank" rel="noopener noreferrer">' . esc_html__( 'Bitsa AI dashboard', 'bitsa-ai-chatbot' ) . '</a>'
     278        echo wp_kses(
     279                sprintf(
     280                        /* translators: %s: link to the Bitsa AI dashboard */
     281                        esc_html__( 'Find it in your %s under Branding → Embed code. You can paste the whole embed code here; the ID is picked out automatically.', 'bitsa-ai-chatbot' ),
     282                        bitsaai_chatbot_external_link( BITSAAI_CHATBOT_DASHBOARD_URL, __( 'Bitsa AI dashboard', 'bitsa-ai-chatbot' ) )
     283                ),
     284                bitsaai_chatbot_allowed_html()
    190285        );
    191286        echo '</p>';
    … …  
    200295                '<label><input type="checkbox" name="%1$s[enabled]" value="1" %2$s /> %3$s</label>',
    201296                esc_attr( BITSAAI_CHATBOT_OPTION ),
    202                 checked( ! empty( $settings['enabled'] ), true, false ),
     297                checked( $settings['enabled'], true, false ),
    203298                esc_html__( 'Display the chatbot on the front end of this site', 'bitsa-ai-chatbot' )
    204299        );
    … …  
    213308                __( 'Bitsa AI Chatbot', 'bitsa-ai-chatbot' ),
    214309                'manage_options',
    215                 'bitsaai-chatbot',
     310                BITSAAI_CHATBOT_PAGE,
    216311                'bitsaai_chatbot_render_settings_page',
    217312                'dashicons-format-chat',
    … …  
    220315}
    221316add_action( 'admin_menu', 'bitsaai_chatbot_admin_menu' );
     317
     318/**
     319 * One-line connection status for the top of the settings page.
     320 */
     321function bitsaai_chatbot_render_status() {
     322        $settings = bitsaai_chatbot_get_settings();
     323        if ( '' === $settings['client_id'] ) {
     324                $class = 'notice-warning';
     325                $text  = __( 'Not connected yet. Complete the two steps below.', 'bitsa-ai-chatbot' );
     326        } elseif ( ! $settings['enabled'] ) {
     327                $class = 'notice-info';
     328                $text  = __( 'Connected, but the chatbot is switched off. Tick "Show chatbot" below to display it.', 'bitsa-ai-chatbot' );
     329        } else {
     330                $class = 'notice-success';
     331                $text  = __( 'Connected. The chatbot loads on your site as long as this domain is on your Bitsa AI whitelist.', 'bitsa-ai-chatbot' );
     332        }
     333        printf(
     334                '<div class="notice inline %1$s"><p><strong>%2$s</strong> %3$s</p></div>',
     335                esc_attr( $class ),
     336                esc_html__( 'Status:', 'bitsa-ai-chatbot' ),
     337                esc_html( $text )
     338        );
     339}
    222340
    223341/**
    … …  
    236354                settings_errors( BITSAAI_CHATBOT_OPTION );
    237355                settings_errors( 'general' );
     356                bitsaai_chatbot_render_status();
    238357                ?>
    239358                <p>
    … …  
    242361                <p>
    243362                        <?php
    244                         printf(
    245                                 /* translators: %s: link to sign up for Bitsa AI */
    246                                 esc_html__( 'No account yet? %s (7-day free trial, no card required).', 'bitsa-ai-chatbot' ),
    247                                 '<a href="' . esc_url( 'https://www.bitsaai.com/signup' ) . '" target="_blank" rel="noopener noreferrer">' . esc_html__( 'Create one at bitsaai.com', 'bitsa-ai-chatbot' ) . '</a>'
     363                        echo wp_kses(
     364                                sprintf(
     365                                        /* translators: %s: link to sign up for Bitsa AI */
     366                                        esc_html__( 'No account yet? %s (7-day free trial, no card required).', 'bitsa-ai-chatbot' ),
     367                                        bitsaai_chatbot_external_link( BITSAAI_CHATBOT_SIGNUP_URL, __( 'Create one at bitsaai.com', 'bitsa-ai-chatbot' ) )
     368                                ),
     369                                bitsaai_chatbot_allowed_html()
    248370                        );
    249371                        ?>
    … …  
    261383                        <li>
    262384                                <?php
    263                                 printf(
    264                                         /* translators: %s: link to the Domain Access page of the Bitsa AI dashboard */
    265                                         esc_html__( 'Log in to your Bitsa AI dashboard and open %s from the left menu.', 'bitsa-ai-chatbot' ),
    266                                         '<a href="' . esc_url( BITSAAI_CHATBOT_DOMAINS_URL ) . '" target="_blank" rel="noopener noreferrer"><strong>' . esc_html__( 'Domain Access', 'bitsa-ai-chatbot' ) . '</strong></a>'
     385                                echo wp_kses(
     386                                        sprintf(
     387                                                /* translators: %s: link to the Domain Access page of the Bitsa AI dashboard */
     388                                                esc_html__( 'Log in to your Bitsa AI dashboard and open %s from the left menu.', 'bitsa-ai-chatbot' ),
     389                                                '<strong>' . bitsaai_chatbot_external_link( BITSAAI_CHATBOT_DOMAINS_URL, __( 'Domain Access', 'bitsa-ai-chatbot' ) ) . '</strong>'
     390                                        ),
     391                                        bitsaai_chatbot_allowed_html()
    267392                                );
    268393                                ?>
    … …  
    272397                </ol>
    273398                <p class="description">
    274                         <?php esc_html_e( 'Tips: enter only the domain, e.g. example.com (no https:// or www.). Adding example.com also covers www.example.com and every subdomain such as shop.example.com. A staging or local site with a different domain (e.g. mysite.local) needs its own entry.', 'bitsa-ai-chatbot' ); ?>
     399                        <?php esc_html_e( 'Tips: enter only the domain, e.g. example.com (no https:// or www.). Adding example.com also covers www.example.com and every subdomain such as shop.example.com. A staging or local site with a different domain (e.g. mysite.local) needs its own entry. If you use a page-cache or optimisation plugin, clear its cache after saving.', 'bitsa-ai-chatbot' ); ?>
    275400                </p>
    276401
    … …  
    279404                        <?php
    280405                        settings_fields( 'bitsaai_chatbot' );
    281                         do_settings_sections( 'bitsaai-chatbot' );
     406                        do_settings_sections( BITSAAI_CHATBOT_PAGE );
    282407                        submit_button();
    283408                        ?>
    … …  
    294419 */
    295420function bitsaai_chatbot_action_links( $links ) {
    296         $url = admin_url( 'admin.php?page=bitsaai-chatbot' );
     421        $url = admin_url( 'admin.php?page=' . BITSAAI_CHATBOT_PAGE );
    297422        array_unshift( $links, '<a href="' . esc_url( $url ) . '">' . esc_html__( 'Settings', 'bitsa-ai-chatbot' ) . '</a>' );
    298423        return $links;
    … …  
    301426
    302427/**
    303  * Remind admins to finish setup until a Client ID is saved.
     428 * Remind admins to finish setup until a Client ID is saved. Shown only on the
     429 * Dashboard and Plugins screens, and dismissible, so it never nags elsewhere.
    304430 */
    305431function bitsaai_chatbot_setup_notice() {
    … …  
    308434        }
    309435        $screen = get_current_screen();
    310         if ( $screen && 'toplevel_page_bitsaai-chatbot' === $screen->id ) {
     436        if ( ! $screen || ! in_array( $screen->id, array( 'dashboard', 'plugins' ), true ) ) {
    311437                return;
    312438        }
    … …  
    314440                return;
    315441        }
    316         $url = admin_url( 'admin.php?page=bitsaai-chatbot' );
    317442        printf(
    318                 '<div class="notice notice-info"><p>%1$s <a href="%2$s">%3$s</a></p></div>',
     443                '<div class="notice notice-info is-dismissible"><p>%1$s <a href="%2$s">%3$s</a></p></div>',
    319444                esc_html__( 'Bitsa AI Chatbot is almost ready.', 'bitsa-ai-chatbot' ),
    320                 esc_url( $url ),
     445                esc_url( admin_url( 'admin.php?page=' . BITSAAI_CHATBOT_PAGE ) ),
    321446                esc_html__( 'Add your Client ID to switch it on.', 'bitsa-ai-chatbot' )
    322447        );
    323448}
    324449add_action( 'admin_notices', 'bitsaai_chatbot_setup_notice' );
     450
     451/**
     452 * Suggest text for the site's privacy policy (Settings → Privacy → Policy Guide).
     453 */
     454function bitsaai_chatbot_privacy_policy_content() {
     455        if ( ! function_exists( 'wp_add_privacy_policy_content' ) ) {
     456                return;
     457        }
     458        $content = '<p>' . esc_html__( 'This site uses the Bitsa AI chatbot. When a visitor opens the chat, their messages, any contact details they choose to share (such as name, email address or phone number), the website domain, and standard technical data (IP address, browser user agent) are sent to Bitsa AI to generate replies and record enquiries for the site owner.', 'bitsa-ai-chatbot' ) . '</p>'
     459                . '<p>' . wp_kses(
     460                        sprintf(
     461                                /* translators: %s: link to the Bitsa AI privacy policy */
     462                                esc_html__( 'See the %s for how this data is handled.', 'bitsa-ai-chatbot' ),
     463                                bitsaai_chatbot_external_link( BITSAAI_CHATBOT_PRIVACY_URL, __( 'Bitsa AI privacy policy', 'bitsa-ai-chatbot' ) )
     464                        ),
     465                        bitsaai_chatbot_allowed_html()
     466                ) . '</p>';
     467
     468        wp_add_privacy_policy_content( __( 'Bitsa AI Chatbot', 'bitsa-ai-chatbot' ), wp_kses_post( $content ) );
     469}
     470add_action( 'admin_init', 'bitsaai_chatbot_privacy_policy_content' );
  • bitsa-ai-chatbot/trunk/readme.txt

    r3750149 r3750286  
    1 === Bitsa AI Chatbot – 24/7 AI Sales Assistant, Live Chat & Smart Lead Generation ===
     1=== Bitsa AI Chatbot ===
    22Contributors: sabitali
    3 Donate link: https://www.bitsaai.com/
    43Tags: chatbot, ai chatbot, customer support, live chat, lead generation
    54Requires at least: 5.0
    65Tested up to: 7.1
    76Requires PHP: 7.4
    8 Stable tag: 1.0.0
     7Stable tag: 1.0.1
    98License: GPLv2 or later
    109License URI: https://www.gnu.org/licenses/gpl-2.0.html
    1110
    12 Autonomous 24/7 AI chatbot trained on your website content. Answers visitor queries instantly, captures qualified leads, and drives sales.
     1124/7 AI chatbot and live chat trained on your website content. Answers visitor questions instantly and captures qualified leads.
    1312
    1413== Description ==
    1514
    16 **Bitsa AI Chatbot** is a next-generation conversational AI assistant designed to turn casual website visitors into loyal customers. Powered by custom large language models, Bitsa AI learns your business inside and out—answering support queries in real time, capturing high-intent leads, and guiding shoppers toward purchasing decisions around the clock.
     15**Bitsa AI Chatbot** is a conversational AI assistant that helps turn website visitors into customers. Bitsa AI learns your business from the content you give it, answers support questions in real time, captures high-intent leads, and guides shoppers toward a purchase around the clock.
    1716
    18 Unlike traditional static rule-based bots that frustrate visitors with rigid menus, Bitsa AI understands natural human intent, context, and nuance. It answers queries directly from your approved knowledge base (website pages, FAQs, documentation, and product catalogs) with zero hallucinations.
     17Unlike rule-based bots with rigid menus, Bitsa AI understands natural language, context and intent. It answers from your own approved knowledge base (website pages, FAQs, documentation and product catalogues) instead of generic internet content.
    1918
    20 ---
     19= Key features =
    2120
    22 ### 🚀 Key Features
     21* **Fast knowledge base setup:** Train your AI in minutes from your website URLs, sitemaps, PDFs, text documents or FAQs inside your Bitsa AI dashboard.
     22* **Lead capture and qualification:** Collect visitor names, phone numbers, email addresses and requirements inside the conversation, then hand warm leads to your sales team.
     23* **WooCommerce aware:** Helps shoppers discover products, check details and add items to their cart through the official WooCommerce Store API.
     24* **Multilingual, including Hinglish:** Understands and replies in 50+ languages, including English, Hindi and Hinglish.
     25* **Lightweight and non-blocking:** A single small loader (about 16 KB gzipped) loads asynchronously in the footer, and the chat window itself loads only after the page has finished loading or when a visitor reaches for the chat. It does not block page rendering.
     26* **Brand customisation:** Change the theme, launcher icon, welcome greeting and bubble position from your Bitsa AI dashboard without touching code.
     27* **Domain whitelisting:** Your chatbot only runs on domains you explicitly authorise, so nobody else can use your AI quota.
    2328
    24 * **Instant Knowledge Base Ingestion:** Train your AI in minutes by connecting your website URLs, sitemaps, PDFs, text documents, or FAQs inside your Bitsa AI dashboard.
    25 * **Autonomous Lead Capture & Qualification:** Collect visitor names, phone numbers, email addresses, and specific requirements right inside the conversation before handing warm leads to your sales team.
    26 * **Seamless WooCommerce Intelligence:** WooCommerce-aware chatbot that helps shoppers discover products, checks stock/details, and allows visitors to add products directly to their cart via the official WooCommerce Store API.
    27 * **True Multilingual & Hinglish Support:** Understands and replies naturally in over 50+ languages, including fluent English, Hindi, and natural Hinglish.
    28 * **Asynchronous & Ultra-Lightweight:** Loads non-blockingly in your website footer (<15 KB footprint). Guaranteed zero impact on your Core Web Vitals, PageSpeed Insights, or SEO scores.
    29 * **Full Brand Customization:** Tailor the chatbot theme, launcher icons, welcome greetings, and chat bubble position directly from your cloud dashboard without touching a single line of code.
    30 * **Multi-Domain Whitelisting & Security:** Strict origin verification ensures your chatbot only runs on domains you explicitly authorize.
     29= Built for e-commerce and service businesses =
    3130
    32 ---
     31Whether you run a WooCommerce store, a digital agency, a healthcare practice or a real estate consultancy, Bitsa AI acts as a 24/7 front desk. It handles repetitive customer questions automatically and routes high-value prospects straight into your pipeline.
    3332
    34 ### 🛒 Built for E-Commerce & Service Businesses
     33= How it works =
    3534
    36 Whether you run a high-volume WooCommerce store, a digital agency, a healthcare practice, or a real estate consultancy, Bitsa AI acts as your dedicated 24/7 front-desk executive. It resolves up to 80% of repetitive customer support inquiries automatically and routes high-value sales prospects straight into your pipeline.
     35This plugin is a lightweight connector between your WordPress site and your Bitsa AI dashboard. AI responses, knowledge base training and lead management run on Bitsa AI's cloud service.
    3736
    38 ---
     37A Bitsa AI account is required. Every new account includes a **7-day free trial** (no credit card required). Paid plans start at ₹299/month. See [Bitsa AI Pricing](https://www.bitsaai.com/chatbot-pricing-india/).
    3938
    40 ### ⚙️ How It Works
     39= For developers =
    4140
    42 This plugin serves as a secure, lightweight connector between your WordPress site and your Bitsa AI cloud dashboard. The AI inference, knowledge base training, and lead management are handled on Bitsa AI's optimized cloud infrastructure.
     41Hide the chatbot on specific pages with the `bitsaai_chatbot_load_widget` filter:
    4342
    44 A Bitsa AI account is required. Every new account includes an unrestricted **7-day free trial** (no credit card required). Affordable paid plans start at just ₹299/month. Explore plans at [Bitsa AI Pricing](https://www.bitsaai.com/chatbot-pricing-india/).
    45 
    46 ---
     43`add_filter( 'bitsaai_chatbot_load_widget', function ( $load ) { return is_checkout() ? false : $load; } );`
    4744
    4845== External services ==
    4946
    50 This plugin securely connects your WordPress website to the Bitsa AI cloud service to deliver conversational AI and live chat capabilities. No external scripts or styles are loaded until you input and save your authorized Client ID in the plugin settings.
     47This plugin connects your website to the Bitsa AI cloud service to provide the chatbot. Nothing is loaded from Bitsa AI until you save a Client ID in the plugin settings, and nothing is loaded while the "Show chatbot" option is switched off.
    5148
    52 1. **Bitsa AI Embed Widget (`www.bitsaai.com`)**
    53    * **Purpose:** Delivers the chat launcher interface and real-time messaging UI to front-end visitors.
     491. **Bitsa AI embed widget (`www.bitsaai.com`)**
     50   * **Purpose:** Delivers the chat launcher and chat window to visitors on the front end of your site.
     51   * **When:** On every front-end page view once a Client ID is saved and the chatbot is switched on.
    5452   * **Script URL:** `https://www.bitsaai.com/embed-snippet.js`
    55    * **Chat Frame URL:** `https://www.bitsaai.com/embed/`
    56    * **Data Transmitted:** Your account Client ID, browser technical metadata (standard IP address and user-agent string for session persistence), and visitor chat messages (including name, email, or contact number if voluntarily provided).
     53   * **Chat window URL:** `https://www.bitsaai.com/embed/`
     54   * **Data sent:** Your Client ID, your website's domain (to check it against your whitelist), and standard request data any web request carries (visitor IP address and browser user agent).
    5755
    58 2. **Bitsa AI Inference & Orchestration API (`production-backend-w1e8.onrender.com`)**
    59    * **Purpose:** Processes incoming user queries against your trained knowledge base, generates conversational responses, and logs captured leads in your dashboard.
    60    * **Data Transmitted:** Client ID and chat conversational text.
     562. **Bitsa AI chat API (`production-backend-w1e8.onrender.com`)**
     57   * **Purpose:** Loads your chatbot's branding, answers visitor questions from your knowledge base, and records captured leads in your dashboard.
     58   * **When:** When the widget loads and whenever a visitor uses the chat.
     59   * **Data sent:** Your Client ID, your website's domain, the visitor's chat messages, and any contact details the visitor chooses to share (such as name, email address or phone number), plus the visitor's IP address and browser user agent.
    6160
    62 3. **Local WooCommerce Store API**
    63    * For WooCommerce stores, cart operations requested by visitors are executed directly against your own website's native REST API (`/wp-json/wc/store/v1/`). Customer purchase data remains strictly within your WordPress installation.
     613. **Your own WooCommerce Store API**
     62   * On WooCommerce stores, cart actions a visitor asks for are sent to your own site's REST API (`/wp-json/wc/store/v1/`), not to Bitsa AI.
    6463
    65 * **Privacy Policy:** [https://www.bitsaai.com/privacy/](https://www.bitsaai.com/privacy/)
    66 * **Terms of Service:** [https://www.bitsaai.com/terms/](https://www.bitsaai.com/terms/)
     64Bitsa AI [Privacy Policy](https://www.bitsaai.com/privacy/) and [Terms of Service](https://www.bitsaai.com/terms/).
    6765
    68 ---
     66The plugin also adds suggested text to your site's privacy policy guide (Settings → Privacy → Policy Guide).
    6967
    7068== Installation ==
    7169
    72 Setting up Bitsa AI Chatbot requires zero coding knowledge and takes less than 2 minutes:
     701. In your WordPress admin, go to **Plugins → Add New**.
     712. Search for `Bitsa AI Chatbot`, click **Install Now**, then **Activate**.
     723. Create a free account or log in at [bitsaai.com](https://www.bitsaai.com/signup).
     734. In the Bitsa AI dashboard, open **Knowledge Base** and train your AI on your website content or documents.
     745. Under **Domain Access**, add your website's domain (e.g. `example.com`, without `https://`).
     756. Open **Branding → Embed code** and copy your **Client ID**.
     767. In WordPress, click **Bitsa AI Chatbot** in the left menu, paste your Client ID and click **Save Changes**.
    7377
    74 1. In your WordPress Admin, navigate to **Plugins → Add New**.
    75 2. Search for `Bitsa AI Chatbot`, click **Install Now**, and then **Activate**.
    76 3. Create your free account or log in at [Bitsa AI Dashboard](https://www.bitsaai.com/signup).
    77 4. In the Bitsa AI dashboard, go to **Knowledge Base** to train your AI on your website content or documents.
    78 5. Under **Domain Access**, add your website's domain name (e.g., `example.com` without `https://`).
    79 6. Navigate to **Branding → Embed code** and copy your unique **Client ID**.
    80 7. In your WordPress admin, click on **Bitsa AI Chatbot** in the left menu, paste your Client ID, and click **Save Changes**.
    81 
    82 Your intelligent assistant is now live on your site!
    83 
    84 ---
     78Your assistant is now live on your site.
    8579
    8680== Frequently Asked Questions ==
    8781
    88 = Do I need an account with Bitsa AI to use this plugin? =
    89 Yes. The plugin connects your WordPress frontend to your custom-trained Bitsa AI brain. You can sign up at [bitsaai.com](https://www.bitsaai.com/) in 30 seconds for a full 7-day free trial without entering payment details.
     82= Do I need a Bitsa AI account to use this plugin? =
     83
     84Yes. The plugin connects your site to your Bitsa AI chatbot. You can sign up at [bitsaai.com](https://www.bitsaai.com/) for a 7-day free trial without entering payment details.
    9085
    9186= Where do I find my Client ID? =
    92 Log in to your Bitsa AI dashboard, go to **Branding → Embed code**, and copy the Client ID. You can also paste the entire `<script>` embed snippet into the plugin settings; the plugin will automatically extract your Client ID.
     87
     88Log in to your Bitsa AI dashboard, go to **Branding → Embed code** and copy the Client ID. You can also paste the entire `<script>` embed code into the plugin settings; the plugin picks out the Client ID automatically.
    9389
    9490= I saved my Client ID, but the chat bubble does not appear. Why? =
    95 For enterprise security, Bitsa AI enforces strict domain whitelisting to prevent unauthorized third parties from using your AI quota. Open your Bitsa AI dashboard, click **Domain Access**, and add your domain (e.g., `yourwebsite.com`). Whitelisting `yourwebsite.com` automatically authorizes all subdomains including `www.yourwebsite.com`.
    9691
    97 = Can Bitsa AI understand and respond in Hindi or Hinglish? =
    98 Yes! Bitsa AI natively supports Hindi, Hinglish (Hindi written in Latin script), and over 50 global languages. It automatically detects the language your visitor uses and responds fluently in that same language.
     92Bitsa AI only shows your chatbot on domains you have whitelisted, so that nobody else can use your AI quota. Open your Bitsa AI dashboard, click **Domain Access** and add your domain (e.g. `yourwebsite.com`). Whitelisting `yourwebsite.com` also covers `www.yourwebsite.com` and every subdomain. If you use a caching or optimisation plugin, clear its cache afterwards.
     93
     94= Can Bitsa AI respond in Hindi or Hinglish? =
     95
     96Yes. Bitsa AI supports Hindi, Hinglish (Hindi written in Latin script) and 50+ other languages. It detects the language your visitor uses and replies in the same language.
    9997
    10098= Can the chatbot help customers on my WooCommerce store? =
    101 Absolutely. When active on a WooCommerce store, Bitsa AI can answer product queries, help shoppers find relevant items, and assist with adding items directly to their shopping cart via native WooCommerce endpoints.
    10299
    103 = Will Bitsa AI slow down my website loading time? =
    104 No. The Bitsa AI script loads 100% asynchronously at the bottom of the page footer. It never blocks DOM construction, CSS parsing, or page rendering.
     100Yes. On a WooCommerce store, Bitsa AI can answer product questions, help shoppers find items and add products to their cart through WooCommerce's own Store API.
    105101
    106 = How do I customize the chatbot appearance (colors, avatar, greeting)? =
    107 All visual branding is managed centrally inside your Bitsa AI cloud dashboard. Any updates you make to colors, launcher position, welcome messages, or bot avatar reflect instantly on your WordPress site without requiring plugin updates.
     102= Will Bitsa AI slow down my website? =
    108103
    109 = Can I temporarily disable the chatbot on my site? =
    110 Yes. You can uncheck the "Show chatbot" checkbox on the Bitsa AI Chatbot settings page and click Save Changes, or simply deactivate the plugin.
     104The loader script is small and loads asynchronously in the footer, so it does not block page rendering, and the chat window loads only after the page has finished loading. As with any third-party widget, we recommend checking your own pages with PageSpeed Insights after installing.
    111105
    112 ---
     106= How do I customise the chatbot's appearance (colours, avatar, greeting)? =
     107
     108All branding is managed in your Bitsa AI dashboard. Changes to colours, launcher position, welcome message or avatar appear on your WordPress site automatically, with no plugin update needed.
     109
     110= Can I temporarily disable the chatbot? =
     111
     112Yes. Untick **Show chatbot** on the Bitsa AI Chatbot settings page and click **Save Changes**, or deactivate the plugin.
     113
     114= Can I hide the chatbot on certain pages? =
     115
     116Yes. Use the `bitsaai_chatbot_load_widget` filter shown in the "For developers" section above.
     117
     118= What happens to my settings when I delete the plugin? =
     119
     120Deleting the plugin from the Plugins screen removes its saved settings, including on every site of a multisite network.
    113121
    114122== Screenshots ==
    115123
    116 1. The intelligent Bitsa AI assistant interacting with a visitor in real-time.
    117 2. Clean, single-click WordPress settings panel for instant Client ID activation.
    118 
    119 ---
     1241. The Bitsa AI chatbot answering a visitor's question on a WordPress site.
     1252. The plugin settings page: whitelist your domain, paste your Client ID and you are connected.
    120126
    121127== Changelog ==
    122128
     129= 1.0.1 =
     130* Improved: The widget now uses WordPress's native async script loading (WordPress 6.3+) and no longer adds an unused version query string to the script URL.
     131* Improved: Script attributes are added with the WordPress HTML API, which is more robust with optimisation plugins. Added compatibility with Cloudflare Rocket Loader.
     132* Improved: The setup reminder now appears only on the Dashboard and Plugins screens and can be dismissed.
     133* Improved: Settings page shows the connection status.
     134* New: `bitsaai_chatbot_load_widget` filter to hide the chatbot on specific pages.
     135* New: Suggested privacy policy text under Settings → Privacy.
     136* Fixed: Settings are now removed from every site when the plugin is deleted on a multisite network.
     137* Hardening: Stricter validation of saved settings and stricter escaping of admin links.
     138
    123139= 1.0.0 =
    124 * Initial official release on the WordPress Plugin Directory.
    125 * Added seamless Client ID integration.
    126 * Added native WooCommerce Store API cart support.
    127 * Added asynchronous non-blocking script loader.
     140* Initial release on the WordPress Plugin Directory.
     141* Connect your site with a Client ID (or by pasting the whole embed code).
     142* Asynchronous, non-blocking widget loader.
     143
     144== Upgrade Notice ==
     145
     146= 1.0.1 =
     147Faster native async loading, a dismissible setup reminder, a new filter to hide the chatbot on specific pages, and multisite cleanup on delete.
  • bitsa-ai-chatbot/trunk/uninstall.php

    r3750113 r3750286  
    1010}
    1111
    12 delete_option( 'bitsaai_chatbot_settings' );
     12if ( is_multisite() && function_exists( 'get_sites' ) ) {
     13        // A network-activated plugin stores its settings on every site.
     14        $bitsaai_site_ids = get_sites(
     15                array(
     16                        'fields' => 'ids',
     17                        'number' => 0,
     18                )
     19        );
     20        foreach ( $bitsaai_site_ids as $bitsaai_site_id ) {
     21                switch_to_blog( $bitsaai_site_id );
     22                delete_option( 'bitsaai_chatbot_settings' );
     23                restore_current_blog();
     24        }
     25} else {
     26        delete_option( 'bitsaai_chatbot_settings' );
     27}
Note: See TracChangeset for help on using the changeset viewer.