Skip to content

Commit 0daab9e

Browse files
Add changeset and property
1 parent da7ec96 commit 0daab9e

File tree

2 files changed

+41
-18
lines changed

2 files changed

+41
-18
lines changed

.changeset/short-taxes-wash.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@guardian/libs': major
3+
---
4+
5+
Temporarily switching to use Sourcepoint geolocation
6+
7+
- Load all stubs (tcfv2, usnat, ccpa) regardless of location except for Australia
8+
- Loading all jurisdiction config objects to allow Sourcepoint to choose depending on their geolocation except for Australia
9+
- Australia will use our current geolocation as SP's framework doesn't allow us to load both ccpa and usnat config objects.
10+
- Accept isInSourcepointGeolocationTest into the `cmp.init` function

libs/@guardian/libs/src/consent-management-platform/sourcepoint.ts

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,11 @@ export const willShowPrivacyMessage = new Promise<boolean>((resolve) => {
4747
const getPropertyHref = (
4848
framework: ConsentFramework,
4949
useNonAdvertisedList: boolean,
50+
isInSourcepointGeolocationTest: boolean,
5051
): Property => {
52+
if (isInSourcepointGeolocationTest) {
53+
return getPropertyHrefForGeolocationTest(framework, useNonAdvertisedList);
54+
}
5155
if (framework == 'aus') {
5256
return 'https://au.theguardian.com';
5357
}
@@ -59,36 +63,41 @@ const getPropertyHref = (
5963
return useNonAdvertisedList ? PROPERTY_HREF_SUBDOMAIN : PROPERTY_HREF_MAIN;
6064
};
6165

62-
const getPropertyHrefForGeolocationTest = (
66+
const getPropertyId = (
6367
framework: ConsentFramework,
6468
useNonAdvertisedList: boolean,
65-
): Property => {
69+
isInSourcepointGeolocationTest: boolean,
70+
): number => {
71+
if (isInSourcepointGeolocationTest) {
72+
return getPropertyIdForGeolocationTest(framework, useNonAdvertisedList);
73+
}
74+
6675
if (framework == 'aus') {
67-
return 'https://au.theguardian.com';
76+
return PROPERTY_ID_AUSTRALIA;
6877
}
6978

7079
if (framework == 'usnat') {
71-
return PROPERTY_HREF_MAIN_TEST;
80+
return PROPERTY_ID_MAIN;
7281
}
7382

74-
return useNonAdvertisedList
75-
? PROPERTY_HREF_SUBDOMAIN
76-
: PROPERTY_HREF_MAIN_TEST;
83+
return useNonAdvertisedList ? PROPERTY_ID_SUBDOMAIN : PROPERTY_ID_MAIN;
7784
};
7885

79-
const getPropertyId = (
86+
const getPropertyHrefForGeolocationTest = (
8087
framework: ConsentFramework,
8188
useNonAdvertisedList: boolean,
82-
): number => {
89+
): Property => {
8390
if (framework == 'aus') {
84-
return PROPERTY_ID_AUSTRALIA;
91+
return 'https://au.theguardian.com';
8592
}
8693

8794
if (framework == 'usnat') {
88-
return PROPERTY_ID_MAIN;
95+
return PROPERTY_HREF_MAIN_TEST;
8996
}
9097

91-
return useNonAdvertisedList ? PROPERTY_ID_SUBDOMAIN : PROPERTY_ID_MAIN;
98+
return useNonAdvertisedList
99+
? PROPERTY_HREF_SUBDOMAIN
100+
: PROPERTY_HREF_MAIN_TEST;
92101
};
93102

94103
const getPropertyIdForGeolocationTest = (
@@ -204,12 +213,16 @@ export const init = (
204213
config: {
205214
baseEndpoint: ENDPOINT,
206215
accountId: ACCOUNT_ID,
207-
propertyId: isInSourcepointGeolocationTest
208-
? getPropertyIdForGeolocationTest(framework, useNonAdvertisedList)
209-
: getPropertyId(framework, useNonAdvertisedList),
210-
propertyHref: isInSourcepointGeolocationTest
211-
? getPropertyHrefForGeolocationTest(framework, useNonAdvertisedList)
212-
: getPropertyHref(framework, useNonAdvertisedList),
216+
propertyId: getPropertyId(
217+
framework,
218+
useNonAdvertisedList,
219+
isInSourcepointGeolocationTest,
220+
),
221+
propertyHref: getPropertyHref(
222+
framework,
223+
useNonAdvertisedList,
224+
isInSourcepointGeolocationTest,
225+
),
213226
joinHref: true,
214227
isSPA: true,
215228
targetingParams: {

0 commit comments

Comments
 (0)