Changeset 3777888
- Timestamp:
- 11/01/2026 10:58:56 AM (6 hours ago)
- Location:
- eaforyou-ai-sales-chat
- Files:
-
- 3 edited
- 6 copied
-
tags/1.1.6 (copied) (copied from eaforyou-ai-sales-chat/trunk )
-
tags/1.1.6/easyagent.php (copied) (copied from eaforyou-ai-sales-chat/trunk/easyagent.php ) (2 diffs)
-
tags/1.1.6/includes/class-easyagent-admin.php (copied) (copied from eaforyou-ai-sales-chat/trunk/includes/class-easyagent-admin.php ) (5 diffs)
-
tags/1.1.6/includes/class-easyagent-api.php (copied) (copied from eaforyou-ai-sales-chat/trunk/includes/class-easyagent-api.php )
-
tags/1.1.6/languages/eaforyou-ai-sales-chat.pot (copied) (copied from eaforyou-ai-sales-chat/trunk/languages/eaforyou-ai-sales-chat.pot )
-
tags/1.1.6/readme.txt (copied) (copied from eaforyou-ai-sales-chat/trunk/readme.txt ) (3 diffs)
-
trunk/easyagent.php (modified) (2 diffs)
-
trunk/includes/class-easyagent-admin.php (modified) (5 diffs)
-
trunk/readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
eaforyou-ai-sales-chat/tags/1.1.6/easyagent.php
r3775250 r3777888 4 4 * Description: An AI assistant trained on your site that answers visitors, captures leads and shows what it earned you, right inside wp-admin. Connect in one click, no API keys. 5 5 * Plugin URI: https://www.easyagentforyou.com/integrations/wordpress 6 * Version: 1.1. 56 * Version: 1.1.6 7 7 * Requires at least: 6.4 8 8 * Requires PHP: 7.4 … … 21 21 defined( 'ABSPATH' ) || exit; 22 22 23 define( 'EASYAGENT_VERSION', '1.1. 5' );23 define( 'EASYAGENT_VERSION', '1.1.6' ); 24 24 define( 'EASYAGENT_FILE', __FILE__ ); 25 25 define( 'EASYAGENT_DIR', plugin_dir_path( __FILE__ ) ); -
eaforyou-ai-sales-chat/tags/1.1.6/includes/class-easyagent-admin.php
r3775250 r3777888 35 35 add_action( 'admin_post_easyagent_sso', array( $this, 'handle_sso' ) ); 36 36 add_action( 'admin_post_easyagent_customize', array( $this, 'handle_customize' ) ); 37 add_action( 'admin_post_easyagent_setup', array( $this, 'handle_setup' ) ); 37 38 add_action( 'admin_post_easyagent_refresh', array( $this, 'handle_refresh' ) ); 38 39 add_action( 'admin_post_easyagent_woo_connect', array( $this, 'handle_woo_connect' ) ); … … 252 253 253 254 /** 255 * "Finish setup in your dashboard": this site's page on the EAForYou 256 * dashboard, where the setup checklist (train on your pages, add files) is. 257 * 258 * @return void 259 */ 260 public function handle_setup() { 261 $this->authorize( 'easyagent_setup' ); 262 $store_id = (string) EasyAgent_Options::embed()['store_id']; 263 $this->open_dashboard( ctype_digit( $store_id ) ? '/dashboard/stores/' . $store_id : '/dashboard/stores' ); 264 } 265 266 /** 254 267 * Sign in to the dashboard and land on $next. 255 268 * … … 259 272 private function open_dashboard( $next ) { 260 273 $result = EasyAgent_API::sso( $next ); 261 if ( ! $result['ok'] && isset( $result['code'] ) && 'sso_disabled' === $result['code'] ) { 262 // Signing in from WordPress was not allowed when this site was connected: 263 // send the admin to the normal EasyAgent sign-in page instead. The 264 // sign-in page decodes `next` once more after the query string is read. 274 if ( ! $result['ok'] && isset( $result['code'] ) && in_array( $result['code'], array( 'sso_disabled', 'sso_not_allowed' ), true ) ) { 275 // Signing in from WordPress was not allowed when this site was connected 276 // (or is never allowed for this account, such as a staff account): send 277 // the admin to the normal EAForYou sign-in page instead, which goes 278 // straight on to $next when they are already signed in. The sign-in 279 // page decodes `next` once more after the query string is read. 265 280 $signin = EasyAgent_API::dashboard_url() . '/signin'; 266 281 if ( '' !== $next ) { … … 458 473 $settings = EasyAgent_Options::settings(); 459 474 $summary = EasyAgent_API::summary(); 460 if ( 'verifying' === $this->woo_state( $summary ) ) { 461 // The 10 minute cache must not hide the end of a connect that is in progress. 475 if ( 'verifying' === $this->woo_state( $summary ) || $this->setup_in_progress( $summary ) ) { 476 // The 10 minute cache must not hide the end of a connect, or of the 477 // first read of the site, that is in progress. 462 478 $summary = EasyAgent_API::summary( true ); 463 479 } … … 505 521 </div> 506 522 <?php 523 $this->render_next_steps( $summary ); 507 524 $this->render_woocommerce( $summary ); 508 525 $this->render_results( $summary ); 526 } 527 528 /** 529 * Whether EAForYou is still reading this site to set the chat up. 530 * 531 * @param array $summary Result of EasyAgent_API::summary(). 532 * @return bool 533 */ 534 private function setup_in_progress( array $summary ) { 535 $status = ( ! empty( $summary['ok'] ) && isset( $summary['data']['setup']['status'] ) ) ? $summary['data']['setup']['status'] : ''; 536 return in_array( $status, array( 'reading', 'not_started' ), true ); 537 } 538 539 /** 540 * "Finish setting up": what EAForYou set up from this site, and the few 541 * steps left (teach it the site's pages, add files, test it). 542 * 543 * @param array $summary Result of EasyAgent_API::summary(). 544 * @return void 545 */ 546 private function render_next_steps( array $summary ) { 547 $setup = ( ! empty( $summary['ok'] ) && isset( $summary['data']['setup'] ) && is_array( $summary['data']['setup'] ) ) ? $summary['data']['setup'] : null; 548 if ( null === $setup ) { 549 return; 550 } 551 $status = isset( $setup['status'] ) && is_string( $setup['status'] ) ? $setup['status'] : ''; 552 $label = isset( $setup['business_label'] ) && is_string( $setup['business_label'] ) ? sanitize_text_field( $setup['business_label'] ) : ''; 553 $pages = $this->int_value( $setup, 'page_count' ); 554 $trained = $this->int_value( $setup, 'trained_count' ); 555 $items = array(); 556 if ( 'ready' === $status && ! empty( $setup['questions_set'] ) && '' !== $label ) { 557 /* translators: %s: kind of business, for example "Services business". */ 558 $items[] = sprintf( __( 'Done: we read your site and set the chat\'s greeting and suggested questions for a %s.', 'eaforyou-ai-sales-chat' ), strtolower( $label ) ); 559 } elseif ( 'failed' === $status ) { 560 $items[] = __( 'We could not read your site, so the chat uses the standard questions. You can change them with Customize the chat.', 'eaforyou-ai-sales-chat' ); 561 } elseif ( 'ready' !== $status ) { 562 $items[] = __( 'We are reading your site to set up the chat\'s questions and colours. Check back in a minute.', 'eaforyou-ai-sales-chat' ); 563 } 564 if ( $pages > 0 && $trained >= $pages ) { 565 /* translators: %d: number of pages. */ 566 $items[] = sprintf( _n( 'Done: the chat has learned %d page of your site.', 'Done: the chat has learned %d pages of your site.', $trained, 'eaforyou-ai-sales-chat' ), $trained ); 567 } elseif ( $pages > 0 ) { 568 /* translators: %d: number of pages found on the site. */ 569 $items[] = sprintf( _n( 'Teach it your site: we found %d page. Training it uses a few credits.', 'Teach it your site: we found %d pages. Training them uses a few credits.', $pages, 'eaforyou-ai-sales-chat' ), $pages ); 570 } else { 571 $items[] = __( 'Teach it your site, so it can answer from your pages.', 'eaforyou-ai-sales-chat' ); 572 } 573 $items[] = __( 'Add files with your prices, FAQs or policies.', 'eaforyou-ai-sales-chat' ); 574 $items[] = __( 'Test it: open your site and ask the chat a question.', 'eaforyou-ai-sales-chat' ); 575 ?> 576 <div class="easyagent-card"> 577 <h2><?php esc_html_e( 'Finish setting up', 'eaforyou-ai-sales-chat' ); ?></h2> 578 <ul class="easyagent-list"> 579 <?php foreach ( $items as $item ) : ?> 580 <li><?php echo esc_html( $item ); ?></li> 581 <?php endforeach; ?> 582 </ul> 583 <div class="easyagent-actions"> 584 <?php $this->action_form( 'easyagent_setup', __( 'Finish setup in your dashboard', 'eaforyou-ai-sales-chat' ), 'button button-primary', true ); ?> 585 <a class="button" href="<?php echo esc_url( home_url( '/' ) ); ?>" target="_blank" rel="noopener noreferrer"><?php esc_html_e( 'Open your site', 'eaforyou-ai-sales-chat' ); ?></a> 586 </div> 587 </div> 588 <?php 509 589 } 510 590 -
eaforyou-ai-sales-chat/tags/1.1.6/readme.txt
r3775250 r3777888 5 5 Tested up to: 7.1 6 6 Requires PHP: 7.4 7 Stable tag: 1.1. 57 Stable tag: 1.1.6 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 147 147 == Changelog == 148 148 149 = 1.1.6 = 150 * New: when you connect, EAForYou reads your site and sets the chat's greeting, suggested questions and colour for your kind of business. Anything you have already changed is kept. 151 * New: a *Finish setting up* box with the steps left: teach the chat your pages, add files with your prices or FAQs, and test it. 152 * Fixed: *Open full dashboard* and *Customize the chat* now open the EAForYou sign-in page when one-click sign-in is not available for your account, instead of staying on this page. 153 149 154 = 1.1.5 = 150 155 * New: a *Customize the chat* button that opens this site's chat settings (colours, button, greeting) in your EAForYou dashboard. … … 176 181 == Upgrade Notice == 177 182 183 = 1.1.6 = 184 Sets the chat up for your kind of business and adds a Finish setting up box. Your settings are kept. 185 178 186 = 1.1.5 = 179 187 Adds a Customize the chat button. Nothing else changes. -
eaforyou-ai-sales-chat/trunk/easyagent.php
r3775250 r3777888 4 4 * Description: An AI assistant trained on your site that answers visitors, captures leads and shows what it earned you, right inside wp-admin. Connect in one click, no API keys. 5 5 * Plugin URI: https://www.easyagentforyou.com/integrations/wordpress 6 * Version: 1.1. 56 * Version: 1.1.6 7 7 * Requires at least: 6.4 8 8 * Requires PHP: 7.4 … … 21 21 defined( 'ABSPATH' ) || exit; 22 22 23 define( 'EASYAGENT_VERSION', '1.1. 5' );23 define( 'EASYAGENT_VERSION', '1.1.6' ); 24 24 define( 'EASYAGENT_FILE', __FILE__ ); 25 25 define( 'EASYAGENT_DIR', plugin_dir_path( __FILE__ ) ); -
eaforyou-ai-sales-chat/trunk/includes/class-easyagent-admin.php
r3775250 r3777888 35 35 add_action( 'admin_post_easyagent_sso', array( $this, 'handle_sso' ) ); 36 36 add_action( 'admin_post_easyagent_customize', array( $this, 'handle_customize' ) ); 37 add_action( 'admin_post_easyagent_setup', array( $this, 'handle_setup' ) ); 37 38 add_action( 'admin_post_easyagent_refresh', array( $this, 'handle_refresh' ) ); 38 39 add_action( 'admin_post_easyagent_woo_connect', array( $this, 'handle_woo_connect' ) ); … … 252 253 253 254 /** 255 * "Finish setup in your dashboard": this site's page on the EAForYou 256 * dashboard, where the setup checklist (train on your pages, add files) is. 257 * 258 * @return void 259 */ 260 public function handle_setup() { 261 $this->authorize( 'easyagent_setup' ); 262 $store_id = (string) EasyAgent_Options::embed()['store_id']; 263 $this->open_dashboard( ctype_digit( $store_id ) ? '/dashboard/stores/' . $store_id : '/dashboard/stores' ); 264 } 265 266 /** 254 267 * Sign in to the dashboard and land on $next. 255 268 * … … 259 272 private function open_dashboard( $next ) { 260 273 $result = EasyAgent_API::sso( $next ); 261 if ( ! $result['ok'] && isset( $result['code'] ) && 'sso_disabled' === $result['code'] ) { 262 // Signing in from WordPress was not allowed when this site was connected: 263 // send the admin to the normal EasyAgent sign-in page instead. The 264 // sign-in page decodes `next` once more after the query string is read. 274 if ( ! $result['ok'] && isset( $result['code'] ) && in_array( $result['code'], array( 'sso_disabled', 'sso_not_allowed' ), true ) ) { 275 // Signing in from WordPress was not allowed when this site was connected 276 // (or is never allowed for this account, such as a staff account): send 277 // the admin to the normal EAForYou sign-in page instead, which goes 278 // straight on to $next when they are already signed in. The sign-in 279 // page decodes `next` once more after the query string is read. 265 280 $signin = EasyAgent_API::dashboard_url() . '/signin'; 266 281 if ( '' !== $next ) { … … 458 473 $settings = EasyAgent_Options::settings(); 459 474 $summary = EasyAgent_API::summary(); 460 if ( 'verifying' === $this->woo_state( $summary ) ) { 461 // The 10 minute cache must not hide the end of a connect that is in progress. 475 if ( 'verifying' === $this->woo_state( $summary ) || $this->setup_in_progress( $summary ) ) { 476 // The 10 minute cache must not hide the end of a connect, or of the 477 // first read of the site, that is in progress. 462 478 $summary = EasyAgent_API::summary( true ); 463 479 } … … 505 521 </div> 506 522 <?php 523 $this->render_next_steps( $summary ); 507 524 $this->render_woocommerce( $summary ); 508 525 $this->render_results( $summary ); 526 } 527 528 /** 529 * Whether EAForYou is still reading this site to set the chat up. 530 * 531 * @param array $summary Result of EasyAgent_API::summary(). 532 * @return bool 533 */ 534 private function setup_in_progress( array $summary ) { 535 $status = ( ! empty( $summary['ok'] ) && isset( $summary['data']['setup']['status'] ) ) ? $summary['data']['setup']['status'] : ''; 536 return in_array( $status, array( 'reading', 'not_started' ), true ); 537 } 538 539 /** 540 * "Finish setting up": what EAForYou set up from this site, and the few 541 * steps left (teach it the site's pages, add files, test it). 542 * 543 * @param array $summary Result of EasyAgent_API::summary(). 544 * @return void 545 */ 546 private function render_next_steps( array $summary ) { 547 $setup = ( ! empty( $summary['ok'] ) && isset( $summary['data']['setup'] ) && is_array( $summary['data']['setup'] ) ) ? $summary['data']['setup'] : null; 548 if ( null === $setup ) { 549 return; 550 } 551 $status = isset( $setup['status'] ) && is_string( $setup['status'] ) ? $setup['status'] : ''; 552 $label = isset( $setup['business_label'] ) && is_string( $setup['business_label'] ) ? sanitize_text_field( $setup['business_label'] ) : ''; 553 $pages = $this->int_value( $setup, 'page_count' ); 554 $trained = $this->int_value( $setup, 'trained_count' ); 555 $items = array(); 556 if ( 'ready' === $status && ! empty( $setup['questions_set'] ) && '' !== $label ) { 557 /* translators: %s: kind of business, for example "Services business". */ 558 $items[] = sprintf( __( 'Done: we read your site and set the chat\'s greeting and suggested questions for a %s.', 'eaforyou-ai-sales-chat' ), strtolower( $label ) ); 559 } elseif ( 'failed' === $status ) { 560 $items[] = __( 'We could not read your site, so the chat uses the standard questions. You can change them with Customize the chat.', 'eaforyou-ai-sales-chat' ); 561 } elseif ( 'ready' !== $status ) { 562 $items[] = __( 'We are reading your site to set up the chat\'s questions and colours. Check back in a minute.', 'eaforyou-ai-sales-chat' ); 563 } 564 if ( $pages > 0 && $trained >= $pages ) { 565 /* translators: %d: number of pages. */ 566 $items[] = sprintf( _n( 'Done: the chat has learned %d page of your site.', 'Done: the chat has learned %d pages of your site.', $trained, 'eaforyou-ai-sales-chat' ), $trained ); 567 } elseif ( $pages > 0 ) { 568 /* translators: %d: number of pages found on the site. */ 569 $items[] = sprintf( _n( 'Teach it your site: we found %d page. Training it uses a few credits.', 'Teach it your site: we found %d pages. Training them uses a few credits.', $pages, 'eaforyou-ai-sales-chat' ), $pages ); 570 } else { 571 $items[] = __( 'Teach it your site, so it can answer from your pages.', 'eaforyou-ai-sales-chat' ); 572 } 573 $items[] = __( 'Add files with your prices, FAQs or policies.', 'eaforyou-ai-sales-chat' ); 574 $items[] = __( 'Test it: open your site and ask the chat a question.', 'eaforyou-ai-sales-chat' ); 575 ?> 576 <div class="easyagent-card"> 577 <h2><?php esc_html_e( 'Finish setting up', 'eaforyou-ai-sales-chat' ); ?></h2> 578 <ul class="easyagent-list"> 579 <?php foreach ( $items as $item ) : ?> 580 <li><?php echo esc_html( $item ); ?></li> 581 <?php endforeach; ?> 582 </ul> 583 <div class="easyagent-actions"> 584 <?php $this->action_form( 'easyagent_setup', __( 'Finish setup in your dashboard', 'eaforyou-ai-sales-chat' ), 'button button-primary', true ); ?> 585 <a class="button" href="<?php echo esc_url( home_url( '/' ) ); ?>" target="_blank" rel="noopener noreferrer"><?php esc_html_e( 'Open your site', 'eaforyou-ai-sales-chat' ); ?></a> 586 </div> 587 </div> 588 <?php 509 589 } 510 590 -
eaforyou-ai-sales-chat/trunk/readme.txt
r3775250 r3777888 5 5 Tested up to: 7.1 6 6 Requires PHP: 7.4 7 Stable tag: 1.1. 57 Stable tag: 1.1.6 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 147 147 == Changelog == 148 148 149 = 1.1.6 = 150 * New: when you connect, EAForYou reads your site and sets the chat's greeting, suggested questions and colour for your kind of business. Anything you have already changed is kept. 151 * New: a *Finish setting up* box with the steps left: teach the chat your pages, add files with your prices or FAQs, and test it. 152 * Fixed: *Open full dashboard* and *Customize the chat* now open the EAForYou sign-in page when one-click sign-in is not available for your account, instead of staying on this page. 153 149 154 = 1.1.5 = 150 155 * New: a *Customize the chat* button that opens this site's chat settings (colours, button, greeting) in your EAForYou dashboard. … … 176 181 == Upgrade Notice == 177 182 183 = 1.1.6 = 184 Sets the chat up for your kind of business and adds a Finish setting up box. Your settings are kept. 185 178 186 = 1.1.5 = 179 187 Adds a Customize the chat button. Nothing else changes.
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)