@nivaro/react 0.3.115 → 0.3.117
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 +1 -1
- package/dist/index.d.ts +15 -1
- package/dist/shared/components/CollectionBrowserView.js +3815 -3576
- package/dist/shared/components/DataTable.js +611 -551
- package/dist/shared/components/OverflowRail.js +326 -0
- package/dist/shared/components/ReportView.js +1086 -1091
- package/dist/shared/components/TipLayer.js +8 -8
- package/dist/shared/components/cbv/column-totals.js +62 -57
- package/dist/shared/components/charts/category-axis.js +93 -0
- package/dist/shared/components/integrations/console/SignalCard.js +84 -77
- package/dist/shared/components/list/PhonePager.js +50 -0
- package/dist/shared/components/notifications/NotificationCenterView.js +67 -68
- package/dist/shared/components/pipeline/BindingStartStateSettings.js +163 -0
- package/dist/shared/components/pipeline/PipelineEditorView.js +1515 -1475
- package/dist/shared/components/queue/OwnerAvatars.js +9 -9
- package/dist/shared/components/queue/QueueWorklist.js +2016 -1851
- package/dist/shared/components/queue/worklist-helpers.js +10 -6
- package/dist/shared/components/ui/popover.js +53 -29
- package/dist/shared/lib/keep-row-focus.js +43 -0
- package/dist/shared/lib/obligation-banner.js +17 -17
- package/dist/shared/lib/rail-menu-context.js +9 -0
- package/dist/shared/lib/row-surface.js +7 -0
- package/dist/shared/lib/table-pins.js +20 -18
- package/dist/shared/lib/upload-file.js +48 -19
- package/dist/shared/lib/upload-presence.js +33 -33
- package/dist/shared/lib/use-below-md.js +29 -0
- package/dist/shared/lib/use-query-entry.js +17 -0
- package/package.json +1 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsxs as n, jsx as t, Fragment as qe } from "react/jsx-runtime";
|
|
2
2
|
import { useQueryClient as Nt, useQuery as H, keepPreviousData as Ct, useMutation as A } from "@tanstack/react-query";
|
|
3
|
-
import { Archive as Me, CheckCheck as
|
|
3
|
+
import { ChevronUp as St, Archive as Me, CheckCheck as _t, Search as At, Check as oe, AlarmClock as ce, ExternalLink as Te, Bell as Le, ShieldCheck as ue, ChevronLeft as Dt, ChevronRight as zt, History as $t, Trash2 as Ft, ChevronDown as qt } from "lucide-react";
|
|
4
4
|
import { useState as c, useEffect as me, useRef as Mt, useCallback as Tt, Fragment as pe } from "react";
|
|
5
5
|
import { useNivaroClient as Lt } from "../../context.js";
|
|
6
6
|
import { get as Q, post as w, patch as Pt, del as Rt } from "../../lib/commands.js";
|
|
7
7
|
import { useTopInserts as Pe, slideIn as Ot } from "../../lib/live-screen.js";
|
|
8
8
|
import { resolveNotificationTargetFor as V, runNotificationTarget as be } from "../../lib/notification-target.js";
|
|
9
|
-
import { openInTabsMessage as It, openInTabs as
|
|
10
|
-
import { useRecordPeek as
|
|
9
|
+
import { openInTabsMessage as It, openInTabs as Kt } from "../../lib/open-in-tabs.js";
|
|
10
|
+
import { useRecordPeek as jt, isNewTabClick as Bt, notificationPeekTarget as Re } from "../../lib/record-peek.js";
|
|
11
11
|
import { cn as b, formatRelative as Oe } from "../../lib/utils.js";
|
|
12
12
|
import { AgentBadge as Ut } from "../AgentBadge.js";
|
|
13
13
|
import { hasSnapshotView as Ht, offersChanges as Qt } from "../NotificationBell.js";
|
|
@@ -31,7 +31,7 @@ const xe = 25, na = [
|
|
|
31
31
|
{ key: "needs_you", label: "Needs you" },
|
|
32
32
|
{ key: "fyi", label: "FYI" }
|
|
33
33
|
];
|
|
34
|
-
function
|
|
34
|
+
function Ke() {
|
|
35
35
|
const m = /* @__PURE__ */ new Date(), h = new Date(m.getTime() + 3600 * 1e3), N = new Date(m);
|
|
36
36
|
N.setDate(N.getDate() + 1), N.setHours(8, 0, 0, 0);
|
|
37
37
|
const D = new Date(m);
|
|
@@ -41,7 +41,7 @@ function je() {
|
|
|
41
41
|
{ label: "Until next week", until: D }
|
|
42
42
|
];
|
|
43
43
|
}
|
|
44
|
-
const
|
|
44
|
+
const je = (m) => `b:${m.collection}:${m.item}`, Be = (m) => `n:${m.id}`;
|
|
45
45
|
function Sa({
|
|
46
46
|
routes: m,
|
|
47
47
|
onNavigate: h,
|
|
@@ -54,7 +54,7 @@ function Sa({
|
|
|
54
54
|
onError: d,
|
|
55
55
|
className: Ge
|
|
56
56
|
}) {
|
|
57
|
-
const p = Lt(), W =
|
|
57
|
+
const p = Lt(), W = jt(), Z = Nt(), [J, Ye] = c(() => {
|
|
58
58
|
if (fe !== void 0) return fe;
|
|
59
59
|
if (typeof window > "u") return null;
|
|
60
60
|
const e = new URLSearchParams(window.location.search).get("changes"), a = Number(e);
|
|
@@ -66,9 +66,9 @@ function Sa({
|
|
|
66
66
|
).then((e) => e.data ?? []),
|
|
67
67
|
enabled: i === "sent",
|
|
68
68
|
refetchInterval: i === "sent" ? 3e4 : !1
|
|
69
|
-
}), [S, F] = c(1), [Xe, X] = c(null), [ke, ve] = c(null), [E, Ee] = c(""), [I, et] = c(""), [q, tt] = c(""), [
|
|
69
|
+
}), [S, F] = c(1), [Xe, X] = c(null), [ke, ve] = c(null), [E, Ee] = c(""), [I, et] = c(""), [q, tt] = c(""), [K, at] = c(!0), [nt, lt] = c(() => /* @__PURE__ */ new Set()), [v, ye] = c(null), [M, Y] = c(() => /* @__PURE__ */ new Set()), [ee, j] = c(!1), [rt, te] = c(!1), [we, dt] = c(!1), [Ne, it] = c("30");
|
|
70
70
|
me(() => {
|
|
71
|
-
Y(/* @__PURE__ */ new Set()),
|
|
71
|
+
Y(/* @__PURE__ */ new Set()), j(!1), te(!1);
|
|
72
72
|
}, [i, C, S, I, q]), me(() => {
|
|
73
73
|
const e = setTimeout(() => {
|
|
74
74
|
et(E.trim()), F(1);
|
|
@@ -88,7 +88,7 @@ function Sa({
|
|
|
88
88
|
I,
|
|
89
89
|
q,
|
|
90
90
|
N ?? null,
|
|
91
|
-
|
|
91
|
+
K
|
|
92
92
|
],
|
|
93
93
|
queryFn: () => p.request(
|
|
94
94
|
Q("/notifications", {
|
|
@@ -100,10 +100,10 @@ function Sa({
|
|
|
100
100
|
search: I || void 0,
|
|
101
101
|
collection: q || void 0,
|
|
102
102
|
app: N,
|
|
103
|
-
bundle:
|
|
103
|
+
bundle: K ? "record" : void 0
|
|
104
104
|
})
|
|
105
105
|
).then((e) => {
|
|
106
|
-
if (!
|
|
106
|
+
if (!K || e.bundles) return e;
|
|
107
107
|
const a = Yt(e.data ?? []);
|
|
108
108
|
return { ...e, data: a.rows, bundles: a.bundles };
|
|
109
109
|
}),
|
|
@@ -118,7 +118,7 @@ function Sa({
|
|
|
118
118
|
return [...new Set(a.map((l) => l.collection))].sort();
|
|
119
119
|
}),
|
|
120
120
|
staleTime: 3e5
|
|
121
|
-
}), z = i === "archived" || S > 1 ? [] : (u == null ? void 0 : u.pinned) ?? [], ut = new Set(z.map((e) => e.id)), T = ((u == null ? void 0 : u.data) ?? []).filter((e) => !ut.has(e.id)), B = (u == null ? void 0 : u.bundles) ?? [], $ = (u == null ? void 0 : u.total) ?? 0, ae = Math.max(1, Math.ceil($ / xe)), Ce = i !== "sent" && S === 1 && !!u && !ot, Se = [i, C, I, q, N ?? "",
|
|
121
|
+
}), z = i === "archived" || S > 1 ? [] : (u == null ? void 0 : u.pinned) ?? [], ut = new Set(z.map((e) => e.id)), T = ((u == null ? void 0 : u.data) ?? []).filter((e) => !ut.has(e.id)), B = (u == null ? void 0 : u.bundles) ?? [], $ = (u == null ? void 0 : u.total) ?? 0, ae = Math.max(1, Math.ceil($ / xe)), Ce = i !== "sent" && S === 1 && !!u && !ot, Se = [i, C, I, q, N ?? "", K].join("|"), L = Pe(u ? B : void 0, je, {
|
|
122
122
|
enabled: Ce,
|
|
123
123
|
resetKey: Se
|
|
124
124
|
}), P = Pe(u ? T : void 0, Be, {
|
|
@@ -186,7 +186,7 @@ function Sa({
|
|
|
186
186
|
),
|
|
187
187
|
onSuccess: (e, a) => {
|
|
188
188
|
var s;
|
|
189
|
-
k(), Y(/* @__PURE__ */ new Set()),
|
|
189
|
+
k(), Y(/* @__PURE__ */ new Set()), j(!1), te(!1);
|
|
190
190
|
const l = ((s = e.data) == null ? void 0 : s.updated) ?? 0;
|
|
191
191
|
r == null || r(
|
|
192
192
|
`${l} notification${l === 1 ? "" : "s"} ${a.action === "read" ? "marked read" : a.action === "archive" ? "archived" : "snoozed"}`
|
|
@@ -233,7 +233,7 @@ function Sa({
|
|
|
233
233
|
e.read || (await p.request(w(`/notifications/${e.id}/read`)).catch(() => {
|
|
234
234
|
}), k()), be(V(e, m), h);
|
|
235
235
|
}, vt = (e) => {
|
|
236
|
-
|
|
236
|
+
j(!1), Y((a) => {
|
|
237
237
|
const l = new Set(a);
|
|
238
238
|
return l.has(e) ? l.delete(e) : l.add(e), l;
|
|
239
239
|
});
|
|
@@ -429,7 +429,7 @@ function Sa({
|
|
|
429
429
|
}
|
|
430
430
|
),
|
|
431
431
|
ke === e.id && /* @__PURE__ */ n("div", { className: "absolute right-0 top-8 z-20 w-[180px] rounded-md border border-slate-200 bg-white py-1 shadow-lg dark:border-border dark:bg-card", children: [
|
|
432
|
-
|
|
432
|
+
Ke().map((g) => /* @__PURE__ */ t(
|
|
433
433
|
"button",
|
|
434
434
|
{
|
|
435
435
|
type: "button",
|
|
@@ -494,7 +494,7 @@ function Sa({
|
|
|
494
494
|
return /* @__PURE__ */ n(
|
|
495
495
|
"div",
|
|
496
496
|
{
|
|
497
|
-
"data-live-key":
|
|
497
|
+
"data-live-key": je(e),
|
|
498
498
|
"data-notification-bundle": a,
|
|
499
499
|
"data-notification-bundle-count": e.count,
|
|
500
500
|
"data-notification-bundle-lane": e.lane,
|
|
@@ -630,7 +630,23 @@ function Sa({
|
|
|
630
630
|
/* @__PURE__ */ n("header", { className: "shrink-0 border-b border-slate-200 bg-white px-4 py-5 dark:border-border dark:bg-background sm:px-8", children: [
|
|
631
631
|
/* @__PURE__ */ n("div", { className: "flex flex-wrap items-center justify-between gap-x-3 gap-y-2", children: [
|
|
632
632
|
/* @__PURE__ */ n("div", { children: [
|
|
633
|
-
/* @__PURE__ */
|
|
633
|
+
/* @__PURE__ */ n("div", { className: "flex flex-wrap items-center gap-x-3 gap-y-1", children: [
|
|
634
|
+
/* @__PURE__ */ t("h1", { className: "text-xl font-bold text-slate-900 dark:text-slate-100", children: "Notifications" }),
|
|
635
|
+
ne > 0 && /* @__PURE__ */ n(
|
|
636
|
+
"button",
|
|
637
|
+
{
|
|
638
|
+
type: "button",
|
|
639
|
+
"data-notification-new-pill": ne,
|
|
640
|
+
onClick: bt,
|
|
641
|
+
className: "inline-flex h-7 items-center gap-1 rounded-full border border-nvr-cyan/40 bg-nvr-cyan/[0.08] px-3 text-[12px] font-medium text-nvr-navy transition-colors hover:bg-nvr-cyan/15 focus-visible:outline focus-visible:outline-2 focus-visible:outline-nvr-cyan dark:border-nvr-cyan/40 dark:bg-nvr-cyan/15 dark:text-nvr-cyan dark:hover:bg-nvr-cyan/25",
|
|
642
|
+
children: [
|
|
643
|
+
/* @__PURE__ */ t(St, { className: "h-3.5 w-3.5", "aria-hidden": !0 }),
|
|
644
|
+
ne,
|
|
645
|
+
" new"
|
|
646
|
+
]
|
|
647
|
+
}
|
|
648
|
+
)
|
|
649
|
+
] }),
|
|
634
650
|
/* @__PURE__ */ n("p", { className: "mt-0.5 text-[13px] text-slate-400", children: [
|
|
635
651
|
$,
|
|
636
652
|
" notification",
|
|
@@ -660,7 +676,7 @@ function Sa({
|
|
|
660
676
|
disabled: le.isPending,
|
|
661
677
|
className: "inline-flex h-8 items-center gap-1.5 whitespace-nowrap rounded-md border border-slate-200 px-3 text-[12px] font-medium text-slate-700 hover:bg-slate-50 disabled:opacity-50 dark:border-border dark:text-foreground dark:hover:bg-muted",
|
|
662
678
|
children: [
|
|
663
|
-
/* @__PURE__ */ t(
|
|
679
|
+
/* @__PURE__ */ t(_t, { className: "h-3.5 w-3.5" }),
|
|
664
680
|
le.isPending ? "Marking…" : "Mark all read"
|
|
665
681
|
]
|
|
666
682
|
}
|
|
@@ -764,7 +780,7 @@ function Sa({
|
|
|
764
780
|
e.key
|
|
765
781
|
)) }),
|
|
766
782
|
/* @__PURE__ */ n("div", { className: "relative w-full sm:ml-auto sm:w-auto", children: [
|
|
767
|
-
/* @__PURE__ */ t(
|
|
783
|
+
/* @__PURE__ */ t(At, { className: "pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" }),
|
|
768
784
|
/* @__PURE__ */ t(
|
|
769
785
|
"input",
|
|
770
786
|
{
|
|
@@ -800,7 +816,7 @@ function Sa({
|
|
|
800
816
|
"input",
|
|
801
817
|
{
|
|
802
818
|
type: "checkbox",
|
|
803
|
-
checked:
|
|
819
|
+
checked: K,
|
|
804
820
|
onChange: (e) => at(e.target.checked),
|
|
805
821
|
className: "h-3.5 w-3.5",
|
|
806
822
|
"data-notification-group-by-record": !0
|
|
@@ -845,7 +861,7 @@ function Sa({
|
|
|
845
861
|
"button",
|
|
846
862
|
{
|
|
847
863
|
type: "button",
|
|
848
|
-
onClick: () =>
|
|
864
|
+
onClick: () => j(!0),
|
|
849
865
|
"data-notification-select-matching": !0,
|
|
850
866
|
className: "text-nvr-navy underline decoration-dotted underline-offset-2 dark:text-nvr-cyan",
|
|
851
867
|
children: [
|
|
@@ -885,7 +901,7 @@ function Sa({
|
|
|
885
901
|
]
|
|
886
902
|
}
|
|
887
903
|
),
|
|
888
|
-
rt && /* @__PURE__ */ t("div", { className: "absolute left-0 top-8 z-20 w-[180px] rounded-md border border-slate-200 bg-white py-1 shadow-lg dark:border-border dark:bg-card", children:
|
|
904
|
+
rt && /* @__PURE__ */ t("div", { className: "absolute left-0 top-8 z-20 w-[180px] rounded-md border border-slate-200 bg-white py-1 shadow-lg dark:border-border dark:bg-card", children: Ke().map((e) => /* @__PURE__ */ t(
|
|
889
905
|
"button",
|
|
890
906
|
{
|
|
891
907
|
type: "button",
|
|
@@ -921,7 +937,7 @@ function Sa({
|
|
|
921
937
|
const l = V(a, m);
|
|
922
938
|
l && (l.type === "external" ? e.push(l.url) : l.type === "path" && typeof window < "u" && e.push(`${window.location.origin}${l.path}`));
|
|
923
939
|
}
|
|
924
|
-
e.length === 0 ? r == null || r("None of the selected notifications opens a page") : r == null || r(It(
|
|
940
|
+
e.length === 0 ? r == null || r("None of the selected notifications opens a page") : r == null || r(It(Kt(e)));
|
|
925
941
|
},
|
|
926
942
|
"data-notification-bulk": "tabs",
|
|
927
943
|
className: "inline-flex h-7 items-center gap-1 rounded-md border border-slate-200 bg-background px-2 text-[11.5px] font-medium hover:bg-slate-50 dark:border-border",
|
|
@@ -936,7 +952,7 @@ function Sa({
|
|
|
936
952
|
{
|
|
937
953
|
type: "button",
|
|
938
954
|
onClick: () => {
|
|
939
|
-
Y(/* @__PURE__ */ new Set()),
|
|
955
|
+
Y(/* @__PURE__ */ new Set()), j(!1);
|
|
940
956
|
},
|
|
941
957
|
className: "ml-auto text-[11.5px] text-slate-500 underline decoration-dotted underline-offset-2",
|
|
942
958
|
children: "Clear selection"
|
|
@@ -1034,51 +1050,34 @@ function Sa({
|
|
|
1034
1050
|
/* @__PURE__ */ t(Le, { className: "h-10 w-10 text-slate-200 dark:text-slate-700" }),
|
|
1035
1051
|
/* @__PURE__ */ t("p", { className: "mt-3 text-[14px] font-medium text-slate-500", children: "You're all caught up" }),
|
|
1036
1052
|
/* @__PURE__ */ t("p", { className: "mt-1 text-[12px] text-slate-400", children: i === "inbox" ? "No unread notifications." : "No notifications here." })
|
|
1037
|
-
] }) : /* @__PURE__ */
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
"data-notification-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
/* @__PURE__ */ t(At, { className: "h-3.5 w-3.5", "aria-hidden": !0 }),
|
|
1048
|
-
ne,
|
|
1049
|
-
" new"
|
|
1050
|
-
]
|
|
1051
|
-
}
|
|
1052
|
-
) }),
|
|
1053
|
-
/* @__PURE__ */ n(
|
|
1054
|
-
"div",
|
|
1055
|
-
{
|
|
1056
|
-
ref: pt,
|
|
1057
|
-
className: "mx-8 my-6 divide-y divide-slate-100 overflow-hidden rounded-lg border border-slate-200 bg-white dark:divide-border dark:border-border dark:bg-card",
|
|
1058
|
-
children: [
|
|
1059
|
-
z.length > 0 && /* @__PURE__ */ n("div", { "data-notification-pinned": !0, children: [
|
|
1060
|
-
/* @__PURE__ */ n("div", { className: "bg-amber-50 px-4 py-1 text-[10.5px] font-semibold uppercase tracking-wide text-amber-700 dark:bg-amber-400/10 dark:text-amber-300", children: [
|
|
1061
|
-
"Needs your acknowledgement · ",
|
|
1062
|
-
z.length
|
|
1063
|
-
] }),
|
|
1064
|
-
z.map((e) => /* @__PURE__ */ t(pe, { children: se(e) }, `pin:${e.id}`))
|
|
1053
|
+
] }) : /* @__PURE__ */ t(qe, { children: /* @__PURE__ */ n(
|
|
1054
|
+
"div",
|
|
1055
|
+
{
|
|
1056
|
+
ref: pt,
|
|
1057
|
+
className: "mx-8 my-6 divide-y divide-slate-100 overflow-hidden rounded-lg border border-slate-200 bg-white dark:divide-border dark:border-border dark:bg-card",
|
|
1058
|
+
children: [
|
|
1059
|
+
z.length > 0 && /* @__PURE__ */ n("div", { "data-notification-pinned": !0, children: [
|
|
1060
|
+
/* @__PURE__ */ n("div", { className: "bg-amber-50 px-4 py-1 text-[10.5px] font-semibold uppercase tracking-wide text-amber-700 dark:bg-amber-400/10 dark:text-amber-300", children: [
|
|
1061
|
+
"Needs your acknowledgement · ",
|
|
1062
|
+
z.length
|
|
1065
1063
|
] }),
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
return
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
]
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1064
|
+
z.map((e) => /* @__PURE__ */ t(pe, { children: se(e) }, `pin:${e.id}`))
|
|
1065
|
+
] }),
|
|
1066
|
+
mt.map(yt),
|
|
1067
|
+
_e.map((e, a) => {
|
|
1068
|
+
const l = (_) => {
|
|
1069
|
+
if (!_) return "Older";
|
|
1070
|
+
const o = new Date(_), f = /* @__PURE__ */ new Date(), g = new Date(f.getFullYear(), f.getMonth(), f.getDate());
|
|
1071
|
+
return o >= g ? "Today" : o >= new Date(g.getTime() - 864e5) ? "Yesterday" : o >= new Date(g.getTime() - 5184e5) ? "This week" : "Older";
|
|
1072
|
+
}, s = l(e.created_at), x = a > 0 ? l(_e[a - 1].created_at) : null;
|
|
1073
|
+
return /* @__PURE__ */ n(pe, { children: [
|
|
1074
|
+
s !== x ? /* @__PURE__ */ t("div", { className: "bg-slate-50/80 px-4 py-1 text-[10.5px] font-semibold uppercase tracking-wide text-slate-400 dark:bg-muted/40", children: s }) : null,
|
|
1075
|
+
/* @__PURE__ */ t("div", { "data-live-key": Be(e), children: se(e) })
|
|
1076
|
+
] }, e.id);
|
|
1077
|
+
})
|
|
1078
|
+
]
|
|
1079
|
+
}
|
|
1080
|
+
) }),
|
|
1082
1081
|
i !== "sent" && $ > xe && /* @__PURE__ */ n("div", { className: "mx-8 mb-6 flex items-center justify-between", children: [
|
|
1083
1082
|
/* @__PURE__ */ n("p", { className: "text-[12px] text-slate-400", children: [
|
|
1084
1083
|
"Page ",
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { jsxs as l, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useQuery as v } from "@tanstack/react-query";
|
|
3
|
+
import { X as w, Plus as N, ChevronsUpDown as g } from "lucide-react";
|
|
4
|
+
import { useState as k, useMemo as C } from "react";
|
|
5
|
+
import { useNivaroClient as L } from "../../context.js";
|
|
6
|
+
import { get as S } from "../../lib/commands.js";
|
|
7
|
+
import { Command as A, CommandInput as T, CommandList as _, CommandEmpty as P, CommandGroup as O, CommandItem as $ } from "../ui/command.js";
|
|
8
|
+
import { Popover as q, PopoverTrigger as F, PopoverContent as I } from "../ui/popover.js";
|
|
9
|
+
function b(o) {
|
|
10
|
+
let r = o;
|
|
11
|
+
if (typeof r == "string") {
|
|
12
|
+
const s = r.trim();
|
|
13
|
+
if (!s) return [];
|
|
14
|
+
try {
|
|
15
|
+
r = JSON.parse(s);
|
|
16
|
+
} catch {
|
|
17
|
+
r = s.split(",");
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return Array.isArray(r) ? [...new Set(r.map((s) => String(s ?? "").trim()).filter(Boolean))] : [];
|
|
21
|
+
}
|
|
22
|
+
function f({
|
|
23
|
+
label: o,
|
|
24
|
+
value: r,
|
|
25
|
+
options: s,
|
|
26
|
+
onChange: i,
|
|
27
|
+
addLabel: d,
|
|
28
|
+
findLabel: p,
|
|
29
|
+
emptyText: m,
|
|
30
|
+
noneText: h
|
|
31
|
+
}) {
|
|
32
|
+
const [x, c] = k(!1), u = C(() => new Map(s.map((a) => [a.value.toLowerCase(), a])), [s]), t = s.filter((a) => !r.some((n) => n.toLowerCase() === a.value.toLowerCase()));
|
|
33
|
+
return /* @__PURE__ */ l(
|
|
34
|
+
"fieldset",
|
|
35
|
+
{
|
|
36
|
+
className: "m-0 flex min-w-0 flex-wrap items-center gap-1.5 border-0 p-0",
|
|
37
|
+
"aria-label": o,
|
|
38
|
+
children: [
|
|
39
|
+
r.length === 0 && /* @__PURE__ */ e("span", { className: "text-[12px] text-slate-500 dark:text-slate-400", children: h }),
|
|
40
|
+
r.map((a) => {
|
|
41
|
+
const n = u.get(a.toLowerCase());
|
|
42
|
+
return /* @__PURE__ */ l(
|
|
43
|
+
"span",
|
|
44
|
+
{
|
|
45
|
+
className: "inline-flex h-6 items-center gap-1 rounded-md border border-slate-200 bg-slate-50 pl-2 pr-1 text-[12px] text-slate-700 dark:border-border dark:bg-muted dark:text-slate-200",
|
|
46
|
+
children: [
|
|
47
|
+
/* @__PURE__ */ e("span", { className: "max-w-[16rem] truncate", children: (n == null ? void 0 : n.label) ?? a }),
|
|
48
|
+
/* @__PURE__ */ e(
|
|
49
|
+
"button",
|
|
50
|
+
{
|
|
51
|
+
type: "button",
|
|
52
|
+
onClick: () => i(r.filter((y) => y !== a)),
|
|
53
|
+
"aria-label": `Remove ${(n == null ? void 0 : n.label) ?? a}`,
|
|
54
|
+
className: "rounded p-0.5 text-slate-400 hover:bg-slate-200 hover:text-slate-700 focus-visible:outline focus-visible:outline-2 focus-visible:outline-nvr-cyan dark:hover:bg-slate-700 dark:hover:text-white",
|
|
55
|
+
children: /* @__PURE__ */ e(w, { className: "h-3 w-3" })
|
|
56
|
+
}
|
|
57
|
+
)
|
|
58
|
+
]
|
|
59
|
+
},
|
|
60
|
+
a
|
|
61
|
+
);
|
|
62
|
+
}),
|
|
63
|
+
/* @__PURE__ */ l(q, { open: x, onOpenChange: c, children: [
|
|
64
|
+
/* @__PURE__ */ e(F, { asChild: !0, children: /* @__PURE__ */ l(
|
|
65
|
+
"button",
|
|
66
|
+
{
|
|
67
|
+
type: "button",
|
|
68
|
+
disabled: t.length === 0,
|
|
69
|
+
className: "inline-flex h-6 items-center gap-1 rounded-md border border-dashed border-slate-300 px-2 text-[12px] text-slate-600 hover:border-slate-400 hover:text-slate-900 disabled:cursor-not-allowed disabled:opacity-50 dark:border-border dark:text-slate-300 dark:hover:text-white",
|
|
70
|
+
children: [
|
|
71
|
+
/* @__PURE__ */ e(N, { className: "h-3 w-3" }),
|
|
72
|
+
" ",
|
|
73
|
+
d,
|
|
74
|
+
/* @__PURE__ */ e(g, { className: "h-3 w-3 opacity-60" })
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
) }),
|
|
78
|
+
/* @__PURE__ */ e(I, { align: "start", className: "w-64 p-0", children: /* @__PURE__ */ l(A, { children: [
|
|
79
|
+
/* @__PURE__ */ e(T, { placeholder: p }),
|
|
80
|
+
/* @__PURE__ */ l(_, { children: [
|
|
81
|
+
/* @__PURE__ */ e(P, { children: m }),
|
|
82
|
+
/* @__PURE__ */ e(O, { children: t.map((a) => /* @__PURE__ */ l(
|
|
83
|
+
$,
|
|
84
|
+
{
|
|
85
|
+
value: `${a.label} ${a.hint ?? ""} ${a.value}`,
|
|
86
|
+
onSelect: () => {
|
|
87
|
+
i([...r, a.value]), c(!1);
|
|
88
|
+
},
|
|
89
|
+
children: [
|
|
90
|
+
/* @__PURE__ */ e("span", { className: "truncate", children: a.label }),
|
|
91
|
+
a.hint && /* @__PURE__ */ e("span", { className: "ml-auto truncate font-mono text-[10.5px] text-slate-500 dark:text-slate-400", children: a.hint })
|
|
92
|
+
]
|
|
93
|
+
},
|
|
94
|
+
a.value
|
|
95
|
+
)) })
|
|
96
|
+
] })
|
|
97
|
+
] }) })
|
|
98
|
+
] })
|
|
99
|
+
]
|
|
100
|
+
}
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
function J({
|
|
104
|
+
collection: o,
|
|
105
|
+
roles: r,
|
|
106
|
+
allowed: s,
|
|
107
|
+
states: i,
|
|
108
|
+
onSave: d
|
|
109
|
+
}) {
|
|
110
|
+
const p = L(), m = b(r), h = b(s), { data: x } = v({
|
|
111
|
+
queryKey: ["pipeline-start-state-roles"],
|
|
112
|
+
queryFn: () => p.request(
|
|
113
|
+
S("/roles")
|
|
114
|
+
).then((t) => t.data).catch(() => []),
|
|
115
|
+
staleTime: 5 * 6e4
|
|
116
|
+
}), c = (x ?? []).filter((t) => !t.admin_access).map((t) => ({ value: String(t.id), label: t.name })), u = i.filter((t) => !t.is_initial).map((t) => ({ value: t.key, label: t.label, hint: t.key }));
|
|
117
|
+
return /* @__PURE__ */ l("div", { className: "mt-3 space-y-2.5 border-t border-slate-100 pt-3 dark:border-border", children: [
|
|
118
|
+
/* @__PURE__ */ l("div", { children: [
|
|
119
|
+
/* @__PURE__ */ e("div", { className: "text-[12px] font-medium text-slate-700 dark:text-slate-200", children: "Who may create records in a later step" }),
|
|
120
|
+
/* @__PURE__ */ l("p", { className: "mt-0.5 max-w-[72ch] text-[11.5px] text-slate-500 dark:text-slate-400", children: [
|
|
121
|
+
"An integration or person creating a ",
|
|
122
|
+
o,
|
|
123
|
+
" record can name the step it starts in (",
|
|
124
|
+
/* @__PURE__ */ e("code", { className: "font-mono", children: "start_state" }),
|
|
125
|
+
" in the API). Administrators always may. No transition runs, so its actions (partner pushes, emails set on the move) do not."
|
|
126
|
+
] }),
|
|
127
|
+
/* @__PURE__ */ e("div", { className: "mt-1.5", children: /* @__PURE__ */ e(
|
|
128
|
+
f,
|
|
129
|
+
{
|
|
130
|
+
label: "Roles that may create records in a later step",
|
|
131
|
+
value: m,
|
|
132
|
+
options: c,
|
|
133
|
+
onChange: (t) => d({ start_state_roles: t }),
|
|
134
|
+
addLabel: "Add a role",
|
|
135
|
+
findLabel: "Find a role",
|
|
136
|
+
emptyText: "No role matches.",
|
|
137
|
+
noneText: "Administrators only"
|
|
138
|
+
}
|
|
139
|
+
) })
|
|
140
|
+
] }),
|
|
141
|
+
m.length > 0 && /* @__PURE__ */ l("div", { children: [
|
|
142
|
+
/* @__PURE__ */ e("div", { className: "text-[12px] font-medium text-slate-700 dark:text-slate-200", children: "Which steps" }),
|
|
143
|
+
/* @__PURE__ */ e("p", { className: "mt-0.5 max-w-[72ch] text-[11.5px] text-slate-500 dark:text-slate-400", children: "The steps those roles may start a record in. Leave empty to allow any step." }),
|
|
144
|
+
/* @__PURE__ */ e("div", { className: "mt-1.5", children: /* @__PURE__ */ e(
|
|
145
|
+
f,
|
|
146
|
+
{
|
|
147
|
+
label: "Steps those roles may start a record in",
|
|
148
|
+
value: h,
|
|
149
|
+
options: u,
|
|
150
|
+
onChange: (t) => d({ start_state_allowed: t }),
|
|
151
|
+
addLabel: "Add a step",
|
|
152
|
+
findLabel: "Find a step",
|
|
153
|
+
emptyText: "No step matches.",
|
|
154
|
+
noneText: "Any step"
|
|
155
|
+
}
|
|
156
|
+
) })
|
|
157
|
+
] })
|
|
158
|
+
] });
|
|
159
|
+
}
|
|
160
|
+
export {
|
|
161
|
+
J as BindingStartStateSettings,
|
|
162
|
+
b as parseStartList
|
|
163
|
+
};
|