@mparticle/web-rokt-kit 1.18.0 → 1.19.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.
@@ -43,6 +43,7 @@ var constructor = function () {
43
43
  self.placementEventMappingLookup = {};
44
44
  self.placementEventAttributeMappingLookup = {};
45
45
  self.eventQueue = [];
46
+ self.eventStreamQueue = [];
46
47
  self.integrationName = null;
47
48
 
48
49
  function getEventAttributeValue(event, eventAttributeKey) {
@@ -273,8 +274,8 @@ var constructor = function () {
273
274
  sendAdBlockMeasurementSignals: sendAdBlockMeasurementSignals,
274
275
  createAutoRemovedIframe: createAutoRemovedIframe,
275
276
  djb2: djb2,
276
- setAllowedOriginHash: function (hash) {
277
- _allowedOriginHash = hash;
277
+ setAllowedOriginHashes: function (hashes) {
278
+ _allowedOriginHashes = hashes;
278
279
  },
279
280
  };
280
281
  attachLauncher(accountId, launcherOptions);
@@ -447,6 +448,8 @@ var constructor = function () {
447
448
  .catch(function () {
448
449
  logSelectPlacementsEvent(selectPlacementsAttributes);
449
450
  });
451
+ } else {
452
+ logSelectPlacementsEvent(selectPlacementsAttributes);
450
453
  }
451
454
 
452
455
  return selection;
@@ -553,9 +556,24 @@ var constructor = function () {
553
556
  }
554
557
  }
555
558
 
559
+ function _enrichEvent(event) {
560
+ return mergeObjects({}, event, {
561
+ UserAttributes: self.userAttributes,
562
+ });
563
+ }
564
+
556
565
  function _sendEventStream(event) {
557
566
  if (window.Rokt && typeof window.Rokt.__event_stream__ === 'function') {
558
- window.Rokt.__event_stream__(event);
567
+ if (self.eventStreamQueue.length) {
568
+ var queuedEvents = self.eventStreamQueue;
569
+ self.eventStreamQueue = [];
570
+ for (var i = 0; i < queuedEvents.length; i++) {
571
+ window.Rokt.__event_stream__(_enrichEvent(queuedEvents[i]));
572
+ }
573
+ }
574
+ window.Rokt.__event_stream__(_enrichEvent(event));
575
+ } else {
576
+ self.eventStreamQueue.push(event);
559
577
  }
560
578
  }
561
579
 
@@ -755,7 +773,7 @@ var constructor = function () {
755
773
 
756
774
  var ADBLOCK_CONTROL_DOMAIN = 'apps.roktecommerce.com';
757
775
  var INIT_LOG_SAMPLING_RATE = 0.1;
758
- var _allowedOriginHash = 1445747545;
776
+ var _allowedOriginHashes = [-553112570, 549508659];
759
777
 
760
778
  function djb2(str) {
761
779
  var hash = 5381;
@@ -767,7 +785,8 @@ var constructor = function () {
767
785
  }
768
786
 
769
787
  function sendAdBlockMeasurementSignals(domain, version) {
770
- if (djb2(window.location.origin) !== _allowedOriginHash) {
788
+ var originHash = djb2(window.location.origin);
789
+ if (_allowedOriginHashes.indexOf(originHash) === -1) {
771
790
  return;
772
791
  }
773
792
 
@@ -806,7 +825,7 @@ var constructor = function () {
806
825
 
807
826
  function generateIntegrationName(customIntegrationName) {
808
827
  var coreSdkVersion = window.mParticle.getVersion();
809
- var kitVersion = "1.18.0";
828
+ var kitVersion = "1.19.0";
810
829
  var name = 'mParticle_' + 'wsdkv_' + coreSdkVersion + '_kitv_' + kitVersion;
811
830
 
812
831
  if (customIntegrationName) {
@@ -42,6 +42,7 @@ var RoktKit = (function (exports) {
42
42
  self.placementEventMappingLookup = {};
43
43
  self.placementEventAttributeMappingLookup = {};
44
44
  self.eventQueue = [];
45
+ self.eventStreamQueue = [];
45
46
  self.integrationName = null;
46
47
 
47
48
  function getEventAttributeValue(event, eventAttributeKey) {
@@ -272,8 +273,8 @@ var RoktKit = (function (exports) {
272
273
  sendAdBlockMeasurementSignals: sendAdBlockMeasurementSignals,
273
274
  createAutoRemovedIframe: createAutoRemovedIframe,
274
275
  djb2: djb2,
275
- setAllowedOriginHash: function (hash) {
276
- _allowedOriginHash = hash;
276
+ setAllowedOriginHashes: function (hashes) {
277
+ _allowedOriginHashes = hashes;
277
278
  },
278
279
  };
279
280
  attachLauncher(accountId, launcherOptions);
@@ -446,6 +447,8 @@ var RoktKit = (function (exports) {
446
447
  .catch(function () {
447
448
  logSelectPlacementsEvent(selectPlacementsAttributes);
448
449
  });
450
+ } else {
451
+ logSelectPlacementsEvent(selectPlacementsAttributes);
449
452
  }
450
453
 
451
454
  return selection;
@@ -552,9 +555,24 @@ var RoktKit = (function (exports) {
552
555
  }
553
556
  }
554
557
 
558
+ function _enrichEvent(event) {
559
+ return mergeObjects({}, event, {
560
+ UserAttributes: self.userAttributes,
561
+ });
562
+ }
563
+
555
564
  function _sendEventStream(event) {
556
565
  if (window.Rokt && typeof window.Rokt.__event_stream__ === 'function') {
557
- window.Rokt.__event_stream__(event);
566
+ if (self.eventStreamQueue.length) {
567
+ var queuedEvents = self.eventStreamQueue;
568
+ self.eventStreamQueue = [];
569
+ for (var i = 0; i < queuedEvents.length; i++) {
570
+ window.Rokt.__event_stream__(_enrichEvent(queuedEvents[i]));
571
+ }
572
+ }
573
+ window.Rokt.__event_stream__(_enrichEvent(event));
574
+ } else {
575
+ self.eventStreamQueue.push(event);
558
576
  }
559
577
  }
560
578
 
@@ -754,7 +772,7 @@ var RoktKit = (function (exports) {
754
772
 
755
773
  var ADBLOCK_CONTROL_DOMAIN = 'apps.roktecommerce.com';
756
774
  var INIT_LOG_SAMPLING_RATE = 0.1;
757
- var _allowedOriginHash = 1445747545;
775
+ var _allowedOriginHashes = [-553112570, 549508659];
758
776
 
759
777
  function djb2(str) {
760
778
  var hash = 5381;
@@ -766,7 +784,8 @@ var RoktKit = (function (exports) {
766
784
  }
767
785
 
768
786
  function sendAdBlockMeasurementSignals(domain, version) {
769
- if (djb2(window.location.origin) !== _allowedOriginHash) {
787
+ var originHash = djb2(window.location.origin);
788
+ if (_allowedOriginHashes.indexOf(originHash) === -1) {
770
789
  return;
771
790
  }
772
791
 
@@ -805,7 +824,7 @@ var RoktKit = (function (exports) {
805
824
 
806
825
  function generateIntegrationName(customIntegrationName) {
807
826
  var coreSdkVersion = window.mParticle.getVersion();
808
- var kitVersion = "1.18.0";
827
+ var kitVersion = "1.19.0";
809
828
  var name = 'mParticle_' + 'wsdkv_' + coreSdkVersion + '_kitv_' + kitVersion;
810
829
 
811
830
  if (customIntegrationName) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mparticle/web-rokt-kit",
3
- "version": "1.18.0",
3
+ "version": "1.19.0",
4
4
  "description": "mParticle integration kit for Rokt",
5
5
  "main": "dist/Rokt-Kit.common.js",
6
6
  "files": [