@aslaluroba/help-center
Version:
A powerful and customizable help center widget for Angular applications with real-time chat functionality, AI assistance, and multi-language support.
134 lines (102 loc) • 3.69 kB
Markdown
# /help-center
A powerful and customizable help center widget for Angular applications with real-time chat functionality, AI assistance, and multi-language support.
## Installation
```bash
npm install /help-center
```
## Setup and Configuration
1. Import and configure the widget in your app.module.ts:
```typescript
import { HelpCenterWidgetComponent, ApiService } from '@aslaluroba/help-center'
export class AppModule {}
```
2. Initialize and use the widget in your component:
```typescript
import { Component, OnInit } from '@angular/core'
import { ApiService, ApiConfig, Language } from '@aslaluroba/help-center'
export class AppComponent implements OnInit {
helpScreenId = 'your-help-screen-id' // Required: Your unique help screen ID
currentLang: Language = 'en' // Default language
constructor(private apiService: ApiService) {}
ngOnInit() {
// Initialize API with authentication
const apiConfig: ApiConfig = {
getToken: async () => {
// Implement your token retrieval logic
const response = await fetch('your-auth-endpoint')
const data = await response.json()
return data.token
}
// Optional: Override default API URL (default: 'https://babylai.net/api')
// baseUrl: 'https://your-custom-api.com'
}
this.apiService.initialize(apiConfig)
}
}
```
## Language Support
The widget supports multiple languages with built-in RTL support. Currently available languages:
- English (en) - Default
- Arabic (ar) - With RTL support
### Changing Languages
1. Simple language switch:
```typescript
import { Component } from '@angular/core'
import { Language } from '@aslaluroba/help-center'
export class AppComponent {
helpScreenId = 'your-help-screen-id'
currentLang: Language = 'en'
}
```
2. Using Translation Service (for advanced usage):
```typescript
import { Component } from '@angular/core'
import { TranslationService, Language } from '@aslaluroba/help-center'
export class AppComponent {
constructor(private translationService: TranslationService) {
// Subscribe to language changes
this.translationService.currentLang.subscribe((lang: Language) => {
console.log('Current language:', lang)
})
// Change language
this.translationService.setLanguage('ar')
}
}
```
## Props
| Prop | Type | Required | Default | Description |
| ------------ | -------- | -------- | ------- | ----------------------------- |
| helpScreenId | string | Yes | - | Unique help screen identifier |
| currentLang | Language | No | 'en' | UI language ('en' \| 'ar') |
| showArrow | boolean | No | true | Show/hide floating arrow |
## Support
For issues and feature requests, please visit our [GitHub repository](https://github.com/aslaluroba/help-center/issues).
## License
MIT License - see the [LICENSE](LICENSE) file for details.