@mparticle/web-rokt-kit 1.8.0 → 1.9.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 +52 -27
- package/dist/Rokt-Kit.iife.js +52 -27
- package/package.json +1 -1
package/dist/Rokt-Kit.common.js
CHANGED
|
@@ -34,6 +34,7 @@ var constructor = function () {
|
|
|
34
34
|
self.userAttributes = {};
|
|
35
35
|
self.testHelpers = null;
|
|
36
36
|
self.placementEventMappingLookup = {};
|
|
37
|
+
self.eventQueue = [];
|
|
37
38
|
|
|
38
39
|
/**
|
|
39
40
|
* Generates the Rokt launcher script URL with optional domain override and extensions
|
|
@@ -280,9 +281,20 @@ var constructor = function () {
|
|
|
280
281
|
window.Rokt.setExtensionData(partnerExtensionData);
|
|
281
282
|
}
|
|
282
283
|
|
|
284
|
+
function processEventQueue() {
|
|
285
|
+
self.eventQueue.forEach(function (event) {
|
|
286
|
+
processEvent(event);
|
|
287
|
+
});
|
|
288
|
+
self.eventQueue = [];
|
|
289
|
+
}
|
|
290
|
+
|
|
283
291
|
function processEvent(event) {
|
|
292
|
+
if (!isKitReady()) {
|
|
293
|
+
self.eventQueue.push(event);
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
|
|
284
297
|
if (
|
|
285
|
-
!isKitReady() ||
|
|
286
298
|
isEmpty(self.placementEventMappingLookup) ||
|
|
287
299
|
typeof window.mParticle.Rokt.setLocalSessionAttribute !== 'function'
|
|
288
300
|
) {
|
|
@@ -322,34 +334,40 @@ var constructor = function () {
|
|
|
322
334
|
launcherOptions || {}
|
|
323
335
|
);
|
|
324
336
|
|
|
325
|
-
|
|
326
|
-
.
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
337
|
+
if (isPartnerInLocalLauncherTestGroup()) {
|
|
338
|
+
var localLauncher = window.Rokt.createLocalLauncher(options);
|
|
339
|
+
initRoktLauncher(localLauncher);
|
|
340
|
+
} else {
|
|
341
|
+
window.Rokt.createLauncher(options)
|
|
342
|
+
.then(initRoktLauncher)
|
|
343
|
+
.catch(function (err) {
|
|
344
|
+
console.error('Error creating Rokt launcher:', err);
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
function initRoktLauncher(launcher) {
|
|
350
|
+
// Assign the launcher to a global variable for later access
|
|
351
|
+
window.Rokt.currentLauncher = launcher;
|
|
352
|
+
// Locally cache the launcher and filters
|
|
353
|
+
self.launcher = launcher;
|
|
331
354
|
|
|
332
|
-
|
|
355
|
+
var roktFilters = window.mParticle.Rokt.filters;
|
|
333
356
|
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
}
|
|
343
|
-
}
|
|
357
|
+
if (!roktFilters) {
|
|
358
|
+
console.warn('Rokt Kit: No filters have been set.');
|
|
359
|
+
} else {
|
|
360
|
+
self.filters = roktFilters;
|
|
361
|
+
if (!roktFilters.filteredUser) {
|
|
362
|
+
console.warn('Rokt Kit: No filtered user has been set.');
|
|
363
|
+
}
|
|
364
|
+
}
|
|
344
365
|
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
.catch(function (err) {
|
|
351
|
-
console.error('Error creating Rokt launcher:', err);
|
|
352
|
-
});
|
|
366
|
+
// Kit must be initialized before attaching to the Rokt manager
|
|
367
|
+
self.isInitialized = true;
|
|
368
|
+
// Attaches the kit to the Rokt manager
|
|
369
|
+
window.mParticle.Rokt.attachKit(self);
|
|
370
|
+
processEventQueue();
|
|
353
371
|
}
|
|
354
372
|
|
|
355
373
|
// mParticle Kit Callback Methods
|
|
@@ -417,11 +435,18 @@ var constructor = function () {
|
|
|
417
435
|
function isKitReady() {
|
|
418
436
|
return !!(self.isInitialized && self.launcher);
|
|
419
437
|
}
|
|
438
|
+
|
|
439
|
+
function isPartnerInLocalLauncherTestGroup() {
|
|
440
|
+
return (
|
|
441
|
+
window.mParticle.config &&
|
|
442
|
+
window.mParticle.config.isLocalLauncherEnabled
|
|
443
|
+
);
|
|
444
|
+
}
|
|
420
445
|
};
|
|
421
446
|
|
|
422
447
|
function generateIntegrationName(customIntegrationName) {
|
|
423
448
|
var coreSdkVersion = window.mParticle.getVersion();
|
|
424
|
-
var kitVersion = "1.
|
|
449
|
+
var kitVersion = "1.9.0";
|
|
425
450
|
var name = 'mParticle_' + 'wsdkv_' + coreSdkVersion + '_kitv_' + kitVersion;
|
|
426
451
|
|
|
427
452
|
if (customIntegrationName) {
|
package/dist/Rokt-Kit.iife.js
CHANGED
|
@@ -33,6 +33,7 @@ var RoktKit = (function (exports) {
|
|
|
33
33
|
self.userAttributes = {};
|
|
34
34
|
self.testHelpers = null;
|
|
35
35
|
self.placementEventMappingLookup = {};
|
|
36
|
+
self.eventQueue = [];
|
|
36
37
|
|
|
37
38
|
/**
|
|
38
39
|
* Generates the Rokt launcher script URL with optional domain override and extensions
|
|
@@ -279,9 +280,20 @@ var RoktKit = (function (exports) {
|
|
|
279
280
|
window.Rokt.setExtensionData(partnerExtensionData);
|
|
280
281
|
}
|
|
281
282
|
|
|
283
|
+
function processEventQueue() {
|
|
284
|
+
self.eventQueue.forEach(function (event) {
|
|
285
|
+
processEvent(event);
|
|
286
|
+
});
|
|
287
|
+
self.eventQueue = [];
|
|
288
|
+
}
|
|
289
|
+
|
|
282
290
|
function processEvent(event) {
|
|
291
|
+
if (!isKitReady()) {
|
|
292
|
+
self.eventQueue.push(event);
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
|
|
283
296
|
if (
|
|
284
|
-
!isKitReady() ||
|
|
285
297
|
isEmpty(self.placementEventMappingLookup) ||
|
|
286
298
|
typeof window.mParticle.Rokt.setLocalSessionAttribute !== 'function'
|
|
287
299
|
) {
|
|
@@ -321,34 +333,40 @@ var RoktKit = (function (exports) {
|
|
|
321
333
|
launcherOptions || {}
|
|
322
334
|
);
|
|
323
335
|
|
|
324
|
-
|
|
325
|
-
.
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
336
|
+
if (isPartnerInLocalLauncherTestGroup()) {
|
|
337
|
+
var localLauncher = window.Rokt.createLocalLauncher(options);
|
|
338
|
+
initRoktLauncher(localLauncher);
|
|
339
|
+
} else {
|
|
340
|
+
window.Rokt.createLauncher(options)
|
|
341
|
+
.then(initRoktLauncher)
|
|
342
|
+
.catch(function (err) {
|
|
343
|
+
console.error('Error creating Rokt launcher:', err);
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
function initRoktLauncher(launcher) {
|
|
349
|
+
// Assign the launcher to a global variable for later access
|
|
350
|
+
window.Rokt.currentLauncher = launcher;
|
|
351
|
+
// Locally cache the launcher and filters
|
|
352
|
+
self.launcher = launcher;
|
|
330
353
|
|
|
331
|
-
|
|
354
|
+
var roktFilters = window.mParticle.Rokt.filters;
|
|
332
355
|
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
}
|
|
342
|
-
}
|
|
356
|
+
if (!roktFilters) {
|
|
357
|
+
console.warn('Rokt Kit: No filters have been set.');
|
|
358
|
+
} else {
|
|
359
|
+
self.filters = roktFilters;
|
|
360
|
+
if (!roktFilters.filteredUser) {
|
|
361
|
+
console.warn('Rokt Kit: No filtered user has been set.');
|
|
362
|
+
}
|
|
363
|
+
}
|
|
343
364
|
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
.catch(function (err) {
|
|
350
|
-
console.error('Error creating Rokt launcher:', err);
|
|
351
|
-
});
|
|
365
|
+
// Kit must be initialized before attaching to the Rokt manager
|
|
366
|
+
self.isInitialized = true;
|
|
367
|
+
// Attaches the kit to the Rokt manager
|
|
368
|
+
window.mParticle.Rokt.attachKit(self);
|
|
369
|
+
processEventQueue();
|
|
352
370
|
}
|
|
353
371
|
|
|
354
372
|
// mParticle Kit Callback Methods
|
|
@@ -416,11 +434,18 @@ var RoktKit = (function (exports) {
|
|
|
416
434
|
function isKitReady() {
|
|
417
435
|
return !!(self.isInitialized && self.launcher);
|
|
418
436
|
}
|
|
437
|
+
|
|
438
|
+
function isPartnerInLocalLauncherTestGroup() {
|
|
439
|
+
return (
|
|
440
|
+
window.mParticle.config &&
|
|
441
|
+
window.mParticle.config.isLocalLauncherEnabled
|
|
442
|
+
);
|
|
443
|
+
}
|
|
419
444
|
};
|
|
420
445
|
|
|
421
446
|
function generateIntegrationName(customIntegrationName) {
|
|
422
447
|
var coreSdkVersion = window.mParticle.getVersion();
|
|
423
|
-
var kitVersion = "1.
|
|
448
|
+
var kitVersion = "1.9.0";
|
|
424
449
|
var name = 'mParticle_' + 'wsdkv_' + coreSdkVersion + '_kitv_' + kitVersion;
|
|
425
450
|
|
|
426
451
|
if (customIntegrationName) {
|