Skip to content

Commit 6ff92f8

Browse files
committed
Merge branch 'refs/heads/master' into DEP-11967-Cookie-Sync-Prebid.js-integration
2 parents 66101f3 + 9987e58 commit 6ff92f8

317 files changed

Lines changed: 2329 additions & 696 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/PR-assignment-deps.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ jobs:
2020
run: |
2121
npx gulp build
2222
- name: Upload dependencies.json
23-
uses: actions/upload-artifact@v4
23+
uses: actions/upload-artifact@v6
2424
with:
2525
name: dependencies.json
2626
path: ./build/dist/dependencies.json
2727
- name: Generate PR info
2828
run: |
2929
echo '{ "prNo": ${{ github.event.pull_request.number }} }' >> ${{ runner.temp}}/prInfo.json
3030
- name: Upload PR info
31-
uses: actions/upload-artifact@v4
31+
uses: actions/upload-artifact@v6
3232
with:
3333
name: prInfo
3434
path: ${{ runner.temp}}/prInfo.json

.github/workflows/jscpd.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ jobs:
119119
120120
- name: Upload comment data
121121
if: env.filtered_report_exists == 'true'
122-
uses: actions/upload-artifact@v4
122+
uses: actions/upload-artifact@v6
123123
with:
124124
name: comment
125125
path: ${{ runner.temp }}/comment.json

.github/workflows/linter.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ jobs:
117117
118118
- name: Upload comment data
119119
if: ${{ steps.comment.outputs.result == 'true' }}
120-
uses: actions/upload-artifact@v4
120+
uses: actions/upload-artifact@v6
121121
with:
122122
name: comment
123123
path: ${{ runner.temp }}/comment.json

integrationExamples/audio/audioGam.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,11 @@
115115

116116
const bid = bidResponse.bids[0];
117117

118+
const adUnit = adUnits.find(au => au.code === 'div-gpt-ad-51545-0');
119+
118120
const adXml = await pbjs.adServers.gam.getVastXml({
119121
bid,
120-
adUnit: 'div-gpt-ad-51545-0',
122+
adUnit,
121123
params: {
122124
iu: '/41758329/localcache',
123125
url: "https://pubads.g.doubleclick.net/gampad/ads?iu=/41758329/localcache&sz=640x480&gdfp_req=1&output=vast&env=vp",

integrationExamples/gpt/localCacheGam.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
mediaTypes: {
1414
video: {
1515
playerSize: [640, 360],
16+
playbackmethod: [2, 6],
17+
api: [2, 7, 8],
1618
}
1719
},
1820
video: {
@@ -95,9 +97,11 @@
9597

9698
const bid = bidResponse.bids[0];
9799

100+
const adUnit = adUnits.find(au => au.code === 'div-gpt-ad-51545-0');
101+
98102
const vastXml = await pbjs.adServers.gam.getVastXml({
99103
bid,
100-
adUnit: 'div-gpt-ad-51545-0',
104+
adUnit,
101105
params: {
102106
iu: '/41758329/localcache',
103107
url: "https://pubads.g.doubleclick.net/gampad/ads?iu=/41758329/localcache&sz=640x480&gdfp_req=1&output=vast&env=vp",

libraries/intentIqConstants/intentIqConstants.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export const GVLID = "1323";
1212
export const VERSION = 0.33;
1313
export const PREBID = "pbjs";
1414
export const HOURS_24 = 86400000;
15+
export const HOURS_72 = HOURS_24 * 3;
1516

1617
export const INVALID_ID = "INVALID_ID";
1718

libraries/intentIqUtils/getRefferer.js

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,25 @@ import { getWindowTop, logError, getWindowLocation, getWindowSelf } from '../../
44
* Determines if the script is running inside an iframe and retrieves the URL.
55
* @return {string} The encoded vrref value representing the relevant URL.
66
*/
7-
export function getReferrer() {
7+
8+
export function getCurrentUrl() {
9+
let url = '';
810
try {
9-
const url = getWindowSelf() === getWindowTop()
10-
? getWindowLocation().href
11-
: getWindowTop().location.href;
11+
if (getWindowSelf() === getWindowTop()) {
12+
// top page
13+
url = getWindowLocation().href || '';
14+
} else {
15+
// iframe
16+
url = getWindowTop().location.href || '';
17+
}
1218

1319
if (url.length >= 50) {
14-
const { origin } = new URL(url);
15-
return origin;
16-
}
20+
return new URL(url).origin;
21+
};
1722

1823
return url;
1924
} catch (error) {
25+
// Handling access errors, such as cross-domain restrictions
2026
logError(`Error accessing location: ${error}`);
2127
return '';
2228
}
@@ -31,12 +37,12 @@ export function getReferrer() {
3137
* @return {string} The modified URL with appended `vrref` or `fui` parameters.
3238
*/
3339
export function appendVrrefAndFui(url, domainName) {
34-
const fullUrl = encodeURIComponent(getReferrer());
40+
const fullUrl = getCurrentUrl();
3541
if (fullUrl) {
3642
return (url += '&vrref=' + getRelevantRefferer(domainName, fullUrl));
3743
}
3844
url += '&fui=1'; // Full Url Issue
39-
url += '&vrref=' + encodeURIComponent(domainName || '');
45+
if (domainName) url += '&vrref=' + encodeURIComponent(domainName);
4046
return url;
4147
}
4248

@@ -47,10 +53,9 @@ export function appendVrrefAndFui(url, domainName) {
4753
* @return {string} The relevant referrer
4854
*/
4955
export function getRelevantRefferer(domainName, fullUrl) {
50-
if (domainName && isDomainIncluded(fullUrl, domainName)) {
51-
return fullUrl;
52-
}
53-
return domainName ? encodeURIComponent(domainName) : fullUrl;
56+
return encodeURIComponent(
57+
domainName && isDomainIncluded(fullUrl, domainName) ? fullUrl : (domainName || fullUrl)
58+
);
5459
}
5560

5661
/**
@@ -61,7 +66,7 @@ export function getRelevantRefferer(domainName, fullUrl) {
6166
*/
6267
export function isDomainIncluded(fullUrl, domainName) {
6368
try {
64-
return fullUrl.includes(domainName);
69+
return new URL(fullUrl).hostname === domainName;
6570
} catch (error) {
6671
logError(`Invalid URL provided: ${error}`);
6772
return false;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
export function getUnitPosition(pbjs, adUnitCode) {
2+
const adUnits = pbjs?.adUnits;
3+
if (!Array.isArray(adUnits) || !adUnitCode) return;
4+
5+
for (let i = 0; i < adUnits.length; i++) {
6+
const adUnit = adUnits[i];
7+
if (adUnit?.code !== adUnitCode) continue;
8+
9+
const mediaTypes = adUnit?.mediaTypes;
10+
if (!mediaTypes || typeof mediaTypes !== 'object') return;
11+
12+
const firstKey = Object.keys(mediaTypes)[0];
13+
const pos = mediaTypes[firstKey]?.pos;
14+
15+
return typeof pos === 'number' ? pos : undefined;
16+
}
17+
}
Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,33 @@
1-
export const iiqServerAddress = (configParams, gdprDetected) => typeof configParams?.iiqServerAddress === 'string' ? configParams.iiqServerAddress : gdprDetected ? 'https://api-gdpr.intentiq.com' : 'https://api.intentiq.com'
2-
export const iiqPixelServerAddress = (configParams, gdprDetected) => typeof configParams?.iiqPixelServerAddress === 'string' ? configParams.iiqPixelServerAddress : gdprDetected ? 'https://sync-gdpr.intentiq.com' : 'https://sync.intentiq.com'
3-
export const reportingServerAddress = (reportEndpoint, gdprDetected) => reportEndpoint && typeof reportEndpoint === 'string' ? reportEndpoint : gdprDetected ? 'https://reports-gdpr.intentiq.com/report' : 'https://reports.intentiq.com/report'
1+
const REGION_MAPPING = {
2+
gdpr: true,
3+
apac: true,
4+
emea: true
5+
};
6+
7+
function checkRegion(region) {
8+
if (typeof region !== 'string') return '';
9+
const lower = region.toLowerCase();
10+
return REGION_MAPPING[lower] ? lower : '';
11+
}
12+
13+
function buildServerAddress(baseName, region) {
14+
const checkedRegion = checkRegion(region);
15+
if (checkedRegion) return `https://${baseName}-${checkedRegion}.intentiq.com`;
16+
return `https://${baseName}.intentiq.com`;
17+
}
18+
19+
export const getIiqServerAddress = (configParams = {}) => {
20+
if (typeof configParams?.iiqServerAddress === 'string') return configParams.iiqServerAddress;
21+
return buildServerAddress('api', configParams.region);
22+
};
23+
24+
export const iiqPixelServerAddress = (configParams = {}) => {
25+
if (typeof configParams?.iiqPixelServerAddress === 'string') return configParams.iiqPixelServerAddress;
26+
return buildServerAddress('sync', configParams.region);
27+
};
28+
29+
export const reportingServerAddress = (reportEndpoint, region) => {
30+
if (reportEndpoint && typeof reportEndpoint === 'string') return reportEndpoint;
31+
const host = buildServerAddress('reports', region);
32+
return `${host}/report`;
33+
};
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
export function appendSPData (url, firstPartyData) {
2-
const spdParam = firstPartyData?.spd ? encodeURIComponent(typeof firstPartyData.spd === 'object' ? JSON.stringify(firstPartyData.spd) : firstPartyData.spd) : '';
3-
url += spdParam ? '&spd=' + spdParam : '';
4-
return url
1+
export function appendSPData (url, partnerData) {
2+
const spdParam = partnerData?.spd ? encodeURIComponent(typeof partnerData.spd === 'object' ? JSON.stringify(partnerData.spd) : partnerData.spd) : '';
3+
if (!spdParam) {
4+
return url;
5+
}
6+
return `${url}&spd=${spdParam}`;
57
};

0 commit comments

Comments
 (0)