@nivaro/react 0.3.128 → 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.
@@ -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
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nivaro/react",
3
- "version": "0.3.128",
3
+ "version": "0.3.129",
4
4
  "description": "React hooks and components for Nivaro CMS forms",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",