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

Ghostery Plus & Insights Promo Modals #464

Merged
merged 13 commits into from Oct 28, 2019
Merged
Changes from 1 commit
Commits
File filter
Filter file types
Jump to
Jump to file
Failed to load files.

Always

Just for now

Debug and clean up PlusPromoModal shared component

  • Loading branch information
wlycdgr committed Oct 25, 2019
commit da5627961941416b97d3ecfe222febddeee1e99a
@@ -59,9 +59,23 @@ class HomeViewContainer extends Component {

/**
* @private
* Function to handle clicks on Select Plus and Select Basic in the Plus Promo Modal
* Function to handle clicks on Select Basic in the Plus Promo Modal
*/
_handlePlusPromoModalClicks = () => {
// TODO send appropriate metrics ping
_handlePromoSelectBasicClick = () => {
// GH-1777
// we want to show the Plus Promo modal once per Hub visit - not every time the user returns to the Home view
this.props.actions.markPlusPromoModalShown();

sendMessage('SET_PLUS_PROMO_MODAL_SEEN', {});
}

/**
* @private
* Function to handle clicks on Select Plus in the Plus Promo Modal
*/
// TODO send appropriate metrics ping
_handlePromoSelectPlusClick = () => {
// GH-1777
// we want to show the Plus Promo modal once per Hub visit - not every time the user returns to the Home view
this.props.actions.markPlusPromoModalShown();
@@ -94,7 +108,8 @@ class HomeViewContainer extends Component {
<PlusPromoModal
show={!isPlus && !plus_promo_modal_shown}
location="hub"
clickHandler={this._handlePlusPromoModalClicks}
handleSelectBasicClick={this._handlePromoSelectBasicClick}
handleSelectPlusClick={this._handlePromoSelectPlusClick}
/>
<HomeView {...childProps} />
</div>
@@ -201,25 +201,35 @@ class Panel extends React.Component {
// TODO metrics ping
this.props.actions.togglePromoModal();
sendMessage('promoModals.turnOffPromos', {});
}
};

_handlePromoSignInClick = (modal) => {
// TODO metrics ping
this.props.actions.togglePromoModal();
history.push({
pathname: '/login',
});
}
};

_handlePromoSelectBasicClick = () => {
// TODO send metrics ping
this.props.actions.togglePromoModal();
};

_handlePromoSelectPlusClick = () => {
// TODO send metrics ping
this.props.actions.togglePromoModal();
};

_handlePromoSubscribeClick = (modal) => {
// TODO send metrics ping
this.props.actions.togglePromoModal();
}
};

_handlePromoXClick = (modal) => {
// TODO send metrics ping
this.props.actions.togglePromoModal();
}
};

_plusSubscriber = () => {
const { loggedIn, user } = this.props;
@@ -254,10 +264,8 @@ class Panel extends React.Component {
<PlusPromoModal
show
location="panel"
handleNoThanksClick={this._handlePromoNoThanksClick}
handleSignInClick={this._handlePromoSignInClick}
handleSubscribeClick={this._handlePromoSubscribeClick}
handleXClick={this._handlePromoXClick}
handleSelectBasicClick={this._handlePromoSelectBasicClick}
handleSelectPlusClick={this._handlePromoSelectPlusClick}
/>
);
}
@@ -61,7 +61,7 @@ class PlusUpgradePromoModal extends React.Component {
{t('upgrade_cta_TEXT')}
</div>
<div className="PlusPromoModal__button-container" onClick={this.handleSubscribeClick}>
<PanelToTabLink className="PlusPromoModal__button upgrade" href={`http://signon.${DOMAIN}.com/subscribe/`}>
<PanelToTabLink className="PlusPromoModal__button upgrade" href={`http://checkout.${DOMAIN}.com/plus/`}>
<span className="button-text">{t('upgrade_to_plus')}</span>
</PanelToTabLink>
</div>
@@ -15,8 +15,11 @@
import React from 'react';
import PropTypes from 'prop-types';
import ClassNames from 'classnames';
import globals from '../../../src/classes/Globals';
import Modal from '../Modal/Modal';

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

function _renderInitialVersion(props) {
const { show, location, clickHandler } = props;

@@ -82,7 +85,7 @@ function _renderInitialVersion(props) {
<div className="PlusPromoModal__option-description-item">{t('fast_browsing')}</div>
</div>
</div>
<div className="PlusPromoModal__button basic" onClick={clickHandler}>
<div className="PlusPromoModal__button basic" onClick={props.handleSelectBasicClick}>
<span>{t('select_basic')}</span>
</div>
</div>
@@ -115,7 +118,7 @@ function _renderInitialVersion(props) {
</div>
</div>
</div>
<a href="http://signon.ghostery.com/en/subscribe/" target="_blank" rel="noopener noreferrer" className="PlusPromoModal__button plus" onClick={clickHandler}>
<a href={`https://checkout.${DOMAIN}.com/plus`} target="_blank" rel="noopener noreferrer" className="PlusPromoModal__button plus" onClick={props.handleSelectPlusClick}>
<span>{t('select_plus')}</span>
</a>
</div>
@@ -136,7 +139,8 @@ const PlusPromoModal = props => _renderInitialVersion(props);
PlusPromoModal.propTypes = {
show: PropTypes.bool.isRequired,
location: PropTypes.string.isRequired,
clickHandler: PropTypes.func.isRequired,
handleSelectBasicClick: PropTypes.func.isRequired,
handleSelectPlusClick: PropTypes.func.isRequired,
};

export default PlusPromoModal;
ProTip! Use n and p to navigate between commits in a pull request.