Changeset 3825228
- Timestamp:
- 11/26/2026 03:33:29 AM (less than one hour ago)
- Location:
- winaltchat-for-woocommerce
- Files:
-
- 6 added
- 30 edited
- 1 copied
-
tags/1.67.50 (copied) (copied from winaltchat-for-woocommerce/trunk )
-
tags/1.67.50/admin/class-winalt-chat-branding.php (modified) (9 diffs)
-
tags/1.67.50/admin/class-winalt-guided-setup.php (modified) (2 diffs)
-
tags/1.67.50/admin/class-winalt-support-contact.php (modified) (1 diff)
-
tags/1.67.50/assets/css/admin-dark.css (modified) (1 diff)
-
tags/1.67.50/assets/css/guided-setup.css (modified) (2 diffs)
-
tags/1.67.50/assets/js/admin.js (modified) (1 diff)
-
tags/1.67.50/assets/js/guided-setup.js (modified) (6 diffs)
-
tags/1.67.50/changelog.txt (modified) (3 diffs)
-
tags/1.67.50/includes/basic-ai/class-winalt-basic-ai-core.php (modified) (3 diffs)
-
tags/1.67.50/includes/basic-ai/data (added)
-
tags/1.67.50/includes/basic-ai/data/index.php (added)
-
tags/1.67.50/includes/basic-ai/helpers/class-winalt-language-lexicon.php (added)
-
tags/1.67.50/includes/class-winalt-order-lookup.php (modified) (1 diff)
-
tags/1.67.50/includes/class-winalt-pattern-sync.php (modified) (17 diffs)
-
tags/1.67.50/includes/class-winalt-translate.php (modified) (7 diffs)
-
tags/1.67.50/readme.txt (modified) (5 diffs)
-
tags/1.67.50/uninstall.php (modified) (2 diffs)
-
tags/1.67.50/winaltchat-for-woocommerce.php (modified) (3 diffs)
-
trunk/admin/class-winalt-chat-branding.php (modified) (9 diffs)
-
trunk/admin/class-winalt-guided-setup.php (modified) (2 diffs)
-
trunk/admin/class-winalt-support-contact.php (modified) (1 diff)
-
trunk/assets/css/admin-dark.css (modified) (1 diff)
-
trunk/assets/css/guided-setup.css (modified) (2 diffs)
-
trunk/assets/js/admin.js (modified) (1 diff)
-
trunk/assets/js/guided-setup.js (modified) (6 diffs)
-
trunk/changelog.txt (modified) (3 diffs)
-
trunk/includes/basic-ai/class-winalt-basic-ai-core.php (modified) (3 diffs)
-
trunk/includes/basic-ai/data (added)
-
trunk/includes/basic-ai/data/index.php (added)
-
trunk/includes/basic-ai/helpers/class-winalt-language-lexicon.php (added)
-
trunk/includes/class-winalt-order-lookup.php (modified) (1 diff)
-
trunk/includes/class-winalt-pattern-sync.php (modified) (17 diffs)
-
trunk/includes/class-winalt-translate.php (modified) (7 diffs)
-
trunk/readme.txt (modified) (5 diffs)
-
trunk/uninstall.php (modified) (2 diffs)
-
trunk/winaltchat-for-woocommerce.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
winaltchat-for-woocommerce/tags/1.67.50/admin/class-winalt-chat-branding.php
r3788419 r3825228 719 719 <div class="winalt-settings-col"> 720 720 721 <?php Winalt_Guided_Setup::render_looks_card(); ?> 722 <?php Winalt_Guided_Setup::render_language_card(); ?> 721 <?php // Advanced view: the sections below are shown one tab at a time (see initAppearanceTabs() in guided-setup.js). Simple view shows them all. ?> 722 <div class="winalt-status-bar winalt-appearance-tabs"> 723 <div class="winalt-sub-tabs" role="tablist" aria-label="<?php esc_attr_e( 'Appearance sections', 'winaltchat-for-woocommerce' ); ?>"> 724 <button type="button" class="winalt-sub-tab is-active" role="tab" aria-selected="true" data-atab-target="style"><?php esc_html_e( 'Style', 'winaltchat-for-woocommerce' ); ?></button> 725 <button type="button" class="winalt-sub-tab" role="tab" aria-selected="false" data-atab-target="branding"><?php esc_html_e( 'Branding', 'winaltchat-for-woocommerce' ); ?></button> 726 <button type="button" class="winalt-sub-tab" role="tab" aria-selected="false" data-atab-target="typography"><?php esc_html_e( 'Typography', 'winaltchat-for-woocommerce' ); ?></button> 727 <button type="button" class="winalt-sub-tab" role="tab" aria-selected="false" data-atab-target="language"><?php esc_html_e( 'Chat language', 'winaltchat-for-woocommerce' ); ?></button> 728 <button type="button" class="winalt-sub-tab" role="tab" aria-selected="false" data-atab-target="engagement"><?php esc_html_e( 'Engagement', 'winaltchat-for-woocommerce' ); ?></button> 729 <button type="button" class="winalt-sub-tab" role="tab" aria-selected="false" data-atab-target="replies"><?php esc_html_e( 'Quick replies', 'winaltchat-for-woocommerce' ); ?></button> 730 <button type="button" class="winalt-sub-tab" role="tab" aria-selected="false" data-atab-target="messages"><?php esc_html_e( 'Messages', 'winaltchat-for-woocommerce' ); ?></button> 731 </div> 732 </div> 733 734 <div data-atab="style"> 735 <?php Winalt_Guided_Setup::render_looks_card(); ?> 736 </div> 737 <div data-atab="language"> 738 <?php Winalt_Guided_Setup::render_language_card(); ?> 739 </div> 723 740 724 741 <!-- Branding card --> 725 <div class="winalt-card" >742 <div class="winalt-card" data-atab="branding"> 726 743 <div class="winalt-card-header"> 727 744 <div class="winalt-card-title"><?php esc_html_e( 'Chat Window Branding', 'winaltchat-for-woocommerce' ); ?></div> … … 801 818 802 819 <!-- Header Trigger card — only shown when Header Right Trigger mode is selected --> 803 <div class="winalt-card winalt-advanced" id="winalt-header-trigger-fields" style="<?php echo get_option( 'winalt_chat_display_mode', 'bubble' ) === 'header_panel' ? '' : 'display:none;'; ?>">820 <div class="winalt-card winalt-advanced" data-atab="branding" id="winalt-header-trigger-fields" style="<?php echo get_option( 'winalt_chat_display_mode', 'bubble' ) === 'header_panel' ? '' : 'display:none;'; ?>"> 804 821 <div class="winalt-card-header"> 805 822 <div class="winalt-card-title"><?php esc_html_e( 'Header Trigger Settings', 'winaltchat-for-woocommerce' ); ?></div> … … 841 858 842 859 <!-- Colors card --> 843 <div class="winalt-card winalt-advanced" >860 <div class="winalt-card winalt-advanced" data-atab="style"> 844 861 <div class="winalt-card-header"> 845 862 <div class="winalt-card-title"><?php esc_html_e( 'Color Customization', 'winaltchat-for-woocommerce' ); ?></div> … … 892 909 893 910 <!-- Typography + Engagement cards (side-by-side) --> 894 <div class="winalt-grid-2 winalt-grid-2--cards" >911 <div class="winalt-grid-2 winalt-grid-2--cards" data-atab="typography engagement"> 895 912 <!-- Typography card --> 896 <div class="winalt-card winalt-advanced" >913 <div class="winalt-card winalt-advanced" data-atab="typography"> 897 914 <div class="winalt-card-header"> 898 915 <div class="winalt-card-title"><?php esc_html_e( 'Typography', 'winaltchat-for-woocommerce' ); ?></div> … … 920 937 </div> 921 938 <!-- Engagement card --> 922 <div class="winalt-card winalt-advanced" >939 <div class="winalt-card winalt-advanced" data-atab="engagement"> 923 940 <div class="winalt-card-header"> 924 941 <div class="winalt-card-title"><?php esc_html_e( 'Engagement', 'winaltchat-for-woocommerce' ); ?></div> … … 953 970 </div><!-- /.winalt-grid-2 typography+engagement --> 954 971 955 <!-- Wording: quick replies, labels and window controls, grouped so Simple view shows none of it and Advanced view keeps it tidy -->956 <details class="winalt-wording winalt-advanced">957 <summary><?php esc_html_e( 'Customize wording (quick replies, labels and messages)', 'winaltchat-for-woocommerce' ); ?></summary>958 959 972 <!-- Quick Reply Buttons card --> 960 <div class="winalt-card ">973 <div class="winalt-card winalt-advanced" data-atab="replies"> 961 974 <div class="winalt-card-header"> 962 975 <div class="winalt-card-title"><?php esc_html_e( 'Quick Reply Buttons', 'winaltchat-for-woocommerce' ); ?></div> … … 1089 1102 1090 1103 <!-- Chat Labels & Messages card --> 1091 <div class="winalt-card ">1104 <div class="winalt-card winalt-advanced" data-atab="messages"> 1092 1105 <div class="winalt-card-header"> 1093 1106 <div class="winalt-card-title"><?php esc_html_e( 'Chat Labels & Messages', 'winaltchat-for-woocommerce' ); ?></div> … … 1204 1217 1205 1218 <!-- Chat Window Controls card --> 1206 <div class="winalt-card ">1219 <div class="winalt-card winalt-advanced" data-atab="messages"> 1207 1220 <div class="winalt-card-header"> 1208 1221 <div class="winalt-card-title"><?php esc_html_e( 'Chat Window Controls', 'winaltchat-for-woocommerce' ); ?></div> … … 1246 1259 </div> 1247 1260 </div><!-- /.winalt-card (Chat Window Controls) --> 1248 1249 </details><!-- /.winalt-wording -->1250 1261 1251 1262 <div class="winalt-form-actions"> -
winaltchat-for-woocommerce/tags/1.67.50/admin/class-winalt-guided-setup.php
r3788419 r3825228 442 442 <span class="winalt-info" tabindex="0" role="note" aria-label="<?php echo esc_attr( $info ); ?>" data-tip="<?php echo esc_attr( $info ); ?>">i</span> 443 443 </div> 444 <p class="winalt-language-hint"><?php esc_html_e( 'Show the chat in another language. It applies when you save Appearance. Pick English to turn it off.', 'winaltchat-for-woocommerce' ); ?></p>445 444 </div> 446 445 <div class="winalt-language-controls"> … … 454 453 </div> 455 454 <p class="winalt-language-status" id="winalt-translate-status" aria-live="polite"></p> 455 <p class="winalt-language-status" id="winalt-patterns-status" aria-live="polite" hidden> 456 <span id="winalt-patterns-message"></span> 457 <button type="button" class="button button-small" id="winalt-patterns-retry"><?php esc_html_e( 'Retry', 'winaltchat-for-woocommerce' ); ?></button> 458 </p> 456 459 <p class="winalt-language-note"><?php esc_html_e( 'Machine-translated. Ask a native speaker to check it.', 'winaltchat-for-woocommerce' ); ?></p> 457 460 </div> -
winaltchat-for-woocommerce/tags/1.67.50/admin/class-winalt-support-contact.php
r3788419 r3825228 26 26 * @var string 27 27 */ 28 const SUPPORT_EMAIL = ' support@aisalesmanchatpro.com';28 const SUPPORT_EMAIL = 'info@winalttechnologies.com'; 29 29 30 30 /** -
winaltchat-for-woocommerce/tags/1.67.50/assets/css/admin-dark.css
r3788419 r3825228 297 297 html[data-winalt-theme="dark"] #winalt-admin-root .winalt-form-actions .winalt-unsaved{color:#a9b1be} 298 298 html[data-winalt-theme="dark"] #winalt-admin-root .winalt-home-number-label{color:#a9b1be} 299 html[data-winalt-theme="dark"] #winalt-admin-root .winalt-language-hint{color:#a9b1be}300 299 html[data-winalt-theme="dark"] #winalt-admin-root .winalt-language-status{color:#d5e0f0} 301 300 html[data-winalt-theme="dark"] #winalt-admin-root .winalt-switch{background:#37404b} -
winaltchat-for-woocommerce/tags/1.67.50/assets/css/guided-setup.css
r3788419 r3825228 14 14 #winalt-admin-root.winalt-view-simple .winalt-livechat-fields { grid-template-columns: 1fr; } 15 15 #winalt-admin-root.winalt-view-advanced .winalt-simple-hint { display: none; } 16 17 /* Appearance tabs: Advanced view only. Simple view shows every card. */ 18 #winalt-admin-root .winalt-appearance-tabs { display: none; margin: 0 0 16px; } 19 #winalt-admin-root.winalt-view-advanced .winalt-appearance-tabs { display: flex; } 20 #winalt-admin-root .winalt-appearance-tabs .winalt-sub-tabs { flex-wrap: wrap; margin-left: 0; } 21 #winalt-admin-root.winalt-view-advanced .winalt-tab-off { display: none !important; } 22 #winalt-admin-root.winalt-view-advanced .winalt-grid-2--cards { grid-template-columns: 1fr; } 16 23 17 24 .winalt-simple-hint { … … 513 520 514 521 .winalt-language-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; } 515 .winalt-language-hint { margin: 0; font-size: 13px; color: #5b6678; max-width: 60ch; }516 522 .winalt-language-status { margin: 10px 0 0; font-size: 13px; color: #0f1a2b; } 517 523 #winalt-translate-now { margin-top: 10px; } -
winaltchat-for-woocommerce/tags/1.67.50/assets/js/admin.js
r3788419 r3825228 1805 1805 jQuery(document).ready(function($) { 1806 1806 function switchSubTab(targetId) { 1807 document.querySelectorAll('.winalt-sub-tab ').forEach(function(btn) {1807 document.querySelectorAll('.winalt-sub-tab[data-target]').forEach(function(btn) { 1808 1808 btn.classList.remove('is-active'); 1809 1809 btn.setAttribute('aria-selected', 'false'); -
winaltchat-for-woocommerce/tags/1.67.50/assets/js/guided-setup.js
r3788419 r3825228 105 105 root.classList.add('winalt-view-' + view); 106 106 107 $all('.winalt-view-btn ').forEach(function (btn) {107 $all('.winalt-view-btn[data-view]').forEach(function (btn) { 108 108 var active = btn.getAttribute('data-view') === view; 109 109 btn.classList.toggle('is-active', active); … … 780 780 /* ---- Chat language (auto-translate) ----------------------------------------- */ 781 781 782 // A failed download of the language's reply patterns: say so, with Retry. 783 function showPatternsStatus(status) { 784 var box = $('#winalt-patterns-status'); 785 if (!box) { 786 return; 787 } 788 var failed = !!(status && status.patterns_error); 789 box.hidden = !failed; 790 var message = $('#winalt-patterns-message'); 791 if (message && failed) { 792 message.textContent = status.patterns_message || ''; 793 } 794 } 795 796 function initPatternsRetry() { 797 var button = $('#winalt-patterns-retry'); 798 showPatternsStatus(cfg.translate); 799 if (!button) { 800 return; 801 } 802 button.addEventListener('click', function () { 803 button.disabled = true; 804 post('winalt_patterns_retry', cfg.translateNonce, {}).then(function (result) { 805 button.disabled = false; 806 var data = result && result.data ? result.data : {}; 807 if (data.status) { 808 cfg.translate = data.status; 809 showPatternsStatus(data.status); 810 } 811 }); 812 }); 813 } 814 782 815 function showTranslateStatus(status) { 783 816 var line = $('#winalt-translate-status'); … … 789 822 cfg.translate = status; 790 823 applyPreview(status.preview); 824 showPatternsStatus(status); 791 825 } 792 826 } … … 891 925 line.textContent = data.message; 892 926 } 927 showPatternsStatus(data.status); 893 928 return !!(result && result.success); 894 929 }); … … 981 1016 } 982 1017 1018 /* ---- Appearance tabs (Advanced view) ------------------------------------------ */ 1019 1020 // Each Appearance card carries data-atab="name [name...]". In the Advanced 1021 // view only the cards of the open tab are shown; the Simple view shows all. 1022 function initAppearanceTabs() { 1023 var bar = $('.winalt-appearance-tabs'); 1024 if (!bar) { 1025 return; 1026 } 1027 var buttons = Array.prototype.slice.call(bar.querySelectorAll('[data-atab-target]')); 1028 var cards = Array.prototype.slice.call(document.querySelectorAll('.winalt-settings-col [data-atab]')); 1029 var stored = ''; 1030 try { 1031 stored = window.sessionStorage.getItem('winaltAppearanceTab') || ''; 1032 } catch (error) { 1033 stored = ''; 1034 } 1035 1036 function show(name) { 1037 buttons.forEach(function (button) { 1038 var on = button.getAttribute('data-atab-target') === name; 1039 button.classList.toggle('is-active', on); 1040 button.setAttribute('aria-selected', on ? 'true' : 'false'); 1041 }); 1042 cards.forEach(function (card) { 1043 var names = (card.getAttribute('data-atab') || '').split(' '); 1044 card.classList.toggle('winalt-tab-off', names.indexOf(name) === -1); 1045 }); 1046 try { 1047 window.sessionStorage.setItem('winaltAppearanceTab', name); 1048 } catch (error) { 1049 // Remembering the tab is optional. 1050 } 1051 } 1052 1053 buttons.forEach(function (button) { 1054 button.addEventListener('click', function () { 1055 show(button.getAttribute('data-atab-target')); 1056 }); 1057 }); 1058 1059 var known = buttons.some(function (button) { 1060 return button.getAttribute('data-atab-target') === stored; 1061 }); 1062 show(known ? stored : 'style'); 1063 } 1064 983 1065 function initTranslate() { 984 1066 initInfoTips(); 985 1067 initTranslatedSave(); 1068 initPatternsRetry(); 986 1069 applyPreview(cfg.translate && cfg.translate.preview); 987 1070 var select = languageSelect(); … … 1529 1612 initSimpleHeader(); 1530 1613 initTranslate(); 1614 initAppearanceTabs(); 1531 1615 initLooks(); 1532 1616 initWizard(); -
winaltchat-for-woocommerce/tags/1.67.50/changelog.txt
r3788419 r3825228 2 2 3 3 The readme.txt shows only the most recent versions (WordPress.org limits it to 5000 characters). Every version is listed here. 4 5 = 1.67.50 = 6 * Improve: Removed the extra hint text under Chat language on the Appearance screen. 7 8 = 1.67.49 = 9 * Improve: The Appearance tab bar now matches the Live Chats bar and shows in Advanced view only. Typography and Chat language have their own tabs, and the "Customize wording" box is gone: Quick replies and Messages are ordinary tabs. 10 11 = 1.67.48 = 12 * New: In Advanced view the Appearance screen is split into tabs (Style, Branding, Engagement, Quick replies, Messages) so you no longer scroll one long page. Simple view is unchanged. 13 14 = 1.67.47 = 15 * Fix: A store running in English now removes reply patterns that an older version had downloaded, so English always uses the wording built into the plugin. 16 17 = 1.67.46 = 18 * Change: Reply patterns and the ready-made translation for a non-English Chat language are downloaded from Winalt Technologies only when you choose that language and once after a plugin update. English is built in and contacts no server. There is no daily or background sync, and no site address is sent with the patterns. If a download fails the screen offers a Retry button. 19 20 = 1.67.45 = 21 * Internal: interim release, replaced by 1.67.46. 22 23 = 1.67.44 = 24 * Improve: Basic AI Pattern Sync now sends your site's home address, plugin edition and version with each request, so Winalt Technologies can see which sites sync. The readme's external services section describes exactly what is sent. No customer or visitor data is sent. 25 26 = 1.67.43 = 27 * Fix: Chinese is now synced in both Simplified and Traditional characters together, so Traditional Chinese questions are understood on stores set to Simplified Chinese, and the other way round. 28 29 = 1.67.42 = 30 * Fix: Product searches written in a non-English language ended in an error message instead of showing products. 31 32 = 1.67.41 = 33 * Improve: The non-English phrases and replies Basic AI uses are no longer stored in the plugin. They are managed on the plugin website and synced for your site language, English and the Chat language you choose, so wording can be improved without a plugin update. Nothing changes for English. 34 35 = 1.67.40 = 36 * New: Basic AI now understands 28 languages besides English: Spanish, French, German, Italian, Portuguese, Dutch, Russian, Ukrainian, Turkish, Polish, Arabic, Persian, Hebrew, Greek, Hindi, Thai, Japanese, Korean, Chinese (Simplified and Traditional), Indonesian, Vietnamese, Swedish, Danish, Norwegian, Finnish, Czech, Romanian and Hungarian. Shoppers can ask about orders, returns, shipping, opening hours, contact details, payment methods, discounts, the cart and talking to a person, and are answered in their own language using your store's own pages. Products are found by the names used in your catalogue. English is unchanged. 37 38 = 1.67.39 = 39 * New: Basic AI now understands Chinese. It answers questions about orders, returns, shipping, opening hours, contact details, payment methods, discounts, the cart and talking to a person, in Chinese, using your store's own pages. It also finds products by their Chinese names and handles greetings, thanks and goodbyes without needing a sync. English is unchanged. 40 * Fix: the free plugin reported itself as Pro when asking for chat translations; it now reports Free. 41 42 = 1.67.38 = 43 * Fix: The "copy our support email" button in the admin now copies info@winalttechnologies.com. 44 45 = 1.67.37 = 46 * Fix: The support email on the plugin page is now info@winalttechnologies.com, and the Support Forum line is gone. 47 * Improve: Rewrote the plugin page text without long dashes so it reads more naturally. 48 49 = 1.67.36 = 50 * Fix: The readme no longer says nothing is ever sent to an outside service. It now points to the External Services list (AI providers, translations, pattern sync, mobile push). 51 52 = 1.67.35 = 53 * Improve: The mobile app is limited to 3 phones per site on the free plan. A 4th phone gets a clear "limit reached" message; signing out on one phone frees its slot. The same account can still sign in on several phones, and a phone whose notification token refreshes keeps its place. 54 55 = 1.67.34 = 56 * Fix: The chat no longer gives customers an email address taken from the WooCommerce or WordPress settings. It only uses the address published on your Contact page, in its own replies and in the AI model's instructions. With no email on the Contact page, no address is given. 57 * Fix: An address you put on the Contact page is always used as written, even if it looks like an example. This undoes the 1.67.33 rule that skipped such addresses. 58 59 = 1.67.33 = 60 * Fix: "Most expensive" now lists the priciest products first, and "cheap gifts under $15" applies the $15 limit. 61 * Fix: A single result reads "Here is 1 product", and the sale list is topped up with other sale items instead of showing one. 62 * Fix: A placeholder contact address (example.com, .test) is no longer shown to customers as the store's email. 63 * Fix: The offline form rejects a mistyped email instead of saving a rewritten one. 64 * Improve: Accessibility. The chat is a labelled dialog, new replies are read out to screen readers, the message box and send button have labels, Esc closes the chat, buttons are at least 44px on touch screens, and View Product and the send arrow follow Text on Primary so light brand colours stay readable. 65 66 = 1.67.32 = 67 * Fix: After a page reload during a live chat, the visitor's own messages showed raw text such as & and ". They now read normally, and delivery ticks match again. 68 * Fix: When the chat limit is reached, the shopper now sees "Too many requests. Please wait a moment before trying again." instead of a generic error. 69 70 = 1.67.31 = 71 * Fix: Chats this week on the Home screen never counted real conversations, because the chat always sends the visitor's first message along with the request. Each new conversation is now counted once. 72 73 = 1.67.30 = 74 * Fix: Basic AI no longer adds made-up taglines before a single product ("Premium Quality", "Eco-Friendly", "Trusted by thousands", "Fast Delivery Available"). It now only mentions the shopper rating when the product has a good one with reviews. 4 75 5 76 = 1.67.29 = … … 7 78 8 79 = 1.67.28 = 9 * Fix: Live chat —the availability switch no longer moves when its label changes, the tabs (Live Conversations, Team Access, Settings) use the same soft highlight as the main menu, and the screen has a little scroll room underneath.80 * Fix: Live chat, the availability switch no longer moves when its label changes, the tabs (Live Conversations, Team Access, Settings) use the same soft highlight as the main menu, and the screen has a little scroll room underneath. 10 81 11 82 = 1.67.27 = … … 13 84 14 85 = 1.67.26 = 15 * Fix: Appearance —the Style you picked is remembered when you save, so it is still highlighted after reloading the screen.86 * Fix: Appearance, the Style you picked is remembered when you save, so it is still highlighted after reloading the screen. 16 87 17 88 = 1.67.25 = 18 * Fix: Appearance —the chosen Style stays highlighted after a reload, and the Style / Light or dark buttons and colour swatches have a visible hover in dark mode.89 * Fix: Appearance, the chosen Style stays highlighted after a reload, and the Style / Light or dark buttons and colour swatches have a visible hover in dark mode. 19 90 20 91 = 1.67.24 = 21 * Fix: Dark mode —the machine-translation note under Chat language is readable. The info tip says "our server" instead of the domain name.92 * Fix: Dark mode, the machine-translation note under Chat language is readable. The info tip says "our server" instead of the domain name. 22 93 23 94 = 1.67.23 = 24 * Improve: Appearance —the Style buttons now look like the Light or dark options, the live preview starts level with the first card, and the Chat language info tip is shorter and aligned.95 * Improve: Appearance, the Style buttons now look like the Light or dark options, the live preview starts level with the first card, and the Chat language info tip is shorter and aligned. 25 96 26 97 = 1.67.22 = -
winaltchat-for-woocommerce/tags/1.67.50/includes/basic-ai/class-winalt-basic-ai-core.php
r3788419 r3825228 71 71 require_once WINALT_PATH . 'includes/basic-ai/helpers/class-winalt-intent-detector.php'; 72 72 require_once WINALT_PATH . 'includes/basic-ai/helpers/class-winalt-response-formatter.php'; 73 require_once WINALT_PATH . 'includes/basic-ai/helpers/class-winalt-language-lexicon.php'; 73 74 74 75 // Load core modules. … … 136 137 'context_used' => false, 137 138 ); 139 } 140 141 // Questions in a language with its own phrase lists (see 142 // Winalt_Language_Lexicon, synced from the plugin website). English messages never 143 // match here, so English behaviour is unchanged. 144 $lexicon_match = Winalt_Language_Lexicon::match( $user_message ); 145 if ( null !== $lexicon_match ) { 146 $lexicon_result = $this->handle_lexicon_query( $lexicon_match, $user_message, $context ); 147 if ( null !== $lexicon_result ) { 148 return $lexicon_result; 149 } 150 } elseif ( null !== Winalt_Language_Lexicon::detect_language( $user_message ) && null === Winalt_Pattern_Sync::find_response( $user_message ) && ! $this->modules['intent']->has_product_request_signal( $user_message ) ) { 151 $lexicon_product = $this->handle_lexicon_product_search( $user_message, $context ); 152 if ( null !== $lexicon_product ) { 153 return $lexicon_product; 154 } 138 155 } 139 156 … … 2969 2986 2970 2987 /** 2988 * Answer a question matched by the language lexicon (see 2989 * Winalt_Language_Lexicon), in the shopper's language, from the store's 2990 * own pages and settings. 2991 * 2992 * @since 1.69.45 2993 * @param array{lang:string,intent:string} $match Lexicon match. 2994 * @param string $message Visitor message. 2995 * @param array $context Conversation history. 2996 * @return array|null Response payload, or null to continue with normal routing. 2997 */ 2998 private function handle_lexicon_query( $match, $message, $context ) { 2999 $lang = $match['lang']; 3000 $intent = $match['intent']; 3001 3002 $page_url = static function ( $option ) { 3003 $page_id = absint( get_option( $option, 0 ) ); 3004 if ( $page_id < 1 || 'publish' !== get_post_status( $page_id ) ) { 3005 return ''; 3006 } 3007 return (string) get_permalink( $page_id ); 3008 }; 3009 $contact_url = $page_url( 'winalt_contact_page' ); 3010 3011 $answer = static function ( $text, $category, $has_page ) use ( $lang, $intent ) { 3012 return array( 3013 'response' => $text, 3014 'type' => 'information', 3015 'data' => array( 3016 'category' => $category, 3017 'has_page' => $has_page, 3018 'source' => 'language_lexicon', 3019 'language' => $lang, 3020 ), 3021 'intent' => array( 3022 'type' => 'information', 3023 'category' => $category, 3024 'lexicon' => $intent, 3025 ), 3026 'context_used' => false, 3027 ); 3028 }; 3029 3030 // A topic answer: the link to the store's own page when it has one, 3031 // otherwise a short "please contact us". Both versions are synced 3032 // replies; the one with {page_link} is used only when there is a link. 3033 $topic_answer = static function ( $topic, $intent_name, $link_var, $url ) use ( $lang, $answer ) { 3034 $text = Winalt_Language_Lexicon::response( $lang, $intent_name, array( $link_var => $url ) ); 3035 return '' === $text ? null : $answer( $text, $topic, '' !== $url ); 3036 }; 3037 3038 switch ( $intent ) { 3039 case 'human_handoff': 3040 if ( get_option( 'winalt_live_chat_enabled' ) ) { 3041 return $this->build_live_chat_handoff_response(); 3042 } 3043 $text = Winalt_Language_Lexicon::response( $lang, 'handoff_unavailable', array( 'contact_link' => $contact_url ) ); 3044 return '' === $text ? null : $answer( $text, 'contact', '' !== $contact_url ); 3045 3046 case 'shipping': 3047 return $topic_answer( 'shipping', 'shipping_info', 'page_link', $page_url( 'winalt_shipping_page' ) ); 3048 3049 case 'returns': 3050 return $topic_answer( 'returns', 'returns_info', 'page_link', $page_url( 'winalt_return_page' ) ); 3051 3052 case 'hours': 3053 return $topic_answer( 'hours', 'hours_info', 'page_link', $page_url( 'winalt_hours_page' ) ); 3054 3055 case 'contact': 3056 return $topic_answer( 'contact', 'contact_info', 'page_link', $contact_url ); 3057 3058 case 'order_status': 3059 return $topic_answer( 'order', 'order_status', 'contact_link', $contact_url ); 3060 3061 case 'payment': 3062 $titles = array(); 3063 if ( function_exists( 'WC' ) && WC() && WC()->payment_gateways() ) { 3064 foreach ( WC()->payment_gateways()->get_available_payment_gateways() as $gateway ) { 3065 $title = trim( wp_strip_all_tags( (string) $gateway->get_title() ) ); 3066 if ( '' !== $title ) { 3067 $titles[] = $title; 3068 } 3069 } 3070 } 3071 $text = Winalt_Language_Lexicon::response( $lang, 'payment_info', array( 'payment_methods' => implode( Winalt_Language_Lexicon::list_separator( $lang ), $titles ) ) ); 3072 return '' === $text ? null : $answer( $text, 'payment', false ); 3073 3074 case 'discount': 3075 $text = Winalt_Language_Lexicon::response( $lang, 'discount_info' ); 3076 return '' === $text ? null : $answer( $text, 'discount', false ); 3077 3078 case 'cart': 3079 return $this->handle_cart_query( $message ); 3080 3081 case 'greeting': 3082 case 'how_are_you': 3083 case 'thanks': 3084 case 'farewell': 3085 case 'capabilities': 3086 $text = Winalt_Language_Lexicon::response( $lang, Winalt_Language_Lexicon::INTENT_NAMES[ $intent ], array( 'store_name' => sanitize_text_field( get_bloginfo( 'name' ) ) ) ); 3087 if ( '' === $text ) { 3088 return null; 3089 } 3090 $data = array( 3091 'subtype' => $intent, 3092 'source' => 'language_lexicon', 3093 ); 3094 if ( in_array( $intent, array( 'greeting', 'capabilities' ), true ) && isset( $this->modules['conversation'] ) ) { 3095 $data['suggestions'] = $this->modules['conversation']->get_suggestions( $context ); 3096 } 3097 return array( 3098 'response' => $text, 3099 'type' => 'conversation', 3100 'data' => $data, 3101 'intent' => array( 3102 'type' => 'conversation', 3103 'subtype' => $intent, 3104 ), 3105 'context_used' => false, 3106 ); 3107 } 3108 3109 return null; 3110 } 3111 3112 /** 3113 * Search the catalogue for a product named in a non-English message and 3114 * answer in the shopper's language. Words are matched as written (the 3115 * store's own product names), so this works for stores whose catalogue is 3116 * in the shopper's language. 3117 * 3118 * @since 1.69.45 3119 * @param string $message Visitor message. 3120 * @param array $context Conversation history. 3121 * @return array|null Response payload, or null to continue with normal routing. 3122 */ 3123 private function handle_lexicon_product_search( $message, $context ) { 3124 $lang = Winalt_Language_Lexicon::detect_language( $message ); 3125 if ( null === $lang ) { 3126 return null; 3127 } 3128 3129 $term = Winalt_Language_Lexicon::product_term( $message, $lang ); 3130 if ( '' === $term ) { 3131 return array( 3132 'response' => Winalt_Language_Lexicon::response( $lang, 'product_not_sure' ), 3133 'type' => 'clarification_needed', 3134 'data' => array(), 3135 'intent' => array( 'type' => 'clarification' ), 3136 'context_used' => false, 3137 ); 3138 } 3139 3140 // A bare phrase of several words with no request wording ("do you 3141 // have ...", "I want ...") is probably not a product search. 3142 if ( ! Winalt_Language_Lexicon::has_request_words( $message, $lang ) && count( preg_split( '/\s+/u', $term, -1, PREG_SPLIT_NO_EMPTY ) ) > 2 ) { 3143 return array( 3144 'response' => Winalt_Language_Lexicon::response( $lang, 'product_not_sure' ), 3145 'type' => 'clarification_needed', 3146 'data' => array(), 3147 'intent' => array( 'type' => 'clarification' ), 3148 'context_used' => false, 3149 ); 3150 } 3151 3152 $result = $this->modules['product']->process( 3153 $term, 3154 array( 3155 'type' => 'product_search', 3156 'keywords' => array( $term ), 3157 ), 3158 $context 3159 ); 3160 $products = isset( $result['data']['products'] ) && is_array( $result['data']['products'] ) ? $result['data']['products'] : array(); 3161 3162 if ( 'product_results' === ( $result['type'] ?? '' ) && ! empty( $products ) ) { 3163 $lead = Winalt_Language_Lexicon::response( $lang, 'product_found', array( 'count' => count( $products ), 'term' => $term ) ); 3164 return array( 3165 'response' => $this->modules['formatter']->format( $lead, 'product_results', $result['data'] ), 3166 'type' => 'product_results', 3167 'data' => $result['data'], 3168 'intent' => array( 'type' => 'product_search' ), 3169 'context_used' => false, 3170 ); 3171 } 3172 3173 return array( 3174 'response' => Winalt_Language_Lexicon::response( $lang, 'product_not_found', array( 'term' => $term ) ), 3175 'type' => 'help', 3176 'data' => array( 3177 'category' => 'no_results', 3178 'language' => $lang, 3179 'search_term' => $term, 3180 'language_lexicon' => true, 3181 ), 3182 'intent' => array( 'type' => 'product_search' ), 3183 'context_used' => false, 3184 ); 3185 } 3186 3187 /** 2971 3188 * Detect order status queries ("where is my order", "track my order", etc.). 2972 3189 * -
winaltchat-for-woocommerce/tags/1.67.50/includes/class-winalt-order-lookup.php
r3788419 r3825228 246 246 if ( '' === trim( $message ) || strlen( $message ) > 500 ) { 247 247 return false; 248 } 249 250 // Other languages: the phrase lists in Winalt_Language_Lexicon. 251 if ( ! class_exists( 'Winalt_Language_Lexicon' ) && defined( 'WINALT_PATH' ) ) { 252 require_once WINALT_PATH . 'includes/basic-ai/helpers/class-winalt-language-lexicon.php'; 253 } 254 if ( class_exists( 'Winalt_Language_Lexicon' ) ) { 255 $lexicon_match = Winalt_Language_Lexicon::match( $message ); 256 if ( null !== $lexicon_match && 'order_status' === $lexicon_match['intent'] ) { 257 return true; 258 } 248 259 } 249 260 -
winaltchat-for-woocommerce/tags/1.67.50/includes/class-winalt-pattern-sync.php
r3788419 r3825228 1 1 <?php 2 2 /** 3 * Admin-managed pattern/response sync for Basic AI Mode.3 * Pattern/response data for Basic AI Mode in a non-English chat language. 4 4 * 5 * Purpose: pull the intent/pattern/response dataset curated on 6 * aisalesmanchatpro.com (api/get-chat-patterns.php) into local cache 7 * tables, so support staff can add/tune patterns from a web admin panel 8 * without a plugin code change or release. STRICTLY ADDITIVE: every 5 * The dataset is curated on aisalesmanchatpro.com (Chat Patterns). English 6 * lives in this plugin's own code, so a store running in English never 7 * contacts the website. When the owner chooses another Chat language (and 8 * after a plugin update), the plugin downloads the patterns for that one 9 * language into local cache tables. There is no daily or background sync. 10 * STRICTLY ADDITIVE: every 9 11 * hardcoded pattern already in class-winalt-conversation-flow.php and 10 12 * class-winalt-basic-ai-core.php stays exactly as it is and remains the … … 58 60 59 61 /** 62 * One-time event scheduled after a plugin update to refresh the chosen 63 * language's data. 64 * 65 * @since 1.69.52 66 * @var string 67 */ 68 const UPDATE_CRON_HOOK = 'winalt_pattern_sync_update_run'; 69 70 /** 71 * Option set to '1' when the last download failed, so the screen can offer 72 * a Retry button. 73 * 74 * @since 1.69.52 75 * @var string 76 */ 77 const OPTION_ERROR = 'winalt_pattern_sync_error'; 78 79 /** 60 80 * Option storing the last successfully synced dataset_version. 61 81 * … … 78 98 /** 79 99 * Option storing the plugin version that last triggered an 80 * upgrade-time sync — see maybe_schedule_upgrade_sync(). Distinct100 * post-update refresh — see maybe_schedule_update_refresh(). Distinct 81 101 * from OPTION_VERSION, which tracks the remote DATASET version, not 82 102 * the plugin's own version. 83 103 * 84 * @since 1.2 6.0104 * @since 1.28.0 85 105 * @var string 86 106 */ … … 100 120 * self-heals a plugin version upgrade. 101 121 * 102 * @since 1.4 2.1122 * @since 1.44.1 103 123 * @var string 104 124 */ 105 125 const OPTION_LANGUAGE_SCOPE = 'winalt_pattern_sync_language_scope'; 106 107 /**108 * Option storing the site owner's opt-in list of EXTRA languages to109 * sync beyond the site's own WP locale (and "en", always included as110 * the fallback set) — comma-separated codes, e.g. "zh,ar,ru", set from111 * the Pattern Sync admin card. Empty/absent means "just this site's112 * own locale," the original, narrowest behavior. Deliberately NOT113 * `language=all`: as the central dataset grows to cover more114 * languages, defaulting every install to downloading all of them115 * would make sync payload size and local cache-rebuild cost scale116 * with the TOTAL dataset regardless of whether a given site has any117 * visitors in most of those languages.118 *119 * @since 1.43.0120 * @var string121 */122 const OPTION_EXTRA_LANGUAGES = 'winalt_pattern_sync_extra_languages';123 126 124 127 /** … … 144 147 * which is which before opting in. 145 148 * 146 * @since 1.4 5.0149 * @since 1.47.0 147 150 * @var array<string,array{label:string,matchable:bool}> 148 151 */ … … 202 205 * Register WordPress hooks. Call once during plugin bootstrap. 203 206 * 204 * Deliberately NOT gated behind an opt-in option (unlike 205 * Winalt_Usage_Tracking) — this sync sends no site-identifying or 206 * customer data (see build_request_args()'s docblock), only pulls 207 * admin-authored content, so there is nothing here that needs a 208 * consent gate the way the usage-ping does. 207 * There is no recurring sync. Older versions scheduled one: it is removed. 208 * The only automatic request is a single one after a plugin update, and 209 * only for a store whose Chat language is not English. 209 210 * 210 211 * @since 1.25.0 … … 212 213 */ 213 214 public function init() { 214 add_action( self::CRON_HOOK, array( $this, 'sync' ) ); 215 add_action( self::ACTIVATION_CRON_HOOK, array( $this, 'sync' ) ); 216 217 // Self-heal on every load, same reasoning as Winalt_Usage_Tracking's 218 // sync_cron_from_option(): deactivate/reactivate clears scheduled 219 // events without any option changing, so nothing else would 220 // otherwise reschedule this. 221 if ( ! wp_next_scheduled( self::CRON_HOOK ) ) { 222 wp_schedule_event( time() + DAY_IN_SECONDS, 'daily', self::CRON_HOOK ); 223 } 224 225 self::maybe_schedule_upgrade_sync(); 226 } 227 228 /** 229 * Schedule an immediate background sync the first time this runs 230 * under a new plugin version. 231 * 232 * WordPress only fires register_activation_hook() — and therefore 233 * schedule_activation_sync() — on a fresh activate/reactivate, NOT 234 * when an already-active plugin is upgraded to a new version via the 235 * normal "Update" flow. Without this, an existing site upgrading to a 236 * release that changed the synced dataset would only pick it up via 237 * the next daily cron tick (self-healed above) — up to ~24h away, 238 * and only if WP-Cron actually fires (it's request-driven, not a 239 * real system cron). This closes that gap the same way 240 * winalt_live_chat_maybe_upgrade() self-heals the Live Chat schema 241 * on version mismatch. 242 * 243 * Runs at most once per plugin version: the stored option is updated 244 * immediately after scheduling, so every other request just pays for 245 * one get_option() comparison. 246 * 247 * @since 1.26.0 215 foreach ( array( self::CRON_HOOK, self::ACTIVATION_CRON_HOOK ) as $hook ) { 216 if ( wp_next_scheduled( $hook ) ) { 217 wp_clear_scheduled_hook( $hook ); 218 } 219 } 220 221 add_action( self::UPDATE_CRON_HOOK, array( __CLASS__, 'run_update_refresh' ) ); 222 add_action( 'init', array( __CLASS__, 'maybe_schedule_update_refresh' ), 20 ); 223 } 224 225 /** 226 * After a plugin update, schedule one refresh of the chosen language's 227 * translation and patterns. Nothing is scheduled for an English store. 228 * 229 * @since 1.69.52 248 230 * @return void 249 231 */ 250 public static function maybe_schedule_up grade_sync() {251 $ synced_version = get_option( self::OPTION_SYNCED_PLUGIN_VERSION, '' );252 if ( defined( 'WINALT_VERSION' ) && WINALT_VERSION === $synced_version ) {232 public static function maybe_schedule_update_refresh() { 233 $version = defined( 'WINALT_VERSION' ) ? WINALT_VERSION : ''; 234 if ( get_option( self::OPTION_SYNCED_PLUGIN_VERSION, '' ) === $version ) { 253 235 return; 254 236 } 255 256 self::schedule_activation_sync(); 257 update_option( self::OPTION_SYNCED_PLUGIN_VERSION, defined( 'WINALT_VERSION' ) ? WINALT_VERSION : '' ); 237 update_option( self::OPTION_SYNCED_PLUGIN_VERSION, $version ); 238 239 if ( '' === self::target_language() ) { 240 // English is built in: drop anything an older version downloaded. 241 self::clear_cache(); 242 return; 243 } 244 if ( ! wp_next_scheduled( self::UPDATE_CRON_HOOK ) ) { 245 wp_schedule_single_event( time(), self::UPDATE_CRON_HOOK ); 246 } 247 } 248 249 /** 250 * The one-time refresh that follows a plugin update. 251 * 252 * @since 1.69.52 253 * @return void 254 */ 255 public static function run_update_refresh() { 256 if ( class_exists( 'Winalt_Translate' ) ) { 257 Winalt_Translate::refresh_ready_made(); 258 } 259 self::refresh(); 260 } 261 262 /** 263 * The dataset language the store needs: the Chat language the owner 264 * chose, or '' for English / not set (English is built into the plugin). 265 * 266 * @since 1.69.52 267 * @return string Dataset language code, for example "es" or "zh-tw". 268 */ 269 public static function target_language() { 270 if ( ! class_exists( 'Winalt_Translate' ) || ! Winalt_Translate::enabled() ) { 271 return ''; 272 } 273 $chosen = Winalt_Translate::chosen_language(); 274 if ( '' === $chosen || Winalt_Translate::is_english( $chosen ) ) { 275 return ''; 276 } 277 278 return self::dataset_language( $chosen ); 258 279 } 259 280 … … 265 286 * so it's fine for it to cost a few small COUNT queries. 266 287 * 267 * @since 1.2 6.0288 * @since 1.28.0 268 289 * @return array{version:string,last_synced_at:string,intents:int,patterns:int,responses:int} 269 290 */ … … 316 337 name VARCHAR(100) NOT NULL, 317 338 description TEXT NULL, 339 action VARCHAR(40) NULL, 318 340 PRIMARY KEY (id) 319 341 ) {$charset};"; … … 347 369 348 370 /** 349 * Schedule a one-time sync attempt shortly after activation, as a350 * background WP-Cron event rather than an inline HTTP call — so351 * activation itself never blocks on network I/O, and a slow/352 * unreachable endpoint can never make activation appear to hang or353 * fail. wp_schedule_single_event() with $time = now fires on the354 * very next WP-Cron run (typically the next page load), same355 * "practically immediate, never blocking" pattern used elsewhere in356 * this codebase for post-action background work.357 *358 * @since 1.25.0359 * @return void360 */361 public static function schedule_activation_sync() {362 if ( ! wp_next_scheduled( self::ACTIVATION_CRON_HOOK ) ) {363 wp_schedule_single_event( time(), self::ACTIVATION_CRON_HOOK );364 }365 }366 367 /**368 371 * Detect the site's language as a short code matching the dataset's 369 372 * "en" / "fa" style (get_locale() returns "en_US" / "fa_IR" style). … … 395 398 * Chinese. 396 399 * 397 * @since 1.4 2.0400 * @since 1.44.0 398 401 * @param string $message Raw user message. 399 402 * @return string Language code to match/query against. … … 424 427 425 428 /** 426 * The language codes to actually request from aisalesmanchatpro.com: 427 * the site's own locale, "en" (always the API's fallback set anyway), 428 * plus whatever the site owner opted into via OPTION_EXTRA_LANGUAGES. 429 * Returns a sorted, deduped, comma-joined string — sorted so the 430 * scope string is stable regardless of the order an admin typed 431 * languages in, which matters for the OPTION_LANGUAGE_SCOPE 432 * comparison in sync() not force-refetching on every single sync 433 * just because "zh,ar" and "ar,zh" look different as strings. 434 * 435 * @since 1.43.0 436 * @return string Comma-separated language codes, e.g. "ar,en,zh". 437 */ 438 private static function resolve_language_scope() { 439 $languages = array( self::get_site_language(), 'en' ); 440 441 // The language the owner chose for the chat box: its patterns are 442 // synced automatically, no separate setting needed. 443 if ( class_exists( 'Winalt_Translate' ) ) { 444 $chat_language = strtolower( substr( Winalt_Translate::chosen_language(), 0, 2 ) ); 445 if ( preg_match( '/^[a-z]{2,3}$/', $chat_language ) ) { 446 $languages[] = $chat_language; 447 } 448 } 449 450 $extra = (string) get_option( self::OPTION_EXTRA_LANGUAGES, '' ); 451 if ( '' !== $extra ) { 452 foreach ( explode( ',', $extra ) as $lang ) { 453 $lang = strtolower( trim( $lang ) ); 454 $lang = preg_replace( '/[^a-z\-]/', '', $lang ); 455 if ( '' !== $lang ) { 456 $languages[] = $lang; 457 } 458 } 459 } 460 461 $languages = array_values( array_unique( $languages ) ); 462 sort( $languages ); 463 464 return implode( ',', $languages ); 465 } 466 467 /** 468 * Run one sync attempt: fetch, and only replace the local cache when 469 * the remote dataset_version has actually moved on. 470 * 471 * Fire-and-forget in spirit: ANY failure (network error, timeout, 472 * non-200, unparseable JSON, missing expected fields) is caught and 473 * silently ignored — this method never throws, never surfaces 474 * anything to the site owner, and always leaves whatever is already 475 * cached locally untouched on failure. That's the whole point: a 476 * site that has never synced, or whose every sync attempt has 477 * failed, must behave identically to the plugin's pre-sync behavior. 478 * 479 * @since 1.25.0 480 * @return void 481 */ 482 public function sync() { 483 $desired_scope = self::resolve_language_scope(); 484 485 // A site whose desired scope has changed since its last successful 486 // sync — a fresh install, an admin adding/removing an extra 487 // language, or an upgrade from an older per-locale-only request — 488 // must not send `since`: the dataset_version cheap-check has no 489 // memory of what language SCOPE a cached snapshot was built from, 490 // only whether the content has changed since, so it would 491 // otherwise report "unchanged" forever and this site would stay 492 // stuck on a stale-scope cache even though what it wants has 493 // changed. 494 $force_full_refetch = ( get_option( self::OPTION_LANGUAGE_SCOPE, '' ) !== $desired_scope ); 429 * The dataset's language code for a WordPress locale ("zh_TW" is 430 * "zh-tw", "nb_NO" and "no" are "nb"; otherwise the two-letter code). 431 * 432 * @since 1.69.47 433 * @param string $locale Locale such as "es_ES". 434 * @return string Dataset language code. 435 */ 436 public static function dataset_language( $locale ) { 437 $locale = strtolower( str_replace( '-', '_', (string) $locale ) ); 438 if ( 'zh_tw' === $locale || 'zh_hk' === $locale ) { 439 return 'zh-tw'; 440 } 441 $code = substr( $locale, 0, 2 ); 442 if ( 'no' === $code || 'nn' === $code ) { 443 return 'nb'; 444 } 445 446 return '' === $code ? 'en' : $code; 447 } 448 449 /** 450 * Download the patterns for the chosen Chat language and replace the local 451 * cache with them. For an English store this clears the cache and makes no 452 * request. On any failure the existing cache is kept and the error flag is 453 * set, so the screen can offer a Retry button. 454 * 455 * @since 1.69.52 456 * @return array{ok:bool,message:string} 457 */ 458 public static function refresh() { 459 $language = self::target_language(); 460 if ( '' === $language ) { 461 self::clear_cache(); 462 delete_option( self::OPTION_ERROR ); 463 464 return array( 465 'ok' => true, 466 'message' => '', 467 ); 468 } 469 470 $failed = array( 471 'ok' => false, 472 'message' => __( 'The reply patterns for this language could not be loaded. Check your connection and try again.', 'winaltchat-for-woocommerce' ), 473 ); 495 474 496 475 $response = wp_safe_remote_get( 497 $this->build_request_url( $desired_scope, $force_full_refetch),476 self::build_request_url( $language ), 498 477 array( 499 'timeout' => 8,478 'timeout' => 10, 500 479 'sslverify' => true, 501 480 ) 502 481 ); 503 482 504 if ( is_wp_error( $response ) ) { 505 return; 506 } 507 508 if ( 200 !== (int) wp_remote_retrieve_response_code( $response ) ) { 509 return; 510 } 511 512 $body = json_decode( wp_remote_retrieve_body( $response ), true ); 513 if ( ! is_array( $body ) || empty( $body['dataset_version'] ) ) { 514 return; 515 } 516 517 $remote_version = sanitize_text_field( (string) $body['dataset_version'] ); 518 $local_version = get_option( self::OPTION_VERSION, '' ); 519 520 // Cheap-check hit ("unchanged") or the version is otherwise 521 // unchanged — nothing to do. Skipped when this was a forced full 522 // refetch: the version can be identical to what's already cached 523 // while the PAYLOAD still isn't (a wider language scope than 524 // last time), so it must still be written even though the 525 // version itself didn't move. 526 if ( ! $force_full_refetch && $remote_version === $local_version ) { 527 return; 528 } 529 530 // A version bump with no payload (shouldn't happen per the API's 531 // own contract, but never trust a remote response blindly) — skip 532 // rather than wipe local data based on an incomplete response. 533 if ( ! isset( $body['intents'], $body['patterns'], $body['responses'] ) 483 $body = null; 484 if ( ! is_wp_error( $response ) && 200 === (int) wp_remote_retrieve_response_code( $response ) ) { 485 $body = json_decode( wp_remote_retrieve_body( $response ), true ); 486 } 487 if ( ! is_array( $body ) || empty( $body['dataset_version'] ) 488 || ! isset( $body['intents'], $body['patterns'], $body['responses'] ) 534 489 || ! is_array( $body['intents'] ) || ! is_array( $body['patterns'] ) || ! is_array( $body['responses'] ) 535 490 ) { 491 update_option( self::OPTION_ERROR, '1', false ); 492 493 return $failed; 494 } 495 496 // Only the chosen language is kept, whatever the server sent. 497 $patterns = array_values( array_filter( $body['patterns'], static function ( $row ) use ( $language ) { 498 return isset( $row['language'] ) && $language === $row['language']; 499 } ) ); 500 $responses = array_values( array_filter( $body['responses'], static function ( $row ) use ( $language ) { 501 return isset( $row['language'] ) && $language === $row['language']; 502 } ) ); 503 504 if ( file_exists( ABSPATH . 'wp-admin/includes/upgrade.php' ) ) { 505 // Make sure the cache tables have the newest columns (dbDelta is a no-op when they do). 506 self::install(); 507 } 508 509 if ( ! self::replace_local_cache( $body['intents'], $patterns, $responses ) ) { 510 update_option( self::OPTION_ERROR, '1', false ); 511 512 return $failed; 513 } 514 515 update_option( self::OPTION_VERSION, sanitize_text_field( (string) $body['dataset_version'] ) ); 516 update_option( self::OPTION_LAST_SYNCED_AT, current_time( 'mysql', true ) ); 517 update_option( self::OPTION_LANGUAGE_SCOPE, $language ); 518 delete_option( self::OPTION_ERROR ); 519 520 return array( 521 'ok' => true, 522 'message' => '', 523 ); 524 } 525 526 /** 527 * Remove everything downloaded (used when the chat goes back to English). 528 * 529 * @since 1.69.52 530 * @return void 531 */ 532 public static function clear_cache() { 533 global $wpdb; 534 535 if ( '' === get_option( self::OPTION_VERSION, '' ) ) { 536 536 return; 537 537 } 538 538 539 $this->replace_local_cache( $body['intents'], $body['patterns'], $body['responses'] ); 540 541 update_option( self::OPTION_VERSION, $remote_version ); 542 update_option( self::OPTION_LAST_SYNCED_AT, current_time( 'mysql', true ) ); 543 update_option( self::OPTION_LANGUAGE_SCOPE, $desired_scope ); 544 } 545 546 /** 547 * Build the outbound request URL. 548 * 549 * `language` is this site's own locale + "en" + whatever the site 550 * owner opted into via OPTION_EXTRA_LANGUAGES (see 551 * resolve_language_scope()), NOT just the site's own locale: a 552 * visitor's message language and the site owner's WP locale are two 553 * different things — most stores serving occasional non-English- 554 * speaking visitors still run their own WP install in English, so 555 * syncing only the site's own locale would mean any OTHER language's 556 * dataset (Chinese patterns added on the admin panel, say) never 557 * reaches this cache at all, no matter how many times "Sync Now" 558 * runs. Deliberately NOT `language=all`: as the central dataset grows 559 * to cover more languages, every install downloading the full thing 560 * regardless of relevance would make sync payload size and local 561 * cache-rebuild cost scale with the total dataset, not what this 562 * particular site's visitors actually use. find_response() below 563 * still only ever MATCHES against one language per message (detected 564 * from the message itself, not the whole requested scope). 565 * 566 * CRITICAL PRIVACY CONSTRAINT: only `language` and `since` (the 567 * locally cached dataset_version string — an opaque version marker, 568 * not a real timestamp of any activity) are ever sent. No site_url, 569 * no customer message content, no conversation data, no product data, 570 * no IP-identifying parameter of any kind is included — 571 * wp_safe_remote_get() itself necessarily reveals the requesting IP 572 * at the TCP/HTTP level (true of any HTTP request to anywhere), but 573 * nothing beyond that transport-level minimum is added here. 574 * 575 * @since 1.25.0 576 * @param string $language_scope Comma-separated language codes to 577 * request — see resolve_language_scope(). 578 * @param bool $force_full_refetch When true, omit `since` even if a 579 * cached version exists — see sync()'s 580 * use of this for the language-scope 581 * self-heal. 582 * @return string Full request URL with query args. 583 */ 584 private function build_request_url( $language_scope, $force_full_refetch = false ) { 585 $args = array( 586 'language' => $language_scope, 539 foreach ( array( self::patterns_table(), self::responses_table(), self::intents_table() ) as $table ) { 540 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching -- emptying our own cache table; table name passed via %i. 541 $wpdb->query( $wpdb->prepare( 'DELETE FROM %i', $table ) ); 542 } 543 delete_option( self::OPTION_VERSION ); 544 delete_option( self::OPTION_LAST_SYNCED_AT ); 545 delete_option( self::OPTION_LANGUAGE_SCOPE ); 546 } 547 548 /** 549 * Build the request URL. 550 * 551 * PRIVACY: only the language, the feature flag and `exclusive` (give me 552 * just this language) are sent. No site address, no edition, no version, 553 * no customer or visitor data. wp_safe_remote_get() reveals the requesting 554 * IP at the transport level, as any HTTP request does. Disclosed in 555 * readme.txt. 556 * 557 * @since 1.25.0 558 * @param string $language Dataset language code. 559 * @return string Full request URL. 560 */ 561 private static function build_request_url( $language ) { 562 return self::ENDPOINT . '?' . http_build_query( 563 array( 564 'language' => $language, 565 'features' => 'actions', 566 'exclusive' => '1', 567 ) 587 568 ); 588 589 $cached_version = get_option( self::OPTION_VERSION, '' );590 if ( ! $force_full_refetch && '' !== $cached_version ) {591 $args['since'] = $cached_version;592 }593 594 // Plain http_build_query() rather than add_query_arg()'s array595 // form — both work fine against a plugin's own hardcoded base596 // URL, but this keeps the request-building logic dependency-free597 // PHP, easier to unit-test without a full WordPress stub layer.598 return self::ENDPOINT . '?' . http_build_query( $args );599 569 } 600 570 … … 611 581 * @param array $patterns Remote patterns payload. 612 582 * @param array $responses Remote responses payload. 613 * @return void614 */ 615 private function replace_local_cache( $intents, $patterns, $responses ) {583 * @return bool True when the cache was replaced. 584 */ 585 private static function replace_local_cache( $intents, $patterns, $responses ) { 616 586 global $wpdb; 617 587 … … 638 608 'name' => sanitize_text_field( (string) $intent['name'] ), 639 609 'description' => isset( $intent['description'] ) ? sanitize_textarea_field( (string) $intent['description'] ) : '', 610 'action' => ( isset( $intent['action'] ) && is_string( $intent['action'] ) && '' !== $intent['action'] ) ? sanitize_key( $intent['action'] ) : null, 640 611 ), 641 array( '%d', '%s', '%s' )612 array( '%d', '%s', '%s', '%s' ) 642 613 ) ); 643 614 } … … 683 654 if ( $ok ) { 684 655 $wpdb->query( 'COMMIT' ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching -- transaction control, not a data query. 656 return true; 685 657 } else { 686 658 // Never leave a half-written cache — roll back to whatever was … … 690 662 $wpdb->query( 'ROLLBACK' ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching -- transaction control, not a data query. 691 663 } 664 665 return false; 692 666 } 693 667 … … 760 734 FROM %i p 761 735 INNER JOIN %i i ON i.id = p.intent_id 762 WHERE p.language = %s ',736 WHERE p.language = %s AND ( i.action IS NULL OR i.action = \'\' )', 763 737 $patterns_table, 764 738 $intents_table, -
winaltchat-for-woocommerce/tags/1.67.50/includes/class-winalt-translate.php
r3788419 r3825228 66 66 add_action( 'wp_ajax_winalt_translate_toggle', array( __CLASS__, 'ajax_toggle' ) ); 67 67 add_action( 'wp_ajax_winalt_translate_now', array( __CLASS__, 'ajax_translate' ) ); 68 add_action( 'wp_ajax_winalt_patterns_retry', array( __CLASS__, 'ajax_patterns_retry' ) ); 68 69 add_action( 'wp_ajax_winalt_translate_preview', array( __CLASS__, 'ajax_preview' ) ); 69 70 … … 626 627 */ 627 628 public static function fetch_ready_made( $locale, $sources ) { 628 $edition = defined( 'WINALT_ VERSION' ) ? 'pro' : 'free';629 $version = defined( 'WINALT_ VERSION' ) ? WINALT_VERSION : ( defined( 'WINALT_VERSION' ) ? WINALT_VERSION : '' );629 $edition = defined( 'WINALT_PRO_VERSION' ) ? 'pro' : 'free'; 630 $version = defined( 'WINALT_PRO_VERSION' ) ? WINALT_PRO_VERSION : ( defined( 'WINALT_VERSION' ) ? WINALT_VERSION : '' ); 630 631 631 632 $response = wp_safe_remote_get( … … 642 643 643 644 return self::parse_remote( wp_remote_retrieve_body( $response ), $sources ); 645 } 646 647 /** 648 * Refresh the ready-made translation of the chosen language from the 649 * website (no AI key is ever used here). Used after a plugin update and by 650 * the Retry button. 651 * 652 * @since 1.67.45 653 * @return bool False only when there is no translation at all for the chosen language. 654 */ 655 public static function refresh_ready_made() { 656 $locale = self::target_locale(); 657 if ( ! self::enabled() || self::is_english( $locale ) ) { 658 return true; 659 } 660 661 $sources = self::source_strings(); 662 $ready = empty( $sources ) ? null : self::fetch_ready_made( $locale, $sources ); 663 if ( null !== $ready ) { 664 update_option( 665 self::OPTION_DATA, 666 array( 667 'locale' => $locale, 668 'generated' => time(), 669 'source' => 'ready-made', 670 'strings' => $ready, 671 ), 672 false 673 ); 674 675 return true; 676 } 677 678 // Keep what is already stored for this language (ready-made or AI). 679 $data = (array) get_option( self::OPTION_DATA, array() ); 680 681 return isset( $data['locale'] ) && $data['locale'] === $locale && ! empty( $data['strings'] ); 644 682 } 645 683 … … 771 809 ); 772 810 811 $status['patterns_error'] = '1' === (string) get_option( 'winalt_pattern_sync_error', '0' ); 812 $status['patterns_message'] = __( 'The reply patterns for this language could not be loaded. Check your connection and try again.', 'winaltchat-for-woocommerce' ); 773 813 $status['chosen'] = self::chosen_language(); 774 814 $status['preview'] = self::preview_map(); … … 789 829 $on = isset( $_POST['enabled'] ) && '1' === sanitize_text_field( wp_unslash( $_POST['enabled'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing -- verified in guard(). 790 830 update_option( self::OPTION_ENABLED, $on ? '1' : '0', false ); 831 if ( class_exists( 'Winalt_Pattern_Sync' ) ) { 832 // Off means English: the downloaded patterns are removed. 833 Winalt_Pattern_Sync::refresh(); 834 } 791 835 792 836 wp_send_json_success( array( 'status' => self::current_status() ) ); … … 864 908 update_option( self::OPTION_ENABLED, '1', false ); 865 909 866 // Reply patterns for this language are fetched in the background. 910 // The reply patterns for this language come from the website too. A 911 // failure is shown on the screen with a Retry button. 867 912 if ( class_exists( 'Winalt_Pattern_Sync' ) ) { 868 Winalt_Pattern_Sync:: schedule_activation_sync();913 Winalt_Pattern_Sync::refresh(); 869 914 } 870 915 … … 880 925 881 926 /** 927 * AJAX: try again to load the translation and patterns for the chosen 928 * language (the Retry button). 929 * 930 * @since 1.67.45 931 * @return void 932 */ 933 public static function ajax_patterns_retry() { 934 self::guard(); 935 936 self::refresh_ready_made(); 937 $result = class_exists( 'Winalt_Pattern_Sync' ) ? Winalt_Pattern_Sync::refresh() : array( 'ok' => true ); 938 939 $payload = array( 940 'ok' => ! empty( $result['ok'] ), 941 'status' => self::current_status(), 942 ); 943 if ( $payload['ok'] ) { 944 wp_send_json_success( $payload ); 945 } 946 wp_send_json_error( $payload, 400 ); 947 } 948 949 /** 882 950 * Nonce and capability check shared by the endpoints. 883 951 * -
winaltchat-for-woocommerce/tags/1.67.50/readme.txt
r3788451 r3825228 4 4 Requires at least: 6.2 5 5 Tested up to: 7.1 6 Stable tag: 1.67. 376 Stable tag: 1.67.50 7 7 Requires PHP: 7.4 8 8 Requires Plugins: woocommerce … … 92 92 Chat messages and visitor details are never sent to an external 93 93 service by live chat. The optional features that contact one 94 (AI providers, translations, pattern sync, mobile push) are listed94 (AI providers, translations, reply patterns, mobile push) are listed 95 95 under External Services below. 96 96 * Session tokens are 32-character cryptographically random strings, … … 267 267 * **Winalt Technologies:** [aisalesmanchatpro.com](https://aisalesmanchatpro.com) | [Privacy Policy](https://aisalesmanchatpro.com/privacy-policy.html) 268 268 269 **Basic AI Pattern Sync (automatic and in the background, about once a day, once after activation, and whenever you choose a new chat language)** 270 271 Basic AI mode periodically pulls an updated set of intents, patterns, 272 and responses from Winalt Technologies so its built-in conversational 273 replies can improve and cover more languages over time. Only your 274 site's detected language and the version number of the pattern set 275 you already have cached are sent. Nothing else. Your customer 276 messages, conversation content, and product data are never sent as 277 part of this sync, and never leave your site for this feature. If the 278 sync ever fails (network error, timeout, or Winalt Technologies is 279 unreachable), Basic AI mode silently keeps using whatever it already 280 has cached, or its original built-in patterns if it has never synced 281 successfully. Nothing breaks and no data is lost. 269 **Basic AI reply patterns in another language (only when your Chat language is not English)** 270 271 English wording and reply patterns are built into the plugin, so a store running in English contacts no server for this. When you choose another Chat language and press Apply, and once after the plugin is updated, the plugin downloads that language's reply patterns from Winalt Technologies into your own database. Sent with the request: the language you chose, and nothing else. No site address, plugin version, customer message, visitor detail or product data is sent. There is no background or recurring sync. If the download fails, the screen says so and offers a Retry button; the plugin keeps what it already has in the meantime. 282 272 283 273 * **Winalt Technologies:** [aisalesmanchatpro.com](https://aisalesmanchatpro.com) | [Privacy Policy](https://aisalesmanchatpro.com/privacy-policy.html) … … 292 282 **Chat language - ready-made translations (only when you choose a language on the Appearance screen)** 293 283 294 When you choose a language in Chat language on the Appearance screen and press Translate, the plugin asks Winalt Technologies for a ready-made translation of the chat buttons and messages in that language, so you do not need an AI key. The list of available languages is fetched the same way (nothing is sent with it). Sent with the translation request: your site's home address, the language you chose, and the plugin edition and version. Winalt Technologies keeps one record per site and language (with a request counter and first/last request dates) so it can see which languages store owners need and add them. Never sent: customer messages, visitor details, or any chat or product data. Nothing is requested unless you press Translate . The translations are machine-generated and should be checked by a native speaker. If no ready-made translation exists yet, the plugin uses your own AI provider key instead, if you have connected one.284 When you choose a language in Chat language on the Appearance screen and press Translate, the plugin asks Winalt Technologies for a ready-made translation of the chat buttons and messages in that language, so you do not need an AI key. The list of available languages is fetched the same way (nothing is sent with it). Sent with the translation request: your site's home address, the language you chose, and the plugin edition and version. Winalt Technologies keeps one record per site and language (with a request counter and first/last request dates) so it can see which languages store owners need and add them. Never sent: customer messages, visitor details, or any chat or product data. Nothing is requested unless you press Translate, apart from one refresh of the language you already chose after a plugin update. The translations are machine-generated and should be checked by a native speaker. If no ready-made translation exists yet, the plugin uses your own AI provider key instead, if you have connected one. 295 285 296 286 * **Winalt Technologies** - [aisalesmanchatpro.com](https://aisalesmanchatpro.com) | [Privacy Policy](https://aisalesmanchatpro.com/privacy-policy.html) 297 287 298 288 == Changelog == 289 290 = 1.67.50 = 291 * Improve: Removed the extra hint text under Chat language on the Appearance screen. 292 293 = 1.67.49 = 294 * Improve: The Appearance tab bar now matches the Live Chats bar and shows in Advanced view only. Typography and Chat language have their own tabs, and the "Customize wording" box is gone: Quick replies and Messages are ordinary tabs. 295 296 = 1.67.48 = 297 * New: In Advanced view the Appearance screen is split into tabs (Style, Branding, Engagement, Quick replies, Messages) so you no longer scroll one long page. Simple view is unchanged. 298 299 = 1.67.47 = 300 * Fix: A store running in English now removes reply patterns that an older version had downloaded, so English always uses the wording built into the plugin. 301 302 = 1.67.46 = 303 * Change: Reply patterns and the ready-made translation for a non-English Chat language are downloaded from Winalt Technologies only when you choose that language and once after a plugin update. English is built in and contacts no server. There is no daily or background sync, and no site address is sent with the patterns. If a download fails the screen offers a Retry button. 304 305 = 1.67.44 = 306 * Improve: Basic AI Pattern Sync now sends your site's home address, plugin edition and version with each request, so Winalt Technologies can see which sites sync. The readme's external services section describes exactly what is sent. No customer or visitor data is sent. 307 308 = 1.67.43 = 309 * Fix: Chinese is now synced in both Simplified and Traditional characters together, so Traditional Chinese questions are understood on stores set to Simplified Chinese, and the other way round. 310 311 = 1.67.42 = 312 * Fix: Product searches written in a non-English language ended in an error message instead of showing products. 313 314 = 1.67.41 = 315 * Improve: The non-English phrases and replies Basic AI uses are no longer stored in the plugin. They are managed on the plugin website and synced for your site language, English and the Chat language you choose, so wording can be improved without a plugin update. Nothing changes for English. 316 317 = 1.67.40 = 318 * New: Basic AI now understands 28 languages besides English: Spanish, French, German, Italian, Portuguese, Dutch, Russian, Ukrainian, Turkish, Polish, Arabic, Persian, Hebrew, Greek, Hindi, Thai, Japanese, Korean, Chinese (Simplified and Traditional), Indonesian, Vietnamese, Swedish, Danish, Norwegian, Finnish, Czech, Romanian and Hungarian. Shoppers can ask about orders, returns, shipping, opening hours, contact details, payment methods, discounts, the cart and talking to a person, and are answered in their own language using your store's own pages. Products are found by the names used in your catalogue. English is unchanged. 319 320 = 1.67.39 = 321 * New: Basic AI now understands Chinese. It answers questions about orders, returns, shipping, opening hours, contact details, payment methods, discounts, the cart and talking to a person, in Chinese, using your store's own pages. It also finds products by their Chinese names and handles greetings, thanks and goodbyes without needing a sync. English is unchanged. 322 * Fix: the free plugin reported itself as Pro when asking for chat translations; it now reports Free. 323 324 = 1.67.38 = 325 * Fix: The "copy our support email" button in the admin now copies info@winalttechnologies.com. 299 326 300 327 = 1.67.37 = … … 303 330 304 331 = 1.67.36 = 305 * Fix: The readme no longer says nothing is ever sent to an outside service. It now points to the External Services list (AI providers, translations, pattern sync, mobile push).332 * Fix: The readme no longer says nothing is ever sent to an outside service. It now points to the External Services list (AI providers, translations, reply patterns, mobile push). 306 333 307 334 = 1.67.35 = 308 335 * Improve: The mobile app is limited to 3 phones per site on the free plan. A 4th phone gets a clear "limit reached" message; signing out on one phone frees its slot. The same account can still sign in on several phones, and a phone whose notification token refreshes keeps its place. 309 310 = 1.67.34 =311 * Fix: The chat no longer gives customers an email address taken from the WooCommerce or WordPress settings. It only uses the address published on your Contact page, in its own replies and in the AI model's instructions. With no email on the Contact page, no address is given.312 * Fix: An address you put on the Contact page is always used as written, even if it looks like an example. This undoes the 1.67.33 rule that skipped such addresses.313 314 = 1.67.33 =315 * Fix: "Most expensive" now lists the priciest products first, and "cheap gifts under $15" applies the $15 limit.316 * Fix: A single result reads "Here is 1 product", and the sale list is topped up with other sale items instead of showing one.317 * Fix: A placeholder contact address (example.com, .test) is no longer shown to customers as the store's email.318 * Fix: The offline form rejects a mistyped email instead of saving a rewritten one.319 * Improve: Accessibility. The chat is a labelled dialog, new replies are read out to screen readers, the message box and send button have labels, Esc closes the chat, buttons are at least 44px on touch screens, and View Product and the send arrow follow Text on Primary so light brand colours stay readable.320 321 = 1.67.32 =322 * Fix: After a page reload during a live chat, the visitor's own messages showed raw text such as & and ". They now read normally, and delivery ticks match again.323 * Fix: When the chat limit is reached, the shopper now sees "Too many requests. Please wait a moment before trying again." instead of a generic error.324 325 = 1.67.31 =326 * Fix: Chats this week on the Home screen never counted real conversations, because the chat always sends the visitor's first message along with the request. Each new conversation is now counted once.327 328 = 1.67.30 =329 * Fix: Basic AI no longer adds made-up taglines before a single product ("Premium Quality", "Eco-Friendly", "Trusted by thousands", "Fast Delivery Available"). It now only mentions the shopper rating when the product has a good one with reviews.330 331 = 1.67.29 =332 * Fix: Removed the extra page-background and scroll-room rules that were added to chase a scroll flicker; free and Pro lay out the bottom of the screen the same way again.333 334 = 1.67.28 =335 * Fix: Live chat, the availability switch no longer moves when its label changes, the tabs (Live Conversations, Team Access, Settings) use the same soft highlight as the main menu, and the screen has a little scroll room underneath.336 337 = 1.67.27 =338 * Fix: Reset to Defaults on Appearance now shows the same colours that are saved (they differed until a refresh), sets Light or dark back to Light and clears the highlighted Style. Chat language is left as it was.339 340 = 1.67.26 =341 * Fix: Appearance, the Style you picked is remembered when you save, so it is still highlighted after reloading the screen.342 343 = 1.67.25 =344 * Fix: Appearance, the chosen Style stays highlighted after a reload, and the Style / Light or dark buttons and colour swatches have a visible hover in dark mode.345 346 = 1.67.24 =347 * Fix: Dark mode, the machine-translation note under Chat language is readable. The info tip says "our server" instead of the domain name.348 349 = 1.67.23 =350 * Improve: Appearance, the Style buttons now look like the Light or dark options, the live preview starts level with the first card, and the Chat language info tip is shorter and aligned.351 336 352 337 Earlier versions are listed in changelog.txt in the plugin folder. -
winaltchat-for-woocommerce/tags/1.67.50/uninstall.php
r3788419 r3825228 62 62 wp_clear_scheduled_hook( 'winalt_pattern_sync_run' ); 63 63 wp_clear_scheduled_hook( 'winalt_pattern_sync_activation_run' ); 64 wp_clear_scheduled_hook( 'winalt_pattern_sync_update_run' ); 64 65 65 66 /** … … 130 131 wp_clear_scheduled_hook( 'winalt_pattern_sync_run' ); 131 132 wp_clear_scheduled_hook( 'winalt_pattern_sync_activation_run' ); 133 wp_clear_scheduled_hook( 'winalt_pattern_sync_update_run' ); 132 134 133 135 // Delete options for this blog. -
winaltchat-for-woocommerce/tags/1.67.50/winaltchat-for-woocommerce.php
r3788451 r3825228 4 4 * Plugin URI: https://wordpress.org/plugins/winaltchat-for-woocommerce/ 5 5 * Description: WinaltChat adds an AI-powered chat widget to your WooCommerce store to help customers find products, answer questions, and boost sales. 6 * Version: 1.67. 376 * Version: 1.67.50 7 7 * Requires at least: 6.2 8 8 * Requires PHP: 7.4 … … 133 133 winalt_live_chat_install(); 134 134 135 // Attempt one pattern-sync shortly after activation, as a136 // background WP-Cron event — never an inline HTTP call here,137 // so activation itself can never block on or fail because of138 // network I/O. See Winalt_Pattern_Sync::schedule_activation_sync().139 Winalt_Pattern_Sync::schedule_activation_sync();140 135 } 141 136 } … … 151 146 152 147 // Define plugin-wide constants for version, file paths, and URLs. 153 define( 'WINALT_VERSION', '1.67. 37' );148 define( 'WINALT_VERSION', '1.67.50' ); 154 149 define( 'WINALT_FILE', __FILE__ ); 155 150 define( 'WINALT_PATH', plugin_dir_path( __FILE__ ) ); -
winaltchat-for-woocommerce/trunk/admin/class-winalt-chat-branding.php
r3788419 r3825228 719 719 <div class="winalt-settings-col"> 720 720 721 <?php Winalt_Guided_Setup::render_looks_card(); ?> 722 <?php Winalt_Guided_Setup::render_language_card(); ?> 721 <?php // Advanced view: the sections below are shown one tab at a time (see initAppearanceTabs() in guided-setup.js). Simple view shows them all. ?> 722 <div class="winalt-status-bar winalt-appearance-tabs"> 723 <div class="winalt-sub-tabs" role="tablist" aria-label="<?php esc_attr_e( 'Appearance sections', 'winaltchat-for-woocommerce' ); ?>"> 724 <button type="button" class="winalt-sub-tab is-active" role="tab" aria-selected="true" data-atab-target="style"><?php esc_html_e( 'Style', 'winaltchat-for-woocommerce' ); ?></button> 725 <button type="button" class="winalt-sub-tab" role="tab" aria-selected="false" data-atab-target="branding"><?php esc_html_e( 'Branding', 'winaltchat-for-woocommerce' ); ?></button> 726 <button type="button" class="winalt-sub-tab" role="tab" aria-selected="false" data-atab-target="typography"><?php esc_html_e( 'Typography', 'winaltchat-for-woocommerce' ); ?></button> 727 <button type="button" class="winalt-sub-tab" role="tab" aria-selected="false" data-atab-target="language"><?php esc_html_e( 'Chat language', 'winaltchat-for-woocommerce' ); ?></button> 728 <button type="button" class="winalt-sub-tab" role="tab" aria-selected="false" data-atab-target="engagement"><?php esc_html_e( 'Engagement', 'winaltchat-for-woocommerce' ); ?></button> 729 <button type="button" class="winalt-sub-tab" role="tab" aria-selected="false" data-atab-target="replies"><?php esc_html_e( 'Quick replies', 'winaltchat-for-woocommerce' ); ?></button> 730 <button type="button" class="winalt-sub-tab" role="tab" aria-selected="false" data-atab-target="messages"><?php esc_html_e( 'Messages', 'winaltchat-for-woocommerce' ); ?></button> 731 </div> 732 </div> 733 734 <div data-atab="style"> 735 <?php Winalt_Guided_Setup::render_looks_card(); ?> 736 </div> 737 <div data-atab="language"> 738 <?php Winalt_Guided_Setup::render_language_card(); ?> 739 </div> 723 740 724 741 <!-- Branding card --> 725 <div class="winalt-card" >742 <div class="winalt-card" data-atab="branding"> 726 743 <div class="winalt-card-header"> 727 744 <div class="winalt-card-title"><?php esc_html_e( 'Chat Window Branding', 'winaltchat-for-woocommerce' ); ?></div> … … 801 818 802 819 <!-- Header Trigger card — only shown when Header Right Trigger mode is selected --> 803 <div class="winalt-card winalt-advanced" id="winalt-header-trigger-fields" style="<?php echo get_option( 'winalt_chat_display_mode', 'bubble' ) === 'header_panel' ? '' : 'display:none;'; ?>">820 <div class="winalt-card winalt-advanced" data-atab="branding" id="winalt-header-trigger-fields" style="<?php echo get_option( 'winalt_chat_display_mode', 'bubble' ) === 'header_panel' ? '' : 'display:none;'; ?>"> 804 821 <div class="winalt-card-header"> 805 822 <div class="winalt-card-title"><?php esc_html_e( 'Header Trigger Settings', 'winaltchat-for-woocommerce' ); ?></div> … … 841 858 842 859 <!-- Colors card --> 843 <div class="winalt-card winalt-advanced" >860 <div class="winalt-card winalt-advanced" data-atab="style"> 844 861 <div class="winalt-card-header"> 845 862 <div class="winalt-card-title"><?php esc_html_e( 'Color Customization', 'winaltchat-for-woocommerce' ); ?></div> … … 892 909 893 910 <!-- Typography + Engagement cards (side-by-side) --> 894 <div class="winalt-grid-2 winalt-grid-2--cards" >911 <div class="winalt-grid-2 winalt-grid-2--cards" data-atab="typography engagement"> 895 912 <!-- Typography card --> 896 <div class="winalt-card winalt-advanced" >913 <div class="winalt-card winalt-advanced" data-atab="typography"> 897 914 <div class="winalt-card-header"> 898 915 <div class="winalt-card-title"><?php esc_html_e( 'Typography', 'winaltchat-for-woocommerce' ); ?></div> … … 920 937 </div> 921 938 <!-- Engagement card --> 922 <div class="winalt-card winalt-advanced" >939 <div class="winalt-card winalt-advanced" data-atab="engagement"> 923 940 <div class="winalt-card-header"> 924 941 <div class="winalt-card-title"><?php esc_html_e( 'Engagement', 'winaltchat-for-woocommerce' ); ?></div> … … 953 970 </div><!-- /.winalt-grid-2 typography+engagement --> 954 971 955 <!-- Wording: quick replies, labels and window controls, grouped so Simple view shows none of it and Advanced view keeps it tidy -->956 <details class="winalt-wording winalt-advanced">957 <summary><?php esc_html_e( 'Customize wording (quick replies, labels and messages)', 'winaltchat-for-woocommerce' ); ?></summary>958 959 972 <!-- Quick Reply Buttons card --> 960 <div class="winalt-card ">973 <div class="winalt-card winalt-advanced" data-atab="replies"> 961 974 <div class="winalt-card-header"> 962 975 <div class="winalt-card-title"><?php esc_html_e( 'Quick Reply Buttons', 'winaltchat-for-woocommerce' ); ?></div> … … 1089 1102 1090 1103 <!-- Chat Labels & Messages card --> 1091 <div class="winalt-card ">1104 <div class="winalt-card winalt-advanced" data-atab="messages"> 1092 1105 <div class="winalt-card-header"> 1093 1106 <div class="winalt-card-title"><?php esc_html_e( 'Chat Labels & Messages', 'winaltchat-for-woocommerce' ); ?></div> … … 1204 1217 1205 1218 <!-- Chat Window Controls card --> 1206 <div class="winalt-card ">1219 <div class="winalt-card winalt-advanced" data-atab="messages"> 1207 1220 <div class="winalt-card-header"> 1208 1221 <div class="winalt-card-title"><?php esc_html_e( 'Chat Window Controls', 'winaltchat-for-woocommerce' ); ?></div> … … 1246 1259 </div> 1247 1260 </div><!-- /.winalt-card (Chat Window Controls) --> 1248 1249 </details><!-- /.winalt-wording -->1250 1261 1251 1262 <div class="winalt-form-actions"> -
winaltchat-for-woocommerce/trunk/admin/class-winalt-guided-setup.php
r3788419 r3825228 442 442 <span class="winalt-info" tabindex="0" role="note" aria-label="<?php echo esc_attr( $info ); ?>" data-tip="<?php echo esc_attr( $info ); ?>">i</span> 443 443 </div> 444 <p class="winalt-language-hint"><?php esc_html_e( 'Show the chat in another language. It applies when you save Appearance. Pick English to turn it off.', 'winaltchat-for-woocommerce' ); ?></p>445 444 </div> 446 445 <div class="winalt-language-controls"> … … 454 453 </div> 455 454 <p class="winalt-language-status" id="winalt-translate-status" aria-live="polite"></p> 455 <p class="winalt-language-status" id="winalt-patterns-status" aria-live="polite" hidden> 456 <span id="winalt-patterns-message"></span> 457 <button type="button" class="button button-small" id="winalt-patterns-retry"><?php esc_html_e( 'Retry', 'winaltchat-for-woocommerce' ); ?></button> 458 </p> 456 459 <p class="winalt-language-note"><?php esc_html_e( 'Machine-translated. Ask a native speaker to check it.', 'winaltchat-for-woocommerce' ); ?></p> 457 460 </div> -
winaltchat-for-woocommerce/trunk/admin/class-winalt-support-contact.php
r3788419 r3825228 26 26 * @var string 27 27 */ 28 const SUPPORT_EMAIL = ' support@aisalesmanchatpro.com';28 const SUPPORT_EMAIL = 'info@winalttechnologies.com'; 29 29 30 30 /** -
winaltchat-for-woocommerce/trunk/assets/css/admin-dark.css
r3788419 r3825228 297 297 html[data-winalt-theme="dark"] #winalt-admin-root .winalt-form-actions .winalt-unsaved{color:#a9b1be} 298 298 html[data-winalt-theme="dark"] #winalt-admin-root .winalt-home-number-label{color:#a9b1be} 299 html[data-winalt-theme="dark"] #winalt-admin-root .winalt-language-hint{color:#a9b1be}300 299 html[data-winalt-theme="dark"] #winalt-admin-root .winalt-language-status{color:#d5e0f0} 301 300 html[data-winalt-theme="dark"] #winalt-admin-root .winalt-switch{background:#37404b} -
winaltchat-for-woocommerce/trunk/assets/css/guided-setup.css
r3788419 r3825228 14 14 #winalt-admin-root.winalt-view-simple .winalt-livechat-fields { grid-template-columns: 1fr; } 15 15 #winalt-admin-root.winalt-view-advanced .winalt-simple-hint { display: none; } 16 17 /* Appearance tabs: Advanced view only. Simple view shows every card. */ 18 #winalt-admin-root .winalt-appearance-tabs { display: none; margin: 0 0 16px; } 19 #winalt-admin-root.winalt-view-advanced .winalt-appearance-tabs { display: flex; } 20 #winalt-admin-root .winalt-appearance-tabs .winalt-sub-tabs { flex-wrap: wrap; margin-left: 0; } 21 #winalt-admin-root.winalt-view-advanced .winalt-tab-off { display: none !important; } 22 #winalt-admin-root.winalt-view-advanced .winalt-grid-2--cards { grid-template-columns: 1fr; } 16 23 17 24 .winalt-simple-hint { … … 513 520 514 521 .winalt-language-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; } 515 .winalt-language-hint { margin: 0; font-size: 13px; color: #5b6678; max-width: 60ch; }516 522 .winalt-language-status { margin: 10px 0 0; font-size: 13px; color: #0f1a2b; } 517 523 #winalt-translate-now { margin-top: 10px; } -
winaltchat-for-woocommerce/trunk/assets/js/admin.js
r3788419 r3825228 1805 1805 jQuery(document).ready(function($) { 1806 1806 function switchSubTab(targetId) { 1807 document.querySelectorAll('.winalt-sub-tab ').forEach(function(btn) {1807 document.querySelectorAll('.winalt-sub-tab[data-target]').forEach(function(btn) { 1808 1808 btn.classList.remove('is-active'); 1809 1809 btn.setAttribute('aria-selected', 'false'); -
winaltchat-for-woocommerce/trunk/assets/js/guided-setup.js
r3788419 r3825228 105 105 root.classList.add('winalt-view-' + view); 106 106 107 $all('.winalt-view-btn ').forEach(function (btn) {107 $all('.winalt-view-btn[data-view]').forEach(function (btn) { 108 108 var active = btn.getAttribute('data-view') === view; 109 109 btn.classList.toggle('is-active', active); … … 780 780 /* ---- Chat language (auto-translate) ----------------------------------------- */ 781 781 782 // A failed download of the language's reply patterns: say so, with Retry. 783 function showPatternsStatus(status) { 784 var box = $('#winalt-patterns-status'); 785 if (!box) { 786 return; 787 } 788 var failed = !!(status && status.patterns_error); 789 box.hidden = !failed; 790 var message = $('#winalt-patterns-message'); 791 if (message && failed) { 792 message.textContent = status.patterns_message || ''; 793 } 794 } 795 796 function initPatternsRetry() { 797 var button = $('#winalt-patterns-retry'); 798 showPatternsStatus(cfg.translate); 799 if (!button) { 800 return; 801 } 802 button.addEventListener('click', function () { 803 button.disabled = true; 804 post('winalt_patterns_retry', cfg.translateNonce, {}).then(function (result) { 805 button.disabled = false; 806 var data = result && result.data ? result.data : {}; 807 if (data.status) { 808 cfg.translate = data.status; 809 showPatternsStatus(data.status); 810 } 811 }); 812 }); 813 } 814 782 815 function showTranslateStatus(status) { 783 816 var line = $('#winalt-translate-status'); … … 789 822 cfg.translate = status; 790 823 applyPreview(status.preview); 824 showPatternsStatus(status); 791 825 } 792 826 } … … 891 925 line.textContent = data.message; 892 926 } 927 showPatternsStatus(data.status); 893 928 return !!(result && result.success); 894 929 }); … … 981 1016 } 982 1017 1018 /* ---- Appearance tabs (Advanced view) ------------------------------------------ */ 1019 1020 // Each Appearance card carries data-atab="name [name...]". In the Advanced 1021 // view only the cards of the open tab are shown; the Simple view shows all. 1022 function initAppearanceTabs() { 1023 var bar = $('.winalt-appearance-tabs'); 1024 if (!bar) { 1025 return; 1026 } 1027 var buttons = Array.prototype.slice.call(bar.querySelectorAll('[data-atab-target]')); 1028 var cards = Array.prototype.slice.call(document.querySelectorAll('.winalt-settings-col [data-atab]')); 1029 var stored = ''; 1030 try { 1031 stored = window.sessionStorage.getItem('winaltAppearanceTab') || ''; 1032 } catch (error) { 1033 stored = ''; 1034 } 1035 1036 function show(name) { 1037 buttons.forEach(function (button) { 1038 var on = button.getAttribute('data-atab-target') === name; 1039 button.classList.toggle('is-active', on); 1040 button.setAttribute('aria-selected', on ? 'true' : 'false'); 1041 }); 1042 cards.forEach(function (card) { 1043 var names = (card.getAttribute('data-atab') || '').split(' '); 1044 card.classList.toggle('winalt-tab-off', names.indexOf(name) === -1); 1045 }); 1046 try { 1047 window.sessionStorage.setItem('winaltAppearanceTab', name); 1048 } catch (error) { 1049 // Remembering the tab is optional. 1050 } 1051 } 1052 1053 buttons.forEach(function (button) { 1054 button.addEventListener('click', function () { 1055 show(button.getAttribute('data-atab-target')); 1056 }); 1057 }); 1058 1059 var known = buttons.some(function (button) { 1060 return button.getAttribute('data-atab-target') === stored; 1061 }); 1062 show(known ? stored : 'style'); 1063 } 1064 983 1065 function initTranslate() { 984 1066 initInfoTips(); 985 1067 initTranslatedSave(); 1068 initPatternsRetry(); 986 1069 applyPreview(cfg.translate && cfg.translate.preview); 987 1070 var select = languageSelect(); … … 1529 1612 initSimpleHeader(); 1530 1613 initTranslate(); 1614 initAppearanceTabs(); 1531 1615 initLooks(); 1532 1616 initWizard(); -
winaltchat-for-woocommerce/trunk/changelog.txt
r3788419 r3825228 2 2 3 3 The readme.txt shows only the most recent versions (WordPress.org limits it to 5000 characters). Every version is listed here. 4 5 = 1.67.50 = 6 * Improve: Removed the extra hint text under Chat language on the Appearance screen. 7 8 = 1.67.49 = 9 * Improve: The Appearance tab bar now matches the Live Chats bar and shows in Advanced view only. Typography and Chat language have their own tabs, and the "Customize wording" box is gone: Quick replies and Messages are ordinary tabs. 10 11 = 1.67.48 = 12 * New: In Advanced view the Appearance screen is split into tabs (Style, Branding, Engagement, Quick replies, Messages) so you no longer scroll one long page. Simple view is unchanged. 13 14 = 1.67.47 = 15 * Fix: A store running in English now removes reply patterns that an older version had downloaded, so English always uses the wording built into the plugin. 16 17 = 1.67.46 = 18 * Change: Reply patterns and the ready-made translation for a non-English Chat language are downloaded from Winalt Technologies only when you choose that language and once after a plugin update. English is built in and contacts no server. There is no daily or background sync, and no site address is sent with the patterns. If a download fails the screen offers a Retry button. 19 20 = 1.67.45 = 21 * Internal: interim release, replaced by 1.67.46. 22 23 = 1.67.44 = 24 * Improve: Basic AI Pattern Sync now sends your site's home address, plugin edition and version with each request, so Winalt Technologies can see which sites sync. The readme's external services section describes exactly what is sent. No customer or visitor data is sent. 25 26 = 1.67.43 = 27 * Fix: Chinese is now synced in both Simplified and Traditional characters together, so Traditional Chinese questions are understood on stores set to Simplified Chinese, and the other way round. 28 29 = 1.67.42 = 30 * Fix: Product searches written in a non-English language ended in an error message instead of showing products. 31 32 = 1.67.41 = 33 * Improve: The non-English phrases and replies Basic AI uses are no longer stored in the plugin. They are managed on the plugin website and synced for your site language, English and the Chat language you choose, so wording can be improved without a plugin update. Nothing changes for English. 34 35 = 1.67.40 = 36 * New: Basic AI now understands 28 languages besides English: Spanish, French, German, Italian, Portuguese, Dutch, Russian, Ukrainian, Turkish, Polish, Arabic, Persian, Hebrew, Greek, Hindi, Thai, Japanese, Korean, Chinese (Simplified and Traditional), Indonesian, Vietnamese, Swedish, Danish, Norwegian, Finnish, Czech, Romanian and Hungarian. Shoppers can ask about orders, returns, shipping, opening hours, contact details, payment methods, discounts, the cart and talking to a person, and are answered in their own language using your store's own pages. Products are found by the names used in your catalogue. English is unchanged. 37 38 = 1.67.39 = 39 * New: Basic AI now understands Chinese. It answers questions about orders, returns, shipping, opening hours, contact details, payment methods, discounts, the cart and talking to a person, in Chinese, using your store's own pages. It also finds products by their Chinese names and handles greetings, thanks and goodbyes without needing a sync. English is unchanged. 40 * Fix: the free plugin reported itself as Pro when asking for chat translations; it now reports Free. 41 42 = 1.67.38 = 43 * Fix: The "copy our support email" button in the admin now copies info@winalttechnologies.com. 44 45 = 1.67.37 = 46 * Fix: The support email on the plugin page is now info@winalttechnologies.com, and the Support Forum line is gone. 47 * Improve: Rewrote the plugin page text without long dashes so it reads more naturally. 48 49 = 1.67.36 = 50 * Fix: The readme no longer says nothing is ever sent to an outside service. It now points to the External Services list (AI providers, translations, pattern sync, mobile push). 51 52 = 1.67.35 = 53 * Improve: The mobile app is limited to 3 phones per site on the free plan. A 4th phone gets a clear "limit reached" message; signing out on one phone frees its slot. The same account can still sign in on several phones, and a phone whose notification token refreshes keeps its place. 54 55 = 1.67.34 = 56 * Fix: The chat no longer gives customers an email address taken from the WooCommerce or WordPress settings. It only uses the address published on your Contact page, in its own replies and in the AI model's instructions. With no email on the Contact page, no address is given. 57 * Fix: An address you put on the Contact page is always used as written, even if it looks like an example. This undoes the 1.67.33 rule that skipped such addresses. 58 59 = 1.67.33 = 60 * Fix: "Most expensive" now lists the priciest products first, and "cheap gifts under $15" applies the $15 limit. 61 * Fix: A single result reads "Here is 1 product", and the sale list is topped up with other sale items instead of showing one. 62 * Fix: A placeholder contact address (example.com, .test) is no longer shown to customers as the store's email. 63 * Fix: The offline form rejects a mistyped email instead of saving a rewritten one. 64 * Improve: Accessibility. The chat is a labelled dialog, new replies are read out to screen readers, the message box and send button have labels, Esc closes the chat, buttons are at least 44px on touch screens, and View Product and the send arrow follow Text on Primary so light brand colours stay readable. 65 66 = 1.67.32 = 67 * Fix: After a page reload during a live chat, the visitor's own messages showed raw text such as & and ". They now read normally, and delivery ticks match again. 68 * Fix: When the chat limit is reached, the shopper now sees "Too many requests. Please wait a moment before trying again." instead of a generic error. 69 70 = 1.67.31 = 71 * Fix: Chats this week on the Home screen never counted real conversations, because the chat always sends the visitor's first message along with the request. Each new conversation is now counted once. 72 73 = 1.67.30 = 74 * Fix: Basic AI no longer adds made-up taglines before a single product ("Premium Quality", "Eco-Friendly", "Trusted by thousands", "Fast Delivery Available"). It now only mentions the shopper rating when the product has a good one with reviews. 4 75 5 76 = 1.67.29 = … … 7 78 8 79 = 1.67.28 = 9 * Fix: Live chat —the availability switch no longer moves when its label changes, the tabs (Live Conversations, Team Access, Settings) use the same soft highlight as the main menu, and the screen has a little scroll room underneath.80 * Fix: Live chat, the availability switch no longer moves when its label changes, the tabs (Live Conversations, Team Access, Settings) use the same soft highlight as the main menu, and the screen has a little scroll room underneath. 10 81 11 82 = 1.67.27 = … … 13 84 14 85 = 1.67.26 = 15 * Fix: Appearance —the Style you picked is remembered when you save, so it is still highlighted after reloading the screen.86 * Fix: Appearance, the Style you picked is remembered when you save, so it is still highlighted after reloading the screen. 16 87 17 88 = 1.67.25 = 18 * Fix: Appearance —the chosen Style stays highlighted after a reload, and the Style / Light or dark buttons and colour swatches have a visible hover in dark mode.89 * Fix: Appearance, the chosen Style stays highlighted after a reload, and the Style / Light or dark buttons and colour swatches have a visible hover in dark mode. 19 90 20 91 = 1.67.24 = 21 * Fix: Dark mode —the machine-translation note under Chat language is readable. The info tip says "our server" instead of the domain name.92 * Fix: Dark mode, the machine-translation note under Chat language is readable. The info tip says "our server" instead of the domain name. 22 93 23 94 = 1.67.23 = 24 * Improve: Appearance —the Style buttons now look like the Light or dark options, the live preview starts level with the first card, and the Chat language info tip is shorter and aligned.95 * Improve: Appearance, the Style buttons now look like the Light or dark options, the live preview starts level with the first card, and the Chat language info tip is shorter and aligned. 25 96 26 97 = 1.67.22 = -
winaltchat-for-woocommerce/trunk/includes/basic-ai/class-winalt-basic-ai-core.php
r3788419 r3825228 71 71 require_once WINALT_PATH . 'includes/basic-ai/helpers/class-winalt-intent-detector.php'; 72 72 require_once WINALT_PATH . 'includes/basic-ai/helpers/class-winalt-response-formatter.php'; 73 require_once WINALT_PATH . 'includes/basic-ai/helpers/class-winalt-language-lexicon.php'; 73 74 74 75 // Load core modules. … … 136 137 'context_used' => false, 137 138 ); 139 } 140 141 // Questions in a language with its own phrase lists (see 142 // Winalt_Language_Lexicon, synced from the plugin website). English messages never 143 // match here, so English behaviour is unchanged. 144 $lexicon_match = Winalt_Language_Lexicon::match( $user_message ); 145 if ( null !== $lexicon_match ) { 146 $lexicon_result = $this->handle_lexicon_query( $lexicon_match, $user_message, $context ); 147 if ( null !== $lexicon_result ) { 148 return $lexicon_result; 149 } 150 } elseif ( null !== Winalt_Language_Lexicon::detect_language( $user_message ) && null === Winalt_Pattern_Sync::find_response( $user_message ) && ! $this->modules['intent']->has_product_request_signal( $user_message ) ) { 151 $lexicon_product = $this->handle_lexicon_product_search( $user_message, $context ); 152 if ( null !== $lexicon_product ) { 153 return $lexicon_product; 154 } 138 155 } 139 156 … … 2969 2986 2970 2987 /** 2988 * Answer a question matched by the language lexicon (see 2989 * Winalt_Language_Lexicon), in the shopper's language, from the store's 2990 * own pages and settings. 2991 * 2992 * @since 1.69.45 2993 * @param array{lang:string,intent:string} $match Lexicon match. 2994 * @param string $message Visitor message. 2995 * @param array $context Conversation history. 2996 * @return array|null Response payload, or null to continue with normal routing. 2997 */ 2998 private function handle_lexicon_query( $match, $message, $context ) { 2999 $lang = $match['lang']; 3000 $intent = $match['intent']; 3001 3002 $page_url = static function ( $option ) { 3003 $page_id = absint( get_option( $option, 0 ) ); 3004 if ( $page_id < 1 || 'publish' !== get_post_status( $page_id ) ) { 3005 return ''; 3006 } 3007 return (string) get_permalink( $page_id ); 3008 }; 3009 $contact_url = $page_url( 'winalt_contact_page' ); 3010 3011 $answer = static function ( $text, $category, $has_page ) use ( $lang, $intent ) { 3012 return array( 3013 'response' => $text, 3014 'type' => 'information', 3015 'data' => array( 3016 'category' => $category, 3017 'has_page' => $has_page, 3018 'source' => 'language_lexicon', 3019 'language' => $lang, 3020 ), 3021 'intent' => array( 3022 'type' => 'information', 3023 'category' => $category, 3024 'lexicon' => $intent, 3025 ), 3026 'context_used' => false, 3027 ); 3028 }; 3029 3030 // A topic answer: the link to the store's own page when it has one, 3031 // otherwise a short "please contact us". Both versions are synced 3032 // replies; the one with {page_link} is used only when there is a link. 3033 $topic_answer = static function ( $topic, $intent_name, $link_var, $url ) use ( $lang, $answer ) { 3034 $text = Winalt_Language_Lexicon::response( $lang, $intent_name, array( $link_var => $url ) ); 3035 return '' === $text ? null : $answer( $text, $topic, '' !== $url ); 3036 }; 3037 3038 switch ( $intent ) { 3039 case 'human_handoff': 3040 if ( get_option( 'winalt_live_chat_enabled' ) ) { 3041 return $this->build_live_chat_handoff_response(); 3042 } 3043 $text = Winalt_Language_Lexicon::response( $lang, 'handoff_unavailable', array( 'contact_link' => $contact_url ) ); 3044 return '' === $text ? null : $answer( $text, 'contact', '' !== $contact_url ); 3045 3046 case 'shipping': 3047 return $topic_answer( 'shipping', 'shipping_info', 'page_link', $page_url( 'winalt_shipping_page' ) ); 3048 3049 case 'returns': 3050 return $topic_answer( 'returns', 'returns_info', 'page_link', $page_url( 'winalt_return_page' ) ); 3051 3052 case 'hours': 3053 return $topic_answer( 'hours', 'hours_info', 'page_link', $page_url( 'winalt_hours_page' ) ); 3054 3055 case 'contact': 3056 return $topic_answer( 'contact', 'contact_info', 'page_link', $contact_url ); 3057 3058 case 'order_status': 3059 return $topic_answer( 'order', 'order_status', 'contact_link', $contact_url ); 3060 3061 case 'payment': 3062 $titles = array(); 3063 if ( function_exists( 'WC' ) && WC() && WC()->payment_gateways() ) { 3064 foreach ( WC()->payment_gateways()->get_available_payment_gateways() as $gateway ) { 3065 $title = trim( wp_strip_all_tags( (string) $gateway->get_title() ) ); 3066 if ( '' !== $title ) { 3067 $titles[] = $title; 3068 } 3069 } 3070 } 3071 $text = Winalt_Language_Lexicon::response( $lang, 'payment_info', array( 'payment_methods' => implode( Winalt_Language_Lexicon::list_separator( $lang ), $titles ) ) ); 3072 return '' === $text ? null : $answer( $text, 'payment', false ); 3073 3074 case 'discount': 3075 $text = Winalt_Language_Lexicon::response( $lang, 'discount_info' ); 3076 return '' === $text ? null : $answer( $text, 'discount', false ); 3077 3078 case 'cart': 3079 return $this->handle_cart_query( $message ); 3080 3081 case 'greeting': 3082 case 'how_are_you': 3083 case 'thanks': 3084 case 'farewell': 3085 case 'capabilities': 3086 $text = Winalt_Language_Lexicon::response( $lang, Winalt_Language_Lexicon::INTENT_NAMES[ $intent ], array( 'store_name' => sanitize_text_field( get_bloginfo( 'name' ) ) ) ); 3087 if ( '' === $text ) { 3088 return null; 3089 } 3090 $data = array( 3091 'subtype' => $intent, 3092 'source' => 'language_lexicon', 3093 ); 3094 if ( in_array( $intent, array( 'greeting', 'capabilities' ), true ) && isset( $this->modules['conversation'] ) ) { 3095 $data['suggestions'] = $this->modules['conversation']->get_suggestions( $context ); 3096 } 3097 return array( 3098 'response' => $text, 3099 'type' => 'conversation', 3100 'data' => $data, 3101 'intent' => array( 3102 'type' => 'conversation', 3103 'subtype' => $intent, 3104 ), 3105 'context_used' => false, 3106 ); 3107 } 3108 3109 return null; 3110 } 3111 3112 /** 3113 * Search the catalogue for a product named in a non-English message and 3114 * answer in the shopper's language. Words are matched as written (the 3115 * store's own product names), so this works for stores whose catalogue is 3116 * in the shopper's language. 3117 * 3118 * @since 1.69.45 3119 * @param string $message Visitor message. 3120 * @param array $context Conversation history. 3121 * @return array|null Response payload, or null to continue with normal routing. 3122 */ 3123 private function handle_lexicon_product_search( $message, $context ) { 3124 $lang = Winalt_Language_Lexicon::detect_language( $message ); 3125 if ( null === $lang ) { 3126 return null; 3127 } 3128 3129 $term = Winalt_Language_Lexicon::product_term( $message, $lang ); 3130 if ( '' === $term ) { 3131 return array( 3132 'response' => Winalt_Language_Lexicon::response( $lang, 'product_not_sure' ), 3133 'type' => 'clarification_needed', 3134 'data' => array(), 3135 'intent' => array( 'type' => 'clarification' ), 3136 'context_used' => false, 3137 ); 3138 } 3139 3140 // A bare phrase of several words with no request wording ("do you 3141 // have ...", "I want ...") is probably not a product search. 3142 if ( ! Winalt_Language_Lexicon::has_request_words( $message, $lang ) && count( preg_split( '/\s+/u', $term, -1, PREG_SPLIT_NO_EMPTY ) ) > 2 ) { 3143 return array( 3144 'response' => Winalt_Language_Lexicon::response( $lang, 'product_not_sure' ), 3145 'type' => 'clarification_needed', 3146 'data' => array(), 3147 'intent' => array( 'type' => 'clarification' ), 3148 'context_used' => false, 3149 ); 3150 } 3151 3152 $result = $this->modules['product']->process( 3153 $term, 3154 array( 3155 'type' => 'product_search', 3156 'keywords' => array( $term ), 3157 ), 3158 $context 3159 ); 3160 $products = isset( $result['data']['products'] ) && is_array( $result['data']['products'] ) ? $result['data']['products'] : array(); 3161 3162 if ( 'product_results' === ( $result['type'] ?? '' ) && ! empty( $products ) ) { 3163 $lead = Winalt_Language_Lexicon::response( $lang, 'product_found', array( 'count' => count( $products ), 'term' => $term ) ); 3164 return array( 3165 'response' => $this->modules['formatter']->format( $lead, 'product_results', $result['data'] ), 3166 'type' => 'product_results', 3167 'data' => $result['data'], 3168 'intent' => array( 'type' => 'product_search' ), 3169 'context_used' => false, 3170 ); 3171 } 3172 3173 return array( 3174 'response' => Winalt_Language_Lexicon::response( $lang, 'product_not_found', array( 'term' => $term ) ), 3175 'type' => 'help', 3176 'data' => array( 3177 'category' => 'no_results', 3178 'language' => $lang, 3179 'search_term' => $term, 3180 'language_lexicon' => true, 3181 ), 3182 'intent' => array( 'type' => 'product_search' ), 3183 'context_used' => false, 3184 ); 3185 } 3186 3187 /** 2971 3188 * Detect order status queries ("where is my order", "track my order", etc.). 2972 3189 * -
winaltchat-for-woocommerce/trunk/includes/class-winalt-order-lookup.php
r3788419 r3825228 246 246 if ( '' === trim( $message ) || strlen( $message ) > 500 ) { 247 247 return false; 248 } 249 250 // Other languages: the phrase lists in Winalt_Language_Lexicon. 251 if ( ! class_exists( 'Winalt_Language_Lexicon' ) && defined( 'WINALT_PATH' ) ) { 252 require_once WINALT_PATH . 'includes/basic-ai/helpers/class-winalt-language-lexicon.php'; 253 } 254 if ( class_exists( 'Winalt_Language_Lexicon' ) ) { 255 $lexicon_match = Winalt_Language_Lexicon::match( $message ); 256 if ( null !== $lexicon_match && 'order_status' === $lexicon_match['intent'] ) { 257 return true; 258 } 248 259 } 249 260 -
winaltchat-for-woocommerce/trunk/includes/class-winalt-pattern-sync.php
r3788419 r3825228 1 1 <?php 2 2 /** 3 * Admin-managed pattern/response sync for Basic AI Mode.3 * Pattern/response data for Basic AI Mode in a non-English chat language. 4 4 * 5 * Purpose: pull the intent/pattern/response dataset curated on 6 * aisalesmanchatpro.com (api/get-chat-patterns.php) into local cache 7 * tables, so support staff can add/tune patterns from a web admin panel 8 * without a plugin code change or release. STRICTLY ADDITIVE: every 5 * The dataset is curated on aisalesmanchatpro.com (Chat Patterns). English 6 * lives in this plugin's own code, so a store running in English never 7 * contacts the website. When the owner chooses another Chat language (and 8 * after a plugin update), the plugin downloads the patterns for that one 9 * language into local cache tables. There is no daily or background sync. 10 * STRICTLY ADDITIVE: every 9 11 * hardcoded pattern already in class-winalt-conversation-flow.php and 10 12 * class-winalt-basic-ai-core.php stays exactly as it is and remains the … … 58 60 59 61 /** 62 * One-time event scheduled after a plugin update to refresh the chosen 63 * language's data. 64 * 65 * @since 1.69.52 66 * @var string 67 */ 68 const UPDATE_CRON_HOOK = 'winalt_pattern_sync_update_run'; 69 70 /** 71 * Option set to '1' when the last download failed, so the screen can offer 72 * a Retry button. 73 * 74 * @since 1.69.52 75 * @var string 76 */ 77 const OPTION_ERROR = 'winalt_pattern_sync_error'; 78 79 /** 60 80 * Option storing the last successfully synced dataset_version. 61 81 * … … 78 98 /** 79 99 * Option storing the plugin version that last triggered an 80 * upgrade-time sync — see maybe_schedule_upgrade_sync(). Distinct100 * post-update refresh — see maybe_schedule_update_refresh(). Distinct 81 101 * from OPTION_VERSION, which tracks the remote DATASET version, not 82 102 * the plugin's own version. 83 103 * 84 * @since 1.2 6.0104 * @since 1.28.0 85 105 * @var string 86 106 */ … … 100 120 * self-heals a plugin version upgrade. 101 121 * 102 * @since 1.4 2.1122 * @since 1.44.1 103 123 * @var string 104 124 */ 105 125 const OPTION_LANGUAGE_SCOPE = 'winalt_pattern_sync_language_scope'; 106 107 /**108 * Option storing the site owner's opt-in list of EXTRA languages to109 * sync beyond the site's own WP locale (and "en", always included as110 * the fallback set) — comma-separated codes, e.g. "zh,ar,ru", set from111 * the Pattern Sync admin card. Empty/absent means "just this site's112 * own locale," the original, narrowest behavior. Deliberately NOT113 * `language=all`: as the central dataset grows to cover more114 * languages, defaulting every install to downloading all of them115 * would make sync payload size and local cache-rebuild cost scale116 * with the TOTAL dataset regardless of whether a given site has any117 * visitors in most of those languages.118 *119 * @since 1.43.0120 * @var string121 */122 const OPTION_EXTRA_LANGUAGES = 'winalt_pattern_sync_extra_languages';123 126 124 127 /** … … 144 147 * which is which before opting in. 145 148 * 146 * @since 1.4 5.0149 * @since 1.47.0 147 150 * @var array<string,array{label:string,matchable:bool}> 148 151 */ … … 202 205 * Register WordPress hooks. Call once during plugin bootstrap. 203 206 * 204 * Deliberately NOT gated behind an opt-in option (unlike 205 * Winalt_Usage_Tracking) — this sync sends no site-identifying or 206 * customer data (see build_request_args()'s docblock), only pulls 207 * admin-authored content, so there is nothing here that needs a 208 * consent gate the way the usage-ping does. 207 * There is no recurring sync. Older versions scheduled one: it is removed. 208 * The only automatic request is a single one after a plugin update, and 209 * only for a store whose Chat language is not English. 209 210 * 210 211 * @since 1.25.0 … … 212 213 */ 213 214 public function init() { 214 add_action( self::CRON_HOOK, array( $this, 'sync' ) ); 215 add_action( self::ACTIVATION_CRON_HOOK, array( $this, 'sync' ) ); 216 217 // Self-heal on every load, same reasoning as Winalt_Usage_Tracking's 218 // sync_cron_from_option(): deactivate/reactivate clears scheduled 219 // events without any option changing, so nothing else would 220 // otherwise reschedule this. 221 if ( ! wp_next_scheduled( self::CRON_HOOK ) ) { 222 wp_schedule_event( time() + DAY_IN_SECONDS, 'daily', self::CRON_HOOK ); 223 } 224 225 self::maybe_schedule_upgrade_sync(); 226 } 227 228 /** 229 * Schedule an immediate background sync the first time this runs 230 * under a new plugin version. 231 * 232 * WordPress only fires register_activation_hook() — and therefore 233 * schedule_activation_sync() — on a fresh activate/reactivate, NOT 234 * when an already-active plugin is upgraded to a new version via the 235 * normal "Update" flow. Without this, an existing site upgrading to a 236 * release that changed the synced dataset would only pick it up via 237 * the next daily cron tick (self-healed above) — up to ~24h away, 238 * and only if WP-Cron actually fires (it's request-driven, not a 239 * real system cron). This closes that gap the same way 240 * winalt_live_chat_maybe_upgrade() self-heals the Live Chat schema 241 * on version mismatch. 242 * 243 * Runs at most once per plugin version: the stored option is updated 244 * immediately after scheduling, so every other request just pays for 245 * one get_option() comparison. 246 * 247 * @since 1.26.0 215 foreach ( array( self::CRON_HOOK, self::ACTIVATION_CRON_HOOK ) as $hook ) { 216 if ( wp_next_scheduled( $hook ) ) { 217 wp_clear_scheduled_hook( $hook ); 218 } 219 } 220 221 add_action( self::UPDATE_CRON_HOOK, array( __CLASS__, 'run_update_refresh' ) ); 222 add_action( 'init', array( __CLASS__, 'maybe_schedule_update_refresh' ), 20 ); 223 } 224 225 /** 226 * After a plugin update, schedule one refresh of the chosen language's 227 * translation and patterns. Nothing is scheduled for an English store. 228 * 229 * @since 1.69.52 248 230 * @return void 249 231 */ 250 public static function maybe_schedule_up grade_sync() {251 $ synced_version = get_option( self::OPTION_SYNCED_PLUGIN_VERSION, '' );252 if ( defined( 'WINALT_VERSION' ) && WINALT_VERSION === $synced_version ) {232 public static function maybe_schedule_update_refresh() { 233 $version = defined( 'WINALT_VERSION' ) ? WINALT_VERSION : ''; 234 if ( get_option( self::OPTION_SYNCED_PLUGIN_VERSION, '' ) === $version ) { 253 235 return; 254 236 } 255 256 self::schedule_activation_sync(); 257 update_option( self::OPTION_SYNCED_PLUGIN_VERSION, defined( 'WINALT_VERSION' ) ? WINALT_VERSION : '' ); 237 update_option( self::OPTION_SYNCED_PLUGIN_VERSION, $version ); 238 239 if ( '' === self::target_language() ) { 240 // English is built in: drop anything an older version downloaded. 241 self::clear_cache(); 242 return; 243 } 244 if ( ! wp_next_scheduled( self::UPDATE_CRON_HOOK ) ) { 245 wp_schedule_single_event( time(), self::UPDATE_CRON_HOOK ); 246 } 247 } 248 249 /** 250 * The one-time refresh that follows a plugin update. 251 * 252 * @since 1.69.52 253 * @return void 254 */ 255 public static function run_update_refresh() { 256 if ( class_exists( 'Winalt_Translate' ) ) { 257 Winalt_Translate::refresh_ready_made(); 258 } 259 self::refresh(); 260 } 261 262 /** 263 * The dataset language the store needs: the Chat language the owner 264 * chose, or '' for English / not set (English is built into the plugin). 265 * 266 * @since 1.69.52 267 * @return string Dataset language code, for example "es" or "zh-tw". 268 */ 269 public static function target_language() { 270 if ( ! class_exists( 'Winalt_Translate' ) || ! Winalt_Translate::enabled() ) { 271 return ''; 272 } 273 $chosen = Winalt_Translate::chosen_language(); 274 if ( '' === $chosen || Winalt_Translate::is_english( $chosen ) ) { 275 return ''; 276 } 277 278 return self::dataset_language( $chosen ); 258 279 } 259 280 … … 265 286 * so it's fine for it to cost a few small COUNT queries. 266 287 * 267 * @since 1.2 6.0288 * @since 1.28.0 268 289 * @return array{version:string,last_synced_at:string,intents:int,patterns:int,responses:int} 269 290 */ … … 316 337 name VARCHAR(100) NOT NULL, 317 338 description TEXT NULL, 339 action VARCHAR(40) NULL, 318 340 PRIMARY KEY (id) 319 341 ) {$charset};"; … … 347 369 348 370 /** 349 * Schedule a one-time sync attempt shortly after activation, as a350 * background WP-Cron event rather than an inline HTTP call — so351 * activation itself never blocks on network I/O, and a slow/352 * unreachable endpoint can never make activation appear to hang or353 * fail. wp_schedule_single_event() with $time = now fires on the354 * very next WP-Cron run (typically the next page load), same355 * "practically immediate, never blocking" pattern used elsewhere in356 * this codebase for post-action background work.357 *358 * @since 1.25.0359 * @return void360 */361 public static function schedule_activation_sync() {362 if ( ! wp_next_scheduled( self::ACTIVATION_CRON_HOOK ) ) {363 wp_schedule_single_event( time(), self::ACTIVATION_CRON_HOOK );364 }365 }366 367 /**368 371 * Detect the site's language as a short code matching the dataset's 369 372 * "en" / "fa" style (get_locale() returns "en_US" / "fa_IR" style). … … 395 398 * Chinese. 396 399 * 397 * @since 1.4 2.0400 * @since 1.44.0 398 401 * @param string $message Raw user message. 399 402 * @return string Language code to match/query against. … … 424 427 425 428 /** 426 * The language codes to actually request from aisalesmanchatpro.com: 427 * the site's own locale, "en" (always the API's fallback set anyway), 428 * plus whatever the site owner opted into via OPTION_EXTRA_LANGUAGES. 429 * Returns a sorted, deduped, comma-joined string — sorted so the 430 * scope string is stable regardless of the order an admin typed 431 * languages in, which matters for the OPTION_LANGUAGE_SCOPE 432 * comparison in sync() not force-refetching on every single sync 433 * just because "zh,ar" and "ar,zh" look different as strings. 434 * 435 * @since 1.43.0 436 * @return string Comma-separated language codes, e.g. "ar,en,zh". 437 */ 438 private static function resolve_language_scope() { 439 $languages = array( self::get_site_language(), 'en' ); 440 441 // The language the owner chose for the chat box: its patterns are 442 // synced automatically, no separate setting needed. 443 if ( class_exists( 'Winalt_Translate' ) ) { 444 $chat_language = strtolower( substr( Winalt_Translate::chosen_language(), 0, 2 ) ); 445 if ( preg_match( '/^[a-z]{2,3}$/', $chat_language ) ) { 446 $languages[] = $chat_language; 447 } 448 } 449 450 $extra = (string) get_option( self::OPTION_EXTRA_LANGUAGES, '' ); 451 if ( '' !== $extra ) { 452 foreach ( explode( ',', $extra ) as $lang ) { 453 $lang = strtolower( trim( $lang ) ); 454 $lang = preg_replace( '/[^a-z\-]/', '', $lang ); 455 if ( '' !== $lang ) { 456 $languages[] = $lang; 457 } 458 } 459 } 460 461 $languages = array_values( array_unique( $languages ) ); 462 sort( $languages ); 463 464 return implode( ',', $languages ); 465 } 466 467 /** 468 * Run one sync attempt: fetch, and only replace the local cache when 469 * the remote dataset_version has actually moved on. 470 * 471 * Fire-and-forget in spirit: ANY failure (network error, timeout, 472 * non-200, unparseable JSON, missing expected fields) is caught and 473 * silently ignored — this method never throws, never surfaces 474 * anything to the site owner, and always leaves whatever is already 475 * cached locally untouched on failure. That's the whole point: a 476 * site that has never synced, or whose every sync attempt has 477 * failed, must behave identically to the plugin's pre-sync behavior. 478 * 479 * @since 1.25.0 480 * @return void 481 */ 482 public function sync() { 483 $desired_scope = self::resolve_language_scope(); 484 485 // A site whose desired scope has changed since its last successful 486 // sync — a fresh install, an admin adding/removing an extra 487 // language, or an upgrade from an older per-locale-only request — 488 // must not send `since`: the dataset_version cheap-check has no 489 // memory of what language SCOPE a cached snapshot was built from, 490 // only whether the content has changed since, so it would 491 // otherwise report "unchanged" forever and this site would stay 492 // stuck on a stale-scope cache even though what it wants has 493 // changed. 494 $force_full_refetch = ( get_option( self::OPTION_LANGUAGE_SCOPE, '' ) !== $desired_scope ); 429 * The dataset's language code for a WordPress locale ("zh_TW" is 430 * "zh-tw", "nb_NO" and "no" are "nb"; otherwise the two-letter code). 431 * 432 * @since 1.69.47 433 * @param string $locale Locale such as "es_ES". 434 * @return string Dataset language code. 435 */ 436 public static function dataset_language( $locale ) { 437 $locale = strtolower( str_replace( '-', '_', (string) $locale ) ); 438 if ( 'zh_tw' === $locale || 'zh_hk' === $locale ) { 439 return 'zh-tw'; 440 } 441 $code = substr( $locale, 0, 2 ); 442 if ( 'no' === $code || 'nn' === $code ) { 443 return 'nb'; 444 } 445 446 return '' === $code ? 'en' : $code; 447 } 448 449 /** 450 * Download the patterns for the chosen Chat language and replace the local 451 * cache with them. For an English store this clears the cache and makes no 452 * request. On any failure the existing cache is kept and the error flag is 453 * set, so the screen can offer a Retry button. 454 * 455 * @since 1.69.52 456 * @return array{ok:bool,message:string} 457 */ 458 public static function refresh() { 459 $language = self::target_language(); 460 if ( '' === $language ) { 461 self::clear_cache(); 462 delete_option( self::OPTION_ERROR ); 463 464 return array( 465 'ok' => true, 466 'message' => '', 467 ); 468 } 469 470 $failed = array( 471 'ok' => false, 472 'message' => __( 'The reply patterns for this language could not be loaded. Check your connection and try again.', 'winaltchat-for-woocommerce' ), 473 ); 495 474 496 475 $response = wp_safe_remote_get( 497 $this->build_request_url( $desired_scope, $force_full_refetch),476 self::build_request_url( $language ), 498 477 array( 499 'timeout' => 8,478 'timeout' => 10, 500 479 'sslverify' => true, 501 480 ) 502 481 ); 503 482 504 if ( is_wp_error( $response ) ) { 505 return; 506 } 507 508 if ( 200 !== (int) wp_remote_retrieve_response_code( $response ) ) { 509 return; 510 } 511 512 $body = json_decode( wp_remote_retrieve_body( $response ), true ); 513 if ( ! is_array( $body ) || empty( $body['dataset_version'] ) ) { 514 return; 515 } 516 517 $remote_version = sanitize_text_field( (string) $body['dataset_version'] ); 518 $local_version = get_option( self::OPTION_VERSION, '' ); 519 520 // Cheap-check hit ("unchanged") or the version is otherwise 521 // unchanged — nothing to do. Skipped when this was a forced full 522 // refetch: the version can be identical to what's already cached 523 // while the PAYLOAD still isn't (a wider language scope than 524 // last time), so it must still be written even though the 525 // version itself didn't move. 526 if ( ! $force_full_refetch && $remote_version === $local_version ) { 527 return; 528 } 529 530 // A version bump with no payload (shouldn't happen per the API's 531 // own contract, but never trust a remote response blindly) — skip 532 // rather than wipe local data based on an incomplete response. 533 if ( ! isset( $body['intents'], $body['patterns'], $body['responses'] ) 483 $body = null; 484 if ( ! is_wp_error( $response ) && 200 === (int) wp_remote_retrieve_response_code( $response ) ) { 485 $body = json_decode( wp_remote_retrieve_body( $response ), true ); 486 } 487 if ( ! is_array( $body ) || empty( $body['dataset_version'] ) 488 || ! isset( $body['intents'], $body['patterns'], $body['responses'] ) 534 489 || ! is_array( $body['intents'] ) || ! is_array( $body['patterns'] ) || ! is_array( $body['responses'] ) 535 490 ) { 491 update_option( self::OPTION_ERROR, '1', false ); 492 493 return $failed; 494 } 495 496 // Only the chosen language is kept, whatever the server sent. 497 $patterns = array_values( array_filter( $body['patterns'], static function ( $row ) use ( $language ) { 498 return isset( $row['language'] ) && $language === $row['language']; 499 } ) ); 500 $responses = array_values( array_filter( $body['responses'], static function ( $row ) use ( $language ) { 501 return isset( $row['language'] ) && $language === $row['language']; 502 } ) ); 503 504 if ( file_exists( ABSPATH . 'wp-admin/includes/upgrade.php' ) ) { 505 // Make sure the cache tables have the newest columns (dbDelta is a no-op when they do). 506 self::install(); 507 } 508 509 if ( ! self::replace_local_cache( $body['intents'], $patterns, $responses ) ) { 510 update_option( self::OPTION_ERROR, '1', false ); 511 512 return $failed; 513 } 514 515 update_option( self::OPTION_VERSION, sanitize_text_field( (string) $body['dataset_version'] ) ); 516 update_option( self::OPTION_LAST_SYNCED_AT, current_time( 'mysql', true ) ); 517 update_option( self::OPTION_LANGUAGE_SCOPE, $language ); 518 delete_option( self::OPTION_ERROR ); 519 520 return array( 521 'ok' => true, 522 'message' => '', 523 ); 524 } 525 526 /** 527 * Remove everything downloaded (used when the chat goes back to English). 528 * 529 * @since 1.69.52 530 * @return void 531 */ 532 public static function clear_cache() { 533 global $wpdb; 534 535 if ( '' === get_option( self::OPTION_VERSION, '' ) ) { 536 536 return; 537 537 } 538 538 539 $this->replace_local_cache( $body['intents'], $body['patterns'], $body['responses'] ); 540 541 update_option( self::OPTION_VERSION, $remote_version ); 542 update_option( self::OPTION_LAST_SYNCED_AT, current_time( 'mysql', true ) ); 543 update_option( self::OPTION_LANGUAGE_SCOPE, $desired_scope ); 544 } 545 546 /** 547 * Build the outbound request URL. 548 * 549 * `language` is this site's own locale + "en" + whatever the site 550 * owner opted into via OPTION_EXTRA_LANGUAGES (see 551 * resolve_language_scope()), NOT just the site's own locale: a 552 * visitor's message language and the site owner's WP locale are two 553 * different things — most stores serving occasional non-English- 554 * speaking visitors still run their own WP install in English, so 555 * syncing only the site's own locale would mean any OTHER language's 556 * dataset (Chinese patterns added on the admin panel, say) never 557 * reaches this cache at all, no matter how many times "Sync Now" 558 * runs. Deliberately NOT `language=all`: as the central dataset grows 559 * to cover more languages, every install downloading the full thing 560 * regardless of relevance would make sync payload size and local 561 * cache-rebuild cost scale with the total dataset, not what this 562 * particular site's visitors actually use. find_response() below 563 * still only ever MATCHES against one language per message (detected 564 * from the message itself, not the whole requested scope). 565 * 566 * CRITICAL PRIVACY CONSTRAINT: only `language` and `since` (the 567 * locally cached dataset_version string — an opaque version marker, 568 * not a real timestamp of any activity) are ever sent. No site_url, 569 * no customer message content, no conversation data, no product data, 570 * no IP-identifying parameter of any kind is included — 571 * wp_safe_remote_get() itself necessarily reveals the requesting IP 572 * at the TCP/HTTP level (true of any HTTP request to anywhere), but 573 * nothing beyond that transport-level minimum is added here. 574 * 575 * @since 1.25.0 576 * @param string $language_scope Comma-separated language codes to 577 * request — see resolve_language_scope(). 578 * @param bool $force_full_refetch When true, omit `since` even if a 579 * cached version exists — see sync()'s 580 * use of this for the language-scope 581 * self-heal. 582 * @return string Full request URL with query args. 583 */ 584 private function build_request_url( $language_scope, $force_full_refetch = false ) { 585 $args = array( 586 'language' => $language_scope, 539 foreach ( array( self::patterns_table(), self::responses_table(), self::intents_table() ) as $table ) { 540 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching -- emptying our own cache table; table name passed via %i. 541 $wpdb->query( $wpdb->prepare( 'DELETE FROM %i', $table ) ); 542 } 543 delete_option( self::OPTION_VERSION ); 544 delete_option( self::OPTION_LAST_SYNCED_AT ); 545 delete_option( self::OPTION_LANGUAGE_SCOPE ); 546 } 547 548 /** 549 * Build the request URL. 550 * 551 * PRIVACY: only the language, the feature flag and `exclusive` (give me 552 * just this language) are sent. No site address, no edition, no version, 553 * no customer or visitor data. wp_safe_remote_get() reveals the requesting 554 * IP at the transport level, as any HTTP request does. Disclosed in 555 * readme.txt. 556 * 557 * @since 1.25.0 558 * @param string $language Dataset language code. 559 * @return string Full request URL. 560 */ 561 private static function build_request_url( $language ) { 562 return self::ENDPOINT . '?' . http_build_query( 563 array( 564 'language' => $language, 565 'features' => 'actions', 566 'exclusive' => '1', 567 ) 587 568 ); 588 589 $cached_version = get_option( self::OPTION_VERSION, '' );590 if ( ! $force_full_refetch && '' !== $cached_version ) {591 $args['since'] = $cached_version;592 }593 594 // Plain http_build_query() rather than add_query_arg()'s array595 // form — both work fine against a plugin's own hardcoded base596 // URL, but this keeps the request-building logic dependency-free597 // PHP, easier to unit-test without a full WordPress stub layer.598 return self::ENDPOINT . '?' . http_build_query( $args );599 569 } 600 570 … … 611 581 * @param array $patterns Remote patterns payload. 612 582 * @param array $responses Remote responses payload. 613 * @return void614 */ 615 private function replace_local_cache( $intents, $patterns, $responses ) {583 * @return bool True when the cache was replaced. 584 */ 585 private static function replace_local_cache( $intents, $patterns, $responses ) { 616 586 global $wpdb; 617 587 … … 638 608 'name' => sanitize_text_field( (string) $intent['name'] ), 639 609 'description' => isset( $intent['description'] ) ? sanitize_textarea_field( (string) $intent['description'] ) : '', 610 'action' => ( isset( $intent['action'] ) && is_string( $intent['action'] ) && '' !== $intent['action'] ) ? sanitize_key( $intent['action'] ) : null, 640 611 ), 641 array( '%d', '%s', '%s' )612 array( '%d', '%s', '%s', '%s' ) 642 613 ) ); 643 614 } … … 683 654 if ( $ok ) { 684 655 $wpdb->query( 'COMMIT' ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching -- transaction control, not a data query. 656 return true; 685 657 } else { 686 658 // Never leave a half-written cache — roll back to whatever was … … 690 662 $wpdb->query( 'ROLLBACK' ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching -- transaction control, not a data query. 691 663 } 664 665 return false; 692 666 } 693 667 … … 760 734 FROM %i p 761 735 INNER JOIN %i i ON i.id = p.intent_id 762 WHERE p.language = %s ',736 WHERE p.language = %s AND ( i.action IS NULL OR i.action = \'\' )', 763 737 $patterns_table, 764 738 $intents_table, -
winaltchat-for-woocommerce/trunk/includes/class-winalt-translate.php
r3788419 r3825228 66 66 add_action( 'wp_ajax_winalt_translate_toggle', array( __CLASS__, 'ajax_toggle' ) ); 67 67 add_action( 'wp_ajax_winalt_translate_now', array( __CLASS__, 'ajax_translate' ) ); 68 add_action( 'wp_ajax_winalt_patterns_retry', array( __CLASS__, 'ajax_patterns_retry' ) ); 68 69 add_action( 'wp_ajax_winalt_translate_preview', array( __CLASS__, 'ajax_preview' ) ); 69 70 … … 626 627 */ 627 628 public static function fetch_ready_made( $locale, $sources ) { 628 $edition = defined( 'WINALT_ VERSION' ) ? 'pro' : 'free';629 $version = defined( 'WINALT_ VERSION' ) ? WINALT_VERSION : ( defined( 'WINALT_VERSION' ) ? WINALT_VERSION : '' );629 $edition = defined( 'WINALT_PRO_VERSION' ) ? 'pro' : 'free'; 630 $version = defined( 'WINALT_PRO_VERSION' ) ? WINALT_PRO_VERSION : ( defined( 'WINALT_VERSION' ) ? WINALT_VERSION : '' ); 630 631 631 632 $response = wp_safe_remote_get( … … 642 643 643 644 return self::parse_remote( wp_remote_retrieve_body( $response ), $sources ); 645 } 646 647 /** 648 * Refresh the ready-made translation of the chosen language from the 649 * website (no AI key is ever used here). Used after a plugin update and by 650 * the Retry button. 651 * 652 * @since 1.67.45 653 * @return bool False only when there is no translation at all for the chosen language. 654 */ 655 public static function refresh_ready_made() { 656 $locale = self::target_locale(); 657 if ( ! self::enabled() || self::is_english( $locale ) ) { 658 return true; 659 } 660 661 $sources = self::source_strings(); 662 $ready = empty( $sources ) ? null : self::fetch_ready_made( $locale, $sources ); 663 if ( null !== $ready ) { 664 update_option( 665 self::OPTION_DATA, 666 array( 667 'locale' => $locale, 668 'generated' => time(), 669 'source' => 'ready-made', 670 'strings' => $ready, 671 ), 672 false 673 ); 674 675 return true; 676 } 677 678 // Keep what is already stored for this language (ready-made or AI). 679 $data = (array) get_option( self::OPTION_DATA, array() ); 680 681 return isset( $data['locale'] ) && $data['locale'] === $locale && ! empty( $data['strings'] ); 644 682 } 645 683 … … 771 809 ); 772 810 811 $status['patterns_error'] = '1' === (string) get_option( 'winalt_pattern_sync_error', '0' ); 812 $status['patterns_message'] = __( 'The reply patterns for this language could not be loaded. Check your connection and try again.', 'winaltchat-for-woocommerce' ); 773 813 $status['chosen'] = self::chosen_language(); 774 814 $status['preview'] = self::preview_map(); … … 789 829 $on = isset( $_POST['enabled'] ) && '1' === sanitize_text_field( wp_unslash( $_POST['enabled'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing -- verified in guard(). 790 830 update_option( self::OPTION_ENABLED, $on ? '1' : '0', false ); 831 if ( class_exists( 'Winalt_Pattern_Sync' ) ) { 832 // Off means English: the downloaded patterns are removed. 833 Winalt_Pattern_Sync::refresh(); 834 } 791 835 792 836 wp_send_json_success( array( 'status' => self::current_status() ) ); … … 864 908 update_option( self::OPTION_ENABLED, '1', false ); 865 909 866 // Reply patterns for this language are fetched in the background. 910 // The reply patterns for this language come from the website too. A 911 // failure is shown on the screen with a Retry button. 867 912 if ( class_exists( 'Winalt_Pattern_Sync' ) ) { 868 Winalt_Pattern_Sync:: schedule_activation_sync();913 Winalt_Pattern_Sync::refresh(); 869 914 } 870 915 … … 880 925 881 926 /** 927 * AJAX: try again to load the translation and patterns for the chosen 928 * language (the Retry button). 929 * 930 * @since 1.67.45 931 * @return void 932 */ 933 public static function ajax_patterns_retry() { 934 self::guard(); 935 936 self::refresh_ready_made(); 937 $result = class_exists( 'Winalt_Pattern_Sync' ) ? Winalt_Pattern_Sync::refresh() : array( 'ok' => true ); 938 939 $payload = array( 940 'ok' => ! empty( $result['ok'] ), 941 'status' => self::current_status(), 942 ); 943 if ( $payload['ok'] ) { 944 wp_send_json_success( $payload ); 945 } 946 wp_send_json_error( $payload, 400 ); 947 } 948 949 /** 882 950 * Nonce and capability check shared by the endpoints. 883 951 * -
winaltchat-for-woocommerce/trunk/readme.txt
r3788451 r3825228 4 4 Requires at least: 6.2 5 5 Tested up to: 7.1 6 Stable tag: 1.67. 376 Stable tag: 1.67.50 7 7 Requires PHP: 7.4 8 8 Requires Plugins: woocommerce … … 92 92 Chat messages and visitor details are never sent to an external 93 93 service by live chat. The optional features that contact one 94 (AI providers, translations, pattern sync, mobile push) are listed94 (AI providers, translations, reply patterns, mobile push) are listed 95 95 under External Services below. 96 96 * Session tokens are 32-character cryptographically random strings, … … 267 267 * **Winalt Technologies:** [aisalesmanchatpro.com](https://aisalesmanchatpro.com) | [Privacy Policy](https://aisalesmanchatpro.com/privacy-policy.html) 268 268 269 **Basic AI Pattern Sync (automatic and in the background, about once a day, once after activation, and whenever you choose a new chat language)** 270 271 Basic AI mode periodically pulls an updated set of intents, patterns, 272 and responses from Winalt Technologies so its built-in conversational 273 replies can improve and cover more languages over time. Only your 274 site's detected language and the version number of the pattern set 275 you already have cached are sent. Nothing else. Your customer 276 messages, conversation content, and product data are never sent as 277 part of this sync, and never leave your site for this feature. If the 278 sync ever fails (network error, timeout, or Winalt Technologies is 279 unreachable), Basic AI mode silently keeps using whatever it already 280 has cached, or its original built-in patterns if it has never synced 281 successfully. Nothing breaks and no data is lost. 269 **Basic AI reply patterns in another language (only when your Chat language is not English)** 270 271 English wording and reply patterns are built into the plugin, so a store running in English contacts no server for this. When you choose another Chat language and press Apply, and once after the plugin is updated, the plugin downloads that language's reply patterns from Winalt Technologies into your own database. Sent with the request: the language you chose, and nothing else. No site address, plugin version, customer message, visitor detail or product data is sent. There is no background or recurring sync. If the download fails, the screen says so and offers a Retry button; the plugin keeps what it already has in the meantime. 282 272 283 273 * **Winalt Technologies:** [aisalesmanchatpro.com](https://aisalesmanchatpro.com) | [Privacy Policy](https://aisalesmanchatpro.com/privacy-policy.html) … … 292 282 **Chat language - ready-made translations (only when you choose a language on the Appearance screen)** 293 283 294 When you choose a language in Chat language on the Appearance screen and press Translate, the plugin asks Winalt Technologies for a ready-made translation of the chat buttons and messages in that language, so you do not need an AI key. The list of available languages is fetched the same way (nothing is sent with it). Sent with the translation request: your site's home address, the language you chose, and the plugin edition and version. Winalt Technologies keeps one record per site and language (with a request counter and first/last request dates) so it can see which languages store owners need and add them. Never sent: customer messages, visitor details, or any chat or product data. Nothing is requested unless you press Translate . The translations are machine-generated and should be checked by a native speaker. If no ready-made translation exists yet, the plugin uses your own AI provider key instead, if you have connected one.284 When you choose a language in Chat language on the Appearance screen and press Translate, the plugin asks Winalt Technologies for a ready-made translation of the chat buttons and messages in that language, so you do not need an AI key. The list of available languages is fetched the same way (nothing is sent with it). Sent with the translation request: your site's home address, the language you chose, and the plugin edition and version. Winalt Technologies keeps one record per site and language (with a request counter and first/last request dates) so it can see which languages store owners need and add them. Never sent: customer messages, visitor details, or any chat or product data. Nothing is requested unless you press Translate, apart from one refresh of the language you already chose after a plugin update. The translations are machine-generated and should be checked by a native speaker. If no ready-made translation exists yet, the plugin uses your own AI provider key instead, if you have connected one. 295 285 296 286 * **Winalt Technologies** - [aisalesmanchatpro.com](https://aisalesmanchatpro.com) | [Privacy Policy](https://aisalesmanchatpro.com/privacy-policy.html) 297 287 298 288 == Changelog == 289 290 = 1.67.50 = 291 * Improve: Removed the extra hint text under Chat language on the Appearance screen. 292 293 = 1.67.49 = 294 * Improve: The Appearance tab bar now matches the Live Chats bar and shows in Advanced view only. Typography and Chat language have their own tabs, and the "Customize wording" box is gone: Quick replies and Messages are ordinary tabs. 295 296 = 1.67.48 = 297 * New: In Advanced view the Appearance screen is split into tabs (Style, Branding, Engagement, Quick replies, Messages) so you no longer scroll one long page. Simple view is unchanged. 298 299 = 1.67.47 = 300 * Fix: A store running in English now removes reply patterns that an older version had downloaded, so English always uses the wording built into the plugin. 301 302 = 1.67.46 = 303 * Change: Reply patterns and the ready-made translation for a non-English Chat language are downloaded from Winalt Technologies only when you choose that language and once after a plugin update. English is built in and contacts no server. There is no daily or background sync, and no site address is sent with the patterns. If a download fails the screen offers a Retry button. 304 305 = 1.67.44 = 306 * Improve: Basic AI Pattern Sync now sends your site's home address, plugin edition and version with each request, so Winalt Technologies can see which sites sync. The readme's external services section describes exactly what is sent. No customer or visitor data is sent. 307 308 = 1.67.43 = 309 * Fix: Chinese is now synced in both Simplified and Traditional characters together, so Traditional Chinese questions are understood on stores set to Simplified Chinese, and the other way round. 310 311 = 1.67.42 = 312 * Fix: Product searches written in a non-English language ended in an error message instead of showing products. 313 314 = 1.67.41 = 315 * Improve: The non-English phrases and replies Basic AI uses are no longer stored in the plugin. They are managed on the plugin website and synced for your site language, English and the Chat language you choose, so wording can be improved without a plugin update. Nothing changes for English. 316 317 = 1.67.40 = 318 * New: Basic AI now understands 28 languages besides English: Spanish, French, German, Italian, Portuguese, Dutch, Russian, Ukrainian, Turkish, Polish, Arabic, Persian, Hebrew, Greek, Hindi, Thai, Japanese, Korean, Chinese (Simplified and Traditional), Indonesian, Vietnamese, Swedish, Danish, Norwegian, Finnish, Czech, Romanian and Hungarian. Shoppers can ask about orders, returns, shipping, opening hours, contact details, payment methods, discounts, the cart and talking to a person, and are answered in their own language using your store's own pages. Products are found by the names used in your catalogue. English is unchanged. 319 320 = 1.67.39 = 321 * New: Basic AI now understands Chinese. It answers questions about orders, returns, shipping, opening hours, contact details, payment methods, discounts, the cart and talking to a person, in Chinese, using your store's own pages. It also finds products by their Chinese names and handles greetings, thanks and goodbyes without needing a sync. English is unchanged. 322 * Fix: the free plugin reported itself as Pro when asking for chat translations; it now reports Free. 323 324 = 1.67.38 = 325 * Fix: The "copy our support email" button in the admin now copies info@winalttechnologies.com. 299 326 300 327 = 1.67.37 = … … 303 330 304 331 = 1.67.36 = 305 * Fix: The readme no longer says nothing is ever sent to an outside service. It now points to the External Services list (AI providers, translations, pattern sync, mobile push).332 * Fix: The readme no longer says nothing is ever sent to an outside service. It now points to the External Services list (AI providers, translations, reply patterns, mobile push). 306 333 307 334 = 1.67.35 = 308 335 * Improve: The mobile app is limited to 3 phones per site on the free plan. A 4th phone gets a clear "limit reached" message; signing out on one phone frees its slot. The same account can still sign in on several phones, and a phone whose notification token refreshes keeps its place. 309 310 = 1.67.34 =311 * Fix: The chat no longer gives customers an email address taken from the WooCommerce or WordPress settings. It only uses the address published on your Contact page, in its own replies and in the AI model's instructions. With no email on the Contact page, no address is given.312 * Fix: An address you put on the Contact page is always used as written, even if it looks like an example. This undoes the 1.67.33 rule that skipped such addresses.313 314 = 1.67.33 =315 * Fix: "Most expensive" now lists the priciest products first, and "cheap gifts under $15" applies the $15 limit.316 * Fix: A single result reads "Here is 1 product", and the sale list is topped up with other sale items instead of showing one.317 * Fix: A placeholder contact address (example.com, .test) is no longer shown to customers as the store's email.318 * Fix: The offline form rejects a mistyped email instead of saving a rewritten one.319 * Improve: Accessibility. The chat is a labelled dialog, new replies are read out to screen readers, the message box and send button have labels, Esc closes the chat, buttons are at least 44px on touch screens, and View Product and the send arrow follow Text on Primary so light brand colours stay readable.320 321 = 1.67.32 =322 * Fix: After a page reload during a live chat, the visitor's own messages showed raw text such as & and ". They now read normally, and delivery ticks match again.323 * Fix: When the chat limit is reached, the shopper now sees "Too many requests. Please wait a moment before trying again." instead of a generic error.324 325 = 1.67.31 =326 * Fix: Chats this week on the Home screen never counted real conversations, because the chat always sends the visitor's first message along with the request. Each new conversation is now counted once.327 328 = 1.67.30 =329 * Fix: Basic AI no longer adds made-up taglines before a single product ("Premium Quality", "Eco-Friendly", "Trusted by thousands", "Fast Delivery Available"). It now only mentions the shopper rating when the product has a good one with reviews.330 331 = 1.67.29 =332 * Fix: Removed the extra page-background and scroll-room rules that were added to chase a scroll flicker; free and Pro lay out the bottom of the screen the same way again.333 334 = 1.67.28 =335 * Fix: Live chat, the availability switch no longer moves when its label changes, the tabs (Live Conversations, Team Access, Settings) use the same soft highlight as the main menu, and the screen has a little scroll room underneath.336 337 = 1.67.27 =338 * Fix: Reset to Defaults on Appearance now shows the same colours that are saved (they differed until a refresh), sets Light or dark back to Light and clears the highlighted Style. Chat language is left as it was.339 340 = 1.67.26 =341 * Fix: Appearance, the Style you picked is remembered when you save, so it is still highlighted after reloading the screen.342 343 = 1.67.25 =344 * Fix: Appearance, the chosen Style stays highlighted after a reload, and the Style / Light or dark buttons and colour swatches have a visible hover in dark mode.345 346 = 1.67.24 =347 * Fix: Dark mode, the machine-translation note under Chat language is readable. The info tip says "our server" instead of the domain name.348 349 = 1.67.23 =350 * Improve: Appearance, the Style buttons now look like the Light or dark options, the live preview starts level with the first card, and the Chat language info tip is shorter and aligned.351 336 352 337 Earlier versions are listed in changelog.txt in the plugin folder. -
winaltchat-for-woocommerce/trunk/uninstall.php
r3788419 r3825228 62 62 wp_clear_scheduled_hook( 'winalt_pattern_sync_run' ); 63 63 wp_clear_scheduled_hook( 'winalt_pattern_sync_activation_run' ); 64 wp_clear_scheduled_hook( 'winalt_pattern_sync_update_run' ); 64 65 65 66 /** … … 130 131 wp_clear_scheduled_hook( 'winalt_pattern_sync_run' ); 131 132 wp_clear_scheduled_hook( 'winalt_pattern_sync_activation_run' ); 133 wp_clear_scheduled_hook( 'winalt_pattern_sync_update_run' ); 132 134 133 135 // Delete options for this blog. -
winaltchat-for-woocommerce/trunk/winaltchat-for-woocommerce.php
r3788451 r3825228 4 4 * Plugin URI: https://wordpress.org/plugins/winaltchat-for-woocommerce/ 5 5 * Description: WinaltChat adds an AI-powered chat widget to your WooCommerce store to help customers find products, answer questions, and boost sales. 6 * Version: 1.67. 376 * Version: 1.67.50 7 7 * Requires at least: 6.2 8 8 * Requires PHP: 7.4 … … 133 133 winalt_live_chat_install(); 134 134 135 // Attempt one pattern-sync shortly after activation, as a136 // background WP-Cron event — never an inline HTTP call here,137 // so activation itself can never block on or fail because of138 // network I/O. See Winalt_Pattern_Sync::schedule_activation_sync().139 Winalt_Pattern_Sync::schedule_activation_sync();140 135 } 141 136 } … … 151 146 152 147 // Define plugin-wide constants for version, file paths, and URLs. 153 define( 'WINALT_VERSION', '1.67. 37' );148 define( 'WINALT_VERSION', '1.67.50' ); 154 149 define( 'WINALT_FILE', __FILE__ ); 155 150 define( 'WINALT_PATH', plugin_dir_path( __FILE__ ) );
Note:
See TracChangeset
for help on using the changeset viewer.