Plugin Directory

Changeset 2886900


Ignore:
Timestamp:
03/25/2023 06:29:02 PM (3 years ago)
Author:
mspanwa2
Message:

Added support for Elementor and upgraded version to 2.0.0

Location:
voice-search-for-woocommerce
Files:
55 added
9 edited

Legend:

Unmodified
Added
Removed
  • voice-search-for-woocommerce/trunk/classes/plugin.php

    r2783035 r2886900  
    5252     * Plugin version.
    5353     */
    54     const VERSION = '1.0.2';
     54    const VERSION = '2.0.0';
    5555   
    5656    /**
     
    128128            add_action( 'admin_notices', function(){
    129129    ?>          <div class="notice notice-error is-dismissible">
    130                     <p> <?php echo esc_html(self::$vswc_admin_notice_logo); ?>
    131                         <br/> <?php echo esc_html(VSWC_LANGUAGE_LIBRARY['other']['nonHttpsNotice']); ?>
     130                    <p> <?php echo wp_kses_post(self::$vswc_admin_notice_logo); ?>
     131                        <br/> <?php echo wp_kses_post(VSWC_LANGUAGE_LIBRARY['other']['nonHttpsNotice']); ?>
    132132                    </p>       
    133133                </div>
     
    156156    ?>
    157157        <div class="notice notice-warning is-dismissible">
    158             <p> <?php echo esc_html(self::$vswc_admin_notice_logo); ?>
     158            <p> <?php echo wp_kses_post(self::$vswc_admin_notice_logo); ?>
    159159                <br/>
    160                 <?php echo esc_html("<b>".VSWC_LANGUAGE_LIBRARY['other']['nonChromeNotice']['warning']."</b>".VSWC_LANGUAGE_LIBRARY['other']['nonChromeNotice']['thisPlugin']); ?>
    161                 <a target="blank" href="https://speak2web.com/plugin/#plan"><?php echo esc_html(VSWC_LANGUAGE_LIBRARY['other']['nonChromeNotice']['goPro']); ?></a><?php echo esc_html(VSWC_LANGUAGE_LIBRARY['other']['nonChromeNotice']['supportMoreBrowsers']); ?>
     160                <?php echo wp_kses_post("<b>".VSWC_LANGUAGE_LIBRARY['other']['nonChromeNotice']['warning']."</b>".VSWC_LANGUAGE_LIBRARY['other']['nonChromeNotice']['thisPlugin']); ?>
     161                <a target="blank" href="https://speak2web.com/plugin/#plan"><?php echo wp_kses_post(VSWC_LANGUAGE_LIBRARY['other']['nonChromeNotice']['goPro']); ?></a><?php echo wp_kses_post(VSWC_LANGUAGE_LIBRARY['other']['nonChromeNotice']['supportMoreBrowsers']); ?>
    162162            </p>
    163163        </div>
     
    344344        }
    345345
    346         wp_localize_script( 'vswc.text-library', 'vswcSelectedLanguage', self::$vswc_selected_language);
    347346        wp_localize_script( 'vswc.text-library', '_vswcSttLanguageContext', $vswc_stt_language_context);
    348347        wp_localize_script( 'vswc.text-library', '_vswcTextPhrases', VswcLanguage::$textual_phrases[self::$vswc_selected_language]);
    349348
    350         wp_localize_script( 'vswc.text-library', 'vswcImagesPath', self::$vswc_url . 'images/');
    351         wp_localize_script( 'vswc.text-library', '_vswcPath', VSWC_PLUGIN['ABS_URL']);
    352349
    353350        $count_nonce = wp_create_nonce( 'service_call_count' );
     
    362359        $protocol = sanitize_text_field((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://");
    363360        $domainName = sanitize_text_field($_SERVER['SERVER_NAME']);
    364         wp_localize_script( 'vswc.text-library', 'vswcCurrentHostName', $protocol.$domainName);
    365 
    366         wp_localize_script( 'vswc.text-library', 'vswcWorkerPath', $this->get_url(). 'js/recorderjs/vswc.audio-recorder-worker'.self::$vswc_file_type.'.js');
     361
     362        wp_add_inline_script( 'vswc.text-library', 'vswcWorkerPath ='.json_encode($this->get_url(). 'js/recorderjs/vswc.audio-recorder-worker'.self::$vswc_file_type.'.js'));
    367363
    368364        $vswc_floating_mic = get_option(Voice_Search_For_WooCommerce_Settings_Page::BASIC_CONFIG_OPTION_NAMES['floating_mic'], null);
    369365        $vswc_floating_mic = self::vswc_sanitize_variable_for_local_script($vswc_floating_mic);
    370         wp_localize_script( 'vswc.text-library', 'vswcFloatingMic', $vswc_floating_mic);
    371         wp_localize_script( 'vswc.text-library', 'vswcSelectedMicPosition', self::$vswc_floating_mic_position);
    372366
    373367        wp_localize_script( 'vswc.text-library', 'voice_search_for_woocommerce', array(
     
    384378        }
    385379
    386         wp_localize_script( 'vswc.text-library', 'vswcMicListenTimeoutDuration', $vswc_mic_listening_timeout);
    387         wp_localize_script( 'vswc.text-library', 'vswcXApiKey', self::$vswc_api_access_key);
    388380
    389381        $vswc_current_value = get_option('vswc_current_value', "0");
     
    402394        $vswc_mute_audio_phrases = get_option(Voice_Search_For_WooCommerce_Settings_Page::BASIC_CONFIG_OPTION_NAMES['mute_audio_phrases'], null);
    403395        $vswc_mute_audio_phrases = self::vswc_sanitize_variable_for_local_script($vswc_mute_audio_phrases);
    404         wp_localize_script( 'vswc.text-library', '_vswcMuteAudioPhrases', $vswc_mute_audio_phrases);
     396
     397        $vswc_single_click = get_option(Voice_Search_For_WooCommerce_Settings_Page::BASIC_CONFIG_OPTION_NAMES['single_click'], null);
     398        $vswc_single_click = self::vswc_sanitize_variable_for_local_script($vswc_single_click);
     399
     400        $vswc_elementor = get_option(Voice_Search_For_WooCommerce_Settings_Page::BASIC_CONFIG_OPTION_NAMES['elementor_mic'], null);
     401        $vswc_elementor = self::vswc_sanitize_variable_for_local_script($vswc_elementor);
     402
     403        $vswc_array = array(
     404            "vswcSelectedLanguage" => self::$vswc_selected_language,
     405            "vswcImagesPath" => self::$vswc_url . 'images/',
     406            "_vswcPath" => VSWC_PLUGIN['ABS_URL'],
     407            "vswcCurrentHostName" => $protocol.$domainName,
     408            "vswcFloatingMic" => $vswc_floating_mic,
     409            "vswcSelectedMicPosition" => self::$vswc_floating_mic_position,
     410            "vswcMicListenTimeoutDuration" => $vswc_mic_listening_timeout,
     411            "vswcXApiKey" => self::$vswc_api_access_key,
     412            "_vswcMuteAudioPhrases" => $vswc_mute_audio_phrases,
     413            "_vswcSingleClick" => $vswc_single_click,
     414            "_vswcElementor" => $vswc_elementor,
     415
     416        );
     417        wp_localize_script( 'vswc.text-library', 'vswc', $vswc_array);
    405418
    406419        //################################################################################
  • voice-search-for-woocommerce/trunk/classes/settings-page.php

    r2783021 r2886900  
    1111        'floating_mic'          => 'vswc_floating_mic',
    1212        'floating_mic_position' => 'vswc_floating_mic_position',
    13         'mute_audio_phrases'    => 'vswc_mute_audio_phrases'
     13        'mute_audio_phrases'    => 'vswc_mute_audio_phrases',
     14        'single_click'    => 'vswc_single_click',
     15        'elementor_mic'    => 'vswc_elementor'
    1416    );
    1517
     
    2123    private $vswc_all_languages         = array();
    2224    private $vswc_mute_audio_phrases    = null;
     25    private $vswc_single_click    = null;
     26    private $vswc_elementor = null;
    2327
    2428    /**
     
    343347        $this->vswc_all_languages = VswcLanguage::get_all_languages();
    344348        $this->vswc_all_languages = isset($this->vswc_all_languages) ? $this->vswc_all_languages : array('en-US' => array(VswcLanguage::NAME => 'English (United States)', VswcLanguage::LANG_CODE => 'en-US'));
    345 
     349 
    346350        // For mute audio phrases
    347351        $this->vswc_mute_audio_phrases = strip_tags(stripslashes(get_option(self::BASIC_CONFIG_OPTION_NAMES['mute_audio_phrases'], null)));
    348 ?>
     352        // For single click
     353        $this->vswc_single_click = strip_tags(stripslashes(get_option(self::BASIC_CONFIG_OPTION_NAMES['single_click'], null)));
     354        // For Elementor
     355        $this->vswc_elementor = strip_tags(stripslashes(get_option(self::BASIC_CONFIG_OPTION_NAMES['elementor_mic'], null)));
     356?>     
    349357        <div class="wrap">
    350358            <div id="vswcavigationSettingsWrapper">
     
    374382                            <table id="vswcavigationBasicConfHeaderTable">
    375383                                <tr>
    376                                     <th><h4><u><?php echo esc_html(VSWC_LANGUAGE_LIBRARY['basicConfig']['basicConfiguration']); ?></u></h4></th>
     384                                    <th><h4><u><?php echo wp_kses_post(VSWC_LANGUAGE_LIBRARY['basicConfig']['basicConfiguration']); ?></u></h4></th>
    377385                                </tr>
    378386                            </table>
     
    380388                        <div class="vswc-setting-basic-config-column-2">
    381389                            <div class="vswc-basic-config-sub-row">
    382                                 <div><?php echo esc_html(VSWC_LANGUAGE_LIBRARY['basicConfig']['selectLanguage']); ?>
     390                                <div><?php echo wp_kses_post(VSWC_LANGUAGE_LIBRARY['basicConfig']['selectLanguage']); ?>
    383391                                    <select  id="vswcLanguage" class="vswc-language" name="<?php echo esc_attr(self:: BASIC_CONFIG_OPTION_NAMES['selected_language']); ?>">
    384392                                        <?php
     
    387395                                            <option
    388396                                                <?php selected($langCode, $this->vswc_selected_language);?>
    389                                                 value=<?php echo esc_html($langCode);?>><?php echo esc_html($lang[VswcLanguage::NAME]);?>
     397                                                value=<?php echo wp_kses_post($langCode);?>><?php echo wp_kses_post($lang[VswcLanguage::NAME]);?>
    390398                                            </option>
    391399                                        <?php
     
    402410                                    <input
    403411                                    type="text"
    404                                     name="<?php echo esc_html(self::BASIC_CONFIG_OPTION_NAMES['license_key']); ?>"
     412                                    name="<?php echo wp_kses_post(self::BASIC_CONFIG_OPTION_NAMES['license_key']); ?>"
    405413                                    id="vswcavigationLicenseKey"
    406414                                    placeholder="<?php echo esc_attr(VSWC_LANGUAGE_LIBRARY['basicConfig']['copyYourLicenseKey']); ?>"
    407                                     value="<?php echo esc_html($this->vswc_license_key); ?>"/>
     415                                    value="<?php echo wp_kses_post($this->vswc_license_key); ?>"/>
    408416                                </div>
    409417                                <?php if (strlen($this->vswc_license_key) == 32)
     
    420428                                <div class="vswc-dotted-border">
    421429                                    <label for="<?php echo esc_attr(self::BASIC_CONFIG_OPTION_NAMES['floating_mic_position']); ?>">
    422                                         <b><?php echo esc_html(VSWC_LANGUAGE_LIBRARY['basicConfig']['floatingMicOptions']); ?></b>
     430                                        <b><?php echo wp_kses_post(VSWC_LANGUAGE_LIBRARY['basicConfig']['floatingMicOptions']); ?></b>
    423431                                    </label><br><br>
    424432                                    <label for="vswcFloatingMic">
     
    426434                                        id="vswcFloatingMic"
    427435                                        type='checkbox'
    428                                         name="<?php echo esc_html(self::BASIC_CONFIG_OPTION_NAMES['floating_mic']); ?>"
     436                                        name="<?php echo wp_kses_post(self::BASIC_CONFIG_OPTION_NAMES['floating_mic']); ?>"
    429437                                        value="yes" <?php checked('yes', $this->vswc_floating_mic);?>
    430                                         > <?php echo esc_html(VSWC_LANGUAGE_LIBRARY['basicConfig']['floatingMic']); ?>
     438                                        > <?php echo wp_kses_post(VSWC_LANGUAGE_LIBRARY['basicConfig']['floatingMic']); ?>
    431439                                    </label><br>
    432                                     <div><?php echo esc_html(VSWC_LANGUAGE_LIBRARY['basicConfig']['selectFloatingMicPosition']); ?> <select id="vswcFloatingMicPosition" name="<?php echo esc_attr(self:: BASIC_CONFIG_OPTION_NAMES['floating_mic_position']); ?>">
     440                                    <div><?php echo wp_kses_post(VSWC_LANGUAGE_LIBRARY['basicConfig']['selectFloatingMicPosition']); ?> <select id="vswcFloatingMicPosition" name="<?php echo esc_attr(self:: BASIC_CONFIG_OPTION_NAMES['floating_mic_position']); ?>">
    433441                                            <option value="Middle Right" <?php selected('Middle Right', $this->vswc_floating_mic_position);?>>Middle Right</option>
    434442                                            <option value="Middle Left" <?php selected('Middle Left', $this->vswc_floating_mic_position);?>>Middle Left</option>
     
    447455                                        class="vswc-autotimeout-mic"
    448456                                        type='number'
    449                                         name="<?php echo esc_html(self::BASIC_CONFIG_OPTION_NAMES['mic_listening_timeout']); ?>"
     457                                        name="<?php echo wp_kses_post(self::BASIC_CONFIG_OPTION_NAMES['mic_listening_timeout']); ?>"
    450458                                        min="8"
    451459                                        max="20"
     
    453461                                        onKeyup="vswcResetTimeoutDefaultValue(this, event)"
    454462                                        onKeydown="vswcValidateTimeoutValue(this, event)"
    455                                         value="<?php echo esc_html($this->vswc_mic_listening_timeout); ?>"
    456                                     /> <?php echo esc_html(VSWC_LANGUAGE_LIBRARY['basicConfig']['autoTimeoutDuration']); ?></span>
     463                                        value="<?php echo wp_kses_post($this->vswc_mic_listening_timeout); ?>"
     464                                    /> <?php echo wp_kses_post(VSWC_LANGUAGE_LIBRARY['basicConfig']['autoTimeoutDuration']); ?></span>
    457465                            </div>
    458466                            <div class="vswc-basic-config-sub-row">
     
    461469                                    id="vswcMuteAudioPhrases"
    462470                                    type='checkbox'
    463                                     name="<?php echo esc_html(self::BASIC_CONFIG_OPTION_NAMES['mute_audio_phrases']); ?>"
     471                                    name="<?php echo wp_kses_post(self::BASIC_CONFIG_OPTION_NAMES['mute_audio_phrases']); ?>"
    464472                                    value="yes" <?php checked('yes', $this->vswc_mute_audio_phrases);?>
    465                                     > <?php echo esc_html(VSWC_LANGUAGE_LIBRARY['basicConfig']['muteAudioPhrases']); ?>
     473                                    > <?php echo wp_kses_post(VSWC_LANGUAGE_LIBRARY['basicConfig']['muteAudioPhrases']); ?>
    466474                                </label>
    467475                            </div>
     476                            <div class="vswc-basic-config-sub-row">
     477                                <label for="vswcSingleClick">
     478                                    <input
     479                                    id="vswcSingleClick"
     480                                    type='checkbox'
     481                                    name="<?php echo wp_kses_post(self::BASIC_CONFIG_OPTION_NAMES['single_click']); ?>"
     482                                    value="yes" <?php checked('yes', $this->vswc_single_click);?>
     483                                    > Enable single click transcription.
     484                                </label>
     485                            </div>
     486                            <div class="vswc-basic-config-sub-row">
     487                                <label for="vswcElementorSettings">
     488                                    <input
     489                                    id="vswcElementorSettings"
     490                                    type='checkbox'
     491                                    name="<?php echo wp_kses_post(self::BASIC_CONFIG_OPTION_NAMES['elementor_mic']); ?>"
     492                                    value='yes' <?php checked('yes', $this->vswc_elementor);?>
     493                                    > Enable Elementor.
     494                                </label>
     495                            </div>
    468496                        </div>
    469 
    470497                        <div class="vswc-setting-basic-config-column-3 vswc-basic-config-sub-row">
    471498                            <?php
     
    499526        register_setting('vswc-basic-config-settings-group', self::BASIC_CONFIG_OPTION_NAMES['floating_mic_position']);
    500527        register_setting('vswc-basic-config-settings-group', self::BASIC_CONFIG_OPTION_NAMES['mute_audio_phrases']);
     528        register_setting('vswc-basic-config-settings-group', self::BASIC_CONFIG_OPTION_NAMES['single_click']);
     529        register_setting('vswc-basic-config-settings-group', self::BASIC_CONFIG_OPTION_NAMES['elementor_mic']);
    501530    }
    502531}
  • voice-search-for-woocommerce/trunk/composer.json

    r2783035 r2886900  
    22  "name": "speak2web/voice-search-for-woocommerce",
    33  "description": "Allows user to use voice input to perform a product search on WooCommerce WP pages.",
    4   "version": "1.0.2",
     4  "version": "2.0.0",
    55  "type": "wordpress-plugin",
    66  "license": "GPL-2.0+",
  • voice-search-for-woocommerce/trunk/css/voice-search-for-woocommerce.css

    r2771841 r2886900  
    44 * Copyright (c) 2019 speak2web
    55 */
     6
     7 .my-icon-wrapper i {
     8    position: relative;
     9    z-index: 10;
     10}
     11
     12#pulse, #pulse-rate {
     13    position: absolute;
     14    top: -4px;
     15    border-radius: 50%;
     16    z-index: -1;
     17}
     18
     19#pulse-rate {
     20    opacity: .5;
     21    animation-name: listen;
     22    animation-duration: 2s;
     23    animation-iteration-count: infinite;
     24    -webkit-animation-name: listen;
     25    -webkit-animation-duration: 2s;
     26    -webkit-animation-iteration-count: infinite;
     27}
     28
     29@keyframes listen {
     30    0% {transform: scale(1.0);}
     31    20% {transform: scale(1.2);}
     32    40% {transform: scale(1.4);}
     33    50% {transform: scale(1.6);}
     34    60% {transform: scale(1.4);}
     35    80% {transform: scale(1.2);}
     36    100% {transform: scale(1.0);}
     37}
     38
     39@-webkit-keyframes listen {
     40    0% {-webkit-transform: scale(1.0);}
     41    20% {-webkit-transform: scale(1.2);}
     42    40% {-webkit-transform: scale(1.4);}
     43    50% {-webkit-transform: scale(1.6);}
     44    60% {-webkit-transform: scale(1.4);}
     45    80% {-webkit-transform: scale(1.2);}
     46    100% {-webkit-transform: scale(1.0);}
     47}
     48
    649.voice-search-for-woocommerce-wrapper {
    750    display: inline-block;
     
    1053.voice-search-for-woocommerce-wrapper input { margin: 0; }
    1154.voice-search-for-woocommerce-button {
    12     position: absolute;
     55    position: absolute !important;
    1356    margin-left: 5px;
    1457    top: 0;
     58    right: 0;
    1559    float: right;
    1660    height: 30px !important;
     
    63107}
    64108.vswc-mic-band {
    65     -webkit-transform: scaleX(-1);
    66     -ms-transform: scaleX(-1);
    67     transform: scaleX(-1);
     109    -webkit-transform: matrix(1, 0, 0, 1, 0, 0);
     110    -ms-transform: matrix(1, 0, 0, 1, 0, 0);
     111    transform: matrix(1, 0, 0, 1, 0, 0);
    68112}
    69113.vswc-hide-element{ display: none !important; }
  • voice-search-for-woocommerce/trunk/js/voice-search-for-woocommerce.js

    r2771841 r2886900  
    1313    var vswcMicListenAutoTimeoutDuration = null;
    1414
    15     if (typeof(vswcMicListenTimeoutDuration) != 'undefined' && vswcMicListenTimeoutDuration !== null) {
    16         vswcMicListenAutoTimeoutDuration = parseInt(vswcMicListenTimeoutDuration);
     15    if (typeof(vswc.vswcMicListenTimeoutDuration) != 'undefined' && vswc.vswcMicListenTimeoutDuration !== null) {
     16        vswcMicListenAutoTimeoutDuration = parseInt(vswc.vswcMicListenTimeoutDuration);
    1717        vswcMicListenAutoTimeoutDuration = isNaN(vswcMicListenAutoTimeoutDuration) ? 8 : vswcMicListenAutoTimeoutDuration;
    1818    } else {
     
    192192             // Add mic image icon
    193193            var vswcMicIcon = document.createElement('img');
    194             vswcMicIcon.setAttribute('src', vswcImagesPath + 'vswc_mic.svg');
     194            vswcMicIcon.setAttribute('src', vswc.vswcImagesPath + 'vswc_mic.svg');
    195195            vswcMicIcon.setAttribute('class', 'vswc-mic-image');
    196196
     
    418418                    function listenEvent() {
    419419                        // If API system key is unavailable then acknowledge service unavailability and stop voice navigation.
    420                         if (!(typeof (vswcXApiKey) != 'undefined' && vswcXApiKey !== null)) {
     420                        if (!(typeof (vswc.vswcXApiKey) != 'undefined' && vswc.vswcXApiKey !== null)) {
    421421                            // Play 'unavailable' playback
    422422                            vswcAudioPlayer.configure(vswcAlternativeResponse['unavailable']);
    423423                            vswcAudioPlayer.play();
    424                            
    425424                            return false;
    426425                        }
     
    521520
    522521    // Load floating mic with search bar
    523     if (vswcFloatingMic && vswcFloatingMic === 'yes') {
    524522        //############################# Floating mic - Widget ###################################
    525523        let vswcDocFragment = document.createDocumentFragment();
     
    529527        let vswcWrapperMicPositionClass = 'vswc-widget-wrapper-middle-right';
    530528        let vswcChatWrapperMicPositionClass = 'vswc-widget-chat-wrapper-middle-right';
    531         let vswcMicPosition =  vswcSelectedMicPosition ? vswcSelectedMicPosition.toLowerCase() : 'middle right';
     529        let vswcMicPosition =  vswc.vswcSelectedMicPosition ? vswc.vswcSelectedMicPosition.toLowerCase() : 'middle right';
    532530   
    533531        switch (vswcMicPosition) {
     
    575573        // Create and append mic icon/image to mic wrapper
    576574        let vswcWidgetMicImg = document.createElement('img');
    577         vswcWidgetMicImg.setAttribute('src', vswcImagesPath + 'vswc-widget-mic-black.svg');
     575        vswcWidgetMicImg.setAttribute('src', vswc.vswcImagesPath + 'vswc-widget-mic-black.svg');
    578576        vswcWidgetMic.appendChild(vswcWidgetMicImg);
    579577
     
    631629        // Create a widget toggle button wrapper
    632630        let vswcWidgetToggleButton = document.createElement('a');
    633         vswcWidgetToggleButton.setAttribute('id', 'vswcWidgetToggleButton');
    634         vswcWidgetToggleButton.setAttribute('class', 'vswc-widget-button');
     631
    635632
    636633        // Create toggle button icon element
    637634        let vswcWidgetIcon = document.createElement('div');
    638         vswcWidgetIcon.setAttribute('class', 'vswc-widget-icon vswc-widget-toggle-button vswc-toggle-btn-mic');
    639 
    640         // Append toggle button icon to toggle button wrapper
    641         vswcWidgetToggleButton.appendChild(vswcWidgetIcon);
     635
     636        if(vswc.vswcFloatingMic && vswc.vswcFloatingMic === 'yes'){
     637            vswcWidgetToggleButton.setAttribute('id', 'vswcWidgetToggleButton');
     638            vswcWidgetToggleButton.setAttribute('class', 'vswc-widget-button');
     639            vswcWidgetIcon.setAttribute('class', 'vswc-widget-icon vswc-widget-toggle-button vswc-toggle-btn-mic');
     640            // Append toggle button icon to toggle button wrapper
     641            vswcWidgetToggleButton.appendChild(vswcWidgetIcon);
     642        }
    642643
    643644        // Append chat wrapper and toggle button to widget wrapper
    644         vswcWidgetWrapper.appendChild(vswcWidgetChatWrapper);
     645        vswcWidgetWrapper.appendChild(vswcWidgetChatWrapper)
    645646        vswcWidgetWrapper.appendChild(vswcWidgetToggleButton);
    646647
     
    661662        let widget_ignore_onend;
    662663
    663         if ('webkitSpeechRecognition' in window && vswcClientInfo['chrome'] === true) {
     664        /**
     665         * Function for add pulse animation in elementor mic
     666         *
     667         */
     668        function vswcElementorMicPulseAnimation(vswcElementorMicElement) {
     669            let size = 0, left = 0;
     670            if (vswcElementorMicElement.clientHeight >= 80) {
     671                size = vswcElementorMicElement.clientHeight + 15;
     672                left = -(size / 6);
     673            } if (vswcElementorMicElement.clientHeight >= 60) {
     674                size = vswcElementorMicElement.clientHeight + 12;
     675                left = -(size / 5);
     676            } else if (vswcElementorMicElement.clientHeight >= 30) {
     677                size = vswcElementorMicElement.clientHeight + 10;
     678                left = -(size / 4);
     679            } else {
     680                size = vswcElementorMicElement.clientHeight + 8;
     681                left = -(size / 3.5);
     682            }
     683
     684
     685            const vswcPulse = document.createElement('div');
     686            vswcPulse.setAttribute('id', 'pulse');
     687            vswcPulse.setAttribute('class', 'pulse-color');
     688            vswcPulse.style.width = size + 'px';
     689            vswcPulse.style.height = size + 'px';
     690            vswcPulse.style.left = left + 'px';
     691
     692            const vswcPulseRate = document.createElement('div');
     693            vswcPulseRate.setAttribute('id', 'pulse-rate');
     694            vswcPulseRate.setAttribute('class', 'pulse-color');
     695            vswcPulseRate.style.width = size + 'px';
     696            vswcPulseRate.style.height = size + 'px';
     697            vswcPulseRate.style.left = left + 'px';
     698
     699            return { vswcPulse, vswcPulseRate };
     700        }
     701
     702        function enableElementor(){
     703            const vswcFloatigMic = document.getElementById('flt-mic')
     704            if( vswcFloatigMic != null){
     705                const vswcElementorMicColor = vswcFloatigMic.getElementsByClassName('my-icon-wrapper')[0].getElementsByTagName('i')[0];
     706                const vswcPulseItem = vswcElementorMicPulseAnimation(vswcElementorMicColor);   
     707            if ('webkitSpeechRecognition' in window && vswcClientInfo['chrome'] === true) {
     708                let widgetRecognition = new webkitSpeechRecognition();
     709                widgetRecognition.continuous = true;
     710                widgetRecognition.interimResults = true;
     711   
     712                widgetRecognition.onstart = function () {
     713                    widgetRecognizing = true;
     714                };
     715   
     716                widgetRecognition.onerror = function (event) {
     717                    vswcFloatigMic.classList.remove('listening');
     718                    widgetRecognizing = false;
     719                    vswcElementorMicColor.classList.remove('my-icon-animation-wrapper');
     720                    vswcElementorMicColor.removeChild(vswcPulseItem['vswcPulse']);
     721                    vswcElementorMicColor.removeChild(vswcPulseItem['vswcPulseRate']);
     722   
     723                    if (event.error == 'no-speech') {
     724                        // Play feature unavailable playback
     725                        vswcAudioPlayer.configure(vswcAlternativeResponse['notAudible']);
     726                        vswcAudioPlayer.play();
     727   
     728                        widget_ignore_onend = true;
     729                    }
     730   
     731                    if (event.error == 'audio-capture') {
     732                        widget_ignore_onend = true;
     733                    }
     734   
     735                    if (event.error == 'not-allowed') {
     736                        widget_ignore_onend = true;
     737                    }
     738                };
     739   
     740                function widgetProcessEnd() {
     741                    widgetRecognizing = false;
     742   
     743                    if (widget_ignore_onend) { return; }
     744   
     745                    widgetFinalTranscript = widget_final_transcript;
     746                    vswcFloatigMic.classList.remove('listening');
     747                    vswcElementorMicColor.classList.remove('my-icon-animation-wrapper');
     748                    vswcElementorMicColor.removeChild(vswcPulseItem['vswcPulse']);
     749                    vswcElementorMicColor.removeChild(vswcPulseItem['vswcPulseRate']);   
     750   
     751                   
     752                    if (typeof(widgetFinalTranscript) != 'undefined' && widgetFinalTranscript.length != 0) {
     753                        vswcWidgetSearch.value = widgetFinalTranscript;
     754   
     755                        // Play 'basic' playback
     756                        vswcAudioPlayer.configure(vswcAlternativeResponse['basic'], function(){
     757                            vswcWidgetForm.submit();
     758                        });
     759                        vswcAudioPlayer.play();
     760                    } else {
     761                        // Play 'notAudible' playback
     762                        vswcAudioPlayer.configure(vswcAlternativeResponse['notAudible']);
     763                        vswcAudioPlayer.play();
     764   
     765                        vswcWidgetSearch.placeholder = vswcMessages['ask'];
     766                    }
     767                }
     768   
     769                widgetRecognition.onend = function () {
     770                    if (isAndroid) { widgetProcessEnd(); }
     771                };
     772   
     773                widgetRecognition.onresult = function (event) {
     774                    let interim_transcript = '';
     775                    if (typeof (event.results) == 'undefined') {
     776                        widgetRecognition.onend = null;
     777                        widgetRecognition.stop();
     778   
     779                        // Play 'micConnect' playback
     780                        vswcAudioPlayer.configure(vswcAlternativeResponse['micConnect']);
     781                        vswcAudioPlayer.play();
     782                        return;
     783                    }
     784   
     785                    let eventResultsLength = event.results.length;
     786   
     787                    for (let i = event.resultIndex; i < eventResultsLength; ++i) {
     788                        if (event.results[i].isFinal) {
     789                            widget_final_transcript = event.results[i][0].transcript;
     790   
     791                            if (isAndroid == false) {
     792                                widgetProcessEnd();
     793                                widgetRecognition.stop();
     794                            }                       
     795                        } else {
     796                            interim_transcript += event.results[i][0].transcript;
     797                        }
     798                    }
     799                };
     800                    vswcFloatigMic.addEventListener(vswcMicEventToListen, function (event) {
     801
     802                        if (vswcAnyOtherMicListening(vswcFloatigMic.getAttribute('id'), vswcFloatigMic) === true) return;
     803   
     804                    if (widgetRecognizing) {
     805                        // To clear pre-existing mic reset timeout if any. (Based on duration from settings)
     806                        vswcClearMicResetTimeout();
     807   
     808                        // Stop ongoing playback if nay
     809                        if (vswcAudioPlayer.isPlaying()) {
     810                            vswcAudioPlayer.stop();
     811                        }
     812   
     813                        if (isAndroid == false) {
     814                            widgetProcessEnd();
     815                            widgetRecognition.stop();
     816                        }
     817                    } else {
     818                        vswcFloatigMic.classList.add('listening');
     819                        vswcElementorMicColor.classList.add('my-icon-animation-wrapper');
     820                        vswcElementorMicColor.appendChild(vswcPulseItem['vswcPulse']);
     821                        vswcElementorMicColor.appendChild(vswcPulseItem['vswcPulseRate']);
     822                        event.preventDefault();
     823   
     824                        // Stop ongoing playback if nay
     825                        if (vswcAudioPlayer.isPlaying()) {
     826                            vswcAudioPlayer.stop();
     827                        }
     828   
     829                        widgetFinalTranscript = '';
     830                        widgetRecognizing = true;
     831                        widgetRecognition.lang = !!vswcSttLanguageContext['gcp']['stt'] ? vswcSttLanguageContext['gcp']['langCode'] : 'en-US';
     832                        widgetRecognition.start();
     833                        widget_ignore_onend = false;
     834   
     835                        // To clear pre-existing mic reset timeout if any. (Based on duration from settings)
     836                        vswcClearMicResetTimeout();
     837   
     838                        // To set new mic reset timeout. (Based on duration from settings)
     839                        window.vswcMicTimeoutIdentifier = setTimeout(function(){
     840                            let updatedClassList = vswcFloatigMic.classList;
     841   
     842                            if (updatedClassList && updatedClassList.contains('listening')) {
     843                                vswcFloatigMic.click();
     844                            }
     845                        }, vswcMicListenAutoTimeoutDuration);
     846                    }
     847                    });
     848            } else {
     849                //CODE FOR BROWSERS THAT DO NOT SUPPORT STT NATIVLY
     850                // MUST USE THE BUILT IN MICROPHONE
     851                vswcFloatigMic.addEventListener(vswcMicEventToListen, function (event) {
     852                   
     853                    /**
     854                     * Audio element's play method must be invoked in exact influence of user gesture to avoid auto play restriction
     855                     *
     856                     */
     857                    if (
     858                        vswcClientInfo.ios === true
     859                        || (vswcClientInfo.iosSafari && !vswcClientInfo.chrome && !vswcClientInfo.firefox)
     860                        || (vswcClientInfo.windows && vswcClientInfo.firefox)
     861                    ) {
     862                        vswcAudioPlayer.configure(vswcSilenceSoundPath);
     863                        vswcAudioPlayer.play();
     864                    }
     865   
     866                    if (vswcAnyOtherMicListening(vswcFloatigMic.getAttribute('id'), vswcFloatigMic) === true) return;
     867   
     868                    // Deny recording if microphone is not accessible
     869                    if (!vswcAudioRecorder || !vswcAudioContext) {
     870                        vswcInitAudio(function (a) {
     871                            if (!vswcAudioRecorder || !vswcAudioContext) {                       
     872                                vswcWidgetSearch.placeholder = vswcMessages['micNotAccessible'];
     873                                return false;
     874                            } else {
     875                                widgetListenEvent();
     876                            }
     877                        });
     878                    } else {
     879                        widgetListenEvent();
     880                    }
     881   
     882                    function widgetListenEvent() {
     883                        // If API system key is unavailable then acknowledge service unavailability and stop voice navigation.
     884                        if (!(typeof (vswc.vswcXApiKey) != 'undefined' && vswc.vswcXApiKey !== null)) {
     885                            // Play 'unavailable' playback
     886                            vswcAudioPlayer.configure(vswcAlternativeResponse['unavailable']);
     887                            vswcAudioPlayer.play();
     888   
     889                            return false;
     890                        }
     891   
     892                        // User ending recording by clicking back mic
     893                        if (widgetRecognizing) {
     894                            // To clear pre-existing mic reset timeout if any. (Based on duration from settings)
     895                            vswcClearMicResetTimeout();
     896   
     897                            // Stop recorder
     898                            vswcAudioRecorder.stop();
     899   
     900                            // Stop access to audio resource
     901                            vswcStopAudio();
     902   
     903                            // Stop ongoing playback if nay
     904                            if (vswcAudioPlayer.isPlaying()) {
     905                                vswcAudioPlayer.stop();
     906                            }
     907   
     908                            //replace recording with mic icon
     909                            vswcFloatigMic.classList.remove('listening');
     910                            vswcElementorMicColor.classList.remove('my-icon-animation-wrapper');
     911                            vswcElementorMicColor.removeChild(vswcPulseItem['vswcPulse']);
     912                            vswcElementorMicColor.removeChild(vswcPulseItem['vswcPulseRate']);
     913   
     914                            vswcWidgetSearch.placeholder = vswcMessages['transcribeText'];
     915                           
     916                            vswcAudioRecorder.getBuffers(function (buffers) {                           
     917                                if (!!vswcSttLanguageContext['gcp']['stt']) {
     918                                    vswcAudioRecorder.exportMonoWAV(function(blob){
     919                                        vswcAudioRecorder.convertBlobToBase64(blob).then(function(resultedBase64){
     920                                            vswcGcpStt(resultedBase64).then(function(transcriptResult){
     921                                                vswcWidgetSearch.value = transcriptResult;
     922   
     923                                                // Play 'basic' playback
     924                                                vswcAudioPlayer.configure(vswcAlternativeResponse['basic'], function(){
     925                                                    vswcWidgetForm.submit();
     926                                                });
     927                                                vswcAudioPlayer.play();
     928                                            }).catch(function(error) {
     929                                                // Play 'notAudible' playback
     930                                                vswcAudioPlayer.configure(vswcAlternativeResponse['notAudible']);
     931                                                vswcAudioPlayer.play();
     932   
     933                                                vswcWidgetSearch.placeholder = vswcMessages['ask'];
     934                                            })
     935                                        }).catch(function(error){
     936                                            // Play 'notAudible' playback
     937                                            vswcAudioPlayer.configure(vswcAlternativeResponse['notAudible']);
     938                                            vswcAudioPlayer.play();
     939   
     940                                            vswcWidgetSearch.placeholder = vswcMessages['ask'];
     941                                        });
     942                                    });
     943                                } else {
     944                                    // Play 'notAudible' playback
     945                                    vswcAudioPlayer.configure(vswcAlternativeResponse['notAudible']);
     946                                    vswcAudioPlayer.play();
     947                                    vswcWidgetSearch.placeholder = vswcMessages['ask'];
     948                                }
     949                            });
     950   
     951                            widgetRecognizing = false;
     952                            return;
     953                        } else {// User started recording by clicking mic
     954                            vswcFloatigMic.classList.add('listening');
     955                            vswcElementorMicColor.classList.add('my-icon-animation-wrapper');
     956                            vswcElementorMicColor.appendChild(vswcPulseItem['vswcPulse']);
     957                            vswcElementorMicColor.appendChild(vswcPulseItem['vswcPulseRate']);
     958                            event.preventDefault();
     959   
     960                            // Stop ongoing playback if nay
     961                            if (vswcAudioPlayer.isPlaying()) {
     962                                vswcAudioPlayer.stop();
     963                            }
     964   
     965                            widgetFinalTranscript = '';
     966   
     967                            widgetRecognizing = true;
     968                            vswcAudioRecorder.clear();
     969                            vswcAudioRecorder.record(vswcFloatigMic);
     970   
     971                            // To clear pre-existing mic reset timeout if any. (Based on duration from settings)
     972                            vswcClearMicResetTimeout();
     973   
     974                            // To set new mic reset timeout. (Based on duration from settings)
     975                            window.vswcMicTimeoutIdentifier = setTimeout(function(){
     976                                let updatedClassList = vswcFloatigMic.classList;
     977   
     978                                if (updatedClassList && updatedClassList.contains('listening')) {
     979                                    vswcFloatigMic.click();
     980                                }
     981                            }, vswcMicListenAutoTimeoutDuration);
     982                        }
     983                    }
     984                }, false);
     985            }
     986        }}
     987
     988        function enableSingleClick(){           
     989            vswcWidgetWrapper.classList.remove('vswcWidgetChatWrapper');
     990            if ('webkitSpeechRecognition' in window && vswcClientInfo['chrome'] === true) {
     991                let widgetRecognition = new webkitSpeechRecognition();
     992                widgetRecognition.continuous = true;
     993                widgetRecognition.interimResults = true;
     994   
     995                widgetRecognition.onstart = function () {
     996                    widgetRecognizing = true;
     997                };
     998   
     999                widgetRecognition.onerror = function (event) {
     1000                    vswcWidgetToggleButton.classList.remove('listening');
     1001                    widgetRecognizing = false;
     1002   
     1003                    if (event.error == 'no-speech') {
     1004                        // Play feature unavailable playback
     1005                        vswcAudioPlayer.configure(vswcAlternativeResponse['notAudible']);
     1006                        vswcAudioPlayer.play();
     1007   
     1008                        widget_ignore_onend = true;
     1009                        vswcWidgetSearch.placeholder = vswcMessages['unableToHear'];
     1010                    }
     1011   
     1012                    if (event.error == 'audio-capture') {
     1013                        widget_ignore_onend = true;
     1014                        vswcWidgetSearch.placeholder = vswcMessages['micNotAccessible'];
     1015                    }
     1016
     1017                    if (event.error == 'not-allowed') {
     1018                        widget_ignore_onend = true;
     1019                        vswcWidgetSearch.placeholder = vswcMessages['browserDenyMicAccess'];
     1020                    }
     1021                }; 
     1022
     1023            function widgetProcessEnd() {
     1024                widgetRecognizing = false;
     1025
     1026                if (widget_ignore_onend) { return; }
     1027
     1028                widgetFinalTranscript = widget_final_transcript;   
     1029                vswcWidgetToggleButton.classList.remove('listening');
     1030               
     1031                if (typeof(widgetFinalTranscript) != 'undefined' && widgetFinalTranscript.length != 0) {
     1032                    vswcWidgetSearch.value = widgetFinalTranscript;
     1033
     1034                    // Play 'basic' playback
     1035                    vswcAudioPlayer.configure(vswcAlternativeResponse['basic'], function(){
     1036                        vswcWidgetForm.submit();
     1037                    });
     1038                    vswcAudioPlayer.play();
     1039                } else {
     1040                    // Play 'notAudible' playback
     1041                    vswcAudioPlayer.configure(vswcAlternativeResponse['notAudible']);
     1042                    vswcAudioPlayer.play();
     1043
     1044                    vswcWidgetSearch.placeholder = vswcMessages['ask'];
     1045                }
     1046            }
     1047
     1048            widgetRecognition.onend = function () {
     1049                if (isAndroid) { widgetProcessEnd(); }
     1050            };
     1051
     1052            widgetRecognition.onresult = function (event) {
     1053                let interim_transcript = '';
     1054                if (typeof (event.results) == 'undefined') {
     1055                    widgetRecognition.onend = null;
     1056                    widgetRecognition.stop();
     1057                    vswcWidgetSearch.placeholder = vswcMessages['unableToHear'];
     1058
     1059                    // Play 'micConnect' playback
     1060                    vswcAudioPlayer.configure(vswcAlternativeResponse['micConnect']);
     1061                    vswcAudioPlayer.play();
     1062                    return;
     1063                }
     1064
     1065                let eventResultsLength = event.results.length;
     1066
     1067                for (let i = event.resultIndex; i < eventResultsLength; ++i) {
     1068                    if (event.results[i].isFinal) {
     1069                        widget_final_transcript = event.results[i][0].transcript;
     1070
     1071                        if (isAndroid == false) {
     1072                            widgetProcessEnd();
     1073                            widgetRecognition.stop();
     1074                        }                       
     1075                    } else {
     1076                        interim_transcript += event.results[i][0].transcript;
     1077                    }
     1078                }
     1079            };
     1080
     1081            vswcWidgetToggleButton.addEventListener(vswcMicEventToListen, function (event) {
     1082                if (vswcAnyOtherMicListening(vswcWidgetToggleButton.getAttribute('id'), vswcWidgetToggleButton) === true) return;
     1083
     1084                if (widgetRecognizing) {
     1085                    // To clear pre-existing mic reset timeout if any. (Based on duration from settings)
     1086                    vswcClearMicResetTimeout();
     1087
     1088                    // Stop ongoing playback if nay
     1089                    if (vswcAudioPlayer.isPlaying()) {
     1090                        vswcAudioPlayer.stop();
     1091                    }
     1092
     1093                    if (isAndroid == false) {
     1094                        widgetProcessEnd();
     1095                        widgetRecognition.stop();
     1096                    }
     1097                } else {
     1098                    vswcWidgetToggleButton.classList.add('listening');
     1099                    event.preventDefault();
     1100
     1101                    // Stop ongoing playback if nay
     1102                    if (vswcAudioPlayer.isPlaying()) {
     1103                        vswcAudioPlayer.stop();
     1104                    }
     1105
     1106                    widgetFinalTranscript = '';
     1107                    widgetRecognizing = true;
     1108                    widgetRecognition.lang = !!vswcSttLanguageContext['gcp']['stt'] ? vswcSttLanguageContext['gcp']['langCode'] : 'en-US';
     1109                    widgetRecognition.start();
     1110                    widget_ignore_onend = false;
     1111
     1112                    // To clear pre-existing mic reset timeout if any. (Based on duration from settings)
     1113                    vswcClearMicResetTimeout();
     1114
     1115                    // To set new mic reset timeout. (Based on duration from settings)
     1116                    window.vswcMicTimeoutIdentifier = setTimeout(function(){
     1117                        let updatedClassList = vswcWidgetToggleButton.classList;
     1118
     1119                        if (updatedClassList && updatedClassList.contains('listening')) {
     1120                            vswcWidgetToggleButton.click();
     1121                        }
     1122                    }, vswcMicListenAutoTimeoutDuration);
     1123                }
     1124            });
     1125        } else {
     1126            //CODE FOR BROWSERS THAT DO NOT SUPPORT STT NATIVLY
     1127            // MUST USE THE BUILT IN MICROPHONE
     1128            vswcWidgetToggleButton.addEventListener(vswcMicEventToListen, function (event) {
     1129                /**
     1130                 * Audio element's play method must be invoked in exact influence of user gesture to avoid auto play restriction
     1131                 *
     1132                 */
     1133                if (
     1134                    vswcClientInfo.ios === true
     1135                    || (vswcClientInfo.iosSafari && !vswcClientInfo.chrome && !vswcClientInfo.firefox)
     1136                    || (vswcClientInfo.windows && vswcClientInfo.firefox)
     1137                ) {
     1138                    vswcAudioPlayer.configure(vswcSilenceSoundPath);
     1139                    vswcAudioPlayer.play();
     1140                }
     1141
     1142                if (vswcAnyOtherMicListening(vswcWidgetToggleButton.getAttribute('id'), vswcWidgetToggleButton) === true) return;
     1143
     1144                // Deny recording if microphone is not accessible
     1145                if (!vswcAudioRecorder || !vswcAudioContext) {
     1146                    vswcInitAudio(function (a) {
     1147                        if (!vswcAudioRecorder || !vswcAudioContext) {                       
     1148                            vswcWidgetSearch.placeholder = vswcMessages['micNotAccessible'];
     1149                            return false;
     1150                        } else {
     1151                            widgetListenEvent();
     1152                        }
     1153                    });
     1154                } else {
     1155                    widgetListenEvent();
     1156                }
     1157
     1158                function widgetListenEvent() {
     1159                    // If API system key is unavailable then acknowledge service unavailability and stop voice navigation.
     1160                    if (!(typeof (vswc.vswcXApiKey) != 'undefined' && vswc.vswcXApiKey !== null)) {
     1161                        // Play 'unavailable' playback
     1162                        vswcAudioPlayer.configure(vswcAlternativeResponse['unavailable']);
     1163                        vswcAudioPlayer.play();
     1164
     1165                        return false;
     1166                    }
     1167
     1168                    // User ending recording by clicking back mic
     1169                    if (widgetRecognizing) {
     1170                        // To clear pre-existing mic reset timeout if any. (Based on duration from settings)
     1171                        vswcClearMicResetTimeout();
     1172
     1173                        // Stop recorder
     1174                        vswcAudioRecorder.stop();
     1175
     1176                        // Stop access to audio resource
     1177                        vswcStopAudio();
     1178
     1179                        // Stop ongoing playback if nay
     1180                        if (vswcAudioPlayer.isPlaying()) {
     1181                            vswcAudioPlayer.stop();
     1182                        }
     1183
     1184                        //replace recording with mic icon
     1185                        vswcWidgetToggleButton.classList.remove('listening');
     1186
     1187                        vswcWidgetSearch.placeholder = vswcMessages['transcribeText'];
     1188                       
     1189                        vswcAudioRecorder.getBuffers(function (buffers) {                           
     1190                            if (!!vswcSttLanguageContext['gcp']['stt']) {
     1191                                vswcAudioRecorder.exportMonoWAV(function(blob){
     1192                                    vswcAudioRecorder.convertBlobToBase64(blob).then(function(resultedBase64){
     1193                                        vswcGcpStt(resultedBase64).then(function(transcriptResult){
     1194                                            vswcWidgetSearch.value = transcriptResult;
     1195
     1196                                            // Play 'basic' playback
     1197                                            vswcAudioPlayer.configure(vswcAlternativeResponse['basic'], function(){
     1198                                                vswcWidgetForm.submit();
     1199                                            });
     1200                                            vswcAudioPlayer.play();
     1201                                        }).catch(function(error) {
     1202                                            // Play 'notAudible' playback
     1203                                            vswcAudioPlayer.configure(vswcAlternativeResponse['notAudible']);
     1204                                            vswcAudioPlayer.play();
     1205
     1206                                            vswcWidgetSearch.placeholder = vswcMessages['ask'];
     1207                                        })
     1208                                    }).catch(function(error){
     1209                                        // Play 'notAudible' playback
     1210                                        vswcAudioPlayer.configure(vswcAlternativeResponse['notAudible']);
     1211                                        vswcAudioPlayer.play();
     1212
     1213                                        vswcWidgetSearch.placeholder = vswcMessages['ask'];
     1214                                    });
     1215                                });
     1216                            } else {
     1217                                // Play 'notAudible' playback
     1218                                vswcAudioPlayer.configure(vswcAlternativeResponse['notAudible']);
     1219                                vswcAudioPlayer.play();
     1220                                vswcWidgetSearch.placeholder = vswcMessages['ask'];
     1221                            }
     1222                        });
     1223
     1224                        widgetRecognizing = false;
     1225                        return;
     1226                    } else {// User started recording by clicking mic
     1227                        vswcWidgetToggleButton.classList.add('listening');
     1228                        event.preventDefault();
     1229
     1230                        // Stop ongoing playback if nay
     1231                        if (vswcAudioPlayer.isPlaying()) {
     1232                            vswcAudioPlayer.stop();
     1233                        }
     1234
     1235                        widgetFinalTranscript = '';
     1236
     1237                        widgetRecognizing = true;
     1238                        vswcAudioRecorder.clear();
     1239                        vswcAudioRecorder.record(vswcWidgetToggleButton);
     1240
     1241                        // To clear pre-existing mic reset timeout if any. (Based on duration from settings)
     1242                        vswcClearMicResetTimeout();
     1243
     1244                        // To set new mic reset timeout. (Based on duration from settings)
     1245                        window.vswcMicTimeoutIdentifier = setTimeout(function(){
     1246                            let updatedClassList = vswcWidgetToggleButton.classList;
     1247
     1248                            if (updatedClassList && updatedClassList.contains('listening')) {
     1249                                vswcWidgetToggleButton.click();
     1250                            }
     1251                        }, vswcMicListenAutoTimeoutDuration);
     1252                    }
     1253                }
     1254            }, false);
     1255        }}
     1256
     1257        function disableSingleClick(){           
     1258            if ('webkitSpeechRecognition' in window && vswcClientInfo['chrome'] === true) {
    6641259            let widgetRecognition = new webkitSpeechRecognition();
    6651260            widgetRecognition.continuous = true;
     
    8341429                function widgetListenEvent() {
    8351430                    // If API system key is unavailable then acknowledge service unavailability and stop voice navigation.
    836                     if (!(typeof (vswcXApiKey) != 'undefined' && vswcXApiKey !== null)) {
     1431                    if (!(typeof (vswc.vswcXApiKey) != 'undefined' && vswc.vswcXApiKey !== null)) {
    8371432                        // Play 'unavailable' playback
    8381433                        vswcAudioPlayer.configure(vswcAlternativeResponse['unavailable']);
     
    8941489                                vswcAudioPlayer.configure(vswcAlternativeResponse['notAudible']);
    8951490                                vswcAudioPlayer.play();
    896 
    8971491                                vswcWidgetSearch.placeholder = vswcMessages['ask'];
    8981492                            }
     
    9301524                }
    9311525            }, false);
     1526        }}
     1527
     1528        if (vswcIsElementor == true){
     1529            enableElementor()
     1530        }
     1531     
     1532        if (vswcIsSingleClick ==true){
     1533            enableSingleClick()
     1534        }
     1535
     1536        else {
     1537            disableSingleClick()           
    9321538        }
    9331539
     
    9661572         */
    9671573        function vswcToggleWidgetElements() {
    968             vswcToggleClass('.vswc-widget-toggle-button', 'vswc-toggle-btn-mic');
    969             vswcToggleClass('.vswc-widget-toggle-button', 'vswc-toggle-btn-close');
    970             vswcToggleClass('.vswc-widget-toggle-button', 'vswc-widget-active');
    971             vswcToggleClass('.vswc-widget-toggle-button', 'vswc-widget-visible');
    972             vswcToggleClass('#vswcWidgetToggleButton', 'vswc-widget-float');
    973             vswcToggleClass('.vswc-widget-chat-wrapper', 'vswc-widget-visible');
    974             vswcToggleClass('.vswc-widget-button', 'vswc-widget-visible');
     1574            if (vswcIsSingleClick == true){
     1575                    vswcToggleClass('.vswc-widget-toggle-button', 'vswc-toggle-btn-mic');
     1576                    vswcToggleClass('.vswc-widget-toggle-button', 'vswc-toggle-btn-close');
     1577                    vswcToggleClass('.vswc-widget-toggle-button', 'vswc-widget-active');
     1578                    vswcToggleClass('.vswc-widget-toggle-button', 'vswc-widget-visible');
     1579                    vswcToggleClass('#vswcWidgetToggleButton', 'vswc-widget-float');
     1580                    vswcToggleClass('.vswc-widget-button', 'vswc-widget-visible');
     1581            }
     1582
     1583            else{
     1584                    vswcToggleClass('.vswc-widget-toggle-button', 'vswc-toggle-btn-mic');
     1585                    vswcToggleClass('.vswc-widget-toggle-button', 'vswc-toggle-btn-close');
     1586                    vswcToggleClass('.vswc-widget-toggle-button', 'vswc-widget-active');
     1587                    vswcToggleClass('.vswc-widget-toggle-button', 'vswc-widget-visible');
     1588                    vswcToggleClass('#vswcWidgetToggleButton', 'vswc-widget-float');
     1589                    vswcToggleClass('.vswc-widget-chat-wrapper', 'vswc-widget-visible');
     1590                    vswcToggleClass('.vswc-widget-button', 'vswc-widget-visible');
     1591            }
    9751592        }
    976     }
    9771593})();
    9781594};
  • voice-search-for-woocommerce/trunk/js/vswc.speech-handler.js

    r2783021 r2886900  
    1212var respTimeOut = false;
    1313var errcnt = 0;
    14 let vswcHostName = typeof(vswcCurrentHostName) != 'undefined' ? vswcCurrentHostName : null;
     14let vswcHostName = typeof(vswc.vswcCurrentHostName) != 'undefined' ? vswc.vswcCurrentHostName : null;
    1515
    1616/**
     
    2929            if (pathOfFile) {
    3030                let partialFilePath = !!vswcIsMuteSimon ? vswcSilenceSoundPath : pathOfFile;
    31                 this.htmlAudioElement.src = _vswcPath + partialFilePath;
     31                this.htmlAudioElement.src = vswc._vswcPath + partialFilePath;
    3232                this.htmlAudioElement.preload = 'auto';
    3333                this.lastFilePath = pathOfFile;
  • voice-search-for-woocommerce/trunk/js/vswc.text-library.js

    r2771841 r2886900  
    1212// PLUGIN LANGUAGE
    1313//####################################
    14 var vswcTypeOfSelectedLanguage = (typeof(vswcSelectedLanguage) != 'undefined' && vswcSelectedLanguage !== null) ? vswcSelectedLanguage.trim() : 'English';
    15 var vswcSelectedLang = (typeof(vswcSelectedLanguage) != 'undefined' && vswcSelectedLanguage !== null) ? vswcSelectedLanguage.trim() : 'en-US';
     14var vswcTypeOfSelectedLanguage = (typeof(vswc.vswcSelectedLanguage) != 'undefined' && vswc.vswcSelectedLanguage !== null) ? vswc.vswcSelectedLanguage.trim() : 'English';
     15var vswcSelectedLang = (typeof(vswc.vswcSelectedLanguage) != 'undefined' && vswc.vswcSelectedLanguage !== null) ? vswc.vswcSelectedLanguage.trim() : 'en-US';
    1616
    1717var vswcIsSttLangCtx = typeof _vswcSttLanguageContext != 'undefined' && !!_vswcSttLanguageContext && _vswcSttLanguageContext instanceof Object ? true : false;
     
    157157var vswcWidgetMessages = _vswcTextPhrases['vswcWidgetMessages'];
    158158
    159 var vswcIsMuteSimon = typeof _vswcMuteAudioPhrases != 'undefined' && !!_vswcMuteAudioPhrases && _vswcMuteAudioPhrases == 'yes' ? true : false;
     159var vswcIsMuteSimon = typeof vswc._vswcMuteAudioPhrases != 'undefined' && !! vswc._vswcMuteAudioPhrases && vswc._vswcMuteAudioPhrases == 'yes' ? true : false;
     160var vswcIsSingleClick = typeof vswc._vswcSingleClick != 'undefined' && !! vswc._vswcSingleClick && vswc._vswcSingleClick == 'yes' ? true : false;
     161var vswcIsElementor = typeof vswc._vswcElementor != 'undefined' && !! vswc._vswcElementor && vswc._vswcElementor == 'yes' ? true : false;
  • voice-search-for-woocommerce/trunk/readme.txt

    r2783035 r2886900  
    11=== Voice Search For WooCommerce ===
    22Contributors:      mspanwa2   
    3 Tags:              voice search, wooCommerce, iOS voice search, Microsoft Edge voice search, multi platform voice search, voice, AI, speech, FireFox voice search, api,  
     3Tags:              voice search, wooCommerce, iOS voice search, Microsoft Edge voice search, multi platform voice search, voice, AI, speech, FireFox voice search, api, elementor, page builder
    44Requires at least: 2.6 
    5 Tested up to:      6.0.1 
     5Tested up to:      6.1.1 
    66Requires PHP:      5.3
    7 Stable tag:        1.0.2
     7Stable tag:        2.0.0
    88License:           GPLv2 or later 
    99License URI:       http://www.gnu.org/licenses/gpl-2.0.html 
    1010
     11
     12= ELEMENTOR PAGE BUILDER SUPPORT NOW INCLUDED =
     13
     14Place a microphone anywhere on your site. Control the icon, color, and other advanced design features when deploying this exciting new feature.
     15
    1116Add an universal, multi lingual voice search to wooCommerce web pages. This plugin will add voice search ability to all wooCommerce web pages. Simply click the microphone and dictate your search terms.
    1217The plugin will automatically detect end of speech and submit your search to the wooCommerce store.
    1318
    14 
    1519Add voice search to your WooCommerce store. This simple, fast, and intuitive plugin helps your shoppers find what they're looking for with the ultimate in accessibility - their voice. Our plugin supports 130 languages and follows stringest ethical and privacy guidelines to protect your shoppers privacy while delivering the highest levels of security to your store.
    1620
     
    2125= ETHICAL PRIVACY FOCUSED VOICE ASSISTANCE & SEARCH FOR YOUR WEBSITE =
    2226
    23 This plugin adds voice search features to your website that optimize user experience. Upon installation you'll be able to choose from 130+ languages we support and instantly add a microphone to every search bar as well as a floating icon to every page.
     27This plugin adds voice search features to your website that optimize user experience. Upon installation you'll be able to choose from 130+ languages we support and instantly add a microphone to every search bar as well as a floating icon to every page or place a microphone widget using Elementor to enable voice search on your WooCommerce shop.
    2428
    2529Our service helps you to stay compliant with privacy regulations because we do not store or retain any user generated content or personally identifying information. As one of the earliest members and contributors to The Open Voice Network, a Community of The Linux Foundation, we have made it our goal to deliver services in voice tech that meet even the most demanding standards and guidelines.
     
    191195
    192196 
     197Elementor:
     198++++++++++++++++++++++++++++++++++++++++++
     199Steps to enable Elementor on voice-seatch-for-woocommerce plugin-
     200
     2011. In admin page of your website on the left navigation bar-
     202    Plugins -> Add New  and search and install "Elementor Website Builder"
     203
     2042. Head over to Plugins -> Installed Plugins and activate both the "Elementor Website Builder" and  "Voice Search For WooCommerce".
     205
     2063. Head over to "Voice Search For WooCommerce" -> Settings and check mark "Enable Elementor" settings.
     207    (Note - Currently Elementor works conditionally with our flaoting mic widget, if single click is enabled, elementor wont work. This can be changed as per requirements)
     208
     2094. Now Elementor is active! Go to any page and select option "Edit with Elementor" option. It will open up a widget toolbox on the left side.
     210
     2115. Search for "Floating Mic Widget" and place it anywhere on the webpage! User can currently customise its color and icon.
     212
     213
    193214
    194215speak2web Voice Search Service:
     
    218239= 1.0.2 =
    219240* Address merge Issue
     241
     242= 2.0.0 =
     243* Added Elementor support
     244* Upgraded to Wordpress 6.1.1
     245* Upgraded to PHP 8.0
     246* Upgraded to WooCommerce 7.4.1
  • voice-search-for-woocommerce/trunk/voice-search-for-woocommerce.php

    r2783035 r2886900  
    33 * Plugin Name: Voice Search For WooCommerce
    44 * Description: Allows any serach box on the page to be searchable via voice.
    5  * Version:     1.0.2
     5 * Version:     2.0.0
    66 * Author:      speak2web
    77 * Author URI:  https://speak2web.com/
     
    99 * Domain Path: /languages
    1010 * WC requires at least: 2.2
    11  * WC tested up to: 4.5.2
     11 * WC tested up to: 7.4.1
    1212 */
    1313
     
    4141));
    4242
     43class Vswc_Elementor_widget {
     44
     45    private static $instance = null;
     46
     47
     48    public static function instance() {
     49        if ( is_null( self::$instance ) ) {
     50            self::$instance = new self();
     51        }
     52
     53        return self::$instance;
     54    }
     55
     56
     57    private function include_widgets_files() {
     58        require_once( __DIR__ . '/widgets/oembed-widget.php' );
     59    }
     60
     61    public function register_widgets() {
     62        // It's now safe to include Widgets files.
     63        $this->include_widgets_files();
     64
     65        // Register the plugin widget classes.
     66        \Elementor\Plugin::instance()->widgets_manager->register( new \Vswc_Elementor_Floating_Mic_Widget() );
     67    }
     68
     69    public function register_categories($elements_manager){
     70        $elements_manager->add_category(
     71            'speak2web',
     72            [
     73                'title' => __('Speak2web', 'myWidget'),
     74                'icon'  => 'fa fa-plug'
     75            ]
     76        );
     77    }
     78
     79    public function __construct() {
     80        // Register the widgets.
     81        add_action( 'elementor/widgets/register', array( $this, 'register_widgets' ) );
     82        add_action( 'elementor/elements/categories_registered', array( $this, 'register_categories' ) );
     83
     84    }
     85}
     86Vswc_Elementor_widget::instance();
     87
    4388if ( $voice_search_for_woocommerce_requirements_check->passes() ) {
    4489    $vswc_client_info = array(
Note: See TracChangeset for help on using the changeset viewer.