From 285aaa9b44baf522a68307943d8eb75052ff6dd0 Mon Sep 17 00:00:00 2001 From: Moon Date: Wed, 6 Jan 2021 22:39:04 -0800 Subject: [PATCH] Add new note for the first product and payment setup insight (https://github.com/woocommerce/woocommerce-admin/pull/6015) * Add new note for the first product and payment setup insight * Remove note from FeaturePlugin -- it is unncessary --- plugins/woocommerce-admin/src/Events.php | 2 + .../woocommerce-admin/src/FeaturePlugin.php | 1 + .../Notes/InsightFirstProductAndPayment.php | 57 +++++++++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 plugins/woocommerce-admin/src/Notes/InsightFirstProductAndPayment.php diff --git a/plugins/woocommerce-admin/src/Events.php b/plugins/woocommerce-admin/src/Events.php index fa8d3b4af61..9d1d70e4916 100644 --- a/plugins/woocommerce-admin/src/Events.php +++ b/plugins/woocommerce-admin/src/Events.php @@ -10,6 +10,7 @@ defined( 'ABSPATH' ) || exit; use \Automattic\WooCommerce\Admin\Notes\ChooseNiche; use \Automattic\WooCommerce\Admin\Notes\GivingFeedbackNotes; +use \Automattic\WooCommerce\Admin\Notes\InsightFirstProductAndPayment; use \Automattic\WooCommerce\Admin\Notes\MobileApp; use \Automattic\WooCommerce\Admin\Notes\NewSalesRecord; use \Automattic\WooCommerce\Admin\Notes\TrackingOptIn; @@ -115,6 +116,7 @@ class Events { NavigationFeedback::possibly_add_note(); NavigationFeedbackFollowUp::possibly_add_note(); FilterByProductVariationsInReports::possibly_add_note(); + InsightFirstProductAndPayment::possibly_add_note(); if ( $this->is_remote_inbox_notifications_enabled() ) { DataSourcePoller::read_specs_from_data_sources(); diff --git a/plugins/woocommerce-admin/src/FeaturePlugin.php b/plugins/woocommerce-admin/src/FeaturePlugin.php index 113214de8bb..3b45a0399b1 100644 --- a/plugins/woocommerce-admin/src/FeaturePlugin.php +++ b/plugins/woocommerce-admin/src/FeaturePlugin.php @@ -7,6 +7,7 @@ namespace Automattic\WooCommerce\Admin; defined( 'ABSPATH' ) || exit; +use \Automattic\WooCommerce\Admin\Notes\InsightFirstProductAndPayment; use \Automattic\WooCommerce\Admin\Notes\Notes; use \Automattic\WooCommerce\Admin\Notes\OrderMilestones; use \Automattic\WooCommerce\Admin\Notes\WooSubscriptionsNotes; diff --git a/plugins/woocommerce-admin/src/Notes/InsightFirstProductAndPayment.php b/plugins/woocommerce-admin/src/Notes/InsightFirstProductAndPayment.php new file mode 100644 index 00000000000..f1c4001fb16 --- /dev/null +++ b/plugins/woocommerce-admin/src/Notes/InsightFirstProductAndPayment.php @@ -0,0 +1,57 @@ +set_title( __( 'Insight', 'woocommerce-admin' ) ); + $note->set_content( __( 'More than 80% of new merchants add the first product and have at least one payment method set up during the first week. We\'re here to help your business succeed! Do you find this type of insight useful?', 'woocommerce-admin' ) ); + $note->set_type( Note::E_WC_ADMIN_NOTE_SURVEY ); + $note->set_name( self::NOTE_NAME ); + $note->set_content_data( (object) array() ); + $note->set_source( 'woocommerce-admin' ); + $note->add_action( + 'affirm-insight-first-product-and-payment', + __( 'Yes', 'woocommerce-admin' ), + false, + Note::E_WC_ADMIN_NOTE_ACTIONED, + false, + __( 'Thanks for your feedback', 'woocommerce-admin' ) + ); + + return $note; + } +}