@nivaro/react 0.2.54 → 0.2.55
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 +99 -98
- package/dist/index.d.ts +339 -2
- package/dist/index.js +644 -618
- package/dist/layout-editor.d.ts +4 -0
- package/dist/shared/components/BackgroundRunOffer.js +117 -0
- package/dist/shared/components/BroadcastView.js +214 -213
- package/dist/shared/components/CollectionBrowserView.js +2592 -2695
- package/dist/shared/components/ItemEditForm.js +4066 -3832
- package/dist/shared/components/JobsTray.js +100 -55
- package/dist/shared/components/MyWorkView.js +91 -89
- package/dist/shared/components/NotificationBell.js +80 -79
- package/dist/shared/components/ProfileView.js +568 -520
- package/dist/shared/components/RecordCompare.js +254 -0
- package/dist/shared/components/RecordReadView.js +599 -552
- package/dist/shared/components/ReportView.js +578 -543
- package/dist/shared/components/RowPresence.js +91 -0
- package/dist/shared/components/WidgetSlot.js +474 -458
- package/dist/shared/components/ai/AiAnalyticsView.js +16 -6
- package/dist/shared/components/ai/AskPanel.js +139 -119
- package/dist/shared/components/ai/FirstWeekCard.js +126 -0
- package/dist/shared/components/bulk/BulkFieldUpdate.js +289 -0
- package/dist/shared/components/bulk/bulk-field-options.js +45 -0
- package/dist/shared/components/charts/CumulativeFlowChart.js +176 -0
- package/dist/shared/components/chat/ChannelArchive.js +326 -0
- package/dist/shared/components/chat/ChannelExtras.js +141 -121
- package/dist/shared/components/chat/ChatAnalyticsView.js +112 -110
- package/dist/shared/components/chat/ChatPanel.js +1695 -1733
- package/dist/shared/components/chat/Composer.js +357 -303
- package/dist/shared/components/chat/MessageActions.js +92 -0
- package/dist/shared/components/chat/MessageFormat.js +290 -264
- package/dist/shared/components/chat/OutboxBubbles.js +146 -0
- package/dist/shared/components/chat/RequestIdCard.js +135 -0
- package/dist/shared/components/chat/RoomHeaderMenu.js +202 -0
- package/dist/shared/components/chat/RoomParts.js +213 -274
- package/dist/shared/components/chat/ScreenClip.js +184 -0
- package/dist/shared/components/chat/chat-core.js +402 -483
- package/dist/shared/components/chat/chat-drafts.js +59 -0
- package/dist/shared/components/chat/chat-emoji.js +348 -0
- package/dist/shared/components/chat/chat-local-time.js +41 -0
- package/dist/shared/components/chat/chat-outbox.js +303 -0
- package/dist/shared/components/chat/chat-window.js +163 -0
- package/dist/shared/components/chat/huddle/HuddleControls.js +143 -0
- package/dist/shared/components/chat/huddle/HuddleStage.js +164 -0
- package/dist/shared/components/chat/huddle/huddle-store.js +342 -0
- package/dist/shared/components/chat/huddle/useHuddle.js +58 -0
- package/dist/shared/components/help-videos/api.js +76 -73
- package/dist/shared/components/item-edit/CatalogPickerField.js +113 -112
- package/dist/shared/components/item-edit/ChangeReasonDialog.js +13 -13
- package/dist/shared/components/item-edit/FieldAffordances.js +2 -2
- package/dist/shared/components/item-edit/FieldRenderer.js +248 -245
- package/dist/shared/components/item-edit/FieldRow.js +292 -279
- package/dist/shared/components/item-edit/GroupSection.js +698 -574
- package/dist/shared/components/item-edit/InlineTableField.js +3 -1
- package/dist/shared/components/item-edit/RelationCombobox.js +186 -176
- package/dist/shared/components/item-edit/entry/EntryStrip.js +54 -0
- package/dist/shared/components/item-edit/entry/entry-keys.js +27 -0
- package/dist/shared/components/item-edit/entry/useEntryKeyboard.js +70 -0
- package/dist/shared/components/item-edit/entry/useEntryMode.js +59 -0
- package/dist/shared/components/item-edit/form-structure-ui.js +105 -0
- package/dist/shared/components/item-edit/lazy-sections.js +36 -0
- package/dist/shared/components/item-edit/lock-why.js +39 -32
- package/dist/shared/components/item-edit/picker-miss.js +26 -0
- package/dist/shared/components/item-edit/placement-behaviour.js +196 -0
- package/dist/shared/components/item-edit/useFormUsageBeacon.js +51 -45
- package/dist/shared/components/layout-editor/AddPanel.js +134 -117
- package/dist/shared/components/layout-editor/ChangeNote.js +25 -24
- package/dist/shared/components/layout-editor/CollabParts.js +80 -75
- package/dist/shared/components/layout-editor/DesignNode.js +126 -120
- package/dist/shared/components/layout-editor/EditorCanvas.js +30 -27
- package/dist/shared/components/layout-editor/EditorTopBar.js +203 -192
- package/dist/shared/components/layout-editor/HistoryPanel.js +120 -104
- package/dist/shared/components/layout-editor/LayoutEditor.js +768 -671
- package/dist/shared/components/layout-editor/RestorePiece.js +143 -0
- package/dist/shared/components/layout-editor/StagedChip.js +22 -0
- package/dist/shared/components/layout-editor/StructureMenu.js +237 -186
- package/dist/shared/components/layout-editor/collab/FormFollowShare.js +149 -103
- package/dist/shared/components/layout-editor/collab/collab-api.js +29 -26
- package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +81 -80
- package/dist/shared/components/layout-editor/dnd/node.js +69 -57
- package/dist/shared/components/layout-editor/draft-recovery.js +113 -43
- package/dist/shared/components/layout-editor/entry/PlacementPresets.js +149 -0
- package/dist/shared/components/layout-editor/entry/entry-editor-context.js +10 -0
- package/dist/shared/components/layout-editor/entry/presets.js +71 -0
- package/dist/shared/components/layout-editor/entry/tab-order.js +110 -0
- package/dist/shared/components/layout-editor/entry/theme-preview.js +37 -0
- package/dist/shared/components/layout-editor/grid-guides.js +142 -0
- package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +402 -0
- package/dist/shared/components/layout-editor/inspector/BulkInspector.js +61 -57
- package/dist/shared/components/layout-editor/inspector/GroupInspector.js +247 -151
- package/dist/shared/components/layout-editor/inspector/Inspector.js +176 -155
- package/dist/shared/components/layout-editor/inspector/LookTab.js +167 -116
- package/dist/shared/components/layout-editor/inspector/PickerMisses.js +129 -0
- package/dist/shared/components/layout-editor/inspector/PickerTab.js +84 -82
- package/dist/shared/components/layout-editor/inspector/RulesTab.js +66 -62
- package/dist/shared/components/layout-editor/inspector/kit.js +69 -68
- package/dist/shared/components/layout-editor/outputs/OutputsButton.js +254 -0
- package/dist/shared/components/layout-editor/outputs/help-sheet.js +154 -0
- package/dist/shared/components/layout-editor/outputs/output-api.js +61 -0
- package/dist/shared/components/layout-editor/overview/describe-conditions.js +6 -0
- package/dist/shared/components/layout-editor/overview/purpose.js +15 -13
- package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
- package/dist/shared/components/layout-editor/restore-piece.js +192 -0
- package/dist/shared/components/layout-editor/section-structure.js +241 -0
- package/dist/shared/components/layout-editor/settings/EntrySection.js +296 -0
- package/dist/shared/components/layout-editor/settings/FormSettings.js +41 -39
- package/dist/shared/components/layout-editor/settings/ResolveSettings.js +255 -0
- package/dist/shared/components/layout-editor/settings/ToolsSection.js +147 -111
- package/dist/shared/components/layout-editor/settings/WhoSection.js +29 -26
- package/dist/shared/components/layout-editor/settings/settings-registry.js +114 -17
- package/dist/shared/components/layout-editor/staged-api.js +64 -0
- package/dist/shared/components/layout-editor/structure-ops.js +81 -77
- package/dist/shared/components/layout-editor/testing/TestingPanels.js +65 -60
- package/dist/shared/components/layout-editor/testing/testing-model.js +198 -185
- package/dist/shared/components/layout-editor/toolbar-kit.js +11 -11
- package/dist/shared/components/layout-editor/usage/AbTestSection.js +355 -0
- package/dist/shared/components/layout-editor/usage/UsagePanel.js +144 -70
- package/dist/shared/components/layout-editor/usage/ab-api.js +86 -0
- package/dist/shared/components/layout-editor/usage/suggest-collapse.js +32 -0
- package/dist/shared/components/layout-editor/useLayoutDraft.js +25 -24
- package/dist/shared/components/notifications/NotificationAnalyticsView.js +148 -77
- package/dist/shared/components/panels/ErpFailureBanner.js +18 -17
- package/dist/shared/components/panels/ExternalRequestsChip.js +63 -62
- package/dist/shared/components/pipeline/PipelineEditorView.js +106 -104
- package/dist/shared/components/profile/AgentsPanel.js +479 -0
- package/dist/shared/components/queue/QueueWorklist.js +1026 -1040
- package/dist/shared/components/support/SupportAnalytics.js +171 -0
- package/dist/shared/components/support/SupportView.js +75 -73
- package/dist/shared/lib/background-runs.js +150 -0
- package/dist/shared/lib/delivery-ack.js +9 -0
- package/dist/shared/lib/entry-badge-style.js +13 -0
- package/dist/shared/lib/entry-config.js +71 -0
- package/dist/shared/lib/form-sections.js +64 -0
- package/dist/shared/lib/form-structure.js +99 -0
- package/dist/shared/lib/form-usage-beacon.js +101 -52
- package/dist/shared/lib/jobs-tray.js +25 -23
- package/dist/shared/lib/keyset-pager.js +37 -0
- package/dist/shared/lib/layout-ops.js +84 -82
- package/dist/shared/lib/layout-resolve.js +113 -0
- package/dist/shared/lib/placement-behaviour.js +144 -0
- package/dist/shared/lib/prefetch.js +149 -0
- package/dist/shared/lib/presence-hooks.js +199 -0
- package/dist/shared/lib/record-outbox.js +82 -81
- package/dist/shared/lib/replay-socket.js +93 -0
- package/dist/shared/lib/request-gate.js +51 -50
- package/dist/shared/lib/room-gaps.js +96 -0
- package/dist/shared/lib/search-log.js +27 -0
- package/dist/shared/lib/socket-realtime.js +101 -80
- package/dist/shared/lib/worker-socket.js +200 -0
- package/package.json +1 -1
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { jsxs as s, jsx as e, Fragment as g } from "react/jsx-runtime";
|
|
2
|
+
import { useQuery as k } from "@tanstack/react-query";
|
|
3
|
+
import { useState as N } from "react";
|
|
4
|
+
import { useNivaroClient as y } from "../../context.js";
|
|
5
|
+
import { get as w } from "../../lib/commands.js";
|
|
6
|
+
import { cn as p, formatNumber as u } from "../../lib/utils.js";
|
|
7
|
+
import { Skeleton as x } from "../ui/skeleton.js";
|
|
8
|
+
const v = [7, 30, 90];
|
|
9
|
+
function c(t) {
|
|
10
|
+
return t == null ? "—" : t < 1 ? `${Math.max(1, Math.round(t * 60))} min` : t < 48 ? `${Number.isInteger(t) ? t : t.toFixed(1)} h` : `${(t / 24).toFixed(1)} d`;
|
|
11
|
+
}
|
|
12
|
+
const m = (t) => t == null ? "—" : `${Math.round(t * 100)}%`;
|
|
13
|
+
function o({ rows: t, empty: l }) {
|
|
14
|
+
if (!t.length) return /* @__PURE__ */ e("p", { className: "text-[12px] text-muted-foreground", children: l });
|
|
15
|
+
const n = Math.max(...t.map((d) => d.n), 1);
|
|
16
|
+
return /* @__PURE__ */ e("ul", { className: "space-y-1.5", children: t.map((d) => /* @__PURE__ */ s("li", { className: "flex items-center gap-2 text-[12px]", children: [
|
|
17
|
+
/* @__PURE__ */ e(
|
|
18
|
+
"span",
|
|
19
|
+
{
|
|
20
|
+
className: "w-40 shrink-0 truncate text-slate-700 dark:text-slate-200",
|
|
21
|
+
"data-tip": d.label,
|
|
22
|
+
children: d.label
|
|
23
|
+
}
|
|
24
|
+
),
|
|
25
|
+
/* @__PURE__ */ e("span", { className: "h-2 min-w-0 flex-1 overflow-hidden rounded-full bg-slate-100 dark:bg-white/10", children: /* @__PURE__ */ e(
|
|
26
|
+
"span",
|
|
27
|
+
{
|
|
28
|
+
className: "block h-full rounded-full bg-nvr-cyan",
|
|
29
|
+
style: { width: `${Math.max(3, d.n / n * 100)}%` }
|
|
30
|
+
}
|
|
31
|
+
) }),
|
|
32
|
+
/* @__PURE__ */ e("span", { className: "w-10 shrink-0 text-right tabular-nums text-slate-500 dark:text-muted-foreground", children: u(d.n) })
|
|
33
|
+
] }, d.label)) });
|
|
34
|
+
}
|
|
35
|
+
function i({ title: t, children: l }) {
|
|
36
|
+
return /* @__PURE__ */ s("section", { className: "rounded-lg border border-slate-200 bg-white p-4 dark:border-border dark:bg-card", children: [
|
|
37
|
+
/* @__PURE__ */ e("h3", { className: "mb-3 text-[13px] font-semibold text-slate-800 dark:text-foreground", children: t }),
|
|
38
|
+
l
|
|
39
|
+
] });
|
|
40
|
+
}
|
|
41
|
+
function h({ label: t, p: l, hint: n }) {
|
|
42
|
+
return /* @__PURE__ */ s("div", { className: "bg-white px-4 py-3 dark:bg-card", children: [
|
|
43
|
+
/* @__PURE__ */ e("p", { className: "text-[11.5px] text-slate-500 dark:text-muted-foreground", children: t }),
|
|
44
|
+
/* @__PURE__ */ s("p", { className: "mt-1 text-[18px] font-semibold tabular-nums text-slate-900 dark:text-foreground", children: [
|
|
45
|
+
c(l.p50_hours),
|
|
46
|
+
l.samples > 0 && /* @__PURE__ */ e("span", { className: "ml-1.5 text-[11.5px] font-normal text-slate-500 dark:text-muted-foreground", children: "median" })
|
|
47
|
+
] }),
|
|
48
|
+
l.samples > 0 && /* @__PURE__ */ s("p", { className: "mt-0.5 text-[12px] tabular-nums text-slate-600 dark:text-slate-300", children: [
|
|
49
|
+
"p75 ",
|
|
50
|
+
c(l.p75_hours),
|
|
51
|
+
" · ",
|
|
52
|
+
m(l.within_target),
|
|
53
|
+
" within",
|
|
54
|
+
" ",
|
|
55
|
+
c(l.target_hours)
|
|
56
|
+
] }),
|
|
57
|
+
/* @__PURE__ */ e("p", { className: "mt-0.5 text-[11px] text-slate-500 dark:text-muted-foreground", children: l.samples === 0 ? `No ${n} yet` : `${u(l.samples)} ticket${l.samples === 1 ? "" : "s"}` })
|
|
58
|
+
] });
|
|
59
|
+
}
|
|
60
|
+
function C({ className: t }) {
|
|
61
|
+
const l = y(), [n, d] = N(30), { data: a, isLoading: b, isError: f } = k({
|
|
62
|
+
queryKey: ["support-analytics", n],
|
|
63
|
+
queryFn: () => l.request(w("/support/analytics", { days: n })).then((r) => r.data)
|
|
64
|
+
});
|
|
65
|
+
return /* @__PURE__ */ s("div", { className: p("mt-4 space-y-4", t), "data-support-analytics": !0, children: [
|
|
66
|
+
/* @__PURE__ */ s("div", { className: "flex items-center justify-between gap-3", children: [
|
|
67
|
+
/* @__PURE__ */ e("p", { className: "text-[12px] text-slate-500 dark:text-muted-foreground", children: "Tickets raised in the window. Counts and timings only — no ticket text." }),
|
|
68
|
+
/* @__PURE__ */ e("span", { className: "flex shrink-0 rounded-md border border-slate-200 p-0.5 dark:border-border", children: v.map((r) => /* @__PURE__ */ s(
|
|
69
|
+
"button",
|
|
70
|
+
{
|
|
71
|
+
type: "button",
|
|
72
|
+
onClick: () => d(r),
|
|
73
|
+
"aria-pressed": n === r,
|
|
74
|
+
"aria-label": `Last ${r} days`,
|
|
75
|
+
className: p(
|
|
76
|
+
"rounded px-2.5 py-1 text-[12px] font-medium focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan",
|
|
77
|
+
n === r ? "bg-nvr-cyan/10 text-slate-800 dark:text-foreground" : "text-slate-500 hover:bg-muted dark:text-muted-foreground"
|
|
78
|
+
),
|
|
79
|
+
children: [
|
|
80
|
+
r,
|
|
81
|
+
"d"
|
|
82
|
+
]
|
|
83
|
+
},
|
|
84
|
+
r
|
|
85
|
+
)) })
|
|
86
|
+
] }),
|
|
87
|
+
b ? /* @__PURE__ */ s("div", { className: "space-y-3", children: [
|
|
88
|
+
/* @__PURE__ */ e(x, { className: "h-24 w-full" }),
|
|
89
|
+
/* @__PURE__ */ e(x, { className: "h-40 w-full" })
|
|
90
|
+
] }) : f || !a ? /* @__PURE__ */ e("p", { className: "text-[12.5px] text-red-600 dark:text-red-400", children: "Analytics could not be loaded." }) : a.totals.tickets === 0 ? /* @__PURE__ */ s("p", { className: "py-10 text-center text-[12.5px] text-muted-foreground", children: [
|
|
91
|
+
"No tickets were raised in the last ",
|
|
92
|
+
n,
|
|
93
|
+
" days."
|
|
94
|
+
] }) : /* @__PURE__ */ s(g, { children: [
|
|
95
|
+
/* @__PURE__ */ s("div", { className: "grid gap-px overflow-hidden rounded-lg border border-slate-200 bg-slate-200 sm:grid-cols-2 lg:grid-cols-4 dark:border-border dark:bg-border", children: [
|
|
96
|
+
/* @__PURE__ */ s("div", { className: "bg-white px-4 py-3 dark:bg-card", children: [
|
|
97
|
+
/* @__PURE__ */ e("p", { className: "text-[11.5px] text-slate-500 dark:text-muted-foreground", children: "Tickets" }),
|
|
98
|
+
/* @__PURE__ */ e("p", { className: "mt-1 text-[18px] font-semibold tabular-nums text-slate-900 dark:text-foreground", children: u(a.totals.tickets) }),
|
|
99
|
+
/* @__PURE__ */ s("p", { className: "mt-0.5 text-[12px] tabular-nums text-slate-600 dark:text-slate-300", children: [
|
|
100
|
+
a.totals.open,
|
|
101
|
+
" open · ",
|
|
102
|
+
a.totals.done,
|
|
103
|
+
" done · ",
|
|
104
|
+
a.totals.cancelled,
|
|
105
|
+
" ",
|
|
106
|
+
"cancelled"
|
|
107
|
+
] })
|
|
108
|
+
] }),
|
|
109
|
+
/* @__PURE__ */ e(h, { label: "First response", p: a.first_response, hint: "replies" }),
|
|
110
|
+
/* @__PURE__ */ e(h, { label: "Resolution", p: a.resolution, hint: "resolved tickets" }),
|
|
111
|
+
/* @__PURE__ */ s("div", { className: "bg-white px-4 py-3 dark:bg-card", children: [
|
|
112
|
+
/* @__PURE__ */ e("p", { className: "text-[11.5px] text-slate-500 dark:text-muted-foreground", children: "Reopened" }),
|
|
113
|
+
/* @__PURE__ */ e("p", { className: "mt-1 text-[18px] font-semibold tabular-nums text-slate-900 dark:text-foreground", children: m(a.reopen.rate) }),
|
|
114
|
+
/* @__PURE__ */ s("p", { className: "mt-0.5 text-[12px] tabular-nums text-slate-600 dark:text-slate-300", children: [
|
|
115
|
+
a.reopen.reopened,
|
|
116
|
+
" of ",
|
|
117
|
+
a.reopen.closed_ever,
|
|
118
|
+
" closed tickets"
|
|
119
|
+
] })
|
|
120
|
+
] })
|
|
121
|
+
] }),
|
|
122
|
+
/* @__PURE__ */ s("div", { className: "grid gap-4 lg:grid-cols-2", children: [
|
|
123
|
+
/* @__PURE__ */ e(i, { title: "By request type", children: /* @__PURE__ */ e(
|
|
124
|
+
o,
|
|
125
|
+
{
|
|
126
|
+
rows: a.by_type.map((r) => ({ label: r.name, n: r.tickets })),
|
|
127
|
+
empty: "No tickets."
|
|
128
|
+
}
|
|
129
|
+
) }),
|
|
130
|
+
/* @__PURE__ */ e(i, { title: "By team", children: /* @__PURE__ */ e(
|
|
131
|
+
o,
|
|
132
|
+
{
|
|
133
|
+
rows: a.by_team.map((r) => ({ label: r.name, n: r.tickets })),
|
|
134
|
+
empty: "No tickets."
|
|
135
|
+
}
|
|
136
|
+
) }),
|
|
137
|
+
/* @__PURE__ */ e(i, { title: "Tickets per kind of record", children: /* @__PURE__ */ e(
|
|
138
|
+
o,
|
|
139
|
+
{
|
|
140
|
+
rows: a.by_collection.map((r) => ({ label: r.collection, n: r.tickets })),
|
|
141
|
+
empty: "No tickets."
|
|
142
|
+
}
|
|
143
|
+
) }),
|
|
144
|
+
/* @__PURE__ */ e(i, { title: "Busiest requesters", children: /* @__PURE__ */ e(
|
|
145
|
+
o,
|
|
146
|
+
{
|
|
147
|
+
rows: a.busiest_requesters.map((r) => ({
|
|
148
|
+
label: r.name ?? r.id.slice(0, 8),
|
|
149
|
+
n: r.tickets
|
|
150
|
+
})),
|
|
151
|
+
empty: "No requesters."
|
|
152
|
+
}
|
|
153
|
+
) })
|
|
154
|
+
] }),
|
|
155
|
+
/* @__PURE__ */ e(i, { title: "Tickets with a clip or screenshot", children: /* @__PURE__ */ s("p", { className: "text-[12.5px] text-slate-700 dark:text-slate-200", children: [
|
|
156
|
+
/* @__PURE__ */ e("span", { className: "font-semibold tabular-nums", children: m(a.evidence.share) }),
|
|
157
|
+
" of tickets carried one (",
|
|
158
|
+
a.evidence.with_clip,
|
|
159
|
+
" with a replay clip,",
|
|
160
|
+
" ",
|
|
161
|
+
a.evidence.with_screenshot,
|
|
162
|
+
" with a screenshot or file)."
|
|
163
|
+
] }) }),
|
|
164
|
+
a.window.truncated && /* @__PURE__ */ e("p", { className: "text-[11.5px] text-muted-foreground", children: "The window holds more tickets than are counted; narrow it for exact figures." })
|
|
165
|
+
] })
|
|
166
|
+
] });
|
|
167
|
+
}
|
|
168
|
+
export {
|
|
169
|
+
C as SupportAnalytics,
|
|
170
|
+
c as formatHours
|
|
171
|
+
};
|
|
@@ -1,44 +1,45 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useQueryClient as
|
|
1
|
+
import { jsxs as n, jsx as t, Fragment as T } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as $, useQuery as f, useMutation as S } from "@tanstack/react-query";
|
|
3
3
|
import { Plus as V, Search as P, LifeBuoy as I } from "lucide-react";
|
|
4
|
-
import { useState as c, useRef as U, useEffect as
|
|
5
|
-
import { useNivaroClient as
|
|
4
|
+
import { useState as c, useRef as U, useEffect as M } from "react";
|
|
5
|
+
import { useNivaroClient as R, useItemEditAuth as W } from "../../context.js";
|
|
6
6
|
import { get as v, patch as Y, post as z, del as H } from "../../lib/commands.js";
|
|
7
7
|
import { useLiveOps as J } from "../../lib/live-ops.js";
|
|
8
8
|
import { RelationCombobox as X } from "../item-edit/RelationCombobox.js";
|
|
9
9
|
import { SimpleSelect as Z } from "../ui/SimpleSelect.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
10
|
+
import { SupportAnalytics as ee } from "./SupportAnalytics.js";
|
|
11
|
+
import { SupportRequestDialog as te } from "./SupportRequestDialog.js";
|
|
12
|
+
import { StatusPill as ae, TicketDetailSheet as re } from "./TicketDetailSheet.js";
|
|
13
|
+
function se(l) {
|
|
13
14
|
if (!l) return "";
|
|
14
15
|
const i = Math.round((Date.now() - new Date(l).getTime()) / 6e4);
|
|
15
16
|
if (i < 60) return `${Math.max(i, 1)}m ago`;
|
|
16
|
-
const
|
|
17
|
-
return
|
|
17
|
+
const d = Math.round(i / 60);
|
|
18
|
+
return d < 48 ? `${d}h ago` : `${Math.round(d / 24)}d ago`;
|
|
18
19
|
}
|
|
19
|
-
function
|
|
20
|
+
function ye({
|
|
20
21
|
initialTicketId: l,
|
|
21
22
|
onTicketChange: i,
|
|
22
|
-
className:
|
|
23
|
+
className: d
|
|
23
24
|
}) {
|
|
24
|
-
const p =
|
|
25
|
+
const p = R(), m = $(), h = W(), x = !!(h != null && h.isAdmin), [s, b] = c("mine"), y = U(!1), a = (e) => {
|
|
25
26
|
y.current = !0, b(e);
|
|
26
|
-
}, [r, _] = c(l ?? null), [
|
|
27
|
-
|
|
27
|
+
}, [r, _] = c(l ?? null), [Q, C] = c(!1), [k, A] = c("open"), [g, O] = c("unassigned"), [N, j] = c("");
|
|
28
|
+
M(() => {
|
|
28
29
|
l != null && _(l);
|
|
29
30
|
}, [l]);
|
|
30
|
-
const { data:
|
|
31
|
+
const { data: o } = f({
|
|
31
32
|
queryKey: ["support-summary"],
|
|
32
33
|
queryFn: () => p.request(v("/support/summary")).then((e) => e.data)
|
|
33
|
-
}),
|
|
34
|
+
}), F = !!(o != null && o.desk);
|
|
34
35
|
J("support", () => {
|
|
35
36
|
m.invalidateQueries({ queryKey: ["support-tickets"] }), m.invalidateQueries({ queryKey: ["support-summary"] }), m.invalidateQueries({ queryKey: ["support-ticket"] });
|
|
36
37
|
});
|
|
37
|
-
const [
|
|
38
|
-
|
|
39
|
-
!
|
|
40
|
-
}, [
|
|
41
|
-
const w =
|
|
38
|
+
const [D, B] = c(!1);
|
|
39
|
+
M(() => {
|
|
40
|
+
!D && o && (o.desk && !y.current && b("desk"), B(!0));
|
|
41
|
+
}, [o, D]);
|
|
42
|
+
const w = s === "desk" ? {
|
|
42
43
|
scope: "desk",
|
|
43
44
|
status: g === "closed" ? "closed" : "open",
|
|
44
45
|
...g === "unassigned" ? { assignee: "unassigned" } : {},
|
|
@@ -48,25 +49,26 @@ function be({
|
|
|
48
49
|
const { data: u, isLoading: E } = f({
|
|
49
50
|
queryKey: ["support-tickets", w],
|
|
50
51
|
queryFn: () => p.request(v("/support/tickets", w)),
|
|
51
|
-
enabled:
|
|
52
|
+
enabled: s !== "types" && s !== "analytics"
|
|
52
53
|
}), q = (e) => {
|
|
53
54
|
_(e), i == null || i(e);
|
|
54
55
|
}, G = [
|
|
55
|
-
{ key: "mine", label: "My requests", count:
|
|
56
|
-
...
|
|
56
|
+
{ key: "mine", label: "My requests", count: o == null ? void 0 : o.mine_open },
|
|
57
|
+
...F ? [{ key: "desk", label: "Desk", count: o == null ? void 0 : o.unassigned }] : [],
|
|
58
|
+
...F ? [{ key: "analytics", label: "Analytics" }] : [],
|
|
57
59
|
...x ? [{ key: "types", label: "Request types" }] : []
|
|
58
60
|
];
|
|
59
|
-
return /* @__PURE__ */
|
|
60
|
-
/* @__PURE__ */
|
|
61
|
-
/* @__PURE__ */ t("div", { className: "flex items-center gap-1", role: "tablist", children: G.map((e) => /* @__PURE__ */
|
|
61
|
+
return /* @__PURE__ */ n("div", { className: d, "data-support-view": !0, children: [
|
|
62
|
+
/* @__PURE__ */ n("div", { className: "flex flex-wrap items-center justify-between gap-3", children: [
|
|
63
|
+
/* @__PURE__ */ t("div", { className: "flex items-center gap-1", role: "tablist", children: G.map((e) => /* @__PURE__ */ n(
|
|
62
64
|
"button",
|
|
63
65
|
{
|
|
64
66
|
type: "button",
|
|
65
67
|
role: "tab",
|
|
66
|
-
"aria-selected":
|
|
68
|
+
"aria-selected": s === e.key,
|
|
67
69
|
"data-support-tab": e.key,
|
|
68
70
|
onClick: () => a(e.key),
|
|
69
|
-
className:
|
|
71
|
+
className: s === e.key ? "inline-flex h-8 items-center gap-1.5 rounded-md bg-nvr-cyan/10 px-3 text-[12.5px] font-medium text-nvr-navy dark:text-nvr-cyan" : "inline-flex h-8 items-center gap-1.5 rounded-md px-3 text-[12.5px] text-slate-600 hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-white/5",
|
|
70
72
|
children: [
|
|
71
73
|
e.label,
|
|
72
74
|
e.count ? /* @__PURE__ */ t("span", { className: "rounded-full bg-slate-200 px-1.5 text-[10.5px] font-semibold tabular-nums text-slate-700 dark:bg-white/10 dark:text-slate-200", children: e.count }) : null
|
|
@@ -74,7 +76,7 @@ function be({
|
|
|
74
76
|
},
|
|
75
77
|
e.key
|
|
76
78
|
)) }),
|
|
77
|
-
/* @__PURE__ */
|
|
79
|
+
/* @__PURE__ */ n(
|
|
78
80
|
"button",
|
|
79
81
|
{
|
|
80
82
|
type: "button",
|
|
@@ -88,9 +90,9 @@ function be({
|
|
|
88
90
|
}
|
|
89
91
|
)
|
|
90
92
|
] }),
|
|
91
|
-
|
|
92
|
-
/* @__PURE__ */
|
|
93
|
-
(
|
|
93
|
+
s === "types" ? /* @__PURE__ */ t(ne, {}) : s === "analytics" ? /* @__PURE__ */ t(ee, {}) : /* @__PURE__ */ n(T, { children: [
|
|
94
|
+
/* @__PURE__ */ n("div", { className: "mt-4 flex flex-wrap items-center gap-2", children: [
|
|
95
|
+
(s === "desk" ? [
|
|
94
96
|
["unassigned", "Not picked up"],
|
|
95
97
|
["me", "Mine"],
|
|
96
98
|
["open", "All open"],
|
|
@@ -99,27 +101,27 @@ function be({
|
|
|
99
101
|
["open", "Open"],
|
|
100
102
|
["closed", "Closed"]
|
|
101
103
|
]).map(([e, L]) => {
|
|
102
|
-
const
|
|
104
|
+
const K = s === "desk" ? g === e : k === e;
|
|
103
105
|
return /* @__PURE__ */ t(
|
|
104
106
|
"button",
|
|
105
107
|
{
|
|
106
108
|
type: "button",
|
|
107
109
|
"data-support-filter": e,
|
|
108
|
-
"aria-pressed":
|
|
109
|
-
onClick: () =>
|
|
110
|
-
className:
|
|
110
|
+
"aria-pressed": K,
|
|
111
|
+
onClick: () => s === "desk" ? O(e) : A(e),
|
|
112
|
+
className: K ? "h-7 rounded-full border border-nvr-cyan/60 bg-nvr-cyan/10 px-2.5 text-[12px] font-medium text-nvr-navy dark:text-nvr-cyan" : "h-7 rounded-full border border-slate-200 px-2.5 text-[12px] text-slate-600 hover:border-slate-300 dark:border-border dark:text-slate-300",
|
|
111
113
|
children: L
|
|
112
114
|
},
|
|
113
115
|
e
|
|
114
116
|
);
|
|
115
117
|
}),
|
|
116
|
-
/* @__PURE__ */
|
|
118
|
+
/* @__PURE__ */ n("label", { className: "ml-auto flex h-8 items-center gap-1.5 rounded-md border border-slate-200 bg-white px-2 dark:border-border dark:bg-background", children: [
|
|
117
119
|
/* @__PURE__ */ t(P, { className: "h-3.5 w-3.5 text-slate-400" }),
|
|
118
120
|
/* @__PURE__ */ t(
|
|
119
121
|
"input",
|
|
120
122
|
{
|
|
121
123
|
value: N,
|
|
122
|
-
onChange: (e) =>
|
|
124
|
+
onChange: (e) => j(e.target.value),
|
|
123
125
|
placeholder: "Search requests",
|
|
124
126
|
"aria-label": "Search requests",
|
|
125
127
|
className: "w-48 bg-transparent text-[12.5px] text-slate-900 outline-none dark:text-slate-100"
|
|
@@ -133,7 +135,7 @@ function be({
|
|
|
133
135
|
className: "h-10 animate-pulse rounded bg-[hsl(var(--nvr-skeleton))]"
|
|
134
136
|
},
|
|
135
137
|
e
|
|
136
|
-
)) }) : u != null && u.data.length ? /* @__PURE__ */ t("ul", { className: "divide-y divide-slate-100 dark:divide-border/60", "data-support-list": !0, children: u.data.map((e) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */
|
|
138
|
+
)) }) : u != null && u.data.length ? /* @__PURE__ */ t("ul", { className: "divide-y divide-slate-100 dark:divide-border/60", "data-support-list": !0, children: u.data.map((e) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ n(
|
|
137
139
|
"button",
|
|
138
140
|
{
|
|
139
141
|
type: "button",
|
|
@@ -141,9 +143,9 @@ function be({
|
|
|
141
143
|
onClick: () => q(e.id),
|
|
142
144
|
className: "grid w-full grid-cols-[1fr_auto] items-start gap-3 px-4 py-2.5 text-left hover:bg-slate-50 dark:hover:bg-white/5",
|
|
143
145
|
children: [
|
|
144
|
-
/* @__PURE__ */
|
|
145
|
-
/* @__PURE__ */
|
|
146
|
-
/* @__PURE__ */
|
|
146
|
+
/* @__PURE__ */ n("span", { className: "min-w-0", children: [
|
|
147
|
+
/* @__PURE__ */ n("span", { className: "flex items-center gap-2", children: [
|
|
148
|
+
/* @__PURE__ */ n("span", { className: "font-mono text-[11px] text-slate-400", children: [
|
|
147
149
|
"#",
|
|
148
150
|
e.id
|
|
149
151
|
] }),
|
|
@@ -153,23 +155,23 @@ function be({
|
|
|
153
155
|
/* @__PURE__ */ t("span", { className: "mt-0.5 block truncate text-[11.5px] text-slate-500 dark:text-muted-foreground", children: [
|
|
154
156
|
e.record_label ?? "General Support",
|
|
155
157
|
e.category_name,
|
|
156
|
-
|
|
158
|
+
s === "desk" ? e.requester_name : null,
|
|
157
159
|
e.assignee_name ? `with ${e.assignee_name}` : null,
|
|
158
160
|
e.replies ? `${e.replies} repl${e.replies === 1 ? "y" : "ies"}` : null
|
|
159
161
|
].filter(Boolean).join(" · ") })
|
|
160
162
|
] }),
|
|
161
|
-
/* @__PURE__ */
|
|
162
|
-
/* @__PURE__ */ t(
|
|
163
|
-
/* @__PURE__ */ t("span", { className: "text-[11px] text-slate-400", children:
|
|
163
|
+
/* @__PURE__ */ n("span", { className: "flex flex-col items-end gap-1", children: [
|
|
164
|
+
/* @__PURE__ */ t(ae, { status: e.status, label: e.status_label }),
|
|
165
|
+
/* @__PURE__ */ t("span", { className: "text-[11px] text-slate-400", children: se(e.updated_at ?? e.created_at) })
|
|
164
166
|
] })
|
|
165
167
|
]
|
|
166
168
|
}
|
|
167
|
-
) }, e.id)) }) : /* @__PURE__ */
|
|
169
|
+
) }, e.id)) }) : /* @__PURE__ */ n("div", { className: "flex flex-col items-center gap-2 px-6 py-12 text-center", children: [
|
|
168
170
|
/* @__PURE__ */ t(I, { className: "h-6 w-6 text-slate-300" }),
|
|
169
|
-
/* @__PURE__ */ t("p", { className: "text-[13px] font-medium text-slate-700 dark:text-slate-200", children:
|
|
170
|
-
|
|
171
|
+
/* @__PURE__ */ t("p", { className: "text-[13px] font-medium text-slate-700 dark:text-slate-200", children: s === "desk" ? g === "unassigned" ? "Every request has been picked up." : "Nothing here." : k === "open" ? "You have no open requests." : "No closed requests yet." }),
|
|
172
|
+
s === "mine" && /* @__PURE__ */ t("p", { className: "max-w-sm text-[12px] text-slate-500 dark:text-muted-foreground", children: "Use Get help for anything general, or Request a change from a record's ⋯ menu to ask for a change to that record." })
|
|
171
173
|
] }) }),
|
|
172
|
-
u && u.total > u.data.length && /* @__PURE__ */
|
|
174
|
+
u && u.total > u.data.length && /* @__PURE__ */ n("p", { className: "mt-2 text-[11.5px] text-slate-500 dark:text-muted-foreground", children: [
|
|
173
175
|
"Showing ",
|
|
174
176
|
u.data.length,
|
|
175
177
|
" of ",
|
|
@@ -178,30 +180,30 @@ function be({
|
|
|
178
180
|
] })
|
|
179
181
|
] }),
|
|
180
182
|
/* @__PURE__ */ t(
|
|
181
|
-
|
|
183
|
+
te,
|
|
182
184
|
{
|
|
183
|
-
open:
|
|
185
|
+
open: Q,
|
|
184
186
|
onOpenChange: C,
|
|
185
187
|
onCreated: (e) => {
|
|
186
|
-
a("mine"),
|
|
188
|
+
a("mine"), A("open"), q(e.id);
|
|
187
189
|
}
|
|
188
190
|
}
|
|
189
191
|
),
|
|
190
|
-
/* @__PURE__ */ t(
|
|
192
|
+
/* @__PURE__ */ t(re, { ticketId: r, onOpenChange: (e) => !e && q(null) })
|
|
191
193
|
] });
|
|
192
194
|
}
|
|
193
|
-
function
|
|
194
|
-
const l =
|
|
195
|
+
function ne() {
|
|
196
|
+
const l = R(), i = $(), [d, p] = c(""), { data: m = [] } = f({
|
|
195
197
|
queryKey: ["support-categories", "all"],
|
|
196
198
|
queryFn: () => l.request(v("/support/categories", { all: "1" })).then((a) => a.data ?? [])
|
|
197
199
|
}), { data: h = [] } = f({
|
|
198
200
|
queryKey: ["support-teams"],
|
|
199
201
|
queryFn: () => l.request(v("/user-groups")).then((a) => a.data ?? []).catch(() => [])
|
|
200
|
-
}), x = () => void i.invalidateQueries({ queryKey: ["support-categories"] }),
|
|
202
|
+
}), x = () => void i.invalidateQueries({ queryKey: ["support-categories"] }), s = S({
|
|
201
203
|
mutationFn: ({ id: a, body: r }) => l.request(Y(`/support/categories/${a}`, r)),
|
|
202
204
|
onSuccess: x
|
|
203
205
|
}), b = S({
|
|
204
|
-
mutationFn: () => l.request(z("/support/categories", { name:
|
|
206
|
+
mutationFn: () => l.request(z("/support/categories", { name: d.trim() })),
|
|
205
207
|
onSuccess: () => {
|
|
206
208
|
p(""), x();
|
|
207
209
|
}
|
|
@@ -209,10 +211,10 @@ function se() {
|
|
|
209
211
|
mutationFn: (a) => l.request(H(`/support/categories/${a}`)),
|
|
210
212
|
onSuccess: x
|
|
211
213
|
});
|
|
212
|
-
return /* @__PURE__ */
|
|
214
|
+
return /* @__PURE__ */ n("div", { className: "mt-4 space-y-3", "data-support-types-editor": !0, children: [
|
|
213
215
|
/* @__PURE__ */ t("p", { className: "max-w-2xl text-[12.5px] text-slate-500 dark:text-muted-foreground", children: "The kinds of request people pick from. A type tied to a collection is offered on those records only; without one it is offered everywhere, including General Support. With no team a request goes to every administrator; a default assignee skips the desk entirely." }),
|
|
214
|
-
/* @__PURE__ */ t("div", { className: "overflow-hidden rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: /* @__PURE__ */
|
|
215
|
-
/* @__PURE__ */ t("thead", { className: "bg-slate-50 text-left text-[11px] uppercase tracking-wide text-slate-500 dark:bg-white/5 dark:text-muted-foreground", children: /* @__PURE__ */
|
|
216
|
+
/* @__PURE__ */ t("div", { className: "overflow-hidden rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: /* @__PURE__ */ n("table", { className: "w-full text-[12.5px]", children: [
|
|
217
|
+
/* @__PURE__ */ t("thead", { className: "bg-slate-50 text-left text-[11px] uppercase tracking-wide text-slate-500 dark:bg-white/5 dark:text-muted-foreground", children: /* @__PURE__ */ n("tr", { children: [
|
|
216
218
|
/* @__PURE__ */ t("th", { className: "px-3 py-2 font-medium", children: "Type" }),
|
|
217
219
|
/* @__PURE__ */ t("th", { className: "px-3 py-2 font-medium", children: "For records in" }),
|
|
218
220
|
/* @__PURE__ */ t("th", { className: "px-3 py-2 font-medium", children: "Team" }),
|
|
@@ -220,12 +222,12 @@ function se() {
|
|
|
220
222
|
/* @__PURE__ */ t("th", { className: "px-3 py-2 font-medium", children: "Active" }),
|
|
221
223
|
/* @__PURE__ */ t("th", { className: "px-3 py-2" })
|
|
222
224
|
] }) }),
|
|
223
|
-
/* @__PURE__ */ t("tbody", { className: "divide-y divide-slate-100 dark:divide-border/60", children: m.map((a) => /* @__PURE__ */
|
|
225
|
+
/* @__PURE__ */ t("tbody", { className: "divide-y divide-slate-100 dark:divide-border/60", children: m.map((a) => /* @__PURE__ */ n("tr", { "data-support-type-row": a.id, children: [
|
|
224
226
|
/* @__PURE__ */ t("td", { className: "px-3 py-2", children: /* @__PURE__ */ t(
|
|
225
227
|
"input",
|
|
226
228
|
{
|
|
227
229
|
defaultValue: a.name,
|
|
228
|
-
onBlur: (r) => r.target.value.trim() && r.target.value !== a.name &&
|
|
230
|
+
onBlur: (r) => r.target.value.trim() && r.target.value !== a.name && s.mutate({ id: a.id, body: { name: r.target.value } }),
|
|
229
231
|
"aria-label": "Type name",
|
|
230
232
|
className: "w-full bg-transparent font-medium text-slate-900 outline-none focus:underline dark:text-slate-100"
|
|
231
233
|
}
|
|
@@ -235,7 +237,7 @@ function se() {
|
|
|
235
237
|
{
|
|
236
238
|
defaultValue: a.collection ?? "",
|
|
237
239
|
placeholder: "Anywhere",
|
|
238
|
-
onBlur: (r) => (r.target.value || null) !== a.collection &&
|
|
240
|
+
onBlur: (r) => (r.target.value || null) !== a.collection && s.mutate({ id: a.id, body: { collection: r.target.value || null } }),
|
|
239
241
|
"aria-label": "Collection",
|
|
240
242
|
className: "w-full bg-transparent font-mono text-[12px] text-slate-700 outline-none dark:text-slate-300"
|
|
241
243
|
}
|
|
@@ -244,7 +246,7 @@ function se() {
|
|
|
244
246
|
Z,
|
|
245
247
|
{
|
|
246
248
|
value: a.team_id != null ? String(a.team_id) : "",
|
|
247
|
-
onChange: (r) =>
|
|
249
|
+
onChange: (r) => s.mutate({ id: a.id, body: { team_id: r ? Number(r) : null } }),
|
|
248
250
|
options: [
|
|
249
251
|
{ value: "", label: "Administrators" },
|
|
250
252
|
...h.map((r) => ({ value: String(r.id), label: r.name }))
|
|
@@ -257,7 +259,7 @@ function se() {
|
|
|
257
259
|
{
|
|
258
260
|
collection: "nivaro_users",
|
|
259
261
|
value: a.default_assignee,
|
|
260
|
-
onChange: (r) =>
|
|
262
|
+
onChange: (r) => s.mutate({ id: a.id, body: { default_assignee: r ? String(r) : null } }),
|
|
261
263
|
placeholder: "Nobody"
|
|
262
264
|
}
|
|
263
265
|
) }),
|
|
@@ -266,7 +268,7 @@ function se() {
|
|
|
266
268
|
{
|
|
267
269
|
type: "checkbox",
|
|
268
270
|
checked: a.is_active,
|
|
269
|
-
onChange: (r) =>
|
|
271
|
+
onChange: (r) => s.mutate({ id: a.id, body: { is_active: r.target.checked } }),
|
|
270
272
|
"aria-label": "Active"
|
|
271
273
|
}
|
|
272
274
|
) }),
|
|
@@ -281,18 +283,18 @@ function se() {
|
|
|
281
283
|
) })
|
|
282
284
|
] }, a.id)) })
|
|
283
285
|
] }) }),
|
|
284
|
-
/* @__PURE__ */
|
|
286
|
+
/* @__PURE__ */ n(
|
|
285
287
|
"form",
|
|
286
288
|
{
|
|
287
289
|
className: "flex items-center gap-2",
|
|
288
290
|
onSubmit: (a) => {
|
|
289
|
-
a.preventDefault(),
|
|
291
|
+
a.preventDefault(), d.trim() && b.mutate();
|
|
290
292
|
},
|
|
291
293
|
children: [
|
|
292
294
|
/* @__PURE__ */ t(
|
|
293
295
|
"input",
|
|
294
296
|
{
|
|
295
|
-
value:
|
|
297
|
+
value: d,
|
|
296
298
|
onChange: (a) => p(a.target.value),
|
|
297
299
|
placeholder: "New type, e.g. Vendor change",
|
|
298
300
|
"aria-label": "New type name",
|
|
@@ -303,7 +305,7 @@ function se() {
|
|
|
303
305
|
"button",
|
|
304
306
|
{
|
|
305
307
|
type: "submit",
|
|
306
|
-
disabled: !
|
|
308
|
+
disabled: !d.trim() || b.isPending,
|
|
307
309
|
className: "h-8 rounded-md border border-nvr-cyan/60 bg-nvr-cyan/10 px-3 text-[12.5px] font-medium text-nvr-navy disabled:opacity-50 dark:text-nvr-cyan",
|
|
308
310
|
children: "Add type"
|
|
309
311
|
}
|
|
@@ -314,5 +316,5 @@ function se() {
|
|
|
314
316
|
] });
|
|
315
317
|
}
|
|
316
318
|
export {
|
|
317
|
-
|
|
319
|
+
ye as SupportView
|
|
318
320
|
};
|