@convokit/widget 0.0.4 → 0.0.6
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
CHANGED
|
@@ -1,43 +1,23 @@
|
|
|
1
1
|
# @convokit/widget
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> **ConvoKit is currently in early access.** The waitlist is live — [join at convokit.dev](https://convokit.dev) to get early access.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|-----------|--------|--------------|-------------|
|
|
7
|
-
| **PopupWidget** | Bubble (corner) | ConvoKit | `apiKey` (public ConvoKit key) |
|
|
8
|
-
| **FullScreenWidget** | Full page | ConvoKit | `apiKey`, optional `onBack` |
|
|
9
|
-
| **PopupBackendWidget** | Bubble | Your backend | `apiUrl`, `apiKey`, optional `authToken` |
|
|
10
|
-
| **FullScreenBackendWidget** | Full page | Your backend | `apiUrl`, `apiKey`, optional `authToken`, `onBack` |
|
|
5
|
+
Add an AI-powered chat widget to any React or Next.js app in minutes. ConvoKit handles the AI, knowledge base, and conversations — you just drop in a component.
|
|
11
6
|
|
|
12
|
-
|
|
7
|
+
**Website:** [convokit.dev](https://convokit.dev)
|
|
13
8
|
|
|
14
9
|
---
|
|
15
10
|
|
|
16
|
-
##
|
|
11
|
+
## Four drop-in components
|
|
17
12
|
|
|
18
|
-
|
|
13
|
+
| Component | Layout | You provide |
|
|
14
|
+
|-----------|--------|-------------|
|
|
15
|
+
| **PopupWidget** | Bubble in corner | `apiKey` (your ConvoKit public key) |
|
|
16
|
+
| **FullScreenWidget** | Full page | `apiKey`, optional `onBack` |
|
|
17
|
+
| **PopupBackendWidget** | Bubble in corner | `apiUrl`, `apiKey` |
|
|
18
|
+
| **FullScreenBackendWidget** | Full page | `apiUrl`, `apiKey`, optional `onBack` |
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|--------------|----------------|
|
|
22
|
-
| **PopupWidget** | `<PopupWidget apiKey={key} />` — popup bubble, ConvoKit key. |
|
|
23
|
-
| **FullScreenWidget** | `<FullScreenWidget apiKey={key} onBack={() => router.back()} />` — full-page chat, ConvoKit key. |
|
|
24
|
-
| **PopupBackendWidget** | `<PopupBackendWidget apiUrl="/api/chat" apiKey={myKey} />` — popup, your backend. |
|
|
25
|
-
| **FullScreenBackendWidget** | `<FullScreenBackendWidget apiUrl="/api/chat" apiKey={myKey} onBack={() => router.back()} />` — full-page, your backend. |
|
|
26
|
-
|
|
27
|
-
**Optional props (all wrappers):** `title`, `welcomeMessage`, `widgetId`, `primaryColor`. Popup ones also accept `position`. Backend ones accept `authToken`. Full-screen ones accept `backLabel`. PopupWidget / FullScreenWidget also accept `persistMessages`.
|
|
28
|
-
|
|
29
|
-
**If you need full control** (your own state/API), use the low-level components with a config object:
|
|
30
|
-
|
|
31
|
-
| What to call | How |
|
|
32
|
-
|--------------|-----|
|
|
33
|
-
| **PopupKey** | `<PopupKey config={keyConfig} />` — config: `KeyConfig` (e.g. `{ key, title, position }`). |
|
|
34
|
-
| **FullScreenKey** | `<FullScreenKey config={keyConfig} onBack={fn} backLabel="Back" />` |
|
|
35
|
-
| **PopupBackend** | `<PopupBackend config={backendConfig} />` — config: `BackendConfig` (e.g. `{ apiUrl, apiKey }`). |
|
|
36
|
-
| **FullScreenBackend** | `<FullScreenBackend config={backendConfig} onBack={fn} backLabel="Back" />` |
|
|
37
|
-
| **PopupControlled** | `<PopupControlled config={controlledConfig} />` — you pass `messages`, `onMessagesUpdate`, `onSend`. |
|
|
38
|
-
| **FullScreenControlled** | `<FullScreenControlled config={controlledConfig} onBack={fn} backLabel="Back" />` |
|
|
39
|
-
|
|
40
|
-
**Types you can import:** `KeyConfig`, `BackendConfig`, `ControlledConfig`, `PopupWidgetProps`, `FullScreenWidgetProps`, `PopupBackendWidgetProps`, `FullScreenBackendWidgetProps`, `ChatMessage`, `ChatHistoryItem`, `ChatResponse`, `ThemeOptions`.
|
|
20
|
+
No separate CSS import needed — styles are bundled.
|
|
41
21
|
|
|
42
22
|
---
|
|
43
23
|
|
|
@@ -53,66 +33,51 @@ pnpm add @convokit/widget
|
|
|
53
33
|
|
|
54
34
|
---
|
|
55
35
|
|
|
56
|
-
## Quick start
|
|
36
|
+
## Quick start
|
|
57
37
|
|
|
58
|
-
|
|
38
|
+
### React / Vite
|
|
59
39
|
|
|
60
40
|
```tsx
|
|
61
|
-
// Any React entry (e.g. App.tsx)
|
|
62
41
|
import { PopupWidget } from '@convokit/widget';
|
|
63
42
|
|
|
64
43
|
export function App() {
|
|
65
44
|
return (
|
|
66
45
|
<div>
|
|
67
|
-
{/*
|
|
46
|
+
{/* your app */}
|
|
68
47
|
<PopupWidget apiKey={import.meta.env.VITE_CONVOKIT_KEY ?? ''} />
|
|
69
48
|
</div>
|
|
70
49
|
);
|
|
71
50
|
}
|
|
72
51
|
```
|
|
73
52
|
|
|
74
|
-
|
|
75
|
-
- Optional props (all wrappers): `title`, `welcomeMessage`, `widgetId`, `primaryColor`.
|
|
76
|
-
- Popup widgets also accept `position`, `persistMessages`. Backend widgets accept `authToken`. Full‑screen widgets accept `onBack` and `backLabel`.
|
|
77
|
-
|
|
78
|
-
If the required props are missing (`apiKey` for key‑based widgets, or `apiUrl`/`apiKey` for backend widgets), the widget renders nothing.
|
|
53
|
+
### Next.js App Router (recommended)
|
|
79
54
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
If you use **Next.js App Router**, use the Next-specific entry so you don’t write `dynamic()` or a wrapper yourself:
|
|
55
|
+
Use the built-in Next.js entry — no need to write `dynamic()` yourself:
|
|
83
56
|
|
|
84
57
|
```tsx
|
|
85
|
-
// app/layout.tsx
|
|
58
|
+
// app/layout.tsx
|
|
86
59
|
import { PopupWidgetNext } from '@convokit/widget/next';
|
|
87
60
|
|
|
88
61
|
export default function Layout({ children }) {
|
|
89
62
|
return (
|
|
90
63
|
<html><body>
|
|
91
64
|
{children}
|
|
92
|
-
<PopupWidgetNext />
|
|
65
|
+
<PopupWidgetNext apiKey={process.env.NEXT_PUBLIC_CONVOKIT_KEY ?? ''} />
|
|
93
66
|
</body></html>
|
|
94
67
|
);
|
|
95
68
|
}
|
|
96
69
|
```
|
|
97
70
|
|
|
98
|
-
|
|
99
|
-
- Optional: pass `apiKey`, `title`, `welcomeMessage`, `position`, etc. as props.
|
|
100
|
-
- You still need **transpilePackages** (and optionally resolve alias for react) in `next.config.js` if you see duplicate-React errors; see “Next.js App Router (avoid duplicate React)” below.
|
|
101
|
-
|
|
102
|
-
### Next.js App Router (avoid duplicate React)
|
|
103
|
-
|
|
104
|
-
The widget is client-only (hooks, DOM). In Next.js you must use **one React instance** in the browser. If the widget resolves to a different copy of React than your app, you get errors like `Cannot read properties of undefined (reading 'ReactCurrentDispatcher')`.
|
|
71
|
+
`PopupWidgetNext` uses `next/dynamic` with `ssr: false` automatically and reads `NEXT_PUBLIC_CONVOKIT_KEY` if you don't pass `apiKey`.
|
|
105
72
|
|
|
106
|
-
|
|
73
|
+
### Next.js App Router (manual dynamic import)
|
|
107
74
|
|
|
108
75
|
```tsx
|
|
109
|
-
// app/layout.tsx or a client component
|
|
110
76
|
'use client';
|
|
111
|
-
|
|
112
77
|
import dynamic from 'next/dynamic';
|
|
113
78
|
|
|
114
79
|
const PopupWidget = dynamic(
|
|
115
|
-
() => import('@convokit/widget').then((
|
|
80
|
+
() => import('@convokit/widget').then((m) => m.PopupWidget),
|
|
116
81
|
{ ssr: false }
|
|
117
82
|
);
|
|
118
83
|
|
|
@@ -126,150 +91,101 @@ export default function Layout({ children }) {
|
|
|
126
91
|
}
|
|
127
92
|
```
|
|
128
93
|
|
|
129
|
-
|
|
94
|
+
---
|
|
130
95
|
|
|
131
|
-
|
|
132
|
-
// next.config.js
|
|
133
|
-
/** @type {import('next').NextConfig} */
|
|
134
|
-
const nextConfig = {
|
|
135
|
-
transpilePackages: ['@convokit/widget'],
|
|
136
|
-
webpack: (config) => {
|
|
137
|
-
config.resolve.alias = {
|
|
138
|
-
...config.resolve.alias,
|
|
139
|
-
react: require.resolve('react'),
|
|
140
|
-
'react-dom': require.resolve('react-dom'),
|
|
141
|
-
};
|
|
142
|
-
return config;
|
|
143
|
-
},
|
|
144
|
-
};
|
|
145
|
-
module.exports = nextConfig;
|
|
146
|
-
```
|
|
96
|
+
## All four components
|
|
147
97
|
|
|
148
|
-
|
|
98
|
+
```tsx
|
|
99
|
+
// Popup bubble – ConvoKit key
|
|
100
|
+
<PopupWidget apiKey="pk_live_..." />
|
|
149
101
|
|
|
150
|
-
|
|
102
|
+
// Full-page chat – ConvoKit key
|
|
103
|
+
<FullScreenWidget apiKey="pk_live_..." onBack={() => router.back()} />
|
|
151
104
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
| **PopupWidget** | Popup with ConvoKit key | `apiKey` |
|
|
155
|
-
| **FullScreenWidget** | Full-page chat with ConvoKit key | `apiKey`, `onBack` (e.g. `() => router.back()`) |
|
|
156
|
-
| **PopupBackendWidget** | Popup talking to your backend | `apiUrl`, `apiKey` |
|
|
157
|
-
| **FullScreenBackendWidget** | Full-page chat talking to your backend | `apiUrl`, `apiKey`, `onBack` |
|
|
105
|
+
// Popup bubble – your own backend
|
|
106
|
+
<PopupBackendWidget apiUrl="/api/chat" apiKey="your-key" />
|
|
158
107
|
|
|
159
|
-
|
|
108
|
+
// Full-page chat – your own backend
|
|
109
|
+
<FullScreenBackendWidget apiUrl="/api/chat" apiKey="your-key" onBack={() => router.back()} />
|
|
110
|
+
```
|
|
160
111
|
|
|
161
|
-
|
|
162
|
-
// Full-screen (Key mode)
|
|
163
|
-
import { FullScreenWidget } from '@convokit/widget';
|
|
112
|
+
---
|
|
164
113
|
|
|
165
|
-
|
|
166
|
-
const apiKey = import.meta.env.VITE_CONVOKIT_KEY ?? '';
|
|
167
|
-
return (
|
|
168
|
-
<FullScreenWidget
|
|
169
|
-
apiKey={apiKey}
|
|
170
|
-
onBack={() => {
|
|
171
|
-
// e.g. navigate(-1) with react-router
|
|
172
|
-
}}
|
|
173
|
-
/>
|
|
174
|
-
);
|
|
175
|
-
}
|
|
114
|
+
## Props
|
|
176
115
|
|
|
177
|
-
|
|
178
|
-
import { PopupBackendWidget } from '@convokit/widget';
|
|
116
|
+
**All components accept:**
|
|
179
117
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
);
|
|
187
|
-
}
|
|
118
|
+
| Prop | Type | Description |
|
|
119
|
+
|------|------|-------------|
|
|
120
|
+
| `title` | `string` | Widget header title |
|
|
121
|
+
| `welcomeMessage` | `string` | First message shown to the user |
|
|
122
|
+
| `widgetId` | `string` | Identifier for the bot / channel |
|
|
123
|
+
| `primaryColor` | `string` | Accent color (hex or CSS color) |
|
|
188
124
|
|
|
189
|
-
|
|
190
|
-
import { FullScreenBackendWidget } from '@convokit/widget';
|
|
125
|
+
**Popup components also accept:**
|
|
191
126
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
apiKey={import.meta.env.VITE_BACKEND_KEY ?? ''}
|
|
197
|
-
onBack={() => {
|
|
198
|
-
// go back / close
|
|
199
|
-
}}
|
|
200
|
-
/>
|
|
201
|
-
);
|
|
202
|
-
}
|
|
203
|
-
```
|
|
127
|
+
| Prop | Type | Description |
|
|
128
|
+
|------|------|-------------|
|
|
129
|
+
| `position` | `'bottom-right' \| 'bottom-left'` | Bubble position |
|
|
130
|
+
| `persistMessages` | `boolean` | Keep messages across page loads |
|
|
204
131
|
|
|
205
|
-
|
|
132
|
+
**Backend components also accept:**
|
|
206
133
|
|
|
207
|
-
|
|
208
|
-
|
|
134
|
+
| Prop | Type | Description |
|
|
135
|
+
|------|------|-------------|
|
|
136
|
+
| `authToken` | `string` | Bearer token forwarded to your backend |
|
|
209
137
|
|
|
210
|
-
|
|
138
|
+
**Full-screen components also accept:**
|
|
211
139
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
);
|
|
140
|
+
| Prop | Type | Description |
|
|
141
|
+
|------|------|-------------|
|
|
142
|
+
| `onBack` | `() => void` | Called when user taps the back button |
|
|
143
|
+
| `backLabel` | `string` | Label for the back button |
|
|
217
144
|
|
|
218
|
-
|
|
219
|
-
const FullScreenWidget = dynamic(
|
|
220
|
-
() => import('@convokit/widget').then((m) => m.FullScreenWidget),
|
|
221
|
-
{ ssr: false }
|
|
222
|
-
);
|
|
145
|
+
---
|
|
223
146
|
|
|
224
|
-
|
|
225
|
-
const apiKey = process.env.NEXT_PUBLIC_CONVOKIT_KEY ?? '';
|
|
226
|
-
return (
|
|
227
|
-
<html>
|
|
228
|
-
<body>
|
|
229
|
-
{children}
|
|
230
|
-
<PopupWidget apiKey={apiKey} />
|
|
231
|
-
</body>
|
|
232
|
-
</html>
|
|
233
|
-
);
|
|
234
|
-
}
|
|
147
|
+
## Advanced: low-level components
|
|
235
148
|
|
|
236
|
-
|
|
237
|
-
export function FullScreenChatPage() {
|
|
238
|
-
const apiKey = process.env.NEXT_PUBLIC_CONVOKIT_KEY ?? '';
|
|
239
|
-
const router = useRouter();
|
|
240
|
-
return (
|
|
241
|
-
<FullScreenWidget apiKey={apiKey} onBack={() => router.back()} />
|
|
242
|
-
);
|
|
243
|
-
}
|
|
244
|
-
```
|
|
149
|
+
If you need full control over state or API calls, use the low-level components directly:
|
|
245
150
|
|
|
246
|
-
|
|
151
|
+
| Component | Config type |
|
|
152
|
+
|-----------|-------------|
|
|
153
|
+
| `PopupKey` / `FullScreenKey` | `KeyConfig` |
|
|
154
|
+
| `PopupBackend` / `FullScreenBackend` | `BackendConfig` |
|
|
155
|
+
| `PopupControlled` / `FullScreenControlled` | `ControlledConfig` (you pass `messages`, `onMessagesUpdate`, `onSend`) |
|
|
156
|
+
|
|
157
|
+
**Types you can import:** `KeyConfig`, `BackendConfig`, `ControlledConfig`, `PopupWidgetProps`, `FullScreenWidgetProps`, `PopupBackendWidgetProps`, `FullScreenBackendWidgetProps`, `ChatMessage`, `ChatHistoryItem`, `ChatResponse`, `ThemeOptions`.
|
|
247
158
|
|
|
248
159
|
---
|
|
249
160
|
|
|
250
|
-
##
|
|
161
|
+
## Fixing duplicate React errors in Next.js
|
|
251
162
|
|
|
252
|
-
|
|
163
|
+
If you see `Cannot read properties of undefined (reading 'ReactCurrentDispatcher')`, add this to `next.config.js`:
|
|
253
164
|
|
|
254
|
-
|
|
165
|
+
```js
|
|
166
|
+
const nextConfig = {
|
|
167
|
+
transpilePackages: ['@convokit/widget'],
|
|
168
|
+
webpack: (config) => {
|
|
169
|
+
config.resolve.alias = {
|
|
170
|
+
...config.resolve.alias,
|
|
171
|
+
react: require.resolve('react'),
|
|
172
|
+
'react-dom': require.resolve('react-dom'),
|
|
173
|
+
};
|
|
174
|
+
return config;
|
|
175
|
+
},
|
|
176
|
+
};
|
|
177
|
+
module.exports = nextConfig;
|
|
178
|
+
```
|
|
255
179
|
|
|
256
|
-
|
|
180
|
+
---
|
|
257
181
|
|
|
258
|
-
|
|
182
|
+
## Early access
|
|
259
183
|
|
|
260
|
-
|
|
261
|
-
npm run dev
|
|
262
|
-
# or
|
|
263
|
-
pnpm dev
|
|
264
|
-
```
|
|
184
|
+
ConvoKit is in early access. Get your API key and set up your knowledge base at **[convokit.dev](https://convokit.dev)**.
|
|
265
185
|
|
|
266
|
-
|
|
186
|
+
The waitlist is live — join now to get early access.
|
|
267
187
|
|
|
268
|
-
|
|
269
|
-
npm run build
|
|
270
|
-
# or
|
|
271
|
-
pnpm build
|
|
272
|
-
```
|
|
188
|
+
---
|
|
273
189
|
|
|
274
190
|
## License
|
|
275
191
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Component, ErrorInfo, ReactNode } from 'react';
|
|
2
2
|
|
|
3
3
|
export declare class DemoErrorBoundary extends Component<{
|
|
4
4
|
children: ReactNode;
|
|
@@ -12,6 +12,6 @@ export declare class DemoErrorBoundary extends Component<{
|
|
|
12
12
|
error: Error;
|
|
13
13
|
};
|
|
14
14
|
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
15
|
-
render(): string | number | boolean | import("react/jsx-runtime").JSX.Element | Iterable<
|
|
15
|
+
render(): string | number | boolean | import("react/jsx-runtime").JSX.Element | Iterable<ReactNode> | null | undefined;
|
|
16
16
|
}
|
|
17
17
|
//# sourceMappingURL=DemoErrorBoundary.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DemoErrorBoundary.d.ts","sourceRoot":"","sources":["../src/DemoErrorBoundary.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"DemoErrorBoundary.d.ts","sourceRoot":"","sources":["../src/DemoErrorBoundary.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAExD,qBAAa,iBAAkB,SAAQ,SAAS,CAAC;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,EAAE;IAAE,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;CAAE,CAAC;IAChG,KAAK;eAAoB,KAAK,GAAG,IAAI;MAAG;IAExC,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,KAAK;;;IAI5C,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS;IAIpD,MAAM;CAcP"}
|
|
@@ -4818,7 +4818,7 @@ const xh = {
|
|
|
4818
4818
|
function Dh(t, e) {
|
|
4819
4819
|
return jf(t, e, Ph, zf);
|
|
4820
4820
|
}
|
|
4821
|
-
const Fn = /* @__PURE__ */ Dh("div"), Lo = "
|
|
4821
|
+
const Fn = /* @__PURE__ */ Dh("div"), Lo = "https://qa-api.convokit.dev/api/widget/chat";
|
|
4822
4822
|
function cn(t) {
|
|
4823
4823
|
let e;
|
|
4824
4824
|
try {
|
package/dist/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document!="undefined"){var o=document.createElement("style");o.appendChild(document.createTextNode(":root{--convokit-primary: #000;--convokit-header-bg: #000;--convokit-font-family: Inter, system-ui, sans-serif;--convokit-font-size: 14px;--convokit-border-radius: 18px;--convokit-chat-bg: #ffffff;--convokit-user-msg-bg: #000;--convokit-assistant-msg-bg: #f3f4f6;--convokit-input-bg: #ffffff;--convokit-input-border: #d1d5db}.convokit-widget{position:fixed;top:0;left:0;right:0;bottom:0;pointer-events:none;font-family:var(--convokit-font-family);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.convokit-button{width:56px;height:56px;border-radius:50%;border:2px solid var(--convokit-primary);color:#fff;cursor:pointer;display:flex;align-items:center;justify-content:center;box-shadow:0 2px 8px #0000001a;z-index:10000;transition:all .2s ease;background:var(--convokit-primary)}.convokit-button:hover{transform:translateY(-2px);box-shadow:0 4px 12px #00000026}.convokit-button:active{transform:translateY(0)}.convokit-button-hidden{opacity:0;transform:scale(0);pointer-events:none;transition:all .2s ease-in-out}.convokit-chat-window{width:380px;height:600px;background:#fff;border-radius:12px;box-shadow:0 4px 16px #0000001a;display:flex;flex-direction:column;overflow:hidden;position:absolute;bottom:0;right:0;z-index:9999;transform-origin:bottom right;border:2px solid #000;overscroll-behavior:contain}.convokit-chat-window-body{width:100%;height:100%;background:#fff;display:flex;flex-direction:column;overflow:hidden}.convokit-chat-wrapper{display:flex;flex-direction:column;flex:1;background:var(--convokit-chat-bg);overflow:hidden}.convokit-header{padding:16px 20px;color:#fff;display:flex;justify-content:space-between;align-items:center;min-height:60px;background:var(--convokit-header-bg);position:relative;border-bottom:2px solid var(--convokit-header-bg)}.convokit-header-subtitle{margin:0;font-size:12px;opacity:.85;line-height:1.3}.convokit-header-left{display:flex;align-items:center;gap:12px;flex:1}.convokit-avatar{display:none}.convokit-header-text{display:flex;flex-direction:column;gap:4px}.convokit-header-text h3{margin:0;font-size:16px;font-weight:600;line-height:1.3}.convokit-header-actions{display:flex;align-items:center;gap:4px}.convokit-header-icon{background:none;border:none;color:#fff;cursor:pointer;padding:4px;display:flex;align-items:center;justify-content:center;border-radius:4px;transition:opacity .2s ease}.convokit-header-icon:hover{opacity:.7}.convokit-header-icon:active{opacity:.5}.convokit-chat-window-content{display:flex;flex-direction:column;flex:1;overflow:hidden;min-height:0}.convokit-chat-container{display:flex;flex-direction:column;flex:1;padding:16px;border:none;overflow:hidden;background:transparent;overscroll-behavior:contain}.convokit-messages{flex:1;overflow-y:auto;padding:8px 0;display:flex;flex-direction:column;gap:16px;background:transparent;scrollbar-width:none;-ms-overflow-style:none;overscroll-behavior:contain}.convokit-messages::-webkit-scrollbar{display:none}.convokit-welcome{text-align:center;color:#666;padding:20px;font-size:14px}.convokit-message{display:flex;align-items:flex-end;gap:0;max-width:75%}.convokit-message-user{align-self:flex-end}.convokit-message-assistant{align-self:flex-start}.convokit-bot-icon{display:none}.convokit-message-content{padding:10px 14px;border-radius:var(--convokit-border-radius);word-wrap:break-word;font-size:var(--convokit-font-size);line-height:1.5;position:relative}.convokit-message-user .convokit-message-content{background:var(--convokit-user-msg-bg);color:#fff;border-bottom-right-radius:4px}.convokit-message-assistant .convokit-message-content{background:var(--convokit-assistant-msg-bg);color:#000;border-bottom-left-radius:4px}.convokit-message-content strong{font-weight:600}.convokit-message-content em{font-style:italic}.convokit-message-content a{text-decoration:underline}.convokit-typing{display:flex;gap:6px;padding:4px 0;align-items:center}.convokit-typing span{width:8px;height:8px;border-radius:50%;background:#6b7280;animation:typing-bounce 1.4s ease-in-out infinite}.convokit-typing span:nth-child(1){animation-delay:0s}.convokit-typing span:nth-child(2){animation-delay:.2s}.convokit-typing span:nth-child(3){animation-delay:.4s}@keyframes typing-bounce{0%,60%,to{transform:translateY(0)}30%{transform:translateY(-8px)}}.convokit-input-form{display:flex;align-items:center;padding:12px 0 0;gap:8px;flex-shrink:0;background:transparent;border-bottom:none}.convokit-input{flex:1;padding:11px 14px;border:1px solid color-mix(in srgb,var(--convokit-primary) 35%,transparent);background:var(--convokit-input-bg);border-radius:20px;font-size:var(--convokit-font-size);outline:none;color:#000;font-family:var(--convokit-font-family);transition:border-color .2s ease,box-shadow .2s ease}.convokit-input:focus{border-color:var(--convokit-primary);box-shadow:none}.convokit-input::placeholder{color:#9ca3af}.convokit-input:disabled{background:#f9fafb;color:#9ca3af;border-color:#e5e7eb}.convokit-send-button{width:40px;height:40px;border-radius:50%;border:none;color:#fff;cursor:pointer;display:flex;align-items:center;justify-content:center;flex-shrink:0;background:var(--convokit-primary);transition:opacity .2s ease}.convokit-send-button:hover:not(:disabled){opacity:.8}.convokit-send-button:active:not(:disabled){opacity:.6}.convokit-send-button:disabled{opacity:.3;cursor:not-allowed;background:var(--convokit-primary)}.convokit-footer{padding:10px 16px;text-align:center;background:var(--convokit-chat-bg);font-size:11px;color:#6b7280}.convokit-footer a{color:var(--convokit-primary);text-decoration:none;font-weight:500;transition:opacity .2s ease}.convokit-footer a:hover{opacity:.7}.convokit-rating-prompt{padding:16px;border-top:1px solid #e5e7eb;background-color:#f9fafb;border-bottom-left-radius:12px;border-bottom-right-radius:12px}.convokit-rating-question{margin:0 0 12px;font-size:14px;font-weight:500;color:#374151;text-align:center}.convokit-rating-buttons{display:flex;gap:12px;justify-content:center;margin-bottom:12px}.convokit-rating-button{width:48px;height:48px;border-radius:50%;border:2px solid #d1d5db;background-color:#fff;color:#6b7280;cursor:pointer;transition:all .2s ease;display:flex;align-items:center;justify-content:center;padding:0}.convokit-rating-button:hover:not(:disabled){border-color:#9ca3af;transform:scale(1.05)}.convokit-rating-button:disabled{opacity:.5;cursor:not-allowed}.convokit-rating-button.convokit-rating-selected{color:#fff;border-width:2px}.convokit-rating-feedback{margin-top:12px;animation:slideDown .3s ease}@keyframes slideDown{0%{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}.convokit-rating-textarea{width:100%;padding:10px 12px;border:1px solid #d1d5db;border-radius:8px;font-size:14px;font-family:inherit;resize:vertical;min-height:60px;margin-bottom:8px;box-sizing:border-box}.convokit-rating-textarea:focus{outline:none;border-color:#3b82f6;box-shadow:0 0 0 3px #3b82f61a}.convokit-rating-textarea:disabled{background-color:#f3f4f6;cursor:not-allowed}.convokit-rating-submit{width:100%;padding:10px 16px;border:none;border-radius:8px;font-size:14px;font-weight:500;color:#fff;cursor:pointer;transition:opacity .2s ease}.convokit-rating-submit:hover:not(:disabled){opacity:.9}.convokit-rating-submit:disabled{opacity:.6;cursor:not-allowed}.convokit-rating-thankyou{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:24px 16px;animation:fadeIn .3s ease}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}.convokit-rating-icon{width:48px;height:48px;border-radius:50%;background-color:#10b981;color:#fff;display:flex;align-items:center;justify-content:center;font-size:24px;font-weight:700;margin-bottom:12px}.convokit-rating-message{margin:0;font-size:14px;font-weight:500;color:#374151}@media (max-width: 480px){.convokit-widget{bottom:10px;right:10px}.convokit-chat-window{width:calc(100vw - 20px);height:calc(100vh - 20px);max-width:calc(100vw - 20px);max-height:calc(100vh - 20px);bottom:0;right:0;border-radius:16px}.convokit-message{max-width:85%}.convokit-header{padding:16px 16px 12px;min-height:64px}.convokit-chat-container{padding:12px}}")),document.head.appendChild(o)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
|
|
2
|
-
import { M as L, r as _, f as R, i as $, s as G, c as Y, a as q, g as A, b as U, d as V, e as J } from "./PopupWidget-
|
|
3
|
-
import { P as he } from "./PopupWidget-
|
|
2
|
+
import { M as L, r as _, f as R, i as $, s as G, c as Y, a as q, g as A, b as U, d as V, e as J } from "./PopupWidget-PskdRToD.js";
|
|
3
|
+
import { P as he } from "./PopupWidget-PskdRToD.js";
|
|
4
4
|
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
5
5
|
import { useState as u, useRef as F, useEffect as N } from "react";
|
|
6
6
|
const Q = "convokit-widget", X = ({ config: e, onBack: c, backLabel: r = "Back to editor" }) => {
|
package/dist/next.esm.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as o } from "react/jsx-runtime";
|
|
3
3
|
import n from "next/dynamic";
|
|
4
4
|
const i = n(
|
|
5
|
-
() => import("./PopupWidget-
|
|
5
|
+
() => import("./PopupWidget-PskdRToD.js").then((e) => e.h).then((e) => e.PopupWidget),
|
|
6
6
|
{ ssr: !1 }
|
|
7
7
|
), s = () => {
|
|
8
8
|
var e;
|