Skip to content

Commit 1716bbb

Browse files
screencore-devKostiantyn Karchevskydgirardipatmmccannpavlosamonin-a11y
authored
Screencore Bid Adapter: fix region routing and endpoint path (prebid#14544)
* Screencore prebid adapter * rearrange code * use lowercase screncore bidder code * fix tests * update tests * trigger CI * Screencore Bid Adapter: add endpointId parameter * Updated adapter to use teqblazeUtils library * Added endpointId parameter support in test parameters * Updated test specs to include endpointId validation * Screencore Bid Adapter: update sync URL to base domain Update SYNC_URL constant to use base domain. The getUserSyncs function from teqblazeUtils will append the appropriate path. * Screencore Bid Adapter: migrate to teqblazeUtils library - Update imports to use buildRequestsBase, interpretResponse, getUserSyncs, isBidRequestValid, and buildPlacementProcessingFunction from teqblazeUtils - Remove storage manager dependency (no longer needed) - Update isBidRequestValid to use placementId/endpointId params validation - Refactor buildRequests to use buildRequestsBase pattern - Rewrite test suite to match teqblazeUtils API: - Simplify test data structures - Update server response format (body as array) - Add tests for placementId/endpointId validation - Update getUserSyncs URL format expectations * fix(screencore): correct region routing and endpoint path - add US/ and Canada/ timezone prefixes to getRegionSubdomainSuffix() - fix endpoint path from /prebid to /pbjs - move AD_URL inside buildRequests to compute per request --------- Co-authored-by: Kostiantyn Karchevsky <kostiantyn.karchevsky@teqblaze.com> Co-authored-by: Demetrio Girardi <dgirardi@prebid.org> Co-authored-by: Patrick McCann <patmmccann@gmail.com> Co-authored-by: Pavlo Samonin <pavlo.samonin@teqblaze.com>
1 parent f502bd3 commit 1716bbb

2 files changed

Lines changed: 39 additions & 4 deletions

File tree

modules/screencoreBidAdapter.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ const REGION_SUBDOMAIN_SUFFIX = {
2525
*/
2626
function getRegionSubdomainSuffix() {
2727
try {
28-
const region = getTimeZone().split('/')[0];
28+
const tz = getTimeZone();
29+
const region = tz.split('/')[0];
2930

3031
switch (region) {
3132
case 'Asia':
@@ -40,6 +41,8 @@ function getRegionSubdomainSuffix() {
4041
case 'Arctic':
4142
return REGION_SUBDOMAIN_SUFFIX['EU'];
4243
case 'America':
44+
case 'US':
45+
case 'Canada':
4346
return REGION_SUBDOMAIN_SUFFIX['US'];
4447
default:
4548
return REGION_SUBDOMAIN_SUFFIX['EU'];
@@ -55,11 +58,10 @@ export function createDomain() {
5558
return `https://${subDomain}.screencore.io`;
5659
}
5760

58-
const AD_URL = `${createDomain()}/prebid`;
59-
6061
const placementProcessingFunction = buildPlacementProcessingFunction();
6162

6263
const buildRequests = (validBidRequests = [], bidderRequest = {}) => {
64+
const AD_URL = `${createDomain()}/pbjs`;
6365
return buildRequestsBase({ adUrl: AD_URL, validBidRequests, bidderRequest, placementProcessingFunction });
6466
};
6567

test/spec/modules/screencoreBidAdapter_spec.js

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ describe('screencore bid adapter', function () {
227227
const requests = adapter.buildRequests([BID], BIDDER_REQUEST);
228228
expect(requests).to.exist;
229229
expect(requests.method).to.equal('POST');
230-
expect(requests.url).to.include('screencore.io/prebid');
230+
expect(requests.url).to.include('screencore.io/pbjs');
231231
expect(requests.data).to.exist;
232232
expect(requests.data.placements).to.be.an('array');
233233
expect(requests.data.placements[0].bidId).to.equal(BID.bidId);
@@ -394,5 +394,38 @@ describe('screencore bid adapter', function () {
394394

395395
stub.restore();
396396
});
397+
398+
it('should return correct domain for US/ prefixed timezone', function () {
399+
const stub = sinon.stub(Intl, 'DateTimeFormat').returns({
400+
resolvedOptions: () => ({ timeZone: 'US/Eastern' })
401+
});
402+
403+
const domain = createDomain();
404+
expect(domain).to.equal('https://taqus.screencore.io');
405+
406+
stub.restore();
407+
});
408+
409+
it('should return correct domain for Canada/ prefixed timezone', function () {
410+
const stub = sinon.stub(Intl, 'DateTimeFormat').returns({
411+
resolvedOptions: () => ({ timeZone: 'Canada/Eastern' })
412+
});
413+
414+
const domain = createDomain();
415+
expect(domain).to.equal('https://taqus.screencore.io');
416+
417+
stub.restore();
418+
});
419+
420+
it('should return EU domain as default for unknown timezone', function () {
421+
const stub = sinon.stub(Intl, 'DateTimeFormat').returns({
422+
resolvedOptions: () => ({ timeZone: 'UTC' })
423+
});
424+
425+
const domain = createDomain();
426+
expect(domain).to.equal('https://taqeu.screencore.io');
427+
428+
stub.restore();
429+
});
397430
});
398431
});

0 commit comments

Comments
 (0)