@nivaro/react 0.3.139 → 0.3.140

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 (87) hide show
  1. package/dist/components/InlineGridField.js +95 -92
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +36 -2
  4. package/dist/shared/components/AudienceConfirmPanel.js +19 -19
  5. package/dist/shared/components/BroadcastView.js +213 -211
  6. package/dist/shared/components/CollectionBrowserView.js +2677 -2658
  7. package/dist/shared/components/ConfigHistory.js +45 -45
  8. package/dist/shared/components/ConformanceView.js +110 -110
  9. package/dist/shared/components/DataTable.js +51 -51
  10. package/dist/shared/components/FilePreviewLightbox.js +26 -25
  11. package/dist/shared/components/ItemEditForm.js +3038 -3027
  12. package/dist/shared/components/LiveCount.js +27 -23
  13. package/dist/shared/components/LiveTraceView.js +62 -61
  14. package/dist/shared/components/PageRenderer.js +422 -410
  15. package/dist/shared/components/ProfileView.js +199 -199
  16. package/dist/shared/components/QualityRulesView.js +70 -70
  17. package/dist/shared/components/QueryTable.js +131 -130
  18. package/dist/shared/components/RecordGraph.js +98 -98
  19. package/dist/shared/components/RecordReadView.js +287 -288
  20. package/dist/shared/components/ReportView.js +1279 -1259
  21. package/dist/shared/components/SlaRulesView.js +73 -74
  22. package/dist/shared/components/WidgetSlot.js +73 -73
  23. package/dist/shared/components/ai/AiChart.js +36 -32
  24. package/dist/shared/components/ai/AiMarkdown.js +136 -129
  25. package/dist/shared/components/ai/TaskDo.js +87 -87
  26. package/dist/shared/components/ai/answer-formats.js +37 -30
  27. package/dist/shared/components/ai/call-log/format.js +17 -16
  28. package/dist/shared/components/bulk/BulkActionButtons.js +66 -66
  29. package/dist/shared/components/bulk/BulkFieldUpdate.js +59 -59
  30. package/dist/shared/components/bulk/BulkSelectionNotices.js +34 -34
  31. package/dist/shared/components/bulk/MessageStakeholders.js +31 -29
  32. package/dist/shared/components/bulk/PushBulkButtons.js +83 -82
  33. package/dist/shared/components/bulk/bulk-field-options.js +10 -10
  34. package/dist/shared/components/cbv/column-totals.js +53 -51
  35. package/dist/shared/components/chat/ChatAnalyticsView.js +87 -87
  36. package/dist/shared/components/collections-directory/CollectionsToolbar.js +18 -18
  37. package/dist/shared/components/command-center/announce.js +7 -6
  38. package/dist/shared/components/command-center/panels/AttentionPanel.js +32 -31
  39. package/dist/shared/components/command-center/panels/FlowPanel.js +29 -28
  40. package/dist/shared/components/command-center/panels/PeoplePanel.js +39 -39
  41. package/dist/shared/components/delegation/DelegationConsoleView.js +27 -27
  42. package/dist/shared/components/imports/RunDetailSheet.js +1 -1
  43. package/dist/shared/components/integrations/IntegrationObligationsView.js +119 -119
  44. package/dist/shared/components/integrations/console/EventsView.js +35 -35
  45. package/dist/shared/components/integrations/console/FirefightView.js +15 -14
  46. package/dist/shared/components/integrations/console/PartnerDetail.js +78 -78
  47. package/dist/shared/components/integrations/console/ReadyToSendView.js +103 -103
  48. package/dist/shared/components/integrations/console/SignalCard.js +67 -67
  49. package/dist/shared/components/item-edit/CatalogPickerField.js +536 -527
  50. package/dist/shared/components/item-edit/ChangesTray.js +88 -74
  51. package/dist/shared/components/item-edit/FilePickerField.js +123 -123
  52. package/dist/shared/components/item-edit/GroupSection.js +301 -292
  53. package/dist/shared/components/item-edit/HeaderSummaryChip.js +54 -54
  54. package/dist/shared/components/item-edit/InlineGridField.js +45 -36
  55. package/dist/shared/components/item-edit/InlineTableField.js +1167 -1153
  56. package/dist/shared/components/item-edit/NestedRelationEditor.js +106 -99
  57. package/dist/shared/components/item-edit/RecordChatMentionsChip.js +11 -11
  58. package/dist/shared/components/layout-editor/ai-forms/SlimPanel.js +43 -44
  59. package/dist/shared/components/monitoring/ApiRequestLog.js +35 -35
  60. package/dist/shared/components/notifications/NotificationCenterView.js +268 -268
  61. package/dist/shared/components/ops-report/format.js +37 -36
  62. package/dist/shared/components/panels/ReferencedByPanel.js +21 -20
  63. package/dist/shared/components/panels/RevisionsPanel.js +306 -305
  64. package/dist/shared/components/pipeline/OwnerMatrixVersionsCard.js +12 -12
  65. package/dist/shared/components/pipeline/PipelineEditorView.js +483 -482
  66. package/dist/shared/components/pipeline/PipelineHealthCards.js +33 -32
  67. package/dist/shared/components/pipeline/TeamsView.js +189 -130
  68. package/dist/shared/components/profile/AgentsPanel.js +6 -6
  69. package/dist/shared/components/profile/DelegationCard.js +13 -12
  70. package/dist/shared/components/profile/PersonActivity.js +48 -48
  71. package/dist/shared/components/profile/PersonExtras.js +107 -107
  72. package/dist/shared/components/profile/PersonWeek.js +9 -9
  73. package/dist/shared/components/queue/QueueBulkBar.js +19 -18
  74. package/dist/shared/components/queue/QueueBulkMove.js +21 -20
  75. package/dist/shared/components/queue/QueueItemSheet.js +136 -131
  76. package/dist/shared/components/queue/QueueWorklist.js +671 -670
  77. package/dist/shared/components/queue/worklist-helpers.js +36 -21
  78. package/dist/shared/components/support/RequestList.js +121 -121
  79. package/dist/shared/components/support/SupportAnalytics.js +29 -29
  80. package/dist/shared/lib/activity-sentence.js +251 -229
  81. package/dist/shared/lib/format-value.js +5 -4
  82. package/dist/shared/lib/number-format.js +87 -0
  83. package/dist/shared/lib/number-kind.js +133 -0
  84. package/dist/shared/lib/utils.js +24 -20
  85. package/dist/shared/lib/watch-list.js +1 -1
  86. package/dist/shared/lib/widget-value-format.js +26 -12
  87. package/package.json +1 -1
@@ -3,22 +3,22 @@ import { RefreshCw as ie, Search as Se, X as Pe, ArrowUpRight as Ee, ArrowDownLe
3
3
  import { useState as g, useId as Oe, useEffect as L, useMemo as S } from "react";
4
4
  import { toast as ne } from "sonner";
5
5
  import { useDebounced as Te } from "../../../hooks/useDebounced.js";
6
- import { cn as N } from "../../../lib/utils.js";
7
- import { Checkbox as Ie } from "../../ui/checkbox.js";
6
+ import { cn as N, formatNumber as Ie } from "../../../lib/utils.js";
7
+ import { Checkbox as Re } from "../../ui/checkbox.js";
8
8
  import { SimpleSelect as K } from "../../ui/SimpleSelect.js";
9
- import { useIntegrationEvents as Re, useReplayEvent as Ae } from "./api.js";
10
- import { agoText as le, exactTime as ce, TONE_TEXT as de, TONE_SOFT as ue, TONE_BORDER as $e, TONE_FILL as Fe } from "./tone.js";
11
- import { EventPathSheet as Le } from "./event-path/EventPathSheet.js";
12
- const Ke = {
9
+ import { useIntegrationEvents as Ae, useReplayEvent as $e } from "./api.js";
10
+ import { agoText as le, exactTime as ce, TONE_TEXT as de, TONE_SOFT as ue, TONE_BORDER as Fe, TONE_FILL as Le } from "./tone.js";
11
+ import { EventPathSheet as Ke } from "./event-path/EventPathSheet.js";
12
+ const Me = {
13
13
  ok: "positive",
14
14
  error: "negative",
15
15
  info: "neutral"
16
- }, oe = { ok: "OK", error: "Problem", info: "Info" }, Me = [
16
+ }, oe = { ok: "OK", error: "Problem", info: "Info" }, Ue = [
17
17
  ["", "All"],
18
18
  ["out", "Outbound"],
19
19
  ["in", "Inbound"],
20
20
  ["poll", "Polls & feeds"]
21
- ], Ue = {
21
+ ], Ye = {
22
22
  in: _e,
23
23
  out: Ee,
24
24
  poll: ie
@@ -27,7 +27,7 @@ const Ke = {
27
27
  out: "Outbound — we pushed to a partner",
28
28
  poll: "Poll or feed — we asked the partner"
29
29
  }, O = (t) => t.provider ?? t.source ?? "", T = (t) => `${O(t)}:${t.id}`;
30
- function Ye(t) {
30
+ function je(t) {
31
31
  const o = (a) => [
32
32
  O(a),
33
33
  a.collection ?? "",
@@ -46,13 +46,13 @@ function Ye(t) {
46
46
  }
47
47
  return i.map(({ event: a, repeats: d }) => ({ event: a, repeats: d }));
48
48
  }
49
- const je = [
49
+ const Be = [
50
50
  ["", "All"],
51
51
  ["error", "Problems"],
52
52
  ["ok", "OK"],
53
53
  ["info", "Info"]
54
54
  ];
55
- function Be(t, o = /* @__PURE__ */ new Date()) {
55
+ function We(t, o = /* @__PURE__ */ new Date()) {
56
56
  const i = new Date(t), a = (c) => new Date(c.getFullYear(), c.getMonth(), c.getDate()).getTime(), d = Math.round((a(o) - a(i)) / 864e5);
57
57
  return d === 0 ? "Today" : d === 1 ? "Yesterday" : i.toLocaleDateString(void 0, {
58
58
  weekday: "long",
@@ -61,7 +61,7 @@ function Be(t, o = /* @__PURE__ */ new Date()) {
61
61
  ...i.getFullYear() !== o.getFullYear() ? { year: "numeric" } : {}
62
62
  });
63
63
  }
64
- const We = (t) => {
64
+ const Xe = (t) => {
65
65
  const o = new Date(t);
66
66
  return `${o.getFullYear()}-${o.getMonth()}-${o.getDate()}`;
67
67
  };
@@ -101,8 +101,8 @@ function se({
101
101
  }
102
102
  );
103
103
  }
104
- function Xe({ event: t }) {
105
- const o = Ae(), [i, a] = g(!1), d = T(t), c = o.isPending;
104
+ function qe({ event: t }) {
105
+ const o = $e(), [i, a] = g(!1), d = T(t), c = o.isPending;
106
106
  return /* @__PURE__ */ r(
107
107
  "button",
108
108
  {
@@ -141,7 +141,7 @@ function Xe({ event: t }) {
141
141
  }
142
142
  );
143
143
  }
144
- function qe({
144
+ function He({
145
145
  event: t,
146
146
  onOpenRecord: o
147
147
  }) {
@@ -163,14 +163,14 @@ function qe({
163
163
  }
164
164
  ) : /* @__PURE__ */ r("span", { className: "font-medium text-foreground", children: a });
165
165
  }
166
- function He({
166
+ function Ve({
167
167
  event: t,
168
168
  repeats: o = 1,
169
169
  direction: i,
170
170
  onOpenRecord: a,
171
171
  onSelect: d
172
172
  }) {
173
- const c = t.status ?? "info", m = Ke[c] ?? "neutral", u = T(t), h = i ? Ue[i] : null, f = (b) => {
173
+ const c = t.status ?? "info", m = Me[c] ?? "neutral", u = T(t), h = i ? Ye[i] : null, f = (b) => {
174
174
  b.target === b.currentTarget && (b.key === "Enter" || b.key === " ") && (b.preventDefault(), d(t));
175
175
  };
176
176
  return /* @__PURE__ */ s(
@@ -212,7 +212,7 @@ function He({
212
212
  /* @__PURE__ */ r(
213
213
  "span",
214
214
  {
215
- className: N("h-2 w-2 shrink-0 rounded-full", Fe[m]),
215
+ className: N("h-2 w-2 shrink-0 rounded-full", Le[m]),
216
216
  role: "img",
217
217
  "aria-label": oe[c] ?? "Info",
218
218
  "data-tip": oe[c] ?? "Info"
@@ -222,9 +222,9 @@ function He({
222
222
  ] }),
223
223
  /* @__PURE__ */ s("div", { className: "min-w-0 flex-1", children: [
224
224
  /* @__PURE__ */ s("p", { className: "flex flex-wrap items-baseline gap-x-2 text-[13px] leading-5", children: [
225
- /* @__PURE__ */ r(qe, { event: t, onOpenRecord: a }),
225
+ /* @__PURE__ */ r(He, { event: t, onOpenRecord: a }),
226
226
  t.record_count != null && t.record_count > 1 && /* @__PURE__ */ s("span", { className: "text-[12px] tabular-nums text-muted-foreground", children: [
227
- t.record_count,
227
+ Ie(t.record_count),
228
228
  " records"
229
229
  ] }),
230
230
  o > 1 && /* @__PURE__ */ s(
@@ -262,7 +262,7 @@ function He({
262
262
  ]
263
263
  }
264
264
  ),
265
- t.replayable && /* @__PURE__ */ r(Xe, { event: t })
265
+ t.replayable && /* @__PURE__ */ r(qe, { event: t })
266
266
  ]
267
267
  }
268
268
  );
@@ -273,9 +273,9 @@ function M({ title: t, children: o }) {
273
273
  /* @__PURE__ */ r("div", { className: "mt-1 max-w-[70ch] text-[12.5px] text-muted-foreground", children: o })
274
274
  ] });
275
275
  }
276
- function at({ onOpenRecord: t }) {
276
+ function st({ onOpenRecord: t }) {
277
277
  var V, z, G, J, Q, Z;
278
- const [o, i] = g(""), [a, d] = g(""), [c, m] = g(""), [u, h] = g(""), [f, b] = g(""), [U, I] = g(""), [R, A] = g(!1), [w, $] = g(null), v = Te(U.trim(), 350), Y = Oe(), [j, pe] = g([]), B = j.filter((e) => e.can_list), W = o ? B.filter((e) => e.direction === o) : B, me = a || (o && W.length === 1 ? W[0].id : ""), l = Re({
278
+ const [o, i] = g(""), [a, d] = g(""), [c, m] = g(""), [u, h] = g(""), [f, b] = g(""), [U, I] = g(""), [R, A] = g(!1), [w, $] = g(null), v = Te(U.trim(), 350), Y = Oe(), [j, pe] = g([]), B = j.filter((e) => e.can_list), W = o ? B.filter((e) => e.direction === o) : B, me = a || (o && W.length === 1 ? W[0].id : ""), l = Ae({
279
279
  provider: me,
280
280
  status: c,
281
281
  partner: u || void 0,
@@ -324,10 +324,10 @@ function at({ onOpenRecord: t }) {
324
324
  }, [y, f]), xe = S(() => {
325
325
  const e = [];
326
326
  for (const n of _) {
327
- const p = We(n.created_at), x = e[e.length - 1];
328
- x && x.key === p ? x.items.push(n) : e.push({ key: p, label: Be(n.created_at), items: [n] });
327
+ const p = Xe(n.created_at), x = e[e.length - 1];
328
+ x && x.key === p ? x.items.push(n) : e.push({ key: p, label: We(n.created_at), items: [n] });
329
329
  }
330
- return e.map((n) => ({ ...n, rows: Ye(n.items) }));
330
+ return e.map((n) => ({ ...n, rows: je(n.items) }));
331
331
  }, [_]), ve = o !== "" || a !== "" || c !== "" || u !== "" || f !== "" || v !== "" || R, D = l.dataUpdatedAt ? new Date(l.dataUpdatedAt).toISOString() : null, ye = l.isRefetching && fe && !l.isFetchingNextPage;
332
332
  L(() => {
333
333
  l.isRefetching || X(!1);
@@ -370,7 +370,7 @@ function at({ onOpenRecord: t }) {
370
370
  se,
371
371
  {
372
372
  value: o,
373
- options: Me,
373
+ options: Ue,
374
374
  onChange: we,
375
375
  label: "Direction",
376
376
  "data-ic-events-direction": !0
@@ -410,7 +410,7 @@ function at({ onOpenRecord: t }) {
410
410
  se,
411
411
  {
412
412
  value: c,
413
- options: je,
413
+ options: Be,
414
414
  onChange: m,
415
415
  label: "Status",
416
416
  "data-ic-events-status": !0
@@ -445,7 +445,7 @@ function at({ onOpenRecord: t }) {
445
445
  "data-tip": "Also list calls made with people's own tokens, not only integration accounts",
446
446
  children: [
447
447
  /* @__PURE__ */ r(
448
- Ie,
448
+ Re,
449
449
  {
450
450
  id: Y,
451
451
  checked: R,
@@ -514,7 +514,7 @@ function at({ onOpenRecord: t }) {
514
514
  {
515
515
  className: N(
516
516
  "rounded-lg border px-4 py-3 text-[12.5px]",
517
- $e.negative,
517
+ Fe.negative,
518
518
  ue.negative,
519
519
  de.negative
520
520
  ),
@@ -560,7 +560,7 @@ function at({ onOpenRecord: t }) {
560
560
  ] })
561
561
  ] }),
562
562
  /* @__PURE__ */ r("ul", { className: "divide-y divide-border overflow-hidden rounded-lg border border-border bg-card", children: e.rows.map(({ event: n, repeats: p }) => /* @__PURE__ */ r(
563
- He,
563
+ Ve,
564
564
  {
565
565
  event: n,
566
566
  repeats: p,
@@ -595,7 +595,7 @@ function at({ onOpenRecord: t }) {
595
595
  Ce,
596
596
  C,
597
597
  /* @__PURE__ */ r(
598
- Le,
598
+ Ke,
599
599
  {
600
600
  target: (w == null ? void 0 : w.target) ?? null,
601
601
  event: w == null ? void 0 : w.event,
@@ -607,8 +607,8 @@ function at({ onOpenRecord: t }) {
607
607
  ] });
608
608
  }
609
609
  export {
610
- at as EventsView,
610
+ st as EventsView,
611
611
  se as Segment,
612
- Ye as collapseRepeats,
613
- Be as dayHeading
612
+ je as collapseRepeats,
613
+ We as dayHeading
614
614
  };
@@ -2,12 +2,12 @@ import { jsxs as n, jsx as a, Fragment as R } from "react/jsx-runtime";
2
2
  import { RefreshCw as V, Clock as W, CheckCircle2 as X } from "lucide-react";
3
3
  import { useState as b, useEffect as j, useMemo as F } from "react";
4
4
  import { useNavigation as q } from "../../../context.js";
5
- import { cn as m } from "../../../lib/utils.js";
6
- import { useSignals as G, useRefreshSignals as H } from "./api.js";
7
- import { SignalCard as K, oldestSeen as I } from "./SignalCard.js";
8
- import { agoText as w, exactTime as Q, TONE_TEXT as h, TONE_SOFT as $, TONE_BORDER as L } from "./tone.js";
5
+ import { cn as m, formatNumber as G } from "../../../lib/utils.js";
6
+ import { useSignals as H, useRefreshSignals as K } from "./api.js";
7
+ import { SignalCard as Q, oldestSeen as I } from "./SignalCard.js";
8
+ import { agoText as w, exactTime as T, TONE_TEXT as h, TONE_SOFT as $, TONE_BORDER as L } from "./tone.js";
9
9
  const U = (d) => !!d.error || d.rows.length > 0 || d.snoozed.length > 0;
10
- function T(d) {
10
+ function Y(d) {
11
11
  return [...d].sort((i, u) => {
12
12
  if (!!i.error != !!u.error) return i.error ? 1 : -1;
13
13
  if (i.severity !== u.severity) return i.severity === "critical" ? -1 : 1;
@@ -15,14 +15,14 @@ function T(d) {
15
15
  return r && p && r !== p ? r < p ? -1 : 1 : !r != !p ? r ? -1 : 1 : i.label.localeCompare(u.label);
16
16
  });
17
17
  }
18
- function se({ onOpenRecord: d, onJumpTab: i, focusSignal: u }) {
18
+ function ae({ onOpenRecord: d, onJumpTab: i, focusSignal: u }) {
19
19
  var _, O, P;
20
- const { data: r, isLoading: p, isError: z, error: g } = G(), o = H(), v = q(), [A, k] = b(/* @__PURE__ */ new Set()), [y, B] = b(!1), [, D] = b(0);
20
+ const { data: r, isLoading: p, isError: z, error: g } = H(), o = K(), v = q(), [A, k] = b(/* @__PURE__ */ new Set()), [y, B] = b(!1), [, D] = b(0);
21
21
  j(() => {
22
22
  const e = setInterval(() => D((t) => t + 1), 3e4);
23
23
  return () => clearInterval(e);
24
24
  }, []);
25
- const l = F(() => T(((r == null ? void 0 : r.signals) ?? []).filter(U)), [r]), E = F(() => ((r == null ? void 0 : r.signals) ?? []).filter((e) => !U(e)), [r]);
25
+ const l = F(() => Y(((r == null ? void 0 : r.signals) ?? []).filter(U)), [r]), E = F(() => ((r == null ? void 0 : r.signals) ?? []).filter((e) => !U(e)), [r]);
26
26
  j(() => {
27
27
  if (y || !r) return;
28
28
  B(!0);
@@ -89,8 +89,9 @@ function se({ onOpenRecord: d, onJumpTab: i, focusSignal: u }) {
89
89
  /* @__PURE__ */ n("div", { className: "flex flex-wrap items-center gap-x-4 gap-y-2", children: [
90
90
  /* @__PURE__ */ n("p", { className: "text-[13px] text-muted-foreground", "data-ic-summary": !0, children: [
91
91
  N === 0 && x === 0 ? /* @__PURE__ */ a("span", { className: "font-medium text-foreground", children: "Nothing needs attention" }) : /* @__PURE__ */ n(R, { children: [
92
- /* @__PURE__ */ a("span", { className: "font-semibold tabular-nums text-foreground", children: N }),
93
- " problem",
92
+ /* @__PURE__ */ a("span", { className: "font-semibold tabular-nums text-foreground", children: G(N) }),
93
+ " ",
94
+ "problem",
94
95
  N === 1 ? "" : "s",
95
96
  " · ",
96
97
  /* @__PURE__ */ a(
@@ -116,7 +117,7 @@ function se({ onOpenRecord: d, onJumpTab: i, focusSignal: u }) {
116
117
  ] })
117
118
  ] }),
118
119
  " · ",
119
- /* @__PURE__ */ n("span", { "data-tip": Q(f), children: [
120
+ /* @__PURE__ */ n("span", { "data-tip": T(f), children: [
120
121
  "last checked ",
121
122
  w(f)
122
123
  ] })
@@ -180,7 +181,7 @@ function se({ onOpenRecord: d, onJumpTab: i, focusSignal: u }) {
180
181
  ]
181
182
  }
182
183
  ) : /* @__PURE__ */ a("div", { className: "space-y-2", children: l.map((e) => /* @__PURE__ */ a(
183
- K,
184
+ Q,
184
185
  {
185
186
  signal: e,
186
187
  expanded: A.has(e.id),
@@ -202,6 +203,6 @@ function se({ onOpenRecord: d, onJumpTab: i, focusSignal: u }) {
202
203
  ] });
203
204
  }
204
205
  export {
205
- se as FirefightView,
206
- T as rankSignals
206
+ ae as FirefightView,
207
+ Y as rankSignals
207
208
  };
@@ -1,35 +1,35 @@
1
- import { jsx as e, jsxs as a, Fragment as $ } from "react/jsx-runtime";
2
- import { useQueryClient as q, useQuery as K, useMutation as S } from "@tanstack/react-query";
3
- import { Search as L, Loader2 as A, Play as Q, ChevronDown as M } from "lucide-react";
4
- import { useState as b, useRef as P, useEffect as E } from "react";
5
- import { useNivaroClient as O } from "../../../context.js";
6
- import { get as H, post as R } from "../../../lib/commands.js";
7
- import { cn as m } from "../../../lib/utils.js";
8
- import { Sheet as j, SheetContent as U, SheetTitle as N, SheetDescription as w } from "../../ui/sheet.js";
9
- import { IntegrationObligationsView as V } from "../IntegrationObligationsView.js";
10
- import { usePartner as W, useCallDetail as X } from "./api.js";
11
- import { ErrorExplanation as z } from "./ErrorExplanation.js";
12
- import { HealthPill as G, PartnerFlags as J, fmtPct as Y, fmtMs as v, HourlyBars as Z } from "./PartnerBits.js";
13
- import { SubmissionRow as I } from "./SubmissionRow.js";
14
- import { TONE_TEXT as h, TONE_SOFT as f, agoText as D, exactTime as F } from "./tone.js";
15
- import { describeCallTrigger as ee, TriggerChip as te } from "./drill/trigger.js";
16
- import { HeaderTable as k, CodeBlock as C, isTruncatedBody as _, pretty as T } from "./drill/json.js";
17
- import { HttpStatusChip as re } from "./drill/status.js";
18
- function ae(l) {
1
+ import { jsx as e, jsxs as a, Fragment as K } from "react/jsx-runtime";
2
+ import { useQueryClient as S, useQuery as L, useMutation as P } from "@tanstack/react-query";
3
+ import { Search as A, Loader2 as Q, Play as M, ChevronDown as H } from "lucide-react";
4
+ import { useState as b, useRef as E, useEffect as O } from "react";
5
+ import { useNivaroClient as R } from "../../../context.js";
6
+ import { get as j, post as D } from "../../../lib/commands.js";
7
+ import { cn as m, formatNumber as N } from "../../../lib/utils.js";
8
+ import { Sheet as U, SheetContent as V, SheetTitle as w, SheetDescription as k } from "../../ui/sheet.js";
9
+ import { IntegrationObligationsView as W } from "../IntegrationObligationsView.js";
10
+ import { usePartner as X, useCallDetail as z } from "./api.js";
11
+ import { ErrorExplanation as G } from "./ErrorExplanation.js";
12
+ import { HealthPill as J, PartnerFlags as Y, fmtPct as Z, fmtMs as v, HourlyBars as I } from "./PartnerBits.js";
13
+ import { SubmissionRow as ee } from "./SubmissionRow.js";
14
+ import { TONE_TEXT as h, TONE_SOFT as f, agoText as F, exactTime as B } from "./tone.js";
15
+ import { describeCallTrigger as te, TriggerChip as re } from "./drill/trigger.js";
16
+ import { HeaderTable as C, CodeBlock as _, isTruncatedBody as T, pretty as q } from "./drill/json.js";
17
+ import { HttpStatusChip as ae } from "./drill/status.js";
18
+ function ne(l) {
19
19
  return l != null && l >= 200 && l < 300;
20
20
  }
21
- const ne = [
21
+ const se = [
22
22
  { key: "calls", label: "Recent calls" },
23
23
  { key: "submissions", label: "Submissions" },
24
24
  { key: "obligations", label: "Obligations" },
25
25
  { key: "contracts", label: "Contracts" }
26
26
  ];
27
- function Se({ apiId: l, onClose: t, initialTab: r = "calls" }) {
28
- const { data: n, isLoading: o, isError: u } = W(l), [i, d] = b(r), c = n == null ? void 0 : n.card, g = P(0), x = (s) => {
27
+ function Pe({ apiId: l, onClose: t, initialTab: r = "calls" }) {
28
+ const { data: n, isLoading: o, isError: u } = X(l), [i, d] = b(r), c = n == null ? void 0 : n.card, g = E(0), x = (s) => {
29
29
  g.current += s ? 1 : -1;
30
30
  };
31
- return /* @__PURE__ */ e(j, { open: !0, onOpenChange: (s) => !s && t(), children: /* @__PURE__ */ a(
32
- U,
31
+ return /* @__PURE__ */ e(U, { open: !0, onOpenChange: (s) => !s && t(), children: /* @__PURE__ */ a(
32
+ V,
33
33
  {
34
34
  className: "flex flex-col gap-0 overflow-hidden p-0",
35
35
  style: { width: 1040, maxWidth: "94vw" },
@@ -39,24 +39,24 @@ function Se({ apiId: l, onClose: t, initialTab: r = "calls" }) {
39
39
  },
40
40
  children: [
41
41
  /* @__PURE__ */ e("div", { className: "shrink-0 border-b border-border px-6 pb-0 pt-5", children: o || !c ? /* @__PURE__ */ a("div", { className: "space-y-2 pb-4", children: [
42
- /* @__PURE__ */ e(N, { className: "sr-only", children: "Partner" }),
43
- /* @__PURE__ */ e(w, { className: "sr-only", children: "Loading partner detail" }),
42
+ /* @__PURE__ */ e(w, { className: "sr-only", children: "Partner" }),
43
+ /* @__PURE__ */ e(k, { className: "sr-only", children: "Loading partner detail" }),
44
44
  /* @__PURE__ */ e("div", { className: "h-5 w-48 animate-pulse rounded bg-[hsl(var(--nvr-skeleton))]" }),
45
45
  /* @__PURE__ */ e("div", { className: "h-4 w-80 animate-pulse rounded bg-[hsl(var(--nvr-skeleton))]" }),
46
46
  u && /* @__PURE__ */ e("p", { className: m("text-[12.5px]", h.negative), children: "Couldn't load this partner." })
47
- ] }) : /* @__PURE__ */ a($, { children: [
47
+ ] }) : /* @__PURE__ */ a(K, { children: [
48
48
  /* @__PURE__ */ a("div", { className: "flex flex-wrap items-center gap-2.5 pr-8", children: [
49
- /* @__PURE__ */ e(N, { className: "text-[17px] font-semibold", children: c.name }),
50
- /* @__PURE__ */ e(G, { health: c.health }),
51
- /* @__PURE__ */ e(J, { card: c })
49
+ /* @__PURE__ */ e(w, { className: "text-[17px] font-semibold", children: c.name }),
50
+ /* @__PURE__ */ e(J, { health: c.health }),
51
+ /* @__PURE__ */ e(Y, { card: c })
52
52
  ] }),
53
- /* @__PURE__ */ a(w, { className: "mt-1 text-[12.5px] text-muted-foreground", children: [
53
+ /* @__PURE__ */ a(k, { className: "mt-1 text-[12.5px] text-muted-foreground", children: [
54
54
  c.calls24,
55
55
  " call",
56
56
  c.calls24 === 1 ? "" : "s",
57
57
  " in the last 24 hours ·",
58
58
  " ",
59
- Y(c.success_pct24),
59
+ Z(c.success_pct24),
60
60
  " succeeded · typically ",
61
61
  v(c.p50_ms),
62
62
  ", slowest",
@@ -64,8 +64,8 @@ function Se({ apiId: l, onClose: t, initialTab: r = "calls" }) {
64
64
  v(c.p95_ms),
65
65
  c.owner ? ` · owner ${c.owner.name}` : ""
66
66
  ] }),
67
- /* @__PURE__ */ e(Z, { hourly: c.hourly, className: "mt-3 max-w-[720px]" }),
68
- /* @__PURE__ */ e("div", { role: "tablist", "aria-label": "Partner detail", className: "-mb-px mt-3 flex gap-5", children: ne.map((s) => /* @__PURE__ */ e(
67
+ /* @__PURE__ */ e(I, { hourly: c.hourly, className: "mt-3 max-w-[720px]" }),
68
+ /* @__PURE__ */ e("div", { role: "tablist", "aria-label": "Partner detail", className: "-mb-px mt-3 flex gap-5", children: se.map((s) => /* @__PURE__ */ e(
69
69
  "button",
70
70
  {
71
71
  type: "button",
@@ -83,16 +83,16 @@ function Se({ apiId: l, onClose: t, initialTab: r = "calls" }) {
83
83
  )) })
84
84
  ] }) }),
85
85
  /* @__PURE__ */ a("div", { className: "min-h-0 flex-1 overflow-y-auto bg-muted/30 px-6 py-5", children: [
86
- n && i === "calls" && /* @__PURE__ */ e(se, { apiId: l, calls: n.calls, onCallOpenChange: x }),
87
- n && i === "submissions" && /* @__PURE__ */ e(de, { apiId: l }),
88
- n && i === "obligations" && /* @__PURE__ */ e(V, { api: n.card.name }),
89
- n && i === "contracts" && /* @__PURE__ */ e(ce, { apiId: l, data: n })
86
+ n && i === "calls" && /* @__PURE__ */ e(ie, { apiId: l, calls: n.calls, onCallOpenChange: x }),
87
+ n && i === "submissions" && /* @__PURE__ */ e(ce, { apiId: l }),
88
+ n && i === "obligations" && /* @__PURE__ */ e(W, { api: n.card.name }),
89
+ n && i === "contracts" && /* @__PURE__ */ e(ue, { apiId: l, data: n })
90
90
  ] })
91
91
  ]
92
92
  }
93
93
  ) });
94
94
  }
95
- function se({
95
+ function ie({
96
96
  apiId: l,
97
97
  calls: t,
98
98
  onCallOpenChange: r
@@ -131,22 +131,22 @@ function se({
131
131
  {
132
132
  className: "divide-y divide-border overflow-hidden rounded-lg border border-border bg-card",
133
133
  "data-ic-calls": !0,
134
- children: i.map((d) => /* @__PURE__ */ e(ie, { apiId: l, call: d, onOpenChange: r }, d.key))
134
+ children: i.map((d) => /* @__PURE__ */ e(oe, { apiId: l, call: d, onOpenChange: r }, d.key))
135
135
  }
136
136
  )
137
137
  ] });
138
138
  }
139
- function ie({
139
+ function oe({
140
140
  apiId: l,
141
141
  call: t,
142
142
  onOpenChange: r
143
143
  }) {
144
144
  var c, g, x;
145
- const [n, o] = b(!1), u = P(null), i = ee(t.triggered_by, t.user), d = () => {
145
+ const [n, o] = b(!1), u = E(null), i = te(t.triggered_by, t.user), d = () => {
146
146
  var s;
147
147
  o(!1), (s = u.current) == null || s.focus();
148
148
  };
149
- return E(() => {
149
+ return O(() => {
150
150
  if (n)
151
151
  return r(!0), () => r(!1);
152
152
  }, [n]), /* @__PURE__ */ a(
@@ -173,8 +173,8 @@ function ie({
173
173
  "span",
174
174
  {
175
175
  className: "w-16 shrink-0 text-[11.5px] text-muted-foreground",
176
- "data-tip": F(t.created_at),
177
- children: D(t.created_at)
176
+ "data-tip": B(t.created_at),
177
+ children: F(t.created_at)
178
178
  }
179
179
  ),
180
180
  /* @__PURE__ */ a("span", { className: "min-w-0 flex-1 truncate font-mono text-[11.5px] text-foreground", children: [
@@ -213,7 +213,7 @@ function ie({
213
213
  }
214
214
  ),
215
215
  /* @__PURE__ */ e(
216
- M,
216
+ H,
217
217
  {
218
218
  className: m(
219
219
  "h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform",
@@ -241,15 +241,15 @@ function ie({
241
241
  s.key === "Escape" && (s.stopPropagation(), d());
242
242
  },
243
243
  className: "border-t border-border px-3 py-3",
244
- children: t.source === "outbound" ? /* @__PURE__ */ e("p", { className: "text-[12px] italic text-muted-foreground", "data-ic-call-empty": !0, children: "No request/response recorded for this call." }) : /* @__PURE__ */ e(oe, { apiId: l, callId: t.id })
244
+ children: t.source === "outbound" ? /* @__PURE__ */ e("p", { className: "text-[12px] italic text-muted-foreground", "data-ic-call-empty": !0, children: "No request/response recorded for this call." }) : /* @__PURE__ */ e(le, { apiId: l, callId: t.id })
245
245
  }
246
246
  )
247
247
  ]
248
248
  }
249
249
  );
250
250
  }
251
- function oe({ apiId: l, callId: t }) {
252
- const { data: r, isLoading: n, isError: o } = X(l, t);
251
+ function le({ apiId: l, callId: t }) {
252
+ const { data: r, isLoading: n, isError: o } = z(l, t);
253
253
  return n ? /* @__PURE__ */ a("div", { className: "space-y-2", children: [
254
254
  /* @__PURE__ */ e("div", { className: "h-4 w-40 animate-pulse rounded bg-[hsl(var(--nvr-skeleton))]" }),
255
255
  /* @__PURE__ */ a("div", { className: "grid gap-3 lg:grid-cols-2", children: [
@@ -259,7 +259,7 @@ function oe({ apiId: l, callId: t }) {
259
259
  ] }) : o || !r ? /* @__PURE__ */ e("p", { className: m("text-[12.5px]", h.negative), children: "Couldn't load this call." }) : /* @__PURE__ */ a("div", { className: "space-y-3", children: [
260
260
  /* @__PURE__ */ a("div", { className: "flex flex-wrap items-center gap-2", "data-ic-call-section": "trigger", children: [
261
261
  /* @__PURE__ */ e("span", { className: "text-[11.5px] font-semibold text-muted-foreground", children: "Triggered by" }),
262
- /* @__PURE__ */ e(te, { triggeredBy: r.triggered_by, user: r.user })
262
+ /* @__PURE__ */ e(re, { triggeredBy: r.triggered_by, user: r.user })
263
263
  ] }),
264
264
  /* @__PURE__ */ a("div", { className: "grid gap-3 lg:grid-cols-2", children: [
265
265
  /* @__PURE__ */ a("div", { className: "min-w-0 space-y-2", "data-ic-call-section": "request", children: [
@@ -276,24 +276,24 @@ function oe({ apiId: l, callId: t }) {
276
276
  ]
277
277
  }
278
278
  ),
279
- /* @__PURE__ */ e(k, { headers: r.request_headers }),
279
+ /* @__PURE__ */ e(C, { headers: r.request_headers }),
280
280
  /* @__PURE__ */ e(
281
- C,
281
+ _,
282
282
  {
283
283
  label: "Body",
284
- value: T(r.request_body),
284
+ value: q(r.request_body),
285
285
  fold: !0,
286
- truncated: _(r.request_body)
286
+ truncated: T(r.request_body)
287
287
  }
288
288
  )
289
289
  ] }),
290
290
  /* @__PURE__ */ a("div", { className: "min-w-0 space-y-2", "data-ic-call-section": "response", children: [
291
291
  /* @__PURE__ */ e("p", { className: "text-[11.5px] font-semibold text-muted-foreground", children: "Response" }),
292
292
  /* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
293
- /* @__PURE__ */ e(re, { status: r.response_status, ok: ae(r.response_status) }),
293
+ /* @__PURE__ */ e(ae, { status: r.response_status, ok: ne(r.response_status) }),
294
294
  /* @__PURE__ */ e("span", { className: "text-[11.5px] tabular-nums text-muted-foreground", children: v(r.duration_ms) })
295
295
  ] }),
296
- r.explanation ? /* @__PURE__ */ e(z, { explanation: r.explanation, raw: r.error }) : r.error && /* @__PURE__ */ e(
296
+ r.explanation ? /* @__PURE__ */ e(G, { explanation: r.explanation, raw: r.error }) : r.error && /* @__PURE__ */ e(
297
297
  "p",
298
298
  {
299
299
  className: m(
@@ -304,34 +304,34 @@ function oe({ apiId: l, callId: t }) {
304
304
  children: r.error
305
305
  }
306
306
  ),
307
- /* @__PURE__ */ e(k, { headers: r.response_headers }),
307
+ /* @__PURE__ */ e(C, { headers: r.response_headers }),
308
308
  /* @__PURE__ */ e(
309
- C,
309
+ _,
310
310
  {
311
311
  label: "Body",
312
- value: T(r.response_body),
312
+ value: q(r.response_body),
313
313
  fold: !0,
314
- truncated: _(r.response_body)
314
+ truncated: T(r.response_body)
315
315
  }
316
316
  )
317
317
  ] })
318
318
  ] })
319
319
  ] });
320
320
  }
321
- const le = "endpoint_path";
322
- function de({ apiId: l }) {
323
- const t = O(), r = q(), [n, o] = b(""), [u, i] = b("");
324
- E(() => {
321
+ const de = "endpoint_path";
322
+ function ce({ apiId: l }) {
323
+ const t = R(), r = S(), [n, o] = b(""), [u, i] = b("");
324
+ O(() => {
325
325
  const p = setTimeout(() => i(n.trim()), 350);
326
326
  return () => clearTimeout(p);
327
327
  }, [n]);
328
- const d = u.length >= 2 ? u : le, { data: c, isLoading: g, isError: x } = K({
328
+ const d = u.length >= 2 ? u : de, { data: c, isLoading: g, isError: x } = L({
329
329
  queryKey: ["erp-submissions", "partner", l, d],
330
330
  queryFn: () => t.request(
331
- H("/erp-submissions/search", { external_api: l, q: d, limit: 50 })
331
+ j("/erp-submissions/search", { external_api: l, q: d, limit: 50 })
332
332
  ).then((p) => p.data)
333
- }), s = S({
334
- mutationFn: (p) => t.request(R(`/erp-submissions/${p}/retry`)),
333
+ }), s = P({
334
+ mutationFn: (p) => t.request(D(`/erp-submissions/${p}/retry`)),
335
335
  onSettled: () => {
336
336
  r.invalidateQueries({ queryKey: ["erp-submissions"] }), r.invalidateQueries({ queryKey: ["erp-submission-attempts"] }), r.invalidateQueries({ queryKey: ["integration-partner", l] });
337
337
  }
@@ -339,7 +339,7 @@ function de({ apiId: l }) {
339
339
  return /* @__PURE__ */ a("div", { className: "space-y-3", children: [
340
340
  /* @__PURE__ */ a("div", { className: "flex items-center gap-3", children: [
341
341
  /* @__PURE__ */ a("div", { className: "relative w-full max-w-[420px]", children: [
342
- /* @__PURE__ */ e(L, { className: "pointer-events-none absolute left-2.5 top-2 h-3.5 w-3.5 text-muted-foreground" }),
342
+ /* @__PURE__ */ e(A, { className: "pointer-events-none absolute left-2.5 top-2 h-3.5 w-3.5 text-muted-foreground" }),
343
343
  /* @__PURE__ */ e(
344
344
  "input",
345
345
  {
@@ -354,19 +354,19 @@ function de({ apiId: l }) {
354
354
  /* @__PURE__ */ e("p", { className: "text-[12px] text-muted-foreground", children: u.length >= 2 ? `Matching “${u}”` : "Newest 50 from the last 90 days" })
355
355
  ] }),
356
356
  g ? /* @__PURE__ */ e("div", { className: "space-y-2", children: [0, 1, 2].map((p) => /* @__PURE__ */ e("div", { className: "h-10 animate-pulse rounded-lg bg-[hsl(var(--nvr-skeleton))]" }, p)) }) : x ? /* @__PURE__ */ e("p", { className: m("text-[12.5px]", h.negative), children: "Couldn't load submissions." }) : y.length === 0 ? /* @__PURE__ */ e("p", { className: "rounded-lg border border-border bg-card px-4 py-5 text-[12.5px] text-muted-foreground", children: u.length >= 2 ? "Nothing sent to this partner matches that." : "Nothing has been sent to this partner in the last 90 days." }) : /* @__PURE__ */ e("div", { className: "space-y-2", "data-ic-submissions": !0, children: y.map((p) => /* @__PURE__ */ e("div", { className: "bg-card", children: /* @__PURE__ */ e(
357
- I,
357
+ ee,
358
358
  {
359
359
  sub: p,
360
- onRetry: (B) => s.mutate(B),
360
+ onRetry: ($) => s.mutate($),
361
361
  retrying: s.isPending && s.variables === p.id
362
362
  }
363
363
  ) }, p.id)) })
364
364
  ] });
365
365
  }
366
- function ce({ apiId: l, data: t }) {
367
- const r = O(), n = q(), o = S({
366
+ function ue({ apiId: l, data: t }) {
367
+ const r = R(), n = S(), o = P({
368
368
  mutationFn: () => r.request(
369
- R(`/external-apis/${l}/contracts/run`)
369
+ D(`/external-apis/${l}/contracts/run`)
370
370
  ).then((i) => i.data),
371
371
  onSettled: () => n.invalidateQueries({ queryKey: ["integration-partner", l] })
372
372
  }), u = t.contracts;
@@ -382,7 +382,7 @@ function ce({ apiId: l, data: t }) {
382
382
  "data-ic-run-contracts": !0,
383
383
  className: "ml-auto inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-border bg-card px-3 text-[12.5px] font-medium text-foreground hover:bg-muted disabled:opacity-60",
384
384
  children: [
385
- o.isPending ? /* @__PURE__ */ e(A, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e(Q, { className: "h-3.5 w-3.5" }),
385
+ o.isPending ? /* @__PURE__ */ e(Q, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e(M, { className: "h-3.5 w-3.5" }),
386
386
  "Run contracts"
387
387
  ]
388
388
  }
@@ -397,7 +397,7 @@ function ce({ apiId: l, data: t }) {
397
397
  o.data.failed > 0 ? f.negative : f.positive,
398
398
  o.data.failed > 0 ? h.negative : h.positive
399
399
  ),
400
- children: o.data.failed > 0 ? `${o.data.failed} of ${o.data.results.length} failing` : `All ${o.data.results.length} passed`
400
+ children: o.data.failed > 0 ? `${N(o.data.failed)} of ${N(o.data.results.length)} failing` : `All ${o.data.results.length} passed`
401
401
  }
402
402
  ),
403
403
  o.isError && /* @__PURE__ */ e("p", { className: m("text-[12.5px]", h.negative), children: "The contracts couldn't run." }),
@@ -422,8 +422,8 @@ function ce({ apiId: l, data: t }) {
422
422
  "span",
423
423
  {
424
424
  className: "shrink-0 text-[12px] text-muted-foreground",
425
- "data-tip": F(i.last_run),
426
- children: i.last_run ? D(i.last_run) : ""
425
+ "data-tip": B(i.last_run),
426
+ children: i.last_run ? F(i.last_run) : ""
427
427
  }
428
428
  )
429
429
  ] }, i.endpoint_id);
@@ -431,5 +431,5 @@ function ce({ apiId: l, data: t }) {
431
431
  ] });
432
432
  }
433
433
  export {
434
- Se as PartnerDetail
434
+ Pe as PartnerDetail
435
435
  };