woocommerce/plugins/woocommerce-admin/src-internal/Admin/Notes/InsightFirstProductAndPayme...

70 lines
1.7 KiB
PHP
Raw Normal View History

<?php
/**
* WooCommerce Admin: Insight - First product and payment setup
*
* Adds a note to give insight about the first product and payment setup
*
* @package WooCommerce\Admin
*/
Make individual note classes internal (https://github.com/woocommerce/woocommerce-admin/pull/8398) * Moved `WooSubscriptionsNotes` * Moved `WooSubscriptionsNotes` deprecated * Moved `WooCommerceSubscriptions` * Moved `WooCommercePayments` * Fix `WooCommerceSubscriptions` * Fix `WooSubscriptionsNotes * Fix `WooCommercePayments` * Moved `WelcomeToWooCommerceForStoreUsers * Add use `Note` * Moved `UpdateStoreDetails` * Moved `UnsecuredReportFiles` * Moved `TrackingOptIn` * Moved `TestCheckout` * Moved `SetUpAdditionalPaymentTypes` * Moved `SellingOnlineCourses` * Moved `RealTimeOrderAlerts` * Moved `PersonalizeStore` * Moved `PerformanceOnMobile` * Moved `PaymentsRemindMeLater` * Moved `OrderMilestones` * Moved `OnlineClothingStore` * Moved `OnboardingPayments * Moved `NewSalesRecord` * Moved `NavigationNudge` * Moved `NavigationNudge` * Moved `MobileApp` * Moved `MigrateFromShopify` * Moved `MarketingJetpack` * Moved `ManageStoreActivityFromHomeScreen` * Moved `ManageOrdersOnTheGo` * Moved `MagentoMigration` * Moved `LaunchChecklist` * Moved `InstallJPAndWCSPlugins` * Moved `InsightFirstSale` * Moved `InsightFirstProductAndPayment` * Moved `GivingFeedbackNotes` * Moved `FirstProduct` * Moved `FirstDownlaodableProduct` * Moved `EUVATNumber` * Moved `EditProductsOnTheMove` * Moved `DeactivatePlugin` * Moved `CustomizingProductCatalog` * Moved `CustomizeStoreWithBlocks` * Moved `CouponPageMoved` * Moved `CompleteStoreDetails` * Moved `ChoosingTheme` * Moved `AddingAndManangingProducts` * Moved `AddFirstProduct` * Removed `OnboardingTraits` trait * Moved `EmailNotification` * Fixed notes * Add changelog * Fix lint error Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
2022-03-08 13:55:27 +00:00
namespace Automattic\WooCommerce\Internal\Admin\Notes;
defined( 'ABSPATH' ) || exit;
Make individual note classes internal (https://github.com/woocommerce/woocommerce-admin/pull/8398) * Moved `WooSubscriptionsNotes` * Moved `WooSubscriptionsNotes` deprecated * Moved `WooCommerceSubscriptions` * Moved `WooCommercePayments` * Fix `WooCommerceSubscriptions` * Fix `WooSubscriptionsNotes * Fix `WooCommercePayments` * Moved `WelcomeToWooCommerceForStoreUsers * Add use `Note` * Moved `UpdateStoreDetails` * Moved `UnsecuredReportFiles` * Moved `TrackingOptIn` * Moved `TestCheckout` * Moved `SetUpAdditionalPaymentTypes` * Moved `SellingOnlineCourses` * Moved `RealTimeOrderAlerts` * Moved `PersonalizeStore` * Moved `PerformanceOnMobile` * Moved `PaymentsRemindMeLater` * Moved `OrderMilestones` * Moved `OnlineClothingStore` * Moved `OnboardingPayments * Moved `NewSalesRecord` * Moved `NavigationNudge` * Moved `NavigationNudge` * Moved `MobileApp` * Moved `MigrateFromShopify` * Moved `MarketingJetpack` * Moved `ManageStoreActivityFromHomeScreen` * Moved `ManageOrdersOnTheGo` * Moved `MagentoMigration` * Moved `LaunchChecklist` * Moved `InstallJPAndWCSPlugins` * Moved `InsightFirstSale` * Moved `InsightFirstProductAndPayment` * Moved `GivingFeedbackNotes` * Moved `FirstProduct` * Moved `FirstDownlaodableProduct` * Moved `EUVATNumber` * Moved `EditProductsOnTheMove` * Moved `DeactivatePlugin` * Moved `CustomizingProductCatalog` * Moved `CustomizeStoreWithBlocks` * Moved `CouponPageMoved` * Moved `CompleteStoreDetails` * Moved `ChoosingTheme` * Moved `AddingAndManangingProducts` * Moved `AddFirstProduct` * Removed `OnboardingTraits` trait * Moved `EmailNotification` * Fixed notes * Add changelog * Fix lint error Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
2022-03-08 13:55:27 +00:00
use \Automattic\WooCommerce\Admin\Notes\Note;
use \Automattic\WooCommerce\Admin\Notes\NoteTraits;
/**
* Insight_First_Sale.
*/
class InsightFirstProductAndPayment {
/**
* Note traits.
*/
use NoteTraits;
/**
* Name of the note for use in the database.
*/
const NOTE_NAME = 'wc-admin-insight-first-product-and-payment';
/**
* Get the note.
*
* @return Note
*/
public static function get_note() {
// We want to show the note after 1 day.
if ( ! self::is_wc_admin_active_in_date_range( 'week-1', DAY_IN_SECONDS ) ) {
return;
}
$note = new Note();
$note->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.<br><br>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' )
);
$note->add_action(
'affirm-insight-first-product-and-payment',
__( 'No', 'woocommerce-admin' ),
false,
Note::E_WC_ADMIN_NOTE_ACTIONED,
false,
__( 'Thanks for your feedback', 'woocommerce-admin' )
);
return $note;
}
}