@mparticle/web-sdk
Advanced tools
Comparing version 2.26.1 to 2.26.2
{ | ||
"name": "@mparticle/web-sdk", | ||
"version": "2.26.1", | ||
"version": "2.26.2", | ||
"description": "mParticle core SDK for web applications", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0", |
@@ -13,2 +13,3 @@ import Constants from './constants'; | ||
if (xhr.readyState === 4) { | ||
// https://go.mparticle.com/work/SQDSDKS-6368 | ||
mpInstance.Logger.verbose( | ||
@@ -77,2 +78,3 @@ 'Received ' + xhr.statusText + ' from server' | ||
if (xhr.readyState === 4) { | ||
// https://go.mparticle.com/work/SQDSDKS-6368 | ||
mpInstance.Logger.verbose( | ||
@@ -79,0 +81,0 @@ 'Received ' + xhr.statusText + ' from server' |
@@ -25,4 +25,3 @@ import { Context } from '@mparticle/event-models'; | ||
// TODO: Migrate this to @types/mparticle__web-sdk | ||
// https://go.mparticle.com/work/SQDSDKS-5196 | ||
// https://go.mparticle.com/work/SQDSDKS-5196 | ||
export type UserAttributes = AllUserAttributes; | ||
@@ -29,0 +28,0 @@ |
@@ -1015,2 +1015,17 @@ import Constants from './constants'; | ||
this.swapCurrentUser = function( | ||
previousMPID, | ||
currentMPID, | ||
currentSessionMPIDs | ||
) { | ||
if (previousMPID && currentMPID && previousMPID !== currentMPID) { | ||
var persistence = self.getPersistence(); | ||
if (persistence) { | ||
persistence.cu = currentMPID; | ||
persistence.gs.csm = currentSessionMPIDs; | ||
self.savePersistence(persistence); | ||
} | ||
} | ||
}; | ||
// https://go.mparticle.com/work/SQDSDKS-6021 | ||
@@ -1101,2 +1116,3 @@ this.savePersistence = function(persistence) { | ||
} | ||
// https://go.mparticle.com/work/SQDSDKS-6329 | ||
if (!time) { | ||
@@ -1142,2 +1158,3 @@ time = new Date().getTime(); | ||
} | ||
// https://go.mparticle.com/work/SQDSDKS-6329 | ||
if (!time) { | ||
@@ -1144,0 +1161,0 @@ time = new Date().getTime(); |
@@ -29,3 +29,6 @@ import * as EventsApi from '@mparticle/event-models'; | ||
EventCategory: number; | ||
// https://go.mparticle.com/work/SQDSDKS-5196 | ||
UserAttributes?: { [key: string]: string | string[] | null }; | ||
UserIdentities?: SDKUserIdentity[]; | ||
@@ -308,9 +311,12 @@ SourceMessageId: string; | ||
// FIXME: Resolve with User in @types/mparticle-web-sdk | ||
// https://go.mparticle.com/work/SQDSDKS-5033 | ||
// https://go.mparticle.com/work/SQDSDKS-5033 | ||
export interface MParticleUser { | ||
getMPID(): string; | ||
getConsentState(): SDKConsentState; | ||
getAllUserAttributes(): any; // FIXME; | ||
getUserIdentities(): IdentityApiData; // FIXME: Is this correct? | ||
getMPID?(): string; | ||
getConsentState?(): SDKConsentState; | ||
// https://go.mparticle.com/work/SQDSDKS-5196 | ||
getAllUserAttributes?(): any; | ||
getUserIdentities?(): IdentityApiData; | ||
isLoggedIn?(): boolean; | ||
} | ||
@@ -317,0 +323,0 @@ |
@@ -30,2 +30,3 @@ // TODO: This file is no longer the server model because the web SDK payload | ||
} from './consent'; | ||
import { UserAttributes } from './persistence.interfaces'; | ||
@@ -51,3 +52,6 @@ const MessageType = Types.MessageType; | ||
et?: number; | ||
// https://go.mparticle.com/work/SQDSDKS-5196 | ||
ua?: Dictionary<string | string[]>; | ||
ui?: SDKUserIdentity[]; | ||
@@ -54,0 +58,0 @@ ia?: Dictionary<Dictionary<string>>; |
@@ -29,2 +29,3 @@ import { Batch } from '@mparticle/event-models'; | ||
isObject, | ||
moveElementToEnd, | ||
parseNumber, | ||
@@ -189,2 +190,3 @@ returnConvertedBoolean, | ||
addMpidToSessionHistory?(mpid: MPID, previousMpid?: MPID): void; | ||
hasInvalidIdentifyRequest?: () => boolean; | ||
@@ -498,2 +500,18 @@ nullifySession?: () => void; | ||
this.addMpidToSessionHistory = (mpid: MPID, previousMPID?: MPID): void => { | ||
const indexOfMPID = this.currentSessionMPIDs.indexOf(mpid); | ||
if (mpid && previousMPID !== mpid && indexOfMPID < 0) { | ||
this.currentSessionMPIDs.push(mpid); | ||
return; | ||
} | ||
if (indexOfMPID >= 0) { | ||
this.currentSessionMPIDs = moveElementToEnd( | ||
this.currentSessionMPIDs, | ||
indexOfMPID | ||
); | ||
} | ||
}; | ||
this.getFirstSeenTime = (mpid: MPID) => { | ||
@@ -500,0 +518,0 @@ if (!mpid) { |
@@ -0,1 +1,3 @@ | ||
import { getIdentityName } from './type-utils'; | ||
var MessageType = { | ||
@@ -212,46 +214,3 @@ SessionStart: 1, | ||
IdentityType.getIdentityName = function(identityType) { | ||
switch (identityType) { | ||
case IdentityType.Other: | ||
return 'other'; | ||
case IdentityType.CustomerId: | ||
return 'customerid'; | ||
case IdentityType.Facebook: | ||
return 'facebook'; | ||
case IdentityType.Twitter: | ||
return 'twitter'; | ||
case IdentityType.Google: | ||
return 'google'; | ||
case IdentityType.Microsoft: | ||
return 'microsoft'; | ||
case IdentityType.Yahoo: | ||
return 'yahoo'; | ||
case IdentityType.Email: | ||
return 'email'; | ||
case IdentityType.FacebookCustomAudienceId: | ||
return 'facebookcustomaudienceid'; | ||
case IdentityType.Other2: | ||
return 'other2'; | ||
case IdentityType.Other3: | ||
return 'other3'; | ||
case IdentityType.Other4: | ||
return 'other4'; | ||
case IdentityType.Other5: | ||
return 'other5'; | ||
case IdentityType.Other6: | ||
return 'other6'; | ||
case IdentityType.Other7: | ||
return 'other7'; | ||
case IdentityType.Other8: | ||
return 'other8'; | ||
case IdentityType.Other9: | ||
return 'other9'; | ||
case IdentityType.Other10: | ||
return 'other10'; | ||
case IdentityType.MobileNumber: | ||
return 'mobile_number'; | ||
case IdentityType.PhoneNumber2: | ||
return 'phone_number_2'; | ||
case IdentityType.PhoneNumber3: | ||
return 'phone_number_3'; | ||
} | ||
return getIdentityName(identityType); | ||
}; | ||
@@ -258,0 +217,0 @@ |
@@ -230,2 +230,5 @@ import Constants from './constants'; | ||
const moveElementToEnd = <T>(array: T[], index: number): T[] => | ||
array.slice(0, index).concat(array.slice(index + 1), array[index]); | ||
export { | ||
@@ -260,2 +263,3 @@ createCookieString, | ||
mergeObjects, | ||
moveElementToEnd, | ||
}; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1533103
49
27548