@mparticle/web-rokt-kit 1.13.1 → 1.14.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/dist/Rokt-Kit.common.js +43 -10
- package/dist/Rokt-Kit.iife.js +43 -10
- package/package.json +10 -6
package/dist/Rokt-Kit.common.js
CHANGED
|
@@ -19,6 +19,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
19
19
|
|
|
20
20
|
var name = 'Rokt';
|
|
21
21
|
var moduleId = 181;
|
|
22
|
+
var EVENT_NAME_SELECT_PLACEMENTS = 'selectPlacements';
|
|
22
23
|
|
|
23
24
|
var constructor = function () {
|
|
24
25
|
var self = this;
|
|
@@ -62,6 +63,14 @@ var constructor = function () {
|
|
|
62
63
|
return baseUrl + '?extensions=' + extensions.join(',');
|
|
63
64
|
}
|
|
64
65
|
|
|
66
|
+
/**
|
|
67
|
+
* Checks if Rokt launcher is available and ready to attach
|
|
68
|
+
* @returns {boolean} True if launcher can be attached
|
|
69
|
+
*/
|
|
70
|
+
function isLauncherReadyToAttach() {
|
|
71
|
+
return window.Rokt && typeof window.Rokt.createLauncher === 'function';
|
|
72
|
+
}
|
|
73
|
+
|
|
65
74
|
/**
|
|
66
75
|
* Passes attributes to the Rokt Web SDK for client-side hashing
|
|
67
76
|
* @see https://docs.rokt.com/developers/integration-guides/web/library/integration-launcher#hash-attributes
|
|
@@ -124,7 +133,9 @@ var constructor = function () {
|
|
|
124
133
|
return;
|
|
125
134
|
}
|
|
126
135
|
|
|
127
|
-
if (
|
|
136
|
+
if (isLauncherReadyToAttach()) {
|
|
137
|
+
attachLauncher(accountId, launcherOptions);
|
|
138
|
+
} else {
|
|
128
139
|
var target = document.head || document.body;
|
|
129
140
|
var script = document.createElement('script');
|
|
130
141
|
script.type = 'text/javascript';
|
|
@@ -135,12 +146,7 @@ var constructor = function () {
|
|
|
135
146
|
script.id = 'rokt-launcher';
|
|
136
147
|
|
|
137
148
|
script.onload = function () {
|
|
138
|
-
|
|
139
|
-
if (
|
|
140
|
-
window.Rokt &&
|
|
141
|
-
typeof window.Rokt.createLauncher === 'function' &&
|
|
142
|
-
window.Rokt.currentLauncher === undefined
|
|
143
|
-
) {
|
|
149
|
+
if (isLauncherReadyToAttach()) {
|
|
144
150
|
attachLauncher(accountId, launcherOptions);
|
|
145
151
|
} else {
|
|
146
152
|
console.error(
|
|
@@ -155,8 +161,6 @@ var constructor = function () {
|
|
|
155
161
|
|
|
156
162
|
target.appendChild(script);
|
|
157
163
|
captureTiming(PerformanceMarks.RoktScriptAppended);
|
|
158
|
-
} else {
|
|
159
|
-
console.warn('Unable to find Rokt on the page');
|
|
160
164
|
}
|
|
161
165
|
}
|
|
162
166
|
/**
|
|
@@ -259,9 +263,38 @@ var constructor = function () {
|
|
|
259
263
|
attributes: selectPlacementsAttributes,
|
|
260
264
|
});
|
|
261
265
|
|
|
266
|
+
// Log custom event for selectPlacements call
|
|
267
|
+
logSelectPlacementsEvent(selectPlacementsAttributes);
|
|
268
|
+
|
|
262
269
|
return self.launcher.selectPlacements(selectPlacementsOptions);
|
|
263
270
|
}
|
|
264
271
|
|
|
272
|
+
/**
|
|
273
|
+
* Logs a custom event when selectPlacements is called
|
|
274
|
+
* This enables visibility and troubleshooting
|
|
275
|
+
* @param {Object} attributes - The attributes sent to Rokt
|
|
276
|
+
*/
|
|
277
|
+
function logSelectPlacementsEvent(attributes) {
|
|
278
|
+
if (
|
|
279
|
+
!window.mParticle ||
|
|
280
|
+
typeof window.mParticle.logEvent !== 'function'
|
|
281
|
+
) {
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
if (!isObject(attributes)) {
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
var EVENT_TYPE_OTHER = window.mParticle.EventType.Other;
|
|
290
|
+
|
|
291
|
+
window.mParticle.logEvent(
|
|
292
|
+
EVENT_NAME_SELECT_PLACEMENTS,
|
|
293
|
+
EVENT_TYPE_OTHER,
|
|
294
|
+
attributes
|
|
295
|
+
);
|
|
296
|
+
}
|
|
297
|
+
|
|
265
298
|
/**
|
|
266
299
|
* Enables optional Integration Launcher extensions before selecting placements
|
|
267
300
|
* @param {string} extensionName - Name of the extension to enable
|
|
@@ -478,7 +511,7 @@ var constructor = function () {
|
|
|
478
511
|
|
|
479
512
|
function generateIntegrationName(customIntegrationName) {
|
|
480
513
|
var coreSdkVersion = window.mParticle.getVersion();
|
|
481
|
-
var kitVersion = "1.
|
|
514
|
+
var kitVersion = "1.14.0";
|
|
482
515
|
var name = 'mParticle_' + 'wsdkv_' + coreSdkVersion + '_kitv_' + kitVersion;
|
|
483
516
|
|
|
484
517
|
if (customIntegrationName) {
|
package/dist/Rokt-Kit.iife.js
CHANGED
|
@@ -18,6 +18,7 @@ var RoktKit = (function (exports) {
|
|
|
18
18
|
|
|
19
19
|
var name = 'Rokt';
|
|
20
20
|
var moduleId = 181;
|
|
21
|
+
var EVENT_NAME_SELECT_PLACEMENTS = 'selectPlacements';
|
|
21
22
|
|
|
22
23
|
var constructor = function () {
|
|
23
24
|
var self = this;
|
|
@@ -61,6 +62,14 @@ var RoktKit = (function (exports) {
|
|
|
61
62
|
return baseUrl + '?extensions=' + extensions.join(',');
|
|
62
63
|
}
|
|
63
64
|
|
|
65
|
+
/**
|
|
66
|
+
* Checks if Rokt launcher is available and ready to attach
|
|
67
|
+
* @returns {boolean} True if launcher can be attached
|
|
68
|
+
*/
|
|
69
|
+
function isLauncherReadyToAttach() {
|
|
70
|
+
return window.Rokt && typeof window.Rokt.createLauncher === 'function';
|
|
71
|
+
}
|
|
72
|
+
|
|
64
73
|
/**
|
|
65
74
|
* Passes attributes to the Rokt Web SDK for client-side hashing
|
|
66
75
|
* @see https://docs.rokt.com/developers/integration-guides/web/library/integration-launcher#hash-attributes
|
|
@@ -123,7 +132,9 @@ var RoktKit = (function (exports) {
|
|
|
123
132
|
return;
|
|
124
133
|
}
|
|
125
134
|
|
|
126
|
-
if (
|
|
135
|
+
if (isLauncherReadyToAttach()) {
|
|
136
|
+
attachLauncher(accountId, launcherOptions);
|
|
137
|
+
} else {
|
|
127
138
|
var target = document.head || document.body;
|
|
128
139
|
var script = document.createElement('script');
|
|
129
140
|
script.type = 'text/javascript';
|
|
@@ -134,12 +145,7 @@ var RoktKit = (function (exports) {
|
|
|
134
145
|
script.id = 'rokt-launcher';
|
|
135
146
|
|
|
136
147
|
script.onload = function () {
|
|
137
|
-
|
|
138
|
-
if (
|
|
139
|
-
window.Rokt &&
|
|
140
|
-
typeof window.Rokt.createLauncher === 'function' &&
|
|
141
|
-
window.Rokt.currentLauncher === undefined
|
|
142
|
-
) {
|
|
148
|
+
if (isLauncherReadyToAttach()) {
|
|
143
149
|
attachLauncher(accountId, launcherOptions);
|
|
144
150
|
} else {
|
|
145
151
|
console.error(
|
|
@@ -154,8 +160,6 @@ var RoktKit = (function (exports) {
|
|
|
154
160
|
|
|
155
161
|
target.appendChild(script);
|
|
156
162
|
captureTiming(PerformanceMarks.RoktScriptAppended);
|
|
157
|
-
} else {
|
|
158
|
-
console.warn('Unable to find Rokt on the page');
|
|
159
163
|
}
|
|
160
164
|
}
|
|
161
165
|
/**
|
|
@@ -258,9 +262,38 @@ var RoktKit = (function (exports) {
|
|
|
258
262
|
attributes: selectPlacementsAttributes,
|
|
259
263
|
});
|
|
260
264
|
|
|
265
|
+
// Log custom event for selectPlacements call
|
|
266
|
+
logSelectPlacementsEvent(selectPlacementsAttributes);
|
|
267
|
+
|
|
261
268
|
return self.launcher.selectPlacements(selectPlacementsOptions);
|
|
262
269
|
}
|
|
263
270
|
|
|
271
|
+
/**
|
|
272
|
+
* Logs a custom event when selectPlacements is called
|
|
273
|
+
* This enables visibility and troubleshooting
|
|
274
|
+
* @param {Object} attributes - The attributes sent to Rokt
|
|
275
|
+
*/
|
|
276
|
+
function logSelectPlacementsEvent(attributes) {
|
|
277
|
+
if (
|
|
278
|
+
!window.mParticle ||
|
|
279
|
+
typeof window.mParticle.logEvent !== 'function'
|
|
280
|
+
) {
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
if (!isObject(attributes)) {
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
var EVENT_TYPE_OTHER = window.mParticle.EventType.Other;
|
|
289
|
+
|
|
290
|
+
window.mParticle.logEvent(
|
|
291
|
+
EVENT_NAME_SELECT_PLACEMENTS,
|
|
292
|
+
EVENT_TYPE_OTHER,
|
|
293
|
+
attributes
|
|
294
|
+
);
|
|
295
|
+
}
|
|
296
|
+
|
|
264
297
|
/**
|
|
265
298
|
* Enables optional Integration Launcher extensions before selecting placements
|
|
266
299
|
* @param {string} extensionName - Name of the extension to enable
|
|
@@ -477,7 +510,7 @@ var RoktKit = (function (exports) {
|
|
|
477
510
|
|
|
478
511
|
function generateIntegrationName(customIntegrationName) {
|
|
479
512
|
var coreSdkVersion = window.mParticle.getVersion();
|
|
480
|
-
var kitVersion = "1.
|
|
513
|
+
var kitVersion = "1.14.0";
|
|
481
514
|
var name = 'mParticle_' + 'wsdkv_' + coreSdkVersion + '_kitv_' + kitVersion;
|
|
482
515
|
|
|
483
516
|
if (customIntegrationName) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mparticle/web-rokt-kit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.14.0",
|
|
4
4
|
"description": "mParticle integration kit for Rokt",
|
|
5
5
|
"main": "dist/Rokt-Kit.common.js",
|
|
6
6
|
"files": [
|
|
@@ -19,13 +19,17 @@
|
|
|
19
19
|
"test:debug": "npm run build && npm run build:test && DEBUG=true karma start test/karma.config.js"
|
|
20
20
|
},
|
|
21
21
|
"publishConfig": {
|
|
22
|
-
"access": "public"
|
|
22
|
+
"access": "public",
|
|
23
|
+
"provenance": true,
|
|
24
|
+
"registry": "https://registry.npmjs.org"
|
|
23
25
|
},
|
|
24
26
|
"devDependencies": {
|
|
25
27
|
"@rollup/plugin-json": "^6.1.0",
|
|
26
|
-
"@semantic-release/changelog": "^
|
|
27
|
-
"@semantic-release/exec": "^
|
|
28
|
-
"@semantic-release/git": "^
|
|
28
|
+
"@semantic-release/changelog": "^6.0.3",
|
|
29
|
+
"@semantic-release/exec": "^6.0.3",
|
|
30
|
+
"@semantic-release/git": "^10.0.1",
|
|
31
|
+
"@semantic-release/npm": "^13.1.2",
|
|
32
|
+
"semantic-release": "^24.2.0",
|
|
29
33
|
"mocha": "^5.2.0",
|
|
30
34
|
"chai": "^4.2.0",
|
|
31
35
|
"eslint": "^7.25.0",
|
|
@@ -46,7 +50,7 @@
|
|
|
46
50
|
"watchify": "^3.11.0"
|
|
47
51
|
},
|
|
48
52
|
"dependencies": {
|
|
49
|
-
"@mparticle/web-sdk": "^2.
|
|
53
|
+
"@mparticle/web-sdk": "^2.56.0"
|
|
50
54
|
},
|
|
51
55
|
"license": "Apache-2.0"
|
|
52
56
|
}
|