@eloquentai/chat-sdk 0.29.0-dev → 0.29.0-dev.1

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 (98) hide show
  1. package/README.md +146 -6
  2. package/dist/components/banner.d.ts +1 -1
  3. package/dist/components/chat/chat.d.ts +22 -0
  4. package/dist/components/chat/hooks/use-chat.d.ts +79 -0
  5. package/dist/components/chat/{interface-props.hook.d.ts → hooks/use-interface-props.d.ts} +2 -2
  6. package/dist/components/chat/hooks/use-keyboard-inset.d.ts +6 -0
  7. package/dist/components/chat/{message-events.hook.d.ts → hooks/use-message-events.d.ts} +5 -5
  8. package/dist/components/chat/{persistence.hook.d.ts → hooks/use-persistence.d.ts} +5 -2
  9. package/dist/components/chat/{realtime-socket.hook.d.ts → hooks/use-realtime-socket.d.ts} +5 -4
  10. package/dist/components/chat/hooks/use-scroll-lock.d.ts +6 -0
  11. package/dist/components/chat/{sdk-initialization.hook.d.ts → hooks/use-sdk-initialization.d.ts} +4 -2
  12. package/dist/components/chat/index.d.ts +1 -3
  13. package/dist/components/chat/message-mapping.d.ts +17 -0
  14. package/dist/components/chat/validations.d.ts +62 -74
  15. package/dist/components/chat-interface/chat-interface.d.ts +2 -0
  16. package/dist/components/chat-interface/content.d.ts +1 -1
  17. package/dist/components/chat-interface/context.d.ts +2 -2
  18. package/dist/components/chat-interface/footer.d.ts +1 -1
  19. package/dist/components/chat-interface/header.d.ts +1 -1
  20. package/dist/components/chat-interface/index.d.ts +2 -27
  21. package/dist/components/chat-interface/message-bubble/message-action-buttons.d.ts +6 -0
  22. package/dist/components/chat-interface/message-bubble/message-animation-state.d.ts +2 -0
  23. package/dist/components/chat-interface/message-bubble/message-bubble-item.d.ts +7 -0
  24. package/dist/components/{chat-message-bubble.d.ts → chat-interface/message-bubble/message-bubble.d.ts} +2 -2
  25. package/dist/components/{chat-rating-bubble.d.ts → chat-interface/rating-message-bubble.d.ts} +1 -1
  26. package/dist/components/chat-interface/shared.d.ts +11 -1
  27. package/dist/components/chat-interface/skeleton.d.ts +4 -2
  28. package/dist/components/chat-interface/suggested-messages.d.ts +20 -0
  29. package/dist/components/chat-interface/types.d.ts +56 -0
  30. package/dist/components/embed/chat-bubble.d.ts +6 -0
  31. package/dist/components/{iframe.d.ts → embed/iframe.d.ts} +1 -1
  32. package/dist/components/{portal.d.ts → embed/portal.d.ts} +2 -1
  33. package/dist/components/{chat → embed}/proactive-message.d.ts +1 -1
  34. package/dist/components/{render-chat.d.ts → embed/render-chat.d.ts} +1 -1
  35. package/dist/components/index.d.ts +2 -2
  36. package/dist/components/logo.d.ts +1 -1
  37. package/dist/components/ui/avatar.d.ts +3 -4
  38. package/dist/components/ui/card.d.ts +7 -7
  39. package/dist/components/ui/dialog.d.ts +11 -12
  40. package/dist/components/ui/markdown-viewer.d.ts +1 -1
  41. package/dist/components/ui/scroll-area.d.ts +5 -5
  42. package/dist/components/ui/skeleton.d.ts +2 -1
  43. package/dist/components/ui/star-rating.d.ts +1 -1
  44. package/dist/components/ui/textarea.d.ts +1 -2
  45. package/dist/contexts/{agent-cognition-context-definition.d.ts → agent-cognition/agent-cognition-context.d.ts} +1 -1
  46. package/dist/contexts/{agent-cognition.context.d.ts → agent-cognition/agent-cognition-provider.d.ts} +1 -1
  47. package/dist/contexts/{error-handling.utils.d.ts → error-handling/error-context.d.ts} +1 -1
  48. package/dist/contexts/{constants.d.ts → error-handling/error-messages.d.ts} +4 -0
  49. package/dist/contexts/error-handling/error-provider.d.ts +4 -0
  50. package/dist/contexts/theme.context.d.ts +14 -1
  51. package/dist/embed-loader.d.ts +35 -0
  52. package/dist/embed-loader.entry.d.ts +1 -0
  53. package/dist/hooks/use-debounce.d.ts +6 -0
  54. package/dist/hooks/use-drag-scroll.d.ts +5 -4
  55. package/dist/hooks/use-latest-ref.d.ts +9 -0
  56. package/dist/hooks/use-typed-text.d.ts +11 -0
  57. package/dist/index-hFbiYJI3.js +4165 -0
  58. package/dist/index-hFbiYJI3.js.map +1 -0
  59. package/dist/index.css +1 -1
  60. package/dist/index.d.ts +1 -1
  61. package/dist/index.mjs +2288 -7
  62. package/dist/index.mjs.map +1 -1
  63. package/dist/lib/appsync-events-client.d.ts +71 -0
  64. package/dist/lib/color-aura.d.ts +23 -0
  65. package/dist/lib/color-contrast.d.ts +13 -0
  66. package/dist/lib/config.d.ts +0 -15
  67. package/dist/lib/cookies.d.ts +13 -0
  68. package/dist/lib/eloquent-ai-api-client.d.ts +20 -2
  69. package/dist/lib/http.d.ts +3 -0
  70. package/dist/lib/retry.d.ts +10 -0
  71. package/dist/lib/utils.d.ts +0 -7
  72. package/dist/lib/wrap-promise.d.ts +7 -0
  73. package/dist/skeleton-ebiDTqw5.js +18959 -0
  74. package/dist/skeleton-ebiDTqw5.js.map +1 -0
  75. package/dist/ui.d.ts +10 -0
  76. package/dist/ui.mjs +19 -0
  77. package/dist/ui.mjs.map +1 -0
  78. package/package.json +59 -31
  79. package/dist/components/chat/chat.hook.d.ts +0 -47
  80. package/dist/components/chat-bubble.d.ts +0 -4
  81. package/dist/components/logo-animated.d.ts +0 -6
  82. package/dist/components/logo-squared.d.ts +0 -5
  83. package/dist/components/ui/input.d.ts +0 -3
  84. package/dist/components/ui/loading-ellipsis.d.ts +0 -1
  85. package/dist/components/ui/popover.d.ts +0 -6
  86. package/dist/contexts/error-handling.context.d.ts +0 -4
  87. package/dist/contexts/utils.d.ts +0 -2
  88. package/dist/hooks/useTypewriter.d.ts +0 -1
  89. package/dist/index-DaMnFGD6.js +0 -18793
  90. package/dist/index-DaMnFGD6.js.map +0 -1
  91. package/dist/index-DySyj7Hm.js +0 -30694
  92. package/dist/index-DySyj7Hm.js.map +0 -1
  93. /package/dist/components/chat/{ui-initialization.hook.d.ts → hooks/use-ui-initialization.d.ts} +0 -0
  94. /package/dist/components/chat/{user-identity.hook.d.ts → hooks/use-user-identity.d.ts} +0 -0
  95. /package/dist/{hooks → contexts/agent-cognition}/use-agent-cognition-context.d.ts +0 -0
  96. /package/dist/{hooks → contexts/agent-cognition}/use-agent-cognition.d.ts +0 -0
  97. /package/dist/hooks/{useFetch.d.ts → use-fetch.d.ts} +0 -0
  98. /package/dist/{type.d.ts → types/message.d.ts} +0 -0
package/dist/ui.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ export { ChatInterface, type ChatInterfaceProps, } from './components/chat-interface';
2
+ export { ChatInterfaceProvider } from './components/chat-interface/context';
3
+ export { SkeletonChatInterface } from './components/chat-interface/skeleton';
4
+ export { MessageBubble } from './components/chat-interface/message-bubble/message-bubble';
5
+ export { RatingMessageBubble } from './components/chat-interface/rating-message-bubble';
6
+ export { Banner } from './components/banner';
7
+ export { Logo } from './components/logo';
8
+ export { MarkdownViewer } from './components/ui/markdown-viewer';
9
+ export { ThemeProvider, useTheme, type ThemeContextType, } from './contexts/theme.context';
10
+ export type { Message, MessageData } from './types/message';
package/dist/ui.mjs ADDED
@@ -0,0 +1,19 @@
1
+ import { B as n, C as t, a as r, L as o, M as f, b, R as i, S as l, T as g, u } from "./skeleton-ebiDTqw5.js";
2
+ try {
3
+ let e = typeof window < "u" ? window : typeof global < "u" ? global : typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : {}, a = new e.Error().stack;
4
+ a && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[a] = "f9ed1380-1437-4e00-acb2-cdd914034062", e._sentryDebugIdIdentifier = "sentry-dbid-f9ed1380-1437-4e00-acb2-cdd914034062");
5
+ } catch {
6
+ }
7
+ export {
8
+ n as Banner,
9
+ t as ChatInterface,
10
+ r as ChatInterfaceProvider,
11
+ o as Logo,
12
+ f as MarkdownViewer,
13
+ b as MessageBubble,
14
+ i as RatingMessageBubble,
15
+ l as SkeletonChatInterface,
16
+ g as ThemeProvider,
17
+ u as useTheme
18
+ };
19
+ //# sourceMappingURL=ui.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ui.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eloquentai/chat-sdk",
3
- "version": "0.29.0-dev",
3
+ "version": "0.29.0-dev.1",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "chat",
@@ -11,13 +11,21 @@
11
11
  "javascript"
12
12
  ],
13
13
  "author": "Eloquent AI",
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/Eloquent-AI/eloquent-ai-chat-sdk.git"
17
+ },
14
18
  "type": "module",
15
19
  "main": "dist/index.mjs",
16
20
  "types": "dist/index.d.ts",
17
21
  "exports": {
18
22
  ".": {
19
- "import": "./dist/index.mjs",
20
- "types": "./dist/index.d.ts"
23
+ "types": "./dist/index.d.ts",
24
+ "import": "./dist/index.mjs"
25
+ },
26
+ "./ui": {
27
+ "types": "./dist/ui.d.ts",
28
+ "import": "./dist/ui.mjs"
21
29
  },
22
30
  "./index.css": "./dist/index.css"
23
31
  },
@@ -29,65 +37,74 @@
29
37
  "build": "tsc -b && vite build",
30
38
  "build:dev": "VITE_ENVIRONMENT=dev tsc -b && vite build --mode dev",
31
39
  "build:prod": "VITE_ENVIRONMENT=prod tsc -b && vite build --mode prod",
32
- "build:vanilla": "tsc -b && vite build --config vite.vanilla.config.ts",
33
- "build:vanilla:dev": "VITE_ENVIRONMENT=dev tsc -b && vite build --config vite.vanilla.config.ts --mode dev",
34
- "build:vanilla:prod": "VITE_ENVIRONMENT=prod tsc -b && vite build --config vite.vanilla.config.ts --mode prod",
40
+ "build:embed-loader": "vite build --config vite.embed-loader.config.ts",
41
+ "build:vanilla": "tsc -b && vite build --config vite.vanilla.config.ts && npm run build:embed-loader && node scripts/verify-embed-bundle.mjs",
42
+ "build:vanilla:dev": "VITE_ENVIRONMENT=dev tsc -b && vite build --config vite.vanilla.config.ts --mode dev && npm run build:embed-loader && node scripts/verify-embed-bundle.mjs",
43
+ "build:vanilla:prod": "VITE_ENVIRONMENT=prod tsc -b && vite build --config vite.vanilla.config.ts --mode prod && npm run build:embed-loader && node scripts/verify-embed-bundle.mjs",
44
+ "build:analyze": "ANALYZE=true npm run build:vanilla:prod",
45
+ "bundle:report": "node scripts/bundle-report.mjs",
46
+ "bundle:baseline": "node scripts/bundle-report.mjs --json > bundle-baseline.json",
35
47
  "preview": "vite preview",
36
48
  "trunk": "trunk",
37
49
  "lint": "trunk check",
38
50
  "lint:ci": "trunk check --ci --no-progress",
39
51
  "format": "trunk fmt",
52
+ "knip": "knip",
53
+ "knip:fix": "knip --fix",
40
54
  "test": "vitest",
41
55
  "test:run": "vitest run",
42
- "preview:dev": "npx http-server ./dev"
56
+ "preview:dev": "npx http-server ./dev",
57
+ "storybook": "storybook dev -p 6007",
58
+ "build-storybook": "storybook build",
59
+ "verify:embed": "node scripts/verify-embed-bundle.mjs"
43
60
  },
44
61
  "devDependencies": {
45
62
  "@eslint/js": "^9.17.0",
63
+ "@sentry/vite-plugin": "^3.6.1",
64
+ "@storybook/addon-a11y": "^10.4.6",
65
+ "@storybook/addon-docs": "^10.4.6",
66
+ "@storybook/react-vite": "^10.4.6",
67
+ "@tailwindcss/postcss": "^4.3.3",
68
+ "@testing-library/dom": "^10.4.1",
46
69
  "@testing-library/jest-dom": "^6.7.0",
47
70
  "@testing-library/react": "^16.3.0",
48
- "@testing-library/user-event": "^14.6.1",
49
71
  "@trunkio/launcher": "^1.3.4",
50
72
  "@types/node": "^22.10.2",
51
73
  "@types/react": "^18",
52
74
  "@types/react-dom": "^18",
53
75
  "@vitejs/plugin-react": "^4.3.4",
54
- "ajv": "^8.18.0",
55
- "autoprefixer": "^10.4.20",
56
- "aws-amplify": "^6.16.4",
57
- "babel-plugin-transform-remove-console": "^6.9.4",
76
+ "ajv": "^8.20.0",
58
77
  "eslint": "^9.39.4",
59
78
  "eslint-plugin-react-hooks": "^5.1.0",
60
79
  "eslint-plugin-react-refresh": "^0.4.16",
80
+ "eslint-plugin-storybook": "^10.4.6",
61
81
  "globals": "^15.14.0",
62
82
  "jsdom": "^26.1.0",
63
- "postcss": "^8.4.49",
83
+ "knip": "^6.32.2",
84
+ "postcss": "^8.5.26",
64
85
  "prettier": "^3.4.2",
65
- "tailwind-scrollbar": "^3.1.0",
66
- "tailwindcss": "^3.4.17",
67
- "tailwindcss-animate": "^1.0.7",
86
+ "rollup-plugin-visualizer": "^7.0.1",
87
+ "rollup-preserve-directives": "^1.1.3",
88
+ "storybook": "^10.4.6",
89
+ "tailwindcss": "^4.3.3",
68
90
  "terser": "^5.46.0",
69
91
  "typescript": "~5.7.2",
70
92
  "typescript-eslint": "^8.18.2",
71
- "vite": "^6.4.2",
93
+ "vite": "^6.4.3",
72
94
  "vite-plugin-dts": "^4.5.4",
73
- "vitest": "^3.2.4"
95
+ "vitest": "^4.1.9"
74
96
  },
75
97
  "peerDependencies": {
76
- "aws-amplify": ">=6.8.0",
77
98
  "react": ">=18",
78
99
  "react-dom": ">=18"
79
100
  },
80
101
  "dependencies": {
81
102
  "@radix-ui/react-avatar": "^1.1.11",
82
103
  "@radix-ui/react-dialog": "^1.1.15",
83
- "@radix-ui/react-popover": "^1.1.15",
84
104
  "@radix-ui/react-scroll-area": "^1.2.10",
85
- "@rive-app/react-canvas": "^4.27.1",
86
105
  "@sentry/react": "^9.19.0",
87
- "@sentry/vite-plugin": "^3.4.0",
88
- "@uidotdev/usehooks": "^2.4.1",
89
106
  "clsx": "^2.1.1",
90
- "emoji-picker-react": "^4.18.0",
107
+ "dompurify": "^3.4.13",
91
108
  "lucide-react": "^0.577.0",
92
109
  "react-markdown": ">=9.0.0",
93
110
  "rehype-sanitize": "^6.0.0",
@@ -98,12 +115,23 @@
98
115
  },
99
116
  "overrides": {
100
117
  "fast-xml-parser": "^5.7.0",
101
- "tar": "^7.5.10",
102
- "minimatch@<3.1.4": "3.1.4",
118
+ "tar": "^7.5.22",
103
119
  "lodash@<=4.17.23": "4.18.1",
104
- "flatted@<=3.4.1": "3.4.2",
105
- "uuid": "^14.0.0",
106
- "brace-expansion@>=2.0.0": "^2.0.3",
107
- "yaml@>=2.0.0": "^2.8.3"
108
- }
120
+ "brace-expansion": "^2.1.2",
121
+ "fast-uri": "^3.1.6",
122
+ "js-yaml": "^4.3.2"
123
+ },
124
+ "allowScripts": {
125
+ "esbuild@0.25.12": true,
126
+ "esbuild@0.28.2": true,
127
+ "fsevents@2.3.3": true,
128
+ "@sentry/cli@2.58.6": true
129
+ },
130
+ "sideEffects": [
131
+ "**/*.css",
132
+ "./src/index.ts",
133
+ "./src/instrumentation.ts",
134
+ "./src/components/index.ts",
135
+ "./dist/index.mjs"
136
+ ]
109
137
  }
@@ -1,47 +0,0 @@
1
- import { Message, MessageData } from '../../type';
2
- import { ThemeContextType } from '../../contexts/theme.context';
3
- import { ChatInterfaceProps } from '../chat-interface';
4
- export interface UseChatProps {
5
- appId: string;
6
- userId?: string;
7
- userName?: string;
8
- userData?: Record<string, string | number | boolean>;
9
- theme?: Partial<ThemeContextType>;
10
- chatProps?: Partial<ChatInterfaceProps>;
11
- isMobile?: boolean;
12
- closeButton?: boolean;
13
- cleanChatButton?: boolean;
14
- initialOpen?: boolean;
15
- proactiveMessageHideDelay?: number;
16
- }
17
- export interface UseChatReturn {
18
- isReady: boolean;
19
- isMobile: boolean;
20
- chatInterfaceProps: Partial<ChatInterfaceProps>;
21
- chatOpen: boolean;
22
- chatOpenDebounced: boolean;
23
- messages: Message[];
24
- portalContainer: HTMLElement | null;
25
- onSendMessage: (message: MessageData) => Promise<void>;
26
- setChatOpen: (value: boolean | ((prev: boolean) => boolean)) => void;
27
- onCleanMessages: () => void;
28
- proactiveMessage?: {
29
- text: string;
30
- isVisible: boolean;
31
- autoHideDelay: number;
32
- };
33
- hideProactiveMessage: () => void;
34
- isChatClosed: boolean;
35
- onStartNewChat: () => void;
36
- onRateChat: (rating: number) => Promise<void>;
37
- }
38
- /**
39
- * The primary chat hook, responsible for managing the chat state and operations.
40
- * @param options The hook parameters
41
- * @returns The chat hook return type
42
- */
43
- export declare function useChat({ environment, apiUrl, appId, userId: initialUserId, userName, userData, chatProps, isMobile: propIsMobile, initialOpen: propInitialOpen, proactiveMessageHideDelay, }: Readonly<Partial<UseChatProps> & {
44
- environment: "test" | "live";
45
- apiUrl?: string;
46
- appId: string;
47
- }>): UseChatReturn;
@@ -1,4 +0,0 @@
1
- export declare function ChatBubble({ toggleBubble, }: {
2
- isOpen: boolean;
3
- toggleBubble: () => void;
4
- }): import("react/jsx-runtime").JSX.Element;
@@ -1,6 +0,0 @@
1
- export interface LogoProps {
2
- className?: string;
3
- isWaiting?: boolean;
4
- onLoaded?: () => void;
5
- }
6
- export declare function LogoAnimated({ isWaiting, ...props }: LogoProps): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +0,0 @@
1
- export interface LogoSquaredProps {
2
- className?: string;
3
- src?: string;
4
- }
5
- export declare function LogoSquared(props: LogoSquaredProps): import("react/jsx-runtime").JSX.Element;
@@ -1,3 +0,0 @@
1
- import * as React from "react";
2
- declare const Input: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>>;
3
- export { Input };
@@ -1 +0,0 @@
1
- export declare function LoadingEllipsis(): import("react/jsx-runtime").JSX.Element;
@@ -1,6 +0,0 @@
1
- import * as React from "react";
2
- import * as PopoverPrimitive from "@radix-ui/react-popover";
3
- declare const Popover: React.FC<PopoverPrimitive.PopoverProps>;
4
- declare const PopoverTrigger: React.ForwardRefExoticComponent<PopoverPrimitive.PopoverTriggerProps & React.RefAttributes<HTMLButtonElement>>;
5
- declare const PopoverContent: React.ForwardRefExoticComponent<Omit<PopoverPrimitive.PopoverContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
6
- export { Popover, PopoverTrigger, PopoverContent };
@@ -1,4 +0,0 @@
1
- import { default as React, ReactNode } from 'react';
2
- export declare const ErrorProvider: React.FC<{
3
- children: ReactNode;
4
- }>;
@@ -1,2 +0,0 @@
1
- import { ERROR_CODES } from './constants';
2
- export declare const getErrorMessage: (code: ERROR_CODES) => string;
@@ -1 +0,0 @@
1
- export declare function useTypewriter(text: string, enabled?: boolean): string;