@mparticle/web-sdk 2.15.5 → 2.16.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.
@@ -34,28 +34,28 @@ var defineProperty = _defineProperty;
34
34
 
35
35
  var _TriggerUploadType,MessageType={SessionStart:1,SessionEnd:2,PageView:3,PageEvent:4,CrashReport:5,OptOut:6,AppStateTransition:10,Profile:14,Commerce:16,Media:20,UserAttributeChange:17,UserIdentityChange:18},TriggerUploadType=(_TriggerUploadType={},defineProperty(_TriggerUploadType,MessageType.Commerce,1),defineProperty(_TriggerUploadType,MessageType.UserAttributeChange,1),defineProperty(_TriggerUploadType,MessageType.UserIdentityChange,1),_TriggerUploadType),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"}},CommerceEventType={ProductAddToCart:10,ProductRemoveFromCart:11,ProductCheckout:12,ProductCheckoutOption:13,ProductClick:14,ProductViewDetail:15,ProductPurchase:16,ProductRefund:17,PromotionView:18,PromotionClick:19,ProductAddToWishlist:20,ProductRemoveFromWishlist:21,ProductImpression:22},IdentityType={Other:0,CustomerId:1,Facebook:2,Twitter:3,Google:4,Microsoft:5,Yahoo:6,Email:7,FacebookCustomAudienceId:9,Other2:10,Other3:11,Other4:12,Other5:13,Other6:14,Other7:15,Other8:16,Other9:17,Other10:18,MobileNumber:19,PhoneNumber2:20,PhoneNumber3:21};IdentityType.isValid=function(a){if("number"==typeof a)for(var b in IdentityType)if(IdentityType.hasOwnProperty(b)&&IdentityType[b]===a)return !0;return !1},IdentityType.getName=function(a){return a===window.mParticle.IdentityType.CustomerId?"Customer ID":a===window.mParticle.IdentityType.Facebook?"Facebook ID":a===window.mParticle.IdentityType.Twitter?"Twitter ID":a===window.mParticle.IdentityType.Google?"Google ID":a===window.mParticle.IdentityType.Microsoft?"Microsoft ID":a===window.mParticle.IdentityType.Yahoo?"Yahoo ID":a===window.mParticle.IdentityType.Email?"Email":a===window.mParticle.IdentityType.FacebookCustomAudienceId?"Facebook App User ID":"Other ID"},IdentityType.getIdentityType=function(a){return "other"===a?IdentityType.Other:"customerid"===a?IdentityType.CustomerId:"facebook"===a?IdentityType.Facebook:"twitter"===a?IdentityType.Twitter:"google"===a?IdentityType.Google:"microsoft"===a?IdentityType.Microsoft:"yahoo"===a?IdentityType.Yahoo:"email"===a?IdentityType.Email:"facebookcustomaudienceid"===a?IdentityType.FacebookCustomAudienceId:"other2"===a?IdentityType.Other2:"other3"===a?IdentityType.Other3:"other4"===a?IdentityType.Other4:"other5"===a?IdentityType.Other5:"other6"===a?IdentityType.Other6:"other7"===a?IdentityType.Other7:"other8"===a?IdentityType.Other8:"other9"===a?IdentityType.Other9:"other10"===a?IdentityType.Other10:"mobile_number"===a?IdentityType.MobileNumber:"phone_number_2"===a?IdentityType.PhoneNumber2:!("phone_number_3"!=a)&&IdentityType.PhoneNumber3},IdentityType.getIdentityName=function(a){return a===IdentityType.Other?"other":a===IdentityType.CustomerId?"customerid":a===IdentityType.Facebook?"facebook":a===IdentityType.Twitter?"twitter":a===IdentityType.Google?"google":a===IdentityType.Microsoft?"microsoft":a===IdentityType.Yahoo?"yahoo":a===IdentityType.Email?"email":a===IdentityType.FacebookCustomAudienceId?"facebookcustomaudienceid":a===IdentityType.Other2?"other2":a===IdentityType.Other3?"other3":a===IdentityType.Other4?"other4":a===IdentityType.Other5?"other5":a===IdentityType.Other6?"other6":a===IdentityType.Other7?"other7":a===IdentityType.Other8?"other8":a===IdentityType.Other9?"other9":a===IdentityType.Other10?"other10":a===IdentityType.MobileNumber?"mobile_number":a===IdentityType.PhoneNumber2?"phone_number_2":a===IdentityType.PhoneNumber3?"phone_number_3":void 0};var ProductActionType={Unknown:0,AddToCart:1,RemoveFromCart:2,Checkout:3,CheckoutOption:4,Click:5,ViewDetail:6,Purchase:7,Refund:8,AddToWishlist:9,RemoveFromWishlist:10};ProductActionType.getName=function(a){return a===ProductActionType.AddToCart?"Add to Cart":a===ProductActionType.RemoveFromCart?"Remove from Cart":a===ProductActionType.Checkout?"Checkout":a===ProductActionType.CheckoutOption?"Checkout Option":a===ProductActionType.Click?"Click":a===ProductActionType.ViewDetail?"View Detail":a===ProductActionType.Purchase?"Purchase":a===ProductActionType.Refund?"Refund":a===ProductActionType.AddToWishlist?"Add to Wishlist":a===ProductActionType.RemoveFromWishlist?"Remove from Wishlist":"Unknown"},ProductActionType.getExpansionName=function(a){return a===ProductActionType.AddToCart?"add_to_cart":a===ProductActionType.RemoveFromCart?"remove_from_cart":a===ProductActionType.Checkout?"checkout":a===ProductActionType.CheckoutOption?"checkout_option":a===ProductActionType.Click?"click":a===ProductActionType.ViewDetail?"view_detail":a===ProductActionType.Purchase?"purchase":a===ProductActionType.Refund?"refund":a===ProductActionType.AddToWishlist?"add_to_wishlist":a===ProductActionType.RemoveFromWishlist?"remove_from_wishlist":"unknown"};var PromotionActionType={Unknown:0,PromotionView:1,PromotionClick:2};PromotionActionType.getName=function(a){return a===PromotionActionType.PromotionView?"view":a===PromotionActionType.PromotionClick?"click":"unknown"},PromotionActionType.getExpansionName=function(a){return a===PromotionActionType.PromotionView?"view":a===PromotionActionType.PromotionClick?"click":"unknown"};var ProfileMessageType={Logout:3},ApplicationTransitionType={AppInit:1};var Types = {MessageType:MessageType,EventType:EventType,CommerceEventType:CommerceEventType,IdentityType:IdentityType,ProfileMessageType:ProfileMessageType,ApplicationTransitionType:ApplicationTransitionType,ProductActionType:ProductActionType,PromotionActionType:PromotionActionType,TriggerUploadType:TriggerUploadType};
36
36
 
37
- var version = "2.15.5";
38
-
39
- var Constants={sdkVersion:version,sdkVendor:"mparticle",platform:"web",Messages:{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"},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. The onUserAlias provided is of type",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",// Name of the mP localstorage, had cp and pb even if cookies were used, skipped v2
40
- localStorageNameV3:"mprtcl-v3",// v3 Name of the mP localstorage, final version on SDKv1
41
- cookieName:"mprtcl-api",// v1 Name of the cookie stored on the user's machine
42
- cookieNameV2:"mprtcl-v2",// v2 Name of the cookie stored on the user's machine. Removed keys with no values, moved cartProducts and productBags to localStorage.
43
- cookieNameV3:"mprtcl-v3",// v3 Name of the cookie stored on the user's machine. Base64 encoded keys in Base64CookieKeys object, final version on SDKv1
44
- localStorageNameV4:"mprtcl-v4",// v4 Name of the mP localstorage, Current Version
45
- localStorageProductsV4:"mprtcl-prodv4",// The name for mP localstorage that contains products for cartProducs and productBags
46
- cookieNameV4:"mprtcl-v4",// v4 Name of the cookie stored on the user's machine. Base64 encoded keys in Base64CookieKeys object, current version on SDK v2
47
- currentStorageName:"mprtcl-v4",currentStorageProductsName:"mprtcl-prodv4"},DefaultConfig:{cookieDomain:null,// If null, defaults to current location.host
48
- cookieExpiration:365,// Cookie expiration time in days
49
- logLevel:null,// What logging will be provided in the console
50
- timeout:300,// timeout in milliseconds for logging functions
51
- sessionTimeout:30,// Session timeout in minutes
52
- maxProducts:20,// Number of products persisted in cartProducts and productBags
53
- forwarderStatsTimeout:5e3,// Milliseconds for forwarderStats timeout
54
- integrationDelayTimeout:5e3,// Milliseconds for forcing the integration delay to un-suspend event queueing due to integration partner errors
55
- maxCookieSize:3e3,// Number of bytes for cookie size to not exceed
56
- aliasMaxWindow:90,// Max age of Alias request startTime, in days
57
- uploadInterval:0// Maximum milliseconds in between batch uploads, below 500 will mean immediate upload
58
- },DefaultUrls:{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/"},Base64CookieKeys:{csm:1,sa:1,ss:1,ua:1,ui:1,csd:1,ia:1,con:1},SDKv2NonMPIDCookieKeys:{gs:1,cu:1,l:1,globalSettings:1,currentUserMPID:1},HTTPCodes:{noHttpCoverage:-1,activeIdentityRequest:-2,activeSession:-3,validationIssue:-4,nativeIdentityRequest:-5,loggingDisabledOrMissingAPIKey:-6,tooManyRequests:429},FeatureFlags:{ReportBatching:"reportBatching",EventsV3:"eventsV3",EventBatchingIntervalMillis:"eventBatchingIntervalMillis"},DefaultInstance:"default_instance"};
37
+ var version = "2.16.0";
38
+
39
+ var Constants = { sdkVersion: version, sdkVendor: "mparticle", platform: "web", Messages: { 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" }, 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. The onUserAlias provided is of type", 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",
40
+ localStorageNameV3: "mprtcl-v3",
41
+ cookieName: "mprtcl-api",
42
+ cookieNameV2: "mprtcl-v2",
43
+ cookieNameV3: "mprtcl-v3",
44
+ localStorageNameV4: "mprtcl-v4",
45
+ localStorageProductsV4: "mprtcl-prodv4",
46
+ cookieNameV4: "mprtcl-v4",
47
+ currentStorageName: "mprtcl-v4", currentStorageProductsName: "mprtcl-prodv4" }, DefaultConfig: { cookieDomain: null,
48
+ cookieExpiration: 365,
49
+ logLevel: null,
50
+ timeout: 300,
51
+ sessionTimeout: 30,
52
+ maxProducts: 20,
53
+ forwarderStatsTimeout: 5e3,
54
+ integrationDelayTimeout: 5e3,
55
+ maxCookieSize: 3e3,
56
+ aliasMaxWindow: 90,
57
+ uploadInterval: 0 // Maximum milliseconds in between batch uploads, below 500 will mean immediate upload
58
+ }, DefaultUrls: { 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/" }, Base64CookieKeys: { csm: 1, sa: 1, ss: 1, ua: 1, ui: 1, csd: 1, ia: 1, con: 1 }, SDKv2NonMPIDCookieKeys: { gs: 1, cu: 1, l: 1, globalSettings: 1, currentUserMPID: 1 }, HTTPCodes: { noHttpCoverage: -1, activeIdentityRequest: -2, activeSession: -3, validationIssue: -4, nativeIdentityRequest: -5, loggingDisabledOrMissingAPIKey: -6, tooManyRequests: 429 }, FeatureFlags: { ReportBatching: "reportBatching", EventsV3: "eventsV3", EventBatchingIntervalMillis: "eventBatchingIntervalMillis" }, DefaultInstance: "default_instance" };
59
59
 
60
60
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
61
61
 
@@ -1422,7 +1422,7 @@ catch (a) {
1422
1422
  finally {
1423
1423
  g.f();
1424
1424
  } if (!f)
1425
- return null; var h = { source_request_id: c._Helpers.generateUniqueId(), mpid: a, timestamp_unixtime_ms: new Date().getTime(), environment: f.Debug ? dist_4.development : dist_4.production, events: e, mp_deviceid: f.DeviceId, sdk_version: f.SDKVersion, application_info: { application_version: f.AppVersion, application_name: f.AppName }, device_info: { platform: dist_13.web, screen_width: window.screen.width, screen_height: window.screen.height }, user_attributes: f.UserAttributes, user_identities: convertUserIdentities(f.UserIdentities), consent_state: convertConsentState(f.ConsentState), integration_attributes: f.IntegrationAttributes }; return f.DataPlan && f.DataPlan.PlanId && (h.context = { data_plan: { plan_id: f.DataPlan.PlanId, plan_version: f.DataPlan.PlanVersion || void 0 } }), h; }
1425
+ return null; var h = { source_request_id: c._Helpers.generateUniqueId(), mpid: a, timestamp_unixtime_ms: new Date().getTime(), environment: f.Debug ? dist_4.development : dist_4.production, events: e, mp_deviceid: f.DeviceId, sdk_version: f.SDKVersion, application_info: { application_version: f.AppVersion, application_name: f.AppName, package: f.Package }, device_info: { platform: dist_13.web, screen_width: window.screen.width, screen_height: window.screen.height }, user_attributes: f.UserAttributes, user_identities: convertUserIdentities(f.UserIdentities), consent_state: convertConsentState(f.ConsentState), integration_attributes: f.IntegrationAttributes }; return f.DataPlan && f.DataPlan.PlanId && (h.context = { data_plan: { plan_id: f.DataPlan.PlanId, plan_version: f.DataPlan.PlanVersion || void 0 } }), h; }
1426
1426
  function convertConsentState(a) { if (!a)
1427
1427
  return null; var b = { gdpr: convertGdprConsentState(a.getGDPRConsentState()), ccpa: convertCcpaConsentState(a.getCCPAConsentState()) }; return b; }
1428
1428
  function convertGdprConsentState(a) { if (!a)
@@ -1706,13 +1706,13 @@ var BatchUploader = /*#__PURE__*/ function () {
1706
1706
  var d, e = [], f = new Map, g = _createForOfIteratorHelper$1(a);
1707
1707
  try {
1708
1708
  for (g.s(); !(d = g.n()).done;) {
1709
- var v = d.value; //on initial startup, there may be events logged without an mpid.
1710
- if (!v.MPID) {
1711
- var w = b.getMPID();
1712
- v.MPID = w;
1709
+ var w = d.value; //on initial startup, there may be events logged without an mpid.
1710
+ if (!w.MPID) {
1711
+ var x = b.getMPID();
1712
+ w.MPID = x;
1713
1713
  }
1714
- var x = f.get(v.MPID);
1715
- x || (x = []), x.push(v), f.set(v.MPID, x);
1714
+ var y = f.get(w.MPID);
1715
+ y || (y = []), y.push(w), f.set(w.MPID, y);
1716
1716
  }
1717
1717
  }
1718
1718
  catch (a) {
@@ -1736,8 +1736,8 @@ var BatchUploader = /*#__PURE__*/ function () {
1736
1736
  o.f();
1737
1737
  }
1738
1738
  for (var r = 0, s = Array.from(n.entries()); r < s.length; r++) {
1739
- var t = s[r], u = convertEvents(l, t[1], c);
1740
- u && e.push(u);
1739
+ var t = s[r], u = convertEvents(l, t[1], c), v = c._Store.SDKConfig.onCreateBatch;
1740
+ v && (u = v(u), u.mutated = !0), u && e.push(u);
1741
1741
  }
1742
1742
  }
1743
1743
  return e;
@@ -1875,7 +1875,7 @@ this.convertTransactionAttributesToProductAction=function(a,b){a.hasOwnProperty(
1875
1875
  return a._Helpers.parseNumber(b)};}
1876
1876
 
1877
1877
  function createSDKConfig(a){var b={};for(var c in Constants.DefaultConfig)Constants.DefaultConfig.hasOwnProperty(c)&&(b[c]=Constants.DefaultConfig[c]);if(a)for(c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);for(c in Constants.DefaultUrls)b[c]=Constants.DefaultUrls[c];return b}function Store(a,b){var c={isEnabled:!0,sessionAttributes:{},currentSessionMPIDs:[],consentState:null,sessionId:null,isFirstRun:null,clientId:null,deviceId:null,devToken:null,migrationData:{},serverSettings:{},dateLastEventSent:null,sessionStartDate:null,currentPosition:null,isTracking:!1,watchPositionId:null,cartProducts:[],eventQueue:[],currencyCode:null,globalTimer:null,context:"",configurationLoaded:!1,identityCallInFlight:!1,SDKConfig:{},migratingToIDSyncCookies:!1,nonCurrentUserMPIDs:{},identifyCalled:!1,isLoggedIn:!1,cookieSyncDates:{},integrationAttributes:{},requireDelay:!0,isLocalStorageAvailable:null,storageName:null,prodStorageName:null,activeForwarders:[],kits:{},configuredForwarders:[],pixelConfigurations:[]};for(var d in c)this[d]=c[d];// Set configuration to default settings
1878
- if(this.integrationDelayTimeoutStart=Date.now(),this.SDKConfig=createSDKConfig(a),a){if(a.deviceId&&(this.deviceId=a.deviceId),this.SDKConfig.isDevelopmentMode=!!a.hasOwnProperty("isDevelopmentMode")&&b._Helpers.returnConvertedBoolean(a.isDevelopmentMode),a.hasOwnProperty("v1SecureServiceUrl")&&(this.SDKConfig.v1SecureServiceUrl=a.v1SecureServiceUrl),a.hasOwnProperty("v2SecureServiceUrl")&&(this.SDKConfig.v2SecureServiceUrl=a.v2SecureServiceUrl),a.hasOwnProperty("v3SecureServiceUrl")&&(this.SDKConfig.v3SecureServiceUrl=a.v3SecureServiceUrl),a.hasOwnProperty("identityUrl")&&(this.SDKConfig.identityUrl=a.identityUrl),a.hasOwnProperty("aliasUrl")&&(this.SDKConfig.aliasUrl=a.aliasUrl),a.hasOwnProperty("configUrl")&&(this.SDKConfig.configUrl=a.configUrl),a.hasOwnProperty("logLevel")&&(this.SDKConfig.logLevel=a.logLevel),this.SDKConfig.useNativeSdk=!!a.hasOwnProperty("useNativeSdk")&&a.useNativeSdk,a.hasOwnProperty("kits")&&(this.SDKConfig.kits=a.kits),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),this.SDKConfig.integrationDelayTimeout=a.hasOwnProperty("integrationDelayTimeout")?a.integrationDelayTimeout:Constants.DefaultConfig.integrationDelayTimeout,a.hasOwnProperty("identifyRequest")&&(this.SDKConfig.identifyRequest=a.identifyRequest),a.hasOwnProperty("identityCallback")){var e=a.identityCallback;b._Helpers.Validators.isFunction(e)?this.SDKConfig.identityCallback=a.identityCallback:b.Logger.warning("The optional callback must be a function. You tried entering a(n) "+_typeof_1(e)," . 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},a.dataPlan.hasOwnProperty("planId")&&("string"==typeof a.dataPlan.planId?b._Helpers.isSlug(a.dataPlan.planId)?this.SDKConfig.dataPlan.PlanId=a.dataPlan.planId:b.Logger.error("Your data plan id must be in a slug format"):b.Logger.error("Your data plan id must be a string")),a.dataPlan.hasOwnProperty("planVersion")&&("number"==typeof a.dataPlan.planVersion?this.SDKConfig.dataPlan.PlanVersion=a.dataPlan.planVersion:b.Logger.error("Your data plan version must be a number"))),this.SDKConfig.forceHttps=!a.hasOwnProperty("forceHttps")||a.forceHttps,a.hasOwnProperty("customFlags")&&(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 f=a.dataPlanOptions;f.hasOwnProperty("dataPlanVersion")&&f.hasOwnProperty("blockUserAttributes")&&f.hasOwnProperty("blockEventAttributes")&&f.hasOwnProperty("blockEvents")&&f.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("flags")||(this.SDKConfig.flags={}),this.SDKConfig.flags.hasOwnProperty(Constants.FeatureFlags.EventsV3)||(this.SDKConfig.flags[Constants.FeatureFlags.EventsV3]=0),this.SDKConfig.flags.hasOwnProperty(Constants.FeatureFlags.EventBatchingIntervalMillis)||(this.SDKConfig.flags[Constants.FeatureFlags.EventBatchingIntervalMillis]=Constants.DefaultConfig.uploadInterval),this.SDKConfig.flags.hasOwnProperty(Constants.FeatureFlags.ReportBatching)||(this.SDKConfig.flags[Constants.FeatureFlags.ReportBatching]=!1);}}
1878
+ if(this.integrationDelayTimeoutStart=Date.now(),this.SDKConfig=createSDKConfig(a),a){if(a.deviceId&&(this.deviceId=a.deviceId),this.SDKConfig.isDevelopmentMode=!!a.hasOwnProperty("isDevelopmentMode")&&b._Helpers.returnConvertedBoolean(a.isDevelopmentMode),a.hasOwnProperty("v1SecureServiceUrl")&&(this.SDKConfig.v1SecureServiceUrl=a.v1SecureServiceUrl),a.hasOwnProperty("v2SecureServiceUrl")&&(this.SDKConfig.v2SecureServiceUrl=a.v2SecureServiceUrl),a.hasOwnProperty("v3SecureServiceUrl")&&(this.SDKConfig.v3SecureServiceUrl=a.v3SecureServiceUrl),a.hasOwnProperty("identityUrl")&&(this.SDKConfig.identityUrl=a.identityUrl),a.hasOwnProperty("aliasUrl")&&(this.SDKConfig.aliasUrl=a.aliasUrl),a.hasOwnProperty("configUrl")&&(this.SDKConfig.configUrl=a.configUrl),a.hasOwnProperty("logLevel")&&(this.SDKConfig.logLevel=a.logLevel),this.SDKConfig.useNativeSdk=!!a.hasOwnProperty("useNativeSdk")&&a.useNativeSdk,a.hasOwnProperty("kits")&&(this.SDKConfig.kits=a.kits),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 e=a.identityCallback;b._Helpers.Validators.isFunction(e)?this.SDKConfig.identityCallback=a.identityCallback:b.Logger.warning("The optional callback must be a function. You tried entering a(n) "+_typeof_1(e)," . 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},a.dataPlan.hasOwnProperty("planId")&&("string"==typeof a.dataPlan.planId?b._Helpers.isSlug(a.dataPlan.planId)?this.SDKConfig.dataPlan.PlanId=a.dataPlan.planId:b.Logger.error("Your data plan id must be in a slug format"):b.Logger.error("Your data plan id must be a string")),a.dataPlan.hasOwnProperty("planVersion")&&("number"==typeof a.dataPlan.planVersion?this.SDKConfig.dataPlan.PlanVersion=a.dataPlan.planVersion:b.Logger.error("Your data plan version must be a number"))),this.SDKConfig.forceHttps=!a.hasOwnProperty("forceHttps")||a.forceHttps,a.hasOwnProperty("customFlags")&&(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 f=a.dataPlanOptions;f.hasOwnProperty("dataPlanVersion")&&f.hasOwnProperty("blockUserAttributes")&&f.hasOwnProperty("blockEventAttributes")&&f.hasOwnProperty("blockEvents")&&f.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)),a.hasOwnProperty("flags")||(this.SDKConfig.flags={}),this.SDKConfig.flags.hasOwnProperty(Constants.FeatureFlags.EventsV3)||(this.SDKConfig.flags[Constants.FeatureFlags.EventsV3]=0),this.SDKConfig.flags.hasOwnProperty(Constants.FeatureFlags.EventBatchingIntervalMillis)||(this.SDKConfig.flags[Constants.FeatureFlags.EventBatchingIntervalMillis]=Constants.DefaultConfig.uploadInterval),this.SDKConfig.flags.hasOwnProperty(Constants.FeatureFlags.ReportBatching)||(this.SDKConfig.flags[Constants.FeatureFlags.ReportBatching]=!1);}}
1879
1879
 
1880
1880
  function Logger(a){var b=this,c=a.logLevel||"warning";this.logger=a.hasOwnProperty("logger")?a.logger:new ConsoleLogger,this.verbose=function(a){"none"!==c&&b.logger.verbose&&"verbose"===c&&b.logger.verbose(a);},this.warning=function(a){"none"!==c&&b.logger.warning&&("verbose"===c||"warning"===c)&&b.logger.warning(a);},this.error=function(a){"none"!==c&&b.logger.error&&b.logger.error(a);},this.setLogLevel=function(a){c=a;};}function ConsoleLogger(){this.verbose=function(a){console&&console.info&&console.info(a);},this.error=function(a){console&&console.error&&console.error(a);},this.warning=function(a){console&&console.warn&&console.warn(a);};}
1881
1881
 
@@ -1954,7 +1954,7 @@ if(c={},c=a._Helpers.extend(!0,c,b),b.EventDataType===Types.MessageType.PageEven
1954
1954
  if(c.EventAttributes&&(b.EventDataType===Types.MessageType.PageEvent?g(c,a._Store.activeForwarders[k].attributeFilters):b.EventDataType===Types.MessageType.PageView&&g(c,a._Store.activeForwarders[k].screenAttributeFilters)),f(c,a._Store.activeForwarders[k].userIdentityFilters),c.UserAttributes=a._Helpers.filterUserAttributes(c.UserAttributes,a._Store.activeForwarders[k].userAttributeFilters),a._Store.activeForwarders[k].process){a.Logger.verbose("Sending message to forwarder: "+a._Store.activeForwarders[k].name);var q=a._Store.activeForwarders[k].process(c);q&&a.Logger.verbose(q);}}}},this.callSetUserAttributeOnForwarders=function(c,d){b&&b.isAttributeKeyBlocked(c)||a._Store.activeForwarders.length&&a._Store.activeForwarders.forEach(function(b){if(b.setUserAttribute&&b.userAttributeFilters&&!a._Helpers.inArray(b.userAttributeFilters,a._Helpers.generateHash(c)))try{var e=b.setUserAttribute(c,d);e&&a.Logger.verbose(e);}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);"identify"===d?f.onIdentifyComplete&&(e=f.onIdentifyComplete(g),e&&a.Logger.verbose(e)):"login"===d?f.onLoginComplete&&(e=f.onLoginComplete(g),e&&a.Logger.verbose(e)):"logout"===d?f.onLogoutComplete&&(e=f.onLogoutComplete(g),e&&a.Logger.verbose(e)):"modify"==d&&f.onModifyComplete&&(e=f.onModifyComplete(g),e&&a.Logger.verbose(e));});},this.getForwarderStatsQueue=function(){return a._Persistence.forwardingStatsBatches.forwardingStatsEventQueue},this.setForwarderStatsQueue=function(b){a._Persistence.forwardingStatsBatches.forwardingStatsEventQueue=b;},this.configureForwarder=function(b){var c=null,d=b,e={};// if there are kits inside of mpInstance._Store.SDKConfig.kits, then mParticle is self hosted
1955
1955
  for(var f in a._Helpers.isObject(a._Store.SDKConfig.kits)&&0<Object.keys(a._Store.SDKConfig.kits).length?e=a._Store.SDKConfig.kits:0<a._preInit.forwarderConstructors.length&&a._preInit.forwarderConstructors.forEach(function(a){e[a.name]=a;}),e)if(f===d.name&&(d.isDebug===a._Store.SDKConfig.isDevelopmentMode||d.isSandbox===a._Store.SDKConfig.isDevelopmentMode)){c=new e[f].constructor,c.id=d.moduleId,c.isSandbox=d.isDebug||d.isSandbox,c.hasSandbox="true"===d.hasDebugString,c.isVisible=d.isVisible,c.settings=d.settings,c.eventNameFilters=d.eventNameFilters,c.eventTypeFilters=d.eventTypeFilters,c.attributeFilters=d.attributeFilters,c.screenNameFilters=d.screenNameFilters,c.screenNameFilters=d.screenNameFilters,c.screenAttributeFilters=d.screenAttributeFilters,c.userIdentityFilters=d.userIdentityFilters,c.userAttributeFilters=d.userAttributeFilters,c.filteringEventAttributeValue=d.filteringEventAttributeValue,c.filteringUserAttributeValue=d.filteringUserAttributeValue,c.eventSubscriptionId=d.eventSubscriptionId,c.filteringConsentRuleValues=d.filteringConsentRuleValues,c.excludeAnonymousUser=d.excludeAnonymousUser,a._Store.configuredForwarders.push(c);break}},this.configurePixel=function(b){(b.isDebug===a._Store.SDKConfig.isDevelopmentMode||b.isProduction!==a._Store.SDKConfig.isDevelopmentMode)&&a._Store.pixelConfigurations.push(b);},this.processForwarders=function(b,d){if(!b)a.Logger.warning("No config was passed. Cannot process forwarders");else try{Array.isArray(b.kitConfigs)&&b.kitConfigs.length&&b.kitConfigs.forEach(function(a){c.configureForwarder(a);}),Array.isArray(b.pixelConfigs)&&b.pixelConfigs.length&&b.pixelConfigs.forEach(function(a){c.configurePixel(a);}),c.initForwarders(a._Store.SDKConfig.identifyRequest.userIdentities,d);}catch(b){a.Logger.error("Config was not parsed propertly. Forwarders may not be initialized.");}};}
1956
1956
 
1957
- var MessageType$1=Types.MessageType,ApplicationTransitionType$1=Types.ApplicationTransitionType;function ServerModel(a){function b(a,b){var c=[];for(var d in b.flags={},a.CustomFlags)c=[],a.CustomFlags.hasOwnProperty(d)&&(Array.isArray(a.CustomFlags[d])?a.CustomFlags[d].forEach(function(a){("number"==typeof a||"string"==typeof a||"boolean"==typeof a)&&c.push(a.toString());}):("number"==typeof a.CustomFlags[d]||"string"==typeof a.CustomFlags[d]||"boolean"==typeof a.CustomFlags[d])&&c.push(a.CustomFlags[d].toString()),c.length&&(b.flags[d]=c));}function c(a){return a?a.map(function(a){return d(a)}):[]}function d(b){return {id:a._Helpers.parseStringOrNumber(b.Sku),nm:a._Helpers.parseStringOrNumber(b.Name),pr:a._Helpers.parseNumber(b.Price),qt:a._Helpers.parseNumber(b.Quantity),br:a._Helpers.parseStringOrNumber(b.Brand),va:a._Helpers.parseStringOrNumber(b.Variant),ca:a._Helpers.parseStringOrNumber(b.Category),ps:a._Helpers.parseNumber(b.Position),cc:a._Helpers.parseStringOrNumber(b.CouponCode),tpa:a._Helpers.parseNumber(b.TotalAmount),attrs:b.Attributes}}var e=this;this.appendUserInfo=function(b,c){if(c){if(!b)return c.MPID=null,c.ConsentState=null,c.UserAttributes=null,void(c.UserIdentities=null);if(!(c.MPID&&c.MPID===b.getMPID())){c.MPID=b.getMPID(),c.ConsentState=b.getConsentState(),c.UserAttributes=b.getAllUserAttributes();var d=b.getUserIdentities().userIdentities,e={};for(var f in d){var g=Types.IdentityType.getIdentityType(f);!1!==g&&(e[g]=d[f]);}var h=[];if(a._Helpers.isObject(e)&&Object.keys(e).length)for(var i in e){var j={};j.Identity=e[i],j.Type=a._Helpers.parseNumber(i),h.push(j);}c.UserIdentities=h;}}},this.convertToConsentStateDTO=function(a){if(!a)return null;var b={},c=a.getGDPRConsentState();if(c){var d={};for(var e in b.gdpr=d,c)if(c.hasOwnProperty(e)){var f=c[e];b.gdpr[e]={},"boolean"==typeof f.Consented&&(d[e].c=f.Consented),"number"==typeof f.Timestamp&&(d[e].ts=f.Timestamp),"string"==typeof f.ConsentDocument&&(d[e].d=f.ConsentDocument),"string"==typeof f.Location&&(d[e].l=f.Location),"string"==typeof f.HardwareId&&(d[e].h=f.HardwareId);}}var g=a.getCCPAConsentState();return g&&(b.ccpa={data_sale_opt_out:{c:g.Consented,ts:g.Timestamp,d:g.ConsentDocument,l:g.Location,h:g.HardwareId}}),b},this.createEventObject=function(b,c){var d={},f={},g=b.messageType===Types.MessageType.OptOut?!a._Store.isEnabled:null;if(a._Store.sessionId||b.messageType==Types.MessageType.OptOut||a._Store.webviewBridgeEnabled){f=b.hasOwnProperty("toEventAPIObject")?b.toEventAPIObject():{EventName:b.name||b.messageType,EventCategory:b.eventType,EventAttributes:a._Helpers.sanitizeAttributes(b.data,b.name),SourceMessageId:b.sourceMessageId||a._Helpers.generateUniqueId(),EventDataType:b.messageType,CustomFlags:b.customFlags||{},UserAttributeChanges:b.userAttributeChanges,UserIdentityChanges:b.userIdentityChanges},b.messageType!==Types.MessageType.SessionEnd&&(a._Store.dateLastEventSent=new Date),d={Store:a._Store.serverSettings,SDKVersion:Constants.sdkVersion,SessionId:a._Store.sessionId,SessionStartDate:a._Store.sessionStartDate?a._Store.sessionStartDate.getTime():0,Debug:a._Store.SDKConfig.isDevelopmentMode,Location:a._Store.currentPosition,OptOut:g,ExpandedEventCount:0,AppVersion:a.getAppVersion(),AppName:a.getAppName(),ClientGeneratedId:a._Store.clientId,DeviceId:a._Store.deviceId,IntegrationAttributes:a._Store.integrationAttributes,CurrencyCode:a._Store.currencyCode,DataPlan:a._Store.SDKConfig.dataPlan?a._Store.SDKConfig.dataPlan:{}},f.EventDataType===MessageType$1.AppStateTransition&&(f.IsFirstRun=a._Store.isFirstRun,f.LaunchReferral=window.location.href||null),f.CurrencyCode=a._Store.currencyCode;var h=c||a.Identity.getCurrentUser();return e.appendUserInfo(h,f),b.messageType===Types.MessageType.SessionEnd&&(f.SessionLength=a._Store.dateLastEventSent.getTime()-a._Store.sessionStartDate.getTime(),f.currentSessionMPIDs=a._Store.currentSessionMPIDs,f.EventAttributes=a._Store.sessionAttributes,a._Store.currentSessionMPIDs=[],a._Store.sessionStartDate=null),d.Timestamp=a._Store.dateLastEventSent.getTime(),a._Helpers.extend({},f,d)}return null},this.convertEventToDTO=function(d){var f={n:d.EventName,et:d.EventCategory,ua:d.UserAttributes,ui:d.UserIdentities,ia:d.IntegrationAttributes,str:d.Store,attrs:d.EventAttributes,sdk:d.SDKVersion,sid:d.SessionId,sl:d.SessionLength,ssd:d.SessionStartDate,dt:d.EventDataType,dbg:d.Debug,ct:d.Timestamp,lc:d.Location,o:d.OptOut,eec:d.ExpandedEventCount,av:d.AppVersion,cgid:d.ClientGeneratedId,das:d.DeviceId,mpid:d.MPID,smpids:d.currentSessionMPIDs};d.DataPlan&&d.DataPlan.PlanId&&(f.dp_id=d.DataPlan.PlanId,d.DataPlan.PlanVersion&&(f.dp_v=d.DataPlan.PlanVersion));var g=e.convertToConsentStateDTO(d.ConsentState);return g&&(f.con=g),d.EventDataType===MessageType$1.AppStateTransition&&(f.fr=d.IsFirstRun,f.iu=!1,f.at=ApplicationTransitionType$1.AppInit,f.lr=d.LaunchReferral,f.attrs=null),d.CustomFlags&&b(d,f),d.EventDataType===MessageType$1.Commerce?(f.cu=d.CurrencyCode,d.ShoppingCart&&(f.sc={pl:c(d.ShoppingCart.ProductList)}),d.ProductAction?f.pd={an:d.ProductAction.ProductActionType,cs:a._Helpers.parseNumber(d.ProductAction.CheckoutStep),co:d.ProductAction.CheckoutOptions,pl:c(d.ProductAction.ProductList),ti:d.ProductAction.TransactionId,ta:d.ProductAction.Affiliation,tcc:d.ProductAction.CouponCode,tr:a._Helpers.parseNumber(d.ProductAction.TotalAmount),ts:a._Helpers.parseNumber(d.ProductAction.ShippingAmount),tt:a._Helpers.parseNumber(d.ProductAction.TaxAmount)}:d.PromotionAction?f.pm={an:d.PromotionAction.PromotionActionType,pl:d.PromotionAction.PromotionList.map(function(a){return {id:a.Id,nm:a.Name,cr:a.Creative,ps:a.Position?a.Position:0}})}:d.ProductImpressions&&(f.pi=d.ProductImpressions.map(function(a){return {pil:a.ProductImpressionList,pl:c(a.ProductList)}}))):d.EventDataType===MessageType$1.Profile&&(f.pet=d.ProfileMessageType),f};}
1957
+ var MessageType$1=Types.MessageType,ApplicationTransitionType$1=Types.ApplicationTransitionType;function ServerModel(a){function b(a,b){var c=[];for(var d in b.flags={},a.CustomFlags)c=[],a.CustomFlags.hasOwnProperty(d)&&(Array.isArray(a.CustomFlags[d])?a.CustomFlags[d].forEach(function(a){("number"==typeof a||"string"==typeof a||"boolean"==typeof a)&&c.push(a.toString());}):("number"==typeof a.CustomFlags[d]||"string"==typeof a.CustomFlags[d]||"boolean"==typeof a.CustomFlags[d])&&c.push(a.CustomFlags[d].toString()),c.length&&(b.flags[d]=c));}function c(a){return a?a.map(function(a){return d(a)}):[]}function d(b){return {id:a._Helpers.parseStringOrNumber(b.Sku),nm:a._Helpers.parseStringOrNumber(b.Name),pr:a._Helpers.parseNumber(b.Price),qt:a._Helpers.parseNumber(b.Quantity),br:a._Helpers.parseStringOrNumber(b.Brand),va:a._Helpers.parseStringOrNumber(b.Variant),ca:a._Helpers.parseStringOrNumber(b.Category),ps:a._Helpers.parseNumber(b.Position),cc:a._Helpers.parseStringOrNumber(b.CouponCode),tpa:a._Helpers.parseNumber(b.TotalAmount),attrs:b.Attributes}}var e=this;this.appendUserInfo=function(b,c){if(c){if(!b)return c.MPID=null,c.ConsentState=null,c.UserAttributes=null,void(c.UserIdentities=null);if(!(c.MPID&&c.MPID===b.getMPID())){c.MPID=b.getMPID(),c.ConsentState=b.getConsentState(),c.UserAttributes=b.getAllUserAttributes();var d=b.getUserIdentities().userIdentities,e={};for(var f in d){var g=Types.IdentityType.getIdentityType(f);!1!==g&&(e[g]=d[f]);}var h=[];if(a._Helpers.isObject(e)&&Object.keys(e).length)for(var i in e){var j={};j.Identity=e[i],j.Type=a._Helpers.parseNumber(i),h.push(j);}c.UserIdentities=h;}}},this.convertToConsentStateDTO=function(a){if(!a)return null;var b={},c=a.getGDPRConsentState();if(c){var d={};for(var e in b.gdpr=d,c)if(c.hasOwnProperty(e)){var f=c[e];b.gdpr[e]={},"boolean"==typeof f.Consented&&(d[e].c=f.Consented),"number"==typeof f.Timestamp&&(d[e].ts=f.Timestamp),"string"==typeof f.ConsentDocument&&(d[e].d=f.ConsentDocument),"string"==typeof f.Location&&(d[e].l=f.Location),"string"==typeof f.HardwareId&&(d[e].h=f.HardwareId);}}var g=a.getCCPAConsentState();return g&&(b.ccpa={data_sale_opt_out:{c:g.Consented,ts:g.Timestamp,d:g.ConsentDocument,l:g.Location,h:g.HardwareId}}),b},this.createEventObject=function(b,c){var d={},f={},g=b.messageType===Types.MessageType.OptOut?!a._Store.isEnabled:null;if(a._Store.sessionId||b.messageType==Types.MessageType.OptOut||a._Store.webviewBridgeEnabled){f=b.hasOwnProperty("toEventAPIObject")?b.toEventAPIObject():{EventName:b.name||b.messageType,EventCategory:b.eventType,EventAttributes:a._Helpers.sanitizeAttributes(b.data,b.name),SourceMessageId:b.sourceMessageId||a._Helpers.generateUniqueId(),EventDataType:b.messageType,CustomFlags:b.customFlags||{},UserAttributeChanges:b.userAttributeChanges,UserIdentityChanges:b.userIdentityChanges},b.messageType!==Types.MessageType.SessionEnd&&(a._Store.dateLastEventSent=new Date),d={Store:a._Store.serverSettings,SDKVersion:Constants.sdkVersion,SessionId:a._Store.sessionId,SessionStartDate:a._Store.sessionStartDate?a._Store.sessionStartDate.getTime():0,Debug:a._Store.SDKConfig.isDevelopmentMode,Location:a._Store.currentPosition,OptOut:g,ExpandedEventCount:0,AppVersion:a.getAppVersion(),AppName:a.getAppName(),Package:a._Store.SDKConfig["package"],ClientGeneratedId:a._Store.clientId,DeviceId:a._Store.deviceId,IntegrationAttributes:a._Store.integrationAttributes,CurrencyCode:a._Store.currencyCode,DataPlan:a._Store.SDKConfig.dataPlan?a._Store.SDKConfig.dataPlan:{}},f.EventDataType===MessageType$1.AppStateTransition&&(f.IsFirstRun=a._Store.isFirstRun,f.LaunchReferral=window.location.href||null),f.CurrencyCode=a._Store.currencyCode;var h=c||a.Identity.getCurrentUser();return e.appendUserInfo(h,f),b.messageType===Types.MessageType.SessionEnd&&(f.SessionLength=a._Store.dateLastEventSent.getTime()-a._Store.sessionStartDate.getTime(),f.currentSessionMPIDs=a._Store.currentSessionMPIDs,f.EventAttributes=a._Store.sessionAttributes,a._Store.currentSessionMPIDs=[],a._Store.sessionStartDate=null),d.Timestamp=a._Store.dateLastEventSent.getTime(),a._Helpers.extend({},f,d)}return null},this.convertEventToDTO=function(d){var f={n:d.EventName,et:d.EventCategory,ua:d.UserAttributes,ui:d.UserIdentities,ia:d.IntegrationAttributes,str:d.Store,attrs:d.EventAttributes,sdk:d.SDKVersion,sid:d.SessionId,sl:d.SessionLength,ssd:d.SessionStartDate,dt:d.EventDataType,dbg:d.Debug,ct:d.Timestamp,lc:d.Location,o:d.OptOut,eec:d.ExpandedEventCount,av:d.AppVersion,cgid:d.ClientGeneratedId,das:d.DeviceId,mpid:d.MPID,smpids:d.currentSessionMPIDs};d.DataPlan&&d.DataPlan.PlanId&&(f.dp_id=d.DataPlan.PlanId,d.DataPlan.PlanVersion&&(f.dp_v=d.DataPlan.PlanVersion));var g=e.convertToConsentStateDTO(d.ConsentState);return g&&(f.con=g),d.EventDataType===MessageType$1.AppStateTransition&&(f.fr=d.IsFirstRun,f.iu=!1,f.at=ApplicationTransitionType$1.AppInit,f.lr=d.LaunchReferral,f.attrs=null),d.CustomFlags&&b(d,f),d.EventDataType===MessageType$1.Commerce?(f.cu=d.CurrencyCode,d.ShoppingCart&&(f.sc={pl:c(d.ShoppingCart.ProductList)}),d.ProductAction?f.pd={an:d.ProductAction.ProductActionType,cs:a._Helpers.parseNumber(d.ProductAction.CheckoutStep),co:d.ProductAction.CheckoutOptions,pl:c(d.ProductAction.ProductList),ti:d.ProductAction.TransactionId,ta:d.ProductAction.Affiliation,tcc:d.ProductAction.CouponCode,tr:a._Helpers.parseNumber(d.ProductAction.TotalAmount),ts:a._Helpers.parseNumber(d.ProductAction.ShippingAmount),tt:a._Helpers.parseNumber(d.ProductAction.TaxAmount)}:d.PromotionAction?f.pm={an:d.PromotionAction.PromotionActionType,pl:d.PromotionAction.PromotionList.map(function(a){return {id:a.Id,nm:a.Name,cr:a.Creative,ps:a.Position?a.Position:0}})}:d.ProductImpressions&&(f.pi=d.ProductImpressions.map(function(a){return {pil:a.ProductImpressionList,pl:c(a.ProductList)}}))):d.EventDataType===MessageType$1.Profile&&(f.pet=d.ProfileMessageType),f};}
1958
1958
 
1959
1959
  function forwardingStatsUploader(a){function b(){var b=a._Forwarders.getForwarderStatsQueue(),c=a._Persistence.forwardingStatsBatches.uploadsTable,d=Date.now();for(var e in b.length&&(c[d]={uploading:!1,data:b},a._Forwarders.setForwarderStatsQueue([])),c)(function(b){if(c.hasOwnProperty(b)&&!1===c[b].uploading){var d=function(){4===e.readyState&&(200===e.status||202===e.status?(a.Logger.verbose("Successfully sent "+e.statusText+" from server"),delete c[b]):"4"===e.status.toString()[0]?429!==e.status&&delete c[b]:c[b].uploading=!1);},e=a._Helpers.createXHR(d),f=c[b].data;c[b].uploading=!0,a._APIClient.sendBatchForwardingStatsToServer(f,e);}})(e);}this.startForwardingStatsTimer=function(){mParticle._forwardingStatsTimer=setInterval(function(){b();},a._Store.SDKConfig.forwarderStatsTimeout);};}
1960
1960
 
@@ -34,28 +34,28 @@ var defineProperty = _defineProperty;
34
34
 
35
35
  var _TriggerUploadType,MessageType={SessionStart:1,SessionEnd:2,PageView:3,PageEvent:4,CrashReport:5,OptOut:6,AppStateTransition:10,Profile:14,Commerce:16,Media:20,UserAttributeChange:17,UserIdentityChange:18},TriggerUploadType=(_TriggerUploadType={},defineProperty(_TriggerUploadType,MessageType.Commerce,1),defineProperty(_TriggerUploadType,MessageType.UserAttributeChange,1),defineProperty(_TriggerUploadType,MessageType.UserIdentityChange,1),_TriggerUploadType),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"}},CommerceEventType={ProductAddToCart:10,ProductRemoveFromCart:11,ProductCheckout:12,ProductCheckoutOption:13,ProductClick:14,ProductViewDetail:15,ProductPurchase:16,ProductRefund:17,PromotionView:18,PromotionClick:19,ProductAddToWishlist:20,ProductRemoveFromWishlist:21,ProductImpression:22},IdentityType={Other:0,CustomerId:1,Facebook:2,Twitter:3,Google:4,Microsoft:5,Yahoo:6,Email:7,FacebookCustomAudienceId:9,Other2:10,Other3:11,Other4:12,Other5:13,Other6:14,Other7:15,Other8:16,Other9:17,Other10:18,MobileNumber:19,PhoneNumber2:20,PhoneNumber3:21};IdentityType.isValid=function(a){if("number"==typeof a)for(var b in IdentityType)if(IdentityType.hasOwnProperty(b)&&IdentityType[b]===a)return !0;return !1},IdentityType.getName=function(a){return a===window.mParticle.IdentityType.CustomerId?"Customer ID":a===window.mParticle.IdentityType.Facebook?"Facebook ID":a===window.mParticle.IdentityType.Twitter?"Twitter ID":a===window.mParticle.IdentityType.Google?"Google ID":a===window.mParticle.IdentityType.Microsoft?"Microsoft ID":a===window.mParticle.IdentityType.Yahoo?"Yahoo ID":a===window.mParticle.IdentityType.Email?"Email":a===window.mParticle.IdentityType.FacebookCustomAudienceId?"Facebook App User ID":"Other ID"},IdentityType.getIdentityType=function(a){return "other"===a?IdentityType.Other:"customerid"===a?IdentityType.CustomerId:"facebook"===a?IdentityType.Facebook:"twitter"===a?IdentityType.Twitter:"google"===a?IdentityType.Google:"microsoft"===a?IdentityType.Microsoft:"yahoo"===a?IdentityType.Yahoo:"email"===a?IdentityType.Email:"facebookcustomaudienceid"===a?IdentityType.FacebookCustomAudienceId:"other2"===a?IdentityType.Other2:"other3"===a?IdentityType.Other3:"other4"===a?IdentityType.Other4:"other5"===a?IdentityType.Other5:"other6"===a?IdentityType.Other6:"other7"===a?IdentityType.Other7:"other8"===a?IdentityType.Other8:"other9"===a?IdentityType.Other9:"other10"===a?IdentityType.Other10:"mobile_number"===a?IdentityType.MobileNumber:"phone_number_2"===a?IdentityType.PhoneNumber2:!("phone_number_3"!=a)&&IdentityType.PhoneNumber3},IdentityType.getIdentityName=function(a){return a===IdentityType.Other?"other":a===IdentityType.CustomerId?"customerid":a===IdentityType.Facebook?"facebook":a===IdentityType.Twitter?"twitter":a===IdentityType.Google?"google":a===IdentityType.Microsoft?"microsoft":a===IdentityType.Yahoo?"yahoo":a===IdentityType.Email?"email":a===IdentityType.FacebookCustomAudienceId?"facebookcustomaudienceid":a===IdentityType.Other2?"other2":a===IdentityType.Other3?"other3":a===IdentityType.Other4?"other4":a===IdentityType.Other5?"other5":a===IdentityType.Other6?"other6":a===IdentityType.Other7?"other7":a===IdentityType.Other8?"other8":a===IdentityType.Other9?"other9":a===IdentityType.Other10?"other10":a===IdentityType.MobileNumber?"mobile_number":a===IdentityType.PhoneNumber2?"phone_number_2":a===IdentityType.PhoneNumber3?"phone_number_3":void 0};var ProductActionType={Unknown:0,AddToCart:1,RemoveFromCart:2,Checkout:3,CheckoutOption:4,Click:5,ViewDetail:6,Purchase:7,Refund:8,AddToWishlist:9,RemoveFromWishlist:10};ProductActionType.getName=function(a){return a===ProductActionType.AddToCart?"Add to Cart":a===ProductActionType.RemoveFromCart?"Remove from Cart":a===ProductActionType.Checkout?"Checkout":a===ProductActionType.CheckoutOption?"Checkout Option":a===ProductActionType.Click?"Click":a===ProductActionType.ViewDetail?"View Detail":a===ProductActionType.Purchase?"Purchase":a===ProductActionType.Refund?"Refund":a===ProductActionType.AddToWishlist?"Add to Wishlist":a===ProductActionType.RemoveFromWishlist?"Remove from Wishlist":"Unknown"},ProductActionType.getExpansionName=function(a){return a===ProductActionType.AddToCart?"add_to_cart":a===ProductActionType.RemoveFromCart?"remove_from_cart":a===ProductActionType.Checkout?"checkout":a===ProductActionType.CheckoutOption?"checkout_option":a===ProductActionType.Click?"click":a===ProductActionType.ViewDetail?"view_detail":a===ProductActionType.Purchase?"purchase":a===ProductActionType.Refund?"refund":a===ProductActionType.AddToWishlist?"add_to_wishlist":a===ProductActionType.RemoveFromWishlist?"remove_from_wishlist":"unknown"};var PromotionActionType={Unknown:0,PromotionView:1,PromotionClick:2};PromotionActionType.getName=function(a){return a===PromotionActionType.PromotionView?"view":a===PromotionActionType.PromotionClick?"click":"unknown"},PromotionActionType.getExpansionName=function(a){return a===PromotionActionType.PromotionView?"view":a===PromotionActionType.PromotionClick?"click":"unknown"};var ProfileMessageType={Logout:3},ApplicationTransitionType={AppInit:1};var Types = {MessageType:MessageType,EventType:EventType,CommerceEventType:CommerceEventType,IdentityType:IdentityType,ProfileMessageType:ProfileMessageType,ApplicationTransitionType:ApplicationTransitionType,ProductActionType:ProductActionType,PromotionActionType:PromotionActionType,TriggerUploadType:TriggerUploadType};
36
36
 
37
- var version = "2.15.5";
38
-
39
- var Constants={sdkVersion:version,sdkVendor:"mparticle",platform:"web",Messages:{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"},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. The onUserAlias provided is of type",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",// Name of the mP localstorage, had cp and pb even if cookies were used, skipped v2
40
- localStorageNameV3:"mprtcl-v3",// v3 Name of the mP localstorage, final version on SDKv1
41
- cookieName:"mprtcl-api",// v1 Name of the cookie stored on the user's machine
42
- cookieNameV2:"mprtcl-v2",// v2 Name of the cookie stored on the user's machine. Removed keys with no values, moved cartProducts and productBags to localStorage.
43
- cookieNameV3:"mprtcl-v3",// v3 Name of the cookie stored on the user's machine. Base64 encoded keys in Base64CookieKeys object, final version on SDKv1
44
- localStorageNameV4:"mprtcl-v4",// v4 Name of the mP localstorage, Current Version
45
- localStorageProductsV4:"mprtcl-prodv4",// The name for mP localstorage that contains products for cartProducs and productBags
46
- cookieNameV4:"mprtcl-v4",// v4 Name of the cookie stored on the user's machine. Base64 encoded keys in Base64CookieKeys object, current version on SDK v2
47
- currentStorageName:"mprtcl-v4",currentStorageProductsName:"mprtcl-prodv4"},DefaultConfig:{cookieDomain:null,// If null, defaults to current location.host
48
- cookieExpiration:365,// Cookie expiration time in days
49
- logLevel:null,// What logging will be provided in the console
50
- timeout:300,// timeout in milliseconds for logging functions
51
- sessionTimeout:30,// Session timeout in minutes
52
- maxProducts:20,// Number of products persisted in cartProducts and productBags
53
- forwarderStatsTimeout:5e3,// Milliseconds for forwarderStats timeout
54
- integrationDelayTimeout:5e3,// Milliseconds for forcing the integration delay to un-suspend event queueing due to integration partner errors
55
- maxCookieSize:3e3,// Number of bytes for cookie size to not exceed
56
- aliasMaxWindow:90,// Max age of Alias request startTime, in days
57
- uploadInterval:0// Maximum milliseconds in between batch uploads, below 500 will mean immediate upload
58
- },DefaultUrls:{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/"},Base64CookieKeys:{csm:1,sa:1,ss:1,ua:1,ui:1,csd:1,ia:1,con:1},SDKv2NonMPIDCookieKeys:{gs:1,cu:1,l:1,globalSettings:1,currentUserMPID:1},HTTPCodes:{noHttpCoverage:-1,activeIdentityRequest:-2,activeSession:-3,validationIssue:-4,nativeIdentityRequest:-5,loggingDisabledOrMissingAPIKey:-6,tooManyRequests:429},FeatureFlags:{ReportBatching:"reportBatching",EventsV3:"eventsV3",EventBatchingIntervalMillis:"eventBatchingIntervalMillis"},DefaultInstance:"default_instance"};
37
+ var version = "2.16.0";
38
+
39
+ var Constants = { sdkVersion: version, sdkVendor: "mparticle", platform: "web", Messages: { 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" }, 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. The onUserAlias provided is of type", 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",
40
+ localStorageNameV3: "mprtcl-v3",
41
+ cookieName: "mprtcl-api",
42
+ cookieNameV2: "mprtcl-v2",
43
+ cookieNameV3: "mprtcl-v3",
44
+ localStorageNameV4: "mprtcl-v4",
45
+ localStorageProductsV4: "mprtcl-prodv4",
46
+ cookieNameV4: "mprtcl-v4",
47
+ currentStorageName: "mprtcl-v4", currentStorageProductsName: "mprtcl-prodv4" }, DefaultConfig: { cookieDomain: null,
48
+ cookieExpiration: 365,
49
+ logLevel: null,
50
+ timeout: 300,
51
+ sessionTimeout: 30,
52
+ maxProducts: 20,
53
+ forwarderStatsTimeout: 5e3,
54
+ integrationDelayTimeout: 5e3,
55
+ maxCookieSize: 3e3,
56
+ aliasMaxWindow: 90,
57
+ uploadInterval: 0 // Maximum milliseconds in between batch uploads, below 500 will mean immediate upload
58
+ }, DefaultUrls: { 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/" }, Base64CookieKeys: { csm: 1, sa: 1, ss: 1, ua: 1, ui: 1, csd: 1, ia: 1, con: 1 }, SDKv2NonMPIDCookieKeys: { gs: 1, cu: 1, l: 1, globalSettings: 1, currentUserMPID: 1 }, HTTPCodes: { noHttpCoverage: -1, activeIdentityRequest: -2, activeSession: -3, validationIssue: -4, nativeIdentityRequest: -5, loggingDisabledOrMissingAPIKey: -6, tooManyRequests: 429 }, FeatureFlags: { ReportBatching: "reportBatching", EventsV3: "eventsV3", EventBatchingIntervalMillis: "eventBatchingIntervalMillis" }, DefaultInstance: "default_instance" };
59
59
 
60
60
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
61
61
 
@@ -1422,7 +1422,7 @@ catch (a) {
1422
1422
  finally {
1423
1423
  g.f();
1424
1424
  } if (!f)
1425
- return null; var h = { source_request_id: c._Helpers.generateUniqueId(), mpid: a, timestamp_unixtime_ms: new Date().getTime(), environment: f.Debug ? dist_4.development : dist_4.production, events: e, mp_deviceid: f.DeviceId, sdk_version: f.SDKVersion, application_info: { application_version: f.AppVersion, application_name: f.AppName }, device_info: { platform: dist_13.web, screen_width: window.screen.width, screen_height: window.screen.height }, user_attributes: f.UserAttributes, user_identities: convertUserIdentities(f.UserIdentities), consent_state: convertConsentState(f.ConsentState), integration_attributes: f.IntegrationAttributes }; return f.DataPlan && f.DataPlan.PlanId && (h.context = { data_plan: { plan_id: f.DataPlan.PlanId, plan_version: f.DataPlan.PlanVersion || void 0 } }), h; }
1425
+ return null; var h = { source_request_id: c._Helpers.generateUniqueId(), mpid: a, timestamp_unixtime_ms: new Date().getTime(), environment: f.Debug ? dist_4.development : dist_4.production, events: e, mp_deviceid: f.DeviceId, sdk_version: f.SDKVersion, application_info: { application_version: f.AppVersion, application_name: f.AppName, package: f.Package }, device_info: { platform: dist_13.web, screen_width: window.screen.width, screen_height: window.screen.height }, user_attributes: f.UserAttributes, user_identities: convertUserIdentities(f.UserIdentities), consent_state: convertConsentState(f.ConsentState), integration_attributes: f.IntegrationAttributes }; return f.DataPlan && f.DataPlan.PlanId && (h.context = { data_plan: { plan_id: f.DataPlan.PlanId, plan_version: f.DataPlan.PlanVersion || void 0 } }), h; }
1426
1426
  function convertConsentState(a) { if (!a)
1427
1427
  return null; var b = { gdpr: convertGdprConsentState(a.getGDPRConsentState()), ccpa: convertCcpaConsentState(a.getCCPAConsentState()) }; return b; }
1428
1428
  function convertGdprConsentState(a) { if (!a)
@@ -1706,13 +1706,13 @@ var BatchUploader = /*#__PURE__*/ function () {
1706
1706
  var d, e = [], f = new Map, g = _createForOfIteratorHelper$1(a);
1707
1707
  try {
1708
1708
  for (g.s(); !(d = g.n()).done;) {
1709
- var v = d.value; //on initial startup, there may be events logged without an mpid.
1710
- if (!v.MPID) {
1711
- var w = b.getMPID();
1712
- v.MPID = w;
1709
+ var w = d.value; //on initial startup, there may be events logged without an mpid.
1710
+ if (!w.MPID) {
1711
+ var x = b.getMPID();
1712
+ w.MPID = x;
1713
1713
  }
1714
- var x = f.get(v.MPID);
1715
- x || (x = []), x.push(v), f.set(v.MPID, x);
1714
+ var y = f.get(w.MPID);
1715
+ y || (y = []), y.push(w), f.set(w.MPID, y);
1716
1716
  }
1717
1717
  }
1718
1718
  catch (a) {
@@ -1736,8 +1736,8 @@ var BatchUploader = /*#__PURE__*/ function () {
1736
1736
  o.f();
1737
1737
  }
1738
1738
  for (var r = 0, s = Array.from(n.entries()); r < s.length; r++) {
1739
- var t = s[r], u = convertEvents(l, t[1], c);
1740
- u && e.push(u);
1739
+ var t = s[r], u = convertEvents(l, t[1], c), v = c._Store.SDKConfig.onCreateBatch;
1740
+ v && (u = v(u), u.mutated = !0), u && e.push(u);
1741
1741
  }
1742
1742
  }
1743
1743
  return e;
@@ -1875,7 +1875,7 @@ this.convertTransactionAttributesToProductAction=function(a,b){a.hasOwnProperty(
1875
1875
  return a._Helpers.parseNumber(b)};}
1876
1876
 
1877
1877
  function createSDKConfig(a){var b={};for(var c in Constants.DefaultConfig)Constants.DefaultConfig.hasOwnProperty(c)&&(b[c]=Constants.DefaultConfig[c]);if(a)for(c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);for(c in Constants.DefaultUrls)b[c]=Constants.DefaultUrls[c];return b}function Store(a,b){var c={isEnabled:!0,sessionAttributes:{},currentSessionMPIDs:[],consentState:null,sessionId:null,isFirstRun:null,clientId:null,deviceId:null,devToken:null,migrationData:{},serverSettings:{},dateLastEventSent:null,sessionStartDate:null,currentPosition:null,isTracking:!1,watchPositionId:null,cartProducts:[],eventQueue:[],currencyCode:null,globalTimer:null,context:"",configurationLoaded:!1,identityCallInFlight:!1,SDKConfig:{},migratingToIDSyncCookies:!1,nonCurrentUserMPIDs:{},identifyCalled:!1,isLoggedIn:!1,cookieSyncDates:{},integrationAttributes:{},requireDelay:!0,isLocalStorageAvailable:null,storageName:null,prodStorageName:null,activeForwarders:[],kits:{},configuredForwarders:[],pixelConfigurations:[]};for(var d in c)this[d]=c[d];// Set configuration to default settings
1878
- if(this.integrationDelayTimeoutStart=Date.now(),this.SDKConfig=createSDKConfig(a),a){if(a.deviceId&&(this.deviceId=a.deviceId),this.SDKConfig.isDevelopmentMode=!!a.hasOwnProperty("isDevelopmentMode")&&b._Helpers.returnConvertedBoolean(a.isDevelopmentMode),a.hasOwnProperty("v1SecureServiceUrl")&&(this.SDKConfig.v1SecureServiceUrl=a.v1SecureServiceUrl),a.hasOwnProperty("v2SecureServiceUrl")&&(this.SDKConfig.v2SecureServiceUrl=a.v2SecureServiceUrl),a.hasOwnProperty("v3SecureServiceUrl")&&(this.SDKConfig.v3SecureServiceUrl=a.v3SecureServiceUrl),a.hasOwnProperty("identityUrl")&&(this.SDKConfig.identityUrl=a.identityUrl),a.hasOwnProperty("aliasUrl")&&(this.SDKConfig.aliasUrl=a.aliasUrl),a.hasOwnProperty("configUrl")&&(this.SDKConfig.configUrl=a.configUrl),a.hasOwnProperty("logLevel")&&(this.SDKConfig.logLevel=a.logLevel),this.SDKConfig.useNativeSdk=!!a.hasOwnProperty("useNativeSdk")&&a.useNativeSdk,a.hasOwnProperty("kits")&&(this.SDKConfig.kits=a.kits),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),this.SDKConfig.integrationDelayTimeout=a.hasOwnProperty("integrationDelayTimeout")?a.integrationDelayTimeout:Constants.DefaultConfig.integrationDelayTimeout,a.hasOwnProperty("identifyRequest")&&(this.SDKConfig.identifyRequest=a.identifyRequest),a.hasOwnProperty("identityCallback")){var e=a.identityCallback;b._Helpers.Validators.isFunction(e)?this.SDKConfig.identityCallback=a.identityCallback:b.Logger.warning("The optional callback must be a function. You tried entering a(n) "+_typeof_1(e)," . 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},a.dataPlan.hasOwnProperty("planId")&&("string"==typeof a.dataPlan.planId?b._Helpers.isSlug(a.dataPlan.planId)?this.SDKConfig.dataPlan.PlanId=a.dataPlan.planId:b.Logger.error("Your data plan id must be in a slug format"):b.Logger.error("Your data plan id must be a string")),a.dataPlan.hasOwnProperty("planVersion")&&("number"==typeof a.dataPlan.planVersion?this.SDKConfig.dataPlan.PlanVersion=a.dataPlan.planVersion:b.Logger.error("Your data plan version must be a number"))),this.SDKConfig.forceHttps=!a.hasOwnProperty("forceHttps")||a.forceHttps,a.hasOwnProperty("customFlags")&&(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 f=a.dataPlanOptions;f.hasOwnProperty("dataPlanVersion")&&f.hasOwnProperty("blockUserAttributes")&&f.hasOwnProperty("blockEventAttributes")&&f.hasOwnProperty("blockEvents")&&f.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("flags")||(this.SDKConfig.flags={}),this.SDKConfig.flags.hasOwnProperty(Constants.FeatureFlags.EventsV3)||(this.SDKConfig.flags[Constants.FeatureFlags.EventsV3]=0),this.SDKConfig.flags.hasOwnProperty(Constants.FeatureFlags.EventBatchingIntervalMillis)||(this.SDKConfig.flags[Constants.FeatureFlags.EventBatchingIntervalMillis]=Constants.DefaultConfig.uploadInterval),this.SDKConfig.flags.hasOwnProperty(Constants.FeatureFlags.ReportBatching)||(this.SDKConfig.flags[Constants.FeatureFlags.ReportBatching]=!1);}}
1878
+ if(this.integrationDelayTimeoutStart=Date.now(),this.SDKConfig=createSDKConfig(a),a){if(a.deviceId&&(this.deviceId=a.deviceId),this.SDKConfig.isDevelopmentMode=!!a.hasOwnProperty("isDevelopmentMode")&&b._Helpers.returnConvertedBoolean(a.isDevelopmentMode),a.hasOwnProperty("v1SecureServiceUrl")&&(this.SDKConfig.v1SecureServiceUrl=a.v1SecureServiceUrl),a.hasOwnProperty("v2SecureServiceUrl")&&(this.SDKConfig.v2SecureServiceUrl=a.v2SecureServiceUrl),a.hasOwnProperty("v3SecureServiceUrl")&&(this.SDKConfig.v3SecureServiceUrl=a.v3SecureServiceUrl),a.hasOwnProperty("identityUrl")&&(this.SDKConfig.identityUrl=a.identityUrl),a.hasOwnProperty("aliasUrl")&&(this.SDKConfig.aliasUrl=a.aliasUrl),a.hasOwnProperty("configUrl")&&(this.SDKConfig.configUrl=a.configUrl),a.hasOwnProperty("logLevel")&&(this.SDKConfig.logLevel=a.logLevel),this.SDKConfig.useNativeSdk=!!a.hasOwnProperty("useNativeSdk")&&a.useNativeSdk,a.hasOwnProperty("kits")&&(this.SDKConfig.kits=a.kits),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 e=a.identityCallback;b._Helpers.Validators.isFunction(e)?this.SDKConfig.identityCallback=a.identityCallback:b.Logger.warning("The optional callback must be a function. You tried entering a(n) "+_typeof_1(e)," . 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},a.dataPlan.hasOwnProperty("planId")&&("string"==typeof a.dataPlan.planId?b._Helpers.isSlug(a.dataPlan.planId)?this.SDKConfig.dataPlan.PlanId=a.dataPlan.planId:b.Logger.error("Your data plan id must be in a slug format"):b.Logger.error("Your data plan id must be a string")),a.dataPlan.hasOwnProperty("planVersion")&&("number"==typeof a.dataPlan.planVersion?this.SDKConfig.dataPlan.PlanVersion=a.dataPlan.planVersion:b.Logger.error("Your data plan version must be a number"))),this.SDKConfig.forceHttps=!a.hasOwnProperty("forceHttps")||a.forceHttps,a.hasOwnProperty("customFlags")&&(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 f=a.dataPlanOptions;f.hasOwnProperty("dataPlanVersion")&&f.hasOwnProperty("blockUserAttributes")&&f.hasOwnProperty("blockEventAttributes")&&f.hasOwnProperty("blockEvents")&&f.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)),a.hasOwnProperty("flags")||(this.SDKConfig.flags={}),this.SDKConfig.flags.hasOwnProperty(Constants.FeatureFlags.EventsV3)||(this.SDKConfig.flags[Constants.FeatureFlags.EventsV3]=0),this.SDKConfig.flags.hasOwnProperty(Constants.FeatureFlags.EventBatchingIntervalMillis)||(this.SDKConfig.flags[Constants.FeatureFlags.EventBatchingIntervalMillis]=Constants.DefaultConfig.uploadInterval),this.SDKConfig.flags.hasOwnProperty(Constants.FeatureFlags.ReportBatching)||(this.SDKConfig.flags[Constants.FeatureFlags.ReportBatching]=!1);}}
1879
1879
 
1880
1880
  function Logger(a){var b=this,c=a.logLevel||"warning";this.logger=a.hasOwnProperty("logger")?a.logger:new ConsoleLogger,this.verbose=function(a){"none"!==c&&b.logger.verbose&&"verbose"===c&&b.logger.verbose(a);},this.warning=function(a){"none"!==c&&b.logger.warning&&("verbose"===c||"warning"===c)&&b.logger.warning(a);},this.error=function(a){"none"!==c&&b.logger.error&&b.logger.error(a);},this.setLogLevel=function(a){c=a;};}function ConsoleLogger(){this.verbose=function(a){console&&console.info&&console.info(a);},this.error=function(a){console&&console.error&&console.error(a);},this.warning=function(a){console&&console.warn&&console.warn(a);};}
1881
1881
 
@@ -1954,7 +1954,7 @@ if(c={},c=a._Helpers.extend(!0,c,b),b.EventDataType===Types.MessageType.PageEven
1954
1954
  if(c.EventAttributes&&(b.EventDataType===Types.MessageType.PageEvent?g(c,a._Store.activeForwarders[k].attributeFilters):b.EventDataType===Types.MessageType.PageView&&g(c,a._Store.activeForwarders[k].screenAttributeFilters)),f(c,a._Store.activeForwarders[k].userIdentityFilters),c.UserAttributes=a._Helpers.filterUserAttributes(c.UserAttributes,a._Store.activeForwarders[k].userAttributeFilters),a._Store.activeForwarders[k].process){a.Logger.verbose("Sending message to forwarder: "+a._Store.activeForwarders[k].name);var q=a._Store.activeForwarders[k].process(c);q&&a.Logger.verbose(q);}}}},this.callSetUserAttributeOnForwarders=function(c,d){b&&b.isAttributeKeyBlocked(c)||a._Store.activeForwarders.length&&a._Store.activeForwarders.forEach(function(b){if(b.setUserAttribute&&b.userAttributeFilters&&!a._Helpers.inArray(b.userAttributeFilters,a._Helpers.generateHash(c)))try{var e=b.setUserAttribute(c,d);e&&a.Logger.verbose(e);}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);"identify"===d?f.onIdentifyComplete&&(e=f.onIdentifyComplete(g),e&&a.Logger.verbose(e)):"login"===d?f.onLoginComplete&&(e=f.onLoginComplete(g),e&&a.Logger.verbose(e)):"logout"===d?f.onLogoutComplete&&(e=f.onLogoutComplete(g),e&&a.Logger.verbose(e)):"modify"==d&&f.onModifyComplete&&(e=f.onModifyComplete(g),e&&a.Logger.verbose(e));});},this.getForwarderStatsQueue=function(){return a._Persistence.forwardingStatsBatches.forwardingStatsEventQueue},this.setForwarderStatsQueue=function(b){a._Persistence.forwardingStatsBatches.forwardingStatsEventQueue=b;},this.configureForwarder=function(b){var c=null,d=b,e={};// if there are kits inside of mpInstance._Store.SDKConfig.kits, then mParticle is self hosted
1955
1955
  for(var f in a._Helpers.isObject(a._Store.SDKConfig.kits)&&0<Object.keys(a._Store.SDKConfig.kits).length?e=a._Store.SDKConfig.kits:0<a._preInit.forwarderConstructors.length&&a._preInit.forwarderConstructors.forEach(function(a){e[a.name]=a;}),e)if(f===d.name&&(d.isDebug===a._Store.SDKConfig.isDevelopmentMode||d.isSandbox===a._Store.SDKConfig.isDevelopmentMode)){c=new e[f].constructor,c.id=d.moduleId,c.isSandbox=d.isDebug||d.isSandbox,c.hasSandbox="true"===d.hasDebugString,c.isVisible=d.isVisible,c.settings=d.settings,c.eventNameFilters=d.eventNameFilters,c.eventTypeFilters=d.eventTypeFilters,c.attributeFilters=d.attributeFilters,c.screenNameFilters=d.screenNameFilters,c.screenNameFilters=d.screenNameFilters,c.screenAttributeFilters=d.screenAttributeFilters,c.userIdentityFilters=d.userIdentityFilters,c.userAttributeFilters=d.userAttributeFilters,c.filteringEventAttributeValue=d.filteringEventAttributeValue,c.filteringUserAttributeValue=d.filteringUserAttributeValue,c.eventSubscriptionId=d.eventSubscriptionId,c.filteringConsentRuleValues=d.filteringConsentRuleValues,c.excludeAnonymousUser=d.excludeAnonymousUser,a._Store.configuredForwarders.push(c);break}},this.configurePixel=function(b){(b.isDebug===a._Store.SDKConfig.isDevelopmentMode||b.isProduction!==a._Store.SDKConfig.isDevelopmentMode)&&a._Store.pixelConfigurations.push(b);},this.processForwarders=function(b,d){if(!b)a.Logger.warning("No config was passed. Cannot process forwarders");else try{Array.isArray(b.kitConfigs)&&b.kitConfigs.length&&b.kitConfigs.forEach(function(a){c.configureForwarder(a);}),Array.isArray(b.pixelConfigs)&&b.pixelConfigs.length&&b.pixelConfigs.forEach(function(a){c.configurePixel(a);}),c.initForwarders(a._Store.SDKConfig.identifyRequest.userIdentities,d);}catch(b){a.Logger.error("Config was not parsed propertly. Forwarders may not be initialized.");}};}
1956
1956
 
1957
- var MessageType$1=Types.MessageType,ApplicationTransitionType$1=Types.ApplicationTransitionType;function ServerModel(a){function b(a,b){var c=[];for(var d in b.flags={},a.CustomFlags)c=[],a.CustomFlags.hasOwnProperty(d)&&(Array.isArray(a.CustomFlags[d])?a.CustomFlags[d].forEach(function(a){("number"==typeof a||"string"==typeof a||"boolean"==typeof a)&&c.push(a.toString());}):("number"==typeof a.CustomFlags[d]||"string"==typeof a.CustomFlags[d]||"boolean"==typeof a.CustomFlags[d])&&c.push(a.CustomFlags[d].toString()),c.length&&(b.flags[d]=c));}function c(a){return a?a.map(function(a){return d(a)}):[]}function d(b){return {id:a._Helpers.parseStringOrNumber(b.Sku),nm:a._Helpers.parseStringOrNumber(b.Name),pr:a._Helpers.parseNumber(b.Price),qt:a._Helpers.parseNumber(b.Quantity),br:a._Helpers.parseStringOrNumber(b.Brand),va:a._Helpers.parseStringOrNumber(b.Variant),ca:a._Helpers.parseStringOrNumber(b.Category),ps:a._Helpers.parseNumber(b.Position),cc:a._Helpers.parseStringOrNumber(b.CouponCode),tpa:a._Helpers.parseNumber(b.TotalAmount),attrs:b.Attributes}}var e=this;this.appendUserInfo=function(b,c){if(c){if(!b)return c.MPID=null,c.ConsentState=null,c.UserAttributes=null,void(c.UserIdentities=null);if(!(c.MPID&&c.MPID===b.getMPID())){c.MPID=b.getMPID(),c.ConsentState=b.getConsentState(),c.UserAttributes=b.getAllUserAttributes();var d=b.getUserIdentities().userIdentities,e={};for(var f in d){var g=Types.IdentityType.getIdentityType(f);!1!==g&&(e[g]=d[f]);}var h=[];if(a._Helpers.isObject(e)&&Object.keys(e).length)for(var i in e){var j={};j.Identity=e[i],j.Type=a._Helpers.parseNumber(i),h.push(j);}c.UserIdentities=h;}}},this.convertToConsentStateDTO=function(a){if(!a)return null;var b={},c=a.getGDPRConsentState();if(c){var d={};for(var e in b.gdpr=d,c)if(c.hasOwnProperty(e)){var f=c[e];b.gdpr[e]={},"boolean"==typeof f.Consented&&(d[e].c=f.Consented),"number"==typeof f.Timestamp&&(d[e].ts=f.Timestamp),"string"==typeof f.ConsentDocument&&(d[e].d=f.ConsentDocument),"string"==typeof f.Location&&(d[e].l=f.Location),"string"==typeof f.HardwareId&&(d[e].h=f.HardwareId);}}var g=a.getCCPAConsentState();return g&&(b.ccpa={data_sale_opt_out:{c:g.Consented,ts:g.Timestamp,d:g.ConsentDocument,l:g.Location,h:g.HardwareId}}),b},this.createEventObject=function(b,c){var d={},f={},g=b.messageType===Types.MessageType.OptOut?!a._Store.isEnabled:null;if(a._Store.sessionId||b.messageType==Types.MessageType.OptOut||a._Store.webviewBridgeEnabled){f=b.hasOwnProperty("toEventAPIObject")?b.toEventAPIObject():{EventName:b.name||b.messageType,EventCategory:b.eventType,EventAttributes:a._Helpers.sanitizeAttributes(b.data,b.name),SourceMessageId:b.sourceMessageId||a._Helpers.generateUniqueId(),EventDataType:b.messageType,CustomFlags:b.customFlags||{},UserAttributeChanges:b.userAttributeChanges,UserIdentityChanges:b.userIdentityChanges},b.messageType!==Types.MessageType.SessionEnd&&(a._Store.dateLastEventSent=new Date),d={Store:a._Store.serverSettings,SDKVersion:Constants.sdkVersion,SessionId:a._Store.sessionId,SessionStartDate:a._Store.sessionStartDate?a._Store.sessionStartDate.getTime():0,Debug:a._Store.SDKConfig.isDevelopmentMode,Location:a._Store.currentPosition,OptOut:g,ExpandedEventCount:0,AppVersion:a.getAppVersion(),AppName:a.getAppName(),ClientGeneratedId:a._Store.clientId,DeviceId:a._Store.deviceId,IntegrationAttributes:a._Store.integrationAttributes,CurrencyCode:a._Store.currencyCode,DataPlan:a._Store.SDKConfig.dataPlan?a._Store.SDKConfig.dataPlan:{}},f.EventDataType===MessageType$1.AppStateTransition&&(f.IsFirstRun=a._Store.isFirstRun,f.LaunchReferral=window.location.href||null),f.CurrencyCode=a._Store.currencyCode;var h=c||a.Identity.getCurrentUser();return e.appendUserInfo(h,f),b.messageType===Types.MessageType.SessionEnd&&(f.SessionLength=a._Store.dateLastEventSent.getTime()-a._Store.sessionStartDate.getTime(),f.currentSessionMPIDs=a._Store.currentSessionMPIDs,f.EventAttributes=a._Store.sessionAttributes,a._Store.currentSessionMPIDs=[],a._Store.sessionStartDate=null),d.Timestamp=a._Store.dateLastEventSent.getTime(),a._Helpers.extend({},f,d)}return null},this.convertEventToDTO=function(d){var f={n:d.EventName,et:d.EventCategory,ua:d.UserAttributes,ui:d.UserIdentities,ia:d.IntegrationAttributes,str:d.Store,attrs:d.EventAttributes,sdk:d.SDKVersion,sid:d.SessionId,sl:d.SessionLength,ssd:d.SessionStartDate,dt:d.EventDataType,dbg:d.Debug,ct:d.Timestamp,lc:d.Location,o:d.OptOut,eec:d.ExpandedEventCount,av:d.AppVersion,cgid:d.ClientGeneratedId,das:d.DeviceId,mpid:d.MPID,smpids:d.currentSessionMPIDs};d.DataPlan&&d.DataPlan.PlanId&&(f.dp_id=d.DataPlan.PlanId,d.DataPlan.PlanVersion&&(f.dp_v=d.DataPlan.PlanVersion));var g=e.convertToConsentStateDTO(d.ConsentState);return g&&(f.con=g),d.EventDataType===MessageType$1.AppStateTransition&&(f.fr=d.IsFirstRun,f.iu=!1,f.at=ApplicationTransitionType$1.AppInit,f.lr=d.LaunchReferral,f.attrs=null),d.CustomFlags&&b(d,f),d.EventDataType===MessageType$1.Commerce?(f.cu=d.CurrencyCode,d.ShoppingCart&&(f.sc={pl:c(d.ShoppingCart.ProductList)}),d.ProductAction?f.pd={an:d.ProductAction.ProductActionType,cs:a._Helpers.parseNumber(d.ProductAction.CheckoutStep),co:d.ProductAction.CheckoutOptions,pl:c(d.ProductAction.ProductList),ti:d.ProductAction.TransactionId,ta:d.ProductAction.Affiliation,tcc:d.ProductAction.CouponCode,tr:a._Helpers.parseNumber(d.ProductAction.TotalAmount),ts:a._Helpers.parseNumber(d.ProductAction.ShippingAmount),tt:a._Helpers.parseNumber(d.ProductAction.TaxAmount)}:d.PromotionAction?f.pm={an:d.PromotionAction.PromotionActionType,pl:d.PromotionAction.PromotionList.map(function(a){return {id:a.Id,nm:a.Name,cr:a.Creative,ps:a.Position?a.Position:0}})}:d.ProductImpressions&&(f.pi=d.ProductImpressions.map(function(a){return {pil:a.ProductImpressionList,pl:c(a.ProductList)}}))):d.EventDataType===MessageType$1.Profile&&(f.pet=d.ProfileMessageType),f};}
1957
+ var MessageType$1=Types.MessageType,ApplicationTransitionType$1=Types.ApplicationTransitionType;function ServerModel(a){function b(a,b){var c=[];for(var d in b.flags={},a.CustomFlags)c=[],a.CustomFlags.hasOwnProperty(d)&&(Array.isArray(a.CustomFlags[d])?a.CustomFlags[d].forEach(function(a){("number"==typeof a||"string"==typeof a||"boolean"==typeof a)&&c.push(a.toString());}):("number"==typeof a.CustomFlags[d]||"string"==typeof a.CustomFlags[d]||"boolean"==typeof a.CustomFlags[d])&&c.push(a.CustomFlags[d].toString()),c.length&&(b.flags[d]=c));}function c(a){return a?a.map(function(a){return d(a)}):[]}function d(b){return {id:a._Helpers.parseStringOrNumber(b.Sku),nm:a._Helpers.parseStringOrNumber(b.Name),pr:a._Helpers.parseNumber(b.Price),qt:a._Helpers.parseNumber(b.Quantity),br:a._Helpers.parseStringOrNumber(b.Brand),va:a._Helpers.parseStringOrNumber(b.Variant),ca:a._Helpers.parseStringOrNumber(b.Category),ps:a._Helpers.parseNumber(b.Position),cc:a._Helpers.parseStringOrNumber(b.CouponCode),tpa:a._Helpers.parseNumber(b.TotalAmount),attrs:b.Attributes}}var e=this;this.appendUserInfo=function(b,c){if(c){if(!b)return c.MPID=null,c.ConsentState=null,c.UserAttributes=null,void(c.UserIdentities=null);if(!(c.MPID&&c.MPID===b.getMPID())){c.MPID=b.getMPID(),c.ConsentState=b.getConsentState(),c.UserAttributes=b.getAllUserAttributes();var d=b.getUserIdentities().userIdentities,e={};for(var f in d){var g=Types.IdentityType.getIdentityType(f);!1!==g&&(e[g]=d[f]);}var h=[];if(a._Helpers.isObject(e)&&Object.keys(e).length)for(var i in e){var j={};j.Identity=e[i],j.Type=a._Helpers.parseNumber(i),h.push(j);}c.UserIdentities=h;}}},this.convertToConsentStateDTO=function(a){if(!a)return null;var b={},c=a.getGDPRConsentState();if(c){var d={};for(var e in b.gdpr=d,c)if(c.hasOwnProperty(e)){var f=c[e];b.gdpr[e]={},"boolean"==typeof f.Consented&&(d[e].c=f.Consented),"number"==typeof f.Timestamp&&(d[e].ts=f.Timestamp),"string"==typeof f.ConsentDocument&&(d[e].d=f.ConsentDocument),"string"==typeof f.Location&&(d[e].l=f.Location),"string"==typeof f.HardwareId&&(d[e].h=f.HardwareId);}}var g=a.getCCPAConsentState();return g&&(b.ccpa={data_sale_opt_out:{c:g.Consented,ts:g.Timestamp,d:g.ConsentDocument,l:g.Location,h:g.HardwareId}}),b},this.createEventObject=function(b,c){var d={},f={},g=b.messageType===Types.MessageType.OptOut?!a._Store.isEnabled:null;if(a._Store.sessionId||b.messageType==Types.MessageType.OptOut||a._Store.webviewBridgeEnabled){f=b.hasOwnProperty("toEventAPIObject")?b.toEventAPIObject():{EventName:b.name||b.messageType,EventCategory:b.eventType,EventAttributes:a._Helpers.sanitizeAttributes(b.data,b.name),SourceMessageId:b.sourceMessageId||a._Helpers.generateUniqueId(),EventDataType:b.messageType,CustomFlags:b.customFlags||{},UserAttributeChanges:b.userAttributeChanges,UserIdentityChanges:b.userIdentityChanges},b.messageType!==Types.MessageType.SessionEnd&&(a._Store.dateLastEventSent=new Date),d={Store:a._Store.serverSettings,SDKVersion:Constants.sdkVersion,SessionId:a._Store.sessionId,SessionStartDate:a._Store.sessionStartDate?a._Store.sessionStartDate.getTime():0,Debug:a._Store.SDKConfig.isDevelopmentMode,Location:a._Store.currentPosition,OptOut:g,ExpandedEventCount:0,AppVersion:a.getAppVersion(),AppName:a.getAppName(),Package:a._Store.SDKConfig["package"],ClientGeneratedId:a._Store.clientId,DeviceId:a._Store.deviceId,IntegrationAttributes:a._Store.integrationAttributes,CurrencyCode:a._Store.currencyCode,DataPlan:a._Store.SDKConfig.dataPlan?a._Store.SDKConfig.dataPlan:{}},f.EventDataType===MessageType$1.AppStateTransition&&(f.IsFirstRun=a._Store.isFirstRun,f.LaunchReferral=window.location.href||null),f.CurrencyCode=a._Store.currencyCode;var h=c||a.Identity.getCurrentUser();return e.appendUserInfo(h,f),b.messageType===Types.MessageType.SessionEnd&&(f.SessionLength=a._Store.dateLastEventSent.getTime()-a._Store.sessionStartDate.getTime(),f.currentSessionMPIDs=a._Store.currentSessionMPIDs,f.EventAttributes=a._Store.sessionAttributes,a._Store.currentSessionMPIDs=[],a._Store.sessionStartDate=null),d.Timestamp=a._Store.dateLastEventSent.getTime(),a._Helpers.extend({},f,d)}return null},this.convertEventToDTO=function(d){var f={n:d.EventName,et:d.EventCategory,ua:d.UserAttributes,ui:d.UserIdentities,ia:d.IntegrationAttributes,str:d.Store,attrs:d.EventAttributes,sdk:d.SDKVersion,sid:d.SessionId,sl:d.SessionLength,ssd:d.SessionStartDate,dt:d.EventDataType,dbg:d.Debug,ct:d.Timestamp,lc:d.Location,o:d.OptOut,eec:d.ExpandedEventCount,av:d.AppVersion,cgid:d.ClientGeneratedId,das:d.DeviceId,mpid:d.MPID,smpids:d.currentSessionMPIDs};d.DataPlan&&d.DataPlan.PlanId&&(f.dp_id=d.DataPlan.PlanId,d.DataPlan.PlanVersion&&(f.dp_v=d.DataPlan.PlanVersion));var g=e.convertToConsentStateDTO(d.ConsentState);return g&&(f.con=g),d.EventDataType===MessageType$1.AppStateTransition&&(f.fr=d.IsFirstRun,f.iu=!1,f.at=ApplicationTransitionType$1.AppInit,f.lr=d.LaunchReferral,f.attrs=null),d.CustomFlags&&b(d,f),d.EventDataType===MessageType$1.Commerce?(f.cu=d.CurrencyCode,d.ShoppingCart&&(f.sc={pl:c(d.ShoppingCart.ProductList)}),d.ProductAction?f.pd={an:d.ProductAction.ProductActionType,cs:a._Helpers.parseNumber(d.ProductAction.CheckoutStep),co:d.ProductAction.CheckoutOptions,pl:c(d.ProductAction.ProductList),ti:d.ProductAction.TransactionId,ta:d.ProductAction.Affiliation,tcc:d.ProductAction.CouponCode,tr:a._Helpers.parseNumber(d.ProductAction.TotalAmount),ts:a._Helpers.parseNumber(d.ProductAction.ShippingAmount),tt:a._Helpers.parseNumber(d.ProductAction.TaxAmount)}:d.PromotionAction?f.pm={an:d.PromotionAction.PromotionActionType,pl:d.PromotionAction.PromotionList.map(function(a){return {id:a.Id,nm:a.Name,cr:a.Creative,ps:a.Position?a.Position:0}})}:d.ProductImpressions&&(f.pi=d.ProductImpressions.map(function(a){return {pil:a.ProductImpressionList,pl:c(a.ProductList)}}))):d.EventDataType===MessageType$1.Profile&&(f.pet=d.ProfileMessageType),f};}
1958
1958
 
1959
1959
  function forwardingStatsUploader(a){function b(){var b=a._Forwarders.getForwarderStatsQueue(),c=a._Persistence.forwardingStatsBatches.uploadsTable,d=Date.now();for(var e in b.length&&(c[d]={uploading:!1,data:b},a._Forwarders.setForwarderStatsQueue([])),c)(function(b){if(c.hasOwnProperty(b)&&!1===c[b].uploading){var d=function(){4===e.readyState&&(200===e.status||202===e.status?(a.Logger.verbose("Successfully sent "+e.statusText+" from server"),delete c[b]):"4"===e.status.toString()[0]?429!==e.status&&delete c[b]:c[b].uploading=!1);},e=a._Helpers.createXHR(d),f=c[b].data;c[b].uploading=!0,a._APIClient.sendBatchForwardingStatsToServer(f,e);}})(e);}this.startForwardingStatsTimer=function(){mParticle._forwardingStatsTimer=setInterval(function(){b();},a._Store.SDKConfig.forwarderStatsTimeout);};}
1960
1960
 
package/dist/mparticle.js CHANGED
@@ -721,176 +721,175 @@ var mParticle = (function () {
721
721
  TriggerUploadType: TriggerUploadType
722
722
  };
723
723
 
724
- var version = "2.15.5";
724
+ var version = "2.16.0";
725
725
 
726
726
  var Constants = {
727
- sdkVersion: version,
728
- sdkVendor: 'mparticle',
729
- platform: 'web',
730
- Messages: {
731
- ErrorMessages: {
732
- NoToken: 'A token must be specified.',
733
- EventNameInvalidType: 'Event name must be a valid string value.',
734
- EventDataInvalidType: 'Event data must be a valid object hash.',
735
- LoggingDisabled: 'Event logging is currently disabled.',
736
- CookieParseError: 'Could not parse cookie',
737
- EventEmpty: 'Event object is null or undefined, cancelling send',
738
- APIRequestEmpty: 'APIRequest is null or undefined, cancelling send',
739
- NoEventType: 'Event type must be specified.',
740
- TransactionIdRequired: 'Transaction ID is required',
741
- TransactionRequired: 'A transaction attributes object is required',
742
- PromotionIdRequired: 'Promotion ID is required',
743
- BadAttribute: 'Attribute value cannot be object or array',
744
- BadKey: 'Key value cannot be object or array',
745
- BadLogPurchase: 'Transaction attributes and a product are both required to log a purchase, https://docs.mparticle.com/?javascript#measuring-transactions'
727
+ sdkVersion: version,
728
+ sdkVendor: 'mparticle',
729
+ platform: 'web',
730
+ Messages: {
731
+ ErrorMessages: {
732
+ NoToken: 'A token must be specified.',
733
+ EventNameInvalidType: 'Event name must be a valid string value.',
734
+ EventDataInvalidType: 'Event data must be a valid object hash.',
735
+ LoggingDisabled: 'Event logging is currently disabled.',
736
+ CookieParseError: 'Could not parse cookie',
737
+ EventEmpty: 'Event object is null or undefined, cancelling send',
738
+ APIRequestEmpty: 'APIRequest is null or undefined, cancelling send',
739
+ NoEventType: 'Event type must be specified.',
740
+ TransactionIdRequired: 'Transaction ID is required',
741
+ TransactionRequired: 'A transaction attributes object is required',
742
+ PromotionIdRequired: 'Promotion ID is required',
743
+ BadAttribute: 'Attribute value cannot be object or array',
744
+ BadKey: 'Key value cannot be object or array',
745
+ BadLogPurchase: 'Transaction attributes and a product are both required to log a purchase, https://docs.mparticle.com/?javascript#measuring-transactions'
746
+ },
747
+ InformationMessages: {
748
+ CookieSearch: 'Searching for cookie',
749
+ CookieFound: 'Cookie found, parsing values',
750
+ CookieNotFound: 'Cookies not found',
751
+ CookieSet: 'Setting cookie',
752
+ CookieSync: 'Performing cookie sync',
753
+ SendBegin: 'Starting to send event',
754
+ SendIdentityBegin: 'Starting to send event to identity server',
755
+ SendWindowsPhone: 'Sending event to Windows Phone container',
756
+ SendIOS: 'Calling iOS path: ',
757
+ SendAndroid: 'Calling Android JS interface method: ',
758
+ SendHttp: 'Sending event to mParticle HTTP service',
759
+ SendAliasHttp: 'Sending alias request to mParticle HTTP service',
760
+ SendIdentityHttp: 'Sending event to mParticle HTTP service',
761
+ StartingNewSession: 'Starting new Session',
762
+ StartingLogEvent: 'Starting to log event',
763
+ StartingLogOptOut: 'Starting to log user opt in/out',
764
+ StartingEndSession: 'Starting to end session',
765
+ StartingInitialization: 'Starting to initialize',
766
+ StartingLogCommerceEvent: 'Starting to log commerce event',
767
+ StartingAliasRequest: 'Starting to Alias MPIDs',
768
+ LoadingConfig: 'Loading configuration options',
769
+ AbandonLogEvent: 'Cannot log event, logging disabled or developer token not set',
770
+ AbandonAliasUsers: 'Cannot Alias Users, logging disabled or developer token not set',
771
+ AbandonStartSession: 'Cannot start session, logging disabled or developer token not set',
772
+ AbandonEndSession: 'Cannot end session, logging disabled or developer token not set',
773
+ NoSessionToEnd: 'Cannot end session, no active session found'
774
+ },
775
+ ValidationMessages: {
776
+ ModifyIdentityRequestUserIdentitiesPresent: 'identityRequests to modify require userIdentities to be present. Request not sent to server. Please fix and try again',
777
+ 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.',
778
+ OnUserAliasType: 'The onUserAlias value must be a function. The onUserAlias provided is of type',
779
+ 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.',
780
+ UserIdentitiesInvalidKey: 'There is an invalid identity key on your `userIdentities` object within the identityRequest. Request not sent to server. Please fix and try again.',
781
+ UserIdentitiesInvalidValues: 'All user identity values must be strings or null. Request not sent to server. Please fix and try again.',
782
+ AliasMissingMpid: 'Alias Request must contain both a destinationMpid and a sourceMpid',
783
+ AliasNonUniqueMpid: "Alias Request's destinationMpid and sourceMpid must be unique",
784
+ AliasMissingTime: 'Alias Request must have both a startTime and an endTime',
785
+ AliasStartBeforeEndTime: "Alias Request's endTime must be later than its startTime"
786
+ }
746
787
  },
747
- InformationMessages: {
748
- CookieSearch: 'Searching for cookie',
749
- CookieFound: 'Cookie found, parsing values',
750
- CookieNotFound: 'Cookies not found',
751
- CookieSet: 'Setting cookie',
752
- CookieSync: 'Performing cookie sync',
753
- SendBegin: 'Starting to send event',
754
- SendIdentityBegin: 'Starting to send event to identity server',
755
- SendWindowsPhone: 'Sending event to Windows Phone container',
756
- SendIOS: 'Calling iOS path: ',
757
- SendAndroid: 'Calling Android JS interface method: ',
758
- SendHttp: 'Sending event to mParticle HTTP service',
759
- SendAliasHttp: 'Sending alias request to mParticle HTTP service',
760
- SendIdentityHttp: 'Sending event to mParticle HTTP service',
761
- StartingNewSession: 'Starting new Session',
762
- StartingLogEvent: 'Starting to log event',
763
- StartingLogOptOut: 'Starting to log user opt in/out',
764
- StartingEndSession: 'Starting to end session',
765
- StartingInitialization: 'Starting to initialize',
766
- StartingLogCommerceEvent: 'Starting to log commerce event',
767
- StartingAliasRequest: 'Starting to Alias MPIDs',
768
- LoadingConfig: 'Loading configuration options',
769
- AbandonLogEvent: 'Cannot log event, logging disabled or developer token not set',
770
- AbandonAliasUsers: 'Cannot Alias Users, logging disabled or developer token not set',
771
- AbandonStartSession: 'Cannot start session, logging disabled or developer token not set',
772
- AbandonEndSession: 'Cannot end session, logging disabled or developer token not set',
773
- NoSessionToEnd: 'Cannot end session, no active session found'
788
+ NativeSdkPaths: {
789
+ LogEvent: 'logEvent',
790
+ SetUserTag: 'setUserTag',
791
+ RemoveUserTag: 'removeUserTag',
792
+ SetUserAttribute: 'setUserAttribute',
793
+ RemoveUserAttribute: 'removeUserAttribute',
794
+ SetSessionAttribute: 'setSessionAttribute',
795
+ AddToCart: 'addToCart',
796
+ RemoveFromCart: 'removeFromCart',
797
+ ClearCart: 'clearCart',
798
+ LogOut: 'logOut',
799
+ SetUserAttributeList: 'setUserAttributeList',
800
+ RemoveAllUserAttributes: 'removeAllUserAttributes',
801
+ GetUserAttributesLists: 'getUserAttributesLists',
802
+ GetAllUserAttributes: 'getAllUserAttributes',
803
+ Identify: 'identify',
804
+ Logout: 'logout',
805
+ Login: 'login',
806
+ Modify: 'modify',
807
+ Alias: 'aliasUsers',
808
+ Upload: 'upload'
774
809
  },
775
- ValidationMessages: {
776
- ModifyIdentityRequestUserIdentitiesPresent: 'identityRequests to modify require userIdentities to be present. Request not sent to server. Please fix and try again',
777
- 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.',
778
- OnUserAliasType: 'The onUserAlias value must be a function. The onUserAlias provided is of type',
779
- 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.',
780
- UserIdentitiesInvalidKey: 'There is an invalid identity key on your `userIdentities` object within the identityRequest. Request not sent to server. Please fix and try again.',
781
- UserIdentitiesInvalidValues: 'All user identity values must be strings or null. Request not sent to server. Please fix and try again.',
782
- AliasMissingMpid: 'Alias Request must contain both a destinationMpid and a sourceMpid',
783
- AliasNonUniqueMpid: "Alias Request's destinationMpid and sourceMpid must be unique",
784
- AliasMissingTime: 'Alias Request must have both a startTime and an endTime',
785
- AliasStartBeforeEndTime: "Alias Request's endTime must be later than its startTime"
786
- }
787
- },
788
- NativeSdkPaths: {
789
- LogEvent: 'logEvent',
790
- SetUserTag: 'setUserTag',
791
- RemoveUserTag: 'removeUserTag',
792
- SetUserAttribute: 'setUserAttribute',
793
- RemoveUserAttribute: 'removeUserAttribute',
794
- SetSessionAttribute: 'setSessionAttribute',
795
- AddToCart: 'addToCart',
796
- RemoveFromCart: 'removeFromCart',
797
- ClearCart: 'clearCart',
798
- LogOut: 'logOut',
799
- SetUserAttributeList: 'setUserAttributeList',
800
- RemoveAllUserAttributes: 'removeAllUserAttributes',
801
- GetUserAttributesLists: 'getUserAttributesLists',
802
- GetAllUserAttributes: 'getAllUserAttributes',
803
- Identify: 'identify',
804
- Logout: 'logout',
805
- Login: 'login',
806
- Modify: 'modify',
807
- Alias: 'aliasUsers',
808
- Upload: 'upload'
809
- },
810
- StorageNames: {
811
- localStorageName: 'mprtcl-api',
812
- // Name of the mP localstorage, had cp and pb even if cookies were used, skipped v2
813
- localStorageNameV3: 'mprtcl-v3',
814
- // v3 Name of the mP localstorage, final version on SDKv1
815
- cookieName: 'mprtcl-api',
816
- // v1 Name of the cookie stored on the user's machine
817
- cookieNameV2: 'mprtcl-v2',
818
- // v2 Name of the cookie stored on the user's machine. Removed keys with no values, moved cartProducts and productBags to localStorage.
819
- cookieNameV3: 'mprtcl-v3',
820
- // v3 Name of the cookie stored on the user's machine. Base64 encoded keys in Base64CookieKeys object, final version on SDKv1
821
- localStorageNameV4: 'mprtcl-v4',
822
- // v4 Name of the mP localstorage, Current Version
823
- localStorageProductsV4: 'mprtcl-prodv4',
824
- // The name for mP localstorage that contains products for cartProducs and productBags
825
- cookieNameV4: 'mprtcl-v4',
826
- // v4 Name of the cookie stored on the user's machine. Base64 encoded keys in Base64CookieKeys object, current version on SDK v2
827
- currentStorageName: 'mprtcl-v4',
828
- currentStorageProductsName: 'mprtcl-prodv4'
829
- },
830
- DefaultConfig: {
831
- cookieDomain: null,
832
- // If null, defaults to current location.host
833
- cookieExpiration: 365,
834
- // Cookie expiration time in days
835
- logLevel: null,
836
- // What logging will be provided in the console
837
- timeout: 300,
838
- // timeout in milliseconds for logging functions
839
- sessionTimeout: 30,
840
- // Session timeout in minutes
841
- maxProducts: 20,
842
- // Number of products persisted in cartProducts and productBags
843
- forwarderStatsTimeout: 5000,
844
- // Milliseconds for forwarderStats timeout
845
- integrationDelayTimeout: 5000,
846
- // Milliseconds for forcing the integration delay to un-suspend event queueing due to integration partner errors
847
- maxCookieSize: 3000,
848
- // Number of bytes for cookie size to not exceed
849
- aliasMaxWindow: 90,
850
- // Max age of Alias request startTime, in days
851
- uploadInterval: 0 // Maximum milliseconds in between batch uploads, below 500 will mean immediate upload
852
-
853
- },
854
- DefaultUrls: {
855
- v1SecureServiceUrl: 'jssdks.mparticle.com/v1/JS/',
856
- v2SecureServiceUrl: 'jssdks.mparticle.com/v2/JS/',
857
- v3SecureServiceUrl: 'jssdks.mparticle.com/v3/JS/',
858
- configUrl: 'jssdkcdns.mparticle.com/JS/v2/',
859
- identityUrl: 'identity.mparticle.com/v1/',
860
- aliasUrl: 'jssdks.mparticle.com/v1/identity/'
861
- },
862
- Base64CookieKeys: {
863
- csm: 1,
864
- sa: 1,
865
- ss: 1,
866
- ua: 1,
867
- ui: 1,
868
- csd: 1,
869
- ia: 1,
870
- con: 1
871
- },
872
- SDKv2NonMPIDCookieKeys: {
873
- gs: 1,
874
- cu: 1,
875
- l: 1,
876
- globalSettings: 1,
877
- currentUserMPID: 1
878
- },
879
- HTTPCodes: {
880
- noHttpCoverage: -1,
881
- activeIdentityRequest: -2,
882
- activeSession: -3,
883
- validationIssue: -4,
884
- nativeIdentityRequest: -5,
885
- loggingDisabledOrMissingAPIKey: -6,
886
- tooManyRequests: 429
887
- },
888
- FeatureFlags: {
889
- ReportBatching: 'reportBatching',
890
- EventsV3: 'eventsV3',
891
- EventBatchingIntervalMillis: 'eventBatchingIntervalMillis'
892
- },
893
- DefaultInstance: 'default_instance'
810
+ StorageNames: {
811
+ localStorageName: 'mprtcl-api',
812
+ // Name of the mP localstorage, had cp and pb even if cookies were used, skipped v2
813
+ localStorageNameV3: 'mprtcl-v3',
814
+ // v3 Name of the mP localstorage, final version on SDKv1
815
+ cookieName: 'mprtcl-api',
816
+ // v1 Name of the cookie stored on the user's machine
817
+ cookieNameV2: 'mprtcl-v2',
818
+ // v2 Name of the cookie stored on the user's machine. Removed keys with no values, moved cartProducts and productBags to localStorage.
819
+ cookieNameV3: 'mprtcl-v3',
820
+ // v3 Name of the cookie stored on the user's machine. Base64 encoded keys in Base64CookieKeys object, final version on SDKv1
821
+ localStorageNameV4: 'mprtcl-v4',
822
+ // v4 Name of the mP localstorage, Current Version
823
+ localStorageProductsV4: 'mprtcl-prodv4',
824
+ // The name for mP localstorage that contains products for cartProducs and productBags
825
+ cookieNameV4: 'mprtcl-v4',
826
+ // v4 Name of the cookie stored on the user's machine. Base64 encoded keys in Base64CookieKeys object, current version on SDK v2
827
+ currentStorageName: 'mprtcl-v4',
828
+ currentStorageProductsName: 'mprtcl-prodv4'
829
+ },
830
+ DefaultConfig: {
831
+ cookieDomain: null,
832
+ // If null, defaults to current location.host
833
+ cookieExpiration: 365,
834
+ // Cookie expiration time in days
835
+ logLevel: null,
836
+ // What logging will be provided in the console
837
+ timeout: 300,
838
+ // timeout in milliseconds for logging functions
839
+ sessionTimeout: 30,
840
+ // Session timeout in minutes
841
+ maxProducts: 20,
842
+ // Number of products persisted in cartProducts and productBags
843
+ forwarderStatsTimeout: 5000,
844
+ // Milliseconds for forwarderStats timeout
845
+ integrationDelayTimeout: 5000,
846
+ // Milliseconds for forcing the integration delay to un-suspend event queueing due to integration partner errors
847
+ maxCookieSize: 3000,
848
+ // Number of bytes for cookie size to not exceed
849
+ aliasMaxWindow: 90,
850
+ // Max age of Alias request startTime, in days
851
+ uploadInterval: 0 // Maximum milliseconds in between batch uploads, below 500 will mean immediate upload
852
+ },
853
+ DefaultUrls: {
854
+ v1SecureServiceUrl: 'jssdks.mparticle.com/v1/JS/',
855
+ v2SecureServiceUrl: 'jssdks.mparticle.com/v2/JS/',
856
+ v3SecureServiceUrl: 'jssdks.mparticle.com/v3/JS/',
857
+ configUrl: 'jssdkcdns.mparticle.com/JS/v2/',
858
+ identityUrl: 'identity.mparticle.com/v1/',
859
+ aliasUrl: 'jssdks.mparticle.com/v1/identity/'
860
+ },
861
+ Base64CookieKeys: {
862
+ csm: 1,
863
+ sa: 1,
864
+ ss: 1,
865
+ ua: 1,
866
+ ui: 1,
867
+ csd: 1,
868
+ ia: 1,
869
+ con: 1
870
+ },
871
+ SDKv2NonMPIDCookieKeys: {
872
+ gs: 1,
873
+ cu: 1,
874
+ l: 1,
875
+ globalSettings: 1,
876
+ currentUserMPID: 1
877
+ },
878
+ HTTPCodes: {
879
+ noHttpCoverage: -1,
880
+ activeIdentityRequest: -2,
881
+ activeSession: -3,
882
+ validationIssue: -4,
883
+ nativeIdentityRequest: -5,
884
+ loggingDisabledOrMissingAPIKey: -6,
885
+ tooManyRequests: 429
886
+ },
887
+ FeatureFlags: {
888
+ ReportBatching: 'reportBatching',
889
+ EventsV3: 'eventsV3',
890
+ EventBatchingIntervalMillis: 'eventBatchingIntervalMillis'
891
+ },
892
+ DefaultInstance: 'default_instance'
894
893
  };
895
894
 
896
895
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
@@ -2335,7 +2334,8 @@ var mParticle = (function () {
2335
2334
  sdk_version: lastEvent.SDKVersion,
2336
2335
  application_info: {
2337
2336
  application_version: lastEvent.AppVersion,
2338
- application_name: lastEvent.AppName
2337
+ application_name: lastEvent.AppName,
2338
+ "package": lastEvent.Package
2339
2339
  },
2340
2340
  device_info: {
2341
2341
  platform: dist_13.web,
@@ -3234,9 +3234,14 @@ var mParticle = (function () {
3234
3234
  }
3235
3235
  for (var _i2 = 0, _Array$from2 = Array.from(eventsBySession.entries()); _i2 < _Array$from2.length; _i2++) {
3236
3236
  var _entry = _Array$from2[_i2];
3237
- var upload = convertEvents(mpid, _entry[1], mpInstance);
3238
- if (upload) {
3239
- newUploads.push(upload);
3237
+ var uploadBatchObject = convertEvents(mpid, _entry[1], mpInstance);
3238
+ var onCreateBatchCallback = mpInstance._Store.SDKConfig.onCreateBatch;
3239
+ if (onCreateBatchCallback) {
3240
+ uploadBatchObject = onCreateBatchCallback(uploadBatchObject);
3241
+ uploadBatchObject.mutated = true;
3242
+ }
3243
+ if (uploadBatchObject) {
3244
+ newUploads.push(uploadBatchObject);
3240
3245
  }
3241
3246
  }
3242
3247
  }
@@ -5284,6 +5289,10 @@ var mParticle = (function () {
5284
5289
  this.SDKConfig.appName = config.appName;
5285
5290
  }
5286
5291
 
5292
+ if (config.hasOwnProperty('package')) {
5293
+ this.SDKConfig["package"] = config["package"];
5294
+ }
5295
+
5287
5296
  if (config.hasOwnProperty('integrationDelayTimeout')) {
5288
5297
  this.SDKConfig.integrationDelayTimeout = config.integrationDelayTimeout;
5289
5298
  } else {
@@ -5374,6 +5383,16 @@ var mParticle = (function () {
5374
5383
  }
5375
5384
  }
5376
5385
 
5386
+ if (config.hasOwnProperty('onCreateBatch')) {
5387
+ if (typeof config.onCreateBatch === 'function') {
5388
+ this.SDKConfig.onCreateBatch = config.onCreateBatch;
5389
+ } else {
5390
+ mpInstance.Logger.error('config.onCreateBatch must be a function'); // set to undefined because all items are set on createSDKConfig
5391
+
5392
+ this.SDKConfig.onCreateBatch = undefined;
5393
+ }
5394
+ }
5395
+
5377
5396
  if (!config.hasOwnProperty('flags')) {
5378
5397
  this.SDKConfig.flags = {};
5379
5398
  }
@@ -7674,6 +7693,7 @@ var mParticle = (function () {
7674
7693
  ExpandedEventCount: 0,
7675
7694
  AppVersion: mpInstance.getAppVersion(),
7676
7695
  AppName: mpInstance.getAppName(),
7696
+ Package: mpInstance._Store.SDKConfig["package"],
7677
7697
  ClientGeneratedId: mpInstance._Store.clientId,
7678
7698
  DeviceId: mpInstance._Store.deviceId,
7679
7699
  IntegrationAttributes: mpInstance._Store.integrationAttributes,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mparticle/web-sdk",
3
- "version": "2.15.5",
3
+ "version": "2.16.0",
4
4
  "description": "mParticle core SDK for web applications",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [
@@ -68,7 +68,7 @@
68
68
  "@babel/preset-env": "^7.6.0",
69
69
  "@babel/preset-typescript": "^7.6.0",
70
70
  "@mparticle/data-planning-models": "^0.1.0",
71
- "@mparticle/event-models": "^1.1.2",
71
+ "@mparticle/event-models": "^1.1.4",
72
72
  "@rollup/plugin-json": "^4.1.0",
73
73
  "@semantic-release/changelog": "^5.0.1",
74
74
  "@semantic-release/exec": "^5.0.0",
@@ -131,9 +131,16 @@ export class BatchUploader {
131
131
  eventsBySession.set(sdkEvent.SessionId, events);
132
132
  }
133
133
  for (const entry of Array.from(eventsBySession.entries())) {
134
- const upload = convertEvents(mpid, entry[1], mpInstance);
135
- if (upload) {
136
- newUploads.push(upload);
134
+ let uploadBatchObject = convertEvents(mpid, entry[1], mpInstance);
135
+ const onCreateBatchCallback = mpInstance._Store.SDKConfig.onCreateBatch;
136
+
137
+ if (onCreateBatchCallback) {
138
+ uploadBatchObject = onCreateBatchCallback(uploadBatchObject);
139
+ uploadBatchObject.mutated = true;
140
+ }
141
+
142
+ if (uploadBatchObject) {
143
+ newUploads.push(uploadBatchObject);
137
144
  }
138
145
  }
139
146
  }
@@ -1,6 +1,6 @@
1
1
  import { version } from '../package.json';
2
2
 
3
- var Constants = {
3
+ const Constants = {
4
4
  sdkVersion: version,
5
5
  sdkVendor: 'mparticle',
6
6
  platform: 'web',
@@ -164,6 +164,6 @@ var Constants = {
164
164
  EventBatchingIntervalMillis: 'eventBatchingIntervalMillis',
165
165
  },
166
166
  DefaultInstance: 'default_instance',
167
- };
167
+ } as const;
168
168
 
169
169
  export default Constants;
@@ -24,6 +24,7 @@ export interface SDKEvent {
24
24
  CustomFlags?: { [key: string]: string };
25
25
  AppVersion?: string;
26
26
  AppName?: string;
27
+ Package?: string;
27
28
  ConsentState?: SDKConsentState;
28
29
  IntegrationAttributes?: { [key: string]: { [key: string]: string } };
29
30
  ProductAction?: SDKProductAction;
@@ -142,8 +143,10 @@ export interface SDKConfig {
142
143
  warning?(msg)
143
144
  verbose?(msg)
144
145
  };
146
+ onCreateBatch(batch: EventsApi.Batch): EventsApi.Batch;
145
147
  dataPlan: DataPlanConfig;
146
148
  appVersion?: string;
149
+ package?: string;
147
150
  flags?: { [key: string]: string | number };
148
151
  kitConfigs: any;
149
152
  appName?: string;
@@ -202,6 +205,7 @@ export interface SDKConfigApi {
202
205
  v3SecureServiceUrl?: string;
203
206
  isDevelopmentMode: boolean;
204
207
  appVersion?: string;
208
+ onCreateBatch(batch: EventsApi.Batch): EventsApi.Batch
205
209
  }
206
210
  export interface MParticleUser {
207
211
  getMPID(): string;
@@ -55,6 +55,7 @@ export function convertEvents(
55
55
  application_info: {
56
56
  application_version: lastEvent.AppVersion,
57
57
  application_name: lastEvent.AppName,
58
+ package: lastEvent.Package,
58
59
  },
59
60
  device_info: {
60
61
  platform: EventsApi.DeviceInformationPlatformEnum.web,
@@ -207,6 +207,7 @@ export default function ServerModel(mpInstance) {
207
207
  ExpandedEventCount: 0,
208
208
  AppVersion: mpInstance.getAppVersion(),
209
209
  AppName: mpInstance.getAppName(),
210
+ Package: mpInstance._Store.SDKConfig.package,
210
211
  ClientGeneratedId: mpInstance._Store.clientId,
211
212
  DeviceId: mpInstance._Store.deviceId,
212
213
  IntegrationAttributes: mpInstance._Store.integrationAttributes,
package/src/store.js CHANGED
@@ -154,6 +154,10 @@ export default function Store(config, mpInstance) {
154
154
  this.SDKConfig.appName = config.appName;
155
155
  }
156
156
 
157
+ if (config.hasOwnProperty('package')) {
158
+ this.SDKConfig.package = config.package;
159
+ }
160
+
157
161
  if (config.hasOwnProperty('integrationDelayTimeout')) {
158
162
  this.SDKConfig.integrationDelayTimeout =
159
163
  config.integrationDelayTimeout;
@@ -264,6 +268,18 @@ export default function Store(config, mpInstance) {
264
268
  }
265
269
  }
266
270
 
271
+ if (config.hasOwnProperty('onCreateBatch')) {
272
+ if (typeof config.onCreateBatch === 'function') {
273
+ this.SDKConfig.onCreateBatch = config.onCreateBatch;
274
+ } else {
275
+ mpInstance.Logger.error(
276
+ 'config.onCreateBatch must be a function'
277
+ );
278
+ // set to undefined because all items are set on createSDKConfig
279
+ this.SDKConfig.onCreateBatch = undefined;
280
+ }
281
+ }
282
+
267
283
  if (!config.hasOwnProperty('flags')) {
268
284
  this.SDKConfig.flags = {};
269
285
  }