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
0
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 5.0.0-beta.6 to 5.0.0-beta.7

23

dist/cam-utils.cjs.js
'use strict';
// --- Enums
/**
* window.postMessage event types. Primarily used in subscription-frontend for iframe communication with CAM.
* @enum
*/
exports.PostMessageEvent = void 0;
(function (PostMessageEvent) {
PostMessageEvent["ROUTE_CHANGE"] = "CAMRouteChange";
PostMessageEvent["SIGN_IN"] = "CAMSignIn";
PostMessageEvent["SIGN_OUT"] = "CAMSignOut";
PostMessageEvent["FORM_VALIDATION_CHANGE"] = "CAMValidationEvent";
PostMessageEvent["RESIZE"] = "CAMResize";
})(exports.PostMessageEvent || (exports.PostMessageEvent = {}));
exports.Environment = void 0;

@@ -58,3 +46,3 @@ (function (Environment) {

class CAMUtilsClient {
constructor({ cookies, cookieOptions, environment = exports.Environment.Dev, hostname = '.britannica.com', }) {
constructor({ cookies, cookieOptions, environment = exports.Environment.Dev, origin = 'https://www.britannica.com', }) {
this.getCookie = (name) => {

@@ -86,7 +74,7 @@ return this.get?.(name);

this.environment = environment;
this.cookieDomain = CAMUtilsClient.parseCookieDomain(hostname);
this.cookieDomain = CAMUtilsClient.parseCookieDomain(origin);
}
// --- Public
set hostname(hostname) {
this.cookieDomain = CAMUtilsClient.parseCookieDomain(hostname);
set origin(origin) {
this.cookieDomain = CAMUtilsClient.parseCookieDomain(origin);
}

@@ -164,4 +152,5 @@ clearAuthCookies() {

*/
static parseCookieDomain(hostname) {
static parseCookieDomain(origin) {
const validDomains = ['.britannica.', '.merriam-webster.'];
const hostname = new URL(origin).hostname;
let cookieDomain = hostname;

@@ -168,0 +157,0 @@ validDomains.forEach((prefix) => {

// --- Enums
/**
* window.postMessage event types. Primarily used in subscription-frontend for iframe communication with CAM.
* @enum
*/
var PostMessageEvent;
(function (PostMessageEvent) {
PostMessageEvent["ROUTE_CHANGE"] = "CAMRouteChange";
PostMessageEvent["SIGN_IN"] = "CAMSignIn";
PostMessageEvent["SIGN_OUT"] = "CAMSignOut";
PostMessageEvent["FORM_VALIDATION_CHANGE"] = "CAMValidationEvent";
PostMessageEvent["RESIZE"] = "CAMResize";
})(PostMessageEvent || (PostMessageEvent = {}));
var Environment;

@@ -56,3 +44,3 @@ (function (Environment) {

class CAMUtilsClient {
constructor({ cookies, cookieOptions, environment = Environment.Dev, hostname = '.britannica.com', }) {
constructor({ cookies, cookieOptions, environment = Environment.Dev, origin = 'https://www.britannica.com', }) {
this.getCookie = (name) => {

@@ -84,7 +72,7 @@ return this.get?.(name);

this.environment = environment;
this.cookieDomain = CAMUtilsClient.parseCookieDomain(hostname);
this.cookieDomain = CAMUtilsClient.parseCookieDomain(origin);
}
// --- Public
set hostname(hostname) {
this.cookieDomain = CAMUtilsClient.parseCookieDomain(hostname);
set origin(origin) {
this.cookieDomain = CAMUtilsClient.parseCookieDomain(origin);
}

@@ -162,4 +150,5 @@ clearAuthCookies() {

*/
static parseCookieDomain(hostname) {
static parseCookieDomain(origin) {
const validDomains = ['.britannica.', '.merriam-webster.'];
const hostname = new URL(origin).hostname;
let cookieDomain = hostname;

@@ -175,3 +164,3 @@ validDomains.forEach((prefix) => {

export { CAMCookie, CAMUtilsClient, CAM_DEFAULT_EXPIRATION_DAYS, COGNITO_COOKIE_PREFIX, Environment, PostMessageEvent, poolConfigurations };
export { CAMCookie, CAMUtilsClient, CAM_DEFAULT_EXPIRATION_DAYS, COGNITO_COOKIE_PREFIX, Environment, poolConfigurations };
//# sourceMappingURL=cam-utils.esm.js.map

@@ -8,14 +8,2 @@ (function (global, factory) {

// --- Enums
/**
* window.postMessage event types. Primarily used in subscription-frontend for iframe communication with CAM.
* @enum
*/
exports.PostMessageEvent = void 0;
(function (PostMessageEvent) {
PostMessageEvent["ROUTE_CHANGE"] = "CAMRouteChange";
PostMessageEvent["SIGN_IN"] = "CAMSignIn";
PostMessageEvent["SIGN_OUT"] = "CAMSignOut";
PostMessageEvent["FORM_VALIDATION_CHANGE"] = "CAMValidationEvent";
PostMessageEvent["RESIZE"] = "CAMResize";
})(exports.PostMessageEvent || (exports.PostMessageEvent = {}));
exports.Environment = void 0;

@@ -63,3 +51,3 @@ (function (Environment) {

class CAMUtilsClient {
constructor({ cookies, cookieOptions, environment = exports.Environment.Dev, hostname = '.britannica.com', }) {
constructor({ cookies, cookieOptions, environment = exports.Environment.Dev, origin = 'https://www.britannica.com', }) {
this.getCookie = (name) => {

@@ -91,7 +79,7 @@ return this.get?.(name);

this.environment = environment;
this.cookieDomain = CAMUtilsClient.parseCookieDomain(hostname);
this.cookieDomain = CAMUtilsClient.parseCookieDomain(origin);
}
// --- Public
set hostname(hostname) {
this.cookieDomain = CAMUtilsClient.parseCookieDomain(hostname);
set origin(origin) {
this.cookieDomain = CAMUtilsClient.parseCookieDomain(origin);
}

@@ -169,4 +157,5 @@ clearAuthCookies() {

*/
static parseCookieDomain(hostname) {
static parseCookieDomain(origin) {
const validDomains = ['.britannica.', '.merriam-webster.'];
const hostname = new URL(origin).hostname;
let cookieDomain = hostname;

@@ -173,0 +162,0 @@ validDomains.forEach((prefix) => {

import type { CookieSerializeOptions } from 'cookie';
type Origin = `${'https' | 'http'}://${string}`;
export type GetCookie = (name: CAMCookie) => string | undefined;

@@ -15,3 +16,3 @@ export type GetAllCookies = () => Record<string, string>;

environment?: Environment;
hostname?: string;
origin?: Origin;
};

@@ -27,13 +28,2 @@ export type PoolConfiguration = {

};
/**
* window.postMessage event types. Primarily used in subscription-frontend for iframe communication with CAM.
* @enum
*/
export declare enum PostMessageEvent {
ROUTE_CHANGE = "CAMRouteChange",
SIGN_IN = "CAMSignIn",
SIGN_OUT = "CAMSignOut",
FORM_VALIDATION_CHANGE = "CAMValidationEvent",
RESIZE = "CAMResize"
}
export declare enum Environment {

@@ -66,4 +56,4 @@ Dev = "dev",

cookieDomain: string;
constructor({ cookies, cookieOptions, environment, hostname, }: CAMUtilsClientOptions);
set hostname(hostname: string);
constructor({ cookies, cookieOptions, environment, origin, }: CAMUtilsClientOptions);
set origin(origin: Origin);
getCookie: GetCookie;

@@ -89,3 +79,4 @@ setCookie: SetCookie;

*/
static parseCookieDomain(hostname: string): string;
static parseCookieDomain(origin: Origin): string;
}
export {};
{
"name": "@britannica/cam-utils",
"version": "5.0.0-beta.6",
"version": "5.0.0-beta.7",
"description": "Consumer Account Management (CAM) auth configuration and utilities",

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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