@britannica/cam-utils
Advanced tools
Comparing version 2.0.0 to 2.1.0
@@ -5,2 +5,9 @@ # Changelog | ||
## [2.1.0](https://github.com/britannica/cam-utils/compare/v2.0.0...v2.1.0) (2020-03-10) | ||
### Features | ||
- Add `clearRedirectUrl` method ([7e656fe](https://github.com/britannica/cam-utils/commit/7e656fea3d40955a63a945da6289d51944d6827c)) | ||
- Throw error when environment is not recognized ([da602e4](https://github.com/britannica/cam-utils/commit/da602e4a761114daff033673f655aef55914196a)) | ||
## [2.0.0](https://github.com/britannica/cam-utils/compare/v1.1.0...v2.0.0) (2020-03-10) | ||
@@ -7,0 +14,0 @@ |
@@ -52,2 +52,6 @@ 'use strict'; | ||
) { | ||
if (!Object.values(Environment).includes(env)) { | ||
throw new Error(`Unknown environment: ${env}`); | ||
} | ||
return { | ||
@@ -88,2 +92,11 @@ ...authConfigurations[env], | ||
/** | ||
* Clear the redirect url for the given cookie type | ||
* @param {string} type | ||
*/ | ||
function clearRedirectUrl(type) { | ||
Cookies.remove(type, { domain: CAM_COOKIE_DOMAIN }); | ||
} | ||
// Heavy-handed sign out function | ||
@@ -107,4 +120,5 @@ | ||
exports.clearAuthCookies = clearAuthCookies; | ||
exports.clearRedirectUrl = clearRedirectUrl; | ||
exports.getAuthConfiguration = getAuthConfiguration; | ||
exports.getRedirectUrl = getRedirectUrl; | ||
exports.setRedirectUrl = setRedirectUrl; |
@@ -46,2 +46,6 @@ import Cookies from 'js-cookie'; | ||
) { | ||
if (!Object.values(Environment).includes(env)) { | ||
throw new Error(`Unknown environment: ${env}`); | ||
} | ||
return { | ||
@@ -82,2 +86,11 @@ ...authConfigurations[env], | ||
/** | ||
* Clear the redirect url for the given cookie type | ||
* @param {string} type | ||
*/ | ||
function clearRedirectUrl(type) { | ||
Cookies.remove(type, { domain: CAM_COOKIE_DOMAIN }); | ||
} | ||
// Heavy-handed sign out function | ||
@@ -95,2 +108,2 @@ | ||
export { CAM_COOKIE_DOMAIN, CAM_DEFAULT_EXPIRATION_DAYS, CAM_LOGIN_REDIRECT_URL_COOKIE, CAM_SIGN_UP_REDIRECT_URL_COOKIE, Environment, clearAuthCookies, getAuthConfiguration, getRedirectUrl, setRedirectUrl }; | ||
export { CAM_COOKIE_DOMAIN, CAM_DEFAULT_EXPIRATION_DAYS, CAM_LOGIN_REDIRECT_URL_COOKIE, CAM_SIGN_UP_REDIRECT_URL_COOKIE, Environment, clearAuthCookies, clearRedirectUrl, getAuthConfiguration, getRedirectUrl, setRedirectUrl }; |
@@ -209,2 +209,6 @@ (function (global, factory) { | ||
) { | ||
if (!Object.values(Environment).includes(env)) { | ||
throw new Error(`Unknown environment: ${env}`); | ||
} | ||
return { | ||
@@ -245,2 +249,11 @@ ...authConfigurations[env], | ||
/** | ||
* Clear the redirect url for the given cookie type | ||
* @param {string} type | ||
*/ | ||
function clearRedirectUrl(type) { | ||
js_cookie.remove(type, { domain: CAM_COOKIE_DOMAIN }); | ||
} | ||
// Heavy-handed sign out function | ||
@@ -264,2 +277,3 @@ | ||
exports.clearAuthCookies = clearAuthCookies; | ||
exports.clearRedirectUrl = clearRedirectUrl; | ||
exports.getAuthConfiguration = getAuthConfiguration; | ||
@@ -266,0 +280,0 @@ exports.getRedirectUrl = getRedirectUrl; |
{ | ||
"name": "@britannica/cam-utils", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "Consumer Account Management (CAM) auth configuration and utilities", | ||
@@ -5,0 +5,0 @@ "repository": "git://github.com/britannica/cam-utils.git", |
@@ -46,2 +46,6 @@ import Cookies from 'js-cookie'; | ||
) { | ||
if (!Object.values(Environment).includes(env)) { | ||
throw new Error(`Unknown environment: ${env}`); | ||
} | ||
return { | ||
@@ -82,2 +86,11 @@ ...authConfigurations[env], | ||
/** | ||
* Clear the redirect url for the given cookie type | ||
* @param {string} type | ||
*/ | ||
export function clearRedirectUrl(type) { | ||
Cookies.remove(type, { domain: CAM_COOKIE_DOMAIN }); | ||
} | ||
// Heavy-handed sign out function | ||
@@ -84,0 +97,0 @@ |
19107
540