@mparticle/web-sdk
Advanced tools
Comparing version 2.15.2 to 2.15.3
{ | ||
"name": "@mparticle/web-sdk", | ||
"version": "2.15.2", | ||
"version": "2.15.3", | ||
"description": "mParticle core SDK for web applications", | ||
@@ -119,4 +119,5 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"@babel/runtime": "^7.6.0" | ||
"@babel/runtime": "^7.6.0", | ||
"slugify": "^1.3.6" | ||
} | ||
} |
import Types from './types'; | ||
import Constants from './constants'; | ||
import Slugify from 'slugify'; | ||
@@ -723,16 +724,5 @@ var StorageNames = Constants.StorageNames, | ||
this.isDataPlanSlug = function(str) { | ||
// This verifies that `str` matches how our backend defines data plan slug names. | ||
// i.e. under_score_slug instead kabob-case-slug | ||
// We also want to reject any non-string values | ||
return ( | ||
typeof str === 'string' && | ||
str === | ||
str | ||
.trim() | ||
.replaceAll(/[^0-9a-zA-Z]+/g, '_') | ||
.toLowerCase() | ||
); | ||
this.isSlug = function(str) { | ||
return str === Slugify(str); | ||
}; | ||
} |
@@ -200,9 +200,13 @@ import Constants from './constants'; | ||
if (config.dataPlan.hasOwnProperty('planId')) { | ||
if ( | ||
mpInstance._Helpers.isDataPlanSlug(config.dataPlan.planId) | ||
) { | ||
this.SDKConfig.dataPlan.PlanId = config.dataPlan.planId; | ||
if (typeof config.dataPlan.planId === 'string') { | ||
if (mpInstance._Helpers.isSlug(config.dataPlan.planId)) { | ||
this.SDKConfig.dataPlan.PlanId = config.dataPlan.planId; | ||
} else { | ||
mpInstance.Logger.error( | ||
'Your data plan id must be in a slug format' | ||
); | ||
} | ||
} else { | ||
mpInstance.Logger.error( | ||
'Your data plan id must be a string and match the data plan slug format (i.e. under_case_slug)' | ||
'Your data plan id must be a string' | ||
); | ||
@@ -209,0 +213,0 @@ } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1537065
27975
2
+ Addedslugify@^1.3.6
+ Addedslugify@1.6.6(transitive)