Plugin Directory

Changeset 3295364


Ignore:
Timestamp:
05/17/2025 05:42:12 PM (11 months ago)
Author:
ilachat
Message:

Initial v1.2.0 update

Location:
ilachat/trunk
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • ilachat/trunk/assets/css/ilachat-admin.css

    r3295270 r3295364  
    4040  border: 1px solid #c3c4c7;
    4141  margin: 0 0.25em;
     42}
     43
     44a.ilachat-plan-name {
     45  text-decoration: none;
     46  background-color: #06f;
     47  border-color: #005cd4;
     48  color: #fff;
     49}
     50
     51a.ilachat-plan-name:hover {
     52  background-color: #005cd4;
     53  border-color: #005cd4;
    4254}
    4355
  • ilachat/trunk/assets/js/ilachat-woocommerce.js

    r3295270 r3295364  
    205205                if (data.success) {
    206206                    const responseData = data.data;
     207                    // Check for limit_message and show admin error notice
     208                    if (responseData.limit_message) {
     209                        // Stop further syncing
     210                        this.resetSync();
     211                        // Show an admin error notice after the page header
     212                        const header = document.querySelector('.ilachat-wrap h1');
     213                        if (header) {
     214                            const notice = document.createElement('div');
     215                            notice.className = 'notice notice-error is-dismissible';
     216                            notice.innerHTML = '<p>' + responseData.limit_message + '</p>';
     217                            header.insertAdjacentElement('afterend', notice);
     218                        }
     219                        return;
     220                    }
    207221                    this.updateMessage(responseData.success, responseData.error);
    208222
  • ilachat/trunk/languages/ilachat.pot

    r3295270 r3295364  
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2025-05-17T15:34:04+02:00\n"
     12"POT-Creation-Date: 2025-05-17T19:27:57+02:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1414"X-Generator: WP-CLI 2.11.0\n"
     
    8484msgstr ""
    8585
    86 #: src/Admin/Connection.php:167
     86#: src/Admin/Connection.php:169
    8787msgid "Ilachat has been successfully connected."
    8888msgstr ""
    8989
    90 #: src/Integrations/Woocommerce.php:149
    9190#: src/Integrations/Woocommerce.php:150
    92 #: src/Integrations/Woocommerce.php:175
     91#: src/Integrations/Woocommerce.php:151
     92#: src/Integrations/Woocommerce.php:176
    9393#: templates/admin/wc-integration-page.php:51
    9494msgid "WooCommerce Integration"
    9595msgstr ""
    9696
    97 #: src/Integrations/Woocommerce.php:329
     97#: src/Integrations/Woocommerce.php:330
    9898msgid "Order tracking is disabled"
    9999msgstr ""
    100100
    101 #: src/Integrations/Woocommerce.php:337
     101#: src/Integrations/Woocommerce.php:338
    102102msgid "Order ID is required"
    103103msgstr ""
    104104
    105 #: src/Integrations/Woocommerce.php:342
     105#: src/Integrations/Woocommerce.php:343
    106106msgid "Order not found"
    107107msgstr ""
    108108
    109 #: src/Integrations/Woocommerce.php:347
     109#: src/Integrations/Woocommerce.php:348
    110110msgid "Invalid phone number"
    111111msgstr ""
    112112
    113 #: src/Integrations/Woocommerce.php:352
     113#: src/Integrations/Woocommerce.php:353
    114114msgid "Invalid email address"
    115115msgstr ""
    116116
    117 #: src/Integrations/Woocommerce.php:557
    118 #: src/Integrations/Woocommerce.php:631
     117#: src/Integrations/Woocommerce.php:558
     118#: src/Integrations/Woocommerce.php:632
    119119msgid "Please enter a note."
    120120msgstr ""
    121121
    122 #: src/Integrations/Woocommerce.php:558
     122#: src/Integrations/Woocommerce.php:559
    123123msgid "An error occurred while doing the request."
    124124msgstr ""
    125125
    126 #: src/Integrations/Woocommerce.php:559
     126#: src/Integrations/Woocommerce.php:560
    127127#: templates/admin/wc-order-notes.php:38
    128128msgid "Delete note"
    129129msgstr ""
    130130
    131 #: src/Integrations/Woocommerce.php:560
     131#: src/Integrations/Woocommerce.php:561
    132132msgid "Are you sure you want to delete this note? This action cannot be undone."
    133133msgstr ""
    134134
    135 #: src/Integrations/Woocommerce.php:561
     135#: src/Integrations/Woocommerce.php:562
    136136msgid "Pause sync"
    137137msgstr ""
    138138
    139 #: src/Integrations/Woocommerce.php:562
     139#: src/Integrations/Woocommerce.php:563
    140140msgid "Resume sync"
    141141msgstr ""
    142142
    143 #: src/Integrations/Woocommerce.php:563
     143#: src/Integrations/Woocommerce.php:564
    144144msgid "Sync Products"
    145145msgstr ""
    146146
    147 #: src/Integrations/Woocommerce.php:583
     147#: src/Integrations/Woocommerce.php:584
    148148msgid "Ilachat Order Notes"
    149149msgstr ""
    150150
    151 #: src/Integrations/Woocommerce.php:626
     151#: src/Integrations/Woocommerce.php:627
    152152msgid "Invalid order."
    153153msgstr ""
    154154
    155 #: src/Integrations/Woocommerce.php:635
    156 #: src/Integrations/Woocommerce.php:712
     155#: src/Integrations/Woocommerce.php:636
     156#: src/Integrations/Woocommerce.php:713
    157157msgid "You do not have permission to add notes to this order."
    158158msgstr ""
    159159
    160 #: src/Integrations/Woocommerce.php:640
     160#: src/Integrations/Woocommerce.php:641
    161161msgid "Failed to add note."
    162162msgstr ""
    163163
    164 #: src/Integrations/Woocommerce.php:708
     164#: src/Integrations/Woocommerce.php:709
    165165msgid "Invalid comment ID."
    166166msgstr ""
    167167
    168 #: src/Integrations/Woocommerce.php:717
     168#: src/Integrations/Woocommerce.php:718
    169169msgid "Failed to delete note."
    170170msgstr ""
    171171
    172 #: src/Integrations/Woocommerce.php:999
    173172#: src/Integrations/Woocommerce.php:1014
     173#: src/Integrations/Woocommerce.php:1029
    174174#: src/Integrations/Wordpress.php:289
    175175#: src/Integrations/Wordpress.php:304
    176 #: assets/js/editor-sync.js:19
    177 #: assets/js/editor-sync.js:21
    178 #: assets/js/editor-sync.js:48
     176#: assets/js/ilachat-editor-sync.js:19
     177#: assets/js/ilachat-editor-sync.js:21
     178#: assets/js/ilachat-editor-sync.js:48
    179179msgid "Sync with Ilachat"
    180180msgstr ""
    181181
    182 #: src/Integrations/Woocommerce.php:1001
     182#: src/Integrations/Woocommerce.php:1016
    183183#: src/Integrations/Wordpress.php:291
    184 #: assets/js/editor-sync.js:14
    185 #: assets/js/editor-sync.js:38
     184#: assets/js/ilachat-editor-sync.js:14
     185#: assets/js/ilachat-editor-sync.js:38
    186186msgid "Last synced:"
    187187msgstr ""
    188188
    189189#. translators: %s is the number of products successfully synced with Ilachat.
    190 #: src/Integrations/Woocommerce.php:1080
     190#: src/Integrations/Woocommerce.php:1096
    191191msgid "Synced %s product with Ilachat."
    192192msgid_plural "Synced %s products with Ilachat."
     
    195195
    196196#. translators: %s is the number of products that failed to sync with Ilachat.
    197 #: src/Integrations/Woocommerce.php:1094
     197#: src/Integrations/Woocommerce.php:1110
    198198msgid "Failed to sync %s product with Ilachat."
    199199msgid_plural "Failed to sync %s products with Ilachat."
    200200msgstr[0] ""
    201201msgstr[1] ""
     202
     203#: src/Integrations/Woocommerce.php:1174
     204msgid "Product data limit reached. Please upgrade your plan."
     205msgstr ""
    202206
    203207#: src/Integrations/Wordpress.php:182
     
    410414msgstr ""
    411415
    412 #: assets/js/editor-sync.js:15
    413 #: assets/js/editor-sync.js:39
     416#: assets/js/ilachat-editor-sync.js:15
     417#: assets/js/ilachat-editor-sync.js:39
    414418msgid "This post will be synced with Ilachat when you save it."
    415419msgstr ""
  • ilachat/trunk/src/Admin/Connection.php

    r3295270 r3295364  
    163163        self::set_bot_details($validated_token);
    164164
     165        do_action('ilachat_after_connect');
     166
    165167        self::flush_page_cache();
    166168
  • ilachat/trunk/src/Integrations/Woocommerce.php

    r3295270 r3295364  
    3535        add_action('ilachat_settings_page_after_buttons', [$this, 'add_settings_page_buttons']);
    3636        add_action('updated_option', [$this, 'sync_variable_links_after_update'], 10, 3);
     37        add_action('ilachat_after_connect', [$this, 'sync_variable_links'], 10);
    3738
    3839        if (get_option('ilachat_woocommerce_integration_enabled', 1)) {
     
    820821     *
    821822     * @param object $product
    822      * @return bool
     823     * @return bool|void
    823824     */
    824825    public static function sync_product($product)
    825826    {
    826827        if (! $product) {
    827             return false;
     828            return;
    828829        }
    829830
    830831        if ('publish' !== $product->get_status()) {
    831             return false;
     832            return;
    832833        }
    833834
    834835        if (! apply_filters('ilachat_should_sync_product', true, $product)) {
    835             return false;
     836            return;
    836837        }
    837838
    838839        $token = get_option('ilachat_token', '');
    839840        if (empty($token)) {
    840             return false;
     841            return;
    841842        }
    842843
     
    918919        }
    919920
     921        if (empty($body['variations'])) {
     922            return;
     923        }
     924
    920925        $body = apply_filters('ilachat_woocommerce_sync_product_data', $body, $product);
    921926
     
    927932
    928933        if (empty($response['status']) || 'success' !== $response['status']) {
     934            if (defined('WP_DEBUG') && WP_DEBUG === true) {
     935                // phpcs:disable WordPress.PHP.DevelopmentFunctions
     936                error_log('Ilachat Sync Product Error: ' . $response['message']);
     937                // phpcs:enable
     938            }
     939
     940            if (isset($response['code']) && 403 == $response['code']) {
     941                set_transient('ilachat_product_limit_reached', true, 5 * MINUTE_IN_SECONDS);
     942            }
     943
    929944            return false;
    930945        }
     
    10341049            $product = wc_get_product($post_id);
    10351050            if ($product) {
    1036                 if (self::sync_product($product)) {
     1051                $result = self::sync_product($product);
     1052                if ($result === true) {
    10371053                    $update_status['success']++;
    1038                 } else {
     1054                } elseif ($result === false) {
    10391055                    $update_status['error']++;
    10401056                }
     
    11381154                continue;
    11391155            }
    1140             if (self::sync_product($product)) {
     1156            if (get_transient('ilachat_product_limit_reached')) {
     1157                break;
     1158            }
     1159            $result = self::sync_product($product);
     1160            if ($result === true) {
    11411161                $success++;
    1142             } else {
     1162            } elseif ($result === false) {
    11431163                $error++;
    11441164            }
     
    11481168
    11491169        $response = [
    1150             'success' => $success,
    1151             'error'   => $error,
    1152             'offset'  => $offset,
    1153             'total'   => $total_products,
     1170            'success'       => $success,
     1171            'error'         => $error,
     1172            'offset'        => $offset,
     1173            'total'         => $total_products,
     1174            'limit_message' => get_transient('ilachat_product_limit_reached') ? esc_html__('Product data limit reached. Please upgrade your plan.', 'ilachat') : '',
    11541175        ];
    11551176
  • ilachat/trunk/src/Integrations/Wordpress.php

    r3295270 r3295364  
    9898        wp_enqueue_script(
    9999            'ilachat-editor-sync',
    100             ILACHAT_URL . 'assets/js/editor-sync.js',
     100            ILACHAT_URL . 'assets/js/ilachat-editor-sync.js',
    101101            ['wp-plugins', 'wp-edit-post', 'wp-element', 'wp-components', 'wp-data', 'wp-core-data', 'wp-i18n'],
    102102            ILACHAT_VERSION,
Note: See TracChangeset for help on using the changeset viewer.