@rhinon/botsdk-test 0.0.1

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 ADDED
@@ -0,0 +1,346 @@
1
+ # @rhinon/botsdk
2
+
3
+ A lightweight, framework-agnostic JavaScript SDK for integrating Rhinon chatbot into your web applications. Built with TypeScript and React, this SDK provides seamless chatbot integration across various platforms and frameworks.
4
+
5
+ <br>
6
+
7
+ ## Features
8
+
9
+ - 🚀 **Easy Integration** - Quick setup with just a few lines of code
10
+ - ⚛️ **Framework Support** - Works with React, Next.js, Angular, Vue, and vanilla JavaScript
11
+ - 🎨 **Customizable** - Configure appearance and behavior to match your brand
12
+ - 📱 **Responsive** - Mobile-friendly design that works on all devices
13
+ - 🔒 **Secure** - Built with security best practices
14
+ - 🌐 **SSR Compatible** - Full support for server-side rendering frameworks
15
+ - 💡 **TypeScript** - Full TypeScript support with type definitions
16
+ - ⚡ **Lightweight** - Minimal bundle size for optimal performance
17
+
18
+ <br>
19
+
20
+ ## Installation
21
+
22
+ Install the package using your preferred package manager:
23
+
24
+ ```bash
25
+ # using npm
26
+ npm install @rhinon/botsdk
27
+
28
+ # using yarn
29
+ yarn add @rhinon/botsdk
30
+
31
+ # using pnpm
32
+ pnpm add @rhinon/botsdk
33
+ ```
34
+
35
+ <br>
36
+
37
+ ## Quick Start
38
+
39
+ ### Basic Usage (Vanilla JavaScript)
40
+
41
+ ```javascript
42
+ import Rhinontech from '@rhinon/botsdk';
43
+
44
+ // Initialize when DOM is ready
45
+ document.addEventListener('DOMContentLoaded', () => {
46
+ Rhinontech({
47
+ app_id: 'YOUR_APP_ID',
48
+ chatbot_config: {
49
+ isBgFade: true
50
+ }
51
+ });
52
+ });
53
+ ```
54
+
55
+ <br>
56
+
57
+ ## Framework Integration
58
+
59
+ ### React
60
+
61
+ ```jsx
62
+ import { useEffect } from 'react';
63
+ import Rhinontech from '@rhinon/botsdk';
64
+
65
+ export default function Chatbot() {
66
+ useEffect(() => {
67
+ Rhinontech({
68
+ app_id: 'YOUR_APP_ID',
69
+ chatbot_config: {
70
+ isBgFade: true
71
+ }
72
+ });
73
+ }, []);
74
+
75
+ return null;
76
+ }
77
+ ```
78
+
79
+ <br>
80
+
81
+ ### Next.js
82
+
83
+ For Next.js applications, you need to handle SSR properly:
84
+
85
+ **Step 1:** Create a client component wrapper
86
+
87
+ ```tsx
88
+ // components/Chatbot/ChatbotWrapper.tsx
89
+ 'use client';
90
+
91
+ import dynamic from 'next/dynamic';
92
+
93
+ const Chatbot = dynamic(() => import('./Chatbot'), {
94
+ ssr: false,
95
+ });
96
+
97
+ export default function ChatbotWrapper() {
98
+ return <Chatbot />;
99
+ }
100
+ ```
101
+
102
+ **Step 2:** Create the main Chatbot component
103
+
104
+ ```tsx
105
+ // components/Chatbot/Chatbot.tsx
106
+ import { useEffect } from 'react';
107
+ import Rhinontech from '@rhinon/botsdk';
108
+
109
+ export default function Chatbot() {
110
+ useEffect(() => {
111
+ Rhinontech({
112
+ app_id: 'YOUR_APP_ID',
113
+ chatbot_config: {
114
+ isBgFade: true
115
+ }
116
+ });
117
+ }, []);
118
+
119
+ return null;
120
+ }
121
+ ```
122
+
123
+ **Step 3:** Add to your layout
124
+
125
+ ```tsx
126
+ // app/layout.tsx
127
+ import ChatbotWrapper from '@/components/Chatbot/ChatbotWrapper';
128
+
129
+ export default function RootLayout({
130
+ children,
131
+ }: {
132
+ children: React.ReactNode;
133
+ }) {
134
+ return (
135
+ <html lang="en">
136
+ <body>
137
+ {children}
138
+ <ChatbotWrapper />
139
+ </body>
140
+ </html>
141
+ );
142
+ }
143
+ ```
144
+
145
+ <br>
146
+
147
+ ### Angular
148
+
149
+ ```typescript
150
+ // app.component.ts
151
+ import { Component, AfterViewInit, PLATFORM_ID, Inject } from '@angular/core';
152
+ import { isPlatformBrowser } from '@angular/common';
153
+
154
+ @Component({
155
+ selector: 'app-root',
156
+ standalone: true,
157
+ template: '',
158
+ styleUrls: ['./app.component.css']
159
+ })
160
+ export class AppComponent implements AfterViewInit {
161
+ constructor(@Inject(PLATFORM_ID) private platformId: object) {}
162
+
163
+ ngAfterViewInit() {
164
+ if (isPlatformBrowser(this.platformId)) {
165
+ import('@rhinon/botsdk').then((RhinontechModule) => {
166
+ const Rhinontech = RhinontechModule.default;
167
+ Rhinontech({
168
+ app_id: 'YOUR_APP_ID',
169
+ chatbot_config: {
170
+ isBgFade: true
171
+ }
172
+ });
173
+ });
174
+ }
175
+ }
176
+ }
177
+ ```
178
+
179
+ <br>
180
+
181
+ ### Vue.js
182
+
183
+ ```vue
184
+ <template>
185
+ <div id="app">
186
+ <!-- Your app content -->
187
+ </div>
188
+ </template>
189
+
190
+ <script>
191
+ import { onMounted } from 'vue';
192
+ import Rhinontech from '@rhinon/botsdk';
193
+
194
+ export default {
195
+ name: 'App',
196
+ setup() {
197
+ onMounted(() => {
198
+ Rhinontech({
199
+ app_id: 'YOUR_APP_ID',
200
+ chatbot_config: {
201
+ isBgFade: true
202
+ }
203
+ });
204
+ });
205
+ }
206
+ }
207
+ </script>
208
+ ```
209
+
210
+ <br>
211
+
212
+ ## Configuration Options
213
+
214
+ The SDK accepts the following configuration options:
215
+
216
+ ```typescript
217
+ interface RhinontechConfig {
218
+ app_id: string; // Required: Your unique chatbot app ID
219
+ admin?: boolean; // Optional: Enable admin mode
220
+ container?: HTMLElement; // Optional: Custom container element
221
+ chatbot_config?: {
222
+ isBgFade?: boolean; // Optional: Enable background fade effect
223
+ // Add more config options as needed
224
+ };
225
+ }
226
+ ```
227
+
228
+ ### Basic Configuration
229
+
230
+ ```javascript
231
+ Rhinontech({
232
+ app_id: 'YOUR_APP_ID',
233
+ chatbot_config: {
234
+ isBgFade: true
235
+ }
236
+ });
237
+ ```
238
+
239
+ ### Advanced Configuration
240
+
241
+ ```javascript
242
+ Rhinontech({
243
+ app_id: 'YOUR_APP_ID',
244
+ admin: false,
245
+ container: document.getElementById('custom-container'),
246
+ chatbot_config: {
247
+ isBgFade: true
248
+ }
249
+ });
250
+ ```
251
+
252
+ <br>
253
+
254
+ ## API Reference
255
+
256
+ ### `Rhinontech(config: RhinontechConfig): ChatBotElement`
257
+
258
+ Initializes and returns a chatbot instance.
259
+
260
+ **Parameters:**
261
+ - `config` (RhinontechConfig): Configuration object for the chatbot
262
+
263
+ **Returns:**
264
+ - `ChatBotElement`: The chatbot custom element instance
265
+
266
+ <br>
267
+
268
+ ## Browser Support
269
+
270
+ - Chrome (latest)
271
+ - Firefox (latest)
272
+ - Safari (latest)
273
+ - Edge (latest)
274
+ - Opera (latest)
275
+
276
+ <br>
277
+
278
+ ## TypeScript Support
279
+
280
+ This package includes TypeScript type definitions. No additional `@types` package is required.
281
+
282
+ ```typescript
283
+ import Rhinontech, { RhinontechConfig, ChatBotElement } from '@rhinon/botsdk';
284
+
285
+ const config: RhinontechConfig = {
286
+ app_id: 'YOUR_APP_ID',
287
+ chatbot_config: {
288
+ isBgFade: true
289
+ }
290
+ };
291
+
292
+ const chatbot: ChatBotElement = Rhinontech(config);
293
+ ```
294
+
295
+ <br>
296
+
297
+ ## Troubleshooting
298
+
299
+ ### SSR/Next.js Issues
300
+
301
+ If you encounter `HTMLElement is not defined` or similar errors:
302
+
303
+ 1. Ensure you're using dynamic imports with `ssr: false`
304
+ 2. Wrap the initialization in `useEffect` or equivalent lifecycle method
305
+ 3. Use the `'use client'` directive for Next.js App Router
306
+
307
+ ### Chatbot Not Appearing
308
+
309
+ 1. Verify your `app_id` is correct
310
+ 2. Check browser console for errors
311
+ 3. Ensure the SDK is initialized after DOM is loaded
312
+ 4. Check if there are any CSP (Content Security Policy) restrictions
313
+
314
+ <br>
315
+
316
+ ## Examples
317
+
318
+ Check out our [examples repository](https://github.com/rhinontech/botsdk-examples) for complete implementation examples in various frameworks.
319
+
320
+ <br>
321
+
322
+ ## Support
323
+
324
+ For issues, questions, or contributions:
325
+
326
+ - 📧 Email: support@rhinontech.com
327
+ - 🐛 Issues: [GitHub Issues](https://github.com/rhinontech/botsdk/issues)
328
+ - 📚 Documentation: [docs.rhinontech.com](https://docs.rhinontech.com)
329
+
330
+ <br>
331
+
332
+ ## License
333
+
334
+ MIT License - see [LICENSE](LICENSE) file for details
335
+
336
+ <br>
337
+
338
+ ## Contributing
339
+
340
+ Contributions are welcome! Please read our [Contributing Guide](CONTRIBUTING.md) for details on our code of conduct and the process for submitting pull requests.
341
+
342
+ <br>
343
+
344
+ ---
345
+
346
+ Made with ❤️ by [Rhinon Tech](https://rhinontech.com)
@@ -0,0 +1 @@
1
+ <!doctype html><html style="background-color: rgb(255, 255, 255);"><head><meta charset="UTF-8"/><title>React Webpack Typescript</title><style></style><script defer="defer" src="rhinonbot.js"></script></head><body><div id="app"></div></body></html>