PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / trunk
Yoast SEO – Advanced SEO with real-time guidance and built-in AI vtrunk
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
← All changes | src/ai/generator/user-interface/ai-generator-integration.php +34 -23 27.7 → trunk View file →
@@ -11,9 +11,8 @@
11 11 use Yoast\WP\SEO\AI\Generator\Application\Generator_Endpoints_Repository;
12 12 use Yoast\WP\SEO\AI\HTTP_Request\Infrastructure\API_Client;
13 13 use Yoast\WP\SEO\Conditionals\AI_Conditional;
14 14 use Yoast\WP\SEO\Conditionals\AI_Editor_Conditional;
15 -use Yoast\WP\SEO\Conditionals\New_Premium_Or_Free_AI_Conditional;
16 15 use Yoast\WP\SEO\Helpers\Current_Page_Helper;
17 16 use Yoast\WP\SEO\Helpers\Options_Helper;
18 17 use Yoast\WP\SEO\Helpers\User_Helper;
19 18 use Yoast\WP\SEO\Integrations\Integration_Interface;
@@ -18,8 +17,9 @@
18 17 use Yoast\WP\SEO\Helpers\User_Helper;
19 18 use Yoast\WP\SEO\Integrations\Integration_Interface;
20 19 use Yoast\WP\SEO\Introductions\Application\Ai_Fix_Assessments_Upsell;
21 20 use Yoast\WP\SEO\Introductions\Infrastructure\Introductions_Seen_Repository;
21 +use Yoast\WP\SEO\MyYoast_Client\User_Interface\Myyoast_Connection_Data_Presenter;
22 22
23 23 /**
24 24 * Ai_Generator_Integration class.
25 25 */
@@ -95,29 +95,37 @@
95 95 */
96 96 private $free_sparks_endpoints_repository;
97 97
98 98 /**
99 + * Builds the MyYoast connection payload for script data.
100 + *
101 + * @var Myyoast_Connection_Data_Presenter
102 + */
103 + private $myyoast_connection_data_presenter;
104 +
105 + /**
99 106 * Returns the conditionals based in which this loadable should be active.
100 107 *
101 108 * @return array<string>
102 109 */
103 110 public static function get_conditionals() {
104 - return [ AI_Conditional::class, AI_Editor_Conditional::class, New_Premium_Or_Free_AI_Conditional::class ];
111 + return [ AI_Conditional::class, AI_Editor_Conditional::class ];
105 112 }
106 113
107 114 /**
108 115 * Constructs the class.
109 116 *
110 - * @param WPSEO_Admin_Asset_Manager $asset_manager The admin asset manager.
111 - * @param WPSEO_Addon_Manager $addon_manager The addon manager.
112 - * @param API_Client $api_client The API client.
113 - * @param Current_Page_Helper $current_page_helper The current page helper.
114 - * @param Options_Helper $options_helper The options helper.
115 - * @param User_Helper $user_helper The user helper.
116 - * @param Introductions_Seen_Repository $introductions_seen_repository The introductions seen repository.
117 - * @param Generator_Endpoints_Repository $generator_endpoints_repository The Generator endpoints repository.
118 - * @param Consent_Endpoints_Repository $consent_endpoints_repository The Consent endpoints repository.
119 - * @param Free_Sparks_Endpoints_Repository $free_sparks_endpoints_repository The Free Sparks endpoints repository.
117 + * @param WPSEO_Admin_Asset_Manager $asset_manager The admin asset manager.
118 + * @param WPSEO_Addon_Manager $addon_manager The addon manager.
119 + * @param API_Client $api_client The API client.
120 + * @param Current_Page_Helper $current_page_helper The current page helper.
121 + * @param Options_Helper $options_helper The options helper.
122 + * @param User_Helper $user_helper The user helper.
123 + * @param Introductions_Seen_Repository $introductions_seen_repository The introductions seen repository.
124 + * @param Generator_Endpoints_Repository $generator_endpoints_repository The Generator endpoints repository.
125 + * @param Consent_Endpoints_Repository $consent_endpoints_repository The Consent endpoints repository.
126 + * @param Free_Sparks_Endpoints_Repository $free_sparks_endpoints_repository The Free Sparks endpoints repository.
127 + * @param Myyoast_Connection_Data_Presenter $myyoast_connection_data_presenter The MyYoast connection data presenter.
120 128 */
121 129 public function __construct(
122 130 WPSEO_Admin_Asset_Manager $asset_manager,
123 131 WPSEO_Addon_Manager $addon_manager,
@@ -127,20 +135,22 @@
127 135 User_Helper $user_helper,
128 136 Introductions_Seen_Repository $introductions_seen_repository,
129 137 Generator_Endpoints_Repository $generator_endpoints_repository,
130 138 Consent_Endpoints_Repository $consent_endpoints_repository,
131 - Free_Sparks_Endpoints_Repository $free_sparks_endpoints_repository
139 + Free_Sparks_Endpoints_Repository $free_sparks_endpoints_repository,
140 + Myyoast_Connection_Data_Presenter $myyoast_connection_data_presenter
132 141 ) {
133 - $this->asset_manager = $asset_manager;
134 - $this->addon_manager = $addon_manager;
135 - $this->api_client = $api_client;
136 - $this->current_page_helper = $current_page_helper;
137 - $this->options_helper = $options_helper;
138 - $this->user_helper = $user_helper;
139 - $this->introductions_seen_repository = $introductions_seen_repository;
140 - $this->generator_endpoints_repository = $generator_endpoints_repository;
141 - $this->consent_endpoints_repository = $consent_endpoints_repository;
142 - $this->free_sparks_endpoints_repository = $free_sparks_endpoints_repository;
142 + $this->asset_manager = $asset_manager;
143 + $this->addon_manager = $addon_manager;
144 + $this->api_client = $api_client;
145 + $this->current_page_helper = $current_page_helper;
146 + $this->options_helper = $options_helper;
147 + $this->user_helper = $user_helper;
148 + $this->introductions_seen_repository = $introductions_seen_repository;
149 + $this->generator_endpoints_repository = $generator_endpoints_repository;
150 + $this->consent_endpoints_repository = $consent_endpoints_repository;
151 + $this->free_sparks_endpoints_repository = $free_sparks_endpoints_repository;
152 + $this->myyoast_connection_data_presenter = $myyoast_connection_data_presenter;
143 153 }
144 154
145 155 /**
146 156 * Initializes the integration.
@@ -187,8 +197,9 @@
187 197 'hasSeenIntroduction' => $this->introductions_seen_repository->is_introduction_seen( $user_id, AI_Fix_Assessments_Upsell::ID ),
188 198 'requestTimeout' => $this->api_client->get_request_timeout(),
189 199 'isFreeSparks' => $this->options_helper->get( 'ai_free_sparks_started_on', null ) !== null,
190 200 'endpoints' => $endpoints,
201 + 'myyoastConnection' => $this->myyoast_connection_data_presenter->present(),
191 202 ];
192 203 }
193 204
194 205 /**