@functionalcms/svelte-components 0.8.10 → 0.9.0
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/authStore.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export declare const authStore: {
|
|
|
11
11
|
isAuthenticated: import("svelte/store").Readable<boolean>;
|
|
12
12
|
userId: import("svelte/store").Readable<string>;
|
|
13
13
|
accessToken: import("svelte/store").Readable<string>;
|
|
14
|
+
username: import("svelte/store").Readable<string>;
|
|
14
15
|
initialise: (config: AuthConfig) => Promise<void>;
|
|
15
16
|
signIn: () => Promise<void>;
|
|
16
17
|
signOut: () => Promise<void>;
|
package/dist/authStore.js
CHANGED
|
@@ -3,6 +3,7 @@ import { PublicClientApplication } from "@azure/msal-browser";
|
|
|
3
3
|
const isAuthenticated = writable(false);
|
|
4
4
|
const accessToken = writable('');
|
|
5
5
|
const userId = writable('');
|
|
6
|
+
const username = writable('');
|
|
6
7
|
let msal;
|
|
7
8
|
let authConfig;
|
|
8
9
|
const getMSALConfig = (config) => {
|
|
@@ -35,7 +36,8 @@ const handleToken = (token) => {
|
|
|
35
36
|
if (token !== null) {
|
|
36
37
|
isAuthenticated.set(true);
|
|
37
38
|
accessToken.set(token.accessToken);
|
|
38
|
-
userId.set(token.
|
|
39
|
+
userId.set(token.account.idTokenClaims.sub);
|
|
40
|
+
username.set(token.account.idTokenClaims.name);
|
|
39
41
|
}
|
|
40
42
|
else {
|
|
41
43
|
isAuthenticated.set(false);
|
|
@@ -52,6 +54,7 @@ export const authStore = {
|
|
|
52
54
|
isAuthenticated: readonly(isAuthenticated),
|
|
53
55
|
userId: readonly(userId),
|
|
54
56
|
accessToken: readonly(accessToken),
|
|
57
|
+
username: readonly(username),
|
|
55
58
|
initialise: async (config) => {
|
|
56
59
|
msal = new PublicClientApplication(getMSALConfig(config));
|
|
57
60
|
await msal.initialize();
|
|
@@ -6,8 +6,8 @@ export declare enum Visiblity {
|
|
|
6
6
|
}
|
|
7
7
|
export declare class HeaderNavigationItem {
|
|
8
8
|
name: string;
|
|
9
|
-
path
|
|
10
|
-
action
|
|
9
|
+
path?: string | undefined;
|
|
10
|
+
action?: ClickAction | undefined;
|
|
11
11
|
visiblity: Visiblity;
|
|
12
12
|
}
|
|
13
13
|
export {};
|