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

Remove the action required cookie #13097

Merged
merged 1 commit into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ const getAuthStatus = getAuthStatus_ as jest.MockedFunction<
const PERSISTENCE_KEYS = {
USER_FEATURES_EXPIRY_COOKIE: 'gu_user_features_expiry',
AD_FREE_USER_COOKIE: 'GU_AF1',
ACTION_REQUIRED_FOR_COOKIE: 'gu_action_required_for',
SUPPORT_ONE_OFF_CONTRIBUTION_COOKIE: 'gu.contributions.contrib-timestamp',
HIDE_SUPPORT_MESSAGING_COOKIE: 'gu_hide_support_messaging',
};
Expand All @@ -62,16 +61,11 @@ const setAllFeaturesData = (opts: { isExpired: boolean }) => {
name: PERSISTENCE_KEYS.USER_FEATURES_EXPIRY_COOKIE,
value: expiryDate.getTime().toString(),
});
setCookie({
name: PERSISTENCE_KEYS.ACTION_REQUIRED_FOR_COOKIE,
value: 'test',
});
};

const deleteAllFeaturesData = () => {
removeCookie({ name: PERSISTENCE_KEYS.USER_FEATURES_EXPIRY_COOKIE });
removeCookie({ name: PERSISTENCE_KEYS.AD_FREE_USER_COOKIE });
removeCookie({ name: PERSISTENCE_KEYS.ACTION_REQUIRED_FOR_COOKIE });
removeCookie({ name: PERSISTENCE_KEYS.HIDE_SUPPORT_MESSAGING_COOKIE });
};

Expand Down
11 changes: 0 additions & 11 deletions dotcom-rendering/src/client/userFeatures/user-features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import {
import type { UserFeaturesResponse } from './user-features-lib';

const USER_FEATURES_EXPIRY_COOKIE = 'gu_user_features_expiry';
const ACTION_REQUIRED_FOR_COOKIE = 'gu_action_required_for';
const HIDE_SUPPORT_MESSAGING_COOKIE = 'gu_hide_support_messaging';
const AD_FREE_USER_COOKIE = 'GU_AF1';

Expand All @@ -36,7 +35,6 @@ const forcedAdFreeMode = !!/[#&]noadsaf(&.*)?$/.exec(window.location.hash);
const userHasData = () => {
const cookie =
getAdFreeCookie() ??
getCookie({ name: ACTION_REQUIRED_FOR_COOKIE }) ??
getCookie({ name: USER_FEATURES_EXPIRY_COOKIE }) ??
getCookie({ name: HIDE_SUPPORT_MESSAGING_COOKIE });
return !!cookie;
Expand Down Expand Up @@ -65,14 +63,6 @@ const persistResponse = (JsonResponse: UserFeaturesResponse) => {
value: String(!JsonResponse.showSupportMessaging),
});

removeCookie({ name: ACTION_REQUIRED_FOR_COOKIE });
if (JsonResponse.alertAvailableFor) {
setCookie({
name: ACTION_REQUIRED_FOR_COOKIE,
value: JsonResponse.alertAvailableFor,
});
}

if (JsonResponse.contentAccess.digitalPack) {
setAdFreeCookie(2);
} else if (adFreeDataIsPresent() && !forcedAdFreeMode) {
Expand All @@ -83,7 +73,6 @@ const persistResponse = (JsonResponse: UserFeaturesResponse) => {
const deleteOldData = (): void => {
removeCookie({ name: AD_FREE_USER_COOKIE });
removeCookie({ name: USER_FEATURES_EXPIRY_COOKIE });
removeCookie({ name: ACTION_REQUIRED_FOR_COOKIE });
removeCookie({ name: HIDE_SUPPORT_MESSAGING_COOKIE });
};

Expand Down
Loading