@declarion/react 0.177.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/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 ee } from "./components/pages/auth/Reset.js";
7
- import { TwoFA as a } from "./components/pages/auth/TwoFA.js";
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";
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 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";
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
- j("Profile", c), j("TenantParameters", l);
51
- var Z = "declarion-managed-favicon", Q = new W({ defaultOptions: { queries: {
50
+ M("Profile", l), M("TenantParameters", u);
51
+ var Z = "declarion-managed-favicon", Q = new G({ defaultOptions: { queries: {
52
52
  staleTime: 3e5,
53
- retry: w,
54
- retryDelay: T
53
+ retry: T,
54
+ retryDelay: E
55
55
  } } });
56
- N(Q, P);
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 O(), /* @__PURE__ */ q(e, { screenCode: t });
67
+ return k(), /* @__PURE__ */ q(e, { screenCode: t });
68
68
  }
69
69
  function me() {
70
70
  let { data: e } = _();
71
71
  return {
72
- routes: U(() => {
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(M, {
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(M, {
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(M, {
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 ? A(r.component) : void 0;
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(M, {
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: U(() => k(e), [e])
114
+ defaultRoute: W(() => A(e), [e])
115
115
  };
116
116
  }
117
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(() => {
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 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
+ 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
- E.pathname,
127
- T.enabled,
128
- k,
129
- l,
126
+ D.pathname,
127
+ E.enabled,
128
+ j,
129
+ A,
130
130
  d,
131
- O
132
- ]), H(() => {
133
- T.enabled || k || c();
131
+ k
132
+ ]), U(() => {
133
+ E.enabled || j || l();
134
134
  }, [
135
- T.enabled,
136
- k,
137
- c
135
+ E.enabled,
136
+ j,
137
+ l
138
138
  ]);
139
- let A = f?.icons;
140
- H(() => {
141
- se(A ?? {});
142
- }, [A]);
143
- let j = x?.identity, M = x?.theme;
144
- H(() => {
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 = j?.app_name?.trim();
146
+ let e = N?.app_name?.trim();
147
147
  e && (document.title = e);
148
- }, [j?.app_name]), H(() => {
148
+ }, [N?.app_name]), U(() => {
149
149
  if (typeof document > "u") return;
150
- let e = j?.app_logo, t = D(e) ? $(e.trim()) : null, n = document.getElementById(Z);
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
- }, [j?.app_logo]);
159
- let N = M?.css_url ?? null, P = U(() => V(M), [M]);
160
- H(() => {
161
- B(P);
162
- }, [P]), H(() => {
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(z);
165
- if (!N) {
164
+ let e = document.getElementById(B);
165
+ if (!F) {
166
166
  e && e.remove();
167
167
  return;
168
168
  }
169
- let t = $(N);
169
+ let t = $(F);
170
170
  if (!t) {
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).`);
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 = 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: [
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: re,
187
- element: /* @__PURE__ */ q(ne, {})
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(ee, {})
199
+ element: /* @__PURE__ */ q(a, {})
200
200
  }),
201
201
  /* @__PURE__ */ q(X, {
202
202
  path: "/2fa",
203
- element: /* @__PURE__ */ q(a, {})
203
+ element: /* @__PURE__ */ q(o, {})
204
204
  }),
205
205
  /* @__PURE__ */ q(X, {
206
206
  path: "/oauth/consent",
207
- element: /* @__PURE__ */ q(te, {})
207
+ element: /* @__PURE__ */ q(ee, {})
208
208
  }),
209
209
  /* @__PURE__ */ J(X, {
210
210
  element: /* @__PURE__ */ q(t, {}),
211
211
  children: [
212
- f && !w && /* @__PURE__ */ q(X, {
212
+ f && !T && /* @__PURE__ */ q(X, {
213
213
  index: !0,
214
- element: /* @__PURE__ */ q(s, {})
214
+ element: /* @__PURE__ */ q(c, {})
215
215
  }),
216
- w && /* @__PURE__ */ J(ce, { children: [/* @__PURE__ */ q(X, {
216
+ T && /* @__PURE__ */ J(ce, { children: [/* @__PURE__ */ q(X, {
217
217
  index: !0,
218
218
  element: /* @__PURE__ */ q(Y, {
219
- to: w,
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: w,
225
+ to: T,
226
226
  replace: !0
227
227
  })
228
228
  })] }),
229
- C,
229
+ w,
230
230
  /* @__PURE__ */ q(X, {
231
231
  path: "/preferences",
232
- element: /* @__PURE__ */ q(u, {})
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(o, {})
240
+ element: /* @__PURE__ */ q(s, {})
241
241
  })
242
242
  ]
243
243
  })
244
244
  ] });
245
245
  }
246
246
  function ge() {
247
- S();
247
+ C();
248
248
  let e = g((e) => e.toastPosition);
249
249
  return /* @__PURE__ */ J(le, { children: [
250
- /* @__PURE__ */ q(L, {}),
251
- /* @__PURE__ */ q(C, {}),
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 = x(), n = b();
270
- return /* @__PURE__ */ q(E, {
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(G, {
277
+ return /* @__PURE__ */ q(m, { children: /* @__PURE__ */ q(K, {
278
278
  client: Q,
279
- children: /* @__PURE__ */ q(F, { children: /* @__PURE__ */ q(_e, { children: /* @__PURE__ */ q(ge, {}) }) })
279
+ children: /* @__PURE__ */ q(I, { children: /* @__PURE__ */ q(_e, { children: /* @__PURE__ */ q(ge, {}) }) })
280
280
  }) });
281
281
  }
282
282
  export { ve as App };