@paymanai/payman-ask-sdk 1.2.20 → 1.2.22

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.mjs CHANGED
@@ -4,6 +4,7 @@ import { AnimatePresence, motion } from 'framer-motion';
4
4
  import { createContext, forwardRef, useState, useRef, useEffect, useMemo, useImperativeHandle, useCallback, useLayoutEffect, useContext } from 'react';
5
5
  import { clsx } from 'clsx';
6
6
  import { twMerge } from 'tailwind-merge';
7
+ import * as Sentry from '@sentry/react';
7
8
  import { Check, RotateCcw, Mic, ArrowUp, ArrowDown, X, Loader2, User, Clock, Sparkles, Binoculars, ChevronDown, ChevronRight } from 'lucide-react';
8
9
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
9
10
  import ReactMarkdown from 'react-markdown';
@@ -53,6 +54,17 @@ function formatElapsedTime(ms) {
53
54
  if (ms < 1e3) return `${ms}ms`;
54
55
  return `${(ms / 1e3).toFixed(1)}s`;
55
56
  }
57
+ function initSentryIfNeeded(dsn) {
58
+ if (!dsn) return;
59
+ if (Sentry.getClient()) return;
60
+ Sentry.init({
61
+ dsn,
62
+ sendDefaultPii: true,
63
+ initialScope: {
64
+ tags: { source: "payman-ask-sdk" }
65
+ }
66
+ });
67
+ }
56
68
  var AI_DISCLAIMER_TEXT = "AI can make mistakes. Please double-check responses.";
57
69
  function ChatInput({
58
70
  value,
@@ -1995,6 +2007,11 @@ var PaymanChat = forwardRef(function PaymanChat2({
1995
2007
  const [inputValue, setInputValue] = useState("");
1996
2008
  const prevInputValueRef = useRef(inputValue);
1997
2009
  const [hasEverSentMessage, setHasEverSentMessage] = useState(false);
2010
+ useEffect(() => {
2011
+ if (config.sentryDsn) {
2012
+ initSentryIfNeeded(config.sentryDsn);
2013
+ }
2014
+ }, [config.sentryDsn]);
1998
2015
  const chat = useChat(config, callbacks);
1999
2016
  const {
2000
2017
  messages,