@guardian/commercial-core 0.34.1 → 0.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/targeting/content.d.ts +4 -3
- package/dist/cjs/targeting/content.js +0 -1
- package/dist/cjs/targeting/session.d.ts +13 -2
- package/dist/cjs/targeting/session.js +6 -4
- package/dist/esm/targeting/content.d.ts +4 -3
- package/dist/esm/targeting/content.js +0 -1
- package/dist/esm/targeting/session.d.ts +13 -2
- package/dist/esm/targeting/session.js +6 -4
- package/package.json +1 -1
|
@@ -58,12 +58,13 @@ export declare type ContentTargeting = {
|
|
|
58
58
|
*/
|
|
59
59
|
vl: null | typeof videoLengths[number];
|
|
60
60
|
};
|
|
61
|
-
|
|
61
|
+
declare type Content = {
|
|
62
62
|
eligibleForDCR: boolean;
|
|
63
63
|
path: SharedTargeting['url'];
|
|
64
64
|
renderingPlatform: ContentTargeting['rp'];
|
|
65
65
|
section: ContentTargeting['s'];
|
|
66
66
|
sensitive: boolean;
|
|
67
|
-
videoLength?: number
|
|
68
|
-
}
|
|
67
|
+
videoLength?: number;
|
|
68
|
+
};
|
|
69
|
+
export declare const getContentTargeting: ({ eligibleForDCR, path, renderingPlatform, section, sensitive, videoLength, }: Content) => ContentTargeting;
|
|
69
70
|
export {};
|
|
@@ -28,7 +28,6 @@ const getUrlKeywords = (url) => {
|
|
|
28
28
|
.slice(-1)[0];
|
|
29
29
|
return (0, libs_1.isString)(lastSegment) ? lastSegment.split('-').filter(Boolean) : [];
|
|
30
30
|
};
|
|
31
|
-
/* -- Targeting -- */
|
|
32
31
|
const getContentTargeting = ({ eligibleForDCR, path, renderingPlatform, section, sensitive, videoLength, }) => {
|
|
33
32
|
return {
|
|
34
33
|
dcre: eligibleForDCR ? 't' : 'f',
|
|
@@ -92,7 +92,18 @@ export declare type SessionTargeting = {
|
|
|
92
92
|
};
|
|
93
93
|
export declare type AllParticipations = {
|
|
94
94
|
clientSideParticipations: Participations;
|
|
95
|
-
serverSideParticipations:
|
|
95
|
+
serverSideParticipations: {
|
|
96
|
+
[key: `${string}Control`]: 'control';
|
|
97
|
+
[key: `${string}Variant`]: 'variant';
|
|
98
|
+
};
|
|
96
99
|
};
|
|
97
|
-
|
|
100
|
+
declare type Session = {
|
|
101
|
+
adTest: SessionTargeting['at'];
|
|
102
|
+
countryCode: CountryCode;
|
|
103
|
+
isSignedIn: boolean;
|
|
104
|
+
pageViewId: SessionTargeting['pv'];
|
|
105
|
+
participations: AllParticipations;
|
|
106
|
+
referrer: string;
|
|
107
|
+
};
|
|
108
|
+
export declare const getSessionTargeting: ({ adTest, countryCode, isSignedIn, pageViewId, participations, referrer, }: Session) => SessionTargeting;
|
|
98
109
|
export {};
|
|
@@ -49,10 +49,12 @@ const experimentsTargeting = ({ clientSideParticipations, serverSideParticipatio
|
|
|
49
49
|
}
|
|
50
50
|
return [...clientSideExperiment, ...serverSideExperiments];
|
|
51
51
|
};
|
|
52
|
-
|
|
53
|
-
const getSessionTargeting = (referrer, participations, targeting) => ({
|
|
54
|
-
ref: getReferrer(referrer),
|
|
52
|
+
const getSessionTargeting = ({ adTest, countryCode, isSignedIn, pageViewId, participations, referrer, }) => ({
|
|
55
53
|
ab: experimentsTargeting(participations),
|
|
56
|
-
|
|
54
|
+
at: adTest,
|
|
55
|
+
cc: countryCode,
|
|
56
|
+
pv: pageViewId,
|
|
57
|
+
ref: getReferrer(referrer),
|
|
58
|
+
si: isSignedIn ? 't' : 'f',
|
|
57
59
|
});
|
|
58
60
|
exports.getSessionTargeting = getSessionTargeting;
|
|
@@ -58,12 +58,13 @@ export declare type ContentTargeting = {
|
|
|
58
58
|
*/
|
|
59
59
|
vl: null | typeof videoLengths[number];
|
|
60
60
|
};
|
|
61
|
-
|
|
61
|
+
declare type Content = {
|
|
62
62
|
eligibleForDCR: boolean;
|
|
63
63
|
path: SharedTargeting['url'];
|
|
64
64
|
renderingPlatform: ContentTargeting['rp'];
|
|
65
65
|
section: ContentTargeting['s'];
|
|
66
66
|
sensitive: boolean;
|
|
67
|
-
videoLength?: number
|
|
68
|
-
}
|
|
67
|
+
videoLength?: number;
|
|
68
|
+
};
|
|
69
|
+
export declare const getContentTargeting: ({ eligibleForDCR, path, renderingPlatform, section, sensitive, videoLength, }: Content) => ContentTargeting;
|
|
69
70
|
export {};
|
|
@@ -25,7 +25,6 @@ const getUrlKeywords = (url) => {
|
|
|
25
25
|
.slice(-1)[0];
|
|
26
26
|
return isString(lastSegment) ? lastSegment.split('-').filter(Boolean) : [];
|
|
27
27
|
};
|
|
28
|
-
/* -- Targeting -- */
|
|
29
28
|
export const getContentTargeting = ({ eligibleForDCR, path, renderingPlatform, section, sensitive, videoLength, }) => {
|
|
30
29
|
return {
|
|
31
30
|
dcre: eligibleForDCR ? 't' : 'f',
|
|
@@ -92,7 +92,18 @@ export declare type SessionTargeting = {
|
|
|
92
92
|
};
|
|
93
93
|
export declare type AllParticipations = {
|
|
94
94
|
clientSideParticipations: Participations;
|
|
95
|
-
serverSideParticipations:
|
|
95
|
+
serverSideParticipations: {
|
|
96
|
+
[key: `${string}Control`]: 'control';
|
|
97
|
+
[key: `${string}Variant`]: 'variant';
|
|
98
|
+
};
|
|
96
99
|
};
|
|
97
|
-
|
|
100
|
+
declare type Session = {
|
|
101
|
+
adTest: SessionTargeting['at'];
|
|
102
|
+
countryCode: CountryCode;
|
|
103
|
+
isSignedIn: boolean;
|
|
104
|
+
pageViewId: SessionTargeting['pv'];
|
|
105
|
+
participations: AllParticipations;
|
|
106
|
+
referrer: string;
|
|
107
|
+
};
|
|
108
|
+
export declare const getSessionTargeting: ({ adTest, countryCode, isSignedIn, pageViewId, participations, referrer, }: Session) => SessionTargeting;
|
|
98
109
|
export {};
|
|
@@ -46,9 +46,11 @@ const experimentsTargeting = ({ clientSideParticipations, serverSideParticipatio
|
|
|
46
46
|
}
|
|
47
47
|
return [...clientSideExperiment, ...serverSideExperiments];
|
|
48
48
|
};
|
|
49
|
-
|
|
50
|
-
export const getSessionTargeting = (referrer, participations, targeting) => ({
|
|
51
|
-
ref: getReferrer(referrer),
|
|
49
|
+
export const getSessionTargeting = ({ adTest, countryCode, isSignedIn, pageViewId, participations, referrer, }) => ({
|
|
52
50
|
ab: experimentsTargeting(participations),
|
|
53
|
-
|
|
51
|
+
at: adTest,
|
|
52
|
+
cc: countryCode,
|
|
53
|
+
pv: pageViewId,
|
|
54
|
+
ref: getReferrer(referrer),
|
|
55
|
+
si: isSignedIn ? 't' : 'f',
|
|
54
56
|
});
|