@declarion/react 0.87.0 → 0.89.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 (90) hide show
  1. package/dist-lib/app.js +28 -28
  2. package/dist-lib/components/actions/ActionButton.js +86 -85
  3. package/dist-lib/components/actions/ActionResultDialog.impl.js +47 -47
  4. package/dist-lib/components/actions/ActionRunner.js +47 -47
  5. package/dist-lib/components/actions/ObjectActionBar.js +9 -9
  6. package/dist-lib/components/actions/RowActionsKebab.js +19 -19
  7. package/dist-lib/components/agents/AgentChatPanel.impl.js +53 -53
  8. package/dist-lib/components/chrome/AssociationTabs.js +21 -21
  9. package/dist-lib/components/chrome/RecordHeader.js +33 -40
  10. package/dist-lib/components/detail-layout/AssociatedBlock.js +387 -381
  11. package/dist-lib/components/detail-layout/ChildrenBlock.js +12 -13
  12. package/dist-lib/components/detail-layout/ChildrenTimeline.js +198 -198
  13. package/dist-lib/components/detail-layout/DraggableChildrenTable.js +114 -114
  14. package/dist-lib/components/detail-layout/EditableChildrenTable.js +160 -160
  15. package/dist-lib/components/detail-layout/EvidenceBlock.js +20 -21
  16. package/dist-lib/components/detail-layout/PropertiesBlock.js +45 -39
  17. package/dist-lib/components/detail-layout/QuickAddForm.js +9 -9
  18. package/dist-lib/components/detail-layout/TimelineComposer.js +87 -89
  19. package/dist-lib/components/detail-layout/widgets/EntityScorecardWidget.js +100 -99
  20. package/dist-lib/components/fields/FileReferenceField.js +9 -9
  21. package/dist-lib/components/fields/StructureField.js +57 -47
  22. package/dist-lib/components/fields/TimestampField.js +59 -54
  23. package/dist-lib/components/fields/cells/factories/money.js +14 -23
  24. package/dist-lib/components/fields/cells/factories/nextRun.js +1 -1
  25. package/dist-lib/components/fields/cells/factories/text.js +18 -3
  26. package/dist-lib/components/fields/cells/factories/timestamp.js +24 -12
  27. package/dist-lib/components/file-widgets/DocumentCard.js +108 -106
  28. package/dist-lib/components/layout/Layout.js +306 -361
  29. package/dist-lib/components/layout/Rail.js +42 -41
  30. package/dist-lib/components/layout/Sidebar.js +132 -117
  31. package/dist-lib/components/layout/TabStrip.js +116 -115
  32. package/dist-lib/components/layout/TenantChip.js +47 -54
  33. package/dist-lib/components/layout/TopBar.js +108 -105
  34. package/dist-lib/components/list/InlineEditCell.js +23 -23
  35. package/dist-lib/components/list/QuickPeek.js +65 -66
  36. package/dist-lib/components/pages/DocumentsMenu.js +42 -42
  37. package/dist-lib/components/pages/ExportMenu.js +25 -25
  38. package/dist-lib/components/pages/RecordDocumentsPanel.js +35 -35
  39. package/dist-lib/components/pages/RecordNotesPanel.js +94 -93
  40. package/dist-lib/components/pages/SmartDetailPage.impl.js +421 -417
  41. package/dist-lib/components/pages/SmartListPage.impl.js +293 -295
  42. package/dist-lib/components/pages/SmartRecordListPage.impl.js +310 -310
  43. package/dist-lib/components/pages/auth/AuthShell.js +73 -73
  44. package/dist-lib/components/pages/auth/SignIn.js +32 -32
  45. package/dist-lib/components/pages/auth/SignUp.impl.js +3 -3
  46. package/dist-lib/components/pages/auth/SignUpCode.js +9 -9
  47. package/dist-lib/components/pages/list/ListFloatbar.js +12 -12
  48. package/dist-lib/components/pages/list/ListHeader.js +19 -19
  49. package/dist-lib/components/pages/list/ListNoRows.js +15 -15
  50. package/dist-lib/components/pages/list/ListToolbar.js +145 -145
  51. package/dist-lib/components/pages/list/useActiveView.js +14 -5
  52. package/dist-lib/components/pages/list/useListQuery.js +121 -81
  53. package/dist-lib/components/pages/list/useListRowInteraction.js +70 -70
  54. package/dist-lib/components/pages/list/useRowMenu.js +7 -7
  55. package/dist-lib/components/pages/profile/Preferences.impl.js +81 -78
  56. package/dist-lib/components/pages/profile/Profile.impl.js +191 -189
  57. package/dist-lib/components/pages/tenant-params/TenantParamsPage.impl.js +166 -158
  58. package/dist-lib/components/shared/ChangePasswordDialog.impl.js +23 -23
  59. package/dist-lib/components/shared/MarkdownRenderer.js +9 -9
  60. package/dist-lib/hooks/useAuth.js +11 -11
  61. package/dist-lib/hooks/useBranding.js +4 -4
  62. package/dist-lib/hooks/useDisplayTimeZone.js +8 -0
  63. package/dist-lib/hooks/useFollowAgentOpen.js +24 -24
  64. package/dist-lib/hooks/useImpersonation.js +6 -6
  65. package/dist-lib/hooks/useMutations.js +23 -23
  66. package/dist-lib/hooks/useObjectStatus.js +5 -5
  67. package/dist-lib/hooks/useParams.js +59 -51
  68. package/dist-lib/hooks/useProperties.js +8 -8
  69. package/dist-lib/hooks/useRowTenant.js +18 -6
  70. package/dist-lib/hooks/useText.js +9 -7
  71. package/dist-lib/hooks/useUiPreferences.js +71 -0
  72. package/dist-lib/index.d.ts +22 -6
  73. package/dist-lib/index.js +127 -126
  74. package/dist-lib/lib/actions.js +116 -84
  75. package/dist-lib/lib/child-config.js +10 -1
  76. package/dist-lib/lib/format-count.js +16 -1
  77. package/dist-lib/lib/language.js +23 -21
  78. package/dist-lib/lib/money-text.js +29 -0
  79. package/dist-lib/lib/profile.js +4 -0
  80. package/dist-lib/lib/role-label.js +8 -0
  81. package/dist-lib/lib/schema-routing.js +34 -14
  82. package/dist-lib/lib/shortcut.js +10 -0
  83. package/dist-lib/lib/timestamp.js +93 -31
  84. package/dist-lib/stores/auth.js +9 -8
  85. package/dist-lib/stores/preferences.js +56 -17
  86. package/dist-lib/testing.d.ts +1 -1
  87. package/dist-lib/testing.js +25 -28
  88. package/dist-lib/types/schema.js +33 -27
  89. package/dist-lib/{useResponsiveMode-D3SKz5z4.d.ts → useResponsiveMode-9_eJT18k.d.ts} +5 -5
  90. package/package.json +1 -1
@@ -1,18 +1,18 @@
1
1
  import { useSchema as e } from "../../hooks/useSchema.js";
2
- import { Icon as t } from "../primitives/Icons.js";
3
- import { Btn as n } from "../primitives/Btn.js";
4
- import { IconBtn as r } from "../primitives/IconBtn.js";
5
- import { useText as i } from "../../hooks/useText.js";
6
- import { useResponsiveMode as a } from "../../hooks/useResponsiveMode.js";
7
- import { Spinner as o } from "../primitives/Spinner.js";
8
- import { FieldLabel as s, PasswordInput as c } from "../primitives/Fields.js";
9
- import { failureTitle as l } from "../../lib/failure.js";
2
+ import { failureTitle as t } from "../../lib/failure.js";
3
+ import { Icon as n } from "../primitives/Icons.js";
4
+ import { Btn as r } from "../primitives/Btn.js";
5
+ import { IconBtn as i } from "../primitives/IconBtn.js";
6
+ import { useText as a } from "../../hooks/useText.js";
7
+ import { useResponsiveMode as o } from "../../hooks/useResponsiveMode.js";
8
+ import { Spinner as s } from "../primitives/Spinner.js";
9
+ import { FieldLabel as c, PasswordInput as l } from "../primitives/Fields.js";
10
10
  import { useId as u, useState as d } from "react";
11
11
  import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
12
12
  //#region src/components/shared/ChangePasswordDialog.impl.tsx
13
13
  var h = "auth.change_password", g = "auth.change_password@v1";
14
14
  function _({ open: _, onClose: v, onSubmit: y }) {
15
- let b = i(), x = i("errors"), { data: S } = e(), C = b(S?.actions?.[h]?.display?.name) || h, w = a().isPhone, T = u(), [E, D] = d(""), [O, k] = d(""), [A, j] = d(""), [M, N] = d(!1), [P, F] = d(null);
15
+ let b = a(), x = a("errors"), { data: S } = e(), C = b(S?.actions?.[h]?.display?.name) || h, w = o().isPhone, T = u(), [E, D] = d(""), [O, k] = d(""), [A, j] = d(""), [M, N] = d(!1), [P, F] = d(null);
16
16
  if (!_) return null;
17
17
  let I = () => {
18
18
  D(""), k(""), j(""), F(null), N(!1);
@@ -64,7 +64,7 @@ function _({ open: _, onClose: v, onSubmit: y }) {
64
64
  alignItems: "center",
65
65
  justifyContent: "center"
66
66
  },
67
- children: /* @__PURE__ */ p(t.key, { size: 15 })
67
+ children: /* @__PURE__ */ p(n.key, { size: 15 })
68
68
  }),
69
69
  /* @__PURE__ */ m("div", {
70
70
  style: { flex: 1 },
@@ -83,8 +83,8 @@ function _({ open: _, onClose: v, onSubmit: y }) {
83
83
  children: b("account.password.subtitle", "Pick something strong. You'll stay signed in on this device.")
84
84
  })]
85
85
  }),
86
- /* @__PURE__ */ p(r, {
87
- icon: /* @__PURE__ */ p(t.x, { size: 14 }),
86
+ /* @__PURE__ */ p(i, {
87
+ icon: /* @__PURE__ */ p(n.x, { size: 14 }),
88
88
  title: b("dialog.close", "Close"),
89
89
  onClick: L
90
90
  })
@@ -98,32 +98,32 @@ function _({ open: _, onClose: v, onSubmit: y }) {
98
98
  gap: 12
99
99
  },
100
100
  children: [
101
- /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p(s, {
101
+ /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p(c, {
102
102
  required: !0,
103
103
  htmlFor: `${T}-current`,
104
104
  children: b("account.password.current", "Current password")
105
- }), /* @__PURE__ */ p(c, {
105
+ }), /* @__PURE__ */ p(l, {
106
106
  id: `${T}-current`,
107
107
  value: E,
108
108
  onChange: D,
109
109
  placeholder: b("account.password.current_placeholder", "Enter your current password")
110
110
  })] }),
111
- /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p(s, {
111
+ /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p(c, {
112
112
  required: !0,
113
113
  htmlFor: `${T}-new`,
114
114
  children: b("account.password.new", "New password")
115
- }), /* @__PURE__ */ p(c, {
115
+ }), /* @__PURE__ */ p(l, {
116
116
  id: `${T}-new`,
117
117
  value: O,
118
118
  onChange: k,
119
119
  placeholder: b("account.password.new_placeholder", "At least 8 characters"),
120
120
  showStrength: !0
121
121
  })] }),
122
- /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p(s, {
122
+ /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p(c, {
123
123
  required: !0,
124
124
  htmlFor: `${T}-confirm`,
125
125
  children: b("account.password.confirm", "Confirm new password")
126
- }), /* @__PURE__ */ p(c, {
126
+ }), /* @__PURE__ */ p(l, {
127
127
  id: `${T}-confirm`,
128
128
  value: A,
129
129
  onChange: j,
@@ -139,7 +139,7 @@ function _({ open: _, onClose: v, onSubmit: y }) {
139
139
  display: "flex",
140
140
  gap: 6
141
141
  },
142
- children: [/* @__PURE__ */ p(t.info, { size: 13 }), /* @__PURE__ */ p("span", { children: P })]
142
+ children: [/* @__PURE__ */ p(n.info, { size: 13 }), /* @__PURE__ */ p("span", { children: P })]
143
143
  })
144
144
  ]
145
145
  }),
@@ -164,13 +164,13 @@ function _({ open: _, onClose: v, onSubmit: y }) {
164
164
  children: g
165
165
  }),
166
166
  /* @__PURE__ */ p("div", { style: { flex: 1 } }),
167
- /* @__PURE__ */ p(n, {
167
+ /* @__PURE__ */ p(r, {
168
168
  onClick: L,
169
169
  children: b("dialog.cancel", "Cancel")
170
170
  }),
171
- /* @__PURE__ */ p(n, {
171
+ /* @__PURE__ */ p(r, {
172
172
  kind: "primary",
173
- icon: p(M ? o : t.key, { size: 13 }),
173
+ icon: p(M ? s : n.key, { size: 13 }),
174
174
  onClick: async () => {
175
175
  if (!R) O.length < 8 ? F(b("account.password.too_short", "New password must be at least 8 characters.")) : F(A === O ? b("account.password.fill_all", "Fill in all fields.") : b("account.password.mismatch", "Passwords do not match."));
176
176
  else {
@@ -181,7 +181,7 @@ function _({ open: _, onClose: v, onSubmit: y }) {
181
181
  next: O
182
182
  }), I(), v();
183
183
  } catch (e) {
184
- F(l(x, e));
184
+ F(t(x, e));
185
185
  } finally {
186
186
  N(!1);
187
187
  }
@@ -1,5 +1,5 @@
1
- import { useText as e } from "../../hooks/useText.js";
2
- import { isExternalHref as t } from "../../lib/safe-url.js";
1
+ import { isExternalHref as e } from "../../lib/safe-url.js";
2
+ import { useText as t } from "../../hooks/useText.js";
3
3
  import { extractDeclarionFileId as n } from "../../lib/rich-text.js";
4
4
  import { previewFileURL as r } from "../file-widgets/helpers.js";
5
5
  import { jsx as i } from "react/jsx-runtime";
@@ -14,14 +14,14 @@ function f(e) {
14
14
  function p(e) {
15
15
  return e.startsWith("/") || e.startsWith("https://") || e.startsWith("http://") ? e : null;
16
16
  }
17
- function m({ href: e, children: n }) {
18
- return t(e) ? /* @__PURE__ */ i("a", {
19
- href: e,
17
+ function m({ href: t, children: n }) {
18
+ return e(t) ? /* @__PURE__ */ i("a", {
19
+ href: t,
20
20
  target: "_blank",
21
21
  rel: "noopener noreferrer",
22
22
  children: n
23
23
  }) : /* @__PURE__ */ i("a", {
24
- href: e,
24
+ href: t,
25
25
  children: n
26
26
  });
27
27
  }
@@ -67,8 +67,8 @@ function h(e, t) {
67
67
  }
68
68
  };
69
69
  }
70
- function g({ content: t, plugins: n = "breaks", files: r, components: o, skipHtml: s = !0, prose: c = !0 }) {
71
- let p = e(), g = n === "gfm" ? d : u, _ = {
70
+ function g({ content: e, plugins: n = "breaks", files: r, components: o, skipHtml: s = !0, prose: c = !0 }) {
71
+ let p = t(), g = n === "gfm" ? d : u, _ = {
72
72
  a: m,
73
73
  ...r ? h(p, r) : {},
74
74
  ...o
@@ -77,7 +77,7 @@ function g({ content: t, plugins: n = "breaks", files: r, components: o, skipHtm
77
77
  remarkPlugins: g,
78
78
  components: _,
79
79
  urlTransform: r ? f : void 0,
80
- children: t
80
+ children: e
81
81
  });
82
82
  return c ? /* @__PURE__ */ i("div", {
83
83
  className: l,
@@ -1,18 +1,18 @@
1
1
  import { confirmSignup as e, login as t, signup as n, switchTenant as r } from "../api/auth.js";
2
2
  import { useAuthStore as i } from "../stores/auth.js";
3
3
  import { SCHEMA_QUERY_KEY as a } from "./useSchema.js";
4
- import { useText as o } from "./useText.js";
5
- import { failureTitle as s } from "../lib/failure.js";
6
- import { PUBLIC_PARAMS_QUERY_KEY as c } from "./useParams.js";
7
- import { peekTenantLandingPath as l } from "../stores/tabs.js";
8
- import { toast as u } from "../lib/toast.js";
4
+ import { failureTitle as o } from "../lib/failure.js";
5
+ import { useText as s } from "./useText.js";
6
+ import { toast as c } from "../lib/toast.js";
7
+ import { PUBLIC_PARAMS_QUERY_KEY as l } from "./useParams.js";
8
+ import { peekTenantLandingPath as u } from "../stores/tabs.js";
9
9
  import { usePageStateStore as d } from "../stores/page-state.js";
10
10
  import { useMutation as f, useQueryClient as p } from "@tanstack/react-query";
11
11
  import { useNavigate as m } from "react-router";
12
12
  //#region src/hooks/useAuth.ts
13
- var h = /* @__PURE__ */ new Set([a[0], c[0]]);
13
+ var h = /* @__PURE__ */ new Set([a[0], l[0]]);
14
14
  function g() {
15
- let { user: a, isAuthenticated: c, isLoading: g, activeTenant: _, tenants: v, setUser: y, loadTenants: b, logout: x } = i(), S = m(), C = p(), w = o("errors"), T = f({
15
+ let { user: a, isAuthenticated: l, isLoading: g, activeTenant: _, tenants: v, setUser: y, loadTenants: b, logout: x } = i(), S = m(), C = p(), w = s("errors"), T = f({
16
16
  mutationFn: ({ email: e, password: n, remember: r }) => t(e, n, r ?? !0),
17
17
  onSuccess: (e) => {
18
18
  y(e.user, e.tenant), b();
@@ -23,7 +23,7 @@ function g() {
23
23
  e.verification_required || (y(e.user, e.tenant), b());
24
24
  },
25
25
  onError: (e) => {
26
- u.error(s(w, e));
26
+ c.error(o(w, e));
27
27
  }
28
28
  }), D = f({
29
29
  mutationFn: ({ email: t, code: n }) => e(t, n),
@@ -33,16 +33,16 @@ function g() {
33
33
  }), O = f({
34
34
  mutationFn: (e) => r(e),
35
35
  onSuccess: (e) => {
36
- let t = e.tenant?.id, n = e.user?.id, r = t && n && l(t, n) || "/";
36
+ let t = e.tenant?.id, n = e.user?.id, r = t && n && u(t, n) || "/";
37
37
  window.location.assign(r);
38
38
  },
39
39
  onError: (e) => {
40
- u.error(s(w, e));
40
+ c.error(o(w, e));
41
41
  }
42
42
  });
43
43
  return {
44
44
  user: a,
45
- isAuthenticated: c,
45
+ isAuthenticated: l,
46
46
  isLoading: g,
47
47
  activeTenant: _,
48
48
  tenants: v,
@@ -1,10 +1,10 @@
1
- import { BRANDING_PARAM_CODE as e, brandingFromValue as t } from "../lib/branding.js";
2
- import { useEffectiveParam as n } from "./useParams.js";
1
+ import { useEffectiveParam as e } from "./useParams.js";
2
+ import { BRANDING_PARAM_CODE as t, brandingFromValue as n } from "../lib/branding.js";
3
3
  //#region src/hooks/useBranding.ts
4
4
  function r() {
5
- let r = n(e);
5
+ let r = e(t);
6
6
  return {
7
- branding: t(r.value),
7
+ branding: n(r.value),
8
8
  isLoading: r.loading
9
9
  };
10
10
  }
@@ -0,0 +1,8 @@
1
+ import { resolveTimeZone as e } from "../lib/timestamp.js";
2
+ import { useAuthStore as t } from "../stores/auth.js";
3
+ //#region src/hooks/useDisplayTimeZone.ts
4
+ function n() {
5
+ return e(t((e) => e.user?.timezone));
6
+ }
7
+ //#endregion
8
+ export { n as useDisplayTimeZone };
@@ -2,13 +2,13 @@ import { getDisplayValue as e, screenTitleForPath as t } from "../types/schema.j
2
2
  import { useEmbed as n } from "../embed/EmbedContext.js";
3
3
  import { useAuthStore as r } from "../stores/auth.js";
4
4
  import { useSchema as i } from "./useSchema.js";
5
- import { useText as a } from "./useText.js";
6
- import { getEntity as o } from "../api/data.js";
7
- import { isSameOriginPath as s, useTabStore as c } from "../stores/tabs.js";
8
- import { stripLeadingQuestion as l } from "../lib/screen-back.js";
9
- import { resolveTabTarget as u, useTabNavigate as d } from "./useTabNavigate.js";
10
- import { useEntity as f } from "./useEntity.js";
11
- import { toast as p } from "../lib/toast.js";
5
+ import { getEntity as a } from "../api/data.js";
6
+ import { useText as o } from "./useText.js";
7
+ import { toast as s } from "../lib/toast.js";
8
+ import { isSameOriginPath as c, useTabStore as l } from "../stores/tabs.js";
9
+ import { stripLeadingQuestion as u } from "../lib/screen-back.js";
10
+ import { resolveTabTarget as d, useTabNavigate as f } from "./useTabNavigate.js";
11
+ import { useEntity as p } from "./useEntity.js";
12
12
  import { AGENT_MESSAGE_CHANGED_EVENT as m, agentBus as h, eventStreamFirstOpenedAt as g } from "../api/events.js";
13
13
  import { locationFor as _ } from "./useCurrentLocation.js";
14
14
  import { sharedWindowElection as v } from "../lib/window-election.js";
@@ -17,15 +17,15 @@ import { useCallback as y, useEffect as b, useRef as x } from "react";
17
17
  var S = "ui.open";
18
18
  function C(e) {
19
19
  let t = e.result;
20
- return typeof t?.path == "string" && s(t.path) ? t.path : void 0;
20
+ return typeof t?.path == "string" && c(t.path) ? t.path : void 0;
21
21
  }
22
22
  function w(e, t) {
23
23
  return e.requester_user_id === t.id && (e.real_user_id ?? null) === (t.impersonation?.real_user_id ?? null);
24
24
  }
25
25
  async function T(t, n, r) {
26
- let i = _(n, r?.screens), a = i?.record ? r?.screens?.[i.screen]?.entity : void 0, s = a ? r?.entities?.[a] : void 0;
27
- if (i?.record && a && s) try {
28
- let n = await o(a, i.record), r = e(t, n.data, s);
26
+ let i = _(n, r?.screens), o = i?.record ? r?.screens?.[i.screen]?.entity : void 0, s = o ? r?.entities?.[o] : void 0;
27
+ if (i?.record && o && s) try {
28
+ let n = await a(o, i.record), r = e(t, n.data, s);
29
29
  return r && !String(r).startsWith("/") ? String(r) : void 0;
30
30
  } catch {
31
31
  return;
@@ -36,10 +36,10 @@ function E(e) {
36
36
  return t !== void 0 && !Number.isNaN(n) && n < t;
37
37
  }
38
38
  function D() {
39
- let e = n(), s = f("agent_tool_invocation") !== void 0, g = !e.enabled && s, _ = d(), D = a(), { data: O } = i(), k = x(/* @__PURE__ */ new Set()), A = y(async (e) => {
39
+ let e = n(), c = p("agent_tool_invocation") !== void 0, g = !e.enabled && c, _ = f(), D = o(), { data: O } = i(), k = x(/* @__PURE__ */ new Set()), A = y(async (e) => {
40
40
  let n;
41
41
  try {
42
- n = (await o("agent_tool_invocation", e)).data;
42
+ n = (await a("agent_tool_invocation", e)).data;
43
43
  } catch (e) {
44
44
  console.warn("agent_tool_invocation read failed; the opened screen is not followed", e);
45
45
  return;
@@ -47,24 +47,24 @@ function D() {
47
47
  if (k.current.has(e)) return;
48
48
  let i = n.tool_code === S;
49
49
  if (i && n.status !== "succeeded" || (k.current.add(e), E(n))) return;
50
- let a = C(n), s = r.getState().user;
51
- if (!i || !a || !s || !w(n, s) || !v().isElected(n.conversation_id)) return;
52
- let d = c.getState();
53
- if (!d.tabs.find((e) => e.id === d.activeTabId)?.dirty) {
54
- _(a);
50
+ let o = C(n), c = r.getState().user;
51
+ if (!i || !o || !c || !w(n, c) || !v().isElected(n.conversation_id)) return;
52
+ let f = l.getState();
53
+ if (!f.tabs.find((e) => e.id === f.activeTabId)?.dirty) {
54
+ _(o);
55
55
  return;
56
56
  }
57
- let { pathname: f, search: m } = u(a), h = t(D, f, O?.screens, O?.entities), g = await T(D, f, O), y = g ?? h?.title ?? f;
58
- d.openTab({
59
- pathname: f,
60
- search: l(m),
57
+ let { pathname: p, search: m } = d(o), h = t(D, p, O?.screens, O?.entities), g = await T(D, p, O), y = g ?? h?.title ?? p;
58
+ f.openTab({
59
+ pathname: p,
60
+ search: u(m),
61
61
  title: y,
62
62
  derivedTitle: g === void 0,
63
63
  icon: h?.icon,
64
64
  closable: !0
65
- }, { activate: !1 }), p.info(D("shell.tabs.agent_opened.title", "{screen} is open in a background tab", { screen: y }), void 0, { action: {
65
+ }, { activate: !1 }), s.info(D("shell.tabs.agent_opened.title", "{screen} is open in a background tab", { screen: y }), void 0, { action: {
66
66
  label: D("shell.tabs.agent_opened.go", "Go there"),
67
- onClick: () => _(a)
67
+ onClick: () => _(o)
68
68
  } });
69
69
  }, [
70
70
  _,
@@ -1,30 +1,30 @@
1
1
  import { impersonationRevoke as e, impersonationStart as t, impersonationStop as n } from "../api/auth.js";
2
2
  import { useAuthStore as r } from "../stores/auth.js";
3
3
  import { reresolveLanguage as i } from "./useLanguage.js";
4
- import { useText as a } from "./useText.js";
5
- import { failureTitle as o } from "../lib/failure.js";
4
+ import { failureTitle as a } from "../lib/failure.js";
5
+ import { useText as o } from "./useText.js";
6
6
  import { toast as s } from "../lib/toast.js";
7
7
  import { useMutation as c, useQueryClient as l } from "@tanstack/react-query";
8
8
  //#region src/hooks/useImpersonation.ts
9
9
  function u() {
10
- let u = r((e) => e.user), d = r((e) => e.reloadSession), f = l(), p = a(), m = a("errors"), h = u?.impersonation ?? null, g = !!h, _ = c({
10
+ let u = r((e) => e.user), d = r((e) => e.reloadSession), f = l(), p = o(), m = o("errors"), h = u?.impersonation ?? null, g = !!h, _ = c({
11
11
  mutationFn: ({ targetUserId: e, reason: n, durationMinutes: r }) => t(e, n, r),
12
12
  onSuccess: async () => {
13
13
  await d(), await i(f), f.invalidateQueries(), s.success(p("toast.impersonation.started", "Impersonation session started."));
14
14
  },
15
- onError: (e) => s.error(o(m, e))
15
+ onError: (e) => s.error(a(m, e))
16
16
  }), v = c({
17
17
  mutationFn: () => n(),
18
18
  onSuccess: async () => {
19
19
  await d(), await i(f), f.invalidateQueries(), s.success(p("toast.impersonation.returned", "Returned to your own session."));
20
20
  },
21
- onError: (e) => s.error(o(m, e))
21
+ onError: (e) => s.error(a(m, e))
22
22
  }), y = c({
23
23
  mutationFn: (t) => e(t),
24
24
  onSuccess: () => {
25
25
  s.success(p("toast.impersonation.revoke_done", "Session revoked.")), f.invalidateQueries({ queryKey: ["impersonation_session"] });
26
26
  },
27
- onError: (e) => s.error(o(m, e))
27
+ onError: (e) => s.error(a(m, e))
28
28
  });
29
29
  return {
30
30
  info: h,
@@ -1,8 +1,8 @@
1
1
  import { singlePkValues as e } from "../types/schema.js";
2
2
  import { useSchema as t } from "./useSchema.js";
3
- import { useText as n } from "./useText.js";
4
- import { createEntity as r, deleteObject as i, restoreObject as a, updateEntity as o } from "../api/data.js";
5
- import { failureTitle as s } from "../lib/failure.js";
3
+ import { createEntity as n, deleteObject as r, restoreObject as i, updateEntity as a } from "../api/data.js";
4
+ import { failureTitle as o } from "../lib/failure.js";
5
+ import { useText as s } from "./useText.js";
6
6
  import { toast as c } from "../lib/toast.js";
7
7
  import { ENTITY_CHILDREN_KEY as l } from "./useChildrenData.js";
8
8
  import { ENTITY_AGGREGATE_KEY as u } from "../lib/realtime-query-keys.js";
@@ -10,60 +10,60 @@ import { settleOwnWrite as d } from "./useSSE.js";
10
10
  import { useMutation as f, useQueryClient as p } from "@tanstack/react-query";
11
11
  //#region src/hooks/useMutations.ts
12
12
  function m(e) {
13
- return (t) => c.error(s(e, t));
13
+ return (t) => c.error(o(e, t));
14
14
  }
15
15
  function h(e, t, n = {}) {
16
16
  e.invalidateQueries({ queryKey: ["entity-data", t] }), e.invalidateQueries({ queryKey: ["entity-count", t] }), e.invalidateQueries({ queryKey: [u, t] }), n.item && e.invalidateQueries({ queryKey: ["entity-item", t] }), n.children && e.invalidateQueries({ queryKey: [l, t] }), n.objectMeta && (e.invalidateQueries({ queryKey: ["object-status", t] }), e.invalidateQueries({ queryKey: ["object-properties", t] }));
17
17
  }
18
18
  function g(e) {
19
- let t = p(), i = n(), a = n("errors");
19
+ let t = p(), r = s(), i = s("errors");
20
20
  return f({
21
- mutationFn: (t) => r(e, t),
21
+ mutationFn: (t) => n(e, t),
22
22
  onSuccess: () => {
23
- h(t, e), c.success(i("toast.record.created", "Record created"));
23
+ h(t, e), c.success(r("toast.record.created", "Record created"));
24
24
  },
25
- onError: m(a)
25
+ onError: m(i)
26
26
  });
27
27
  }
28
- function _(r) {
29
- let i = p(), a = n(), s = n("errors"), { data: l } = t();
28
+ function _(n) {
29
+ let r = p(), i = s(), o = s("errors"), { data: l } = t();
30
30
  return f({
31
- mutationFn: ({ pkValues: e, data: t }) => o(r, e, t),
32
- onSuccess: (t, { pkValues: n }) => {
33
- let o = l?.entities?.[r], s = typeof n == "string" ? o ? e(o, n) : void 0 : n, u = () => h(i, r, {
31
+ mutationFn: ({ pkValues: e, data: t }) => a(n, e, t),
32
+ onSuccess: (t, { pkValues: a }) => {
33
+ let o = l?.entities?.[n], s = typeof a == "string" ? o ? e(o, a) : void 0 : a, u = () => h(r, n, {
34
34
  item: !0,
35
35
  children: !0,
36
36
  objectMeta: !0
37
37
  });
38
- s ? (d(i, r, [s], u), v(i, r)) : u(), c.success(a("toast.record.updated", "Record updated"));
38
+ s ? (d(r, n, [s], u), v(r, n)) : u(), c.success(i("toast.record.updated", "Record updated"));
39
39
  },
40
- onError: m(s)
40
+ onError: m(o)
41
41
  });
42
42
  }
43
43
  function v(e, t) {
44
44
  e.invalidateQueries({ queryKey: ["entity-item", t] }), e.invalidateQueries({ queryKey: [l, t] }), e.invalidateQueries({ queryKey: ["object-status", t] }), e.invalidateQueries({ queryKey: ["object-properties", t] });
45
45
  }
46
46
  function y(e) {
47
- let t = p(), r = n(), a = n("errors");
47
+ let t = p(), n = s(), i = s("errors");
48
48
  return f({
49
- mutationFn: (t) => i(e, t),
49
+ mutationFn: (t) => r(e, t),
50
50
  onSuccess: () => {
51
- h(t, e, { item: !0 }), c.success(r("toast.record.deleted", "Record deleted"));
51
+ h(t, e, { item: !0 }), c.success(n("toast.record.deleted", "Record deleted"));
52
52
  },
53
- onError: m(a)
53
+ onError: m(i)
54
54
  });
55
55
  }
56
56
  function b(e) {
57
- let t = p(), r = n(), i = n("errors");
57
+ let t = p(), n = s(), r = s("errors");
58
58
  return f({
59
- mutationFn: (t) => a(e, t),
59
+ mutationFn: (t) => i(e, t),
60
60
  onSuccess: () => {
61
61
  h(t, e, {
62
62
  item: !0,
63
63
  objectMeta: !0
64
- }), c.success(r("toast.record.restored", "Record restored"));
64
+ }), c.success(n("toast.record.restored", "Record restored"));
65
65
  },
66
- onError: m(i)
66
+ onError: m(r)
67
67
  });
68
68
  }
69
69
  //#endregion
@@ -1,18 +1,18 @@
1
- import { useText as e } from "./useText.js";
2
- import { failureTitle as t } from "../lib/failure.js";
1
+ import { failureTitle as e } from "../lib/failure.js";
2
+ import { useText as t } from "./useText.js";
3
3
  import { toast as n } from "../lib/toast.js";
4
4
  import { setObjectStatus as r } from "../api/status.js";
5
5
  import { useMutation as i, useQueryClient as a } from "@tanstack/react-query";
6
6
  //#region src/hooks/useObjectStatus.ts
7
7
  function o(o, s) {
8
- let c = a(), l = e("errors");
8
+ let c = a(), l = t("errors");
9
9
  return i({
10
10
  mutationFn: ({ groupCode: e, statusCode: t, note: n }) => r(o, s, e, t, n),
11
11
  onSuccess: () => {
12
12
  c.invalidateQueries({ queryKey: ["entity-item", o] });
13
13
  },
14
- onError: (e) => {
15
- n.error(t(l, e));
14
+ onError: (t) => {
15
+ n.error(e(l, t));
16
16
  }
17
17
  });
18
18
  }