diff --git a/assets/js/src/wizard/revenue_tracking_permission.jsx b/assets/js/src/wizard/revenue_tracking_permission.jsx
new file mode 100644
index 0000000000..0d4c15ee0a
--- /dev/null
+++ b/assets/js/src/wizard/revenue_tracking_permission.jsx
@@ -0,0 +1,14 @@
+import React from 'react';
+
+function RevenueTrackingPermission() {
+ return (
+
+
+

+
+
This is the page
+
+ );
+}
+
+export default RevenueTrackingPermission;
diff --git a/assets/js/src/wizard/steps/revenue_tracking_permission_step.jsx b/assets/js/src/wizard/steps/revenue_tracking_permission_step.jsx
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/assets/js/src/wizard/wizard.jsx b/assets/js/src/wizard/wizard.jsx
index 465db2f97a..fbe3ad8395 100644
--- a/assets/js/src/wizard/wizard.jsx
+++ b/assets/js/src/wizard/wizard.jsx
@@ -3,17 +3,24 @@ import ReactDOM from 'react-dom';
import { Route, HashRouter, Redirect } from 'react-router-dom';
import WelcomeWizardStepsController from './welcome_wizard_controller.jsx';
import WooCommerceImportController from './woocommerce_import_controller.jsx';
+import RevenueTrackingPermissionController from './revenue_tracking_permission.jsx';
const container = document.getElementById('mailpoet_wizard_container');
if (container) {
- const basePath = window.location.search.includes('woocommerce-list-import') ? '/import' : '/steps/1';
+ let basePath = '/steps/1';
+ if (window.location.search.includes('revenue-tracking-permission')) {
+ basePath = '/revenue-tracking-permission';
+ } else if (window.location.search.includes('woocommerce-list-import')) {
+ basePath = '/import';
+ }
ReactDOM.render((
} />
+
), container);
diff --git a/lib/Config/Changelog.php b/lib/Config/Changelog.php
index fc4b3959a7..ebf3e8e3f0 100644
--- a/lib/Config/Changelog.php
+++ b/lib/Config/Changelog.php
@@ -63,6 +63,9 @@ class Changelog {
$this->checkWelcomeWizard();
}
$this->checkWooCommerceListImportPage();
+ if ($this->settings->get('display_revenues')) {
+ $this->checkRevenueTrackingPermissionPage();
+ }
}
private function checkMp2Migration($version) {
@@ -108,6 +111,18 @@ class Changelog {
}
}
+ private function checkRevenueTrackingPermissionPage() {
+ if (
+ !in_array($_GET['page'], ['mailpoet-revenue-tracking-permission', 'mailpoet-welcome-wizard', 'mailpoet-migration'])
+ && ($this->settings->get('woocommerce.accept_cookie_revenue_tracking ') !== null)
+ && $this->settings->get('tracking.enabled')
+ && $this->wooCommerceHelper->isWooCommerceActive()
+ && $this->wp->currentUserCan('administrator')
+ ) {
+ $this->url_helper->redirectTo($this->wp->adminUrl('admin.php?page=mailpoet-revenue-tracking-permission'));
+ }
+ }
+
private function terminateWithRedirect($redirect_url) {
// save version number
$this->settings->set('version', Env::$version);
diff --git a/lib/Config/Menu.php b/lib/Config/Menu.php
index ec00fe98c6..274275aef9 100644
--- a/lib/Config/Menu.php
+++ b/lib/Config/Menu.php
@@ -360,6 +360,19 @@ class Menu {
]
);
+ // WooCommerce List Import
+ $this->wp->addSubmenuPage(
+ true,
+ $this->setPageTitle($this->wp->__('Track WooCommerce revenues with cookies', 'mailpoet')),
+ $this->wp->__('Track WooCommerce revenues with cookies', 'mailpoet'),
+ AccessControl::PERMISSION_ACCESS_PLUGIN_ADMIN,
+ 'mailpoet-revenue-tracking-permission',
+ array(
+ $this,
+ 'revenueTrackingPermission'
+ )
+ );
+
// Update page
$this->wp->addSubmenuPage(
true,
@@ -432,6 +445,17 @@ class Menu {
$this->displayPage('woocommerce_list_import.html', $data);
}
+ function revenueTrackingPermission() {
+ if (!$this->settings->get('display_revenues')) {
+ return;
+ }
+ if ((bool)(defined('DOING_AJAX') && DOING_AJAX)) return;
+ $data = [
+ 'finish_wizard_url' => $this->wp->adminUrl('admin.php?page=' . self::MAIN_PAGE_SLUG),
+ ];
+ $this->displayPage('revenue_tracking_permission.html', $data);
+ }
+
function update() {
global $wp;
$current_url = $this->wp->homeUrl(add_query_arg($wp->query_string, $wp->request));
diff --git a/views/revenue_tracking_permission.html b/views/revenue_tracking_permission.html
new file mode 100644
index 0000000000..7a7eae2ffd
--- /dev/null
+++ b/views/revenue_tracking_permission.html
@@ -0,0 +1,17 @@
+<% extends 'layout.html' %>
+
+<% block content %>
+
+
+
+
+<% endblock %>
+
+<% block translations %>
+<%= localize({
+
+}) %>
+<% endblock %>