@declarion/react 0.40.0 → 0.40.2

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.
@@ -1,4 +1,4 @@
1
- import { Dt as e, Mt as t, Ot as n, Qn as r, bt as i, kt as a, r as o, t as s } from "./useCurrentScreen-mw8TfE8q.js";
1
+ import { $n as e, Dt as t, Mt as n, Ot as r, bt as i, kt as a, r as o, t as s } from "./useCurrentScreen-C33VZcNn.js";
2
2
  import { useState as c } from "react";
3
3
  import { MemoryRouter as l } from "react-router-dom";
4
4
  import { QueryClient as u, QueryClientProvider as d } from "@tanstack/react-query";
@@ -59,7 +59,7 @@ function S() {
59
59
  code: "test",
60
60
  name: "Test",
61
61
  role: "admin"
62
- }, n = {
62
+ }, t = {
63
63
  id: "test-user",
64
64
  email: "test@example.com",
65
65
  display_name: "Test User",
@@ -70,7 +70,7 @@ function S() {
70
70
  created_at: "2026-01-01T00:00:00Z",
71
71
  updated_at: "2026-01-01T00:00:00Z"
72
72
  };
73
- t.getState().setUser(n, e);
73
+ n.getState().setUser(t, e);
74
74
  }
75
75
  function C(e) {
76
76
  if (e === void 0) return { rows: [] };
@@ -85,10 +85,10 @@ function C(e) {
85
85
  }
86
86
  return e;
87
87
  }
88
- function w(t) {
89
- let r = t.entityData ?? {};
88
+ function w(e) {
89
+ let n = e.entityData ?? {};
90
90
  a((e, t) => {
91
- let n = r[e], i = C(n), a = i.meta?.per_page ?? 50, o = i.meta?.total ?? i.rows.length;
91
+ let r = n[e], i = C(r), a = i.meta?.per_page ?? 50, o = i.meta?.total ?? i.rows.length;
92
92
  return t.count === "only" ? {
93
93
  data: [],
94
94
  meta: {
@@ -108,8 +108,8 @@ function w(t) {
108
108
  ...i.refs === void 0 ? {} : { $refs: i.refs }
109
109
  };
110
110
  });
111
- let o = t.entityItems ?? {}, s = t.entityItemResponses ?? {};
112
- n((e, t) => {
111
+ let o = e.entityItems ?? {}, s = e.entityItemResponses ?? {};
112
+ r((e, t) => {
113
113
  let n = typeof t == "string" ? t : i(t), r = s[e]?.[n];
114
114
  if (r instanceof Error) throw r;
115
115
  if (r !== void 0) return r;
@@ -117,49 +117,49 @@ function w(t) {
117
117
  if (a instanceof Error) throw a;
118
118
  return { data: a };
119
119
  });
120
- let c = t.actionResults ?? {};
121
- e(async (e, t) => {
120
+ let c = e.actionResults ?? {};
121
+ t(async (e, t) => {
122
122
  if (!(e in c)) throw Error(`renderWithDeclarion: no action result registered for "${e}" (seed it via actionResults)`);
123
123
  let n = c[e];
124
124
  return x(typeof n == "function" ? await n(t) : n);
125
125
  });
126
126
  }
127
127
  function T() {
128
- a(null), n(null), e(null), t.setState({
128
+ a(null), r(null), t(null), n.setState({
129
129
  user: null,
130
130
  isAuthenticated: !1,
131
131
  activeTenant: null,
132
132
  tenants: []
133
133
  });
134
134
  }
135
- function E(e, t = {}) {
136
- let n = new u({ defaultOptions: { queries: {
135
+ function E(t, n = {}) {
136
+ let r = new u({ defaultOptions: { queries: {
137
137
  retry: !1,
138
138
  gcTime: Infinity
139
139
  } } });
140
- S(), n.setQueryData(["schema", !0], t.schema ?? g()), w(t);
141
- let i = t.screenCode ? /* @__PURE__ */ p(s, {
142
- code: t.screenCode,
143
- children: e
144
- }) : e, a = /* @__PURE__ */ m(d, {
145
- client: n,
140
+ S(), r.setQueryData(["schema", !0], n.schema ?? g()), w(n);
141
+ let i = n.screenCode ? /* @__PURE__ */ p(s, {
142
+ code: n.screenCode,
143
+ children: t
144
+ }) : t, a = /* @__PURE__ */ m(d, {
145
+ client: r,
146
146
  children: [/* @__PURE__ */ p(l, {
147
- initialEntries: [t.route ?? "/"],
147
+ initialEntries: [n.route ?? "/"],
148
148
  children: /* @__PURE__ */ p(o, { children: i })
149
149
  }), /* @__PURE__ */ p(f, {})]
150
- }), c = h(t.viewport ? /* @__PURE__ */ p(r, {
151
- viewportOverride: t.viewport,
150
+ }), c = h(n.viewport ? /* @__PURE__ */ p(e, {
151
+ viewportOverride: n.viewport,
152
152
  children: a
153
153
  }) : a);
154
- return Object.assign(c, { queryClient: n });
154
+ return Object.assign(c, { queryClient: r });
155
155
  }
156
- function D({ children: e, authenticated: n = !0, ...r }) {
156
+ function D({ children: e, authenticated: t = !0, ...r }) {
157
157
  let [i] = c(() => {
158
158
  let e = new u({ defaultOptions: { queries: {
159
159
  retry: !1,
160
160
  gcTime: Infinity
161
161
  } } });
162
- return n ? (S(), e.setQueryData(["schema", !0], r.schema ?? g())) : t.setState({
162
+ return t ? (S(), e.setQueryData(["schema", !0], r.schema ?? g())) : n.setState({
163
163
  user: null,
164
164
  isAuthenticated: !1,
165
165
  activeTenant: null,