@mparticle/web-rokt-kit 1.8.1 → 1.10.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.
@@ -334,35 +334,40 @@ var constructor = function () {
334
334
  launcherOptions || {}
335
335
  );
336
336
 
337
- window.Rokt.createLauncher(options)
338
- .then(function (launcher) {
339
- // Assign the launcher to a global variable for later access
340
- window.Rokt.currentLauncher = launcher;
341
- // Locally cache the launcher and filters
342
- self.launcher = launcher;
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
+ }
343
348
 
344
- var roktFilters = window.mParticle.Rokt.filters;
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;
345
354
 
346
- if (!roktFilters) {
347
- console.warn('Rokt Kit: No filters have been set.');
348
- } else {
349
- self.filters = roktFilters;
350
- if (!roktFilters.filteredUser) {
351
- console.warn(
352
- 'Rokt Kit: No filtered user has been set.'
353
- );
354
- }
355
- }
355
+ var roktFilters = window.mParticle.Rokt.filters;
356
356
 
357
- // Kit must be initialized before attaching to the Rokt manager
358
- self.isInitialized = true;
359
- // Attaches the kit to the Rokt manager
360
- window.mParticle.Rokt.attachKit(self);
361
- processEventQueue();
362
- })
363
- .catch(function (err) {
364
- console.error('Error creating Rokt launcher:', err);
365
- });
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
+ }
365
+
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();
366
371
  }
367
372
 
368
373
  // mParticle Kit Callback Methods
@@ -430,11 +435,24 @@ var constructor = function () {
430
435
  function isKitReady() {
431
436
  return !!(self.isInitialized && self.launcher);
432
437
  }
438
+
439
+ function isPartnerInLocalLauncherTestGroup() {
440
+ return (
441
+ window.mParticle.config &&
442
+ window.mParticle.config.isLocalLauncherEnabled &&
443
+ _isAssignedToSampleGroup()
444
+ );
445
+ }
446
+
447
+ function _isAssignedToSampleGroup() {
448
+ var LOCAL_LAUNCHER_TEST_GROUP_THRESHOLD = 0.5;
449
+ return Math.random() > LOCAL_LAUNCHER_TEST_GROUP_THRESHOLD;
450
+ }
433
451
  };
434
452
 
435
453
  function generateIntegrationName(customIntegrationName) {
436
454
  var coreSdkVersion = window.mParticle.getVersion();
437
- var kitVersion = "1.8.1";
455
+ var kitVersion = "1.10.0";
438
456
  var name = 'mParticle_' + 'wsdkv_' + coreSdkVersion + '_kitv_' + kitVersion;
439
457
 
440
458
  if (customIntegrationName) {
@@ -333,35 +333,40 @@ var RoktKit = (function (exports) {
333
333
  launcherOptions || {}
334
334
  );
335
335
 
336
- window.Rokt.createLauncher(options)
337
- .then(function (launcher) {
338
- // Assign the launcher to a global variable for later access
339
- window.Rokt.currentLauncher = launcher;
340
- // Locally cache the launcher and filters
341
- self.launcher = launcher;
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
+ }
342
347
 
343
- var roktFilters = window.mParticle.Rokt.filters;
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;
344
353
 
345
- if (!roktFilters) {
346
- console.warn('Rokt Kit: No filters have been set.');
347
- } else {
348
- self.filters = roktFilters;
349
- if (!roktFilters.filteredUser) {
350
- console.warn(
351
- 'Rokt Kit: No filtered user has been set.'
352
- );
353
- }
354
- }
354
+ var roktFilters = window.mParticle.Rokt.filters;
355
355
 
356
- // Kit must be initialized before attaching to the Rokt manager
357
- self.isInitialized = true;
358
- // Attaches the kit to the Rokt manager
359
- window.mParticle.Rokt.attachKit(self);
360
- processEventQueue();
361
- })
362
- .catch(function (err) {
363
- console.error('Error creating Rokt launcher:', err);
364
- });
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
+ }
364
+
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();
365
370
  }
366
371
 
367
372
  // mParticle Kit Callback Methods
@@ -429,11 +434,24 @@ var RoktKit = (function (exports) {
429
434
  function isKitReady() {
430
435
  return !!(self.isInitialized && self.launcher);
431
436
  }
437
+
438
+ function isPartnerInLocalLauncherTestGroup() {
439
+ return (
440
+ window.mParticle.config &&
441
+ window.mParticle.config.isLocalLauncherEnabled &&
442
+ _isAssignedToSampleGroup()
443
+ );
444
+ }
445
+
446
+ function _isAssignedToSampleGroup() {
447
+ var LOCAL_LAUNCHER_TEST_GROUP_THRESHOLD = 0.5;
448
+ return Math.random() > LOCAL_LAUNCHER_TEST_GROUP_THRESHOLD;
449
+ }
432
450
  };
433
451
 
434
452
  function generateIntegrationName(customIntegrationName) {
435
453
  var coreSdkVersion = window.mParticle.getVersion();
436
- var kitVersion = "1.8.1";
454
+ var kitVersion = "1.10.0";
437
455
  var name = 'mParticle_' + 'wsdkv_' + coreSdkVersion + '_kitv_' + kitVersion;
438
456
 
439
457
  if (customIntegrationName) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mparticle/web-rokt-kit",
3
- "version": "1.8.1",
3
+ "version": "1.10.0",
4
4
  "description": "mParticle integration kit for Rokt",
5
5
  "main": "dist/Rokt-Kit.common.js",
6
6
  "files": [