@aigentyc/chat-sdk 0.5.0 → 0.5.2

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.
Files changed (85) hide show
  1. package/dist/{ChatInterface-2MN5cpYB.d.ts → ChatInterface-CRmM_RG_.d.ts} +9 -1
  2. package/dist/{ChatInterface-BnVyOUG5.d.cts → ChatInterface-DKF3BY42.d.cts} +9 -1
  3. package/dist/{SlotsContext-BZBi51ZT.d.ts → SlotsContext-B_087V7B.d.ts} +11 -2
  4. package/dist/{SlotsContext-D_C7zlUA.d.cts → SlotsContext-DAQiASVu.d.cts} +11 -2
  5. package/dist/ai-elements.cjs +39 -27
  6. package/dist/ai-elements.d.cts +63 -1
  7. package/dist/ai-elements.d.ts +63 -1
  8. package/dist/ai-elements.js +2 -2
  9. package/dist/{chunk-3MP2EGEJ.cjs → chunk-72QJ2ORD.cjs} +4 -2
  10. package/dist/chunk-72QJ2ORD.cjs.map +1 -0
  11. package/dist/{chunk-KTYYLZN7.cjs → chunk-B277MAUK.cjs} +76 -4
  12. package/dist/chunk-B277MAUK.cjs.map +1 -0
  13. package/dist/{chunk-P3RPAI4F.cjs → chunk-BYX6IOGX.cjs} +4 -4
  14. package/dist/{chunk-P3RPAI4F.cjs.map → chunk-BYX6IOGX.cjs.map} +1 -1
  15. package/dist/chunk-CNPYBLLT.js +81 -0
  16. package/dist/chunk-CNPYBLLT.js.map +1 -0
  17. package/dist/{chunk-FJZL33KP.js → chunk-CW6LCVNC.js} +3 -3
  18. package/dist/{chunk-FJZL33KP.js.map → chunk-CW6LCVNC.js.map} +1 -1
  19. package/dist/{chunk-D75TDRBH.js → chunk-JAEXKKSE.js} +41 -35
  20. package/dist/chunk-JAEXKKSE.js.map +1 -0
  21. package/dist/{chunk-Q3UJEIBN.cjs → chunk-JEK2V5I3.cjs} +6 -6
  22. package/dist/{chunk-Q3UJEIBN.cjs.map → chunk-JEK2V5I3.cjs.map} +1 -1
  23. package/dist/{chunk-7ESWDFF5.cjs → chunk-KHQYSEYN.cjs} +244 -146
  24. package/dist/chunk-KHQYSEYN.cjs.map +1 -0
  25. package/dist/{chunk-QYCEHFAB.js → chunk-LDQVDUUJ.js} +4 -2
  26. package/dist/chunk-LDQVDUUJ.js.map +1 -0
  27. package/dist/{chunk-5XF3NEFB.js → chunk-O5TPHZRP.js} +74 -5
  28. package/dist/chunk-O5TPHZRP.js.map +1 -0
  29. package/dist/{chunk-BWWN5LSE.js → chunk-PNUHUUA3.js} +221 -124
  30. package/dist/chunk-PNUHUUA3.js.map +1 -0
  31. package/dist/{chunk-52ZHMTAA.cjs → chunk-UXVOUC2A.cjs} +41 -35
  32. package/dist/chunk-UXVOUC2A.cjs.map +1 -0
  33. package/dist/{chunk-IU7Q7O5G.js → chunk-VQPOUMBC.js} +3 -3
  34. package/dist/{chunk-IU7Q7O5G.js.map → chunk-VQPOUMBC.js.map} +1 -1
  35. package/dist/chunk-VYBHYFG3.cjs +87 -0
  36. package/dist/chunk-VYBHYFG3.cjs.map +1 -0
  37. package/dist/components.cjs +20 -19
  38. package/dist/components.cjs.map +1 -1
  39. package/dist/components.d.cts +2 -2
  40. package/dist/components.d.ts +2 -2
  41. package/dist/components.js +8 -7
  42. package/dist/components.js.map +1 -1
  43. package/dist/core.cjs +21 -82
  44. package/dist/core.cjs.map +1 -1
  45. package/dist/core.d.cts +2 -2
  46. package/dist/core.d.ts +2 -2
  47. package/dist/core.js +2 -78
  48. package/dist/core.js.map +1 -1
  49. package/dist/hooks.cjs +9 -8
  50. package/dist/hooks.cjs.map +1 -1
  51. package/dist/hooks.d.cts +2 -2
  52. package/dist/hooks.d.ts +2 -2
  53. package/dist/hooks.js +4 -3
  54. package/dist/hooks.js.map +1 -1
  55. package/dist/i18n.cjs +5 -5
  56. package/dist/i18n.d.cts +2 -2
  57. package/dist/i18n.d.ts +2 -2
  58. package/dist/i18n.js +1 -1
  59. package/dist/index.cjs +35 -26
  60. package/dist/index.cjs.map +1 -1
  61. package/dist/index.d.cts +28 -6
  62. package/dist/index.d.ts +28 -6
  63. package/dist/index.js +18 -13
  64. package/dist/index.js.map +1 -1
  65. package/dist/llms-full.txt +10 -10
  66. package/dist/styles.css +1 -1
  67. package/dist/theme.cjs +4 -4
  68. package/dist/theme.d.cts +1 -1
  69. package/dist/theme.d.ts +1 -1
  70. package/dist/theme.js +2 -2
  71. package/dist/tools.cjs +6 -5
  72. package/dist/tools.d.cts +2 -2
  73. package/dist/tools.d.ts +2 -2
  74. package/dist/tools.js +3 -2
  75. package/dist/{types-bsR_-fq8.d.cts → types-DRa1zFlN.d.cts} +10 -1
  76. package/dist/{types-bsR_-fq8.d.ts → types-DRa1zFlN.d.ts} +10 -1
  77. package/package.json +2 -2
  78. package/dist/chunk-3MP2EGEJ.cjs.map +0 -1
  79. package/dist/chunk-52ZHMTAA.cjs.map +0 -1
  80. package/dist/chunk-5XF3NEFB.js.map +0 -1
  81. package/dist/chunk-7ESWDFF5.cjs.map +0 -1
  82. package/dist/chunk-BWWN5LSE.js.map +0 -1
  83. package/dist/chunk-D75TDRBH.js.map +0 -1
  84. package/dist/chunk-KTYYLZN7.cjs.map +0 -1
  85. package/dist/chunk-QYCEHFAB.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/providers/ChatProvider.tsx","../src/components/Chat.tsx","../src/components/ChatWidget.tsx"],"names":["jsx","LiveChatProvider","PreviewEmbedProvider","I18nProvider","ThemeProvider","SlotsProvider","ChatContextProvider","jsxs","ChatInterface","usePreviewEmbed","useEffect","Fragment","useState","useIsMobile","useSlots","useCallback","useMemo","PreviewEmbedPanel","LiveChatPanel","cn","MobileLiveChatDrawer","renderSlot","FloatingButton"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAWA,IAAM,aAAA,GAA8C;AAAA,EAClD,SAAA;AAAA,EACA,gBAAA;AAAA,EACA,kBAAA;AAAA,EACA,eAAA;AAAA,EACA,mBAAA;AAAA,EACA,eAAA;AAAA,EACA,aAAA;AAAA,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A,IACA,cAAA;AAAA,IACA,iBAAA;AAAA,IACA,kBAAA;AAAA,IACA,oBAAA;AAAA,IACA,aAAA;AAAA,IACA,kBAAA;AAAA,IACA,YAAA;AAAA,IACA,OAAA;AAAA,IACA,YAAA;AAAA,IACA,eAAA;AAAA,IACA,iBAAA;AAAA,IACA,UAAA;AAAA,IACA,UAAA;AAAA,IACA,gBAAA;AAAA,IACA,eAAA;AAAA,IACA,qBAAA;AAAA,IACA,QAAA,EAAU,SAAA;AAAA,IACV,GAAG;AAAA,GACJ,GAAI,KAAA;AAEJ,EAAA,uBACCtB,cAAAA,CAAC,YAAA,EAAA,EAAc,GAAG,eACjB,QAAA,kBAAAA,cAAAA;AAAA,IAAC,eAAA;AAAA,IAAA;AAAA,MACA,IAAA;AAAA,MACA,QAAA;AAAA,MACA,cAAA;AAAA,MACA,MAAA;AAAA,MACA,YAAA;AAAA,MACA,cAAA;AAAA,MACA,MAAA;AAAA,MACA,YAAA;AAAA,MACA,eAAA;AAAA,MACA,eAAA;AAAA,MACA,gBAAA;AAAA,MACA,mBAAA;AAAA,MACA,mBAAA;AAAA,MACA,oBAAA;AAAA,MACA,oBAAA;AAAA,MACA,aAAA;AAAA,MACA,cAAA;AAAA,MACA,oBAAA;AAAA,MACA,WAAA;AAAA,MACA,YAAA;AAAA,MACA,cAAA;AAAA,MACA,iBAAA;AAAA,MACA,kBAAA;AAAA,MACA,oBAAA;AAAA,MACA,aAAA;AAAA,MACA,kBAAA;AAAA,MACA,YAAA;AAAA,MACA,OAAA;AAAA,MACA,YAAA;AAAA,MACA,eAAA;AAAA,MACA,iBAAA;AAAA,MACA,UAAA;AAAA,MACA,UAAA;AAAA,MACA,gBAAA;AAAA,MACA,eAAA;AAAA,MACA,qBAAA;AAAA,MACA,UAAU,aAAA,CAAc;AAAA;AAAA,GACzB,EACD,CAAA;AAEF","file":"index.cjs","sourcesContent":["\"use client\";\n\nimport { I18nProvider } from \"./I18nProvider\";\nimport { ThemeProvider } from \"./ThemeProvider\";\nimport { SlotsProvider } from \"./SlotsContext\";\nimport { ChatContextProvider } from \"./ChatContext\";\nimport { LiveChatProvider } from \"./LiveChatProvider\";\nimport { PreviewEmbedProvider } from \"./PreviewEmbedProvider\";\nimport type { ChatProviderProps, ChatEventCallbacks } from \"../core/types\";\nimport type { TranslationMap } from \"./I18nProvider\";\n\nconst CALLBACK_KEYS: (keyof ChatEventCallbacks)[] = [\n \"onReady\",\n \"onSessionStart\",\n \"onSessionRestore\",\n \"onMessageSent\",\n \"onMessageReceived\",\n \"onStreamStart\",\n \"onStreamEnd\",\n \"onToolCall\",\n \"onToolResult\",\n \"onToolAction\",\n \"onLiveChatRequested\",\n \"onLiveChatConnected\",\n \"onLiveChatEnded\",\n \"onError\",\n \"onNewConversation\",\n \"onStopGeneration\",\n \"onClearMessages\",\n \"onInteraction\",\n];\n\nfunction pickCallbacks(props: Record<string, unknown>): ChatEventCallbacks {\n const out: Record<string, unknown> = {};\n for (const key of CALLBACK_KEYS) {\n if (props[key] !== undefined) out[key] = props[key];\n }\n return out as ChatEventCallbacks;\n}\n\n/**\n * Top-level provider that composes all Aigentyc Chat sub-providers.\n *\n * Provider order (outermost to innermost):\n * 1. I18nProvider\n * 2. ThemeProvider (renders `<div data-aigentyc-chat>`)\n * 3. SlotsProvider\n * 4. ChatContextProvider\n * 5. LiveChatProvider (conditional on `enableLiveChat`)\n * 6. PreviewEmbedProvider\n */\nexport function ChatProvider(props: ChatProviderProps) {\n const {\n children,\n projectId,\n apiEndpoint,\n apiKey,\n clientName,\n pageUrl,\n pageTitle,\n pageContext,\n language,\n translations,\n theme,\n slots,\n enableLiveChat = false,\n chatServiceUrl,\n persistMessages: _persistMessages,\n maxMessages: _maxMessages,\n questions: _questions,\n ...rest\n } = props;\n\n const callbacks = pickCallbacks(rest as Record<string, unknown>);\n const config = {\n projectId,\n apiEndpoint,\n apiKey,\n clientName,\n pageUrl,\n pageTitle,\n pageContext,\n };\n\n // Flatten translations from per-language map into single overrides.\n const langCode = language ?? \"en\";\n const translationOverrides = translations?.[langCode] as Partial<TranslationMap> | undefined;\n\n const liveChatUrl = chatServiceUrl ?? apiEndpoint;\n const inner = enableLiveChat && liveChatUrl && apiKey ? (\n <LiveChatProvider\n chatServiceUrl={liveChatUrl}\n apiKey={apiKey}\n projectId={projectId || \"default\"}\n sessionId=\"default\"\n >\n <PreviewEmbedProvider>{children}</PreviewEmbedProvider>\n </LiveChatProvider>\n ) : (\n <PreviewEmbedProvider>{children}</PreviewEmbedProvider>\n );\n\n return (\n <I18nProvider language={language} translations={translationOverrides}>\n <ThemeProvider theme={theme}>\n <SlotsProvider slots={slots as never}>\n <ChatContextProvider\n config={config}\n callbacks={callbacks}\n >\n {inner}\n </ChatContextProvider>\n </SlotsProvider>\n </ThemeProvider>\n </I18nProvider>\n );\n}\n","\"use client\";\n\n/**\n * Chat — Level 1 drop-in embed component.\n *\n * Wraps everything in `<ChatProvider>` internally and renders `<ChatInterface />`\n * inline (no floating button, no overlay). Use this when you want to embed a\n * chat directly inside a page layout.\n */\n\nimport type { ChatProviderProps } from \"../core/types\";\nimport { ChatProvider } from \"../providers/ChatProvider\";\nimport { ChatInterface } from \"./ChatInterface\";\n\nexport interface ChatProps extends ChatProviderProps {\n /** Optional className forwarded to the ChatInterface root. */\n className?: string;\n /**\n * Show citation sources under each assistant message that used the\n * `searchKnowledgeBase` tool. Off by default.\n */\n showSources?: boolean;\n /**\n * Controls the rendering order of message parts (text vs tool results).\n * - `\"text-first\"` (default) — text parts render before tool cards\n * - `\"tools-first\"` — tool cards render before text\n * - `\"stream-order\"` — parts render in the order received from the API\n */\n messagePartOrder?: \"text-first\" | \"tools-first\" | \"stream-order\";\n}\n\nexport function Chat({ className, children, showSources, messagePartOrder, ...providerProps }: ChatProps) {\n return (\n <ChatProvider {...(providerProps as unknown as React.ComponentProps<typeof ChatProvider>)}>\n <div className={className}>\n <ChatInterface showSources={showSources} messagePartOrder={messagePartOrder} />\n {children}\n </div>\n </ChatProvider>\n );\n}\n\nexport default Chat;\n","\"use client\";\n\n/**\n * Top-level widget (Level 1 API).\n *\n * Composes ChatProvider internally and renders FloatingButton, ChatInterface,\n * LiveChatPanel, and PreviewEmbedPanel based on widget mode.\n */\n\nimport { useState, useCallback, useEffect, useMemo } from \"react\";\nimport { ChatProvider } from \"../providers/ChatProvider\";\nimport type { ChatProviderProps } from \"../core/types\";\nimport { useIsMobile } from \"../hooks/use-mobile\";\nimport { cn } from \"../core/utils\";\nimport { ChatInterface } from \"./ChatInterface\";\nimport { FloatingButton } from \"./FloatingButton\";\nimport { LiveChatPanel, MobileLiveChatDrawer } from \"./LiveChatPanel\";\nimport { PreviewEmbedPanel } from \"./PreviewEmbedPanel\";\nimport { usePreviewEmbed } from \"../providers/PreviewEmbedProvider\";\nimport { useSlots, renderSlot } from \"../providers/SlotsContext\";\n\n/** Widget placement mode. */\nexport type WidgetMode = \"floating\" | \"inline\" | \"trigger\";\n\nexport interface ChatWidgetProps extends ChatProviderProps {\n\t/** How the widget is rendered. Default \"floating\". */\n\tmode?: WidgetMode;\n\t/** Fixed position for the floating button. Default \"bottom-right\". */\n\tposition?: \"bottom-right\" | \"bottom-left\" | \"top-right\" | \"top-left\";\n\tpositionMobile?: \"bottom-right\" | \"bottom-left\" | \"top-right\" | \"top-left\";\n\t/** Controlled open state. */\n\tisOpen?: boolean;\n\t/** Fired whenever the widget opens/closes. */\n\tonOpenChange?: (open: boolean) => void;\n\t/** Message to pre-fill and auto-submit on open. */\n\tpendingMessage?: string | null;\n\t/** Overlay z-index (defaults to 9999). */\n\tzIndex?: number;\n\n\t// Floating button customisation\n\tgreetingText?: string;\n\tgreetingOffsetX?: string;\n\tgreetingOffsetY?: string;\n\tgreetingMaxWidth?: string;\n\tbuttonOffsetXMobile?: string;\n\tbuttonOffsetYMobile?: string;\n\tbuttonOffsetXDesktop?: string;\n\tbuttonOffsetYDesktop?: string;\n\tbuttonIconUrl?: string;\n\tbuttonImageUrl?: string;\n\tbuttonImageUrlMobile?: string;\n\tbuttonWidth?: string;\n\tbuttonHeight?: string;\n\tbuttonIconSize?: string;\n\tbuttonWidthMobile?: string;\n\tbuttonHeightMobile?: string;\n\tbuttonIconSizeMobile?: string;\n\tbuttonBgColor?: string;\n\tbuttonBorderRadius?: string;\n\thideGreeting?: boolean;\n\n\t// Welcome-page customisation (passed through to ChatInterface)\n\tlogoUrl?: string;\n\twelcomeTitle?: string;\n\twelcomeSubtitle?: string;\n\thideWelcomeHeader?: boolean;\n\tfooterText?: string;\n\thideHeader?: boolean;\n\tshowFirstMessage?: boolean;\n\tquestionsLayout?: \"vertical\" | \"horizontal\";\n\tquestionsLayoutMobile?: \"vertical\" | \"horizontal\";\n\t/** Show citation sources under each assistant message. Off by default. */\n\tshowSources?: boolean;\n\t/** Controls rendering order of message parts. Default: \"text-first\". */\n\tmessagePartOrder?: \"text-first\" | \"tools-first\" | \"stream-order\";\n}\n\n/** Bridges the \"widget-preview-open\" custom event to the PreviewEmbed context. */\nfunction PreviewEventBridge() {\n\tconst previewEmbed = usePreviewEmbed();\n\n\tuseEffect(() => {\n\t\tif (!previewEmbed || typeof window === \"undefined\") return;\n\t\tconst handler = (e: Event) => {\n\t\t\tconst { url, title, description } = (e as CustomEvent).detail || {};\n\t\t\tif (url) previewEmbed.openPreview({ url, title, description });\n\t\t};\n\t\twindow.addEventListener(\"widget-preview-open\", handler);\n\t\treturn () => window.removeEventListener(\"widget-preview-open\", handler);\n\t}, [previewEmbed]);\n\n\treturn null;\n}\n\n/** Mobile preview drawer — slides up from bottom of the widget. */\nfunction MobilePreviewDrawer() {\n\tconst previewEmbed = usePreviewEmbed();\n\tconst isVisible = !!previewEmbed?.preview;\n\tconst preview = previewEmbed?.preview;\n\tconst closePreview = previewEmbed?.closePreview;\n\n\treturn (\n\t\t<>\n\t\t\t<div\n\t\t\t\tclassName=\"absolute inset-0 z-40 bg-black/50\"\n\t\t\t\tstyle={{\n\t\t\t\t\topacity: isVisible ? 1 : 0,\n\t\t\t\t\tpointerEvents: isVisible ? \"auto\" : \"none\",\n\t\t\t\t\ttransition: \"opacity 200ms ease-out\",\n\t\t\t\t}}\n\t\t\t\tonClick={closePreview}\n\t\t\t/>\n\t\t\t<div\n\t\t\t\tclassName=\"absolute inset-x-0 bottom-0 z-50 rounded-t-2xl border-t shadow-2xl\"\n\t\t\t\tstyle={{\n\t\t\t\t\tbackgroundColor: \"var(--ac-background)\",\n\t\t\t\t\tborderColor: \"var(--ac-border)\",\n\t\t\t\t\theight: \"calc(100dvh - 150px)\",\n\t\t\t\t\ttransform: isVisible ? \"translateY(0)\" : \"translateY(100%)\",\n\t\t\t\t\ttransition: \"transform 300ms cubic-bezier(0.32, 0.72, 0, 1)\",\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<div className=\"flex justify-center pt-3 pb-1\">\n\t\t\t\t\t<div className=\"w-[100px] h-2 rounded-full bg-muted\" />\n\t\t\t\t</div>\n\t\t\t\t<div className=\"px-5 py-3 flex items-center justify-between\">\n\t\t\t\t\t<div className=\"min-w-0\">\n\t\t\t\t\t\t<h3 className=\"font-medium text-sm truncate\" style={{ color: \"var(--ac-text)\" }}>\n\t\t\t\t\t\t\t{preview?.title || \"Preview\"}\n\t\t\t\t\t\t</h3>\n\t\t\t\t\t\t{preview?.description && (\n\t\t\t\t\t\t\t<p className=\"text-xs text-muted-foreground mt-0.5 truncate\">{preview.description}</p>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tonClick={closePreview}\n\t\t\t\t\t\tclassName=\"shrink-0 w-8 h-8 rounded-full border flex items-center justify-center hover:bg-muted transition-colors ml-3\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<span className=\"sr-only\">Close</span>&times;\n\t\t\t\t\t</button>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"px-4 pb-4 flex-1\" style={{ height: \"calc(100% - 80px)\" }}>\n\t\t\t\t\t{preview && (\n\t\t\t\t\t\t<iframe\n\t\t\t\t\t\t\tkey={preview.url}\n\t\t\t\t\t\t\tsrc={preview.url}\n\t\t\t\t\t\t\tclassName=\"w-full h-full rounded-xl border-none\"\n\t\t\t\t\t\t\tsandbox=\"allow-scripts allow-same-origin allow-forms allow-popups allow-presentation\"\n\t\t\t\t\t\t\ttitle={preview.title || \"Preview\"}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\n/** Props for the inner widget shell — does not include ChatProvider config. */\ntype ChatWidgetInnerProps = Omit<\n\tChatWidgetProps,\n\tkeyof ChatProviderProps | \"children\"\n> & { language?: string };\n\n/** Inner component — rendered inside ChatProvider so it can read context. */\nfunction ChatWidgetInner({\n\tmode = \"floating\",\n\tposition = \"bottom-right\",\n\tpositionMobile,\n\tisOpen: controlledIsOpen,\n\tonOpenChange,\n\tpendingMessage: initialPendingMessage,\n\tzIndex,\n\tgreetingText,\n\tgreetingOffsetX,\n\tgreetingOffsetY,\n\tgreetingMaxWidth,\n\tbuttonOffsetXMobile,\n\tbuttonOffsetYMobile,\n\tbuttonOffsetXDesktop,\n\tbuttonOffsetYDesktop,\n\tbuttonIconUrl,\n\tbuttonImageUrl,\n\tbuttonImageUrlMobile,\n\tbuttonWidth,\n\tbuttonHeight,\n\tbuttonIconSize,\n\tbuttonWidthMobile,\n\tbuttonHeightMobile,\n\tbuttonIconSizeMobile,\n\tbuttonBgColor,\n\tbuttonBorderRadius,\n\thideGreeting,\n\tlogoUrl,\n\twelcomeTitle,\n\twelcomeSubtitle,\n\thideWelcomeHeader,\n\tfooterText,\n\thideHeader,\n\tshowFirstMessage,\n\tquestionsLayout,\n\tquestionsLayoutMobile,\n\tshowSources,\n\tmessagePartOrder,\n\tlanguage,\n}: ChatWidgetInnerProps) {\n\tconst [internalIsOpen, setInternalIsOpen] = useState(false);\n\tconst [pendingMessage, setPendingMessage] = useState<string | null>(initialPendingMessage ?? null);\n\tconst isMobile = useIsMobile();\n\tconst slots = useSlots();\n\n\tuseEffect(() => {\n\t\tif (controlledIsOpen === true) setInternalIsOpen(true);\n\t}, [controlledIsOpen]);\n\n\tconst isOpen = internalIsOpen;\n\n\t// Lock body scroll when open (except in inline mode)\n\tuseEffect(() => {\n\t\tif (mode === \"inline\" || typeof document === \"undefined\") return;\n\t\tif (isOpen) {\n\t\t\tconst originalStyle = window.getComputedStyle(document.body).overflow;\n\t\t\tdocument.body.style.overflow = \"hidden\";\n\t\t\treturn () => {\n\t\t\t\tdocument.body.style.overflow = originalStyle;\n\t\t\t};\n\t\t}\n\t}, [isOpen, mode]);\n\n\tconst handleOpen = useCallback(() => {\n\t\tsetInternalIsOpen(true);\n\t\tonOpenChange?.(true);\n\t}, [onOpenChange]);\n\n\tconst handleClose = useCallback(() => {\n\t\tsetInternalIsOpen(false);\n\t\tonOpenChange?.(false);\n\t}, [onOpenChange]);\n\n\tconst handleToggle = useCallback(() => {\n\t\tif (isOpen) handleClose();\n\t\telse handleOpen();\n\t}, [isOpen, handleOpen, handleClose]);\n\n\tconst isRightSide = position === \"bottom-right\" || position === \"top-right\";\n\tconst dirRTL = language === \"he\";\n\n\tconst chatInterfaceProps = useMemo(\n\t\t() => ({\n\t\t\tisOpen,\n\t\t\tonClose: handleClose,\n\t\t\tlogoUrl,\n\t\t\twelcomeTitle,\n\t\t\twelcomeSubtitle,\n\t\t\thideWelcomeHeader,\n\t\t\tfooterText,\n\t\t\thideHeader,\n\t\t\tshowFirstMessage,\n\t\t\tquestionsLayout,\n\t\t\tquestionsLayoutMobile,\n\t\t\tshowSources,\n\t\t\tmessagePartOrder,\n\t\t\tpendingMessage,\n\t\t\tonPendingMessageConsumed: () => setPendingMessage(null),\n\t\t}),\n\t\t[isOpen, handleClose, logoUrl, welcomeTitle, welcomeSubtitle, hideWelcomeHeader, footerText, hideHeader, showFirstMessage, questionsLayout, questionsLayoutMobile, showSources, messagePartOrder, pendingMessage],\n\t);\n\n\t// Inline mode\n\tif (mode === \"inline\") {\n\t\treturn (\n\t\t\t<div className=\"flex flex-col w-full h-full\" dir={dirRTL ? \"rtl\" : \"ltr\"} style={{ backgroundColor: \"var(--ac-background)\" }}>\n\t\t\t\t<ChatInterface {...chatInterfaceProps} />\n\t\t\t</div>\n\t\t);\n\t}\n\n\tconst panelZIndex = zIndex || 9999;\n\n\t// Floating button slot props\n\tconst floatingButtonProps = {\n\t\tonClick: handleToggle,\n\t\tposition,\n\t\tpositionMobile,\n\t\tisOpen,\n\t\tgreeting: greetingText,\n\t\tgreetingOffsetX,\n\t\tgreetingOffsetY,\n\t\tgreetingMaxWidth,\n\t\tbuttonOffsetXMobile,\n\t\tbuttonOffsetYMobile,\n\t\tbuttonOffsetXDesktop,\n\t\tbuttonOffsetYDesktop,\n\t\tbuttonIconUrl,\n\t\tbuttonImageUrl,\n\t\tbuttonImageUrlMobile,\n\t\tbuttonWidth,\n\t\tbuttonHeight,\n\t\tbuttonIconSize,\n\t\tbuttonWidthMobile,\n\t\tbuttonHeightMobile,\n\t\tbuttonIconSizeMobile,\n\t\tbuttonBgColor,\n\t\tbuttonBorderRadius,\n\t\tzIndex: zIndex || 999999,\n\t\thideGreeting,\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<PreviewEventBridge />\n\n\t\t\t{/* Overlay */}\n\t\t\t<div\n\t\t\t\tclassName=\"fixed inset-0 bg-black/50 transition-opacity duration-300 ease-in-out\"\n\t\t\t\tstyle={{\n\t\t\t\t\tzIndex: panelZIndex - 1,\n\t\t\t\t\topacity: isOpen ? 1 : 0,\n\t\t\t\t\tpointerEvents: isOpen ? \"auto\" : \"none\",\n\t\t\t\t}}\n\t\t\t\tonClick={handleClose}\n\t\t\t/>\n\n\t\t\t{!isMobile && <PreviewEmbedPanel isOpen={isOpen} isRightSide={isRightSide} zIndex={panelZIndex - 1} />}\n\t\t\t{!isMobile && <LiveChatPanel isWidgetOpen={isOpen} isRightSide={isRightSide} zIndex={panelZIndex - 1} />}\n\n\t\t\t{/* Main chat panel */}\n\t\t\t<div\n\t\t\t\tclassName={cn(\n\t\t\t\t\t\"fixed flex flex-col p-0 shadow-2xl\",\n\t\t\t\t\tisMobile\n\t\t\t\t\t\t? \"inset-x-0 rounded-t-2xl border-t\"\n\t\t\t\t\t\t: cn(\"inset-y-0 w-full max-w-[780px]\", isRightSide ? \"right-0 border-l\" : \"left-0 border-r\"),\n\t\t\t\t)}\n\t\t\t\tdir={dirRTL ? \"rtl\" : \"ltr\"}\n\t\t\t\tstyle={{\n\t\t\t\t\tbackgroundColor: \"var(--ac-background)\",\n\t\t\t\t\tborderColor: \"var(--ac-border)\",\n\t\t\t\t\t...(isMobile\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\ttop: \"70px\",\n\t\t\t\t\t\t\t\tbottom: 0,\n\t\t\t\t\t\t\t\theight: \"calc(100dvh - 70px)\",\n\t\t\t\t\t\t\t\ttransform: isOpen ? \"translateY(0)\" : \"translateY(100%)\",\n\t\t\t\t\t\t\t\topacity: isOpen ? 1 : 0,\n\t\t\t\t\t\t\t\tpointerEvents: isOpen ? \"auto\" : \"none\",\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\ttransform: isOpen ? \"translateX(0)\" : isRightSide ? \"translateX(100%)\" : \"translateX(-100%)\",\n\t\t\t\t\t\t\t\topacity: isOpen ? 1 : 0,\n\t\t\t\t\t\t\t\tpointerEvents: isOpen ? \"auto\" : \"none\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\ttransition: \"transform 300ms ease-in-out\",\n\t\t\t\t\tzIndex: panelZIndex,\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{isMobile && <MobilePreviewDrawer />}\n\t\t\t\t<MobileLiveChatDrawer />\n\n\t\t\t\t<ChatInterface {...chatInterfaceProps} />\n\t\t\t</div>\n\n\t\t\t{/* Floating button — hidden when open */}\n\t\t\t{!isOpen &&\n\t\t\t\trenderSlot(\n\t\t\t\t\t\"floatingButton\",\n\t\t\t\t\tfloatingButtonProps as never,\n\t\t\t\t\tFloatingButton as never,\n\t\t\t\t\tslots,\n\t\t\t\t)}\n\t\t</>\n\t);\n}\n\n/**\n * Top-level widget (Level 1 API). Composes ChatProvider internally and renders\n * the correct shell based on `mode`.\n */\nexport function ChatWidget(props: ChatWidgetProps) {\n\t// Split ChatProviderProps from widget-shell props.\n\tconst {\n\t\t// Widget shell props consumed by inner component (also forwarded separately)\n\t\tmode,\n\t\tposition,\n\t\tpositionMobile,\n\t\tisOpen,\n\t\tonOpenChange,\n\t\tpendingMessage,\n\t\tzIndex,\n\t\tgreetingText,\n\t\tgreetingOffsetX,\n\t\tgreetingOffsetY,\n\t\tgreetingMaxWidth,\n\t\tbuttonOffsetXMobile,\n\t\tbuttonOffsetYMobile,\n\t\tbuttonOffsetXDesktop,\n\t\tbuttonOffsetYDesktop,\n\t\tbuttonIconUrl,\n\t\tbuttonImageUrl,\n\t\tbuttonImageUrlMobile,\n\t\tbuttonWidth,\n\t\tbuttonHeight,\n\t\tbuttonIconSize,\n\t\tbuttonWidthMobile,\n\t\tbuttonHeightMobile,\n\t\tbuttonIconSizeMobile,\n\t\tbuttonBgColor,\n\t\tbuttonBorderRadius,\n\t\thideGreeting,\n\t\tlogoUrl,\n\t\twelcomeTitle,\n\t\twelcomeSubtitle,\n\t\thideWelcomeHeader,\n\t\tfooterText,\n\t\thideHeader,\n\t\tshowFirstMessage,\n\t\tquestionsLayout,\n\t\tquestionsLayoutMobile,\n\t\tchildren: _children,\n\t\t...providerProps\n\t} = props;\n\n\treturn (\n\t\t<ChatProvider {...providerProps}>\n\t\t\t<ChatWidgetInner\n\t\t\t\tmode={mode}\n\t\t\t\tposition={position}\n\t\t\t\tpositionMobile={positionMobile}\n\t\t\t\tisOpen={isOpen}\n\t\t\t\tonOpenChange={onOpenChange}\n\t\t\t\tpendingMessage={pendingMessage}\n\t\t\t\tzIndex={zIndex}\n\t\t\t\tgreetingText={greetingText}\n\t\t\t\tgreetingOffsetX={greetingOffsetX}\n\t\t\t\tgreetingOffsetY={greetingOffsetY}\n\t\t\t\tgreetingMaxWidth={greetingMaxWidth}\n\t\t\t\tbuttonOffsetXMobile={buttonOffsetXMobile}\n\t\t\t\tbuttonOffsetYMobile={buttonOffsetYMobile}\n\t\t\t\tbuttonOffsetXDesktop={buttonOffsetXDesktop}\n\t\t\t\tbuttonOffsetYDesktop={buttonOffsetYDesktop}\n\t\t\t\tbuttonIconUrl={buttonIconUrl}\n\t\t\t\tbuttonImageUrl={buttonImageUrl}\n\t\t\t\tbuttonImageUrlMobile={buttonImageUrlMobile}\n\t\t\t\tbuttonWidth={buttonWidth}\n\t\t\t\tbuttonHeight={buttonHeight}\n\t\t\t\tbuttonIconSize={buttonIconSize}\n\t\t\t\tbuttonWidthMobile={buttonWidthMobile}\n\t\t\t\tbuttonHeightMobile={buttonHeightMobile}\n\t\t\t\tbuttonIconSizeMobile={buttonIconSizeMobile}\n\t\t\t\tbuttonBgColor={buttonBgColor}\n\t\t\t\tbuttonBorderRadius={buttonBorderRadius}\n\t\t\t\thideGreeting={hideGreeting}\n\t\t\t\tlogoUrl={logoUrl}\n\t\t\t\twelcomeTitle={welcomeTitle}\n\t\t\t\twelcomeSubtitle={welcomeSubtitle}\n\t\t\t\thideWelcomeHeader={hideWelcomeHeader}\n\t\t\t\tfooterText={footerText}\n\t\t\t\thideHeader={hideHeader}\n\t\t\t\tshowFirstMessage={showFirstMessage}\n\t\t\t\tquestionsLayout={questionsLayout}\n\t\t\t\tquestionsLayoutMobile={questionsLayoutMobile}\n\t\t\t\tlanguage={providerProps.language as string | undefined}\n\t\t\t/>\n\t\t</ChatProvider>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["../src/providers/ChatProvider.tsx","../src/components/Chat.tsx","../src/components/ChatWidget.tsx"],"names":["jsx","LiveChatProvider","PreviewEmbedProvider","I18nProvider","ThemeProvider","SlotsProvider","ChatContextProvider","jsxs","ChatInterface","usePreviewEmbed","useEffect","Fragment","useState","useIsMobile","useSlots","useCallback","useMemo","PreviewEmbedPanel","LiveChatPanel","cn","MobileLiveChatDrawer","renderSlot","FloatingButton"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAWA,IAAM,aAAA,GAA8C;AAAA,EAClD,SAAA;AAAA,EACA,gBAAA;AAAA,EACA,kBAAA;AAAA,EACA,eAAA;AAAA,EACA,mBAAA;AAAA,EACA,eAAA;AAAA,EACA,aAAA;AAAA,EACA,YAAA;AAAA,EACA,cAAA;AAAA,EACA,cAAA;AAAA,EACA,qBAAA;AAAA,EACA,qBAAA;AAAA,EACA,iBAAA;AAAA,EACA,SAAA;AAAA,EACA,mBAAA;AAAA,EACA,kBAAA;AAAA,EACA,iBAAA;AAAA,EACA;AACF,CAAA;AAEA,SAAS,cAAc,KAAA,EAAoD;AACzE,EAAA,MAAM,MAA+B,EAAC;AACtC,EAAA,KAAA,MAAW,OAAO,aAAA,EAAe;AAC/B,IAAA,IAAI,KAAA,CAAM,GAAG,CAAA,KAAM,MAAA,MAAe,GAAG,CAAA,GAAI,MAAM,GAAG,CAAA;AAAA,EACpD;AACA,EAAA,OAAO,GAAA;AACT;AAaO,SAAS,aAAa,KAAA,EAA0B;AACrD,EAAA,MAAM;AAAA,IACJ,QAAA;AAAA,IACA,SAAA;AAAA,IACA,WAAA;AAAA,IACA,MAAA;AAAA,IACA,UAAA;AAAA,IACA,OAAA;AAAA,IACA,SAAA;AAAA,IACA,WAAA;AAAA,IACA,QAAA;AAAA,IACA,YAAA;AAAA,IACA,KAAA;AAAA,IACA,KAAA;AAAA,IACA,cAAA,GAAiB,KAAA;AAAA,IACjB,cAAA;AAAA,IACA,eAAA,EAAiB,gBAAA;AAAA,IACjB,WAAA,EAAa,YAAA;AAAA,IACb,SAAA,EAAW,UAAA;AAAA,IACX,GAAG;AAAA,GACL,GAAI,KAAA;AAEJ,EAAA,MAAM,SAAA,GAAY,cAAc,IAA+B,CAAA;AAC/D,EAAA,MAAM,MAAA,GAAS;AAAA,IACb,SAAA;AAAA,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,MACA,aAAA;AAAA,MACA,kBAAA;AAAA,MACA,YAAA;AAAA,MACA,OAAA;AAAA,MACA,YAAA;AAAA,MACA,eAAA;AAAA,MACA,iBAAA;AAAA,MACA,UAAA;AAAA,MACA,UAAA;AAAA,MACA,gBAAA;AAAA,MACA,eAAA;AAAA,MACA,qBAAA;AAAA,MACA,YAAA;AAAA,MACA,UAAU,aAAA,CAAc;AAAA;AAAA,GACzB,EACD,CAAA;AAEF","file":"index.cjs","sourcesContent":["\"use client\";\n\nimport { I18nProvider } from \"./I18nProvider\";\nimport { ThemeProvider } from \"./ThemeProvider\";\nimport { SlotsProvider } from \"./SlotsContext\";\nimport { ChatContextProvider } from \"./ChatContext\";\nimport { LiveChatProvider } from \"./LiveChatProvider\";\nimport { PreviewEmbedProvider } from \"./PreviewEmbedProvider\";\nimport type { ChatProviderProps, ChatEventCallbacks } from \"../core/types\";\nimport type { TranslationMap } from \"./I18nProvider\";\n\nconst CALLBACK_KEYS: (keyof ChatEventCallbacks)[] = [\n \"onReady\",\n \"onSessionStart\",\n \"onSessionRestore\",\n \"onMessageSent\",\n \"onMessageReceived\",\n \"onStreamStart\",\n \"onStreamEnd\",\n \"onToolCall\",\n \"onToolResult\",\n \"onToolAction\",\n \"onLiveChatRequested\",\n \"onLiveChatConnected\",\n \"onLiveChatEnded\",\n \"onError\",\n \"onNewConversation\",\n \"onStopGeneration\",\n \"onClearMessages\",\n \"onInteraction\",\n];\n\nfunction pickCallbacks(props: Record<string, unknown>): ChatEventCallbacks {\n const out: Record<string, unknown> = {};\n for (const key of CALLBACK_KEYS) {\n if (props[key] !== undefined) out[key] = props[key];\n }\n return out as ChatEventCallbacks;\n}\n\n/**\n * Top-level provider that composes all Aigentyc Chat sub-providers.\n *\n * Provider order (outermost to innermost):\n * 1. I18nProvider\n * 2. ThemeProvider (renders `<div data-aigentyc-chat>`)\n * 3. SlotsProvider\n * 4. ChatContextProvider\n * 5. LiveChatProvider (conditional on `enableLiveChat`)\n * 6. PreviewEmbedProvider\n */\nexport function ChatProvider(props: ChatProviderProps) {\n const {\n children,\n projectId,\n apiEndpoint,\n apiKey,\n clientName,\n pageUrl,\n pageTitle,\n pageContext,\n language,\n translations,\n theme,\n slots,\n enableLiveChat = false,\n chatServiceUrl,\n persistMessages: _persistMessages,\n maxMessages: _maxMessages,\n questions: _questions,\n ...rest\n } = props;\n\n const callbacks = pickCallbacks(rest as Record<string, unknown>);\n const config = {\n projectId,\n apiEndpoint,\n apiKey,\n clientName,\n pageUrl,\n pageTitle,\n pageContext,\n };\n\n // Flatten translations from per-language map into single overrides.\n const langCode = language ?? \"en\";\n const translationOverrides = translations?.[langCode] as Partial<TranslationMap> | undefined;\n\n const liveChatUrl = chatServiceUrl ?? apiEndpoint;\n const inner = enableLiveChat && liveChatUrl && apiKey ? (\n <LiveChatProvider\n chatServiceUrl={liveChatUrl}\n apiKey={apiKey}\n projectId={projectId || \"default\"}\n sessionId=\"default\"\n >\n <PreviewEmbedProvider>{children}</PreviewEmbedProvider>\n </LiveChatProvider>\n ) : (\n <PreviewEmbedProvider>{children}</PreviewEmbedProvider>\n );\n\n return (\n <I18nProvider language={language} translations={translationOverrides}>\n <ThemeProvider theme={theme}>\n <SlotsProvider slots={slots as never}>\n <ChatContextProvider\n config={config}\n callbacks={callbacks}\n >\n {inner}\n </ChatContextProvider>\n </SlotsProvider>\n </ThemeProvider>\n </I18nProvider>\n );\n}\n","\"use client\";\n\n/**\n * Chat — Level 1 drop-in embed component.\n *\n * Wraps everything in `<ChatProvider>` internally and renders `<ChatInterface />`\n * inline (no floating button, no overlay). Use this when you want to embed a\n * chat directly inside a page layout.\n */\n\nimport type { ChatProviderProps } from \"../core/types\";\nimport { ChatProvider } from \"../providers/ChatProvider\";\nimport { ChatInterface } from \"./ChatInterface\";\n\nexport interface ChatProps extends ChatProviderProps {\n /** Optional className forwarded to the ChatInterface root. */\n className?: string;\n /**\n * Show citation sources under each assistant message that used the\n * `searchKnowledgeBase` tool. Off by default.\n */\n showSources?: boolean;\n /**\n * Controls the rendering order of message parts (text vs tool results).\n * - `\"text-first\"` (default) — text parts render before tool cards\n * - `\"tools-first\"` — tool cards render before text\n * - `\"stream-order\"` — parts render in the order received from the API\n */\n messagePartOrder?: \"text-first\" | \"tools-first\" | \"stream-order\";\n /**\n * Where the view settles while an answer streams in.\n * - `\"latest-turn\"` (default) — the question stays at the top\n * - `\"bottom\"` — always follows the end of the content\n */\n scrollAnchor?: \"latest-turn\" | \"bottom\";\n}\n\nexport function Chat({ className, children, showSources, messagePartOrder, scrollAnchor, ...providerProps }: ChatProps) {\n return (\n <ChatProvider {...(providerProps as unknown as React.ComponentProps<typeof ChatProvider>)}>\n <div className={className}>\n <ChatInterface showSources={showSources} messagePartOrder={messagePartOrder} scrollAnchor={scrollAnchor} />\n {children}\n </div>\n </ChatProvider>\n );\n}\n\nexport default Chat;\n","\"use client\";\n\n/**\n * Top-level widget (Level 1 API).\n *\n * Composes ChatProvider internally and renders FloatingButton, ChatInterface,\n * LiveChatPanel, and PreviewEmbedPanel based on widget mode.\n */\n\nimport { useState, useCallback, useEffect, useMemo } from \"react\";\nimport { ChatProvider } from \"../providers/ChatProvider\";\nimport type { ChatProviderProps } from \"../core/types\";\nimport { useIsMobile } from \"../hooks/use-mobile\";\nimport { cn } from \"../core/utils\";\nimport { ChatInterface } from \"./ChatInterface\";\nimport { FloatingButton } from \"./FloatingButton\";\nimport { LiveChatPanel, MobileLiveChatDrawer } from \"./LiveChatPanel\";\nimport { PreviewEmbedPanel } from \"./PreviewEmbedPanel\";\nimport { usePreviewEmbed } from \"../providers/PreviewEmbedProvider\";\nimport { useSlots, renderSlot } from \"../providers/SlotsContext\";\n\n/** Widget placement mode. */\nexport type WidgetMode = \"floating\" | \"inline\" | \"trigger\";\n\nexport interface ChatWidgetProps extends ChatProviderProps {\n\t/** How the widget is rendered. Default \"floating\". */\n\tmode?: WidgetMode;\n\t/** Fixed position for the floating button. Default \"bottom-right\". */\n\tposition?: \"bottom-right\" | \"bottom-left\" | \"top-right\" | \"top-left\";\n\tpositionMobile?: \"bottom-right\" | \"bottom-left\" | \"top-right\" | \"top-left\";\n\t/** Controlled open state. */\n\tisOpen?: boolean;\n\t/** Fired whenever the widget opens/closes. */\n\tonOpenChange?: (open: boolean) => void;\n\t/** Message to pre-fill and auto-submit on open. */\n\tpendingMessage?: string | null;\n\t/** Overlay z-index (defaults to 9999). */\n\tzIndex?: number;\n\n\t// Floating button customisation\n\tgreetingText?: string;\n\tgreetingOffsetX?: string;\n\tgreetingOffsetY?: string;\n\tgreetingMaxWidth?: string;\n\tbuttonOffsetXMobile?: string;\n\tbuttonOffsetYMobile?: string;\n\tbuttonOffsetXDesktop?: string;\n\tbuttonOffsetYDesktop?: string;\n\tbuttonIconUrl?: string;\n\tbuttonImageUrl?: string;\n\tbuttonImageUrlMobile?: string;\n\tbuttonWidth?: string;\n\tbuttonHeight?: string;\n\tbuttonIconSize?: string;\n\tbuttonWidthMobile?: string;\n\tbuttonHeightMobile?: string;\n\tbuttonIconSizeMobile?: string;\n\tbuttonBgColor?: string;\n\tbuttonBorderRadius?: string;\n\thideGreeting?: boolean;\n\n\t// Welcome-page customisation (passed through to ChatInterface)\n\tlogoUrl?: string;\n\twelcomeTitle?: string;\n\twelcomeSubtitle?: string;\n\thideWelcomeHeader?: boolean;\n\tfooterText?: string;\n\thideHeader?: boolean;\n\tshowFirstMessage?: boolean;\n\tquestionsLayout?: \"vertical\" | \"horizontal\";\n\tquestionsLayoutMobile?: \"vertical\" | \"horizontal\";\n\t/** Show citation sources under each assistant message. Off by default. */\n\tshowSources?: boolean;\n\t/** Controls rendering order of message parts. Default: \"text-first\". */\n\tmessagePartOrder?: \"text-first\" | \"tools-first\" | \"stream-order\";\n\t/**\n\t * Where the view settles while an answer streams in. Default:\n\t * `\"latest-turn\"` — the visitor's question stays at the top and a long answer\n\t * is read from its first line. `\"bottom\"` always follows the end.\n\t */\n\tscrollAnchor?: \"latest-turn\" | \"bottom\";\n}\n\n/** Bridges the \"widget-preview-open\" custom event to the PreviewEmbed context. */\nfunction PreviewEventBridge() {\n\tconst previewEmbed = usePreviewEmbed();\n\n\tuseEffect(() => {\n\t\tif (!previewEmbed || typeof window === \"undefined\") return;\n\t\tconst handler = (e: Event) => {\n\t\t\tconst { url, title, description } = (e as CustomEvent).detail || {};\n\t\t\tif (url) previewEmbed.openPreview({ url, title, description });\n\t\t};\n\t\twindow.addEventListener(\"widget-preview-open\", handler);\n\t\treturn () => window.removeEventListener(\"widget-preview-open\", handler);\n\t}, [previewEmbed]);\n\n\treturn null;\n}\n\n/** Mobile preview drawer — slides up from bottom of the widget. */\nfunction MobilePreviewDrawer() {\n\tconst previewEmbed = usePreviewEmbed();\n\tconst isVisible = !!previewEmbed?.preview;\n\tconst preview = previewEmbed?.preview;\n\tconst closePreview = previewEmbed?.closePreview;\n\n\treturn (\n\t\t<>\n\t\t\t<div\n\t\t\t\tclassName=\"absolute inset-0 z-40 bg-black/50\"\n\t\t\t\tstyle={{\n\t\t\t\t\topacity: isVisible ? 1 : 0,\n\t\t\t\t\tpointerEvents: isVisible ? \"auto\" : \"none\",\n\t\t\t\t\ttransition: \"opacity 200ms ease-out\",\n\t\t\t\t}}\n\t\t\t\tonClick={closePreview}\n\t\t\t/>\n\t\t\t<div\n\t\t\t\tclassName=\"absolute inset-x-0 bottom-0 z-50 rounded-t-2xl border-t shadow-2xl\"\n\t\t\t\tstyle={{\n\t\t\t\t\tbackgroundColor: \"var(--ac-background)\",\n\t\t\t\t\tborderColor: \"var(--ac-border)\",\n\t\t\t\t\theight: \"calc(100dvh - 150px)\",\n\t\t\t\t\ttransform: isVisible ? \"translateY(0)\" : \"translateY(100%)\",\n\t\t\t\t\ttransition: \"transform 300ms cubic-bezier(0.32, 0.72, 0, 1)\",\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<div className=\"flex justify-center pt-3 pb-1\">\n\t\t\t\t\t<div className=\"w-[100px] h-2 rounded-full bg-muted\" />\n\t\t\t\t</div>\n\t\t\t\t<div className=\"px-5 py-3 flex items-center justify-between\">\n\t\t\t\t\t<div className=\"min-w-0\">\n\t\t\t\t\t\t<h3 className=\"font-medium text-sm truncate\" style={{ color: \"var(--ac-text)\" }}>\n\t\t\t\t\t\t\t{preview?.title || \"Preview\"}\n\t\t\t\t\t\t</h3>\n\t\t\t\t\t\t{preview?.description && (\n\t\t\t\t\t\t\t<p className=\"text-xs text-muted-foreground mt-0.5 truncate\">{preview.description}</p>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tonClick={closePreview}\n\t\t\t\t\t\tclassName=\"shrink-0 w-8 h-8 rounded-full border flex items-center justify-center hover:bg-muted transition-colors ml-3\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<span className=\"sr-only\">Close</span>&times;\n\t\t\t\t\t</button>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"px-4 pb-4 flex-1\" style={{ height: \"calc(100% - 80px)\" }}>\n\t\t\t\t\t{preview && (\n\t\t\t\t\t\t<iframe\n\t\t\t\t\t\t\tkey={preview.url}\n\t\t\t\t\t\t\tsrc={preview.url}\n\t\t\t\t\t\t\tclassName=\"w-full h-full rounded-xl border-none\"\n\t\t\t\t\t\t\tsandbox=\"allow-scripts allow-same-origin allow-forms allow-popups allow-presentation\"\n\t\t\t\t\t\t\ttitle={preview.title || \"Preview\"}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\n/** Props for the inner widget shell — does not include ChatProvider config. */\ntype ChatWidgetInnerProps = Omit<\n\tChatWidgetProps,\n\tkeyof ChatProviderProps | \"children\"\n> & { language?: string };\n\n/** Inner component — rendered inside ChatProvider so it can read context. */\nfunction ChatWidgetInner({\n\tmode = \"floating\",\n\tposition = \"bottom-right\",\n\tpositionMobile,\n\tisOpen: controlledIsOpen,\n\tonOpenChange,\n\tpendingMessage: initialPendingMessage,\n\tzIndex,\n\tgreetingText,\n\tgreetingOffsetX,\n\tgreetingOffsetY,\n\tgreetingMaxWidth,\n\tbuttonOffsetXMobile,\n\tbuttonOffsetYMobile,\n\tbuttonOffsetXDesktop,\n\tbuttonOffsetYDesktop,\n\tbuttonIconUrl,\n\tbuttonImageUrl,\n\tbuttonImageUrlMobile,\n\tbuttonWidth,\n\tbuttonHeight,\n\tbuttonIconSize,\n\tbuttonWidthMobile,\n\tbuttonHeightMobile,\n\tbuttonIconSizeMobile,\n\tbuttonBgColor,\n\tbuttonBorderRadius,\n\thideGreeting,\n\tlogoUrl,\n\twelcomeTitle,\n\twelcomeSubtitle,\n\thideWelcomeHeader,\n\tfooterText,\n\thideHeader,\n\tshowFirstMessage,\n\tquestionsLayout,\n\tquestionsLayoutMobile,\n\tshowSources,\n\tmessagePartOrder,\n\tscrollAnchor,\n\tlanguage,\n}: ChatWidgetInnerProps) {\n\tconst [internalIsOpen, setInternalIsOpen] = useState(false);\n\tconst [pendingMessage, setPendingMessage] = useState<string | null>(initialPendingMessage ?? null);\n\tconst isMobile = useIsMobile();\n\tconst slots = useSlots();\n\n\tuseEffect(() => {\n\t\tif (controlledIsOpen === true) setInternalIsOpen(true);\n\t}, [controlledIsOpen]);\n\n\tconst isOpen = internalIsOpen;\n\n\t// Lock body scroll when open (except in inline mode)\n\tuseEffect(() => {\n\t\tif (mode === \"inline\" || typeof document === \"undefined\") return;\n\t\tif (isOpen) {\n\t\t\tconst originalStyle = window.getComputedStyle(document.body).overflow;\n\t\t\tdocument.body.style.overflow = \"hidden\";\n\t\t\treturn () => {\n\t\t\t\tdocument.body.style.overflow = originalStyle;\n\t\t\t};\n\t\t}\n\t}, [isOpen, mode]);\n\n\tconst handleOpen = useCallback(() => {\n\t\tsetInternalIsOpen(true);\n\t\tonOpenChange?.(true);\n\t}, [onOpenChange]);\n\n\tconst handleClose = useCallback(() => {\n\t\tsetInternalIsOpen(false);\n\t\tonOpenChange?.(false);\n\t}, [onOpenChange]);\n\n\tconst handleToggle = useCallback(() => {\n\t\tif (isOpen) handleClose();\n\t\telse handleOpen();\n\t}, [isOpen, handleOpen, handleClose]);\n\n\tconst isRightSide = position === \"bottom-right\" || position === \"top-right\";\n\tconst dirRTL = language === \"he\";\n\n\tconst chatInterfaceProps = useMemo(\n\t\t() => ({\n\t\t\tisOpen,\n\t\t\tonClose: handleClose,\n\t\t\tlogoUrl,\n\t\t\twelcomeTitle,\n\t\t\twelcomeSubtitle,\n\t\t\thideWelcomeHeader,\n\t\t\tfooterText,\n\t\t\thideHeader,\n\t\t\tshowFirstMessage,\n\t\t\tquestionsLayout,\n\t\t\tquestionsLayoutMobile,\n\t\t\tshowSources,\n\t\t\tmessagePartOrder,\n\t\t\tscrollAnchor,\n\t\t\tpendingMessage,\n\t\t\tonPendingMessageConsumed: () => setPendingMessage(null),\n\t\t}),\n\t\t[isOpen, handleClose, logoUrl, welcomeTitle, welcomeSubtitle, hideWelcomeHeader, footerText, hideHeader, showFirstMessage, questionsLayout, questionsLayoutMobile, showSources, messagePartOrder, scrollAnchor, pendingMessage],\n\t);\n\n\t// Inline mode\n\tif (mode === \"inline\") {\n\t\treturn (\n\t\t\t<div className=\"flex flex-col w-full h-full\" dir={dirRTL ? \"rtl\" : \"ltr\"} style={{ backgroundColor: \"var(--ac-background)\" }}>\n\t\t\t\t<ChatInterface {...chatInterfaceProps} />\n\t\t\t</div>\n\t\t);\n\t}\n\n\tconst panelZIndex = zIndex || 9999;\n\n\t// Floating button slot props\n\tconst floatingButtonProps = {\n\t\tonClick: handleToggle,\n\t\tposition,\n\t\tpositionMobile,\n\t\tisOpen,\n\t\tgreeting: greetingText,\n\t\tgreetingOffsetX,\n\t\tgreetingOffsetY,\n\t\tgreetingMaxWidth,\n\t\tbuttonOffsetXMobile,\n\t\tbuttonOffsetYMobile,\n\t\tbuttonOffsetXDesktop,\n\t\tbuttonOffsetYDesktop,\n\t\tbuttonIconUrl,\n\t\tbuttonImageUrl,\n\t\tbuttonImageUrlMobile,\n\t\tbuttonWidth,\n\t\tbuttonHeight,\n\t\tbuttonIconSize,\n\t\tbuttonWidthMobile,\n\t\tbuttonHeightMobile,\n\t\tbuttonIconSizeMobile,\n\t\tbuttonBgColor,\n\t\tbuttonBorderRadius,\n\t\tzIndex: zIndex || 999999,\n\t\thideGreeting,\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<PreviewEventBridge />\n\n\t\t\t{/* Overlay */}\n\t\t\t<div\n\t\t\t\tclassName=\"fixed inset-0 bg-black/50 transition-opacity duration-300 ease-in-out\"\n\t\t\t\tstyle={{\n\t\t\t\t\tzIndex: panelZIndex - 1,\n\t\t\t\t\topacity: isOpen ? 1 : 0,\n\t\t\t\t\tpointerEvents: isOpen ? \"auto\" : \"none\",\n\t\t\t\t}}\n\t\t\t\tonClick={handleClose}\n\t\t\t/>\n\n\t\t\t{!isMobile && <PreviewEmbedPanel isOpen={isOpen} isRightSide={isRightSide} zIndex={panelZIndex - 1} />}\n\t\t\t{!isMobile && <LiveChatPanel isWidgetOpen={isOpen} isRightSide={isRightSide} zIndex={panelZIndex - 1} />}\n\n\t\t\t{/* Main chat panel */}\n\t\t\t<div\n\t\t\t\tclassName={cn(\n\t\t\t\t\t\"fixed flex flex-col p-0 shadow-2xl\",\n\t\t\t\t\tisMobile\n\t\t\t\t\t\t? \"inset-x-0 rounded-t-2xl border-t\"\n\t\t\t\t\t\t: cn(\"inset-y-0 w-full max-w-[780px]\", isRightSide ? \"right-0 border-l\" : \"left-0 border-r\"),\n\t\t\t\t)}\n\t\t\t\tdir={dirRTL ? \"rtl\" : \"ltr\"}\n\t\t\t\tstyle={{\n\t\t\t\t\tbackgroundColor: \"var(--ac-background)\",\n\t\t\t\t\tborderColor: \"var(--ac-border)\",\n\t\t\t\t\t...(isMobile\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\ttop: \"70px\",\n\t\t\t\t\t\t\t\tbottom: 0,\n\t\t\t\t\t\t\t\theight: \"calc(100dvh - 70px)\",\n\t\t\t\t\t\t\t\ttransform: isOpen ? \"translateY(0)\" : \"translateY(100%)\",\n\t\t\t\t\t\t\t\topacity: isOpen ? 1 : 0,\n\t\t\t\t\t\t\t\tpointerEvents: isOpen ? \"auto\" : \"none\",\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\ttransform: isOpen ? \"translateX(0)\" : isRightSide ? \"translateX(100%)\" : \"translateX(-100%)\",\n\t\t\t\t\t\t\t\topacity: isOpen ? 1 : 0,\n\t\t\t\t\t\t\t\tpointerEvents: isOpen ? \"auto\" : \"none\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\ttransition: \"transform 300ms ease-in-out\",\n\t\t\t\t\tzIndex: panelZIndex,\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{isMobile && <MobilePreviewDrawer />}\n\t\t\t\t<MobileLiveChatDrawer />\n\n\t\t\t\t<ChatInterface {...chatInterfaceProps} />\n\t\t\t</div>\n\n\t\t\t{/* Floating button — hidden when open */}\n\t\t\t{!isOpen &&\n\t\t\t\trenderSlot(\n\t\t\t\t\t\"floatingButton\",\n\t\t\t\t\tfloatingButtonProps as never,\n\t\t\t\t\tFloatingButton as never,\n\t\t\t\t\tslots,\n\t\t\t\t)}\n\t\t</>\n\t);\n}\n\n/**\n * Top-level widget (Level 1 API). Composes ChatProvider internally and renders\n * the correct shell based on `mode`.\n */\nexport function ChatWidget(props: ChatWidgetProps) {\n\t// Split ChatProviderProps from widget-shell props.\n\tconst {\n\t\t// Widget shell props consumed by inner component (also forwarded separately)\n\t\tmode,\n\t\tposition,\n\t\tpositionMobile,\n\t\tisOpen,\n\t\tonOpenChange,\n\t\tpendingMessage,\n\t\tzIndex,\n\t\tgreetingText,\n\t\tgreetingOffsetX,\n\t\tgreetingOffsetY,\n\t\tgreetingMaxWidth,\n\t\tbuttonOffsetXMobile,\n\t\tbuttonOffsetYMobile,\n\t\tbuttonOffsetXDesktop,\n\t\tbuttonOffsetYDesktop,\n\t\tbuttonIconUrl,\n\t\tbuttonImageUrl,\n\t\tbuttonImageUrlMobile,\n\t\tbuttonWidth,\n\t\tbuttonHeight,\n\t\tbuttonIconSize,\n\t\tbuttonWidthMobile,\n\t\tbuttonHeightMobile,\n\t\tbuttonIconSizeMobile,\n\t\tbuttonBgColor,\n\t\tbuttonBorderRadius,\n\t\thideGreeting,\n\t\tlogoUrl,\n\t\twelcomeTitle,\n\t\twelcomeSubtitle,\n\t\thideWelcomeHeader,\n\t\tfooterText,\n\t\thideHeader,\n\t\tshowFirstMessage,\n\t\tquestionsLayout,\n\t\tquestionsLayoutMobile,\n\t\tscrollAnchor,\n\t\tchildren: _children,\n\t\t...providerProps\n\t} = props;\n\n\treturn (\n\t\t<ChatProvider {...providerProps}>\n\t\t\t<ChatWidgetInner\n\t\t\t\tmode={mode}\n\t\t\t\tposition={position}\n\t\t\t\tpositionMobile={positionMobile}\n\t\t\t\tisOpen={isOpen}\n\t\t\t\tonOpenChange={onOpenChange}\n\t\t\t\tpendingMessage={pendingMessage}\n\t\t\t\tzIndex={zIndex}\n\t\t\t\tgreetingText={greetingText}\n\t\t\t\tgreetingOffsetX={greetingOffsetX}\n\t\t\t\tgreetingOffsetY={greetingOffsetY}\n\t\t\t\tgreetingMaxWidth={greetingMaxWidth}\n\t\t\t\tbuttonOffsetXMobile={buttonOffsetXMobile}\n\t\t\t\tbuttonOffsetYMobile={buttonOffsetYMobile}\n\t\t\t\tbuttonOffsetXDesktop={buttonOffsetXDesktop}\n\t\t\t\tbuttonOffsetYDesktop={buttonOffsetYDesktop}\n\t\t\t\tbuttonIconUrl={buttonIconUrl}\n\t\t\t\tbuttonImageUrl={buttonImageUrl}\n\t\t\t\tbuttonImageUrlMobile={buttonImageUrlMobile}\n\t\t\t\tbuttonWidth={buttonWidth}\n\t\t\t\tbuttonHeight={buttonHeight}\n\t\t\t\tbuttonIconSize={buttonIconSize}\n\t\t\t\tbuttonWidthMobile={buttonWidthMobile}\n\t\t\t\tbuttonHeightMobile={buttonHeightMobile}\n\t\t\t\tbuttonIconSizeMobile={buttonIconSizeMobile}\n\t\t\t\tbuttonBgColor={buttonBgColor}\n\t\t\t\tbuttonBorderRadius={buttonBorderRadius}\n\t\t\t\thideGreeting={hideGreeting}\n\t\t\t\tlogoUrl={logoUrl}\n\t\t\t\twelcomeTitle={welcomeTitle}\n\t\t\t\twelcomeSubtitle={welcomeSubtitle}\n\t\t\t\thideWelcomeHeader={hideWelcomeHeader}\n\t\t\t\tfooterText={footerText}\n\t\t\t\thideHeader={hideHeader}\n\t\t\t\tshowFirstMessage={showFirstMessage}\n\t\t\t\tquestionsLayout={questionsLayout}\n\t\t\t\tquestionsLayoutMobile={questionsLayoutMobile}\n\t\t\t\tscrollAnchor={scrollAnchor}\n\t\t\t\tlanguage={providerProps.language as string | undefined}\n\t\t\t/>\n\t\t</ChatProvider>\n\t);\n}\n"]}
package/dist/index.d.cts CHANGED
@@ -1,10 +1,10 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { C as ChatProviderProps } from './types-bsR_-fq8.cjs';
3
- export { a as ChatAttachmentInput, b as ChatConfig, c as ChatEventCallbacks, d as ChatMessage, e as ComponentAction, L as Language, f as LiveChatMessage, g as LiveChatState, Q as QuestionConfig, S as SlotMap, T as ThemeConfig, h as ToolRendererProps, i as ToolResult } from './types-bsR_-fq8.cjs';
4
- export { A as AutoResizeOptions, K as KeyboardLanguageOptions, L as LATIN, a as LiveChatReturn, S as SlotComponent, b as SlotName, U as UseAigentycChatOptions, c as UseAigentycChatReturn, d as detectLanguage, r as renderSlot, s as scriptLanguageOf, u as useAigentycChat, e as useAutoResize, f as useChatContext, g as useKeyboardLanguage, h as useLiveChat, i as useSlot, j as useSlots } from './SlotsContext-D_C7zlUA.cjs';
2
+ import { b as ChatProviderProps } from './types-DRa1zFlN.cjs';
3
+ export { c as ChatAttachmentInput, d as ChatConfig, e as ChatEventCallbacks, f as ChatMessage, C as ComponentAction, L as Language, g as LiveChatMessage, h as LiveChatState, Q as QuestionConfig, S as SlotMap, i as ThemeConfig, T as ToolRendererProps, a as ToolResult } from './types-DRa1zFlN.cjs';
4
+ export { A as AutoResizeOptions, K as KeyboardLanguageOptions, L as LATIN, a as LiveChatReturn, S as SlotComponent, b as SlotName, U as UseAigentycChatOptions, c as UseAigentycChatReturn, d as detectLanguage, r as renderSlot, s as scriptLanguageOf, u as useAigentycChat, e as useAutoResize, f as useChatContext, g as useKeyboardLanguage, h as useLiveChat, i as useSlot, j as useSlots } from './SlotsContext-DAQiASVu.cjs';
5
5
  export { useTheme } from './theme.cjs';
6
6
  export { useI18n } from './i18n.cjs';
7
- export { A as AssistantMessageSlotProps, C as ChatInterfaceProps, U as UserMessageSlotProps } from './ChatInterface-BnVyOUG5.cjs';
7
+ export { A as AssistantMessageSlotProps, C as ChatInterfaceProps, U as UserMessageSlotProps } from './ChatInterface-DKF3BY42.cjs';
8
8
  export { g as getToolDisplayData, n as normalizeToolRows } from './normalize-KzCLLqpU.cjs';
9
9
  import { Component, ReactNode, ErrorInfo } from 'react';
10
10
  export { F as FeedbackData, M as MessageFeedbackActionsState } from './message-feedback-BFh3-qym.cjs';
@@ -25,8 +25,14 @@ interface ChatProps extends ChatProviderProps {
25
25
  * - `"stream-order"` — parts render in the order received from the API
26
26
  */
27
27
  messagePartOrder?: "text-first" | "tools-first" | "stream-order";
28
+ /**
29
+ * Where the view settles while an answer streams in.
30
+ * - `"latest-turn"` (default) — the question stays at the top
31
+ * - `"bottom"` — always follows the end of the content
32
+ */
33
+ scrollAnchor?: "latest-turn" | "bottom";
28
34
  }
29
- declare function Chat({ className, children, showSources, messagePartOrder, ...providerProps }: ChatProps): react_jsx_runtime.JSX.Element;
35
+ declare function Chat({ className, children, showSources, messagePartOrder, scrollAnchor, ...providerProps }: ChatProps): react_jsx_runtime.JSX.Element;
30
36
 
31
37
  /** Widget placement mode. */
32
38
  type WidgetMode = "floating" | "inline" | "trigger";
@@ -77,6 +83,12 @@ interface ChatWidgetProps extends ChatProviderProps {
77
83
  showSources?: boolean;
78
84
  /** Controls rendering order of message parts. Default: "text-first". */
79
85
  messagePartOrder?: "text-first" | "tools-first" | "stream-order";
86
+ /**
87
+ * Where the view settles while an answer streams in. Default:
88
+ * `"latest-turn"` — the visitor's question stays at the top and a long answer
89
+ * is read from its first line. `"bottom"` always follows the end.
90
+ */
91
+ scrollAnchor?: "latest-turn" | "bottom";
80
92
  }
81
93
  /**
82
94
  * Top-level widget (Level 1 API). Composes ChatProvider internally and renders
@@ -129,4 +141,14 @@ declare class ChatErrorBoundary extends Component<ErrorBoundaryProps, ErrorBound
129
141
  render(): ReactNode;
130
142
  }
131
143
 
132
- export { Chat, ChatErrorBoundary, type ChatProps, ChatProvider, ChatProviderProps, ChatWidget };
144
+ interface ChatErrorProps {
145
+ /** The failed turn, as `useChat` reported it. */
146
+ error?: Error;
147
+ /** Re-send the last turn. Omitted when there is nothing to retry. */
148
+ onRetry?: () => void;
149
+ /** Clear the history and start over. */
150
+ onNewConversation: () => void;
151
+ }
152
+ declare function ChatError({ error, onRetry, onNewConversation }: ChatErrorProps): react_jsx_runtime.JSX.Element;
153
+
154
+ export { Chat, ChatError, ChatErrorBoundary, type ChatErrorProps, type ChatProps, ChatProvider, ChatProviderProps, ChatWidget };
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { C as ChatProviderProps } from './types-bsR_-fq8.js';
3
- export { a as ChatAttachmentInput, b as ChatConfig, c as ChatEventCallbacks, d as ChatMessage, e as ComponentAction, L as Language, f as LiveChatMessage, g as LiveChatState, Q as QuestionConfig, S as SlotMap, T as ThemeConfig, h as ToolRendererProps, i as ToolResult } from './types-bsR_-fq8.js';
4
- export { A as AutoResizeOptions, K as KeyboardLanguageOptions, L as LATIN, a as LiveChatReturn, S as SlotComponent, b as SlotName, U as UseAigentycChatOptions, c as UseAigentycChatReturn, d as detectLanguage, r as renderSlot, s as scriptLanguageOf, u as useAigentycChat, e as useAutoResize, f as useChatContext, g as useKeyboardLanguage, h as useLiveChat, i as useSlot, j as useSlots } from './SlotsContext-BZBi51ZT.js';
2
+ import { b as ChatProviderProps } from './types-DRa1zFlN.js';
3
+ export { c as ChatAttachmentInput, d as ChatConfig, e as ChatEventCallbacks, f as ChatMessage, C as ComponentAction, L as Language, g as LiveChatMessage, h as LiveChatState, Q as QuestionConfig, S as SlotMap, i as ThemeConfig, T as ToolRendererProps, a as ToolResult } from './types-DRa1zFlN.js';
4
+ export { A as AutoResizeOptions, K as KeyboardLanguageOptions, L as LATIN, a as LiveChatReturn, S as SlotComponent, b as SlotName, U as UseAigentycChatOptions, c as UseAigentycChatReturn, d as detectLanguage, r as renderSlot, s as scriptLanguageOf, u as useAigentycChat, e as useAutoResize, f as useChatContext, g as useKeyboardLanguage, h as useLiveChat, i as useSlot, j as useSlots } from './SlotsContext-B_087V7B.js';
5
5
  export { useTheme } from './theme.js';
6
6
  export { useI18n } from './i18n.js';
7
- export { A as AssistantMessageSlotProps, C as ChatInterfaceProps, U as UserMessageSlotProps } from './ChatInterface-2MN5cpYB.js';
7
+ export { A as AssistantMessageSlotProps, C as ChatInterfaceProps, U as UserMessageSlotProps } from './ChatInterface-CRmM_RG_.js';
8
8
  export { g as getToolDisplayData, n as normalizeToolRows } from './normalize-KzCLLqpU.js';
9
9
  import { Component, ReactNode, ErrorInfo } from 'react';
10
10
  export { F as FeedbackData, M as MessageFeedbackActionsState } from './message-feedback-cWR0NVok.js';
@@ -25,8 +25,14 @@ interface ChatProps extends ChatProviderProps {
25
25
  * - `"stream-order"` — parts render in the order received from the API
26
26
  */
27
27
  messagePartOrder?: "text-first" | "tools-first" | "stream-order";
28
+ /**
29
+ * Where the view settles while an answer streams in.
30
+ * - `"latest-turn"` (default) — the question stays at the top
31
+ * - `"bottom"` — always follows the end of the content
32
+ */
33
+ scrollAnchor?: "latest-turn" | "bottom";
28
34
  }
29
- declare function Chat({ className, children, showSources, messagePartOrder, ...providerProps }: ChatProps): react_jsx_runtime.JSX.Element;
35
+ declare function Chat({ className, children, showSources, messagePartOrder, scrollAnchor, ...providerProps }: ChatProps): react_jsx_runtime.JSX.Element;
30
36
 
31
37
  /** Widget placement mode. */
32
38
  type WidgetMode = "floating" | "inline" | "trigger";
@@ -77,6 +83,12 @@ interface ChatWidgetProps extends ChatProviderProps {
77
83
  showSources?: boolean;
78
84
  /** Controls rendering order of message parts. Default: "text-first". */
79
85
  messagePartOrder?: "text-first" | "tools-first" | "stream-order";
86
+ /**
87
+ * Where the view settles while an answer streams in. Default:
88
+ * `"latest-turn"` — the visitor's question stays at the top and a long answer
89
+ * is read from its first line. `"bottom"` always follows the end.
90
+ */
91
+ scrollAnchor?: "latest-turn" | "bottom";
80
92
  }
81
93
  /**
82
94
  * Top-level widget (Level 1 API). Composes ChatProvider internally and renders
@@ -129,4 +141,14 @@ declare class ChatErrorBoundary extends Component<ErrorBoundaryProps, ErrorBound
129
141
  render(): ReactNode;
130
142
  }
131
143
 
132
- export { Chat, ChatErrorBoundary, type ChatProps, ChatProvider, ChatProviderProps, ChatWidget };
144
+ interface ChatErrorProps {
145
+ /** The failed turn, as `useChat` reported it. */
146
+ error?: Error;
147
+ /** Re-send the last turn. Omitted when there is nothing to retry. */
148
+ onRetry?: () => void;
149
+ /** Clear the history and start over. */
150
+ onNewConversation: () => void;
151
+ }
152
+ declare function ChatError({ error, onRetry, onNewConversation }: ChatErrorProps): react_jsx_runtime.JSX.Element;
153
+
154
+ export { Chat, ChatError, ChatErrorBoundary, type ChatErrorProps, type ChatProps, ChatProvider, ChatProviderProps, ChatWidget };
package/dist/index.js CHANGED
@@ -1,21 +1,22 @@
1
1
  "use client";
2
2
  export { useAigentycChat } from './chunk-3H4CX3MS.js';
3
3
  import './chunk-BKDV2H6Z.js';
4
- import { ChatInterface, PreviewEmbedPanel, LiveChatPanel, MobileLiveChatDrawer, FloatingButton } from './chunk-BWWN5LSE.js';
5
- export { ChatErrorBoundary } from './chunk-BWWN5LSE.js';
4
+ import { ChatInterface, PreviewEmbedPanel, LiveChatPanel, MobileLiveChatDrawer, FloatingButton } from './chunk-PNUHUUA3.js';
5
+ export { ChatError, ChatErrorBoundary } from './chunk-PNUHUUA3.js';
6
6
  import { LiveChatProvider, PreviewEmbedProvider, useIsMobile, usePreviewEmbed } from './chunk-P7UR37HP.js';
7
7
  export { useAutoResize, useLiveChat } from './chunk-P7UR37HP.js';
8
- import { ThemeProvider } from './chunk-IU7Q7O5G.js';
9
- export { useTheme } from './chunk-IU7Q7O5G.js';
8
+ import { ThemeProvider } from './chunk-VQPOUMBC.js';
9
+ export { useTheme } from './chunk-VQPOUMBC.js';
10
10
  export { LATIN, detectLanguage, scriptLanguageOf, useKeyboardLanguage } from './chunk-BYTPAQ7F.js';
11
- import './chunk-5XF3NEFB.js';
11
+ import './chunk-O5TPHZRP.js';
12
12
  import './chunk-MZQKGNWF.js';
13
- import { I18nProvider } from './chunk-QYCEHFAB.js';
14
- export { useI18n } from './chunk-QYCEHFAB.js';
13
+ import { I18nProvider } from './chunk-LDQVDUUJ.js';
14
+ export { useI18n } from './chunk-LDQVDUUJ.js';
15
15
  export { getToolDisplayData, normalizeToolRows } from './chunk-XEAAB5ZM.js';
16
- import './chunk-FJZL33KP.js';
17
- import { SlotsProvider, ChatContextProvider, useSlots, renderSlot } from './chunk-D75TDRBH.js';
18
- export { renderSlot, useChatContext, useSlot, useSlots } from './chunk-D75TDRBH.js';
16
+ import './chunk-CW6LCVNC.js';
17
+ import { SlotsProvider, ChatContextProvider, useSlots, renderSlot } from './chunk-JAEXKKSE.js';
18
+ export { renderSlot, useChatContext, useSlot, useSlots } from './chunk-JAEXKKSE.js';
19
+ import './chunk-CNPYBLLT.js';
19
20
  import './chunk-PS3U7T37.js';
20
21
  import './chunk-JAOD6CNW.js';
21
22
  import './chunk-4QT25AXI.js';
@@ -104,9 +105,9 @@ function ChatProvider(props) {
104
105
  }
105
106
  ) }) }) });
106
107
  }
107
- function Chat({ className, children, showSources, messagePartOrder, ...providerProps }) {
108
+ function Chat({ className, children, showSources, messagePartOrder, scrollAnchor, ...providerProps }) {
108
109
  return /* @__PURE__ */ jsx(ChatProvider, { ...providerProps, children: /* @__PURE__ */ jsxs("div", { className, children: [
109
- /* @__PURE__ */ jsx(ChatInterface, { showSources, messagePartOrder }),
110
+ /* @__PURE__ */ jsx(ChatInterface, { showSources, messagePartOrder, scrollAnchor }),
110
111
  children
111
112
  ] }) });
112
113
  }
@@ -226,6 +227,7 @@ function ChatWidgetInner({
226
227
  questionsLayoutMobile,
227
228
  showSources,
228
229
  messagePartOrder,
230
+ scrollAnchor,
229
231
  language
230
232
  }) {
231
233
  const [internalIsOpen, setInternalIsOpen] = useState(false);
@@ -275,10 +277,11 @@ function ChatWidgetInner({
275
277
  questionsLayoutMobile,
276
278
  showSources,
277
279
  messagePartOrder,
280
+ scrollAnchor,
278
281
  pendingMessage,
279
282
  onPendingMessageConsumed: () => setPendingMessage(null)
280
283
  }),
281
- [isOpen, handleClose, logoUrl, welcomeTitle, welcomeSubtitle, hideWelcomeHeader, footerText, hideHeader, showFirstMessage, questionsLayout, questionsLayoutMobile, showSources, messagePartOrder, pendingMessage]
284
+ [isOpen, handleClose, logoUrl, welcomeTitle, welcomeSubtitle, hideWelcomeHeader, footerText, hideHeader, showFirstMessage, questionsLayout, questionsLayoutMobile, showSources, messagePartOrder, scrollAnchor, pendingMessage]
282
285
  );
283
286
  if (mode === "inline") {
284
287
  return /* @__PURE__ */ jsx("div", { className: "flex flex-col w-full h-full", dir: dirRTL ? "rtl" : "ltr", style: { backgroundColor: "var(--ac-background)" }, children: /* @__PURE__ */ jsx(ChatInterface, { ...chatInterfaceProps }) });
@@ -407,6 +410,7 @@ function ChatWidget(props) {
407
410
  showFirstMessage,
408
411
  questionsLayout,
409
412
  questionsLayoutMobile,
413
+ scrollAnchor,
410
414
  children: _children,
411
415
  ...providerProps
412
416
  } = props;
@@ -449,6 +453,7 @@ function ChatWidget(props) {
449
453
  showFirstMessage,
450
454
  questionsLayout,
451
455
  questionsLayoutMobile,
456
+ scrollAnchor,
452
457
  language: providerProps.language
453
458
  }
454
459
  ) });
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/providers/ChatProvider.tsx","../src/components/Chat.tsx","../src/components/ChatWidget.tsx"],"names":["jsx","jsxs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAWA,IAAM,aAAA,GAA8C;AAAA,EAClD,SAAA;AAAA,EACA,gBAAA;AAAA,EACA,kBAAA;AAAA,EACA,eAAA;AAAA,EACA,mBAAA;AAAA,EACA,eAAA;AAAA,EACA,aAAA;AAAA,EACA,YAAA;AAAA,EACA,cAAA;AAAA,EACA,cAAA;AAAA,EACA,qBAAA;AAAA,EACA,qBAAA;AAAA,EACA,iBAAA;AAAA,EACA,SAAA;AAAA,EACA,mBAAA;AAAA,EACA,kBAAA;AAAA,EACA,iBAAA;AAAA,EACA;AACF,CAAA;AAEA,SAAS,cAAc,KAAA,EAAoD;AACzE,EAAA,MAAM,MAA+B,EAAC;AACtC,EAAA,KAAA,MAAW,OAAO,aAAA,EAAe;AAC/B,IAAA,IAAI,KAAA,CAAM,GAAG,CAAA,KAAM,MAAA,MAAe,GAAG,CAAA,GAAI,MAAM,GAAG,CAAA;AAAA,EACpD;AACA,EAAA,OAAO,GAAA;AACT;AAaO,SAAS,aAAa,KAAA,EAA0B;AACrD,EAAA,MAAM;AAAA,IACJ,QAAA;AAAA,IACA,SAAA;AAAA,IACA,WAAA;AAAA,IACA,MAAA;AAAA,IACA,UAAA;AAAA,IACA,OAAA;AAAA,IACA,SAAA;AAAA,IACA,WAAA;AAAA,IACA,QAAA;AAAA,IACA,YAAA;AAAA,IACA,KAAA;AAAA,IACA,KAAA;AAAA,IACA,cAAA,GAAiB,KAAA;AAAA,IACjB,cAAA;AAAA,IACA,eAAA,EAAiB,gBAAA;AAAA,IACjB,WAAA,EAAa,YAAA;AAAA,IACb,SAAA,EAAW,UAAA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AAA,MACA,kBAAA;AAAA,MACA,YAAA;AAAA,MACA,OAAA;AAAA,MACA,YAAA;AAAA,MACA,eAAA;AAAA,MACA,iBAAA;AAAA,MACA,UAAA;AAAA,MACA,UAAA;AAAA,MACA,gBAAA;AAAA,MACA,eAAA;AAAA,MACA,qBAAA;AAAA,MACA,UAAU,aAAA,CAAc;AAAA;AAAA,GACzB,EACD,CAAA;AAEF","file":"index.js","sourcesContent":["\"use client\";\n\nimport { I18nProvider } from \"./I18nProvider\";\nimport { ThemeProvider } from \"./ThemeProvider\";\nimport { SlotsProvider } from \"./SlotsContext\";\nimport { ChatContextProvider } from \"./ChatContext\";\nimport { LiveChatProvider } from \"./LiveChatProvider\";\nimport { PreviewEmbedProvider } from \"./PreviewEmbedProvider\";\nimport type { ChatProviderProps, ChatEventCallbacks } from \"../core/types\";\nimport type { TranslationMap } from \"./I18nProvider\";\n\nconst CALLBACK_KEYS: (keyof ChatEventCallbacks)[] = [\n \"onReady\",\n \"onSessionStart\",\n \"onSessionRestore\",\n \"onMessageSent\",\n \"onMessageReceived\",\n \"onStreamStart\",\n \"onStreamEnd\",\n \"onToolCall\",\n \"onToolResult\",\n \"onToolAction\",\n \"onLiveChatRequested\",\n \"onLiveChatConnected\",\n \"onLiveChatEnded\",\n \"onError\",\n \"onNewConversation\",\n \"onStopGeneration\",\n \"onClearMessages\",\n \"onInteraction\",\n];\n\nfunction pickCallbacks(props: Record<string, unknown>): ChatEventCallbacks {\n const out: Record<string, unknown> = {};\n for (const key of CALLBACK_KEYS) {\n if (props[key] !== undefined) out[key] = props[key];\n }\n return out as ChatEventCallbacks;\n}\n\n/**\n * Top-level provider that composes all Aigentyc Chat sub-providers.\n *\n * Provider order (outermost to innermost):\n * 1. I18nProvider\n * 2. ThemeProvider (renders `<div data-aigentyc-chat>`)\n * 3. SlotsProvider\n * 4. ChatContextProvider\n * 5. LiveChatProvider (conditional on `enableLiveChat`)\n * 6. PreviewEmbedProvider\n */\nexport function ChatProvider(props: ChatProviderProps) {\n const {\n children,\n projectId,\n apiEndpoint,\n apiKey,\n clientName,\n pageUrl,\n pageTitle,\n pageContext,\n language,\n translations,\n theme,\n slots,\n enableLiveChat = false,\n chatServiceUrl,\n persistMessages: _persistMessages,\n maxMessages: _maxMessages,\n questions: _questions,\n ...rest\n } = props;\n\n const callbacks = pickCallbacks(rest as Record<string, unknown>);\n const config = {\n projectId,\n apiEndpoint,\n apiKey,\n clientName,\n pageUrl,\n pageTitle,\n pageContext,\n };\n\n // Flatten translations from per-language map into single overrides.\n const langCode = language ?? \"en\";\n const translationOverrides = translations?.[langCode] as Partial<TranslationMap> | undefined;\n\n const liveChatUrl = chatServiceUrl ?? apiEndpoint;\n const inner = enableLiveChat && liveChatUrl && apiKey ? (\n <LiveChatProvider\n chatServiceUrl={liveChatUrl}\n apiKey={apiKey}\n projectId={projectId || \"default\"}\n sessionId=\"default\"\n >\n <PreviewEmbedProvider>{children}</PreviewEmbedProvider>\n </LiveChatProvider>\n ) : (\n <PreviewEmbedProvider>{children}</PreviewEmbedProvider>\n );\n\n return (\n <I18nProvider language={language} translations={translationOverrides}>\n <ThemeProvider theme={theme}>\n <SlotsProvider slots={slots as never}>\n <ChatContextProvider\n config={config}\n callbacks={callbacks}\n >\n {inner}\n </ChatContextProvider>\n </SlotsProvider>\n </ThemeProvider>\n </I18nProvider>\n );\n}\n","\"use client\";\n\n/**\n * Chat — Level 1 drop-in embed component.\n *\n * Wraps everything in `<ChatProvider>` internally and renders `<ChatInterface />`\n * inline (no floating button, no overlay). Use this when you want to embed a\n * chat directly inside a page layout.\n */\n\nimport type { ChatProviderProps } from \"../core/types\";\nimport { ChatProvider } from \"../providers/ChatProvider\";\nimport { ChatInterface } from \"./ChatInterface\";\n\nexport interface ChatProps extends ChatProviderProps {\n /** Optional className forwarded to the ChatInterface root. */\n className?: string;\n /**\n * Show citation sources under each assistant message that used the\n * `searchKnowledgeBase` tool. Off by default.\n */\n showSources?: boolean;\n /**\n * Controls the rendering order of message parts (text vs tool results).\n * - `\"text-first\"` (default) — text parts render before tool cards\n * - `\"tools-first\"` — tool cards render before text\n * - `\"stream-order\"` — parts render in the order received from the API\n */\n messagePartOrder?: \"text-first\" | \"tools-first\" | \"stream-order\";\n}\n\nexport function Chat({ className, children, showSources, messagePartOrder, ...providerProps }: ChatProps) {\n return (\n <ChatProvider {...(providerProps as unknown as React.ComponentProps<typeof ChatProvider>)}>\n <div className={className}>\n <ChatInterface showSources={showSources} messagePartOrder={messagePartOrder} />\n {children}\n </div>\n </ChatProvider>\n );\n}\n\nexport default Chat;\n","\"use client\";\n\n/**\n * Top-level widget (Level 1 API).\n *\n * Composes ChatProvider internally and renders FloatingButton, ChatInterface,\n * LiveChatPanel, and PreviewEmbedPanel based on widget mode.\n */\n\nimport { useState, useCallback, useEffect, useMemo } from \"react\";\nimport { ChatProvider } from \"../providers/ChatProvider\";\nimport type { ChatProviderProps } from \"../core/types\";\nimport { useIsMobile } from \"../hooks/use-mobile\";\nimport { cn } from \"../core/utils\";\nimport { ChatInterface } from \"./ChatInterface\";\nimport { FloatingButton } from \"./FloatingButton\";\nimport { LiveChatPanel, MobileLiveChatDrawer } from \"./LiveChatPanel\";\nimport { PreviewEmbedPanel } from \"./PreviewEmbedPanel\";\nimport { usePreviewEmbed } from \"../providers/PreviewEmbedProvider\";\nimport { useSlots, renderSlot } from \"../providers/SlotsContext\";\n\n/** Widget placement mode. */\nexport type WidgetMode = \"floating\" | \"inline\" | \"trigger\";\n\nexport interface ChatWidgetProps extends ChatProviderProps {\n\t/** How the widget is rendered. Default \"floating\". */\n\tmode?: WidgetMode;\n\t/** Fixed position for the floating button. Default \"bottom-right\". */\n\tposition?: \"bottom-right\" | \"bottom-left\" | \"top-right\" | \"top-left\";\n\tpositionMobile?: \"bottom-right\" | \"bottom-left\" | \"top-right\" | \"top-left\";\n\t/** Controlled open state. */\n\tisOpen?: boolean;\n\t/** Fired whenever the widget opens/closes. */\n\tonOpenChange?: (open: boolean) => void;\n\t/** Message to pre-fill and auto-submit on open. */\n\tpendingMessage?: string | null;\n\t/** Overlay z-index (defaults to 9999). */\n\tzIndex?: number;\n\n\t// Floating button customisation\n\tgreetingText?: string;\n\tgreetingOffsetX?: string;\n\tgreetingOffsetY?: string;\n\tgreetingMaxWidth?: string;\n\tbuttonOffsetXMobile?: string;\n\tbuttonOffsetYMobile?: string;\n\tbuttonOffsetXDesktop?: string;\n\tbuttonOffsetYDesktop?: string;\n\tbuttonIconUrl?: string;\n\tbuttonImageUrl?: string;\n\tbuttonImageUrlMobile?: string;\n\tbuttonWidth?: string;\n\tbuttonHeight?: string;\n\tbuttonIconSize?: string;\n\tbuttonWidthMobile?: string;\n\tbuttonHeightMobile?: string;\n\tbuttonIconSizeMobile?: string;\n\tbuttonBgColor?: string;\n\tbuttonBorderRadius?: string;\n\thideGreeting?: boolean;\n\n\t// Welcome-page customisation (passed through to ChatInterface)\n\tlogoUrl?: string;\n\twelcomeTitle?: string;\n\twelcomeSubtitle?: string;\n\thideWelcomeHeader?: boolean;\n\tfooterText?: string;\n\thideHeader?: boolean;\n\tshowFirstMessage?: boolean;\n\tquestionsLayout?: \"vertical\" | \"horizontal\";\n\tquestionsLayoutMobile?: \"vertical\" | \"horizontal\";\n\t/** Show citation sources under each assistant message. Off by default. */\n\tshowSources?: boolean;\n\t/** Controls rendering order of message parts. Default: \"text-first\". */\n\tmessagePartOrder?: \"text-first\" | \"tools-first\" | \"stream-order\";\n}\n\n/** Bridges the \"widget-preview-open\" custom event to the PreviewEmbed context. */\nfunction PreviewEventBridge() {\n\tconst previewEmbed = usePreviewEmbed();\n\n\tuseEffect(() => {\n\t\tif (!previewEmbed || typeof window === \"undefined\") return;\n\t\tconst handler = (e: Event) => {\n\t\t\tconst { url, title, description } = (e as CustomEvent).detail || {};\n\t\t\tif (url) previewEmbed.openPreview({ url, title, description });\n\t\t};\n\t\twindow.addEventListener(\"widget-preview-open\", handler);\n\t\treturn () => window.removeEventListener(\"widget-preview-open\", handler);\n\t}, [previewEmbed]);\n\n\treturn null;\n}\n\n/** Mobile preview drawer — slides up from bottom of the widget. */\nfunction MobilePreviewDrawer() {\n\tconst previewEmbed = usePreviewEmbed();\n\tconst isVisible = !!previewEmbed?.preview;\n\tconst preview = previewEmbed?.preview;\n\tconst closePreview = previewEmbed?.closePreview;\n\n\treturn (\n\t\t<>\n\t\t\t<div\n\t\t\t\tclassName=\"absolute inset-0 z-40 bg-black/50\"\n\t\t\t\tstyle={{\n\t\t\t\t\topacity: isVisible ? 1 : 0,\n\t\t\t\t\tpointerEvents: isVisible ? \"auto\" : \"none\",\n\t\t\t\t\ttransition: \"opacity 200ms ease-out\",\n\t\t\t\t}}\n\t\t\t\tonClick={closePreview}\n\t\t\t/>\n\t\t\t<div\n\t\t\t\tclassName=\"absolute inset-x-0 bottom-0 z-50 rounded-t-2xl border-t shadow-2xl\"\n\t\t\t\tstyle={{\n\t\t\t\t\tbackgroundColor: \"var(--ac-background)\",\n\t\t\t\t\tborderColor: \"var(--ac-border)\",\n\t\t\t\t\theight: \"calc(100dvh - 150px)\",\n\t\t\t\t\ttransform: isVisible ? \"translateY(0)\" : \"translateY(100%)\",\n\t\t\t\t\ttransition: \"transform 300ms cubic-bezier(0.32, 0.72, 0, 1)\",\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<div className=\"flex justify-center pt-3 pb-1\">\n\t\t\t\t\t<div className=\"w-[100px] h-2 rounded-full bg-muted\" />\n\t\t\t\t</div>\n\t\t\t\t<div className=\"px-5 py-3 flex items-center justify-between\">\n\t\t\t\t\t<div className=\"min-w-0\">\n\t\t\t\t\t\t<h3 className=\"font-medium text-sm truncate\" style={{ color: \"var(--ac-text)\" }}>\n\t\t\t\t\t\t\t{preview?.title || \"Preview\"}\n\t\t\t\t\t\t</h3>\n\t\t\t\t\t\t{preview?.description && (\n\t\t\t\t\t\t\t<p className=\"text-xs text-muted-foreground mt-0.5 truncate\">{preview.description}</p>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tonClick={closePreview}\n\t\t\t\t\t\tclassName=\"shrink-0 w-8 h-8 rounded-full border flex items-center justify-center hover:bg-muted transition-colors ml-3\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<span className=\"sr-only\">Close</span>&times;\n\t\t\t\t\t</button>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"px-4 pb-4 flex-1\" style={{ height: \"calc(100% - 80px)\" }}>\n\t\t\t\t\t{preview && (\n\t\t\t\t\t\t<iframe\n\t\t\t\t\t\t\tkey={preview.url}\n\t\t\t\t\t\t\tsrc={preview.url}\n\t\t\t\t\t\t\tclassName=\"w-full h-full rounded-xl border-none\"\n\t\t\t\t\t\t\tsandbox=\"allow-scripts allow-same-origin allow-forms allow-popups allow-presentation\"\n\t\t\t\t\t\t\ttitle={preview.title || \"Preview\"}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\n/** Props for the inner widget shell — does not include ChatProvider config. */\ntype ChatWidgetInnerProps = Omit<\n\tChatWidgetProps,\n\tkeyof ChatProviderProps | \"children\"\n> & { language?: string };\n\n/** Inner component — rendered inside ChatProvider so it can read context. */\nfunction ChatWidgetInner({\n\tmode = \"floating\",\n\tposition = \"bottom-right\",\n\tpositionMobile,\n\tisOpen: controlledIsOpen,\n\tonOpenChange,\n\tpendingMessage: initialPendingMessage,\n\tzIndex,\n\tgreetingText,\n\tgreetingOffsetX,\n\tgreetingOffsetY,\n\tgreetingMaxWidth,\n\tbuttonOffsetXMobile,\n\tbuttonOffsetYMobile,\n\tbuttonOffsetXDesktop,\n\tbuttonOffsetYDesktop,\n\tbuttonIconUrl,\n\tbuttonImageUrl,\n\tbuttonImageUrlMobile,\n\tbuttonWidth,\n\tbuttonHeight,\n\tbuttonIconSize,\n\tbuttonWidthMobile,\n\tbuttonHeightMobile,\n\tbuttonIconSizeMobile,\n\tbuttonBgColor,\n\tbuttonBorderRadius,\n\thideGreeting,\n\tlogoUrl,\n\twelcomeTitle,\n\twelcomeSubtitle,\n\thideWelcomeHeader,\n\tfooterText,\n\thideHeader,\n\tshowFirstMessage,\n\tquestionsLayout,\n\tquestionsLayoutMobile,\n\tshowSources,\n\tmessagePartOrder,\n\tlanguage,\n}: ChatWidgetInnerProps) {\n\tconst [internalIsOpen, setInternalIsOpen] = useState(false);\n\tconst [pendingMessage, setPendingMessage] = useState<string | null>(initialPendingMessage ?? null);\n\tconst isMobile = useIsMobile();\n\tconst slots = useSlots();\n\n\tuseEffect(() => {\n\t\tif (controlledIsOpen === true) setInternalIsOpen(true);\n\t}, [controlledIsOpen]);\n\n\tconst isOpen = internalIsOpen;\n\n\t// Lock body scroll when open (except in inline mode)\n\tuseEffect(() => {\n\t\tif (mode === \"inline\" || typeof document === \"undefined\") return;\n\t\tif (isOpen) {\n\t\t\tconst originalStyle = window.getComputedStyle(document.body).overflow;\n\t\t\tdocument.body.style.overflow = \"hidden\";\n\t\t\treturn () => {\n\t\t\t\tdocument.body.style.overflow = originalStyle;\n\t\t\t};\n\t\t}\n\t}, [isOpen, mode]);\n\n\tconst handleOpen = useCallback(() => {\n\t\tsetInternalIsOpen(true);\n\t\tonOpenChange?.(true);\n\t}, [onOpenChange]);\n\n\tconst handleClose = useCallback(() => {\n\t\tsetInternalIsOpen(false);\n\t\tonOpenChange?.(false);\n\t}, [onOpenChange]);\n\n\tconst handleToggle = useCallback(() => {\n\t\tif (isOpen) handleClose();\n\t\telse handleOpen();\n\t}, [isOpen, handleOpen, handleClose]);\n\n\tconst isRightSide = position === \"bottom-right\" || position === \"top-right\";\n\tconst dirRTL = language === \"he\";\n\n\tconst chatInterfaceProps = useMemo(\n\t\t() => ({\n\t\t\tisOpen,\n\t\t\tonClose: handleClose,\n\t\t\tlogoUrl,\n\t\t\twelcomeTitle,\n\t\t\twelcomeSubtitle,\n\t\t\thideWelcomeHeader,\n\t\t\tfooterText,\n\t\t\thideHeader,\n\t\t\tshowFirstMessage,\n\t\t\tquestionsLayout,\n\t\t\tquestionsLayoutMobile,\n\t\t\tshowSources,\n\t\t\tmessagePartOrder,\n\t\t\tpendingMessage,\n\t\t\tonPendingMessageConsumed: () => setPendingMessage(null),\n\t\t}),\n\t\t[isOpen, handleClose, logoUrl, welcomeTitle, welcomeSubtitle, hideWelcomeHeader, footerText, hideHeader, showFirstMessage, questionsLayout, questionsLayoutMobile, showSources, messagePartOrder, pendingMessage],\n\t);\n\n\t// Inline mode\n\tif (mode === \"inline\") {\n\t\treturn (\n\t\t\t<div className=\"flex flex-col w-full h-full\" dir={dirRTL ? \"rtl\" : \"ltr\"} style={{ backgroundColor: \"var(--ac-background)\" }}>\n\t\t\t\t<ChatInterface {...chatInterfaceProps} />\n\t\t\t</div>\n\t\t);\n\t}\n\n\tconst panelZIndex = zIndex || 9999;\n\n\t// Floating button slot props\n\tconst floatingButtonProps = {\n\t\tonClick: handleToggle,\n\t\tposition,\n\t\tpositionMobile,\n\t\tisOpen,\n\t\tgreeting: greetingText,\n\t\tgreetingOffsetX,\n\t\tgreetingOffsetY,\n\t\tgreetingMaxWidth,\n\t\tbuttonOffsetXMobile,\n\t\tbuttonOffsetYMobile,\n\t\tbuttonOffsetXDesktop,\n\t\tbuttonOffsetYDesktop,\n\t\tbuttonIconUrl,\n\t\tbuttonImageUrl,\n\t\tbuttonImageUrlMobile,\n\t\tbuttonWidth,\n\t\tbuttonHeight,\n\t\tbuttonIconSize,\n\t\tbuttonWidthMobile,\n\t\tbuttonHeightMobile,\n\t\tbuttonIconSizeMobile,\n\t\tbuttonBgColor,\n\t\tbuttonBorderRadius,\n\t\tzIndex: zIndex || 999999,\n\t\thideGreeting,\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<PreviewEventBridge />\n\n\t\t\t{/* Overlay */}\n\t\t\t<div\n\t\t\t\tclassName=\"fixed inset-0 bg-black/50 transition-opacity duration-300 ease-in-out\"\n\t\t\t\tstyle={{\n\t\t\t\t\tzIndex: panelZIndex - 1,\n\t\t\t\t\topacity: isOpen ? 1 : 0,\n\t\t\t\t\tpointerEvents: isOpen ? \"auto\" : \"none\",\n\t\t\t\t}}\n\t\t\t\tonClick={handleClose}\n\t\t\t/>\n\n\t\t\t{!isMobile && <PreviewEmbedPanel isOpen={isOpen} isRightSide={isRightSide} zIndex={panelZIndex - 1} />}\n\t\t\t{!isMobile && <LiveChatPanel isWidgetOpen={isOpen} isRightSide={isRightSide} zIndex={panelZIndex - 1} />}\n\n\t\t\t{/* Main chat panel */}\n\t\t\t<div\n\t\t\t\tclassName={cn(\n\t\t\t\t\t\"fixed flex flex-col p-0 shadow-2xl\",\n\t\t\t\t\tisMobile\n\t\t\t\t\t\t? \"inset-x-0 rounded-t-2xl border-t\"\n\t\t\t\t\t\t: cn(\"inset-y-0 w-full max-w-[780px]\", isRightSide ? \"right-0 border-l\" : \"left-0 border-r\"),\n\t\t\t\t)}\n\t\t\t\tdir={dirRTL ? \"rtl\" : \"ltr\"}\n\t\t\t\tstyle={{\n\t\t\t\t\tbackgroundColor: \"var(--ac-background)\",\n\t\t\t\t\tborderColor: \"var(--ac-border)\",\n\t\t\t\t\t...(isMobile\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\ttop: \"70px\",\n\t\t\t\t\t\t\t\tbottom: 0,\n\t\t\t\t\t\t\t\theight: \"calc(100dvh - 70px)\",\n\t\t\t\t\t\t\t\ttransform: isOpen ? \"translateY(0)\" : \"translateY(100%)\",\n\t\t\t\t\t\t\t\topacity: isOpen ? 1 : 0,\n\t\t\t\t\t\t\t\tpointerEvents: isOpen ? \"auto\" : \"none\",\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\ttransform: isOpen ? \"translateX(0)\" : isRightSide ? \"translateX(100%)\" : \"translateX(-100%)\",\n\t\t\t\t\t\t\t\topacity: isOpen ? 1 : 0,\n\t\t\t\t\t\t\t\tpointerEvents: isOpen ? \"auto\" : \"none\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\ttransition: \"transform 300ms ease-in-out\",\n\t\t\t\t\tzIndex: panelZIndex,\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{isMobile && <MobilePreviewDrawer />}\n\t\t\t\t<MobileLiveChatDrawer />\n\n\t\t\t\t<ChatInterface {...chatInterfaceProps} />\n\t\t\t</div>\n\n\t\t\t{/* Floating button — hidden when open */}\n\t\t\t{!isOpen &&\n\t\t\t\trenderSlot(\n\t\t\t\t\t\"floatingButton\",\n\t\t\t\t\tfloatingButtonProps as never,\n\t\t\t\t\tFloatingButton as never,\n\t\t\t\t\tslots,\n\t\t\t\t)}\n\t\t</>\n\t);\n}\n\n/**\n * Top-level widget (Level 1 API). Composes ChatProvider internally and renders\n * the correct shell based on `mode`.\n */\nexport function ChatWidget(props: ChatWidgetProps) {\n\t// Split ChatProviderProps from widget-shell props.\n\tconst {\n\t\t// Widget shell props consumed by inner component (also forwarded separately)\n\t\tmode,\n\t\tposition,\n\t\tpositionMobile,\n\t\tisOpen,\n\t\tonOpenChange,\n\t\tpendingMessage,\n\t\tzIndex,\n\t\tgreetingText,\n\t\tgreetingOffsetX,\n\t\tgreetingOffsetY,\n\t\tgreetingMaxWidth,\n\t\tbuttonOffsetXMobile,\n\t\tbuttonOffsetYMobile,\n\t\tbuttonOffsetXDesktop,\n\t\tbuttonOffsetYDesktop,\n\t\tbuttonIconUrl,\n\t\tbuttonImageUrl,\n\t\tbuttonImageUrlMobile,\n\t\tbuttonWidth,\n\t\tbuttonHeight,\n\t\tbuttonIconSize,\n\t\tbuttonWidthMobile,\n\t\tbuttonHeightMobile,\n\t\tbuttonIconSizeMobile,\n\t\tbuttonBgColor,\n\t\tbuttonBorderRadius,\n\t\thideGreeting,\n\t\tlogoUrl,\n\t\twelcomeTitle,\n\t\twelcomeSubtitle,\n\t\thideWelcomeHeader,\n\t\tfooterText,\n\t\thideHeader,\n\t\tshowFirstMessage,\n\t\tquestionsLayout,\n\t\tquestionsLayoutMobile,\n\t\tchildren: _children,\n\t\t...providerProps\n\t} = props;\n\n\treturn (\n\t\t<ChatProvider {...providerProps}>\n\t\t\t<ChatWidgetInner\n\t\t\t\tmode={mode}\n\t\t\t\tposition={position}\n\t\t\t\tpositionMobile={positionMobile}\n\t\t\t\tisOpen={isOpen}\n\t\t\t\tonOpenChange={onOpenChange}\n\t\t\t\tpendingMessage={pendingMessage}\n\t\t\t\tzIndex={zIndex}\n\t\t\t\tgreetingText={greetingText}\n\t\t\t\tgreetingOffsetX={greetingOffsetX}\n\t\t\t\tgreetingOffsetY={greetingOffsetY}\n\t\t\t\tgreetingMaxWidth={greetingMaxWidth}\n\t\t\t\tbuttonOffsetXMobile={buttonOffsetXMobile}\n\t\t\t\tbuttonOffsetYMobile={buttonOffsetYMobile}\n\t\t\t\tbuttonOffsetXDesktop={buttonOffsetXDesktop}\n\t\t\t\tbuttonOffsetYDesktop={buttonOffsetYDesktop}\n\t\t\t\tbuttonIconUrl={buttonIconUrl}\n\t\t\t\tbuttonImageUrl={buttonImageUrl}\n\t\t\t\tbuttonImageUrlMobile={buttonImageUrlMobile}\n\t\t\t\tbuttonWidth={buttonWidth}\n\t\t\t\tbuttonHeight={buttonHeight}\n\t\t\t\tbuttonIconSize={buttonIconSize}\n\t\t\t\tbuttonWidthMobile={buttonWidthMobile}\n\t\t\t\tbuttonHeightMobile={buttonHeightMobile}\n\t\t\t\tbuttonIconSizeMobile={buttonIconSizeMobile}\n\t\t\t\tbuttonBgColor={buttonBgColor}\n\t\t\t\tbuttonBorderRadius={buttonBorderRadius}\n\t\t\t\thideGreeting={hideGreeting}\n\t\t\t\tlogoUrl={logoUrl}\n\t\t\t\twelcomeTitle={welcomeTitle}\n\t\t\t\twelcomeSubtitle={welcomeSubtitle}\n\t\t\t\thideWelcomeHeader={hideWelcomeHeader}\n\t\t\t\tfooterText={footerText}\n\t\t\t\thideHeader={hideHeader}\n\t\t\t\tshowFirstMessage={showFirstMessage}\n\t\t\t\tquestionsLayout={questionsLayout}\n\t\t\t\tquestionsLayoutMobile={questionsLayoutMobile}\n\t\t\t\tlanguage={providerProps.language as string | undefined}\n\t\t\t/>\n\t\t</ChatProvider>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["../src/providers/ChatProvider.tsx","../src/components/Chat.tsx","../src/components/ChatWidget.tsx"],"names":["jsx","jsxs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,IAAM,aAAA,GAA8C;AAAA,EAClD,SAAA;AAAA,EACA,gBAAA;AAAA,EACA,kBAAA;AAAA,EACA,eAAA;AAAA,EACA,mBAAA;AAAA,EACA,eAAA;AAAA,EACA,aAAA;AAAA,EACA,YAAA;AAAA,EACA,cAAA;AAAA,EACA,cAAA;AAAA,EACA,qBAAA;AAAA,EACA,qBAAA;AAAA,EACA,iBAAA;AAAA,EACA,SAAA;AAAA,EACA,mBAAA;AAAA,EACA,kBAAA;AAAA,EACA,iBAAA;AAAA,EACA;AACF,CAAA;AAEA,SAAS,cAAc,KAAA,EAAoD;AACzE,EAAA,MAAM,MAA+B,EAAC;AACtC,EAAA,KAAA,MAAW,OAAO,aAAA,EAAe;AAC/B,IAAA,IAAI,KAAA,CAAM,GAAG,CAAA,KAAM,MAAA,MAAe,GAAG,CAAA,GAAI,MAAM,GAAG,CAAA;AAAA,EACpD;AACA,EAAA,OAAO,GAAA;AACT;AAaO,SAAS,aAAa,KAAA,EAA0B;AACrD,EAAA,MAAM;AAAA,IACJ,QAAA;AAAA,IACA,SAAA;AAAA,IACA,WAAA;AAAA,IACA,MAAA;AAAA,IACA,UAAA;AAAA,IACA,OAAA;AAAA,IACA,SAAA;AAAA,IACA,WAAA;AAAA,IACA,QAAA;AAAA,IACA,YAAA;AAAA,IACA,KAAA;AAAA,IACA,KAAA;AAAA,IACA,cAAA,GAAiB,KAAA;AAAA,IACjB,cAAA;AAAA,IACA,eAAA,EAAiB,gBAAA;AAAA,IACjB,WAAA,EAAa,YAAA;AAAA,IACb,SAAA,EAA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YAAA;AAAA,MACA,cAAA;AAAA,MACA,iBAAA;AAAA,MACA,kBAAA;AAAA,MACA,oBAAA;AAAA,MACA,aAAA;AAAA,MACA,kBAAA;AAAA,MACA,YAAA;AAAA,MACA,OAAA;AAAA,MACA,YAAA;AAAA,MACA,eAAA;AAAA,MACA,iBAAA;AAAA,MACA,UAAA;AAAA,MACA,UAAA;AAAA,MACA,gBAAA;AAAA,MACA,eAAA;AAAA,MACA,qBAAA;AAAA,MACA,YAAA;AAAA,MACA,UAAU,aAAA,CAAc;AAAA;AAAA,GACzB,EACD,CAAA;AAEF","file":"index.js","sourcesContent":["\"use client\";\n\nimport { I18nProvider } from \"./I18nProvider\";\nimport { ThemeProvider } from \"./ThemeProvider\";\nimport { SlotsProvider } from \"./SlotsContext\";\nimport { ChatContextProvider } from \"./ChatContext\";\nimport { LiveChatProvider } from \"./LiveChatProvider\";\nimport { PreviewEmbedProvider } from \"./PreviewEmbedProvider\";\nimport type { ChatProviderProps, ChatEventCallbacks } from \"../core/types\";\nimport type { TranslationMap } from \"./I18nProvider\";\n\nconst CALLBACK_KEYS: (keyof ChatEventCallbacks)[] = [\n \"onReady\",\n \"onSessionStart\",\n \"onSessionRestore\",\n \"onMessageSent\",\n \"onMessageReceived\",\n \"onStreamStart\",\n \"onStreamEnd\",\n \"onToolCall\",\n \"onToolResult\",\n \"onToolAction\",\n \"onLiveChatRequested\",\n \"onLiveChatConnected\",\n \"onLiveChatEnded\",\n \"onError\",\n \"onNewConversation\",\n \"onStopGeneration\",\n \"onClearMessages\",\n \"onInteraction\",\n];\n\nfunction pickCallbacks(props: Record<string, unknown>): ChatEventCallbacks {\n const out: Record<string, unknown> = {};\n for (const key of CALLBACK_KEYS) {\n if (props[key] !== undefined) out[key] = props[key];\n }\n return out as ChatEventCallbacks;\n}\n\n/**\n * Top-level provider that composes all Aigentyc Chat sub-providers.\n *\n * Provider order (outermost to innermost):\n * 1. I18nProvider\n * 2. ThemeProvider (renders `<div data-aigentyc-chat>`)\n * 3. SlotsProvider\n * 4. ChatContextProvider\n * 5. LiveChatProvider (conditional on `enableLiveChat`)\n * 6. PreviewEmbedProvider\n */\nexport function ChatProvider(props: ChatProviderProps) {\n const {\n children,\n projectId,\n apiEndpoint,\n apiKey,\n clientName,\n pageUrl,\n pageTitle,\n pageContext,\n language,\n translations,\n theme,\n slots,\n enableLiveChat = false,\n chatServiceUrl,\n persistMessages: _persistMessages,\n maxMessages: _maxMessages,\n questions: _questions,\n ...rest\n } = props;\n\n const callbacks = pickCallbacks(rest as Record<string, unknown>);\n const config = {\n projectId,\n apiEndpoint,\n apiKey,\n clientName,\n pageUrl,\n pageTitle,\n pageContext,\n };\n\n // Flatten translations from per-language map into single overrides.\n const langCode = language ?? \"en\";\n const translationOverrides = translations?.[langCode] as Partial<TranslationMap> | undefined;\n\n const liveChatUrl = chatServiceUrl ?? apiEndpoint;\n const inner = enableLiveChat && liveChatUrl && apiKey ? (\n <LiveChatProvider\n chatServiceUrl={liveChatUrl}\n apiKey={apiKey}\n projectId={projectId || \"default\"}\n sessionId=\"default\"\n >\n <PreviewEmbedProvider>{children}</PreviewEmbedProvider>\n </LiveChatProvider>\n ) : (\n <PreviewEmbedProvider>{children}</PreviewEmbedProvider>\n );\n\n return (\n <I18nProvider language={language} translations={translationOverrides}>\n <ThemeProvider theme={theme}>\n <SlotsProvider slots={slots as never}>\n <ChatContextProvider\n config={config}\n callbacks={callbacks}\n >\n {inner}\n </ChatContextProvider>\n </SlotsProvider>\n </ThemeProvider>\n </I18nProvider>\n );\n}\n","\"use client\";\n\n/**\n * Chat — Level 1 drop-in embed component.\n *\n * Wraps everything in `<ChatProvider>` internally and renders `<ChatInterface />`\n * inline (no floating button, no overlay). Use this when you want to embed a\n * chat directly inside a page layout.\n */\n\nimport type { ChatProviderProps } from \"../core/types\";\nimport { ChatProvider } from \"../providers/ChatProvider\";\nimport { ChatInterface } from \"./ChatInterface\";\n\nexport interface ChatProps extends ChatProviderProps {\n /** Optional className forwarded to the ChatInterface root. */\n className?: string;\n /**\n * Show citation sources under each assistant message that used the\n * `searchKnowledgeBase` tool. Off by default.\n */\n showSources?: boolean;\n /**\n * Controls the rendering order of message parts (text vs tool results).\n * - `\"text-first\"` (default) — text parts render before tool cards\n * - `\"tools-first\"` — tool cards render before text\n * - `\"stream-order\"` — parts render in the order received from the API\n */\n messagePartOrder?: \"text-first\" | \"tools-first\" | \"stream-order\";\n /**\n * Where the view settles while an answer streams in.\n * - `\"latest-turn\"` (default) — the question stays at the top\n * - `\"bottom\"` — always follows the end of the content\n */\n scrollAnchor?: \"latest-turn\" | \"bottom\";\n}\n\nexport function Chat({ className, children, showSources, messagePartOrder, scrollAnchor, ...providerProps }: ChatProps) {\n return (\n <ChatProvider {...(providerProps as unknown as React.ComponentProps<typeof ChatProvider>)}>\n <div className={className}>\n <ChatInterface showSources={showSources} messagePartOrder={messagePartOrder} scrollAnchor={scrollAnchor} />\n {children}\n </div>\n </ChatProvider>\n );\n}\n\nexport default Chat;\n","\"use client\";\n\n/**\n * Top-level widget (Level 1 API).\n *\n * Composes ChatProvider internally and renders FloatingButton, ChatInterface,\n * LiveChatPanel, and PreviewEmbedPanel based on widget mode.\n */\n\nimport { useState, useCallback, useEffect, useMemo } from \"react\";\nimport { ChatProvider } from \"../providers/ChatProvider\";\nimport type { ChatProviderProps } from \"../core/types\";\nimport { useIsMobile } from \"../hooks/use-mobile\";\nimport { cn } from \"../core/utils\";\nimport { ChatInterface } from \"./ChatInterface\";\nimport { FloatingButton } from \"./FloatingButton\";\nimport { LiveChatPanel, MobileLiveChatDrawer } from \"./LiveChatPanel\";\nimport { PreviewEmbedPanel } from \"./PreviewEmbedPanel\";\nimport { usePreviewEmbed } from \"../providers/PreviewEmbedProvider\";\nimport { useSlots, renderSlot } from \"../providers/SlotsContext\";\n\n/** Widget placement mode. */\nexport type WidgetMode = \"floating\" | \"inline\" | \"trigger\";\n\nexport interface ChatWidgetProps extends ChatProviderProps {\n\t/** How the widget is rendered. Default \"floating\". */\n\tmode?: WidgetMode;\n\t/** Fixed position for the floating button. Default \"bottom-right\". */\n\tposition?: \"bottom-right\" | \"bottom-left\" | \"top-right\" | \"top-left\";\n\tpositionMobile?: \"bottom-right\" | \"bottom-left\" | \"top-right\" | \"top-left\";\n\t/** Controlled open state. */\n\tisOpen?: boolean;\n\t/** Fired whenever the widget opens/closes. */\n\tonOpenChange?: (open: boolean) => void;\n\t/** Message to pre-fill and auto-submit on open. */\n\tpendingMessage?: string | null;\n\t/** Overlay z-index (defaults to 9999). */\n\tzIndex?: number;\n\n\t// Floating button customisation\n\tgreetingText?: string;\n\tgreetingOffsetX?: string;\n\tgreetingOffsetY?: string;\n\tgreetingMaxWidth?: string;\n\tbuttonOffsetXMobile?: string;\n\tbuttonOffsetYMobile?: string;\n\tbuttonOffsetXDesktop?: string;\n\tbuttonOffsetYDesktop?: string;\n\tbuttonIconUrl?: string;\n\tbuttonImageUrl?: string;\n\tbuttonImageUrlMobile?: string;\n\tbuttonWidth?: string;\n\tbuttonHeight?: string;\n\tbuttonIconSize?: string;\n\tbuttonWidthMobile?: string;\n\tbuttonHeightMobile?: string;\n\tbuttonIconSizeMobile?: string;\n\tbuttonBgColor?: string;\n\tbuttonBorderRadius?: string;\n\thideGreeting?: boolean;\n\n\t// Welcome-page customisation (passed through to ChatInterface)\n\tlogoUrl?: string;\n\twelcomeTitle?: string;\n\twelcomeSubtitle?: string;\n\thideWelcomeHeader?: boolean;\n\tfooterText?: string;\n\thideHeader?: boolean;\n\tshowFirstMessage?: boolean;\n\tquestionsLayout?: \"vertical\" | \"horizontal\";\n\tquestionsLayoutMobile?: \"vertical\" | \"horizontal\";\n\t/** Show citation sources under each assistant message. Off by default. */\n\tshowSources?: boolean;\n\t/** Controls rendering order of message parts. Default: \"text-first\". */\n\tmessagePartOrder?: \"text-first\" | \"tools-first\" | \"stream-order\";\n\t/**\n\t * Where the view settles while an answer streams in. Default:\n\t * `\"latest-turn\"` — the visitor's question stays at the top and a long answer\n\t * is read from its first line. `\"bottom\"` always follows the end.\n\t */\n\tscrollAnchor?: \"latest-turn\" | \"bottom\";\n}\n\n/** Bridges the \"widget-preview-open\" custom event to the PreviewEmbed context. */\nfunction PreviewEventBridge() {\n\tconst previewEmbed = usePreviewEmbed();\n\n\tuseEffect(() => {\n\t\tif (!previewEmbed || typeof window === \"undefined\") return;\n\t\tconst handler = (e: Event) => {\n\t\t\tconst { url, title, description } = (e as CustomEvent).detail || {};\n\t\t\tif (url) previewEmbed.openPreview({ url, title, description });\n\t\t};\n\t\twindow.addEventListener(\"widget-preview-open\", handler);\n\t\treturn () => window.removeEventListener(\"widget-preview-open\", handler);\n\t}, [previewEmbed]);\n\n\treturn null;\n}\n\n/** Mobile preview drawer — slides up from bottom of the widget. */\nfunction MobilePreviewDrawer() {\n\tconst previewEmbed = usePreviewEmbed();\n\tconst isVisible = !!previewEmbed?.preview;\n\tconst preview = previewEmbed?.preview;\n\tconst closePreview = previewEmbed?.closePreview;\n\n\treturn (\n\t\t<>\n\t\t\t<div\n\t\t\t\tclassName=\"absolute inset-0 z-40 bg-black/50\"\n\t\t\t\tstyle={{\n\t\t\t\t\topacity: isVisible ? 1 : 0,\n\t\t\t\t\tpointerEvents: isVisible ? \"auto\" : \"none\",\n\t\t\t\t\ttransition: \"opacity 200ms ease-out\",\n\t\t\t\t}}\n\t\t\t\tonClick={closePreview}\n\t\t\t/>\n\t\t\t<div\n\t\t\t\tclassName=\"absolute inset-x-0 bottom-0 z-50 rounded-t-2xl border-t shadow-2xl\"\n\t\t\t\tstyle={{\n\t\t\t\t\tbackgroundColor: \"var(--ac-background)\",\n\t\t\t\t\tborderColor: \"var(--ac-border)\",\n\t\t\t\t\theight: \"calc(100dvh - 150px)\",\n\t\t\t\t\ttransform: isVisible ? \"translateY(0)\" : \"translateY(100%)\",\n\t\t\t\t\ttransition: \"transform 300ms cubic-bezier(0.32, 0.72, 0, 1)\",\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<div className=\"flex justify-center pt-3 pb-1\">\n\t\t\t\t\t<div className=\"w-[100px] h-2 rounded-full bg-muted\" />\n\t\t\t\t</div>\n\t\t\t\t<div className=\"px-5 py-3 flex items-center justify-between\">\n\t\t\t\t\t<div className=\"min-w-0\">\n\t\t\t\t\t\t<h3 className=\"font-medium text-sm truncate\" style={{ color: \"var(--ac-text)\" }}>\n\t\t\t\t\t\t\t{preview?.title || \"Preview\"}\n\t\t\t\t\t\t</h3>\n\t\t\t\t\t\t{preview?.description && (\n\t\t\t\t\t\t\t<p className=\"text-xs text-muted-foreground mt-0.5 truncate\">{preview.description}</p>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tonClick={closePreview}\n\t\t\t\t\t\tclassName=\"shrink-0 w-8 h-8 rounded-full border flex items-center justify-center hover:bg-muted transition-colors ml-3\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<span className=\"sr-only\">Close</span>&times;\n\t\t\t\t\t</button>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"px-4 pb-4 flex-1\" style={{ height: \"calc(100% - 80px)\" }}>\n\t\t\t\t\t{preview && (\n\t\t\t\t\t\t<iframe\n\t\t\t\t\t\t\tkey={preview.url}\n\t\t\t\t\t\t\tsrc={preview.url}\n\t\t\t\t\t\t\tclassName=\"w-full h-full rounded-xl border-none\"\n\t\t\t\t\t\t\tsandbox=\"allow-scripts allow-same-origin allow-forms allow-popups allow-presentation\"\n\t\t\t\t\t\t\ttitle={preview.title || \"Preview\"}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\n/** Props for the inner widget shell — does not include ChatProvider config. */\ntype ChatWidgetInnerProps = Omit<\n\tChatWidgetProps,\n\tkeyof ChatProviderProps | \"children\"\n> & { language?: string };\n\n/** Inner component — rendered inside ChatProvider so it can read context. */\nfunction ChatWidgetInner({\n\tmode = \"floating\",\n\tposition = \"bottom-right\",\n\tpositionMobile,\n\tisOpen: controlledIsOpen,\n\tonOpenChange,\n\tpendingMessage: initialPendingMessage,\n\tzIndex,\n\tgreetingText,\n\tgreetingOffsetX,\n\tgreetingOffsetY,\n\tgreetingMaxWidth,\n\tbuttonOffsetXMobile,\n\tbuttonOffsetYMobile,\n\tbuttonOffsetXDesktop,\n\tbuttonOffsetYDesktop,\n\tbuttonIconUrl,\n\tbuttonImageUrl,\n\tbuttonImageUrlMobile,\n\tbuttonWidth,\n\tbuttonHeight,\n\tbuttonIconSize,\n\tbuttonWidthMobile,\n\tbuttonHeightMobile,\n\tbuttonIconSizeMobile,\n\tbuttonBgColor,\n\tbuttonBorderRadius,\n\thideGreeting,\n\tlogoUrl,\n\twelcomeTitle,\n\twelcomeSubtitle,\n\thideWelcomeHeader,\n\tfooterText,\n\thideHeader,\n\tshowFirstMessage,\n\tquestionsLayout,\n\tquestionsLayoutMobile,\n\tshowSources,\n\tmessagePartOrder,\n\tscrollAnchor,\n\tlanguage,\n}: ChatWidgetInnerProps) {\n\tconst [internalIsOpen, setInternalIsOpen] = useState(false);\n\tconst [pendingMessage, setPendingMessage] = useState<string | null>(initialPendingMessage ?? null);\n\tconst isMobile = useIsMobile();\n\tconst slots = useSlots();\n\n\tuseEffect(() => {\n\t\tif (controlledIsOpen === true) setInternalIsOpen(true);\n\t}, [controlledIsOpen]);\n\n\tconst isOpen = internalIsOpen;\n\n\t// Lock body scroll when open (except in inline mode)\n\tuseEffect(() => {\n\t\tif (mode === \"inline\" || typeof document === \"undefined\") return;\n\t\tif (isOpen) {\n\t\t\tconst originalStyle = window.getComputedStyle(document.body).overflow;\n\t\t\tdocument.body.style.overflow = \"hidden\";\n\t\t\treturn () => {\n\t\t\t\tdocument.body.style.overflow = originalStyle;\n\t\t\t};\n\t\t}\n\t}, [isOpen, mode]);\n\n\tconst handleOpen = useCallback(() => {\n\t\tsetInternalIsOpen(true);\n\t\tonOpenChange?.(true);\n\t}, [onOpenChange]);\n\n\tconst handleClose = useCallback(() => {\n\t\tsetInternalIsOpen(false);\n\t\tonOpenChange?.(false);\n\t}, [onOpenChange]);\n\n\tconst handleToggle = useCallback(() => {\n\t\tif (isOpen) handleClose();\n\t\telse handleOpen();\n\t}, [isOpen, handleOpen, handleClose]);\n\n\tconst isRightSide = position === \"bottom-right\" || position === \"top-right\";\n\tconst dirRTL = language === \"he\";\n\n\tconst chatInterfaceProps = useMemo(\n\t\t() => ({\n\t\t\tisOpen,\n\t\t\tonClose: handleClose,\n\t\t\tlogoUrl,\n\t\t\twelcomeTitle,\n\t\t\twelcomeSubtitle,\n\t\t\thideWelcomeHeader,\n\t\t\tfooterText,\n\t\t\thideHeader,\n\t\t\tshowFirstMessage,\n\t\t\tquestionsLayout,\n\t\t\tquestionsLayoutMobile,\n\t\t\tshowSources,\n\t\t\tmessagePartOrder,\n\t\t\tscrollAnchor,\n\t\t\tpendingMessage,\n\t\t\tonPendingMessageConsumed: () => setPendingMessage(null),\n\t\t}),\n\t\t[isOpen, handleClose, logoUrl, welcomeTitle, welcomeSubtitle, hideWelcomeHeader, footerText, hideHeader, showFirstMessage, questionsLayout, questionsLayoutMobile, showSources, messagePartOrder, scrollAnchor, pendingMessage],\n\t);\n\n\t// Inline mode\n\tif (mode === \"inline\") {\n\t\treturn (\n\t\t\t<div className=\"flex flex-col w-full h-full\" dir={dirRTL ? \"rtl\" : \"ltr\"} style={{ backgroundColor: \"var(--ac-background)\" }}>\n\t\t\t\t<ChatInterface {...chatInterfaceProps} />\n\t\t\t</div>\n\t\t);\n\t}\n\n\tconst panelZIndex = zIndex || 9999;\n\n\t// Floating button slot props\n\tconst floatingButtonProps = {\n\t\tonClick: handleToggle,\n\t\tposition,\n\t\tpositionMobile,\n\t\tisOpen,\n\t\tgreeting: greetingText,\n\t\tgreetingOffsetX,\n\t\tgreetingOffsetY,\n\t\tgreetingMaxWidth,\n\t\tbuttonOffsetXMobile,\n\t\tbuttonOffsetYMobile,\n\t\tbuttonOffsetXDesktop,\n\t\tbuttonOffsetYDesktop,\n\t\tbuttonIconUrl,\n\t\tbuttonImageUrl,\n\t\tbuttonImageUrlMobile,\n\t\tbuttonWidth,\n\t\tbuttonHeight,\n\t\tbuttonIconSize,\n\t\tbuttonWidthMobile,\n\t\tbuttonHeightMobile,\n\t\tbuttonIconSizeMobile,\n\t\tbuttonBgColor,\n\t\tbuttonBorderRadius,\n\t\tzIndex: zIndex || 999999,\n\t\thideGreeting,\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<PreviewEventBridge />\n\n\t\t\t{/* Overlay */}\n\t\t\t<div\n\t\t\t\tclassName=\"fixed inset-0 bg-black/50 transition-opacity duration-300 ease-in-out\"\n\t\t\t\tstyle={{\n\t\t\t\t\tzIndex: panelZIndex - 1,\n\t\t\t\t\topacity: isOpen ? 1 : 0,\n\t\t\t\t\tpointerEvents: isOpen ? \"auto\" : \"none\",\n\t\t\t\t}}\n\t\t\t\tonClick={handleClose}\n\t\t\t/>\n\n\t\t\t{!isMobile && <PreviewEmbedPanel isOpen={isOpen} isRightSide={isRightSide} zIndex={panelZIndex - 1} />}\n\t\t\t{!isMobile && <LiveChatPanel isWidgetOpen={isOpen} isRightSide={isRightSide} zIndex={panelZIndex - 1} />}\n\n\t\t\t{/* Main chat panel */}\n\t\t\t<div\n\t\t\t\tclassName={cn(\n\t\t\t\t\t\"fixed flex flex-col p-0 shadow-2xl\",\n\t\t\t\t\tisMobile\n\t\t\t\t\t\t? \"inset-x-0 rounded-t-2xl border-t\"\n\t\t\t\t\t\t: cn(\"inset-y-0 w-full max-w-[780px]\", isRightSide ? \"right-0 border-l\" : \"left-0 border-r\"),\n\t\t\t\t)}\n\t\t\t\tdir={dirRTL ? \"rtl\" : \"ltr\"}\n\t\t\t\tstyle={{\n\t\t\t\t\tbackgroundColor: \"var(--ac-background)\",\n\t\t\t\t\tborderColor: \"var(--ac-border)\",\n\t\t\t\t\t...(isMobile\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\ttop: \"70px\",\n\t\t\t\t\t\t\t\tbottom: 0,\n\t\t\t\t\t\t\t\theight: \"calc(100dvh - 70px)\",\n\t\t\t\t\t\t\t\ttransform: isOpen ? \"translateY(0)\" : \"translateY(100%)\",\n\t\t\t\t\t\t\t\topacity: isOpen ? 1 : 0,\n\t\t\t\t\t\t\t\tpointerEvents: isOpen ? \"auto\" : \"none\",\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\ttransform: isOpen ? \"translateX(0)\" : isRightSide ? \"translateX(100%)\" : \"translateX(-100%)\",\n\t\t\t\t\t\t\t\topacity: isOpen ? 1 : 0,\n\t\t\t\t\t\t\t\tpointerEvents: isOpen ? \"auto\" : \"none\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\ttransition: \"transform 300ms ease-in-out\",\n\t\t\t\t\tzIndex: panelZIndex,\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{isMobile && <MobilePreviewDrawer />}\n\t\t\t\t<MobileLiveChatDrawer />\n\n\t\t\t\t<ChatInterface {...chatInterfaceProps} />\n\t\t\t</div>\n\n\t\t\t{/* Floating button — hidden when open */}\n\t\t\t{!isOpen &&\n\t\t\t\trenderSlot(\n\t\t\t\t\t\"floatingButton\",\n\t\t\t\t\tfloatingButtonProps as never,\n\t\t\t\t\tFloatingButton as never,\n\t\t\t\t\tslots,\n\t\t\t\t)}\n\t\t</>\n\t);\n}\n\n/**\n * Top-level widget (Level 1 API). Composes ChatProvider internally and renders\n * the correct shell based on `mode`.\n */\nexport function ChatWidget(props: ChatWidgetProps) {\n\t// Split ChatProviderProps from widget-shell props.\n\tconst {\n\t\t// Widget shell props consumed by inner component (also forwarded separately)\n\t\tmode,\n\t\tposition,\n\t\tpositionMobile,\n\t\tisOpen,\n\t\tonOpenChange,\n\t\tpendingMessage,\n\t\tzIndex,\n\t\tgreetingText,\n\t\tgreetingOffsetX,\n\t\tgreetingOffsetY,\n\t\tgreetingMaxWidth,\n\t\tbuttonOffsetXMobile,\n\t\tbuttonOffsetYMobile,\n\t\tbuttonOffsetXDesktop,\n\t\tbuttonOffsetYDesktop,\n\t\tbuttonIconUrl,\n\t\tbuttonImageUrl,\n\t\tbuttonImageUrlMobile,\n\t\tbuttonWidth,\n\t\tbuttonHeight,\n\t\tbuttonIconSize,\n\t\tbuttonWidthMobile,\n\t\tbuttonHeightMobile,\n\t\tbuttonIconSizeMobile,\n\t\tbuttonBgColor,\n\t\tbuttonBorderRadius,\n\t\thideGreeting,\n\t\tlogoUrl,\n\t\twelcomeTitle,\n\t\twelcomeSubtitle,\n\t\thideWelcomeHeader,\n\t\tfooterText,\n\t\thideHeader,\n\t\tshowFirstMessage,\n\t\tquestionsLayout,\n\t\tquestionsLayoutMobile,\n\t\tscrollAnchor,\n\t\tchildren: _children,\n\t\t...providerProps\n\t} = props;\n\n\treturn (\n\t\t<ChatProvider {...providerProps}>\n\t\t\t<ChatWidgetInner\n\t\t\t\tmode={mode}\n\t\t\t\tposition={position}\n\t\t\t\tpositionMobile={positionMobile}\n\t\t\t\tisOpen={isOpen}\n\t\t\t\tonOpenChange={onOpenChange}\n\t\t\t\tpendingMessage={pendingMessage}\n\t\t\t\tzIndex={zIndex}\n\t\t\t\tgreetingText={greetingText}\n\t\t\t\tgreetingOffsetX={greetingOffsetX}\n\t\t\t\tgreetingOffsetY={greetingOffsetY}\n\t\t\t\tgreetingMaxWidth={greetingMaxWidth}\n\t\t\t\tbuttonOffsetXMobile={buttonOffsetXMobile}\n\t\t\t\tbuttonOffsetYMobile={buttonOffsetYMobile}\n\t\t\t\tbuttonOffsetXDesktop={buttonOffsetXDesktop}\n\t\t\t\tbuttonOffsetYDesktop={buttonOffsetYDesktop}\n\t\t\t\tbuttonIconUrl={buttonIconUrl}\n\t\t\t\tbuttonImageUrl={buttonImageUrl}\n\t\t\t\tbuttonImageUrlMobile={buttonImageUrlMobile}\n\t\t\t\tbuttonWidth={buttonWidth}\n\t\t\t\tbuttonHeight={buttonHeight}\n\t\t\t\tbuttonIconSize={buttonIconSize}\n\t\t\t\tbuttonWidthMobile={buttonWidthMobile}\n\t\t\t\tbuttonHeightMobile={buttonHeightMobile}\n\t\t\t\tbuttonIconSizeMobile={buttonIconSizeMobile}\n\t\t\t\tbuttonBgColor={buttonBgColor}\n\t\t\t\tbuttonBorderRadius={buttonBorderRadius}\n\t\t\t\thideGreeting={hideGreeting}\n\t\t\t\tlogoUrl={logoUrl}\n\t\t\t\twelcomeTitle={welcomeTitle}\n\t\t\t\twelcomeSubtitle={welcomeSubtitle}\n\t\t\t\thideWelcomeHeader={hideWelcomeHeader}\n\t\t\t\tfooterText={footerText}\n\t\t\t\thideHeader={hideHeader}\n\t\t\t\tshowFirstMessage={showFirstMessage}\n\t\t\t\tquestionsLayout={questionsLayout}\n\t\t\t\tquestionsLayoutMobile={questionsLayoutMobile}\n\t\t\t\tscrollAnchor={scrollAnchor}\n\t\t\t\tlanguage={providerProps.language as string | undefined}\n\t\t\t/>\n\t\t</ChatProvider>\n\t);\n}\n"]}
@@ -888,28 +888,28 @@ Each entry below shows the typed exports for one subpath of the package. Use the
888
888
  ### `@aigentyc/chat-sdk` — Main exports — Chat, ChatWidget, ChatProvider, useAigentycChat
889
889
 
890
890
  ```ts
891
- export { a as ChatAttachmentInput, b as ChatConfig, c as ChatEventCallbacks, d as ChatMessage, e as ComponentAction, L as Language, f as LiveChatMessage, g as LiveChatState, Q as QuestionConfig, S as SlotMap, T as ThemeConfig, h as ToolRendererProps, i as ToolResult } from './types-bsR_-fq8.js';
891
+ export { c as ChatAttachmentInput, d as ChatConfig, e as ChatEventCallbacks, f as ChatMessage, C as ComponentAction, L as Language, g as LiveChatMessage, h as LiveChatState, Q as QuestionConfig, S as SlotMap, i as ThemeConfig, T as ToolRendererProps, a as ToolResult } from './types-DRa1zFlN.js';
892
892
 
893
- export { A as AutoResizeOptions, K as KeyboardLanguageOptions, L as LATIN, a as LiveChatReturn, S as SlotComponent, b as SlotName, U as UseAigentycChatOptions, c as UseAigentycChatReturn, d as detectLanguage, r as renderSlot, s as scriptLanguageOf, u as useAigentycChat, e as useAutoResize, f as useChatContext, g as useKeyboardLanguage, h as useLiveChat, i as useSlot, j as useSlots } from './SlotsContext-BZBi51ZT.js';
893
+ export { A as AutoResizeOptions, K as KeyboardLanguageOptions, L as LATIN, a as LiveChatReturn, S as SlotComponent, b as SlotName, U as UseAigentycChatOptions, c as UseAigentycChatReturn, d as detectLanguage, r as renderSlot, s as scriptLanguageOf, u as useAigentycChat, e as useAutoResize, f as useChatContext, g as useKeyboardLanguage, h as useLiveChat, i as useSlot, j as useSlots } from './SlotsContext-B_087V7B.js';
894
894
 
895
895
  export { useTheme } from './theme.js';
896
896
 
897
897
  export { useI18n } from './i18n.js';
898
898
 
899
- export { A as AssistantMessageSlotProps, C as ChatInterfaceProps, U as UserMessageSlotProps } from './ChatInterface-2MN5cpYB.js';
899
+ export { A as AssistantMessageSlotProps, C as ChatInterfaceProps, U as UserMessageSlotProps } from './ChatInterface-CRmM_RG_.js';
900
900
 
901
901
  export { g as getToolDisplayData, n as normalizeToolRows } from './normalize-KzCLLqpU.js';
902
902
 
903
903
  export { F as FeedbackData, M as MessageFeedbackActionsState } from './message-feedback-cWR0NVok.js';
904
904
 
905
- export { Chat, ChatErrorBoundary, type ChatProps, ChatProvider, ChatProviderProps, ChatWidget };
905
+ export { Chat, ChatError, ChatErrorBoundary, type ChatErrorProps, type ChatProps, ChatProvider, ChatProviderProps, ChatWidget };
906
906
  ```
907
907
 
908
908
 
909
909
  ### `@aigentyc/chat-sdk/hooks` — Hooks — useAigentycChat, useChatContext, useTheme, useI18n, useLiveChat, useSlots
910
910
 
911
911
  ```ts
912
- export { A as AutoResizeOptions, K as KeyboardLanguageOptions, L as LATIN, a as LiveChatReturn, U as UseAigentycChatOptions, c as UseAigentycChatReturn, d as detectLanguage, s as scriptLanguageOf, u as useAigentycChat, e as useAutoResize, f as useChatContext, g as useKeyboardLanguage, h as useLiveChat, i as useSlot, j as useSlots } from './SlotsContext-BZBi51ZT.js';
912
+ export { A as AutoResizeOptions, K as KeyboardLanguageOptions, L as LATIN, a as LiveChatReturn, U as UseAigentycChatOptions, c as UseAigentycChatReturn, d as detectLanguage, s as scriptLanguageOf, u as useAigentycChat, e as useAutoResize, f as useChatContext, g as useKeyboardLanguage, h as useLiveChat, i as useSlot, j as useSlots } from './SlotsContext-B_087V7B.js';
913
913
 
914
914
  export { useTheme } from './theme.js';
915
915
 
@@ -924,7 +924,7 @@ export { useImageLoader, useIsMobile, useMultiImageLoader, useMultiOrderTracking
924
924
  ### `@aigentyc/chat-sdk/components` — Granular components — ChatInterface, ChatInput, ChatHeader, etc.
925
925
 
926
926
  ```ts
927
- export { a as ChatInterface } from './ChatInterface-2MN5cpYB.js';
927
+ export { a as ChatInterface } from './ChatInterface-CRmM_RG_.js';
928
928
 
929
929
  export { CartDrawer, ChatDrawer, ChatFooter, ChatHeader, ChatInput, ChatInputWithAttachments, FloatingButton, LiveChatHeader, LiveChatPanel, LiveChatQueueBanner, PreviewEmbedPanel, QuickQuestions, SatisfactionRating, SystemMessage, VisitorIdentityForm, WelcomePage };
930
930
  ```
@@ -933,7 +933,7 @@ export { CartDrawer, ChatDrawer, ChatFooter, ChatHeader, ChatInput, ChatInputWit
933
933
  ### `@aigentyc/chat-sdk/tools` — Tool rendering — ToolRenderer, SearchKnowledgeBaseRenderer
934
934
 
935
935
  ```ts
936
- export { e as ComponentAction, i as ToolResult } from './types-bsR_-fq8.js';
936
+ export { C as ComponentAction, a as ToolResult } from './types-DRa1zFlN.js';
937
937
 
938
938
  export { J as JsonRenderResult } from './JsonRenderResult-D6ogds0_.js';
939
939
 
@@ -946,7 +946,7 @@ export { ComponentRenderer, SearchKnowledgeBaseRenderer, ToolRenderer, ToolRende
946
946
  ### `@aigentyc/chat-sdk/theme` — Theming — ThemeProvider
947
947
 
948
948
  ```ts
949
- export { T as ThemeConfig } from './types-bsR_-fq8.js';
949
+ export { i as ThemeConfig } from './types-DRa1zFlN.js';
950
950
 
951
951
  export { ThemeProvider, useTheme };
952
952
  ```
@@ -955,7 +955,7 @@ export { ThemeProvider, useTheme };
955
955
  ### `@aigentyc/chat-sdk/i18n` — Internationalization — addLanguage
956
956
 
957
957
  ```ts
958
- export { L as Language } from './types-bsR_-fq8.js';
958
+ export { L as Language } from './types-DRa1zFlN.js';
959
959
 
960
960
  export { I18nProvider, type I18nProviderProps, type TranslationKeys, type TranslationMap, addLanguage, isRTL, useI18n };
961
961
  ```
@@ -964,7 +964,7 @@ export { I18nProvider, type I18nProviderProps, type TranslationKeys, type Transl
964
964
  ### `@aigentyc/chat-sdk/core` — Core types and utilities
965
965
 
966
966
  ```ts
967
- export { a as ChatAttachmentInput, c as ChatEventCallbacks, d as ChatMessage, C as ChatProviderProps, e as ComponentAction, L as Language, f as LiveChatMessage, g as LiveChatState, Q as QuestionConfig, S as SlotMap, j as SlotProps, T as ThemeConfig, h as ToolRendererProps, i as ToolResult } from './types-bsR_-fq8.js';
967
+ export { c as ChatAttachmentInput, e as ChatEventCallbacks, f as ChatMessage, b as ChatProviderProps, C as ComponentAction, L as Language, g as LiveChatMessage, h as LiveChatState, Q as QuestionConfig, S as SlotMap, j as SlotProps, i as ThemeConfig, T as ToolRendererProps, a as ToolResult } from './types-DRa1zFlN.js';
968
968
 
969
969
  export { I as InteractionMetadata, a as InteractionType, T as TrackInteractionParams, U as UseInteractionTrackerOptions, g as generateSessionId, u as useInteractionTracker } from './interaction-tracker-D9P1Oq4j.js';
970
970