@nivaro/react 0.3.37 → 0.3.38
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.
|
@@ -9,7 +9,7 @@ import { noteReplayEvent as _e, createReplayCheckoutState as De } from "../share
|
|
|
9
9
|
import { emitReplayTap as Te, setReplayRecorderMode as N, registerReplayCapture as qe, clipEndOffset as Le, withClipKind as Pe } from "../shared/lib/replay-capture.js";
|
|
10
10
|
import { instrumentConsole as Ne, instrumentRequests as Fe, redactSecrets as Me } from "../shared/lib/replay-context.js";
|
|
11
11
|
import { instrumentSocket as Oe } from "../shared/lib/replay-socket.js";
|
|
12
|
-
const Ue = "nivaro-react@0.3.
|
|
12
|
+
const Ue = "nivaro-react@0.3.38", j = 1e4, We = 150, He = 3e3, Ke = 600, $e = (n) => `nvr_replay_resume${n ? `:${n}` : ""}`, G = () => typeof navigator > "u" || navigator.onLine !== !1;
|
|
13
13
|
function Be(n) {
|
|
14
14
|
return typeof n.url != "string" || typeof fetch != "function" ? null : (f, a) => {
|
|
15
15
|
const u = typeof n.getToken == "function" ? n.getToken() : void 0, d = { "Content-Type": "application/json" };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs as a, jsx as e, Fragment as R } from "react/jsx-runtime";
|
|
2
2
|
import { useQueryClient as oe, useQuery as X, useMutation as Y } from "@tanstack/react-query";
|
|
3
|
-
import { FileSpreadsheet as Ne, Download as Z, RotateCcw as ve, Undo2 as ee, Ban as we, ArrowRight as ye, AlertTriangle as Ce, Loader2 as H, Search as
|
|
3
|
+
import { FileSpreadsheet as Ne, Download as Z, RotateCcw as ve, Undo2 as ee, Ban as we, ArrowRight as ye, AlertTriangle as Ce, Loader2 as H, Search as $e, ChevronDown as ie, ChevronRight as ce, Check as ue, Copy as me, ExternalLink as _e } from "lucide-react";
|
|
4
4
|
import { useState as N, useEffect as he, useMemo as pe } from "react";
|
|
5
5
|
import { useNivaroClient as te, useApiFetchConfig as Re, useItemNavigation as Se } from "../../context.js";
|
|
6
6
|
import { useDebounced as Te } from "../../hooks/useDebounced.js";
|
|
@@ -465,7 +465,7 @@ function Ae({
|
|
|
465
465
|
v
|
|
466
466
|
),
|
|
467
467
|
children: [
|
|
468
|
-
/* @__PURE__ */ e(
|
|
468
|
+
/* @__PURE__ */ e(_e, { className: "h-3 w-3" }),
|
|
469
469
|
" Open the record"
|
|
470
470
|
]
|
|
471
471
|
}
|
|
@@ -499,10 +499,10 @@ function Ie({
|
|
|
499
499
|
var O, U, z;
|
|
500
500
|
const p = te(), u = oe(), { download: s, busy: g, error: r } = ke(), [f, x] = N(""), [m, Q] = N(null), [w, L] = N(1), [q, D] = N(null), C = Te(f, 300);
|
|
501
501
|
he(() => L(1), [o, m, C, t]);
|
|
502
|
-
const
|
|
503
|
-
queryKey: ["staged-import-run-items", t,
|
|
502
|
+
const $ = { kind: o ?? "", collection: m ?? "", search: C, page: w, limit: B }, y = X({
|
|
503
|
+
queryKey: ["staged-import-run-items", t, $],
|
|
504
504
|
queryFn: () => p.request(
|
|
505
|
-
xe(`/staged-imports/${t}/items`,
|
|
505
|
+
xe(`/staged-imports/${t}/items`, $)
|
|
506
506
|
),
|
|
507
507
|
placeholderData: (d) => d,
|
|
508
508
|
refetchInterval: c ? fe : !1
|
|
@@ -520,14 +520,14 @@ function Ie({
|
|
|
520
520
|
var k;
|
|
521
521
|
return D(((k = d.response) == null ? void 0 : k.error) ?? d.message);
|
|
522
522
|
}
|
|
523
|
-
}), F = ((O = y.data) == null ? void 0 : O.facets) ?? {}, j = Object.keys(F.collection ?? n.collections ?? {}),
|
|
523
|
+
}), F = ((O = y.data) == null ? void 0 : O.facets) ?? {}, j = Object.keys(F.collection ?? n.collections ?? {}), _ = ((U = y.data) == null ? void 0 : U.total) ?? 0, M = ((z = y.data) == null ? void 0 : z.data) ?? [], V = n.items_stored ?? 0, W = [
|
|
524
524
|
{ key: null, label: "All", n: Object.values(F.kind ?? {}).reduce((d, k) => d + k, 0) },
|
|
525
525
|
...["created", "updated", "removed", "skipped", "failed"].map((d) => {
|
|
526
526
|
var k;
|
|
527
527
|
return { key: d, label: K[d].label, n: ((k = F.kind) == null ? void 0 : k[d]) ?? 0 };
|
|
528
528
|
}).filter((d) => d.n > 0 || d.key === o)
|
|
529
529
|
];
|
|
530
|
-
return V === 0 && !y.isLoading &&
|
|
530
|
+
return V === 0 && !y.isLoading && _ === 0 && !C && !o ? /* @__PURE__ */ a("section", { "data-run-records": !0, children: [
|
|
531
531
|
/* @__PURE__ */ e(T, { children: "Records" }),
|
|
532
532
|
/* @__PURE__ */ e("p", { className: "rounded-md border border-dashed border-slate-200 px-3 py-4 text-[12.5px] text-slate-600 dark:border-border dark:text-muted-foreground", children: "This run changed no records and left no rows out. Every row in the file already matched what is stored." })
|
|
533
533
|
] }) : /* @__PURE__ */ a("section", { "data-run-records": !0, children: [
|
|
@@ -538,7 +538,7 @@ function Ie({
|
|
|
538
538
|
P,
|
|
539
539
|
{
|
|
540
540
|
"data-run-items-download": !0,
|
|
541
|
-
disabled: g != null ||
|
|
541
|
+
disabled: g != null || _ === 0,
|
|
542
542
|
onClick: () => s(
|
|
543
543
|
`/staged-imports/${t}/items.csv?kind=${o ?? ""}&collection=${m ?? ""}&search=${encodeURIComponent(C)}`,
|
|
544
544
|
`import-run-${t}${o ? `-${o}` : ""}.csv`
|
|
@@ -607,7 +607,7 @@ function Ie({
|
|
|
607
607
|
}
|
|
608
608
|
),
|
|
609
609
|
/* @__PURE__ */ a("div", { className: "relative ml-auto w-[220px] max-w-full", children: [
|
|
610
|
-
/* @__PURE__ */ e(
|
|
610
|
+
/* @__PURE__ */ e($e, { className: "pointer-events-none absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" }),
|
|
611
611
|
/* @__PURE__ */ e(
|
|
612
612
|
Ke,
|
|
613
613
|
{
|
|
@@ -654,14 +654,14 @@ function Ie({
|
|
|
654
654
|
}) })
|
|
655
655
|
}
|
|
656
656
|
),
|
|
657
|
-
|
|
657
|
+
_ > B && /* @__PURE__ */ a("div", { className: "mt-2 flex items-center justify-between text-[11.5px] text-slate-600 dark:text-muted-foreground", children: [
|
|
658
658
|
/* @__PURE__ */ a("span", { className: "tabular-nums", children: [
|
|
659
659
|
h((w - 1) * B + 1),
|
|
660
660
|
"–",
|
|
661
|
-
h(Math.min(w * B,
|
|
661
|
+
h(Math.min(w * B, _)),
|
|
662
662
|
" of",
|
|
663
663
|
" ",
|
|
664
|
-
h(
|
|
664
|
+
h(_)
|
|
665
665
|
] }),
|
|
666
666
|
/* @__PURE__ */ a("span", { className: "flex items-center gap-1", children: [
|
|
667
667
|
/* @__PURE__ */ e(
|
|
@@ -681,7 +681,7 @@ function Ie({
|
|
|
681
681
|
variant: "outline",
|
|
682
682
|
size: "sm",
|
|
683
683
|
className: "h-6 px-2 text-[11.5px]",
|
|
684
|
-
disabled: w * B >=
|
|
684
|
+
disabled: w * B >= _,
|
|
685
685
|
onClick: () => L((d) => d + 1),
|
|
686
686
|
children: "Next"
|
|
687
687
|
}
|
|
@@ -907,12 +907,12 @@ function Nt({
|
|
|
907
907
|
he(() => {
|
|
908
908
|
w(null), q(!1), C(!1);
|
|
909
909
|
}, [n]);
|
|
910
|
-
const
|
|
910
|
+
const $ = Y({
|
|
911
911
|
mutationFn: () => u.request(
|
|
912
912
|
J(`/staged-imports/${n}/report/rebuild`, {})
|
|
913
913
|
),
|
|
914
914
|
onSuccess: () => void s.invalidateQueries({ queryKey: ["staged-import-run", n] })
|
|
915
|
-
}), y = r ? be(r).mode : null, E = (r == null ? void 0 : r.status) === "completed" || (r == null ? void 0 : r.status) === "error", F = l && !!f && E && (f.counts.created > 0 || f.counts.updated > 0), j = !!f,
|
|
915
|
+
}), y = r ? be(r).mode : null, E = (r == null ? void 0 : r.status) === "completed" || (r == null ? void 0 : r.status) === "error", F = l && !!f && E && (f.counts.created > 0 || f.counts.updated > 0), j = !!f, _ = pe(() => r ? /* @__PURE__ */ a("dl", { className: "mt-3 grid grid-cols-2 gap-x-5 gap-y-2 sm:grid-cols-4", children: [
|
|
916
916
|
/* @__PURE__ */ e(I, { label: "Queued by", children: ze(r) ?? "—" }),
|
|
917
917
|
/* @__PURE__ */ e(I, { label: r.finished_at ? "Finished" : r.started_at ? "Started" : "Queued", children: se(r.finished_at ?? r.started_at ?? r.created_at ?? /* @__PURE__ */ new Date()) }),
|
|
918
918
|
/* @__PURE__ */ e(I, { label: "Took", children: /* @__PURE__ */ e("span", { className: "tabular-nums", children: ne(r.duration) }) }),
|
|
@@ -952,7 +952,7 @@ function Nt({
|
|
|
952
952
|
o,
|
|
953
953
|
x != null && ` · ${ne(x)} elapsed`
|
|
954
954
|
] }),
|
|
955
|
-
|
|
955
|
+
_
|
|
956
956
|
] }),
|
|
957
957
|
/* @__PURE__ */ a("div", { className: "min-h-0 flex-1 space-y-6 overflow-y-auto px-5 py-4", children: [
|
|
958
958
|
f ? /* @__PURE__ */ a(R, { children: [
|
|
@@ -995,18 +995,18 @@ function Nt({
|
|
|
995
995
|
{
|
|
996
996
|
type: "button",
|
|
997
997
|
"data-run-rebuild": !0,
|
|
998
|
-
disabled:
|
|
999
|
-
onClick: () =>
|
|
998
|
+
disabled: $.isPending,
|
|
999
|
+
onClick: () => $.mutate(),
|
|
1000
1000
|
className: b(
|
|
1001
1001
|
"font-medium text-[#0369a1] underline-offset-2 hover:underline disabled:opacity-60 dark:text-[#7dd3fc]",
|
|
1002
1002
|
v
|
|
1003
1003
|
),
|
|
1004
|
-
children:
|
|
1004
|
+
children: $.isPending ? "Reading…" : "Read it back from recorded changes"
|
|
1005
1005
|
}
|
|
1006
1006
|
)
|
|
1007
1007
|
] })
|
|
1008
1008
|
] }),
|
|
1009
|
-
|
|
1009
|
+
$.isError && /* @__PURE__ */ e("p", { className: "mt-1.5 max-w-[64ch] text-[12px] text-slate-700 dark:text-foreground", children: ((z = $.error.response) == null ? void 0 : z.error) ?? $.error.message })
|
|
1010
1010
|
] }),
|
|
1011
1011
|
/* @__PURE__ */ a("section", { "data-run-file": !0, children: [
|
|
1012
1012
|
/* @__PURE__ */ e(T, { children: "File" }),
|
|
@@ -1019,9 +1019,10 @@ function Nt({
|
|
|
1019
1019
|
m && /* @__PURE__ */ e(
|
|
1020
1020
|
"a",
|
|
1021
1021
|
{
|
|
1022
|
-
href: m
|
|
1023
|
-
|
|
1022
|
+
href: `${m}${m.includes("?") ? "&" : "?"}download=1`,
|
|
1023
|
+
download: r.file_name ?? !0,
|
|
1024
1024
|
rel: "noreferrer",
|
|
1025
|
+
"data-run-file-download": !0,
|
|
1025
1026
|
className: b(
|
|
1026
1027
|
"rounded p-1 text-slate-500 transition-colors hover:bg-slate-100 hover:text-slate-800 dark:hover:bg-muted",
|
|
1027
1028
|
v
|