emanate-ai-chat-lib 0.1.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,409 @@
1
+ # Emanate AI Chat Library
2
+
3
+ A powerful, reusable Angular library for integrating AI chat functionality with **modern UI design**, **resizable interface**, **configurable uploads**, and comprehensive customization options.
4
+
5
+ ## 🎉 What's New in v2.0.0 (UI Enhancement Release)
6
+
7
+ - **🎨 Modern Icon System** - Clean, minimalist SVG icons replacing emojis
8
+ - **📊 Icon-Only Status** - Subtle status dots with no text clutter
9
+ - **🔧 Configurable Uploads** - Independently enable/disable image and file uploads
10
+ - **🖼️ Enhanced Fullscreen** - Fixed fullscreen mode with proper dimension restoration
11
+ - **✨ Refined Animations** - Smoother transitions with cubic-bezier easing
12
+ - **♿ Better Accessibility** - WCAG AA+ compliance with high contrast support
13
+ - **📱 Improved Responsive** - Enhanced mobile experience with optimized touch targets
14
+ - **🎯 Social Media Inspired** - Design patterns from Facebook, Twitter, LinkedIn
15
+
16
+ [View UI Enhancements Guide](./documentation/UI_ENHANCEMENTS_GUIDE.md) | [View Full Changelog](./CHANGELOG.md)
17
+
18
+ ## ✨ Features
19
+
20
+ ### Core Functionality
21
+ - ✅ Real-time AI chat messaging
22
+ - ✅ Resizable chat interface (drag handles + presets)
23
+ - ✅ **Configurable file upload** (PDF, DOC, DOCX, TXT, CSV) - *New!*
24
+ - ✅ **Configurable image upload** (PNG, JPEG, GIF, WEBP) - *New!*
25
+ - ✅ Enhanced fullscreen mode
26
+ - ✅ Historical message loading
27
+ - ✅ Session state persistence
28
+
29
+ ### UI & Design
30
+ - ✅ **Modern SVG icon system** - *New!*
31
+ - ✅ **Icon-only status indicators** - *New!*
32
+ - ✅ 10 customizable themes
33
+ - ✅ **Smooth animations & transitions** - *Enhanced!*
34
+ - ✅ Mobile-responsive design
35
+ - ✅ Clean, minimalist interface
36
+
37
+ ### Accessibility & Performance
38
+ - ✅ **WCAG AA+ compliant** - *Enhanced!*
39
+ - ✅ **High contrast mode support** - *New!*
40
+ - ✅ **Reduced motion support** - *New!*
41
+ - ✅ Keyboard navigation
42
+ - ✅ Screen reader friendly
43
+ - ✅ TypeScript support
44
+
45
+ ## 📦 Installation
46
+
47
+ Install via npm:
48
+
49
+ ```bash
50
+ npm install westlake-emanate-ai-chat-lib
51
+ ```
52
+
53
+ Or via yarn:
54
+
55
+ ```bash
56
+ yarn add westlake-emanate-ai-chat-lib
57
+ ```
58
+
59
+ ## 🚀 Quick Start
60
+
61
+ ### 1. Import the Module
62
+
63
+ ```typescript
64
+ import { NgModule } from '@angular/core';
65
+ import { EmanateAiChatLibModule } from 'westlake-emanate-ai-chat-lib';
66
+
67
+ @NgModule({
68
+ imports: [
69
+ EmanateAiChatLibModule
70
+ ]
71
+ })
72
+ export class AppModule { }
73
+ ```
74
+
75
+ ### 2. Use the Component
76
+
77
+ ```html
78
+ <emanate-ai-chat
79
+ [title]="'Chat with Maestro'"
80
+ [apiUrl]="'https://your-api-url.com/api'"
81
+ [appKey]="'your-app-key'"
82
+ [userId]="currentUser.id"
83
+ [userName]="currentUser.name"
84
+ [firstName]="currentUser.firstName"
85
+ [templateDesign]="'default'"
86
+ [enableImageUpload]="true"
87
+ [enableFileUpload]="true"
88
+ (fileUploaded)="onFileUploaded($event)"
89
+ (sizeChanged)="onSizeChanged($event)">
90
+ </emanate-ai-chat>
91
+ ```
92
+
93
+ ### 3. Configure Upload Buttons (Optional)
94
+
95
+ Upload buttons are **disabled by default**. Enable them as needed:
96
+
97
+ ```typescript
98
+ // Enable both upload types
99
+ <emanate-ai-chat
100
+ [enableImageUpload]="true"
101
+ [enableFileUpload]="true">
102
+ </emanate-ai-chat>
103
+
104
+ // Enable only images
105
+ <emanate-ai-chat
106
+ [enableImageUpload]="true"
107
+ [enableFileUpload]="false">
108
+ </emanate-ai-chat>
109
+
110
+ // Disable both (default)
111
+ <emanate-ai-chat>
112
+ </emanate-ai-chat>
113
+ ```
114
+
115
+ ## 📖 Component API
116
+
117
+ ### Input Properties
118
+
119
+ | Property | Type | Default | Description |
120
+ |----------|------|---------|-------------|
121
+ | `title` | `string` | `'Chat with Maestro'` | Chat window title |
122
+ | `placeholder` | `string` | `'Type your inquiry...'` | Input placeholder text |
123
+ | `showDebugInfo` | `boolean` | `false` | Show debug information |
124
+ | `apiUrl` | `string` | `undefined` | AI service API URL |
125
+ | `appKey` | `string` | `undefined` | Application key for API |
126
+ | `appSource` | `string` | `undefined` | Application source identifier |
127
+ | `userId` | `string` | `undefined` | Current user ID |
128
+ | `firstName` | `string` | `undefined` | User's first name |
129
+ | `userName` | `string` | `undefined` | User's full name |
130
+ | `templateDesign` | `string` | `'default'` | Theme name (see Themes) |
131
+ | `welcomeMessage` | `string` | Auto-generated | Custom welcome message |
132
+ | `historicalMessages` | `any[]` | `[]` | Previous conversation messages |
133
+ | `conversationId` | `string` | `undefined` | Current conversation identifier |
134
+ | `enableImageUpload` | `boolean` | `false` | **NEW!** Enable image upload button |
135
+ | `enableFileUpload` | `boolean` | `false` | **NEW!** Enable file upload button |
136
+
137
+ ### Output Events
138
+
139
+ | Event | Payload | Description |
140
+ |-------|---------|-------------|
141
+ | `messageReceived` | `ChatMessage` | Emitted when AI responds |
142
+ | `messageSent` | `ChatMessage` | Emitted when user sends message |
143
+ | `fileUploaded` | `FileAttachment` | Emitted when file is uploaded |
144
+ | `sizeChanged` | `{size, width, height}` | Emitted when chat is resized |
145
+
146
+ ### Interfaces
147
+
148
+ ```typescript
149
+ export interface ChatMessage {
150
+ messageId?: string;
151
+ conversationId?: string;
152
+ isUser: boolean;
153
+ content: string;
154
+ sender?: string;
155
+ intent?: string;
156
+ authorName?: string;
157
+ confidenceScore?: number;
158
+ timestamp: Date;
159
+ isLoading?: boolean;
160
+ attachments?: FileAttachment[];
161
+ }
162
+
163
+ export interface FileAttachment {
164
+ id: string;
165
+ name: string;
166
+ type: string;
167
+ size: number;
168
+ url?: string;
169
+ data?: string | ArrayBuffer;
170
+ }
171
+
172
+ export type ChatSize = 'compact' | 'default' | 'expanded' | 'fullscreen';
173
+ ```
174
+
175
+ ## 🎨 Available Themes
176
+
177
+ Choose from 10 professionally designed themes:
178
+
179
+ - `default` - Purple gradient theme
180
+ - `dark` - Dark mode theme
181
+ - `blue` - Blue professional theme
182
+ - `green` - Green nature theme
183
+ - `purple` - Purple vibrant theme
184
+ - `minimal` - Clean minimal theme
185
+ - `corporate` - Corporate gray theme
186
+ - `red` - Red alert theme
187
+ - `yellow` - Yellow sunshine theme
188
+ - `orange` - Orange warm theme
189
+
190
+ ## 📐 Resizing Features
191
+
192
+ ### Size Presets
193
+ - **📱 Compact**: 400x500px - Minimal footprint
194
+ - **💻 Default**: 800x600px - Standard view
195
+ - **🖥️ Expanded**: 1200x800px - Maximum workspace
196
+ - **⛶ Fullscreen**: 100vw x 100vh - Full coverage
197
+
198
+ ### Manual Resize
199
+ - Drag the **right edge** to resize width
200
+ - Drag the **bottom-right corner** to resize both dimensions
201
+ - Size preferences saved automatically to session storage
202
+
203
+ ## 📎 File Upload
204
+
205
+ ### Supported File Types
206
+
207
+ **Images**: 🖼️
208
+ - PNG, JPEG, JPG, GIF, WEBP
209
+
210
+ **Documents**: 📄
211
+ - PDF, DOC, DOCX, TXT, CSV
212
+
213
+ ### File Validation
214
+ - Maximum size: **10MB** per file
215
+ - Type checking enforced
216
+ - Visual preview with icons and sizes
217
+ - Remove attachments before sending
218
+
219
+ ## 📱 Responsive Design
220
+
221
+ - **Desktop (>768px)**: Full features with resize handles
222
+ - **Tablet (768px-480px)**: Optimized layout, hidden handles
223
+ - **Mobile (<480px)**: Full-screen, touch-optimized
224
+
225
+ ## 💡 Usage Examples
226
+
227
+ ### Basic Implementation
228
+
229
+ ```typescript
230
+ import { Component } from '@angular/core';
231
+
232
+ @Component({
233
+ selector: 'app-chat',
234
+ template: `
235
+ <emanate-ai-chat
236
+ [apiUrl]="apiUrl"
237
+ [appKey]="appKey"
238
+ [userId]="userId"
239
+ [userName]="userName">
240
+ </emanate-ai-chat>
241
+ `
242
+ })
243
+ export class ChatComponent {
244
+ apiUrl = 'https://your-backend.com/api';
245
+ appKey = 'your-app-key';
246
+ userId = 'user123';
247
+ userName = 'John Doe';
248
+ }
249
+ ```
250
+
251
+ ### With File Upload Handling
252
+
253
+ ```typescript
254
+ import { Component } from '@angular/core';
255
+ import { FileAttachment } from 'westlake-emanate-ai-chat-lib';
256
+
257
+ @Component({
258
+ selector: 'app-chat',
259
+ template: `
260
+ <emanate-ai-chat
261
+ [apiUrl]="apiUrl"
262
+ [appKey]="appKey"
263
+ (fileUploaded)="onFileUploaded($event)"
264
+ (sizeChanged)="onSizeChanged($event)">
265
+ </emanate-ai-chat>
266
+ `
267
+ })
268
+ export class ChatComponent {
269
+ apiUrl = 'https://your-backend.com/api';
270
+ appKey = 'your-app-key';
271
+
272
+ onFileUploaded(file: FileAttachment): void {
273
+ console.log('File uploaded:', file.name, file.size);
274
+ // Process file upload to your backend
275
+ this.uploadToServer(file);
276
+ }
277
+
278
+ onSizeChanged(sizeData: any): void {
279
+ console.log('Chat resized:', sizeData.size, sizeData.width, sizeData.height);
280
+ // Save user preference or adjust layout
281
+ }
282
+
283
+ private async uploadToServer(file: FileAttachment): Promise<void> {
284
+ // Your upload logic here
285
+ }
286
+ }
287
+ ```
288
+
289
+ ### With Historical Messages
290
+
291
+ ```typescript
292
+ import { Component, OnInit } from '@angular/core';
293
+
294
+ @Component({
295
+ selector: 'app-chat',
296
+ template: `
297
+ <emanate-ai-chat
298
+ [apiUrl]="apiUrl"
299
+ [conversationId]="conversationId"
300
+ [historicalMessages]="messages">
301
+ </emanate-ai-chat>
302
+ `
303
+ })
304
+ export class ChatComponent implements OnInit {
305
+ apiUrl = 'https://your-backend.com/api';
306
+ conversationId = 'conv-123';
307
+ messages: any[] = [];
308
+
309
+ ngOnInit(): void {
310
+ // Load previous conversation
311
+ this.loadHistory();
312
+ }
313
+
314
+ private loadHistory(): void {
315
+ // Fetch from backend
316
+ this.http.get(`/api/conversations/${this.conversationId}`)
317
+ .subscribe((data: any) => {
318
+ this.messages = data.messages;
319
+ });
320
+ }
321
+ }
322
+ ```
323
+
324
+ ## 📚 Documentation
325
+
326
+ For detailed documentation, see:
327
+
328
+ - **[RESIZABLE_UI_GUIDE.md](./RESIZABLE_UI_GUIDE.md)** - Complete feature guide and API reference
329
+ - **[VISUAL_REFERENCE.md](./VISUAL_REFERENCE.md)** - Visual layouts, diagrams, and design specs
330
+ - **[INTEGRATION_EXAMPLES.md](./INTEGRATION_EXAMPLES.md)** - Real-world integration examples
331
+ - **[HISTORICAL_MESSAGES_USAGE.md](./HISTORICAL_MESSAGES_USAGE.md)** - Message history guide
332
+ - **[CHANGELOG.md](./CHANGELOG.md)** - Version history and changes
333
+
334
+ ## 🛠️ Development
335
+
336
+ To develop or contribute to this library:
337
+
338
+ ### Building the Library
339
+
340
+ ```bash
341
+ # Navigate to project root
342
+ cd Westlake.Underwriting.AIAgent.Angular
343
+
344
+ # Build the library
345
+ ng build emanate-ai-chat-lib
346
+
347
+ # Build with watch mode
348
+ ng build emanate-ai-chat-lib --watch
349
+ ```
350
+
351
+ ### Testing Locally
352
+
353
+ ```bash
354
+ # Build the library
355
+ ng build emanate-ai-chat-lib
356
+
357
+ # Link locally
358
+ cd dist/emanate-ai-chat-lib
359
+ npm link
360
+
361
+ # In your test project
362
+ npm link westlake-emanate-ai-chat-lib
363
+ ```
364
+
365
+ ### Running Tests
366
+
367
+ ```bash
368
+ ng test emanate-ai-chat-lib
369
+ ```
370
+
371
+ ## 📋 Requirements
372
+
373
+ - **Angular**: 12.1.3+
374
+ - **RxJS**: 6.6.0+
375
+ - **TypeScript**: 4.3.5+
376
+ - **Modern Browsers**: Chrome 80+, Firefox 75+, Safari 13+
377
+
378
+ ## 🤝 Contributing
379
+
380
+ Contributions are welcome! Please:
381
+
382
+ 1. Fork the repository
383
+ 2. Create a feature branch
384
+ 3. Make your changes
385
+ 4. Add tests if applicable
386
+ 5. Submit a pull request
387
+
388
+ ## 📝 License
389
+
390
+ MIT License - see LICENSE file for details
391
+
392
+ ## 🐛 Issues & Support
393
+
394
+ Report issues at: [GitHub Issues](https://github.com/NC-Westlake/Westlake.Underwriting.AIAgent.Angular/issues)
395
+
396
+ ## 👨‍💻 Author
397
+
398
+ **Jomel Dicen** - [jomel.dicen@nowcom.com.ph](mailto:jomel.dicen@nowcom.com.ph)
399
+
400
+ ## 🔗 Links
401
+
402
+ - [GitHub Repository](https://github.com/NC-Westlake/Westlake.Underwriting.AIAgent.Angular)
403
+ - [npm Package](https://www.npmjs.com/package/westlake-emanate-ai-chat-lib)
404
+ - [Changelog](./CHANGELOG.md)
405
+
406
+ ---
407
+
408
+ **Version**: 0.1.0
409
+ **Last Updated**: December 31, 2025