@ztimson/momentum 1.5.2 → 1.5.4
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/auth.d.ts +12 -1
- package/dist/auth.d.ts.map +1 -1
- package/dist/index.js +9 -7
- package/dist/index.mjs +9 -7
- package/package.json +1 -1
package/dist/auth.d.ts
CHANGED
|
@@ -28,7 +28,16 @@ export declare class Auth extends PathEventEmitter {
|
|
|
28
28
|
/** Update user info without changing the session */
|
|
29
29
|
set user(user: User | null | undefined);
|
|
30
30
|
constructor(momentum: Momentum);
|
|
31
|
-
|
|
31
|
+
/**
|
|
32
|
+
* Handle login flow automatically:
|
|
33
|
+
* 1. Check for URL token and use if provided
|
|
34
|
+
* 2. Check server for session (retrieve cookie)
|
|
35
|
+
* 3. Open SSO login
|
|
36
|
+
* 4. Handle redirects/events
|
|
37
|
+
* @param {boolean | string} reload - Perform redirect (string) or reload (true) on success
|
|
38
|
+
*/
|
|
39
|
+
handleLogin(redirect: string): Promise<SessionData | null>;
|
|
40
|
+
handleLogin(reload?: boolean): Promise<SessionData | null>;
|
|
32
41
|
/**
|
|
33
42
|
* Check if origin is recognized & whitelisted
|
|
34
43
|
* @param {string} host Origin to check
|
|
@@ -58,7 +67,9 @@ export declare class Auth extends PathEventEmitter {
|
|
|
58
67
|
loginRedirect(host?: string): Promise<string>;
|
|
59
68
|
/**
|
|
60
69
|
* Logout current user
|
|
70
|
+
* @param {boolean | string} reload - Perform redirect (string) or reload (true) on logout
|
|
61
71
|
*/
|
|
72
|
+
logout(redirect: string): Promise<void>;
|
|
62
73
|
logout(reload?: boolean): Promise<void>;
|
|
63
74
|
/**
|
|
64
75
|
* Create a new user with login
|
package/dist/auth.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,gBAAgB,EAAM,MAAM,QAAQ,CAA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
|
|
2875
2875
|
s = await this.loginRedirect();
|
|
2876
|
-
if (!!s && reload) location.reload
|
|
2876
|
+
if (!!s && reload) if (typeof reload == "string") location.href = reload;
|
|
2877
|
+
else location.reload();
|
|
2877
2878
|
}
|
|
2878
|
-
return this.session;
|
|
2879
|
+
return this.session || null;
|
|
2879
2880
|
}
|
|
2880
2881
|
/**
|
|
2881
2882
|
* Check if origin is recognized & whitelisted
|
|
@@ -2940,15 +2941,16 @@
|
|
|
2940
2941
|
}
|
|
2941
2942
|
});
|
|
2942
2943
|
}
|
|
2943
|
-
/**
|
|
2944
|
-
* Logout current user
|
|
2945
|
-
*/
|
|
2946
2944
|
async logout(reload = this.momentum.opts?.expiredStrategy == "reload") {
|
|
2947
2945
|
await this.momentum.api.request({
|
|
2948
2946
|
url: "api/auth/logout",
|
|
2949
2947
|
method: "DELETE"
|
|
2950
2948
|
});
|
|
2951
|
-
if (reload)
|
|
2949
|
+
if (reload) {
|
|
2950
|
+
if (typeof reload == "string") location.href = reload;
|
|
2951
|
+
else location.reload();
|
|
2952
|
+
return;
|
|
2953
|
+
}
|
|
2952
2954
|
this.momentum.api.token = this.session = this.user = null;
|
|
2953
2955
|
await this.readSession();
|
|
2954
2956
|
}
|
|
@@ -4889,7 +4891,7 @@ ${Object.entries(t).map(([name, value]) => `--theme-${kebabCase(name)}: ${value}
|
|
|
4889
4891
|
};
|
|
4890
4892
|
//#endregion
|
|
4891
4893
|
//#region package.json
|
|
4892
|
-
var version = "1.5.
|
|
4894
|
+
var version = "1.5.4";
|
|
4893
4895
|
//#endregion
|
|
4894
4896
|
//#region src/webRtc.ts
|
|
4895
4897
|
var WebRtc = class extends PathEventEmitter {
|
package/dist/index.mjs
CHANGED
|
@@ -2869,9 +2869,10 @@ var Auth = class extends PathEventEmitter {
|
|
|
2869
2869
|
}
|
|
2870
2870
|
if (!s?.user) {
|
|
2871
2871
|
s = await this.loginRedirect();
|
|
2872
|
-
if (!!s && reload) location.reload
|
|
2872
|
+
if (!!s && reload) if (typeof reload == "string") location.href = reload;
|
|
2873
|
+
else location.reload();
|
|
2873
2874
|
}
|
|
2874
|
-
return this.session;
|
|
2875
|
+
return this.session || null;
|
|
2875
2876
|
}
|
|
2876
2877
|
/**
|
|
2877
2878
|
* Check if origin is recognized & whitelisted
|
|
@@ -2936,15 +2937,16 @@ var Auth = class extends PathEventEmitter {
|
|
|
2936
2937
|
}
|
|
2937
2938
|
});
|
|
2938
2939
|
}
|
|
2939
|
-
/**
|
|
2940
|
-
* Logout current user
|
|
2941
|
-
*/
|
|
2942
2940
|
async logout(reload = this.momentum.opts?.expiredStrategy == "reload") {
|
|
2943
2941
|
await this.momentum.api.request({
|
|
2944
2942
|
url: "api/auth/logout",
|
|
2945
2943
|
method: "DELETE"
|
|
2946
2944
|
});
|
|
2947
|
-
if (reload)
|
|
2945
|
+
if (reload) {
|
|
2946
|
+
if (typeof reload == "string") location.href = reload;
|
|
2947
|
+
else location.reload();
|
|
2948
|
+
return;
|
|
2949
|
+
}
|
|
2948
2950
|
this.momentum.api.token = this.session = this.user = null;
|
|
2949
2951
|
await this.readSession();
|
|
2950
2952
|
}
|
|
@@ -4885,7 +4887,7 @@ var Static = class extends Storage {
|
|
|
4885
4887
|
};
|
|
4886
4888
|
//#endregion
|
|
4887
4889
|
//#region package.json
|
|
4888
|
-
var version = "1.5.
|
|
4890
|
+
var version = "1.5.4";
|
|
4889
4891
|
//#endregion
|
|
4890
4892
|
//#region src/webRtc.ts
|
|
4891
4893
|
var WebRtc = class extends PathEventEmitter {
|