@aslaluroba/help-center 1.2.2 → 2.0.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.
Files changed (35) hide show
  1. package/README.md +212 -48
  2. package/assets/Shape.png +0 -0
  3. package/assets/favicon.ico +0 -0
  4. package/fesm2022/aslaluroba-help-center.mjs +497 -348
  5. package/fesm2022/aslaluroba-help-center.mjs.map +1 -1
  6. package/package.json +26 -13
  7. package/public_api.d.ts +3 -1
  8. package/src/app/chat/chat.component.d.ts +9 -6
  9. package/src/app/help-center-widget/help-center-widget.component.d.ts +14 -8
  10. package/src/app/help-screen-data/help-screen-data.component.d.ts +8 -1
  11. package/src/app/language.service.d.ts +11 -0
  12. package/src/app/services/help-center-config.service.d.ts +12 -0
  13. package/src/app/services/token.service.d.ts +4 -6
  14. package/src/app/services/translation.service.d.ts +3 -1
  15. package/src/app/shared/components/button/button.component.d.ts +4 -2
  16. package/src/app/shared/components/header/header.component.d.ts +4 -1
  17. package/src/app/shared/components/loading/loading.component.d.ts +2 -1
  18. package/src/app/types.d.ts +38 -0
  19. package/assets/i18n/ar.json +0 -17
  20. package/assets/i18n/en.json +0 -17
  21. package/assets/icons/arrow-stripped-colored.svg +0 -3
  22. package/assets/icons/arrow-stripped.svg +0 -3
  23. package/assets/icons/chat.svg +0 -4
  24. package/assets/icons/close-circle.svg +0 -3
  25. package/assets/icons/menu.svg +0 -3
  26. package/assets/icons/person.svg +0 -4
  27. package/assets/icons/send.svg +0 -3
  28. package/assets/images/animatedLogo.gif +0 -0
  29. package/assets/images/seperator.svg +0 -5
  30. package/assets/images/stars.svg +0 -7
  31. package/assets/logo-primary.svg +0 -6
  32. package/assets/logo-white.svg +0 -6
  33. package/lib/tailwind.scss +0 -1564
  34. package/src/app/shared/utils/class-utils.d.ts +0 -5
  35. package/src/app/types/index.d.ts +0 -1
package/README.md CHANGED
@@ -1,76 +1,240 @@
1
- # @babylai/help-center
1
+ # @aslaluroba/help-center
2
2
 
3
- A customizable help center widget for Angular applications that provides chat functionality and documentation support.
3
+ A powerful and customizable help center widget for Angular applications that provides real-time chat functionality, AI assistance, and multi-language support.
4
4
 
5
- ## Installation
5
+ ## Features
6
+
7
+ - 🎯 Easy integration with any Angular application
8
+ - 🌐 Built-in multi-language support (English & Arabic) with RTL
9
+ - 💬 Real-time chat functionality with SignalR
10
+ - 🤖 AI Assistant integration
11
+ - 📱 Responsive and modern design
12
+ - 🎨 Highly customizable UI
13
+ - 🔒 Secure token-based authentication
14
+ - 🔄 Real-time updates and notifications
15
+ - 📋 Nested options and help screens
6
16
 
7
- Install the package and its peer dependencies:
17
+ ## Installation
8
18
 
9
19
  ```bash
10
- npm install @babylai/help-center
20
+ npm install @aslaluroba/help-center
11
21
  ```
12
22
 
13
- ### Markdown Support
14
-
15
- This library uses [ngx-markdown](https://github.com/jfcere/ngx-markdown) for rendering markdown content. Please refer to their [official documentation](https://github.com/jfcere/ngx-markdown) for detailed installation and configuration instructions, including:
23
+ ## Quick Start
16
24
 
17
- - Syntax highlighting with Prism.js
18
- - Emoji support
19
- - Math expression rendering with KaTeX
20
- - Diagrams and charts with Mermaid
21
- - Copy-to-clipboard functionality
22
-
23
- ## Basic Usage
24
-
25
- 1. Import the HelpCenterModule in your app.module.ts:
25
+ 1. Import the required components and services in your app.module.ts or standalone component:
26
26
 
27
27
  ```typescript
28
- typescript
29
- import { HelpCenterModule } from '@babylai/help-center'
28
+ import { HelpCenterWidgetComponent, HelpCenterConfigService } from '@aslaluroba/help-center'
29
+
30
30
  @NgModule({
31
31
  imports: [
32
32
  // ... other imports
33
- HelpCenterModule
34
- ]
33
+ HelpCenterWidgetComponent
34
+ ],
35
+ providers: [HelpCenterConfigService]
35
36
  })
36
37
  export class AppModule {}
37
38
  ```
38
39
 
39
- 2. Add the HelpCenterComponent to your template:
40
+ 2. Configure and use the Help Center in your component:
41
+
40
42
  ```typescript
41
- import { HelpCenterWidgetComponent } from '@babylai/help-center';
43
+ import { Component } from '@angular/core'
44
+ import { HelpCenterConfigService, Language } from '@aslaluroba/help-center'
42
45
 
43
46
  @Component({
44
47
  selector: 'app-root',
45
- imports: [RouterOutlet, HelpCenterWidgetComponent],
46
- templateUrl: './app.component.html',
48
+ template: `
49
+ <div>
50
+ <!-- Language Switcher (Optional) -->
51
+ <div class="language-switcher">
52
+ <button (click)="switchLanguage('en')">English</button>
53
+ <button (click)="switchLanguage('ar')">العربية</button>
54
+ </div>
55
+
56
+ <!-- Help Center Widget -->
57
+ <app-help-center-widget
58
+ [getToken]="getToken"
59
+ [helpScreenId]="helpScreenId"
60
+ [showArrow]="true"
61
+ [messageLabel]="'Need help? Click here!'"
62
+ [currentLang]="currentLang"
63
+ [isIntroScreenEnabled]="false"
64
+ >
65
+ </app-help-center-widget>
66
+ </div>
67
+ `
47
68
  })
69
+ export class AppComponent {
70
+ helpScreenId = 'your-help-screen-id'
71
+ currentLang: Language = 'en'
72
+
73
+ constructor(private configService: HelpCenterConfigService) {
74
+ // Optional: Configure global settings
75
+ this.configService.setApiBaseUrl('https://your-custom-api.com')
76
+ }
77
+
78
+ // Required: Implement token retrieval
79
+ getToken = async () => {
80
+ const response = await fetch('your-auth-endpoint')
81
+ const data = await response.json()
82
+ return data.token
83
+ }
84
+
85
+ // Optional: Language switching
86
+ switchLanguage(lang: Language) {
87
+ this.currentLang = lang
88
+ }
89
+ }
48
90
  ```
49
91
 
50
- ```html
51
- <app-help-center-widget
52
- [getToken]="getTokenFunction"
53
- [helpScreenId]="yourHelpScreenId"
54
- [user]="currentUser"
55
- [showArrow]="true"
56
- [messageLabel]="'Need help? Click here!'"
57
- >
58
- </app-help-center-widget>
92
+ ## Available Services
93
+
94
+ The library provides several services for advanced customization:
95
+
96
+ ### HelpCenterConfigService
97
+
98
+ Global configuration service for the help center:
99
+
100
+ ```typescript
101
+ import { HelpCenterConfigService } from '@aslaluroba/help-center'
102
+
103
+ constructor(private config: HelpCenterConfigService) {
104
+ // Set custom API base URL (optional)
105
+ config.setApiBaseUrl('https://your-api.com')
106
+
107
+ // Set custom token function (optional)
108
+ config.setGetTokenFn(async () => {
109
+ return 'your-custom-token'
110
+ })
111
+ }
59
112
  ```
60
113
 
61
- ## Configuration Options
114
+ ### TranslationService & LanguageService
62
115
 
63
- The widget accepts the following inputs:
116
+ Handle multi-language support:
64
117
 
65
- - `getToken`: () => Promise<string> - A function that returns a promise resolving to an authentication token
66
- - `helpScreenId`: string - The ID of the help screen to display
67
- - `user`: Object - (Optional) Current user information
68
- ```typescript
69
- {
70
- id: string
71
- name: string
72
- email: string
73
- }
74
- ```
75
- - `showArrow`: boolean - (Optional) Whether to show the attention arrow animation
76
- - `messageLabel`: string - (Optional) Custom message for the arrow tooltip
118
+ ```typescript
119
+ import {
120
+ TranslationService,
121
+ LanguageService,
122
+ Language
123
+ } from '@aslaluroba/help-center'
124
+
125
+ constructor(
126
+ private translation: TranslationService,
127
+ private language: LanguageService
128
+ ) {
129
+ // Subscribe to language changes
130
+ translation.currentLang.subscribe((lang: Language) => {
131
+ console.log('Language changed to:', lang)
132
+ })
133
+
134
+ // Switch language
135
+ language.switchLanguage('ar')
136
+ }
137
+ ```
138
+
139
+ ### SignalRService
140
+
141
+ Handles real-time communication:
142
+
143
+ ```typescript
144
+ import { SignalRService } from '@aslaluroba/help-center'
145
+
146
+ constructor(private signalR: SignalRService) {
147
+ // The service is automatically managed by the widget
148
+ // but you can subscribe to connection status if needed
149
+ signalR.connectionStatus$.subscribe(status => {
150
+ console.log('SignalR connection status:', status)
151
+ })
152
+ }
153
+ ```
154
+
155
+ ## Component Props
156
+
157
+ ### Required Props
158
+
159
+ | Prop | Type | Description |
160
+ | ------------ | --------------------- | -------------------------------------------------------------------- |
161
+ | getToken | () => Promise<string> | Function that returns a promise resolving to an authentication token |
162
+ | helpScreenId | string | Unique identifier for the help screen |
163
+
164
+ ### Optional Props
165
+
166
+ | Prop | Type | Default | Description |
167
+ | -------------------- | -------- | ------- | -------------------------------------- |
168
+ | showArrow | boolean | true | Show/hide the floating arrow animation |
169
+ | messageLabel | string | null | Custom message label for the widget |
170
+ | currentLang | Language | 'en' | Current language ('en' or 'ar') |
171
+ | isIntroScreenEnabled | boolean | false | Enable/disable intro screen |
172
+
173
+ ## Styling
174
+
175
+ The widget can be customized using CSS variables:
176
+
177
+ ```css
178
+ :root {
179
+ /* Primary Colors */
180
+ --help-center-primary-color: #ad49e1;
181
+ --help-center-secondary-color: #8a2be2;
182
+
183
+ /* Text Colors */
184
+ --help-center-text-color: #333;
185
+ --help-center-text-light: #fff;
186
+
187
+ /* Background Colors */
188
+ --help-center-background: #fff;
189
+ --help-center-chat-background: #f5f5f5;
190
+
191
+ /* Border Styles */
192
+ --help-center-border-radius: 8px;
193
+ --help-center-border-color: #e0e0e0;
194
+
195
+ /* Spacing */
196
+ --help-center-padding: 16px;
197
+ --help-center-margin: 8px;
198
+ }
199
+ ```
200
+
201
+ ## Types
202
+
203
+ The library exports several TypeScript interfaces and types:
204
+
205
+ ```typescript
206
+ import {
207
+ Language, // 'en' | 'ar'
208
+ TokenResponse, // { token: string; expiresIn: number }
209
+ Option, // Help screen option interface
210
+ Message // Chat message interface
211
+ } from '@aslaluroba/help-center'
212
+ ```
213
+
214
+ ## Security Considerations
215
+
216
+ - All authentication is token-based
217
+ - Tokens are never stored in localStorage/sessionStorage
218
+ - All API communications use HTTPS
219
+ - Real-time connections are secured via SignalR
220
+ - API base URL can be configured for your domain
221
+ - Custom token retrieval logic can be implemented
222
+
223
+ ## Browser Support
224
+
225
+ - Chrome (latest 2 versions)
226
+ - Firefox (latest 2 versions)
227
+ - Safari (latest 2 versions)
228
+ - Edge (latest 2 versions)
229
+
230
+ ## Contributing
231
+
232
+ We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
233
+
234
+ ## License
235
+
236
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
237
+
238
+ ## Support
239
+
240
+ For support, please [open an issue](https://github.com/aslaluroba/help-center/issues) on our GitHub repository.
Binary file
Binary file