@blotoutio/providers-at-label-sdk 0.48.0 → 0.49.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 +21 -138
- package/index.js +21 -138
- package/index.mjs +21 -138
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -2,154 +2,38 @@
|
|
|
2
2
|
|
|
3
3
|
const packageName = 'atLabel';
|
|
4
4
|
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const resolve = (value) => {
|
|
18
|
-
clearTimeout(timeout);
|
|
19
|
-
switch (value) {
|
|
20
|
-
case 'ERROR': {
|
|
21
|
-
return internalResolve('error');
|
|
22
|
-
}
|
|
23
|
-
case 'BLOCKED': {
|
|
24
|
-
if (states.includes(XMLHttpRequest.HEADERS_RECEIVED)) {
|
|
25
|
-
return internalResolve('extension');
|
|
26
|
-
}
|
|
27
|
-
return internalResolve('browser');
|
|
28
|
-
}
|
|
29
|
-
case 'ALLOWED': {
|
|
30
|
-
return internalResolve('allowed');
|
|
31
|
-
}
|
|
32
|
-
case 'TIMEOUT': {
|
|
33
|
-
return internalResolve('timeout');
|
|
34
|
-
}
|
|
35
|
-
default: {
|
|
36
|
-
return internalResolve('unknown');
|
|
37
|
-
}
|
|
5
|
+
const getCookieValue = (key) => {
|
|
6
|
+
try {
|
|
7
|
+
if (!document || !document.cookie) {
|
|
8
|
+
return '';
|
|
9
|
+
}
|
|
10
|
+
const name = `${key}=`;
|
|
11
|
+
const decodedCookie = decodeURIComponent(document.cookie);
|
|
12
|
+
const ca = decodedCookie.split(';');
|
|
13
|
+
for (let i = 0; i < ca.length; i++) {
|
|
14
|
+
let c = ca[i];
|
|
15
|
+
while (c.charAt(0) === ' ') {
|
|
16
|
+
c = c.substring(1);
|
|
38
17
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
xhr.onreadystatechange = function () {
|
|
42
|
-
states.push(xhr.readyState);
|
|
43
|
-
if (xhr.readyState == XMLHttpRequest.DONE) {
|
|
44
|
-
if (xhr.status === 0 || xhr.responseURL !== url) {
|
|
45
|
-
resolve('BLOCKED');
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
if (xhr.readyState == 4 && xhr.status == 200) {
|
|
49
|
-
resolve('ALLOWED');
|
|
50
|
-
}
|
|
18
|
+
if (c.indexOf(name) === 0) {
|
|
19
|
+
return c.substring(name.length, c.length);
|
|
51
20
|
}
|
|
52
|
-
};
|
|
53
|
-
try {
|
|
54
|
-
xhr.open('HEAD', url, true);
|
|
55
|
-
xhr.send(null);
|
|
56
21
|
}
|
|
57
|
-
|
|
58
|
-
resolve('ERROR');
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
const canLog = () => {
|
|
64
|
-
try {
|
|
65
|
-
return localStorage.getItem('edgeTagDebug') === '1';
|
|
22
|
+
return '';
|
|
66
23
|
}
|
|
67
24
|
catch {
|
|
68
|
-
return
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
const logger = {
|
|
72
|
-
log: (...args) => {
|
|
73
|
-
if (canLog()) {
|
|
74
|
-
console.log(...args);
|
|
75
|
-
}
|
|
76
|
-
},
|
|
77
|
-
error: (...args) => {
|
|
78
|
-
if (canLog()) {
|
|
79
|
-
console.error(...args);
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
info: (...args) => {
|
|
83
|
-
if (canLog()) {
|
|
84
|
-
console.info(...args);
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
trace: (...args) => {
|
|
88
|
-
if (canLog()) {
|
|
89
|
-
console.trace(...args);
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
table: (...args) => {
|
|
93
|
-
if (canLog()) {
|
|
94
|
-
console.table(...args);
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
dir: (...args) => {
|
|
98
|
-
if (canLog()) {
|
|
99
|
-
console.dir(...args);
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
const init = () => {
|
|
105
|
-
try {
|
|
106
|
-
if (sessionStorage && !sessionStorage.getItem('attentiveLoaded')) {
|
|
107
|
-
loaded();
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
catch (error) {
|
|
111
|
-
logger.error(error);
|
|
25
|
+
return '';
|
|
112
26
|
}
|
|
113
27
|
};
|
|
114
28
|
|
|
115
|
-
const sdkVersion = "0.
|
|
116
|
-
const getCookie = (cookie, cookieName) => {
|
|
117
|
-
if (!cookie) {
|
|
118
|
-
return null;
|
|
119
|
-
}
|
|
120
|
-
const name = cookieName + '=';
|
|
121
|
-
const decodedCookie = decodeURIComponent(cookie);
|
|
122
|
-
const ca = decodedCookie.split(';');
|
|
123
|
-
for (let i = 0; i < ca.length; i++) {
|
|
124
|
-
let c = ca[i];
|
|
125
|
-
while (c.charAt(0) === ' ') {
|
|
126
|
-
c = c.substring(1);
|
|
127
|
-
}
|
|
128
|
-
if (c.indexOf(name) === 0) {
|
|
129
|
-
return c.substring(name.length, c.length);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
return null;
|
|
133
|
-
};
|
|
29
|
+
const sdkVersion = "0.49.0" ;
|
|
134
30
|
const tag = () => {
|
|
135
31
|
let visitorId = '';
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
const visitorIdCookie = getCookie(cookie, '__attentive_id');
|
|
140
|
-
if (visitorIdCookie) {
|
|
141
|
-
visitorId = visitorIdCookie;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
catch {
|
|
145
|
-
// do nothing
|
|
146
|
-
}
|
|
147
|
-
try {
|
|
148
|
-
sdkStatus = sessionStorage.getItem('attentiveLoaded') || 'none';
|
|
149
|
-
}
|
|
150
|
-
catch {
|
|
151
|
-
// do nothing
|
|
32
|
+
const visitorIdCookie = getCookieValue('__attentive_id');
|
|
33
|
+
if (visitorIdCookie) {
|
|
34
|
+
visitorId = visitorIdCookie;
|
|
152
35
|
}
|
|
36
|
+
const sdkStatus = getCookieValue('_attn_bopd_') || 'none';
|
|
153
37
|
return {
|
|
154
38
|
sdkVersion,
|
|
155
39
|
visitorId,
|
|
@@ -161,7 +45,6 @@ const tag = () => {
|
|
|
161
45
|
const data = {
|
|
162
46
|
name: packageName,
|
|
163
47
|
tag,
|
|
164
|
-
init,
|
|
165
48
|
};
|
|
166
49
|
try {
|
|
167
50
|
if (window) {
|
package/index.js
CHANGED
|
@@ -3,154 +3,38 @@ var ProvidersAtLabelSdk = (function () {
|
|
|
3
3
|
|
|
4
4
|
const packageName = 'atLabel';
|
|
5
5
|
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const resolve = (value) => {
|
|
19
|
-
clearTimeout(timeout);
|
|
20
|
-
switch (value) {
|
|
21
|
-
case 'ERROR': {
|
|
22
|
-
return internalResolve('error');
|
|
23
|
-
}
|
|
24
|
-
case 'BLOCKED': {
|
|
25
|
-
if (states.includes(XMLHttpRequest.HEADERS_RECEIVED)) {
|
|
26
|
-
return internalResolve('extension');
|
|
27
|
-
}
|
|
28
|
-
return internalResolve('browser');
|
|
29
|
-
}
|
|
30
|
-
case 'ALLOWED': {
|
|
31
|
-
return internalResolve('allowed');
|
|
32
|
-
}
|
|
33
|
-
case 'TIMEOUT': {
|
|
34
|
-
return internalResolve('timeout');
|
|
35
|
-
}
|
|
36
|
-
default: {
|
|
37
|
-
return internalResolve('unknown');
|
|
38
|
-
}
|
|
6
|
+
const getCookieValue = (key) => {
|
|
7
|
+
try {
|
|
8
|
+
if (!document || !document.cookie) {
|
|
9
|
+
return '';
|
|
10
|
+
}
|
|
11
|
+
const name = `${key}=`;
|
|
12
|
+
const decodedCookie = decodeURIComponent(document.cookie);
|
|
13
|
+
const ca = decodedCookie.split(';');
|
|
14
|
+
for (let i = 0; i < ca.length; i++) {
|
|
15
|
+
let c = ca[i];
|
|
16
|
+
while (c.charAt(0) === ' ') {
|
|
17
|
+
c = c.substring(1);
|
|
39
18
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
xhr.onreadystatechange = function () {
|
|
43
|
-
states.push(xhr.readyState);
|
|
44
|
-
if (xhr.readyState == XMLHttpRequest.DONE) {
|
|
45
|
-
if (xhr.status === 0 || xhr.responseURL !== url) {
|
|
46
|
-
resolve('BLOCKED');
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
if (xhr.readyState == 4 && xhr.status == 200) {
|
|
50
|
-
resolve('ALLOWED');
|
|
51
|
-
}
|
|
19
|
+
if (c.indexOf(name) === 0) {
|
|
20
|
+
return c.substring(name.length, c.length);
|
|
52
21
|
}
|
|
53
|
-
};
|
|
54
|
-
try {
|
|
55
|
-
xhr.open('HEAD', url, true);
|
|
56
|
-
xhr.send(null);
|
|
57
22
|
}
|
|
58
|
-
|
|
59
|
-
resolve('ERROR');
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
const canLog = () => {
|
|
65
|
-
try {
|
|
66
|
-
return localStorage.getItem('edgeTagDebug') === '1';
|
|
23
|
+
return '';
|
|
67
24
|
}
|
|
68
25
|
catch {
|
|
69
|
-
return
|
|
26
|
+
return '';
|
|
70
27
|
}
|
|
71
28
|
};
|
|
72
|
-
const logger = {
|
|
73
|
-
log: (...args) => {
|
|
74
|
-
if (canLog()) {
|
|
75
|
-
console.log(...args);
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
error: (...args) => {
|
|
79
|
-
if (canLog()) {
|
|
80
|
-
console.error(...args);
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
info: (...args) => {
|
|
84
|
-
if (canLog()) {
|
|
85
|
-
console.info(...args);
|
|
86
|
-
}
|
|
87
|
-
},
|
|
88
|
-
trace: (...args) => {
|
|
89
|
-
if (canLog()) {
|
|
90
|
-
console.trace(...args);
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
table: (...args) => {
|
|
94
|
-
if (canLog()) {
|
|
95
|
-
console.table(...args);
|
|
96
|
-
}
|
|
97
|
-
},
|
|
98
|
-
dir: (...args) => {
|
|
99
|
-
if (canLog()) {
|
|
100
|
-
console.dir(...args);
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
};
|
|
104
29
|
|
|
105
|
-
const
|
|
106
|
-
try {
|
|
107
|
-
if (sessionStorage && !sessionStorage.getItem('attentiveLoaded')) {
|
|
108
|
-
loaded();
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
catch (error) {
|
|
112
|
-
logger.error(error);
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
const sdkVersion = "0.48.0" ;
|
|
117
|
-
const getCookie = (cookie, cookieName) => {
|
|
118
|
-
if (!cookie) {
|
|
119
|
-
return null;
|
|
120
|
-
}
|
|
121
|
-
const name = cookieName + '=';
|
|
122
|
-
const decodedCookie = decodeURIComponent(cookie);
|
|
123
|
-
const ca = decodedCookie.split(';');
|
|
124
|
-
for (let i = 0; i < ca.length; i++) {
|
|
125
|
-
let c = ca[i];
|
|
126
|
-
while (c.charAt(0) === ' ') {
|
|
127
|
-
c = c.substring(1);
|
|
128
|
-
}
|
|
129
|
-
if (c.indexOf(name) === 0) {
|
|
130
|
-
return c.substring(name.length, c.length);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
return null;
|
|
134
|
-
};
|
|
30
|
+
const sdkVersion = "0.49.0" ;
|
|
135
31
|
const tag = () => {
|
|
136
32
|
let visitorId = '';
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
const visitorIdCookie = getCookie(cookie, '__attentive_id');
|
|
141
|
-
if (visitorIdCookie) {
|
|
142
|
-
visitorId = visitorIdCookie;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
catch {
|
|
146
|
-
// do nothing
|
|
147
|
-
}
|
|
148
|
-
try {
|
|
149
|
-
sdkStatus = sessionStorage.getItem('attentiveLoaded') || 'none';
|
|
150
|
-
}
|
|
151
|
-
catch {
|
|
152
|
-
// do nothing
|
|
33
|
+
const visitorIdCookie = getCookieValue('__attentive_id');
|
|
34
|
+
if (visitorIdCookie) {
|
|
35
|
+
visitorId = visitorIdCookie;
|
|
153
36
|
}
|
|
37
|
+
const sdkStatus = getCookieValue('_attn_bopd_') || 'none';
|
|
154
38
|
return {
|
|
155
39
|
sdkVersion,
|
|
156
40
|
visitorId,
|
|
@@ -162,7 +46,6 @@ var ProvidersAtLabelSdk = (function () {
|
|
|
162
46
|
const data = {
|
|
163
47
|
name: packageName,
|
|
164
48
|
tag,
|
|
165
|
-
init,
|
|
166
49
|
};
|
|
167
50
|
try {
|
|
168
51
|
if (window) {
|
package/index.mjs
CHANGED
|
@@ -1,153 +1,37 @@
|
|
|
1
1
|
const packageName = 'atLabel';
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const resolve = (value) => {
|
|
16
|
-
clearTimeout(timeout);
|
|
17
|
-
switch (value) {
|
|
18
|
-
case 'ERROR': {
|
|
19
|
-
return internalResolve('error');
|
|
20
|
-
}
|
|
21
|
-
case 'BLOCKED': {
|
|
22
|
-
if (states.includes(XMLHttpRequest.HEADERS_RECEIVED)) {
|
|
23
|
-
return internalResolve('extension');
|
|
24
|
-
}
|
|
25
|
-
return internalResolve('browser');
|
|
26
|
-
}
|
|
27
|
-
case 'ALLOWED': {
|
|
28
|
-
return internalResolve('allowed');
|
|
29
|
-
}
|
|
30
|
-
case 'TIMEOUT': {
|
|
31
|
-
return internalResolve('timeout');
|
|
32
|
-
}
|
|
33
|
-
default: {
|
|
34
|
-
return internalResolve('unknown');
|
|
35
|
-
}
|
|
3
|
+
const getCookieValue = (key) => {
|
|
4
|
+
try {
|
|
5
|
+
if (!document || !document.cookie) {
|
|
6
|
+
return '';
|
|
7
|
+
}
|
|
8
|
+
const name = `${key}=`;
|
|
9
|
+
const decodedCookie = decodeURIComponent(document.cookie);
|
|
10
|
+
const ca = decodedCookie.split(';');
|
|
11
|
+
for (let i = 0; i < ca.length; i++) {
|
|
12
|
+
let c = ca[i];
|
|
13
|
+
while (c.charAt(0) === ' ') {
|
|
14
|
+
c = c.substring(1);
|
|
36
15
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
xhr.onreadystatechange = function () {
|
|
40
|
-
states.push(xhr.readyState);
|
|
41
|
-
if (xhr.readyState == XMLHttpRequest.DONE) {
|
|
42
|
-
if (xhr.status === 0 || xhr.responseURL !== url) {
|
|
43
|
-
resolve('BLOCKED');
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
if (xhr.readyState == 4 && xhr.status == 200) {
|
|
47
|
-
resolve('ALLOWED');
|
|
48
|
-
}
|
|
16
|
+
if (c.indexOf(name) === 0) {
|
|
17
|
+
return c.substring(name.length, c.length);
|
|
49
18
|
}
|
|
50
|
-
};
|
|
51
|
-
try {
|
|
52
|
-
xhr.open('HEAD', url, true);
|
|
53
|
-
xhr.send(null);
|
|
54
19
|
}
|
|
55
|
-
|
|
56
|
-
resolve('ERROR');
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
const canLog = () => {
|
|
62
|
-
try {
|
|
63
|
-
return localStorage.getItem('edgeTagDebug') === '1';
|
|
20
|
+
return '';
|
|
64
21
|
}
|
|
65
22
|
catch {
|
|
66
|
-
return
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
const logger = {
|
|
70
|
-
log: (...args) => {
|
|
71
|
-
if (canLog()) {
|
|
72
|
-
console.log(...args);
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
error: (...args) => {
|
|
76
|
-
if (canLog()) {
|
|
77
|
-
console.error(...args);
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
info: (...args) => {
|
|
81
|
-
if (canLog()) {
|
|
82
|
-
console.info(...args);
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
trace: (...args) => {
|
|
86
|
-
if (canLog()) {
|
|
87
|
-
console.trace(...args);
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
table: (...args) => {
|
|
91
|
-
if (canLog()) {
|
|
92
|
-
console.table(...args);
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
dir: (...args) => {
|
|
96
|
-
if (canLog()) {
|
|
97
|
-
console.dir(...args);
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
const init = () => {
|
|
103
|
-
try {
|
|
104
|
-
if (sessionStorage && !sessionStorage.getItem('attentiveLoaded')) {
|
|
105
|
-
loaded();
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
catch (error) {
|
|
109
|
-
logger.error(error);
|
|
23
|
+
return '';
|
|
110
24
|
}
|
|
111
25
|
};
|
|
112
26
|
|
|
113
|
-
const sdkVersion = "0.
|
|
114
|
-
const getCookie = (cookie, cookieName) => {
|
|
115
|
-
if (!cookie) {
|
|
116
|
-
return null;
|
|
117
|
-
}
|
|
118
|
-
const name = cookieName + '=';
|
|
119
|
-
const decodedCookie = decodeURIComponent(cookie);
|
|
120
|
-
const ca = decodedCookie.split(';');
|
|
121
|
-
for (let i = 0; i < ca.length; i++) {
|
|
122
|
-
let c = ca[i];
|
|
123
|
-
while (c.charAt(0) === ' ') {
|
|
124
|
-
c = c.substring(1);
|
|
125
|
-
}
|
|
126
|
-
if (c.indexOf(name) === 0) {
|
|
127
|
-
return c.substring(name.length, c.length);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
return null;
|
|
131
|
-
};
|
|
27
|
+
const sdkVersion = "0.49.0" ;
|
|
132
28
|
const tag = () => {
|
|
133
29
|
let visitorId = '';
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
const visitorIdCookie = getCookie(cookie, '__attentive_id');
|
|
138
|
-
if (visitorIdCookie) {
|
|
139
|
-
visitorId = visitorIdCookie;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
catch {
|
|
143
|
-
// do nothing
|
|
144
|
-
}
|
|
145
|
-
try {
|
|
146
|
-
sdkStatus = sessionStorage.getItem('attentiveLoaded') || 'none';
|
|
147
|
-
}
|
|
148
|
-
catch {
|
|
149
|
-
// do nothing
|
|
30
|
+
const visitorIdCookie = getCookieValue('__attentive_id');
|
|
31
|
+
if (visitorIdCookie) {
|
|
32
|
+
visitorId = visitorIdCookie;
|
|
150
33
|
}
|
|
34
|
+
const sdkStatus = getCookieValue('_attn_bopd_') || 'none';
|
|
151
35
|
return {
|
|
152
36
|
sdkVersion,
|
|
153
37
|
visitorId,
|
|
@@ -159,7 +43,6 @@ const tag = () => {
|
|
|
159
43
|
const data = {
|
|
160
44
|
name: packageName,
|
|
161
45
|
tag,
|
|
162
|
-
init,
|
|
163
46
|
};
|
|
164
47
|
try {
|
|
165
48
|
if (window) {
|