Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@edx/cookie-policy-banner

Package Overview
Dependencies
Maintainers
13
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@edx/cookie-policy-banner - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

1

build/constants.js

@@ -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]);

28

build/utilities.js

@@ -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",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc