Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@blotoutio/providers-attentive-sdk

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@blotoutio/providers-attentive-sdk - npm Package Compare versions

Comparing version 0.44.0 to 0.44.1

116

index.cjs.js

@@ -5,6 +5,118 @@ 'use strict';

const sdkVersion = "0.44.0" ;
const loaded = () => {
checks().then((result) => {
sessionStorage.setItem('attentiveLoaded', result);
});
};
const checks = () => {
const url = 'https://cdn.attn.tv/offersbytext/dtag.js';
return new Promise((internalResolve) => {
const states = [];
const timeout = setTimeout(() => {
resolve('TIMEOUT');
}, 5000);
const resolve = (value) => {
clearTimeout(timeout);
switch (value) {
case 'ERROR': {
return internalResolve('error');
}
case 'BLOCKED': {
if (states.includes(XMLHttpRequest.HEADERS_RECEIVED)) {
return internalResolve('extension');
}
return internalResolve('browser');
}
case 'ALLOWED': {
return internalResolve('allowed');
}
case 'TIMEOUT': {
return internalResolve('timeout');
}
default: {
return internalResolve('unknown');
}
}
};
const xhr = new XMLHttpRequest();
xhr.onreadystatechange = function () {
states.push(xhr.readyState);
if (xhr.readyState == XMLHttpRequest.DONE) {
if (xhr.status === 0 || xhr.responseURL !== url) {
resolve('BLOCKED');
return;
}
if (xhr.readyState == 4 && xhr.status == 200) {
resolve('ALLOWED');
}
}
};
try {
xhr.open('HEAD', url, true);
xhr.send(null);
}
catch (e) {
resolve('ERROR');
}
});
};
const canLog = () => {
try {
return localStorage.getItem('edgeTagDebug') === '1';
}
catch {
return false;
}
};
const logger = {
log: (...args) => {
if (canLog()) {
console.log(...args);
}
},
error: (...args) => {
if (canLog()) {
console.error(...args);
}
},
info: (...args) => {
if (canLog()) {
console.info(...args);
}
},
trace: (...args) => {
if (canLog()) {
console.trace(...args);
}
},
table: (...args) => {
if (canLog()) {
console.table(...args);
}
},
dir: (...args) => {
if (canLog()) {
console.dir(...args);
}
},
};
const init = () => {
try {
if (sessionStorage && !sessionStorage.getItem('attentiveLoaded')) {
loaded();
}
}
catch (error) {
logger.error(error);
}
};
const sdkVersion = "0.44.1" ;
const tag = () => {
let sdkStatus = 'none';
let sdkStatus2 = 'none';
try {
sdkStatus2 = sessionStorage.getItem('attentiveLoaded') || 'none';
const tagScript = document.querySelector('script[src*="dtag.js"]');

@@ -24,2 +136,3 @@ if (tagScript) {

sdkStatus,
sdkStatus2,
};

@@ -31,2 +144,3 @@ };

name: packageName,
init,
tag,

@@ -33,0 +147,0 @@ };

@@ -6,6 +6,118 @@ var ProvidersAttentiveSdk = (function () {

const sdkVersion = "0.44.0" ;
const loaded = () => {
checks().then((result) => {
sessionStorage.setItem('attentiveLoaded', result);
});
};
const checks = () => {
const url = 'https://cdn.attn.tv/offersbytext/dtag.js';
return new Promise((internalResolve) => {
const states = [];
const timeout = setTimeout(() => {
resolve('TIMEOUT');
}, 5000);
const resolve = (value) => {
clearTimeout(timeout);
switch (value) {
case 'ERROR': {
return internalResolve('error');
}
case 'BLOCKED': {
if (states.includes(XMLHttpRequest.HEADERS_RECEIVED)) {
return internalResolve('extension');
}
return internalResolve('browser');
}
case 'ALLOWED': {
return internalResolve('allowed');
}
case 'TIMEOUT': {
return internalResolve('timeout');
}
default: {
return internalResolve('unknown');
}
}
};
const xhr = new XMLHttpRequest();
xhr.onreadystatechange = function () {
states.push(xhr.readyState);
if (xhr.readyState == XMLHttpRequest.DONE) {
if (xhr.status === 0 || xhr.responseURL !== url) {
resolve('BLOCKED');
return;
}
if (xhr.readyState == 4 && xhr.status == 200) {
resolve('ALLOWED');
}
}
};
try {
xhr.open('HEAD', url, true);
xhr.send(null);
}
catch (e) {
resolve('ERROR');
}
});
};
const canLog = () => {
try {
return localStorage.getItem('edgeTagDebug') === '1';
}
catch {
return false;
}
};
const logger = {
log: (...args) => {
if (canLog()) {
console.log(...args);
}
},
error: (...args) => {
if (canLog()) {
console.error(...args);
}
},
info: (...args) => {
if (canLog()) {
console.info(...args);
}
},
trace: (...args) => {
if (canLog()) {
console.trace(...args);
}
},
table: (...args) => {
if (canLog()) {
console.table(...args);
}
},
dir: (...args) => {
if (canLog()) {
console.dir(...args);
}
},
};
const init = () => {
try {
if (sessionStorage && !sessionStorage.getItem('attentiveLoaded')) {
loaded();
}
}
catch (error) {
logger.error(error);
}
};
const sdkVersion = "0.44.1" ;
const tag = () => {
let sdkStatus = 'none';
let sdkStatus2 = 'none';
try {
sdkStatus2 = sessionStorage.getItem('attentiveLoaded') || 'none';
const tagScript = document.querySelector('script[src*="dtag.js"]');

@@ -25,2 +137,3 @@ if (tagScript) {

sdkStatus,
sdkStatus2,
};

@@ -32,2 +145,3 @@ };

name: packageName,
init,
tag,

@@ -34,0 +148,0 @@ };

2

package.json
{
"name": "@blotoutio/providers-attentive-sdk",
"version": "0.44.0",
"version": "0.44.1",
"description": "Attentive Browser SDK for EdgeTag",

@@ -5,0 +5,0 @@ "author": "Blotout",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc