@mparticle/web-sdk 2.26.2 → 2.26.4

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/src/identity.js CHANGED
@@ -6,27 +6,32 @@ import {
6
6
  tryCacheIdentity,
7
7
  } from './identity-utils';
8
8
  import AudienceManager from './audienceManager';
9
- const { Messages, HTTPCodes, FeatureFlags, IdentityMethods } = Constants;
9
+
10
+ const { Messages, HTTPCodes, FeatureFlags } = Constants;
10
11
  const { ErrorMessages } = Messages;
11
- const { CacheIdentity } = FeatureFlags;
12
- const { Identify, Modify, Login, Logout } = IdentityMethods;
13
- import {
14
- generateDeprecationMessage,
15
- isEmpty,
16
- isFunction,
17
- isObject,
18
- } from './utils';
19
- import { didUserChange } from './user-utils';
20
- import { getNewIdentitiesByName } from './type-utils';
21
12
 
22
- export default function Identity(mpInstance) {
23
- const { getFeatureFlag, extend } = mpInstance._Helpers;
13
+ const { Identify, Modify, Login, Logout } = Constants.IdentityMethods;
24
14
 
15
+ export default function Identity(mpInstance) {
25
16
  var self = this;
26
17
  this.idCache = null;
27
18
  this.audienceManager = null;
28
19
 
29
- // https://go.mparticle.com/work/SQDSDKS-6353
20
+ this.checkIdentitySwap = function(
21
+ previousMPID,
22
+ currentMPID,
23
+ currentSessionMPIDs
24
+ ) {
25
+ if (previousMPID && currentMPID && previousMPID !== currentMPID) {
26
+ var persistence = mpInstance._Persistence.getPersistence();
27
+ if (persistence) {
28
+ persistence.cu = currentMPID;
29
+ persistence.gs.csm = currentSessionMPIDs;
30
+ mpInstance._Persistence.savePersistence(persistence);
31
+ }
32
+ }
33
+ };
34
+
30
35
  this.IdentityRequest = {
31
36
  preProcessIdentityRequest: function(identityApiData, callback, method) {
32
37
  mpInstance.Logger.verbose(
@@ -130,9 +135,9 @@ export default function Identity(mpInstance) {
130
135
  var key;
131
136
  if (
132
137
  newIdentities &&
133
- isObject(newIdentities) &&
138
+ mpInstance._Helpers.isObject(newIdentities) &&
134
139
  previousIdentities &&
135
- isObject(previousIdentities)
140
+ mpInstance._Helpers.isObject(previousIdentities)
136
141
  ) {
137
142
  for (key in newIdentities) {
138
143
  identityChanges.push({
@@ -149,7 +154,11 @@ export default function Identity(mpInstance) {
149
154
  // takes 2 UI objects keyed by name, combines them, returns them keyed by type
150
155
  combineUserIdentities: function(previousUIByName, newUIByName) {
151
156
  var combinedUIByType = {};
152
- var combinedUIByName = extend({}, previousUIByName, newUIByName);
157
+
158
+ var combinedUIByName = mpInstance._Helpers.extend(
159
+ previousUIByName,
160
+ newUIByName
161
+ );
153
162
 
154
163
  for (var key in combinedUIByName) {
155
164
  var type = Types.IdentityType.getIdentityType(key);
@@ -223,7 +232,6 @@ export default function Identity(mpInstance) {
223
232
  * @param {Function} [callback] A callback function that is called when the identify request completes
224
233
  */
225
234
  identify: function(identityApiData, callback) {
226
- // https://go.mparticle.com/work/SQDSDKS-6337
227
235
  var mpid,
228
236
  currentUser = mpInstance.Identity.getCurrentUser(),
229
237
  preProcessResult = mpInstance._Identity.IdentityRequest.preProcessIdentityRequest(
@@ -317,7 +325,6 @@ export default function Identity(mpInstance) {
317
325
  * @param {Function} [callback] A callback function that is called when the logout request completes
318
326
  */
319
327
  logout: function(identityApiData, callback) {
320
- // https://go.mparticle.com/work/SQDSDKS-6337
321
328
  var mpid,
322
329
  currentUser = mpInstance.Identity.getCurrentUser(),
323
330
  preProcessResult = mpInstance._Identity.IdentityRequest.preProcessIdentityRequest(
@@ -407,7 +414,6 @@ export default function Identity(mpInstance) {
407
414
  * @param {Function} [callback] A callback function that is called when the login request completes
408
415
  */
409
416
  login: function(identityApiData, callback) {
410
- // https://go.mparticle.com/work/SQDSDKS-6337
411
417
  var mpid,
412
418
  currentUser = mpInstance.Identity.getCurrentUser(),
413
419
  preProcessResult = mpInstance._Identity.IdentityRequest.preProcessIdentityRequest(
@@ -503,7 +509,6 @@ export default function Identity(mpInstance) {
503
509
  * @param {Function} [callback] A callback function that is called when the modify request completes
504
510
  */
505
511
  modify: function(identityApiData, callback) {
506
- // https://go.mparticle.com/work/SQDSDKS-6337
507
512
  var mpid,
508
513
  currentUser = mpInstance.Identity.getCurrentUser(),
509
514
  preProcessResult = mpInstance._Identity.IdentityRequest.preProcessIdentityRequest(
@@ -791,7 +796,6 @@ export default function Identity(mpInstance) {
791
796
  },
792
797
  };
793
798
 
794
- // https://go.mparticle.com/work/SQDSDKS-6354
795
799
  /**
796
800
  * Invoke these methods on the mParticle.Identity.getCurrentUser() object.
797
801
  * Example: mParticle.Identity.getCurrentUser().getAllUserAttributes()
@@ -951,7 +955,7 @@ export default function Identity(mpInstance) {
951
955
  */
952
956
  setUserAttributes: function(userAttributes) {
953
957
  mpInstance._SessionManager.resetSessionTimer();
954
- if (isObject(userAttributes)) {
958
+ if (mpInstance._Helpers.isObject(userAttributes)) {
955
959
  if (mpInstance._Helpers.canLog()) {
956
960
  for (var key in userAttributes) {
957
961
  if (userAttributes.hasOwnProperty(key)) {
@@ -1268,6 +1272,7 @@ export default function Identity(mpInstance) {
1268
1272
  * @method getuserAudiences
1269
1273
  * @param {Function} [callback] A callback function that is invoked when the user audience request completes
1270
1274
  */
1275
+ // https://go.mparticle.com/work/SQDSDKS-6436
1271
1276
  getUserAudiences: function(callback) {
1272
1277
  // user audience API is feature flagged
1273
1278
  if (
@@ -1476,7 +1481,6 @@ export default function Identity(mpInstance) {
1476
1481
  };
1477
1482
  };
1478
1483
 
1479
- // https://go.mparticle.com/work/SQDSDKS-6355
1480
1484
  this.parseIdentityResponse = function(
1481
1485
  xhr,
1482
1486
  previousMPID,
@@ -1486,46 +1490,64 @@ export default function Identity(mpInstance) {
1486
1490
  knownIdentities,
1487
1491
  parsingCachedResponse
1488
1492
  ) {
1489
- const prevUser = mpInstance.Identity.getUser(previousMPID);
1490
- const prevUserMPID = prevUser ? prevUser.getMPID() : null;
1491
- const previousUIByName = prevUser
1492
- ? prevUser.getUserIdentities().userIdentities
1493
- : {};
1494
-
1495
- let identityApiResult;
1496
-
1497
- let newUser;
1498
- let newIdentitiesByType = {};
1499
-
1493
+ var prevUser = mpInstance.Identity.getUser(previousMPID),
1494
+ newUser,
1495
+ mpidIsNotInCookies,
1496
+ identityApiResult,
1497
+ indexOfMPID,
1498
+ newIdentitiesByType = {},
1499
+ previousUIByName = prevUser
1500
+ ? prevUser.getUserIdentities().userIdentities
1501
+ : {},
1502
+ previousUIByNameCopy = mpInstance._Helpers.extend(
1503
+ {},
1504
+ previousUIByName
1505
+ );
1500
1506
  mpInstance._Store.identityCallInFlight = false;
1501
1507
 
1502
1508
  try {
1503
1509
  mpInstance.Logger.verbose(
1504
1510
  'Parsing "' + method + '" identity response from server'
1505
1511
  );
1512
+ if (xhr.responseText) {
1513
+ identityApiResult = JSON.parse(xhr.responseText);
1506
1514
 
1507
- identityApiResult = xhr.responseText
1508
- ? JSON.parse(xhr.responseText)
1509
- : null;
1510
-
1511
- mpInstance._Store.isLoggedIn =
1512
- identityApiResult?.is_logged_in || false;
1513
- mpInstance._Store.mpid = identityApiResult.mpid;
1514
-
1515
- if (prevUser) {
1516
- // https://go.mparticle.com/work/SQDSDKS-6329
1517
- mpInstance._Persistence.setLastSeenTime(previousMPID);
1515
+ if (identityApiResult.hasOwnProperty('is_logged_in')) {
1516
+ mpInstance._Store.isLoggedIn =
1517
+ identityApiResult.is_logged_in;
1518
+ }
1518
1519
  }
1519
1520
 
1520
- const mpidIsNotInCookies = !mpInstance._Persistence.getFirstSeenTime(
1521
- identityApiResult.mpid
1522
- );
1521
+ // set currentUser
1522
+ if (
1523
+ !prevUser ||
1524
+ (prevUser.getMPID() &&
1525
+ identityApiResult.mpid &&
1526
+ identityApiResult.mpid !== prevUser.getMPID())
1527
+ ) {
1528
+ mpInstance._Store.mpid = identityApiResult.mpid;
1523
1529
 
1524
- // https://go.mparticle.com/work/SQDSDKS-6329
1525
- mpInstance._Persistence.setFirstSeenTime(identityApiResult.mpid);
1530
+ if (prevUser) {
1531
+ mpInstance._Persistence.setLastSeenTime(previousMPID);
1532
+ }
1533
+
1534
+ if (
1535
+ !mpInstance._Persistence.getFirstSeenTime(
1536
+ identityApiResult.mpid
1537
+ )
1538
+ )
1539
+ mpidIsNotInCookies = true;
1540
+ mpInstance._Persistence.setFirstSeenTime(
1541
+ identityApiResult.mpid
1542
+ );
1543
+ }
1526
1544
 
1527
1545
  if (xhr.status === 200) {
1528
- if (getFeatureFlag(CacheIdentity)) {
1546
+ if (
1547
+ mpInstance._Helpers.getFeatureFlag(
1548
+ Constants.FeatureFlags.CacheIdentity
1549
+ )
1550
+ ) {
1529
1551
  cacheOrClearIdCache(
1530
1552
  method,
1531
1553
  knownIdentities,
@@ -1535,14 +1557,6 @@ export default function Identity(mpInstance) {
1535
1557
  );
1536
1558
  }
1537
1559
 
1538
- const incomingUser = self.IdentityAPI.getUser(
1539
- identityApiResult.mpid
1540
- );
1541
-
1542
- const incomingMpidUIByName = incomingUser
1543
- ? incomingUser.getUserIdentities().userIdentities
1544
- : {};
1545
-
1546
1560
  if (method === Modify) {
1547
1561
  newIdentitiesByType = mpInstance._Identity.IdentityRequest.combineUserIdentities(
1548
1562
  previousUIByName,
@@ -1554,32 +1568,71 @@ export default function Identity(mpInstance) {
1554
1568
  newIdentitiesByType
1555
1569
  );
1556
1570
  } else {
1557
- // https://go.mparticle.com/work/SQDSDKS-6356
1571
+ var incomingUser = self.IdentityAPI.getUser(
1572
+ identityApiResult.mpid
1573
+ );
1574
+
1575
+ var incomingMpidUIByName = incomingUser
1576
+ ? incomingUser.getUserIdentities().userIdentities
1577
+ : {};
1578
+
1579
+ var incomingMpidUIByNameCopy = mpInstance._Helpers.extend(
1580
+ {},
1581
+ incomingMpidUIByName
1582
+ );
1583
+ mpInstance.Logger.verbose(
1584
+ 'Successfully parsed Identity Response'
1585
+ );
1586
+
1558
1587
  //this covers an edge case where, users stored before "firstSeenTime" was introduced
1559
1588
  //will not have a value for "fst" until the current MPID changes, and in some cases,
1560
1589
  //the current MPID will never change
1561
1590
  if (
1562
1591
  method === Identify &&
1563
1592
  prevUser &&
1564
- identityApiResult.mpid === prevUserMPID
1593
+ identityApiResult.mpid === prevUser.getMPID()
1565
1594
  ) {
1566
1595
  mpInstance._Persistence.setFirstSeenTime(
1567
1596
  identityApiResult.mpid
1568
1597
  );
1569
1598
  }
1570
1599
 
1571
- mpInstance._Store.addMpidToSessionHistory(
1572
- identityApiResult.mpid,
1573
- previousMPID
1600
+ indexOfMPID = mpInstance._Store.currentSessionMPIDs.indexOf(
1601
+ identityApiResult.mpid
1574
1602
  );
1575
1603
 
1604
+ if (
1605
+ mpInstance._Store.sessionId &&
1606
+ identityApiResult.mpid &&
1607
+ previousMPID !== identityApiResult.mpid &&
1608
+ indexOfMPID < 0
1609
+ ) {
1610
+ mpInstance._Store.currentSessionMPIDs.push(
1611
+ identityApiResult.mpid
1612
+ );
1613
+ }
1614
+
1615
+ if (indexOfMPID > -1) {
1616
+ mpInstance._Store.currentSessionMPIDs = mpInstance._Store.currentSessionMPIDs
1617
+ .slice(0, indexOfMPID)
1618
+ .concat(
1619
+ mpInstance._Store.currentSessionMPIDs.slice(
1620
+ indexOfMPID + 1,
1621
+ mpInstance._Store.currentSessionMPIDs.length
1622
+ )
1623
+ );
1624
+ mpInstance._Store.currentSessionMPIDs.push(
1625
+ identityApiResult.mpid
1626
+ );
1627
+ }
1628
+
1576
1629
  mpInstance._CookieSyncManager.attemptCookieSync(
1577
1630
  previousMPID,
1578
1631
  identityApiResult.mpid,
1579
1632
  mpidIsNotInCookies
1580
1633
  );
1581
1634
 
1582
- mpInstance._Persistence.swapCurrentUser(
1635
+ self.checkIdentitySwap(
1583
1636
  previousMPID,
1584
1637
  identityApiResult.mpid,
1585
1638
  mpInstance._Store.currentSessionMPIDs
@@ -1587,7 +1640,8 @@ export default function Identity(mpInstance) {
1587
1640
 
1588
1641
  if (
1589
1642
  identityApiData &&
1590
- !isEmpty(identityApiData.userIdentities)
1643
+ identityApiData.userIdentities &&
1644
+ Object.keys(identityApiData.userIdentities).length
1591
1645
  ) {
1592
1646
  newIdentitiesByType = self.IdentityRequest.combineUserIdentities(
1593
1647
  incomingMpidUIByName,
@@ -1606,71 +1660,112 @@ export default function Identity(mpInstance) {
1606
1660
  identityApiData
1607
1661
  );
1608
1662
 
1609
- // https://go.mparticle.com/work/SQDSDKS-6357
1610
1663
  mpInstance._Store.context =
1611
1664
  identityApiResult.context || mpInstance._Store.context;
1612
1665
  }
1613
1666
 
1614
1667
  newUser = mpInstance.Identity.getCurrentUser();
1615
1668
 
1616
- // https://go.mparticle.com/work/SQDSDKS-6359
1617
- tryOnUserAlias(
1618
- prevUser,
1619
- newUser,
1620
- identityApiData,
1621
- mpInstance.Logger
1622
- );
1623
-
1624
- const persistence = mpInstance._Persistence.getPersistence();
1669
+ if (
1670
+ identityApiData &&
1671
+ identityApiData.onUserAlias &&
1672
+ mpInstance._Helpers.Validators.isFunction(
1673
+ identityApiData.onUserAlias
1674
+ )
1675
+ ) {
1676
+ try {
1677
+ mpInstance.Logger.warning(
1678
+ 'Deprecated function onUserAlias will be removed in future releases'
1679
+ );
1680
+ identityApiData.onUserAlias(prevUser, newUser);
1681
+ } catch (e) {
1682
+ mpInstance.Logger.error(
1683
+ 'There was an error with your onUserAlias function - ' +
1684
+ e
1685
+ );
1686
+ }
1687
+ }
1688
+ var persistence = mpInstance._Persistence.getPersistence();
1625
1689
 
1626
1690
  if (newUser) {
1627
1691
  mpInstance._Persistence.storeDataInMemory(
1628
1692
  persistence,
1629
1693
  newUser.getMPID()
1630
1694
  );
1695
+ if (
1696
+ !prevUser ||
1697
+ newUser.getMPID() !== prevUser.getMPID() ||
1698
+ prevUser.isLoggedIn() !== newUser.isLoggedIn()
1699
+ ) {
1700
+ mpInstance._Forwarders.initForwarders(
1701
+ newUser.getUserIdentities().userIdentities,
1702
+ mpInstance._APIClient.prepareForwardingStats
1703
+ );
1704
+ }
1631
1705
 
1632
- self.reinitForwardersOnUserChange(prevUser, newUser);
1633
- self.setForwarderCallbacks(newUser, method);
1706
+ // TODO: https://go.mparticle.com/work/SQDSDKS-6036
1707
+ mpInstance._Forwarders.setForwarderUserIdentities(
1708
+ newUser.getUserIdentities().userIdentities
1709
+ );
1710
+ mpInstance._Forwarders.setForwarderOnIdentityComplete(
1711
+ newUser,
1712
+ method
1713
+ );
1714
+ mpInstance._Forwarders.setForwarderOnUserIdentified(
1715
+ newUser
1716
+ );
1634
1717
  }
1718
+ var newIdentitiesByName = {};
1635
1719
 
1636
- const newIdentitiesByName = getNewIdentitiesByName(
1637
- newIdentitiesByType
1638
- );
1639
-
1640
- const uiByName =
1641
- method === Modify ? previousUIByName : incomingMpidUIByName;
1720
+ for (var key in newIdentitiesByType) {
1721
+ newIdentitiesByName[
1722
+ Types.IdentityType.getIdentityName(
1723
+ mpInstance._Helpers.parseNumber(key)
1724
+ )
1725
+ ] = newIdentitiesByType[key];
1726
+ }
1642
1727
 
1643
1728
  self.sendUserIdentityChangeEvent(
1644
1729
  newIdentitiesByName,
1730
+ method,
1645
1731
  identityApiResult.mpid,
1646
- uiByName
1732
+ method === Modify
1733
+ ? previousUIByNameCopy
1734
+ : incomingMpidUIByNameCopy
1647
1735
  );
1648
1736
  }
1649
1737
 
1650
1738
  if (callback) {
1651
- const callbackCode =
1652
- xhr.status === 0 ? HTTPCodes.noHttpCoverage : xhr.status;
1653
-
1654
- mpInstance._Helpers.invokeCallback(
1655
- callback,
1656
- callbackCode,
1657
- identityApiResult || null,
1658
- newUser
1659
- );
1660
- } else if (
1661
- identityApiResult &&
1662
- !isEmpty(identityApiResult.errors)
1663
- ) {
1664
- mpInstance.Logger.error(
1665
- 'Received HTTP response code of ' +
1666
- xhr.status +
1667
- ' - ' +
1668
- identityApiResult.errors[0].message
1669
- );
1739
+ if (xhr.status === 0) {
1740
+ mpInstance._Helpers.invokeCallback(
1741
+ callback,
1742
+ HTTPCodes.noHttpCoverage,
1743
+ identityApiResult || null,
1744
+ newUser
1745
+ );
1746
+ } else {
1747
+ mpInstance._Helpers.invokeCallback(
1748
+ callback,
1749
+ xhr.status,
1750
+ identityApiResult || null,
1751
+ newUser
1752
+ );
1753
+ }
1754
+ } else {
1755
+ if (
1756
+ identityApiResult &&
1757
+ identityApiResult.errors &&
1758
+ identityApiResult.errors.length
1759
+ ) {
1760
+ mpInstance.Logger.error(
1761
+ 'Received HTTP response code of ' +
1762
+ xhr.status +
1763
+ ' - ' +
1764
+ identityApiResult.errors[0].message
1765
+ );
1766
+ }
1670
1767
  }
1671
1768
 
1672
- mpInstance.Logger.verbose('Successfully parsed Identity Response');
1673
-
1674
1769
  mpInstance._APIClient.processQueuedEvents();
1675
1770
  } catch (e) {
1676
1771
  if (callback) {
@@ -1692,28 +1787,30 @@ export default function Identity(mpInstance) {
1692
1787
 
1693
1788
  this.sendUserIdentityChangeEvent = function(
1694
1789
  newUserIdentities,
1790
+ method,
1695
1791
  mpid,
1696
- currentUserIdentities
1792
+ prevUserIdentities
1697
1793
  ) {
1698
- // https://go.mparticle.com/work/SQDSDKS-6354
1699
- const currentUserInMemory = this.IdentityAPI.getUser(mpid);
1794
+ var currentUserInMemory, userIdentityChangeEvent;
1795
+
1796
+ if (!mpid) {
1797
+ if (method !== Modify) {
1798
+ return;
1799
+ }
1800
+ }
1801
+
1802
+ currentUserInMemory = this.IdentityAPI.getUser(mpid);
1700
1803
 
1701
1804
  for (var identityType in newUserIdentities) {
1702
- // Verifies a change actually happened
1703
1805
  if (
1704
- currentUserIdentities[identityType] !==
1806
+ prevUserIdentities[identityType] !==
1705
1807
  newUserIdentities[identityType]
1706
1808
  ) {
1707
- // If a new identity type was introduced when the identity changes
1708
- // we need to notify the server so that it will associate the new
1709
- // identity type with subsequent events
1710
- const isNewUserIdentityType = !currentUserIdentities[
1711
- identityType
1712
- ];
1713
- const userIdentityChangeEvent = self.createUserIdentityChange(
1809
+ var isNewUserIdentityType = !prevUserIdentities[identityType];
1810
+ userIdentityChangeEvent = self.createUserIdentityChange(
1714
1811
  identityType,
1715
1812
  newUserIdentities[identityType],
1716
- currentUserIdentities[identityType],
1813
+ prevUserIdentities[identityType],
1717
1814
  isNewUserIdentityType,
1718
1815
  currentUserInMemory
1719
1816
  );
@@ -1728,18 +1825,19 @@ export default function Identity(mpInstance) {
1728
1825
  identityType,
1729
1826
  newIdentity,
1730
1827
  oldIdentity,
1731
- isIdentityTypeNewToBatch,
1828
+ newCreatedThisBatch,
1732
1829
  userInMemory
1733
1830
  ) {
1734
1831
  var userIdentityChangeEvent;
1735
1832
 
1833
+ // https://go.mparticle.com/work/SQDSDKS-6439
1736
1834
  userIdentityChangeEvent = mpInstance._ServerModel.createEventObject({
1737
1835
  messageType: Types.MessageType.UserIdentityChange,
1738
1836
  userIdentityChanges: {
1739
1837
  New: {
1740
1838
  IdentityType: identityType,
1741
1839
  Identity: newIdentity,
1742
- CreatedThisBatch: isIdentityTypeNewToBatch,
1840
+ CreatedThisBatch: newCreatedThisBatch,
1743
1841
  },
1744
1842
  Old: {
1745
1843
  IdentityType: identityType,
@@ -1787,6 +1885,7 @@ export default function Identity(mpInstance) {
1787
1885
  }
1788
1886
  var userAttributeChangeEvent;
1789
1887
  if (newValue !== previousUserAttributeValue) {
1888
+ // https://go.mparticle.com/work/SQDSDKS-6439
1790
1889
  userAttributeChangeEvent = mpInstance._ServerModel.createEventObject(
1791
1890
  {
1792
1891
  messageType: Types.MessageType.UserAttributeChange,
@@ -1803,40 +1902,4 @@ export default function Identity(mpInstance) {
1803
1902
  }
1804
1903
  return userAttributeChangeEvent;
1805
1904
  };
1806
-
1807
- this.reinitForwardersOnUserChange = function(prevUser, newUser) {
1808
- if (didUserChange(prevUser, newUser)) {
1809
- mpInstance._Forwarders.initForwarders(
1810
- newUser.getUserIdentities().userIdentities,
1811
- mpInstance._APIClient.prepareForwardingStats
1812
- );
1813
- }
1814
- };
1815
-
1816
- this.setForwarderCallbacks = function(user, method) {
1817
- // https://go.mparticle.com/work/SQDSDKS-6036
1818
- mpInstance._Forwarders.setForwarderUserIdentities(
1819
- user.getUserIdentities().userIdentities
1820
- );
1821
- mpInstance._Forwarders.setForwarderOnIdentityComplete(user, method);
1822
- mpInstance._Forwarders.setForwarderOnUserIdentified(user);
1823
- };
1824
- }
1825
-
1826
- // https://go.mparticle.com/work/SQDSDKS-6359
1827
- function tryOnUserAlias(previousUser, newUser, identityApiData, logger) {
1828
- if (
1829
- identityApiData &&
1830
- identityApiData.onUserAlias &&
1831
- isFunction(identityApiData.onUserAlias)
1832
- ) {
1833
- try {
1834
- logger.warning(generateDeprecationMessage('onUserAlias'));
1835
- identityApiData.onUserAlias(previousUser, newUser);
1836
- } catch (e) {
1837
- logger.error(
1838
- 'There was an error with your onUserAlias function - ' + e
1839
- );
1840
- }
1841
- }
1842
1905
  }
@@ -10,7 +10,6 @@ export default function IdentityAPIClient(mpInstance) {
10
10
  var xhr,
11
11
  xhrCallback = function() {
12
12
  if (xhr.readyState === 4) {
13
- // https://go.mparticle.com/work/SQDSDKS-6368
14
13
  mpInstance.Logger.verbose(
15
14
  'Received ' + xhr.statusText + ' from server'
16
15
  );
@@ -74,7 +73,6 @@ export default function IdentityAPIClient(mpInstance) {
74
73
  previousMPID,
75
74
  xhrCallback = function() {
76
75
  if (xhr.readyState === 4) {
77
- // https://go.mparticle.com/work/SQDSDKS-6368
78
76
  mpInstance.Logger.verbose(
79
77
  'Received ' + xhr.statusText + ' from server'
80
78
  );
@@ -14,6 +14,7 @@ import {
14
14
  SessionAttributes,
15
15
  } from './store';
16
16
  import { Dictionary } from './utils';
17
+ import { UserAttributes } from './identity-user-interfaces';
17
18
 
18
19
  export type CookieSyncDate = Dictionary<string>;
19
20
  export type UploadsTable = Dictionary<any>;
@@ -22,9 +23,6 @@ export interface iForwardingStatsBatches {
22
23
  forwardingStatsEventQueue: ForwardingStatsData[];
23
24
  }
24
25
 
25
- // https://go.mparticle.com/work/SQDSDKS-5196
26
- export type UserAttributes = AllUserAttributes;
27
-
28
26
  export interface IGlobalStoreV2MinifiedKeys {
29
27
  sid: string; // Session ID
30
28
  ie: boolean; // Is Enabled
@@ -1012,21 +1012,6 @@ export default function _Persistence(mpInstance) {
1012
1012
  }
1013
1013
  };
1014
1014
 
1015
- this.swapCurrentUser = function(
1016
- previousMPID,
1017
- currentMPID,
1018
- currentSessionMPIDs
1019
- ) {
1020
- if (previousMPID && currentMPID && previousMPID !== currentMPID) {
1021
- var persistence = self.getPersistence();
1022
- if (persistence) {
1023
- persistence.cu = currentMPID;
1024
- persistence.gs.csm = currentSessionMPIDs;
1025
- self.savePersistence(persistence);
1026
- }
1027
- }
1028
- };
1029
-
1030
1015
  // https://go.mparticle.com/work/SQDSDKS-6021
1031
1016
  this.savePersistence = function(persistence) {
1032
1017
  var encodedPersistence = self.encodePersistence(
@@ -1112,7 +1097,6 @@ export default function _Persistence(mpInstance) {
1112
1097
  if (!mpid) {
1113
1098
  return;
1114
1099
  }
1115
- // https://go.mparticle.com/work/SQDSDKS-6329
1116
1100
  if (!time) {
1117
1101
  time = new Date().getTime();
1118
1102
  }
@@ -1153,7 +1137,6 @@ export default function _Persistence(mpInstance) {
1153
1137
  if (!mpid) {
1154
1138
  return;
1155
1139
  }
1156
- // https://go.mparticle.com/work/SQDSDKS-6329
1157
1140
  if (!time) {
1158
1141
  time = new Date().getTime();
1159
1142
  }