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-1774 et al; promo modal logic bug fixes #468

Merged
merged 2 commits into from Oct 29, 2019
Merged
Changes from all commits
Commits
File filter
Filter file types
Jump to
Jump to file
Failed to load files.

Always

Just for now

@@ -229,12 +229,20 @@ class Panel extends React.Component {
_handlePromoSelectBasicClick = () => {
this.props.actions.togglePromoModal();

// we do not mark the choice-required initial plus promo as 'seen' until
// the user has clicked Select Basic or Select Plus
sendMessage('promoModals.sawPlusPromo', {});

sendMessage('ping', 'promo_modals_select_basic_panel');
};

_handlePromoSelectPlusClick = () => {
this.props.actions.togglePromoModal();

// we do not mark the choice-required initial plus promo as 'seen' until
// the user has clicked Select Basic or Select Plus
sendMessage('promoModals.sawPlusPromo', {});

sendMessage('ping', 'promo_modals_select_plus_panel');
};

@@ -273,9 +281,9 @@ class Panel extends React.Component {
_renderPlusPromoModal = () => {
if (this._plusSubscriber() || this._insightsSubscriber()) return null;

sendMessage('promoModals.sawPlusPromo', {});

if (this.props.promoModal === 'plus_upgrade') {
// the upgrade promo does not require the user to make a choice, so we mark it as 'seen' immediately
sendMessage('promoModals.sawPlusPromo', {});
sendMessage('ping', 'promo_modals_show_upgrade_plus');
return (
<PlusUpgradePromoModal
@@ -16,11 +16,11 @@ import globals from './Globals';
import panelData from './PanelData';

const DAYS_BETWEEN_PROMOS = {
plus: globals.DEBUG ? 0.00025 : 30,
insights: globals.DEBUG ? 0.00025 : 30
plus: globals.DEBUG ? 0.0005 : 30,
insights: globals.DEBUG ? 0.0005 : 30
};
const WEEKLY_INSIGHTS_TARGET = globals.DEBUG ? 1 : 3;
const DAILY_INSIGHTS_TARGET = 3;
const DAILY_INSIGHTS_TARGET = globals.DEBUG ? 7 : 3;

const MSECS_IN_DAY = 86400000; // 1000 msecs-in-sec * 60 secs-in-min * 60 mins-in-hour * 24 hours-in-day
const PLUS = 'plus';
@@ -68,6 +68,11 @@ class PromoModals {
return false;
}

// don't wait 30 days to show the first Insights promo if user meets the criteria before then
if (type === INSIGHTS && lastSeenInsightsPromo === 0) {
return true;
}

return (
(Date.now() - lastSeenPromo) >
(MSECS_IN_DAY * DAYS_BETWEEN_PROMOS[type])
ProTip! Use n and p to navigate between commits in a pull request.