@nivaro/react 0.3.103 → 0.3.105

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 (28) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +15 -3
  4. package/dist/shared/components/CollectionBrowserView.js +1694 -1639
  5. package/dist/shared/components/ItemEditForm.js +2867 -2845
  6. package/dist/shared/components/imports/CollectionImportPanel.js +483 -459
  7. package/dist/shared/components/integrations/IntegrationStatusLines.js +71 -68
  8. package/dist/shared/components/item-edit/InlineTableField.js +88 -88
  9. package/dist/shared/components/item-edit/UserChip.js +38 -38
  10. package/dist/shared/components/layout-editor/DesignNode.js +16 -14
  11. package/dist/shared/components/layout-editor/LayoutEditor.js +445 -441
  12. package/dist/shared/components/layout-editor/inspector/Inspector.js +18 -18
  13. package/dist/shared/components/layout-editor/inspector/SlotInspector.js +80 -52
  14. package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
  15. package/dist/shared/components/layout-editor/settings/ButtonsSection.js +54 -26
  16. package/dist/shared/components/layout-editor/settings/settings-registry.js +23 -15
  17. package/dist/shared/components/layout-editor/useLayoutDraft.js +211 -196
  18. package/dist/shared/components/panels/ExternalRequestsChip.js +141 -122
  19. package/dist/shared/components/quick-filters/QuickFilterBarEditor.js +334 -0
  20. package/dist/shared/components/quick-filters/QuickFilterFieldPicker.js +151 -0
  21. package/dist/shared/components/quick-filters/QuickFilterForm.js +371 -0
  22. package/dist/shared/components/quick-filters/config.js +63 -0
  23. package/dist/shared/components/quick-filters/facets.js +55 -0
  24. package/dist/shared/components/quick-filters/useQuickFilterEditing.js +95 -0
  25. package/dist/shared/lib/entry-config.js +7 -7
  26. package/dist/shared/lib/integration-chip.js +10 -6
  27. package/dist/shared/lib/owners-header-tile.js +63 -0
  28. package/package.json +1 -1
@@ -1,104 +1,122 @@
1
- import { jsxs as o, jsx as t, Fragment as E } from "react/jsx-runtime";
2
- import { useQueryClient as K, useQuery as L, useMutation as O } from "@tanstack/react-query";
3
- import { Satellite as p } from "lucide-react";
4
- import { useState as f, useEffect as F } from "react";
5
- import { toast as c } from "sonner";
6
- import { useNivaroClient as T } from "../../context.js";
7
- import { get as _, post as I } from "../../lib/commands.js";
8
- import { integrationChipSummary as j } from "../../lib/integration-chip.js";
9
- import { useLiveRefetchInterval as B } from "../../lib/live-queries.js";
10
- import { cn as y, formatRelative as M } from "../../lib/utils.js";
11
- import { SubmissionRow as V } from "../integrations/console/SubmissionRow.js";
12
- import { useRecordObligations as A, IntegrationStatusLines as H } from "../integrations/IntegrationStatusLines.js";
13
- import { OutboundPreviewSection as J } from "../integrations/RecordIntegrationPreview.js";
14
- import { Dialog as U, DialogContent as W, DialogHeader as z, DialogTitle as G, DialogBody as X } from "../ui/dialog.js";
15
- import { RecordEventPathSheet as Y } from "./IntegrationActivitySection.js";
16
- function ge({
17
- collection: r,
1
+ import { jsxs as d, jsx as r, Fragment as _ } from "react/jsx-runtime";
2
+ import { useQueryClient as M, useMutation as O, useQuery as j } from "@tanstack/react-query";
3
+ import { Satellite as b } from "lucide-react";
4
+ import { useState as v, useEffect as R } from "react";
5
+ import { toast as x } from "sonner";
6
+ import { useNivaroClient as C } from "../../context.js";
7
+ import { post as B, get as I } from "../../lib/commands.js";
8
+ import { integrationChipSummary as V, externalRequestsShown as A } from "../../lib/integration-chip.js";
9
+ import { useLiveRefetchInterval as H } from "../../lib/live-queries.js";
10
+ import { cn as w, formatRelative as J } from "../../lib/utils.js";
11
+ import { SubmissionRow as U } from "../integrations/console/SubmissionRow.js";
12
+ import { useRecordObligations as E, IntegrationStatusLines as W } from "../integrations/IntegrationStatusLines.js";
13
+ import { OutboundPreviewSection as z } from "../integrations/RecordIntegrationPreview.js";
14
+ import { Dialog as G, DialogContent as X, DialogHeader as Y, DialogTitle as Z, DialogBody as ee } from "../ui/dialog.js";
15
+ import { RecordEventPathSheet as te } from "./IntegrationActivitySection.js";
16
+ function $(t, s, u, a = !0) {
17
+ const p = C();
18
+ return j({
19
+ queryKey: ["erp-submissions", t, String(s)],
20
+ queryFn: () => p.request(
21
+ I(`/erp-submissions/${t}/${encodeURIComponent(s)}`)
22
+ ).then((n) => n.data ?? []),
23
+ enabled: a && !!t && !!s,
24
+ staleTime: 15e3,
25
+ refetchInterval: u
26
+ });
27
+ }
28
+ const q = /* @__PURE__ */ new Map();
29
+ function xe(t, s, u) {
30
+ var g;
31
+ const a = u && !!s, p = $(t, s ?? "", void 0, a), n = E(t, a ? s ?? "" : ""), c = A({
32
+ layoutOn: u,
33
+ // A viewer refused the record's integrations has nothing to see here.
34
+ partnerIntegration: n.isError ? !1 : n.partnerIntegration,
35
+ obligations: n.isError ? 0 : n.obligationCount,
36
+ submissions: p.isError ? 0 : ((g = p.data) == null ? void 0 : g.length) ?? null
37
+ });
38
+ return R(() => {
39
+ c !== null && u && q.set(t, c);
40
+ }, [c, t, u]), a ? c ?? q.get(t) ?? !1 : !1;
41
+ }
42
+ function fe({
43
+ collection: t,
18
44
  itemId: s
19
45
  }) {
20
- const k = T(), u = K(), [g, l] = f(!1), [v, N] = f(null), [m, w] = f(null);
21
- F(() => {
22
- if (!g || m == null) return;
23
- const e = document.querySelector(`[data-submission-id="${m}"]`);
46
+ const u = C(), a = M(), [p, n] = v(!1), [c, g] = v(null), [h, N] = v(null);
47
+ R(() => {
48
+ if (!p || h == null) return;
49
+ const e = document.querySelector(`[data-submission-id="${h}"]`);
24
50
  e == null || e.scrollIntoView({ block: "center", behavior: "smooth" });
25
- }, [g, m]);
26
- const S = B(6e4), { data: C, isLoading: R } = L({
27
- queryKey: ["erp-submissions", r, String(s)],
28
- queryFn: () => k.request(
29
- _(`/erp-submissions/${r}/${encodeURIComponent(s)}`)
30
- ).then((e) => e.data ?? []),
31
- enabled: !!r && !!s,
32
- staleTime: 15e3,
33
- refetchInterval: S
34
- }), h = O({
35
- mutationFn: (e) => k.request(I(`/erp-submissions/${e}/retry`)),
51
+ }, [p, h]);
52
+ const P = H(6e4), { data: Q, isLoading: D } = $(t, s, P), f = O({
53
+ mutationFn: (e) => u.request(B(`/erp-submissions/${e}/retry`)),
36
54
  onSuccess: (e) => {
37
- var q;
38
- const i = (q = e == null ? void 0 : e.data) == null ? void 0 : q.status;
39
- i && i !== "failed" ? c.success("Submission retried successfully") : c.error("Retry failed — expand the request for the error"), u.invalidateQueries({ queryKey: ["erp-submissions", r, String(s)] }), u.invalidateQueries({ queryKey: ["erp-submission-attempts"] }), u.invalidateQueries({
40
- queryKey: ["integration-obligations", "record", r, String(s)]
55
+ var S;
56
+ const l = (S = e == null ? void 0 : e.data) == null ? void 0 : S.status;
57
+ l && l !== "failed" ? x.success("Submission retried successfully") : x.error("Retry failed — expand the request for the error"), a.invalidateQueries({ queryKey: ["erp-submissions", t, String(s)] }), a.invalidateQueries({ queryKey: ["erp-submission-attempts"] }), a.invalidateQueries({
58
+ queryKey: ["integration-obligations", "record", t, String(s)]
41
59
  });
42
60
  },
43
- onError: () => c.error("Retry failed")
61
+ onError: () => x.error("Retry failed")
44
62
  }), {
45
- lines: x,
46
- remediationEnabled: $,
47
- isLoading: P
48
- } = A(r, s), d = C ?? [];
49
- if (R || P)
50
- return /* @__PURE__ */ o(
63
+ lines: y,
64
+ remediationEnabled: K,
65
+ isLoading: L
66
+ } = E(t, s), m = Q ?? [];
67
+ if (D || L)
68
+ return /* @__PURE__ */ d(
51
69
  "span",
52
70
  {
53
71
  className: "flex shrink-0 items-center gap-1.5 self-center rounded-md border border-slate-200 px-2 py-1 text-[11px] text-slate-400 dark:border-border",
54
72
  "data-nvr-external-requests": "loading",
55
73
  children: [
56
- /* @__PURE__ */ t(p, { className: "h-3.5 w-3.5 opacity-60" }),
57
- /* @__PURE__ */ t("span", { className: "h-2.5 w-16 animate-pulse rounded bg-[hsl(var(--nvr-skeleton))]" })
74
+ /* @__PURE__ */ r(b, { className: "h-3.5 w-3.5 opacity-60" }),
75
+ /* @__PURE__ */ r("span", { className: "h-2.5 w-16 animate-pulse rounded bg-[hsl(var(--nvr-skeleton))]" })
58
76
  ]
59
77
  }
60
78
  );
61
- const a = j(x, d, (e) => e ? M(e) : ""), b = /* @__PURE__ */ new Map();
62
- for (const e of d) {
63
- const i = (e.external_api_name ?? (e.external_api != null ? `#${e.external_api}` : "External")).toLowerCase();
64
- b.has(i) || b.set(i, { id: e.id, status: e.status });
79
+ const o = V(y, m, (e) => e ? J(e) : ""), k = /* @__PURE__ */ new Map();
80
+ for (const e of m) {
81
+ const l = (e.external_api_name ?? (e.external_api != null ? `#${e.external_api}` : "External")).toLowerCase();
82
+ k.has(l) || k.set(l, { id: e.id, status: e.status });
65
83
  }
66
- const Q = d.length === 0 && a.partners.length === 0, D = {
84
+ const F = m.length === 0 && o.partners.length === 0, T = {
67
85
  ok: "bg-emerald-500",
68
86
  attention: "bg-red-500",
69
87
  pending: "bg-sky-500",
70
88
  neutral: "bg-slate-400 dark:bg-slate-500"
71
- }, n = a.attention;
72
- return /* @__PURE__ */ o(E, { children: [
73
- Q ? /* @__PURE__ */ o(
89
+ }, i = o.attention;
90
+ return /* @__PURE__ */ d(_, { children: [
91
+ F ? /* @__PURE__ */ d(
74
92
  "button",
75
93
  {
76
94
  type: "button",
77
- onClick: () => l(!0),
95
+ onClick: () => n(!0),
78
96
  className: "flex shrink-0 items-center gap-1.5 self-center rounded-md border border-dashed border-slate-200 px-2 py-1 text-[11px] text-slate-500 hover:bg-slate-50 dark:border-border dark:text-slate-400 dark:hover:bg-white/5",
79
97
  "data-nvr-external-requests": "none",
80
98
  "data-tip": "Nothing from this record has been sent to an outside system yet. Click to see what the first push would carry.",
81
99
  children: [
82
- /* @__PURE__ */ t(p, { className: "h-3.5 w-3.5 opacity-60" }),
100
+ /* @__PURE__ */ r(b, { className: "h-3.5 w-3.5 opacity-60" }),
83
101
  "No external requests"
84
102
  ]
85
103
  }
86
- ) : /* @__PURE__ */ o(
104
+ ) : /* @__PURE__ */ d(
87
105
  "button",
88
106
  {
89
107
  type: "button",
90
- onClick: () => l(!0),
108
+ onClick: () => n(!0),
91
109
  "data-nvr-external-requests": !0,
92
- "data-integrations-ok": a.ok,
93
- "data-integrations-attention": n,
94
- className: y(
110
+ "data-integrations-ok": o.ok,
111
+ "data-integrations-attention": i,
112
+ className: w(
95
113
  "flex shrink-0 items-center gap-1.5 self-center rounded-md border px-2 py-1 text-[11px] font-medium transition-colors",
96
- n > 0 ? "border-red-200 text-slate-700 hover:bg-red-50/60 dark:border-red-500/40 dark:text-slate-200 dark:hover:bg-red-500/10" : "border-slate-200 text-slate-600 hover:bg-slate-50 dark:border-border dark:text-slate-300 dark:hover:bg-white/5"
114
+ i > 0 ? "border-red-200 text-slate-700 hover:bg-red-50/60 dark:border-red-500/40 dark:text-slate-200 dark:hover:bg-red-500/10" : "border-slate-200 text-slate-600 hover:bg-slate-50 dark:border-border dark:text-slate-300 dark:hover:bg-white/5"
97
115
  ),
98
- title: n > 0 ? `${n} integration ${n === 1 ? "issue needs" : "issues need"} attention — click for details` : "Integrations for this record — partner status and every request sent",
116
+ title: i > 0 ? `${i} integration ${i === 1 ? "issue needs" : "issues need"} attention — click for details` : "Integrations for this record — partner status and every request sent",
99
117
  children: [
100
- /* @__PURE__ */ t(p, { className: y("h-3.5 w-3.5", n > 0 ? "text-red-500" : "text-nvr-cyan") }),
101
- a.partners.length <= 3 ? a.partners.map((e) => /* @__PURE__ */ o(
118
+ /* @__PURE__ */ r(b, { className: w("h-3.5 w-3.5", i > 0 ? "text-red-500" : "text-nvr-cyan") }),
119
+ o.partners.length <= 3 ? o.partners.map((e) => /* @__PURE__ */ d(
102
120
  "span",
103
121
  {
104
122
  className: "inline-flex items-center gap-1",
@@ -106,133 +124,134 @@ function ge({
106
124
  "data-integration-status": e.status,
107
125
  "data-tip": e.tip,
108
126
  children: [
109
- /* @__PURE__ */ t("span", { className: y("h-1.5 w-1.5 rounded-full", D[e.status]) }),
127
+ /* @__PURE__ */ r("span", { className: w("h-1.5 w-1.5 rounded-full", T[e.status]) }),
110
128
  e.name
111
129
  ]
112
130
  },
113
131
  e.name
114
- )) : /* @__PURE__ */ t("span", { children: "Integrations" }),
115
- a.ok > 0 && /* @__PURE__ */ t(
132
+ )) : /* @__PURE__ */ r("span", { children: "Integrations" }),
133
+ o.ok > 0 && /* @__PURE__ */ r(
116
134
  "span",
117
135
  {
118
136
  "data-integrations-badge": "ok",
119
137
  className: "rounded bg-emerald-50 px-1 text-[10.5px] font-semibold text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-400",
120
- children: a.ok
138
+ children: o.ok
121
139
  }
122
140
  ),
123
- a.pending > 0 && /* @__PURE__ */ t(
141
+ o.pending > 0 && /* @__PURE__ */ r(
124
142
  "span",
125
143
  {
126
144
  "data-integrations-badge": "pending",
127
145
  className: "rounded bg-sky-50 px-1 text-[10.5px] font-semibold text-sky-700 dark:bg-sky-500/10 dark:text-sky-400",
128
- children: a.pending
146
+ children: o.pending
129
147
  }
130
148
  ),
131
- n > 0 && /* @__PURE__ */ t(
149
+ i > 0 && /* @__PURE__ */ r(
132
150
  "span",
133
151
  {
134
152
  "data-integrations-badge": "attention",
135
153
  className: "rounded bg-red-50 px-1 text-[10.5px] font-semibold text-red-700 dark:bg-red-500/10 dark:text-red-400",
136
- children: n
154
+ children: i
137
155
  }
138
156
  )
139
157
  ]
140
158
  }
141
159
  ),
142
- g && /* @__PURE__ */ t(U, { open: !0, onOpenChange: (e) => !e && l(!1), children: /* @__PURE__ */ o(W, { className: "p-5", style: { width: "75%", maxWidth: "75%" }, children: [
143
- /* @__PURE__ */ t(z, { children: /* @__PURE__ */ o(G, { className: "flex items-center gap-2 text-[15px]", children: [
144
- /* @__PURE__ */ t(p, { className: "h-4 w-4 text-nvr-cyan" }),
160
+ p && /* @__PURE__ */ r(G, { open: !0, onOpenChange: (e) => !e && n(!1), children: /* @__PURE__ */ d(X, { className: "p-5", style: { width: "75%", maxWidth: "75%" }, children: [
161
+ /* @__PURE__ */ r(Y, { children: /* @__PURE__ */ d(Z, { className: "flex items-center gap-2 text-[15px]", children: [
162
+ /* @__PURE__ */ r(b, { className: "h-4 w-4 text-nvr-cyan" }),
145
163
  "Integrations",
146
- /* @__PURE__ */ o("span", { className: "text-[12px] font-normal text-slate-400", children: [
147
- a.partners.length,
164
+ /* @__PURE__ */ d("span", { className: "text-[12px] font-normal text-slate-400", children: [
165
+ o.partners.length,
148
166
  " partner",
149
- a.partners.length !== 1 ? "s" : "",
167
+ o.partners.length !== 1 ? "s" : "",
150
168
  " ·",
151
169
  " ",
152
- d.length,
170
+ m.length,
153
171
  " request",
154
- d.length !== 1 ? "s" : "",
155
- n > 0 && /* @__PURE__ */ o("span", { className: "ml-1 text-red-600 dark:text-red-400", children: [
172
+ m.length !== 1 ? "s" : "",
173
+ i > 0 && /* @__PURE__ */ d("span", { className: "ml-1 text-red-600 dark:text-red-400", children: [
156
174
  "· ",
157
- n,
175
+ i,
158
176
  " need",
159
- n === 1 ? "s" : "",
177
+ i === 1 ? "s" : "",
160
178
  " attention"
161
179
  ] })
162
180
  ] })
163
181
  ] }) }),
164
- /* @__PURE__ */ o(X, { className: "max-h-[65vh] space-y-2 overflow-y-auto", children: [
165
- /* @__PURE__ */ t(
166
- J,
182
+ /* @__PURE__ */ d(ee, { className: "max-h-[65vh] space-y-2 overflow-y-auto", children: [
183
+ /* @__PURE__ */ r(
184
+ z,
167
185
  {
168
- collection: r,
186
+ collection: t,
169
187
  itemId: String(s),
170
- onShowRequest: (e) => w(e),
171
- onJump: () => l(!1)
188
+ onShowRequest: (e) => N(e),
189
+ onJump: () => n(!1)
172
190
  }
173
191
  ),
174
- x.length > 0 && /* @__PURE__ */ o("div", { className: "space-y-1.5 pb-2", "data-integrations-partner-status": !0, children: [
175
- /* @__PURE__ */ t("p", { className: "text-[10.5px] font-semibold uppercase tracking-wide text-slate-400", children: "Partner status" }),
176
- /* @__PURE__ */ t(
177
- H,
192
+ y.length > 0 && /* @__PURE__ */ d("div", { className: "space-y-1.5 pb-2", "data-integrations-partner-status": !0, children: [
193
+ /* @__PURE__ */ r("p", { className: "text-[10.5px] font-semibold uppercase tracking-wide text-slate-400", children: "Partner status" }),
194
+ /* @__PURE__ */ r(
195
+ W,
178
196
  {
179
- collection: r,
197
+ collection: t,
180
198
  itemId: s,
181
- lines: x,
182
- remediationEnabled: $,
199
+ lines: y,
200
+ remediationEnabled: K,
183
201
  actions: {
184
- newestSubmissionByApi: b,
185
- onRetry: (e) => h.mutate(e),
186
- onView: (e) => w(e),
202
+ newestSubmissionByApi: k,
203
+ onRetry: (e) => f.mutate(e),
204
+ onView: (e) => N(e),
187
205
  onCheck: () => {
188
- u.invalidateQueries({
206
+ a.invalidateQueries({
189
207
  queryKey: [
190
208
  "integration-obligations",
191
209
  "record",
192
- r,
210
+ t,
193
211
  String(s)
194
212
  ]
195
- }), u.invalidateQueries({
196
- queryKey: ["erp-submissions", r, String(s)]
197
- }), c.message("Checking with the partner status…");
213
+ }), a.invalidateQueries({
214
+ queryKey: ["erp-submissions", t, String(s)]
215
+ }), x.message("Checking with the partner status…");
198
216
  },
199
217
  // The pipeline panel takes over (save, requirements
200
218
  // dialog, run) — this dialog gets out of its way.
201
- onRanTransition: () => l(!1)
219
+ onRanTransition: () => n(!1)
202
220
  }
203
221
  }
204
222
  )
205
223
  ] }),
206
- d.length > 0 && /* @__PURE__ */ t("p", { className: "pt-1 text-[10.5px] font-semibold uppercase tracking-wide text-slate-400", children: "Requests sent" }),
207
- d.length === 0 && /* @__PURE__ */ t("p", { className: "text-[12px] text-slate-500 dark:text-muted-foreground", children: "No request has been sent from this record yet." }),
208
- d.map((e) => /* @__PURE__ */ t(
209
- V,
224
+ m.length > 0 && /* @__PURE__ */ r("p", { className: "pt-1 text-[10.5px] font-semibold uppercase tracking-wide text-slate-400", children: "Requests sent" }),
225
+ m.length === 0 && /* @__PURE__ */ r("p", { className: "text-[12px] text-slate-500 dark:text-muted-foreground", children: "No request has been sent from this record yet." }),
226
+ m.map((e) => /* @__PURE__ */ r(
227
+ U,
210
228
  {
211
229
  sub: e,
212
- initialOpen: m === e.id,
213
- onRetry: (i) => h.mutate(i),
214
- retrying: h.isPending,
215
- onShowPath: (i) => {
216
- l(!1), N(i);
230
+ initialOpen: h === e.id,
231
+ onRetry: (l) => f.mutate(l),
232
+ retrying: f.isPending,
233
+ onShowPath: (l) => {
234
+ n(!1), g(l);
217
235
  }
218
236
  },
219
- `${e.id}:${m === e.id ? "focus" : ""}`
237
+ `${e.id}:${h === e.id ? "focus" : ""}`
220
238
  ))
221
239
  ] })
222
240
  ] }) }),
223
- /* @__PURE__ */ t(
224
- Y,
241
+ /* @__PURE__ */ r(
242
+ te,
225
243
  {
226
- target: v != null ? {
244
+ target: c != null ? {
227
245
  source: "core:outbound",
228
- id: String(v),
229
- record: { collection: r, item: String(s) }
246
+ id: String(c),
247
+ record: { collection: t, item: String(s) }
230
248
  } : null,
231
- onClose: () => N(null)
249
+ onClose: () => g(null)
232
250
  }
233
251
  )
234
252
  ] });
235
253
  }
236
254
  export {
237
- ge as ExternalRequestsChip
255
+ fe as ExternalRequestsChip,
256
+ xe as useExternalRequestsShown
238
257
  };