Changeset 3740440
- Timestamp:
- 10/12/2026 03:43:59 AM (6 weeks ago)
- Location:
- chat-cobalt
- Files:
-
- 2 added
- 8 edited
- 1 copied
-
tags/1.4.1 (copied) (copied from chat-cobalt/trunk )
-
tags/1.4.1/admin-page.php (modified) (4 diffs)
-
tags/1.4.1/chat-cobalt.php (modified) (7 diffs)
-
tags/1.4.1/connect.php (added)
-
tags/1.4.1/readme.txt (modified) (2 diffs)
-
tags/1.4.1/uninstall.php (modified) (1 diff)
-
trunk/admin-page.php (modified) (4 diffs)
-
trunk/chat-cobalt.php (modified) (7 diffs)
-
trunk/connect.php (added)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/uninstall.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
chat-cobalt/tags/1.4.1/admin-page.php
r3713711 r3740440 69 69 add_settings_error( CHATCOBALT_OPTION_KEY, 'chatcobalt_saved', __( 'Settings saved.', 'chat-cobalt' ), 'success' ); 70 70 } 71 // Carried across the redirect from connect.php in a transient, so the 72 // wording is never in the address bar. 73 $connect_notice = function_exists( 'chatcobalt_connect_take_notice' ) ? chatcobalt_connect_take_notice() : false; 74 if ( $connect_notice ) { 75 add_settings_error( CHATCOBALT_OPTION_KEY, 'chatcobalt_connect', $connect_notice['message'], $connect_notice['type'] ); 76 } 71 77 ?> 72 78 <div class="wrap chatcobalt-wrap"> … … 120 126 121 127 <section class="cc-card"> 122 <?php chatcobalt_card_head( __( 'Step 1', 'chat-cobalt' ), 'link', __( 'Connect your account', 'chat-cobalt' ), __( 'Paste your Business ID and the chat bubble appears on every page of this site. No code editing.', 'chat-cobalt' ) ); ?> 128 <?php 129 // One-click Connect leads Step 1 (2026-10-07): it fills Business ID 130 // and Site Key together, so it is the first thing a new owner sees, 131 // not something to find in Step 3. 132 chatcobalt_card_head( 133 __( 'Step 1', 'chat-cobalt' ), 134 'link', 135 __( 'Connect your account', 'chat-cobalt' ), 136 chatcobalt_is_connected() 137 ? __( 'Your site is connected. The chat bubble appears on every page of this site.', 'chat-cobalt' ) 138 : __( 'One click and the chat bubble appears on every page of this site. No code editing.', 'chat-cobalt' ) 139 ); 140 ?> 141 <?php if ( ! chatcobalt_is_connected() ) : ?> 142 <div class="cc-connect"> 143 <div class="cc-connect__text"> 144 <strong><?php esc_html_e( 'Connect in one click', 'chat-cobalt' ); ?></strong> 145 <p><?php 146 printf( 147 /* translators: %s: the product name. */ 148 esc_html__( 'Press the button, say yes on the %s screen, and your Business ID and Site Key are filled in for you. Nothing to copy.', 'chat-cobalt' ), 149 esc_html( CHATCOBALT_PRODUCT_NAME ) 150 ); 151 ?></p> 152 </div> 153 <?php 154 // A link, not a nested <form>. This card sits inside the settings 155 // form, and a form inside a form is invalid HTML: the browser drops 156 // the inner one and its button submits the OUTER form to options.php, 157 // which lands the owner on WordPress's raw All Settings screen. The 158 // nonce still travels, and admin-post.php reads $_REQUEST, so this is 159 // checked exactly as a POST would be. 160 $connect_url = wp_nonce_url( 161 add_query_arg( 'action', 'chatcobalt_connect', admin_url( 'admin-post.php' ) ), 162 'chatcobalt_connect' 163 ); 164 ?> 165 <a href="<?php echo esc_url( $connect_url ); ?>" class="button button-primary cc-button"><?php esc_html_e( 'Connect', 'chat-cobalt' ); ?></a> 166 </div> 167 <p class="cc-connect__alt"><?php esc_html_e( 'Or paste your Business ID yourself:', 'chat-cobalt' ); ?></p> 168 <?php endif; ?> 123 169 <div class="cc-field"> 124 170 <label class="cc-label" for="chatcobalt_business_id"><?php esc_html_e( 'Business ID', 'chat-cobalt' ); ?></label> … … 147 193 <section class="cc-card"> 148 194 <?php chatcobalt_card_head( __( 'Step 3', 'chat-cobalt' ), 'pages', __( 'Answer with your own pages', 'chat-cobalt' ), __( 'Optional. Let the chat recommend your pages and posts as clickable cards.', 'chat-cobalt' ) ); ?> 195 <?php if ( ! chatcobalt_is_connected() ) : ?> 196 <p class="cc-connect__alt"><?php esc_html_e( 'Pressing Connect in Step 1 fills this in for you.', 'chat-cobalt' ); ?></p> 197 <?php endif; ?> 149 198 <div class="cc-field"> 150 199 <label class="cc-label" for="chatcobalt_site_key"><?php esc_html_e( 'Site Key', 'chat-cobalt' ); ?></label> … … 237 286 .cc-shop-toggle{display:flex;gap:10px;align-items:flex-start;padding:14px 16px;border:1px solid var(--cc-line);border-radius:14px;background:#fff;font-size:14px;color:var(--cc-ink);font-weight:600} 238 287 .cc-shop-note{margin:12px 0 0;font-size:12.5px;color:var(--cc-muted);line-height:1.5} 288 .cc-connect{display:flex;gap:18px;align-items:center;flex-wrap:wrap;justify-content:space-between;padding:18px 20px;margin:0 0 14px;border-radius:16px;background:linear-gradient(180deg,#F7F9FF 0%,#fff 70%);border:1px solid #DCE3FF} 289 .cc-connect__text{min-width:220px;flex:1 1 320px} 290 .cc-connect__text strong{display:block;font-size:15px;color:var(--cc-ink)} 291 .cc-connect__text p{margin:4px 0 0;font-size:13px;color:var(--cc-muted);line-height:1.5} 292 .cc-connect form{margin:0} 293 .cc-connect__alt{margin:0 0 14px;font-size:12.5px;color:var(--cc-muted)} 239 294 .cc-card__head{display:flex;gap:16px;align-items:flex-start;margin-bottom:22px;padding-bottom:20px;border-bottom:1px solid var(--cc-line)} 240 295 .cc-badge{display:flex;width:42px;height:42px;flex:none;align-items:center;justify-content:center;border-radius:14px;background:var(--cc-tint);color:var(--cc)} -
chat-cobalt/tags/1.4.1/chat-cobalt.php
r3713711 r3740440 3 3 * Plugin Name: Chat Cobalt 4 4 * Description: Adds an AI chat widget to every page of your site. Paste in your Business ID and you're done -- no theme or code editing required. 5 * Version: 1.4. 05 * Version: 1.4.1 6 6 * Requires at least: 5.8 7 7 * Tested up to: 7.1 … … 41 41 // the enqueued widget script, not anything functional, but corrected here 42 42 // while touching this line anyway. 43 define( 'CHATCOBALT_VERSION', '1.4. 0' );43 define( 'CHATCOBALT_VERSION', '1.4.1' ); 44 44 define( 'CHATCOBALT_EMBED_URL', 'https://www.chatcobalt.com/embed.js' ); 45 45 define( 'CHATCOBALT_CONFIG_URL', 'https://www.chatcobalt.com/api/widget-config' ); … … 69 69 require_once plugin_dir_path( __FILE__ ) . 'admin-page.php'; 70 70 require_once plugin_dir_path( __FILE__ ) . 'support-page.php'; 71 require_once plugin_dir_path( __FILE__ ) . 'connect.php'; 71 72 require_once plugin_dir_path( __FILE__ ) . 'woo-orders.php'; 72 73 … … 219 220 } 220 221 222 /** 223 * Queue a notice on our settings screen unless one with the same code is 224 * already queued. On the very first save (no option row yet) WordPress runs 225 * the sanitize callback twice -- update_option, then add_option -- so without 226 * this every notice it adds appears twice. 227 */ 228 function chatcobalt_settings_notice_once( $code, $message, $type ) { 229 foreach ( get_settings_errors( CHATCOBALT_OPTION_KEY ) as $queued ) { 230 if ( isset( $queued['code'] ) && $queued['code'] === $code ) { 231 return; 232 } 233 } 234 add_settings_error( CHATCOBALT_OPTION_KEY, $code, $message, $type ); 235 } 236 221 237 function chatcobalt_sanitize_settings( $input ) { 222 238 $existing = chatcobalt_get_settings(); … … 293 309 // the customer typed is kept and the widget still loads -- a failed 294 310 // lookup only costs them the automatic brand color. 295 add_settings_error( 296 CHATCOBALT_OPTION_KEY, 311 chatcobalt_settings_notice_once( 297 312 'chatcobalt_lookup_failed', 298 313 sprintf( … … 316 331 if ( '' === $output['accent_color'] && chatcobalt_is_hex_color( $brand ) ) { 317 332 $output['accent_color'] = $brand; 318 add_settings_error( 319 CHATCOBALT_OPTION_KEY, 333 chatcobalt_settings_notice_once( 320 334 'chatcobalt_connected', 321 335 sprintf( … … 330 344 } 331 345 332 add_settings_error( 333 CHATCOBALT_OPTION_KEY, 346 chatcobalt_settings_notice_once( 334 347 'chatcobalt_connected', 335 348 sprintf( -
chat-cobalt/tags/1.4.1/readme.txt
r3713711 r3740440 5 5 Tested up to: 7.1 6 6 Requires PHP: 7.2 7 Stable tag: 1.4. 07 Stable tag: 1.4.1 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 78 78 If you turn on "Order updates on WhatsApp" (shown only when WooCommerce is installed), two things happen. When you save the setting, your site registers itself with `https://www.chatcobalt.com/api/wp/orders-connect`, sending your Business ID, your site address and a secret this plugin generates, so that only Chat Cobalt can ask your shop about orders. Then, when a customer messages your WhatsApp number about an order, Chat Cobalt sends one signed request to your site (`/wp-json/chat-cobalt/v1/orders`) carrying the phone number they are messaging from, and your shop answers with the status, date, total, items and tracking number of at most three of that customer's own orders -- never an address, email or payment detail. The answer is used for that one reply and is not stored. This is off by default, and turning it off removes the secret at both ends. 79 79 80 If you use the **Connect** button on the settings screen, your site opens a Chat Cobalt page carrying your site address, your site's name, and a one-time code (only a scrambled form of the code is in the link). After you approve the connection there, your site collects the Site Key directly from `https://www.chatcobalt.com/api/wp/claim-site-key`. No password or personal data is exchanged, and nothing is sent unless you press Connect. 81 80 82 Once a Business ID is saved, the settings screen also shows a "Try your chatbot" box. Typing a question there and clicking Ask sends your Business ID and whatever you typed to `https://www.chatcobalt.com/api/preview-chat`, purely so the reply can be shown to you on that same screen -- it is never saved as a lead or a conversation, and nothing is sent unless you click Ask yourself. 81 83 82 84 == Changelog == 85 86 = 1.4.1 = 87 * New: a **Connect** button on the settings screen. Press it, say yes on the Chat Cobalt screen, and your Business ID and Site Key are filled in for you -- no more copying a key between two websites. 88 * Connecting also picks sensible content to sync (pages and posts) and runs the first sync straight away, so the chat can answer with your pages immediately. 89 * Fix: the first time you saved your Business ID, the "Connected" message showed twice. 83 90 84 91 = 1.4.0 = -
chat-cobalt/tags/1.4.1/uninstall.php
r3713711 r3740440 14 14 delete_option( 'chatcobalt_settings' ); 15 15 delete_option( 'chatcobalt_orders_secret' ); 16 delete_option( 'chatcobalt_pairing' ); 16 17 delete_option( 'chatcobalt_orders_status' ); 17 18 delete_option( 'chatcobalt_last_sync' ); -
chat-cobalt/trunk/admin-page.php
r3713711 r3740440 69 69 add_settings_error( CHATCOBALT_OPTION_KEY, 'chatcobalt_saved', __( 'Settings saved.', 'chat-cobalt' ), 'success' ); 70 70 } 71 // Carried across the redirect from connect.php in a transient, so the 72 // wording is never in the address bar. 73 $connect_notice = function_exists( 'chatcobalt_connect_take_notice' ) ? chatcobalt_connect_take_notice() : false; 74 if ( $connect_notice ) { 75 add_settings_error( CHATCOBALT_OPTION_KEY, 'chatcobalt_connect', $connect_notice['message'], $connect_notice['type'] ); 76 } 71 77 ?> 72 78 <div class="wrap chatcobalt-wrap"> … … 120 126 121 127 <section class="cc-card"> 122 <?php chatcobalt_card_head( __( 'Step 1', 'chat-cobalt' ), 'link', __( 'Connect your account', 'chat-cobalt' ), __( 'Paste your Business ID and the chat bubble appears on every page of this site. No code editing.', 'chat-cobalt' ) ); ?> 128 <?php 129 // One-click Connect leads Step 1 (2026-10-07): it fills Business ID 130 // and Site Key together, so it is the first thing a new owner sees, 131 // not something to find in Step 3. 132 chatcobalt_card_head( 133 __( 'Step 1', 'chat-cobalt' ), 134 'link', 135 __( 'Connect your account', 'chat-cobalt' ), 136 chatcobalt_is_connected() 137 ? __( 'Your site is connected. The chat bubble appears on every page of this site.', 'chat-cobalt' ) 138 : __( 'One click and the chat bubble appears on every page of this site. No code editing.', 'chat-cobalt' ) 139 ); 140 ?> 141 <?php if ( ! chatcobalt_is_connected() ) : ?> 142 <div class="cc-connect"> 143 <div class="cc-connect__text"> 144 <strong><?php esc_html_e( 'Connect in one click', 'chat-cobalt' ); ?></strong> 145 <p><?php 146 printf( 147 /* translators: %s: the product name. */ 148 esc_html__( 'Press the button, say yes on the %s screen, and your Business ID and Site Key are filled in for you. Nothing to copy.', 'chat-cobalt' ), 149 esc_html( CHATCOBALT_PRODUCT_NAME ) 150 ); 151 ?></p> 152 </div> 153 <?php 154 // A link, not a nested <form>. This card sits inside the settings 155 // form, and a form inside a form is invalid HTML: the browser drops 156 // the inner one and its button submits the OUTER form to options.php, 157 // which lands the owner on WordPress's raw All Settings screen. The 158 // nonce still travels, and admin-post.php reads $_REQUEST, so this is 159 // checked exactly as a POST would be. 160 $connect_url = wp_nonce_url( 161 add_query_arg( 'action', 'chatcobalt_connect', admin_url( 'admin-post.php' ) ), 162 'chatcobalt_connect' 163 ); 164 ?> 165 <a href="<?php echo esc_url( $connect_url ); ?>" class="button button-primary cc-button"><?php esc_html_e( 'Connect', 'chat-cobalt' ); ?></a> 166 </div> 167 <p class="cc-connect__alt"><?php esc_html_e( 'Or paste your Business ID yourself:', 'chat-cobalt' ); ?></p> 168 <?php endif; ?> 123 169 <div class="cc-field"> 124 170 <label class="cc-label" for="chatcobalt_business_id"><?php esc_html_e( 'Business ID', 'chat-cobalt' ); ?></label> … … 147 193 <section class="cc-card"> 148 194 <?php chatcobalt_card_head( __( 'Step 3', 'chat-cobalt' ), 'pages', __( 'Answer with your own pages', 'chat-cobalt' ), __( 'Optional. Let the chat recommend your pages and posts as clickable cards.', 'chat-cobalt' ) ); ?> 195 <?php if ( ! chatcobalt_is_connected() ) : ?> 196 <p class="cc-connect__alt"><?php esc_html_e( 'Pressing Connect in Step 1 fills this in for you.', 'chat-cobalt' ); ?></p> 197 <?php endif; ?> 149 198 <div class="cc-field"> 150 199 <label class="cc-label" for="chatcobalt_site_key"><?php esc_html_e( 'Site Key', 'chat-cobalt' ); ?></label> … … 237 286 .cc-shop-toggle{display:flex;gap:10px;align-items:flex-start;padding:14px 16px;border:1px solid var(--cc-line);border-radius:14px;background:#fff;font-size:14px;color:var(--cc-ink);font-weight:600} 238 287 .cc-shop-note{margin:12px 0 0;font-size:12.5px;color:var(--cc-muted);line-height:1.5} 288 .cc-connect{display:flex;gap:18px;align-items:center;flex-wrap:wrap;justify-content:space-between;padding:18px 20px;margin:0 0 14px;border-radius:16px;background:linear-gradient(180deg,#F7F9FF 0%,#fff 70%);border:1px solid #DCE3FF} 289 .cc-connect__text{min-width:220px;flex:1 1 320px} 290 .cc-connect__text strong{display:block;font-size:15px;color:var(--cc-ink)} 291 .cc-connect__text p{margin:4px 0 0;font-size:13px;color:var(--cc-muted);line-height:1.5} 292 .cc-connect form{margin:0} 293 .cc-connect__alt{margin:0 0 14px;font-size:12.5px;color:var(--cc-muted)} 239 294 .cc-card__head{display:flex;gap:16px;align-items:flex-start;margin-bottom:22px;padding-bottom:20px;border-bottom:1px solid var(--cc-line)} 240 295 .cc-badge{display:flex;width:42px;height:42px;flex:none;align-items:center;justify-content:center;border-radius:14px;background:var(--cc-tint);color:var(--cc)} -
chat-cobalt/trunk/chat-cobalt.php
r3713711 r3740440 3 3 * Plugin Name: Chat Cobalt 4 4 * Description: Adds an AI chat widget to every page of your site. Paste in your Business ID and you're done -- no theme or code editing required. 5 * Version: 1.4. 05 * Version: 1.4.1 6 6 * Requires at least: 5.8 7 7 * Tested up to: 7.1 … … 41 41 // the enqueued widget script, not anything functional, but corrected here 42 42 // while touching this line anyway. 43 define( 'CHATCOBALT_VERSION', '1.4. 0' );43 define( 'CHATCOBALT_VERSION', '1.4.1' ); 44 44 define( 'CHATCOBALT_EMBED_URL', 'https://www.chatcobalt.com/embed.js' ); 45 45 define( 'CHATCOBALT_CONFIG_URL', 'https://www.chatcobalt.com/api/widget-config' ); … … 69 69 require_once plugin_dir_path( __FILE__ ) . 'admin-page.php'; 70 70 require_once plugin_dir_path( __FILE__ ) . 'support-page.php'; 71 require_once plugin_dir_path( __FILE__ ) . 'connect.php'; 71 72 require_once plugin_dir_path( __FILE__ ) . 'woo-orders.php'; 72 73 … … 219 220 } 220 221 222 /** 223 * Queue a notice on our settings screen unless one with the same code is 224 * already queued. On the very first save (no option row yet) WordPress runs 225 * the sanitize callback twice -- update_option, then add_option -- so without 226 * this every notice it adds appears twice. 227 */ 228 function chatcobalt_settings_notice_once( $code, $message, $type ) { 229 foreach ( get_settings_errors( CHATCOBALT_OPTION_KEY ) as $queued ) { 230 if ( isset( $queued['code'] ) && $queued['code'] === $code ) { 231 return; 232 } 233 } 234 add_settings_error( CHATCOBALT_OPTION_KEY, $code, $message, $type ); 235 } 236 221 237 function chatcobalt_sanitize_settings( $input ) { 222 238 $existing = chatcobalt_get_settings(); … … 293 309 // the customer typed is kept and the widget still loads -- a failed 294 310 // lookup only costs them the automatic brand color. 295 add_settings_error( 296 CHATCOBALT_OPTION_KEY, 311 chatcobalt_settings_notice_once( 297 312 'chatcobalt_lookup_failed', 298 313 sprintf( … … 316 331 if ( '' === $output['accent_color'] && chatcobalt_is_hex_color( $brand ) ) { 317 332 $output['accent_color'] = $brand; 318 add_settings_error( 319 CHATCOBALT_OPTION_KEY, 333 chatcobalt_settings_notice_once( 320 334 'chatcobalt_connected', 321 335 sprintf( … … 330 344 } 331 345 332 add_settings_error( 333 CHATCOBALT_OPTION_KEY, 346 chatcobalt_settings_notice_once( 334 347 'chatcobalt_connected', 335 348 sprintf( -
chat-cobalt/trunk/readme.txt
r3713711 r3740440 5 5 Tested up to: 7.1 6 6 Requires PHP: 7.2 7 Stable tag: 1.4. 07 Stable tag: 1.4.1 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 78 78 If you turn on "Order updates on WhatsApp" (shown only when WooCommerce is installed), two things happen. When you save the setting, your site registers itself with `https://www.chatcobalt.com/api/wp/orders-connect`, sending your Business ID, your site address and a secret this plugin generates, so that only Chat Cobalt can ask your shop about orders. Then, when a customer messages your WhatsApp number about an order, Chat Cobalt sends one signed request to your site (`/wp-json/chat-cobalt/v1/orders`) carrying the phone number they are messaging from, and your shop answers with the status, date, total, items and tracking number of at most three of that customer's own orders -- never an address, email or payment detail. The answer is used for that one reply and is not stored. This is off by default, and turning it off removes the secret at both ends. 79 79 80 If you use the **Connect** button on the settings screen, your site opens a Chat Cobalt page carrying your site address, your site's name, and a one-time code (only a scrambled form of the code is in the link). After you approve the connection there, your site collects the Site Key directly from `https://www.chatcobalt.com/api/wp/claim-site-key`. No password or personal data is exchanged, and nothing is sent unless you press Connect. 81 80 82 Once a Business ID is saved, the settings screen also shows a "Try your chatbot" box. Typing a question there and clicking Ask sends your Business ID and whatever you typed to `https://www.chatcobalt.com/api/preview-chat`, purely so the reply can be shown to you on that same screen -- it is never saved as a lead or a conversation, and nothing is sent unless you click Ask yourself. 81 83 82 84 == Changelog == 85 86 = 1.4.1 = 87 * New: a **Connect** button on the settings screen. Press it, say yes on the Chat Cobalt screen, and your Business ID and Site Key are filled in for you -- no more copying a key between two websites. 88 * Connecting also picks sensible content to sync (pages and posts) and runs the first sync straight away, so the chat can answer with your pages immediately. 89 * Fix: the first time you saved your Business ID, the "Connected" message showed twice. 83 90 84 91 = 1.4.0 = -
chat-cobalt/trunk/uninstall.php
r3713711 r3740440 14 14 delete_option( 'chatcobalt_settings' ); 15 15 delete_option( 'chatcobalt_orders_secret' ); 16 delete_option( 'chatcobalt_pairing' ); 16 17 delete_option( 'chatcobalt_orders_status' ); 17 18 delete_option( 'chatcobalt_last_sync' );
Note:
See TracChangeset
for help on using the changeset viewer.