@nivaro/react 0.3.136 → 0.3.138
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.
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +95 -4
- package/dist/index.js +748 -743
- package/dist/shared/components/CollectionBrowserView.js +392 -389
- package/dist/shared/components/DelegateCoverLine.js +80 -87
- package/dist/shared/components/ItemEditForm.js +589 -588
- package/dist/shared/components/MyWorkView.js +284 -286
- package/dist/shared/components/NotificationBell.js +251 -205
- package/dist/shared/components/ai/AiAnalyticsView.js +878 -417
- package/dist/shared/components/ai/AiPlanCard.js +164 -122
- package/dist/shared/components/ai/AiPlanUndo.js +291 -0
- package/dist/shared/components/ai/call-log/CallDrawer.js +357 -0
- package/dist/shared/components/ai/call-log/RawJson.js +126 -0
- package/dist/shared/components/ai/call-log/ThreadView.js +223 -0
- package/dist/shared/components/ai/call-log/TranscriptView.js +227 -0
- package/dist/shared/components/ai/call-log/controls.js +364 -0
- package/dist/shared/components/ai/call-log/format.js +46 -0
- package/dist/shared/components/ai/call-log/url.js +105 -0
- package/dist/shared/components/chat/ChatPanel.js +86 -86
- package/dist/shared/components/chat/chat-core.js +422 -346
- package/dist/shared/components/integrations/IntegrationObligationsView.js +98 -98
- package/dist/shared/components/integrations/RecordIntegrationPreview.js +102 -93
- package/dist/shared/components/integrations/console/api.js +11 -1
- package/dist/shared/components/item-edit/HeaderRollupExplainer.js +5 -1
- package/dist/shared/components/item-edit/RecordLiveSync.js +241 -229
- package/dist/shared/components/item-edit/RecordRecapChanges.js +166 -0
- package/dist/shared/components/item-edit/RecordRecapStrip.js +254 -84
- package/dist/shared/components/item-edit/live-related.js +34 -18
- package/dist/shared/components/panels/RevisionsPanel.js +735 -683
- package/dist/shared/components/queue/QueueWorklist.js +323 -316
- package/dist/shared/components/support/SupportRequestDialog.js +198 -181
- package/dist/shared/components/trackers/use-tracker-link.js +74 -65
- package/dist/shared/lib/config-update-refresh.js +34 -0
- package/dist/shared/lib/config-watch.js +17 -17
- package/dist/shared/lib/gap-refresh.js +49 -0
- package/dist/shared/lib/integration-dots.js +8 -8
- package/dist/shared/lib/live-ops.js +26 -23
- package/dist/shared/lib/live-pickers.js +1 -1
- package/dist/shared/lib/live-queries.js +223 -195
- package/dist/shared/lib/live.js +56 -51
- package/dist/shared/lib/obligation-banner.js +11 -10
- package/dist/shared/lib/obligation-filters.js +22 -18
- package/dist/shared/lib/obligation-reason-text.js +18 -8
- package/dist/shared/lib/presence-hooks.js +133 -132
- package/dist/shared/lib/reconnect-resync.js +90 -0
- package/dist/shared/lib/record-room-holds.js +43 -0
- package/dist/shared/lib/socket-realtime.js +116 -105
- package/dist/shared/lib/user-sync.js +1 -6
- package/package.json +1 -1
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
import { jsxs as a, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as M, useQuery as j, useMutation as L } from "@tanstack/react-query";
|
|
3
|
+
import { Bookmark as I, Users as D, Trash2 as Q, ChevronsUpDown as R, Check as V, SlidersHorizontal as A } from "lucide-react";
|
|
4
|
+
import { useState as b, useEffect as B } from "react";
|
|
5
|
+
import { useNivaroClient as K } from "../../../context.js";
|
|
6
|
+
import { get as z, post as H, del as Y } from "../../../lib/commands.js";
|
|
7
|
+
import { toastError as T } from "../../../lib/error-toast.js";
|
|
8
|
+
import { cn as v } from "../../../lib/utils.js";
|
|
9
|
+
import { Segmented as G } from "../../delivery-analytics/ui.js";
|
|
10
|
+
import { Command as J, CommandInput as W, CommandList as X, CommandEmpty as Z, CommandItem as ee } from "../../ui/command.js";
|
|
11
|
+
import { Popover as k, PopoverTrigger as y, PopoverContent as N } from "../../ui/popover.js";
|
|
12
|
+
import { FILTER_KEYS as E, listOf as te, toggleIn as ne } from "./url.js";
|
|
13
|
+
const C = "inline-flex h-8 max-w-[220px] shrink-0 items-center gap-1.5 rounded-md border px-2.5 text-[12px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50", S = "border-slate-200 bg-white text-slate-600 hover:bg-slate-50 dark:border-border dark:bg-card dark:text-muted-foreground dark:hover:bg-muted", F = "border-nvr-cyan/60 bg-nvr-cyan/10 text-slate-900 dark:text-foreground";
|
|
14
|
+
function pe({
|
|
15
|
+
label: r,
|
|
16
|
+
paramKey: m,
|
|
17
|
+
params: u,
|
|
18
|
+
setParams: h,
|
|
19
|
+
options: d,
|
|
20
|
+
render: o
|
|
21
|
+
}) {
|
|
22
|
+
const [i, g] = b(!1), l = te(u, m), s = (n) => {
|
|
23
|
+
const c = d.find((p) => p.value === n);
|
|
24
|
+
return c ? o ? o(c) : c.label : n;
|
|
25
|
+
};
|
|
26
|
+
return /* @__PURE__ */ a(k, { open: i, onOpenChange: g, children: [
|
|
27
|
+
/* @__PURE__ */ e(y, { asChild: !0, children: /* @__PURE__ */ a(
|
|
28
|
+
"button",
|
|
29
|
+
{
|
|
30
|
+
type: "button",
|
|
31
|
+
"data-ai-filter": m,
|
|
32
|
+
"aria-label": `${r}: ${l.length ? l.map(s).join(", ") : "all"}`,
|
|
33
|
+
className: v(C, l.length ? F : S),
|
|
34
|
+
children: [
|
|
35
|
+
/* @__PURE__ */ e("span", { className: "text-slate-500 dark:text-muted-foreground", children: r }),
|
|
36
|
+
/* @__PURE__ */ e("span", { className: "min-w-0 truncate font-medium", children: l.length === 0 ? "All" : l.length === 1 ? s(l[0]) : `${l.length} picked` }),
|
|
37
|
+
/* @__PURE__ */ e(R, { className: "h-3 w-3 shrink-0 opacity-50", "aria-hidden": !0 })
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
) }),
|
|
41
|
+
/* @__PURE__ */ e(N, { className: "w-[280px] p-0", align: "start", children: /* @__PURE__ */ a(J, { children: [
|
|
42
|
+
/* @__PURE__ */ e(
|
|
43
|
+
W,
|
|
44
|
+
{
|
|
45
|
+
placeholder: `Find a ${r.toLowerCase()}…`,
|
|
46
|
+
className: "h-9 text-[12.5px]"
|
|
47
|
+
}
|
|
48
|
+
),
|
|
49
|
+
/* @__PURE__ */ a(X, { children: [
|
|
50
|
+
/* @__PURE__ */ e(Z, { children: "Nothing in this window." }),
|
|
51
|
+
d.map((n) => {
|
|
52
|
+
const c = l.includes(n.value);
|
|
53
|
+
return /* @__PURE__ */ a(
|
|
54
|
+
ee,
|
|
55
|
+
{
|
|
56
|
+
value: `${n.label} ${n.value}`,
|
|
57
|
+
onSelect: () => h((p) => ne(p, m, n.value), { replace: !0 }),
|
|
58
|
+
className: "text-[12.5px]",
|
|
59
|
+
children: [
|
|
60
|
+
/* @__PURE__ */ e(
|
|
61
|
+
"span",
|
|
62
|
+
{
|
|
63
|
+
className: v(
|
|
64
|
+
"mr-2 inline-flex h-3.5 w-3.5 items-center justify-center rounded-sm border",
|
|
65
|
+
c ? "border-nvr-cyan bg-nvr-cyan text-white" : "border-slate-300 dark:border-border"
|
|
66
|
+
),
|
|
67
|
+
"aria-hidden": !0,
|
|
68
|
+
children: c && /* @__PURE__ */ e(V, { className: "h-2.5 w-2.5" })
|
|
69
|
+
}
|
|
70
|
+
),
|
|
71
|
+
/* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate", children: o ? o(n) : n.label }),
|
|
72
|
+
/* @__PURE__ */ e("span", { className: "ml-2 text-[11px] tabular-nums text-slate-400", children: n.count.toLocaleString("en-US") })
|
|
73
|
+
]
|
|
74
|
+
},
|
|
75
|
+
n.value
|
|
76
|
+
);
|
|
77
|
+
})
|
|
78
|
+
] })
|
|
79
|
+
] }) })
|
|
80
|
+
] });
|
|
81
|
+
}
|
|
82
|
+
function x({
|
|
83
|
+
label: r,
|
|
84
|
+
value: m,
|
|
85
|
+
onChange: u,
|
|
86
|
+
step: h,
|
|
87
|
+
suffix: d
|
|
88
|
+
}) {
|
|
89
|
+
return /* @__PURE__ */ a("label", { className: "flex min-w-0 flex-col gap-0.5 text-[11px] text-slate-500 dark:text-muted-foreground", children: [
|
|
90
|
+
r,
|
|
91
|
+
/* @__PURE__ */ a("span", { className: "flex items-center gap-1", children: [
|
|
92
|
+
/* @__PURE__ */ e(
|
|
93
|
+
"input",
|
|
94
|
+
{
|
|
95
|
+
type: "number",
|
|
96
|
+
inputMode: "decimal",
|
|
97
|
+
min: 0,
|
|
98
|
+
step: h,
|
|
99
|
+
value: m,
|
|
100
|
+
onChange: (o) => u(o.target.value),
|
|
101
|
+
className: "h-8 w-full min-w-0 rounded-md border border-slate-200 bg-white px-2 text-[12px] text-slate-900 tabular-nums focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 dark:border-border dark:bg-background dark:text-foreground"
|
|
102
|
+
}
|
|
103
|
+
),
|
|
104
|
+
d && /* @__PURE__ */ e("span", { className: "shrink-0 text-[11px]", children: d })
|
|
105
|
+
] })
|
|
106
|
+
] });
|
|
107
|
+
}
|
|
108
|
+
function xe({
|
|
109
|
+
params: r,
|
|
110
|
+
setParams: m
|
|
111
|
+
}) {
|
|
112
|
+
const [u, h] = b(!1), o = [
|
|
113
|
+
"cost_min",
|
|
114
|
+
"cost_max",
|
|
115
|
+
"tokens_min",
|
|
116
|
+
"tokens_max",
|
|
117
|
+
"ms_min",
|
|
118
|
+
"ms_max",
|
|
119
|
+
"feedback",
|
|
120
|
+
"error"
|
|
121
|
+
].filter((s) => r.get(s)).length, i = (s) => (n) => m(
|
|
122
|
+
(c) => {
|
|
123
|
+
n ? c.set(s, n) : c.delete(s), c.delete("page");
|
|
124
|
+
},
|
|
125
|
+
{ replace: !0 }
|
|
126
|
+
), g = (s) => {
|
|
127
|
+
const n = r.get(s);
|
|
128
|
+
return n ? String(Number(n) / 1e3) : "";
|
|
129
|
+
}, l = (s) => (n) => i(s)(n ? String(Math.round(Number(n) * 1e3)) : "");
|
|
130
|
+
return /* @__PURE__ */ a(k, { open: u, onOpenChange: h, children: [
|
|
131
|
+
/* @__PURE__ */ e(y, { asChild: !0, children: /* @__PURE__ */ a(
|
|
132
|
+
"button",
|
|
133
|
+
{
|
|
134
|
+
type: "button",
|
|
135
|
+
className: v(C, o ? F : S),
|
|
136
|
+
"data-ai-more-filters": !0,
|
|
137
|
+
children: [
|
|
138
|
+
/* @__PURE__ */ e(A, { className: "h-3.5 w-3.5", "aria-hidden": !0 }),
|
|
139
|
+
"More filters",
|
|
140
|
+
o ? ` · ${o}` : ""
|
|
141
|
+
]
|
|
142
|
+
}
|
|
143
|
+
) }),
|
|
144
|
+
/* @__PURE__ */ e(N, { className: "w-[320px] p-3", align: "start", children: /* @__PURE__ */ a("div", { className: "grid grid-cols-2 gap-x-3 gap-y-2.5", children: [
|
|
145
|
+
/* @__PURE__ */ e(
|
|
146
|
+
x,
|
|
147
|
+
{
|
|
148
|
+
label: "Cost from ($)",
|
|
149
|
+
step: "0.001",
|
|
150
|
+
value: r.get("cost_min") ?? "",
|
|
151
|
+
onChange: i("cost_min")
|
|
152
|
+
}
|
|
153
|
+
),
|
|
154
|
+
/* @__PURE__ */ e(
|
|
155
|
+
x,
|
|
156
|
+
{
|
|
157
|
+
label: "Cost to ($)",
|
|
158
|
+
step: "0.001",
|
|
159
|
+
value: r.get("cost_max") ?? "",
|
|
160
|
+
onChange: i("cost_max")
|
|
161
|
+
}
|
|
162
|
+
),
|
|
163
|
+
/* @__PURE__ */ e(
|
|
164
|
+
x,
|
|
165
|
+
{
|
|
166
|
+
label: "Tokens from",
|
|
167
|
+
step: "100",
|
|
168
|
+
value: r.get("tokens_min") ?? "",
|
|
169
|
+
onChange: i("tokens_min")
|
|
170
|
+
}
|
|
171
|
+
),
|
|
172
|
+
/* @__PURE__ */ e(
|
|
173
|
+
x,
|
|
174
|
+
{
|
|
175
|
+
label: "Tokens to",
|
|
176
|
+
step: "100",
|
|
177
|
+
value: r.get("tokens_max") ?? "",
|
|
178
|
+
onChange: i("tokens_max")
|
|
179
|
+
}
|
|
180
|
+
),
|
|
181
|
+
/* @__PURE__ */ e(
|
|
182
|
+
x,
|
|
183
|
+
{
|
|
184
|
+
label: "Time from",
|
|
185
|
+
step: "0.5",
|
|
186
|
+
suffix: "s",
|
|
187
|
+
value: g("ms_min"),
|
|
188
|
+
onChange: l("ms_min")
|
|
189
|
+
}
|
|
190
|
+
),
|
|
191
|
+
/* @__PURE__ */ e(
|
|
192
|
+
x,
|
|
193
|
+
{
|
|
194
|
+
label: "Time to",
|
|
195
|
+
step: "0.5",
|
|
196
|
+
suffix: "s",
|
|
197
|
+
value: g("ms_max"),
|
|
198
|
+
onChange: l("ms_max")
|
|
199
|
+
}
|
|
200
|
+
),
|
|
201
|
+
/* @__PURE__ */ a("label", { className: "col-span-2 flex flex-col gap-0.5 text-[11px] text-slate-500 dark:text-muted-foreground", children: [
|
|
202
|
+
"Error text contains",
|
|
203
|
+
/* @__PURE__ */ e(
|
|
204
|
+
"input",
|
|
205
|
+
{
|
|
206
|
+
type: "text",
|
|
207
|
+
value: r.get("error") ?? "",
|
|
208
|
+
onChange: (s) => i("error")(s.target.value),
|
|
209
|
+
placeholder: "e.g. rate limit",
|
|
210
|
+
className: "h-8 rounded-md border border-slate-200 bg-white px-2 text-[12px] text-slate-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 dark:border-border dark:bg-background dark:text-foreground"
|
|
211
|
+
}
|
|
212
|
+
)
|
|
213
|
+
] }),
|
|
214
|
+
/* @__PURE__ */ a("div", { className: "col-span-2 flex flex-col gap-1 text-[11px] text-slate-500 dark:text-muted-foreground", children: [
|
|
215
|
+
"Feedback on the answer",
|
|
216
|
+
/* @__PURE__ */ e(
|
|
217
|
+
G,
|
|
218
|
+
{
|
|
219
|
+
ariaLabel: "Feedback",
|
|
220
|
+
value: r.get("feedback") ?? "",
|
|
221
|
+
onChange: i("feedback"),
|
|
222
|
+
options: [
|
|
223
|
+
{ value: "", label: "Any" },
|
|
224
|
+
{ value: "any", label: "Rated" },
|
|
225
|
+
{ value: "up", label: "Up" },
|
|
226
|
+
{ value: "down", label: "Down" },
|
|
227
|
+
{ value: "none", label: "Unrated" }
|
|
228
|
+
]
|
|
229
|
+
}
|
|
230
|
+
)
|
|
231
|
+
] })
|
|
232
|
+
] }) })
|
|
233
|
+
] });
|
|
234
|
+
}
|
|
235
|
+
function be({
|
|
236
|
+
params: r,
|
|
237
|
+
setParams: m
|
|
238
|
+
}) {
|
|
239
|
+
var $;
|
|
240
|
+
const u = K(), h = M(), [d, o] = b(!1), [i, g] = b(""), [l, s] = b(!1), n = j({
|
|
241
|
+
queryKey: ["nvr-ai-call-log-views"],
|
|
242
|
+
queryFn: () => u.request(z("/ai/call-log/views")),
|
|
243
|
+
enabled: d,
|
|
244
|
+
staleTime: 3e4
|
|
245
|
+
}), c = new URLSearchParams();
|
|
246
|
+
for (const t of [...E, "sort"]) {
|
|
247
|
+
const f = r.get(t);
|
|
248
|
+
f && c.set(t, f);
|
|
249
|
+
}
|
|
250
|
+
const p = L({
|
|
251
|
+
mutationFn: () => u.request(
|
|
252
|
+
H("/ai/call-log/views", { name: i.trim(), query: c.toString(), shared: l })
|
|
253
|
+
),
|
|
254
|
+
onSuccess: () => {
|
|
255
|
+
g(""), h.invalidateQueries({ queryKey: ["nvr-ai-call-log-views"] });
|
|
256
|
+
},
|
|
257
|
+
onError: (t) => T(t, "The view was not saved")
|
|
258
|
+
}), O = L({
|
|
259
|
+
mutationFn: (t) => u.request(Y(`/ai/call-log/views/${t}`)),
|
|
260
|
+
onSuccess: () => void h.invalidateQueries({ queryKey: ["nvr-ai-call-log-views"] }),
|
|
261
|
+
onError: (t) => T(t, "The view was not deleted")
|
|
262
|
+
});
|
|
263
|
+
B(() => {
|
|
264
|
+
d || g("");
|
|
265
|
+
}, [d]);
|
|
266
|
+
const P = (t) => {
|
|
267
|
+
const f = new URLSearchParams(t.query);
|
|
268
|
+
m((q) => {
|
|
269
|
+
for (const w of [...E, "sort", "page", "call", "thread"]) q.delete(w);
|
|
270
|
+
for (const [w, U] of f) q.set(w, U);
|
|
271
|
+
}), o(!1);
|
|
272
|
+
}, _ = (($ = n.data) == null ? void 0 : $.data) ?? [];
|
|
273
|
+
return /* @__PURE__ */ a(k, { open: d, onOpenChange: o, children: [
|
|
274
|
+
/* @__PURE__ */ e(y, { asChild: !0, children: /* @__PURE__ */ a("button", { type: "button", className: v(C, S), "data-ai-saved-views": !0, children: [
|
|
275
|
+
/* @__PURE__ */ e(I, { className: "h-3.5 w-3.5", "aria-hidden": !0 }),
|
|
276
|
+
"Views"
|
|
277
|
+
] }) }),
|
|
278
|
+
/* @__PURE__ */ a(N, { className: "w-[300px] p-0", align: "end", children: [
|
|
279
|
+
/* @__PURE__ */ e("div", { className: "max-h-[260px] overflow-y-auto py-1", children: n.isLoading ? /* @__PURE__ */ e("p", { className: "px-3 py-2 text-[12px] text-slate-500", children: "Loading…" }) : _.length === 0 ? /* @__PURE__ */ e("p", { className: "px-3 py-2 text-[12px] text-slate-500 dark:text-muted-foreground", children: "No saved views yet. Set the filters, name the view below and save it." }) : _.map((t) => /* @__PURE__ */ a("div", { className: "group flex items-center gap-1 px-1", children: [
|
|
280
|
+
/* @__PURE__ */ a(
|
|
281
|
+
"button",
|
|
282
|
+
{
|
|
283
|
+
type: "button",
|
|
284
|
+
onClick: () => P(t),
|
|
285
|
+
className: "flex min-w-0 flex-1 items-center gap-1.5 rounded px-2 py-1.5 text-left text-[12.5px] hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50",
|
|
286
|
+
children: [
|
|
287
|
+
/* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate", children: t.name }),
|
|
288
|
+
t.shared && /* @__PURE__ */ a(
|
|
289
|
+
"span",
|
|
290
|
+
{
|
|
291
|
+
className: "inline-flex shrink-0 items-center gap-0.5 text-[10.5px] text-slate-400",
|
|
292
|
+
"data-tip": t.mine ? "Shared with every administrator" : `Shared by ${t.owner_name}`,
|
|
293
|
+
children: [
|
|
294
|
+
/* @__PURE__ */ e(D, { className: "h-3 w-3", "aria-hidden": !0 }),
|
|
295
|
+
t.mine ? "shared" : t.owner_name.split(" ")[0]
|
|
296
|
+
]
|
|
297
|
+
}
|
|
298
|
+
)
|
|
299
|
+
]
|
|
300
|
+
}
|
|
301
|
+
),
|
|
302
|
+
t.mine && /* @__PURE__ */ e(
|
|
303
|
+
"button",
|
|
304
|
+
{
|
|
305
|
+
type: "button",
|
|
306
|
+
"aria-label": `Delete the view ${t.name}`,
|
|
307
|
+
onClick: () => O.mutate(t.id),
|
|
308
|
+
className: "invisible inline-flex h-6 w-6 items-center justify-center rounded text-slate-400 hover:bg-muted hover:text-red-700 focus-visible:visible focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 group-hover:visible",
|
|
309
|
+
children: /* @__PURE__ */ e(Q, { className: "h-3.5 w-3.5", "aria-hidden": !0 })
|
|
310
|
+
}
|
|
311
|
+
)
|
|
312
|
+
] }, t.id)) }),
|
|
313
|
+
/* @__PURE__ */ a(
|
|
314
|
+
"form",
|
|
315
|
+
{
|
|
316
|
+
className: "flex flex-col gap-2 border-t border-slate-100 p-3 dark:border-border/60",
|
|
317
|
+
onSubmit: (t) => {
|
|
318
|
+
t.preventDefault(), i.trim() && p.mutate();
|
|
319
|
+
},
|
|
320
|
+
children: [
|
|
321
|
+
/* @__PURE__ */ e(
|
|
322
|
+
"input",
|
|
323
|
+
{
|
|
324
|
+
value: i,
|
|
325
|
+
onChange: (t) => g(t.target.value),
|
|
326
|
+
maxLength: 60,
|
|
327
|
+
placeholder: "Name this view",
|
|
328
|
+
"aria-label": "View name",
|
|
329
|
+
className: "h-8 rounded-md border border-slate-200 bg-white px-2 text-[12.5px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 dark:border-border dark:bg-background"
|
|
330
|
+
}
|
|
331
|
+
),
|
|
332
|
+
/* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
|
|
333
|
+
/* @__PURE__ */ a("label", { className: "inline-flex items-center gap-1.5 text-[12px] text-slate-600 dark:text-muted-foreground", children: [
|
|
334
|
+
/* @__PURE__ */ e(
|
|
335
|
+
"input",
|
|
336
|
+
{
|
|
337
|
+
type: "checkbox",
|
|
338
|
+
checked: l,
|
|
339
|
+
onChange: (t) => s(t.target.checked)
|
|
340
|
+
}
|
|
341
|
+
),
|
|
342
|
+
"Share with administrators"
|
|
343
|
+
] }),
|
|
344
|
+
/* @__PURE__ */ e(
|
|
345
|
+
"button",
|
|
346
|
+
{
|
|
347
|
+
type: "submit",
|
|
348
|
+
disabled: !i.trim() || p.isPending,
|
|
349
|
+
className: "ml-auto inline-flex h-7 items-center rounded-md bg-nvr-cyan px-2.5 text-[12px] font-medium text-white hover:bg-nvr-cyan/90 disabled:opacity-50",
|
|
350
|
+
children: p.isPending ? "Saving…" : "Save view"
|
|
351
|
+
}
|
|
352
|
+
)
|
|
353
|
+
] })
|
|
354
|
+
]
|
|
355
|
+
}
|
|
356
|
+
)
|
|
357
|
+
] })
|
|
358
|
+
] });
|
|
359
|
+
}
|
|
360
|
+
export {
|
|
361
|
+
xe as MoreFilters,
|
|
362
|
+
pe as MultiPicker,
|
|
363
|
+
be as SavedViews
|
|
364
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const i = (e, t = 2) => e == null || Number.isNaN(e) ? "–" : e > 0 && e < 1e-4 ? "<$0.0001" : `$${e.toFixed(e < 0.1 && e > 0 ? 4 : t)}`, u = (e) => e == null || Number.isNaN(e) ? "–" : e.toLocaleString("en-US"), s = (e) => e == null ? "–" : e >= 1e6 ? `${(e / 1e6).toFixed(2)}M` : e >= 1e4 ? `${(e / 1e3).toFixed(1)}k` : e.toLocaleString("en-US"), a = (e) => e == null ? "–" : e < 1e3 ? `${Math.round(e)}ms` : `${(e / 1e3).toFixed(1)}s`, c = (e, t) => t > 0 ? `${e / t < 0.1 && e > 0 ? (e / t * 100).toFixed(1) : Math.round(e / t * 100)}%` : "–", n = {
|
|
2
|
+
ok: "OK",
|
|
3
|
+
end_turn: "Answered",
|
|
4
|
+
tool_use: "Called tools",
|
|
5
|
+
max_tokens: "Hit the length limit",
|
|
6
|
+
stopped: "Stopped by the person",
|
|
7
|
+
stop_sequence: "Stop sequence",
|
|
8
|
+
error: "Error"
|
|
9
|
+
}, l = (e) => n[e ?? "ok"] ?? String(e).replace(/_/g, " "), d = (e) => e.status === "error" ? "error" : e.stop_reason ?? "ok", m = (e) => e === "chat" ? "Ask AI" : e === "chat-bot" ? "Chat bot" : e.replace(/[-_]+/g, " ").replace(/^\w/, (t) => t.toUpperCase());
|
|
10
|
+
function g(e, t) {
|
|
11
|
+
if (t === "hour") {
|
|
12
|
+
const r = /* @__PURE__ */ new Date(`${e}:00:00.000Z`);
|
|
13
|
+
return Number.isNaN(r.getTime()) ? e : r.toLocaleString(void 0, { month: "short", day: "numeric", hour: "numeric" });
|
|
14
|
+
}
|
|
15
|
+
const o = /* @__PURE__ */ new Date(`${e}T00:00:00.000Z`);
|
|
16
|
+
return Number.isNaN(o.getTime()) ? e : o.toLocaleDateString(void 0, { month: "short", day: "numeric", timeZone: "UTC" });
|
|
17
|
+
}
|
|
18
|
+
function h(e, t) {
|
|
19
|
+
const o = t === "hour" ? /* @__PURE__ */ new Date(`${e}:00:00.000Z`) : /* @__PURE__ */ new Date(`${e}T00:00:00.000Z`);
|
|
20
|
+
if (Number.isNaN(o.getTime())) return null;
|
|
21
|
+
const r = new Date(o.getTime() + (t === "hour" ? 36e5 : 864e5));
|
|
22
|
+
return { from: o.toISOString(), to: r.toISOString() };
|
|
23
|
+
}
|
|
24
|
+
function N(e) {
|
|
25
|
+
if (!e) return "–";
|
|
26
|
+
const t = new Date(e);
|
|
27
|
+
return Number.isNaN(t.getTime()) ? "–" : t.toLocaleString(void 0, {
|
|
28
|
+
month: "short",
|
|
29
|
+
day: "numeric",
|
|
30
|
+
hour: "numeric",
|
|
31
|
+
minute: "2-digit"
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
g as bucketLabel,
|
|
36
|
+
h as bucketRange,
|
|
37
|
+
m as featureLabel,
|
|
38
|
+
u as num,
|
|
39
|
+
c as pctOf,
|
|
40
|
+
l as resultLabel,
|
|
41
|
+
d as resultOf,
|
|
42
|
+
a as secs,
|
|
43
|
+
s as tok,
|
|
44
|
+
i as usd,
|
|
45
|
+
N as whenShort
|
|
46
|
+
};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { resultLabel as h, featureLabel as $ } from "./format.js";
|
|
2
|
+
const k = [
|
|
3
|
+
{ value: "24h", label: "24h", hours: 24 },
|
|
4
|
+
{ value: "7d", label: "7d", hours: 168 },
|
|
5
|
+
{ value: "30d", label: "30d", hours: 720 },
|
|
6
|
+
{ value: "90d", label: "90d", hours: 2160 }
|
|
7
|
+
], d = ["feature", "model", "user", "tool", "result"], m = ["q", "error", "request_id", "conversation", "feedback"], _ = [
|
|
8
|
+
"cost_min",
|
|
9
|
+
"cost_max",
|
|
10
|
+
"tokens_min",
|
|
11
|
+
"tokens_max",
|
|
12
|
+
"ms_min",
|
|
13
|
+
"ms_max"
|
|
14
|
+
], v = [
|
|
15
|
+
"window",
|
|
16
|
+
"from",
|
|
17
|
+
"to",
|
|
18
|
+
...d,
|
|
19
|
+
...m,
|
|
20
|
+
..._
|
|
21
|
+
];
|
|
22
|
+
function b(t, o) {
|
|
23
|
+
return (t.get(o) ?? "").split(",").filter(Boolean);
|
|
24
|
+
}
|
|
25
|
+
function S(t, o, r) {
|
|
26
|
+
const c = b(t, o), s = c.includes(r) ? c.filter((l) => l !== r) : [...c, r];
|
|
27
|
+
s.length ? t.set(o, s.join(",")) : t.delete(o), t.delete("page");
|
|
28
|
+
}
|
|
29
|
+
function x(t) {
|
|
30
|
+
var c;
|
|
31
|
+
const o = new URLSearchParams(), r = t.get("window") ?? "7d";
|
|
32
|
+
if (r === "custom" && t.get("from")) {
|
|
33
|
+
o.set("from", t.get("from"));
|
|
34
|
+
const s = t.get("to");
|
|
35
|
+
s && o.set("to", s);
|
|
36
|
+
} else
|
|
37
|
+
o.set("hours", String(((c = k.find((s) => s.value === r)) == null ? void 0 : c.hours) ?? 168));
|
|
38
|
+
for (const s of [...d, ...m, ..._]) {
|
|
39
|
+
const l = t.get(s);
|
|
40
|
+
l && o.set(s, l);
|
|
41
|
+
}
|
|
42
|
+
return o;
|
|
43
|
+
}
|
|
44
|
+
function E(t, o = {}) {
|
|
45
|
+
const r = [], c = {
|
|
46
|
+
feature: (e) => $(e),
|
|
47
|
+
model: (e) => e,
|
|
48
|
+
user: (e) => {
|
|
49
|
+
var n;
|
|
50
|
+
return e === "system" ? "System" : ((n = o.people) == null ? void 0 : n.get(e)) ?? "Person";
|
|
51
|
+
},
|
|
52
|
+
tool: (e) => `tool ${e}`,
|
|
53
|
+
result: (e) => h(e)
|
|
54
|
+
};
|
|
55
|
+
for (const e of d)
|
|
56
|
+
for (const n of b(t, e))
|
|
57
|
+
r.push({
|
|
58
|
+
key: `${e}:${n}`,
|
|
59
|
+
label: c[e](n),
|
|
60
|
+
clear: (a) => S(a, e, n)
|
|
61
|
+
});
|
|
62
|
+
const s = {
|
|
63
|
+
q: (e) => `“${e}”`,
|
|
64
|
+
error: (e) => `error has “${e}”`,
|
|
65
|
+
request_id: (e) => `question #${e.slice(0, 6)}`,
|
|
66
|
+
conversation: () => "one conversation",
|
|
67
|
+
feedback: (e) => e === "up" ? "thumbs up" : e === "down" ? "thumbs down" : e === "any" ? "has feedback" : "no feedback"
|
|
68
|
+
};
|
|
69
|
+
for (const e of m) {
|
|
70
|
+
const n = t.get(e);
|
|
71
|
+
n && r.push({
|
|
72
|
+
key: e,
|
|
73
|
+
label: s[e](n),
|
|
74
|
+
clear: (a) => {
|
|
75
|
+
a.delete(e), a.delete("page");
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
const l = (e, n, a, u) => {
|
|
80
|
+
const i = t.get(e), f = t.get(n);
|
|
81
|
+
!i && !f || r.push({
|
|
82
|
+
key: e,
|
|
83
|
+
label: i && f ? `${a} ${u(i)}–${u(f)}` : i ? `${a} ≥ ${u(i)}` : `${a} ≤ ${u(f)}`,
|
|
84
|
+
clear: (g) => {
|
|
85
|
+
g.delete(e), g.delete(n), g.delete("page");
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
return l("cost_min", "cost_max", "cost", (e) => `$${e}`), l("tokens_min", "tokens_max", "tokens", (e) => Number(e).toLocaleString("en-US")), l("ms_min", "ms_max", "time", (e) => `${(Number(e) / 1e3).toFixed(1)}s`), r;
|
|
90
|
+
}
|
|
91
|
+
function L(t) {
|
|
92
|
+
for (const o of [...d, ...m, ..._, "page"]) t.delete(o);
|
|
93
|
+
}
|
|
94
|
+
export {
|
|
95
|
+
v as FILTER_KEYS,
|
|
96
|
+
d as LIST_KEYS,
|
|
97
|
+
_ as RANGE_KEYS,
|
|
98
|
+
m as TEXT_KEYS,
|
|
99
|
+
k as WINDOWS,
|
|
100
|
+
E as activeChips,
|
|
101
|
+
x as apiFilter,
|
|
102
|
+
L as clearFilters,
|
|
103
|
+
b as listOf,
|
|
104
|
+
S as toggleIn
|
|
105
|
+
};
|