@ihoomanai/react-chat 2.3.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -12
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
# @
|
|
1
|
+
# @ihoomanai/react-chat
|
|
2
2
|
|
|
3
3
|
React components and hooks for the Ihooman Chat Widget. Provides native React integration with proper lifecycle management and SSR compatibility.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install @
|
|
8
|
+
npm install @ihoomanai/react-chat
|
|
9
9
|
# or
|
|
10
|
-
yarn add @
|
|
10
|
+
yarn add @ihoomanai/react-chat
|
|
11
11
|
# or
|
|
12
|
-
pnpm add @
|
|
12
|
+
pnpm add @ihoomanai/react-chat
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
## Requirements
|
|
16
16
|
|
|
17
17
|
- React 17.0.0 or higher
|
|
18
|
-
- A valid Widget ID from your [Ihooman Dashboard](https://ihooman.ai)
|
|
18
|
+
- A valid Widget ID from your [Ihooman Dashboard](https://dashboard.ihooman.ai)
|
|
19
19
|
|
|
20
20
|
## Quick Start
|
|
21
21
|
|
|
22
22
|
### Basic Usage
|
|
23
23
|
|
|
24
24
|
```tsx
|
|
25
|
-
import { ChatWidget } from '@
|
|
25
|
+
import { ChatWidget } from '@ihoomanai/react-chat';
|
|
26
26
|
|
|
27
27
|
function App() {
|
|
28
28
|
return (
|
|
@@ -40,7 +40,7 @@ function App() {
|
|
|
40
40
|
For programmatic control over the widget from any component:
|
|
41
41
|
|
|
42
42
|
```tsx
|
|
43
|
-
import { ChatWidgetProvider, ChatWidget, useChatWidget } from '@
|
|
43
|
+
import { ChatWidgetProvider, ChatWidget, useChatWidget } from '@ihoomanai/react-chat';
|
|
44
44
|
|
|
45
45
|
function SupportButton() {
|
|
46
46
|
const { open, isReady } = useChatWidget();
|
|
@@ -84,8 +84,6 @@ The main component that renders the chat widget.
|
|
|
84
84
|
| `onMessage` | `(message: Message) => void` | No | Called on new messages |
|
|
85
85
|
| `onError` | `(error: Error) => void` | No | Called on errors |
|
|
86
86
|
|
|
87
|
-
See the [full props documentation](#chatwidget-props) for all available options.
|
|
88
|
-
|
|
89
87
|
### `<ChatWidgetProvider />`
|
|
90
88
|
|
|
91
89
|
Context provider for global widget access. Wrap your app with this to use the `useChatWidget` hook.
|
|
@@ -179,8 +177,26 @@ function QuickActions() {
|
|
|
179
177
|
The component is SSR-compatible and defers initialization to the client:
|
|
180
178
|
|
|
181
179
|
```tsx
|
|
182
|
-
//
|
|
183
|
-
import { ChatWidgetProvider, ChatWidget } from '@
|
|
180
|
+
// app/layout.tsx (App Router)
|
|
181
|
+
import { ChatWidgetProvider, ChatWidget } from '@ihoomanai/react-chat';
|
|
182
|
+
|
|
183
|
+
export default function RootLayout({ children }) {
|
|
184
|
+
return (
|
|
185
|
+
<html>
|
|
186
|
+
<body>
|
|
187
|
+
<ChatWidgetProvider>
|
|
188
|
+
{children}
|
|
189
|
+
<ChatWidget widgetId="wgt_abc123def456" />
|
|
190
|
+
</ChatWidgetProvider>
|
|
191
|
+
</body>
|
|
192
|
+
</html>
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
```tsx
|
|
198
|
+
// pages/_app.tsx (Pages Router)
|
|
199
|
+
import { ChatWidgetProvider, ChatWidget } from '@ihoomanai/react-chat';
|
|
184
200
|
|
|
185
201
|
export default function App({ Component, pageProps }) {
|
|
186
202
|
return (
|
|
@@ -202,7 +218,7 @@ import type {
|
|
|
202
218
|
UseChatWidgetReturn,
|
|
203
219
|
Message,
|
|
204
220
|
UserInfo
|
|
205
|
-
} from '@
|
|
221
|
+
} from '@ihoomanai/react-chat';
|
|
206
222
|
```
|
|
207
223
|
|
|
208
224
|
## Framework Compatibility
|
package/dist/index.cjs.js
CHANGED
package/dist/index.esm.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ihoomanai/react-chat",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "React components and hooks for Ihooman Chat Widget - secure Widget ID based initialization",
|
|
6
6
|
"main": "dist/index.cjs.js",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
}
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@ihoomanai/chat-widget": "^2.
|
|
68
|
+
"@ihoomanai/chat-widget": "^2.5.0"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@rollup/plugin-commonjs": "^25.0.7",
|