tas-uell-sdk 0.0.6 → 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.
@@ -11,11 +11,13 @@ export declare class TasButtonComponent implements OnInit, OnDestroy {
11
11
  tenant: string;
12
12
  businessRole: TasBusinessRole;
13
13
  currentUser: TasCurrentUser;
14
+ variant: 'default' | 'teal';
15
+ buttonLabel: string;
14
16
  isLoading: boolean;
15
- readonly buttonText = "Iniciar TAS";
16
17
  isCheckingStatus: boolean;
17
18
  isStatusError: boolean;
18
19
  statusErrorMessage: string;
20
+ isJoinable: boolean;
19
21
  private subscriptions;
20
22
  private currentModalRef;
21
23
  private videoCallModalRef;
@@ -23,10 +25,10 @@ export declare class TasButtonComponent implements OnInit, OnDestroy {
23
25
  private readonly STATUS_POLL_INTERVAL_MS;
24
26
  /** Whether user is backoffice (or admin/manager) */
25
27
  get isBackoffice(): boolean;
26
- /** Whether the button should be visible */
27
- get isVisible(): boolean;
28
28
  /** Whether the button should be disabled */
29
29
  get isDisabled(): boolean;
30
+ /** Reason why the button is disabled (for tooltip) */
31
+ get disabledReason(): string;
30
32
  constructor(modalService: NgbModal, tasService: TasService);
31
33
  ngOnInit(): void;
32
34
  ngOnDestroy(): void;
@@ -46,5 +48,5 @@ export declare class TasButtonComponent implements OnInit, OnDestroy {
46
48
  private openWaitingRoomModal;
47
49
  private openVideoCallModal;
48
50
  static ɵfac: i0.ɵɵFactoryDeclaration<TasButtonComponent, never>;
49
- static ɵcmp: i0.ɵɵComponentDeclaration<TasButtonComponent, "tas-btn", never, { "roomType": "roomType"; "entityId": "entityId"; "tenant": "tenant"; "businessRole": "businessRole"; "currentUser": "currentUser"; }, {}, never, never>;
51
+ static ɵcmp: i0.ɵɵComponentDeclaration<TasButtonComponent, "tas-btn", never, { "roomType": "roomType"; "entityId": "entityId"; "tenant": "tenant"; "businessRole": "businessRole"; "currentUser": "currentUser"; "variant": "variant"; "buttonLabel": "buttonLabel"; }, {}, never, never>;
50
52
  }
@@ -0,0 +1,33 @@
1
+ import { OnInit, OnDestroy, EventEmitter } from '@angular/core';
2
+ import { TasService } from '../../services/tas.service';
3
+ import { TasAppointment, TasRoomType, TasBusinessRole, TasCurrentUser } from '../../interfaces/tas.interfaces';
4
+ import * as i0 from "@angular/core";
5
+ export declare class TasIncomingAppointmentComponent implements OnInit, OnDestroy {
6
+ private tasService;
7
+ roomType: TasRoomType;
8
+ entityId: number;
9
+ tenant: string;
10
+ businessRole: TasBusinessRole;
11
+ currentUser: TasCurrentUser;
12
+ enterCall: EventEmitter<TasAppointment>;
13
+ appointment: TasAppointment | null;
14
+ isLoading: boolean;
15
+ hasError: boolean;
16
+ private subscriptions;
17
+ constructor(tasService: TasService);
18
+ ngOnInit(): void;
19
+ ngOnDestroy(): void;
20
+ private loadAppointments;
21
+ onEnterCall(): void;
22
+ /**
23
+ * Format date to Spanish format: "Lunes 8 de diciembre"
24
+ */
25
+ get formattedDate(): string;
26
+ /**
27
+ * Format time range: "9:00 - 9:30"
28
+ */
29
+ get formattedTimeRange(): string;
30
+ private formatDate;
31
+ static ɵfac: i0.ɵɵFactoryDeclaration<TasIncomingAppointmentComponent, never>;
32
+ static ɵcmp: i0.ɵɵComponentDeclaration<TasIncomingAppointmentComponent, "tas-incoming-appointment", never, { "roomType": "roomType"; "entityId": "entityId"; "tenant": "tenant"; "businessRole": "businessRole"; "currentUser": "currentUser"; }, { "enterCall": "enterCall"; }, never, never>;
33
+ }
@@ -1,15 +1,18 @@
1
1
  import { OnInit, OnDestroy, ElementRef, AfterViewInit } from '@angular/core';
2
2
  import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
3
3
  import { TasService } from '../../services/tas.service';
4
+ import { GeolocationService } from '../../services/geolocation.service';
4
5
  import { CallState, TasBusinessRole, WaitingRoomUser } from '../../interfaces/tas.interfaces';
5
6
  import * as i0 from "@angular/core";
6
7
  export declare class TasVideocallComponent implements OnInit, OnDestroy, AfterViewInit {
7
8
  activeModal: NgbActiveModal;
8
9
  private tasService;
10
+ private geolocationService;
9
11
  sessionId: string;
10
12
  token: string;
11
13
  appointmentId?: number;
12
14
  videoCallId?: number;
15
+ userId?: number;
13
16
  participantName: string;
14
17
  tenant: string;
15
18
  businessRole: TasBusinessRole;
@@ -23,8 +26,13 @@ export declare class TasVideocallComponent implements OnInit, OnDestroy, AfterVi
23
26
  ownerHasJoined: boolean;
24
27
  hasVideoStream: boolean;
25
28
  dismissedUsers: number[];
29
+ showLocationPanel: boolean;
30
+ userHasLocation: boolean;
31
+ geoLocationStatus: 'unknown' | 'active' | 'denied';
32
+ geoRequestActive: boolean;
33
+ allGeoGranted: boolean;
26
34
  private subscriptions;
27
- constructor(activeModal: NgbActiveModal, tasService: TasService);
35
+ constructor(activeModal: NgbActiveModal, tasService: TasService, geolocationService: GeolocationService);
28
36
  ngOnInit(): void;
29
37
  ngAfterViewInit(): void;
30
38
  ngOnDestroy(): void;
@@ -45,10 +53,27 @@ export declare class TasVideocallComponent implements OnInit, OnDestroy, AfterVi
45
53
  * Dismiss the waiting room notification for a user
46
54
  */
47
55
  dismissWaitingNotification(userId: number): void;
56
+ /**
57
+ * Close the location panel
58
+ */
59
+ closeLocationPanel(): void;
60
+ /**
61
+ * Request the user to share their location
62
+ */
63
+ requestUserLocation(): void;
48
64
  private setupSubscriptions;
65
+ /**
66
+ * Handle activateGeo request from backend (for non-owner users).
67
+ * If geo is already active, report it. If not, prompt user.
68
+ */
69
+ private handleActivateGeo;
70
+ /**
71
+ * Report geolocation status to backend.
72
+ */
73
+ private reportGeoStatus;
49
74
  private initializeCall;
50
75
  private resetVideoPositions;
51
76
  private initInteract;
52
77
  static ɵfac: i0.ɵɵFactoryDeclaration<TasVideocallComponent, never>;
53
- static ɵcmp: i0.ɵɵComponentDeclaration<TasVideocallComponent, "tas-videocall", never, { "sessionId": "sessionId"; "token": "token"; "appointmentId": "appointmentId"; "videoCallId": "videoCallId"; "participantName": "participantName"; "tenant": "tenant"; "businessRole": "businessRole"; "isReturningFromPip": "isReturningFromPip"; }, {}, never, never>;
78
+ static ɵcmp: i0.ɵɵComponentDeclaration<TasVideocallComponent, "tas-videocall", never, { "sessionId": "sessionId"; "token": "token"; "appointmentId": "appointmentId"; "videoCallId": "videoCallId"; "userId": "userId"; "participantName": "participantName"; "tenant": "tenant"; "businessRole": "businessRole"; "isReturningFromPip": "isReturningFromPip"; }, {}, never, never>;
54
79
  }
@@ -1,18 +1,21 @@
1
1
  import { OnInit, OnDestroy, ChangeDetectorRef } from '@angular/core';
2
2
  import { NgbActiveModal, NgbModal } from '@ng-bootstrap/ng-bootstrap';
3
3
  import { TasService } from '../../services/tas.service';
4
+ import { GeolocationService } from '../../services/geolocation.service';
4
5
  import { TasCurrentUser, TasRoomType, TasBusinessRole } from '../../interfaces/tas.interfaces';
5
6
  import * as i0 from "@angular/core";
6
7
  export declare enum WaitingRoomState {
7
8
  CHECKING_STATUS = "CHECKING_STATUS",
8
- WAITING_FOR_OWNER = "WAITING_FOR_OWNER",
9
+ WAITING_FOR_JOINABLE = "WAITING_FOR_JOINABLE",
9
10
  READY = "READY",
10
11
  GETTING_TOKEN = "GETTING_TOKEN",
12
+ JOINING = "JOINING",
11
13
  ERROR = "ERROR"
12
14
  }
13
15
  export declare class TasWaitingRoomComponent implements OnInit, OnDestroy {
14
16
  activeModal: NgbActiveModal;
15
17
  private tasService;
18
+ private geolocationService;
16
19
  private modalService;
17
20
  private cdr;
18
21
  roomType: TasRoomType;
@@ -23,16 +26,33 @@ export declare class TasWaitingRoomComponent implements OnInit, OnDestroy {
23
26
  state: WaitingRoomState;
24
27
  WaitingRoomState: typeof WaitingRoomState;
25
28
  errorMessage: string;
29
+ isJoinable: boolean;
26
30
  private resolvedSessionId;
27
31
  private resolvedAppointmentId;
28
32
  private token;
29
33
  private videoCallId;
30
34
  private subscriptions;
31
35
  private videoCallModalRef;
36
+ private geoPosition;
32
37
  /** Whether current user is an owner */
33
38
  get isOwner(): boolean;
34
- constructor(activeModal: NgbActiveModal, tasService: TasService, modalService: NgbModal, cdr: ChangeDetectorRef);
39
+ constructor(activeModal: NgbActiveModal, tasService: TasService, geolocationService: GeolocationService, modalService: NgbModal, cdr: ChangeDetectorRef);
35
40
  ngOnInit(): void;
41
+ /**
42
+ * Request camera and microphone permissions.
43
+ */
44
+ private requestMediaPermissions;
45
+ /**
46
+ * Request geolocation immediately on init.
47
+ * Only for regular users (not owners/backoffice).
48
+ * If user allows, store position and send to backend.
49
+ */
50
+ private requestGeolocation;
51
+ /**
52
+ * Send geolocation to backend via modify user endpoint.
53
+ * NOTE: Endpoint call is prepared but may not be active yet.
54
+ */
55
+ private sendGeolocationToBackend;
36
56
  ngOnDestroy(): void;
37
57
  /**
38
58
  * Check status to get session info
@@ -43,17 +63,18 @@ export declare class TasWaitingRoomComponent implements OnInit, OnDestroy {
43
63
  */
44
64
  private handleJoinableChange;
45
65
  /**
46
- * Check if user has owner/backoffice role
66
+ * Called when user clicks the join button.
67
+ * Calls /start to get token then auto-joins.
47
68
  */
48
- private get isBackoffice();
69
+ joinSession(): void;
49
70
  /**
50
- * Get token for owner/backoffice - call /start endpoint
71
+ * Check if user has owner/backoffice role
51
72
  */
52
- private getTokenForOwner;
73
+ private get isBackoffice();
53
74
  /**
54
- * Join the session - token already obtained
75
+ * Start session and join - called when user clicks join button
55
76
  */
56
- joinSession(): void;
77
+ private startSessionAndJoin;
57
78
  /**
58
79
  * Closes the waiting room
59
80
  */
@@ -13,6 +13,9 @@ export interface TasConfig {
13
13
  * HTTP client interface that consuming apps must implement
14
14
  */
15
15
  export interface TasHttpClient {
16
+ get<T>(url: string, options: {
17
+ headers?: Record<string, string>;
18
+ }): Observable<T>;
16
19
  post<T>(url: string, options: {
17
20
  body: any;
18
21
  headers?: Record<string, string>;
@@ -56,6 +56,7 @@ export declare enum ViewMode {
56
56
  PIP = "PIP"
57
57
  }
58
58
  export interface TasCurrentUser {
59
+ id: number;
59
60
  name: string;
60
61
  lastname: string;
61
62
  role: TasUserRole;
@@ -108,6 +109,8 @@ export interface ProxyVideoStatusResponse {
108
109
  waitingRoomAvailable: boolean;
109
110
  appointmentId: number;
110
111
  activateGeo: boolean;
112
+ geoRequestActive?: boolean;
113
+ allGeoGranted?: boolean;
111
114
  users: ProxyVideoStatusUser[];
112
115
  };
113
116
  }
@@ -122,13 +125,34 @@ export interface FinishSessionResponse {
122
125
  };
123
126
  }
124
127
  export interface ProxyVideoUserModifyRequest {
125
- userId: number;
128
+ userId?: number;
126
129
  videoCallId: number;
127
- action: UserCallAction;
130
+ action?: UserCallAction;
128
131
  newStatus?: RoomUserStatus;
132
+ latitude?: number;
133
+ longitude?: number;
129
134
  }
130
135
  export interface WaitingRoomUser {
131
136
  userId: number;
132
137
  name: string;
133
138
  status: RoomUserStatus;
134
139
  }
140
+ export declare enum AppointmentStatus {
141
+ CONFIRMED = "CONFIRMED",
142
+ CANCELLED = "CANCELLED"
143
+ }
144
+ export interface TasAppointment {
145
+ id: number;
146
+ agendaId: number;
147
+ date: string;
148
+ startTime: string;
149
+ endTime: string;
150
+ bookingType: string;
151
+ status: AppointmentStatus;
152
+ title: string;
153
+ notes: string;
154
+ }
155
+ export interface GetAppointmentsRequest {
156
+ fromDate: string;
157
+ toDate: string;
158
+ }
@@ -0,0 +1,24 @@
1
+ import * as i0 from "@angular/core";
2
+ export interface GeoPosition {
3
+ latitude: number;
4
+ longitude: number;
5
+ }
6
+ export declare class GeolocationService {
7
+ private cachedPosition;
8
+ /**
9
+ * Request current geolocation position using Web Geolocation API.
10
+ * Works in both browser and Capacitor environments.
11
+ * @returns Promise with {latitude, longitude} or null if denied/unavailable
12
+ */
13
+ getCurrentPosition(): Promise<GeoPosition | null>;
14
+ /**
15
+ * Get the cached position from the last successful request.
16
+ */
17
+ getCachedPosition(): GeoPosition | null;
18
+ /**
19
+ * Clear the cached position.
20
+ */
21
+ clearCache(): void;
22
+ static ɵfac: i0.ɵɵFactoryDeclaration<GeolocationService, never>;
23
+ static ɵprov: i0.ɵɵInjectableDeclaration<GeolocationService>;
24
+ }
@@ -1,6 +1,6 @@
1
1
  import { Observable } from 'rxjs';
2
2
  import * as OT from '@opentok/client';
3
- import { GenerateTokenResponse, StartSessionRequest, FinishSessionResponse, ProxyVideoStatusRequest, ProxyVideoStatusResponse, ProxyVideoFinishRequest, ProxyVideoUserModifyRequest, UserCallAction, RoomUserStatus, TasBusinessRole, CallState, ViewMode, WaitingRoomUser } from '../interfaces/tas.interfaces';
3
+ import { GenerateTokenResponse, StartSessionRequest, FinishSessionResponse, ProxyVideoStatusRequest, ProxyVideoStatusResponse, ProxyVideoFinishRequest, ProxyVideoUserModifyRequest, UserCallAction, RoomUserStatus, TasBusinessRole, CallState, ViewMode, WaitingRoomUser, TasAppointment, GetAppointmentsRequest } from '../interfaces/tas.interfaces';
4
4
  import { TasConfig, TasHttpClient } from '../config/tas.config';
5
5
  import * as i0 from "@angular/core";
6
6
  export { CallState, ViewMode, TasBusinessRole, UserCallAction, RoomUserStatus };
@@ -32,6 +32,12 @@ export declare class TasService {
32
32
  ownerHasLeft$: Observable<boolean>;
33
33
  private joinableSubject;
34
34
  joinable$: Observable<boolean>;
35
+ private activateGeoSubject;
36
+ activateGeo$: Observable<boolean>;
37
+ private geoRequestActiveSubject;
38
+ geoRequestActive$: Observable<boolean>;
39
+ private allGeoGrantedSubject;
40
+ allGeoGranted$: Observable<boolean>;
35
41
  private statusPollingInterval;
36
42
  private readonly DEFAULT_POLL_INTERVAL_MS;
37
43
  private wasOwnerPresent;
@@ -87,6 +93,12 @@ export declare class TasService {
87
93
  */
88
94
  modifyProxyVideoUser(payload: ProxyVideoUserModifyRequest): Observable<any>;
89
95
  finishProxyVideoSession(payload: ProxyVideoFinishRequest): Observable<FinishSessionResponse>;
96
+ /**
97
+ * Get user appointments within a date range.
98
+ * @param params Date range for querying appointments
99
+ * @returns Observable of appointment array
100
+ */
101
+ getAppointments(params: GetAppointmentsRequest): Observable<TasAppointment[]>;
90
102
  /**
91
103
  * Start automatic status polling for the current session.
92
104
  * Status is polled every STATUS_POLL_INTERVAL_MS milliseconds.
@@ -6,8 +6,10 @@ import * as i2 from "./components/tas-videocall/tas-videocall.component";
6
6
  import * as i3 from "./components/tas-floating-call/tas-floating-call.component";
7
7
  import * as i4 from "./components/tas-waiting-room/tas-waiting-room.component";
8
8
  import * as i5 from "./components/tas-avatar/tas-avatar.component";
9
- import * as i6 from "@angular/common";
10
- import * as i7 from "@angular/forms";
9
+ import * as i6 from "./components/tas-incoming-appointment/tas-incoming-appointment.component";
10
+ import * as i7 from "@angular/common";
11
+ import * as i8 from "@angular/forms";
12
+ import * as i9 from "@ng-bootstrap/ng-bootstrap";
11
13
  export declare class TasUellSdkModule {
12
14
  /**
13
15
  * Use forRoot() to configure the TAS SDK module with required dependencies.
@@ -43,6 +45,6 @@ export declare class TasUellSdkModule {
43
45
  httpClient: new (...args: any[]) => TasHttpClient;
44
46
  }): ModuleWithProviders<TasUellSdkModule>;
45
47
  static ɵfac: i0.ɵɵFactoryDeclaration<TasUellSdkModule, never>;
46
- static ɵmod: i0.ɵɵNgModuleDeclaration<TasUellSdkModule, [typeof i1.TasButtonComponent, typeof i2.TasVideocallComponent, typeof i3.TasFloatingCallComponent, typeof i4.TasWaitingRoomComponent, typeof i5.TasAvatarComponent], [typeof i6.CommonModule, typeof i7.FormsModule], [typeof i1.TasButtonComponent, typeof i2.TasVideocallComponent, typeof i3.TasFloatingCallComponent, typeof i4.TasWaitingRoomComponent, typeof i5.TasAvatarComponent]>;
48
+ static ɵmod: i0.ɵɵNgModuleDeclaration<TasUellSdkModule, [typeof i1.TasButtonComponent, typeof i2.TasVideocallComponent, typeof i3.TasFloatingCallComponent, typeof i4.TasWaitingRoomComponent, typeof i5.TasAvatarComponent, typeof i6.TasIncomingAppointmentComponent], [typeof i7.CommonModule, typeof i8.FormsModule, typeof i9.NgbTooltipModule], [typeof i1.TasButtonComponent, typeof i2.TasVideocallComponent, typeof i3.TasFloatingCallComponent, typeof i4.TasWaitingRoomComponent, typeof i5.TasAvatarComponent, typeof i6.TasIncomingAppointmentComponent]>;
47
49
  static ɵinj: i0.ɵɵInjectorDeclaration<TasUellSdkModule>;
48
50
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tas-uell-sdk",
3
- "version": "0.0.6",
3
+ "version": "0.1.0",
4
4
  "description": "TAS (Telemedicine Assistance Service) SDK for Angular applications - Video call functionality using TokBox/Vonage",
5
5
  "peerDependencies": {
6
6
  "@angular/common": "^13.0.0 || ^14.0.0 || ^15.0.0 || ^16.0.0",
package/public-api.d.ts CHANGED
@@ -1,9 +1,11 @@
1
1
  export * from './lib/config/tas.config';
2
2
  export * from './lib/interfaces/tas.interfaces';
3
3
  export * from './lib/services/tas.service';
4
+ export * from './lib/services/geolocation.service';
4
5
  export * from './lib/components/tas-btn/tas-btn.component';
5
6
  export * from './lib/components/tas-waiting-room/tas-waiting-room.component';
6
7
  export * from './lib/components/tas-videocall/tas-videocall.component';
7
8
  export * from './lib/components/tas-floating-call/tas-floating-call.component';
8
9
  export * from './lib/components/tas-avatar/tas-avatar.component';
10
+ export * from './lib/components/tas-incoming-appointment/tas-incoming-appointment.component';
9
11
  export * from './lib/tas-uell-sdk.module';