@snapcall/stream-ui 1.18.1 → 1.19.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.
package/dist/types.d.ts CHANGED
@@ -49,9 +49,19 @@ interface PeerState {
49
49
  profile: Profile;
50
50
  deviceState: DevicesState;
51
51
  }
52
+ interface CompanyInfo {
53
+ name?: string;
54
+ company_name?: string;
55
+ avatar_url?: string;
56
+ terminate_enabled?: boolean;
57
+ }
52
58
  interface StreamerState extends PeerState {
53
59
  roomId: string;
60
+ plan?: string;
61
+ permissions: Permissions;
62
+ company?: CompanyInfo;
54
63
  companyId: number;
64
+ waitingRoomAccess: boolean;
55
65
  callId: number | undefined;
56
66
  peers: Array<PeerState>;
57
67
  joinOptions: JoinOptions;
@@ -177,6 +187,10 @@ declare global {
177
187
  peerId: string;
178
188
  plan?: string;
179
189
  permissions: Permissions;
190
+ waitingRequests: Array<{
191
+ id: string;
192
+ profile?: Profile;
193
+ }>;
180
194
  peers: {
181
195
  peerId: string;
182
196
  muted: boolean;
@@ -189,6 +203,17 @@ declare global {
189
203
  displayName?: string;
190
204
  profile: Profile;
191
205
  }>;
206
+ export type RequestAccessEvent = SnapcallEvent<{
207
+ success: string;
208
+ message?: string;
209
+ }>;
210
+ export type RequestAccessRequestEvent = SnapcallEvent<{
211
+ id: string;
212
+ profile?: Profile;
213
+ }>;
214
+ export type RequestAccessCancelEvent = SnapcallEvent<{
215
+ id: string;
216
+ }>;
192
217
  export type ProfileUpdateEvent = SnapcallEvent<{
193
218
  peerId: string;
194
219
  profile: Profile;
@@ -249,6 +274,21 @@ declare global {
249
274
  audioLevel: number;
250
275
  }>;
251
276
  }
277
+ export interface PublicPage {
278
+ token: string;
279
+ logo_url: string;
280
+ title: string;
281
+ description: string;
282
+ data: {
283
+ links: {
284
+ id: 'recordVideo' | 'takePicture' | 'scheduleCall' | 'recordScreen';
285
+ active: boolean;
286
+ user_ids?: number[];
287
+ team_ids?: number[];
288
+ schedule_ids?: string[];
289
+ }[];
290
+ };
291
+ }
252
292
  }
253
293
  interface StreamerEventMap {
254
294
  audioLevel: SnapCall.AudioLevelEvent['detail'];
@@ -257,6 +297,9 @@ interface StreamerEventMap {
257
297
  leaveRoom: SnapCall.BaseEvent['detail'];
258
298
  terminateRoom: SnapCall.BaseEvent['detail'];
259
299
  invalidRoom: SnapCall.BaseEvent['detail'];
300
+ accessRequest: SnapCall.RequestAccessRequestEvent['detail'];
301
+ cancelAccessRequest: SnapCall.RequestAccessCancelEvent['detail'];
302
+ requestAccessResult: SnapCall.RequestAccessEvent['detail'];
260
303
  localVideoUnavailable: SnapCall.BaseEvent['detail'];
261
304
  localVideoAvailable: SnapCall.BaseEvent['detail'];
262
305
  microphoneEnabled: SnapCall.BaseEvent['detail'];
@@ -328,10 +371,13 @@ declare class StreamerClient extends StreamerEventTargetType implements AudioLev
328
371
  muted: boolean;
329
372
  roomId: string;
330
373
  companyId: number;
374
+ defaultPublicPage?: {
375
+ token: string;
376
+ };
331
377
  peerId: PeerId;
332
378
  profile: Profile;
333
- protooTransport: protooClient.WebSocketTransport;
334
- protoo: protooClient.Peer;
379
+ protooTransport?: protooClient.WebSocketTransport;
380
+ protoo?: protooClient.Peer;
335
381
  micProducer?: mediasoupClient.types.Producer;
336
382
  webcamProducer: mediasoupClient.types.Producer | null;
337
383
  screenshareVideoProducer?: mediasoupClient.types.Producer;
@@ -349,12 +395,28 @@ declare class StreamerClient extends StreamerEventTargetType implements AudioLev
349
395
  onStopSpeak(): void;
350
396
  generateToken(bid: string): Promise<string>;
351
397
  init(room?: string, options?: JoinOptions): Promise<void>;
398
+ setAgentIdentity({ apiKey, email }: {
399
+ apiKey: string;
400
+ email?: string;
401
+ }): Promise<void>;
402
+ acceptAccessRequest(id: string): Promise<void>;
403
+ denyAccessRequest(id: string): Promise<void>;
404
+ requestRoomAccess(): Promise<void>;
352
405
  joinRoom(): Promise<void>;
406
+ getRoomPeers(): Promise<{
407
+ waitingRequests: Array<{
408
+ profile: Profile;
409
+ id: string;
410
+ }>;
411
+ }>;
412
+ onEnterRoom(): Promise<void>;
353
413
  joinRecorder(): Promise<void>;
354
414
  switchMicrophone(deviceId?: string): Promise<void>;
355
415
  closeMicrophoneProducer(): Promise<void>;
356
416
  onDeviceChange(): Promise<void>;
357
- enableMicrophone(): Promise<void>;
417
+ enableMicrophone({ deviceId }?: {
418
+ deviceId?: string;
419
+ }): Promise<void>;
358
420
  muteMicrophone(): void;
359
421
  unMuteMicrophone(): void;
360
422
  toggleMute(): Promise<{
@@ -446,6 +508,7 @@ declare class StreamerClient extends StreamerEventTargetType implements AudioLev
446
508
  getPermissions(): Permissions;
447
509
  startRecord(): Promise<void>;
448
510
  stopRecord(): Promise<void>;
511
+ getPublicPage(token: string): Promise<PublicPage>;
449
512
  }
450
513
  declare const streamerClient: StreamerClient;
451
514
  interface NotificationOptions {
@@ -478,19 +541,15 @@ interface SendNotificationOptions extends Omit<NotificationOptions, 'button'> {
478
541
  duration?: number;
479
542
  }
480
543
  declare const sendNotification: (message: string, options?: SendNotificationOptions) => void;
481
- type OnGreetingDoneSignature = ({ cameraEnabled, micEnabled, displayName, }: {
482
- cameraEnabled?: boolean;
483
- micEnabled?: boolean;
484
- displayName?: string;
485
- }) => void;
486
544
  interface StreamUIMethods {
545
+ initV2: (options: StreamUIInitOptions) => Promise<void>;
487
546
  init: (options: StreamUIInitOptions) => void;
488
- initGreeting: (e: HTMLElement, onGreetingDone: OnGreetingDoneSignature) => void;
547
+ joinRoom: (token: string, options: StreamUIInitOptions) => Promise<void>;
548
+ setAgentIdentity: typeof streamerClient.setAgentIdentity;
489
549
  setExtraSettingsOptions: (extraOptions: SettingsCategory[]) => void;
490
550
  sendNotification: typeof sendNotification;
491
551
  startRecord: typeof streamerClient.startRecord;
492
552
  stopRecord: typeof streamerClient.stopRecord;
493
- joinRoom: typeof streamerClient.init;
494
553
  leaveRoom: typeof streamerClient.endCall;
495
554
  terminateRoom: typeof streamerClient.terminateRoom;
496
555
  generateToken: typeof streamerClient.generateToken;
@@ -509,7 +568,13 @@ interface ControlSettings {
509
568
  enabled?: boolean;
510
569
  }
511
570
  interface StreamUIBaseOptions {
571
+ token?: string;
572
+ authKey?: string;
573
+ profile?: Profile;
574
+ apiKey?: string;
575
+ email?: string;
512
576
  headless?: boolean;
577
+ greeting?: boolean;
513
578
  recorder?: {
514
579
  enabled: boolean;
515
580
  defaultMode?: 'photo' | 'video';
@@ -548,7 +613,6 @@ declare global {
548
613
  interface Window {
549
614
  streamUI: StreamUIMethods;
550
615
  snapcallAPI: {
551
- join: typeof streamerClient.init;
552
616
  endCall: typeof streamerClient.endCall;
553
617
  terminateRoom: typeof streamerClient.terminateRoom;
554
618
  generateToken: typeof streamerClient.generateToken;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snapcall/stream-ui",
3
- "version": "1.18.1",
3
+ "version": "1.19.1",
4
4
  "description": "",
5
5
  "source": "src/index.tsx",
6
6
  "main": "dist/stream-ui.js",