Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-1969, GH-2029 Plus & Premium In App Promo's #529

Closed
wants to merge 24 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
d7a2d6d
Design spring-plus promo modal
benstrumeyer Mar 5, 2020
95280ff
Add click events to promo modal
benstrumeyer Mar 9, 2020
887f445
Remove comments and console.logs
benstrumeyer Mar 9, 2020
c14cf55
Add translations
benstrumeyer Mar 9, 2020
6301df3
Unfinished PromoModal superclass
benstrumeyer Mar 31, 2020
bedad10
Add base class for promo modals
benstrumeyer Apr 1, 2020
04a9760
Insights promo modal broken
benstrumeyer Apr 1, 2020
31121c1
Fix handlePromoXClick, comment in PromoModal structure
Eden12345 Apr 2, 2020
2b54972
Merge insights, plus, and premium PromoModal methods
benstrumeyer Apr 6, 2020
70c9fa1
Fix error
benstrumeyer Apr 7, 2020
56d0716
Refactor X button out to PromoModal.jsx. Move Insights and Plus Promo…
benstrumeyer Apr 7, 2020
4f187af
Fix imports and remove debug flag from manifest.json
benstrumeyer Apr 7, 2020
ea8f83f
Use React.Fragment, update class names, factor out repeat code, updat…
Eden12345 Apr 8, 2020
e3140f5
Update InsightsPromoModal class name and fix display
Eden12345 Apr 8, 2020
121cafb
Merge branch 'develop' into GH-1969/plus-in-app-promo
benstrumeyer Apr 15, 2020
406fec5
Fix premium promo modal in hub. Refactor promo modal pings. Style mod…
benstrumeyer Apr 16, 2020
e6771a4
Merge branch 'develop' into GH-1969/plus-in-app-promo
benstrumeyer Apr 16, 2020
16ed0d1
Merge branch 'develop' into GH-1969/plus-in-app-promo
benstrumeyer Apr 16, 2020
3f8f5dd
Change Spring has sprung to Spring is here. Clear them when logging out
benstrumeyer Apr 22, 2020
5e8dd16
Change Plus promo modal copy
benstrumeyer Apr 22, 2020
e771e4f
Remove $2 price tag from Plus Promo
benstrumeyer Apr 24, 2020
6606256
Remove $14 price tag from Premium Promo
benstrumeyer Apr 24, 2020
72df836
Merge branch 'develop' into GH-1969/plus-in-app-promo
benstrumeyer Apr 24, 2020
73d08e3
Remove testing code
benstrumeyer Apr 24, 2020
File filter
Filter file types
Jump to
Jump to file
Failed to load files.

Always

Just for now

Unfinished PromoModal superclass
  • Loading branch information
benstrumeyer committed Mar 31, 2020
commit 6301df35e56637f3ff17c930b002a7457319bad2
@@ -15,11 +15,12 @@ import React, { Component } from 'react';
import PropTypes from 'prop-types';
import QueryString from 'query-string';
import HomeView from './HomeView';
import { PremiumPromoModal } from '../../../shared-components';
import PromoModal from '../../../shared-components/PromoModal';
import { sendMessage } from '../../utils';
import globals from '../../../../src/classes/Globals';

const DOMAIN = globals.DEBUG ? 'ghosterystage' : 'ghostery';
const PREMIUM = 'premium';

/**
* @class Implement the Home View for the Ghostery Hub
@@ -137,7 +138,8 @@ class HomeViewContainer extends Component {

return (
<div className="full-height">
<PremiumPromoModal
<PromoModal
type={PREMIUM}
show={showPromoModal}
isPlus={isPlus}
location="hub"
@@ -14,6 +14,7 @@
import React from 'react';
import { NavLink } from 'react-router-dom';
import Header from '../containers/HeaderContainer';
import PromoModal from '../../shared-components/PromoModal';
import { PremiumPromoModal } from '../../shared-components';
import InsightsPromoModal from './InsightsPromoModal';
import PlusPromoModal from '../containers/PlusPromoModalContainer';
@@ -24,6 +25,9 @@ import history from '../utils/history';
import globals from '../../../src/classes/Globals';

const DOMAIN = globals.DEBUG ? 'ghosterystage' : 'ghostery';
const INSIGHTS = 'insights';
const PLUS = 'plus';
const PREMIUM = 'premium';

/**
* @class Implement base view with functionality common to all views.
@@ -354,14 +358,15 @@ class Panel extends React.Component {
const isPlus = this._plusSubscriber();

return (
<PremiumPromoModal
show
isPlus={isPlus}
<PromoModal
type={PREMIUM}
location="panel"
isPlus={isPlus}
handleGoAwayClick={this._handlePromoGoAwayClick}
handleGetPlusClick={this._handlePromoGetPlusClick}
handleTryMidnightClick={this._handlePromoTryMidnightClick}
handleXClick={this._handlePromoXClick}
show
/>
);
}
@@ -379,7 +384,8 @@ class Panel extends React.Component {
sendMessage('ping', 'promo_modals_show_insights');

return (
<InsightsPromoModal
<PromoModal
type={INSIGHTS}
handleGoAwayClick={this._handlePromoGoAwayClick}
handleSignInClick={this._handlePromoSignInClick}
handleSubscribeClick={this._handlePromoSubscribeClick}
@@ -392,7 +398,7 @@ class Panel extends React.Component {
/**
* @returns {null|JSX}
* @private
* Renders the Insights promo modal if the user is not already an Insights subscriber
* Renders the Plus promo modal if the user is not already an subscriber
*/
_renderPlusPromoModal = () => {
if (this._plusSubscriber() || this._premiumSubscriber()) { return null; }
@@ -401,7 +407,8 @@ class Panel extends React.Component {
sendMessage('ping', 'promo_modals_show_plus');

return (
<PlusPromoModal
<PromoModal
type={PLUS}
handleGoAwayClick={this._handlePromoGoAwayClick}
handleSignInClick={this._handlePromoSignInClick}
handleSubscribeClick={this._handlePromoSubscribeClick}
@@ -0,0 +1,77 @@
/**
* Super component for all of the Promo Modals
*
* Ghostery Browser Extension
* https://www.ghostery.com/
*
* Copyright 2019 Ghostery, Inc. All rights reserved.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0
*/

import React from 'react';
import PropTypes from 'prop-types';
import InsightsPromoModal from '../../panel/components/InsightsPromoModal';
import PlusPromoModal from '../../panel/components/PlusPromoModal';
import PremiumPromoModal from '../PremiumPromoModal';

const INSIGHTS = 'insights';
const PLUS = 'plus';
const PREMIUM = 'premium';
/**
* A superclass for Promo Modals
* @return {JSX}
* @memberof HubComponents
*/
class PromoModal extends React.Component {
handleGoAwayClick = () => { this.props.handleGoAwayClick(this.props.type); }

handleSubscribeClick = () => { this.props.handleSubscribeClick(this.props.type); }

handleXClick = () => { this.props.handleXClick(this.props.type); }

render() {
const { type } = this.props;
switch (type) {
case INSIGHTS:
return <InsightsPromoModal {...this.props} />;
case PLUS:
return <PlusPromoModal {...this.props} />;
case PREMIUM:
return <PremiumPromoModal {...this.props} />;
default:
return <InsightsPromoModal {...this.props} />;
}
}
}

// PropTypes ensure we pass required props of the correct type
PromoModal.propTypes = {
type: PropTypes.string.isRequired,
handleGoAwayClick: PropTypes.func,
handleSignInClick: PropTypes.func,
handleSubscribeClick: PropTypes.func,
handleXClick: PropTypes.func,
handleTryMidnightClick: PropTypes.func,
handleGetPlusClick: PropTypes.func,
handleKeepBasicClick: PropTypes.func,
location: PropTypes.string,
isPlus: PropTypes.bool,
};

const noop = () => {};
PromoModal.defaultProps = {
handleGoAwayClick: noop,
handleSignInClick: noop,
handleSubscribeClick: noop,
handleXClick: noop,
handleTryMidnightClick: noop,
handleGetPlusClick: noop,
handleKeepBasicClick: noop,
location: 'panel',
isPlus: false,
};

export default PromoModal;
@@ -0,0 +1,16 @@
/**
* Point of entry index.js file for PromoModal
*
* Ghostery Browser Extension
* https://www.ghostery.com/
*
* Copyright 2019 Ghostery, Inc. All rights reserved.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0
*/

import PromoModal from './PromoModal';

export default PromoModal;
@@ -18,7 +18,7 @@ import panelData from './PanelData';
const DAYS_BETWEEN_PROMOS = {
premium: globals.DEBUG ? 0.0005 : 30, // 40 seconds on staging
insights: globals.DEBUG ? 0.0005 : 30, // 40 seconds on staging
plus: globals.DEBUG ? 0.0005 : 30 // 40 seconds on staging
plus: globals.DEBUG ? 0.0005 : 2 // 40 seconds on staging
};
const WEEKLY_INSIGHTS_TARGET = globals.DEBUG ? 1 : 3;
const DAILY_INSIGHTS_TARGET = globals.DEBUG ? 7 : 3;
ProTip! Use n and p to navigate between commits in a pull request.