@mparticle/web-sdk 2.16.0 → 2.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -34,7 +34,7 @@ var defineProperty = _defineProperty;
34
34
 
35
35
  var _TriggerUploadType,MessageType={SessionStart:1,SessionEnd:2,PageView:3,PageEvent:4,CrashReport:5,OptOut:6,AppStateTransition:10,Profile:14,Commerce:16,Media:20,UserAttributeChange:17,UserIdentityChange:18},TriggerUploadType=(_TriggerUploadType={},defineProperty(_TriggerUploadType,MessageType.Commerce,1),defineProperty(_TriggerUploadType,MessageType.UserAttributeChange,1),defineProperty(_TriggerUploadType,MessageType.UserIdentityChange,1),_TriggerUploadType),EventType={Unknown:0,Navigation:1,Location:2,Search:3,Transaction:4,UserContent:5,UserPreference:6,Social:7,Other:8,Media:9,getName:function getName(a){return a===EventType.Unknown?"Unknown":a===EventType.Navigation?"Navigation":a===EventType.Location?"Location":a===EventType.Search?"Search":a===EventType.Transaction?"Transaction":a===EventType.UserContent?"User Content":a===EventType.UserPreference?"User Preference":a===EventType.Social?"Social":a===CommerceEventType.ProductAddToCart?"Product Added to Cart":a===CommerceEventType.ProductAddToWishlist?"Product Added to Wishlist":a===CommerceEventType.ProductCheckout?"Product Checkout":a===CommerceEventType.ProductCheckoutOption?"Product Checkout Options":a===CommerceEventType.ProductClick?"Product Click":a===CommerceEventType.ProductImpression?"Product Impression":a===CommerceEventType.ProductPurchase?"Product Purchased":a===CommerceEventType.ProductRefund?"Product Refunded":a===CommerceEventType.ProductRemoveFromCart?"Product Removed From Cart":a===CommerceEventType.ProductRemoveFromWishlist?"Product Removed from Wishlist":a===CommerceEventType.ProductViewDetail?"Product View Details":a===CommerceEventType.PromotionClick?"Promotion Click":a===CommerceEventType.PromotionView?"Promotion View":"Other"}},CommerceEventType={ProductAddToCart:10,ProductRemoveFromCart:11,ProductCheckout:12,ProductCheckoutOption:13,ProductClick:14,ProductViewDetail:15,ProductPurchase:16,ProductRefund:17,PromotionView:18,PromotionClick:19,ProductAddToWishlist:20,ProductRemoveFromWishlist:21,ProductImpression:22},IdentityType={Other:0,CustomerId:1,Facebook:2,Twitter:3,Google:4,Microsoft:5,Yahoo:6,Email:7,FacebookCustomAudienceId:9,Other2:10,Other3:11,Other4:12,Other5:13,Other6:14,Other7:15,Other8:16,Other9:17,Other10:18,MobileNumber:19,PhoneNumber2:20,PhoneNumber3:21};IdentityType.isValid=function(a){if("number"==typeof a)for(var b in IdentityType)if(IdentityType.hasOwnProperty(b)&&IdentityType[b]===a)return !0;return !1},IdentityType.getName=function(a){return a===window.mParticle.IdentityType.CustomerId?"Customer ID":a===window.mParticle.IdentityType.Facebook?"Facebook ID":a===window.mParticle.IdentityType.Twitter?"Twitter ID":a===window.mParticle.IdentityType.Google?"Google ID":a===window.mParticle.IdentityType.Microsoft?"Microsoft ID":a===window.mParticle.IdentityType.Yahoo?"Yahoo ID":a===window.mParticle.IdentityType.Email?"Email":a===window.mParticle.IdentityType.FacebookCustomAudienceId?"Facebook App User ID":"Other ID"},IdentityType.getIdentityType=function(a){return "other"===a?IdentityType.Other:"customerid"===a?IdentityType.CustomerId:"facebook"===a?IdentityType.Facebook:"twitter"===a?IdentityType.Twitter:"google"===a?IdentityType.Google:"microsoft"===a?IdentityType.Microsoft:"yahoo"===a?IdentityType.Yahoo:"email"===a?IdentityType.Email:"facebookcustomaudienceid"===a?IdentityType.FacebookCustomAudienceId:"other2"===a?IdentityType.Other2:"other3"===a?IdentityType.Other3:"other4"===a?IdentityType.Other4:"other5"===a?IdentityType.Other5:"other6"===a?IdentityType.Other6:"other7"===a?IdentityType.Other7:"other8"===a?IdentityType.Other8:"other9"===a?IdentityType.Other9:"other10"===a?IdentityType.Other10:"mobile_number"===a?IdentityType.MobileNumber:"phone_number_2"===a?IdentityType.PhoneNumber2:!("phone_number_3"!=a)&&IdentityType.PhoneNumber3},IdentityType.getIdentityName=function(a){return a===IdentityType.Other?"other":a===IdentityType.CustomerId?"customerid":a===IdentityType.Facebook?"facebook":a===IdentityType.Twitter?"twitter":a===IdentityType.Google?"google":a===IdentityType.Microsoft?"microsoft":a===IdentityType.Yahoo?"yahoo":a===IdentityType.Email?"email":a===IdentityType.FacebookCustomAudienceId?"facebookcustomaudienceid":a===IdentityType.Other2?"other2":a===IdentityType.Other3?"other3":a===IdentityType.Other4?"other4":a===IdentityType.Other5?"other5":a===IdentityType.Other6?"other6":a===IdentityType.Other7?"other7":a===IdentityType.Other8?"other8":a===IdentityType.Other9?"other9":a===IdentityType.Other10?"other10":a===IdentityType.MobileNumber?"mobile_number":a===IdentityType.PhoneNumber2?"phone_number_2":a===IdentityType.PhoneNumber3?"phone_number_3":void 0};var ProductActionType={Unknown:0,AddToCart:1,RemoveFromCart:2,Checkout:3,CheckoutOption:4,Click:5,ViewDetail:6,Purchase:7,Refund:8,AddToWishlist:9,RemoveFromWishlist:10};ProductActionType.getName=function(a){return a===ProductActionType.AddToCart?"Add to Cart":a===ProductActionType.RemoveFromCart?"Remove from Cart":a===ProductActionType.Checkout?"Checkout":a===ProductActionType.CheckoutOption?"Checkout Option":a===ProductActionType.Click?"Click":a===ProductActionType.ViewDetail?"View Detail":a===ProductActionType.Purchase?"Purchase":a===ProductActionType.Refund?"Refund":a===ProductActionType.AddToWishlist?"Add to Wishlist":a===ProductActionType.RemoveFromWishlist?"Remove from Wishlist":"Unknown"},ProductActionType.getExpansionName=function(a){return a===ProductActionType.AddToCart?"add_to_cart":a===ProductActionType.RemoveFromCart?"remove_from_cart":a===ProductActionType.Checkout?"checkout":a===ProductActionType.CheckoutOption?"checkout_option":a===ProductActionType.Click?"click":a===ProductActionType.ViewDetail?"view_detail":a===ProductActionType.Purchase?"purchase":a===ProductActionType.Refund?"refund":a===ProductActionType.AddToWishlist?"add_to_wishlist":a===ProductActionType.RemoveFromWishlist?"remove_from_wishlist":"unknown"};var PromotionActionType={Unknown:0,PromotionView:1,PromotionClick:2};PromotionActionType.getName=function(a){return a===PromotionActionType.PromotionView?"view":a===PromotionActionType.PromotionClick?"click":"unknown"},PromotionActionType.getExpansionName=function(a){return a===PromotionActionType.PromotionView?"view":a===PromotionActionType.PromotionClick?"click":"unknown"};var ProfileMessageType={Logout:3},ApplicationTransitionType={AppInit:1};var Types = {MessageType:MessageType,EventType:EventType,CommerceEventType:CommerceEventType,IdentityType:IdentityType,ProfileMessageType:ProfileMessageType,ApplicationTransitionType:ApplicationTransitionType,ProductActionType:ProductActionType,PromotionActionType:PromotionActionType,TriggerUploadType:TriggerUploadType};
36
36
 
37
- var version = "2.16.0";
37
+ var version = "2.16.1";
38
38
 
39
39
  var Constants = { sdkVersion: version, sdkVendor: "mparticle", platform: "web", Messages: { ErrorMessages: { NoToken: "A token must be specified.", EventNameInvalidType: "Event name must be a valid string value.", EventDataInvalidType: "Event data must be a valid object hash.", LoggingDisabled: "Event logging is currently disabled.", CookieParseError: "Could not parse cookie", EventEmpty: "Event object is null or undefined, cancelling send", APIRequestEmpty: "APIRequest is null or undefined, cancelling send", NoEventType: "Event type must be specified.", TransactionIdRequired: "Transaction ID is required", TransactionRequired: "A transaction attributes object is required", PromotionIdRequired: "Promotion ID is required", BadAttribute: "Attribute value cannot be object or array", BadKey: "Key value cannot be object or array", BadLogPurchase: "Transaction attributes and a product are both required to log a purchase, https://docs.mparticle.com/?javascript#measuring-transactions" }, InformationMessages: { CookieSearch: "Searching for cookie", CookieFound: "Cookie found, parsing values", CookieNotFound: "Cookies not found", CookieSet: "Setting cookie", CookieSync: "Performing cookie sync", SendBegin: "Starting to send event", SendIdentityBegin: "Starting to send event to identity server", SendWindowsPhone: "Sending event to Windows Phone container", SendIOS: "Calling iOS path: ", SendAndroid: "Calling Android JS interface method: ", SendHttp: "Sending event to mParticle HTTP service", SendAliasHttp: "Sending alias request to mParticle HTTP service", SendIdentityHttp: "Sending event to mParticle HTTP service", StartingNewSession: "Starting new Session", StartingLogEvent: "Starting to log event", StartingLogOptOut: "Starting to log user opt in/out", StartingEndSession: "Starting to end session", StartingInitialization: "Starting to initialize", StartingLogCommerceEvent: "Starting to log commerce event", StartingAliasRequest: "Starting to Alias MPIDs", LoadingConfig: "Loading configuration options", AbandonLogEvent: "Cannot log event, logging disabled or developer token not set", AbandonAliasUsers: "Cannot Alias Users, logging disabled or developer token not set", AbandonStartSession: "Cannot start session, logging disabled or developer token not set", AbandonEndSession: "Cannot end session, logging disabled or developer token not set", NoSessionToEnd: "Cannot end session, no active session found" }, ValidationMessages: { ModifyIdentityRequestUserIdentitiesPresent: "identityRequests to modify require userIdentities to be present. Request not sent to server. Please fix and try again", IdentityRequesetInvalidKey: "There is an invalid key on your identityRequest object. It can only contain a `userIdentities` object and a `onUserAlias` function. Request not sent to server. Please fix and try again.", OnUserAliasType: "The onUserAlias value must be a function. The onUserAlias provided is of type", UserIdentities: "The userIdentities key must be an object with keys of identityTypes and values of strings. Request not sent to server. Please fix and try again.", UserIdentitiesInvalidKey: "There is an invalid identity key on your `userIdentities` object within the identityRequest. Request not sent to server. Please fix and try again.", UserIdentitiesInvalidValues: "All user identity values must be strings or null. Request not sent to server. Please fix and try again.", AliasMissingMpid: "Alias Request must contain both a destinationMpid and a sourceMpid", AliasNonUniqueMpid: "Alias Request's destinationMpid and sourceMpid must be unique", AliasMissingTime: "Alias Request must have both a startTime and an endTime", AliasStartBeforeEndTime: "Alias Request's endTime must be later than its startTime" } }, NativeSdkPaths: { LogEvent: "logEvent", SetUserTag: "setUserTag", RemoveUserTag: "removeUserTag", SetUserAttribute: "setUserAttribute", RemoveUserAttribute: "removeUserAttribute", SetSessionAttribute: "setSessionAttribute", AddToCart: "addToCart", RemoveFromCart: "removeFromCart", ClearCart: "clearCart", LogOut: "logOut", SetUserAttributeList: "setUserAttributeList", RemoveAllUserAttributes: "removeAllUserAttributes", GetUserAttributesLists: "getUserAttributesLists", GetAllUserAttributes: "getAllUserAttributes", Identify: "identify", Logout: "logout", Login: "login", Modify: "modify", Alias: "aliasUsers", Upload: "upload" }, StorageNames: { localStorageName: "mprtcl-api",
40
40
  localStorageNameV3: "mprtcl-v3",
@@ -1829,10 +1829,59 @@ var slugify = createCommonjsModule(function (module, exports) {
1829
1829
  }));
1830
1830
  });
1831
1831
 
1832
- var StorageNames=Constants.StorageNames,pluses=/\+/g;function Helpers(a){function b(b){var a;return window.crypto&&window.crypto.getRandomValues&&(a=window.crypto.getRandomValues(new Uint8Array(1))),a?(b^a[0]%16>>b/4).toString(16):(b^16*Math.random()>>b/4).toString(16)}var c=this;/**
1832
+ function _readOnlyError(name) {
1833
+ throw new Error("\"" + name + "\" is read-only");
1834
+ }
1835
+
1836
+ var readOnlyError = _readOnlyError;
1837
+
1838
+ var inArray = function (a, b) { var c = 0; if (Array.prototype.indexOf)
1839
+ return 0 <= a.indexOf(b, 0); for (var d = a.length; c < d; readOnlyError("i"))
1840
+ if (c in a && a[c] === b)
1841
+ return !0; return !1; }, findKeyInObject = function (a, b) { if (b && a)
1842
+ for (var c in a)
1843
+ if (a.hasOwnProperty(c) && c.toLowerCase() === b.toLowerCase())
1844
+ return c; return null; }, 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))
1845
+ return 0; var b = parseFloat(a); return isNaN(b) ? 0 : b; }, 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; };
1846
+
1847
+ var Validators = { isValidAttributeValue: function isValidAttributeValue(a) { return a !== void 0 && !isObject(a) && !Array.isArray(a); },
1848
+ isValidKeyValue: function isValidKeyValue(a) { return !(!a || isObject(a) || Array.isArray(a) || this.isFunction(a)); }, isStringOrNumber: function isStringOrNumber(a) { return "string" == typeof a || "number" == typeof a; }, isNumber: function isNumber(a) { return "number" == typeof a; }, isFunction: function isFunction(a) { return "function" == typeof a; }, validateIdentities: function validateIdentities(a, b) {
1849
+ var c = { userIdentities: 1, onUserAlias: 1, copyUserAttributes: 1 };
1850
+ if (a) {
1851
+ if ("modify" === b && (isObject(a.userIdentities) && !Object.keys(a.userIdentities).length || !isObject(a.userIdentities)))
1852
+ return { valid: !1, error: Constants.Messages.ValidationMessages.ModifyIdentityRequestUserIdentitiesPresent };
1853
+ for (var d in a)
1854
+ if (a.hasOwnProperty(d)) {
1855
+ if (!c[d])
1856
+ return { valid: !1, error: Constants.Messages.ValidationMessages.IdentityRequesetInvalidKey };
1857
+ if ("onUserAlias" === d && !Validators.isFunction(a[d]))
1858
+ return { valid: !1,
1859
+ error: Constants.Messages.ValidationMessages.OnUserAliasType + _typeof_1(a[d]) };
1860
+ }
1861
+ if (0 === Object.keys(a).length)
1862
+ return { valid: !0 }; // identityApiData.userIdentities can't be undefined
1863
+ if (void 0 === a.userIdentities)
1864
+ return { valid: !1, error: Constants.Messages.ValidationMessages.UserIdentities }; // identityApiData.userIdentities can be null, but if it isn't null or undefined (above conditional), it must be an object
1865
+ if (null !== a.userIdentities && !isObject(a.userIdentities))
1866
+ return { valid: !1, error: Constants.Messages.ValidationMessages.UserIdentities };
1867
+ if (isObject(a.userIdentities) && Object.keys(a.userIdentities).length)
1868
+ for (var e in a.userIdentities)
1869
+ if (a.userIdentities.hasOwnProperty(e)) {
1870
+ if (!1 === Types.IdentityType.getIdentityType(e))
1871
+ return { valid: !1, error: Constants.Messages.ValidationMessages.UserIdentitiesInvalidKey };
1872
+ if ("string" != typeof a.userIdentities[e] && null !== a.userIdentities[e])
1873
+ return { valid: !1, error: Constants.Messages.ValidationMessages.UserIdentitiesInvalidValues };
1874
+ }
1875
+ }
1876
+ return { valid: !0 };
1877
+ } };
1878
+
1879
+ var StorageNames=Constants.StorageNames;function Helpers(a){function b(b){var a;return window.crypto&&window.crypto.getRandomValues&&(a=window.crypto.getRandomValues(new Uint8Array(1))),a?(b^a[0]%16>>b/4).toString(16):(b^16*Math.random()>>b/4).toString(16)}var c=this;/**
1833
1880
  * Returns a value between 1-100 inclusive.
1834
1881
  */ // Standalone version of jQuery.extend, from https://github.com/dansdom/extend
1835
- this.canLog=function(){return !!(a._Store.isEnabled&&(a._Store.devToken||a._Store.webviewBridgeEnabled))},this.returnConvertedBoolean=function(a){return "false"!==a&&"0"!==a&&!!a},this.getFeatureFlag=function(b){return a._Store.SDKConfig.flags.hasOwnProperty(b)?a._Store.SDKConfig.flags[b]:null},this.getRampNumber=function(a){if(!a)return 100;var b=c.generateHash(a);return Math.abs(b%100)+1},this.invokeCallback=function(b,d,e,f,g){b||a.Logger.warning("There is no callback provided");try{c.Validators.isFunction(b)&&b({httpCode:d,body:e,getUser:function getUser(){return f?f:a.Identity.getCurrentUser()},getPreviousUser:function getPreviousUser(){if(!g){var b=a.Identity.getUsers(),c=b.shift(),d=f||a.Identity.getCurrentUser();return c&&d&&c.getMPID()===d.getMPID()&&(c=b.shift()),c||null}return a.Identity.getUser(g)}});}catch(b){a.Logger.error("There was an error with your callback: "+b);}},this.invokeAliasCallback=function(b,d,e){b||a.Logger.warning("There is no callback provided");try{if(c.Validators.isFunction(b)){var f={httpCode:d};e&&(f.message=e),b(f);}}catch(b){a.Logger.error("There was an error with your callback: "+b);}},this.extend=function(){var a,b,d,e,f,g,h=arguments[0]||{},j=1,k=arguments.length,l=!1,// helper which replicates the jquery internal functions
1882
+ // Utility Functions
1883
+ // Imported Validators
1884
+ this.canLog=function(){return !!(a._Store.isEnabled&&(a._Store.devToken||a._Store.webviewBridgeEnabled))},this.getFeatureFlag=function(b){return a._Store.SDKConfig.flags.hasOwnProperty(b)?a._Store.SDKConfig.flags[b]:null},this.getRampNumber=function(a){if(!a)return 100;var b=c.generateHash(a);return Math.abs(b%100)+1},this.invokeCallback=function(b,d,e,f,g){b||a.Logger.warning("There is no callback provided");try{c.Validators.isFunction(b)&&b({httpCode:d,body:e,getUser:function getUser(){return f?f:a.Identity.getCurrentUser()},getPreviousUser:function getPreviousUser(){if(!g){var b=a.Identity.getUsers(),c=b.shift(),d=f||a.Identity.getCurrentUser();return c&&d&&c.getMPID()===d.getMPID()&&(c=b.shift()),c||null}return a.Identity.getUser(g)}});}catch(b){a.Logger.error("There was an error with your callback: "+b);}},this.invokeAliasCallback=function(b,d,e){b||a.Logger.warning("There is no callback provided");try{if(c.Validators.isFunction(b)){var f={httpCode:d};e&&(f.message=e),b(f);}}catch(b){a.Logger.error("There was an error with your callback: "+b);}},this.extend=function(){var a,b,d,e,f,g,h=arguments[0]||{},j=1,k=arguments.length,l=!1,// helper which replicates the jquery internal functions
1836
1885
  m={hasOwn:Object.prototype.hasOwnProperty,class2type:{},type:function type(a){return null==a?a+"":m.class2type[Object.prototype.toString.call(a)]||"object"},isPlainObject:function isPlainObject(a){if(!a||"object"!==m.type(a)||a.nodeType||m.isWindow(a))return !1;try{if(a.constructor&&!m.hasOwn.call(a,"constructor")&&!m.hasOwn.call(a.constructor.prototype,"isPrototypeOf"))return !1}catch(a){return !1}for(var b in a);// eslint-disable-line no-empty
1837
1886
  return b===void 0||m.hasOwn.call(a,b)},isArray:Array.isArray||function(a){return "array"===m.type(a)},isFunction:function isFunction(a){return "function"===m.type(a)},isWindow:function isWindow(a){return null!=a&&a==a.window}};// end of objectHelper
1838
1887
  // Handle a deep copy situation
@@ -1841,7 +1890,7 @@ if(null!=(a=arguments[j]))// Extend the base object
1841
1890
  for(b in a)// Prevent never-ending loop
1842
1891
  (d=h[b],e=a[b],h!==e)&&(l&&e&&(m.isPlainObject(e)||(f=m.isArray(e)))?(f?(f=!1,g=d&&m.isArray(d)?d:[]):g=d&&m.isPlainObject(d)?d:{},h[b]=c.extend(l,g,e)):void 0!==e&&(h[b]=e));// Recurse if we're merging plain objects or arrays
1843
1892
  // Return the modified object
1844
- return h},this.isObject=function(a){var b=Object.prototype.toString.call(a);return "[object Object]"===b||"[object Error]"===b},this.inArray=function(a,b){var c=0;if(Array.prototype.indexOf)return 0<=a.indexOf(b,0);for(var d=a.length;c<d;c++)if(c in a&&a[c]===b)return !0},this.createServiceUrl=function(b,c){var d,e=window.mParticle&&a._Store.SDKConfig.forceHttps?"https://":window.location.protocol+"//";return d=a._Store.SDKConfig.forceHttps?"https://"+b:e+b,c&&(d+=c),d},this.createXHR=function(b){var c;try{c=new window.XMLHttpRequest;}catch(b){a.Logger.error("Error creating XMLHttpRequest object.");}if(c&&b&&"withCredentials"in c)c.onreadystatechange=b;else if("undefined"!=typeof window.XDomainRequest){a.Logger.verbose("Creating XDomainRequest object");try{c=new window.XDomainRequest,c.onload=b;}catch(b){a.Logger.error("Error creating XDomainRequest object");}}return c},this.generateUniqueId=function(d){// https://gist.github.com/jed/982883
1893
+ return h},this.createServiceUrl=function(b,c){var d,e=window.mParticle&&a._Store.SDKConfig.forceHttps?"https://":window.location.protocol+"//";return d=a._Store.SDKConfig.forceHttps?"https://"+b:e+b,c&&(d+=c),d},this.createXHR=function(b){var c;try{c=new window.XMLHttpRequest;}catch(b){a.Logger.error("Error creating XMLHttpRequest object.");}if(c&&b&&"withCredentials"in c)c.onreadystatechange=b;else if("undefined"!=typeof window.XDomainRequest){a.Logger.verbose("Creating XDomainRequest object");try{c=new window.XDomainRequest,c.onload=b;}catch(b){a.Logger.error("Error creating XDomainRequest object");}}return c},this.generateUniqueId=function(d){// https://gist.github.com/jed/982883
1845
1894
  // Added support for crypto for better random
1846
1895
  return d// if the placeholder was passed, return
1847
1896
  ?b(d)// a random number
@@ -1849,11 +1898,8 @@ return d// if the placeholder was passed, return
1849
1898
  "10000000-1000-4000-8000-100000000000".replace(// replacing
1850
1899
  /[018]/g,// zeroes, ones, and eights with
1851
1900
  c.generateUniqueId// random hex digits
1852
- )},this.filterUserIdentities=function(a,b){var d=[];if(a&&Object.keys(a).length)for(var e in a)if(a.hasOwnProperty(e)){var f=Types.IdentityType.getIdentityType(e);if(!c.inArray(b,f)){var g={Type:f,Identity:a[e]};f===Types.IdentityType.CustomerId?d.unshift(g):d.push(g);}}return d},this.filterUserIdentitiesForForwarders=function(a,b){var d={};if(a&&Object.keys(a).length)for(var e in a)if(a.hasOwnProperty(e)){var f=Types.IdentityType.getIdentityType(e);c.inArray(b,f)||(d[e]=a[e]);}return d},this.filterUserAttributes=function(a,b){var d={};if(a&&Object.keys(a).length)for(var e in a)if(a.hasOwnProperty(e)){var f=c.generateHash(e);c.inArray(b,f)||(d[e]=a[e]);}return d},this.findKeyInObject=function(a,b){if(b&&a)for(var c in a)if(a.hasOwnProperty(c)&&c.toLowerCase()===b.toLowerCase())return c;return null},this.decoded=function(a){return decodeURIComponent(a.replace(pluses," "))},this.converted=function(a){return 0===a.indexOf("\"")&&(a=a.slice(1,-1).replace(/\\"/g,"\"").replace(/\\\\/g,"\\")),a},this.isEventType=function(a){for(var b in Types.EventType)if(Types.EventType.hasOwnProperty(b)&&Types.EventType[b]===a)return !0;return !1},this.parseNumber=function(a){if(isNaN(a)||!isFinite(a))return 0;var b=parseFloat(a);return isNaN(b)?0:b},this.parseStringOrNumber=function(a){return c.Validators.isStringOrNumber(a)?a:null},this.generateHash=function(a){var b,c=0,d=0;if(void 0===a||null===a)return 0;if(a=a.toString().toLowerCase(),Array.prototype.reduce)return a.split("").reduce(function(c,d){return c=(c<<5)-c+d.charCodeAt(0),c&c},0);if(0===a.length)return c;for(d=0;d<a.length;d++)b=a.charCodeAt(d),c=(c<<5)-c+b,c&=c;return c},this.sanitizeAttributes=function(b,d){if(!b||!c.isObject(b))return null;var e={};for(var f in b)// Make sure that attribute values are not objects or arrays, which are not valid
1853
- b.hasOwnProperty(f)&&c.Validators.isValidAttributeValue(b[f])?e[f]=b[f]:a.Logger.warning("For '"+d+"', the corresponding attribute value of '"+f+"' must be a string, number, boolean, or null.");return e},this.Validators={isValidAttributeValue:function isValidAttributeValue(a){return a!==void 0&&!c.isObject(a)&&!Array.isArray(a)},// Neither null nor undefined can be a valid Key
1854
- isValidKeyValue:function isValidKeyValue(a){return !(!a||c.isObject(a)||Array.isArray(a))},isStringOrNumber:function isStringOrNumber(a){return "string"==typeof a||"number"==typeof a},isNumber:function isNumber(a){return "number"==typeof a},isFunction:function isFunction(a){return "function"==typeof a},validateIdentities:function validateIdentities(b,d){var e={userIdentities:1,onUserAlias:1,copyUserAttributes:1};if(b){if("modify"===d&&(c.isObject(b.userIdentities)&&!Object.keys(b.userIdentities).length||!c.isObject(b.userIdentities)))return {valid:!1,error:Constants.Messages.ValidationMessages.ModifyIdentityRequestUserIdentitiesPresent};for(var f in b)if(b.hasOwnProperty(f)){if(!e[f])return {valid:!1,error:Constants.Messages.ValidationMessages.IdentityRequesetInvalidKey};if("onUserAlias"===f&&!a._Helpers.Validators.isFunction(b[f]))return {valid:!1,error:Constants.Messages.ValidationMessages.OnUserAliasType+_typeof_1(b[f])}}if(0===Object.keys(b).length)return {valid:!0};// identityApiData.userIdentities can't be undefined
1855
- if(void 0===b.userIdentities)return {valid:!1,error:Constants.Messages.ValidationMessages.UserIdentities};// identityApiData.userIdentities can be null, but if it isn't null or undefined (above conditional), it must be an object
1856
- if(null!==b.userIdentities&&!c.isObject(b.userIdentities))return {valid:!1,error:Constants.Messages.ValidationMessages.UserIdentities};if(c.isObject(b.userIdentities)&&Object.keys(b.userIdentities).length)for(var g in b.userIdentities)if(b.userIdentities.hasOwnProperty(g)){if(!1===Types.IdentityType.getIdentityType(g))return {valid:!1,error:Constants.Messages.ValidationMessages.UserIdentitiesInvalidKey};if("string"!=typeof b.userIdentities[g]&&null!==b.userIdentities[g])return {valid:!1,error:Constants.Messages.ValidationMessages.UserIdentitiesInvalidValues}}}return {valid:!0}}},this.isDelayedByIntegration=function(b,c,d){if(d-c>a._Store.SDKConfig.integrationDelayTimeout)return !1;for(var e in b){if(!0===b[e])return !0;continue}return !1},this.createMainStorageName=function(a){return a?StorageNames.currentStorageName+"_"+a:StorageNames.currentStorageName},this.createProductStorageName=function(a){return a?StorageNames.currentStorageProductsName+"_"+a:StorageNames.currentStorageProductsName},this.isSlug=function(a){return a===slugify(a)};}
1901
+ )},this.filterUserIdentities=function(a,b){var d=[];if(a&&Object.keys(a).length)for(var e in a)if(a.hasOwnProperty(e)){var f=Types.IdentityType.getIdentityType(e);if(!c.inArray(b,f)){var g={Type:f,Identity:a[e]};f===Types.IdentityType.CustomerId?d.unshift(g):d.push(g);}}return d},this.filterUserIdentitiesForForwarders=function(a,b){var d={};if(a&&Object.keys(a).length)for(var e in a)if(a.hasOwnProperty(e)){var f=Types.IdentityType.getIdentityType(e);c.inArray(b,f)||(d[e]=a[e]);}return d},this.filterUserAttributes=function(a,b){var d={};if(a&&Object.keys(a).length)for(var e in a)if(a.hasOwnProperty(e)){var f=c.generateHash(e);c.inArray(b,f)||(d[e]=a[e]);}return d},this.isEventType=function(a){for(var b in Types.EventType)if(Types.EventType.hasOwnProperty(b)&&Types.EventType[b]===a)return !0;return !1},this.parseStringOrNumber=function(a){return Validators.isStringOrNumber(a)?a:null},this.generateHash=function(a){var b,c=0,d=0;if(void 0===a||null===a)return 0;if(a=a.toString().toLowerCase(),Array.prototype.reduce)return a.split("").reduce(function(c,d){return c=(c<<5)-c+d.charCodeAt(0),c&c},0);if(0===a.length)return c;for(d=0;d<a.length;d++)b=a.charCodeAt(d),c=(c<<5)-c+b,c&=c;return c},this.sanitizeAttributes=function(b,d){if(!b||!c.isObject(b))return null;var e={};for(var f in b)// Make sure that attribute values are not objects or arrays, which are not valid
1902
+ b.hasOwnProperty(f)&&c.Validators.isValidAttributeValue(b[f])?e[f]=b[f]:a.Logger.warning("For '"+d+"', the corresponding attribute value of '"+f+"' must be a string, number, boolean, or null.");return e},this.isDelayedByIntegration=function(b,c,d){if(d-c>a._Store.SDKConfig.integrationDelayTimeout)return !1;for(var e in b){if(!0===b[e])return !0;continue}return !1},this.createMainStorageName=function(a){return a?StorageNames.currentStorageName+"_"+a:StorageNames.currentStorageName},this.createProductStorageName=function(a){return a?StorageNames.currentStorageProductsName+"_"+a:StorageNames.currentStorageProductsName},this.isSlug=function(a){return a===slugify(a)},this.converted=converted,this.findKeyInObject=findKeyInObject,this.parseNumber=parseNumber,this.inArray=inArray,this.isObject=isObject,this.decoded=decoded,this.returnConvertedBoolean=returnConvertedBoolean,this.Validators=Validators;}
1857
1903
 
1858
1904
  var Messages$1=Constants.Messages,androidBridgeNameBase="mParticleAndroid",iosBridgeNameBase="mParticle";function NativeSdkHelpers(a){var b=this;this.isBridgeV2Available=function(a){if(!a)return !1;var b=iosBridgeNameBase+"_"+a+"_v2";// iOS v2 bridge
1859
1905
  return !!(window.webkit&&window.webkit.messageHandlers&&window.webkit.messageHandlers.hasOwnProperty(b))||!!(window.mParticle&&window.mParticle.uiwebviewBridgeName&&window.mParticle.uiwebviewBridgeName===b)||!!window.hasOwnProperty(androidBridgeNameBase+"_"+a+"_v2");// other iOS v2 bridge
@@ -34,7 +34,7 @@ var defineProperty = _defineProperty;
34
34
 
35
35
  var _TriggerUploadType,MessageType={SessionStart:1,SessionEnd:2,PageView:3,PageEvent:4,CrashReport:5,OptOut:6,AppStateTransition:10,Profile:14,Commerce:16,Media:20,UserAttributeChange:17,UserIdentityChange:18},TriggerUploadType=(_TriggerUploadType={},defineProperty(_TriggerUploadType,MessageType.Commerce,1),defineProperty(_TriggerUploadType,MessageType.UserAttributeChange,1),defineProperty(_TriggerUploadType,MessageType.UserIdentityChange,1),_TriggerUploadType),EventType={Unknown:0,Navigation:1,Location:2,Search:3,Transaction:4,UserContent:5,UserPreference:6,Social:7,Other:8,Media:9,getName:function getName(a){return a===EventType.Unknown?"Unknown":a===EventType.Navigation?"Navigation":a===EventType.Location?"Location":a===EventType.Search?"Search":a===EventType.Transaction?"Transaction":a===EventType.UserContent?"User Content":a===EventType.UserPreference?"User Preference":a===EventType.Social?"Social":a===CommerceEventType.ProductAddToCart?"Product Added to Cart":a===CommerceEventType.ProductAddToWishlist?"Product Added to Wishlist":a===CommerceEventType.ProductCheckout?"Product Checkout":a===CommerceEventType.ProductCheckoutOption?"Product Checkout Options":a===CommerceEventType.ProductClick?"Product Click":a===CommerceEventType.ProductImpression?"Product Impression":a===CommerceEventType.ProductPurchase?"Product Purchased":a===CommerceEventType.ProductRefund?"Product Refunded":a===CommerceEventType.ProductRemoveFromCart?"Product Removed From Cart":a===CommerceEventType.ProductRemoveFromWishlist?"Product Removed from Wishlist":a===CommerceEventType.ProductViewDetail?"Product View Details":a===CommerceEventType.PromotionClick?"Promotion Click":a===CommerceEventType.PromotionView?"Promotion View":"Other"}},CommerceEventType={ProductAddToCart:10,ProductRemoveFromCart:11,ProductCheckout:12,ProductCheckoutOption:13,ProductClick:14,ProductViewDetail:15,ProductPurchase:16,ProductRefund:17,PromotionView:18,PromotionClick:19,ProductAddToWishlist:20,ProductRemoveFromWishlist:21,ProductImpression:22},IdentityType={Other:0,CustomerId:1,Facebook:2,Twitter:3,Google:4,Microsoft:5,Yahoo:6,Email:7,FacebookCustomAudienceId:9,Other2:10,Other3:11,Other4:12,Other5:13,Other6:14,Other7:15,Other8:16,Other9:17,Other10:18,MobileNumber:19,PhoneNumber2:20,PhoneNumber3:21};IdentityType.isValid=function(a){if("number"==typeof a)for(var b in IdentityType)if(IdentityType.hasOwnProperty(b)&&IdentityType[b]===a)return !0;return !1},IdentityType.getName=function(a){return a===window.mParticle.IdentityType.CustomerId?"Customer ID":a===window.mParticle.IdentityType.Facebook?"Facebook ID":a===window.mParticle.IdentityType.Twitter?"Twitter ID":a===window.mParticle.IdentityType.Google?"Google ID":a===window.mParticle.IdentityType.Microsoft?"Microsoft ID":a===window.mParticle.IdentityType.Yahoo?"Yahoo ID":a===window.mParticle.IdentityType.Email?"Email":a===window.mParticle.IdentityType.FacebookCustomAudienceId?"Facebook App User ID":"Other ID"},IdentityType.getIdentityType=function(a){return "other"===a?IdentityType.Other:"customerid"===a?IdentityType.CustomerId:"facebook"===a?IdentityType.Facebook:"twitter"===a?IdentityType.Twitter:"google"===a?IdentityType.Google:"microsoft"===a?IdentityType.Microsoft:"yahoo"===a?IdentityType.Yahoo:"email"===a?IdentityType.Email:"facebookcustomaudienceid"===a?IdentityType.FacebookCustomAudienceId:"other2"===a?IdentityType.Other2:"other3"===a?IdentityType.Other3:"other4"===a?IdentityType.Other4:"other5"===a?IdentityType.Other5:"other6"===a?IdentityType.Other6:"other7"===a?IdentityType.Other7:"other8"===a?IdentityType.Other8:"other9"===a?IdentityType.Other9:"other10"===a?IdentityType.Other10:"mobile_number"===a?IdentityType.MobileNumber:"phone_number_2"===a?IdentityType.PhoneNumber2:!("phone_number_3"!=a)&&IdentityType.PhoneNumber3},IdentityType.getIdentityName=function(a){return a===IdentityType.Other?"other":a===IdentityType.CustomerId?"customerid":a===IdentityType.Facebook?"facebook":a===IdentityType.Twitter?"twitter":a===IdentityType.Google?"google":a===IdentityType.Microsoft?"microsoft":a===IdentityType.Yahoo?"yahoo":a===IdentityType.Email?"email":a===IdentityType.FacebookCustomAudienceId?"facebookcustomaudienceid":a===IdentityType.Other2?"other2":a===IdentityType.Other3?"other3":a===IdentityType.Other4?"other4":a===IdentityType.Other5?"other5":a===IdentityType.Other6?"other6":a===IdentityType.Other7?"other7":a===IdentityType.Other8?"other8":a===IdentityType.Other9?"other9":a===IdentityType.Other10?"other10":a===IdentityType.MobileNumber?"mobile_number":a===IdentityType.PhoneNumber2?"phone_number_2":a===IdentityType.PhoneNumber3?"phone_number_3":void 0};var ProductActionType={Unknown:0,AddToCart:1,RemoveFromCart:2,Checkout:3,CheckoutOption:4,Click:5,ViewDetail:6,Purchase:7,Refund:8,AddToWishlist:9,RemoveFromWishlist:10};ProductActionType.getName=function(a){return a===ProductActionType.AddToCart?"Add to Cart":a===ProductActionType.RemoveFromCart?"Remove from Cart":a===ProductActionType.Checkout?"Checkout":a===ProductActionType.CheckoutOption?"Checkout Option":a===ProductActionType.Click?"Click":a===ProductActionType.ViewDetail?"View Detail":a===ProductActionType.Purchase?"Purchase":a===ProductActionType.Refund?"Refund":a===ProductActionType.AddToWishlist?"Add to Wishlist":a===ProductActionType.RemoveFromWishlist?"Remove from Wishlist":"Unknown"},ProductActionType.getExpansionName=function(a){return a===ProductActionType.AddToCart?"add_to_cart":a===ProductActionType.RemoveFromCart?"remove_from_cart":a===ProductActionType.Checkout?"checkout":a===ProductActionType.CheckoutOption?"checkout_option":a===ProductActionType.Click?"click":a===ProductActionType.ViewDetail?"view_detail":a===ProductActionType.Purchase?"purchase":a===ProductActionType.Refund?"refund":a===ProductActionType.AddToWishlist?"add_to_wishlist":a===ProductActionType.RemoveFromWishlist?"remove_from_wishlist":"unknown"};var PromotionActionType={Unknown:0,PromotionView:1,PromotionClick:2};PromotionActionType.getName=function(a){return a===PromotionActionType.PromotionView?"view":a===PromotionActionType.PromotionClick?"click":"unknown"},PromotionActionType.getExpansionName=function(a){return a===PromotionActionType.PromotionView?"view":a===PromotionActionType.PromotionClick?"click":"unknown"};var ProfileMessageType={Logout:3},ApplicationTransitionType={AppInit:1};var Types = {MessageType:MessageType,EventType:EventType,CommerceEventType:CommerceEventType,IdentityType:IdentityType,ProfileMessageType:ProfileMessageType,ApplicationTransitionType:ApplicationTransitionType,ProductActionType:ProductActionType,PromotionActionType:PromotionActionType,TriggerUploadType:TriggerUploadType};
36
36
 
37
- var version = "2.16.0";
37
+ var version = "2.16.1";
38
38
 
39
39
  var Constants = { sdkVersion: version, sdkVendor: "mparticle", platform: "web", Messages: { ErrorMessages: { NoToken: "A token must be specified.", EventNameInvalidType: "Event name must be a valid string value.", EventDataInvalidType: "Event data must be a valid object hash.", LoggingDisabled: "Event logging is currently disabled.", CookieParseError: "Could not parse cookie", EventEmpty: "Event object is null or undefined, cancelling send", APIRequestEmpty: "APIRequest is null or undefined, cancelling send", NoEventType: "Event type must be specified.", TransactionIdRequired: "Transaction ID is required", TransactionRequired: "A transaction attributes object is required", PromotionIdRequired: "Promotion ID is required", BadAttribute: "Attribute value cannot be object or array", BadKey: "Key value cannot be object or array", BadLogPurchase: "Transaction attributes and a product are both required to log a purchase, https://docs.mparticle.com/?javascript#measuring-transactions" }, InformationMessages: { CookieSearch: "Searching for cookie", CookieFound: "Cookie found, parsing values", CookieNotFound: "Cookies not found", CookieSet: "Setting cookie", CookieSync: "Performing cookie sync", SendBegin: "Starting to send event", SendIdentityBegin: "Starting to send event to identity server", SendWindowsPhone: "Sending event to Windows Phone container", SendIOS: "Calling iOS path: ", SendAndroid: "Calling Android JS interface method: ", SendHttp: "Sending event to mParticle HTTP service", SendAliasHttp: "Sending alias request to mParticle HTTP service", SendIdentityHttp: "Sending event to mParticle HTTP service", StartingNewSession: "Starting new Session", StartingLogEvent: "Starting to log event", StartingLogOptOut: "Starting to log user opt in/out", StartingEndSession: "Starting to end session", StartingInitialization: "Starting to initialize", StartingLogCommerceEvent: "Starting to log commerce event", StartingAliasRequest: "Starting to Alias MPIDs", LoadingConfig: "Loading configuration options", AbandonLogEvent: "Cannot log event, logging disabled or developer token not set", AbandonAliasUsers: "Cannot Alias Users, logging disabled or developer token not set", AbandonStartSession: "Cannot start session, logging disabled or developer token not set", AbandonEndSession: "Cannot end session, logging disabled or developer token not set", NoSessionToEnd: "Cannot end session, no active session found" }, ValidationMessages: { ModifyIdentityRequestUserIdentitiesPresent: "identityRequests to modify require userIdentities to be present. Request not sent to server. Please fix and try again", IdentityRequesetInvalidKey: "There is an invalid key on your identityRequest object. It can only contain a `userIdentities` object and a `onUserAlias` function. Request not sent to server. Please fix and try again.", OnUserAliasType: "The onUserAlias value must be a function. The onUserAlias provided is of type", UserIdentities: "The userIdentities key must be an object with keys of identityTypes and values of strings. Request not sent to server. Please fix and try again.", UserIdentitiesInvalidKey: "There is an invalid identity key on your `userIdentities` object within the identityRequest. Request not sent to server. Please fix and try again.", UserIdentitiesInvalidValues: "All user identity values must be strings or null. Request not sent to server. Please fix and try again.", AliasMissingMpid: "Alias Request must contain both a destinationMpid and a sourceMpid", AliasNonUniqueMpid: "Alias Request's destinationMpid and sourceMpid must be unique", AliasMissingTime: "Alias Request must have both a startTime and an endTime", AliasStartBeforeEndTime: "Alias Request's endTime must be later than its startTime" } }, NativeSdkPaths: { LogEvent: "logEvent", SetUserTag: "setUserTag", RemoveUserTag: "removeUserTag", SetUserAttribute: "setUserAttribute", RemoveUserAttribute: "removeUserAttribute", SetSessionAttribute: "setSessionAttribute", AddToCart: "addToCart", RemoveFromCart: "removeFromCart", ClearCart: "clearCart", LogOut: "logOut", SetUserAttributeList: "setUserAttributeList", RemoveAllUserAttributes: "removeAllUserAttributes", GetUserAttributesLists: "getUserAttributesLists", GetAllUserAttributes: "getAllUserAttributes", Identify: "identify", Logout: "logout", Login: "login", Modify: "modify", Alias: "aliasUsers", Upload: "upload" }, StorageNames: { localStorageName: "mprtcl-api",
40
40
  localStorageNameV3: "mprtcl-v3",
@@ -1829,10 +1829,59 @@ var slugify = createCommonjsModule(function (module, exports) {
1829
1829
  }));
1830
1830
  });
1831
1831
 
1832
- var StorageNames=Constants.StorageNames,pluses=/\+/g;function Helpers(a){function b(b){var a;return window.crypto&&window.crypto.getRandomValues&&(a=window.crypto.getRandomValues(new Uint8Array(1))),a?(b^a[0]%16>>b/4).toString(16):(b^16*Math.random()>>b/4).toString(16)}var c=this;/**
1832
+ function _readOnlyError(name) {
1833
+ throw new Error("\"" + name + "\" is read-only");
1834
+ }
1835
+
1836
+ var readOnlyError = _readOnlyError;
1837
+
1838
+ var inArray = function (a, b) { var c = 0; if (Array.prototype.indexOf)
1839
+ return 0 <= a.indexOf(b, 0); for (var d = a.length; c < d; readOnlyError("i"))
1840
+ if (c in a && a[c] === b)
1841
+ return !0; return !1; }, findKeyInObject = function (a, b) { if (b && a)
1842
+ for (var c in a)
1843
+ if (a.hasOwnProperty(c) && c.toLowerCase() === b.toLowerCase())
1844
+ return c; return null; }, 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))
1845
+ return 0; var b = parseFloat(a); return isNaN(b) ? 0 : b; }, 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; };
1846
+
1847
+ var Validators = { isValidAttributeValue: function isValidAttributeValue(a) { return a !== void 0 && !isObject(a) && !Array.isArray(a); },
1848
+ isValidKeyValue: function isValidKeyValue(a) { return !(!a || isObject(a) || Array.isArray(a) || this.isFunction(a)); }, isStringOrNumber: function isStringOrNumber(a) { return "string" == typeof a || "number" == typeof a; }, isNumber: function isNumber(a) { return "number" == typeof a; }, isFunction: function isFunction(a) { return "function" == typeof a; }, validateIdentities: function validateIdentities(a, b) {
1849
+ var c = { userIdentities: 1, onUserAlias: 1, copyUserAttributes: 1 };
1850
+ if (a) {
1851
+ if ("modify" === b && (isObject(a.userIdentities) && !Object.keys(a.userIdentities).length || !isObject(a.userIdentities)))
1852
+ return { valid: !1, error: Constants.Messages.ValidationMessages.ModifyIdentityRequestUserIdentitiesPresent };
1853
+ for (var d in a)
1854
+ if (a.hasOwnProperty(d)) {
1855
+ if (!c[d])
1856
+ return { valid: !1, error: Constants.Messages.ValidationMessages.IdentityRequesetInvalidKey };
1857
+ if ("onUserAlias" === d && !Validators.isFunction(a[d]))
1858
+ return { valid: !1,
1859
+ error: Constants.Messages.ValidationMessages.OnUserAliasType + _typeof_1(a[d]) };
1860
+ }
1861
+ if (0 === Object.keys(a).length)
1862
+ return { valid: !0 }; // identityApiData.userIdentities can't be undefined
1863
+ if (void 0 === a.userIdentities)
1864
+ return { valid: !1, error: Constants.Messages.ValidationMessages.UserIdentities }; // identityApiData.userIdentities can be null, but if it isn't null or undefined (above conditional), it must be an object
1865
+ if (null !== a.userIdentities && !isObject(a.userIdentities))
1866
+ return { valid: !1, error: Constants.Messages.ValidationMessages.UserIdentities };
1867
+ if (isObject(a.userIdentities) && Object.keys(a.userIdentities).length)
1868
+ for (var e in a.userIdentities)
1869
+ if (a.userIdentities.hasOwnProperty(e)) {
1870
+ if (!1 === Types.IdentityType.getIdentityType(e))
1871
+ return { valid: !1, error: Constants.Messages.ValidationMessages.UserIdentitiesInvalidKey };
1872
+ if ("string" != typeof a.userIdentities[e] && null !== a.userIdentities[e])
1873
+ return { valid: !1, error: Constants.Messages.ValidationMessages.UserIdentitiesInvalidValues };
1874
+ }
1875
+ }
1876
+ return { valid: !0 };
1877
+ } };
1878
+
1879
+ var StorageNames=Constants.StorageNames;function Helpers(a){function b(b){var a;return window.crypto&&window.crypto.getRandomValues&&(a=window.crypto.getRandomValues(new Uint8Array(1))),a?(b^a[0]%16>>b/4).toString(16):(b^16*Math.random()>>b/4).toString(16)}var c=this;/**
1833
1880
  * Returns a value between 1-100 inclusive.
1834
1881
  */ // Standalone version of jQuery.extend, from https://github.com/dansdom/extend
1835
- this.canLog=function(){return !!(a._Store.isEnabled&&(a._Store.devToken||a._Store.webviewBridgeEnabled))},this.returnConvertedBoolean=function(a){return "false"!==a&&"0"!==a&&!!a},this.getFeatureFlag=function(b){return a._Store.SDKConfig.flags.hasOwnProperty(b)?a._Store.SDKConfig.flags[b]:null},this.getRampNumber=function(a){if(!a)return 100;var b=c.generateHash(a);return Math.abs(b%100)+1},this.invokeCallback=function(b,d,e,f,g){b||a.Logger.warning("There is no callback provided");try{c.Validators.isFunction(b)&&b({httpCode:d,body:e,getUser:function getUser(){return f?f:a.Identity.getCurrentUser()},getPreviousUser:function getPreviousUser(){if(!g){var b=a.Identity.getUsers(),c=b.shift(),d=f||a.Identity.getCurrentUser();return c&&d&&c.getMPID()===d.getMPID()&&(c=b.shift()),c||null}return a.Identity.getUser(g)}});}catch(b){a.Logger.error("There was an error with your callback: "+b);}},this.invokeAliasCallback=function(b,d,e){b||a.Logger.warning("There is no callback provided");try{if(c.Validators.isFunction(b)){var f={httpCode:d};e&&(f.message=e),b(f);}}catch(b){a.Logger.error("There was an error with your callback: "+b);}},this.extend=function(){var a,b,d,e,f,g,h=arguments[0]||{},j=1,k=arguments.length,l=!1,// helper which replicates the jquery internal functions
1882
+ // Utility Functions
1883
+ // Imported Validators
1884
+ this.canLog=function(){return !!(a._Store.isEnabled&&(a._Store.devToken||a._Store.webviewBridgeEnabled))},this.getFeatureFlag=function(b){return a._Store.SDKConfig.flags.hasOwnProperty(b)?a._Store.SDKConfig.flags[b]:null},this.getRampNumber=function(a){if(!a)return 100;var b=c.generateHash(a);return Math.abs(b%100)+1},this.invokeCallback=function(b,d,e,f,g){b||a.Logger.warning("There is no callback provided");try{c.Validators.isFunction(b)&&b({httpCode:d,body:e,getUser:function getUser(){return f?f:a.Identity.getCurrentUser()},getPreviousUser:function getPreviousUser(){if(!g){var b=a.Identity.getUsers(),c=b.shift(),d=f||a.Identity.getCurrentUser();return c&&d&&c.getMPID()===d.getMPID()&&(c=b.shift()),c||null}return a.Identity.getUser(g)}});}catch(b){a.Logger.error("There was an error with your callback: "+b);}},this.invokeAliasCallback=function(b,d,e){b||a.Logger.warning("There is no callback provided");try{if(c.Validators.isFunction(b)){var f={httpCode:d};e&&(f.message=e),b(f);}}catch(b){a.Logger.error("There was an error with your callback: "+b);}},this.extend=function(){var a,b,d,e,f,g,h=arguments[0]||{},j=1,k=arguments.length,l=!1,// helper which replicates the jquery internal functions
1836
1885
  m={hasOwn:Object.prototype.hasOwnProperty,class2type:{},type:function type(a){return null==a?a+"":m.class2type[Object.prototype.toString.call(a)]||"object"},isPlainObject:function isPlainObject(a){if(!a||"object"!==m.type(a)||a.nodeType||m.isWindow(a))return !1;try{if(a.constructor&&!m.hasOwn.call(a,"constructor")&&!m.hasOwn.call(a.constructor.prototype,"isPrototypeOf"))return !1}catch(a){return !1}for(var b in a);// eslint-disable-line no-empty
1837
1886
  return b===void 0||m.hasOwn.call(a,b)},isArray:Array.isArray||function(a){return "array"===m.type(a)},isFunction:function isFunction(a){return "function"===m.type(a)},isWindow:function isWindow(a){return null!=a&&a==a.window}};// end of objectHelper
1838
1887
  // Handle a deep copy situation
@@ -1841,7 +1890,7 @@ if(null!=(a=arguments[j]))// Extend the base object
1841
1890
  for(b in a)// Prevent never-ending loop
1842
1891
  (d=h[b],e=a[b],h!==e)&&(l&&e&&(m.isPlainObject(e)||(f=m.isArray(e)))?(f?(f=!1,g=d&&m.isArray(d)?d:[]):g=d&&m.isPlainObject(d)?d:{},h[b]=c.extend(l,g,e)):void 0!==e&&(h[b]=e));// Recurse if we're merging plain objects or arrays
1843
1892
  // Return the modified object
1844
- return h},this.isObject=function(a){var b=Object.prototype.toString.call(a);return "[object Object]"===b||"[object Error]"===b},this.inArray=function(a,b){var c=0;if(Array.prototype.indexOf)return 0<=a.indexOf(b,0);for(var d=a.length;c<d;c++)if(c in a&&a[c]===b)return !0},this.createServiceUrl=function(b,c){var d,e=window.mParticle&&a._Store.SDKConfig.forceHttps?"https://":window.location.protocol+"//";return d=a._Store.SDKConfig.forceHttps?"https://"+b:e+b,c&&(d+=c),d},this.createXHR=function(b){var c;try{c=new window.XMLHttpRequest;}catch(b){a.Logger.error("Error creating XMLHttpRequest object.");}if(c&&b&&"withCredentials"in c)c.onreadystatechange=b;else if("undefined"!=typeof window.XDomainRequest){a.Logger.verbose("Creating XDomainRequest object");try{c=new window.XDomainRequest,c.onload=b;}catch(b){a.Logger.error("Error creating XDomainRequest object");}}return c},this.generateUniqueId=function(d){// https://gist.github.com/jed/982883
1893
+ return h},this.createServiceUrl=function(b,c){var d,e=window.mParticle&&a._Store.SDKConfig.forceHttps?"https://":window.location.protocol+"//";return d=a._Store.SDKConfig.forceHttps?"https://"+b:e+b,c&&(d+=c),d},this.createXHR=function(b){var c;try{c=new window.XMLHttpRequest;}catch(b){a.Logger.error("Error creating XMLHttpRequest object.");}if(c&&b&&"withCredentials"in c)c.onreadystatechange=b;else if("undefined"!=typeof window.XDomainRequest){a.Logger.verbose("Creating XDomainRequest object");try{c=new window.XDomainRequest,c.onload=b;}catch(b){a.Logger.error("Error creating XDomainRequest object");}}return c},this.generateUniqueId=function(d){// https://gist.github.com/jed/982883
1845
1894
  // Added support for crypto for better random
1846
1895
  return d// if the placeholder was passed, return
1847
1896
  ?b(d)// a random number
@@ -1849,11 +1898,8 @@ return d// if the placeholder was passed, return
1849
1898
  "10000000-1000-4000-8000-100000000000".replace(// replacing
1850
1899
  /[018]/g,// zeroes, ones, and eights with
1851
1900
  c.generateUniqueId// random hex digits
1852
- )},this.filterUserIdentities=function(a,b){var d=[];if(a&&Object.keys(a).length)for(var e in a)if(a.hasOwnProperty(e)){var f=Types.IdentityType.getIdentityType(e);if(!c.inArray(b,f)){var g={Type:f,Identity:a[e]};f===Types.IdentityType.CustomerId?d.unshift(g):d.push(g);}}return d},this.filterUserIdentitiesForForwarders=function(a,b){var d={};if(a&&Object.keys(a).length)for(var e in a)if(a.hasOwnProperty(e)){var f=Types.IdentityType.getIdentityType(e);c.inArray(b,f)||(d[e]=a[e]);}return d},this.filterUserAttributes=function(a,b){var d={};if(a&&Object.keys(a).length)for(var e in a)if(a.hasOwnProperty(e)){var f=c.generateHash(e);c.inArray(b,f)||(d[e]=a[e]);}return d},this.findKeyInObject=function(a,b){if(b&&a)for(var c in a)if(a.hasOwnProperty(c)&&c.toLowerCase()===b.toLowerCase())return c;return null},this.decoded=function(a){return decodeURIComponent(a.replace(pluses," "))},this.converted=function(a){return 0===a.indexOf("\"")&&(a=a.slice(1,-1).replace(/\\"/g,"\"").replace(/\\\\/g,"\\")),a},this.isEventType=function(a){for(var b in Types.EventType)if(Types.EventType.hasOwnProperty(b)&&Types.EventType[b]===a)return !0;return !1},this.parseNumber=function(a){if(isNaN(a)||!isFinite(a))return 0;var b=parseFloat(a);return isNaN(b)?0:b},this.parseStringOrNumber=function(a){return c.Validators.isStringOrNumber(a)?a:null},this.generateHash=function(a){var b,c=0,d=0;if(void 0===a||null===a)return 0;if(a=a.toString().toLowerCase(),Array.prototype.reduce)return a.split("").reduce(function(c,d){return c=(c<<5)-c+d.charCodeAt(0),c&c},0);if(0===a.length)return c;for(d=0;d<a.length;d++)b=a.charCodeAt(d),c=(c<<5)-c+b,c&=c;return c},this.sanitizeAttributes=function(b,d){if(!b||!c.isObject(b))return null;var e={};for(var f in b)// Make sure that attribute values are not objects or arrays, which are not valid
1853
- b.hasOwnProperty(f)&&c.Validators.isValidAttributeValue(b[f])?e[f]=b[f]:a.Logger.warning("For '"+d+"', the corresponding attribute value of '"+f+"' must be a string, number, boolean, or null.");return e},this.Validators={isValidAttributeValue:function isValidAttributeValue(a){return a!==void 0&&!c.isObject(a)&&!Array.isArray(a)},// Neither null nor undefined can be a valid Key
1854
- isValidKeyValue:function isValidKeyValue(a){return !(!a||c.isObject(a)||Array.isArray(a))},isStringOrNumber:function isStringOrNumber(a){return "string"==typeof a||"number"==typeof a},isNumber:function isNumber(a){return "number"==typeof a},isFunction:function isFunction(a){return "function"==typeof a},validateIdentities:function validateIdentities(b,d){var e={userIdentities:1,onUserAlias:1,copyUserAttributes:1};if(b){if("modify"===d&&(c.isObject(b.userIdentities)&&!Object.keys(b.userIdentities).length||!c.isObject(b.userIdentities)))return {valid:!1,error:Constants.Messages.ValidationMessages.ModifyIdentityRequestUserIdentitiesPresent};for(var f in b)if(b.hasOwnProperty(f)){if(!e[f])return {valid:!1,error:Constants.Messages.ValidationMessages.IdentityRequesetInvalidKey};if("onUserAlias"===f&&!a._Helpers.Validators.isFunction(b[f]))return {valid:!1,error:Constants.Messages.ValidationMessages.OnUserAliasType+_typeof_1(b[f])}}if(0===Object.keys(b).length)return {valid:!0};// identityApiData.userIdentities can't be undefined
1855
- if(void 0===b.userIdentities)return {valid:!1,error:Constants.Messages.ValidationMessages.UserIdentities};// identityApiData.userIdentities can be null, but if it isn't null or undefined (above conditional), it must be an object
1856
- if(null!==b.userIdentities&&!c.isObject(b.userIdentities))return {valid:!1,error:Constants.Messages.ValidationMessages.UserIdentities};if(c.isObject(b.userIdentities)&&Object.keys(b.userIdentities).length)for(var g in b.userIdentities)if(b.userIdentities.hasOwnProperty(g)){if(!1===Types.IdentityType.getIdentityType(g))return {valid:!1,error:Constants.Messages.ValidationMessages.UserIdentitiesInvalidKey};if("string"!=typeof b.userIdentities[g]&&null!==b.userIdentities[g])return {valid:!1,error:Constants.Messages.ValidationMessages.UserIdentitiesInvalidValues}}}return {valid:!0}}},this.isDelayedByIntegration=function(b,c,d){if(d-c>a._Store.SDKConfig.integrationDelayTimeout)return !1;for(var e in b){if(!0===b[e])return !0;continue}return !1},this.createMainStorageName=function(a){return a?StorageNames.currentStorageName+"_"+a:StorageNames.currentStorageName},this.createProductStorageName=function(a){return a?StorageNames.currentStorageProductsName+"_"+a:StorageNames.currentStorageProductsName},this.isSlug=function(a){return a===slugify(a)};}
1901
+ )},this.filterUserIdentities=function(a,b){var d=[];if(a&&Object.keys(a).length)for(var e in a)if(a.hasOwnProperty(e)){var f=Types.IdentityType.getIdentityType(e);if(!c.inArray(b,f)){var g={Type:f,Identity:a[e]};f===Types.IdentityType.CustomerId?d.unshift(g):d.push(g);}}return d},this.filterUserIdentitiesForForwarders=function(a,b){var d={};if(a&&Object.keys(a).length)for(var e in a)if(a.hasOwnProperty(e)){var f=Types.IdentityType.getIdentityType(e);c.inArray(b,f)||(d[e]=a[e]);}return d},this.filterUserAttributes=function(a,b){var d={};if(a&&Object.keys(a).length)for(var e in a)if(a.hasOwnProperty(e)){var f=c.generateHash(e);c.inArray(b,f)||(d[e]=a[e]);}return d},this.isEventType=function(a){for(var b in Types.EventType)if(Types.EventType.hasOwnProperty(b)&&Types.EventType[b]===a)return !0;return !1},this.parseStringOrNumber=function(a){return Validators.isStringOrNumber(a)?a:null},this.generateHash=function(a){var b,c=0,d=0;if(void 0===a||null===a)return 0;if(a=a.toString().toLowerCase(),Array.prototype.reduce)return a.split("").reduce(function(c,d){return c=(c<<5)-c+d.charCodeAt(0),c&c},0);if(0===a.length)return c;for(d=0;d<a.length;d++)b=a.charCodeAt(d),c=(c<<5)-c+b,c&=c;return c},this.sanitizeAttributes=function(b,d){if(!b||!c.isObject(b))return null;var e={};for(var f in b)// Make sure that attribute values are not objects or arrays, which are not valid
1902
+ b.hasOwnProperty(f)&&c.Validators.isValidAttributeValue(b[f])?e[f]=b[f]:a.Logger.warning("For '"+d+"', the corresponding attribute value of '"+f+"' must be a string, number, boolean, or null.");return e},this.isDelayedByIntegration=function(b,c,d){if(d-c>a._Store.SDKConfig.integrationDelayTimeout)return !1;for(var e in b){if(!0===b[e])return !0;continue}return !1},this.createMainStorageName=function(a){return a?StorageNames.currentStorageName+"_"+a:StorageNames.currentStorageName},this.createProductStorageName=function(a){return a?StorageNames.currentStorageProductsName+"_"+a:StorageNames.currentStorageProductsName},this.isSlug=function(a){return a===slugify(a)},this.converted=converted,this.findKeyInObject=findKeyInObject,this.parseNumber=parseNumber,this.inArray=inArray,this.isObject=isObject,this.decoded=decoded,this.returnConvertedBoolean=returnConvertedBoolean,this.Validators=Validators;}
1857
1903
 
1858
1904
  var Messages$1=Constants.Messages,androidBridgeNameBase="mParticleAndroid",iosBridgeNameBase="mParticle";function NativeSdkHelpers(a){var b=this;this.isBridgeV2Available=function(a){if(!a)return !1;var b=iosBridgeNameBase+"_"+a+"_v2";// iOS v2 bridge
1859
1905
  return !!(window.webkit&&window.webkit.messageHandlers&&window.webkit.messageHandlers.hasOwnProperty(b))||!!(window.mParticle&&window.mParticle.uiwebviewBridgeName&&window.mParticle.uiwebviewBridgeName===b)||!!window.hasOwnProperty(androidBridgeNameBase+"_"+a+"_v2");// other iOS v2 bridge
package/dist/mparticle.js CHANGED
@@ -721,7 +721,7 @@ var mParticle = (function () {
721
721
  TriggerUploadType: TriggerUploadType
722
722
  };
723
723
 
724
- var version = "2.16.0";
724
+ var version = "2.16.1";
725
725
 
726
726
  var Constants = {
727
727
  sdkVersion: version,
@@ -3643,8 +3643,163 @@ var mParticle = (function () {
3643
3643
  }));
3644
3644
  });
3645
3645
 
3646
- var StorageNames = Constants.StorageNames,
3647
- pluses = /\+/g;
3646
+ function _readOnlyError(name) {
3647
+ throw new Error("\"" + name + "\" is read-only");
3648
+ }
3649
+
3650
+ var readOnlyError = _readOnlyError;
3651
+
3652
+ var inArray = function inArray(items, name) {
3653
+ var i = 0;
3654
+ if (Array.prototype.indexOf) {
3655
+ return items.indexOf(name, 0) >= 0;
3656
+ }
3657
+ else {
3658
+ for (var n = items.length; i < n; readOnlyError("i")) {
3659
+ if (i in items && items[i] === name) {
3660
+ return true;
3661
+ }
3662
+ }
3663
+ }
3664
+ return false;
3665
+ };
3666
+ var findKeyInObject = function findKeyInObject(obj, key) {
3667
+ if (key && obj) {
3668
+ for (var prop in obj) {
3669
+ if (obj.hasOwnProperty(prop) && prop.toLowerCase() === key.toLowerCase()) {
3670
+ return prop;
3671
+ }
3672
+ }
3673
+ }
3674
+ return null;
3675
+ };
3676
+ var isObject = function isObject(value) {
3677
+ var objType = Object.prototype.toString.call(value);
3678
+ return objType === '[object Object]' || objType === '[object Error]';
3679
+ };
3680
+ var parseNumber = function parseNumber(value) {
3681
+ if (isNaN(value) || !isFinite(value)) {
3682
+ return 0;
3683
+ }
3684
+ var floatValue = parseFloat(value);
3685
+ return isNaN(floatValue) ? 0 : floatValue;
3686
+ }; // FIXME: REFACTOR for V3
3687
+ // only used in store.js to sanitize server-side formatting of
3688
+ // booleans when checking for `isDevelopmentMode`
3689
+ // Should be removed in v3
3690
+ var returnConvertedBoolean = function returnConvertedBoolean(data) {
3691
+ if (data === 'false' || data === '0') {
3692
+ return false;
3693
+ }
3694
+ else {
3695
+ return Boolean(data);
3696
+ }
3697
+ };
3698
+ var decoded = function decoded(s) {
3699
+ return decodeURIComponent(s.replace(/\+/g, ' '));
3700
+ };
3701
+ var converted = function converted(s) {
3702
+ if (s.indexOf('"') === 0) {
3703
+ s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
3704
+ }
3705
+ return s;
3706
+ };
3707
+
3708
+ var Validators = {
3709
+ isValidAttributeValue: function isValidAttributeValue(value) {
3710
+ return value !== undefined && !isObject(value) && !Array.isArray(value);
3711
+ },
3712
+ // Neither null nor undefined can be a valid Key
3713
+ isValidKeyValue: function isValidKeyValue(key) {
3714
+ return Boolean(key && !isObject(key) && !Array.isArray(key) && !this.isFunction(key));
3715
+ },
3716
+ isStringOrNumber: function isStringOrNumber(value) {
3717
+ return typeof value === 'string' || typeof value === 'number';
3718
+ },
3719
+ isNumber: function isNumber(value) {
3720
+ return typeof value === 'number';
3721
+ },
3722
+ isFunction: function isFunction(fn) {
3723
+ return typeof fn === 'function';
3724
+ },
3725
+ validateIdentities: function validateIdentities(identityApiData, method) {
3726
+ var validIdentityRequestKeys = {
3727
+ userIdentities: 1,
3728
+ onUserAlias: 1,
3729
+ copyUserAttributes: 1
3730
+ };
3731
+ if (identityApiData) {
3732
+ if (method === 'modify') {
3733
+ if (isObject(identityApiData.userIdentities) && !Object.keys(identityApiData.userIdentities).length || !isObject(identityApiData.userIdentities)) {
3734
+ return {
3735
+ valid: false,
3736
+ error: Constants.Messages.ValidationMessages.ModifyIdentityRequestUserIdentitiesPresent
3737
+ };
3738
+ }
3739
+ }
3740
+ for (var key in identityApiData) {
3741
+ if (identityApiData.hasOwnProperty(key)) {
3742
+ if (!validIdentityRequestKeys[key]) {
3743
+ return {
3744
+ valid: false,
3745
+ error: Constants.Messages.ValidationMessages.IdentityRequesetInvalidKey
3746
+ };
3747
+ }
3748
+ if (key === 'onUserAlias' && !Validators.isFunction(identityApiData[key])) {
3749
+ return {
3750
+ valid: false,
3751
+ // FIXME: Validates type safety
3752
+ error: Constants.Messages.ValidationMessages.OnUserAliasType + _typeof_1(identityApiData[key])
3753
+ };
3754
+ }
3755
+ }
3756
+ }
3757
+ if (Object.keys(identityApiData).length === 0) {
3758
+ return {
3759
+ valid: true
3760
+ };
3761
+ }
3762
+ else {
3763
+ // identityApiData.userIdentities can't be undefined
3764
+ if (identityApiData.userIdentities === undefined) {
3765
+ return {
3766
+ valid: false,
3767
+ error: Constants.Messages.ValidationMessages.UserIdentities
3768
+ }; // identityApiData.userIdentities can be null, but if it isn't null or undefined (above conditional), it must be an object
3769
+ }
3770
+ else if (identityApiData.userIdentities !== null && !isObject(identityApiData.userIdentities)) {
3771
+ return {
3772
+ valid: false,
3773
+ error: Constants.Messages.ValidationMessages.UserIdentities
3774
+ };
3775
+ }
3776
+ if (isObject(identityApiData.userIdentities) && Object.keys(identityApiData.userIdentities).length) {
3777
+ for (var identityType in identityApiData.userIdentities) {
3778
+ if (identityApiData.userIdentities.hasOwnProperty(identityType)) {
3779
+ if (Types.IdentityType.getIdentityType(identityType) === false) {
3780
+ return {
3781
+ valid: false,
3782
+ error: Constants.Messages.ValidationMessages.UserIdentitiesInvalidKey
3783
+ };
3784
+ }
3785
+ if (!(typeof identityApiData.userIdentities[identityType] === 'string' || identityApiData.userIdentities[identityType] === null)) {
3786
+ return {
3787
+ valid: false,
3788
+ error: Constants.Messages.ValidationMessages.UserIdentitiesInvalidValues
3789
+ };
3790
+ }
3791
+ }
3792
+ }
3793
+ }
3794
+ }
3795
+ }
3796
+ return {
3797
+ valid: true
3798
+ };
3799
+ }
3800
+ };
3801
+
3802
+ var StorageNames = Constants.StorageNames;
3648
3803
  function Helpers(mpInstance) {
3649
3804
  var self = this;
3650
3805
 
@@ -3656,14 +3811,6 @@ var mParticle = (function () {
3656
3811
  return false;
3657
3812
  };
3658
3813
 
3659
- this.returnConvertedBoolean = function (data) {
3660
- if (data === 'false' || data === '0') {
3661
- return false;
3662
- } else {
3663
- return Boolean(data);
3664
- }
3665
- };
3666
-
3667
3814
  this.getFeatureFlag = function (feature) {
3668
3815
  if (mpInstance._Store.SDKConfig.flags.hasOwnProperty(feature)) {
3669
3816
  return mpInstance._Store.SDKConfig.flags[feature];
@@ -3849,25 +3996,6 @@ var mParticle = (function () {
3849
3996
  return target;
3850
3997
  };
3851
3998
 
3852
- this.isObject = function (value) {
3853
- var objType = Object.prototype.toString.call(value);
3854
- return objType === '[object Object]' || objType === '[object Error]';
3855
- };
3856
-
3857
- this.inArray = function (items, name) {
3858
- var i = 0;
3859
-
3860
- if (Array.prototype.indexOf) {
3861
- return items.indexOf(name, 0) >= 0;
3862
- } else {
3863
- for (var n = items.length; i < n; i++) {
3864
- if (i in items && items[i] === name) {
3865
- return true;
3866
- }
3867
- }
3868
- }
3869
- };
3870
-
3871
3999
  this.createServiceUrl = function (secureServiceUrl, devToken) {
3872
4000
  var serviceScheme = window.mParticle && mpInstance._Store.SDKConfig.forceHttps ? 'https://' : window.location.protocol + '//';
3873
4001
  var baseUrl;
@@ -4003,30 +4131,6 @@ var mParticle = (function () {
4003
4131
  return filteredUserAttributes;
4004
4132
  };
4005
4133
 
4006
- this.findKeyInObject = function (obj, key) {
4007
- if (key && obj) {
4008
- for (var prop in obj) {
4009
- if (obj.hasOwnProperty(prop) && prop.toLowerCase() === key.toLowerCase()) {
4010
- return prop;
4011
- }
4012
- }
4013
- }
4014
-
4015
- return null;
4016
- };
4017
-
4018
- this.decoded = function (s) {
4019
- return decodeURIComponent(s.replace(pluses, ' '));
4020
- };
4021
-
4022
- this.converted = function (s) {
4023
- if (s.indexOf('"') === 0) {
4024
- s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
4025
- }
4026
-
4027
- return s;
4028
- };
4029
-
4030
4134
  this.isEventType = function (type) {
4031
4135
  for (var prop in Types.EventType) {
4032
4136
  if (Types.EventType.hasOwnProperty(prop)) {
@@ -4039,17 +4143,8 @@ var mParticle = (function () {
4039
4143
  return false;
4040
4144
  };
4041
4145
 
4042
- this.parseNumber = function (value) {
4043
- if (isNaN(value) || !isFinite(value)) {
4044
- return 0;
4045
- }
4046
-
4047
- var floatValue = parseFloat(value);
4048
- return isNaN(floatValue) ? 0 : floatValue;
4049
- };
4050
-
4051
4146
  this.parseStringOrNumber = function (value) {
4052
- if (self.Validators.isStringOrNumber(value)) {
4147
+ if (Validators.isStringOrNumber(value)) {
4053
4148
  return value;
4054
4149
  } else {
4055
4150
  return null;
@@ -4106,104 +4201,6 @@ var mParticle = (function () {
4106
4201
  return sanitizedAttrs;
4107
4202
  };
4108
4203
 
4109
- this.Validators = {
4110
- isValidAttributeValue: function isValidAttributeValue(value) {
4111
- return value !== undefined && !self.isObject(value) && !Array.isArray(value);
4112
- },
4113
- // Neither null nor undefined can be a valid Key
4114
- isValidKeyValue: function isValidKeyValue(key) {
4115
- return Boolean(key && !self.isObject(key) && !Array.isArray(key));
4116
- },
4117
- isStringOrNumber: function isStringOrNumber(value) {
4118
- return typeof value === 'string' || typeof value === 'number';
4119
- },
4120
- isNumber: function isNumber(value) {
4121
- return typeof value === 'number';
4122
- },
4123
- isFunction: function isFunction(fn) {
4124
- return typeof fn === 'function';
4125
- },
4126
- validateIdentities: function validateIdentities(identityApiData, method) {
4127
- var validIdentityRequestKeys = {
4128
- userIdentities: 1,
4129
- onUserAlias: 1,
4130
- copyUserAttributes: 1
4131
- };
4132
-
4133
- if (identityApiData) {
4134
- if (method === 'modify') {
4135
- if (self.isObject(identityApiData.userIdentities) && !Object.keys(identityApiData.userIdentities).length || !self.isObject(identityApiData.userIdentities)) {
4136
- return {
4137
- valid: false,
4138
- error: Constants.Messages.ValidationMessages.ModifyIdentityRequestUserIdentitiesPresent
4139
- };
4140
- }
4141
- }
4142
-
4143
- for (var key in identityApiData) {
4144
- if (identityApiData.hasOwnProperty(key)) {
4145
- if (!validIdentityRequestKeys[key]) {
4146
- return {
4147
- valid: false,
4148
- error: Constants.Messages.ValidationMessages.IdentityRequesetInvalidKey
4149
- };
4150
- }
4151
-
4152
- if (key === 'onUserAlias' && !mpInstance._Helpers.Validators.isFunction(identityApiData[key])) {
4153
- return {
4154
- valid: false,
4155
- error: Constants.Messages.ValidationMessages.OnUserAliasType + _typeof_1(identityApiData[key])
4156
- };
4157
- }
4158
- }
4159
- }
4160
-
4161
- if (Object.keys(identityApiData).length === 0) {
4162
- return {
4163
- valid: true
4164
- };
4165
- } else {
4166
- // identityApiData.userIdentities can't be undefined
4167
- if (identityApiData.userIdentities === undefined) {
4168
- return {
4169
- valid: false,
4170
- error: Constants.Messages.ValidationMessages.UserIdentities
4171
- }; // identityApiData.userIdentities can be null, but if it isn't null or undefined (above conditional), it must be an object
4172
- } else if (identityApiData.userIdentities !== null && !self.isObject(identityApiData.userIdentities)) {
4173
- return {
4174
- valid: false,
4175
- error: Constants.Messages.ValidationMessages.UserIdentities
4176
- };
4177
- }
4178
-
4179
- if (self.isObject(identityApiData.userIdentities) && Object.keys(identityApiData.userIdentities).length) {
4180
- for (var identityType in identityApiData.userIdentities) {
4181
- if (identityApiData.userIdentities.hasOwnProperty(identityType)) {
4182
- if (Types.IdentityType.getIdentityType(identityType) === false) {
4183
- return {
4184
- valid: false,
4185
- error: Constants.Messages.ValidationMessages.UserIdentitiesInvalidKey
4186
- };
4187
- }
4188
-
4189
- if (!(typeof identityApiData.userIdentities[identityType] === 'string' || identityApiData.userIdentities[identityType] === null)) {
4190
- return {
4191
- valid: false,
4192
- error: Constants.Messages.ValidationMessages.UserIdentitiesInvalidValues
4193
- };
4194
- }
4195
- }
4196
- }
4197
- }
4198
- }
4199
- }
4200
-
4201
- return {
4202
- valid: true
4203
- };
4204
- }
4205
- };
4206
-
4207
4204
  this.isDelayedByIntegration = function (delayedIntegrations, timeoutStart, now) {
4208
4205
  if (now - timeoutStart > mpInstance._Store.SDKConfig.integrationDelayTimeout) {
4209
4206
  return false;
@@ -4238,7 +4235,18 @@ var mParticle = (function () {
4238
4235
 
4239
4236
  this.isSlug = function (str) {
4240
4237
  return str === slugify(str);
4241
- };
4238
+ }; // Utility Functions
4239
+
4240
+
4241
+ this.converted = converted;
4242
+ this.findKeyInObject = findKeyInObject;
4243
+ this.parseNumber = parseNumber;
4244
+ this.inArray = inArray;
4245
+ this.isObject = isObject;
4246
+ this.decoded = decoded;
4247
+ this.returnConvertedBoolean = returnConvertedBoolean; // Imported Validators
4248
+
4249
+ this.Validators = Validators;
4242
4250
  }
4243
4251
 
4244
4252
  var Messages$1 = Constants.Messages;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mparticle/web-sdk",
3
- "version": "2.16.0",
3
+ "version": "2.16.1",
4
4
  "description": "mParticle core SDK for web applications",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [
@@ -27,7 +27,6 @@
27
27
  "build:npm": "cross-env ENVIRONMENT=prod BUILD=cjs rollup --config rollup.config.js",
28
28
  "build:esm": "cross-env ENVIRONMENT=prod BUILD=esm rollup --config rollup.config.js",
29
29
  "build:stub": "cross-env ENVIRONMENT=prod BUILD=stub rollup --config rollup.config.js",
30
- "build:docs": "yuidoc src/",
31
30
  "build:snippet": "uglifyjs snippet.js -nm -o snippet.min.js",
32
31
  "build:browserify:cjs": "browserify test/integrations/cjs/browserify/index.js -o test/integrations/cjs/dist/browserify-output.js && npm run test:karma:browserify:cjs",
33
32
  "build:rollup:cjs": "rollup --config test/integrations/cjs/rollup/rollup.config.js && npm run test:karma:rollup:cjs",
@@ -112,8 +111,7 @@
112
111
  "typescript": "^4.2.4",
113
112
  "uglify-js": "^3.4.9",
114
113
  "webpack": "^5.36.2",
115
- "webpack-cli": "^4.6.0",
116
- "yuidocjs": "^0.10.2"
114
+ "webpack-cli": "^4.6.0"
117
115
  },
118
116
  "dependencies": {
119
117
  "@babel/runtime": "^7.6.0",
package/src/helpers.js CHANGED
@@ -1,9 +1,10 @@
1
1
  import Types from './types';
2
2
  import Constants from './constants';
3
3
  import Slugify from 'slugify';
4
+ import * as utils from './utils';
5
+ import Validators from './validators';
4
6
 
5
- var StorageNames = Constants.StorageNames,
6
- pluses = /\+/g;
7
+ var StorageNames = Constants.StorageNames;
7
8
 
8
9
  export default function Helpers(mpInstance) {
9
10
  var self = this;
@@ -19,14 +20,6 @@ export default function Helpers(mpInstance) {
19
20
  return false;
20
21
  };
21
22
 
22
- this.returnConvertedBoolean = function(data) {
23
- if (data === 'false' || data === '0') {
24
- return false;
25
- } else {
26
- return Boolean(data);
27
- }
28
- };
29
-
30
23
  this.getFeatureFlag = function(feature) {
31
24
  if (mpInstance._Store.SDKConfig.flags.hasOwnProperty(feature)) {
32
25
  return mpInstance._Store.SDKConfig.flags[feature];
@@ -250,26 +243,6 @@ export default function Helpers(mpInstance) {
250
243
  return target;
251
244
  };
252
245
 
253
- this.isObject = function(value) {
254
- var objType = Object.prototype.toString.call(value);
255
-
256
- return objType === '[object Object]' || objType === '[object Error]';
257
- };
258
-
259
- this.inArray = function(items, name) {
260
- var i = 0;
261
-
262
- if (Array.prototype.indexOf) {
263
- return items.indexOf(name, 0) >= 0;
264
- } else {
265
- for (var n = items.length; i < n; i++) {
266
- if (i in items && items[i] === name) {
267
- return true;
268
- }
269
- }
270
- }
271
- };
272
-
273
246
  this.createServiceUrl = function(secureServiceUrl, devToken) {
274
247
  var serviceScheme =
275
248
  window.mParticle && mpInstance._Store.SDKConfig.forceHttps
@@ -415,36 +388,6 @@ export default function Helpers(mpInstance) {
415
388
  return filteredUserAttributes;
416
389
  };
417
390
 
418
- this.findKeyInObject = function(obj, key) {
419
- if (key && obj) {
420
- for (var prop in obj) {
421
- if (
422
- obj.hasOwnProperty(prop) &&
423
- prop.toLowerCase() === key.toLowerCase()
424
- ) {
425
- return prop;
426
- }
427
- }
428
- }
429
-
430
- return null;
431
- };
432
-
433
- this.decoded = function(s) {
434
- return decodeURIComponent(s.replace(pluses, ' '));
435
- };
436
-
437
- this.converted = function(s) {
438
- if (s.indexOf('"') === 0) {
439
- s = s
440
- .slice(1, -1)
441
- .replace(/\\"/g, '"')
442
- .replace(/\\\\/g, '\\');
443
- }
444
-
445
- return s;
446
- };
447
-
448
391
  this.isEventType = function(type) {
449
392
  for (var prop in Types.EventType) {
450
393
  if (Types.EventType.hasOwnProperty(prop)) {
@@ -456,16 +399,8 @@ export default function Helpers(mpInstance) {
456
399
  return false;
457
400
  };
458
401
 
459
- this.parseNumber = function(value) {
460
- if (isNaN(value) || !isFinite(value)) {
461
- return 0;
462
- }
463
- var floatValue = parseFloat(value);
464
- return isNaN(floatValue) ? 0 : floatValue;
465
- };
466
-
467
402
  this.parseStringOrNumber = function(value) {
468
- if (self.Validators.isStringOrNumber(value)) {
403
+ if (Validators.isStringOrNumber(value)) {
469
404
  return value;
470
405
  } else {
471
406
  return null;
@@ -531,157 +466,6 @@ export default function Helpers(mpInstance) {
531
466
  return sanitizedAttrs;
532
467
  };
533
468
 
534
- this.Validators = {
535
- isValidAttributeValue: function(value) {
536
- return (
537
- value !== undefined &&
538
- !self.isObject(value) &&
539
- !Array.isArray(value)
540
- );
541
- },
542
-
543
- // Neither null nor undefined can be a valid Key
544
- isValidKeyValue: function(key) {
545
- return Boolean(key && !self.isObject(key) && !Array.isArray(key));
546
- },
547
-
548
- isStringOrNumber: function(value) {
549
- return typeof value === 'string' || typeof value === 'number';
550
- },
551
-
552
- isNumber: function(value) {
553
- return typeof value === 'number';
554
- },
555
-
556
- isFunction: function(fn) {
557
- return typeof fn === 'function';
558
- },
559
-
560
- validateIdentities: function(identityApiData, method) {
561
- var validIdentityRequestKeys = {
562
- userIdentities: 1,
563
- onUserAlias: 1,
564
- copyUserAttributes: 1,
565
- };
566
- if (identityApiData) {
567
- if (method === 'modify') {
568
- if (
569
- (self.isObject(identityApiData.userIdentities) &&
570
- !Object.keys(identityApiData.userIdentities)
571
- .length) ||
572
- !self.isObject(identityApiData.userIdentities)
573
- ) {
574
- return {
575
- valid: false,
576
- error:
577
- Constants.Messages.ValidationMessages
578
- .ModifyIdentityRequestUserIdentitiesPresent,
579
- };
580
- }
581
- }
582
- for (var key in identityApiData) {
583
- if (identityApiData.hasOwnProperty(key)) {
584
- if (!validIdentityRequestKeys[key]) {
585
- return {
586
- valid: false,
587
- error:
588
- Constants.Messages.ValidationMessages
589
- .IdentityRequesetInvalidKey,
590
- };
591
- }
592
- if (
593
- key === 'onUserAlias' &&
594
- !mpInstance._Helpers.Validators.isFunction(
595
- identityApiData[key]
596
- )
597
- ) {
598
- return {
599
- valid: false,
600
- error:
601
- Constants.Messages.ValidationMessages
602
- .OnUserAliasType +
603
- typeof identityApiData[key],
604
- };
605
- }
606
- }
607
- }
608
- if (Object.keys(identityApiData).length === 0) {
609
- return {
610
- valid: true,
611
- };
612
- } else {
613
- // identityApiData.userIdentities can't be undefined
614
- if (identityApiData.userIdentities === undefined) {
615
- return {
616
- valid: false,
617
- error:
618
- Constants.Messages.ValidationMessages
619
- .UserIdentities,
620
- };
621
- // identityApiData.userIdentities can be null, but if it isn't null or undefined (above conditional), it must be an object
622
- } else if (
623
- identityApiData.userIdentities !== null &&
624
- !self.isObject(identityApiData.userIdentities)
625
- ) {
626
- return {
627
- valid: false,
628
- error:
629
- Constants.Messages.ValidationMessages
630
- .UserIdentities,
631
- };
632
- }
633
- if (
634
- self.isObject(identityApiData.userIdentities) &&
635
- Object.keys(identityApiData.userIdentities).length
636
- ) {
637
- for (var identityType in identityApiData.userIdentities) {
638
- if (
639
- identityApiData.userIdentities.hasOwnProperty(
640
- identityType
641
- )
642
- ) {
643
- if (
644
- Types.IdentityType.getIdentityType(
645
- identityType
646
- ) === false
647
- ) {
648
- return {
649
- valid: false,
650
- error:
651
- Constants.Messages
652
- .ValidationMessages
653
- .UserIdentitiesInvalidKey,
654
- };
655
- }
656
- if (
657
- !(
658
- typeof identityApiData.userIdentities[
659
- identityType
660
- ] === 'string' ||
661
- identityApiData.userIdentities[
662
- identityType
663
- ] === null
664
- )
665
- ) {
666
- return {
667
- valid: false,
668
- error:
669
- Constants.Messages
670
- .ValidationMessages
671
- .UserIdentitiesInvalidValues,
672
- };
673
- }
674
- }
675
- }
676
- }
677
- }
678
- }
679
- return {
680
- valid: true,
681
- };
682
- },
683
- };
684
-
685
469
  this.isDelayedByIntegration = function(
686
470
  delayedIntegrations,
687
471
  timeoutStart,
@@ -724,4 +508,16 @@ export default function Helpers(mpInstance) {
724
508
  this.isSlug = function(str) {
725
509
  return str === Slugify(str);
726
510
  };
511
+
512
+ // Utility Functions
513
+ this.converted = utils.converted;
514
+ this.findKeyInObject = utils.findKeyInObject;
515
+ this.parseNumber = utils.parseNumber;
516
+ this.inArray = utils.inArray;
517
+ this.isObject = utils.isObject;
518
+ this.decoded = utils.decoded;
519
+ this.returnConvertedBoolean = utils.returnConvertedBoolean;
520
+
521
+ // Imported Validators
522
+ this.Validators = Validators;
727
523
  }
package/src/utils.ts ADDED
@@ -0,0 +1,82 @@
1
+ type valueof<T> = T[keyof T];
2
+
3
+ const inArray = (items: any[], name: string): boolean => {
4
+ const i = 0;
5
+
6
+ if (Array.prototype.indexOf) {
7
+ return items.indexOf(name, 0) >= 0;
8
+ } else {
9
+ for (var n = items.length; i < n; i++) {
10
+ if (i in items && items[i] === name) {
11
+ return true;
12
+ }
13
+ }
14
+ }
15
+
16
+ return false;
17
+ };
18
+
19
+ const findKeyInObject = (obj: any, key: string): string => {
20
+ if (key && obj) {
21
+ for (var prop in obj) {
22
+ if (
23
+ obj.hasOwnProperty(prop) &&
24
+ prop.toLowerCase() === key.toLowerCase()
25
+ ) {
26
+ return prop;
27
+ }
28
+ }
29
+ }
30
+
31
+ return null;
32
+ };
33
+
34
+ const isObject = (value: any): boolean => {
35
+ var objType = Object.prototype.toString.call(value);
36
+ return objType === '[object Object]' || objType === '[object Error]';
37
+ };
38
+
39
+ const parseNumber = (value: string | number): number => {
40
+ if (isNaN(value as number) || !isFinite(value as number)) {
41
+ return 0;
42
+ }
43
+ var floatValue = parseFloat(value as string);
44
+ return isNaN(floatValue) ? 0 : floatValue;
45
+ };
46
+
47
+ // FIXME: REFACTOR for V3
48
+ // only used in store.js to sanitize server-side formatting of
49
+ // booleans when checking for `isDevelopmentMode`
50
+ // Should be removed in v3
51
+ const returnConvertedBoolean = (data: string | boolean | number) => {
52
+ if (data === 'false' || data === '0') {
53
+ return false;
54
+ } else {
55
+ return Boolean(data);
56
+ }
57
+ };
58
+
59
+ const decoded = (s: string): string =>
60
+ decodeURIComponent(s.replace(/\+/g, ' '));
61
+
62
+ const converted = (s: string): string => {
63
+ if (s.indexOf('"') === 0) {
64
+ s = s
65
+ .slice(1, -1)
66
+ .replace(/\\"/g, '"')
67
+ .replace(/\\\\/g, '\\');
68
+ }
69
+
70
+ return s;
71
+ };
72
+
73
+ export {
74
+ valueof,
75
+ converted,
76
+ decoded,
77
+ findKeyInObject,
78
+ inArray,
79
+ isObject,
80
+ parseNumber,
81
+ returnConvertedBoolean,
82
+ };
@@ -0,0 +1,165 @@
1
+ import Types from './types';
2
+ import { isObject } from './utils';
3
+ import Constants from './constants';
4
+ import { IdentityApiData } from '@mparticle/web-sdk';
5
+ import { valueof } from './utils';
6
+
7
+ type IdentityAPIMethod = 'login' | 'logout' | 'identify' | 'modify';
8
+
9
+ type ValidationIdentitiesReturn = {
10
+ valid: boolean;
11
+ error?: valueof<typeof Constants.Messages.ValidationMessages>;
12
+ };
13
+
14
+ const Validators = {
15
+ isValidAttributeValue: function(value: any): boolean {
16
+ return value !== undefined && !isObject(value) && !Array.isArray(value);
17
+ },
18
+
19
+ // Neither null nor undefined can be a valid Key
20
+ isValidKeyValue: function(key: any): boolean {
21
+ return Boolean(
22
+ key &&
23
+ !isObject(key) &&
24
+ !Array.isArray(key) &&
25
+ !this.isFunction(key)
26
+ );
27
+ },
28
+
29
+ isStringOrNumber: function(value: any): boolean {
30
+ return typeof value === 'string' || typeof value === 'number';
31
+ },
32
+
33
+ isNumber: function(value: any): boolean {
34
+ return typeof value === 'number';
35
+ },
36
+
37
+ isFunction: (fn: any): boolean => {
38
+ return typeof fn === 'function';
39
+ },
40
+
41
+ validateIdentities: function(
42
+ identityApiData: IdentityApiData,
43
+ method?: IdentityAPIMethod
44
+ ): ValidationIdentitiesReturn {
45
+ var validIdentityRequestKeys = {
46
+ userIdentities: 1,
47
+ onUserAlias: 1,
48
+ copyUserAttributes: 1,
49
+ };
50
+ if (identityApiData) {
51
+ if (method === 'modify') {
52
+ if (
53
+ (isObject(identityApiData.userIdentities) &&
54
+ !Object.keys(identityApiData.userIdentities).length) ||
55
+ !isObject(identityApiData.userIdentities)
56
+ ) {
57
+ return {
58
+ valid: false,
59
+ error:
60
+ Constants.Messages.ValidationMessages
61
+ .ModifyIdentityRequestUserIdentitiesPresent,
62
+ };
63
+ }
64
+ }
65
+ for (var key in identityApiData) {
66
+ if (identityApiData.hasOwnProperty(key)) {
67
+ if (!validIdentityRequestKeys[key]) {
68
+ return {
69
+ valid: false,
70
+ error:
71
+ Constants.Messages.ValidationMessages
72
+ .IdentityRequesetInvalidKey,
73
+ };
74
+ }
75
+ if (
76
+ key === 'onUserAlias' &&
77
+ !Validators.isFunction(identityApiData[key])
78
+ ) {
79
+ return {
80
+ valid: false,
81
+ // FIXME: Validates type safety
82
+ error:
83
+ Constants.Messages.ValidationMessages
84
+ .OnUserAliasType +
85
+ typeof identityApiData[key],
86
+ };
87
+ }
88
+ }
89
+ }
90
+ if (Object.keys(identityApiData).length === 0) {
91
+ return {
92
+ valid: true,
93
+ };
94
+ } else {
95
+ // identityApiData.userIdentities can't be undefined
96
+ if (identityApiData.userIdentities === undefined) {
97
+ return {
98
+ valid: false,
99
+ error:
100
+ Constants.Messages.ValidationMessages
101
+ .UserIdentities,
102
+ };
103
+ // identityApiData.userIdentities can be null, but if it isn't null or undefined (above conditional), it must be an object
104
+ } else if (
105
+ identityApiData.userIdentities !== null &&
106
+ !isObject(identityApiData.userIdentities)
107
+ ) {
108
+ return {
109
+ valid: false,
110
+ error:
111
+ Constants.Messages.ValidationMessages
112
+ .UserIdentities,
113
+ };
114
+ }
115
+ if (
116
+ isObject(identityApiData.userIdentities) &&
117
+ Object.keys(identityApiData.userIdentities).length
118
+ ) {
119
+ for (var identityType in identityApiData.userIdentities) {
120
+ if (
121
+ identityApiData.userIdentities.hasOwnProperty(
122
+ identityType
123
+ )
124
+ ) {
125
+ if (
126
+ Types.IdentityType.getIdentityType(
127
+ identityType
128
+ ) === false
129
+ ) {
130
+ return {
131
+ valid: false,
132
+ error:
133
+ Constants.Messages.ValidationMessages
134
+ .UserIdentitiesInvalidKey,
135
+ };
136
+ }
137
+ if (
138
+ !(
139
+ typeof identityApiData.userIdentities[
140
+ identityType
141
+ ] === 'string' ||
142
+ identityApiData.userIdentities[
143
+ identityType
144
+ ] === null
145
+ )
146
+ ) {
147
+ return {
148
+ valid: false,
149
+ error:
150
+ Constants.Messages.ValidationMessages
151
+ .UserIdentitiesInvalidValues,
152
+ };
153
+ }
154
+ }
155
+ }
156
+ }
157
+ }
158
+ }
159
+ return {
160
+ valid: true,
161
+ };
162
+ },
163
+ };
164
+
165
+ export default Validators;