tas-uell-sdk 0.0.1 → 0.0.2

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 (29) hide show
  1. package/README.md +122 -229
  2. package/esm2020/lib/components/tas-btn/tas-btn.component.mjs +79 -95
  3. package/esm2020/lib/components/tas-floating-call/tas-floating-call.component.mjs +74 -24
  4. package/esm2020/lib/components/tas-videocall/tas-videocall.component.mjs +50 -45
  5. package/esm2020/lib/components/tas-waiting-room/tas-waiting-room.component.mjs +179 -0
  6. package/esm2020/lib/config/tas.config.mjs +10 -0
  7. package/esm2020/lib/interfaces/tas.interfaces.mjs +32 -2
  8. package/esm2020/lib/services/tas.service.mjs +27 -48
  9. package/esm2020/lib/tas-uell-sdk.module.mjs +82 -0
  10. package/esm2020/public-api.mjs +13 -12
  11. package/esm2020/tas-uell-sdk.mjs +1 -1
  12. package/fesm2015/tas-uell-sdk.mjs +440 -218
  13. package/fesm2015/tas-uell-sdk.mjs.map +1 -1
  14. package/fesm2020/tas-uell-sdk.mjs +437 -216
  15. package/fesm2020/tas-uell-sdk.mjs.map +1 -1
  16. package/lib/components/tas-btn/tas-btn.component.d.ts +15 -11
  17. package/lib/components/tas-floating-call/tas-floating-call.component.d.ts +3 -2
  18. package/lib/components/tas-videocall/tas-videocall.component.d.ts +4 -3
  19. package/lib/components/tas-waiting-room/tas-waiting-room.component.d.ts +56 -0
  20. package/lib/config/tas.config.d.ts +28 -0
  21. package/lib/interfaces/tas.interfaces.d.ts +41 -6
  22. package/lib/services/tas.service.d.ts +6 -16
  23. package/lib/tas-uell-sdk.module.d.ts +46 -0
  24. package/package.json +34 -23
  25. package/public-api.d.ts +8 -7
  26. package/esm2020/lib/tas.config.mjs +0 -14
  27. package/esm2020/lib/tas.module.mjs +0 -73
  28. package/lib/tas.config.d.ts +0 -51
  29. package/lib/tas.module.d.ts +0 -34
package/README.md CHANGED
@@ -1,15 +1,15 @@
1
- # TAS-Uell-SDK
1
+ # TAS UELL SDK
2
2
 
3
- Angular library for TAS (Telemedicine Assistance Service) video call functionality using OpenTok/Vonage Video API.
3
+ Angular library for TAS (Telemedicine Assistance Service) video call functionality using TokBox/Vonage.
4
4
 
5
5
  ## Features
6
6
 
7
- - 📹 Video call integration with OpenTok/Vonage
8
- - 🔘 Ready-to-use button component to initiate calls
9
- - 🖼️ Picture-in-Picture (PiP) mode support
10
- - 🎤 Mute/unmute functionality
11
- - 📱 Draggable floating call widget
12
- - 🔌 Pluggable architecture for HTTP and user data providers
7
+ - 📹 Video call integration with TokBox/Vonage
8
+ - 🪟 Picture-in-Picture (PiP) mode support
9
+ - 🎤 Mute/unmute audio controls
10
+ - 🔄 Swappable video views
11
+ - 📱 Responsive design
12
+ - 🎨 Customizable styling
13
13
 
14
14
  ## Installation
15
15
 
@@ -17,288 +17,181 @@ Angular library for TAS (Telemedicine Assistance Service) video call functionali
17
17
  npm install tas-uell-sdk
18
18
  ```
19
19
 
20
- ### Peer Dependencies
20
+ ## Peer Dependencies
21
21
 
22
- Make sure you have these peer dependencies installed:
22
+ Make sure you have the following peer dependencies installed:
23
23
 
24
24
  ```bash
25
- npm install @angular/common @angular/core @ng-bootstrap/ng-bootstrap @opentok/client interactjs rxjs
25
+ npm install @ng-bootstrap/ng-bootstrap @opentok/client interactjs
26
26
  ```
27
27
 
28
28
  ## Setup
29
29
 
30
- ### 1. Implement Required Adapters
30
+ ### 1. Create an HTTP Adapter
31
31
 
32
- The library requires two adapters to integrate with your application:
33
-
34
- #### HTTP Client Adapter
35
-
36
- Create a service that implements `TasHttpClient`:
32
+ The library requires an HTTP adapter that implements `TasHttpClient` interface:
37
33
 
38
34
  ```typescript
39
- import { Injectable } from "@angular/core";
40
- import { Observable } from "rxjs";
41
- import { TasHttpClient } from "tas-uell-sdk";
35
+ import { Injectable } from '@angular/core';
36
+ import { HttpClient } from '@angular/common/http';
37
+ import { Observable } from 'rxjs';
38
+ import { TasHttpClient } from 'tas-uell-sdk';
42
39
 
43
40
  @Injectable({ providedIn: 'root' })
44
- export class TasHttpAdapter implements TasHttpClient {
41
+ export class TasHttpAdapterService implements TasHttpClient {
45
42
  constructor(private http: HttpClient) {}
46
43
 
47
- post<T>(url: string, body: any, options?: { headers?: Record<string, string> }): Observable<T> {
48
- return this.http.post<T>(url, body, { headers: options?.headers });
49
- }
50
- }
51
- ```
52
-
53
- #### User Data Provider Adapter
54
-
55
- Create a service that implements `TasUserDataProvider`:
56
-
57
- ```typescript
58
- import { Injectable } from "@angular/core";
59
- import { TasUserDataProvider, TasUserData } from "tas-uell-sdk";
60
-
61
- @Injectable({ providedIn: 'root' })
62
- export class TasUserDataAdapter implements TasUserDataProvider {
63
- getUserData(): TasUserData | null {
64
- // Return the current user's data
65
- const user = this.authService.getCurrentUser();
66
- if (user) {
67
- return {
68
- id: user.id,
69
- name: user.firstName,
70
- surname: user.lastName,
71
- };
72
- }
73
- return null;
74
- }
75
-
76
- getTenantId(): string | null {
77
- // Return the current tenant ID
78
- return this.authService.getTenantId();
44
+ post<T>(url: string, options: { body: any; headers?: Record<string, string> }): Observable<T> {
45
+ return this.http.post<T>(`https://your-api.com/${url}`, options.body, {
46
+ headers: options.headers
47
+ });
79
48
  }
80
49
  }
81
50
  ```
82
51
 
83
- ### 2. Configure the Module
52
+ ### 2. Import the Module
84
53
 
85
- In your root module (e.g., `AppModule`):
54
+ In your `AppModule` (root module):
86
55
 
87
56
  ```typescript
88
- import { NgModule } from '@angular/core';
89
- import { TasModule, TAS_CONFIG, TAS_HTTP_CLIENT, TAS_USER_DATA_PROVIDER } from 'tas-uell-sdk';
90
- import { TasHttpAdapter } from './adapters/tas-http-adapter.service';
91
- import { TasUserDataAdapter } from './adapters/tas-user-data-adapter.service';
92
- import { environment } from '../environments/environment';
57
+ import { TasUellSdkModule } from 'tas-uell-sdk';
58
+ import { TasHttpAdapterService } from './adapters/tas-http-adapter.service';
93
59
 
94
60
  @NgModule({
95
61
  imports: [
96
- // ... other imports
97
- TasModule
98
- ],
99
- providers: [
100
- {
101
- provide: TAS_CONFIG,
102
- useValue: {
103
- tokBoxApiKey: environment.tokBoxApiKey,
104
- apiBaseUrl: environment.apiUrl
105
- }
106
- },
107
- { provide: TAS_HTTP_CLIENT, useExisting: TasHttpAdapter },
108
- { provide: TAS_USER_DATA_PROVIDER, useExisting: TasUserDataAdapter }
62
+ TasUellSdkModule.forRoot({
63
+ config: {
64
+ tokBoxApiKey: 'YOUR_TOKBOX_API_KEY'
65
+ },
66
+ httpClient: TasHttpAdapterService
67
+ })
109
68
  ]
110
69
  })
111
70
  export class AppModule { }
112
71
  ```
113
72
 
114
- ### 3. Import in Feature Modules
115
-
116
- In any feature module where you want to use the TAS components:
117
-
118
- ```typescript
119
- import { TasModule } from 'tas-uell-sdk';
120
-
121
- @NgModule({
122
- imports: [
123
- TasModule
124
- ]
125
- })
126
- export class MyFeatureModule { }
127
- ```
128
-
129
- ## Usage
130
-
131
- ### TAS Button Component
132
-
133
- Add the video call button to your template:
134
-
135
- ```html
136
- <tas-btn *ngIf="showVideoCall"></tas-btn>
137
- ```
138
-
139
- When clicked, this button will:
140
- 1. Create a video room via your API
141
- 2. Generate a session token
142
- 3. Open the video call modal
143
-
144
- ### Floating Call Component
145
-
146
- Add the floating PiP widget to your root component template:
147
-
148
- ```html
149
- <router-outlet></router-outlet>
150
- <tas-floating-call></tas-floating-call>
151
- ```
152
-
153
- This component shows a draggable mini video player when the user switches to PiP mode during a call.
154
-
155
- ## Components
156
-
157
- | Component | Selector | Description |
158
- |-----------|----------|-------------|
159
- | `TasButtonComponent` | `<tas-btn>` | Button to initiate a video call |
160
- | `TasVideocallComponent` | `<tas-videocall>` | Full video call modal (opened automatically) |
161
- | `TasFloatingCallComponent` | `<tas-floating-call>` | Floating PiP widget for minimized calls |
73
+ ### 3. Add Global Styles
162
74
 
163
- ## Services
75
+ Add the TAS modal styles to your global `styles.scss`:
164
76
 
165
- ### TasService
166
-
167
- The main service for managing video calls.
168
-
169
- ```typescript
170
- import { TasService } from 'tas-uell-sdk';
171
-
172
- @Component({...})
173
- export class MyComponent {
174
- constructor(private tasService: TasService) {}
175
-
176
- // Subscribe to call state changes
177
- ngOnInit() {
178
- this.tasService.callState$.subscribe(state => {
179
- console.log('Call state:', state); // IDLE, CONNECTING, CONNECTED, DISCONNECTED, ERROR
180
- });
181
-
182
- this.tasService.viewMode$.subscribe(mode => {
183
- console.log('View mode:', mode); // FULLSCREEN, PIP
184
- });
185
-
186
- this.tasService.isMuted$.subscribe(muted => {
187
- console.log('Is muted:', muted);
188
- });
77
+ ```scss
78
+ /* TAS Video Modal */
79
+ .tas-video-modal {
80
+ .modal-dialog {
81
+ max-width: 100vw;
82
+ margin: 0;
83
+ height: 100vh;
84
+ }
85
+ .modal-content {
86
+ height: 100vh;
87
+ border: none;
88
+ border-radius: 0;
89
+ background: #000;
90
+ }
91
+ .modal-body {
92
+ padding: 0;
189
93
  }
190
94
  }
191
- ```
192
-
193
- ## Interfaces
194
-
195
- ### TasConfig
196
-
197
- ```typescript
198
- interface TasConfig {
199
- tokBoxApiKey: string; // Your OpenTok/Vonage API Key
200
- apiBaseUrl: string; // Base URL for TAS API endpoints
201
- }
202
- ```
203
-
204
- ### TasHttpClient
205
95
 
206
- ```typescript
207
- interface TasHttpClient {
208
- post<T>(url: string, body: any, options?: { headers?: Record<string, string> }): Observable<T>;
96
+ /* TAS Waiting Room Modal */
97
+ .tas-waiting-room-modal {
98
+ .modal-dialog {
99
+ max-width: 480px;
100
+ }
101
+ .modal-content {
102
+ border: none;
103
+ border-radius: 5px;
104
+ background: #ffffff;
105
+ overflow: hidden;
106
+ box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
107
+ }
108
+ .modal-body {
109
+ padding: 0;
110
+ }
209
111
  }
210
112
  ```
211
113
 
212
- ### TasUserDataProvider
114
+ ### 4. Add the Floating Call Component
213
115
 
214
- ```typescript
215
- interface TasUserDataProvider {
216
- getUserData(): TasUserData | null;
217
- getTenantId(): string | null;
218
- }
219
- ```
220
-
221
- ### TasUserData
116
+ Add `<tas-floating-call>` to your root component template (e.g., `app.component.html`):
222
117
 
223
- ```typescript
224
- interface TasUserData {
225
- id: string | number;
226
- name: string;
227
- surname: string;
228
- }
118
+ ```html
119
+ <router-outlet></router-outlet>
120
+ <tas-floating-call></tas-floating-call>
229
121
  ```
230
122
 
231
- ## API Endpoints
232
-
233
- The library expects the following API endpoints to be available:
234
-
235
- | Method | Endpoint | Description |
236
- |--------|----------|-------------|
237
- | POST | `{apiBaseUrl}/v2/room` | Create a video room |
238
- | POST | `{apiBaseUrl}/v2/room/token` | Generate session token |
123
+ ## Usage
239
124
 
240
- ### Create Room Request
125
+ ### TAS Button Component
241
126
 
242
- ```typescript
243
- {
244
- tenant: string;
245
- userId: string;
246
- product: string;
247
- record: boolean;
248
- roomType: string;
249
- type: string;
250
- }
251
- ```
127
+ Use the `<tas-btn>` component to initiate a video call:
252
128
 
253
- ### Generate Token Request
129
+ ```html
130
+ <tas-btn
131
+ [appointmentId]="appointment.id"
132
+ [product]="'your-product'"
133
+ [tenantId]="tenantId"
134
+ [currentUser]="currentUser"
135
+ [ownerUserIds]="[ownerId]"
136
+ [regularUserIds]="regularUserIds"
137
+ [moderatorUserIds]="moderatorUserIds"
138
+ ></tas-btn>
139
+ ```
140
+
141
+ ### Input Properties
142
+
143
+ | Property | Type | Required | Description |
144
+ |----------|------|----------|-------------|
145
+ | `appointmentId` | `number` | Yes | The appointment/session ID |
146
+ | `product` | `string` | Yes | Product identifier |
147
+ | `tenantId` | `string` | Yes | Tenant identifier |
148
+ | `currentUser` | `TasCurrentUser` | Yes | Current user info (name, lastname, role) |
149
+ | `ownerUserIds` | `number[]` | Yes | Array with exactly one owner user ID |
150
+ | `regularUserIds` | `number[]` | No | Array of regular participant user IDs |
151
+ | `moderatorUserIds` | `number[]` | No | Array of moderator user IDs |
152
+
153
+ ### TasCurrentUser Interface
254
154
 
255
155
  ```typescript
256
- {
257
- sessionId: string;
156
+ interface TasCurrentUser {
258
157
  name: string;
259
158
  lastname: string;
159
+ role: TasUserRole; // 'OWNER' | 'USER' | 'MODERATOR'
260
160
  }
261
161
  ```
262
162
 
263
- ## Styling
163
+ ## Exported Components
264
164
 
265
- The library includes default styles for all components. You may need to add global styles for the modal:
165
+ - `TasButtonComponent` - Button to initiate video calls
166
+ - `TasVideocallComponent` - Full-screen video call interface
167
+ - `TasWaitingRoomComponent` - Pre-call waiting room
168
+ - `TasFloatingCallComponent` - Picture-in-Picture floating window
266
169
 
267
- ```scss
268
- // styles.scss
269
- ngb-modal-window.tas-video-modal {
270
- .modal-dialog {
271
- max-width: 100vw;
272
- height: 100vh;
273
- margin: 0;
274
- }
275
- .modal-content {
276
- background-color: transparent;
277
- border: none;
278
- height: 100%;
279
- }
280
- }
281
- ```
170
+ ## Exported Services
282
171
 
283
- ## Building the Library
172
+ - `TasService` - Core service for managing video sessions
284
173
 
285
- ```bash
286
- cd TAS-Uell-SDK
287
- npm install
288
- npm run build
289
- ```
174
+ ## Exported Interfaces & Types
290
175
 
291
- The built library will be in the `dist/` folder.
176
+ - `TasConfig`
177
+ - `TasHttpClient`
178
+ - `TasCurrentUser`
179
+ - `CreateRoomRequest`
180
+ - `CreateRoomResponse`
181
+ - `GenerateTokenRequest`
182
+ - `GenerateTokenResponse`
183
+ - `TasRoomType`
184
+ - `TasSessionType`
185
+ - `TasUserRole`
186
+ - `CallState`
187
+ - `ViewMode`
292
188
 
293
- ## Publishing
189
+ ## Building the Library
294
190
 
295
191
  ```bash
296
- cd dist/tas-uell-sdk
297
- npm publish
192
+ ng build tas-uell-sdk --configuration=production
298
193
  ```
299
194
 
300
195
  ## License
301
196
 
302
197
  MIT
303
-
304
-