@mu-cabin/opms-permission 0.8.4 → 0.8.6

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.
package/dist/index.cjs CHANGED
@@ -303,9 +303,9 @@ var Permission = class {
303
303
  /**
304
304
  * Logout and clear userInfo
305
305
  */
306
- async logout() {
306
+ async logout(clearData = false) {
307
307
  await logout(this.baseUrl);
308
- this.clear();
308
+ clearData && this.clear();
309
309
  }
310
310
  clear() {
311
311
  this._userInfo = null;
@@ -535,8 +535,8 @@ function jumpToSSOLogout({
535
535
  throw new Error("baseUrl is required");
536
536
  }
537
537
  const { location } = window;
538
- const ssoLoginUrl = `${baseUrl}/idp/oauth2/authorize?client_id=${clientId}&response_type=code&redirect_uri=${location.origin}/`;
539
- const redirectUrl = redirectToUrl || ssoLoginUrl;
538
+ const ssoLoginUrl = `${baseUrl}/idp/oauth2/authorize?client_id=${clientId}&response_type=code&redirect_uri=${location.origin}${redirectToUrl || "/"}`;
539
+ const redirectUrl = ssoLoginUrl;
540
540
  const logoutUrl = new URL(`${baseUrl}/idp/profile/OAUTH2/Redirect/GLO`);
541
541
  logoutUrl.searchParams.set("response_type", "code");
542
542
  logoutUrl.searchParams.set("entityId", clientId);
package/dist/index.d.mts CHANGED
@@ -65,7 +65,7 @@ declare class Permission {
65
65
  /**
66
66
  * Logout and clear userInfo
67
67
  */
68
- logout(): Promise<void>;
68
+ logout(clearData?: boolean): Promise<void>;
69
69
  clear(): void;
70
70
  getUserInfo(): Promise<UserInfo | null>;
71
71
  /**
package/dist/index.d.ts CHANGED
@@ -65,7 +65,7 @@ declare class Permission {
65
65
  /**
66
66
  * Logout and clear userInfo
67
67
  */
68
- logout(): Promise<void>;
68
+ logout(clearData?: boolean): Promise<void>;
69
69
  clear(): void;
70
70
  getUserInfo(): Promise<UserInfo | null>;
71
71
  /**
package/dist/index.mjs CHANGED
@@ -265,9 +265,9 @@ var Permission = class {
265
265
  /**
266
266
  * Logout and clear userInfo
267
267
  */
268
- async logout() {
268
+ async logout(clearData = false) {
269
269
  await logout(this.baseUrl);
270
- this.clear();
270
+ clearData && this.clear();
271
271
  }
272
272
  clear() {
273
273
  this._userInfo = null;
@@ -497,8 +497,8 @@ function jumpToSSOLogout({
497
497
  throw new Error("baseUrl is required");
498
498
  }
499
499
  const { location } = window;
500
- const ssoLoginUrl = `${baseUrl}/idp/oauth2/authorize?client_id=${clientId}&response_type=code&redirect_uri=${location.origin}/`;
501
- const redirectUrl = redirectToUrl || ssoLoginUrl;
500
+ const ssoLoginUrl = `${baseUrl}/idp/oauth2/authorize?client_id=${clientId}&response_type=code&redirect_uri=${location.origin}${redirectToUrl || "/"}`;
501
+ const redirectUrl = ssoLoginUrl;
502
502
  const logoutUrl = new URL(`${baseUrl}/idp/profile/OAUTH2/Redirect/GLO`);
503
503
  logoutUrl.searchParams.set("response_type", "code");
504
504
  logoutUrl.searchParams.set("entityId", clientId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mu-cabin/opms-permission",
3
- "version": "0.8.4",
3
+ "version": "0.8.6",
4
4
  "description": "Frontend SDK for OPMS permission and auth management.",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",