Skip to content

Commit 729c7d6

Browse files
refactor: update the black friday labels (#4483)
1 parent c6098b4 commit 729c7d6

1 file changed

Lines changed: 51 additions & 27 deletions

File tree

inc/admin/dashboard/main.php

Lines changed: 51 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function init() {
5656
add_action( 'admin_enqueue_scripts', [ $this, 'enqueue' ] );
5757
add_action( 'init', array( $this, 'register_settings' ) );
5858
add_action( 'init', array( $this, 'register_about_page' ), 1 );
59-
59+
6060
add_action( 'admin_notices', array( $this, 'render_custom_layout_header' ) );
6161
}
6262

@@ -999,7 +999,7 @@ private function get_available_modules() {
999999
*/
10001000
public function render_custom_layout_header() {
10011001
$screen = get_current_screen();
1002-
1002+
10031003
if ( ! $screen || ! ( $screen->id === 'edit-neve_custom_layouts' || $screen->id === 'neve_page_neve-custom-layout-upsell' ) ) {
10041004
return;
10051005
}
@@ -1255,18 +1255,18 @@ public function render_neve_header() {
12551255

12561256
/**
12571257
* Register the survey.
1258-
*
1258+
*
12591259
* @param array $dash_data The dashboard data.
1260-
*
1260+
*
12611261
* @return void
12621262
*/
12631263
public function register_survey( $dash_data ) {
12641264
add_filter(
12651265
'themeisle-sdk/survey/neve',
12661266
function( $data, $page_slug ) use ( $dash_data ) {
1267-
1267+
12681268
$install_days_number = intval( ( time() - get_option( 'neve_install', time() ) ) / DAY_IN_SECONDS );
1269-
1269+
12701270
$data = array(
12711271
'environmentId' => 'clr0ply35522h8up0bay2de4y',
12721272
'attributes' => array(
@@ -1288,43 +1288,67 @@ function( $data, $page_slug ) use ( $dash_data ) {
12881288
return $data;
12891289
},
12901290
10,
1291-
2
1291+
2
12921292
);
12931293
}
12941294

12951295
/**
12961296
* Get the Black Friday config settings.
1297-
*
1297+
*
12981298
* @param array $default Optional. The default values.
1299-
*
1299+
*
13001300
* @return array The data.
13011301
*/
13021302
public static function get_black_friday_data( $default = array() ) {
13031303
$config = $default;
13041304

1305-
// translators: %1$s - HTML tag, %2$s - discount, %3$s - HTML tag, %4$s - product name.
1306-
$message_template = __( 'Our biggest sale of the year: %1$sup to %2$s OFF%3$s on %4$s. Don\'t miss this limited-time offer.', 'neve' );
1307-
$product_label = __( 'Neve', 'neve' );
1308-
$discount = '70%';
1305+
$message = __( 'Custom layouts, WooCommerce tools, starter sites. What you\'ve been doing manually, Neve Pro handles for you. Exclusively for existing Neve users.', 'neve' );
1306+
$cta_label = __( 'Get Neve Pro', 'neve' );
13091307

1310-
$plan = apply_filters( 'product_neve_license_plan', 0 );
1308+
$plan = apply_filters( 'product_neve_license_plan', false );
13111309
$is_pro = 0 < $plan;
13121310

1313-
if ( $is_pro ) {
1314-
// translators: %1$s - HTML tag, %2$s - discount, %3$s - HTML tag, %4$s - product name.
1315-
$message_template = __( 'Get %1$sup to %2$s off%3$s when you upgrade your %4$s plan or renew early.', 'neve' );
1316-
$product_label = __( 'Neve Pro', 'neve' );
1317-
$discount = '30%';
1311+
$license_status = apply_filters( 'product_neve_license_status', false );
1312+
$has_valid_license = 'valid' === $license_status;
1313+
$has_expired_license = 'expired' === $license_status || 'active-expired' === $license_status;
1314+
1315+
$neve_pro_product_slug = defined( 'NEVE_PRO_BASEFILE' ) ? basename( dirname( NEVE_PRO_BASEFILE ) ) : '';
1316+
1317+
if ( $has_valid_license ) {
1318+
// translators: %s is the discount percentage.
1319+
$config['plugin_meta_message'] = sprintf( __( 'Black Friday Sale - up to %s off', 'neve' ), '30%' );
1320+
// translators: %1$s - the discount percentage for the upgrade, %2$s - the discount percentage for the renewal.
1321+
$message = sprintf( __( 'Upgrade your Neve Pro plan: %1$s off this week. Already on the plan you need? Renew early and save up to %2$s.', 'neve' ), '30%', '20%' );
1322+
$cta_label = __( 'See your options', 'neve' );
1323+
} elseif ( $has_expired_license ) {
1324+
// translators: %s is the discount percentage.
1325+
$config['plugin_meta_message'] = sprintf( __( 'Black Friday Sale - %s off', 'neve' ), '50%' );
1326+
// translators: %s is the discount percentage.
1327+
$config['upgrade_menu_text'] = sprintf( __( 'BF Sale - %s off', 'neve' ), '50%' );
1328+
$message = __( 'Your Neve Pro features are still here, just locked. Renew at a reduced rate this week and pick up right where you left off.', 'neve' );
1329+
$cta_label = __( 'Reactivate now', 'neve' );
1330+
} else {
1331+
// translators: %s is the discount percentage.
1332+
$config['plugin_meta_message'] = sprintf( __( 'Black Friday Sale - %s off', 'neve' ), '60%' );
1333+
// translators: %s is the discount percentage.
1334+
$config['upgrade_menu_text'] = sprintf( __( 'BF Sale - %s off', 'neve' ), '60%' );
1335+
// translators: %s - the discount percentage for the upgrade.
1336+
$config['title'] = sprintf( __( 'Neve Pro: %s off this week', 'neve' ), '60%' );
1337+
}
1338+
1339+
if ( $has_valid_license || $has_expired_license ) {
1340+
$config['plugin_meta_targets'] = array( $neve_pro_product_slug );
13181341
}
1319-
1320-
$product_label = sprintf( '<strong>%s</strong>', $product_label );
1321-
$url_params = array(
1342+
1343+
$url_params = array(
13221344
'utm_term' => $is_pro ? 'plan-' . $plan : 'free',
13231345
'lkey' => apply_filters( 'product_neve_license_key', false ),
1346+
'expired' => $has_expired_license ? '1' : false,
13241347
);
1325-
1326-
$config['message'] = sprintf( $message_template, '<strong>', $discount, '</strong>', $product_label );
1327-
$config['sale_url'] = add_query_arg(
1348+
1349+
$config['message'] = $message;
1350+
$config['cta_label'] = $cta_label;
1351+
$config['sale_url'] = add_query_arg(
13281352
$url_params,
13291353
tsdk_translate_link( tsdk_utmify( 'https://themeisle.link/neve-bf', 'bfcm', 'neve' ) )
13301354
);
@@ -1334,9 +1358,9 @@ public static function get_black_friday_data( $default = array() ) {
13341358

13351359
/**
13361360
* Add the Black Friday data.
1337-
*
1361+
*
13381362
* @param array $configs An array of configurations.
1339-
*
1363+
*
13401364
* @return array The configurations.
13411365
*/
13421366
public function add_black_friday_data( $configs ) {

0 commit comments

Comments
 (0)