@nivaro/react 0.2.56 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/slots/TasksSlot.js +31 -29
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +73 -1
- package/dist/index.js +515 -505
- package/dist/shared/components/ItemEditForm.js +666 -658
- package/dist/shared/components/MyWorkView.js +47 -37
- package/dist/shared/components/ProfileView.js +163 -144
- package/dist/shared/components/ai/AiPlanCard.js +427 -0
- package/dist/shared/components/ai/AiPlanChanges.js +117 -0
- package/dist/shared/components/ai/TaskDo.js +1022 -0
- package/dist/shared/components/chat/ChatAnalyticsView.js +19 -17
- package/dist/shared/components/chat/ChatPanel.js +1356 -1317
- package/dist/shared/components/chat/HuddleAnalyticsTab.js +198 -0
- package/dist/shared/components/chat/RoomHeaderMenu.js +78 -65
- package/dist/shared/components/chat/chat-core.js +273 -264
- package/dist/shared/components/chat/huddle/HuddleAudioUi.js +397 -0
- package/dist/shared/components/chat/huddle/HuddleCallBar.js +296 -0
- package/dist/shared/components/chat/huddle/HuddleCallLayer.js +180 -0
- package/dist/shared/components/chat/huddle/HuddleCamera.js +124 -0
- package/dist/shared/components/chat/huddle/HuddleCollab.js +320 -0
- package/dist/shared/components/chat/huddle/HuddleControls.js +82 -121
- package/dist/shared/components/chat/huddle/HuddleDraw.js +231 -0
- package/dist/shared/components/chat/huddle/HuddleLiveBadge.js +52 -0
- package/dist/shared/components/chat/huddle/HuddlePeoplePicker.js +143 -0
- package/dist/shared/components/chat/huddle/HuddleScheduleCard.js +190 -0
- package/dist/shared/components/chat/huddle/HuddleScheduleForm.js +188 -0
- package/dist/shared/components/chat/huddle/HuddleStage.js +184 -89
- package/dist/shared/components/chat/huddle/HuddleStageTools.js +197 -0
- package/dist/shared/components/chat/huddle/huddle-audio-logic.js +156 -0
- package/dist/shared/components/chat/huddle/huddle-audio.js +69 -0
- package/dist/shared/components/chat/huddle/huddle-calls.js +129 -0
- package/dist/shared/components/chat/huddle/huddle-camera.js +143 -0
- package/dist/shared/components/chat/huddle/huddle-collab-store.js +391 -0
- package/dist/shared/components/chat/huddle/huddle-device-prefs.js +55 -0
- package/dist/shared/components/chat/huddle/huddle-devices.js +99 -0
- package/dist/shared/components/chat/huddle/huddle-draw.js +226 -0
- package/dist/shared/components/chat/huddle/huddle-follow-bus.js +96 -0
- package/dist/shared/components/chat/huddle/huddle-hold.js +62 -0
- package/dist/shared/components/chat/huddle/huddle-link-quality.js +159 -0
- package/dist/shared/components/chat/huddle/huddle-live.js +82 -0
- package/dist/shared/components/chat/huddle/huddle-pip.js +343 -0
- package/dist/shared/components/chat/huddle/huddle-quality.js +22 -0
- package/dist/shared/components/chat/huddle/huddle-reactions.js +71 -0
- package/dist/shared/components/chat/huddle/huddle-ring-refused.js +34 -0
- package/dist/shared/components/chat/huddle/huddle-schedule.js +102 -0
- package/dist/shared/components/chat/huddle/huddle-sfu.js +176 -0
- package/dist/shared/components/chat/huddle/huddle-shortcuts.js +91 -0
- package/dist/shared/components/chat/huddle/huddle-speaking.js +100 -0
- package/dist/shared/components/chat/huddle/huddle-store.js +431 -157
- package/dist/shared/components/chat/huddle/useHuddle.js +46 -38
- package/dist/shared/components/chat/huddle/useHuddleAudio.js +35 -0
- package/dist/shared/components/item-edit/GroupSection.js +1 -0
- package/dist/shared/components/item-edit/RecordChatActions.js +68 -59
- package/dist/shared/components/item-edit/UserChip.js +145 -142
- package/dist/shared/components/panels/TaskPanel.js +51 -49
- package/dist/shared/components/support/TicketDetailSheet.js +57 -42
- package/dist/shared/lib/notification-sound.js +25 -16
- package/package.json +2 -1
|
@@ -5,18 +5,19 @@ import { useState as y, useRef as Ue, useEffect as ge, useMemo as Re } from "rea
|
|
|
5
5
|
import { toast as k } from "sonner";
|
|
6
6
|
import { useNivaroClient as R, useItemEditAuth as Ke } from "../../context.js";
|
|
7
7
|
import { get as F, post as J, patch as Me, del as He } from "../../lib/commands.js";
|
|
8
|
-
import { OPEN_TASK_STATUSES as ce, invalidateRecordTasks as
|
|
8
|
+
import { OPEN_TASK_STATUSES as ce, invalidateRecordTasks as Be } from "../../lib/record-tasks.js";
|
|
9
9
|
import { formatDate as X, cn as U, formatRelative as be } from "../../lib/utils.js";
|
|
10
|
-
import {
|
|
10
|
+
import { TaskDoButton as ze } from "../ai/TaskDo.js";
|
|
11
|
+
import { Button as B } from "../ui/button.js";
|
|
11
12
|
import { Checkbox as me } from "../ui/checkbox.js";
|
|
12
13
|
import { Command as fe, CommandInput as ke, CommandList as ye, CommandEmpty as Ne, CommandGroup as Y, CommandItem as ve } from "../ui/command.js";
|
|
13
14
|
import { Input as Z } from "../ui/input.js";
|
|
14
|
-
import { Label as
|
|
15
|
+
import { Label as A } from "../ui/label.js";
|
|
15
16
|
import { Popover as we, PopoverTrigger as _e, PopoverContent as Ce } from "../ui/popover.js";
|
|
16
17
|
import { SimpleSelect as ee } from "../ui/SimpleSelect.js";
|
|
17
|
-
import { Textarea as
|
|
18
|
-
const
|
|
19
|
-
function
|
|
18
|
+
import { Textarea as Ve } from "../ui/textarea.js";
|
|
19
|
+
const Ge = "id,first_name,last_name,email,is_out_of_office,ooo_end,delegate_id";
|
|
20
|
+
function z(a) {
|
|
20
21
|
return a && ([a.first_name, a.last_name].filter(Boolean).join(" ") || a.email) || "Unknown";
|
|
21
22
|
}
|
|
22
23
|
const C = (a, i) => a != null && i != null && String(a).toUpperCase() === String(i).toUpperCase();
|
|
@@ -29,7 +30,7 @@ function Se(a) {
|
|
|
29
30
|
return [];
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
|
-
function
|
|
33
|
+
function Je(a, i) {
|
|
33
34
|
return a.map((o) => {
|
|
34
35
|
const m = i.get(o.field) ?? o.field.replace(/_/g, " ");
|
|
35
36
|
return o.op === "nnull" ? `${m} is filled in` : o.op === "eq" ? `${m} is ${String(o.value ?? "")}` : o.op === "null" ? `${m} is empty` : `${m} ${o.op} ${String(o.value ?? "")}`.trim();
|
|
@@ -44,7 +45,7 @@ function ue({ priority: a }) {
|
|
|
44
45
|
}
|
|
45
46
|
);
|
|
46
47
|
}
|
|
47
|
-
function
|
|
48
|
+
function Xe({
|
|
48
49
|
collection: a,
|
|
49
50
|
item: i,
|
|
50
51
|
value: o,
|
|
@@ -67,20 +68,20 @@ function Je({
|
|
|
67
68
|
F("/users", {
|
|
68
69
|
limit: 25,
|
|
69
70
|
people: 1,
|
|
70
|
-
fields:
|
|
71
|
+
fields: Ge,
|
|
71
72
|
...h ? { search: h } : {}
|
|
72
73
|
})
|
|
73
74
|
).then((n) => n.data).catch(() => []),
|
|
74
75
|
enabled: g,
|
|
75
76
|
staleTime: 6e4
|
|
76
77
|
}), u = v.data ?? [], x = new Set(u.map((n) => String(n.id).toUpperCase())), f = h.toLowerCase(), S = u.filter(
|
|
77
|
-
(n) => !f || `${
|
|
78
|
-
), $ = (_.data ?? []).filter((n) => !x.has(String(n.id).toUpperCase())),
|
|
79
|
-
queryKey: ["task-open-counts",
|
|
78
|
+
(n) => !f || `${z(n)} ${n.email ?? ""}`.toLowerCase().includes(f)
|
|
79
|
+
), $ = (_.data ?? []).filter((n) => !x.has(String(n.id).toUpperCase())), L = [...S, ...$].map((n) => n.id), { data: D } = T({
|
|
80
|
+
queryKey: ["task-open-counts", L.join(",")],
|
|
80
81
|
queryFn: () => c.request(
|
|
81
|
-
F("/tasks/open-counts", { ids:
|
|
82
|
+
F("/tasks/open-counts", { ids: L.join(",") })
|
|
82
83
|
).then((n) => n.data).catch(() => ({})),
|
|
83
|
-
enabled: g &&
|
|
84
|
+
enabled: g && L.length > 0,
|
|
84
85
|
staleTime: 6e4
|
|
85
86
|
}), K = (n, q) => {
|
|
86
87
|
const E = (D == null ? void 0 : D[String(n.id).toUpperCase()]) ?? 0;
|
|
@@ -101,7 +102,7 @@ function Je({
|
|
|
101
102
|
}
|
|
102
103
|
),
|
|
103
104
|
/* @__PURE__ */ s("span", { className: "min-w-0 flex-1 truncate", children: [
|
|
104
|
-
|
|
105
|
+
z(n),
|
|
105
106
|
q != null && q.length ? /* @__PURE__ */ t("span", { className: "ml-1.5 text-[10.5px] text-muted-foreground", children: q.join(", ") }) : null
|
|
106
107
|
] }),
|
|
107
108
|
n.is_out_of_office ? /* @__PURE__ */ t("span", { className: "ml-2 shrink-0 text-[10px] text-amber-600 dark:text-amber-400", children: "out" }) : null,
|
|
@@ -120,7 +121,7 @@ function Je({
|
|
|
120
121
|
};
|
|
121
122
|
return /* @__PURE__ */ s(we, { open: g, onOpenChange: d, children: [
|
|
122
123
|
/* @__PURE__ */ t(_e, { asChild: !0, children: /* @__PURE__ */ s(
|
|
123
|
-
|
|
124
|
+
B,
|
|
124
125
|
{
|
|
125
126
|
variant: "outline",
|
|
126
127
|
role: "combobox",
|
|
@@ -151,7 +152,7 @@ function Je({
|
|
|
151
152
|
] }) })
|
|
152
153
|
] });
|
|
153
154
|
}
|
|
154
|
-
function
|
|
155
|
+
function Qe({
|
|
155
156
|
value: a,
|
|
156
157
|
onChange: i
|
|
157
158
|
}) {
|
|
@@ -192,18 +193,18 @@ function $e(a) {
|
|
|
192
193
|
);
|
|
193
194
|
return { fields: m, labels: r };
|
|
194
195
|
}
|
|
195
|
-
function
|
|
196
|
+
function Ye({
|
|
196
197
|
collection: a,
|
|
197
198
|
value: i,
|
|
198
199
|
onChange: o
|
|
199
200
|
}) {
|
|
200
201
|
const { fields: m, labels: r } = $e(a), [c, g] = y(!1), d = i[0] ?? null;
|
|
201
202
|
return /* @__PURE__ */ s("div", { className: "space-y-1.5", "data-task-done-when": !0, children: [
|
|
202
|
-
/* @__PURE__ */ t(
|
|
203
|
+
/* @__PURE__ */ t(A, { className: "block text-[11px]", children: "Close automatically when (optional)" }),
|
|
203
204
|
/* @__PURE__ */ s("div", { className: "flex flex-wrap items-center gap-1.5", children: [
|
|
204
205
|
/* @__PURE__ */ s(we, { open: c, onOpenChange: g, children: [
|
|
205
206
|
/* @__PURE__ */ t(_e, { asChild: !0, children: /* @__PURE__ */ s(
|
|
206
|
-
|
|
207
|
+
B,
|
|
207
208
|
{
|
|
208
209
|
variant: "outline",
|
|
209
210
|
className: "h-8 max-w-[220px] justify-between px-2.5 text-[12px] font-normal",
|
|
@@ -269,7 +270,7 @@ function Qe({
|
|
|
269
270
|
] })
|
|
270
271
|
] });
|
|
271
272
|
}
|
|
272
|
-
const
|
|
273
|
+
const Ze = () => ({
|
|
273
274
|
title: "",
|
|
274
275
|
description: "",
|
|
275
276
|
mode: "person",
|
|
@@ -282,7 +283,7 @@ const Ye = () => ({
|
|
|
282
283
|
priority: "normal",
|
|
283
284
|
doneWhen: []
|
|
284
285
|
});
|
|
285
|
-
function
|
|
286
|
+
function et(a) {
|
|
286
287
|
return {
|
|
287
288
|
title: a.title,
|
|
288
289
|
description: a.description ?? "",
|
|
@@ -316,7 +317,7 @@ function pe({
|
|
|
316
317
|
"data-task-form": !0,
|
|
317
318
|
children: [
|
|
318
319
|
/* @__PURE__ */ s("div", { children: [
|
|
319
|
-
/* @__PURE__ */ t(
|
|
320
|
+
/* @__PURE__ */ t(A, { className: "mb-1 block text-[11px]", children: "Title" }),
|
|
320
321
|
/* @__PURE__ */ t(
|
|
321
322
|
Z,
|
|
322
323
|
{
|
|
@@ -330,9 +331,9 @@ function pe({
|
|
|
330
331
|
)
|
|
331
332
|
] }),
|
|
332
333
|
/* @__PURE__ */ s("div", { children: [
|
|
333
|
-
/* @__PURE__ */ t(
|
|
334
|
+
/* @__PURE__ */ t(A, { className: "mb-1 block text-[11px]", children: "Details (optional)" }),
|
|
334
335
|
/* @__PURE__ */ t(
|
|
335
|
-
|
|
336
|
+
Ve,
|
|
336
337
|
{
|
|
337
338
|
value: l.description,
|
|
338
339
|
onChange: (u) => h("description", u.target.value),
|
|
@@ -346,7 +347,7 @@ function pe({
|
|
|
346
347
|
/* @__PURE__ */ s("div", { className: "grid grid-cols-2 gap-3", children: [
|
|
347
348
|
/* @__PURE__ */ s("div", { className: "col-span-2 sm:col-span-1", children: [
|
|
348
349
|
/* @__PURE__ */ s("div", { className: "mb-1 flex items-center justify-between", children: [
|
|
349
|
-
/* @__PURE__ */ t(
|
|
350
|
+
/* @__PURE__ */ t(A, { className: "text-[11px]", children: l.mode === "team" ? "Team" : "Assignee" }),
|
|
350
351
|
c && /* @__PURE__ */ t(
|
|
351
352
|
"button",
|
|
352
353
|
{
|
|
@@ -359,13 +360,13 @@ function pe({
|
|
|
359
360
|
)
|
|
360
361
|
] }),
|
|
361
362
|
l.mode === "team" ? /* @__PURE__ */ t(
|
|
362
|
-
|
|
363
|
+
Qe,
|
|
363
364
|
{
|
|
364
365
|
value: l.teamId,
|
|
365
366
|
onChange: (u, x) => w((f) => ({ ...f, teamId: u, teamName: (x == null ? void 0 : x.name) ?? null }))
|
|
366
367
|
}
|
|
367
368
|
) : /* @__PURE__ */ t(
|
|
368
|
-
|
|
369
|
+
Xe,
|
|
369
370
|
{
|
|
370
371
|
collection: a,
|
|
371
372
|
item: i,
|
|
@@ -374,13 +375,13 @@ function pe({
|
|
|
374
375
|
onChange: (u, x) => w((f) => ({
|
|
375
376
|
...f,
|
|
376
377
|
assignee: u,
|
|
377
|
-
assigneeName: x ?
|
|
378
|
+
assigneeName: x ? z(x) : null,
|
|
378
379
|
assigneePerson: x
|
|
379
380
|
}))
|
|
380
381
|
}
|
|
381
382
|
),
|
|
382
383
|
v && /* @__PURE__ */ s("p", { className: "mt-1 rounded bg-amber-50 px-2 py-1 text-[11px] text-amber-700 dark:bg-amber-400/10 dark:text-amber-400", children: [
|
|
383
|
-
|
|
384
|
+
z(v),
|
|
384
385
|
" is out of office",
|
|
385
386
|
v.ooo_end ? ` until ${String(v.ooo_end).slice(0, 10)}` : "",
|
|
386
387
|
" — the task goes to their delegate if one is set."
|
|
@@ -388,7 +389,7 @@ function pe({
|
|
|
388
389
|
l.mode === "team" && /* @__PURE__ */ t("p", { className: "mt-1 text-[11px] text-muted-foreground", children: "Waits with the team until one of them picks it up." })
|
|
389
390
|
] }),
|
|
390
391
|
/* @__PURE__ */ s("div", { children: [
|
|
391
|
-
/* @__PURE__ */ t(
|
|
392
|
+
/* @__PURE__ */ t(A, { className: "mb-1 block text-[11px]", children: "Due date" }),
|
|
392
393
|
/* @__PURE__ */ t(
|
|
393
394
|
Z,
|
|
394
395
|
{
|
|
@@ -401,7 +402,7 @@ function pe({
|
|
|
401
402
|
)
|
|
402
403
|
] }),
|
|
403
404
|
/* @__PURE__ */ s("div", { children: [
|
|
404
|
-
/* @__PURE__ */ t(
|
|
405
|
+
/* @__PURE__ */ t(A, { className: "mb-1 block text-[11px]", children: "Priority" }),
|
|
405
406
|
/* @__PURE__ */ t(
|
|
406
407
|
ee,
|
|
407
408
|
{
|
|
@@ -417,7 +418,7 @@ function pe({
|
|
|
417
418
|
] })
|
|
418
419
|
] }),
|
|
419
420
|
/* @__PURE__ */ t(
|
|
420
|
-
|
|
421
|
+
Ye,
|
|
421
422
|
{
|
|
422
423
|
collection: a,
|
|
423
424
|
value: l.doneWhen,
|
|
@@ -426,7 +427,7 @@ function pe({
|
|
|
426
427
|
),
|
|
427
428
|
/* @__PURE__ */ s("div", { className: "flex justify-end gap-2", children: [
|
|
428
429
|
/* @__PURE__ */ t(
|
|
429
|
-
|
|
430
|
+
B,
|
|
430
431
|
{
|
|
431
432
|
type: "button",
|
|
432
433
|
variant: "outline",
|
|
@@ -437,7 +438,7 @@ function pe({
|
|
|
437
438
|
}
|
|
438
439
|
),
|
|
439
440
|
/* @__PURE__ */ t(
|
|
440
|
-
|
|
441
|
+
B,
|
|
441
442
|
{
|
|
442
443
|
type: "button",
|
|
443
444
|
size: "sm",
|
|
@@ -476,7 +477,7 @@ function he({ taskId: a }) {
|
|
|
476
477
|
}
|
|
477
478
|
) : /* @__PURE__ */ t("p", { className: "mt-1 text-[11px] text-muted-foreground", children: "No history yet." });
|
|
478
479
|
}
|
|
479
|
-
function
|
|
480
|
+
function kt({
|
|
480
481
|
collection: a,
|
|
481
482
|
item: i,
|
|
482
483
|
title: o,
|
|
@@ -489,12 +490,12 @@ function bt({
|
|
|
489
490
|
ge(() => {
|
|
490
491
|
!_.current && m !== void 0 && (_.current = !0, v(m));
|
|
491
492
|
}, [m]);
|
|
492
|
-
const [u, x] = y(!1), [f, S] = y(null), [$,
|
|
493
|
+
const [u, x] = y(!1), [f, S] = y(null), [$, L] = y(null), [D, K] = y(!1), n = !i || i === "new", { data: q = [] } = T({
|
|
493
494
|
queryKey: ["tasks", a, i],
|
|
494
495
|
queryFn: () => d.request(F("/tasks", { collection: a, item: i })).then((e) => e.data),
|
|
495
496
|
enabled: !!a && !n
|
|
496
|
-
}), { labels: E } = $e(a),
|
|
497
|
-
|
|
497
|
+
}), { labels: E } = $e(a), I = () => {
|
|
498
|
+
Be(l, a, i), l.invalidateQueries({ queryKey: ["task-history"] });
|
|
498
499
|
}, O = (e, p) => {
|
|
499
500
|
var P;
|
|
500
501
|
return ((P = e == null ? void 0 : e.response) == null ? void 0 : P.error) ?? (e instanceof Error && e.message ? e.message : p);
|
|
@@ -512,7 +513,7 @@ function bt({
|
|
|
512
513
|
),
|
|
513
514
|
onSuccess: (e) => {
|
|
514
515
|
var p;
|
|
515
|
-
|
|
516
|
+
I(), x(!1), k.success(
|
|
516
517
|
(p = e == null ? void 0 : e.data) != null && p.delegated_from ? "Task created — it went to their delegate" : "Task created"
|
|
517
518
|
);
|
|
518
519
|
},
|
|
@@ -520,25 +521,25 @@ function bt({
|
|
|
520
521
|
}), M = j({
|
|
521
522
|
mutationFn: ({ id: e, body: p }) => d.request(Me(`/tasks/${e}`, p)),
|
|
522
523
|
onSuccess: (e, p) => {
|
|
523
|
-
|
|
524
|
+
I(), S(null), p.body.status === "open" ? k.success("Task reopened") : k.success("Task updated");
|
|
524
525
|
},
|
|
525
526
|
onError: (e) => k.error(O(e, "Could not update the task"))
|
|
526
527
|
}), se = j({
|
|
527
528
|
mutationFn: (e) => d.request(J(`/tasks/${e}/complete`, {})),
|
|
528
529
|
onSuccess: () => {
|
|
529
|
-
|
|
530
|
+
I(), k.success("Task completed");
|
|
530
531
|
},
|
|
531
532
|
onError: (e) => k.error(O(e, "Could not complete the task"))
|
|
532
533
|
}), ne = j({
|
|
533
534
|
mutationFn: (e) => d.request(J(`/tasks/${e}/claim`, {})),
|
|
534
535
|
onSuccess: () => {
|
|
535
|
-
|
|
536
|
+
I(), k.success("It’s yours");
|
|
536
537
|
},
|
|
537
538
|
onError: (e) => k.error(O(e, "Could not pick it up"))
|
|
538
539
|
}), le = j({
|
|
539
540
|
mutationFn: (e) => d.request(He(`/tasks/${e}`)),
|
|
540
541
|
onSuccess: () => {
|
|
541
|
-
|
|
542
|
+
I(), k.success("Task deleted");
|
|
542
543
|
},
|
|
543
544
|
onError: (e) => k.error(O(e, "Could not delete the task"))
|
|
544
545
|
});
|
|
@@ -581,11 +582,12 @@ function bt({
|
|
|
581
582
|
] })
|
|
582
583
|
] });
|
|
583
584
|
}, ie = (e, p) => /* @__PURE__ */ s("div", { className: "flex shrink-0 items-center gap-0.5", children: [
|
|
585
|
+
!p && /* @__PURE__ */ t(ze, { task: e, compact: !0, onTaskChanged: I }),
|
|
584
586
|
/* @__PURE__ */ t(
|
|
585
587
|
"button",
|
|
586
588
|
{
|
|
587
589
|
type: "button",
|
|
588
|
-
onClick: () =>
|
|
590
|
+
onClick: () => L($ === e.id ? null : e.id),
|
|
589
591
|
className: "rounded p-1 text-slate-300 transition-colors hover:bg-muted hover:text-slate-600",
|
|
590
592
|
"aria-label": `History of ${e.title}`,
|
|
591
593
|
title: "History",
|
|
@@ -718,7 +720,7 @@ function bt({
|
|
|
718
720
|
re(e, !1),
|
|
719
721
|
p.length > 0 && /* @__PURE__ */ s("p", { className: "mt-0.5 text-[11px] text-slate-500", "data-task-rule": !0, children: [
|
|
720
722
|
"Closes itself when ",
|
|
721
|
-
|
|
723
|
+
Je(p, E)
|
|
722
724
|
] }),
|
|
723
725
|
P && /* @__PURE__ */ t(
|
|
724
726
|
"button",
|
|
@@ -739,7 +741,7 @@ function bt({
|
|
|
739
741
|
{
|
|
740
742
|
collection: a,
|
|
741
743
|
item: i,
|
|
742
|
-
initial:
|
|
744
|
+
initial: et(e),
|
|
743
745
|
submitLabel: "Save changes",
|
|
744
746
|
busy: M.isPending,
|
|
745
747
|
allowTeam: !1,
|
|
@@ -777,7 +779,7 @@ function bt({
|
|
|
777
779
|
{
|
|
778
780
|
collection: a,
|
|
779
781
|
item: i,
|
|
780
|
-
initial:
|
|
782
|
+
initial: Ze(),
|
|
781
783
|
submitLabel: n ? "Queue task" : "Create task",
|
|
782
784
|
busy: ae.isPending,
|
|
783
785
|
allowTeam: !0,
|
|
@@ -832,5 +834,5 @@ function bt({
|
|
|
832
834
|
] });
|
|
833
835
|
}
|
|
834
836
|
export {
|
|
835
|
-
|
|
837
|
+
kt as TaskPanel
|
|
836
838
|
};
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { jsx as a, jsxs as r, Fragment as h } from "react/jsx-runtime";
|
|
2
|
-
import { useQueryClient as
|
|
3
|
-
import { Loader2 as
|
|
2
|
+
import { useQueryClient as j, useQuery as N, useMutation as g } from "@tanstack/react-query";
|
|
3
|
+
import { Loader2 as A, PlayCircle as U, Paperclip as L } from "lucide-react";
|
|
4
4
|
import { useState as w } from "react";
|
|
5
5
|
import { useNivaroClient as O, useApiFetchConfig as E, useItemNavigation as H, useNavigation as W } from "../../context.js";
|
|
6
6
|
import { get as _, post as S, patch as B } from "../../lib/commands.js";
|
|
7
7
|
import { useTopicPresence as G, signalSentence as q } from "../../lib/presence-signals.js";
|
|
8
8
|
import { replayHref as M } from "../../lib/replay-capture.js";
|
|
9
|
-
import {
|
|
9
|
+
import { TaskDoButton as z } from "../ai/TaskDo.js";
|
|
10
|
+
import { RelationCombobox as J } from "../item-edit/RelationCombobox.js";
|
|
10
11
|
import { SimpleSelect as C } from "../ui/SimpleSelect.js";
|
|
11
|
-
import { Sheet as
|
|
12
|
-
import { TicketTraffic as
|
|
12
|
+
import { Sheet as V, SheetContent as X, SheetHeader as Y, SheetTitle as Z, SheetDescription as I } from "../ui/sheet.js";
|
|
13
|
+
import { TicketTraffic as ee } from "./TicketTraffic.js";
|
|
13
14
|
import { STATUS_TONE as T } from "./types.js";
|
|
14
15
|
const $ = [
|
|
15
16
|
{ value: "open", label: "Open" },
|
|
@@ -25,66 +26,66 @@ function y(n) {
|
|
|
25
26
|
minute: "2-digit"
|
|
26
27
|
}) : "";
|
|
27
28
|
}
|
|
28
|
-
function
|
|
29
|
-
var
|
|
29
|
+
function te({ status: n, label: c }) {
|
|
30
|
+
var s;
|
|
30
31
|
return /* @__PURE__ */ a(
|
|
31
32
|
"span",
|
|
32
33
|
{
|
|
33
34
|
"data-ticket-status": n,
|
|
34
35
|
className: `inline-flex shrink-0 items-center rounded-full px-2 py-0.5 text-[11px] font-medium ${T[n] ?? T.open}`,
|
|
35
|
-
children:
|
|
36
|
+
children: c ?? ((s = $.find((l) => l.value === n)) == null ? void 0 : s.label) ?? n
|
|
36
37
|
}
|
|
37
38
|
);
|
|
38
39
|
}
|
|
39
|
-
function
|
|
40
|
+
function ge({
|
|
40
41
|
ticketId: n,
|
|
41
|
-
onOpenChange:
|
|
42
|
+
onOpenChange: c
|
|
42
43
|
}) {
|
|
43
|
-
const
|
|
44
|
+
const s = O(), l = j(), { apiBase: K } = E(), { urlFor: F, open: P } = H(), m = W(), [p, f] = w(""), [b, D] = w(null), i = G(n != null ? `ticket:${n}` : null), { data: e, isLoading: Q } = N({
|
|
44
45
|
queryKey: ["support-ticket", n],
|
|
45
|
-
queryFn: () =>
|
|
46
|
+
queryFn: () => s.request(_(`/support/tickets/${n}`)).then((t) => t.data),
|
|
46
47
|
enabled: n != null
|
|
47
|
-
}), { data:
|
|
48
|
+
}), { data: R = [] } = N({
|
|
48
49
|
queryKey: ["support-categories", "all-for", (e == null ? void 0 : e.collection) ?? null],
|
|
49
|
-
queryFn: () =>
|
|
50
|
+
queryFn: () => s.request(
|
|
50
51
|
_("/support/categories", e != null && e.collection ? { collection: e.collection } : void 0)
|
|
51
52
|
).then((t) => t.data ?? []),
|
|
52
53
|
enabled: !!(e != null && e.can.work)
|
|
53
54
|
}), u = () => {
|
|
54
|
-
|
|
55
|
-
}, x = (t) =>
|
|
56
|
-
mutationFn: () =>
|
|
55
|
+
l.invalidateQueries({ queryKey: ["support-ticket", n] }), l.invalidateQueries({ queryKey: ["support-tickets"] }), l.invalidateQueries({ queryKey: ["support-summary"] }), l.invalidateQueries({ queryKey: ["my-work"] });
|
|
56
|
+
}, x = (t) => D(t.message || "That did not work"), k = g({
|
|
57
|
+
mutationFn: () => s.request(S(`/support/tickets/${n}/claim`)),
|
|
57
58
|
onSuccess: u,
|
|
58
59
|
onError: x
|
|
59
60
|
}), o = g({
|
|
60
|
-
mutationFn: (t) =>
|
|
61
|
+
mutationFn: (t) => s.request(B(`/support/tickets/${n}`, t)),
|
|
61
62
|
onSuccess: u,
|
|
62
63
|
onError: x
|
|
63
64
|
}), v = g({
|
|
64
|
-
mutationFn: () =>
|
|
65
|
+
mutationFn: () => s.request(S(`/support/tickets/${n}/comments`, { text: p.trim() })),
|
|
65
66
|
onSuccess: () => {
|
|
66
|
-
|
|
67
|
+
f(""), i.signalReplying(!1), u();
|
|
67
68
|
},
|
|
68
69
|
onError: x
|
|
69
70
|
});
|
|
70
|
-
return /* @__PURE__ */ a(
|
|
71
|
-
|
|
71
|
+
return /* @__PURE__ */ a(V, { open: n != null, onOpenChange: c, children: /* @__PURE__ */ a(
|
|
72
|
+
X,
|
|
72
73
|
{
|
|
73
74
|
side: "right",
|
|
74
75
|
className: "flex w-[560px] max-w-[96vw] flex-col gap-0 p-0 sm:max-w-[560px] dark:bg-card",
|
|
75
76
|
"data-support-ticket": n ?? "",
|
|
76
|
-
children:
|
|
77
|
-
/* @__PURE__ */ r(
|
|
77
|
+
children: Q || !e ? /* @__PURE__ */ a("div", { className: "flex flex-1 items-center justify-center text-slate-400", children: /* @__PURE__ */ a(A, { className: "h-5 w-5 animate-spin" }) }) : /* @__PURE__ */ r(h, { children: [
|
|
78
|
+
/* @__PURE__ */ r(Y, { className: "border-b border-slate-200 px-5 py-4 dark:border-border", children: [
|
|
78
79
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-2 pr-6", children: [
|
|
79
80
|
/* @__PURE__ */ r("span", { className: "font-mono text-[11.5px] text-slate-400", children: [
|
|
80
81
|
"#",
|
|
81
82
|
e.id
|
|
82
83
|
] }),
|
|
83
|
-
/* @__PURE__ */ a(
|
|
84
|
+
/* @__PURE__ */ a(te, { status: e.status, label: e.status_label }),
|
|
84
85
|
e.priority === "urgent" && /* @__PURE__ */ a("span", { className: "rounded bg-red-500/10 px-1.5 py-px text-[10px] font-semibold uppercase tracking-wide text-red-600 dark:text-red-400", children: "urgent" })
|
|
85
86
|
] }),
|
|
86
|
-
/* @__PURE__ */ a(
|
|
87
|
-
/* @__PURE__ */ r(
|
|
87
|
+
/* @__PURE__ */ a(Z, { className: "mt-1 text-left text-[16px] font-semibold text-slate-900 dark:text-slate-100", children: e.title }),
|
|
88
|
+
/* @__PURE__ */ r(I, { className: "text-left text-[12px] text-slate-500 dark:text-muted-foreground", children: [
|
|
88
89
|
e.requester_name ?? "Someone",
|
|
89
90
|
" · ",
|
|
90
91
|
y(e.created_at),
|
|
@@ -93,7 +94,7 @@ function xe({
|
|
|
93
94
|
/* @__PURE__ */ a("div", { className: "mt-1 text-[12px]", children: e.collection && e.item ? /* @__PURE__ */ a(
|
|
94
95
|
"a",
|
|
95
96
|
{
|
|
96
|
-
href:
|
|
97
|
+
href: F({ collection: e.collection, itemId: e.item }),
|
|
97
98
|
onClick: (t) => {
|
|
98
99
|
t.metaKey || t.ctrlKey || t.shiftKey || t.button !== 0 || (t.preventDefault(), P({ collection: e.collection, itemId: e.item }));
|
|
99
100
|
},
|
|
@@ -132,6 +133,20 @@ function xe({
|
|
|
132
133
|
"Not picked up yet",
|
|
133
134
|
e.team_name ? ` · ${e.team_name}` : " · Administrators"
|
|
134
135
|
] }) }),
|
|
136
|
+
/* @__PURE__ */ a(
|
|
137
|
+
z,
|
|
138
|
+
{
|
|
139
|
+
task: {
|
|
140
|
+
id: e.id,
|
|
141
|
+
kind: "support",
|
|
142
|
+
status: e.status,
|
|
143
|
+
assignee: e.assignee,
|
|
144
|
+
category_id: e.category_id,
|
|
145
|
+
title: e.title
|
|
146
|
+
},
|
|
147
|
+
onTaskChanged: () => void l.invalidateQueries({ queryKey: ["support-ticket", n] })
|
|
148
|
+
}
|
|
149
|
+
),
|
|
135
150
|
(e.status === "open" || e.status === "in_progress") && /* @__PURE__ */ a(
|
|
136
151
|
"button",
|
|
137
152
|
{
|
|
@@ -166,7 +181,7 @@ function xe({
|
|
|
166
181
|
onChange: (t) => o.mutate({ category_id: t ? Number(t) : null }),
|
|
167
182
|
options: [
|
|
168
183
|
{ value: "", label: "No type" },
|
|
169
|
-
...
|
|
184
|
+
...R.map((t) => ({ value: String(t.id), label: t.name }))
|
|
170
185
|
],
|
|
171
186
|
ariaLabel: "Type",
|
|
172
187
|
className: "mt-1"
|
|
@@ -176,7 +191,7 @@ function xe({
|
|
|
176
191
|
/* @__PURE__ */ r("div", { className: "col-span-2 text-[11px] font-medium text-slate-500 dark:text-muted-foreground", children: [
|
|
177
192
|
"Assignee",
|
|
178
193
|
/* @__PURE__ */ a("div", { className: "mt-1", children: /* @__PURE__ */ a(
|
|
179
|
-
|
|
194
|
+
J,
|
|
180
195
|
{
|
|
181
196
|
collection: "nivaro_users",
|
|
182
197
|
value: e.assignee,
|
|
@@ -192,11 +207,11 @@ function xe({
|
|
|
192
207
|
/* @__PURE__ */ a("h3", { className: "mb-1.5 text-[11px] font-semibold uppercase tracking-wide text-slate-500 dark:text-muted-foreground", children: "Request" }),
|
|
193
208
|
/* @__PURE__ */ a("p", { className: "whitespace-pre-wrap text-[13px] leading-relaxed text-slate-800 dark:text-slate-200", children: e.description || /* @__PURE__ */ a("span", { className: "text-slate-400", children: "No details given." }) }),
|
|
194
209
|
e.replay && e.can.work && (() => {
|
|
195
|
-
const t = M(e.replay),
|
|
196
|
-
return
|
|
210
|
+
const t = M(e.replay), d = m.consoleUrl ? m.consoleUrl(t) : t;
|
|
211
|
+
return d ? /* @__PURE__ */ r(
|
|
197
212
|
"a",
|
|
198
213
|
{
|
|
199
|
-
href:
|
|
214
|
+
href: d,
|
|
200
215
|
target: "_blank",
|
|
201
216
|
rel: "noreferrer",
|
|
202
217
|
"data-ticket-replay": e.replay.recording_id,
|
|
@@ -209,11 +224,11 @@ function xe({
|
|
|
209
224
|
) : null;
|
|
210
225
|
})(),
|
|
211
226
|
e.issue_id != null && e.can.work && (() => {
|
|
212
|
-
const t = `/issues/${e.issue_id}`,
|
|
213
|
-
return
|
|
227
|
+
const t = `/issues/${e.issue_id}`, d = m.consoleUrl ? m.consoleUrl(t) : t;
|
|
228
|
+
return d ? /* @__PURE__ */ r(
|
|
214
229
|
"a",
|
|
215
230
|
{
|
|
216
|
-
href:
|
|
231
|
+
href: d,
|
|
217
232
|
target: "_blank",
|
|
218
233
|
rel: "noreferrer",
|
|
219
234
|
"data-ticket-issue": e.issue_id,
|
|
@@ -228,7 +243,7 @@ function xe({
|
|
|
228
243
|
e.files.length > 0 && /* @__PURE__ */ a("ul", { className: "mt-2 flex flex-wrap gap-1.5", children: e.files.map((t) => /* @__PURE__ */ a("li", { children: /* @__PURE__ */ r(
|
|
229
244
|
"a",
|
|
230
245
|
{
|
|
231
|
-
href: `${
|
|
246
|
+
href: `${K}/files/${t.id}`,
|
|
232
247
|
target: "_blank",
|
|
233
248
|
rel: "noreferrer",
|
|
234
249
|
className: "inline-flex items-center gap-1 rounded bg-slate-100 px-2 py-0.5 text-[11.5px] text-slate-700 hover:underline dark:bg-white/10 dark:text-slate-200",
|
|
@@ -239,7 +254,7 @@ function xe({
|
|
|
239
254
|
}
|
|
240
255
|
) }, t.id)) })
|
|
241
256
|
] }),
|
|
242
|
-
e.can.work && /* @__PURE__ */ a(
|
|
257
|
+
e.can.work && /* @__PURE__ */ a(ee, { ticketId: e.id }),
|
|
243
258
|
/* @__PURE__ */ r("section", { "data-ticket-thread": !0, children: [
|
|
244
259
|
/* @__PURE__ */ a("h3", { className: "mb-2 text-[11px] font-semibold uppercase tracking-wide text-slate-500 dark:text-muted-foreground", children: "Conversation" }),
|
|
245
260
|
e.thread.length === 0 ? /* @__PURE__ */ a("p", { className: "text-[12px] text-slate-400", children: "No replies yet." }) : /* @__PURE__ */ a("ul", { className: "space-y-2.5", children: e.thread.map((t) => /* @__PURE__ */ r(
|
|
@@ -270,7 +285,7 @@ function xe({
|
|
|
270
285
|
"data-ticket-reply": !0,
|
|
271
286
|
value: p,
|
|
272
287
|
onChange: (t) => {
|
|
273
|
-
|
|
288
|
+
f(t.target.value), i.signalReplying(!!t.target.value.trim());
|
|
274
289
|
},
|
|
275
290
|
rows: 3,
|
|
276
291
|
placeholder: "Write a reply",
|
|
@@ -324,7 +339,7 @@ function xe({
|
|
|
324
339
|
]
|
|
325
340
|
}
|
|
326
341
|
),
|
|
327
|
-
|
|
342
|
+
b && /* @__PURE__ */ a("p", { className: "mt-1 text-[12px] text-red-600 dark:text-red-400", role: "alert", children: b })
|
|
328
343
|
] }),
|
|
329
344
|
/* @__PURE__ */ r("section", { "data-ticket-history": !0, children: [
|
|
330
345
|
/* @__PURE__ */ a("h3", { className: "mb-2 text-[11px] font-semibold uppercase tracking-wide text-slate-500 dark:text-muted-foreground", children: "History" }),
|
|
@@ -345,6 +360,6 @@ function xe({
|
|
|
345
360
|
) });
|
|
346
361
|
}
|
|
347
362
|
export {
|
|
348
|
-
|
|
349
|
-
|
|
363
|
+
te as StatusPill,
|
|
364
|
+
ge as TicketDetailSheet
|
|
350
365
|
};
|
|
@@ -1,29 +1,38 @@
|
|
|
1
|
-
import { isCleanRecording as
|
|
2
|
-
import { shouldPlayHere as
|
|
3
|
-
let
|
|
4
|
-
function
|
|
1
|
+
import { isCleanRecording as f } from "../components/help-videos/recorder/cleanRecording.js";
|
|
2
|
+
import { shouldPlayHere as l } from "./tab-sound.js";
|
|
3
|
+
let u = null;
|
|
4
|
+
function d() {
|
|
5
5
|
if (typeof window > "u") return null;
|
|
6
6
|
try {
|
|
7
|
-
return
|
|
8
|
-
}),
|
|
7
|
+
return u || (u = new AudioContext()), u.state === "suspended" && u.resume().catch(() => {
|
|
8
|
+
}), u;
|
|
9
9
|
} catch {
|
|
10
10
|
return null;
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
const i = n.createOscillator(),
|
|
15
|
-
i.type = "sine", i.frequency.value =
|
|
13
|
+
function a(n, o, t, e, r) {
|
|
14
|
+
const i = n.createOscillator(), c = n.createGain();
|
|
15
|
+
i.type = "sine", i.frequency.value = o, c.gain.setValueAtTime(1e-4, t), c.gain.exponentialRampToValueAtTime(r, t + 0.015), c.gain.exponentialRampToValueAtTime(1e-4, t + e), i.connect(c), c.connect(n.destination), i.start(t), i.stop(t + e + 0.05);
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
if (!n || n === "off" ||
|
|
19
|
-
const
|
|
20
|
-
if (
|
|
17
|
+
function y(n, o = {}) {
|
|
18
|
+
if (!n || n === "off" || f() || !o.preview && !l()) return;
|
|
19
|
+
const t = d();
|
|
20
|
+
if (t)
|
|
21
21
|
try {
|
|
22
|
-
const
|
|
23
|
-
n === "chime" ? (
|
|
22
|
+
const e = t.currentTime;
|
|
23
|
+
n === "chime" ? (a(t, 660, e, 0.14, 0.06), a(t, 880, e + 0.12, 0.2, 0.06)) : a(t, 880, e, 0.09, 0.03);
|
|
24
24
|
} catch {
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
+
function g(n, o) {
|
|
28
|
+
const t = n == null ? void 0 : n.notification_sounds;
|
|
29
|
+
if (o && t && typeof t == "object") {
|
|
30
|
+
const e = t[o];
|
|
31
|
+
if (e === "off" || e === "subtle" || e === "chime") return e;
|
|
32
|
+
}
|
|
33
|
+
return typeof (n == null ? void 0 : n.notification_sound) == "string" ? n.notification_sound : "off";
|
|
34
|
+
}
|
|
27
35
|
export {
|
|
28
|
-
|
|
36
|
+
y as playNotificationSound,
|
|
37
|
+
g as soundForCategory
|
|
29
38
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nivaro/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "React hooks and components for Nivaro CMS forms",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -85,6 +85,7 @@
|
|
|
85
85
|
"class-variance-authority": "^0.7.0",
|
|
86
86
|
"clsx": "^2.0.0",
|
|
87
87
|
"cmdk": "^1.0.0",
|
|
88
|
+
"livekit-client": "^2.23.0",
|
|
88
89
|
"lucide-react": "^0.460.0",
|
|
89
90
|
"recharts": "^3.8.1",
|
|
90
91
|
"tailwind-merge": "^2.0.0",
|