@edx/cookie-policy-banner
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -14,2 +14,3 @@ 'use strict'; | ||
var DEFAULT_IETF_TAG = ENGLISH_IETF_TAG; | ||
var STAGE_ENVIRONMENTS = ['acceptance.edx.org', 'dev.edx.org', 'extra.edx.org', 'qa.edx.org', 'stage.edx.org', 'localhost']; | ||
@@ -16,0 +17,0 @@ var LANGUAGE_CODES = Object.freeze([ENGLISH_IETF_TAG, SPANISH_IETF_TAG]); |
@@ -16,5 +16,19 @@ 'use strict'; | ||
var isStage = function isStage() { | ||
var host = window.location.hostname; | ||
return _constants.STAGE_ENVIRONMENTS.filter(function (environment) { | ||
return host.indexOf(environment) > -1; | ||
}).length > 0; | ||
}; | ||
var isProduction = function isProduction() { | ||
var host = window.location.hostname; | ||
return !isStage() && host.indexOf('.edx.org') !== -1; | ||
}; | ||
var getLanguageCode = function getLanguageCode() { | ||
var cookie = new _universalCookie2.default('edx.org'); | ||
var languageCode = cookie.get('prod-edx-language-preference'); | ||
var languageCode = isProduction() ? cookie.get('prod-edx-language-preference') : cookie.get('stage-edx-language-preference'); | ||
@@ -29,9 +43,9 @@ if (!!languageCode || _constants.LANGUAGE_CODES.indexOf(languageCode) <= -1) { | ||
var createHasViewedCookieBanner = function createHasViewedCookieBanner() { | ||
var host = window.location.hostname; | ||
var path = '/'; | ||
var maxAge = Number.MAX_SAFE_INTEGER; | ||
// edx.org uses different subdomains so use a root domain to match across services | ||
if (host.indexOf('stage.edx.org') !== -1 || host.indexOf('dev.edx.org') !== -1 || host.indexOf('acceptance.edx.org') !== -1 || host.indexOf('qa.edx.org') !== -1) { | ||
return new _universalCookie2.default().set('edx-cookie-policy-viewed', true, { domain: '.stage.edx.org' }); | ||
} else if (host.indexOf('.edx.org') !== -1) { | ||
return new _universalCookie2.default().set('edx-cookie-policy-viewed', true, { domain: '.edx.org' }); | ||
if (isStage()) { | ||
return new _universalCookie2.default().set('edx-cookie-policy-viewed', true, { domain: '.stage.edx.org', path: path, maxAge: maxAge }); | ||
} else if (isProduction()) { | ||
return new _universalCookie2.default().set('edx-cookie-policy-viewed', true, { domain: '.edx.org', path: path, maxAge: maxAge }); | ||
} | ||
@@ -38,0 +52,0 @@ |
{ | ||
"name": "@edx/cookie-policy-banner", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "The edX cookie policy banner component implemented in React.", | ||
@@ -47,6 +47,8 @@ "main": "build/index.js", | ||
"prop-types": "^15.6.1", | ||
"react": "^16.3.0", | ||
"react-dom": "^16.3.0", | ||
"universal-cookie": "^2.1.2" | ||
}, | ||
"peerDependencies": { | ||
"react": "^16.3.0", | ||
"react-dom": "^16.3.0" | ||
}, | ||
"devDependencies": { | ||
@@ -84,3 +86,5 @@ "@commitlint/cli": "^6.1.3", | ||
"node-sass-import": "^1.1.1", | ||
"react": "^16.3.0", | ||
"react-dev-utils": "^5.0.0", | ||
"react-dom": "^16.3.0", | ||
"sass-loader": "^6.0.7", | ||
@@ -87,0 +91,0 @@ "semantic-release": "^15.1.4", |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
53088
289
0
42
- Removedreact@^16.3.0
- Removedreact-dom@^16.3.0