@mparticle/web-sdk 3.6.2 → 3.8.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 = "3.6.2";
18
+ var version = "3.8.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",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",cookieNameV4:"mprtcl-v4",currentStorageName:"mprtcl-v4"},DefaultConfig:{cookieDomain:null,cookieExpiration:365,logLevel:null,timeout:300,sessionTimeout:30,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
@@ -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$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
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(hasOwnProp(a,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 +
@@ -147,15 +147,15 @@ var Messages$a=Constants.Messages,createCookieString=function(a){return replaceC
147
147
  // -1e11 -> //-100000000000,
148
148
  "".concat(1e7,"-").concat(1e3,"-").concat(4e3,"-").concat(8e3,"-").concat(1e11).replace(/[018]/g,// zeroes, ones, and eights with
149
149
  generateUniqueId// random hex digits
150
- )},getRampNumber=function(a){if(!a)return 100;var b=generateHash(a);return Math.abs(b%100)+1},isObject=function(a){var b=Object.prototype.toString.call(a);return "[object Object]"===b||"[object Error]"===b},parseNumber=function(a){if(isNaN(a)||!isFinite(a))return 0;var b=parseFloat(a);return isNaN(b)?0:b},parseSettingsString=function(a){try{return a?JSON.parse(a.replace(/&quot;/g,"\"")):[]}catch(a){throw new Error("Settings string contains invalid JSON")}},parseStringOrNumber=function(a){return isStringOrNumber(a)?a:null},replaceCommasWithPipes=function(a){return a.replace(/,/g,"|")},replacePipesWithCommas=function(a){return a.replace(/\|/g,",")},replaceApostrophesWithQuotes=function(a){return a.replace(/\'/g,"\"")},replaceQuotesWithApostrophes=function(a){return a.replace(/\"/g,"'")},replaceMPID=function(a,b){return a.replace("%%mpid%%",b)},replaceAmpWithAmpersand=function(a){return a.replace(/&amp;/g,"&")},createCookieSyncUrl=function(a,b,c,d,e){var f=replaceAmpWithAmpersand(b),g=c?replaceAmpWithAmpersand(c):null,h=replaceMPID(f,a),i=g?replaceMPID(g,a):"",j=h+encodeURIComponent(i);if(d){var k=j.includes("?")?"&":"?";j+="".concat(k,"domain=").concat(d);}if(e){var k=j.includes("?")?"&":"?";j+="".concat(k,"google_hm=").concat(e);}return j},WEB_SAFE_BASE64_REPLACEMENTS={"+":"-","/":"_","=":""},toWebSafeBase64=function(a){return btoa(a).replace(/[+/=]/g,function(a){return WEB_SAFE_BASE64_REPLACEMENTS[a]})},returnConvertedBoolean=function(a){return "false"!==a&&"0"!==a&&!!a},decoded=function(a){return decodeURIComponent(a.replace(/\+/g," "))},converted=function(a){return 0===a.indexOf("\"")&&(a=a.slice(1,-1).replace(/\\"/g,"\"").replace(/\\\\/g,"\\")),a},isString=function(a){return "string"==typeof a},isNumber=function(a){return "number"==typeof a},isBoolean=function(a){return "boolean"==typeof a},isFunction=function(a){return "function"==typeof a},isValidAttributeValue=function(a){return a!==void 0&&!isObject(a)&&!Array.isArray(a)},isValidCustomFlagProperty=function(a){return isNumber(a)||isString(a)||isBoolean(a)},toDataPlanSlug=function(a){// Make sure we are only acting on strings or numbers
151
- return isStringOrNumber(a)?a.toString().toLowerCase().replace(/[^0-9a-zA-Z]+/g,"_"):""},isDataPlanSlug=function(a){return a===toDataPlanSlug(a)},isStringOrNumber=function(a){return isString(a)||isNumber(a)},isEmpty=function(a){return null==a||!(Object.keys(a)||a).length},moveElementToEnd=function(a,b){return a.slice(0,b).concat(a.slice(b+1),a[b])},hasOwnProp=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)},queryStringParser=function(a,b){void 0===b&&(b=[]);var c,d={},e={};if(!a)return d;if("undefined"!=typeof URL&&"undefined"!=typeof URLSearchParams){var f=new URL(a);c=new URLSearchParams(f.search);}else c=queryStringParserFallback(a);return (c.forEach(function(a,b){e[b.toLowerCase()]=a;}),isEmpty(b))?e:(b.forEach(function(a){var b=a.toLowerCase();// Callers pass their own key list, so `name` may not be from this URL.
150
+ )},getRampNumber=function(a){if(!a)return 100;var b=generateHash(a);return Math.abs(b%100)+1},isObject=function(a){var b=Object.prototype.toString.call(a);return "[object Object]"===b||"[object Error]"===b},parseNumber=function(a){if(isNaN(a)||!isFinite(a))return 0;var b=parseFloat(a);return isNaN(b)?0:b},parseSettingsString=function(a){try{return a?JSON.parse(a.replace(/&quot;/g,"\"")):[]}catch(a){throw new Error("Settings string contains invalid JSON")}},parseStringOrNumber=function(a){return isStringOrNumber(a)?a:null},replaceCommasWithPipes=function(a){return a.replace(/,/g,"|")},replacePipesWithCommas=function(a){return a.replace(/\|/g,",")},replaceApostrophesWithQuotes=function(a){return a.replace(/\'/g,"\"")},replaceQuotesWithApostrophes=function(a){return a.replace(/\"/g,"'")},replaceMPID=function(a,b){return a.replace("%%mpid%%",b)},replaceAmpWithAmpersand=function(a){return a.replace(/&amp;/g,"&")},createCookieSyncUrl=function(a,b,c,d,e){var f=replaceAmpWithAmpersand(b),g=c?replaceAmpWithAmpersand(c):null,h=replaceMPID(f,a),i=g?replaceMPID(g,a):"",j=h+encodeURIComponent(i);if(d){var k=j.includes("?")?"&":"?";j+="".concat(k,"domain=").concat(d);}if(e){var k=j.includes("?")?"&":"?";j+="".concat(k,"google_hm=").concat(e);}return j},WEB_SAFE_BASE64_REPLACEMENTS={"+":"-","/":"_","=":""},isLatin1=function(a){return !/[^\u0000-\u00ff]/.test(a)},toWebSafeBase64=function(a){return isLatin1(a)?btoa(a).replace(/[+/=]/g,function(a){return WEB_SAFE_BASE64_REPLACEMENTS[a]}):void 0},returnConvertedBoolean=function(a){return "false"!==a&&"0"!==a&&!!a},decoded=function(a){return decodeURIComponent(a.replace(/\+/g," "))},converted=function(a){return 0===a.indexOf("\"")&&(a=a.slice(1,-1).replace(/\\"/g,"\"").replace(/\\\\/g,"\\")),a},isString=function(a){return "string"==typeof a},isNumber=function(a){return "number"==typeof a},isBoolean=function(a){return "boolean"==typeof a},isFunction=function(a){return "function"==typeof a},isValidAttributeValue=function(a){return a!==void 0&&!isObject(a)&&!Array.isArray(a)},isValidCustomFlagProperty=function(a){return isNumber(a)||isString(a)||isBoolean(a)},toDataPlanSlug=function(a){// Make sure we are only acting on strings or numbers
151
+ return isStringOrNumber(a)?a.toString().toLowerCase().replace(/[^0-9a-zA-Z]+/g,"_"):""},isDataPlanSlug=function(a){return a===toDataPlanSlug(a)},isStringOrNumber=function(a){return isString(a)||isNumber(a)},isEmpty=function(a){return null==a||!(Object.keys(a)||a).length},moveElementToEnd=function(a,b){return a.slice(0,b).concat(a.slice(b+1),a[b])},hasOwnProp=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)},isReservedStoredPropertyName=function(a){return "__proto__"===a||"constructor"===a},isUncopyableMergeName=function(a){return isReservedStoredPropertyName(a)||"prototype"===a},isReservedKitPropertyName=function(a){return isReservedStoredPropertyName(a)||"hasOwnProperty"===a},queryStringParser=function(a,b){void 0===b&&(b=[]);var c,d={},e={};if(!a)return d;if("undefined"!=typeof URL&&"undefined"!=typeof URLSearchParams){var f=new URL(a);c=new URLSearchParams(f.search);}else c=queryStringParserFallback(a);return (c.forEach(function(a,b){e[b.toLowerCase()]=a;}),isEmpty(b))?e:(b.forEach(function(a){var b=a.toLowerCase();// Callers pass their own key list, so `name` may not be from this URL.
152
152
  hasOwnProp(e,b)&&e[b]&&(d[a]=e[b]);}),d)},queryStringParserFallback=function(a){var b={},c=a.split("?")[1]||"",d=c.split("&");return d.forEach(function(a){var c=a.split("="),d=c[0],e=c.slice(1),f=e.join("=");if(d&&void 0!==f)try{b[d]=decodeURIComponent(f||"");}catch(a){console.error("Failed to decode value for key ".concat(d,": ").concat(a));}}),{get:function get(a){return b[a]},forEach:function forEach(a){for(var c in b)// Keys come straight off the URL, so `?hasOwnProperty=1` would
153
153
  // shadow the method and `params.hasOwnProperty(key)` would throw.
154
154
  hasOwnProp(b,c)&&a(b[c],c);}}},getCookies=function(a){// Helper function to parse cookies from document.cookie
155
155
  var b=function parseCookies(){try{return "undefined"==typeof window?[]:window.document.cookie.split(";").map(function(a){return a.trim()})}catch(a){return console.error("Unable to parse cookies",a),[]}}();// Helper function to filter cookies by keys
156
156
  // Parse cookies from document.cookie
157
157
  // Filter cookies by keys if provided
158
- return function filterCookies(a,b){for(var c={},d=0,e=a;d<e.length;d++){var f=e[d],g=f.split("="),h=g[0],i=g[1];(!b||b.includes(h))&&(c[h]=i);}return c}(b,a)},getHref=function(){return "undefined"!=typeof window&&window.location?window.location.href:""},filterDictionaryWithHash=function(a,b,c){var d={};if(!isEmpty(a))for(var e in a)if(a.hasOwnProperty(e)){var f=c(e);inArray(b,f)||(d[e]=a[e]);}return d},parseConfig=function(a,b,c){var d;return (null===(d=a.kitConfigs)||void 0===d?void 0:d.find(function(a){return a.name===b&&a.moduleId===c}))||null},obfuscateData=function(a){// Preserve null and undefined
158
+ return function filterCookies(a,b){for(var c={},d=0,e=a;d<e.length;d++){var f=e[d],g=f.split("="),h=g[0],i=g[1];(!b||b.includes(h))&&(c[h]=i);}return c}(b,a)},getHref=function(){return "undefined"!=typeof window&&window.location?window.location.href:""},filterDictionaryWithHash=function(a,b,c){var d={};if(!isEmpty(a))for(var e in a)if(hasOwnProp(a,e)&&!isReservedKitPropertyName(e)){var f=c(e);inArray(b,f)||(d[e]=a[e]);}return d},parseConfig=function(a,b,c){var d;return (null===(d=a.kitConfigs)||void 0===d?void 0:d.find(function(a){return a.name===b&&a.moduleId===c}))||null},obfuscateData=function(a){// Preserve null and undefined
159
159
  if(null===a||a===void 0)return a;// Handle arrays - recursively obfuscate each element
160
160
  if(Array.isArray(a))return a.map(function(a){return obfuscateData(a)});// Handle objects - recursively obfuscate each property
161
161
  if(isObject(a)){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=obfuscateData(a[c]));return b}// For primitives and other types, return the type as a string
@@ -165,6 +165,7 @@ return _typeof(a)},obfuscateDevData=function(a,b){return b?a:obfuscateData(a)};/
165
165
  // base64 (RFC 4648 §5) without padding, otherwise the write to the hosted
166
166
  // match table fails: https://developers.google.com/authorized-buyers/rtb/cookie-guide
167
167
  // (String#replaceAll is not available in our ES5 browser targets.)
168
+ // btoa is defined only over Latin-1 and throws InvalidCharacterError above U+00FF
168
169
  // FIXME: REFACTOR for V3
169
170
  // only used in store.js to sanitize server-side formatting of
170
171
  // booleans when checking for `isDevelopmentMode`
@@ -176,6 +177,14 @@ return _typeof(a)},obfuscateDevData=function(a,b){return b?a:obfuscateData(a)};/
176
177
  // does not compile under this project's `lib: ["es5", "es6", "dom"]`; widening that
177
178
  // would emit a call absent from every browser before 2021, and this same file still
178
179
  // carries a fallback for browsers with no URLSearchParams.
180
+ // Assigning `__proto__` replaces the target's prototype instead of adding an own
181
+ // property; `constructor` is reserved alongside it by the stored-record contract.
182
+ // `prototype` is deliberately absent: isValidKeyValue accepts it, so setUserAttribute
183
+ // persists it and the getters must hand it back.
184
+ // extend's historical set, which additionally refuses `prototype` when merging.
185
+ // Kit-facing copies stay compatible with conventional own-property iteration, such as
186
+ // attributes.hasOwnProperty(key), which is the one read pattern an attribute of that name
187
+ // interferes with. The public getters keep the name; only this filter drops it.
179
188
  // Get cookies as a dictionary
180
189
  /**
181
190
  * Obfuscates an object by replacing all primitive values with their type names,
@@ -208,7 +217,7 @@ return _typeof(a)},obfuscateDevData=function(a,b){return b?a:obfuscateData(a)};/
208
217
  */ // Standalone version of jQuery.extend, from https://github.com/dansdom/extend
209
218
  // https://go.mparticle.com/work/SQDSDKS-6047
210
219
  function extend(){for(var a=[],b=0;b<arguments.length;b++)a[b]=arguments[b];var c,d,e,f,g,h,j={hasOwn:Object.prototype.hasOwnProperty,class2type:{},type:function type(a){return null==a?a+"":j.class2type[Object.prototype.toString.call(a)]||"object"},isPlainObject:function isPlainObject(a){if(!a||"object"!==j.type(a)||a.nodeType||j.isWindow(a))return !1;try{if(a.constructor&&!j.hasOwn.call(a,"constructor")&&!j.hasOwn.call(a.constructor.prototype,"isPrototypeOf"))return !1}catch(a){return !1}for(var b in a);// eslint-disable-line no-empty
211
- 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(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}var getErrorMessage=function(a,b){return void 0===b&&(b="unknown error"),a instanceof Error?a.message:"string"==typeof a?a:a&&"object"===_typeof(a)&&"string"==typeof a.message?a.message:b;// fetch-mock and some network libs reject with { message } rather than Error
220
+ 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(k)||j.isFunction(k)||(k={}),n===l&&(k={},--l);l<n;l++)if(null!=(c=a[l]))for(d in c)isUncopyableMergeName(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}var getErrorMessage=function(a,b){return void 0===b&&(b="unknown error"),a instanceof Error?a.message:"string"==typeof a?a:a&&"object"===_typeof(a)&&"string"==typeof a.message?a.message:b;// fetch-mock and some network libs reject with { message } rather than Error
212
221
  };
213
222
 
214
223
  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
@@ -217,7 +226,10 @@ getValuesAsStrings:function getValuesAsStrings(){return Object.values(IdentityTy
217
226
  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,// Rokt Brain commerce-adjacent types
218
227
  ViewCart:11,AddShippingInfo:12,AddPaymentInfo:13,PaymentMethodSelected:14,PaymentAttempted:15,PaymentSucceeded:16,PaymentFailed:17,RefundInitiated:18,isRoktCommerceType:function isRoktCommerceType(a){return a>=ProductActionType.ViewCart&&a<=ProductActionType.RefundInitiated},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":a===ProductActionType.ViewCart?"View Cart":a===ProductActionType.AddShippingInfo?"Add Shipping Info":a===ProductActionType.AddPaymentInfo?"Add Payment Info":a===ProductActionType.PaymentMethodSelected?"Payment Method Selected":a===ProductActionType.PaymentAttempted?"Payment Attempted":a===ProductActionType.PaymentSucceeded?"Payment Succeeded":a===ProductActionType.PaymentFailed?"Payment Failed":a===ProductActionType.RefundInitiated?"Refund Initiated":"Unknown"},// these are the action names used by server and mobile SDKs when expanding a CommerceEvent
219
228
  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":a===ProductActionType.ViewCart?"view_cart":a===ProductActionType.AddShippingInfo?"add_shipping_info":a===ProductActionType.AddPaymentInfo?"add_payment_info":a===ProductActionType.PaymentMethodSelected?"payment_method_selected":a===ProductActionType.PaymentAttempted?"payment_attempted":a===ProductActionType.PaymentSucceeded?"payment_succeeded":a===ProductActionType.PaymentFailed?"payment_failed":a===ProductActionType.RefundInitiated?"refund_initiated":"unknown"}};var RoktEvents={SignUp:"sign_up",Subscribe:"subscribe",StartTrial:"start_trial",GenerateLead:"generate_lead",Search:"search",Upsell:"upsell",EarnVirtualCurrency:"earn_virtual_currency",DwellTime:"dwell_time",Hover:"hover",Scroll:"scroll",ClickToExpand:"click_to_expand"};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
220
- getExpansionName:function getExpansionName(a){return a===PromotionActionType.PromotionView?"view":a===PromotionActionType.PromotionClick?"click":"unknown"}};var ProfileMessageType={Logout:3};var ApplicationTransitionType$1={AppInit:1};var PerformanceMarkType={SdkStart:"mp:sdkStart",JointSdkSelectPlacements:"mp:jointSdkSelectPlacements",JointSdkRoktKitInit:"mp:jointSdkRoktKitInit"};var Types = {MessageType:MessageType$1,EventType:EventType,CommerceEventType:CommerceEventType,IdentityType:IdentityType,ProfileMessageType:ProfileMessageType,ApplicationTransitionType:ApplicationTransitionType$1,ProductActionType:ProductActionType,PromotionActionType:PromotionActionType,RoktEvents:RoktEvents,Environment:Constants.Environment};
229
+ getExpansionName:function getExpansionName(a){return a===PromotionActionType.PromotionView?"view":a===PromotionActionType.PromotionClick?"click":"unknown"}};var ProfileMessageType={Logout:3};var ApplicationTransitionType$1={AppInit:1};var PerformanceMarkType={SdkStart:"mp:sdkStart",JointSdkSelectPlacements:"mp:jointSdkSelectPlacements",JointSdkRoktKitInit:"mp:jointSdkRoktKitInit"};// not written by this SDK. The round-trip comparison is load bearing: parseNumber
230
+ // returns 0 for any non-numeric key and IdentityType.Other is 0, so after parsing
231
+ // alone a stored "hasOwnProperty" is indistinguishable from a genuine Other entry.
232
+ function getIdentityTypeFromStoredKey(a){var b=parseNumber(a);return b+""===a&&IdentityType.isValid(b)?b:null}var Types = {MessageType:MessageType$1,EventType:EventType,CommerceEventType:CommerceEventType,IdentityType:IdentityType,ProfileMessageType:ProfileMessageType,ApplicationTransitionType:ApplicationTransitionType$1,ProductActionType:ProductActionType,PromotionActionType:PromotionActionType,RoktEvents:RoktEvents,Environment:Constants.Environment};
221
233
 
222
234
  var SDKProductActionType;(function(a){a[a.Unknown=0]="Unknown",a[a.AddToCart=1]="AddToCart",a[a.RemoveFromCart=2]="RemoveFromCart",a[a.Checkout=3]="Checkout",a[a.CheckoutOption=4]="CheckoutOption",a[a.Click=5]="Click",a[a.ViewDetail=6]="ViewDetail",a[a.Purchase=7]="Purchase",a[a.Refund=8]="Refund",a[a.AddToWishlist=9]="AddToWishlist",a[a.RemoveFromWishlist=10]="RemoveFromWishlist",a[a.ViewCart=11]="ViewCart",a[a.AddShippingInfo=12]="AddShippingInfo",a[a.AddPaymentInfo=13]="AddPaymentInfo",a[a.PaymentMethodSelected=14]="PaymentMethodSelected",a[a.PaymentAttempted=15]="PaymentAttempted",a[a.PaymentSucceeded=16]="PaymentSucceeded",a[a.PaymentFailed=17]="PaymentFailed",a[a.RefundInitiated=18]="RefundInitiated";})(SDKProductActionType||(SDKProductActionType={}));var LogLevelType={None:"none",Verbose:"verbose",Warning:"warning",Error:"error"};
223
235
 
@@ -574,8 +586,7 @@ for(var g in b)if(g==="device_application_stamp")continue;else f[Types.IdentityT
574
586
  // "queued events contain login mpid instead of identify mpid when calling
575
587
  // login immediately after mParticle initializes"
576
588
  var d=null===c||void 0===c?void 0:c.retrieve();// if there is no cache, then there is no valid cached identity
577
- if(!d)return !1;var e=concatenateIdentities(a,b),f=generateHash(e);// if cache doesn't have the cacheKey, there is no valid cached identity
578
- if(!d.hasOwnProperty(f))return !1;// If there is a valid cache key, compare the expireTimestamp to the current time.
589
+ if(!d)return !1;var e=concatenateIdentities(a,b),f=generateHash(e);if(!hasOwnProp(d,f))return !1;// If there is a valid cache key, compare the expireTimestamp to the current time.
579
590
  // If the current time is greater than the expireTimestamp, it is not a valid
580
591
  // cached identity.
581
592
  var g=d[f].expireTimestamp;return !(g<new Date().getTime())};var getCachedIdentity=function(a,b,c){var d=concatenateIdentities(a,b),e=generateHash(d),f=c.retrieve(),g=f?f[e]:null;return {responseText:parseIdentityResponse(g.responseText),expireTimestamp:g.expireTimestamp,status:g.status}};// https://go.mparticle.com/work/SQDSDKS-6079
@@ -629,7 +640,7 @@ var f=Types.IdentityType.getIdentityType(e),g=!1===f;g||c(b,f)||appendFilteredUs
629
640
  // https://go.mparticle.com/work/SQDSDKS-5239
630
641
  // Utility Functions
631
642
  // Imported Validators
632
- this.canLog=function(){return !!(a._Store.isEnabled&&(a._Store.devToken||a._Store.webviewBridgeEnabled))},this.getFeatureFlag=function(b){return a._Store.SDKConfig.flags.hasOwnProperty(b)?a._Store.SDKConfig.flags[b]:null},this.invokeCallback=function(c,d,e,f,g){c||a.Logger.warning("There is no callback provided");try{b.Validators.isFunction(c)&&c({httpCode:d,body:e,getUser:function getUser(){return f?f:a.Identity.getCurrentUser()},getPreviousUser:function getPreviousUser(){if(!g){var b=a.Identity.getUsers(),c=b.shift(),d=f||a.Identity.getCurrentUser();return c&&d&&c.getMPID()===d.getMPID()&&(c=b.shift()),c||null}return a.Identity.getUser(g)}});}catch(b){a.Logger.error("There was an error with your callback: "+b);}},this.invokeAliasCallback=function(c,d,e){c||a.Logger.warning("There is no callback provided");try{if(b.Validators.isFunction(c)){var f={httpCode:d};e&&(f.message=e),c(f);}}catch(b){a.Logger.error("There was an error with your callback: "+b);}},this.extend=extend,this.createServiceUrl=function(b,c){var d,e=window.mParticle&&a._Store.SDKConfig.forceHttps?"https://":window.location.protocol+"//";return d=a._Store.SDKConfig.forceHttps?"https://"+b:e+b,c&&(d+=c),d},this.createXHR=function(b){var c;try{c=new window.XMLHttpRequest;}catch(b){a.Logger.error("Error creating XMLHttpRequest object.");}if(c&&b&&"withCredentials"in c)c.onreadystatechange=b;else if("undefined"!=typeof window.XDomainRequest){a.Logger.verbose("Creating XDomainRequest object");try{c=new window.XDomainRequest,c.onload=b;}catch(b){a.Logger.error("Error creating XDomainRequest object");}}return c},this.filterUserIdentities=function(a,c){return buildFilteredUserIdentities$1(a,c,b.inArray)},this.filterUserIdentitiesForForwarders=KitFilterHelper.filterUserIdentities,this.filterUserAttributes=KitFilterHelper.filterUserAttributes,this.isEventType=function(a){for(var b in Types.EventType)if(Types.EventType.hasOwnProperty(b)&&Types.EventType[b]===a)return !0;return !1},this.sanitizeAttributes=function(c,d){if(!c||!b.isObject(c))return null;var e={};for(var f in c)// Make sure that attribute values are not objects or arrays, which are not valid
643
+ this.canLog=function(){return !!(a._Store.isEnabled&&(a._Store.devToken||a._Store.webviewBridgeEnabled))},this.getFeatureFlag=function(b){return a._Store.SDKConfig.flags.hasOwnProperty(b)?a._Store.SDKConfig.flags[b]:null},this.invokeCallback=function(c,d,e,f,g){c||a.Logger.warning("There is no callback provided");try{b.Validators.isFunction(c)&&c({httpCode:d,body:e,getUser:function getUser(){return f?f:a.Identity.getCurrentUser()},getPreviousUser:function getPreviousUser(){if(!g){var b=a.Identity.getUsers(),c=b.shift(),d=f||a.Identity.getCurrentUser();return c&&d&&c.getMPID()===d.getMPID()&&(c=b.shift()),c||null}var d=f||a.Identity.getCurrentUser(),e=(null===d||void 0===d?void 0:d.getMPID())===g;return e?null:a.Identity.getUser(g)}});}catch(b){a.Logger.error("There was an error with your callback: "+b);}},this.invokeAliasCallback=function(c,d,e){c||a.Logger.warning("There is no callback provided");try{if(b.Validators.isFunction(c)){var f={httpCode:d};e&&(f.message=e),c(f);}}catch(b){a.Logger.error("There was an error with your callback: "+b);}},this.extend=extend,this.createServiceUrl=function(b,c){var d,e=window.mParticle&&a._Store.SDKConfig.forceHttps?"https://":window.location.protocol+"//";return d=a._Store.SDKConfig.forceHttps?"https://"+b:e+b,c&&(d+=c),d},this.createXHR=function(b){var c;try{c=new window.XMLHttpRequest;}catch(b){a.Logger.error("Error creating XMLHttpRequest object.");}if(c&&b&&"withCredentials"in c)c.onreadystatechange=b;else if("undefined"!=typeof window.XDomainRequest){a.Logger.verbose("Creating XDomainRequest object");try{c=new window.XDomainRequest,c.onload=b;}catch(b){a.Logger.error("Error creating XDomainRequest object");}}return c},this.filterUserIdentities=function(a,c){return buildFilteredUserIdentities$1(a,c,b.inArray)},this.filterUserIdentitiesForForwarders=KitFilterHelper.filterUserIdentities,this.filterUserAttributes=KitFilterHelper.filterUserAttributes,this.isEventType=function(a){for(var b in Types.EventType)if(Types.EventType.hasOwnProperty(b)&&Types.EventType[b]===a)return !0;return !1},this.sanitizeAttributes=function(c,d){if(!c||!b.isObject(c))return null;var e={};for(var f in c)// Make sure that attribute values are not objects or arrays, which are not valid
633
644
  c.hasOwnProperty(f)&&b.Validators.isValidAttributeValue(c[f])?e[f]=c[f]:a.Logger.warning("For '"+d+"', the corresponding attribute value of '"+f+"' must be a string, number, boolean, or null.");return e},this.isDelayedByIntegration=function(b,c,d){if(d-c>a._Store.SDKConfig.integrationDelayTimeout)return !1;for(var e in b){if(!0===b[e])return !0;continue}return !1},this.createMainStorageName=function(a){return a?StorageNames$1.currentStorageName+"_"+a:StorageNames$1.currentStorageName},this.converted=converted,this.findKeyInObject=findKeyInObject,this.parseNumber=parseNumber,this.inArray=inArray,this.isObject=isObject,this.decoded=decoded,this.parseStringOrNumber=parseStringOrNumber,this.generateHash=generateHash,this.generateUniqueId=generateUniqueId,this.Validators=Validators;}
634
645
 
635
646
  var Messages$8=Constants.Messages,androidBridgeNameBase="mParticleAndroid",iosBridgeNameBase="mParticle";function getAndroidBridge(a){return Object.prototype.hasOwnProperty.call(window,a)?window[a]:void 0}function getInstanceNamedValue(a,b){return a[b]}function NativeSdkHelpers(a){var b=this;this.initializeSessionAttributes=function(a){var c=Constants.NativeSdkPaths.SetSessionAttribute,d=JSON.stringify({key:"$src_env",value:"webview"}),e=JSON.stringify({key:"$src_key",value:a});b.sendToNative(c,d),a&&b.sendToNative(c,e);},this.isBridgeV2Available=function(a){var b,c;if(!a)return !1;var d=iosBridgeNameBase+"_"+a+"_v2";// iOS v2 bridge
@@ -644,23 +655,23 @@ var PARTNER_MODULE_IDS={AdobeEventForwarder:11,DoubleclickDFP:41,AppNexus:50,Lot
644
655
  // Private
645
656
  this.attemptCookieSync=function(c,d){var e,f=a._Store,g=f.pixelConfigurations,h=f.webviewBridgeEnabled;if(c&&!h&&(null===(e=a._CookieConsentManager)||void 0===e||!e.getNoFunctional()))// When noFunctional is true, persistence is not saved, so we cannot track cookie sync
646
657
  // dates. Skip cookie sync to avoid running it on every page load.
647
- {var i=a._Persistence.getPersistence();isEmpty(i)||g.forEach(function(e){var f,g,h,j=!1,k=e.filteringConsentRuleValues,l=e.pixelUrl,m=e.redirectUrl,n=e.moduleId,o=e.settings,// Tells you how often we should do a cookie sync (in days)
648
- p=e.frequencyCap,q=(k||{}).values;// set requiresConsent to false to start each additional pixel configuration
658
+ {var i=a._Persistence.getPersistence();isEmpty(i)||g.forEach(function(e){var f,g,h;try{// set requiresConsent to false to start each additional pixel configuration
649
659
  // set to true only if filteringConsenRuleValues.values.length exists
650
- // Filtering rules as defined in UI
651
- if(!isEmpty(l)&&(isEmpty(q)||(j=!0),!(j&&d))&&!(n===PARTNER_MODULE_IDS.Rokt&&a._CookieConsentManager.getNoTargeting()))// For Rokt, block cookie sync when noTargeting privacy flag is true
652
- // If MPID is new to cookies, we should not try to perform the cookie sync
660
+ var j=!1,k=e.filteringConsentRuleValues,l=e.pixelUrl,m=e.redirectUrl,n=e.moduleId,o=e.settings,// Tells you how often we should do a cookie sync (in days)
661
+ p=e.frequencyCap,q=(k||{}).values;// Filtering rules as defined in UI
662
+ if(isEmpty(l))return;// If MPID is new to cookies, we should not try to perform the cookie sync
653
663
  // because a cookie sync can only occur once a user either consents or doesn't.
654
664
  // we should not check if it's enabled if the user has a blank consent
655
- // The Trade Desk requires a URL parameter for GDPR enabled users.
665
+ if(isEmpty(q)||(j=!0),j&&d)return;// For Rokt, block cookie sync when noTargeting privacy flag is true
666
+ if(n===PARTNER_MODULE_IDS.Rokt&&a._CookieConsentManager.getNoTargeting())return;var r=a._Consent.isEnabledForUserConsent;if(!r(k,a.Identity.getCurrentUser()))return;var s=null!==(g=null===(f=i[c])||void 0===f?void 0:f.csd)&&void 0!==g?g:{},t=s[n]||null;if(!isLastSyncDateExpired(p,t))return;// The Trade Desk requires a URL parameter for GDPR enabled users.
656
667
  // It is optional but to simplify the code, we add it for all Trade
657
668
  // // Desk cookie syncs.
658
- // Google Marketing Platform accepts a web-safe base64-encoded MPID via the
669
+ var u=n===PARTNER_MODULE_IDS.TradeDesk?window.location.hostname:void 0,v="true"===(null===(h=null===o||void 0===o?void 0:o.enableHmTag)||void 0===h?void 0:h.toLowerCase()),w=n===PARTNER_MODULE_IDS.DoubleclickDFP,x=w&&v,y=x?toWebSafeBase64(c):void 0;// Google Marketing Platform accepts a web-safe base64-encoded MPID via the
659
670
  // `google_hm` query parameter, but only for accounts provisioned for Google
660
671
  // Hosted Matching — Google returns errors otherwise. It is therefore gated
661
672
  // behind the opt-in `enableHmTag` setting (off by default), which the server
662
673
  // delivers as the string 'True' when the UI toggle is enabled.
663
- {var r=a._Consent.isEnabledForUserConsent;if(r(k,a.Identity.getCurrentUser())){var s=null!==(g=null===(f=i[c])||void 0===f?void 0:f.csd)&&void 0!==g?g:{},t=s[n]||null;if(isLastSyncDateExpired(p,t)){var u=n===PARTNER_MODULE_IDS.TradeDesk?window.location.hostname:void 0,v="true"===(null===(h=null===o||void 0===o?void 0:o.enableHmTag)||void 0===h?void 0:h.toLowerCase()),w=n===PARTNER_MODULE_IDS.DoubleclickDFP,x=w&&v?toWebSafeBase64(c):void 0,y=createCookieSyncUrl(c,l,m,u,x);b.performCookieSync(y,n.toString(),c,s);}}}});}},this.performCookieSync=function(b,c,d,e){var f=document.createElement("img");a.Logger.verbose(InformationMessages.CookieSync),f.onload=function(){e[c]=new Date().getTime(),a._Persistence.saveUserCookieSyncDatesToPersistence(d,e);},f.src=b;};}var isLastSyncDateExpired=function(a,b){// If there is no lastSyncDate, then there is no previous cookie sync, so we should sync the cookie
674
+ x&&!y&&a.Logger.warning("Unable to base64 encode the current MPID; omitting the google_hm parameter from this cookie sync");var z=createCookieSyncUrl(c,l,m,u,y);b.performCookieSync(z,n.toString(),c,s);}catch(b){a.Logger.error("Error performing cookie sync: "+b);}});}},this.performCookieSync=function(b,c,d,e){var f=document.createElement("img");a.Logger.verbose(InformationMessages.CookieSync),f.onload=function(){e[c]=new Date().getTime(),a._Persistence.saveUserCookieSyncDatesToPersistence(d,e);},f.src=b;};}var isLastSyncDateExpired=function(a,b){// If there is no lastSyncDate, then there is no previous cookie sync, so we should sync the cookie
664
675
  return !b||new Date().getTime()>new Date(b).getTime()+a*DAYS_IN_MILLISECONDS;// Otherwise, compare the last sync date to determine if it should do a cookie sync again
665
676
  };
666
677
 
@@ -704,7 +715,7 @@ function createSDKConfig(a){// TODO: Refactor to create a default config object
704
715
  var b={};for(var c in Constants.DefaultConfig)Constants.DefaultConfig.hasOwnProperty(c)&&(b[c]=Constants.DefaultConfig[c]);if(a)for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);for(var c in Constants.DefaultBaseUrls)b[c]=Constants.DefaultBaseUrls[c];// Always initialize flags to at least an empty object to prevent undefined access
705
716
  return b.flags=b.flags||{},b}// TODO: Merge this with SDKStoreApi in sdkRuntimeModels
706
717
  function Store(a,b,c){var d=this,e=b._Helpers.createMainStorageName,f=b._NativeSdkHelpers.isWebviewEnabled,g={isEnabled:!0,sessionAttributes:{},localSessionAttributes:{},currentSessionMPIDs:[],consentState:null,sessionId:null,isFirstRun:null,clientId:null,deviceId:null,devToken:null,serverSettings:{},dateLastEventSent:null,sessionStartDate:null,currentPosition:null,isTracking:!1,watchPositionId:null,cartProducts:[],eventQueue:[],currencyCode:null,globalTimer:null,context:null,configurationLoaded:!1,identityCallInFlight:!1,identityCallFailed:!1,identifyRequestCount:0,SDKConfig:{},nonCurrentUserMPIDs:{},identifyCalled:!1,isLoggedIn:!1,cookieSyncDates:{},integrationAttributes:{},requireDelay:!0,isLocalStorageAvailable:null,storageName:null,activeForwarders:[],kits:{},sideloadedKits:[],configuredForwarders:[],pixelConfigurations:[],wrapperSDKInfo:{name:"none",version:null,isInfoSet:!1},roktAccountId:null,integrationName:null,// Placeholder for in-memory persistence model
707
- persistenceData:{gs:{}}};for(var h in g)this[h]=g[h];if(this.devToken=c||null,this.integrationDelayTimeoutStart=Date.now(),this.SDKConfig=createSDKConfig(a),a){a.hasOwnProperty("flags")||(this.SDKConfig.flags={}),this.SDKConfig.flags=processFlags(a),a.deviceId&&(this.deviceId=a.deviceId),this.SDKConfig.isDevelopmentMode=!!a.hasOwnProperty("isDevelopmentMode")&&returnConvertedBoolean(a.isDevelopmentMode);var i=processBaseUrls(a,this.SDKConfig.flags,c);for(var j in i)this.SDKConfig[j]=i[j];if(this.SDKConfig.useNativeSdk=!!a.useNativeSdk,this.SDKConfig.kits=a.kits||{},this.SDKConfig.sideloadedKits=a.sideloadedKits||[],this.SDKConfig.isIOS=a.hasOwnProperty("isIOS")?a.isIOS:!!(window.mParticle&&window.mParticle.isIOS)&&window.mParticle.isIOS,this.SDKConfig.useCookieStorage=!!a.hasOwnProperty("useCookieStorage")&&a.useCookieStorage,this.SDKConfig.maxCookieSize=a.hasOwnProperty("maxCookieSize")?a.maxCookieSize:Constants.DefaultConfig.maxCookieSize,a.hasOwnProperty("appName")&&(this.SDKConfig.appName=a.appName),a.hasOwnProperty("package")&&(this.SDKConfig["package"]=a["package"]),this.SDKConfig.integrationDelayTimeout=a.hasOwnProperty("integrationDelayTimeout")?a.integrationDelayTimeout:Constants.DefaultConfig.integrationDelayTimeout,a.hasOwnProperty("identifyRequest")&&(this.SDKConfig.identifyRequest=a.identifyRequest),a.hasOwnProperty("identityCallback")){var k=a.identityCallback;b._Helpers.Validators.isFunction(k)?this.SDKConfig.identityCallback=a.identityCallback:b.Logger.warning("The optional callback must be a function. You tried entering a(n) "+_typeof(k)+" . Callback not set. Please set your callback again.");}if(a.hasOwnProperty("appVersion")&&(this.SDKConfig.appVersion=a.appVersion),a.hasOwnProperty("appName")&&(this.SDKConfig.appName=a.appName),a.hasOwnProperty("sessionTimeout")&&(this.SDKConfig.sessionTimeout=a.sessionTimeout),a.hasOwnProperty("dataPlan")){this.SDKConfig.dataPlan={PlanVersion:null,PlanId:null};var l=a.dataPlan;l.planId&&(isDataPlanSlug(l.planId)?this.SDKConfig.dataPlan.PlanId=l.planId:b.Logger.error("Your data plan id must be a string and match the data plan slug format (i.e. under_case_slug)")),l.planVersion&&(isNumber(l.planVersion)?this.SDKConfig.dataPlan.PlanVersion=l.planVersion:b.Logger.error("Your data plan version must be a number"));}else this.SDKConfig.dataPlan={};if(this.SDKConfig.forceHttps=!a.hasOwnProperty("forceHttps")||a.forceHttps,this.SDKConfig.customFlags=a.customFlags||{},this.SDKConfig.minWebviewBridgeVersion=a.hasOwnProperty("minWebviewBridgeVersion")?a.minWebviewBridgeVersion:1,this.SDKConfig.aliasMaxWindow=a.hasOwnProperty("aliasMaxWindow")?a.aliasMaxWindow:Constants.DefaultConfig.aliasMaxWindow,a.hasOwnProperty("dataPlanOptions")){var m=a.dataPlanOptions;m.hasOwnProperty("dataPlanVersion")&&m.hasOwnProperty("blockUserAttributes")&&m.hasOwnProperty("blockEventAttributes")&&m.hasOwnProperty("blockEvents")&&m.hasOwnProperty("blockUserIdentities")||b.Logger.error("Ensure your config.dataPlanOptions object has the following keys: a \"dataPlanVersion\" object, and \"blockUserAttributes\", \"blockEventAttributes\", \"blockEvents\", \"blockUserIdentities\" booleans");}a.hasOwnProperty("onCreateBatch")&&("function"==typeof a.onCreateBatch?this.SDKConfig.onCreateBatch=a.onCreateBatch:(b.Logger.error("config.onCreateBatch must be a function"),this.SDKConfig.onCreateBatch=void 0));}this._getFromPersistence=function(a,b){return a?(d.syncPersistenceData(),d.persistenceData&&d.persistenceData[a]&&d.persistenceData[a][b]?d.persistenceData[a][b]:null):null},this._setPersistence=function(a,c,e){var f;a&&(d.syncPersistenceData(),d.persistenceData&&(d.persistenceData[a]?d.persistenceData[a][c]=e:d.persistenceData[a]=(f={},f[c]=e,f),isObject(d.persistenceData[a][c])&&isEmpty(d.persistenceData[a][c])&&delete d.persistenceData[a][c],b._Persistence.savePersistence(d.persistenceData)));},this.hasInvalidIdentifyRequest=function(){var a=d.SDKConfig.identifyRequest;return isObject(a)&&isObject(a.userIdentities)&&isEmpty(a.userIdentities)||!a},this.getConsentState=function(a){var c=b._Consent.ConsentSerialization.fromMinifiedJsonObject,e=d._getFromPersistence(a,"con");return isEmpty(e)?null:c(e)},this.setConsentState=function(a,c){var e=b._Consent.ConsentSerialization.toMinifiedJsonObject;// If ConsentState is null, we assume the intent is to clear out the consent state
718
+ persistenceData:{gs:{}}};for(var h in g)this[h]=g[h];if(this.devToken=c||null,this.integrationDelayTimeoutStart=Date.now(),this.SDKConfig=createSDKConfig(a),a){a.hasOwnProperty("flags")||(this.SDKConfig.flags={}),this.SDKConfig.flags=processFlags(a),a.deviceId&&(this.deviceId=a.deviceId),this.SDKConfig.isDevelopmentMode=!!a.hasOwnProperty("isDevelopmentMode")&&returnConvertedBoolean(a.isDevelopmentMode);var i=processBaseUrls(a,this.SDKConfig.flags,c);for(var j in i)this.SDKConfig[j]=i[j];if(this.SDKConfig.useNativeSdk=!!a.useNativeSdk,this.SDKConfig.kits=a.kits||{},this.SDKConfig.sideloadedKits=a.sideloadedKits||[],this.SDKConfig.isIOS=a.hasOwnProperty("isIOS")?a.isIOS:!!(window.mParticle&&window.mParticle.isIOS)&&window.mParticle.isIOS,this.SDKConfig.useCookieStorage=!!a.hasOwnProperty("useCookieStorage")&&a.useCookieStorage,this.SDKConfig.maxCookieSize=a.hasOwnProperty("maxCookieSize")?a.maxCookieSize:Constants.DefaultConfig.maxCookieSize,a.hasOwnProperty("appName")&&(this.SDKConfig.appName=a.appName),a.hasOwnProperty("package")&&(this.SDKConfig["package"]=a["package"]),this.SDKConfig.integrationDelayTimeout=a.hasOwnProperty("integrationDelayTimeout")?a.integrationDelayTimeout:Constants.DefaultConfig.integrationDelayTimeout,a.hasOwnProperty("identifyRequest")&&(this.SDKConfig.identifyRequest=a.identifyRequest),a.hasOwnProperty("identityCallback")){var k=a.identityCallback;b._Helpers.Validators.isFunction(k)?this.SDKConfig.identityCallback=a.identityCallback:b.Logger.warning("The optional callback must be a function. You tried entering a(n) "+_typeof(k)+" . Callback not set. Please set your callback again.");}if(a.hasOwnProperty("appVersion")&&(this.SDKConfig.appVersion=a.appVersion),a.hasOwnProperty("appName")&&(this.SDKConfig.appName=a.appName),a.hasOwnProperty("sessionTimeout")&&(this.SDKConfig.sessionTimeout=a.sessionTimeout),a.hasOwnProperty("dataPlan")){this.SDKConfig.dataPlan={PlanVersion:null,PlanId:null};var l=a.dataPlan;l.planId&&(isDataPlanSlug(l.planId)?this.SDKConfig.dataPlan.PlanId=l.planId:b.Logger.error("Your data plan id must be a string and match the data plan slug format (i.e. under_case_slug)")),l.planVersion&&(isNumber(l.planVersion)?this.SDKConfig.dataPlan.PlanVersion=l.planVersion:b.Logger.error("Your data plan version must be a number"));}else this.SDKConfig.dataPlan={};if(this.SDKConfig.forceHttps=!a.hasOwnProperty("forceHttps")||a.forceHttps,this.SDKConfig.customFlags=a.customFlags||{},this.SDKConfig.minWebviewBridgeVersion=a.hasOwnProperty("minWebviewBridgeVersion")?a.minWebviewBridgeVersion:1,this.SDKConfig.aliasMaxWindow=a.hasOwnProperty("aliasMaxWindow")?a.aliasMaxWindow:Constants.DefaultConfig.aliasMaxWindow,a.hasOwnProperty("dataPlanOptions")){var m=a.dataPlanOptions;m.hasOwnProperty("dataPlanVersion")&&m.hasOwnProperty("blockUserAttributes")&&m.hasOwnProperty("blockEventAttributes")&&m.hasOwnProperty("blockEvents")&&m.hasOwnProperty("blockUserIdentities")||b.Logger.error("Ensure your config.dataPlanOptions object has the following keys: a \"dataPlanVersion\" object, and \"blockUserAttributes\", \"blockEventAttributes\", \"blockEvents\", \"blockUserIdentities\" booleans");}a.hasOwnProperty("onCreateBatch")&&("function"==typeof a.onCreateBatch?this.SDKConfig.onCreateBatch=a.onCreateBatch:(b.Logger.error("config.onCreateBatch must be a function"),this.SDKConfig.onCreateBatch=void 0));}this._getFromPersistence=function(a,b){return a?(d.syncPersistenceData(),d.persistenceData&&d.persistenceData[a]&&d.persistenceData[a][b]?d.persistenceData[a][b]:null):null},this._setPersistence=function(a,c,e){var f;a&&(d.syncPersistenceData(),d.persistenceData&&(isObject(d.persistenceData[a])?d.persistenceData[a][c]=e:d.persistenceData[a]=(f={},f[c]=e,f),isObject(d.persistenceData[a][c])&&isEmpty(d.persistenceData[a][c])&&delete d.persistenceData[a][c],b._Persistence.savePersistence(d.persistenceData)));},this.hasInvalidIdentifyRequest=function(){var a=d.SDKConfig.identifyRequest;return isObject(a)&&isObject(a.userIdentities)&&isEmpty(a.userIdentities)||!a},this.getConsentState=function(a){var c=b._Consent.ConsentSerialization.fromMinifiedJsonObject,e=d._getFromPersistence(a,"con");return isEmpty(e)?null:c(e)},this.setConsentState=function(a,c){var e=b._Consent.ConsentSerialization.toMinifiedJsonObject;// If ConsentState is null, we assume the intent is to clear out the consent state
708
719
  (c||null===c)&&d._setPersistence(a,"con",e(c));},this.getDeviceId=function(){return d.deviceId},this.setDeviceId=function(a){d.deviceId=a,d.persistenceData.gs.das=a,b._Persistence.update();},this.getFirstSeenTime=function(a){return d._getFromPersistence(a,"fst")},this.setFirstSeenTime=function(a,b){if(a){var c=b||new Date().getTime();d._setPersistence(a,"fst",c);}},this.getLastSeenTime=function(a){if(!a)return null;// https://go.mparticle.com/work/SQDSDKS-6315
709
720
  var c=b.Identity.getCurrentUser();return a===(null===c||void 0===c?void 0:c.getMPID())?new Date().getTime():d._getFromPersistence(a,"lst")},this.setLastSeenTime=function(a,b){if(a){var c=b||new Date().getTime();d._setPersistence(a,"lst",c);}},this.getLocalSessionAttributes=function(){return d.localSessionAttributes||{}},this.setLocalSessionAttribute=function(a,c){var e;d.localSessionAttributes[a]=c,d.persistenceData.gs.lsa=__assign(__assign({},d.persistenceData.gs.lsa||{}),(e={},e[a]=c,e)),b._Persistence.savePersistence(d.persistenceData);},this.syncPersistenceData=function(){var a=b._Persistence.getPersistence();d.persistenceData=extend({},d.persistenceData,a);},this.getUserAttributes=function(a){return d._getFromPersistence(a,"ua")||{}},this.setUserAttributes=function(a,b){return d._setPersistence(a,"ua",b)},this.getUserIdentities=function(a){return d._getFromPersistence(a,"ui")||{}},this.setUserIdentities=function(a,b){d._setPersistence(a,"ui",b);},this.getRoktAccountId=function(){return d.roktAccountId},this.setRoktAccountId=function(a){d.roktAccountId=a;},this.getIntegrationName=function(){return d.integrationName},this.setIntegrationName=function(a){d.integrationName=a;},this.getTimeOnSite=function(){var a;return null===(a=b._timeOnSiteTimer)||void 0===a?void 0:a.getTimeInForeground()},this.getTotalTimeOnSite=function(){return d.sessionStartDate?Date.now()-d.sessionStartDate.getTime():void 0},this.addMpidToSessionHistory=function(a,b){var c=d.currentSessionMPIDs.indexOf(a);return a&&b!==a&&0>c?void d.currentSessionMPIDs.push(a):void(0<=c&&(d.currentSessionMPIDs=moveElementToEnd(d.currentSessionMPIDs,c)))},this.nullifySession=function(){d.sessionId=null,d.dateLastEventSent=null,d.sessionStartDate=null,d.sessionAttributes={},d.localSessionAttributes={},b._Persistence.update();},this.processConfig=function(a){var g=a.workspaceToken,h=a.requiredWebviewBridgeName;// We should reprocess the flags and baseUrls in case they have changed when we request an updated config
710
721
  // such as if the SDK is being self-hosted and the flags are different on the server config
@@ -800,10 +811,10 @@ var e=f(c,d);g(e),E.update();}catch(b){// If cookies or local storage is corrupt
800
811
  // so that in the future, initializeStorage will work
801
812
  h(),a.Logger.error("Error initializing storage: "+b);}},this.update=function(){a._Store.webviewBridgeEnabled||(a._Store.SDKConfig.useCookieStorage&&E.setCookie(),E.setLocalStorage());},this.storeDataInMemory=function(b,c){try{if(!b)return void i();j(b,c);}catch(b){a.Logger.error(Messages$4.ErrorMessages.CookieParseError);}},this.determineLocalStorageAvailability=function(a){var b=getMParticleManager();if(null===b||void 0===b?void 0:b._forceNoLocalStorage)return !1;try{a.setItem("mparticle","test");var c="test"===a.getItem("mparticle");return a.removeItem("mparticle"),!!(c&&a)}catch(a){return !1}},this.setLocalStorage=function(){var b;if(a._Store.isLocalStorageAvailable&&(null===(b=a._CookieConsentManager)||void 0===b||!b.getNoFunctional()))// Block mprtcl-v4 localStorage when noFunctional is true
802
813
  {var c=a._Store.storageName,d=E.getLocalStorage()||{},e=a.Identity.getCurrentUser(),f=e?e.getMPID():null;if(!a._Store.SDKConfig.useCookieStorage){d.gs=d.gs||{},d.l=a._Store.isLoggedIn?1:0,a._Store.sessionId&&(d.gs.csm=a._Store.currentSessionMPIDs),d.gs.ie=a._Store.isEnabled,f&&(d.cu=f),Object.keys(a._Store.nonCurrentUserMPIDs).length&&(d=extend({},d,a._Store.nonCurrentUserMPIDs),a._Store.nonCurrentUserMPIDs={}),d=k(d);try{window.localStorage.setItem(encodeURIComponent(c),E.encodePersistence(JSON.stringify(d)));}catch(b){a.Logger.error("Error with setting localStorage item.");}}}},this.getLocalStorage=function(){if(!a._Store.isLocalStorageAvailable)return null;var b=a._Store.storageName,c=E.decodePersistence(window.localStorage.getItem(b));if(!c)return null;var d=JSON.parse(c),e={};for(var f in d)d.hasOwnProperty(f)&&(e[f]=d[f]);return Object.keys(e).length?e:null},this.expireCookies=function(a){var b,c,d,e=new Date;d=E.getCookieDomain(),c=""===d?"":";domain="+d,e.setTime(e.getTime()-86400000),b="; expires="+e.toUTCString(),document.cookie=a+"="+b+"; path=/"+c;},this.getCookie=function(){var b,c,d,e,f,g,h=a._Store.storageName,j=h?void 0:{};a.Logger.verbose(Messages$4.InformationMessages.CookieSearch);try{b=window.document.cookie.split("; ");}catch(b){return a.Logger.verbose("Unable to parse undefined cookie"),null}for(c=0,d=b.length;c<d;c++){try{e=b[c].split("="),f=e.shift(),g=e.join("=");}catch(b){a.Logger.verbose("Unable to parse cookie: "+f+". Skipping.");}if(h&&h===f){j=a._Helpers.converted(g);break}h||(j[f]=a._Helpers.converted(g));}return j?(a.Logger.verbose(Messages$4.InformationMessages.CookieFound),JSON.parse(E.decodePersistence(j))):null},this.setCookie=function(){var b;// Block mprtcl-v4 cookies when noFunctional is true
803
- if(!(null!==(b=a._CookieConsentManager)&&void 0!==b)||!b.getNoFunctional()){var c,d=a.Identity.getCurrentUser();d&&(c=d.getMPID());var e,f,g,h=new Date,i=a._Store.storageName,j=E.getCookie()||{},l=new Date(h.getTime()+1e3*(60*(60*(24*a._Store.SDKConfig.cookieExpiration)))).toUTCString();e=E.getCookieDomain(),f=""===e?"":";domain="+e,j.gs=j.gs||{},a._Store.sessionId&&(j.gs.csm=a._Store.currentSessionMPIDs),c&&(j.cu=c),j.l=a._Store.isLoggedIn?1:0,j=k(j),Object.keys(a._Store.nonCurrentUserMPIDs).length&&(j=extend({},j,a._Store.nonCurrentUserMPIDs),a._Store.nonCurrentUserMPIDs={}),g=E.reduceAndEncodePersistence(j,l,f,a._Store.SDKConfig.maxCookieSize),a.Logger.verbose(Messages$4.InformationMessages.CookieSet),window.document.cookie=encodeURIComponent(i)+"="+g;}},this.reduceAndEncodePersistence=function(a,b,c,d){var e=a.gs.csm?a.gs.csm:[];if(!e.length)return m(a,b,c,d);var f=n(a);return Object.keys(f).length&&o(a,f,e,b,c,d),q(a,e,b,c,d)},this.findPrevCookiesBasedOnUI=function(b){var c=a._Persistence.getPersistence();if(b){var d=u(c,b);d&&E.storeDataInMemory(c,d);}},this.encodePersistence=function(a){var b=JSON.parse(a);return x(b.gs),A(b),createCookieString(JSON.stringify(b))},this.decodePersistence=function(b){try{if(!b)return;var c=JSON.parse(revertCookieString(b));return a._Helpers.isObject(c)&&Object.keys(c).length&&(B(c.gs),D(c)),JSON.stringify(c)}catch(b){a.Logger.error("Problem with decoding cookie");}},this.getCookieDomain=function(){if(a._Store.SDKConfig.cookieDomain)return a._Store.SDKConfig.cookieDomain;var b=E.getDomain(document,location.hostname);return ""===b?"":"."+b},this.getDomain=function(a,b){var c,d,e=b.split(".");for(c=e.length-1;0<=c;c--)if(d=e.slice(c).join("."),a.cookie="mptest=cookie;domain=."+d+";",-1<a.cookie.indexOf("mptest=cookie"))return a.cookie="mptest=;domain=."+d+";expires=Thu, 01 Jan 1970 00:00:01 GMT;",d;return ""},this.saveUserCookieSyncDatesToPersistence=function(a,b){if(b){var c=E.getPersistence();c&&(c[a]?c[a].csd=b:c[a]={csd:b}),E.savePersistence(c);}},this.swapCurrentUser=function(a,b,c){if(a&&b&&a!==b){var d=E.getPersistence();d&&(d.cu=b,d.gs.csm=c,E.savePersistence(d));}},this.savePersistence=function(b){var c;// Block mprtcl-v4 persistence when noFunctional is true
804
- if(null===(c=a._CookieConsentManager)||void 0===c||!c.getNoFunctional()){var d,e=E.encodePersistence(JSON.stringify(b)),f=new Date,g=a._Store.storageName,h=new Date(f.getTime()+1e3*(60*(60*(24*a._Store.SDKConfig.cookieExpiration)))).toUTCString(),i=E.getCookieDomain();if(d=""===i?"":";domain="+i,a._Store.SDKConfig.useCookieStorage){var j=E.reduceAndEncodePersistence(b,h,d,a._Store.SDKConfig.maxCookieSize);window.document.cookie=encodeURIComponent(g)+"="+j;}else if(a._Store.isLocalStorageAvailable)try{localStorage.setItem(a._Store.storageName,e);}catch(b){a.Logger.error("Error saving persistence to localStorage.");}}},this.getPersistence=function(){var a=this.useLocalStorage()?this.getLocalStorage():this.getCookie();return a},this.getFirstSeenTime=function(a){if(!a)return null;var b=E.getPersistence();return b&&b[a]&&b[a].fst?b[a].fst:null},this.setFirstSeenTime=function(a,b){if(a){b||(b=new Date().getTime());var c=E.getPersistence();c&&(!c[a]&&(c[a]={}),!c[a].fst&&(c[a].fst=b,E.savePersistence(c)));}// https://go.mparticle.com/work/SQDSDKS-6329
814
+ if(!(null!==(b=a._CookieConsentManager)&&void 0!==b)||!b.getNoFunctional()){var c,d=a.Identity.getCurrentUser();d&&(c=d.getMPID());var e,f,g,h=new Date,i=a._Store.storageName,j=E.getCookie()||{},l=new Date(h.getTime()+1e3*(60*(60*(24*a._Store.SDKConfig.cookieExpiration)))).toUTCString();e=E.getCookieDomain(),f=""===e?"":";domain="+e,j.gs=j.gs||{},a._Store.sessionId&&(j.gs.csm=a._Store.currentSessionMPIDs),c&&(j.cu=c),j.l=a._Store.isLoggedIn?1:0,j=k(j),Object.keys(a._Store.nonCurrentUserMPIDs).length&&(j=extend({},j,a._Store.nonCurrentUserMPIDs),a._Store.nonCurrentUserMPIDs={}),g=E.reduceAndEncodePersistence(j,l,f,a._Store.SDKConfig.maxCookieSize),a.Logger.verbose(Messages$4.InformationMessages.CookieSet),window.document.cookie=encodeURIComponent(i)+"="+g;}},this.reduceAndEncodePersistence=function(a,b,c,d){var e=a.gs.csm?a.gs.csm:[];if(!e.length)return m(a,b,c,d);var f=n(a);return Object.keys(f).length&&o(a,f,e,b,c,d),q(a,e,b,c,d)},this.findPrevCookiesBasedOnUI=function(b){var c=a._Persistence.getPersistence();if(b){var d=u(c,b);d&&E.storeDataInMemory(c,d);}},this.encodePersistence=function(a){var b=JSON.parse(a);return x(b.gs),A(b),createCookieString(JSON.stringify(b))},this.decodePersistence=function(b){try{if(!b)return;var c=JSON.parse(revertCookieString(b));return a._Helpers.isObject(c)&&Object.keys(c).length&&(B(c.gs),D(c)),JSON.stringify(c)}catch(b){a.Logger.error("Problem with decoding cookie");}},this.getCookieDomain=function(){if(a._Store.SDKConfig.cookieDomain)return a._Store.SDKConfig.cookieDomain;var b=E.getDomain(document,location.hostname);return ""===b?"":"."+b},this.getDomain=function(a,b){var c,d,e=b.split(".");for(c=e.length-1;0<=c;c--)if(d=e.slice(c).join("."),a.cookie="mptest=cookie;domain=."+d+";",-1<a.cookie.indexOf("mptest=cookie"))return a.cookie="mptest=;domain=."+d+";expires=Thu, 01 Jan 1970 00:00:01 GMT;",d;return ""},this.saveUserCookieSyncDatesToPersistence=function(b,c){if(c){var d=E.getPersistence();d&&(a._Helpers.isObject(d[b])?d[b].csd=c:d[b]={csd:c}),E.savePersistence(d);}},this.swapCurrentUser=function(a,b,c){if(a&&b&&a!==b){var d=E.getPersistence();d&&(d.cu=b,d.gs.csm=c,E.savePersistence(d));}},this.savePersistence=function(b){var c;// Block mprtcl-v4 persistence when noFunctional is true
815
+ if(null===(c=a._CookieConsentManager)||void 0===c||!c.getNoFunctional()){var d,e=E.encodePersistence(JSON.stringify(b)),f=new Date,g=a._Store.storageName,h=new Date(f.getTime()+1e3*(60*(60*(24*a._Store.SDKConfig.cookieExpiration)))).toUTCString(),i=E.getCookieDomain();if(d=""===i?"":";domain="+i,a._Store.SDKConfig.useCookieStorage){var j=E.reduceAndEncodePersistence(b,h,d,a._Store.SDKConfig.maxCookieSize);window.document.cookie=encodeURIComponent(g)+"="+j;}else if(a._Store.isLocalStorageAvailable)try{localStorage.setItem(a._Store.storageName,e);}catch(b){a.Logger.error("Error saving persistence to localStorage.");}}},this.getPersistence=function(){var a=this.useLocalStorage()?this.getLocalStorage():this.getCookie();return a},this.getFirstSeenTime=function(a){if(!a)return null;var b=E.getPersistence();return b&&b[a]&&b[a].fst?b[a].fst:null},this.setFirstSeenTime=function(b,c){if(b){c||(c=new Date().getTime());var d=E.getPersistence();d&&(!a._Helpers.isObject(d[b])&&(d[b]={}),!d[b].fst&&(d[b].fst=c,E.savePersistence(d)));}// https://go.mparticle.com/work/SQDSDKS-6329
805
816
  },this.getLastSeenTime=function(b){if(!b)return null;if(b===a.Identity.getCurrentUser().getMPID())//if the mpid is the current user, its last seen time is the current time
806
- return new Date().getTime();var c=E.getPersistence();return c&&c[b]&&c[b].lst?c[b].lst:null},this.setLastSeenTime=function(a,b){if(a){b||(b=new Date().getTime());var c=E.getPersistence();c&&c[a]&&(c[a].lst=b,E.savePersistence(c));}// https://go.mparticle.com/work/SQDSDKS-6329
817
+ return new Date().getTime();var c=E.getPersistence();return c&&c[b]&&c[b].lst?c[b].lst:null},this.setLastSeenTime=function(b,c){if(b){c||(c=new Date().getTime());var d=E.getPersistence();d&&a._Helpers.isObject(d[b])&&(d[b].lst=c,E.savePersistence(d));}// https://go.mparticle.com/work/SQDSDKS-6329
807
818
  },this.getDeviceId=function(){return a._Store.deviceId},this.setDeviceId=function(b){a._Store.deviceId=b,E.update();},this.resetPersistence=function(){localStorage.clear(),E.expireCookies(StorageNames.cookieName),E.expireCookies(StorageNames.cookieNameV2),E.expireCookies(StorageNames.cookieNameV3),E.expireCookies(StorageNames.cookieNameV4),E.expireCookies(a._Store.storageName);var b=getMParticleManager();if(null===b||void 0===b?void 0:b._isTestEnv){localStorage.removeItem(a._Helpers.createMainStorageName("abcdef")),E.expireCookies(a._Helpers.createMainStorageName("abcdef"));}},this.forwardingStatsBatches={uploadsTable:{},forwardingStatsEventQueue:[]};}
808
819
 
809
820
  var HISTORY_METHODS=["pushState","replaceState"],WRAPPED_MARKER="__mpApvWrapped__";// All APV state hangs off one window key, and it is the public debugging
@@ -846,7 +857,10 @@ var ALLOWED_QUERY_PARAMS=[// Campaign attribution
846
857
  // attribute), drops empty values, and carries the fallback for browsers without
847
858
  // URLSearchParams. Tolerates an empty href, so SSR yields no params rather than
848
859
  // throwing.
849
- var allowedQueryParams=function(a){return queryStringParser(a,ALLOWED_QUERY_PARAMS)};// The captured params, in allowlist order. Ordering comes from the constant
860
+ var allowedQueryParams=function(a){return queryStringParser(a,ALLOWED_QUERY_PARAMS)};var AUTO_PAGE_VIEW_ATTRIBUTE="is_auto_page_view";// Absent rather than false on a manual page view, so the attribute is only ever
861
+ // added by the automatic emitters. Shared by both of them so the key and that
862
+ // rule have one definition instead of two that can drift.
863
+ var autoPageViewAttribute=function(a){var b;return a?(b={},b[AUTO_PAGE_VIEW_ATTRIBUTE]=!0,b):{}};// The captured params, in allowlist order. Ordering comes from the constant
850
864
  // rather than a sort: it is deterministic without needing a comparator, and it
851
865
  // does not depend on the object's insertion order, so reordering the query string
852
866
  // cannot produce a different key.
@@ -872,10 +886,10 @@ var pageKey=function(a){var b=capturedNames(a.params).map(function(b){return "".
872
886
  var isNewPage=function(a,b){return b!==a};var supportsHistoryTracking=function(a){return !!a&&a.history!==void 0&&"function"==typeof a.history.pushState&&"function"==typeof a.addEventListener};// Mirrors the event shape of the public mParticle.logPageView(), but carries the
873
887
  // path and query params captured when the navigation was accepted rather than the
874
888
  // live location.
875
- var buildPageViewEvent=function(a){var b=a.params,c=a.hostname,d=a.title,e=a.path;return {messageType:MessageType$1.PageView,name:"PageView",// Params spread first, then the core fields by name, so a core field always
889
+ var buildPageViewEvent=function(a){var b=a.params,c=a.hostname,d=a.title,e=a.path,f=a.isAutoPageView;return {messageType:MessageType$1.PageView,name:"PageView",// Params spread first, then the core fields by name, so a core field always
876
890
  // wins. No allowlist entry collides with hostname/title/path today; naming
877
891
  // them here is what keeps a later addition from silently overwriting one.
878
- data:__assign(__assign({},b),{hostname:c,title:d,path:e}),eventType:EventType.Unknown}};// ---------------------------------------------------------------------------
892
+ data:__assign(__assign(__assign({},b),{hostname:c,title:d,path:e}),autoPageViewAttribute(f)),eventType:EventType.Unknown}};// ---------------------------------------------------------------------------
879
893
  // Window-scoped APV state. Every read and write goes through these helpers, so
880
894
  // neither the tracker nor mp-instance touches `window` directly and
881
895
  // `typeof window` is checked in exactly one place.
@@ -906,7 +920,7 @@ var patchHistory=function(a,b){if(window.history.pushState[WRAPPED_MARKER])retur
906
920
  var e=function(){return HISTORY_METHODS.forEach(function(a){window.history[a]===d[a]?(window.history[a]=c[a],b("[teardown] restored original ".concat(a))):b("[teardown] ".concat(a," no longer ours; leaving in place, gating callback to no-op"));})};try{HISTORY_METHODS.forEach(function(a){window.history[a]=d[a];});}catch(a){b("[error] failed to patch history methods (frozen/sealed), rolling back: ".concat(a));try{e();}catch(a){b("[error] failed to restore history methods after patch failure: ".concat(a));}return null}return e};// ---------------------------------------------------------------------------
907
921
  // Tracker
908
922
  // ---------------------------------------------------------------------------
909
- var PageViewTracker=/** @class */function(){function a(a){this.lastPage=null,this.active=!1,this.pendingNavigations=[],this.undoHistoryPatch=null,this.popStateListener=null,this.mpInstance=a;}return Object.defineProperty(a.prototype,"isActive",{// True while this tracker owns the history patch and is listening for
923
+ var PageViewTracker=/** @class */function(){function a(a,b){this.lastPage=null,this.active=!1,this.pendingNavigations=[],this.undoHistoryPatch=null,this.popStateListener=null,this.mpInstance=a,this.isAutoPageView=!!(b&&b.isAutoPageView);}return Object.defineProperty(a.prototype,"isActive",{// True while this tracker owns the history patch and is listening for
910
924
  // navigations. Flips to false on teardown, including the teardown a
911
925
  // successor tracker performs during a handoff. Read-only, and the one thing
912
926
  // worth checking on `window.__mpApv__.tracker` from a console.
@@ -920,7 +934,7 @@ var b=getActiveTracker(),c=this.retire(b);this.active&&b!==this&&(c=c.concat(thi
920
934
  // installed and keeps firing at a dead tracker. Bail before touching
921
935
  // lastPath or queueing a fire the flush would just abort. Guarding here
922
936
  // rather than at each wrapper also covers the popstate path.
923
- if(this.active)try{this.handleNavigation(a);}catch(b){this.log("[error] navigation handler threw (".concat(a,"), page view skipped: ").concat(b));}},a.prototype.handleNavigation=function(a){var b=currentPage(),c=this.lastPage?pageKey(this.lastPage):null;return this.log("[detect] navigation signal (source: ".concat(a,", candidate: ").concat(describePage(b),", last: ").concat(describePage(this.lastPage),")")),isNewPage(c,pageKey(b))?void(this.log("[accept] page changed, scheduling fire (source: ".concat(a,", from: ").concat(describePage(this.lastPage),", to: ").concat(describePage(b),")")),this.lastPage=b,this.scheduleFire(b)):void this.log("[dedupe] page unchanged, skipping (source: ".concat(a,", page: ").concat(describePage(b),")"))},a.prototype.scheduleFire=function(a){var b=this,c=setTimeout(function(){return b.pendingNavigations=b.pendingNavigations.filter(function(a){return a.timeoutId!==c}),b.active?void(b.mpInstance._SessionManager.resetSessionTimer(),b.firePageView(a)):void b.log("[defer] fire aborted, tracker inactive (torn down before flush)")},0);this.pendingNavigations.push({page:a,timeoutId:c});},a.prototype.firePageView=function(a){var b=window.document.title,c=buildPageViewEvent(__assign(__assign({},a),{hostname:window.location.hostname,title:b}));this.log("[fire] deferred flush -> _Events.logEvent(PageView) (page: ".concat(describePage(a),", title: ").concat(b,")")),this.mpInstance._Events.logEvent(c);},a.prototype.log=function(a){this.mpInstance.Logger.verbose("mParticle APV: ".concat(a));},a}();
937
+ if(this.active)try{this.handleNavigation(a);}catch(b){this.log("[error] navigation handler threw (".concat(a,"), page view skipped: ").concat(b));}},a.prototype.handleNavigation=function(a){var b=currentPage(),c=this.lastPage?pageKey(this.lastPage):null;return this.log("[detect] navigation signal (source: ".concat(a,", candidate: ").concat(describePage(b),", last: ").concat(describePage(this.lastPage),")")),isNewPage(c,pageKey(b))?void(this.log("[accept] page changed, scheduling fire (source: ".concat(a,", from: ").concat(describePage(this.lastPage),", to: ").concat(describePage(b),")")),this.lastPage=b,this.scheduleFire(b)):void this.log("[dedupe] page unchanged, skipping (source: ".concat(a,", page: ").concat(describePage(b),")"))},a.prototype.scheduleFire=function(a){var b=this,c=setTimeout(function(){return b.pendingNavigations=b.pendingNavigations.filter(function(a){return a.timeoutId!==c}),b.active?void(b.mpInstance._SessionManager.resetSessionTimer(),b.firePageView(a)):void b.log("[defer] fire aborted, tracker inactive (torn down before flush)")},0);this.pendingNavigations.push({page:a,timeoutId:c});},a.prototype.firePageView=function(a){var b=window.document.title,c=buildPageViewEvent(__assign(__assign({},a),{hostname:window.location.hostname,title:b,isAutoPageView:this.isAutoPageView}));this.log("[fire] deferred flush -> _Events.logEvent(PageView) (page: ".concat(describePage(a),", title: ").concat(b,")")),this.mpInstance._Events.logEvent(c);},a.prototype.log=function(a){this.mpInstance.Logger.verbose("mParticle APV: ".concat(a));},a}();
924
938
 
925
939
  var Messages$3=Constants.Messages;function Events(a){var b=this;// The auto page view for the landing page. The SPA navigations that follow it
926
940
  // come from PageViewTracker instead, so both emitters attach the same
@@ -928,19 +942,21 @@ var Messages$3=Constants.Messages;function Events(a){var b=this;// The auto page
928
942
  // attribution, since utm_*/gclid live on the entry URL.
929
943
  this.logEvent=function(b,c){if(a.Logger.verbose(Messages$3.InformationMessages.StartingLogEvent+": "+b.name),a._Helpers.canLog()){var d=a._ServerModel.createEventObject(b);a._APIClient.sendEventToServer(d,c);}else a.Logger.verbose(Messages$3.InformationMessages.AbandonLogEvent);},this.startTracking=function(b){function c(b,c){if(b)try{c?b(c):b();}catch(b){a.Logger.error("Error invoking the callback passed to startTrackingLocation."),a.Logger.error(b);}}if(!a._Store.isTracking)"geolocation"in navigator&&(a._Store.watchPositionId=navigator.geolocation.watchPosition(function e(d){// prevents callback from being fired multiple times
930
944
  a._Store.currentPosition={lat:d.coords.latitude,lng:d.coords.longitude},c(b,d),b=null,a._Store.isTracking=!0;},function d(){// prevents callback from being fired multiple times
931
- c(b),b=null,a._Store.isTracking=!1;}));else {var d={coords:{latitude:a._Store.currentPosition.lat,longitude:a._Store.currentPosition.lng}};c(b,d);}},this.stopTracking=function(){a._Store.isTracking&&(navigator.geolocation.clearWatch(a._Store.watchPositionId),a._Store.currentPosition=null,a._Store.isTracking=!1);},this.logOptOut=function(){a.Logger.verbose(Messages$3.InformationMessages.StartingLogOptOut);var b=a._ServerModel.createEventObject({messageType:Types.MessageType.OptOut,eventType:Types.EventType.Other});a._APIClient.sendEventToServer(b);},this.logAST=function(){b.logEvent({messageType:Types.MessageType.AppStateTransition});},this.logPageView=function(){b.logEvent({messageType:Types.MessageType.PageView,name:"PageView",data:__assign(__assign({},allowedQueryParams(getHref())),{hostname:window.location.hostname,title:window.document.title}),eventType:Types.EventType.Unknown});},this.logProductActionEvent=function(c,d,e,f,g,h){var i=a._Ecommerce.createCommerceEventObject(f,h),j=Array.isArray(d)?d:[d];j.forEach(function(b){b.TotalAmount&&(b.TotalAmount=a._Ecommerce.sanitizeAmount(b.TotalAmount,"TotalAmount")),b.Position&&(b.Position=a._Ecommerce.sanitizeAmount(b.Position,"Position")),b.Price&&(b.Price=a._Ecommerce.sanitizeAmount(b.Price,"Price")),b.Quantity&&(b.Quantity=a._Ecommerce.sanitizeAmount(b.Quantity,"Quantity"));}),i&&(i.EventCategory=a._Ecommerce.convertProductActionToEventType(c),i.EventName+=a._Ecommerce.getProductActionEventName(c),i.ProductAction={ProductActionType:c,ProductList:j},Types.ProductActionType.isRoktCommerceType(c)&&(i.CustomFlags=i.CustomFlags||{},i.CustomFlags["Rokt.CommerceEventType"]=Types.ProductActionType.getExpansionName(c)),a._Helpers.isObject(g)&&a._Ecommerce.convertTransactionAttributesToProductAction(g,i.ProductAction),b.logCommerceEvent(i,e,h));},this.logPurchaseEvent=function(c,d,e,f){var g=a._Ecommerce.createCommerceEventObject(f);g&&(g.EventName+=a._Ecommerce.getProductActionEventName(Types.ProductActionType.Purchase),g.EventCategory=Types.CommerceEventType.ProductPurchase,g.ProductAction={ProductActionType:Types.ProductActionType.Purchase,ProductList:Array.isArray(d)?d:[d]},a._Ecommerce.convertTransactionAttributesToProductAction(c,g.ProductAction),b.logCommerceEvent(g,e));},this.logPromotionEvent=function(c,d,e,f,g){var h=a._Ecommerce.createCommerceEventObject(f);h&&(h.EventName+=a._Ecommerce.getPromotionActionEventName(c),h.EventCategory=a._Ecommerce.convertPromotionActionToEventType(c),h.PromotionAction={PromotionActionType:c,PromotionList:Array.isArray(d)?d:[d]},b.logCommerceEvent(h,e,g));},this.logImpressionEvent=function(c,d,e,f){var g=a._Ecommerce.createCommerceEventObject(e);g&&(g.EventName+="Impression",g.EventCategory=Types.CommerceEventType.ProductImpression,!Array.isArray(c)&&(c=[c]),g.ProductImpressions=[],c.forEach(function(a){g.ProductImpressions.push({ProductImpressionList:a.Name,ProductList:Array.isArray(a.Product)?a.Product:[a.Product]});}),b.logCommerceEvent(g,d,f));},this.logCommerceEvent=function(b,c,d){// If a developer typos the ProductActionType, the event category will be
945
+ c(b),b=null,a._Store.isTracking=!1;}));else {var d={coords:{latitude:a._Store.currentPosition.lat,longitude:a._Store.currentPosition.lng}};c(b,d);}},this.stopTracking=function(){a._Store.isTracking&&(navigator.geolocation.clearWatch(a._Store.watchPositionId),a._Store.currentPosition=null,a._Store.isTracking=!1);},this.logOptOut=function(){a.Logger.verbose(Messages$3.InformationMessages.StartingLogOptOut);var b=a._ServerModel.createEventObject({messageType:Types.MessageType.OptOut,eventType:Types.EventType.Other});a._APIClient.sendEventToServer(b);},this.logAST=function(){b.logEvent({messageType:Types.MessageType.AppStateTransition});},this.logPageView=function(a){b.logEvent({messageType:Types.MessageType.PageView,name:"PageView",data:__assign(__assign(__assign({},allowedQueryParams(getHref())),{hostname:window.location.hostname,title:window.document.title}),autoPageViewAttribute(a&&a.isAutoPageView)),eventType:Types.EventType.Unknown});},this.logProductActionEvent=function(c,d,e,f,g,h){var i=a._Ecommerce.createCommerceEventObject(f,h),j=Array.isArray(d)?d:[d];j.forEach(function(b){b.TotalAmount&&(b.TotalAmount=a._Ecommerce.sanitizeAmount(b.TotalAmount,"TotalAmount")),b.Position&&(b.Position=a._Ecommerce.sanitizeAmount(b.Position,"Position")),b.Price&&(b.Price=a._Ecommerce.sanitizeAmount(b.Price,"Price")),b.Quantity&&(b.Quantity=a._Ecommerce.sanitizeAmount(b.Quantity,"Quantity"));}),i&&(i.EventCategory=a._Ecommerce.convertProductActionToEventType(c),i.EventName+=a._Ecommerce.getProductActionEventName(c),i.ProductAction={ProductActionType:c,ProductList:j},Types.ProductActionType.isRoktCommerceType(c)&&(i.CustomFlags=i.CustomFlags||{},i.CustomFlags["Rokt.CommerceEventType"]=Types.ProductActionType.getExpansionName(c)),a._Helpers.isObject(g)&&a._Ecommerce.convertTransactionAttributesToProductAction(g,i.ProductAction),b.logCommerceEvent(i,e,h));},this.logPurchaseEvent=function(c,d,e,f){var g=a._Ecommerce.createCommerceEventObject(f);g&&(g.EventName+=a._Ecommerce.getProductActionEventName(Types.ProductActionType.Purchase),g.EventCategory=Types.CommerceEventType.ProductPurchase,g.ProductAction={ProductActionType:Types.ProductActionType.Purchase,ProductList:Array.isArray(d)?d:[d]},a._Ecommerce.convertTransactionAttributesToProductAction(c,g.ProductAction),b.logCommerceEvent(g,e));},this.logPromotionEvent=function(c,d,e,f,g){var h=a._Ecommerce.createCommerceEventObject(f);h&&(h.EventName+=a._Ecommerce.getPromotionActionEventName(c),h.EventCategory=a._Ecommerce.convertPromotionActionToEventType(c),h.PromotionAction={PromotionActionType:c,PromotionList:Array.isArray(d)?d:[d]},b.logCommerceEvent(h,e,g));},this.logImpressionEvent=function(c,d,e,f){var g=a._Ecommerce.createCommerceEventObject(e);g&&(g.EventName+="Impression",g.EventCategory=Types.CommerceEventType.ProductImpression,!Array.isArray(c)&&(c=[c]),g.ProductImpressions=[],c.forEach(function(a){g.ProductImpressions.push({ProductImpressionList:a.Name,ProductList:Array.isArray(a.Product)?a.Product:[a.Product]});}),b.logCommerceEvent(g,d,f));},this.logCommerceEvent=function(b,c,d){// If a developer typos the ProductActionType, the event category will be
932
946
  // null, resulting in kit forwarding errors on the server.
933
947
  // The check for `ProductAction` is required to denote that these are
934
948
  // ProductAction events, and not impression or promotions
935
949
  if(a.Logger.verbose(Messages$3.InformationMessages.StartingLogCommerceEvent),b.ProductAction&&null===b.EventCategory)return void a.Logger.error("Commerce event not sent. The mParticle.ProductActionType you passed was invalid. Re-check your code.");var e=a._Helpers.sanitizeAttributes(c,b.EventName);a._Helpers.canLog()?(e&&(b.EventAttributes=e),b.ProductAction&&a._Ecommerce.calculateProductActionTotalAmount(b.ProductAction),a._APIClient.sendEventToServer(b,d),a._Persistence.update()):a.Logger.verbose(Messages$3.InformationMessages.AbandonLogEvent);},this.addEventHandler=function(c,d,f,g,h){var j,k,e=[],l=function handler(c){var d=function timeoutHandler(){j.href?window.location.href=j.href:j.submit&&j.submit();};a.Logger.verbose("DOM event triggered, handling event"),b.logEvent({messageType:Types.MessageType.PageEvent,name:"function"==typeof f?f(j):f,data:"function"==typeof g?g(j):g,eventType:h||Types.EventType.Other}),(j.href&&"_blank"!==j.target||j.submit)&&(c.preventDefault?c.preventDefault():c.returnValue=!1,setTimeout(d,a._Store.SDKConfig.timeout));};if(!d)return void a.Logger.error("Can't bind event, selector is required");// Handle a css selector string or a dom element
936
950
  if("string"==typeof d?e=document.querySelectorAll(d):d.nodeType&&(e=[d]),e.length)for(a.Logger.verbose("Found "+e.length+" element"+(1<e.length?"s":"")+", attaching event handlers"),k=0;k<e.length;k++)j=e[k],j.addEventListener?j.addEventListener(c,l,!1):j.attachEvent?j.attachEvent("on"+c,l):j["on"+c]=l;else a.Logger.verbose("No elements found");};}
937
951
 
938
- function isAttributeKeyAllowed(a,b){return !(null!==a&&void 0!==a)||!a.isAttributeKeyBlocked(b)}function isIdentityAllowed(a,b){return !(null!==a&&void 0!==a)||!a.isIdentityBlocked(b)}function copyUserAttributeValue(a){return Array.isArray(a)?a.slice():a}function buildUserAttributesCopy(a,b){var c={};if(!a)return c;for(var d in a)a.hasOwnProperty(d)&&isAttributeKeyAllowed(b,d)&&(c[d]=copyUserAttributeValue(a[d]));return c}function buildUserAttributeLists(a,b){var c={};for(var d in a)a.hasOwnProperty(d)&&Array.isArray(a[d])&&isAttributeKeyAllowed(b,d)&&(c[d]=a[d].slice());return c}function buildFilteredUserIdentities(a,b,c){var d={},e=a;for(var f in e)if(e.hasOwnProperty(f)){var g=Types.IdentityType.getIdentityName(c(f));isIdentityAllowed(b,g)&&(d[g]=e[f]);}return d}function filteredMparticleUser(a,b,c,d){function e(){var e=buildUserAttributesCopy(c._Store.getUserAttributes(a),d);return c._Helpers.filterUserAttributes(e,b.userAttributeFilters)}return {getUserIdentities:function getUserIdentities(){var e=buildFilteredUserIdentities(c._Store.getUserIdentities(a),d,c._Helpers.parseNumber);return e=c._Helpers.filterUserIdentitiesForForwarders(e,b.userIdentityFilters),{userIdentities:e}},getMPID:function getMPID(){return a},getUserAttributesLists:function getUserAttributesLists(a){var b=buildUserAttributeLists(e(),d);return c._Helpers.filterUserAttributes(b,a.userAttributeFilters)},getAllUserAttributes:e}}
952
+ function isAttributeKeyAllowed(a,b){return !(null!==a&&void 0!==a)||!a.isAttributeKeyBlocked(b)}function isIdentityAllowed(a,b){return !(null!==a&&void 0!==a)||!a.isIdentityBlocked(b)}function copyUserAttributeValue(a){return Array.isArray(a)?a.slice():a}function buildUserAttributesCopy(a,b){var c={};if(!a)return c;for(var d in a)hasOwnProp(a,d)&&!isReservedStoredPropertyName(d)&&isAttributeKeyAllowed(b,d)&&(c[d]=copyUserAttributeValue(a[d]));return c}function buildUserAttributeLists(a,b){var c={};for(var d in a)hasOwnProp(a,d)&&!isReservedStoredPropertyName(d)&&Array.isArray(a[d])&&isAttributeKeyAllowed(b,d)&&(c[d]=a[d].slice());return c}function buildFilteredUserIdentities(a,b){var c={},d=a;for(var e in d)if(hasOwnProp(d,e)){var f=getIdentityTypeFromStoredKey(e);// Must be `=== null`: IdentityType.Other is 0, so a falsy check would
953
+ // drop a valid stored Other identity.
954
+ if(null!==f){var g=Types.IdentityType.getIdentityName(f);isIdentityAllowed(b,g)&&(c[g]=d[e]);}}return c}function filteredMparticleUser(a,b,c,d){function e(){var e=buildUserAttributesCopy(c._Store.getUserAttributes(a),d);return c._Helpers.filterUserAttributes(e,b.userAttributeFilters)}return {getUserIdentities:function getUserIdentities(){var e=buildFilteredUserIdentities(c._Store.getUserIdentities(a),d);return e=c._Helpers.filterUserIdentitiesForForwarders(e,b.userIdentityFilters),{userIdentities:e}},getMPID:function getMPID(){return a},getUserAttributesLists:function getUserAttributesLists(a){var b=buildUserAttributeLists(e(),d);return c._Helpers.filterUserAttributes(b,a.userAttributeFilters)},getAllUserAttributes:e}}
939
955
 
940
956
  var FORWARDING_RULE_MESSAGE_TYPES=[Types.MessageType.PageEvent,Types.MessageType.PageView,Types.MessageType.Commerce];function inFilteredList(a,b){return !!(a&&a.length)&&inArray(a,b)}function isBlockedByForwardingRule(a,b,c){if(!FORWARDING_RULE_MESSAGE_TYPES.includes(a)||!c.filteringEventAttributeValue||!c.filteringEventAttributeValue.eventAttributeName||!c.filteringEventAttributeValue.eventAttributeValue)return !1;var d=null;if(b)for(var e in b)if(b.hasOwnProperty(e)){var f=KitFilterHelper.hashAttributeConditionalForwarding(e);if(f===c.filteringEventAttributeValue.eventAttributeName){d={name:f,value:KitFilterHelper.hashAttributeConditionalForwarding(b[e])};break}}var g=null!==d&&d.value===c.filteringEventAttributeValue.eventAttributeValue,h=!0===c.filteringEventAttributeValue.includeOnMatch?g:!g;return !h}function isBlockedByEventFilter(a,b,c,d){if(a===Types.MessageType.PageEvent&&(inFilteredList(d.eventNameFilters,b)||inFilteredList(d.eventTypeFilters,c)))return !0;return !!(a===Types.MessageType.Commerce&&inFilteredList(d.eventTypeFilters,c))||!!(a===Types.MessageType.PageView&&inFilteredList(d.screenNameFilters,b))}function filterEventAttributes(a,b,c,d,e){if(!d)return d;var f;if(a===Types.MessageType.PageEvent?f=e.attributeFilters:a===Types.MessageType.PageView&&(f=e.screenAttributeFilters),!f)return d;var g={};for(var h in d)if(d.hasOwnProperty(h)){var i=KitFilterHelper.hashEventAttributeKey(b,c,h);inArray(f,i)||(g[h]=d[h]);}return g}function filterUserIdentities(a,b){return a&&a.length?a.filter(function(a){return !inArray(b,KitFilterHelper.hashUserIdentity(a.Type))}):a||[]}
941
957
 
942
958
  var _a;var _b=Constants.IdentityMethods,Modify$2=_b.Modify,Identify$1=_b.Identify,Login$1=_b.Login,Logout$1=_b.Logout,identityCompleteKitMethods=(_a={},_a[Identify$1]="onIdentifyComplete",_a[Login$1]="onLoginComplete",_a[Logout$1]="onLogoutComplete",_a[Modify$2]="onModifyComplete",_a);// Maps an identity method to the kit callback that reports its completion.
943
- function removeBlockedUserIdentities(a,b){var c=a,d={};for(var e in c)c.hasOwnProperty(e)&&isIdentityAllowed(b,e)&&(d[e]=c[e]);return d}function userAttributesMatchFilter(a,b){for(var c in a)if(a.hasOwnProperty(c)){var d=KitFilterHelper.hashAttributeConditionalForwarding(c),e=KitFilterHelper.hashAttributeConditionalForwarding(a[c]);if(d===b.userAttributeName&&e===b.userAttributeValue)return !0}return !1}function Forwarders(a,b){var c=this,d=this;this.forwarderStatsUploader=new APIClient(a,b).initializeForwarderStatsUploader();var e={setUserAttribute:"setUserAttribute",removeUserAttribute:"removeUserAttribute"};// TODO: https://go.mparticle.com/work/SQDSDKS-6036
959
+ function removeBlockedUserIdentities(a,b){var c=a,d={};for(var e in c)c.hasOwnProperty(e)&&isIdentityAllowed(b,e)&&(d[e]=c[e]);return d}function userAttributesMatchFilter(a,b){for(var c in a)if(hasOwnProp(a,c)){var d=KitFilterHelper.hashAttributeConditionalForwarding(c),e=KitFilterHelper.hashAttributeConditionalForwarding(a[c]);if(d===b.userAttributeName&&e===b.userAttributeValue)return !0}return !1}function Forwarders(a,b){var c=this,d=this;this.forwarderStatsUploader=new APIClient(a,b).initializeForwarderStatsUploader();var e={setUserAttribute:"setUserAttribute",removeUserAttribute:"removeUserAttribute"};// TODO: https://go.mparticle.com/work/SQDSDKS-6036
944
960
  // Processing forwarders is a 2 step process:
945
961
  // 1. Configure the kit
946
962
  // 2. Initialize the kit
@@ -1115,7 +1131,9 @@ return e<f&&(e=f,g<e&&a.Logger.warning("Source User has not been seen in the las
1115
1131
  * Get user identities for current user
1116
1132
  * @method getUserIdentities
1117
1133
  * @return {Object} an object with userIdentities as its key
1118
- */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}},/**
1134
+ */getUserIdentities:function getUserIdentities(){var c={},d=a._Store.getUserIdentities(b);for(var e in d)if(hasOwnProp(d,e)){var f=getIdentityTypeFromStoredKey(e);// Must be `=== null`: IdentityType.Other is 0, so a falsy
1135
+ // check would drop a valid stored Other identity.
1136
+ null!==f&&(c[Types.IdentityType.getIdentityName(f)]=d[e]);}return {userIdentities:c}},/**
1119
1137
  * Get the MPID of the current user
1120
1138
  * @method getMPID
1121
1139
  * @return {String} the current user MPID as a string
@@ -1143,7 +1161,7 @@ setUserAttributes:function setUserAttributes(b){if(a._SessionManager.resetSessio
1143
1161
  * Removes a specific user attribute
1144
1162
  * @method removeUserAttribute
1145
1163
  * @param {String} key
1146
- */removeUserAttribute:function removeUserAttribute(c){var d,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 {d=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],d&&d[b]&&(d[b].ua=f,a._Persistence.savePersistence(d)),e.sendUserAttributeChangeEvent(c,null,h,!1,!0,this),a._Forwarders.initForwarders(e.IdentityAPI.getCurrentUser().getUserIdentities().userIdentities,a._APIClient.prepareForwardingStats),a._Forwarders.handleForwarderUserAttributes("removeUserAttribute",c,null);}},/**
1164
+ */removeUserAttribute:function removeUserAttribute(c){var d,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 {d=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],d&&isObject(d[b])&&(d[b].ua=f,a._Persistence.savePersistence(d)),e.sendUserAttributeChangeEvent(c,null,h,!1,!0,this),a._Forwarders.initForwarders(e.IdentityAPI.getCurrentUser().getUserIdentities().userIdentities,a._APIClient.prepareForwardingStats),a._Forwarders.handleForwarderUserAttributes("removeUserAttribute",c,null);}},/**
1147
1165
  * Sets a list of user attributes
1148
1166
  * @method setUserAttributeList
1149
1167
  * @param {String} key
@@ -1155,15 +1173,15 @@ setUserAttributeList:function setUserAttributeList(c,d){if(a._SessionManager.res
1155
1173
  if(l?(j=!1,h=g[l],delete g[l]):j=!0,g[c]=f,a._Store.setUserAttributes(b,g),!h||!Array.isArray(h))k=!0;else if(d.length!==h.length)k=!0;else for(var m=0;m<d.length;m++)if(h[m]!==d[m]){k=!0;break}k&&e.sendUserAttributeChangeEvent(c,d,h,j,!1,this),a._Forwarders.initForwarders(e.IdentityAPI.getCurrentUser().getUserIdentities().userIdentities,a._APIClient.prepareForwardingStats),a._Forwarders.handleForwarderUserAttributes("setUserAttribute",c,f);}},/**
1156
1174
  * Removes all user attributes
1157
1175
  * @method removeAllUserAttributes
1158
- */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(e.IdentityAPI.getCurrentUser().getUserIdentities().userIdentities,a._APIClient.prepareForwardingStats),b)for(var c in b)b.hasOwnProperty(c)&&a._Forwarders.handleForwarderUserAttributes("removeUserAttribute",c,null),this.removeUserAttribute(c);},/**
1176
+ */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(e.IdentityAPI.getCurrentUser().getUserIdentities().userIdentities,a._APIClient.prepareForwardingStats),b)for(var c in b)hasOwnProp(b,c)&&a._Forwarders.handleForwarderUserAttributes("removeUserAttribute",c,null),this.removeUserAttribute(c);},/**
1159
1177
  * Returns all user attribute keys that have values that are arrays
1160
1178
  * @method getUserAttributesLists
1161
1179
  * @return {Object} an object of only keys with array values. Example: { attr1: [1, 2, 3], attr2: ['a', 'b', 'c'] }
1162
- */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},/**
1180
+ */getUserAttributesLists:function getUserAttributesLists(){var a,b={};for(var c in a=this.getAllUserAttributes(),a)hasOwnProp(a,c)&&!isReservedStoredPropertyName(c)&&Array.isArray(a[c])&&(b[c]=a[c].slice());return b},/**
1163
1181
  * Returns all user attributes
1164
1182
  * @method getAllUserAttributes
1165
1183
  * @return {Object} an object of all user attributes. Example: { attr1: 'value1', attr2: ['a', 'b', 'c'] }
1166
- */getAllUserAttributes:function getAllUserAttributes(){var c=a._Store.getUserAttributes,d={},e=c(b);if(e)for(var f in e)if(e.hasOwnProperty(f)){var g=e[f];d[f]=Array.isArray(g)?g.slice():g;}return d},/**
1184
+ */getAllUserAttributes:function getAllUserAttributes(){var c=a._Store.getUserAttributes,d={},e=c(b);if(e)for(var f in e)if(hasOwnProp(e,f)&&!isReservedStoredPropertyName(f)){var g=e[f];d[f]=Array.isArray(g)?g.slice():g;}return d},/**
1167
1185
  * Returns the Consent State stored locally for this user.
1168
1186
  * @method getConsentState
1169
1187
  * @return a ConsentState object
@@ -1182,7 +1200,7 @@ return a._Helpers.getFeatureFlag(FeatureFlags$1.AudienceAPI)?void(null===e.audie
1182
1200
  // processQueuedEvents, draining the event queue. The
1183
1201
  // attribute must be in the store before that happens so
1184
1202
  // appendUserInfo picks it up.
1185
- null===(l=a._CookieConsentManager)||void 0===l?void 0:l.syncNoTargetingAttribute(p),e.sendUserIdentityChangeEvent(x,h,o.mpid,y);}if(f){var z=0===b.status?HTTPCodes$2.noHttpCoverage:b.status;a._Helpers.invokeCallback(f,z,o||null,p);}else o&&!isEmpty(o.errors)&&// https://go.mparticle.com/work/SQDSDKS-6500
1203
+ null===(l=a._CookieConsentManager)||void 0===l?void 0:l.syncNoTargetingAttribute(p),e.sendUserIdentityChangeEvent(x,h,o.mpid,y);}if(f){var z=0===b.status?HTTPCodes$2.noHttpCoverage:b.status;a._Helpers.invokeCallback(f,z,o||null,p,d);}else o&&!isEmpty(o.errors)&&// https://go.mparticle.com/work/SQDSDKS-6500
1186
1204
  a.Logger.error("Received HTTP response code of "+b.status+" - "+o.errors[0].message);a.Logger.verbose("Successfully parsed Identity Response"),null===(m=a._APIClient)||void 0===m?void 0:m.processQueuedEvents();}catch(c){f&&a._Helpers.invokeCallback(f,b.status,o||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,a.Logger);},this.sendUserIdentityChangeEvent=function(b,c,d,f){var g;if(d||c===Modify$1)// https://go.mparticle.com/work/SQDSDKS-6501
1187
1205
  {// https://go.mparticle.com/work/SQDSDKS-6354
1188
1206
  var h=this.IdentityAPI.getUser(d);for(var i in b)// Verifies a change actually happened
@@ -1201,7 +1219,7 @@ var CCPAPurpose=Constants.CCPAPurpose;function Consent(a){var b=this;// this fun
1201
1219
  this.isEnabledForUserConsent=function(a,b){if(!a||!a.values||!a.values.length)return !0;if(!b)return !1;var c,d={},e=b.getConsentState();if(e){// the server hashes consent purposes in the following way:
1202
1220
  // GDPR - '1' + purpose name
1203
1221
  // CCPA - '2data_sale_opt_out' (there is only 1 purpose of data_sale_opt_out for CCPA)
1204
- var f=e.getGDPRConsentState();if(f)for(var g in f)f.hasOwnProperty(g)&&(c=KitFilterHelper.hashConsentPurposeConditionalForwarding("1",g),d[c]=f[g].Consented);var h=e.getCCPAConsentState();h&&(c=KitFilterHelper.hashConsentPurposeConditionalForwarding("2",CCPAPurpose),d[c]=h.Consented);}var i=a.values.some(function(a){var b=a.consentPurpose,c=a.hasConsented;return !!d.hasOwnProperty(b)&&d[b]===c});return a.includeOnMatch===i},this.createPrivacyConsent=function(b,c,d,e,f){return "boolean"==typeof b?c&&isNaN(c)?(a.Logger.error("Timestamp must be a valid number when constructing a Consent object."),null):d&&"string"!=typeof d?(a.Logger.error("Document must be a valid string when constructing a Consent object."),null):e&&"string"!=typeof e?(a.Logger.error("Location must be a valid string when constructing a Consent object."),null):f&&"string"!=typeof f?(a.Logger.error("Hardware ID must be a valid string when constructing a Consent object."),null):{Consented:b,Timestamp:c||Date.now(),ConsentDocument:d,Location:e,HardwareId:f}:(a.Logger.error("Consented boolean is required when constructing a Consent object."),null)},this.ConsentSerialization={toMinifiedJsonObject:function toMinifiedJsonObject(a){var b,c={};if(a){var d=a.getGDPRConsentState();if(d)for(var e in c.gdpr={},d)if(d.hasOwnProperty(e)){var f=d[e];c.gdpr[e]={},"boolean"==typeof f.Consented&&(c.gdpr[e].c=f.Consented),"number"==typeof f.Timestamp&&(c.gdpr[e].ts=f.Timestamp),"string"==typeof f.ConsentDocument&&(c.gdpr[e].d=f.ConsentDocument),"string"==typeof f.Location&&(c.gdpr[e].l=f.Location),"string"==typeof f.HardwareId&&(c.gdpr[e].h=f.HardwareId);}var g=a.getCCPAConsentState();g&&(c.ccpa=(b={},b[CCPAPurpose]={},b),"boolean"==typeof g.Consented&&(c.ccpa[CCPAPurpose].c=g.Consented),"number"==typeof g.Timestamp&&(c.ccpa[CCPAPurpose].ts=g.Timestamp),"string"==typeof g.ConsentDocument&&(c.ccpa[CCPAPurpose].d=g.ConsentDocument),"string"==typeof g.Location&&(c.ccpa[CCPAPurpose].l=g.Location),"string"==typeof g.HardwareId&&(c.ccpa[CCPAPurpose].h=g.HardwareId));}return c},fromMinifiedJsonObject:function fromMinifiedJsonObject(a){var c=b.createConsentState();if(a.gdpr)for(var d in a.gdpr)if(a.gdpr.hasOwnProperty(d)){var e=b.createPrivacyConsent(a.gdpr[d].c,a.gdpr[d].ts,a.gdpr[d].d,a.gdpr[d].l,a.gdpr[d].h);c.addGDPRConsentState(d,e);}if(a.ccpa&&a.ccpa.hasOwnProperty(CCPAPurpose)){var f=b.createPrivacyConsent(a.ccpa[CCPAPurpose].c,a.ccpa[CCPAPurpose].ts,a.ccpa[CCPAPurpose].d,a.ccpa[CCPAPurpose].l,a.ccpa[CCPAPurpose].h);c.setCCPAConsentState(f);}return c}},this.createConsentState=function(c){function d(a){if("string"!=typeof a)return null;var b=a.trim();return b.length?b.toLowerCase():null}/**
1222
+ var f=e.getGDPRConsentState();if(f)for(var g in f)f.hasOwnProperty(g)&&(c=KitFilterHelper.hashConsentPurposeConditionalForwarding("1",g),d[c]=f[g].Consented);var h=e.getCCPAConsentState();h&&(c=KitFilterHelper.hashConsentPurposeConditionalForwarding("2",CCPAPurpose),d[c]=h.Consented);}var i=a.values.some(function(a){var b=a.consentPurpose,c=a.hasConsented;return !!d.hasOwnProperty(b)&&d[b]===c});return a.includeOnMatch===i},this.createPrivacyConsent=function(b,c,d,e,f){return "boolean"==typeof b?c&&isNaN(c)?(a.Logger.error("Timestamp must be a valid number when constructing a Consent object."),null):d&&"string"!=typeof d?(a.Logger.error("Document must be a valid string when constructing a Consent object."),null):e&&"string"!=typeof e?(a.Logger.error("Location must be a valid string when constructing a Consent object."),null):f&&"string"!=typeof f?(a.Logger.error("Hardware ID must be a valid string when constructing a Consent object."),null):{Consented:b,Timestamp:c||Date.now(),ConsentDocument:d,Location:e,HardwareId:f}:(a.Logger.error("Consented boolean is required when constructing a Consent object."),null)},this.ConsentSerialization={toMinifiedJsonObject:function toMinifiedJsonObject(a){var b,c={};if(a){var d=a.getGDPRConsentState();if(d)for(var e in c.gdpr={},d)if(d.hasOwnProperty(e)){var f=d[e];c.gdpr[e]={},"boolean"==typeof f.Consented&&(c.gdpr[e].c=f.Consented),"number"==typeof f.Timestamp&&(c.gdpr[e].ts=f.Timestamp),"string"==typeof f.ConsentDocument&&(c.gdpr[e].d=f.ConsentDocument),"string"==typeof f.Location&&(c.gdpr[e].l=f.Location),"string"==typeof f.HardwareId&&(c.gdpr[e].h=f.HardwareId);}var g=a.getCCPAConsentState();g&&(c.ccpa=(b={},b[CCPAPurpose]={},b),"boolean"==typeof g.Consented&&(c.ccpa[CCPAPurpose].c=g.Consented),"number"==typeof g.Timestamp&&(c.ccpa[CCPAPurpose].ts=g.Timestamp),"string"==typeof g.ConsentDocument&&(c.ccpa[CCPAPurpose].d=g.ConsentDocument),"string"==typeof g.Location&&(c.ccpa[CCPAPurpose].l=g.Location),"string"==typeof g.HardwareId&&(c.ccpa[CCPAPurpose].h=g.HardwareId));}return c},fromMinifiedJsonObject:function fromMinifiedJsonObject(a){var c=b.createConsentState();if(a.gdpr)for(var d in a.gdpr)if(hasOwnProp(a.gdpr,d)){var e=b.createPrivacyConsent(a.gdpr[d].c,a.gdpr[d].ts,a.gdpr[d].d,a.gdpr[d].l,a.gdpr[d].h);c.addGDPRConsentState(d,e);}if(a.ccpa&&hasOwnProp(a.ccpa,CCPAPurpose)){var f=b.createPrivacyConsent(a.ccpa[CCPAPurpose].c,a.ccpa[CCPAPurpose].ts,a.ccpa[CCPAPurpose].d,a.ccpa[CCPAPurpose].l,a.ccpa[CCPAPurpose].h);c.setCCPAConsentState(f);}return c}},this.createConsentState=function(c){function d(a){if("string"!=typeof a)return null;var b=a.trim();return b.length?b.toLowerCase():null}/**
1205
1223
  * Invoke these methods on a consent state object.
1206
1224
  * <p>
1207
1225
  * Usage: const consent = mParticle.Consent.createConsentState()
@@ -1307,14 +1325,17 @@ fbclid:{mappedKey:"Facebook.ClickId",processor:facebookClickIdProcessor,output:I
1307
1325
  gclid:{mappedKey:"GoogleEnhancedConversions.Gclid",output:IntegrationOutputs.CUSTOM_FLAGS},gbraid:{mappedKey:"GoogleEnhancedConversions.Gbraid",output:IntegrationOutputs.CUSTOM_FLAGS},wbraid:{mappedKey:"GoogleEnhancedConversions.Wbraid",output:IntegrationOutputs.CUSTOM_FLAGS},// TIKTOK
1308
1326
  ttclid:{mappedKey:"TikTok.Callback",output:IntegrationOutputs.CUSTOM_FLAGS},_ttp:{mappedKey:"tiktok_cookie_id",output:IntegrationOutputs.PARTNER_IDENTITIES},// Snapchat
1309
1327
  // https://businesshelp.snapchat.com/s/article/troubleshooting-click-id?language=en_US
1310
- ScCid:{mappedKey:"SnapchatConversions.ClickId",output:IntegrationOutputs.CUSTOM_FLAGS},// Snapchat
1328
+ ScCid:{mappedKey:"SnapchatConversions.ClickId",output:IntegrationOutputs.CUSTOM_FLAGS},// Pinterest
1329
+ // https://developers.pinterest.com/docs/track-conversions/track-conversions-in-the-api/
1330
+ // https://help.pinterest.com/en/business/article/pinterest-tag-parameters-and-cookies
1331
+ epik:{mappedKey:"Pinterest.click_id",output:IntegrationOutputs.CUSTOM_FLAGS},_epik:{mappedKey:"Pinterest.click_id",output:IntegrationOutputs.CUSTOM_FLAGS},// Snapchat
1311
1332
  // https://developers.snap.com/api/marketing-api/Conversions-API/UsingTheAPI#sending-click-id
1312
1333
  _scid:{mappedKey:"SnapchatConversions.Cookie1",output:IntegrationOutputs.CUSTOM_FLAGS}},integrationMappingRokt={// Rokt
1313
1334
  // https://docs.rokt.com/developers/integration-guides/web/advanced/rokt-id-tag/
1314
1335
  // https://go.mparticle.com/work/SQDSDKS-7167
1315
1336
  rtid:{mappedKey:"passbackconversiontrackingid",output:IntegrationOutputs.INTEGRATION_ATTRIBUTES,moduleId:1277},rclid:{mappedKey:"passbackconversiontrackingid",output:IntegrationOutputs.INTEGRATION_ATTRIBUTES,moduleId:1277},RoktTransactionId:{mappedKey:"passbackconversiontrackingid",output:IntegrationOutputs.INTEGRATION_ATTRIBUTES,moduleId:1277}},IntegrationCapture=/** @class */function(){function a(a){this.initialTimestamp=Date.now(),this.captureMode=a,this.filteredPartnerIdentityMappings=this.filterMappings(IntegrationOutputs.PARTNER_IDENTITIES),this.filteredCustomFlagMappings=this.filterMappings(IntegrationOutputs.CUSTOM_FLAGS),this.filteredIntegrationAttributeMappings=this.filterMappings(IntegrationOutputs.INTEGRATION_ATTRIBUTES);}/**
1316
1337
  * Captures Integration Ids from cookies and query params and stores them in clickIds object
1317
- */return a.prototype.capture=function(){var a=this.captureQueryParams()||{},b=this.captureCookies()||{},c=this.captureLocalStorage()||{};a.fbclid&&b._fbc&&delete b._fbc;// ROKT Rules
1338
+ */return a.prototype.capture=function(){var a=this.captureQueryParams()||{},b=this.captureCookies()||{},c=this.captureLocalStorage()||{};this.applyPinterestRules(a,c,b),a.fbclid&&b._fbc&&delete b._fbc;// ROKT Rules
1318
1339
  // If both rtid or rclid and RoktTransactionId are present, prioritize rtid/rclid
1319
1340
  // If RoktTransactionId is present in both cookies and localStorage,
1320
1341
  // prioritize localStorage
@@ -1326,7 +1347,7 @@ var d=a.rtid||a.rclid,e=c.RoktTransactionId,f=b.RoktTransactionId;d?(e&&delete c
1326
1347
  // }
1327
1348
  // }
1328
1349
  // }
1329
- for(var e in this.clickIds)if(this.clickIds.hasOwnProperty(e)){var f=this.clickIds[e],g=null===(b=this.filteredIntegrationAttributeMappings[e])||void 0===b?void 0:b.mappedKey;if(!isEmpty(g)){var h=null===(c=this.filteredIntegrationAttributeMappings[e])||void 0===c?void 0:c.moduleId;h&&!d[h]&&(d[h]=(a={},a[g]=f,a));}}return d},a.prototype.getClickIds=function(a,b){var c,d={};if(!a)return d;for(var e in a)if(a.hasOwnProperty(e)){var f=a[e],g=null===(c=b[e])||void 0===c?void 0:c.mappedKey;isEmpty(g)||(d[g]=f);}return d},a.prototype.applyProcessors=function(a,b,c){var d,e={},f=this.getActiveIntegrationMapping();for(var g in a)if(a.hasOwnProperty(g)){var h=a[g],i=null===(d=f[g])||void 0===d?void 0:d.processor;e[g]=i?i(h,b,c):h;}return e},a.prototype.filterMappings=function(a){var b={},c=this.getActiveIntegrationMapping();for(var d in c)c[d].output===a&&(b[d]=c[d]);return b},a.prototype.getAllowedKeysForMode=function(){return Object.keys(this.getActiveIntegrationMapping())},a.prototype.getActiveIntegrationMapping=function(){return this.captureMode===Constants.CaptureIntegrationSpecificIdsV2Modes.RoktOnly?integrationMappingRokt:this.captureMode===Constants.CaptureIntegrationSpecificIdsV2Modes.All?__assign(__assign({},integrationMappingExternal),integrationMappingRokt):{}},a}();
1350
+ for(var e in this.clickIds)if(this.clickIds.hasOwnProperty(e)){var f=this.clickIds[e],g=null===(b=this.filteredIntegrationAttributeMappings[e])||void 0===b?void 0:b.mappedKey;if(!isEmpty(g)){var h=null===(c=this.filteredIntegrationAttributeMappings[e])||void 0===c?void 0:c.moduleId;h&&!d[h]&&(d[h]=(a={},a[g]=f,a));}}return d},a.prototype.getClickIds=function(a,b){var c,d={};if(!a)return d;for(var e in a)if(a.hasOwnProperty(e)){var f=a[e],g=null===(c=b[e])||void 0===c?void 0:c.mappedKey;isEmpty(g)||(d[g]=f);}return d},a.prototype.normalizePinterestClickId=function(a){isEmpty(null===a||void 0===a?void 0:a._epik)||isEmpty(null===a||void 0===a?void 0:a.epik)||delete a.epik;},a.prototype.hasPinterestAlias=function(a){return !isEmpty(null===a||void 0===a?void 0:a.epik)||!isEmpty(null===a||void 0===a?void 0:a._epik)},a.prototype.applyPinterestRules=function(a,b,c){var d,e;return this.normalizePinterestClickId(a),this.normalizePinterestClickId(b),this.normalizePinterestClickId(c),(this.hasPinterestAlias(a)||this.hasPinterestAlias(b)||this.hasPinterestAlias(c))&&(null===(d=this.clickIds)||void 0===d||delete d.epik,null===(e=this.clickIds)||void 0===e||delete e._epik),this.hasPinterestAlias(a)?(delete c.epik,delete c._epik,delete b.epik,void delete b._epik):void(this.hasPinterestAlias(b)&&(delete c.epik,delete c._epik))},a.prototype.applyProcessors=function(a,b,c){var d,e={},f=this.getActiveIntegrationMapping();for(var g in a)if(a.hasOwnProperty(g)){var h=a[g],i=null===(d=f[g])||void 0===d?void 0:d.processor;e[g]=i?i(h,b,c):h;}return e},a.prototype.filterMappings=function(a){var b={},c=this.getActiveIntegrationMapping();for(var d in c)c[d].output===a&&(b[d]=c[d]);return b},a.prototype.getAllowedKeysForMode=function(){return Object.keys(this.getActiveIntegrationMapping())},a.prototype.getActiveIntegrationMapping=function(){return this.captureMode===Constants.CaptureIntegrationSpecificIdsV2Modes.RoktOnly?integrationMappingRokt:this.captureMode===Constants.CaptureIntegrationSpecificIdsV2Modes.All?__assign(__assign({},integrationMappingExternal),integrationMappingRokt):{}},a}();
1330
1351
 
1331
1352
  var PASSBACK_CONVERSION_TRACKING_ID="passbackconversiontrackingid",ON_SHOPPABLE_ADS_READY_METHOD="onShoppableAdsReady",RoktManager=/** @class */function(){function a(){this.kit=null,this.filters={},this.currentUser=null,this.messageQueue=new Map,this.sandbox=null,this.placementAttributesMapping=[],this.onReadyCallback=null,this.initialized=!1,this.isShoppableAdsLoaded=!1;}/**
1332
1353
  * Sets a callback to be invoked when RoktManager becomes ready
@@ -1356,7 +1377,7 @@ Promise.resolve(k).then(function(a){h&&h(a);})["catch"](j);}catch(a){j(a);}});}}
1356
1377
  */var CookieConsentManager=/** @class */function(){function a(a){this.flags=a,this.flags={noFunctional:!0===a.noFunctional,noTargeting:!0===a.noTargeting};}/**
1357
1378
  * Returns true if third-party targeting is disabled.
1358
1379
  * Targeting is allowed when noTargeting is false (default).
1359
- */return a.prototype.getNoTargeting=function(){return this.flags.noTargeting},a.prototype.getNoFunctional=function(){return this.flags.noFunctional},a.prototype.syncNoTargetingAttribute=function(a){a&&(this.flags.noTargeting?a.setUserAttribute(NO_TARGETING_ATTRIBUTE,!0):a.getAllUserAttributes().hasOwnProperty(NO_TARGETING_ATTRIBUTE)&&a.removeUserAttribute(NO_TARGETING_ATTRIBUTE));},a}();
1380
+ */return a.prototype.getNoTargeting=function(){return this.flags.noTargeting},a.prototype.getNoFunctional=function(){return this.flags.noFunctional},a.prototype.syncNoTargetingAttribute=function(a){a&&(this.flags.noTargeting?a.setUserAttribute(NO_TARGETING_ATTRIBUTE,!0):hasOwnProp(a.getAllUserAttributes(),NO_TARGETING_ATTRIBUTE)&&a.removeUserAttribute(NO_TARGETING_ATTRIBUTE));},a}();
1360
1381
 
1361
1382
  var ErrorReportingDispatcher=/** @class */function(){function a(){this.services=[];}return a.prototype.register=function(a){this.services.push(a);},a.prototype.report=function(a){var b=this;this.services.forEach(function(c){var d;try{c.report(a);}catch(a){null===(d=b.logger)||void 0===d?void 0:d.error("Error in ErrorReportingService: "+a);}});},a}();
1362
1383
 
@@ -1499,7 +1520,7 @@ if((null===(d=c._APIClient)||void 0===d?void 0:d.uploader)&&c._APIClient.uploade
1499
1520
  var k=c.Identity.getCurrentUser(),l=k?k.getMPID():null,m=k?k.getUserIdentities().userIdentities:{};c._Store.SDKConfig.identifyRequest=c._Store.hasInvalidIdentifyRequest()?{userIdentities:m}:c._Store.SDKConfig.identifyRequest,i(ReportBatching)&&c._ForwardingStatsUploader.startForwardingStatsTimer();// https://go.mparticle.com/work/SQDSDKS-7639
1500
1521
  var n=i(CaptureIntegrationSpecificIds),o=i(CaptureIntegrationSpecificIdsV2),p=o&&o!==CaptureIntegrationSpecificIdsV2Modes.None||!0===n;if(p){var q;n||o===CaptureIntegrationSpecificIdsV2Modes.All?q="all":o===CaptureIntegrationSpecificIdsV2Modes.RoktOnly&&(q="roktonly"),c._IntegrationCapture=new IntegrationCapture(q),c._IntegrationCapture.capture();}// Configure Rokt Manager with user and filtered user
1501
1522
  var r=parseConfig(b,"Rokt",181);if(r){var s=null===(e=r.settings)||void 0===e?void 0:e.accountId;c._Store.setRoktAccountId(s);var t=r.userAttributeFilters,u=filteredMparticleUser(l,{userAttributeFilters:t},c),v={sandbox:null===b||void 0===b?void 0:b.isDevelopmentMode,launcherOptions:null===b||void 0===b?void 0:b.launcherOptions,domain:null===b||void 0===b?void 0:b.domain};// https://go.mparticle.com/work/SQDSDKS-7339
1502
- c._RoktManager.init(r,u,c.Identity,c._Store,c.Logger,v,c.captureTiming,c._ErrorReportingDispatcher,c._LoggingDispatcher,c._IntegrationCapture);}c._Forwarders.processForwarders(b,c._APIClient.prepareForwardingStats),c._Forwarders.processPixelConfigs(b),c._SessionManager.initialize(),c._Events.logAST(),i(j)?(!c._PageViewTracker&&(c.Logger.verbose("mParticle APV: [sdk-init] creating new PageViewTracker for this instance"),c._PageViewTracker=new PageViewTracker(c)),hasInitialPageViewFired()?c.Logger.verbose("mParticle APV: [sdk-init] initial page view already logged this page load, skipping"):(markInitialPageViewFired(),c._Events.logPageView()),c._PageViewTracker.init()):c._PageViewTracker&&c._PageViewTracker.teardown(),processIdentityCallback(c,k,l,m);}// We will continue to clear out the ready queue as part of the initial init flow
1523
+ c._RoktManager.init(r,u,c.Identity,c._Store,c.Logger,v,c.captureTiming,c._ErrorReportingDispatcher,c._LoggingDispatcher,c._IntegrationCapture);}c._Forwarders.processForwarders(b,c._APIClient.prepareForwardingStats),c._Forwarders.processPixelConfigs(b),c._SessionManager.initialize(),c._Events.logAST(),i(j)?(!c._PageViewTracker&&(c.Logger.verbose("mParticle APV: [sdk-init] creating new PageViewTracker for this instance"),c._PageViewTracker=new PageViewTracker(c,{isAutoPageView:!0})),hasInitialPageViewFired()?c.Logger.verbose("mParticle APV: [sdk-init] initial page view already logged this page load, skipping"):(markInitialPageViewFired(),c._Events.logPageView({isAutoPageView:!0})),c._PageViewTracker.init()):c._PageViewTracker&&c._PageViewTracker.teardown(),processIdentityCallback(c,k,l,m);}// We will continue to clear out the ready queue as part of the initial init flow
1503
1524
  // if an identify request is unnecessary, such as if there is an existing session
1504
1525
  (c._Store.mpid&&!c._Store.identifyCalled||c._Store.webviewBridgeEnabled)&&(c._Store.isInitialized=!0,null===(f=c._CookieConsentManager)||void 0===f?void 0:f.syncNoTargetingAttribute(c.Identity.getCurrentUser()),c._preInit.readyQueue=processReadyQueue(c._preInit.readyQueue,c.Logger)),null===(g=c.processQueueOnNoFunctional)||void 0===g?void 0:g.call(c),c._Store.isFirstRun&&(c._Store.isFirstRun=!1);}// https://go.mparticle.com/work/SQDSDKS-7061
1505
1526
  function createKitBlocker(a,b){var c,d,e,f;/* There are three ways a data plan object for blocking can be passed to the SDK: