@cognitiondesk/widget 1.2.0 → 1.2.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Lucilo del Castillo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,101 +1,2 @@
1
- # @cognitiondesk/widget
1
+ # cognitiondesk_npm_package
2
2
 
3
- Embed a CognitionDesk AI chat widget into any website with a single API key.
4
-
5
- ## Installation
6
-
7
- ```bash
8
- npm install @cognitiondesk/widget
9
- ```
10
-
11
- ## Quick start — React
12
-
13
- ```jsx
14
- import { CognitionDeskWidget } from '@cognitiondesk/widget/react';
15
-
16
- export default function App() {
17
- return (
18
- <>
19
- {/* your app */}
20
- <CognitionDeskWidget
21
- apiKey="YOUR_API_KEY"
22
- assistantId="YOUR_ASSISTANT_ID" // optional
23
- theme="light" // 'light' | 'dark' | 'auto'
24
- primaryColor="#2563eb"
25
- botName="Support Bot"
26
- welcomeMessage="Hello! How can I help you today?"
27
- />
28
- </>
29
- );
30
- }
31
- ```
32
-
33
- ## Quick start — Vanilla JS
34
-
35
- ```js
36
- import { CognitionDeskWidget } from '@cognitiondesk/widget';
37
-
38
- const widget = new CognitionDeskWidget({
39
- apiKey: 'YOUR_API_KEY',
40
- assistantId: 'YOUR_ASSISTANT_ID',
41
- });
42
- widget.mount(); // appends to document.body
43
- ```
44
-
45
- ## Script tag (CDN)
46
-
47
- ```html
48
- <!-- Auto-init via data attributes -->
49
- <script
50
- src="https://cdn.jsdelivr.net/npm/@cognitiondesk/widget/dist/widget.umd.cjs"
51
- data-api-key="YOUR_API_KEY"
52
- data-assistant-id="YOUR_ASSISTANT_ID"
53
- data-theme="light"
54
- ></script>
55
-
56
- <!-- Or manual init -->
57
- <script src="https://cdn.jsdelivr.net/npm/@cognitiondesk/widget/dist/widget.umd.cjs"></script>
58
- <script>
59
- CognitionDesk.init({ apiKey: 'YOUR_API_KEY' });
60
- </script>
61
- ```
62
-
63
- ## API Keys
64
-
65
- Generate and manage API keys in your [CognitionDesk dashboard](https://app.cognitiondesk.com/dashboard/api-keys).
66
-
67
- Each API key is scoped to your account and used to:
68
- - Authenticate widget requests to the AI backend
69
- - Track usage against your plan quotas
70
- - Associate conversations with the correct assistant
71
-
72
- ## Configuration options
73
-
74
- | Prop | Type | Default | Description |
75
- |---|---|---|---|
76
- | `apiKey` | `string` | **required** | Your CognitionDesk API key |
77
- | `assistantId` | `string` | `undefined` | Specific assistant to use (uses account default otherwise) |
78
- | `theme` | `'light'│'dark'│'auto'` | `'light'` | Color scheme |
79
- | `primaryColor` | `string` | `'#2563eb'` | Brand accent color (CSS color) |
80
- | `botName` | `string` | `'AI Assistant'` | Name shown in the widget header |
81
- | `botEmoji` | `string` | `'🤖'` | Avatar emoji shown in the header |
82
- | `welcomeMessage` | `string` | `'Hello! How can I help you today?'` | First message shown to the user |
83
- | `placeholder` | `string` | `'Type a message…'` | Input placeholder |
84
- | `defaultOpen` | `boolean` | `false` | Open the widget on load *(React only)* |
85
- | `backendUrl` | `string` | auto | Override backend URL (self-hosted setups) |
86
-
87
- ## Widget methods (vanilla JS)
88
-
89
- ```js
90
- const widget = new CognitionDeskWidget({ apiKey: '...' });
91
- widget.mount(); // mount to DOM
92
- widget.open(); // programmatically open
93
- widget.close(); // close
94
- widget.toggle(); // toggle open/close
95
- widget.clearHistory(); // reset conversation
96
- widget.unmount(); // remove from DOM
97
- ```
98
-
99
- ## License
100
-
101
- MIT