Plugin Directory

Changeset 3487326


Ignore:
Timestamp:
03/20/2026 04:12:34 PM (13 days ago)
Author:
selektable
Message:

Update to version v1.10.0 from GitHub

Location:
selektable
Files:
10 edited
1 copied

Legend:

Unmodified
Added
Removed
  • selektable/tags/v1.10.0/assets/js/admin.js

    r3483715 r3487326  
    113113            });
    114114
    115             // Widget ID change (update shortcode)
     115            // Widget ID change — strip prefix if pasted, update shortcode
    116116            $(document).on('input', '#selektable-widget-id', function () {
     117                var $input = $(this);
     118                var val = $input.val();
     119                if (val.indexOf('wgt_') === 0) {
     120                    $input.val(val.substring(4));
     121                }
    117122                self.updateShortcodePreview();
    118123            });
     
    216221        },
    217222
     223        /**
     224         * Strip a known prefix (e.g. "wgt_", "store_") from a value.
     225         */
     226        stripPrefix: function (value, prefix) {
     227            if (value && value.indexOf(prefix) === 0) {
     228                return value.substring(prefix.length);
     229            }
     230            return value;
     231        },
     232
    218233        populateForm: function (integration) {
    219234            $('#selektable-int-id').val(integration.id);
    220235            $('#selektable-int-type').val(integration.type);
    221             $('#selektable-widget-id').val(integration.widget_id || '');
     236            $('#selektable-widget-id').val(this.stripPrefix(integration.widget_id || '', 'wgt_'));
    222237            $('#selektable-button-text').val(integration.button_text || 'Try it on');
    223238            $('#selektable-button-class').val(integration.button_class || 'button selektable-try-on');
     
    294309
    295310        updateShortcodePreview: function () {
    296             var widgetId = $('#selektable-widget-id').val();
     311            var rawVal = $.trim($('#selektable-widget-id').val());
     312            var widgetId = this.stripPrefix(rawVal, 'wgt_');
    297313            var shortcode = '[selektable_button';
    298314            if (widgetId) {
    299                 shortcode += ' widget_id="' + widgetId + '"';
     315                shortcode += ' widget_id="wgt_' + widgetId + '"';
    300316            }
    301317            shortcode += ']';
     
    317333        saveIntegration: function () {
    318334            var self = this;
    319             var widgetId = $('#selektable-widget-id').val();
     335            var rawWidgetId = $.trim($('#selektable-widget-id').val());
     336            // Strip wgt_ prefix if pasted, server will re-add it.
     337            var widgetId = self.stripPrefix(rawWidgetId, 'wgt_');
    320338
    321339            if (!widgetId) {
     
    485503            SelektableAdmin.init();
    486504        }
     505
     506        // Auto-strip store_ prefix if pasted into the settings store ID input
     507        $('#selektable_store_id').on('input', function () {
     508            var val = $(this).val();
     509            if (val.indexOf('store_') === 0) {
     510                $(this).val(val.substring(6));
     511            }
     512        });
    487513    });
    488514
  • selektable/tags/v1.10.0/assets/js/onboarding.js

    r3483715 r3487326  
    173173
    174174    // ------------------------------------------------------------------ //
     175    // Auto-strip prefixes when pasted into prefixed inputs                 //
     176    // ------------------------------------------------------------------ //
     177    $('#slk-store-id').on('input', function () {
     178        var val = $(this).val();
     179        if (val.indexOf('store_') === 0) {
     180            $(this).val(val.substring(6));
     181        }
     182    });
     183
     184    $('#slk-widget-id').on('input', function () {
     185        var val = $(this).val();
     186        if (val.indexOf('wgt_') === 0) {
     187            $(this).val(val.substring(4));
     188        } else if (val.indexOf('widget_') === 0) {
     189            $(this).val(val.substring(7));
     190        }
     191    });
     192
     193    // ------------------------------------------------------------------ //
    175194    // Focus styles for custom input wrappers                               //
    176195    // ------------------------------------------------------------------ //
  • selektable/tags/v1.10.0/includes/class-selektable-admin.php

    r3487227 r3487326  
    9595
    9696        if ($section === 'general' && isset($_POST['selektable_store_id'])) {
    97             update_option('selektable_store_id', sanitize_text_field(wp_unslash($_POST['selektable_store_id'])));
     97            $store_id = sanitize_text_field(wp_unslash($_POST['selektable_store_id']));
     98            $store_id = preg_replace('/^store_/', '', $store_id);
     99            if (!empty($store_id)) {
     100                $store_id = 'store_' . $store_id;
     101            }
     102            update_option('selektable_store_id', $store_id);
    98103        }
    99104
     
    114119        $categories   = $wc_active ? $this->get_product_categories() : [];
    115120        $tags         = $wc_active ? $this->get_product_tags() : [];
    116         $store_id     = get_option('selektable_store_id', '');
     121        $store_id_raw = get_option('selektable_store_id', '');
     122        $store_id     = preg_replace('/^store_/', '', $store_id_raw);
    117123        $app_url      = get_option('selektable_app_url', 'https://app.selektable.com');
    118         $is_connected = !empty($store_id);
     124        $is_connected = !empty($store_id_raw);
    119125        $int_count    = count($integrations);
    120126        $wc_int_count = count(array_filter($integrations, fn($i) => $i['type'] === 'wc_product_page'));
     
    534540                                    <div class="selektable-form-row">
    535541                                        <label for="selektable-widget-id"><?php esc_html_e('Widget ID', 'selektable'); ?> <span class="required">*</span></label>
    536                                         <input type="text" id="selektable-widget-id" placeholder="wgt_abc123">
     542                                        <div class="slk-input-prefixed">
     543                                            <span class="slk-input-prefix" aria-hidden="true">wgt_</span>
     544                                            <input type="text" id="selektable-widget-id" placeholder="abc123">
     545                                        </div>
    537546                                        <p class="description"><?php esc_html_e('Your Selektable widget ID. Find this in your Selektable dashboard.', 'selektable'); ?></p>
    538547                                    </div>
     
    832841        $widget_id = isset($_POST['widget_id']) ? sanitize_text_field(wp_unslash($_POST['widget_id'])) : '';
    833842
     843        // Normalise: strip wgt_ prefix if pasted, then prepend it.
     844        $widget_id = preg_replace('/^wgt_/', '', $widget_id);
     845
    834846        // Validation - allow wc_product_page only when WooCommerce is active
    835847        $valid_types = ['shortcode'];
     
    845857            wp_send_json_error(['message' => __('Widget ID is required.', 'selektable')]);
    846858        }
     859
     860        // Prepend wgt_ prefix.
     861        $widget_id = 'wgt_' . $widget_id;
    847862
    848863        $integrations = get_option('selektable_integrations', []);
  • selektable/tags/v1.10.0/includes/class-selektable-onboarding.php

    r3483770 r3487326  
    329329                            <label class="slk-label" for="slk-widget-id"><?php esc_html_e( 'Widget ID', 'selektable' ); ?></label>
    330330                            <div class="slk-input-wrap" id="slk-widget-id-wrap">
    331                                 <span class="slk-input-prefix">widget_</span>
     331                                <span class="slk-input-prefix">wgt_</span>
    332332                                <input
    333333                                    type="text"
     
    339339                                />
    340340                            </div>
    341                             <p class="slk-hint"><?php esc_html_e( 'Format: widget_xxxxxxxxx · Selektable Dashboard → Widgets → Settings', 'selektable' ); ?></p>
     341                            <p class="slk-hint"><?php esc_html_e( 'Format: wgt_xxxxxxxxx · Selektable Dashboard → Widgets → Settings', 'selektable' ); ?></p>
    342342                        </div>
    343343
     
    515515        }
    516516
    517         // Normalise: prepend store_ if not already present.
    518         if ( strpos( $store_id, 'store_' ) !== 0 ) {
    519             $store_id = 'store_' . $store_id;
    520         }
     517        // Normalise: strip store_ prefix if pasted, then prepend it.
     518        $store_id = preg_replace( '/^store_/', '', $store_id );
     519        $store_id = 'store_' . $store_id;
    521520
    522521        update_option( 'selektable_store_id', $store_id );
     
    560559        }
    561560
    562         // Normalise: prepend widget_ if not already present.
    563         if ( strpos( $widget_id, 'widget_' ) !== 0 ) {
    564             $widget_id = 'widget_' . $widget_id;
    565         }
     561        // Normalise: strip wgt_ / widget_ prefix if pasted, then prepend wgt_.
     562        $widget_id = preg_replace( '/^(wgt_|widget_)/', '', $widget_id );
     563        $widget_id = 'wgt_' . $widget_id;
    566564
    567565        $wc_active   = selektable_is_woocommerce_active();
  • selektable/tags/v1.10.0/selektable.php

    r3487227 r3487326  
    44 * Plugin URI: https://selektable.com
    55 * Description: Integrate the Selektable widget for virtual try-on and room visualization on your WordPress site.
    6  * Version: 1.9.0
     6 * Version: 1.10.0
    77 * Author: Selektable
    88 * Author URI: https://selektable.com/about
     
    2222
    2323// Plugin constants
    24 define('SELEKTABLE_VERSION', '1.9.0');
     24define('SELEKTABLE_VERSION', '1.10.0');
    2525define('SELEKTABLE_DB_VERSION', '1.1.0');
    2626define('SELEKTABLE_PLUGIN_FILE', __FILE__);
  • selektable/trunk/assets/js/admin.js

    r3483715 r3487326  
    113113            });
    114114
    115             // Widget ID change (update shortcode)
     115            // Widget ID change — strip prefix if pasted, update shortcode
    116116            $(document).on('input', '#selektable-widget-id', function () {
     117                var $input = $(this);
     118                var val = $input.val();
     119                if (val.indexOf('wgt_') === 0) {
     120                    $input.val(val.substring(4));
     121                }
    117122                self.updateShortcodePreview();
    118123            });
     
    216221        },
    217222
     223        /**
     224         * Strip a known prefix (e.g. "wgt_", "store_") from a value.
     225         */
     226        stripPrefix: function (value, prefix) {
     227            if (value && value.indexOf(prefix) === 0) {
     228                return value.substring(prefix.length);
     229            }
     230            return value;
     231        },
     232
    218233        populateForm: function (integration) {
    219234            $('#selektable-int-id').val(integration.id);
    220235            $('#selektable-int-type').val(integration.type);
    221             $('#selektable-widget-id').val(integration.widget_id || '');
     236            $('#selektable-widget-id').val(this.stripPrefix(integration.widget_id || '', 'wgt_'));
    222237            $('#selektable-button-text').val(integration.button_text || 'Try it on');
    223238            $('#selektable-button-class').val(integration.button_class || 'button selektable-try-on');
     
    294309
    295310        updateShortcodePreview: function () {
    296             var widgetId = $('#selektable-widget-id').val();
     311            var rawVal = $.trim($('#selektable-widget-id').val());
     312            var widgetId = this.stripPrefix(rawVal, 'wgt_');
    297313            var shortcode = '[selektable_button';
    298314            if (widgetId) {
    299                 shortcode += ' widget_id="' + widgetId + '"';
     315                shortcode += ' widget_id="wgt_' + widgetId + '"';
    300316            }
    301317            shortcode += ']';
     
    317333        saveIntegration: function () {
    318334            var self = this;
    319             var widgetId = $('#selektable-widget-id').val();
     335            var rawWidgetId = $.trim($('#selektable-widget-id').val());
     336            // Strip wgt_ prefix if pasted, server will re-add it.
     337            var widgetId = self.stripPrefix(rawWidgetId, 'wgt_');
    320338
    321339            if (!widgetId) {
     
    485503            SelektableAdmin.init();
    486504        }
     505
     506        // Auto-strip store_ prefix if pasted into the settings store ID input
     507        $('#selektable_store_id').on('input', function () {
     508            var val = $(this).val();
     509            if (val.indexOf('store_') === 0) {
     510                $(this).val(val.substring(6));
     511            }
     512        });
    487513    });
    488514
  • selektable/trunk/assets/js/onboarding.js

    r3483715 r3487326  
    173173
    174174    // ------------------------------------------------------------------ //
     175    // Auto-strip prefixes when pasted into prefixed inputs                 //
     176    // ------------------------------------------------------------------ //
     177    $('#slk-store-id').on('input', function () {
     178        var val = $(this).val();
     179        if (val.indexOf('store_') === 0) {
     180            $(this).val(val.substring(6));
     181        }
     182    });
     183
     184    $('#slk-widget-id').on('input', function () {
     185        var val = $(this).val();
     186        if (val.indexOf('wgt_') === 0) {
     187            $(this).val(val.substring(4));
     188        } else if (val.indexOf('widget_') === 0) {
     189            $(this).val(val.substring(7));
     190        }
     191    });
     192
     193    // ------------------------------------------------------------------ //
    175194    // Focus styles for custom input wrappers                               //
    176195    // ------------------------------------------------------------------ //
  • selektable/trunk/includes/class-selektable-admin.php

    r3487227 r3487326  
    9595
    9696        if ($section === 'general' && isset($_POST['selektable_store_id'])) {
    97             update_option('selektable_store_id', sanitize_text_field(wp_unslash($_POST['selektable_store_id'])));
     97            $store_id = sanitize_text_field(wp_unslash($_POST['selektable_store_id']));
     98            $store_id = preg_replace('/^store_/', '', $store_id);
     99            if (!empty($store_id)) {
     100                $store_id = 'store_' . $store_id;
     101            }
     102            update_option('selektable_store_id', $store_id);
    98103        }
    99104
     
    114119        $categories   = $wc_active ? $this->get_product_categories() : [];
    115120        $tags         = $wc_active ? $this->get_product_tags() : [];
    116         $store_id     = get_option('selektable_store_id', '');
     121        $store_id_raw = get_option('selektable_store_id', '');
     122        $store_id     = preg_replace('/^store_/', '', $store_id_raw);
    117123        $app_url      = get_option('selektable_app_url', 'https://app.selektable.com');
    118         $is_connected = !empty($store_id);
     124        $is_connected = !empty($store_id_raw);
    119125        $int_count    = count($integrations);
    120126        $wc_int_count = count(array_filter($integrations, fn($i) => $i['type'] === 'wc_product_page'));
     
    534540                                    <div class="selektable-form-row">
    535541                                        <label for="selektable-widget-id"><?php esc_html_e('Widget ID', 'selektable'); ?> <span class="required">*</span></label>
    536                                         <input type="text" id="selektable-widget-id" placeholder="wgt_abc123">
     542                                        <div class="slk-input-prefixed">
     543                                            <span class="slk-input-prefix" aria-hidden="true">wgt_</span>
     544                                            <input type="text" id="selektable-widget-id" placeholder="abc123">
     545                                        </div>
    537546                                        <p class="description"><?php esc_html_e('Your Selektable widget ID. Find this in your Selektable dashboard.', 'selektable'); ?></p>
    538547                                    </div>
     
    832841        $widget_id = isset($_POST['widget_id']) ? sanitize_text_field(wp_unslash($_POST['widget_id'])) : '';
    833842
     843        // Normalise: strip wgt_ prefix if pasted, then prepend it.
     844        $widget_id = preg_replace('/^wgt_/', '', $widget_id);
     845
    834846        // Validation - allow wc_product_page only when WooCommerce is active
    835847        $valid_types = ['shortcode'];
     
    845857            wp_send_json_error(['message' => __('Widget ID is required.', 'selektable')]);
    846858        }
     859
     860        // Prepend wgt_ prefix.
     861        $widget_id = 'wgt_' . $widget_id;
    847862
    848863        $integrations = get_option('selektable_integrations', []);
  • selektable/trunk/includes/class-selektable-onboarding.php

    r3483770 r3487326  
    329329                            <label class="slk-label" for="slk-widget-id"><?php esc_html_e( 'Widget ID', 'selektable' ); ?></label>
    330330                            <div class="slk-input-wrap" id="slk-widget-id-wrap">
    331                                 <span class="slk-input-prefix">widget_</span>
     331                                <span class="slk-input-prefix">wgt_</span>
    332332                                <input
    333333                                    type="text"
     
    339339                                />
    340340                            </div>
    341                             <p class="slk-hint"><?php esc_html_e( 'Format: widget_xxxxxxxxx · Selektable Dashboard → Widgets → Settings', 'selektable' ); ?></p>
     341                            <p class="slk-hint"><?php esc_html_e( 'Format: wgt_xxxxxxxxx · Selektable Dashboard → Widgets → Settings', 'selektable' ); ?></p>
    342342                        </div>
    343343
     
    515515        }
    516516
    517         // Normalise: prepend store_ if not already present.
    518         if ( strpos( $store_id, 'store_' ) !== 0 ) {
    519             $store_id = 'store_' . $store_id;
    520         }
     517        // Normalise: strip store_ prefix if pasted, then prepend it.
     518        $store_id = preg_replace( '/^store_/', '', $store_id );
     519        $store_id = 'store_' . $store_id;
    521520
    522521        update_option( 'selektable_store_id', $store_id );
     
    560559        }
    561560
    562         // Normalise: prepend widget_ if not already present.
    563         if ( strpos( $widget_id, 'widget_' ) !== 0 ) {
    564             $widget_id = 'widget_' . $widget_id;
    565         }
     561        // Normalise: strip wgt_ / widget_ prefix if pasted, then prepend wgt_.
     562        $widget_id = preg_replace( '/^(wgt_|widget_)/', '', $widget_id );
     563        $widget_id = 'wgt_' . $widget_id;
    566564
    567565        $wc_active   = selektable_is_woocommerce_active();
  • selektable/trunk/selektable.php

    r3487227 r3487326  
    44 * Plugin URI: https://selektable.com
    55 * Description: Integrate the Selektable widget for virtual try-on and room visualization on your WordPress site.
    6  * Version: 1.9.0
     6 * Version: 1.10.0
    77 * Author: Selektable
    88 * Author URI: https://selektable.com/about
     
    2222
    2323// Plugin constants
    24 define('SELEKTABLE_VERSION', '1.9.0');
     24define('SELEKTABLE_VERSION', '1.10.0');
    2525define('SELEKTABLE_DB_VERSION', '1.1.0');
    2626define('SELEKTABLE_PLUGIN_FILE', __FILE__);
Note: See TracChangeset for help on using the changeset viewer.