2020-09-08 22:35:59 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* WooCommerce Admin Performance on mobile note.
|
|
|
|
*
|
|
|
|
* Adds a note to download the mobile app, performance on mobile.
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Automattic\WooCommerce\Admin\Notes;
|
|
|
|
|
|
|
|
defined( 'ABSPATH' ) || exit;
|
|
|
|
|
|
|
|
/**
|
2020-09-28 04:35:10 +00:00
|
|
|
* Performance_On_Mobile
|
2020-09-08 22:35:59 +00:00
|
|
|
*/
|
2020-10-28 17:12:14 +00:00
|
|
|
class PerformanceOnMobile {
|
2020-09-08 22:35:59 +00:00
|
|
|
/**
|
|
|
|
* Note traits.
|
|
|
|
*/
|
|
|
|
use NoteTraits;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Name of the note for use in the database.
|
|
|
|
*/
|
|
|
|
const NOTE_NAME = 'wc-admin-performance-on-mobile';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the note.
|
2020-09-28 04:35:10 +00:00
|
|
|
*
|
|
|
|
* @return Note
|
2020-09-08 22:35:59 +00:00
|
|
|
*/
|
|
|
|
public static function get_note() {
|
|
|
|
// Only add this note if this store is at least 9 months old.
|
|
|
|
$nine_months_in_seconds = MONTH_IN_SECONDS * 9;
|
|
|
|
if ( ! self::wc_admin_active_for( $nine_months_in_seconds ) ) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check that the previous mobile app notes have not been actioned.
|
2020-11-16 21:39:36 +00:00
|
|
|
if ( MobileApp::has_note_been_actioned() ) {
|
2020-09-08 22:35:59 +00:00
|
|
|
return;
|
|
|
|
}
|
2020-11-16 21:39:36 +00:00
|
|
|
if ( RealTimeOrderAlerts::has_note_been_actioned() ) {
|
2020-09-08 22:35:59 +00:00
|
|
|
return;
|
|
|
|
}
|
2020-11-16 21:39:36 +00:00
|
|
|
if ( ManageOrdersOnTheGo::has_note_been_actioned() ) {
|
2020-10-13 04:35:53 +00:00
|
|
|
return;
|
|
|
|
}
|
2020-09-08 22:35:59 +00:00
|
|
|
|
2020-09-28 04:35:10 +00:00
|
|
|
$note = new Note();
|
2020-09-08 22:35:59 +00:00
|
|
|
|
|
|
|
$note->set_title( __( 'Track your store performance on mobile', 'woocommerce-admin' ) );
|
|
|
|
$note->set_content( __( 'Monitor your sales and high performing products with the Woo app.', 'woocommerce-admin' ) );
|
|
|
|
$note->set_content_data( (object) array() );
|
2020-09-28 04:35:10 +00:00
|
|
|
$note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
|
2020-09-08 22:35:59 +00:00
|
|
|
$note->set_name( self::NOTE_NAME );
|
|
|
|
$note->set_source( 'woocommerce-admin' );
|
|
|
|
$note->add_action(
|
|
|
|
'learn-more',
|
|
|
|
__( 'Learn more', 'woocommerce-admin' ),
|
2021-08-03 20:56:43 +00:00
|
|
|
'https://woocommerce.com/mobile/?utm_source=inbox&utm_medium=product'
|
2020-09-08 22:35:59 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
return $note;
|
|
|
|
}
|
|
|
|
}
|