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 +33 -21 27.6 → trunk View file →
@@ -17,8 +17,9 @@
17 17 use Yoast\WP\SEO\Helpers\User_Helper;
18 18 use Yoast\WP\SEO\Integrations\Integration_Interface;
19 19 use Yoast\WP\SEO\Introductions\Application\Ai_Fix_Assessments_Upsell;
20 20 use Yoast\WP\SEO\Introductions\Infrastructure\Introductions_Seen_Repository;
21 +use Yoast\WP\SEO\MyYoast_Client\User_Interface\Myyoast_Connection_Data_Presenter;
21 22
22 23 /**
23 24 * Ai_Generator_Integration class.
24 25 */
@@ -94,8 +95,15 @@
94 95 */
95 96 private $free_sparks_endpoints_repository;
96 97
97 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 + /**
98 106 * Returns the conditionals based in which this loadable should be active.
99 107 *
100 108 * @return array<string>
101 109 */
@@ -105,18 +113,19 @@
105 113
106 114 /**
107 115 * Constructs the class.
108 116 *
109 - * @param WPSEO_Admin_Asset_Manager $asset_manager The admin asset manager.
110 - * @param WPSEO_Addon_Manager $addon_manager The addon manager.
111 - * @param API_Client $api_client The API client.
112 - * @param Current_Page_Helper $current_page_helper The current page helper.
113 - * @param Options_Helper $options_helper The options helper.
114 - * @param User_Helper $user_helper The user helper.
115 - * @param Introductions_Seen_Repository $introductions_seen_repository The introductions seen repository.
116 - * @param Generator_Endpoints_Repository $generator_endpoints_repository The Generator endpoints repository.
117 - * @param Consent_Endpoints_Repository $consent_endpoints_repository The Consent endpoints repository.
118 - * @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.
119 128 */
120 129 public function __construct(
121 130 WPSEO_Admin_Asset_Manager $asset_manager,
122 131 WPSEO_Addon_Manager $addon_manager,
@@ -126,20 +135,22 @@
126 135 User_Helper $user_helper,
127 136 Introductions_Seen_Repository $introductions_seen_repository,
128 137 Generator_Endpoints_Repository $generator_endpoints_repository,
129 138 Consent_Endpoints_Repository $consent_endpoints_repository,
130 - 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
131 141 ) {
132 - $this->asset_manager = $asset_manager;
133 - $this->addon_manager = $addon_manager;
134 - $this->api_client = $api_client;
135 - $this->current_page_helper = $current_page_helper;
136 - $this->options_helper = $options_helper;
137 - $this->user_helper = $user_helper;
138 - $this->introductions_seen_repository = $introductions_seen_repository;
139 - $this->generator_endpoints_repository = $generator_endpoints_repository;
140 - $this->consent_endpoints_repository = $consent_endpoints_repository;
141 - $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;
142 153 }
143 154
144 155 /**
145 156 * Initializes the integration.
@@ -186,8 +197,9 @@
186 197 'hasSeenIntroduction' => $this->introductions_seen_repository->is_introduction_seen( $user_id, AI_Fix_Assessments_Upsell::ID ),
187 198 'requestTimeout' => $this->api_client->get_request_timeout(),
188 199 'isFreeSparks' => $this->options_helper->get( 'ai_free_sparks_started_on', null ) !== null,
189 200 'endpoints' => $endpoints,
201 + 'myyoastConnection' => $this->myyoast_connection_data_presenter->present(),
190 202 ];
191 203 }
192 204
193 205 /**