Plugin Directory

Changeset 3450006


Ignore:
Timestamp:
01/29/2026 08:45:33 PM (2 months ago)
Author:
caseyak
Message:

Release 1.8

Location:
caseyak
Files:
2 deleted
15 edited
2 copied

Legend:

Unmodified
Added
Removed
  • caseyak/tags/1.8/README.txt

    r3269071 r3450006  
    44Tags: legaltech, ai, mva, pi, chatbot, legal, accident, attorney
    55Requires at least: 5.0.0
    6 Tested up to: 6.8
     6Tested up to: 6.9
    77Requires PHP: 7.0
    8 Stable tag: 1.7
     8Stable tag: 1.8
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    8080* Bug fixes & misc improvements
    8181
     82= 1.8 =
     83* Add chat configuration controls and sync to server.
     84
    8285= 1.6 =
    8386* Bug fixes & misc improvements
  • caseyak/tags/1.8/admin/class-caseyak-admin.php

    r3065572 r3450006  
    5555    }
    5656
     57    private function sanitizeChatConfig( $input ) {
     58        $output = array();
     59        if ( !is_array( $input ) ) {
     60            return $output;
     61        }
     62        foreach ( $input as $key => $value ) {
     63            $safe_key = sanitize_key( $key );
     64            if ( is_array( $value ) ) {
     65                $output[ $safe_key ] = $this->sanitizeChatConfig( $value );
     66            } else {
     67                $output[ $safe_key ] = sanitize_text_field( $value );
     68            }
     69        }
     70        return $output;
     71    }
     72
    5773    /**
    5874     * Register the stylesheets for the admin area.
     
    98114        global $wpdb;
    99115        $caseyakTable = $wpdb->prefix . 'caseyak';
     116        self::ensureSchema( $caseyakTable );
    100117        $result = $wpdb->get_results("SELECT * FROM $caseyakTable ORDER BY updated DESC");
    101118        if (count($result) > 0) {
     
    103120        }
    104121        return null;
     122    }
     123
     124    private static function ensureSchema( $caseyakTable ) {
     125        global $wpdb;
     126        $column = $wpdb->get_results( $wpdb->prepare( "SHOW COLUMNS FROM $caseyakTable LIKE %s", 'chatConfig' ) );
     127        if ( empty( $column ) ) {
     128            $wpdb->query( "ALTER TABLE $caseyakTable ADD COLUMN chatConfig LONGTEXT NULL" );
     129        }
    105130    }
    106131
     
    136161    }
    137162
    138     function processFormSubmit() {
     163    function processFormSubmit() {
    139164        if ( isset($_POST['action']) && $_POST['action'] == 'yak_form_response' && isset($_POST['yak_nonce']) &&  wp_verify_nonce( sanitize_text_field( wp_unslash ( $_POST['yak_nonce'] ) ), 'yak_nonce') ) {
    140165
     
    164189            }
    165190
     191            $chatConfig = array();
     192            if ( isset( $_POST['chat_config'] ) && is_array( $_POST['chat_config'] ) ) {
     193                $chatConfig = $this->sanitizeChatConfig( $_POST['chat_config'] );
     194            }
     195            $chatConfigJson = wp_json_encode( $chatConfig );
     196
    166197            $wpdb->update($caseyakTable,
    167198                array(
     
    170201                    'yakContainerID' => $containerID,
    171202                    'yakEnabled' => $enabled,
     203                    'chatConfig' => $chatConfigJson,
    172204                    'updated' => time()
    173205                ),
    174206                array('ID' => $instanceID ));
     207
     208            // sync chat config to server (best effort)
     209            if ( isset( $instanceID ) ) {
     210                $instance = self::getInstance();
     211                if ( $instance && isset( $instance->subscriptionID ) ) {
     212                    $api_base = defined( 'CASEYAK_API_BASE' ) ? CASEYAK_API_BASE : 'https://www.pakalapp.com';
     213                    $api_base = rtrim( $api_base, '/' );
     214                    $sync_body = array(
     215                        'subscriptionID' => $instance->subscriptionID,
     216                        'chat_config' => $chatConfig
     217                    );
     218                    $sync_args = array(
     219                        'body'        => wp_json_encode( $sync_body ),
     220                        'timeout'     => '5',
     221                        'redirection' => '5',
     222                        'httpversion' => '1.0',
     223                        'blocking'    => true,
     224                        'headers'     => array (
     225                            'Content-Type' => 'application/json',
     226                            'Accept' => 'application/json'
     227                        ),
     228                        'cookies'     => array(),
     229                    );
     230                    $sync_request = wp_remote_post( $api_base . '/v1/kesu_flimr_nubs_config_update', $sync_args );
     231                    if ( is_wp_error( $sync_request ) ) {
     232                        error_log( 'CaseYak chat_config sync failed: ' . $sync_request->get_error_message() );
     233                    } else {
     234                        $sync_code = wp_remote_retrieve_response_code( $sync_request );
     235                        if ( $sync_code != 200 ) {
     236                            error_log( 'CaseYak chat_config sync failed (HTTP ' . $sync_code . '): ' . wp_remote_retrieve_body( $sync_request ) );
     237                        }
     238                    }
     239                }
     240            }
    175241
    176242            // // redirect
     
    197263            );
    198264            // execute!
    199             $request = wp_remote_post( 'https://www.pakalapp.com/api/v1/kesu_flimr_nubs_config', $args );
     265            $api_base = defined( 'CASEYAK_API_BASE' ) ? CASEYAK_API_BASE : 'https://www.pakalapp.com';
     266            $api_base = rtrim( $api_base, '/' );
     267            $request = wp_remote_post( $api_base . '/v1/kesu_flimr_nubs_config', $args );
    200268            $json = json_decode( wp_remote_retrieve_body( $request ), true );
    201269            $httpcode = wp_remote_retrieve_response_code ( $request );
    202             if( $httpcode == 200) {
     270            $error_message = null;
     271            if ( is_wp_error( $request ) ) {
     272                $error_message = $request->get_error_message();
     273            } elseif ( $httpcode != 200 ) {
     274                $error_message = 'Subscription lookup failed (HTTP ' . $httpcode . ').';
     275            } elseif ( !is_array( $json ) || empty( $json['auth_token'] ) || empty( $json['firm_id'] ) || empty( $json['slide_position'] ) ) {
     276                $error_message = 'Subscription lookup failed (invalid response).';
     277            }
     278
     279            if ( $error_message ) {
     280                error_log( 'CaseYak subscription lookup error for ' . $manualSubID . ': ' . $error_message . ' | Response: ' . wp_remote_retrieve_body( $request ) );
     281                $transient_key = 'caseyak_admin_error_' . get_current_user_id();
     282                set_transient( $transient_key, $error_message, 60 );
     283            } else {
    203284                $yakToken = $json['auth_token'];
    204285                $slidePosition = $json['slide_position'];
    205286                $firmID = $json['firm_id'];
     287                $chatConfig = array();
     288                if ( isset( $json['chat_config'] ) && is_array( $json['chat_config'] ) ) {
     289                    $chatConfig = $json['chat_config'];
     290                }
    206291                $isActive = 1;
    207292                // save in DB!
     
    215300                    'yakEnabled'        => true,
    216301                    'yakContainerID'    => '',
     302                    'chatConfig'        => wp_json_encode( $chatConfig ),
    217303                    'updated'           => time()
    218304                );
     
    239325            $subscriptionID = $instance->subscriptionID;
    240326            $lastChanged = date('m/d/Y', $instance->updated);
     327            $chatConfig = array();
     328            if ( isset( $instance->chatConfig ) ) {
     329                $decoded = json_decode( $instance->chatConfig, true );
     330                if ( is_array( $decoded ) ) {
     331                    $chatConfig = $decoded;
     332                }
     333            }
    241334            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/partials/caseyak-admin-display.php';
    242335        } else {
     336            $transient_key = 'caseyak_admin_error_' . get_current_user_id();
     337            $admin_error = get_transient( $transient_key );
     338            if ( $admin_error ) {
     339                delete_transient( $transient_key );
     340                $error = $admin_error;
     341            }
    243342            $vertical_icon = plugin_dir_url( __FILE__ ) . '/images/cy.png';
    244343            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/partials/caseyak-admin-new.php';
  • caseyak/tags/1.8/admin/partials/caseyak-admin-display.php

    r3065572 r3450006  
    3333                        <li><strong>Container ID:</strong> Tells the plugin to embed itself in a standalone element with this ID. Useful for standalone pages.</li>
    3434                        <li><strong>Enabled:</strong> Quickly disables or enables the plugin without uninstalling via WordPress.</li>
     35                        <li><strong>Chat Bubble:</strong> Customize the launch bubble (background, text, and typography).</li>
     36                        <li><strong>Locale:</strong> Sets the language/locale (experimental).</li>
     37                        <li><strong>Workflow ID:</strong> Optional workflow override (experimental).</li>
    3538                    </ul>
    36                     <div class="notification is-primary is-light" style="padding:8px;margin-top: 8px;">
    37                         Looking for more customization options? Email us! <strong>kenny@caseyak.com</strong>
    38                     </div>
    3939                </div>
    4040            </div>
     
    4242                <input type="hidden" name="action" value="yak_form_response">
    4343                <input type="hidden" name="yak_nonce" value="<?php echo esc_attr( wp_create_nonce( 'yak_nonce' ) ); ?>" />
     44                <?php
     45                  $bubble = isset( $chatConfig['bubble'] ) && is_array( $chatConfig['bubble'] ) ? $chatConfig['bubble'] : array();
     46                  $chatkit = isset( $chatConfig['chatkit'] ) && is_array( $chatConfig['chatkit'] ) ? $chatConfig['chatkit'] : array();
     47                  $workflow_id = isset( $chatConfig['workflow_id'] ) ? $chatConfig['workflow_id'] : '';
     48                ?>
    4449                <div class="field" style="margin-top:20px">
    4550                  <label class="label" style="margin-bottom: 0px;">Slide Position</label>
     
    7782                    </p>
    7883                </div>
     84                <hr>
     85                <div class="field" style="margin-top:20px">
     86                  <label class="label" style="margin-bottom: 0px;">Chat Bubble</label>
     87                  <p class="is-size-7" style="margin-bottom:10px">Customize the launch bubble.</p>
     88                  <div class="columns is-multiline">
     89                    <div class="column is-half">
     90                      <label class="label is-size-7">Background</label>
     91                      <input class="input is-size-7" type="text" name="chat_config[bubble][background]" value="<?php echo esc_attr( isset( $bubble['background'] ) ? $bubble['background'] : '' ); ?>" placeholder="#000000">
     92                    </div>
     93                    <div class="column is-half">
     94                      <label class="label is-size-7">Color</label>
     95                      <input class="input is-size-7" type="text" name="chat_config[bubble][color]" value="<?php echo esc_attr( isset( $bubble['color'] ) ? $bubble['color'] : '' ); ?>" placeholder="#ffffff">
     96                    </div>
     97                    <div class="column is-half">
     98                      <label class="label is-size-7">Font Size</label>
     99                      <input class="input is-size-7" type="text" name="chat_config[bubble][fontSize]" value="<?php echo esc_attr( isset( $bubble['fontSize'] ) ? $bubble['fontSize'] : '' ); ?>" placeholder="14px">
     100                    </div>
     101                    <div class="column is-half">
     102                      <label class="label is-size-7">Font Family</label>
     103                      <input class="input is-size-7" type="text" name="chat_config[bubble][fontFamily]" value="<?php echo esc_attr( isset( $bubble['fontFamily'] ) ? $bubble['fontFamily'] : '' ); ?>" placeholder="Arial, sans-serif">
     104                    </div>
     105                    <div class="column is-full">
     106                      <label class="label is-size-7">Bubble Text</label>
     107                      <input class="input is-size-7" type="text" name="chat_config[bubble][bubbleText]" value="<?php echo esc_attr( isset( $bubble['bubbleText'] ) ? $bubble['bubbleText'] : '' ); ?>" placeholder="Chat with us">
     108                    </div>
     109                  </div>
     110                </div>
     111
     112                <div class="field" style="margin-top:20px">
     113                  <label class="label" style="margin-bottom: 0px;">Chatbot</label>
     114                  <p class="is-size-7" style="margin-bottom:10px">Configure Chatbot settings.</p>
     115                  <div class="columns is-multiline">
     116                    <div class="column is-half">
     117                      <label class="label is-size-7">Locale</label>
     118                      <input class="input is-size-7" type="text" name="chat_config[chatkit][locale]" value="<?php echo esc_attr( isset( $chatkit['locale'] ) ? $chatkit['locale'] : '' ); ?>" placeholder="en">
     119                    </div>
     120                  </div>
     121                </div>
     122
     123                <div class="field" style="margin-top:20px">
     124                  <label class="label" style="margin-bottom: 0px;">Workflow ID</label>
     125                  <p class="is-size-7" style="margin-bottom:5px">Optional workflow ID override.</p>
     126                  <input class="input is-size-7" type="text" name="chat_config[workflow_id]" value="<?php echo esc_attr( $workflow_id ); ?>" placeholder="workflow_id">
     127                </div>
    79128                <div class="field is-grouped" style="margin-top:30px;">
    80129                    <div class="control">
  • caseyak/tags/1.8/admin/partials/caseyak-admin-new.php

    r3065572 r3450006  
    1818    if (isset($error)) { ?>
    1919<div class="notification is-danger is-light" style="margin:2em;">
    20   Oops, we ecountered an error ?>
     20  Oops, we encountered an error: <?php echo esc_html( $error ); ?>
    2121</div>
    2222    <?php }
     
    7070</section>
    7171<?php }
    72 
  • caseyak/tags/1.8/caseyak.php

    r3266658 r3450006  
    1717 * Plugin URI:        https://caseyak.com/wordpress
    1818 * Description:       The CaseYak AI Case Value Calculator.
    19  * Version:           1.7
     19 * Version:           1.8
    2020 * Author:            CaseYak
    2121 * Author URI:        https://caseyak.com
     
    3636 * Rename this for your plugin and update it as you release new versions.
    3737 */
    38 define( 'CASEYAK_VERSION', '1.7' );
     38define( 'CASEYAK_VERSION', '1.8' );
    3939
    4040/**
  • caseyak/tags/1.8/includes/class-caseyak-activator.php

    r3065572 r3450006  
    5151                        yakEnabled BOOLEAN NOT NULL,
    5252                        yakContainerID VARCHAR(255) NOT NULL,
     53                        chatConfig LONGTEXT NULL,
    5354                        updated VARCHAR(255) NOT NULL,
    5455                        PRIMARY KEY  (ID)
  • caseyak/tags/1.8/public/class-caseyak-public.php

    r3266658 r3450006  
    7171            $slidePosition = $instance->slidePosition;
    7272            $container = $instance->yakContainerID;
     73            $chatConfig = array();
     74            if ( isset( $instance->chatConfig ) ) {
     75                $decoded = json_decode( $instance->chatConfig, true );
     76                if ( is_array( $decoded ) ) {
     77                    $chatConfig = $decoded;
     78                }
     79            }
    7380            if ($instance->yakEnabled) {
    7481                require_once $file;
  • caseyak/tags/1.8/public/partials/caseyak-script.php

    r3065572 r3450006  
    11<?php
    22if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
    3     if($expanded && $container && $container != '') { ?>
    4         <script caseyak-container-id="<?php echo esc_attr($container) ?>" yak-token="<?php echo esc_attr( $token ) ?>" src='<?php echo esc_url( $mvaScript ) ?>' expanded='true'></script>
    5    <?php } else { ?>
    6         <script yak-token="<?php echo esc_attr($token) ?>" src='<?php echo esc_url( $mvaScript ) ?>' slide-position="<?php echo esc_attr( $slidePosition) ?>"></script>
    7     <?php }
     3    $workflow_id = '';
     4    if ( isset( $chatConfig['workflow_id'] ) ) {
     5        $workflow_id = $chatConfig['workflow_id'];
     6    }
    87?>
     8<script>
     9  window.__CASEYAK_CHAT_CONFIG = <?php echo wp_json_encode( $chatConfig ); ?>;
     10</script>
     11<?php if($expanded && $container && $container != '') { ?>
     12    <script caseyak-container-id="<?php echo esc_attr($container) ?>" yak-token="<?php echo esc_attr( $token ) ?>" src='<?php echo esc_url( $mvaScript ) ?>' expanded='true'<?php echo $workflow_id ? " workflow-id='" . esc_attr( $workflow_id ) . "'" : ""; ?>></script>
     13<?php } else { ?>
     14    <script yak-token="<?php echo esc_attr($token) ?>" src='<?php echo esc_url( $mvaScript ) ?>' slide-position="<?php echo esc_attr( $slidePosition) ?>"<?php echo $workflow_id ? " workflow-id='" . esc_attr( $workflow_id ) . "'" : ""; ?>></script>
     15<?php } ?>
     16?>
  • caseyak/trunk/README.txt

    r3269071 r3450006  
    44Tags: legaltech, ai, mva, pi, chatbot, legal, accident, attorney
    55Requires at least: 5.0.0
    6 Tested up to: 6.8
     6Tested up to: 6.9
    77Requires PHP: 7.0
    8 Stable tag: 1.7
     8Stable tag: 1.8
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    8080* Bug fixes & misc improvements
    8181
     82= 1.8 =
     83* Add chat configuration controls and sync to server.
     84
    8285= 1.6 =
    8386* Bug fixes & misc improvements
  • caseyak/trunk/admin/class-caseyak-admin.php

    r3065572 r3450006  
    5555    }
    5656
     57    private function sanitizeChatConfig( $input ) {
     58        $output = array();
     59        if ( !is_array( $input ) ) {
     60            return $output;
     61        }
     62        foreach ( $input as $key => $value ) {
     63            $safe_key = sanitize_key( $key );
     64            if ( is_array( $value ) ) {
     65                $output[ $safe_key ] = $this->sanitizeChatConfig( $value );
     66            } else {
     67                $output[ $safe_key ] = sanitize_text_field( $value );
     68            }
     69        }
     70        return $output;
     71    }
     72
    5773    /**
    5874     * Register the stylesheets for the admin area.
     
    98114        global $wpdb;
    99115        $caseyakTable = $wpdb->prefix . 'caseyak';
     116        self::ensureSchema( $caseyakTable );
    100117        $result = $wpdb->get_results("SELECT * FROM $caseyakTable ORDER BY updated DESC");
    101118        if (count($result) > 0) {
     
    103120        }
    104121        return null;
     122    }
     123
     124    private static function ensureSchema( $caseyakTable ) {
     125        global $wpdb;
     126        $column = $wpdb->get_results( $wpdb->prepare( "SHOW COLUMNS FROM $caseyakTable LIKE %s", 'chatConfig' ) );
     127        if ( empty( $column ) ) {
     128            $wpdb->query( "ALTER TABLE $caseyakTable ADD COLUMN chatConfig LONGTEXT NULL" );
     129        }
    105130    }
    106131
     
    136161    }
    137162
    138     function processFormSubmit() {
     163    function processFormSubmit() {
    139164        if ( isset($_POST['action']) && $_POST['action'] == 'yak_form_response' && isset($_POST['yak_nonce']) &&  wp_verify_nonce( sanitize_text_field( wp_unslash ( $_POST['yak_nonce'] ) ), 'yak_nonce') ) {
    140165
     
    164189            }
    165190
     191            $chatConfig = array();
     192            if ( isset( $_POST['chat_config'] ) && is_array( $_POST['chat_config'] ) ) {
     193                $chatConfig = $this->sanitizeChatConfig( $_POST['chat_config'] );
     194            }
     195            $chatConfigJson = wp_json_encode( $chatConfig );
     196
    166197            $wpdb->update($caseyakTable,
    167198                array(
     
    170201                    'yakContainerID' => $containerID,
    171202                    'yakEnabled' => $enabled,
     203                    'chatConfig' => $chatConfigJson,
    172204                    'updated' => time()
    173205                ),
    174206                array('ID' => $instanceID ));
     207
     208            // sync chat config to server (best effort)
     209            if ( isset( $instanceID ) ) {
     210                $instance = self::getInstance();
     211                if ( $instance && isset( $instance->subscriptionID ) ) {
     212                    $api_base = defined( 'CASEYAK_API_BASE' ) ? CASEYAK_API_BASE : 'https://www.pakalapp.com';
     213                    $api_base = rtrim( $api_base, '/' );
     214                    $sync_body = array(
     215                        'subscriptionID' => $instance->subscriptionID,
     216                        'chat_config' => $chatConfig
     217                    );
     218                    $sync_args = array(
     219                        'body'        => wp_json_encode( $sync_body ),
     220                        'timeout'     => '5',
     221                        'redirection' => '5',
     222                        'httpversion' => '1.0',
     223                        'blocking'    => true,
     224                        'headers'     => array (
     225                            'Content-Type' => 'application/json',
     226                            'Accept' => 'application/json'
     227                        ),
     228                        'cookies'     => array(),
     229                    );
     230                    $sync_request = wp_remote_post( $api_base . '/v1/kesu_flimr_nubs_config_update', $sync_args );
     231                    if ( is_wp_error( $sync_request ) ) {
     232                        error_log( 'CaseYak chat_config sync failed: ' . $sync_request->get_error_message() );
     233                    } else {
     234                        $sync_code = wp_remote_retrieve_response_code( $sync_request );
     235                        if ( $sync_code != 200 ) {
     236                            error_log( 'CaseYak chat_config sync failed (HTTP ' . $sync_code . '): ' . wp_remote_retrieve_body( $sync_request ) );
     237                        }
     238                    }
     239                }
     240            }
    175241
    176242            // // redirect
     
    197263            );
    198264            // execute!
    199             $request = wp_remote_post( 'https://www.pakalapp.com/api/v1/kesu_flimr_nubs_config', $args );
     265            $api_base = defined( 'CASEYAK_API_BASE' ) ? CASEYAK_API_BASE : 'https://www.pakalapp.com';
     266            $api_base = rtrim( $api_base, '/' );
     267            $request = wp_remote_post( $api_base . '/v1/kesu_flimr_nubs_config', $args );
    200268            $json = json_decode( wp_remote_retrieve_body( $request ), true );
    201269            $httpcode = wp_remote_retrieve_response_code ( $request );
    202             if( $httpcode == 200) {
     270            $error_message = null;
     271            if ( is_wp_error( $request ) ) {
     272                $error_message = $request->get_error_message();
     273            } elseif ( $httpcode != 200 ) {
     274                $error_message = 'Subscription lookup failed (HTTP ' . $httpcode . ').';
     275            } elseif ( !is_array( $json ) || empty( $json['auth_token'] ) || empty( $json['firm_id'] ) || empty( $json['slide_position'] ) ) {
     276                $error_message = 'Subscription lookup failed (invalid response).';
     277            }
     278
     279            if ( $error_message ) {
     280                error_log( 'CaseYak subscription lookup error for ' . $manualSubID . ': ' . $error_message . ' | Response: ' . wp_remote_retrieve_body( $request ) );
     281                $transient_key = 'caseyak_admin_error_' . get_current_user_id();
     282                set_transient( $transient_key, $error_message, 60 );
     283            } else {
    203284                $yakToken = $json['auth_token'];
    204285                $slidePosition = $json['slide_position'];
    205286                $firmID = $json['firm_id'];
     287                $chatConfig = array();
     288                if ( isset( $json['chat_config'] ) && is_array( $json['chat_config'] ) ) {
     289                    $chatConfig = $json['chat_config'];
     290                }
    206291                $isActive = 1;
    207292                // save in DB!
     
    215300                    'yakEnabled'        => true,
    216301                    'yakContainerID'    => '',
     302                    'chatConfig'        => wp_json_encode( $chatConfig ),
    217303                    'updated'           => time()
    218304                );
     
    239325            $subscriptionID = $instance->subscriptionID;
    240326            $lastChanged = date('m/d/Y', $instance->updated);
     327            $chatConfig = array();
     328            if ( isset( $instance->chatConfig ) ) {
     329                $decoded = json_decode( $instance->chatConfig, true );
     330                if ( is_array( $decoded ) ) {
     331                    $chatConfig = $decoded;
     332                }
     333            }
    241334            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/partials/caseyak-admin-display.php';
    242335        } else {
     336            $transient_key = 'caseyak_admin_error_' . get_current_user_id();
     337            $admin_error = get_transient( $transient_key );
     338            if ( $admin_error ) {
     339                delete_transient( $transient_key );
     340                $error = $admin_error;
     341            }
    243342            $vertical_icon = plugin_dir_url( __FILE__ ) . '/images/cy.png';
    244343            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/partials/caseyak-admin-new.php';
  • caseyak/trunk/admin/partials/caseyak-admin-display.php

    r3065572 r3450006  
    3333                        <li><strong>Container ID:</strong> Tells the plugin to embed itself in a standalone element with this ID. Useful for standalone pages.</li>
    3434                        <li><strong>Enabled:</strong> Quickly disables or enables the plugin without uninstalling via WordPress.</li>
     35                        <li><strong>Chat Bubble:</strong> Customize the launch bubble (background, text, and typography).</li>
     36                        <li><strong>Locale:</strong> Sets the language/locale (experimental).</li>
     37                        <li><strong>Workflow ID:</strong> Optional workflow override (experimental).</li>
    3538                    </ul>
    36                     <div class="notification is-primary is-light" style="padding:8px;margin-top: 8px;">
    37                         Looking for more customization options? Email us! <strong>kenny@caseyak.com</strong>
    38                     </div>
    3939                </div>
    4040            </div>
     
    4242                <input type="hidden" name="action" value="yak_form_response">
    4343                <input type="hidden" name="yak_nonce" value="<?php echo esc_attr( wp_create_nonce( 'yak_nonce' ) ); ?>" />
     44                <?php
     45                  $bubble = isset( $chatConfig['bubble'] ) && is_array( $chatConfig['bubble'] ) ? $chatConfig['bubble'] : array();
     46                  $chatkit = isset( $chatConfig['chatkit'] ) && is_array( $chatConfig['chatkit'] ) ? $chatConfig['chatkit'] : array();
     47                  $workflow_id = isset( $chatConfig['workflow_id'] ) ? $chatConfig['workflow_id'] : '';
     48                ?>
    4449                <div class="field" style="margin-top:20px">
    4550                  <label class="label" style="margin-bottom: 0px;">Slide Position</label>
     
    7782                    </p>
    7883                </div>
     84                <hr>
     85                <div class="field" style="margin-top:20px">
     86                  <label class="label" style="margin-bottom: 0px;">Chat Bubble</label>
     87                  <p class="is-size-7" style="margin-bottom:10px">Customize the launch bubble.</p>
     88                  <div class="columns is-multiline">
     89                    <div class="column is-half">
     90                      <label class="label is-size-7">Background</label>
     91                      <input class="input is-size-7" type="text" name="chat_config[bubble][background]" value="<?php echo esc_attr( isset( $bubble['background'] ) ? $bubble['background'] : '' ); ?>" placeholder="#000000">
     92                    </div>
     93                    <div class="column is-half">
     94                      <label class="label is-size-7">Color</label>
     95                      <input class="input is-size-7" type="text" name="chat_config[bubble][color]" value="<?php echo esc_attr( isset( $bubble['color'] ) ? $bubble['color'] : '' ); ?>" placeholder="#ffffff">
     96                    </div>
     97                    <div class="column is-half">
     98                      <label class="label is-size-7">Font Size</label>
     99                      <input class="input is-size-7" type="text" name="chat_config[bubble][fontSize]" value="<?php echo esc_attr( isset( $bubble['fontSize'] ) ? $bubble['fontSize'] : '' ); ?>" placeholder="14px">
     100                    </div>
     101                    <div class="column is-half">
     102                      <label class="label is-size-7">Font Family</label>
     103                      <input class="input is-size-7" type="text" name="chat_config[bubble][fontFamily]" value="<?php echo esc_attr( isset( $bubble['fontFamily'] ) ? $bubble['fontFamily'] : '' ); ?>" placeholder="Arial, sans-serif">
     104                    </div>
     105                    <div class="column is-full">
     106                      <label class="label is-size-7">Bubble Text</label>
     107                      <input class="input is-size-7" type="text" name="chat_config[bubble][bubbleText]" value="<?php echo esc_attr( isset( $bubble['bubbleText'] ) ? $bubble['bubbleText'] : '' ); ?>" placeholder="Chat with us">
     108                    </div>
     109                  </div>
     110                </div>
     111
     112                <div class="field" style="margin-top:20px">
     113                  <label class="label" style="margin-bottom: 0px;">Chatbot</label>
     114                  <p class="is-size-7" style="margin-bottom:10px">Configure Chatbot settings.</p>
     115                  <div class="columns is-multiline">
     116                    <div class="column is-half">
     117                      <label class="label is-size-7">Locale</label>
     118                      <input class="input is-size-7" type="text" name="chat_config[chatkit][locale]" value="<?php echo esc_attr( isset( $chatkit['locale'] ) ? $chatkit['locale'] : '' ); ?>" placeholder="en">
     119                    </div>
     120                  </div>
     121                </div>
     122
     123                <div class="field" style="margin-top:20px">
     124                  <label class="label" style="margin-bottom: 0px;">Workflow ID</label>
     125                  <p class="is-size-7" style="margin-bottom:5px">Optional workflow ID override.</p>
     126                  <input class="input is-size-7" type="text" name="chat_config[workflow_id]" value="<?php echo esc_attr( $workflow_id ); ?>" placeholder="workflow_id">
     127                </div>
    79128                <div class="field is-grouped" style="margin-top:30px;">
    80129                    <div class="control">
  • caseyak/trunk/admin/partials/caseyak-admin-new.php

    r3065572 r3450006  
    1818    if (isset($error)) { ?>
    1919<div class="notification is-danger is-light" style="margin:2em;">
    20   Oops, we ecountered an error ?>
     20  Oops, we encountered an error: <?php echo esc_html( $error ); ?>
    2121</div>
    2222    <?php }
     
    7070</section>
    7171<?php }
    72 
  • caseyak/trunk/caseyak.php

    r3266658 r3450006  
    1717 * Plugin URI:        https://caseyak.com/wordpress
    1818 * Description:       The CaseYak AI Case Value Calculator.
    19  * Version:           1.7
     19 * Version:           1.8
    2020 * Author:            CaseYak
    2121 * Author URI:        https://caseyak.com
     
    3636 * Rename this for your plugin and update it as you release new versions.
    3737 */
    38 define( 'CASEYAK_VERSION', '1.7' );
     38define( 'CASEYAK_VERSION', '1.8' );
    3939
    4040/**
  • caseyak/trunk/includes/class-caseyak-activator.php

    r3065572 r3450006  
    5151                        yakEnabled BOOLEAN NOT NULL,
    5252                        yakContainerID VARCHAR(255) NOT NULL,
     53                        chatConfig LONGTEXT NULL,
    5354                        updated VARCHAR(255) NOT NULL,
    5455                        PRIMARY KEY  (ID)
  • caseyak/trunk/public/class-caseyak-public.php

    r3266658 r3450006  
    7171            $slidePosition = $instance->slidePosition;
    7272            $container = $instance->yakContainerID;
     73            $chatConfig = array();
     74            if ( isset( $instance->chatConfig ) ) {
     75                $decoded = json_decode( $instance->chatConfig, true );
     76                if ( is_array( $decoded ) ) {
     77                    $chatConfig = $decoded;
     78                }
     79            }
    7380            if ($instance->yakEnabled) {
    7481                require_once $file;
  • caseyak/trunk/public/partials/caseyak-script.php

    r3065572 r3450006  
    11<?php
    22if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
    3     if($expanded && $container && $container != '') { ?>
    4         <script caseyak-container-id="<?php echo esc_attr($container) ?>" yak-token="<?php echo esc_attr( $token ) ?>" src='<?php echo esc_url( $mvaScript ) ?>' expanded='true'></script>
    5    <?php } else { ?>
    6         <script yak-token="<?php echo esc_attr($token) ?>" src='<?php echo esc_url( $mvaScript ) ?>' slide-position="<?php echo esc_attr( $slidePosition) ?>"></script>
    7     <?php }
     3    $workflow_id = '';
     4    if ( isset( $chatConfig['workflow_id'] ) ) {
     5        $workflow_id = $chatConfig['workflow_id'];
     6    }
    87?>
     8<script>
     9  window.__CASEYAK_CHAT_CONFIG = <?php echo wp_json_encode( $chatConfig ); ?>;
     10</script>
     11<?php if($expanded && $container && $container != '') { ?>
     12    <script caseyak-container-id="<?php echo esc_attr($container) ?>" yak-token="<?php echo esc_attr( $token ) ?>" src='<?php echo esc_url( $mvaScript ) ?>' expanded='true'<?php echo $workflow_id ? " workflow-id='" . esc_attr( $workflow_id ) . "'" : ""; ?>></script>
     13<?php } else { ?>
     14    <script yak-token="<?php echo esc_attr($token) ?>" src='<?php echo esc_url( $mvaScript ) ?>' slide-position="<?php echo esc_attr( $slidePosition) ?>"<?php echo $workflow_id ? " workflow-id='" . esc_attr( $workflow_id ) . "'" : ""; ?>></script>
     15<?php } ?>
     16?>
Note: See TracChangeset for help on using the changeset viewer.