@whereby.com/browser-sdk 2.0.0-alpha8 → 2.0.0-alpha9

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/lib.esm.js CHANGED
@@ -115,7 +115,7 @@ define("WherebyEmbed", {
115
115
  if (!subdomain)
116
116
  return this.html `Whereby: Missing subdomain attr.`;
117
117
  const url = new URL(room, `https://${subdomain}.whereby.com`);
118
- Object.entries(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ jsApi: true, we: "2.0.0-alpha8", iframeSource: subdomain }, (displayName && { displayName })), (lang && { lang })), (metadata && { metadata })), (groups && { groups })), (virtualBackgroundUrl && { virtualBackgroundUrl })), (avatarUrl && { avatarUrl })), (minimal != null && { embed: minimal })), boolAttrs.reduce(
118
+ Object.entries(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ jsApi: true, we: "2.0.0-alpha9", iframeSource: subdomain }, (displayName && { displayName })), (lang && { lang })), (metadata && { metadata })), (groups && { groups })), (virtualBackgroundUrl && { virtualBackgroundUrl })), (avatarUrl && { avatarUrl })), (minimal != null && { embed: minimal })), boolAttrs.reduce(
119
119
  // add to URL if set in any way
120
120
  (o, v) => (this[v.toLowerCase()] != null ? Object.assign(Object.assign({}, o), { [v]: this[v.toLowerCase()] }) : o), {}))).forEach(([k, v]) => {
121
121
  if (!url.searchParams.has(k) && typeof v === "string") {
@@ -5262,7 +5262,7 @@ class LocalParticipant extends RoomParticipant {
5262
5262
  }
5263
5263
  }
5264
5264
 
5265
- const API_BASE_URL = "https://api.appearin.net";
5265
+ const API_BASE_URL = "https://api.whereby.dev";
5266
5266
  const SIGNAL_BASE_URL = "wss://signal.appearin.net";
5267
5267
  const NON_PERSON_ROLES = ["recorder", "streamer"];
5268
5268
  function createSocket() {
@@ -5288,11 +5288,13 @@ class RoomConnection extends TypedEventTarget {
5288
5288
  super();
5289
5289
  this.localParticipant = null;
5290
5290
  this.remoteParticipants = [];
5291
- this.roomConnectionState = "";
5292
5291
  this._ownsLocalMedia = false;
5292
+ this.organizationId = "";
5293
+ this.roomConnectionStatus = "";
5293
5294
  this.roomUrl = new URL(roomUrl); // Throw if invalid Whereby room url
5294
5295
  const searchParams = new URLSearchParams(this.roomUrl.search);
5295
5296
  this._roomKey = roomKey || searchParams.get("roomKey");
5297
+ this.roomName = this.roomUrl.pathname;
5296
5298
  this.logger = logger || {
5297
5299
  debug: noop,
5298
5300
  error: noop,
@@ -5313,6 +5315,7 @@ class RoomConnection extends TypedEventTarget {
5313
5315
  else {
5314
5316
  throw new Error("Missing constraints");
5315
5317
  }
5318
+ // Set up services
5316
5319
  this.credentialsService = CredentialsService.create({ baseUrl: API_BASE_URL });
5317
5320
  this.apiClient = new ApiClient({
5318
5321
  fetchDeviceCredentials: this.credentialsService.getCredentials.bind(this.credentialsService),
@@ -5339,6 +5342,10 @@ class RoomConnection extends TypedEventTarget {
5339
5342
  this.signalSocket.on("audio_enabled", this._handleClientAudioEnabled.bind(this));
5340
5343
  this.signalSocket.on("video_enabled", this._handleClientVideoEnabled.bind(this));
5341
5344
  this.signalSocket.on("client_metadata_received", this._handleClientMetadataReceived.bind(this));
5345
+ this.signalSocket.on("knock_handled", this._handleKnockHandled.bind(this));
5346
+ this.signalSocket.on("knocker_left", this._handleKnockerLeft.bind(this));
5347
+ this.signalSocket.on("room_joined", this._handleRoomJoined.bind(this));
5348
+ this.signalSocket.on("room_knocked", this._handleRoomKnocked.bind(this));
5342
5349
  // Set up local media listeners
5343
5350
  this.localMedia.addEventListener("camera_enabled", (e) => {
5344
5351
  const { enabled } = e.detail;
@@ -5399,6 +5406,70 @@ class RoomConnection extends TypedEventTarget {
5399
5406
  detail: { participantId: remoteParticipant.id, displayName },
5400
5407
  }));
5401
5408
  }
5409
+ _handleKnockHandled(payload) {
5410
+ const { resolution } = payload;
5411
+ if (resolution === "accepted") {
5412
+ this.roomConnectionStatus = "accepted";
5413
+ this._roomKey = payload.metadata.roomKey;
5414
+ this._joinRoom();
5415
+ }
5416
+ else if (resolution === "rejected") {
5417
+ this.roomConnectionStatus = "rejected";
5418
+ this.dispatchEvent(new CustomEvent("room_connection_status_changed", {
5419
+ detail: {
5420
+ roomConnectionStatus: this.roomConnectionStatus,
5421
+ },
5422
+ }));
5423
+ }
5424
+ }
5425
+ _handleKnockerLeft(payload) {
5426
+ const { clientId } = payload;
5427
+ this.dispatchEvent(new CustomEvent("waiting_participant_left", {
5428
+ detail: { participantId: clientId },
5429
+ }));
5430
+ }
5431
+ _handleRoomJoined(event) {
5432
+ const { error, isLocked, room, selfId } = event;
5433
+ if (error === "room_locked" && isLocked) {
5434
+ this.roomConnectionStatus = "room_locked";
5435
+ this.dispatchEvent(new CustomEvent("room_connection_status_changed", {
5436
+ detail: {
5437
+ roomConnectionStatus: this.roomConnectionStatus,
5438
+ },
5439
+ }));
5440
+ return;
5441
+ }
5442
+ // Check if we have an error
5443
+ // Check if it is a room joined error
5444
+ // Set state to connect_failed_locked
5445
+ // Set state to connect_failed_no_host
5446
+ if (room) {
5447
+ const { clients, knockers } = room;
5448
+ const localClient = clients.find((c) => c.id === selfId);
5449
+ if (!localClient)
5450
+ throw new Error("Missing local client");
5451
+ this.localParticipant = new LocalParticipant(Object.assign(Object.assign({}, localClient), { stream: this.localMedia.stream || undefined }));
5452
+ this.remoteParticipants = clients
5453
+ .filter((c) => c.id !== selfId)
5454
+ .map((c) => new RemoteParticipant(Object.assign(Object.assign({}, c), { newJoiner: false })));
5455
+ this.roomConnectionStatus = "connected";
5456
+ this.dispatchEvent(new CustomEvent("room_joined", {
5457
+ detail: {
5458
+ localParticipant: this.localParticipant,
5459
+ remoteParticipants: this.remoteParticipants,
5460
+ waitingParticipants: knockers.map((knocker) => {
5461
+ return { id: knocker.clientId, displayName: knocker.displayName };
5462
+ }),
5463
+ },
5464
+ }));
5465
+ }
5466
+ }
5467
+ _handleRoomKnocked(event) {
5468
+ const { clientId, displayName } = event;
5469
+ this.dispatchEvent(new CustomEvent("waiting_participant_joined", {
5470
+ detail: { participantId: clientId, displayName },
5471
+ }));
5472
+ }
5402
5473
  _handleRtcEvent(eventName, data) {
5403
5474
  if (eventName === "rtc_manager_created") {
5404
5475
  return this._handleRtcManagerCreated(data);
@@ -5417,6 +5488,9 @@ class RoomConnection extends TypedEventTarget {
5417
5488
  if (this.localMedia.stream) {
5418
5489
  (_a = this.rtcManager) === null || _a === void 0 ? void 0 : _a.addNewStream("0", this.localMedia.stream, !this.localMedia.isMicrophoneEnabled(), !this.localMedia.isCameraEnabled());
5419
5490
  }
5491
+ if (this.remoteParticipants.length) {
5492
+ this._handleAcceptStreams(this.remoteParticipants);
5493
+ }
5420
5494
  }
5421
5495
  _handleAcceptStreams(remoteParticipants) {
5422
5496
  var _a, _b;
@@ -5474,14 +5548,43 @@ class RoomConnection extends TypedEventTarget {
5474
5548
  }
5475
5549
  this.dispatchEvent(new CustomEvent("participant_stream_added", { detail: { participantId: clientId, stream, streamId } }));
5476
5550
  }
5551
+ _joinRoom() {
5552
+ this.signalSocket.emit("join_room", {
5553
+ avatarUrl: null,
5554
+ config: {
5555
+ isAudioEnabled: this.localMedia.isMicrophoneEnabled(),
5556
+ isVideoEnabled: this.localMedia.isCameraEnabled(),
5557
+ },
5558
+ deviceCapabilities: { canScreenshare: true },
5559
+ displayName: this.displayName,
5560
+ isCoLocated: false,
5561
+ isDevicePermissionDenied: false,
5562
+ kickFromOtherRooms: false,
5563
+ organizationId: this.organizationId,
5564
+ roomKey: this.roomKey,
5565
+ roomName: this.roomName,
5566
+ selfId: "",
5567
+ userAgent: `browser-sdk:${sdkVersion }`,
5568
+ });
5569
+ }
5477
5570
  join() {
5478
5571
  return __awaiter(this, void 0, void 0, function* () {
5479
- if (["connected", "connecting"].includes(this.roomConnectionState)) {
5480
- console.warn(`Trying to join room state is ${this.roomConnectionState}`);
5572
+ if (["connected", "connecting"].includes(this.roomConnectionStatus)) {
5573
+ console.warn(`Trying to join when room state is already ${this.roomConnectionStatus}`);
5481
5574
  return;
5482
5575
  }
5483
5576
  this.logger.log("Joining room");
5484
- this.roomConnectionState = "connecting";
5577
+ this.roomConnectionStatus = "connecting";
5578
+ this.dispatchEvent(new CustomEvent("room_connection_status_changed", {
5579
+ detail: {
5580
+ roomConnectionStatus: this.roomConnectionStatus,
5581
+ },
5582
+ }));
5583
+ const organization = yield this.organizationServiceCache.fetchOrganization();
5584
+ if (!organization) {
5585
+ throw new Error("Invalid room url");
5586
+ }
5587
+ this.organizationId = organization.organizationId;
5485
5588
  if (this._ownsLocalMedia) {
5486
5589
  yield this.localMedia.start();
5487
5590
  }
@@ -5510,57 +5613,32 @@ class RoomConnection extends TypedEventTarget {
5510
5613
  simulcastScreenshareOn: false,
5511
5614
  },
5512
5615
  });
5513
- const organization = yield this.organizationServiceCache.fetchOrganization();
5514
- if (!organization) {
5515
- throw new Error("Invalid room url");
5516
- }
5517
5616
  // Identify device on signal connection
5518
5617
  const deviceCredentials = yield this.credentialsService.getCredentials();
5519
- this.logger.log("Connecting to signal socket");
5618
+ this.logger.log("Connected to signal socket");
5520
5619
  this.signalSocket.emit("identify_device", { deviceCredentials });
5521
5620
  this.signalSocket.once("device_identified", () => {
5522
- this.logger.log("Connected to signal socket");
5523
- this.signalSocket.emit("join_room", {
5524
- avatarUrl: null,
5525
- config: {
5526
- isAudioEnabled: this.localMedia.isMicrophoneEnabled(),
5527
- isVideoEnabled: this.localMedia.isCameraEnabled(),
5528
- },
5529
- deviceCapabilities: { canScreenshare: true },
5530
- displayName: this.displayName,
5531
- isCoLocated: false,
5532
- isDevicePermissionDenied: false,
5533
- kickFromOtherRooms: false,
5534
- organizationId: organization.organizationId,
5535
- roomKey: this.roomKey,
5536
- roomName: this.roomUrl.pathname,
5537
- selfId: "",
5538
- userAgent: `browser-sdk:${sdkVersion }`,
5539
- });
5540
- });
5541
- this.signalSocket.once("room_joined", (res) => {
5542
- const { selfId, room: { clients }, } = res;
5543
- const localClient = clients.find((c) => c.id === selfId);
5544
- if (!localClient)
5545
- throw new Error("Missing local client");
5546
- this.localParticipant = new LocalParticipant(Object.assign(Object.assign({}, localClient), { stream: this.localMedia.stream || undefined }));
5547
- this.remoteParticipants = clients
5548
- .filter((c) => c.id !== selfId)
5549
- .map((c) => new RemoteParticipant(Object.assign(Object.assign({}, c), { newJoiner: false })));
5550
- // Accept remote streams if RTC manager has been initialized
5551
- if (this.rtcManager) {
5552
- this._handleAcceptStreams(this.remoteParticipants);
5553
- }
5554
- this.roomConnectionState = "connected";
5555
- this.dispatchEvent(new CustomEvent("room_joined", {
5556
- detail: {
5557
- localParticipant: this.localParticipant,
5558
- remoteParticipants: this.remoteParticipants,
5559
- },
5560
- }));
5621
+ this._joinRoom();
5561
5622
  });
5562
5623
  });
5563
5624
  }
5625
+ knock() {
5626
+ this.roomConnectionStatus = "knocking";
5627
+ this.dispatchEvent(new CustomEvent("room_connection_status_changed", {
5628
+ detail: {
5629
+ roomConnectionStatus: this.roomConnectionStatus,
5630
+ },
5631
+ }));
5632
+ this.signalSocket.emit("knock_room", {
5633
+ displayName: this.displayName,
5634
+ imageUrl: null,
5635
+ kickFromOtherRooms: true,
5636
+ liveVideo: false,
5637
+ organizationId: this.organizationId,
5638
+ roomKey: this._roomKey,
5639
+ roomName: this.roomName,
5640
+ });
5641
+ }
5564
5642
  leave() {
5565
5643
  return new Promise((resolve) => {
5566
5644
  if (this._ownsLocalMedia) {
@@ -5598,14 +5676,30 @@ class RoomConnection extends TypedEventTarget {
5598
5676
  },
5599
5677
  });
5600
5678
  }
5679
+ acceptWaitingParticipant(participantId) {
5680
+ this.signalSocket.emit("handle_knock", {
5681
+ action: "accept",
5682
+ clientId: participantId,
5683
+ response: {},
5684
+ });
5685
+ }
5686
+ rejectWaitingParticipant(participantId) {
5687
+ this.signalSocket.emit("handle_knock", {
5688
+ action: "reject",
5689
+ clientId: participantId,
5690
+ response: {},
5691
+ });
5692
+ }
5601
5693
  }
5602
5694
 
5603
5695
  const initialState = {
5604
5696
  chatMessages: [],
5697
+ roomConnectionStatus: "",
5605
5698
  isJoining: false,
5606
5699
  joinError: null,
5607
5700
  mostRecentChatMessage: null,
5608
5701
  remoteParticipants: [],
5702
+ waitingParticipants: [],
5609
5703
  };
5610
5704
  function updateParticipant(remoteParticipants, participantId, updates) {
5611
5705
  const existingParticipant = remoteParticipants.find((p) => p.id === participantId);
@@ -5624,7 +5718,9 @@ function reducer(state, action) {
5624
5718
  case "CHAT_MESSAGE":
5625
5719
  return Object.assign(Object.assign({}, state), { chatMessages: [...state.chatMessages, action.payload], mostRecentChatMessage: action.payload });
5626
5720
  case "ROOM_JOINED":
5627
- return Object.assign(Object.assign({}, state), { localParticipant: action.payload.localParticipant, remoteParticipants: action.payload.remoteParticipants, roomConnectionStatus: "connected" });
5721
+ return Object.assign(Object.assign({}, state), { localParticipant: action.payload.localParticipant, remoteParticipants: action.payload.remoteParticipants, waitingParticipants: action.payload.waitingParticipants, roomConnectionStatus: "connected" });
5722
+ case "ROOM_CONNECTION_STATUS_CHANGED":
5723
+ return Object.assign(Object.assign({}, state), { roomConnectionStatus: action.payload.roomConnectionStatus });
5628
5724
  case "PARTICIPANT_AUDIO_ENABLED":
5629
5725
  return Object.assign(Object.assign({}, state), { remoteParticipants: updateParticipant(state.remoteParticipants, action.payload.participantId, {
5630
5726
  isAudioEnabled: action.payload.isAudioEnabled,
@@ -5649,6 +5745,13 @@ function reducer(state, action) {
5649
5745
  if (!state.localParticipant)
5650
5746
  return state;
5651
5747
  return Object.assign(Object.assign({}, state), { localParticipant: Object.assign(Object.assign({}, state.localParticipant), { displayName: action.payload.displayName }) });
5748
+ case "WAITING_PARTICIPANT_JOINED":
5749
+ return Object.assign(Object.assign({}, state), { waitingParticipants: [
5750
+ ...state.waitingParticipants,
5751
+ { id: action.payload.participantId, displayName: action.payload.displayName },
5752
+ ] });
5753
+ case "WAITING_PARTICIPANT_LEFT":
5754
+ return Object.assign(Object.assign({}, state), { waitingParticipants: state.waitingParticipants.filter((wp) => wp.id !== action.payload.participantId) });
5652
5755
  default:
5653
5756
  throw state;
5654
5757
  }
@@ -5680,9 +5783,13 @@ function useRoomConnection(roomUrl, roomConnectionOptions) {
5680
5783
  const { participantId, stream } = e.detail;
5681
5784
  dispatch({ type: "PARTICIPANT_STREAM_ADDED", payload: { participantId, stream } });
5682
5785
  });
5786
+ roomConnection.addEventListener("room_connection_status_changed", (e) => {
5787
+ const { roomConnectionStatus } = e.detail;
5788
+ dispatch({ type: "ROOM_CONNECTION_STATUS_CHANGED", payload: { roomConnectionStatus } });
5789
+ });
5683
5790
  roomConnection.addEventListener("room_joined", (e) => {
5684
- const { localParticipant, remoteParticipants } = e.detail;
5685
- dispatch({ type: "ROOM_JOINED", payload: { localParticipant, remoteParticipants } });
5791
+ const { localParticipant, remoteParticipants, waitingParticipants } = e.detail;
5792
+ dispatch({ type: "ROOM_JOINED", payload: { localParticipant, remoteParticipants, waitingParticipants } });
5686
5793
  });
5687
5794
  roomConnection.addEventListener("participant_video_enabled", (e) => {
5688
5795
  const { participantId, isVideoEnabled } = e.detail;
@@ -5692,6 +5799,14 @@ function useRoomConnection(roomUrl, roomConnectionOptions) {
5692
5799
  const { participantId, displayName } = e.detail;
5693
5800
  dispatch({ type: "PARTICIPANT_METADATA_CHANGED", payload: { participantId, displayName } });
5694
5801
  });
5802
+ roomConnection.addEventListener("waiting_participant_joined", (e) => {
5803
+ const { participantId, displayName } = e.detail;
5804
+ dispatch({ type: "WAITING_PARTICIPANT_JOINED", payload: { participantId, displayName } });
5805
+ });
5806
+ roomConnection.addEventListener("waiting_participant_left", (e) => {
5807
+ const { participantId } = e.detail;
5808
+ dispatch({ type: "WAITING_PARTICIPANT_LEFT", payload: { participantId } });
5809
+ });
5695
5810
  roomConnection.join();
5696
5811
  return () => {
5697
5812
  roomConnection.leave();
@@ -5700,18 +5815,27 @@ function useRoomConnection(roomUrl, roomConnectionOptions) {
5700
5815
  return {
5701
5816
  state,
5702
5817
  actions: {
5818
+ knock: () => {
5819
+ roomConnection.knock();
5820
+ },
5703
5821
  sendChatMessage: (text) => {
5704
5822
  roomConnection.sendChatMessage(text);
5705
5823
  },
5706
5824
  setDisplayName: (displayName) => {
5707
- roomConnection === null || roomConnection === void 0 ? void 0 : roomConnection.setDisplayName(displayName);
5825
+ roomConnection.setDisplayName(displayName);
5708
5826
  dispatch({ type: "LOCAL_CLIENT_DISPLAY_NAME_CHANGED", payload: { displayName } });
5709
5827
  },
5710
5828
  toggleCamera: (enabled) => {
5711
- roomConnection === null || roomConnection === void 0 ? void 0 : roomConnection.localMedia.toggleCameraEnabled(enabled);
5829
+ roomConnection.localMedia.toggleCameraEnabled(enabled);
5712
5830
  },
5713
5831
  toggleMicrophone: (enabled) => {
5714
- roomConnection === null || roomConnection === void 0 ? void 0 : roomConnection.localMedia.toggleMichrophoneEnabled(enabled);
5832
+ roomConnection.localMedia.toggleMichrophoneEnabled(enabled);
5833
+ },
5834
+ acceptWaitingParticipant: (participantId) => {
5835
+ roomConnection.acceptWaitingParticipant(participantId);
5836
+ },
5837
+ rejectWaitingParticipant: (participantId) => {
5838
+ roomConnection.rejectWaitingParticipant(participantId);
5715
5839
  },
5716
5840
  },
5717
5841
  components: {
@@ -5721,6 +5845,6 @@ function useRoomConnection(roomUrl, roomConnectionOptions) {
5721
5845
  };
5722
5846
  }
5723
5847
 
5724
- const sdkVersion = "2.0.0-alpha8";
5848
+ const sdkVersion = "2.0.0-alpha9";
5725
5849
 
5726
5850
  export { VideoView, sdkVersion, useLocalMedia, useRoomConnection };
package/dist/types.d.ts CHANGED
@@ -150,6 +150,10 @@ declare class RemoteParticipant extends RoomParticipant {
150
150
  declare class LocalParticipant extends RoomParticipant {
151
151
  readonly isLocalParticipant = true;
152
152
  constructor({ displayName, id, stream, isAudioEnabled, isVideoEnabled }: RoomParticipantData);
153
+ }
154
+ interface WaitingParticipant {
155
+ id: string;
156
+ displayName: string | null;
153
157
  }
154
158
 
155
159
  type Logger = Pick<Console, "debug" | "error" | "log" | "warn">;
@@ -161,9 +165,14 @@ interface RoomConnectionOptions {
161
165
  localMedia?: LocalMedia;
162
166
  }
163
167
  type ChatMessage = Pick<ChatMessage$1, "senderId" | "timestamp" | "text">;
168
+ type RoomConnectionStatus = "" | "connecting" | "connected" | "room_locked" | "knocking" | "disconnected" | "accepted" | "rejected";
164
169
  type RoomJoinedEvent = {
165
170
  localParticipant: LocalParticipant;
166
171
  remoteParticipants: RemoteParticipant[];
172
+ waitingParticipants: WaitingParticipant[];
173
+ };
174
+ type RoomConnectionStatusChangedEvent = {
175
+ roomConnectionStatus: RoomConnectionStatus;
167
176
  };
168
177
  type ParticipantJoinedEvent = {
169
178
  remoteParticipant: RemoteParticipant;
@@ -187,6 +196,13 @@ type ParticipantMetadataChangedEvent = {
187
196
  participantId: string;
188
197
  displayName: string;
189
198
  };
199
+ type WaitingParticipantJoinedEvent = {
200
+ participantId: string;
201
+ displayName: string | null;
202
+ };
203
+ type WaitingParticipantLeftEvent = {
204
+ participantId: string;
205
+ };
190
206
  interface RoomEventsMap {
191
207
  chat_message: CustomEvent<ChatMessage>;
192
208
  participant_audio_enabled: CustomEvent<ParticipantAudioEnabledEvent>;
@@ -195,7 +211,10 @@ interface RoomEventsMap {
195
211
  participant_metadata_changed: CustomEvent<ParticipantMetadataChangedEvent>;
196
212
  participant_stream_added: CustomEvent<ParticipantStreamAddedEvent>;
197
213
  participant_video_enabled: CustomEvent<ParticipantVideoEnabledEvent>;
214
+ room_connection_status_changed: CustomEvent<RoomConnectionStatusChangedEvent>;
198
215
  room_joined: CustomEvent<RoomJoinedEvent>;
216
+ waiting_participant_joined: CustomEvent<WaitingParticipantJoinedEvent>;
217
+ waiting_participant_left: CustomEvent<WaitingParticipantLeftEvent>;
199
218
  }
200
219
  interface RoomEventTarget extends EventTarget {
201
220
  addEventListener<K extends keyof RoomEventsMap>(type: K, listener: (ev: RoomEventsMap[K]) => void, options?: boolean | AddEventListenerOptions): void;
@@ -208,6 +227,8 @@ declare class RoomConnection extends TypedEventTarget {
208
227
  roomUrl: URL;
209
228
  remoteParticipants: RemoteParticipant[];
210
229
  readonly localMediaConstraints?: MediaStreamConstraints;
230
+ readonly roomName: string;
231
+ private organizationId;
211
232
  private credentialsService;
212
233
  private apiClient;
213
234
  private organizationService;
@@ -217,7 +238,7 @@ declare class RoomConnection extends TypedEventTarget {
217
238
  private signalSocket;
218
239
  private rtcManagerDispatcher?;
219
240
  private rtcManager?;
220
- private roomConnectionState;
241
+ private roomConnectionStatus;
221
242
  private logger;
222
243
  private _ownsLocalMedia;
223
244
  private displayName?;
@@ -230,14 +251,22 @@ declare class RoomConnection extends TypedEventTarget {
230
251
  private _handleClientAudioEnabled;
231
252
  private _handleClientVideoEnabled;
232
253
  private _handleClientMetadataReceived;
254
+ private _handleKnockHandled;
255
+ private _handleKnockerLeft;
256
+ private _handleRoomJoined;
257
+ private _handleRoomKnocked;
233
258
  private _handleRtcEvent;
234
259
  private _handleRtcManagerCreated;
235
260
  private _handleAcceptStreams;
236
261
  private _handleStreamAdded;
262
+ private _joinRoom;
237
263
  join(): Promise<void>;
264
+ knock(): void;
238
265
  leave(): Promise<void>;
239
266
  sendChatMessage(text: string): void;
240
267
  setDisplayName(displayName: string): void;
268
+ acceptWaitingParticipant(participantId: string): void;
269
+ rejectWaitingParticipant(participantId: string): void;
241
270
  }
242
271
 
243
272
  type RemoteParticipantState = Omit<RemoteParticipant, "updateStreamState">;
@@ -247,17 +276,21 @@ interface RoomConnectionState {
247
276
  joinError: unknown;
248
277
  localParticipant?: LocalParticipant;
249
278
  mostRecentChatMessage: ChatMessage | null;
250
- roomConnectionStatus?: "connecting" | "connected" | "disconnected";
279
+ roomConnectionStatus: RoomConnectionStatus;
251
280
  remoteParticipants: RemoteParticipantState[];
281
+ waitingParticipants: WaitingParticipant[];
252
282
  }
253
283
  interface UseRoomConnectionOptions extends Omit<RoomConnectionOptions, "localMedia"> {
254
284
  localMedia?: LocalMediaRef;
255
285
  }
256
286
  interface RoomConnectionActions {
257
287
  sendChatMessage(text: string): void;
288
+ knock(): void;
258
289
  setDisplayName(displayName: string): void;
259
290
  toggleCamera(enabled?: boolean): void;
260
291
  toggleMicrophone(enabled?: boolean): void;
292
+ acceptWaitingParticipant(participantId: string): void;
293
+ rejectWaitingParticipant(participantId: string): void;
261
294
  }
262
295
  interface RoomConnectionComponents {
263
296
  VideoView: typeof _default;
@@ -270,6 +303,6 @@ type RoomConnectionRef = {
270
303
  };
271
304
  declare function useRoomConnection(roomUrl: string, roomConnectionOptions: UseRoomConnectionOptions): RoomConnectionRef;
272
305
 
273
- declare const sdkVersion = "2.0.0-alpha8";
306
+ declare const sdkVersion = "2.0.0-alpha9";
274
307
 
275
308
  export { _default as VideoView, sdkVersion, useLocalMedia, useRoomConnection };