@mparticle/web-rokt-kit 1.19.0 → 1.21.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.
@@ -599,10 +599,59 @@ var constructor = function () {
599
599
  function onUserIdentified(filteredUser) {
600
600
  self.filters.filteredUser = filteredUser;
601
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));
602
645
  }
603
646
 
604
647
  function setUserAttribute(key, value) {
605
648
  self.userAttributes[key] = value;
649
+ _sendEventStream(
650
+ _buildIdentityEvent(
651
+ 'set_user_attributes',
652
+ self.filters.filteredUser || {}
653
+ )
654
+ );
606
655
  }
607
656
 
608
657
  function removeUserAttribute(key) {
@@ -717,6 +766,9 @@ var constructor = function () {
717
766
  this.setExtensionData = setExtensionData;
718
767
  this.setUserAttribute = setUserAttribute;
719
768
  this.onUserIdentified = onUserIdentified;
769
+ this.onLoginComplete = onLoginComplete;
770
+ this.onLogoutComplete = onLogoutComplete;
771
+ this.onModifyComplete = onModifyComplete;
720
772
  this.removeUserAttribute = removeUserAttribute;
721
773
 
722
774
  /**
@@ -825,7 +877,7 @@ var constructor = function () {
825
877
 
826
878
  function generateIntegrationName(customIntegrationName) {
827
879
  var coreSdkVersion = window.mParticle.getVersion();
828
- var kitVersion = "1.19.0";
880
+ var kitVersion = "1.21.0";
829
881
  var name = 'mParticle_' + 'wsdkv_' + coreSdkVersion + '_kitv_' + kitVersion;
830
882
 
831
883
  if (customIntegrationName) {
@@ -598,10 +598,59 @@ var RoktKit = (function (exports) {
598
598
  function onUserIdentified(filteredUser) {
599
599
  self.filters.filteredUser = filteredUser;
600
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));
601
644
  }
602
645
 
603
646
  function setUserAttribute(key, value) {
604
647
  self.userAttributes[key] = value;
648
+ _sendEventStream(
649
+ _buildIdentityEvent(
650
+ 'set_user_attributes',
651
+ self.filters.filteredUser || {}
652
+ )
653
+ );
605
654
  }
606
655
 
607
656
  function removeUserAttribute(key) {
@@ -716,6 +765,9 @@ var RoktKit = (function (exports) {
716
765
  this.setExtensionData = setExtensionData;
717
766
  this.setUserAttribute = setUserAttribute;
718
767
  this.onUserIdentified = onUserIdentified;
768
+ this.onLoginComplete = onLoginComplete;
769
+ this.onLogoutComplete = onLogoutComplete;
770
+ this.onModifyComplete = onModifyComplete;
719
771
  this.removeUserAttribute = removeUserAttribute;
720
772
 
721
773
  /**
@@ -824,7 +876,7 @@ var RoktKit = (function (exports) {
824
876
 
825
877
  function generateIntegrationName(customIntegrationName) {
826
878
  var coreSdkVersion = window.mParticle.getVersion();
827
- var kitVersion = "1.19.0";
879
+ var kitVersion = "1.21.0";
828
880
  var name = 'mParticle_' + 'wsdkv_' + coreSdkVersion + '_kitv_' + kitVersion;
829
881
 
830
882
  if (customIntegrationName) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mparticle/web-rokt-kit",
3
- "version": "1.19.0",
3
+ "version": "1.21.0",
4
4
  "description": "mParticle integration kit for Rokt",
5
5
  "main": "dist/Rokt-Kit.common.js",
6
6
  "files": [