@tarxemo/customer_support 1.2.11 → 1.2.13

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 (2) hide show
  1. package/README.md +150 -17
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -31,7 +31,40 @@ yarn add @tarxemo/customer_support
31
31
 
32
32
  ## 🚀 Quick Start
33
33
 
34
- ### Basic Usage
34
+ ### Step 1: Get Your API Key
35
+
36
+ Before using the library, you need to set up your website in the SiteWise console:
37
+
38
+ 1. **Visit the Console**: Go to [https://servicesconsole.tarxemo.com](https://servicesconsole.tarxemo.com)
39
+ 2. **Sign Up**: Create a new account and verify your email
40
+ 3. **Create Organization**: You'll be prompted to create an organization (e.g., "My Company")
41
+ 4. **Add Your Website**:
42
+ - Navigate to "Websites" in the console
43
+ - Click "Add Website"
44
+ - Enter your website name and URL (e.g., "https://mycompany.com")
45
+ - Submit the form
46
+ 5. **Crawl Your Website**:
47
+ - On your website card, click "Start Crawl"
48
+ - Wait for the crawl to complete (status: `PENDING` → `CRAWLING` → `READY`)
49
+ 6. **Generate API Key**:
50
+ - Go to "API Keys" section
51
+ - Click "Create API Key"
52
+ - Select your website and set rate limits
53
+ - **Copy the API key immediately** (shown only once!)
54
+
55
+ ### Step 2: Install the Library
56
+
57
+ ```bash
58
+ npm install @tarxemo/customer_support
59
+ ```
60
+
61
+ or with yarn:
62
+
63
+ ```bash
64
+ yarn add @tarxemo/customer_support
65
+ ```
66
+
67
+ ### Step 3: Add to Your React App
35
68
 
36
69
  ```tsx
37
70
  import { CustomerSupportWidget } from '@tarxemo/customer_support';
@@ -41,17 +74,27 @@ function App() {
41
74
  return (
42
75
  <div>
43
76
  <h1>My Website</h1>
44
- {/* Your content */}
77
+ {/* Your existing content */}
45
78
 
46
79
  <CustomerSupportWidget
47
- apiKey="your-sitewise-api-key"
80
+ apiKey="your-sitewise-api-key-here"
81
+ position="bottom-right"
82
+ theme={{
83
+ primaryColor: '#6366f1',
84
+ secondaryColor: '#8b5cf6',
85
+ backgroundColor: '#ffffff',
86
+ textColor: '#1f2937',
87
+ borderRadius: '16px',
88
+ }}
89
+ welcomeMessage="Welcome! How can we help you today?"
90
+ placeholder="Ask us anything about our products or services..."
48
91
  />
49
92
  </div>
50
93
  );
51
94
  }
52
95
  ```
53
96
 
54
- That's it! The chat widget will appear in the bottom-right corner of your page.
97
+ That's it! The chat widget will appear in the bottom-right corner of your page, ready to answer questions about your website content.
55
98
 
56
99
  ## 📖 API Reference
57
100
 
@@ -60,7 +103,6 @@ That's it! The chat widget will appear in the bottom-right corner of your page.
60
103
  | Prop | Type | Default | Description |
61
104
  |------|------|---------|-------------|
62
105
  | `apiKey` | `string` | **required** | Your SiteWise API key |
63
- | `baseUrl` | `string` | `http://localhost:8000/api` | SiteWise API base URL |
64
106
  | `theme` | `ThemeConfig` | - | Custom theme configuration |
65
107
  | `position` | `Position` | `'bottom-right'` | Widget position |
66
108
  | `welcomeMessage` | `string` | `'Hi! How can I help you today?'` | Initial welcome message |
@@ -109,6 +151,24 @@ interface ThemeConfig {
109
151
  />
110
152
  ```
111
153
 
154
+ ### Using Environment Variables for API Key
155
+
156
+ ```tsx
157
+ <CustomerSupportWidget
158
+ apiKey={import.meta.env.VITE_SITEWISE_API_KEY || 'fallback-key'}
159
+ position="bottom-right"
160
+ theme={{
161
+ primaryColor: '#6366f1',
162
+ secondaryColor: '#8b5cf6',
163
+ backgroundColor: '#ffffff',
164
+ textColor: '#1f2937',
165
+ borderRadius: '16px',
166
+ }}
167
+ welcomeMessage="Welcome to your website! How can we help you today?"
168
+ placeholder="Ask us anything about our products or services..."
169
+ />
170
+ ```
171
+
112
172
  ### Custom Position and Welcome Message
113
173
 
114
174
  ```tsx
@@ -223,23 +283,95 @@ export default function RootLayout({ children }) {
223
283
 
224
284
  ## 🔐 Getting an API Key
225
285
 
226
- 1. Sign up for SiteWise at your SiteWise instance
227
- 2. Register your website
228
- 3. Trigger a crawl of your website content
229
- 4. Generate an API key for your website
230
- 5. Use the API key in the widget configuration
286
+ Follow these steps to get your API key from the SiteWise console:
287
+
288
+ ### 1. Create Your Account
289
+ 1. Visit **[https://servicesconsole.tarxemo.com](https://servicesconsole.tarxemo.com)**
290
+ 2. Click **"Register"** and create your account
291
+ 3. Verify your email address
292
+
293
+ ### 2. Set Up Your Organization
294
+ - After registration, you'll be automatically prompted to create an organization
295
+ - Enter your organization name (e.g., "My Company")
296
+ - Click **"Create Organization"**
297
+
298
+ ### 3. Register Your Website
299
+ 1. Navigate to the **"Websites"** section in the console
300
+ 2. Click **"Add Website"**
301
+ 3. Fill in the details:
302
+ - **Name**: Your website name (e.g., "My Company Website")
303
+ - **URL**: Your website base URL (e.g., "https://mycompany.com")
304
+ - **Crawl Settings**: Keep defaults for now
305
+ 4. Click **"Submit"**
306
+
307
+ ### 4. Crawl Your Website
308
+ 1. On your website card, click **"Start Crawl"**
309
+ 2. Wait for the crawl to complete (status will change from `PENDING` → `CRAWLING` → `READY`)
310
+ 3. You'll see statistics like pages crawled and chunks created
311
+
312
+ ### 5. Generate API Key
313
+ 1. Navigate to the **"API Keys"** section
314
+ 2. Click **"Create API Key"**
315
+ 3. Select your website from the dropdown
316
+ 4. Set a rate limit (optional, default: 100 requests/minute)
317
+ 5. Click **"Generate"**
318
+ 6. **⚠️ IMPORTANT**: Copy the API key immediately - it's shown only once!
319
+
320
+ ### 6. Test Your API Key
321
+ ```bash
322
+ curl -X POST https://api.tarxemo.com/api/chat/ \
323
+ -H "X-API-Key: YOUR_API_KEY_HERE" \
324
+ -H "Content-Type: application/json" \
325
+ -d '{"question": "What services do you offer?"}'
326
+ ```
327
+
328
+ Once you have your API key, you can use it in the widget configuration as shown in the Quick Start section.
231
329
 
232
330
  ## 🌐 Production Deployment
233
331
 
234
- For production, set the `baseUrl` to your SiteWise API:
332
+ For production deployment, always use environment variables for your API key:
235
333
 
334
+ ### React (Create React App)
236
335
  ```tsx
336
+ // .env file
337
+ REACT_APP_SITEWISE_API_KEY=your-production-api-key
338
+
339
+ // In your component
237
340
  <CustomerSupportWidget
238
341
  apiKey={process.env.REACT_APP_SITEWISE_API_KEY}
239
- baseUrl="https://api.yourdomain.com/api"
240
342
  />
241
343
  ```
242
344
 
345
+ ### Next.js
346
+ ```tsx
347
+ // .env.local file
348
+ NEXT_PUBLIC_SITEWISE_API_KEY=your-production-api-key
349
+
350
+ // In your component
351
+ <CustomerSupportWidget
352
+ apiKey={process.env.NEXT_PUBLIC_SITEWISE_API_KEY}
353
+ />
354
+ ```
355
+
356
+ ### Vite
357
+ ```tsx
358
+ // .env file
359
+ VITE_SITEWISE_API_KEY=your-production-api-key
360
+
361
+ // In your component
362
+ <CustomerSupportWidget
363
+ apiKey={import.meta.env.VITE_SITEWISE_API_KEY}
364
+ />
365
+ ```
366
+
367
+ ### Production Checklist
368
+ - [ ] Use environment variables for API keys (never hardcode)
369
+ - [ ] Test with your production API key
370
+ - [ ] Verify your website crawl is completed in the console
371
+ - [ ] Monitor API usage and rate limits
372
+ - [ ] Test on mobile devices
373
+ - [ ] Check console for any errors
374
+
243
375
  ## 📱 Mobile Support
244
376
 
245
377
  The widget is fully responsive and automatically adjusts to mobile screens:
@@ -302,12 +434,13 @@ For issues and questions:
302
434
 
303
435
  ## 🔗 Links
304
436
 
305
- - [NPM Package](https://www.npmjs.com/package/@tarxemo/customer_support)
306
- - [GitHub Repository](https://github.com/tarxemo/customer_support)
307
- - [SiteWise Platform](https://github.com/yourusername/sitewise)
437
+ - **NPM Package**: https://www.npmjs.com/package/@tarxemo/customer_support
438
+ - **GitHub Repository**: https://github.com/tarxemo/customer_support
439
+ - **SiteWise Console**: https://servicesconsole.tarxemo.com
440
+ - **API Documentation**: Available in the SiteWise console after login
441
+ - **User Guide**: Complete step-by-step integration guide
442
+ - **Developer Guide**: Advanced API reference and customization
308
443
 
309
444
  ---
310
445
 
311
446
  Made with ❤️ by Tarxemo
312
- # custom_support
313
- # custom_support
package/package.json CHANGED
@@ -51,7 +51,7 @@
51
51
  "url": "https://github.com/tarxemo/customer_support/issues"
52
52
  },
53
53
  "homepage": "https://github.com/tarxemo/customer_support#readme",
54
- "version": "1.2.11",
54
+ "version": "1.2.13",
55
55
  "peerDependencies": {
56
56
  "react": "^18.0.0 || ^19.0.0",
57
57
  "react-dom": "^18.0.0 || ^19.0.0",