@mparticle/web-sdk 2.26.9 → 2.26.10

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.
@@ -154,7 +154,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
154
154
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
155
155
  };
156
156
 
157
- var version = "2.26.9";
157
+ var version = "2.26.10";
158
158
 
159
159
  var Constants={sdkVersion:version,sdkVendor:"mparticle",platform:"web",Messages:{DeprecationMessages:{MethodIsDeprecatedPostfix:"is a deprecated method and will be removed in future releases",AlternativeMethodPrefix:"Please use the alternate method:"},ErrorMessages:{NoToken:"A token must be specified.",EventNameInvalidType:"Event name must be a valid string value.",EventDataInvalidType:"Event data must be a valid object hash.",LoggingDisabled:"Event logging is currently disabled.",CookieParseError:"Could not parse cookie",EventEmpty:"Event object is null or undefined, cancelling send",APIRequestEmpty:"APIRequest is null or undefined, cancelling send",NoEventType:"Event type must be specified.",TransactionIdRequired:"Transaction ID is required",TransactionRequired:"A transaction attributes object is required",PromotionIdRequired:"Promotion ID is required",BadAttribute:"Attribute value cannot be object or array",BadKey:"Key value cannot be object or array",BadLogPurchase:"Transaction attributes and a product are both required to log a purchase, https://docs.mparticle.com/?javascript#measuring-transactions",AudienceAPINotEnabled:"Your workspace is not enabled to retrieve user audiences."},InformationMessages:{CookieSearch:"Searching for cookie",CookieFound:"Cookie found, parsing values",CookieNotFound:"Cookies not found",CookieSet:"Setting cookie",CookieSync:"Performing cookie sync",SendBegin:"Starting to send event",SendIdentityBegin:"Starting to send event to identity server",SendWindowsPhone:"Sending event to Windows Phone container",SendIOS:"Calling iOS path: ",SendAndroid:"Calling Android JS interface method: ",SendHttp:"Sending event to mParticle HTTP service",SendAliasHttp:"Sending alias request to mParticle HTTP service",SendIdentityHttp:"Sending event to mParticle HTTP service",StartingNewSession:"Starting new Session",StartingLogEvent:"Starting to log event",StartingLogOptOut:"Starting to log user opt in/out",StartingEndSession:"Starting to end session",StartingInitialization:"Starting to initialize",StartingLogCommerceEvent:"Starting to log commerce event",StartingAliasRequest:"Starting to Alias MPIDs",LoadingConfig:"Loading configuration options",AbandonLogEvent:"Cannot log event, logging disabled or developer token not set",AbandonAliasUsers:"Cannot Alias Users, logging disabled or developer token not set",AbandonStartSession:"Cannot start session, logging disabled or developer token not set",AbandonEndSession:"Cannot end session, logging disabled or developer token not set",NoSessionToEnd:"Cannot end session, no active session found"},ValidationMessages:{ModifyIdentityRequestUserIdentitiesPresent:"identityRequests to modify require userIdentities to be present. Request not sent to server. Please fix and try again",IdentityRequesetInvalidKey:"There is an invalid key on your identityRequest object. It can only contain a `userIdentities` object and a `onUserAlias` function. Request not sent to server. Please fix and try again.",OnUserAliasType:"The onUserAlias value must be a function.",UserIdentities:"The userIdentities key must be an object with keys of identityTypes and values of strings. Request not sent to server. Please fix and try again.",UserIdentitiesInvalidKey:"There is an invalid identity key on your `userIdentities` object within the identityRequest. Request not sent to server. Please fix and try again.",UserIdentitiesInvalidValues:"All user identity values must be strings or null. Request not sent to server. Please fix and try again.",AliasMissingMpid:"Alias Request must contain both a destinationMpid and a sourceMpid",AliasNonUniqueMpid:"Alias Request's destinationMpid and sourceMpid must be unique",AliasMissingTime:"Alias Request must have both a startTime and an endTime",AliasStartBeforeEndTime:"Alias Request's endTime must be later than its startTime"}},NativeSdkPaths:{LogEvent:"logEvent",SetUserTag:"setUserTag",RemoveUserTag:"removeUserTag",SetUserAttribute:"setUserAttribute",RemoveUserAttribute:"removeUserAttribute",SetSessionAttribute:"setSessionAttribute",AddToCart:"addToCart",RemoveFromCart:"removeFromCart",ClearCart:"clearCart",LogOut:"logOut",SetUserAttributeList:"setUserAttributeList",RemoveAllUserAttributes:"removeAllUserAttributes",GetUserAttributesLists:"getUserAttributesLists",GetAllUserAttributes:"getAllUserAttributes",Identify:"identify",Logout:"logout",Login:"login",Modify:"modify",Alias:"aliasUsers",Upload:"upload"},StorageNames:{localStorageName:"mprtcl-api",localStorageNameV3:"mprtcl-v3",cookieName:"mprtcl-api",cookieNameV2:"mprtcl-v2",cookieNameV3:"mprtcl-v3",localStorageNameV4:"mprtcl-v4",localStorageProductsV4:"mprtcl-prodv4",cookieNameV4:"mprtcl-v4",currentStorageName:"mprtcl-v4",currentStorageProductsName:"mprtcl-prodv4"},DefaultConfig:{cookieDomain:null,cookieExpiration:365,logLevel:null,timeout:300,sessionTimeout:30,maxProducts:20,forwarderStatsTimeout:5e3,integrationDelayTimeout:5e3,maxCookieSize:3e3,aliasMaxWindow:90,uploadInterval:0// Maximum milliseconds in between batch uploads, below 500 will mean immediate upload. The server returns this as a string, but we are using it as a number internally
160
160
  },DefaultBaseUrls:{v1SecureServiceUrl:"jssdks.mparticle.com/v1/JS/",v2SecureServiceUrl:"jssdks.mparticle.com/v2/JS/",v3SecureServiceUrl:"jssdks.mparticle.com/v3/JS/",configUrl:"jssdkcdns.mparticle.com/JS/v2/",identityUrl:"identity.mparticle.com/v1/",aliasUrl:"jssdks.mparticle.com/v1/identity/",userAudienceUrl:"nativesdks.mparticle.com/v1/"},Base64CookieKeys:{csm:1,sa:1,ss:1,ua:1,ui:1,csd:1,ia:1,con:1},// https://go.mparticle.com/work/SQDSDKS-6039
@@ -554,7 +554,7 @@ var b={};for(var c in Constants.DefaultConfig)Constants.DefaultConfig.hasOwnProp
554
554
  function Store(a,b,c){var d=this,e=b._Helpers,f=e.createMainStorageName,g=e.createProductStorageName,h=b._NativeSdkHelpers.isWebviewEnabled,i={isEnabled:!0,sessionAttributes:{},currentSessionMPIDs:[],consentState:null,sessionId:null,isFirstRun:null,clientId:null,deviceId:null,devToken:null,serverSettings:{},dateLastEventSent:null,sessionStartDate:null,currentPosition:null,isTracking:!1,watchPositionId:null,cartProducts:[],eventQueue:[],currencyCode:null,globalTimer:null,context:null,configurationLoaded:!1,identityCallInFlight:!1,SDKConfig:{},nonCurrentUserMPIDs:{},identifyCalled:!1,isLoggedIn:!1,cookieSyncDates:{},integrationAttributes:{},requireDelay:!0,isLocalStorageAvailable:null,storageName:null,prodStorageName:null,activeForwarders:[],kits:{},sideloadedKits:[],configuredForwarders:[],pixelConfigurations:[],wrapperSDKInfo:{name:"none",version:null,isInfoSet:!1},// Placeholder for in-memory persistence model
555
555
  persistenceData:{gs:{}}};for(var j in i)this[j]=i[j];if(this.devToken=c||null,this.integrationDelayTimeoutStart=Date.now(),this.SDKConfig=createSDKConfig(a),a){a.hasOwnProperty("flags")||(this.SDKConfig.flags={}),this.SDKConfig.flags=processFlags(a),a.deviceId&&(this.deviceId=a.deviceId),this.SDKConfig.isDevelopmentMode=!!a.hasOwnProperty("isDevelopmentMode")&&returnConvertedBoolean(a.isDevelopmentMode);var k=processBaseUrls(a,this.SDKConfig.flags,c);for(var l in k)this.SDKConfig[l]=k[l];if(a.hasOwnProperty("logLevel")&&(this.SDKConfig.logLevel=a.logLevel),this.SDKConfig.useNativeSdk=!!a.useNativeSdk,this.SDKConfig.kits=a.kits||{},this.SDKConfig.sideloadedKits=a.sideloadedKits||[],this.SDKConfig.isIOS=a.hasOwnProperty("isIOS")?a.isIOS:!!(window.mParticle&&window.mParticle.isIOS)&&window.mParticle.isIOS,this.SDKConfig.useCookieStorage=!!a.hasOwnProperty("useCookieStorage")&&a.useCookieStorage,this.SDKConfig.maxProducts=a.hasOwnProperty("maxProducts")?a.maxProducts:Constants.DefaultConfig.maxProducts,this.SDKConfig.maxCookieSize=a.hasOwnProperty("maxCookieSize")?a.maxCookieSize:Constants.DefaultConfig.maxCookieSize,a.hasOwnProperty("appName")&&(this.SDKConfig.appName=a.appName),a.hasOwnProperty("package")&&(this.SDKConfig["package"]=a["package"]),this.SDKConfig.integrationDelayTimeout=a.hasOwnProperty("integrationDelayTimeout")?a.integrationDelayTimeout:Constants.DefaultConfig.integrationDelayTimeout,a.hasOwnProperty("identifyRequest")&&(this.SDKConfig.identifyRequest=a.identifyRequest),a.hasOwnProperty("identityCallback")){var m=a.identityCallback;b._Helpers.Validators.isFunction(m)?this.SDKConfig.identityCallback=a.identityCallback:b.Logger.warning("The optional callback must be a function. You tried entering a(n) "+_typeof(m)+" . Callback not set. Please set your callback again.");}if(a.hasOwnProperty("appVersion")&&(this.SDKConfig.appVersion=a.appVersion),a.hasOwnProperty("appName")&&(this.SDKConfig.appName=a.appName),a.hasOwnProperty("sessionTimeout")&&(this.SDKConfig.sessionTimeout=a.sessionTimeout),a.hasOwnProperty("dataPlan")){this.SDKConfig.dataPlan={PlanVersion:null,PlanId:null};var n=a.dataPlan;n.planId&&(isDataPlanSlug(n.planId)?this.SDKConfig.dataPlan.PlanId=n.planId:b.Logger.error("Your data plan id must be a string and match the data plan slug format (i.e. under_case_slug)")),n.planVersion&&(isNumber(n.planVersion)?this.SDKConfig.dataPlan.PlanVersion=n.planVersion:b.Logger.error("Your data plan version must be a number"));}else this.SDKConfig.dataPlan={};if(this.SDKConfig.forceHttps=!a.hasOwnProperty("forceHttps")||a.forceHttps,this.SDKConfig.customFlags=a.customFlags||{},this.SDKConfig.minWebviewBridgeVersion=a.hasOwnProperty("minWebviewBridgeVersion")?a.minWebviewBridgeVersion:1,this.SDKConfig.aliasMaxWindow=a.hasOwnProperty("aliasMaxWindow")?a.aliasMaxWindow:Constants.DefaultConfig.aliasMaxWindow,a.hasOwnProperty("dataPlanOptions")){var o=a.dataPlanOptions;o.hasOwnProperty("dataPlanVersion")&&o.hasOwnProperty("blockUserAttributes")&&o.hasOwnProperty("blockEventAttributes")&&o.hasOwnProperty("blockEvents")&&o.hasOwnProperty("blockUserIdentities")||b.Logger.error("Ensure your config.dataPlanOptions object has the following keys: a \"dataPlanVersion\" object, and \"blockUserAttributes\", \"blockEventAttributes\", \"blockEvents\", \"blockUserIdentities\" booleans");}a.hasOwnProperty("onCreateBatch")&&("function"==typeof a.onCreateBatch?this.SDKConfig.onCreateBatch=a.onCreateBatch:(b.Logger.error("config.onCreateBatch must be a function"),this.SDKConfig.onCreateBatch=void 0));}this._getFromPersistence=function(a,b){return a?(d.syncPersistenceData(),d.persistenceData&&d.persistenceData[a]&&d.persistenceData[a][b]?d.persistenceData[a][b]:null):null},this._setPersistence=function(a,c,e){var f;a&&(d.syncPersistenceData(),d.persistenceData&&(d.persistenceData[a]?d.persistenceData[a][c]=e:d.persistenceData[a]=(f={},f[c]=e,f),isObject(d.persistenceData[a][c])&&isEmpty(d.persistenceData[a][c])&&delete d.persistenceData[a][c],b._Persistence.savePersistence(d.persistenceData)));},this.hasInvalidIdentifyRequest=function(){var a=d.SDKConfig.identifyRequest;return isObject(a)&&isObject(a.userIdentities)&&isEmpty(a.userIdentities)||!a},this.getConsentState=function(a){var c=b._Consent.ConsentSerialization.fromMinifiedJsonObject,e=d._getFromPersistence(a,"con");return isEmpty(e)?null:c(e)},this.setConsentState=function(a,c){var e=b._Consent.ConsentSerialization.toMinifiedJsonObject;// If ConsentState is null, we assume the intent is to clear out the consent state
556
556
  (c||null===c)&&d._setPersistence(a,"con",e(c));},this.getDeviceId=function(){return d.deviceId},this.setDeviceId=function(a){d.deviceId=a,d.persistenceData.gs.das=a,b._Persistence.update();},this.getFirstSeenTime=function(a){return d._getFromPersistence(a,"fst")},this.setFirstSeenTime=function(a,b){if(a){var c=b||new Date().getTime();d._setPersistence(a,"fst",c);}},this.getLastSeenTime=function(a){if(!a)return null;// https://go.mparticle.com/work/SQDSDKS-6315
557
- var c=b.Identity.getCurrentUser();return a===(null===c||void 0===c?void 0:c.getMPID())?new Date().getTime():d._getFromPersistence(a,"lst")},this.setLastSeenTime=function(a,b){if(a){var c=b||new Date().getTime();d._setPersistence(a,"lst",c);}},this.syncPersistenceData=function(){var a=b._Persistence.getPersistence();d.persistenceData=b._Helpers.extend({},d.persistenceData,a);},this.getUserAttributes=function(a){return d._getFromPersistence(a,"ua")||{}},this.setUserAttributes=function(a,b){return d._setPersistence(a,"ua",b)},this.addMpidToSessionHistory=function(a,b){var c=d.currentSessionMPIDs.indexOf(a);return a&&b!==a&&0>c?void d.currentSessionMPIDs.push(a):void(0<=c&&(d.currentSessionMPIDs=moveElementToEnd(d.currentSessionMPIDs,c)))},this.nullifySession=function(){d.sessionId=null,d.dateLastEventSent=null,d.sessionAttributes={},b._Persistence.update();},this.processConfig=function(a){var c=a.workspaceToken,e=a.requiredWebviewBridgeName;// We should reprocess the flags in case they have changed when we request an updated config
557
+ var c=b.Identity.getCurrentUser();return a===(null===c||void 0===c?void 0:c.getMPID())?new Date().getTime():d._getFromPersistence(a,"lst")},this.setLastSeenTime=function(a,b){if(a){var c=b||new Date().getTime();d._setPersistence(a,"lst",c);}},this.syncPersistenceData=function(){var a=b._Persistence.getPersistence();d.persistenceData=b._Helpers.extend({},d.persistenceData,a);},this.getUserAttributes=function(a){return d._getFromPersistence(a,"ua")||{}},this.setUserAttributes=function(a,b){return d._setPersistence(a,"ua",b)},this.getUserIdentities=function(a){return d._getFromPersistence(a,"ui")||{}},this.setUserIdentities=function(a,b){d._setPersistence(a,"ui",b);},this.addMpidToSessionHistory=function(a,b){var c=d.currentSessionMPIDs.indexOf(a);return a&&b!==a&&0>c?void d.currentSessionMPIDs.push(a):void(0<=c&&(d.currentSessionMPIDs=moveElementToEnd(d.currentSessionMPIDs,c)))},this.nullifySession=function(){d.sessionId=null,d.dateLastEventSent=null,d.sessionAttributes={},b._Persistence.update();},this.processConfig=function(a){var c=a.workspaceToken,e=a.requiredWebviewBridgeName;// We should reprocess the flags in case they have changed when we request an updated config
558
558
  // such as if the SDK is being self-hosted and the flags are different on the server config
559
559
  // https://go.mparticle.com/work/SQDSDKS-6317
560
560
  d.SDKConfig.flags=processFlags(a),c?d.SDKConfig.workspaceToken=c:b.Logger.warning("You should have a workspaceToken on your config object for security purposes."),d.storageName=f(c),d.prodStorageName=g(c),d.SDKConfig.requiredWebviewBridgeName=e||c,d.webviewBridgeEnabled=h(d.SDKConfig.requiredWebviewBridgeName,d.SDKConfig.minWebviewBridgeVersion),d.configurationLoaded=!0;};}// https://go.mparticle.com/work/SQDSDKS-6317
@@ -626,7 +626,7 @@ var k={};for(var l in b)b.hasOwnProperty(l)&&(SDKv2NonMPIDCookieKeys[l]||l===b.c
626
626
  if(Object.keys(k).length)for(var m in k)g=d(b,c,e),g.length>f&&k.hasOwnProperty(m)&&-1===h.indexOf(m)&&delete b[m];// Comment 2b above
627
627
  for(var n,o=0;o<h.length&&(g=d(b,c,e),g.length>f);o++)n=h[o],b[n]?(a.Logger.verbose("Size of new encoded cookie is larger than maxCookieSize setting of "+f+". Removing from cookie the earliest logged in MPID containing: "+JSON.stringify(b[n],0,2)),delete b[n]):a.Logger.error("Unable to save MPID data to cookies because the resulting encoded cookie is larger than the maxCookieSize setting of "+f+". We recommend using a maxCookieSize of 1500.");}return g},this.findPrevCookiesBasedOnUI=function(b){var c,d=a._Persistence.getPersistence();if(b)for(var e in b.userIdentities)if(d&&Object.keys(d).length)for(var g in d)// any value in persistence that has an MPID key will be an MPID to search through
628
628
  // other keys on the cookie are currentSessionMPIDs and currentMPID which should not be searched
629
- if(d[g].mpid){var h=d[g].ui;for(var i in h)if(e===i&&b.userIdentities[e]===h[i]){c=g;break}}c&&f.storeDataInMemory(d,c);},this.encodePersistence=function(b){for(var c in b=JSON.parse(b),b.gs)b.gs.hasOwnProperty(c)&&(Base64CookieKeys[c]?b.gs[c]?Array.isArray(b.gs[c])&&b.gs[c].length||a._Helpers.isObject(b.gs[c])&&Object.keys(b.gs[c]).length?b.gs[c]=Base64.encode(JSON.stringify(b.gs[c])):delete b.gs[c]:delete b.gs[c]:"ie"===c?b.gs[c]=b.gs[c]?1:0:!b.gs[c]&&delete b.gs[c]);for(var d in b)if(b.hasOwnProperty(d)&&!SDKv2NonMPIDCookieKeys[d])for(c in b[d])b[d].hasOwnProperty(c)&&Base64CookieKeys[c]&&(a._Helpers.isObject(b[d][c])&&Object.keys(b[d][c]).length?b[d][c]=Base64.encode(JSON.stringify(b[d][c])):delete b[d][c]);return createCookieString(JSON.stringify(b))},this.decodePersistence=function(b){try{if(b){if(b=JSON.parse(revertCookieString(b)),a._Helpers.isObject(b)&&Object.keys(b).length){for(var c in b.gs)b.gs.hasOwnProperty(c)&&(Base64CookieKeys[c]?b.gs[c]=JSON.parse(Base64.decode(b.gs[c])):"ie"===c&&(b.gs[c]=!!b.gs[c]));for(var d in b)if(b.hasOwnProperty(d))if(!SDKv2NonMPIDCookieKeys[d])for(c in b[d])b[d].hasOwnProperty(c)&&Base64CookieKeys[c]&&b[d][c].length&&(b[d][c]=JSON.parse(Base64.decode(b[d][c])));else "l"===d&&(b[d]=!!b[d]);}return JSON.stringify(b)}}catch(b){a.Logger.error("Problem with decoding cookie",b);}},this.getCookieDomain=function(){if(a._Store.SDKConfig.cookieDomain)return a._Store.SDKConfig.cookieDomain;var b=f.getDomain(document,location.hostname);return ""===b?"":"."+b},this.getDomain=function(a,b){var c,d,e=b.split(".");for(c=e.length-1;0<=c;c--)if(d=e.slice(c).join("."),a.cookie="mptest=cookie;domain=."+d+";",-1<a.cookie.indexOf("mptest=cookie"))return a.cookie="mptest=;domain=."+d+";expires=Thu, 01 Jan 1970 00:00:01 GMT;",d;return ""},this.getUserIdentities=function(a){var b=f.getPersistence();return b&&b[a]&&b[a].ui?b[a].ui:{}},this.getCartProducts=function(b){var c,d=localStorage.getItem(a._Store.prodStorageName);return d&&(c=JSON.parse(Base64.decode(d)),c&&c[b]&&c[b].cp)?c[b].cp:[]},this.setCartProducts=function(b){if(a._Store.isLocalStorageAvailable)try{window.localStorage.setItem(encodeURIComponent(a._Store.prodStorageName),Base64.encode(JSON.stringify(b)));}catch(b){a.Logger.error("Error with setting products on localStorage.");}},this.saveUserIdentitiesToPersistence=function(a,b){if(b){var c=f.getPersistence();c&&(c[a]?c[a].ui=b:c[a]={ui:b},f.savePersistence(c));}},this.saveUserCookieSyncDatesToPersistence=function(a,b){if(b){var c=f.getPersistence();c&&(c[a]?c[a].csd=b:c[a]={csd:b}),f.savePersistence(c);}},this.swapCurrentUser=function(a,b,c){if(a&&b&&a!==b){var d=f.getPersistence();d&&(d.cu=b,d.gs.csm=c,f.savePersistence(d));}},this.savePersistence=function(b){var c,d=f.encodePersistence(JSON.stringify(b)),e=new Date,g=a._Store.storageName,h=new Date(e.getTime()+1e3*(60*(60*(24*a._Store.SDKConfig.cookieExpiration)))).toGMTString(),i=f.getCookieDomain();if(c=""===i?"":";domain="+i,a._Store.SDKConfig.useCookieStorage){var j=f.reduceAndEncodePersistence(b,h,c,a._Store.SDKConfig.maxCookieSize);window.document.cookie=encodeURIComponent(g)+"="+j;}else a._Store.isLocalStorageAvailable&&localStorage.setItem(a._Store.storageName,d);},this.getPersistence=function(){var a=this.useLocalStorage()?this.getLocalStorage():this.getCookie();return a},this.getFirstSeenTime=function(a){if(!a)return null;var b=f.getPersistence();return b&&b[a]&&b[a].fst?b[a].fst:null},this.setFirstSeenTime=function(a,b){if(a){b||(b=new Date().getTime());var c=f.getPersistence();c&&(!c[a]&&(c[a]={}),!c[a].fst&&(c[a].fst=b,f.savePersistence(c)));}// https://go.mparticle.com/work/SQDSDKS-6329
629
+ if(d[g].mpid){var h=d[g].ui;for(var i in h)if(e===i&&b.userIdentities[e]===h[i]){c=g;break}}c&&f.storeDataInMemory(d,c);},this.encodePersistence=function(b){for(var c in b=JSON.parse(b),b.gs)b.gs.hasOwnProperty(c)&&(Base64CookieKeys[c]?b.gs[c]?Array.isArray(b.gs[c])&&b.gs[c].length||a._Helpers.isObject(b.gs[c])&&Object.keys(b.gs[c]).length?b.gs[c]=Base64.encode(JSON.stringify(b.gs[c])):delete b.gs[c]:delete b.gs[c]:"ie"===c?b.gs[c]=b.gs[c]?1:0:!b.gs[c]&&delete b.gs[c]);for(var d in b)if(b.hasOwnProperty(d)&&!SDKv2NonMPIDCookieKeys[d])for(c in b[d])b[d].hasOwnProperty(c)&&Base64CookieKeys[c]&&(a._Helpers.isObject(b[d][c])&&Object.keys(b[d][c]).length?b[d][c]=Base64.encode(JSON.stringify(b[d][c])):delete b[d][c]);return createCookieString(JSON.stringify(b))},this.decodePersistence=function(b){try{if(b){if(b=JSON.parse(revertCookieString(b)),a._Helpers.isObject(b)&&Object.keys(b).length){for(var c in b.gs)b.gs.hasOwnProperty(c)&&(Base64CookieKeys[c]?b.gs[c]=JSON.parse(Base64.decode(b.gs[c])):"ie"===c&&(b.gs[c]=!!b.gs[c]));for(var d in b)if(b.hasOwnProperty(d))if(!SDKv2NonMPIDCookieKeys[d])for(c in b[d])b[d].hasOwnProperty(c)&&Base64CookieKeys[c]&&b[d][c].length&&(b[d][c]=JSON.parse(Base64.decode(b[d][c])));else "l"===d&&(b[d]=!!b[d]);}return JSON.stringify(b)}}catch(b){a.Logger.error("Problem with decoding cookie",b);}},this.getCookieDomain=function(){if(a._Store.SDKConfig.cookieDomain)return a._Store.SDKConfig.cookieDomain;var b=f.getDomain(document,location.hostname);return ""===b?"":"."+b},this.getDomain=function(a,b){var c,d,e=b.split(".");for(c=e.length-1;0<=c;c--)if(d=e.slice(c).join("."),a.cookie="mptest=cookie;domain=."+d+";",-1<a.cookie.indexOf("mptest=cookie"))return a.cookie="mptest=;domain=."+d+";expires=Thu, 01 Jan 1970 00:00:01 GMT;",d;return ""},this.getCartProducts=function(b){var c,d=localStorage.getItem(a._Store.prodStorageName);return d&&(c=JSON.parse(Base64.decode(d)),c&&c[b]&&c[b].cp)?c[b].cp:[]},this.setCartProducts=function(b){if(a._Store.isLocalStorageAvailable)try{window.localStorage.setItem(encodeURIComponent(a._Store.prodStorageName),Base64.encode(JSON.stringify(b)));}catch(b){a.Logger.error("Error with setting products on localStorage.");}},this.saveUserCookieSyncDatesToPersistence=function(a,b){if(b){var c=f.getPersistence();c&&(c[a]?c[a].csd=b:c[a]={csd:b}),f.savePersistence(c);}},this.swapCurrentUser=function(a,b,c){if(a&&b&&a!==b){var d=f.getPersistence();d&&(d.cu=b,d.gs.csm=c,f.savePersistence(d));}},this.savePersistence=function(b){var c,d=f.encodePersistence(JSON.stringify(b)),e=new Date,g=a._Store.storageName,h=new Date(e.getTime()+1e3*(60*(60*(24*a._Store.SDKConfig.cookieExpiration)))).toGMTString(),i=f.getCookieDomain();if(c=""===i?"":";domain="+i,a._Store.SDKConfig.useCookieStorage){var j=f.reduceAndEncodePersistence(b,h,c,a._Store.SDKConfig.maxCookieSize);window.document.cookie=encodeURIComponent(g)+"="+j;}else a._Store.isLocalStorageAvailable&&localStorage.setItem(a._Store.storageName,d);},this.getPersistence=function(){var a=this.useLocalStorage()?this.getLocalStorage():this.getCookie();return a},this.getFirstSeenTime=function(a){if(!a)return null;var b=f.getPersistence();return b&&b[a]&&b[a].fst?b[a].fst:null},this.setFirstSeenTime=function(a,b){if(a){b||(b=new Date().getTime());var c=f.getPersistence();c&&(!c[a]&&(c[a]={}),!c[a].fst&&(c[a].fst=b,f.savePersistence(c)));}// https://go.mparticle.com/work/SQDSDKS-6329
630
630
  },this.getLastSeenTime=function(b){if(!b)return null;if(b===a.Identity.getCurrentUser().getMPID())//if the mpid is the current user, its last seen time is the current time
631
631
  return new Date().getTime();var c=f.getPersistence();return c&&c[b]&&c[b].lst?c[b].lst:null},this.setLastSeenTime=function(a,b){if(a){b||(b=new Date().getTime());var c=f.getPersistence();c&&c[a]&&(c[a].lst=b,f.savePersistence(c));}// https://go.mparticle.com/work/SQDSDKS-6329
632
632
  },this.getDeviceId=function(){return a._Store.deviceId},this.setDeviceId=function(b){a._Store.deviceId=b,f.update();},this.resetPersistence=function(){if(c(StorageNames.localStorageName),c(StorageNames.localStorageNameV3),c(StorageNames.localStorageNameV4),c(a._Store.prodStorageName),c(a._Store.storageName),c(StorageNames.localStorageProductsV4),f.expireCookies(StorageNames.cookieName),f.expireCookies(StorageNames.cookieNameV2),f.expireCookies(StorageNames.cookieNameV3),f.expireCookies(StorageNames.cookieNameV4),f.expireCookies(a._Store.prodStorageName),f.expireCookies(a._Store.storageName),mParticle._isTestEnv){c(a._Helpers.createMainStorageName("abcdef")),f.expireCookies(a._Helpers.createMainStorageName("abcdef")),c(a._Helpers.createProductStorageName("abcdef"));}},this.forwardingStatsBatches={uploadsTable:{},forwardingStatsEventQueue:[]};}
@@ -640,7 +640,7 @@ c(b),b=null,a._Store.isTracking=!1;}));else {var d={coords:{latitude:a._Store.cu
640
640
  return a.Logger.verbose(Messages$3.InformationMessages.StartingLogCommerceEvent),b.ProductAction&&null===b.EventCategory?void a.Logger.error("Commerce event not sent. The mParticle.ProductActionType you passed was invalid. Re-check your code."):void(c=a._Helpers.sanitizeAttributes(c,b.EventName),a._Helpers.canLog()?(a._Store.webviewBridgeEnabled&&(b.ShoppingCart={}),c&&(b.EventAttributes=c),a._APIClient.sendEventToServer(b,d),a._Persistence.update()):a.Logger.verbose(Messages$3.InformationMessages.AbandonLogEvent))},this.addEventHandler=function(c,d,f,g,h){var j,k,e=[],l=function handler(c){var d=function timeoutHandler(){j.href?window.location.href=j.href:j.submit&&j.submit();};a.Logger.verbose("DOM event triggered, handling event"),b.logEvent({messageType:Types.MessageType.PageEvent,name:"function"==typeof f?f(j):f,data:"function"==typeof g?g(j):g,eventType:h||Types.EventType.Other}),(j.href&&"_blank"!==j.target||j.submit)&&(c.preventDefault?c.preventDefault():c.returnValue=!1,setTimeout(d,a._Store.SDKConfig.timeout));};if(!d)return void a.Logger.error("Can't bind event, selector is required");// Handle a css selector string or a dom element
641
641
  if("string"==typeof d?e=document.querySelectorAll(d):d.nodeType&&(e=[d]),e.length)for(a.Logger.verbose("Found "+e.length+" element"+(1<e.length?"s":"")+", attaching event handlers"),k=0;k<e.length;k++)j=e[k],j.addEventListener?j.addEventListener(c,l,!1):j.attachEvent?j.attachEvent("on"+c,l):j["on"+c]=l;else a.Logger.verbose("No elements found");};}
642
642
 
643
- function filteredMparticleUser(a,b,c,d){var e=this;return {getUserIdentities:function getUserIdentities(){var e={},f=c._Persistence.getUserIdentities(a);for(var g in f)if(f.hasOwnProperty(g)){var h=Types.IdentityType.getIdentityName(c._Helpers.parseNumber(g));d&&(!d||d.isIdentityBlocked(h))||(//if identity type is not blocked
643
+ function filteredMparticleUser(a,b,c,d){var e=this;return {getUserIdentities:function getUserIdentities(){var e={},f=c._Store.getUserIdentities(a);for(var g in f)if(f.hasOwnProperty(g)){var h=Types.IdentityType.getIdentityName(c._Helpers.parseNumber(g));d&&(!d||d.isIdentityBlocked(h))||(//if identity type is not blocked
644
644
  e[h]=f[g]);}return e=c._Helpers.filterUserIdentitiesForForwarders(e,b.userIdentityFilters),{userIdentities:e}},getMPID:function getMPID(){return a},getUserAttributesLists:function getUserAttributesLists(a){var b,f={};for(var g in b=e.getAllUserAttributes(),b)b.hasOwnProperty(g)&&Array.isArray(b[g])&&(d&&(!d||d.isAttributeKeyBlocked(g))||(f[g]=b[g].slice()));return f=c._Helpers.filterUserAttributes(f,a.userAttributeFilters),f},getAllUserAttributes:function getAllUserAttributes(){var e={},f=c._Store.getUserAttributes(a);if(f)for(var g in f)f.hasOwnProperty(g)&&(d&&(!d||d.isAttributeKeyBlocked(g))||(Array.isArray(f[g])?e[g]=f[g].slice():e[g]=f[g]));return e=c._Helpers.filterUserAttributes(e,b.userAttributeFilters),e}}}
645
645
 
646
646
  var _Constants$IdentityMe=Constants.IdentityMethods,Modify$3=_Constants$IdentityMe.Modify,Identify$2=_Constants$IdentityMe.Identify,Login$2=_Constants$IdentityMe.Login,Logout$2=_Constants$IdentityMe.Logout;function Forwarders(a,b){var c=this,d={setUserAttribute:"setUserAttribute",removeUserAttribute:"removeUserAttribute"};// TODO: https://go.mparticle.com/work/SQDSDKS-6036
@@ -753,7 +753,7 @@ var Messages$2=Constants.Messages,HTTPCodes$2=Constants.HTTPCodes,FeatureFlags$1
753
753
  // send a user identity change request on identify, login, logout, modify when any values change.
754
754
  // compare what identities exist vs what is previously was for the specific user if they were in memory before.
755
755
  // if it's the first time the user is logging in, send a user identity change request with
756
- this.idCache=null,this.audienceManager=null,this.IdentityRequest={preProcessIdentityRequest:function preProcessIdentityRequest(e,r,s){t.Logger.verbose(Messages$2.InformationMessages.StartingLogEvent+": "+s);var i=t._Helpers.Validators.validateIdentities(e,s);if(!i.valid)return t.Logger.error("ERROR: "+i.error),{valid:!1,error:i.error};if(r&&!t._Helpers.Validators.isFunction(r)){var n="The optional callback must be a function. You tried entering a(n) "+_typeof(r);return t.Logger.error(n),{valid:!1,error:n}}return {valid:!0}},createIdentityRequest:function createIdentityRequest(e,r,s,i,n,a,d){var o={client_sdk:{platform:r,sdk_vendor:s,sdk_version:i},context:a,environment:t._Store.SDKConfig.isDevelopmentMode?"development":"production",request_id:t._Helpers.generateUniqueId(),request_timestamp_ms:new Date().getTime(),previous_mpid:d||null,known_identities:createKnownIdentities(e,n)};return o},createModifyIdentityRequest:function createModifyIdentityRequest(e,r,s,i,n,a){return {client_sdk:{platform:s,sdk_vendor:i,sdk_version:n},context:a,environment:t._Store.SDKConfig.isDevelopmentMode?"development":"production",request_id:t._Helpers.generateUniqueId(),request_timestamp_ms:new Date().getTime(),identity_changes:this.createIdentityChanges(e,r)}},createIdentityChanges:function createIdentityChanges(e,t){var r,s=[];if(t&&isObject(t)&&e&&isObject(e))for(r in t)s.push({old_value:e[r]||null,new_value:t[r],identity_type:r});return s},// takes 2 UI objects keyed by name, combines them, returns them keyed by type
756
+ this.idCache=null,this.audienceManager=null,this.IdentityRequest={preProcessIdentityRequest:function preProcessIdentityRequest(e,r,s){t.Logger.verbose(Messages$2.InformationMessages.StartingLogEvent+": "+s);var i=t._Helpers.Validators.validateIdentities(e,s);if(!i.valid)return t.Logger.error("ERROR: "+i.error),{valid:!1,error:i.error};if(r&&!t._Helpers.Validators.isFunction(r)){var n="The optional callback must be a function. You tried entering a(n) "+_typeof(r);return t.Logger.error(n),{valid:!1,error:n}}return {valid:!0}},createIdentityRequest:function createIdentityRequest(e,r,s,i,n,a,o){var d={client_sdk:{platform:r,sdk_vendor:s,sdk_version:i},context:a,environment:t._Store.SDKConfig.isDevelopmentMode?"development":"production",request_id:t._Helpers.generateUniqueId(),request_timestamp_ms:new Date().getTime(),previous_mpid:o||null,known_identities:createKnownIdentities(e,n)};return d},createModifyIdentityRequest:function createModifyIdentityRequest(e,r,s,i,n,a){return {client_sdk:{platform:s,sdk_vendor:i,sdk_version:n},context:a,environment:t._Store.SDKConfig.isDevelopmentMode?"development":"production",request_id:t._Helpers.generateUniqueId(),request_timestamp_ms:new Date().getTime(),identity_changes:this.createIdentityChanges(e,r)}},createIdentityChanges:function createIdentityChanges(e,t){var r,s=[];if(t&&isObject(t)&&e&&isObject(e))for(r in t)s.push({old_value:e[r]||null,new_value:t[r],identity_type:r});return s},// takes 2 UI objects keyed by name, combines them, returns them keyed by type
757
757
  combineUserIdentities:function combineUserIdentities(e,t){var r={},s=i({},e,t);for(var n in s){var a=Types.IdentityType.getIdentityType(n);// this check removes anything that is not whitelisted as an identity type
758
758
  !1!==a&&0<=a&&(r[Types.IdentityType.getIdentityType(n)]=s[n]);}return r},createAliasNetworkRequest:function createAliasNetworkRequest(e){return {request_id:t._Helpers.generateUniqueId(),request_type:"alias",environment:t._Store.SDKConfig.isDevelopmentMode?"development":"production",api_key:t._Store.devToken,data:{destination_mpid:e.destinationMpid,source_mpid:e.sourceMpid,start_unixtime_ms:e.startTime,end_unixtime_ms:e.endTime,scope:e.scope,device_application_stamp:t._Store.deviceId}}},convertAliasToNative:function convertAliasToNative(e){return {DestinationMpid:e.destinationMpid,SourceMpid:e.sourceMpid,StartUnixtimeMs:e.startTime,EndUnixtimeMs:e.endTime}},convertToNative:function convertToNative(e){var t=[];if(e&&e.userIdentities){for(var r in e.userIdentities)e.userIdentities.hasOwnProperty(r)&&t.push({Type:Types.IdentityType.getIdentityType(r),Identity:e.userIdentities[r]});return {UserIdentities:t}}}},this.IdentityAPI={HTTPCodes:HTTPCodes$2,/**
759
759
  * Initiate a logout request to the mParticle server
@@ -761,25 +761,25 @@ combineUserIdentities:function combineUserIdentities(e,t){var r={},s=i({},e,t);f
761
761
  * @param {Object} identityApiData The identityApiData object as indicated [here](https://github.com/mParticle/mparticle-sdk-javascript/blob/master-v2/README.md#1-customize-the-sdk)
762
762
  * @param {Function} [callback] A callback function that is called when the identify request completes
763
763
  */identify:function identify(e,r){// https://go.mparticle.com/work/SQDSDKS-6337
764
- var s,i=t.Identity.getCurrentUser(),a=t._Identity.IdentityRequest.preProcessIdentityRequest(e,r,Identify);if(i&&(s=i.getMPID()),a.valid){var d=t._Identity.IdentityRequest.createIdentityRequest(e,Constants.platform,Constants.sdkVendor,Constants.sdkVersion,t._Store.deviceId,t._Store.context,s);if(t._Helpers.getFeatureFlag(Constants.FeatureFlags.CacheIdentity)){var o=tryCacheIdentity(d.known_identities,n.idCache,n.parseIdentityResponse,s,r,e,Identify);if(o)return}t._Helpers.canLog()?t._Store.webviewBridgeEnabled?(t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Identify,JSON.stringify(t._Identity.IdentityRequest.convertToNative(e))),t._Helpers.invokeCallback(r,HTTPCodes$2.nativeIdentityRequest,"Identify request sent to native sdk")):t._IdentityAPIClient.sendIdentityRequest(d,Identify,r,e,n.parseIdentityResponse,s,d.known_identities):(t._Helpers.invokeCallback(r,HTTPCodes$2.loggingDisabledOrMissingAPIKey,Messages$2.InformationMessages.AbandonLogEvent),t.Logger.verbose(Messages$2.InformationMessages.AbandonLogEvent));}else t._Helpers.invokeCallback(r,HTTPCodes$2.validationIssue,a.error),t.Logger.verbose(a);},/**
764
+ var s,i=t.Identity.getCurrentUser(),a=t._Identity.IdentityRequest.preProcessIdentityRequest(e,r,Identify);if(i&&(s=i.getMPID()),a.valid){var o=t._Identity.IdentityRequest.createIdentityRequest(e,Constants.platform,Constants.sdkVendor,Constants.sdkVersion,t._Store.deviceId,t._Store.context,s);if(t._Helpers.getFeatureFlag(Constants.FeatureFlags.CacheIdentity)){var d=tryCacheIdentity(o.known_identities,n.idCache,n.parseIdentityResponse,s,r,e,Identify);if(d)return}t._Helpers.canLog()?t._Store.webviewBridgeEnabled?(t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Identify,JSON.stringify(t._Identity.IdentityRequest.convertToNative(e))),t._Helpers.invokeCallback(r,HTTPCodes$2.nativeIdentityRequest,"Identify request sent to native sdk")):t._IdentityAPIClient.sendIdentityRequest(o,Identify,r,e,n.parseIdentityResponse,s,o.known_identities):(t._Helpers.invokeCallback(r,HTTPCodes$2.loggingDisabledOrMissingAPIKey,Messages$2.InformationMessages.AbandonLogEvent),t.Logger.verbose(Messages$2.InformationMessages.AbandonLogEvent));}else t._Helpers.invokeCallback(r,HTTPCodes$2.validationIssue,a.error),t.Logger.verbose(a);},/**
765
765
  * Initiate a logout request to the mParticle server
766
766
  * @method logout
767
767
  * @param {Object} identityApiData The identityApiData object as indicated [here](https://github.com/mParticle/mparticle-sdk-javascript/blob/master-v2/README.md#1-customize-the-sdk)
768
768
  * @param {Function} [callback] A callback function that is called when the logout request completes
769
769
  */logout:function logout(e,r){// https://go.mparticle.com/work/SQDSDKS-6337
770
- var s,i=t.Identity.getCurrentUser(),a=t._Identity.IdentityRequest.preProcessIdentityRequest(e,r,Logout);if(i&&(s=i.getMPID()),a.valid){var d,o=t._Identity.IdentityRequest.createIdentityRequest(e,Constants.platform,Constants.sdkVendor,Constants.sdkVersion,t._Store.deviceId,t._Store.context,s);t._Helpers.canLog()?t._Store.webviewBridgeEnabled?(t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Logout,JSON.stringify(t._Identity.IdentityRequest.convertToNative(e))),t._Helpers.invokeCallback(r,HTTPCodes$2.nativeIdentityRequest,"Logout request sent to native sdk")):(t._IdentityAPIClient.sendIdentityRequest(o,Logout,r,e,n.parseIdentityResponse,s),d=t._ServerModel.createEventObject({messageType:Types.MessageType.Profile}),d.ProfileMessageType=Types.ProfileMessageType.Logout,t._Store.activeForwarders.length&&t._Store.activeForwarders.forEach(function(e){e.logOut&&e.logOut(d);})):(t._Helpers.invokeCallback(r,HTTPCodes$2.loggingDisabledOrMissingAPIKey,Messages$2.InformationMessages.AbandonLogEvent),t.Logger.verbose(Messages$2.InformationMessages.AbandonLogEvent));}else t._Helpers.invokeCallback(r,HTTPCodes$2.validationIssue,a.error),t.Logger.verbose(a);},/**
770
+ var s,i=t.Identity.getCurrentUser(),a=t._Identity.IdentityRequest.preProcessIdentityRequest(e,r,Logout);if(i&&(s=i.getMPID()),a.valid){var o,d=t._Identity.IdentityRequest.createIdentityRequest(e,Constants.platform,Constants.sdkVendor,Constants.sdkVersion,t._Store.deviceId,t._Store.context,s);t._Helpers.canLog()?t._Store.webviewBridgeEnabled?(t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Logout,JSON.stringify(t._Identity.IdentityRequest.convertToNative(e))),t._Helpers.invokeCallback(r,HTTPCodes$2.nativeIdentityRequest,"Logout request sent to native sdk")):(t._IdentityAPIClient.sendIdentityRequest(d,Logout,r,e,n.parseIdentityResponse,s),o=t._ServerModel.createEventObject({messageType:Types.MessageType.Profile}),o.ProfileMessageType=Types.ProfileMessageType.Logout,t._Store.activeForwarders.length&&t._Store.activeForwarders.forEach(function(e){e.logOut&&e.logOut(o);})):(t._Helpers.invokeCallback(r,HTTPCodes$2.loggingDisabledOrMissingAPIKey,Messages$2.InformationMessages.AbandonLogEvent),t.Logger.verbose(Messages$2.InformationMessages.AbandonLogEvent));}else t._Helpers.invokeCallback(r,HTTPCodes$2.validationIssue,a.error),t.Logger.verbose(a);},/**
771
771
  * Initiate a login request to the mParticle server
772
772
  * @method login
773
773
  * @param {Object} identityApiData The identityApiData object as indicated [here](https://github.com/mParticle/mparticle-sdk-javascript/blob/master-v2/README.md#1-customize-the-sdk)
774
774
  * @param {Function} [callback] A callback function that is called when the login request completes
775
775
  */login:function login(e,r){// https://go.mparticle.com/work/SQDSDKS-6337
776
- var s,i=t.Identity.getCurrentUser(),a=t._Identity.IdentityRequest.preProcessIdentityRequest(e,r,Login);if(i&&(s=i.getMPID()),a.valid){var d=t._Identity.IdentityRequest.createIdentityRequest(e,Constants.platform,Constants.sdkVendor,Constants.sdkVersion,t._Store.deviceId,t._Store.context,s);if(t._Helpers.getFeatureFlag(Constants.FeatureFlags.CacheIdentity)){var o=tryCacheIdentity(d.known_identities,n.idCache,n.parseIdentityResponse,s,r,e,Login);if(o)return}t._Helpers.canLog()?t._Store.webviewBridgeEnabled?(t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Login,JSON.stringify(t._Identity.IdentityRequest.convertToNative(e))),t._Helpers.invokeCallback(r,HTTPCodes$2.nativeIdentityRequest,"Login request sent to native sdk")):t._IdentityAPIClient.sendIdentityRequest(d,Login,r,e,n.parseIdentityResponse,s,d.known_identities):(t._Helpers.invokeCallback(r,HTTPCodes$2.loggingDisabledOrMissingAPIKey,Messages$2.InformationMessages.AbandonLogEvent),t.Logger.verbose(Messages$2.InformationMessages.AbandonLogEvent));}else t._Helpers.invokeCallback(r,HTTPCodes$2.validationIssue,a.error),t.Logger.verbose(a);},/**
776
+ var s,i=t.Identity.getCurrentUser(),a=t._Identity.IdentityRequest.preProcessIdentityRequest(e,r,Login);if(i&&(s=i.getMPID()),a.valid){var o=t._Identity.IdentityRequest.createIdentityRequest(e,Constants.platform,Constants.sdkVendor,Constants.sdkVersion,t._Store.deviceId,t._Store.context,s);if(t._Helpers.getFeatureFlag(Constants.FeatureFlags.CacheIdentity)){var d=tryCacheIdentity(o.known_identities,n.idCache,n.parseIdentityResponse,s,r,e,Login);if(d)return}t._Helpers.canLog()?t._Store.webviewBridgeEnabled?(t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Login,JSON.stringify(t._Identity.IdentityRequest.convertToNative(e))),t._Helpers.invokeCallback(r,HTTPCodes$2.nativeIdentityRequest,"Login request sent to native sdk")):t._IdentityAPIClient.sendIdentityRequest(o,Login,r,e,n.parseIdentityResponse,s,o.known_identities):(t._Helpers.invokeCallback(r,HTTPCodes$2.loggingDisabledOrMissingAPIKey,Messages$2.InformationMessages.AbandonLogEvent),t.Logger.verbose(Messages$2.InformationMessages.AbandonLogEvent));}else t._Helpers.invokeCallback(r,HTTPCodes$2.validationIssue,a.error),t.Logger.verbose(a);},/**
777
777
  * Initiate a modify request to the mParticle server
778
778
  * @method modify
779
779
  * @param {Object} identityApiData The identityApiData object as indicated [here](https://github.com/mParticle/mparticle-sdk-javascript/blob/master-v2/README.md#1-customize-the-sdk)
780
780
  * @param {Function} [callback] A callback function that is called when the modify request completes
781
781
  */modify:function modify(e,r){// https://go.mparticle.com/work/SQDSDKS-6337
782
- var s,i=t.Identity.getCurrentUser(),a=t._Identity.IdentityRequest.preProcessIdentityRequest(e,r,Modify$1);i&&(s=i.getMPID());var d=e&&e.userIdentities?e.userIdentities:{};if(a.valid){var o=t._Identity.IdentityRequest.createModifyIdentityRequest(i?i.getUserIdentities().userIdentities:{},d,Constants.platform,Constants.sdkVendor,Constants.sdkVersion,t._Store.context);t._Helpers.canLog()?t._Store.webviewBridgeEnabled?(t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Modify,JSON.stringify(t._Identity.IdentityRequest.convertToNative(e))),t._Helpers.invokeCallback(r,HTTPCodes$2.nativeIdentityRequest,"Modify request sent to native sdk")):t._IdentityAPIClient.sendIdentityRequest(o,Modify$1,r,e,n.parseIdentityResponse,s,o.known_identities):(t._Helpers.invokeCallback(r,HTTPCodes$2.loggingDisabledOrMissingAPIKey,Messages$2.InformationMessages.AbandonLogEvent),t.Logger.verbose(Messages$2.InformationMessages.AbandonLogEvent));}else t._Helpers.invokeCallback(r,HTTPCodes$2.validationIssue,a.error),t.Logger.verbose(a);},/**
782
+ var s,i=t.Identity.getCurrentUser(),a=t._Identity.IdentityRequest.preProcessIdentityRequest(e,r,Modify$1);i&&(s=i.getMPID());var o=e&&e.userIdentities?e.userIdentities:{};if(a.valid){var d=t._Identity.IdentityRequest.createModifyIdentityRequest(i?i.getUserIdentities().userIdentities:{},o,Constants.platform,Constants.sdkVendor,Constants.sdkVersion,t._Store.context);t._Helpers.canLog()?t._Store.webviewBridgeEnabled?(t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Modify,JSON.stringify(t._Identity.IdentityRequest.convertToNative(e))),t._Helpers.invokeCallback(r,HTTPCodes$2.nativeIdentityRequest,"Modify request sent to native sdk")):t._IdentityAPIClient.sendIdentityRequest(d,Modify$1,r,e,n.parseIdentityResponse,s,d.known_identities):(t._Helpers.invokeCallback(r,HTTPCodes$2.loggingDisabledOrMissingAPIKey,Messages$2.InformationMessages.AbandonLogEvent),t.Logger.verbose(Messages$2.InformationMessages.AbandonLogEvent));}else t._Helpers.invokeCallback(r,HTTPCodes$2.validationIssue,a.error),t.Logger.verbose(a);},/**
783
783
  * Returns a user object with methods to interact with the current user
784
784
  * @method getCurrentUser
785
785
  * @return {Object} the current user object
@@ -817,7 +817,7 @@ return s<i&&(s=i,n<s&&t.Logger.warning("Source User has not been seen in the las
817
817
  * Get user identities for current user
818
818
  * @method getUserIdentities
819
819
  * @return {Object} an object with userIdentities as its key
820
- */getUserIdentities:function getUserIdentities(){var r={},s=t._Persistence.getUserIdentities(e);for(var i in s)s.hasOwnProperty(i)&&(r[Types.IdentityType.getIdentityName(t._Helpers.parseNumber(i))]=s[i]);return {userIdentities:r}},/**
820
+ */getUserIdentities:function getUserIdentities(){var r={},s=t._Store.getUserIdentities(e);for(var i in s)s.hasOwnProperty(i)&&(r[Types.IdentityType.getIdentityName(t._Helpers.parseNumber(i))]=s[i]);return {userIdentities:r}},/**
821
821
  * Get the MPID of the current user
822
822
  * @method getMPID
823
823
  * @return {String} the current user MPID as a string
@@ -836,7 +836,7 @@ return s<i&&(s=i,n<s&&t.Logger.warning("Source User has not been seen in the las
836
836
  * @param {String} value
837
837
  */ // https://go.mparticle.com/work/SQDSDKS-4576
838
838
  // https://go.mparticle.com/work/SQDSDKS-6373
839
- setUserAttribute:function setUserAttribute(r,i){if(t._SessionManager.resetSessionTimer(),t._Helpers.canLog()){if(!t._Helpers.Validators.isValidAttributeValue(i))return void t.Logger.error(Messages$2.ErrorMessages.BadAttribute);if(!t._Helpers.Validators.isValidKeyValue(r))return void t.Logger.error(Messages$2.ErrorMessages.BadKey);if(t._Store.webviewBridgeEnabled)t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.SetUserAttribute,JSON.stringify({key:r,value:i}));else {var n,a,d=this.getAllUserAttributes(),o=t._Helpers.findKeyInObject(d,r);o?(a=!1,n=d[o],delete d[o]):a=!0,d[r]=i,t._Store.setUserAttributes(e,d),s.sendUserAttributeChangeEvent(r,i,n,a,!1,this),t._Forwarders.initForwarders(s.IdentityAPI.getCurrentUser().getUserIdentities(),t._APIClient.prepareForwardingStats),t._Forwarders.handleForwarderUserAttributes("setUserAttribute",r,i);}}},/**
839
+ setUserAttribute:function setUserAttribute(r,i){if(t._SessionManager.resetSessionTimer(),t._Helpers.canLog()){if(!t._Helpers.Validators.isValidAttributeValue(i))return void t.Logger.error(Messages$2.ErrorMessages.BadAttribute);if(!t._Helpers.Validators.isValidKeyValue(r))return void t.Logger.error(Messages$2.ErrorMessages.BadKey);if(t._Store.webviewBridgeEnabled)t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.SetUserAttribute,JSON.stringify({key:r,value:i}));else {var n,a,o=this.getAllUserAttributes(),d=t._Helpers.findKeyInObject(o,r);d?(a=!1,n=o[d],delete o[d]):a=!0,o[r]=i,t._Store.setUserAttributes(e,o),s.sendUserAttributeChangeEvent(r,i,n,a,!1,this),t._Forwarders.initForwarders(s.IdentityAPI.getCurrentUser().getUserIdentities(),t._APIClient.prepareForwardingStats),t._Forwarders.handleForwarderUserAttributes("setUserAttribute",r,i);}}},/**
840
840
  * Set multiple user attributes
841
841
  * @method setUserAttributes
842
842
  * @param {Object} user attribute object with keys of the attribute type, and value of the attribute value
@@ -845,16 +845,16 @@ setUserAttributes:function setUserAttributes(e){if(t._SessionManager.resetSessio
845
845
  * Removes a specific user attribute
846
846
  * @method removeUserAttribute
847
847
  * @param {String} key
848
- */removeUserAttribute:function removeUserAttribute(r){var i,n;if(t._SessionManager.resetSessionTimer(),!t._Helpers.Validators.isValidKeyValue(r))return void t.Logger.error(Messages$2.ErrorMessages.BadKey);if(t._Store.webviewBridgeEnabled)t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.RemoveUserAttribute,JSON.stringify({key:r,value:null}));else {i=t._Persistence.getPersistence(),n=this.getAllUserAttributes();var a=t._Helpers.findKeyInObject(n,r);a&&(r=a);var d=n[r]?n[r].toString():null;delete n[r],i&&i[e]&&(i[e].ua=n,t._Persistence.savePersistence(i,e)),s.sendUserAttributeChangeEvent(r,null,d,!1,!0,this),t._Forwarders.initForwarders(s.IdentityAPI.getCurrentUser().getUserIdentities(),t._APIClient.prepareForwardingStats),t._Forwarders.handleForwarderUserAttributes("removeUserAttribute",r,null);}},/**
848
+ */removeUserAttribute:function removeUserAttribute(r){var i,n;if(t._SessionManager.resetSessionTimer(),!t._Helpers.Validators.isValidKeyValue(r))return void t.Logger.error(Messages$2.ErrorMessages.BadKey);if(t._Store.webviewBridgeEnabled)t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.RemoveUserAttribute,JSON.stringify({key:r,value:null}));else {i=t._Persistence.getPersistence(),n=this.getAllUserAttributes();var a=t._Helpers.findKeyInObject(n,r);a&&(r=a);var o=n[r]?n[r].toString():null;delete n[r],i&&i[e]&&(i[e].ua=n,t._Persistence.savePersistence(i,e)),s.sendUserAttributeChangeEvent(r,null,o,!1,!0,this),t._Forwarders.initForwarders(s.IdentityAPI.getCurrentUser().getUserIdentities(),t._APIClient.prepareForwardingStats),t._Forwarders.handleForwarderUserAttributes("removeUserAttribute",r,null);}},/**
849
849
  * Sets a list of user attributes
850
850
  * @method setUserAttributeList
851
851
  * @param {String} key
852
852
  * @param {Array} value an array of values
853
853
  */ // https://go.mparticle.com/work/SQDSDKS-6373
854
- setUserAttributeList:function setUserAttributeList(r,n){if(t._SessionManager.resetSessionTimer(),!t._Helpers.Validators.isValidKeyValue(r))return void t.Logger.error(Messages$2.ErrorMessages.BadKey);if(!Array.isArray(n))return void t.Logger.error("The value you passed in to setUserAttributeList must be an array. You passed in a "+("undefined"==typeof value?"undefined":_typeof(value)));var a=n.slice();if(t._Store.webviewBridgeEnabled)t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.SetUserAttributeList,JSON.stringify({key:r,value:a}));else {var d,o,g,l=this.getAllUserAttributes(),u=t._Helpers.findKeyInObject(l,r);// If the new attributeList length is different than the previous, then there is a change event.
854
+ setUserAttributeList:function setUserAttributeList(r,n){if(t._SessionManager.resetSessionTimer(),!t._Helpers.Validators.isValidKeyValue(r))return void t.Logger.error(Messages$2.ErrorMessages.BadKey);if(!Array.isArray(n))return void t.Logger.error("The value you passed in to setUserAttributeList must be an array. You passed in a "+("undefined"==typeof value?"undefined":_typeof(value)));var a=n.slice();if(t._Store.webviewBridgeEnabled)t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.SetUserAttributeList,JSON.stringify({key:r,value:a}));else {var o,d,g,l=this.getAllUserAttributes(),u=t._Helpers.findKeyInObject(l,r);// If the new attributeList length is different than the previous, then there is a change event.
855
855
  // Loop through new attributes list, see if they are all in the same index as previous user attributes list
856
856
  // If there are any changes, break, and immediately send a userAttributeChangeEvent with full array as a value
857
- if(u?(o=!1,d=l[u],delete l[u]):o=!0,l[r]=a,t._Store.setUserAttributes(e,l),!d||!Array.isArray(d))g=!0;else if(n.length!==d.length)g=!0;else for(var p=0;p<n.length;p++)if(d[p]!==n[p]){g=!0;break}g&&s.sendUserAttributeChangeEvent(r,n,d,o,!1,this),t._Forwarders.initForwarders(s.IdentityAPI.getCurrentUser().getUserIdentities(),t._APIClient.prepareForwardingStats),t._Forwarders.handleForwarderUserAttributes("setUserAttribute",r,a);}},/**
857
+ if(u?(d=!1,o=l[u],delete l[u]):d=!0,l[r]=a,t._Store.setUserAttributes(e,l),!o||!Array.isArray(o))g=!0;else if(n.length!==o.length)g=!0;else for(var p=0;p<n.length;p++)if(o[p]!==n[p]){g=!0;break}g&&s.sendUserAttributeChangeEvent(r,n,o,d,!1,this),t._Forwarders.initForwarders(s.IdentityAPI.getCurrentUser().getUserIdentities(),t._APIClient.prepareForwardingStats),t._Forwarders.handleForwarderUserAttributes("setUserAttribute",r,a);}},/**
858
858
  * Removes all user attributes
859
859
  * @method removeAllUserAttributes
860
860
  */removeAllUserAttributes:function removeAllUserAttributes(){var e;if(t._SessionManager.resetSessionTimer(),t._Store.webviewBridgeEnabled)t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.RemoveAllUserAttributes);else if(e=this.getAllUserAttributes(),t._Forwarders.initForwarders(s.IdentityAPI.getCurrentUser().getUserIdentities(),t._APIClient.prepareForwardingStats),e)for(var r in e)e.hasOwnProperty(r)&&t._Forwarders.handleForwarderUserAttributes("removeUserAttribute",r,null),this.removeUserAttribute(r);},/**
@@ -895,7 +895,7 @@ return t._Helpers.getFeatureFlag(FeatureFlags$1.AudienceAPI)?void(null===s.audie
895
895
  * @param {Object} product the product
896
896
  * @param {Boolean} [logEvent] a boolean to log adding of the cart object. If blank, no logging occurs.
897
897
  * @deprecated
898
- */remove:function remove(r,s){t.Logger.warning("Deprecated function Identity.getCurrentUser().getCart().remove() will be removed in future releases");var i,n,a=-1,d=null;if(t._Store.webviewBridgeEnabled)t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.RemoveFromCart,JSON.stringify(r));else {t._SessionManager.resetSessionTimer(),n=t._Persistence.getUserProductsFromLS(e),n&&(n.forEach(function(e,t){e.Sku===r.Sku&&(a=t,d=e);}),-1<a&&(n.splice(a,1),!0===s&&t._Events.logProductActionEvent(Types.ProductActionType.RemoveFromCart,d)));i=t._Persistence.getAllUserProductsFromLS(),i[e].cp=n,t._Persistence.setCartProducts(i);}},/**
898
+ */remove:function remove(r,s){t.Logger.warning("Deprecated function Identity.getCurrentUser().getCart().remove() will be removed in future releases");var i,n,a=-1,o=null;if(t._Store.webviewBridgeEnabled)t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.RemoveFromCart,JSON.stringify(r));else {t._SessionManager.resetSessionTimer(),n=t._Persistence.getUserProductsFromLS(e),n&&(n.forEach(function(e,t){e.Sku===r.Sku&&(a=t,o=e);}),-1<a&&(n.splice(a,1),!0===s&&t._Events.logProductActionEvent(Types.ProductActionType.RemoveFromCart,o)));i=t._Persistence.getAllUserProductsFromLS(),i[e].cp=n,t._Persistence.setCartProducts(i);}},/**
899
899
  * Clears the user's cart
900
900
  * @method clear
901
901
  * @deprecated
@@ -904,16 +904,16 @@ return t._Helpers.getFeatureFlag(FeatureFlags$1.AudienceAPI)?void(null===s.audie
904
904
  * @method getCartProducts
905
905
  * @return {Array} array of cart products
906
906
  * @deprecated
907
- */getCartProducts:function getCartProducts(){return t.Logger.warning("Deprecated function Identity.getCurrentUser().getCart().getCartProducts() will be removed in future releases"),t._Persistence.getCartProducts(e)}}},this.parseIdentityResponse=function(r,i,a,d,o,g,l){var u,p,c,y=t.Identity.getUser(i),I=y?y.getMPID():null,_=y?y.getUserIdentities().userIdentities:{},v={};t._Store.identityCallInFlight=!1;try{var m;if(t.Logger.verbose("Parsing \""+o+"\" identity response from server"),p=r.responseText?JSON.parse(r.responseText):null,t._Store.isLoggedIn=(null===(m=p)||void 0===m?void 0:m.is_logged_in)||!1,hasMPIDChanged(y,p)&&(t._Store.mpid=p.mpid,y&&t._Persistence.setLastSeenTime(i),u=!t._Persistence.getFirstSeenTime(p.mpid),t._Persistence.setFirstSeenTime(p.mpid)),200===r.status){s(CacheIdentity)&&cacheOrClearIdCache(o,g,n.idCache,r,l);var S=n.IdentityAPI.getUser(p.mpid),b=S?S.getUserIdentities().userIdentities:{};o===Modify$1?(v=t._Identity.IdentityRequest.combineUserIdentities(_,d.userIdentities),t._Persistence.saveUserIdentitiesToPersistence(i,v)):(o===Identify&&y&&p.mpid===I&&t._Persistence.setFirstSeenTime(p.mpid),t._Store.addMpidToSessionHistory(p.mpid,i),t._CookieSyncManager.attemptCookieSync(i,p.mpid,u),t._Persistence.swapCurrentUser(i,p.mpid,t._Store.currentSessionMPIDs),d&&!isEmpty(d.userIdentities)&&(v=n.IdentityRequest.combineUserIdentities(b,d.userIdentities)),t._Persistence.saveUserIdentitiesToPersistence(p.mpid,v),t._Persistence.update(),t._Store.syncPersistenceData(),t._Persistence.findPrevCookiesBasedOnUI(d),t._Store.context=p.context||t._Store.context),c=t.Identity.getCurrentUser(),tryOnUserAlias(y,c,d,t.Logger);var A=t._Persistence.getPersistence();c&&(t._Persistence.storeDataInMemory(A,c.getMPID()),n.reinitForwardersOnUserChange(y,c),n.setForwarderCallbacks(c,o));var P=getNewIdentitiesByName(v),U=o===Modify$1?_:b;// https://go.mparticle.com/work/SQDSDKS-6501
908
- n.sendUserIdentityChangeEvent(P,o,p.mpid,U);}if(a){var C=0===r.status?HTTPCodes$2.noHttpCoverage:r.status;t._Helpers.invokeCallback(a,C,p||null,c);}else p&&!isEmpty(p.errors)&&// https://go.mparticle.com/work/SQDSDKS-6500
907
+ */getCartProducts:function getCartProducts(){return t.Logger.warning("Deprecated function Identity.getCurrentUser().getCart().getCartProducts() will be removed in future releases"),t._Persistence.getCartProducts(e)}}},this.parseIdentityResponse=function(r,i,a,o,d,g,l){var u,p,y,c=t.Identity.getUser(i),I=c?c.getMPID():null,_=c?c.getUserIdentities().userIdentities:{},v={};t._Store.identityCallInFlight=!1;try{var m;if(t.Logger.verbose("Parsing \""+d+"\" identity response from server"),p=r.responseText?JSON.parse(r.responseText):null,t._Store.isLoggedIn=(null===(m=p)||void 0===m?void 0:m.is_logged_in)||!1,hasMPIDChanged(c,p)&&(t._Store.mpid=p.mpid,c&&t._Persistence.setLastSeenTime(i),u=!t._Persistence.getFirstSeenTime(p.mpid),t._Persistence.setFirstSeenTime(p.mpid)),200===r.status){s(CacheIdentity)&&cacheOrClearIdCache(d,g,n.idCache,r,l);var S=n.IdentityAPI.getUser(p.mpid),b=S?S.getUserIdentities().userIdentities:{};d===Modify$1?(v=t._Identity.IdentityRequest.combineUserIdentities(_,o.userIdentities),t._Store.setUserIdentities(i,v)):(d===Identify&&c&&p.mpid===I&&t._Persistence.setFirstSeenTime(p.mpid),t._Store.addMpidToSessionHistory(p.mpid,i),t._CookieSyncManager.attemptCookieSync(i,p.mpid,u),t._Persistence.swapCurrentUser(i,p.mpid,t._Store.currentSessionMPIDs),o&&!isEmpty(o.userIdentities)&&(v=n.IdentityRequest.combineUserIdentities(b,o.userIdentities)),t._Store.setUserIdentities(p.mpid,v),t._Persistence.update(),t._Store.syncPersistenceData(),t._Persistence.findPrevCookiesBasedOnUI(o),t._Store.context=p.context||t._Store.context),y=t.Identity.getCurrentUser(),tryOnUserAlias(c,y,o,t.Logger);var A=t._Persistence.getPersistence();y&&(t._Persistence.storeDataInMemory(A,y.getMPID()),n.reinitForwardersOnUserChange(c,y),n.setForwarderCallbacks(y,d));var P=getNewIdentitiesByName(v),U=d===Modify$1?_:b;// https://go.mparticle.com/work/SQDSDKS-6501
908
+ n.sendUserIdentityChangeEvent(P,d,p.mpid,U);}if(a){var C=0===r.status?HTTPCodes$2.noHttpCoverage:r.status;t._Helpers.invokeCallback(a,C,p||null,y);}else p&&!isEmpty(p.errors)&&// https://go.mparticle.com/work/SQDSDKS-6500
909
909
  t.Logger.error("Received HTTP response code of "+r.status+" - "+p.errors[0].message);t.Logger.verbose("Successfully parsed Identity Response"),t._APIClient.processQueuedEvents();}catch(s){a&&t._Helpers.invokeCallback(a,r.status,p||null),t.Logger.error("Error parsing JSON response from Identity server: "+s);}},this.sendUserIdentityChangeEvent=function(e,r,s,i){if(s||r===Modify$1)// https://go.mparticle.com/work/SQDSDKS-6501
910
910
  {// https://go.mparticle.com/work/SQDSDKS-6354
911
- var a=this.IdentityAPI.getUser(s);for(var d in e)// Verifies a change actually happened
912
- if(i[d]!==e[d]){// If a new identity type was introduced when the identity changes
911
+ var a=this.IdentityAPI.getUser(s);for(var o in e)// Verifies a change actually happened
912
+ if(i[o]!==e[o]){// If a new identity type was introduced when the identity changes
913
913
  // we need to notify the server so that the user profile is updated in
914
914
  // the mParticle UI.
915
- var o=!i[d],g=n.createUserIdentityChange(d,e[d],i[d],o,a);t._APIClient.sendEventToServer(g);}}},this.createUserIdentityChange=function(e,r,s,i,n){var a;// https://go.mparticle.com/work/SQDSDKS-6439
916
- return a=t._ServerModel.createEventObject({messageType:Types.MessageType.UserIdentityChange,userIdentityChanges:{New:{IdentityType:e,Identity:r,CreatedThisBatch:i},Old:{IdentityType:e,Identity:s,CreatedThisBatch:!1}},userInMemory:n}),a},this.sendUserAttributeChangeEvent=function(e,r,s,i,a,d){var o=n.createUserAttributeChange(e,r,s,i,a,d);o&&t._APIClient.sendEventToServer(o);},this.createUserAttributeChange=function(e,r,s,i,n,a){"undefined"==typeof s&&(s=null);var d;return r!==s&&(d=t._ServerModel.createEventObject({messageType:Types.MessageType.UserAttributeChange,userAttributeChanges:{UserAttributeName:e,New:r,Old:s,Deleted:n,IsNewAttribute:i}},a)),d},this.reinitForwardersOnUserChange=function(e,r){hasMPIDAndUserLoginChanged(e,r)&&t._Forwarders.initForwarders(r.getUserIdentities().userIdentities,t._APIClient.prepareForwardingStats);},this.setForwarderCallbacks=function(e,r){// https://go.mparticle.com/work/SQDSDKS-6036
915
+ var d=!i[o],g=n.createUserIdentityChange(o,e[o],i[o],d,a);t._APIClient.sendEventToServer(g);}}},this.createUserIdentityChange=function(e,r,s,i,n){var a;// https://go.mparticle.com/work/SQDSDKS-6439
916
+ return a=t._ServerModel.createEventObject({messageType:Types.MessageType.UserIdentityChange,userIdentityChanges:{New:{IdentityType:e,Identity:r,CreatedThisBatch:i},Old:{IdentityType:e,Identity:s,CreatedThisBatch:!1}},userInMemory:n}),a},this.sendUserAttributeChangeEvent=function(e,r,s,i,a,o){var d=n.createUserAttributeChange(e,r,s,i,a,o);d&&t._APIClient.sendEventToServer(d);},this.createUserAttributeChange=function(e,r,s,i,n,a){"undefined"==typeof s&&(s=null);var o;return r!==s&&(o=t._ServerModel.createEventObject({messageType:Types.MessageType.UserAttributeChange,userAttributeChanges:{UserAttributeName:e,New:r,Old:s,Deleted:n,IsNewAttribute:i}},a)),o},this.reinitForwardersOnUserChange=function(e,r){hasMPIDAndUserLoginChanged(e,r)&&t._Forwarders.initForwarders(r.getUserIdentities().userIdentities,t._APIClient.prepareForwardingStats);},this.setForwarderCallbacks=function(e,r){// https://go.mparticle.com/work/SQDSDKS-6036
917
917
  t._Forwarders.setForwarderUserIdentities(e.getUserIdentities().userIdentities),t._Forwarders.setForwarderOnIdentityComplete(e,r),t._Forwarders.setForwarderOnUserIdentified(e);};}// https://go.mparticle.com/work/SQDSDKS-6359
918
918
  function tryOnUserAlias(e,t,r,s){if(r&&r.onUserAlias&&isFunction(r.onUserAlias))try{s.warning(generateDeprecationMessage("onUserAlias")),r.onUserAlias(e,t);}catch(t){s.error("There was an error with your onUserAlias function - "+t);}}
919
919
 
@@ -154,7 +154,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
154
154
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
155
155
  };
156
156
 
157
- var version = "2.26.9";
157
+ var version = "2.26.10";
158
158
 
159
159
  var Constants={sdkVersion:version,sdkVendor:"mparticle",platform:"web",Messages:{DeprecationMessages:{MethodIsDeprecatedPostfix:"is a deprecated method and will be removed in future releases",AlternativeMethodPrefix:"Please use the alternate method:"},ErrorMessages:{NoToken:"A token must be specified.",EventNameInvalidType:"Event name must be a valid string value.",EventDataInvalidType:"Event data must be a valid object hash.",LoggingDisabled:"Event logging is currently disabled.",CookieParseError:"Could not parse cookie",EventEmpty:"Event object is null or undefined, cancelling send",APIRequestEmpty:"APIRequest is null or undefined, cancelling send",NoEventType:"Event type must be specified.",TransactionIdRequired:"Transaction ID is required",TransactionRequired:"A transaction attributes object is required",PromotionIdRequired:"Promotion ID is required",BadAttribute:"Attribute value cannot be object or array",BadKey:"Key value cannot be object or array",BadLogPurchase:"Transaction attributes and a product are both required to log a purchase, https://docs.mparticle.com/?javascript#measuring-transactions",AudienceAPINotEnabled:"Your workspace is not enabled to retrieve user audiences."},InformationMessages:{CookieSearch:"Searching for cookie",CookieFound:"Cookie found, parsing values",CookieNotFound:"Cookies not found",CookieSet:"Setting cookie",CookieSync:"Performing cookie sync",SendBegin:"Starting to send event",SendIdentityBegin:"Starting to send event to identity server",SendWindowsPhone:"Sending event to Windows Phone container",SendIOS:"Calling iOS path: ",SendAndroid:"Calling Android JS interface method: ",SendHttp:"Sending event to mParticle HTTP service",SendAliasHttp:"Sending alias request to mParticle HTTP service",SendIdentityHttp:"Sending event to mParticle HTTP service",StartingNewSession:"Starting new Session",StartingLogEvent:"Starting to log event",StartingLogOptOut:"Starting to log user opt in/out",StartingEndSession:"Starting to end session",StartingInitialization:"Starting to initialize",StartingLogCommerceEvent:"Starting to log commerce event",StartingAliasRequest:"Starting to Alias MPIDs",LoadingConfig:"Loading configuration options",AbandonLogEvent:"Cannot log event, logging disabled or developer token not set",AbandonAliasUsers:"Cannot Alias Users, logging disabled or developer token not set",AbandonStartSession:"Cannot start session, logging disabled or developer token not set",AbandonEndSession:"Cannot end session, logging disabled or developer token not set",NoSessionToEnd:"Cannot end session, no active session found"},ValidationMessages:{ModifyIdentityRequestUserIdentitiesPresent:"identityRequests to modify require userIdentities to be present. Request not sent to server. Please fix and try again",IdentityRequesetInvalidKey:"There is an invalid key on your identityRequest object. It can only contain a `userIdentities` object and a `onUserAlias` function. Request not sent to server. Please fix and try again.",OnUserAliasType:"The onUserAlias value must be a function.",UserIdentities:"The userIdentities key must be an object with keys of identityTypes and values of strings. Request not sent to server. Please fix and try again.",UserIdentitiesInvalidKey:"There is an invalid identity key on your `userIdentities` object within the identityRequest. Request not sent to server. Please fix and try again.",UserIdentitiesInvalidValues:"All user identity values must be strings or null. Request not sent to server. Please fix and try again.",AliasMissingMpid:"Alias Request must contain both a destinationMpid and a sourceMpid",AliasNonUniqueMpid:"Alias Request's destinationMpid and sourceMpid must be unique",AliasMissingTime:"Alias Request must have both a startTime and an endTime",AliasStartBeforeEndTime:"Alias Request's endTime must be later than its startTime"}},NativeSdkPaths:{LogEvent:"logEvent",SetUserTag:"setUserTag",RemoveUserTag:"removeUserTag",SetUserAttribute:"setUserAttribute",RemoveUserAttribute:"removeUserAttribute",SetSessionAttribute:"setSessionAttribute",AddToCart:"addToCart",RemoveFromCart:"removeFromCart",ClearCart:"clearCart",LogOut:"logOut",SetUserAttributeList:"setUserAttributeList",RemoveAllUserAttributes:"removeAllUserAttributes",GetUserAttributesLists:"getUserAttributesLists",GetAllUserAttributes:"getAllUserAttributes",Identify:"identify",Logout:"logout",Login:"login",Modify:"modify",Alias:"aliasUsers",Upload:"upload"},StorageNames:{localStorageName:"mprtcl-api",localStorageNameV3:"mprtcl-v3",cookieName:"mprtcl-api",cookieNameV2:"mprtcl-v2",cookieNameV3:"mprtcl-v3",localStorageNameV4:"mprtcl-v4",localStorageProductsV4:"mprtcl-prodv4",cookieNameV4:"mprtcl-v4",currentStorageName:"mprtcl-v4",currentStorageProductsName:"mprtcl-prodv4"},DefaultConfig:{cookieDomain:null,cookieExpiration:365,logLevel:null,timeout:300,sessionTimeout:30,maxProducts:20,forwarderStatsTimeout:5e3,integrationDelayTimeout:5e3,maxCookieSize:3e3,aliasMaxWindow:90,uploadInterval:0// Maximum milliseconds in between batch uploads, below 500 will mean immediate upload. The server returns this as a string, but we are using it as a number internally
160
160
  },DefaultBaseUrls:{v1SecureServiceUrl:"jssdks.mparticle.com/v1/JS/",v2SecureServiceUrl:"jssdks.mparticle.com/v2/JS/",v3SecureServiceUrl:"jssdks.mparticle.com/v3/JS/",configUrl:"jssdkcdns.mparticle.com/JS/v2/",identityUrl:"identity.mparticle.com/v1/",aliasUrl:"jssdks.mparticle.com/v1/identity/",userAudienceUrl:"nativesdks.mparticle.com/v1/"},Base64CookieKeys:{csm:1,sa:1,ss:1,ua:1,ui:1,csd:1,ia:1,con:1},// https://go.mparticle.com/work/SQDSDKS-6039
@@ -554,7 +554,7 @@ var b={};for(var c in Constants.DefaultConfig)Constants.DefaultConfig.hasOwnProp
554
554
  function Store(a,b,c){var d=this,e=b._Helpers,f=e.createMainStorageName,g=e.createProductStorageName,h=b._NativeSdkHelpers.isWebviewEnabled,i={isEnabled:!0,sessionAttributes:{},currentSessionMPIDs:[],consentState:null,sessionId:null,isFirstRun:null,clientId:null,deviceId:null,devToken:null,serverSettings:{},dateLastEventSent:null,sessionStartDate:null,currentPosition:null,isTracking:!1,watchPositionId:null,cartProducts:[],eventQueue:[],currencyCode:null,globalTimer:null,context:null,configurationLoaded:!1,identityCallInFlight:!1,SDKConfig:{},nonCurrentUserMPIDs:{},identifyCalled:!1,isLoggedIn:!1,cookieSyncDates:{},integrationAttributes:{},requireDelay:!0,isLocalStorageAvailable:null,storageName:null,prodStorageName:null,activeForwarders:[],kits:{},sideloadedKits:[],configuredForwarders:[],pixelConfigurations:[],wrapperSDKInfo:{name:"none",version:null,isInfoSet:!1},// Placeholder for in-memory persistence model
555
555
  persistenceData:{gs:{}}};for(var j in i)this[j]=i[j];if(this.devToken=c||null,this.integrationDelayTimeoutStart=Date.now(),this.SDKConfig=createSDKConfig(a),a){a.hasOwnProperty("flags")||(this.SDKConfig.flags={}),this.SDKConfig.flags=processFlags(a),a.deviceId&&(this.deviceId=a.deviceId),this.SDKConfig.isDevelopmentMode=!!a.hasOwnProperty("isDevelopmentMode")&&returnConvertedBoolean(a.isDevelopmentMode);var k=processBaseUrls(a,this.SDKConfig.flags,c);for(var l in k)this.SDKConfig[l]=k[l];if(a.hasOwnProperty("logLevel")&&(this.SDKConfig.logLevel=a.logLevel),this.SDKConfig.useNativeSdk=!!a.useNativeSdk,this.SDKConfig.kits=a.kits||{},this.SDKConfig.sideloadedKits=a.sideloadedKits||[],this.SDKConfig.isIOS=a.hasOwnProperty("isIOS")?a.isIOS:!!(window.mParticle&&window.mParticle.isIOS)&&window.mParticle.isIOS,this.SDKConfig.useCookieStorage=!!a.hasOwnProperty("useCookieStorage")&&a.useCookieStorage,this.SDKConfig.maxProducts=a.hasOwnProperty("maxProducts")?a.maxProducts:Constants.DefaultConfig.maxProducts,this.SDKConfig.maxCookieSize=a.hasOwnProperty("maxCookieSize")?a.maxCookieSize:Constants.DefaultConfig.maxCookieSize,a.hasOwnProperty("appName")&&(this.SDKConfig.appName=a.appName),a.hasOwnProperty("package")&&(this.SDKConfig["package"]=a["package"]),this.SDKConfig.integrationDelayTimeout=a.hasOwnProperty("integrationDelayTimeout")?a.integrationDelayTimeout:Constants.DefaultConfig.integrationDelayTimeout,a.hasOwnProperty("identifyRequest")&&(this.SDKConfig.identifyRequest=a.identifyRequest),a.hasOwnProperty("identityCallback")){var m=a.identityCallback;b._Helpers.Validators.isFunction(m)?this.SDKConfig.identityCallback=a.identityCallback:b.Logger.warning("The optional callback must be a function. You tried entering a(n) "+_typeof(m)+" . Callback not set. Please set your callback again.");}if(a.hasOwnProperty("appVersion")&&(this.SDKConfig.appVersion=a.appVersion),a.hasOwnProperty("appName")&&(this.SDKConfig.appName=a.appName),a.hasOwnProperty("sessionTimeout")&&(this.SDKConfig.sessionTimeout=a.sessionTimeout),a.hasOwnProperty("dataPlan")){this.SDKConfig.dataPlan={PlanVersion:null,PlanId:null};var n=a.dataPlan;n.planId&&(isDataPlanSlug(n.planId)?this.SDKConfig.dataPlan.PlanId=n.planId:b.Logger.error("Your data plan id must be a string and match the data plan slug format (i.e. under_case_slug)")),n.planVersion&&(isNumber(n.planVersion)?this.SDKConfig.dataPlan.PlanVersion=n.planVersion:b.Logger.error("Your data plan version must be a number"));}else this.SDKConfig.dataPlan={};if(this.SDKConfig.forceHttps=!a.hasOwnProperty("forceHttps")||a.forceHttps,this.SDKConfig.customFlags=a.customFlags||{},this.SDKConfig.minWebviewBridgeVersion=a.hasOwnProperty("minWebviewBridgeVersion")?a.minWebviewBridgeVersion:1,this.SDKConfig.aliasMaxWindow=a.hasOwnProperty("aliasMaxWindow")?a.aliasMaxWindow:Constants.DefaultConfig.aliasMaxWindow,a.hasOwnProperty("dataPlanOptions")){var o=a.dataPlanOptions;o.hasOwnProperty("dataPlanVersion")&&o.hasOwnProperty("blockUserAttributes")&&o.hasOwnProperty("blockEventAttributes")&&o.hasOwnProperty("blockEvents")&&o.hasOwnProperty("blockUserIdentities")||b.Logger.error("Ensure your config.dataPlanOptions object has the following keys: a \"dataPlanVersion\" object, and \"blockUserAttributes\", \"blockEventAttributes\", \"blockEvents\", \"blockUserIdentities\" booleans");}a.hasOwnProperty("onCreateBatch")&&("function"==typeof a.onCreateBatch?this.SDKConfig.onCreateBatch=a.onCreateBatch:(b.Logger.error("config.onCreateBatch must be a function"),this.SDKConfig.onCreateBatch=void 0));}this._getFromPersistence=function(a,b){return a?(d.syncPersistenceData(),d.persistenceData&&d.persistenceData[a]&&d.persistenceData[a][b]?d.persistenceData[a][b]:null):null},this._setPersistence=function(a,c,e){var f;a&&(d.syncPersistenceData(),d.persistenceData&&(d.persistenceData[a]?d.persistenceData[a][c]=e:d.persistenceData[a]=(f={},f[c]=e,f),isObject(d.persistenceData[a][c])&&isEmpty(d.persistenceData[a][c])&&delete d.persistenceData[a][c],b._Persistence.savePersistence(d.persistenceData)));},this.hasInvalidIdentifyRequest=function(){var a=d.SDKConfig.identifyRequest;return isObject(a)&&isObject(a.userIdentities)&&isEmpty(a.userIdentities)||!a},this.getConsentState=function(a){var c=b._Consent.ConsentSerialization.fromMinifiedJsonObject,e=d._getFromPersistence(a,"con");return isEmpty(e)?null:c(e)},this.setConsentState=function(a,c){var e=b._Consent.ConsentSerialization.toMinifiedJsonObject;// If ConsentState is null, we assume the intent is to clear out the consent state
556
556
  (c||null===c)&&d._setPersistence(a,"con",e(c));},this.getDeviceId=function(){return d.deviceId},this.setDeviceId=function(a){d.deviceId=a,d.persistenceData.gs.das=a,b._Persistence.update();},this.getFirstSeenTime=function(a){return d._getFromPersistence(a,"fst")},this.setFirstSeenTime=function(a,b){if(a){var c=b||new Date().getTime();d._setPersistence(a,"fst",c);}},this.getLastSeenTime=function(a){if(!a)return null;// https://go.mparticle.com/work/SQDSDKS-6315
557
- var c=b.Identity.getCurrentUser();return a===(null===c||void 0===c?void 0:c.getMPID())?new Date().getTime():d._getFromPersistence(a,"lst")},this.setLastSeenTime=function(a,b){if(a){var c=b||new Date().getTime();d._setPersistence(a,"lst",c);}},this.syncPersistenceData=function(){var a=b._Persistence.getPersistence();d.persistenceData=b._Helpers.extend({},d.persistenceData,a);},this.getUserAttributes=function(a){return d._getFromPersistence(a,"ua")||{}},this.setUserAttributes=function(a,b){return d._setPersistence(a,"ua",b)},this.addMpidToSessionHistory=function(a,b){var c=d.currentSessionMPIDs.indexOf(a);return a&&b!==a&&0>c?void d.currentSessionMPIDs.push(a):void(0<=c&&(d.currentSessionMPIDs=moveElementToEnd(d.currentSessionMPIDs,c)))},this.nullifySession=function(){d.sessionId=null,d.dateLastEventSent=null,d.sessionAttributes={},b._Persistence.update();},this.processConfig=function(a){var c=a.workspaceToken,e=a.requiredWebviewBridgeName;// We should reprocess the flags in case they have changed when we request an updated config
557
+ var c=b.Identity.getCurrentUser();return a===(null===c||void 0===c?void 0:c.getMPID())?new Date().getTime():d._getFromPersistence(a,"lst")},this.setLastSeenTime=function(a,b){if(a){var c=b||new Date().getTime();d._setPersistence(a,"lst",c);}},this.syncPersistenceData=function(){var a=b._Persistence.getPersistence();d.persistenceData=b._Helpers.extend({},d.persistenceData,a);},this.getUserAttributes=function(a){return d._getFromPersistence(a,"ua")||{}},this.setUserAttributes=function(a,b){return d._setPersistence(a,"ua",b)},this.getUserIdentities=function(a){return d._getFromPersistence(a,"ui")||{}},this.setUserIdentities=function(a,b){d._setPersistence(a,"ui",b);},this.addMpidToSessionHistory=function(a,b){var c=d.currentSessionMPIDs.indexOf(a);return a&&b!==a&&0>c?void d.currentSessionMPIDs.push(a):void(0<=c&&(d.currentSessionMPIDs=moveElementToEnd(d.currentSessionMPIDs,c)))},this.nullifySession=function(){d.sessionId=null,d.dateLastEventSent=null,d.sessionAttributes={},b._Persistence.update();},this.processConfig=function(a){var c=a.workspaceToken,e=a.requiredWebviewBridgeName;// We should reprocess the flags in case they have changed when we request an updated config
558
558
  // such as if the SDK is being self-hosted and the flags are different on the server config
559
559
  // https://go.mparticle.com/work/SQDSDKS-6317
560
560
  d.SDKConfig.flags=processFlags(a),c?d.SDKConfig.workspaceToken=c:b.Logger.warning("You should have a workspaceToken on your config object for security purposes."),d.storageName=f(c),d.prodStorageName=g(c),d.SDKConfig.requiredWebviewBridgeName=e||c,d.webviewBridgeEnabled=h(d.SDKConfig.requiredWebviewBridgeName,d.SDKConfig.minWebviewBridgeVersion),d.configurationLoaded=!0;};}// https://go.mparticle.com/work/SQDSDKS-6317
@@ -626,7 +626,7 @@ var k={};for(var l in b)b.hasOwnProperty(l)&&(SDKv2NonMPIDCookieKeys[l]||l===b.c
626
626
  if(Object.keys(k).length)for(var m in k)g=d(b,c,e),g.length>f&&k.hasOwnProperty(m)&&-1===h.indexOf(m)&&delete b[m];// Comment 2b above
627
627
  for(var n,o=0;o<h.length&&(g=d(b,c,e),g.length>f);o++)n=h[o],b[n]?(a.Logger.verbose("Size of new encoded cookie is larger than maxCookieSize setting of "+f+". Removing from cookie the earliest logged in MPID containing: "+JSON.stringify(b[n],0,2)),delete b[n]):a.Logger.error("Unable to save MPID data to cookies because the resulting encoded cookie is larger than the maxCookieSize setting of "+f+". We recommend using a maxCookieSize of 1500.");}return g},this.findPrevCookiesBasedOnUI=function(b){var c,d=a._Persistence.getPersistence();if(b)for(var e in b.userIdentities)if(d&&Object.keys(d).length)for(var g in d)// any value in persistence that has an MPID key will be an MPID to search through
628
628
  // other keys on the cookie are currentSessionMPIDs and currentMPID which should not be searched
629
- if(d[g].mpid){var h=d[g].ui;for(var i in h)if(e===i&&b.userIdentities[e]===h[i]){c=g;break}}c&&f.storeDataInMemory(d,c);},this.encodePersistence=function(b){for(var c in b=JSON.parse(b),b.gs)b.gs.hasOwnProperty(c)&&(Base64CookieKeys[c]?b.gs[c]?Array.isArray(b.gs[c])&&b.gs[c].length||a._Helpers.isObject(b.gs[c])&&Object.keys(b.gs[c]).length?b.gs[c]=Base64.encode(JSON.stringify(b.gs[c])):delete b.gs[c]:delete b.gs[c]:"ie"===c?b.gs[c]=b.gs[c]?1:0:!b.gs[c]&&delete b.gs[c]);for(var d in b)if(b.hasOwnProperty(d)&&!SDKv2NonMPIDCookieKeys[d])for(c in b[d])b[d].hasOwnProperty(c)&&Base64CookieKeys[c]&&(a._Helpers.isObject(b[d][c])&&Object.keys(b[d][c]).length?b[d][c]=Base64.encode(JSON.stringify(b[d][c])):delete b[d][c]);return createCookieString(JSON.stringify(b))},this.decodePersistence=function(b){try{if(b){if(b=JSON.parse(revertCookieString(b)),a._Helpers.isObject(b)&&Object.keys(b).length){for(var c in b.gs)b.gs.hasOwnProperty(c)&&(Base64CookieKeys[c]?b.gs[c]=JSON.parse(Base64.decode(b.gs[c])):"ie"===c&&(b.gs[c]=!!b.gs[c]));for(var d in b)if(b.hasOwnProperty(d))if(!SDKv2NonMPIDCookieKeys[d])for(c in b[d])b[d].hasOwnProperty(c)&&Base64CookieKeys[c]&&b[d][c].length&&(b[d][c]=JSON.parse(Base64.decode(b[d][c])));else "l"===d&&(b[d]=!!b[d]);}return JSON.stringify(b)}}catch(b){a.Logger.error("Problem with decoding cookie",b);}},this.getCookieDomain=function(){if(a._Store.SDKConfig.cookieDomain)return a._Store.SDKConfig.cookieDomain;var b=f.getDomain(document,location.hostname);return ""===b?"":"."+b},this.getDomain=function(a,b){var c,d,e=b.split(".");for(c=e.length-1;0<=c;c--)if(d=e.slice(c).join("."),a.cookie="mptest=cookie;domain=."+d+";",-1<a.cookie.indexOf("mptest=cookie"))return a.cookie="mptest=;domain=."+d+";expires=Thu, 01 Jan 1970 00:00:01 GMT;",d;return ""},this.getUserIdentities=function(a){var b=f.getPersistence();return b&&b[a]&&b[a].ui?b[a].ui:{}},this.getCartProducts=function(b){var c,d=localStorage.getItem(a._Store.prodStorageName);return d&&(c=JSON.parse(Base64.decode(d)),c&&c[b]&&c[b].cp)?c[b].cp:[]},this.setCartProducts=function(b){if(a._Store.isLocalStorageAvailable)try{window.localStorage.setItem(encodeURIComponent(a._Store.prodStorageName),Base64.encode(JSON.stringify(b)));}catch(b){a.Logger.error("Error with setting products on localStorage.");}},this.saveUserIdentitiesToPersistence=function(a,b){if(b){var c=f.getPersistence();c&&(c[a]?c[a].ui=b:c[a]={ui:b},f.savePersistence(c));}},this.saveUserCookieSyncDatesToPersistence=function(a,b){if(b){var c=f.getPersistence();c&&(c[a]?c[a].csd=b:c[a]={csd:b}),f.savePersistence(c);}},this.swapCurrentUser=function(a,b,c){if(a&&b&&a!==b){var d=f.getPersistence();d&&(d.cu=b,d.gs.csm=c,f.savePersistence(d));}},this.savePersistence=function(b){var c,d=f.encodePersistence(JSON.stringify(b)),e=new Date,g=a._Store.storageName,h=new Date(e.getTime()+1e3*(60*(60*(24*a._Store.SDKConfig.cookieExpiration)))).toGMTString(),i=f.getCookieDomain();if(c=""===i?"":";domain="+i,a._Store.SDKConfig.useCookieStorage){var j=f.reduceAndEncodePersistence(b,h,c,a._Store.SDKConfig.maxCookieSize);window.document.cookie=encodeURIComponent(g)+"="+j;}else a._Store.isLocalStorageAvailable&&localStorage.setItem(a._Store.storageName,d);},this.getPersistence=function(){var a=this.useLocalStorage()?this.getLocalStorage():this.getCookie();return a},this.getFirstSeenTime=function(a){if(!a)return null;var b=f.getPersistence();return b&&b[a]&&b[a].fst?b[a].fst:null},this.setFirstSeenTime=function(a,b){if(a){b||(b=new Date().getTime());var c=f.getPersistence();c&&(!c[a]&&(c[a]={}),!c[a].fst&&(c[a].fst=b,f.savePersistence(c)));}// https://go.mparticle.com/work/SQDSDKS-6329
629
+ if(d[g].mpid){var h=d[g].ui;for(var i in h)if(e===i&&b.userIdentities[e]===h[i]){c=g;break}}c&&f.storeDataInMemory(d,c);},this.encodePersistence=function(b){for(var c in b=JSON.parse(b),b.gs)b.gs.hasOwnProperty(c)&&(Base64CookieKeys[c]?b.gs[c]?Array.isArray(b.gs[c])&&b.gs[c].length||a._Helpers.isObject(b.gs[c])&&Object.keys(b.gs[c]).length?b.gs[c]=Base64.encode(JSON.stringify(b.gs[c])):delete b.gs[c]:delete b.gs[c]:"ie"===c?b.gs[c]=b.gs[c]?1:0:!b.gs[c]&&delete b.gs[c]);for(var d in b)if(b.hasOwnProperty(d)&&!SDKv2NonMPIDCookieKeys[d])for(c in b[d])b[d].hasOwnProperty(c)&&Base64CookieKeys[c]&&(a._Helpers.isObject(b[d][c])&&Object.keys(b[d][c]).length?b[d][c]=Base64.encode(JSON.stringify(b[d][c])):delete b[d][c]);return createCookieString(JSON.stringify(b))},this.decodePersistence=function(b){try{if(b){if(b=JSON.parse(revertCookieString(b)),a._Helpers.isObject(b)&&Object.keys(b).length){for(var c in b.gs)b.gs.hasOwnProperty(c)&&(Base64CookieKeys[c]?b.gs[c]=JSON.parse(Base64.decode(b.gs[c])):"ie"===c&&(b.gs[c]=!!b.gs[c]));for(var d in b)if(b.hasOwnProperty(d))if(!SDKv2NonMPIDCookieKeys[d])for(c in b[d])b[d].hasOwnProperty(c)&&Base64CookieKeys[c]&&b[d][c].length&&(b[d][c]=JSON.parse(Base64.decode(b[d][c])));else "l"===d&&(b[d]=!!b[d]);}return JSON.stringify(b)}}catch(b){a.Logger.error("Problem with decoding cookie",b);}},this.getCookieDomain=function(){if(a._Store.SDKConfig.cookieDomain)return a._Store.SDKConfig.cookieDomain;var b=f.getDomain(document,location.hostname);return ""===b?"":"."+b},this.getDomain=function(a,b){var c,d,e=b.split(".");for(c=e.length-1;0<=c;c--)if(d=e.slice(c).join("."),a.cookie="mptest=cookie;domain=."+d+";",-1<a.cookie.indexOf("mptest=cookie"))return a.cookie="mptest=;domain=."+d+";expires=Thu, 01 Jan 1970 00:00:01 GMT;",d;return ""},this.getCartProducts=function(b){var c,d=localStorage.getItem(a._Store.prodStorageName);return d&&(c=JSON.parse(Base64.decode(d)),c&&c[b]&&c[b].cp)?c[b].cp:[]},this.setCartProducts=function(b){if(a._Store.isLocalStorageAvailable)try{window.localStorage.setItem(encodeURIComponent(a._Store.prodStorageName),Base64.encode(JSON.stringify(b)));}catch(b){a.Logger.error("Error with setting products on localStorage.");}},this.saveUserCookieSyncDatesToPersistence=function(a,b){if(b){var c=f.getPersistence();c&&(c[a]?c[a].csd=b:c[a]={csd:b}),f.savePersistence(c);}},this.swapCurrentUser=function(a,b,c){if(a&&b&&a!==b){var d=f.getPersistence();d&&(d.cu=b,d.gs.csm=c,f.savePersistence(d));}},this.savePersistence=function(b){var c,d=f.encodePersistence(JSON.stringify(b)),e=new Date,g=a._Store.storageName,h=new Date(e.getTime()+1e3*(60*(60*(24*a._Store.SDKConfig.cookieExpiration)))).toGMTString(),i=f.getCookieDomain();if(c=""===i?"":";domain="+i,a._Store.SDKConfig.useCookieStorage){var j=f.reduceAndEncodePersistence(b,h,c,a._Store.SDKConfig.maxCookieSize);window.document.cookie=encodeURIComponent(g)+"="+j;}else a._Store.isLocalStorageAvailable&&localStorage.setItem(a._Store.storageName,d);},this.getPersistence=function(){var a=this.useLocalStorage()?this.getLocalStorage():this.getCookie();return a},this.getFirstSeenTime=function(a){if(!a)return null;var b=f.getPersistence();return b&&b[a]&&b[a].fst?b[a].fst:null},this.setFirstSeenTime=function(a,b){if(a){b||(b=new Date().getTime());var c=f.getPersistence();c&&(!c[a]&&(c[a]={}),!c[a].fst&&(c[a].fst=b,f.savePersistence(c)));}// https://go.mparticle.com/work/SQDSDKS-6329
630
630
  },this.getLastSeenTime=function(b){if(!b)return null;if(b===a.Identity.getCurrentUser().getMPID())//if the mpid is the current user, its last seen time is the current time
631
631
  return new Date().getTime();var c=f.getPersistence();return c&&c[b]&&c[b].lst?c[b].lst:null},this.setLastSeenTime=function(a,b){if(a){b||(b=new Date().getTime());var c=f.getPersistence();c&&c[a]&&(c[a].lst=b,f.savePersistence(c));}// https://go.mparticle.com/work/SQDSDKS-6329
632
632
  },this.getDeviceId=function(){return a._Store.deviceId},this.setDeviceId=function(b){a._Store.deviceId=b,f.update();},this.resetPersistence=function(){if(c(StorageNames.localStorageName),c(StorageNames.localStorageNameV3),c(StorageNames.localStorageNameV4),c(a._Store.prodStorageName),c(a._Store.storageName),c(StorageNames.localStorageProductsV4),f.expireCookies(StorageNames.cookieName),f.expireCookies(StorageNames.cookieNameV2),f.expireCookies(StorageNames.cookieNameV3),f.expireCookies(StorageNames.cookieNameV4),f.expireCookies(a._Store.prodStorageName),f.expireCookies(a._Store.storageName),mParticle._isTestEnv){c(a._Helpers.createMainStorageName("abcdef")),f.expireCookies(a._Helpers.createMainStorageName("abcdef")),c(a._Helpers.createProductStorageName("abcdef"));}},this.forwardingStatsBatches={uploadsTable:{},forwardingStatsEventQueue:[]};}
@@ -640,7 +640,7 @@ c(b),b=null,a._Store.isTracking=!1;}));else {var d={coords:{latitude:a._Store.cu
640
640
  return a.Logger.verbose(Messages$3.InformationMessages.StartingLogCommerceEvent),b.ProductAction&&null===b.EventCategory?void a.Logger.error("Commerce event not sent. The mParticle.ProductActionType you passed was invalid. Re-check your code."):void(c=a._Helpers.sanitizeAttributes(c,b.EventName),a._Helpers.canLog()?(a._Store.webviewBridgeEnabled&&(b.ShoppingCart={}),c&&(b.EventAttributes=c),a._APIClient.sendEventToServer(b,d),a._Persistence.update()):a.Logger.verbose(Messages$3.InformationMessages.AbandonLogEvent))},this.addEventHandler=function(c,d,f,g,h){var j,k,e=[],l=function handler(c){var d=function timeoutHandler(){j.href?window.location.href=j.href:j.submit&&j.submit();};a.Logger.verbose("DOM event triggered, handling event"),b.logEvent({messageType:Types.MessageType.PageEvent,name:"function"==typeof f?f(j):f,data:"function"==typeof g?g(j):g,eventType:h||Types.EventType.Other}),(j.href&&"_blank"!==j.target||j.submit)&&(c.preventDefault?c.preventDefault():c.returnValue=!1,setTimeout(d,a._Store.SDKConfig.timeout));};if(!d)return void a.Logger.error("Can't bind event, selector is required");// Handle a css selector string or a dom element
641
641
  if("string"==typeof d?e=document.querySelectorAll(d):d.nodeType&&(e=[d]),e.length)for(a.Logger.verbose("Found "+e.length+" element"+(1<e.length?"s":"")+", attaching event handlers"),k=0;k<e.length;k++)j=e[k],j.addEventListener?j.addEventListener(c,l,!1):j.attachEvent?j.attachEvent("on"+c,l):j["on"+c]=l;else a.Logger.verbose("No elements found");};}
642
642
 
643
- function filteredMparticleUser(a,b,c,d){var e=this;return {getUserIdentities:function getUserIdentities(){var e={},f=c._Persistence.getUserIdentities(a);for(var g in f)if(f.hasOwnProperty(g)){var h=Types.IdentityType.getIdentityName(c._Helpers.parseNumber(g));d&&(!d||d.isIdentityBlocked(h))||(//if identity type is not blocked
643
+ function filteredMparticleUser(a,b,c,d){var e=this;return {getUserIdentities:function getUserIdentities(){var e={},f=c._Store.getUserIdentities(a);for(var g in f)if(f.hasOwnProperty(g)){var h=Types.IdentityType.getIdentityName(c._Helpers.parseNumber(g));d&&(!d||d.isIdentityBlocked(h))||(//if identity type is not blocked
644
644
  e[h]=f[g]);}return e=c._Helpers.filterUserIdentitiesForForwarders(e,b.userIdentityFilters),{userIdentities:e}},getMPID:function getMPID(){return a},getUserAttributesLists:function getUserAttributesLists(a){var b,f={};for(var g in b=e.getAllUserAttributes(),b)b.hasOwnProperty(g)&&Array.isArray(b[g])&&(d&&(!d||d.isAttributeKeyBlocked(g))||(f[g]=b[g].slice()));return f=c._Helpers.filterUserAttributes(f,a.userAttributeFilters),f},getAllUserAttributes:function getAllUserAttributes(){var e={},f=c._Store.getUserAttributes(a);if(f)for(var g in f)f.hasOwnProperty(g)&&(d&&(!d||d.isAttributeKeyBlocked(g))||(Array.isArray(f[g])?e[g]=f[g].slice():e[g]=f[g]));return e=c._Helpers.filterUserAttributes(e,b.userAttributeFilters),e}}}
645
645
 
646
646
  var _Constants$IdentityMe=Constants.IdentityMethods,Modify$3=_Constants$IdentityMe.Modify,Identify$2=_Constants$IdentityMe.Identify,Login$2=_Constants$IdentityMe.Login,Logout$2=_Constants$IdentityMe.Logout;function Forwarders(a,b){var c=this,d={setUserAttribute:"setUserAttribute",removeUserAttribute:"removeUserAttribute"};// TODO: https://go.mparticle.com/work/SQDSDKS-6036
@@ -753,7 +753,7 @@ var Messages$2=Constants.Messages,HTTPCodes$2=Constants.HTTPCodes,FeatureFlags$1
753
753
  // send a user identity change request on identify, login, logout, modify when any values change.
754
754
  // compare what identities exist vs what is previously was for the specific user if they were in memory before.
755
755
  // if it's the first time the user is logging in, send a user identity change request with
756
- this.idCache=null,this.audienceManager=null,this.IdentityRequest={preProcessIdentityRequest:function preProcessIdentityRequest(e,r,s){t.Logger.verbose(Messages$2.InformationMessages.StartingLogEvent+": "+s);var i=t._Helpers.Validators.validateIdentities(e,s);if(!i.valid)return t.Logger.error("ERROR: "+i.error),{valid:!1,error:i.error};if(r&&!t._Helpers.Validators.isFunction(r)){var n="The optional callback must be a function. You tried entering a(n) "+_typeof(r);return t.Logger.error(n),{valid:!1,error:n}}return {valid:!0}},createIdentityRequest:function createIdentityRequest(e,r,s,i,n,a,d){var o={client_sdk:{platform:r,sdk_vendor:s,sdk_version:i},context:a,environment:t._Store.SDKConfig.isDevelopmentMode?"development":"production",request_id:t._Helpers.generateUniqueId(),request_timestamp_ms:new Date().getTime(),previous_mpid:d||null,known_identities:createKnownIdentities(e,n)};return o},createModifyIdentityRequest:function createModifyIdentityRequest(e,r,s,i,n,a){return {client_sdk:{platform:s,sdk_vendor:i,sdk_version:n},context:a,environment:t._Store.SDKConfig.isDevelopmentMode?"development":"production",request_id:t._Helpers.generateUniqueId(),request_timestamp_ms:new Date().getTime(),identity_changes:this.createIdentityChanges(e,r)}},createIdentityChanges:function createIdentityChanges(e,t){var r,s=[];if(t&&isObject(t)&&e&&isObject(e))for(r in t)s.push({old_value:e[r]||null,new_value:t[r],identity_type:r});return s},// takes 2 UI objects keyed by name, combines them, returns them keyed by type
756
+ this.idCache=null,this.audienceManager=null,this.IdentityRequest={preProcessIdentityRequest:function preProcessIdentityRequest(e,r,s){t.Logger.verbose(Messages$2.InformationMessages.StartingLogEvent+": "+s);var i=t._Helpers.Validators.validateIdentities(e,s);if(!i.valid)return t.Logger.error("ERROR: "+i.error),{valid:!1,error:i.error};if(r&&!t._Helpers.Validators.isFunction(r)){var n="The optional callback must be a function. You tried entering a(n) "+_typeof(r);return t.Logger.error(n),{valid:!1,error:n}}return {valid:!0}},createIdentityRequest:function createIdentityRequest(e,r,s,i,n,a,o){var d={client_sdk:{platform:r,sdk_vendor:s,sdk_version:i},context:a,environment:t._Store.SDKConfig.isDevelopmentMode?"development":"production",request_id:t._Helpers.generateUniqueId(),request_timestamp_ms:new Date().getTime(),previous_mpid:o||null,known_identities:createKnownIdentities(e,n)};return d},createModifyIdentityRequest:function createModifyIdentityRequest(e,r,s,i,n,a){return {client_sdk:{platform:s,sdk_vendor:i,sdk_version:n},context:a,environment:t._Store.SDKConfig.isDevelopmentMode?"development":"production",request_id:t._Helpers.generateUniqueId(),request_timestamp_ms:new Date().getTime(),identity_changes:this.createIdentityChanges(e,r)}},createIdentityChanges:function createIdentityChanges(e,t){var r,s=[];if(t&&isObject(t)&&e&&isObject(e))for(r in t)s.push({old_value:e[r]||null,new_value:t[r],identity_type:r});return s},// takes 2 UI objects keyed by name, combines them, returns them keyed by type
757
757
  combineUserIdentities:function combineUserIdentities(e,t){var r={},s=i({},e,t);for(var n in s){var a=Types.IdentityType.getIdentityType(n);// this check removes anything that is not whitelisted as an identity type
758
758
  !1!==a&&0<=a&&(r[Types.IdentityType.getIdentityType(n)]=s[n]);}return r},createAliasNetworkRequest:function createAliasNetworkRequest(e){return {request_id:t._Helpers.generateUniqueId(),request_type:"alias",environment:t._Store.SDKConfig.isDevelopmentMode?"development":"production",api_key:t._Store.devToken,data:{destination_mpid:e.destinationMpid,source_mpid:e.sourceMpid,start_unixtime_ms:e.startTime,end_unixtime_ms:e.endTime,scope:e.scope,device_application_stamp:t._Store.deviceId}}},convertAliasToNative:function convertAliasToNative(e){return {DestinationMpid:e.destinationMpid,SourceMpid:e.sourceMpid,StartUnixtimeMs:e.startTime,EndUnixtimeMs:e.endTime}},convertToNative:function convertToNative(e){var t=[];if(e&&e.userIdentities){for(var r in e.userIdentities)e.userIdentities.hasOwnProperty(r)&&t.push({Type:Types.IdentityType.getIdentityType(r),Identity:e.userIdentities[r]});return {UserIdentities:t}}}},this.IdentityAPI={HTTPCodes:HTTPCodes$2,/**
759
759
  * Initiate a logout request to the mParticle server
@@ -761,25 +761,25 @@ combineUserIdentities:function combineUserIdentities(e,t){var r={},s=i({},e,t);f
761
761
  * @param {Object} identityApiData The identityApiData object as indicated [here](https://github.com/mParticle/mparticle-sdk-javascript/blob/master-v2/README.md#1-customize-the-sdk)
762
762
  * @param {Function} [callback] A callback function that is called when the identify request completes
763
763
  */identify:function identify(e,r){// https://go.mparticle.com/work/SQDSDKS-6337
764
- var s,i=t.Identity.getCurrentUser(),a=t._Identity.IdentityRequest.preProcessIdentityRequest(e,r,Identify);if(i&&(s=i.getMPID()),a.valid){var d=t._Identity.IdentityRequest.createIdentityRequest(e,Constants.platform,Constants.sdkVendor,Constants.sdkVersion,t._Store.deviceId,t._Store.context,s);if(t._Helpers.getFeatureFlag(Constants.FeatureFlags.CacheIdentity)){var o=tryCacheIdentity(d.known_identities,n.idCache,n.parseIdentityResponse,s,r,e,Identify);if(o)return}t._Helpers.canLog()?t._Store.webviewBridgeEnabled?(t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Identify,JSON.stringify(t._Identity.IdentityRequest.convertToNative(e))),t._Helpers.invokeCallback(r,HTTPCodes$2.nativeIdentityRequest,"Identify request sent to native sdk")):t._IdentityAPIClient.sendIdentityRequest(d,Identify,r,e,n.parseIdentityResponse,s,d.known_identities):(t._Helpers.invokeCallback(r,HTTPCodes$2.loggingDisabledOrMissingAPIKey,Messages$2.InformationMessages.AbandonLogEvent),t.Logger.verbose(Messages$2.InformationMessages.AbandonLogEvent));}else t._Helpers.invokeCallback(r,HTTPCodes$2.validationIssue,a.error),t.Logger.verbose(a);},/**
764
+ var s,i=t.Identity.getCurrentUser(),a=t._Identity.IdentityRequest.preProcessIdentityRequest(e,r,Identify);if(i&&(s=i.getMPID()),a.valid){var o=t._Identity.IdentityRequest.createIdentityRequest(e,Constants.platform,Constants.sdkVendor,Constants.sdkVersion,t._Store.deviceId,t._Store.context,s);if(t._Helpers.getFeatureFlag(Constants.FeatureFlags.CacheIdentity)){var d=tryCacheIdentity(o.known_identities,n.idCache,n.parseIdentityResponse,s,r,e,Identify);if(d)return}t._Helpers.canLog()?t._Store.webviewBridgeEnabled?(t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Identify,JSON.stringify(t._Identity.IdentityRequest.convertToNative(e))),t._Helpers.invokeCallback(r,HTTPCodes$2.nativeIdentityRequest,"Identify request sent to native sdk")):t._IdentityAPIClient.sendIdentityRequest(o,Identify,r,e,n.parseIdentityResponse,s,o.known_identities):(t._Helpers.invokeCallback(r,HTTPCodes$2.loggingDisabledOrMissingAPIKey,Messages$2.InformationMessages.AbandonLogEvent),t.Logger.verbose(Messages$2.InformationMessages.AbandonLogEvent));}else t._Helpers.invokeCallback(r,HTTPCodes$2.validationIssue,a.error),t.Logger.verbose(a);},/**
765
765
  * Initiate a logout request to the mParticle server
766
766
  * @method logout
767
767
  * @param {Object} identityApiData The identityApiData object as indicated [here](https://github.com/mParticle/mparticle-sdk-javascript/blob/master-v2/README.md#1-customize-the-sdk)
768
768
  * @param {Function} [callback] A callback function that is called when the logout request completes
769
769
  */logout:function logout(e,r){// https://go.mparticle.com/work/SQDSDKS-6337
770
- var s,i=t.Identity.getCurrentUser(),a=t._Identity.IdentityRequest.preProcessIdentityRequest(e,r,Logout);if(i&&(s=i.getMPID()),a.valid){var d,o=t._Identity.IdentityRequest.createIdentityRequest(e,Constants.platform,Constants.sdkVendor,Constants.sdkVersion,t._Store.deviceId,t._Store.context,s);t._Helpers.canLog()?t._Store.webviewBridgeEnabled?(t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Logout,JSON.stringify(t._Identity.IdentityRequest.convertToNative(e))),t._Helpers.invokeCallback(r,HTTPCodes$2.nativeIdentityRequest,"Logout request sent to native sdk")):(t._IdentityAPIClient.sendIdentityRequest(o,Logout,r,e,n.parseIdentityResponse,s),d=t._ServerModel.createEventObject({messageType:Types.MessageType.Profile}),d.ProfileMessageType=Types.ProfileMessageType.Logout,t._Store.activeForwarders.length&&t._Store.activeForwarders.forEach(function(e){e.logOut&&e.logOut(d);})):(t._Helpers.invokeCallback(r,HTTPCodes$2.loggingDisabledOrMissingAPIKey,Messages$2.InformationMessages.AbandonLogEvent),t.Logger.verbose(Messages$2.InformationMessages.AbandonLogEvent));}else t._Helpers.invokeCallback(r,HTTPCodes$2.validationIssue,a.error),t.Logger.verbose(a);},/**
770
+ var s,i=t.Identity.getCurrentUser(),a=t._Identity.IdentityRequest.preProcessIdentityRequest(e,r,Logout);if(i&&(s=i.getMPID()),a.valid){var o,d=t._Identity.IdentityRequest.createIdentityRequest(e,Constants.platform,Constants.sdkVendor,Constants.sdkVersion,t._Store.deviceId,t._Store.context,s);t._Helpers.canLog()?t._Store.webviewBridgeEnabled?(t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Logout,JSON.stringify(t._Identity.IdentityRequest.convertToNative(e))),t._Helpers.invokeCallback(r,HTTPCodes$2.nativeIdentityRequest,"Logout request sent to native sdk")):(t._IdentityAPIClient.sendIdentityRequest(d,Logout,r,e,n.parseIdentityResponse,s),o=t._ServerModel.createEventObject({messageType:Types.MessageType.Profile}),o.ProfileMessageType=Types.ProfileMessageType.Logout,t._Store.activeForwarders.length&&t._Store.activeForwarders.forEach(function(e){e.logOut&&e.logOut(o);})):(t._Helpers.invokeCallback(r,HTTPCodes$2.loggingDisabledOrMissingAPIKey,Messages$2.InformationMessages.AbandonLogEvent),t.Logger.verbose(Messages$2.InformationMessages.AbandonLogEvent));}else t._Helpers.invokeCallback(r,HTTPCodes$2.validationIssue,a.error),t.Logger.verbose(a);},/**
771
771
  * Initiate a login request to the mParticle server
772
772
  * @method login
773
773
  * @param {Object} identityApiData The identityApiData object as indicated [here](https://github.com/mParticle/mparticle-sdk-javascript/blob/master-v2/README.md#1-customize-the-sdk)
774
774
  * @param {Function} [callback] A callback function that is called when the login request completes
775
775
  */login:function login(e,r){// https://go.mparticle.com/work/SQDSDKS-6337
776
- var s,i=t.Identity.getCurrentUser(),a=t._Identity.IdentityRequest.preProcessIdentityRequest(e,r,Login);if(i&&(s=i.getMPID()),a.valid){var d=t._Identity.IdentityRequest.createIdentityRequest(e,Constants.platform,Constants.sdkVendor,Constants.sdkVersion,t._Store.deviceId,t._Store.context,s);if(t._Helpers.getFeatureFlag(Constants.FeatureFlags.CacheIdentity)){var o=tryCacheIdentity(d.known_identities,n.idCache,n.parseIdentityResponse,s,r,e,Login);if(o)return}t._Helpers.canLog()?t._Store.webviewBridgeEnabled?(t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Login,JSON.stringify(t._Identity.IdentityRequest.convertToNative(e))),t._Helpers.invokeCallback(r,HTTPCodes$2.nativeIdentityRequest,"Login request sent to native sdk")):t._IdentityAPIClient.sendIdentityRequest(d,Login,r,e,n.parseIdentityResponse,s,d.known_identities):(t._Helpers.invokeCallback(r,HTTPCodes$2.loggingDisabledOrMissingAPIKey,Messages$2.InformationMessages.AbandonLogEvent),t.Logger.verbose(Messages$2.InformationMessages.AbandonLogEvent));}else t._Helpers.invokeCallback(r,HTTPCodes$2.validationIssue,a.error),t.Logger.verbose(a);},/**
776
+ var s,i=t.Identity.getCurrentUser(),a=t._Identity.IdentityRequest.preProcessIdentityRequest(e,r,Login);if(i&&(s=i.getMPID()),a.valid){var o=t._Identity.IdentityRequest.createIdentityRequest(e,Constants.platform,Constants.sdkVendor,Constants.sdkVersion,t._Store.deviceId,t._Store.context,s);if(t._Helpers.getFeatureFlag(Constants.FeatureFlags.CacheIdentity)){var d=tryCacheIdentity(o.known_identities,n.idCache,n.parseIdentityResponse,s,r,e,Login);if(d)return}t._Helpers.canLog()?t._Store.webviewBridgeEnabled?(t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Login,JSON.stringify(t._Identity.IdentityRequest.convertToNative(e))),t._Helpers.invokeCallback(r,HTTPCodes$2.nativeIdentityRequest,"Login request sent to native sdk")):t._IdentityAPIClient.sendIdentityRequest(o,Login,r,e,n.parseIdentityResponse,s,o.known_identities):(t._Helpers.invokeCallback(r,HTTPCodes$2.loggingDisabledOrMissingAPIKey,Messages$2.InformationMessages.AbandonLogEvent),t.Logger.verbose(Messages$2.InformationMessages.AbandonLogEvent));}else t._Helpers.invokeCallback(r,HTTPCodes$2.validationIssue,a.error),t.Logger.verbose(a);},/**
777
777
  * Initiate a modify request to the mParticle server
778
778
  * @method modify
779
779
  * @param {Object} identityApiData The identityApiData object as indicated [here](https://github.com/mParticle/mparticle-sdk-javascript/blob/master-v2/README.md#1-customize-the-sdk)
780
780
  * @param {Function} [callback] A callback function that is called when the modify request completes
781
781
  */modify:function modify(e,r){// https://go.mparticle.com/work/SQDSDKS-6337
782
- var s,i=t.Identity.getCurrentUser(),a=t._Identity.IdentityRequest.preProcessIdentityRequest(e,r,Modify$1);i&&(s=i.getMPID());var d=e&&e.userIdentities?e.userIdentities:{};if(a.valid){var o=t._Identity.IdentityRequest.createModifyIdentityRequest(i?i.getUserIdentities().userIdentities:{},d,Constants.platform,Constants.sdkVendor,Constants.sdkVersion,t._Store.context);t._Helpers.canLog()?t._Store.webviewBridgeEnabled?(t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Modify,JSON.stringify(t._Identity.IdentityRequest.convertToNative(e))),t._Helpers.invokeCallback(r,HTTPCodes$2.nativeIdentityRequest,"Modify request sent to native sdk")):t._IdentityAPIClient.sendIdentityRequest(o,Modify$1,r,e,n.parseIdentityResponse,s,o.known_identities):(t._Helpers.invokeCallback(r,HTTPCodes$2.loggingDisabledOrMissingAPIKey,Messages$2.InformationMessages.AbandonLogEvent),t.Logger.verbose(Messages$2.InformationMessages.AbandonLogEvent));}else t._Helpers.invokeCallback(r,HTTPCodes$2.validationIssue,a.error),t.Logger.verbose(a);},/**
782
+ var s,i=t.Identity.getCurrentUser(),a=t._Identity.IdentityRequest.preProcessIdentityRequest(e,r,Modify$1);i&&(s=i.getMPID());var o=e&&e.userIdentities?e.userIdentities:{};if(a.valid){var d=t._Identity.IdentityRequest.createModifyIdentityRequest(i?i.getUserIdentities().userIdentities:{},o,Constants.platform,Constants.sdkVendor,Constants.sdkVersion,t._Store.context);t._Helpers.canLog()?t._Store.webviewBridgeEnabled?(t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Modify,JSON.stringify(t._Identity.IdentityRequest.convertToNative(e))),t._Helpers.invokeCallback(r,HTTPCodes$2.nativeIdentityRequest,"Modify request sent to native sdk")):t._IdentityAPIClient.sendIdentityRequest(d,Modify$1,r,e,n.parseIdentityResponse,s,d.known_identities):(t._Helpers.invokeCallback(r,HTTPCodes$2.loggingDisabledOrMissingAPIKey,Messages$2.InformationMessages.AbandonLogEvent),t.Logger.verbose(Messages$2.InformationMessages.AbandonLogEvent));}else t._Helpers.invokeCallback(r,HTTPCodes$2.validationIssue,a.error),t.Logger.verbose(a);},/**
783
783
  * Returns a user object with methods to interact with the current user
784
784
  * @method getCurrentUser
785
785
  * @return {Object} the current user object
@@ -817,7 +817,7 @@ return s<i&&(s=i,n<s&&t.Logger.warning("Source User has not been seen in the las
817
817
  * Get user identities for current user
818
818
  * @method getUserIdentities
819
819
  * @return {Object} an object with userIdentities as its key
820
- */getUserIdentities:function getUserIdentities(){var r={},s=t._Persistence.getUserIdentities(e);for(var i in s)s.hasOwnProperty(i)&&(r[Types.IdentityType.getIdentityName(t._Helpers.parseNumber(i))]=s[i]);return {userIdentities:r}},/**
820
+ */getUserIdentities:function getUserIdentities(){var r={},s=t._Store.getUserIdentities(e);for(var i in s)s.hasOwnProperty(i)&&(r[Types.IdentityType.getIdentityName(t._Helpers.parseNumber(i))]=s[i]);return {userIdentities:r}},/**
821
821
  * Get the MPID of the current user
822
822
  * @method getMPID
823
823
  * @return {String} the current user MPID as a string
@@ -836,7 +836,7 @@ return s<i&&(s=i,n<s&&t.Logger.warning("Source User has not been seen in the las
836
836
  * @param {String} value
837
837
  */ // https://go.mparticle.com/work/SQDSDKS-4576
838
838
  // https://go.mparticle.com/work/SQDSDKS-6373
839
- setUserAttribute:function setUserAttribute(r,i){if(t._SessionManager.resetSessionTimer(),t._Helpers.canLog()){if(!t._Helpers.Validators.isValidAttributeValue(i))return void t.Logger.error(Messages$2.ErrorMessages.BadAttribute);if(!t._Helpers.Validators.isValidKeyValue(r))return void t.Logger.error(Messages$2.ErrorMessages.BadKey);if(t._Store.webviewBridgeEnabled)t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.SetUserAttribute,JSON.stringify({key:r,value:i}));else {var n,a,d=this.getAllUserAttributes(),o=t._Helpers.findKeyInObject(d,r);o?(a=!1,n=d[o],delete d[o]):a=!0,d[r]=i,t._Store.setUserAttributes(e,d),s.sendUserAttributeChangeEvent(r,i,n,a,!1,this),t._Forwarders.initForwarders(s.IdentityAPI.getCurrentUser().getUserIdentities(),t._APIClient.prepareForwardingStats),t._Forwarders.handleForwarderUserAttributes("setUserAttribute",r,i);}}},/**
839
+ setUserAttribute:function setUserAttribute(r,i){if(t._SessionManager.resetSessionTimer(),t._Helpers.canLog()){if(!t._Helpers.Validators.isValidAttributeValue(i))return void t.Logger.error(Messages$2.ErrorMessages.BadAttribute);if(!t._Helpers.Validators.isValidKeyValue(r))return void t.Logger.error(Messages$2.ErrorMessages.BadKey);if(t._Store.webviewBridgeEnabled)t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.SetUserAttribute,JSON.stringify({key:r,value:i}));else {var n,a,o=this.getAllUserAttributes(),d=t._Helpers.findKeyInObject(o,r);d?(a=!1,n=o[d],delete o[d]):a=!0,o[r]=i,t._Store.setUserAttributes(e,o),s.sendUserAttributeChangeEvent(r,i,n,a,!1,this),t._Forwarders.initForwarders(s.IdentityAPI.getCurrentUser().getUserIdentities(),t._APIClient.prepareForwardingStats),t._Forwarders.handleForwarderUserAttributes("setUserAttribute",r,i);}}},/**
840
840
  * Set multiple user attributes
841
841
  * @method setUserAttributes
842
842
  * @param {Object} user attribute object with keys of the attribute type, and value of the attribute value
@@ -845,16 +845,16 @@ setUserAttributes:function setUserAttributes(e){if(t._SessionManager.resetSessio
845
845
  * Removes a specific user attribute
846
846
  * @method removeUserAttribute
847
847
  * @param {String} key
848
- */removeUserAttribute:function removeUserAttribute(r){var i,n;if(t._SessionManager.resetSessionTimer(),!t._Helpers.Validators.isValidKeyValue(r))return void t.Logger.error(Messages$2.ErrorMessages.BadKey);if(t._Store.webviewBridgeEnabled)t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.RemoveUserAttribute,JSON.stringify({key:r,value:null}));else {i=t._Persistence.getPersistence(),n=this.getAllUserAttributes();var a=t._Helpers.findKeyInObject(n,r);a&&(r=a);var d=n[r]?n[r].toString():null;delete n[r],i&&i[e]&&(i[e].ua=n,t._Persistence.savePersistence(i,e)),s.sendUserAttributeChangeEvent(r,null,d,!1,!0,this),t._Forwarders.initForwarders(s.IdentityAPI.getCurrentUser().getUserIdentities(),t._APIClient.prepareForwardingStats),t._Forwarders.handleForwarderUserAttributes("removeUserAttribute",r,null);}},/**
848
+ */removeUserAttribute:function removeUserAttribute(r){var i,n;if(t._SessionManager.resetSessionTimer(),!t._Helpers.Validators.isValidKeyValue(r))return void t.Logger.error(Messages$2.ErrorMessages.BadKey);if(t._Store.webviewBridgeEnabled)t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.RemoveUserAttribute,JSON.stringify({key:r,value:null}));else {i=t._Persistence.getPersistence(),n=this.getAllUserAttributes();var a=t._Helpers.findKeyInObject(n,r);a&&(r=a);var o=n[r]?n[r].toString():null;delete n[r],i&&i[e]&&(i[e].ua=n,t._Persistence.savePersistence(i,e)),s.sendUserAttributeChangeEvent(r,null,o,!1,!0,this),t._Forwarders.initForwarders(s.IdentityAPI.getCurrentUser().getUserIdentities(),t._APIClient.prepareForwardingStats),t._Forwarders.handleForwarderUserAttributes("removeUserAttribute",r,null);}},/**
849
849
  * Sets a list of user attributes
850
850
  * @method setUserAttributeList
851
851
  * @param {String} key
852
852
  * @param {Array} value an array of values
853
853
  */ // https://go.mparticle.com/work/SQDSDKS-6373
854
- setUserAttributeList:function setUserAttributeList(r,n){if(t._SessionManager.resetSessionTimer(),!t._Helpers.Validators.isValidKeyValue(r))return void t.Logger.error(Messages$2.ErrorMessages.BadKey);if(!Array.isArray(n))return void t.Logger.error("The value you passed in to setUserAttributeList must be an array. You passed in a "+("undefined"==typeof value?"undefined":_typeof(value)));var a=n.slice();if(t._Store.webviewBridgeEnabled)t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.SetUserAttributeList,JSON.stringify({key:r,value:a}));else {var d,o,g,l=this.getAllUserAttributes(),u=t._Helpers.findKeyInObject(l,r);// If the new attributeList length is different than the previous, then there is a change event.
854
+ setUserAttributeList:function setUserAttributeList(r,n){if(t._SessionManager.resetSessionTimer(),!t._Helpers.Validators.isValidKeyValue(r))return void t.Logger.error(Messages$2.ErrorMessages.BadKey);if(!Array.isArray(n))return void t.Logger.error("The value you passed in to setUserAttributeList must be an array. You passed in a "+("undefined"==typeof value?"undefined":_typeof(value)));var a=n.slice();if(t._Store.webviewBridgeEnabled)t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.SetUserAttributeList,JSON.stringify({key:r,value:a}));else {var o,d,g,l=this.getAllUserAttributes(),u=t._Helpers.findKeyInObject(l,r);// If the new attributeList length is different than the previous, then there is a change event.
855
855
  // Loop through new attributes list, see if they are all in the same index as previous user attributes list
856
856
  // If there are any changes, break, and immediately send a userAttributeChangeEvent with full array as a value
857
- if(u?(o=!1,d=l[u],delete l[u]):o=!0,l[r]=a,t._Store.setUserAttributes(e,l),!d||!Array.isArray(d))g=!0;else if(n.length!==d.length)g=!0;else for(var p=0;p<n.length;p++)if(d[p]!==n[p]){g=!0;break}g&&s.sendUserAttributeChangeEvent(r,n,d,o,!1,this),t._Forwarders.initForwarders(s.IdentityAPI.getCurrentUser().getUserIdentities(),t._APIClient.prepareForwardingStats),t._Forwarders.handleForwarderUserAttributes("setUserAttribute",r,a);}},/**
857
+ if(u?(d=!1,o=l[u],delete l[u]):d=!0,l[r]=a,t._Store.setUserAttributes(e,l),!o||!Array.isArray(o))g=!0;else if(n.length!==o.length)g=!0;else for(var p=0;p<n.length;p++)if(o[p]!==n[p]){g=!0;break}g&&s.sendUserAttributeChangeEvent(r,n,o,d,!1,this),t._Forwarders.initForwarders(s.IdentityAPI.getCurrentUser().getUserIdentities(),t._APIClient.prepareForwardingStats),t._Forwarders.handleForwarderUserAttributes("setUserAttribute",r,a);}},/**
858
858
  * Removes all user attributes
859
859
  * @method removeAllUserAttributes
860
860
  */removeAllUserAttributes:function removeAllUserAttributes(){var e;if(t._SessionManager.resetSessionTimer(),t._Store.webviewBridgeEnabled)t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.RemoveAllUserAttributes);else if(e=this.getAllUserAttributes(),t._Forwarders.initForwarders(s.IdentityAPI.getCurrentUser().getUserIdentities(),t._APIClient.prepareForwardingStats),e)for(var r in e)e.hasOwnProperty(r)&&t._Forwarders.handleForwarderUserAttributes("removeUserAttribute",r,null),this.removeUserAttribute(r);},/**
@@ -895,7 +895,7 @@ return t._Helpers.getFeatureFlag(FeatureFlags$1.AudienceAPI)?void(null===s.audie
895
895
  * @param {Object} product the product
896
896
  * @param {Boolean} [logEvent] a boolean to log adding of the cart object. If blank, no logging occurs.
897
897
  * @deprecated
898
- */remove:function remove(r,s){t.Logger.warning("Deprecated function Identity.getCurrentUser().getCart().remove() will be removed in future releases");var i,n,a=-1,d=null;if(t._Store.webviewBridgeEnabled)t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.RemoveFromCart,JSON.stringify(r));else {t._SessionManager.resetSessionTimer(),n=t._Persistence.getUserProductsFromLS(e),n&&(n.forEach(function(e,t){e.Sku===r.Sku&&(a=t,d=e);}),-1<a&&(n.splice(a,1),!0===s&&t._Events.logProductActionEvent(Types.ProductActionType.RemoveFromCart,d)));i=t._Persistence.getAllUserProductsFromLS(),i[e].cp=n,t._Persistence.setCartProducts(i);}},/**
898
+ */remove:function remove(r,s){t.Logger.warning("Deprecated function Identity.getCurrentUser().getCart().remove() will be removed in future releases");var i,n,a=-1,o=null;if(t._Store.webviewBridgeEnabled)t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.RemoveFromCart,JSON.stringify(r));else {t._SessionManager.resetSessionTimer(),n=t._Persistence.getUserProductsFromLS(e),n&&(n.forEach(function(e,t){e.Sku===r.Sku&&(a=t,o=e);}),-1<a&&(n.splice(a,1),!0===s&&t._Events.logProductActionEvent(Types.ProductActionType.RemoveFromCart,o)));i=t._Persistence.getAllUserProductsFromLS(),i[e].cp=n,t._Persistence.setCartProducts(i);}},/**
899
899
  * Clears the user's cart
900
900
  * @method clear
901
901
  * @deprecated
@@ -904,16 +904,16 @@ return t._Helpers.getFeatureFlag(FeatureFlags$1.AudienceAPI)?void(null===s.audie
904
904
  * @method getCartProducts
905
905
  * @return {Array} array of cart products
906
906
  * @deprecated
907
- */getCartProducts:function getCartProducts(){return t.Logger.warning("Deprecated function Identity.getCurrentUser().getCart().getCartProducts() will be removed in future releases"),t._Persistence.getCartProducts(e)}}},this.parseIdentityResponse=function(r,i,a,d,o,g,l){var u,p,c,y=t.Identity.getUser(i),I=y?y.getMPID():null,_=y?y.getUserIdentities().userIdentities:{},v={};t._Store.identityCallInFlight=!1;try{var m;if(t.Logger.verbose("Parsing \""+o+"\" identity response from server"),p=r.responseText?JSON.parse(r.responseText):null,t._Store.isLoggedIn=(null===(m=p)||void 0===m?void 0:m.is_logged_in)||!1,hasMPIDChanged(y,p)&&(t._Store.mpid=p.mpid,y&&t._Persistence.setLastSeenTime(i),u=!t._Persistence.getFirstSeenTime(p.mpid),t._Persistence.setFirstSeenTime(p.mpid)),200===r.status){s(CacheIdentity)&&cacheOrClearIdCache(o,g,n.idCache,r,l);var S=n.IdentityAPI.getUser(p.mpid),b=S?S.getUserIdentities().userIdentities:{};o===Modify$1?(v=t._Identity.IdentityRequest.combineUserIdentities(_,d.userIdentities),t._Persistence.saveUserIdentitiesToPersistence(i,v)):(o===Identify&&y&&p.mpid===I&&t._Persistence.setFirstSeenTime(p.mpid),t._Store.addMpidToSessionHistory(p.mpid,i),t._CookieSyncManager.attemptCookieSync(i,p.mpid,u),t._Persistence.swapCurrentUser(i,p.mpid,t._Store.currentSessionMPIDs),d&&!isEmpty(d.userIdentities)&&(v=n.IdentityRequest.combineUserIdentities(b,d.userIdentities)),t._Persistence.saveUserIdentitiesToPersistence(p.mpid,v),t._Persistence.update(),t._Store.syncPersistenceData(),t._Persistence.findPrevCookiesBasedOnUI(d),t._Store.context=p.context||t._Store.context),c=t.Identity.getCurrentUser(),tryOnUserAlias(y,c,d,t.Logger);var A=t._Persistence.getPersistence();c&&(t._Persistence.storeDataInMemory(A,c.getMPID()),n.reinitForwardersOnUserChange(y,c),n.setForwarderCallbacks(c,o));var P=getNewIdentitiesByName(v),U=o===Modify$1?_:b;// https://go.mparticle.com/work/SQDSDKS-6501
908
- n.sendUserIdentityChangeEvent(P,o,p.mpid,U);}if(a){var C=0===r.status?HTTPCodes$2.noHttpCoverage:r.status;t._Helpers.invokeCallback(a,C,p||null,c);}else p&&!isEmpty(p.errors)&&// https://go.mparticle.com/work/SQDSDKS-6500
907
+ */getCartProducts:function getCartProducts(){return t.Logger.warning("Deprecated function Identity.getCurrentUser().getCart().getCartProducts() will be removed in future releases"),t._Persistence.getCartProducts(e)}}},this.parseIdentityResponse=function(r,i,a,o,d,g,l){var u,p,y,c=t.Identity.getUser(i),I=c?c.getMPID():null,_=c?c.getUserIdentities().userIdentities:{},v={};t._Store.identityCallInFlight=!1;try{var m;if(t.Logger.verbose("Parsing \""+d+"\" identity response from server"),p=r.responseText?JSON.parse(r.responseText):null,t._Store.isLoggedIn=(null===(m=p)||void 0===m?void 0:m.is_logged_in)||!1,hasMPIDChanged(c,p)&&(t._Store.mpid=p.mpid,c&&t._Persistence.setLastSeenTime(i),u=!t._Persistence.getFirstSeenTime(p.mpid),t._Persistence.setFirstSeenTime(p.mpid)),200===r.status){s(CacheIdentity)&&cacheOrClearIdCache(d,g,n.idCache,r,l);var S=n.IdentityAPI.getUser(p.mpid),b=S?S.getUserIdentities().userIdentities:{};d===Modify$1?(v=t._Identity.IdentityRequest.combineUserIdentities(_,o.userIdentities),t._Store.setUserIdentities(i,v)):(d===Identify&&c&&p.mpid===I&&t._Persistence.setFirstSeenTime(p.mpid),t._Store.addMpidToSessionHistory(p.mpid,i),t._CookieSyncManager.attemptCookieSync(i,p.mpid,u),t._Persistence.swapCurrentUser(i,p.mpid,t._Store.currentSessionMPIDs),o&&!isEmpty(o.userIdentities)&&(v=n.IdentityRequest.combineUserIdentities(b,o.userIdentities)),t._Store.setUserIdentities(p.mpid,v),t._Persistence.update(),t._Store.syncPersistenceData(),t._Persistence.findPrevCookiesBasedOnUI(o),t._Store.context=p.context||t._Store.context),y=t.Identity.getCurrentUser(),tryOnUserAlias(c,y,o,t.Logger);var A=t._Persistence.getPersistence();y&&(t._Persistence.storeDataInMemory(A,y.getMPID()),n.reinitForwardersOnUserChange(c,y),n.setForwarderCallbacks(y,d));var P=getNewIdentitiesByName(v),U=d===Modify$1?_:b;// https://go.mparticle.com/work/SQDSDKS-6501
908
+ n.sendUserIdentityChangeEvent(P,d,p.mpid,U);}if(a){var C=0===r.status?HTTPCodes$2.noHttpCoverage:r.status;t._Helpers.invokeCallback(a,C,p||null,y);}else p&&!isEmpty(p.errors)&&// https://go.mparticle.com/work/SQDSDKS-6500
909
909
  t.Logger.error("Received HTTP response code of "+r.status+" - "+p.errors[0].message);t.Logger.verbose("Successfully parsed Identity Response"),t._APIClient.processQueuedEvents();}catch(s){a&&t._Helpers.invokeCallback(a,r.status,p||null),t.Logger.error("Error parsing JSON response from Identity server: "+s);}},this.sendUserIdentityChangeEvent=function(e,r,s,i){if(s||r===Modify$1)// https://go.mparticle.com/work/SQDSDKS-6501
910
910
  {// https://go.mparticle.com/work/SQDSDKS-6354
911
- var a=this.IdentityAPI.getUser(s);for(var d in e)// Verifies a change actually happened
912
- if(i[d]!==e[d]){// If a new identity type was introduced when the identity changes
911
+ var a=this.IdentityAPI.getUser(s);for(var o in e)// Verifies a change actually happened
912
+ if(i[o]!==e[o]){// If a new identity type was introduced when the identity changes
913
913
  // we need to notify the server so that the user profile is updated in
914
914
  // the mParticle UI.
915
- var o=!i[d],g=n.createUserIdentityChange(d,e[d],i[d],o,a);t._APIClient.sendEventToServer(g);}}},this.createUserIdentityChange=function(e,r,s,i,n){var a;// https://go.mparticle.com/work/SQDSDKS-6439
916
- return a=t._ServerModel.createEventObject({messageType:Types.MessageType.UserIdentityChange,userIdentityChanges:{New:{IdentityType:e,Identity:r,CreatedThisBatch:i},Old:{IdentityType:e,Identity:s,CreatedThisBatch:!1}},userInMemory:n}),a},this.sendUserAttributeChangeEvent=function(e,r,s,i,a,d){var o=n.createUserAttributeChange(e,r,s,i,a,d);o&&t._APIClient.sendEventToServer(o);},this.createUserAttributeChange=function(e,r,s,i,n,a){"undefined"==typeof s&&(s=null);var d;return r!==s&&(d=t._ServerModel.createEventObject({messageType:Types.MessageType.UserAttributeChange,userAttributeChanges:{UserAttributeName:e,New:r,Old:s,Deleted:n,IsNewAttribute:i}},a)),d},this.reinitForwardersOnUserChange=function(e,r){hasMPIDAndUserLoginChanged(e,r)&&t._Forwarders.initForwarders(r.getUserIdentities().userIdentities,t._APIClient.prepareForwardingStats);},this.setForwarderCallbacks=function(e,r){// https://go.mparticle.com/work/SQDSDKS-6036
915
+ var d=!i[o],g=n.createUserIdentityChange(o,e[o],i[o],d,a);t._APIClient.sendEventToServer(g);}}},this.createUserIdentityChange=function(e,r,s,i,n){var a;// https://go.mparticle.com/work/SQDSDKS-6439
916
+ return a=t._ServerModel.createEventObject({messageType:Types.MessageType.UserIdentityChange,userIdentityChanges:{New:{IdentityType:e,Identity:r,CreatedThisBatch:i},Old:{IdentityType:e,Identity:s,CreatedThisBatch:!1}},userInMemory:n}),a},this.sendUserAttributeChangeEvent=function(e,r,s,i,a,o){var d=n.createUserAttributeChange(e,r,s,i,a,o);d&&t._APIClient.sendEventToServer(d);},this.createUserAttributeChange=function(e,r,s,i,n,a){"undefined"==typeof s&&(s=null);var o;return r!==s&&(o=t._ServerModel.createEventObject({messageType:Types.MessageType.UserAttributeChange,userAttributeChanges:{UserAttributeName:e,New:r,Old:s,Deleted:n,IsNewAttribute:i}},a)),o},this.reinitForwardersOnUserChange=function(e,r){hasMPIDAndUserLoginChanged(e,r)&&t._Forwarders.initForwarders(r.getUserIdentities().userIdentities,t._APIClient.prepareForwardingStats);},this.setForwarderCallbacks=function(e,r){// https://go.mparticle.com/work/SQDSDKS-6036
917
917
  t._Forwarders.setForwarderUserIdentities(e.getUserIdentities().userIdentities),t._Forwarders.setForwarderOnIdentityComplete(e,r),t._Forwarders.setForwarderOnUserIdentified(e);};}// https://go.mparticle.com/work/SQDSDKS-6359
918
918
  function tryOnUserAlias(e,t,r,s){if(r&&r.onUserAlias&&isFunction(r.onUserAlias))try{s.warning(generateDeprecationMessage("onUserAlias")),r.onUserAlias(e,t);}catch(t){s.error("There was an error with your onUserAlias function - "+t);}}
919
919
 
package/dist/mparticle.js CHANGED
@@ -393,7 +393,7 @@ var mParticle = (function () {
393
393
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
394
394
  };
395
395
 
396
- var version = "2.26.9";
396
+ var version = "2.26.10";
397
397
 
398
398
  var Constants = {
399
399
  sdkVersion: version,
@@ -4153,6 +4153,12 @@ var mParticle = (function () {
4153
4153
  this.setUserAttributes = function (mpid, userAttributes) {
4154
4154
  return _this._setPersistence(mpid, 'ua', userAttributes);
4155
4155
  };
4156
+ this.getUserIdentities = function (mpid) {
4157
+ return _this._getFromPersistence(mpid, 'ui') || {};
4158
+ };
4159
+ this.setUserIdentities = function (mpid, userIdentities) {
4160
+ _this._setPersistence(mpid, 'ui', userIdentities);
4161
+ };
4156
4162
  this.addMpidToSessionHistory = function (mpid, previousMPID) {
4157
4163
  var indexOfMPID = _this.currentSessionMPIDs.indexOf(mpid);
4158
4164
  if (mpid && previousMPID !== mpid && indexOfMPID < 0) {
@@ -4943,14 +4949,6 @@ var mParticle = (function () {
4943
4949
  }
4944
4950
  return '';
4945
4951
  };
4946
- this.getUserIdentities = function (mpid) {
4947
- var persistence = self.getPersistence();
4948
- if (persistence && persistence[mpid] && persistence[mpid].ui) {
4949
- return persistence[mpid].ui;
4950
- } else {
4951
- return {};
4952
- }
4953
- };
4954
4952
  this.getCartProducts = function (mpid) {
4955
4953
  var allCartProducts,
4956
4954
  cartProductsString = localStorage.getItem(mpInstance._Store.prodStorageName);
@@ -4972,21 +4970,6 @@ var mParticle = (function () {
4972
4970
  mpInstance.Logger.error('Error with setting products on localStorage.');
4973
4971
  }
4974
4972
  };
4975
- this.saveUserIdentitiesToPersistence = function (mpid, userIdentities) {
4976
- if (userIdentities) {
4977
- var persistence = self.getPersistence();
4978
- if (persistence) {
4979
- if (persistence[mpid]) {
4980
- persistence[mpid].ui = userIdentities;
4981
- } else {
4982
- persistence[mpid] = {
4983
- ui: userIdentities
4984
- };
4985
- }
4986
- self.savePersistence(persistence);
4987
- }
4988
- }
4989
- };
4990
4973
  this.saveUserCookieSyncDatesToPersistence = function (mpid, csd) {
4991
4974
  if (csd) {
4992
4975
  var persistence = self.getPersistence();
@@ -5420,7 +5403,7 @@ var mParticle = (function () {
5420
5403
  return {
5421
5404
  getUserIdentities: function getUserIdentities() {
5422
5405
  var currentUserIdentities = {};
5423
- var identities = mpInstance._Persistence.getUserIdentities(mpid);
5406
+ var identities = mpInstance._Store.getUserIdentities(mpid);
5424
5407
  for (var identityType in identities) {
5425
5408
  if (identities.hasOwnProperty(identityType)) {
5426
5409
  var identityName = Types.IdentityType.getIdentityName(mpInstance._Helpers.parseNumber(identityType));
@@ -6986,7 +6969,7 @@ var mParticle = (function () {
6986
6969
  */
6987
6970
  getUserIdentities: function getUserIdentities() {
6988
6971
  var currentUserIdentities = {};
6989
- var identities = mpInstance._Persistence.getUserIdentities(mpid);
6972
+ var identities = mpInstance._Store.getUserIdentities(mpid);
6990
6973
  for (var identityType in identities) {
6991
6974
  if (identities.hasOwnProperty(identityType)) {
6992
6975
  currentUserIdentities[Types.IdentityType.getIdentityName(mpInstance._Helpers.parseNumber(identityType))] = identities[identityType];
@@ -7459,7 +7442,7 @@ var mParticle = (function () {
7459
7442
  var incomingUIByName = incomingUser ? incomingUser.getUserIdentities().userIdentities : {};
7460
7443
  if (method === Modify$1) {
7461
7444
  newIdentitiesByType = mpInstance._Identity.IdentityRequest.combineUserIdentities(previousUIByName, identityApiData.userIdentities);
7462
- mpInstance._Persistence.saveUserIdentitiesToPersistence(previousMPID, newIdentitiesByType);
7445
+ mpInstance._Store.setUserIdentities(previousMPID, newIdentitiesByType);
7463
7446
  } else {
7464
7447
  // https://go.mparticle.com/work/SQDSDKS-6356
7465
7448
  //this covers an edge case where, users stored before "firstSeenTime" was introduced
@@ -7477,7 +7460,7 @@ var mParticle = (function () {
7477
7460
  }
7478
7461
 
7479
7462
  // https://go.mparticle.com/work/SQDSDKS-6041
7480
- mpInstance._Persistence.saveUserIdentitiesToPersistence(identityApiResult.mpid, newIdentitiesByType);
7463
+ mpInstance._Store.setUserIdentities(identityApiResult.mpid, newIdentitiesByType);
7481
7464
  mpInstance._Persistence.update();
7482
7465
  mpInstance._Store.syncPersistenceData();
7483
7466
  mpInstance._Persistence.findPrevCookiesBasedOnUI(identityApiData);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mparticle/web-sdk",
3
- "version": "2.26.9",
3
+ "version": "2.26.10",
4
4
  "description": "mParticle core SDK for web applications",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [
@@ -10,7 +10,7 @@ export default function filteredMparticleUser(
10
10
  return {
11
11
  getUserIdentities: function() {
12
12
  var currentUserIdentities = {};
13
- var identities = mpInstance._Persistence.getUserIdentities(mpid);
13
+ var identities = mpInstance._Store.getUserIdentities(mpid);
14
14
 
15
15
  for (var identityType in identities) {
16
16
  if (identities.hasOwnProperty(identityType)) {
package/src/identity.js CHANGED
@@ -806,11 +806,8 @@ export default function Identity(mpInstance) {
806
806
  * @return {Object} an object with userIdentities as its key
807
807
  */
808
808
  getUserIdentities: function() {
809
- var currentUserIdentities = {};
810
-
811
- var identities = mpInstance._Persistence.getUserIdentities(
812
- mpid
813
- );
809
+ const currentUserIdentities = {};
810
+ const identities = mpInstance._Store.getUserIdentities(mpid);
814
811
 
815
812
  for (var identityType in identities) {
816
813
  if (identities.hasOwnProperty(identityType)) {
@@ -1541,7 +1538,7 @@ export default function Identity(mpInstance) {
1541
1538
  identityApiData.userIdentities
1542
1539
  );
1543
1540
 
1544
- mpInstance._Persistence.saveUserIdentitiesToPersistence(
1541
+ mpInstance._Store.setUserIdentities(
1545
1542
  previousMPID,
1546
1543
  newIdentitiesByType
1547
1544
  );
@@ -1589,7 +1586,7 @@ export default function Identity(mpInstance) {
1589
1586
  }
1590
1587
 
1591
1588
  // https://go.mparticle.com/work/SQDSDKS-6041
1592
- mpInstance._Persistence.saveUserIdentitiesToPersistence(
1589
+ mpInstance._Store.setUserIdentities(
1593
1590
  identityApiResult.mpid,
1594
1591
  newIdentitiesByType
1595
1592
  );
@@ -1,6 +1,5 @@
1
1
  import { Context } from '@mparticle/event-models';
2
2
  import {
3
- AllUserAttributes,
4
3
  IdentityApiData,
5
4
  MPID,
6
5
  Product,
@@ -120,13 +119,8 @@ export interface IPersistence {
120
119
  decodePersistence(persistenceString: string): string;
121
120
  getCookieDomain(): string;
122
121
  getDomain(doc: string, locationHostname: string): string;
123
- getUserIdentities(mpid: MPID): UserIdentities;
124
122
  getCartProducts(mpid: MPID): Product[];
125
123
  setCartProducts(allProducts: Product[]): void;
126
- saveUserIdentitiesToPersistence(
127
- mpid: MPID,
128
- userIdentities: UserIdentities
129
- ): void;
130
124
  saveUserCookieSyncDatesToPersistence(mpid: MPID, csd: CookieSyncDate): void;
131
125
  savePersistence(persistance: IPersistenceMinified): void;
132
126
  getPersistence(): IPersistenceMinified;
@@ -882,16 +882,6 @@ export default function _Persistence(mpInstance) {
882
882
  return '';
883
883
  };
884
884
 
885
- this.getUserIdentities = function(mpid) {
886
- var persistence = self.getPersistence();
887
-
888
- if (persistence && persistence[mpid] && persistence[mpid].ui) {
889
- return persistence[mpid].ui;
890
- } else {
891
- return {};
892
- }
893
- };
894
-
895
885
  this.getCartProducts = function(mpid) {
896
886
  var allCartProducts,
897
887
  cartProductsString = localStorage.getItem(
@@ -928,22 +918,6 @@ export default function _Persistence(mpInstance) {
928
918
  }
929
919
  };
930
920
 
931
- this.saveUserIdentitiesToPersistence = function(mpid, userIdentities) {
932
- if (userIdentities) {
933
- var persistence = self.getPersistence();
934
- if (persistence) {
935
- if (persistence[mpid]) {
936
- persistence[mpid].ui = userIdentities;
937
- } else {
938
- persistence[mpid] = {
939
- ui: userIdentities,
940
- };
941
- }
942
- self.savePersistence(persistence);
943
- }
944
- }
945
- };
946
-
947
921
  this.saveUserCookieSyncDatesToPersistence = function(mpid, csd) {
948
922
  if (csd) {
949
923
  var persistence = self.getPersistence();
package/src/store.ts CHANGED
@@ -5,6 +5,7 @@ import {
5
5
  IdentifyRequest,
6
6
  SDKEventCustomFlags,
7
7
  ConsentState,
8
+ UserIdentities,
8
9
  } from '@mparticle/web-sdk';
9
10
  import { IKitConfigs } from './configAPIClient';
10
11
  import Constants from './constants';
@@ -197,6 +198,8 @@ export interface IStore {
197
198
  setLastSeenTime?(mpid: MPID, time?: number): void;
198
199
  getUserAttributes?(mpid: MPID): UserAttributes;
199
200
  setUserAttributes?(mpid: MPID, attributes: UserAttributes): void;
201
+ getUserIdentities?(mpid: MPID): UserIdentities;
202
+ setUserIdentities?(mpid: MPID, userIdentities: UserIdentities): void;
200
203
 
201
204
  addMpidToSessionHistory?(mpid: MPID, previousMpid?: MPID): void;
202
205
  hasInvalidIdentifyRequest?: () => boolean;
@@ -530,15 +533,13 @@ export default function Store(
530
533
  isEmpty(identifyRequest.userIdentities)) ||
531
534
  !identifyRequest
532
535
  );
533
- }
534
-
535
-
536
+ };
536
537
 
537
538
  this.getConsentState = (mpid: MPID): ConsentState => {
538
539
  const {
539
540
  fromMinifiedJsonObject,
540
541
  } = mpInstance._Consent.ConsentSerialization;
541
-
542
+
542
543
  const serializedConsentState = this._getFromPersistence<
543
544
  IMinifiedConsentJSONObject
544
545
  >(mpid, 'con');
@@ -627,6 +628,13 @@ export default function Store(
627
628
  userAttributes: UserAttributes
628
629
  ): void => this._setPersistence(mpid, 'ua', userAttributes);
629
630
 
631
+ this.getUserIdentities = (mpid: MPID): UserIdentities =>
632
+ this._getFromPersistence(mpid, 'ui') || {};
633
+
634
+ this.setUserIdentities = (mpid: MPID, userIdentities: UserIdentities) => {
635
+ this._setPersistence(mpid, 'ui', userIdentities);
636
+ };
637
+
630
638
  this.addMpidToSessionHistory = (mpid: MPID, previousMPID?: MPID): void => {
631
639
  const indexOfMPID = this.currentSessionMPIDs.indexOf(mpid);
632
640