andy-widget-react 2.0.5
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 +79 -0
- package/dist/index.cjs +4688 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.esm.js +4658 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/types/AndyChat.d.ts +4 -0
- package/dist/types/components/ChatBubble.d.ts +9 -0
- package/dist/types/components/ChatWindow.d.ts +11 -0
- package/dist/types/components/FAQ.d.ts +8 -0
- package/dist/types/components/MessageInput.d.ts +8 -0
- package/dist/types/components/MessageList.d.ts +10 -0
- package/dist/types/components/UserInfoForm.d.ts +10 -0
- package/dist/types/components/WelcomePopup.d.ts +8 -0
- package/dist/types/hooks/index.d.ts +1 -0
- package/dist/types/hooks/useAndyChat.d.ts +2 -0
- package/dist/types/index.d.ts +13 -0
- package/dist/types/types/index.d.ts +180 -0
- package/package.json +72 -0
- package/src/AndyChat.tsx +1091 -0
- package/src/components/ChatBubble.tsx +48 -0
- package/src/components/ChatWindow.tsx +53 -0
- package/src/components/FAQ.tsx +48 -0
- package/src/components/MessageInput.tsx +82 -0
- package/src/components/MessageList.tsx +122 -0
- package/src/components/UserInfoForm.tsx +186 -0
- package/src/components/WelcomePopup.tsx +70 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useAndyChat.ts +281 -0
- package/src/index.ts +65 -0
- package/src/styles/main.css +14 -0
- package/src/types/index.ts +222 -0
package/README.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# andy-widget-react
|
|
2
|
+
|
|
3
|
+
The official React Widget for Andy. Its canonical source is
|
|
4
|
+
[`Andesphere/andy-sdk`](https://github.com/Andesphere/andy-sdk/tree/main/packages/react).
|
|
5
|
+
|
|
6
|
+
## Install
|
|
7
|
+
|
|
8
|
+
Pin an exact reviewed release:
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
bun add andy-widget-react@2.0.5
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
React and React DOM 18 or 19 are required peer dependencies.
|
|
15
|
+
|
|
16
|
+
## Use
|
|
17
|
+
|
|
18
|
+
```tsx
|
|
19
|
+
'use client'
|
|
20
|
+
|
|
21
|
+
import { AndyChat, setApiBaseUrl } from 'andy-widget-react'
|
|
22
|
+
|
|
23
|
+
setApiBaseUrl('https://app.andypartner.com/api')
|
|
24
|
+
|
|
25
|
+
export function SupportWidget() {
|
|
26
|
+
return <AndyChat embedId='your-agent-id' />
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
`embedId` is the non-secret Andy Agent ID. The Widget fetches its effective configuration from
|
|
31
|
+
`GET /api/chatbot/:embedId` and sends visitor messages to `POST /api/messages`. The browser sends
|
|
32
|
+
the embedding page's `Origin`; Andy enforces the Agent's exact allowed-origin configuration.
|
|
33
|
+
|
|
34
|
+
The launcher starts closed. If the Agent ID is invalid or configuration cannot be loaded, the
|
|
35
|
+
Widget renders no launcher and does not affect the host page. Message failures remain inside the
|
|
36
|
+
Widget as a short, language-aware retry message.
|
|
37
|
+
|
|
38
|
+
## Props
|
|
39
|
+
|
|
40
|
+
| Prop | Type | Purpose |
|
|
41
|
+
| --- | --- | --- |
|
|
42
|
+
| `embedId` | `string` | Required Agent ID outside preview mode |
|
|
43
|
+
| `tooltip` | `string` | Optional launcher tooltip |
|
|
44
|
+
| `name` | `string` | Override the configured Agent name |
|
|
45
|
+
| `headline` | `string` | Override the configured headline |
|
|
46
|
+
| `description` | `string` | Override the configured description |
|
|
47
|
+
| `welcomeMessage` | `string` | Override the configured first message |
|
|
48
|
+
| `bubbleLabel` | `string` | Override the configured pill label |
|
|
49
|
+
| `theme` | `'light' \| 'dark' \| 'auto'` | Override the configured theme |
|
|
50
|
+
| `orientation` | `'left' \| 'right'` | Override the configured position |
|
|
51
|
+
| `brandColor` | `string` | Override the configured six-digit hex color |
|
|
52
|
+
| `bubbleStyle` | `'icon' \| 'pill'` | Override the configured launcher style |
|
|
53
|
+
| `useBrandColor` | `boolean` | Override configured brand-color use |
|
|
54
|
+
| `logoUrl` | `string` | Override the configured logo |
|
|
55
|
+
| `previewMode` | `boolean` | Render local prop-based preview configuration |
|
|
56
|
+
| `initialOpen` | `boolean` | Opt into an initially open Widget; defaults to `false` |
|
|
57
|
+
|
|
58
|
+
The server configuration controls **Powered by Andy** visibility. Consumers cannot suppress it
|
|
59
|
+
with a prop. FAQ entries render only when the API supplies both a question and an answer; the
|
|
60
|
+
current question-only response safely exposes no incomplete FAQ. Visitor-information and lead
|
|
61
|
+
capture are disabled in this release because there is no durable public submission boundary.
|
|
62
|
+
|
|
63
|
+
This release intentionally has no Widget analytics or event callback API. Use Andy's existing
|
|
64
|
+
conversation analytics rather than observing the Shadow DOM.
|
|
65
|
+
|
|
66
|
+
## Advanced exports
|
|
67
|
+
|
|
68
|
+
The package also exports `useAndyChat`, individual presentation components, its public TypeScript
|
|
69
|
+
types, design tokens, `getApiBaseUrl`, and `setApiBaseUrl`. `Andy` remains a compatibility alias
|
|
70
|
+
for `AndyChat`; new integrations should use `AndyChat`.
|
|
71
|
+
|
|
72
|
+
## Supported integration path
|
|
73
|
+
|
|
74
|
+
Use the React package directly. Do not use an iframe, a floating `@latest` dependency, or Andy's
|
|
75
|
+
legacy hosted `/widget.js` redirect for new integrations.
|
|
76
|
+
|
|
77
|
+
## License
|
|
78
|
+
|
|
79
|
+
MIT
|