@nivaro/react 0.3.91 → 0.3.93
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.
|
@@ -1,94 +1,109 @@
|
|
|
1
|
-
import { jsx as l, Fragment as
|
|
2
|
-
import { useQueryClient as
|
|
3
|
-
import { Loader2 as
|
|
4
|
-
import { useMemo as
|
|
5
|
-
import { toast as
|
|
6
|
-
import { useNivaroClient as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { jsx as l, Fragment as oe, jsxs as c } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as le, useQueries as ce } from "@tanstack/react-query";
|
|
3
|
+
import { Loader2 as K, Send as de, CheckCircle2 as ue, AlertCircle as me, MinusCircle as pe } from "lucide-react";
|
|
4
|
+
import { useMemo as U, useState as y } from "react";
|
|
5
|
+
import { toast as N } from "sonner";
|
|
6
|
+
import { useNivaroClient as he } from "../../context.js";
|
|
7
|
+
import { newBulkProgressId as fe, startBulkProgress as be, endBulkProgress as ke } from "../../lib/bulk-progress.js";
|
|
8
|
+
import { get as xe, post as G } from "../../lib/commands.js";
|
|
9
|
+
import { userErrorMessage as ge } from "../../lib/safe-error.js";
|
|
10
|
+
import { cn as H } from "../../lib/utils.js";
|
|
11
|
+
import { Popover as ye, PopoverTrigger as we, PopoverContent as ve } from "../ui/popover.js";
|
|
12
|
+
import { useAvailableBulkActions as Ne, bulkActionEnabled as $e } from "./BulkActionButtons.js";
|
|
13
|
+
function J(a, r, n, d) {
|
|
14
|
+
return ((a == null ? void 0 : a[n]) ?? []).some((f) => f.source === "builtin" && f.key === d) && $e(r, n, d);
|
|
14
15
|
}
|
|
15
|
-
function
|
|
16
|
+
function Ce(a) {
|
|
16
17
|
const r = { succeeded: 0, failed: 0, skipped: 0, errors: [], outcomes: [] };
|
|
17
|
-
for (const { collection:
|
|
18
|
+
for (const { collection: n, data: d } of a) {
|
|
18
19
|
r.succeeded += d.succeeded ?? 0, r.failed += d.failed ?? 0, r.skipped += d.skipped ?? 0, r.errors.push(...d.errors ?? []);
|
|
19
|
-
for (const
|
|
20
|
-
r.outcomes.push({ ...
|
|
20
|
+
for (const f of d.outcomes ?? [])
|
|
21
|
+
r.outcomes.push({ ...f, item: `${n}:${f.item}` });
|
|
21
22
|
}
|
|
22
23
|
return r;
|
|
23
24
|
}
|
|
24
|
-
function
|
|
25
|
-
const
|
|
26
|
-
return r.skipped &&
|
|
25
|
+
function Re(a, r) {
|
|
26
|
+
const n = [`${r.succeeded} done`];
|
|
27
|
+
return r.skipped && n.push(`${r.skipped} skipped`), r.failed && n.push(`${r.failed} failed`), `${a}: ${n.join(" · ")}`;
|
|
27
28
|
}
|
|
28
|
-
function
|
|
29
|
-
targets:
|
|
29
|
+
function Ie({
|
|
30
|
+
targets: a,
|
|
30
31
|
enabledKeys: r,
|
|
31
|
-
tone:
|
|
32
|
+
tone: n = "light",
|
|
32
33
|
disabled: d,
|
|
33
|
-
onDone:
|
|
34
|
+
onDone: f
|
|
34
35
|
}) {
|
|
35
|
-
const
|
|
36
|
-
(e) =>
|
|
37
|
-
),
|
|
38
|
-
queries:
|
|
36
|
+
const $ = he(), V = le(), C = U(() => [...new Set(a.map((e) => e.collection))], [a]), { data: j } = Ne(C), R = C.filter((e) => J(j, r, e, "push")), O = C.filter(
|
|
37
|
+
(e) => J(j, r, e, "retry-push")
|
|
38
|
+
), S = ce({
|
|
39
|
+
queries: R.map((e) => ({
|
|
39
40
|
queryKey: ["bulk-push-actions", e],
|
|
40
|
-
queryFn: () =>
|
|
41
|
+
queryFn: () => $.request(xe("/item-actions/registered", { collection: e })).then((t) => t.data ?? []).catch(() => []),
|
|
41
42
|
staleTime: 5 * 6e4
|
|
42
43
|
}))
|
|
43
|
-
}),
|
|
44
|
+
}), W = S.map((e) => e.dataUpdatedAt).join(","), X = U(() => {
|
|
44
45
|
const e = /* @__PURE__ */ new Map();
|
|
45
|
-
return
|
|
46
|
-
var
|
|
47
|
-
for (const
|
|
48
|
-
const u = e.get(
|
|
49
|
-
u ? u.collections.push(
|
|
46
|
+
return R.forEach((t, s) => {
|
|
47
|
+
var i;
|
|
48
|
+
for (const o of (((i = S[s]) == null ? void 0 : i.data) ?? []).filter((u) => u.bulk !== !1)) {
|
|
49
|
+
const u = e.get(o.id);
|
|
50
|
+
u ? u.collections.push(t) : e.set(o.id, { ...o, collections: [t] });
|
|
50
51
|
}
|
|
51
52
|
}), [...e.values()];
|
|
52
|
-
}, [
|
|
53
|
-
const [
|
|
54
|
-
return
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
53
|
+
}, [W, R.join(",")]), [Y, A] = y(null), [w, B] = y(""), [M, _] = y(null), [Z, q] = y({}), [D, E] = y({}), ee = (e) => {
|
|
54
|
+
const [t, ...s] = e.split(":"), i = s.join(":"), o = a.find((u) => u.collection === t && String(u.id) === i);
|
|
55
|
+
return o != null && o.label ? String(o.label) : `#${i}`;
|
|
56
|
+
};
|
|
57
|
+
let k = 0;
|
|
58
|
+
const Q = async (e, t) => {
|
|
59
|
+
var o;
|
|
60
|
+
const s = e.kind === "push" ? e.action.collections : e.collections, i = [];
|
|
61
|
+
for (const u of s) {
|
|
62
|
+
const b = a.filter((x) => x.collection === u).map((x) => x.id);
|
|
63
|
+
if (b.length === 0) continue;
|
|
64
|
+
const m = !t && e.kind === "push" ? fe() : null;
|
|
65
|
+
m && be(m, b);
|
|
66
|
+
const p = e.kind === "push" ? await $.request(
|
|
67
|
+
G(`/bulk-actions/push${m ? `?progress=${m}` : ""}`, {
|
|
68
|
+
collection: u,
|
|
63
69
|
action_id: e.action.id,
|
|
64
|
-
ids:
|
|
65
|
-
dry_run:
|
|
66
|
-
...
|
|
70
|
+
ids: b,
|
|
71
|
+
dry_run: t,
|
|
72
|
+
...w.trim() ? { payload: { message: w.trim() } } : {}
|
|
67
73
|
})
|
|
68
|
-
) : await
|
|
69
|
-
|
|
70
|
-
);
|
|
71
|
-
|
|
74
|
+
) : await $.request(
|
|
75
|
+
G("/bulk-actions/retry-push", { collection: u, ids: b, dry_run: t })
|
|
76
|
+
), h = ((o = p.data) == null ? void 0 : o.background) === !0;
|
|
77
|
+
if (m && !h && ke(m), h) {
|
|
78
|
+
k += b.length;
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
i.push({ collection: u, data: p.data });
|
|
72
82
|
}
|
|
73
|
-
return
|
|
74
|
-
},
|
|
75
|
-
const
|
|
76
|
-
|
|
83
|
+
return Ce(i);
|
|
84
|
+
}, P = (e) => e.kind === "push" ? `push:${e.action.id}` : "retry-push", v = (e) => e.kind === "push" ? e.action.label : "Retry failed pushes", te = async (e) => {
|
|
85
|
+
const t = P(e);
|
|
86
|
+
q((s) => ({ ...s, [t]: "loading" }));
|
|
77
87
|
try {
|
|
78
|
-
const
|
|
79
|
-
|
|
88
|
+
const s = await Q(e, !0);
|
|
89
|
+
q((i) => ({ ...i, [t]: s }));
|
|
80
90
|
} catch {
|
|
81
|
-
|
|
91
|
+
q((s) => ({ ...s, [t]: null }));
|
|
82
92
|
}
|
|
83
|
-
},
|
|
84
|
-
const
|
|
85
|
-
_(
|
|
93
|
+
}, se = async (e) => {
|
|
94
|
+
const t = P(e);
|
|
95
|
+
_(t);
|
|
86
96
|
try {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
97
|
+
k = 0;
|
|
98
|
+
const s = await Q(e, !1);
|
|
99
|
+
if (k === 0 && E((i) => ({ ...i, [t]: s })), k > 0 && N.info(
|
|
100
|
+
`${v(e)}: running on ${k} record${k === 1 ? "" : "s"} — each row updates as it finishes, and a notification tells you how it ended.`,
|
|
101
|
+
{ duration: 8e3 }
|
|
102
|
+
), k === 0 || s.succeeded + s.failed + s.skipped > 0) {
|
|
103
|
+
const i = Re(v(e), s);
|
|
104
|
+
s.failed > 0 ? N.warning(i, { duration: 8e3 }) : k === 0 && N.success(i, { duration: 4e3 });
|
|
105
|
+
}
|
|
106
|
+
for (const i of [
|
|
92
107
|
"erp-submissions",
|
|
93
108
|
"row-push-state",
|
|
94
109
|
"cbv-integrations-summary",
|
|
@@ -96,37 +111,37 @@ function Qe({
|
|
|
96
111
|
"integration-obligations",
|
|
97
112
|
"item-actions"
|
|
98
113
|
])
|
|
99
|
-
|
|
100
|
-
} catch (
|
|
101
|
-
const
|
|
102
|
-
|
|
114
|
+
V.invalidateQueries({ queryKey: [i] });
|
|
115
|
+
} catch (s) {
|
|
116
|
+
const i = s.response;
|
|
117
|
+
N.error((i == null ? void 0 : i.error) ?? ge(s, `${v(e)} failed`));
|
|
103
118
|
} finally {
|
|
104
119
|
_(null);
|
|
105
120
|
}
|
|
106
|
-
},
|
|
107
|
-
...
|
|
121
|
+
}, F = [
|
|
122
|
+
...X.map((e) => ({ kind: "push", action: e })),
|
|
108
123
|
...O.length > 0 ? [{ kind: "retry", collections: O }] : []
|
|
109
124
|
];
|
|
110
|
-
if (
|
|
111
|
-
const
|
|
125
|
+
if (F.length === 0) return null;
|
|
126
|
+
const ne = (e) => n === "dark" ? H(
|
|
112
127
|
"inline-flex h-8 items-center gap-1.5 rounded-md border border-white/20 px-3 text-[12.5px] font-medium transition-colors hover:bg-white/10 disabled:opacity-50 dark:border-border dark:hover:bg-muted",
|
|
113
128
|
e && "bg-white/10"
|
|
114
|
-
) :
|
|
129
|
+
) : H(
|
|
115
130
|
"inline-flex items-center gap-1.5 rounded-md px-2.5 py-1 text-[12px] font-medium text-slate-600 transition-colors hover:bg-slate-100 disabled:opacity-50 dark:text-slate-300 dark:hover:bg-muted",
|
|
116
131
|
e && "bg-slate-100 dark:bg-muted"
|
|
117
132
|
);
|
|
118
|
-
return /* @__PURE__ */ l(
|
|
119
|
-
var
|
|
120
|
-
const
|
|
133
|
+
return /* @__PURE__ */ l(oe, { children: F.map((e) => {
|
|
134
|
+
var L, z, I, T;
|
|
135
|
+
const t = P(e), s = v(e), i = e.kind === "push" ? e.action.collections : e.collections, o = a.filter((g) => i.includes(g.collection)).length, u = Y === t, b = M === t, m = e.kind === "push" ? (L = e.action.confirm) == null ? void 0 : L.input : void 0, p = Z[t], h = D[t] ?? null, x = p && p !== "loading" ? p.succeeded : null, re = o > 0 && !b && x !== 0 && (!(m != null && m.required) || w.trim().length > 0), ie = e.kind === "push" ? ((z = e.action.confirm) == null ? void 0 : z.body) ?? `Runs "${e.action.label}" on each selected record, one at a time. Every record is a real request to the partner.` : "Re-sends the latest failed push of each selected record, partner by partner — the same stored request the record’s own Retry button sends.";
|
|
121
136
|
return /* @__PURE__ */ c(
|
|
122
|
-
|
|
137
|
+
ye,
|
|
123
138
|
{
|
|
124
139
|
open: u,
|
|
125
|
-
onOpenChange: (
|
|
126
|
-
|
|
140
|
+
onOpenChange: (g) => {
|
|
141
|
+
A(g ? t : null), g ? (B(""), E((ae) => ({ ...ae, [t]: null })), te(e)) : h && (f == null || f(h));
|
|
127
142
|
},
|
|
128
143
|
children: [
|
|
129
|
-
/* @__PURE__ */ l(
|
|
144
|
+
/* @__PURE__ */ l(we, { asChild: !0, children: /* @__PURE__ */ c(
|
|
130
145
|
"button",
|
|
131
146
|
{
|
|
132
147
|
type: "button",
|
|
@@ -134,88 +149,88 @@ function Qe({
|
|
|
134
149
|
"data-bulk-push-action": e.kind === "push" ? e.action.id : void 0,
|
|
135
150
|
"data-bulk-retry-push": e.kind === "retry" ? "" : void 0,
|
|
136
151
|
title: e.kind === "push" ? `Run ${e.action.label} on the selected records` : "Re-send each selected record’s latest failed push",
|
|
137
|
-
className:
|
|
152
|
+
className: ne(u),
|
|
138
153
|
children: [
|
|
139
|
-
|
|
140
|
-
|
|
154
|
+
b ? /* @__PURE__ */ l(K, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ l(de, { className: "h-3.5 w-3.5" }),
|
|
155
|
+
s
|
|
141
156
|
]
|
|
142
157
|
}
|
|
143
158
|
) }),
|
|
144
159
|
/* @__PURE__ */ c(
|
|
145
|
-
|
|
160
|
+
ve,
|
|
146
161
|
{
|
|
147
162
|
align: "center",
|
|
148
163
|
side: "top",
|
|
149
164
|
sideOffset: 8,
|
|
150
165
|
className: "w-[340px] p-3",
|
|
151
|
-
"data-bulk-push-popover":
|
|
166
|
+
"data-bulk-push-popover": t,
|
|
152
167
|
children: [
|
|
153
168
|
/* @__PURE__ */ c("p", { className: "text-[13px] font-semibold text-slate-800 dark:text-slate-100", children: [
|
|
154
|
-
|
|
169
|
+
s,
|
|
155
170
|
/* @__PURE__ */ c("span", { className: "ml-1.5 font-normal text-slate-500 dark:text-slate-400", children: [
|
|
156
171
|
"· ",
|
|
157
|
-
|
|
172
|
+
o,
|
|
158
173
|
" record",
|
|
159
|
-
|
|
174
|
+
o === 1 ? "" : "s"
|
|
160
175
|
] })
|
|
161
176
|
] }),
|
|
162
|
-
/* @__PURE__ */ l("p", { className: "mt-1 text-[12px] leading-snug text-slate-600 dark:text-slate-400", children:
|
|
163
|
-
!
|
|
177
|
+
/* @__PURE__ */ l("p", { className: "mt-1 text-[12px] leading-snug text-slate-600 dark:text-slate-400", children: ie }),
|
|
178
|
+
!h && (p === "loading" ? /* @__PURE__ */ l("p", { className: "mt-2 text-[11.5px] text-slate-400", "data-bulk-push-preview": "loading", children: "Checking which records this applies to…" }) : p ? /* @__PURE__ */ c(
|
|
164
179
|
"p",
|
|
165
180
|
{
|
|
166
181
|
className: "mt-2 rounded-md border border-slate-200 bg-slate-50 px-2 py-1.5 text-[11.5px] font-medium text-slate-700 dark:border-border dark:bg-muted/40 dark:text-slate-200",
|
|
167
|
-
"data-bulk-push-preview":
|
|
182
|
+
"data-bulk-push-preview": p.succeeded,
|
|
168
183
|
children: [
|
|
169
|
-
|
|
184
|
+
p.succeeded,
|
|
170
185
|
" of ",
|
|
171
|
-
|
|
186
|
+
o,
|
|
172
187
|
" would ",
|
|
173
188
|
e.kind === "push" ? "run" : "be retried",
|
|
174
|
-
|
|
189
|
+
p.skipped + p.failed > 0 && /* @__PURE__ */ c("span", { className: "font-normal text-slate-500 dark:text-slate-400", children: [
|
|
175
190
|
" · ",
|
|
176
|
-
|
|
191
|
+
qe(p)
|
|
177
192
|
] })
|
|
178
193
|
]
|
|
179
194
|
}
|
|
180
195
|
) : null),
|
|
181
|
-
!
|
|
196
|
+
!h && m && /* @__PURE__ */ c("label", { className: "mt-2.5 block", children: [
|
|
182
197
|
/* @__PURE__ */ c("span", { className: "text-[11px] font-medium text-slate-600 dark:text-slate-400", children: [
|
|
183
|
-
|
|
184
|
-
|
|
198
|
+
m.label,
|
|
199
|
+
m.required && /* @__PURE__ */ l("span", { className: "text-destructive", children: " *" })
|
|
185
200
|
] }),
|
|
186
201
|
/* @__PURE__ */ l(
|
|
187
202
|
"textarea",
|
|
188
203
|
{
|
|
189
|
-
value:
|
|
190
|
-
onChange: (
|
|
191
|
-
placeholder:
|
|
204
|
+
value: w,
|
|
205
|
+
onChange: (g) => B(g.target.value),
|
|
206
|
+
placeholder: m.placeholder ?? "Sent with every record",
|
|
192
207
|
rows: 2,
|
|
193
208
|
className: "mt-1 w-full resize-none rounded-md border border-slate-200 bg-white px-2 py-1.5 text-[12.5px] focus:border-nvr-cyan focus:outline-none dark:border-border dark:bg-card dark:text-slate-100"
|
|
194
209
|
}
|
|
195
210
|
)
|
|
196
211
|
] }),
|
|
197
|
-
|
|
212
|
+
h && /* @__PURE__ */ l(Pe, { result: h, labelFor: ee }),
|
|
198
213
|
/* @__PURE__ */ c("div", { className: "mt-3 flex items-center justify-end gap-2", children: [
|
|
199
214
|
/* @__PURE__ */ l(
|
|
200
215
|
"button",
|
|
201
216
|
{
|
|
202
217
|
type: "button",
|
|
203
218
|
onClick: () => {
|
|
204
|
-
|
|
219
|
+
A(null), h && (f == null || f(h));
|
|
205
220
|
},
|
|
206
221
|
className: "h-8 rounded-md px-2.5 text-[12.5px] font-medium text-slate-600 hover:bg-muted dark:text-slate-300",
|
|
207
|
-
children:
|
|
222
|
+
children: h ? "Done" : "Close"
|
|
208
223
|
}
|
|
209
224
|
),
|
|
210
|
-
!
|
|
225
|
+
!h && /* @__PURE__ */ l(
|
|
211
226
|
"button",
|
|
212
227
|
{
|
|
213
228
|
type: "button",
|
|
214
|
-
onClick: () => void
|
|
215
|
-
disabled: !
|
|
229
|
+
onClick: () => void se(e),
|
|
230
|
+
disabled: !re,
|
|
216
231
|
"data-bulk-push-run": !0,
|
|
217
232
|
className: "h-8 rounded-md bg-nvr-cyan px-3 text-[12.5px] font-semibold text-[#172940] hover:bg-nvr-cyan-dark disabled:opacity-40",
|
|
218
|
-
children:
|
|
233
|
+
children: b ? /* @__PURE__ */ l(K, { className: "h-3.5 w-3.5 animate-spin" }) : x != null && x !== o ? `${e.kind === "push" ? ((I = e.action.confirm) == null ? void 0 : I.confirm_label) ?? s : "Retry"} · ${x} of ${o}` : `${e.kind === "push" ? ((T = e.action.confirm) == null ? void 0 : T.confirm_label) ?? s : "Retry"} ${o}`
|
|
219
234
|
}
|
|
220
235
|
)
|
|
221
236
|
] })
|
|
@@ -224,58 +239,58 @@ function Qe({
|
|
|
224
239
|
)
|
|
225
240
|
]
|
|
226
241
|
},
|
|
227
|
-
|
|
242
|
+
t
|
|
228
243
|
);
|
|
229
244
|
}) });
|
|
230
245
|
}
|
|
231
|
-
function
|
|
246
|
+
function qe(a) {
|
|
232
247
|
const r = /* @__PURE__ */ new Map();
|
|
233
|
-
for (const
|
|
234
|
-
if (
|
|
235
|
-
const d =
|
|
248
|
+
for (const n of a.outcomes) {
|
|
249
|
+
if (n.outcome === "change") continue;
|
|
250
|
+
const d = n.reason ?? n.outcome;
|
|
236
251
|
r.set(d, (r.get(d) ?? 0) + 1);
|
|
237
252
|
}
|
|
238
|
-
return [...r.entries()].map(([
|
|
253
|
+
return [...r.entries()].map(([n, d]) => `${d} ${n}`).join(" · ");
|
|
239
254
|
}
|
|
240
|
-
function
|
|
241
|
-
result:
|
|
255
|
+
function Pe({
|
|
256
|
+
result: a,
|
|
242
257
|
labelFor: r
|
|
243
258
|
}) {
|
|
244
259
|
return /* @__PURE__ */ c("div", { className: "mt-2", "data-bulk-push-results": !0, children: [
|
|
245
260
|
/* @__PURE__ */ c("p", { className: "text-[11.5px] font-medium text-slate-700 dark:text-slate-200", children: [
|
|
246
|
-
|
|
261
|
+
a.succeeded,
|
|
247
262
|
" done",
|
|
248
|
-
|
|
249
|
-
|
|
263
|
+
a.skipped > 0 && ` · ${a.skipped} skipped`,
|
|
264
|
+
a.failed > 0 && /* @__PURE__ */ c("span", { className: "text-red-600 dark:text-red-400", children: [
|
|
250
265
|
" · ",
|
|
251
|
-
|
|
266
|
+
a.failed,
|
|
252
267
|
" failed"
|
|
253
268
|
] })
|
|
254
269
|
] }),
|
|
255
|
-
/* @__PURE__ */ l("ul", { className: "mt-1 max-h-48 space-y-1 overflow-auto", children:
|
|
270
|
+
/* @__PURE__ */ l("ul", { className: "mt-1 max-h-48 space-y-1 overflow-auto", children: a.outcomes.map((n) => /* @__PURE__ */ c(
|
|
256
271
|
"li",
|
|
257
272
|
{
|
|
258
|
-
"data-bulk-push-result":
|
|
259
|
-
"data-outcome":
|
|
273
|
+
"data-bulk-push-result": n.item,
|
|
274
|
+
"data-outcome": n.outcome,
|
|
260
275
|
className: "flex items-start gap-1.5 text-[11.5px] leading-snug",
|
|
261
276
|
children: [
|
|
262
|
-
|
|
277
|
+
n.outcome === "change" ? /* @__PURE__ */ l(ue, { className: "mt-px h-3.5 w-3.5 shrink-0 text-emerald-600 dark:text-emerald-400" }) : n.outcome === "fail" ? /* @__PURE__ */ l(me, { className: "mt-px h-3.5 w-3.5 shrink-0 text-red-600 dark:text-red-400" }) : /* @__PURE__ */ l(pe, { className: "mt-px h-3.5 w-3.5 shrink-0 text-slate-400" }),
|
|
263
278
|
/* @__PURE__ */ c("span", { className: "min-w-0", children: [
|
|
264
|
-
/* @__PURE__ */ l("span", { className: "font-medium text-slate-700 dark:text-slate-200", children: r(
|
|
265
|
-
|
|
279
|
+
/* @__PURE__ */ l("span", { className: "font-medium text-slate-700 dark:text-slate-200", children: r(n.item) }),
|
|
280
|
+
n.reason && /* @__PURE__ */ c("span", { className: "break-words text-slate-500 dark:text-slate-400", children: [
|
|
266
281
|
" ",
|
|
267
282
|
"— ",
|
|
268
|
-
|
|
283
|
+
n.reason
|
|
269
284
|
] })
|
|
270
285
|
] })
|
|
271
286
|
]
|
|
272
287
|
},
|
|
273
|
-
|
|
288
|
+
n.item
|
|
274
289
|
)) })
|
|
275
290
|
] });
|
|
276
291
|
}
|
|
277
292
|
export {
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
293
|
+
Ie as PushBulkButtons,
|
|
294
|
+
Pe as PushResultList,
|
|
295
|
+
J as builtinListed
|
|
281
296
|
};
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { useSyncExternalStore as
|
|
2
|
-
import { useLiveEvent as
|
|
1
|
+
import { useSyncExternalStore as f } from "react";
|
|
2
|
+
import { useLiveEvent as a } from "./live.js";
|
|
3
3
|
let t = null, l = 0;
|
|
4
|
-
const
|
|
4
|
+
const i = /* @__PURE__ */ new Set();
|
|
5
5
|
let r = null;
|
|
6
6
|
function s() {
|
|
7
7
|
l++;
|
|
8
|
-
for (const e of
|
|
8
|
+
for (const e of i) e();
|
|
9
9
|
}
|
|
10
|
-
function
|
|
10
|
+
function m() {
|
|
11
11
|
return `bp${typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID().replace(/-/g, "") : `${Date.now().toString(36)}${Math.random().toString(36).slice(2, 12)}`}`.slice(0, 40);
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function S(e, n) {
|
|
14
14
|
r && clearTimeout(r), t = {
|
|
15
15
|
id: e,
|
|
16
16
|
rows: new Map(n.map((o) => [String(o), { status: "queued" }])),
|
|
17
17
|
finished: !1
|
|
18
18
|
}, s();
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function d(e, n = 6e3) {
|
|
21
21
|
if (!(!t || t.id !== e)) {
|
|
22
22
|
t.finished = !0;
|
|
23
|
-
for (const [o,
|
|
24
|
-
(
|
|
23
|
+
for (const [o, u] of t.rows)
|
|
24
|
+
(u.status === "queued" || u.status === "running") && t.rows.set(o, { status: "done" });
|
|
25
25
|
s(), r && clearTimeout(r), r = setTimeout(() => {
|
|
26
26
|
(t == null ? void 0 : t.id) === e && (t = null, s());
|
|
27
27
|
}, n);
|
|
@@ -34,23 +34,27 @@ function c(e) {
|
|
|
34
34
|
const n = t.rows.get(String(e.running));
|
|
35
35
|
(!n || n.status === "queued") && t.rows.set(String(e.running), { status: "running" });
|
|
36
36
|
}
|
|
37
|
+
if (e.finished && !t.finished) {
|
|
38
|
+
d(t.id);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
37
41
|
s();
|
|
38
42
|
}
|
|
39
43
|
}
|
|
40
44
|
function k() {
|
|
41
|
-
|
|
45
|
+
a("bulk:rows", c, { includeOwn: !0 });
|
|
42
46
|
}
|
|
43
|
-
function
|
|
44
|
-
return
|
|
45
|
-
(n) => (
|
|
47
|
+
function y(e) {
|
|
48
|
+
return f(
|
|
49
|
+
(n) => (i.add(n), () => i.delete(n)),
|
|
46
50
|
() => l,
|
|
47
51
|
() => 0
|
|
48
52
|
), (t == null ? void 0 : t.rows.get(String(e))) ?? null;
|
|
49
53
|
}
|
|
50
54
|
export {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
55
|
+
d as endBulkProgress,
|
|
56
|
+
m as newBulkProgressId,
|
|
57
|
+
S as startBulkProgress,
|
|
54
58
|
k as useBulkProgressFeed,
|
|
55
|
-
|
|
59
|
+
y as useBulkRowState
|
|
56
60
|
};
|