@blotoutio/providers-onescreen-ai-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
@@ -440,12 +440,24 @@ const getSourceName = (sourceMapping, url) => {
440
440
  return match ? match.source : null;
441
441
  };
442
442
 
443
- const initOneScreen = (offerId, affId, sourceMapping) => {
443
+ const initOneScreen = (offerId, affId, sourceMapping, pageUrl) => {
444
444
  var _a;
445
445
  if (typeof document == 'undefined') {
446
446
  return;
447
447
  }
448
- const url = window.location.origin + window.location.pathname;
448
+ let url;
449
+ if (pageUrl) {
450
+ try {
451
+ const parsed = new URL(pageUrl);
452
+ url = parsed.origin + parsed.pathname;
453
+ }
454
+ catch {
455
+ url = window.location.origin + window.location.pathname;
456
+ }
457
+ }
458
+ else {
459
+ url = window.location.origin + window.location.pathname;
460
+ }
449
461
  try {
450
462
  const source = getSourceName(sourceMapping, url);
451
463
  if (source) {
@@ -467,7 +479,7 @@ const initOneScreen = (offerId, affId, sourceMapping) => {
467
479
  logger.log('Not able to parse the Source and URL form Array');
468
480
  }
469
481
  };
470
- const init = ({ manifest }) => {
482
+ const init = ({ manifest, pageUrl }) => {
471
483
  if (typeof window == 'undefined' ||
472
484
  !manifest.variables ||
473
485
  manifest.variables['enableBrowser'] !== '1' ||
@@ -476,7 +488,7 @@ const init = ({ manifest }) => {
476
488
  !manifest.variables['sourceMapping']) {
477
489
  return;
478
490
  }
479
- initOneScreen(manifest.variables['offerId'], manifest.variables['affId'], manifest.variables['sourceMapping']);
491
+ initOneScreen(manifest.variables['offerId'], manifest.variables['affId'], manifest.variables['sourceMapping'], pageUrl);
480
492
  };
481
493
 
482
494
  // eslint-disable-next-line @nx/enforce-module-boundaries
package/index.js CHANGED
@@ -441,12 +441,24 @@ var ProvidersOnescreenAiSdk = (function () {
441
441
  return match ? match.source : null;
442
442
  };
443
443
 
444
- const initOneScreen = (offerId, affId, sourceMapping) => {
444
+ const initOneScreen = (offerId, affId, sourceMapping, pageUrl) => {
445
445
  var _a;
446
446
  if (typeof document == 'undefined') {
447
447
  return;
448
448
  }
449
- const url = window.location.origin + window.location.pathname;
449
+ let url;
450
+ if (pageUrl) {
451
+ try {
452
+ const parsed = new URL(pageUrl);
453
+ url = parsed.origin + parsed.pathname;
454
+ }
455
+ catch {
456
+ url = window.location.origin + window.location.pathname;
457
+ }
458
+ }
459
+ else {
460
+ url = window.location.origin + window.location.pathname;
461
+ }
450
462
  try {
451
463
  const source = getSourceName(sourceMapping, url);
452
464
  if (source) {
@@ -468,7 +480,7 @@ var ProvidersOnescreenAiSdk = (function () {
468
480
  logger.log('Not able to parse the Source and URL form Array');
469
481
  }
470
482
  };
471
- const init = ({ manifest }) => {
483
+ const init = ({ manifest, pageUrl }) => {
472
484
  if (typeof window == 'undefined' ||
473
485
  !manifest.variables ||
474
486
  manifest.variables['enableBrowser'] !== '1' ||
@@ -477,7 +489,7 @@ var ProvidersOnescreenAiSdk = (function () {
477
489
  !manifest.variables['sourceMapping']) {
478
490
  return;
479
491
  }
480
- initOneScreen(manifest.variables['offerId'], manifest.variables['affId'], manifest.variables['sourceMapping']);
492
+ initOneScreen(manifest.variables['offerId'], manifest.variables['affId'], manifest.variables['sourceMapping'], pageUrl);
481
493
  };
482
494
 
483
495
  // eslint-disable-next-line @nx/enforce-module-boundaries
package/index.mjs CHANGED
@@ -438,12 +438,24 @@ const getSourceName = (sourceMapping, url) => {
438
438
  return match ? match.source : null;
439
439
  };
440
440
 
441
- const initOneScreen = (offerId, affId, sourceMapping) => {
441
+ const initOneScreen = (offerId, affId, sourceMapping, pageUrl) => {
442
442
  var _a;
443
443
  if (typeof document == 'undefined') {
444
444
  return;
445
445
  }
446
- const url = window.location.origin + window.location.pathname;
446
+ let url;
447
+ if (pageUrl) {
448
+ try {
449
+ const parsed = new URL(pageUrl);
450
+ url = parsed.origin + parsed.pathname;
451
+ }
452
+ catch {
453
+ url = window.location.origin + window.location.pathname;
454
+ }
455
+ }
456
+ else {
457
+ url = window.location.origin + window.location.pathname;
458
+ }
447
459
  try {
448
460
  const source = getSourceName(sourceMapping, url);
449
461
  if (source) {
@@ -465,7 +477,7 @@ const initOneScreen = (offerId, affId, sourceMapping) => {
465
477
  logger.log('Not able to parse the Source and URL form Array');
466
478
  }
467
479
  };
468
- const init = ({ manifest }) => {
480
+ const init = ({ manifest, pageUrl }) => {
469
481
  if (typeof window == 'undefined' ||
470
482
  !manifest.variables ||
471
483
  manifest.variables['enableBrowser'] !== '1' ||
@@ -474,7 +486,7 @@ const init = ({ manifest }) => {
474
486
  !manifest.variables['sourceMapping']) {
475
487
  return;
476
488
  }
477
- initOneScreen(manifest.variables['offerId'], manifest.variables['affId'], manifest.variables['sourceMapping']);
489
+ initOneScreen(manifest.variables['offerId'], manifest.variables['affId'], manifest.variables['sourceMapping'], pageUrl);
478
490
  };
479
491
 
480
492
  // eslint-disable-next-line @nx/enforce-module-boundaries
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blotoutio/providers-onescreen-ai-sdk",
3
- "version": "1.46.1",
3
+ "version": "1.47.0",
4
4
  "description": "OnescreenAI Browser SDK for EdgeTag",
5
5
  "author": "Blotout",
6
6
  "license": "MIT",