@paymanai/payman-ask-sdk 1.2.19 → 1.2.21

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/index.d.mts CHANGED
@@ -49,6 +49,8 @@ type MessageDisplay = {
49
49
  activeThinkingText?: string;
50
50
  /** All thinking accumulated across blocks (for post-stream display) */
51
51
  allThinkingText?: string;
52
+ /** True while RAG image URLs are being resolved after the final response is shown */
53
+ isResolvingImages?: boolean;
52
54
  };
53
55
  type SessionParams = {
54
56
  id?: string;
@@ -64,6 +66,8 @@ type APIConfig = {
64
66
  headers?: Record<string, string>;
65
67
  /** API endpoint for streaming (default: /api/workflows/ask/stream) */
66
68
  streamEndpoint?: string;
69
+ /** API endpoint for resolving RAG image URLs (default: /api/playground/ask/resolve-image-urls) */
70
+ resolveImagesEndpoint?: string;
67
71
  };
68
72
  type ChatConfig = {
69
73
  /** API configuration - required for the library to make calls */
@@ -134,6 +138,12 @@ type ChatConfig = {
134
138
  voiceContinuous?: boolean;
135
139
  /** Show a "New Session" reset button inside the input bar (default: false) */
136
140
  showResetSession?: boolean;
141
+ /**
142
+ * Sentry DSN for error monitoring.
143
+ * The library will initialise Sentry with this DSN if Sentry has not already
144
+ * been initialised by the host application.
145
+ */
146
+ sentryDsn?: string;
137
147
  };
138
148
  type ChatCallbacks = {
139
149
  /** Called when a message is sent (before API call) */
package/dist/index.d.ts CHANGED
@@ -49,6 +49,8 @@ type MessageDisplay = {
49
49
  activeThinkingText?: string;
50
50
  /** All thinking accumulated across blocks (for post-stream display) */
51
51
  allThinkingText?: string;
52
+ /** True while RAG image URLs are being resolved after the final response is shown */
53
+ isResolvingImages?: boolean;
52
54
  };
53
55
  type SessionParams = {
54
56
  id?: string;
@@ -64,6 +66,8 @@ type APIConfig = {
64
66
  headers?: Record<string, string>;
65
67
  /** API endpoint for streaming (default: /api/workflows/ask/stream) */
66
68
  streamEndpoint?: string;
69
+ /** API endpoint for resolving RAG image URLs (default: /api/playground/ask/resolve-image-urls) */
70
+ resolveImagesEndpoint?: string;
67
71
  };
68
72
  type ChatConfig = {
69
73
  /** API configuration - required for the library to make calls */
@@ -134,6 +138,12 @@ type ChatConfig = {
134
138
  voiceContinuous?: boolean;
135
139
  /** Show a "New Session" reset button inside the input bar (default: false) */
136
140
  showResetSession?: boolean;
141
+ /**
142
+ * Sentry DSN for error monitoring.
143
+ * The library will initialise Sentry with this DSN if Sentry has not already
144
+ * been initialised by the host application.
145
+ */
146
+ sentryDsn?: string;
137
147
  };
138
148
  type ChatCallbacks = {
139
149
  /** Called when a message is sent (before API call) */
package/dist/index.js CHANGED
@@ -5,13 +5,34 @@ var framerMotion = require('framer-motion');
5
5
  var react = require('react');
6
6
  var clsx = require('clsx');
7
7
  var tailwindMerge = require('tailwind-merge');
8
+ var Sentry = require('@sentry/react');
8
9
  var lucideReact = require('lucide-react');
9
10
  var jsxRuntime = require('react/jsx-runtime');
10
11
  var ReactMarkdown = require('react-markdown');
11
12
  var remarkGfm = require('remark-gfm');
13
+ var reactDom = require('react-dom');
12
14
 
13
15
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
14
16
 
17
+ function _interopNamespace(e) {
18
+ if (e && e.__esModule) return e;
19
+ var n = Object.create(null);
20
+ if (e) {
21
+ Object.keys(e).forEach(function (k) {
22
+ if (k !== 'default') {
23
+ var d = Object.getOwnPropertyDescriptor(e, k);
24
+ Object.defineProperty(n, k, d.get ? d : {
25
+ enumerable: true,
26
+ get: function () { return e[k]; }
27
+ });
28
+ }
29
+ });
30
+ }
31
+ n.default = e;
32
+ return Object.freeze(n);
33
+ }
34
+
35
+ var Sentry__namespace = /*#__PURE__*/_interopNamespace(Sentry);
15
36
  var ReactMarkdown__default = /*#__PURE__*/_interopDefault(ReactMarkdown);
16
37
  var remarkGfm__default = /*#__PURE__*/_interopDefault(remarkGfm);
17
38
 
@@ -58,6 +79,17 @@ function formatElapsedTime(ms) {
58
79
  if (ms < 1e3) return `${ms}ms`;
59
80
  return `${(ms / 1e3).toFixed(1)}s`;
60
81
  }
82
+ function initSentryIfNeeded(dsn) {
83
+ if (!dsn) return;
84
+ if (Sentry__namespace.getClient()) return;
85
+ Sentry__namespace.init({
86
+ dsn,
87
+ sendDefaultPii: true,
88
+ initialScope: {
89
+ tags: { source: "payman-ask-sdk" }
90
+ }
91
+ });
92
+ }
61
93
  var AI_DISCLAIMER_TEXT = "AI can make mistakes. Please double-check responses.";
62
94
  function ChatInput({
63
95
  value,
@@ -321,6 +353,256 @@ function ChatInput({
321
353
  }
322
354
  );
323
355
  }
356
+ function ImageLightbox({
357
+ src,
358
+ alt = "",
359
+ onClose
360
+ }) {
361
+ const [isMounted, setIsMounted] = react.useState(false);
362
+ const [isImageLoaded, setIsImageLoaded] = react.useState(false);
363
+ const overlayStyle = {
364
+ position: "fixed",
365
+ inset: 0,
366
+ zIndex: 2147483647,
367
+ display: "flex",
368
+ alignItems: "center",
369
+ justifyContent: "center",
370
+ padding: 16,
371
+ background: "rgba(2, 6, 23, 0.92)",
372
+ isolation: "isolate"
373
+ };
374
+ const frameStyle = {
375
+ position: "relative",
376
+ width: "min(92vw, 1280px)",
377
+ height: "min(88vh, 920px)",
378
+ display: "flex",
379
+ alignItems: "center",
380
+ justifyContent: "center",
381
+ overflow: "hidden"
382
+ };
383
+ react.useEffect(() => {
384
+ setIsMounted(true);
385
+ return () => setIsMounted(false);
386
+ }, []);
387
+ react.useEffect(() => {
388
+ setIsImageLoaded(false);
389
+ }, [src]);
390
+ react.useEffect(() => {
391
+ if (typeof document === "undefined") return;
392
+ const previousOverflow = document.body.style.overflow;
393
+ document.body.style.overflow = "hidden";
394
+ return () => {
395
+ document.body.style.overflow = previousOverflow;
396
+ };
397
+ }, []);
398
+ react.useEffect(() => {
399
+ if (typeof document === "undefined") return;
400
+ const handleKeyDown = (event) => {
401
+ if (event.key === "Escape") {
402
+ onClose();
403
+ }
404
+ };
405
+ document.addEventListener("keydown", handleKeyDown);
406
+ return () => {
407
+ document.removeEventListener("keydown", handleKeyDown);
408
+ };
409
+ }, [onClose]);
410
+ if (!isMounted || typeof document === "undefined") {
411
+ return null;
412
+ }
413
+ return reactDom.createPortal(
414
+ /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: /* @__PURE__ */ jsxRuntime.jsxs(
415
+ framerMotion.motion.div,
416
+ {
417
+ style: overlayStyle,
418
+ initial: { opacity: 0 },
419
+ animate: { opacity: 1 },
420
+ exit: { opacity: 0 },
421
+ transition: { duration: 0.18 },
422
+ onClick: onClose,
423
+ children: [
424
+ /* @__PURE__ */ jsxRuntime.jsx(
425
+ "button",
426
+ {
427
+ type: "button",
428
+ onClick: onClose,
429
+ className: "absolute top-4 right-4 z-[1] flex h-9 w-9 items-center justify-center rounded-full bg-black/60 text-white/90 transition-colors hover:bg-black/75",
430
+ "aria-label": "Close",
431
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-4 w-4" })
432
+ }
433
+ ),
434
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: frameStyle, onClick: (event) => event.stopPropagation(), children: [
435
+ !isImageLoaded ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "absolute inset-0 flex flex-col items-center justify-center gap-2", children: [
436
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "h-5 w-5 animate-spin text-white/80" }),
437
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium text-white/90", children: "Loading image" }),
438
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-white/60", children: "Reference image" })
439
+ ] }) : null,
440
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-full w-full items-center justify-center p-3 sm:p-4", children: /* @__PURE__ */ jsxRuntime.jsx(
441
+ "img",
442
+ {
443
+ src,
444
+ alt,
445
+ draggable: false,
446
+ onLoad: () => setIsImageLoaded(true),
447
+ className: `block h-full w-full rounded-xl object-contain shadow-2xl transition-opacity duration-200 ${isImageLoaded ? "opacity-100" : "opacity-0"}`
448
+ }
449
+ ) })
450
+ ] })
451
+ ]
452
+ }
453
+ ) }),
454
+ document.body
455
+ );
456
+ }
457
+ var RAG_IMAGE_PATH_REGEX = /^(?:https?:\/\/[^/\s]+)?\/api\/rag\/chunks\/[^"'\s]+\/image(?:[?#][^"'\s]*)?$/;
458
+ function isUnresolvedRagImageSource(src) {
459
+ return RAG_IMAGE_PATH_REGEX.test(src);
460
+ }
461
+ function LoadingImageCard({
462
+ label,
463
+ description
464
+ }) {
465
+ return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "my-3 flex min-h-36 w-full flex-col items-center justify-center gap-2 px-4 py-5 text-center", children: [
466
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "h-5 w-5 animate-spin text-slate-500 dark:text-slate-300" }),
467
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-medium text-slate-600 dark:text-slate-200", children: label }),
468
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] leading-relaxed text-slate-500/90 dark:text-slate-300/80", children: description })
469
+ ] });
470
+ }
471
+ function BrokenImageCard({ alt }) {
472
+ return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "my-3 flex min-h-44 w-full flex-col items-center justify-center gap-2 rounded-xl border border-dashed border-red-200 bg-red-50/60 px-4 py-5 text-center dark:border-red-900/40 dark:bg-red-950/20", children: [
473
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-medium text-red-600 dark:text-red-300", children: "Unable to load image" }),
474
+ alt ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "max-w-sm text-[11px] leading-relaxed text-red-500/80 dark:text-red-200/80", children: alt }) : null
475
+ ] });
476
+ }
477
+ function MarkdownImage({
478
+ src,
479
+ alt,
480
+ isResolving = false
481
+ }) {
482
+ const imageFrameStyle = {
483
+ width: "min(100%, 32rem)",
484
+ maxWidth: "100%"
485
+ };
486
+ const imageStyle = {
487
+ display: "block",
488
+ width: "100%",
489
+ height: "auto",
490
+ maxWidth: "100%",
491
+ maxHeight: "18rem",
492
+ objectFit: "contain"
493
+ };
494
+ const [isLoaded, setIsLoaded] = react.useState(false);
495
+ const [hasError, setHasError] = react.useState(false);
496
+ const [isLightboxOpen, setIsLightboxOpen] = react.useState(false);
497
+ const isUnresolvedRagImage = react.useMemo(
498
+ () => src ? isUnresolvedRagImageSource(src) : false,
499
+ [src]
500
+ );
501
+ const isResolvingRagImage = isResolving && isUnresolvedRagImage;
502
+ react.useEffect(() => {
503
+ setIsLoaded(false);
504
+ setHasError(false);
505
+ setIsLightboxOpen(false);
506
+ }, [src]);
507
+ if (!src) {
508
+ return null;
509
+ }
510
+ if (isResolvingRagImage) {
511
+ return /* @__PURE__ */ jsxRuntime.jsx(LoadingImageCard, { label: "Loading image", description: "Reference image" });
512
+ }
513
+ if (hasError) {
514
+ return /* @__PURE__ */ jsxRuntime.jsx(BrokenImageCard, { alt });
515
+ }
516
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
517
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "my-3 block w-full", children: /* @__PURE__ */ jsxRuntime.jsx(
518
+ "button",
519
+ {
520
+ type: "button",
521
+ onClick: () => {
522
+ if (isLoaded) {
523
+ setIsLightboxOpen(true);
524
+ }
525
+ },
526
+ disabled: !isLoaded,
527
+ "aria-busy": !isLoaded,
528
+ className: "group relative mx-auto flex w-full items-center justify-center overflow-hidden rounded-xl bg-black/[0.03] px-3 py-3 text-left transition-colors hover:bg-black/[0.05] disabled:cursor-wait disabled:hover:bg-black/[0.03] dark:bg-white/[0.03] dark:hover:bg-white/[0.05] dark:disabled:hover:bg-white/[0.03]",
529
+ style: {
530
+ ...imageFrameStyle,
531
+ ...!isLoaded ? { minHeight: "9rem" } : {}
532
+ },
533
+ children: /* @__PURE__ */ jsxRuntime.jsx(
534
+ "img",
535
+ {
536
+ src,
537
+ alt: alt || "",
538
+ className: `relative z-[1] block h-auto max-h-[22rem] w-full max-w-full rounded-lg object-contain transition-opacity duration-200 ${isLoaded ? "opacity-100" : "opacity-0"}`,
539
+ style: imageStyle,
540
+ onLoad: () => {
541
+ setHasError(false);
542
+ setIsLoaded(true);
543
+ },
544
+ onError: () => {
545
+ setIsLoaded(false);
546
+ setHasError(true);
547
+ }
548
+ }
549
+ )
550
+ }
551
+ ) }),
552
+ isLightboxOpen && isLoaded ? /* @__PURE__ */ jsxRuntime.jsx(
553
+ ImageLightbox,
554
+ {
555
+ src,
556
+ alt,
557
+ onClose: () => setIsLightboxOpen(false)
558
+ }
559
+ ) : null
560
+ ] });
561
+ }
562
+ function createMarkdownComponents(options = {}) {
563
+ return {
564
+ p: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mb-3 last:mb-0 text-sm leading-relaxed", children }),
565
+ code: ({ className: codeClassName, children }) => {
566
+ const isInline = !codeClassName;
567
+ return isInline ? /* @__PURE__ */ jsxRuntime.jsx("code", { className: "payman-agent-code-inline rounded-md px-1.5 py-0.5 font-mono text-xs break-all", children }) : /* @__PURE__ */ jsxRuntime.jsx("code", { className: "payman-agent-code-block my-2 block overflow-x-auto rounded-lg p-3 font-mono text-xs whitespace-pre", children });
568
+ },
569
+ pre: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "my-2 max-w-full overflow-x-auto rounded-lg", children }),
570
+ ul: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "mb-3 ml-4 list-disc space-y-1 text-sm", children }),
571
+ ol: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("ol", { className: "mb-3 ml-4 list-decimal space-y-1 text-sm", children }),
572
+ li: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("li", { className: "text-sm leading-relaxed", children }),
573
+ h1: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "mt-4 mb-2 text-lg font-semibold first:mt-0", children }),
574
+ h2: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "mt-3 mb-2 text-base font-semibold first:mt-0", children }),
575
+ h3: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "mt-2 mb-1 text-sm font-semibold first:mt-0", children }),
576
+ strong: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("strong", { className: "font-semibold", children }),
577
+ em: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("em", { className: "italic", children }),
578
+ blockquote: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("blockquote", { className: "payman-agent-blockquote my-2 pl-4 italic", children }),
579
+ hr: () => /* @__PURE__ */ jsxRuntime.jsx("hr", { className: "payman-agent-hr my-4" }),
580
+ a: ({ href, children }) => /* @__PURE__ */ jsxRuntime.jsx(
581
+ "a",
582
+ {
583
+ href,
584
+ target: "_blank",
585
+ rel: "noopener noreferrer",
586
+ className: "payman-agent-link underline decoration-1 underline-offset-2",
587
+ children
588
+ }
589
+ ),
590
+ img: ({ src, alt }) => /* @__PURE__ */ jsxRuntime.jsx(
591
+ MarkdownImage,
592
+ {
593
+ src: typeof src === "string" ? src : void 0,
594
+ alt: typeof alt === "string" ? alt : void 0,
595
+ isResolving: options.isResolvingImages
596
+ }
597
+ ),
598
+ table: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative my-4 -mx-1 w-full overflow-x-auto", children: /* @__PURE__ */ jsxRuntime.jsx("table", { className: "payman-agent-table min-w-full caption-bottom overflow-hidden rounded-lg text-sm", children }) }),
599
+ thead: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("thead", { className: "payman-agent-thead [&_tr]:border-b", children }),
600
+ tbody: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "[&_tr:last-child]:border-0", children }),
601
+ tr: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("tr", { className: "payman-agent-tr border-b transition-colors", children }),
602
+ th: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("th", { className: "h-10 px-3 text-left align-middle text-xs font-medium whitespace-nowrap", children }),
603
+ td: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("td", { className: "p-3 align-middle text-sm whitespace-nowrap", children })
604
+ };
605
+ }
324
606
 
325
607
  // src/utils/errorMessages.ts
326
608
  var WORKFLOW_FAILED = "WORKFLOW_FAILED";
@@ -453,6 +735,12 @@ function AgentMessage({
453
735
  ),
454
736
  [message.steps, currentExecutingStepId]
455
737
  );
738
+ const markdownRenderers = react.useMemo(
739
+ () => createMarkdownComponents({
740
+ isResolvingImages: message.isResolvingImages
741
+ }),
742
+ [message.isResolvingImages]
743
+ );
456
744
  const getStepsLabel = (streaming) => {
457
745
  const count = message.steps.length;
458
746
  const stepWord = count === 1 ? "step" : "steps";
@@ -640,7 +928,7 @@ function AgentMessage({
640
928
  ReactMarkdown__default.default,
641
929
  {
642
930
  remarkPlugins: [remarkGfm__default.default],
643
- components: markdownComponents(),
931
+ components: markdownRenderers,
644
932
  children: isError ? conflictErrorMessage ?? FRIENDLY_ERROR_MESSAGE : content || (isStreaming ? "Thinking..." : isCancelled ? "Request was stopped." : "")
645
933
  }
646
934
  )
@@ -691,42 +979,6 @@ function AgentMessage({
691
979
  }
692
980
  return messageContent;
693
981
  }
694
- function markdownComponents(_isError) {
695
- return {
696
- p: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mb-3 last:mb-0 text-sm leading-relaxed", children }),
697
- code: ({ className: codeClassName, children }) => {
698
- const isInline = !codeClassName;
699
- return isInline ? /* @__PURE__ */ jsxRuntime.jsx("code", { className: "px-1.5 py-0.5 rounded-md text-xs font-mono break-all payman-agent-code-inline", children }) : /* @__PURE__ */ jsxRuntime.jsx("code", { className: "block p-3 rounded-lg text-xs font-mono overflow-x-auto my-2 whitespace-pre payman-agent-code-block", children });
700
- },
701
- pre: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "my-2 overflow-x-auto max-w-full rounded-lg", children }),
702
- ul: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "list-disc ml-4 mb-3 space-y-1 text-sm", children }),
703
- ol: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("ol", { className: "list-decimal ml-4 mb-3 space-y-1 text-sm", children }),
704
- li: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("li", { className: "text-sm leading-relaxed", children }),
705
- h1: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-lg font-semibold mb-2 mt-4 first:mt-0", children }),
706
- h2: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-base font-semibold mb-2 mt-3 first:mt-0", children }),
707
- h3: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-sm font-semibold mb-1 mt-2 first:mt-0", children }),
708
- strong: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("strong", { className: "font-semibold", children }),
709
- em: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("em", { className: "italic", children }),
710
- blockquote: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("blockquote", { className: "pl-4 my-2 italic payman-agent-blockquote", children }),
711
- hr: () => /* @__PURE__ */ jsxRuntime.jsx("hr", { className: "my-4 payman-agent-hr" }),
712
- a: ({ href, children }) => /* @__PURE__ */ jsxRuntime.jsx(
713
- "a",
714
- {
715
- href,
716
- target: "_blank",
717
- rel: "noopener noreferrer",
718
- className: "underline underline-offset-2 decoration-1 payman-agent-link",
719
- children
720
- }
721
- ),
722
- table: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative w-full overflow-x-auto my-4 -mx-1", children: /* @__PURE__ */ jsxRuntime.jsx("table", { className: "min-w-full caption-bottom text-sm rounded-lg overflow-hidden payman-agent-table", children }) }),
723
- thead: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("thead", { className: "[&_tr]:border-b payman-agent-thead", children }),
724
- tbody: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "[&_tr:last-child]:border-0", children }),
725
- tr: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("tr", { className: "border-b transition-colors payman-agent-tr", children }),
726
- th: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("th", { className: "h-10 px-3 text-left align-middle font-medium whitespace-nowrap text-xs", children }),
727
- td: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("td", { className: "p-3 align-middle text-sm whitespace-nowrap", children })
728
- };
729
- }
730
982
  function UserMessage({
731
983
  message,
732
984
  animated = false,
@@ -1780,6 +2032,11 @@ var PaymanChat = react.forwardRef(function PaymanChat2({
1780
2032
  const [inputValue, setInputValue] = react.useState("");
1781
2033
  const prevInputValueRef = react.useRef(inputValue);
1782
2034
  const [hasEverSentMessage, setHasEverSentMessage] = react.useState(false);
2035
+ react.useEffect(() => {
2036
+ if (config.sentryDsn) {
2037
+ initSentryIfNeeded(config.sentryDsn);
2038
+ }
2039
+ }, [config.sentryDsn]);
1783
2040
  const chat = paymanTypescriptAskSdk.useChat(config, callbacks);
1784
2041
  const {
1785
2042
  messages,