@snapcall/stream-ui 1.18.0 → 1.19.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.
@@ -4,7 +4,7 @@
4
4
  */ // @ts-ignore
5
5
  let $febe13af234b7734$var$interval;
6
6
  self.onmessage = (event)=>{
7
- const { action: action , params: params } = event.data;
7
+ const { action: action, params: params } = event.data;
8
8
  if (action === "start") {
9
9
  if ($febe13af234b7734$var$interval) clearInterval($febe13af234b7734$var$interval);
10
10
  $febe13af234b7734$var$interval = self.setInterval(()=>{
@@ -5,7 +5,7 @@
5
5
  */ // @ts-ignore
6
6
  let $7df5a1066adc9830$var$interval;
7
7
  self.onmessage = (event)=>{
8
- const { action: action , params: params } = event.data;
8
+ const { action: action, params: params } = event.data;
9
9
  if (action === "start") {
10
10
  if ($7df5a1066adc9830$var$interval) clearInterval($7df5a1066adc9830$var$interval);
11
11
  $7df5a1066adc9830$var$interval = self.setInterval(()=>{
@@ -0,0 +1 @@
1
+ let e;self.onmessage=a=>{let{action:s,params:t}=a.data;"start"===s&&(e&&clearInterval(e),e=self.setInterval(()=>{self.postMessage("time")},1e3/t))};
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<{
@@ -402,10 +464,6 @@ declare class StreamerClient extends StreamerEventTargetType implements AudioLev
402
464
  url: string;
403
465
  assetId: number;
404
466
  }>;
405
- saveThumbnail(base64Image: string): Promise<{
406
- url: string;
407
- assetId: number;
408
- }>;
409
467
  deleteCapture(assetId: number): Promise<number>;
410
468
  captureVideo(videoElement?: HTMLVideoElement): Promise<string>;
411
469
  requestLocalVideo(element: HTMLVideoElement): {
@@ -450,6 +508,7 @@ declare class StreamerClient extends StreamerEventTargetType implements AudioLev
450
508
  getPermissions(): Permissions;
451
509
  startRecord(): Promise<void>;
452
510
  stopRecord(): Promise<void>;
511
+ getPublicPage(token: string): Promise<PublicPage>;
453
512
  }
454
513
  declare const streamerClient: StreamerClient;
455
514
  interface NotificationOptions {
@@ -482,19 +541,15 @@ interface SendNotificationOptions extends Omit<NotificationOptions, 'button'> {
482
541
  duration?: number;
483
542
  }
484
543
  declare const sendNotification: (message: string, options?: SendNotificationOptions) => void;
485
- type OnGreetingDoneSignature = ({ cameraEnabled, micEnabled, displayName, }: {
486
- cameraEnabled?: boolean;
487
- micEnabled?: boolean;
488
- displayName?: string;
489
- }) => void;
490
544
  interface StreamUIMethods {
545
+ initV2: (options: StreamUIInitOptions) => Promise<void>;
491
546
  init: (options: StreamUIInitOptions) => void;
492
- initGreeting: (e: HTMLElement, onGreetingDone: OnGreetingDoneSignature) => void;
547
+ joinRoom: (token: string, options: StreamUIInitOptions) => Promise<void>;
548
+ setAgentIdentity: typeof streamerClient.setAgentIdentity;
493
549
  setExtraSettingsOptions: (extraOptions: SettingsCategory[]) => void;
494
550
  sendNotification: typeof sendNotification;
495
551
  startRecord: typeof streamerClient.startRecord;
496
552
  stopRecord: typeof streamerClient.stopRecord;
497
- joinRoom: typeof streamerClient.init;
498
553
  leaveRoom: typeof streamerClient.endCall;
499
554
  terminateRoom: typeof streamerClient.terminateRoom;
500
555
  generateToken: typeof streamerClient.generateToken;
@@ -513,7 +568,13 @@ interface ControlSettings {
513
568
  enabled?: boolean;
514
569
  }
515
570
  interface StreamUIBaseOptions {
571
+ token?: string;
572
+ authKey?: string;
573
+ profile?: Profile;
574
+ apiKey?: string;
575
+ email?: string;
516
576
  headless?: boolean;
577
+ greeting?: boolean;
517
578
  recorder?: {
518
579
  enabled: boolean;
519
580
  defaultMode?: 'photo' | 'video';
@@ -536,7 +597,7 @@ interface StreamUIBaseOptions {
536
597
  showMenuButton?: boolean;
537
598
  GDPRDisclaimer?: boolean;
538
599
  streamApiURL?: string;
539
- apiUrl: string;
600
+ apiUrl?: string;
540
601
  tracking?: boolean;
541
602
  language?: string;
542
603
  showLogin?: {
@@ -552,7 +613,6 @@ declare global {
552
613
  interface Window {
553
614
  streamUI: StreamUIMethods;
554
615
  snapcallAPI: {
555
- join: typeof streamerClient.init;
556
616
  endCall: typeof streamerClient.endCall;
557
617
  terminateRoom: typeof streamerClient.terminateRoom;
558
618
  generateToken: typeof streamerClient.generateToken;
@@ -562,6 +622,7 @@ declare global {
562
622
  interface MediaSession {
563
623
  setMicrophoneActive?: (active: boolean) => void;
564
624
  setCameraActive?: (active: boolean) => void;
625
+ setActionHandler(action: MediaSessionAction | 'togglemicrophone' | 'togglecamera' | 'hangup', handler: MediaSessionActionHandler | null): void;
565
626
  }
566
627
  interface HTMLAudioElement {
567
628
  setSinkId?: (sinkId: string) => Promise<undefined>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snapcall/stream-ui",
3
- "version": "1.18.0",
3
+ "version": "1.19.0",
4
4
  "description": "",
5
5
  "source": "src/index.tsx",
6
6
  "main": "dist/stream-ui.js",
@@ -38,6 +38,7 @@
38
38
  "license": "ISC",
39
39
  "peerDependencies": {
40
40
  "@sentry/browser": "^7.0.0",
41
+ "@snapcall/design-system": "^1.15.1",
41
42
  "bowser": "^2.11.0",
42
43
  "i18next": "^21.9.1",
43
44
  "inobounce": "^0.2.1",
@@ -51,9 +52,9 @@
51
52
  "styled-components": "^5.3.3"
52
53
  },
53
54
  "devDependencies": {
54
- "@parcel/packager-ts": "^2.8.3",
55
- "@parcel/transformer-inline-string": "^2.8.3",
56
- "@parcel/transformer-typescript-types": "^2.8.3",
55
+ "@parcel/packager-ts": "^2.11.0",
56
+ "@parcel/transformer-inline-string": "^2.11.0",
57
+ "@parcel/transformer-typescript-types": "^2.11.0",
57
58
  "@types/protoo-client": "^4.0.1",
58
59
  "@types/qrcode": "^1.4.2",
59
60
  "@types/react": "^18.2.0",
@@ -66,12 +67,12 @@
66
67
  "eslint": "^8.16.0",
67
68
  "eslint-config-prettier": "^8.5.0",
68
69
  "eslint-config-react-app": "^7.0.1",
69
- "parcel": "^2.8.3",
70
+ "parcel": "^2.11.0",
70
71
  "postcss": "^8.4.21",
71
72
  "prettier": "2.7.1",
72
73
  "process": "^0.11.10",
73
74
  "tailwindcss": "^3.2.4",
74
- "typescript": "^4.7.2"
75
+ "typescript": "^5.3.3"
75
76
  },
76
77
  "dependencies": {
77
78
  "@hotjar/browser": "^1.0.6",
@@ -81,7 +82,7 @@
81
82
  "@react-aria/overlays": "^3.12.1",
82
83
  "@react-aria/utils": "^3.14.2",
83
84
  "@sentry/browser": "^7.0.0",
84
- "@snapcall/design-system": "^1.14.4",
85
+ "@snapcall/design-system": "^1.15.1",
85
86
  "@types/youtube": "^0.0.47",
86
87
  "bowser": "^2.11.0",
87
88
  "classnames": "^2.3.2",
@@ -1 +0,0 @@
1
- (()=>{let e;self.onmessage=s=>{const{action:a,params:t}=s.data;"start"===a&&(e&&clearInterval(e),e=self.setInterval((()=>{self.postMessage("time")}),1e3/t))}})();