@arkitektbedriftene/fe-lib 0.4.39 → 1.1.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/oidc/oidc.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export type AuthContextData = {
|
|
|
14
14
|
state: AuthState;
|
|
15
15
|
handleSigninCallback: () => Promise<User | undefined>;
|
|
16
16
|
redirectToSignin: UserManager["signinRedirect"];
|
|
17
|
+
logout: UserManager["signoutRedirect"];
|
|
17
18
|
};
|
|
18
19
|
export type AuthProviderConfig = {
|
|
19
20
|
onSigninComplete: (user: User | null) => void;
|
package/dist/oidc.es.js
CHANGED
|
@@ -1,82 +1,82 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { createContext as
|
|
1
|
+
import { jsx as A } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as p, useContext as x, useMemo as v, useEffect as m, useState as U, useRef as w, useCallback as C } from "react";
|
|
3
3
|
export * from "oidc-client-ts";
|
|
4
|
-
import
|
|
5
|
-
import { jwtDecode as
|
|
6
|
-
const
|
|
4
|
+
import E from "use-local-storage-state";
|
|
5
|
+
import { jwtDecode as k } from "jwt-decode";
|
|
6
|
+
const I = p(
|
|
7
7
|
null
|
|
8
|
-
),
|
|
9
|
-
const e =
|
|
8
|
+
), L = () => {
|
|
9
|
+
const e = x(I);
|
|
10
10
|
if (!e)
|
|
11
11
|
throw new Error(
|
|
12
12
|
"useImpersonationContext must be used within a ImpersonationContextProvider"
|
|
13
13
|
);
|
|
14
14
|
return e;
|
|
15
|
-
},
|
|
15
|
+
}, F = ({
|
|
16
16
|
children: e
|
|
17
17
|
}) => {
|
|
18
|
-
const [t, c] =
|
|
18
|
+
const [t, c] = E("impersonationState", {
|
|
19
19
|
defaultValue: {}
|
|
20
|
-
}), s =
|
|
20
|
+
}), s = v(() => ({
|
|
21
21
|
accessToken: t == null ? void 0 : t.accessToken,
|
|
22
22
|
userInfo: t == null ? void 0 : t.userInfo,
|
|
23
23
|
setImpersonation: (n, o) => {
|
|
24
24
|
c({ accessToken: n, userInfo: o });
|
|
25
25
|
}
|
|
26
26
|
}), []);
|
|
27
|
-
return /* @__PURE__ */
|
|
28
|
-
},
|
|
29
|
-
const { setImpersonation: t } =
|
|
30
|
-
|
|
27
|
+
return /* @__PURE__ */ A(I.Provider, { value: s, children: e });
|
|
28
|
+
}, j = (e) => {
|
|
29
|
+
const { setImpersonation: t } = L();
|
|
30
|
+
m(() => {
|
|
31
31
|
const { search: c } = window.location, s = new URLSearchParams(c).get(
|
|
32
32
|
"impersonateAccessToken"
|
|
33
33
|
);
|
|
34
34
|
if (s && t) {
|
|
35
|
-
const n =
|
|
35
|
+
const n = k(s);
|
|
36
36
|
t(s, n), e();
|
|
37
37
|
}
|
|
38
38
|
}, []);
|
|
39
39
|
};
|
|
40
|
-
function
|
|
40
|
+
function z(e) {
|
|
41
41
|
return JSON.parse(e).map((s) => {
|
|
42
42
|
const [
|
|
43
43
|
n,
|
|
44
44
|
o,
|
|
45
45
|
a,
|
|
46
46
|
i,
|
|
47
|
-
|
|
48
|
-
] = s.split("|"),
|
|
47
|
+
l
|
|
48
|
+
] = s.split("|"), f = i.split(",");
|
|
49
49
|
return {
|
|
50
50
|
CustomerExternalId: n,
|
|
51
51
|
CustomerFirmId: o,
|
|
52
52
|
CustomerFirmName: a,
|
|
53
|
-
CustomerUserRoles:
|
|
54
|
-
CustomerUserIsAdmin:
|
|
53
|
+
CustomerUserRoles: f,
|
|
54
|
+
CustomerUserIsAdmin: l === "True"
|
|
55
55
|
};
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
|
-
const
|
|
58
|
+
const N = [
|
|
59
59
|
"97",
|
|
60
60
|
"131",
|
|
61
61
|
"132",
|
|
62
62
|
"141"
|
|
63
|
-
], N = [
|
|
64
|
-
"3"
|
|
65
63
|
], V = [
|
|
64
|
+
"3"
|
|
65
|
+
], J = [
|
|
66
66
|
"0"
|
|
67
|
-
],
|
|
67
|
+
], R = ({
|
|
68
68
|
userManager: e,
|
|
69
69
|
context: t,
|
|
70
70
|
children: c
|
|
71
71
|
}) => {
|
|
72
|
-
const [s, n] =
|
|
72
|
+
const [s, n] = U({
|
|
73
73
|
user: null,
|
|
74
74
|
isLoading: !0,
|
|
75
75
|
isAuthenticated: !1,
|
|
76
76
|
isError: !1,
|
|
77
77
|
error: null
|
|
78
|
-
}), o =
|
|
79
|
-
|
|
78
|
+
}), o = w(!1);
|
|
79
|
+
m(() => {
|
|
80
80
|
o.current || (o.current = !0, (async () => {
|
|
81
81
|
try {
|
|
82
82
|
const r = await e.getUser();
|
|
@@ -97,12 +97,12 @@ const z = [
|
|
|
97
97
|
});
|
|
98
98
|
}
|
|
99
99
|
})());
|
|
100
|
-
}, [e]),
|
|
101
|
-
const r = (
|
|
100
|
+
}, [e]), m(() => {
|
|
101
|
+
const r = (d) => {
|
|
102
102
|
n({
|
|
103
|
-
user:
|
|
103
|
+
user: d,
|
|
104
104
|
isLoading: !1,
|
|
105
|
-
isAuthenticated: !
|
|
105
|
+
isAuthenticated: !d.expired,
|
|
106
106
|
isError: !1,
|
|
107
107
|
error: null
|
|
108
108
|
});
|
|
@@ -116,19 +116,19 @@ const z = [
|
|
|
116
116
|
});
|
|
117
117
|
};
|
|
118
118
|
e.events.addUserUnloaded(u);
|
|
119
|
-
const
|
|
119
|
+
const S = (d) => {
|
|
120
120
|
n({
|
|
121
121
|
...s,
|
|
122
122
|
isLoading: !1,
|
|
123
123
|
isError: !0,
|
|
124
|
-
error:
|
|
124
|
+
error: d
|
|
125
125
|
});
|
|
126
126
|
};
|
|
127
|
-
return e.events.addSilentRenewError(
|
|
128
|
-
e.events.removeUserLoaded(r), e.events.removeUserUnloaded(u), e.events.removeSilentRenewError(
|
|
127
|
+
return e.events.addSilentRenewError(S), () => {
|
|
128
|
+
e.events.removeUserLoaded(r), e.events.removeUserUnloaded(u), e.events.removeSilentRenewError(S);
|
|
129
129
|
};
|
|
130
130
|
}, [e]);
|
|
131
|
-
const a =
|
|
131
|
+
const a = C(async () => {
|
|
132
132
|
const r = await e.signinCallback();
|
|
133
133
|
return n({
|
|
134
134
|
user: r ?? null,
|
|
@@ -137,7 +137,7 @@ const z = [
|
|
|
137
137
|
isError: !1,
|
|
138
138
|
error: null
|
|
139
139
|
}), r ?? void 0;
|
|
140
|
-
}, [e]), i =
|
|
140
|
+
}, [e]), i = C(
|
|
141
141
|
async (r) => {
|
|
142
142
|
try {
|
|
143
143
|
await e.signinRedirect(r);
|
|
@@ -146,40 +146,50 @@ const z = [
|
|
|
146
146
|
}
|
|
147
147
|
},
|
|
148
148
|
[e]
|
|
149
|
-
),
|
|
149
|
+
), l = C(
|
|
150
|
+
async (r) => {
|
|
151
|
+
try {
|
|
152
|
+
await e.signoutRedirect(r);
|
|
153
|
+
} catch (u) {
|
|
154
|
+
console.error(u);
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
[e]
|
|
158
|
+
), f = v(
|
|
150
159
|
() => ({
|
|
151
160
|
state: s,
|
|
152
161
|
handleSigninCallback: a,
|
|
153
|
-
redirectToSignin: i
|
|
162
|
+
redirectToSignin: i,
|
|
163
|
+
logout: l
|
|
154
164
|
}),
|
|
155
|
-
[s, a, i]
|
|
165
|
+
[s, a, i, l]
|
|
156
166
|
);
|
|
157
|
-
return /* @__PURE__ */
|
|
158
|
-
},
|
|
159
|
-
const t =
|
|
167
|
+
return /* @__PURE__ */ A(t.Provider, { value: f, children: c });
|
|
168
|
+
}, h = (e) => {
|
|
169
|
+
const t = x(e);
|
|
160
170
|
if (!t)
|
|
161
171
|
throw new Error("useAuthContext must be used within an AuthProvider");
|
|
162
172
|
return t;
|
|
163
173
|
}, P = (e) => {
|
|
164
|
-
const { state: t } =
|
|
174
|
+
const { state: t } = h(e);
|
|
165
175
|
return t;
|
|
166
|
-
},
|
|
167
|
-
const { state: c, handleSigninCallback: s } =
|
|
168
|
-
return
|
|
176
|
+
}, b = (e, t) => {
|
|
177
|
+
const { state: c, handleSigninCallback: s } = h(e), n = w(!1);
|
|
178
|
+
return m(() => {
|
|
169
179
|
n.current || (n.current = !0, s().then(
|
|
170
180
|
(o) => new Promise(
|
|
171
181
|
(a) => setTimeout(() => a(o), 0)
|
|
172
182
|
)
|
|
173
183
|
).then((o) => t == null ? void 0 : t(o)));
|
|
174
184
|
}, [s]), c;
|
|
175
|
-
},
|
|
176
|
-
const t =
|
|
185
|
+
}, K = (e) => {
|
|
186
|
+
const t = p(null);
|
|
177
187
|
return {
|
|
178
188
|
AuthContext: t,
|
|
179
|
-
AuthProvider: ({ children: i }) => /* @__PURE__ */
|
|
180
|
-
useAuthContext: () =>
|
|
189
|
+
AuthProvider: ({ children: i }) => /* @__PURE__ */ A(R, { userManager: e, context: t, children: i }),
|
|
190
|
+
useAuthContext: () => h(t),
|
|
181
191
|
useAuthState: () => P(t),
|
|
182
|
-
useSigninCallback: (i) =>
|
|
192
|
+
useSigninCallback: (i) => b(t, i),
|
|
183
193
|
getAccessToken: async () => {
|
|
184
194
|
const i = await e.getUser();
|
|
185
195
|
return i ? i.access_token : null;
|
|
@@ -187,12 +197,12 @@ const z = [
|
|
|
187
197
|
};
|
|
188
198
|
};
|
|
189
199
|
export {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
200
|
+
F as ImpersonationContextProvider,
|
|
201
|
+
N as ROLESAdminInCompany,
|
|
202
|
+
J as ROLESAnsatt,
|
|
203
|
+
V as ROLESMAKSAdministrator,
|
|
204
|
+
K as createAuthContext,
|
|
205
|
+
z as parseUserProfileFCString,
|
|
206
|
+
j as useImpersonationCallback,
|
|
207
|
+
L as useImpersonationContext
|
|
198
208
|
};
|
|
@@ -3,6 +3,6 @@ export declare class LinkTargetNode extends LinkNode {
|
|
|
3
3
|
static getType(): string;
|
|
4
4
|
constructor(url: string, attrs?: LinkAttributes, key?: string);
|
|
5
5
|
static clone(node: LinkTargetNode): LinkTargetNode;
|
|
6
|
-
exportJSON(): SerializedLinkNode;
|
|
6
|
+
exportJSON(): SerializedLinkNode | import("@lexical/link").SerializedAutoLinkNode;
|
|
7
7
|
static importJSON(serializedNode: SerializedLinkNode): LinkNode;
|
|
8
8
|
}
|
|
@@ -5,7 +5,7 @@ export declare class RutineLinkNode extends LinkNode {
|
|
|
5
5
|
static baseURL: string;
|
|
6
6
|
static getType(): string;
|
|
7
7
|
static clone(node: RutineLinkNode): RutineLinkNode;
|
|
8
|
-
createDOM(config: EditorConfig): HTMLAnchorElement;
|
|
8
|
+
createDOM(config: EditorConfig): HTMLSpanElement | HTMLAnchorElement;
|
|
9
9
|
static importJSON(serializedNode: SerializedLinkNode): RutineLinkNode;
|
|
10
10
|
exportJSON(): {
|
|
11
11
|
type: string;
|
|
@@ -18,6 +18,18 @@ export declare class RutineLinkNode extends LinkNode {
|
|
|
18
18
|
indent: number;
|
|
19
19
|
rel?: string | null | undefined;
|
|
20
20
|
target?: string | null | undefined;
|
|
21
|
+
} | {
|
|
22
|
+
type: string;
|
|
23
|
+
url: string;
|
|
24
|
+
version: number;
|
|
25
|
+
title?: string | null | undefined;
|
|
26
|
+
children: import("lexical").SerializedLexicalNode[];
|
|
27
|
+
direction: "ltr" | "rtl" | null;
|
|
28
|
+
format: import("lexical").ElementFormatType;
|
|
29
|
+
indent: number;
|
|
30
|
+
rel?: string | null | undefined;
|
|
31
|
+
target?: string | null | undefined;
|
|
32
|
+
isUnlinked: boolean;
|
|
21
33
|
};
|
|
22
34
|
getURL(): string;
|
|
23
35
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arkitektbedriftene/fe-lib",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -73,21 +73,21 @@
|
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
75
|
"@floating-ui/react": "^0.26.0",
|
|
76
|
-
"@lexical/headless": "~0.
|
|
77
|
-
"@lexical/html": "~0.
|
|
78
|
-
"@lexical/link": "~0.
|
|
79
|
-
"@lexical/list": "~0.
|
|
80
|
-
"@lexical/react": "~0.
|
|
81
|
-
"@lexical/rich-text": "~0.
|
|
82
|
-
"@lexical/selection": "~0.
|
|
83
|
-
"@lexical/table": "~0.
|
|
76
|
+
"@lexical/headless": "~0.17.0",
|
|
77
|
+
"@lexical/html": "~0.17.0",
|
|
78
|
+
"@lexical/link": "~0.17.0",
|
|
79
|
+
"@lexical/list": "~0.17.0",
|
|
80
|
+
"@lexical/react": "~0.17.0",
|
|
81
|
+
"@lexical/rich-text": "~0.17.0",
|
|
82
|
+
"@lexical/selection": "~0.17.0",
|
|
83
|
+
"@lexical/table": "~0.17.0",
|
|
84
84
|
"@radix-ui/react-checkbox": "^1.0.4",
|
|
85
85
|
"@radix-ui/react-dialog": "^1.0.5",
|
|
86
86
|
"@radix-ui/react-dropdown-menu": "^2.0.6",
|
|
87
87
|
"@radix-ui/react-toolbar": "^1.0.4",
|
|
88
88
|
"@stitches/react": "^1.2.8",
|
|
89
89
|
"jwt-decode": "^4.0.0",
|
|
90
|
-
"lexical": "~0.
|
|
90
|
+
"lexical": "~0.17.0",
|
|
91
91
|
"oidc-client-ts": "^2.2.2",
|
|
92
92
|
"react-icons": "^4.8.0",
|
|
93
93
|
"react-select": "^5.8.0",
|