@blotoutio/providers-universal-ads-sdk 1.46.1 → 1.47.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/index.cjs.js CHANGED
@@ -451,12 +451,24 @@ const getUrl = (mapping, buzzKey, accountId) => {
451
451
  url.searchParams.set('ord', cacheBuster.toString());
452
452
  return url.toString();
453
453
  };
454
- const initUniversalAds = (accountId, buzzKey, urlMapping) => {
454
+ const initUniversalAds = (accountId, buzzKey, urlMapping, pageUrl) => {
455
455
  var _a;
456
456
  if (typeof document == 'undefined') {
457
457
  return;
458
458
  }
459
- const url = window.location.origin + window.location.pathname;
459
+ let url;
460
+ if (pageUrl) {
461
+ try {
462
+ const parsed = new URL(pageUrl);
463
+ url = parsed.origin + parsed.pathname;
464
+ }
465
+ catch {
466
+ url = window.location.origin + window.location.pathname;
467
+ }
468
+ }
469
+ else {
470
+ url = window.location.origin + window.location.pathname;
471
+ }
460
472
  try {
461
473
  const mapping = getUrlMapping(urlMapping, url);
462
474
  if (mapping) {
@@ -478,7 +490,7 @@ const initUniversalAds = (accountId, buzzKey, urlMapping) => {
478
490
  logger.log('Not able to parse the URL mapping for Universal Ads');
479
491
  }
480
492
  };
481
- const init = ({ manifest }) => {
493
+ const init = ({ manifest, pageUrl }) => {
482
494
  if (typeof window == 'undefined' ||
483
495
  !manifest.variables ||
484
496
  manifest.variables['enableBrowser'] !== '1' ||
@@ -487,7 +499,7 @@ const init = ({ manifest }) => {
487
499
  !manifest.variables['urlMapping']) {
488
500
  return;
489
501
  }
490
- initUniversalAds(manifest.variables['accountId'], manifest.variables['buzzKey'], manifest.variables['urlMapping']);
502
+ initUniversalAds(manifest.variables['accountId'], manifest.variables['buzzKey'], manifest.variables['urlMapping'], pageUrl);
491
503
  };
492
504
 
493
505
  // eslint-disable-next-line @nx/enforce-module-boundaries
package/index.js CHANGED
@@ -452,12 +452,24 @@ var ProvidersUniversalAdsSdk = (function () {
452
452
  url.searchParams.set('ord', cacheBuster.toString());
453
453
  return url.toString();
454
454
  };
455
- const initUniversalAds = (accountId, buzzKey, urlMapping) => {
455
+ const initUniversalAds = (accountId, buzzKey, urlMapping, pageUrl) => {
456
456
  var _a;
457
457
  if (typeof document == 'undefined') {
458
458
  return;
459
459
  }
460
- const url = window.location.origin + window.location.pathname;
460
+ let url;
461
+ if (pageUrl) {
462
+ try {
463
+ const parsed = new URL(pageUrl);
464
+ url = parsed.origin + parsed.pathname;
465
+ }
466
+ catch {
467
+ url = window.location.origin + window.location.pathname;
468
+ }
469
+ }
470
+ else {
471
+ url = window.location.origin + window.location.pathname;
472
+ }
461
473
  try {
462
474
  const mapping = getUrlMapping(urlMapping, url);
463
475
  if (mapping) {
@@ -479,7 +491,7 @@ var ProvidersUniversalAdsSdk = (function () {
479
491
  logger.log('Not able to parse the URL mapping for Universal Ads');
480
492
  }
481
493
  };
482
- const init = ({ manifest }) => {
494
+ const init = ({ manifest, pageUrl }) => {
483
495
  if (typeof window == 'undefined' ||
484
496
  !manifest.variables ||
485
497
  manifest.variables['enableBrowser'] !== '1' ||
@@ -488,7 +500,7 @@ var ProvidersUniversalAdsSdk = (function () {
488
500
  !manifest.variables['urlMapping']) {
489
501
  return;
490
502
  }
491
- initUniversalAds(manifest.variables['accountId'], manifest.variables['buzzKey'], manifest.variables['urlMapping']);
503
+ initUniversalAds(manifest.variables['accountId'], manifest.variables['buzzKey'], manifest.variables['urlMapping'], pageUrl);
492
504
  };
493
505
 
494
506
  // eslint-disable-next-line @nx/enforce-module-boundaries
package/index.mjs CHANGED
@@ -449,12 +449,24 @@ const getUrl = (mapping, buzzKey, accountId) => {
449
449
  url.searchParams.set('ord', cacheBuster.toString());
450
450
  return url.toString();
451
451
  };
452
- const initUniversalAds = (accountId, buzzKey, urlMapping) => {
452
+ const initUniversalAds = (accountId, buzzKey, urlMapping, pageUrl) => {
453
453
  var _a;
454
454
  if (typeof document == 'undefined') {
455
455
  return;
456
456
  }
457
- const url = window.location.origin + window.location.pathname;
457
+ let url;
458
+ if (pageUrl) {
459
+ try {
460
+ const parsed = new URL(pageUrl);
461
+ url = parsed.origin + parsed.pathname;
462
+ }
463
+ catch {
464
+ url = window.location.origin + window.location.pathname;
465
+ }
466
+ }
467
+ else {
468
+ url = window.location.origin + window.location.pathname;
469
+ }
458
470
  try {
459
471
  const mapping = getUrlMapping(urlMapping, url);
460
472
  if (mapping) {
@@ -476,7 +488,7 @@ const initUniversalAds = (accountId, buzzKey, urlMapping) => {
476
488
  logger.log('Not able to parse the URL mapping for Universal Ads');
477
489
  }
478
490
  };
479
- const init = ({ manifest }) => {
491
+ const init = ({ manifest, pageUrl }) => {
480
492
  if (typeof window == 'undefined' ||
481
493
  !manifest.variables ||
482
494
  manifest.variables['enableBrowser'] !== '1' ||
@@ -485,7 +497,7 @@ const init = ({ manifest }) => {
485
497
  !manifest.variables['urlMapping']) {
486
498
  return;
487
499
  }
488
- initUniversalAds(manifest.variables['accountId'], manifest.variables['buzzKey'], manifest.variables['urlMapping']);
500
+ initUniversalAds(manifest.variables['accountId'], manifest.variables['buzzKey'], manifest.variables['urlMapping'], pageUrl);
489
501
  };
490
502
 
491
503
  // eslint-disable-next-line @nx/enforce-module-boundaries
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blotoutio/providers-universal-ads-sdk",
3
- "version": "1.46.1",
3
+ "version": "1.47.0",
4
4
  "description": "Universal Ads Browser SDK for EdgeTag",
5
5
  "author": "Blotout",
6
6
  "license": "MIT",