@elevenlabs/convai-widget-core 0.5.2 → 0.6.0-beta.3

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 (45) hide show
  1. package/dist/components/Avatar.d.ts +1 -1
  2. package/dist/components/Button.d.ts +3 -2
  3. package/dist/components/CopyButton.d.ts +1 -1
  4. package/dist/components/Flag.d.ts +1 -1
  5. package/dist/components/Icon.d.ts +11 -0
  6. package/dist/components/InOutTransition.d.ts +1 -1
  7. package/dist/components/SizeTransition.d.ts +1 -1
  8. package/dist/components/TextArea.d.ts +1 -1
  9. package/dist/contexts/conversation.d.ts +19 -0
  10. package/dist/contexts/root-portal.d.ts +1 -1
  11. package/dist/contexts/widget-config.d.ts +1 -0
  12. package/dist/contexts/widget-size.d.ts +14 -0
  13. package/dist/index.js +31926 -4866
  14. package/dist/markdown/components/CodeBlock.d.ts +7 -0
  15. package/dist/markdown/components/ContentBlock.d.ts +19 -0
  16. package/dist/markdown/components/Image.d.ts +5 -0
  17. package/dist/markdown/components/Table.d.ts +11 -0
  18. package/dist/markdown/components/components.d.ts +2 -0
  19. package/dist/markdown/index.d.ts +12 -0
  20. package/dist/markdown/utils/highlighter.d.ts +11 -0
  21. package/dist/markdown/utils/parse-blocks.d.ts +1 -0
  22. package/dist/markdown/utils/parse-incomplete-markdown.d.ts +1 -0
  23. package/dist/markdown/utils/utils.d.ts +1 -0
  24. package/dist/markdown.dev.d.ts +1 -0
  25. package/dist/mocks/browser.d.ts +7 -7
  26. package/dist/types/config.d.ts +3 -0
  27. package/dist/utils/cn.d.ts +2 -0
  28. package/dist/utils/useStickToBottom.d.ts +13 -0
  29. package/dist/version.d.ts +1 -1
  30. package/dist/widget/AvatarOverlay.d.ts +7 -0
  31. package/dist/widget/CompactTrigger.d.ts +1 -1
  32. package/dist/widget/ErrorModal.d.ts +1 -1
  33. package/dist/widget/ExpandableTriggerActions.d.ts +1 -1
  34. package/dist/widget/FeedbackActions.d.ts +1 -1
  35. package/dist/widget/FeedbackPage.d.ts +1 -1
  36. package/dist/widget/FullTrigger.d.ts +1 -1
  37. package/dist/widget/SheetActions.d.ts +2 -4
  38. package/dist/widget/SheetActionsV2.d.ts +5 -0
  39. package/dist/widget/SheetHeader.d.ts +5 -4
  40. package/dist/widget/StatusLabel.d.ts +1 -1
  41. package/dist/widget/Transcript.d.ts +1 -1
  42. package/dist/widget/Trigger.d.ts +1 -1
  43. package/dist/widget/TriggerMuteButton.d.ts +1 -5
  44. package/package.json +37 -15
  45. package/LICENSE +0 -21
@@ -0,0 +1,7 @@
1
+ import { type HTMLAttributes } from "preact/compat";
2
+ type CodeBlockProps = HTMLAttributes<HTMLDivElement> & {
3
+ code: string;
4
+ language: string;
5
+ };
6
+ export declare const CodeBlock: ({ code, language, className, ...rest }: CodeBlockProps) => import("preact").JSX.Element;
7
+ export {};
@@ -0,0 +1,19 @@
1
+ import type { ComponentChildren } from "preact";
2
+ import type { HTMLAttributes } from "preact/compat";
3
+ type ContentBlockRootProps = HTMLAttributes<HTMLDivElement> & {
4
+ children: ComponentChildren;
5
+ };
6
+ declare function ContentBlockRoot({ children, className, ...props }: ContentBlockRootProps): import("preact").JSX.Element;
7
+ type ContentBlockActionsProps = HTMLAttributes<HTMLDivElement> & {
8
+ children: ComponentChildren;
9
+ };
10
+ declare function ContentBlockActions({ children, className, ...props }: ContentBlockActionsProps): import("preact").JSX.Element;
11
+ type ContentBlockContentProps = HTMLAttributes<HTMLDivElement> & {
12
+ children: ComponentChildren;
13
+ };
14
+ declare function ContentBlockContent({ children, className, ...props }: ContentBlockContentProps): import("preact").JSX.Element;
15
+ export declare const ContentBlock: typeof ContentBlockRoot & {
16
+ Actions: typeof ContentBlockActions;
17
+ Content: typeof ContentBlockContent;
18
+ };
19
+ export {};
@@ -0,0 +1,5 @@
1
+ import type { DetailedHTMLProps, ImgHTMLAttributes } from "react";
2
+ import type { ExtraProps } from "react-markdown";
3
+ type ImageComponentProps = DetailedHTMLProps<ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement> & ExtraProps;
4
+ export declare const ImageComponent: ({ node, className, src, alt, ...props }: ImageComponentProps) => import("preact").JSX.Element | null;
5
+ export {};
@@ -0,0 +1,11 @@
1
+ import { HTMLAttributes } from "preact/compat";
2
+ export declare function useCopyTable({ onCopy, onError, timeout, }?: {
3
+ onCopy?: () => void;
4
+ onError?: (error: Error) => void;
5
+ timeout?: number;
6
+ }): {
7
+ isCopied: import("@preact/signals").Signal<boolean>;
8
+ copyTableData: (event: React.MouseEvent<HTMLButtonElement>) => Promise<void>;
9
+ disabled: boolean;
10
+ };
11
+ export declare const TableComponent: ({ children, className, ...props }: HTMLAttributes<HTMLTableElement>) => import("preact").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { Options } from "react-markdown";
2
+ export declare const components: Options["components"];
@@ -0,0 +1,12 @@
1
+ import { type Options } from "react-markdown";
2
+ export { defaultUrlTransform } from "react-markdown";
3
+ export type StreamdownProps = Options & {
4
+ parseIncompleteMarkdown?: boolean;
5
+ className?: string;
6
+ isAnimating?: boolean;
7
+ };
8
+ export type StreamdownRuntimeContextType = {
9
+ isAnimating: boolean;
10
+ };
11
+ export declare const StreamdownRuntimeContext: import("preact").Context<StreamdownRuntimeContextType>;
12
+ export declare const WidgetStreamdown: ({ children, parseIncompleteMarkdown: shouldParseIncompleteMarkdown, components, className, isAnimating, urlTransform, ...props }: StreamdownProps) => import("preact").JSX.Element;
@@ -0,0 +1,11 @@
1
+ import type { LRParser } from "@lezer/lr";
2
+ import type { MarkdownParser } from "@lezer/markdown";
3
+ export type Parser = LRParser | MarkdownParser;
4
+ export declare const ParsersContext: import("preact").Context<Record<string, Parser>>;
5
+ export declare const parserConfig: Record<string, Parser>;
6
+ export declare const languageParser: Record<string, string>;
7
+ export interface CodeProps {
8
+ code: string;
9
+ language?: string;
10
+ }
11
+ export declare const Code: (props: CodeProps) => import("preact").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const parseMarkdownIntoBlocks: (markdown: string) => string[];
@@ -0,0 +1 @@
1
+ export declare const parseIncompleteMarkdown: (text: string) => string;
@@ -0,0 +1 @@
1
+ export declare const save: (filename: string, content: string | Blob, mimeType: string) => void;
@@ -0,0 +1 @@
1
+ import "preact/debug";
@@ -10,8 +10,8 @@ export declare const AGENTS: {
10
10
  readonly end_feedback?: {
11
11
  type: import("../types/config").FeedbackType;
12
12
  } | null;
13
- readonly language: import("@elevenlabs/client").Language;
14
- readonly supported_language_overrides?: import("@elevenlabs/client").Language[];
13
+ readonly language: import("@elevenlabs/types").ConversationConfigOverrideAgentLanguage;
14
+ readonly supported_language_overrides?: import("@elevenlabs/types").ConversationConfigOverrideAgentLanguage[];
15
15
  readonly terms_html?: string;
16
16
  readonly terms_key?: string;
17
17
  readonly mic_muting_enabled: boolean;
@@ -21,7 +21,7 @@ export declare const AGENTS: {
21
21
  readonly always_expanded: boolean;
22
22
  readonly text_contents: Partial<import("../types/config").TextContents>;
23
23
  readonly styles?: Partial<import("../types/config").Styles>;
24
- readonly language_presets: Partial<Record<import("@elevenlabs/client").Language, {
24
+ readonly language_presets: Partial<Record<import("@elevenlabs/types").ConversationConfigOverrideAgentLanguage, {
25
25
  text_contents?: Partial<import("../types/config").TextContents>;
26
26
  first_message?: string;
27
27
  }>>;
@@ -40,8 +40,8 @@ export declare const AGENTS: {
40
40
  readonly end_feedback?: {
41
41
  type: import("../types/config").FeedbackType;
42
42
  } | null;
43
- readonly language: import("@elevenlabs/client").Language;
44
- readonly supported_language_overrides?: import("@elevenlabs/client").Language[];
43
+ readonly language: import("@elevenlabs/types").ConversationConfigOverrideAgentLanguage;
44
+ readonly supported_language_overrides?: import("@elevenlabs/types").ConversationConfigOverrideAgentLanguage[];
45
45
  readonly terms_html?: string;
46
46
  readonly terms_key?: string;
47
47
  readonly mic_muting_enabled: boolean;
@@ -51,7 +51,7 @@ export declare const AGENTS: {
51
51
  readonly always_expanded: boolean;
52
52
  readonly text_contents: Partial<import("../types/config").TextContents>;
53
53
  readonly styles?: Partial<import("../types/config").Styles>;
54
- readonly language_presets: Partial<Record<import("@elevenlabs/client").Language, {
54
+ readonly language_presets: Partial<Record<import("@elevenlabs/types").ConversationConfigOverrideAgentLanguage, {
55
55
  text_contents?: Partial<import("../types/config").TextContents>;
56
56
  first_message?: string;
57
57
  }>>;
@@ -63,4 +63,4 @@ export declare const AGENTS: {
63
63
  };
64
64
  readonly fail: WidgetConfig;
65
65
  };
66
- export declare const Worker: import("msw/lib/browser").SetupWorker;
66
+ export declare const Worker: import("msw/browser").SetupWorker;
@@ -82,6 +82,9 @@ export declare const DefaultTextContents: {
82
82
  follow_up_feedback_placeholder: string;
83
83
  submit: string;
84
84
  go_back: string;
85
+ copy: string;
86
+ download: string;
87
+ wrap: string;
85
88
  };
86
89
  export declare const TextKeys: (keyof typeof DefaultTextContents)[];
87
90
  export type TextContents = typeof DefaultTextContents;
@@ -0,0 +1,2 @@
1
+ import { type ClassValue } from "clsx";
2
+ export declare const cn: (...inputs: ClassValue[]) => string;
@@ -0,0 +1,13 @@
1
+ import { ReadonlySignal, Signal } from "@preact/signals";
2
+ import { TranscriptEntry } from "../contexts/conversation";
3
+ interface UseStickToBottomOptions {
4
+ scrollPinned: Signal<boolean>;
5
+ transcript: ReadonlySignal<TranscriptEntry[]>;
6
+ }
7
+ export declare function useStickToBottom({ scrollPinned, transcript, }: UseStickToBottomOptions): {
8
+ scrollContainer: import("preact").RefObject<HTMLDivElement>;
9
+ handleScroll: () => void;
10
+ handleUserInteraction: () => void;
11
+ firstRender: import("preact/hooks").MutableRef<boolean>;
12
+ };
13
+ export {};
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const PACKAGE_VERSION = "0.5.2";
1
+ export declare const PACKAGE_VERSION = "0.6.0-beta.3";
@@ -0,0 +1,7 @@
1
+ import { ReadonlySignal } from "@preact/signals";
2
+ export declare function AvatarOverlay({ showAvatar, showTranscript, isDisconnected, onStartSession, }: {
3
+ showAvatar: ReadonlySignal<boolean>;
4
+ showTranscript: ReadonlySignal<boolean>;
5
+ isDisconnected: ReadonlySignal<boolean>;
6
+ onStartSession: (element: HTMLElement) => void;
7
+ }): import("preact").JSX.Element;
@@ -1,2 +1,2 @@
1
1
  import { HTMLAttributes } from "preact/compat";
2
- export declare function CompactTrigger({ className, ...rest }: HTMLAttributes<HTMLDivElement>): import("react-dom/src").JSX.Element;
2
+ export declare function CompactTrigger({ className, ...rest }: HTMLAttributes<HTMLDivElement>): import("preact").JSX.Element;
@@ -2,5 +2,5 @@ import { Signal } from "@preact/signals";
2
2
  interface ErrorModalProps {
3
3
  sawError: Signal<boolean>;
4
4
  }
5
- export declare function ErrorModal({ sawError }: ErrorModalProps): import("react-dom/src").JSX.Element;
5
+ export declare function ErrorModal({ sawError }: ErrorModalProps): import("preact").JSX.Element;
6
6
  export {};
@@ -1,2 +1,2 @@
1
1
  import { ExpandableProps } from "./Trigger";
2
- export declare function ExpandableTriggerActions({ expanded }: ExpandableProps): import("react-dom/src").JSX.Element;
2
+ export declare function ExpandableTriggerActions({ expanded }: ExpandableProps): import("preact").JSX.Element;
@@ -1 +1 @@
1
- export declare function FeedbackActions(): import("react-dom/src").JSX.Element;
1
+ export declare function FeedbackActions(): import("preact").JSX.Element;
@@ -1 +1 @@
1
- export declare function FeedbackPage(): import("react-dom/src").JSX.Element;
1
+ export declare function FeedbackPage(): import("preact").JSX.Element;
@@ -1,2 +1,2 @@
1
1
  import { HTMLAttributes } from "preact/compat";
2
- export declare function FullTrigger({ className, ...rest }: HTMLAttributes<HTMLDivElement>): import("react-dom/src").JSX.Element;
2
+ export declare function FullTrigger({ className, ...rest }: HTMLAttributes<HTMLDivElement>): import("preact").JSX.Element;
@@ -1,7 +1,5 @@
1
1
  import { Signal } from "@preact/signals";
2
- interface SheetActionsProps {
2
+ export declare function SheetActions({ showTranscript, scrollPinned, }: {
3
3
  showTranscript: boolean;
4
4
  scrollPinned: Signal<boolean>;
5
- }
6
- export declare function SheetActions({ showTranscript, scrollPinned, }: SheetActionsProps): import("react-dom/src").JSX.Element;
7
- export {};
5
+ }): import("preact").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { Signal } from "@preact/signals";
2
+ export declare function SheetActions({ showTranscript, scrollPinned, }: {
3
+ showTranscript: boolean;
4
+ scrollPinned: Signal<boolean>;
5
+ }): import("preact").JSX.Element;
@@ -1,9 +1,10 @@
1
+ import { ReadonlySignal } from "@preact/signals";
1
2
  interface SheetHeaderProps {
2
3
  showBackButton: boolean;
3
4
  onBackClick?: () => void;
4
- showStatusLabel: boolean;
5
- showShadow: boolean;
6
- showLanguageSelector: boolean;
5
+ showStatusLabel: ReadonlySignal<boolean>;
6
+ showLanguageSelector: ReadonlySignal<boolean>;
7
+ showExpandButton: ReadonlySignal<boolean>;
7
8
  }
8
- export declare function SheetHeader({ showBackButton, onBackClick, showStatusLabel, showShadow, showLanguageSelector, }: SheetHeaderProps): import("preact").JSX.Element;
9
+ export declare function SheetHeader({ showBackButton, onBackClick, showStatusLabel, showLanguageSelector, showExpandButton, }: SheetHeaderProps): import("preact").JSX.Element;
9
10
  export {};
@@ -1,2 +1,2 @@
1
1
  import { HTMLAttributes } from "preact/compat";
2
- export declare function StatusLabel({ className, ...props }: HTMLAttributes<HTMLDivElement>): import("react-dom/src").JSX.Element;
2
+ export declare function StatusLabel({ className, ...props }: HTMLAttributes<HTMLDivElement>): import("preact").JSX.Element;
@@ -4,5 +4,5 @@ interface TranscriptProps {
4
4
  scrollPinned: Signal<boolean>;
5
5
  transcript: ReadonlySignal<TranscriptEntry[]>;
6
6
  }
7
- export declare function Transcript({ scrollPinned, transcript }: TranscriptProps): import("react-dom/src").JSX.Element;
7
+ export declare function Transcript({ scrollPinned, transcript }: TranscriptProps): import("preact").JSX.Element;
8
8
  export {};
@@ -7,5 +7,5 @@ interface TriggerProps {
7
7
  expandable?: boolean;
8
8
  expanded: Signal<boolean>;
9
9
  }
10
- export declare function Trigger({ expandable, expanded }: TriggerProps): import("react-dom/src").JSX.Element;
10
+ export declare function Trigger({ expandable, expanded }: TriggerProps): import("preact").JSX.Element;
11
11
  export {};
@@ -1,6 +1,2 @@
1
1
  import { ButtonProps } from "../components/Button";
2
- interface TriggerMuteButtonProps extends Omit<ButtonProps, "icon"> {
3
- visible: boolean;
4
- }
5
- export declare function TriggerMuteButton({ visible, ...rest }: TriggerMuteButtonProps): import("react-dom/src").JSX.Element | null;
6
- export {};
2
+ export declare function TriggerMuteButton(props: Omit<ButtonProps, "icon">): import("preact").JSX.Element | null;
package/package.json CHANGED
@@ -1,11 +1,25 @@
1
1
  {
2
2
  "name": "@elevenlabs/convai-widget-core",
3
- "version": "0.5.2",
3
+ "version": "0.6.0-beta.3",
4
4
  "description": "The common library for the Conversational AI Widget.",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
7
  "source": "./src/index.ts",
8
8
  "type": "module",
9
+ "scripts": {
10
+ "generate-version": "printf \"// This file is auto-generated during build\\nexport const PACKAGE_VERSION = \\\"%s\\\";\\n\" \"$npm_package_version\" > src/version.ts",
11
+ "postinstall": "npm run generate-version",
12
+ "prebuild": "npm run generate-version",
13
+ "build": "vite build && tsc --declaration --emitDeclarationOnly",
14
+ "build:analyze": "ANALYZE=true vite build",
15
+ "dev": "npm run generate-version && vite",
16
+ "lint": "npm run check-types && npm run lint:es && npm run lint:prettier",
17
+ "check-types": "tsc --noEmit --skipLibCheck",
18
+ "lint:es": "pnpm exec eslint .",
19
+ "lint:prettier": "prettier 'src/**/*.ts' --check",
20
+ "prepublishOnly": "npm run build",
21
+ "test": "vitest"
22
+ },
9
23
  "files": [
10
24
  "dist"
11
25
  ],
@@ -23,15 +37,35 @@
23
37
  "playwright": "^1.46.1",
24
38
  "tailwindcss": "^3.4.17",
25
39
  "typescript": "^5.5.4",
40
+ "unified": "^11.0.5",
26
41
  "vite": "^6.3.2",
42
+ "vite-bundle-analyzer": "^1.2.3",
27
43
  "vitest": "^3.1.2"
28
44
  },
29
45
  "dependencies": {
46
+ "@elevenlabs/client": "workspace:*",
47
+ "@lezer/common": "^1.3.0",
48
+ "@lezer/highlight": "^1.2.3",
49
+ "@lezer/html": "^1.3.12",
50
+ "@lezer/javascript": "^1.5.4",
51
+ "@lezer/json": "^1.0.3",
52
+ "@lezer/lr": "^1.4.3",
53
+ "@lezer/markdown": "^1.6.0",
54
+ "@lezer/python": "^1.1.18",
55
+ "@lezer/xml": "^1.0.6",
56
+ "@lezer/yaml": "^1.0.3",
30
57
  "@preact/signals": "^2.0.4",
31
58
  "clsx": "^2.1.1",
59
+ "hast-util-from-lezer": "^0.5.4",
60
+ "hast-util-to-jsx-runtime": "^2.3.6",
61
+ "marked": "^17.0.0",
32
62
  "preact": "^10.26.5",
33
63
  "preact-custom-element": "^4.3.0",
34
- "@elevenlabs/client": "0.10.0"
64
+ "react-markdown": "^10.1.0",
65
+ "rehype-harden": "^1.1.5",
66
+ "rehype-raw": "^7.0.0",
67
+ "remark-gfm": "^4.0.1",
68
+ "tailwind-merge": "^3.4.0"
35
69
  },
36
70
  "publishConfig": {
37
71
  "access": "public"
@@ -40,17 +74,5 @@
40
74
  "type": "git",
41
75
  "url": "git+https://github.com/elevenlabs/packages.git",
42
76
  "directory": "packages/convai-widget-core"
43
- },
44
- "scripts": {
45
- "generate-version": "printf \"// This file is auto-generated during build\\nexport const PACKAGE_VERSION = \\\"%s\\\";\\n\" \"$npm_package_version\" > src/version.ts",
46
- "postinstall": "npm run generate-version",
47
- "prebuild": "npm run generate-version",
48
- "build": "vite build && tsc --declaration --emitDeclarationOnly",
49
- "dev": "npm run generate-version && vite",
50
- "lint": "npm run check-types && npm run lint:es && npm run lint:prettier",
51
- "check-types": "tsc --noEmit --skipLibCheck",
52
- "lint:es": "pnpm exec eslint .",
53
- "lint:prettier": "prettier 'src/**/*.ts' --check",
54
- "test": "vitest"
55
77
  }
56
- }
78
+ }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 ElevenLabs
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.