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

Use gu_hide_support_messaging cookie as the only source of truth for support messaging #13037

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
We don't need recurring contributor cookie either
rupertbates committed Dec 19, 2024
commit 2ccdae123b98f1783187fa85ba315f581534df94
4 changes: 2 additions & 2 deletions dotcom-rendering/src/lib/contributions.ts
Original file line number Diff line number Diff line change
@@ -6,9 +6,9 @@ import type { DCRFrontType } from '../types/front';
import type { DCRNewslettersPageType } from '../types/newslettersPage';
import type { DCRTagPageType } from '../types/tagPage';

// User Attributes API cookies (created on sign-in)
// User Attributes API cookie (created on sign-in)
export const HIDE_SUPPORT_MESSAGING_COOKIE = 'gu_hide_support_messaging';
export const RECURRING_CONTRIBUTOR_COOKIE = 'gu_recurring_contributor';

export const OPT_OUT_OF_ARTICLE_COUNT_COOKIE = 'gu_article_count_opt_out';

// Local storage keys
22 changes: 2 additions & 20 deletions dotcom-rendering/src/lib/readerRevenueDevUtils.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
import { getCookie, removeCookie, setCookie, storage } from '@guardian/libs';
import {
HIDE_SUPPORT_MESSAGING_COOKIE,
RECURRING_CONTRIBUTOR_COOKIE,
SUPPORT_ONE_OFF_CONTRIBUTION_COOKIE,
} from './contributions';
import { HIDE_SUPPORT_MESSAGING_COOKIE } from './contributions';
import { getLocaleCode } from './getCountryCode';

const readerRevenueCookies = [
HIDE_SUPPORT_MESSAGING_COOKIE,
RECURRING_CONTRIBUTOR_COOKIE,
SUPPORT_ONE_OFF_CONTRIBUTION_COOKIE,
];
const readerRevenueCookies = [HIDE_SUPPORT_MESSAGING_COOKIE];

const clearEpicViewLog = (): void =>
storage.local.remove('gu.contributions.views');
@@ -22,12 +14,6 @@ const clearBannerLastClosedAt = (): void => {
storage.local.remove('gu.noRRBannerTimestamp');
};

const fakeOneOffContributor = (): void =>
setCookie({
name: SUPPORT_ONE_OFF_CONTRIBUTION_COOKIE,
value: Date.now().toString(),
});

const MULTIVARIATE_ID_COOKIE = 'GU_mvt_id';
const MAX_CLIENT_MVT_ID = 1000000;
const incrementMvtCookie = (): void => {
@@ -76,10 +62,6 @@ const clearCommonReaderRevenueStateAndReload = (
for (const cookie of readerRevenueCookies) removeCookie({ name: cookie });
clearEpicViewLog();

if (asExistingSupporter) {
fakeOneOffContributor();
}

window.location.reload();
};