@skywu/virtual-chat-sdk 1.7.14 → 1.9.0

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 CHANGED
@@ -1,13 +1,14 @@
1
- # @virtual-chat/sdk
1
+ # @skywu/virtual-chat-sdk
2
2
 
3
- [![npm version](https://badge.fury.io/js/%40virtual-chat%2Fsdk.svg)](https://badge.fury.io/js/%40virtual-chat%2Fsdk)
3
+ [![npm version](https://badge.fury.io/js/%40skywu%2Fvirtual-chat-sdk.svg)](https://badge.fury.io/js/%40skywu%2Fvirtual-chat-sdk)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
5
 
6
- A modern JavaScript/TypeScript SDK for embedding floating chat widgets into web applications. Features real-time messaging, virtual chat simulations, and seamless integration.
6
+ A modern JavaScript/TypeScript SDK for embedding floating chat widgets into web applications. Features real-time messaging, virtual chat simulations, **20+ languages support**, and seamless integration.
7
7
 
8
8
  ## ✨ Features
9
9
 
10
10
  - 🎈 **Floating Button Mode** - Non-intrusive chat widget with smooth expand/collapse animations
11
+ - 🌍 **20+ Languages** - Built-in i18n support (English, 简体中文, 繁體中文, Español, हिन्दी, العربية, Português, Deutsch, 日本語, 한국어, Français, Русский, Italiano, Türkçe, Polski, Tiếng Việt, ไทย, Bahasa Indonesia, Nederlands, and more)
11
12
  - 🎨 **Multiple UI Templates** - WhatsApp and Telegram-style themes with dark mode support
12
13
  - ⚡ **Real-time Communication** - WebSocket-based messaging with automatic reconnection
13
14
  - 📱 **Responsive Design** - Optimized for desktop, tablet, and mobile devices
@@ -22,13 +23,13 @@ A modern JavaScript/TypeScript SDK for embedding floating chat widgets into web
22
23
 
23
24
  ```bash
24
25
  # npm
25
- npm install @virtual-chat/sdk
26
+ npm install @skywu/virtual-chat-sdk
26
27
 
27
28
  # yarn
28
- yarn add @virtual-chat/sdk
29
+ yarn add @skywu/virtual-chat-sdk
29
30
 
30
31
  # pnpm
31
- pnpm add @virtual-chat/sdk
32
+ pnpm add @skywu/virtual-chat-sdk
32
33
  ```
33
34
 
34
35
  ### CDN (Browser)
@@ -200,7 +201,7 @@ const chat = ChatSDK.init({
200
201
  | `templateId` | `string` | `undefined` | Specific template to load (uses project default if not specified) |
201
202
  | `userId` | `string` | Auto-generated | Unique user identifier |
202
203
  | `username` | `string` | Auto-generated | Display name for the user |
203
- | `language` | `string` | `'en'` | Language code (en, zh, es, fr, de, ja, ko, etc.) |
204
+ | `language` | `string` | `'en'` | Language code: `'en'`, `'zh'`, `'zh-TW'`, `'es'`, `'hi'`, `'ar'`, `'pt'`, `'de'`, `'ja'`, `'ko'`, `'fr'`, `'ru'`, `'it'`, `'tr'`, `'pl'`, `'vi'`, `'th'`, `'id'`, `'nl'` |
204
205
  | `theme` | `'light' \| 'dark' \| 'auto'` | `'light'` | UI theme |
205
206
  | `uiTemplate` | `'whatsapp' \| 'telegram' \| 'discord' \| 'slack'` | `'whatsapp'` | Chat UI style |
206
207
  | `width` | `string \| number` | `'400px'` | Widget width |
@@ -343,23 +344,35 @@ const chat = ChatSDK.init({
343
344
  });
344
345
  ```
345
346
 
346
- ### Multi-language Support
347
+ ### Multi-language Support (20+ Languages)
347
348
 
348
349
  ```javascript
349
350
  const chat = ChatSDK.init({
350
351
  container: '#chat',
351
352
  projectId: 'support-chat',
352
- language: 'en' // Start with English
353
+ language: 'en', // Start with English
354
+ mode: 'floating'
353
355
  });
354
356
 
355
- // Language switcher
357
+ // Language switcher - dynamically change UI language
356
358
  document.getElementById('lang-zh').addEventListener('click', () => {
357
- chat.setLanguage('zh');
359
+ chat.setLanguage('zh'); // 简体中文
358
360
  });
359
361
 
360
362
  document.getElementById('lang-es').addEventListener('click', () => {
361
- chat.setLanguage('es');
363
+ chat.setLanguage('es'); // Español
362
364
  });
365
+
366
+ document.getElementById('lang-ar').addEventListener('click', () => {
367
+ chat.setLanguage('ar'); // العربية (RTL support)
368
+ });
369
+
370
+ // Supported languages:
371
+ // 'en' (English), 'zh' (简体中文), 'zh-TW' (繁體中文), 'es' (Español),
372
+ // 'hi' (हिन्दी), 'ar' (العربية), 'pt' (Português), 'de' (Deutsch),
373
+ // 'ja' (日本語), 'ko' (한국어), 'fr' (Français), 'ru' (Русский),
374
+ // 'it' (Italiano), 'tr' (Türkçe), 'pl' (Polski), 'vi' (Tiếng Việt),
375
+ // 'th' (ไทย), 'id' (Bahasa Indonesia), 'nl' (Nederlands)
363
376
  ```
364
377
 
365
378
  ### Event-driven Integration
@@ -406,11 +419,13 @@ const chat = ChatSDK.init({
406
419
  The SDK includes full TypeScript definitions:
407
420
 
408
421
  ```typescript
409
- import { ChatSDK, ChatSDKConfig, ChatMessage } from '@virtual-chat/sdk';
422
+ import { ChatSDK, ChatSDKConfig, ChatMessage } from '@skywu/virtual-chat-sdk';
410
423
 
411
424
  const config: ChatSDKConfig = {
412
425
  container: '#chat',
413
426
  projectId: 'my-project',
427
+ language: 'zh', // 简体中文
428
+ mode: 'floating',
414
429
  onMessage: (message: ChatMessage) => {
415
430
  console.log(message.content);
416
431
  }