fix BiProvider
All checks were successful
Build and Deploy Next.js + Nginx Docker Image / build-and-deploy (push) Successful in 50s
Build and Deploy Next.js + Nginx Docker Image / deploy (push) Successful in 7s

This commit is contained in:
Mohamadzadeh 2026-08-19 14:28:04 +03:30
parent 37f0b178bd
commit fbd2ca137e
2 changed files with 236 additions and 190 deletions

388
dist/core.js vendored
View File

@ -1,31 +1,31 @@
import _ from "axios"; import _ from "axios";
import { jsx as b, jsxs as M } from "react/jsx-runtime"; import { jsx as b, jsxs as D } from "react/jsx-runtime";
import $ from "keycloak-js"; import $ from "keycloak-js";
import ee, { createContext as N, useState as X, useRef as R, useCallback as K, useEffect as g, useMemo as f, useContext as te } from "react"; import ee, { createContext as V, useState as K, useRef as N, useCallback as g, useEffect as f, useMemo as z, useContext as te } from "react";
import { useQueryClient as re, useMutation as ne, useQuery as P, QueryClient as oe, QueryClientProvider as ie } from "@tanstack/react-query"; import { useQueryClient as re, useMutation as ne, useQuery as P, QueryClient as oe, QueryClientProvider as ie } from "@tanstack/react-query";
import { createRoot as se } from "react-dom/client"; import { createRoot as se } from "react-dom/client";
import { extendTheme as ae, withDefaultColorScheme as ue, ChakraProvider as I, Spinner as de, Badge as ce } from "@chakra-ui/react"; import { extendTheme as ae, withDefaultColorScheme as ue, ChakraProvider as R, Spinner as de, Badge as ce } from "@chakra-ui/react";
import D from "next-query-params/pages"; import * as M from "next-query-params/pages";
import le from "use-query-params"; import * as le from "use-query-params";
import { Global as he } from "@emotion/react"; import { Global as he } from "@emotion/react";
let W = null, o = null, Y = null, O = !1; let v = null, o = null, Y = null, W = !1;
const Se = N(null), pe = ({ url: e, realm: r, clientId: t }) => (o || (o = new $({ const pe = V(null), Se = ({ url: e, realm: r, clientId: t }) => (o || (o = new $({
url: e, url: e,
realm: r, realm: r,
clientId: t clientId: t
})), o), Fe = (e) => (W = e, W), me = () => O, G = () => !!(o != null && o.authenticated), x = () => (o == null ? void 0 : o.token) ?? null, C = async (e = 30) => o ? o.updateToken(e) : !1, J = (e) => o == null ? void 0 : o.logout(e), tt = (e) => o == null ? void 0 : o.login(e), H = ({ config: e, initOptions: r = {} } = {}) => { })), o), me = (e) => (v = e, v), Fe = () => W, I = () => !!(o != null && o.authenticated), x = () => (o == null ? void 0 : o.token) ?? null, C = async (e = 30) => o ? o.updateToken(e) : !1, G = (e) => o == null ? void 0 : o.logout(e), et = (e) => o == null ? void 0 : o.login(e), J = ({ config: e, initOptions: r = {} } = {}) => {
const t = e ?? W; const t = e ?? v;
if (!(t != null && t.url) || !(t != null && t.realm) || !(t != null && t.clientId)) if (!(t != null && t.url) || !(t != null && t.realm) || !(t != null && t.clientId))
throw new Error("Keycloak config is required."); throw new Error("Keycloak config is required.");
Fe(t); me(t);
const n = pe(t); const n = Se(t);
return Y || (Y = n.init({ return Y || (Y = n.init({
onLoad: "login-required", onLoad: "login-required",
checkLoginIframe: !1, checkLoginIframe: !1,
flow: "implicit", flow: "implicit",
...r ...r
}).then((d) => (O = !0, d)).catch((d) => { }).then((s) => (W = !0, s)).catch((s) => {
throw O = !0, d; throw W = !0, s;
})), Y; })), Y;
}, qe = ({ }, qe = ({
children: e, children: e,
@ -33,78 +33,78 @@ const Se = N(null), pe = ({ url: e, realm: r, clientId: t }) => (o || (o = new $
initOptions: t, initOptions: t,
loading: n = null loading: n = null
}) => { }) => {
const [d, h] = X(!1), [u, s] = X(!1), [a, p] = X(null), m = R(!1), i = K(() => { const [s, h] = K(!1), [d, a] = K(!1), [u, S] = K(null), F = N(!1), i = g(() => {
o && (s(!!o.authenticated), p(o.token ?? null)); o && (a(!!o.authenticated), S(o.token ?? null));
}, []); }, []);
g(() => (m.current = !0, H({ config: r, initOptions: t }).then((l) => { f(() => (F.current = !0, J({ config: r, initOptions: t }).then((l) => {
m.current && (s(!!l), p((o == null ? void 0 : o.token) ?? null), h(!0)); F.current && (a(!!l), S((o == null ? void 0 : o.token) ?? null), h(!0));
}).catch(() => { }).catch(() => {
m.current && (s(!1), p(null), h(!0)); F.current && (a(!1), S(null), h(!0));
}), () => { }), () => {
m.current = !1; F.current = !1;
}), [r, t]); }), [r, t]);
const c = K(() => o == null ? void 0 : o.login(), []), q = K((l) => o == null ? void 0 : o.logout(l), []), S = K( const c = g(() => o == null ? void 0 : o.login(), []), q = g((l) => o == null ? void 0 : o.logout(l), []), p = g(
async (l = 30) => { async (l = 30) => {
if (!o) return !1; if (!o) return !1;
const Z = await o.updateToken(l); const Z = await o.updateToken(l);
return i(), Z; return i(), Z;
}, },
[i] [i]
), F = f( ), m = z(
() => ({ () => ({
initialized: d, initialized: s,
authenticated: u, authenticated: d,
token: a, token: u,
login: c, login: c,
logout: q, logout: q,
updateToken: S updateToken: p
}), }),
[d, u, a, c, q, S] [s, d, u, c, q, p]
); );
return d ? /* @__PURE__ */ b(Se.Provider, { value: F, children: e }) : n; return s ? /* @__PURE__ */ b(pe.Provider, { value: m, children: e }) : n;
}; };
let B = null; let B = null;
const Ee = (e) => { const Ee = (e) => {
const { api: r } = e, t = _.create({ const { api: r } = e, t = _.create({
baseURL: r.baseUrl baseURL: r.baseUrl
}), n = async () => { }), n = async () => {
(!me() || !G()) && await H(); (!Fe() || !I()) && await J();
}, d = !!e.keycloak, h = async (s) => { }, s = !!e.keycloak, h = async (a) => {
if (!d) return s; if (!s) return a;
await n(); await n();
let a = x(); let u = x();
if (a) { if (u) {
try { try {
await C(5), a = x(); await C(5), u = x();
} catch { } catch {
} }
s.headers = { a.headers = {
...s.headers, ...a.headers,
Authorization: `Bearer ${a}` Authorization: `Bearer ${u}`
}; };
} }
return s; return a;
}, u = async (s) => { }, d = async (a) => {
var p; var S;
const a = s.config; const u = a.config;
if (((p = s == null ? void 0 : s.response) == null ? void 0 : p.status) === 401 && !(a != null && a._retry)) { if (((S = a == null ? void 0 : a.response) == null ? void 0 : S.status) === 401 && !(u != null && u._retry)) {
a._retry = !0; u._retry = !0;
try { try {
await C(30); await C(30);
const m = x(); const F = x();
return a.headers = { return u.headers = {
...a.headers, ...u.headers,
Authorization: `Bearer ${m}` Authorization: `Bearer ${F}`
}, t(a); }, t(u);
} catch { } catch {
J({ redirectUri: window.location.origin }); G({ redirectUri: window.location.origin });
} }
} }
return Promise.reject(s); return Promise.reject(a);
}; };
return t.interceptors.request.use(h), t.interceptors.response.use( return t.interceptors.request.use(h), t.interceptors.response.use(
(s) => s, (a) => a,
u d
), { ), {
api: t api: t
}; };
@ -112,79 +112,79 @@ const Ee = (e) => {
if (!B) if (!B)
throw new Error("api is not configured. Call configureApi(config) first."); throw new Error("api is not configured. Call configureApi(config) first.");
return B.api; return B.api;
}, k = new Proxy( }, H = new Proxy(
{}, {},
{ {
get(e, r) { get(e, r) {
return ye()[r]; return ye()[r];
} }
} }
), be = async (e) => (await k.get(e)).data; ), be = async (e) => (await H.get(e)).data;
function v(e) { function O(e) {
return Array.isArray(e) ? e : [e]; return Array.isArray(e) ? e : [e];
} }
function Te(e) { function Te(e) {
return [...v(e), "list"]; return [...O(e), "list"];
} }
function U(e, r) { function U(e, r) {
return [...v(e), r]; return [...O(e), r];
} }
function Ke(e, r) { function ge(e, r) {
if (!r) return e; if (!r) return e;
const t = new URLSearchParams(); const t = new URLSearchParams();
Object.entries(r).forEach(([d, h]) => { Object.entries(r).forEach(([s, h]) => {
h != null && h !== "" && t.append(d, h); h != null && h !== "" && t.append(s, h);
}); });
const n = t.toString(); const n = t.toString();
return n ? `${e}?${n}` : e; return n ? `${e}?${n}` : e;
} }
function Xe(e, r) { function Ke(e, r) {
return typeof e == "function" ? e(r == null ? void 0 : r.id, r) : e; return typeof e == "function" ? e(r == null ? void 0 : r.id, r) : e;
} }
function ge(e = {}) { function fe(e = {}) {
const { id: r, ...t } = e; const { id: r, ...t } = e;
return t; return t;
} }
function ze(e, r) { function Xe(e, r) {
return `${e.replace(/\/$/, "")}/${r}`; return `${e.replace(/\/$/, "")}/${r}`;
} }
function xe(e) { function xe(e) {
return `use${e.charAt(0).toUpperCase()}${e.slice(1)}`; return `use${e.charAt(0).toUpperCase()}${e.slice(1)}`;
} }
function fe(e, r) { function ze(e, r) {
return typeof e == "function" ? e(r) : e; return typeof e == "function" ? e(r) : e;
} }
function rt({ function tt({
key: e, key: e,
url: r, url: r,
actions: t = {}, actions: t = {},
axiosInstance: n = k, axiosInstance: n = H,
fetcher: d = be fetcher: s = be
}) { }) {
const h = v(e), u = Te(e); const h = O(e), d = Te(e);
function s(i, c = {}) { function a(i, c = {}) {
return P({ return P({
queryKey: i ? [...u, i] : u, queryKey: i ? [...d, i] : d,
queryFn: () => d(Ke(r, i)), queryFn: () => s(ge(r, i)),
...c ...c
}); });
} }
function a(i, c = {}) { function u(i, c = {}) {
return P({ return P({
queryKey: U(e, i), queryKey: U(e, i),
queryFn: () => d(ze(r, i)), queryFn: () => s(Xe(r, i)),
enabled: !!i, enabled: !!i,
...c ...c
}); });
} }
function p(i, c = {}) { function S(i, c = {}) {
const q = re(), S = t[i]; const q = re(), p = t[i];
if (!S) if (!p)
throw new Error(`Action "${i}" is not defined.`); throw new Error(`Action "${i}" is not defined.`);
return ne({ return ne({
mutationKey: [...h, i], mutationKey: [...h, i],
mutationFn: async (F = {}) => { mutationFn: async (m = {}) => {
const l = S.method || "post", Z = Xe(S.url || r, F), T = fe(S.requestConfig, F), E = S.body ? S.body(F) : S.sendRawPayload ? F : ge(F); const l = p.method || "post", Z = Ke(p.url || r, m), T = ze(p.requestConfig, m), E = p.body ? p.body(m) : p.sendRawPayload ? m : fe(m);
let y; let y;
if (l === "get") if (l === "get")
y = await n.get( y = await n.get(
@ -195,12 +195,12 @@ function rt({
} : E } : E
); );
else if (l === "delete") { else if (l === "delete") {
const z = E && Object.keys(E).length > 0; const X = E && Object.keys(E).length > 0;
y = await n.delete( y = await n.delete(
Z, Z,
T || z ? { T || X ? {
...T || {}, ...T || {},
...z ? { data: E } : {} ...X ? { data: E } : {}
} : void 0 } : void 0
); );
} else } else
@ -211,65 +211,65 @@ function rt({
); );
return y.data; return y.data;
}, },
onSuccess: (...F) => { onSuccess: (...m) => {
var y; var y;
const [l, Z] = F; const [l, Z] = m;
q.invalidateQueries({ q.invalidateQueries({
queryKey: u queryKey: d
}); });
const T = (Z == null ? void 0 : Z.id) ?? (l == null ? void 0 : l.id); const T = (Z == null ? void 0 : Z.id) ?? (l == null ? void 0 : l.id);
T && q.invalidateQueries({ T && q.invalidateQueries({
queryKey: U(e, T) queryKey: U(e, T)
}); });
const E = typeof S.invalidateKeys == "function" ? S.invalidateKeys(l, Z) : S.invalidateKeys; const E = typeof p.invalidateKeys == "function" ? p.invalidateKeys(l, Z) : p.invalidateKeys;
E == null || E.forEach((z) => { E == null || E.forEach((X) => {
q.invalidateQueries({ queryKey: z }); q.invalidateQueries({ queryKey: X });
}), (y = c.onSuccess) == null || y.call(c, ...F); }), (y = c.onSuccess) == null || y.call(c, ...m);
}, },
...c ...c
}); });
} }
const m = Object.keys(t).reduce((i, c) => (i[xe(c)] = (q = {}) => p(c, q), i), {}); const F = Object.keys(t).reduce((i, c) => (i[xe(c)] = (q = {}) => S(c, q), i), {});
return { return {
key: h, key: h,
listKey: u, listKey: d,
useGet: s, useGet: a,
useItem: a, useItem: u,
useAction: p, useAction: S,
...m ...F
}; };
} }
const Q = N(null), w = "permissions", Be = (e) => (e == null ? void 0 : e.storageKey) || w, we = ({ const k = V(null), w = "permissions", Be = (e) => (e == null ? void 0 : e.storageKey) || w, we = ({
user: e = null, user: e = null,
children: r, children: r,
config: t, config: t,
loading: n = /* @__PURE__ */ b("div", { children: "Loading permissions..." }), loading: n = /* @__PURE__ */ b("div", { children: "Loading permissions..." }),
errorFallback: d = /* @__PURE__ */ b("div", { children: "Error loading permissions" }) errorFallback: s = /* @__PURE__ */ b("div", { children: "Error loading permissions" })
}) => { }) => {
const h = Be(t), [u, s] = X( const h = Be(t), [d, a] = K(
() => Ye(h) () => Ye(h)
), { data: a, isLoading: p, error: m } = Ae(t), i = a ?? u; ), { data: u, isLoading: S, error: F } = Ae(t), i = u ?? d;
g(() => { f(() => {
a && (Pe(h, a), s(a)); u && (Pe(h, u), a(u));
}, [a, h]); }, [u, h]);
const c = f( const c = z(
() => We(i), () => ve(i),
[i] [i]
), q = K( ), q = g(
(l = "") => Oe(c, l), (l = "") => We(c, l),
[c] [c]
), S = K((l = "") => !q(l), [q]), F = f( ), p = g((l = "") => !q(l), [q]), m = z(
() => ({ () => ({
user: e, user: e,
can: q, can: q,
cannot: S, cannot: p,
permissions: i, permissions: i,
isLoading: p, isLoading: S,
error: m error: F
}), }),
[e, q, S, i, p, m] [e, q, p, i, S, F]
); );
return m && !i ? d : p && !i ? n : /* @__PURE__ */ b(Q.Provider, { value: F, children: r }); return F && !i ? s : S && !i ? n : /* @__PURE__ */ b(k.Provider, { value: m, children: r });
}, Ye = (e = w) => { }, Ye = (e = w) => {
if (!(typeof window > "u")) if (!(typeof window > "u"))
try { try {
@ -284,23 +284,23 @@ const Q = N(null), w = "permissions", Be = (e) => (e == null ? void 0 : e.storag
localStorage.setItem(e, JSON.stringify(r)); localStorage.setItem(e, JSON.stringify(r));
} catch { } catch {
} }
}, nt = (e = w) => { }, rt = (e = w) => {
if (!(typeof window > "u")) if (!(typeof window > "u"))
try { try {
localStorage.removeItem(e); localStorage.removeItem(e);
} catch { } catch {
} }
}, We = (e) => e ? new Set(e.map((r) => r.name)) : /* @__PURE__ */ new Set(), Oe = (e, r = "") => { }, ve = (e) => e ? new Set(e.map((r) => r.name)) : /* @__PURE__ */ new Set(), We = (e, r = "") => {
if (!r) return !1; if (!r) return !1;
if (e.has(r) || [...e].some((n) => n.startsWith(r))) return !0; if (e.has(r) || [...e].some((n) => n.startsWith(r))) return !0;
let t = r; let t = r;
for (; t.includes(":"); ) for (; t.includes(":"); )
if (t = t.slice(0, t.lastIndexOf(":")), e.has(`${t}:*`)) return !0; if (t = t.slice(0, t.lastIndexOf(":")), e.has(`${t}:*`)) return !0;
return !1; return !1;
}, j = { }, Q = {
all: ["permissions"], all: ["permissions"],
list: (e) => [...j.all, e] list: (e) => [...Q.all, e]
}, ve = async (e) => { }, Oe = async (e) => {
if (!(e != null && e.url) || !(e != null && e.clientId)) if (!(e != null && e.url) || !(e != null && e.clientId))
throw new Error("Permission config requires url and clientId."); throw new Error("Permission config requires url and clientId.");
const r = x(), t = new URL(e.url); const r = x(), t = new URL(e.url);
@ -315,59 +315,59 @@ const Q = N(null), w = "permissions", Be = (e) => (e == null ? void 0 : e.storag
throw new Error("Failed to load permissions"); throw new Error("Failed to load permissions");
return n.json(); return n.json();
}, A = () => { }, A = () => {
const e = te(Q); const e = te(k);
if (!e) if (!e)
throw new Error("usePermission must be used within PermissionProvider"); throw new Error("usePermission must be used within PermissionProvider");
return e; return e;
}, Ae = (e) => P({ }, Ae = (e) => P({
queryKey: j.list(e == null ? void 0 : e.clientId), queryKey: Q.list(e == null ? void 0 : e.clientId),
queryFn: () => ve(e), queryFn: () => Oe(e),
enabled: !!(e != null && e.url) && !!(e != null && e.clientId) && G(), enabled: !!(e != null && e.url) && !!(e != null && e.clientId) && I(),
staleTime: 1 / 0, staleTime: 1 / 0,
refetchOnWindowFocus: !1, refetchOnWindowFocus: !1,
refetchOnReconnect: !1 refetchOnReconnect: !1
}), ot = ({ }), nt = ({
perm: e, perm: e,
children: r, children: r,
fallback: t = /* @__PURE__ */ b("div", { children: "You are not allowed to do this" }) fallback: t = /* @__PURE__ */ b("div", { children: "You are not allowed to do this" })
}) => { }) => {
const { can: n } = A(); const { can: n } = A();
return n(e) ? r : t; return n(e) ? r : t;
}, it = ({ children: e }) => { }, ot = ({ children: e }) => {
const { can: r, permissions: t } = A(); const { can: r, permissions: t } = A();
return t && r("admin") ? e : null; return t && r("admin") ? e : null;
}, st = ({ children: e, forceNoAccess: r = !1 }) => { }, it = ({ children: e, forceNoAccess: r = !1 }) => {
const { can: t, isLoading: n } = A(); const { can: t, isLoading: n } = A();
return g(() => { return f(() => {
n || (r || !t("panel_access")) && J(); n || (r || !t("panel_access")) && G();
}, [n, t, r]), e; }, [n, t, r]), e;
}; };
function Me() { function De() {
const [e, r] = X(!1), t = R(null); const [e, r] = K(!1), t = N(null);
return g(() => { return f(() => {
if (process.env.NODE_ENV !== "production") return; if (process.env.NODE_ENV !== "production") return;
let n; let n;
const d = async () => { const s = async () => {
const u = await fetch(`/version.json?t=${Date.now()}`, { const d = await fetch(`/version.json?t=${Date.now()}`, {
cache: "no-store" cache: "no-store"
}); });
if (!u.ok) if (!d.ok)
throw new Error(`Failed to fetch version: ${u.status}`); throw new Error(`Failed to fetch version: ${d.status}`);
const s = await u.json(); const a = await d.json();
return String(s.version); return String(a.version);
}; };
return (async () => { return (async () => {
try { try {
t.current = await d(), n = setInterval(async () => { t.current = await s(), n = setInterval(async () => {
try { try {
const u = await d(); const d = await s();
t.current && u !== t.current && (r(!0), clearInterval(n)); t.current && d !== t.current && (r(!0), clearInterval(n));
} catch (u) { } catch (d) {
console.error("Update check failed:", u); console.error("Update check failed:", d);
} }
}, 3e4); }, 3e4);
} catch (u) { } catch (d) {
console.error("Initial version fetch failed:", u); console.error("Initial version fetch failed:", d);
} }
})(), () => { })(), () => {
n && clearInterval(n); n && clearInterval(n);
@ -391,7 +391,7 @@ function Me() {
} }
) : null; ) : null;
} }
const De = new oe({ const Me = new oe({
defaultOptions: { defaultOptions: {
queries: { queries: {
retry: 1, retry: 1,
@ -435,17 +435,33 @@ const De = new oe({
} }
` `
} }
), { QueryParamProvider: Ve } = le; ), j = (e, r) => {
var V; let t = e;
const Ne = ((V = D) == null ? void 0 : V.default) ?? D, L = "__UIKIT_REMOTE_DEPS__"; for (let n = 0; n < 4 && t; n += 1) {
function Re({ theme: e, chakraProviderProps: r } = {}) { const s = Reflect.get(t, r);
if (s !== void 0) return s;
t = Reflect.get(t, "default");
}
}, Ve = (e) => {
let r = e;
for (let t = 0; t < 4 && r; t += 1) {
const n = Reflect.get(r, "default");
if (n === void 0) break;
r = n;
}
return r;
}, Ne = j(
le,
"QueryParamProvider"
), Re = j(M, "NextAdapterPages") ?? Ve(M), L = "__UIKIT_REMOTE_DEPS__";
function Ie({ theme: e, chakraProviderProps: r } = {}) {
if (typeof window > "u") return; if (typeof window > "u") return;
const t = window[L] || {}; const t = window[L] || {};
window[L] = { window[L] = {
...t, ...t,
React: t.React || ee, React: t.React || ee,
createRoot: t.createRoot || se, createRoot: t.createRoot || se,
ChakraProvider: t.ChakraProvider || I, ChakraProvider: t.ChakraProvider || R,
Badge: t.Badge || ce, Badge: t.Badge || ce,
theme: e ?? t.theme, theme: e ?? t.theme,
chakraProviderProps: { chakraProviderProps: {
@ -454,35 +470,35 @@ function Re({ theme: e, chakraProviderProps: r } = {}) {
} }
}; };
} }
function at({ function st({
children: e, children: e,
apiBaseUrl: r, apiBaseUrl: r,
keycloakClientId: t, keycloakClientId: t,
permissionClientId: n, permissionClientId: n,
loading: d = /* @__PURE__ */ b(de, {}), loading: s = /* @__PURE__ */ b(de, {}),
updateChecker: h = !1, updateChecker: h = !1,
updateCheckerProps: u, updateCheckerProps: d,
keycloakUrl: s = "https://auth.ibagher.ir", keycloakUrl: a = "https://auth.ibagher.ir",
keycloakRealm: a = "bi", keycloakRealm: u = "bi",
permissionUrl: p = "https://api.d.aiengines.ir/user_api/v1/permissions/list", permissionUrl: S = "https://api.d.aiengines.ir/user_api/v1/permissions/list",
keycloakEnabled: m, keycloakEnabled: F,
permissionEnabled: i, permissionEnabled: i,
theme: c = Ue, theme: c = Ue,
remoteUiEnabled: q = !0, remoteUiEnabled: q = !0,
remoteUiChakraProviderProps: S remoteUiChakraProviderProps: p
}) { }) {
const [F, l] = X(!1), Z = m ?? !!t, T = i ?? !!n, E = f( const [m, l] = K(!1), Z = F ?? !!t, T = i ?? !!n, E = z(
() => ({ () => ({
api: { api: {
baseUrl: r || "" baseUrl: r || ""
}, },
keycloak: Z ? { keycloak: Z ? {
url: s, url: a,
realm: a, realm: u,
clientId: t clientId: t
} : null, } : null,
permission: T ? { permission: T ? {
url: p, url: S,
clientId: n clientId: n
} : null } : null
}), }),
@ -490,56 +506,56 @@ function at({
r, r,
Z, Z,
T, T,
s,
a, a,
u,
t, t,
p, S,
n n
] ]
); );
if (g(() => { if (f(() => {
l(!0); l(!0);
}, []), g(() => { }, []), f(() => {
F && Ze(E); m && Ze(E);
}, [F, E]), !F) }, [m, E]), !m)
return null; return null;
q && Re({ q && Ie({
theme: c, theme: c,
chakraProviderProps: S chakraProviderProps: p
}); });
let y = e; let y = e;
return T && (y = /* @__PURE__ */ b(we, { config: E.permission, loading: d, children: y })), Z && (y = /* @__PURE__ */ b(qe, { config: E.keycloak, loading: d, children: y })), /* @__PURE__ */ M(I, { theme: c, children: [ return T && (y = /* @__PURE__ */ b(we, { config: E.permission, loading: s, children: y })), Z && (y = /* @__PURE__ */ b(qe, { config: E.keycloak, loading: s, children: y })), /* @__PURE__ */ D(R, { theme: c, children: [
/* @__PURE__ */ b(Le, {}), /* @__PURE__ */ b(Le, {}),
/* @__PURE__ */ M(ie, { client: De, children: [ /* @__PURE__ */ D(ie, { client: Me, children: [
h && /* @__PURE__ */ b(Me, { ...u }), h && /* @__PURE__ */ b(De, { ...d }),
/* @__PURE__ */ b(Ve, { adapter: Ne, children: y }) /* @__PURE__ */ b(Ne, { adapter: Re, children: y })
] }) ] })
] }); ] });
} }
export { export {
it as AdminGuard, ot as AdminGuard,
at as BiProvider, st as BiProvider,
ot as Can, nt as Can,
qe as KeycloakProvider, qe as KeycloakProvider,
st as PanelAccessGuard, it as PanelAccessGuard,
we as PermissionProvider, we as PermissionProvider,
k as api, H as api,
Oe as checkPermission, We as checkPermission,
nt as clearCachedPermissions, rt as clearCachedPermissions,
Ze as configureApi, Ze as configureApi,
rt as createApi, tt as createApi,
We as createPermissionSet, ve as createPermissionSet,
be as fetcher, be as fetcher,
ye as getApi, ye as getApi,
Ye as getCachedPermissions, Ye as getCachedPermissions,
x as getKeycloakToken, x as getKeycloakToken,
ve as getPermissions, Oe as getPermissions,
H as initKeycloak, J as initKeycloak,
G as isKeycloakAuthenticated, I as isKeycloakAuthenticated,
me as isKeycloakInitialized, Fe as isKeycloakInitialized,
tt as loginKeycloak, et as loginKeycloak,
J as logoutKeycloak, G as logoutKeycloak,
j as permissionKeys, Q as permissionKeys,
Pe as setCachedPermissions, Pe as setCachedPermissions,
C as updateKeycloakToken, C as updateKeycloakToken,
A as usePermission, A as usePermission,

View File

@ -2,8 +2,8 @@ import React, { useEffect, useMemo, useState } from "react";
import { createRoot } from "react-dom/client"; import { createRoot } from "react-dom/client";
import { Badge, ChakraProvider, Spinner } from "@chakra-ui/react"; import { Badge, ChakraProvider, Spinner } from "@chakra-ui/react";
import { QueryClientProvider } from "@tanstack/react-query"; import { QueryClientProvider } from "@tanstack/react-query";
import nextAdapterPagesModule from "next-query-params/pages"; import * as nextAdapterPagesModule from "next-query-params/pages";
import useQueryParamsModule from "use-query-params"; import * as useQueryParamsModule from "use-query-params";
import { KeycloakProvider } from "./keycloak.jsx"; import { KeycloakProvider } from "./keycloak.jsx";
import { PermissionProvider } from "./permission.jsx"; import { PermissionProvider } from "./permission.jsx";
import { UpdateChecker } from "./UpdateChecker.jsx"; import { UpdateChecker } from "./UpdateChecker.jsx";
@ -11,9 +11,39 @@ import { configureApi } from "./api.js";
import { queryClient } from "./query.js"; import { queryClient } from "./query.js";
import { Fonts, theme as defaultTheme } from "./style.jsx"; import { Fonts, theme as defaultTheme } from "./style.jsx";
const { QueryParamProvider } = useQueryParamsModule; const getInteropExport = (module, exportName) => {
let current = module;
for (let index = 0; index < 4 && current; index += 1) {
const value = Reflect.get(current, exportName);
if (value !== undefined) return value;
current = Reflect.get(current, "default");
}
return undefined;
};
const getInteropDefault = (module) => {
let current = module;
for (let index = 0; index < 4 && current; index += 1) {
const next = Reflect.get(current, "default");
if (next === undefined) break;
current = next;
}
return current;
};
const QueryParamProvider = getInteropExport(
useQueryParamsModule,
"QueryParamProvider",
);
const NextAdapterPages = const NextAdapterPages =
nextAdapterPagesModule?.default ?? nextAdapterPagesModule; getInteropExport(nextAdapterPagesModule, "NextAdapterPages") ??
getInteropDefault(nextAdapterPagesModule);
const REMOTE_DEPS_KEY = "__UIKIT_REMOTE_DEPS__"; const REMOTE_DEPS_KEY = "__UIKIT_REMOTE_DEPS__";
function setupBiRemoteUiDeps({ theme, chakraProviderProps } = {}) { function setupBiRemoteUiDeps({ theme, chakraProviderProps } = {}) {