diff --git a/plugins/woocommerce-admin/client/marketing/components/product-icon/icons/index.js b/plugins/woocommerce-admin/client/marketing/components/product-icon/icons/index.js index 847759fd058..d2b856797ff 100644 --- a/plugins/woocommerce-admin/client/marketing/components/product-icon/icons/index.js +++ b/plugins/woocommerce-admin/client/marketing/components/product-icon/icons/index.js @@ -31,6 +31,9 @@ export { default as mailchimpForWoocommerce } from './library/mailchimp'; // MailPoet export { default as mailpoet } from './library/mailpoet'; +// Klaviyo +export { default as klaviyo } from './library/klaviyo'; + // Creative Mail by Constant Contact export { default as creativeMailByConstantContact } from './library/creative-mail'; diff --git a/plugins/woocommerce-admin/client/marketing/components/product-icon/icons/library/klaviyo.js b/plugins/woocommerce-admin/client/marketing/components/product-icon/icons/library/klaviyo.js new file mode 100644 index 00000000000..640434fc5f3 --- /dev/null +++ b/plugins/woocommerce-admin/client/marketing/components/product-icon/icons/library/klaviyo.js @@ -0,0 +1,18 @@ +/** + * External dependencies + */ +import { __ } from '@wordpress/i18n'; + +/** + * Internal dependencies + */ +import { WC_ASSET_URL } from '~/utils/admin-settings'; + +const klaviyo = ( + { +); + +export default klaviyo; diff --git a/plugins/woocommerce/assets/images/marketing/klaviyo.png b/plugins/woocommerce/assets/images/marketing/klaviyo.png new file mode 100644 index 00000000000..781a4196541 Binary files /dev/null and b/plugins/woocommerce/assets/images/marketing/klaviyo.png differ diff --git a/plugins/woocommerce/changelog/add-klaviyo-marketing-extension b/plugins/woocommerce/changelog/add-klaviyo-marketing-extension new file mode 100644 index 00000000000..dbd67ef5bb7 --- /dev/null +++ b/plugins/woocommerce/changelog/add-klaviyo-marketing-extension @@ -0,0 +1,4 @@ +Significance: minor +Type: update + +Update the call to marketing extensions recommendations API from version 1.2 to version 1.3 with new recommendation Klaviyo. diff --git a/plugins/woocommerce/src/Admin/Marketing/InstalledExtensions.php b/plugins/woocommerce/src/Admin/Marketing/InstalledExtensions.php index b1e9ad82b80..9f077130e17 100644 --- a/plugins/woocommerce/src/Admin/Marketing/InstalledExtensions.php +++ b/plugins/woocommerce/src/Admin/Marketing/InstalledExtensions.php @@ -29,6 +29,7 @@ class InstalledExtensions { $google = self::get_google_extension_data(); $amazon_ebay = self::get_amazon_ebay_extension_data(); $mailpoet = self::get_mailpoet_extension_data(); + $klaviyo = self::get_klaviyo_extension_data(); $creative_mail = self::get_creative_mail_extension_data(); $tiktok = self::get_tiktok_extension_data(); $jetpack_crm = self::get_jetpack_crm_extension_data(); @@ -73,6 +74,10 @@ class InstalledExtensions { $data[] = $mailpoet; } + if ( $klaviyo ) { + $data[] = $klaviyo; + } + if ( $creative_mail ) { $data[] = $creative_mail; } @@ -380,6 +385,33 @@ class InstalledExtensions { return $data; } + /** + * Get Klaviyo extension data. + * + * @return array|bool + */ + protected static function get_klaviyo_extension_data() { + $slug = 'klaviyo'; + + if ( ! PluginsHelper::is_plugin_installed( $slug ) ) { + return false; + } + + $data = self::get_extension_base_data( $slug ); + $data['icon'] = plugins_url( 'assets/images/marketing/klaviyo.png', WC_PLUGIN_FILE ); + + if ( 'activated' === $data['status'] ) { + $klaviyo_options = get_option( 'klaviyo_settings' ); + if ( isset( $klaviyo_options['klaviyo_public_api_key'] ) ) { + $data['status'] = 'configured'; + } + + $data['settingsUrl'] = admin_url( 'admin.php?page=klaviyo_settings' ); + } + + return $data; + } + /** * Get Creative Mail for WooCommerce extension data. * diff --git a/plugins/woocommerce/src/Internal/Admin/Marketing/MarketingSpecs.php b/plugins/woocommerce/src/Internal/Admin/Marketing/MarketingSpecs.php index e6ed4e875d9..b80b93a16a4 100644 --- a/plugins/woocommerce/src/Internal/Admin/Marketing/MarketingSpecs.php +++ b/plugins/woocommerce/src/Internal/Admin/Marketing/MarketingSpecs.php @@ -52,7 +52,7 @@ class MarketingSpecs { if ( false === $plugins ) { $request = wp_remote_get( - 'https://woocommerce.com/wp-json/wccom/marketing-tab/1.2/recommendations.json', + 'https://woocommerce.com/wp-json/wccom/marketing-tab/1.3/recommendations.json', array( 'user-agent' => 'WooCommerce/' . WC()->version . '; ' . get_bloginfo( 'url' ), )