@mparticle/web-sdk 2.80.0 → 2.81.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.
Files changed (36) hide show
  1. package/dist/mparticle.common.js +75 -488
  2. package/dist/mparticle.esm.js +75 -488
  3. package/dist/mparticle.js +244 -673
  4. package/dist/types/src/configAPIClient.d.ts +1 -0
  5. package/dist/types/src/ecommerce.d.ts +3 -53
  6. package/dist/types/src/ecommerce.interfaces.d.ts +11 -12
  7. package/dist/types/src/events.interfaces.d.ts +1 -1
  8. package/dist/types/src/forwarders.d.ts +4 -26
  9. package/dist/types/src/forwarders.interfaces.d.ts +41 -10
  10. package/dist/types/src/identity-utils.d.ts +3 -3
  11. package/dist/types/src/identity.d.ts +3 -0
  12. package/dist/types/src/identity.interfaces.d.ts +45 -11
  13. package/dist/types/src/identityApiClient.d.ts +5 -4
  14. package/dist/types/src/mp-instance.d.ts +2 -2
  15. package/dist/types/src/persistence.interfaces.d.ts +2 -3
  16. package/dist/types/src/roktManager.d.ts +18 -0
  17. package/dist/types/src/sdkRuntimeModels.d.ts +2 -2
  18. package/dist/types/src/store.d.ts +4 -3
  19. package/package.json +1 -1
  20. package/src/configAPIClient.ts +1 -0
  21. package/src/ecommerce.interfaces.ts +12 -21
  22. package/src/{ecommerce.js → ecommerce.ts} +144 -73
  23. package/src/events.interfaces.ts +1 -1
  24. package/src/events.ts +1 -1
  25. package/src/forwarders.interfaces.ts +73 -10
  26. package/src/{forwarders.js → forwarders.ts} +214 -176
  27. package/src/helpers.ts +7 -3
  28. package/src/identity-utils.ts +2 -2
  29. package/src/identity.interfaces.ts +58 -14
  30. package/src/{identity.js → identity.ts} +237 -192
  31. package/src/identityApiClient.ts +9 -9
  32. package/src/mp-instance.ts +2 -2
  33. package/src/persistence.interfaces.ts +2 -3
  34. package/src/roktManager.ts +37 -0
  35. package/src/sdkRuntimeModels.ts +2 -1
  36. package/src/store.ts +4 -3
@@ -15,7 +15,7 @@ map:function map(a,b){var c,d,e;if(null===this)throw new TypeError(" this is nul
15
15
  filter:function filter(a/*, thisArg*/){if(void 0===this||null===this)throw new TypeError;var b=Object(this),c=b.length>>>0;if("function"!=typeof a)throw new TypeError;for(var d=[],e=2<=arguments.length?arguments[1]:void 0,f=0;f<c;f++)if(f in b){var g=b[f];a.call(e,g,f,b)&&d.push(g);}return d},// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray
16
16
  isArray:function isArray(a){return "[object Array]"===Object.prototype.toString.call(a)},Base64:Base64$1};
17
17
 
18
- var version = "2.80.0";
18
+ var version = "2.81.0";
19
19
 
20
20
  var Constants={sdkVersion:version,sdkVendor:"mparticle",platform:"web",Messages:{DeprecationMessages:{MethodHasBeenDeprecated:"has been deprecated.",MethodMarkedForDeprecationPostfix:"is a deprecated method and will be removed in future releases.",AlternativeMethodPrefix:"Please use the alternate method:"},ErrorMessages:{NoToken:"A token must be specified.",EventNameInvalidType:"Event name must be a valid string value.",EventDataInvalidType:"Event data must be a valid object hash.",LoggingDisabled:"Event logging is currently disabled.",CookieParseError:"Could not parse cookie",EventEmpty:"Event object is null or undefined, cancelling send",APIRequestEmpty:"APIRequest is null or undefined, cancelling send",NoEventType:"Event type must be specified.",TransactionIdRequired:"Transaction ID is required",TransactionRequired:"A transaction attributes object is required",PromotionIdRequired:"Promotion ID is required",BadAttribute:"Attribute value cannot be object or array",BadKey:"Key value cannot be object or array",BadLogPurchase:"Transaction attributes and a product are both required to log a purchase, https://docs.mparticle.com/?javascript#measuring-transactions",AudienceAPINotEnabled:"Your workspace is not enabled to retrieve user audiences."},InformationMessages:{CookieSearch:"Searching for cookie",CookieFound:"Cookie found, parsing values",CookieNotFound:"Cookies not found",CookieSet:"Setting cookie",CookieSync:"Performing cookie sync",SendBegin:"Starting to send event",SendIdentityBegin:"Starting to send event to identity server",SendWindowsPhone:"Sending event to Windows Phone container",SendIOS:"Calling iOS path: ",SendAndroid:"Calling Android JS interface method: ",SendHttp:"Sending event to mParticle HTTP service",SendAliasHttp:"Sending alias request to mParticle HTTP service",SendIdentityHttp:"Sending event to mParticle HTTP service",StartingNewSession:"Starting new Session",StartingLogEvent:"Starting to log event",StartingLogOptOut:"Starting to log user opt in/out",StartingEndSession:"Starting to end session",StartingInitialization:"Starting to initialize",StartingLogCommerceEvent:"Starting to log commerce event",StartingAliasRequest:"Starting to Alias MPIDs",LoadingConfig:"Loading configuration options",AbandonLogEvent:"Cannot log event, logging disabled or developer token not set",AbandonAliasUsers:"Cannot Alias Users, logging disabled or developer token not set",AbandonStartSession:"Cannot start session, logging disabled or developer token not set",AbandonEndSession:"Cannot end session, logging disabled or developer token not set",NoSessionToEnd:"Cannot end session, no active session found"},ValidationMessages:{ModifyIdentityRequestUserIdentitiesPresent:"identityRequests to modify require userIdentities to be present. Request not sent to server. Please fix and try again",IdentityRequesetInvalidKey:"There is an invalid key on your identityRequest object. It can only contain a `userIdentities` object and a `onUserAlias` function. Request not sent to server. Please fix and try again.",OnUserAliasType:"The onUserAlias value must be a function.",UserIdentities:"The userIdentities key must be an object with keys of identityTypes and values of strings. Request not sent to server. Please fix and try again.",UserIdentitiesInvalidKey:"There is an invalid identity key on your `userIdentities` object within the identityRequest. Request not sent to server. Please fix and try again.",UserIdentitiesInvalidValues:"All user identity values must be strings or null. Request not sent to server. Please fix and try again.",AliasMissingMpid:"Alias Request must contain both a destinationMpid and a sourceMpid",AliasNonUniqueMpid:"Alias Request's destinationMpid and sourceMpid must be unique",AliasMissingTime:"Alias Request must have both a startTime and an endTime",AliasStartBeforeEndTime:"Alias Request's endTime must be later than its startTime"}},NativeSdkPaths:{LogEvent:"logEvent",SetUserTag:"setUserTag",RemoveUserTag:"removeUserTag",SetUserAttribute:"setUserAttribute",RemoveUserAttribute:"removeUserAttribute",SetSessionAttribute:"setSessionAttribute",AddToCart:"addToCart",RemoveFromCart:"removeFromCart",ClearCart:"clearCart",LogOut:"logOut",SetUserAttributeList:"setUserAttributeList",RemoveAllUserAttributes:"removeAllUserAttributes",GetUserAttributesLists:"getUserAttributesLists",GetAllUserAttributes:"getAllUserAttributes",Identify:"identify",Logout:"logout",Login:"login",Modify:"modify",Alias:"aliasUsers",Upload:"upload"},StorageNames:{localStorageName:"mprtcl-api",localStorageNameV3:"mprtcl-v3",cookieName:"mprtcl-api",cookieNameV2:"mprtcl-v2",cookieNameV3:"mprtcl-v3",localStorageNameV4:"mprtcl-v4",localStorageProductsV4:"mprtcl-prodv4",cookieNameV4:"mprtcl-v4",currentStorageName:"mprtcl-v4",currentStorageProductsName:"mprtcl-prodv4"},DefaultConfig:{cookieDomain:null,cookieExpiration:365,logLevel:null,timeout:300,sessionTimeout:30,maxProducts:20,forwarderStatsTimeout:5e3,integrationDelayTimeout:5e3,maxCookieSize:3e3,aliasMaxWindow:90,uploadInterval:0// Maximum milliseconds in between batch uploads, below 500 will mean immediate upload. The server returns this as a string, but we are using it as a number internally
21
21
  },DefaultBaseUrls:{v1SecureServiceUrl:"jssdks.mparticle.com/v1/JS/",v2SecureServiceUrl:"jssdks.mparticle.com/v2/JS/",v3SecureServiceUrl:"jssdks.mparticle.com/v3/JS/",configUrl:"jssdkcdns.mparticle.com/JS/v2/",identityUrl:"identity.mparticle.com/v1/",aliasUrl:"jssdks.mparticle.com/v1/identity/",userAudienceUrl:"nativesdks.mparticle.com/v1/"},// These are the paths that are used to construct the CNAME urls
@@ -33,14 +33,14 @@ CaptureIntegrationSpecificIdsV2:"captureIntegrationSpecificIds.V2",AstBackground
33
33
  var NO_TARGETING_ATTRIBUTE="$NoTargeting";// https://developer.mozilla.org/en-US/docs/Web/HTTP/Status
34
34
  var HTTP_OK=200;var HTTP_ACCEPTED=202;var HTTP_BAD_REQUEST=400;var HTTP_NOT_FOUND=404;var HTTP_SERVER_ERROR=500;
35
35
 
36
- function _typeof$1(o) {
36
+ function _typeof(o) {
37
37
  "@babel/helpers - typeof";
38
38
 
39
- return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
39
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
40
40
  return typeof o;
41
41
  } : function (o) {
42
42
  return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
43
- }, _typeof$1(o);
43
+ }, _typeof(o);
44
44
  }
45
45
 
46
46
  /******************************************************************************
@@ -156,7 +156,7 @@ return function filterCookies(a,b){for(var c={},d=0,e=a;d<e.length;d++){var f=e[
156
156
  if(null===a||a===void 0)return a;// Handle arrays - recursively obfuscate each element
157
157
  if(Array.isArray(a))return a.map(function(a){return obfuscateData(a)});// Handle objects - recursively obfuscate each property
158
158
  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
159
- return _typeof$1(a)},obfuscateDevData=function(a,b){return b?a:obfuscateData(a)};/**
159
+ return _typeof(a)},obfuscateDevData=function(a,b){return b?a:obfuscateData(a)};/**
160
160
  * Returns a value between 1-100 inclusive.
161
161
  */ // Google's cookie matching service requires `google_hm` values to be web-safe
162
162
  // base64 (RFC 4648 §5) without padding, otherwise the write to the hosted
@@ -198,7 +198,7 @@ return _typeof$1(a)},obfuscateDevData=function(a,b){return b?a:obfuscateData(a)}
198
198
  */ // Standalone version of jQuery.extend, from https://github.com/dansdom/extend
199
199
  // https://go.mparticle.com/work/SQDSDKS-6047
200
200
  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
201
- return b===void 0||j.hasOwn.call(a,b)},isArray:Array.isArray||function(a){return "array"===j.type(a)},isFunction:function(a){return "function"===j.type(a)},isWindow:function isWindow(a){return null!=a&&a==a.window}},k=a[0]||{},l=1,m=!1,n=a.length;for("boolean"==typeof k&&(m=k,k=a[1]||{},l=2),"object"===_typeof$1(k)||j.isFunction(k)||(k={}),n===l&&(k={},--l);l<n;l++)if(null!=(c=a[l]))for(d in c)"__proto__"!==d&&"constructor"!==d&&"prototype"!==d&&Object.prototype.hasOwnProperty.call(c,d)&&(e=k[d],f=c[d],k!==f)&&(m&&f&&(j.isPlainObject(f)||(g=j.isArray(f)))?(g?(g=!1,h=e&&j.isArray(e)?e:[]):h=e&&j.isPlainObject(e)?e:{},k[d]=extend(m,h,f)):void 0!==f&&(k[d]=f));return k}var getErrorMessage=function(a,b){return void 0===b&&(b="unknown error"),a instanceof Error?a.message:"string"==typeof a?a:a&&"object"===_typeof$1(a)&&"string"==typeof a.message?a.message:b;// fetch-mock and some network libs reject with { message } rather than Error
201
+ 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
202
202
  };
203
203
 
204
204
  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
@@ -211,10 +211,6 @@ getExpansionName:function getExpansionName(a){return a===PromotionActionType.Pro
211
211
 
212
212
  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"};
213
213
 
214
- function getDefaultExportFromCjs (x) {
215
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
216
- }
217
-
218
214
  var dist = {};
219
215
 
220
216
  (function (exports) {
@@ -555,7 +551,7 @@ if(!isFunction(e))return f.error("search called without a callback function; ski
555
551
  if(i=function(a){try{e(a);}catch(a){f.error("Error invoking search callback: "+getErrorMessage(a));}},j=Validators.removeFalsyIdentityValues({userIdentities:null!==a&&void 0!==a?a:{}},f).userIdentities,!Object.values(null!==j&&void 0!==j?j:{}).some(function(a){return "string"==typeof a&&0<a.length}))return f.verbose("Identity search called with empty identifiers; skipping request."),i({httpCode:HTTPCodes$4.noHttpCoverage}),[2/*return*/];// No API key -> same: deliver noHttpCoverage rather than hanging.
556
552
  if(!b)return f.verbose("search called without a workspace API key; skipping request."),i({httpCode:HTTPCodes$4.noHttpCoverage}),[2/*return*/];v.label=1;case 1:return v.trys.push([1,9,,10]),k=c(),l=__assign(__assign({},k),{known_identities:__assign({},j)}),m={method:"post",headers:{Accept:"application/json","Content-Type":"application/json","x-mp-key":b},body:JSON.stringify(l)},n=g||(window.fetch?new FetchUploader(d):new XHRUploader(d)),f.verbose("Sending search request to "+d),[4/*yield*/,n.upload(m,d)];case 2:if(o=v.sent(),p=void 0,!isFunction(o.json))return [3/*break*/,7];v.label=3;case 3:return v.trys.push([3,5,,6]),[4/*yield*/,o.json()];case 4:return p=v.sent(),[3/*break*/,6];case 5:return v.sent(),f.verbose("search response had no parseable JSON body."),[3/*break*/,6];case 6:return [3/*break*/,8];case 7:if(r=o,null===r||void 0===r?void 0:r.responseText)try{p=JSON.parse(r.responseText);}catch(a){f.verbose("search XHR response was not valid JSON.");}v.label=8;case 8:return o.status===HTTP_OK?f.verbose("search received 200 OK."):o.status===HTTP_NOT_FOUND?f.verbose("search received 404 (no match)."):f.verbose("search received non-success status "+o.status),i({httpCode:o.status,body:p}),[3/*break*/,10];case 9:return s=v.sent(),t=getErrorMessage(s),u="Error sending search request: "+t,f.error(u),null===h||void 0===h?void 0:h.report({message:u,code:ErrorCodes.IDENTITY_REQUEST,severity:WSDKErrorSeverity.ERROR}),i({httpCode:HTTPCodes$4.noHttpCoverage}),[3/*break*/,10];case 10:return [2/*return*/]}})})};
557
553
 
558
- var _a=Constants.IdentityMethods,Identify$2=_a.Identify,Modify$3=_a.Modify,Login$2=_a.Login,Logout$2=_a.Logout,HTTPCodes$3=Constants.HTTPCodes,Messages$9=Constants.Messages;var CACHE_HEADER="x-mp-max-age";var cacheOrClearIdCache=function(a,b,c,d,e){// when parsing a response that has already been cached, simply return instead of attempting another cache
554
+ var _a$1=Constants.IdentityMethods,Identify$2=_a$1.Identify,Modify$3=_a$1.Modify,Login$2=_a$1.Login,Logout$2=_a$1.Logout,HTTPCodes$3=Constants.HTTPCodes,Messages$9=Constants.Messages;var CACHE_HEADER="x-mp-max-age";var cacheOrClearIdCache=function(a,b,c,d,e){// when parsing a response that has already been cached, simply return instead of attempting another cache
559
555
  if(!e){// default the expire timestamp to one day in milliseconds unless a header comes back
560
556
  var f=getExpireTimestamp(null===d||void 0===d?void 0:d.cacheMaxAge);a===Login$2||a===Identify$2?cacheIdentityRequest(a,b,f,c,d):a===Modify$3||a===Logout$2?c.purge():void 0;}};var cacheIdentityRequest=function(a,b,c,d,e){var f=e.responseText,g=e.status,h=d.retrieve()||{},i=concatenateIdentities(a,b),j=generateHash(i),k=f.mpid,l=f.is_logged_in;h[j]={responseText:JSON.stringify({mpid:k,is_logged_in:l}),status:g,expireTimestamp:c},d.store(h);};// We need to ensure that identities are concatenated in a deterministic way, so
561
557
  // we sort the identities based on their enum.
@@ -684,7 +680,7 @@ var Messages$5=Constants.Messages;function Ecommerce(a){var b=this;// https://go
684
680
  // https://go.mparticle.com/work/SQDSDKS-4801
685
681
  // sanitizes any non number, non string value to 0
686
682
  this.convertTransactionAttributesToProductAction=function(a,b){a.hasOwnProperty("Id")&&(b.TransactionId=a.Id),a.hasOwnProperty("Affiliation")&&(b.Affiliation=a.Affiliation),a.hasOwnProperty("CouponCode")&&(b.CouponCode=a.CouponCode),a.hasOwnProperty("Revenue")&&(b.TotalAmount=this.sanitizeAmount(a.Revenue,"Revenue")),a.hasOwnProperty("Shipping")&&(b.ShippingAmount=this.sanitizeAmount(a.Shipping,"Shipping")),a.hasOwnProperty("Tax")&&(b.TaxAmount=this.sanitizeAmount(a.Tax,"Tax")),a.hasOwnProperty("Step")&&(b.CheckoutStep=a.Step),a.hasOwnProperty("Option")&&(b.CheckoutOptions=a.Option);},this.calculateProductActionTotalAmount=function(a){if(!a||null!=a.TotalAmount)return a;var b=0;return Array.isArray(a.ProductList)&&a.ProductList.forEach(function(a){b+=parseNumber(a.Quantity)*parseNumber(a.Price);}),b+=parseNumber(a.ShippingAmount)+parseNumber(a.TaxAmount),a.TotalAmount=b,a},this.getProductActionEventName=function(a){switch(a){case Types.ProductActionType.AddToCart:return "AddToCart";case Types.ProductActionType.AddToWishlist:return "AddToWishlist";case Types.ProductActionType.Checkout:return "Checkout";case Types.ProductActionType.CheckoutOption:return "CheckoutOption";case Types.ProductActionType.Click:return "Click";case Types.ProductActionType.Purchase:return "Purchase";case Types.ProductActionType.Refund:return "Refund";case Types.ProductActionType.RemoveFromCart:return "RemoveFromCart";case Types.ProductActionType.RemoveFromWishlist:return "RemoveFromWishlist";case Types.ProductActionType.ViewDetail:return "ViewDetail";case Types.ProductActionType.ViewCart:return "ViewCart";case Types.ProductActionType.AddShippingInfo:return "AddShippingInfo";case Types.ProductActionType.AddPaymentInfo:return "AddPaymentInfo";case Types.ProductActionType.PaymentMethodSelected:return "PaymentMethodSelected";case Types.ProductActionType.PaymentAttempted:return "PaymentAttempted";case Types.ProductActionType.PaymentSucceeded:return "PaymentSucceeded";case Types.ProductActionType.PaymentFailed:return "PaymentFailed";case Types.ProductActionType.RefundInitiated:return "RefundInitiated";case Types.ProductActionType.Unknown:default:return "Unknown"}},this.getPromotionActionEventName=function(a){return a===Types.PromotionActionType.PromotionClick?"PromotionClick":a===Types.PromotionActionType.PromotionView?"PromotionView":"Unknown"},this.convertProductActionToEventType=function(b){return b===Types.ProductActionType.AddToCart?Types.CommerceEventType.ProductAddToCart:b===Types.ProductActionType.AddToWishlist?Types.CommerceEventType.ProductAddToWishlist:b===Types.ProductActionType.Checkout?Types.CommerceEventType.ProductCheckout:b===Types.ProductActionType.CheckoutOption?Types.CommerceEventType.ProductCheckoutOption:b===Types.ProductActionType.Click?Types.CommerceEventType.ProductClick:b===Types.ProductActionType.Purchase?Types.CommerceEventType.ProductPurchase:b===Types.ProductActionType.Refund?Types.CommerceEventType.ProductRefund:b===Types.ProductActionType.RemoveFromCart?Types.CommerceEventType.ProductRemoveFromCart:b===Types.ProductActionType.RemoveFromWishlist?Types.CommerceEventType.ProductRemoveFromWishlist:b===Types.ProductActionType.Unknown?Types.EventType.Unknown:b===Types.ProductActionType.ViewDetail?Types.CommerceEventType.ProductViewDetail:b===Types.ProductActionType.ViewCart||b===Types.ProductActionType.AddShippingInfo||b===Types.ProductActionType.AddPaymentInfo||b===Types.ProductActionType.PaymentMethodSelected||b===Types.ProductActionType.PaymentAttempted||b===Types.ProductActionType.PaymentSucceeded||b===Types.ProductActionType.PaymentFailed||b===Types.ProductActionType.RefundInitiated?Types.EventType.Unknown:(a.Logger.error("Could not convert product action type "+b+" to event type"),null)},this.convertPromotionActionToEventType=function(b){return b===Types.PromotionActionType.PromotionClick?Types.CommerceEventType.PromotionClick:b===Types.PromotionActionType.PromotionView?Types.CommerceEventType.PromotionView:(a.Logger.error("Could not convert promotion action type "+b+" to event type"),null)},this.generateExpandedEcommerceName=function(a,b){return "eCommerce - "+a+" - "+(b?"Total":"Item")},this.extractProductAttributes=function(a,b){b.CouponCode&&(a["Coupon Code"]=b.CouponCode),b.Brand&&(a.Brand=b.Brand),b.Category&&(a.Category=b.Category),b.Name&&(a.Name=b.Name),b.Sku&&(a.Id=b.Sku),b.Price&&(a["Item Price"]=b.Price),b.Quantity&&(a.Quantity=b.Quantity),b.Position&&(a.Position=b.Position),b.Variant&&(a.Variant=b.Variant),a["Total Product Amount"]=b.TotalAmount||0;},this.extractTransactionId=function(a,b){b.TransactionId&&(a["Transaction Id"]=b.TransactionId);},this.extractActionAttributes=function(a,c){b.extractTransactionId(a,c),c.Affiliation&&(a.Affiliation=c.Affiliation),c.CouponCode&&(a["Coupon Code"]=c.CouponCode),c.TotalAmount&&(a["Total Amount"]=c.TotalAmount),c.ShippingAmount&&(a["Shipping Amount"]=c.ShippingAmount),c.TaxAmount&&(a["Tax Amount"]=c.TaxAmount),c.CheckoutOptions&&(a["Checkout Options"]=c.CheckoutOptions),c.CheckoutStep&&(a["Checkout Step"]=c.CheckoutStep);},this.extractPromotionAttributes=function(a,b){b.Id&&(a.Id=b.Id),b.Creative&&(a.Creative=b.Creative),b.Name&&(a.Name=b.Name),b.Position&&(a.Position=b.Position);},this.buildProductList=function(a,b){return b?Array.isArray(b)?b:[b]:a.ShoppingCart.ProductList},this.createProduct=function(b,c,d,e,f,g,h,i,j,k){return (k=a._Helpers.sanitizeAttributes(k,b),"string"!=typeof b)?(a.Logger.error("Name is required when creating a product"),null):a._Helpers.Validators.isStringOrNumber(c)?a._Helpers.Validators.isStringOrNumber(d)?(d=a._Helpers.parseNumber(d),i&&!a._Helpers.Validators.isNumber(i)&&(a.Logger.error("Position must be a number, it will be set to null."),i=null),e=a._Helpers.Validators.isStringOrNumber(e)?a._Helpers.parseNumber(e):1,{Name:b,Sku:c,Price:d,Quantity:e,Brand:h,Variant:f,Category:g,Position:i,CouponCode:j,TotalAmount:e*d,Attributes:k}):(a.Logger.error("Price is required when creating a product, and must be a string or a number"),null):(a.Logger.error("SKU is required when creating a product, and must be a string or a number"),null)},this.createPromotion=function(b,c,d,e){return a._Helpers.Validators.isStringOrNumber(b)?{Id:b,Creative:c,Name:d,Position:e}:(a.Logger.error(Messages$5.ErrorMessages.PromotionIdRequired),null)},this.createImpression=function(b,c){return "string"==typeof b?c?{Name:b,Product:c}:(a.Logger.error("Product is required when creating an impression."),null):(a.Logger.error("Name is required when creating an impression."),null)},this.createTransactionAttributes=function(b,c,d,e,f,g){return a._Helpers.Validators.isStringOrNumber(b)?{Id:b,Affiliation:c,CouponCode:d,Revenue:e,Shipping:f,Tax:g}:(a.Logger.error(Messages$5.ErrorMessages.TransactionIdRequired),null)},this.expandProductImpression=function(c){var d=[];return c.ProductImpressions?(c.ProductImpressions.forEach(function(e){e.ProductList&&e.ProductList.forEach(function(f){var g=extend(!1,{},c.EventAttributes);if(f.Attributes)for(var h in f.Attributes)g[h]=f.Attributes[h];b.extractProductAttributes(g,f),e.ProductImpressionList&&(g["Product Impression List"]=e.ProductImpressionList);var i=a._ServerModel.createEventObject({messageType:Types.MessageType.PageEvent,name:b.generateExpandedEcommerceName("Impression"),data:g,eventType:Types.EventType.Transaction});d.push(i);});}),d):d},this.expandCommerceEvent=function(a){return a?b.expandProductAction(a).concat(b.expandPromotionAction(a)).concat(b.expandProductImpression(a)):null},this.expandPromotionAction=function(c){var d=[];if(!c.PromotionAction)return d;var e=c.PromotionAction.PromotionList;return e.forEach(function(e){var f=extend(!1,{},c.EventAttributes);b.extractPromotionAttributes(f,e);var g=a._ServerModel.createEventObject({messageType:Types.MessageType.PageEvent,name:b.generateExpandedEcommerceName(Types.PromotionActionType.getExpansionName(c.PromotionAction.PromotionActionType)),data:f,eventType:Types.EventType.Transaction});d.push(g);}),d},this.expandProductAction=function(c){var d=[];if(!c.ProductAction)return d;var e=!1;if(c.ProductAction.ProductActionType===Types.ProductActionType.Purchase||c.ProductAction.ProductActionType===Types.ProductActionType.Refund){var f=extend(!1,{},c.EventAttributes);f["Product Count"]=c.ProductAction.ProductList?c.ProductAction.ProductList.length:0,b.extractActionAttributes(f,c.ProductAction),c.CurrencyCode&&(f["Currency Code"]=c.CurrencyCode);var g=a._ServerModel.createEventObject({messageType:Types.MessageType.PageEvent,name:b.generateExpandedEcommerceName(Types.ProductActionType.getExpansionName(c.ProductAction.ProductActionType),!0),data:f,eventType:Types.EventType.Transaction});d.push(g);}else e=!0;var h=c.ProductAction.ProductList;return h?(h.forEach(function(f){var g=extend(!1,c.EventAttributes,f.Attributes);e?b.extractActionAttributes(g,c.ProductAction):b.extractTransactionId(g,c.ProductAction),b.extractProductAttributes(g,f);var h=a._ServerModel.createEventObject({messageType:Types.MessageType.PageEvent,name:b.generateExpandedEcommerceName(Types.ProductActionType.getExpansionName(c.ProductAction.ProductActionType)),data:g,eventType:Types.EventType.Transaction});d.push(h);}),d):d},this.createCommerceEventObject=function(b,c){var d,e=a._Helpers.extend;// https://go.mparticle.com/work/SQDSDKS-4801
687
- return (a.Logger.verbose(Messages$5.InformationMessages.StartingLogCommerceEvent),a._Helpers.canLog())?(d=a._ServerModel.createEventObject({messageType:Types.MessageType.Commerce,sourceMessageId:null===c||void 0===c?void 0:c.sourceMessageId}),d.EventName="eCommerce - ",d.CurrencyCode=a._Store.currencyCode,d.ShoppingCart=[],d.CustomFlags=e(d.CustomFlags,b),d):(a.Logger.verbose(Messages$5.InformationMessages.AbandonLogEvent),null)},this.sanitizeAmount=function(b,c){if(!a._Helpers.Validators.isStringOrNumber(b)){var d=[c,"must be of type number. A",_typeof$1(b),"was passed. Converting to 0"].join(" ");return a.Logger.warning(d),0}// if amount is a string, it will be parsed into a number if possible, or set to 0
683
+ return (a.Logger.verbose(Messages$5.InformationMessages.StartingLogCommerceEvent),a._Helpers.canLog())?(d=a._ServerModel.createEventObject({messageType:Types.MessageType.Commerce,sourceMessageId:null===c||void 0===c?void 0:c.sourceMessageId}),d.EventName="eCommerce - ",d.CurrencyCode=a._Store.currencyCode,d.ShoppingCart=[],d.CustomFlags=e(d.CustomFlags,b),d):(a.Logger.verbose(Messages$5.InformationMessages.AbandonLogEvent),null)},this.sanitizeAmount=function(b,c){if(!a._Helpers.Validators.isStringOrNumber(b)){var d=[c,"must be of type number. A",_typeof(b),"was passed. Converting to 0"].join(" ");return a.Logger.warning(d),0}// if amount is a string, it will be parsed into a number if possible, or set to 0
688
684
  return a._Helpers.parseNumber(b)};}
689
685
 
690
686
  var ForegroundTimeTracker=/** @class */function(){function a(a,b){void 0===b&&(b=!1),this.noFunctional=b,this.isTrackerActive=!1,this.localStorageName="",this.startTime=0,this.totalTime=0,this.localStorageName="mprtcl-tos-".concat(a),this.timerVault=new LocalStorageVault(this.localStorageName),this.noFunctional||this.loadTimeFromStorage(),this.addHandlers(),!1===document.hidden&&this.startTracking();}return a.prototype.addHandlers=function(){var a=this;// when user switches tabs or minimizes the window
@@ -696,7 +692,7 @@ function createSDKConfig(a){// TODO: Refactor to create a default config object
696
692
  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
697
693
  return b.flags=b.flags||{},b}// TODO: Merge this with SDKStoreApi in sdkRuntimeModels
698
694
  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
699
- 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.maxProducts=a.hasOwnProperty("maxProducts")?a.maxProducts:Constants.DefaultConfig.maxProducts,this.SDKConfig.maxCookieSize=a.hasOwnProperty("maxCookieSize")?a.maxCookieSize:Constants.DefaultConfig.maxCookieSize,a.hasOwnProperty("appName")&&(this.SDKConfig.appName=a.appName),a.hasOwnProperty("package")&&(this.SDKConfig["package"]=a["package"]),this.SDKConfig.integrationDelayTimeout=a.hasOwnProperty("integrationDelayTimeout")?a.integrationDelayTimeout:Constants.DefaultConfig.integrationDelayTimeout,a.hasOwnProperty("identifyRequest")&&(this.SDKConfig.identifyRequest=a.identifyRequest),a.hasOwnProperty("identityCallback")){var 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$1(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
695
+ 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.maxProducts=a.hasOwnProperty("maxProducts")?a.maxProducts:Constants.DefaultConfig.maxProducts,this.SDKConfig.maxCookieSize=a.hasOwnProperty("maxCookieSize")?a.maxCookieSize:Constants.DefaultConfig.maxCookieSize,a.hasOwnProperty("appName")&&(this.SDKConfig.appName=a.appName),a.hasOwnProperty("package")&&(this.SDKConfig["package"]=a["package"]),this.SDKConfig.integrationDelayTimeout=a.hasOwnProperty("integrationDelayTimeout")?a.integrationDelayTimeout:Constants.DefaultConfig.integrationDelayTimeout,a.hasOwnProperty("identifyRequest")&&(this.SDKConfig.identifyRequest=a.identifyRequest),a.hasOwnProperty("identityCallback")){var 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
700
696
  (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
701
697
  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
702
698
  // such as if the SDK is being self-hosted and the flags are different on the server config
@@ -914,391 +910,12 @@ c(b),b=null,a._Store.isTracking=!1;}));else {var d={coords:{latitude:a._Store.cu
914
910
  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()?(a._Store.webviewBridgeEnabled&&(b.ShoppingCart={}),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
915
911
  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");};}
916
912
 
917
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
918
- try {
919
- var info = gen[key](arg);
920
- var value = info.value;
921
- } catch (error) {
922
- reject(error);
923
- return;
924
- }
925
- if (info.done) {
926
- resolve(value);
927
- } else {
928
- Promise.resolve(value).then(_next, _throw);
929
- }
930
- }
931
- function _asyncToGenerator(fn) {
932
- return function () {
933
- var self = this,
934
- args = arguments;
935
- return new Promise(function (resolve, reject) {
936
- var gen = fn.apply(self, args);
937
- function _next(value) {
938
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
939
- }
940
- function _throw(err) {
941
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
942
- }
943
- _next(undefined);
944
- });
945
- };
946
- }
947
-
948
- var regeneratorRuntime$1 = {exports: {}};
949
-
950
- var _typeof = {exports: {}};
951
-
952
- _typeof.exports;
953
-
954
- (function (module) {
955
- function _typeof(o) {
956
- "@babel/helpers - typeof";
957
-
958
- return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
959
- return typeof o;
960
- } : function (o) {
961
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
962
- }, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(o);
963
- }
964
- module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
965
- } (_typeof));
966
-
967
- var _typeofExports = _typeof.exports;
968
-
969
- regeneratorRuntime$1.exports;
970
-
971
- (function (module) {
972
- var _typeof = _typeofExports["default"];
973
- function _regeneratorRuntime() {
974
- module.exports = _regeneratorRuntime = function _regeneratorRuntime() {
975
- return e;
976
- }, module.exports.__esModule = true, module.exports["default"] = module.exports;
977
- var t,
978
- e = {},
979
- r = Object.prototype,
980
- n = r.hasOwnProperty,
981
- o = Object.defineProperty || function (t, e, r) {
982
- t[e] = r.value;
983
- },
984
- i = "function" == typeof Symbol ? Symbol : {},
985
- a = i.iterator || "@@iterator",
986
- c = i.asyncIterator || "@@asyncIterator",
987
- u = i.toStringTag || "@@toStringTag";
988
- function define(t, e, r) {
989
- return Object.defineProperty(t, e, {
990
- value: r,
991
- enumerable: !0,
992
- configurable: !0,
993
- writable: !0
994
- }), t[e];
995
- }
996
- try {
997
- define({}, "");
998
- } catch (t) {
999
- define = function define(t, e, r) {
1000
- return t[e] = r;
1001
- };
1002
- }
1003
- function wrap(t, e, r, n) {
1004
- var i = e && e.prototype instanceof Generator ? e : Generator,
1005
- a = Object.create(i.prototype),
1006
- c = new Context(n || []);
1007
- return o(a, "_invoke", {
1008
- value: makeInvokeMethod(t, r, c)
1009
- }), a;
1010
- }
1011
- function tryCatch(t, e, r) {
1012
- try {
1013
- return {
1014
- type: "normal",
1015
- arg: t.call(e, r)
1016
- };
1017
- } catch (t) {
1018
- return {
1019
- type: "throw",
1020
- arg: t
1021
- };
1022
- }
1023
- }
1024
- e.wrap = wrap;
1025
- var h = "suspendedStart",
1026
- l = "suspendedYield",
1027
- f = "executing",
1028
- s = "completed",
1029
- y = {};
1030
- function Generator() {}
1031
- function GeneratorFunction() {}
1032
- function GeneratorFunctionPrototype() {}
1033
- var p = {};
1034
- define(p, a, function () {
1035
- return this;
1036
- });
1037
- var d = Object.getPrototypeOf,
1038
- v = d && d(d(values([])));
1039
- v && v !== r && n.call(v, a) && (p = v);
1040
- var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
1041
- function defineIteratorMethods(t) {
1042
- ["next", "throw", "return"].forEach(function (e) {
1043
- define(t, e, function (t) {
1044
- return this._invoke(e, t);
1045
- });
1046
- });
1047
- }
1048
- function AsyncIterator(t, e) {
1049
- function invoke(r, o, i, a) {
1050
- var c = tryCatch(t[r], t, o);
1051
- if ("throw" !== c.type) {
1052
- var u = c.arg,
1053
- h = u.value;
1054
- return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
1055
- invoke("next", t, i, a);
1056
- }, function (t) {
1057
- invoke("throw", t, i, a);
1058
- }) : e.resolve(h).then(function (t) {
1059
- u.value = t, i(u);
1060
- }, function (t) {
1061
- return invoke("throw", t, i, a);
1062
- });
1063
- }
1064
- a(c.arg);
1065
- }
1066
- var r;
1067
- o(this, "_invoke", {
1068
- value: function value(t, n) {
1069
- function callInvokeWithMethodAndArg() {
1070
- return new e(function (e, r) {
1071
- invoke(t, n, e, r);
1072
- });
1073
- }
1074
- return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
1075
- }
1076
- });
1077
- }
1078
- function makeInvokeMethod(e, r, n) {
1079
- var o = h;
1080
- return function (i, a) {
1081
- if (o === f) throw new Error("Generator is already running");
1082
- if (o === s) {
1083
- if ("throw" === i) throw a;
1084
- return {
1085
- value: t,
1086
- done: !0
1087
- };
1088
- }
1089
- for (n.method = i, n.arg = a;;) {
1090
- var c = n.delegate;
1091
- if (c) {
1092
- var u = maybeInvokeDelegate(c, n);
1093
- if (u) {
1094
- if (u === y) continue;
1095
- return u;
1096
- }
1097
- }
1098
- if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
1099
- if (o === h) throw o = s, n.arg;
1100
- n.dispatchException(n.arg);
1101
- } else "return" === n.method && n.abrupt("return", n.arg);
1102
- o = f;
1103
- var p = tryCatch(e, r, n);
1104
- if ("normal" === p.type) {
1105
- if (o = n.done ? s : l, p.arg === y) continue;
1106
- return {
1107
- value: p.arg,
1108
- done: n.done
1109
- };
1110
- }
1111
- "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
1112
- }
1113
- };
1114
- }
1115
- function maybeInvokeDelegate(e, r) {
1116
- var n = r.method,
1117
- o = e.iterator[n];
1118
- if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
1119
- var i = tryCatch(o, e.iterator, r.arg);
1120
- if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
1121
- var a = i.arg;
1122
- return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
1123
- }
1124
- function pushTryEntry(t) {
1125
- var e = {
1126
- tryLoc: t[0]
1127
- };
1128
- 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
1129
- }
1130
- function resetTryEntry(t) {
1131
- var e = t.completion || {};
1132
- e.type = "normal", delete e.arg, t.completion = e;
1133
- }
1134
- function Context(t) {
1135
- this.tryEntries = [{
1136
- tryLoc: "root"
1137
- }], t.forEach(pushTryEntry, this), this.reset(!0);
1138
- }
1139
- function values(e) {
1140
- if (e || "" === e) {
1141
- var r = e[a];
1142
- if (r) return r.call(e);
1143
- if ("function" == typeof e.next) return e;
1144
- if (!isNaN(e.length)) {
1145
- var o = -1,
1146
- i = function next() {
1147
- for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
1148
- return next.value = t, next.done = !0, next;
1149
- };
1150
- return i.next = i;
1151
- }
1152
- }
1153
- throw new TypeError(_typeof(e) + " is not iterable");
1154
- }
1155
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
1156
- value: GeneratorFunctionPrototype,
1157
- configurable: !0
1158
- }), o(GeneratorFunctionPrototype, "constructor", {
1159
- value: GeneratorFunction,
1160
- configurable: !0
1161
- }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
1162
- var e = "function" == typeof t && t.constructor;
1163
- return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
1164
- }, e.mark = function (t) {
1165
- return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
1166
- }, e.awrap = function (t) {
1167
- return {
1168
- __await: t
1169
- };
1170
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
1171
- return this;
1172
- }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
1173
- void 0 === i && (i = Promise);
1174
- var a = new AsyncIterator(wrap(t, r, n, o), i);
1175
- return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
1176
- return t.done ? t.value : a.next();
1177
- });
1178
- }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
1179
- return this;
1180
- }), define(g, "toString", function () {
1181
- return "[object Generator]";
1182
- }), e.keys = function (t) {
1183
- var e = Object(t),
1184
- r = [];
1185
- for (var n in e) r.push(n);
1186
- return r.reverse(), function next() {
1187
- for (; r.length;) {
1188
- var t = r.pop();
1189
- if (t in e) return next.value = t, next.done = !1, next;
1190
- }
1191
- return next.done = !0, next;
1192
- };
1193
- }, e.values = values, Context.prototype = {
1194
- constructor: Context,
1195
- reset: function reset(e) {
1196
- if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
1197
- },
1198
- stop: function stop() {
1199
- this.done = !0;
1200
- var t = this.tryEntries[0].completion;
1201
- if ("throw" === t.type) throw t.arg;
1202
- return this.rval;
1203
- },
1204
- dispatchException: function dispatchException(e) {
1205
- if (this.done) throw e;
1206
- var r = this;
1207
- function handle(n, o) {
1208
- return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
1209
- }
1210
- for (var o = this.tryEntries.length - 1; o >= 0; --o) {
1211
- var i = this.tryEntries[o],
1212
- a = i.completion;
1213
- if ("root" === i.tryLoc) return handle("end");
1214
- if (i.tryLoc <= this.prev) {
1215
- var c = n.call(i, "catchLoc"),
1216
- u = n.call(i, "finallyLoc");
1217
- if (c && u) {
1218
- if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
1219
- if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
1220
- } else if (c) {
1221
- if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
1222
- } else {
1223
- if (!u) throw new Error("try statement without catch or finally");
1224
- if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
1225
- }
1226
- }
1227
- }
1228
- },
1229
- abrupt: function abrupt(t, e) {
1230
- for (var r = this.tryEntries.length - 1; r >= 0; --r) {
1231
- var o = this.tryEntries[r];
1232
- if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
1233
- var i = o;
1234
- break;
1235
- }
1236
- }
1237
- i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
1238
- var a = i ? i.completion : {};
1239
- return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
1240
- },
1241
- complete: function complete(t, e) {
1242
- if ("throw" === t.type) throw t.arg;
1243
- return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
1244
- },
1245
- finish: function finish(t) {
1246
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
1247
- var r = this.tryEntries[e];
1248
- if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
1249
- }
1250
- },
1251
- "catch": function _catch(t) {
1252
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
1253
- var r = this.tryEntries[e];
1254
- if (r.tryLoc === t) {
1255
- var n = r.completion;
1256
- if ("throw" === n.type) {
1257
- var o = n.arg;
1258
- resetTryEntry(r);
1259
- }
1260
- return o;
1261
- }
1262
- }
1263
- throw new Error("illegal catch attempt");
1264
- },
1265
- delegateYield: function delegateYield(e, r, n) {
1266
- return this.delegate = {
1267
- iterator: values(e),
1268
- resultName: r,
1269
- nextLoc: n
1270
- }, "next" === this.method && (this.arg = t), y;
1271
- }
1272
- }, e;
1273
- }
1274
- module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports;
1275
- } (regeneratorRuntime$1));
1276
-
1277
- var regeneratorRuntimeExports = regeneratorRuntime$1.exports;
1278
-
1279
- // TODO(Babel 8): Remove this file.
1280
-
1281
- var runtime = regeneratorRuntimeExports();
1282
- var regenerator = runtime;
1283
-
1284
- // Copied from https://github.com/facebook/regenerator/blob/main/packages/runtime/runtime.js#L736=
1285
- try {
1286
- regeneratorRuntime = runtime;
1287
- } catch (accidentalStrictMode) {
1288
- if (typeof globalThis === "object") {
1289
- globalThis.regeneratorRuntime = runtime;
1290
- } else {
1291
- Function("r", "regeneratorRuntime = r")(runtime);
1292
- }
1293
- }
1294
-
1295
- var _regeneratorRuntime = /*@__PURE__*/getDefaultExportFromCjs(regenerator);
1296
-
1297
913
  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}}
1298
914
 
1299
915
  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||[]}
1300
916
 
1301
- var _Constants$IdentityMe=Constants.IdentityMethods,Modify$2=_Constants$IdentityMe.Modify,Identify$1=_Constants$IdentityMe.Identify,Login$1=_Constants$IdentityMe.Login,Logout$1=_Constants$IdentityMe.Logout;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
917
+ 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.
918
+ 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
1302
919
  // Processing forwarders is a 2 step process:
1303
920
  // 1. Configure the kit
1304
921
  // 2. Initialize the kit
@@ -1318,9 +935,10 @@ var _Constants$IdentityMe=Constants.IdentityMethods,Modify$2=_Constants$Identity
1318
935
  // there being a separate process for MP configured kits and
1319
936
  // sideloaded kits, this will need to be refactored.
1320
937
  // kits can be included via mParticle UI, or via sideloaded kit config API
1321
- this.initForwarders=function(b,c){var e=a.Identity.getCurrentUser();!a._Store.webviewBridgeEnabled&&a._Store.configuredForwarders&&(a._Store.configuredForwarders.sort(function(a,b){return a.settings.PriorityValue=a.settings.PriorityValue||0,b.settings.PriorityValue=b.settings.PriorityValue||0,-1*(a.settings.PriorityValue-b.settings.PriorityValue)}),a._Store.activeForwarders=a._Store.configuredForwarders.filter(function(f){if(!a._Consent.isEnabledForUserConsent(f.filteringConsentRuleValues,e))return !1;if(!d.isEnabledForUserAttributes(f.filteringUserAttributeValue,e))return !1;if(!d.isEnabledForUnknownUser(f.excludeAnonymousUser,e))return !1;var g=a._Helpers.filterUserIdentities(b,f.userIdentityFilters),h=KitFilterHelper.filterUserAttributes(e?e.getAllUserAttributes():{},f.userAttributeFilters);return f.initialized||(f.logger=a.Logger,f.init(f.settings,c,!1,null,h,g,a._Store.SDKConfig.appVersion,a._Store.SDKConfig.appName,a._Store.SDKConfig.customFlags,a._Store.clientId),f.initialized=!0),!0}));},this.isEnabledForUserAttributes=function(b,c){if(!b||!a._Helpers.isObject(b)||!Object.keys(b).length)return !0;var d,e,f;if(!c)return !1;f=c.getAllUserAttributes();var g=!1;try{if(f&&a._Helpers.isObject(f)&&Object.keys(f).length)for(var h in f)if(f.hasOwnProperty(h)&&(d=KitFilterHelper.hashAttributeConditionalForwarding(h),e=KitFilterHelper.hashAttributeConditionalForwarding(f[h]),d===b.userAttributeName&&e===b.userAttributeValue)){g=!0;break}return !b||b.includeOnMatch===g}catch(a){// in any error scenario, err on side of returning true and forwarding event
1322
- return !0}},this.isEnabledForUnknownUser=function(a,b){return !!(b&&b.isLoggedIn()||!a)},this.applyToForwarders=function(b,c){a._Store.activeForwarders.length&&a._Store.activeForwarders.forEach(function(d){var e=d[b];if(e)try{var f=d[b](c);f&&a.Logger.verbose(f);}catch(b){a.Logger.verbose(b);}});},this.sendEventToForwarders=function(b){var c,d,e;if(!a._Store.webviewBridgeEnabled&&a._Store.activeForwarders){d=KitFilterHelper.hashEventName(b.EventName,b.EventCategory),e=KitFilterHelper.hashEventType(b.EventCategory);for(var f,g=0;g<a._Store.activeForwarders.length;g++)if((f=a._Store.activeForwarders[g],!isBlockedByForwardingRule(b.EventDataType,b.EventAttributes,f))&&(c=extend(!0,{},b),!isBlockedByEventFilter(b.EventDataType,d,e,f))&&(c.EventAttributes=filterEventAttributes(b.EventDataType,b.EventCategory,b.EventName,c.EventAttributes,f),c.UserIdentities=filterUserIdentities(c.UserIdentities,f.userIdentityFilters),c.UserAttributes=KitFilterHelper.filterUserAttributes(c.UserAttributes,f.userAttributeFilters),f.process)){a.Logger.verbose("Sending message to forwarder: "+f.name);var h=f.process(c);h&&a.Logger.verbose(h);}// Clone the event object, as we could be sending different attributes to each forwarder
1323
- }},this.handleForwarderUserAttributes=function(c,d,f){b&&b.isAttributeKeyBlocked(d)||!a._Store.activeForwarders.length||a._Store.activeForwarders.forEach(function(b){var g=b[c];if(g&&!KitFilterHelper.isFilteredUserAttribute(d,b.userAttributeFilters))try{var h;c===e.setUserAttribute?h=b.setUserAttribute(d,f):c===e.removeUserAttribute&&(h=b.removeUserAttribute(d)),h&&a.Logger.verbose(h);}catch(b){a.Logger.error(b);}});},this.setForwarderUserIdentities=function(b){a._Store.activeForwarders.forEach(function(c){var d=a._Helpers.filterUserIdentities(b,c.userIdentityFilters);c.setUserIdentity&&d.forEach(function(b){var d=c.setUserIdentity(b.Identity,b.Type);d&&a.Logger.verbose(d);});});},this.setForwarderOnUserIdentified=function(c){a._Store.activeForwarders.forEach(function(d){var e=filteredMparticleUser(c.getMPID(),d,a,b);if(d.onUserIdentified){var f=d.onUserIdentified(e);f&&a.Logger.verbose(f);}});},this.setForwarderOnIdentityComplete=function(c,d){var e;a._Store.activeForwarders.forEach(function(f){var g=filteredMparticleUser(c.getMPID(),f,a,b),h=g.getUserIdentities();d===Identify$1?f.onIdentifyComplete&&(e=f.onIdentifyComplete(g,h),e&&a.Logger.verbose(e)):d===Login$1?f.onLoginComplete&&(e=f.onLoginComplete(g,h),e&&a.Logger.verbose(e)):d===Logout$1?f.onLogoutComplete&&(e=f.onLogoutComplete(g,h),e&&a.Logger.verbose(e)):d===Modify$2&&f.onModifyComplete&&(e=f.onModifyComplete(g,h),e&&a.Logger.verbose(e));});},this.getForwarderStatsQueue=function(){return a._Persistence.forwardingStatsBatches.forwardingStatsEventQueue},this.setForwarderStatsQueue=function(b){a._Persistence.forwardingStatsBatches.forwardingStatsEventQueue=b;},this.processForwarders=function(b,c){b?(this.processUIEnabledKits(b),this.processSideloadedKits(b),d.initForwarders(a._Store.SDKConfig.identifyRequest.userIdentities,c)):a.Logger.warning("No config was passed. Cannot process forwarders");},this.processUIEnabledKits=function(b){var c=this.returnKitConstructors();try{Array.isArray(b.kitConfigs)&&b.kitConfigs.length&&b.kitConfigs.forEach(function(a){d.configureUIEnabledKit(a,c);});}catch(b){a.Logger.error("MP Kits not configured propertly. Kits may not be initialized. "+b);}},this.returnKitConstructors=function(){var b={};// If there are kits inside of mpInstance._Store.SDKConfig.kits, then mParticle is self hosted
938
+ this.initForwarders=function(b,c){var e=a.Identity.getCurrentUser();!a._Store.webviewBridgeEnabled&&a._Store.configuredForwarders&&(a._Store.configuredForwarders.sort(function(a,b){return a.settings.PriorityValue=a.settings.PriorityValue||0,b.settings.PriorityValue=b.settings.PriorityValue||0,-1*(a.settings.PriorityValue-b.settings.PriorityValue)}),a._Store.activeForwarders=a._Store.configuredForwarders.filter(function(f){if(!a._Consent.isEnabledForUserConsent(f.filteringConsentRuleValues,e))return !1;if(!d.isEnabledForUserAttributes(f.filteringUserAttributeValue,e))return !1;if(!d.isEnabledForUnknownUser(f.excludeAnonymousUser,e))return !1;var g=a._Helpers.filterUserIdentities(b,f.userIdentityFilters),h=KitFilterHelper.filterUserAttributes(e?e.getAllUserAttributes():{},f.userAttributeFilters);return f.initialized||(f.logger=a.Logger,f.init(f.settings,c,!1,null,h,g,a._Store.SDKConfig.appVersion,a._Store.SDKConfig.appName,a._Store.SDKConfig.customFlags,a._Store.clientId),f.initialized=!0),!0}));},this.isEnabledForUserAttributes=function(b,c){if(!b||!a._Helpers.isObject(b)||!Object.keys(b).length)return !0;if(!c)return !1;var d=c.getAllUserAttributes();try{var e=d&&a._Helpers.isObject(d)&&0<Object.keys(d).length,f=!!e&&userAttributesMatchFilter(d,b);return b.includeOnMatch===f}catch(a){// in any error scenario, err on side of returning true and forwarding event
939
+ return !0}},this.isEnabledForUnknownUser=function(a,b){return !!(b&&b.isLoggedIn()||!a)},this.applyToForwarders=function(b,c){a._Store.activeForwarders.length&&a._Store.activeForwarders.forEach(function(d){var e=d[b];if(e)try{var f=d[b](c);f&&a.Logger.verbose(f);}catch(b){a.Logger.verbose(b);}});},this.sendEventToForwarders=function(b){if(!a._Store.webviewBridgeEnabled&&a._Store.activeForwarders){// Not for...of: the downleveled loop is miscompiled in cjs/esm builds.
940
+ var c=KitFilterHelper.hashEventName(b.EventName,b.EventCategory),d=KitFilterHelper.hashEventType(b.EventCategory),e=function(e){if(!isBlockedByForwardingRule(b.EventDataType,b.EventAttributes,e)){// Clone the event object, as we could be sending different attributes to each forwarder
941
+ var f=extend(!0,{},b);if(!isBlockedByEventFilter(b.EventDataType,c,d,e)&&(f.EventAttributes=filterEventAttributes(b.EventDataType,b.EventCategory,b.EventName,f.EventAttributes,e),f.UserIdentities=filterUserIdentities(f.UserIdentities,e.userIdentityFilters),f.UserAttributes=KitFilterHelper.filterUserAttributes(f.UserAttributes,e.userAttributeFilters),!!e.process)){a.Logger.verbose("Sending message to forwarder: "+e.name);var g=e.process(f);g&&a.Logger.verbose(g);}}};a._Store.activeForwarders.forEach(function(a){e(a);});}},this.handleForwarderUserAttributes=function(c,d,f){b&&b.isAttributeKeyBlocked(d)||!a._Store.activeForwarders.length||a._Store.activeForwarders.forEach(function(b){var g=b[c];if(g&&!KitFilterHelper.isFilteredUserAttribute(d,b.userAttributeFilters))try{var h;c===e.setUserAttribute?h=b.setUserAttribute(d,f):c===e.removeUserAttribute&&(h=b.removeUserAttribute(d)),h&&a.Logger.verbose(h);}catch(b){a.Logger.error(b);}});},this.setForwarderUserIdentities=function(b){a._Store.activeForwarders.forEach(function(c){var d=a._Helpers.filterUserIdentities(b,c.userIdentityFilters);c.setUserIdentity&&d.forEach(function(b){var d=c.setUserIdentity(b.Identity,b.Type);d&&a.Logger.verbose(d);});});},this.setForwarderOnUserIdentified=function(c){a._Store.activeForwarders.forEach(function(d){var e=filteredMparticleUser(c.getMPID(),d,a,b);if(d.onUserIdentified){var f=d.onUserIdentified(e);f&&a.Logger.verbose(f);}});},this.setForwarderOnIdentityComplete=function(c,d){var e=identityCompleteKitMethods[d];e&&a._Store.activeForwarders.forEach(function(d){var f=d[e];if(f){var g=filteredMparticleUser(c.getMPID(),d,a,b),h=f.call(d,g,g.getUserIdentities());h&&a.Logger.verbose(h);}});},this.getForwarderStatsQueue=function(){return a._Persistence.forwardingStatsBatches.forwardingStatsEventQueue},this.setForwarderStatsQueue=function(b){a._Persistence.forwardingStatsBatches.forwardingStatsEventQueue=b;},this.processForwarders=function(b,c){b?(this.processUIEnabledKits(b),this.processSideloadedKits(b),d.initForwarders(a._Store.SDKConfig.identifyRequest.userIdentities,c)):a.Logger.warning("No config was passed. Cannot process forwarders");},this.processUIEnabledKits=function(b){var c=this.returnKitConstructors();try{Array.isArray(b.kitConfigs)&&b.kitConfigs.length&&b.kitConfigs.forEach(function(a){d.configureUIEnabledKit(a,c);});}catch(b){a.Logger.error("MP Kits not configured propertly. Kits may not be initialized. "+b);}},this.returnKitConstructors=function(){var b={};// If there are kits inside of mpInstance._Store.SDKConfig.kits, then mParticle is self hosted
1324
942
  return isEmpty(a._Store.SDKConfig.kits)?!isEmpty(a._preInit.forwarderConstructors)&&a._preInit.forwarderConstructors.forEach(function(a){// A suffix is added to a kitConstructor and kit config if there are multiple different
1325
943
  // versions of a client kit. This matches the suffix in the DB. As an example
1326
944
  // the GA4 kit has a client kit and a server side kit which has a client side
@@ -1334,7 +952,7 @@ var g=void 0;if(e.suffix&&(g="".concat(e.name,"-").concat(e.suffix)),(f===g||f==
1334
952
  for(var f in e.forEach(function(a){try{a.kitInstance.register(c);var b=a.kitInstance.name;// Then add the kit filters to each registered kit.
1335
953
  c.kits[b].filters=a.filterDictionary;}catch(b){console.error("Error registering sideloaded kit "+a.kitInstance.name);}}),c.kits){var g=c.kits[f];d.configureSideloadedKit(g);}// If Sideloaded Kits are successfully registered,
1336
954
  // record this in the Store.
1337
- if(!isEmpty(c.kits)){var h=Object.keys(c.kits);a._Store.sideloadedKitsCount=h.length;}}}catch(b){a.Logger.error("Sideloaded Kits not configured propertly. Kits may not be initialized. "+b);}},this.configureSideloadedKit=function(b){a._Store.configuredForwarders.push(this.returnConfiguredKit(b,b.filters));},this.returnConfiguredKit=function(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},c=new a.constructor;return c.id=b.moduleId,c.isSandbox=b.isDebug||b.isSandbox,c.hasSandbox="true"===b.hasDebugString,c.isVisible=b.isVisible||!0,c.settings=b.settings||{},c.eventNameFilters=b.eventNameFilters||[],c.eventTypeFilters=b.eventTypeFilters||[],c.attributeFilters=b.attributeFilters||[],c.screenNameFilters=b.screenNameFilters||[],c.screenAttributeFilters=b.screenAttributeFilters||[],c.userIdentityFilters=b.userIdentityFilters||[],c.userAttributeFilters=b.userAttributeFilters||[],c.filteringEventAttributeValue=b.filteringEventAttributeValue||{},c.filteringUserAttributeValue=b.filteringUserAttributeValue||{},c.eventSubscriptionId=b.eventSubscriptionId||null,c.filteringConsentRuleValues=b.filteringConsentRuleValues||{},c.excludeAnonymousUser=b.excludeAnonymousUser||!1,c},this.configurePixel=function(b){(b.isDebug===a._Store.SDKConfig.isDevelopmentMode||b.isProduction!==a._Store.SDKConfig.isDevelopmentMode)&&a._Store.pixelConfigurations.push(b);},this.processPixelConfigs=function(b){try{isEmpty(b.pixelConfigs)||b.pixelConfigs.forEach(function(a){d.configurePixel(a);});}catch(b){a.Logger.error("Cookie Sync configs not configured propertly. Cookie Sync may not be initialized. "+b);}},this.sendSingleForwardingStatsToServer=/*#__PURE__*/function(){var b=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function d(b){var e,f,g,h;return _regeneratorRuntime.wrap(function(d){for(;;)switch(d.prev=d.next){case 0:return f={method:"post",body:JSON.stringify(b),headers:{Accept:"text/plain;charset=UTF-8","Content-Type":"text/plain;charset=UTF-8"}},d.next=3,c.forwarderStatsUploader.upload(f);case 3:g=d.sent,h=202===g.status?"Successfully sent forwarding stats to mParticle Servers":"Issue with forwarding stats to mParticle Servers, received HTTP Code of "+g.statusText,null===a||void 0===a||null===(e=a.Logger)||void 0===e||e.verbose(h);case 6:case"end":return d.stop()}},d)}));return function(){return b.apply(this,arguments)}}();}
955
+ if(!isEmpty(c.kits)){var h=Object.keys(c.kits);a._Store.sideloadedKitsCount=h.length;}}}catch(b){a.Logger.error("Sideloaded Kits not configured propertly. Kits may not be initialized. "+b);}},this.configureSideloadedKit=function(b){a._Store.configuredForwarders.push(this.returnConfiguredKit(b,b.filters));},this.returnConfiguredKit=function(a,b){void 0===b&&(b={});var c=new a.constructor;return c.id=b.moduleId,c.isSandbox=b.isDebug||b.isSandbox,c.hasSandbox="true"===b.hasDebugString,c.isVisible=b.isVisible||!0,c.settings=b.settings||{},c.eventNameFilters=b.eventNameFilters||[],c.eventTypeFilters=b.eventTypeFilters||[],c.attributeFilters=b.attributeFilters||[],c.screenNameFilters=b.screenNameFilters||[],c.screenAttributeFilters=b.screenAttributeFilters||[],c.userIdentityFilters=b.userIdentityFilters||[],c.userAttributeFilters=b.userAttributeFilters||[],c.filteringEventAttributeValue=b.filteringEventAttributeValue||{},c.filteringUserAttributeValue=b.filteringUserAttributeValue||{},c.eventSubscriptionId=b.eventSubscriptionId||null,c.filteringConsentRuleValues=b.filteringConsentRuleValues||{},c.excludeAnonymousUser=b.excludeAnonymousUser||!1,c},this.configurePixel=function(b){(b.isDebug===a._Store.SDKConfig.isDevelopmentMode||b.isProduction!==a._Store.SDKConfig.isDevelopmentMode)&&a._Store.pixelConfigurations.push(b);},this.processPixelConfigs=function(b){try{isEmpty(b.pixelConfigs)||b.pixelConfigs.forEach(function(a){d.configurePixel(a);});}catch(b){a.Logger.error("Cookie Sync configs not configured propertly. Cookie Sync may not be initialized. "+b);}},this.sendSingleForwardingStatsToServer=function(b){return __awaiter(c,void 0,void 0,function(){var c,d,e,f;return __generator(this,function(g){switch(g.label){case 0:return c={method:"post",body:JSON.stringify(b),headers:{Accept:"text/plain;charset=UTF-8","Content-Type":"text/plain;charset=UTF-8"}},[4/*yield*/,this.forwarderStatsUploader.upload(c)];case 1:return d=g.sent(),e=202===d.status?"Successfully sent forwarding stats to mParticle Servers":"Issue with forwarding stats to mParticle Servers, received HTTP Code of "+d.statusText,null===(f=null===a||void 0===a?void 0:a.Logger)||void 0===f?void 0:f.verbose(e),[2/*return*/]}})})};}
1338
956
 
1339
957
  // TODO: This file is no longer the server model because the web SDK payload
1340
958
  var MessageType=Types.MessageType,ApplicationTransitionType=Types.ApplicationTransitionType;// TODO: Make this a pure function that returns a new object
@@ -1353,37 +971,6 @@ Store:a._Store.serverSettings,SDKVersion:Constants.sdkVersion,SessionId:a._Store
1353
971
 
1354
972
  function forwardingStatsUploader(a){function b(){var b=a._Forwarders.getForwarderStatsQueue(),c=a._Persistence.forwardingStatsBatches.uploadsTable,d=Date.now();for(var e in b.length&&(c[d]={uploading:!1,data:b},a._Forwarders.setForwarderStatsQueue([])),c)(function(b){if(c.hasOwnProperty(b)&&!1===c[b].uploading){var d=function(){4===e.readyState&&(200===e.status||202===e.status?(a.Logger.verbose("Successfully sent "+e.statusText+" from server"),delete c[b]):"4"===e.status.toString()[0]?429!==e.status&&delete c[b]:c[b].uploading=!1);},e=a._Helpers.createXHR(d),f=c[b].data;c[b].uploading=!0,a._APIClient.sendBatchForwardingStatsToServer(f,e);}})(e);}this.startForwardingStatsTimer=function(){window.mParticle._forwardingStatsTimer=setInterval(function(){b();},a._Store.SDKConfig.forwarderStatsTimeout);};}
1355
973
 
1356
- function _toPrimitive(input, hint) {
1357
- if (_typeof$1(input) !== "object" || input === null) return input;
1358
- var prim = input[Symbol.toPrimitive];
1359
- if (prim !== undefined) {
1360
- var res = prim.call(input, hint || "default");
1361
- if (_typeof$1(res) !== "object") return res;
1362
- throw new TypeError("@@toPrimitive must return a primitive value.");
1363
- }
1364
- return (hint === "string" ? String : Number)(input);
1365
- }
1366
-
1367
- function _toPropertyKey(arg) {
1368
- var key = _toPrimitive(arg, "string");
1369
- return _typeof$1(key) === "symbol" ? key : String(key);
1370
- }
1371
-
1372
- function _defineProperty(obj, key, value) {
1373
- key = _toPropertyKey(key);
1374
- if (key in obj) {
1375
- Object.defineProperty(obj, key, {
1376
- value: value,
1377
- enumerable: true,
1378
- configurable: true,
1379
- writable: true
1380
- });
1381
- } else {
1382
- obj[key] = value;
1383
- }
1384
- return obj;
1385
- }
1386
-
1387
974
  var AudienceManager=/** @class */function(){function a(a,b,c){this.url="",this.logger=c,this.url="https://".concat(a).concat(b,"/audience"),this.userAudienceAPI=window.fetch?new FetchUploader(this.url):new XHRUploader(this.url);}return a.prototype.sendGetUserAudienceRequest=function(a,b){return __awaiter(this,void 0,void 0,function(){var c,d,e,f,g,h;return __generator(this,function(i){switch(i.label){case 0:this.logger.verbose("Fetching user audiences from server"),c={method:"GET",headers:{Accept:"*/*"}},d="".concat(this.url,"?mpid=").concat(a),i.label=1;case 1:return i.trys.push([1,6,,7]),[4/*yield*/,this.userAudienceAPI.upload(c,d)];case 2:return (e=i.sent(),!(200<=e.status&&300>e.status))?[3/*break*/,4]:(this.logger.verbose("User Audiences successfully received"),[4/*yield*/,e.json()]);case 3:f=i.sent(),g={currentAudienceMemberships:null===f||void 0===f?void 0:f.audience_memberships};try{b(g);}catch(a){throw new Error("Error invoking callback on user audience response.")}return [3/*break*/,5];case 4:if(401===e.status)throw new Error("`HTTP error status ${userAudiencePromise.status} while retrieving User Audiences - please verify your API key.`");else if(403===e.status)throw new Error("`HTTP error status ${userAudiencePromise.status} while retrieving User Audiences - please verify your workspace is enabled for audiences.`");else// In case there is an HTTP error we did not anticipate.
1388
975
  throw new Error("Uncaught HTTP Error ".concat(e.status,"."));case 5:return [3/*break*/,7];case 6:return h=i.sent(),this.logger.error("Error retrieving audiences. ".concat(h)),[3/*break*/,7];case 7:return [2/*return*/]}})})},a}();
1389
976
 
@@ -1406,7 +993,7 @@ for(var e,f=window.mParticle,g=window.mParticle,h=0,i=d;h<i.length;h++)// Keep t
1406
993
  e=i[h],g=f,f=f[e];// Apply the function with its proper context
1407
994
  f.apply(g,b);}catch(a){throw new Error("Unable to compute proper mParticle function "+a)}}};
1408
995
 
1409
- function ownKeys(s,e){var r=Object.keys(s);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(s);e&&(t=t.filter(function(e){return Object.getOwnPropertyDescriptor(s,e).enumerable})),r.push.apply(r,t);}return r}function _objectSpread(s){for(var e,i=1;i<arguments.length;i++)e=null==arguments[i]?{}:arguments[i],i%2?ownKeys(Object(e),!0).forEach(function(t){_defineProperty(s,t,e[t]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(e)):ownKeys(Object(e)).forEach(function(t){Object.defineProperty(s,t,Object.getOwnPropertyDescriptor(e,t));});return s}var Messages$2=Constants.Messages,HTTPCodes$2=Constants.HTTPCodes,FeatureFlags$1=Constants.FeatureFlags,IdentityMethods$1=Constants.IdentityMethods,ErrorMessages=Messages$2.ErrorMessages,CacheIdentity=FeatureFlags$1.CacheIdentity,Identify=IdentityMethods$1.Identify,Modify$1=IdentityMethods$1.Modify,Login=IdentityMethods$1.Login,Logout=IdentityMethods$1.Logout;function Identity(t){var r=t._Helpers,s=r.getFeatureFlag,i=r.extend,n=this;// https://go.mparticle.com/work/SQDSDKS-6353
996
+ var Messages$2=Constants.Messages,HTTPCodes$2=Constants.HTTPCodes,FeatureFlags$1=Constants.FeatureFlags,IdentityMethods$1=Constants.IdentityMethods,ErrorMessages=Messages$2.ErrorMessages,CacheIdentity=FeatureFlags$1.CacheIdentity,Identify=IdentityMethods$1.Identify,Modify$1=IdentityMethods$1.Modify,Login=IdentityMethods$1.Login,Logout=IdentityMethods$1.Logout;function Identity(a){var b=a._Helpers,c=b.getFeatureFlag,d=b.extend,e=this;// https://go.mparticle.com/work/SQDSDKS-6353
1410
997
  /**
1411
998
  * Invoke these methods on the mParticle.Identity object.
1412
999
  * Example: mParticle.Identity.getCurrentUser().
@@ -1425,54 +1012,54 @@ function ownKeys(s,e){var r=Object.keys(s);if(Object.getOwnPropertySymbols){var
1425
1012
  // send a user identity change request on identify, login, logout, modify when any values change.
1426
1013
  // compare what identities exist vs what is previously was for the specific user if they were in memory before.
1427
1014
  // if it's the first time the user is logging in, send a user identity change request with
1428
- this.idCache=null,this.audienceManager=null,this.IdentityRequest={preProcessIdentityRequest:function preProcessIdentityRequest(e,r,s){t.Logger.verbose(Messages$2.InformationMessages.StartingLogEvent+": "+s);// First, remove any falsy identity values and warn about them
1429
- var i=t._Helpers.Validators.removeFalsyIdentityValues(e,t.Logger),n=null!==i&&void 0!==i&&i.userIdentities?_objectSpread(_objectSpread({},i),{},{userIdentities:normalizeUserIdentityKeys(i.userIdentities)}):i,a=t._Helpers.Validators.validateIdentities(n,s);// Normalize convenience aliases (email_sha256 → other, mobile_sha256 → other2)
1430
- if(!a.valid)return t.Logger.error("ERROR: "+a.error),{valid:!1,error:a.error};if(r&&!t._Helpers.Validators.isFunction(r)){var d="The optional callback must be a function. You tried entering a(n) "+_typeof$1(r);return t.Logger.error(d),{valid:!1,error:d}}return {valid:!0,cleanedIdentities:n}},createIdentityRequest:function createIdentityRequest(e,r,s,i,n,a,d){var o={client_sdk:{platform:r,sdk_vendor:s,sdk_version:i},context:a,environment:t._Store.SDKConfig.isDevelopmentMode?"development":"production",request_id:t._Helpers.generateUniqueId(),request_timestamp_ms:new Date().getTime(),previous_mpid:d||null,known_identities:createKnownIdentities(e,n)};return o},createModifyIdentityRequest:function createModifyIdentityRequest(e,r,s,i,n,a){return {client_sdk:{platform:s,sdk_vendor:i,sdk_version:n},context:a,environment:t._Store.SDKConfig.isDevelopmentMode?"development":"production",request_id:t._Helpers.generateUniqueId(),request_timestamp_ms:new Date().getTime(),identity_changes:this.createIdentityChanges(e,r)}},createIdentityChanges:function createIdentityChanges(e,t){var r,s=[];if(t&&isObject(t)&&e&&isObject(e))for(r in t)s.push({old_value:e[r]||null,new_value:t[r],identity_type:r});return s},// takes 2 UI objects keyed by name, combines them, returns them keyed by type
1431
- combineUserIdentities:function combineUserIdentities(e,t){var r={},s=i({},e,t);for(var n in s){var a=Types.IdentityType.getIdentityType(n);// this check removes anything that is not whitelisted as an identity type
1432
- !1!==a&&0<=a&&(r[Types.IdentityType.getIdentityType(n)]=s[n]);}return r},createAliasNetworkRequest:function createAliasNetworkRequest(e){return {request_id:t._Helpers.generateUniqueId(),request_type:"alias",environment:t._Store.SDKConfig.isDevelopmentMode?"development":"production",api_key:t._Store.devToken,data:{destination_mpid:e.destinationMpid,source_mpid:e.sourceMpid,start_unixtime_ms:e.startTime,end_unixtime_ms:e.endTime,scope:e.scope,device_application_stamp:t._Store.deviceId}}},convertAliasToNative:function convertAliasToNative(e){return {DestinationMpid:e.destinationMpid,SourceMpid:e.sourceMpid,StartUnixtimeMs:e.startTime,EndUnixtimeMs:e.endTime,Scope:e.scope}},convertToNative:function convertToNative(e){var t=[];if(e&&e.userIdentities){for(var r in e.userIdentities)e.userIdentities.hasOwnProperty(r)&&t.push({Type:Types.IdentityType.getIdentityType(r),Identity:e.userIdentities[r]});return {UserIdentities:t}}}},this.IdentityAPI={HTTPCodes:HTTPCodes$2,/**
1015
+ this.idCache=null,this.audienceManager=null,this.IdentityRequest={preProcessIdentityRequest:function preProcessIdentityRequest(b,c,d){a.Logger.verbose(Messages$2.InformationMessages.StartingLogEvent+": "+d);// First, remove any falsy identity values and warn about them
1016
+ var e=a._Helpers.Validators.removeFalsyIdentityValues(b,a.Logger),f=(null===e||void 0===e?void 0:e.userIdentities)?__assign(__assign({},e),{userIdentities:normalizeUserIdentityKeys(e.userIdentities)}):e,g=a._Helpers.Validators.validateIdentities(f,d);// Normalize convenience aliases (email_sha256 → other, mobile_sha256 → other2)
1017
+ if(!g.valid)return a.Logger.error("ERROR: "+g.error),{valid:!1,error:g.error};if(c&&!a._Helpers.Validators.isFunction(c)){var h="The optional callback must be a function. You tried entering a(n) "+_typeof(c);return a.Logger.error(h),{valid:!1,error:h}}return {valid:!0,cleanedIdentities:f}},createIdentityRequest:function createIdentityRequest(b,c,d,e,f,g,h){var i={client_sdk:{platform:c,sdk_vendor:d,sdk_version:e},context:g,environment:a._Store.SDKConfig.isDevelopmentMode?"development":"production",request_id:a._Helpers.generateUniqueId(),request_timestamp_ms:new Date().getTime(),previous_mpid:h||null,known_identities:createKnownIdentities(b,f)};return i},createModifyIdentityRequest:function createModifyIdentityRequest(b,c,d,e,f,g){return {client_sdk:{platform:d,sdk_vendor:e,sdk_version:f},context:g,environment:a._Store.SDKConfig.isDevelopmentMode?"development":"production",request_id:a._Helpers.generateUniqueId(),request_timestamp_ms:new Date().getTime(),identity_changes:this.createIdentityChanges(b,c)}},createIdentityChanges:function createIdentityChanges(a,b){var c=[];if(b&&isObject(b)&&a&&isObject(a))for(var d in b)c.push({old_value:a[d]||null,new_value:b[d],identity_type:d});return c},// takes 2 UI objects keyed by name, combines them, returns them keyed by type
1018
+ combineUserIdentities:function combineUserIdentities(a,b){var c={},e=d({},a,b);for(var f in e){var g=Types.IdentityType.getIdentityType(f);// this check removes anything that is not whitelisted as an identity type
1019
+ !1!==g&&0<=g&&(c[Types.IdentityType.getIdentityType(f)]=e[f]);}return c},createAliasNetworkRequest:function createAliasNetworkRequest(b){return {request_id:a._Helpers.generateUniqueId(),request_type:"alias",environment:a._Store.SDKConfig.isDevelopmentMode?"development":"production",api_key:a._Store.devToken,data:{destination_mpid:b.destinationMpid,source_mpid:b.sourceMpid,start_unixtime_ms:b.startTime,end_unixtime_ms:b.endTime,scope:b.scope,device_application_stamp:a._Store.deviceId}}},convertAliasToNative:function convertAliasToNative(a){return {DestinationMpid:a.destinationMpid,SourceMpid:a.sourceMpid,StartUnixtimeMs:a.startTime,EndUnixtimeMs:a.endTime,Scope:a.scope}},convertToNative:function convertToNative(a){var b=[];if(null===a||void 0===a?void 0:a.userIdentities){for(var c in a.userIdentities)a.userIdentities.hasOwnProperty(c)&&b.push({Type:Types.IdentityType.getIdentityType(c),Identity:a.userIdentities[c]});return {UserIdentities:b}}}},this.IdentityAPI={HTTPCodes:HTTPCodes$2,/**
1433
1020
  * Initiate a logout request to the mParticle server
1434
1021
  * @method identify
1435
1022
  * @param {Object} identityApiData The identityApiData object as indicated [here](https://github.com/mParticle/mparticle-sdk-javascript/blob/master-v2/README.md#1-customize-the-sdk)
1436
1023
  * @param {Function} [callback] A callback function that is called when the identify request completes
1437
- */identify:function identify(e,r){// https://go.mparticle.com/work/SQDSDKS-6337
1438
- var s,i=t.Identity.getCurrentUser(),a=t._Identity.IdentityRequest.preProcessIdentityRequest(e,r,Identify);if(i&&(s=i.getMPID()),a.valid){var d=t._Identity.IdentityRequest.createIdentityRequest(a.cleanedIdentities,Constants.platform,Constants.sdkVendor,Constants.sdkVersion,t._Store.deviceId,t._Store.context,s);if(t._Helpers.getFeatureFlag(Constants.FeatureFlags.CacheIdentity)){var o=tryCacheIdentity(d.known_identities,n.idCache,n.parseIdentityResponse,s,r,e,Identify);if(o)return}t._Helpers.canLog()?t._Store.webviewBridgeEnabled?(t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Identify,JSON.stringify(t._Identity.IdentityRequest.convertToNative(e))),t._Helpers.invokeCallback(r,HTTPCodes$2.nativeIdentityRequest,"Identify request sent to native sdk")):t._IdentityAPIClient.sendIdentityRequest(d,Identify,r,e,n.parseIdentityResponse,s,d.known_identities):(t._Helpers.invokeCallback(r,HTTPCodes$2.loggingDisabledOrMissingAPIKey,Messages$2.InformationMessages.AbandonLogEvent),t.Logger.verbose(Messages$2.InformationMessages.AbandonLogEvent));}else t._Helpers.invokeCallback(r,HTTPCodes$2.validationIssue,a.error),t.Logger.verbose(a);},/**
1024
+ */identify:function identify(b,c){// https://go.mparticle.com/work/SQDSDKS-6337
1025
+ var d,f=a.Identity.getCurrentUser(),g=a._Identity.IdentityRequest.preProcessIdentityRequest(b,c,Identify);if(f&&(d=f.getMPID()),g.valid){var h=a._Identity.IdentityRequest.createIdentityRequest(g.cleanedIdentities,Constants.platform,Constants.sdkVendor,Constants.sdkVersion,a._Store.deviceId,a._Store.context,d);if(a._Helpers.getFeatureFlag(Constants.FeatureFlags.CacheIdentity)){var i=tryCacheIdentity(h.known_identities,e.idCache,e.parseIdentityResponse,d,c,b,Identify);if(i)return}a._Helpers.canLog()?a._Store.webviewBridgeEnabled?(a._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Identify,JSON.stringify(a._Identity.IdentityRequest.convertToNative(b))),a._Helpers.invokeCallback(c,HTTPCodes$2.nativeIdentityRequest,"Identify request sent to native sdk")):a._IdentityAPIClient.sendIdentityRequest(h,Identify,c,b,e.parseIdentityResponse,d,h.known_identities):(a._Helpers.invokeCallback(c,HTTPCodes$2.loggingDisabledOrMissingAPIKey,Messages$2.InformationMessages.AbandonLogEvent),a.Logger.verbose(Messages$2.InformationMessages.AbandonLogEvent));}else a._Helpers.invokeCallback(c,HTTPCodes$2.validationIssue,g.error),a.Logger.verbose(g);},/**
1439
1026
  * Initiate a logout request to the mParticle server
1440
1027
  * @method logout
1441
1028
  * @param {Object} identityApiData The identityApiData object as indicated [here](https://github.com/mParticle/mparticle-sdk-javascript/blob/master-v2/README.md#1-customize-the-sdk)
1442
1029
  * @param {Function} [callback] A callback function that is called when the logout request completes
1443
- */logout:function logout(e,r){// https://go.mparticle.com/work/SQDSDKS-6337
1444
- var s,i=t.Identity.getCurrentUser(),a=t._Identity.IdentityRequest.preProcessIdentityRequest(e,r,Logout);if(i&&(s=i.getMPID()),a.valid){var d,o=t._Identity.IdentityRequest.createIdentityRequest(a.cleanedIdentities,Constants.platform,Constants.sdkVendor,Constants.sdkVersion,t._Store.deviceId,t._Store.context,s);t._Helpers.canLog()?t._Store.webviewBridgeEnabled?(t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Logout,JSON.stringify(t._Identity.IdentityRequest.convertToNative(e))),t._Helpers.invokeCallback(r,HTTPCodes$2.nativeIdentityRequest,"Logout request sent to native sdk")):(t._IdentityAPIClient.sendIdentityRequest(o,Logout,r,e,n.parseIdentityResponse,s),d=t._ServerModel.createEventObject({messageType:Types.MessageType.Profile}),d.ProfileMessageType=Types.ProfileMessageType.Logout,t._Store.activeForwarders.length&&t._Store.activeForwarders.forEach(function(e){e.logOut&&e.logOut(d);})):(t._Helpers.invokeCallback(r,HTTPCodes$2.loggingDisabledOrMissingAPIKey,Messages$2.InformationMessages.AbandonLogEvent),t.Logger.verbose(Messages$2.InformationMessages.AbandonLogEvent));}else t._Helpers.invokeCallback(r,HTTPCodes$2.validationIssue,a.error),t.Logger.verbose(a);},/**
1030
+ */logout:function logout(b,c){// https://go.mparticle.com/work/SQDSDKS-6337
1031
+ var d,f=a.Identity.getCurrentUser(),g=a._Identity.IdentityRequest.preProcessIdentityRequest(b,c,Logout);if(f&&(d=f.getMPID()),g.valid){var h,i=a._Identity.IdentityRequest.createIdentityRequest(g.cleanedIdentities,Constants.platform,Constants.sdkVendor,Constants.sdkVersion,a._Store.deviceId,a._Store.context,d);a._Helpers.canLog()?a._Store.webviewBridgeEnabled?(a._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Logout,JSON.stringify(a._Identity.IdentityRequest.convertToNative(b))),a._Helpers.invokeCallback(c,HTTPCodes$2.nativeIdentityRequest,"Logout request sent to native sdk")):(a._IdentityAPIClient.sendIdentityRequest(i,Logout,c,b,e.parseIdentityResponse,d),h=a._ServerModel.createEventObject({messageType:Types.MessageType.Profile}),h.ProfileMessageType=Types.ProfileMessageType.Logout,a._Store.activeForwarders.length&&a._Store.activeForwarders.forEach(function(a){var b=a;b.logOut&&b.logOut(h);})):(a._Helpers.invokeCallback(c,HTTPCodes$2.loggingDisabledOrMissingAPIKey,Messages$2.InformationMessages.AbandonLogEvent),a.Logger.verbose(Messages$2.InformationMessages.AbandonLogEvent));}else a._Helpers.invokeCallback(c,HTTPCodes$2.validationIssue,g.error),a.Logger.verbose(g);},/**
1445
1032
  * Initiate a login request to the mParticle server
1446
1033
  * @method login
1447
1034
  * @param {Object} identityApiData The identityApiData object as indicated [here](https://github.com/mParticle/mparticle-sdk-javascript/blob/master-v2/README.md#1-customize-the-sdk)
1448
1035
  * @param {Function} [callback] A callback function that is called when the login request completes
1449
- */login:function login(e,r){// https://go.mparticle.com/work/SQDSDKS-6337
1450
- var s,i=t.Identity.getCurrentUser(),a=t._Identity.IdentityRequest.preProcessIdentityRequest(e,r,Login);if(i&&(s=i.getMPID()),a.valid){var d=t._Identity.IdentityRequest.createIdentityRequest(a.cleanedIdentities,Constants.platform,Constants.sdkVendor,Constants.sdkVersion,t._Store.deviceId,t._Store.context,s);if(t._Helpers.getFeatureFlag(Constants.FeatureFlags.CacheIdentity)){var o=tryCacheIdentity(d.known_identities,n.idCache,n.parseIdentityResponse,s,r,e,Login);if(o)return}t._Helpers.canLog()?t._Store.webviewBridgeEnabled?(t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Login,JSON.stringify(t._Identity.IdentityRequest.convertToNative(e))),t._Helpers.invokeCallback(r,HTTPCodes$2.nativeIdentityRequest,"Login request sent to native sdk")):t._IdentityAPIClient.sendIdentityRequest(d,Login,r,e,n.parseIdentityResponse,s,d.known_identities):(t._Helpers.invokeCallback(r,HTTPCodes$2.loggingDisabledOrMissingAPIKey,Messages$2.InformationMessages.AbandonLogEvent),t.Logger.verbose(Messages$2.InformationMessages.AbandonLogEvent));}else t._Helpers.invokeCallback(r,HTTPCodes$2.validationIssue,a.error),t.Logger.verbose(a);},/**
1036
+ */login:function login(b,c){// https://go.mparticle.com/work/SQDSDKS-6337
1037
+ var d,f=a.Identity.getCurrentUser(),g=a._Identity.IdentityRequest.preProcessIdentityRequest(b,c,Login);if(f&&(d=f.getMPID()),g.valid){var h=a._Identity.IdentityRequest.createIdentityRequest(g.cleanedIdentities,Constants.platform,Constants.sdkVendor,Constants.sdkVersion,a._Store.deviceId,a._Store.context,d);if(a._Helpers.getFeatureFlag(Constants.FeatureFlags.CacheIdentity)){var i=tryCacheIdentity(h.known_identities,e.idCache,e.parseIdentityResponse,d,c,b,Login);if(i)return}a._Helpers.canLog()?a._Store.webviewBridgeEnabled?(a._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Login,JSON.stringify(a._Identity.IdentityRequest.convertToNative(b))),a._Helpers.invokeCallback(c,HTTPCodes$2.nativeIdentityRequest,"Login request sent to native sdk")):a._IdentityAPIClient.sendIdentityRequest(h,Login,c,b,e.parseIdentityResponse,d,h.known_identities):(a._Helpers.invokeCallback(c,HTTPCodes$2.loggingDisabledOrMissingAPIKey,Messages$2.InformationMessages.AbandonLogEvent),a.Logger.verbose(Messages$2.InformationMessages.AbandonLogEvent));}else a._Helpers.invokeCallback(c,HTTPCodes$2.validationIssue,g.error),a.Logger.verbose(g);},/**
1451
1038
  * Initiate a modify request to the mParticle server
1452
1039
  * @method modify
1453
1040
  * @param {Object} identityApiData The identityApiData object as indicated [here](https://github.com/mParticle/mparticle-sdk-javascript/blob/master-v2/README.md#1-customize-the-sdk)
1454
1041
  * @param {Function} [callback] A callback function that is called when the modify request completes
1455
- */modify:function modify(e,r){// https://go.mparticle.com/work/SQDSDKS-6337
1456
- var s,i=t.Identity.getCurrentUser(),a=t._Identity.IdentityRequest.preProcessIdentityRequest(e,r,Modify$1);if(i&&(s=i.getMPID()),a.valid){var d=e&&e.userIdentities?a.cleanedIdentities.userIdentities:{},o=t._Identity.IdentityRequest.createModifyIdentityRequest(i?i.getUserIdentities().userIdentities:{},d,Constants.platform,Constants.sdkVendor,Constants.sdkVersion,t._Store.context);t._Helpers.canLog()?t._Store.webviewBridgeEnabled?(t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Modify,JSON.stringify(t._Identity.IdentityRequest.convertToNative(e))),t._Helpers.invokeCallback(r,HTTPCodes$2.nativeIdentityRequest,"Modify request sent to native sdk")):t._IdentityAPIClient.sendIdentityRequest(o,Modify$1,r,e,n.parseIdentityResponse,s,o.known_identities):(t._Helpers.invokeCallback(r,HTTPCodes$2.loggingDisabledOrMissingAPIKey,Messages$2.InformationMessages.AbandonLogEvent),t.Logger.verbose(Messages$2.InformationMessages.AbandonLogEvent));}else t._Helpers.invokeCallback(r,HTTPCodes$2.validationIssue,a.error),t.Logger.verbose(a);},/**
1042
+ */modify:function modify(b,c){// https://go.mparticle.com/work/SQDSDKS-6337
1043
+ var d,f=a.Identity.getCurrentUser(),g=a._Identity.IdentityRequest.preProcessIdentityRequest(b,c,Modify$1);if(f&&(d=f.getMPID()),g.valid){var h=(null===b||void 0===b?void 0:b.userIdentities)?g.cleanedIdentities.userIdentities:{},i=a._Identity.IdentityRequest.createModifyIdentityRequest(f?f.getUserIdentities().userIdentities:{},h,Constants.platform,Constants.sdkVendor,Constants.sdkVersion,a._Store.context);a._Helpers.canLog()?a._Store.webviewBridgeEnabled?(a._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Modify,JSON.stringify(a._Identity.IdentityRequest.convertToNative(b))),a._Helpers.invokeCallback(c,HTTPCodes$2.nativeIdentityRequest,"Modify request sent to native sdk")):a._IdentityAPIClient.sendIdentityRequest(i,Modify$1,c,b,e.parseIdentityResponse,d):(a._Helpers.invokeCallback(c,HTTPCodes$2.loggingDisabledOrMissingAPIKey,Messages$2.InformationMessages.AbandonLogEvent),a.Logger.verbose(Messages$2.InformationMessages.AbandonLogEvent));}else a._Helpers.invokeCallback(c,HTTPCodes$2.validationIssue,g.error),a.Logger.verbose(g);},/**
1457
1044
  * Returns a user object with methods to interact with the current user
1458
1045
  * @method getCurrentUser
1459
1046
  * @return {Object} the current user object
1460
- */getCurrentUser:function getCurrentUser(){var e;return t._Store?(e=t._Store.mpid,e?(e=t._Store.mpid.slice(),n.mParticleUser(e,t._Store.isLoggedIn)):t._Store.webviewBridgeEnabled?n.mParticleUser():null):null},/**
1047
+ */getCurrentUser:function getCurrentUser(){var b;return a._Store?(b=a._Store.mpid,b?(b=a._Store.mpid.slice(),e.mParticleUser(b,a._Store.isLoggedIn)):a._Store.webviewBridgeEnabled?e.mParticleUser():null):null},/**
1461
1048
  * Returns a the user object associated with the mpid parameter or 'null' if no such
1462
1049
  * user exists
1463
1050
  * @method getUser
1464
1051
  * @param {String} mpid of the desired user
1465
1052
  * @return {Object} the user for mpid
1466
- */getUser:function getUser(e){var r=t._Persistence.getPersistence();return r?r[e]&&!Constants.SDKv2NonMPIDCookieKeys.hasOwnProperty(e)?n.mParticleUser(e):null:null},/**
1053
+ */getUser:function getUser(b){var c=a._Persistence.getPersistence();return c?c[b]&&!Constants.SDKv2NonMPIDCookieKeys.hasOwnProperty(b)?e.mParticleUser(b):null:null},/**
1467
1054
  * Returns all users, including the current user and all previous users that are stored on the device.
1468
1055
  * @method getUsers
1469
1056
  * @return {Array} array of users
1470
- */getUsers:function getUsers(){var e=t._Persistence.getPersistence(),r=[];if(e)for(var s in e)Constants.SDKv2NonMPIDCookieKeys.hasOwnProperty(s)||r.push(n.mParticleUser(s));return r.sort(function(e,t){var r=e.getLastSeenTime()||0,s=t.getLastSeenTime()||0;return r>s?-1:1}),r},/**
1057
+ */getUsers:function getUsers(){var b=a._Persistence.getPersistence(),c=[];if(b)for(var d in b)Constants.SDKv2NonMPIDCookieKeys.hasOwnProperty(d)||c.push(e.mParticleUser(d));return c.sort(function(c,a){var b=c.getLastSeenTime()||0,d=a.getLastSeenTime()||0;return b>d?-1:1}),c},/**
1471
1058
  * Initiate an alias request to the mParticle server
1472
1059
  * @method aliasUsers
1473
1060
  * @param {Object} aliasRequest object representing an AliasRequest
1474
1061
  * @param {Function} [callback] A callback function that is called when the aliasUsers request completes
1475
- */aliasUsers:function aliasUsers(e,r){var s;if(e.destinationMpid&&e.sourceMpid||(s=Messages$2.ValidationMessages.AliasMissingMpid),e.destinationMpid===e.sourceMpid&&(s=Messages$2.ValidationMessages.AliasNonUniqueMpid),e.startTime&&e.endTime||(s=Messages$2.ValidationMessages.AliasMissingTime),e.startTime>e.endTime&&(s=Messages$2.ValidationMessages.AliasStartBeforeEndTime),s)return t.Logger.warning(s),void t._Helpers.invokeAliasCallback(r,HTTPCodes$2.validationIssue,s);if(!t._Helpers.canLog())t._Helpers.invokeAliasCallback(r,HTTPCodes$2.loggingDisabledOrMissingAPIKey,Messages$2.InformationMessages.AbandonAliasUsers),t.Logger.verbose(Messages$2.InformationMessages.AbandonAliasUsers);else if(t._Store.webviewBridgeEnabled)t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Alias,JSON.stringify(t._Identity.IdentityRequest.convertAliasToNative(e))),t._Helpers.invokeAliasCallback(r,HTTPCodes$2.nativeIdentityRequest,"Alias request sent to native sdk");else {t.Logger.verbose(Messages$2.InformationMessages.StartingAliasRequest+": "+e.sourceMpid+" -> "+e.destinationMpid);var i=t._Identity.IdentityRequest.createAliasNetworkRequest(e);t._IdentityAPIClient.sendAliasRequest(i,r);}},/**
1062
+ */aliasUsers:function aliasUsers(b,c){var d;if(b.destinationMpid&&b.sourceMpid||(d=Messages$2.ValidationMessages.AliasMissingMpid),b.destinationMpid===b.sourceMpid&&(d=Messages$2.ValidationMessages.AliasNonUniqueMpid),b.startTime&&b.endTime||(d=Messages$2.ValidationMessages.AliasMissingTime),b.startTime>b.endTime&&(d=Messages$2.ValidationMessages.AliasStartBeforeEndTime),d)return a.Logger.warning(d),void a._Helpers.invokeAliasCallback(c,HTTPCodes$2.validationIssue,d);if(!a._Helpers.canLog())a._Helpers.invokeAliasCallback(c,HTTPCodes$2.loggingDisabledOrMissingAPIKey,Messages$2.InformationMessages.AbandonAliasUsers),a.Logger.verbose(Messages$2.InformationMessages.AbandonAliasUsers);else if(a._Store.webviewBridgeEnabled)a._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Alias,JSON.stringify(a._Identity.IdentityRequest.convertAliasToNative(b))),a._Helpers.invokeAliasCallback(c,HTTPCodes$2.nativeIdentityRequest,"Alias request sent to native sdk");else {a.Logger.verbose(Messages$2.InformationMessages.StartingAliasRequest+": "+b.sourceMpid+" -> "+b.destinationMpid);var e=a._Identity.IdentityRequest.createAliasNetworkRequest(b);a._IdentityAPIClient.sendAliasRequest(e,c);}},/**
1476
1063
  * Search the IDSync Workspace endpoint for a known identity.
1477
1064
  *
1478
1065
  * POSTs to mParticle's `/v1/search` endpoint and invokes `callback`
@@ -1488,124 +1075,124 @@ var s,i=t.Identity.getCurrentUser(),a=t._Identity.IdentityRequest.preProcessIden
1488
1075
  * @param {String} workspaceApiKey Workspace API key (sent as x-mp-key).
1489
1076
  * @param {Object} knownIdentities A `UserIdentities` map.
1490
1077
  * @param {Function} callback Invoked with the `IIdentitySearchResult`.
1491
- */search:function search(e,r,s){executeSearchRequest(t,e,r,s);},/**
1078
+ */search:function search(b,c,d){executeSearchRequest(a,b,c,d);},/**
1492
1079
  Create a default AliasRequest for 2 MParticleUsers. This will construct the request
1493
1080
  using the sourceUser's firstSeenTime as the startTime, and its lastSeenTime as the endTime.
1494
1081
 
1495
1082
  In the unlikely scenario that the sourceUser does not have a firstSeenTime, which will only
1496
- be the case if they have not been the current user since this functionality was added, the
1083
+ be the case if they have not been the current user since this functionality was added, the
1497
1084
  startTime will be populated with the earliest firstSeenTime out of any stored user. Similarly,
1498
1085
  if the sourceUser does not have a lastSeenTime, the endTime will be populated with the current time
1499
1086
 
1500
1087
  There is a limit to how old the startTime can be, represented by the config field 'aliasMaxWindow', in days.
1501
- If the startTime falls before the limit, it will be adjusted to the oldest allowed startTime.
1502
- In rare cases, where the sourceUser's lastSeenTime also falls outside of the aliasMaxWindow limit,
1503
- after applying this adjustment it will be impossible to create an aliasRequest passes the aliasUsers()
1504
- validation that the startTime must be less than the endTime
1505
- */createAliasRequest:function createAliasRequest(e,r,s){try{if(!r||!e)return t.Logger.error("'destinationUser' and 'sourceUser' must both be present"),null;var i=e.getFirstSeenTime();i||t.Identity.getUsers().forEach(function(e){e.getFirstSeenTime()&&(!i||e.getFirstSeenTime()<i)&&(i=e.getFirstSeenTime());});var n=new Date().getTime()-1e3*(60*(60*(24*t._Store.SDKConfig.aliasMaxWindow))),a=e.getLastSeenTime()||new Date().getTime();//if the startTime is greater than $maxAliasWindow ago, adjust the startTime to the earliest allowed
1506
- return i<n&&(i=n,a<i&&t.Logger.warning("Source User has not been seen in the last "+t._Store.SDKConfig.maxAliasWindow+" days, Alias Request will likely fail")),{destinationMpid:r.getMPID(),sourceMpid:e.getMPID(),startTime:i,endTime:a,scope:s||"device"}}catch(r){return t.Logger.error("There was a problem with creating an alias request: "+r),null}}},this.mParticleUser=function(e,r){var s=this;return {/**
1088
+ If the startTime falls before the limit, it will be adjusted to the oldest allowed startTime.
1089
+ In rare cases, where the sourceUser's lastSeenTime also falls outside of the aliasMaxWindow limit,
1090
+ after applying this adjustment it will be impossible to create an aliasRequest passes the aliasUsers()
1091
+ validation that the startTime must be less than the endTime
1092
+ */createAliasRequest:function createAliasRequest(b,c,d){try{if(!c||!b)return a.Logger.error("'destinationUser' and 'sourceUser' must both be present"),null;var e=b.getFirstSeenTime();e||a.Identity.getUsers().forEach(function(a){a.getFirstSeenTime()&&(!e||a.getFirstSeenTime()<e)&&(e=a.getFirstSeenTime());});var f=new Date().getTime()-1e3*(60*(60*(24*a._Store.SDKConfig.aliasMaxWindow))),g=b.getLastSeenTime()||new Date().getTime();//if the startTime is greater than $maxAliasWindow ago, adjust the startTime to the earliest allowed
1093
+ return e<f&&(e=f,g<e&&a.Logger.warning("Source User has not been seen in the last "+a._Store.SDKConfig.maxAliasWindow+" days, Alias Request will likely fail")),{destinationMpid:c.getMPID(),sourceMpid:b.getMPID(),startTime:e,endTime:g,scope:d||"device"}}catch(b){return a.Logger.error("There was a problem with creating an alias request: "+b),null}}},this.mParticleUser=function(b,c){return {/**
1507
1094
  * Get user identities for current user
1508
1095
  * @method getUserIdentities
1509
1096
  * @return {Object} an object with userIdentities as its key
1510
- */getUserIdentities:function getUserIdentities(){var r={},s=t._Store.getUserIdentities(e);for(var i in s)s.hasOwnProperty(i)&&(r[Types.IdentityType.getIdentityName(t._Helpers.parseNumber(i))]=s[i]);return {userIdentities:r}},/**
1097
+ */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}},/**
1511
1098
  * Get the MPID of the current user
1512
1099
  * @method getMPID
1513
1100
  * @return {String} the current user MPID as a string
1514
- */getMPID:function getMPID(){return e},/**
1101
+ */getMPID:function getMPID(){return b},/**
1515
1102
  * Sets a user tag
1516
1103
  * @method setUserTag
1517
1104
  * @param {String} tagName
1518
- */setUserTag:function setUserTag(e){return t._Helpers.Validators.isValidKeyValue(e)?void this.setUserAttribute(e,null):void t.Logger.error(Messages$2.ErrorMessages.BadKey)},/**
1105
+ */setUserTag:function setUserTag(b){return a._Helpers.Validators.isValidKeyValue(b)?void this.setUserAttribute(b,null):void a.Logger.error(Messages$2.ErrorMessages.BadKey)},/**
1519
1106
  * Removes a user tag
1520
1107
  * @method removeUserTag
1521
1108
  * @param {String} tagName
1522
- */removeUserTag:function removeUserTag(e){return t._Helpers.Validators.isValidKeyValue(e)?void this.removeUserAttribute(e):void t.Logger.error(Messages$2.ErrorMessages.BadKey)},/**
1109
+ */removeUserTag:function removeUserTag(b){return a._Helpers.Validators.isValidKeyValue(b)?void this.removeUserAttribute(b):void a.Logger.error(Messages$2.ErrorMessages.BadKey)},/**
1523
1110
  * Sets a user attribute
1524
1111
  * @method setUserAttribute
1525
1112
  * @param {String} key
1526
1113
  * @param {String} value
1527
1114
  */ // https://go.mparticle.com/work/SQDSDKS-4576
1528
1115
  // https://go.mparticle.com/work/SQDSDKS-6373
1529
- setUserAttribute:function setUserAttribute(r,i){if(t._SessionManager.resetSessionTimer(),t._Helpers.canLog()){if(!t._Helpers.Validators.isValidAttributeValue(i))return void t.Logger.error(Messages$2.ErrorMessages.BadAttribute);if(!t._Helpers.Validators.isValidKeyValue(r))return void t.Logger.error(Messages$2.ErrorMessages.BadKey);if(t._Store.webviewBridgeEnabled)t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.SetUserAttribute,JSON.stringify({key:r,value:i}));else {var n,a,d=this.getAllUserAttributes(),o=t._Helpers.findKeyInObject(d,r);o?(a=!1,n=d[o],delete d[o]):a=!0,d[r]=i,t._Store.setUserAttributes(e,d),s.sendUserAttributeChangeEvent(r,i,n,a,!1,this),t._Forwarders.initForwarders(s.IdentityAPI.getCurrentUser().getUserIdentities(),t._APIClient.prepareForwardingStats),t._Forwarders.handleForwarderUserAttributes("setUserAttribute",r,i);}}},/**
1116
+ setUserAttribute:function setUserAttribute(c,d){if(a._SessionManager.resetSessionTimer(),a._Helpers.canLog()){if(!a._Helpers.Validators.isValidAttributeValue(d))return void a.Logger.error(Messages$2.ErrorMessages.BadAttribute);if(!a._Helpers.Validators.isValidKeyValue(c))return void a.Logger.error(Messages$2.ErrorMessages.BadKey);if(a._Store.webviewBridgeEnabled)a._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.SetUserAttribute,JSON.stringify({key:c,value:d}));else {var f=this.getAllUserAttributes(),g=void 0,h=void 0,i=a._Helpers.findKeyInObject(f,c);i?(h=!1,g=f[i],delete f[i]):h=!0,f[c]=d,a._Store.setUserAttributes(b,f),e.sendUserAttributeChangeEvent(c,d,g,h,!1,this),a._Forwarders.initForwarders(e.IdentityAPI.getCurrentUser().getUserIdentities(),a._APIClient.prepareForwardingStats),a._Forwarders.handleForwarderUserAttributes("setUserAttribute",c,d);}}},/**
1530
1117
  * Set multiple user attributes
1531
1118
  * @method setUserAttributes
1532
1119
  * @param {Object} user attribute object with keys of the attribute type, and value of the attribute value
1533
1120
  */ // https://go.mparticle.com/work/SQDSDKS-6373
1534
- setUserAttributes:function setUserAttributes(e){if(t._SessionManager.resetSessionTimer(),!isObject(e))t.Logger.error("Must pass an object into setUserAttributes. You passed a "+_typeof$1(e));else if(t._Helpers.canLog())for(var r in e)e.hasOwnProperty(r)&&this.setUserAttribute(r,e[r]);},/**
1121
+ setUserAttributes:function setUserAttributes(b){if(a._SessionManager.resetSessionTimer(),!isObject(b))a.Logger.error("Must pass an object into setUserAttributes. You passed a "+_typeof(b));else if(a._Helpers.canLog())for(var c in b)b.hasOwnProperty(c)&&this.setUserAttribute(c,b[c]);},/**
1535
1122
  * Removes a specific user attribute
1536
1123
  * @method removeUserAttribute
1537
1124
  * @param {String} key
1538
- */removeUserAttribute:function removeUserAttribute(r){var i,n;if(t._SessionManager.resetSessionTimer(),!t._Helpers.Validators.isValidKeyValue(r))return void t.Logger.error(Messages$2.ErrorMessages.BadKey);if(t._Store.webviewBridgeEnabled)t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.RemoveUserAttribute,JSON.stringify({key:r,value:null}));else {i=t._Persistence.getPersistence(),n=this.getAllUserAttributes();var a=t._Helpers.findKeyInObject(n,r);a&&(r=a);var d=n[r]?n[r].toString():null;delete n[r],i&&i[e]&&(i[e].ua=n,t._Persistence.savePersistence(i,e)),s.sendUserAttributeChangeEvent(r,null,d,!1,!0,this),t._Forwarders.initForwarders(s.IdentityAPI.getCurrentUser().getUserIdentities(),t._APIClient.prepareForwardingStats),t._Forwarders.handleForwarderUserAttributes("removeUserAttribute",r,null);}},/**
1125
+ */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(),a._APIClient.prepareForwardingStats),a._Forwarders.handleForwarderUserAttributes("removeUserAttribute",c,null);}},/**
1539
1126
  * Sets a list of user attributes
1540
1127
  * @method setUserAttributeList
1541
1128
  * @param {String} key
1542
1129
  * @param {Array} value an array of values
1543
1130
  */ // https://go.mparticle.com/work/SQDSDKS-6373
1544
- setUserAttributeList:function setUserAttributeList(r,n){if(t._SessionManager.resetSessionTimer(),!t._Helpers.Validators.isValidKeyValue(r))return void t.Logger.error(Messages$2.ErrorMessages.BadKey);if(!Array.isArray(n))return void t.Logger.error("The value you passed in to setUserAttributeList must be an array. You passed in a "+("undefined"==typeof value?"undefined":_typeof$1(value)));var a=n.slice();if(t._Store.webviewBridgeEnabled)t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.SetUserAttributeList,JSON.stringify({key:r,value:a}));else {var d,o,g,l=this.getAllUserAttributes(),u=t._Helpers.findKeyInObject(l,r);// If the new attributeList length is different than the previous, then there is a change event.
1131
+ setUserAttributeList:function setUserAttributeList(c,d){if(a._SessionManager.resetSessionTimer(),!a._Helpers.Validators.isValidKeyValue(c))return void a.Logger.error(Messages$2.ErrorMessages.BadKey);if(!Array.isArray(d))return void a.Logger.error("The value you passed in to setUserAttributeList must be an array. You passed in a "+_typeof(d));var f=d.slice();if(a._Store.webviewBridgeEnabled)a._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.SetUserAttributeList,JSON.stringify({key:c,value:f}));else {var g=this.getAllUserAttributes(),h=void 0,j=void 0,k=void 0,l=a._Helpers.findKeyInObject(g,c);// If the new attributeList length is different than the previous, then there is a change event.
1545
1132
  // Loop through new attributes list, see if they are all in the same index as previous user attributes list
1546
1133
  // If there are any changes, break, and immediately send a userAttributeChangeEvent with full array as a value
1547
- if(u?(o=!1,d=l[u],delete l[u]):o=!0,l[r]=a,t._Store.setUserAttributes(e,l),!d||!Array.isArray(d))g=!0;else if(n.length!==d.length)g=!0;else for(var p=0;p<n.length;p++)if(d[p]!==n[p]){g=!0;break}g&&s.sendUserAttributeChangeEvent(r,n,d,o,!1,this),t._Forwarders.initForwarders(s.IdentityAPI.getCurrentUser().getUserIdentities(),t._APIClient.prepareForwardingStats),t._Forwarders.handleForwarderUserAttributes("setUserAttribute",r,a);}},/**
1134
+ 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(),a._APIClient.prepareForwardingStats),a._Forwarders.handleForwarderUserAttributes("setUserAttribute",c,f);}},/**
1548
1135
  * Removes all user attributes
1549
1136
  * @method removeAllUserAttributes
1550
- */removeAllUserAttributes:function removeAllUserAttributes(){var e;if(t._SessionManager.resetSessionTimer(),t._Store.webviewBridgeEnabled)t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.RemoveAllUserAttributes);else if(e=this.getAllUserAttributes(),t._Forwarders.initForwarders(s.IdentityAPI.getCurrentUser().getUserIdentities(),t._APIClient.prepareForwardingStats),e)for(var r in e)e.hasOwnProperty(r)&&t._Forwarders.handleForwarderUserAttributes("removeUserAttribute",r,null),this.removeUserAttribute(r);},/**
1137
+ */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(),a._APIClient.prepareForwardingStats),b)for(var c in b)b.hasOwnProperty(c)&&a._Forwarders.handleForwarderUserAttributes("removeUserAttribute",c,null),this.removeUserAttribute(c);},/**
1551
1138
  * Returns all user attribute keys that have values that are arrays
1552
1139
  * @method getUserAttributesLists
1553
1140
  * @return {Object} an object of only keys with array values. Example: { attr1: [1, 2, 3], attr2: ['a', 'b', 'c'] }
1554
- */getUserAttributesLists:function getUserAttributesLists(){var e,t={};for(var r in e=this.getAllUserAttributes(),e)e.hasOwnProperty(r)&&Array.isArray(e[r])&&(t[r]=e[r].slice());return t},/**
1141
+ */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},/**
1555
1142
  * Returns all user attributes
1556
1143
  * @method getAllUserAttributes
1557
1144
  * @return {Object} an object of all user attributes. Example: { attr1: 'value1', attr2: ['a', 'b', 'c'] }
1558
- */getAllUserAttributes:function getAllUserAttributes(){var r=t._Store.getUserAttributes,s={},i=r(e);if(i)for(var n in i)i.hasOwnProperty(n)&&(s[n]=Array.isArray(i[n])?i[n].slice():i[n]);return s},/**
1145
+ */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},/**
1559
1146
  * Returns the cart object for the current user
1560
1147
  * @method getCart
1561
1148
  * @return a cart object
1562
- */getCart:function getCart(){return logDeprecatedMethodUsage({methodName:"Identity.getCurrentUser().getCart()",warningMessage:"Deprecated function Identity.getCurrentUser().getCart() will be removed in future releases"},t.Logger,t._ErrorReportingDispatcher),s.mParticleUserCart()},/**
1149
+ */getCart:function getCart(){return logDeprecatedMethodUsage({methodName:"Identity.getCurrentUser().getCart()",warningMessage:"Deprecated function Identity.getCurrentUser().getCart() will be removed in future releases"},a.Logger,a._ErrorReportingDispatcher),e.mParticleUserCart()},/**
1563
1150
  * Returns the Consent State stored locally for this user.
1564
1151
  * @method getConsentState
1565
1152
  * @return a ConsentState object
1566
- */getConsentState:function getConsentState(){return t._Store.getConsentState(e)},/**
1153
+ */getConsentState:function getConsentState(){return a._Store.getConsentState(b)},/**
1567
1154
  * Sets the Consent State stored locally for this user.
1568
1155
  * @method setConsentState
1569
1156
  * @param {Object} consent state
1570
- */setConsentState:function setConsentState(r){t._Store.setConsentState(e,r),t._Forwarders.initForwarders(this.getUserIdentities().userIdentities,t._APIClient.prepareForwardingStats),t._CookieSyncManager.attemptCookieSync(this.getMPID());},isLoggedIn:function isLoggedIn(){return r},getLastSeenTime:function getLastSeenTime(){return t._Persistence.getLastSeenTime(e)},getFirstSeenTime:function getFirstSeenTime(){return t._Persistence.getFirstSeenTime(e)},/**
1157
+ */setConsentState:function setConsentState(c){a._Store.setConsentState(b,c),a._Forwarders.initForwarders(this.getUserIdentities().userIdentities,a._APIClient.prepareForwardingStats),a._CookieSyncManager.attemptCookieSync(this.getMPID());},isLoggedIn:function isLoggedIn(){return c},getLastSeenTime:function getLastSeenTime(){return a._Persistence.getLastSeenTime(b)},getFirstSeenTime:function getFirstSeenTime(){return a._Persistence.getFirstSeenTime(b)},/**
1571
1158
  * Get user audiences
1572
1159
  * @method getuserAudiences
1573
1160
  * @param {Function} [callback] A callback function that is invoked when the user audience request completes
1574
1161
  */ // https://go.mparticle.com/work/SQDSDKS-6436
1575
- getUserAudiences:function getUserAudiences(r){// user audience API is feature flagged
1576
- return t._Helpers.getFeatureFlag(FeatureFlags$1.AudienceAPI)?void(null===s.audienceManager&&(s.audienceManager=new AudienceManager(t._Store.SDKConfig.userAudienceUrl,t._Store.devToken,t.Logger,e)),s.audienceManager.sendGetUserAudienceRequest(e,r)):void t.Logger.error(ErrorMessages.AudienceAPINotEnabled)}}},this.mParticleUserCart=function(){return {/**
1162
+ getUserAudiences:function getUserAudiences(c){// user audience API is feature flagged
1163
+ return a._Helpers.getFeatureFlag(FeatureFlags$1.AudienceAPI)?void(null===e.audienceManager&&(e.audienceManager=new AudienceManager(a._Store.SDKConfig.userAudienceUrl,a._Store.devToken,a.Logger)),e.audienceManager.sendGetUserAudienceRequest(b,c)):void a.Logger.error(ErrorMessages.AudienceAPINotEnabled)}}},this.mParticleUserCart=function(){return {/**
1577
1164
  * Adds a cart product to the user cart
1578
1165
  * @method add
1579
1166
  * @deprecated
1580
- */add:function add(){logDeprecatedMethodUsage({methodName:"Identity.getCurrentUser().getCart().add()",warningMessage:generateDeprecationMessage("Identity.getCurrentUser().getCart().add()",!0,"eCommerce.logProductAction()","https://docs.mparticle.com/developers/sdk/web/commerce-tracking")},t.Logger,t._ErrorReportingDispatcher);},/**
1167
+ */add:function add(){logDeprecatedMethodUsage({methodName:"Identity.getCurrentUser().getCart().add()",warningMessage:generateDeprecationMessage("Identity.getCurrentUser().getCart().add()",!0,"eCommerce.logProductAction()","https://docs.mparticle.com/developers/sdk/web/commerce-tracking")},a.Logger,a._ErrorReportingDispatcher);},/**
1581
1168
  * Removes a cart product from the current user cart
1582
1169
  * @method remove
1583
1170
  * @deprecated
1584
- */remove:function remove(){logDeprecatedMethodUsage({methodName:"Identity.getCurrentUser().getCart().remove()",warningMessage:generateDeprecationMessage("Identity.getCurrentUser().getCart().remove()",!0,"eCommerce.logProductAction()","https://docs.mparticle.com/developers/sdk/web/commerce-tracking")},t.Logger,t._ErrorReportingDispatcher);},/**
1171
+ */remove:function remove(){logDeprecatedMethodUsage({methodName:"Identity.getCurrentUser().getCart().remove()",warningMessage:generateDeprecationMessage("Identity.getCurrentUser().getCart().remove()",!0,"eCommerce.logProductAction()","https://docs.mparticle.com/developers/sdk/web/commerce-tracking")},a.Logger,a._ErrorReportingDispatcher);},/**
1585
1172
  * Clears the user's cart
1586
1173
  * @method clear
1587
1174
  * @deprecated
1588
- */clear:function clear(){logDeprecatedMethodUsage({methodName:"Identity.getCurrentUser().getCart().clear()",warningMessage:generateDeprecationMessage("Identity.getCurrentUser().getCart().clear()",!0,"","https://docs.mparticle.com/developers/sdk/web/commerce-tracking")},t.Logger,t._ErrorReportingDispatcher);},/**
1175
+ */clear:function clear(){logDeprecatedMethodUsage({methodName:"Identity.getCurrentUser().getCart().clear()",warningMessage:generateDeprecationMessage("Identity.getCurrentUser().getCart().clear()",!0,"","https://docs.mparticle.com/developers/sdk/web/commerce-tracking")},a.Logger,a._ErrorReportingDispatcher);},/**
1589
1176
  * Returns all cart products
1590
1177
  * @method getCartProducts
1591
1178
  * @return {Array} array of cart products
1592
1179
  * @deprecated
1593
- */getCartProducts:function getCartProducts(){return logDeprecatedMethodUsage({methodName:"Identity.getCurrentUser().getCart().getCartProducts()",warningMessage:generateDeprecationMessage("Identity.getCurrentUser().getCart().getCartProducts()",!0,"eCommerce.logProductAction()","https://docs.mparticle.com/developers/sdk/web/commerce-tracking")},t.Logger,t._ErrorReportingDispatcher),[]}}},this.parseIdentityResponse=function(r,i,a,d,o,g,l){var u,p,y,I=t.Identity.getUser(i),c=I?I.getMPID():null,_=I?I.getUserIdentities().userIdentities:{},v={};t._Store.identityCallInFlight=!1;try{var m,b,S;if(t.Logger.verbose("Parsing \""+o+"\" identity response from server"),p=null!==(m=r.responseText)&&void 0!==m?m:null,t._Store.isLoggedIn=(null===(b=p)||void 0===b?void 0:b.is_logged_in)||!1,hasMPIDChanged(I,p)&&(t._Store.mpid=p.mpid,I&&t._Persistence.setLastSeenTime(i),u=!t._Persistence.getFirstSeenTime(p.mpid),t._Persistence.setFirstSeenTime(p.mpid)),r.status===HTTP_OK){var A;s(CacheIdentity)&&cacheOrClearIdCache(o,g,n.idCache,r,l);var U=n.IdentityAPI.getUser(p.mpid),C=U?U.getUserIdentities().userIdentities:{};o===Modify$1?(v=t._Identity.IdentityRequest.combineUserIdentities(_,d.userIdentities),t._Store.setUserIdentities(i,v)):(o===Identify&&I&&p.mpid===c&&t._Persistence.setFirstSeenTime(p.mpid),t._Store.addMpidToSessionHistory(p.mpid,i),t._CookieSyncManager.attemptCookieSync(p.mpid,u),t._Persistence.swapCurrentUser(i,p.mpid,t._Store.currentSessionMPIDs),d&&!isEmpty(d.userIdentities)&&(v=n.IdentityRequest.combineUserIdentities(C,d.userIdentities)),t._Store.setUserIdentities(p.mpid,v),t._Persistence.update(),t._Store.syncPersistenceData(),t._Persistence.findPrevCookiesBasedOnUI(d),t._Store.context=p.context||t._Store.context),y=t.Identity.getCurrentUser(),tryOnUserAlias(I,y,d,t.Logger,t._ErrorReportingDispatcher);var k=t._Persistence.getPersistence();y&&(t._Persistence.storeDataInMemory(k,y.getMPID()),n.reinitForwardersOnUserChange(I,y),n.setForwarderCallbacks(y,o));var P=IdentityType.getNewIdentitiesByName(v),f=o===Modify$1?_:C;// Sync $NoTargeting before sendUserIdentityChangeEvent
1180
+ */getCartProducts:function getCartProducts(){return logDeprecatedMethodUsage({methodName:"Identity.getCurrentUser().getCart().getCartProducts()",warningMessage:generateDeprecationMessage("Identity.getCurrentUser().getCart().getCartProducts()",!0,"eCommerce.logProductAction()","https://docs.mparticle.com/developers/sdk/web/commerce-tracking")},a.Logger,a._ErrorReportingDispatcher),[]}}},this.parseIdentityResponse=function(b,d,f,g,h,i,j){var k,l,m,n,o,p,q=a.Identity.getUser(d),r=q?q.getMPID():null,s=q?q.getUserIdentities().userIdentities:{},t={};a._Store.identityCallInFlight=!1;try{if(a.Logger.verbose("Parsing \""+h+"\" identity response from server"),o=null!==(k=b.responseText)&&void 0!==k?k:null,a._Store.isLoggedIn=(null===o||void 0===o?void 0:o.is_logged_in)||!1,hasMPIDChanged(q,o)&&(a._Store.mpid=o.mpid,q&&a._Persistence.setLastSeenTime(d),n=!a._Persistence.getFirstSeenTime(o.mpid),a._Persistence.setFirstSeenTime(o.mpid)),b.status===HTTP_OK){c(CacheIdentity)&&cacheOrClearIdCache(h,i,e.idCache,b,j);var u=e.IdentityAPI.getUser(o.mpid),v=u?u.getUserIdentities().userIdentities:{};h===Modify$1?(t=a._Identity.IdentityRequest.combineUserIdentities(s,g.userIdentities),a._Store.setUserIdentities(d,t)):(h===Identify&&q&&o.mpid===r&&a._Persistence.setFirstSeenTime(o.mpid),a._Store.addMpidToSessionHistory(o.mpid,d),a._CookieSyncManager.attemptCookieSync(o.mpid,n),a._Persistence.swapCurrentUser(d,o.mpid,a._Store.currentSessionMPIDs),g&&!isEmpty(g.userIdentities)&&(t=e.IdentityRequest.combineUserIdentities(v,g.userIdentities)),a._Store.setUserIdentities(o.mpid,t),a._Persistence.update(),a._Store.syncPersistenceData(),a._Persistence.findPrevCookiesBasedOnUI(g),a._Store.context=o.context||a._Store.context),p=a.Identity.getCurrentUser(),tryOnUserAlias(q,p,g,a.Logger,a._ErrorReportingDispatcher);var w=a._Persistence.getPersistence();p&&(a._Persistence.storeDataInMemory(w,p.getMPID()),e.reinitForwardersOnUserChange(q,p),e.setForwarderCallbacks(p,h));var x=IdentityType.getNewIdentitiesByName(t),y=h===Modify$1?s:v;// Sync $NoTargeting before sendUserIdentityChangeEvent
1594
1181
  // because UIC events call sendEventToServer which triggers
1595
1182
  // processQueuedEvents, draining the event queue. The
1596
1183
  // attribute must be in the store before that happens so
1597
1184
  // appendUserInfo picks it up.
1598
- null===(A=t._CookieConsentManager)||void 0===A||A.syncNoTargetingAttribute(y),n.sendUserIdentityChangeEvent(P,o,p.mpid,f);}if(a){var w=0===r.status?HTTPCodes$2.noHttpCoverage:r.status;t._Helpers.invokeCallback(a,w,p||null,y);}else p&&!isEmpty(p.errors)&&// https://go.mparticle.com/work/SQDSDKS-6500
1599
- t.Logger.error("Received HTTP response code of "+r.status+" - "+p.errors[0].message);t.Logger.verbose("Successfully parsed Identity Response"),null===(S=t._APIClient)||void 0===S||S.processQueuedEvents();}catch(s){a&&t._Helpers.invokeCallback(a,r.status,p||null),t.Logger.error("Error parsing JSON response from Identity server: "+s);}t._Store.isInitialized=!0,t._RoktManager.onIdentityComplete(),t._preInit.readyQueue=processReadyQueue(t._preInit.readyQueue,t.Logger);},this.sendUserIdentityChangeEvent=function(e,r,s,i){if(s||r===Modify$1)// https://go.mparticle.com/work/SQDSDKS-6501
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
1186
+ 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
1600
1187
  {// https://go.mparticle.com/work/SQDSDKS-6354
1601
- var a=this.IdentityAPI.getUser(s);for(var d in e)// Verifies a change actually happened
1602
- if(i[d]!==e[d]){var o,g=!i[d],l=n.createUserIdentityChange(d,e[d],i[d],g,a);// If a new identity type was introduced when the identity changes
1188
+ var h=this.IdentityAPI.getUser(d);for(var i in b)// Verifies a change actually happened
1189
+ if(f[i]!==b[i]){// If a new identity type was introduced when the identity changes
1603
1190
  // we need to notify the server so that the user profile is updated in
1604
1191
  // the mParticle UI.
1605
- null===(o=t._APIClient)||void 0===o||o.sendEventToServer(l);}}},this.createUserIdentityChange=function(e,r,s,i,n){var a;// https://go.mparticle.com/work/SQDSDKS-6439
1606
- return a=t._ServerModel.createEventObject({messageType:Types.MessageType.UserIdentityChange,userIdentityChanges:{New:{IdentityType:e,Identity:r,CreatedThisBatch:i},Old:{IdentityType:e,Identity:s,CreatedThisBatch:!1}},userInMemory:n}),a},this.sendUserAttributeChangeEvent=function(e,r,s,i,a,d){var o=n.createUserAttributeChange(e,r,s,i,a,d);if(o){var g;null===(g=t._APIClient)||void 0===g||g.sendEventToServer(o);}},this.createUserAttributeChange=function(e,r,s,i,n,a){"undefined"==typeof s&&(s=null);var d;return r!==s&&(d=t._ServerModel.createEventObject({messageType:Types.MessageType.UserAttributeChange,userAttributeChanges:{UserAttributeName:e,New:r,Old:s,Deleted:n,IsNewAttribute:i}},a)),d},this.reinitForwardersOnUserChange=function(e,r){if(hasMPIDAndUserLoginChanged(e,r)){var s;null===(s=t._Forwarders)||void 0===s||s.initForwarders(r.getUserIdentities().userIdentities,t._APIClient.prepareForwardingStats);}},this.setForwarderCallbacks=function(e,r){var s,i,n;// https://go.mparticle.com/work/SQDSDKS-6036
1607
- null===(s=t._Forwarders)||void 0===s||s.setForwarderUserIdentities(e.getUserIdentities().userIdentities),null===(i=t._Forwarders)||void 0===i||i.setForwarderOnIdentityComplete(e,r),null===(n=t._Forwarders)||void 0===n||n.setForwarderOnUserIdentified(e);};}// https://go.mparticle.com/work/SQDSDKS-6359
1608
- function tryOnUserAlias(e,t,r,s,i){if(r&&r.onUserAlias&&isFunction(r.onUserAlias))try{logDeprecatedMethodUsage({methodName:"onUserAlias",warningMessage:generateDeprecationMessage("onUserAlias")},s,i),r.onUserAlias(e,t);}catch(t){s.error("There was an error with your onUserAlias function - "+t);}}
1192
+ var j=!f[i],k=e.createUserIdentityChange(i,b[i],f[i],j,h);null===(g=a._APIClient)||void 0===g?void 0:g.sendEventToServer(k);}}},this.createUserIdentityChange=function(b,c,d,e,f){var g;// https://go.mparticle.com/work/SQDSDKS-6439
1193
+ return g=a._ServerModel.createEventObject({messageType:Types.MessageType.UserIdentityChange,userIdentityChanges:{New:{IdentityType:b,Identity:c,CreatedThisBatch:e},Old:{IdentityType:b,Identity:d,CreatedThisBatch:!1}},userInMemory:f}),g},this.sendUserAttributeChangeEvent=function(b,c,d,f,g,h){var i,j=e.createUserAttributeChange(b,c,d,f,g,h);j&&(null===(i=a._APIClient)||void 0===i?void 0:i.sendEventToServer(j));},this.createUserAttributeChange=function(b,c,d,e,f,g){"undefined"==typeof d&&(d=null);var h;return c!==d&&(h=a._ServerModel.createEventObject({messageType:Types.MessageType.UserAttributeChange,userAttributeChanges:{UserAttributeName:b,New:c,Old:d,Deleted:f,IsNewAttribute:e}},g)),h},this.reinitForwardersOnUserChange=function(b,c){var d;hasMPIDAndUserLoginChanged(b,c)&&(null===(d=a._Forwarders)||void 0===d?void 0:d.initForwarders(c.getUserIdentities().userIdentities,a._APIClient.prepareForwardingStats));},this.setForwarderCallbacks=function(b,c){var d,e,f;// https://go.mparticle.com/work/SQDSDKS-6036
1194
+ null===(d=a._Forwarders)||void 0===d?void 0:d.setForwarderUserIdentities(b.getUserIdentities().userIdentities),null===(e=a._Forwarders)||void 0===e?void 0:e.setForwarderOnIdentityComplete(b,c),null===(f=a._Forwarders)||void 0===f?void 0:f.setForwarderOnUserIdentified(b);};}// https://go.mparticle.com/work/SQDSDKS-6359
1195
+ function tryOnUserAlias(a,b,c,d,e){if(c&&c.onUserAlias&&isFunction(c.onUserAlias))try{logDeprecatedMethodUsage({methodName:"onUserAlias",warningMessage:generateDeprecationMessage("onUserAlias")},d,e),c.onUserAlias(a,b);}catch(a){d.error("There was an error with your onUserAlias function - "+a);}}
1609
1196
 
1610
1197
  var CCPAPurpose=Constants.CCPAPurpose;function Consent(a){var b=this;// this function is called when consent is required to
1611
1198
  // determine if a cookie sync should happen, or a
@@ -1687,7 +1274,7 @@ if(v=null===(u=null===(t=null===(s=null===(r=null===(q=null===(p=null===(o=null=
1687
1274
  then remove it from event.UserAttributes as it is blocked
1688
1275
  */var c=this.dataPlanMatchLookups.user_attributes;if(this.mpInstance._Helpers.isObject(c))for(var d,e=0,f=Object.keys(b.UserAttributes);e<f.length;e++)d=f[e],c[d]||delete b.UserAttributes[d];}return b},a.prototype.isAttributeKeyBlocked=function(a){/* used when an attribute is added to the user */if(!this.blockUserAttributes)return !1;var b=this.dataPlanMatchLookups.user_attributes;// When additionalProperties is set to true, matchedAttributes
1689
1276
  // will be a boolean, otherwise it will return an object
1690
- return !("boolean"==typeof b&&b)&&"object"===_typeof$1(b)&&!0!==b[a];// When "Block unplanned user attributes" is enabled and "Allow unplanned user
1277
+ return !("boolean"==typeof b&&b)&&"object"===_typeof(b)&&!0!==b[a];// When "Block unplanned user attributes" is enabled and "Allow unplanned user
1691
1278
  // attributes" is also enabled in the UI, allowing unplanned user attributes will be prioritized
1692
1279
  },a.prototype.isIdentityBlocked=function(a){/* used when an attribute is added to the user */if(!this.blockUserIdentities)return !1;if(this.blockUserIdentities){var b=this.dataPlanMatchLookups.user_identities;if(!0===b)return !1;if(!b[a])return !0}else return !1;return !1},a.prototype.transformUserIdentities=function(a){var b,c=this,d=__assign({},a);/*
1693
1280
  If the user identity is not found in matchedIdentities
@@ -1752,7 +1339,7 @@ var s=(null===f||void 0===f?void 0:f.sandbox)||!1,t=normalizeRoktLauncherOptions
1752
1339
  // to the Rokt Launcher.
1753
1340
  this.launcherOptions=__assign({sandbox:s},t),(null===f||void 0===f?void 0:f.domain)&&(this.domain=f.domain),this.initialized=!0;},Object.defineProperty(a.prototype,"isInitialized",{get:function get(){return this.initialized},enumerable:!1,configurable:!0}),a.prototype.attachKit=function(a){var b,c,d,f;this.kit=a,(null===(b=a.settings)||void 0===b?void 0:b.accountId)&&this.store.setRoktAccountId(a.settings.accountId),a.integrationName&&(null===(c=this.store)||void 0===c?void 0:c.setIntegrationName(a.integrationName)),this.processMessageQueue();try{null===(d=this.onReadyCallback)||void 0===d?void 0:d.call(this);}catch(a){null===(f=this.logger)||void 0===f?void 0:f.error("RoktManager: Error in onReadyCallback: "+a);}},a.prototype.selectPlacements=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q;return __awaiter(this,void 0,void 0,function(){var r,s,t,u,v,w,x,y,z,A,B,C,D,E,E,F,G,H,I,J,K,L,M,N=this;return __generator(this,function(){// Queue if kit isn't ready OR if identity is in flight
1754
1341
  if(null===(b=this.captureTiming)||void 0===b?void 0:b.call(this,PerformanceMarkType.JointSdkSelectPlacements),!this.isReady()||(null===(c=this.store)||void 0===c?void 0:c.identityCallInFlight))return [2/*return*/,this.deferredCall("selectPlacements",a)];try{if(r=a.attributes,s=(null===r||void 0===r?void 0:r.sandbox)||null,t=this.mapPlacementAttributes(r,this.placementAttributesMapping),(null===(d=this.logger)||void 0===d?void 0:d.isVerbose())&&(u=obfuscateDevData(r,null===(f=null===(e=this.store)||void 0===e?void 0:e.SDKConfig)||void 0===f?void 0:f.isDevelopmentMode),this.logger.verbose("mParticle.Rokt selectPlacements called with attributes:\n".concat(JSON.stringify(u,null,2)))),this.currentUser=this.identityService.getCurrentUser(),v=(null===(h=null===(g=this.currentUser)||void 0===g?void 0:g.getUserIdentities())||void 0===h?void 0:h.userIdentities)||{},w=v.email,x=t.email,y=void 0,z=void 0,A=this.mappedEmailShaIdentityType&&!1!==IdentityType.getIdentityType(this.mappedEmailShaIdentityType),A&&(y=v[this.mappedEmailShaIdentityType],z=t.emailsha256||t[this.mappedEmailShaIdentityType]||void 0),B=this.hasIdentityChanged(w,x),C=this.hasIdentityChanged(y,z),D={},B&&(D.email=x,x&&(E="Email mismatch detected. Current email differs from email passed to selectPlacements call. Proceeding to call identify with email from selectPlacements call. Please verify your implementation.",this.logger.warning(E),null===(i=this.errorReporter)||void 0===i?void 0:i.report({message:E,code:ErrorCodes.IDENTITY_MISMATCH,severity:WSDKErrorSeverity.WARNING}))),C&&(D[this.mappedEmailShaIdentityType]=z,E="emailsha256 mismatch detected. Current mParticle hashedEmail differs from hashedEmail passed to selectPlacements call. Proceeding to call identify with hashedEmail from selectPlacements call. Please verify your implementation.",this.logger.warning(E),null===(j=this.errorReporter)||void 0===j?void 0:j.report({message:E,code:ErrorCodes.IDENTITY_MISMATCH,severity:WSDKErrorSeverity.WARNING})),!isEmpty(D))// Fire-and-forget identify — best-effort, does not block selectPlacements
1755
- try{this.identityService.identify({userIdentities:__assign(__assign({},v),D)},function(a){var b=+(null===a||void 0===a?void 0:a.httpCode);b&&(400<=b||0>b)&&N.logger.error("Background identify failed with HTTP "+b),N.processMessageQueue();});}catch(a){this.logger.error("Background identify threw an error: "+getErrorMessage(a));}return F=__assign(__assign({},v),D),this.setUserAttributes(t),G=null===(l=null===(k=this.store)||void 0===k?void 0:k.getTimeOnSite)||void 0===l?void 0:l.call(k),H=null===(n=null===(m=this.store)||void 0===m?void 0:m.getTotalTimeOnSite)||void 0===n?void 0:n.call(m),I=__assign(__assign(__assign(__assign({},t),null===s?{}:{sandbox:s}),G?{active_time_on_site_ms:G}:{}),H?{total_time_on_site_ms:H}:{}),F.email&&!I.email&&(I.email=F.email),A&&(J=F[this.mappedEmailShaIdentityType],J&&!I.emailsha256&&!I[this.mappedEmailShaIdentityType]&&(I.emailsha256=J)),I[PASSBACK_CONVERSION_TRACKING_ID]||(null===(o=this.integrationCapture)||void 0===o?void 0:o.capture(),K=null===(p=this.integrationCapture)||void 0===p?void 0:p.getClickIdsAsIntegrationAttributes(),L=null===(q=null===K||void 0===K?void 0:K[PARTNER_MODULE_IDS.Rokt])||void 0===q?void 0:q[PASSBACK_CONVERSION_TRACKING_ID],L&&(I[PASSBACK_CONVERSION_TRACKING_ID]=L)),this.filters.filteredUser=this.currentUser||this.filters.filteredUser||null,M=__assign(__assign({},a),{attributes:I}),[2/*return*/,this.kit.selectPlacements(M)]}catch(a){return [2/*return*/,Promise.reject(a instanceof Error?a:new Error("Unknown error occurred"))]}return [2/*return*/]})})},a.prototype.hashAttributes=function(a){return __awaiter(this,void 0,void 0,function(){var b,c,d,e,f,g,h,i,j,k,l,m=this;return __generator(this,function(n){switch(n.label){case 0:return (n.trys.push([0,2,,3]),!a||"object"!==_typeof$1(a))?[2/*return*/,{}]:(b=Object.keys(a),0===b.length)?[2/*return*/,{}]:(c=b.map(function(b){return __awaiter(m,void 0,void 0,function(){var c,d;return __generator(this,function(e){switch(e.label){case 0:return c=a[b],[4/*yield*/,this.hashSha256(c)];case 1:return d=e.sent(),[2/*return*/,{key:b,attributeValue:c,hashedValue:d}]}})})}),[4/*yield*/,Promise.all(c)]);case 1:for(d=n.sent(),e={},(f=0,g=d);f<g.length;f++)h=g[f],i=h.key,j=h.attributeValue,k=h.hashedValue,e[i]=j,k&&(e["".concat(i,"sha256")]=k);return [2/*return*/,e];case 2:return l=n.sent(),this.logger.error("Failed to hashAttributes, returning an empty object: ".concat(getErrorMessage(l))),[2/*return*/,{}];case 3:return [2/*return*/]}})})},a.prototype.setExtensionData=function(a){if(!this.isReady())return void this.deferredCall("setExtensionData",a);try{this.kit.setExtensionData(a);}catch(a){throw new Error("Error setting extension data: "+getErrorMessage(a))}},a.prototype.use=function(a){if(!this.isReady())return this.deferredCall("use",a);try{return this.kit.use(a)}catch(b){return Promise.reject(b instanceof Error?b:new Error("Error using extension: "+a))}},a.prototype.onShoppableAdsReady=function(a){if(!this.kit||!this.isShoppableAdsLoaded)return void this.deferredCall("onShoppableAdsReady",a);try{this.kit.onShoppableAdsReady(a);}catch(a){this.logger.error("Failed to register onShoppableAdsReady callback: ".concat(getErrorMessage(a)));}},a.prototype.flushOnShoppableAdsReadyMessageQueue=function(a){var b=this;this.kit=a,this.messageQueue.forEach(function(c,d){var f;if(c.methodName===ON_SHOPPABLE_ADS_READY_METHOD){try{a.onShoppableAdsReady(c.payload);}catch(a){null===(f=b.logger)||void 0===f?void 0:f.error("RoktManager: Error flushing onShoppableAdsReady: "+a);}b.messageQueue["delete"](d);}}),this.isShoppableAdsLoaded=!0;},a.prototype.hashSha256=function(a){return __awaiter(this,void 0,void 0,function(){var b,c;return __generator(this,function(d){switch(d.label){case 0:if(null===a||void 0===a)return this.logger.warning("hashSha256 received null/undefined as input"),[2/*return*/,a];d.label=1;case 1:return d.trys.push([1,3,,4]),b=(a+"").trim().toLocaleLowerCase(),[4/*yield*/,this.sha256Hex(b)];case 2:return [2/*return*/,d.sent()];case 3:return c=d.sent(),this.logger.error("Failed to hashSha256, returning undefined: ".concat(getErrorMessage(c))),[2/*return*/,void 0];case 4:return [2/*return*/]}})})},a.prototype.getLocalSessionAttributes=function(){return this.store.getLocalSessionAttributes()},a.prototype.setLocalSessionAttribute=function(a,b){this.store.setLocalSessionAttribute(a,b);},a.prototype.isReady=function(){// The Rokt Manager is ready when a kit is attached and has a launcher
1342
+ try{this.identityService.identify({userIdentities:__assign(__assign({},v),D)},function(a){var b=+(null===a||void 0===a?void 0:a.httpCode);b&&(400<=b||0>b)&&N.logger.error("Background identify failed with HTTP "+b),N.processMessageQueue();});}catch(a){this.logger.error("Background identify threw an error: "+getErrorMessage(a));}return F=__assign(__assign({},v),D),this.setUserAttributes(t),G=null===(l=null===(k=this.store)||void 0===k?void 0:k.getTimeOnSite)||void 0===l?void 0:l.call(k),H=null===(n=null===(m=this.store)||void 0===m?void 0:m.getTotalTimeOnSite)||void 0===n?void 0:n.call(m),I=__assign(__assign(__assign(__assign({},t),null===s?{}:{sandbox:s}),G?{active_time_on_site_ms:G}:{}),H?{total_time_on_site_ms:H}:{}),F.email&&!I.email&&(I.email=F.email),A&&(J=F[this.mappedEmailShaIdentityType],J&&!I.emailsha256&&!I[this.mappedEmailShaIdentityType]&&(I.emailsha256=J)),I[PASSBACK_CONVERSION_TRACKING_ID]||(null===(o=this.integrationCapture)||void 0===o?void 0:o.capture(),K=null===(p=this.integrationCapture)||void 0===p?void 0:p.getClickIdsAsIntegrationAttributes(),L=null===(q=null===K||void 0===K?void 0:K[PARTNER_MODULE_IDS.Rokt])||void 0===q?void 0:q[PASSBACK_CONVERSION_TRACKING_ID],L&&(I[PASSBACK_CONVERSION_TRACKING_ID]=L)),this.filters.filteredUser=this.currentUser||this.filters.filteredUser||null,M=__assign(__assign({},a),{attributes:I}),[2/*return*/,this.kit.selectPlacements(M)]}catch(a){return [2/*return*/,Promise.reject(a instanceof Error?a:new Error("Unknown error occurred"))]}return [2/*return*/]})})},a.prototype.hashAttributes=function(a){return __awaiter(this,void 0,void 0,function(){var b,c,d,e,f,g,h,i,j,k,l,m=this;return __generator(this,function(n){switch(n.label){case 0:return (n.trys.push([0,2,,3]),!a||"object"!==_typeof(a))?[2/*return*/,{}]:(b=Object.keys(a),0===b.length)?[2/*return*/,{}]:(c=b.map(function(b){return __awaiter(m,void 0,void 0,function(){var c,d;return __generator(this,function(e){switch(e.label){case 0:return c=a[b],[4/*yield*/,this.hashSha256(c)];case 1:return d=e.sent(),[2/*return*/,{key:b,attributeValue:c,hashedValue:d}]}})})}),[4/*yield*/,Promise.all(c)]);case 1:for(d=n.sent(),e={},(f=0,g=d);f<g.length;f++)h=g[f],i=h.key,j=h.attributeValue,k=h.hashedValue,e[i]=j,k&&(e["".concat(i,"sha256")]=k);return [2/*return*/,e];case 2:return l=n.sent(),this.logger.error("Failed to hashAttributes, returning an empty object: ".concat(getErrorMessage(l))),[2/*return*/,{}];case 3:return [2/*return*/]}})})},a.prototype.setExtensionData=function(a){if(!this.isReady())return void this.deferredCall("setExtensionData",a);try{this.kit.setExtensionData(a);}catch(a){throw new Error("Error setting extension data: "+getErrorMessage(a))}},a.prototype.use=function(a){if(!this.isReady())return this.deferredCall("use",a);try{return this.kit.use(a)}catch(b){return Promise.reject(b instanceof Error?b:new Error("Error using extension: "+a))}},a.prototype.terminate=function(){var a,b,c;return __awaiter(this,void 0,void 0,function(){var d;return __generator(this,function(e){switch(e.label){case 0:if(!this.isReady())return null===(a=this.logger)||void 0===a?void 0:a.verbose("mParticle.Rokt.terminate called before the Rokt kit was ready. Nothing to terminate."),[2/*return*/];if(!isFunction(this.kit.terminate))return null===(b=this.logger)||void 0===b?void 0:b.error("mParticle.Rokt.terminate is not supported by the attached Rokt Kit version."),[2/*return*/];e.label=1;case 1:return e.trys.push([1,3,,4]),[4/*yield*/,this.kit.terminate()];case 2:return e.sent(),[3/*break*/,4];case 3:return d=e.sent(),null===(c=this.logger)||void 0===c?void 0:c.error("Failed to terminate the Rokt launcher: ".concat(getErrorMessage(d))),[3/*break*/,4];case 4:return [2/*return*/]}})})},a.prototype.onShoppableAdsReady=function(a){if(!this.kit||!this.isShoppableAdsLoaded)return void this.deferredCall("onShoppableAdsReady",a);try{this.kit.onShoppableAdsReady(a);}catch(a){this.logger.error("Failed to register onShoppableAdsReady callback: ".concat(getErrorMessage(a)));}},a.prototype.flushOnShoppableAdsReadyMessageQueue=function(a){var b=this;this.kit=a,this.messageQueue.forEach(function(c,d){var f;if(c.methodName===ON_SHOPPABLE_ADS_READY_METHOD){try{a.onShoppableAdsReady(c.payload);}catch(a){null===(f=b.logger)||void 0===f?void 0:f.error("RoktManager: Error flushing onShoppableAdsReady: "+a);}b.messageQueue["delete"](d);}}),this.isShoppableAdsLoaded=!0;},a.prototype.hashSha256=function(a){return __awaiter(this,void 0,void 0,function(){var b,c;return __generator(this,function(d){switch(d.label){case 0:if(null===a||void 0===a)return this.logger.warning("hashSha256 received null/undefined as input"),[2/*return*/,a];d.label=1;case 1:return d.trys.push([1,3,,4]),b=(a+"").trim().toLocaleLowerCase(),[4/*yield*/,this.sha256Hex(b)];case 2:return [2/*return*/,d.sent()];case 3:return c=d.sent(),this.logger.error("Failed to hashSha256, returning undefined: ".concat(getErrorMessage(c))),[2/*return*/,void 0];case 4:return [2/*return*/]}})})},a.prototype.getLocalSessionAttributes=function(){return this.store.getLocalSessionAttributes()},a.prototype.setLocalSessionAttribute=function(a,b){this.store.setLocalSessionAttribute(a,b);},a.prototype.isReady=function(){// The Rokt Manager is ready when a kit is attached and has a launcher
1756
1343
  return !!(this.kit&&this.kit.launcher)},a.prototype.setUserAttributes=function(a){var b=["sandbox"],c={};for(var d in a)if(a.hasOwnProperty(d)&&-1===b.indexOf(d)){var e=a[d];c[d]=Array.isArray(e)?JSON.stringify(e):e;}try{this.currentUser.setUserAttributes(c);}catch(a){this.logger.error("Error setting user attributes: "+a);}},a.prototype.mapPlacementAttributes=function(a,b){for(var c,d={},e=0,f=b;e<f.length;e++)c=f[e],d[c.map]=c.value;var g={};for(var h in a)if(a.hasOwnProperty(h)){var i=d[h]||h;g[i]=a[h];}return g},a.prototype.onIdentityComplete=function(){this.isReady()&&(this.currentUser=this.identityService.getCurrentUser(),this.processMessageQueue());},a.prototype.processMessageQueue=function(){var a,b=this;if(this.isReady()&&0!==this.messageQueue.size){null===(a=this.logger)||void 0===a?void 0:a.verbose("RoktManager: Processing ".concat(this.messageQueue.size," queued messages"));var c=Array.from(this.messageQueue.values());// Clear the queue immediately to prevent re-processing
1757
1344
  this.messageQueue.clear(),c.forEach(function(a){var c,d,e,f;if(!(a.methodName in b)||!isFunction(b[a.methodName]))return void(null===(c=b.logger)||void 0===c?void 0:c.error("RoktManager: Method ".concat(a.methodName," not found")));if(null===(d=b.logger)||void 0===d?void 0:d.isVerbose()){var g=obfuscateDevData(a.payload,null===(f=null===(e=b.store)||void 0===e?void 0:e.SDKConfig)||void 0===f?void 0:f.isDevelopmentMode);b.logger.verbose("RoktManager: Processing queued message: ".concat(a.methodName," with payload: ").concat(JSON.stringify(g)));}// Capture resolve/reject functions before async processing
1758
1345
  var h=a.resolve,i=a.reject,j=function(c){var d;null===(d=b.logger)||void 0===d?void 0:d.error("RoktManager: Error processing message '".concat(a.methodName,"': ").concat(getErrorMessage(c))),i&&i(c);};try{var k=b[a.methodName](a.payload);// Handle both sync and async methods
@@ -1792,7 +1379,7 @@ this._instanceName=a,this._NativeSdkHelpers=new NativeSdkHelpers(this),this._Ses
1792
1379
  // Since fetching the configuration is asynchronous, we must pass completeSDKInitialization
1793
1380
  // to it for it to be run after fetched
1794
1381
  if(b||console.warn("You did not pass a config object to init(). mParticle will not initialize properly"),runPreConfigFetchInitialization(this,a,b),!b)return void console.error("No config available on the window, please pass a config object to mParticle.init()");if(!b.hasOwnProperty("requestConfig")||b.requestConfig){var d=new ConfigAPIClient(a,b,this);d.getSDKConfiguration().then(function(d){var e=extend({},b,d);completeSDKInitialization(a,e,c);});}else completeSDKInitialization(a,b,this);},this.setLogLevel=function(a){b.Logger.setLogLevel(a);},this.reset=function(a){try{a._Persistence.resetPersistence(),a._Store&&delete a._Store;}catch(a){console.error("Cannot reset mParticle",a);}},this._resetForTests=function(a,b,c){c._Store&&delete c._Store,c._ErrorReportingDispatcher=new ErrorReportingDispatcher,c._LoggingDispatcher=new LoggingDispatcher,c.Logger=new Logger(a),c._ErrorReportingDispatcher.logger=c.Logger,c._LoggingDispatcher.logger=c.Logger,c._Store=new Store(a,c),c._Store.isLocalStorageAvailable=c._Persistence.determineLocalStorageAvailability(window.localStorage),c._Events.stopTracking(),resetPageViewTracking(),c._PageViewTracker=void 0,b||c._Persistence.resetPersistence(),c._Persistence.forwardingStatsBatches.uploadsTable={},c._Persistence.forwardingStatsBatches.forwardingStatsEventQueue=[],c._preInit={readyQueue:[],pixelConfigurations:[],integrationDelays:{},forwarderConstructors:[],isDevelopmentMode:!1};},this.ready=function(a){var c,d,e,f=(null===(c=b._CookieConsentManager)||void 0===c?void 0:c.getNoFunctional())&&!hasExplicitIdentifier(b._Store),g=isFunction(a)&&((null===(d=b._Store)||void 0===d?void 0:d.isInitialized)||(null===(e=b._Store)||void 0===e?void 0:e.identityCallFailed)&&b._RoktManager.isReady()||f);g?a():b._preInit.readyQueue.push(a);},this.getEnvironment=function(){return b._Store.SDKConfig.isDevelopmentMode?Constants.Environment.Development:Constants.Environment.Production},this.getVersion=function(){return Constants.sdkVersion},this.setAppVersion=function(a){var c=queueIfNotInitialized(function(){b.setAppVersion(a);},b);c||(b._Store.SDKConfig.appVersion=a,b._Persistence.update());},this.setDeviceId=function(a){var c=queueIfNotInitialized(function(){b.setDeviceId(a);},b);c||this._Store.setDeviceId(a);},this.isInitialized=function(){return !!b._Store&&b._Store.isInitialized},this.getAppName=function(){return b._Store.SDKConfig.appName},this.setAppName=function(a){var c=queueIfNotInitialized(function(){b.setAppName(a);},b);c||(b._Store.SDKConfig.appName=a);},this.getAppVersion=function(){return b._Store.SDKConfig.appVersion},this.stopTrackingLocation=function(){b._SessionManager.resetSessionTimer(),b._Events.stopTracking();},this.startTrackingLocation=function(a){isFunction(a)||b.Logger.warning("Warning: Location tracking is triggered, but not including a callback into the `startTrackingLocation` may result in events logged too quickly and not being associated with a location."),b._SessionManager.resetSessionTimer(),b._Events.startTracking(a);},this.setPosition=function(a,c){var d=queueIfNotInitialized(function(){b.setPosition(a,c);},b);d||(b._SessionManager.resetSessionTimer(),"number"==typeof a&&"number"==typeof c?b._Store.currentPosition={lat:a,lng:c}:b.Logger.error("Position latitude and/or longitude must both be of type number"));},this.startNewSession=function(){b._SessionManager.startNewSession();},this.endSession=function(){// Sends true as an over ride vs when endSession is called from the setInterval
1795
- b._SessionManager.endSession(!0);},this.logBaseEvent=function(a,c){var d=queueIfNotInitialized(function(){b.logBaseEvent(a,c);},b);if(!d)return (b._SessionManager.resetSessionTimer(),"string"!=typeof a.name)?void b.Logger.error(Messages.ErrorMessages.EventNameInvalidType):(a.eventType||(a.eventType=EventType.Unknown),b._Helpers.canLog()?void b._Events.logEvent(a,c):void b.Logger.error(Messages.ErrorMessages.LoggingDisabled))},this.logEvent=function(a,c,d,e,f){var g=queueIfNotInitialized(function(){b.logEvent(a,c,d,e,f);},b);if(!g)return (b._SessionManager.resetSessionTimer(),"string"!=typeof a)?void b.Logger.error(Messages.ErrorMessages.EventNameInvalidType):(c||(c=EventType.Unknown),b._Helpers.isEventType(c)?b._Helpers.canLog()?void b._Events.logEvent({messageType:MessageType$1.PageEvent,name:a,data:d,eventType:c,customFlags:e},f):void b.Logger.error(Messages.ErrorMessages.LoggingDisabled):void b.Logger.error("Invalid event type: "+c+", must be one of: \n"+JSON.stringify(EventType)))},this.logError=function(a,c){var d=queueIfNotInitialized(function(){b.logError(a,c);},b);if(!d&&(b._SessionManager.resetSessionTimer(),!!a)){"string"==typeof a&&(a={message:a});var e={m:a.message?a.message:a,s:"Error",t:a.stack||null};if(c){var f=b._Helpers.sanitizeAttributes(c,e.m);for(var g in f)e[g]=f[g];}b._Events.logEvent({messageType:MessageType$1.CrashReport,name:a.name?a.name:"Error",eventType:EventType.Other,data:e});}},this.logLink=function(a,c,d,e){b._Events.addEventHandler("click",a,c,e,d);},this.logForm=function(a,c,d,e){b._Events.addEventHandler("submit",a,c,e,d);},this.logPageView=function(a,c,d,e){var f=queueIfNotInitialized(function(){b.logPageView(a,c,d,e);},b);if(!f){if(b._SessionManager.resetSessionTimer(),b._Helpers.canLog()){if(b._Helpers.Validators.isStringOrNumber(a)||(a="PageView"),!c)c={hostname:window.location.hostname,title:window.document.title};else if(!b._Helpers.isObject(c))return void b.Logger.error("The attributes argument must be an object. A "+_typeof$1(c)+" was entered. Please correct and retry.");if(d&&!b._Helpers.isObject(d))return void b.Logger.error("The customFlags argument must be an object. A "+_typeof$1(d)+" was entered. Please correct and retry.")}b._Events.logEvent({messageType:MessageType$1.PageView,name:a,data:c,eventType:EventType.Unknown,customFlags:d},e);}},this.upload=function(){var a,c;b._Helpers.canLog()&&(b._Store.webviewBridgeEnabled?b._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Upload):null===(c=null===(a=b._APIClient)||void 0===a?void 0:a.uploader)||void 0===c?void 0:c.prepareAndUpload(!1,!1));},this.Consent={/**
1382
+ b._SessionManager.endSession(!0);},this.logBaseEvent=function(a,c){var d=queueIfNotInitialized(function(){b.logBaseEvent(a,c);},b);if(!d)return (b._SessionManager.resetSessionTimer(),"string"!=typeof a.name)?void b.Logger.error(Messages.ErrorMessages.EventNameInvalidType):(a.eventType||(a.eventType=EventType.Unknown),b._Helpers.canLog()?void b._Events.logEvent(a,c):void b.Logger.error(Messages.ErrorMessages.LoggingDisabled))},this.logEvent=function(a,c,d,e,f){var g=queueIfNotInitialized(function(){b.logEvent(a,c,d,e,f);},b);if(!g)return (b._SessionManager.resetSessionTimer(),"string"!=typeof a)?void b.Logger.error(Messages.ErrorMessages.EventNameInvalidType):(c||(c=EventType.Unknown),b._Helpers.isEventType(c)?b._Helpers.canLog()?void b._Events.logEvent({messageType:MessageType$1.PageEvent,name:a,data:d,eventType:c,customFlags:e},f):void b.Logger.error(Messages.ErrorMessages.LoggingDisabled):void b.Logger.error("Invalid event type: "+c+", must be one of: \n"+JSON.stringify(EventType)))},this.logError=function(a,c){var d=queueIfNotInitialized(function(){b.logError(a,c);},b);if(!d&&(b._SessionManager.resetSessionTimer(),!!a)){"string"==typeof a&&(a={message:a});var e={m:a.message?a.message:a,s:"Error",t:a.stack||null};if(c){var f=b._Helpers.sanitizeAttributes(c,e.m);for(var g in f)e[g]=f[g];}b._Events.logEvent({messageType:MessageType$1.CrashReport,name:a.name?a.name:"Error",eventType:EventType.Other,data:e});}},this.logLink=function(a,c,d,e){b._Events.addEventHandler("click",a,c,e,d);},this.logForm=function(a,c,d,e){b._Events.addEventHandler("submit",a,c,e,d);},this.logPageView=function(a,c,d,e){var f=queueIfNotInitialized(function(){b.logPageView(a,c,d,e);},b);if(!f){if(b._SessionManager.resetSessionTimer(),b._Helpers.canLog()){if(b._Helpers.Validators.isStringOrNumber(a)||(a="PageView"),!c)c={hostname:window.location.hostname,title:window.document.title};else if(!b._Helpers.isObject(c))return void b.Logger.error("The attributes argument must be an object. A "+_typeof(c)+" was entered. Please correct and retry.");if(d&&!b._Helpers.isObject(d))return void b.Logger.error("The customFlags argument must be an object. A "+_typeof(d)+" was entered. Please correct and retry.")}b._Events.logEvent({messageType:MessageType$1.PageView,name:a,data:c,eventType:EventType.Unknown,customFlags:d},e);}},this.upload=function(){var a,c;b._Helpers.canLog()&&(b._Store.webviewBridgeEnabled?b._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Upload):null===(c=null===(a=b._APIClient)||void 0===a?void 0:a.uploader)||void 0===c?void 0:c.prepareAndUpload(!1,!1));},this.Consent={/**
1796
1383
  * Creates a CCPA Opt Out Consent State.
1797
1384
  *
1798
1385
  * @method createCCPAConsent
@@ -1940,7 +1527,7 @@ b._SessionManager.endSession(!0);},this.logBaseEvent=function(a,c){var d=queueIf
1940
1527
  */logRefund:function logRefund(a,c,d,e,f){return logDeprecatedMethodUsage({methodName:"mParticle.logRefund",warningMessage:"mParticle.logRefund is deprecated, please use mParticle.logProductAction instead"},b.Logger,b._ErrorReportingDispatcher),b._Store.isInitialized?void(b._SessionManager.resetSessionTimer(),b._Events.logRefundEvent(a,c,e,f)):void b.ready(function(){b.eCommerce.logRefund(a,c,d,e,f);})},expandCommerceEvent:function expandCommerceEvent(a){return b._Ecommerce.expandCommerceEvent(a)}},this.setSessionAttribute=function(a,c){var d,e=(null===(d=b._CookieConsentManager)||void 0===d?void 0:d.getNoFunctional())&&!hasExplicitIdentifier(b._Store);if(!e){var f=queueIfNotInitialized(function(){b.setSessionAttribute(a,c);},b);if(f)return}// Logs to cookie
1941
1528
  // And logs to in-memory object
1942
1529
  // Example: mParticle.setSessionAttribute('location', '33431');
1943
- if(b._Helpers.canLog()){if(!b._Helpers.Validators.isValidAttributeValue(c))return void b.Logger.error(Messages.ErrorMessages.BadAttribute);if(!b._Helpers.Validators.isValidKeyValue(a))return void b.Logger.error(Messages.ErrorMessages.BadKey);if(b._Store.webviewBridgeEnabled)b._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.SetSessionAttribute,JSON.stringify({key:a,value:c}));else {var g=b._Helpers.findKeyInObject(b._Store.sessionAttributes,a);g&&(a=g),b._Store.sessionAttributes[a]=c,b._Persistence.update(),b._Forwarders.applyToForwarders("setSessionAttribute",[a,c]);}}},this.setOptOut=function(a){var c=queueIfNotInitialized(function(){b.setOptOut(a);},b);c||(b._SessionManager.resetSessionTimer(),b._Store.isEnabled=!a,b._Events.logOptOut(),b._Persistence.update(),b._Store.activeForwarders.length&&b._Store.activeForwarders.forEach(function(c){if(c.setOptOut){var d=c.setOptOut(a);d&&b.Logger.verbose(d);}}));},this.setIntegrationAttribute=function(a,c){var d=queueIfNotInitialized(function(){b.setIntegrationAttribute(a,c);},b);if(!d){if("number"!=typeof a)return void b.Logger.error("integrationId must be a number");if(null===c)b._Store.integrationAttributes[a]={};else {if(!b._Helpers.isObject(c))return void b.Logger.error("Attrs must be an object with keys and values. You entered a "+_typeof$1(c));if(0===Object.keys(c).length)b._Store.integrationAttributes[a]={};else for(var e in c)if("string"!=typeof e){b.Logger.error("Keys must be strings, you entered a "+_typeof$1(e));continue}else if("string"==typeof c[e])b._Helpers.isObject(b._Store.integrationAttributes[a])?b._Store.integrationAttributes[a][e]=c[e]:(b._Store.integrationAttributes[a]={},b._Store.integrationAttributes[a][e]=c[e]);else {b.Logger.error("Values for integration attributes must be strings. You entered a "+_typeof$1(c[e]));continue}}b._Persistence.update();}},this.getIntegrationAttributes=function(a){return b._Store.integrationAttributes[a]?b._Store.integrationAttributes[a]:{}},this.addForwarder=function(a){b._preInit.forwarderConstructors.push(a);},this.configurePixel=function(a){b._Forwarders.configurePixel(a);},this._getActiveForwarders=function(){return b._Store.activeForwarders},this._getIntegrationDelays=function(){return b._preInit.integrationDelays},this._setIntegrationDelay=function(a,c){// If the integration delay is set to true, no further action needed
1530
+ if(b._Helpers.canLog()){if(!b._Helpers.Validators.isValidAttributeValue(c))return void b.Logger.error(Messages.ErrorMessages.BadAttribute);if(!b._Helpers.Validators.isValidKeyValue(a))return void b.Logger.error(Messages.ErrorMessages.BadKey);if(b._Store.webviewBridgeEnabled)b._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.SetSessionAttribute,JSON.stringify({key:a,value:c}));else {var g=b._Helpers.findKeyInObject(b._Store.sessionAttributes,a);g&&(a=g),b._Store.sessionAttributes[a]=c,b._Persistence.update(),b._Forwarders.applyToForwarders("setSessionAttribute",[a,c]);}}},this.setOptOut=function(a){var c=queueIfNotInitialized(function(){b.setOptOut(a);},b);c||(b._SessionManager.resetSessionTimer(),b._Store.isEnabled=!a,b._Events.logOptOut(),b._Persistence.update(),b._Store.activeForwarders.length&&b._Store.activeForwarders.forEach(function(c){if(c.setOptOut){var d=c.setOptOut(a);d&&b.Logger.verbose(d);}}));},this.setIntegrationAttribute=function(a,c){var d=queueIfNotInitialized(function(){b.setIntegrationAttribute(a,c);},b);if(!d){if("number"!=typeof a)return void b.Logger.error("integrationId must be a number");if(null===c)b._Store.integrationAttributes[a]={};else {if(!b._Helpers.isObject(c))return void b.Logger.error("Attrs must be an object with keys and values. You entered a "+_typeof(c));if(0===Object.keys(c).length)b._Store.integrationAttributes[a]={};else for(var e in c)if("string"!=typeof e){b.Logger.error("Keys must be strings, you entered a "+_typeof(e));continue}else if("string"==typeof c[e])b._Helpers.isObject(b._Store.integrationAttributes[a])?b._Store.integrationAttributes[a][e]=c[e]:(b._Store.integrationAttributes[a]={},b._Store.integrationAttributes[a][e]=c[e]);else {b.Logger.error("Values for integration attributes must be strings. You entered a "+_typeof(c[e]));continue}}b._Persistence.update();}},this.getIntegrationAttributes=function(a){return b._Store.integrationAttributes[a]?b._Store.integrationAttributes[a]:{}},this.addForwarder=function(a){b._preInit.forwarderConstructors.push(a);},this.configurePixel=function(a){b._Forwarders.configurePixel(a);},this._getActiveForwarders=function(){return b._Store.activeForwarders},this._getIntegrationDelays=function(){return b._preInit.integrationDelays},this._setIntegrationDelay=function(a,c){// If the integration delay is set to true, no further action needed
1944
1531
  if(b._preInit.integrationDelays[a]=c,!0!==c){// If the integration delay is set to false, check to see if there are any
1945
1532
  // other integration delays set to true. It not, process the queued events/.
1946
1533
  var d=Object.keys(b._preInit.integrationDelays);if(0!==d.length){var e=d.some(function(a){return !0===b._preInit.integrationDelays[a]});e||b._APIClient.processQueuedEvents();}}},this._setWrapperSDKInfo=function(a,c){var d=queueIfNotInitialized(function(){b._setWrapperSDKInfo(a,c);},b);d||(b._Store.wrapperSDKInfo===void 0||!b._Store.wrapperSDKInfo.isInfoSet)&&(b._Store.wrapperSDKInfo={name:a,version:c,isInfoSet:!0});},this._registerErrorReportingService=function(a){b._ErrorReportingDispatcher.register(a);},this._registerLoggingService=function(a){b._LoggingDispatcher.register(a);};var c=Constants.Rokt.LauncherInstanceGuidKey;this.setLauncherInstanceGuid=function(){window[c]&&"string"==typeof window[c]||(window[c]=b._Helpers.generateUniqueId());},this.getLauncherInstanceGuid=function(){return window[c]},this.captureTiming=function(a){var b;"undefined"!=typeof window&&(null===(b=window.performance)||void 0===b?void 0:b.mark)&&window.performance.mark(a);};}// Some (server) config settings need to be returned before they are set on SDKConfig in a self hosted environment