@declarion/react 0.106.0 → 0.109.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.
Files changed (34) hide show
  1. package/dist-lib/api/agents.js +8 -7
  2. package/dist-lib/api/client.js +48 -49
  3. package/dist-lib/components/agents/AgentChatPanel.impl.js +362 -301
  4. package/dist-lib/components/agents/ChatAttachments.js +144 -0
  5. package/dist-lib/components/agents/transcript-runs.js +1 -1
  6. package/dist-lib/components/chrome/AssociationTabs.js +89 -75
  7. package/dist-lib/components/detail-layout/AssociatedBlock.js +243 -235
  8. package/dist-lib/components/detail-layout/ChildrenCards.js +57 -55
  9. package/dist-lib/components/detail-layout/ChildrenList.js +45 -43
  10. package/dist-lib/components/detail-layout/ChildrenTable.js +93 -91
  11. package/dist-lib/components/detail-layout/ChildrenTimeline.js +160 -155
  12. package/dist-lib/components/detail-layout/widgets/EntityScorecardWidget.js +127 -121
  13. package/dist-lib/components/fields/RefCombobox.js +53 -48
  14. package/dist-lib/components/fields/index.js +1 -0
  15. package/dist-lib/components/file-widgets/useFileSelection.js +152 -0
  16. package/dist-lib/components/pages/SmartDetailPage.impl.js +506 -482
  17. package/dist-lib/components/pages/SmartRecordListPage.impl.js +335 -300
  18. package/dist-lib/components/pages/tenant-params/TenantParamsPage.impl.js +112 -109
  19. package/dist-lib/components/params/ParamsBlock.js +18 -15
  20. package/dist-lib/components/params/param-editors.js +60 -54
  21. package/dist-lib/components/primitives/RetryButton.js +14 -0
  22. package/dist-lib/components/primitives/StatTile.js +42 -34
  23. package/dist-lib/hooks/useAgentConversation.js +18 -13
  24. package/dist-lib/hooks/useParams.js +54 -52
  25. package/dist-lib/hooks/useSchema.js +5 -2
  26. package/dist-lib/hooks/useTimelineData.js +26 -24
  27. package/dist-lib/index.d.ts +89 -5
  28. package/dist-lib/index.js +95 -93
  29. package/dist-lib/lib/read-display-state.js +19 -0
  30. package/dist-lib/stores/auth.js +1 -0
  31. package/dist-lib/testing.d.ts +1 -1
  32. package/dist-lib/types/fieldType.js +1 -1
  33. package/dist-lib/{useResponsiveMode-ECv1AEhv.d.ts → useResponsiveMode-DODbtSrY.d.ts} +3 -0
  34. package/package.json +1 -1
@@ -3,16 +3,17 @@ import { useSchema as t } from "../../hooks/useSchema.js";
3
3
  import { Icon as n } from "../primitives/Icons.js";
4
4
  import { Btn as r } from "../primitives/Btn.js";
5
5
  import { useText as i } from "../../hooks/useText.js";
6
- import { Spinner as a } from "../primitives/Spinner.js";
7
- import { FieldLabel as o } from "../primitives/Fields.js";
8
- import { ModalFrame as s } from "../shared/ModalFrame.js";
9
- import { ConfirmDialog as c } from "../shared/ConfirmDialog.js";
10
- import { renderField as l } from "../fields/index.js";
11
- import { refLabel as u, useRefRecords as d } from "../../hooks/useRefRecords.js";
12
- import { useState as f } from "react";
13
- import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
6
+ import { RetryButton as a } from "../primitives/RetryButton.js";
7
+ import { Spinner as o } from "../primitives/Spinner.js";
8
+ import { FieldLabel as s } from "../primitives/Fields.js";
9
+ import { ModalFrame as c } from "../shared/ModalFrame.js";
10
+ import { ConfirmDialog as l } from "../shared/ConfirmDialog.js";
11
+ import { renderField as u } from "../fields/index.js";
12
+ import { refLabel as d, useRefRecords as f } from "../../hooks/useRefRecords.js";
13
+ import { useState as p } from "react";
14
+ import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
14
15
  //#region src/components/params/param-editors.tsx
15
- var g = {
16
+ var _ = {
16
17
  object: ["params.source.object", "Record"],
17
18
  user: ["params.source.user", "User"],
18
19
  role: ["params.source.role", "Role"],
@@ -21,19 +22,19 @@ var g = {
21
22
  yaml: ["params.source.yaml", "Default"],
22
23
  none: ["params.source.none", "Not set"]
23
24
  };
24
- function _(e, t) {
25
- let n = g[t];
25
+ function v(e, t) {
26
+ let n = _[t];
26
27
  return n ? e(n[0], n[1]) : t;
27
28
  }
28
- var v = n["undo-2"];
29
- function y({ param: e, description: t, onReset: n }) {
30
- let a = i(), [o, s] = f(!1);
31
- return /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m(r, {
29
+ var y = n["undo-2"];
30
+ function b({ param: e, description: t, onReset: n }) {
31
+ let a = i(), [o, s] = p(!1);
32
+ return /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h(r, {
32
33
  size: "xs",
33
- icon: /* @__PURE__ */ m(v, { size: 12 }),
34
+ icon: /* @__PURE__ */ h(y, { size: 12 }),
34
35
  onClick: () => s(!0),
35
36
  children: a("params.reset", "Reset to default")
36
- }), /* @__PURE__ */ m(c, {
37
+ }), /* @__PURE__ */ h(l, {
37
38
  open: o,
38
39
  onOpenChange: s,
39
40
  title: a("params.reset_confirm.title", "Reset {name} to default?", { name: a(e.name) || e.code }),
@@ -42,8 +43,8 @@ function y({ param: e, description: t, onReset: n }) {
42
43
  onConfirm: () => n(e)
43
44
  })] });
44
45
  }
45
- function b({ text: e }) {
46
- return /* @__PURE__ */ h("div", {
46
+ function x({ text: e, onRetry: t }) {
47
+ return /* @__PURE__ */ g("div", {
47
48
  style: {
48
49
  padding: "8px 10px",
49
50
  background: "var(--danger-soft)",
@@ -51,24 +52,29 @@ function b({ text: e }) {
51
52
  fontSize: 11.5,
52
53
  color: "var(--danger)",
53
54
  display: "flex",
54
- gap: 6
55
+ gap: 6,
56
+ alignItems: "center"
55
57
  },
56
- children: [/* @__PURE__ */ m(n.info, { size: 13 }), /* @__PURE__ */ m("span", { children: e })]
58
+ children: [
59
+ /* @__PURE__ */ h(n.info, { size: 13 }),
60
+ /* @__PURE__ */ h("span", { children: e }),
61
+ t && /* @__PURE__ */ h(a, { onRetry: t })
62
+ ]
57
63
  });
58
64
  }
59
- function x(e) {
65
+ function S(e) {
60
66
  let n = i(), { data: r } = t(), a = e.flatMap((e) => e.ref?.entity && e.value != null && e.value !== "" ? [{
61
67
  ref: e.ref,
62
68
  value: e.value
63
- }] : []), { refs: o } = d(a, void 0, r?.entities);
64
- return (e) => e.ref?.entity ? u(n, o, e.ref, e.value, r?.entities) : void 0;
69
+ }] : []), { refs: o } = f(a, void 0, r?.entities);
70
+ return (e) => e.ref?.entity ? d(n, o, e.ref, e.value, r?.entities) : void 0;
65
71
  }
66
- function S({ type: t, value: n, values: r, label: a, maxWidth: o = 180 }) {
72
+ function C({ type: t, value: n, values: r, label: a, maxWidth: o = 180 }) {
67
73
  let s = i(), c = (t) => {
68
74
  let n = r?.find((e) => e.code === t);
69
75
  return n && s(n.name) || e(t);
70
76
  }, l;
71
- return l = a === void 0 ? n == null ? "—" : r && r.length > 0 ? (Array.isArray(n) ? n.map(c).join(", ") : c(n)) || "—" : t === "bool" ? n ? s("params.value.on", "On") : s("params.value.off", "Off") : t === "multilang" || t === "multilang_text" ? s(n) || "—" : t === "multilang_array" && Array.isArray(n) ? n.map((e) => s(e)).join(", ") || "—" : t === "json" || t === "structure" ? Array.isArray(n) ? `[${n.map((t) => t && typeof t == "object" ? "{…}" : e(t)).join(", ")}]` : n && typeof n == "object" ? `{${Object.keys(n).join(", ")}}` : e(n) : e(n) : a, /* @__PURE__ */ m("span", {
77
+ return l = a === void 0 ? n == null ? "—" : r && r.length > 0 ? (Array.isArray(n) ? n.map(c).join(", ") : c(n)) || "—" : t === "bool" ? n ? s("params.value.on", "On") : s("params.value.off", "Off") : t === "multilang" || t === "multilang_text" ? s(n) || "—" : t === "multilang_array" && Array.isArray(n) ? n.map((e) => s(e)).join(", ") || "—" : t === "json" || t === "structure" ? Array.isArray(n) ? `[${n.map((t) => t && typeof t == "object" ? "{…}" : e(t)).join(", ")}]` : n && typeof n == "object" ? `{${Object.keys(n).join(", ")}}` : e(n) : e(n) : a, /* @__PURE__ */ h("span", {
72
78
  className: "mono",
73
79
  title: l,
74
80
  style: {
@@ -84,15 +90,15 @@ function S({ type: t, value: n, values: r, label: a, maxWidth: o = 180 }) {
84
90
  children: l
85
91
  });
86
92
  }
87
- function C({ param: e, current: t, error: c, onCancel: l, onSave: u }) {
88
- let d = i(), [p, g] = f(() => T(e, t)), [_, v] = f(!1), [y, x] = f(null);
93
+ function w({ param: e, current: t, error: a, onCancel: l, onSave: u }) {
94
+ let d = i(), [f, m] = p(() => E(e, t)), [_, v] = p(!1), [y, b] = p(null);
89
95
  async function S() {
90
- x(null);
96
+ b(null);
91
97
  let e;
92
98
  try {
93
- e = E(d, p);
99
+ e = D(d, f);
94
100
  } catch (e) {
95
- x(String(e instanceof Error ? e.message : e));
101
+ b(String(e instanceof Error ? e.message : e));
96
102
  return;
97
103
  }
98
104
  v(!0);
@@ -102,21 +108,21 @@ function C({ param: e, current: t, error: c, onCancel: l, onSave: u }) {
102
108
  v(!1);
103
109
  }
104
110
  }
105
- return /* @__PURE__ */ h(s, {
111
+ return /* @__PURE__ */ g(c, {
106
112
  label: d(e.name) || e.code,
107
113
  maxWidth: 440,
108
114
  onClose: l,
109
115
  testId: "param-edit-dialog",
110
116
  children: [
111
- /* @__PURE__ */ h("div", {
117
+ /* @__PURE__ */ g("div", {
112
118
  style: { padding: "14px 18px 0" },
113
- children: [/* @__PURE__ */ m("div", {
119
+ children: [/* @__PURE__ */ h("div", {
114
120
  style: {
115
121
  fontSize: 14,
116
122
  fontWeight: 600
117
123
  },
118
124
  children: d(e.name) || e.code
119
- }), e.description && /* @__PURE__ */ m("div", {
125
+ }), e.description && /* @__PURE__ */ h("div", {
120
126
  style: {
121
127
  fontSize: 11.5,
122
128
  color: "var(--text-3)",
@@ -125,7 +131,7 @@ function C({ param: e, current: t, error: c, onCancel: l, onSave: u }) {
125
131
  children: d(e.description)
126
132
  })]
127
133
  }),
128
- /* @__PURE__ */ h("div", {
134
+ /* @__PURE__ */ g("div", {
129
135
  style: {
130
136
  padding: "12px 18px 16px",
131
137
  display: "flex",
@@ -134,16 +140,16 @@ function C({ param: e, current: t, error: c, onCancel: l, onSave: u }) {
134
140
  overflowY: "auto"
135
141
  },
136
142
  children: [
137
- /* @__PURE__ */ m(o, { children: d("params.value", "Value") }),
138
- /* @__PURE__ */ m(w, {
143
+ /* @__PURE__ */ h(s, { children: d("params.value", "Value") }),
144
+ /* @__PURE__ */ h(T, {
139
145
  param: e,
140
- value: p,
141
- onChange: g
146
+ value: f,
147
+ onChange: m
142
148
  }),
143
- (y || c) && /* @__PURE__ */ m(b, { text: y || c })
149
+ (y || a) && /* @__PURE__ */ h(x, { text: y || a })
144
150
  ]
145
151
  }),
146
- /* @__PURE__ */ h("div", {
152
+ /* @__PURE__ */ g("div", {
147
153
  style: {
148
154
  padding: "10px 16px",
149
155
  borderTop: "1px solid var(--divider)",
@@ -153,14 +159,14 @@ function C({ param: e, current: t, error: c, onCancel: l, onSave: u }) {
153
159
  flexShrink: 0
154
160
  },
155
161
  children: [
156
- /* @__PURE__ */ m("div", { style: { flex: 1 } }),
157
- /* @__PURE__ */ m(r, {
162
+ /* @__PURE__ */ h("div", { style: { flex: 1 } }),
163
+ /* @__PURE__ */ h(r, {
158
164
  onClick: l,
159
165
  children: d("dialog.cancel", "Cancel")
160
166
  }),
161
- /* @__PURE__ */ m(r, {
167
+ /* @__PURE__ */ h(r, {
162
168
  kind: "primary",
163
- icon: m(_ ? a : n.check, { size: 13 }),
169
+ icon: h(_ ? o : n.check, { size: 13 }),
164
170
  onClick: S,
165
171
  disabled: _,
166
172
  children: _ ? d("dialog.saving", "Saving…") : d("dialog.save", "Save")
@@ -170,14 +176,14 @@ function C({ param: e, current: t, error: c, onCancel: l, onSave: u }) {
170
176
  ]
171
177
  });
172
178
  }
173
- function w({ param: e, value: t, onChange: n }) {
179
+ function T({ param: e, value: t, onChange: n }) {
174
180
  let r = i(), a = {
175
181
  type: e.type,
176
182
  structure: e.structure,
177
183
  values: e.values,
178
184
  ref: e.ref
179
185
  };
180
- return /* @__PURE__ */ m(p, { children: l({
186
+ return /* @__PURE__ */ h(m, { children: u({
181
187
  field: a,
182
188
  fieldName: e.code,
183
189
  value: t,
@@ -186,23 +192,23 @@ function w({ param: e, value: t, onChange: n }) {
186
192
  t: r
187
193
  }) });
188
194
  }
189
- function T(e, t) {
195
+ function E(e, t) {
190
196
  return e.type === "bool" ? t === !0 : e.type === "structure" ? t ?? {} : t ?? null;
191
197
  }
192
- function E(e, t) {
198
+ function D(e, t) {
193
199
  if (t == null) throw Error(e("params.value.required", "Enter a value."));
194
200
  return t;
195
201
  }
196
- var D = /* @__PURE__ */ new Set([
202
+ var O = /* @__PURE__ */ new Set([
197
203
  "server",
198
204
  "database",
199
205
  "auth",
200
206
  "sso",
201
207
  "seeder"
202
208
  ]);
203
- function O(e) {
209
+ function k(e) {
204
210
  let t = e.scopes ?? [];
205
- return t.length === 0 ? !D.has(e.category ?? "") : t.includes("tenant");
211
+ return t.length === 0 ? !O.has(e.category ?? "") : t.includes("tenant");
206
212
  }
207
213
  //#endregion
208
- export { C as EditParamDialog, b as ErrorLine, y as ResetParamControl, S as ValuePreview, _ as paramSourceName, O as paramTenantEditable, x as useParamRefLabels };
214
+ export { w as EditParamDialog, x as ErrorLine, b as ResetParamControl, C as ValuePreview, v as paramSourceName, k as paramTenantEditable, S as useParamRefLabels };
@@ -0,0 +1,14 @@
1
+ import { Btn as e } from "./Btn.js";
2
+ import { useText as t } from "../../hooks/useText.js";
3
+ import { jsx as n } from "react/jsx-runtime";
4
+ //#region src/components/primitives/RetryButton.tsx
5
+ function r({ onRetry: r }) {
6
+ let i = t();
7
+ return /* @__PURE__ */ n(e, {
8
+ size: "xs",
9
+ onClick: r,
10
+ children: i("control.retry", "Retry")
11
+ });
12
+ }
13
+ //#endregion
14
+ export { r as RetryButton };
@@ -1,17 +1,18 @@
1
- import { useId as e } from "react";
2
- import { Fragment as t, jsx as n, jsxs as r } from "react/jsx-runtime";
1
+ import { RetryButton as e } from "./RetryButton.js";
2
+ import { useId as t } from "react";
3
+ import { Fragment as n, jsx as r, jsxs as i } from "react/jsx-runtime";
3
4
  //#region src/components/primitives/StatTile.tsx
4
- var i = {
5
+ var a = {
5
6
  neutral: "var(--text)",
6
7
  good: "var(--success)",
7
8
  warn: "var(--warn)",
8
9
  bad: "var(--danger)",
9
10
  accent: "var(--accent)"
10
11
  };
11
- function a({ label: a, value: o, unit: s, tone: c = "neutral", delta: l, note: u, footer: d, loading: f = !1, error: p, href: m }) {
12
- let h = e(), g = p != null && p !== !1, _ = /* @__PURE__ */ r("article", {
13
- "aria-labelledby": h,
14
- "aria-busy": f || void 0,
12
+ function o({ label: o, value: s, unit: c, tone: l = "neutral", delta: u, note: d, footer: f, loading: p = !1, error: m, onRetry: h, href: g }) {
13
+ let _ = t(), v = m != null && m !== !1, y = /* @__PURE__ */ i("article", {
14
+ "aria-labelledby": _,
15
+ "aria-busy": p || void 0,
15
16
  style: {
16
17
  display: "flex",
17
18
  flexDirection: "column",
@@ -23,24 +24,24 @@ function a({ label: a, value: o, unit: s, tone: c = "neutral", delta: l, note: u
23
24
  minWidth: 0
24
25
  },
25
26
  children: [
26
- /* @__PURE__ */ n("h3", {
27
- id: h,
27
+ /* @__PURE__ */ r("h3", {
28
+ id: _,
28
29
  style: {
29
30
  margin: 0,
30
31
  fontSize: 12,
31
32
  fontWeight: 500,
32
33
  color: "var(--text-3)"
33
34
  },
34
- children: a
35
+ children: o
35
36
  }),
36
- /* @__PURE__ */ n("div", {
37
+ /* @__PURE__ */ r("div", {
37
38
  style: {
38
39
  display: "flex",
39
40
  alignItems: "baseline",
40
41
  gap: 8,
41
42
  minHeight: 32
42
43
  },
43
- children: f ? /* @__PURE__ */ n("span", {
44
+ children: p ? /* @__PURE__ */ r("span", {
44
45
  "aria-hidden": !0,
45
46
  style: {
46
47
  width: 72,
@@ -48,61 +49,68 @@ function a({ label: a, value: o, unit: s, tone: c = "neutral", delta: l, note: u
48
49
  borderRadius: "var(--radius-sm)",
49
50
  background: "var(--surface-2)"
50
51
  }
51
- }) : g ? null : /* @__PURE__ */ r(t, { children: [
52
- /* @__PURE__ */ n("strong", {
52
+ }) : v ? null : /* @__PURE__ */ i(n, { children: [
53
+ /* @__PURE__ */ r("strong", {
53
54
  style: {
54
55
  fontSize: 24,
55
56
  fontWeight: 600,
56
57
  lineHeight: 1.1,
57
- color: i[c],
58
+ color: a[l],
58
59
  fontVariantNumeric: "tabular-nums"
59
60
  },
60
- children: o
61
+ children: s
61
62
  }),
62
- s !== void 0 && /* @__PURE__ */ n("span", {
63
+ c !== void 0 && /* @__PURE__ */ r("span", {
63
64
  style: {
64
65
  fontSize: 12,
65
66
  color: "var(--text-3)"
66
67
  },
67
- children: s
68
+ children: c
68
69
  }),
69
- l && /* @__PURE__ */ n("span", {
70
+ u && /* @__PURE__ */ r("span", {
70
71
  style: {
71
72
  fontSize: 12,
72
73
  fontWeight: 500,
73
- color: i[l.tone ?? "neutral"]
74
+ color: a[u.tone ?? "neutral"]
74
75
  },
75
- children: l.text
76
+ children: u.text
76
77
  })
77
78
  ] })
78
79
  }),
79
- g ? /* @__PURE__ */ n("div", {
80
- role: "alert",
80
+ v ? /* @__PURE__ */ i("div", {
81
81
  style: {
82
- fontSize: 12,
83
- color: "var(--danger)"
82
+ display: "flex",
83
+ alignItems: "center",
84
+ gap: 8
84
85
  },
85
- children: p
86
- }) : u !== void 0 && /* @__PURE__ */ n("div", {
86
+ children: [/* @__PURE__ */ r("div", {
87
+ role: "alert",
88
+ style: {
89
+ fontSize: 12,
90
+ color: "var(--danger)"
91
+ },
92
+ children: m
93
+ }), h && /* @__PURE__ */ r(e, { onRetry: h })]
94
+ }) : d !== void 0 && /* @__PURE__ */ r("div", {
87
95
  style: {
88
96
  fontSize: 12,
89
97
  color: "var(--text-3)"
90
98
  },
91
- children: u
99
+ children: d
92
100
  }),
93
- !f && !g && d
101
+ !p && !v && f
94
102
  ]
95
103
  });
96
- return m ? /* @__PURE__ */ n("a", {
97
- href: m,
104
+ return !g || v && h ? y : /* @__PURE__ */ r("a", {
105
+ href: g,
98
106
  style: {
99
107
  display: "block",
100
108
  color: "inherit",
101
109
  textDecoration: "none",
102
110
  borderRadius: "var(--radius-lg)"
103
111
  },
104
- children: _
105
- }) : _;
112
+ children: y
113
+ });
106
114
  }
107
115
  //#endregion
108
- export { a as StatTile };
116
+ export { o as StatTile };
@@ -241,23 +241,28 @@ function N(e) {
241
241
  a.removeEventListener(r, e), a.removeEventListener(i, o);
242
242
  };
243
243
  }, [$]);
244
- let ie = h(async (e, t) => {
245
- let n = x;
246
- n || (n = (await l({ agent_id: K })).id, J.current.add(n), X.current = n, N(n));
247
- let r;
244
+ let ie = h(async (e, t, n = []) => {
245
+ let r = n.map((e) => e.id), i = x;
246
+ i || (i = (await l({ agent_id: K })).id, J.current.add(i), X.current = i, N(i));
247
+ let a;
248
248
  try {
249
- r = await m(e, n, t);
250
- } catch (i) {
251
- if (!w(i)) throw i;
252
- n = (await l({ agent_id: K })).id, J.current.add(n), X.current = n, N(n), r = await m(e, n, t);
249
+ a = await m(e, i, t, r);
250
+ } catch (n) {
251
+ if (!w(n)) throw n;
252
+ i = (await l({ agent_id: K })).id, J.current.add(i), X.current = i, N(i), a = await m(e, i, t, r);
253
253
  }
254
- F((t) => t.some((e) => e.id === r.id) ? t : [...t, {
255
- ...r,
256
- content: [{
254
+ F((t) => {
255
+ if (t.some((e) => e.id === a.id)) return t;
256
+ let r = e ? [{
257
257
  type: "text",
258
258
  text: e
259
- }]
260
- }]);
259
+ }] : [];
260
+ return [...t, {
261
+ ...a,
262
+ content: r,
263
+ attachments: n
264
+ }];
265
+ });
261
266
  }, [
262
267
  x,
263
268
  N,
@@ -4,120 +4,122 @@ import { fetchAllParams as n, fetchParam as r, fetchPublicParams as i } from "..
4
4
  import { executeAction as a, getEntity as o } from "../api/data.js";
5
5
  import { failureTitle as s } from "../lib/failure.js";
6
6
  import { useText as c } from "./useText.js";
7
- import { useCallback as l, useMemo as u, useState as d } from "react";
8
- import { useQuery as f, useQueryClient as p } from "@tanstack/react-query";
7
+ import { readDisplayState as l } from "../lib/read-display-state.js";
8
+ import { useCallback as u, useMemo as d, useState as f } from "react";
9
+ import { useQuery as p, useQueryClient as m } from "@tanstack/react-query";
9
10
  //#region src/hooks/useParams.ts
10
- var m = "$params";
11
- function h(e, t) {
11
+ var h = "$params";
12
+ function g(e, t) {
12
13
  return [
13
14
  "params-carrier-detail",
14
15
  e,
15
16
  t
16
17
  ];
17
18
  }
18
- async function g(e, { carrierEntityCode: n, rowId: r }, i) {
19
- let s = h(n, r), c = (await e.fetchQuery({
19
+ async function _(e, { carrierEntityCode: n, rowId: r }, i) {
20
+ let s = g(n, r), c = (await e.fetchQuery({
20
21
  queryKey: s,
21
22
  queryFn: () => o(n, r),
22
23
  staleTime: 0
23
- }))?.data?.[m];
24
- if (!Array.isArray(c)) throw Error(`${n} ${r} carries no ${m}`);
24
+ }))?.data?.[h];
25
+ if (!Array.isArray(c)) throw Error(`${n} ${r} carries no ${h}`);
25
26
  await a(`${n}.__update`, {
26
27
  object_ids: [r],
27
28
  entity: n,
28
- fields: { [m]: i(c) }
29
+ fields: { [h]: i(c) }
29
30
  }), await e.invalidateQueries({ queryKey: ["params-all"] }), await e.invalidateQueries({ queryKey: ["params"] }), await e.invalidateQueries({ queryKey: s }), await t(e);
30
31
  }
31
- function _({ carrierEntityCode: e, rowId: t, enabled: n = !0, writeOneByOne: r = !1 }) {
32
- let i = p(), _ = c("errors"), [v, y] = d(null), b = f({
33
- queryKey: h(e, t),
32
+ function v({ carrierEntityCode: e, rowId: t, enabled: n = !0, writeOneByOne: r = !1 }) {
33
+ let i = m(), v = c("errors"), [y, b] = f(null), x = p({
34
+ queryKey: g(e, t),
34
35
  queryFn: () => o(e, t),
35
36
  enabled: n && !!t,
36
37
  staleTime: 3e4
37
- }), x = b.data?.data, S = !!x && !("$params" in x), C = u(() => Array.isArray(x?.$params) ? x[m] : [], [x]), w = u(() => new Map(C.map((e) => [e.param_code, e])), [C]), T = l(async (n) => {
38
- y(null);
38
+ }), S = x.data?.data, C = l(x), w = S ? !(h in S) : C.error !== null, T = d(() => Array.isArray(S?.$params) ? S[h] : [], [S]), E = d(() => new Map(T.map((e) => [e.param_code, e])), [T]), D = u(async (n) => {
39
+ b(null);
39
40
  try {
40
- return await g(i, {
41
+ return await _(i, {
41
42
  carrierEntityCode: e,
42
43
  rowId: t
43
44
  }, n), !0;
44
45
  } catch (e) {
45
- return y(s(_, e)), !1;
46
+ return b(s(v, e)), !1;
46
47
  }
47
48
  }, [
48
49
  e,
49
50
  t,
50
51
  i,
51
- _
52
- ]), E = l(async (n, r) => {
53
- y(null);
52
+ v
53
+ ]), O = u(async (n, r) => {
54
+ b(null);
54
55
  try {
55
56
  return await a("params.set", {
56
57
  code: n,
57
58
  value: r,
58
59
  entity: e,
59
60
  object_id: t
60
- }), await i.invalidateQueries({ queryKey: ["params-all"] }), await i.invalidateQueries({ queryKey: ["params"] }), await i.invalidateQueries({ queryKey: h(e, t) }), !0;
61
+ }), await i.invalidateQueries({ queryKey: ["params-all"] }), await i.invalidateQueries({ queryKey: ["params"] }), await i.invalidateQueries({ queryKey: g(e, t) }), !0;
61
62
  } catch (e) {
62
- return y(s(_, e)), !1;
63
+ return b(s(v, e)), !1;
63
64
  }
64
65
  }, [
65
66
  e,
66
67
  t,
67
68
  i,
68
- _
69
- ]), D = l((e, t) => r ? E(e.code, t) : T((n) => [...n.filter((t) => t.param_code !== e.code), {
69
+ v
70
+ ]), k = u((e, t) => r ? O(e.code, t) : D((n) => [...n.filter((t) => t.param_code !== e.code), {
70
71
  param_code: e.code,
71
72
  value: t
72
73
  }]), [
73
74
  r,
74
- E,
75
- T
76
- ]), O = l((e) => r ? E(e.code, null) : T((t) => t.filter((t) => t.param_code !== e.code)), [
75
+ O,
76
+ D
77
+ ]), A = u((e) => r ? O(e.code, null) : D((t) => t.filter((t) => t.param_code !== e.code)), [
77
78
  r,
78
- E,
79
- T
80
- ]), k = l(() => y(null), []);
79
+ O,
80
+ D
81
+ ]), j = u(() => b(null), []);
81
82
  return {
82
- overrides: C,
83
- overrideByCode: w,
84
- missingParams: S,
85
- isLoading: b.isLoading,
86
- error: v,
87
- clearError: k,
88
- save: D,
89
- reset: O
83
+ overrides: T,
84
+ overrideByCode: E,
85
+ missingParams: w,
86
+ isLoading: C.loading,
87
+ retry: C.retry,
88
+ error: y,
89
+ clearError: j,
90
+ save: k,
91
+ reset: A
90
92
  };
91
93
  }
92
- function v(e) {
93
- return f({
94
+ function y(e) {
95
+ return p({
94
96
  queryKey: ["params-all", e ?? "full"],
95
97
  queryFn: () => n(e),
96
98
  staleTime: 3e4
97
99
  });
98
100
  }
99
- var y = ["params-public"];
100
- function b() {
101
- return f({
102
- queryKey: y,
101
+ var b = ["params-public"];
102
+ function x() {
103
+ return p({
104
+ queryKey: b,
103
105
  queryFn: i,
104
106
  staleTime: 3e5
105
107
  });
106
108
  }
107
- function x(e, t = {}) {
109
+ function S(e, t = {}) {
108
110
  let n = t.enabled ?? !0, i = t.isSessionProbe ?? !1;
109
- return f({
111
+ return p({
110
112
  queryKey: ["params", e],
111
113
  queryFn: () => r(e, { isSessionProbe: i }),
112
114
  enabled: !!e && n,
113
115
  staleTime: 6e4
114
116
  });
115
117
  }
116
- function S(t) {
117
- let n = e((e) => e.isAuthenticated), r = e((e) => e.sessionPresumed), i = b(), a = x(t, {
118
+ function C(t) {
119
+ let n = e((e) => e.isAuthenticated), r = e((e) => e.sessionPresumed), i = x(), a = S(t, {
118
120
  enabled: n || r,
119
121
  isSessionProbe: !n
120
- }), o = C(i.data?.parameters, t);
122
+ }), o = w(i.data?.parameters, t);
121
123
  if (n && a.data?.found) return {
122
124
  value: a.data.value,
123
125
  found: !0,
@@ -134,11 +136,11 @@ function S(t) {
134
136
  error: a.error ?? i.error ?? null
135
137
  };
136
138
  }
137
- function C(e, t) {
139
+ function w(e, t) {
138
140
  return e?.find((e) => e.code === t);
139
141
  }
140
- function w(t, n) {
141
- let i = e((e) => e.isAuthenticated), a = f({
142
+ function T(t, n) {
143
+ let i = e((e) => e.isAuthenticated), a = p({
142
144
  queryKey: ["params", t],
143
145
  queryFn: () => r(t),
144
146
  enabled: !!t && i,
@@ -153,4 +155,4 @@ function w(t, n) {
153
155
  };
154
156
  }
155
157
  //#endregion
156
- export { m as PARAMS_KEY, y as PUBLIC_PARAMS_QUERY_KEY, v as useAllParams, _ as useCarrierParamOverrides, S as useEffectiveParam, w as useParam, b as usePublicParams, x as useResolvedParam, g as writeCarrierParams };
158
+ export { h as PARAMS_KEY, b as PUBLIC_PARAMS_QUERY_KEY, y as useAllParams, v as useCarrierParamOverrides, C as useEffectiveParam, T as useParam, x as usePublicParams, S as useResolvedParam, _ as writeCarrierParams };
@@ -33,9 +33,12 @@ function p(e) {
33
33
  return t || (t = { rereading: !1 }, f.set(e, t)), t;
34
34
  }
35
35
  function m(e) {
36
- e.rereading || (e.rereading = !0, n.getState().reloadSession().finally(() => {
36
+ if (e.rereading) return;
37
+ e.rereading = !0;
38
+ let t = n.getState();
39
+ (t.isAuthenticated ? t.reloadSession : t.recheckSession)().finally(() => {
37
40
  e.rereadFor = n.getState().identitySince, e.rereading = !1;
38
- }));
41
+ });
39
42
  }
40
43
  function h() {
41
44
  let c = 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 = s({