@mparticle/web-rokt-kit 1.18.1 → 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);
@@ -555,9 +556,24 @@ var constructor = function () {
555
556
  }
556
557
  }
557
558
 
559
+ function _enrichEvent(event) {
560
+ return mergeObjects({}, event, {
561
+ UserAttributes: self.userAttributes,
562
+ });
563
+ }
564
+
558
565
  function _sendEventStream(event) {
559
566
  if (window.Rokt && typeof window.Rokt.__event_stream__ === 'function') {
560
- 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);
561
577
  }
562
578
  }
563
579
 
@@ -757,7 +773,7 @@ var constructor = function () {
757
773
 
758
774
  var ADBLOCK_CONTROL_DOMAIN = 'apps.roktecommerce.com';
759
775
  var INIT_LOG_SAMPLING_RATE = 0.1;
760
- var _allowedOriginHash = 1445747545;
776
+ var _allowedOriginHashes = [-553112570, 549508659];
761
777
 
762
778
  function djb2(str) {
763
779
  var hash = 5381;
@@ -769,7 +785,8 @@ var constructor = function () {
769
785
  }
770
786
 
771
787
  function sendAdBlockMeasurementSignals(domain, version) {
772
- if (djb2(window.location.origin) !== _allowedOriginHash) {
788
+ var originHash = djb2(window.location.origin);
789
+ if (_allowedOriginHashes.indexOf(originHash) === -1) {
773
790
  return;
774
791
  }
775
792
 
@@ -808,7 +825,7 @@ var constructor = function () {
808
825
 
809
826
  function generateIntegrationName(customIntegrationName) {
810
827
  var coreSdkVersion = window.mParticle.getVersion();
811
- var kitVersion = "1.18.1";
828
+ var kitVersion = "1.19.0";
812
829
  var name = 'mParticle_' + 'wsdkv_' + coreSdkVersion + '_kitv_' + kitVersion;
813
830
 
814
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);
@@ -554,9 +555,24 @@ var RoktKit = (function (exports) {
554
555
  }
555
556
  }
556
557
 
558
+ function _enrichEvent(event) {
559
+ return mergeObjects({}, event, {
560
+ UserAttributes: self.userAttributes,
561
+ });
562
+ }
563
+
557
564
  function _sendEventStream(event) {
558
565
  if (window.Rokt && typeof window.Rokt.__event_stream__ === 'function') {
559
- 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);
560
576
  }
561
577
  }
562
578
 
@@ -756,7 +772,7 @@ var RoktKit = (function (exports) {
756
772
 
757
773
  var ADBLOCK_CONTROL_DOMAIN = 'apps.roktecommerce.com';
758
774
  var INIT_LOG_SAMPLING_RATE = 0.1;
759
- var _allowedOriginHash = 1445747545;
775
+ var _allowedOriginHashes = [-553112570, 549508659];
760
776
 
761
777
  function djb2(str) {
762
778
  var hash = 5381;
@@ -768,7 +784,8 @@ var RoktKit = (function (exports) {
768
784
  }
769
785
 
770
786
  function sendAdBlockMeasurementSignals(domain, version) {
771
- if (djb2(window.location.origin) !== _allowedOriginHash) {
787
+ var originHash = djb2(window.location.origin);
788
+ if (_allowedOriginHashes.indexOf(originHash) === -1) {
772
789
  return;
773
790
  }
774
791
 
@@ -807,7 +824,7 @@ var RoktKit = (function (exports) {
807
824
 
808
825
  function generateIntegrationName(customIntegrationName) {
809
826
  var coreSdkVersion = window.mParticle.getVersion();
810
- var kitVersion = "1.18.1";
827
+ var kitVersion = "1.19.0";
811
828
  var name = 'mParticle_' + 'wsdkv_' + coreSdkVersion + '_kitv_' + kitVersion;
812
829
 
813
830
  if (customIntegrationName) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mparticle/web-rokt-kit",
3
- "version": "1.18.1",
3
+ "version": "1.19.0",
4
4
  "description": "mParticle integration kit for Rokt",
5
5
  "main": "dist/Rokt-Kit.common.js",
6
6
  "files": [