@evelan/jexity-widget 0.2.0 → 0.3.0-canary.4
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 +162 -16
- package/dist/index.mjs +1046 -731
- package/dist/index.mjs.map +1 -1
- package/dist/react.mjs +20 -11
- package/dist/react.mjs.map +1 -1
- package/dist/types/entries/esm.d.ts +4 -0
- package/dist/types/entries/esm.d.ts.map +1 -0
- package/dist/types/{react.d.ts → entries/react.d.ts} +1 -1
- package/dist/types/entries/react.d.ts.map +1 -0
- package/dist/types/features/chat/components/BotMessage.d.ts +6 -0
- package/dist/types/features/chat/components/BotMessage.d.ts.map +1 -0
- package/dist/types/features/chat/components/ChatInput.d.ts +3 -0
- package/dist/types/features/chat/components/ChatInput.d.ts.map +1 -0
- package/dist/types/features/chat/components/ChatScreen.d.ts +8 -0
- package/dist/types/features/chat/components/ChatScreen.d.ts.map +1 -0
- package/dist/types/features/chat/components/MessageList.d.ts +3 -0
- package/dist/types/features/chat/components/MessageList.d.ts.map +1 -0
- package/dist/types/features/chat/components/TypingIndicator.d.ts +2 -0
- package/dist/types/features/chat/components/TypingIndicator.d.ts.map +1 -0
- package/dist/types/features/chat/components/UserMessage.d.ts +6 -0
- package/dist/types/features/chat/components/UserMessage.d.ts.map +1 -0
- package/dist/types/features/chat/lib/chat.d.ts +13 -0
- package/dist/types/features/chat/lib/chat.d.ts.map +1 -0
- package/dist/types/features/home/components/HomeScreen.d.ts +14 -0
- package/dist/types/features/home/components/HomeScreen.d.ts.map +1 -0
- package/dist/types/features/selection/components/SelectionScreen.d.ts +7 -0
- package/dist/types/features/selection/components/SelectionScreen.d.ts.map +1 -0
- package/dist/types/features/ticket/components/ConfirmationScreen.d.ts +7 -0
- package/dist/types/features/ticket/components/ConfirmationScreen.d.ts.map +1 -0
- package/dist/types/features/ticket/components/FormScreen.d.ts +3 -0
- package/dist/types/features/ticket/components/FormScreen.d.ts.map +1 -0
- package/dist/types/i18n/config.d.ts +10 -0
- package/dist/types/i18n/config.d.ts.map +1 -0
- package/dist/types/i18n/index.d.ts +6 -1
- package/dist/types/i18n/index.d.ts.map +1 -1
- package/dist/types/i18n/locales/de.d.ts.map +1 -1
- package/dist/types/i18n/locales/en.d.ts +19 -0
- package/dist/types/i18n/locales/en.d.ts.map +1 -1
- package/dist/types/i18n/resolve-widget-locale.d.ts +10 -7
- package/dist/types/i18n/resolve-widget-locale.d.ts.map +1 -1
- package/dist/types/module/screens/ScreenRouter.d.ts +8 -0
- package/dist/types/module/screens/ScreenRouter.d.ts.map +1 -0
- package/dist/types/module/screens/screens.state.d.ts +26 -0
- package/dist/types/module/screens/screens.state.d.ts.map +1 -0
- package/dist/types/module/shell/AppShell.d.ts +8 -0
- package/dist/types/module/shell/AppShell.d.ts.map +1 -0
- package/dist/types/module/shell/mount.d.ts +13 -0
- package/dist/types/module/shell/mount.d.ts.map +1 -0
- package/dist/types/module/shell/shell.state.d.ts +2 -0
- package/dist/types/module/shell/shell.state.d.ts.map +1 -0
- package/dist/types/module/visitor/visitor.state.d.ts +21 -0
- package/dist/types/module/visitor/visitor.state.d.ts.map +1 -0
- package/dist/types/shared/icons/BotIcon.d.ts +4 -0
- package/dist/types/shared/icons/BotIcon.d.ts.map +1 -0
- package/dist/types/shared/icons/CloseIcon.d.ts +4 -0
- package/dist/types/shared/icons/CloseIcon.d.ts.map +1 -0
- package/dist/types/shared/icons/MessageIcon.d.ts +4 -0
- package/dist/types/shared/icons/MessageIcon.d.ts.map +1 -0
- package/dist/types/shared/icons/SendIcon.d.ts +4 -0
- package/dist/types/shared/icons/SendIcon.d.ts.map +1 -0
- package/dist/types/shared/icons/SparklesIcon.d.ts +5 -0
- package/dist/types/shared/icons/SparklesIcon.d.ts.map +1 -0
- package/dist/types/shared/icons/ZapIcon.d.ts +4 -0
- package/dist/types/shared/icons/ZapIcon.d.ts.map +1 -0
- package/dist/types/shared/theme/build-theme.d.ts +5 -0
- package/dist/types/shared/theme/build-theme.d.ts.map +1 -0
- package/dist/types/shared/theme/inject-styles.d.ts +10 -0
- package/dist/types/shared/theme/inject-styles.d.ts.map +1 -0
- package/dist/types/shared/ui/ErrorScreen.d.ts +9 -0
- package/dist/types/shared/ui/ErrorScreen.d.ts.map +1 -0
- package/dist/types/shared/ui/FAB.d.ts +9 -0
- package/dist/types/shared/ui/FAB.d.ts.map +1 -0
- package/dist/types/shared/ui/Footer.d.ts +3 -0
- package/dist/types/shared/ui/Footer.d.ts.map +1 -0
- package/dist/types/shared/ui/Header.d.ts +7 -0
- package/dist/types/shared/ui/Header.d.ts.map +1 -0
- package/dist/types/shared/ui/LoadingScreen.d.ts +7 -0
- package/dist/types/shared/ui/LoadingScreen.d.ts.map +1 -0
- package/dist/types/types.d.ts +11 -1
- package/dist/types/types.d.ts.map +1 -1
- package/dist/widget.js +1 -2
- package/dist/widget.js.map +1 -1
- package/package.json +6 -4
- package/dist/types/app.d.ts +0 -6
- package/dist/types/app.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -4
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/react.d.ts.map +0 -1
- package/dist/types/widget-state.d.ts +0 -7
- package/dist/types/widget-state.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -8,8 +8,9 @@ Embeddable AI chat widget for any website. Add customer support chat with a sing
|
|
|
8
8
|
|
|
9
9
|
```html
|
|
10
10
|
<script
|
|
11
|
-
src="https://
|
|
12
|
-
data-org-
|
|
11
|
+
src="https://cdn.evelan.de/widget/latest/widget.js"
|
|
12
|
+
data-org-slug="YOUR_ORG_SLUG"
|
|
13
|
+
async
|
|
13
14
|
></script>
|
|
14
15
|
```
|
|
15
16
|
|
|
@@ -23,10 +24,11 @@ npm install @evelan/jexity-widget
|
|
|
23
24
|
import { JexityChat } from '@evelan/jexity-widget'
|
|
24
25
|
|
|
25
26
|
const chat = JexityChat({
|
|
26
|
-
|
|
27
|
+
orgSlug: 'YOUR_ORG_SLUG',
|
|
27
28
|
})
|
|
28
29
|
|
|
29
|
-
// Later:
|
|
30
|
+
// Later:
|
|
31
|
+
chat.shutdown()
|
|
30
32
|
```
|
|
31
33
|
|
|
32
34
|
### React Provider
|
|
@@ -36,7 +38,7 @@ import { JexityChatProvider, useJexityChat } from '@evelan/jexity-widget/react'
|
|
|
36
38
|
|
|
37
39
|
function App() {
|
|
38
40
|
return (
|
|
39
|
-
<JexityChatProvider
|
|
41
|
+
<JexityChatProvider orgSlug="YOUR_ORG_SLUG">
|
|
40
42
|
<HomePage />
|
|
41
43
|
</JexityChatProvider>
|
|
42
44
|
)
|
|
@@ -48,40 +50,184 @@ function HomePage() {
|
|
|
48
50
|
}
|
|
49
51
|
```
|
|
50
52
|
|
|
53
|
+
---
|
|
54
|
+
|
|
51
55
|
## Configuration
|
|
52
56
|
|
|
53
57
|
| Option | Type | Default | Description |
|
|
54
58
|
|--------|------|---------|-------------|
|
|
55
|
-
| `
|
|
59
|
+
| `orgSlug` | `string` | **required** | Your organization slug (e.g. `acme-corp`) |
|
|
56
60
|
| `container` | `string \| HTMLElement` | auto-created `div` | CSS selector or element to mount into |
|
|
57
61
|
| `position` | `'bottom-right' \| 'bottom-left'` | `'bottom-right'` | Widget position on screen |
|
|
58
|
-
| `
|
|
59
|
-
| `greeting` | `string` | `'Hi there! How can I help?'` | Initial bot message |
|
|
62
|
+
| `colorScheme` | `'light' \| 'dark' \| 'auto'` | `'auto'` | Force color scheme; `'auto'` follows system preference |
|
|
60
63
|
| `title` | `string` | `'Jexity Assistant'` | Chat window header title |
|
|
61
|
-
| `
|
|
64
|
+
| `greeting` | `string` | `'Hi! How can I help?'` | Initial bot message shown on open |
|
|
65
|
+
| `primaryColor` | `string` | `'#0070f3'` | Shorthand brand color — tints FAB, header, user bubbles, send button |
|
|
66
|
+
| `accentColor` | `string` | — | Secondary accent color |
|
|
67
|
+
| `fontFamily` | `string` | — | Override widget font family |
|
|
68
|
+
| `fontSize` | `number` | — | Base font size in px |
|
|
69
|
+
| `borderRadius` | `string` | — | Override widget corner radius (e.g. `'8px'`) |
|
|
70
|
+
| `windowWidth` | `number` | — | Chat window width in px |
|
|
71
|
+
| `windowHeight` | `number` | — | Chat window height in px |
|
|
72
|
+
| `triggerIcon` | `'chat' \| 'bot' \| 'sparkles'` | `'chat'` | Floating action button icon |
|
|
73
|
+
| `triggerRadius` | `'none' \| 'sm' \| 'md' \| 'lg' \| 'full'` | `'full'` | FAB border radius shape |
|
|
74
|
+
| `triggerLabel` | `string` | — | Text label shown next to the FAB |
|
|
75
|
+
| `hideBranding` | `boolean` | `false` | Hide the "Powered by Jexity" footer |
|
|
76
|
+
| `locale` | `string` | browser / `'de'` | Force locale (`'de'` \| `'en'`). Overrides browser detection |
|
|
77
|
+
| `parentOrigin` | `string` | `window.location.origin` | Trusted origin for postMessage dashboard preview updates |
|
|
78
|
+
| `theme` | `JexityTheme` | — | Granular per-element color overrides (see below) |
|
|
79
|
+
|
|
80
|
+
### Granular Theme Overrides
|
|
81
|
+
|
|
82
|
+
`theme` lets you override individual element colors. Unset keys fall back to `primaryColor` or brand defaults.
|
|
83
|
+
|
|
84
|
+
```ts
|
|
85
|
+
JexityChat({
|
|
86
|
+
orgSlug: 'acme',
|
|
87
|
+
theme: {
|
|
88
|
+
bg: {
|
|
89
|
+
trigger: '#1a1a2e', // FAB background
|
|
90
|
+
header: '#16213e', // Chat header
|
|
91
|
+
msgUser: '#0f3460', // User bubble background
|
|
92
|
+
msgBot: '#f5f5f5', // Bot bubble background
|
|
93
|
+
window: '#ffffff', // Chat window background
|
|
94
|
+
sendBtn: '#e94560', // Send button background
|
|
95
|
+
},
|
|
96
|
+
text: {
|
|
97
|
+
header: '#ffffff', // Header text/icon color
|
|
98
|
+
msgUser: '#ffffff', // User bubble text
|
|
99
|
+
msgBot: '#333333', // Bot bubble text
|
|
100
|
+
main: '#212121', // Primary body text
|
|
101
|
+
muted: '#888888', // Secondary/muted text
|
|
102
|
+
},
|
|
103
|
+
border: {
|
|
104
|
+
window: '#e0e0e0', // Window border
|
|
105
|
+
input: '#cccccc', // Input field border
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
})
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
---
|
|
62
112
|
|
|
63
113
|
## Programmatic API
|
|
64
114
|
|
|
65
115
|
```ts
|
|
66
116
|
const chat = JexityChat(options)
|
|
67
117
|
|
|
68
|
-
chat.open()
|
|
69
|
-
chat.close()
|
|
70
|
-
chat.toggle()
|
|
71
|
-
chat.shutdown()
|
|
72
|
-
chat.isOpen
|
|
118
|
+
chat.open() // Open the chat window
|
|
119
|
+
chat.close() // Close the chat window
|
|
120
|
+
chat.toggle() // Toggle open/closed
|
|
121
|
+
chat.shutdown() // Remove widget from DOM
|
|
122
|
+
chat.isOpen // readonly boolean — current open state
|
|
123
|
+
chat.subscribe(cb) // Subscribe to open/close changes
|
|
124
|
+
// Returns unsubscribe function
|
|
125
|
+
|
|
126
|
+
// IIFE global (script tag):
|
|
127
|
+
window.JexityChat.open()
|
|
128
|
+
window.JexityChat.close()
|
|
129
|
+
window.JexityChat.toggle()
|
|
130
|
+
window.JexityChat.shutdown()
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## IIFE (Script Tag) Attributes
|
|
136
|
+
|
|
137
|
+
All options can be set as `data-*` attributes on the `<script>` tag:
|
|
138
|
+
|
|
139
|
+
```html
|
|
140
|
+
<script
|
|
141
|
+
src="https://cdn.evelan.de/widget/latest/widget.js"
|
|
142
|
+
data-org-slug="acme-corp"
|
|
143
|
+
data-locale="de"
|
|
144
|
+
data-primary-color="#ff6600"
|
|
145
|
+
data-trigger-icon="sparkles"
|
|
146
|
+
data-trigger-radius="lg"
|
|
147
|
+
data-trigger-label="Chat with us"
|
|
148
|
+
data-hide-branding="true"
|
|
149
|
+
async
|
|
150
|
+
></script>
|
|
73
151
|
```
|
|
74
152
|
|
|
75
|
-
|
|
153
|
+
Then control programmatically after load:
|
|
76
154
|
|
|
77
155
|
```html
|
|
78
|
-
<script src="https://cdn.evelan.de/widget/latest/widget.js" data-org-id="YOUR_ORG_ID"></script>
|
|
79
156
|
<script>
|
|
80
157
|
window.JexityChat.open()
|
|
81
158
|
window.JexityChat.shutdown()
|
|
82
159
|
</script>
|
|
83
160
|
```
|
|
84
161
|
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## Build Outputs
|
|
165
|
+
|
|
166
|
+
```
|
|
167
|
+
dist/
|
|
168
|
+
widget.js ← IIFE for <script> embed (CDN)
|
|
169
|
+
index.mjs ← ESM for bundlers (npm)
|
|
170
|
+
react.mjs ← React bindings (externalizes react + core)
|
|
171
|
+
types/index.d.ts ← TypeScript declarations (core)
|
|
172
|
+
types/react.d.ts ← TypeScript declarations (React)
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Target sizes: IIFE ≤ 32 KB · ESM ≤ 42 KB (gzipped)
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## Development
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
# From repo root:
|
|
183
|
+
pnpm dev --filter @evelan/jexity-widget
|
|
184
|
+
|
|
185
|
+
# Or directly:
|
|
186
|
+
cd apps/widget
|
|
187
|
+
pnpm dev
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
Open **`http://localhost:3002`** — the dev playground with live config controls.
|
|
191
|
+
|
|
192
|
+
### Environment variables
|
|
193
|
+
|
|
194
|
+
Create `apps/widget/.env.local`:
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
# Convex HTTP site URL — used to fetch widget config on mount.
|
|
198
|
+
# Copy from packages/backend/.env.local (CONVEX_SITE_URL).
|
|
199
|
+
# Dev deployment: sensible-anaconda-990.eu-west-1.convex.site
|
|
200
|
+
# Prod deployment: festive-<...>.convex.site (set in GitHub Actions Variable)
|
|
201
|
+
VITE_CONVEX_SITE_URL=https://<your-dev-deployment>.convex.site
|
|
202
|
+
|
|
203
|
+
# Reserved — not consumed yet. Future escape hatch if we ever swap Convex for
|
|
204
|
+
# a traditional REST backend (Express, Fastify, etc.). Once wired, widget code
|
|
205
|
+
# will read this instead of VITE_CONVEX_SITE_URL so the backend is hot-swappable
|
|
206
|
+
# via env alone. Set in GitHub Actions Secret: VITE_API_BASE_URL.
|
|
207
|
+
# VITE_API_BASE_URL=https://api.example.com
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### URL Parameters
|
|
211
|
+
|
|
212
|
+
| Parameter | Example | Purpose |
|
|
213
|
+
|-----------|---------|---------|
|
|
214
|
+
| `?orgSlug=` | `?orgSlug=demo` | Set org slug (default: `dev_local`) |
|
|
215
|
+
| `?primaryColor=` | `?primaryColor=%230070f3` | Set primary color |
|
|
216
|
+
| `?locale=` | `?locale=en` | Lock locale |
|
|
217
|
+
| `?position=` | `?position=bottom-left` | Widget position |
|
|
218
|
+
| `?title=` | `?title=My+Assistant` | Widget title |
|
|
219
|
+
| `?hideBranding=true` | — | Hide footer branding |
|
|
220
|
+
| `?skipHomeScreen=true` | — | Open directly to chat (skip landing) |
|
|
221
|
+
|
|
222
|
+
### Build
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
pnpm build # Full build (all 5 outputs)
|
|
226
|
+
pnpm check-types # Type-check only (fast)
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
85
231
|
## License
|
|
86
232
|
|
|
87
233
|
MIT
|