New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@britannica/cam-utils

Package Overview
Dependencies
Maintainers
5
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@britannica/cam-utils - npm Package Compare versions

Comparing version 3.0.0-beta.5 to 3.0.0-beta.6

41

dist/cam-utils.cjs.js

@@ -15,3 +15,2 @@ 'use strict';

const CAM_LOGOUT_REDIRECT_URL_COOKIE = 'CAMLogoutRedirectUrl';
const CAM_PRODUCT_NAME_COOKIE = 'CAMProductName';
const CAM_LEGACY_AUTH_COOKIE = 'AuthTokenExpirable2';

@@ -132,17 +131,33 @@

/**
* Set the name of the product to display within CAM
* @param {string} productName
* Retrieve the product name
* @param {string} redirectCookieName
* @returns {string|null}
*/
function setProductName(productName) {
setCookie(CAM_PRODUCT_NAME_COOKIE, productName);
}
function getProductName(redirectCookieName = CAM_LOGIN_REDIRECT_URL_COOKIE) {
try {
const { hostname } = new URL(getRedirectUrl(redirectCookieName));
/**
* Retrieve the product name
* @returns {string}
*/
if (!parseDomain(hostname)) {
return null;
}
function getProductName() {
return Cookies__default['default'].get(CAM_PRODUCT_NAME_COOKIE);
// A map of subdomains and their product names
const productNameMap = {
beyond: 'Britannica Beyond',
kids: 'Britannica Kids',
myaccount: 'Billing Preferences',
premium: 'Britannica Premium',
subscription: 'Britannica Premium',
};
// Match the hostname to a key within "productNameMap", otherwise default to "Britannica.com"
return (
productNameMap[Object.keys(productNameMap).find((subdomain) => hostname.includes(subdomain))] || 'Britannica.com'
);
} catch {
return null;
}
}

@@ -166,3 +181,2 @@

exports.CAM_LOGOUT_REDIRECT_URL_COOKIE = CAM_LOGOUT_REDIRECT_URL_COOKIE;
exports.CAM_PRODUCT_NAME_COOKIE = CAM_PRODUCT_NAME_COOKIE;
exports.CAM_SIGN_UP_REDIRECT_URL_COOKIE = CAM_SIGN_UP_REDIRECT_URL_COOKIE;

@@ -176,3 +190,2 @@ exports.Environment = Environment;

exports.setCookie = setCookie;
exports.setProductName = setProductName;
exports.setRedirectUrl = setRedirectUrl;

@@ -7,3 +7,2 @@ import Cookies from 'js-cookie';

const CAM_LOGOUT_REDIRECT_URL_COOKIE = 'CAMLogoutRedirectUrl';
const CAM_PRODUCT_NAME_COOKIE = 'CAMProductName';
const CAM_LEGACY_AUTH_COOKIE = 'AuthTokenExpirable2';

@@ -124,17 +123,33 @@

/**
* Set the name of the product to display within CAM
* @param {string} productName
* Retrieve the product name
* @param {string} redirectCookieName
* @returns {string|null}
*/
function setProductName(productName) {
setCookie(CAM_PRODUCT_NAME_COOKIE, productName);
}
function getProductName(redirectCookieName = CAM_LOGIN_REDIRECT_URL_COOKIE) {
try {
const { hostname } = new URL(getRedirectUrl(redirectCookieName));
/**
* Retrieve the product name
* @returns {string}
*/
if (!parseDomain(hostname)) {
return null;
}
function getProductName() {
return Cookies.get(CAM_PRODUCT_NAME_COOKIE);
// A map of subdomains and their product names
const productNameMap = {
beyond: 'Britannica Beyond',
kids: 'Britannica Kids',
myaccount: 'Billing Preferences',
premium: 'Britannica Premium',
subscription: 'Britannica Premium',
};
// Match the hostname to a key within "productNameMap", otherwise default to "Britannica.com"
return (
productNameMap[Object.keys(productNameMap).find((subdomain) => hostname.includes(subdomain))] || 'Britannica.com'
);
} catch {
return null;
}
}

@@ -154,2 +169,2 @@

export { CAM_DEFAULT_EXPIRATION_DAYS, CAM_LEGACY_AUTH_COOKIE, CAM_LOGIN_REDIRECT_URL_COOKIE, CAM_LOGOUT_REDIRECT_URL_COOKIE, CAM_PRODUCT_NAME_COOKIE, CAM_SIGN_UP_REDIRECT_URL_COOKIE, Environment, clearAuthCookies, clearRedirectUrl, getAuthConfiguration, getProductName, getRedirectUrl, setCookie, setProductName, setRedirectUrl };
export { CAM_DEFAULT_EXPIRATION_DAYS, CAM_LEGACY_AUTH_COOKIE, CAM_LOGIN_REDIRECT_URL_COOKIE, CAM_LOGOUT_REDIRECT_URL_COOKIE, CAM_SIGN_UP_REDIRECT_URL_COOKIE, Environment, clearAuthCookies, clearRedirectUrl, getAuthConfiguration, getProductName, getRedirectUrl, setCookie, setRedirectUrl };

@@ -179,3 +179,2 @@ (function (global, factory) {

const CAM_LOGOUT_REDIRECT_URL_COOKIE = 'CAMLogoutRedirectUrl';
const CAM_PRODUCT_NAME_COOKIE = 'CAMProductName';
const CAM_LEGACY_AUTH_COOKIE = 'AuthTokenExpirable2';

@@ -296,17 +295,33 @@

/**
* Set the name of the product to display within CAM
* @param {string} productName
* Retrieve the product name
* @param {string} redirectCookieName
* @returns {string|null}
*/
function setProductName(productName) {
setCookie(CAM_PRODUCT_NAME_COOKIE, productName);
}
function getProductName(redirectCookieName = CAM_LOGIN_REDIRECT_URL_COOKIE) {
try {
const { hostname } = new URL(getRedirectUrl(redirectCookieName));
/**
* Retrieve the product name
* @returns {string}
*/
if (!parseDomain(hostname)) {
return null;
}
function getProductName() {
return js_cookie.get(CAM_PRODUCT_NAME_COOKIE);
// A map of subdomains and their product names
const productNameMap = {
beyond: 'Britannica Beyond',
kids: 'Britannica Kids',
myaccount: 'Billing Preferences',
premium: 'Britannica Premium',
subscription: 'Britannica Premium',
};
// Match the hostname to a key within "productNameMap", otherwise default to "Britannica.com"
return (
productNameMap[Object.keys(productNameMap).find((subdomain) => hostname.includes(subdomain))] || 'Britannica.com'
);
} catch {
return null;
}
}

@@ -330,3 +345,2 @@

exports.CAM_LOGOUT_REDIRECT_URL_COOKIE = CAM_LOGOUT_REDIRECT_URL_COOKIE;
exports.CAM_PRODUCT_NAME_COOKIE = CAM_PRODUCT_NAME_COOKIE;
exports.CAM_SIGN_UP_REDIRECT_URL_COOKIE = CAM_SIGN_UP_REDIRECT_URL_COOKIE;

@@ -340,3 +354,2 @@ exports.Environment = Environment;

exports.setCookie = setCookie;
exports.setProductName = setProductName;
exports.setRedirectUrl = setRedirectUrl;

@@ -343,0 +356,0 @@

{
"name": "@britannica/cam-utils",
"version": "3.0.0-beta.5",
"version": "3.0.0-beta.6",
"description": "Consumer Account Management (CAM) auth configuration and utilities",

@@ -5,0 +5,0 @@ "repository": "git://github.com/britannica/cam-utils.git",

@@ -7,3 +7,2 @@ import Cookies from 'js-cookie';

export const CAM_LOGOUT_REDIRECT_URL_COOKIE = 'CAMLogoutRedirectUrl';
export const CAM_PRODUCT_NAME_COOKIE = 'CAMProductName';
export const CAM_LEGACY_AUTH_COOKIE = 'AuthTokenExpirable2';

@@ -124,17 +123,33 @@

/**
* Set the name of the product to display within CAM
* @param {string} productName
* Retrieve the product name
* @param {string} redirectCookieName
* @returns {string|null}
*/
export function setProductName(productName) {
setCookie(CAM_PRODUCT_NAME_COOKIE, productName);
}
export function getProductName(redirectCookieName = CAM_LOGIN_REDIRECT_URL_COOKIE) {
try {
const { hostname } = new URL(getRedirectUrl(redirectCookieName));
/**
* Retrieve the product name
* @returns {string}
*/
if (!parseDomain(hostname)) {
return null;
}
export function getProductName() {
return Cookies.get(CAM_PRODUCT_NAME_COOKIE);
// A map of subdomains and their product names
const productNameMap = {
beyond: 'Britannica Beyond',
kids: 'Britannica Kids',
myaccount: 'Billing Preferences',
premium: 'Britannica Premium',
subscription: 'Britannica Premium',
};
// Match the hostname to a key within "productNameMap", otherwise default to "Britannica.com"
return (
productNameMap[Object.keys(productNameMap).find((subdomain) => hostname.includes(subdomain))] || 'Britannica.com'
);
} catch {
return null;
}
}

@@ -141,0 +156,0 @@

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