diff --git a/mailpoet/assets/js/src/landingpage/ab-test-button.tsx b/mailpoet/assets/js/src/landingpage/ab-test-button.tsx deleted file mode 100644 index d22fed0a91..0000000000 --- a/mailpoet/assets/js/src/landingpage/ab-test-button.tsx +++ /dev/null @@ -1,88 +0,0 @@ -import { __ } from '@wordpress/i18n'; -import { MailPoet } from 'mailpoet'; -import { - Experiment, - Variant, - emitter, - experimentDebugger, -} from '@marvelapp/react-ab-test'; -import { Button } from 'common'; -import { - MailPoetTrackEvent, - CacheEventOptionSaveInStorage, -} from '../analytics-event'; -import { redirectToWelcomeWizard } from './util'; - -const EXPERIMENT_NAME = 'landing_page_cta_display'; -const VARIANT_BEGIN_SETUP = 'landing_page_cta_display_variant_begin_setup'; -const VARIANT_GET_STARTED_FOR_FREE = - 'landing_page_cta_display_variant_get_started_for_free'; - -// analytics permission is currently unavailable at this point -// we will save the event data and send them to mixpanel later -// details in MAILPOET-4972 - -// Called when the experiment is displayed to the user. -emitter.addPlayListener((experimentName, variantName) => { - MailPoetTrackEvent( - 'Experiment Display', - { - experiment: experimentName, - variant: variantName, - }, - CacheEventOptionSaveInStorage, // persist in local storage - ); -}); - -// Called when a 'win' is emitted -emitter.addWinListener((experimentName, variantName) => { - MailPoetTrackEvent( - 'Experiment Win', - { - experiment: experimentName, - variant: variantName, - }, - CacheEventOptionSaveInStorage, // persist in local storage - redirectToWelcomeWizard, // callback - ); -}); - -// Define variants in advance. -emitter.defineVariants( - EXPERIMENT_NAME, - [VARIANT_BEGIN_SETUP, VARIANT_GET_STARTED_FOR_FREE], - [50, 50], -); - -experimentDebugger.setDebuggerAvailable( - MailPoet.FeaturesController.isSupported('landingpage_ab_test_debugger'), -); -experimentDebugger.enable(); - -function AbTestButton() { - return ( - - - - - - - - - ); -} -AbTestButton.displayName = 'Landingpage Ab Test'; - -export { AbTestButton }; diff --git a/mailpoet/assets/js/src/landingpage/footer.tsx b/mailpoet/assets/js/src/landingpage/footer.tsx index 7464d10feb..eda140d62a 100644 --- a/mailpoet/assets/js/src/landingpage/footer.tsx +++ b/mailpoet/assets/js/src/landingpage/footer.tsx @@ -1,6 +1,7 @@ import { __ } from '@wordpress/i18n'; +import { Button } from 'common'; import { Heading } from 'common/typography/heading/heading'; -import { AbTestButton } from './ab-test-button'; +import { redirectToWelcomeWizard } from './util'; function Footer() { return ( @@ -10,7 +11,9 @@ function Footer() { {' '} {__('Ready to start using MailPoet?', 'mailpoet')}{' '} - + ); diff --git a/mailpoet/assets/js/src/landingpage/header.tsx b/mailpoet/assets/js/src/landingpage/header.tsx index e0b086f5ac..b858315e34 100644 --- a/mailpoet/assets/js/src/landingpage/header.tsx +++ b/mailpoet/assets/js/src/landingpage/header.tsx @@ -1,6 +1,7 @@ import { __ } from '@wordpress/i18n'; +import { Button } from 'common'; import { Heading } from 'common/typography/heading/heading'; -import { AbTestButton } from './ab-test-button'; +import { redirectToWelcomeWizard } from './util'; function Header() { return ( @@ -15,7 +16,9 @@ function Header() { 'mailpoet', )}

- + ); diff --git a/mailpoet/lib/Features/FeaturesController.php b/mailpoet/lib/Features/FeaturesController.php index 5ea4278882..61aae93e32 100644 --- a/mailpoet/lib/Features/FeaturesController.php +++ b/mailpoet/lib/Features/FeaturesController.php @@ -5,7 +5,6 @@ namespace MailPoet\Features; use MailPoetVendor\Doctrine\DBAL\Exception\TableNotFoundException; class FeaturesController { - const LANDINGPAGE_AB_TEST_DEBUGGER = 'landingpage_ab_test_debugger'; const FEATURE_BRAND_TEMPLATES = 'brand_templates'; const GUTENBERG_EMAIL_EDITOR = 'gutenberg_email_editor'; const MAILPOET_WOOCOMMERCE_MULTICHANNEL_INTEGRATION = 'mailpoet_woocommerce_multichannel_integration'; @@ -13,7 +12,6 @@ class FeaturesController { // Define feature defaults in the array below in the following form: // self::FEATURE_NAME_OF_FEATURE => true, private $defaults = [ - self::LANDINGPAGE_AB_TEST_DEBUGGER => false, self::FEATURE_BRAND_TEMPLATES => false, self::GUTENBERG_EMAIL_EDITOR => false, self::MAILPOET_WOOCOMMERCE_MULTICHANNEL_INTEGRATION => false, diff --git a/mailpoet/tests/acceptance/Landingpage/LandingpageBasicsCest.php b/mailpoet/tests/acceptance/Landingpage/LandingpageBasicsCest.php index 6fe1996698..1a82432eac 100644 --- a/mailpoet/tests/acceptance/Landingpage/LandingpageBasicsCest.php +++ b/mailpoet/tests/acceptance/Landingpage/LandingpageBasicsCest.php @@ -3,8 +3,6 @@ namespace MailPoet\Test\Acceptance; use Facebook\WebDriver\WebDriverKeys; -use MailPoet\Features\FeaturesController; -use MailPoet\Test\DataFactories\Features; use MailPoet\Test\DataFactories\Settings; class LandingpageBasicsCest { @@ -48,45 +46,11 @@ class LandingpageBasicsCest { $settings = new Settings(); $settings->withWelcomeWizard(); - (new Features())->withFeatureEnabled(FeaturesController::LANDINGPAGE_AB_TEST_DEBUGGER); // enable ab test debugger - $i->amOnMailpoetPage('Emails'); $i->waitForText('Better email — without leaving WordPress'); - $this->selectAbTestVariant($i, 'landing_page_cta_display_variant_begin_setup'); - $i->click('Begin setup'); $i->waitForText('Start by configuring your sender information'); } - - public function abTestButtonWorks(\AcceptanceTester $i) { - $i->wantTo('Check landingpage AB test button works'); - $i->login(); - - // show welcome wizard & landing page - $settings = new Settings(); - $settings->withWelcomeWizard(); - - (new Features())->withFeatureEnabled(FeaturesController::LANDINGPAGE_AB_TEST_DEBUGGER); - - $i->amOnMailpoetPage('Emails'); - - $this->selectAbTestVariant($i, 'landing_page_cta_display_variant_begin_setup'); - - $i->see('Begin setup'); - - $this->selectAbTestVariant($i, 'landing_page_cta_display_variant_get_started_for_free'); - - $i->see('Get started for free'); - } - - private function selectAbTestVariant(\AcceptanceTester $i, $testVariant) { - $i->canSeeElementInDOM('#pushtell-debugger'); - $i->click('.pushtell-container.pushtell-handle'); // open debug panel - $i->see($testVariant); - $i->selectOption(".pushtell-experiment input[value=$testVariant]", $testVariant); - $i->click('.pushtell-close'); // close debug panel - - } }