@shivnandan/connector-react 0.0.0-stage → 1.0.0
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/README.md +106 -2
- package/dist/index.d.mts +53 -0
- package/dist/index.d.ts +53 -0
- package/dist/index.js +491 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +463 -0
- package/dist/index.mjs.map +1 -0
- package/dist/tracepulse.min.js +359 -0
- package/dist/tracepulse.min.js.map +1 -0
- package/dist/tracepulse.mjs +359 -0
- package/dist/tracepulse.mjs.map +1 -0
- package/package.json +63 -4
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,463 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/TracePulseProvider.tsx
|
|
4
|
+
import { useState, useRef, useEffect, useCallback } from "react";
|
|
5
|
+
|
|
6
|
+
// src/TracePulseContext.tsx
|
|
7
|
+
import { createContext } from "react";
|
|
8
|
+
var TracePulseContext = createContext(null);
|
|
9
|
+
|
|
10
|
+
// src/TracePulseProvider.tsx
|
|
11
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
function TracePulseProvider({
|
|
13
|
+
apiKey,
|
|
14
|
+
projectId = "default-project",
|
|
15
|
+
endpoint = "http://127.0.0.1:8000",
|
|
16
|
+
targetTransactionId,
|
|
17
|
+
position = "bottom-right",
|
|
18
|
+
theme = "light",
|
|
19
|
+
floatingButton = true,
|
|
20
|
+
children
|
|
21
|
+
}) {
|
|
22
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
23
|
+
const [activeTransactionId, setActiveTransactionId] = useState(
|
|
24
|
+
targetTransactionId || null
|
|
25
|
+
);
|
|
26
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
27
|
+
const [input, setInput] = useState("");
|
|
28
|
+
const [messages, setMessages] = useState([
|
|
29
|
+
{
|
|
30
|
+
id: "welcome",
|
|
31
|
+
sender: "copilot",
|
|
32
|
+
text: "\u{1F44B} Hi! I am **TracePulse AI Copilot**. Ask me anything about any transaction, why a payment failed, or mention a transaction ID to see deep-dive diagnostics.",
|
|
33
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
34
|
+
}
|
|
35
|
+
]);
|
|
36
|
+
const messagesEndRef = useRef(null);
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
if (targetTransactionId) {
|
|
39
|
+
setActiveTransactionId(targetTransactionId);
|
|
40
|
+
}
|
|
41
|
+
}, [targetTransactionId]);
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (isOpen) {
|
|
44
|
+
messagesEndRef.current?.scrollIntoView({ behavior: "smooth" });
|
|
45
|
+
}
|
|
46
|
+
}, [messages, isOpen]);
|
|
47
|
+
const openCopilot = useCallback((transactionId) => {
|
|
48
|
+
if (transactionId) {
|
|
49
|
+
setActiveTransactionId(transactionId);
|
|
50
|
+
}
|
|
51
|
+
setIsOpen(true);
|
|
52
|
+
}, []);
|
|
53
|
+
const closeCopilot = useCallback(() => {
|
|
54
|
+
setIsOpen(false);
|
|
55
|
+
}, []);
|
|
56
|
+
const toggleCopilot = useCallback(() => {
|
|
57
|
+
setIsOpen((prev) => !prev);
|
|
58
|
+
}, []);
|
|
59
|
+
const sendMessage = useCallback(
|
|
60
|
+
async (text, transactionId) => {
|
|
61
|
+
if (!text.trim() || isLoading) return "";
|
|
62
|
+
const effectiveTxnId = transactionId || (() => {
|
|
63
|
+
const match = text.match(/\b(?:45\d{13}|\d{10,20})\b/);
|
|
64
|
+
return match ? match[0] : activeTransactionId || void 0;
|
|
65
|
+
})();
|
|
66
|
+
const userMsg = {
|
|
67
|
+
id: `user-${Date.now()}`,
|
|
68
|
+
sender: "user",
|
|
69
|
+
text,
|
|
70
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
71
|
+
transactionId: effectiveTxnId
|
|
72
|
+
};
|
|
73
|
+
setMessages((prev) => [...prev, userMsg]);
|
|
74
|
+
setIsLoading(true);
|
|
75
|
+
try {
|
|
76
|
+
const cleanEndpoint = endpoint.replace(/\/+$/, "");
|
|
77
|
+
const res = await fetch(`${cleanEndpoint}/api/v1/widget/chat`, {
|
|
78
|
+
method: "POST",
|
|
79
|
+
headers: {
|
|
80
|
+
"Content-Type": "application/json",
|
|
81
|
+
"X-TracePulse-Key": apiKey,
|
|
82
|
+
"X-TracePulse-Project": projectId
|
|
83
|
+
},
|
|
84
|
+
body: JSON.stringify({
|
|
85
|
+
query: text,
|
|
86
|
+
transaction_id: effectiveTxnId,
|
|
87
|
+
app_context: projectId
|
|
88
|
+
})
|
|
89
|
+
});
|
|
90
|
+
if (!res.ok) {
|
|
91
|
+
throw new Error(`Server returned ${res.status}`);
|
|
92
|
+
}
|
|
93
|
+
const data = await res.json();
|
|
94
|
+
const reply = data.reply || data.answer || "No response received.";
|
|
95
|
+
const copilotMsg = {
|
|
96
|
+
id: `copilot-${Date.now()}`,
|
|
97
|
+
sender: "copilot",
|
|
98
|
+
text: reply,
|
|
99
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
100
|
+
transactionId: data.transactionId || effectiveTxnId
|
|
101
|
+
};
|
|
102
|
+
setMessages((prev) => [...prev, copilotMsg]);
|
|
103
|
+
return reply;
|
|
104
|
+
} catch (err) {
|
|
105
|
+
const errorMsg = {
|
|
106
|
+
id: `copilot-err-${Date.now()}`,
|
|
107
|
+
sender: "copilot",
|
|
108
|
+
text: `\u26A0\uFE0F **Failed to reach AI Copilot**: ${err.message || "Network error"}. Check backend connection at \`${endpoint}\`.`,
|
|
109
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
110
|
+
};
|
|
111
|
+
setMessages((prev) => [...prev, errorMsg]);
|
|
112
|
+
return errorMsg.text;
|
|
113
|
+
} finally {
|
|
114
|
+
setIsLoading(false);
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
[apiKey, projectId, endpoint, activeTransactionId, isLoading]
|
|
118
|
+
);
|
|
119
|
+
const contextValue = {
|
|
120
|
+
isOpen,
|
|
121
|
+
openCopilot,
|
|
122
|
+
closeCopilot,
|
|
123
|
+
toggleCopilot,
|
|
124
|
+
activeTransactionId,
|
|
125
|
+
setActiveTransactionId,
|
|
126
|
+
sendMessage,
|
|
127
|
+
messages,
|
|
128
|
+
isLoading,
|
|
129
|
+
endpoint,
|
|
130
|
+
apiKey
|
|
131
|
+
};
|
|
132
|
+
const quickPrompts = [
|
|
133
|
+
"Why did transaction 450000015526099 fail?",
|
|
134
|
+
"What happened in Loki logs for 450000015526099?",
|
|
135
|
+
"Check payment status for 450000015526099",
|
|
136
|
+
"Show Kafka consumer errors in Loki"
|
|
137
|
+
];
|
|
138
|
+
const handleFormSubmit = (e) => {
|
|
139
|
+
e.preventDefault();
|
|
140
|
+
if (!input.trim()) return;
|
|
141
|
+
const text = input;
|
|
142
|
+
setInput("");
|
|
143
|
+
sendMessage(text);
|
|
144
|
+
};
|
|
145
|
+
const isRight = position === "bottom-right";
|
|
146
|
+
return /* @__PURE__ */ jsxs(TracePulseContext.Provider, { value: contextValue, children: [
|
|
147
|
+
children,
|
|
148
|
+
floatingButton && /* @__PURE__ */ jsxs(
|
|
149
|
+
"div",
|
|
150
|
+
{
|
|
151
|
+
style: {
|
|
152
|
+
position: "fixed",
|
|
153
|
+
bottom: "24px",
|
|
154
|
+
right: isRight ? "24px" : "auto",
|
|
155
|
+
left: !isRight ? "24px" : "auto",
|
|
156
|
+
zIndex: 999999,
|
|
157
|
+
fontFamily: "system-ui, -apple-system, sans-serif"
|
|
158
|
+
},
|
|
159
|
+
children: [
|
|
160
|
+
!isOpen && /* @__PURE__ */ jsxs(
|
|
161
|
+
"button",
|
|
162
|
+
{
|
|
163
|
+
onClick: () => setIsOpen(true),
|
|
164
|
+
style: {
|
|
165
|
+
display: "flex",
|
|
166
|
+
alignItems: "center",
|
|
167
|
+
gap: "10px",
|
|
168
|
+
padding: "10px 18px",
|
|
169
|
+
borderRadius: "9999px",
|
|
170
|
+
backgroundColor: "#ffffff",
|
|
171
|
+
color: "#0f172a",
|
|
172
|
+
border: "1px solid #e2e8f0",
|
|
173
|
+
boxShadow: "0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1)",
|
|
174
|
+
cursor: "pointer",
|
|
175
|
+
transition: "all 0.2s ease"
|
|
176
|
+
},
|
|
177
|
+
children: [
|
|
178
|
+
/* @__PURE__ */ jsx(
|
|
179
|
+
"div",
|
|
180
|
+
{
|
|
181
|
+
style: {
|
|
182
|
+
width: "32px",
|
|
183
|
+
height: "32px",
|
|
184
|
+
borderRadius: "50%",
|
|
185
|
+
background: "linear-gradient(135deg, #0284c7, #4f46e5)",
|
|
186
|
+
display: "flex",
|
|
187
|
+
alignItems: "center",
|
|
188
|
+
justifyContent: "center",
|
|
189
|
+
color: "#ffffff"
|
|
190
|
+
},
|
|
191
|
+
children: /* @__PURE__ */ jsxs("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
192
|
+
/* @__PURE__ */ jsx("path", { d: "M12 8V4H8" }),
|
|
193
|
+
/* @__PURE__ */ jsx("rect", { width: "16", height: "12", x: "4", y: "8", rx: "2" }),
|
|
194
|
+
/* @__PURE__ */ jsx("path", { d: "M2 14h2" }),
|
|
195
|
+
/* @__PURE__ */ jsx("path", { d: "M20 14h2" }),
|
|
196
|
+
/* @__PURE__ */ jsx("path", { d: "M15 13v2" }),
|
|
197
|
+
/* @__PURE__ */ jsx("path", { d: "M9 13v2" })
|
|
198
|
+
] })
|
|
199
|
+
}
|
|
200
|
+
),
|
|
201
|
+
/* @__PURE__ */ jsxs("div", { style: { textAlign: "left" }, children: [
|
|
202
|
+
/* @__PURE__ */ jsx("span", { style: { display: "block", fontSize: "12px", fontWeight: "700", lineHeight: "1.2" }, children: "Ask AI Copilot" }),
|
|
203
|
+
/* @__PURE__ */ jsx("span", { style: { display: "block", fontSize: "10px", color: "#64748b" }, children: "AI Diagnostics" })
|
|
204
|
+
] }),
|
|
205
|
+
/* @__PURE__ */ jsx(
|
|
206
|
+
"span",
|
|
207
|
+
{
|
|
208
|
+
style: {
|
|
209
|
+
width: "8px",
|
|
210
|
+
height: "8px",
|
|
211
|
+
borderRadius: "50%",
|
|
212
|
+
backgroundColor: "#10b981",
|
|
213
|
+
marginLeft: "4px"
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
)
|
|
217
|
+
]
|
|
218
|
+
}
|
|
219
|
+
),
|
|
220
|
+
isOpen && /* @__PURE__ */ jsxs(
|
|
221
|
+
"div",
|
|
222
|
+
{
|
|
223
|
+
style: {
|
|
224
|
+
width: "min(420px, 92vw)",
|
|
225
|
+
height: "min(580px, 85vh)",
|
|
226
|
+
borderRadius: "16px",
|
|
227
|
+
backgroundColor: "#ffffff",
|
|
228
|
+
border: "1px solid #e2e8f0",
|
|
229
|
+
boxShadow: "0 25px 50px -12px rgba(0, 0, 0, 0.25)",
|
|
230
|
+
display: "flex",
|
|
231
|
+
flexDirection: "column",
|
|
232
|
+
overflow: "hidden"
|
|
233
|
+
},
|
|
234
|
+
children: [
|
|
235
|
+
/* @__PURE__ */ jsxs(
|
|
236
|
+
"div",
|
|
237
|
+
{
|
|
238
|
+
style: {
|
|
239
|
+
padding: "14px 16px",
|
|
240
|
+
backgroundColor: "#f8fafc",
|
|
241
|
+
borderBottom: "1px solid #e2e8f0",
|
|
242
|
+
display: "flex",
|
|
243
|
+
alignItems: "center",
|
|
244
|
+
justifyContent: "space-between"
|
|
245
|
+
},
|
|
246
|
+
children: [
|
|
247
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "10px" }, children: [
|
|
248
|
+
/* @__PURE__ */ jsx(
|
|
249
|
+
"div",
|
|
250
|
+
{
|
|
251
|
+
style: {
|
|
252
|
+
width: "32px",
|
|
253
|
+
height: "32px",
|
|
254
|
+
borderRadius: "8px",
|
|
255
|
+
backgroundColor: "#e0f2fe",
|
|
256
|
+
border: "1px solid #bae6fd",
|
|
257
|
+
display: "flex",
|
|
258
|
+
alignItems: "center",
|
|
259
|
+
justifyContent: "center",
|
|
260
|
+
color: "#0369a1"
|
|
261
|
+
},
|
|
262
|
+
children: /* @__PURE__ */ jsxs("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
263
|
+
/* @__PURE__ */ jsx("rect", { width: "16", height: "12", x: "4", y: "8", rx: "2" }),
|
|
264
|
+
/* @__PURE__ */ jsx("path", { d: "M12 8V4H8" })
|
|
265
|
+
] })
|
|
266
|
+
}
|
|
267
|
+
),
|
|
268
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
269
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "6px" }, children: [
|
|
270
|
+
/* @__PURE__ */ jsx("span", { style: { fontWeight: "700", fontSize: "13px", color: "#0f172a" }, children: "TracePulse Copilot" }),
|
|
271
|
+
/* @__PURE__ */ jsx("span", { style: { fontSize: "9px", fontWeight: "700", textTransform: "uppercase", padding: "2px 6px", borderRadius: "4px", backgroundColor: "#e0f2fe", color: "#0369a1" }, children: "AI Active" })
|
|
272
|
+
] }),
|
|
273
|
+
/* @__PURE__ */ jsx("span", { style: { fontSize: "11px", color: "#64748b" }, children: "Autonomous Transaction Diagnosis" })
|
|
274
|
+
] })
|
|
275
|
+
] }),
|
|
276
|
+
/* @__PURE__ */ jsx(
|
|
277
|
+
"button",
|
|
278
|
+
{
|
|
279
|
+
onClick: () => setIsOpen(false),
|
|
280
|
+
style: {
|
|
281
|
+
padding: "6px",
|
|
282
|
+
borderRadius: "6px",
|
|
283
|
+
backgroundColor: "transparent",
|
|
284
|
+
border: "none",
|
|
285
|
+
color: "#94a3b8",
|
|
286
|
+
cursor: "pointer"
|
|
287
|
+
},
|
|
288
|
+
title: "Close",
|
|
289
|
+
children: /* @__PURE__ */ jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
290
|
+
/* @__PURE__ */ jsx("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
291
|
+
/* @__PURE__ */ jsx("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
292
|
+
] })
|
|
293
|
+
}
|
|
294
|
+
)
|
|
295
|
+
]
|
|
296
|
+
}
|
|
297
|
+
),
|
|
298
|
+
/* @__PURE__ */ jsxs(
|
|
299
|
+
"div",
|
|
300
|
+
{
|
|
301
|
+
style: {
|
|
302
|
+
flex: 1,
|
|
303
|
+
padding: "16px",
|
|
304
|
+
overflowY: "auto",
|
|
305
|
+
display: "flex",
|
|
306
|
+
flexDirection: "column",
|
|
307
|
+
gap: "12px",
|
|
308
|
+
backgroundColor: "#f8fafc"
|
|
309
|
+
},
|
|
310
|
+
children: [
|
|
311
|
+
messages.map((msg) => /* @__PURE__ */ jsxs(
|
|
312
|
+
"div",
|
|
313
|
+
{
|
|
314
|
+
style: {
|
|
315
|
+
display: "flex",
|
|
316
|
+
flexDirection: "column",
|
|
317
|
+
alignItems: msg.sender === "user" ? "flex-end" : "flex-start"
|
|
318
|
+
},
|
|
319
|
+
children: [
|
|
320
|
+
/* @__PURE__ */ jsx(
|
|
321
|
+
"div",
|
|
322
|
+
{
|
|
323
|
+
style: {
|
|
324
|
+
maxWidth: "85%",
|
|
325
|
+
borderRadius: "14px",
|
|
326
|
+
padding: "10px 14px",
|
|
327
|
+
fontSize: "12px",
|
|
328
|
+
lineHeight: "1.5",
|
|
329
|
+
backgroundColor: msg.sender === "user" ? "#0284c7" : "#ffffff",
|
|
330
|
+
color: msg.sender === "user" ? "#ffffff" : "#1e293b",
|
|
331
|
+
border: msg.sender === "user" ? "none" : "1px solid #e2e8f0",
|
|
332
|
+
boxShadow: "0 1px 2px rgba(0, 0, 0, 0.05)",
|
|
333
|
+
whiteSpace: "pre-wrap"
|
|
334
|
+
},
|
|
335
|
+
children: msg.text
|
|
336
|
+
}
|
|
337
|
+
),
|
|
338
|
+
/* @__PURE__ */ jsx("span", { style: { fontSize: "10px", color: "#94a3b8", marginTop: "4px", padding: "0 4px" }, children: new Date(msg.timestamp).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) })
|
|
339
|
+
]
|
|
340
|
+
},
|
|
341
|
+
msg.id
|
|
342
|
+
)),
|
|
343
|
+
isLoading && /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "8px", color: "#64748b", fontSize: "12px", padding: "4px" }, children: [
|
|
344
|
+
/* @__PURE__ */ jsx("span", { style: { display: "inline-block", width: "12px", height: "12px", border: "2px solid #0284c7", borderTopColor: "transparent", borderRadius: "50%", animation: "spin 1s linear infinite" } }),
|
|
345
|
+
/* @__PURE__ */ jsx("span", { children: "Analyzing transaction traces & logs..." })
|
|
346
|
+
] }),
|
|
347
|
+
/* @__PURE__ */ jsx("div", { ref: messagesEndRef })
|
|
348
|
+
]
|
|
349
|
+
}
|
|
350
|
+
),
|
|
351
|
+
/* @__PURE__ */ jsx(
|
|
352
|
+
"div",
|
|
353
|
+
{
|
|
354
|
+
style: {
|
|
355
|
+
padding: "6px 12px",
|
|
356
|
+
backgroundColor: "#ffffff",
|
|
357
|
+
borderTop: "1px solid #f1f5f9",
|
|
358
|
+
display: "flex",
|
|
359
|
+
gap: "6px",
|
|
360
|
+
overflowX: "auto",
|
|
361
|
+
whiteSpace: "nowrap"
|
|
362
|
+
},
|
|
363
|
+
children: quickPrompts.map((q, idx) => /* @__PURE__ */ jsx(
|
|
364
|
+
"button",
|
|
365
|
+
{
|
|
366
|
+
onClick: () => sendMessage(q),
|
|
367
|
+
disabled: isLoading,
|
|
368
|
+
style: {
|
|
369
|
+
fontSize: "11px",
|
|
370
|
+
padding: "4px 10px",
|
|
371
|
+
borderRadius: "9999px",
|
|
372
|
+
backgroundColor: "#f1f5f9",
|
|
373
|
+
color: "#334155",
|
|
374
|
+
border: "1px solid #e2e8f0",
|
|
375
|
+
cursor: "pointer"
|
|
376
|
+
},
|
|
377
|
+
children: q
|
|
378
|
+
},
|
|
379
|
+
idx
|
|
380
|
+
))
|
|
381
|
+
}
|
|
382
|
+
),
|
|
383
|
+
/* @__PURE__ */ jsxs(
|
|
384
|
+
"form",
|
|
385
|
+
{
|
|
386
|
+
onSubmit: handleFormSubmit,
|
|
387
|
+
style: {
|
|
388
|
+
padding: "12px",
|
|
389
|
+
backgroundColor: "#ffffff",
|
|
390
|
+
borderTop: "1px solid #e2e8f0",
|
|
391
|
+
display: "flex",
|
|
392
|
+
gap: "8px"
|
|
393
|
+
},
|
|
394
|
+
children: [
|
|
395
|
+
/* @__PURE__ */ jsx(
|
|
396
|
+
"input",
|
|
397
|
+
{
|
|
398
|
+
type: "text",
|
|
399
|
+
value: input,
|
|
400
|
+
onChange: (e) => setInput(e.target.value),
|
|
401
|
+
placeholder: "Ask about any transaction (e.g. Why did 450000015526099 fail?)...",
|
|
402
|
+
style: {
|
|
403
|
+
flex: 1,
|
|
404
|
+
backgroundColor: "#f8fafc",
|
|
405
|
+
border: "1px solid #cbd5e1",
|
|
406
|
+
borderRadius: "10px",
|
|
407
|
+
padding: "8px 12px",
|
|
408
|
+
fontSize: "12px",
|
|
409
|
+
color: "#0f172a",
|
|
410
|
+
outline: "none"
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
),
|
|
414
|
+
/* @__PURE__ */ jsx(
|
|
415
|
+
"button",
|
|
416
|
+
{
|
|
417
|
+
type: "submit",
|
|
418
|
+
disabled: isLoading || !input.trim(),
|
|
419
|
+
style: {
|
|
420
|
+
padding: "8px 14px",
|
|
421
|
+
borderRadius: "10px",
|
|
422
|
+
backgroundColor: "#0284c7",
|
|
423
|
+
color: "#ffffff",
|
|
424
|
+
border: "none",
|
|
425
|
+
cursor: "pointer",
|
|
426
|
+
fontWeight: "600",
|
|
427
|
+
fontSize: "12px",
|
|
428
|
+
opacity: isLoading || !input.trim() ? 0.5 : 1
|
|
429
|
+
},
|
|
430
|
+
children: "Send"
|
|
431
|
+
}
|
|
432
|
+
)
|
|
433
|
+
]
|
|
434
|
+
}
|
|
435
|
+
)
|
|
436
|
+
]
|
|
437
|
+
}
|
|
438
|
+
)
|
|
439
|
+
]
|
|
440
|
+
}
|
|
441
|
+
)
|
|
442
|
+
] });
|
|
443
|
+
}
|
|
444
|
+
var TracePulseProvider_default = TracePulseProvider;
|
|
445
|
+
|
|
446
|
+
// src/useTracePulse.ts
|
|
447
|
+
import { useContext } from "react";
|
|
448
|
+
function useTracePulse() {
|
|
449
|
+
const ctx = useContext(TracePulseContext);
|
|
450
|
+
if (!ctx) {
|
|
451
|
+
throw new Error(
|
|
452
|
+
'[TracePulse] useTracePulse() must be used within a <TracePulseProvider />. Ensure your application root is wrapped with <TracePulseProvider apiKey="...">.'
|
|
453
|
+
);
|
|
454
|
+
}
|
|
455
|
+
return ctx;
|
|
456
|
+
}
|
|
457
|
+
export {
|
|
458
|
+
TracePulseContext,
|
|
459
|
+
TracePulseProvider,
|
|
460
|
+
TracePulseProvider_default as default,
|
|
461
|
+
useTracePulse
|
|
462
|
+
};
|
|
463
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/TracePulseProvider.tsx","../src/TracePulseContext.tsx","../src/useTracePulse.ts"],"sourcesContent":["import React, { useState, useRef, useEffect, useCallback } from \"react\";\nimport { TracePulseContext } from \"./TracePulseContext\";\nimport { TracePulseProviderProps, ChatMessage, TracePulseContextValue } from \"./types\";\n\nexport function TracePulseProvider({\n apiKey,\n projectId = \"default-project\",\n endpoint = \"http://127.0.0.1:8000\",\n targetTransactionId,\n position = \"bottom-right\",\n theme = \"light\",\n floatingButton = true,\n children,\n}: TracePulseProviderProps) {\n const [isOpen, setIsOpen] = useState(false);\n const [activeTransactionId, setActiveTransactionId] = useState<string | null>(\n targetTransactionId || null\n );\n const [isLoading, setIsLoading] = useState(false);\n const [input, setInput] = useState(\"\");\n const [messages, setMessages] = useState<ChatMessage[]>([\n {\n id: \"welcome\",\n sender: \"copilot\",\n text: \"👋 Hi! I am **TracePulse AI Copilot**. Ask me anything about any transaction, why a payment failed, or mention a transaction ID to see deep-dive diagnostics.\",\n timestamp: new Date().toISOString(),\n },\n ]);\n\n const messagesEndRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (targetTransactionId) {\n setActiveTransactionId(targetTransactionId);\n }\n }, [targetTransactionId]);\n\n useEffect(() => {\n if (isOpen) {\n messagesEndRef.current?.scrollIntoView({ behavior: \"smooth\" });\n }\n }, [messages, isOpen]);\n\n const openCopilot = useCallback((transactionId?: string) => {\n if (transactionId) {\n setActiveTransactionId(transactionId);\n }\n setIsOpen(true);\n }, []);\n\n const closeCopilot = useCallback(() => {\n setIsOpen(false);\n }, []);\n\n const toggleCopilot = useCallback(() => {\n setIsOpen((prev) => !prev);\n }, []);\n\n const sendMessage = useCallback(\n async (text: string, transactionId?: string): Promise<string> => {\n if (!text.trim() || isLoading) return \"\";\n\n const effectiveTxnId =\n transactionId ||\n (() => {\n const match = text.match(/\\b(?:45\\d{13}|\\d{10,20})\\b/);\n return match ? match[0] : activeTransactionId || undefined;\n })();\n\n const userMsg: ChatMessage = {\n id: `user-${Date.now()}`,\n sender: \"user\",\n text,\n timestamp: new Date().toISOString(),\n transactionId: effectiveTxnId,\n };\n\n setMessages((prev) => [...prev, userMsg]);\n setIsLoading(true);\n\n try {\n const cleanEndpoint = endpoint.replace(/\\/+$/, \"\");\n const res = await fetch(`${cleanEndpoint}/api/v1/widget/chat`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n \"X-TracePulse-Key\": apiKey,\n \"X-TracePulse-Project\": projectId,\n },\n body: JSON.stringify({\n query: text,\n transaction_id: effectiveTxnId,\n app_context: projectId,\n }),\n });\n\n if (!res.ok) {\n throw new Error(`Server returned ${res.status}`);\n }\n\n const data = await res.json();\n const reply = data.reply || data.answer || \"No response received.\";\n\n const copilotMsg: ChatMessage = {\n id: `copilot-${Date.now()}`,\n sender: \"copilot\",\n text: reply,\n timestamp: new Date().toISOString(),\n transactionId: data.transactionId || effectiveTxnId,\n };\n\n setMessages((prev) => [...prev, copilotMsg]);\n return reply;\n } catch (err: any) {\n const errorMsg: ChatMessage = {\n id: `copilot-err-${Date.now()}`,\n sender: \"copilot\",\n text: `⚠️ **Failed to reach AI Copilot**: ${err.message || \"Network error\"}. Check backend connection at \\`${endpoint}\\`.`,\n timestamp: new Date().toISOString(),\n };\n setMessages((prev) => [...prev, errorMsg]);\n return errorMsg.text;\n } finally {\n setIsLoading(false);\n }\n },\n [apiKey, projectId, endpoint, activeTransactionId, isLoading]\n );\n\n const contextValue: TracePulseContextValue = {\n isOpen,\n openCopilot,\n closeCopilot,\n toggleCopilot,\n activeTransactionId,\n setActiveTransactionId,\n sendMessage,\n messages,\n isLoading,\n endpoint,\n apiKey,\n };\n\n const quickPrompts = [\n \"Why did transaction 450000015526099 fail?\",\n \"What happened in Loki logs for 450000015526099?\",\n \"Check payment status for 450000015526099\",\n \"Show Kafka consumer errors in Loki\",\n ];\n\n const handleFormSubmit = (e: React.FormEvent) => {\n e.preventDefault();\n if (!input.trim()) return;\n const text = input;\n setInput(\"\");\n sendMessage(text);\n };\n\n const isRight = position === \"bottom-right\";\n\n return (\n <TracePulseContext.Provider value={contextValue}>\n {children}\n\n {/* Floating Action Button & Modal (Self-Contained Light UI) */}\n {floatingButton && (\n <div\n style={{\n position: \"fixed\",\n bottom: \"24px\",\n right: isRight ? \"24px\" : \"auto\",\n left: !isRight ? \"24px\" : \"auto\",\n zIndex: 999999,\n fontFamily: \"system-ui, -apple-system, sans-serif\",\n }}\n >\n {/* Floating Launcher Button */}\n {!isOpen && (\n <button\n onClick={() => setIsOpen(true)}\n style={{\n display: \"flex\",\n alignItems: \"center\",\n gap: \"10px\",\n padding: \"10px 18px\",\n borderRadius: \"9999px\",\n backgroundColor: \"#ffffff\",\n color: \"#0f172a\",\n border: \"1px solid #e2e8f0\",\n boxShadow: \"0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1)\",\n cursor: \"pointer\",\n transition: \"all 0.2s ease\",\n }}\n >\n <div\n style={{\n width: \"32px\",\n height: \"32px\",\n borderRadius: \"50%\",\n background: \"linear-gradient(135deg, #0284c7, #4f46e5)\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n color: \"#ffffff\",\n }}\n >\n <svg width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n <path d=\"M12 8V4H8\"></path>\n <rect width=\"16\" height=\"12\" x=\"4\" y=\"8\" rx=\"2\"></rect>\n <path d=\"M2 14h2\"></path>\n <path d=\"M20 14h2\"></path>\n <path d=\"M15 13v2\"></path>\n <path d=\"M9 13v2\"></path>\n </svg>\n </div>\n <div style={{ textAlign: \"left\" }}>\n <span style={{ display: \"block\", fontSize: \"12px\", fontWeight: \"700\", lineHeight: \"1.2\" }}>Ask AI Copilot</span>\n <span style={{ display: \"block\", fontSize: \"10px\", color: \"#64748b\" }}>AI Diagnostics</span>\n </div>\n <span\n style={{\n width: \"8px\",\n height: \"8px\",\n borderRadius: \"50%\",\n backgroundColor: \"#10b981\",\n marginLeft: \"4px\",\n }}\n />\n </button>\n )}\n\n {/* Floating Drawer Modal */}\n {isOpen && (\n <div\n style={{\n width: \"min(420px, 92vw)\",\n height: \"min(580px, 85vh)\",\n borderRadius: \"16px\",\n backgroundColor: \"#ffffff\",\n border: \"1px solid #e2e8f0\",\n boxShadow: \"0 25px 50px -12px rgba(0, 0, 0, 0.25)\",\n display: \"flex\",\n flexDirection: \"column\",\n overflow: \"hidden\",\n }}\n >\n {/* Header */}\n <div\n style={{\n padding: \"14px 16px\",\n backgroundColor: \"#f8fafc\",\n borderBottom: \"1px solid #e2e8f0\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n }}\n >\n <div style={{ display: \"flex\", alignItems: \"center\", gap: \"10px\" }}>\n <div\n style={{\n width: \"32px\",\n height: \"32px\",\n borderRadius: \"8px\",\n backgroundColor: \"#e0f2fe\",\n border: \"1px solid #bae6fd\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n color: \"#0369a1\",\n }}\n >\n <svg width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n <rect width=\"16\" height=\"12\" x=\"4\" y=\"8\" rx=\"2\"></rect>\n <path d=\"M12 8V4H8\"></path>\n </svg>\n </div>\n <div>\n <div style={{ display: \"flex\", alignItems: \"center\", gap: \"6px\" }}>\n <span style={{ fontWeight: \"700\", fontSize: \"13px\", color: \"#0f172a\" }}>TracePulse Copilot</span>\n <span style={{ fontSize: \"9px\", fontWeight: \"700\", textTransform: \"uppercase\", padding: \"2px 6px\", borderRadius: \"4px\", backgroundColor: \"#e0f2fe\", color: \"#0369a1\" }}>AI Active</span>\n </div>\n <span style={{ fontSize: \"11px\", color: \"#64748b\" }}>Autonomous Transaction Diagnosis</span>\n </div>\n </div>\n\n <button\n onClick={() => setIsOpen(false)}\n style={{\n padding: \"6px\",\n borderRadius: \"6px\",\n backgroundColor: \"transparent\",\n border: \"none\",\n color: \"#94a3b8\",\n cursor: \"pointer\",\n }}\n title=\"Close\"\n >\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n <line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\"></line>\n <line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\"></line>\n </svg>\n </button>\n </div>\n\n {/* Messages Body */}\n <div\n style={{\n flex: 1,\n padding: \"16px\",\n overflowY: \"auto\",\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"12px\",\n backgroundColor: \"#f8fafc\",\n }}\n >\n {messages.map((msg) => (\n <div\n key={msg.id}\n style={{\n display: \"flex\",\n flexDirection: \"column\",\n alignItems: msg.sender === \"user\" ? \"flex-end\" : \"flex-start\",\n }}\n >\n <div\n style={{\n maxWidth: \"85%\",\n borderRadius: \"14px\",\n padding: \"10px 14px\",\n fontSize: \"12px\",\n lineHeight: \"1.5\",\n backgroundColor: msg.sender === \"user\" ? \"#0284c7\" : \"#ffffff\",\n color: msg.sender === \"user\" ? \"#ffffff\" : \"#1e293b\",\n border: msg.sender === \"user\" ? \"none\" : \"1px solid #e2e8f0\",\n boxShadow: \"0 1px 2px rgba(0, 0, 0, 0.05)\",\n whiteSpace: \"pre-wrap\",\n }}\n >\n {msg.text}\n </div>\n <span style={{ fontSize: \"10px\", color: \"#94a3b8\", marginTop: \"4px\", padding: \"0 4px\" }}>\n {new Date(msg.timestamp).toLocaleTimeString([], { hour: \"2-digit\", minute: \"2-digit\" })}\n </span>\n </div>\n ))}\n\n {isLoading && (\n <div style={{ display: \"flex\", alignItems: \"center\", gap: \"8px\", color: \"#64748b\", fontSize: \"12px\", padding: \"4px\" }}>\n <span style={{ display: \"inline-block\", width: \"12px\", height: \"12px\", border: \"2px solid #0284c7\", borderTopColor: \"transparent\", borderRadius: \"50%\", animation: \"spin 1s linear infinite\" }}></span>\n <span>Analyzing transaction traces & logs...</span>\n </div>\n )}\n <div ref={messagesEndRef} />\n </div>\n\n {/* Quick Prompts */}\n <div\n style={{\n padding: \"6px 12px\",\n backgroundColor: \"#ffffff\",\n borderTop: \"1px solid #f1f5f9\",\n display: \"flex\",\n gap: \"6px\",\n overflowX: \"auto\",\n whiteSpace: \"nowrap\",\n }}\n >\n {quickPrompts.map((q, idx) => (\n <button\n key={idx}\n onClick={() => sendMessage(q)}\n disabled={isLoading}\n style={{\n fontSize: \"11px\",\n padding: \"4px 10px\",\n borderRadius: \"9999px\",\n backgroundColor: \"#f1f5f9\",\n color: \"#334155\",\n border: \"1px solid #e2e8f0\",\n cursor: \"pointer\",\n }}\n >\n {q}\n </button>\n ))}\n </div>\n\n {/* Chat Input */}\n <form\n onSubmit={handleFormSubmit}\n style={{\n padding: \"12px\",\n backgroundColor: \"#ffffff\",\n borderTop: \"1px solid #e2e8f0\",\n display: \"flex\",\n gap: \"8px\",\n }}\n >\n <input\n type=\"text\"\n value={input}\n onChange={(e) => setInput(e.target.value)}\n placeholder=\"Ask about any transaction (e.g. Why did 450000015526099 fail?)...\"\n style={{\n flex: 1,\n backgroundColor: \"#f8fafc\",\n border: \"1px solid #cbd5e1\",\n borderRadius: \"10px\",\n padding: \"8px 12px\",\n fontSize: \"12px\",\n color: \"#0f172a\",\n outline: \"none\",\n }}\n />\n <button\n type=\"submit\"\n disabled={isLoading || !input.trim()}\n style={{\n padding: \"8px 14px\",\n borderRadius: \"10px\",\n backgroundColor: \"#0284c7\",\n color: \"#ffffff\",\n border: \"none\",\n cursor: \"pointer\",\n fontWeight: \"600\",\n fontSize: \"12px\",\n opacity: isLoading || !input.trim() ? 0.5 : 1,\n }}\n >\n Send\n </button>\n </form>\n </div>\n )}\n </div>\n )}\n </TracePulseContext.Provider>\n );\n}\n\nexport default TracePulseProvider;\n","import React, { createContext } from \"react\";\nimport { TracePulseContextValue } from \"./types\";\n\nexport const TracePulseContext = createContext<TracePulseContextValue | null>(null);\n","import { useContext } from \"react\";\nimport { TracePulseContext } from \"./TracePulseContext\";\nimport { TracePulseContextValue } from \"./types\";\n\n/**\n * React hook to access TracePulse AI Copilot controls from any child component.\n *\n * Example:\n * ```tsx\n * import { useTracePulse } from \"@tracepulse/connector-react\";\n *\n * function OrderCard({ leadId }) {\n * const { openCopilot } = useTracePulse();\n * return <button onClick={() => openCopilot(leadId)}>Investigate with AI</button>;\n * }\n * ```\n */\nexport function useTracePulse(): TracePulseContextValue {\n const ctx = useContext(TracePulseContext);\n if (!ctx) {\n throw new Error(\n \"[TracePulse] useTracePulse() must be used within a <TracePulseProvider />. Ensure your application root is wrapped with <TracePulseProvider apiKey=\\\"...\\\">.\"\n );\n }\n return ctx;\n}\n"],"mappings":";;;AAAA,SAAgB,UAAU,QAAQ,WAAW,mBAAmB;;;ACAhE,SAAgB,qBAAqB;AAG9B,IAAM,oBAAoB,cAA6C,IAAI;;;AD2MlE,SACE,KADF;AA1MT,SAAS,mBAAmB;AAAA,EACjC;AAAA,EACA,YAAY;AAAA,EACZ,WAAW;AAAA,EACX;AAAA,EACA,WAAW;AAAA,EACX,QAAQ;AAAA,EACR,iBAAiB;AAAA,EACjB;AACF,GAA4B;AAC1B,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAS,KAAK;AAC1C,QAAM,CAAC,qBAAqB,sBAAsB,IAAI;AAAA,IACpD,uBAAuB;AAAA,EACzB;AACA,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,KAAK;AAChD,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAS,EAAE;AACrC,QAAM,CAAC,UAAU,WAAW,IAAI,SAAwB;AAAA,IACtD;AAAA,MACE,IAAI;AAAA,MACJ,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,YAAW,oBAAI,KAAK,GAAE,YAAY;AAAA,IACpC;AAAA,EACF,CAAC;AAED,QAAM,iBAAiB,OAAuB,IAAI;AAElD,YAAU,MAAM;AACd,QAAI,qBAAqB;AACvB,6BAAuB,mBAAmB;AAAA,IAC5C;AAAA,EACF,GAAG,CAAC,mBAAmB,CAAC;AAExB,YAAU,MAAM;AACd,QAAI,QAAQ;AACV,qBAAe,SAAS,eAAe,EAAE,UAAU,SAAS,CAAC;AAAA,IAC/D;AAAA,EACF,GAAG,CAAC,UAAU,MAAM,CAAC;AAErB,QAAM,cAAc,YAAY,CAAC,kBAA2B;AAC1D,QAAI,eAAe;AACjB,6BAAuB,aAAa;AAAA,IACtC;AACA,cAAU,IAAI;AAAA,EAChB,GAAG,CAAC,CAA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