@blotoutio/providers-klaviyo-sdk 0.36.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/README.md +11 -0
- package/index.cjs.js +46 -0
- package/index.js +49 -0
- package/index.mjs +44 -0
- package/package.json +24 -0
package/README.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# providers-klaviyo-sdk
|
|
2
|
+
|
|
3
|
+
This library was generated with [Nx](https://nx.dev).
|
|
4
|
+
|
|
5
|
+
## Building
|
|
6
|
+
|
|
7
|
+
Run `nx build providers-klaviyo-sdk` to build the library.
|
|
8
|
+
|
|
9
|
+
## Running unit tests
|
|
10
|
+
|
|
11
|
+
Run `nx test providers-klaviyo-sdk` to execute the unit tests via [Jest](https://jestjs.io).
|
package/index.cjs.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const packageName = 'klaviyo';
|
|
4
|
+
|
|
5
|
+
const decodeCookie = (value) => {
|
|
6
|
+
if (!value)
|
|
7
|
+
return null;
|
|
8
|
+
try {
|
|
9
|
+
return JSON.parse(atob(value));
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
const capture = (rule, value) => {
|
|
16
|
+
if (rule.key == '__kla_id' && rule.location == 'cookie' && value) {
|
|
17
|
+
try {
|
|
18
|
+
const decoded = decodeCookie(value);
|
|
19
|
+
return (decoded === null || decoded === void 0 ? void 0 : decoded.$exchange_id) || null;
|
|
20
|
+
}
|
|
21
|
+
catch (e) {
|
|
22
|
+
console.error('Error decoding Klaviyo exchange ID', e);
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return value;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
// eslint-disable-next-line @nx/enforce-module-boundaries
|
|
30
|
+
const data = {
|
|
31
|
+
name: packageName,
|
|
32
|
+
capture,
|
|
33
|
+
};
|
|
34
|
+
try {
|
|
35
|
+
if (window) {
|
|
36
|
+
if (!window.edgetagProviders) {
|
|
37
|
+
window.edgetagProviders = [];
|
|
38
|
+
}
|
|
39
|
+
window.edgetagProviders.push(data);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
// No window
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
module.exports = data;
|
package/index.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
var ProvidersKlaviyoSdk = (function () {
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const packageName = 'klaviyo';
|
|
5
|
+
|
|
6
|
+
const decodeCookie = (value) => {
|
|
7
|
+
if (!value)
|
|
8
|
+
return null;
|
|
9
|
+
try {
|
|
10
|
+
return JSON.parse(atob(value));
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
const capture = (rule, value) => {
|
|
17
|
+
if (rule.key == '__kla_id' && rule.location == 'cookie' && value) {
|
|
18
|
+
try {
|
|
19
|
+
const decoded = decodeCookie(value);
|
|
20
|
+
return (decoded === null || decoded === void 0 ? void 0 : decoded.$exchange_id) || null;
|
|
21
|
+
}
|
|
22
|
+
catch (e) {
|
|
23
|
+
console.error('Error decoding Klaviyo exchange ID', e);
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return value;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
// eslint-disable-next-line @nx/enforce-module-boundaries
|
|
31
|
+
const data = {
|
|
32
|
+
name: packageName,
|
|
33
|
+
capture,
|
|
34
|
+
};
|
|
35
|
+
try {
|
|
36
|
+
if (window) {
|
|
37
|
+
if (!window.edgetagProviders) {
|
|
38
|
+
window.edgetagProviders = [];
|
|
39
|
+
}
|
|
40
|
+
window.edgetagProviders.push(data);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
// No window
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return data;
|
|
48
|
+
|
|
49
|
+
})();
|
package/index.mjs
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
const packageName = 'klaviyo';
|
|
2
|
+
|
|
3
|
+
const decodeCookie = (value) => {
|
|
4
|
+
if (!value)
|
|
5
|
+
return null;
|
|
6
|
+
try {
|
|
7
|
+
return JSON.parse(atob(value));
|
|
8
|
+
}
|
|
9
|
+
catch {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
const capture = (rule, value) => {
|
|
14
|
+
if (rule.key == '__kla_id' && rule.location == 'cookie' && value) {
|
|
15
|
+
try {
|
|
16
|
+
const decoded = decodeCookie(value);
|
|
17
|
+
return (decoded === null || decoded === void 0 ? void 0 : decoded.$exchange_id) || null;
|
|
18
|
+
}
|
|
19
|
+
catch (e) {
|
|
20
|
+
console.error('Error decoding Klaviyo exchange ID', e);
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return value;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
// eslint-disable-next-line @nx/enforce-module-boundaries
|
|
28
|
+
const data = {
|
|
29
|
+
name: packageName,
|
|
30
|
+
capture,
|
|
31
|
+
};
|
|
32
|
+
try {
|
|
33
|
+
if (window) {
|
|
34
|
+
if (!window.edgetagProviders) {
|
|
35
|
+
window.edgetagProviders = [];
|
|
36
|
+
}
|
|
37
|
+
window.edgetagProviders.push(data);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
// No window
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export { data as default };
|
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@blotoutio/providers-klaviyo-sdk",
|
|
3
|
+
"version": "0.36.0",
|
|
4
|
+
"description": "Klaviyo Browser SDK for EdgeTag",
|
|
5
|
+
"author": "Blotout",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"homepage": "https://github.com/blotoutio/edgetag-sdk",
|
|
8
|
+
"publishConfig": {
|
|
9
|
+
"access": "public"
|
|
10
|
+
},
|
|
11
|
+
"main": "./index.cjs.js",
|
|
12
|
+
"module": "./index.mjs",
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+https://github.com/blotoutio/edgetag-sdk.git"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"index.js",
|
|
19
|
+
"index.cjs.js",
|
|
20
|
+
"index.mjs",
|
|
21
|
+
"package.json",
|
|
22
|
+
"README.md"
|
|
23
|
+
]
|
|
24
|
+
}
|