@contenify/chatbot 4.0.0 → 4.0.2
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 +199 -170
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +16 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -1
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1199 -59
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,268 +1,297 @@
|
|
|
1
1
|
# @contenify/chatbot
|
|
2
2
|
|
|
3
|
-
AI-powered
|
|
3
|
+
An AI-powered content creation widget. Drop it into any React app and your users can paste a news URL or topic, get a fully rewritten article, run SEO analysis, and export or publish — all from one chat interface.
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Table of Contents
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
1. [Prerequisites](#1-prerequisites)
|
|
10
|
+
2. [Installation](#2-installation)
|
|
11
|
+
3. [Get Your API Key](#3-get-your-api-key)
|
|
12
|
+
4. [Set Up Environment Variables](#4-set-up-environment-variables)
|
|
13
|
+
5. [Add the Component](#5-add-the-component)
|
|
14
|
+
6. [Next.js Setup](#6-nextjs-setup)
|
|
15
|
+
7. [Receive Published Articles](#7-receive-published-articles)
|
|
16
|
+
8. [Props Reference](#8-props-reference)
|
|
17
|
+
9. [Update Config at Runtime](#9-update-config-at-runtime)
|
|
18
|
+
10. [What the Widget Can Do](#10-what-the-widget-can-do)
|
|
19
|
+
11. [Troubleshooting](#11-troubleshooting)
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## 1. Prerequisites
|
|
24
|
+
|
|
25
|
+
- React **18** or higher
|
|
26
|
+
- A Contenify API key (see [Step 3](#3-get-your-api-key))
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## 2. Installation
|
|
12
31
|
|
|
13
32
|
```bash
|
|
33
|
+
npm install @contenify/chatbot
|
|
34
|
+
# or
|
|
14
35
|
yarn add @contenify/chatbot
|
|
36
|
+
# or
|
|
37
|
+
pnpm add @contenify/chatbot
|
|
15
38
|
```
|
|
16
39
|
|
|
17
|
-
|
|
18
|
-
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## 3. Get Your API Key
|
|
43
|
+
|
|
44
|
+
1. Go to [contenify.in/dashboard/api-keys](https://contenify.in/dashboard/api-keys)
|
|
45
|
+
2. Create a new API key
|
|
46
|
+
3. Copy the key — you will need it in the next step
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## 4. Set Up Environment Variables
|
|
51
|
+
|
|
52
|
+
Create a `.env` file in the root of your project (or add to your existing one):
|
|
53
|
+
|
|
54
|
+
```env
|
|
55
|
+
NEXT_PUBLIC_CONTENIFY_API_URL=https://api.contenifyai.cloud/api
|
|
56
|
+
NEXT_PUBLIC_API_KEY=your-api-key-here
|
|
57
|
+
NEXT_PUBLIC_CONTENIFY_DOMAIN=yourdomain.com
|
|
19
58
|
```
|
|
20
59
|
|
|
21
|
-
|
|
60
|
+
| Variable | Required | Description |
|
|
61
|
+
|---|---|---|
|
|
62
|
+
| `NEXT_PUBLIC_CONTENIFY_API_URL` | Yes | The Contenify backend URL |
|
|
63
|
+
| `NEXT_PUBLIC_API_KEY` | Yes | Your API key from Step 3 |
|
|
64
|
+
| `NEXT_PUBLIC_CONTENIFY_DOMAIN` | No | Your site domain, used for news source filtering |
|
|
65
|
+
|
|
66
|
+
> The widget reads these variables automatically. You do not need to pass them as props unless you want to override them per instance.
|
|
22
67
|
|
|
23
68
|
---
|
|
24
69
|
|
|
25
|
-
##
|
|
70
|
+
## 5. Add the Component
|
|
26
71
|
|
|
27
|
-
|
|
72
|
+
Import the component and its styles, then place it anywhere in your app:
|
|
28
73
|
|
|
29
74
|
```tsx
|
|
30
75
|
import { ContenifyChatBot } from '@contenify/chatbot'
|
|
31
76
|
import '@contenify/chatbot/styles.css'
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
### 2. Add the chatbot to your app
|
|
35
77
|
|
|
36
|
-
```tsx
|
|
37
78
|
export default function App() {
|
|
38
|
-
return
|
|
39
|
-
<ContenifyChatBot
|
|
40
|
-
apiUrl="https://your-api.example.com/api"
|
|
41
|
-
apiKey="YOUR_API_KEY"
|
|
42
|
-
/>
|
|
43
|
-
)
|
|
79
|
+
return <ContenifyChatBot />
|
|
44
80
|
}
|
|
45
81
|
```
|
|
46
82
|
|
|
47
|
-
That's it. The
|
|
83
|
+
That's it. The widget picks up `NEXT_PUBLIC_CONTENIFY_API_URL` and `NEXT_PUBLIC_API_KEY` from your environment automatically.
|
|
48
84
|
|
|
49
85
|
---
|
|
50
86
|
|
|
51
|
-
##
|
|
87
|
+
## 6. Next.js Setup
|
|
52
88
|
|
|
53
|
-
|
|
54
|
-
|------|------|----------|-------------|
|
|
55
|
-
| `apiUrl` | `string` | Yes | Base URL of your Contenify backend API (e.g. `https://api.example.com/api`) |
|
|
56
|
-
| `apiKey` | `string` | Yes | Your licence API key |
|
|
57
|
-
| `domain` | `string` | No | Domain identifier for multi-tenant setups |
|
|
58
|
-
| `onPost` | `(content: string, keywords: string[]) => void` | No | Callback fired when the user clicks **Post** on a generated article. Receives the HTML content and meta keywords. |
|
|
89
|
+
### App Router (recommended)
|
|
59
90
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
## Usage Examples
|
|
63
|
-
|
|
64
|
-
### Basic embed
|
|
91
|
+
The widget uses React hooks internally so it must run on the client. Create a wrapper component:
|
|
65
92
|
|
|
66
93
|
```tsx
|
|
94
|
+
// app/components/ContentEditor.tsx
|
|
95
|
+
'use client'
|
|
96
|
+
|
|
67
97
|
import { ContenifyChatBot } from '@contenify/chatbot'
|
|
68
98
|
import '@contenify/chatbot/styles.css'
|
|
69
99
|
|
|
70
|
-
export default function
|
|
71
|
-
return
|
|
72
|
-
<div style={{ height: '100vh' }}>
|
|
73
|
-
<ContenifyChatBot
|
|
74
|
-
apiUrl="https://api.example.com/api"
|
|
75
|
-
apiKey="LIC-XXXXXX-XXXXXX"
|
|
76
|
-
/>
|
|
77
|
-
</div>
|
|
78
|
-
)
|
|
100
|
+
export default function ContentEditor() {
|
|
101
|
+
return <ContenifyChatBot />
|
|
79
102
|
}
|
|
80
103
|
```
|
|
81
104
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
Handle articles when the user clicks **Post** — publish to your CMS, save to a database, or trigger any workflow:
|
|
105
|
+
Then use it in any Server Component or page:
|
|
85
106
|
|
|
86
107
|
```tsx
|
|
87
|
-
|
|
88
|
-
import '
|
|
108
|
+
// app/page.tsx
|
|
109
|
+
import ContentEditor from './components/ContentEditor'
|
|
89
110
|
|
|
90
111
|
export default function Page() {
|
|
91
|
-
const handlePost = (content: string, keywords: string[]) => {
|
|
92
|
-
// content is an HTML string, keywords is string[]
|
|
93
|
-
console.log('Article HTML:', content)
|
|
94
|
-
console.log('Keywords:', keywords)
|
|
95
|
-
|
|
96
|
-
// Example: POST to your CMS
|
|
97
|
-
fetch('/api/articles', {
|
|
98
|
-
method: 'POST',
|
|
99
|
-
headers: { 'Content-Type': 'application/json' },
|
|
100
|
-
body: JSON.stringify({ content, keywords }),
|
|
101
|
-
})
|
|
102
|
-
}
|
|
103
|
-
|
|
104
112
|
return (
|
|
105
|
-
<
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
onPost={handlePost}
|
|
109
|
-
/>
|
|
113
|
+
<main>
|
|
114
|
+
<ContentEditor />
|
|
115
|
+
</main>
|
|
110
116
|
)
|
|
111
117
|
}
|
|
112
118
|
```
|
|
113
119
|
|
|
114
|
-
###
|
|
120
|
+
### Pages Router
|
|
115
121
|
|
|
116
|
-
|
|
122
|
+
No wrapper needed — just import and use directly:
|
|
117
123
|
|
|
118
124
|
```tsx
|
|
119
|
-
//
|
|
120
|
-
'use client'
|
|
121
|
-
|
|
125
|
+
// pages/editor.tsx
|
|
122
126
|
import { ContenifyChatBot } from '@contenify/chatbot'
|
|
123
127
|
import '@contenify/chatbot/styles.css'
|
|
124
128
|
|
|
125
|
-
export default function
|
|
126
|
-
return
|
|
127
|
-
<ContenifyChatBot
|
|
128
|
-
apiUrl={process.env.NEXT_PUBLIC_API_URL!}
|
|
129
|
-
apiKey={process.env.NEXT_PUBLIC_API_KEY!}
|
|
130
|
-
onPost={(content, keywords) => {
|
|
131
|
-
console.log('Post triggered', { content, keywords })
|
|
132
|
-
}}
|
|
133
|
-
/>
|
|
134
|
-
)
|
|
129
|
+
export default function EditorPage() {
|
|
130
|
+
return <ContenifyChatBot />
|
|
135
131
|
}
|
|
136
132
|
```
|
|
137
133
|
|
|
138
|
-
|
|
139
|
-
// app/layout.tsx (or app/page.tsx)
|
|
140
|
-
import ChatbotWrapper from '@/components/ChatbotWrapper'
|
|
134
|
+
### Import styles globally (optional)
|
|
141
135
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
<ChatbotWrapper />
|
|
148
|
-
</body>
|
|
149
|
-
</html>
|
|
150
|
-
)
|
|
151
|
-
}
|
|
136
|
+
Instead of importing styles in every file, add it once to `app/layout.tsx` or `pages/_app.tsx`:
|
|
137
|
+
|
|
138
|
+
```tsx
|
|
139
|
+
// app/layout.tsx
|
|
140
|
+
import '@contenify/chatbot/styles.css'
|
|
152
141
|
```
|
|
153
142
|
|
|
154
|
-
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## 7. Receive Published Articles
|
|
155
146
|
|
|
156
|
-
|
|
147
|
+
When a user clicks **Post** inside the editor, you can receive the article data in two ways:
|
|
148
|
+
|
|
149
|
+
### Option A — `onPost` prop
|
|
157
150
|
|
|
158
151
|
```tsx
|
|
159
|
-
// app/providers.tsx (or _app.tsx)
|
|
160
152
|
'use client'
|
|
161
153
|
|
|
162
|
-
import {
|
|
154
|
+
import { ContenifyChatBot } from '@contenify/chatbot'
|
|
163
155
|
import '@contenify/chatbot/styles.css'
|
|
164
156
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
157
|
+
export default function Editor() {
|
|
158
|
+
const handlePost = async (article: string, keywords: string[]) => {
|
|
159
|
+
// Send the article to your own API or CMS
|
|
160
|
+
await fetch('/api/publish', {
|
|
161
|
+
method: 'POST',
|
|
162
|
+
headers: { 'Content-Type': 'application/json' },
|
|
163
|
+
body: JSON.stringify({ article, keywords }),
|
|
164
|
+
})
|
|
165
|
+
}
|
|
170
166
|
|
|
171
|
-
|
|
172
|
-
return <ContenifyChatBot />
|
|
167
|
+
return <ContenifyChatBot onPost={handlePost} />
|
|
173
168
|
}
|
|
174
169
|
```
|
|
175
170
|
|
|
171
|
+
### Option B — DOM event listener
|
|
172
|
+
|
|
173
|
+
Listen for the `contenify-post-article` event on `window`. This is useful when you need to handle publishing outside of the React component tree:
|
|
174
|
+
|
|
175
|
+
```ts
|
|
176
|
+
window.addEventListener('contenify-post-article', (e: Event) => {
|
|
177
|
+
const detail = (e as CustomEvent).detail
|
|
178
|
+
|
|
179
|
+
console.log(detail.title) // Article title
|
|
180
|
+
console.log(detail.subtitle) // Subtitle
|
|
181
|
+
console.log(detail.article) // Full HTML content
|
|
182
|
+
console.log(detail.metaDescription) // Meta description
|
|
183
|
+
console.log(detail.slug) // URL slug (auto-generated, user-editable)
|
|
184
|
+
console.log(detail.keywords) // string[] of meta keywords
|
|
185
|
+
console.log(detail.featuredImage) // Image URL (if present)
|
|
186
|
+
})
|
|
187
|
+
```
|
|
188
|
+
|
|
176
189
|
---
|
|
177
190
|
|
|
178
|
-
##
|
|
191
|
+
## 8. Props Reference
|
|
192
|
+
|
|
193
|
+
All props are optional. The widget works out of the box using environment variables.
|
|
194
|
+
|
|
195
|
+
| Prop | Type | Description |
|
|
196
|
+
|---|---|---|
|
|
197
|
+
| `apiUrl` | `string` | Override the API base URL. Defaults to `NEXT_PUBLIC_CONTENIFY_API_URL`. |
|
|
198
|
+
| `apiKey` | `string` | Override the API key. Defaults to `NEXT_PUBLIC_API_KEY`. |
|
|
199
|
+
| `domain` | `string` | Override the domain. Defaults to `NEXT_PUBLIC_CONTENIFY_DOMAIN`. |
|
|
200
|
+
| `onPost` | `(article: string, keywords: string[]) => void` | Called when the user posts an article from the editor. |
|
|
201
|
+
|
|
202
|
+
### Passing props explicitly
|
|
179
203
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
204
|
+
If you prefer to pass values as props instead of using env vars:
|
|
205
|
+
|
|
206
|
+
```tsx
|
|
207
|
+
<ContenifyChatBot
|
|
208
|
+
apiUrl="https://api.contenifyai.cloud/api"
|
|
209
|
+
apiKey="your-api-key"
|
|
210
|
+
domain="yourdomain.com"
|
|
211
|
+
onPost={(article, keywords) => console.log(article, keywords)}
|
|
212
|
+
/>
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
**Priority order:** explicit prop > environment variable > built-in default.
|
|
189
216
|
|
|
190
217
|
---
|
|
191
218
|
|
|
192
|
-
##
|
|
219
|
+
## 9. Update Config at Runtime
|
|
193
220
|
|
|
194
|
-
|
|
221
|
+
Use `setConfig` to update the API URL, key, or domain at any point — for example, after a user logs in:
|
|
195
222
|
|
|
196
223
|
```ts
|
|
197
|
-
import
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
} from '@contenify/chatbot'
|
|
224
|
+
import { setConfig } from '@contenify/chatbot'
|
|
225
|
+
|
|
226
|
+
// After login
|
|
227
|
+
setConfig({ apiKey: 'user-specific-api-key' })
|
|
228
|
+
|
|
229
|
+
// Change environment dynamically
|
|
230
|
+
setConfig({
|
|
231
|
+
apiUrl: 'https://api.contenifyai.cloud/api',
|
|
232
|
+
apiKey: 'new-key',
|
|
233
|
+
domain: 'newdomain.com',
|
|
234
|
+
})
|
|
209
235
|
```
|
|
210
236
|
|
|
211
|
-
|
|
237
|
+
---
|
|
212
238
|
|
|
213
|
-
|
|
214
|
-
interface ContenifyChatBotProps {
|
|
215
|
-
apiUrl?: string
|
|
216
|
-
apiKey?: string
|
|
217
|
-
domain?: string
|
|
218
|
-
onPost?: (content: string, keywords: string[]) => void
|
|
219
|
-
}
|
|
239
|
+
## 10. What the Widget Can Do
|
|
220
240
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
style: 'news' | 'blog' | 'editorial' | 'summary'
|
|
224
|
-
wordCount: 'short' | 'medium' | 'long'
|
|
225
|
-
includeQuotes: boolean
|
|
226
|
-
includeFAQ: boolean
|
|
227
|
-
targetAudience: string
|
|
228
|
-
}
|
|
241
|
+
**Paste a URL**
|
|
242
|
+
Paste any news article URL into the chat. The widget fetches the content and presents action options.
|
|
229
243
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
}
|
|
244
|
+
**Available actions on a URL:**
|
|
245
|
+
- Recreate the article
|
|
246
|
+
- Write a blog post
|
|
247
|
+
- Create a summary
|
|
248
|
+
- Generate social media posts
|
|
249
|
+
- Write a newsletter
|
|
250
|
+
- Extract key points
|
|
238
251
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
252
|
+
**Type a topic**
|
|
253
|
+
Type any topic or text directly and the widget generates an article from scratch.
|
|
254
|
+
|
|
255
|
+
**Article editor features:**
|
|
256
|
+
- Rich text editor with live formatting
|
|
257
|
+
- SEO score with grade (A–F) and recommendations
|
|
258
|
+
- Auto-fix SEO issues with one click
|
|
259
|
+
- Edit title, subtitle, meta description, slug, and keywords
|
|
260
|
+
- Copy to clipboard
|
|
261
|
+
- Download as PDF or DOCX
|
|
262
|
+
- Post directly to your platform via `onPost`
|
|
263
|
+
|
|
264
|
+
**History panel**
|
|
265
|
+
Previously generated articles are saved locally and accessible from the history panel.
|
|
266
|
+
|
|
267
|
+
**News panel**
|
|
268
|
+
Browse trending news and news by source to use as inspiration.
|
|
247
269
|
|
|
248
270
|
---
|
|
249
271
|
|
|
250
|
-
##
|
|
272
|
+
## 11. Troubleshooting
|
|
251
273
|
|
|
252
|
-
|
|
274
|
+
**Widget shows an "Invalid API Key" modal**
|
|
253
275
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
276
|
+
- Check that `NEXT_PUBLIC_API_KEY` is set in your `.env` file
|
|
277
|
+
- Make sure you restarted your dev server after adding env vars
|
|
278
|
+
- Verify the key is active at [contenify.in/dashboard/api-keys](https://contenify.in/dashboard/api-keys)
|
|
279
|
+
|
|
280
|
+
**Styles are not loading**
|
|
281
|
+
|
|
282
|
+
Make sure you import the stylesheet:
|
|
283
|
+
|
|
284
|
+
```ts
|
|
285
|
+
import '@contenify/chatbot/styles.css'
|
|
258
286
|
```
|
|
259
287
|
|
|
260
|
-
|
|
288
|
+
**"use client" error in Next.js App Router**
|
|
289
|
+
|
|
290
|
+
Wrap the component in a client component as shown in [Step 6](#6-nextjs-setup).
|
|
261
291
|
|
|
262
|
-
|
|
292
|
+
**API requests failing (CORS or network errors)**
|
|
263
293
|
|
|
264
|
-
|
|
265
|
-
- A running Contenify backend with a valid API key
|
|
294
|
+
Confirm `NEXT_PUBLIC_CONTENIFY_API_URL` points to the correct backend URL and that the server allows requests from your domain.
|
|
266
295
|
|
|
267
296
|
---
|
|
268
297
|
|
package/dist/index.d.mts
CHANGED
|
@@ -42,6 +42,6 @@ interface ContenifyChatBotProps {
|
|
|
42
42
|
domain?: string;
|
|
43
43
|
onPost?: (content: string, keywords: string[]) => void;
|
|
44
44
|
}
|
|
45
|
-
declare function ContenifyChatBot({ apiUrl, apiKey, domain, onPost }: ContenifyChatBotProps): react_jsx_runtime.JSX.Element;
|
|
45
|
+
declare function ContenifyChatBot({ apiUrl, apiKey, domain, onPost, }: ContenifyChatBotProps): react_jsx_runtime.JSX.Element;
|
|
46
46
|
|
|
47
47
|
export { type AnalyzeInputResponse, ContenifyChatBot, type ContenifyChatBotProps, type ContentOption, type CreateContentPayload, type RecreateSettings, ContenifyChatBot as default, setConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -42,6 +42,6 @@ interface ContenifyChatBotProps {
|
|
|
42
42
|
domain?: string;
|
|
43
43
|
onPost?: (content: string, keywords: string[]) => void;
|
|
44
44
|
}
|
|
45
|
-
declare function ContenifyChatBot({ apiUrl, apiKey, domain, onPost }: ContenifyChatBotProps): react_jsx_runtime.JSX.Element;
|
|
45
|
+
declare function ContenifyChatBot({ apiUrl, apiKey, domain, onPost, }: ContenifyChatBotProps): react_jsx_runtime.JSX.Element;
|
|
46
46
|
|
|
47
47
|
export { type AnalyzeInputResponse, ContenifyChatBot, type ContenifyChatBotProps, type ContentOption, type CreateContentPayload, type RecreateSettings, ContenifyChatBot as default, setConfig };
|
package/dist/index.js
CHANGED
|
@@ -2897,10 +2897,25 @@ ${optionsList}` }) : m
|
|
|
2897
2897
|
|
|
2898
2898
|
// src/index.tsx
|
|
2899
2899
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
2900
|
-
function ContenifyChatBot({
|
|
2900
|
+
function ContenifyChatBot({
|
|
2901
|
+
apiUrl = process.env.NEXT_PUBLIC_CONTENIFY_API_URL,
|
|
2902
|
+
apiKey = process.env.NEXT_PUBLIC_API_KEY,
|
|
2903
|
+
domain = process.env.NEXT_PUBLIC_CONTENIFY_DOMAIN,
|
|
2904
|
+
onPost
|
|
2905
|
+
}) {
|
|
2901
2906
|
(0, import_react10.useEffect)(() => {
|
|
2902
2907
|
setConfig({ apiUrl, apiKey, domain });
|
|
2903
2908
|
}, [apiUrl, apiKey, domain]);
|
|
2909
|
+
(0, import_react10.useEffect)(() => {
|
|
2910
|
+
if (!onPost) return;
|
|
2911
|
+
const handler = (e) => {
|
|
2912
|
+
var _a, _b;
|
|
2913
|
+
const detail = e.detail;
|
|
2914
|
+
onPost((_a = detail.article) != null ? _a : "", (_b = detail.keywords) != null ? _b : []);
|
|
2915
|
+
};
|
|
2916
|
+
window.addEventListener("contenify-post-article", handler);
|
|
2917
|
+
return () => window.removeEventListener("contenify-post-article", handler);
|
|
2918
|
+
}, [onPost]);
|
|
2904
2919
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ChatBot, {});
|
|
2905
2920
|
}
|
|
2906
2921
|
var index_default = ContenifyChatBot;
|