@declarion/react 0.180.0 → 0.182.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-lib/api/audience.js +1 -1
- package/dist-lib/api/client.js +39 -37
- package/dist-lib/app.js +101 -101
- package/dist-lib/hooks/useSchema.js +15 -14
- package/dist-lib/stores/auth.js +17 -8
- package/package.json +1 -1
package/dist-lib/api/audience.js
CHANGED
package/dist-lib/api/client.js
CHANGED
|
@@ -31,7 +31,7 @@ function x(e) {
|
|
|
31
31
|
async function S() {
|
|
32
32
|
let e = navigator.locks;
|
|
33
33
|
if (!e) {
|
|
34
|
-
await
|
|
34
|
+
await P();
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
37
|
let t = Date.now();
|
|
@@ -43,7 +43,7 @@ async function S() {
|
|
|
43
43
|
} else try {
|
|
44
44
|
b({
|
|
45
45
|
ok: !0,
|
|
46
|
-
access_expires_at: await
|
|
46
|
+
access_expires_at: await P()
|
|
47
47
|
});
|
|
48
48
|
} catch (e) {
|
|
49
49
|
throw e instanceof C && b({
|
|
@@ -65,27 +65,27 @@ function T() {
|
|
|
65
65
|
}), w;
|
|
66
66
|
}
|
|
67
67
|
function E(e) {
|
|
68
|
-
return O || (
|
|
68
|
+
return O || (F = null, l() || p(e), typeof window > "u") ? Promise.resolve() : T().then((t) => t.scheduleRenewal(e), () => void 0);
|
|
69
69
|
}
|
|
70
70
|
function D() {
|
|
71
71
|
f(), w?.then((e) => e.cancelRenewal());
|
|
72
72
|
}
|
|
73
73
|
var O = !1;
|
|
74
|
-
function
|
|
74
|
+
function ee() {
|
|
75
75
|
O = !0, D();
|
|
76
76
|
}
|
|
77
|
-
function
|
|
77
|
+
function k() {
|
|
78
78
|
return O;
|
|
79
79
|
}
|
|
80
|
-
function
|
|
81
|
-
return O = !1, E(e);
|
|
80
|
+
function A(e) {
|
|
81
|
+
return O = !1, I += 1, E(e);
|
|
82
82
|
}
|
|
83
83
|
typeof window < "u" && window.addEventListener("storage", (e) => {
|
|
84
84
|
if (e.key !== _ || l()) return;
|
|
85
85
|
let t = y(() => e.newValue);
|
|
86
86
|
t?.ok && t.access_expires_at && E(t.access_expires_at);
|
|
87
87
|
});
|
|
88
|
-
async function
|
|
88
|
+
async function j(e, n, r) {
|
|
89
89
|
let i = new AbortController(), a = setTimeout(() => i.abort(), r);
|
|
90
90
|
try {
|
|
91
91
|
return await fetch(e, {
|
|
@@ -98,47 +98,49 @@ async function M(e, n, r) {
|
|
|
98
98
|
clearTimeout(a);
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
|
-
async function
|
|
101
|
+
async function M(e) {
|
|
102
102
|
try {
|
|
103
103
|
return (await e.json())?.result?.expires_at;
|
|
104
104
|
} catch {
|
|
105
105
|
return;
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
|
-
function
|
|
109
|
-
return
|
|
108
|
+
function N() {
|
|
109
|
+
return j("/api/actions/auth.refresh", {
|
|
110
110
|
method: "POST",
|
|
111
111
|
credentials: "include",
|
|
112
112
|
headers: { "Content-Type": "application/json" },
|
|
113
113
|
body: h({})
|
|
114
114
|
}, u);
|
|
115
115
|
}
|
|
116
|
-
async function
|
|
117
|
-
let t = await
|
|
116
|
+
async function P() {
|
|
117
|
+
let t = await N();
|
|
118
118
|
if (t.status === 429) {
|
|
119
119
|
let e = parseInt(t.headers.get("Retry-After") || "1", 10);
|
|
120
|
-
await r(t), await new Promise((t) => setTimeout(t, e * 1e3)), t = await
|
|
120
|
+
await r(t), await new Promise((t) => setTimeout(t, e * 1e3)), t = await N();
|
|
121
121
|
}
|
|
122
122
|
if (t.status >= 500) {
|
|
123
123
|
let n = await r(t);
|
|
124
124
|
throw new e(t.status, n.body, n.raw);
|
|
125
125
|
}
|
|
126
126
|
if (!t.ok) throw await r(t), new C(t.status);
|
|
127
|
-
let n = await
|
|
127
|
+
let n = await M(t);
|
|
128
128
|
return E(n), n;
|
|
129
129
|
}
|
|
130
|
-
var
|
|
130
|
+
var F = null, I = 0, L = /* @__PURE__ */ new Set(["auth.token_refresh_needed", "auth.unauthorized"]);
|
|
131
131
|
function R(n) {
|
|
132
132
|
return n instanceof t || n instanceof e;
|
|
133
133
|
}
|
|
134
134
|
async function z() {
|
|
135
135
|
if (O) throw new C(401);
|
|
136
|
-
if (
|
|
137
|
-
|
|
138
|
-
|
|
136
|
+
if (F !== null) throw new C(F);
|
|
137
|
+
if (g) return g;
|
|
138
|
+
let e = I;
|
|
139
|
+
return g = S().catch((t) => {
|
|
140
|
+
throw t instanceof C && e === I && (F = t.status), t;
|
|
139
141
|
}).finally(() => {
|
|
140
142
|
g = null;
|
|
141
|
-
}), g
|
|
143
|
+
}), g;
|
|
142
144
|
}
|
|
143
145
|
var B = () => {
|
|
144
146
|
if (typeof window > "u") return;
|
|
@@ -169,7 +171,7 @@ function J(e, t) {
|
|
|
169
171
|
reader: e
|
|
170
172
|
} : null);
|
|
171
173
|
}
|
|
172
|
-
function
|
|
174
|
+
function te(e) {
|
|
173
175
|
G = e ? {
|
|
174
176
|
language: e,
|
|
175
177
|
reader: K ?? null
|
|
@@ -183,58 +185,58 @@ function X(e) {
|
|
|
183
185
|
return !t || !e.startsWith("/api/") || /[?&]language=/.test(e) ? e : `${e}${e.includes("?") ? "&" : "?"}language=${encodeURIComponent(t)}`;
|
|
184
186
|
}
|
|
185
187
|
async function Z(t, i, u, f) {
|
|
186
|
-
let p = X(t), m = l(), h = m ? "omit" : i.credentials ?? "include", g = m || h !== "omit", _ = W(i.headers, !!i.body, u, m ? c() : null), v = d(t, i), y = await
|
|
188
|
+
let p = X(t), m = l(), h = m ? "omit" : i.credentials ?? "include", g = m || h !== "omit", _ = W(i.headers, !!i.body, u, m ? c() : null), v = d(t, i), y = I, b = await j(p, {
|
|
187
189
|
...i,
|
|
188
190
|
headers: _,
|
|
189
191
|
credentials: h
|
|
190
192
|
}, v);
|
|
191
|
-
if (a(
|
|
192
|
-
let { raw: t, body: a } = await r(
|
|
193
|
-
if (g &&
|
|
193
|
+
if (a(b.headers), !b.ok) {
|
|
194
|
+
let { raw: t, body: a } = await r(b), c = n(a.type), l = a.title ?? "";
|
|
195
|
+
if (g && b.status === 401 && L.has(c)) try {
|
|
194
196
|
let t = null;
|
|
195
197
|
m ? (s(), t = await o()) : await z();
|
|
196
|
-
let a = W(i.headers, !!i.body, u, t), c = await
|
|
198
|
+
let a = W(i.headers, !!i.body, u, t), c = await j(p, {
|
|
197
199
|
...i,
|
|
198
200
|
headers: a,
|
|
199
201
|
credentials: h
|
|
200
202
|
}, v);
|
|
201
203
|
if (!c.ok) {
|
|
202
204
|
let t = await r(c);
|
|
203
|
-
throw !m && c.status === 401 && L.has(n(t.body.type)) && (
|
|
205
|
+
throw !m && y === I && c.status === 401 && L.has(n(t.body.type)) && (F = 401), c.status === 401 && !u.isSessionProbe && B(), new e(c.status, t.body, t.raw);
|
|
204
206
|
}
|
|
205
207
|
return f(c);
|
|
206
208
|
} catch (n) {
|
|
207
209
|
throw R(n) ? n : (u.isSessionProbe || B(), new e(401, a, t));
|
|
208
210
|
}
|
|
209
|
-
throw g &&
|
|
210
|
-
status:
|
|
211
|
+
throw g && b.status === 401 && !u.isSessionProbe && B(), U({
|
|
212
|
+
status: b.status,
|
|
211
213
|
code: c,
|
|
212
214
|
message: l
|
|
213
|
-
}), new e(
|
|
215
|
+
}), new e(b.status, a, t);
|
|
214
216
|
}
|
|
215
|
-
return f(
|
|
217
|
+
return f(b);
|
|
216
218
|
}
|
|
217
219
|
function Q(e) {
|
|
218
220
|
return e.status === 204 ? Promise.resolve(void 0) : e.json();
|
|
219
221
|
}
|
|
220
|
-
async function
|
|
222
|
+
async function ne(e, t = {}, { isSessionProbe: n = !1 } = {}) {
|
|
221
223
|
return Z(e, t, {
|
|
222
224
|
setAccept: !1,
|
|
223
225
|
isSessionProbe: n
|
|
224
226
|
}, Q);
|
|
225
227
|
}
|
|
226
|
-
async function
|
|
228
|
+
async function re(e) {
|
|
227
229
|
return {
|
|
228
230
|
blob: await e.blob(),
|
|
229
231
|
filename: $(e.headers),
|
|
230
232
|
headers: e.headers
|
|
231
233
|
};
|
|
232
234
|
}
|
|
233
|
-
async function
|
|
235
|
+
async function ie(e, t = {}) {
|
|
234
236
|
return Z(e, t, {
|
|
235
237
|
setAccept: !0,
|
|
236
238
|
isSessionProbe: !1
|
|
237
|
-
},
|
|
239
|
+
}, re);
|
|
238
240
|
}
|
|
239
241
|
function $(e) {
|
|
240
242
|
let t = e.get("Content-Disposition");
|
|
@@ -246,7 +248,7 @@ function $(e) {
|
|
|
246
248
|
let r = t.match(/filename\s*=\s*("([^"]+)"|([^;]+))/i);
|
|
247
249
|
return r ? (r[2] ?? r[3] ?? "").trim() : "";
|
|
248
250
|
}
|
|
249
|
-
async function
|
|
251
|
+
async function ae(e, t = {}, { isSessionProbe: n = !1, keepalive: r = !1, credentials: i } = {}) {
|
|
250
252
|
return (await Z(`/api/actions/${encodeURIComponent(e)}`, {
|
|
251
253
|
method: "POST",
|
|
252
254
|
body: h(t),
|
|
@@ -257,4 +259,4 @@ async function ie(e, t = {}, { isSessionProbe: n = !1, keepalive: r = !1, creden
|
|
|
257
259
|
isSessionProbe: n
|
|
258
260
|
}, Q)).result;
|
|
259
261
|
}
|
|
260
|
-
export { C as RefreshDeadError,
|
|
262
|
+
export { C as RefreshDeadError, ne as apiFetch, ie as apiFetchBlob, A as beginSessionInPage, ae as callHandler, D as cancelProactiveRefresh, Y as currentPublishedLanguage, ee as endSessionInPage, z as ensureRefresh, H as getPersistentAuthFailureHandler, k as isSignedOutInPage, R as isTransientFailure, $ as parseContentDispositionFilename, te as publishLanguage, J as publishLanguageFor, E as scheduleProactiveRefresh, q as setLanguageReader, V as setPersistentAuthFailureHandler, X as withPublishedLanguage };
|
package/dist-lib/app.js
CHANGED
|
@@ -3,16 +3,16 @@ import { Layout as t } from "./components/layout/Layout.js";
|
|
|
3
3
|
import { SignIn as n } from "./components/pages/auth/SignIn.js";
|
|
4
4
|
import { SignUp as r } from "./components/pages/auth/SignUp.js";
|
|
5
5
|
import { Forgot as i } from "./components/pages/auth/Forgot.js";
|
|
6
|
-
import { Reset as
|
|
7
|
-
import { TwoFA as
|
|
8
|
-
import { OAuthConsent as
|
|
9
|
-
import { SSOCallbackPage as
|
|
10
|
-
import { SSO_RETURN_PATH as
|
|
11
|
-
import { NotFoundPage as
|
|
12
|
-
import { NoScreensPage as
|
|
13
|
-
import { Profile as
|
|
14
|
-
import { TenantParamsPage as
|
|
15
|
-
import { Preferences as
|
|
6
|
+
import { Reset as a } from "./components/pages/auth/Reset.js";
|
|
7
|
+
import { TwoFA as o } from "./components/pages/auth/TwoFA.js";
|
|
8
|
+
import { OAuthConsent as ee } from "./components/pages/auth/OAuthConsent.js";
|
|
9
|
+
import { SSOCallbackPage as te } from "./components/pages/SSOCallbackPage.js";
|
|
10
|
+
import { SSO_RETURN_PATH as ne } from "./api/access-expiry.js";
|
|
11
|
+
import { NotFoundPage as s } from "./components/pages/NotFoundPage.js";
|
|
12
|
+
import { NoScreensPage as c } from "./components/pages/NoScreensPage.js";
|
|
13
|
+
import { Profile as l } from "./components/pages/profile/Profile.js";
|
|
14
|
+
import { TenantParamsPage as u } from "./components/pages/tenant-params/TenantParamsPage.js";
|
|
15
|
+
import { Preferences as re } from "./components/pages/profile/Preferences.js";
|
|
16
16
|
import { AdminCatalogPage as ie } from "./components/pages/AdminCatalogPage.js";
|
|
17
17
|
import { SmartListPage as d } from "./components/pages/SmartListPage.js";
|
|
18
18
|
import { SmartDetailPage as f } from "./components/pages/SmartDetailPage.js";
|
|
@@ -23,37 +23,37 @@ import { usePreferencesStore as g } from "./stores/preferences.js";
|
|
|
23
23
|
import { useSchema as _ } from "./hooks/useSchema.js";
|
|
24
24
|
import { usePublicParams as v } from "./hooks/useParams.js";
|
|
25
25
|
import { useBranding as y } from "./hooks/useBranding.js";
|
|
26
|
-
import { identityProvidersQueryOptions as
|
|
27
|
-
import { useBrandingBreakpoints as
|
|
28
|
-
import { useVersionWatcher as
|
|
29
|
-
import { ConnectionNotice as
|
|
30
|
-
import { shouldRetryQuery as
|
|
31
|
-
import { backoffDelayMs as
|
|
32
|
-
import { ResponsiveModeProvider as
|
|
33
|
-
import { isValidLogoUrl as
|
|
34
|
-
import { useFirstScreenSettledOnInput as
|
|
35
|
-
import { schemaDefaultRoute as
|
|
36
|
-
import { getRegisteredScreen as
|
|
37
|
-
import { CurrentScreenProvider as
|
|
38
|
-
import { setIconRegistry as
|
|
39
|
-
import { applyRetainedReadGcTime as
|
|
40
|
-
import { DEFAULT_PAGE_STATE_TTL_MS as
|
|
41
|
-
import { EmbedProvider as
|
|
42
|
-
import { EmbedAuthBootstrap as
|
|
43
|
-
import { BlankScreen as
|
|
44
|
-
import { CONSUMER_BRAND_CSS_ID as
|
|
45
|
-
import { useEffect as
|
|
46
|
-
import { QueryClient as
|
|
26
|
+
import { identityProvidersQueryOptions as b, setupQueryOptions as ae } from "./hooks/useSignInData.js";
|
|
27
|
+
import { useBrandingBreakpoints as x, useBrandingViewport as S } from "./hooks/useBrandingChrome.js";
|
|
28
|
+
import { useVersionWatcher as C } from "./hooks/useVersionWatcher.js";
|
|
29
|
+
import { ConnectionNotice as w } from "./components/shared/ConnectionNotice.js";
|
|
30
|
+
import { shouldRetryQuery as T } from "./lib/query-retry.js";
|
|
31
|
+
import { backoffDelayMs as E } from "./api/request-bounds.js";
|
|
32
|
+
import { ResponsiveModeProvider as D } from "./hooks/useResponsiveMode.js";
|
|
33
|
+
import { isValidLogoUrl as O } from "./lib/branding.js";
|
|
34
|
+
import { useFirstScreenSettledOnInput as k } from "./lib/capabilityPrefetch.js";
|
|
35
|
+
import { schemaDefaultRoute as A } from "./lib/schema-routing.js";
|
|
36
|
+
import { getRegisteredScreen as j, registerScreen as M } from "./stores/screen-registry.js";
|
|
37
|
+
import { CurrentScreenProvider as N } from "./hooks/useCurrentScreen.js";
|
|
38
|
+
import { setIconRegistry as oe } from "./stores/icon-registry.js";
|
|
39
|
+
import { applyRetainedReadGcTime as P } from "./hooks/usePageStateRuntime.js";
|
|
40
|
+
import { DEFAULT_PAGE_STATE_TTL_MS as F } from "./stores/page-state.js";
|
|
41
|
+
import { EmbedProvider as I, useEmbed as L } from "./embed/EmbedContext.js";
|
|
42
|
+
import { EmbedAuthBootstrap as R } from "./embed/EmbedAuthBootstrap.js";
|
|
43
|
+
import { BlankScreen as z } from "./components/shared/BlankScreen.js";
|
|
44
|
+
import { CONSUMER_BRAND_CSS_ID as B, applyBrandTokens as V, brandTokenCss as H } from "./lib/brand-tokens.js";
|
|
45
|
+
import { useEffect as U, useMemo as W } from "react";
|
|
46
|
+
import { QueryClient as G, QueryClientProvider as K, useQueryClient as se } from "@tanstack/react-query";
|
|
47
47
|
import { Fragment as ce, jsx as q, jsxs as J } from "react/jsx-runtime";
|
|
48
48
|
import { BrowserRouter as le, Navigate as Y, Route as X, Routes as ue, useLocation as de } from "react-router";
|
|
49
49
|
import { Toaster as fe } from "sonner";
|
|
50
|
-
|
|
51
|
-
var Z = "declarion-managed-favicon", Q = new
|
|
50
|
+
M("Profile", l), M("TenantParameters", u);
|
|
51
|
+
var Z = "declarion-managed-favicon", Q = new G({ defaultOptions: { queries: {
|
|
52
52
|
staleTime: 3e5,
|
|
53
|
-
retry:
|
|
54
|
-
retryDelay:
|
|
53
|
+
retry: T,
|
|
54
|
+
retryDelay: E
|
|
55
55
|
} } });
|
|
56
|
-
|
|
56
|
+
P(Q, F);
|
|
57
57
|
function $(e) {
|
|
58
58
|
if (typeof window > "u") return null;
|
|
59
59
|
try {
|
|
@@ -64,12 +64,12 @@ function $(e) {
|
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
function pe({ component: e, screenCode: t }) {
|
|
67
|
-
return
|
|
67
|
+
return k(), /* @__PURE__ */ q(e, { screenCode: t });
|
|
68
68
|
}
|
|
69
69
|
function me() {
|
|
70
70
|
let { data: e } = _();
|
|
71
71
|
return {
|
|
72
|
-
routes:
|
|
72
|
+
routes: W(() => {
|
|
73
73
|
if (!e) return [];
|
|
74
74
|
let t = [];
|
|
75
75
|
for (let [n, r] of Object.entries(e.screens ?? {})) if (r.type === "list") {
|
|
@@ -77,30 +77,30 @@ function me() {
|
|
|
77
77
|
if ((i ? e.entities?.[i] : void 0)?.singleton) continue;
|
|
78
78
|
t.push(/* @__PURE__ */ q(X, {
|
|
79
79
|
path: r.route,
|
|
80
|
-
element: /* @__PURE__ */ q(m, { children: /* @__PURE__ */ q(
|
|
80
|
+
element: /* @__PURE__ */ q(m, { children: /* @__PURE__ */ q(N, {
|
|
81
81
|
code: n,
|
|
82
82
|
children: /* @__PURE__ */ q(d, { screenCode: n })
|
|
83
83
|
}) })
|
|
84
84
|
}, n));
|
|
85
85
|
} else if (r.type === "detail") t.push(/* @__PURE__ */ q(X, {
|
|
86
86
|
path: r.route,
|
|
87
|
-
element: /* @__PURE__ */ q(m, { children: /* @__PURE__ */ q(
|
|
87
|
+
element: /* @__PURE__ */ q(m, { children: /* @__PURE__ */ q(N, {
|
|
88
88
|
code: n,
|
|
89
89
|
children: /* @__PURE__ */ q(f, { screenCode: n })
|
|
90
90
|
}) })
|
|
91
91
|
}, n));
|
|
92
92
|
else if (r.type === "record_list") t.push(/* @__PURE__ */ q(X, {
|
|
93
93
|
path: r.route,
|
|
94
|
-
element: /* @__PURE__ */ q(m, { children: /* @__PURE__ */ q(
|
|
94
|
+
element: /* @__PURE__ */ q(m, { children: /* @__PURE__ */ q(N, {
|
|
95
95
|
code: n,
|
|
96
96
|
children: /* @__PURE__ */ q(p, { screenCode: n })
|
|
97
97
|
}) })
|
|
98
98
|
}, n));
|
|
99
99
|
else if (r.type === "custom") {
|
|
100
|
-
let e = r.component ?
|
|
100
|
+
let e = r.component ? j(r.component) : void 0;
|
|
101
101
|
e && t.push(/* @__PURE__ */ q(X, {
|
|
102
102
|
path: r.route,
|
|
103
|
-
element: /* @__PURE__ */ q(m, { children: /* @__PURE__ */ q(
|
|
103
|
+
element: /* @__PURE__ */ q(m, { children: /* @__PURE__ */ q(N, {
|
|
104
104
|
code: n,
|
|
105
105
|
children: /* @__PURE__ */ q(pe, {
|
|
106
106
|
component: e,
|
|
@@ -111,43 +111,43 @@ function me() {
|
|
|
111
111
|
}
|
|
112
112
|
return t;
|
|
113
113
|
}, [e]),
|
|
114
|
-
defaultRoute:
|
|
114
|
+
defaultRoute: W(() => A(e), [e])
|
|
115
115
|
};
|
|
116
116
|
}
|
|
117
117
|
function he() {
|
|
118
|
-
let
|
|
119
|
-
|
|
118
|
+
let l = h((e) => e.initialize), u = h((e) => e.signedOutPresumed), d = h((e) => e.isAuthenticated), { data: f, isError: p } = _(), m = e(), { data: g, isLoading: x } = v(), { branding: S, isLoading: C } = y(), { routes: w, defaultRoute: T } = me(), E = L(), D = de(), k = se(), A = h((e) => e.isLoading) && !u;
|
|
119
|
+
U(() => {
|
|
120
120
|
document.documentElement.lang = m;
|
|
121
121
|
}, [m]);
|
|
122
|
-
let
|
|
123
|
-
|
|
124
|
-
|
|
122
|
+
let j = typeof window < "u" && window.self !== window.top && !E.enabled;
|
|
123
|
+
U(() => {
|
|
124
|
+
D.pathname !== "/login" || E.enabled || j || A || d || (k.prefetchQuery(ae), k.prefetchQuery(b));
|
|
125
125
|
}, [
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
126
|
+
D.pathname,
|
|
127
|
+
E.enabled,
|
|
128
|
+
j,
|
|
129
|
+
A,
|
|
130
130
|
d,
|
|
131
|
-
|
|
132
|
-
]),
|
|
133
|
-
|
|
131
|
+
k
|
|
132
|
+
]), U(() => {
|
|
133
|
+
E.enabled || j || l();
|
|
134
134
|
}, [
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
135
|
+
E.enabled,
|
|
136
|
+
j,
|
|
137
|
+
l
|
|
138
138
|
]);
|
|
139
|
-
let
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}, [
|
|
143
|
-
let
|
|
144
|
-
|
|
139
|
+
let M = f?.icons;
|
|
140
|
+
U(() => {
|
|
141
|
+
oe(M ?? {});
|
|
142
|
+
}, [M]);
|
|
143
|
+
let N = S?.identity, P = S?.theme;
|
|
144
|
+
U(() => {
|
|
145
145
|
if (typeof document > "u") return;
|
|
146
|
-
let e =
|
|
146
|
+
let e = N?.app_name?.trim();
|
|
147
147
|
e && (document.title = e);
|
|
148
|
-
}, [
|
|
148
|
+
}, [N?.app_name]), U(() => {
|
|
149
149
|
if (typeof document > "u") return;
|
|
150
|
-
let e =
|
|
150
|
+
let e = N?.app_logo, t = O(e) ? $(e.trim()) : null, n = document.getElementById(Z);
|
|
151
151
|
if (!t) n && n.remove();
|
|
152
152
|
else if (n) n.href !== t && (n.href = t);
|
|
153
153
|
else {
|
|
@@ -155,36 +155,36 @@ function he() {
|
|
|
155
155
|
let e = document.createElement("link");
|
|
156
156
|
e.id = Z, e.rel = "icon", e.href = t, document.head.appendChild(e);
|
|
157
157
|
}
|
|
158
|
-
}, [
|
|
159
|
-
let
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}, [
|
|
158
|
+
}, [N?.app_logo]);
|
|
159
|
+
let F = P?.css_url ?? null, I = W(() => H(P), [P]);
|
|
160
|
+
U(() => {
|
|
161
|
+
V(I);
|
|
162
|
+
}, [I]), U(() => {
|
|
163
163
|
if (typeof document > "u") return;
|
|
164
|
-
let e = document.getElementById(
|
|
165
|
-
if (!
|
|
164
|
+
let e = document.getElementById(B);
|
|
165
|
+
if (!F) {
|
|
166
166
|
e && e.remove();
|
|
167
167
|
return;
|
|
168
168
|
}
|
|
169
|
-
let t = $(
|
|
169
|
+
let t = $(F);
|
|
170
170
|
if (!t) {
|
|
171
|
-
e && e.remove(), console.error(`[declarion] branding.theme.css_url rejected: ${
|
|
171
|
+
e && e.remove(), console.error(`[declarion] branding.theme.css_url rejected: ${F}. Only same-origin, relative URLs are allowed (e.g. /modules/crm/public/brand.css).`);
|
|
172
172
|
return;
|
|
173
173
|
}
|
|
174
174
|
if (e && e.href === t) return;
|
|
175
175
|
e && e.remove();
|
|
176
176
|
let n = document.createElement("link");
|
|
177
|
-
n.id =
|
|
178
|
-
}, [
|
|
179
|
-
let
|
|
180
|
-
return
|
|
177
|
+
n.id = B, n.rel = "stylesheet", n.href = t, document.head.appendChild(n);
|
|
178
|
+
}, [F]);
|
|
179
|
+
let R = E.enabled && !d;
|
|
180
|
+
return j || R || A || x && !g || C || !f && (d || !p) ? /* @__PURE__ */ q(z, {}) : /* @__PURE__ */ J(ue, { children: [
|
|
181
181
|
/* @__PURE__ */ q(X, {
|
|
182
182
|
path: "/login",
|
|
183
183
|
element: /* @__PURE__ */ q(n, {})
|
|
184
184
|
}),
|
|
185
185
|
/* @__PURE__ */ q(X, {
|
|
186
|
-
path:
|
|
187
|
-
element: /* @__PURE__ */ q(
|
|
186
|
+
path: ne,
|
|
187
|
+
element: /* @__PURE__ */ q(te, {})
|
|
188
188
|
}),
|
|
189
189
|
/* @__PURE__ */ q(X, {
|
|
190
190
|
path: "/signup",
|
|
@@ -196,40 +196,40 @@ function he() {
|
|
|
196
196
|
}),
|
|
197
197
|
/* @__PURE__ */ q(X, {
|
|
198
198
|
path: "/reset",
|
|
199
|
-
element: /* @__PURE__ */ q(
|
|
199
|
+
element: /* @__PURE__ */ q(a, {})
|
|
200
200
|
}),
|
|
201
201
|
/* @__PURE__ */ q(X, {
|
|
202
202
|
path: "/2fa",
|
|
203
|
-
element: /* @__PURE__ */ q(
|
|
203
|
+
element: /* @__PURE__ */ q(o, {})
|
|
204
204
|
}),
|
|
205
205
|
/* @__PURE__ */ q(X, {
|
|
206
206
|
path: "/oauth/consent",
|
|
207
|
-
element: /* @__PURE__ */ q(
|
|
207
|
+
element: /* @__PURE__ */ q(ee, {})
|
|
208
208
|
}),
|
|
209
209
|
/* @__PURE__ */ J(X, {
|
|
210
210
|
element: /* @__PURE__ */ q(t, {}),
|
|
211
211
|
children: [
|
|
212
|
-
f && !
|
|
212
|
+
f && !T && /* @__PURE__ */ q(X, {
|
|
213
213
|
index: !0,
|
|
214
|
-
element: /* @__PURE__ */ q(
|
|
214
|
+
element: /* @__PURE__ */ q(c, {})
|
|
215
215
|
}),
|
|
216
|
-
|
|
216
|
+
T && /* @__PURE__ */ J(ce, { children: [/* @__PURE__ */ q(X, {
|
|
217
217
|
index: !0,
|
|
218
218
|
element: /* @__PURE__ */ q(Y, {
|
|
219
|
-
to:
|
|
219
|
+
to: T,
|
|
220
220
|
replace: !0
|
|
221
221
|
})
|
|
222
222
|
}), /* @__PURE__ */ q(X, {
|
|
223
223
|
path: "/admin",
|
|
224
224
|
element: /* @__PURE__ */ q(Y, {
|
|
225
|
-
to:
|
|
225
|
+
to: T,
|
|
226
226
|
replace: !0
|
|
227
227
|
})
|
|
228
228
|
})] }),
|
|
229
|
-
|
|
229
|
+
w,
|
|
230
230
|
/* @__PURE__ */ q(X, {
|
|
231
231
|
path: "/preferences",
|
|
232
|
-
element: /* @__PURE__ */ q(
|
|
232
|
+
element: /* @__PURE__ */ q(re, {})
|
|
233
233
|
}),
|
|
234
234
|
/* @__PURE__ */ q(X, {
|
|
235
235
|
path: "/admin/catalog",
|
|
@@ -237,18 +237,18 @@ function he() {
|
|
|
237
237
|
}),
|
|
238
238
|
/* @__PURE__ */ q(X, {
|
|
239
239
|
path: "*",
|
|
240
|
-
element: /* @__PURE__ */ q(
|
|
240
|
+
element: /* @__PURE__ */ q(s, {})
|
|
241
241
|
})
|
|
242
242
|
]
|
|
243
243
|
})
|
|
244
244
|
] });
|
|
245
245
|
}
|
|
246
246
|
function ge() {
|
|
247
|
-
|
|
247
|
+
C();
|
|
248
248
|
let e = g((e) => e.toastPosition);
|
|
249
249
|
return /* @__PURE__ */ J(le, { children: [
|
|
250
|
-
/* @__PURE__ */ q(
|
|
251
|
-
/* @__PURE__ */ q(
|
|
250
|
+
/* @__PURE__ */ q(R, {}),
|
|
251
|
+
/* @__PURE__ */ q(w, {}),
|
|
252
252
|
/* @__PURE__ */ q(he, {}),
|
|
253
253
|
/* @__PURE__ */ q(fe, {
|
|
254
254
|
position: e,
|
|
@@ -266,17 +266,17 @@ function ge() {
|
|
|
266
266
|
] });
|
|
267
267
|
}
|
|
268
268
|
function _e({ children: e }) {
|
|
269
|
-
let t =
|
|
270
|
-
return /* @__PURE__ */ q(
|
|
269
|
+
let t = S(), n = x();
|
|
270
|
+
return /* @__PURE__ */ q(D, {
|
|
271
271
|
viewport: t,
|
|
272
272
|
breakpoints: n,
|
|
273
273
|
children: e
|
|
274
274
|
});
|
|
275
275
|
}
|
|
276
276
|
function ve() {
|
|
277
|
-
return /* @__PURE__ */ q(m, { children: /* @__PURE__ */ q(
|
|
277
|
+
return /* @__PURE__ */ q(m, { children: /* @__PURE__ */ q(K, {
|
|
278
278
|
client: Q,
|
|
279
|
-
children: /* @__PURE__ */ q(
|
|
279
|
+
children: /* @__PURE__ */ q(I, { children: /* @__PURE__ */ q(_e, { children: /* @__PURE__ */ q(ge, {}) }) })
|
|
280
280
|
}) });
|
|
281
281
|
}
|
|
282
282
|
export { ve as App };
|
|
@@ -33,35 +33,36 @@ function m(e) {
|
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
35
|
function h() {
|
|
36
|
-
let r = n((e) => e.isLoading), u = n((e) => e.isAuthenticated), d = n((e) => e.user), f = n((e) => e.activeTenant), h = n((e) => e.identitySince), g = i({
|
|
36
|
+
let r = n((e) => e.isLoading), u = n((e) => e.isAuthenticated), d = n((e) => e.user), f = n((e) => e.activeTenant), h = n((e) => e.identitySince), g = n((e) => e.signedOutPresumed), _ = i({
|
|
37
37
|
isLoading: r,
|
|
38
|
+
signedOutPresumed: g,
|
|
38
39
|
isAuthenticated: u,
|
|
39
40
|
user: d,
|
|
40
41
|
activeTenant: f
|
|
41
|
-
}),
|
|
42
|
+
}), v = n((e) => e.sessionPresumed), y = t().enabled, b = p(s()), x = o({
|
|
42
43
|
queryKey: c,
|
|
43
44
|
queryFn: e,
|
|
44
45
|
staleTime: Infinity,
|
|
45
|
-
enabled:
|
|
46
|
-
}),
|
|
46
|
+
enabled: y ? u : v || g || !r
|
|
47
|
+
}), S = x.data, C = l(S, _), w = !r && S !== void 0 && _ !== void 0 && C === void 0, T = w && S.requestedAt <= h, { refetch: E, isFetching: D } = x, O = w && !T, k = b.rereadFor === h;
|
|
47
48
|
return a(() => {
|
|
48
|
-
|
|
49
|
+
T && !D && b.refetchedFor !== h && (b.refetchedFor = h, E({ cancelRefetch: !1 }));
|
|
49
50
|
}, [
|
|
50
|
-
w,
|
|
51
|
-
E,
|
|
52
51
|
T,
|
|
53
|
-
|
|
52
|
+
D,
|
|
53
|
+
E,
|
|
54
|
+
b,
|
|
54
55
|
h
|
|
55
56
|
]), a(() => {
|
|
56
|
-
|
|
57
|
+
O && !k && m(b);
|
|
57
58
|
}, [
|
|
58
|
-
D,
|
|
59
59
|
O,
|
|
60
|
-
|
|
60
|
+
k,
|
|
61
|
+
b
|
|
61
62
|
]), {
|
|
62
|
-
data:
|
|
63
|
-
isError:
|
|
64
|
-
refetch:
|
|
63
|
+
data: C,
|
|
64
|
+
isError: x.isError || O && k,
|
|
65
|
+
refetch: E
|
|
65
66
|
};
|
|
66
67
|
}
|
|
67
68
|
export { c as SCHEMA_QUERY_KEY, u as cachedSchema, d as schemaAnswerFor, l as schemaFor, i as sessionCaller, h as useSchema };
|
package/dist-lib/stores/auth.js
CHANGED
|
@@ -15,22 +15,27 @@ async function _(t, n, r) {
|
|
|
15
15
|
sessionPresumed: !1,
|
|
16
16
|
identitySince: performance.now()
|
|
17
17
|
});
|
|
18
|
-
if (l())
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
if (l()) {
|
|
19
|
+
i();
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
let a = performance.now();
|
|
23
|
+
try {
|
|
24
|
+
let o = await r();
|
|
25
|
+
if (n().identitySince > a) return;
|
|
21
26
|
if (l()) {
|
|
22
27
|
i();
|
|
23
28
|
return;
|
|
24
29
|
}
|
|
25
|
-
e(), u(
|
|
26
|
-
user:
|
|
30
|
+
e(), u(o.access_expires_at), t({
|
|
31
|
+
user: o,
|
|
27
32
|
isAuthenticated: !0,
|
|
28
33
|
isLoading: !1,
|
|
29
|
-
activeTenant:
|
|
34
|
+
activeTenant: o.tenant ?? null,
|
|
30
35
|
identitySince: performance.now()
|
|
31
36
|
}), n().loadTenants();
|
|
32
37
|
} catch {
|
|
33
|
-
i();
|
|
38
|
+
n().identitySince <= a && i();
|
|
34
39
|
}
|
|
35
40
|
}
|
|
36
41
|
var v = g((e, o) => ({
|
|
@@ -40,10 +45,14 @@ var v = g((e, o) => ({
|
|
|
40
45
|
activeTenant: null,
|
|
41
46
|
tenants: [],
|
|
42
47
|
sessionPresumed: !1,
|
|
48
|
+
signedOutPresumed: !1,
|
|
43
49
|
identitySince: 0,
|
|
44
50
|
initialize: async () => {
|
|
45
51
|
let n = t();
|
|
46
|
-
n === "refresh-first" && (n = await c().then(() => "first-wave", () => "probe-first")), e({
|
|
52
|
+
n === "refresh-first" && (n = await c().then(() => "first-wave", () => "probe-first")), e({
|
|
53
|
+
sessionPresumed: n === "first-wave",
|
|
54
|
+
signedOutPresumed: n === "probe-first" && window.location.pathname === "/login"
|
|
55
|
+
}), n === "first-wave" && m(), await _(e, o, a), n === "probe-first" && o().isAuthenticated && m();
|
|
47
56
|
},
|
|
48
57
|
reloadSession: () => _(e, o, n),
|
|
49
58
|
recheckSession: () => _(e, o, a),
|