@nivaro/react 0.3.135 → 0.3.137
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/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/shared/components/ErrorNotice.js +67 -61
- package/dist/shared/components/chat/ChatPanel.js +86 -86
- package/dist/shared/components/item-edit/InlineTableField.js +2528 -2450
- package/dist/shared/components/panels/ExternalRequestsChip.js +126 -111
- package/dist/shared/components/panels/PipelineEventNotice.js +122 -0
- package/dist/shared/components/panels/PipelinePanel.js +1367 -1382
- package/dist/shared/components/panels/integrations-opener.js +43 -0
- package/dist/shared/components/panels/pipeline-notices.js +137 -0
- package/dist/shared/lib/send-status.js +39 -36
- package/package.json +1 -1
|
@@ -1,132 +1,147 @@
|
|
|
1
|
-
import { jsxs as d, jsx as
|
|
2
|
-
import { useQueryClient as
|
|
3
|
-
import { Satellite as
|
|
4
|
-
import { useState as
|
|
1
|
+
import { jsxs as d, jsx as r, Fragment as j } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as A, useMutation as B, useQuery as U } from "@tanstack/react-query";
|
|
3
|
+
import { Satellite as w, Unplug as V, RefreshCw as W, Plug as H } from "lucide-react";
|
|
4
|
+
import { useState as S, useEffect as C, useRef as I } from "react";
|
|
5
5
|
import { toast as b } from "sonner";
|
|
6
|
-
import { useNivaroClient as
|
|
7
|
-
import { post as
|
|
8
|
-
import { integrationChipSummary as
|
|
9
|
-
import { useLiveRefetchInterval as
|
|
10
|
-
import { sendStatusWords as
|
|
11
|
-
import { cn as
|
|
12
|
-
import { SubmissionRow as
|
|
13
|
-
import { useRecordObligations as
|
|
14
|
-
import { OutboundPreviewSection as
|
|
15
|
-
import { useRecordSendStatus as
|
|
16
|
-
import { Dialog as
|
|
17
|
-
import { RecordEventPathSheet as
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
6
|
+
import { useNivaroClient as E } from "../../context.js";
|
|
7
|
+
import { post as J, get as z } from "../../lib/commands.js";
|
|
8
|
+
import { integrationChipSummary as G, externalRequestsShown as X } from "../../lib/integration-chip.js";
|
|
9
|
+
import { useLiveRefetchInterval as Y } from "../../lib/live-queries.js";
|
|
10
|
+
import { sendStatusWords as Z } from "../../lib/send-status.js";
|
|
11
|
+
import { cn as q, formatRelative as ee } from "../../lib/utils.js";
|
|
12
|
+
import { SubmissionRow as te } from "../integrations/console/SubmissionRow.js";
|
|
13
|
+
import { useRecordObligations as $, IntegrationStatusLines as re } from "../integrations/IntegrationStatusLines.js";
|
|
14
|
+
import { OutboundPreviewSection as se } from "../integrations/RecordIntegrationPreview.js";
|
|
15
|
+
import { useRecordSendStatus as ne } from "../integrations/SendStatus.js";
|
|
16
|
+
import { Dialog as ae, DialogContent as ie, DialogHeader as oe, DialogTitle as de, DialogBody as le } from "../ui/dialog.js";
|
|
17
|
+
import { RecordEventPathSheet as ue } from "./IntegrationActivitySection.js";
|
|
18
|
+
import { useIntegrationsOpener as me } from "./integrations-opener.js";
|
|
19
|
+
function P(t, s, u, i = !0) {
|
|
20
|
+
const m = E();
|
|
21
|
+
return U({
|
|
22
|
+
queryKey: ["erp-submissions", t, String(s)],
|
|
22
23
|
queryFn: () => m.request(
|
|
23
|
-
|
|
24
|
-
).then((
|
|
25
|
-
enabled: i && !!
|
|
24
|
+
z(`/erp-submissions/${t}/${encodeURIComponent(s)}`)
|
|
25
|
+
).then((a) => a.data ?? []),
|
|
26
|
+
enabled: i && !!t && !!s,
|
|
26
27
|
staleTime: 15e3,
|
|
27
28
|
refetchInterval: u
|
|
28
29
|
});
|
|
29
30
|
}
|
|
30
|
-
const
|
|
31
|
-
function
|
|
31
|
+
const R = /* @__PURE__ */ new Map();
|
|
32
|
+
function Pe(t, s, u) {
|
|
32
33
|
var c;
|
|
33
|
-
const i = u && !!s, m =
|
|
34
|
+
const i = u && !!s, m = P(t, s ?? "", void 0, i), a = $(t, i ? s ?? "" : ""), g = X({
|
|
34
35
|
layoutOn: u,
|
|
35
36
|
// A viewer refused the record's integrations has nothing to see here.
|
|
36
|
-
partnerIntegration:
|
|
37
|
-
obligations:
|
|
37
|
+
partnerIntegration: a.isError ? !1 : a.partnerIntegration,
|
|
38
|
+
obligations: a.isError ? 0 : a.obligationCount,
|
|
38
39
|
submissions: m.isError ? 0 : ((c = m.data) == null ? void 0 : c.length) ?? null
|
|
39
40
|
});
|
|
40
|
-
return
|
|
41
|
-
g !== null && u &&
|
|
42
|
-
}, [g,
|
|
41
|
+
return C(() => {
|
|
42
|
+
g !== null && u && R.set(t, g);
|
|
43
|
+
}, [g, t, u]), i ? g ?? R.get(t) ?? !1 : !1;
|
|
43
44
|
}
|
|
44
|
-
function
|
|
45
|
-
collection:
|
|
45
|
+
function Qe({
|
|
46
|
+
collection: t,
|
|
46
47
|
itemId: s
|
|
47
48
|
}) {
|
|
48
|
-
const u =
|
|
49
|
-
|
|
49
|
+
const u = E(), i = A(), [m, a] = S(!1), [g, c] = S(null), [h, f] = S(null);
|
|
50
|
+
C(() => {
|
|
50
51
|
if (!m || h == null) return;
|
|
51
52
|
const e = document.querySelector(`[data-submission-id="${h}"]`);
|
|
52
53
|
e == null || e.scrollIntoView({ block: "center", behavior: "smooth" });
|
|
53
54
|
}, [m, h]);
|
|
54
|
-
const
|
|
55
|
-
|
|
55
|
+
const x = I(null);
|
|
56
|
+
me(
|
|
57
|
+
t,
|
|
58
|
+
String(s),
|
|
59
|
+
() => {
|
|
60
|
+
var e;
|
|
61
|
+
return (((e = x.current) == null ? void 0 : e.getClientRects().length) ?? 0) > 0;
|
|
62
|
+
},
|
|
63
|
+
(e) => {
|
|
64
|
+
f(e), a(!0);
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
const Q = Y(6e4), { data: D, isLoading: K } = P(t, s, Q), { data: L } = ne(t, s), y = B({
|
|
68
|
+
mutationFn: (e) => u.request(J(`/erp-submissions/${e}/retry`)),
|
|
56
69
|
onSuccess: (e) => {
|
|
57
|
-
var
|
|
58
|
-
const l = (
|
|
59
|
-
l && l !== "failed" ? b.success("Submission retried successfully") : b.error("Retry failed — expand the request for the error"), i.invalidateQueries({ queryKey: ["erp-submissions",
|
|
60
|
-
queryKey: ["integration-obligations", "record",
|
|
70
|
+
var N;
|
|
71
|
+
const l = (N = e == null ? void 0 : e.data) == null ? void 0 : N.status;
|
|
72
|
+
l && l !== "failed" ? b.success("Submission retried successfully") : b.error("Retry failed — expand the request for the error"), i.invalidateQueries({ queryKey: ["erp-submissions", t, String(s)] }), i.invalidateQueries({ queryKey: ["erp-submission-attempts"] }), i.invalidateQueries({
|
|
73
|
+
queryKey: ["integration-obligations", "record", t, String(s)]
|
|
61
74
|
});
|
|
62
75
|
},
|
|
63
76
|
onError: () => b.error("Retry failed")
|
|
64
77
|
}), {
|
|
65
|
-
lines:
|
|
66
|
-
remediationEnabled:
|
|
67
|
-
isLoading:
|
|
68
|
-
} =
|
|
69
|
-
if (
|
|
78
|
+
lines: k,
|
|
79
|
+
remediationEnabled: F,
|
|
80
|
+
isLoading: _
|
|
81
|
+
} = $(t, s), p = D ?? [];
|
|
82
|
+
if (K || _)
|
|
70
83
|
return /* @__PURE__ */ d(
|
|
71
84
|
"span",
|
|
72
85
|
{
|
|
73
86
|
className: "flex shrink-0 items-center gap-1.5 self-center rounded-md border border-slate-200 px-2 py-1 text-[11px] text-slate-400 dark:border-border",
|
|
74
87
|
"data-nvr-external-requests": "loading",
|
|
75
88
|
children: [
|
|
76
|
-
/* @__PURE__ */
|
|
77
|
-
/* @__PURE__ */
|
|
89
|
+
/* @__PURE__ */ r(w, { className: "h-3.5 w-3.5 opacity-60" }),
|
|
90
|
+
/* @__PURE__ */ r("span", { className: "h-2.5 w-16 animate-pulse rounded bg-[hsl(var(--nvr-skeleton))]" })
|
|
78
91
|
]
|
|
79
92
|
}
|
|
80
93
|
);
|
|
81
|
-
const
|
|
82
|
-
(
|
|
83
|
-
),
|
|
84
|
-
|
|
94
|
+
const O = new Set(
|
|
95
|
+
(L ?? []).filter((e) => !!Z(e).retry_at).map((e) => e.api)
|
|
96
|
+
), n = G(
|
|
97
|
+
k,
|
|
85
98
|
p,
|
|
86
|
-
(e) => e ?
|
|
87
|
-
|
|
88
|
-
),
|
|
99
|
+
(e) => e ? ee(e) : "",
|
|
100
|
+
O
|
|
101
|
+
), v = /* @__PURE__ */ new Map();
|
|
89
102
|
for (const e of p) {
|
|
90
103
|
const l = (e.external_api_name ?? (e.external_api != null ? `#${e.external_api}` : "External")).toLowerCase();
|
|
91
|
-
|
|
104
|
+
v.has(l) || v.set(l, { id: e.id, status: e.status });
|
|
92
105
|
}
|
|
93
|
-
const T = p.length === 0 &&
|
|
106
|
+
const T = p.length === 0 && n.partners.length === 0, M = {
|
|
94
107
|
ok: "bg-emerald-500",
|
|
95
108
|
attention: "bg-red-500",
|
|
96
109
|
retrying: "bg-amber-500",
|
|
97
110
|
pending: "bg-sky-500",
|
|
98
111
|
neutral: "bg-slate-400 dark:bg-slate-500"
|
|
99
|
-
}, o =
|
|
100
|
-
return /* @__PURE__ */ d(
|
|
112
|
+
}, o = n.attention;
|
|
113
|
+
return /* @__PURE__ */ d(j, { children: [
|
|
101
114
|
T ? /* @__PURE__ */ d(
|
|
102
115
|
"button",
|
|
103
116
|
{
|
|
117
|
+
ref: x,
|
|
104
118
|
type: "button",
|
|
105
|
-
onClick: () =>
|
|
119
|
+
onClick: () => a(!0),
|
|
106
120
|
className: "flex shrink-0 items-center gap-1.5 self-center rounded-md border border-dashed border-slate-200 px-2 py-1 text-[11px] text-slate-500 hover:bg-slate-50 dark:border-border dark:text-slate-400 dark:hover:bg-white/5",
|
|
107
121
|
"data-nvr-external-requests": "none",
|
|
108
122
|
"data-tip": "Nothing from this record has been sent to an outside system yet. Click to see what the first push would carry.",
|
|
109
123
|
children: [
|
|
110
|
-
/* @__PURE__ */
|
|
124
|
+
/* @__PURE__ */ r(w, { className: "h-3.5 w-3.5 opacity-60" }),
|
|
111
125
|
"No external requests"
|
|
112
126
|
]
|
|
113
127
|
}
|
|
114
128
|
) : /* @__PURE__ */ d(
|
|
115
129
|
"button",
|
|
116
130
|
{
|
|
131
|
+
ref: x,
|
|
117
132
|
type: "button",
|
|
118
|
-
onClick: () =>
|
|
133
|
+
onClick: () => a(!0),
|
|
119
134
|
"data-nvr-external-requests": !0,
|
|
120
|
-
"data-integrations-ok":
|
|
135
|
+
"data-integrations-ok": n.ok,
|
|
121
136
|
"data-integrations-attention": o,
|
|
122
|
-
className:
|
|
137
|
+
className: q(
|
|
123
138
|
"flex shrink-0 items-center gap-1.5 self-center rounded-md border px-2 py-1 text-[11px] font-medium transition-colors",
|
|
124
|
-
o > 0 ? "border-red-200 text-slate-700 hover:bg-red-50/60 dark:border-red-500/40 dark:text-slate-200 dark:hover:bg-red-500/10" :
|
|
139
|
+
o > 0 ? "border-red-200 text-slate-700 hover:bg-red-50/60 dark:border-red-500/40 dark:text-slate-200 dark:hover:bg-red-500/10" : n.retrying > 0 ? "border-amber-200 text-slate-700 hover:bg-amber-50/60 dark:border-amber-500/40 dark:text-slate-200 dark:hover:bg-amber-500/10" : "border-slate-200 text-slate-600 hover:bg-slate-50 dark:border-border dark:text-slate-300 dark:hover:bg-white/5"
|
|
125
140
|
),
|
|
126
|
-
title: o > 0 ? `${o} integration ${o === 1 ? "issue needs" : "issues need"} attention — click for details` :
|
|
141
|
+
title: o > 0 ? `${o} integration ${o === 1 ? "issue needs" : "issues need"} attention — click for details` : n.retrying > 0 ? "A send could not get through and will be tried again by itself — click for details" : "Integrations for this record — partner status and every request sent",
|
|
127
142
|
children: [
|
|
128
|
-
o > 0 ? /* @__PURE__ */
|
|
129
|
-
|
|
143
|
+
o > 0 ? /* @__PURE__ */ r(V, { "aria-hidden": !0, className: "h-3.5 w-3.5 text-red-500" }) : n.retrying > 0 ? /* @__PURE__ */ r(W, { "aria-hidden": !0, className: "h-3.5 w-3.5 text-amber-500" }) : /* @__PURE__ */ r(H, { "aria-hidden": !0, className: "h-3.5 w-3.5 text-slate-500 dark:text-slate-400" }),
|
|
144
|
+
n.partners.length <= 3 ? n.partners.map((e) => /* @__PURE__ */ d(
|
|
130
145
|
"span",
|
|
131
146
|
{
|
|
132
147
|
className: "inline-flex items-center gap-1",
|
|
@@ -134,29 +149,29 @@ function Ce({
|
|
|
134
149
|
"data-integration-status": e.status,
|
|
135
150
|
"data-tip": e.tip,
|
|
136
151
|
children: [
|
|
137
|
-
/* @__PURE__ */
|
|
152
|
+
/* @__PURE__ */ r("span", { className: q("h-1.5 w-1.5 rounded-full", M[e.status]) }),
|
|
138
153
|
e.name
|
|
139
154
|
]
|
|
140
155
|
},
|
|
141
156
|
e.name
|
|
142
|
-
)) : /* @__PURE__ */
|
|
143
|
-
|
|
157
|
+
)) : /* @__PURE__ */ r("span", { children: "Integrations" }),
|
|
158
|
+
n.partners.length > 3 && n.ok > 0 && /* @__PURE__ */ r(
|
|
144
159
|
"span",
|
|
145
160
|
{
|
|
146
161
|
"data-integrations-badge": "ok",
|
|
147
162
|
className: "rounded bg-emerald-50 px-1 text-[10.5px] font-semibold text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-400",
|
|
148
|
-
children:
|
|
163
|
+
children: n.ok
|
|
149
164
|
}
|
|
150
165
|
),
|
|
151
|
-
|
|
166
|
+
n.partners.length > 3 && n.pending > 0 && /* @__PURE__ */ r(
|
|
152
167
|
"span",
|
|
153
168
|
{
|
|
154
169
|
"data-integrations-badge": "pending",
|
|
155
170
|
className: "rounded bg-sky-50 px-1 text-[10.5px] font-semibold text-sky-700 dark:bg-sky-500/10 dark:text-sky-400",
|
|
156
|
-
children:
|
|
171
|
+
children: n.pending
|
|
157
172
|
}
|
|
158
173
|
),
|
|
159
|
-
|
|
174
|
+
n.partners.length > 3 && o > 0 && /* @__PURE__ */ r(
|
|
160
175
|
"span",
|
|
161
176
|
{
|
|
162
177
|
"data-integrations-badge": "attention",
|
|
@@ -167,14 +182,14 @@ function Ce({
|
|
|
167
182
|
]
|
|
168
183
|
}
|
|
169
184
|
),
|
|
170
|
-
m && /* @__PURE__ */
|
|
171
|
-
/* @__PURE__ */
|
|
172
|
-
/* @__PURE__ */
|
|
185
|
+
m && /* @__PURE__ */ r(ae, { open: !0, onOpenChange: (e) => !e && a(!1), children: /* @__PURE__ */ d(ie, { className: "p-5", style: { width: "75%", maxWidth: "75%" }, children: [
|
|
186
|
+
/* @__PURE__ */ r(oe, { children: /* @__PURE__ */ d(de, { className: "flex items-center gap-2 text-[15px]", children: [
|
|
187
|
+
/* @__PURE__ */ r(w, { className: "h-4 w-4 text-nvr-cyan" }),
|
|
173
188
|
"Integrations",
|
|
174
189
|
/* @__PURE__ */ d("span", { className: "text-[12px] font-normal text-slate-400", children: [
|
|
175
|
-
|
|
190
|
+
n.partners.length,
|
|
176
191
|
" partner",
|
|
177
|
-
|
|
192
|
+
n.partners.length !== 1 ? "s" : "",
|
|
178
193
|
" ·",
|
|
179
194
|
" ",
|
|
180
195
|
p.length,
|
|
@@ -189,72 +204,72 @@ function Ce({
|
|
|
189
204
|
] })
|
|
190
205
|
] })
|
|
191
206
|
] }) }),
|
|
192
|
-
/* @__PURE__ */ d(
|
|
193
|
-
/* @__PURE__ */
|
|
194
|
-
|
|
207
|
+
/* @__PURE__ */ d(le, { className: "max-h-[65vh] space-y-2 overflow-y-auto", children: [
|
|
208
|
+
/* @__PURE__ */ r(
|
|
209
|
+
se,
|
|
195
210
|
{
|
|
196
|
-
collection:
|
|
211
|
+
collection: t,
|
|
197
212
|
itemId: String(s),
|
|
198
|
-
onShowRequest: (e) =>
|
|
199
|
-
onJump: () =>
|
|
213
|
+
onShowRequest: (e) => f(e),
|
|
214
|
+
onJump: () => a(!1)
|
|
200
215
|
}
|
|
201
216
|
),
|
|
202
|
-
|
|
203
|
-
/* @__PURE__ */
|
|
204
|
-
/* @__PURE__ */
|
|
205
|
-
|
|
217
|
+
k.length > 0 && /* @__PURE__ */ d("div", { className: "space-y-1.5 pb-2", "data-integrations-partner-status": !0, children: [
|
|
218
|
+
/* @__PURE__ */ r("p", { className: "text-[10.5px] font-semibold uppercase tracking-wide text-slate-400", children: "Partner status" }),
|
|
219
|
+
/* @__PURE__ */ r(
|
|
220
|
+
re,
|
|
206
221
|
{
|
|
207
|
-
collection:
|
|
222
|
+
collection: t,
|
|
208
223
|
itemId: s,
|
|
209
|
-
lines:
|
|
210
|
-
remediationEnabled:
|
|
224
|
+
lines: k,
|
|
225
|
+
remediationEnabled: F,
|
|
211
226
|
actions: {
|
|
212
|
-
newestSubmissionByApi:
|
|
213
|
-
onRetry: (e) =>
|
|
214
|
-
onView: (e) =>
|
|
227
|
+
newestSubmissionByApi: v,
|
|
228
|
+
onRetry: (e) => y.mutate(e),
|
|
229
|
+
onView: (e) => f(e),
|
|
215
230
|
onCheck: () => {
|
|
216
231
|
i.invalidateQueries({
|
|
217
232
|
queryKey: [
|
|
218
233
|
"integration-obligations",
|
|
219
234
|
"record",
|
|
220
|
-
|
|
235
|
+
t,
|
|
221
236
|
String(s)
|
|
222
237
|
]
|
|
223
238
|
}), i.invalidateQueries({
|
|
224
|
-
queryKey: ["erp-submissions",
|
|
239
|
+
queryKey: ["erp-submissions", t, String(s)]
|
|
225
240
|
}), b.message("Checking with the partner status…");
|
|
226
241
|
},
|
|
227
242
|
// The pipeline panel takes over (save, requirements
|
|
228
243
|
// dialog, run) — this dialog gets out of its way.
|
|
229
|
-
onRanTransition: () =>
|
|
244
|
+
onRanTransition: () => a(!1)
|
|
230
245
|
}
|
|
231
246
|
}
|
|
232
247
|
)
|
|
233
248
|
] }),
|
|
234
|
-
p.length > 0 && /* @__PURE__ */
|
|
235
|
-
p.length === 0 && /* @__PURE__ */
|
|
236
|
-
p.map((e) => /* @__PURE__ */
|
|
237
|
-
|
|
249
|
+
p.length > 0 && /* @__PURE__ */ r("p", { className: "pt-1 text-[10.5px] font-semibold uppercase tracking-wide text-slate-400", children: "Requests sent" }),
|
|
250
|
+
p.length === 0 && /* @__PURE__ */ r("p", { className: "text-[12px] text-slate-500 dark:text-muted-foreground", children: "No request has been sent from this record yet." }),
|
|
251
|
+
p.map((e) => /* @__PURE__ */ r(
|
|
252
|
+
te,
|
|
238
253
|
{
|
|
239
254
|
sub: e,
|
|
240
255
|
initialOpen: h === e.id,
|
|
241
|
-
onRetry: (l) =>
|
|
242
|
-
retrying:
|
|
256
|
+
onRetry: (l) => y.mutate(l),
|
|
257
|
+
retrying: y.isPending,
|
|
243
258
|
onShowPath: (l) => {
|
|
244
|
-
|
|
259
|
+
a(!1), c(l);
|
|
245
260
|
}
|
|
246
261
|
},
|
|
247
262
|
`${e.id}:${h === e.id ? "focus" : ""}`
|
|
248
263
|
))
|
|
249
264
|
] })
|
|
250
265
|
] }) }),
|
|
251
|
-
/* @__PURE__ */
|
|
252
|
-
|
|
266
|
+
/* @__PURE__ */ r(
|
|
267
|
+
ue,
|
|
253
268
|
{
|
|
254
269
|
target: g != null ? {
|
|
255
270
|
source: "core:outbound",
|
|
256
271
|
id: String(g),
|
|
257
|
-
record: { collection:
|
|
272
|
+
record: { collection: t, item: String(s) }
|
|
258
273
|
} : null,
|
|
259
274
|
onClose: () => c(null)
|
|
260
275
|
}
|
|
@@ -262,6 +277,6 @@ function Ce({
|
|
|
262
277
|
] });
|
|
263
278
|
}
|
|
264
279
|
export {
|
|
265
|
-
|
|
266
|
-
|
|
280
|
+
Qe as ExternalRequestsChip,
|
|
281
|
+
Pe as useExternalRequestsShown
|
|
267
282
|
};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { jsxs as s, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { AlertTriangle as C, Plug as y } from "lucide-react";
|
|
3
|
+
import { useContext as B, useMemo as E } from "react";
|
|
4
|
+
import { useItemEditAuth as $ } from "../../context.js";
|
|
5
|
+
import { cn as c } from "../../lib/utils.js";
|
|
6
|
+
import { ErrorDetails as j } from "../ErrorNotice.js";
|
|
7
|
+
import { useOverflowTip as A } from "../TipLayer.js";
|
|
8
|
+
import { Button as x } from "../ui/button.js";
|
|
9
|
+
import { MoveProblemWordsContext as P, problemReason as T, startedBy as z } from "./BackgroundMove.js";
|
|
10
|
+
import { pipelineEventWords as H } from "./pipeline-notices.js";
|
|
11
|
+
function K({
|
|
12
|
+
event: t,
|
|
13
|
+
onRetry: l,
|
|
14
|
+
retryDisabled: b,
|
|
15
|
+
onOpenIntegrations: o,
|
|
16
|
+
canMoveByHand: u,
|
|
17
|
+
className: h
|
|
18
|
+
}) {
|
|
19
|
+
var n, m;
|
|
20
|
+
const { userId: f } = $(), i = B(P), w = E(() => {
|
|
21
|
+
var p;
|
|
22
|
+
const r = t.problem, d = r ? T(r) : "";
|
|
23
|
+
return d && ((p = i == null ? void 0 : i(d)) == null ? void 0 : p.trim()) || null;
|
|
24
|
+
}, [t.problem, i]), e = H(t, {
|
|
25
|
+
startedBy: t.problem ? z(t.problem, f) : null,
|
|
26
|
+
hostWords: w,
|
|
27
|
+
canRetry: !!l,
|
|
28
|
+
canOpenIntegrations: !!o,
|
|
29
|
+
canMoveByHand: u
|
|
30
|
+
}), g = A(e.reason), k = {
|
|
31
|
+
title: `${e.label} ${e.headline}`,
|
|
32
|
+
status: e.status ?? void 0,
|
|
33
|
+
code: e.errorClass ? e.errorClass.toUpperCase() : void 0,
|
|
34
|
+
technical: [e.raw, ...e.ids.map((r) => `${r.label}: ${r.value}`)].filter(Boolean).join(`
|
|
35
|
+
`)
|
|
36
|
+
}, N = [...e.raw ? [{ label: "Stored answer", value: e.raw }] : [], ...e.ids], v = !!l || !!o;
|
|
37
|
+
return /* @__PURE__ */ s(
|
|
38
|
+
"div",
|
|
39
|
+
{
|
|
40
|
+
role: "note",
|
|
41
|
+
"data-pipeline-event": "",
|
|
42
|
+
"data-move-problem": (n = t.problem) == null ? void 0 : n.result,
|
|
43
|
+
"data-pipeline-auto-held": t.held ? "" : void 0,
|
|
44
|
+
"data-send-spoken": (m = t.send) == null ? void 0 : m.id,
|
|
45
|
+
className: c(
|
|
46
|
+
"flex items-start gap-2.5 border-t border-amber-200/80 bg-amber-50/70 px-4 py-2.5 dark:border-amber-500/20 dark:bg-amber-500/[0.06]",
|
|
47
|
+
h
|
|
48
|
+
),
|
|
49
|
+
children: [
|
|
50
|
+
/* @__PURE__ */ a(
|
|
51
|
+
C,
|
|
52
|
+
{
|
|
53
|
+
"aria-hidden": !0,
|
|
54
|
+
className: "mt-[3px] h-3.5 w-3.5 shrink-0 text-amber-600 dark:text-amber-400"
|
|
55
|
+
}
|
|
56
|
+
),
|
|
57
|
+
/* @__PURE__ */ s("div", { className: "min-w-0 flex-1", children: [
|
|
58
|
+
/* @__PURE__ */ s("p", { className: "break-words text-[13px] leading-snug text-slate-800 dark:text-slate-100", children: [
|
|
59
|
+
/* @__PURE__ */ a("span", { className: "font-medium", children: e.label }),
|
|
60
|
+
" ",
|
|
61
|
+
e.headline
|
|
62
|
+
] }),
|
|
63
|
+
e.reason && /* @__PURE__ */ a(
|
|
64
|
+
"p",
|
|
65
|
+
{
|
|
66
|
+
ref: g,
|
|
67
|
+
"data-pipeline-event-reason": !0,
|
|
68
|
+
className: c(
|
|
69
|
+
"mt-0.5 break-words text-[12px] leading-snug text-slate-700 dark:text-slate-300",
|
|
70
|
+
e.reasonFromHost ? "whitespace-pre-line" : "line-clamp-3"
|
|
71
|
+
),
|
|
72
|
+
children: e.reason
|
|
73
|
+
}
|
|
74
|
+
),
|
|
75
|
+
e.next && /* @__PURE__ */ a(
|
|
76
|
+
"p",
|
|
77
|
+
{
|
|
78
|
+
"data-pipeline-event-next": !0,
|
|
79
|
+
className: "mt-1 break-words text-[12px] leading-snug text-amber-900 dark:text-amber-200",
|
|
80
|
+
children: e.next
|
|
81
|
+
}
|
|
82
|
+
),
|
|
83
|
+
v && /* @__PURE__ */ s("div", { className: "mt-2 flex flex-wrap items-center gap-1.5", children: [
|
|
84
|
+
l && /* @__PURE__ */ a(
|
|
85
|
+
x,
|
|
86
|
+
{
|
|
87
|
+
type: "button",
|
|
88
|
+
size: "sm",
|
|
89
|
+
variant: "outline",
|
|
90
|
+
className: "h-7 text-[12px]",
|
|
91
|
+
disabled: b,
|
|
92
|
+
onClick: l,
|
|
93
|
+
"data-move-problem-retry": !0,
|
|
94
|
+
children: "Try again"
|
|
95
|
+
}
|
|
96
|
+
),
|
|
97
|
+
o && /* @__PURE__ */ s(
|
|
98
|
+
x,
|
|
99
|
+
{
|
|
100
|
+
type: "button",
|
|
101
|
+
size: "sm",
|
|
102
|
+
variant: "outline",
|
|
103
|
+
className: "h-7 gap-1.5 text-[12px]",
|
|
104
|
+
onClick: o,
|
|
105
|
+
"data-pipeline-event-integrations": !0,
|
|
106
|
+
children: [
|
|
107
|
+
/* @__PURE__ */ a(y, { "aria-hidden": !0, className: "h-3 w-3" }),
|
|
108
|
+
"Open Integrations"
|
|
109
|
+
]
|
|
110
|
+
}
|
|
111
|
+
)
|
|
112
|
+
] }),
|
|
113
|
+
e.meta && /* @__PURE__ */ a("p", { className: "mt-1.5 text-[11.5px] text-amber-800/80 dark:text-amber-300/80", children: e.meta }),
|
|
114
|
+
/* @__PURE__ */ a(j, { description: k, action: e.label, rows: N, className: "mt-1" })
|
|
115
|
+
] })
|
|
116
|
+
]
|
|
117
|
+
}
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
export {
|
|
121
|
+
K as PipelineEventNotice
|
|
122
|
+
};
|