@mparticle/web-sdk 2.23.6 → 2.23.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mparticle.common.js +9 -12
- package/dist/mparticle.esm.js +9 -12
- package/dist/mparticle.js +24 -22
- package/package.json +1 -1
- package/src/forwarders.js +27 -21
- package/src/types.js +0 -1
package/dist/mparticle.common.js
CHANGED
|
@@ -56,12 +56,12 @@ function _defineProperty(obj, key, value) {
|
|
|
56
56
|
return obj;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
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.
|
|
59
|
+
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
|
|
60
60
|
// trigger an immediate upload.
|
|
61
61
|
// Continuation of enum above, but in seperate object since we don't expose these to end user
|
|
62
62
|
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};
|
|
63
63
|
|
|
64
|
-
var version = "2.23.
|
|
64
|
+
var version = "2.23.7";
|
|
65
65
|
|
|
66
66
|
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"},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
|
|
67
67
|
},DefaultUrls:{v1SecureServiceUrl:"jssdks.mparticle.com/v1/JS/",v2SecureServiceUrl:"jssdks.mparticle.com/v2/JS/",v3SecureServiceUrl:"jssdks.mparticle.com/v3/JS/",configUrl:"jssdkcdns.mparticle.com/JS/v2/",identityUrl:"identity.mparticle.com/v1/",aliasUrl:"jssdks.mparticle.com/v1/identity/"},Base64CookieKeys:{csm:1,sa:1,ss:1,ua:1,ui:1,csd:1,ia:1,con:1},SDKv2NonMPIDCookieKeys:{gs:1,cu:1,l:1,globalSettings:1,currentUserMPID:1},HTTPCodes:{noHttpCoverage:-1,activeIdentityRequest:-2,activeSession:-3,validationIssue:-4,nativeIdentityRequest:-5,loggingDisabledOrMissingAPIKey:-6,tooManyRequests:429},FeatureFlags:{ReportBatching:"reportBatching",EventBatchingIntervalMillis:"eventBatchingIntervalMillis",OfflineStorage:"offlineStorage"},DefaultInstance:"default_instance",CCPAPurpose:"data_sale_opt_out"};
|
|
@@ -597,11 +597,10 @@ function Forwarders(a,b){var c=this,d={setUserAttribute:"setUserAttribute",remov
|
|
|
597
597
|
// The kit configuration will be compared with the kit constructors to determine
|
|
598
598
|
// if there is a match before being initialized.
|
|
599
599
|
// Only kits that are configured properly can be active and used for kit forwarding.
|
|
600
|
-
//
|
|
601
|
-
//
|
|
602
|
-
// TODO: Sideloading kits currently requires the use of a register method
|
|
600
|
+
// Unlike UI enabled kits, sideloaded kits are always added to active forwarders.
|
|
601
|
+
// TODO: Sideloading kits currently require the use of a register method
|
|
603
602
|
// which requires an object on which to be registered.
|
|
604
|
-
// In the future, when all kits are moved to the
|
|
603
|
+
// In the future, when all kits are moved to the mpConfig rather than
|
|
605
604
|
// there being a separate process for MP configured kits and
|
|
606
605
|
// sideloaded kits, this will need to be refactored.
|
|
607
606
|
// kits can be included via mParticle UI, or via sideloaded kit config API
|
|
@@ -625,13 +624,11 @@ return isEmpty(a._Store.SDKConfig.kits)?!isEmpty(a._preInit.forwarderConstructor
|
|
|
625
624
|
// a suffix allows the SDK to distinguish the two.
|
|
626
625
|
if(a.suffix){var c="".concat(a.name,"-").concat(a.suffix);b[c]=a;}else b[a.name]=a;}):b=a._Store.SDKConfig.kits,b},this.configureUIEnabledKit=function(b,c){var d=null,e=b;for(var f in c){// Configs are returned with suffixes also. We need to consider the
|
|
627
626
|
// config suffix here to match the constructor suffix
|
|
628
|
-
var g=void 0;if(e.suffix&&(g="".concat(e.name,"-").concat(e.suffix)),(f===g||f===e.name)&&(e.isDebug===a._Store.SDKConfig.isDevelopmentMode||e.isSandbox===a._Store.SDKConfig.isDevelopmentMode)){d=this.returnConfiguredKit(c[f],e),a._Store.configuredForwarders.push(d);break}}},this.processSideloadedKits=function(b){try{if(Array.isArray(b.sideloadedKits)){var d={kits:{}};//
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
// Then configure each kit
|
|
632
|
-
for(var e in b.sideloadedKits.forEach(function(a){try{a.kitInstance.register(d);}catch(b){console.error("Error registering sideloaded kit "+a.kitInstance.name);}}),d.kits){var f=d.kits[e];c.configureSideloadedKit(f);}// If Sideloaded Kits are successfully registered,
|
|
627
|
+
var g=void 0;if(e.suffix&&(g="".concat(e.name,"-").concat(e.suffix)),(f===g||f===e.name)&&(e.isDebug===a._Store.SDKConfig.isDevelopmentMode||e.isSandbox===a._Store.SDKConfig.isDevelopmentMode)){d=this.returnConfiguredKit(c[f],e),a._Store.configuredForwarders.push(d);break}}},this.processSideloadedKits=function(b){try{if(Array.isArray(b.sideloadedKits)){var d={kits:{}},e=b.sideloadedKits;// Then configure each registered kit
|
|
628
|
+
for(var f in e.forEach(function(a){try{a.kitInstance.register(d);var b=a.kitInstance.name;// Then add the kit filters to each registered kit.
|
|
629
|
+
d.kits[b].filters=a.filterDictionary;}catch(b){console.error("Error registering sideloaded kit "+a.kitInstance.name);}}),d.kits){var g=d.kits[f];c.configureSideloadedKit(g);}// If Sideloaded Kits are successfully registered,
|
|
633
630
|
// record this in the Store.
|
|
634
|
-
if(!isEmpty(d.kits)){var
|
|
631
|
+
if(!isEmpty(d.kits)){var h=Object.keys(d.kits);a._Store.sideloadedKitsCount=h.length;}}}catch(b){a.Logger.error("Sideloaded Kits not configured propertly. Kits may not be initialized. "+b);}},this.configureSideloadedKit=function(b){a._Store.configuredForwarders.push(this.returnConfiguredKit(b,b.filters));},this.returnConfiguredKit=function(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},c=new a.constructor;return c.id=b.moduleId,c.isSandbox=b.isDebug||b.isSandbox,c.hasSandbox="true"===b.hasDebugString,c.isVisible=b.isVisible||!0,c.settings=b.settings||{},c.eventNameFilters=b.eventNameFilters||[],c.eventTypeFilters=b.eventTypeFilters||[],c.attributeFilters=b.attributeFilters||[],c.screenNameFilters=b.screenNameFilters||[],c.screenAttributeFilters=b.screenAttributeFilters||[],c.userIdentityFilters=b.userIdentityFilters||[],c.userAttributeFilters=b.userAttributeFilters||[],c.filteringEventAttributeValue=b.filteringEventAttributeValue||{},c.filteringUserAttributeValue=b.filteringUserAttributeValue||{},c.eventSubscriptionId=b.eventSubscriptionId||null,c.filteringConsentRuleValues=b.filteringConsentRuleValues||{},c.excludeAnonymousUser=b.excludeAnonymousUser||!1,c},this.configurePixel=function(b){(b.isDebug===a._Store.SDKConfig.isDevelopmentMode||b.isProduction!==a._Store.SDKConfig.isDevelopmentMode)&&a._Store.pixelConfigurations.push(b);},this.processPixelConfigs=function(b){try{isEmpty(b.pixelConfigs)||b.pixelConfigs.forEach(function(a){c.configurePixel(a);});}catch(b){a.Logger.error("Cookie Sync configs not configured propertly. Cookie Sync may not be initialized. "+b);}};}
|
|
635
632
|
|
|
636
633
|
// TODO: This file is no longer the server model because the web SDK payload
|
|
637
634
|
var MessageType$1=Types.MessageType,ApplicationTransitionType=Types.ApplicationTransitionType;// TODO: Make this a pure function that returns a new object
|
package/dist/mparticle.esm.js
CHANGED
|
@@ -56,12 +56,12 @@ function _defineProperty(obj, key, value) {
|
|
|
56
56
|
return obj;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
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.
|
|
59
|
+
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
|
|
60
60
|
// trigger an immediate upload.
|
|
61
61
|
// Continuation of enum above, but in seperate object since we don't expose these to end user
|
|
62
62
|
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};
|
|
63
63
|
|
|
64
|
-
var version = "2.23.
|
|
64
|
+
var version = "2.23.7";
|
|
65
65
|
|
|
66
66
|
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"},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
|
|
67
67
|
},DefaultUrls:{v1SecureServiceUrl:"jssdks.mparticle.com/v1/JS/",v2SecureServiceUrl:"jssdks.mparticle.com/v2/JS/",v3SecureServiceUrl:"jssdks.mparticle.com/v3/JS/",configUrl:"jssdkcdns.mparticle.com/JS/v2/",identityUrl:"identity.mparticle.com/v1/",aliasUrl:"jssdks.mparticle.com/v1/identity/"},Base64CookieKeys:{csm:1,sa:1,ss:1,ua:1,ui:1,csd:1,ia:1,con:1},SDKv2NonMPIDCookieKeys:{gs:1,cu:1,l:1,globalSettings:1,currentUserMPID:1},HTTPCodes:{noHttpCoverage:-1,activeIdentityRequest:-2,activeSession:-3,validationIssue:-4,nativeIdentityRequest:-5,loggingDisabledOrMissingAPIKey:-6,tooManyRequests:429},FeatureFlags:{ReportBatching:"reportBatching",EventBatchingIntervalMillis:"eventBatchingIntervalMillis",OfflineStorage:"offlineStorage"},DefaultInstance:"default_instance",CCPAPurpose:"data_sale_opt_out"};
|
|
@@ -597,11 +597,10 @@ function Forwarders(a,b){var c=this,d={setUserAttribute:"setUserAttribute",remov
|
|
|
597
597
|
// The kit configuration will be compared with the kit constructors to determine
|
|
598
598
|
// if there is a match before being initialized.
|
|
599
599
|
// Only kits that are configured properly can be active and used for kit forwarding.
|
|
600
|
-
//
|
|
601
|
-
//
|
|
602
|
-
// TODO: Sideloading kits currently requires the use of a register method
|
|
600
|
+
// Unlike UI enabled kits, sideloaded kits are always added to active forwarders.
|
|
601
|
+
// TODO: Sideloading kits currently require the use of a register method
|
|
603
602
|
// which requires an object on which to be registered.
|
|
604
|
-
// In the future, when all kits are moved to the
|
|
603
|
+
// In the future, when all kits are moved to the mpConfig rather than
|
|
605
604
|
// there being a separate process for MP configured kits and
|
|
606
605
|
// sideloaded kits, this will need to be refactored.
|
|
607
606
|
// kits can be included via mParticle UI, or via sideloaded kit config API
|
|
@@ -625,13 +624,11 @@ return isEmpty(a._Store.SDKConfig.kits)?!isEmpty(a._preInit.forwarderConstructor
|
|
|
625
624
|
// a suffix allows the SDK to distinguish the two.
|
|
626
625
|
if(a.suffix){var c="".concat(a.name,"-").concat(a.suffix);b[c]=a;}else b[a.name]=a;}):b=a._Store.SDKConfig.kits,b},this.configureUIEnabledKit=function(b,c){var d=null,e=b;for(var f in c){// Configs are returned with suffixes also. We need to consider the
|
|
627
626
|
// config suffix here to match the constructor suffix
|
|
628
|
-
var g=void 0;if(e.suffix&&(g="".concat(e.name,"-").concat(e.suffix)),(f===g||f===e.name)&&(e.isDebug===a._Store.SDKConfig.isDevelopmentMode||e.isSandbox===a._Store.SDKConfig.isDevelopmentMode)){d=this.returnConfiguredKit(c[f],e),a._Store.configuredForwarders.push(d);break}}},this.processSideloadedKits=function(b){try{if(Array.isArray(b.sideloadedKits)){var d={kits:{}};//
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
// Then configure each kit
|
|
632
|
-
for(var e in b.sideloadedKits.forEach(function(a){try{a.kitInstance.register(d);}catch(b){console.error("Error registering sideloaded kit "+a.kitInstance.name);}}),d.kits){var f=d.kits[e];c.configureSideloadedKit(f);}// If Sideloaded Kits are successfully registered,
|
|
627
|
+
var g=void 0;if(e.suffix&&(g="".concat(e.name,"-").concat(e.suffix)),(f===g||f===e.name)&&(e.isDebug===a._Store.SDKConfig.isDevelopmentMode||e.isSandbox===a._Store.SDKConfig.isDevelopmentMode)){d=this.returnConfiguredKit(c[f],e),a._Store.configuredForwarders.push(d);break}}},this.processSideloadedKits=function(b){try{if(Array.isArray(b.sideloadedKits)){var d={kits:{}},e=b.sideloadedKits;// Then configure each registered kit
|
|
628
|
+
for(var f in e.forEach(function(a){try{a.kitInstance.register(d);var b=a.kitInstance.name;// Then add the kit filters to each registered kit.
|
|
629
|
+
d.kits[b].filters=a.filterDictionary;}catch(b){console.error("Error registering sideloaded kit "+a.kitInstance.name);}}),d.kits){var g=d.kits[f];c.configureSideloadedKit(g);}// If Sideloaded Kits are successfully registered,
|
|
633
630
|
// record this in the Store.
|
|
634
|
-
if(!isEmpty(d.kits)){var
|
|
631
|
+
if(!isEmpty(d.kits)){var h=Object.keys(d.kits);a._Store.sideloadedKitsCount=h.length;}}}catch(b){a.Logger.error("Sideloaded Kits not configured propertly. Kits may not be initialized. "+b);}},this.configureSideloadedKit=function(b){a._Store.configuredForwarders.push(this.returnConfiguredKit(b,b.filters));},this.returnConfiguredKit=function(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},c=new a.constructor;return c.id=b.moduleId,c.isSandbox=b.isDebug||b.isSandbox,c.hasSandbox="true"===b.hasDebugString,c.isVisible=b.isVisible||!0,c.settings=b.settings||{},c.eventNameFilters=b.eventNameFilters||[],c.eventTypeFilters=b.eventTypeFilters||[],c.attributeFilters=b.attributeFilters||[],c.screenNameFilters=b.screenNameFilters||[],c.screenAttributeFilters=b.screenAttributeFilters||[],c.userIdentityFilters=b.userIdentityFilters||[],c.userAttributeFilters=b.userAttributeFilters||[],c.filteringEventAttributeValue=b.filteringEventAttributeValue||{},c.filteringUserAttributeValue=b.filteringUserAttributeValue||{},c.eventSubscriptionId=b.eventSubscriptionId||null,c.filteringConsentRuleValues=b.filteringConsentRuleValues||{},c.excludeAnonymousUser=b.excludeAnonymousUser||!1,c},this.configurePixel=function(b){(b.isDebug===a._Store.SDKConfig.isDevelopmentMode||b.isProduction!==a._Store.SDKConfig.isDevelopmentMode)&&a._Store.pixelConfigurations.push(b);},this.processPixelConfigs=function(b){try{isEmpty(b.pixelConfigs)||b.pixelConfigs.forEach(function(a){c.configurePixel(a);});}catch(b){a.Logger.error("Cookie Sync configs not configured propertly. Cookie Sync may not be initialized. "+b);}};}
|
|
635
632
|
|
|
636
633
|
// TODO: This file is no longer the server model because the web SDK payload
|
|
637
634
|
var MessageType$1=Types.MessageType,ApplicationTransitionType=Types.ApplicationTransitionType;// TODO: Make this a pure function that returns a new object
|
package/dist/mparticle.js
CHANGED
|
@@ -262,7 +262,7 @@ var mParticle = (function () {
|
|
|
262
262
|
|
|
263
263
|
// Dictionary that contains MessageTypes that will
|
|
264
264
|
// trigger an immediate upload.
|
|
265
|
-
var TriggerUploadType = (_TriggerUploadType = {}, _defineProperty(_TriggerUploadType, MessageType$2.Commerce, 1), _defineProperty(_TriggerUploadType, MessageType$2.
|
|
265
|
+
var TriggerUploadType = (_TriggerUploadType = {}, _defineProperty(_TriggerUploadType, MessageType$2.Commerce, 1), _defineProperty(_TriggerUploadType, MessageType$2.UserIdentityChange, 1), _TriggerUploadType);
|
|
266
266
|
var EventType = {
|
|
267
267
|
Unknown: 0,
|
|
268
268
|
Navigation: 1,
|
|
@@ -608,7 +608,7 @@ var mParticle = (function () {
|
|
|
608
608
|
Environment: Environment
|
|
609
609
|
};
|
|
610
610
|
|
|
611
|
-
var version = "2.23.
|
|
611
|
+
var version = "2.23.7";
|
|
612
612
|
|
|
613
613
|
var Constants = {
|
|
614
614
|
sdkVersion: version,
|
|
@@ -5543,41 +5543,43 @@ var mParticle = (function () {
|
|
|
5543
5543
|
}
|
|
5544
5544
|
};
|
|
5545
5545
|
|
|
5546
|
-
//
|
|
5547
|
-
// They are automatically added to active forwarders.
|
|
5546
|
+
// Unlike UI enabled kits, sideloaded kits are always added to active forwarders.
|
|
5548
5547
|
|
|
5549
|
-
// TODO: Sideloading kits currently
|
|
5548
|
+
// TODO: Sideloading kits currently require the use of a register method
|
|
5550
5549
|
// which requires an object on which to be registered.
|
|
5551
|
-
// In the future, when all kits are moved to the
|
|
5550
|
+
// In the future, when all kits are moved to the mpConfig rather than
|
|
5552
5551
|
// there being a separate process for MP configured kits and
|
|
5553
5552
|
// sideloaded kits, this will need to be refactored.
|
|
5554
|
-
this.processSideloadedKits = function (
|
|
5553
|
+
this.processSideloadedKits = function (mpConfig) {
|
|
5555
5554
|
try {
|
|
5556
|
-
if (Array.isArray(
|
|
5557
|
-
var
|
|
5555
|
+
if (Array.isArray(mpConfig.sideloadedKits)) {
|
|
5556
|
+
var registeredSideloadedKits = {
|
|
5558
5557
|
kits: {}
|
|
5559
5558
|
};
|
|
5560
|
-
|
|
5561
|
-
|
|
5562
|
-
// The constructors are keyed by the name of the kit.
|
|
5563
|
-
config.sideloadedKits.forEach(function (sideloadedKit) {
|
|
5559
|
+
var unregisteredSideloadedKits = mpConfig.sideloadedKits;
|
|
5560
|
+
unregisteredSideloadedKits.forEach(function (unregisteredKit) {
|
|
5564
5561
|
try {
|
|
5565
|
-
|
|
5562
|
+
// Register each sideloaded kit, which adds a key of the sideloaded kit name
|
|
5563
|
+
// and a value of the sideloaded kit constructor.
|
|
5564
|
+
unregisteredKit.kitInstance.register(registeredSideloadedKits);
|
|
5565
|
+
var kitName = unregisteredKit.kitInstance.name;
|
|
5566
|
+
// Then add the kit filters to each registered kit.
|
|
5567
|
+
registeredSideloadedKits.kits[kitName].filters = unregisteredKit.filterDictionary;
|
|
5566
5568
|
} catch (e) {
|
|
5567
|
-
console.error('Error registering sideloaded kit ' +
|
|
5569
|
+
console.error('Error registering sideloaded kit ' + unregisteredKit.kitInstance.name);
|
|
5568
5570
|
}
|
|
5569
5571
|
});
|
|
5570
5572
|
|
|
5571
|
-
// Then configure each kit
|
|
5572
|
-
for (var registeredKitKey in
|
|
5573
|
-
var
|
|
5574
|
-
self.configureSideloadedKit(
|
|
5573
|
+
// Then configure each registered kit
|
|
5574
|
+
for (var registeredKitKey in registeredSideloadedKits.kits) {
|
|
5575
|
+
var registeredKit = registeredSideloadedKits.kits[registeredKitKey];
|
|
5576
|
+
self.configureSideloadedKit(registeredKit);
|
|
5575
5577
|
}
|
|
5576
5578
|
|
|
5577
5579
|
// If Sideloaded Kits are successfully registered,
|
|
5578
5580
|
// record this in the Store.
|
|
5579
|
-
if (!isEmpty(
|
|
5580
|
-
var kitKeys = Object.keys(
|
|
5581
|
+
if (!isEmpty(registeredSideloadedKits.kits)) {
|
|
5582
|
+
var kitKeys = Object.keys(registeredSideloadedKits.kits);
|
|
5581
5583
|
mpInstance._Store.sideloadedKitsCount = kitKeys.length;
|
|
5582
5584
|
}
|
|
5583
5585
|
}
|
|
@@ -5588,7 +5590,7 @@ var mParticle = (function () {
|
|
|
5588
5590
|
|
|
5589
5591
|
// kits can be included via mParticle UI, or via sideloaded kit config API
|
|
5590
5592
|
this.configureSideloadedKit = function (kitConstructor) {
|
|
5591
|
-
mpInstance._Store.configuredForwarders.push(this.returnConfiguredKit(kitConstructor));
|
|
5593
|
+
mpInstance._Store.configuredForwarders.push(this.returnConfiguredKit(kitConstructor, kitConstructor.filters));
|
|
5592
5594
|
};
|
|
5593
5595
|
this.returnConfiguredKit = function (forwarder) {
|
|
5594
5596
|
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
package/package.json
CHANGED
package/src/forwarders.js
CHANGED
|
@@ -629,43 +629,49 @@ export default function Forwarders(mpInstance, kitBlocker) {
|
|
|
629
629
|
}
|
|
630
630
|
};
|
|
631
631
|
|
|
632
|
-
//
|
|
633
|
-
// They are automatically added to active forwarders.
|
|
632
|
+
// Unlike UI enabled kits, sideloaded kits are always added to active forwarders.
|
|
634
633
|
|
|
635
|
-
// TODO: Sideloading kits currently
|
|
634
|
+
// TODO: Sideloading kits currently require the use of a register method
|
|
636
635
|
// which requires an object on which to be registered.
|
|
637
|
-
// In the future, when all kits are moved to the
|
|
636
|
+
// In the future, when all kits are moved to the mpConfig rather than
|
|
638
637
|
// there being a separate process for MP configured kits and
|
|
639
638
|
// sideloaded kits, this will need to be refactored.
|
|
640
|
-
this.processSideloadedKits = function(
|
|
639
|
+
this.processSideloadedKits = function(mpConfig) {
|
|
641
640
|
try {
|
|
642
|
-
if (Array.isArray(
|
|
643
|
-
const
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
config.sideloadedKits.forEach(function(sideloadedKit) {
|
|
641
|
+
if (Array.isArray(mpConfig.sideloadedKits)) {
|
|
642
|
+
const registeredSideloadedKits = { kits: {} };
|
|
643
|
+
const unregisteredSideloadedKits = mpConfig.sideloadedKits;
|
|
644
|
+
|
|
645
|
+
unregisteredSideloadedKits.forEach(function(unregisteredKit) {
|
|
648
646
|
try {
|
|
649
|
-
|
|
647
|
+
// Register each sideloaded kit, which adds a key of the sideloaded kit name
|
|
648
|
+
// and a value of the sideloaded kit constructor.
|
|
649
|
+
unregisteredKit.kitInstance.register(
|
|
650
|
+
registeredSideloadedKits
|
|
651
|
+
);
|
|
652
|
+
const kitName = unregisteredKit.kitInstance.name;
|
|
653
|
+
// Then add the kit filters to each registered kit.
|
|
654
|
+
registeredSideloadedKits.kits[kitName].filters =
|
|
655
|
+
unregisteredKit.filterDictionary;
|
|
650
656
|
} catch (e) {
|
|
651
657
|
console.error(
|
|
652
658
|
'Error registering sideloaded kit ' +
|
|
653
|
-
|
|
659
|
+
unregisteredKit.kitInstance.name
|
|
654
660
|
);
|
|
655
661
|
}
|
|
656
662
|
});
|
|
657
663
|
|
|
658
|
-
// Then configure each kit
|
|
659
|
-
for (const registeredKitKey in
|
|
660
|
-
const
|
|
661
|
-
|
|
662
|
-
self.configureSideloadedKit(
|
|
664
|
+
// Then configure each registered kit
|
|
665
|
+
for (const registeredKitKey in registeredSideloadedKits.kits) {
|
|
666
|
+
const registeredKit =
|
|
667
|
+
registeredSideloadedKits.kits[registeredKitKey];
|
|
668
|
+
self.configureSideloadedKit(registeredKit);
|
|
663
669
|
}
|
|
664
670
|
|
|
665
671
|
// If Sideloaded Kits are successfully registered,
|
|
666
672
|
// record this in the Store.
|
|
667
|
-
if (!isEmpty(
|
|
668
|
-
const kitKeys = Object.keys(
|
|
673
|
+
if (!isEmpty(registeredSideloadedKits.kits)) {
|
|
674
|
+
const kitKeys = Object.keys(registeredSideloadedKits.kits);
|
|
669
675
|
mpInstance._Store.sideloadedKitsCount = kitKeys.length;
|
|
670
676
|
}
|
|
671
677
|
}
|
|
@@ -680,7 +686,7 @@ export default function Forwarders(mpInstance, kitBlocker) {
|
|
|
680
686
|
// kits can be included via mParticle UI, or via sideloaded kit config API
|
|
681
687
|
this.configureSideloadedKit = function(kitConstructor) {
|
|
682
688
|
mpInstance._Store.configuredForwarders.push(
|
|
683
|
-
this.returnConfiguredKit(kitConstructor)
|
|
689
|
+
this.returnConfiguredKit(kitConstructor, kitConstructor.filters)
|
|
684
690
|
);
|
|
685
691
|
};
|
|
686
692
|
|