@snapcall/stream-ui 1.25.0 → 1.25.1

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 (2) hide show
  1. package/dist/types.d.ts +688 -0
  2. package/package.json +3 -3
@@ -0,0 +1,688 @@
1
+ import * as mediasoupClient from "mediasoup-client";
2
+ import { types } from "mediasoup-client";
3
+ import * as protooClient from "protoo-client";
4
+ import { Transport } from "mediasoup-client/lib/Transport";
5
+ import { CSSProperties } from "react";
6
+ type VideoResolution = 'qvga' | 'vga' | 'hd';
7
+ type PeerId = string;
8
+ type DeviceType = 'webcam' | 'screen' | 'microphone';
9
+ interface Profile {
10
+ name?: string;
11
+ image?: string;
12
+ }
13
+ interface Step {
14
+ type: 'video' | 'audio' | 'screen' | 'image';
15
+ token: string;
16
+ title: string;
17
+ description: string;
18
+ image_url: string;
19
+ translation: {
20
+ title?: string;
21
+ description?: string;
22
+ button?: string;
23
+ languageCode?: string;
24
+ };
25
+ }
26
+ interface Flow {
27
+ token: string;
28
+ name: string;
29
+ is_default: number;
30
+ steps: Array<Step>;
31
+ }
32
+ interface FlowV0 {
33
+ logo_url?: string;
34
+ image_url?: string;
35
+ title?: string;
36
+ text?: string;
37
+ }
38
+ interface InitResult {
39
+ flow?: Flow;
40
+ flowV0?: FlowV0;
41
+ }
42
+ interface JoinOptions {
43
+ languageCode?: string;
44
+ flowToken?: string;
45
+ recorder?: boolean;
46
+ apiKey?: string;
47
+ email?: string;
48
+ displayName?: string;
49
+ profile?: Profile;
50
+ authKey?: string;
51
+ }
52
+ interface PeerState {
53
+ peerId: string;
54
+ profile: Profile;
55
+ deviceState: DevicesState;
56
+ }
57
+ interface CompanyInfo {
58
+ name?: string;
59
+ company_name?: string;
60
+ avatar_url?: string;
61
+ terminate_enabled?: boolean;
62
+ }
63
+ type WaitingRequests = Array<{
64
+ id: string;
65
+ profile?: Profile;
66
+ }>;
67
+ interface GetRoomPeersResult {
68
+ peers: Array<{
69
+ id: string;
70
+ displayName?: string;
71
+ profile: Profile;
72
+ muted: boolean;
73
+ producersIds: string[];
74
+ producersData: ProducerData[];
75
+ }>;
76
+ videoRecordStarted: boolean;
77
+ videoRecording: {
78
+ requested: boolean;
79
+ started: boolean;
80
+ };
81
+ }
82
+ interface StreamerState extends PeerState {
83
+ roomId: string;
84
+ plan?: string;
85
+ permissions: Permissions;
86
+ company?: CompanyInfo;
87
+ companyId: number;
88
+ waitingRoomAccess: boolean;
89
+ peers: Array<PeerState>;
90
+ joinOptions: JoinOptions;
91
+ }
92
+ interface ProducerData {
93
+ producerId: string;
94
+ deviceType: DeviceType;
95
+ paused: boolean;
96
+ }
97
+ interface PeerInfo {
98
+ id?: PeerId;
99
+ peerId: PeerId;
100
+ muted: boolean;
101
+ profile: Profile;
102
+ displayName?: string;
103
+ producersData: Array<ProducerData>;
104
+ }
105
+ type ConsumerId = string;
106
+ type ProducerId = string;
107
+ interface ConsumerData {
108
+ mediaSoupConsumer: types.Consumer;
109
+ deviceType?: DeviceType;
110
+ }
111
+ interface DevicesState {
112
+ microphone: {
113
+ enabled: boolean;
114
+ muted: boolean;
115
+ device?: MediaDeviceInfo | null;
116
+ };
117
+ camera: {
118
+ enabled: boolean;
119
+ device?: MediaDeviceInfo | null;
120
+ };
121
+ screenshare: {
122
+ enabled: boolean;
123
+ };
124
+ }
125
+ interface Config {
126
+ apiUrl: string;
127
+ streamerServer: string;
128
+ streamerApi: string;
129
+ iceServers: RTCIceServer[];
130
+ streamApiURL: string;
131
+ }
132
+ type Permission = 'share_link' | 'direct_pay' | 'quick_connect' | 'virtual_background' | 'screen_sharing' | 'instant_picture' | 'request_input' | 'recording' | 'record_video_on_demand';
133
+ type Permissions = Array<Permission>;
134
+ declare global {
135
+ interface Window {
136
+ webkitAudioContext: Function;
137
+ }
138
+ interface MediaTrackConstraintSet {
139
+ displaySurface?: ConstrainDOMString;
140
+ logicalSurface?: ConstrainBoolean;
141
+ zoom?: number;
142
+ focusMode?: 'none' | 'manual' | 'single-shot' | 'continuous';
143
+ }
144
+ interface MediaTrackCapabilities {
145
+ zoom: {
146
+ min: number;
147
+ max: number;
148
+ step: number;
149
+ };
150
+ focusMode?: Array<'none' | 'manual' | 'single-shot' | 'continuous'>;
151
+ }
152
+ }
153
+ interface MenuItem {
154
+ id: string;
155
+ title: string;
156
+ jsxIcon?: JSX.Element;
157
+ srcIcon?: string;
158
+ action: () => void;
159
+ danger?: boolean;
160
+ isNew?: boolean;
161
+ }
162
+ interface MenuCategory {
163
+ id: string;
164
+ title?: string;
165
+ items: MenuItem[];
166
+ }
167
+ type DisplayType = 'icon' | 'full';
168
+ interface SettingShortcut {
169
+ id: string;
170
+ displayType: DisplayType;
171
+ }
172
+ interface SettingsCategory extends MenuCategory {
173
+ position?: number;
174
+ items: SettingsItem[];
175
+ }
176
+ interface SettingsItem extends MenuItem {
177
+ position?: number;
178
+ }
179
+ interface AudioLevelListener {
180
+ onAudioLevel?(audioLevel: number, id: string): void;
181
+ onMuteDetection?(id: string): void;
182
+ onStartSpeak(): void;
183
+ onStopSpeak(): void;
184
+ }
185
+ declare class AudioLevel {
186
+ readonly id: string;
187
+ constructor(stream: MediaStream, listener?: AudioLevelListener);
188
+ /**
189
+ * return the median of the audio levels (60 per second) for the
190
+ * current second
191
+ */
192
+ getAudioLevelMedian(): number;
193
+ getCurrentAudioLevel(): number;
194
+ analyse(): void;
195
+ startAverageAnalysis(): void;
196
+ stopAverageAnalysis(): number;
197
+ getFrequencyData(): Uint8Array;
198
+ clearListeners(): void;
199
+ release(): void;
200
+ static isAPIAvailable(): boolean;
201
+ }
202
+ declare class AudioRenderer {
203
+ constructor({ consumerId }: {
204
+ consumerId: string;
205
+ });
206
+ destroy(): void;
207
+ setSource(srcObject: MediaStream): void;
208
+ setSink(sinkId: string): Promise<void>;
209
+ getSink(): string;
210
+ play(): Promise<void>;
211
+ }
212
+ interface MediapipeOptions {
213
+ type: 'blur' | 'background';
214
+ fillColor?: string;
215
+ background?: CanvasImageSource;
216
+ blurLevel?: number;
217
+ }
218
+ interface DeviceRequest {
219
+ requestId: string;
220
+ deviceType: DeviceType;
221
+ }
222
+ interface CustomMessage {
223
+ chunks: Array<{
224
+ index: number;
225
+ data: string;
226
+ }>;
227
+ totalChunks: number;
228
+ }
229
+ declare global {
230
+ export namespace SnapCall {
231
+ export { Permissions, Permission };
232
+ export type SnapcallEvent<T> = CustomEvent<T>;
233
+ export type PeersInfoEvent = SnapcallEvent<{
234
+ videoRecordStarted: boolean;
235
+ videoRecording?: {
236
+ requested: boolean;
237
+ started: boolean;
238
+ };
239
+ peerId: string;
240
+ plan?: string;
241
+ permissions: Permissions;
242
+ peers: {
243
+ peerId: string;
244
+ muted: boolean;
245
+ displayName?: string;
246
+ profile: Profile;
247
+ }[];
248
+ }>;
249
+ export type PeerInfoEvent = SnapcallEvent<{
250
+ peerId: string;
251
+ displayName?: string;
252
+ profile: Profile;
253
+ }>;
254
+ export type RequestAccessEvent = SnapcallEvent<{
255
+ success: string;
256
+ message?: string;
257
+ }>;
258
+ export type RequestAccessRequestEvent = SnapcallEvent<WaitingRequests[number]>;
259
+ export type RequestAccessCancelEvent = SnapcallEvent<{
260
+ id: string;
261
+ }>;
262
+ export type ProfileUpdateEvent = SnapcallEvent<{
263
+ peerId: string;
264
+ profile: Profile;
265
+ }>;
266
+ export type RequestDeviceEvent = SnapcallEvent<{
267
+ peerId: string;
268
+ deviceType: DeviceType;
269
+ }>;
270
+ export type RequestDeviceResultEvent = SnapcallEvent<{
271
+ result: {
272
+ peerId: string;
273
+ result: boolean;
274
+ };
275
+ }>;
276
+ export type BaseEvent = SnapcallEvent<{}>;
277
+ export type StreamEvent = SnapcallEvent<{
278
+ peerId: string;
279
+ }>;
280
+ export type RequestResultEvent = SnapcallEvent<{
281
+ success: Boolean;
282
+ }>;
283
+ export type AudioDeviceEvent = SnapcallEvent<MediaDeviceInfo>;
284
+ export type MediaEvent = SnapcallEvent<{
285
+ peerId: string;
286
+ mediaId?: string;
287
+ deviceType: DeviceType;
288
+ paused: boolean;
289
+ }>;
290
+ export type WebcamUpdateEvent = SnapcallEvent<{
291
+ numberOfAvailableWebcams: number;
292
+ }>;
293
+ export type CriticalErrorEvent = SnapcallEvent<{
294
+ code: string;
295
+ }>;
296
+ export type CustomMessageEvent = SnapcallEvent<{
297
+ peerId: string;
298
+ event: {
299
+ type: string;
300
+ } & Record<string, any>;
301
+ }>;
302
+ export type localVideoChangeEvent = SnapcallEvent<{
303
+ camera: {
304
+ device: MediaDeviceInfo | null;
305
+ resolution: VideoResolution;
306
+ };
307
+ }>;
308
+ export type AgentIdentityEvent = SnapcallEvent<{
309
+ success: boolean;
310
+ email?: string;
311
+ name?: string;
312
+ avatarUrl?: string;
313
+ }>;
314
+ export type RecordStoppedEvent = SnapcallEvent<{
315
+ url: string;
316
+ assetId: number;
317
+ }>;
318
+ export type AudioLevelEvent = SnapcallEvent<{
319
+ audioLevel: number;
320
+ }>;
321
+ export type InitializedEvent = SnapcallEvent<InitResult>;
322
+ }
323
+ export interface PublicPage {
324
+ token: string;
325
+ logo_url: string;
326
+ title: string;
327
+ description: string;
328
+ data: {
329
+ links: {
330
+ id: 'recordVideo' | 'takePicture' | 'scheduleCall' | 'recordScreen';
331
+ active: boolean;
332
+ user_ids?: number[];
333
+ team_ids?: number[];
334
+ schedule_ids?: string[];
335
+ }[];
336
+ };
337
+ }
338
+ }
339
+ interface StreamerEventMap {
340
+ audioLevel: SnapCall.AudioLevelEvent['detail'];
341
+ localStartSpeak?: SnapCall.BaseEvent['detail'];
342
+ localStopSpeak?: SnapCall.BaseEvent['detail'];
343
+ leaveRoom: SnapCall.BaseEvent['detail'];
344
+ terminateRoom: SnapCall.BaseEvent['detail'];
345
+ invalidRoom: SnapCall.BaseEvent['detail'];
346
+ accessRequest: SnapCall.RequestAccessRequestEvent['detail'];
347
+ cancelAccessRequest: SnapCall.RequestAccessCancelEvent['detail'];
348
+ requestAccessResult: SnapCall.RequestAccessEvent['detail'];
349
+ localVideoUnavailable: SnapCall.BaseEvent['detail'];
350
+ localVideoAvailable: SnapCall.BaseEvent['detail'];
351
+ microphoneEnabled: SnapCall.BaseEvent['detail'];
352
+ agentIdentity: SnapCall.AgentIdentityEvent['detail'];
353
+ peerClosed: SnapCall.StreamEvent['detail'];
354
+ newPeer: SnapCall.PeerInfoEvent['detail'];
355
+ selfDisplayName: SnapCall.PeerInfoEvent['detail'];
356
+ selfProfileUpdate: SnapCall.ProfileUpdateEvent['detail'];
357
+ profileUpdate: SnapCall.ProfileUpdateEvent['detail'];
358
+ webcamsUpdate: SnapCall.WebcamUpdateEvent['detail'];
359
+ customMessage: SnapCall.CustomMessageEvent['detail'];
360
+ mediaStart: SnapCall.MediaEvent['detail'];
361
+ mediaStop: SnapCall.MediaEvent['detail'];
362
+ mediaPause: SnapCall.MediaEvent['detail'];
363
+ mediaResume: SnapCall.MediaEvent['detail'];
364
+ microphoneMute: SnapCall.BaseEvent['detail'];
365
+ microphoneUnmute: SnapCall.BaseEvent['detail'];
366
+ defaultAudioDeviceChange: SnapCall.AudioDeviceEvent['detail'];
367
+ screenshareEnabled: SnapCall.BaseEvent['detail'];
368
+ screenshareDisabled: SnapCall.BaseEvent['detail'];
369
+ localVideoRotate: SnapCall.BaseEvent['detail'];
370
+ enterRoom: SnapCall.PeersInfoEvent['detail'];
371
+ displayName: SnapCall.PeerInfoEvent['detail'];
372
+ peerStartSpeak: SnapCall.StreamEvent['detail'];
373
+ peerStopSpeak: SnapCall.StreamEvent['detail'];
374
+ criticalError: SnapCall.CriticalErrorEvent['detail'];
375
+ requestDevice: SnapCall.RequestDeviceEvent['detail'];
376
+ requestDeviceResult: SnapCall.RequestDeviceResultEvent['detail'];
377
+ devicesListChange: SnapCall.BaseEvent['detail'];
378
+ localVideoChange: SnapCall.localVideoChangeEvent['detail'];
379
+ recordStopped: SnapCall.RecordStoppedEvent['detail'];
380
+ videoRecordingStarted: SnapCall.BaseEvent['detail'];
381
+ videoRecordingStopped: SnapCall.BaseEvent['detail'];
382
+ videoRecordingRequested: SnapCall.BaseEvent['detail'];
383
+ initialized: SnapCall.InitializedEvent['detail'];
384
+ }
385
+ declare class SnapcallEvent<T extends keyof StreamerEventMap> extends CustomEvent<StreamerEventMap[T]> {
386
+ constructor(name: T, data: CustomEventInit & {
387
+ detail: StreamerEventMap[T];
388
+ });
389
+ }
390
+ interface StreamerEventTarget extends EventTarget {
391
+ addEventListener<T extends keyof StreamerEventMap>(type: T, listener: (event: CustomEvent<StreamerEventMap[T]>) => void, options?: boolean | AddEventListenerOptions): void;
392
+ addEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: EventListenerOptions | boolean): void;
393
+ removeEventListener<T extends keyof StreamerEventMap>(type: T, listener: (event: CustomEvent<StreamerEventMap[T]>) => void): void;
394
+ removeEventListener(type: string, callback: EventListenerOrEventListenerObject | null): void;
395
+ dispatchEvent<T extends keyof StreamerEventMap>(ev: SnapcallEvent<T>): boolean;
396
+ }
397
+ declare const StreamerEventTargetType: {
398
+ new (): StreamerEventTarget;
399
+ prototype: StreamerEventTarget;
400
+ };
401
+ declare class StreamerClient extends StreamerEventTargetType implements AudioLevelListener {
402
+ peers: Map<PeerId, PeerInfo>;
403
+ consumers: Map<ConsumerId, ConsumerData>;
404
+ webcams: Map<string, MediaDeviceInfo>;
405
+ webcam: {
406
+ device: MediaDeviceInfo | null;
407
+ facingMode?: string;
408
+ resolution: VideoResolution;
409
+ framerate?: number;
410
+ };
411
+ microphone: {
412
+ device: MediaDeviceInfo | null;
413
+ muted: boolean;
414
+ };
415
+ webcamTrack: MediaStreamTrack | null;
416
+ webcamZoom: {
417
+ available: boolean;
418
+ min: number;
419
+ max: number;
420
+ };
421
+ audioLevel: AudioLevel | undefined;
422
+ roomId: string;
423
+ companyId: number;
424
+ defaultPublicPage?: {
425
+ token: string;
426
+ };
427
+ peerId: PeerId;
428
+ clientId: string;
429
+ profile: Profile;
430
+ protooTransport?: protooClient.WebSocketTransport;
431
+ protoo?: protooClient.Peer;
432
+ micProducer?: mediasoupClient.types.Producer;
433
+ webcamProducer: mediasoupClient.types.Producer | null;
434
+ screenshareVideoProducer?: mediasoupClient.types.Producer;
435
+ screenshareAudioProducer?: mediasoupClient.types.Producer;
436
+ pendingDeviceRequest: Record<string, DeviceRequest>;
437
+ joinOptions: JoinOptions;
438
+ audioInputDefaultDevice?: MediaDeviceInfo;
439
+ devicesList: Array<MediaDeviceInfo>;
440
+ customMessages: Map<string, CustomMessage>;
441
+ audioRenderers: Record<string, AudioRenderer>;
442
+ constructor();
443
+ getState(): StreamerState;
444
+ onAudioLevel: (this: any) => void;
445
+ onStartSpeak(): void;
446
+ onStopSpeak(): void;
447
+ generateToken(bid: string): Promise<string>;
448
+ init(room?: string, options?: JoinOptions): Promise<InitResult>;
449
+ setAgentIdentity({ apiKey, email }: {
450
+ apiKey: string;
451
+ email?: string;
452
+ }): Promise<void>;
453
+ acceptAccessRequest(id: string): Promise<any>;
454
+ setStep(stepToken: string): Promise<void>;
455
+ denyAccessRequest(id: string): Promise<any>;
456
+ requestRoomAccess(): Promise<void>;
457
+ joinRoom(): Promise<void>;
458
+ getRoomPeers(): Promise<GetRoomPeersResult>;
459
+ onEnterRoom(): Promise<void>;
460
+ joinRecorder(): Promise<void>;
461
+ switchMicrophone(deviceId?: string): Promise<void>;
462
+ closeMicrophoneProducer(): Promise<void>;
463
+ onDeviceChange(): Promise<void>;
464
+ enableMicrophone({ deviceId }?: {
465
+ deviceId?: string;
466
+ }): Promise<void>;
467
+ muteMicrophone(): void;
468
+ unMuteMicrophone(): void;
469
+ toggleMute(): Promise<{
470
+ muted: boolean;
471
+ }>;
472
+ release(): void;
473
+ endCall(): void;
474
+ terminateRoom(): void;
475
+ updateWebcams(): Promise<void>;
476
+ isVideoZoomAvailable(): boolean;
477
+ handleGetUserMediaError(deviceType: DeviceType, getUserMediaPromise: Promise<MediaStream>): Promise<MediaStream>;
478
+ restartIce(transport: Transport): Promise<void>;
479
+ setVideoBackground(options: MediapipeOptions): void;
480
+ initVideoBackground(): Promise<void>;
481
+ stopVideoBackground(): Promise<void>;
482
+ switchWebcam({ device, resolution, rotate, frameRate, facingMode, }: {
483
+ device?: MediaDeviceInfo;
484
+ resolution?: VideoResolution;
485
+ rotate?: boolean;
486
+ frameRate?: number;
487
+ facingMode?: string;
488
+ }): Promise<void>;
489
+ enableVideo(config?: {
490
+ device?: MediaDeviceInfo;
491
+ facingMode?: string;
492
+ resolution?: VideoResolution;
493
+ frameRate?: number;
494
+ }): Promise<void>;
495
+ rotateVideo(): Promise<void>;
496
+ zoomVideo(): Promise<void>;
497
+ unzoomVideo(): Promise<void>;
498
+ disableVideo(): Promise<void>;
499
+ enableScreenshare(options?: {
500
+ mediaStream?: MediaStream;
501
+ audioTransportOption: 'mix' | 'none' | 'classic';
502
+ }): Promise<void>;
503
+ disableScreenshare(): Promise<void>;
504
+ onConsumerClose({ consumerId }: {
505
+ consumerId: ConsumerId;
506
+ }): void;
507
+ requestVideo({ mediaId, element }: {
508
+ mediaId: string;
509
+ element: HTMLVideoElement;
510
+ }): void;
511
+ saveCapture(base64Image: string): Promise<{
512
+ url: string;
513
+ assetId: number;
514
+ }>;
515
+ deleteCapture(assetId: number): Promise<number>;
516
+ captureVideo(videoElement?: HTMLVideoElement): Promise<string>;
517
+ requestLocalVideo(element: HTMLVideoElement): {
518
+ facingMode: string;
519
+ };
520
+ requestLocalScreenshare(element: HTMLVideoElement): void;
521
+ consumePeer({ peerId, producersData, }: {
522
+ peerId: PeerId;
523
+ producersData: Array<ProducerData>;
524
+ }): void;
525
+ consumeProducer({ peerId, producerId, deviceType, paused, }: {
526
+ peerId: PeerId;
527
+ producerId: ProducerId;
528
+ deviceType: DeviceType;
529
+ paused: boolean;
530
+ }): Promise<void>;
531
+ setDisplayName(displayName: string): Promise<void>;
532
+ setProfile(profile: Profile): Promise<void>;
533
+ requestPeerDevice(remotePeerId: string, deviceType: DeviceType): Promise<void>;
534
+ denyDeviceRequest(deviceType: DeviceType): void;
535
+ getConsumers(): Map<string, ConsumerData>;
536
+ getDevicesState(): DevicesState;
537
+ sendCustomMessageToAll(event: any): Promise<void>;
538
+ sendCustomMessage(peerId: string, event: any): Promise<void>;
539
+ listAudioDevices(): Promise<MediaDeviceInfo[]>;
540
+ listVideoDevices(): Promise<MediaDeviceInfo[]>;
541
+ isListDevicesSupported(): boolean;
542
+ getCurrentWebcam(): {
543
+ device: MediaDeviceInfo | null;
544
+ resolution: VideoResolution;
545
+ };
546
+ getCurrentMicrophoneId(): string | MediaTrackSettings | undefined;
547
+ getCurrentSpeakerId(): string;
548
+ setWebcamResolution(resolution: VideoResolution): Promise<void>;
549
+ createAudioRenderer(consumerId: string): AudioRenderer;
550
+ deleteAudioRenderer(consumerId: string): void;
551
+ playAudioRenderer(consumerId: string): Promise<void>;
552
+ setAudioSink(sinkId: string): Promise<void>;
553
+ dispatchEvent(event: SnapcallEvent<keyof StreamerEventMap>): boolean;
554
+ setConfig(config: Partial<Config>): void;
555
+ getPermissions(): Permissions;
556
+ startRecord(): Promise<void>;
557
+ stopRecord(): Promise<void>;
558
+ getPublicPage(token: string): Promise<PublicPage>;
559
+ getWaitingRequests(): Promise<WaitingRequests>;
560
+ }
561
+ declare const streamerClient: StreamerClient;
562
+ interface NotificationOptions {
563
+ icon?: JSX.Element | string;
564
+ subText?: string;
565
+ button?: {
566
+ icon?: JSX.Element | string;
567
+ text: string;
568
+ action: () => void;
569
+ style?: CSSProperties;
570
+ };
571
+ status?: {
572
+ icon?: JSX.Element | string;
573
+ text?: string;
574
+ boldText?: string;
575
+ };
576
+ width?: string;
577
+ backgroundColor?: string;
578
+ messageStyle?: CSSProperties;
579
+ ellipsis?: boolean;
580
+ }
581
+ type NotificationButton = NonNullable<NotificationOptions['button']>;
582
+ interface CustomNotificationButton extends Omit<NotificationButton, 'action'> {
583
+ action: ({ close }: {
584
+ close: () => void;
585
+ }) => void;
586
+ }
587
+ interface SendNotificationOptions extends Omit<NotificationOptions, 'button'> {
588
+ button?: CustomNotificationButton;
589
+ duration?: number;
590
+ }
591
+ declare const sendNotification: (message: string, options?: SendNotificationOptions) => void;
592
+ interface StreamUIMethods {
593
+ initV2: (options: StreamUIInitOptions) => Promise<void>;
594
+ init: (options: StreamUIInitOptions) => void;
595
+ joinRoom: (token: string, options: StreamUIInitOptions) => Promise<void>;
596
+ setAgentIdentity: typeof streamerClient.setAgentIdentity;
597
+ enableScreenshare: typeof streamerClient.enableScreenshare;
598
+ setExtraSettingsOptions: (extraOptions: SettingsCategory[]) => void;
599
+ sendNotification: typeof sendNotification;
600
+ startRecord: typeof streamerClient.startRecord;
601
+ stopRecord: typeof streamerClient.stopRecord;
602
+ leaveRoom: typeof streamerClient.endCall;
603
+ terminateRoom: typeof streamerClient.terminateRoom;
604
+ generateToken: typeof streamerClient.generateToken;
605
+ addEventListener: typeof streamerClient.addEventListener;
606
+ removeEventListener: typeof streamerClient.removeEventListener;
607
+ dispatchEvent: typeof streamerClient.dispatchEvent;
608
+ getState: typeof streamerClient.getState;
609
+ setProfile: typeof streamerClient.setProfile;
610
+ setConfig: typeof streamerClient.setConfig;
611
+ setLogLevel: (level: number) => void;
612
+ getPermissions: () => Permissions;
613
+ streamerClient: StreamerClient;
614
+ }
615
+ interface ControlSettings {
616
+ available?: boolean;
617
+ enabled?: boolean;
618
+ }
619
+ interface StreamUIBaseOptions {
620
+ token?: string;
621
+ flowToken?: string;
622
+ authKey?: string;
623
+ profile?: Profile;
624
+ apiKey?: string;
625
+ email?: string;
626
+ headless?: boolean;
627
+ greeting?: boolean;
628
+ recorder?: {
629
+ enabledModes: Array<'video' | 'screen' | 'photo' | 'audio'>;
630
+ enabled: boolean;
631
+ defaultMode?: 'photo' | 'video' | 'audio' | 'screen';
632
+ skipOnboarding?: boolean;
633
+ };
634
+ sharedURL?: string;
635
+ audioTiles?: boolean;
636
+ settingsShortcuts?: Array<SettingShortcut>;
637
+ extraSettingsOptions?: SettingsCategory[];
638
+ controls?: {
639
+ microphone?: ControlSettings;
640
+ camera?: ControlSettings;
641
+ screenshare?: ControlSettings;
642
+ };
643
+ logo?: {
644
+ text?: string;
645
+ size?: 'small' | 'medium' | 'large';
646
+ };
647
+ showMenuButton?: boolean;
648
+ GDPRDisclaimer?: {
649
+ enabled: boolean;
650
+ text: string;
651
+ closeText: string;
652
+ };
653
+ streamApiURL?: string;
654
+ apiUrl?: string;
655
+ tracking?: boolean;
656
+ language?: string;
657
+ }
658
+ interface StreamUIInitOptions extends StreamUIBaseOptions {
659
+ element: HTMLElement;
660
+ }
661
+ declare global {
662
+ interface Window {
663
+ streamUI: StreamUIMethods;
664
+ snapcallAPI: {
665
+ endCall: typeof streamerClient.endCall;
666
+ terminateRoom: typeof streamerClient.terminateRoom;
667
+ generateToken: typeof streamerClient.generateToken;
668
+ setDisplayName: typeof streamerClient.setDisplayName;
669
+ };
670
+ }
671
+ interface MediaSession {
672
+ setMicrophoneActive?: (active: boolean) => void;
673
+ setCameraActive?: (active: boolean) => void;
674
+ setActionHandler(action: MediaSessionAction | 'togglemicrophone' | 'togglecamera' | 'hangup', handler: MediaSessionActionHandler | null): void;
675
+ }
676
+ interface WindowEventMap {
677
+ streamUISetExtraSettingsOptions: CustomEvent;
678
+ }
679
+ }
680
+ declare global {
681
+ interface Window {
682
+ onYouTubeIframeAPIReady: () => void;
683
+ YT?: {
684
+ loaded?: boolean;
685
+ };
686
+ }
687
+ }
688
+ export const streamUI: StreamUIMethods;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snapcall/stream-ui",
3
- "version": "1.25.0",
3
+ "version": "1.25.1",
4
4
  "description": "",
5
5
  "source": "src/index.tsx",
6
6
  "main": "dist/stream-ui.js",
@@ -39,9 +39,9 @@
39
39
  "dev": "npm run serve",
40
40
  "serve": "APP_ENV=local parcel serve --https --host 0.0.0.0 --target html",
41
41
  "build": "parcel build",
42
- "build:npm": "parcel build --no-source-maps --target main --target module",
42
+ "build:npm": "parcel build --no-source-maps --target main --target module --target types",
43
43
  "build:s3": "parcel build --no-source-maps --target umd --target html",
44
- "build:streamerClient": "parcel build --target streamerClient",
44
+ "build:streamerClient": "parcel build --target streamerClient --target types",
45
45
  "typecheck": "tsc --noEmit",
46
46
  "lint": "eslint src streamerClient --ext .ts,.tsx",
47
47
  "prettier": "prettier --check .",