@mparticle/web-sdk 2.66.0 → 2.68.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,7 +15,7 @@ map:function map(a,b){var c,d,e;if(null===this)throw new TypeError(" this is nul
15
15
  filter:function filter(a/*, thisArg*/){if(void 0===this||null===this)throw new TypeError;var b=Object(this),c=b.length>>>0;if("function"!=typeof a)throw new TypeError;for(var d=[],e=2<=arguments.length?arguments[1]:void 0,f=0;f<c;f++)if(f in b){var g=b[f];a.call(e,g,f,b)&&d.push(g);}return d},// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray
16
16
  isArray:function isArray(a){return "[object Array]"===Object.prototype.toString.call(a)},Base64:Base64$1};
17
17
 
18
- var version = "2.66.0";
18
+ var version = "2.68.0";
19
19
 
20
20
  var Constants={sdkVersion:version,sdkVendor:"mparticle",platform:"web",Messages:{DeprecationMessages:{MethodHasBeenDeprecated:"has been deprecated.",MethodMarkedForDeprecationPostfix:"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
21
21
  },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/"},// These are the paths that are used to construct the CNAME urls
@@ -31,7 +31,7 @@ CaptureIntegrationSpecificIdsV2:"captureIntegrationSpecificIds.V2",AstBackground
31
31
  // launcherOptions.noTargeting. Server-side systems use this attribute
32
32
  // to exclude the user from retargeting audiences.
33
33
  var NO_TARGETING_ATTRIBUTE="$NoTargeting";// https://developer.mozilla.org/en-US/docs/Web/HTTP/Status
34
- var HTTP_OK=200;var HTTP_ACCEPTED=202;var HTTP_BAD_REQUEST=400;var HTTP_SERVER_ERROR=500;
34
+ var HTTP_OK=200;var HTTP_ACCEPTED=202;var HTTP_BAD_REQUEST=400;var HTTP_NOT_FOUND=404;var HTTP_SERVER_ERROR=500;
35
35
 
36
36
  function _typeof$1(o) {
37
37
  "@babel/helpers - typeof";
@@ -138,7 +138,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
138
138
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
139
139
  };
140
140
 
141
- var Messages$9=Constants.Messages,createCookieString=function(a){return replaceCommasWithPipes(replaceQuotesWithApostrophes(a))},revertCookieString=function(a){return replacePipesWithCommas(replaceApostrophesWithQuotes(a))},inArray=function(a,b){if(!a)return !1;var c=0;if(Array.prototype.indexOf)return 0<=a.indexOf(b,0);for(var d=a.length;c<d;c++)if(c in a&&a[c]===b)return !0;return !1},findKeyInObject=function(a,b){if(b&&a)for(var c in a)if(a.hasOwnProperty(c)&&c.toLowerCase()===b.toLowerCase())return c;return null},generateDeprecationMessage=function(a,b,c,d){var e=[a];return b?e.push(Messages$9.DeprecationMessages.MethodHasBeenDeprecated):e.push(Messages$9.DeprecationMessages.MethodMarkedForDeprecationPostfix),c&&(e.push(Messages$9.DeprecationMessages.AlternativeMethodPrefix),e.push(c+".")),d&&e.push("See - "+d),e.join(" ")};function generateHash(a){var b,c=0;if(void 0===a||null===a)return 0;if(a=a.toString().toLowerCase(),Array.prototype.reduce)return a.split("").reduce(function(c,d){return c=(c<<5)-c+d.charCodeAt(0),c&c},0);if(0===a.length)return c;for(var d=0;d<a.length;d++)b=a.charCodeAt(d),c=(c<<5)-c+b,c&=c;return c}var generateRandomValue=function(){var b,c;return window.crypto&&window.crypto.getRandomValues&&(b=window.crypto.getRandomValues(new Uint8Array(1))),b?(c^b[0]%16>>c/4).toString(16):(c^16*Math.random()>>c/4).toString(16)},generateUniqueId=function(b){return void 0===b&&(b=""),b// if the placeholder was passed, return
141
+ var Messages$a=Constants.Messages,createCookieString=function(a){return replaceCommasWithPipes(replaceQuotesWithApostrophes(a))},revertCookieString=function(a){return replacePipesWithCommas(replaceApostrophesWithQuotes(a))},inArray=function(a,b){if(!a)return !1;var c=0;if(Array.prototype.indexOf)return 0<=a.indexOf(b,0);for(var d=a.length;c<d;c++)if(c in a&&a[c]===b)return !0;return !1},findKeyInObject=function(a,b){if(b&&a)for(var c in a)if(a.hasOwnProperty(c)&&c.toLowerCase()===b.toLowerCase())return c;return null},generateDeprecationMessage=function(a,b,c,d){var e=[a];return b?e.push(Messages$a.DeprecationMessages.MethodHasBeenDeprecated):e.push(Messages$a.DeprecationMessages.MethodMarkedForDeprecationPostfix),c&&(e.push(Messages$a.DeprecationMessages.AlternativeMethodPrefix),e.push(c+".")),d&&e.push("See - "+d),e.join(" ")};function generateHash(a){var b,c=0;if(void 0===a||null===a)return 0;if(a=a.toString().toLowerCase(),Array.prototype.reduce)return a.split("").reduce(function(c,d){return c=(c<<5)-c+d.charCodeAt(0),c&c},0);if(0===a.length)return c;for(var d=0;d<a.length;d++)b=a.charCodeAt(d),c=(c<<5)-c+b,c&=c;return c}var generateRandomValue=function(){var b,c;return window.crypto&&window.crypto.getRandomValues&&(b=window.crypto.getRandomValues(new Uint8Array(1))),b?(c^b[0]%16>>c/4).toString(16):(c^16*Math.random()>>c/4).toString(16)},generateUniqueId=function(b){return void 0===b&&(b=""),b// if the placeholder was passed, return
142
142
  ?generateRandomValue()// if the placeholder was passed, return
143
143
  :// [1e7] -> // 10000000 +
144
144
  // -1e3 -> // -1000 +
@@ -197,7 +197,7 @@ function extend(){for(var a=[],b=0;b<arguments.length;b++)a[b]=arguments[b];var
197
197
  return b===void 0||j.hasOwn.call(a,b)},isArray:Array.isArray||function(a){return "array"===j.type(a)},isFunction:function(a){return "function"===j.type(a)},isWindow:function isWindow(a){return null!=a&&a==a.window}},k=a[0]||{},l=1,m=!1,n=a.length;for("boolean"==typeof k&&(m=k,k=a[1]||{},l=2),"object"===_typeof$1(k)||j.isFunction(k)||(k={}),n===l&&(k={},--l);l<n;l++)if(null!=(c=a[l]))for(d in c)"__proto__"!==d&&"constructor"!==d&&"prototype"!==d&&Object.prototype.hasOwnProperty.call(c,d)&&(e=k[d],f=c[d],k!==f)&&(m&&f&&(j.isPlainObject(f)||(g=j.isArray(f)))?(g?(g=!1,h=e&&j.isArray(e)?e:[]):h=e&&j.isPlainObject(e)?e:{},k[d]=extend(m,h,f)):void 0!==f&&(k[d]=f));return k}
198
198
 
199
199
  var MessageType$1={SessionStart:1,SessionEnd:2,PageView:3,PageEvent:4,CrashReport:5,OptOut:6,AppStateTransition:10,Profile:14,Commerce:16,Media:20,UserAttributeChange:17,UserIdentityChange:18};var EventType={Unknown:0,Navigation:1,Location:2,Search:3,Transaction:4,UserContent:5,UserPreference:6,Social:7,Other:8,Media:9,getName:function getName(a){return a===EventType.Unknown?"Unknown":a===EventType.Navigation?"Navigation":a===EventType.Location?"Location":a===EventType.Search?"Search":a===EventType.Transaction?"Transaction":a===EventType.UserContent?"User Content":a===EventType.UserPreference?"User Preference":a===EventType.Social?"Social":a===CommerceEventType.ProductAddToCart?"Product Added to Cart":a===CommerceEventType.ProductAddToWishlist?"Product Added to Wishlist":a===CommerceEventType.ProductCheckout?"Product Checkout":a===CommerceEventType.ProductCheckoutOption?"Product Checkout Options":a===CommerceEventType.ProductClick?"Product Click":a===CommerceEventType.ProductImpression?"Product Impression":a===CommerceEventType.ProductPurchase?"Product Purchased":a===CommerceEventType.ProductRefund?"Product Refunded":a===CommerceEventType.ProductRemoveFromCart?"Product Removed From Cart":a===CommerceEventType.ProductRemoveFromWishlist?"Product Removed from Wishlist":a===CommerceEventType.ProductViewDetail?"Product View Details":a===CommerceEventType.PromotionClick?"Promotion Click":a===CommerceEventType.PromotionView?"Promotion View":"Other"}};// Continuation of EventType enum above, but in seperate object since we don't expose these to end user
200
- var CommerceEventType={ProductAddToCart:10,ProductRemoveFromCart:11,ProductCheckout:12,ProductCheckoutOption:13,ProductClick:14,ProductViewDetail:15,ProductPurchase:16,ProductRefund:17,PromotionView:18,PromotionClick:19,ProductAddToWishlist:20,ProductRemoveFromWishlist:21,ProductImpression:22};var IdentityType={Other:0,CustomerId:1,Facebook:2,Twitter:3,Google:4,Microsoft:5,Yahoo:6,Email:7,FacebookCustomAudienceId:9,Other2:10,Other3:11,Other4:12,Other5:13,Other6:14,Other7:15,Other8:16,Other9:17,Other10:18,MobileNumber:19,PhoneNumber2:20,PhoneNumber3:21,isValid:function isValid(a){if("number"==typeof a)for(var b in IdentityType)if(IdentityType.hasOwnProperty(b)&&IdentityType[b]===a)return !0;return !1},getName:function getName(a){return a===window.mParticle.IdentityType.CustomerId?"Customer ID":a===window.mParticle.IdentityType.Facebook?"Facebook ID":a===window.mParticle.IdentityType.Twitter?"Twitter ID":a===window.mParticle.IdentityType.Google?"Google ID":a===window.mParticle.IdentityType.Microsoft?"Microsoft ID":a===window.mParticle.IdentityType.Yahoo?"Yahoo ID":a===window.mParticle.IdentityType.Email?"Email":a===window.mParticle.IdentityType.FacebookCustomAudienceId?"Facebook App User ID":"Other ID"},getIdentityType:function getIdentityType(a){return "other"===a?IdentityType.Other:"customerid"===a?IdentityType.CustomerId:"facebook"===a?IdentityType.Facebook:"twitter"===a?IdentityType.Twitter:"google"===a?IdentityType.Google:"microsoft"===a?IdentityType.Microsoft:"yahoo"===a?IdentityType.Yahoo:"email"===a?IdentityType.Email:"facebookcustomaudienceid"===a?IdentityType.FacebookCustomAudienceId:"other2"===a?IdentityType.Other2:"other3"===a?IdentityType.Other3:"other4"===a?IdentityType.Other4:"other5"===a?IdentityType.Other5:"other6"===a?IdentityType.Other6:"other7"===a?IdentityType.Other7:"other8"===a?IdentityType.Other8:"other9"===a?IdentityType.Other9:"other10"===a?IdentityType.Other10:"mobile_number"===a?IdentityType.MobileNumber:"phone_number_2"===a?IdentityType.PhoneNumber2:!("phone_number_3"!=a)&&IdentityType.PhoneNumber3},getIdentityName:function getIdentityName(a){return a===IdentityType.Other?"other":a===IdentityType.CustomerId?"customerid":a===IdentityType.Facebook?"facebook":a===IdentityType.Twitter?"twitter":a===IdentityType.Google?"google":a===IdentityType.Microsoft?"microsoft":a===IdentityType.Yahoo?"yahoo":a===IdentityType.Email?"email":a===IdentityType.FacebookCustomAudienceId?"facebookcustomaudienceid":a===IdentityType.Other2?"other2":a===IdentityType.Other3?"other3":a===IdentityType.Other4?"other4":a===IdentityType.Other5?"other5":a===IdentityType.Other6?"other6":a===IdentityType.Other7?"other7":a===IdentityType.Other8?"other8":a===IdentityType.Other9?"other9":a===IdentityType.Other10?"other10":a===IdentityType.MobileNumber?"mobile_number":a===IdentityType.PhoneNumber2?"phone_number_2":a===IdentityType.PhoneNumber3?"phone_number_3":null},// Strips out functions from Identity Types for easier lookups
200
+ var CommerceEventType={ProductAddToCart:10,ProductRemoveFromCart:11,ProductCheckout:12,ProductCheckoutOption:13,ProductClick:14,ProductViewDetail:15,ProductPurchase:16,ProductRefund:17,PromotionView:18,PromotionClick:19,ProductAddToWishlist:20,ProductRemoveFromWishlist:21,ProductImpression:22};var IdentityType={Other:0,CustomerId:1,Facebook:2,Twitter:3,Google:4,Microsoft:5,Yahoo:6,Email:7,FacebookCustomAudienceId:9,Other2:10,Other3:11,Other4:12,Other5:13,Other6:14,Other7:15,Other8:16,Other9:17,Other10:18,MobileNumber:19,PhoneNumber2:20,PhoneNumber3:21,isValid:function isValid(a){if("number"==typeof a)for(var b in IdentityType)if(IdentityType.hasOwnProperty(b)&&IdentityType[b]===a)return !0;return !1},getName:function getName(a){return a===window.mParticle.IdentityType.CustomerId?"Customer ID":a===window.mParticle.IdentityType.Facebook?"Facebook ID":a===window.mParticle.IdentityType.Twitter?"Twitter ID":a===window.mParticle.IdentityType.Google?"Google ID":a===window.mParticle.IdentityType.Microsoft?"Microsoft ID":a===window.mParticle.IdentityType.Yahoo?"Yahoo ID":a===window.mParticle.IdentityType.Email?"Email":a===window.mParticle.IdentityType.FacebookCustomAudienceId?"Facebook App User ID":"Other ID"},getIdentityType:function getIdentityType(a){return "other"===a?IdentityType.Other:"customerid"===a?IdentityType.CustomerId:"facebook"===a?IdentityType.Facebook:"twitter"===a?IdentityType.Twitter:"google"===a?IdentityType.Google:"microsoft"===a?IdentityType.Microsoft:"yahoo"===a?IdentityType.Yahoo:"email"===a?IdentityType.Email:"facebookcustomaudienceid"===a?IdentityType.FacebookCustomAudienceId:"other2"===a?IdentityType.Other2:"other3"===a?IdentityType.Other3:"other4"===a?IdentityType.Other4:"other5"===a?IdentityType.Other5:"other6"===a?IdentityType.Other6:"other7"===a?IdentityType.Other7:"other8"===a?IdentityType.Other8:"other9"===a?IdentityType.Other9:"other10"===a?IdentityType.Other10:"mobile_number"===a?IdentityType.MobileNumber:"phone_number_2"===a?IdentityType.PhoneNumber2:"phone_number_3"===a?IdentityType.PhoneNumber3:"email_sha256"===a?IdentityType.Other:!("mobile_sha256"!=a)&&IdentityType.Other2},getIdentityName:function getIdentityName(a){return a===IdentityType.Other?"other":a===IdentityType.CustomerId?"customerid":a===IdentityType.Facebook?"facebook":a===IdentityType.Twitter?"twitter":a===IdentityType.Google?"google":a===IdentityType.Microsoft?"microsoft":a===IdentityType.Yahoo?"yahoo":a===IdentityType.Email?"email":a===IdentityType.FacebookCustomAudienceId?"facebookcustomaudienceid":a===IdentityType.Other2?"other2":a===IdentityType.Other3?"other3":a===IdentityType.Other4?"other4":a===IdentityType.Other5?"other5":a===IdentityType.Other6?"other6":a===IdentityType.Other7?"other7":a===IdentityType.Other8?"other8":a===IdentityType.Other9?"other9":a===IdentityType.Other10?"other10":a===IdentityType.MobileNumber?"mobile_number":a===IdentityType.PhoneNumber2?"phone_number_2":a===IdentityType.PhoneNumber3?"phone_number_3":null},// Strips out functions from Identity Types for easier lookups
201
201
  getValuesAsStrings:function getValuesAsStrings(){return Object.values(IdentityType).map(function(a){return isNumber(a)?a.toString():void 0}).filter(function(a){return a!==void 0})},getNewIdentitiesByName:function getNewIdentitiesByName(a){var b={},c=IdentityType.getValuesAsStrings();for(var d in a)// IdentityTypes are stored as numbers but are passed in as strings
202
202
  if(c.includes(d)){var e=IdentityType.getIdentityName(parseNumber(d));b[e]=a[d];}return b}};var ProductActionType={Unknown:0,AddToCart:1,RemoveFromCart:2,Checkout:3,CheckoutOption:4,Click:5,ViewDetail:6,Purchase:7,Refund:8,AddToWishlist:9,RemoveFromWishlist:10,getName:function getName(a){return a===ProductActionType.AddToCart?"Add to Cart":a===ProductActionType.RemoveFromCart?"Remove from Cart":a===ProductActionType.Checkout?"Checkout":a===ProductActionType.CheckoutOption?"Checkout Option":a===ProductActionType.Click?"Click":a===ProductActionType.ViewDetail?"View Detail":a===ProductActionType.Purchase?"Purchase":a===ProductActionType.Refund?"Refund":a===ProductActionType.AddToWishlist?"Add to Wishlist":a===ProductActionType.RemoveFromWishlist?"Remove from Wishlist":"Unknown"},// these are the action names used by server and mobile SDKs when expanding a CommerceEvent
203
203
  getExpansionName:function getExpansionName(a){return a===ProductActionType.AddToCart?"add_to_cart":a===ProductActionType.RemoveFromCart?"remove_from_cart":a===ProductActionType.Checkout?"checkout":a===ProductActionType.CheckoutOption?"checkout_option":a===ProductActionType.Click?"click":a===ProductActionType.ViewDetail?"view_detail":a===ProductActionType.Purchase?"purchase":a===ProductActionType.Refund?"refund":a===ProductActionType.AddToWishlist?"add_to_wishlist":a===ProductActionType.RemoveFromWishlist?"remove_from_wishlist":"unknown"}};var PromotionActionType={Unknown:0,PromotionView:1,PromotionClick:2,getName:function getName(a){return a===PromotionActionType.PromotionView?"view":a===PromotionActionType.PromotionClick?"click":"unknown"},// these are the names that the server and mobile SDKs use while expanding CommerceEvent
@@ -508,9 +508,41 @@ if(d=h[g],!d.MPID){var i=b.getMPID();d.MPID=i;}var j=f.get(d.MPID);j||(j=[]),j.p
508
508
  return this.mpInstance.Logger.error("HTTP error status ".concat(j.status," received")),[2/*return*/,d.slice(f,d.length)];if(401<=j.status)//if we're getting a 401, assume we'll keep getting a 401 and clear the uploads.
509
509
  return this.mpInstance.Logger.error("HTTP error status ".concat(j.status," while uploading - please verify your API key.")),[2/*return*/,null];throw console.error("HTTP error status ".concat(j.status," while uploading events."),j),new Error("Uncaught HTTP Error ".concat(j.status,". Batch upload will be re-attempted."))}return [3/*break*/,5];case 4:return k=i.sent(),this.mpInstance.Logger.error("Error sending event to mParticle servers. ".concat(k)),[2/*return*/,d.slice(f,d.length)];case 5:return f++,[3/*break*/,1];case 6:return [2/*return*/,null]}})})},a.CONTENT_TYPE="text/plain;charset=UTF-8",a.MINIMUM_INTERVAL_MILLIS=500,a)}();
510
510
 
511
- var _a=Constants.IdentityMethods,Identify$2=_a.Identify,Modify$4=_a.Modify,Login$2=_a.Login,Logout$2=_a.Logout;var CACHE_HEADER="x-mp-max-age";var cacheOrClearIdCache=function(a,b,c,d,e){// when parsing a response that has already been cached, simply return instead of attempting another cache
511
+ var ErrorCodes={UNKNOWN_ERROR:"UNKNOWN_ERROR",UNHANDLED_EXCEPTION:"UNHANDLED_EXCEPTION",IDENTITY_REQUEST:"IDENTITY_REQUEST",IDENTITY_MISMATCH:"IDENTITY_MISMATCH",ROKT_KIT_ATTACHED:"ROKT_KIT_ATTACHED"};var WSDKErrorSeverity={ERROR:"ERROR",INFO:"INFO",WARNING:"WARNING"};
512
+
513
+ var Modify$4=Constants.IdentityMethods.Modify,Validators={// From ./utils
514
+ // Utility Functions for backwards compatability
515
+ isNumber:isNumber,isFunction:isFunction,isStringOrNumber:isStringOrNumber,// Validator Functions
516
+ isValidAttributeValue:isValidAttributeValue,// Validator Functions
517
+ // Neither null nor undefined can be a valid Key
518
+ isValidKeyValue:function isValidKeyValue(a){return !(!a||isObject(a)||Array.isArray(a)||this.isFunction(a))},removeFalsyIdentityValues:function removeFalsyIdentityValues(a,b){if(!a||!a.userIdentities)return a;var c={},d=__assign({},a.userIdentities);for(var e in a.userIdentities)if(a.userIdentities.hasOwnProperty(e)){var f=a.userIdentities[e];// Check if value is falsy (undefined, false, 0, '', etc.) but not null
519
+ null===f||f||(b.warning("Identity value for '".concat(e,"' is falsy (").concat(f,"). This value will be removed from the request.")),delete d[e]);}return c.userIdentities=d,c},validateIdentities:function validateIdentities(a,b){var c={userIdentities:1,onUserAlias:1,copyUserAttributes:1};if(a){if(b===Modify$4&&(isObject(a.userIdentities)&&!Object.keys(a.userIdentities).length||!isObject(a.userIdentities)))return {valid:!1,error:Constants.Messages.ValidationMessages.ModifyIdentityRequestUserIdentitiesPresent};for(var d in a)if(a.hasOwnProperty(d)){if(!c[d])return {valid:!1,error:Constants.Messages.ValidationMessages.IdentityRequesetInvalidKey};if("onUserAlias"===d&&!Validators.isFunction(a[d]))return {valid:!1,error:Constants.Messages.ValidationMessages.OnUserAliasType}}if(0===Object.keys(a).length)return {valid:!0};// identityApiData.userIdentities can't be undefined
520
+ if(void 0===a.userIdentities)return {valid:!1,error:Constants.Messages.ValidationMessages.UserIdentities};// identityApiData.userIdentities can be null, but if it isn't null or undefined (above conditional), it must be an object
521
+ if(null!==a.userIdentities&&!isObject(a.userIdentities))return {valid:!1,error:Constants.Messages.ValidationMessages.UserIdentities};if(isObject(a.userIdentities)&&Object.keys(a.userIdentities).length)for(var e in a.userIdentities)if(a.userIdentities.hasOwnProperty(e)){if(!1===Types.IdentityType.getIdentityType(e))return {valid:!1,error:Constants.Messages.ValidationMessages.UserIdentitiesInvalidKey};if("string"!=typeof a.userIdentities[e]&&null!==a.userIdentities[e])return {valid:!1,error:Constants.Messages.ValidationMessages.UserIdentitiesInvalidValues}}}return {valid:!0}}};
522
+
523
+ var HTTPCodes$4=Constants.HTTPCodes;/**
524
+ * Sends a POST to mParticle's IDSync Search endpoint and invokes `callback`
525
+ * with the HTTP status and parsed body.
526
+ *
527
+ * Defensive contract:
528
+ * - No identifier with a non-empty string value -> callback with
529
+ * `{ httpCode: noHttpCoverage }`, no network call.
530
+ * - Missing `apiKey` -> callback with `{ httpCode: noHttpCoverage }`,
531
+ * no network call.
532
+ * - Network/JSON-parse errors are caught and surfaced via the callback,
533
+ * never thrown. Network errors are also reported through the optional
534
+ * `errorReporter` so any registered IErrorReportingService can observe
535
+ * them (matches the pattern used by identifyRequest in identityApiClient).
536
+ */var sendSearchRequest=function(a,b,c,d,e,f,g,h){return __awaiter(void 0,void 0,void 0,function(){var i,j,k,l,m,n,o,p,r,s,t,u;return __generator(this,function(v){switch(v.label){case 0:// Validate the callback up front. If it isn't a function we have nowhere
537
+ // to deliver a result to, so log and bail out without invoking anything.
538
+ if(!isFunction(e))return f.error("search called without a callback function; skipping request."),[2/*return*/];// No usable identifier -> deliver httpCode: noHttpCoverage so callers
539
+ // waiting on the callback (e.g. to clear a loading state) don't hang.
540
+ if(i=function(a){try{e(a);}catch(a){f.error("Error invoking search callback: "+((null===a||void 0===a?void 0:a.message)||a+""));}},j=Validators.removeFalsyIdentityValues({userIdentities:null!==a&&void 0!==a?a:{}},f).userIdentities,!Object.values(null!==j&&void 0!==j?j:{}).some(function(a){return "string"==typeof a&&0<a.length}))return f.verbose("Identity search called with empty identifiers; skipping request."),i({httpCode:HTTPCodes$4.noHttpCoverage}),[2/*return*/];// No API key -> same: deliver noHttpCoverage rather than hanging.
541
+ if(!b)return f.verbose("search called without a workspace API key; skipping request."),i({httpCode:HTTPCodes$4.noHttpCoverage}),[2/*return*/];v.label=1;case 1:return v.trys.push([1,9,,10]),k=c(),l=__assign(__assign({},k),{known_identities:__assign({},j)}),m={method:"post",headers:{Accept:"application/json","Content-Type":"application/json","x-mp-key":b},body:JSON.stringify(l)},n=g||(window.fetch?new FetchUploader(d):new XHRUploader(d)),f.verbose("Sending search request to "+d),[4/*yield*/,n.upload(m,d)];case 2:if(o=v.sent(),p=void 0,!isFunction(o.json))return [3/*break*/,7];v.label=3;case 3:return v.trys.push([3,5,,6]),[4/*yield*/,o.json()];case 4:return p=v.sent(),[3/*break*/,6];case 5:return v.sent(),f.verbose("search response had no parseable JSON body."),[3/*break*/,6];case 6:return [3/*break*/,8];case 7:if(r=o,null===r||void 0===r?void 0:r.responseText)try{p=JSON.parse(r.responseText);}catch(a){f.verbose("search XHR response was not valid JSON.");}v.label=8;case 8:return o.status===HTTP_OK?f.verbose("search received 200 OK."):o.status===HTTP_NOT_FOUND?f.verbose("search received 404 (no match)."):f.verbose("search received non-success status "+o.status),i({httpCode:o.status,body:p}),[3/*break*/,10];case 9:return s=v.sent(),t=(null===s||void 0===s?void 0:s.message)||s+"",u="Error sending search request: "+t,f.error(u),null===h||void 0===h?void 0:h.report({message:u,code:ErrorCodes.IDENTITY_REQUEST,severity:WSDKErrorSeverity.ERROR}),i({httpCode:HTTPCodes$4.noHttpCoverage}),[3/*break*/,10];case 10:return [2/*return*/]}})})};
542
+
543
+ var _a=Constants.IdentityMethods,Identify$2=_a.Identify,Modify$3=_a.Modify,Login$2=_a.Login,Logout$2=_a.Logout,HTTPCodes$3=Constants.HTTPCodes,Messages$9=Constants.Messages;var CACHE_HEADER="x-mp-max-age";var cacheOrClearIdCache=function(a,b,c,d,e){// when parsing a response that has already been cached, simply return instead of attempting another cache
512
544
  if(!e){// default the expire timestamp to one day in milliseconds unless a header comes back
513
- var f=getExpireTimestamp(null===d||void 0===d?void 0:d.cacheMaxAge);a===Login$2||a===Identify$2?cacheIdentityRequest(a,b,f,c,d):a===Modify$4||a===Logout$2?c.purge():void 0;}};var cacheIdentityRequest=function(a,b,c,d,e){var f=e.responseText,g=e.status,h=d.retrieve()||{},i=concatenateIdentities(a,b),j=generateHash(i),k=f.mpid,l=f.is_logged_in;h[j]={responseText:JSON.stringify({mpid:k,is_logged_in:l}),status:g,expireTimestamp:c},d.store(h);};// We need to ensure that identities are concatenated in a deterministic way, so
545
+ var f=getExpireTimestamp(null===d||void 0===d?void 0:d.cacheMaxAge);a===Login$2||a===Identify$2?cacheIdentityRequest(a,b,f,c,d):a===Modify$3||a===Logout$2?c.purge():void 0;}};var cacheIdentityRequest=function(a,b,c,d,e){var f=e.responseText,g=e.status,h=d.retrieve()||{},i=concatenateIdentities(a,b),j=generateHash(i),k=f.mpid,l=f.is_logged_in;h[j]={responseText:JSON.stringify({mpid:k,is_logged_in:l}),status:g,expireTimestamp:c},d.store(h);};// We need to ensure that identities are concatenated in a deterministic way, so
514
546
  // we sort the identities based on their enum.
515
547
  // we create an array, set the user identity at the index of the user identity type
516
548
  var concatenateIdentities=function(a,b){var c="".concat(a,":").concat("device_application_stamp","=").concat(b.device_application_stamp,";"),d=Object.keys(b).length,e="";// set DAS first since it is not an official identity type
@@ -529,7 +561,11 @@ var g=d[f].expireTimestamp;return !(g<new Date().getTime())};var getCachedIdenti
529
561
  var createKnownIdentities=function(a,b){var c={};if(isObject(null===a||void 0===a?void 0:a.userIdentities))for(var d in a.userIdentities)c[d]=a.userIdentities[d];return c.device_application_stamp=b,c};var removeExpiredIdentityCacheDates=function(a){var b=a.retrieve()||{},c=new Date().getTime();// Iterate over the cache and remove any key/value pairs that are expired
530
562
  for(var d in b)b[d].expireTimestamp<c&&delete b[d];a.store(b);};var tryCacheIdentity=function(a,b,c,d,e,f,g){// https://go.mparticle.com/work/SQDSDKS-6095
531
563
  var h=hasValidCachedIdentity(g,a,b);// If Identity is cached, then immediately parse the identity response
532
- if(h){var i=getCachedIdentity(g,a,b);return c(i,d,e,f,g,a,!0),!0}return !1};var getExpireTimestamp=function(a){return void 0===a&&(a=ONE_DAY_IN_SECONDS),new Date().getTime()+a*MILLIS_IN_ONE_SEC},parseIdentityResponse=function(a){return a?JSON.parse(a):{}};var hasIdentityRequestChanged=function(a,b){if(!a||!(null!==b&&void 0!==b)||!b.userIdentities)return !1;var c=a.getUserIdentities().userIdentities,d=b.userIdentities;return JSON.stringify(c)!==JSON.stringify(d)};/**
564
+ if(h){var i=getCachedIdentity(g,a,b);return c(i,d,e,f,g,a,!0),!0}return !1};var getExpireTimestamp=function(a){return void 0===a&&(a=ONE_DAY_IN_SECONDS),new Date().getTime()+a*MILLIS_IN_ONE_SEC},parseIdentityResponse=function(a){return a?JSON.parse(a):{}},SHA256_IDENTITY_ALIASES={email_sha256:"other",mobile_sha256:"other2"};var normalizeUserIdentityKeys=function(a){var b=__assign({},a);return Object.keys(SHA256_IDENTITY_ALIASES).forEach(function(a){if(a in b){var c=b[a];delete b[a],b[SHA256_IDENTITY_ALIASES[a]]=c;}}),b};// Compare two identity objects by key and value, independent of
565
+ // object key insertion order. The two sides come from different sources
566
+ // (numeric IdentityType iteration vs. partner-provided / alias-normalized
567
+ // order)
568
+ var identitiesEqual=function(c,a){var b=Object.keys(null!==c&&void 0!==c?c:{}),d=Object.keys(null!==a&&void 0!==a?a:{});return !(b.length!==d.length)&&b.every(function(b){return c[b]===a[b]})};var hasIdentityRequestChanged=function(a,b){if(!a||!(null!==b&&void 0!==b)||!b.userIdentities)return !1;var c=a.getUserIdentities().userIdentities,d=normalizeUserIdentityKeys(b.userIdentities);return !identitiesEqual(c,d)};/**
533
569
  * Checks if deviceId or other user identifiers (like email) were explicitly provided
534
570
  * by the partner via config.deviceId or config.identifyRequest.userIdentities.
535
571
  * When noFunctional is true, then cookies are blocked, so the partner must explicitly
@@ -537,7 +573,20 @@ if(h){var i=getCachedIdentity(g,a,b);return c(i,d,e,f,g,a,!0),!0}return !1};var
537
573
  *
538
574
  * @param store - The SDK store (provides SDKConfig.deviceId and SDKConfig.identifyRequest.userIdentities)
539
575
  * @returns true if deviceId or other identifiers were explicitly provided in config, false otherwise
540
- */var hasExplicitIdentifier=function(a){var b,c,d,e=null===(c=null===(b=null===a||void 0===a?void 0:a.SDKConfig)||void 0===b?void 0:b.identifyRequest)||void 0===c?void 0:c.userIdentities;return !!(e&&isObject(e)&&!isEmpty(e)&&Object.values(e).some(Boolean))||!(!(null!==(d=null===a||void 0===a?void 0:a.SDKConfig)&&void 0!==d)||!d.deviceId)};
576
+ */var hasExplicitIdentifier=function(a){var b,c,d,e=null===(c=null===(b=null===a||void 0===a?void 0:a.SDKConfig)||void 0===b?void 0:b.identifyRequest)||void 0===c?void 0:c.userIdentities;return !!(e&&isObject(e)&&!isEmpty(e)&&Object.values(e).some(Boolean))||!(!(null!==(d=null===a||void 0===a?void 0:a.SDKConfig)&&void 0!==d)||!d.deviceId)};/**
577
+ * Builds the /v1/identify-style envelope (client_sdk, environment,
578
+ * request_id, request_timestamp_ms) used to correlate IDSync requests
579
+ * across endpoints. `known_identities` is omitted so the caller can
580
+ * fold in the search-specific identifiers alongside the envelope.
581
+ */var buildIdentitySearchEnvelope=function(a){return {client_sdk:{platform:Constants.platform,sdk_vendor:Constants.sdkVendor,sdk_version:Constants.sdkVersion},environment:a,request_id:generateUniqueId(),request_timestamp_ms:Date.now()}};/**
582
+ * Wires the SDK instance into `sendSearchRequest`: gates on `canLog`,
583
+ * builds the `/v1/search` URL and request envelope, and dispatches.
584
+ * Lives here so the SDK glue (URL building, opt-out gate, dispatcher
585
+ * plumbing) is type-checked instead of being expressed in plain JS.
586
+ */var executeSearchRequest=function(a,b,c,d){var e=a._Helpers,f=a._Store,g=a.Logger,h=a._ErrorReportingDispatcher,i=f.SDKConfig,j=i.identityUrl,k=i.isDevelopmentMode;if(!e.canLog()){if(g.verbose(Messages$9.InformationMessages.AbandonLogEvent),isFunction(d))try{d({httpCode:HTTPCodes$3.loggingDisabledOrMissingAPIKey});}catch(a){g.error("Error invoking search callback: "+((null===a||void 0===a?void 0:a.message)||a+""));}return}// The Search endpoint is colocated with /v1/identify under
587
+ // identityUrl, so we reuse the same service URL builder. We do
588
+ // NOT append the apiKey to the URL — auth is done via x-mp-key.
589
+ var l=e.createServiceUrl(j),m=k?"development":"production";sendSearchRequest(c,b,function(){return buildIdentitySearchEnvelope(m)},l+"search?cb=1",d,g,void 0,h);};
541
590
 
542
591
  function APIClient(a,b){this.uploader=null;var c=this;this.queueEventForBatchUpload=function(b){if(!this.uploader){// https://go.mparticle.com/work/SQDSDKS-6317
543
592
  var c=parseNumber(a._Helpers.getFeatureFlag(Constants.FeatureFlags.EventBatchingIntervalMillis));this.uploader=new BatchUploader(a,c);}// https://go.mparticle.com/work/SQDSDKS-6038
@@ -551,16 +600,6 @@ var d=function(c,d){var e,f=(null===(e=a._CookieConsentManager)||void 0===e?void
551
600
  if(!g||a._Store.requireDelay||!a._Store.configurationLoaded)return a.Logger.verbose("Event was added to eventQueue. eventQueue will be processed once a valid MPID is returned or there is no more integration imposed delay."),void a._Store.eventQueue.push(c);this.processQueuedEvents(),isEmpty(c)||(f.shouldUploadEvent&&this.queueEventForBatchUpload(c),c.EventName!==Types.MessageType.AppStateTransition+""&&(b&&b.kitBlockingEnabled&&(c=b.createBlockedEvent(c)),c&&!c.AlreadySentToForwarders&&a._Forwarders.sendEventToForwarders(c)));}// https://go.mparticle.com/work/SQDSDKS-6038
552
601
  },this.sendBatchForwardingStatsToServer=function(b,c){var d,e;try{d=a._Helpers.createServiceUrl(a._Store.SDKConfig.v2SecureServiceUrl,a._Store.devToken),e={uuid:a._Helpers.generateUniqueId(),data:b},c&&(c.open("post",d+"/Forwarding"),c.send(JSON.stringify(e)));}catch(b){a.Logger.error("Error sending forwarding stats to mParticle servers.");}},this.initializeForwarderStatsUploader=function(){var b=a._Store.SDKConfig.v1SecureServiceUrl,c=a._Store.devToken,d="https://".concat(b).concat(c,"/Forwarding"),e=window.fetch?new FetchUploader(d):new XHRUploader(d);return e},this.prepareForwardingStats=function(b,c){var d,e=a._Forwarders.getForwarderStatsQueue();if(b&&b.isVisible){d={mid:b.id,esid:b.eventSubscriptionId,n:c.EventName,attrs:c.EventAttributes,sdk:c.SDKVersion,dt:c.EventDataType,et:c.EventCategory,dbg:c.Debug,ct:c.Timestamp,eec:c.ExpandedEventCount,dp:c.DataPlan};var f=a._Forwarders,g=f.sendSingleForwardingStatsToServer,h=f.setForwarderStatsQueue;a._Helpers.getFeatureFlag(Constants.FeatureFlags.ReportBatching)?(e.push(d),h(e)):g(d);}};}
553
602
 
554
- var Modify$3=Constants.IdentityMethods.Modify,Validators={// From ./utils
555
- // Utility Functions for backwards compatability
556
- isNumber:isNumber,isFunction:isFunction,isStringOrNumber:isStringOrNumber,// Validator Functions
557
- isValidAttributeValue:isValidAttributeValue,// Validator Functions
558
- // Neither null nor undefined can be a valid Key
559
- isValidKeyValue:function isValidKeyValue(a){return !(!a||isObject(a)||Array.isArray(a)||this.isFunction(a))},removeFalsyIdentityValues:function removeFalsyIdentityValues(a,b){if(!a||!a.userIdentities)return a;var c={},d=__assign({},a.userIdentities);for(var e in a.userIdentities)if(a.userIdentities.hasOwnProperty(e)){var f=a.userIdentities[e];// Check if value is falsy (undefined, false, 0, '', etc.) but not null
560
- null===f||f||(b.warning("Identity value for '".concat(e,"' is falsy (").concat(f,"). This value will be removed from the request.")),delete d[e]);}return c.userIdentities=d,c},validateIdentities:function validateIdentities(a,b){var c={userIdentities:1,onUserAlias:1,copyUserAttributes:1};if(a){if(b===Modify$3&&(isObject(a.userIdentities)&&!Object.keys(a.userIdentities).length||!isObject(a.userIdentities)))return {valid:!1,error:Constants.Messages.ValidationMessages.ModifyIdentityRequestUserIdentitiesPresent};for(var d in a)if(a.hasOwnProperty(d)){if(!c[d])return {valid:!1,error:Constants.Messages.ValidationMessages.IdentityRequesetInvalidKey};if("onUserAlias"===d&&!Validators.isFunction(a[d]))return {valid:!1,error:Constants.Messages.ValidationMessages.OnUserAliasType}}if(0===Object.keys(a).length)return {valid:!0};// identityApiData.userIdentities can't be undefined
561
- if(void 0===a.userIdentities)return {valid:!1,error:Constants.Messages.ValidationMessages.UserIdentities};// identityApiData.userIdentities can be null, but if it isn't null or undefined (above conditional), it must be an object
562
- if(null!==a.userIdentities&&!isObject(a.userIdentities))return {valid:!1,error:Constants.Messages.ValidationMessages.UserIdentities};if(isObject(a.userIdentities)&&Object.keys(a.userIdentities).length)for(var e in a.userIdentities)if(a.userIdentities.hasOwnProperty(e)){if(!1===Types.IdentityType.getIdentityType(e))return {valid:!1,error:Constants.Messages.ValidationMessages.UserIdentitiesInvalidKey};if("string"!=typeof a.userIdentities[e]&&null!==a.userIdentities[e])return {valid:!1,error:Constants.Messages.ValidationMessages.UserIdentitiesInvalidValues}}}return {valid:!0}}};
563
-
564
603
  var KitFilterHelper=/** @class */function(){function a(){}a.hashEventType=function(a){return generateHash(a)},a.hashEventName=function(a,b){return generateHash(b+a)},a.hashEventAttributeKey=function(a,b,c){return generateHash(a+b+c)},a.hashUserAttribute=function(a){return generateHash(a)},a.hashUserIdentity=function(a){return a},a.hashConsentPurpose=function(a,b){return generateHash(a+b)},a.hashAttributeConditionalForwarding=function(a){return generateHash(a).toString()},a.hashConsentPurposeConditionalForwarding=function(a,b){return this.hashConsentPurpose(a,b).toString()};var b;return b=a,a.filterUserAttributes=function(a,c){return filterDictionaryWithHash(a,c,function(a){return b.hashUserAttribute(a)})},a.filterUserIdentities=function(a,c){return filterDictionaryWithHash(a,c,function(a){return b.hashUserIdentity(IdentityType.getIdentityType(a))})},a.isFilteredUserAttribute=function(a,c){var d=b.hashUserAttribute(a);return c&&inArray(c,d)},a}();
565
604
 
566
605
  var StorageNames$1=Constants.StorageNames;function Helpers(a){var b=this;// TODO: Refactor SDK to directly use these methods
@@ -1167,6 +1206,37 @@ Store:a._Store.serverSettings,SDKVersion:Constants.sdkVersion,SessionId:a._Store
1167
1206
 
1168
1207
  function forwardingStatsUploader(a){function b(){var b=a._Forwarders.getForwarderStatsQueue(),c=a._Persistence.forwardingStatsBatches.uploadsTable,d=Date.now();for(var e in b.length&&(c[d]={uploading:!1,data:b},a._Forwarders.setForwarderStatsQueue([])),c)(function(b){if(c.hasOwnProperty(b)&&!1===c[b].uploading){var d=function(){4===e.readyState&&(200===e.status||202===e.status?(a.Logger.verbose("Successfully sent "+e.statusText+" from server"),delete c[b]):"4"===e.status.toString()[0]?429!==e.status&&delete c[b]:c[b].uploading=!1);},e=a._Helpers.createXHR(d),f=c[b].data;c[b].uploading=!0,a._APIClient.sendBatchForwardingStatsToServer(f,e);}})(e);}this.startForwardingStatsTimer=function(){mParticle._forwardingStatsTimer=setInterval(function(){b();},a._Store.SDKConfig.forwarderStatsTimeout);};}
1169
1208
 
1209
+ function _toPrimitive(input, hint) {
1210
+ if (_typeof$1(input) !== "object" || input === null) return input;
1211
+ var prim = input[Symbol.toPrimitive];
1212
+ if (prim !== undefined) {
1213
+ var res = prim.call(input, hint || "default");
1214
+ if (_typeof$1(res) !== "object") return res;
1215
+ throw new TypeError("@@toPrimitive must return a primitive value.");
1216
+ }
1217
+ return (hint === "string" ? String : Number)(input);
1218
+ }
1219
+
1220
+ function _toPropertyKey(arg) {
1221
+ var key = _toPrimitive(arg, "string");
1222
+ return _typeof$1(key) === "symbol" ? key : String(key);
1223
+ }
1224
+
1225
+ function _defineProperty(obj, key, value) {
1226
+ key = _toPropertyKey(key);
1227
+ if (key in obj) {
1228
+ Object.defineProperty(obj, key, {
1229
+ value: value,
1230
+ enumerable: true,
1231
+ configurable: true,
1232
+ writable: true
1233
+ });
1234
+ } else {
1235
+ obj[key] = value;
1236
+ }
1237
+ return obj;
1238
+ }
1239
+
1170
1240
  var AudienceManager=/** @class */function(){function a(a,b,c){this.url="",this.logger=c,this.url="https://".concat(a).concat(b,"/audience"),this.userAudienceAPI=window.fetch?new FetchUploader(this.url):new XHRUploader(this.url);}return a.prototype.sendGetUserAudienceRequest=function(a,b){return __awaiter(this,void 0,void 0,function(){var c,d,e,f,g,h;return __generator(this,function(i){switch(i.label){case 0:this.logger.verbose("Fetching user audiences from server"),c={method:"GET",headers:{Accept:"*/*"}},d="".concat(this.url,"?mpid=").concat(a),i.label=1;case 1:return i.trys.push([1,6,,7]),[4/*yield*/,this.userAudienceAPI.upload(c,d)];case 2:return (e=i.sent(),!(200<=e.status&&300>e.status))?[3/*break*/,4]:(this.logger.verbose("User Audiences successfully received"),[4/*yield*/,e.json()]);case 3:f=i.sent(),g={currentAudienceMemberships:null===f||void 0===f?void 0:f.audience_memberships};try{b(g);}catch(a){throw new Error("Error invoking callback on user audience response.")}return [3/*break*/,5];case 4:if(401===e.status)throw new Error("`HTTP error status ${userAudiencePromise.status} while retrieving User Audiences - please verify your API key.`");else if(403===e.status)throw new Error("`HTTP error status ${userAudiencePromise.status} while retrieving User Audiences - please verify your workspace is enabled for audiences.`");else// In case there is an HTTP error we did not anticipate.
1171
1241
  throw new Error("Uncaught HTTP Error ".concat(e.status,"."));case 5:return [3/*break*/,7];case 6:return h=i.sent(),this.logger.error("Error retrieving audiences. ".concat(h)),[3/*break*/,7];case 7:return [2/*return*/]}})})},a}();
1172
1242
 
@@ -1176,7 +1246,7 @@ for(var e,f=window.mParticle,g=window.mParticle,h=0,i=d;h<i.length;h++)// Keep t
1176
1246
  e=i[h],g=f,f=f[e];// Apply the function with its proper context
1177
1247
  f.apply(g,b);}catch(a){throw new Error("Unable to compute proper mParticle function "+a)}}};
1178
1248
 
1179
- var Messages$2=Constants.Messages,HTTPCodes$2=Constants.HTTPCodes,FeatureFlags$1=Constants.FeatureFlags,IdentityMethods$1=Constants.IdentityMethods,ErrorMessages=Messages$2.ErrorMessages,CacheIdentity=FeatureFlags$1.CacheIdentity,Identify=IdentityMethods$1.Identify,Modify$1=IdentityMethods$1.Modify,Login=IdentityMethods$1.Login,Logout=IdentityMethods$1.Logout;function Identity(a){var b=a._Helpers,c=b.getFeatureFlag,d=b.extend,e=this;// https://go.mparticle.com/work/SQDSDKS-6353
1249
+ function ownKeys(s,e){var r=Object.keys(s);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(s);e&&(t=t.filter(function(e){return Object.getOwnPropertyDescriptor(s,e).enumerable})),r.push.apply(r,t);}return r}function _objectSpread(s){for(var e,i=1;i<arguments.length;i++)e=null==arguments[i]?{}:arguments[i],i%2?ownKeys(Object(e),!0).forEach(function(t){_defineProperty(s,t,e[t]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(e)):ownKeys(Object(e)).forEach(function(t){Object.defineProperty(s,t,Object.getOwnPropertyDescriptor(e,t));});return s}var Messages$2=Constants.Messages,HTTPCodes$2=Constants.HTTPCodes,FeatureFlags$1=Constants.FeatureFlags,IdentityMethods$1=Constants.IdentityMethods,ErrorMessages=Messages$2.ErrorMessages,CacheIdentity=FeatureFlags$1.CacheIdentity,Identify=IdentityMethods$1.Identify,Modify$1=IdentityMethods$1.Modify,Login=IdentityMethods$1.Login,Logout=IdentityMethods$1.Logout;function Identity(t){var r=t._Helpers,s=r.getFeatureFlag,i=r.extend,n=this;// https://go.mparticle.com/work/SQDSDKS-6353
1180
1250
  /**
1181
1251
  * Invoke these methods on the mParticle.Identity object.
1182
1252
  * Example: mParticle.Identity.getCurrentUser().
@@ -1195,53 +1265,70 @@ var Messages$2=Constants.Messages,HTTPCodes$2=Constants.HTTPCodes,FeatureFlags$1
1195
1265
  // send a user identity change request on identify, login, logout, modify when any values change.
1196
1266
  // compare what identities exist vs what is previously was for the specific user if they were in memory before.
1197
1267
  // if it's the first time the user is logging in, send a user identity change request with
1198
- this.idCache=null,this.audienceManager=null,this.IdentityRequest={preProcessIdentityRequest:function preProcessIdentityRequest(b,c,d){a.Logger.verbose(Messages$2.InformationMessages.StartingLogEvent+": "+d);// First, remove any falsy identity values and warn about them
1199
- var e=a._Helpers.Validators.removeFalsyIdentityValues(b,a.Logger),f=a._Helpers.Validators.validateIdentities(e,d);if(!f.valid)return a.Logger.error("ERROR: "+f.error),{valid:!1,error:f.error};if(c&&!a._Helpers.Validators.isFunction(c)){var g="The optional callback must be a function. You tried entering a(n) "+_typeof$1(c);return a.Logger.error(g),{valid:!1,error:g}}return {valid:!0,cleanedIdentities:e}},createIdentityRequest:function createIdentityRequest(b,c,d,e,f,g,h){var i={client_sdk:{platform:c,sdk_vendor:d,sdk_version:e},context:g,environment:a._Store.SDKConfig.isDevelopmentMode?"development":"production",request_id:a._Helpers.generateUniqueId(),request_timestamp_ms:new Date().getTime(),previous_mpid:h||null,known_identities:createKnownIdentities(b,f)};return i},createModifyIdentityRequest:function createModifyIdentityRequest(b,c,d,e,f,g){return {client_sdk:{platform:d,sdk_vendor:e,sdk_version:f},context:g,environment:a._Store.SDKConfig.isDevelopmentMode?"development":"production",request_id:a._Helpers.generateUniqueId(),request_timestamp_ms:new Date().getTime(),identity_changes:this.createIdentityChanges(b,c)}},createIdentityChanges:function createIdentityChanges(a,b){var c,d=[];if(b&&isObject(b)&&a&&isObject(a))for(c in b)d.push({old_value:a[c]||null,new_value:b[c],identity_type:c});return d},// takes 2 UI objects keyed by name, combines them, returns them keyed by type
1200
- combineUserIdentities:function combineUserIdentities(a,b){var c={},e=d({},a,b);for(var f in e){var g=Types.IdentityType.getIdentityType(f);// this check removes anything that is not whitelisted as an identity type
1201
- !1!==g&&0<=g&&(c[Types.IdentityType.getIdentityType(f)]=e[f]);}return c},createAliasNetworkRequest:function createAliasNetworkRequest(b){return {request_id:a._Helpers.generateUniqueId(),request_type:"alias",environment:a._Store.SDKConfig.isDevelopmentMode?"development":"production",api_key:a._Store.devToken,data:{destination_mpid:b.destinationMpid,source_mpid:b.sourceMpid,start_unixtime_ms:b.startTime,end_unixtime_ms:b.endTime,scope:b.scope,device_application_stamp:a._Store.deviceId}}},convertAliasToNative:function convertAliasToNative(a){return {DestinationMpid:a.destinationMpid,SourceMpid:a.sourceMpid,StartUnixtimeMs:a.startTime,EndUnixtimeMs:a.endTime,Scope:a.scope}},convertToNative:function convertToNative(a){var b=[];if(a&&a.userIdentities){for(var c in a.userIdentities)a.userIdentities.hasOwnProperty(c)&&b.push({Type:Types.IdentityType.getIdentityType(c),Identity:a.userIdentities[c]});return {UserIdentities:b}}}},this.IdentityAPI={HTTPCodes:HTTPCodes$2,/**
1268
+ this.idCache=null,this.audienceManager=null,this.IdentityRequest={preProcessIdentityRequest:function preProcessIdentityRequest(e,r,s){t.Logger.verbose(Messages$2.InformationMessages.StartingLogEvent+": "+s);// First, remove any falsy identity values and warn about them
1269
+ var i=t._Helpers.Validators.removeFalsyIdentityValues(e,t.Logger),n=null!==i&&void 0!==i&&i.userIdentities?_objectSpread(_objectSpread({},i),{},{userIdentities:normalizeUserIdentityKeys(i.userIdentities)}):i,d=t._Helpers.Validators.validateIdentities(n,s);// Normalize convenience aliases (email_sha256 → other, mobile_sha256 → other2)
1270
+ if(!d.valid)return t.Logger.error("ERROR: "+d.error),{valid:!1,error:d.error};if(r&&!t._Helpers.Validators.isFunction(r)){var a="The optional callback must be a function. You tried entering a(n) "+_typeof$1(r);return t.Logger.error(a),{valid:!1,error:a}}return {valid:!0,cleanedIdentities:n}},createIdentityRequest:function createIdentityRequest(e,r,s,i,n,d,a){var o={client_sdk:{platform:r,sdk_vendor:s,sdk_version:i},context:d,environment:t._Store.SDKConfig.isDevelopmentMode?"development":"production",request_id:t._Helpers.generateUniqueId(),request_timestamp_ms:new Date().getTime(),previous_mpid:a||null,known_identities:createKnownIdentities(e,n)};return o},createModifyIdentityRequest:function createModifyIdentityRequest(e,r,s,i,n,d){return {client_sdk:{platform:s,sdk_vendor:i,sdk_version:n},context:d,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
1271
+ combineUserIdentities:function combineUserIdentities(e,t){var r={},s=i({},e,t);for(var n in s){var d=Types.IdentityType.getIdentityType(n);// this check removes anything that is not whitelisted as an identity type
1272
+ !1!==d&&0<=d&&(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,Scope:e.scope}},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,/**
1202
1273
  * Initiate a logout request to the mParticle server
1203
1274
  * @method identify
1204
1275
  * @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)
1205
1276
  * @param {Function} [callback] A callback function that is called when the identify request completes
1206
- */identify:function identify(b,c){// https://go.mparticle.com/work/SQDSDKS-6337
1207
- var d,f=a.Identity.getCurrentUser(),g=a._Identity.IdentityRequest.preProcessIdentityRequest(b,c,Identify);if(f&&(d=f.getMPID()),g.valid){var h=a._Identity.IdentityRequest.createIdentityRequest(g.cleanedIdentities,Constants.platform,Constants.sdkVendor,Constants.sdkVersion,a._Store.deviceId,a._Store.context,d);if(a._Helpers.getFeatureFlag(Constants.FeatureFlags.CacheIdentity)){var i=tryCacheIdentity(h.known_identities,e.idCache,e.parseIdentityResponse,d,c,b,Identify);if(i)return}a._Helpers.canLog()?a._Store.webviewBridgeEnabled?(a._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Identify,JSON.stringify(a._Identity.IdentityRequest.convertToNative(b))),a._Helpers.invokeCallback(c,HTTPCodes$2.nativeIdentityRequest,"Identify request sent to native sdk")):a._IdentityAPIClient.sendIdentityRequest(h,Identify,c,b,e.parseIdentityResponse,d,h.known_identities):(a._Helpers.invokeCallback(c,HTTPCodes$2.loggingDisabledOrMissingAPIKey,Messages$2.InformationMessages.AbandonLogEvent),a.Logger.verbose(Messages$2.InformationMessages.AbandonLogEvent));}else a._Helpers.invokeCallback(c,HTTPCodes$2.validationIssue,g.error),a.Logger.verbose(g);},/**
1277
+ */identify:function identify(e,r){// https://go.mparticle.com/work/SQDSDKS-6337
1278
+ var s,i=t.Identity.getCurrentUser(),d=t._Identity.IdentityRequest.preProcessIdentityRequest(e,r,Identify);if(i&&(s=i.getMPID()),d.valid){var a=t._Identity.IdentityRequest.createIdentityRequest(d.cleanedIdentities,Constants.platform,Constants.sdkVendor,Constants.sdkVersion,t._Store.deviceId,t._Store.context,s);if(t._Helpers.getFeatureFlag(Constants.FeatureFlags.CacheIdentity)){var o=tryCacheIdentity(a.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(a,Identify,r,e,n.parseIdentityResponse,s,a.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,d.error),t.Logger.verbose(d);},/**
1208
1279
  * Initiate a logout request to the mParticle server
1209
1280
  * @method logout
1210
1281
  * @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)
1211
1282
  * @param {Function} [callback] A callback function that is called when the logout request completes
1212
- */logout:function logout(b,c){// https://go.mparticle.com/work/SQDSDKS-6337
1213
- var d,f=a.Identity.getCurrentUser(),g=a._Identity.IdentityRequest.preProcessIdentityRequest(b,c,Logout);if(f&&(d=f.getMPID()),g.valid){var h,i=a._Identity.IdentityRequest.createIdentityRequest(g.cleanedIdentities,Constants.platform,Constants.sdkVendor,Constants.sdkVersion,a._Store.deviceId,a._Store.context,d);a._Helpers.canLog()?a._Store.webviewBridgeEnabled?(a._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Logout,JSON.stringify(a._Identity.IdentityRequest.convertToNative(b))),a._Helpers.invokeCallback(c,HTTPCodes$2.nativeIdentityRequest,"Logout request sent to native sdk")):(a._IdentityAPIClient.sendIdentityRequest(i,Logout,c,b,e.parseIdentityResponse,d),h=a._ServerModel.createEventObject({messageType:Types.MessageType.Profile}),h.ProfileMessageType=Types.ProfileMessageType.Logout,a._Store.activeForwarders.length&&a._Store.activeForwarders.forEach(function(a){a.logOut&&a.logOut(h);})):(a._Helpers.invokeCallback(c,HTTPCodes$2.loggingDisabledOrMissingAPIKey,Messages$2.InformationMessages.AbandonLogEvent),a.Logger.verbose(Messages$2.InformationMessages.AbandonLogEvent));}else a._Helpers.invokeCallback(c,HTTPCodes$2.validationIssue,g.error),a.Logger.verbose(g);},/**
1283
+ */logout:function logout(e,r){// https://go.mparticle.com/work/SQDSDKS-6337
1284
+ var s,i=t.Identity.getCurrentUser(),d=t._Identity.IdentityRequest.preProcessIdentityRequest(e,r,Logout);if(i&&(s=i.getMPID()),d.valid){var a,o=t._Identity.IdentityRequest.createIdentityRequest(d.cleanedIdentities,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),a=t._ServerModel.createEventObject({messageType:Types.MessageType.Profile}),a.ProfileMessageType=Types.ProfileMessageType.Logout,t._Store.activeForwarders.length&&t._Store.activeForwarders.forEach(function(e){e.logOut&&e.logOut(a);})):(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,d.error),t.Logger.verbose(d);},/**
1214
1285
  * Initiate a login request to the mParticle server
1215
1286
  * @method login
1216
1287
  * @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)
1217
1288
  * @param {Function} [callback] A callback function that is called when the login request completes
1218
- */login:function login(b,c){// https://go.mparticle.com/work/SQDSDKS-6337
1219
- var d,f=a.Identity.getCurrentUser(),g=a._Identity.IdentityRequest.preProcessIdentityRequest(b,c,Login);if(f&&(d=f.getMPID()),g.valid){var h=a._Identity.IdentityRequest.createIdentityRequest(g.cleanedIdentities,Constants.platform,Constants.sdkVendor,Constants.sdkVersion,a._Store.deviceId,a._Store.context,d);if(a._Helpers.getFeatureFlag(Constants.FeatureFlags.CacheIdentity)){var i=tryCacheIdentity(h.known_identities,e.idCache,e.parseIdentityResponse,d,c,b,Login);if(i)return}a._Helpers.canLog()?a._Store.webviewBridgeEnabled?(a._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Login,JSON.stringify(a._Identity.IdentityRequest.convertToNative(b))),a._Helpers.invokeCallback(c,HTTPCodes$2.nativeIdentityRequest,"Login request sent to native sdk")):a._IdentityAPIClient.sendIdentityRequest(h,Login,c,b,e.parseIdentityResponse,d,h.known_identities):(a._Helpers.invokeCallback(c,HTTPCodes$2.loggingDisabledOrMissingAPIKey,Messages$2.InformationMessages.AbandonLogEvent),a.Logger.verbose(Messages$2.InformationMessages.AbandonLogEvent));}else a._Helpers.invokeCallback(c,HTTPCodes$2.validationIssue,g.error),a.Logger.verbose(g);},/**
1289
+ */login:function login(e,r){// https://go.mparticle.com/work/SQDSDKS-6337
1290
+ var s,i=t.Identity.getCurrentUser(),d=t._Identity.IdentityRequest.preProcessIdentityRequest(e,r,Login);if(i&&(s=i.getMPID()),d.valid){var a=t._Identity.IdentityRequest.createIdentityRequest(d.cleanedIdentities,Constants.platform,Constants.sdkVendor,Constants.sdkVersion,t._Store.deviceId,t._Store.context,s);if(t._Helpers.getFeatureFlag(Constants.FeatureFlags.CacheIdentity)){var o=tryCacheIdentity(a.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(a,Login,r,e,n.parseIdentityResponse,s,a.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,d.error),t.Logger.verbose(d);},/**
1220
1291
  * Initiate a modify request to the mParticle server
1221
1292
  * @method modify
1222
1293
  * @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)
1223
1294
  * @param {Function} [callback] A callback function that is called when the modify request completes
1224
- */modify:function modify(b,c){// https://go.mparticle.com/work/SQDSDKS-6337
1225
- var d,f=a.Identity.getCurrentUser(),g=a._Identity.IdentityRequest.preProcessIdentityRequest(b,c,Modify$1);if(f&&(d=f.getMPID()),g.valid){var h=b&&b.userIdentities?g.cleanedIdentities.userIdentities:{},i=a._Identity.IdentityRequest.createModifyIdentityRequest(f?f.getUserIdentities().userIdentities:{},h,Constants.platform,Constants.sdkVendor,Constants.sdkVersion,a._Store.context);a._Helpers.canLog()?a._Store.webviewBridgeEnabled?(a._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Modify,JSON.stringify(a._Identity.IdentityRequest.convertToNative(b))),a._Helpers.invokeCallback(c,HTTPCodes$2.nativeIdentityRequest,"Modify request sent to native sdk")):a._IdentityAPIClient.sendIdentityRequest(i,Modify$1,c,b,e.parseIdentityResponse,d,i.known_identities):(a._Helpers.invokeCallback(c,HTTPCodes$2.loggingDisabledOrMissingAPIKey,Messages$2.InformationMessages.AbandonLogEvent),a.Logger.verbose(Messages$2.InformationMessages.AbandonLogEvent));}else a._Helpers.invokeCallback(c,HTTPCodes$2.validationIssue,g.error),a.Logger.verbose(g);},/**
1295
+ */modify:function modify(e,r){// https://go.mparticle.com/work/SQDSDKS-6337
1296
+ var s,i=t.Identity.getCurrentUser(),d=t._Identity.IdentityRequest.preProcessIdentityRequest(e,r,Modify$1);if(i&&(s=i.getMPID()),d.valid){var a=e&&e.userIdentities?d.cleanedIdentities.userIdentities:{},o=t._Identity.IdentityRequest.createModifyIdentityRequest(i?i.getUserIdentities().userIdentities:{},a,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,d.error),t.Logger.verbose(d);},/**
1226
1297
  * Returns a user object with methods to interact with the current user
1227
1298
  * @method getCurrentUser
1228
1299
  * @return {Object} the current user object
1229
- */getCurrentUser:function getCurrentUser(){var b;return a._Store?(b=a._Store.mpid,b?(b=a._Store.mpid.slice(),e.mParticleUser(b,a._Store.isLoggedIn)):a._Store.webviewBridgeEnabled?e.mParticleUser():null):null},/**
1300
+ */getCurrentUser:function getCurrentUser(){var e;return t._Store?(e=t._Store.mpid,e?(e=t._Store.mpid.slice(),n.mParticleUser(e,t._Store.isLoggedIn)):t._Store.webviewBridgeEnabled?n.mParticleUser():null):null},/**
1230
1301
  * Returns a the user object associated with the mpid parameter or 'null' if no such
1231
1302
  * user exists
1232
1303
  * @method getUser
1233
1304
  * @param {String} mpid of the desired user
1234
1305
  * @return {Object} the user for mpid
1235
- */getUser:function getUser(b){var c=a._Persistence.getPersistence();return c?c[b]&&!Constants.SDKv2NonMPIDCookieKeys.hasOwnProperty(b)?e.mParticleUser(b):null:null},/**
1306
+ */getUser:function getUser(e){var r=t._Persistence.getPersistence();return r?r[e]&&!Constants.SDKv2NonMPIDCookieKeys.hasOwnProperty(e)?n.mParticleUser(e):null:null},/**
1236
1307
  * Returns all users, including the current user and all previous users that are stored on the device.
1237
1308
  * @method getUsers
1238
1309
  * @return {Array} array of users
1239
- */getUsers:function getUsers(){var b=a._Persistence.getPersistence(),c=[];if(b)for(var d in b)Constants.SDKv2NonMPIDCookieKeys.hasOwnProperty(d)||c.push(e.mParticleUser(d));return c.sort(function(c,a){var b=c.getLastSeenTime()||0,d=a.getLastSeenTime()||0;return b>d?-1:1}),c},/**
1310
+ */getUsers:function getUsers(){var e=t._Persistence.getPersistence(),r=[];if(e)for(var s in e)Constants.SDKv2NonMPIDCookieKeys.hasOwnProperty(s)||r.push(n.mParticleUser(s));return r.sort(function(e,t){var r=e.getLastSeenTime()||0,s=t.getLastSeenTime()||0;return r>s?-1:1}),r},/**
1240
1311
  * Initiate an alias request to the mParticle server
1241
1312
  * @method aliasUsers
1242
1313
  * @param {Object} aliasRequest object representing an AliasRequest
1243
1314
  * @param {Function} [callback] A callback function that is called when the aliasUsers request completes
1244
- */aliasUsers:function aliasUsers(b,c){var d;if(b.destinationMpid&&b.sourceMpid||(d=Messages$2.ValidationMessages.AliasMissingMpid),b.destinationMpid===b.sourceMpid&&(d=Messages$2.ValidationMessages.AliasNonUniqueMpid),b.startTime&&b.endTime||(d=Messages$2.ValidationMessages.AliasMissingTime),b.startTime>b.endTime&&(d=Messages$2.ValidationMessages.AliasStartBeforeEndTime),d)return a.Logger.warning(d),void a._Helpers.invokeAliasCallback(c,HTTPCodes$2.validationIssue,d);if(!a._Helpers.canLog())a._Helpers.invokeAliasCallback(c,HTTPCodes$2.loggingDisabledOrMissingAPIKey,Messages$2.InformationMessages.AbandonAliasUsers),a.Logger.verbose(Messages$2.InformationMessages.AbandonAliasUsers);else if(a._Store.webviewBridgeEnabled)a._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Alias,JSON.stringify(a._Identity.IdentityRequest.convertAliasToNative(b))),a._Helpers.invokeAliasCallback(c,HTTPCodes$2.nativeIdentityRequest,"Alias request sent to native sdk");else {a.Logger.verbose(Messages$2.InformationMessages.StartingAliasRequest+": "+b.sourceMpid+" -> "+b.destinationMpid);var e=a._Identity.IdentityRequest.createAliasNetworkRequest(b);a._IdentityAPIClient.sendAliasRequest(e,c);}},/**
1315
+ */aliasUsers:function aliasUsers(e,r){var s;if(e.destinationMpid&&e.sourceMpid||(s=Messages$2.ValidationMessages.AliasMissingMpid),e.destinationMpid===e.sourceMpid&&(s=Messages$2.ValidationMessages.AliasNonUniqueMpid),e.startTime&&e.endTime||(s=Messages$2.ValidationMessages.AliasMissingTime),e.startTime>e.endTime&&(s=Messages$2.ValidationMessages.AliasStartBeforeEndTime),s)return t.Logger.warning(s),void t._Helpers.invokeAliasCallback(r,HTTPCodes$2.validationIssue,s);if(!t._Helpers.canLog())t._Helpers.invokeAliasCallback(r,HTTPCodes$2.loggingDisabledOrMissingAPIKey,Messages$2.InformationMessages.AbandonAliasUsers),t.Logger.verbose(Messages$2.InformationMessages.AbandonAliasUsers);else if(t._Store.webviewBridgeEnabled)t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Alias,JSON.stringify(t._Identity.IdentityRequest.convertAliasToNative(e))),t._Helpers.invokeAliasCallback(r,HTTPCodes$2.nativeIdentityRequest,"Alias request sent to native sdk");else {t.Logger.verbose(Messages$2.InformationMessages.StartingAliasRequest+": "+e.sourceMpid+" -> "+e.destinationMpid);var i=t._Identity.IdentityRequest.createAliasNetworkRequest(e);t._IdentityAPIClient.sendAliasRequest(i,r);}},/**
1316
+ * Search the IDSync Workspace endpoint for a known identity.
1317
+ *
1318
+ * POSTs to mParticle's `/v1/search` endpoint and invokes `callback`
1319
+ * with `{ httpCode, body? }`.
1320
+ *
1321
+ * The `workspaceApiKey` is a workspace-specific API key supplied by
1322
+ * the caller (passed in from a kit's settings). It is intentionally
1323
+ * NOT read from the SDK's own workspace token, so that workspace
1324
+ * searches can be authorised independently of the host SDK's
1325
+ * workspace.
1326
+ *
1327
+ * @method search
1328
+ * @param {String} workspaceApiKey Workspace API key (sent as x-mp-key).
1329
+ * @param {Object} knownIdentities A `UserIdentities` map.
1330
+ * @param {Function} callback Invoked with the `IIdentitySearchResult`.
1331
+ */search:function search(e,r,s){executeSearchRequest(t,e,r,s);},/**
1245
1332
  Create a default AliasRequest for 2 MParticleUsers. This will construct the request
1246
1333
  using the sourceUser's firstSeenTime as the startTime, and its lastSeenTime as the endTime.
1247
1334
 
@@ -1255,110 +1342,110 @@ var d,f=a.Identity.getCurrentUser(),g=a._Identity.IdentityRequest.preProcessIden
1255
1342
  In rare cases, where the sourceUser's lastSeenTime also falls outside of the aliasMaxWindow limit,
1256
1343
  after applying this adjustment it will be impossible to create an aliasRequest passes the aliasUsers()
1257
1344
  validation that the startTime must be less than the endTime
1258
- */createAliasRequest:function createAliasRequest(b,c,d){try{if(!c||!b)return a.Logger.error("'destinationUser' and 'sourceUser' must both be present"),null;var e=b.getFirstSeenTime();e||a.Identity.getUsers().forEach(function(a){a.getFirstSeenTime()&&(!e||a.getFirstSeenTime()<e)&&(e=a.getFirstSeenTime());});var f=new Date().getTime()-1e3*(60*(60*(24*a._Store.SDKConfig.aliasMaxWindow))),g=b.getLastSeenTime()||new Date().getTime();//if the startTime is greater than $maxAliasWindow ago, adjust the startTime to the earliest allowed
1259
- return e<f&&(e=f,g<e&&a.Logger.warning("Source User has not been seen in the last "+a._Store.SDKConfig.maxAliasWindow+" days, Alias Request will likely fail")),{destinationMpid:c.getMPID(),sourceMpid:b.getMPID(),startTime:e,endTime:g,scope:d||"device"}}catch(b){return a.Logger.error("There was a problem with creating an alias request: "+b),null}}},this.mParticleUser=function(b,c){var d=this;return {/**
1345
+ */createAliasRequest:function createAliasRequest(e,r,s){try{if(!r||!e)return t.Logger.error("'destinationUser' and 'sourceUser' must both be present"),null;var i=e.getFirstSeenTime();i||t.Identity.getUsers().forEach(function(e){e.getFirstSeenTime()&&(!i||e.getFirstSeenTime()<i)&&(i=e.getFirstSeenTime());});var n=new Date().getTime()-1e3*(60*(60*(24*t._Store.SDKConfig.aliasMaxWindow))),d=e.getLastSeenTime()||new Date().getTime();//if the startTime is greater than $maxAliasWindow ago, adjust the startTime to the earliest allowed
1346
+ return i<n&&(i=n,d<i&&t.Logger.warning("Source User has not been seen in the last "+t._Store.SDKConfig.maxAliasWindow+" days, Alias Request will likely fail")),{destinationMpid:r.getMPID(),sourceMpid:e.getMPID(),startTime:i,endTime:d,scope:s||"device"}}catch(r){return t.Logger.error("There was a problem with creating an alias request: "+r),null}}},this.mParticleUser=function(e,r){var s=this;return {/**
1260
1347
  * Get user identities for current user
1261
1348
  * @method getUserIdentities
1262
1349
  * @return {Object} an object with userIdentities as its key
1263
- */getUserIdentities:function getUserIdentities(){var c={},d=a._Store.getUserIdentities(b);for(var e in d)d.hasOwnProperty(e)&&(c[Types.IdentityType.getIdentityName(a._Helpers.parseNumber(e))]=d[e]);return {userIdentities:c}},/**
1350
+ */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}},/**
1264
1351
  * Get the MPID of the current user
1265
1352
  * @method getMPID
1266
1353
  * @return {String} the current user MPID as a string
1267
- */getMPID:function getMPID(){return b},/**
1354
+ */getMPID:function getMPID(){return e},/**
1268
1355
  * Sets a user tag
1269
1356
  * @method setUserTag
1270
1357
  * @param {String} tagName
1271
- */setUserTag:function setUserTag(b){return a._Helpers.Validators.isValidKeyValue(b)?void this.setUserAttribute(b,null):void a.Logger.error(Messages$2.ErrorMessages.BadKey)},/**
1358
+ */setUserTag:function setUserTag(e){return t._Helpers.Validators.isValidKeyValue(e)?void this.setUserAttribute(e,null):void t.Logger.error(Messages$2.ErrorMessages.BadKey)},/**
1272
1359
  * Removes a user tag
1273
1360
  * @method removeUserTag
1274
1361
  * @param {String} tagName
1275
- */removeUserTag:function removeUserTag(b){return a._Helpers.Validators.isValidKeyValue(b)?void this.removeUserAttribute(b):void a.Logger.error(Messages$2.ErrorMessages.BadKey)},/**
1362
+ */removeUserTag:function removeUserTag(e){return t._Helpers.Validators.isValidKeyValue(e)?void this.removeUserAttribute(e):void t.Logger.error(Messages$2.ErrorMessages.BadKey)},/**
1276
1363
  * Sets a user attribute
1277
1364
  * @method setUserAttribute
1278
1365
  * @param {String} key
1279
1366
  * @param {String} value
1280
1367
  */ // https://go.mparticle.com/work/SQDSDKS-4576
1281
1368
  // https://go.mparticle.com/work/SQDSDKS-6373
1282
- setUserAttribute:function setUserAttribute(c,e){if(a._SessionManager.resetSessionTimer(),a._Helpers.canLog()){if(!a._Helpers.Validators.isValidAttributeValue(e))return void a.Logger.error(Messages$2.ErrorMessages.BadAttribute);if(!a._Helpers.Validators.isValidKeyValue(c))return void a.Logger.error(Messages$2.ErrorMessages.BadKey);if(a._Store.webviewBridgeEnabled)a._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.SetUserAttribute,JSON.stringify({key:c,value:e}));else {var f,g,h=this.getAllUserAttributes(),i=a._Helpers.findKeyInObject(h,c);i?(g=!1,f=h[i],delete h[i]):g=!0,h[c]=e,a._Store.setUserAttributes(b,h),d.sendUserAttributeChangeEvent(c,e,f,g,!1,this),a._Forwarders.initForwarders(d.IdentityAPI.getCurrentUser().getUserIdentities(),a._APIClient.prepareForwardingStats),a._Forwarders.handleForwarderUserAttributes("setUserAttribute",c,e);}}},/**
1369
+ 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,d,a=this.getAllUserAttributes(),o=t._Helpers.findKeyInObject(a,r);o?(d=!1,n=a[o],delete a[o]):d=!0,a[r]=i,t._Store.setUserAttributes(e,a),s.sendUserAttributeChangeEvent(r,i,n,d,!1,this),t._Forwarders.initForwarders(s.IdentityAPI.getCurrentUser().getUserIdentities(),t._APIClient.prepareForwardingStats),t._Forwarders.handleForwarderUserAttributes("setUserAttribute",r,i);}}},/**
1283
1370
  * Set multiple user attributes
1284
1371
  * @method setUserAttributes
1285
1372
  * @param {Object} user attribute object with keys of the attribute type, and value of the attribute value
1286
1373
  */ // https://go.mparticle.com/work/SQDSDKS-6373
1287
- setUserAttributes:function setUserAttributes(b){if(a._SessionManager.resetSessionTimer(),!isObject(b))a.Logger.error("Must pass an object into setUserAttributes. You passed a "+_typeof$1(b));else if(a._Helpers.canLog())for(var c in b)b.hasOwnProperty(c)&&this.setUserAttribute(c,b[c]);},/**
1374
+ setUserAttributes:function setUserAttributes(e){if(t._SessionManager.resetSessionTimer(),!isObject(e))t.Logger.error("Must pass an object into setUserAttributes. You passed a "+_typeof$1(e));else if(t._Helpers.canLog())for(var r in e)e.hasOwnProperty(r)&&this.setUserAttribute(r,e[r]);},/**
1288
1375
  * Removes a specific user attribute
1289
1376
  * @method removeUserAttribute
1290
1377
  * @param {String} key
1291
- */removeUserAttribute:function removeUserAttribute(c){var e,f;if(a._SessionManager.resetSessionTimer(),!a._Helpers.Validators.isValidKeyValue(c))return void a.Logger.error(Messages$2.ErrorMessages.BadKey);if(a._Store.webviewBridgeEnabled)a._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.RemoveUserAttribute,JSON.stringify({key:c,value:null}));else {e=a._Persistence.getPersistence(),f=this.getAllUserAttributes();var g=a._Helpers.findKeyInObject(f,c);g&&(c=g);var h=f[c]?f[c].toString():null;delete f[c],e&&e[b]&&(e[b].ua=f,a._Persistence.savePersistence(e,b)),d.sendUserAttributeChangeEvent(c,null,h,!1,!0,this),a._Forwarders.initForwarders(d.IdentityAPI.getCurrentUser().getUserIdentities(),a._APIClient.prepareForwardingStats),a._Forwarders.handleForwarderUserAttributes("removeUserAttribute",c,null);}},/**
1378
+ */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 d=t._Helpers.findKeyInObject(n,r);d&&(r=d);var a=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,a,!1,!0,this),t._Forwarders.initForwarders(s.IdentityAPI.getCurrentUser().getUserIdentities(),t._APIClient.prepareForwardingStats),t._Forwarders.handleForwarderUserAttributes("removeUserAttribute",r,null);}},/**
1292
1379
  * Sets a list of user attributes
1293
1380
  * @method setUserAttributeList
1294
1381
  * @param {String} key
1295
1382
  * @param {Array} value an array of values
1296
1383
  */ // https://go.mparticle.com/work/SQDSDKS-6373
1297
- setUserAttributeList:function setUserAttributeList(c,e){if(a._SessionManager.resetSessionTimer(),!a._Helpers.Validators.isValidKeyValue(c))return void a.Logger.error(Messages$2.ErrorMessages.BadKey);if(!Array.isArray(e))return void a.Logger.error("The value you passed in to setUserAttributeList must be an array. You passed in a "+("undefined"==typeof value?"undefined":_typeof$1(value)));var f=e.slice();if(a._Store.webviewBridgeEnabled)a._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.SetUserAttributeList,JSON.stringify({key:c,value:f}));else {var g,h,j,k=this.getAllUserAttributes(),l=a._Helpers.findKeyInObject(k,c);// If the new attributeList length is different than the previous, then there is a change event.
1384
+ 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$1(value)));var d=n.slice();if(t._Store.webviewBridgeEnabled)t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.SetUserAttributeList,JSON.stringify({key:r,value:d}));else {var a,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.
1298
1385
  // Loop through new attributes list, see if they are all in the same index as previous user attributes list
1299
1386
  // If there are any changes, break, and immediately send a userAttributeChangeEvent with full array as a value
1300
- if(l?(h=!1,g=k[l],delete k[l]):h=!0,k[c]=f,a._Store.setUserAttributes(b,k),!g||!Array.isArray(g))j=!0;else if(e.length!==g.length)j=!0;else for(var m=0;m<e.length;m++)if(g[m]!==e[m]){j=!0;break}j&&d.sendUserAttributeChangeEvent(c,e,g,h,!1,this),a._Forwarders.initForwarders(d.IdentityAPI.getCurrentUser().getUserIdentities(),a._APIClient.prepareForwardingStats),a._Forwarders.handleForwarderUserAttributes("setUserAttribute",c,f);}},/**
1387
+ if(u?(o=!1,a=l[u],delete l[u]):o=!0,l[r]=d,t._Store.setUserAttributes(e,l),!a||!Array.isArray(a))g=!0;else if(n.length!==a.length)g=!0;else for(var p=0;p<n.length;p++)if(a[p]!==n[p]){g=!0;break}g&&s.sendUserAttributeChangeEvent(r,n,a,o,!1,this),t._Forwarders.initForwarders(s.IdentityAPI.getCurrentUser().getUserIdentities(),t._APIClient.prepareForwardingStats),t._Forwarders.handleForwarderUserAttributes("setUserAttribute",r,d);}},/**
1301
1388
  * Removes all user attributes
1302
1389
  * @method removeAllUserAttributes
1303
- */removeAllUserAttributes:function removeAllUserAttributes(){var b;if(a._SessionManager.resetSessionTimer(),a._Store.webviewBridgeEnabled)a._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.RemoveAllUserAttributes);else if(b=this.getAllUserAttributes(),a._Forwarders.initForwarders(d.IdentityAPI.getCurrentUser().getUserIdentities(),a._APIClient.prepareForwardingStats),b)for(var c in b)b.hasOwnProperty(c)&&a._Forwarders.handleForwarderUserAttributes("removeUserAttribute",c,null),this.removeUserAttribute(c);},/**
1390
+ */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);},/**
1304
1391
  * Returns all user attribute keys that have values that are arrays
1305
1392
  * @method getUserAttributesLists
1306
1393
  * @return {Object} an object of only keys with array values. Example: { attr1: [1, 2, 3], attr2: ['a', 'b', 'c'] }
1307
- */getUserAttributesLists:function getUserAttributesLists(){var a,b={};for(var c in a=this.getAllUserAttributes(),a)a.hasOwnProperty(c)&&Array.isArray(a[c])&&(b[c]=a[c].slice());return b},/**
1394
+ */getUserAttributesLists:function getUserAttributesLists(){var e,t={};for(var r in e=this.getAllUserAttributes(),e)e.hasOwnProperty(r)&&Array.isArray(e[r])&&(t[r]=e[r].slice());return t},/**
1308
1395
  * Returns all user attributes
1309
1396
  * @method getAllUserAttributes
1310
1397
  * @return {Object} an object of all user attributes. Example: { attr1: 'value1', attr2: ['a', 'b', 'c'] }
1311
- */getAllUserAttributes:function getAllUserAttributes(){var c=a._Store.getUserAttributes,d={},e=c(b);if(e)for(var f in e)e.hasOwnProperty(f)&&(d[f]=Array.isArray(e[f])?e[f].slice():e[f]);return d},/**
1398
+ */getAllUserAttributes:function getAllUserAttributes(){var r=t._Store.getUserAttributes,s={},i=r(e);if(i)for(var n in i)i.hasOwnProperty(n)&&(s[n]=Array.isArray(i[n])?i[n].slice():i[n]);return s},/**
1312
1399
  * Returns the cart object for the current user
1313
1400
  * @method getCart
1314
1401
  * @return a cart object
1315
- */getCart:function getCart(){return a.Logger.warning("Deprecated function Identity.getCurrentUser().getCart() will be removed in future releases"),d.mParticleUserCart()},/**
1402
+ */getCart:function getCart(){return t.Logger.warning("Deprecated function Identity.getCurrentUser().getCart() will be removed in future releases"),s.mParticleUserCart()},/**
1316
1403
  * Returns the Consent State stored locally for this user.
1317
1404
  * @method getConsentState
1318
1405
  * @return a ConsentState object
1319
- */getConsentState:function getConsentState(){return a._Store.getConsentState(b)},/**
1406
+ */getConsentState:function getConsentState(){return t._Store.getConsentState(e)},/**
1320
1407
  * Sets the Consent State stored locally for this user.
1321
1408
  * @method setConsentState
1322
1409
  * @param {Object} consent state
1323
- */setConsentState:function setConsentState(c){a._Store.setConsentState(b,c),a._Forwarders.initForwarders(this.getUserIdentities().userIdentities,a._APIClient.prepareForwardingStats),a._CookieSyncManager.attemptCookieSync(this.getMPID());},isLoggedIn:function isLoggedIn(){return c},getLastSeenTime:function getLastSeenTime(){return a._Persistence.getLastSeenTime(b)},getFirstSeenTime:function getFirstSeenTime(){return a._Persistence.getFirstSeenTime(b)},/**
1410
+ */setConsentState:function setConsentState(r){t._Store.setConsentState(e,r),t._Forwarders.initForwarders(this.getUserIdentities().userIdentities,t._APIClient.prepareForwardingStats),t._CookieSyncManager.attemptCookieSync(this.getMPID());},isLoggedIn:function isLoggedIn(){return r},getLastSeenTime:function getLastSeenTime(){return t._Persistence.getLastSeenTime(e)},getFirstSeenTime:function getFirstSeenTime(){return t._Persistence.getFirstSeenTime(e)},/**
1324
1411
  * Get user audiences
1325
1412
  * @method getuserAudiences
1326
1413
  * @param {Function} [callback] A callback function that is invoked when the user audience request completes
1327
1414
  */ // https://go.mparticle.com/work/SQDSDKS-6436
1328
- getUserAudiences:function getUserAudiences(c){// user audience API is feature flagged
1329
- return a._Helpers.getFeatureFlag(FeatureFlags$1.AudienceAPI)?void(null===d.audienceManager&&(d.audienceManager=new AudienceManager(a._Store.SDKConfig.userAudienceUrl,a._Store.devToken,a.Logger,b)),d.audienceManager.sendGetUserAudienceRequest(b,c)):void a.Logger.error(ErrorMessages.AudienceAPINotEnabled)}}},this.mParticleUserCart=function(){return {/**
1415
+ getUserAudiences:function getUserAudiences(r){// user audience API is feature flagged
1416
+ return t._Helpers.getFeatureFlag(FeatureFlags$1.AudienceAPI)?void(null===s.audienceManager&&(s.audienceManager=new AudienceManager(t._Store.SDKConfig.userAudienceUrl,t._Store.devToken,t.Logger,e)),s.audienceManager.sendGetUserAudienceRequest(e,r)):void t.Logger.error(ErrorMessages.AudienceAPINotEnabled)}}},this.mParticleUserCart=function(){return {/**
1330
1417
  * Adds a cart product to the user cart
1331
1418
  * @method add
1332
1419
  * @deprecated
1333
- */add:function add(){a.Logger.warning(generateDeprecationMessage("Identity.getCurrentUser().getCart().add()",!0,"eCommerce.logProductAction()","https://docs.mparticle.com/developers/sdk/web/commerce-tracking"));},/**
1420
+ */add:function add(){t.Logger.warning(generateDeprecationMessage("Identity.getCurrentUser().getCart().add()",!0,"eCommerce.logProductAction()","https://docs.mparticle.com/developers/sdk/web/commerce-tracking"));},/**
1334
1421
  * Removes a cart product from the current user cart
1335
1422
  * @method remove
1336
1423
  * @deprecated
1337
- */remove:function remove(){a.Logger.warning(generateDeprecationMessage("Identity.getCurrentUser().getCart().remove()",!0,"eCommerce.logProductAction()","https://docs.mparticle.com/developers/sdk/web/commerce-tracking"));},/**
1424
+ */remove:function remove(){t.Logger.warning(generateDeprecationMessage("Identity.getCurrentUser().getCart().remove()",!0,"eCommerce.logProductAction()","https://docs.mparticle.com/developers/sdk/web/commerce-tracking"));},/**
1338
1425
  * Clears the user's cart
1339
1426
  * @method clear
1340
1427
  * @deprecated
1341
- */clear:function clear(){a.Logger.warning(generateDeprecationMessage("Identity.getCurrentUser().getCart().clear()",!0,"","https://docs.mparticle.com/developers/sdk/web/commerce-tracking"));},/**
1428
+ */clear:function clear(){t.Logger.warning(generateDeprecationMessage("Identity.getCurrentUser().getCart().clear()",!0,"","https://docs.mparticle.com/developers/sdk/web/commerce-tracking"));},/**
1342
1429
  * Returns all cart products
1343
1430
  * @method getCartProducts
1344
1431
  * @return {Array} array of cart products
1345
1432
  * @deprecated
1346
- */getCartProducts:function getCartProducts(){return a.Logger.warning(generateDeprecationMessage("Identity.getCurrentUser().getCart().getCartProducts()",!0,"eCommerce.logProductAction()","https://docs.mparticle.com/developers/sdk/web/commerce-tracking")),[]}}},this.parseIdentityResponse=function(b,d,f,g,h,i,j){var k,l,m,n=a.Identity.getUser(d),o=n?n.getMPID():null,p=n?n.getUserIdentities().userIdentities:{},q={};a._Store.identityCallInFlight=!1;try{var r,s,t;if(a.Logger.verbose("Parsing \""+h+"\" identity response from server"),l=null!==(r=b.responseText)&&void 0!==r?r:null,a._Store.isLoggedIn=(null===(s=l)||void 0===s?void 0:s.is_logged_in)||!1,hasMPIDChanged(n,l)&&(a._Store.mpid=l.mpid,n&&a._Persistence.setLastSeenTime(d),k=!a._Persistence.getFirstSeenTime(l.mpid),a._Persistence.setFirstSeenTime(l.mpid)),b.status===HTTP_OK){var u;c(CacheIdentity)&&cacheOrClearIdCache(h,i,e.idCache,b,j);var v=e.IdentityAPI.getUser(l.mpid),w=v?v.getUserIdentities().userIdentities:{};h===Modify$1?(q=a._Identity.IdentityRequest.combineUserIdentities(p,g.userIdentities),a._Store.setUserIdentities(d,q)):(h===Identify&&n&&l.mpid===o&&a._Persistence.setFirstSeenTime(l.mpid),a._Store.addMpidToSessionHistory(l.mpid,d),a._CookieSyncManager.attemptCookieSync(l.mpid,k),a._Persistence.swapCurrentUser(d,l.mpid,a._Store.currentSessionMPIDs),g&&!isEmpty(g.userIdentities)&&(q=e.IdentityRequest.combineUserIdentities(w,g.userIdentities)),a._Store.setUserIdentities(l.mpid,q),a._Persistence.update(),a._Store.syncPersistenceData(),a._Persistence.findPrevCookiesBasedOnUI(g),a._Store.context=l.context||a._Store.context),m=a.Identity.getCurrentUser(),tryOnUserAlias(n,m,g,a.Logger);var x=a._Persistence.getPersistence();m&&(a._Persistence.storeDataInMemory(x,m.getMPID()),e.reinitForwardersOnUserChange(n,m),e.setForwarderCallbacks(m,h));var y=IdentityType.getNewIdentitiesByName(q),z=h===Modify$1?p:w;// Sync $NoTargeting before sendUserIdentityChangeEvent
1433
+ */getCartProducts:function getCartProducts(){return t.Logger.warning(generateDeprecationMessage("Identity.getCurrentUser().getCart().getCartProducts()",!0,"eCommerce.logProductAction()","https://docs.mparticle.com/developers/sdk/web/commerce-tracking")),[]}}},this.parseIdentityResponse=function(r,i,d,a,o,g,l){var u,p,y,I=t.Identity.getUser(i),c=I?I.getMPID():null,_=I?I.getUserIdentities().userIdentities:{},v={};t._Store.identityCallInFlight=!1;try{var m,b,S;if(t.Logger.verbose("Parsing \""+o+"\" identity response from server"),p=null!==(m=r.responseText)&&void 0!==m?m:null,t._Store.isLoggedIn=(null===(b=p)||void 0===b?void 0:b.is_logged_in)||!1,hasMPIDChanged(I,p)&&(t._Store.mpid=p.mpid,I&&t._Persistence.setLastSeenTime(i),u=!t._Persistence.getFirstSeenTime(p.mpid),t._Persistence.setFirstSeenTime(p.mpid)),r.status===HTTP_OK){var A;s(CacheIdentity)&&cacheOrClearIdCache(o,g,n.idCache,r,l);var k=n.IdentityAPI.getUser(p.mpid),U=k?k.getUserIdentities().userIdentities:{};o===Modify$1?(v=t._Identity.IdentityRequest.combineUserIdentities(_,a.userIdentities),t._Store.setUserIdentities(i,v)):(o===Identify&&I&&p.mpid===c&&t._Persistence.setFirstSeenTime(p.mpid),t._Store.addMpidToSessionHistory(p.mpid,i),t._CookieSyncManager.attemptCookieSync(p.mpid,u),t._Persistence.swapCurrentUser(i,p.mpid,t._Store.currentSessionMPIDs),a&&!isEmpty(a.userIdentities)&&(v=n.IdentityRequest.combineUserIdentities(U,a.userIdentities)),t._Store.setUserIdentities(p.mpid,v),t._Persistence.update(),t._Store.syncPersistenceData(),t._Persistence.findPrevCookiesBasedOnUI(a),t._Store.context=p.context||t._Store.context),y=t.Identity.getCurrentUser(),tryOnUserAlias(I,y,a,t.Logger);var P=t._Persistence.getPersistence();y&&(t._Persistence.storeDataInMemory(P,y.getMPID()),n.reinitForwardersOnUserChange(I,y),n.setForwarderCallbacks(y,o));var C=IdentityType.getNewIdentitiesByName(v),f=o===Modify$1?_:U;// Sync $NoTargeting before sendUserIdentityChangeEvent
1347
1434
  // because UIC events call sendEventToServer which triggers
1348
1435
  // processQueuedEvents, draining the event queue. The
1349
1436
  // attribute must be in the store before that happens so
1350
1437
  // appendUserInfo picks it up.
1351
- null===(u=a._CookieConsentManager)||void 0===u||u.syncNoTargetingAttribute(m),e.sendUserIdentityChangeEvent(y,h,l.mpid,z);}if(f){var A=0===b.status?HTTPCodes$2.noHttpCoverage:b.status;a._Helpers.invokeCallback(f,A,l||null,m);}else l&&!isEmpty(l.errors)&&// https://go.mparticle.com/work/SQDSDKS-6500
1352
- a.Logger.error("Received HTTP response code of "+b.status+" - "+l.errors[0].message);a.Logger.verbose("Successfully parsed Identity Response"),null===(t=a._APIClient)||void 0===t||t.processQueuedEvents();}catch(c){f&&a._Helpers.invokeCallback(f,b.status,l||null),a.Logger.error("Error parsing JSON response from Identity server: "+c);}a._Store.isInitialized=!0,a._RoktManager.onIdentityComplete(),a._preInit.readyQueue=processReadyQueue(a._preInit.readyQueue);},this.sendUserIdentityChangeEvent=function(b,c,d,f){if(d||c===Modify$1)// https://go.mparticle.com/work/SQDSDKS-6501
1438
+ null===(A=t._CookieConsentManager)||void 0===A||A.syncNoTargetingAttribute(y),n.sendUserIdentityChangeEvent(C,o,p.mpid,f);}if(d){var w=0===r.status?HTTPCodes$2.noHttpCoverage:r.status;t._Helpers.invokeCallback(d,w,p||null,y);}else p&&!isEmpty(p.errors)&&// https://go.mparticle.com/work/SQDSDKS-6500
1439
+ t.Logger.error("Received HTTP response code of "+r.status+" - "+p.errors[0].message);t.Logger.verbose("Successfully parsed Identity Response"),null===(S=t._APIClient)||void 0===S||S.processQueuedEvents();}catch(s){d&&t._Helpers.invokeCallback(d,r.status,p||null),t.Logger.error("Error parsing JSON response from Identity server: "+s);}t._Store.isInitialized=!0,t._RoktManager.onIdentityComplete(),t._preInit.readyQueue=processReadyQueue(t._preInit.readyQueue);},this.sendUserIdentityChangeEvent=function(e,r,s,i){if(s||r===Modify$1)// https://go.mparticle.com/work/SQDSDKS-6501
1353
1440
  {// https://go.mparticle.com/work/SQDSDKS-6354
1354
- var g=this.IdentityAPI.getUser(d);for(var h in b)// Verifies a change actually happened
1355
- if(f[h]!==b[h]){var i,j=!f[h],k=e.createUserIdentityChange(h,b[h],f[h],j,g);// If a new identity type was introduced when the identity changes
1441
+ var d=this.IdentityAPI.getUser(s);for(var a in e)// Verifies a change actually happened
1442
+ if(i[a]!==e[a]){var o,g=!i[a],l=n.createUserIdentityChange(a,e[a],i[a],g,d);// If a new identity type was introduced when the identity changes
1356
1443
  // we need to notify the server so that the user profile is updated in
1357
1444
  // the mParticle UI.
1358
- null===(i=a._APIClient)||void 0===i||i.sendEventToServer(k);}}},this.createUserIdentityChange=function(b,c,d,e,f){var g;// https://go.mparticle.com/work/SQDSDKS-6439
1359
- return g=a._ServerModel.createEventObject({messageType:Types.MessageType.UserIdentityChange,userIdentityChanges:{New:{IdentityType:b,Identity:c,CreatedThisBatch:e},Old:{IdentityType:b,Identity:d,CreatedThisBatch:!1}},userInMemory:f}),g},this.sendUserAttributeChangeEvent=function(b,c,d,f,g,h){var i=e.createUserAttributeChange(b,c,d,f,g,h);if(i){var j;null===(j=a._APIClient)||void 0===j||j.sendEventToServer(i);}},this.createUserAttributeChange=function(b,c,d,e,f,g){"undefined"==typeof d&&(d=null);var h;return c!==d&&(h=a._ServerModel.createEventObject({messageType:Types.MessageType.UserAttributeChange,userAttributeChanges:{UserAttributeName:b,New:c,Old:d,Deleted:f,IsNewAttribute:e}},g)),h},this.reinitForwardersOnUserChange=function(b,c){if(hasMPIDAndUserLoginChanged(b,c)){var d;null===(d=a._Forwarders)||void 0===d||d.initForwarders(c.getUserIdentities().userIdentities,a._APIClient.prepareForwardingStats);}},this.setForwarderCallbacks=function(b,c){var d,e,f;// https://go.mparticle.com/work/SQDSDKS-6036
1360
- null===(d=a._Forwarders)||void 0===d||d.setForwarderUserIdentities(b.getUserIdentities().userIdentities),null===(e=a._Forwarders)||void 0===e||e.setForwarderOnIdentityComplete(b,c),null===(f=a._Forwarders)||void 0===f||f.setForwarderOnUserIdentified(b);};}// https://go.mparticle.com/work/SQDSDKS-6359
1361
- function tryOnUserAlias(a,b,c,d){if(c&&c.onUserAlias&&isFunction(c.onUserAlias))try{d.warning(generateDeprecationMessage("onUserAlias")),c.onUserAlias(a,b);}catch(a){d.error("There was an error with your onUserAlias function - "+a);}}
1445
+ null===(o=t._APIClient)||void 0===o||o.sendEventToServer(l);}}},this.createUserIdentityChange=function(e,r,s,i,n){var d;// https://go.mparticle.com/work/SQDSDKS-6439
1446
+ return d=t._ServerModel.createEventObject({messageType:Types.MessageType.UserIdentityChange,userIdentityChanges:{New:{IdentityType:e,Identity:r,CreatedThisBatch:i},Old:{IdentityType:e,Identity:s,CreatedThisBatch:!1}},userInMemory:n}),d},this.sendUserAttributeChangeEvent=function(e,r,s,i,d,a){var o=n.createUserAttributeChange(e,r,s,i,d,a);if(o){var g;null===(g=t._APIClient)||void 0===g||g.sendEventToServer(o);}},this.createUserAttributeChange=function(e,r,s,i,n,d){"undefined"==typeof s&&(s=null);var a;return r!==s&&(a=t._ServerModel.createEventObject({messageType:Types.MessageType.UserAttributeChange,userAttributeChanges:{UserAttributeName:e,New:r,Old:s,Deleted:n,IsNewAttribute:i}},d)),a},this.reinitForwardersOnUserChange=function(e,r){if(hasMPIDAndUserLoginChanged(e,r)){var s;null===(s=t._Forwarders)||void 0===s||s.initForwarders(r.getUserIdentities().userIdentities,t._APIClient.prepareForwardingStats);}},this.setForwarderCallbacks=function(e,r){var s,i,n;// https://go.mparticle.com/work/SQDSDKS-6036
1447
+ null===(s=t._Forwarders)||void 0===s||s.setForwarderUserIdentities(e.getUserIdentities().userIdentities),null===(i=t._Forwarders)||void 0===i||i.setForwarderOnIdentityComplete(e,r),null===(n=t._Forwarders)||void 0===n||n.setForwarderOnUserIdentified(e);};}// https://go.mparticle.com/work/SQDSDKS-6359
1448
+ 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);}}
1362
1449
 
1363
1450
  var CCPAPurpose=Constants.CCPAPurpose;function Consent(a){var b=this;// this function is called when consent is required to
1364
1451
  // determine if a cookie sync should happen, or a
@@ -1453,8 +1540,6 @@ return !("boolean"==typeof b&&b)&&"object"===_typeof$1(b)&&!0!==b[a];// When "Bl
1453
1540
  var buildUrl=function(a,b,c,d){var e=d?"1":"0",f=["env=".concat(e)],g=c||{},h=g.planId,i=g.planVersion;return h&&f.push("plan_id=".concat(h)),i&&f.push("plan_version=".concat(i)),"".concat(a+b+"/config","?").concat(f.join("&"))};function ConfigAPIClient(a,b,c){var d=this,e="https://"+c._Store.SDKConfig.configUrl,f=b.isDevelopmentMode,g=b.dataPlan,h=buildUrl(e,a,g,f),i=window.fetch?new FetchUploader(h):new XHRUploader(h);this.getSDKConfiguration=function(){return __awaiter(d,void 0,void 0,function(){var a,d,e,f,h,j,k;return __generator(this,function(l){switch(l.label){case 0:d={method:"get",headers:{Accept:"text/plain;charset=UTF-8","Content-Type":"text/plain;charset=UTF-8"},body:null},l.label=1;case 1:return l.trys.push([1,6,,7]),[4/*yield*/,i.upload(d)];case 2:return (e=l.sent(),200!==e.status)?[3/*break*/,5]:(null===(h=null===c||void 0===c?void 0:c.Logger)||void 0===h?void 0:h.verbose("Successfully received configuration from server"),e.json?[4/*yield*/,e.json()]:[3/*break*/,4]);case 3:return a=l.sent(),[2/*return*/,a];case 4:return f=e,a=JSON.parse(f.responseText),[2/*return*/,a];case 5:return null===(j=null===c||void 0===c?void 0:c.Logger)||void 0===j?void 0:j.verbose("Issue with receiving configuration from server, received HTTP Code of "+e.statusText),[3/*break*/,7];case 6:return l.sent(),null===(k=null===c||void 0===c?void 0:c.Logger)||void 0===k?void 0:k.error("Error getting forwarder configuration from mParticle servers."),[3/*break*/,7];case 7:// Returns the original config object if we cannot retrieve the remote config
1454
1541
  return [2/*return*/,b]}})})};}
1455
1542
 
1456
- var ErrorCodes={UNKNOWN_ERROR:"UNKNOWN_ERROR",UNHANDLED_EXCEPTION:"UNHANDLED_EXCEPTION",IDENTITY_REQUEST:"IDENTITY_REQUEST",IDENTITY_MISMATCH:"IDENTITY_MISMATCH",ROKT_KIT_ATTACHED:"ROKT_KIT_ATTACHED"};var WSDKErrorSeverity={ERROR:"ERROR",INFO:"INFO",WARNING:"WARNING"};
1457
-
1458
1543
  var HTTPCodes$1=Constants.HTTPCodes,Messages$1=Constants.Messages,IdentityMethods=Constants.IdentityMethods,Modify=IdentityMethods.Modify;function IdentityAPIClient(a){this.sendAliasRequest=function(b,c){return __awaiter(this,void 0,void 0,function(){var d,e,f,g,h,i,j,k,l,m,n,o,q,r,s,n;return __generator(this,function(t){switch(t.label){case 0:d=a.Logger,e=a._Helpers.invokeAliasCallback,f=a._Store.SDKConfig.aliasUrl,g=a._Store.devToken,d.verbose(Messages$1.InformationMessages.SendAliasHttp),h="https://".concat(f).concat(g,"/Alias"),i=window.fetch?new FetchUploader(h):new XHRUploader(h),j={method:"post",headers:{Accept:"text/plain;charset=UTF-8","Content-Type":"application/json"},body:JSON.stringify(b)},t.label=1;case 1:return t.trys.push([1,13,,14]),[4/*yield*/,i.upload(j)];case 2:return k=t.sent(),l=void 0,m=void 0,n=void 0,o=k.status,o===HTTP_ACCEPTED?[3/*break*/,3]:o===HTTP_OK?[3/*break*/,3]:o===HTTP_BAD_REQUEST?[3/*break*/,4]:[3/*break*/,11];case 3:return m="Received Alias Response from server: "+JSON.stringify(k.status),[3/*break*/,12];case 4:if(!k.json)return [3/*break*/,9];t.label=5;case 5:return t.trys.push([5,7,,8]),[4/*yield*/,k.json()];case 6:return l=t.sent(),[3/*break*/,8];case 7:return t.sent(),d.verbose("The request has no response body"),[3/*break*/,8];case 8:return [3/*break*/,10];case 9:q=k,l=q.responseText?JSON.parse(q.responseText):"",t.label=10;case 10:return r=l,(null===r||void 0===r?void 0:r.message)&&(n=r.message),m="Issue with sending Alias Request to mParticle Servers, received HTTP Code of "+k.status,(null===r||void 0===r?void 0:r.code)&&(m+=" - "+r.code),[3/*break*/,12];case 11:throw new Error("Received HTTP Code of "+k.status);case 12:return d.verbose(m),e(c,k.status,n),[3/*break*/,14];case 13:return s=t.sent(),n=s.message||s.toString(),d.error("Error sending alias request to mParticle servers. "+n),e(c,HTTPCodes$1.noHttpCoverage,n),[3/*break*/,14];case 14:return [2/*return*/]}})})},this.sendIdentityRequest=function(b,c,d,e,f,g,h){var i,j,k,l;return __awaiter(this,void 0,void 0,function(){var m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,A,m,E,m,A,F;return __generator(this,function(G){switch(G.label){case 0:if((null===(i=a._RoktManager)||void 0===i?void 0:i.isInitialized)&&(a._Store.identifyRequestCount=(a._Store.identifyRequestCount||0)+1,m=a._Store.identifyRequestCount,a.captureTiming("".concat(m,"-identityRequestStart"))),n=a._Helpers.invokeCallback,o=a.Logger,p=a._ErrorReportingDispatcher,o.verbose(Messages$1.InformationMessages.SendIdentityBegin),!b)return o.error(Messages$1.ErrorMessages.APIRequestEmpty),[2/*return*/];if(o.verbose(Messages$1.InformationMessages.SendIdentityHttp),a._Store.identityCallInFlight)return n(d,HTTPCodes$1.activeIdentityRequest,"There is currently an Identity request processing. Please wait for this to return before requesting again"),[2/*return*/];q=g||null,r=this.getUploadUrl(c,g),s=window.fetch?new FetchUploader(r):new XHRUploader(r),t={method:"post",headers:{Accept:"text/plain;charset=UTF-8","Content-Type":"application/json","x-mp-key":a._Store.devToken},body:JSON.stringify(b)},a._Store.identityCallInFlight=!0,G.label=1;case 1:return G.trys.push([1,9,,10]),[4/*yield*/,s.upload(t)];case 2:return u=G.sent(),v=void 0,w=void 0,x=u.status,x===HTTP_ACCEPTED?[3/*break*/,3]:x===HTTP_OK?[3/*break*/,3]:x===HTTP_BAD_REQUEST?[3/*break*/,3]:[3/*break*/,7];case 3:return u.json?[4/*yield*/,u.json()]:[3/*break*/,5];case 4:return y=G.sent(),v=this.getIdentityResponseFromFetch(u,y),[3/*break*/,6];case 5:v=this.getIdentityResponseFromXHR(u),G.label=6;case 6:return v.status===HTTP_BAD_REQUEST?(z=v.responseText,w="Issue with sending Identity Request to mParticle Servers, received HTTP Code of "+v.status,(null===z||void 0===z?void 0:z.Errors)&&(A=z.Errors.map(function(a){return a.message}).join(", "),w+=" - "+A)):o.isVerbose()&&(B=v.responseText,C=a._Store.SDKConfig.isDevelopmentMode,D=B,!C&&(null===B||void 0===B?void 0:B.matched_identities)&&(D=__assign(__assign({},B),{matched_identities:obfuscateData(B.matched_identities)})),w="Received Identity Response from server: "+JSON.stringify(D)),[3/*break*/,8];case 7:{if(u.status>=HTTP_SERVER_ERROR)throw new Error("Received HTTP Code of "+u.status);return a._Store.identityCallInFlight=!1,a._Store.identityCallFailed=!1,A="Received HTTP Code of "+u.status,o.error("Error sending identity request to servers - "+A),n(d,HTTPCodes$1.noHttpCoverage,A),[2/*return*/]}case 8:return a._Store.identityCallInFlight=!1,a._Store.identityCallFailed=!1,w&&o.verbose(w),(null===(j=a._RoktManager)||void 0===j?void 0:j.isInitialized)&&(m=a._Store.identifyRequestCount,a.captureTiming("".concat(m,"-identityRequestEnd"))),f(v,q,d,e,c,h,!1),[3/*break*/,10];case 9:return E=G.sent(),a._Store.identityCallInFlight=!1,a._Store.identityCallFailed=!0,(null===(k=a._RoktManager)||void 0===k?void 0:k.isInitialized)&&(m=a._Store.identifyRequestCount,a.captureTiming("".concat(m,"-identityRequestEnd"))),A=E.message||E.toString(),F="Error sending identity request to servers - "+A,o.error(F),null===p||void 0===p?void 0:p.report({message:F,code:ErrorCodes.IDENTITY_REQUEST,severity:WSDKErrorSeverity.ERROR}),null===(l=a.processQueueOnIdentityFailure)||void 0===l?void 0:l.call(a),n(d,HTTPCodes$1.noHttpCoverage,A),[3/*break*/,10];case 10:return [2/*return*/]}})})},this.getUploadUrl=function(b,c){var d=a._Helpers.createServiceUrl(a._Store.SDKConfig.identityUrl),e=b===Modify?d+c+"/"+b:d+b;return e},this.getIdentityResponseFromFetch=function(a,b){return {status:a.status,responseText:b,cacheMaxAge:parseInt(a.headers.get(CACHE_HEADER))||0,expireTimestamp:0}},this.getIdentityResponseFromXHR=function(a){return {status:a.status,responseText:a.responseText?JSON.parse(a.responseText):{},cacheMaxAge:parseNumber(a.getResponseHeader(CACHE_HEADER)||""),expireTimestamp:0}};}
1459
1544
 
1460
1545
  // The formatted ClickID value must be of the form version.subdomainIndex.creationTime.<fbclid>, where:
@@ -1744,6 +1829,6 @@ Array.prototype.forEach||(Array.prototype.forEach=Polyfill.forEach),Array.protot
1744
1829
  * @param {String} apiKey your mParticle assigned API key
1745
1830
  * @param {Object} [config] an options object for additional configuration
1746
1831
  * @param {String} [instanceName] If you are self hosting the JS SDK and working with multiple instances, you would pass an instanceName to `init`. This instance will be selected when invoking other methods. See the above link to the doc site for more info and examples.
1747
- */this.Store={},this._instances={},this.IdentityType=IdentityType,this.EventType=EventType,this.CommerceEventType=CommerceEventType,this.PromotionType=PromotionActionType,this.ProductActionType=ProductActionType,this.MPSideloadedKit=MPSideloadedKit,"undefined"!=typeof window&&(this.isIOS=!!(window.mParticle&&window.mParticle.isIOS)&&window.mParticle.isIOS,this.config=window.mParticle&&window.mParticle.config?window.mParticle.config:{}),this.init=function(b,c,d){!c&&window.mParticle&&window.mParticle.config&&(console.warn("You did not pass a config object to mParticle.init(). Attempting to use the window.mParticle.config if it exists. Please note that in a future release, this may not work and mParticle will not initialize properly"),c=window.mParticle?window.mParticle.config:{}),d=(d&&0!==d.length?d:Constants.DefaultInstance).toLowerCase();var e=a._instances[d];e===void 0&&(e=new mParticleInstance(d),a._instances[d]=e),e.captureTiming(PerformanceMarkType.SdkStart),e.setLauncherInstanceGuid(),e.init(b,c,d);},this.captureTiming=function(b){a.getInstance().captureTiming(b);},this.getInstance=function(b){var c;return b?(c=a._instances[b.toLowerCase()],c?c:(console.log("You tried to initialize an instance named "+b+". This instance does not exist. Check your instance name or initialize a new instance with this name before calling it."),null)):(b=Constants.DefaultInstance,c=a._instances[b],c||(c=new mParticleInstance(b),a._instances[Constants.DefaultInstance]=c),c)},this.Rokt=a.getInstance()._RoktManager,this.getDeviceId=function(){return a.getInstance().getDeviceId()},this.setDeviceId=function(b){return a.getInstance().setDeviceId(b)},this.isInitialized=function(){return a.getInstance().isInitialized()},this.startNewSession=function(){a.getInstance().startNewSession();},this.endSession=function(){a.getInstance().endSession();},this.setLogLevel=function(b){a.getInstance().setLogLevel(b);},this.ready=function(b){a.getInstance().ready(b);},this.setAppVersion=function(b){a.getInstance().setAppVersion(b);},this.getAppName=function(){return a.getInstance().getAppName()},this.setAppName=function(b){a.getInstance().setAppName(b);},this.getAppVersion=function(){return a.getInstance().getAppVersion()},this.getEnvironment=function(){return a.getInstance().getEnvironment()},this.stopTrackingLocation=function(){a.getInstance().stopTrackingLocation();},this.startTrackingLocation=function(b){a.getInstance().startTrackingLocation(b);},this.setPosition=function(b,c){a.getInstance().setPosition(b,c);},this.logBaseEvent=function(b,c){a.getInstance().logBaseEvent(b,c);},this.logEvent=function(b,c,d,e,f){a.getInstance().logEvent(b,c,d,e,f);},this.logError=function(b,c){a.getInstance().logError(b,c);},this.logLink=function(b,c,d,e){a.getInstance().logLink(b,c,d,e);},this.logForm=function(b,c,d,e){a.getInstance().logForm(b,c,d,e);},this.logPageView=function(b,c,d,e){a.getInstance().logPageView(b,c,d,e);},this.upload=function(){a.getInstance().upload();},this.eCommerce={Cart:{add:function add(b,c){a.getInstance().eCommerce.Cart.add(b,c);},remove:function remove(b,c){a.getInstance().eCommerce.Cart.remove(b,c);},clear:function clear(){a.getInstance().eCommerce.Cart.clear();}},setCurrencyCode:function setCurrencyCode(b){a.getInstance().eCommerce.setCurrencyCode(b);},createProduct:function createProduct(b,c,d,e,f,g,h,i,j,k){return a.getInstance().eCommerce.createProduct(b,c,d,e,f,g,h,i,j,k)},createPromotion:function createPromotion(b,c,d,e){return a.getInstance().eCommerce.createPromotion(b,c,d,e)},createImpression:function createImpression(b,c){return a.getInstance().eCommerce.createImpression(b,c)},createTransactionAttributes:function createTransactionAttributes(b,c,d,e,f,g){return a.getInstance().eCommerce.createTransactionAttributes(b,c,d,e,f,g)},logCheckout:function logCheckout(b,c,d,e){a.getInstance().eCommerce.logCheckout(b,c,d,e);},logProductAction:function logProductAction(b,c,d,e,f,g){a.getInstance().eCommerce.logProductAction(b,c,d,e,f,g);},logPurchase:function logPurchase(b,c,d,e,f){a.getInstance().eCommerce.logPurchase(b,c,d,e,f);},logPromotion:function logPromotion(b,c,d,e,f){a.getInstance().eCommerce.logPromotion(b,c,d,e,f);},logImpression:function logImpression(b,c,d,e){a.getInstance().eCommerce.logImpression(b,c,d,e);},logRefund:function logRefund(b,c,d,e,f){a.getInstance().eCommerce.logRefund(b,c,d,e,f);},expandCommerceEvent:function expandCommerceEvent(b){return a.getInstance().eCommerce.expandCommerceEvent(b)}},this.setSessionAttribute=function(b,c){a.getInstance().setSessionAttribute(b,c);},this.setOptOut=function(b){a.getInstance().setOptOut(b);},this.setIntegrationAttribute=function(b,c){a.getInstance().setIntegrationAttribute(b,c);},this.getIntegrationAttributes=function(b){return a.getInstance().getIntegrationAttributes(b)},this.Identity={HTTPCodes:Constants.HTTPCodes,aliasUsers:function aliasUsers(b,c){a.getInstance().Identity.aliasUsers(b,c);},createAliasRequest:function createAliasRequest(b,c,d){return a.getInstance().Identity.createAliasRequest(b,c,d)},getCurrentUser:function getCurrentUser(){return a.getInstance().Identity.getCurrentUser()},getUser:function getUser(b){return a.getInstance().Identity.getUser(b)},getUsers:function getUsers(){return a.getInstance().Identity.getUsers()},identify:function identify(b,c){a.getInstance().Identity.identify(b,c);},login:function login(b,c){a.getInstance().Identity.login(b,c);},logout:function logout(b,c){a.getInstance().Identity.logout(b,c);},modify:function modify(b,c){a.getInstance().Identity.modify(b,c);}},this.sessionManager={getSession:function getSession(){return a.getInstance()._SessionManager.getSessionId()}},this.Consent={createConsentState:function createConsentState(){return a.getInstance().Consent.createConsentState()},createGDPRConsent:function createGDPRConsent(b,c,d,e,f){return a.getInstance().Consent.createGDPRConsent(b,c,d,e,f)},createCCPAConsent:function createCCPAConsent(b,c,d,e,f){return a.getInstance().Consent.createGDPRConsent(b,c,d,e,f)}},this.reset=function(){a.getInstance().reset(a.getInstance());},this._resetForTests=function(b,c){"boolean"==typeof c?a.getInstance()._resetForTests(b,c,a.getInstance()):a.getInstance()._resetForTests(b,!1,a.getInstance());},this.configurePixel=function(b){a.getInstance().configurePixel(b);},this._setIntegrationDelay=function(b,c){a.getInstance()._setIntegrationDelay(b,c);},this._getIntegrationDelays=function(){return a.getInstance()._getIntegrationDelays()},this.getVersion=function(){return a.getInstance().getVersion()},this.generateHash=function(b){return a.getInstance().generateHash(b)},this.addForwarder=function(b){a.getInstance().addForwarder(b);},this._getActiveForwarders=function(){return a.getInstance()._getActiveForwarders()},this._setWrapperSDKInfo=function(b,c){a.getInstance()._setWrapperSDKInfo(b,c);},this._registerErrorReportingService=function(b){a.getInstance()._registerErrorReportingService(b);},this._registerLoggingService=function(b){a.getInstance()._registerLoggingService(b);};}var mParticleManager=new mParticleInstanceManager;"undefined"!=typeof window&&(window.mParticle=mParticleManager,window.mParticle._BatchValidator=new _BatchValidator);
1832
+ */this.Store={},this._instances={},this.IdentityType=IdentityType,this.EventType=EventType,this.CommerceEventType=CommerceEventType,this.PromotionType=PromotionActionType,this.ProductActionType=ProductActionType,this.MPSideloadedKit=MPSideloadedKit,"undefined"!=typeof window&&(this.isIOS=!!(window.mParticle&&window.mParticle.isIOS)&&window.mParticle.isIOS,this.config=window.mParticle&&window.mParticle.config?window.mParticle.config:{}),this.init=function(b,c,d){!c&&window.mParticle&&window.mParticle.config&&(console.warn("You did not pass a config object to mParticle.init(). Attempting to use the window.mParticle.config if it exists. Please note that in a future release, this may not work and mParticle will not initialize properly"),c=window.mParticle?window.mParticle.config:{}),d=(d&&0!==d.length?d:Constants.DefaultInstance).toLowerCase();var e=a._instances[d];e===void 0&&(e=new mParticleInstance(d),a._instances[d]=e),e.captureTiming(PerformanceMarkType.SdkStart),e.setLauncherInstanceGuid(),e.init(b,c,d);},this.captureTiming=function(b){a.getInstance().captureTiming(b);},this.getInstance=function(b){var c;return b?(c=a._instances[b.toLowerCase()],c?c:(console.log("You tried to initialize an instance named "+b+". This instance does not exist. Check your instance name or initialize a new instance with this name before calling it."),null)):(b=Constants.DefaultInstance,c=a._instances[b],c||(c=new mParticleInstance(b),a._instances[Constants.DefaultInstance]=c),c)},this.Rokt=a.getInstance()._RoktManager,this.getDeviceId=function(){return a.getInstance().getDeviceId()},this.setDeviceId=function(b){return a.getInstance().setDeviceId(b)},this.isInitialized=function(){return a.getInstance().isInitialized()},this.startNewSession=function(){a.getInstance().startNewSession();},this.endSession=function(){a.getInstance().endSession();},this.setLogLevel=function(b){a.getInstance().setLogLevel(b);},this.ready=function(b){a.getInstance().ready(b);},this.setAppVersion=function(b){a.getInstance().setAppVersion(b);},this.getAppName=function(){return a.getInstance().getAppName()},this.setAppName=function(b){a.getInstance().setAppName(b);},this.getAppVersion=function(){return a.getInstance().getAppVersion()},this.getEnvironment=function(){return a.getInstance().getEnvironment()},this.stopTrackingLocation=function(){a.getInstance().stopTrackingLocation();},this.startTrackingLocation=function(b){a.getInstance().startTrackingLocation(b);},this.setPosition=function(b,c){a.getInstance().setPosition(b,c);},this.logBaseEvent=function(b,c){a.getInstance().logBaseEvent(b,c);},this.logEvent=function(b,c,d,e,f){a.getInstance().logEvent(b,c,d,e,f);},this.logError=function(b,c){a.getInstance().logError(b,c);},this.logLink=function(b,c,d,e){a.getInstance().logLink(b,c,d,e);},this.logForm=function(b,c,d,e){a.getInstance().logForm(b,c,d,e);},this.logPageView=function(b,c,d,e){a.getInstance().logPageView(b,c,d,e);},this.upload=function(){a.getInstance().upload();},this.eCommerce={Cart:{add:function add(b,c){a.getInstance().eCommerce.Cart.add(b,c);},remove:function remove(b,c){a.getInstance().eCommerce.Cart.remove(b,c);},clear:function clear(){a.getInstance().eCommerce.Cart.clear();}},setCurrencyCode:function setCurrencyCode(b){a.getInstance().eCommerce.setCurrencyCode(b);},createProduct:function createProduct(b,c,d,e,f,g,h,i,j,k){return a.getInstance().eCommerce.createProduct(b,c,d,e,f,g,h,i,j,k)},createPromotion:function createPromotion(b,c,d,e){return a.getInstance().eCommerce.createPromotion(b,c,d,e)},createImpression:function createImpression(b,c){return a.getInstance().eCommerce.createImpression(b,c)},createTransactionAttributes:function createTransactionAttributes(b,c,d,e,f,g){return a.getInstance().eCommerce.createTransactionAttributes(b,c,d,e,f,g)},logCheckout:function logCheckout(b,c,d,e){a.getInstance().eCommerce.logCheckout(b,c,d,e);},logProductAction:function logProductAction(b,c,d,e,f,g){a.getInstance().eCommerce.logProductAction(b,c,d,e,f,g);},logPurchase:function logPurchase(b,c,d,e,f){a.getInstance().eCommerce.logPurchase(b,c,d,e,f);},logPromotion:function logPromotion(b,c,d,e,f){a.getInstance().eCommerce.logPromotion(b,c,d,e,f);},logImpression:function logImpression(b,c,d,e){a.getInstance().eCommerce.logImpression(b,c,d,e);},logRefund:function logRefund(b,c,d,e,f){a.getInstance().eCommerce.logRefund(b,c,d,e,f);},expandCommerceEvent:function expandCommerceEvent(b){return a.getInstance().eCommerce.expandCommerceEvent(b)}},this.setSessionAttribute=function(b,c){a.getInstance().setSessionAttribute(b,c);},this.setOptOut=function(b){a.getInstance().setOptOut(b);},this.setIntegrationAttribute=function(b,c){a.getInstance().setIntegrationAttribute(b,c);},this.getIntegrationAttributes=function(b){return a.getInstance().getIntegrationAttributes(b)},this.Identity={HTTPCodes:Constants.HTTPCodes,aliasUsers:function aliasUsers(b,c){a.getInstance().Identity.aliasUsers(b,c);},createAliasRequest:function createAliasRequest(b,c,d){return a.getInstance().Identity.createAliasRequest(b,c,d)},getCurrentUser:function getCurrentUser(){return a.getInstance().Identity.getCurrentUser()},getUser:function getUser(b){return a.getInstance().Identity.getUser(b)},getUsers:function getUsers(){return a.getInstance().Identity.getUsers()},identify:function identify(b,c){a.getInstance().Identity.identify(b,c);},login:function login(b,c){a.getInstance().Identity.login(b,c);},logout:function logout(b,c){a.getInstance().Identity.logout(b,c);},modify:function modify(b,c){a.getInstance().Identity.modify(b,c);},search:function search(b,c,d){a.getInstance().Identity.search(b,c,d);}},this.sessionManager={getSession:function getSession(){return a.getInstance()._SessionManager.getSessionId()}},this.Consent={createConsentState:function createConsentState(){return a.getInstance().Consent.createConsentState()},createGDPRConsent:function createGDPRConsent(b,c,d,e,f){return a.getInstance().Consent.createGDPRConsent(b,c,d,e,f)},createCCPAConsent:function createCCPAConsent(b,c,d,e,f){return a.getInstance().Consent.createGDPRConsent(b,c,d,e,f)}},this.reset=function(){a.getInstance().reset(a.getInstance());},this._resetForTests=function(b,c){"boolean"==typeof c?a.getInstance()._resetForTests(b,c,a.getInstance()):a.getInstance()._resetForTests(b,!1,a.getInstance());},this.configurePixel=function(b){a.getInstance().configurePixel(b);},this._setIntegrationDelay=function(b,c){a.getInstance()._setIntegrationDelay(b,c);},this._getIntegrationDelays=function(){return a.getInstance()._getIntegrationDelays()},this.getVersion=function(){return a.getInstance().getVersion()},this.generateHash=function(b){return a.getInstance().generateHash(b)},this.addForwarder=function(b){a.getInstance().addForwarder(b);},this._getActiveForwarders=function(){return a.getInstance()._getActiveForwarders()},this._setWrapperSDKInfo=function(b,c){a.getInstance()._setWrapperSDKInfo(b,c);},this._registerErrorReportingService=function(b){a.getInstance()._registerErrorReportingService(b);},this._registerLoggingService=function(b){a.getInstance()._registerLoggingService(b);};}var mParticleManager=new mParticleInstanceManager;"undefined"!=typeof window&&(window.mParticle=mParticleManager,window.mParticle._BatchValidator=new _BatchValidator);
1748
1833
 
1749
1834
  module.exports = mParticleManager;