@mparticle/web-rokt-kit 1.18.1 → 1.20.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 +69 -6
- package/dist/Rokt-Kit.iife.js +69 -6
- package/package.json +1 -1
package/dist/Rokt-Kit.common.js
CHANGED
|
@@ -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
|
-
|
|
277
|
-
|
|
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
|
-
|
|
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
|
|
|
@@ -583,6 +599,49 @@ var constructor = function () {
|
|
|
583
599
|
function onUserIdentified(filteredUser) {
|
|
584
600
|
self.filters.filteredUser = filteredUser;
|
|
585
601
|
self.userAttributes = filteredUser.getAllUserAttributes();
|
|
602
|
+
_sendEventStream(_buildIdentityEvent('identify', filteredUser));
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
function _buildIdentityEvent(eventName, filteredUser) {
|
|
606
|
+
var mpid =
|
|
607
|
+
filteredUser.getMPID && typeof filteredUser.getMPID === 'function'
|
|
608
|
+
? filteredUser.getMPID()
|
|
609
|
+
: null;
|
|
610
|
+
var sessionId =
|
|
611
|
+
window.mParticle &&
|
|
612
|
+
window.mParticle.sessionManager &&
|
|
613
|
+
typeof window.mParticle.sessionManager.getSession === 'function'
|
|
614
|
+
? window.mParticle.sessionManager.getSession()
|
|
615
|
+
: null;
|
|
616
|
+
var userIdentities =
|
|
617
|
+
filteredUser.getUserIdentities &&
|
|
618
|
+
typeof filteredUser.getUserIdentities === 'function'
|
|
619
|
+
? filteredUser.getUserIdentities().userIdentities
|
|
620
|
+
: null;
|
|
621
|
+
|
|
622
|
+
return {
|
|
623
|
+
EventName: eventName,
|
|
624
|
+
EventDataType: 14, // MessageType.Profile
|
|
625
|
+
Timestamp: Date.now(),
|
|
626
|
+
MPID: mpid,
|
|
627
|
+
SessionId: sessionId,
|
|
628
|
+
UserIdentities: userIdentities,
|
|
629
|
+
};
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
function onLoginComplete(filteredUser) {
|
|
633
|
+
self.userAttributes = filteredUser.getAllUserAttributes();
|
|
634
|
+
_sendEventStream(_buildIdentityEvent('login', filteredUser));
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
function onLogoutComplete(filteredUser) {
|
|
638
|
+
self.userAttributes = filteredUser.getAllUserAttributes();
|
|
639
|
+
_sendEventStream(_buildIdentityEvent('logout', filteredUser));
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
function onModifyComplete(filteredUser) {
|
|
643
|
+
self.userAttributes = filteredUser.getAllUserAttributes();
|
|
644
|
+
_sendEventStream(_buildIdentityEvent('modify_user', filteredUser));
|
|
586
645
|
}
|
|
587
646
|
|
|
588
647
|
function setUserAttribute(key, value) {
|
|
@@ -701,6 +760,9 @@ var constructor = function () {
|
|
|
701
760
|
this.setExtensionData = setExtensionData;
|
|
702
761
|
this.setUserAttribute = setUserAttribute;
|
|
703
762
|
this.onUserIdentified = onUserIdentified;
|
|
763
|
+
this.onLoginComplete = onLoginComplete;
|
|
764
|
+
this.onLogoutComplete = onLogoutComplete;
|
|
765
|
+
this.onModifyComplete = onModifyComplete;
|
|
704
766
|
this.removeUserAttribute = removeUserAttribute;
|
|
705
767
|
|
|
706
768
|
/**
|
|
@@ -757,7 +819,7 @@ var constructor = function () {
|
|
|
757
819
|
|
|
758
820
|
var ADBLOCK_CONTROL_DOMAIN = 'apps.roktecommerce.com';
|
|
759
821
|
var INIT_LOG_SAMPLING_RATE = 0.1;
|
|
760
|
-
var
|
|
822
|
+
var _allowedOriginHashes = [-553112570, 549508659];
|
|
761
823
|
|
|
762
824
|
function djb2(str) {
|
|
763
825
|
var hash = 5381;
|
|
@@ -769,7 +831,8 @@ var constructor = function () {
|
|
|
769
831
|
}
|
|
770
832
|
|
|
771
833
|
function sendAdBlockMeasurementSignals(domain, version) {
|
|
772
|
-
|
|
834
|
+
var originHash = djb2(window.location.origin);
|
|
835
|
+
if (_allowedOriginHashes.indexOf(originHash) === -1) {
|
|
773
836
|
return;
|
|
774
837
|
}
|
|
775
838
|
|
|
@@ -808,7 +871,7 @@ var constructor = function () {
|
|
|
808
871
|
|
|
809
872
|
function generateIntegrationName(customIntegrationName) {
|
|
810
873
|
var coreSdkVersion = window.mParticle.getVersion();
|
|
811
|
-
var kitVersion = "1.
|
|
874
|
+
var kitVersion = "1.20.0";
|
|
812
875
|
var name = 'mParticle_' + 'wsdkv_' + coreSdkVersion + '_kitv_' + kitVersion;
|
|
813
876
|
|
|
814
877
|
if (customIntegrationName) {
|
package/dist/Rokt-Kit.iife.js
CHANGED
|
@@ -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
|
-
|
|
276
|
-
|
|
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
|
-
|
|
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
|
|
|
@@ -582,6 +598,49 @@ var RoktKit = (function (exports) {
|
|
|
582
598
|
function onUserIdentified(filteredUser) {
|
|
583
599
|
self.filters.filteredUser = filteredUser;
|
|
584
600
|
self.userAttributes = filteredUser.getAllUserAttributes();
|
|
601
|
+
_sendEventStream(_buildIdentityEvent('identify', filteredUser));
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
function _buildIdentityEvent(eventName, filteredUser) {
|
|
605
|
+
var mpid =
|
|
606
|
+
filteredUser.getMPID && typeof filteredUser.getMPID === 'function'
|
|
607
|
+
? filteredUser.getMPID()
|
|
608
|
+
: null;
|
|
609
|
+
var sessionId =
|
|
610
|
+
window.mParticle &&
|
|
611
|
+
window.mParticle.sessionManager &&
|
|
612
|
+
typeof window.mParticle.sessionManager.getSession === 'function'
|
|
613
|
+
? window.mParticle.sessionManager.getSession()
|
|
614
|
+
: null;
|
|
615
|
+
var userIdentities =
|
|
616
|
+
filteredUser.getUserIdentities &&
|
|
617
|
+
typeof filteredUser.getUserIdentities === 'function'
|
|
618
|
+
? filteredUser.getUserIdentities().userIdentities
|
|
619
|
+
: null;
|
|
620
|
+
|
|
621
|
+
return {
|
|
622
|
+
EventName: eventName,
|
|
623
|
+
EventDataType: 14, // MessageType.Profile
|
|
624
|
+
Timestamp: Date.now(),
|
|
625
|
+
MPID: mpid,
|
|
626
|
+
SessionId: sessionId,
|
|
627
|
+
UserIdentities: userIdentities,
|
|
628
|
+
};
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
function onLoginComplete(filteredUser) {
|
|
632
|
+
self.userAttributes = filteredUser.getAllUserAttributes();
|
|
633
|
+
_sendEventStream(_buildIdentityEvent('login', filteredUser));
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
function onLogoutComplete(filteredUser) {
|
|
637
|
+
self.userAttributes = filteredUser.getAllUserAttributes();
|
|
638
|
+
_sendEventStream(_buildIdentityEvent('logout', filteredUser));
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
function onModifyComplete(filteredUser) {
|
|
642
|
+
self.userAttributes = filteredUser.getAllUserAttributes();
|
|
643
|
+
_sendEventStream(_buildIdentityEvent('modify_user', filteredUser));
|
|
585
644
|
}
|
|
586
645
|
|
|
587
646
|
function setUserAttribute(key, value) {
|
|
@@ -700,6 +759,9 @@ var RoktKit = (function (exports) {
|
|
|
700
759
|
this.setExtensionData = setExtensionData;
|
|
701
760
|
this.setUserAttribute = setUserAttribute;
|
|
702
761
|
this.onUserIdentified = onUserIdentified;
|
|
762
|
+
this.onLoginComplete = onLoginComplete;
|
|
763
|
+
this.onLogoutComplete = onLogoutComplete;
|
|
764
|
+
this.onModifyComplete = onModifyComplete;
|
|
703
765
|
this.removeUserAttribute = removeUserAttribute;
|
|
704
766
|
|
|
705
767
|
/**
|
|
@@ -756,7 +818,7 @@ var RoktKit = (function (exports) {
|
|
|
756
818
|
|
|
757
819
|
var ADBLOCK_CONTROL_DOMAIN = 'apps.roktecommerce.com';
|
|
758
820
|
var INIT_LOG_SAMPLING_RATE = 0.1;
|
|
759
|
-
var
|
|
821
|
+
var _allowedOriginHashes = [-553112570, 549508659];
|
|
760
822
|
|
|
761
823
|
function djb2(str) {
|
|
762
824
|
var hash = 5381;
|
|
@@ -768,7 +830,8 @@ var RoktKit = (function (exports) {
|
|
|
768
830
|
}
|
|
769
831
|
|
|
770
832
|
function sendAdBlockMeasurementSignals(domain, version) {
|
|
771
|
-
|
|
833
|
+
var originHash = djb2(window.location.origin);
|
|
834
|
+
if (_allowedOriginHashes.indexOf(originHash) === -1) {
|
|
772
835
|
return;
|
|
773
836
|
}
|
|
774
837
|
|
|
@@ -807,7 +870,7 @@ var RoktKit = (function (exports) {
|
|
|
807
870
|
|
|
808
871
|
function generateIntegrationName(customIntegrationName) {
|
|
809
872
|
var coreSdkVersion = window.mParticle.getVersion();
|
|
810
|
-
var kitVersion = "1.
|
|
873
|
+
var kitVersion = "1.20.0";
|
|
811
874
|
var name = 'mParticle_' + 'wsdkv_' + coreSdkVersion + '_kitv_' + kitVersion;
|
|
812
875
|
|
|
813
876
|
if (customIntegrationName) {
|