Plugin Directory

Changeset 1745993


Ignore:
Timestamp:
10/13/2017 11:34:49 AM (8 years ago)
Author:
chatx
Message:

Version 0.1.7 update

Location:
chatx-ai
Files:
130 added
7 edited

Legend:

Unmodified
Added
Removed
  • chatx-ai/trunk/chatx-ai.php

    r1744693 r1745993  
    44 * Plugin URI:        https://chatx.ai
    55 * Description:       Recover abandoned carts on WooCommerce using an intelligent Facebook Messenger chatbot.
    6  * Version:           0.1.6
     6 * Version:           0.1.7
    77 * Author:            chatx.ai
    88 * Author URI:        https://chatx.ai
  • chatx-ai/trunk/includes/class-chatx-ai-rest-api.php

    r1744693 r1745993  
    350350                    'campaign'        => isset($template['campaign']) ? $template['campaign'] : null,
    351351                    'button-selector' => isset($template['button-selector']) ? $template['button-selector'] : null,
     352                    'parent-selector' => isset($template['parent-selector']) ? $template['parent-selector'] : null,
    352353                    'type'            => isset($template['type']) ? $template['type'] : null,
    353                     'bubble'            => isset($template['bubble']) ? $template['bubble'] : null
     354                    'bubble'          => isset($template['bubble']) ? $template['bubble'] : null,
     355                    'customcss'       => isset($template['customcss']) ? $template['customcss'] : null
    354356                ];
    355357
  • chatx-ai/trunk/public/class-chatx-ai-public.php

    r1744693 r1745993  
    5151        $this->api_key   = Chatx_Ai_Options::read('chatxai_api_key');
    5252
    53         $this->enable_carts_traking      = Chatx_Ai_Options::read('chatxai_enable_carts_tracking') == "yes";
    54         $this->login_checkbox_enable     = Chatx_Ai_Options::read('chatxai_login_checkbox_enable') == "yes";
    55         $this->register_checkbox_enable  = Chatx_Ai_Options::read('chatxai_register_checkbox_enable') == "yes";
    56         $this->addtocart_checkbox_enable = Chatx_Ai_Options::read('chatxai_enable_add_to_cart_tracking') == "yes";
     53        $this->enable_carts_traking              = Chatx_Ai_Options::read('chatxai_enable_carts_tracking') == "yes";
     54        $this->login_checkbox_enable             = Chatx_Ai_Options::read('chatxai_login_checkbox_enable') == "yes";
     55        $this->register_checkbox_enable          = Chatx_Ai_Options::read('chatxai_register_checkbox_enable') == "yes";
     56        $this->addtocart_checkbox_enable         = Chatx_Ai_Options::read('chatxai_enable_add_to_cart_tracking') == "yes";
    5757        $this->addtocart_archive_checkbox_enable = Chatx_Ai_Options::read('chatxai_enable_add_to_cart_archive_tracking') == "yes";
    5858
     
    116116                'method'  => 'POST',
    117117                'content' => http_build_query($data),
    118             )
     118            ),
    119119        );
    120120        $url     = CHATX_BAESURL . '/' . $url;
     
    140140    {
    141141        $session_tracker = Session_Tracker_Instance();
    142         $session_key = $session_tracker->get_tracking_key();
     142        $session_key     = $session_tracker->get_tracking_key();
    143143        $user_identifier = 'checkbox--' . $campaign . '--' . $session_key . '--' . time(true) . '--' . rand(0, 9999);
    144144
     
    163163            'type'            => 'form',
    164164            'button-selector' => '',
     165            'parent-selector' => '',
    165166            'template'        => null,
    166             'bubble'          => ''
     167            'bubble'          => '',
     168            'customcss'       => '',
     169            'id'              => ''
    167170        ], $atts, 'messenger_checkbox');
    168171
    169         if($atts['template']){
     172        if ($atts['template']) {
    170173            $checkbox_templates = Chatx_Ai_Options::read('chatxai_checkbox_templates', []);
    171174
     
    174177                $template_id = isset($template['id']) ? $template['id'] : null;
    175178
    176                 if($template_id == $atts['template']){
     179                if ($template_id == $atts['template']) {
    177180                    $foundTemplate = $template;
    178181                }
    179182            }
    180183
    181             if(!$foundTemplate){
    182                 if($atts['template'] == "default-add-to-cart-product-page"){
    183                     $atts['campaign'] = "add_to_cart_form";
     184            if (!$foundTemplate) {
     185                if ($atts['template'] == "default-add-to-cart-product-page") {
     186                    $atts['campaign']     = "add_to_cart_form";
    184187                    $checkbox_templates[] = [
    185                         'id' => "default-add-to-cart-product-page",
    186                         'campaign' => 'add_to_cart_form',
    187                         'type' => $atts['type'],
     188                        'id'              => "default-add-to-cart-product-page",
     189                        'campaign'        => 'add_to_cart_form',
     190                        'type'            => $atts['type'],
    188191                        'button-selector' => $atts['button-selector'],
    189                         'bubble' => '173 customers got amazing discounts by checking this.'
     192                        'bubble'          => '173 customers got amazing discounts by checking this.',
    190193                    ];
    191194                    Chatx_Ai_Options::update('chatxai_checkbox_templates', $checkbox_templates);
    192                 }
    193                 else if($atts['template'] == "default-add-to-cart-loop"){
    194                     $atts['campaign'] = "add_to_cart_form";
     195                } else if ($atts['template'] == "default-add-to-cart-loop") {
     196                    $atts['campaign']     = "add_to_cart_form";
    195197                    $checkbox_templates[] = [
    196                         'id' => "default-add-to-cart-loop",
    197                         'campaign' => 'add_to_cart_form',
    198                         'type' => 'button',
     198                        'id'              => "default-add-to-cart-loop",
     199                        'campaign'        => 'add_to_cart_form',
     200                        'type'            => 'button',
    199201                        'button-selector' => '.product a.add_to_cart_button,.product button.add_to_cart_button',
    200                         'bubble' => '173 customers got amazing discounts by checking this.'
     202                        'bubble'          => '173 customers got amazing discounts by checking this.',
    201203                    ];
    202204                    Chatx_Ai_Options::update('chatxai_checkbox_templates', $checkbox_templates);
    203                 }
    204                 else{
     205                } else {
    205206                    echo '<span style="color:red;">Invalid checkbox template!</span>';
    206207                    return;
    207208                }
    208             }
    209             else{
    210                 $atts['campaign'] = isset($foundTemplate['campaign']) ? $foundTemplate['campaign'] : '';
    211                 $atts['type'] = isset($foundTemplate['type']) ? $foundTemplate['type'] : '';
     209            } else {
     210                $atts['id']              = isset($foundTemplate['id']) ? $foundTemplate['id'] : '';
     211                $atts['campaign']        = isset($foundTemplate['campaign']) ? $foundTemplate['campaign'] : '';
     212                $atts['type']            = isset($foundTemplate['type']) ? $foundTemplate['type'] : '';
    212213                $atts['button-selector'] = isset($foundTemplate['button-selector']) ? $foundTemplate['button-selector'] : '';
    213                 $atts['bubble'] = isset($foundTemplate['bubble']) ? $foundTemplate['bubble'] : '173 customers got amazing discounts by checking this.';
     214                $atts['parent-selector'] = isset($foundTemplate['parent-selector']) ? $foundTemplate['parent-selector'] : '';
     215                $atts['bubble']          = isset($foundTemplate['bubble']) ? $foundTemplate['bubble'] : '173 customers got amazing discounts by checking this.';
     216                $atts['customcss']       = isset($foundTemplate['customcss']) ? $foundTemplate['customcss'] : '';
    214217            }
    215218        }
     
    268271        }
    269272
    270         if(!function_exists('ChatXACT')){
     273        if (!function_exists('ChatXACT')) {
    271274            return;
    272275        }
    273276
    274277        $current_ac = ChatXACT()->get_current_abandoned_cart();
    275         if($current_ac){
     278        if ($current_ac) {
    276279            return;
    277280        }
     
    286289        }
    287290
    288         if(!function_exists('ChatXACT')){
     291        if (!function_exists('ChatXACT')) {
    289292            return;
    290293        }
    291294
    292295        $current_ac = ChatXACT()->get_current_abandoned_cart();
    293         if($current_ac){
     296        if ($current_ac) {
    294297            return;
    295298        }
     
    303306    }
    304307
    305     function action_upgrade_completed( $upgrader_object, $options ) {
    306         if($options['action'] == 'update' && $options['type'] == 'plugin' && isset( $options['plugins'])){
     308    public function action_upgrade_completed($upgrader_object, $options)
     309    {
     310        if ($options['action'] == 'update' && $options['type'] == 'plugin' && isset($options['plugins'])) {
    307311            Chatx_Ai_Options::trigger_changes();
    308312        }
  • chatx-ai/trunk/public/css/chatx-ai-public.css

    r1744693 r1745993  
    3232.chatx-speech-bubble {
    3333    position: absolute;
    34     top: 65px;
    35     left: 0;
    36     z-index: 12;
     34    top: -7px;
     35    left: 69px;
     36    z-index: 123456734352;
    3737    margin: 0 auto;
    3838    padding: 10px;
    39     width: 300px;
     39    width: 240px;
    4040    height: 65px;
    4141    border-radius: 5px;
     
    5151    background: #f9f9f9;
    5252    border-radius: 50%;
    53     width: 30px;
    54     height: 30px;
     53    width: 24px;
     54    height: 24px;
    5555    position: absolute;
    56     right: -10px;
    57     top: -10px;
     56    right: -7px;
     57    top: -7px;
    5858    border: solid 2px #717171;
    59     font-size: 20px;
     59    font-size: 18px;
    6060    padding: 0;
    6161    outline: none;
     62    line-height: 0px;
    6263}
    6364
     
    8384    border-left: solid 50px #fff;
    8485    border-top: solid 6px #717171;
    85     top: 1px;
    86     left: 24px;
     86    top: 40px;
     87    left: -15px;
    8788    width: 0;
    8889    height: 1em;
    89     transform: rotate(45deg) skewX(75deg);
     90    transform: rotate(0deg) skewX(75deg);
    9091}
    9192
  • chatx-ai/trunk/public/js/chatx-ai-public.js

    r1744693 r1745993  
    44        this.loadFB();
    55        this.initBubble();
    6 
    7         /*
    8         jQuery('[name="add-to-cart"]').on('mousemove', function(event) {
    9             var offset = jQuery(this).offset();
    10 
    11             var btnX = event.pageX - offset.left;
    12             var btnY = event.pageY - offset.top;
    13 
    14             ChatxAI.canClick = true;
    15 
    16             jQuery('.chatx-checkbox-plugin').css({
    17                 position: "fixed",
    18                 opacity: "0.4",
    19                 left: (event.pageX) + "px",
    20                 top: (event.pageY) + "px",
    21                 height: "12px",
    22                 width: "12px",
    23                 overflow: "hidden"
    24             });
    25 
    26             jQuery("html").css("cursor", "pointer");
    27 
    28             jQuery('.chatx-checkbox-plugin .fb-messenger-checkbox').css({
    29                 position: "relative",
    30                 top: "-18px",
    31                 left: "-15px"
    32             })
    33        });
    34        */
    356    },
    367    cookies: {
     
    7142        jQuery('.chatx-checkbox-plugin').each(function(index, el) {
    7243            fb_app_id = jQuery(el).data('messenger_app_id');
     44
     45            var parentSelector = jQuery(el).data('parent-selector');
     46            if(parentSelector && jQuery(parentSelector).length){
     47                jQuery(el).closest('.chatx-checkbox-plugin-container').appendTo(parentSelector);
     48            }
     49
    7350            ChatxAI.initCheckboxPlugin(index, jQuery(el));
    7451        });
  • chatx-ai/trunk/public/partials/checkbox-plugin.php

    r1744693 r1745993  
    22<div class="chatx-checkbox-plugin-container">
    33    <div
    4         class="chatx-checkbox-plugin"
     4        class="chatx-checkbox-plugin chatx-checkbox-plugin-<?php echo isset($atts['id']) && $atts['id'] ? $atts['id'] : 'defaultid'; ?>"
    55        data-type="<?php echo $atts['type']; ?>"
    66        data-button-selector="<?php echo $atts['button-selector']; ?>"
     7        data-parent-selector="<?php echo $atts['parent-selector']; ?>"
    78        data-messenger_app_id="<?php echo $mess_app_id; ?>"
    89        data-page_id="<?php echo $page_id; ?>"
     
    1516        </div>
    1617
     18        <?php if(isset($atts['customcss']) && $atts['customcss']): ?>
     19            <style>
     20                <?php echo $atts['customcss']; ?>
     21            </style>
     22        <?php endif; ?>
     23
    1724        <span class="chatx-circle-mark"></span>
     25
    1826    </div>
    1927</div>
  • chatx-ai/trunk/readme.txt

    r1744693 r1745993  
    33Tags: abandoned cart, recover abandoned cart, woocommerce, chatbot, facebook messenger
    44Tested up to: 4.8.2
    5 Stable tag: 0.1.6
     5Stable tag: 0.1.7
    66Requires at least: 3.0
    77
     
    3838
    3939== Changelog ==
     40= 0.1.7 =
     41* Fixed the tooltip to look better on mobile.
     42* Added an option to modify the position of the checkbox in your website.
     43
    4044= 0.1.6 =
    4145* Added a quick fix for the checkbox not being checked by default.
Note: See TracChangeset for help on using the changeset viewer.