bstp-agent-widget 0.0.0 → 0.1.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,30 +1,30 @@
1
1
  # BSTP Agent Widget
2
2
 
3
- `bstp-agent-widget`, başka React projelerine eklenebilen bir Agent Chat widget kütüphanesidir.
3
+ `bstp-agent-widget` is an Agent Chat widget library that can be integrated into other React projects.
4
4
 
5
5
  ## Library Build & Publish
6
6
 
7
- ### 1) Library build al
7
+ ### 1) Build the library
8
8
 
9
9
  ```bash
10
10
  bun run build:lib
11
11
  ```
12
12
 
13
- ### 2) Pakete girecek dosyaları kontrol et
13
+ ### 2) Check package contents
14
14
 
15
15
  ```bash
16
16
  bun run pack:check
17
17
  ```
18
18
 
19
- ### 3) npm'e publish et
19
+ ### 3) Publish to npm
20
20
 
21
21
  ```bash
22
22
  npm publish --access public
23
23
  ```
24
24
 
25
- > Not: `prepublishOnly` otomatik olarak `build:lib` çalıştırır.
25
+ > Note: `prepublishOnly` automatically runs `build:lib`.
26
26
 
27
- ## Consumer Project Kullanımı
27
+ ## Consumer Project Usage
28
28
 
29
29
  ```bash
30
30
  bun add bstp-agent-widget
@@ -57,8 +57,60 @@ export function Page() {
57
57
 
58
58
  ## Development Notes
59
59
 
60
- - `react` ve `react-dom` `peerDependencies` olarak tanımlıdır.
61
- - Paket çıktıları `dist/` altına üretilir.
60
+ - `react` and `react-dom` are defined as `peerDependencies`.
61
+ - Library outputs are generated under `dist/`.
62
+
63
+ ## Angular Integration
64
+
65
+ Install the package in your Angular app:
66
+
67
+ ```bash
68
+ npm i bstp-agent-widget
69
+ ```
70
+
71
+ Add the widget stylesheet once (for example in `src/styles.scss`):
72
+
73
+ ```scss
74
+ @import 'bstp-agent-widget/style.css';
75
+ ```
76
+
77
+ Create a wrapper component:
78
+
79
+ ```ts
80
+ import { AfterViewInit, Component, ElementRef, OnDestroy, ViewChild } from '@angular/core';
81
+ import { mountAgentChatWidget } from 'bstp-agent-widget';
82
+
83
+ @Component({
84
+ selector: 'app-agent-chat-widget',
85
+ template: '<div #widgetHost></div>',
86
+ })
87
+ export class AgentChatWidgetComponent implements AfterViewInit, OnDestroy {
88
+ @ViewChild('widgetHost', { static: true }) widgetHost!: ElementRef<HTMLDivElement>;
89
+ private cleanup: (() => void) | null = null;
90
+
91
+ ngAfterViewInit(): void {
92
+ this.cleanup = mountAgentChatWidget(this.widgetHost.nativeElement, {
93
+ config: {
94
+ baseUrl: 'https://your-genai-api-url',
95
+ assistantId: 123,
96
+ genaiInit: {
97
+ email: 'agent@example.com',
98
+ clientSecret: 'secret',
99
+ },
100
+ },
101
+ runtime: {
102
+ customerId: '590100010884',
103
+ customerToken: 'jwt-token',
104
+ language: 'en-US',
105
+ },
106
+ });
107
+ }
108
+
109
+ ngOnDestroy(): void {
110
+ this.cleanup?.();
111
+ }
112
+ }
113
+ ```
62
114
 
63
115
  # React Starter Kit
64
116