Skip to content

Commit

Permalink
Merge c706239 into d871d3f
Browse files Browse the repository at this point in the history
  • Loading branch information
akinsola-guardian authored Feb 26, 2025
2 parents d871d3f + c706239 commit afe2ac6
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 10 deletions.
6 changes: 6 additions & 0 deletions .changeset/rich-poems-jump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@guardian/libs': minor
---

Send propertyHref to Sourcepoint for all domains.
Reinstate CORP_FLAG for testing
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const PROPERTY_ID_MAIN = 7417;
export const PROPERTY_ID_SUBDOMAIN = 38161;
export const PROPERTY_ID_AUSTRALIA = 13348;

export const PROPERTY_HREF_SUBDOMAIN = 'http://subdomain.theguardian.com';
export const PROPERTY_HREF_SUBDOMAIN = 'https://subdomain.theguardian.com';
export const PROPERTY_HREF_MAIN = 'https://test.theguardian.com';

export const PRIVACY_MANAGER_TCFV2 = 106842;
Expand Down
20 changes: 11 additions & 9 deletions libs/@guardian/libs/src/consent-management-platform/sourcepoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
isConsentOrPayCountry,
setIsConsentOrPay,
} from './isConsentOrPay';
import { isGuardianDomain } from './lib/domain';
import { mark } from './lib/mark';
import {
constructBannerMessageId,
Expand Down Expand Up @@ -51,11 +50,11 @@ const getPropertyHref = (
return 'https://au.theguardian.com';
}

return isGuardianDomain()
? null
: useNonAdvertisedList
? PROPERTY_HREF_SUBDOMAIN
: PROPERTY_HREF_MAIN;
if (framework == 'usnat') {
return 'https://www.theguardian.com';
}

return useNonAdvertisedList ? PROPERTY_HREF_SUBDOMAIN : PROPERTY_HREF_MAIN;
};

const getPropertyId = (
Expand Down Expand Up @@ -115,13 +114,14 @@ export const init = (

setCurrentFramework(framework);

const isCorpABTest: boolean = window.location.search.includes('CORP_FLAG');
// To ensure users who are not part of Consent or Pay country or AB Test
if (!isConsentOrPayCountry(countryCode)) {
if (!isCorpABTest || !isConsentOrPayCountry(countryCode)) {
useNonAdvertisedList = false;
}

setIsConsentOrPay(
isConsentOrPayCountry(countryCode) && !useNonAdvertisedList,
isConsentOrPayCountry(countryCode) && !useNonAdvertisedList && isCorpABTest,
);

// invoke callbacks before we receive Sourcepoint
Expand Down Expand Up @@ -241,7 +241,8 @@ export const init = (
choiceTypeID === SourcePointChoiceTypes.RejectAll &&
message_type === 'gdpr' &&
isConsentOrPayCountry(countryCode) &&
!useNonAdvertisedList
!useNonAdvertisedList &&
isCorpABTest
) {
window.location.href = getSupportSignUpPage();
}
Expand Down Expand Up @@ -307,6 +308,7 @@ export const init = (
excludePage: isExcludedFromCMP(pageSection),
isCorP: isConsentOrPayCountry(countryCode),
isUserSignedIn,
isCorpABTest,
},
};
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ declare global {
excludePage: boolean;
isCorP: boolean;
isUserSignedIn: boolean;
isCorpABTest: boolean;
};
};
usnat?: {
Expand Down

0 comments on commit afe2ac6

Please sign in to comment.