@auth0/auth0-spa-js 1.22.2 → 1.22.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  interface ClientStorageOptions {
2
- daysUntilExpire: number;
2
+ daysUntilExpire?: number;
3
3
  cookieDomain?: string;
4
4
  }
5
5
  /**
@@ -8,7 +8,7 @@ interface ClientStorageOptions {
8
8
  export declare type ClientStorage = {
9
9
  get<T extends Object>(key: string): T | undefined;
10
10
  save(key: string, value: any, options?: ClientStorageOptions): void;
11
- remove(key: string): void;
11
+ remove(key: string, options?: ClientStorageOptions): void;
12
12
  };
13
13
  /**
14
14
  * A storage protocol for marshalling data to/from cookies
@@ -1,2 +1,2 @@
1
- declare const _default: "1.22.2";
1
+ declare const _default: "1.22.3";
2
2
  export default _default;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "name": "@auth0/auth0-spa-js",
4
4
  "description": "Auth0 SDK for Single Page Applications using Authorization Code Grant Flow with PKCE",
5
5
  "license": "MIT",
6
- "version": "1.22.2",
6
+ "version": "1.22.3",
7
7
  "main": "dist/lib/auth0-spa-js.cjs.js",
8
8
  "types": "dist/typings/index.d.ts",
9
9
  "module": "dist/auth0-spa-js.production.esm.js",
@@ -52,7 +52,6 @@
52
52
  "jest-localstorage-mock": "^2.4.18",
53
53
  "jsonwebtoken": "^8.5.1",
54
54
  "oidc-provider": "^7.10.1",
55
- "pem": "^1.14.4",
56
55
  "prettier": "^2.4.1",
57
56
  "pretty-quick": "^3.1.2",
58
57
  "qss": "^2.0.3",
@@ -80,8 +79,8 @@
80
79
  "dependencies": {
81
80
  "abortcontroller-polyfill": "^1.7.3",
82
81
  "browser-tabs-lock": "^1.2.15",
83
- "core-js": "^3.23.2",
84
- "es-cookie": "^1.3.2",
82
+ "core-js": "^3.24.0",
83
+ "es-cookie": "~1.3.2",
85
84
  "fast-text-encoding": "^1.0.4",
86
85
  "promise-polyfill": "^8.2.3",
87
86
  "unfetch": "^4.2.0"
@@ -403,7 +403,7 @@ export default class Auth0Client {
403
403
  cookieDomain: this.options.cookieDomain
404
404
  });
405
405
  } else {
406
- this.cookieStorage.remove(this.orgHintCookieName);
406
+ this.cookieStorage.remove(this.orgHintCookieName, { cookieDomain: this.options.cookieDomain });
407
407
  }
408
408
  }
409
409
 
@@ -1048,8 +1048,8 @@ export default class Auth0Client {
1048
1048
  }
1049
1049
 
1050
1050
  const postCacheClear = () => {
1051
- this.cookieStorage.remove(this.orgHintCookieName);
1052
- this.cookieStorage.remove(this.isAuthenticatedCookieName);
1051
+ this.cookieStorage.remove(this.orgHintCookieName, { cookieDomain: this.options.cookieDomain });
1052
+ this.cookieStorage.remove(this.isAuthenticatedCookieName, { cookieDomain: this.options.cookieDomain });
1053
1053
 
1054
1054
  if (localOnly) {
1055
1055
  return;
package/src/storage.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as Cookies from 'es-cookie';
2
2
 
3
3
  interface ClientStorageOptions {
4
- daysUntilExpire: number;
4
+ daysUntilExpire?: number;
5
5
  cookieDomain?: string;
6
6
  }
7
7
 
@@ -11,7 +11,7 @@ interface ClientStorageOptions {
11
11
  export type ClientStorage = {
12
12
  get<T extends Object>(key: string): T | undefined;
13
13
  save(key: string, value: any, options?: ClientStorageOptions): void;
14
- remove(key: string): void;
14
+ remove(key: string, options?: ClientStorageOptions): void;
15
15
  };
16
16
 
17
17
  /**
@@ -49,8 +49,14 @@ export const CookieStorage = {
49
49
  Cookies.set(key, JSON.stringify(value), cookieAttributes);
50
50
  },
51
51
 
52
- remove(key: string) {
53
- Cookies.remove(key);
52
+ remove(key: string, options?: ClientStorageOptions) {
53
+ let cookieAttributes: Cookies.CookieAttributes = {};
54
+
55
+ if (options?.cookieDomain) {
56
+ cookieAttributes.domain = options.cookieDomain;
57
+ }
58
+
59
+ Cookies.remove(key ,cookieAttributes);
54
60
  }
55
61
  } as ClientStorage;
56
62
 
@@ -93,9 +99,16 @@ export const CookieStorageWithLegacySameSite = {
93
99
  CookieStorage.save(key, value, options);
94
100
  },
95
101
 
96
- remove(key: string) {
97
- CookieStorage.remove(key);
98
- CookieStorage.remove(`${LEGACY_PREFIX}${key}`);
102
+ remove(key: string, options?: ClientStorageOptions) {
103
+ let cookieAttributes: Cookies.CookieAttributes = {};
104
+
105
+ if (options?.cookieDomain) {
106
+ cookieAttributes.domain = options.cookieDomain;
107
+ }
108
+
109
+ Cookies.remove(key ,cookieAttributes);
110
+ CookieStorage.remove(key, options);
111
+ CookieStorage.remove(`${LEGACY_PREFIX}${key}`, options);
99
112
  }
100
113
  } as ClientStorage;
101
114
 
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export default '1.22.2';
1
+ export default '1.22.3';