@nivaro/react 0.3.127 → 0.3.129
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/CommentsSlot.js +124 -95
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +29 -3
- package/dist/index.js +150 -147
- package/dist/shared/components/CollectionBrowserView.js +3259 -3211
- package/dist/shared/components/DataTable.js +406 -401
- package/dist/shared/components/ItemEditForm.js +4485 -4409
- package/dist/shared/components/MatrixEditor.js +548 -490
- package/dist/shared/components/MyWorkView.js +284 -274
- package/dist/shared/components/NotificationBell.js +264 -218
- package/dist/shared/components/RecordGridEditor.js +582 -472
- package/dist/shared/components/ai/AiMarkdown.js +215 -196
- package/dist/shared/components/chat/chat-core.js +331 -346
- package/dist/shared/components/chat/chat-typing.js +25 -0
- package/dist/shared/components/command-center/CommandCenterView.js +1 -1
- package/dist/shared/components/command-center/PeekPanel.js +8 -1
- package/dist/shared/components/command-center/api.js +17 -9
- package/dist/shared/components/command-center/panels/AttentionPanel.js +4 -1
- package/dist/shared/components/command-center/panels/PartnersPanel.js +2 -1
- package/dist/shared/components/item-edit/GroupSection.js +1 -1
- package/dist/shared/components/item-edit/HeaderTools.js +216 -210
- package/dist/shared/components/item-edit/InlineTableField.js +432 -429
- package/dist/shared/components/item-edit/RecordLiveSync.js +115 -108
- package/dist/shared/components/item-edit/RecordViewersChip.js +17 -16
- package/dist/shared/components/item-edit/RowComments.js +33 -30
- package/dist/shared/components/item-edit/cascade-clear-notice.js +30 -28
- package/dist/shared/components/item-edit/live-related.js +29 -16
- package/dist/shared/components/item-edit/record-opened-live.js +86 -0
- package/dist/shared/components/panels/CommentPanel.js +345 -327
- package/dist/shared/components/panels/OwnerOpenedLine.js +24 -23
- package/dist/shared/components/panels/RecordIntegrityBanner.js +1 -1
- package/dist/shared/components/pipeline/TeamSuggestions.js +1 -1
- package/dist/shared/components/queue/QueueItemSheet.js +171 -130
- package/dist/shared/components/record-grid-guard.js +85 -0
- package/dist/shared/components/support/TicketDetailSheet.js +213 -174
- package/dist/shared/components/trackers/MirroredText.js +40 -0
- package/dist/shared/components/trackers/SourceTracker.js +168 -0
- package/dist/shared/components/trackers/TrackerChip.js +71 -0
- package/dist/shared/components/trackers/TrackerLinkPanel.js +1039 -0
- package/dist/shared/components/trackers/TrackerPickers.js +245 -0
- package/dist/shared/components/trackers/tracker-model.js +126 -0
- package/dist/shared/components/trackers/use-tracker-link.js +159 -0
- package/dist/shared/lib/at-risk-fields.js +14 -0
- package/dist/shared/lib/live-queries.js +9 -8
- package/dist/shared/lib/live-screen.js +77 -76
- package/dist/shared/lib/presence-hooks.js +190 -127
- package/dist/shared/lib/user-sync.js +78 -65
- package/dist/shared/lib/waiting-count.js +40 -29
- package/package.json +1 -1
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { jsxs as r, jsx as e, Fragment as D } from "react/jsx-runtime";
|
|
2
|
+
import { ChevronsUpDown as T, Check as I, X as j, Plus as F } from "lucide-react";
|
|
3
|
+
import { useState as O, useMemo as H } from "react";
|
|
4
|
+
import { cn as x } from "../../lib/utils.js";
|
|
5
|
+
import { Command as A, CommandInput as E, CommandList as M, CommandEmpty as U, CommandGroup as N, CommandItem as w } from "../ui/command.js";
|
|
6
|
+
import { Popover as V, PopoverTrigger as P, PopoverContent as W } from "../ui/popover.js";
|
|
7
|
+
import { cleanLabel as R, isNewLabel as C } from "./tracker-model.js";
|
|
8
|
+
const L = 60;
|
|
9
|
+
function S({ color: a }) {
|
|
10
|
+
return /* @__PURE__ */ e(
|
|
11
|
+
"span",
|
|
12
|
+
{
|
|
13
|
+
"aria-hidden": !0,
|
|
14
|
+
className: "h-2.5 w-2.5 shrink-0 rounded-full border border-black/10 dark:border-white/15",
|
|
15
|
+
style: { backgroundColor: a || "transparent" }
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
const X = "Not in GitLab yet. GitLab creates it the first time Nivaro uses it.";
|
|
20
|
+
function _({ compact: a }) {
|
|
21
|
+
return /* @__PURE__ */ e(
|
|
22
|
+
"span",
|
|
23
|
+
{
|
|
24
|
+
"data-tip": X,
|
|
25
|
+
"data-label-new": !0,
|
|
26
|
+
className: "shrink-0 rounded bg-amber-100 px-1 text-[10px] font-medium text-amber-800 dark:bg-amber-500/15 dark:text-amber-300",
|
|
27
|
+
children: a ? /* @__PURE__ */ r(D, { children: [
|
|
28
|
+
"new",
|
|
29
|
+
/* @__PURE__ */ e("span", { className: "sr-only", children: ", will be created in GitLab" })
|
|
30
|
+
] }) : "will be created in GitLab"
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
function ee(a) {
|
|
35
|
+
const { labels: n, unavailable: h, placeholder: p, ariaLabel: f, disabled: c, className: k } = a, [d, g] = O(!1), [b, u] = O(""), m = a.multi ? a.value : a.value ? [a.value] : [], v = H(() => {
|
|
36
|
+
const t = /* @__PURE__ */ new Map();
|
|
37
|
+
for (const i of n ?? []) t.set(i.name.toLowerCase(), i.color);
|
|
38
|
+
return t;
|
|
39
|
+
}, [n]), l = R(b), o = l.toLowerCase(), s = (n ?? []).filter((t) => !o || t.name.toLowerCase().includes(o)), q = !!l && ((n ?? []).some((t) => t.name.toLowerCase() === o) || m.some((t) => t.toLowerCase() === o)), y = (t) => m.some((i) => i.toLowerCase() === t.toLowerCase()), G = (t) => {
|
|
40
|
+
a.multi ? a.onChange(
|
|
41
|
+
y(t) ? a.value.filter((i) => i.toLowerCase() !== t.toLowerCase()) : [...a.value, t]
|
|
42
|
+
) : (a.onChange(y(t) ? void 0 : t), g(!1)), u("");
|
|
43
|
+
}, $ = (t) => {
|
|
44
|
+
a.multi ? a.onChange(a.value.filter((i) => i !== t)) : a.onChange(void 0);
|
|
45
|
+
};
|
|
46
|
+
return /* @__PURE__ */ e("div", { className: x("min-w-0", k), children: /* @__PURE__ */ r(
|
|
47
|
+
V,
|
|
48
|
+
{
|
|
49
|
+
open: d,
|
|
50
|
+
onOpenChange: (t) => {
|
|
51
|
+
g(t), t || u("");
|
|
52
|
+
},
|
|
53
|
+
children: [
|
|
54
|
+
a.multi ? /* @__PURE__ */ r(
|
|
55
|
+
"div",
|
|
56
|
+
{
|
|
57
|
+
className: x(
|
|
58
|
+
"flex min-h-8 w-full flex-wrap items-center gap-1 rounded-md border border-input bg-background px-1.5 py-1",
|
|
59
|
+
c && "opacity-50"
|
|
60
|
+
),
|
|
61
|
+
children: [
|
|
62
|
+
m.map((t) => /* @__PURE__ */ r(
|
|
63
|
+
"span",
|
|
64
|
+
{
|
|
65
|
+
className: "inline-flex max-w-full items-center gap-1 rounded border border-slate-200 bg-slate-50 py-px pl-1.5 pr-0.5 text-[11.5px] text-slate-700 dark:border-border dark:bg-muted/40 dark:text-slate-200",
|
|
66
|
+
children: [
|
|
67
|
+
/* @__PURE__ */ e(S, { color: v.get(t.toLowerCase()) }),
|
|
68
|
+
/* @__PURE__ */ e("span", { className: "truncate", children: t }),
|
|
69
|
+
C(t, n) && /* @__PURE__ */ e(_, {}),
|
|
70
|
+
!c && /* @__PURE__ */ e(
|
|
71
|
+
"button",
|
|
72
|
+
{
|
|
73
|
+
type: "button",
|
|
74
|
+
"aria-label": `Remove ${t}`,
|
|
75
|
+
onClick: () => $(t),
|
|
76
|
+
className: "rounded p-0.5 text-slate-400 hover:bg-slate-200 hover:text-slate-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 dark:hover:bg-muted dark:hover:text-slate-100",
|
|
77
|
+
children: /* @__PURE__ */ e(j, { className: "h-3 w-3" })
|
|
78
|
+
}
|
|
79
|
+
)
|
|
80
|
+
]
|
|
81
|
+
},
|
|
82
|
+
t
|
|
83
|
+
)),
|
|
84
|
+
/* @__PURE__ */ e(P, { asChild: !0, children: /* @__PURE__ */ r(
|
|
85
|
+
"button",
|
|
86
|
+
{
|
|
87
|
+
type: "button",
|
|
88
|
+
role: "combobox",
|
|
89
|
+
"aria-expanded": d,
|
|
90
|
+
"aria-label": f,
|
|
91
|
+
disabled: c,
|
|
92
|
+
className: "inline-flex h-6 items-center gap-1 rounded px-1.5 text-[11.5px] text-slate-500 transition-colors hover:bg-slate-100 hover:text-slate-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 disabled:cursor-not-allowed dark:text-muted-foreground dark:hover:bg-muted dark:hover:text-foreground",
|
|
93
|
+
children: [
|
|
94
|
+
/* @__PURE__ */ e(F, { className: "h-3 w-3" }),
|
|
95
|
+
m.length ? "Add" : p ?? "Add label"
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
) })
|
|
99
|
+
]
|
|
100
|
+
}
|
|
101
|
+
) : /* @__PURE__ */ e(P, { asChild: !0, children: /* @__PURE__ */ r(
|
|
102
|
+
"button",
|
|
103
|
+
{
|
|
104
|
+
type: "button",
|
|
105
|
+
role: "combobox",
|
|
106
|
+
"aria-expanded": d,
|
|
107
|
+
"aria-label": f,
|
|
108
|
+
disabled: c,
|
|
109
|
+
className: "flex h-8 w-full items-center gap-1.5 rounded-md border border-input bg-background px-2 text-left text-[12px] transition-colors hover:bg-slate-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 disabled:cursor-not-allowed disabled:opacity-50 dark:hover:bg-muted/50",
|
|
110
|
+
children: [
|
|
111
|
+
a.value ? /* @__PURE__ */ r("span", { className: "flex min-w-0 flex-1 items-center gap-1.5", children: [
|
|
112
|
+
/* @__PURE__ */ e(S, { color: v.get(a.value.toLowerCase()) }),
|
|
113
|
+
/* @__PURE__ */ e("span", { className: "truncate text-slate-800 dark:text-slate-100", children: a.value }),
|
|
114
|
+
C(a.value, n) && /* @__PURE__ */ e(_, { compact: !0 })
|
|
115
|
+
] }) : /* @__PURE__ */ e("span", { className: "flex-1 text-muted-foreground", children: p ?? "No label" }),
|
|
116
|
+
/* @__PURE__ */ e(T, { className: "h-3 w-3 shrink-0 opacity-50" })
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
) }),
|
|
120
|
+
/* @__PURE__ */ e(W, { className: "w-[300px] p-0", align: "start", children: /* @__PURE__ */ r(A, { shouldFilter: !1, children: [
|
|
121
|
+
/* @__PURE__ */ e(
|
|
122
|
+
E,
|
|
123
|
+
{
|
|
124
|
+
value: b,
|
|
125
|
+
onValueChange: u,
|
|
126
|
+
placeholder: "Find or type a label…",
|
|
127
|
+
className: "h-8 text-[12px]"
|
|
128
|
+
}
|
|
129
|
+
),
|
|
130
|
+
/* @__PURE__ */ r(M, { children: [
|
|
131
|
+
h && /* @__PURE__ */ e("p", { className: "border-b border-slate-100 px-3 py-2 text-[11px] text-slate-500 dark:border-border dark:text-muted-foreground", children: h }),
|
|
132
|
+
/* @__PURE__ */ e(U, { className: "px-3 py-4 text-center text-[12px] text-muted-foreground", children: n != null && n.length ? "No label matches." : "Type a label name." }),
|
|
133
|
+
!a.multi && a.value && !l && /* @__PURE__ */ e(N, { children: /* @__PURE__ */ r(w, { value: "__none__", onSelect: () => $(a.value), children: [
|
|
134
|
+
/* @__PURE__ */ e(j, { className: "h-3.5 w-3.5 text-slate-400" }),
|
|
135
|
+
/* @__PURE__ */ e("span", { className: "text-[12px] text-muted-foreground", children: "No label" })
|
|
136
|
+
] }) }),
|
|
137
|
+
l && !q && /* @__PURE__ */ e(N, { children: /* @__PURE__ */ r(w, { value: `__new__${l}`, onSelect: () => G(l), children: [
|
|
138
|
+
/* @__PURE__ */ e(F, { className: "h-3.5 w-3.5 text-nvr-cyan" }),
|
|
139
|
+
/* @__PURE__ */ r("span", { className: "truncate text-[12px]", children: [
|
|
140
|
+
"Use “",
|
|
141
|
+
l,
|
|
142
|
+
"”"
|
|
143
|
+
] }),
|
|
144
|
+
C(l, n) && /* @__PURE__ */ e(_, {})
|
|
145
|
+
] }) }),
|
|
146
|
+
s.length > 0 && /* @__PURE__ */ r(N, { children: [
|
|
147
|
+
s.slice(0, L).map((t) => /* @__PURE__ */ r(w, { value: t.name, onSelect: () => G(t.name), children: [
|
|
148
|
+
/* @__PURE__ */ e(S, { color: t.color }),
|
|
149
|
+
/* @__PURE__ */ e("span", { className: "flex-1 truncate text-[12px]", children: t.name }),
|
|
150
|
+
/* @__PURE__ */ e(
|
|
151
|
+
I,
|
|
152
|
+
{
|
|
153
|
+
className: x(
|
|
154
|
+
"h-3.5 w-3.5 text-nvr-cyan",
|
|
155
|
+
y(t.name) ? "opacity-100" : "opacity-0"
|
|
156
|
+
)
|
|
157
|
+
}
|
|
158
|
+
)
|
|
159
|
+
] }, t.name)),
|
|
160
|
+
s.length > L && /* @__PURE__ */ r("p", { className: "px-3 py-1.5 text-[11px] text-muted-foreground", children: [
|
|
161
|
+
s.length - L,
|
|
162
|
+
" more — keep typing to narrow."
|
|
163
|
+
] })
|
|
164
|
+
] })
|
|
165
|
+
] })
|
|
166
|
+
] }) })
|
|
167
|
+
]
|
|
168
|
+
}
|
|
169
|
+
) });
|
|
170
|
+
}
|
|
171
|
+
function te({
|
|
172
|
+
options: a,
|
|
173
|
+
value: n,
|
|
174
|
+
onChange: h,
|
|
175
|
+
ariaLabel: p,
|
|
176
|
+
placeholder: f,
|
|
177
|
+
multi: c,
|
|
178
|
+
emptyText: k = "Nothing found.",
|
|
179
|
+
onSearch: d,
|
|
180
|
+
loading: g
|
|
181
|
+
}) {
|
|
182
|
+
const [b, u] = O(!1), m = (l) => {
|
|
183
|
+
var o;
|
|
184
|
+
return ((o = a.find((s) => s.value === l)) == null ? void 0 : o.label) ?? String(l);
|
|
185
|
+
}, v = n.length ? n.map(m).join(", ") : f;
|
|
186
|
+
return /* @__PURE__ */ r(V, { open: b, onOpenChange: u, children: [
|
|
187
|
+
/* @__PURE__ */ e(P, { asChild: !0, children: /* @__PURE__ */ r(
|
|
188
|
+
"button",
|
|
189
|
+
{
|
|
190
|
+
type: "button",
|
|
191
|
+
role: "combobox",
|
|
192
|
+
"aria-expanded": b,
|
|
193
|
+
"aria-label": p,
|
|
194
|
+
className: "flex h-8 w-full min-w-0 items-center justify-between gap-2 rounded-md border border-input bg-background px-2.5 text-left text-[12px] hover:bg-slate-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 dark:hover:bg-muted/40",
|
|
195
|
+
children: [
|
|
196
|
+
/* @__PURE__ */ e(
|
|
197
|
+
"span",
|
|
198
|
+
{
|
|
199
|
+
className: x("truncate", !n.length && "text-slate-400 dark:text-muted-foreground"),
|
|
200
|
+
children: v
|
|
201
|
+
}
|
|
202
|
+
),
|
|
203
|
+
/* @__PURE__ */ e(T, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" })
|
|
204
|
+
]
|
|
205
|
+
}
|
|
206
|
+
) }),
|
|
207
|
+
/* @__PURE__ */ e(W, { className: "w-[--radix-popover-trigger-width] min-w-[240px] p-0", align: "start", children: /* @__PURE__ */ r(A, { shouldFilter: !d, children: [
|
|
208
|
+
/* @__PURE__ */ e(
|
|
209
|
+
E,
|
|
210
|
+
{
|
|
211
|
+
placeholder: "Search…",
|
|
212
|
+
onValueChange: d,
|
|
213
|
+
className: "h-8 text-[12px]"
|
|
214
|
+
}
|
|
215
|
+
),
|
|
216
|
+
/* @__PURE__ */ r(M, { children: [
|
|
217
|
+
/* @__PURE__ */ e(U, { className: "py-3 text-center text-[12px] text-slate-500 dark:text-muted-foreground", children: g ? "Searching…" : k }),
|
|
218
|
+
/* @__PURE__ */ e(N, { children: a.map((l) => {
|
|
219
|
+
const o = n.includes(l.value);
|
|
220
|
+
return /* @__PURE__ */ r(
|
|
221
|
+
w,
|
|
222
|
+
{
|
|
223
|
+
value: `${l.label} ${l.hint ?? ""} ${l.value}`,
|
|
224
|
+
onSelect: () => {
|
|
225
|
+
c ? h(o ? n.filter((s) => s !== l.value) : [...n, l.value]) : (h(o ? [] : [l.value]), u(!1));
|
|
226
|
+
},
|
|
227
|
+
className: "text-[12px]",
|
|
228
|
+
children: [
|
|
229
|
+
/* @__PURE__ */ e(I, { className: x("mr-1.5 h-3.5 w-3.5", o ? "opacity-100" : "opacity-0") }),
|
|
230
|
+
/* @__PURE__ */ e("span", { className: "truncate", children: l.label }),
|
|
231
|
+
l.hint && /* @__PURE__ */ e("span", { className: "ml-auto truncate pl-2 text-[11px] text-slate-500 dark:text-muted-foreground", children: l.hint })
|
|
232
|
+
]
|
|
233
|
+
},
|
|
234
|
+
String(l.value)
|
|
235
|
+
);
|
|
236
|
+
}) })
|
|
237
|
+
] })
|
|
238
|
+
] }) })
|
|
239
|
+
] });
|
|
240
|
+
}
|
|
241
|
+
export {
|
|
242
|
+
ee as LabelPicker,
|
|
243
|
+
_ as NewTag,
|
|
244
|
+
te as PickList
|
|
245
|
+
};
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
function a(e) {
|
|
2
|
+
return !!e && typeof e.remote_state == "string";
|
|
3
|
+
}
|
|
4
|
+
function l(e) {
|
|
5
|
+
return a(e) ? { iid: e.iid, web_url: e.web_url, state: e.remote_state, title: e.remote_title } : e;
|
|
6
|
+
}
|
|
7
|
+
function f(e) {
|
|
8
|
+
return e === "opened" ? "open" : e === "closed" ? "closed" : e || "unknown";
|
|
9
|
+
}
|
|
10
|
+
function c(e) {
|
|
11
|
+
return a(e) && e.sync_error ? "error" : l(e).state === "closed" ? "closed" : "open";
|
|
12
|
+
}
|
|
13
|
+
function p(e) {
|
|
14
|
+
return /^https?:\/\/\S+$/i.test(e) ? e : null;
|
|
15
|
+
}
|
|
16
|
+
const d = {
|
|
17
|
+
lead: "Opened it",
|
|
18
|
+
fingerprint: "Same error",
|
|
19
|
+
group: "Grouped with it",
|
|
20
|
+
similar: "Looked similar",
|
|
21
|
+
manual: "Added by hand"
|
|
22
|
+
};
|
|
23
|
+
function m(e) {
|
|
24
|
+
return d[e] ?? e;
|
|
25
|
+
}
|
|
26
|
+
function _(e) {
|
|
27
|
+
return `${Math.round(Math.min(1, Math.max(0, e)) * 100)}%`;
|
|
28
|
+
}
|
|
29
|
+
function b(e) {
|
|
30
|
+
return e.replace(/<!--/g, "").replace(/[\r\n,]+/g, " ").replace(/\s+/g, " ").trim().slice(0, 255).trim();
|
|
31
|
+
}
|
|
32
|
+
function w(e, t) {
|
|
33
|
+
if (!t) return !1;
|
|
34
|
+
const r = e.trim().toLowerCase();
|
|
35
|
+
return !t.some((n) => n.name.toLowerCase() === r);
|
|
36
|
+
}
|
|
37
|
+
const i = (e, t) => e && Object.keys(e).includes(t) ? e[t] : void 0;
|
|
38
|
+
function s(...e) {
|
|
39
|
+
const t = [], r = /* @__PURE__ */ new Set();
|
|
40
|
+
for (const n of e)
|
|
41
|
+
for (const u of n ?? []) {
|
|
42
|
+
const o = (u ?? "").trim();
|
|
43
|
+
!o || r.has(o.toLowerCase()) || (r.add(o.toLowerCase()), t.push(o));
|
|
44
|
+
}
|
|
45
|
+
return t;
|
|
46
|
+
}
|
|
47
|
+
function L(e) {
|
|
48
|
+
var t;
|
|
49
|
+
return s((t = e == null ? void 0 : e.labels) == null ? void 0 : t.always);
|
|
50
|
+
}
|
|
51
|
+
function h(e, t) {
|
|
52
|
+
var n;
|
|
53
|
+
const r = e.status === "cancelled" ? "done" : String(e.status ?? "");
|
|
54
|
+
return s((n = t == null ? void 0 : t.labels) == null ? void 0 : n.always, [
|
|
55
|
+
i(t == null ? void 0 : t.ticket_priority_map, String(e.priority ?? "")),
|
|
56
|
+
i(t == null ? void 0 : t.ticket_lane_map, r)
|
|
57
|
+
]);
|
|
58
|
+
}
|
|
59
|
+
function g(e) {
|
|
60
|
+
return e.kind === "issue" ? { issue: Number(e.id) } : { source_kind: e.kind, source_id: e.id };
|
|
61
|
+
}
|
|
62
|
+
function C(e, t) {
|
|
63
|
+
let r;
|
|
64
|
+
try {
|
|
65
|
+
r = new URL(e.trim()).host.toLowerCase();
|
|
66
|
+
} catch {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
return t.find((n) => {
|
|
70
|
+
if (!n.base_url) return !1;
|
|
71
|
+
try {
|
|
72
|
+
return new URL(n.base_url).host.toLowerCase() === r;
|
|
73
|
+
} catch {
|
|
74
|
+
return !1;
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
const S = {
|
|
79
|
+
create: "Create the GitLab issue",
|
|
80
|
+
note: "Post a note",
|
|
81
|
+
note_seen: "Post a seen-again note",
|
|
82
|
+
state: "Close or reopen it",
|
|
83
|
+
labels: "Change its labels",
|
|
84
|
+
comment: "Send a comment",
|
|
85
|
+
upload: "Upload a file"
|
|
86
|
+
};
|
|
87
|
+
function k(e, t) {
|
|
88
|
+
if (!t) return e;
|
|
89
|
+
const r = (n) => n.iid === t.iid && (n.web_url === t.web_url || n.connection === t.connection);
|
|
90
|
+
return e.some(r) ? e.map((n) => r(n) ? t : n) : [t, ...e];
|
|
91
|
+
}
|
|
92
|
+
function O(e, t) {
|
|
93
|
+
return (e ?? []).filter(
|
|
94
|
+
(r) => r.op === "create" && r.status === "dead" && r.source_kind === t.kind && String(r.source_id) === String(t.id)
|
|
95
|
+
).map((r) => ({
|
|
96
|
+
id: r.id,
|
|
97
|
+
op: r.op,
|
|
98
|
+
status: r.status,
|
|
99
|
+
attempts: r.attempts,
|
|
100
|
+
last_error: r.last_error,
|
|
101
|
+
next_attempt_at: r.next_attempt_at
|
|
102
|
+
}));
|
|
103
|
+
}
|
|
104
|
+
function $(e) {
|
|
105
|
+
return e.kind === "issue" ? e.title || `Issue #${e.id}` : e.kind === "ticket" ? e.title || `Support request #${e.id}` : e.title || `Record ${e.id}`;
|
|
106
|
+
}
|
|
107
|
+
export {
|
|
108
|
+
S as OP_WORDS,
|
|
109
|
+
L as alwaysLabels,
|
|
110
|
+
l as chipOf,
|
|
111
|
+
c as chipTone,
|
|
112
|
+
b as cleanLabel,
|
|
113
|
+
C as connectionForUrl,
|
|
114
|
+
O as deadCreatesFor,
|
|
115
|
+
a as isLink,
|
|
116
|
+
w as isNewLabel,
|
|
117
|
+
m as joinedViaLabel,
|
|
118
|
+
$ as memberName,
|
|
119
|
+
s as mergeLabels,
|
|
120
|
+
_ as percent,
|
|
121
|
+
p as safeHref,
|
|
122
|
+
k as shownTrackers,
|
|
123
|
+
g as sourceBody,
|
|
124
|
+
f as stateWord,
|
|
125
|
+
h as ticketLabelsFor
|
|
126
|
+
};
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { useQueryClient as O, useQuery as f } from "@tanstack/react-query";
|
|
2
|
+
import { useCallback as K, useState as g, useEffect as p, useMemo as A } from "react";
|
|
3
|
+
import { useNivaroClient as I, useItemEditAuth as L, useOptionalNivaroClient as Q } from "../../context.js";
|
|
4
|
+
import { get as k } from "../../lib/commands.js";
|
|
5
|
+
import { deadCreatesFor as P, shownTrackers as R } from "./tracker-model.js";
|
|
6
|
+
const l = {
|
|
7
|
+
all: ["trackers"],
|
|
8
|
+
featurePublic: () => ["trackers", "feature", "public"],
|
|
9
|
+
connections: () => ["trackers", "connections"],
|
|
10
|
+
creatable: (e, t) => ["trackers", "creatable", e, t],
|
|
11
|
+
deadOutbox: () => ["trackers", "dead-outbox"],
|
|
12
|
+
linksFor: (e, t) => ["trackers", "links-for", e, t],
|
|
13
|
+
sourceLinks: (e, t) => ["trackers", "source-links", e, t],
|
|
14
|
+
similar: (e, t, n) => ["trackers", "similar", e, t, n],
|
|
15
|
+
sample: (e, t) => ["trackers", "source-sample", e, t],
|
|
16
|
+
rules: () => ["trackers", "rules"],
|
|
17
|
+
projects: (e, t) => ["trackers", "projects", e, t],
|
|
18
|
+
labels: (e, t) => ["trackers", "labels", e, t],
|
|
19
|
+
users: (e, t, n) => ["trackers", "users", e, t, n]
|
|
20
|
+
}, j = (e) => {
|
|
21
|
+
var n;
|
|
22
|
+
const t = e;
|
|
23
|
+
return (t == null ? void 0 : t.status) ?? ((n = t == null ? void 0 : t.response) == null ? void 0 : n.status);
|
|
24
|
+
};
|
|
25
|
+
async function D(e) {
|
|
26
|
+
var t;
|
|
27
|
+
try {
|
|
28
|
+
return !!((t = (await e.request(k("/trackers/feature/public"))).data) != null && t.enabled);
|
|
29
|
+
} catch (n) {
|
|
30
|
+
if (j(n) === 404) return !1;
|
|
31
|
+
throw n;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function N() {
|
|
35
|
+
const e = Q(), t = f({
|
|
36
|
+
queryKey: l.featurePublic(),
|
|
37
|
+
queryFn: () => D(e),
|
|
38
|
+
enabled: !!e,
|
|
39
|
+
staleTime: 6e4,
|
|
40
|
+
retry: !1
|
|
41
|
+
});
|
|
42
|
+
return { on: t.data === !0, loading: t.isLoading };
|
|
43
|
+
}
|
|
44
|
+
function W(e, t) {
|
|
45
|
+
return (e ?? []).filter((n) => {
|
|
46
|
+
var r, a;
|
|
47
|
+
return n.is_active !== !1 && ((a = (r = n.sync) == null ? void 0 : r.sources) == null ? void 0 : a[t]) !== !1;
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
const $ = (e) => e.request(k("/trackers")).then((t) => t.data ?? []);
|
|
51
|
+
function U(e, t) {
|
|
52
|
+
const n = I(), { isAdmin: r } = L(), a = f({
|
|
53
|
+
queryKey: l.connections(),
|
|
54
|
+
queryFn: () => $(n),
|
|
55
|
+
enabled: t.enabled && r,
|
|
56
|
+
staleTime: 6e4,
|
|
57
|
+
retry: !1
|
|
58
|
+
}), u = f({
|
|
59
|
+
queryKey: l.creatable(e, t.sourceId),
|
|
60
|
+
queryFn: () => n.request(
|
|
61
|
+
k("/trackers/creatable", { source_kind: e, source_id: t.sourceId })
|
|
62
|
+
).then((s) => s.data ?? []),
|
|
63
|
+
enabled: t.enabled && !r && e !== "issue" && !!t.sourceId,
|
|
64
|
+
staleTime: 6e4,
|
|
65
|
+
retry: !1
|
|
66
|
+
});
|
|
67
|
+
return { connections: A(() => t.enabled ? r ? W(a.data, e) : u.data ?? [] : [], [t.enabled, r, a.data, u.data, e]), loading: r ? a.isLoading : u.isLoading };
|
|
68
|
+
}
|
|
69
|
+
const z = 12e4, B = 4e3;
|
|
70
|
+
function G(e, t) {
|
|
71
|
+
const [n, r] = g(null), [a, u] = g(!1);
|
|
72
|
+
p(() => {
|
|
73
|
+
e && (r(null), u(!1));
|
|
74
|
+
}, [e]), p(() => {
|
|
75
|
+
if (n == null) return;
|
|
76
|
+
const o = Math.max(0, n + z - Date.now()), y = window.setTimeout(() => {
|
|
77
|
+
r(null), u(!0);
|
|
78
|
+
}, o);
|
|
79
|
+
return () => window.clearTimeout(y);
|
|
80
|
+
}, [n]);
|
|
81
|
+
const c = K(() => {
|
|
82
|
+
u(!1), r(Date.now()), t();
|
|
83
|
+
}, [t]), s = n != null && !e;
|
|
84
|
+
return {
|
|
85
|
+
creating: s,
|
|
86
|
+
stalled: a && !e,
|
|
87
|
+
pollMs: s ? B : !1,
|
|
88
|
+
markCreating: c,
|
|
89
|
+
checkAgain: c
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
function Z(e, t = {}) {
|
|
93
|
+
const n = I(), r = O(), { isAdmin: a } = L(), c = N().on && !!(e != null && e.id), s = (e == null ? void 0 : e.kind) ?? "record", o = (e == null ? void 0 : e.id) ?? "", y = t.mayCreate !== !1, { connections: q } = U(s, {
|
|
94
|
+
enabled: c && y,
|
|
95
|
+
sourceId: o
|
|
96
|
+
}), T = K(() => {
|
|
97
|
+
r.invalidateQueries({ queryKey: l.linksFor(s, o) }), r.invalidateQueries({ queryKey: l.sourceLinks(s, o) }), a && r.invalidateQueries({ queryKey: l.deadOutbox() });
|
|
98
|
+
}, [r, s, o, a]), [w, M] = g(!1), F = f({
|
|
99
|
+
queryKey: l.linksFor(s, o),
|
|
100
|
+
queryFn: () => n.request(
|
|
101
|
+
k("/trackers/links/for", { source_kind: s, source_id: o })
|
|
102
|
+
).then((i) => i.data ?? []),
|
|
103
|
+
enabled: c,
|
|
104
|
+
staleTime: 3e4,
|
|
105
|
+
retry: !1,
|
|
106
|
+
refetchInterval: w
|
|
107
|
+
}), m = c && a && s !== "issue" && y, _ = f({
|
|
108
|
+
queryKey: l.sourceLinks(s, o),
|
|
109
|
+
queryFn: () => n.request(
|
|
110
|
+
k(`/trackers/links/source/${s}/${encodeURIComponent(o)}`)
|
|
111
|
+
).then((i) => i.data ?? []),
|
|
112
|
+
enabled: m,
|
|
113
|
+
staleTime: 3e4,
|
|
114
|
+
retry: !1,
|
|
115
|
+
refetchInterval: w
|
|
116
|
+
}), b = c ? F.data ?? [] : [], S = new Set(
|
|
117
|
+
b.map((i) => i.connection).filter((i) => i != null)
|
|
118
|
+
), C = c && a ? (_.data ?? []).find(
|
|
119
|
+
(i) => S.has(i.connection) || q.some((E) => E.id === i.connection)
|
|
120
|
+
) ?? null : null, h = b.length > 0 || !!C, v = f({
|
|
121
|
+
queryKey: l.deadOutbox(),
|
|
122
|
+
queryFn: () => n.request(k("/trackers/outbox", { status: "dead" })).then((i) => i.data ?? []),
|
|
123
|
+
enabled: m && !h && F.isSuccess,
|
|
124
|
+
staleTime: 6e4,
|
|
125
|
+
retry: !1
|
|
126
|
+
}), d = G(h, T);
|
|
127
|
+
p(() => M(d.pollMs), [d.pollMs]);
|
|
128
|
+
const x = A(
|
|
129
|
+
() => m && !h ? P(v.data, { kind: s, id: o }) : [],
|
|
130
|
+
[m, h, s, o, v.data]
|
|
131
|
+
);
|
|
132
|
+
return {
|
|
133
|
+
on: c,
|
|
134
|
+
isAdmin: a,
|
|
135
|
+
connections: c ? q : [],
|
|
136
|
+
canCreate: c && y && q.length > 0,
|
|
137
|
+
chips: b,
|
|
138
|
+
shown: R(b, C),
|
|
139
|
+
link: C,
|
|
140
|
+
failed: x,
|
|
141
|
+
creating: d.creating,
|
|
142
|
+
slow: d.stalled,
|
|
143
|
+
markCreating: d.markCreating,
|
|
144
|
+
checkAgain: d.checkAgain,
|
|
145
|
+
refresh: T
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
export {
|
|
149
|
+
B as CREATE_POLL_MS,
|
|
150
|
+
z as CREATE_WAIT_MS,
|
|
151
|
+
$ as fetchTrackerConnections,
|
|
152
|
+
D as fetchTrackerFeature,
|
|
153
|
+
W as syncingConnections,
|
|
154
|
+
l as trackerQueryKeys,
|
|
155
|
+
G as useCreateWait,
|
|
156
|
+
Z as useSourceTracker,
|
|
157
|
+
U as useTrackerConnections,
|
|
158
|
+
N as useTrackerFeature
|
|
159
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const s = /^\{\{\s*([A-Za-z_][A-Za-z0-9_]*)\s*\}\}(?:\s*([*+])\s*(-?\d+(?:\.\d+)?))?$/, n = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
2
|
+
function o(i) {
|
|
3
|
+
const t = /* @__PURE__ */ new Set();
|
|
4
|
+
for (const e of i ?? [])
|
|
5
|
+
if (!(!e || typeof e != "object") && (typeof e.field == "string" && n.test(e.field) && t.add(e.field), typeof e.value == "string")) {
|
|
6
|
+
const f = s.exec(e.value.trim());
|
|
7
|
+
f && t.add(f[1]);
|
|
8
|
+
}
|
|
9
|
+
return [...t];
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
s as AT_RISK_FIELD_REF_RE,
|
|
13
|
+
o as atRiskReferencedFields
|
|
14
|
+
};
|
|
@@ -41,6 +41,7 @@ const Oe = [
|
|
|
41
41
|
"cbv-row-instance",
|
|
42
42
|
"queue-items",
|
|
43
43
|
"my-work",
|
|
44
|
+
"my-work-count",
|
|
44
45
|
"widget-data",
|
|
45
46
|
"live-record",
|
|
46
47
|
"live-list",
|
|
@@ -59,7 +60,7 @@ function Se(n) {
|
|
|
59
60
|
return (i = n.record) != null && i.collection && s.add(n.record.collection), [...s];
|
|
60
61
|
}
|
|
61
62
|
function Ce(n, s, i) {
|
|
62
|
-
var
|
|
63
|
+
var k;
|
|
63
64
|
if (n.reconcileOnly) return !1;
|
|
64
65
|
const f = n.record, v = !!f && f.collection === s;
|
|
65
66
|
if (!v && !(n.reads ?? []).includes(s)) return !1;
|
|
@@ -73,7 +74,7 @@ function Ce(n, s, i) {
|
|
|
73
74
|
if (E.length > 0 && (!n.fields || E.some((u) => {
|
|
74
75
|
var w;
|
|
75
76
|
return (w = n.fields) == null ? void 0 : w.includes(u);
|
|
76
|
-
})) || (
|
|
77
|
+
})) || (k = n.aspects) != null && k.length && a.some((u) => {
|
|
77
78
|
var w;
|
|
78
79
|
return (w = n.aspects) == null ? void 0 : w.includes(u);
|
|
79
80
|
})) return !0;
|
|
@@ -87,7 +88,7 @@ const x = /* @__PURE__ */ new Map(), V = /* @__PURE__ */ new Set(), re = (n, s)
|
|
|
87
88
|
};
|
|
88
89
|
function Ee(n, s, i = {}) {
|
|
89
90
|
var $, J;
|
|
90
|
-
const f = i.windowMs ?? 300, v = i.readsGapMs ?? 1e4, C = i.hiddenReconcileMs ?? 5 * 6e4, L = i.lingerMs ?? 3e4,
|
|
91
|
+
const f = i.windowMs ?? 300, v = i.readsGapMs ?? 1e4, C = i.hiddenReconcileMs ?? 5 * 6e4, L = i.lingerMs ?? 3e4, k = i.jitterMs ?? 1500, p = i.isOwn ?? ((t, e) => ye(t, e)), a = i.now ?? (() => Date.now()), E = i.random ?? Math.random, u = i.doc === void 0 ? typeof document > "u" ? null : document : i.doc, w = i.win === void 0 ? typeof window > "u" ? null : window : i.win, Q = n.getQueryCache(), R = { events: 0, refetches: 0, reconciles: 0, deferred: 0 };
|
|
91
92
|
let g = !1;
|
|
92
93
|
const h = /* @__PURE__ */ new Map(), M = /* @__PURE__ */ new Map(), A = /* @__PURE__ */ new Map(), j = /* @__PURE__ */ new Map(), ue = 500, fe = (t) => {
|
|
93
94
|
if (g || !(t != null && t.collection)) return;
|
|
@@ -109,7 +110,7 @@ function Ee(n, s, i = {}) {
|
|
|
109
110
|
}, U = () => {
|
|
110
111
|
if (g) return;
|
|
111
112
|
const t = /* @__PURE__ */ new Set();
|
|
112
|
-
for (const e of
|
|
113
|
+
for (const e of Q.getAll()) {
|
|
113
114
|
if (e.getObserversCount() === 0) continue;
|
|
114
115
|
const o = m(e);
|
|
115
116
|
if (!(o != null && o.staleOnly && !e.state.dataUpdatedAt))
|
|
@@ -133,7 +134,7 @@ function Ee(n, s, i = {}) {
|
|
|
133
134
|
G || (G = !0, queueMicrotask(() => {
|
|
134
135
|
G = !1, U();
|
|
135
136
|
}));
|
|
136
|
-
}, z = /* @__PURE__ */ new WeakSet(), de =
|
|
137
|
+
}, z = /* @__PURE__ */ new WeakSet(), de = Q.subscribe((t) => {
|
|
137
138
|
var e, o;
|
|
138
139
|
if (t.type === "added" || t.type === "removed" || t.type === "observerAdded" || t.type === "observerRemoved" || t.type === "observerOptionsUpdated")
|
|
139
140
|
W();
|
|
@@ -197,7 +198,7 @@ function Ee(n, s, i = {}) {
|
|
|
197
198
|
const e = A.get(t) ?? [];
|
|
198
199
|
if (A.delete(t), g || e.length === 0) return;
|
|
199
200
|
const o = [];
|
|
200
|
-
for (const c of
|
|
201
|
+
for (const c of Q.getAll()) {
|
|
201
202
|
const l = m(c);
|
|
202
203
|
l && Ce(l, t, e) && o.push(c);
|
|
203
204
|
}
|
|
@@ -206,7 +207,7 @@ function Ee(n, s, i = {}) {
|
|
|
206
207
|
if (g || me() === "off") return;
|
|
207
208
|
R.reconciles++;
|
|
208
209
|
const e = [], o = /* @__PURE__ */ new Set();
|
|
209
|
-
for (const l of
|
|
210
|
+
for (const l of Q.getAll()) {
|
|
210
211
|
const y = m(l);
|
|
211
212
|
y != null && y.staleOnly ? o.add(l) : y && e.push(l);
|
|
212
213
|
}
|
|
@@ -228,7 +229,7 @@ function Ee(n, s, i = {}) {
|
|
|
228
229
|
() => {
|
|
229
230
|
T = null, B();
|
|
230
231
|
},
|
|
231
|
-
Math.floor(E() *
|
|
232
|
+
Math.floor(E() * k)
|
|
232
233
|
));
|
|
233
234
|
};
|
|
234
235
|
let P = (($ = s.status) == null ? void 0 : $.call(s).state) !== "reconnecting";
|