@blotoutio/providers-live-intent-sdk 0.60.0 → 0.61.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 +25 -14
- package/index.js +25 -14
- package/index.mjs +25 -14
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -3,34 +3,45 @@
|
|
|
3
3
|
const packageName = 'liveIntent';
|
|
4
4
|
|
|
5
5
|
const getCookieValue = (key) => {
|
|
6
|
+
var _a;
|
|
6
7
|
try {
|
|
7
8
|
if (!document || !document.cookie) {
|
|
8
9
|
return '';
|
|
9
10
|
}
|
|
10
|
-
const
|
|
11
|
-
|
|
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);
|
|
17
|
-
}
|
|
18
|
-
if (c.indexOf(name) === 0) {
|
|
19
|
-
return c.substring(name.length, c.length);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return '';
|
|
11
|
+
const cookies = parseCookies(document.cookie);
|
|
12
|
+
return (_a = cookies[key]) !== null && _a !== void 0 ? _a : '';
|
|
23
13
|
}
|
|
24
14
|
catch {
|
|
25
15
|
return '';
|
|
26
16
|
}
|
|
27
17
|
};
|
|
18
|
+
const parseCookies = (cookie) => {
|
|
19
|
+
return Object.fromEntries(cookie
|
|
20
|
+
.split(/;\s+/)
|
|
21
|
+
.map((r) => r.split('=').map((str) => str.trim()))
|
|
22
|
+
.map(([cookieKey, cookieValue]) => {
|
|
23
|
+
if (!cookieKey) {
|
|
24
|
+
return [];
|
|
25
|
+
}
|
|
26
|
+
let decodedValue = '';
|
|
27
|
+
if (cookieValue) {
|
|
28
|
+
try {
|
|
29
|
+
decodedValue = decodeURIComponent(cookieValue);
|
|
30
|
+
}
|
|
31
|
+
catch (e) {
|
|
32
|
+
console.log(`Unable to decode cookie ${cookieKey}: ${e}`);
|
|
33
|
+
decodedValue = cookieValue;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return [cookieKey, decodedValue];
|
|
37
|
+
}));
|
|
38
|
+
};
|
|
28
39
|
|
|
29
40
|
const tag = () => {
|
|
30
41
|
const isLoaded = window && window.LI && !!getCookieValue('lidid');
|
|
31
42
|
return {
|
|
32
43
|
loaded: isLoaded,
|
|
33
|
-
sdkVersion: "0.
|
|
44
|
+
sdkVersion: "0.61.0" ,
|
|
34
45
|
};
|
|
35
46
|
};
|
|
36
47
|
|
package/index.js
CHANGED
|
@@ -4,34 +4,45 @@ var ProvidersLiveIntentSdk = (function () {
|
|
|
4
4
|
const packageName = 'liveIntent';
|
|
5
5
|
|
|
6
6
|
const getCookieValue = (key) => {
|
|
7
|
+
var _a;
|
|
7
8
|
try {
|
|
8
9
|
if (!document || !document.cookie) {
|
|
9
10
|
return '';
|
|
10
11
|
}
|
|
11
|
-
const
|
|
12
|
-
|
|
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);
|
|
18
|
-
}
|
|
19
|
-
if (c.indexOf(name) === 0) {
|
|
20
|
-
return c.substring(name.length, c.length);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return '';
|
|
12
|
+
const cookies = parseCookies(document.cookie);
|
|
13
|
+
return (_a = cookies[key]) !== null && _a !== void 0 ? _a : '';
|
|
24
14
|
}
|
|
25
15
|
catch {
|
|
26
16
|
return '';
|
|
27
17
|
}
|
|
28
18
|
};
|
|
19
|
+
const parseCookies = (cookie) => {
|
|
20
|
+
return Object.fromEntries(cookie
|
|
21
|
+
.split(/;\s+/)
|
|
22
|
+
.map((r) => r.split('=').map((str) => str.trim()))
|
|
23
|
+
.map(([cookieKey, cookieValue]) => {
|
|
24
|
+
if (!cookieKey) {
|
|
25
|
+
return [];
|
|
26
|
+
}
|
|
27
|
+
let decodedValue = '';
|
|
28
|
+
if (cookieValue) {
|
|
29
|
+
try {
|
|
30
|
+
decodedValue = decodeURIComponent(cookieValue);
|
|
31
|
+
}
|
|
32
|
+
catch (e) {
|
|
33
|
+
console.log(`Unable to decode cookie ${cookieKey}: ${e}`);
|
|
34
|
+
decodedValue = cookieValue;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return [cookieKey, decodedValue];
|
|
38
|
+
}));
|
|
39
|
+
};
|
|
29
40
|
|
|
30
41
|
const tag = () => {
|
|
31
42
|
const isLoaded = window && window.LI && !!getCookieValue('lidid');
|
|
32
43
|
return {
|
|
33
44
|
loaded: isLoaded,
|
|
34
|
-
sdkVersion: "0.
|
|
45
|
+
sdkVersion: "0.61.0" ,
|
|
35
46
|
};
|
|
36
47
|
};
|
|
37
48
|
|
package/index.mjs
CHANGED
|
@@ -1,34 +1,45 @@
|
|
|
1
1
|
const packageName = 'liveIntent';
|
|
2
2
|
|
|
3
3
|
const getCookieValue = (key) => {
|
|
4
|
+
var _a;
|
|
4
5
|
try {
|
|
5
6
|
if (!document || !document.cookie) {
|
|
6
7
|
return '';
|
|
7
8
|
}
|
|
8
|
-
const
|
|
9
|
-
|
|
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);
|
|
15
|
-
}
|
|
16
|
-
if (c.indexOf(name) === 0) {
|
|
17
|
-
return c.substring(name.length, c.length);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return '';
|
|
9
|
+
const cookies = parseCookies(document.cookie);
|
|
10
|
+
return (_a = cookies[key]) !== null && _a !== void 0 ? _a : '';
|
|
21
11
|
}
|
|
22
12
|
catch {
|
|
23
13
|
return '';
|
|
24
14
|
}
|
|
25
15
|
};
|
|
16
|
+
const parseCookies = (cookie) => {
|
|
17
|
+
return Object.fromEntries(cookie
|
|
18
|
+
.split(/;\s+/)
|
|
19
|
+
.map((r) => r.split('=').map((str) => str.trim()))
|
|
20
|
+
.map(([cookieKey, cookieValue]) => {
|
|
21
|
+
if (!cookieKey) {
|
|
22
|
+
return [];
|
|
23
|
+
}
|
|
24
|
+
let decodedValue = '';
|
|
25
|
+
if (cookieValue) {
|
|
26
|
+
try {
|
|
27
|
+
decodedValue = decodeURIComponent(cookieValue);
|
|
28
|
+
}
|
|
29
|
+
catch (e) {
|
|
30
|
+
console.log(`Unable to decode cookie ${cookieKey}: ${e}`);
|
|
31
|
+
decodedValue = cookieValue;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return [cookieKey, decodedValue];
|
|
35
|
+
}));
|
|
36
|
+
};
|
|
26
37
|
|
|
27
38
|
const tag = () => {
|
|
28
39
|
const isLoaded = window && window.LI && !!getCookieValue('lidid');
|
|
29
40
|
return {
|
|
30
41
|
loaded: isLoaded,
|
|
31
|
-
sdkVersion: "0.
|
|
42
|
+
sdkVersion: "0.61.0" ,
|
|
32
43
|
};
|
|
33
44
|
};
|
|
34
45
|
|