@mparticle/web-sdk 3.10.0 → 3.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,7 +15,7 @@ map:function map(a,b){var c,d,e;if(null===this)throw new TypeError(" this is nul
15
15
  filter:function filter(a/*, thisArg*/){if(void 0===this||null===this)throw new TypeError;var b=Object(this),c=b.length>>>0;if("function"!=typeof a)throw new TypeError;for(var d=[],e=2<=arguments.length?arguments[1]:void 0,f=0;f<c;f++)if(f in b){var g=b[f];a.call(e,g,f,b)&&d.push(g);}return d},// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray
16
16
  isArray:function isArray(a){return "[object Array]"===Object.prototype.toString.call(a)},Base64:Base64$1};
17
17
 
18
- var version = "3.10.0";
18
+ var version = "3.11.0";
19
19
 
20
20
  var Constants={sdkVersion:version,sdkVendor:"mparticle",platform:"web",Messages:{DeprecationMessages:{MethodHasBeenDeprecated:"has been deprecated.",MethodMarkedForDeprecationPostfix:"is a deprecated method and will be removed in future releases.",AlternativeMethodPrefix:"Please use the alternate method:"},ErrorMessages:{NoToken:"A token must be specified.",EventNameInvalidType:"Event name must be a valid string value.",EventDataInvalidType:"Event data must be a valid object hash.",LoggingDisabled:"Event logging is currently disabled.",CookieParseError:"Could not parse cookie",EventEmpty:"Event object is null or undefined, cancelling send",APIRequestEmpty:"APIRequest is null or undefined, cancelling send",NoEventType:"Event type must be specified.",TransactionIdRequired:"Transaction ID is required",TransactionRequired:"A transaction attributes object is required",PromotionIdRequired:"Promotion ID is required",BadAttribute:"Attribute value cannot be object or array",BadKey:"Key value cannot be object or array",BadLogPurchase:"Transaction attributes and a product are both required to log a purchase, https://docs.mparticle.com/?javascript#measuring-transactions",AudienceAPINotEnabled:"Your workspace is not enabled to retrieve user audiences."},InformationMessages:{CookieSearch:"Searching for cookie",CookieFound:"Cookie found, parsing values",CookieNotFound:"Cookies not found",CookieSet:"Setting cookie",CookieSync:"Performing cookie sync",SendBegin:"Starting to send event",SendIdentityBegin:"Starting to send event to identity server",SendWindowsPhone:"Sending event to Windows Phone container",SendIOS:"Calling iOS path: ",SendAndroid:"Calling Android JS interface method: ",SendHttp:"Sending event to mParticle HTTP service",SendAliasHttp:"Sending alias request to mParticle HTTP service",SendIdentityHttp:"Sending event to mParticle HTTP service",StartingNewSession:"Starting new Session",StartingLogEvent:"Starting to log event",StartingLogOptOut:"Starting to log user opt in/out",StartingEndSession:"Starting to end session",StartingInitialization:"Starting to initialize",StartingLogCommerceEvent:"Starting to log commerce event",StartingAliasRequest:"Starting to Alias MPIDs",LoadingConfig:"Loading configuration options",AbandonLogEvent:"Cannot log event, logging disabled or developer token not set",AbandonAliasUsers:"Cannot Alias Users, logging disabled or developer token not set",AbandonStartSession:"Cannot start session, logging disabled or developer token not set",AbandonEndSession:"Cannot end session, logging disabled or developer token not set",NoSessionToEnd:"Cannot end session, no active session found"},ValidationMessages:{ModifyIdentityRequestUserIdentitiesPresent:"identityRequests to modify require userIdentities to be present. Request not sent to server. Please fix and try again",IdentityRequesetInvalidKey:"There is an invalid key on your identityRequest object. It can only contain a `userIdentities` object and a `onUserAlias` function. Request not sent to server. Please fix and try again.",OnUserAliasType:"The onUserAlias value must be a function.",UserIdentities:"The userIdentities key must be an object with keys of identityTypes and values of strings. Request not sent to server. Please fix and try again.",UserIdentitiesInvalidKey:"There is an invalid identity key on your `userIdentities` object within the identityRequest. Request not sent to server. Please fix and try again.",UserIdentitiesInvalidValues:"All user identity values must be strings or null. Request not sent to server. Please fix and try again.",AliasMissingMpid:"Alias Request must contain both a destinationMpid and a sourceMpid",AliasNonUniqueMpid:"Alias Request's destinationMpid and sourceMpid must be unique",AliasMissingTime:"Alias Request must have both a startTime and an endTime",AliasStartBeforeEndTime:"Alias Request's endTime must be later than its startTime"}},NativeSdkPaths:{LogEvent:"logEvent",SetUserTag:"setUserTag",RemoveUserTag:"removeUserTag",SetUserAttribute:"setUserAttribute",RemoveUserAttribute:"removeUserAttribute",SetSessionAttribute:"setSessionAttribute",LogOut:"logOut",SetUserAttributeList:"setUserAttributeList",RemoveAllUserAttributes:"removeAllUserAttributes",GetUserAttributesLists:"getUserAttributesLists",GetAllUserAttributes:"getAllUserAttributes",Identify:"identify",Logout:"logout",Login:"login",Modify:"modify",Alias:"aliasUsers",Upload:"upload"},StorageNames:{localStorageName:"mprtcl-api",localStorageNameV3:"mprtcl-v3",cookieName:"mprtcl-api",cookieNameV2:"mprtcl-v2",cookieNameV3:"mprtcl-v3",localStorageNameV4:"mprtcl-v4",cookieNameV4:"mprtcl-v4",currentStorageName:"mprtcl-v4"},DefaultConfig:{cookieDomain:null,cookieExpiration:365,logLevel:null,timeout:300,sessionTimeout:30,forwarderStatsTimeout:5e3,integrationDelayTimeout:5e3,maxCookieSize:3e3,aliasMaxWindow:90,uploadInterval:0// Maximum milliseconds in between batch uploads, below 500 will mean immediate upload. The server returns this as a string, but we are using it as a number internally
21
21
  },DefaultBaseUrls:{v1SecureServiceUrl:"jssdks.mparticle.com/v1/JS/",v2SecureServiceUrl:"jssdks.mparticle.com/v2/JS/",v3SecureServiceUrl:"jssdks.mparticle.com/v3/JS/",configUrl:"jssdkcdns.mparticle.com/JS/v2/",identityUrl:"identity.mparticle.com/v1/",aliasUrl:"jssdks.mparticle.com/v1/identity/",userAudienceUrl:"nativesdks.mparticle.com/v1/"},// These are the paths that are used to construct the CNAME urls
@@ -468,7 +468,7 @@ var SDKIdentityTypeEnum;(function(a){a.other="other",a.customerId="customerid",a
468
468
  var FeatureFlags$2=Constants.FeatureFlags,CaptureIntegrationSpecificIds$1=FeatureFlags$2.CaptureIntegrationSpecificIds,CaptureIntegrationSpecificIdsV2$1=FeatureFlags$2.CaptureIntegrationSpecificIdsV2;function convertEvents(a,b,c){if(!a)return null;if(!b||1>b.length)return null;for(var d,e=c._IntegrationCapture,f=c._Helpers,g=f.getFeatureFlag,h=c.Identity.getCurrentUser(),i=[],j=null,k=0,l=b;k<l.length;k++)if(d=l[k],d){j=d;var m=convertEvent(d);m&&i.push(m);}if(!j)return null;var n=null;// Add the consent state from either the Last Event or the user
469
469
  isEmpty(j.ConsentState)?!isEmpty(h)&&(n=h.getConsentState()):n=j.ConsentState;var o={source_request_id:c._Helpers.generateUniqueId(),mpid:a,timestamp_unixtime_ms:new Date().getTime(),environment:j.Debug?dist.BatchEnvironmentEnum.development:dist.BatchEnvironmentEnum.production,events:i,mp_deviceid:j.DeviceId,sdk_version:j.SDKVersion,// TODO: Refactor this to read from _Store or a global config
470
470
  application_info:{application_version:j.AppVersion,application_name:j.AppName,package:j.Package,sideloaded_kits_count:c._Store.sideloadedKitsCount},device_info:{platform:dist.DeviceInformationPlatformEnum.web,screen_width:"undefined"!=typeof window&&"undefined"!=typeof window.screen?window.screen.width:0,screen_height:"undefined"!=typeof window&&"undefined"!=typeof window.screen?window.screen.height:0},user_attributes:j.UserAttributes,user_identities:convertUserIdentities(j.UserIdentities),consent_state:convertConsentState(n),integration_attributes:j.IntegrationAttributes};j.DataPlan&&j.DataPlan.PlanId&&(o.context={data_plan:{plan_id:j.DataPlan.PlanId,plan_version:j.DataPlan.PlanVersion||void 0}});// https://go.mparticle.com/work/SQDSDKS-7639
471
- var p=g&&!!g(CaptureIntegrationSpecificIds$1),q=g&&g(CaptureIntegrationSpecificIdsV2$1),r=q&&q!==Constants.CaptureIntegrationSpecificIdsV2Modes.None||!0===p;if(r){var s=null===e||void 0===e?void 0:e.getClickIdsAsPartnerIdentities();isEmpty(s)||(o.partner_identities=s);}return o}function convertConsentState(a){if(isEmpty(a))return null;var b={gdpr:convertGdprConsentState(a.getGDPRConsentState()),ccpa:convertCcpaConsentState(a.getCCPAConsentState())};return b}function convertGdprConsentState(a){if(!a)return null;var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]={consented:a[c].Consented,hardware_id:a[c].HardwareId,document:a[c].ConsentDocument,timestamp_unixtime_ms:a[c].Timestamp,location:a[c].Location});return b}function convertCcpaConsentState(a){if(!a)return null;var b={data_sale_opt_out:{consented:a.Consented,hardware_id:a.HardwareId,document:a.ConsentDocument,timestamp_unixtime_ms:a.Timestamp,location:a.Location}};return b}function convertUserIdentities(a){if(!a||!a.length)return null;for(var b,c={},d=0,e=a;d<e.length;d++)switch(b=e[d],b.Type){case Types.IdentityType.CustomerId:c.customer_id=b.Identity;break;case Types.IdentityType.Email:c.email=b.Identity;break;case Types.IdentityType.Facebook:c.facebook=b.Identity;break;case Types.IdentityType.FacebookCustomAudienceId:c.facebook_custom_audience_id=b.Identity;break;case Types.IdentityType.Google:c.google=b.Identity;break;case Types.IdentityType.Microsoft:c.microsoft=b.Identity;break;case Types.IdentityType.Other:c.other=b.Identity;break;case Types.IdentityType.Other2:c.other_id_2=b.Identity;break;case Types.IdentityType.Other3:c.other_id_3=b.Identity;break;case Types.IdentityType.Other4:c.other_id_4=b.Identity;break;case Types.IdentityType.Other5:c.other_id_5=b.Identity;break;case Types.IdentityType.Other6:c.other_id_6=b.Identity;break;case Types.IdentityType.Other7:c.other_id_7=b.Identity;break;case Types.IdentityType.Other8:c.other_id_8=b.Identity;break;case Types.IdentityType.Other9:c.other_id_9=b.Identity;break;case Types.IdentityType.Other10:c.other_id_10=b.Identity;break;case Types.IdentityType.MobileNumber:c.mobile_number=b.Identity;break;case Types.IdentityType.PhoneNumber2:c.phone_number_2=b.Identity;break;case Types.IdentityType.PhoneNumber3:c.phone_number_3=b.Identity;break;}return c}function convertEvent(a){if(!a)return null;switch(a.EventDataType){case Types.MessageType.AppStateTransition:return convertAST(a);case Types.MessageType.Commerce:return convertCommerceEvent(a);case Types.MessageType.CrashReport:return convertCrashReportEvent(a);case Types.MessageType.OptOut:return convertOptOutEvent(a);case Types.MessageType.PageEvent:// Note: Media Events are also sent as PageEvents/CustomEvents
471
+ var p=g&&!!g(CaptureIntegrationSpecificIds$1),q=g&&g(CaptureIntegrationSpecificIdsV2$1),r=q&&q!==Constants.CaptureIntegrationSpecificIdsV2Modes.None||!0===p;if(r){null===e||void 0===e?void 0:e.capture();var s=null===e||void 0===e?void 0:e.getClickIdsAsPartnerIdentities();isEmpty(s)||(o.partner_identities=s);}return o}function convertConsentState(a){if(isEmpty(a))return null;var b={gdpr:convertGdprConsentState(a.getGDPRConsentState()),ccpa:convertCcpaConsentState(a.getCCPAConsentState())};return b}function convertGdprConsentState(a){if(!a)return null;var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]={consented:a[c].Consented,hardware_id:a[c].HardwareId,document:a[c].ConsentDocument,timestamp_unixtime_ms:a[c].Timestamp,location:a[c].Location});return b}function convertCcpaConsentState(a){if(!a)return null;var b={data_sale_opt_out:{consented:a.Consented,hardware_id:a.HardwareId,document:a.ConsentDocument,timestamp_unixtime_ms:a.Timestamp,location:a.Location}};return b}function convertUserIdentities(a){if(!a||!a.length)return null;for(var b,c={},d=0,e=a;d<e.length;d++)switch(b=e[d],b.Type){case Types.IdentityType.CustomerId:c.customer_id=b.Identity;break;case Types.IdentityType.Email:c.email=b.Identity;break;case Types.IdentityType.Facebook:c.facebook=b.Identity;break;case Types.IdentityType.FacebookCustomAudienceId:c.facebook_custom_audience_id=b.Identity;break;case Types.IdentityType.Google:c.google=b.Identity;break;case Types.IdentityType.Microsoft:c.microsoft=b.Identity;break;case Types.IdentityType.Other:c.other=b.Identity;break;case Types.IdentityType.Other2:c.other_id_2=b.Identity;break;case Types.IdentityType.Other3:c.other_id_3=b.Identity;break;case Types.IdentityType.Other4:c.other_id_4=b.Identity;break;case Types.IdentityType.Other5:c.other_id_5=b.Identity;break;case Types.IdentityType.Other6:c.other_id_6=b.Identity;break;case Types.IdentityType.Other7:c.other_id_7=b.Identity;break;case Types.IdentityType.Other8:c.other_id_8=b.Identity;break;case Types.IdentityType.Other9:c.other_id_9=b.Identity;break;case Types.IdentityType.Other10:c.other_id_10=b.Identity;break;case Types.IdentityType.MobileNumber:c.mobile_number=b.Identity;break;case Types.IdentityType.PhoneNumber2:c.phone_number_2=b.Identity;break;case Types.IdentityType.PhoneNumber3:c.phone_number_3=b.Identity;break;}return c}function convertEvent(a){if(!a)return null;switch(a.EventDataType){case Types.MessageType.AppStateTransition:return convertAST(a);case Types.MessageType.Commerce:return convertCommerceEvent(a);case Types.MessageType.CrashReport:return convertCrashReportEvent(a);case Types.MessageType.OptOut:return convertOptOutEvent(a);case Types.MessageType.PageEvent:// Note: Media Events are also sent as PageEvents/CustomEvents
472
472
  return convertCustomEvent(a);case Types.MessageType.PageView:return convertPageViewEvent(a);case Types.MessageType.Profile://deprecated and not supported by the web SDK
473
473
  return null;case Types.MessageType.SessionEnd:return convertSessionEndEvent(a);case Types.MessageType.SessionStart:return convertSessionStartEvent(a);case Types.MessageType.UserAttributeChange:return convertUserAttributeChangeEvent(a);case Types.MessageType.UserIdentityChange:return convertUserIdentityChangeEvent(a);}return null}function convertProductActionType(a){if(!a)return dist.ProductActionActionEnum.unknown;return a===SDKProductActionType.AddToCart?dist.ProductActionActionEnum.addToCart:a===SDKProductActionType.AddToWishlist?dist.ProductActionActionEnum.addToWishlist:a===SDKProductActionType.Checkout?dist.ProductActionActionEnum.checkout:a===SDKProductActionType.CheckoutOption?dist.ProductActionActionEnum.checkoutOption:a===SDKProductActionType.Click?dist.ProductActionActionEnum.click:a===SDKProductActionType.Purchase?dist.ProductActionActionEnum.purchase:a===SDKProductActionType.Refund?dist.ProductActionActionEnum.refund:a===SDKProductActionType.RemoveFromCart?dist.ProductActionActionEnum.removeFromCart:a===SDKProductActionType.RemoveFromWishlist?dist.ProductActionActionEnum.removeFromWishlist:a===SDKProductActionType.ViewDetail?dist.ProductActionActionEnum.viewDetail:dist.ProductActionActionEnum.unknown}function convertProductAction(a){if(!a.ProductAction)return null;var b={action:convertProductActionType(a.ProductAction.ProductActionType),checkout_step:a.ProductAction.CheckoutStep,checkout_options:a.ProductAction.CheckoutOptions,transaction_id:a.ProductAction.TransactionId,affiliation:a.ProductAction.Affiliation,total_amount:a.ProductAction.TotalAmount,tax_amount:a.ProductAction.TaxAmount,shipping_amount:a.ProductAction.ShippingAmount,coupon_code:a.ProductAction.CouponCode,products:convertProducts(a.ProductAction.ProductList)};return b}function convertProducts(a){if(!a||!a.length)return null;for(var b=[],c=0,d=a;c<d.length;c++){var e=d[c],f={id:e.Sku,name:e.Name,brand:e.Brand,category:e.Category,variant:e.Variant,total_product_amount:e.TotalAmount,position:e.Position,price:e.Price,quantity:e.Quantity,coupon_code:e.CouponCode,custom_attributes:e.Attributes};b.push(f);}return b}function convertPromotionAction(a){if(!a.PromotionAction)return null;var b={action:a.PromotionAction.PromotionActionType,promotions:convertPromotions(a.PromotionAction.PromotionList)};return b}function convertPromotions(a){if(!a||!a.length)return null;for(var b=[],c=0,d=a;c<d.length;c++){var e=d[c],f={id:e.Id,name:e.Name,creative:e.Creative,position:e.Position};b.push(f);}return b}function convertImpressions(a){if(!a.ProductImpressions)return null;for(var b=[],c=0,d=a.ProductImpressions;c<d.length;c++){var e=d[c],f={product_impression_list:e.ProductImpressionList,products:convertProducts(e.ProductList)};b.push(f);}return b}function convertCommerceEvent(a){var b=convertBaseEventData(a),c={custom_flags:a.CustomFlags,product_action:convertProductAction(a),promotion_action:convertPromotionAction(a),product_impressions:convertImpressions(a),currency_code:a.CurrencyCode};return c=Object.assign(c,b),{event_type:dist.EventTypeEnum.commerceEvent,data:c}}function convertCrashReportEvent(a){var b=convertBaseEventData(a),c={message:a.EventName};return c=Object.assign(c,b),{event_type:dist.EventTypeEnum.crashReport,data:c}}function convertAST(a){var b=convertBaseEventData(a),c=dist.ApplicationStateTransitionEventDataApplicationTransitionTypeEnum,d=c.applicationBackground,e=c.applicationInitialized,f=a.IsBackgroundAST?d:e,g={application_transition_type:f,is_first_run:a.IsFirstRun,is_upgrade:!1,launch_referral:a.LaunchReferral};// Determine the transition type based on IsBackgroundAST flag
474
474
  return g=Object.assign(g,b),{event_type:dist.EventTypeEnum.applicationStateTransition,data:g}}function convertSessionEndEvent(a){var b=convertBaseEventData(a),c={session_duration_ms:a.SessionLength//note: External Events DTO does not support the session mpids array as of this time.
@@ -1335,11 +1335,7 @@ _scid:{mappedKey:"SnapchatConversions.Cookie1",output:IntegrationOutputs.CUSTOM_
1335
1335
  // https://go.mparticle.com/work/SQDSDKS-7167
1336
1336
  rtid:{mappedKey:"passbackconversiontrackingid",output:IntegrationOutputs.INTEGRATION_ATTRIBUTES,moduleId:1277},rclid:{mappedKey:"passbackconversiontrackingid",output:IntegrationOutputs.INTEGRATION_ATTRIBUTES,moduleId:1277},RoktTransactionId:{mappedKey:"passbackconversiontrackingid",output:IntegrationOutputs.INTEGRATION_ATTRIBUTES,moduleId:1277}},IntegrationCapture=/** @class */function(){function a(a){this.initialTimestamp=Date.now(),this.captureMode=a,this.filteredPartnerIdentityMappings=this.filterMappings(IntegrationOutputs.PARTNER_IDENTITIES),this.filteredCustomFlagMappings=this.filterMappings(IntegrationOutputs.CUSTOM_FLAGS),this.filteredIntegrationAttributeMappings=this.filterMappings(IntegrationOutputs.INTEGRATION_ATTRIBUTES);}/**
1337
1337
  * Captures Integration Ids from cookies and query params and stores them in clickIds object
1338
- */return a.prototype.capture=function(){var a=this.captureQueryParams()||{},b=this.captureCookies()||{},c=this.captureLocalStorage()||{};this.applyPinterestRules(a,c,b),a.fbclid&&b._fbc&&delete b._fbc;// ROKT Rules
1339
- // If both rtid or rclid and RoktTransactionId are present, prioritize rtid/rclid
1340
- // If RoktTransactionId is present in both cookies and localStorage,
1341
- // prioritize localStorage
1342
- var d=a.rtid||a.rclid,e=c.RoktTransactionId,f=b.RoktTransactionId;d?(e&&delete c.RoktTransactionId,f&&delete b.RoktTransactionId):e&&f&&delete b.RoktTransactionId,this.clickIds=__assign(__assign(__assign(__assign({},this.clickIds),a),c),b);},a.prototype.captureCookies=function(){var a=this.getAllowedKeysForMode(),b=getCookies(a);return this.applyProcessors(b,getHref(),this.initialTimestamp)},a.prototype.captureQueryParams=function(){var a=this.getQueryParams();return this.applyProcessors(a,getHref(),this.initialTimestamp)},a.prototype.captureLocalStorage=function(){for(var a=this.getAllowedKeysForMode(),b={},c=0,d=a;c<d.length;c++){var e=d[c],f=localStorage.getItem(e);f&&(b[e]=f);}return this.applyProcessors(b,getHref(),this.initialTimestamp)},a.prototype.getQueryParams=function(){var a=this.getAllowedKeysForMode();return queryStringParser(getHref(),a)},a.prototype.getClickIdsAsCustomFlags=function(){return this.getClickIds(this.clickIds,this.filteredCustomFlagMappings)},a.prototype.getClickIdsAsPartnerIdentities=function(){return this.getClickIds(this.clickIds,this.filteredPartnerIdentityMappings)},a.prototype.getClickIdsAsIntegrationAttributes=function(){var a,b,c,d={};// Integration IDs are stored in the following format:
1338
+ */return a.prototype.capture=function(){var a=this.captureQueryParams()||{},b=this.captureCookies()||{},c=this.captureLocalStorage()||{};this.normalizePinterestClickId(a),this.normalizePinterestClickId(c),this.normalizePinterestClickId(b),this.applySourcePrecedence([a,c,b,this.clickIds||{}]),this.clickIds=__assign(__assign(__assign(__assign({},this.clickIds),b),c),a);},a.prototype.captureCookies=function(){var a=this.getAllowedKeysForMode(),b=getCookies(a);return this.applyProcessors(b,getHref(),this.initialTimestamp)},a.prototype.captureQueryParams=function(){var a=this.getQueryParams();return this.applyProcessors(a,getHref(),this.initialTimestamp)},a.prototype.captureLocalStorage=function(){for(var a=this.getAllowedKeysForMode(),b={},c=0,d=a;c<d.length;c++){var e=d[c],f=localStorage.getItem(e);f&&(b[e]=f);}return this.applyProcessors(b,getHref(),this.initialTimestamp)},a.prototype.getQueryParams=function(){var a=this.getAllowedKeysForMode();return queryStringParser(getHref(),a)},a.prototype.getClickIdsAsCustomFlags=function(){return this.getClickIds(this.clickIds,this.filteredCustomFlagMappings)},a.prototype.getClickIdsAsPartnerIdentities=function(){return this.getClickIds(this.clickIds,this.filteredPartnerIdentityMappings)},a.prototype.getClickIdsAsIntegrationAttributes=function(){var a,b,c,d={};// Integration IDs are stored in the following format:
1343
1339
  // {
1344
1340
  // "integration_attributes": {
1345
1341
  // "<moduleId>": {
@@ -1347,7 +1343,7 @@ var d=a.rtid||a.rclid,e=c.RoktTransactionId,f=b.RoktTransactionId;d?(e&&delete c
1347
1343
  // }
1348
1344
  // }
1349
1345
  // }
1350
- for(var e in this.clickIds)if(this.clickIds.hasOwnProperty(e)){var f=this.clickIds[e],g=null===(b=this.filteredIntegrationAttributeMappings[e])||void 0===b?void 0:b.mappedKey;if(!isEmpty(g)){var h=null===(c=this.filteredIntegrationAttributeMappings[e])||void 0===c?void 0:c.moduleId;h&&!d[h]&&(d[h]=(a={},a[g]=f,a));}}return d},a.prototype.getClickIds=function(a,b){var c,d={};if(!a)return d;for(var e in a)if(a.hasOwnProperty(e)){var f=a[e],g=null===(c=b[e])||void 0===c?void 0:c.mappedKey;isEmpty(g)||(d[g]=f);}return d},a.prototype.normalizePinterestClickId=function(a){isEmpty(null===a||void 0===a?void 0:a._epik)||isEmpty(null===a||void 0===a?void 0:a.epik)||delete a.epik;},a.prototype.hasPinterestAlias=function(a){return !isEmpty(null===a||void 0===a?void 0:a.epik)||!isEmpty(null===a||void 0===a?void 0:a._epik)},a.prototype.applyPinterestRules=function(a,b,c){var d,e;return this.normalizePinterestClickId(a),this.normalizePinterestClickId(b),this.normalizePinterestClickId(c),(this.hasPinterestAlias(a)||this.hasPinterestAlias(b)||this.hasPinterestAlias(c))&&(null===(d=this.clickIds)||void 0===d||delete d.epik,null===(e=this.clickIds)||void 0===e||delete e._epik),this.hasPinterestAlias(a)?(delete c.epik,delete c._epik,delete b.epik,void delete b._epik):void(this.hasPinterestAlias(b)&&(delete c.epik,delete c._epik))},a.prototype.applyProcessors=function(a,b,c){var d,e={},f=this.getActiveIntegrationMapping();for(var g in a)if(a.hasOwnProperty(g)){var h=a[g],i=null===(d=f[g])||void 0===d?void 0:d.processor;e[g]=i?i(h,b,c):h;}return e},a.prototype.filterMappings=function(a){var b={},c=this.getActiveIntegrationMapping();for(var d in c)c[d].output===a&&(b[d]=c[d]);return b},a.prototype.getAllowedKeysForMode=function(){return Object.keys(this.getActiveIntegrationMapping())},a.prototype.getActiveIntegrationMapping=function(){return this.captureMode===Constants.CaptureIntegrationSpecificIdsV2Modes.RoktOnly?integrationMappingRokt:this.captureMode===Constants.CaptureIntegrationSpecificIdsV2Modes.All?__assign(__assign({},integrationMappingExternal),integrationMappingRokt):{}},a}();
1346
+ for(var e in this.clickIds)if(this.clickIds.hasOwnProperty(e)){var f=this.clickIds[e],g=null===(b=this.filteredIntegrationAttributeMappings[e])||void 0===b?void 0:b.mappedKey;if(!isEmpty(g)){var h=null===(c=this.filteredIntegrationAttributeMappings[e])||void 0===c?void 0:c.moduleId;h&&!d[h]&&(d[h]=(a={},a[g]=f,a));}}return d},a.prototype.getClickIds=function(a,b){var c,d={};if(!a)return d;for(var e in a)if(a.hasOwnProperty(e)){var f=a[e],g=null===(c=b[e])||void 0===c?void 0:c.mappedKey;isEmpty(g)||(d[g]=f);}return d},a.prototype.normalizePinterestClickId=function(a){isEmpty(null===a||void 0===a?void 0:a._epik)||isEmpty(null===a||void 0===a?void 0:a.epik)||delete a.epik;},a.prototype.applySourcePrecedence=function(a){for(var b=this.getActiveIntegrationMapping(),c=function outputOf(a){var c;return (null===(c=b[a])||void 0===c?void 0:c.mappedKey)||a},d=[],e=0,f=a;e<f.length;e++){var g=f[e],h=[];for(var i in g){var j=c(i);-1===d.indexOf(j)?!isEmpty(g[i])&&h.push(j):delete g[i];}d.push.apply(d,h);}},a.prototype.applyProcessors=function(a,b,c){var d,e={},f=this.getActiveIntegrationMapping();for(var g in a)if(a.hasOwnProperty(g)){var h=a[g],i=null===(d=f[g])||void 0===d?void 0:d.processor;e[g]=i?i(h,b,c):h;}return e},a.prototype.filterMappings=function(a){var b={},c=this.getActiveIntegrationMapping();for(var d in c)c[d].output===a&&(b[d]=c[d]);return b},a.prototype.getAllowedKeysForMode=function(){return Object.keys(this.getActiveIntegrationMapping())},a.prototype.getActiveIntegrationMapping=function(){return this.captureMode===Constants.CaptureIntegrationSpecificIdsV2Modes.RoktOnly?integrationMappingRokt:this.captureMode===Constants.CaptureIntegrationSpecificIdsV2Modes.All?__assign(__assign({},integrationMappingExternal),integrationMappingRokt):{}},a}();
1351
1347
 
1352
1348
  var PASSBACK_CONVERSION_TRACKING_ID="passbackconversiontrackingid",ON_SHOPPABLE_ADS_READY_METHOD="onShoppableAdsReady",RoktManager=/** @class */function(){// Keys this manager's route subscription, so a re-executed bundle's manager replaces
1353
1349
  // it while a second named instance keeps its own.
@@ -15,7 +15,7 @@ map:function map(a,b){var c,d,e;if(null===this)throw new TypeError(" this is nul
15
15
  filter:function filter(a/*, thisArg*/){if(void 0===this||null===this)throw new TypeError;var b=Object(this),c=b.length>>>0;if("function"!=typeof a)throw new TypeError;for(var d=[],e=2<=arguments.length?arguments[1]:void 0,f=0;f<c;f++)if(f in b){var g=b[f];a.call(e,g,f,b)&&d.push(g);}return d},// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray
16
16
  isArray:function isArray(a){return "[object Array]"===Object.prototype.toString.call(a)},Base64:Base64$1};
17
17
 
18
- var version = "3.10.0";
18
+ var version = "3.11.0";
19
19
 
20
20
  var Constants={sdkVersion:version,sdkVendor:"mparticle",platform:"web",Messages:{DeprecationMessages:{MethodHasBeenDeprecated:"has been deprecated.",MethodMarkedForDeprecationPostfix:"is a deprecated method and will be removed in future releases.",AlternativeMethodPrefix:"Please use the alternate method:"},ErrorMessages:{NoToken:"A token must be specified.",EventNameInvalidType:"Event name must be a valid string value.",EventDataInvalidType:"Event data must be a valid object hash.",LoggingDisabled:"Event logging is currently disabled.",CookieParseError:"Could not parse cookie",EventEmpty:"Event object is null or undefined, cancelling send",APIRequestEmpty:"APIRequest is null or undefined, cancelling send",NoEventType:"Event type must be specified.",TransactionIdRequired:"Transaction ID is required",TransactionRequired:"A transaction attributes object is required",PromotionIdRequired:"Promotion ID is required",BadAttribute:"Attribute value cannot be object or array",BadKey:"Key value cannot be object or array",BadLogPurchase:"Transaction attributes and a product are both required to log a purchase, https://docs.mparticle.com/?javascript#measuring-transactions",AudienceAPINotEnabled:"Your workspace is not enabled to retrieve user audiences."},InformationMessages:{CookieSearch:"Searching for cookie",CookieFound:"Cookie found, parsing values",CookieNotFound:"Cookies not found",CookieSet:"Setting cookie",CookieSync:"Performing cookie sync",SendBegin:"Starting to send event",SendIdentityBegin:"Starting to send event to identity server",SendWindowsPhone:"Sending event to Windows Phone container",SendIOS:"Calling iOS path: ",SendAndroid:"Calling Android JS interface method: ",SendHttp:"Sending event to mParticle HTTP service",SendAliasHttp:"Sending alias request to mParticle HTTP service",SendIdentityHttp:"Sending event to mParticle HTTP service",StartingNewSession:"Starting new Session",StartingLogEvent:"Starting to log event",StartingLogOptOut:"Starting to log user opt in/out",StartingEndSession:"Starting to end session",StartingInitialization:"Starting to initialize",StartingLogCommerceEvent:"Starting to log commerce event",StartingAliasRequest:"Starting to Alias MPIDs",LoadingConfig:"Loading configuration options",AbandonLogEvent:"Cannot log event, logging disabled or developer token not set",AbandonAliasUsers:"Cannot Alias Users, logging disabled or developer token not set",AbandonStartSession:"Cannot start session, logging disabled or developer token not set",AbandonEndSession:"Cannot end session, logging disabled or developer token not set",NoSessionToEnd:"Cannot end session, no active session found"},ValidationMessages:{ModifyIdentityRequestUserIdentitiesPresent:"identityRequests to modify require userIdentities to be present. Request not sent to server. Please fix and try again",IdentityRequesetInvalidKey:"There is an invalid key on your identityRequest object. It can only contain a `userIdentities` object and a `onUserAlias` function. Request not sent to server. Please fix and try again.",OnUserAliasType:"The onUserAlias value must be a function.",UserIdentities:"The userIdentities key must be an object with keys of identityTypes and values of strings. Request not sent to server. Please fix and try again.",UserIdentitiesInvalidKey:"There is an invalid identity key on your `userIdentities` object within the identityRequest. Request not sent to server. Please fix and try again.",UserIdentitiesInvalidValues:"All user identity values must be strings or null. Request not sent to server. Please fix and try again.",AliasMissingMpid:"Alias Request must contain both a destinationMpid and a sourceMpid",AliasNonUniqueMpid:"Alias Request's destinationMpid and sourceMpid must be unique",AliasMissingTime:"Alias Request must have both a startTime and an endTime",AliasStartBeforeEndTime:"Alias Request's endTime must be later than its startTime"}},NativeSdkPaths:{LogEvent:"logEvent",SetUserTag:"setUserTag",RemoveUserTag:"removeUserTag",SetUserAttribute:"setUserAttribute",RemoveUserAttribute:"removeUserAttribute",SetSessionAttribute:"setSessionAttribute",LogOut:"logOut",SetUserAttributeList:"setUserAttributeList",RemoveAllUserAttributes:"removeAllUserAttributes",GetUserAttributesLists:"getUserAttributesLists",GetAllUserAttributes:"getAllUserAttributes",Identify:"identify",Logout:"logout",Login:"login",Modify:"modify",Alias:"aliasUsers",Upload:"upload"},StorageNames:{localStorageName:"mprtcl-api",localStorageNameV3:"mprtcl-v3",cookieName:"mprtcl-api",cookieNameV2:"mprtcl-v2",cookieNameV3:"mprtcl-v3",localStorageNameV4:"mprtcl-v4",cookieNameV4:"mprtcl-v4",currentStorageName:"mprtcl-v4"},DefaultConfig:{cookieDomain:null,cookieExpiration:365,logLevel:null,timeout:300,sessionTimeout:30,forwarderStatsTimeout:5e3,integrationDelayTimeout:5e3,maxCookieSize:3e3,aliasMaxWindow:90,uploadInterval:0// Maximum milliseconds in between batch uploads, below 500 will mean immediate upload. The server returns this as a string, but we are using it as a number internally
21
21
  },DefaultBaseUrls:{v1SecureServiceUrl:"jssdks.mparticle.com/v1/JS/",v2SecureServiceUrl:"jssdks.mparticle.com/v2/JS/",v3SecureServiceUrl:"jssdks.mparticle.com/v3/JS/",configUrl:"jssdkcdns.mparticle.com/JS/v2/",identityUrl:"identity.mparticle.com/v1/",aliasUrl:"jssdks.mparticle.com/v1/identity/",userAudienceUrl:"nativesdks.mparticle.com/v1/"},// These are the paths that are used to construct the CNAME urls
@@ -468,7 +468,7 @@ var SDKIdentityTypeEnum;(function(a){a.other="other",a.customerId="customerid",a
468
468
  var FeatureFlags$2=Constants.FeatureFlags,CaptureIntegrationSpecificIds$1=FeatureFlags$2.CaptureIntegrationSpecificIds,CaptureIntegrationSpecificIdsV2$1=FeatureFlags$2.CaptureIntegrationSpecificIdsV2;function convertEvents(a,b,c){if(!a)return null;if(!b||1>b.length)return null;for(var d,e=c._IntegrationCapture,f=c._Helpers,g=f.getFeatureFlag,h=c.Identity.getCurrentUser(),i=[],j=null,k=0,l=b;k<l.length;k++)if(d=l[k],d){j=d;var m=convertEvent(d);m&&i.push(m);}if(!j)return null;var n=null;// Add the consent state from either the Last Event or the user
469
469
  isEmpty(j.ConsentState)?!isEmpty(h)&&(n=h.getConsentState()):n=j.ConsentState;var o={source_request_id:c._Helpers.generateUniqueId(),mpid:a,timestamp_unixtime_ms:new Date().getTime(),environment:j.Debug?dist.BatchEnvironmentEnum.development:dist.BatchEnvironmentEnum.production,events:i,mp_deviceid:j.DeviceId,sdk_version:j.SDKVersion,// TODO: Refactor this to read from _Store or a global config
470
470
  application_info:{application_version:j.AppVersion,application_name:j.AppName,package:j.Package,sideloaded_kits_count:c._Store.sideloadedKitsCount},device_info:{platform:dist.DeviceInformationPlatformEnum.web,screen_width:"undefined"!=typeof window&&"undefined"!=typeof window.screen?window.screen.width:0,screen_height:"undefined"!=typeof window&&"undefined"!=typeof window.screen?window.screen.height:0},user_attributes:j.UserAttributes,user_identities:convertUserIdentities(j.UserIdentities),consent_state:convertConsentState(n),integration_attributes:j.IntegrationAttributes};j.DataPlan&&j.DataPlan.PlanId&&(o.context={data_plan:{plan_id:j.DataPlan.PlanId,plan_version:j.DataPlan.PlanVersion||void 0}});// https://go.mparticle.com/work/SQDSDKS-7639
471
- var p=g&&!!g(CaptureIntegrationSpecificIds$1),q=g&&g(CaptureIntegrationSpecificIdsV2$1),r=q&&q!==Constants.CaptureIntegrationSpecificIdsV2Modes.None||!0===p;if(r){var s=null===e||void 0===e?void 0:e.getClickIdsAsPartnerIdentities();isEmpty(s)||(o.partner_identities=s);}return o}function convertConsentState(a){if(isEmpty(a))return null;var b={gdpr:convertGdprConsentState(a.getGDPRConsentState()),ccpa:convertCcpaConsentState(a.getCCPAConsentState())};return b}function convertGdprConsentState(a){if(!a)return null;var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]={consented:a[c].Consented,hardware_id:a[c].HardwareId,document:a[c].ConsentDocument,timestamp_unixtime_ms:a[c].Timestamp,location:a[c].Location});return b}function convertCcpaConsentState(a){if(!a)return null;var b={data_sale_opt_out:{consented:a.Consented,hardware_id:a.HardwareId,document:a.ConsentDocument,timestamp_unixtime_ms:a.Timestamp,location:a.Location}};return b}function convertUserIdentities(a){if(!a||!a.length)return null;for(var b,c={},d=0,e=a;d<e.length;d++)switch(b=e[d],b.Type){case Types.IdentityType.CustomerId:c.customer_id=b.Identity;break;case Types.IdentityType.Email:c.email=b.Identity;break;case Types.IdentityType.Facebook:c.facebook=b.Identity;break;case Types.IdentityType.FacebookCustomAudienceId:c.facebook_custom_audience_id=b.Identity;break;case Types.IdentityType.Google:c.google=b.Identity;break;case Types.IdentityType.Microsoft:c.microsoft=b.Identity;break;case Types.IdentityType.Other:c.other=b.Identity;break;case Types.IdentityType.Other2:c.other_id_2=b.Identity;break;case Types.IdentityType.Other3:c.other_id_3=b.Identity;break;case Types.IdentityType.Other4:c.other_id_4=b.Identity;break;case Types.IdentityType.Other5:c.other_id_5=b.Identity;break;case Types.IdentityType.Other6:c.other_id_6=b.Identity;break;case Types.IdentityType.Other7:c.other_id_7=b.Identity;break;case Types.IdentityType.Other8:c.other_id_8=b.Identity;break;case Types.IdentityType.Other9:c.other_id_9=b.Identity;break;case Types.IdentityType.Other10:c.other_id_10=b.Identity;break;case Types.IdentityType.MobileNumber:c.mobile_number=b.Identity;break;case Types.IdentityType.PhoneNumber2:c.phone_number_2=b.Identity;break;case Types.IdentityType.PhoneNumber3:c.phone_number_3=b.Identity;break;}return c}function convertEvent(a){if(!a)return null;switch(a.EventDataType){case Types.MessageType.AppStateTransition:return convertAST(a);case Types.MessageType.Commerce:return convertCommerceEvent(a);case Types.MessageType.CrashReport:return convertCrashReportEvent(a);case Types.MessageType.OptOut:return convertOptOutEvent(a);case Types.MessageType.PageEvent:// Note: Media Events are also sent as PageEvents/CustomEvents
471
+ var p=g&&!!g(CaptureIntegrationSpecificIds$1),q=g&&g(CaptureIntegrationSpecificIdsV2$1),r=q&&q!==Constants.CaptureIntegrationSpecificIdsV2Modes.None||!0===p;if(r){null===e||void 0===e?void 0:e.capture();var s=null===e||void 0===e?void 0:e.getClickIdsAsPartnerIdentities();isEmpty(s)||(o.partner_identities=s);}return o}function convertConsentState(a){if(isEmpty(a))return null;var b={gdpr:convertGdprConsentState(a.getGDPRConsentState()),ccpa:convertCcpaConsentState(a.getCCPAConsentState())};return b}function convertGdprConsentState(a){if(!a)return null;var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]={consented:a[c].Consented,hardware_id:a[c].HardwareId,document:a[c].ConsentDocument,timestamp_unixtime_ms:a[c].Timestamp,location:a[c].Location});return b}function convertCcpaConsentState(a){if(!a)return null;var b={data_sale_opt_out:{consented:a.Consented,hardware_id:a.HardwareId,document:a.ConsentDocument,timestamp_unixtime_ms:a.Timestamp,location:a.Location}};return b}function convertUserIdentities(a){if(!a||!a.length)return null;for(var b,c={},d=0,e=a;d<e.length;d++)switch(b=e[d],b.Type){case Types.IdentityType.CustomerId:c.customer_id=b.Identity;break;case Types.IdentityType.Email:c.email=b.Identity;break;case Types.IdentityType.Facebook:c.facebook=b.Identity;break;case Types.IdentityType.FacebookCustomAudienceId:c.facebook_custom_audience_id=b.Identity;break;case Types.IdentityType.Google:c.google=b.Identity;break;case Types.IdentityType.Microsoft:c.microsoft=b.Identity;break;case Types.IdentityType.Other:c.other=b.Identity;break;case Types.IdentityType.Other2:c.other_id_2=b.Identity;break;case Types.IdentityType.Other3:c.other_id_3=b.Identity;break;case Types.IdentityType.Other4:c.other_id_4=b.Identity;break;case Types.IdentityType.Other5:c.other_id_5=b.Identity;break;case Types.IdentityType.Other6:c.other_id_6=b.Identity;break;case Types.IdentityType.Other7:c.other_id_7=b.Identity;break;case Types.IdentityType.Other8:c.other_id_8=b.Identity;break;case Types.IdentityType.Other9:c.other_id_9=b.Identity;break;case Types.IdentityType.Other10:c.other_id_10=b.Identity;break;case Types.IdentityType.MobileNumber:c.mobile_number=b.Identity;break;case Types.IdentityType.PhoneNumber2:c.phone_number_2=b.Identity;break;case Types.IdentityType.PhoneNumber3:c.phone_number_3=b.Identity;break;}return c}function convertEvent(a){if(!a)return null;switch(a.EventDataType){case Types.MessageType.AppStateTransition:return convertAST(a);case Types.MessageType.Commerce:return convertCommerceEvent(a);case Types.MessageType.CrashReport:return convertCrashReportEvent(a);case Types.MessageType.OptOut:return convertOptOutEvent(a);case Types.MessageType.PageEvent:// Note: Media Events are also sent as PageEvents/CustomEvents
472
472
  return convertCustomEvent(a);case Types.MessageType.PageView:return convertPageViewEvent(a);case Types.MessageType.Profile://deprecated and not supported by the web SDK
473
473
  return null;case Types.MessageType.SessionEnd:return convertSessionEndEvent(a);case Types.MessageType.SessionStart:return convertSessionStartEvent(a);case Types.MessageType.UserAttributeChange:return convertUserAttributeChangeEvent(a);case Types.MessageType.UserIdentityChange:return convertUserIdentityChangeEvent(a);}return null}function convertProductActionType(a){if(!a)return dist.ProductActionActionEnum.unknown;return a===SDKProductActionType.AddToCart?dist.ProductActionActionEnum.addToCart:a===SDKProductActionType.AddToWishlist?dist.ProductActionActionEnum.addToWishlist:a===SDKProductActionType.Checkout?dist.ProductActionActionEnum.checkout:a===SDKProductActionType.CheckoutOption?dist.ProductActionActionEnum.checkoutOption:a===SDKProductActionType.Click?dist.ProductActionActionEnum.click:a===SDKProductActionType.Purchase?dist.ProductActionActionEnum.purchase:a===SDKProductActionType.Refund?dist.ProductActionActionEnum.refund:a===SDKProductActionType.RemoveFromCart?dist.ProductActionActionEnum.removeFromCart:a===SDKProductActionType.RemoveFromWishlist?dist.ProductActionActionEnum.removeFromWishlist:a===SDKProductActionType.ViewDetail?dist.ProductActionActionEnum.viewDetail:dist.ProductActionActionEnum.unknown}function convertProductAction(a){if(!a.ProductAction)return null;var b={action:convertProductActionType(a.ProductAction.ProductActionType),checkout_step:a.ProductAction.CheckoutStep,checkout_options:a.ProductAction.CheckoutOptions,transaction_id:a.ProductAction.TransactionId,affiliation:a.ProductAction.Affiliation,total_amount:a.ProductAction.TotalAmount,tax_amount:a.ProductAction.TaxAmount,shipping_amount:a.ProductAction.ShippingAmount,coupon_code:a.ProductAction.CouponCode,products:convertProducts(a.ProductAction.ProductList)};return b}function convertProducts(a){if(!a||!a.length)return null;for(var b=[],c=0,d=a;c<d.length;c++){var e=d[c],f={id:e.Sku,name:e.Name,brand:e.Brand,category:e.Category,variant:e.Variant,total_product_amount:e.TotalAmount,position:e.Position,price:e.Price,quantity:e.Quantity,coupon_code:e.CouponCode,custom_attributes:e.Attributes};b.push(f);}return b}function convertPromotionAction(a){if(!a.PromotionAction)return null;var b={action:a.PromotionAction.PromotionActionType,promotions:convertPromotions(a.PromotionAction.PromotionList)};return b}function convertPromotions(a){if(!a||!a.length)return null;for(var b=[],c=0,d=a;c<d.length;c++){var e=d[c],f={id:e.Id,name:e.Name,creative:e.Creative,position:e.Position};b.push(f);}return b}function convertImpressions(a){if(!a.ProductImpressions)return null;for(var b=[],c=0,d=a.ProductImpressions;c<d.length;c++){var e=d[c],f={product_impression_list:e.ProductImpressionList,products:convertProducts(e.ProductList)};b.push(f);}return b}function convertCommerceEvent(a){var b=convertBaseEventData(a),c={custom_flags:a.CustomFlags,product_action:convertProductAction(a),promotion_action:convertPromotionAction(a),product_impressions:convertImpressions(a),currency_code:a.CurrencyCode};return c=Object.assign(c,b),{event_type:dist.EventTypeEnum.commerceEvent,data:c}}function convertCrashReportEvent(a){var b=convertBaseEventData(a),c={message:a.EventName};return c=Object.assign(c,b),{event_type:dist.EventTypeEnum.crashReport,data:c}}function convertAST(a){var b=convertBaseEventData(a),c=dist.ApplicationStateTransitionEventDataApplicationTransitionTypeEnum,d=c.applicationBackground,e=c.applicationInitialized,f=a.IsBackgroundAST?d:e,g={application_transition_type:f,is_first_run:a.IsFirstRun,is_upgrade:!1,launch_referral:a.LaunchReferral};// Determine the transition type based on IsBackgroundAST flag
474
474
  return g=Object.assign(g,b),{event_type:dist.EventTypeEnum.applicationStateTransition,data:g}}function convertSessionEndEvent(a){var b=convertBaseEventData(a),c={session_duration_ms:a.SessionLength//note: External Events DTO does not support the session mpids array as of this time.
@@ -1335,11 +1335,7 @@ _scid:{mappedKey:"SnapchatConversions.Cookie1",output:IntegrationOutputs.CUSTOM_
1335
1335
  // https://go.mparticle.com/work/SQDSDKS-7167
1336
1336
  rtid:{mappedKey:"passbackconversiontrackingid",output:IntegrationOutputs.INTEGRATION_ATTRIBUTES,moduleId:1277},rclid:{mappedKey:"passbackconversiontrackingid",output:IntegrationOutputs.INTEGRATION_ATTRIBUTES,moduleId:1277},RoktTransactionId:{mappedKey:"passbackconversiontrackingid",output:IntegrationOutputs.INTEGRATION_ATTRIBUTES,moduleId:1277}},IntegrationCapture=/** @class */function(){function a(a){this.initialTimestamp=Date.now(),this.captureMode=a,this.filteredPartnerIdentityMappings=this.filterMappings(IntegrationOutputs.PARTNER_IDENTITIES),this.filteredCustomFlagMappings=this.filterMappings(IntegrationOutputs.CUSTOM_FLAGS),this.filteredIntegrationAttributeMappings=this.filterMappings(IntegrationOutputs.INTEGRATION_ATTRIBUTES);}/**
1337
1337
  * Captures Integration Ids from cookies and query params and stores them in clickIds object
1338
- */return a.prototype.capture=function(){var a=this.captureQueryParams()||{},b=this.captureCookies()||{},c=this.captureLocalStorage()||{};this.applyPinterestRules(a,c,b),a.fbclid&&b._fbc&&delete b._fbc;// ROKT Rules
1339
- // If both rtid or rclid and RoktTransactionId are present, prioritize rtid/rclid
1340
- // If RoktTransactionId is present in both cookies and localStorage,
1341
- // prioritize localStorage
1342
- var d=a.rtid||a.rclid,e=c.RoktTransactionId,f=b.RoktTransactionId;d?(e&&delete c.RoktTransactionId,f&&delete b.RoktTransactionId):e&&f&&delete b.RoktTransactionId,this.clickIds=__assign(__assign(__assign(__assign({},this.clickIds),a),c),b);},a.prototype.captureCookies=function(){var a=this.getAllowedKeysForMode(),b=getCookies(a);return this.applyProcessors(b,getHref(),this.initialTimestamp)},a.prototype.captureQueryParams=function(){var a=this.getQueryParams();return this.applyProcessors(a,getHref(),this.initialTimestamp)},a.prototype.captureLocalStorage=function(){for(var a=this.getAllowedKeysForMode(),b={},c=0,d=a;c<d.length;c++){var e=d[c],f=localStorage.getItem(e);f&&(b[e]=f);}return this.applyProcessors(b,getHref(),this.initialTimestamp)},a.prototype.getQueryParams=function(){var a=this.getAllowedKeysForMode();return queryStringParser(getHref(),a)},a.prototype.getClickIdsAsCustomFlags=function(){return this.getClickIds(this.clickIds,this.filteredCustomFlagMappings)},a.prototype.getClickIdsAsPartnerIdentities=function(){return this.getClickIds(this.clickIds,this.filteredPartnerIdentityMappings)},a.prototype.getClickIdsAsIntegrationAttributes=function(){var a,b,c,d={};// Integration IDs are stored in the following format:
1338
+ */return a.prototype.capture=function(){var a=this.captureQueryParams()||{},b=this.captureCookies()||{},c=this.captureLocalStorage()||{};this.normalizePinterestClickId(a),this.normalizePinterestClickId(c),this.normalizePinterestClickId(b),this.applySourcePrecedence([a,c,b,this.clickIds||{}]),this.clickIds=__assign(__assign(__assign(__assign({},this.clickIds),b),c),a);},a.prototype.captureCookies=function(){var a=this.getAllowedKeysForMode(),b=getCookies(a);return this.applyProcessors(b,getHref(),this.initialTimestamp)},a.prototype.captureQueryParams=function(){var a=this.getQueryParams();return this.applyProcessors(a,getHref(),this.initialTimestamp)},a.prototype.captureLocalStorage=function(){for(var a=this.getAllowedKeysForMode(),b={},c=0,d=a;c<d.length;c++){var e=d[c],f=localStorage.getItem(e);f&&(b[e]=f);}return this.applyProcessors(b,getHref(),this.initialTimestamp)},a.prototype.getQueryParams=function(){var a=this.getAllowedKeysForMode();return queryStringParser(getHref(),a)},a.prototype.getClickIdsAsCustomFlags=function(){return this.getClickIds(this.clickIds,this.filteredCustomFlagMappings)},a.prototype.getClickIdsAsPartnerIdentities=function(){return this.getClickIds(this.clickIds,this.filteredPartnerIdentityMappings)},a.prototype.getClickIdsAsIntegrationAttributes=function(){var a,b,c,d={};// Integration IDs are stored in the following format:
1343
1339
  // {
1344
1340
  // "integration_attributes": {
1345
1341
  // "<moduleId>": {
@@ -1347,7 +1343,7 @@ var d=a.rtid||a.rclid,e=c.RoktTransactionId,f=b.RoktTransactionId;d?(e&&delete c
1347
1343
  // }
1348
1344
  // }
1349
1345
  // }
1350
- for(var e in this.clickIds)if(this.clickIds.hasOwnProperty(e)){var f=this.clickIds[e],g=null===(b=this.filteredIntegrationAttributeMappings[e])||void 0===b?void 0:b.mappedKey;if(!isEmpty(g)){var h=null===(c=this.filteredIntegrationAttributeMappings[e])||void 0===c?void 0:c.moduleId;h&&!d[h]&&(d[h]=(a={},a[g]=f,a));}}return d},a.prototype.getClickIds=function(a,b){var c,d={};if(!a)return d;for(var e in a)if(a.hasOwnProperty(e)){var f=a[e],g=null===(c=b[e])||void 0===c?void 0:c.mappedKey;isEmpty(g)||(d[g]=f);}return d},a.prototype.normalizePinterestClickId=function(a){isEmpty(null===a||void 0===a?void 0:a._epik)||isEmpty(null===a||void 0===a?void 0:a.epik)||delete a.epik;},a.prototype.hasPinterestAlias=function(a){return !isEmpty(null===a||void 0===a?void 0:a.epik)||!isEmpty(null===a||void 0===a?void 0:a._epik)},a.prototype.applyPinterestRules=function(a,b,c){var d,e;return this.normalizePinterestClickId(a),this.normalizePinterestClickId(b),this.normalizePinterestClickId(c),(this.hasPinterestAlias(a)||this.hasPinterestAlias(b)||this.hasPinterestAlias(c))&&(null===(d=this.clickIds)||void 0===d||delete d.epik,null===(e=this.clickIds)||void 0===e||delete e._epik),this.hasPinterestAlias(a)?(delete c.epik,delete c._epik,delete b.epik,void delete b._epik):void(this.hasPinterestAlias(b)&&(delete c.epik,delete c._epik))},a.prototype.applyProcessors=function(a,b,c){var d,e={},f=this.getActiveIntegrationMapping();for(var g in a)if(a.hasOwnProperty(g)){var h=a[g],i=null===(d=f[g])||void 0===d?void 0:d.processor;e[g]=i?i(h,b,c):h;}return e},a.prototype.filterMappings=function(a){var b={},c=this.getActiveIntegrationMapping();for(var d in c)c[d].output===a&&(b[d]=c[d]);return b},a.prototype.getAllowedKeysForMode=function(){return Object.keys(this.getActiveIntegrationMapping())},a.prototype.getActiveIntegrationMapping=function(){return this.captureMode===Constants.CaptureIntegrationSpecificIdsV2Modes.RoktOnly?integrationMappingRokt:this.captureMode===Constants.CaptureIntegrationSpecificIdsV2Modes.All?__assign(__assign({},integrationMappingExternal),integrationMappingRokt):{}},a}();
1346
+ for(var e in this.clickIds)if(this.clickIds.hasOwnProperty(e)){var f=this.clickIds[e],g=null===(b=this.filteredIntegrationAttributeMappings[e])||void 0===b?void 0:b.mappedKey;if(!isEmpty(g)){var h=null===(c=this.filteredIntegrationAttributeMappings[e])||void 0===c?void 0:c.moduleId;h&&!d[h]&&(d[h]=(a={},a[g]=f,a));}}return d},a.prototype.getClickIds=function(a,b){var c,d={};if(!a)return d;for(var e in a)if(a.hasOwnProperty(e)){var f=a[e],g=null===(c=b[e])||void 0===c?void 0:c.mappedKey;isEmpty(g)||(d[g]=f);}return d},a.prototype.normalizePinterestClickId=function(a){isEmpty(null===a||void 0===a?void 0:a._epik)||isEmpty(null===a||void 0===a?void 0:a.epik)||delete a.epik;},a.prototype.applySourcePrecedence=function(a){for(var b=this.getActiveIntegrationMapping(),c=function outputOf(a){var c;return (null===(c=b[a])||void 0===c?void 0:c.mappedKey)||a},d=[],e=0,f=a;e<f.length;e++){var g=f[e],h=[];for(var i in g){var j=c(i);-1===d.indexOf(j)?!isEmpty(g[i])&&h.push(j):delete g[i];}d.push.apply(d,h);}},a.prototype.applyProcessors=function(a,b,c){var d,e={},f=this.getActiveIntegrationMapping();for(var g in a)if(a.hasOwnProperty(g)){var h=a[g],i=null===(d=f[g])||void 0===d?void 0:d.processor;e[g]=i?i(h,b,c):h;}return e},a.prototype.filterMappings=function(a){var b={},c=this.getActiveIntegrationMapping();for(var d in c)c[d].output===a&&(b[d]=c[d]);return b},a.prototype.getAllowedKeysForMode=function(){return Object.keys(this.getActiveIntegrationMapping())},a.prototype.getActiveIntegrationMapping=function(){return this.captureMode===Constants.CaptureIntegrationSpecificIdsV2Modes.RoktOnly?integrationMappingRokt:this.captureMode===Constants.CaptureIntegrationSpecificIdsV2Modes.All?__assign(__assign({},integrationMappingExternal),integrationMappingRokt):{}},a}();
1351
1347
 
1352
1348
  var PASSBACK_CONVERSION_TRACKING_ID="passbackconversiontrackingid",ON_SHOPPABLE_ADS_READY_METHOD="onShoppableAdsReady",RoktManager=/** @class */function(){// Keys this manager's route subscription, so a re-executed bundle's manager replaces
1353
1349
  // it while a second named instance keeps its own.
package/dist/mparticle.js CHANGED
@@ -204,7 +204,7 @@ var mParticle = (function () {
204
204
  Base64: Base64$1
205
205
  };
206
206
 
207
- var version = "3.10.0";
207
+ var version = "3.11.0";
208
208
 
209
209
  var Constants = {
210
210
  sdkVersion: version,
@@ -1888,6 +1888,7 @@ var mParticle = (function () {
1888
1888
  var integrationSpecificIdsV2 = getFeatureFlag && getFeatureFlag(CaptureIntegrationSpecificIdsV2$1);
1889
1889
  var isIntegrationCaptureEnabled = integrationSpecificIdsV2 && integrationSpecificIdsV2 !== Constants.CaptureIntegrationSpecificIdsV2Modes.None || integrationSpecificIds === true;
1890
1890
  if (isIntegrationCaptureEnabled) {
1891
+ _IntegrationCapture === null || _IntegrationCapture === void 0 ? void 0 : _IntegrationCapture.capture();
1891
1892
  var capturedPartnerIdentities = _IntegrationCapture === null || _IntegrationCapture === void 0 ? void 0 : _IntegrationCapture.getClickIdsAsPartnerIdentities();
1892
1893
  if (!isEmpty(capturedPartnerIdentities)) {
1893
1894
  upload.partner_identities = capturedPartnerIdentities;
@@ -10458,34 +10459,11 @@ var mParticle = (function () {
10458
10459
  var queryParams = this.captureQueryParams() || {};
10459
10460
  var cookies = this.captureCookies() || {};
10460
10461
  var localStorage = this.captureLocalStorage() || {};
10461
- this.applyPinterestRules(queryParams, localStorage, cookies);
10462
- // Facebook Rules
10463
- // Exclude _fbc if fbclid is present
10464
- // https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/fbp-and-fbc#retrieve-from-fbclid-url-query-parameter
10465
- if (queryParams['fbclid'] && cookies['_fbc']) {
10466
- delete cookies['_fbc'];
10467
- }
10468
- // ROKT Rules
10469
- // If both rtid or rclid and RoktTransactionId are present, prioritize rtid/rclid
10470
- // If RoktTransactionId is present in both cookies and localStorage,
10471
- // prioritize localStorage
10472
- var hasQueryParamId = queryParams['rtid'] || queryParams['rclid'];
10473
- var hasLocalStorageId = localStorage['RoktTransactionId'];
10474
- var hasCookieId = cookies['RoktTransactionId'];
10475
- if (hasQueryParamId) {
10476
- // Query param takes precedence, remove both localStorage and cookie if present
10477
- if (hasLocalStorageId) {
10478
- delete localStorage['RoktTransactionId'];
10479
- }
10480
- if (hasCookieId) {
10481
- delete cookies['RoktTransactionId'];
10482
- }
10483
- } else if (hasLocalStorageId && hasCookieId) {
10484
- // No query param, but both localStorage and cookie exist
10485
- // localStorage takes precedence over cookie
10486
- delete cookies['RoktTransactionId'];
10487
- }
10488
- this.clickIds = __assign(__assign(__assign(__assign({}, this.clickIds), queryParams), localStorage), cookies);
10462
+ this.normalizePinterestClickId(queryParams);
10463
+ this.normalizePinterestClickId(localStorage);
10464
+ this.normalizePinterestClickId(cookies);
10465
+ this.applySourcePrecedence([queryParams, localStorage, cookies, this.clickIds || {}]);
10466
+ this.clickIds = __assign(__assign(__assign(__assign({}, this.clickIds), cookies), localStorage), queryParams);
10489
10467
  };
10490
10468
  /**
10491
10469
  * Captures cookies based on the integration ID mapping.
@@ -10593,30 +10571,25 @@ var mParticle = (function () {
10593
10571
  delete clickIds['epik'];
10594
10572
  }
10595
10573
  };
10596
- IntegrationCapture.prototype.hasPinterestAlias = function (clickIds) {
10597
- return !isEmpty(clickIds === null || clickIds === void 0 ? void 0 : clickIds['epik']) || !isEmpty(clickIds === null || clickIds === void 0 ? void 0 : clickIds['_epik']);
10598
- };
10599
- IntegrationCapture.prototype.applyPinterestRules = function (queryParams, localStorage, cookies) {
10600
- var _a, _b;
10601
- this.normalizePinterestClickId(queryParams);
10602
- this.normalizePinterestClickId(localStorage);
10603
- this.normalizePinterestClickId(cookies);
10604
- // Cross-source precedence: query params > localStorage > cookies.
10605
- // Within the same source, prefer _epik when both aliases are present.
10606
- if (this.hasPinterestAlias(queryParams) || this.hasPinterestAlias(localStorage) || this.hasPinterestAlias(cookies)) {
10607
- (_a = this.clickIds) === null || _a === void 0 ? true : delete _a['epik'];
10608
- (_b = this.clickIds) === null || _b === void 0 ? true : delete _b['_epik'];
10609
- }
10610
- if (this.hasPinterestAlias(queryParams)) {
10611
- delete cookies['epik'];
10612
- delete cookies['_epik'];
10613
- delete localStorage['epik'];
10614
- delete localStorage['_epik'];
10615
- return;
10616
- }
10617
- if (this.hasPinterestAlias(localStorage)) {
10618
- delete cookies['epik'];
10619
- delete cookies['_epik'];
10574
+ IntegrationCapture.prototype.applySourcePrecedence = function (sourcesInPrecedenceOrder) {
10575
+ var mapping = this.getActiveIntegrationMapping();
10576
+ var outputOf = function outputOf(key) {
10577
+ var _a;
10578
+ return ((_a = mapping[key]) === null || _a === void 0 ? void 0 : _a.mappedKey) || key;
10579
+ };
10580
+ var outputsHeldByHigherSources = [];
10581
+ for (var _i = 0, sourcesInPrecedenceOrder_1 = sourcesInPrecedenceOrder; _i < sourcesInPrecedenceOrder_1.length; _i++) {
10582
+ var source = sourcesInPrecedenceOrder_1[_i];
10583
+ var outputsHeldBySource = [];
10584
+ for (var key in source) {
10585
+ var output = outputOf(key);
10586
+ if (outputsHeldByHigherSources.indexOf(output) !== -1) {
10587
+ delete source[key];
10588
+ } else if (!isEmpty(source[key])) {
10589
+ outputsHeldBySource.push(output);
10590
+ }
10591
+ }
10592
+ outputsHeldByHigherSources.push.apply(outputsHeldByHigherSources, outputsHeldBySource);
10620
10593
  }
10621
10594
  };
10622
10595
  IntegrationCapture.prototype.applyProcessors = function (clickIds, url, timestamp) {
@@ -66,8 +66,7 @@ export default class IntegrationCapture {
66
66
  getClickIdsAsIntegrationAttributes(): IntegrationAttributes;
67
67
  private getClickIds;
68
68
  private normalizePinterestClickId;
69
- private hasPinterestAlias;
70
- private applyPinterestRules;
69
+ private applySourcePrecedence;
71
70
  private applyProcessors;
72
71
  private filterMappings;
73
72
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mparticle/web-sdk",
3
- "version": "3.10.0",
3
+ "version": "3.11.0",
4
4
  "description": "mParticle core SDK for web applications",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [
@@ -186,42 +186,17 @@ export default class IntegrationCapture {
186
186
  const cookies = this.captureCookies() || {};
187
187
  const localStorage = this.captureLocalStorage() || {};
188
188
 
189
- this.applyPinterestRules(queryParams, localStorage, cookies);
189
+ this.normalizePinterestClickId(queryParams);
190
+ this.normalizePinterestClickId(localStorage);
191
+ this.normalizePinterestClickId(cookies);
190
192
 
191
- // Facebook Rules
192
- // Exclude _fbc if fbclid is present
193
- // https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/fbp-and-fbc#retrieve-from-fbclid-url-query-parameter
194
- if (queryParams['fbclid'] && cookies['_fbc']) {
195
- delete cookies['_fbc'];
196
- }
197
-
198
- // ROKT Rules
199
- // If both rtid or rclid and RoktTransactionId are present, prioritize rtid/rclid
200
- // If RoktTransactionId is present in both cookies and localStorage,
201
- // prioritize localStorage
202
- const hasQueryParamId = queryParams['rtid'] || queryParams['rclid'];
203
- const hasLocalStorageId = localStorage['RoktTransactionId'];
204
- const hasCookieId = cookies['RoktTransactionId'];
205
-
206
- if (hasQueryParamId) {
207
- // Query param takes precedence, remove both localStorage and cookie if present
208
- if (hasLocalStorageId) {
209
- delete localStorage['RoktTransactionId'];
210
- }
211
- if (hasCookieId) {
212
- delete cookies['RoktTransactionId'];
213
- }
214
- } else if (hasLocalStorageId && hasCookieId) {
215
- // No query param, but both localStorage and cookie exist
216
- // localStorage takes precedence over cookie
217
- delete cookies['RoktTransactionId'];
218
- }
193
+ this.applySourcePrecedence([queryParams, localStorage, cookies, this.clickIds || {}]);
219
194
 
220
195
  this.clickIds = {
221
196
  ...this.clickIds,
222
- ...queryParams,
197
+ ...cookies,
223
198
  ...localStorage,
224
- ...cookies
199
+ ...queryParams,
225
200
  };
226
201
  }
227
202
 
@@ -345,41 +320,22 @@ export default class IntegrationCapture {
345
320
  }
346
321
  }
347
322
 
348
- private hasPinterestAlias(clickIds: Dictionary<string>): boolean {
349
- return !isEmpty(clickIds?.['epik']) || !isEmpty(clickIds?.['_epik']);
350
- }
351
-
352
- private applyPinterestRules(
353
- queryParams: Dictionary<string>,
354
- localStorage: Dictionary<string>,
355
- cookies: Dictionary<string>,
356
- ): void {
357
- this.normalizePinterestClickId(queryParams);
358
- this.normalizePinterestClickId(localStorage);
359
- this.normalizePinterestClickId(cookies);
360
-
361
- // Cross-source precedence: query params > localStorage > cookies.
362
- // Within the same source, prefer _epik when both aliases are present.
363
- if (
364
- this.hasPinterestAlias(queryParams) ||
365
- this.hasPinterestAlias(localStorage) ||
366
- this.hasPinterestAlias(cookies)
367
- ) {
368
- delete this.clickIds?.['epik'];
369
- delete this.clickIds?.['_epik'];
370
- }
371
-
372
- if (this.hasPinterestAlias(queryParams)) {
373
- delete cookies['epik'];
374
- delete cookies['_epik'];
375
- delete localStorage['epik'];
376
- delete localStorage['_epik'];
377
- return;
378
- }
379
-
380
- if (this.hasPinterestAlias(localStorage)) {
381
- delete cookies['epik'];
382
- delete cookies['_epik'];
323
+ private applySourcePrecedence(sourcesInPrecedenceOrder: Dictionary<string>[]): void {
324
+ const mapping = this.getActiveIntegrationMapping();
325
+ const outputOf = (key: string): string => mapping[key]?.mappedKey || key;
326
+ const outputsHeldByHigherSources: string[] = [];
327
+
328
+ for (const source of sourcesInPrecedenceOrder) {
329
+ const outputsHeldBySource: string[] = [];
330
+ for (const key in source) {
331
+ const output = outputOf(key);
332
+ if (outputsHeldByHigherSources.indexOf(output) !== -1) {
333
+ delete source[key];
334
+ } else if (!isEmpty(source[key])) {
335
+ outputsHeldBySource.push(output);
336
+ }
337
+ }
338
+ outputsHeldByHigherSources.push(...outputsHeldBySource);
383
339
  }
384
340
  }
385
341
 
@@ -133,6 +133,7 @@ export function convertEvents(
133
133
  const isIntegrationCaptureEnabled = (integrationSpecificIdsV2 && integrationSpecificIdsV2 !== Constants.CaptureIntegrationSpecificIdsV2Modes.None) || integrationSpecificIds === true;
134
134
 
135
135
  if (isIntegrationCaptureEnabled) {
136
+ _IntegrationCapture?.capture();
136
137
  const capturedPartnerIdentities: PartnerIdentities = _IntegrationCapture?.getClickIdsAsPartnerIdentities();
137
138
  if (!isEmpty(capturedPartnerIdentities)) {
138
139
  upload.partner_identities = capturedPartnerIdentities;