ordify-chat-widget 1.0.36 → 1.0.39
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 +73 -1
- package/dist/hooks/useOrdifyChat.d.ts.map +1 -1
- package/dist/index.cjs.js +25 -25
- package/dist/index.esm.js +690 -721
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -135,11 +135,15 @@ GitHub Packages serves as a mirror of the NPM package. If you need to use it, co
|
|
|
135
135
|
| `position` | string | "bottom-right" | Floating button position |
|
|
136
136
|
| `resizable` | boolean | true | Allow user to resize chat |
|
|
137
137
|
| `showHeader` | boolean | true | Show/hide chat header |
|
|
138
|
-
| `height` | number |
|
|
138
|
+
| `height` | number | 600 | Initial chat height (px) |
|
|
139
139
|
| `width` | string | "320px" | Chat width |
|
|
140
140
|
| `onSessionCreated` | function | - | **Optional** - Callback when a new session is created with session ID |
|
|
141
141
|
| `initialMessage` | string | - | **Optional** - Message to automatically send when chat loads |
|
|
142
142
|
| `initialContext` | string | - | **Optional** - Hidden system context sent to backend (user ID, page info, etc.) |
|
|
143
|
+
| `agentImage` | string | - | **Optional** - URL to agent avatar image (shown in header and next to assistant messages) |
|
|
144
|
+
| `quickQuestions` | string[] | - | **Optional** - Array of quick action questions displayed as buttons in welcome screen |
|
|
145
|
+
| `welcomeMessage` | string | "Hi there 👋 How can we help?" | **Optional** - Custom greeting message shown in welcome screen when quickQuestions are provided |
|
|
146
|
+
| `welcomeImage` | string | - | **Optional** - URL to image/graphic displayed in welcome screen |
|
|
143
147
|
|
|
144
148
|
## 🎯 Advanced Features
|
|
145
149
|
|
|
@@ -199,6 +203,40 @@ The `initialContext` prop allows you to send hidden system information to your A
|
|
|
199
203
|
/>
|
|
200
204
|
```
|
|
201
205
|
|
|
206
|
+
### Welcome Screen with Quick Questions
|
|
207
|
+
|
|
208
|
+
The `quickQuestions` prop enables a welcome screen that displays before the chat session starts. This provides a guided experience with pre-filled question buttons while still allowing users to type custom messages.
|
|
209
|
+
|
|
210
|
+
**Key Features**:
|
|
211
|
+
- **Quick Action Buttons**: Display common questions as clickable buttons
|
|
212
|
+
- **Customizable Greeting**: Set a custom welcome message (defaults to "Hi there 👋 How can we help?")
|
|
213
|
+
- **Welcome Image**: Add a custom image or graphic to the welcome screen
|
|
214
|
+
- **Gradient Background**: Beautiful gradient that starts with your primary color and fades to the theme background
|
|
215
|
+
- **Flexible Input**: Users can click a quick question or type their own custom message
|
|
216
|
+
- **Dynamic Header**: Header uses primary color during welcome screen, switches to theme colors once chat starts
|
|
217
|
+
|
|
218
|
+
**Usage**:
|
|
219
|
+
```tsx
|
|
220
|
+
<OrdifyChat
|
|
221
|
+
agentId="your-agent-id"
|
|
222
|
+
apiKey="your-api-key"
|
|
223
|
+
apiBaseUrl="https://r.ordify.ai"
|
|
224
|
+
mode="floating"
|
|
225
|
+
quickQuestions={[
|
|
226
|
+
"I want to schedule an appointment",
|
|
227
|
+
"I want to find a location near me",
|
|
228
|
+
"I want a Free hearing screening",
|
|
229
|
+
"Please contact me"
|
|
230
|
+
]}
|
|
231
|
+
welcomeMessage="Hi there, how can we help?"
|
|
232
|
+
welcomeImage="https://example.com/welcome-graphic.png"
|
|
233
|
+
primaryColor="#3b82f6"
|
|
234
|
+
agentImage="https://example.com/agent-avatar.png"
|
|
235
|
+
/>
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
**Note**: When `quickQuestions` are provided, the welcome screen is displayed before the session starts. Users must select a question or type a custom message to begin chatting. The `initialMessage` prop is automatically skipped when `quickQuestions` are present.
|
|
239
|
+
|
|
202
240
|
### Theme-Aware Defaults
|
|
203
241
|
|
|
204
242
|
When no `primaryColor` is specified, the header automatically adapts:
|
|
@@ -347,6 +385,40 @@ export function ChatWithContext() {
|
|
|
347
385
|
}
|
|
348
386
|
```
|
|
349
387
|
|
|
388
|
+
#### Welcome Screen with Quick Questions
|
|
389
|
+
```tsx
|
|
390
|
+
// components/ChatWithWelcomeScreen.tsx
|
|
391
|
+
import { OrdifyChat } from 'ordify-chat-widget'
|
|
392
|
+
|
|
393
|
+
export function ChatWithWelcomeScreen() {
|
|
394
|
+
return (
|
|
395
|
+
<OrdifyChat
|
|
396
|
+
agentId="your-agent-id"
|
|
397
|
+
apiKey="your-api-key"
|
|
398
|
+
apiBaseUrl="https://r.ordify.ai"
|
|
399
|
+
mode="floating"
|
|
400
|
+
buttonText="Chat with us"
|
|
401
|
+
chatName="Support Assistant"
|
|
402
|
+
agentImage="https://example.com/agent-avatar.png"
|
|
403
|
+
quickQuestions={[
|
|
404
|
+
"I want to schedule an appointment",
|
|
405
|
+
"I want to find a location near me",
|
|
406
|
+
"I want a Free hearing screening",
|
|
407
|
+
"Please contact me",
|
|
408
|
+
"Tell me more about your products and services"
|
|
409
|
+
]}
|
|
410
|
+
welcomeMessage="Hi there, how can we help?"
|
|
411
|
+
welcomeImage="https://example.com/welcome-graphic.png"
|
|
412
|
+
primaryColor="#3b82f6"
|
|
413
|
+
onSessionCreated={(sessionId) => {
|
|
414
|
+
console.log('Session started:', sessionId)
|
|
415
|
+
// Track user engagement
|
|
416
|
+
}}
|
|
417
|
+
/>
|
|
418
|
+
)
|
|
419
|
+
}
|
|
420
|
+
```
|
|
421
|
+
|
|
350
422
|
#### Landing Page Integration
|
|
351
423
|
```tsx
|
|
352
424
|
// pages/index.tsx
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOrdifyChat.d.ts","sourceRoot":"","sources":["../../src/hooks/useOrdifyChat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,YAAY,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAKpE,wBAAgB,aAAa,CAAC,MAAM,EAAE,YAAY,GAAG,mBAAmB,
|
|
1
|
+
{"version":3,"file":"useOrdifyChat.d.ts","sourceRoot":"","sources":["../../src/hooks/useOrdifyChat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,YAAY,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAKpE,wBAAgB,aAAa,CAAC,MAAM,EAAE,YAAY,GAAG,mBAAmB,CA8VvE"}
|