cindy-ai-chatbot 1.0.14

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.
Files changed (31) hide show
  1. package/README.md +184 -0
  2. package/dist/css/cindy-chatbot.css +4 -0
  3. package/dist/css/fonts/InterVariable-Italic.woff2 +0 -0
  4. package/dist/css/fonts/InterVariable.woff2 +0 -0
  5. package/dist/css/fonts/primeicons.eot +0 -0
  6. package/dist/css/fonts/primeicons.svg +345 -0
  7. package/dist/css/fonts/primeicons.ttf +0 -0
  8. package/dist/css/fonts/primeicons.woff +0 -0
  9. package/dist/css/fonts/primeicons.woff2 +0 -0
  10. package/dist/esm/types/components/AiDialogHeader/index.d.ts +14 -0
  11. package/dist/esm/types/components/AnswerContainer/index.d.ts +20 -0
  12. package/dist/esm/types/components/Chatbot/index.d.ts +21 -0
  13. package/dist/esm/types/components/CindyChatBot.d.ts +42 -0
  14. package/dist/esm/types/components/Graph/Echart/BarEchart/index.d.ts +8 -0
  15. package/dist/esm/types/components/Graph/Echart/DonutEchart/index.d.ts +8 -0
  16. package/dist/esm/types/components/Graph/Echart/LineEchart/index.d.ts +8 -0
  17. package/dist/esm/types/components/Graph/Echart/PieEchart/index.d.ts +8 -0
  18. package/dist/esm/types/components/LoadingContainer/index.d.ts +3 -0
  19. package/dist/esm/types/components/QuestionContainer/index.d.ts +7 -0
  20. package/dist/esm/types/config/http-common.d.ts +15 -0
  21. package/dist/esm/types/lib/index.d.ts +10 -0
  22. package/dist/esm/types/providers/AIBotProvider.d.ts +77 -0
  23. package/dist/esm/types/providers/AuthContext.d.ts +55 -0
  24. package/dist/esm/types/providers/PrimeReactProvider.d.ts +6 -0
  25. package/dist/esm/types/providers/ToastProvider.d.ts +11 -0
  26. package/dist/index.d.ts +36 -0
  27. package/dist/index.esm.js +15 -0
  28. package/dist/index.esm.js.map +1 -0
  29. package/dist/index.js +15 -0
  30. package/dist/index.js.map +1 -0
  31. package/package.json +123 -0
package/README.md ADDED
@@ -0,0 +1,184 @@
1
+ ## Cindy ChatBot
2
+
3
+ An AI-powered chatbot component for React applications.
4
+
5
+ ## Installation
6
+
7
+ ### Using npm
8
+
9
+ ```plaintext
10
+ npm install chatbot-cindy
11
+ ```
12
+
13
+ ### Using yarn
14
+
15
+ ```plaintext
16
+ yarn add chatbot-cindy
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ ### React Applications
22
+
23
+ #### Basic Usage
24
+
25
+ ```plaintext
26
+ import React from 'react';
27
+ import { CindyChatBot } from 'chatbot-cindy';
28
+
29
+ // Import required styles
30
+ import 'primereact/resources/themes/lara-light-indigo/theme.css';
31
+ import 'primereact/resources/primereact.min.css';
32
+ import 'primeicons/primeicons.css';
33
+ import 'primeflex/primeflex.css';
34
+ import 'chatbot-cindy/dist/css/cindy-chatbot.css';
35
+
36
+ function App() {
37
+ return (
38
+ <div classname="App">
39
+ <cindychatbot baseurl="{process.env.REACT_APP_CINDY_BASE_URL" ||="" ''}="" orgid="{process.env.REACT_APP_CINDY_ORG_ID" projectid="{process.env.REACT_APP_CINDY_PROJECT_ID" doctype="{process.env.REACT_APP_CINDY_DOC_TYPE" apptype="{process.env.REACT_APP_CINDY_APP_TYPE" accesstokenkey="{process.env.REACT_APP_CINDY_ACCESS_TOKEN_KEY" logoutroute="{process.env.REACT_APP_CINDY_LOGOUT_ROUTE" '="" logout="" '}="" checktokenroute="{process.env.REACT_APP_CINDY_CHECK_TOKEN_ROUTE"}="">
40
+ </cindychatbot></div>
41
+ );
42
+ }
43
+
44
+ export default App;
45
+ ```
46
+
47
+ #### Advanced Usage with Custom Props
48
+
49
+ ```plaintext
50
+ import React from 'react';
51
+ import { CindyChatBot } from 'chatbot-cindy';
52
+
53
+ // Import required styles
54
+ import 'primereact/resources/themes/lara-light-indigo/theme.css';
55
+ import 'primereact/resources/primereact.min.css';
56
+ import 'primeicons/primeicons.css';
57
+ import 'primeflex/primeflex.css';
58
+ import 'chatbot-cindy/dist/css/cindy-chatbot.css';
59
+
60
+ // Define custom graph items
61
+ const CUSTOM_GRAPHS = [
62
+ { name: "Bar Chart", code: "bar", type: "g1" },
63
+ { name: "Donut Chart", code: "donut", type: "g2" },
64
+ { name: "Pie", code: "pie", type: "g4" },
65
+ ];
66
+
67
+ function App() {
68
+ return (
69
+ <div classname="App">
70
+ <cindychatbot baseurl="https://api.example.com" orgid="your-org-id" projectid="your-project-id" doctype="your-doc-type" apptype="your-app-type" accesstokenkey="your-access-token-key" logoutroute="/custom-logout/" checktokenroute="/api/v1/custom/refresh" graphitems="{CUSTOM_GRAPHS}" aiiconsrc="/path/to/custom-icon.svg" cindylogosrc="/path/to/custom-logo.svg" cindylogoheight="{60}" cindylogowidth="{60}" cindylogoalt="Custom AI Logo" headertitle="Custom AI Bot" headersubtitle="Your AI Assistant" helptext="This is a custom AI assistant. Ask me anything!">
71
+ </cindychatbot></div>
72
+ );
73
+ }
74
+
75
+ export default App;
76
+ ```
77
+
78
+ ### Environment Variables
79
+
80
+ For the basic setup, you can configure the chatbot using environment variables:
81
+
82
+ REACT\_APP\_CINDY\_BASE\_URL=https://api.example.com
83
+
84
+ ## Available Props
85
+
86
+ | Prop Name | Type | Default | Description |
87
+ | --- | --- | --- | --- |
88
+ | graphItems | Array | `[{ name: "Bar Chart", code: "bar", type: "g1" }, { name: "Donut Chart", code: "donut", type: "g2" }, { name: "Pie", code: "pie", type: "g4" }, { name: "Line", code: "line", type: "g5" }]` | Array of graph types available in the chatbot |
89
+ | aiIconSrc | String | "/images/ai-icon.svg" | Path to the AI icon image |
90
+ | cindyLogoSrc | String | "/images/cindy-white.svg" | Path to the Cindy logo image |
91
+ | cindyLogoHeight | Number | 54 | Height of the Cindy logo |
92
+ | cindyLogoWidth | Number | 54 | Width of the Cindy logo |
93
+ | cindyLogoAlt | String | "Ai Icon" | Alt text for the Cindy logo |
94
+ | expandedStyle | Object | `{ width: "80%", height: "100vh", maxHeight: "100%", margin: "0px" }` | Style for expanded chatbot view |
95
+ | dialogStyle | Object | `{ width: "523px", height: "684px" }` | Style for dialog chatbot view |
96
+ | position | String | "bottom-right" | Position of the chatbot icon |
97
+ | dialogContentClassName | String | "p-0 border-round-top-sm" | Class name for dialog content |
98
+ | headerStyle | String | "p-4 flex align-items-center justify-content-between fixed h-\[86px\] bg-\[#18279A\] z-\[1\]" | Style for the header |
99
+ | headerTitle | String | "Cindy.ai" | Title displayed in the header |
100
+ | headerSubtitle | String | "Gen AI Companion" | Subtitle displayed in the header |
101
+ | headerTitleStyle | String | "m-0 text-xl font-bold text-\[#FCFCFD\]" | Style for the header title |
102
+ | headerSubtitleStyle | String | "m-0 text-base text-\[#FCFCFD\]" | Style for the header subtitle |
103
+ | helpText | String | "The response is AI-generated and should be independently verified for accuracy." | Help text displayed in the chatbot |
104
+
105
+ ## Styling
106
+
107
+ ### Required CSS Imports
108
+
109
+ For both React and Vue.js applications, you need to import the following CSS files:
110
+
111
+ ```plaintext
112
+ // Import required styles
113
+ import 'primereact/resources/themes/lara-light-indigo/theme.css';
114
+ import 'primereact/resources/primereact.min.css';
115
+ import 'primeicons/primeicons.css';
116
+ import 'primeflex/primeflex.css';
117
+ import 'chatbot-cindy/dist/css/cindy-chatbot.css';
118
+ ```
119
+
120
+ ### Troubleshooting Font Issues
121
+
122
+ If you encounter font loading issues, make sure:
123
+
124
+ 1. You've imported all the required CSS files as shown above
125
+ 2. Your bundler is configured to handle font files (if you're using webpack, ensure you have the appropriate loaders)
126
+ 3. The fonts directory is accessible in your deployed application
127
+
128
+ #### Webpack Configuration for Fonts
129
+
130
+ If you're using webpack, ensure you have the appropriate loaders for font files:
131
+
132
+ ```javascript
133
+ module.exports = {
134
+ // ...
135
+ module: {
136
+ rules: [
137
+ // ...
138
+ {
139
+ test: /\.(woff|woff2|eot|ttf|otf)$/,
140
+ type: 'asset/resource',
141
+ generator: {
142
+ filename: 'fonts/[name][ext]'
143
+ }
144
+ }
145
+ ]
146
+ }
147
+ };
148
+ ```
149
+
150
+ ## How It Works
151
+
152
+ **Centralized CSS Imports**: By moving all CSS imports to the library entry point, you ensure they're properly processed by your bundler.
153
+
154
+ **Rollup Configuration**: The package's rollup.config.js is set up to extract CSS with:
155
+
156
+ **Font Handling**: The package includes all necessary font files and properly references them in the CSS.
157
+
158
+ This approach ensures that:
159
+
160
+ * CSS is properly bundled and extracted
161
+ * Font files are included and properly referenced
162
+ * Users know they need to import the CSS
163
+ * The component itself doesn't have redundant imports that might cause issues
164
+
165
+ ## Browser Support
166
+
167
+ The component is compatible with all modern browsers:
168
+
169
+ * Chrome (latest)
170
+ * Firefox (latest)
171
+ * Safari (latest)
172
+ * Edge (latest)
173
+
174
+ ## License
175
+
176
+ MIT
177
+
178
+ ```javascript
179
+ postcss({
180
+ extensions: ['.css', '.scss'],
181
+ minimize: true,
182
+ extract: 'css/cindy-chatbot.css',
183
+ }),
184
+ ```