@ibdop/platform-kit 1.0.13 → 1.0.14
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.js +7 -7
- package/dist/index.mjs +346 -326
- package/dist/index.umd.js +8 -8
- package/dist/services/api.d.ts.map +1 -1
- package/dist/utils/shellAuth.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/services/api.ts +9 -1
- package/src/utils/shellAuth.ts +30 -1
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import et, { useState as
|
|
1
|
+
import et, { useState as T, useRef as tt, useCallback as R, useEffect as U, useMemo as ye, Component as Lt, createContext as Ut, useContext as Vt } from "react";
|
|
2
2
|
import Bt from "axios";
|
|
3
3
|
function B() {
|
|
4
4
|
if (typeof window > "u") return null;
|
|
@@ -10,10 +10,25 @@ function B() {
|
|
|
10
10
|
}
|
|
11
11
|
function Wt() {
|
|
12
12
|
const t = B();
|
|
13
|
-
|
|
13
|
+
if (!t)
|
|
14
|
+
return { isAuthenticated: !1 };
|
|
15
|
+
let r;
|
|
16
|
+
const o = t;
|
|
17
|
+
if (t.user?.access_token)
|
|
18
|
+
r = t.user.access_token;
|
|
19
|
+
else if (t.user?.profile?.access_token)
|
|
20
|
+
r = t.user.profile.access_token;
|
|
21
|
+
else if (typeof o.getAccessToken == "function")
|
|
22
|
+
try {
|
|
23
|
+
const a = o.getAccessToken();
|
|
24
|
+
a instanceof Promise ? console.warn("[shellAuth] getAccessToken returned Promise - token may not be available synchronously") : typeof a == "string" && (r = a);
|
|
25
|
+
} catch (a) {
|
|
26
|
+
console.warn("[shellAuth] Failed to get access token via getAccessToken:", a);
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
14
29
|
isAuthenticated: t.isAuthenticated,
|
|
15
|
-
user: t.user
|
|
16
|
-
}
|
|
30
|
+
user: t.user ? { ...t.user, access_token: r } : void 0
|
|
31
|
+
};
|
|
17
32
|
}
|
|
18
33
|
function dr() {
|
|
19
34
|
const t = B();
|
|
@@ -37,19 +52,19 @@ const Je = {
|
|
|
37
52
|
}
|
|
38
53
|
};
|
|
39
54
|
function ae() {
|
|
40
|
-
const [t, r] =
|
|
55
|
+
const [t, r] = T(null), [o, a] = T(!0), i = tt(0), d = 20, n = R(() => B(), []);
|
|
41
56
|
U(() => {
|
|
42
57
|
const v = n();
|
|
43
58
|
if (v) {
|
|
44
|
-
r(v),
|
|
59
|
+
r(v), a(!1);
|
|
45
60
|
return;
|
|
46
61
|
}
|
|
47
62
|
const c = (f) => {
|
|
48
|
-
r(f.detail),
|
|
63
|
+
r(f.detail), a(!1);
|
|
49
64
|
}, g = setInterval(() => {
|
|
50
|
-
|
|
65
|
+
i.current++;
|
|
51
66
|
const f = n();
|
|
52
|
-
f ? (Je.log("Auth found via polling, attempts:",
|
|
67
|
+
f ? (Je.log("Auth found via polling, attempts:", i.current), r(f), a(!1), clearInterval(g)) : i.current >= d && (a(!1), clearInterval(g));
|
|
53
68
|
}, 500);
|
|
54
69
|
return window.addEventListener("shell-auth-ready", c), () => {
|
|
55
70
|
clearInterval(g), window.removeEventListener("shell-auth-ready", c);
|
|
@@ -58,7 +73,7 @@ function ae() {
|
|
|
58
73
|
const l = t || {
|
|
59
74
|
user: null,
|
|
60
75
|
isAuthenticated: !1,
|
|
61
|
-
isLoading:
|
|
76
|
+
isLoading: o,
|
|
62
77
|
signinRedirect: async () => {
|
|
63
78
|
const v = B();
|
|
64
79
|
v?.signinRedirect ? await v.signinRedirect() : typeof window < "u" && (window.location.href = "/");
|
|
@@ -88,25 +103,25 @@ function Gt(t) {
|
|
|
88
103
|
return "unknown-mfe";
|
|
89
104
|
}
|
|
90
105
|
function Yt(t) {
|
|
91
|
-
const [r,
|
|
106
|
+
const [r, o] = T(null), [a, i] = T(!0), [d, n] = T(null), p = R(() => {
|
|
92
107
|
const v = Gt(t?.mfeName).replace("@ib-dop/", "");
|
|
93
|
-
|
|
108
|
+
i(!0), n(null), fetch(`/svc/${v}/info.json`).then((c) => {
|
|
94
109
|
if (!c.ok)
|
|
95
110
|
throw new Error(`HTTP ${c.status}: ${c.statusText}`);
|
|
96
111
|
return c.json();
|
|
97
112
|
}).then((c) => {
|
|
98
|
-
|
|
113
|
+
o(c);
|
|
99
114
|
}).catch((c) => {
|
|
100
115
|
Ht.error("Failed to load info:", c), n(c instanceof Error ? c.message : String(c));
|
|
101
116
|
}).finally(() => {
|
|
102
|
-
|
|
117
|
+
i(!1);
|
|
103
118
|
});
|
|
104
119
|
}, [t?.mfeName]);
|
|
105
120
|
return U(() => {
|
|
106
121
|
p();
|
|
107
122
|
}, [p]), {
|
|
108
123
|
data: r,
|
|
109
|
-
isLoading:
|
|
124
|
+
isLoading: a,
|
|
110
125
|
error: d,
|
|
111
126
|
refetch: p
|
|
112
127
|
};
|
|
@@ -125,11 +140,11 @@ const _e = {
|
|
|
125
140
|
environment: "development"
|
|
126
141
|
};
|
|
127
142
|
function gr() {
|
|
128
|
-
const [t, r] =
|
|
143
|
+
const [t, r] = T(null), [o, a] = T(!0), [i, d] = T(null);
|
|
129
144
|
return U(() => {
|
|
130
145
|
(() => {
|
|
131
146
|
if (typeof sessionStorage > "u") {
|
|
132
|
-
d("sessionStorage not available"), r(re),
|
|
147
|
+
d("sessionStorage not available"), r(re), a(!1);
|
|
133
148
|
return;
|
|
134
149
|
}
|
|
135
150
|
try {
|
|
@@ -142,13 +157,13 @@ function gr() {
|
|
|
142
157
|
} catch (p) {
|
|
143
158
|
_e.error("Error parsing config:", p), r(re), d("Error parsing config");
|
|
144
159
|
} finally {
|
|
145
|
-
|
|
160
|
+
a(!1);
|
|
146
161
|
}
|
|
147
162
|
})();
|
|
148
163
|
}, []), {
|
|
149
164
|
data: t,
|
|
150
|
-
isLoading:
|
|
151
|
-
error:
|
|
165
|
+
isLoading: o,
|
|
166
|
+
error: i
|
|
152
167
|
};
|
|
153
168
|
}
|
|
154
169
|
const rt = "platform-kit", ne = {
|
|
@@ -164,12 +179,12 @@ const rt = "platform-kit", ne = {
|
|
|
164
179
|
};
|
|
165
180
|
function qt(t) {
|
|
166
181
|
const r = t.response;
|
|
167
|
-
let
|
|
168
|
-
return r ? r.status === 401 ?
|
|
182
|
+
let o = "unknown";
|
|
183
|
+
return r ? r.status === 401 ? o = "unauthorized" : r.status === 403 ? o = "forbidden" : r.status === 404 ? o = "not_found" : r.status >= 500 && (o = "server") : o = "network", {
|
|
169
184
|
message: r?.data?.message ?? t.message ?? "Unknown error",
|
|
170
185
|
code: r?.data?.code,
|
|
171
186
|
status: r?.status,
|
|
172
|
-
type:
|
|
187
|
+
type: o,
|
|
173
188
|
timestamp: Date.now(),
|
|
174
189
|
url: t.config?.url
|
|
175
190
|
};
|
|
@@ -182,7 +197,7 @@ function Zt(t) {
|
|
|
182
197
|
return new Promise((r) => setTimeout(r, t));
|
|
183
198
|
}
|
|
184
199
|
function Qt(t = {}) {
|
|
185
|
-
const r = t.name || rt,
|
|
200
|
+
const r = t.name || rt, o = t.retries ?? Jt, a = t.retryDelay ?? Kt, i = {
|
|
186
201
|
log: (...n) => ne.log(`[API:${r}]`, ...n),
|
|
187
202
|
warn: (...n) => ne.warn(`[API:${r}]`, ...n),
|
|
188
203
|
error: (...n) => ne.error(`[API:${r}]`, ...n),
|
|
@@ -197,75 +212,80 @@ function Qt(t = {}) {
|
|
|
197
212
|
return d.interceptors.request.use(
|
|
198
213
|
(n) => {
|
|
199
214
|
const p = Wt();
|
|
200
|
-
if (
|
|
215
|
+
if (i.info("Auth state check:", {
|
|
216
|
+
isAuthenticated: p?.isAuthenticated,
|
|
217
|
+
hasUser: !!p?.user,
|
|
218
|
+
userKeys: p?.user ? Object.keys(p.user) : [],
|
|
219
|
+
token: p?.user?.access_token ? "(present)" : "(missing)"
|
|
220
|
+
}), p?.isAuthenticated) {
|
|
201
221
|
const l = p.user?.access_token || p.user?.profile?.access_token;
|
|
202
|
-
l && n.headers ? (n.headers.Authorization = `Bearer ${l}`,
|
|
222
|
+
l && n.headers ? (n.headers.Authorization = `Bearer ${l}`, i.info("Auth token attached")) : i.warn("User is authenticated but no token found in authState.user or authState.user.profile");
|
|
203
223
|
} else
|
|
204
|
-
|
|
205
|
-
return
|
|
224
|
+
i.info("User not authenticated - request without token");
|
|
225
|
+
return i.log(`${n.method?.toUpperCase()} ${n.url}`), n;
|
|
206
226
|
},
|
|
207
|
-
(n) => (
|
|
227
|
+
(n) => (i.error("Request interceptor error:", n.message), Promise.reject(n))
|
|
208
228
|
), d.interceptors.response.use(
|
|
209
|
-
(n) => (
|
|
229
|
+
(n) => (i.log(`Response ${n.status}:`, n.config.url), n),
|
|
210
230
|
async (n) => {
|
|
211
231
|
const p = n.response?.status, l = n.config?.url, v = n.config?._retryCount ?? 0;
|
|
212
|
-
if (Xt(p) && v <
|
|
232
|
+
if (Xt(p) && v < o) {
|
|
213
233
|
const c = n.config;
|
|
214
234
|
c._retryCount = v + 1;
|
|
215
|
-
const g =
|
|
216
|
-
return
|
|
235
|
+
const g = a * Math.pow(2, v);
|
|
236
|
+
return i.warn(`Retrying (${c._retryCount}/${o}) after ${g}ms:`, l), await Zt(g), d.request(c);
|
|
217
237
|
}
|
|
218
|
-
return p === 401 ? (
|
|
238
|
+
return p === 401 ? (i.warn("401 Unauthorized - triggering re-auth"), zt()) : p === 403 ? i.warn("403 Forbidden - insufficient permissions") : p === 404 ? i.warn("404 Not found:", l) : p === 429 ? i.warn("429 Rate limited") : p === 500 ? i.error("500 Server error:", l) : n.response ? i.warn(`Error ${p}:`, n.message) : i.error("Network error - backend may be unavailable:", l), Promise.reject(qt(n));
|
|
219
239
|
}
|
|
220
240
|
), d;
|
|
221
241
|
}
|
|
222
242
|
const W = Qt();
|
|
223
|
-
async function mr(t, r,
|
|
224
|
-
const
|
|
243
|
+
async function mr(t, r, o = W) {
|
|
244
|
+
const a = await o.get(t, { params: r });
|
|
225
245
|
return {
|
|
226
|
-
data:
|
|
227
|
-
status:
|
|
228
|
-
ok:
|
|
246
|
+
data: a.data,
|
|
247
|
+
status: a.status,
|
|
248
|
+
ok: a.status >= 200 && a.status < 300
|
|
229
249
|
};
|
|
230
250
|
}
|
|
231
|
-
async function _r(t, r,
|
|
232
|
-
const
|
|
251
|
+
async function _r(t, r, o = W) {
|
|
252
|
+
const a = await o.post(t, r);
|
|
233
253
|
return {
|
|
234
|
-
data:
|
|
235
|
-
status:
|
|
236
|
-
ok:
|
|
254
|
+
data: a.data,
|
|
255
|
+
status: a.status,
|
|
256
|
+
ok: a.status >= 200 && a.status < 300
|
|
237
257
|
};
|
|
238
258
|
}
|
|
239
|
-
async function vr(t, r,
|
|
240
|
-
const
|
|
259
|
+
async function vr(t, r, o = W) {
|
|
260
|
+
const a = await o.put(t, r);
|
|
241
261
|
return {
|
|
242
|
-
data:
|
|
243
|
-
status:
|
|
244
|
-
ok:
|
|
262
|
+
data: a.data,
|
|
263
|
+
status: a.status,
|
|
264
|
+
ok: a.status >= 200 && a.status < 300
|
|
245
265
|
};
|
|
246
266
|
}
|
|
247
267
|
async function yr(t, r = W) {
|
|
248
|
-
const
|
|
268
|
+
const o = await r.delete(t);
|
|
249
269
|
return {
|
|
250
|
-
data:
|
|
251
|
-
status:
|
|
252
|
-
ok:
|
|
270
|
+
data: o.data,
|
|
271
|
+
status: o.status,
|
|
272
|
+
ok: o.status >= 200 && o.status < 300
|
|
253
273
|
};
|
|
254
274
|
}
|
|
255
275
|
function nt(t) {
|
|
256
276
|
if (typeof window > "u") return;
|
|
257
|
-
const r = window.__MF_NAME__ || "unknown",
|
|
277
|
+
const r = window.__MF_NAME__ || "unknown", o = {
|
|
258
278
|
...t,
|
|
259
279
|
mfeName: r,
|
|
260
280
|
timestamp: Date.now()
|
|
261
281
|
};
|
|
262
282
|
window.dispatchEvent(new CustomEvent("mfe-notification", {
|
|
263
|
-
detail:
|
|
283
|
+
detail: o,
|
|
264
284
|
bubbles: !0
|
|
265
285
|
}));
|
|
266
286
|
}
|
|
267
287
|
function Ke(t, r) {
|
|
268
|
-
const
|
|
288
|
+
const o = {
|
|
269
289
|
network: {
|
|
270
290
|
title: "Нет подключения",
|
|
271
291
|
message: "Сервер недоступен. Проверьте подключение к интернету."
|
|
@@ -294,11 +314,11 @@ function Ke(t, r) {
|
|
|
294
314
|
title: "Неизвестная ошибка",
|
|
295
315
|
message: t.message || "Произошла неизвестная ошибка."
|
|
296
316
|
}
|
|
297
|
-
},
|
|
317
|
+
}, a = o[t.type] || o.unknown;
|
|
298
318
|
nt({
|
|
299
319
|
type: t.type === "network" ? "warning" : "error",
|
|
300
|
-
title:
|
|
301
|
-
message: r ? `${
|
|
320
|
+
title: a.title,
|
|
321
|
+
message: r ? `${a.message} (${r})` : a.message
|
|
302
322
|
});
|
|
303
323
|
}
|
|
304
324
|
function er(t) {
|
|
@@ -306,19 +326,19 @@ function er(t) {
|
|
|
306
326
|
}
|
|
307
327
|
function ie(t, r = {}) {
|
|
308
328
|
const {
|
|
309
|
-
notifyOnError:
|
|
310
|
-
notifyOnSuccess:
|
|
311
|
-
successMessage:
|
|
329
|
+
notifyOnError: o = !0,
|
|
330
|
+
notifyOnSuccess: a = !1,
|
|
331
|
+
successMessage: i,
|
|
312
332
|
errorContext: d,
|
|
313
333
|
onSuccess: n,
|
|
314
334
|
onError: p
|
|
315
|
-
} = r, [l, v] =
|
|
335
|
+
} = r, [l, v] = T(null), [c, g] = T(null), [f, E] = T(!1), y = tt(null), N = c !== null, S = l !== null && !f && !N;
|
|
316
336
|
U(() => () => {
|
|
317
337
|
y.current && y.current.abort();
|
|
318
338
|
}, []);
|
|
319
|
-
const x =
|
|
339
|
+
const x = R(() => {
|
|
320
340
|
y.current && (y.current.abort(), y.current = null, E(!1));
|
|
321
|
-
}, []), _ =
|
|
341
|
+
}, []), _ = R(async () => {
|
|
322
342
|
y.current && y.current.abort(), y.current = new AbortController();
|
|
323
343
|
const j = y.current.signal;
|
|
324
344
|
E(!0), g(null);
|
|
@@ -327,10 +347,10 @@ function ie(t, r = {}) {
|
|
|
327
347
|
if (j.aborted)
|
|
328
348
|
return null;
|
|
329
349
|
if (P.ok)
|
|
330
|
-
return v(P.data),
|
|
350
|
+
return v(P.data), a && i && nt({
|
|
331
351
|
type: "success",
|
|
332
352
|
title: "Успешно",
|
|
333
|
-
message:
|
|
353
|
+
message: i
|
|
334
354
|
}), n?.(P.data), P.data;
|
|
335
355
|
{
|
|
336
356
|
const L = {
|
|
@@ -339,17 +359,17 @@ function ie(t, r = {}) {
|
|
|
339
359
|
type: "client",
|
|
340
360
|
timestamp: Date.now()
|
|
341
361
|
};
|
|
342
|
-
return g(L),
|
|
362
|
+
return g(L), o && Ke(L, d), p?.(L), null;
|
|
343
363
|
}
|
|
344
364
|
} catch (P) {
|
|
345
365
|
if (er(P))
|
|
346
366
|
return null;
|
|
347
367
|
const L = P;
|
|
348
|
-
return g(L),
|
|
368
|
+
return g(L), o && Ke(L, d), p?.(L), null;
|
|
349
369
|
} finally {
|
|
350
370
|
j.aborted || E(!1), y.current = null;
|
|
351
371
|
}
|
|
352
|
-
}, [t,
|
|
372
|
+
}, [t, o, a, i, d, n, p]), C = R(() => {
|
|
353
373
|
v(null), g(null), E(!1);
|
|
354
374
|
}, []);
|
|
355
375
|
return {
|
|
@@ -357,32 +377,32 @@ function ie(t, r = {}) {
|
|
|
357
377
|
error: c,
|
|
358
378
|
isLoading: f,
|
|
359
379
|
isError: N,
|
|
360
|
-
isSuccess:
|
|
380
|
+
isSuccess: S,
|
|
361
381
|
execute: _,
|
|
362
|
-
reset:
|
|
382
|
+
reset: C,
|
|
363
383
|
abort: x
|
|
364
384
|
};
|
|
365
385
|
}
|
|
366
386
|
function Er(t, r = {}) {
|
|
367
|
-
const { skip:
|
|
368
|
-
const v =
|
|
387
|
+
const { skip: o = !1, headers: a, immediate: i = !0, ...d } = r, n = ye(() => (l) => {
|
|
388
|
+
const v = a ? a() : {};
|
|
369
389
|
return W.get(t, {
|
|
370
390
|
headers: { "Content-Type": "application/json", ...v },
|
|
371
391
|
signal: l
|
|
372
392
|
}).then((c) => ({ data: c.data, status: c.status, ok: c.status >= 200 && c.status < 300 }));
|
|
373
|
-
}, [t,
|
|
393
|
+
}, [t, a]), p = ie(n, { ...d });
|
|
374
394
|
return U(() => {
|
|
375
|
-
|
|
376
|
-
}, [
|
|
395
|
+
i && !o && p.execute();
|
|
396
|
+
}, [i, o, t]), p;
|
|
377
397
|
}
|
|
378
|
-
function wr(t, r,
|
|
379
|
-
return ie((
|
|
398
|
+
function wr(t, r, o = {}) {
|
|
399
|
+
return ie((i) => W.post(t, r, { signal: i }).then((d) => ({ data: d.data, status: d.status, ok: d.status >= 200 && d.status < 300 })), o);
|
|
380
400
|
}
|
|
381
|
-
function br(t, r,
|
|
382
|
-
return ie((
|
|
401
|
+
function br(t, r, o = {}) {
|
|
402
|
+
return ie((i) => W.put(t, r, { signal: i }).then((d) => ({ data: d.data, status: d.status, ok: d.status >= 200 && d.status < 300 })), o);
|
|
383
403
|
}
|
|
384
404
|
function xr(t, r = {}) {
|
|
385
|
-
return ie((
|
|
405
|
+
return ie((a) => W.delete(t, { signal: a }).then((i) => ({ data: i.data, status: i.status, ok: i.status >= 200 && i.status < 300 })), r);
|
|
386
406
|
}
|
|
387
407
|
const tr = {
|
|
388
408
|
canView: ["all"],
|
|
@@ -394,25 +414,25 @@ const tr = {
|
|
|
394
414
|
canManageUsers: ["ibdop-admin"]
|
|
395
415
|
};
|
|
396
416
|
function Ar(t = {}) {
|
|
397
|
-
const r = ae(),
|
|
417
|
+
const r = ae(), o = ye(() => ({
|
|
398
418
|
...tr,
|
|
399
419
|
...t
|
|
400
|
-
}), [t]),
|
|
420
|
+
}), [t]), a = ye(() => {
|
|
401
421
|
const d = r.user?.profile?.realm_roles || r.user?.profile?.roles || [];
|
|
402
422
|
return Array.isArray(d) ? d : [d];
|
|
403
|
-
}, [r.user]),
|
|
423
|
+
}, [r.user]), i = (d) => d.includes("all") ? !0 : d.some((n) => a.includes(n));
|
|
404
424
|
return {
|
|
405
|
-
canView:
|
|
406
|
-
canEdit:
|
|
407
|
-
canDelete:
|
|
408
|
-
canAdmin:
|
|
409
|
-
canViewSensitiveData:
|
|
410
|
-
canExportData:
|
|
411
|
-
canManageUsers:
|
|
425
|
+
canView: i(o.canView),
|
|
426
|
+
canEdit: i(o.canEdit),
|
|
427
|
+
canDelete: i(o.canDelete),
|
|
428
|
+
canAdmin: i(o.canAdmin),
|
|
429
|
+
canViewSensitiveData: i(o.canViewSensitiveData),
|
|
430
|
+
canExportData: i(o.canExportData),
|
|
431
|
+
canManageUsers: i(o.canManageUsers)
|
|
412
432
|
};
|
|
413
433
|
}
|
|
414
|
-
function
|
|
415
|
-
const t = ae(), [r,
|
|
434
|
+
function kr() {
|
|
435
|
+
const t = ae(), [r, o] = T([]), [a, i] = T(0), [d, n] = T([]), [p, l] = T(!0), [v, c] = T(null), g = R(async () => {
|
|
416
436
|
if (!t.isAuthenticated) {
|
|
417
437
|
console.debug("[useFeatures] Not authenticated"), l(!1);
|
|
418
438
|
return;
|
|
@@ -423,13 +443,13 @@ function Sr() {
|
|
|
423
443
|
"Content-Type": "application/json"
|
|
424
444
|
}, N = t.user?.access_token;
|
|
425
445
|
N && (y.Authorization = `Bearer ${N}`);
|
|
426
|
-
const
|
|
427
|
-
if (!
|
|
428
|
-
throw new Error(`HTTP ${
|
|
429
|
-
const x = await
|
|
430
|
-
|
|
446
|
+
const S = await fetch("/api/features", { headers: y });
|
|
447
|
+
if (!S.ok)
|
|
448
|
+
throw new Error(`HTTP ${S.status}: ${S.statusText}`);
|
|
449
|
+
const x = await S.json();
|
|
450
|
+
o(x.features || []), i(x.totalCount || 0), n(x.userRoles || []);
|
|
431
451
|
} catch (y) {
|
|
432
|
-
console.debug("Features fetch error:", y), c(y instanceof Error ? y.message : String(y)),
|
|
452
|
+
console.debug("Features fetch error:", y), c(y instanceof Error ? y.message : String(y)), o([]), n([]);
|
|
433
453
|
} finally {
|
|
434
454
|
l(!1);
|
|
435
455
|
}
|
|
@@ -437,16 +457,16 @@ function Sr() {
|
|
|
437
457
|
U(() => {
|
|
438
458
|
g();
|
|
439
459
|
}, [g]);
|
|
440
|
-
const f =
|
|
441
|
-
(y) => r.find((
|
|
460
|
+
const f = R(
|
|
461
|
+
(y) => r.find((S) => S.name === y)?.userEnabled ?? !1,
|
|
442
462
|
[r]
|
|
443
|
-
), E =
|
|
463
|
+
), E = R(
|
|
444
464
|
(y) => r.filter((N) => N.mfDependencies?.includes(y)),
|
|
445
465
|
[r]
|
|
446
466
|
);
|
|
447
467
|
return {
|
|
448
468
|
features: r,
|
|
449
|
-
totalCount:
|
|
469
|
+
totalCount: a,
|
|
450
470
|
userRoles: d,
|
|
451
471
|
isLoading: p,
|
|
452
472
|
error: v,
|
|
@@ -455,48 +475,48 @@ function Sr() {
|
|
|
455
475
|
getFeaturesByMf: E
|
|
456
476
|
};
|
|
457
477
|
}
|
|
458
|
-
function
|
|
459
|
-
const t = ae(), [r,
|
|
478
|
+
function Tr() {
|
|
479
|
+
const t = ae(), [r, o] = T([]), [a, i] = T([]), [d, n] = T(!1), [p, l] = T(!0), [v, c] = T(null), g = R(async () => {
|
|
460
480
|
if (!t.isAuthenticated) {
|
|
461
481
|
console.debug("[useFeatureAdmin] Not authenticated"), l(!1);
|
|
462
482
|
return;
|
|
463
483
|
}
|
|
464
484
|
l(!0), c(null);
|
|
465
485
|
try {
|
|
466
|
-
const
|
|
486
|
+
const S = {
|
|
467
487
|
"Content-Type": "application/json"
|
|
468
488
|
}, x = t.user?.access_token;
|
|
469
|
-
x && (
|
|
470
|
-
const _ = await fetch("/api/features/admin", { headers:
|
|
489
|
+
x && (S.Authorization = `Bearer ${x}`);
|
|
490
|
+
const _ = await fetch("/api/features/admin", { headers: S });
|
|
471
491
|
if (!_.ok) {
|
|
472
492
|
if (_.status === 403) {
|
|
473
|
-
console.warn("[useFeatureAdmin] 403 Forbidden - checking if token has admin role"), n(!1),
|
|
493
|
+
console.warn("[useFeatureAdmin] 403 Forbidden - checking if token has admin role"), n(!1), o([]), i([]), l(!1);
|
|
474
494
|
return;
|
|
475
495
|
}
|
|
476
496
|
throw new Error(`HTTP ${_.status}: ${_.statusText}`);
|
|
477
497
|
}
|
|
478
|
-
const
|
|
479
|
-
|
|
480
|
-
} catch (
|
|
481
|
-
console.debug("FeatureAdmin fetch error:",
|
|
498
|
+
const C = await _.json();
|
|
499
|
+
o(C.featureToggles || []), i(C.microfrontends || []), n(C.isAdmin || !1);
|
|
500
|
+
} catch (S) {
|
|
501
|
+
console.debug("FeatureAdmin fetch error:", S), o([]), i([]), n(!1);
|
|
482
502
|
} finally {
|
|
483
503
|
l(!1);
|
|
484
504
|
}
|
|
485
|
-
}, [t.isAuthenticated, t.user?.access_token]), f =
|
|
486
|
-
async (
|
|
505
|
+
}, [t.isAuthenticated, t.user?.access_token]), f = R(
|
|
506
|
+
async (S) => {
|
|
487
507
|
try {
|
|
488
508
|
const x = {
|
|
489
509
|
"Content-Type": "application/json"
|
|
490
510
|
}, _ = t.user?.access_token;
|
|
491
511
|
_ && (x.Authorization = `Bearer ${_}`);
|
|
492
|
-
const
|
|
512
|
+
const C = await fetch("/api/features/admin", {
|
|
493
513
|
method: "POST",
|
|
494
514
|
headers: x,
|
|
495
|
-
body: JSON.stringify(
|
|
515
|
+
body: JSON.stringify(S)
|
|
496
516
|
});
|
|
497
|
-
if (!
|
|
498
|
-
const j = await
|
|
499
|
-
throw new Error(j.error || `HTTP ${
|
|
517
|
+
if (!C.ok) {
|
|
518
|
+
const j = await C.json().catch(() => ({}));
|
|
519
|
+
throw new Error(j.error || `HTTP ${C.status}`);
|
|
500
520
|
}
|
|
501
521
|
return await g(), !0;
|
|
502
522
|
} catch (x) {
|
|
@@ -504,14 +524,14 @@ function Rr() {
|
|
|
504
524
|
}
|
|
505
525
|
},
|
|
506
526
|
[g]
|
|
507
|
-
), E =
|
|
508
|
-
async (
|
|
527
|
+
), E = R(
|
|
528
|
+
async (S, x) => {
|
|
509
529
|
try {
|
|
510
530
|
const _ = {
|
|
511
531
|
"Content-Type": "application/json"
|
|
512
|
-
},
|
|
513
|
-
|
|
514
|
-
const j = await fetch(`/api/features/admin/${encodeURIComponent(
|
|
532
|
+
}, C = t.user?.access_token;
|
|
533
|
+
C && (_.Authorization = `Bearer ${C}`);
|
|
534
|
+
const j = await fetch(`/api/features/admin/${encodeURIComponent(S)}`, {
|
|
515
535
|
method: "PUT",
|
|
516
536
|
headers: _,
|
|
517
537
|
body: JSON.stringify(x)
|
|
@@ -526,13 +546,13 @@ function Rr() {
|
|
|
526
546
|
}
|
|
527
547
|
},
|
|
528
548
|
[g]
|
|
529
|
-
), y =
|
|
530
|
-
async (
|
|
549
|
+
), y = R(
|
|
550
|
+
async (S, x) => {
|
|
531
551
|
try {
|
|
532
|
-
const _ = {},
|
|
533
|
-
|
|
552
|
+
const _ = {}, C = t.user?.access_token;
|
|
553
|
+
C && (_.Authorization = `Bearer ${C}`);
|
|
534
554
|
const j = await fetch(
|
|
535
|
-
`/api/features/admin/${encodeURIComponent(
|
|
555
|
+
`/api/features/admin/${encodeURIComponent(S)}/toggle?enabled=${x}`,
|
|
536
556
|
{
|
|
537
557
|
method: "POST",
|
|
538
558
|
headers: _
|
|
@@ -548,18 +568,18 @@ function Rr() {
|
|
|
548
568
|
}
|
|
549
569
|
},
|
|
550
570
|
[g]
|
|
551
|
-
), N =
|
|
552
|
-
async (
|
|
571
|
+
), N = R(
|
|
572
|
+
async (S) => {
|
|
553
573
|
try {
|
|
554
574
|
const x = {}, _ = t.user?.access_token;
|
|
555
575
|
_ && (x.Authorization = `Bearer ${_}`);
|
|
556
|
-
const
|
|
576
|
+
const C = await fetch(`/api/features/admin/${encodeURIComponent(S)}`, {
|
|
557
577
|
method: "DELETE",
|
|
558
578
|
headers: x
|
|
559
579
|
});
|
|
560
|
-
if (!
|
|
561
|
-
const j = await
|
|
562
|
-
throw new Error(j.error || `HTTP ${
|
|
580
|
+
if (!C.ok) {
|
|
581
|
+
const j = await C.json().catch(() => ({}));
|
|
582
|
+
throw new Error(j.error || `HTTP ${C.status}`);
|
|
563
583
|
}
|
|
564
584
|
return await g(), !0;
|
|
565
585
|
} catch (x) {
|
|
@@ -572,7 +592,7 @@ function Rr() {
|
|
|
572
592
|
g();
|
|
573
593
|
}, [g]), {
|
|
574
594
|
features: r,
|
|
575
|
-
microfrontends:
|
|
595
|
+
microfrontends: a,
|
|
576
596
|
isAdmin: d,
|
|
577
597
|
isLoading: p,
|
|
578
598
|
error: v,
|
|
@@ -583,8 +603,8 @@ function Rr() {
|
|
|
583
603
|
deleteFeature: N
|
|
584
604
|
};
|
|
585
605
|
}
|
|
586
|
-
function
|
|
587
|
-
const t = ae(), [r,
|
|
606
|
+
function Sr() {
|
|
607
|
+
const t = ae(), [r, o] = T([]), [a, i] = T(0), [d, n] = T(!0), [p, l] = T(null), v = R(async () => {
|
|
588
608
|
if (!t.isAuthenticated) {
|
|
589
609
|
n(!1);
|
|
590
610
|
return;
|
|
@@ -599,7 +619,7 @@ function Tr() {
|
|
|
599
619
|
if (!f.ok)
|
|
600
620
|
throw new Error(`HTTP ${f.status}: ${f.statusText}`);
|
|
601
621
|
const E = await f.json();
|
|
602
|
-
|
|
622
|
+
o(E.microfrontends || []), i(E.totalCount || 0);
|
|
603
623
|
} catch (c) {
|
|
604
624
|
l(c instanceof Error ? c.message : String(c));
|
|
605
625
|
} finally {
|
|
@@ -610,73 +630,73 @@ function Tr() {
|
|
|
610
630
|
v();
|
|
611
631
|
}, [v]), {
|
|
612
632
|
microfrontends: r,
|
|
613
|
-
totalCount:
|
|
633
|
+
totalCount: a,
|
|
614
634
|
isLoading: d,
|
|
615
635
|
error: p,
|
|
616
636
|
refetch: v
|
|
617
637
|
};
|
|
618
638
|
}
|
|
619
|
-
var
|
|
639
|
+
var se = { exports: {} }, K = {};
|
|
620
640
|
var Xe;
|
|
621
641
|
function rr() {
|
|
622
642
|
if (Xe) return K;
|
|
623
643
|
Xe = 1;
|
|
624
|
-
var t = et, r = /* @__PURE__ */ Symbol.for("react.element"),
|
|
644
|
+
var t = et, r = /* @__PURE__ */ Symbol.for("react.element"), o = /* @__PURE__ */ Symbol.for("react.fragment"), a = Object.prototype.hasOwnProperty, i = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, d = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
625
645
|
function n(p, l, v) {
|
|
626
646
|
var c, g = {}, f = null, E = null;
|
|
627
647
|
v !== void 0 && (f = "" + v), l.key !== void 0 && (f = "" + l.key), l.ref !== void 0 && (E = l.ref);
|
|
628
|
-
for (c in l)
|
|
648
|
+
for (c in l) a.call(l, c) && !d.hasOwnProperty(c) && (g[c] = l[c]);
|
|
629
649
|
if (p && p.defaultProps) for (c in l = p.defaultProps, l) g[c] === void 0 && (g[c] = l[c]);
|
|
630
|
-
return { $$typeof: r, type: p, key: f, ref: E, props: g, _owner:
|
|
650
|
+
return { $$typeof: r, type: p, key: f, ref: E, props: g, _owner: i.current };
|
|
631
651
|
}
|
|
632
|
-
return K.Fragment =
|
|
652
|
+
return K.Fragment = o, K.jsx = n, K.jsxs = n, K;
|
|
633
653
|
}
|
|
634
654
|
var X = {};
|
|
635
655
|
var Ze;
|
|
636
656
|
function nr() {
|
|
637
657
|
return Ze || (Ze = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
638
|
-
var t = et, r = /* @__PURE__ */ Symbol.for("react.element"),
|
|
639
|
-
function
|
|
658
|
+
var t = et, r = /* @__PURE__ */ Symbol.for("react.element"), o = /* @__PURE__ */ Symbol.for("react.portal"), a = /* @__PURE__ */ Symbol.for("react.fragment"), i = /* @__PURE__ */ Symbol.for("react.strict_mode"), d = /* @__PURE__ */ Symbol.for("react.profiler"), n = /* @__PURE__ */ Symbol.for("react.provider"), p = /* @__PURE__ */ Symbol.for("react.context"), l = /* @__PURE__ */ Symbol.for("react.forward_ref"), v = /* @__PURE__ */ Symbol.for("react.suspense"), c = /* @__PURE__ */ Symbol.for("react.suspense_list"), g = /* @__PURE__ */ Symbol.for("react.memo"), f = /* @__PURE__ */ Symbol.for("react.lazy"), E = /* @__PURE__ */ Symbol.for("react.offscreen"), y = Symbol.iterator, N = "@@iterator";
|
|
659
|
+
function S(e) {
|
|
640
660
|
if (e === null || typeof e != "object")
|
|
641
661
|
return null;
|
|
642
|
-
var
|
|
643
|
-
return typeof
|
|
662
|
+
var s = y && e[y] || e[N];
|
|
663
|
+
return typeof s == "function" ? s : null;
|
|
644
664
|
}
|
|
645
665
|
var x = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
646
666
|
function _(e) {
|
|
647
667
|
{
|
|
648
|
-
for (var
|
|
668
|
+
for (var s = arguments.length, u = new Array(s > 1 ? s - 1 : 0), h = 1; h < s; h++)
|
|
649
669
|
u[h - 1] = arguments[h];
|
|
650
|
-
|
|
670
|
+
C("error", e, u);
|
|
651
671
|
}
|
|
652
672
|
}
|
|
653
|
-
function
|
|
673
|
+
function C(e, s, u) {
|
|
654
674
|
{
|
|
655
675
|
var h = x.ReactDebugCurrentFrame, A = h.getStackAddendum();
|
|
656
|
-
A !== "" && (
|
|
657
|
-
var
|
|
676
|
+
A !== "" && (s += "%s", u = u.concat([A]));
|
|
677
|
+
var k = u.map(function(b) {
|
|
658
678
|
return String(b);
|
|
659
679
|
});
|
|
660
|
-
|
|
680
|
+
k.unshift("Warning: " + s), Function.prototype.apply.call(console[e], console, k);
|
|
661
681
|
}
|
|
662
682
|
}
|
|
663
683
|
var j = !1, P = !1, L = !1, ut = !1, ct = !1, Ae;
|
|
664
684
|
Ae = /* @__PURE__ */ Symbol.for("react.module.reference");
|
|
665
685
|
function lt(e) {
|
|
666
|
-
return !!(typeof e == "string" || typeof e == "function" || e ===
|
|
686
|
+
return !!(typeof e == "string" || typeof e == "function" || e === a || e === d || ct || e === i || e === v || e === c || ut || e === E || j || P || L || typeof e == "object" && e !== null && (e.$$typeof === f || e.$$typeof === g || e.$$typeof === n || e.$$typeof === p || e.$$typeof === l || // This needs to include all possible module reference object
|
|
667
687
|
// types supported by any Flight configuration anywhere since
|
|
668
688
|
// we don't know which Flight build this will end up being used
|
|
669
689
|
// with.
|
|
670
690
|
e.$$typeof === Ae || e.getModuleId !== void 0));
|
|
671
691
|
}
|
|
672
|
-
function ft(e,
|
|
692
|
+
function ft(e, s, u) {
|
|
673
693
|
var h = e.displayName;
|
|
674
694
|
if (h)
|
|
675
695
|
return h;
|
|
676
|
-
var A =
|
|
696
|
+
var A = s.displayName || s.name || "";
|
|
677
697
|
return A !== "" ? u + "(" + A + ")" : u;
|
|
678
698
|
}
|
|
679
|
-
function
|
|
699
|
+
function ke(e) {
|
|
680
700
|
return e.displayName || "Context";
|
|
681
701
|
}
|
|
682
702
|
function V(e) {
|
|
@@ -687,13 +707,13 @@ function nr() {
|
|
|
687
707
|
if (typeof e == "string")
|
|
688
708
|
return e;
|
|
689
709
|
switch (e) {
|
|
690
|
-
case
|
|
710
|
+
case a:
|
|
691
711
|
return "Fragment";
|
|
692
|
-
case
|
|
712
|
+
case o:
|
|
693
713
|
return "Portal";
|
|
694
714
|
case d:
|
|
695
715
|
return "Profiler";
|
|
696
|
-
case
|
|
716
|
+
case i:
|
|
697
717
|
return "StrictMode";
|
|
698
718
|
case v:
|
|
699
719
|
return "Suspense";
|
|
@@ -703,20 +723,20 @@ function nr() {
|
|
|
703
723
|
if (typeof e == "object")
|
|
704
724
|
switch (e.$$typeof) {
|
|
705
725
|
case p:
|
|
706
|
-
var
|
|
707
|
-
return
|
|
726
|
+
var s = e;
|
|
727
|
+
return ke(s) + ".Consumer";
|
|
708
728
|
case n:
|
|
709
729
|
var u = e;
|
|
710
|
-
return
|
|
730
|
+
return ke(u._context) + ".Provider";
|
|
711
731
|
case l:
|
|
712
732
|
return ft(e, e.render, "ForwardRef");
|
|
713
733
|
case g:
|
|
714
734
|
var h = e.displayName || null;
|
|
715
735
|
return h !== null ? h : V(e.type) || "Memo";
|
|
716
736
|
case f: {
|
|
717
|
-
var A = e,
|
|
737
|
+
var A = e, k = A._payload, b = A._init;
|
|
718
738
|
try {
|
|
719
|
-
return V(b(
|
|
739
|
+
return V(b(k));
|
|
720
740
|
} catch {
|
|
721
741
|
return null;
|
|
722
742
|
}
|
|
@@ -724,14 +744,14 @@ function nr() {
|
|
|
724
744
|
}
|
|
725
745
|
return null;
|
|
726
746
|
}
|
|
727
|
-
var z = Object.assign, q = 0,
|
|
747
|
+
var z = Object.assign, q = 0, Te, Se, Re, Ce, Me, Ie, Ne;
|
|
728
748
|
function je() {
|
|
729
749
|
}
|
|
730
750
|
je.__reactDisabledLog = !0;
|
|
731
751
|
function dt() {
|
|
732
752
|
{
|
|
733
753
|
if (q === 0) {
|
|
734
|
-
|
|
754
|
+
Te = console.log, Se = console.info, Re = console.warn, Ce = console.error, Me = console.group, Ie = console.groupCollapsed, Ne = console.groupEnd;
|
|
735
755
|
var e = {
|
|
736
756
|
configurable: !0,
|
|
737
757
|
enumerable: !0,
|
|
@@ -761,16 +781,16 @@ function nr() {
|
|
|
761
781
|
};
|
|
762
782
|
Object.defineProperties(console, {
|
|
763
783
|
log: z({}, e, {
|
|
764
|
-
value:
|
|
784
|
+
value: Te
|
|
765
785
|
}),
|
|
766
786
|
info: z({}, e, {
|
|
767
|
-
value:
|
|
787
|
+
value: Se
|
|
768
788
|
}),
|
|
769
789
|
warn: z({}, e, {
|
|
770
|
-
value:
|
|
790
|
+
value: Re
|
|
771
791
|
}),
|
|
772
792
|
error: z({}, e, {
|
|
773
|
-
value:
|
|
793
|
+
value: Ce
|
|
774
794
|
}),
|
|
775
795
|
group: z({}, e, {
|
|
776
796
|
value: Me
|
|
@@ -787,7 +807,7 @@ function nr() {
|
|
|
787
807
|
}
|
|
788
808
|
}
|
|
789
809
|
var ce = x.ReactCurrentDispatcher, le;
|
|
790
|
-
function Z(e,
|
|
810
|
+
function Z(e, s, u) {
|
|
791
811
|
{
|
|
792
812
|
if (le === void 0)
|
|
793
813
|
try {
|
|
@@ -805,7 +825,7 @@ function nr() {
|
|
|
805
825
|
var ht = typeof WeakMap == "function" ? WeakMap : Map;
|
|
806
826
|
Q = new ht();
|
|
807
827
|
}
|
|
808
|
-
function Pe(e,
|
|
828
|
+
function Pe(e, s) {
|
|
809
829
|
if (!e || fe)
|
|
810
830
|
return "";
|
|
811
831
|
{
|
|
@@ -817,10 +837,10 @@ function nr() {
|
|
|
817
837
|
fe = !0;
|
|
818
838
|
var A = Error.prepareStackTrace;
|
|
819
839
|
Error.prepareStackTrace = void 0;
|
|
820
|
-
var
|
|
821
|
-
|
|
840
|
+
var k;
|
|
841
|
+
k = ce.current, ce.current = null, dt();
|
|
822
842
|
try {
|
|
823
|
-
if (
|
|
843
|
+
if (s) {
|
|
824
844
|
var b = function() {
|
|
825
845
|
throw Error();
|
|
826
846
|
};
|
|
@@ -871,19 +891,19 @@ function nr() {
|
|
|
871
891
|
}
|
|
872
892
|
}
|
|
873
893
|
} finally {
|
|
874
|
-
fe = !1, ce.current =
|
|
894
|
+
fe = !1, ce.current = k, pt(), Error.prepareStackTrace = A;
|
|
875
895
|
}
|
|
876
896
|
var Y = e ? e.displayName || e.name : "", H = Y ? Z(Y) : "";
|
|
877
897
|
return typeof e == "function" && Q.set(e, H), H;
|
|
878
898
|
}
|
|
879
|
-
function gt(e,
|
|
899
|
+
function gt(e, s, u) {
|
|
880
900
|
return Pe(e, !1);
|
|
881
901
|
}
|
|
882
902
|
function mt(e) {
|
|
883
|
-
var
|
|
884
|
-
return !!(
|
|
903
|
+
var s = e.prototype;
|
|
904
|
+
return !!(s && s.isReactComponent);
|
|
885
905
|
}
|
|
886
|
-
function ee(e,
|
|
906
|
+
function ee(e, s, u) {
|
|
887
907
|
if (e == null)
|
|
888
908
|
return "";
|
|
889
909
|
if (typeof e == "function")
|
|
@@ -901,11 +921,11 @@ function nr() {
|
|
|
901
921
|
case l:
|
|
902
922
|
return gt(e.render);
|
|
903
923
|
case g:
|
|
904
|
-
return ee(e.type,
|
|
924
|
+
return ee(e.type, s, u);
|
|
905
925
|
case f: {
|
|
906
|
-
var h = e, A = h._payload,
|
|
926
|
+
var h = e, A = h._payload, k = h._init;
|
|
907
927
|
try {
|
|
908
|
-
return ee(
|
|
928
|
+
return ee(k(A), s, u);
|
|
909
929
|
} catch {
|
|
910
930
|
}
|
|
911
931
|
}
|
|
@@ -915,23 +935,23 @@ function nr() {
|
|
|
915
935
|
var J = Object.prototype.hasOwnProperty, Oe = {}, Fe = x.ReactDebugCurrentFrame;
|
|
916
936
|
function te(e) {
|
|
917
937
|
if (e) {
|
|
918
|
-
var
|
|
938
|
+
var s = e._owner, u = ee(e.type, e._source, s ? s.type : null);
|
|
919
939
|
Fe.setExtraStackFrame(u);
|
|
920
940
|
} else
|
|
921
941
|
Fe.setExtraStackFrame(null);
|
|
922
942
|
}
|
|
923
|
-
function _t(e,
|
|
943
|
+
function _t(e, s, u, h, A) {
|
|
924
944
|
{
|
|
925
|
-
var
|
|
945
|
+
var k = Function.call.bind(J);
|
|
926
946
|
for (var b in e)
|
|
927
|
-
if (
|
|
947
|
+
if (k(e, b)) {
|
|
928
948
|
var w = void 0;
|
|
929
949
|
try {
|
|
930
950
|
if (typeof e[b] != "function") {
|
|
931
951
|
var O = Error((h || "React class") + ": " + u + " type `" + b + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[b] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
932
952
|
throw O.name = "Invariant Violation", O;
|
|
933
953
|
}
|
|
934
|
-
w = e[b](
|
|
954
|
+
w = e[b](s, b, h, u, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
935
955
|
} catch (M) {
|
|
936
956
|
w = M;
|
|
937
957
|
}
|
|
@@ -945,7 +965,7 @@ function nr() {
|
|
|
945
965
|
}
|
|
946
966
|
function yt(e) {
|
|
947
967
|
{
|
|
948
|
-
var
|
|
968
|
+
var s = typeof Symbol == "function" && Symbol.toStringTag, u = s && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
949
969
|
return u;
|
|
950
970
|
}
|
|
951
971
|
}
|
|
@@ -971,27 +991,27 @@ function nr() {
|
|
|
971
991
|
}, Ue, Ve;
|
|
972
992
|
function bt(e) {
|
|
973
993
|
if (J.call(e, "ref")) {
|
|
974
|
-
var
|
|
975
|
-
if (
|
|
994
|
+
var s = Object.getOwnPropertyDescriptor(e, "ref").get;
|
|
995
|
+
if (s && s.isReactWarning)
|
|
976
996
|
return !1;
|
|
977
997
|
}
|
|
978
998
|
return e.ref !== void 0;
|
|
979
999
|
}
|
|
980
1000
|
function xt(e) {
|
|
981
1001
|
if (J.call(e, "key")) {
|
|
982
|
-
var
|
|
983
|
-
if (
|
|
1002
|
+
var s = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
1003
|
+
if (s && s.isReactWarning)
|
|
984
1004
|
return !1;
|
|
985
1005
|
}
|
|
986
1006
|
return e.key !== void 0;
|
|
987
1007
|
}
|
|
988
|
-
function At(e,
|
|
1008
|
+
function At(e, s) {
|
|
989
1009
|
typeof e.ref == "string" && Le.current;
|
|
990
1010
|
}
|
|
991
|
-
function
|
|
1011
|
+
function kt(e, s) {
|
|
992
1012
|
{
|
|
993
1013
|
var u = function() {
|
|
994
|
-
Ue || (Ue = !0, _("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",
|
|
1014
|
+
Ue || (Ue = !0, _("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", s));
|
|
995
1015
|
};
|
|
996
1016
|
u.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
997
1017
|
get: u,
|
|
@@ -999,10 +1019,10 @@ function nr() {
|
|
|
999
1019
|
});
|
|
1000
1020
|
}
|
|
1001
1021
|
}
|
|
1002
|
-
function
|
|
1022
|
+
function Tt(e, s) {
|
|
1003
1023
|
{
|
|
1004
1024
|
var u = function() {
|
|
1005
|
-
Ve || (Ve = !0, _("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",
|
|
1025
|
+
Ve || (Ve = !0, _("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", s));
|
|
1006
1026
|
};
|
|
1007
1027
|
u.isReactWarning = !0, Object.defineProperty(e, "ref", {
|
|
1008
1028
|
get: u,
|
|
@@ -1010,17 +1030,17 @@ function nr() {
|
|
|
1010
1030
|
});
|
|
1011
1031
|
}
|
|
1012
1032
|
}
|
|
1013
|
-
var
|
|
1033
|
+
var St = function(e, s, u, h, A, k, b) {
|
|
1014
1034
|
var w = {
|
|
1015
1035
|
// This tag allows us to uniquely identify this as a React Element
|
|
1016
1036
|
$$typeof: r,
|
|
1017
1037
|
// Built-in properties that belong on the element
|
|
1018
1038
|
type: e,
|
|
1019
|
-
key:
|
|
1039
|
+
key: s,
|
|
1020
1040
|
ref: u,
|
|
1021
1041
|
props: b,
|
|
1022
1042
|
// Record the component responsible for creating this element.
|
|
1023
|
-
_owner:
|
|
1043
|
+
_owner: k
|
|
1024
1044
|
};
|
|
1025
1045
|
return w._store = {}, Object.defineProperty(w._store, "validated", {
|
|
1026
1046
|
configurable: !1,
|
|
@@ -1039,28 +1059,28 @@ function nr() {
|
|
|
1039
1059
|
value: A
|
|
1040
1060
|
}), Object.freeze && (Object.freeze(w.props), Object.freeze(w)), w;
|
|
1041
1061
|
};
|
|
1042
|
-
function
|
|
1062
|
+
function Rt(e, s, u, h, A) {
|
|
1043
1063
|
{
|
|
1044
|
-
var
|
|
1045
|
-
u !== void 0 && ($e(u), w = "" + u), xt(
|
|
1046
|
-
for (
|
|
1047
|
-
J.call(
|
|
1064
|
+
var k, b = {}, w = null, O = null;
|
|
1065
|
+
u !== void 0 && ($e(u), w = "" + u), xt(s) && ($e(s.key), w = "" + s.key), bt(s) && (O = s.ref, At(s, A));
|
|
1066
|
+
for (k in s)
|
|
1067
|
+
J.call(s, k) && !wt.hasOwnProperty(k) && (b[k] = s[k]);
|
|
1048
1068
|
if (e && e.defaultProps) {
|
|
1049
1069
|
var M = e.defaultProps;
|
|
1050
|
-
for (
|
|
1051
|
-
b[
|
|
1070
|
+
for (k in M)
|
|
1071
|
+
b[k] === void 0 && (b[k] = M[k]);
|
|
1052
1072
|
}
|
|
1053
1073
|
if (w || O) {
|
|
1054
1074
|
var I = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
1055
|
-
w &&
|
|
1075
|
+
w && kt(b, I), O && Tt(b, I);
|
|
1056
1076
|
}
|
|
1057
|
-
return
|
|
1077
|
+
return St(e, w, O, A, h, Le.current, b);
|
|
1058
1078
|
}
|
|
1059
1079
|
}
|
|
1060
1080
|
var pe = x.ReactCurrentOwner, Be = x.ReactDebugCurrentFrame;
|
|
1061
1081
|
function G(e) {
|
|
1062
1082
|
if (e) {
|
|
1063
|
-
var
|
|
1083
|
+
var s = e._owner, u = ee(e.type, e._source, s ? s.type : null);
|
|
1064
1084
|
Be.setExtraStackFrame(u);
|
|
1065
1085
|
} else
|
|
1066
1086
|
Be.setExtraStackFrame(null);
|
|
@@ -1082,28 +1102,28 @@ Check the render method of \`` + e + "`.";
|
|
|
1082
1102
|
return "";
|
|
1083
1103
|
}
|
|
1084
1104
|
}
|
|
1085
|
-
function
|
|
1105
|
+
function Ct(e) {
|
|
1086
1106
|
return "";
|
|
1087
1107
|
}
|
|
1088
1108
|
var ze = {};
|
|
1089
1109
|
function Mt(e) {
|
|
1090
1110
|
{
|
|
1091
|
-
var
|
|
1092
|
-
if (!
|
|
1111
|
+
var s = We();
|
|
1112
|
+
if (!s) {
|
|
1093
1113
|
var u = typeof e == "string" ? e : e.displayName || e.name;
|
|
1094
|
-
u && (
|
|
1114
|
+
u && (s = `
|
|
1095
1115
|
|
|
1096
1116
|
Check the top-level render call using <` + u + ">.");
|
|
1097
1117
|
}
|
|
1098
|
-
return
|
|
1118
|
+
return s;
|
|
1099
1119
|
}
|
|
1100
1120
|
}
|
|
1101
|
-
function He(e,
|
|
1121
|
+
function He(e, s) {
|
|
1102
1122
|
{
|
|
1103
1123
|
if (!e._store || e._store.validated || e.key != null)
|
|
1104
1124
|
return;
|
|
1105
1125
|
e._store.validated = !0;
|
|
1106
|
-
var u = Mt(
|
|
1126
|
+
var u = Mt(s);
|
|
1107
1127
|
if (ze[u])
|
|
1108
1128
|
return;
|
|
1109
1129
|
ze[u] = !0;
|
|
@@ -1111,54 +1131,54 @@ Check the top-level render call using <` + u + ">.");
|
|
|
1111
1131
|
e && e._owner && e._owner !== pe.current && (h = " It was passed a child from " + V(e._owner.type) + "."), G(e), _('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', u, h), G(null);
|
|
1112
1132
|
}
|
|
1113
1133
|
}
|
|
1114
|
-
function Ge(e,
|
|
1134
|
+
function Ge(e, s) {
|
|
1115
1135
|
{
|
|
1116
1136
|
if (typeof e != "object")
|
|
1117
1137
|
return;
|
|
1118
1138
|
if (de(e))
|
|
1119
1139
|
for (var u = 0; u < e.length; u++) {
|
|
1120
1140
|
var h = e[u];
|
|
1121
|
-
ge(h) && He(h,
|
|
1141
|
+
ge(h) && He(h, s);
|
|
1122
1142
|
}
|
|
1123
1143
|
else if (ge(e))
|
|
1124
1144
|
e._store && (e._store.validated = !0);
|
|
1125
1145
|
else if (e) {
|
|
1126
|
-
var A =
|
|
1146
|
+
var A = S(e);
|
|
1127
1147
|
if (typeof A == "function" && A !== e.entries)
|
|
1128
|
-
for (var
|
|
1129
|
-
ge(b.value) && He(b.value,
|
|
1148
|
+
for (var k = A.call(e), b; !(b = k.next()).done; )
|
|
1149
|
+
ge(b.value) && He(b.value, s);
|
|
1130
1150
|
}
|
|
1131
1151
|
}
|
|
1132
1152
|
}
|
|
1133
1153
|
function It(e) {
|
|
1134
1154
|
{
|
|
1135
|
-
var
|
|
1136
|
-
if (
|
|
1155
|
+
var s = e.type;
|
|
1156
|
+
if (s == null || typeof s == "string")
|
|
1137
1157
|
return;
|
|
1138
1158
|
var u;
|
|
1139
|
-
if (typeof
|
|
1140
|
-
u =
|
|
1141
|
-
else if (typeof
|
|
1159
|
+
if (typeof s == "function")
|
|
1160
|
+
u = s.propTypes;
|
|
1161
|
+
else if (typeof s == "object" && (s.$$typeof === l || // Note: Memo only checks outer props here.
|
|
1142
1162
|
// Inner props are checked in the reconciler.
|
|
1143
|
-
|
|
1144
|
-
u =
|
|
1163
|
+
s.$$typeof === g))
|
|
1164
|
+
u = s.propTypes;
|
|
1145
1165
|
else
|
|
1146
1166
|
return;
|
|
1147
1167
|
if (u) {
|
|
1148
|
-
var h = V(
|
|
1168
|
+
var h = V(s);
|
|
1149
1169
|
_t(u, e.props, "prop", h, e);
|
|
1150
|
-
} else if (
|
|
1170
|
+
} else if (s.PropTypes !== void 0 && !he) {
|
|
1151
1171
|
he = !0;
|
|
1152
|
-
var A = V(
|
|
1172
|
+
var A = V(s);
|
|
1153
1173
|
_("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", A || "Unknown");
|
|
1154
1174
|
}
|
|
1155
|
-
typeof
|
|
1175
|
+
typeof s.getDefaultProps == "function" && !s.getDefaultProps.isReactClassApproved && _("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
1156
1176
|
}
|
|
1157
1177
|
}
|
|
1158
1178
|
function Nt(e) {
|
|
1159
1179
|
{
|
|
1160
|
-
for (var
|
|
1161
|
-
var h =
|
|
1180
|
+
for (var s = Object.keys(e.props), u = 0; u < s.length; u++) {
|
|
1181
|
+
var h = s[u];
|
|
1162
1182
|
if (h !== "children" && h !== "key") {
|
|
1163
1183
|
G(e), _("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", h), G(null);
|
|
1164
1184
|
break;
|
|
@@ -1168,22 +1188,22 @@ Check the top-level render call using <` + u + ">.");
|
|
|
1168
1188
|
}
|
|
1169
1189
|
}
|
|
1170
1190
|
var Ye = {};
|
|
1171
|
-
function qe(e,
|
|
1191
|
+
function qe(e, s, u, h, A, k) {
|
|
1172
1192
|
{
|
|
1173
1193
|
var b = lt(e);
|
|
1174
1194
|
if (!b) {
|
|
1175
1195
|
var w = "";
|
|
1176
1196
|
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (w += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
1177
|
-
var O =
|
|
1197
|
+
var O = Ct();
|
|
1178
1198
|
O ? w += O : w += We();
|
|
1179
1199
|
var M;
|
|
1180
1200
|
e === null ? M = "null" : de(e) ? M = "array" : e !== void 0 && e.$$typeof === r ? (M = "<" + (V(e.type) || "Unknown") + " />", w = " Did you accidentally export a JSX literal instead of a component?") : M = typeof e, _("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", M, w);
|
|
1181
1201
|
}
|
|
1182
|
-
var I =
|
|
1202
|
+
var I = Rt(e, s, u, A, k);
|
|
1183
1203
|
if (I == null)
|
|
1184
1204
|
return I;
|
|
1185
1205
|
if (b) {
|
|
1186
|
-
var D =
|
|
1206
|
+
var D = s.children;
|
|
1187
1207
|
if (D !== void 0)
|
|
1188
1208
|
if (h)
|
|
1189
1209
|
if (de(D)) {
|
|
@@ -1195,8 +1215,8 @@ Check the top-level render call using <` + u + ">.");
|
|
|
1195
1215
|
else
|
|
1196
1216
|
Ge(D, e);
|
|
1197
1217
|
}
|
|
1198
|
-
if (J.call(
|
|
1199
|
-
var H = V(e), F = Object.keys(
|
|
1218
|
+
if (J.call(s, "key")) {
|
|
1219
|
+
var H = V(e), F = Object.keys(s).filter(function($t) {
|
|
1200
1220
|
return $t !== "key";
|
|
1201
1221
|
}), me = F.length > 0 ? "{key: someKey, " + F.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
1202
1222
|
if (!Ye[H + me]) {
|
|
@@ -1209,34 +1229,34 @@ React keys must be passed directly to JSX without using spread:
|
|
|
1209
1229
|
<%s key={someKey} {...props} />`, me, H, Dt, H), Ye[H + me] = !0;
|
|
1210
1230
|
}
|
|
1211
1231
|
}
|
|
1212
|
-
return e ===
|
|
1232
|
+
return e === a ? Nt(I) : It(I), I;
|
|
1213
1233
|
}
|
|
1214
1234
|
}
|
|
1215
|
-
function jt(e,
|
|
1216
|
-
return qe(e,
|
|
1235
|
+
function jt(e, s, u) {
|
|
1236
|
+
return qe(e, s, u, !0);
|
|
1217
1237
|
}
|
|
1218
|
-
function Pt(e,
|
|
1219
|
-
return qe(e,
|
|
1238
|
+
function Pt(e, s, u) {
|
|
1239
|
+
return qe(e, s, u, !1);
|
|
1220
1240
|
}
|
|
1221
1241
|
var Ot = Pt, Ft = jt;
|
|
1222
|
-
X.Fragment =
|
|
1242
|
+
X.Fragment = a, X.jsx = Ot, X.jsxs = Ft;
|
|
1223
1243
|
})()), X;
|
|
1224
1244
|
}
|
|
1225
1245
|
var Qe;
|
|
1226
|
-
function
|
|
1227
|
-
return Qe || (Qe = 1, process.env.NODE_ENV === "production" ?
|
|
1246
|
+
function sr() {
|
|
1247
|
+
return Qe || (Qe = 1, process.env.NODE_ENV === "production" ? se.exports = rr() : se.exports = nr()), se.exports;
|
|
1228
1248
|
}
|
|
1229
|
-
var m =
|
|
1230
|
-
const
|
|
1249
|
+
var m = sr();
|
|
1250
|
+
const st = "platform-kit", or = !1, ve = {
|
|
1231
1251
|
log: (...t) => {
|
|
1232
1252
|
},
|
|
1233
1253
|
warn: (...t) => {
|
|
1234
1254
|
},
|
|
1235
1255
|
error: (...t) => {
|
|
1236
|
-
console.error(`[${
|
|
1256
|
+
console.error(`[${st}]`, ...t);
|
|
1237
1257
|
}
|
|
1238
1258
|
};
|
|
1239
|
-
class
|
|
1259
|
+
class Rr extends Lt {
|
|
1240
1260
|
hasDispatched = !1;
|
|
1241
1261
|
constructor(r) {
|
|
1242
1262
|
super(r), this.state = { hasError: !1 };
|
|
@@ -1250,7 +1270,7 @@ class Cr extends Lt {
|
|
|
1250
1270
|
const r = window;
|
|
1251
1271
|
if (r.__MF_NAME__) return r.__MF_NAME__;
|
|
1252
1272
|
}
|
|
1253
|
-
return
|
|
1273
|
+
return st;
|
|
1254
1274
|
}
|
|
1255
1275
|
/**
|
|
1256
1276
|
* Определить нужно ли показывать детали ошибки
|
|
@@ -1262,35 +1282,35 @@ class Cr extends Lt {
|
|
|
1262
1282
|
try {
|
|
1263
1283
|
const r = sessionStorage.getItem("config");
|
|
1264
1284
|
if (r) {
|
|
1265
|
-
const
|
|
1266
|
-
if (
|
|
1267
|
-
return
|
|
1285
|
+
const o = JSON.parse(r);
|
|
1286
|
+
if (o.showErrorDetails !== void 0)
|
|
1287
|
+
return o.showErrorDetails;
|
|
1268
1288
|
}
|
|
1269
1289
|
} catch {
|
|
1270
1290
|
}
|
|
1271
|
-
return
|
|
1291
|
+
return or;
|
|
1272
1292
|
}
|
|
1273
1293
|
/**
|
|
1274
1294
|
* Dispatch ошибки в shell
|
|
1275
1295
|
*/
|
|
1276
|
-
dispatchError(r,
|
|
1296
|
+
dispatchError(r, o) {
|
|
1277
1297
|
if (this.hasDispatched || typeof window > "u") return;
|
|
1278
1298
|
this.hasDispatched = !0;
|
|
1279
|
-
const
|
|
1299
|
+
const a = this.getMfeName();
|
|
1280
1300
|
ve.error("ErrorBoundary caught:", r);
|
|
1281
1301
|
try {
|
|
1282
1302
|
window.dispatchEvent(new CustomEvent("mfe-error", {
|
|
1283
1303
|
detail: {
|
|
1284
|
-
mfeName:
|
|
1304
|
+
mfeName: a,
|
|
1285
1305
|
error: r.message || String(r),
|
|
1286
1306
|
stack: r.stack,
|
|
1287
|
-
componentStack:
|
|
1307
|
+
componentStack: o?.componentStack,
|
|
1288
1308
|
timestamp: Date.now()
|
|
1289
1309
|
},
|
|
1290
1310
|
bubbles: !0
|
|
1291
1311
|
}));
|
|
1292
|
-
} catch (
|
|
1293
|
-
ve.error("Failed to dispatch mfe-error event:",
|
|
1312
|
+
} catch (i) {
|
|
1313
|
+
ve.error("Failed to dispatch mfe-error event:", i);
|
|
1294
1314
|
}
|
|
1295
1315
|
}
|
|
1296
1316
|
/**
|
|
@@ -1302,8 +1322,8 @@ class Cr extends Lt {
|
|
|
1302
1322
|
/**
|
|
1303
1323
|
* Обработать ошибку
|
|
1304
1324
|
*/
|
|
1305
|
-
componentDidCatch(r,
|
|
1306
|
-
this.dispatchError(r,
|
|
1325
|
+
componentDidCatch(r, o) {
|
|
1326
|
+
this.dispatchError(r, o), ve.error("Error info:", o.componentStack);
|
|
1307
1327
|
}
|
|
1308
1328
|
/**
|
|
1309
1329
|
* Копировать ошибку в буфер обмена
|
|
@@ -1335,7 +1355,7 @@ ${this.state.error?.stack}`;
|
|
|
1335
1355
|
*/
|
|
1336
1356
|
render() {
|
|
1337
1357
|
if (this.state.hasError) {
|
|
1338
|
-
const r = this.state.error?.message || "Unknown error",
|
|
1358
|
+
const r = this.state.error?.message || "Unknown error", o = this.state.error?.stack || "", a = this.shouldShowDetails(), i = this.getMfeName();
|
|
1339
1359
|
return /* @__PURE__ */ m.jsxs("div", { style: {
|
|
1340
1360
|
padding: "20px",
|
|
1341
1361
|
textAlign: "center",
|
|
@@ -1348,10 +1368,10 @@ ${this.state.error?.stack}`;
|
|
|
1348
1368
|
}, children: [
|
|
1349
1369
|
/* @__PURE__ */ m.jsxs("h2", { style: { fontSize: "16px", margin: "0 0 8px 0" }, children: [
|
|
1350
1370
|
"⚠️ Ошибка в ",
|
|
1351
|
-
|
|
1371
|
+
i
|
|
1352
1372
|
] }),
|
|
1353
1373
|
/* @__PURE__ */ m.jsx("p", { style: { fontSize: "12px", margin: 0 }, children: "Произошла ошибка в микрофронтенде. Сообщение отправлено в shell." }),
|
|
1354
|
-
|
|
1374
|
+
a && /* @__PURE__ */ m.jsxs("details", { style: {
|
|
1355
1375
|
whiteSpace: "pre-wrap",
|
|
1356
1376
|
textAlign: "left",
|
|
1357
1377
|
marginTop: "10px",
|
|
@@ -1370,9 +1390,9 @@ ${this.state.error?.stack}`;
|
|
|
1370
1390
|
borderRadius: "4px"
|
|
1371
1391
|
}, children: [
|
|
1372
1392
|
r,
|
|
1373
|
-
|
|
1393
|
+
o && `
|
|
1374
1394
|
|
|
1375
|
-
${
|
|
1395
|
+
${o}`
|
|
1376
1396
|
] })
|
|
1377
1397
|
] }),
|
|
1378
1398
|
/* @__PURE__ */ m.jsxs("div", { style: { marginTop: "12px", display: "flex", gap: "8px", justifyContent: "center" }, children: [
|
|
@@ -1438,15 +1458,15 @@ const $ = {
|
|
|
1438
1458
|
tags: "🏷️",
|
|
1439
1459
|
spreadsheet: "📊"
|
|
1440
1460
|
};
|
|
1441
|
-
function
|
|
1442
|
-
const { data: r, isLoading:
|
|
1443
|
-
if (
|
|
1461
|
+
function Cr({ mfeName: t }) {
|
|
1462
|
+
const { data: r, isLoading: o, error: a } = Yt({ mfeName: t }), [i, d] = T(!1);
|
|
1463
|
+
if (o)
|
|
1444
1464
|
return /* @__PURE__ */ m.jsxs("span", { className: "text-muted small me-2", children: [
|
|
1445
1465
|
/* @__PURE__ */ m.jsx("span", { className: "me-1", children: "⏳" }),
|
|
1446
1466
|
"Загрузка..."
|
|
1447
1467
|
] });
|
|
1448
|
-
if (
|
|
1449
|
-
return /* @__PURE__ */ m.jsxs("span", { className: "text-muted small me-2", title: `Ошибка: ${
|
|
1468
|
+
if (a || !r)
|
|
1469
|
+
return /* @__PURE__ */ m.jsxs("span", { className: "text-muted small me-2", title: `Ошибка: ${a || "нет данных"}`, children: [
|
|
1450
1470
|
/* @__PURE__ */ m.jsx("span", { className: "me-1", children: "ℹ️" }),
|
|
1451
1471
|
"N/A"
|
|
1452
1472
|
] });
|
|
@@ -1455,7 +1475,7 @@ function kr({ mfeName: t }) {
|
|
|
1455
1475
|
/* @__PURE__ */ m.jsxs(
|
|
1456
1476
|
"button",
|
|
1457
1477
|
{
|
|
1458
|
-
onClick: () => d(!
|
|
1478
|
+
onClick: () => d(!i),
|
|
1459
1479
|
style: {
|
|
1460
1480
|
background: "transparent",
|
|
1461
1481
|
border: "none",
|
|
@@ -1472,7 +1492,7 @@ function kr({ mfeName: t }) {
|
|
|
1472
1492
|
]
|
|
1473
1493
|
}
|
|
1474
1494
|
),
|
|
1475
|
-
|
|
1495
|
+
i && /* @__PURE__ */ m.jsxs(
|
|
1476
1496
|
"div",
|
|
1477
1497
|
{
|
|
1478
1498
|
style: {
|
|
@@ -1559,7 +1579,7 @@ function kr({ mfeName: t }) {
|
|
|
1559
1579
|
]
|
|
1560
1580
|
}
|
|
1561
1581
|
),
|
|
1562
|
-
|
|
1582
|
+
i && /* @__PURE__ */ m.jsx(
|
|
1563
1583
|
"div",
|
|
1564
1584
|
{
|
|
1565
1585
|
onClick: () => d(!1),
|
|
@@ -1575,38 +1595,38 @@ function kr({ mfeName: t }) {
|
|
|
1575
1595
|
)
|
|
1576
1596
|
] });
|
|
1577
1597
|
}
|
|
1578
|
-
const Ee = "platform-kit",
|
|
1598
|
+
const Ee = "platform-kit", ot = Ut(null);
|
|
1579
1599
|
function Mr({ children: t }) {
|
|
1580
|
-
const [r,
|
|
1600
|
+
const [r, o] = T([]), a = typeof window < "u" && window.__MF_NAME__ || Ee, i = R((f, E, y, N) => ({
|
|
1581
1601
|
id: `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,
|
|
1582
1602
|
type: f,
|
|
1583
1603
|
title: E,
|
|
1584
1604
|
message: y,
|
|
1585
|
-
mfeName:
|
|
1605
|
+
mfeName: a,
|
|
1586
1606
|
timestamp: Date.now(),
|
|
1587
1607
|
duration: N
|
|
1588
|
-
}), [
|
|
1589
|
-
|
|
1608
|
+
}), [a]), d = R((f) => {
|
|
1609
|
+
o((y) => [...y, f].slice(0, 5));
|
|
1590
1610
|
const E = f.duration || 5e3;
|
|
1591
1611
|
E > 0 && setTimeout(() => {
|
|
1592
|
-
|
|
1612
|
+
o((y) => y.filter((N) => N.id !== f.id));
|
|
1593
1613
|
}, E);
|
|
1594
|
-
}, []), n =
|
|
1595
|
-
const E =
|
|
1614
|
+
}, []), n = R((f) => {
|
|
1615
|
+
const E = i(f.type, f.title, f.message, f.duration);
|
|
1596
1616
|
d(E), typeof window < "u" && window.dispatchEvent(new CustomEvent("mfe-notification", {
|
|
1597
1617
|
detail: E,
|
|
1598
1618
|
bubbles: !0
|
|
1599
1619
|
}));
|
|
1600
|
-
}, [
|
|
1620
|
+
}, [i, d]), p = R((f, E = "Успешно") => {
|
|
1601
1621
|
n({ type: "success", title: E, message: f });
|
|
1602
|
-
}, [n]), l =
|
|
1622
|
+
}, [n]), l = R((f, E = "Ошибка") => {
|
|
1603
1623
|
n({ type: "error", title: E, message: f });
|
|
1604
|
-
}, [n]), v =
|
|
1624
|
+
}, [n]), v = R((f, E = "Предупреждение") => {
|
|
1605
1625
|
n({ type: "warning", title: E, message: f });
|
|
1606
|
-
}, [n]), c =
|
|
1626
|
+
}, [n]), c = R((f, E = "Информация") => {
|
|
1607
1627
|
n({ type: "info", title: E, message: f });
|
|
1608
|
-
}, [n]), g =
|
|
1609
|
-
|
|
1628
|
+
}, [n]), g = R((f) => {
|
|
1629
|
+
o((E) => E.filter((y) => y.id !== f));
|
|
1610
1630
|
}, []);
|
|
1611
1631
|
return U(() => {
|
|
1612
1632
|
if (typeof window > "u") return;
|
|
@@ -1623,7 +1643,7 @@ function Mr({ children: t }) {
|
|
|
1623
1643
|
return window.addEventListener("mfe-notification", f), () => {
|
|
1624
1644
|
window.removeEventListener("mfe-notification", f);
|
|
1625
1645
|
};
|
|
1626
|
-
}, [d]), /* @__PURE__ */ m.jsxs(
|
|
1646
|
+
}, [d]), /* @__PURE__ */ m.jsxs(ot.Provider, { value: {
|
|
1627
1647
|
notify: n,
|
|
1628
1648
|
notifySuccess: p,
|
|
1629
1649
|
notifyError: l,
|
|
@@ -1692,7 +1712,7 @@ function Mr({ children: t }) {
|
|
|
1692
1712
|
] });
|
|
1693
1713
|
}
|
|
1694
1714
|
function Ir() {
|
|
1695
|
-
const t = Vt(
|
|
1715
|
+
const t = Vt(ot);
|
|
1696
1716
|
return t || {
|
|
1697
1717
|
notify: () => {
|
|
1698
1718
|
},
|
|
@@ -1710,27 +1730,27 @@ function Ir() {
|
|
|
1710
1730
|
}
|
|
1711
1731
|
function Nr(t) {
|
|
1712
1732
|
if (typeof window > "u") return;
|
|
1713
|
-
const r = window.__MF_NAME__ || Ee,
|
|
1733
|
+
const r = window.__MF_NAME__ || Ee, o = {
|
|
1714
1734
|
...t,
|
|
1715
1735
|
mfeName: r,
|
|
1716
1736
|
timestamp: Date.now()
|
|
1717
1737
|
};
|
|
1718
1738
|
window.dispatchEvent(new CustomEvent("mfe-notification", {
|
|
1719
|
-
detail:
|
|
1739
|
+
detail: o,
|
|
1720
1740
|
bubbles: !0
|
|
1721
1741
|
}));
|
|
1722
1742
|
}
|
|
1723
1743
|
function ue(t, r) {
|
|
1724
|
-
const
|
|
1744
|
+
const o = r?.prefix ? `[${r.prefix}]` : `[${t}]`;
|
|
1725
1745
|
return {
|
|
1726
|
-
log: (...
|
|
1746
|
+
log: (...a) => {
|
|
1727
1747
|
},
|
|
1728
|
-
warn: (...
|
|
1748
|
+
warn: (...a) => {
|
|
1729
1749
|
},
|
|
1730
|
-
error: (...
|
|
1731
|
-
console.error(
|
|
1750
|
+
error: (...a) => {
|
|
1751
|
+
console.error(o, ...a);
|
|
1732
1752
|
},
|
|
1733
|
-
info: (...
|
|
1753
|
+
info: (...a) => {
|
|
1734
1754
|
}
|
|
1735
1755
|
};
|
|
1736
1756
|
}
|
|
@@ -1769,25 +1789,25 @@ function xe() {
|
|
|
1769
1789
|
const t = ar;
|
|
1770
1790
|
return t.VITE_MFE_NAME ? String(t.VITE_MFE_NAME) : t.MFE_NAME ? String(t.MFE_NAME) : null;
|
|
1771
1791
|
}
|
|
1772
|
-
let
|
|
1792
|
+
let oe = null, we = !1;
|
|
1773
1793
|
function ur(t, r) {
|
|
1774
|
-
const
|
|
1775
|
-
if (
|
|
1776
|
-
return
|
|
1777
|
-
if (we &&
|
|
1778
|
-
return
|
|
1779
|
-
const
|
|
1794
|
+
const o = be(t);
|
|
1795
|
+
if (o)
|
|
1796
|
+
return o;
|
|
1797
|
+
if (we && oe)
|
|
1798
|
+
return oe;
|
|
1799
|
+
const a = [
|
|
1780
1800
|
{ source: "window.__MF_NAME__", value: at() },
|
|
1781
1801
|
{ source: "sessionStorage.mf-config", value: it() },
|
|
1782
1802
|
{ source: "import.meta.env.VITE_MFE_NAME", value: xe() }
|
|
1783
1803
|
];
|
|
1784
|
-
for (const { source: d, value: n } of
|
|
1804
|
+
for (const { source: d, value: n } of a)
|
|
1785
1805
|
if (n)
|
|
1786
|
-
return
|
|
1806
|
+
return oe = n, we = !0, n;
|
|
1787
1807
|
if (r)
|
|
1788
1808
|
return r;
|
|
1789
|
-
const
|
|
1790
|
-
throw ir.error(
|
|
1809
|
+
const i = "Cannot determine MFE name. Please pass mfeName in props, set window.__MF_NAME__, sessionStorage.mf-config, or VITE_MFE_NAME";
|
|
1810
|
+
throw ir.error(i), new Error(i);
|
|
1791
1811
|
}
|
|
1792
1812
|
function Dr(t) {
|
|
1793
1813
|
return ur(t);
|
|
@@ -1799,16 +1819,16 @@ function $r(t) {
|
|
|
1799
1819
|
return cr(t) !== null;
|
|
1800
1820
|
}
|
|
1801
1821
|
function Lr() {
|
|
1802
|
-
|
|
1822
|
+
oe = null, we = !1;
|
|
1803
1823
|
}
|
|
1804
1824
|
function Ur(t) {
|
|
1805
1825
|
const r = [];
|
|
1806
1826
|
return be(t) && r.push("props.mfeName"), typeof window < "u" && (window.__MF_NAME__ && r.push("window.__MF_NAME__"), sessionStorage.getItem("mf-config") && r.push("sessionStorage.mf-config")), xe() && r.push("import.meta.env.VITE_MFE_NAME"), r;
|
|
1807
1827
|
}
|
|
1808
1828
|
export {
|
|
1809
|
-
|
|
1829
|
+
Rr as ErrorBoundary,
|
|
1810
1830
|
Mr as NotificationProvider,
|
|
1811
|
-
|
|
1831
|
+
Cr as VersionInfo,
|
|
1812
1832
|
W as api,
|
|
1813
1833
|
Pr as apiLogger,
|
|
1814
1834
|
jr as authLogger,
|
|
@@ -1835,11 +1855,11 @@ export {
|
|
|
1835
1855
|
Lr as resetMfeNameCache,
|
|
1836
1856
|
ie as useApi,
|
|
1837
1857
|
xr as useDel,
|
|
1838
|
-
|
|
1839
|
-
|
|
1858
|
+
Tr as useFeatureAdmin,
|
|
1859
|
+
kr as useFeatures,
|
|
1840
1860
|
Er as useGet,
|
|
1841
1861
|
Yt as useInfoData,
|
|
1842
|
-
|
|
1862
|
+
Sr as useMicrofrontendsFeatures,
|
|
1843
1863
|
Ir as useNotification,
|
|
1844
1864
|
Ar as usePermissions,
|
|
1845
1865
|
wr as usePost,
|