@declarion/react 0.153.0 → 0.162.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/app.js CHANGED
@@ -5,53 +5,56 @@ import { SignUp as r } from "./components/pages/auth/SignUp.js";
5
5
  import { Forgot as i } from "./components/pages/auth/Forgot.js";
6
6
  import { Reset as ee } from "./components/pages/auth/Reset.js";
7
7
  import { TwoFA as a } from "./components/pages/auth/TwoFA.js";
8
- import { SSOCallbackPage as te } from "./components/pages/SSOCallbackPage.js";
9
- import { NotFoundPage as ne } from "./components/pages/NotFoundPage.js";
10
- import { NoScreensPage as re } from "./components/pages/NoScreensPage.js";
11
- import { Profile as o } from "./components/pages/profile/Profile.js";
12
- import { TenantParamsPage as s } from "./components/pages/tenant-params/TenantParamsPage.js";
13
- import { Preferences as c } from "./components/pages/profile/Preferences.js";
14
- import { AdminCatalogPage as l } from "./components/pages/AdminCatalogPage.js";
15
- import { SmartListPage as u } from "./components/pages/SmartListPage.js";
16
- import { SmartDetailPage as d } from "./components/pages/SmartDetailPage.js";
17
- import { SmartRecordListPage as f } from "./components/pages/SmartRecordListPage.js";
18
- import { ErrorBoundary as p } from "./components/shared/ErrorBoundary.js";
19
- import { useAuthStore as m } from "./stores/auth.js";
20
- import { usePreferencesStore as h } from "./stores/preferences.js";
21
- import { useSchema as g } from "./hooks/useSchema.js";
22
- import { usePublicParams as _ } from "./hooks/useParams.js";
23
- import { useBranding as ie } from "./hooks/useBranding.js";
24
- import { useBrandingBreakpoints as v, useBrandingViewport as y } from "./hooks/useBrandingChrome.js";
25
- import { useVersionWatcher as b } from "./hooks/useVersionWatcher.js";
26
- import { ConnectionNotice as x } from "./components/shared/ConnectionNotice.js";
27
- import { shouldRetryQuery as S } from "./lib/query-retry.js";
28
- import { backoffDelayMs as C } from "./api/request-bounds.js";
29
- import { ResponsiveModeProvider as w } from "./hooks/useResponsiveMode.js";
30
- import { isValidLogoUrl as T } from "./lib/branding.js";
31
- import { useFirstScreenSettledOnInput as E } from "./lib/capabilityPrefetch.js";
32
- import { schemaDefaultRoute as D } from "./lib/schema-routing.js";
33
- import { getRegisteredScreen as O, registerScreen as k } from "./stores/screen-registry.js";
34
- import { CurrentScreenProvider as A } from "./hooks/useCurrentScreen.js";
35
- import { setIconRegistry as ae } from "./stores/icon-registry.js";
36
- import { applyRetainedReadGcTime as j } from "./hooks/usePageStateRuntime.js";
37
- import { DEFAULT_PAGE_STATE_TTL_MS as M } from "./stores/page-state.js";
38
- import { EmbedProvider as N, useEmbed as P } from "./embed/EmbedContext.js";
39
- import { EmbedAuthBootstrap as F } from "./embed/EmbedAuthBootstrap.js";
40
- import { BlankScreen as I } from "./components/shared/BlankScreen.js";
41
- import { CONSUMER_BRAND_CSS_ID as L, applyBrandTokens as R, brandTokenCss as z } from "./lib/brand-tokens.js";
42
- import { useEffect as B, useMemo as V } from "react";
43
- import { QueryClient as H, QueryClientProvider as U } from "@tanstack/react-query";
44
- import { Fragment as W, jsx as G, jsxs as K } from "react/jsx-runtime";
45
- import { BrowserRouter as q, Navigate as J, Route as Y, Routes as oe } from "react-router";
46
- import { Toaster as se } from "sonner";
47
- k("Profile", o), k("TenantParameters", s);
48
- var X = "declarion-managed-favicon", Z = new H({ defaultOptions: { queries: {
8
+ import { OAuthConsent as te } from "./components/pages/auth/OAuthConsent.js";
9
+ import { SSOCallbackPage as ne } from "./components/pages/SSOCallbackPage.js";
10
+ import { SSO_RETURN_PATH as re } from "./api/access-expiry.js";
11
+ import { NotFoundPage as o } from "./components/pages/NotFoundPage.js";
12
+ import { NoScreensPage as s } from "./components/pages/NoScreensPage.js";
13
+ import { Profile as c } from "./components/pages/profile/Profile.js";
14
+ import { TenantParamsPage as l } from "./components/pages/tenant-params/TenantParamsPage.js";
15
+ import { Preferences as u } from "./components/pages/profile/Preferences.js";
16
+ import { AdminCatalogPage as ie } from "./components/pages/AdminCatalogPage.js";
17
+ import { SmartListPage as d } from "./components/pages/SmartListPage.js";
18
+ import { SmartDetailPage as f } from "./components/pages/SmartDetailPage.js";
19
+ import { SmartRecordListPage as p } from "./components/pages/SmartRecordListPage.js";
20
+ import { ErrorBoundary as m } from "./components/shared/ErrorBoundary.js";
21
+ import { useAuthStore as h } from "./stores/auth.js";
22
+ import { usePreferencesStore as g } from "./stores/preferences.js";
23
+ import { useSchema as _ } from "./hooks/useSchema.js";
24
+ import { usePublicParams as v } from "./hooks/useParams.js";
25
+ import { useBranding as y } from "./hooks/useBranding.js";
26
+ import { identityProvidersQueryOptions as ae, setupQueryOptions as oe } from "./hooks/useSignInData.js";
27
+ import { useBrandingBreakpoints as b, useBrandingViewport as x } from "./hooks/useBrandingChrome.js";
28
+ import { useVersionWatcher as S } from "./hooks/useVersionWatcher.js";
29
+ import { ConnectionNotice as C } from "./components/shared/ConnectionNotice.js";
30
+ import { shouldRetryQuery as w } from "./lib/query-retry.js";
31
+ import { backoffDelayMs as T } from "./api/request-bounds.js";
32
+ import { ResponsiveModeProvider as E } from "./hooks/useResponsiveMode.js";
33
+ import { isValidLogoUrl as D } from "./lib/branding.js";
34
+ import { useFirstScreenSettledOnInput as O } from "./lib/capabilityPrefetch.js";
35
+ import { schemaDefaultRoute as k } from "./lib/schema-routing.js";
36
+ import { getRegisteredScreen as A, registerScreen as j } from "./stores/screen-registry.js";
37
+ import { CurrentScreenProvider as M } from "./hooks/useCurrentScreen.js";
38
+ import { setIconRegistry as se } from "./stores/icon-registry.js";
39
+ import { applyRetainedReadGcTime as N } from "./hooks/usePageStateRuntime.js";
40
+ import { DEFAULT_PAGE_STATE_TTL_MS as P } from "./stores/page-state.js";
41
+ import { EmbedProvider as F, useEmbed as I } from "./embed/EmbedContext.js";
42
+ import { EmbedAuthBootstrap as L } from "./embed/EmbedAuthBootstrap.js";
43
+ import { BlankScreen as R } from "./components/shared/BlankScreen.js";
44
+ import { CONSUMER_BRAND_CSS_ID as z, applyBrandTokens as B, brandTokenCss as V } from "./lib/brand-tokens.js";
45
+ import { useEffect as H, useMemo as U } from "react";
46
+ import { QueryClient as W, QueryClientProvider as G, useQueryClient as K } from "@tanstack/react-query";
47
+ import { Fragment as ce, jsx as q, jsxs as J } from "react/jsx-runtime";
48
+ import { BrowserRouter as le, Navigate as Y, Route as X, Routes as ue, useLocation as de } from "react-router";
49
+ import { Toaster as fe } from "sonner";
50
+ j("Profile", c), j("TenantParameters", l);
51
+ var Z = "declarion-managed-favicon", Q = new W({ defaultOptions: { queries: {
49
52
  staleTime: 3e5,
50
- retry: S,
51
- retryDelay: C
53
+ retry: w,
54
+ retryDelay: T
52
55
  } } });
53
- j(Z, M);
54
- function Q(e) {
56
+ N(Q, P);
57
+ function $(e) {
55
58
  if (typeof window > "u") return null;
56
59
  try {
57
60
  let t = new URL(e, window.location.origin);
@@ -60,46 +63,46 @@ function Q(e) {
60
63
  return null;
61
64
  }
62
65
  }
63
- function ce({ component: e, screenCode: t }) {
64
- return E(), /* @__PURE__ */ G(e, { screenCode: t });
66
+ function pe({ component: e, screenCode: t }) {
67
+ return O(), /* @__PURE__ */ q(e, { screenCode: t });
65
68
  }
66
- function le() {
67
- let { data: e } = g();
69
+ function me() {
70
+ let { data: e } = _();
68
71
  return {
69
- routes: V(() => {
72
+ routes: U(() => {
70
73
  if (!e) return [];
71
74
  let t = [];
72
75
  for (let [n, r] of Object.entries(e.screens ?? {})) if (r.type === "list") {
73
76
  let i = r.entity;
74
77
  if ((i ? e.entities?.[i] : void 0)?.singleton) continue;
75
- t.push(/* @__PURE__ */ G(Y, {
78
+ t.push(/* @__PURE__ */ q(X, {
76
79
  path: r.route,
77
- element: /* @__PURE__ */ G(p, { children: /* @__PURE__ */ G(A, {
80
+ element: /* @__PURE__ */ q(m, { children: /* @__PURE__ */ q(M, {
78
81
  code: n,
79
- children: /* @__PURE__ */ G(u, { screenCode: n })
82
+ children: /* @__PURE__ */ q(d, { screenCode: n })
80
83
  }) })
81
84
  }, n));
82
- } else if (r.type === "detail") t.push(/* @__PURE__ */ G(Y, {
85
+ } else if (r.type === "detail") t.push(/* @__PURE__ */ q(X, {
83
86
  path: r.route,
84
- element: /* @__PURE__ */ G(p, { children: /* @__PURE__ */ G(A, {
87
+ element: /* @__PURE__ */ q(m, { children: /* @__PURE__ */ q(M, {
85
88
  code: n,
86
- children: /* @__PURE__ */ G(d, { screenCode: n })
89
+ children: /* @__PURE__ */ q(f, { screenCode: n })
87
90
  }) })
88
91
  }, n));
89
- else if (r.type === "record_list") t.push(/* @__PURE__ */ G(Y, {
92
+ else if (r.type === "record_list") t.push(/* @__PURE__ */ q(X, {
90
93
  path: r.route,
91
- element: /* @__PURE__ */ G(p, { children: /* @__PURE__ */ G(A, {
94
+ element: /* @__PURE__ */ q(m, { children: /* @__PURE__ */ q(M, {
92
95
  code: n,
93
- children: /* @__PURE__ */ G(f, { screenCode: n })
96
+ children: /* @__PURE__ */ q(p, { screenCode: n })
94
97
  }) })
95
98
  }, n));
96
99
  else if (r.type === "custom") {
97
- let e = r.component ? O(r.component) : void 0;
98
- e && t.push(/* @__PURE__ */ G(Y, {
100
+ let e = r.component ? A(r.component) : void 0;
101
+ e && t.push(/* @__PURE__ */ q(X, {
99
102
  path: r.route,
100
- element: /* @__PURE__ */ G(p, { children: /* @__PURE__ */ G(A, {
103
+ element: /* @__PURE__ */ q(m, { children: /* @__PURE__ */ q(M, {
101
104
  code: n,
102
- children: /* @__PURE__ */ G(ce, {
105
+ children: /* @__PURE__ */ q(pe, {
103
106
  component: e,
104
107
  screenCode: n
105
108
  })
@@ -108,133 +111,146 @@ function le() {
108
111
  }
109
112
  return t;
110
113
  }, [e]),
111
- defaultRoute: V(() => D(e), [e])
114
+ defaultRoute: U(() => k(e), [e])
112
115
  };
113
116
  }
114
- function $() {
115
- let o = m((e) => e.initialize), s = m((e) => e.isLoading), u = m((e) => e.isAuthenticated), { data: d, isError: f } = g(), p = e(), { data: h, isLoading: v } = _(), { branding: y, isLoading: b } = ie(), { routes: x, defaultRoute: S } = le(), C = P();
116
- B(() => {
117
- document.documentElement.lang = p;
118
- }, [p]);
119
- let w = typeof window < "u" && window.self !== window.top && !C.enabled;
120
- B(() => {
121
- C.enabled || w || o();
117
+ function he() {
118
+ let c = h((e) => e.initialize), l = h((e) => e.isLoading), d = h((e) => e.isAuthenticated), { data: f, isError: p } = _(), m = e(), { data: g, isLoading: b } = v(), { branding: x, isLoading: S } = y(), { routes: C, defaultRoute: w } = me(), T = I(), E = de(), O = K();
119
+ H(() => {
120
+ document.documentElement.lang = m;
121
+ }, [m]);
122
+ let k = typeof window < "u" && window.self !== window.top && !T.enabled;
123
+ H(() => {
124
+ E.pathname !== "/login" || T.enabled || k || l || d || (O.prefetchQuery(oe), O.prefetchQuery(ae));
122
125
  }, [
123
- C.enabled,
124
- w,
125
- o
126
+ E.pathname,
127
+ T.enabled,
128
+ k,
129
+ l,
130
+ d,
131
+ O
132
+ ]), H(() => {
133
+ T.enabled || k || c();
134
+ }, [
135
+ T.enabled,
136
+ k,
137
+ c
126
138
  ]);
127
- let E = d?.icons;
128
- B(() => {
129
- ae(E ?? {});
130
- }, [E]);
131
- let D = y?.identity, O = y?.theme;
132
- B(() => {
139
+ let A = f?.icons;
140
+ H(() => {
141
+ se(A ?? {});
142
+ }, [A]);
143
+ let j = x?.identity, M = x?.theme;
144
+ H(() => {
133
145
  if (typeof document > "u") return;
134
- let e = D?.app_name?.trim();
146
+ let e = j?.app_name?.trim();
135
147
  e && (document.title = e);
136
- }, [D?.app_name]), B(() => {
148
+ }, [j?.app_name]), H(() => {
137
149
  if (typeof document > "u") return;
138
- let e = D?.app_logo, t = T(e) ? Q(e.trim()) : null, n = document.getElementById(X);
150
+ let e = j?.app_logo, t = D(e) ? $(e.trim()) : null, n = document.getElementById(Z);
139
151
  if (!t) n && n.remove();
140
152
  else if (n) n.href !== t && (n.href = t);
141
153
  else {
142
154
  document.querySelectorAll("link[rel=\"icon\"], link[rel=\"shortcut icon\"]").forEach((e) => e.remove());
143
155
  let e = document.createElement("link");
144
- e.id = X, e.rel = "icon", e.href = t, document.head.appendChild(e);
156
+ e.id = Z, e.rel = "icon", e.href = t, document.head.appendChild(e);
145
157
  }
146
- }, [D?.app_logo]);
147
- let k = O?.css_url ?? null, A = V(() => z(O), [O]);
148
- B(() => {
149
- R(A);
150
- }, [A]), B(() => {
158
+ }, [j?.app_logo]);
159
+ let N = M?.css_url ?? null, P = U(() => V(M), [M]);
160
+ H(() => {
161
+ B(P);
162
+ }, [P]), H(() => {
151
163
  if (typeof document > "u") return;
152
- let e = document.getElementById(L);
153
- if (!k) {
164
+ let e = document.getElementById(z);
165
+ if (!N) {
154
166
  e && e.remove();
155
167
  return;
156
168
  }
157
- let t = Q(k);
169
+ let t = $(N);
158
170
  if (!t) {
159
- e && e.remove(), console.error(`[declarion] branding.theme.css_url rejected: ${k}. Only same-origin, relative URLs are allowed (e.g. /modules/crm/public/brand.css).`);
171
+ e && e.remove(), console.error(`[declarion] branding.theme.css_url rejected: ${N}. Only same-origin, relative URLs are allowed (e.g. /modules/crm/public/brand.css).`);
160
172
  return;
161
173
  }
162
174
  if (e && e.href === t) return;
163
175
  e && e.remove();
164
176
  let n = document.createElement("link");
165
- n.id = L, n.rel = "stylesheet", n.href = t, document.head.appendChild(n);
166
- }, [k]);
167
- let j = C.enabled && !u;
168
- return w || j || s || v && !h || b || !d && (u || !f) ? /* @__PURE__ */ G(I, {}) : /* @__PURE__ */ K(oe, { children: [
169
- /* @__PURE__ */ G(Y, {
177
+ n.id = z, n.rel = "stylesheet", n.href = t, document.head.appendChild(n);
178
+ }, [N]);
179
+ let F = T.enabled && !d;
180
+ return k || F || l || b && !g || S || !f && (d || !p) ? /* @__PURE__ */ q(R, {}) : /* @__PURE__ */ J(ue, { children: [
181
+ /* @__PURE__ */ q(X, {
170
182
  path: "/login",
171
- element: /* @__PURE__ */ G(n, {})
183
+ element: /* @__PURE__ */ q(n, {})
172
184
  }),
173
- /* @__PURE__ */ G(Y, {
174
- path: "/login/sso-callback",
175
- element: /* @__PURE__ */ G(te, {})
185
+ /* @__PURE__ */ q(X, {
186
+ path: re,
187
+ element: /* @__PURE__ */ q(ne, {})
176
188
  }),
177
- /* @__PURE__ */ G(Y, {
189
+ /* @__PURE__ */ q(X, {
178
190
  path: "/signup",
179
- element: /* @__PURE__ */ G(r, {})
191
+ element: /* @__PURE__ */ q(r, {})
180
192
  }),
181
- /* @__PURE__ */ G(Y, {
193
+ /* @__PURE__ */ q(X, {
182
194
  path: "/forgot",
183
- element: /* @__PURE__ */ G(i, {})
195
+ element: /* @__PURE__ */ q(i, {})
184
196
  }),
185
- /* @__PURE__ */ G(Y, {
197
+ /* @__PURE__ */ q(X, {
186
198
  path: "/reset",
187
- element: /* @__PURE__ */ G(ee, {})
199
+ element: /* @__PURE__ */ q(ee, {})
188
200
  }),
189
- /* @__PURE__ */ G(Y, {
201
+ /* @__PURE__ */ q(X, {
190
202
  path: "/2fa",
191
- element: /* @__PURE__ */ G(a, {})
203
+ element: /* @__PURE__ */ q(a, {})
204
+ }),
205
+ /* @__PURE__ */ q(X, {
206
+ path: "/oauth/consent",
207
+ element: /* @__PURE__ */ q(te, {})
192
208
  }),
193
- /* @__PURE__ */ K(Y, {
194
- element: /* @__PURE__ */ G(t, {}),
209
+ /* @__PURE__ */ J(X, {
210
+ element: /* @__PURE__ */ q(t, {}),
195
211
  children: [
196
- d && !S && /* @__PURE__ */ G(Y, {
212
+ f && !w && /* @__PURE__ */ q(X, {
197
213
  index: !0,
198
- element: /* @__PURE__ */ G(re, {})
214
+ element: /* @__PURE__ */ q(s, {})
199
215
  }),
200
- S && /* @__PURE__ */ K(W, { children: [/* @__PURE__ */ G(Y, {
216
+ w && /* @__PURE__ */ J(ce, { children: [/* @__PURE__ */ q(X, {
201
217
  index: !0,
202
- element: /* @__PURE__ */ G(J, {
203
- to: S,
218
+ element: /* @__PURE__ */ q(Y, {
219
+ to: w,
204
220
  replace: !0
205
221
  })
206
- }), /* @__PURE__ */ G(Y, {
222
+ }), /* @__PURE__ */ q(X, {
207
223
  path: "/admin",
208
- element: /* @__PURE__ */ G(J, {
209
- to: S,
224
+ element: /* @__PURE__ */ q(Y, {
225
+ to: w,
210
226
  replace: !0
211
227
  })
212
228
  })] }),
213
- x,
214
- /* @__PURE__ */ G(Y, {
229
+ C,
230
+ /* @__PURE__ */ q(X, {
215
231
  path: "/preferences",
216
- element: /* @__PURE__ */ G(c, {})
232
+ element: /* @__PURE__ */ q(u, {})
217
233
  }),
218
- /* @__PURE__ */ G(Y, {
234
+ /* @__PURE__ */ q(X, {
219
235
  path: "/admin/catalog",
220
- element: /* @__PURE__ */ G(l, {})
236
+ element: /* @__PURE__ */ q(ie, {})
221
237
  }),
222
- /* @__PURE__ */ G(Y, {
238
+ /* @__PURE__ */ q(X, {
223
239
  path: "*",
224
- element: /* @__PURE__ */ G(ne, {})
240
+ element: /* @__PURE__ */ q(o, {})
225
241
  })
226
242
  ]
227
243
  })
228
244
  ] });
229
245
  }
230
- function ue() {
231
- b();
232
- let e = h((e) => e.toastPosition);
233
- return /* @__PURE__ */ K(q, { children: [
234
- /* @__PURE__ */ G(F, {}),
235
- /* @__PURE__ */ G(x, {}),
236
- /* @__PURE__ */ G($, {}),
237
- /* @__PURE__ */ G(se, {
246
+ function ge() {
247
+ S();
248
+ let e = g((e) => e.toastPosition);
249
+ return /* @__PURE__ */ J(le, { children: [
250
+ /* @__PURE__ */ q(L, {}),
251
+ /* @__PURE__ */ q(C, {}),
252
+ /* @__PURE__ */ q(he, {}),
253
+ /* @__PURE__ */ q(fe, {
238
254
  position: e,
239
255
  toastOptions: { unstyled: !0 },
240
256
  expand: !0,
@@ -249,18 +265,18 @@ function ue() {
249
265
  })
250
266
  ] });
251
267
  }
252
- function de({ children: e }) {
253
- let t = y(), n = v();
254
- return /* @__PURE__ */ G(w, {
268
+ function _e({ children: e }) {
269
+ let t = x(), n = b();
270
+ return /* @__PURE__ */ q(E, {
255
271
  viewport: t,
256
272
  breakpoints: n,
257
273
  children: e
258
274
  });
259
275
  }
260
- function fe() {
261
- return /* @__PURE__ */ G(p, { children: /* @__PURE__ */ G(U, {
262
- client: Z,
263
- children: /* @__PURE__ */ G(N, { children: /* @__PURE__ */ G(de, { children: /* @__PURE__ */ G(ue, {}) }) })
276
+ function ve() {
277
+ return /* @__PURE__ */ q(m, { children: /* @__PURE__ */ q(G, {
278
+ client: Q,
279
+ children: /* @__PURE__ */ q(F, { children: /* @__PURE__ */ q(_e, { children: /* @__PURE__ */ q(ge, {}) }) })
264
280
  }) });
265
281
  }
266
- export { fe as App };
282
+ export { ve as App };