@declarion/react 0.106.0 → 0.110.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 (43) hide show
  1. package/dist-lib/api/agents.js +9 -7
  2. package/dist-lib/api/audience.js +12 -0
  3. package/dist-lib/api/auth.js +1 -1
  4. package/dist-lib/api/client.js +101 -93
  5. package/dist-lib/api/schema.js +31 -31
  6. package/dist-lib/components/agents/AgentChatPanel.impl.js +362 -301
  7. package/dist-lib/components/agents/ChatAttachments.js +154 -0
  8. package/dist-lib/components/agents/transcript-runs.js +1 -1
  9. package/dist-lib/components/chrome/AssociationTabs.js +89 -75
  10. package/dist-lib/components/detail-layout/AssociatedBlock.js +243 -235
  11. package/dist-lib/components/detail-layout/ChildrenCards.js +57 -55
  12. package/dist-lib/components/detail-layout/ChildrenList.js +45 -43
  13. package/dist-lib/components/detail-layout/ChildrenTable.js +93 -91
  14. package/dist-lib/components/detail-layout/ChildrenTimeline.js +160 -155
  15. package/dist-lib/components/detail-layout/widgets/EntityScorecardWidget.js +127 -121
  16. package/dist-lib/components/fields/RefCombobox.js +53 -48
  17. package/dist-lib/components/fields/index.js +1 -0
  18. package/dist-lib/components/file-widgets/DocumentCard.js +1 -1
  19. package/dist-lib/components/file-widgets/FileList.js +1 -1
  20. package/dist-lib/components/file-widgets/Grid.js +1 -1
  21. package/dist-lib/components/file-widgets/upload.js +64 -61
  22. package/dist-lib/components/file-widgets/useFileSelection.js +152 -0
  23. package/dist-lib/components/pages/SmartDetailPage.impl.js +506 -482
  24. package/dist-lib/components/pages/SmartRecordListPage.impl.js +335 -300
  25. package/dist-lib/components/pages/tenant-params/TenantParamsPage.impl.js +112 -109
  26. package/dist-lib/components/params/ParamsBlock.js +18 -15
  27. package/dist-lib/components/params/param-editors.js +60 -54
  28. package/dist-lib/components/primitives/RetryButton.js +14 -0
  29. package/dist-lib/components/primitives/StatTile.js +42 -34
  30. package/dist-lib/hooks/useAgentConversation.js +122 -109
  31. package/dist-lib/hooks/useAuth.js +4 -1
  32. package/dist-lib/hooks/useParams.js +54 -52
  33. package/dist-lib/hooks/useSchema.js +25 -30
  34. package/dist-lib/hooks/useTimelineData.js +26 -24
  35. package/dist-lib/index.d.ts +90 -6
  36. package/dist-lib/index.js +95 -93
  37. package/dist-lib/lib/read-display-state.js +19 -0
  38. package/dist-lib/stores/auth.js +35 -34
  39. package/dist-lib/test/seed-schema.js +4 -3
  40. package/dist-lib/testing.d.ts +1 -1
  41. package/dist-lib/types/fieldType.js +1 -1
  42. package/dist-lib/{useResponsiveMode-ECv1AEhv.d.ts → useResponsiveMode-C4MeAgoS.d.ts} +3 -1
  43. package/package.json +1 -1
@@ -1,14 +1,16 @@
1
- import { startOrderNow as e } from "../api/access-expiry.js";
2
- import { cancelProactiveRefresh as t, ensureRefresh as n, publishLanguage as r, scheduleProactiveRefresh as i } from "../api/client.js";
3
- import { getMe as a, listTenants as o, logout as s, probeSession as c } from "../api/auth.js";
4
- import { warmRoutePages as l } from "../lib/capabilityPrefetch.js";
5
- import { usePreferencesStore as u } from "./preferences.js";
6
- import { create as d } from "zustand";
1
+ import { isEmbedTokenMode as e } from "../embed/token.js";
2
+ import { startOrderNow as t } from "../api/access-expiry.js";
3
+ import { sessionCaller as n } from "../api/audience.js";
4
+ import { cancelProactiveRefresh as r, ensureRefresh as i, scheduleProactiveRefresh as a, setLanguageReader as o } from "../api/client.js";
5
+ import { getMe as s, listTenants as c, logout as l, probeSession as u } from "../api/auth.js";
6
+ import { warmRoutePages as d } from "../lib/capabilityPrefetch.js";
7
+ import { usePreferencesStore as f } from "./preferences.js";
8
+ import { create as p } from "zustand";
7
9
  //#region src/stores/auth.ts
8
- async function f(e, t, n) {
10
+ async function m(e, t, n) {
9
11
  try {
10
12
  let r = await n();
11
- i(r.access_expires_at), e({
13
+ a(r.access_expires_at), e({
12
14
  user: r,
13
15
  isAuthenticated: !0,
14
16
  isLoading: !1,
@@ -25,7 +27,7 @@ async function f(e, t, n) {
25
27
  });
26
28
  }
27
29
  }
28
- var p = d((r, i) => ({
30
+ var h = p((e, n) => ({
29
31
  user: null,
30
32
  isAuthenticated: !1,
31
33
  isLoading: !0,
@@ -34,52 +36,51 @@ var p = d((r, i) => ({
34
36
  sessionPresumed: !1,
35
37
  identitySince: 0,
36
38
  initialize: async () => {
37
- let t = e();
38
- t === "refresh-first" && (t = await n().then(() => "first-wave", () => "probe-first")), r({ sessionPresumed: t === "first-wave" }), t === "first-wave" && l(), await f(r, i, c), t === "probe-first" && i().isAuthenticated && l();
39
+ let r = t();
40
+ r === "refresh-first" && (r = await i().then(() => "first-wave", () => "probe-first")), e({ sessionPresumed: r === "first-wave" }), r === "first-wave" && d(), await m(e, n, u), r === "probe-first" && n().isAuthenticated && d();
39
41
  },
40
- reloadSession: () => f(r, i, a),
42
+ reloadSession: () => m(e, n, s),
43
+ recheckSession: () => m(e, n, u),
41
44
  refreshMe: async () => {
42
45
  try {
43
- let e = await a(), t = i(), n = t.user?.id !== e.id || t.activeTenant?.id !== e.tenant?.id;
44
- r({
45
- user: e,
46
- activeTenant: e.tenant ?? null,
47
- ...n ? { identitySince: performance.now() } : {}
46
+ let t = await s(), r = n(), i = r.user?.id !== t.id || r.activeTenant?.id !== t.tenant?.id;
47
+ e({
48
+ user: t,
49
+ activeTenant: t.tenant ?? null,
50
+ ...i ? { identitySince: performance.now() } : {}
48
51
  });
49
52
  } catch {}
50
53
  },
51
- setUser: (e, t) => {
52
- r({
53
- user: e,
54
+ setUser: (t, n) => {
55
+ e({
56
+ user: t,
54
57
  isAuthenticated: !0,
55
58
  isLoading: !1,
56
- activeTenant: t ?? null,
59
+ activeTenant: n ?? null,
57
60
  identitySince: performance.now()
58
61
  });
59
62
  },
60
63
  loadTenants: () => {
61
- o().then((e) => r({ tenants: e }), () => void 0);
64
+ c().then((t) => e({ tenants: t }), () => void 0);
62
65
  },
63
- setActiveTenant: (e) => {
64
- r({ activeTenant: e });
66
+ setActiveTenant: (t) => {
67
+ e({ activeTenant: t });
65
68
  },
66
69
  logout: async () => {
67
- t();
68
- try {
69
- await s();
70
- } catch {}
71
- r({
70
+ r(), e({
72
71
  user: null,
73
72
  isAuthenticated: !1,
74
73
  activeTenant: null,
75
74
  tenants: [],
76
75
  sessionPresumed: !1,
77
76
  identitySince: performance.now()
78
- });
77
+ }), await l(), _?.postMessage(g);
79
78
  }
80
- }));
81
- p.subscribe((e, t) => {
82
- e.isAuthenticated !== t.isAuthenticated && r(null), e.user?.id !== t.user?.id && u.getState().startIdentity();
79
+ })), g = "signed-out", _ = typeof BroadcastChannel == "function" ? new BroadcastChannel("declarion.auth") : null;
80
+ _?.addEventListener("message", (t) => {
81
+ t.data === g && !e() && h.getState().isAuthenticated && (r(), window.location.assign("/login"));
82
+ }), h.subscribe((e, t) => {
83
+ o(n(e)), e.user?.id !== t.user?.id && f.getState().startIdentity();
83
84
  });
84
85
  //#endregion
85
- export { p as useAuthStore };
86
+ export { h as useAuthStore };
@@ -1,8 +1,9 @@
1
- import { useAuthStore as e } from "../stores/auth.js";
2
- import { SCHEMA_QUERY_KEY as t, schemaAnswerFor as n, sessionCaller as r } from "../hooks/useSchema.js";
1
+ import { sessionCaller as e } from "../api/audience.js";
2
+ import { useAuthStore as t } from "../stores/auth.js";
3
+ import { SCHEMA_QUERY_KEY as n, schemaAnswerFor as r } from "../hooks/useSchema.js";
3
4
  //#region src/test/seed-schema.ts
4
5
  function i(i, a) {
5
- e.getState().isLoading && e.setState({ isLoading: !1 }), i.setQueryData(t, n(a, r(e.getState()) ?? null));
6
+ t.getState().isLoading && t.setState({ isLoading: !1 }), i.setQueryData(n, r(a, e(t.getState()) ?? null));
6
7
  }
7
8
  //#endregion
8
9
  export { i as seedSchemaCache };
@@ -1,4 +1,4 @@
1
- import { B as Refs, M as ListMeta, P as ListResponse, d as ActionExecuteResponse, jt as TextFn, k as DataResponse, o as ResponsiveViewport, pt as Schema, st as LocalizedString, u as ActionExecuteRequest } from "./useResponsiveMode-ECv1AEhv.js";
1
+ import { B as Refs, M as ListMeta, P as ListResponse, d as ActionExecuteResponse, jt as TextFn, k as DataResponse, o as ResponsiveViewport, pt as Schema, st as LocalizedString, u as ActionExecuteRequest } from "./useResponsiveMode-C4MeAgoS.js";
2
2
  import { ReactElement, ReactNode } from "react";
3
3
  import { QueryClient } from "@tanstack/react-query";
4
4
  import { RenderResult } from "@testing-library/react";
@@ -1,4 +1,4 @@
1
1
  //#region src/types/fieldType.ts
2
- var e = /* @__PURE__ */ "bool.bytes.date.decimal.email.enum.file_ref.float.int.int_array.json.multilang.multilang_array.multilang_text.password.phone.ref.rich_text.secret.string.string_array.structure.tags.text.time.timestamp.url.uuid.uuid_array".split(".");
2
+ var e = /* @__PURE__ */ "bool.bytes.date.decimal.email.enum.file_ref.float.folder_ref.int.int_array.json.multilang.multilang_array.multilang_text.password.phone.ref.rich_text.secret.string.string_array.structure.tags.text.time.timestamp.url.uuid.uuid_array".split(".");
3
3
  //#endregion
4
4
  export { e as FIELD_TYPES };
@@ -117,7 +117,6 @@ interface UploadedFile extends FileAddress {
117
117
  content_type: string;
118
118
  size_bytes: number;
119
119
  sha256: string;
120
- dedup?: boolean;
121
120
  width?: number;
122
121
  height?: number;
123
122
  metadata?: Record<string, unknown>;
@@ -268,6 +267,9 @@ interface EntityField {
268
267
  file_ref?: {
269
268
  storage_backend: string;
270
269
  };
270
+ folder_ref?: {
271
+ storage_backend: string;
272
+ };
271
273
  /**
272
274
  * Populated by the schema hydrator from the enclosing map key. Tests and
273
275
  * fixtures may omit it; production code always receives it set.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@declarion/react",
3
- "version": "0.106.0",
3
+ "version": "0.110.0",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "description": "React SDK for Declarion, the schema-driven business apps platform.",