Skip to content

Commit 4b0ee89

Browse files
refactor: load Black Friday with the new hooks
1 parent 0bc42bb commit 4b0ee89

File tree

2 files changed

+58
-12
lines changed

2 files changed

+58
-12
lines changed

includes/admin/class-rop-admin.php

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ function() use ( $global_settings ) {
6969
return $global_settings->license_type();
7070
}
7171
);
72+
73+
add_filter( 'themeisle_sdk_blackfriday_data', array( $this, 'add_black_friday_data' ) );
7274
}
7375

7476

@@ -444,10 +446,6 @@ function( $data, $page_slug ) use ( $accounts_count, $is_post_sharing_active ) {
444446
);
445447
}
446448
do_action( 'themeisle_internal_page', ROP_PRODUCT_SLUG, 'dashboard' );
447-
448-
if ( ! defined( 'ROP_PRO_VERSION' ) ) {
449-
do_action( 'themeisle_sdk_load_banner', 'rop' );
450-
}
451449
}
452450

453451
/**
@@ -1845,4 +1843,46 @@ public function get_languages() {
18451843
}
18461844
return apply_filters( 'wpml_active_languages', null, array( 'skip_missing' => 1 ) );
18471845
}
1846+
1847+
/**
1848+
* Add the Black Friday configuration.
1849+
*
1850+
* @param array $configs An array of configurations.
1851+
*
1852+
* @return array The configurations.
1853+
*/
1854+
public static function add_black_friday_data( $configs ) {
1855+
$config = $configs['default'];
1856+
1857+
// translators: %1$s - HTML tag, %2$s - discount, %3$s - HTML tag, %4$s - product name.
1858+
$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' );
1859+
$product_label = __( 'Revive Social', 'neve' );
1860+
$discount = '50%';
1861+
1862+
$plan = apply_filters( 'product_rop_license_plan', 0 );
1863+
$is_pro = 0 < $plan;
1864+
1865+
if ( $is_pro ) {
1866+
// translators: %1$s - HTML tag, %2$s - discount, %3$s - HTML tag, %4$s - product name.
1867+
$message_template = __( 'Get %1$sup to %2$s off%3$s when you upgrade your %4$s plan or renew early.', 'neve' );
1868+
$product_label = __( 'Revive Social Pro', 'neve' );
1869+
$discount = '20%';
1870+
}
1871+
1872+
$product_label = sprintf( '<strong>%s</strong>', $product_label );
1873+
$url_params = array(
1874+
'utm_term' => $is_pro ? 'plan-' . $plan : 'free',
1875+
'lkey' => apply_filters( 'product_rop_license_key', false ),
1876+
);
1877+
1878+
$config['message'] = sprintf( $message_template, '<strong>', $discount, '</strong>', $product_label );
1879+
$config['sale_url'] = add_query_arg(
1880+
$url_params,
1881+
tsdk_translate_link( tsdk_utmify( 'https://themeisle.com/rs-bf', 'bfcm', 'revive' ) )
1882+
);
1883+
1884+
$configs[ ROP_PRODUCT_SLUG ] = $config;
1885+
1886+
return $configs;
1887+
}
18481888
}

vue/src/vue-elements/main-page-panel.vue

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@
1515
</h1>
1616
</div>
1717
</div>
18-
<div
19-
id="tsdk_banner"
20-
class="rop-banner"
21-
/>
2218
<toast />
2319
<div
2420
v-if=" is_rest_api_error "
@@ -64,6 +60,11 @@
6460
</div>
6561
</div>
6662

63+
<div
64+
id="tsdk_banner"
65+
class="rop-banner"
66+
/>
67+
6768
<div class="columns">
6869
<div class="panel column col-9 col-xs-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
6970
<div
@@ -384,8 +385,10 @@
384385
}, 1000);
385386
386387
this.get_toast_message(false);
387-
388-
document.dispatchEvent(new Event('themeisle:banner:init'));
388+
389+
if ( window.tsdk_reposition_notice ) {
390+
window.tsdk_reposition_notice?.();
391+
}
389392
},
390393
created() {
391394
this.$root.$refs.main_page = this;
@@ -574,9 +577,12 @@
574577
text-decoration: underline;
575578
}
576579
577-
.rop-banner:has(.tsdk-banner-cta) {
580+
.rop-banner:has(.themeisle-sale) {
578581
width: 100%;
579-
margin-top: 15px;
580582
margin-bottom: 30px;
581583
}
584+
585+
#tsdk_banner :is(.themeisle-sale, p) {
586+
margin: 0;
587+
}
582588
</style>

0 commit comments

Comments
 (0)