diff --git a/dist/mparticle.common.js b/dist/mparticle.common.js index a5820a638..73d92d796 100644 --- a/dist/mparticle.common.js +++ b/dist/mparticle.common.js @@ -56,16 +56,8 @@ function _defineProperty(obj, key, value) { return obj; } -var _TriggerUploadType,MessageType$2={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$2.Commerce,1),_defineProperty(_TriggerUploadType,MessageType$2.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$1={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};// Dictionary that contains MessageTypes that will -// trigger an immediate upload. -// Continuation of enum above, but in seperate object since we don't expose these to end user -IdentityType$1.isValid=function(a){if("number"==typeof a)for(var b in IdentityType$1)if(IdentityType$1.hasOwnProperty(b)&&IdentityType$1[b]===a)return !0;return !1},IdentityType$1.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$1.getIdentityType=function(a){return "other"===a?IdentityType$1.Other:"customerid"===a?IdentityType$1.CustomerId:"facebook"===a?IdentityType$1.Facebook:"twitter"===a?IdentityType$1.Twitter:"google"===a?IdentityType$1.Google:"microsoft"===a?IdentityType$1.Microsoft:"yahoo"===a?IdentityType$1.Yahoo:"email"===a?IdentityType$1.Email:"facebookcustomaudienceid"===a?IdentityType$1.FacebookCustomAudienceId:"other2"===a?IdentityType$1.Other2:"other3"===a?IdentityType$1.Other3:"other4"===a?IdentityType$1.Other4:"other5"===a?IdentityType$1.Other5:"other6"===a?IdentityType$1.Other6:"other7"===a?IdentityType$1.Other7:"other8"===a?IdentityType$1.Other8:"other9"===a?IdentityType$1.Other9:"other10"===a?IdentityType$1.Other10:"mobile_number"===a?IdentityType$1.MobileNumber:"phone_number_2"===a?IdentityType$1.PhoneNumber2:!("phone_number_3"!=a)&&IdentityType$1.PhoneNumber3},IdentityType$1.getIdentityName=function(a){return a===IdentityType$1.Other?"other":a===IdentityType$1.CustomerId?"customerid":a===IdentityType$1.Facebook?"facebook":a===IdentityType$1.Twitter?"twitter":a===IdentityType$1.Google?"google":a===IdentityType$1.Microsoft?"microsoft":a===IdentityType$1.Yahoo?"yahoo":a===IdentityType$1.Email?"email":a===IdentityType$1.FacebookCustomAudienceId?"facebookcustomaudienceid":a===IdentityType$1.Other2?"other2":a===IdentityType$1.Other3?"other3":a===IdentityType$1.Other4?"other4":a===IdentityType$1.Other5?"other5":a===IdentityType$1.Other6?"other6":a===IdentityType$1.Other7?"other7":a===IdentityType$1.Other8?"other8":a===IdentityType$1.Other9?"other9":a===IdentityType$1.Other10?"other10":a===IdentityType$1.MobileNumber?"mobile_number":a===IdentityType$1.PhoneNumber2?"phone_number_2":a===IdentityType$1.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$1={AppInit:1},Environment={Production:"production",Development:"development"};var Types = {MessageType:MessageType$2,EventType:EventType,CommerceEventType:CommerceEventType,IdentityType:IdentityType$1,ProfileMessageType:ProfileMessageType,ApplicationTransitionType:ApplicationTransitionType$1,ProductActionType:ProductActionType,PromotionActionType:PromotionActionType,TriggerUploadType:TriggerUploadType,Environment:Environment}; - -var version = "2.26.1"; - -var Constants={sdkVersion:version,sdkVendor:"mparticle",platform:"web",Messages:{DeprecationMessages:{MethodIsDeprecatedPostfix:"is a deprecated method and will be removed in future releases",AlternativeMethodPrefix:"Please use the alternate method:"},ErrorMessages:{NoToken:"A token must be specified.",EventNameInvalidType:"Event name must be a valid string value.",EventDataInvalidType:"Event data must be a valid object hash.",LoggingDisabled:"Event logging is currently disabled.",CookieParseError:"Could not parse cookie",EventEmpty:"Event object is null or undefined, cancelling send",APIRequestEmpty:"APIRequest is null or undefined, cancelling send",NoEventType:"Event type must be specified.",TransactionIdRequired:"Transaction ID is required",TransactionRequired:"A transaction attributes object is required",PromotionIdRequired:"Promotion ID is required",BadAttribute:"Attribute value cannot be object or array",BadKey:"Key value cannot be object or array",BadLogPurchase:"Transaction attributes and a product are both required to log a purchase, https://docs.mparticle.com/?javascript#measuring-transactions",AudienceAPINotEnabled:"Your workspace is not enabled to retrieve user audiences."},InformationMessages:{CookieSearch:"Searching for cookie",CookieFound:"Cookie found, parsing values",CookieNotFound:"Cookies not found",CookieSet:"Setting cookie",CookieSync:"Performing cookie sync",SendBegin:"Starting to send event",SendIdentityBegin:"Starting to send event to identity server",SendWindowsPhone:"Sending event to Windows Phone container",SendIOS:"Calling iOS path: ",SendAndroid:"Calling Android JS interface method: ",SendHttp:"Sending event to mParticle HTTP service",SendAliasHttp:"Sending alias request to mParticle HTTP service",SendIdentityHttp:"Sending event to mParticle HTTP service",StartingNewSession:"Starting new Session",StartingLogEvent:"Starting to log event",StartingLogOptOut:"Starting to log user opt in/out",StartingEndSession:"Starting to end session",StartingInitialization:"Starting to initialize",StartingLogCommerceEvent:"Starting to log commerce event",StartingAliasRequest:"Starting to Alias MPIDs",LoadingConfig:"Loading configuration options",AbandonLogEvent:"Cannot log event, logging disabled or developer token not set",AbandonAliasUsers:"Cannot Alias Users, logging disabled or developer token not set",AbandonStartSession:"Cannot start session, logging disabled or developer token not set",AbandonEndSession:"Cannot end session, logging disabled or developer token not set",NoSessionToEnd:"Cannot end session, no active session found"},ValidationMessages:{ModifyIdentityRequestUserIdentitiesPresent:"identityRequests to modify require userIdentities to be present. Request not sent to server. Please fix and try again",IdentityRequesetInvalidKey:"There is an invalid key on your identityRequest object. It can only contain a `userIdentities` object and a `onUserAlias` function. Request not sent to server. Please fix and try again.",OnUserAliasType:"The onUserAlias value must be a function.",UserIdentities:"The userIdentities key must be an object with keys of identityTypes and values of strings. Request not sent to server. Please fix and try again.",UserIdentitiesInvalidKey:"There is an invalid identity key on your `userIdentities` object within the identityRequest. Request not sent to server. Please fix and try again.",UserIdentitiesInvalidValues:"All user identity values must be strings or null. Request not sent to server. Please fix and try again.",AliasMissingMpid:"Alias Request must contain both a destinationMpid and a sourceMpid",AliasNonUniqueMpid:"Alias Request's destinationMpid and sourceMpid must be unique",AliasMissingTime:"Alias Request must have both a startTime and an endTime",AliasStartBeforeEndTime:"Alias Request's endTime must be later than its startTime"}},NativeSdkPaths:{LogEvent:"logEvent",SetUserTag:"setUserTag",RemoveUserTag:"removeUserTag",SetUserAttribute:"setUserAttribute",RemoveUserAttribute:"removeUserAttribute",SetSessionAttribute:"setSessionAttribute",AddToCart:"addToCart",RemoveFromCart:"removeFromCart",ClearCart:"clearCart",LogOut:"logOut",SetUserAttributeList:"setUserAttributeList",RemoveAllUserAttributes:"removeAllUserAttributes",GetUserAttributesLists:"getUserAttributesLists",GetAllUserAttributes:"getAllUserAttributes",Identify:"identify",Logout:"logout",Login:"login",Modify:"modify",Alias:"aliasUsers",Upload:"upload"},StorageNames:{localStorageName:"mprtcl-api",localStorageNameV3:"mprtcl-v3",cookieName:"mprtcl-api",cookieNameV2:"mprtcl-v2",cookieNameV3:"mprtcl-v3",localStorageNameV4:"mprtcl-v4",localStorageProductsV4:"mprtcl-prodv4",cookieNameV4:"mprtcl-v4",currentStorageName:"mprtcl-v4",currentStorageProductsName:"mprtcl-prodv4"},DefaultConfig:{cookieDomain:null,cookieExpiration:365,logLevel:null,timeout:300,sessionTimeout:30,maxProducts:20,forwarderStatsTimeout:5e3,integrationDelayTimeout:5e3,maxCookieSize:3e3,aliasMaxWindow:90,uploadInterval:0// Maximum milliseconds in between batch uploads, below 500 will mean immediate upload. The server returns this as a string, but we are using it as a number internally -},DefaultBaseUrls:{v1SecureServiceUrl:"jssdks.mparticle.com/v1/JS/",v2SecureServiceUrl:"jssdks.mparticle.com/v2/JS/",v3SecureServiceUrl:"jssdks.mparticle.com/v3/JS/",configUrl:"jssdkcdns.mparticle.com/JS/v2/",identityUrl:"identity.mparticle.com/v1/",aliasUrl:"jssdks.mparticle.com/v1/identity/",userAudienceUrl:"nativesdks.mparticle.com/v1/"},Base64CookieKeys:{csm:1,sa:1,ss:1,ua:1,ui:1,csd:1,ia:1,con:1},// https://go.mparticle.com/work/SQDSDKS-6039 -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",EventBatchingIntervalMillis:"eventBatchingIntervalMillis",OfflineStorage:"offlineStorage",DirectUrlRouting:"directURLRouting",CacheIdentity:"cacheIdentity",AudienceAPI:"audienceAPI"},DefaultInstance:"default_instance",CCPAPurpose:"data_sale_opt_out",IdentityMethods:{Modify:"modify",Logout:"logout",Login:"login",Identify:"identify"}};var ONE_DAY_IN_SECONDS=86400;var MILLIS_IN_ONE_SEC=1e3; +var EventTypeEnum;(function(a){a[a.Unknown=0]="Unknown",a[a.Navigation=1]="Navigation",a[a.Location=2]="Location",a[a.Search=3]="Search",a[a.Transaction=4]="Transaction",a[a.UserContent=5]="UserContent",a[a.UserPreference=6]="UserPreference",a[a.Social=7]="Social",a[a.Other=8]="Other",a[a.Media=9]="Media";})(EventTypeEnum||(EventTypeEnum={}));// TODO: https://mparticle-eng.atlassian.net/browse/SQDSDKS-5403 +var MessageType$2;(function(a){a[a.SessionStart=1]="SessionStart",a[a.SessionEnd=2]="SessionEnd",a[a.PageView=3]="PageView",a[a.PageEvent=4]="PageEvent",a[a.CrashReport=5]="CrashReport",a[a.OptOut=6]="OptOut",a[a.AppStateTransition=10]="AppStateTransition",a[a.Profile=14]="Profile",a[a.Commerce=16]="Commerce",a[a.UserAttributeChange=17]="UserAttributeChange",a[a.UserIdentityChange=18]="UserIdentityChange",a[a.Media=20]="Media";})(MessageType$2||(MessageType$2={}));var IdentityType$1;(function(a){a[a.Other=0]="Other",a[a.CustomerId=1]="CustomerId",a[a.Facebook=2]="Facebook",a[a.Twitter=3]="Twitter",a[a.Google=4]="Google",a[a.Microsoft=5]="Microsoft",a[a.Yahoo=6]="Yahoo",a[a.Email=7]="Email",a[a.FacebookCustomAudienceId=9]="FacebookCustomAudienceId",a[a.Other2=10]="Other2",a[a.Other3=11]="Other3",a[a.Other4=12]="Other4",a[a.Other5=13]="Other5",a[a.Other6=14]="Other6",a[a.Other7=15]="Other7",a[a.Other8=16]="Other8",a[a.Other9=17]="Other9",a[a.Other10=18]="Other10",a[a.MobileNumber=19]="MobileNumber",a[a.PhoneNumber2=20]="PhoneNumber2",a[a.PhoneNumber3=21]="PhoneNumber3";})(IdentityType$1||(IdentityType$1={})); /****************************************************************************** Copyright (c) Microsoft Corporation. @@ -162,6 +154,33 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; }; +var version = "2.26.2"; + +var Constants={sdkVersion:version,sdkVendor:"mparticle",platform:"web",Messages:{DeprecationMessages:{MethodIsDeprecatedPostfix:"is a deprecated method and will be removed in future releases",AlternativeMethodPrefix:"Please use the alternate method:"},ErrorMessages:{NoToken:"A token must be specified.",EventNameInvalidType:"Event name must be a valid string value.",EventDataInvalidType:"Event data must be a valid object hash.",LoggingDisabled:"Event logging is currently disabled.",CookieParseError:"Could not parse cookie",EventEmpty:"Event object is null or undefined, cancelling send",APIRequestEmpty:"APIRequest is null or undefined, cancelling send",NoEventType:"Event type must be specified.",TransactionIdRequired:"Transaction ID is required",TransactionRequired:"A transaction attributes object is required",PromotionIdRequired:"Promotion ID is required",BadAttribute:"Attribute value cannot be object or array",BadKey:"Key value cannot be object or array",BadLogPurchase:"Transaction attributes and a product are both required to log a purchase, https://docs.mparticle.com/?javascript#measuring-transactions",AudienceAPINotEnabled:"Your workspace is not enabled to retrieve user audiences."},InformationMessages:{CookieSearch:"Searching for cookie",CookieFound:"Cookie found, parsing values",CookieNotFound:"Cookies not found",CookieSet:"Setting cookie",CookieSync:"Performing cookie sync",SendBegin:"Starting to send event",SendIdentityBegin:"Starting to send event to identity server",SendWindowsPhone:"Sending event to Windows Phone container",SendIOS:"Calling iOS path: ",SendAndroid:"Calling Android JS interface method: ",SendHttp:"Sending event to mParticle HTTP service",SendAliasHttp:"Sending alias request to mParticle HTTP service",SendIdentityHttp:"Sending event to mParticle HTTP service",StartingNewSession:"Starting new Session",StartingLogEvent:"Starting to log event",StartingLogOptOut:"Starting to log user opt in/out",StartingEndSession:"Starting to end session",StartingInitialization:"Starting to initialize",StartingLogCommerceEvent:"Starting to log commerce event",StartingAliasRequest:"Starting to Alias MPIDs",LoadingConfig:"Loading configuration options",AbandonLogEvent:"Cannot log event, logging disabled or developer token not set",AbandonAliasUsers:"Cannot Alias Users, logging disabled or developer token not set",AbandonStartSession:"Cannot start session, logging disabled or developer token not set",AbandonEndSession:"Cannot end session, logging disabled or developer token not set",NoSessionToEnd:"Cannot end session, no active session found"},ValidationMessages:{ModifyIdentityRequestUserIdentitiesPresent:"identityRequests to modify require userIdentities to be present. Request not sent to server. Please fix and try again",IdentityRequesetInvalidKey:"There is an invalid key on your identityRequest object. It can only contain a `userIdentities` object and a `onUserAlias` function. Request not sent to server. Please fix and try again.",OnUserAliasType:"The onUserAlias value must be a function.",UserIdentities:"The userIdentities key must be an object with keys of identityTypes and values of strings. Request not sent to server. Please fix and try again.",UserIdentitiesInvalidKey:"There is an invalid identity key on your `userIdentities` object within the identityRequest. Request not sent to server. Please fix and try again.",UserIdentitiesInvalidValues:"All user identity values must be strings or null. Request not sent to server. Please fix and try again.",AliasMissingMpid:"Alias Request must contain both a destinationMpid and a sourceMpid",AliasNonUniqueMpid:"Alias Request's destinationMpid and sourceMpid must be unique",AliasMissingTime:"Alias Request must have both a startTime and an endTime",AliasStartBeforeEndTime:"Alias Request's endTime must be later than its startTime"}},NativeSdkPaths:{LogEvent:"logEvent",SetUserTag:"setUserTag",RemoveUserTag:"removeUserTag",SetUserAttribute:"setUserAttribute",RemoveUserAttribute:"removeUserAttribute",SetSessionAttribute:"setSessionAttribute",AddToCart:"addToCart",RemoveFromCart:"removeFromCart",ClearCart:"clearCart",LogOut:"logOut",SetUserAttributeList:"setUserAttributeList",RemoveAllUserAttributes:"removeAllUserAttributes",GetUserAttributesLists:"getUserAttributesLists",GetAllUserAttributes:"getAllUserAttributes",Identify:"identify",Logout:"logout",Login:"login",Modify:"modify",Alias:"aliasUsers",Upload:"upload"},StorageNames:{localStorageName:"mprtcl-api",localStorageNameV3:"mprtcl-v3",cookieName:"mprtcl-api",cookieNameV2:"mprtcl-v2",cookieNameV3:"mprtcl-v3",localStorageNameV4:"mprtcl-v4",localStorageProductsV4:"mprtcl-prodv4",cookieNameV4:"mprtcl-v4",currentStorageName:"mprtcl-v4",currentStorageProductsName:"mprtcl-prodv4"},DefaultConfig:{cookieDomain:null,cookieExpiration:365,logLevel:null,timeout:300,sessionTimeout:30,maxProducts:20,forwarderStatsTimeout:5e3,integrationDelayTimeout:5e3,maxCookieSize:3e3,aliasMaxWindow:90,uploadInterval:0// Maximum milliseconds in between batch uploads, below 500 will mean immediate upload. The server returns this as a string, but we are using it as a number internally +},DefaultBaseUrls:{v1SecureServiceUrl:"jssdks.mparticle.com/v1/JS/",v2SecureServiceUrl:"jssdks.mparticle.com/v2/JS/",v3SecureServiceUrl:"jssdks.mparticle.com/v3/JS/",configUrl:"jssdkcdns.mparticle.com/JS/v2/",identityUrl:"identity.mparticle.com/v1/",aliasUrl:"jssdks.mparticle.com/v1/identity/",userAudienceUrl:"nativesdks.mparticle.com/v1/"},Base64CookieKeys:{csm:1,sa:1,ss:1,ua:1,ui:1,csd:1,ia:1,con:1},// https://go.mparticle.com/work/SQDSDKS-6039 +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",EventBatchingIntervalMillis:"eventBatchingIntervalMillis",OfflineStorage:"offlineStorage",DirectUrlRouting:"directURLRouting",CacheIdentity:"cacheIdentity",AudienceAPI:"audienceAPI"},DefaultInstance:"default_instance",CCPAPurpose:"data_sale_opt_out",IdentityMethods:{Modify:"modify",Logout:"logout",Login:"login",Identify:"identify"}};var ONE_DAY_IN_SECONDS=86400;var MILLIS_IN_ONE_SEC=1e3; + +var Messages$9=Constants.Messages,createCookieString=function(a){return replaceCommasWithPipes(replaceQuotesWithApostrophes(a))},revertCookieString=function(a){return replacePipesWithCommas(replaceApostrophesWithQuotes(a))},inArray=function(a,b){var c=0;if(Array.prototype.indexOf)return 0<=a.indexOf(b,0);for(var d=a.length;c>c/4).toString(16):(c^16*Math.random()>>c/4).toString(16)},generateUniqueId=function(b){return void 0===b&&(b=""),b// if the placeholder was passed, return +?generateRandomValue()// if the placeholder was passed, return +:// [1e7] -> // 10000000 + +// -1e3 -> // -1000 + +// -4e3 -> // -4000 + +// -8e3 -> // -80000000 + +// -1e11 -> //-100000000000, +"".concat(1e7,"-").concat(1e3,"-").concat(4e3,"-").concat(8e3,"-").concat(1e11).replace(/[018]/g,// zeroes, ones, and eights with +generateUniqueId// random hex digits +)},getRampNumber=function(a){if(!a)return 100;var b=generateHash(a);return Math.abs(b%100)+1},isObject=function(a){var b=Object.prototype.toString.call(a);return "[object Object]"===b||"[object Error]"===b},parseNumber=function(a){if(isNaN(a)||!isFinite(a))return 0;var b=parseFloat(a);return isNaN(b)?0:b},parseStringOrNumber=function(a){return isStringOrNumber(a)?a:null},replaceCommasWithPipes=function(a){return a.replace(/,/g,"|")},replacePipesWithCommas=function(a){return a.replace(/\|/g,",")},replaceApostrophesWithQuotes=function(a){return a.replace(/\'/g,"\"")},replaceQuotesWithApostrophes=function(a){return a.replace(/\"/g,"'")},returnConvertedBoolean=function(a){return "false"!==a&&"0"!==a&&!!a},decoded=function(a){return decodeURIComponent(a.replace(/\+/g," "))},converted=function(a){return 0===a.indexOf("\"")&&(a=a.slice(1,-1).replace(/\\"/g,"\"").replace(/\\\\/g,"\\")),a},isString=function(a){return "string"==typeof a},isNumber=function(a){return "number"==typeof a},isBoolean=function(a){return "boolean"==typeof a},isFunction=function(a){return "function"==typeof a},isValidCustomFlagProperty=function(a){return isNumber(a)||isString(a)||isBoolean(a)},toDataPlanSlug=function(a){// Make sure we are only acting on strings or numbers +return isStringOrNumber(a)?a.toString().toLowerCase().replace(/[^0-9a-zA-Z]+/g,"_"):""},isDataPlanSlug=function(a){return a===toDataPlanSlug(a)},isStringOrNumber=function(a){return isString(a)||isNumber(a)},isEmpty=function(a){return null==a||!(Object.keys(a)||a).length},moveElementToEnd=function(a,b){return a.slice(0,b).concat(a.slice(b+1),a[b])};/** + * Returns a value between 1-100 inclusive. + */ // FIXME: REFACTOR for V3 + +function getNewIdentitiesByName(a){var b={};for(var c in a){var d=getIdentityName(parseNumber(c));b[d]=a[c];}return b}function getIdentityName(a){return a===IdentityType$1.Other?"other":a===IdentityType$1.CustomerId?"customerid":a===IdentityType$1.Facebook?"facebook":a===IdentityType$1.Twitter?"twitter":a===IdentityType$1.Google?"google":a===IdentityType$1.Microsoft?"microsoft":a===IdentityType$1.Yahoo?"yahoo":a===IdentityType$1.Email?"email":a===IdentityType$1.FacebookCustomAudienceId?"facebookcustomaudienceid":a===IdentityType$1.Other2?"other2":a===IdentityType$1.Other3?"other3":a===IdentityType$1.Other4?"other4":a===IdentityType$1.Other5?"other5":a===IdentityType$1.Other6?"other6":a===IdentityType$1.Other7?"other7":a===IdentityType$1.Other8?"other8":a===IdentityType$1.Other9?"other9":a===IdentityType$1.Other10?"other10":a===IdentityType$1.MobileNumber?"mobile_number":a===IdentityType$1.PhoneNumber2?"phone_number_2":a===IdentityType$1.PhoneNumber3?"phone_number_3":null} + +var _TriggerUploadType;var MessageType$1={SessionStart:1,SessionEnd:2,PageView:3,PageEvent:4,CrashReport:5,OptOut:6,AppStateTransition:10,Profile:14,Commerce:16,Media:20,UserAttributeChange:17,UserIdentityChange:18},TriggerUploadType=(_TriggerUploadType={},_defineProperty(_TriggerUploadType,MessageType$1.Commerce,1),_defineProperty(_TriggerUploadType,MessageType$1.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};// Dictionary that contains MessageTypes that will +// trigger an immediate upload. +// Continuation of enum above, but in seperate object since we don't expose these to end user +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 getIdentityName(a)};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$1={AppInit:1},Environment={Production:"production",Development:"development"};var Types = {MessageType:MessageType$1,EventType:EventType,CommerceEventType:CommerceEventType,IdentityType:IdentityType,ProfileMessageType:ProfileMessageType,ApplicationTransitionType:ApplicationTransitionType$1,ProductActionType:ProductActionType,PromotionActionType:PromotionActionType,TriggerUploadType:TriggerUploadType,Environment:Environment}; + var SDKProductActionType;(function(a){a[a.Unknown=0]="Unknown",a[a.AddToCart=1]="AddToCart",a[a.RemoveFromCart=2]="RemoveFromCart",a[a.Checkout=3]="Checkout",a[a.CheckoutOption=4]="CheckoutOption",a[a.Click=5]="Click",a[a.ViewDetail=6]="ViewDetail",a[a.Purchase=7]="Purchase",a[a.Refund=8]="Refund",a[a.AddToWishlist=9]="AddToWishlist",a[a.RemoveFromWishlist=10]="RemoveFromWishlist";})(SDKProductActionType||(SDKProductActionType={}));var SDKIdentityTypeEnum;(function(a){a.other="other",a.customerId="customerid",a.facebook="facebook",a.twitter="twitter",a.google="google",a.microsoft="microsoft",a.yahoo="yahoo",a.email="email",a.alias="alias",a.facebookCustomAudienceId="facebookcustomaudienceid",a.otherId2="other2",a.otherId3="other3",a.otherId4="other4",a.otherId5="other5",a.otherId6="other6",a.otherId7="other7",a.otherId8="other8",a.otherId9="other9",a.otherId10="other10",a.mobileNumber="mobile_number",a.phoneNumber2="phone_number_2",a.phoneNumber3="phone_number_3";})(SDKIdentityTypeEnum||(SDKIdentityTypeEnum={})); var dist = {}; @@ -394,20 +413,6 @@ var dist = {}; })(exports.UserIdentityChangeEventEventTypeEnum || (exports.UserIdentityChangeEventEventTypeEnum = {})); } (dist)); -var Messages$9=Constants.Messages,createCookieString=function(a){return replaceCommasWithPipes(replaceQuotesWithApostrophes(a))},revertCookieString=function(a){return replacePipesWithCommas(replaceApostrophesWithQuotes(a))},inArray=function(a,b){var c=0;if(Array.prototype.indexOf)return 0<=a.indexOf(b,0);for(var d=a.length;c>c/4).toString(16):(c^16*Math.random()>>c/4).toString(16)},generateUniqueId=function(b){return void 0===b&&(b=""),b// if the placeholder was passed, return -?generateRandomValue()// if the placeholder was passed, return -:// [1e7] -> // 10000000 + -// -1e3 -> // -1000 + -// -4e3 -> // -4000 + -// -8e3 -> // -80000000 + -// -1e11 -> //-100000000000, -"".concat(1e7,"-").concat(1e3,"-").concat(4e3,"-").concat(8e3,"-").concat(1e11).replace(/[018]/g,// zeroes, ones, and eights with -generateUniqueId// random hex digits -)},getRampNumber=function(a){if(!a)return 100;var b=generateHash(a);return Math.abs(b%100)+1},isObject=function(a){var b=Object.prototype.toString.call(a);return "[object Object]"===b||"[object Error]"===b},parseNumber=function(a){if(isNaN(a)||!isFinite(a))return 0;var b=parseFloat(a);return isNaN(b)?0:b},parseStringOrNumber=function(a){return isStringOrNumber(a)?a:null},replaceCommasWithPipes=function(a){return a.replace(/,/g,"|")},replacePipesWithCommas=function(a){return a.replace(/\|/g,",")},replaceApostrophesWithQuotes=function(a){return a.replace(/\'/g,"\"")},replaceQuotesWithApostrophes=function(a){return a.replace(/\"/g,"'")},returnConvertedBoolean=function(a){return "false"!==a&&"0"!==a&&!!a},decoded=function(a){return decodeURIComponent(a.replace(/\+/g," "))},converted=function(a){return 0===a.indexOf("\"")&&(a=a.slice(1,-1).replace(/\\"/g,"\"").replace(/\\\\/g,"\\")),a},isString=function(a){return "string"==typeof a},isNumber=function(a){return "number"==typeof a},isBoolean=function(a){return "boolean"==typeof a},isFunction=function(a){return "function"==typeof a},isValidCustomFlagProperty=function(a){return isNumber(a)||isString(a)||isBoolean(a)},toDataPlanSlug=function(a){// Make sure we are only acting on strings or numbers -return isStringOrNumber(a)?a.toString().toLowerCase().replace(/[^0-9a-zA-Z]+/g,"_"):""},isDataPlanSlug=function(a){return a===toDataPlanSlug(a)},isStringOrNumber=function(a){return isString(a)||isNumber(a)},isEmpty=function(a){return null==a||!(Object.keys(a)||a).length};/** - * Returns a value between 1-100 inclusive. - */ // FIXME: REFACTOR for V3 - function convertEvents(a,b,c){if(!a)return null;if(!b||1>b.length)return null;for(var d,e=c.Identity.getCurrentUser(),f=[],g=null,h=0,i=b;hc?void d.currentSessionMPIDs.push(a):void(0<=c&&(d.currentSessionMPIDs=moveElementToEnd(d.currentSessionMPIDs,c)))},this.getFirstSeenTime=function(a){return a?d.persistenceData&&d.persistenceData[a]&&d.persistenceData[a].fst?d.persistenceData[a].fst:null:null},this.setFirstSeenTime=function(a,c){if(a){var e=c||new Date().getTime();d.persistenceData&&(!d.persistenceData[a]&&(d.persistenceData[a]={}),!d.persistenceData[a].fst&&(d.persistenceData[a].fst=e,b._Persistence.savePersistence(d.persistenceData)));}},this.getLastSeenTime=function(a){if(!a)return null;// // https://go.mparticle.com/work/SQDSDKS-6315 var c=b.Identity.getCurrentUser();return a===(null===c||void 0===c?void 0:c.getMPID())?new Date().getTime():d.persistenceData&&d.persistenceData[a]&&d.persistenceData[a].lst?d.persistenceData[a].lst:null},this.setLastSeenTime=function(a,c){if(a){var e=c||new Date().getTime();d.persistenceData&&(!d.persistenceData[a]&&(d.persistenceData[a]={}),!d.persistenceData[a].lst&&(d.persistenceData[a].lst=e,b._Persistence.savePersistence(d.persistenceData)));}},this.nullifySession=function(){d.sessionId=null,d.dateLastEventSent=null,d.sessionAttributes={},b._Persistence.update();},this.processConfig=function(a){var c=a.workspaceToken,e=a.requiredWebviewBridgeName;// We should reprocess the flags in case they have changed when we request an updated config // such as if the SDK is being self-hosted and the flags are different on the server config // https://go.mparticle.com/work/SQDSDKS-6317 @@ -620,8 +625,10 @@ for(var n,o=0;of);o++)n=h[o],b[n]?(a.Logger.verb // other keys on the cookie are currentSessionMPIDs and currentMPID which should not be searched if(d[g].mpid){var h=d[g].ui;for(var i in h)if(e===i&&b.userIdentities[e]===h[i]){c=g;break}}c&&f.storeDataInMemory(d,c);},this.encodePersistence=function(b){for(var c in b=JSON.parse(b),b.gs)b.gs.hasOwnProperty(c)&&(Base64CookieKeys[c]?b.gs[c]?Array.isArray(b.gs[c])&&b.gs[c].length||a._Helpers.isObject(b.gs[c])&&Object.keys(b.gs[c]).length?b.gs[c]=Base64.encode(JSON.stringify(b.gs[c])):delete b.gs[c]:delete b.gs[c]:"ie"===c?b.gs[c]=b.gs[c]?1:0:!b.gs[c]&&delete b.gs[c]);for(var d in b)if(b.hasOwnProperty(d)&&!SDKv2NonMPIDCookieKeys[d])for(c in b[d])b[d].hasOwnProperty(c)&&Base64CookieKeys[c]&&(a._Helpers.isObject(b[d][c])&&Object.keys(b[d][c]).length?b[d][c]=Base64.encode(JSON.stringify(b[d][c])):delete b[d][c]);return createCookieString(JSON.stringify(b))},this.decodePersistence=function(b){try{if(b){if(b=JSON.parse(revertCookieString(b)),a._Helpers.isObject(b)&&Object.keys(b).length){for(var c in b.gs)b.gs.hasOwnProperty(c)&&(Base64CookieKeys[c]?b.gs[c]=JSON.parse(Base64.decode(b.gs[c])):"ie"===c&&(b.gs[c]=!!b.gs[c]));for(var d in b)if(b.hasOwnProperty(d))if(!SDKv2NonMPIDCookieKeys[d])for(c in b[d])b[d].hasOwnProperty(c)&&Base64CookieKeys[c]&&b[d][c].length&&(b[d][c]=JSON.parse(Base64.decode(b[d][c])));else "l"===d&&(b[d]=!!b[d]);}return JSON.stringify(b)}}catch(b){a.Logger.error("Problem with decoding cookie",b);}},this.getCookieDomain=function(){if(a._Store.SDKConfig.cookieDomain)return a._Store.SDKConfig.cookieDomain;var b=f.getDomain(document,location.hostname);return ""===b?"":"."+b},this.getDomain=function(a,b){var c,d,e=b.split(".");for(c=e.length-1;0<=c;c--)if(d=e.slice(c).join("."),a.cookie="mptest=cookie;domain=."+d+";",-1e.status))?[3/*break*/,4]:(this.logger.verbose("User Audiences successfully received"),[4/*yield*/,e.json()]);case 3:f=i.sent(),g={currentAudienceMemberships:null===f||void 0===f?void 0:f.audience_memberships};try{b(g);}catch(a){throw new Error("Error invoking callback on user audience response.")}return [3/*break*/,5];case 4:if(401===e.status)throw new Error("`HTTP error status ${userAudiencePromise.status} while retrieving User Audiences - please verify your API key.`");else if(403===e.status)throw new Error("`HTTP error status ${userAudiencePromise.status} while retrieving User Audiences - please verify your workspace is enabled for audiences.`");else// In case there is an HTTP error we did not anticipate. throw new Error("Uncaught HTTP Error ".concat(e.status,"."));case 5:return [3/*break*/,7];case 6:return h=i.sent(),this.logger.error("Error retrieving audiences. ".concat(h)),[3/*break*/,7];case 7:return [2/*return*/]}})})},a}(); -var Messages$2=Constants.Messages,HTTPCodes$2=Constants.HTTPCodes,FeatureFlags$1=Constants.FeatureFlags,ErrorMessages=Messages$2.ErrorMessages,_Constants$IdentityMe=Constants.IdentityMethods,Identify=_Constants$IdentityMe.Identify,Modify$1=_Constants$IdentityMe.Modify,Login=_Constants$IdentityMe.Login,Logout=_Constants$IdentityMe.Logout;function Identity(t){var r=this;/** +function didUserChange(a,b){return !a||b.getMPID()!==a.getMPID()||a.isLoggedIn()!==b.isLoggedIn()} + +var Messages$2=Constants.Messages,HTTPCodes$2=Constants.HTTPCodes,FeatureFlags$1=Constants.FeatureFlags,IdentityMethods=Constants.IdentityMethods,ErrorMessages=Messages$2.ErrorMessages,CacheIdentity=FeatureFlags$1.CacheIdentity,Identify=IdentityMethods.Identify,Modify$1=IdentityMethods.Modify,Login=IdentityMethods.Login,Logout=IdentityMethods.Logout;function Identity(t){var r=t._Helpers,s=r.getFeatureFlag,i=r.extend,n=this;// https://go.mparticle.com/work/SQDSDKS-6353 +/** * Invoke these methods on the mParticle.Identity object. * Example: mParticle.Identity.getCurrentUser(). * @class mParticle.Identity - */ /** + */ // https://go.mparticle.com/work/SQDSDKS-6354 +/** * Invoke these methods on the mParticle.Identity.getCurrentUser() object. * Example: mParticle.Identity.getCurrentUser().getAllUserAttributes() * @class mParticle.Identity.getCurrentUser() @@ -736,46 +747,51 @@ var Messages$2=Constants.Messages,HTTPCodes$2=Constants.HTTPCodes,FeatureFlags$1 * Example: mParticle.Identity.getCurrentUser().getCart().add(...); * @class mParticle.Identity.getCurrentUser().getCart() * @deprecated - */ // send a user identity change request on identify, login, logout, modify when any values change. + */ // https://go.mparticle.com/work/SQDSDKS-6355 +// send a user identity change request on identify, login, logout, modify when any values change. // compare what identities exist vs what is previously was for the specific user if they were in memory before. // if it's the first time the user is logging in, send a user identity change request with -this.idCache=null,this.audienceManager=null,this.checkIdentitySwap=function(e,r,s){if(e&&r&&e!==r){var i=t._Persistence.getPersistence();i&&(i.cu=r,i.gs.csm=s,t._Persistence.savePersistence(i));}},this.IdentityRequest={preProcessIdentityRequest:function preProcessIdentityRequest(e,r,s){t.Logger.verbose(Messages$2.InformationMessages.StartingLogEvent+": "+s);var i=t._Helpers.Validators.validateIdentities(e,s);if(!i.valid)return t.Logger.error("ERROR: "+i.error),{valid:!1,error:i.error};if(r&&!t._Helpers.Validators.isFunction(r)){var n="The optional callback must be a function. You tried entering a(n) "+_typeof(r);return t.Logger.error(n),{valid:!1,error:n}}return {valid:!0}},createIdentityRequest:function createIdentityRequest(e,r,s,i,n,a,o){var d={client_sdk:{platform:r,sdk_vendor:s,sdk_version:i},context:a,environment:t._Store.SDKConfig.isDevelopmentMode?"development":"production",request_id:t._Helpers.generateUniqueId(),request_timestamp_ms:new Date().getTime(),previous_mpid:o||null,known_identities:createKnownIdentities(e,n)};return d},createModifyIdentityRequest:function createModifyIdentityRequest(e,r,s,i,n,a){return {client_sdk:{platform:s,sdk_vendor:i,sdk_version:n},context:a,environment:t._Store.SDKConfig.isDevelopmentMode?"development":"production",request_id:t._Helpers.generateUniqueId(),request_timestamp_ms:new Date().getTime(),identity_changes:this.createIdentityChanges(e,r)}},createIdentityChanges:function createIdentityChanges(e,r){var s,i=[];if(r&&t._Helpers.isObject(r)&&e&&t._Helpers.isObject(e))for(s in r)i.push({old_value:e[s]||null,new_value:r[s],identity_type:s});return i},// takes 2 UI objects keyed by name, combines them, returns them keyed by type -combineUserIdentities:function combineUserIdentities(e,r){var s={},i=t._Helpers.extend(e,r);for(var n in i){var a=Types.IdentityType.getIdentityType(n);// this check removes anything that is not whitelisted as an identity type -!1!==a&&0<=a&&(s[Types.IdentityType.getIdentityType(n)]=i[n]);}return s},createAliasNetworkRequest:function createAliasNetworkRequest(e){return {request_id:t._Helpers.generateUniqueId(),request_type:"alias",environment:t._Store.SDKConfig.isDevelopmentMode?"development":"production",api_key:t._Store.devToken,data:{destination_mpid:e.destinationMpid,source_mpid:e.sourceMpid,start_unixtime_ms:e.startTime,end_unixtime_ms:e.endTime,scope:e.scope,device_application_stamp:t._Store.deviceId}}},convertAliasToNative:function convertAliasToNative(e){return {DestinationMpid:e.destinationMpid,SourceMpid:e.sourceMpid,StartUnixtimeMs:e.startTime,EndUnixtimeMs:e.endTime}},convertToNative:function convertToNative(e){var t=[];if(e&&e.userIdentities){for(var r in e.userIdentities)e.userIdentities.hasOwnProperty(r)&&t.push({Type:Types.IdentityType.getIdentityType(r),Identity:e.userIdentities[r]});return {UserIdentities:t}}}},this.IdentityAPI={HTTPCodes:HTTPCodes$2,/** +this.idCache=null,this.audienceManager=null,this.IdentityRequest={preProcessIdentityRequest:function preProcessIdentityRequest(e,r,s){t.Logger.verbose(Messages$2.InformationMessages.StartingLogEvent+": "+s);var i=t._Helpers.Validators.validateIdentities(e,s);if(!i.valid)return t.Logger.error("ERROR: "+i.error),{valid:!1,error:i.error};if(r&&!t._Helpers.Validators.isFunction(r)){var n="The optional callback must be a function. You tried entering a(n) "+_typeof(r);return t.Logger.error(n),{valid:!1,error:n}}return {valid:!0}},createIdentityRequest:function createIdentityRequest(e,r,s,i,n,a,d){var o={client_sdk:{platform:r,sdk_vendor:s,sdk_version:i},context:a,environment:t._Store.SDKConfig.isDevelopmentMode?"development":"production",request_id:t._Helpers.generateUniqueId(),request_timestamp_ms:new Date().getTime(),previous_mpid:d||null,known_identities:createKnownIdentities(e,n)};return o},createModifyIdentityRequest:function createModifyIdentityRequest(e,r,s,i,n,a){return {client_sdk:{platform:s,sdk_vendor:i,sdk_version:n},context:a,environment:t._Store.SDKConfig.isDevelopmentMode?"development":"production",request_id:t._Helpers.generateUniqueId(),request_timestamp_ms:new Date().getTime(),identity_changes:this.createIdentityChanges(e,r)}},createIdentityChanges:function createIdentityChanges(e,t){var r,s=[];if(t&&isObject(t)&&e&&isObject(e))for(r in t)s.push({old_value:e[r]||null,new_value:t[r],identity_type:r});return s},// takes 2 UI objects keyed by name, combines them, returns them keyed by type +combineUserIdentities:function combineUserIdentities(e,t){var r={},s=i({},e,t);for(var n in s){var a=Types.IdentityType.getIdentityType(n);// this check removes anything that is not whitelisted as an identity type +!1!==a&&0<=a&&(r[Types.IdentityType.getIdentityType(n)]=s[n]);}return r},createAliasNetworkRequest:function createAliasNetworkRequest(e){return {request_id:t._Helpers.generateUniqueId(),request_type:"alias",environment:t._Store.SDKConfig.isDevelopmentMode?"development":"production",api_key:t._Store.devToken,data:{destination_mpid:e.destinationMpid,source_mpid:e.sourceMpid,start_unixtime_ms:e.startTime,end_unixtime_ms:e.endTime,scope:e.scope,device_application_stamp:t._Store.deviceId}}},convertAliasToNative:function convertAliasToNative(e){return {DestinationMpid:e.destinationMpid,SourceMpid:e.sourceMpid,StartUnixtimeMs:e.startTime,EndUnixtimeMs:e.endTime}},convertToNative:function convertToNative(e){var t=[];if(e&&e.userIdentities){for(var r in e.userIdentities)e.userIdentities.hasOwnProperty(r)&&t.push({Type:Types.IdentityType.getIdentityType(r),Identity:e.userIdentities[r]});return {UserIdentities:t}}}},this.IdentityAPI={HTTPCodes:HTTPCodes$2,/** * Initiate a logout request to the mParticle server * @method identify * @param {Object} identityApiData The identityApiData object as indicated [here](https://github.com/mParticle/mparticle-sdk-javascript/blob/master-v2/README.md#1-customize-the-sdk) * @param {Function} [callback] A callback function that is called when the identify request completes - */identify:function identify(e,s){var i,n=t.Identity.getCurrentUser(),a=t._Identity.IdentityRequest.preProcessIdentityRequest(e,s,Identify);if(n&&(i=n.getMPID()),a.valid){var o=t._Identity.IdentityRequest.createIdentityRequest(e,Constants.platform,Constants.sdkVendor,Constants.sdkVersion,t._Store.deviceId,t._Store.context,i);if(t._Helpers.getFeatureFlag(Constants.FeatureFlags.CacheIdentity)){var d=tryCacheIdentity(o.known_identities,r.idCache,r.parseIdentityResponse,i,s,e,Identify);if(d)return}t._Helpers.canLog()?t._Store.webviewBridgeEnabled?(t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Identify,JSON.stringify(t._Identity.IdentityRequest.convertToNative(e))),t._Helpers.invokeCallback(s,HTTPCodes$2.nativeIdentityRequest,"Identify request sent to native sdk")):t._IdentityAPIClient.sendIdentityRequest(o,Identify,s,e,r.parseIdentityResponse,i,o.known_identities):(t._Helpers.invokeCallback(s,HTTPCodes$2.loggingDisabledOrMissingAPIKey,Messages$2.InformationMessages.AbandonLogEvent),t.Logger.verbose(Messages$2.InformationMessages.AbandonLogEvent));}else t._Helpers.invokeCallback(s,HTTPCodes$2.validationIssue,a.error),t.Logger.verbose(a);},/** + */identify:function identify(e,r){// https://go.mparticle.com/work/SQDSDKS-6337 +var s,i=t.Identity.getCurrentUser(),a=t._Identity.IdentityRequest.preProcessIdentityRequest(e,r,Identify);if(i&&(s=i.getMPID()),a.valid){var d=t._Identity.IdentityRequest.createIdentityRequest(e,Constants.platform,Constants.sdkVendor,Constants.sdkVersion,t._Store.deviceId,t._Store.context,s);if(t._Helpers.getFeatureFlag(Constants.FeatureFlags.CacheIdentity)){var o=tryCacheIdentity(d.known_identities,n.idCache,n.parseIdentityResponse,s,r,e,Identify);if(o)return}t._Helpers.canLog()?t._Store.webviewBridgeEnabled?(t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Identify,JSON.stringify(t._Identity.IdentityRequest.convertToNative(e))),t._Helpers.invokeCallback(r,HTTPCodes$2.nativeIdentityRequest,"Identify request sent to native sdk")):t._IdentityAPIClient.sendIdentityRequest(d,Identify,r,e,n.parseIdentityResponse,s,d.known_identities):(t._Helpers.invokeCallback(r,HTTPCodes$2.loggingDisabledOrMissingAPIKey,Messages$2.InformationMessages.AbandonLogEvent),t.Logger.verbose(Messages$2.InformationMessages.AbandonLogEvent));}else t._Helpers.invokeCallback(r,HTTPCodes$2.validationIssue,a.error),t.Logger.verbose(a);},/** * Initiate a logout request to the mParticle server * @method logout * @param {Object} identityApiData The identityApiData object as indicated [here](https://github.com/mParticle/mparticle-sdk-javascript/blob/master-v2/README.md#1-customize-the-sdk) * @param {Function} [callback] A callback function that is called when the logout request completes - */logout:function logout(e,s){var i,n=t.Identity.getCurrentUser(),a=t._Identity.IdentityRequest.preProcessIdentityRequest(e,s,Logout);if(n&&(i=n.getMPID()),a.valid){var o,d=t._Identity.IdentityRequest.createIdentityRequest(e,Constants.platform,Constants.sdkVendor,Constants.sdkVersion,t._Store.deviceId,t._Store.context,i);t._Helpers.canLog()?t._Store.webviewBridgeEnabled?(t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Logout,JSON.stringify(t._Identity.IdentityRequest.convertToNative(e))),t._Helpers.invokeCallback(s,HTTPCodes$2.nativeIdentityRequest,"Logout request sent to native sdk")):(t._IdentityAPIClient.sendIdentityRequest(d,Logout,s,e,r.parseIdentityResponse,i),o=t._ServerModel.createEventObject({messageType:Types.MessageType.Profile}),o.ProfileMessageType=Types.ProfileMessageType.Logout,t._Store.activeForwarders.length&&t._Store.activeForwarders.forEach(function(e){e.logOut&&e.logOut(o);})):(t._Helpers.invokeCallback(s,HTTPCodes$2.loggingDisabledOrMissingAPIKey,Messages$2.InformationMessages.AbandonLogEvent),t.Logger.verbose(Messages$2.InformationMessages.AbandonLogEvent));}else t._Helpers.invokeCallback(s,HTTPCodes$2.validationIssue,a.error),t.Logger.verbose(a);},/** + */logout:function logout(e,r){// https://go.mparticle.com/work/SQDSDKS-6337 +var s,i=t.Identity.getCurrentUser(),a=t._Identity.IdentityRequest.preProcessIdentityRequest(e,r,Logout);if(i&&(s=i.getMPID()),a.valid){var d,o=t._Identity.IdentityRequest.createIdentityRequest(e,Constants.platform,Constants.sdkVendor,Constants.sdkVersion,t._Store.deviceId,t._Store.context,s);t._Helpers.canLog()?t._Store.webviewBridgeEnabled?(t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Logout,JSON.stringify(t._Identity.IdentityRequest.convertToNative(e))),t._Helpers.invokeCallback(r,HTTPCodes$2.nativeIdentityRequest,"Logout request sent to native sdk")):(t._IdentityAPIClient.sendIdentityRequest(o,Logout,r,e,n.parseIdentityResponse,s),d=t._ServerModel.createEventObject({messageType:Types.MessageType.Profile}),d.ProfileMessageType=Types.ProfileMessageType.Logout,t._Store.activeForwarders.length&&t._Store.activeForwarders.forEach(function(e){e.logOut&&e.logOut(d);})):(t._Helpers.invokeCallback(r,HTTPCodes$2.loggingDisabledOrMissingAPIKey,Messages$2.InformationMessages.AbandonLogEvent),t.Logger.verbose(Messages$2.InformationMessages.AbandonLogEvent));}else t._Helpers.invokeCallback(r,HTTPCodes$2.validationIssue,a.error),t.Logger.verbose(a);},/** * Initiate a login request to the mParticle server * @method login * @param {Object} identityApiData The identityApiData object as indicated [here](https://github.com/mParticle/mparticle-sdk-javascript/blob/master-v2/README.md#1-customize-the-sdk) * @param {Function} [callback] A callback function that is called when the login request completes - */login:function login(e,s){var i,n=t.Identity.getCurrentUser(),a=t._Identity.IdentityRequest.preProcessIdentityRequest(e,s,Login);if(n&&(i=n.getMPID()),a.valid){var o=t._Identity.IdentityRequest.createIdentityRequest(e,Constants.platform,Constants.sdkVendor,Constants.sdkVersion,t._Store.deviceId,t._Store.context,i);if(t._Helpers.getFeatureFlag(Constants.FeatureFlags.CacheIdentity)){var d=tryCacheIdentity(o.known_identities,r.idCache,r.parseIdentityResponse,i,s,e,Login);if(d)return}t._Helpers.canLog()?t._Store.webviewBridgeEnabled?(t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Login,JSON.stringify(t._Identity.IdentityRequest.convertToNative(e))),t._Helpers.invokeCallback(s,HTTPCodes$2.nativeIdentityRequest,"Login request sent to native sdk")):t._IdentityAPIClient.sendIdentityRequest(o,Login,s,e,r.parseIdentityResponse,i,o.known_identities):(t._Helpers.invokeCallback(s,HTTPCodes$2.loggingDisabledOrMissingAPIKey,Messages$2.InformationMessages.AbandonLogEvent),t.Logger.verbose(Messages$2.InformationMessages.AbandonLogEvent));}else t._Helpers.invokeCallback(s,HTTPCodes$2.validationIssue,a.error),t.Logger.verbose(a);},/** + */login:function login(e,r){// https://go.mparticle.com/work/SQDSDKS-6337 +var s,i=t.Identity.getCurrentUser(),a=t._Identity.IdentityRequest.preProcessIdentityRequest(e,r,Login);if(i&&(s=i.getMPID()),a.valid){var d=t._Identity.IdentityRequest.createIdentityRequest(e,Constants.platform,Constants.sdkVendor,Constants.sdkVersion,t._Store.deviceId,t._Store.context,s);if(t._Helpers.getFeatureFlag(Constants.FeatureFlags.CacheIdentity)){var o=tryCacheIdentity(d.known_identities,n.idCache,n.parseIdentityResponse,s,r,e,Login);if(o)return}t._Helpers.canLog()?t._Store.webviewBridgeEnabled?(t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Login,JSON.stringify(t._Identity.IdentityRequest.convertToNative(e))),t._Helpers.invokeCallback(r,HTTPCodes$2.nativeIdentityRequest,"Login request sent to native sdk")):t._IdentityAPIClient.sendIdentityRequest(d,Login,r,e,n.parseIdentityResponse,s,d.known_identities):(t._Helpers.invokeCallback(r,HTTPCodes$2.loggingDisabledOrMissingAPIKey,Messages$2.InformationMessages.AbandonLogEvent),t.Logger.verbose(Messages$2.InformationMessages.AbandonLogEvent));}else t._Helpers.invokeCallback(r,HTTPCodes$2.validationIssue,a.error),t.Logger.verbose(a);},/** * Initiate a modify request to the mParticle server * @method modify * @param {Object} identityApiData The identityApiData object as indicated [here](https://github.com/mParticle/mparticle-sdk-javascript/blob/master-v2/README.md#1-customize-the-sdk) * @param {Function} [callback] A callback function that is called when the modify request completes - */modify:function modify(e,s){var i,n=t.Identity.getCurrentUser(),a=t._Identity.IdentityRequest.preProcessIdentityRequest(e,s,Modify$1);n&&(i=n.getMPID());var o=e&&e.userIdentities?e.userIdentities:{};if(a.valid){var d=t._Identity.IdentityRequest.createModifyIdentityRequest(n?n.getUserIdentities().userIdentities:{},o,Constants.platform,Constants.sdkVendor,Constants.sdkVersion,t._Store.context);t._Helpers.canLog()?t._Store.webviewBridgeEnabled?(t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Modify,JSON.stringify(t._Identity.IdentityRequest.convertToNative(e))),t._Helpers.invokeCallback(s,HTTPCodes$2.nativeIdentityRequest,"Modify request sent to native sdk")):t._IdentityAPIClient.sendIdentityRequest(d,Modify$1,s,e,r.parseIdentityResponse,i,d.known_identities):(t._Helpers.invokeCallback(s,HTTPCodes$2.loggingDisabledOrMissingAPIKey,Messages$2.InformationMessages.AbandonLogEvent),t.Logger.verbose(Messages$2.InformationMessages.AbandonLogEvent));}else t._Helpers.invokeCallback(s,HTTPCodes$2.validationIssue,a.error),t.Logger.verbose(a);},/** + */modify:function modify(e,r){// https://go.mparticle.com/work/SQDSDKS-6337 +var s,i=t.Identity.getCurrentUser(),a=t._Identity.IdentityRequest.preProcessIdentityRequest(e,r,Modify$1);i&&(s=i.getMPID());var d=e&&e.userIdentities?e.userIdentities:{};if(a.valid){var o=t._Identity.IdentityRequest.createModifyIdentityRequest(i?i.getUserIdentities().userIdentities:{},d,Constants.platform,Constants.sdkVendor,Constants.sdkVersion,t._Store.context);t._Helpers.canLog()?t._Store.webviewBridgeEnabled?(t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Modify,JSON.stringify(t._Identity.IdentityRequest.convertToNative(e))),t._Helpers.invokeCallback(r,HTTPCodes$2.nativeIdentityRequest,"Modify request sent to native sdk")):t._IdentityAPIClient.sendIdentityRequest(o,Modify$1,r,e,n.parseIdentityResponse,s,o.known_identities):(t._Helpers.invokeCallback(r,HTTPCodes$2.loggingDisabledOrMissingAPIKey,Messages$2.InformationMessages.AbandonLogEvent),t.Logger.verbose(Messages$2.InformationMessages.AbandonLogEvent));}else t._Helpers.invokeCallback(r,HTTPCodes$2.validationIssue,a.error),t.Logger.verbose(a);},/** * Returns a user object with methods to interact with the current user * @method getCurrentUser * @return {Object} the current user object - */getCurrentUser:function getCurrentUser(){var e;return t._Store?(e=t._Store.mpid,e?(e=t._Store.mpid.slice(),r.mParticleUser(e,t._Store.isLoggedIn)):t._Store.webviewBridgeEnabled?r.mParticleUser():null):null},/** + */getCurrentUser:function getCurrentUser(){var e;return t._Store?(e=t._Store.mpid,e?(e=t._Store.mpid.slice(),n.mParticleUser(e,t._Store.isLoggedIn)):t._Store.webviewBridgeEnabled?n.mParticleUser():null):null},/** * Returns a the user object associated with the mpid parameter or 'null' if no such * user exists * @method getUser * @param {String} mpid of the desired user * @return {Object} the user for mpid - */getUser:function getUser(e){var s=t._Persistence.getPersistence();return s?s[e]&&!Constants.SDKv2NonMPIDCookieKeys.hasOwnProperty(e)?r.mParticleUser(e):null:null},/** + */getUser:function getUser(e){var r=t._Persistence.getPersistence();return r?r[e]&&!Constants.SDKv2NonMPIDCookieKeys.hasOwnProperty(e)?n.mParticleUser(e):null:null},/** * Returns all users, including the current user and all previous users that are stored on the device. * @method getUsers * @return {Array} array of users - */getUsers:function getUsers(){var e=t._Persistence.getPersistence(),s=[];if(e)for(var i in e)Constants.SDKv2NonMPIDCookieKeys.hasOwnProperty(i)||s.push(r.mParticleUser(i));return s.sort(function(e,t){var r=e.getLastSeenTime()||0,s=t.getLastSeenTime()||0;return r>s?-1:1}),s},/** + */getUsers:function getUsers(){var e=t._Persistence.getPersistence(),r=[];if(e)for(var s in e)Constants.SDKv2NonMPIDCookieKeys.hasOwnProperty(s)||r.push(n.mParticleUser(s));return r.sort(function(e,t){var r=e.getLastSeenTime()||0,s=t.getLastSeenTime()||0;return r>s?-1:1}),r},/** * Initiate an alias request to the mParticle server * @method aliasUsers * @param {Object} aliasRequest object representing an AliasRequest @@ -816,23 +832,23 @@ return sp&&t._Store.currentSessionMPIDs.push(c.mpid),-1>c/4).toString(16):(c^16*Math.random()>>c/4).toString(16)},generateUniqueId=function(b){return void 0===b&&(b=""),b// if the placeholder was passed, return +?generateRandomValue()// if the placeholder was passed, return +:// [1e7] -> // 10000000 + +// -1e3 -> // -1000 + +// -4e3 -> // -4000 + +// -8e3 -> // -80000000 + +// -1e11 -> //-100000000000, +"".concat(1e7,"-").concat(1e3,"-").concat(4e3,"-").concat(8e3,"-").concat(1e11).replace(/[018]/g,// zeroes, ones, and eights with +generateUniqueId// random hex digits +)},getRampNumber=function(a){if(!a)return 100;var b=generateHash(a);return Math.abs(b%100)+1},isObject=function(a){var b=Object.prototype.toString.call(a);return "[object Object]"===b||"[object Error]"===b},parseNumber=function(a){if(isNaN(a)||!isFinite(a))return 0;var b=parseFloat(a);return isNaN(b)?0:b},parseStringOrNumber=function(a){return isStringOrNumber(a)?a:null},replaceCommasWithPipes=function(a){return a.replace(/,/g,"|")},replacePipesWithCommas=function(a){return a.replace(/\|/g,",")},replaceApostrophesWithQuotes=function(a){return a.replace(/\'/g,"\"")},replaceQuotesWithApostrophes=function(a){return a.replace(/\"/g,"'")},returnConvertedBoolean=function(a){return "false"!==a&&"0"!==a&&!!a},decoded=function(a){return decodeURIComponent(a.replace(/\+/g," "))},converted=function(a){return 0===a.indexOf("\"")&&(a=a.slice(1,-1).replace(/\\"/g,"\"").replace(/\\\\/g,"\\")),a},isString=function(a){return "string"==typeof a},isNumber=function(a){return "number"==typeof a},isBoolean=function(a){return "boolean"==typeof a},isFunction=function(a){return "function"==typeof a},isValidCustomFlagProperty=function(a){return isNumber(a)||isString(a)||isBoolean(a)},toDataPlanSlug=function(a){// Make sure we are only acting on strings or numbers +return isStringOrNumber(a)?a.toString().toLowerCase().replace(/[^0-9a-zA-Z]+/g,"_"):""},isDataPlanSlug=function(a){return a===toDataPlanSlug(a)},isStringOrNumber=function(a){return isString(a)||isNumber(a)},isEmpty=function(a){return null==a||!(Object.keys(a)||a).length},moveElementToEnd=function(a,b){return a.slice(0,b).concat(a.slice(b+1),a[b])};/** + * Returns a value between 1-100 inclusive. + */ // FIXME: REFACTOR for V3 + +function getNewIdentitiesByName(a){var b={};for(var c in a){var d=getIdentityName(parseNumber(c));b[d]=a[c];}return b}function getIdentityName(a){return a===IdentityType$1.Other?"other":a===IdentityType$1.CustomerId?"customerid":a===IdentityType$1.Facebook?"facebook":a===IdentityType$1.Twitter?"twitter":a===IdentityType$1.Google?"google":a===IdentityType$1.Microsoft?"microsoft":a===IdentityType$1.Yahoo?"yahoo":a===IdentityType$1.Email?"email":a===IdentityType$1.FacebookCustomAudienceId?"facebookcustomaudienceid":a===IdentityType$1.Other2?"other2":a===IdentityType$1.Other3?"other3":a===IdentityType$1.Other4?"other4":a===IdentityType$1.Other5?"other5":a===IdentityType$1.Other6?"other6":a===IdentityType$1.Other7?"other7":a===IdentityType$1.Other8?"other8":a===IdentityType$1.Other9?"other9":a===IdentityType$1.Other10?"other10":a===IdentityType$1.MobileNumber?"mobile_number":a===IdentityType$1.PhoneNumber2?"phone_number_2":a===IdentityType$1.PhoneNumber3?"phone_number_3":null} + +var _TriggerUploadType;var MessageType$1={SessionStart:1,SessionEnd:2,PageView:3,PageEvent:4,CrashReport:5,OptOut:6,AppStateTransition:10,Profile:14,Commerce:16,Media:20,UserAttributeChange:17,UserIdentityChange:18},TriggerUploadType=(_TriggerUploadType={},_defineProperty(_TriggerUploadType,MessageType$1.Commerce,1),_defineProperty(_TriggerUploadType,MessageType$1.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};// Dictionary that contains MessageTypes that will +// trigger an immediate upload. +// Continuation of enum above, but in seperate object since we don't expose these to end user +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 getIdentityName(a)};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$1={AppInit:1},Environment={Production:"production",Development:"development"};var Types = {MessageType:MessageType$1,EventType:EventType,CommerceEventType:CommerceEventType,IdentityType:IdentityType,ProfileMessageType:ProfileMessageType,ApplicationTransitionType:ApplicationTransitionType$1,ProductActionType:ProductActionType,PromotionActionType:PromotionActionType,TriggerUploadType:TriggerUploadType,Environment:Environment}; + var SDKProductActionType;(function(a){a[a.Unknown=0]="Unknown",a[a.AddToCart=1]="AddToCart",a[a.RemoveFromCart=2]="RemoveFromCart",a[a.Checkout=3]="Checkout",a[a.CheckoutOption=4]="CheckoutOption",a[a.Click=5]="Click",a[a.ViewDetail=6]="ViewDetail",a[a.Purchase=7]="Purchase",a[a.Refund=8]="Refund",a[a.AddToWishlist=9]="AddToWishlist",a[a.RemoveFromWishlist=10]="RemoveFromWishlist";})(SDKProductActionType||(SDKProductActionType={}));var SDKIdentityTypeEnum;(function(a){a.other="other",a.customerId="customerid",a.facebook="facebook",a.twitter="twitter",a.google="google",a.microsoft="microsoft",a.yahoo="yahoo",a.email="email",a.alias="alias",a.facebookCustomAudienceId="facebookcustomaudienceid",a.otherId2="other2",a.otherId3="other3",a.otherId4="other4",a.otherId5="other5",a.otherId6="other6",a.otherId7="other7",a.otherId8="other8",a.otherId9="other9",a.otherId10="other10",a.mobileNumber="mobile_number",a.phoneNumber2="phone_number_2",a.phoneNumber3="phone_number_3";})(SDKIdentityTypeEnum||(SDKIdentityTypeEnum={})); var dist = {}; @@ -394,20 +413,6 @@ var dist = {}; })(exports.UserIdentityChangeEventEventTypeEnum || (exports.UserIdentityChangeEventEventTypeEnum = {})); } (dist)); -var Messages$9=Constants.Messages,createCookieString=function(a){return replaceCommasWithPipes(replaceQuotesWithApostrophes(a))},revertCookieString=function(a){return replacePipesWithCommas(replaceApostrophesWithQuotes(a))},inArray=function(a,b){var c=0;if(Array.prototype.indexOf)return 0<=a.indexOf(b,0);for(var d=a.length;c>c/4).toString(16):(c^16*Math.random()>>c/4).toString(16)},generateUniqueId=function(b){return void 0===b&&(b=""),b// if the placeholder was passed, return -?generateRandomValue()// if the placeholder was passed, return -:// [1e7] -> // 10000000 + -// -1e3 -> // -1000 + -// -4e3 -> // -4000 + -// -8e3 -> // -80000000 + -// -1e11 -> //-100000000000, -"".concat(1e7,"-").concat(1e3,"-").concat(4e3,"-").concat(8e3,"-").concat(1e11).replace(/[018]/g,// zeroes, ones, and eights with -generateUniqueId// random hex digits -)},getRampNumber=function(a){if(!a)return 100;var b=generateHash(a);return Math.abs(b%100)+1},isObject=function(a){var b=Object.prototype.toString.call(a);return "[object Object]"===b||"[object Error]"===b},parseNumber=function(a){if(isNaN(a)||!isFinite(a))return 0;var b=parseFloat(a);return isNaN(b)?0:b},parseStringOrNumber=function(a){return isStringOrNumber(a)?a:null},replaceCommasWithPipes=function(a){return a.replace(/,/g,"|")},replacePipesWithCommas=function(a){return a.replace(/\|/g,",")},replaceApostrophesWithQuotes=function(a){return a.replace(/\'/g,"\"")},replaceQuotesWithApostrophes=function(a){return a.replace(/\"/g,"'")},returnConvertedBoolean=function(a){return "false"!==a&&"0"!==a&&!!a},decoded=function(a){return decodeURIComponent(a.replace(/\+/g," "))},converted=function(a){return 0===a.indexOf("\"")&&(a=a.slice(1,-1).replace(/\\"/g,"\"").replace(/\\\\/g,"\\")),a},isString=function(a){return "string"==typeof a},isNumber=function(a){return "number"==typeof a},isBoolean=function(a){return "boolean"==typeof a},isFunction=function(a){return "function"==typeof a},isValidCustomFlagProperty=function(a){return isNumber(a)||isString(a)||isBoolean(a)},toDataPlanSlug=function(a){// Make sure we are only acting on strings or numbers -return isStringOrNumber(a)?a.toString().toLowerCase().replace(/[^0-9a-zA-Z]+/g,"_"):""},isDataPlanSlug=function(a){return a===toDataPlanSlug(a)},isStringOrNumber=function(a){return isString(a)||isNumber(a)},isEmpty=function(a){return null==a||!(Object.keys(a)||a).length};/** - * Returns a value between 1-100 inclusive. - */ // FIXME: REFACTOR for V3 - function convertEvents(a,b,c){if(!a)return null;if(!b||1>b.length)return null;for(var d,e=c.Identity.getCurrentUser(),f=[],g=null,h=0,i=b;hc?void d.currentSessionMPIDs.push(a):void(0<=c&&(d.currentSessionMPIDs=moveElementToEnd(d.currentSessionMPIDs,c)))},this.getFirstSeenTime=function(a){return a?d.persistenceData&&d.persistenceData[a]&&d.persistenceData[a].fst?d.persistenceData[a].fst:null:null},this.setFirstSeenTime=function(a,c){if(a){var e=c||new Date().getTime();d.persistenceData&&(!d.persistenceData[a]&&(d.persistenceData[a]={}),!d.persistenceData[a].fst&&(d.persistenceData[a].fst=e,b._Persistence.savePersistence(d.persistenceData)));}},this.getLastSeenTime=function(a){if(!a)return null;// // https://go.mparticle.com/work/SQDSDKS-6315 var c=b.Identity.getCurrentUser();return a===(null===c||void 0===c?void 0:c.getMPID())?new Date().getTime():d.persistenceData&&d.persistenceData[a]&&d.persistenceData[a].lst?d.persistenceData[a].lst:null},this.setLastSeenTime=function(a,c){if(a){var e=c||new Date().getTime();d.persistenceData&&(!d.persistenceData[a]&&(d.persistenceData[a]={}),!d.persistenceData[a].lst&&(d.persistenceData[a].lst=e,b._Persistence.savePersistence(d.persistenceData)));}},this.nullifySession=function(){d.sessionId=null,d.dateLastEventSent=null,d.sessionAttributes={},b._Persistence.update();},this.processConfig=function(a){var c=a.workspaceToken,e=a.requiredWebviewBridgeName;// We should reprocess the flags in case they have changed when we request an updated config // such as if the SDK is being self-hosted and the flags are different on the server config // https://go.mparticle.com/work/SQDSDKS-6317 @@ -620,8 +625,10 @@ for(var n,o=0;of);o++)n=h[o],b[n]?(a.Logger.verb // other keys on the cookie are currentSessionMPIDs and currentMPID which should not be searched if(d[g].mpid){var h=d[g].ui;for(var i in h)if(e===i&&b.userIdentities[e]===h[i]){c=g;break}}c&&f.storeDataInMemory(d,c);},this.encodePersistence=function(b){for(var c in b=JSON.parse(b),b.gs)b.gs.hasOwnProperty(c)&&(Base64CookieKeys[c]?b.gs[c]?Array.isArray(b.gs[c])&&b.gs[c].length||a._Helpers.isObject(b.gs[c])&&Object.keys(b.gs[c]).length?b.gs[c]=Base64.encode(JSON.stringify(b.gs[c])):delete b.gs[c]:delete b.gs[c]:"ie"===c?b.gs[c]=b.gs[c]?1:0:!b.gs[c]&&delete b.gs[c]);for(var d in b)if(b.hasOwnProperty(d)&&!SDKv2NonMPIDCookieKeys[d])for(c in b[d])b[d].hasOwnProperty(c)&&Base64CookieKeys[c]&&(a._Helpers.isObject(b[d][c])&&Object.keys(b[d][c]).length?b[d][c]=Base64.encode(JSON.stringify(b[d][c])):delete b[d][c]);return createCookieString(JSON.stringify(b))},this.decodePersistence=function(b){try{if(b){if(b=JSON.parse(revertCookieString(b)),a._Helpers.isObject(b)&&Object.keys(b).length){for(var c in b.gs)b.gs.hasOwnProperty(c)&&(Base64CookieKeys[c]?b.gs[c]=JSON.parse(Base64.decode(b.gs[c])):"ie"===c&&(b.gs[c]=!!b.gs[c]));for(var d in b)if(b.hasOwnProperty(d))if(!SDKv2NonMPIDCookieKeys[d])for(c in b[d])b[d].hasOwnProperty(c)&&Base64CookieKeys[c]&&b[d][c].length&&(b[d][c]=JSON.parse(Base64.decode(b[d][c])));else "l"===d&&(b[d]=!!b[d]);}return JSON.stringify(b)}}catch(b){a.Logger.error("Problem with decoding cookie",b);}},this.getCookieDomain=function(){if(a._Store.SDKConfig.cookieDomain)return a._Store.SDKConfig.cookieDomain;var b=f.getDomain(document,location.hostname);return ""===b?"":"."+b},this.getDomain=function(a,b){var c,d,e=b.split(".");for(c=e.length-1;0<=c;c--)if(d=e.slice(c).join("."),a.cookie="mptest=cookie;domain=."+d+";",-1e.status))?[3/*break*/,4]:(this.logger.verbose("User Audiences successfully received"),[4/*yield*/,e.json()]);case 3:f=i.sent(),g={currentAudienceMemberships:null===f||void 0===f?void 0:f.audience_memberships};try{b(g);}catch(a){throw new Error("Error invoking callback on user audience response.")}return [3/*break*/,5];case 4:if(401===e.status)throw new Error("`HTTP error status ${userAudiencePromise.status} while retrieving User Audiences - please verify your API key.`");else if(403===e.status)throw new Error("`HTTP error status ${userAudiencePromise.status} while retrieving User Audiences - please verify your workspace is enabled for audiences.`");else// In case there is an HTTP error we did not anticipate. throw new Error("Uncaught HTTP Error ".concat(e.status,"."));case 5:return [3/*break*/,7];case 6:return h=i.sent(),this.logger.error("Error retrieving audiences. ".concat(h)),[3/*break*/,7];case 7:return [2/*return*/]}})})},a}(); -var Messages$2=Constants.Messages,HTTPCodes$2=Constants.HTTPCodes,FeatureFlags$1=Constants.FeatureFlags,ErrorMessages=Messages$2.ErrorMessages,_Constants$IdentityMe=Constants.IdentityMethods,Identify=_Constants$IdentityMe.Identify,Modify$1=_Constants$IdentityMe.Modify,Login=_Constants$IdentityMe.Login,Logout=_Constants$IdentityMe.Logout;function Identity(t){var r=this;/** +function didUserChange(a,b){return !a||b.getMPID()!==a.getMPID()||a.isLoggedIn()!==b.isLoggedIn()} + +var Messages$2=Constants.Messages,HTTPCodes$2=Constants.HTTPCodes,FeatureFlags$1=Constants.FeatureFlags,IdentityMethods=Constants.IdentityMethods,ErrorMessages=Messages$2.ErrorMessages,CacheIdentity=FeatureFlags$1.CacheIdentity,Identify=IdentityMethods.Identify,Modify$1=IdentityMethods.Modify,Login=IdentityMethods.Login,Logout=IdentityMethods.Logout;function Identity(t){var r=t._Helpers,s=r.getFeatureFlag,i=r.extend,n=this;// https://go.mparticle.com/work/SQDSDKS-6353 +/** * Invoke these methods on the mParticle.Identity object. * Example: mParticle.Identity.getCurrentUser(). * @class mParticle.Identity - */ /** + */ // https://go.mparticle.com/work/SQDSDKS-6354 +/** * Invoke these methods on the mParticle.Identity.getCurrentUser() object. * Example: mParticle.Identity.getCurrentUser().getAllUserAttributes() * @class mParticle.Identity.getCurrentUser() @@ -736,46 +747,51 @@ var Messages$2=Constants.Messages,HTTPCodes$2=Constants.HTTPCodes,FeatureFlags$1 * Example: mParticle.Identity.getCurrentUser().getCart().add(...); * @class mParticle.Identity.getCurrentUser().getCart() * @deprecated - */ // send a user identity change request on identify, login, logout, modify when any values change. + */ // https://go.mparticle.com/work/SQDSDKS-6355 +// send a user identity change request on identify, login, logout, modify when any values change. // compare what identities exist vs what is previously was for the specific user if they were in memory before. // if it's the first time the user is logging in, send a user identity change request with -this.idCache=null,this.audienceManager=null,this.checkIdentitySwap=function(e,r,s){if(e&&r&&e!==r){var i=t._Persistence.getPersistence();i&&(i.cu=r,i.gs.csm=s,t._Persistence.savePersistence(i));}},this.IdentityRequest={preProcessIdentityRequest:function preProcessIdentityRequest(e,r,s){t.Logger.verbose(Messages$2.InformationMessages.StartingLogEvent+": "+s);var i=t._Helpers.Validators.validateIdentities(e,s);if(!i.valid)return t.Logger.error("ERROR: "+i.error),{valid:!1,error:i.error};if(r&&!t._Helpers.Validators.isFunction(r)){var n="The optional callback must be a function. You tried entering a(n) "+_typeof(r);return t.Logger.error(n),{valid:!1,error:n}}return {valid:!0}},createIdentityRequest:function createIdentityRequest(e,r,s,i,n,a,o){var d={client_sdk:{platform:r,sdk_vendor:s,sdk_version:i},context:a,environment:t._Store.SDKConfig.isDevelopmentMode?"development":"production",request_id:t._Helpers.generateUniqueId(),request_timestamp_ms:new Date().getTime(),previous_mpid:o||null,known_identities:createKnownIdentities(e,n)};return d},createModifyIdentityRequest:function createModifyIdentityRequest(e,r,s,i,n,a){return {client_sdk:{platform:s,sdk_vendor:i,sdk_version:n},context:a,environment:t._Store.SDKConfig.isDevelopmentMode?"development":"production",request_id:t._Helpers.generateUniqueId(),request_timestamp_ms:new Date().getTime(),identity_changes:this.createIdentityChanges(e,r)}},createIdentityChanges:function createIdentityChanges(e,r){var s,i=[];if(r&&t._Helpers.isObject(r)&&e&&t._Helpers.isObject(e))for(s in r)i.push({old_value:e[s]||null,new_value:r[s],identity_type:s});return i},// takes 2 UI objects keyed by name, combines them, returns them keyed by type -combineUserIdentities:function combineUserIdentities(e,r){var s={},i=t._Helpers.extend(e,r);for(var n in i){var a=Types.IdentityType.getIdentityType(n);// this check removes anything that is not whitelisted as an identity type -!1!==a&&0<=a&&(s[Types.IdentityType.getIdentityType(n)]=i[n]);}return s},createAliasNetworkRequest:function createAliasNetworkRequest(e){return {request_id:t._Helpers.generateUniqueId(),request_type:"alias",environment:t._Store.SDKConfig.isDevelopmentMode?"development":"production",api_key:t._Store.devToken,data:{destination_mpid:e.destinationMpid,source_mpid:e.sourceMpid,start_unixtime_ms:e.startTime,end_unixtime_ms:e.endTime,scope:e.scope,device_application_stamp:t._Store.deviceId}}},convertAliasToNative:function convertAliasToNative(e){return {DestinationMpid:e.destinationMpid,SourceMpid:e.sourceMpid,StartUnixtimeMs:e.startTime,EndUnixtimeMs:e.endTime}},convertToNative:function convertToNative(e){var t=[];if(e&&e.userIdentities){for(var r in e.userIdentities)e.userIdentities.hasOwnProperty(r)&&t.push({Type:Types.IdentityType.getIdentityType(r),Identity:e.userIdentities[r]});return {UserIdentities:t}}}},this.IdentityAPI={HTTPCodes:HTTPCodes$2,/** +this.idCache=null,this.audienceManager=null,this.IdentityRequest={preProcessIdentityRequest:function preProcessIdentityRequest(e,r,s){t.Logger.verbose(Messages$2.InformationMessages.StartingLogEvent+": "+s);var i=t._Helpers.Validators.validateIdentities(e,s);if(!i.valid)return t.Logger.error("ERROR: "+i.error),{valid:!1,error:i.error};if(r&&!t._Helpers.Validators.isFunction(r)){var n="The optional callback must be a function. You tried entering a(n) "+_typeof(r);return t.Logger.error(n),{valid:!1,error:n}}return {valid:!0}},createIdentityRequest:function createIdentityRequest(e,r,s,i,n,a,d){var o={client_sdk:{platform:r,sdk_vendor:s,sdk_version:i},context:a,environment:t._Store.SDKConfig.isDevelopmentMode?"development":"production",request_id:t._Helpers.generateUniqueId(),request_timestamp_ms:new Date().getTime(),previous_mpid:d||null,known_identities:createKnownIdentities(e,n)};return o},createModifyIdentityRequest:function createModifyIdentityRequest(e,r,s,i,n,a){return {client_sdk:{platform:s,sdk_vendor:i,sdk_version:n},context:a,environment:t._Store.SDKConfig.isDevelopmentMode?"development":"production",request_id:t._Helpers.generateUniqueId(),request_timestamp_ms:new Date().getTime(),identity_changes:this.createIdentityChanges(e,r)}},createIdentityChanges:function createIdentityChanges(e,t){var r,s=[];if(t&&isObject(t)&&e&&isObject(e))for(r in t)s.push({old_value:e[r]||null,new_value:t[r],identity_type:r});return s},// takes 2 UI objects keyed by name, combines them, returns them keyed by type +combineUserIdentities:function combineUserIdentities(e,t){var r={},s=i({},e,t);for(var n in s){var a=Types.IdentityType.getIdentityType(n);// this check removes anything that is not whitelisted as an identity type +!1!==a&&0<=a&&(r[Types.IdentityType.getIdentityType(n)]=s[n]);}return r},createAliasNetworkRequest:function createAliasNetworkRequest(e){return {request_id:t._Helpers.generateUniqueId(),request_type:"alias",environment:t._Store.SDKConfig.isDevelopmentMode?"development":"production",api_key:t._Store.devToken,data:{destination_mpid:e.destinationMpid,source_mpid:e.sourceMpid,start_unixtime_ms:e.startTime,end_unixtime_ms:e.endTime,scope:e.scope,device_application_stamp:t._Store.deviceId}}},convertAliasToNative:function convertAliasToNative(e){return {DestinationMpid:e.destinationMpid,SourceMpid:e.sourceMpid,StartUnixtimeMs:e.startTime,EndUnixtimeMs:e.endTime}},convertToNative:function convertToNative(e){var t=[];if(e&&e.userIdentities){for(var r in e.userIdentities)e.userIdentities.hasOwnProperty(r)&&t.push({Type:Types.IdentityType.getIdentityType(r),Identity:e.userIdentities[r]});return {UserIdentities:t}}}},this.IdentityAPI={HTTPCodes:HTTPCodes$2,/** * Initiate a logout request to the mParticle server * @method identify * @param {Object} identityApiData The identityApiData object as indicated [here](https://github.com/mParticle/mparticle-sdk-javascript/blob/master-v2/README.md#1-customize-the-sdk) * @param {Function} [callback] A callback function that is called when the identify request completes - */identify:function identify(e,s){var i,n=t.Identity.getCurrentUser(),a=t._Identity.IdentityRequest.preProcessIdentityRequest(e,s,Identify);if(n&&(i=n.getMPID()),a.valid){var o=t._Identity.IdentityRequest.createIdentityRequest(e,Constants.platform,Constants.sdkVendor,Constants.sdkVersion,t._Store.deviceId,t._Store.context,i);if(t._Helpers.getFeatureFlag(Constants.FeatureFlags.CacheIdentity)){var d=tryCacheIdentity(o.known_identities,r.idCache,r.parseIdentityResponse,i,s,e,Identify);if(d)return}t._Helpers.canLog()?t._Store.webviewBridgeEnabled?(t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Identify,JSON.stringify(t._Identity.IdentityRequest.convertToNative(e))),t._Helpers.invokeCallback(s,HTTPCodes$2.nativeIdentityRequest,"Identify request sent to native sdk")):t._IdentityAPIClient.sendIdentityRequest(o,Identify,s,e,r.parseIdentityResponse,i,o.known_identities):(t._Helpers.invokeCallback(s,HTTPCodes$2.loggingDisabledOrMissingAPIKey,Messages$2.InformationMessages.AbandonLogEvent),t.Logger.verbose(Messages$2.InformationMessages.AbandonLogEvent));}else t._Helpers.invokeCallback(s,HTTPCodes$2.validationIssue,a.error),t.Logger.verbose(a);},/** + */identify:function identify(e,r){// https://go.mparticle.com/work/SQDSDKS-6337 +var s,i=t.Identity.getCurrentUser(),a=t._Identity.IdentityRequest.preProcessIdentityRequest(e,r,Identify);if(i&&(s=i.getMPID()),a.valid){var d=t._Identity.IdentityRequest.createIdentityRequest(e,Constants.platform,Constants.sdkVendor,Constants.sdkVersion,t._Store.deviceId,t._Store.context,s);if(t._Helpers.getFeatureFlag(Constants.FeatureFlags.CacheIdentity)){var o=tryCacheIdentity(d.known_identities,n.idCache,n.parseIdentityResponse,s,r,e,Identify);if(o)return}t._Helpers.canLog()?t._Store.webviewBridgeEnabled?(t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Identify,JSON.stringify(t._Identity.IdentityRequest.convertToNative(e))),t._Helpers.invokeCallback(r,HTTPCodes$2.nativeIdentityRequest,"Identify request sent to native sdk")):t._IdentityAPIClient.sendIdentityRequest(d,Identify,r,e,n.parseIdentityResponse,s,d.known_identities):(t._Helpers.invokeCallback(r,HTTPCodes$2.loggingDisabledOrMissingAPIKey,Messages$2.InformationMessages.AbandonLogEvent),t.Logger.verbose(Messages$2.InformationMessages.AbandonLogEvent));}else t._Helpers.invokeCallback(r,HTTPCodes$2.validationIssue,a.error),t.Logger.verbose(a);},/** * Initiate a logout request to the mParticle server * @method logout * @param {Object} identityApiData The identityApiData object as indicated [here](https://github.com/mParticle/mparticle-sdk-javascript/blob/master-v2/README.md#1-customize-the-sdk) * @param {Function} [callback] A callback function that is called when the logout request completes - */logout:function logout(e,s){var i,n=t.Identity.getCurrentUser(),a=t._Identity.IdentityRequest.preProcessIdentityRequest(e,s,Logout);if(n&&(i=n.getMPID()),a.valid){var o,d=t._Identity.IdentityRequest.createIdentityRequest(e,Constants.platform,Constants.sdkVendor,Constants.sdkVersion,t._Store.deviceId,t._Store.context,i);t._Helpers.canLog()?t._Store.webviewBridgeEnabled?(t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Logout,JSON.stringify(t._Identity.IdentityRequest.convertToNative(e))),t._Helpers.invokeCallback(s,HTTPCodes$2.nativeIdentityRequest,"Logout request sent to native sdk")):(t._IdentityAPIClient.sendIdentityRequest(d,Logout,s,e,r.parseIdentityResponse,i),o=t._ServerModel.createEventObject({messageType:Types.MessageType.Profile}),o.ProfileMessageType=Types.ProfileMessageType.Logout,t._Store.activeForwarders.length&&t._Store.activeForwarders.forEach(function(e){e.logOut&&e.logOut(o);})):(t._Helpers.invokeCallback(s,HTTPCodes$2.loggingDisabledOrMissingAPIKey,Messages$2.InformationMessages.AbandonLogEvent),t.Logger.verbose(Messages$2.InformationMessages.AbandonLogEvent));}else t._Helpers.invokeCallback(s,HTTPCodes$2.validationIssue,a.error),t.Logger.verbose(a);},/** + */logout:function logout(e,r){// https://go.mparticle.com/work/SQDSDKS-6337 +var s,i=t.Identity.getCurrentUser(),a=t._Identity.IdentityRequest.preProcessIdentityRequest(e,r,Logout);if(i&&(s=i.getMPID()),a.valid){var d,o=t._Identity.IdentityRequest.createIdentityRequest(e,Constants.platform,Constants.sdkVendor,Constants.sdkVersion,t._Store.deviceId,t._Store.context,s);t._Helpers.canLog()?t._Store.webviewBridgeEnabled?(t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Logout,JSON.stringify(t._Identity.IdentityRequest.convertToNative(e))),t._Helpers.invokeCallback(r,HTTPCodes$2.nativeIdentityRequest,"Logout request sent to native sdk")):(t._IdentityAPIClient.sendIdentityRequest(o,Logout,r,e,n.parseIdentityResponse,s),d=t._ServerModel.createEventObject({messageType:Types.MessageType.Profile}),d.ProfileMessageType=Types.ProfileMessageType.Logout,t._Store.activeForwarders.length&&t._Store.activeForwarders.forEach(function(e){e.logOut&&e.logOut(d);})):(t._Helpers.invokeCallback(r,HTTPCodes$2.loggingDisabledOrMissingAPIKey,Messages$2.InformationMessages.AbandonLogEvent),t.Logger.verbose(Messages$2.InformationMessages.AbandonLogEvent));}else t._Helpers.invokeCallback(r,HTTPCodes$2.validationIssue,a.error),t.Logger.verbose(a);},/** * Initiate a login request to the mParticle server * @method login * @param {Object} identityApiData The identityApiData object as indicated [here](https://github.com/mParticle/mparticle-sdk-javascript/blob/master-v2/README.md#1-customize-the-sdk) * @param {Function} [callback] A callback function that is called when the login request completes - */login:function login(e,s){var i,n=t.Identity.getCurrentUser(),a=t._Identity.IdentityRequest.preProcessIdentityRequest(e,s,Login);if(n&&(i=n.getMPID()),a.valid){var o=t._Identity.IdentityRequest.createIdentityRequest(e,Constants.platform,Constants.sdkVendor,Constants.sdkVersion,t._Store.deviceId,t._Store.context,i);if(t._Helpers.getFeatureFlag(Constants.FeatureFlags.CacheIdentity)){var d=tryCacheIdentity(o.known_identities,r.idCache,r.parseIdentityResponse,i,s,e,Login);if(d)return}t._Helpers.canLog()?t._Store.webviewBridgeEnabled?(t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Login,JSON.stringify(t._Identity.IdentityRequest.convertToNative(e))),t._Helpers.invokeCallback(s,HTTPCodes$2.nativeIdentityRequest,"Login request sent to native sdk")):t._IdentityAPIClient.sendIdentityRequest(o,Login,s,e,r.parseIdentityResponse,i,o.known_identities):(t._Helpers.invokeCallback(s,HTTPCodes$2.loggingDisabledOrMissingAPIKey,Messages$2.InformationMessages.AbandonLogEvent),t.Logger.verbose(Messages$2.InformationMessages.AbandonLogEvent));}else t._Helpers.invokeCallback(s,HTTPCodes$2.validationIssue,a.error),t.Logger.verbose(a);},/** + */login:function login(e,r){// https://go.mparticle.com/work/SQDSDKS-6337 +var s,i=t.Identity.getCurrentUser(),a=t._Identity.IdentityRequest.preProcessIdentityRequest(e,r,Login);if(i&&(s=i.getMPID()),a.valid){var d=t._Identity.IdentityRequest.createIdentityRequest(e,Constants.platform,Constants.sdkVendor,Constants.sdkVersion,t._Store.deviceId,t._Store.context,s);if(t._Helpers.getFeatureFlag(Constants.FeatureFlags.CacheIdentity)){var o=tryCacheIdentity(d.known_identities,n.idCache,n.parseIdentityResponse,s,r,e,Login);if(o)return}t._Helpers.canLog()?t._Store.webviewBridgeEnabled?(t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Login,JSON.stringify(t._Identity.IdentityRequest.convertToNative(e))),t._Helpers.invokeCallback(r,HTTPCodes$2.nativeIdentityRequest,"Login request sent to native sdk")):t._IdentityAPIClient.sendIdentityRequest(d,Login,r,e,n.parseIdentityResponse,s,d.known_identities):(t._Helpers.invokeCallback(r,HTTPCodes$2.loggingDisabledOrMissingAPIKey,Messages$2.InformationMessages.AbandonLogEvent),t.Logger.verbose(Messages$2.InformationMessages.AbandonLogEvent));}else t._Helpers.invokeCallback(r,HTTPCodes$2.validationIssue,a.error),t.Logger.verbose(a);},/** * Initiate a modify request to the mParticle server * @method modify * @param {Object} identityApiData The identityApiData object as indicated [here](https://github.com/mParticle/mparticle-sdk-javascript/blob/master-v2/README.md#1-customize-the-sdk) * @param {Function} [callback] A callback function that is called when the modify request completes - */modify:function modify(e,s){var i,n=t.Identity.getCurrentUser(),a=t._Identity.IdentityRequest.preProcessIdentityRequest(e,s,Modify$1);n&&(i=n.getMPID());var o=e&&e.userIdentities?e.userIdentities:{};if(a.valid){var d=t._Identity.IdentityRequest.createModifyIdentityRequest(n?n.getUserIdentities().userIdentities:{},o,Constants.platform,Constants.sdkVendor,Constants.sdkVersion,t._Store.context);t._Helpers.canLog()?t._Store.webviewBridgeEnabled?(t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Modify,JSON.stringify(t._Identity.IdentityRequest.convertToNative(e))),t._Helpers.invokeCallback(s,HTTPCodes$2.nativeIdentityRequest,"Modify request sent to native sdk")):t._IdentityAPIClient.sendIdentityRequest(d,Modify$1,s,e,r.parseIdentityResponse,i,d.known_identities):(t._Helpers.invokeCallback(s,HTTPCodes$2.loggingDisabledOrMissingAPIKey,Messages$2.InformationMessages.AbandonLogEvent),t.Logger.verbose(Messages$2.InformationMessages.AbandonLogEvent));}else t._Helpers.invokeCallback(s,HTTPCodes$2.validationIssue,a.error),t.Logger.verbose(a);},/** + */modify:function modify(e,r){// https://go.mparticle.com/work/SQDSDKS-6337 +var s,i=t.Identity.getCurrentUser(),a=t._Identity.IdentityRequest.preProcessIdentityRequest(e,r,Modify$1);i&&(s=i.getMPID());var d=e&&e.userIdentities?e.userIdentities:{};if(a.valid){var o=t._Identity.IdentityRequest.createModifyIdentityRequest(i?i.getUserIdentities().userIdentities:{},d,Constants.platform,Constants.sdkVendor,Constants.sdkVersion,t._Store.context);t._Helpers.canLog()?t._Store.webviewBridgeEnabled?(t._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Modify,JSON.stringify(t._Identity.IdentityRequest.convertToNative(e))),t._Helpers.invokeCallback(r,HTTPCodes$2.nativeIdentityRequest,"Modify request sent to native sdk")):t._IdentityAPIClient.sendIdentityRequest(o,Modify$1,r,e,n.parseIdentityResponse,s,o.known_identities):(t._Helpers.invokeCallback(r,HTTPCodes$2.loggingDisabledOrMissingAPIKey,Messages$2.InformationMessages.AbandonLogEvent),t.Logger.verbose(Messages$2.InformationMessages.AbandonLogEvent));}else t._Helpers.invokeCallback(r,HTTPCodes$2.validationIssue,a.error),t.Logger.verbose(a);},/** * Returns a user object with methods to interact with the current user * @method getCurrentUser * @return {Object} the current user object - */getCurrentUser:function getCurrentUser(){var e;return t._Store?(e=t._Store.mpid,e?(e=t._Store.mpid.slice(),r.mParticleUser(e,t._Store.isLoggedIn)):t._Store.webviewBridgeEnabled?r.mParticleUser():null):null},/** + */getCurrentUser:function getCurrentUser(){var e;return t._Store?(e=t._Store.mpid,e?(e=t._Store.mpid.slice(),n.mParticleUser(e,t._Store.isLoggedIn)):t._Store.webviewBridgeEnabled?n.mParticleUser():null):null},/** * Returns a the user object associated with the mpid parameter or 'null' if no such * user exists * @method getUser * @param {String} mpid of the desired user * @return {Object} the user for mpid - */getUser:function getUser(e){var s=t._Persistence.getPersistence();return s?s[e]&&!Constants.SDKv2NonMPIDCookieKeys.hasOwnProperty(e)?r.mParticleUser(e):null:null},/** + */getUser:function getUser(e){var r=t._Persistence.getPersistence();return r?r[e]&&!Constants.SDKv2NonMPIDCookieKeys.hasOwnProperty(e)?n.mParticleUser(e):null:null},/** * Returns all users, including the current user and all previous users that are stored on the device. * @method getUsers * @return {Array} array of users - */getUsers:function getUsers(){var e=t._Persistence.getPersistence(),s=[];if(e)for(var i in e)Constants.SDKv2NonMPIDCookieKeys.hasOwnProperty(i)||s.push(r.mParticleUser(i));return s.sort(function(e,t){var r=e.getLastSeenTime()||0,s=t.getLastSeenTime()||0;return r>s?-1:1}),s},/** + */getUsers:function getUsers(){var e=t._Persistence.getPersistence(),r=[];if(e)for(var s in e)Constants.SDKv2NonMPIDCookieKeys.hasOwnProperty(s)||r.push(n.mParticleUser(s));return r.sort(function(e,t){var r=e.getLastSeenTime()||0,s=t.getLastSeenTime()||0;return r>s?-1:1}),r},/** * Initiate an alias request to the mParticle server * @method aliasUsers * @param {Object} aliasRequest object representing an AliasRequest @@ -816,23 +832,23 @@ return sp&&t._Store.currentSessionMPIDs.push(c.mpid),-1 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } + } + + function __spreadArray(to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); + } + + typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { + var e = new Error(message); + return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; }; - // Continuation of enum above, but in seperate object since we don't expose these to end user - var CommerceEventType = { - ProductAddToCart: 10, - ProductRemoveFromCart: 11, - ProductCheckout: 12, - ProductCheckoutOption: 13, - ProductClick: 14, - ProductViewDetail: 15, - ProductPurchase: 16, - ProductRefund: 17, - PromotionView: 18, - PromotionClick: 19, - ProductAddToWishlist: 20, - ProductRemoveFromWishlist: 21, - ProductImpression: 22 - }; - var IdentityType$1 = { - 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$1.isValid = function (identityType) { - if (typeof identityType === 'number') { - for (var prop in IdentityType$1) { - if (IdentityType$1.hasOwnProperty(prop)) { - if (IdentityType$1[prop] === identityType) { - return true; - } - } - } - } - return false; - }; - IdentityType$1.getName = function (identityType) { - switch (identityType) { - case window.mParticle.IdentityType.CustomerId: - return 'Customer ID'; - case window.mParticle.IdentityType.Facebook: - return 'Facebook ID'; - case window.mParticle.IdentityType.Twitter: - return 'Twitter ID'; - case window.mParticle.IdentityType.Google: - return 'Google ID'; - case window.mParticle.IdentityType.Microsoft: - return 'Microsoft ID'; - case window.mParticle.IdentityType.Yahoo: - return 'Yahoo ID'; - case window.mParticle.IdentityType.Email: - return 'Email'; - case window.mParticle.IdentityType.FacebookCustomAudienceId: - return 'Facebook App User ID'; - default: - return 'Other ID'; - } - }; - IdentityType$1.getIdentityType = function (identityName) { - switch (identityName) { - case 'other': - return IdentityType$1.Other; - case 'customerid': - return IdentityType$1.CustomerId; - case 'facebook': - return IdentityType$1.Facebook; - case 'twitter': - return IdentityType$1.Twitter; - case 'google': - return IdentityType$1.Google; - case 'microsoft': - return IdentityType$1.Microsoft; - case 'yahoo': - return IdentityType$1.Yahoo; - case 'email': - return IdentityType$1.Email; - case 'facebookcustomaudienceid': - return IdentityType$1.FacebookCustomAudienceId; - case 'other2': - return IdentityType$1.Other2; - case 'other3': - return IdentityType$1.Other3; - case 'other4': - return IdentityType$1.Other4; - case 'other5': - return IdentityType$1.Other5; - case 'other6': - return IdentityType$1.Other6; - case 'other7': - return IdentityType$1.Other7; - case 'other8': - return IdentityType$1.Other8; - case 'other9': - return IdentityType$1.Other9; - case 'other10': - return IdentityType$1.Other10; - case 'mobile_number': - return IdentityType$1.MobileNumber; - case 'phone_number_2': - return IdentityType$1.PhoneNumber2; - case 'phone_number_3': - return IdentityType$1.PhoneNumber3; - default: - return false; - } - }; - IdentityType$1.getIdentityName = function (identityType) { - switch (identityType) { - case IdentityType$1.Other: - return 'other'; - case IdentityType$1.CustomerId: - return 'customerid'; - case IdentityType$1.Facebook: - return 'facebook'; - case IdentityType$1.Twitter: - return 'twitter'; - case IdentityType$1.Google: - return 'google'; - case IdentityType$1.Microsoft: - return 'microsoft'; - case IdentityType$1.Yahoo: - return 'yahoo'; - case IdentityType$1.Email: - return 'email'; - case IdentityType$1.FacebookCustomAudienceId: - return 'facebookcustomaudienceid'; - case IdentityType$1.Other2: - return 'other2'; - case IdentityType$1.Other3: - return 'other3'; - case IdentityType$1.Other4: - return 'other4'; - case IdentityType$1.Other5: - return 'other5'; - case IdentityType$1.Other6: - return 'other6'; - case IdentityType$1.Other7: - return 'other7'; - case IdentityType$1.Other8: - return 'other8'; - case IdentityType$1.Other9: - return 'other9'; - case IdentityType$1.Other10: - return 'other10'; - case IdentityType$1.MobileNumber: - return 'mobile_number'; - case IdentityType$1.PhoneNumber2: - return 'phone_number_2'; - case IdentityType$1.PhoneNumber3: - return 'phone_number_3'; - } - }; - 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 (id) { - switch (id) { - case ProductActionType.AddToCart: - return 'Add to Cart'; - case ProductActionType.RemoveFromCart: - return 'Remove from Cart'; - case ProductActionType.Checkout: - return 'Checkout'; - case ProductActionType.CheckoutOption: - return 'Checkout Option'; - case ProductActionType.Click: - return 'Click'; - case ProductActionType.ViewDetail: - return 'View Detail'; - case ProductActionType.Purchase: - return 'Purchase'; - case ProductActionType.Refund: - return 'Refund'; - case ProductActionType.AddToWishlist: - return 'Add to Wishlist'; - case ProductActionType.RemoveFromWishlist: - return 'Remove from Wishlist'; - default: - return 'Unknown'; - } - }; - - // these are the action names used by server and mobile SDKs when expanding a CommerceEvent - ProductActionType.getExpansionName = function (id) { - switch (id) { - case ProductActionType.AddToCart: - return 'add_to_cart'; - case ProductActionType.RemoveFromCart: - return 'remove_from_cart'; - case ProductActionType.Checkout: - return 'checkout'; - case ProductActionType.CheckoutOption: - return 'checkout_option'; - case ProductActionType.Click: - return 'click'; - case ProductActionType.ViewDetail: - return 'view_detail'; - case ProductActionType.Purchase: - return 'purchase'; - case ProductActionType.Refund: - return 'refund'; - case ProductActionType.AddToWishlist: - return 'add_to_wishlist'; - case ProductActionType.RemoveFromWishlist: - return 'remove_from_wishlist'; - default: - return 'unknown'; - } - }; - var PromotionActionType = { - Unknown: 0, - PromotionView: 1, - PromotionClick: 2 - }; - PromotionActionType.getName = function (id) { - switch (id) { - case PromotionActionType.PromotionView: - return 'view'; - case PromotionActionType.PromotionClick: - return 'click'; - default: - return 'unknown'; - } - }; - - // these are the names that the server and mobile SDKs use while expanding CommerceEvent - PromotionActionType.getExpansionName = function (id) { - switch (id) { - case PromotionActionType.PromotionView: - return 'view'; - case PromotionActionType.PromotionClick: - return 'click'; - default: - return 'unknown'; - } - }; - var ProfileMessageType = { - Logout: 3 - }; - var ApplicationTransitionType$1 = { - AppInit: 1 - }; - var Environment = { - Production: 'production', - Development: 'development' - }; - var Types = { - MessageType: MessageType$2, - EventType: EventType, - CommerceEventType: CommerceEventType, - IdentityType: IdentityType$1, - ProfileMessageType: ProfileMessageType, - ApplicationTransitionType: ApplicationTransitionType$1, - ProductActionType: ProductActionType, - PromotionActionType: PromotionActionType, - TriggerUploadType: TriggerUploadType, - Environment: Environment - }; - - var version = "2.26.1"; + var version = "2.26.2"; var Constants = { sdkVersion: version, @@ -673,479 +458,114 @@ var mParticle = (function () { UserIdentitiesInvalidValues: 'All user identity values must be strings or null. Request not sent to server. Please fix and try again.', AliasMissingMpid: 'Alias Request must contain both a destinationMpid and a sourceMpid', AliasNonUniqueMpid: "Alias Request's destinationMpid and sourceMpid must be unique", - AliasMissingTime: 'Alias Request must have both a startTime and an endTime', - AliasStartBeforeEndTime: "Alias Request's endTime must be later than its startTime" - } - }, - NativeSdkPaths: { - LogEvent: 'logEvent', - SetUserTag: 'setUserTag', - RemoveUserTag: 'removeUserTag', - SetUserAttribute: 'setUserAttribute', - RemoveUserAttribute: 'removeUserAttribute', - SetSessionAttribute: 'setSessionAttribute', - AddToCart: 'addToCart', - RemoveFromCart: 'removeFromCart', - ClearCart: 'clearCart', - LogOut: 'logOut', - SetUserAttributeList: 'setUserAttributeList', - RemoveAllUserAttributes: 'removeAllUserAttributes', - GetUserAttributesLists: 'getUserAttributesLists', - GetAllUserAttributes: 'getAllUserAttributes', - Identify: 'identify', - Logout: 'logout', - Login: 'login', - Modify: 'modify', - Alias: 'aliasUsers', - Upload: 'upload' - }, - StorageNames: { - localStorageName: 'mprtcl-api', - localStorageNameV3: 'mprtcl-v3', - cookieName: 'mprtcl-api', - cookieNameV2: 'mprtcl-v2', - cookieNameV3: 'mprtcl-v3', - localStorageNameV4: 'mprtcl-v4', - localStorageProductsV4: 'mprtcl-prodv4', - cookieNameV4: 'mprtcl-v4', - currentStorageName: 'mprtcl-v4', - currentStorageProductsName: 'mprtcl-prodv4' - }, - DefaultConfig: { - cookieDomain: null, - cookieExpiration: 365, - logLevel: null, - timeout: 300, - sessionTimeout: 30, - maxProducts: 20, - forwarderStatsTimeout: 5000, - integrationDelayTimeout: 5000, - maxCookieSize: 3000, - aliasMaxWindow: 90, - uploadInterval: 0 // Maximum milliseconds in between batch uploads, below 500 will mean immediate upload. The server returns this as a string, but we are using it as a number internally - }, - - DefaultBaseUrls: { - v1SecureServiceUrl: 'jssdks.mparticle.com/v1/JS/', - v2SecureServiceUrl: 'jssdks.mparticle.com/v2/JS/', - v3SecureServiceUrl: 'jssdks.mparticle.com/v3/JS/', - configUrl: 'jssdkcdns.mparticle.com/JS/v2/', - identityUrl: 'identity.mparticle.com/v1/', - aliasUrl: 'jssdks.mparticle.com/v1/identity/', - userAudienceUrl: 'nativesdks.mparticle.com/v1/' - }, - Base64CookieKeys: { - csm: 1, - sa: 1, - ss: 1, - ua: 1, - ui: 1, - csd: 1, - ia: 1, - con: 1 - }, - // https://go.mparticle.com/work/SQDSDKS-6039 - 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', - EventBatchingIntervalMillis: 'eventBatchingIntervalMillis', - OfflineStorage: 'offlineStorage', - DirectUrlRouting: 'directURLRouting', - CacheIdentity: 'cacheIdentity', - AudienceAPI: 'audienceAPI' - }, - DefaultInstance: 'default_instance', - CCPAPurpose: 'data_sale_opt_out', - IdentityMethods: { - Modify: 'modify', - Logout: 'logout', - Login: 'login', - Identify: 'identify' - } - }; - // https://go.mparticle.com/work/SQDSDKS-6080 - var ONE_DAY_IN_SECONDS = 60 * 60 * 24; - var MILLIS_IN_ONE_SEC = 1000; - - /****************************************************************************** - Copyright (c) Microsoft Corporation. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */ - /* global Reflect, Promise, SuppressedError, Symbol */ - - var extendStatics = function(d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - - function __extends(d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - } - - var __assign = function() { - __assign = Object.assign || function __assign(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); - }; - - function __awaiter(thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - } - - function __generator(thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (g && (g = 0, op[0] && (_ = 0)), _) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } - } - - function __spreadArray(to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || Array.prototype.slice.call(from)); - } - - typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { - var e = new Error(message); - return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; - }; - - var SDKProductActionType; - (function (SDKProductActionType) { - SDKProductActionType[SDKProductActionType["Unknown"] = 0] = "Unknown"; - SDKProductActionType[SDKProductActionType["AddToCart"] = 1] = "AddToCart"; - SDKProductActionType[SDKProductActionType["RemoveFromCart"] = 2] = "RemoveFromCart"; - SDKProductActionType[SDKProductActionType["Checkout"] = 3] = "Checkout"; - SDKProductActionType[SDKProductActionType["CheckoutOption"] = 4] = "CheckoutOption"; - SDKProductActionType[SDKProductActionType["Click"] = 5] = "Click"; - SDKProductActionType[SDKProductActionType["ViewDetail"] = 6] = "ViewDetail"; - SDKProductActionType[SDKProductActionType["Purchase"] = 7] = "Purchase"; - SDKProductActionType[SDKProductActionType["Refund"] = 8] = "Refund"; - SDKProductActionType[SDKProductActionType["AddToWishlist"] = 9] = "AddToWishlist"; - SDKProductActionType[SDKProductActionType["RemoveFromWishlist"] = 10] = "RemoveFromWishlist"; - })(SDKProductActionType || (SDKProductActionType = {})); - var SDKIdentityTypeEnum; - (function (SDKIdentityTypeEnum) { - SDKIdentityTypeEnum["other"] = "other"; - SDKIdentityTypeEnum["customerId"] = "customerid"; - SDKIdentityTypeEnum["facebook"] = "facebook"; - SDKIdentityTypeEnum["twitter"] = "twitter"; - SDKIdentityTypeEnum["google"] = "google"; - SDKIdentityTypeEnum["microsoft"] = "microsoft"; - SDKIdentityTypeEnum["yahoo"] = "yahoo"; - SDKIdentityTypeEnum["email"] = "email"; - SDKIdentityTypeEnum["alias"] = "alias"; - SDKIdentityTypeEnum["facebookCustomAudienceId"] = "facebookcustomaudienceid"; - SDKIdentityTypeEnum["otherId2"] = "other2"; - SDKIdentityTypeEnum["otherId3"] = "other3"; - SDKIdentityTypeEnum["otherId4"] = "other4"; - SDKIdentityTypeEnum["otherId5"] = "other5"; - SDKIdentityTypeEnum["otherId6"] = "other6"; - SDKIdentityTypeEnum["otherId7"] = "other7"; - SDKIdentityTypeEnum["otherId8"] = "other8"; - SDKIdentityTypeEnum["otherId9"] = "other9"; - SDKIdentityTypeEnum["otherId10"] = "other10"; - SDKIdentityTypeEnum["mobileNumber"] = "mobile_number"; - SDKIdentityTypeEnum["phoneNumber2"] = "phone_number_2"; - SDKIdentityTypeEnum["phoneNumber3"] = "phone_number_3"; - })(SDKIdentityTypeEnum || (SDKIdentityTypeEnum = {})); - - var dist = {}; - - (function (exports) { - Object.defineProperty(exports, "__esModule", { value: true }); - (function (ApplicationInformationOsEnum) { - ApplicationInformationOsEnum["unknown"] = "Unknown"; - ApplicationInformationOsEnum["iOS"] = "IOS"; - ApplicationInformationOsEnum["android"] = "Android"; - ApplicationInformationOsEnum["windowsPhone"] = "WindowsPhone"; - ApplicationInformationOsEnum["mobileWeb"] = "MobileWeb"; - ApplicationInformationOsEnum["unityIOS"] = "UnityIOS"; - ApplicationInformationOsEnum["unityAndroid"] = "UnityAndroid"; - ApplicationInformationOsEnum["desktop"] = "Desktop"; - ApplicationInformationOsEnum["tvOS"] = "TVOS"; - ApplicationInformationOsEnum["roku"] = "Roku"; - ApplicationInformationOsEnum["outOfBand"] = "OutOfBand"; - ApplicationInformationOsEnum["alexa"] = "Alexa"; - ApplicationInformationOsEnum["smartTV"] = "SmartTV"; - ApplicationInformationOsEnum["fireTV"] = "FireTV"; - ApplicationInformationOsEnum["xbox"] = "Xbox"; - })(exports.ApplicationInformationOsEnum || (exports.ApplicationInformationOsEnum = {})); - (function (ApplicationStateTransitionEventEventTypeEnum) { - ApplicationStateTransitionEventEventTypeEnum["applicationStateTransition"] = "application_state_transition"; - })(exports.ApplicationStateTransitionEventEventTypeEnum || (exports.ApplicationStateTransitionEventEventTypeEnum = {})); - (function (ApplicationStateTransitionEventDataApplicationTransitionTypeEnum) { - ApplicationStateTransitionEventDataApplicationTransitionTypeEnum["applicationInitialized"] = "application_initialized"; - ApplicationStateTransitionEventDataApplicationTransitionTypeEnum["applicationExit"] = "application_exit"; - ApplicationStateTransitionEventDataApplicationTransitionTypeEnum["applicationBackground"] = "application_background"; - ApplicationStateTransitionEventDataApplicationTransitionTypeEnum["applicationForeground"] = "application_foreground"; - })(exports.ApplicationStateTransitionEventDataApplicationTransitionTypeEnum || (exports.ApplicationStateTransitionEventDataApplicationTransitionTypeEnum = {})); - (function (BatchEnvironmentEnum) { - BatchEnvironmentEnum["unknown"] = "unknown"; - BatchEnvironmentEnum["development"] = "development"; - BatchEnvironmentEnum["production"] = "production"; - })(exports.BatchEnvironmentEnum || (exports.BatchEnvironmentEnum = {})); - (function (BreadcrumbEventEventTypeEnum) { - BreadcrumbEventEventTypeEnum["breadcrumb"] = "breadcrumb"; - })(exports.BreadcrumbEventEventTypeEnum || (exports.BreadcrumbEventEventTypeEnum = {})); - (function (CommerceEventEventTypeEnum) { - CommerceEventEventTypeEnum["commerceEvent"] = "commerce_event"; - })(exports.CommerceEventEventTypeEnum || (exports.CommerceEventEventTypeEnum = {})); - (function (CommerceEventDataCustomEventTypeEnum) { - CommerceEventDataCustomEventTypeEnum["addToCart"] = "add_to_cart"; - CommerceEventDataCustomEventTypeEnum["removeFromCart"] = "remove_from_cart"; - CommerceEventDataCustomEventTypeEnum["checkout"] = "checkout"; - CommerceEventDataCustomEventTypeEnum["checkoutOption"] = "checkout_option"; - CommerceEventDataCustomEventTypeEnum["click"] = "click"; - CommerceEventDataCustomEventTypeEnum["viewDetail"] = "view_detail"; - CommerceEventDataCustomEventTypeEnum["purchase"] = "purchase"; - CommerceEventDataCustomEventTypeEnum["refund"] = "refund"; - CommerceEventDataCustomEventTypeEnum["promotionView"] = "promotion_view"; - CommerceEventDataCustomEventTypeEnum["promotionClick"] = "promotion_click"; - CommerceEventDataCustomEventTypeEnum["addToWishlist"] = "add_to_wishlist"; - CommerceEventDataCustomEventTypeEnum["removeFromWishlist"] = "remove_from_wishlist"; - CommerceEventDataCustomEventTypeEnum["impression"] = "impression"; - })(exports.CommerceEventDataCustomEventTypeEnum || (exports.CommerceEventDataCustomEventTypeEnum = {})); - (function (CrashReportEventEventTypeEnum) { - CrashReportEventEventTypeEnum["crashReport"] = "crash_report"; - })(exports.CrashReportEventEventTypeEnum || (exports.CrashReportEventEventTypeEnum = {})); - (function (CustomEventEventTypeEnum) { - CustomEventEventTypeEnum["customEvent"] = "custom_event"; - })(exports.CustomEventEventTypeEnum || (exports.CustomEventEventTypeEnum = {})); - (function (CustomEventDataCustomEventTypeEnum) { - CustomEventDataCustomEventTypeEnum["navigation"] = "navigation"; - CustomEventDataCustomEventTypeEnum["location"] = "location"; - CustomEventDataCustomEventTypeEnum["search"] = "search"; - CustomEventDataCustomEventTypeEnum["transaction"] = "transaction"; - CustomEventDataCustomEventTypeEnum["userContent"] = "user_content"; - CustomEventDataCustomEventTypeEnum["userPreference"] = "user_preference"; - CustomEventDataCustomEventTypeEnum["social"] = "social"; - CustomEventDataCustomEventTypeEnum["media"] = "media"; - CustomEventDataCustomEventTypeEnum["other"] = "other"; - CustomEventDataCustomEventTypeEnum["unknown"] = "unknown"; - })(exports.CustomEventDataCustomEventTypeEnum || (exports.CustomEventDataCustomEventTypeEnum = {})); - (function (DeviceCurrentStateDeviceOrientationEnum) { - DeviceCurrentStateDeviceOrientationEnum["portrait"] = "portrait"; - DeviceCurrentStateDeviceOrientationEnum["portraitUpsideDown"] = "portrait_upside_down"; - DeviceCurrentStateDeviceOrientationEnum["landscape"] = "landscape"; - DeviceCurrentStateDeviceOrientationEnum["landscapeLeft"] = "LandscapeLeft"; - DeviceCurrentStateDeviceOrientationEnum["landscapeRight"] = "LandscapeRight"; - DeviceCurrentStateDeviceOrientationEnum["faceUp"] = "FaceUp"; - DeviceCurrentStateDeviceOrientationEnum["faceDown"] = "FaceDown"; - DeviceCurrentStateDeviceOrientationEnum["square"] = "Square"; - })(exports.DeviceCurrentStateDeviceOrientationEnum || (exports.DeviceCurrentStateDeviceOrientationEnum = {})); - (function (DeviceCurrentStateStatusBarOrientationEnum) { - DeviceCurrentStateStatusBarOrientationEnum["portrait"] = "portrait"; - DeviceCurrentStateStatusBarOrientationEnum["portraitUpsideDown"] = "portrait_upside_down"; - DeviceCurrentStateStatusBarOrientationEnum["landscape"] = "landscape"; - DeviceCurrentStateStatusBarOrientationEnum["landscapeLeft"] = "LandscapeLeft"; - DeviceCurrentStateStatusBarOrientationEnum["landscapeRight"] = "LandscapeRight"; - DeviceCurrentStateStatusBarOrientationEnum["faceUp"] = "FaceUp"; - DeviceCurrentStateStatusBarOrientationEnum["faceDown"] = "FaceDown"; - DeviceCurrentStateStatusBarOrientationEnum["square"] = "Square"; - })(exports.DeviceCurrentStateStatusBarOrientationEnum || (exports.DeviceCurrentStateStatusBarOrientationEnum = {})); - (function (DeviceInformationPlatformEnum) { - DeviceInformationPlatformEnum["iOS"] = "iOS"; - DeviceInformationPlatformEnum["android"] = "Android"; - DeviceInformationPlatformEnum["web"] = "web"; - DeviceInformationPlatformEnum["desktop"] = "desktop"; - DeviceInformationPlatformEnum["tvOS"] = "tvOS"; - DeviceInformationPlatformEnum["roku"] = "roku"; - DeviceInformationPlatformEnum["outOfBand"] = "out_of_band"; - DeviceInformationPlatformEnum["smartTV"] = "smart_tv"; - DeviceInformationPlatformEnum["xbox"] = "xbox"; - })(exports.DeviceInformationPlatformEnum || (exports.DeviceInformationPlatformEnum = {})); - (function (EventTypeEnum) { - EventTypeEnum["unknown"] = "unknown"; - EventTypeEnum["sessionStart"] = "session_start"; - EventTypeEnum["sessionEnd"] = "session_end"; - EventTypeEnum["screenView"] = "screen_view"; - EventTypeEnum["customEvent"] = "custom_event"; - EventTypeEnum["crashReport"] = "crash_report"; - EventTypeEnum["optOut"] = "opt_out"; - EventTypeEnum["firstRun"] = "first_run"; - EventTypeEnum["preAttribution"] = "pre_attribution"; - EventTypeEnum["pushRegistration"] = "push_registration"; - EventTypeEnum["applicationStateTransition"] = "application_state_transition"; - EventTypeEnum["pushMessage"] = "push_message"; - EventTypeEnum["networkPerformance"] = "network_performance"; - EventTypeEnum["breadcrumb"] = "breadcrumb"; - EventTypeEnum["profile"] = "profile"; - EventTypeEnum["pushReaction"] = "push_reaction"; - EventTypeEnum["commerceEvent"] = "commerce_event"; - EventTypeEnum["userAttributeChange"] = "user_attribute_change"; - EventTypeEnum["userIdentityChange"] = "user_identity_change"; - EventTypeEnum["uninstall"] = "uninstall"; - EventTypeEnum["validationResult"] = "validation_result"; - })(exports.EventTypeEnum || (exports.EventTypeEnum = {})); - (function (IdentityTypeEnum) { - IdentityTypeEnum["other"] = "other"; - IdentityTypeEnum["customerId"] = "customer_id"; - IdentityTypeEnum["facebook"] = "facebook"; - IdentityTypeEnum["twitter"] = "twitter"; - IdentityTypeEnum["google"] = "google"; - IdentityTypeEnum["microsoft"] = "microsoft"; - IdentityTypeEnum["yahoo"] = "yahoo"; - IdentityTypeEnum["email"] = "email"; - IdentityTypeEnum["alias"] = "alias"; - IdentityTypeEnum["facebookCustomAudienceId"] = "facebook_custom_audience_id"; - IdentityTypeEnum["otherId2"] = "other_id_2"; - IdentityTypeEnum["otherId3"] = "other_id_3"; - IdentityTypeEnum["otherId4"] = "other_id_4"; - IdentityTypeEnum["otherId5"] = "other_id_5"; - IdentityTypeEnum["otherId6"] = "other_id_6"; - IdentityTypeEnum["otherId7"] = "other_id_7"; - IdentityTypeEnum["otherId8"] = "other_id_8"; - IdentityTypeEnum["otherId9"] = "other_id_9"; - IdentityTypeEnum["otherId10"] = "other_id_10"; - IdentityTypeEnum["mobileNumber"] = "mobile_number"; - IdentityTypeEnum["phoneNumber2"] = "phone_number_2"; - IdentityTypeEnum["phoneNumber3"] = "phone_number_3"; - })(exports.IdentityTypeEnum || (exports.IdentityTypeEnum = {})); - (function (NetworkPerformanceEventEventTypeEnum) { - NetworkPerformanceEventEventTypeEnum["networkPerformance"] = "network_performance"; - })(exports.NetworkPerformanceEventEventTypeEnum || (exports.NetworkPerformanceEventEventTypeEnum = {})); - (function (OptOutEventEnum) { - OptOutEventEnum["optOut"] = "opt_out"; - })(exports.OptOutEventEnum || (exports.OptOutEventEnum = {})); - (function (ProductActionActionEnum) { - ProductActionActionEnum["unknown"] = "unknown"; - ProductActionActionEnum["addToCart"] = "add_to_cart"; - ProductActionActionEnum["removeFromCart"] = "remove_from_cart"; - ProductActionActionEnum["checkout"] = "checkout"; - ProductActionActionEnum["checkoutOption"] = "checkout_option"; - ProductActionActionEnum["click"] = "click"; - ProductActionActionEnum["viewDetail"] = "view_detail"; - ProductActionActionEnum["purchase"] = "purchase"; - ProductActionActionEnum["refund"] = "refund"; - ProductActionActionEnum["addToWishlist"] = "add_to_wishlist"; - ProductActionActionEnum["removeFromWishlist"] = "remove_from_wish_list"; - })(exports.ProductActionActionEnum || (exports.ProductActionActionEnum = {})); - (function (ProfileEventEventTypeEnum) { - ProfileEventEventTypeEnum["profile"] = "profile"; - })(exports.ProfileEventEventTypeEnum || (exports.ProfileEventEventTypeEnum = {})); - (function (ProfileEventDataProfileEventTypeEnum) { - ProfileEventDataProfileEventTypeEnum["signup"] = "signup"; - ProfileEventDataProfileEventTypeEnum["login"] = "login"; - ProfileEventDataProfileEventTypeEnum["logout"] = "logout"; - ProfileEventDataProfileEventTypeEnum["update"] = "update"; - ProfileEventDataProfileEventTypeEnum["delete"] = "delete"; - })(exports.ProfileEventDataProfileEventTypeEnum || (exports.ProfileEventDataProfileEventTypeEnum = {})); - (function (PromotionActionActionEnum) { - PromotionActionActionEnum["view"] = "view"; - PromotionActionActionEnum["click"] = "click"; - })(exports.PromotionActionActionEnum || (exports.PromotionActionActionEnum = {})); - (function (PushMessageEventEventTypeEnum) { - PushMessageEventEventTypeEnum["pushMessage"] = "push_message"; - })(exports.PushMessageEventEventTypeEnum || (exports.PushMessageEventEventTypeEnum = {})); - (function (PushMessageEventDataPushMessageTypeEnum) { - PushMessageEventDataPushMessageTypeEnum["sent"] = "sent"; - PushMessageEventDataPushMessageTypeEnum["received"] = "received"; - PushMessageEventDataPushMessageTypeEnum["action"] = "action"; - })(exports.PushMessageEventDataPushMessageTypeEnum || (exports.PushMessageEventDataPushMessageTypeEnum = {})); - (function (PushMessageEventDataApplicationStateEnum) { - PushMessageEventDataApplicationStateEnum["notRunning"] = "not_running"; - PushMessageEventDataApplicationStateEnum["background"] = "background"; - PushMessageEventDataApplicationStateEnum["foreground"] = "foreground"; - })(exports.PushMessageEventDataApplicationStateEnum || (exports.PushMessageEventDataApplicationStateEnum = {})); - (function (PushMessageEventDataPushMessageBehaviorEnum) { - PushMessageEventDataPushMessageBehaviorEnum["received"] = "Received"; - PushMessageEventDataPushMessageBehaviorEnum["directOpen"] = "DirectOpen"; - PushMessageEventDataPushMessageBehaviorEnum["read"] = "Read"; - PushMessageEventDataPushMessageBehaviorEnum["influencedOpen"] = "InfluencedOpen"; - PushMessageEventDataPushMessageBehaviorEnum["displayed"] = "Displayed"; - })(exports.PushMessageEventDataPushMessageBehaviorEnum || (exports.PushMessageEventDataPushMessageBehaviorEnum = {})); - (function (PushRegistrationEventEventTypeEnum) { - PushRegistrationEventEventTypeEnum["pushRegistration"] = "push_registration"; - })(exports.PushRegistrationEventEventTypeEnum || (exports.PushRegistrationEventEventTypeEnum = {})); - (function (SessionEndEventEventTypeEnum) { - SessionEndEventEventTypeEnum["sessionEnd"] = "session_end"; - })(exports.SessionEndEventEventTypeEnum || (exports.SessionEndEventEventTypeEnum = {})); - (function (SessionStartEventEventTypeEnum) { - SessionStartEventEventTypeEnum["sessionStart"] = "session_start"; - })(exports.SessionStartEventEventTypeEnum || (exports.SessionStartEventEventTypeEnum = {})); - (function (SourceInformationChannelEnum) { - SourceInformationChannelEnum["native"] = "native"; - SourceInformationChannelEnum["javascript"] = "javascript"; - SourceInformationChannelEnum["pixel"] = "pixel"; - SourceInformationChannelEnum["desktop"] = "desktop"; - SourceInformationChannelEnum["partner"] = "partner"; - SourceInformationChannelEnum["serverToServer"] = "server_to_server"; - })(exports.SourceInformationChannelEnum || (exports.SourceInformationChannelEnum = {})); - (function (UserAttributeChangeEventEventTypeEnum) { - UserAttributeChangeEventEventTypeEnum["userAttributeChange"] = "user_attribute_change"; - })(exports.UserAttributeChangeEventEventTypeEnum || (exports.UserAttributeChangeEventEventTypeEnum = {})); - (function (UserIdentityChangeEventEventTypeEnum) { - UserIdentityChangeEventEventTypeEnum["userIdentityChange"] = "user_identity_change"; - })(exports.UserIdentityChangeEventEventTypeEnum || (exports.UserIdentityChangeEventEventTypeEnum = {})); - } (dist)); + AliasMissingTime: 'Alias Request must have both a startTime and an endTime', + AliasStartBeforeEndTime: "Alias Request's endTime must be later than its startTime" + } + }, + NativeSdkPaths: { + LogEvent: 'logEvent', + SetUserTag: 'setUserTag', + RemoveUserTag: 'removeUserTag', + SetUserAttribute: 'setUserAttribute', + RemoveUserAttribute: 'removeUserAttribute', + SetSessionAttribute: 'setSessionAttribute', + AddToCart: 'addToCart', + RemoveFromCart: 'removeFromCart', + ClearCart: 'clearCart', + LogOut: 'logOut', + SetUserAttributeList: 'setUserAttributeList', + RemoveAllUserAttributes: 'removeAllUserAttributes', + GetUserAttributesLists: 'getUserAttributesLists', + GetAllUserAttributes: 'getAllUserAttributes', + Identify: 'identify', + Logout: 'logout', + Login: 'login', + Modify: 'modify', + Alias: 'aliasUsers', + Upload: 'upload' + }, + StorageNames: { + localStorageName: 'mprtcl-api', + localStorageNameV3: 'mprtcl-v3', + cookieName: 'mprtcl-api', + cookieNameV2: 'mprtcl-v2', + cookieNameV3: 'mprtcl-v3', + localStorageNameV4: 'mprtcl-v4', + localStorageProductsV4: 'mprtcl-prodv4', + cookieNameV4: 'mprtcl-v4', + currentStorageName: 'mprtcl-v4', + currentStorageProductsName: 'mprtcl-prodv4' + }, + DefaultConfig: { + cookieDomain: null, + cookieExpiration: 365, + logLevel: null, + timeout: 300, + sessionTimeout: 30, + maxProducts: 20, + forwarderStatsTimeout: 5000, + integrationDelayTimeout: 5000, + maxCookieSize: 3000, + aliasMaxWindow: 90, + uploadInterval: 0 // Maximum milliseconds in between batch uploads, below 500 will mean immediate upload. The server returns this as a string, but we are using it as a number internally + }, + + DefaultBaseUrls: { + v1SecureServiceUrl: 'jssdks.mparticle.com/v1/JS/', + v2SecureServiceUrl: 'jssdks.mparticle.com/v2/JS/', + v3SecureServiceUrl: 'jssdks.mparticle.com/v3/JS/', + configUrl: 'jssdkcdns.mparticle.com/JS/v2/', + identityUrl: 'identity.mparticle.com/v1/', + aliasUrl: 'jssdks.mparticle.com/v1/identity/', + userAudienceUrl: 'nativesdks.mparticle.com/v1/' + }, + Base64CookieKeys: { + csm: 1, + sa: 1, + ss: 1, + ua: 1, + ui: 1, + csd: 1, + ia: 1, + con: 1 + }, + // https://go.mparticle.com/work/SQDSDKS-6039 + 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', + EventBatchingIntervalMillis: 'eventBatchingIntervalMillis', + OfflineStorage: 'offlineStorage', + DirectUrlRouting: 'directURLRouting', + CacheIdentity: 'cacheIdentity', + AudienceAPI: 'audienceAPI' + }, + DefaultInstance: 'default_instance', + CCPAPurpose: 'data_sale_opt_out', + IdentityMethods: { + Modify: 'modify', + Logout: 'logout', + Login: 'login', + Identify: 'identify' + } + }; + // https://go.mparticle.com/work/SQDSDKS-6080 + var ONE_DAY_IN_SECONDS = 60 * 60 * 24; + var MILLIS_IN_ONE_SEC = 1000; var Messages$9 = Constants.Messages; var createCookieString = function createCookieString(value) { @@ -1206,130 +626,781 @@ var mParticle = (function () { hash = (hash << 5) - hash + character; hash = hash & hash; } - return hash; + return hash; + } + var generateRandomValue = function generateRandomValue(value) { + var randomValue; + var a; + if (window.crypto && window.crypto.getRandomValues) { + // @ts-ignore + randomValue = window.crypto.getRandomValues(new Uint8Array(1)); // eslint-disable-line no-undef + } + + if (randomValue) { + // @ts-ignore + return (a ^ randomValue[0] % 16 >> a / 4).toString(16); + } + return (a ^ Math.random() * 16 >> a / 4).toString(16); + }; + var generateUniqueId = function generateUniqueId(a) { + // https://gist.github.com/jed/982883 + // Added support for crypto for better random + if (a === void 0) { + a = ''; + } + return a // if the placeholder was passed, return + ? generateRandomValue() // if the placeholder was passed, return + : + // [1e7] -> // 10000000 + + // -1e3 -> // -1000 + + // -4e3 -> // -4000 + + // -8e3 -> // -80000000 + + // -1e11 -> //-100000000000, + "".concat(1e7, "-").concat(1e3, "-").concat(4e3, "-").concat(8e3, "-").concat(1e11).replace(/[018]/g, + // zeroes, ones, and eights with + generateUniqueId // random hex digits + ); + }; + /** + * Returns a value between 1-100 inclusive. + */ + var getRampNumber = function getRampNumber(value) { + if (!value) { + return 100; + } + var hash = generateHash(value); + return Math.abs(hash % 100) + 1; + }; + var isObject = function isObject(value) { + var objType = Object.prototype.toString.call(value); + return objType === '[object Object]' || objType === '[object Error]'; + }; + var parseNumber = function parseNumber(value) { + if (isNaN(value) || !isFinite(value)) { + return 0; + } + var floatValue = parseFloat(value); + return isNaN(floatValue) ? 0 : floatValue; + }; + var parseStringOrNumber = function parseStringOrNumber(value) { + if (isStringOrNumber(value)) { + return value; + } else { + return null; + } + }; + var replaceCommasWithPipes = function replaceCommasWithPipes(value) { + return value.replace(/,/g, '|'); + }; + var replacePipesWithCommas = function replacePipesWithCommas(value) { + return value.replace(/\|/g, ','); + }; + var replaceApostrophesWithQuotes = function replaceApostrophesWithQuotes(value) { + return value.replace(/\'/g, '"'); + }; + var replaceQuotesWithApostrophes = function replaceQuotesWithApostrophes(value) { + return value.replace(/\"/g, "'"); + }; + // FIXME: REFACTOR for V3 + // only used in store.js to sanitize server-side formatting of + // booleans when checking for `isDevelopmentMode` + // Should be removed in v3 + var returnConvertedBoolean = function returnConvertedBoolean(data) { + if (data === 'false' || data === '0') { + return false; + } else { + return Boolean(data); + } + }; + var decoded = function decoded(s) { + return decodeURIComponent(s.replace(/\+/g, ' ')); + }; + var converted = function converted(s) { + if (s.indexOf('"') === 0) { + s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\'); + } + return s; + }; + var isString = function isString(value) { + return typeof value === 'string'; + }; + var isNumber = function isNumber(value) { + return typeof value === 'number'; + }; + var isBoolean = function isBoolean(value) { + return typeof value === 'boolean'; + }; + var isFunction = function isFunction(fn) { + return typeof fn === 'function'; + }; + var isValidCustomFlagProperty = function isValidCustomFlagProperty(value) { + return isNumber(value) || isString(value) || isBoolean(value); + }; + var toDataPlanSlug = function toDataPlanSlug(value) { + // Make sure we are only acting on strings or numbers + return isStringOrNumber(value) ? value.toString().toLowerCase().replace(/[^0-9a-zA-Z]+/g, '_') : ''; + }; + var isDataPlanSlug = function isDataPlanSlug(str) { + return str === toDataPlanSlug(str); + }; + var isStringOrNumber = function isStringOrNumber(value) { + return isString(value) || isNumber(value); + }; + var isEmpty = function isEmpty(value) { + return value == null || !(Object.keys(value) || value).length; + }; + var moveElementToEnd = function moveElementToEnd(array, index) { + return array.slice(0, index).concat(array.slice(index + 1), array[index]); + }; + + function getNewIdentitiesByName(newIdentitiesByType) { + var newIdentitiesByName = {}; + for (var key in newIdentitiesByType) { + var identityNameKey = getIdentityName(parseNumber(key)); + newIdentitiesByName[identityNameKey] = newIdentitiesByType[key]; + } + return newIdentitiesByName; + } + function getIdentityName(identityType) { + switch (identityType) { + case IdentityType$1.Other: + return 'other'; + case IdentityType$1.CustomerId: + return 'customerid'; + case IdentityType$1.Facebook: + return 'facebook'; + case IdentityType$1.Twitter: + return 'twitter'; + case IdentityType$1.Google: + return 'google'; + case IdentityType$1.Microsoft: + return 'microsoft'; + case IdentityType$1.Yahoo: + return 'yahoo'; + case IdentityType$1.Email: + return 'email'; + case IdentityType$1.FacebookCustomAudienceId: + return 'facebookcustomaudienceid'; + case IdentityType$1.Other2: + return 'other2'; + case IdentityType$1.Other3: + return 'other3'; + case IdentityType$1.Other4: + return 'other4'; + case IdentityType$1.Other5: + return 'other5'; + case IdentityType$1.Other6: + return 'other6'; + case IdentityType$1.Other7: + return 'other7'; + case IdentityType$1.Other8: + return 'other8'; + case IdentityType$1.Other9: + return 'other9'; + case IdentityType$1.Other10: + return 'other10'; + case IdentityType$1.MobileNumber: + return 'mobile_number'; + case IdentityType$1.PhoneNumber2: + return 'phone_number_2'; + case IdentityType$1.PhoneNumber3: + return 'phone_number_3'; + default: + return null; + } } - var generateRandomValue = function generateRandomValue(value) { - var randomValue; - var a; - if (window.crypto && window.crypto.getRandomValues) { - // @ts-ignore - randomValue = window.crypto.getRandomValues(new Uint8Array(1)); // eslint-disable-line no-undef - } - if (randomValue) { - // @ts-ignore - return (a ^ randomValue[0] % 16 >> a / 4).toString(16); - } - return (a ^ Math.random() * 16 >> a / 4).toString(16); + var _TriggerUploadType; + var MessageType$1 = { + SessionStart: 1, + SessionEnd: 2, + PageView: 3, + PageEvent: 4, + CrashReport: 5, + OptOut: 6, + AppStateTransition: 10, + Profile: 14, + Commerce: 16, + Media: 20, + UserAttributeChange: 17, + UserIdentityChange: 18 }; - var generateUniqueId = function generateUniqueId(a) { - // https://gist.github.com/jed/982883 - // Added support for crypto for better random - if (a === void 0) { - a = ''; + + // Dictionary that contains MessageTypes that will + // trigger an immediate upload. + var TriggerUploadType = (_TriggerUploadType = {}, _defineProperty(_TriggerUploadType, MessageType$1.Commerce, 1), _defineProperty(_TriggerUploadType, MessageType$1.UserIdentityChange, 1), _TriggerUploadType); + var EventType = { + Unknown: 0, + Navigation: 1, + Location: 2, + Search: 3, + Transaction: 4, + UserContent: 5, + UserPreference: 6, + Social: 7, + Other: 8, + Media: 9, + getName: function getName(id) { + switch (id) { + case EventType.Unknown: + return 'Unknown'; + case EventType.Navigation: + return 'Navigation'; + case EventType.Location: + return 'Location'; + case EventType.Search: + return 'Search'; + case EventType.Transaction: + return 'Transaction'; + case EventType.UserContent: + return 'User Content'; + case EventType.UserPreference: + return 'User Preference'; + case EventType.Social: + return 'Social'; + case CommerceEventType.ProductAddToCart: + return 'Product Added to Cart'; + case CommerceEventType.ProductAddToWishlist: + return 'Product Added to Wishlist'; + case CommerceEventType.ProductCheckout: + return 'Product Checkout'; + case CommerceEventType.ProductCheckoutOption: + return 'Product Checkout Options'; + case CommerceEventType.ProductClick: + return 'Product Click'; + case CommerceEventType.ProductImpression: + return 'Product Impression'; + case CommerceEventType.ProductPurchase: + return 'Product Purchased'; + case CommerceEventType.ProductRefund: + return 'Product Refunded'; + case CommerceEventType.ProductRemoveFromCart: + return 'Product Removed From Cart'; + case CommerceEventType.ProductRemoveFromWishlist: + return 'Product Removed from Wishlist'; + case CommerceEventType.ProductViewDetail: + return 'Product View Details'; + case CommerceEventType.PromotionClick: + return 'Promotion Click'; + case CommerceEventType.PromotionView: + return 'Promotion View'; + default: + return 'Other'; + } } - return a // if the placeholder was passed, return - ? generateRandomValue() // if the placeholder was passed, return - : - // [1e7] -> // 10000000 + - // -1e3 -> // -1000 + - // -4e3 -> // -4000 + - // -8e3 -> // -80000000 + - // -1e11 -> //-100000000000, - "".concat(1e7, "-").concat(1e3, "-").concat(4e3, "-").concat(8e3, "-").concat(1e11).replace(/[018]/g, - // zeroes, ones, and eights with - generateUniqueId // random hex digits - ); }; - /** - * Returns a value between 1-100 inclusive. - */ - var getRampNumber = function getRampNumber(value) { - if (!value) { - return 100; - } - var hash = generateHash(value); - return Math.abs(hash % 100) + 1; + + // Continuation of enum above, but in seperate object since we don't expose these to end user + var CommerceEventType = { + ProductAddToCart: 10, + ProductRemoveFromCart: 11, + ProductCheckout: 12, + ProductCheckoutOption: 13, + ProductClick: 14, + ProductViewDetail: 15, + ProductPurchase: 16, + ProductRefund: 17, + PromotionView: 18, + PromotionClick: 19, + ProductAddToWishlist: 20, + ProductRemoveFromWishlist: 21, + ProductImpression: 22 }; - var isObject = function isObject(value) { - var objType = Object.prototype.toString.call(value); - return objType === '[object Object]' || objType === '[object Error]'; + var IdentityType = { + Other: 0, + CustomerId: 1, + Facebook: 2, + Twitter: 3, + Google: 4, + Microsoft: 5, + Yahoo: 6, + Email: 7, + FacebookCustomAudienceId: 9, + Other2: 10, + Other3: 11, + Other4: 12, + Other5: 13, + Other6: 14, + Other7: 15, + Other8: 16, + Other9: 17, + Other10: 18, + MobileNumber: 19, + PhoneNumber2: 20, + PhoneNumber3: 21 }; - var parseNumber = function parseNumber(value) { - if (isNaN(value) || !isFinite(value)) { - return 0; + IdentityType.isValid = function (identityType) { + if (typeof identityType === 'number') { + for (var prop in IdentityType) { + if (IdentityType.hasOwnProperty(prop)) { + if (IdentityType[prop] === identityType) { + return true; + } + } + } } - var floatValue = parseFloat(value); - return isNaN(floatValue) ? 0 : floatValue; + return false; }; - var parseStringOrNumber = function parseStringOrNumber(value) { - if (isStringOrNumber(value)) { - return value; - } else { - return null; + IdentityType.getName = function (identityType) { + switch (identityType) { + case window.mParticle.IdentityType.CustomerId: + return 'Customer ID'; + case window.mParticle.IdentityType.Facebook: + return 'Facebook ID'; + case window.mParticle.IdentityType.Twitter: + return 'Twitter ID'; + case window.mParticle.IdentityType.Google: + return 'Google ID'; + case window.mParticle.IdentityType.Microsoft: + return 'Microsoft ID'; + case window.mParticle.IdentityType.Yahoo: + return 'Yahoo ID'; + case window.mParticle.IdentityType.Email: + return 'Email'; + case window.mParticle.IdentityType.FacebookCustomAudienceId: + return 'Facebook App User ID'; + default: + return 'Other ID'; } }; - var replaceCommasWithPipes = function replaceCommasWithPipes(value) { - return value.replace(/,/g, '|'); - }; - var replacePipesWithCommas = function replacePipesWithCommas(value) { - return value.replace(/\|/g, ','); - }; - var replaceApostrophesWithQuotes = function replaceApostrophesWithQuotes(value) { - return value.replace(/\'/g, '"'); - }; - var replaceQuotesWithApostrophes = function replaceQuotesWithApostrophes(value) { - return value.replace(/\"/g, "'"); - }; - // FIXME: REFACTOR for V3 - // only used in store.js to sanitize server-side formatting of - // booleans when checking for `isDevelopmentMode` - // Should be removed in v3 - var returnConvertedBoolean = function returnConvertedBoolean(data) { - if (data === 'false' || data === '0') { - return false; - } else { - return Boolean(data); + IdentityType.getIdentityType = function (identityName) { + switch (identityName) { + case 'other': + return IdentityType.Other; + case 'customerid': + return IdentityType.CustomerId; + case 'facebook': + return IdentityType.Facebook; + case 'twitter': + return IdentityType.Twitter; + case 'google': + return IdentityType.Google; + case 'microsoft': + return IdentityType.Microsoft; + case 'yahoo': + return IdentityType.Yahoo; + case 'email': + return IdentityType.Email; + case 'facebookcustomaudienceid': + return IdentityType.FacebookCustomAudienceId; + case 'other2': + return IdentityType.Other2; + case 'other3': + return IdentityType.Other3; + case 'other4': + return IdentityType.Other4; + case 'other5': + return IdentityType.Other5; + case 'other6': + return IdentityType.Other6; + case 'other7': + return IdentityType.Other7; + case 'other8': + return IdentityType.Other8; + case 'other9': + return IdentityType.Other9; + case 'other10': + return IdentityType.Other10; + case 'mobile_number': + return IdentityType.MobileNumber; + case 'phone_number_2': + return IdentityType.PhoneNumber2; + case 'phone_number_3': + return IdentityType.PhoneNumber3; + default: + return false; } }; - var decoded = function decoded(s) { - return decodeURIComponent(s.replace(/\+/g, ' ')); + IdentityType.getIdentityName = function (identityType) { + return getIdentityName(identityType); }; - var converted = function converted(s) { - if (s.indexOf('"') === 0) { - s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\'); - } - return s; + var ProductActionType = { + Unknown: 0, + AddToCart: 1, + RemoveFromCart: 2, + Checkout: 3, + CheckoutOption: 4, + Click: 5, + ViewDetail: 6, + Purchase: 7, + Refund: 8, + AddToWishlist: 9, + RemoveFromWishlist: 10 }; - var isString = function isString(value) { - return typeof value === 'string'; + ProductActionType.getName = function (id) { + switch (id) { + case ProductActionType.AddToCart: + return 'Add to Cart'; + case ProductActionType.RemoveFromCart: + return 'Remove from Cart'; + case ProductActionType.Checkout: + return 'Checkout'; + case ProductActionType.CheckoutOption: + return 'Checkout Option'; + case ProductActionType.Click: + return 'Click'; + case ProductActionType.ViewDetail: + return 'View Detail'; + case ProductActionType.Purchase: + return 'Purchase'; + case ProductActionType.Refund: + return 'Refund'; + case ProductActionType.AddToWishlist: + return 'Add to Wishlist'; + case ProductActionType.RemoveFromWishlist: + return 'Remove from Wishlist'; + default: + return 'Unknown'; + } }; - var isNumber = function isNumber(value) { - return typeof value === 'number'; + + // these are the action names used by server and mobile SDKs when expanding a CommerceEvent + ProductActionType.getExpansionName = function (id) { + switch (id) { + case ProductActionType.AddToCart: + return 'add_to_cart'; + case ProductActionType.RemoveFromCart: + return 'remove_from_cart'; + case ProductActionType.Checkout: + return 'checkout'; + case ProductActionType.CheckoutOption: + return 'checkout_option'; + case ProductActionType.Click: + return 'click'; + case ProductActionType.ViewDetail: + return 'view_detail'; + case ProductActionType.Purchase: + return 'purchase'; + case ProductActionType.Refund: + return 'refund'; + case ProductActionType.AddToWishlist: + return 'add_to_wishlist'; + case ProductActionType.RemoveFromWishlist: + return 'remove_from_wishlist'; + default: + return 'unknown'; + } }; - var isBoolean = function isBoolean(value) { - return typeof value === 'boolean'; + var PromotionActionType = { + Unknown: 0, + PromotionView: 1, + PromotionClick: 2 }; - var isFunction = function isFunction(fn) { - return typeof fn === 'function'; + PromotionActionType.getName = function (id) { + switch (id) { + case PromotionActionType.PromotionView: + return 'view'; + case PromotionActionType.PromotionClick: + return 'click'; + default: + return 'unknown'; + } }; - var isValidCustomFlagProperty = function isValidCustomFlagProperty(value) { - return isNumber(value) || isString(value) || isBoolean(value); + + // these are the names that the server and mobile SDKs use while expanding CommerceEvent + PromotionActionType.getExpansionName = function (id) { + switch (id) { + case PromotionActionType.PromotionView: + return 'view'; + case PromotionActionType.PromotionClick: + return 'click'; + default: + return 'unknown'; + } }; - var toDataPlanSlug = function toDataPlanSlug(value) { - // Make sure we are only acting on strings or numbers - return isStringOrNumber(value) ? value.toString().toLowerCase().replace(/[^0-9a-zA-Z]+/g, '_') : ''; + var ProfileMessageType = { + Logout: 3 }; - var isDataPlanSlug = function isDataPlanSlug(str) { - return str === toDataPlanSlug(str); + var ApplicationTransitionType$1 = { + AppInit: 1 }; - var isStringOrNumber = function isStringOrNumber(value) { - return isString(value) || isNumber(value); + var Environment = { + Production: 'production', + Development: 'development' }; - var isEmpty = function isEmpty(value) { - return value == null || !(Object.keys(value) || value).length; + var Types = { + MessageType: MessageType$1, + EventType: EventType, + CommerceEventType: CommerceEventType, + IdentityType: IdentityType, + ProfileMessageType: ProfileMessageType, + ApplicationTransitionType: ApplicationTransitionType$1, + ProductActionType: ProductActionType, + PromotionActionType: PromotionActionType, + TriggerUploadType: TriggerUploadType, + Environment: Environment }; + var SDKProductActionType; + (function (SDKProductActionType) { + SDKProductActionType[SDKProductActionType["Unknown"] = 0] = "Unknown"; + SDKProductActionType[SDKProductActionType["AddToCart"] = 1] = "AddToCart"; + SDKProductActionType[SDKProductActionType["RemoveFromCart"] = 2] = "RemoveFromCart"; + SDKProductActionType[SDKProductActionType["Checkout"] = 3] = "Checkout"; + SDKProductActionType[SDKProductActionType["CheckoutOption"] = 4] = "CheckoutOption"; + SDKProductActionType[SDKProductActionType["Click"] = 5] = "Click"; + SDKProductActionType[SDKProductActionType["ViewDetail"] = 6] = "ViewDetail"; + SDKProductActionType[SDKProductActionType["Purchase"] = 7] = "Purchase"; + SDKProductActionType[SDKProductActionType["Refund"] = 8] = "Refund"; + SDKProductActionType[SDKProductActionType["AddToWishlist"] = 9] = "AddToWishlist"; + SDKProductActionType[SDKProductActionType["RemoveFromWishlist"] = 10] = "RemoveFromWishlist"; + })(SDKProductActionType || (SDKProductActionType = {})); + var SDKIdentityTypeEnum; + (function (SDKIdentityTypeEnum) { + SDKIdentityTypeEnum["other"] = "other"; + SDKIdentityTypeEnum["customerId"] = "customerid"; + SDKIdentityTypeEnum["facebook"] = "facebook"; + SDKIdentityTypeEnum["twitter"] = "twitter"; + SDKIdentityTypeEnum["google"] = "google"; + SDKIdentityTypeEnum["microsoft"] = "microsoft"; + SDKIdentityTypeEnum["yahoo"] = "yahoo"; + SDKIdentityTypeEnum["email"] = "email"; + SDKIdentityTypeEnum["alias"] = "alias"; + SDKIdentityTypeEnum["facebookCustomAudienceId"] = "facebookcustomaudienceid"; + SDKIdentityTypeEnum["otherId2"] = "other2"; + SDKIdentityTypeEnum["otherId3"] = "other3"; + SDKIdentityTypeEnum["otherId4"] = "other4"; + SDKIdentityTypeEnum["otherId5"] = "other5"; + SDKIdentityTypeEnum["otherId6"] = "other6"; + SDKIdentityTypeEnum["otherId7"] = "other7"; + SDKIdentityTypeEnum["otherId8"] = "other8"; + SDKIdentityTypeEnum["otherId9"] = "other9"; + SDKIdentityTypeEnum["otherId10"] = "other10"; + SDKIdentityTypeEnum["mobileNumber"] = "mobile_number"; + SDKIdentityTypeEnum["phoneNumber2"] = "phone_number_2"; + SDKIdentityTypeEnum["phoneNumber3"] = "phone_number_3"; + })(SDKIdentityTypeEnum || (SDKIdentityTypeEnum = {})); + + var dist = {}; + + (function (exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + (function (ApplicationInformationOsEnum) { + ApplicationInformationOsEnum["unknown"] = "Unknown"; + ApplicationInformationOsEnum["iOS"] = "IOS"; + ApplicationInformationOsEnum["android"] = "Android"; + ApplicationInformationOsEnum["windowsPhone"] = "WindowsPhone"; + ApplicationInformationOsEnum["mobileWeb"] = "MobileWeb"; + ApplicationInformationOsEnum["unityIOS"] = "UnityIOS"; + ApplicationInformationOsEnum["unityAndroid"] = "UnityAndroid"; + ApplicationInformationOsEnum["desktop"] = "Desktop"; + ApplicationInformationOsEnum["tvOS"] = "TVOS"; + ApplicationInformationOsEnum["roku"] = "Roku"; + ApplicationInformationOsEnum["outOfBand"] = "OutOfBand"; + ApplicationInformationOsEnum["alexa"] = "Alexa"; + ApplicationInformationOsEnum["smartTV"] = "SmartTV"; + ApplicationInformationOsEnum["fireTV"] = "FireTV"; + ApplicationInformationOsEnum["xbox"] = "Xbox"; + })(exports.ApplicationInformationOsEnum || (exports.ApplicationInformationOsEnum = {})); + (function (ApplicationStateTransitionEventEventTypeEnum) { + ApplicationStateTransitionEventEventTypeEnum["applicationStateTransition"] = "application_state_transition"; + })(exports.ApplicationStateTransitionEventEventTypeEnum || (exports.ApplicationStateTransitionEventEventTypeEnum = {})); + (function (ApplicationStateTransitionEventDataApplicationTransitionTypeEnum) { + ApplicationStateTransitionEventDataApplicationTransitionTypeEnum["applicationInitialized"] = "application_initialized"; + ApplicationStateTransitionEventDataApplicationTransitionTypeEnum["applicationExit"] = "application_exit"; + ApplicationStateTransitionEventDataApplicationTransitionTypeEnum["applicationBackground"] = "application_background"; + ApplicationStateTransitionEventDataApplicationTransitionTypeEnum["applicationForeground"] = "application_foreground"; + })(exports.ApplicationStateTransitionEventDataApplicationTransitionTypeEnum || (exports.ApplicationStateTransitionEventDataApplicationTransitionTypeEnum = {})); + (function (BatchEnvironmentEnum) { + BatchEnvironmentEnum["unknown"] = "unknown"; + BatchEnvironmentEnum["development"] = "development"; + BatchEnvironmentEnum["production"] = "production"; + })(exports.BatchEnvironmentEnum || (exports.BatchEnvironmentEnum = {})); + (function (BreadcrumbEventEventTypeEnum) { + BreadcrumbEventEventTypeEnum["breadcrumb"] = "breadcrumb"; + })(exports.BreadcrumbEventEventTypeEnum || (exports.BreadcrumbEventEventTypeEnum = {})); + (function (CommerceEventEventTypeEnum) { + CommerceEventEventTypeEnum["commerceEvent"] = "commerce_event"; + })(exports.CommerceEventEventTypeEnum || (exports.CommerceEventEventTypeEnum = {})); + (function (CommerceEventDataCustomEventTypeEnum) { + CommerceEventDataCustomEventTypeEnum["addToCart"] = "add_to_cart"; + CommerceEventDataCustomEventTypeEnum["removeFromCart"] = "remove_from_cart"; + CommerceEventDataCustomEventTypeEnum["checkout"] = "checkout"; + CommerceEventDataCustomEventTypeEnum["checkoutOption"] = "checkout_option"; + CommerceEventDataCustomEventTypeEnum["click"] = "click"; + CommerceEventDataCustomEventTypeEnum["viewDetail"] = "view_detail"; + CommerceEventDataCustomEventTypeEnum["purchase"] = "purchase"; + CommerceEventDataCustomEventTypeEnum["refund"] = "refund"; + CommerceEventDataCustomEventTypeEnum["promotionView"] = "promotion_view"; + CommerceEventDataCustomEventTypeEnum["promotionClick"] = "promotion_click"; + CommerceEventDataCustomEventTypeEnum["addToWishlist"] = "add_to_wishlist"; + CommerceEventDataCustomEventTypeEnum["removeFromWishlist"] = "remove_from_wishlist"; + CommerceEventDataCustomEventTypeEnum["impression"] = "impression"; + })(exports.CommerceEventDataCustomEventTypeEnum || (exports.CommerceEventDataCustomEventTypeEnum = {})); + (function (CrashReportEventEventTypeEnum) { + CrashReportEventEventTypeEnum["crashReport"] = "crash_report"; + })(exports.CrashReportEventEventTypeEnum || (exports.CrashReportEventEventTypeEnum = {})); + (function (CustomEventEventTypeEnum) { + CustomEventEventTypeEnum["customEvent"] = "custom_event"; + })(exports.CustomEventEventTypeEnum || (exports.CustomEventEventTypeEnum = {})); + (function (CustomEventDataCustomEventTypeEnum) { + CustomEventDataCustomEventTypeEnum["navigation"] = "navigation"; + CustomEventDataCustomEventTypeEnum["location"] = "location"; + CustomEventDataCustomEventTypeEnum["search"] = "search"; + CustomEventDataCustomEventTypeEnum["transaction"] = "transaction"; + CustomEventDataCustomEventTypeEnum["userContent"] = "user_content"; + CustomEventDataCustomEventTypeEnum["userPreference"] = "user_preference"; + CustomEventDataCustomEventTypeEnum["social"] = "social"; + CustomEventDataCustomEventTypeEnum["media"] = "media"; + CustomEventDataCustomEventTypeEnum["other"] = "other"; + CustomEventDataCustomEventTypeEnum["unknown"] = "unknown"; + })(exports.CustomEventDataCustomEventTypeEnum || (exports.CustomEventDataCustomEventTypeEnum = {})); + (function (DeviceCurrentStateDeviceOrientationEnum) { + DeviceCurrentStateDeviceOrientationEnum["portrait"] = "portrait"; + DeviceCurrentStateDeviceOrientationEnum["portraitUpsideDown"] = "portrait_upside_down"; + DeviceCurrentStateDeviceOrientationEnum["landscape"] = "landscape"; + DeviceCurrentStateDeviceOrientationEnum["landscapeLeft"] = "LandscapeLeft"; + DeviceCurrentStateDeviceOrientationEnum["landscapeRight"] = "LandscapeRight"; + DeviceCurrentStateDeviceOrientationEnum["faceUp"] = "FaceUp"; + DeviceCurrentStateDeviceOrientationEnum["faceDown"] = "FaceDown"; + DeviceCurrentStateDeviceOrientationEnum["square"] = "Square"; + })(exports.DeviceCurrentStateDeviceOrientationEnum || (exports.DeviceCurrentStateDeviceOrientationEnum = {})); + (function (DeviceCurrentStateStatusBarOrientationEnum) { + DeviceCurrentStateStatusBarOrientationEnum["portrait"] = "portrait"; + DeviceCurrentStateStatusBarOrientationEnum["portraitUpsideDown"] = "portrait_upside_down"; + DeviceCurrentStateStatusBarOrientationEnum["landscape"] = "landscape"; + DeviceCurrentStateStatusBarOrientationEnum["landscapeLeft"] = "LandscapeLeft"; + DeviceCurrentStateStatusBarOrientationEnum["landscapeRight"] = "LandscapeRight"; + DeviceCurrentStateStatusBarOrientationEnum["faceUp"] = "FaceUp"; + DeviceCurrentStateStatusBarOrientationEnum["faceDown"] = "FaceDown"; + DeviceCurrentStateStatusBarOrientationEnum["square"] = "Square"; + })(exports.DeviceCurrentStateStatusBarOrientationEnum || (exports.DeviceCurrentStateStatusBarOrientationEnum = {})); + (function (DeviceInformationPlatformEnum) { + DeviceInformationPlatformEnum["iOS"] = "iOS"; + DeviceInformationPlatformEnum["android"] = "Android"; + DeviceInformationPlatformEnum["web"] = "web"; + DeviceInformationPlatformEnum["desktop"] = "desktop"; + DeviceInformationPlatformEnum["tvOS"] = "tvOS"; + DeviceInformationPlatformEnum["roku"] = "roku"; + DeviceInformationPlatformEnum["outOfBand"] = "out_of_band"; + DeviceInformationPlatformEnum["smartTV"] = "smart_tv"; + DeviceInformationPlatformEnum["xbox"] = "xbox"; + })(exports.DeviceInformationPlatformEnum || (exports.DeviceInformationPlatformEnum = {})); + (function (EventTypeEnum) { + EventTypeEnum["unknown"] = "unknown"; + EventTypeEnum["sessionStart"] = "session_start"; + EventTypeEnum["sessionEnd"] = "session_end"; + EventTypeEnum["screenView"] = "screen_view"; + EventTypeEnum["customEvent"] = "custom_event"; + EventTypeEnum["crashReport"] = "crash_report"; + EventTypeEnum["optOut"] = "opt_out"; + EventTypeEnum["firstRun"] = "first_run"; + EventTypeEnum["preAttribution"] = "pre_attribution"; + EventTypeEnum["pushRegistration"] = "push_registration"; + EventTypeEnum["applicationStateTransition"] = "application_state_transition"; + EventTypeEnum["pushMessage"] = "push_message"; + EventTypeEnum["networkPerformance"] = "network_performance"; + EventTypeEnum["breadcrumb"] = "breadcrumb"; + EventTypeEnum["profile"] = "profile"; + EventTypeEnum["pushReaction"] = "push_reaction"; + EventTypeEnum["commerceEvent"] = "commerce_event"; + EventTypeEnum["userAttributeChange"] = "user_attribute_change"; + EventTypeEnum["userIdentityChange"] = "user_identity_change"; + EventTypeEnum["uninstall"] = "uninstall"; + EventTypeEnum["validationResult"] = "validation_result"; + })(exports.EventTypeEnum || (exports.EventTypeEnum = {})); + (function (IdentityTypeEnum) { + IdentityTypeEnum["other"] = "other"; + IdentityTypeEnum["customerId"] = "customer_id"; + IdentityTypeEnum["facebook"] = "facebook"; + IdentityTypeEnum["twitter"] = "twitter"; + IdentityTypeEnum["google"] = "google"; + IdentityTypeEnum["microsoft"] = "microsoft"; + IdentityTypeEnum["yahoo"] = "yahoo"; + IdentityTypeEnum["email"] = "email"; + IdentityTypeEnum["alias"] = "alias"; + IdentityTypeEnum["facebookCustomAudienceId"] = "facebook_custom_audience_id"; + IdentityTypeEnum["otherId2"] = "other_id_2"; + IdentityTypeEnum["otherId3"] = "other_id_3"; + IdentityTypeEnum["otherId4"] = "other_id_4"; + IdentityTypeEnum["otherId5"] = "other_id_5"; + IdentityTypeEnum["otherId6"] = "other_id_6"; + IdentityTypeEnum["otherId7"] = "other_id_7"; + IdentityTypeEnum["otherId8"] = "other_id_8"; + IdentityTypeEnum["otherId9"] = "other_id_9"; + IdentityTypeEnum["otherId10"] = "other_id_10"; + IdentityTypeEnum["mobileNumber"] = "mobile_number"; + IdentityTypeEnum["phoneNumber2"] = "phone_number_2"; + IdentityTypeEnum["phoneNumber3"] = "phone_number_3"; + })(exports.IdentityTypeEnum || (exports.IdentityTypeEnum = {})); + (function (NetworkPerformanceEventEventTypeEnum) { + NetworkPerformanceEventEventTypeEnum["networkPerformance"] = "network_performance"; + })(exports.NetworkPerformanceEventEventTypeEnum || (exports.NetworkPerformanceEventEventTypeEnum = {})); + (function (OptOutEventEnum) { + OptOutEventEnum["optOut"] = "opt_out"; + })(exports.OptOutEventEnum || (exports.OptOutEventEnum = {})); + (function (ProductActionActionEnum) { + ProductActionActionEnum["unknown"] = "unknown"; + ProductActionActionEnum["addToCart"] = "add_to_cart"; + ProductActionActionEnum["removeFromCart"] = "remove_from_cart"; + ProductActionActionEnum["checkout"] = "checkout"; + ProductActionActionEnum["checkoutOption"] = "checkout_option"; + ProductActionActionEnum["click"] = "click"; + ProductActionActionEnum["viewDetail"] = "view_detail"; + ProductActionActionEnum["purchase"] = "purchase"; + ProductActionActionEnum["refund"] = "refund"; + ProductActionActionEnum["addToWishlist"] = "add_to_wishlist"; + ProductActionActionEnum["removeFromWishlist"] = "remove_from_wish_list"; + })(exports.ProductActionActionEnum || (exports.ProductActionActionEnum = {})); + (function (ProfileEventEventTypeEnum) { + ProfileEventEventTypeEnum["profile"] = "profile"; + })(exports.ProfileEventEventTypeEnum || (exports.ProfileEventEventTypeEnum = {})); + (function (ProfileEventDataProfileEventTypeEnum) { + ProfileEventDataProfileEventTypeEnum["signup"] = "signup"; + ProfileEventDataProfileEventTypeEnum["login"] = "login"; + ProfileEventDataProfileEventTypeEnum["logout"] = "logout"; + ProfileEventDataProfileEventTypeEnum["update"] = "update"; + ProfileEventDataProfileEventTypeEnum["delete"] = "delete"; + })(exports.ProfileEventDataProfileEventTypeEnum || (exports.ProfileEventDataProfileEventTypeEnum = {})); + (function (PromotionActionActionEnum) { + PromotionActionActionEnum["view"] = "view"; + PromotionActionActionEnum["click"] = "click"; + })(exports.PromotionActionActionEnum || (exports.PromotionActionActionEnum = {})); + (function (PushMessageEventEventTypeEnum) { + PushMessageEventEventTypeEnum["pushMessage"] = "push_message"; + })(exports.PushMessageEventEventTypeEnum || (exports.PushMessageEventEventTypeEnum = {})); + (function (PushMessageEventDataPushMessageTypeEnum) { + PushMessageEventDataPushMessageTypeEnum["sent"] = "sent"; + PushMessageEventDataPushMessageTypeEnum["received"] = "received"; + PushMessageEventDataPushMessageTypeEnum["action"] = "action"; + })(exports.PushMessageEventDataPushMessageTypeEnum || (exports.PushMessageEventDataPushMessageTypeEnum = {})); + (function (PushMessageEventDataApplicationStateEnum) { + PushMessageEventDataApplicationStateEnum["notRunning"] = "not_running"; + PushMessageEventDataApplicationStateEnum["background"] = "background"; + PushMessageEventDataApplicationStateEnum["foreground"] = "foreground"; + })(exports.PushMessageEventDataApplicationStateEnum || (exports.PushMessageEventDataApplicationStateEnum = {})); + (function (PushMessageEventDataPushMessageBehaviorEnum) { + PushMessageEventDataPushMessageBehaviorEnum["received"] = "Received"; + PushMessageEventDataPushMessageBehaviorEnum["directOpen"] = "DirectOpen"; + PushMessageEventDataPushMessageBehaviorEnum["read"] = "Read"; + PushMessageEventDataPushMessageBehaviorEnum["influencedOpen"] = "InfluencedOpen"; + PushMessageEventDataPushMessageBehaviorEnum["displayed"] = "Displayed"; + })(exports.PushMessageEventDataPushMessageBehaviorEnum || (exports.PushMessageEventDataPushMessageBehaviorEnum = {})); + (function (PushRegistrationEventEventTypeEnum) { + PushRegistrationEventEventTypeEnum["pushRegistration"] = "push_registration"; + })(exports.PushRegistrationEventEventTypeEnum || (exports.PushRegistrationEventEventTypeEnum = {})); + (function (SessionEndEventEventTypeEnum) { + SessionEndEventEventTypeEnum["sessionEnd"] = "session_end"; + })(exports.SessionEndEventEventTypeEnum || (exports.SessionEndEventEventTypeEnum = {})); + (function (SessionStartEventEventTypeEnum) { + SessionStartEventEventTypeEnum["sessionStart"] = "session_start"; + })(exports.SessionStartEventEventTypeEnum || (exports.SessionStartEventEventTypeEnum = {})); + (function (SourceInformationChannelEnum) { + SourceInformationChannelEnum["native"] = "native"; + SourceInformationChannelEnum["javascript"] = "javascript"; + SourceInformationChannelEnum["pixel"] = "pixel"; + SourceInformationChannelEnum["desktop"] = "desktop"; + SourceInformationChannelEnum["partner"] = "partner"; + SourceInformationChannelEnum["serverToServer"] = "server_to_server"; + })(exports.SourceInformationChannelEnum || (exports.SourceInformationChannelEnum = {})); + (function (UserAttributeChangeEventEventTypeEnum) { + UserAttributeChangeEventEventTypeEnum["userAttributeChange"] = "user_attribute_change"; + })(exports.UserAttributeChangeEventEventTypeEnum || (exports.UserAttributeChangeEventEventTypeEnum = {})); + (function (UserIdentityChangeEventEventTypeEnum) { + UserIdentityChangeEventEventTypeEnum["userIdentityChange"] = "user_identity_change"; + })(exports.UserIdentityChangeEventEventTypeEnum || (exports.UserIdentityChangeEventEventTypeEnum = {})); + } (dist)); + function convertEvents(mpid, sdkEvents, mpInstance) { if (!mpid) { return null; @@ -4012,6 +4083,16 @@ var mParticle = (function () { _this.persistenceData.gs.das = deviceId; mpInstance._Persistence.update(); }; + this.addMpidToSessionHistory = function (mpid, previousMPID) { + var indexOfMPID = _this.currentSessionMPIDs.indexOf(mpid); + if (mpid && previousMPID !== mpid && indexOfMPID < 0) { + _this.currentSessionMPIDs.push(mpid); + return; + } + if (indexOfMPID >= 0) { + _this.currentSessionMPIDs = moveElementToEnd(_this.currentSessionMPIDs, indexOfMPID); + } + }; this.getFirstSeenTime = function (mpid) { if (!mpid) { return null; @@ -4949,6 +5030,16 @@ var mParticle = (function () { } } }; + this.swapCurrentUser = function (previousMPID, currentMPID, currentSessionMPIDs) { + if (previousMPID && currentMPID && previousMPID !== currentMPID) { + var persistence = self.getPersistence(); + if (persistence) { + persistence.cu = currentMPID; + persistence.gs.csm = currentSessionMPIDs; + self.savePersistence(persistence); + } + } + }; // https://go.mparticle.com/work/SQDSDKS-6021 this.savePersistence = function (persistence) { @@ -5004,6 +5095,7 @@ var mParticle = (function () { if (!mpid) { return; } + // https://go.mparticle.com/work/SQDSDKS-6329 if (!time) { time = new Date().getTime(); } @@ -5043,6 +5135,7 @@ var mParticle = (function () { if (!mpid) { return; } + // https://go.mparticle.com/work/SQDSDKS-6329 if (!time) { time = new Date().getTime(); } @@ -5416,11 +5509,11 @@ var mParticle = (function () { }; } - var _Constants$IdentityMe$1 = Constants.IdentityMethods, - Modify$3 = _Constants$IdentityMe$1.Modify, - Identify$2 = _Constants$IdentityMe$1.Identify, - Login$2 = _Constants$IdentityMe$1.Login, - Logout$2 = _Constants$IdentityMe$1.Logout; + var _Constants$IdentityMe = Constants.IdentityMethods, + Modify$3 = _Constants$IdentityMe.Modify, + Identify$2 = _Constants$IdentityMe.Identify, + Login$2 = _Constants$IdentityMe.Login, + Logout$2 = _Constants$IdentityMe.Logout; function Forwarders(mpInstance, kitBlocker) { var self = this; var UserAttributeActionTypes = { @@ -5894,7 +5987,7 @@ var mParticle = (function () { } // TODO: This file is no longer the server model because the web SDK payload - var MessageType$1 = Types.MessageType; + var MessageType = Types.MessageType; var ApplicationTransitionType = Types.ApplicationTransitionType; // TODO: Make this a pure function that returns a new object function convertCustomFlags(event, dto) { @@ -6077,7 +6170,7 @@ var mParticle = (function () { CurrencyCode: mpInstance._Store.currencyCode, DataPlan: mpInstance._Store.SDKConfig.dataPlan ? mpInstance._Store.SDKConfig.dataPlan : {} }; - if (eventObject.EventDataType === MessageType$1.AppStateTransition) { + if (eventObject.EventDataType === MessageType.AppStateTransition) { eventObject.IsFirstRun = mpInstance._Store.isFirstRun; eventObject.LaunchReferral = window.location.href || null; } @@ -6137,7 +6230,7 @@ var mParticle = (function () { if (consent) { dto.con = consent; } - if (event.EventDataType === MessageType$1.AppStateTransition) { + if (event.EventDataType === MessageType.AppStateTransition) { dto.fr = event.IsFirstRun; dto.iu = false; dto.at = ApplicationTransitionType.AppInit; @@ -6149,7 +6242,7 @@ var mParticle = (function () { if (event.CustomFlags) { convertCustomFlags(event, dto); } - if (event.EventDataType === MessageType$1.Commerce) { + if (event.EventDataType === MessageType.Commerce) { dto.cu = event.CurrencyCode; // TODO: If Cart is deprecated, we should deprecate this too if (event.ShoppingCart) { @@ -6190,7 +6283,7 @@ var mParticle = (function () { }; }); } - } else if (event.EventDataType === MessageType$1.Profile) { + } else if (event.EventDataType === MessageType.Profile) { dto.pet = event.ProfileMessageType; } return dto; @@ -6449,29 +6542,29 @@ var mParticle = (function () { return AudienceManager; }(); + function didUserChange(previousUser, newUser) { + return !previousUser || newUser.getMPID() !== previousUser.getMPID() || previousUser.isLoggedIn() !== newUser.isLoggedIn(); + } + var Messages$2 = Constants.Messages, HTTPCodes$2 = Constants.HTTPCodes, - FeatureFlags$1 = Constants.FeatureFlags; + FeatureFlags$1 = Constants.FeatureFlags, + IdentityMethods = Constants.IdentityMethods; var ErrorMessages = Messages$2.ErrorMessages; - var _Constants$IdentityMe = Constants.IdentityMethods, - Identify = _Constants$IdentityMe.Identify, - Modify$1 = _Constants$IdentityMe.Modify, - Login = _Constants$IdentityMe.Login, - Logout = _Constants$IdentityMe.Logout; + var CacheIdentity = FeatureFlags$1.CacheIdentity; + var Identify = IdentityMethods.Identify, + Modify$1 = IdentityMethods.Modify, + Login = IdentityMethods.Login, + Logout = IdentityMethods.Logout; function Identity(mpInstance) { + var _mpInstance$_Helpers = mpInstance._Helpers, + getFeatureFlag = _mpInstance$_Helpers.getFeatureFlag, + extend = _mpInstance$_Helpers.extend; var self = this; this.idCache = null; this.audienceManager = null; - this.checkIdentitySwap = function (previousMPID, currentMPID, currentSessionMPIDs) { - if (previousMPID && currentMPID && previousMPID !== currentMPID) { - var persistence = mpInstance._Persistence.getPersistence(); - if (persistence) { - persistence.cu = currentMPID; - persistence.gs.csm = currentSessionMPIDs; - mpInstance._Persistence.savePersistence(persistence); - } - } - }; + + // https://go.mparticle.com/work/SQDSDKS-6353 this.IdentityRequest = { preProcessIdentityRequest: function preProcessIdentityRequest(identityApiData, callback, method) { mpInstance.Logger.verbose(Messages$2.InformationMessages.StartingLogEvent + ': ' + method); @@ -6528,7 +6621,7 @@ var mParticle = (function () { createIdentityChanges: function createIdentityChanges(previousIdentities, newIdentities) { var identityChanges = []; var key; - if (newIdentities && mpInstance._Helpers.isObject(newIdentities) && previousIdentities && mpInstance._Helpers.isObject(previousIdentities)) { + if (newIdentities && isObject(newIdentities) && previousIdentities && isObject(previousIdentities)) { for (key in newIdentities) { identityChanges.push({ old_value: previousIdentities[key] || null, @@ -6542,7 +6635,7 @@ var mParticle = (function () { // takes 2 UI objects keyed by name, combines them, returns them keyed by type combineUserIdentities: function combineUserIdentities(previousUIByName, newUIByName) { var combinedUIByType = {}; - var combinedUIByName = mpInstance._Helpers.extend(previousUIByName, newUIByName); + var combinedUIByName = extend({}, previousUIByName, newUIByName); for (var key in combinedUIByName) { var type = Types.IdentityType.getIdentityType(key); // this check removes anything that is not whitelisted as an identity type @@ -6607,6 +6700,7 @@ var mParticle = (function () { * @param {Function} [callback] A callback function that is called when the identify request completes */ identify: function identify(identityApiData, callback) { + // https://go.mparticle.com/work/SQDSDKS-6337 var mpid, currentUser = mpInstance.Identity.getCurrentUser(), preProcessResult = mpInstance._Identity.IdentityRequest.preProcessIdentityRequest(identityApiData, callback, Identify); @@ -6644,6 +6738,7 @@ var mParticle = (function () { * @param {Function} [callback] A callback function that is called when the logout request completes */ logout: function logout(identityApiData, callback) { + // https://go.mparticle.com/work/SQDSDKS-6337 var mpid, currentUser = mpInstance.Identity.getCurrentUser(), preProcessResult = mpInstance._Identity.IdentityRequest.preProcessIdentityRequest(identityApiData, callback, Logout); @@ -6687,6 +6782,7 @@ var mParticle = (function () { * @param {Function} [callback] A callback function that is called when the login request completes */ login: function login(identityApiData, callback) { + // https://go.mparticle.com/work/SQDSDKS-6337 var mpid, currentUser = mpInstance.Identity.getCurrentUser(), preProcessResult = mpInstance._Identity.IdentityRequest.preProcessIdentityRequest(identityApiData, callback, Login); @@ -6724,6 +6820,7 @@ var mParticle = (function () { * @param {Function} [callback] A callback function that is called when the modify request completes */ modify: function modify(identityApiData, callback) { + // https://go.mparticle.com/work/SQDSDKS-6337 var mpid, currentUser = mpInstance.Identity.getCurrentUser(), preProcessResult = mpInstance._Identity.IdentityRequest.preProcessIdentityRequest(identityApiData, callback, Modify$1); @@ -6905,6 +7002,7 @@ var mParticle = (function () { } }; + // https://go.mparticle.com/work/SQDSDKS-6354 /** * Invoke these methods on the mParticle.Identity.getCurrentUser() object. * Example: mParticle.Identity.getCurrentUser().getAllUserAttributes() @@ -7014,7 +7112,7 @@ var mParticle = (function () { */ setUserAttributes: function setUserAttributes(userAttributes) { mpInstance._SessionManager.resetSessionTimer(); - if (mpInstance._Helpers.isObject(userAttributes)) { + if (isObject(userAttributes)) { if (mpInstance._Helpers.canLog()) { for (var key in userAttributes) { if (userAttributes.hasOwnProperty(key)) { @@ -7354,64 +7452,51 @@ var mParticle = (function () { } }; }; + + // https://go.mparticle.com/work/SQDSDKS-6355 this.parseIdentityResponse = function (xhr, previousMPID, callback, identityApiData, method, knownIdentities, parsingCachedResponse) { - var prevUser = mpInstance.Identity.getUser(previousMPID), - newUser, - mpidIsNotInCookies, - identityApiResult, - indexOfMPID, - newIdentitiesByType = {}, - previousUIByName = prevUser ? prevUser.getUserIdentities().userIdentities : {}, - previousUIByNameCopy = mpInstance._Helpers.extend({}, previousUIByName); + var prevUser = mpInstance.Identity.getUser(previousMPID); + var prevUserMPID = prevUser ? prevUser.getMPID() : null; + var previousUIByName = prevUser ? prevUser.getUserIdentities().userIdentities : {}; + var identityApiResult; + var newUser; + var newIdentitiesByType = {}; mpInstance._Store.identityCallInFlight = false; try { + var _identityApiResult; mpInstance.Logger.verbose('Parsing "' + method + '" identity response from server'); - if (xhr.responseText) { - identityApiResult = JSON.parse(xhr.responseText); - if (identityApiResult.hasOwnProperty('is_logged_in')) { - mpInstance._Store.isLoggedIn = identityApiResult.is_logged_in; - } + identityApiResult = xhr.responseText ? JSON.parse(xhr.responseText) : null; + mpInstance._Store.isLoggedIn = ((_identityApiResult = identityApiResult) === null || _identityApiResult === void 0 ? void 0 : _identityApiResult.is_logged_in) || false; + mpInstance._Store.mpid = identityApiResult.mpid; + if (prevUser) { + // https://go.mparticle.com/work/SQDSDKS-6329 + mpInstance._Persistence.setLastSeenTime(previousMPID); } + var mpidIsNotInCookies = !mpInstance._Persistence.getFirstSeenTime(identityApiResult.mpid); - // set currentUser - if (!prevUser || prevUser.getMPID() && identityApiResult.mpid && identityApiResult.mpid !== prevUser.getMPID()) { - mpInstance._Store.mpid = identityApiResult.mpid; - if (prevUser) { - mpInstance._Persistence.setLastSeenTime(previousMPID); - } - if (!mpInstance._Persistence.getFirstSeenTime(identityApiResult.mpid)) mpidIsNotInCookies = true; - mpInstance._Persistence.setFirstSeenTime(identityApiResult.mpid); - } + // https://go.mparticle.com/work/SQDSDKS-6329 + mpInstance._Persistence.setFirstSeenTime(identityApiResult.mpid); if (xhr.status === 200) { - if (mpInstance._Helpers.getFeatureFlag(Constants.FeatureFlags.CacheIdentity)) { + if (getFeatureFlag(CacheIdentity)) { cacheOrClearIdCache(method, knownIdentities, self.idCache, xhr, parsingCachedResponse); } + var incomingUser = self.IdentityAPI.getUser(identityApiResult.mpid); + var incomingMpidUIByName = incomingUser ? incomingUser.getUserIdentities().userIdentities : {}; if (method === Modify$1) { newIdentitiesByType = mpInstance._Identity.IdentityRequest.combineUserIdentities(previousUIByName, identityApiData.userIdentities); mpInstance._Persistence.saveUserIdentitiesToPersistence(previousMPID, newIdentitiesByType); } else { - var incomingUser = self.IdentityAPI.getUser(identityApiResult.mpid); - var incomingMpidUIByName = incomingUser ? incomingUser.getUserIdentities().userIdentities : {}; - var incomingMpidUIByNameCopy = mpInstance._Helpers.extend({}, incomingMpidUIByName); - mpInstance.Logger.verbose('Successfully parsed Identity Response'); - + // https://go.mparticle.com/work/SQDSDKS-6356 //this covers an edge case where, users stored before "firstSeenTime" was introduced //will not have a value for "fst" until the current MPID changes, and in some cases, //the current MPID will never change - if (method === Identify && prevUser && identityApiResult.mpid === prevUser.getMPID()) { + if (method === Identify && prevUser && identityApiResult.mpid === prevUserMPID) { mpInstance._Persistence.setFirstSeenTime(identityApiResult.mpid); } - indexOfMPID = mpInstance._Store.currentSessionMPIDs.indexOf(identityApiResult.mpid); - if (mpInstance._Store.sessionId && identityApiResult.mpid && previousMPID !== identityApiResult.mpid && indexOfMPID < 0) { - mpInstance._Store.currentSessionMPIDs.push(identityApiResult.mpid); - } - if (indexOfMPID > -1) { - mpInstance._Store.currentSessionMPIDs = mpInstance._Store.currentSessionMPIDs.slice(0, indexOfMPID).concat(mpInstance._Store.currentSessionMPIDs.slice(indexOfMPID + 1, mpInstance._Store.currentSessionMPIDs.length)); - mpInstance._Store.currentSessionMPIDs.push(identityApiResult.mpid); - } + mpInstance._Store.addMpidToSessionHistory(identityApiResult.mpid, previousMPID); mpInstance._CookieSyncManager.attemptCookieSync(previousMPID, identityApiResult.mpid, mpidIsNotInCookies); - self.checkIdentitySwap(previousMPID, identityApiResult.mpid, mpInstance._Store.currentSessionMPIDs); - if (identityApiData && identityApiData.userIdentities && Object.keys(identityApiData.userIdentities).length) { + mpInstance._Persistence.swapCurrentUser(previousMPID, identityApiResult.mpid, mpInstance._Store.currentSessionMPIDs); + if (identityApiData && !isEmpty(identityApiData.userIdentities)) { newIdentitiesByType = self.IdentityRequest.combineUserIdentities(incomingMpidUIByName, identityApiData.userIdentities); } @@ -7419,46 +7504,31 @@ var mParticle = (function () { mpInstance._Persistence.saveUserIdentitiesToPersistence(identityApiResult.mpid, newIdentitiesByType); mpInstance._Persistence.update(); mpInstance._Persistence.findPrevCookiesBasedOnUI(identityApiData); + + // https://go.mparticle.com/work/SQDSDKS-6357 mpInstance._Store.context = identityApiResult.context || mpInstance._Store.context; } newUser = mpInstance.Identity.getCurrentUser(); - if (identityApiData && identityApiData.onUserAlias && mpInstance._Helpers.Validators.isFunction(identityApiData.onUserAlias)) { - try { - mpInstance.Logger.warning('Deprecated function onUserAlias will be removed in future releases'); - identityApiData.onUserAlias(prevUser, newUser); - } catch (e) { - mpInstance.Logger.error('There was an error with your onUserAlias function - ' + e); - } - } + + // https://go.mparticle.com/work/SQDSDKS-6359 + tryOnUserAlias(prevUser, newUser, identityApiData, mpInstance.Logger); var persistence = mpInstance._Persistence.getPersistence(); if (newUser) { mpInstance._Persistence.storeDataInMemory(persistence, newUser.getMPID()); - if (!prevUser || newUser.getMPID() !== prevUser.getMPID() || prevUser.isLoggedIn() !== newUser.isLoggedIn()) { - mpInstance._Forwarders.initForwarders(newUser.getUserIdentities().userIdentities, mpInstance._APIClient.prepareForwardingStats); - } - - // TODO: https://go.mparticle.com/work/SQDSDKS-6036 - mpInstance._Forwarders.setForwarderUserIdentities(newUser.getUserIdentities().userIdentities); - mpInstance._Forwarders.setForwarderOnIdentityComplete(newUser, method); - mpInstance._Forwarders.setForwarderOnUserIdentified(newUser); + self.reinitForwardersOnUserChange(prevUser, newUser); + self.setForwarderCallbacks(newUser, method); } - var newIdentitiesByName = {}; - for (var key in newIdentitiesByType) { - newIdentitiesByName[Types.IdentityType.getIdentityName(mpInstance._Helpers.parseNumber(key))] = newIdentitiesByType[key]; - } - self.sendUserIdentityChangeEvent(newIdentitiesByName, method, identityApiResult.mpid, method === Modify$1 ? previousUIByNameCopy : incomingMpidUIByNameCopy); + var newIdentitiesByName = getNewIdentitiesByName(newIdentitiesByType); + var uiByName = method === Modify$1 ? previousUIByName : incomingMpidUIByName; + self.sendUserIdentityChangeEvent(newIdentitiesByName, identityApiResult.mpid, uiByName); } if (callback) { - if (xhr.status === 0) { - mpInstance._Helpers.invokeCallback(callback, HTTPCodes$2.noHttpCoverage, identityApiResult || null, newUser); - } else { - mpInstance._Helpers.invokeCallback(callback, xhr.status, identityApiResult || null, newUser); - } - } else { - if (identityApiResult && identityApiResult.errors && identityApiResult.errors.length) { - mpInstance.Logger.error('Received HTTP response code of ' + xhr.status + ' - ' + identityApiResult.errors[0].message); - } + var callbackCode = xhr.status === 0 ? HTTPCodes$2.noHttpCoverage : xhr.status; + mpInstance._Helpers.invokeCallback(callback, callbackCode, identityApiResult || null, newUser); + } else if (identityApiResult && !isEmpty(identityApiResult.errors)) { + mpInstance.Logger.error('Received HTTP response code of ' + xhr.status + ' - ' + identityApiResult.errors[0].message); } + mpInstance.Logger.verbose('Successfully parsed Identity Response'); mpInstance._APIClient.processQueuedEvents(); } catch (e) { if (callback) { @@ -7472,23 +7542,22 @@ var mParticle = (function () { // compare what identities exist vs what is previously was for the specific user if they were in memory before. // if it's the first time the user is logging in, send a user identity change request with - this.sendUserIdentityChangeEvent = function (newUserIdentities, method, mpid, prevUserIdentities) { - var currentUserInMemory, userIdentityChangeEvent; - if (!mpid) { - if (method !== Modify$1) { - return; - } - } - currentUserInMemory = this.IdentityAPI.getUser(mpid); + this.sendUserIdentityChangeEvent = function (newUserIdentities, mpid, currentUserIdentities) { + // https://go.mparticle.com/work/SQDSDKS-6354 + var currentUserInMemory = this.IdentityAPI.getUser(mpid); for (var identityType in newUserIdentities) { - if (prevUserIdentities[identityType] !== newUserIdentities[identityType]) { - var isNewUserIdentityType = !prevUserIdentities[identityType]; - userIdentityChangeEvent = self.createUserIdentityChange(identityType, newUserIdentities[identityType], prevUserIdentities[identityType], isNewUserIdentityType, currentUserInMemory); + // Verifies a change actually happened + if (currentUserIdentities[identityType] !== newUserIdentities[identityType]) { + // If a new identity type was introduced when the identity changes + // we need to notify the server so that it will associate the new + // identity type with subsequent events + var isNewUserIdentityType = !currentUserIdentities[identityType]; + var userIdentityChangeEvent = self.createUserIdentityChange(identityType, newUserIdentities[identityType], currentUserIdentities[identityType], isNewUserIdentityType, currentUserInMemory); mpInstance._APIClient.sendEventToServer(userIdentityChangeEvent); } } }; - this.createUserIdentityChange = function (identityType, newIdentity, oldIdentity, newCreatedThisBatch, userInMemory) { + this.createUserIdentityChange = function (identityType, newIdentity, oldIdentity, isIdentityTypeNewToBatch, userInMemory) { var userIdentityChangeEvent; userIdentityChangeEvent = mpInstance._ServerModel.createEventObject({ messageType: Types.MessageType.UserIdentityChange, @@ -7496,7 +7565,7 @@ var mParticle = (function () { New: { IdentityType: identityType, Identity: newIdentity, - CreatedThisBatch: newCreatedThisBatch + CreatedThisBatch: isIdentityTypeNewToBatch }, Old: { IdentityType: identityType, @@ -7533,6 +7602,29 @@ var mParticle = (function () { } return userAttributeChangeEvent; }; + this.reinitForwardersOnUserChange = function (prevUser, newUser) { + if (didUserChange(prevUser, newUser)) { + mpInstance._Forwarders.initForwarders(newUser.getUserIdentities().userIdentities, mpInstance._APIClient.prepareForwardingStats); + } + }; + this.setForwarderCallbacks = function (user, method) { + // https://go.mparticle.com/work/SQDSDKS-6036 + mpInstance._Forwarders.setForwarderUserIdentities(user.getUserIdentities().userIdentities); + mpInstance._Forwarders.setForwarderOnIdentityComplete(user, method); + mpInstance._Forwarders.setForwarderOnUserIdentified(user); + }; + } + + // https://go.mparticle.com/work/SQDSDKS-6359 + function tryOnUserAlias(previousUser, newUser, identityApiData, logger) { + if (identityApiData && identityApiData.onUserAlias && isFunction(identityApiData.onUserAlias)) { + try { + logger.warning(generateDeprecationMessage('onUserAlias')); + identityApiData.onUserAlias(previousUser, newUser); + } catch (e) { + logger.error('There was an error with your onUserAlias function - ' + e); + } + } } var CCPAPurpose = Constants.CCPAPurpose; @@ -8339,6 +8431,7 @@ var mParticle = (function () { var xhr, xhrCallback = function xhrCallback() { if (xhr.readyState === 4) { + // https://go.mparticle.com/work/SQDSDKS-6368 mpInstance.Logger.verbose('Received ' + xhr.statusText + ' from server'); //only parse error messages from failing requests if (xhr.status !== 200 && xhr.status !== 202) { @@ -8371,6 +8464,7 @@ var mParticle = (function () { previousMPID, xhrCallback = function xhrCallback() { if (xhr.readyState === 4) { + // https://go.mparticle.com/work/SQDSDKS-6368 mpInstance.Logger.verbose('Received ' + xhr.statusText + ' from server'); parseIdentityResponse(xhr, previousMPID, callback, originalIdentityApiData, method, knownIdentities, false); } @@ -9684,60 +9778,6 @@ var mParticle = (function () { return _BatchValidator; }(); - var EventTypeEnum; - (function (EventTypeEnum) { - EventTypeEnum[EventTypeEnum["Unknown"] = 0] = "Unknown"; - EventTypeEnum[EventTypeEnum["Navigation"] = 1] = "Navigation"; - EventTypeEnum[EventTypeEnum["Location"] = 2] = "Location"; - EventTypeEnum[EventTypeEnum["Search"] = 3] = "Search"; - EventTypeEnum[EventTypeEnum["Transaction"] = 4] = "Transaction"; - EventTypeEnum[EventTypeEnum["UserContent"] = 5] = "UserContent"; - EventTypeEnum[EventTypeEnum["UserPreference"] = 6] = "UserPreference"; - EventTypeEnum[EventTypeEnum["Social"] = 7] = "Social"; - EventTypeEnum[EventTypeEnum["Other"] = 8] = "Other"; - EventTypeEnum[EventTypeEnum["Media"] = 9] = "Media"; - })(EventTypeEnum || (EventTypeEnum = {})); - // TODO: https://mparticle-eng.atlassian.net/browse/SQDSDKS-5403 - var MessageType; - (function (MessageType) { - MessageType[MessageType["SessionStart"] = 1] = "SessionStart"; - MessageType[MessageType["SessionEnd"] = 2] = "SessionEnd"; - MessageType[MessageType["PageView"] = 3] = "PageView"; - MessageType[MessageType["PageEvent"] = 4] = "PageEvent"; - MessageType[MessageType["CrashReport"] = 5] = "CrashReport"; - MessageType[MessageType["OptOut"] = 6] = "OptOut"; - MessageType[MessageType["AppStateTransition"] = 10] = "AppStateTransition"; - MessageType[MessageType["Profile"] = 14] = "Profile"; - MessageType[MessageType["Commerce"] = 16] = "Commerce"; - MessageType[MessageType["UserAttributeChange"] = 17] = "UserAttributeChange"; - MessageType[MessageType["UserIdentityChange"] = 18] = "UserIdentityChange"; - MessageType[MessageType["Media"] = 20] = "Media"; - })(MessageType || (MessageType = {})); - var IdentityType; - (function (IdentityType) { - IdentityType[IdentityType["Other"] = 0] = "Other"; - IdentityType[IdentityType["CustomerId"] = 1] = "CustomerId"; - IdentityType[IdentityType["Facebook"] = 2] = "Facebook"; - IdentityType[IdentityType["Twitter"] = 3] = "Twitter"; - IdentityType[IdentityType["Google"] = 4] = "Google"; - IdentityType[IdentityType["Microsoft"] = 5] = "Microsoft"; - IdentityType[IdentityType["Yahoo"] = 6] = "Yahoo"; - IdentityType[IdentityType["Email"] = 7] = "Email"; - IdentityType[IdentityType["FacebookCustomAudienceId"] = 9] = "FacebookCustomAudienceId"; - IdentityType[IdentityType["Other2"] = 10] = "Other2"; - IdentityType[IdentityType["Other3"] = 11] = "Other3"; - IdentityType[IdentityType["Other4"] = 12] = "Other4"; - IdentityType[IdentityType["Other5"] = 13] = "Other5"; - IdentityType[IdentityType["Other6"] = 14] = "Other6"; - IdentityType[IdentityType["Other7"] = 15] = "Other7"; - IdentityType[IdentityType["Other8"] = 16] = "Other8"; - IdentityType[IdentityType["Other9"] = 17] = "Other9"; - IdentityType[IdentityType["Other10"] = 18] = "Other10"; - IdentityType[IdentityType["MobileNumber"] = 19] = "MobileNumber"; - IdentityType[IdentityType["PhoneNumber2"] = 20] = "PhoneNumber2"; - IdentityType[IdentityType["PhoneNumber3"] = 21] = "PhoneNumber3"; - })(IdentityType || (IdentityType = {})); - var MPSideloadedKit = /** @class */function () { function MPSideloadedKit(unregisteredKitInstance) { this.filterDictionary = {