@nivaro/react 0.3.99 → 0.3.100

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/full.css +1 -1
  2. package/dist/hooks/useFormSchema.js +82 -85
  3. package/dist/hooks/useSessionRecorder.js +206 -175
  4. package/dist/index.d.ts +38 -13
  5. package/dist/index.js +182 -180
  6. package/dist/lib/commands.js +15 -11
  7. package/dist/shared/components/CollectionBrowserView.js +516 -503
  8. package/dist/shared/components/ItemEditForm.js +3021 -3019
  9. package/dist/shared/components/JobsTray.js +20 -16
  10. package/dist/shared/components/MyWorkView.js +133 -126
  11. package/dist/shared/components/NotificationBell.js +314 -288
  12. package/dist/shared/components/RecordCompare.js +38 -40
  13. package/dist/shared/components/RecordReadView.js +119 -119
  14. package/dist/shared/components/cbv/FoundElsewhere.js +61 -0
  15. package/dist/shared/components/item-edit/InlineGridField.js +45 -45
  16. package/dist/shared/components/item-edit/InlineTableField.js +750 -749
  17. package/dist/shared/components/item-edit/QuickPickerDialog.js +44 -44
  18. package/dist/shared/components/item-edit/RawEditSheet.js +122 -114
  19. package/dist/shared/components/item-edit/RelationCombobox.js +454 -378
  20. package/dist/shared/components/item-edit/SummaryPanel.js +56 -48
  21. package/dist/shared/components/item-edit/related-missing.js +75 -19
  22. package/dist/shared/components/notifications/NotificationCenterView.js +249 -226
  23. package/dist/shared/components/panels/AccessDeniedPanel.js +31 -28
  24. package/dist/shared/components/panels/BackgroundMove.js +175 -0
  25. package/dist/shared/components/panels/MoveAdvisory.js +204 -0
  26. package/dist/shared/components/panels/PipelinePanel.js +1450 -1219
  27. package/dist/shared/components/panels/RecordIntegrityBanner.js +113 -112
  28. package/dist/shared/lib/commands.js +18 -14
  29. package/dist/shared/lib/error-hints.js +1 -1
  30. package/dist/shared/lib/job-failure-text.js +12 -0
  31. package/dist/shared/lib/move-failure.js +9 -0
  32. package/dist/shared/lib/obligation-banner.js +15 -14
  33. package/dist/shared/lib/partner-failure.js +71 -0
  34. package/dist/shared/lib/prefetch.js +73 -73
  35. package/dist/shared/lib/replay-checkout.js +18 -13
  36. package/dist/shared/lib/replay-context.js +90 -77
  37. package/dist/shared/lib/replay-idle.js +21 -0
  38. package/dist/shared/lib/replay-socket.js +21 -17
  39. package/dist/shared/lib/rum.js +56 -51
  40. package/dist/shared/lib/safe-error.js +17 -13
  41. package/dist/shared/lib/stale-chunk.js +69 -26
  42. package/dist/shared/lib/system-collections.js +20 -0
  43. package/package.json +1 -1
@@ -1,94 +1,95 @@
1
- import { jsxs as d, jsx as n } from "react/jsx-runtime";
1
+ import { jsxs as o, jsx as n } from "react/jsx-runtime";
2
2
  import { useQuery as S, useQueryClient as Z, useMutation as I } from "@tanstack/react-query";
3
3
  import { useState as f, useMemo as J, useEffect as ee } from "react";
4
4
  import { useNivaroClient as W } from "../../context.js";
5
5
  import { get as G, post as q } from "../../lib/commands.js";
6
6
  import { useAfterIdle as te } from "../../lib/defer.js";
7
- import { formatRelative as re, formatDateTime as ne, cn as K, titleCase as ae } from "../../lib/utils.js";
8
- function ie(r, t, a = !0) {
9
- const u = W(), { data: i } = S({
10
- queryKey: ["record-integrity", r, t],
11
- enabled: a,
7
+ import { hasRecordExtras as re } from "../../lib/system-collections.js";
8
+ import { formatRelative as ne, formatDateTime as ae, cn as K, titleCase as ie } from "../../lib/utils.js";
9
+ function de(t, r, a = !0) {
10
+ const u = W(), i = a && re(t), { data: g } = S({
11
+ queryKey: ["record-integrity", t, r],
12
+ enabled: i,
12
13
  queryFn: () => u.request(
13
- G(`/config-conformance/record/${r}/${encodeURIComponent(t)}`)
14
- ).then((p) => p.data).catch(() => ({ enabled: !1, findings: [] })),
14
+ G(`/config-conformance/record/${t}/${encodeURIComponent(r)}`)
15
+ ).then((d) => d.data).catch(() => ({ enabled: !1, findings: [] })),
15
16
  staleTime: 5 * 6e4
16
- }), g = te(2e3), { data: b, isFetching: m } = S({
17
- queryKey: ["record-integrity", r, t, "live"],
18
- enabled: a && g,
17
+ }), h = te(2e3), { data: m, isFetching: k } = S({
18
+ queryKey: ["record-integrity", t, r, "live"],
19
+ enabled: i && h,
19
20
  queryFn: () => u.request(
20
- q(`/config-conformance/record/${r}/${encodeURIComponent(t)}/check`, {})
21
- ).then((p) => p.data).catch(() => null),
21
+ q(`/config-conformance/record/${t}/${encodeURIComponent(r)}/check`, {})
22
+ ).then((d) => d.data).catch(() => null),
22
23
  staleTime: 6e4,
23
24
  // Never spin the banner on a background refetch storm — one live check per
24
25
  // mount / invalidation is the contract.
25
26
  refetchOnWindowFocus: !1
26
27
  });
27
- return { data: b ?? i, checking: m };
28
+ return { data: m ?? g, checking: k };
28
29
  }
29
- const de = "nvr:own-record-writes";
30
- function H(r) {
30
+ const oe = "nvr:own-record-writes";
31
+ function H(t) {
31
32
  var a;
32
- const t = [];
33
- for (const u of r.writes ?? []) {
33
+ const r = [];
34
+ for (const u of t.writes ?? []) {
34
35
  const i = u;
35
- i && typeof i.collection == "string" && i.item_id != null && i.item_id !== "" && t.push({ collection: i.collection, id: String(i.item_id) });
36
+ i && typeof i.collection == "string" && i.item_id != null && i.item_id !== "" && r.push({ collection: i.collection, id: String(i.item_id) });
36
37
  }
37
- return (a = r.pick) != null && a.collection && r.pick.item_id && t.push({ collection: r.pick.collection, id: String(r.pick.item_id) }), t;
38
+ return (a = t.pick) != null && a.collection && t.pick.item_id && r.push({ collection: t.pick.collection, id: String(t.pick.item_id) }), r;
38
39
  }
39
- function Y(r) {
40
- r.length === 0 || typeof window > "u" || window.dispatchEvent(
41
- new CustomEvent(de, { detail: { writes: r } })
40
+ function Y(t) {
41
+ t.length === 0 || typeof window > "u" || window.dispatchEvent(
42
+ new CustomEvent(oe, { detail: { writes: t } })
42
43
  );
43
44
  }
44
- function oe(r, t) {
45
+ function se(t, r) {
45
46
  var u;
46
- const a = t == null ? void 0 : t.find((i) => i.field === r);
47
- return ((u = a == null ? void 0 : a.label) == null ? void 0 : u.trim()) || ae(r);
47
+ const a = r == null ? void 0 : r.find((i) => i.field === t);
48
+ return ((u = a == null ? void 0 : a.label) == null ? void 0 : u.trim()) || ie(t);
48
49
  }
49
- function pe(r) {
50
- const t = /* @__PURE__ */ new Map();
51
- for (const a of r ?? []) {
52
- const u = t.get(a.field) ?? [];
53
- u.push(a), t.set(a.field, u);
50
+ function be(t) {
51
+ const r = /* @__PURE__ */ new Map();
52
+ for (const a of t ?? []) {
53
+ const u = r.get(a.field) ?? [];
54
+ u.push(a), r.set(a.field, u);
54
55
  }
55
- return t;
56
+ return r;
56
57
  }
57
58
  const z = {
58
59
  high: { dot: "bg-emerald-500", text: "Confident" },
59
60
  medium: { dot: "bg-amber-500", text: "Likely" },
60
61
  low: { dot: "bg-slate-400", text: "Manual" }
61
62
  };
62
- function he({
63
- collection: r,
64
- itemId: t,
63
+ function ke({
64
+ collection: t,
65
+ itemId: r,
65
66
  onJumpToField: a
66
67
  }) {
67
68
  var R;
68
- const u = W(), i = Z(), [g, b] = f(!1), [m, p] = f(null), { data: s, checking: E } = ie(r, t), { data: y } = S({
69
- queryKey: ["field-config", r, null],
70
- queryFn: () => u.request(G(`/field-config/${r}`)).then((l) => l.data ?? []),
71
- enabled: !!((R = s == null ? void 0 : s.findings) != null && R.length),
69
+ const u = W(), i = Z(), [g, h] = f(!1), [m, k] = f(null), { data: d, checking: E } = de(t, r), { data: y } = S({
70
+ queryKey: ["field-config", t, null],
71
+ queryFn: () => u.request(G(`/field-config/${t}`)).then((l) => l.data ?? []),
72
+ enabled: !!((R = d == null ? void 0 : d.findings) != null && R.length),
72
73
  staleTime: 6e4
73
74
  }), L = () => {
74
- i.invalidateQueries({ queryKey: ["record-integrity", r, t] }), i.invalidateQueries({ queryKey: ["item", r, t] }), i.invalidateQueries({ queryKey: [r, t] }), i.invalidateQueries({ queryKey: ["o2m-rows"] }), i.invalidateQueries({ queryKey: ["revisions"] });
75
+ i.invalidateQueries({ queryKey: ["record-integrity", t, r] }), i.invalidateQueries({ queryKey: ["item", t, r] }), i.invalidateQueries({ queryKey: [t, r] }), i.invalidateQueries({ queryKey: ["o2m-rows"] }), i.invalidateQueries({ queryKey: ["revisions"] });
75
76
  };
76
- if (!(s != null && s.enabled) || s.findings.length === 0) return null;
77
- const v = s.findings.length;
78
- return /* @__PURE__ */ d(
77
+ if (!(d != null && d.enabled) || d.findings.length === 0) return null;
78
+ const v = d.findings.length;
79
+ return /* @__PURE__ */ o(
79
80
  "div",
80
81
  {
81
82
  "data-record-integrity": !0,
82
83
  className: "nvr-expand-in rounded-lg border border-amber-200 bg-amber-50 px-4 py-2.5 dark:border-amber-500/30 dark:bg-amber-400/10",
83
84
  children: [
84
- /* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
85
- /* @__PURE__ */ d("span", { className: "text-[12.5px] font-medium text-amber-800 dark:text-amber-300", children: [
85
+ /* @__PURE__ */ o("div", { className: "flex items-center gap-2", children: [
86
+ /* @__PURE__ */ o("span", { className: "text-[12.5px] font-medium text-amber-800 dark:text-amber-300", children: [
86
87
  v,
87
88
  " data integrity issue",
88
89
  v === 1 ? "" : "s",
89
90
  " on this record"
90
91
  ] }),
91
- s.live ? /* @__PURE__ */ n(
92
+ d.live ? /* @__PURE__ */ n(
92
93
  "span",
93
94
  {
94
95
  className: "text-[11px] text-amber-600/80 dark:text-amber-400/70",
@@ -102,15 +103,15 @@ function he({
102
103
  "data-integrity-checked": "checking",
103
104
  children: "checking…"
104
105
  }
105
- ) : s.checked_at ? /* @__PURE__ */ d(
106
+ ) : d.checked_at ? /* @__PURE__ */ o(
106
107
  "span",
107
108
  {
108
109
  className: "text-[11px] text-amber-600/80 dark:text-amber-400/70",
109
110
  "data-integrity-checked": "stored",
110
- title: ne(s.checked_at),
111
+ title: ae(d.checked_at),
111
112
  children: [
112
113
  "checked ",
113
- re(s.checked_at)
114
+ ne(d.checked_at)
114
115
  ]
115
116
  }
116
117
  ) : null,
@@ -118,14 +119,14 @@ function he({
118
119
  "button",
119
120
  {
120
121
  type: "button",
121
- onClick: () => b((l) => !l),
122
+ onClick: () => h((l) => !l),
122
123
  className: "ml-auto text-[11.5px] font-medium text-amber-700 underline decoration-dotted underline-offset-2 dark:text-amber-300",
123
124
  children: g ? "Hide" : "View"
124
125
  }
125
126
  )
126
127
  ] }),
127
- g && /* @__PURE__ */ n("div", { className: "mt-1.5 space-y-1", children: s.findings.map((l, k) => /* @__PURE__ */ d("div", { children: [
128
- /* @__PURE__ */ d("div", { className: "flex items-baseline gap-2 text-[12px]", children: [
128
+ g && /* @__PURE__ */ n("div", { className: "mt-1.5 space-y-1", children: d.findings.map((l, b) => /* @__PURE__ */ o("div", { children: [
129
+ /* @__PURE__ */ o("div", { className: "flex items-baseline gap-2 text-[12px]", children: [
129
130
  /* @__PURE__ */ n(
130
131
  "button",
131
132
  {
@@ -133,7 +134,7 @@ function he({
133
134
  onClick: () => a == null ? void 0 : a(l.field),
134
135
  "data-integrity-field": l.field,
135
136
  className: "shrink-0 text-[11.5px] font-medium text-amber-700 underline decoration-dotted underline-offset-2 dark:text-amber-300",
136
- children: oe(l.field, y)
137
+ children: se(l.field, y)
137
138
  }
138
139
  ),
139
140
  /* @__PURE__ */ n("span", { className: "min-w-0 flex-1 text-amber-800 dark:text-amber-200/90", children: l.message }),
@@ -141,95 +142,95 @@ function he({
141
142
  "button",
142
143
  {
143
144
  type: "button",
144
- onClick: () => p((h) => h === k ? null : k),
145
+ onClick: () => k((p) => p === b ? null : b),
145
146
  className: K(
146
147
  "shrink-0 rounded px-2 py-0.5 text-[10.5px] font-semibold transition-colors",
147
- m === k ? "bg-amber-200 text-amber-900 dark:bg-amber-400/30 dark:text-amber-100" : "bg-amber-600 text-white hover:bg-amber-700"
148
+ m === b ? "bg-amber-200 text-amber-900 dark:bg-amber-400/30 dark:text-amber-100" : "bg-amber-600 text-white hover:bg-amber-700"
148
149
  ),
149
- children: m === k ? "Close" : "Fix…"
150
+ children: m === b ? "Close" : "Fix…"
150
151
  }
151
152
  )
152
153
  ] }),
153
- m === k && /* @__PURE__ */ n(
154
- se,
154
+ m === b && /* @__PURE__ */ n(
155
+ le,
155
156
  {
156
- collection: r,
157
- itemId: t,
157
+ collection: t,
158
+ itemId: r,
158
159
  finding: l,
159
160
  onApplied: L,
160
- onClose: () => p(null)
161
+ onClose: () => k(null)
161
162
  }
162
163
  )
163
- ] }, `${l.field}|${l.rule}|${k}`)) })
164
+ ] }, `${l.field}|${l.rule}|${b}`)) })
164
165
  ]
165
166
  }
166
167
  );
167
168
  }
168
- function se({
169
- collection: r,
170
- itemId: t,
169
+ function le({
170
+ collection: t,
171
+ itemId: r,
171
172
  finding: a,
172
173
  onApplied: u,
173
174
  onClose: i
174
175
  }) {
175
- const g = W(), b = `/config-conformance/record/${r}/${encodeURIComponent(t)}`, m = { field: a.field, rule: a.rule, message: a.message }, { data: p, isLoading: s, error: E } = S({
176
- queryKey: ["integrity-proposals", r, t, a.field, a.rule],
177
- queryFn: () => g.request(q(`${b}/proposals`, m)).then((e) => e.data.proposals),
176
+ const g = W(), h = `/config-conformance/record/${t}/${encodeURIComponent(r)}`, m = { field: a.field, rule: a.rule, message: a.message }, { data: k, isLoading: d, error: E } = S({
177
+ queryKey: ["integrity-proposals", t, r, a.field, a.rule],
178
+ queryFn: () => g.request(q(`${h}/proposals`, m)).then((e) => e.data.proposals),
178
179
  staleTime: 6e4
179
- }), [y, L] = f([]), [v, R] = f({}), [l, k] = f(""), [h, M] = f(null), [j, D] = f(0), [T, N] = f(null), [B, X] = f(null), [_, O] = f(null), V = J(() => [...p ?? [], ...y], [p, y]);
180
+ }), [y, L] = f([]), [v, R] = f({}), [l, b] = f(""), [p, M] = f(null), [j, D] = f(0), [T, N] = f(null), [B, X] = f(null), [_, O] = f(null), V = J(() => [...k ?? [], ...y], [k, y]);
180
181
  ee(() => {
181
- if (!h || h.undo.length === 0) return;
182
+ if (!p || p.undo.length === 0) return;
182
183
  D(30);
183
184
  const e = setInterval(() => D((c) => c <= 1 ? 0 : c - 1), 1e3);
184
185
  return () => clearInterval(e);
185
- }, [h]);
186
+ }, [p]);
186
187
  const A = I({
187
188
  mutationFn: (e) => g.request(
188
- q(`${b}/fix`, {
189
+ q(`${h}/fix`, {
189
190
  ...m,
190
191
  proposal_id: e.id,
191
192
  choice: e.kind === "pick" ? v[e.id] : void 0
192
193
  })
193
194
  ),
194
195
  onSuccess: (e, c) => {
195
- var C, $, o;
196
+ var C, $, s;
196
197
  N(null), Y(H(c)), X(c);
197
198
  const x = e.data, w = ((C = x.failed) == null ? void 0 : C.length) ?? 0;
198
199
  M({
199
- text: c.kind === "notify" ? `Sent to ${(($ = c.notify) == null ? void 0 : $.name) ?? "the owner"} as a task.` : `${x.applied} write${x.applied === 1 ? "" : "s"} applied${w ? ` — ${w} failed: ${((o = x.failed[0]) == null ? void 0 : o.error) ?? ""}` : ""}.`,
200
+ text: c.kind === "notify" ? `Sent to ${(($ = c.notify) == null ? void 0 : $.name) ?? "the owner"} as a task.` : `${x.applied} write${x.applied === 1 ? "" : "s"} applied${w ? ` — ${w} failed: ${((s = x.failed[0]) == null ? void 0 : s.error) ?? ""}` : ""}.`,
200
201
  undo: x.undo ?? []
201
202
  }), u();
202
203
  },
203
204
  onError: (e) => N(F(e))
204
205
  }), P = I({
205
- mutationFn: (e) => g.request(q(`${b}/fix`, { ...m, undo: e })),
206
+ mutationFn: (e) => g.request(q(`${h}/fix`, { ...m, undo: e })),
206
207
  onSuccess: () => {
207
208
  B && Y(H(B)), M({ text: "Undone.", undo: [] }), u();
208
209
  },
209
210
  onError: (e) => N(F(e))
210
211
  }), Q = I({
211
- mutationFn: () => g.request(q(`${b}/proposals/ai`, m)).then((e) => e.data.proposal),
212
+ mutationFn: () => g.request(q(`${h}/proposals/ai`, m)).then((e) => e.data.proposal),
212
213
  onSuccess: (e) => {
213
214
  N(null), L((c) => c.some((x) => x.id === e.id) ? c : [...c, e]);
214
215
  },
215
216
  onError: (e) => N(F(e))
216
217
  });
217
- return /* @__PURE__ */ d(
218
+ return /* @__PURE__ */ o(
218
219
  "div",
219
220
  {
220
221
  "data-integrity-proposals": !0,
221
222
  className: "mt-1.5 rounded-md border border-amber-200/80 bg-white/70 px-3 py-2 dark:border-amber-500/20 dark:bg-black/20",
222
223
  children: [
223
- s && /* @__PURE__ */ n("p", { className: "text-[11.5px] text-slate-500 dark:text-muted-foreground", children: "Working out what would fix this…" }),
224
+ d && /* @__PURE__ */ n("p", { className: "text-[11.5px] text-slate-500 dark:text-muted-foreground", children: "Working out what would fix this…" }),
224
225
  E && /* @__PURE__ */ n("p", { className: "text-[11.5px] text-red-600 dark:text-red-400", children: F(E) }),
225
- h ? /* @__PURE__ */ d("div", { className: "flex flex-wrap items-center gap-2 text-[11.5px]", children: [
226
- /* @__PURE__ */ n("span", { className: "font-medium text-emerald-700 dark:text-emerald-400", children: h.text }),
227
- h.undo.length > 0 && j > 0 && /* @__PURE__ */ n(
226
+ p ? /* @__PURE__ */ o("div", { className: "flex flex-wrap items-center gap-2 text-[11.5px]", children: [
227
+ /* @__PURE__ */ n("span", { className: "font-medium text-emerald-700 dark:text-emerald-400", children: p.text }),
228
+ p.undo.length > 0 && j > 0 && /* @__PURE__ */ n(
228
229
  "button",
229
230
  {
230
231
  type: "button",
231
232
  disabled: P.isPending,
232
- onClick: () => P.mutate(h.undo),
233
+ onClick: () => P.mutate(p.undo),
233
234
  className: "rounded border border-slate-300 px-2 py-0.5 text-[11px] font-medium text-slate-700 hover:bg-slate-50 disabled:opacity-50 dark:border-border dark:text-foreground dark:hover:bg-muted",
234
235
  children: P.isPending ? "Undoing…" : `Undo (${j}s)`
235
236
  }
@@ -243,18 +244,18 @@ function se({
243
244
  children: "Done"
244
245
  }
245
246
  )
246
- ] }) : !s && /* @__PURE__ */ d("div", { className: "space-y-1.5", children: [
247
+ ] }) : !d && /* @__PURE__ */ o("div", { className: "space-y-1.5", children: [
247
248
  V.length === 0 && /* @__PURE__ */ n("p", { className: "text-[11.5px] text-slate-500 dark:text-muted-foreground", children: "Nothing on this record can derive a value — fix it by hand on the form." }),
248
249
  V.map((e) => {
249
250
  var C, $;
250
251
  const c = z[e.confidence] ?? z.low, x = v[e.id], w = (e.choices ?? []).filter(
251
- (o) => !l || o.label.toLowerCase().includes(l.toLowerCase())
252
+ (s) => !l || s.label.toLowerCase().includes(l.toLowerCase())
252
253
  );
253
254
  return /* @__PURE__ */ n(
254
255
  "div",
255
256
  {
256
257
  className: "rounded border border-slate-200/80 bg-white px-2.5 py-1.5 dark:border-border dark:bg-card",
257
- children: /* @__PURE__ */ d("div", { className: "flex items-start gap-2", children: [
258
+ children: /* @__PURE__ */ o("div", { className: "flex items-start gap-2", children: [
258
259
  /* @__PURE__ */ n(
259
260
  "span",
260
261
  {
@@ -263,13 +264,13 @@ function se({
263
264
  "data-tip": c.text
264
265
  }
265
266
  ),
266
- /* @__PURE__ */ d("div", { className: "min-w-0 flex-1", children: [
267
- /* @__PURE__ */ d("p", { className: "text-[12px] font-medium text-slate-800 dark:text-foreground", children: [
267
+ /* @__PURE__ */ o("div", { className: "min-w-0 flex-1", children: [
268
+ /* @__PURE__ */ o("p", { className: "text-[12px] font-medium text-slate-800 dark:text-foreground", children: [
268
269
  e.label,
269
270
  /* @__PURE__ */ n("span", { className: "ml-1.5 text-[10px] font-normal uppercase tracking-wide text-slate-400", children: e.kind === "ai" ? "AI" : c.text })
270
271
  ] }),
271
272
  /* @__PURE__ */ n("p", { className: "text-[11px] leading-snug text-slate-500 dark:text-muted-foreground", children: e.basis }),
272
- e.confirm && _ === e.id && /* @__PURE__ */ d(
273
+ e.confirm && _ === e.id && /* @__PURE__ */ o(
273
274
  "p",
274
275
  {
275
276
  role: "alert",
@@ -290,51 +291,51 @@ function se({
290
291
  ]
291
292
  }
292
293
  ),
293
- e.preview.length > 0 && /* @__PURE__ */ d("div", { className: "mt-1 flex flex-wrap gap-1", children: [
294
- e.preview.slice(0, 8).map((o, U) => /* @__PURE__ */ d(
294
+ e.preview.length > 0 && /* @__PURE__ */ o("div", { className: "mt-1 flex flex-wrap gap-1", children: [
295
+ e.preview.slice(0, 8).map((s, U) => /* @__PURE__ */ o(
295
296
  "span",
296
297
  {
297
298
  className: "rounded bg-slate-100 px-1.5 py-0.5 text-[10.5px] text-slate-700 dark:bg-muted dark:text-foreground",
298
299
  children: [
299
- o.label,
300
+ s.label,
300
301
  ": ",
301
- /* @__PURE__ */ n("span", { className: "line-through opacity-60", children: o.from }),
302
+ /* @__PURE__ */ n("span", { className: "line-through opacity-60", children: s.from }),
302
303
  " ",
303
304
  "→ ",
304
- /* @__PURE__ */ n("span", { className: "font-medium", children: o.to })
305
+ /* @__PURE__ */ n("span", { className: "font-medium", children: s.to })
305
306
  ]
306
307
  },
307
- `${o.item_id}|${o.field}|${U}`
308
+ `${s.item_id}|${s.field}|${U}`
308
309
  )),
309
- e.preview.length > 8 && /* @__PURE__ */ d("span", { className: "text-[10.5px] text-slate-400", children: [
310
+ e.preview.length > 8 && /* @__PURE__ */ o("span", { className: "text-[10.5px] text-slate-400", children: [
310
311
  "+",
311
312
  e.preview.length - 8,
312
313
  " more"
313
314
  ] })
314
315
  ] }),
315
- e.kind === "pick" && /* @__PURE__ */ d("div", { className: "mt-1.5", children: [
316
+ e.kind === "pick" && /* @__PURE__ */ o("div", { className: "mt-1.5", children: [
316
317
  (((C = e.choices) == null ? void 0 : C.length) ?? 0) > 8 && /* @__PURE__ */ n(
317
318
  "input",
318
319
  {
319
320
  value: l,
320
- onChange: (o) => k(o.target.value),
321
+ onChange: (s) => b(s.target.value),
321
322
  placeholder: "Filter options…",
322
323
  className: "mb-1 h-6 w-full rounded border border-slate-200 bg-white px-2 text-[11px] dark:border-border dark:bg-background"
323
324
  }
324
325
  ),
325
- /* @__PURE__ */ d("div", { className: "flex max-h-36 flex-wrap gap-1 overflow-y-auto", children: [
326
- w.map((o) => /* @__PURE__ */ n(
326
+ /* @__PURE__ */ o("div", { className: "flex max-h-36 flex-wrap gap-1 overflow-y-auto", children: [
327
+ w.map((s) => /* @__PURE__ */ n(
327
328
  "button",
328
329
  {
329
330
  type: "button",
330
- onClick: () => R((U) => ({ ...U, [e.id]: o.id })),
331
+ onClick: () => R((U) => ({ ...U, [e.id]: s.id })),
331
332
  className: K(
332
333
  "rounded border px-1.5 py-0.5 text-[11px] transition-colors",
333
- x === o.id ? "border-nvr-cyan bg-nvr-cyan/10 text-slate-900 dark:text-foreground" : "border-slate-200 text-slate-700 hover:bg-muted dark:border-border dark:text-foreground"
334
+ x === s.id ? "border-nvr-cyan bg-nvr-cyan/10 text-slate-900 dark:text-foreground" : "border-slate-200 text-slate-700 hover:bg-muted dark:border-border dark:text-foreground"
334
335
  ),
335
- children: o.label
336
+ children: s.label
336
337
  },
337
- o.id
338
+ s.id
338
339
  )),
339
340
  w.length === 0 && /* @__PURE__ */ n("span", { className: "text-[11px] text-slate-400", children: "No options match." })
340
341
  ] })
@@ -365,7 +366,7 @@ function se({
365
366
  e.id
366
367
  );
367
368
  }),
368
- /* @__PURE__ */ d("div", { className: "flex items-center gap-2 pt-0.5", children: [
369
+ /* @__PURE__ */ o("div", { className: "flex items-center gap-2 pt-0.5", children: [
369
370
  !y.some((e) => e.kind === "ai") && /* @__PURE__ */ n(
370
371
  "button",
371
372
  {
@@ -392,16 +393,16 @@ function se({
392
393
  }
393
394
  );
394
395
  }
395
- function F(r) {
396
+ function F(t) {
396
397
  var a;
397
- const t = r;
398
- return String(((a = t == null ? void 0 : t.response) == null ? void 0 : a.error) ?? (t == null ? void 0 : t.message) ?? "Request failed");
398
+ const r = t;
399
+ return String(((a = r == null ? void 0 : r.response) == null ? void 0 : a.error) ?? (r == null ? void 0 : r.message) ?? "Request failed");
399
400
  }
400
401
  export {
401
- de as OWN_RECORD_WRITES_EVENT,
402
- he as RecordIntegrityBanner,
403
- oe as findingFieldLabel,
404
- pe as integrityByField,
402
+ oe as OWN_RECORD_WRITES_EVENT,
403
+ ke as RecordIntegrityBanner,
404
+ se as findingFieldLabel,
405
+ be as integrityByField,
405
406
  H as ownWritesOf,
406
- ie as useRecordIntegrity
407
+ de as useRecordIntegrity
407
408
  };
@@ -1,22 +1,26 @@
1
- function o(t, n) {
2
- return { _method: "GET", _path: t, _params: n };
1
+ function n(t, o) {
2
+ return { _method: "GET", _path: t, _params: o };
3
3
  }
4
- function _(t, n) {
5
- return { _method: "POST", _path: t, _body: n };
4
+ function e(t) {
5
+ return n("/collection-layouts/active", { ...t, optional: 1 });
6
6
  }
7
- function e(t, n) {
8
- return { _method: "PATCH", _path: t, _body: n };
7
+ function u(t, o) {
8
+ return { _method: "POST", _path: t, _body: o };
9
9
  }
10
- function r(t, n) {
11
- return { _method: "PUT", _path: t, _body: n };
10
+ function r(t, o) {
11
+ return { _method: "PATCH", _path: t, _body: o };
12
12
  }
13
- function h(t) {
13
+ function _(t, o) {
14
+ return { _method: "PUT", _path: t, _body: o };
15
+ }
16
+ function a(t) {
14
17
  return { _method: "DELETE", _path: t };
15
18
  }
16
19
  export {
17
- h as del,
18
- o as get,
19
- e as patch,
20
- _ as post,
21
- r as put
20
+ a as del,
21
+ n as get,
22
+ e as getActiveLayout,
23
+ r as patch,
24
+ u as post,
25
+ _ as put
22
26
  };
@@ -106,7 +106,7 @@ const h = {
106
106
  // ── The platform ───────────────────────────────────────────────────────────
107
107
  MAINTENANCE: "Wait until maintenance ends, then try again.",
108
108
  SERVER_BUSY: "Try again in a few seconds.",
109
- DB_UNAVAILABLE: "The database cannot be reached right now. Try again in a minute.",
109
+ DB_UNAVAILABLE: "Try again in a moment.",
110
110
  MIGRATION_PENDING: "An update is still being applied. Try again in a few minutes.",
111
111
  NOT_CONFIGURED: "Ask an administrator to set this up first.",
112
112
  NOT_READY: "This is still being set up. Try again in a few minutes.",
@@ -0,0 +1,12 @@
1
+ import { describeError as e } from "./error-message.js";
2
+ import { partnerCallText as n } from "./partner-failure.js";
3
+ import { isRawErrorText as o } from "./safe-error.js";
4
+ function u(i) {
5
+ const r = (i ?? "").trim();
6
+ if (!r) return null;
7
+ const t = n(r);
8
+ return t || (o(r) ? e({ message: r }, "This did not finish").title.trim() || "This did not finish" : r);
9
+ }
10
+ export {
11
+ u as jobFailureText
12
+ };
@@ -0,0 +1,9 @@
1
+ import { partnerCallText as e } from "./partner-failure.js";
2
+ import { serverErrorText as i } from "./safe-error.js";
3
+ function p(n, r) {
4
+ const t = i(n), o = t ? e(t) : null;
5
+ return o ? { title: `${(r == null ? void 0 : r.trim()) || "The move"} did not go through`, description: o } : null;
6
+ }
7
+ export {
8
+ p as partnerMoveFailure
9
+ };
@@ -1,16 +1,17 @@
1
1
  import { toneForOutcome as d } from "./obligation-filters.js";
2
2
  import { plainObligationReason as f } from "./obligation-reason-text.js";
3
- import { formatDate as $, getDisplayTimezone as p } from "./utils.js";
4
- const g = (o) => {
5
- const t = p();
3
+ import { partnerFailureText as p } from "./partner-failure.js";
4
+ import { formatDate as $, getDisplayTimezone as g } from "./utils.js";
5
+ const _ = (o) => {
6
+ const t = g();
6
7
  return new Intl.DateTimeFormat("en-US", {
7
8
  hour: "numeric",
8
9
  minute: "2-digit",
9
10
  ...t ? { timeZone: t } : {}
10
11
  }).format(new Date(o));
11
12
  };
12
- function _(o, t) {
13
- const l = t.getTime() - new Date(o).getTime(), e = Math.floor(l / 6e4);
13
+ function h(o, t) {
14
+ const r = t.getTime() - new Date(o).getTime(), e = Math.floor(r / 6e4);
14
15
  if (e < 1) return "just now";
15
16
  if (e < 60) return `${e}m ago`;
16
17
  const n = Math.floor(e / 60);
@@ -18,25 +19,25 @@ function _(o, t) {
18
19
  const i = Math.floor(n / 24);
19
20
  return i < 7 ? `${i}d ago` : $(o);
20
21
  }
21
- function h(o) {
22
+ function w(o) {
22
23
  return o.split(/[._-]+/).filter(Boolean).map((t) => t[0].toUpperCase() + t.slice(1)).join(" ");
23
24
  }
24
- function T(o, t = /* @__PURE__ */ new Date()) {
25
- const l = /* @__PURE__ */ new Map();
25
+ function M(o, t = /* @__PURE__ */ new Date()) {
26
+ const r = /* @__PURE__ */ new Map();
26
27
  for (const e of o) {
27
28
  if (e.outcome === "superseded") continue;
28
- const n = l.get(e.api);
29
- (!n || e.id > n.id) && l.set(e.api, e);
29
+ const n = r.get(e.api);
30
+ (!n || e.id > n.id) && r.set(e.api, e);
30
31
  }
31
- return [...l.values()].map((e) => {
32
+ return [...r.values()].map((e) => {
32
33
  var c;
33
- const n = e.resolved_at ?? e.due_at, i = `${_(n, t)} (${g(n)})`, r = e.reason ? ` — ${f(e.reason)}` : "", u = ((c = e.label) == null ? void 0 : c.trim()) || (e.trigger === "transition" ? h(e.kind) : ""), a = u ? ` · ${u}` : "";
34
+ const n = e.resolved_at ?? e.due_at, i = `${h(n, t)} (${_(n)})`, l = e.reason ? ` — ${p(e.reason) ?? f(e.reason)}` : "", u = ((c = e.label) == null ? void 0 : c.trim()) || (e.trigger === "transition" ? w(e.kind) : ""), a = u ? ` · ${u}` : "";
34
35
  let s;
35
36
  if (e.outcome === "sent") s = `told ${i}${a}`;
36
37
  else if (e.outcome === "pending") {
37
38
  const m = Math.round((t.getTime() - new Date(e.due_at).getTime()) / 6e4);
38
39
  s = `sent ${i}${a}, awaiting acknowledgement (${m} min)`;
39
- } else e.outcome === "skipped" ? s = `should have been told ${i}${a}${r}` : e.outcome === "failed" ? s = `send failed ${i}${a}${r}` : e.outcome === "missing" ? s = `never told${a}${r}` : s = `still not told${a}${r}`;
40
+ } else e.outcome === "skipped" ? s = `should have been told ${i}${a}${l}` : e.outcome === "failed" ? s = `send failed ${i}${a}${l}` : e.outcome === "missing" ? s = `never told${a}${l}` : s = `still not told${a}${l}`;
40
41
  return {
41
42
  api: e.api,
42
43
  tone: d(e.outcome),
@@ -53,5 +54,5 @@ function T(o, t = /* @__PURE__ */ new Date()) {
53
54
  });
54
55
  }
55
56
  export {
56
- T as bannerLines
57
+ M as bannerLines
57
58
  };