@signalwire/js 3.28.0 → 3.28.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/core/src/BaseSession.d.ts +1 -1
- package/dist/core/src/RPCMessages/VertoMessages.d.ts +7 -0
- package/dist/core/src/RPCMessages/VertoMessages.d.ts.map +1 -1
- package/dist/core/src/index.d.ts +2 -2
- package/dist/core/src/index.d.ts.map +1 -1
- package/dist/core/src/redux/features/component/componentSlice.d.ts +96 -0
- package/dist/core/src/redux/features/component/componentSlice.d.ts.map +1 -1
- package/dist/core/src/redux/rootReducer.d.ts +16 -0
- package/dist/core/src/redux/rootReducer.d.ts.map +1 -1
- package/dist/core/src/types/common.d.ts +16 -10
- package/dist/core/src/types/common.d.ts.map +1 -1
- package/dist/core/src/types/fabric.d.ts +0 -27
- package/dist/core/src/types/fabric.d.ts.map +1 -1
- package/dist/core/src/types/index.d.ts +67 -1
- package/dist/core/src/types/index.d.ts.map +1 -1
- package/dist/core/src/types/videoPlayback.d.ts +1 -7
- package/dist/core/src/types/videoPlayback.d.ts.map +1 -1
- package/dist/core/src/types/videoRecording.d.ts +1 -7
- package/dist/core/src/types/videoRecording.d.ts.map +1 -1
- package/dist/core/src/types/voice.d.ts +13 -2
- package/dist/core/src/types/voice.d.ts.map +1 -1
- package/dist/core/src/types/voiceCall.d.ts +96 -964
- package/dist/core/src/types/voiceCall.d.ts.map +1 -1
- package/dist/core/src/types/voiceCollect.d.ts +166 -0
- package/dist/core/src/types/voiceCollect.d.ts.map +1 -0
- package/dist/core/src/types/voiceConnect.d.ts +77 -0
- package/dist/core/src/types/voiceConnect.d.ts.map +1 -0
- package/dist/core/src/types/voiceDetect.d.ts +127 -0
- package/dist/core/src/types/voiceDetect.d.ts.map +1 -0
- package/dist/core/src/types/voicePlayback.d.ts +141 -0
- package/dist/core/src/types/voicePlayback.d.ts.map +1 -0
- package/dist/core/src/types/voicePrompt.d.ts +105 -0
- package/dist/core/src/types/voicePrompt.d.ts.map +1 -0
- package/dist/core/src/types/voiceRecording.d.ts +107 -0
- package/dist/core/src/types/voiceRecording.d.ts.map +1 -0
- package/dist/core/src/types/voiceSendDigits.d.ts +21 -0
- package/dist/core/src/types/voiceSendDigits.d.ts.map +1 -0
- package/dist/core/src/types/voiceTap.d.ts +116 -0
- package/dist/core/src/types/voiceTap.d.ts.map +1 -0
- package/dist/core/src/utils/constants.d.ts.map +1 -1
- package/dist/core/src/utils/eventUtils.d.ts +0 -2
- package/dist/core/src/utils/eventUtils.d.ts.map +1 -1
- package/dist/core/src/utils/interfaces.d.ts +19 -2
- package/dist/core/src/utils/interfaces.d.ts.map +1 -1
- package/dist/index.esm.js +636 -223
- package/dist/index.esm.js.map +4 -4
- package/dist/index.js +655 -233
- package/dist/index.js.map +4 -4
- package/dist/index.umd.js +26 -2
- package/dist/index.umd.js.map +1 -1
- package/dist/js/src/fabric/Conversation.d.ts +2 -2
- package/dist/js/src/fabric/Conversation.d.ts.map +1 -1
- package/dist/js/src/fabric/FabricRoomSession.d.ts +5 -4
- package/dist/js/src/fabric/FabricRoomSession.d.ts.map +1 -1
- package/dist/js/src/fabric/SignalWire.d.ts.map +1 -1
- package/dist/js/src/fabric/WSClient.d.ts +2 -2
- package/dist/js/src/fabric/WSClient.d.ts.map +1 -1
- package/dist/js/src/fabric/createWSClient.d.ts +1 -1
- package/dist/js/src/fabric/createWSClient.d.ts.map +1 -1
- package/dist/js/src/fabric/interfaces/capabilities.d.ts +28 -0
- package/dist/js/src/fabric/interfaces/capabilities.d.ts.map +1 -0
- package/dist/js/src/fabric/interfaces/conversation.d.ts +4 -4
- package/dist/js/src/fabric/interfaces/conversation.d.ts.map +1 -1
- package/dist/js/src/fabric/interfaces/index.d.ts +1 -0
- package/dist/js/src/fabric/interfaces/index.d.ts.map +1 -1
- package/dist/js/src/fabric/interfaces/wsClient.d.ts +2 -2
- package/dist/js/src/fabric/interfaces/wsClient.d.ts.map +1 -1
- package/dist/js/src/fabric/utils/capabilitiesHelpers.d.ts +28 -0
- package/dist/js/src/fabric/utils/capabilitiesHelpers.d.ts.map +1 -0
- package/dist/js/src/fabric/workers/callJoinWorker.d.ts.map +1 -1
- package/dist/js/src/fabric/workers/wsClientWorker.d.ts.map +1 -1
- package/dist/js/src/index.d.ts +2 -2
- package/dist/js/src/index.d.ts.map +1 -1
- package/dist/js/src/utils/interfaces/fabric.d.ts +6 -3
- package/dist/js/src/utils/interfaces/fabric.d.ts.map +1 -1
- package/dist/js/src/utils/paginatedResult.d.ts +4 -4
- package/dist/js/tsconfig.build.tsbuildinfo +1 -1
- package/dist/webrtc/src/BaseConnection.d.ts +78 -19
- package/dist/webrtc/src/BaseConnection.d.ts.map +1 -1
- package/dist/webrtc/src/RTCPeer.d.ts +11 -0
- package/dist/webrtc/src/RTCPeer.d.ts.map +1 -1
- package/dist/webrtc/src/utils/helpers.d.ts.map +1 -1
- package/dist/webrtc/src/utils/interfaces.d.ts +6 -0
- package/dist/webrtc/src/utils/interfaces.d.ts.map +1 -1
- package/dist/webrtc/src/utils/sdpHelpers.d.ts +27 -2
- package/dist/webrtc/src/utils/sdpHelpers.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/fabric/Conversation.ts +9 -7
- package/src/fabric/FabricRoomSession.ts +32 -32
- package/src/fabric/SignalWire.test.ts +2 -0
- package/src/fabric/SignalWire.ts +2 -0
- package/src/fabric/WSClient.ts +6 -10
- package/src/fabric/interfaces/capabilities.ts +30 -0
- package/src/fabric/interfaces/conversation.ts +5 -4
- package/src/fabric/interfaces/index.ts +2 -1
- package/src/fabric/interfaces/wsClient.ts +2 -2
- package/src/fabric/utils/capabilitiesHelpers.test.ts +201 -0
- package/src/fabric/utils/capabilitiesHelpers.ts +190 -0
- package/src/fabric/workers/callJoinWorker.ts +7 -6
- package/src/fabric/workers/wsClientWorker.ts +35 -12
- package/src/index.ts +1 -1
- package/src/utils/interfaces/fabric.ts +10 -3
- package/dist/core/src/utils/eventUtils.test.d.ts +0 -2
- package/dist/core/src/utils/eventUtils.test.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __defProps = Object.defineProperties;
|
|
@@ -46,12 +47,16 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
46
47
|
}
|
|
47
48
|
return to;
|
|
48
49
|
};
|
|
49
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
50
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
51
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
52
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
53
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
54
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
55
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
56
|
+
mod
|
|
57
|
+
));
|
|
50
58
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
51
|
-
var __publicField = (obj, key, value) =>
|
|
52
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
53
|
-
return value;
|
|
54
|
-
};
|
|
59
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
55
60
|
var __superGet = (cls, obj, key) => __reflectGet(__getProtoOf(cls), key, obj);
|
|
56
61
|
var __async = (__this, __arguments, generator) => {
|
|
57
62
|
return new Promise((resolve, reject) => {
|
|
@@ -75,8 +80,8 @@ var __async = (__this, __arguments, generator) => {
|
|
|
75
80
|
};
|
|
76
81
|
|
|
77
82
|
// src/index.ts
|
|
78
|
-
var
|
|
79
|
-
__export(
|
|
83
|
+
var index_exports = {};
|
|
84
|
+
__export(index_exports, {
|
|
80
85
|
Chat: () => chat_exports,
|
|
81
86
|
Fabric: () => fabric_exports,
|
|
82
87
|
LocalVideoOverlay: () => LocalVideoOverlay,
|
|
@@ -87,7 +92,7 @@ __export(src_exports, {
|
|
|
87
92
|
WebRTC: () => webrtc_exports,
|
|
88
93
|
buildVideoElement: () => buildVideoElement
|
|
89
94
|
});
|
|
90
|
-
module.exports = __toCommonJS(
|
|
95
|
+
module.exports = __toCommonJS(index_exports);
|
|
91
96
|
|
|
92
97
|
// src/chat/index.ts
|
|
93
98
|
var chat_exports = {};
|
|
@@ -124,7 +129,9 @@ var setAudioMediaTrack = ({
|
|
|
124
129
|
|
|
125
130
|
// src/features/actions.ts
|
|
126
131
|
var import_core = require("@signalwire/core");
|
|
127
|
-
var audioSetSpeakerAction = import_core.actions.createAction(
|
|
132
|
+
var audioSetSpeakerAction = import_core.actions.createAction(
|
|
133
|
+
"swJs/audioSetSpeakerAction"
|
|
134
|
+
);
|
|
128
135
|
|
|
129
136
|
// src/features/mediaElements/mediaElementsSagas.ts
|
|
130
137
|
var makeAudioElementSaga = ({ speakerId }) => {
|
|
@@ -165,14 +172,25 @@ function* audioElementActionsWatcher({
|
|
|
165
172
|
element,
|
|
166
173
|
room
|
|
167
174
|
}) {
|
|
168
|
-
const setSpeakerActionType = import_core2.actions.getCustomSagaActionType(
|
|
175
|
+
const setSpeakerActionType = import_core2.actions.getCustomSagaActionType(
|
|
176
|
+
room.__uuid,
|
|
177
|
+
audioSetSpeakerAction
|
|
178
|
+
);
|
|
169
179
|
while (true) {
|
|
170
180
|
const action = yield import_core2.sagaEffects.take([setSpeakerActionType]);
|
|
171
181
|
try {
|
|
172
182
|
switch (action.type) {
|
|
173
183
|
case setSpeakerActionType:
|
|
174
|
-
const response = yield import_core2.sagaEffects.call(
|
|
175
|
-
|
|
184
|
+
const response = yield import_core2.sagaEffects.call(
|
|
185
|
+
import_webrtc.setMediaElementSinkId,
|
|
186
|
+
element,
|
|
187
|
+
action.payload
|
|
188
|
+
);
|
|
189
|
+
room.emit(
|
|
190
|
+
// @ts-expect-error
|
|
191
|
+
`${import_core2.LOCAL_EVENT_PREFIX}.speaker.updated`,
|
|
192
|
+
action.payload
|
|
193
|
+
);
|
|
176
194
|
room.settleCustomSagaTrigger({
|
|
177
195
|
dispatchId: action.dispatchId,
|
|
178
196
|
payload: response,
|
|
@@ -224,7 +242,11 @@ var videoManagerRoomsWorker = function* (options) {
|
|
|
224
242
|
const modPayload = {
|
|
225
243
|
rooms: payload.rooms.map((row) => (0, import_core3.toExternalJSON)(row))
|
|
226
244
|
};
|
|
227
|
-
client.emit(
|
|
245
|
+
client.emit(
|
|
246
|
+
(0, import_core3.stripNamespacePrefix)(type),
|
|
247
|
+
// @ts-expect-error
|
|
248
|
+
modPayload
|
|
249
|
+
);
|
|
228
250
|
(0, import_core3.getLogger)().trace("videoManagerRoomsWorker ended");
|
|
229
251
|
};
|
|
230
252
|
|
|
@@ -236,7 +258,10 @@ var videoManagerRoomWorker = function* (options) {
|
|
|
236
258
|
instance: client,
|
|
237
259
|
action: { type, payload }
|
|
238
260
|
} = options;
|
|
239
|
-
client.emit(
|
|
261
|
+
client.emit(
|
|
262
|
+
(0, import_core4.stripNamespacePrefix)(type),
|
|
263
|
+
(0, import_core4.toExternalJSON)(payload)
|
|
264
|
+
);
|
|
240
265
|
(0, import_core4.getLogger)().trace("videoManagerRoomWorker ended");
|
|
241
266
|
};
|
|
242
267
|
|
|
@@ -269,9 +294,12 @@ var videoManagerWorker = function* (options) {
|
|
|
269
294
|
}
|
|
270
295
|
}
|
|
271
296
|
while (true) {
|
|
272
|
-
const action = yield import_core5.sagaEffects.take(
|
|
273
|
-
|
|
274
|
-
|
|
297
|
+
const action = yield import_core5.sagaEffects.take(
|
|
298
|
+
swEventChannel,
|
|
299
|
+
(action2) => {
|
|
300
|
+
return action2.type.startsWith("video-manager.");
|
|
301
|
+
}
|
|
302
|
+
);
|
|
275
303
|
yield import_core5.sagaEffects.fork(worker, action);
|
|
276
304
|
}
|
|
277
305
|
(0, import_core5.getLogger)().trace("videoManagerWorker ended");
|
|
@@ -285,8 +313,11 @@ var VideoManagerAPI = class extends import_core6.BaseConsumer {
|
|
|
285
313
|
worker: videoManagerWorker
|
|
286
314
|
});
|
|
287
315
|
}
|
|
316
|
+
/** @internal */
|
|
288
317
|
getSubscriptions() {
|
|
289
|
-
const eventNamesWithPrefix = this.eventNames().map(
|
|
318
|
+
const eventNamesWithPrefix = this.eventNames().map(
|
|
319
|
+
(event) => `video-manager.${event}`
|
|
320
|
+
);
|
|
290
321
|
return (0, import_core6.validateEventsToSubscribe)(eventNamesWithPrefix);
|
|
291
322
|
}
|
|
292
323
|
};
|
|
@@ -329,6 +360,7 @@ var SCREENSHARE_AUDIO_CONSTRAINTS = {
|
|
|
329
360
|
echoCancellation: true,
|
|
330
361
|
noiseSuppression: false,
|
|
331
362
|
autoGainControl: false,
|
|
363
|
+
// @ts-expect-error
|
|
332
364
|
googAutoGainControl: false
|
|
333
365
|
};
|
|
334
366
|
|
|
@@ -357,16 +389,24 @@ var getJoinMediaParams = (options) => {
|
|
|
357
389
|
const reqToReceiveAudio = Boolean(receiveAudio != null ? receiveAudio : audio);
|
|
358
390
|
const reqToReceiveVideo = Boolean(receiveVideo != null ? receiveVideo : video);
|
|
359
391
|
if (!canSendAudio && reqToSendAudio) {
|
|
360
|
-
(0, import_core7.getLogger)().info(
|
|
392
|
+
(0, import_core7.getLogger)().info(
|
|
393
|
+
"Not allowed to send audio on this room. Default values will be used."
|
|
394
|
+
);
|
|
361
395
|
}
|
|
362
396
|
if (!canSendVideo && reqToSendVideo) {
|
|
363
|
-
(0, import_core7.getLogger)().info(
|
|
397
|
+
(0, import_core7.getLogger)().info(
|
|
398
|
+
"Not allowed to send video on this room. Default values will be used."
|
|
399
|
+
);
|
|
364
400
|
}
|
|
365
401
|
if (!canReceiveAudio && reqToReceiveAudio) {
|
|
366
|
-
(0, import_core7.getLogger)().info(
|
|
402
|
+
(0, import_core7.getLogger)().info(
|
|
403
|
+
"Not allowed to receive video from the room. Default values will be used."
|
|
404
|
+
);
|
|
367
405
|
}
|
|
368
406
|
if (!canReceiveVideo && reqToReceiveVideo) {
|
|
369
|
-
(0, import_core7.getLogger)().info(
|
|
407
|
+
(0, import_core7.getLogger)().info(
|
|
408
|
+
"Not allowed to receive video from the room. Default values will be used."
|
|
409
|
+
);
|
|
370
410
|
}
|
|
371
411
|
return {
|
|
372
412
|
mustSendAudio: canSendAudio && reqToSendAudio,
|
|
@@ -416,8 +456,11 @@ var EXTERNAL_MEMBER_LIST_UPDATED_EVENT = "memberList.updated";
|
|
|
416
456
|
var INTERNAL_MEMBER_LIST_UPDATED_EVENT = (0, import_core9.toInternalEventName)({
|
|
417
457
|
event: EXTERNAL_MEMBER_LIST_UPDATED_EVENT
|
|
418
458
|
});
|
|
419
|
-
var SYNTHETIC_MEMBER_LIST_UPDATED_EVENT = (0, import_core9.toSyntheticEvent)(
|
|
459
|
+
var SYNTHETIC_MEMBER_LIST_UPDATED_EVENT = (0, import_core9.toSyntheticEvent)(
|
|
460
|
+
INTERNAL_MEMBER_LIST_UPDATED_EVENT
|
|
461
|
+
);
|
|
420
462
|
var MEMBER_LIST_EVENTS = [
|
|
463
|
+
/** Alias to `video.room.subscribed` */
|
|
421
464
|
"video.room.joined",
|
|
422
465
|
"video.member.joined",
|
|
423
466
|
"video.member.left",
|
|
@@ -432,7 +475,9 @@ var getMemberListEventsToSubscribe = (subscriptions) => {
|
|
|
432
475
|
});
|
|
433
476
|
};
|
|
434
477
|
var shouldHandleMemberList = (subscriptions) => {
|
|
435
|
-
return subscriptions.some(
|
|
478
|
+
return subscriptions.some(
|
|
479
|
+
(event) => event.includes(EXTERNAL_MEMBER_LIST_UPDATED_EVENT)
|
|
480
|
+
);
|
|
436
481
|
};
|
|
437
482
|
var getMembersFromAction = (action) => {
|
|
438
483
|
if (action.type === "video.room.joined") {
|
|
@@ -483,15 +528,24 @@ function* membersListUpdatedWatcher({
|
|
|
483
528
|
const roomSessionId = pubSubAction.type === "video.room.joined" ? pubSubAction.payload.room_session.id : pubSubAction.payload.room_session_id;
|
|
484
529
|
const members = getUpdatedMembers({ action: pubSubAction, memberList });
|
|
485
530
|
const memberListPayload = {
|
|
531
|
+
/**
|
|
532
|
+
* At this point it's needed to send the
|
|
533
|
+
* `room_session_id` so the pubSubSaga can properly
|
|
534
|
+
* infer the namespace for emitting the events to the
|
|
535
|
+
* appropiate room.
|
|
536
|
+
*/
|
|
486
537
|
room_session_id: roomSessionId,
|
|
487
538
|
members
|
|
488
539
|
};
|
|
489
540
|
instance.emit(SYNTHETIC_MEMBER_LIST_UPDATED_EVENT, memberListPayload);
|
|
490
541
|
}
|
|
491
542
|
while (true) {
|
|
492
|
-
const pubSubAction = yield import_core9.sagaEffects.take(
|
|
493
|
-
|
|
494
|
-
|
|
543
|
+
const pubSubAction = yield import_core9.sagaEffects.take(
|
|
544
|
+
swEventChannel,
|
|
545
|
+
({ type }) => {
|
|
546
|
+
return isMemberListEvent(type);
|
|
547
|
+
}
|
|
548
|
+
);
|
|
495
549
|
yield import_core9.sagaEffects.fork(worker, pubSubAction);
|
|
496
550
|
}
|
|
497
551
|
}
|
|
@@ -531,17 +585,21 @@ var childMemberJoinedWorker = function* (options) {
|
|
|
531
585
|
});
|
|
532
586
|
const { member } = action.payload;
|
|
533
587
|
if (member == null ? void 0 : member.parent_id) {
|
|
534
|
-
const byId = yield import_core10.sagaEffects.select(
|
|
588
|
+
const byId = yield import_core10.sagaEffects.select(
|
|
589
|
+
import_core10.componentSelectors.getComponentsById
|
|
590
|
+
);
|
|
535
591
|
const parent = Object.values(byId).find((row) => {
|
|
536
592
|
return "memberId" in row && row.memberId === member.parent_id;
|
|
537
593
|
});
|
|
538
594
|
if (parent) {
|
|
539
|
-
yield import_core10.sagaEffects.put(
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
595
|
+
yield import_core10.sagaEffects.put(
|
|
596
|
+
import_core10.componentActions.upsert({
|
|
597
|
+
id: instance.callId,
|
|
598
|
+
roomId: action.payload.room_id,
|
|
599
|
+
roomSessionId: action.payload.room_session_id,
|
|
600
|
+
memberId: member.id
|
|
601
|
+
})
|
|
602
|
+
);
|
|
545
603
|
onDone == null ? void 0 : onDone();
|
|
546
604
|
} else {
|
|
547
605
|
onFail == null ? void 0 : onFail({ error: new Error("Unknown parent_id") });
|
|
@@ -682,6 +740,7 @@ var videoWorker = function* (options) {
|
|
|
682
740
|
action
|
|
683
741
|
}, options));
|
|
684
742
|
return;
|
|
743
|
+
// Return since we don't need to handle the raw event for this
|
|
685
744
|
case "video.recording.started":
|
|
686
745
|
case "video.recording.updated":
|
|
687
746
|
case "video.recording.ended":
|
|
@@ -723,14 +782,17 @@ var videoWorker = function* (options) {
|
|
|
723
782
|
return action.type.startsWith("video.");
|
|
724
783
|
};
|
|
725
784
|
while (true) {
|
|
726
|
-
const action = yield import_core14.sagaEffects.take(
|
|
785
|
+
const action = yield import_core14.sagaEffects.take(
|
|
786
|
+
swEventChannel,
|
|
787
|
+
isVideoEvent
|
|
788
|
+
);
|
|
727
789
|
yield import_core14.sagaEffects.fork(worker, action);
|
|
728
790
|
}
|
|
729
791
|
(0, import_core14.getLogger)().trace("videoWorker ended");
|
|
730
792
|
};
|
|
731
793
|
|
|
732
794
|
// src/BaseRoomSession.ts
|
|
733
|
-
var BaseRoomSessionConnection = class extends import_webrtc3.BaseConnection {
|
|
795
|
+
var BaseRoomSessionConnection = class _BaseRoomSessionConnection extends import_webrtc3.BaseConnection {
|
|
734
796
|
constructor() {
|
|
735
797
|
super(...arguments);
|
|
736
798
|
__publicField(this, "_screenShareList", /* @__PURE__ */ new Set());
|
|
@@ -757,8 +819,7 @@ var BaseRoomSessionConnection = class extends import_webrtc3.BaseConnection {
|
|
|
757
819
|
return Array.from(this._screenShareList);
|
|
758
820
|
}
|
|
759
821
|
_attachSpeakerTrackListener() {
|
|
760
|
-
if (!(0, import_webrtc3.supportsMediaOutput)())
|
|
761
|
-
return;
|
|
822
|
+
if (!(0, import_webrtc3.supportsMediaOutput)()) return;
|
|
762
823
|
(0, import_webrtc3.createSpeakerDeviceWatcher)().then((deviceWatcher) => {
|
|
763
824
|
deviceWatcher.on("removed", (data) => __async(this, null, function* () {
|
|
764
825
|
var _a, _b;
|
|
@@ -774,8 +835,7 @@ var BaseRoomSessionConnection = class extends import_webrtc3.BaseConnection {
|
|
|
774
835
|
});
|
|
775
836
|
yield (_b = (_a = this._audioEl).setSinkId) == null ? void 0 : _b.call(_a, "");
|
|
776
837
|
const defaultSpeakers = yield (0, import_webrtc3.getSpeakerById)("default");
|
|
777
|
-
if (!(defaultSpeakers == null ? void 0 : defaultSpeakers.deviceId))
|
|
778
|
-
return;
|
|
838
|
+
if (!(defaultSpeakers == null ? void 0 : defaultSpeakers.deviceId)) return;
|
|
779
839
|
this.emit("speaker.updated", {
|
|
780
840
|
previous: {
|
|
781
841
|
deviceId: disconnectedSpeaker.payload.deviceId,
|
|
@@ -790,29 +850,37 @@ var BaseRoomSessionConnection = class extends import_webrtc3.BaseConnection {
|
|
|
790
850
|
}));
|
|
791
851
|
});
|
|
792
852
|
}
|
|
853
|
+
/** @internal */
|
|
793
854
|
_finalize() {
|
|
794
855
|
this._screenShareList.clear();
|
|
795
856
|
super._finalize();
|
|
796
857
|
}
|
|
858
|
+
/** @internal */
|
|
797
859
|
hangup(id) {
|
|
798
860
|
return __async(this, null, function* () {
|
|
799
861
|
this._screenShareList.forEach((screenShare) => {
|
|
800
862
|
screenShare.leave();
|
|
801
863
|
});
|
|
802
|
-
return __superGet(
|
|
864
|
+
return __superGet(_BaseRoomSessionConnection.prototype, this, "hangup").call(this, id);
|
|
803
865
|
});
|
|
804
866
|
}
|
|
805
867
|
leave() {
|
|
806
868
|
return this.hangup();
|
|
807
869
|
}
|
|
870
|
+
/**
|
|
871
|
+
* This method will be called by `join()` right before the
|
|
872
|
+
* `connect()` happens and it's a way for us to control
|
|
873
|
+
* exactly when the workers are attached.
|
|
874
|
+
* @internal
|
|
875
|
+
*/
|
|
808
876
|
attachPreConnectWorkers() {
|
|
809
877
|
this.runWorker("memberListUpdated", {
|
|
810
878
|
worker: memberListUpdatedWorker
|
|
811
879
|
});
|
|
812
880
|
}
|
|
881
|
+
/** @internal */
|
|
813
882
|
getAudioEl() {
|
|
814
|
-
if (this._audioEl)
|
|
815
|
-
return this._audioEl;
|
|
883
|
+
if (this._audioEl) return this._audioEl;
|
|
816
884
|
this._audioEl = new Audio();
|
|
817
885
|
this._attachSpeakerTrackListener();
|
|
818
886
|
return this._audioEl;
|
|
@@ -820,6 +888,9 @@ var BaseRoomSessionConnection = class extends import_webrtc3.BaseConnection {
|
|
|
820
888
|
getMemberOverlay(memberId) {
|
|
821
889
|
return this.overlayMap.get(addOverlayPrefix(memberId));
|
|
822
890
|
}
|
|
891
|
+
/**
|
|
892
|
+
* Allow sharing the screen within the room.
|
|
893
|
+
*/
|
|
823
894
|
startScreenShare() {
|
|
824
895
|
return __async(this, arguments, function* (opts = {}) {
|
|
825
896
|
return new Promise((resolve, reject) => __async(this, null, function* () {
|
|
@@ -885,23 +956,26 @@ var BaseRoomSessionConnection = class extends import_webrtc3.BaseConnection {
|
|
|
885
956
|
}
|
|
886
957
|
updateSpeaker({ deviceId }) {
|
|
887
958
|
const prevId = this.audioEl.sinkId;
|
|
888
|
-
this.once(
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
959
|
+
this.once(
|
|
960
|
+
// @ts-expect-error
|
|
961
|
+
`${import_core15.LOCAL_EVENT_PREFIX}.speaker.updated`,
|
|
962
|
+
(newId) => __async(this, null, function* () {
|
|
963
|
+
const prevSpeaker = yield (0, import_webrtc3.getSpeakerById)(prevId);
|
|
964
|
+
const newSpeaker = yield (0, import_webrtc3.getSpeakerById)(newId);
|
|
965
|
+
const isSame = (newSpeaker == null ? void 0 : newSpeaker.deviceId) === (prevSpeaker == null ? void 0 : prevSpeaker.deviceId);
|
|
966
|
+
if (!(newSpeaker == null ? void 0 : newSpeaker.deviceId) || isSame) return;
|
|
967
|
+
this.emit("speaker.updated", {
|
|
968
|
+
previous: {
|
|
969
|
+
deviceId: prevSpeaker == null ? void 0 : prevSpeaker.deviceId,
|
|
970
|
+
label: prevSpeaker == null ? void 0 : prevSpeaker.label
|
|
971
|
+
},
|
|
972
|
+
current: {
|
|
973
|
+
deviceId: newSpeaker.deviceId,
|
|
974
|
+
label: newSpeaker.label
|
|
975
|
+
}
|
|
976
|
+
});
|
|
977
|
+
})
|
|
978
|
+
);
|
|
905
979
|
return this.triggerCustomSaga(audioSetSpeakerAction(deviceId));
|
|
906
980
|
}
|
|
907
981
|
};
|
|
@@ -928,7 +1002,7 @@ var RoomSessionDeviceAPI = (0, import_core16.extendComponent)(RoomSessionDeviceC
|
|
|
928
1002
|
});
|
|
929
1003
|
|
|
930
1004
|
// src/video/VideoRoomSession.ts
|
|
931
|
-
var VideoRoomSessionConnection = class extends BaseRoomSessionConnection {
|
|
1005
|
+
var VideoRoomSessionConnection = class _VideoRoomSessionConnection extends BaseRoomSessionConnection {
|
|
932
1006
|
constructor(options) {
|
|
933
1007
|
super(options);
|
|
934
1008
|
__publicField(this, "_deviceList", /* @__PURE__ */ new Set());
|
|
@@ -947,7 +1021,9 @@ var VideoRoomSessionConnection = class extends BaseRoomSessionConnection {
|
|
|
947
1021
|
}
|
|
948
1022
|
get currentPosition() {
|
|
949
1023
|
var _a, _b;
|
|
950
|
-
return (_b = (_a = this._currentLayoutEvent) == null ? void 0 : _a.layout.layers.find(
|
|
1024
|
+
return (_b = (_a = this._currentLayoutEvent) == null ? void 0 : _a.layout.layers.find(
|
|
1025
|
+
(layer) => layer.member_id === this.memberId
|
|
1026
|
+
)) == null ? void 0 : _b.position;
|
|
951
1027
|
}
|
|
952
1028
|
get deviceList() {
|
|
953
1029
|
return Array.from(this._deviceList);
|
|
@@ -971,38 +1047,55 @@ var VideoRoomSessionConnection = class extends BaseRoomSessionConnection {
|
|
|
971
1047
|
worker: videoWorker
|
|
972
1048
|
});
|
|
973
1049
|
}
|
|
1050
|
+
/** @internal */
|
|
974
1051
|
getSubscriptions() {
|
|
975
1052
|
const eventNamesWithPrefix = this.eventNames().map((event) => {
|
|
976
1053
|
return `video.${String(event)}`;
|
|
977
1054
|
});
|
|
978
|
-
return (0, import_core17.validateEventsToSubscribe)(
|
|
1055
|
+
return (0, import_core17.validateEventsToSubscribe)(
|
|
1056
|
+
eventNamesWithPrefix
|
|
1057
|
+
);
|
|
979
1058
|
}
|
|
1059
|
+
/** @internal */
|
|
980
1060
|
_finalize() {
|
|
981
1061
|
this._deviceList.clear();
|
|
982
1062
|
super._finalize();
|
|
983
1063
|
}
|
|
1064
|
+
/** @internal */
|
|
984
1065
|
hangup(id) {
|
|
985
1066
|
return __async(this, null, function* () {
|
|
986
1067
|
this._deviceList.forEach((device) => {
|
|
987
1068
|
device.leave();
|
|
988
1069
|
});
|
|
989
|
-
return __superGet(
|
|
1070
|
+
return __superGet(_VideoRoomSessionConnection.prototype, this, "hangup").call(this, id);
|
|
990
1071
|
});
|
|
991
1072
|
}
|
|
992
1073
|
join() {
|
|
993
1074
|
return super.invite();
|
|
994
1075
|
}
|
|
1076
|
+
/**
|
|
1077
|
+
* @deprecated Use {@link getLayouts} instead. `getLayoutList` will
|
|
1078
|
+
* be removed in v3.0.0
|
|
1079
|
+
*/
|
|
995
1080
|
getLayoutList() {
|
|
996
1081
|
return this.getLayouts();
|
|
997
1082
|
}
|
|
1083
|
+
/**
|
|
1084
|
+
* @deprecated Use {@link getMembers} instead. `getMemberList` will
|
|
1085
|
+
* be removed in v3.0.0
|
|
1086
|
+
*/
|
|
998
1087
|
getMemberList() {
|
|
999
1088
|
return this.getMembers();
|
|
1000
1089
|
}
|
|
1090
|
+
/** @deprecated Use {@link startScreenShare} instead. */
|
|
1001
1091
|
createScreenShareObject() {
|
|
1002
1092
|
return __async(this, arguments, function* (opts = {}) {
|
|
1003
1093
|
return this.startScreenShare(opts);
|
|
1004
1094
|
});
|
|
1005
1095
|
}
|
|
1096
|
+
/**
|
|
1097
|
+
* Allow to add a camera to the room.
|
|
1098
|
+
*/
|
|
1006
1099
|
addCamera(opts = {}) {
|
|
1007
1100
|
const _a = opts, { autoJoin = true } = _a, video = __objRest(_a, ["autoJoin"]);
|
|
1008
1101
|
return this.addDevice({
|
|
@@ -1010,6 +1103,9 @@ var VideoRoomSessionConnection = class extends BaseRoomSessionConnection {
|
|
|
1010
1103
|
video
|
|
1011
1104
|
});
|
|
1012
1105
|
}
|
|
1106
|
+
/**
|
|
1107
|
+
* Allow to add a microphone to the room.
|
|
1108
|
+
*/
|
|
1013
1109
|
addMicrophone(opts = {}) {
|
|
1014
1110
|
const _a = opts, { autoJoin = true } = _a, audio = __objRest(_a, ["autoJoin"]);
|
|
1015
1111
|
return this.addDevice({
|
|
@@ -1017,13 +1113,18 @@ var VideoRoomSessionConnection = class extends BaseRoomSessionConnection {
|
|
|
1017
1113
|
audio
|
|
1018
1114
|
});
|
|
1019
1115
|
}
|
|
1116
|
+
/**
|
|
1117
|
+
* Allow to add additional devices to the room like cameras or microphones.
|
|
1118
|
+
*/
|
|
1020
1119
|
addDevice() {
|
|
1021
1120
|
return __async(this, arguments, function* (opts = {}) {
|
|
1022
1121
|
return new Promise((resolve, reject) => __async(this, null, function* () {
|
|
1023
1122
|
var _a;
|
|
1024
1123
|
const { autoJoin = true, audio = false, video = false } = opts;
|
|
1025
1124
|
if (!audio && !video) {
|
|
1026
|
-
throw new TypeError(
|
|
1125
|
+
throw new TypeError(
|
|
1126
|
+
"At least one of `audio` or `video` must be requested."
|
|
1127
|
+
);
|
|
1027
1128
|
}
|
|
1028
1129
|
const options = __spreadProps(__spreadValues({}, this.options), {
|
|
1029
1130
|
localStream: void 0,
|
|
@@ -1166,19 +1267,35 @@ var PREVIOUS_CALLID_STORAGE_KEY = "ci-SAT";
|
|
|
1166
1267
|
var import_core19 = require("@signalwire/core");
|
|
1167
1268
|
var wsClientWorker = function* (options) {
|
|
1168
1269
|
(0, import_core19.getLogger)().debug("wsClientWorker started");
|
|
1169
|
-
const { channels, initialState } = options;
|
|
1270
|
+
const { channels, initialState, instance: client } = options;
|
|
1170
1271
|
const { swEventChannel } = channels;
|
|
1171
1272
|
const { handleIncomingInvite } = initialState;
|
|
1273
|
+
function* fireHoseWorker(action) {
|
|
1274
|
+
client.emit(action.type, action.payload);
|
|
1275
|
+
}
|
|
1276
|
+
function* vertoInviteWorker(action) {
|
|
1277
|
+
handleIncomingInvite(action.payload.params);
|
|
1278
|
+
}
|
|
1279
|
+
const isVertoInvite = (action) => {
|
|
1280
|
+
if (action.type === "webrtc.message") {
|
|
1281
|
+
return action.payload.method === "verto.invite";
|
|
1282
|
+
}
|
|
1283
|
+
return false;
|
|
1284
|
+
};
|
|
1172
1285
|
try {
|
|
1173
1286
|
while (true) {
|
|
1174
|
-
const action = yield import_core19.sagaEffects.take(
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1287
|
+
const action = yield import_core19.sagaEffects.take(
|
|
1288
|
+
swEventChannel,
|
|
1289
|
+
() => true
|
|
1290
|
+
);
|
|
1291
|
+
yield import_core19.sagaEffects.fork(fireHoseWorker, action);
|
|
1292
|
+
if (isVertoInvite(action)) {
|
|
1293
|
+
(0, import_core19.getLogger)().debug("Receiving a call over WebSocket", action);
|
|
1294
|
+
yield import_core19.sagaEffects.fork(
|
|
1295
|
+
vertoInviteWorker,
|
|
1296
|
+
action
|
|
1297
|
+
);
|
|
1298
|
+
}
|
|
1182
1299
|
}
|
|
1183
1300
|
} finally {
|
|
1184
1301
|
(0, import_core19.getLogger)().trace("wsClientWorker ended");
|
|
@@ -1198,7 +1315,10 @@ var conversationWorker = function* (options) {
|
|
|
1198
1315
|
return action.type.startsWith("conversation.");
|
|
1199
1316
|
};
|
|
1200
1317
|
while (true) {
|
|
1201
|
-
const action = yield import_core20.sagaEffects.take(
|
|
1318
|
+
const action = yield import_core20.sagaEffects.take(
|
|
1319
|
+
swEventChannel,
|
|
1320
|
+
isConversationEvent
|
|
1321
|
+
);
|
|
1202
1322
|
conversation.handleEvent(action.payload);
|
|
1203
1323
|
}
|
|
1204
1324
|
(0, import_core20.getLogger)().trace("conversationWorker ended");
|
|
@@ -1281,6 +1401,7 @@ var FabricRoomSessionMemberAPI = class extends import_core21.BaseComponent {
|
|
|
1281
1401
|
get subscriberData() {
|
|
1282
1402
|
return this._payload.member.subscriber_data;
|
|
1283
1403
|
}
|
|
1404
|
+
/** @internal */
|
|
1284
1405
|
setPayload(payload) {
|
|
1285
1406
|
const newPayload = __spreadProps(__spreadValues(__spreadValues({}, this._payload), payload), {
|
|
1286
1407
|
member: __spreadValues(__spreadValues({}, this._payload.member), payload.member)
|
|
@@ -1392,7 +1513,9 @@ var mapInternalFabricMemberToInternalVideoMemberEntity = (params) => {
|
|
|
1392
1513
|
};
|
|
1393
1514
|
var mapInternalFabricMemberToInternalVideoMemberUpdatedEntity = (params) => {
|
|
1394
1515
|
return __spreadProps(__spreadValues({}, mapInternalFabricMemberToInternalVideoMemberEntity(params)), {
|
|
1395
|
-
updated: params.updated.map(
|
|
1516
|
+
updated: params.updated.map(
|
|
1517
|
+
(key) => key === "member_id" ? "id" : key
|
|
1518
|
+
)
|
|
1396
1519
|
});
|
|
1397
1520
|
};
|
|
1398
1521
|
var mapInternalFabricRoomToInternalVideoRoomEntity = (params) => {
|
|
@@ -1426,7 +1549,9 @@ var mapInternalFabricRoomToInternalVideoRoomSessionEntity = (params) => {
|
|
|
1426
1549
|
layout_name: params.layout_name,
|
|
1427
1550
|
locked: params.locked,
|
|
1428
1551
|
meta: params.meta,
|
|
1429
|
-
members: params.members.map(
|
|
1552
|
+
members: params.members.map(
|
|
1553
|
+
mapInternalFabricMemberToInternalVideoMemberEntity
|
|
1554
|
+
),
|
|
1430
1555
|
streaming: params.streaming,
|
|
1431
1556
|
streams: params.streams,
|
|
1432
1557
|
prioritize_handraise: params.prioritize_handraise,
|
|
@@ -1438,10 +1563,16 @@ var mapCallJoinedToRoomSubscribedEventParams = (params) => {
|
|
|
1438
1563
|
call_id: params.call_id,
|
|
1439
1564
|
member_id: params.member_id,
|
|
1440
1565
|
room: __spreadProps(__spreadValues({}, mapInternalFabricRoomToInternalVideoRoomEntity(params.room_session)), {
|
|
1441
|
-
members: params.room_session.members.map(
|
|
1566
|
+
members: params.room_session.members.map(
|
|
1567
|
+
mapInternalFabricMemberToInternalVideoMemberEntity
|
|
1568
|
+
)
|
|
1442
1569
|
}),
|
|
1443
|
-
room_session: __spreadProps(__spreadValues({}, mapInternalFabricRoomToInternalVideoRoomSessionEntity(
|
|
1444
|
-
|
|
1570
|
+
room_session: __spreadProps(__spreadValues({}, mapInternalFabricRoomToInternalVideoRoomSessionEntity(
|
|
1571
|
+
params.room_session
|
|
1572
|
+
)), {
|
|
1573
|
+
members: params.room_session.members.map(
|
|
1574
|
+
mapInternalFabricMemberToInternalVideoMemberEntity
|
|
1575
|
+
)
|
|
1445
1576
|
})
|
|
1446
1577
|
};
|
|
1447
1578
|
};
|
|
@@ -1462,13 +1593,17 @@ var mapFabricMemberEventToVideoMemberUpdatedEventParams = (params) => {
|
|
|
1462
1593
|
return {
|
|
1463
1594
|
room_session_id: params.room_session_id,
|
|
1464
1595
|
room_id: params.room_id,
|
|
1465
|
-
member: mapInternalFabricMemberToInternalVideoMemberUpdatedEntity(
|
|
1596
|
+
member: mapInternalFabricMemberToInternalVideoMemberUpdatedEntity(
|
|
1597
|
+
params.member
|
|
1598
|
+
)
|
|
1466
1599
|
};
|
|
1467
1600
|
};
|
|
1468
1601
|
var mapFabricMemberActionToVideoMemberUpdatedAction = (action) => {
|
|
1469
1602
|
return {
|
|
1470
1603
|
type: `video.${action.type}`,
|
|
1471
|
-
payload: mapFabricMemberEventToVideoMemberUpdatedEventParams(
|
|
1604
|
+
payload: mapFabricMemberEventToVideoMemberUpdatedEventParams(
|
|
1605
|
+
action.payload
|
|
1606
|
+
)
|
|
1472
1607
|
};
|
|
1473
1608
|
};
|
|
1474
1609
|
var mapFabricLayoutActionToVideoLayoutAction = (action) => {
|
|
@@ -1478,6 +1613,146 @@ var mapFabricLayoutActionToVideoLayoutAction = (action) => {
|
|
|
1478
1613
|
};
|
|
1479
1614
|
};
|
|
1480
1615
|
|
|
1616
|
+
// src/fabric/utils/capabilitiesHelpers.ts
|
|
1617
|
+
var CapabilityOnOffState = class {
|
|
1618
|
+
constructor(_flags) {
|
|
1619
|
+
this._flags = _flags;
|
|
1620
|
+
}
|
|
1621
|
+
get on() {
|
|
1622
|
+
return this._flags.some((flag) => !flag.endsWith(".off"));
|
|
1623
|
+
}
|
|
1624
|
+
get off() {
|
|
1625
|
+
return this._flags.some((flag) => !flag.endsWith(".on"));
|
|
1626
|
+
}
|
|
1627
|
+
};
|
|
1628
|
+
var MemberCapability = class {
|
|
1629
|
+
constructor(_flags, _memberType) {
|
|
1630
|
+
this._flags = _flags;
|
|
1631
|
+
this._memberType = _memberType;
|
|
1632
|
+
__publicField(this, "_muteAudio");
|
|
1633
|
+
__publicField(this, "_muteVideo");
|
|
1634
|
+
__publicField(this, "_deaf");
|
|
1635
|
+
}
|
|
1636
|
+
get muteAudio() {
|
|
1637
|
+
var _a;
|
|
1638
|
+
this._muteAudio = (_a = this._muteAudio) != null ? _a : new CapabilityOnOffState(
|
|
1639
|
+
this._flags.filter(
|
|
1640
|
+
(flag) => flag === this._memberType || flag === `${this._memberType}.mute` || flag.startsWith(`${this._memberType}.mute.audio`)
|
|
1641
|
+
)
|
|
1642
|
+
);
|
|
1643
|
+
return this._muteAudio;
|
|
1644
|
+
}
|
|
1645
|
+
get muteVideo() {
|
|
1646
|
+
var _a;
|
|
1647
|
+
this._muteVideo = (_a = this._muteVideo) != null ? _a : new CapabilityOnOffState(
|
|
1648
|
+
this._flags.filter(
|
|
1649
|
+
(flag) => flag === this._memberType || flag === `${this._memberType}.mute` || flag.startsWith(`${this._memberType}.mute.video`)
|
|
1650
|
+
)
|
|
1651
|
+
);
|
|
1652
|
+
return this._muteVideo;
|
|
1653
|
+
}
|
|
1654
|
+
get microphoneVolume() {
|
|
1655
|
+
return this._flags.some(
|
|
1656
|
+
(flag) => flag === this._memberType || flag === `${this._memberType}.microphone` || flag.startsWith(`${this._memberType}.microphone.volume`)
|
|
1657
|
+
);
|
|
1658
|
+
}
|
|
1659
|
+
get microphoneSensitivity() {
|
|
1660
|
+
return this._flags.some(
|
|
1661
|
+
(flag) => flag === this._memberType || flag === `${this._memberType}.microphone` || flag.startsWith(`${this._memberType}.microphone.sensitivity`)
|
|
1662
|
+
);
|
|
1663
|
+
}
|
|
1664
|
+
get speakerVolume() {
|
|
1665
|
+
return this._flags.some(
|
|
1666
|
+
(flag) => flag === this._memberType || flag === `${this._memberType}.speaker` || flag.startsWith(`${this._memberType}.speaker.volume`)
|
|
1667
|
+
);
|
|
1668
|
+
}
|
|
1669
|
+
get deaf() {
|
|
1670
|
+
var _a;
|
|
1671
|
+
this._deaf = (_a = this._deaf) != null ? _a : new CapabilityOnOffState(
|
|
1672
|
+
this._flags.filter(
|
|
1673
|
+
(flag) => flag === this._memberType || flag.startsWith(`${this._memberType}.deaf`)
|
|
1674
|
+
)
|
|
1675
|
+
);
|
|
1676
|
+
return this._deaf;
|
|
1677
|
+
}
|
|
1678
|
+
get raisehand() {
|
|
1679
|
+
return {
|
|
1680
|
+
on: true,
|
|
1681
|
+
off: true
|
|
1682
|
+
};
|
|
1683
|
+
}
|
|
1684
|
+
get position() {
|
|
1685
|
+
return this._flags.some(
|
|
1686
|
+
(flag) => flag === this._memberType || flag.startsWith(`${this._memberType}.position`)
|
|
1687
|
+
);
|
|
1688
|
+
}
|
|
1689
|
+
get meta() {
|
|
1690
|
+
return this._flags.some(
|
|
1691
|
+
(flag) => flag === this._memberType || flag.startsWith(`${this._memberType}.meta`)
|
|
1692
|
+
);
|
|
1693
|
+
}
|
|
1694
|
+
get remove() {
|
|
1695
|
+
return this._flags.some(
|
|
1696
|
+
(flag) => flag === this._memberType || flag.startsWith(`${this._memberType}.remove`)
|
|
1697
|
+
);
|
|
1698
|
+
}
|
|
1699
|
+
};
|
|
1700
|
+
var CallCapabilities = class {
|
|
1701
|
+
constructor(_flags) {
|
|
1702
|
+
this._flags = _flags;
|
|
1703
|
+
__publicField(this, "_self");
|
|
1704
|
+
__publicField(this, "_member");
|
|
1705
|
+
__publicField(this, "_vmutedHide");
|
|
1706
|
+
__publicField(this, "_lock");
|
|
1707
|
+
}
|
|
1708
|
+
_buildMemberCapability(memberType) {
|
|
1709
|
+
return new MemberCapability(
|
|
1710
|
+
this._flags.filter((flag) => flag.startsWith(memberType)),
|
|
1711
|
+
memberType
|
|
1712
|
+
);
|
|
1713
|
+
}
|
|
1714
|
+
get self() {
|
|
1715
|
+
var _a;
|
|
1716
|
+
this._self = (_a = this._self) != null ? _a : this._buildMemberCapability("self");
|
|
1717
|
+
return this._self;
|
|
1718
|
+
}
|
|
1719
|
+
get member() {
|
|
1720
|
+
var _a;
|
|
1721
|
+
this._member = (_a = this._member) != null ? _a : this._buildMemberCapability("member");
|
|
1722
|
+
return this._member;
|
|
1723
|
+
}
|
|
1724
|
+
get end() {
|
|
1725
|
+
return this._flags.some((capability) => capability === "end");
|
|
1726
|
+
}
|
|
1727
|
+
get setLayout() {
|
|
1728
|
+
return this._flags.some((capability) => capability.startsWith("layout"));
|
|
1729
|
+
}
|
|
1730
|
+
get sendDigit() {
|
|
1731
|
+
return this._flags.some((capability) => capability.startsWith("digit"));
|
|
1732
|
+
}
|
|
1733
|
+
get vmutedHide() {
|
|
1734
|
+
var _a;
|
|
1735
|
+
this._vmutedHide = (_a = this._vmutedHide) != null ? _a : new CapabilityOnOffState(
|
|
1736
|
+
this._flags.filter((flag) => flag.startsWith("vmuted"))
|
|
1737
|
+
);
|
|
1738
|
+
return this._vmutedHide;
|
|
1739
|
+
}
|
|
1740
|
+
get lock() {
|
|
1741
|
+
var _a;
|
|
1742
|
+
this._lock = (_a = this._lock) != null ? _a : new CapabilityOnOffState(
|
|
1743
|
+
this._flags.filter((flag) => flag.startsWith("lock"))
|
|
1744
|
+
);
|
|
1745
|
+
return this._lock;
|
|
1746
|
+
}
|
|
1747
|
+
get device() {
|
|
1748
|
+
return this._flags.some((capability) => capability === "device");
|
|
1749
|
+
}
|
|
1750
|
+
get screenshare() {
|
|
1751
|
+
return this._flags.some((capability) => capability === "screenshare");
|
|
1752
|
+
}
|
|
1753
|
+
};
|
|
1754
|
+
var mapCapabilityPayload = (capabilities) => new CallCapabilities(capabilities);
|
|
1755
|
+
|
|
1481
1756
|
// src/fabric/workers/callJoinWorker.ts
|
|
1482
1757
|
var callJoinWorker = function* (options) {
|
|
1483
1758
|
var _a;
|
|
@@ -1486,6 +1761,11 @@ var callJoinWorker = function* (options) {
|
|
|
1486
1761
|
const { payload } = action;
|
|
1487
1762
|
const { get, set } = instanceMap;
|
|
1488
1763
|
yield import_core24.sagaEffects.fork(import_core24.MemberPosition.memberPositionWorker, __spreadProps(__spreadValues({}, options), {
|
|
1764
|
+
/**
|
|
1765
|
+
* The {@link memberPositionWorker} worker understands only the Video SDK events.
|
|
1766
|
+
* So, we need to map CF SDK event to Video SDK event.
|
|
1767
|
+
* Similar to what we do in the {@link callSegmentWorker}, for member events.
|
|
1768
|
+
*/
|
|
1489
1769
|
initialState: mapCallJoinedToRoomSubscribedEventParams(payload),
|
|
1490
1770
|
dispatcher: function* (subType, subPayload) {
|
|
1491
1771
|
const fabricType = (0, import_core24.stripNamespacePrefix)(subType, "video");
|
|
@@ -1520,10 +1800,11 @@ var callJoinWorker = function* (options) {
|
|
|
1520
1800
|
set(member.member_id, memberInstance);
|
|
1521
1801
|
});
|
|
1522
1802
|
cfRoomSession.member = get(payload.member_id);
|
|
1523
|
-
cfRoomSession.capabilities =
|
|
1524
|
-
|
|
1803
|
+
cfRoomSession.capabilities = mapCapabilityPayload(payload.capabilities);
|
|
1804
|
+
const fabricEvent = __spreadProps(__spreadValues({}, payload), {
|
|
1525
1805
|
capabilities: cfRoomSession.capabilities
|
|
1526
|
-
})
|
|
1806
|
+
});
|
|
1807
|
+
cfRoomSession.emit("call.joined", fabricEvent);
|
|
1527
1808
|
(0, import_core24.getLogger)().trace("callJoinWorker ended");
|
|
1528
1809
|
};
|
|
1529
1810
|
|
|
@@ -1536,7 +1817,9 @@ var callSegmentWorker = function* (options) {
|
|
|
1536
1817
|
} = options;
|
|
1537
1818
|
const segmentCallId = action.payload.call_id;
|
|
1538
1819
|
const segmentRooSessionId = action.payload.room_session_id;
|
|
1539
|
-
(0, import_core25.getLogger)().debug(
|
|
1820
|
+
(0, import_core25.getLogger)().debug(
|
|
1821
|
+
`callSegmentWorker started for: callId ${segmentCallId}, roomSessionId ${segmentRooSessionId}`
|
|
1822
|
+
);
|
|
1540
1823
|
yield import_core25.sagaEffects.fork(callJoinWorker, __spreadProps(__spreadValues({}, options), {
|
|
1541
1824
|
action
|
|
1542
1825
|
}));
|
|
@@ -1563,6 +1846,20 @@ var callSegmentWorker = function* (options) {
|
|
|
1563
1846
|
case "call.room":
|
|
1564
1847
|
cfRoomSession.emit(type, payload);
|
|
1565
1848
|
break;
|
|
1849
|
+
/**
|
|
1850
|
+
* The Core module includes a generic worker, {@link memberPositionWorker},
|
|
1851
|
+
* which listens for member & layout events to add a "current_position" parameter
|
|
1852
|
+
* and handle member "updated" parameter.
|
|
1853
|
+
* This worker in CF SDK is initialized by the {@link callJoinWorker} worker.
|
|
1854
|
+
*
|
|
1855
|
+
* To ensure compatibility, we map these events to Video SDK events and
|
|
1856
|
+
* re-publish them on the channel so that they can be processed by the
|
|
1857
|
+
* generic worker. Note that the generic worker only dispatches "member.updated"
|
|
1858
|
+
* and "member.updated.*" events.
|
|
1859
|
+
*
|
|
1860
|
+
* Additionally, the "member.joined" event is monitored by another worker,
|
|
1861
|
+
* {@link childMemberJoinedWorker}, specifically for the screen share API.
|
|
1862
|
+
*/
|
|
1566
1863
|
case "member.joined":
|
|
1567
1864
|
case "member.left": {
|
|
1568
1865
|
yield import_core25.sagaEffects.fork(fabricMemberWorker, __spreadProps(__spreadValues({}, options), {
|
|
@@ -1607,11 +1904,13 @@ var callSegmentWorker = function* (options) {
|
|
|
1607
1904
|
return false;
|
|
1608
1905
|
};
|
|
1609
1906
|
while (true) {
|
|
1610
|
-
const action2 = yield import_core25.sagaEffects.take(
|
|
1907
|
+
const action2 = yield import_core25.sagaEffects.take(
|
|
1908
|
+
swEventChannel,
|
|
1909
|
+
isSegmentEvent
|
|
1910
|
+
);
|
|
1611
1911
|
const task = yield import_core25.sagaEffects.fork(worker, action2);
|
|
1612
1912
|
const shouldStop = yield import_core25.sagaEffects.join(task);
|
|
1613
|
-
if (shouldStop)
|
|
1614
|
-
return;
|
|
1913
|
+
if (shouldStop) return;
|
|
1615
1914
|
}
|
|
1616
1915
|
};
|
|
1617
1916
|
|
|
@@ -1630,7 +1929,9 @@ var fabricWorker = function* (options) {
|
|
|
1630
1929
|
const memberInstance = createFabricRoomSessionMemberObject({
|
|
1631
1930
|
store: cfRoomSession.store,
|
|
1632
1931
|
payload: {
|
|
1633
|
-
member: action.payload.room_session.members.find(
|
|
1932
|
+
member: action.payload.room_session.members.find(
|
|
1933
|
+
(m) => m.member_id === action.payload.member_id
|
|
1934
|
+
),
|
|
1634
1935
|
room_id: action.payload.room_id,
|
|
1635
1936
|
room_session_id: action.payload.room_session_id
|
|
1636
1937
|
}
|
|
@@ -1668,20 +1969,26 @@ var fabricWorker = function* (options) {
|
|
|
1668
1969
|
return true;
|
|
1669
1970
|
};
|
|
1670
1971
|
while (true) {
|
|
1671
|
-
const action = yield import_core26.sagaEffects.take(
|
|
1972
|
+
const action = yield import_core26.sagaEffects.take(
|
|
1973
|
+
swEventChannel,
|
|
1974
|
+
isFirstCallJoinedorCallStateEvent
|
|
1975
|
+
);
|
|
1672
1976
|
yield import_core26.sagaEffects.fork(worker, action);
|
|
1673
1977
|
}
|
|
1674
1978
|
(0, import_core26.getLogger)().trace("fabricWorker ended");
|
|
1675
1979
|
};
|
|
1676
1980
|
|
|
1677
1981
|
// src/fabric/FabricRoomSession.ts
|
|
1678
|
-
var FabricRoomSessionConnection = class extends BaseRoomSessionConnection {
|
|
1982
|
+
var FabricRoomSessionConnection = class _FabricRoomSessionConnection extends BaseRoomSessionConnection {
|
|
1679
1983
|
constructor(options) {
|
|
1680
1984
|
super(options);
|
|
1985
|
+
// this is "self" parameter required by the RPC, and is always "the member" on the 1st call segment
|
|
1681
1986
|
__publicField(this, "_self");
|
|
1987
|
+
// this is "the member" on the last/active call segment
|
|
1682
1988
|
__publicField(this, "_member");
|
|
1683
1989
|
__publicField(this, "_currentLayoutEvent");
|
|
1684
|
-
|
|
1990
|
+
//describes what are methods are allow for the user in a call segment
|
|
1991
|
+
__publicField(this, "_capabilities");
|
|
1685
1992
|
this.initWorker();
|
|
1686
1993
|
}
|
|
1687
1994
|
get memberId() {
|
|
@@ -1700,7 +2007,9 @@ var FabricRoomSessionConnection = class extends BaseRoomSessionConnection {
|
|
|
1700
2007
|
}
|
|
1701
2008
|
get currentPosition() {
|
|
1702
2009
|
var _a, _b;
|
|
1703
|
-
return (_b = (_a = this._currentLayoutEvent) == null ? void 0 : _a.layout.layers.find(
|
|
2010
|
+
return (_b = (_a = this._currentLayoutEvent) == null ? void 0 : _a.layout.layers.find(
|
|
2011
|
+
(layer) => layer.member_id === this.memberId
|
|
2012
|
+
)) == null ? void 0 : _b.position;
|
|
1704
2013
|
}
|
|
1705
2014
|
get capabilities() {
|
|
1706
2015
|
return this._capabilities;
|
|
@@ -1736,39 +2045,46 @@ var FabricRoomSessionConnection = class extends BaseRoomSessionConnection {
|
|
|
1736
2045
|
if (this.options.attach) {
|
|
1737
2046
|
this.options.prevCallId = (_b = (_a = getStorage()) == null ? void 0 : _a.getItem(PREVIOUS_CALLID_STORAGE_KEY)) != null ? _b : void 0;
|
|
1738
2047
|
}
|
|
1739
|
-
this.logger.debug(
|
|
1740
|
-
|
|
2048
|
+
this.logger.debug(
|
|
2049
|
+
`Tying to reattach to previuos call? ${!!this.options.prevCallId} - prevCallId: ${this.options.prevCallId}`
|
|
2050
|
+
);
|
|
2051
|
+
return __superGet(_FabricRoomSessionConnection.prototype, this, "invite").call(this);
|
|
1741
2052
|
});
|
|
1742
2053
|
}
|
|
1743
2054
|
executeAction(params, options = {}) {
|
|
1744
2055
|
var _a, _b, _c;
|
|
1745
2056
|
const { method, channel, memberId, extraParams = {} } = params;
|
|
1746
2057
|
const targetMember = memberId ? this.instanceMap.get(memberId) : this.member;
|
|
1747
|
-
if (!targetMember)
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
2058
|
+
if (!targetMember) throw new Error("No target param found to execute");
|
|
2059
|
+
return this.execute(
|
|
2060
|
+
{
|
|
2061
|
+
method,
|
|
2062
|
+
params: __spreadValues(__spreadProps(__spreadValues({}, channel && { channels: [channel] }), {
|
|
2063
|
+
self: {
|
|
2064
|
+
member_id: (_a = this.selfMember) == null ? void 0 : _a.id,
|
|
2065
|
+
call_id: (_b = this.selfMember) == null ? void 0 : _b.callId,
|
|
2066
|
+
node_id: (_c = this.selfMember) == null ? void 0 : _c.nodeId
|
|
2067
|
+
},
|
|
2068
|
+
target: {
|
|
2069
|
+
member_id: targetMember.id,
|
|
2070
|
+
call_id: targetMember.callId,
|
|
2071
|
+
node_id: targetMember.nodeId
|
|
2072
|
+
}
|
|
2073
|
+
}), extraParams)
|
|
2074
|
+
},
|
|
2075
|
+
options
|
|
2076
|
+
);
|
|
1764
2077
|
}
|
|
2078
|
+
/** @internal */
|
|
1765
2079
|
resume() {
|
|
1766
2080
|
return __async(this, null, function* () {
|
|
1767
2081
|
var _a;
|
|
1768
2082
|
this.logger.warn(`[resume] Call ${this.id}`);
|
|
1769
2083
|
if ((_a = this.peer) == null ? void 0 : _a.instance) {
|
|
1770
2084
|
const { connectionState } = this.peer.instance;
|
|
1771
|
-
this.logger.debug(
|
|
2085
|
+
this.logger.debug(
|
|
2086
|
+
`[resume] connectionState for ${this.id} is '${connectionState}'`
|
|
2087
|
+
);
|
|
1772
2088
|
if (["closed", "failed", "disconnected"].includes(connectionState)) {
|
|
1773
2089
|
this.resuming = true;
|
|
1774
2090
|
this.peer.restartIce();
|
|
@@ -1799,8 +2115,8 @@ var FabricRoomSessionConnection = class extends BaseRoomSessionConnection {
|
|
|
1799
2115
|
}
|
|
1800
2116
|
audioMute(params) {
|
|
1801
2117
|
return __async(this, null, function* () {
|
|
1802
|
-
var _a, _b
|
|
1803
|
-
if (!params || params.memberId === this.member.id ? !((
|
|
2118
|
+
var _a, _b;
|
|
2119
|
+
if (!params || params.memberId === this.member.id ? !((_a = this.capabilities) == null ? void 0 : _a.self.muteAudio.off) : !((_b = this.capabilities) == null ? void 0 : _b.member.muteAudio.off)) {
|
|
1804
2120
|
throw Error("Missing audio mute capability");
|
|
1805
2121
|
}
|
|
1806
2122
|
return this.executeAction({
|
|
@@ -1812,8 +2128,8 @@ var FabricRoomSessionConnection = class extends BaseRoomSessionConnection {
|
|
|
1812
2128
|
}
|
|
1813
2129
|
audioUnmute(params) {
|
|
1814
2130
|
return __async(this, null, function* () {
|
|
1815
|
-
var _a, _b
|
|
1816
|
-
if (!params || params.memberId === this.member.id ? !((
|
|
2131
|
+
var _a, _b;
|
|
2132
|
+
if (!params || params.memberId === this.member.id ? !((_a = this.capabilities) == null ? void 0 : _a.self.muteAudio.on) : !((_b = this.capabilities) == null ? void 0 : _b.member.muteAudio.on)) {
|
|
1817
2133
|
throw Error("Missing audio unmute capability");
|
|
1818
2134
|
}
|
|
1819
2135
|
return this.executeAction({
|
|
@@ -1825,8 +2141,8 @@ var FabricRoomSessionConnection = class extends BaseRoomSessionConnection {
|
|
|
1825
2141
|
}
|
|
1826
2142
|
videoMute(params) {
|
|
1827
2143
|
return __async(this, null, function* () {
|
|
1828
|
-
var _a, _b
|
|
1829
|
-
if (!params || params.memberId === this.member.id ? !((
|
|
2144
|
+
var _a, _b;
|
|
2145
|
+
if (!params || params.memberId === this.member.id ? !((_a = this.capabilities) == null ? void 0 : _a.self.muteVideo.off) : !((_b = this.capabilities) == null ? void 0 : _b.member.muteVideo.on)) {
|
|
1830
2146
|
throw Error("Missing video mute capability");
|
|
1831
2147
|
}
|
|
1832
2148
|
return this.executeAction({
|
|
@@ -1838,8 +2154,8 @@ var FabricRoomSessionConnection = class extends BaseRoomSessionConnection {
|
|
|
1838
2154
|
}
|
|
1839
2155
|
videoUnmute(params) {
|
|
1840
2156
|
return __async(this, null, function* () {
|
|
1841
|
-
var _a, _b
|
|
1842
|
-
if (!params || params.memberId === this.member.id ? !((
|
|
2157
|
+
var _a, _b;
|
|
2158
|
+
if (!params || params.memberId === this.member.id ? !((_a = this.capabilities) == null ? void 0 : _a.self.muteVideo.on) : !((_b = this.capabilities) == null ? void 0 : _b.member.muteVideo.on)) {
|
|
1843
2159
|
throw Error("Missing video unmute capability");
|
|
1844
2160
|
}
|
|
1845
2161
|
return this.executeAction({
|
|
@@ -1851,8 +2167,8 @@ var FabricRoomSessionConnection = class extends BaseRoomSessionConnection {
|
|
|
1851
2167
|
}
|
|
1852
2168
|
deaf(params) {
|
|
1853
2169
|
return __async(this, null, function* () {
|
|
1854
|
-
var _a, _b
|
|
1855
|
-
if (!params || params.memberId === this.member.id ? !((
|
|
2170
|
+
var _a, _b;
|
|
2171
|
+
if (!params || params.memberId === this.member.id ? !((_a = this.capabilities) == null ? void 0 : _a.self.deaf.on) : !((_b = this.capabilities) == null ? void 0 : _b.member.deaf.on)) {
|
|
1856
2172
|
throw Error("Missing deaf capability");
|
|
1857
2173
|
}
|
|
1858
2174
|
return this.executeAction({
|
|
@@ -1863,8 +2179,8 @@ var FabricRoomSessionConnection = class extends BaseRoomSessionConnection {
|
|
|
1863
2179
|
}
|
|
1864
2180
|
undeaf(params) {
|
|
1865
2181
|
return __async(this, null, function* () {
|
|
1866
|
-
var _a, _b
|
|
1867
|
-
if (!params || params.memberId === this.member.id ? !((
|
|
2182
|
+
var _a, _b;
|
|
2183
|
+
if (!params || params.memberId === this.member.id ? !((_a = this.capabilities) == null ? void 0 : _a.self.deaf.off) : !((_b = this.capabilities) == null ? void 0 : _b.member.deaf.off)) {
|
|
1868
2184
|
throw Error("Missing undeaf capability");
|
|
1869
2185
|
}
|
|
1870
2186
|
return this.executeAction({
|
|
@@ -1875,30 +2191,36 @@ var FabricRoomSessionConnection = class extends BaseRoomSessionConnection {
|
|
|
1875
2191
|
}
|
|
1876
2192
|
getLayouts() {
|
|
1877
2193
|
return __async(this, null, function* () {
|
|
1878
|
-
return this.executeAction(
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
2194
|
+
return this.executeAction(
|
|
2195
|
+
{
|
|
2196
|
+
method: "call.layout.list"
|
|
2197
|
+
},
|
|
2198
|
+
{
|
|
2199
|
+
transformResolve: (payload) => ({
|
|
2200
|
+
layouts: payload.layouts
|
|
2201
|
+
})
|
|
2202
|
+
}
|
|
2203
|
+
);
|
|
1885
2204
|
});
|
|
1886
2205
|
}
|
|
1887
2206
|
getMembers() {
|
|
1888
2207
|
return __async(this, null, function* () {
|
|
1889
|
-
return this.executeAction(
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
2208
|
+
return this.executeAction(
|
|
2209
|
+
{
|
|
2210
|
+
method: "call.member.list"
|
|
2211
|
+
},
|
|
2212
|
+
{
|
|
2213
|
+
transformResolve: (payload) => ({
|
|
2214
|
+
members: payload.members
|
|
2215
|
+
})
|
|
2216
|
+
}
|
|
2217
|
+
);
|
|
1896
2218
|
});
|
|
1897
2219
|
}
|
|
1898
2220
|
removeMember(params) {
|
|
1899
2221
|
return __async(this, null, function* () {
|
|
1900
2222
|
var _a;
|
|
1901
|
-
if (!((_a = this.capabilities
|
|
2223
|
+
if (!((_a = this.capabilities) == null ? void 0 : _a.member.remove)) {
|
|
1902
2224
|
throw Error("Missing setLayout capability");
|
|
1903
2225
|
}
|
|
1904
2226
|
if (!(params == null ? void 0 : params.memberId)) {
|
|
@@ -1912,12 +2234,12 @@ var FabricRoomSessionConnection = class extends BaseRoomSessionConnection {
|
|
|
1912
2234
|
}
|
|
1913
2235
|
setRaisedHand(params) {
|
|
1914
2236
|
return __async(this, null, function* () {
|
|
1915
|
-
var _a, _b, _c, _d
|
|
2237
|
+
var _a, _b, _c, _d;
|
|
1916
2238
|
const { raised = true, memberId } = params || {};
|
|
1917
|
-
if (memberId == this.member.id && raised ? !((
|
|
2239
|
+
if (memberId == this.member.id && raised ? !((_a = this.capabilities) == null ? void 0 : _a.self.raisehand.on) : !((_b = this.capabilities) == null ? void 0 : _b.member.raisehand.on)) {
|
|
1918
2240
|
throw Error("Missing raisehand capability");
|
|
1919
2241
|
}
|
|
1920
|
-
if (memberId == this.member.id && !raised ? !((
|
|
2242
|
+
if (memberId == this.member.id && !raised ? !((_c = this.capabilities) == null ? void 0 : _c.self.raisehand.off) : !((_d = this.capabilities) == null ? void 0 : _d.member.raisehand.off)) {
|
|
1921
2243
|
throw Error("Missing lowerhand capability");
|
|
1922
2244
|
}
|
|
1923
2245
|
return this.executeAction({
|
|
@@ -1928,7 +2250,8 @@ var FabricRoomSessionConnection = class extends BaseRoomSessionConnection {
|
|
|
1928
2250
|
}
|
|
1929
2251
|
setLayout(params) {
|
|
1930
2252
|
return __async(this, null, function* () {
|
|
1931
|
-
|
|
2253
|
+
var _a;
|
|
2254
|
+
if (!((_a = this.capabilities) == null ? void 0 : _a.setLayout)) {
|
|
1932
2255
|
throw Error("Missing setLayout capability");
|
|
1933
2256
|
}
|
|
1934
2257
|
const extraParams = {
|
|
@@ -1944,7 +2267,7 @@ var FabricRoomSessionConnection = class extends BaseRoomSessionConnection {
|
|
|
1944
2267
|
setInputVolume(params) {
|
|
1945
2268
|
return __async(this, null, function* () {
|
|
1946
2269
|
var _a, _b;
|
|
1947
|
-
if (!params || params.memberId === this.member.id ? !((_a = this.capabilities
|
|
2270
|
+
if (!params || params.memberId === this.member.id ? !((_a = this.capabilities) == null ? void 0 : _a.self.microphoneVolume) : !((_b = this.capabilities) == null ? void 0 : _b.member.microphoneVolume)) {
|
|
1948
2271
|
throw Error("Missing setInputVolume capability");
|
|
1949
2272
|
}
|
|
1950
2273
|
return this.executeAction({
|
|
@@ -1959,7 +2282,7 @@ var FabricRoomSessionConnection = class extends BaseRoomSessionConnection {
|
|
|
1959
2282
|
setOutputVolume(params) {
|
|
1960
2283
|
return __async(this, null, function* () {
|
|
1961
2284
|
var _a, _b;
|
|
1962
|
-
if (!params || params.memberId === this.member.id ? !((_a = this.capabilities
|
|
2285
|
+
if (!params || params.memberId === this.member.id ? !((_a = this.capabilities) == null ? void 0 : _a.self.speakerVolume) : !((_b = this.capabilities) == null ? void 0 : _b.member.speakerVolume)) {
|
|
1963
2286
|
throw Error("Missing setOutputVolume capability");
|
|
1964
2287
|
}
|
|
1965
2288
|
return this.executeAction({
|
|
@@ -1974,7 +2297,7 @@ var FabricRoomSessionConnection = class extends BaseRoomSessionConnection {
|
|
|
1974
2297
|
setInputSensitivity(params) {
|
|
1975
2298
|
return __async(this, null, function* () {
|
|
1976
2299
|
var _a, _b;
|
|
1977
|
-
if (!params || params.memberId === this.member.id ? !((_a = this.capabilities
|
|
2300
|
+
if (!params || params.memberId === this.member.id ? !((_a = this.capabilities) == null ? void 0 : _a.self.microphoneSensitivity) : !((_b = this.capabilities) == null ? void 0 : _b.member.microphoneSensitivity)) {
|
|
1978
2301
|
throw Error("Missing setOutputVolume capability");
|
|
1979
2302
|
}
|
|
1980
2303
|
return this.executeAction({
|
|
@@ -1993,7 +2316,9 @@ var FabricRoomSessionConnection = class extends BaseRoomSessionConnection {
|
|
|
1993
2316
|
if (positions && !Object.keys(positions).length) {
|
|
1994
2317
|
throw new Error("Invalid positions");
|
|
1995
2318
|
}
|
|
1996
|
-
if (Object.keys(positions).some(
|
|
2319
|
+
if (Object.keys(positions).some(
|
|
2320
|
+
(p) => ["self", `${this.memberId}`].includes(p)
|
|
2321
|
+
) ? !((_a = this.capabilities) == null ? void 0 : _a.self.position) : !((_b = this.capabilities) == null ? void 0 : _b.member.position)) {
|
|
1997
2322
|
throw Error("Missing setPositions capability");
|
|
1998
2323
|
}
|
|
1999
2324
|
const targets = [];
|
|
@@ -2029,7 +2354,7 @@ var FabricRoomSessionConnection = class extends BaseRoomSessionConnection {
|
|
|
2029
2354
|
lock() {
|
|
2030
2355
|
return __async(this, null, function* () {
|
|
2031
2356
|
var _a;
|
|
2032
|
-
if (!((_a = this.capabilities
|
|
2357
|
+
if (!((_a = this.capabilities) == null ? void 0 : _a.lock.on)) {
|
|
2033
2358
|
throw Error("Missing lock capability");
|
|
2034
2359
|
}
|
|
2035
2360
|
return this.executeAction({
|
|
@@ -2040,7 +2365,7 @@ var FabricRoomSessionConnection = class extends BaseRoomSessionConnection {
|
|
|
2040
2365
|
unlock() {
|
|
2041
2366
|
return __async(this, null, function* () {
|
|
2042
2367
|
var _a;
|
|
2043
|
-
if (!((_a = this.capabilities
|
|
2368
|
+
if (!((_a = this.capabilities) == null ? void 0 : _a.lock.off)) {
|
|
2044
2369
|
throw Error("Missing unlock capability");
|
|
2045
2370
|
}
|
|
2046
2371
|
return this.executeAction({
|
|
@@ -2119,16 +2444,29 @@ var LocalVideoOverlay = class extends UserOverlay {
|
|
|
2119
2444
|
}
|
|
2120
2445
|
attachListeners() {
|
|
2121
2446
|
if (isFabricRoomSession(this._room)) {
|
|
2122
|
-
this._room.on(
|
|
2447
|
+
this._room.on(
|
|
2448
|
+
"member.updated.videoMuted",
|
|
2449
|
+
this.fabricMemberVideoMutedHandler
|
|
2450
|
+
);
|
|
2123
2451
|
} else if (isVideoRoomSession(this._room)) {
|
|
2124
|
-
this._room.on(
|
|
2452
|
+
this._room.on(
|
|
2453
|
+
"member.updated.videoMuted",
|
|
2454
|
+
this.videoMemberVideoMutedHandler
|
|
2455
|
+
);
|
|
2125
2456
|
}
|
|
2126
2457
|
}
|
|
2458
|
+
/** @internal */
|
|
2127
2459
|
detachListeners() {
|
|
2128
2460
|
if (isFabricRoomSession(this._room)) {
|
|
2129
|
-
this._room.off(
|
|
2461
|
+
this._room.off(
|
|
2462
|
+
"member.updated.videoMuted",
|
|
2463
|
+
this.fabricMemberVideoMutedHandler
|
|
2464
|
+
);
|
|
2130
2465
|
} else if (isVideoRoomSession(this._room)) {
|
|
2131
|
-
this._room.off(
|
|
2466
|
+
this._room.off(
|
|
2467
|
+
"member.updated.videoMuted",
|
|
2468
|
+
this.videoMemberVideoMutedHandler
|
|
2469
|
+
);
|
|
2132
2470
|
}
|
|
2133
2471
|
}
|
|
2134
2472
|
memberVideoMutedHandler(memberId, videoMuted) {
|
|
@@ -2141,7 +2479,10 @@ var LocalVideoOverlay = class extends UserOverlay {
|
|
|
2141
2479
|
}
|
|
2142
2480
|
}
|
|
2143
2481
|
fabricMemberVideoMutedHandler(params) {
|
|
2144
|
-
this.memberVideoMutedHandler(
|
|
2482
|
+
this.memberVideoMutedHandler(
|
|
2483
|
+
params.member.member_id,
|
|
2484
|
+
params.member.video_muted
|
|
2485
|
+
);
|
|
2145
2486
|
}
|
|
2146
2487
|
videoMemberVideoMutedHandler(params) {
|
|
2147
2488
|
this.memberVideoMutedHandler(params.member.id, params.member.video_muted);
|
|
@@ -2288,8 +2629,7 @@ var makeLayoutChangedHandler = (params) => {
|
|
|
2288
2629
|
if (applyMemberOverlay) {
|
|
2289
2630
|
layers.forEach((location) => {
|
|
2290
2631
|
const memberIdInLocation = location.member_id;
|
|
2291
|
-
if (!memberIdInLocation)
|
|
2292
|
-
return;
|
|
2632
|
+
if (!memberIdInLocation) return;
|
|
2293
2633
|
const overlayId = addOverlayPrefix(memberIdInLocation);
|
|
2294
2634
|
currentOverlayIds.add(overlayId);
|
|
2295
2635
|
let overlay = overlayMap.get(overlayId);
|
|
@@ -2358,14 +2698,17 @@ var createRootElementResizeObserver = ({
|
|
|
2358
2698
|
return `${height * nativeVideoRatio}px`;
|
|
2359
2699
|
}
|
|
2360
2700
|
};
|
|
2361
|
-
const update = (0, import_core29.debounce)(
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2701
|
+
const update = (0, import_core29.debounce)(
|
|
2702
|
+
({ width, height }) => {
|
|
2703
|
+
const maxPaddingBottom = video.videoHeight / video.videoWidth * 100;
|
|
2704
|
+
if (paddingWrapper) {
|
|
2705
|
+
const pb = height / width * 100;
|
|
2706
|
+
paddingWrapper.style.paddingBottom = `${pb > maxPaddingBottom ? maxPaddingBottom : pb}%`;
|
|
2707
|
+
paddingWrapper.style.width = computePaddingWrapperWidth(width, height);
|
|
2708
|
+
}
|
|
2709
|
+
},
|
|
2710
|
+
100
|
|
2711
|
+
);
|
|
2369
2712
|
const observer = new ResizeObserver((entries) => {
|
|
2370
2713
|
entries.forEach((entry) => {
|
|
2371
2714
|
if (entry.contentBoxSize) {
|
|
@@ -2605,9 +2948,11 @@ var ClientAPI = class extends import_core31.BaseClient {
|
|
|
2605
2948
|
"stopMicrophoneWhileMuted"
|
|
2606
2949
|
]);
|
|
2607
2950
|
const customSagas = [];
|
|
2608
|
-
customSagas.push(
|
|
2609
|
-
|
|
2610
|
-
|
|
2951
|
+
customSagas.push(
|
|
2952
|
+
makeAudioElementSaga({
|
|
2953
|
+
speakerId: options.speakerId
|
|
2954
|
+
})
|
|
2955
|
+
);
|
|
2611
2956
|
const room = createVideoRoomSessionObject(__spreadProps(__spreadValues({}, options), {
|
|
2612
2957
|
store: this.store,
|
|
2613
2958
|
customSagas
|
|
@@ -2627,7 +2972,9 @@ var ClientAPI = class extends import_core31.BaseClient {
|
|
|
2627
2972
|
}
|
|
2628
2973
|
room.on("room.subscribed", (params) => {
|
|
2629
2974
|
var _a2;
|
|
2630
|
-
const member = (_a2 = params.room_session.members) == null ? void 0 : _a2.find(
|
|
2975
|
+
const member = (_a2 = params.room_session.members) == null ? void 0 : _a2.find(
|
|
2976
|
+
(m) => m.id === room.memberId
|
|
2977
|
+
);
|
|
2631
2978
|
if (member == null ? void 0 : member.audio_muted) {
|
|
2632
2979
|
try {
|
|
2633
2980
|
room.stopOutboundAudio();
|
|
@@ -2685,12 +3032,21 @@ var ClientAPI = class extends import_core31.BaseClient {
|
|
|
2685
3032
|
}
|
|
2686
3033
|
return this._pubSub;
|
|
2687
3034
|
}
|
|
3035
|
+
/** @internal */
|
|
2688
3036
|
get videoManager() {
|
|
2689
3037
|
if (!this._videoManager) {
|
|
2690
3038
|
this._videoManager = createVideoManagerObject(this.options);
|
|
2691
3039
|
}
|
|
2692
3040
|
return this._videoManager;
|
|
2693
3041
|
}
|
|
3042
|
+
/**
|
|
3043
|
+
* Reauthenticate with the SignalWire network using a new token
|
|
3044
|
+
* For now it returns void since with an invalid token the server
|
|
3045
|
+
* will close the connection right away so we can hook on the session
|
|
3046
|
+
* events in case. Need to improve it.
|
|
3047
|
+
*
|
|
3048
|
+
* @internal
|
|
3049
|
+
*/
|
|
2694
3050
|
reauthenticate(token) {
|
|
2695
3051
|
this.store.dispatch(import_core31.actions.reauthAction({ token }));
|
|
2696
3052
|
}
|
|
@@ -2724,7 +3080,7 @@ var JWTSession = class extends import_core33.BaseJWTSession {
|
|
|
2724
3080
|
this.options = options;
|
|
2725
3081
|
__publicField(this, "WebSocketConstructor", WebSocket);
|
|
2726
3082
|
__publicField(this, "CloseEventConstructor", SwCloseEvent);
|
|
2727
|
-
__publicField(this, "agent", "@signalwire/js/browser/3.28.
|
|
3083
|
+
__publicField(this, "agent", "@signalwire/js/browser/3.28.1");
|
|
2728
3084
|
__publicField(this, "tokenTyp");
|
|
2729
3085
|
this.tokenTyp = (_a = decodedJwt.typ) != null ? _a : "VRT";
|
|
2730
3086
|
}
|
|
@@ -2785,7 +3141,9 @@ var JWTSession = class extends import_core33.BaseJWTSession {
|
|
|
2785
3141
|
_onSocketClose(event) {
|
|
2786
3142
|
var _a, _b, _c;
|
|
2787
3143
|
if (this.status === "unknown" || this.status === "disconnected") {
|
|
2788
|
-
const { protocolKey, authStateKey, callIdKey } = sessionStorageManager(
|
|
3144
|
+
const { protocolKey, authStateKey, callIdKey } = sessionStorageManager(
|
|
3145
|
+
this.options.token
|
|
3146
|
+
);
|
|
2789
3147
|
this.logger.debug("Cleaning up storage");
|
|
2790
3148
|
if (protocolKey) {
|
|
2791
3149
|
this.logger.debug("Remove protocolKey", protocolKey);
|
|
@@ -2874,7 +3232,9 @@ var import_core37 = require("@signalwire/core");
|
|
|
2874
3232
|
|
|
2875
3233
|
// src/utils/interfaces/video.ts
|
|
2876
3234
|
var import_core36 = require("@signalwire/core");
|
|
2877
|
-
var INTERNAL_MEMBER_UPDATED_EVENTS = Object.keys(
|
|
3235
|
+
var INTERNAL_MEMBER_UPDATED_EVENTS = Object.keys(
|
|
3236
|
+
import_core36.INTERNAL_MEMBER_UPDATABLE_PROPS
|
|
3237
|
+
).map((key) => {
|
|
2878
3238
|
return `member.updated.${key}`;
|
|
2879
3239
|
});
|
|
2880
3240
|
|
|
@@ -2964,11 +3324,14 @@ var createHttpClient = (_a, fetcher = http) => {
|
|
|
2964
3324
|
}, timeout);
|
|
2965
3325
|
}
|
|
2966
3326
|
try {
|
|
2967
|
-
const response = yield fetcher(
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
3327
|
+
const response = yield fetcher(
|
|
3328
|
+
getUrl({
|
|
3329
|
+
path,
|
|
3330
|
+
baseUrl,
|
|
3331
|
+
searchParams: options == null ? void 0 : options.searchParams
|
|
3332
|
+
}),
|
|
3333
|
+
reqInit
|
|
3334
|
+
);
|
|
2972
3335
|
return { body: response.parsedBody };
|
|
2973
3336
|
} catch (e) {
|
|
2974
3337
|
throw e;
|
|
@@ -3014,8 +3377,7 @@ var getUrl = ({
|
|
|
3014
3377
|
// src/utils/paginatedResult.ts
|
|
3015
3378
|
function buildPaginatedResult(body, client) {
|
|
3016
3379
|
const anotherPage = (url) => __async(this, null, function* () {
|
|
3017
|
-
if (!url)
|
|
3018
|
-
return Promise.resolve(void 0);
|
|
3380
|
+
if (!url) return Promise.resolve(void 0);
|
|
3019
3381
|
const { body: body2 } = yield client(url);
|
|
3020
3382
|
return buildPaginatedResult(body2, client);
|
|
3021
3383
|
});
|
|
@@ -3101,8 +3463,7 @@ var HTTPClient = class {
|
|
|
3101
3463
|
}
|
|
3102
3464
|
const { body } = yield this.httpClient(path);
|
|
3103
3465
|
if (isGetAddressesResponse(body)) {
|
|
3104
|
-
if (!body.data[0])
|
|
3105
|
-
throw new import_core39.HttpError(404, "Not Found");
|
|
3466
|
+
if (!body.data[0]) throw new import_core39.HttpError(404, "Not Found");
|
|
3106
3467
|
return body.data[0];
|
|
3107
3468
|
}
|
|
3108
3469
|
return body;
|
|
@@ -3220,6 +3581,7 @@ var Conversation = class {
|
|
|
3220
3581
|
}
|
|
3221
3582
|
});
|
|
3222
3583
|
}
|
|
3584
|
+
/** @internal */
|
|
3223
3585
|
handleEvent(event) {
|
|
3224
3586
|
if (event.subtype === "chat") {
|
|
3225
3587
|
const chatCallbacks = this.chatSubscriptions[event.conversation_id];
|
|
@@ -3260,9 +3622,13 @@ var Conversation = class {
|
|
|
3260
3622
|
if (pageSize) {
|
|
3261
3623
|
queryParams.append("page_size", pageSize.toString());
|
|
3262
3624
|
}
|
|
3263
|
-
const { body } = yield this.httpClient.fetch(
|
|
3625
|
+
const { body } = yield this.httpClient.fetch(
|
|
3626
|
+
makeQueryParamsUrls(path, queryParams)
|
|
3627
|
+
);
|
|
3264
3628
|
const self = this;
|
|
3265
|
-
const data = body.data.map(
|
|
3629
|
+
const data = body.data.map(
|
|
3630
|
+
(conversation) => new ConversationAPI(self, conversation)
|
|
3631
|
+
);
|
|
3266
3632
|
return buildPaginatedResult(__spreadProps(__spreadValues({}, body), { data }), this.httpClient.fetch);
|
|
3267
3633
|
} catch (error) {
|
|
3268
3634
|
throw new Error("Error fetching the conversation history!", error);
|
|
@@ -3278,8 +3644,13 @@ var Conversation = class {
|
|
|
3278
3644
|
if (pageSize) {
|
|
3279
3645
|
queryParams.append("page_size", pageSize.toString());
|
|
3280
3646
|
}
|
|
3281
|
-
const { body } = yield this.httpClient.fetch(
|
|
3282
|
-
|
|
3647
|
+
const { body } = yield this.httpClient.fetch(
|
|
3648
|
+
makeQueryParamsUrls(path, queryParams)
|
|
3649
|
+
);
|
|
3650
|
+
return buildPaginatedResult(
|
|
3651
|
+
body,
|
|
3652
|
+
this.httpClient.fetch
|
|
3653
|
+
);
|
|
3283
3654
|
} catch (error) {
|
|
3284
3655
|
throw new Error("Error fetching the conversation messages!", error);
|
|
3285
3656
|
}
|
|
@@ -3294,8 +3665,13 @@ var Conversation = class {
|
|
|
3294
3665
|
if (pageSize) {
|
|
3295
3666
|
queryParams.append("page_size", pageSize.toString());
|
|
3296
3667
|
}
|
|
3297
|
-
const { body } = yield this.httpClient.fetch(
|
|
3298
|
-
|
|
3668
|
+
const { body } = yield this.httpClient.fetch(
|
|
3669
|
+
makeQueryParamsUrls(path, queryParams)
|
|
3670
|
+
);
|
|
3671
|
+
return buildPaginatedResult(
|
|
3672
|
+
body,
|
|
3673
|
+
this.httpClient.fetch
|
|
3674
|
+
);
|
|
3299
3675
|
} catch (error) {
|
|
3300
3676
|
throw new Error("Error fetching the conversation messages!", error);
|
|
3301
3677
|
}
|
|
@@ -3335,15 +3711,24 @@ var Conversation = class {
|
|
|
3335
3711
|
hasNext: !!(conversationMessages == null ? void 0 : conversationMessages.hasNext) || !!cached.length,
|
|
3336
3712
|
hasPrev: !!(conversationMessages == null ? void 0 : conversationMessages.hasPrev),
|
|
3337
3713
|
nextPage: () => fetchChatMessagesPage(conversationMessages == null ? void 0 : conversationMessages.nextPage, missingReturns),
|
|
3338
|
-
prevPage: () => fetchChatMessagesPage(
|
|
3714
|
+
prevPage: () => fetchChatMessagesPage(
|
|
3715
|
+
conversationMessages == null ? void 0 : conversationMessages.prevPage,
|
|
3716
|
+
missingReturns,
|
|
3717
|
+
false
|
|
3718
|
+
),
|
|
3339
3719
|
self: () => fetchChatMessagesPage(conversationMessages == null ? void 0 : conversationMessages.self, missingReturns),
|
|
3340
|
-
firstPage: () => fetchChatMessagesPage(
|
|
3720
|
+
firstPage: () => fetchChatMessagesPage(
|
|
3721
|
+
conversationMessages == null ? void 0 : conversationMessages.firstPage,
|
|
3722
|
+
missingReturns
|
|
3723
|
+
)
|
|
3341
3724
|
};
|
|
3342
3725
|
});
|
|
3343
|
-
return fetchChatMessagesPage(
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3726
|
+
return fetchChatMessagesPage(
|
|
3727
|
+
() => this.getConversationMessages({
|
|
3728
|
+
addressId,
|
|
3729
|
+
pageSize
|
|
3730
|
+
})
|
|
3731
|
+
);
|
|
3347
3732
|
});
|
|
3348
3733
|
}
|
|
3349
3734
|
subscribe(callback) {
|
|
@@ -3371,12 +3756,15 @@ var Conversation = class {
|
|
|
3371
3756
|
try {
|
|
3372
3757
|
const { addressId } = params;
|
|
3373
3758
|
const path = "/api/fabric/conversations/join";
|
|
3374
|
-
const { body } = yield this.httpClient.fetch(
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3759
|
+
const { body } = yield this.httpClient.fetch(
|
|
3760
|
+
path,
|
|
3761
|
+
{
|
|
3762
|
+
method: "POST",
|
|
3763
|
+
body: {
|
|
3764
|
+
conversation_id: addressId
|
|
3765
|
+
}
|
|
3378
3766
|
}
|
|
3379
|
-
|
|
3767
|
+
);
|
|
3380
3768
|
return body;
|
|
3381
3769
|
} catch (error) {
|
|
3382
3770
|
throw new Error("Error joining a conversation!", error);
|
|
@@ -3434,7 +3822,9 @@ var IncomingCallManager = class {
|
|
|
3434
3822
|
handleIncomingInvite(incomingInvite) {
|
|
3435
3823
|
var _a, _b;
|
|
3436
3824
|
if (incomingInvite.callID in this._pendingInvites) {
|
|
3437
|
-
this._client.logger.debug(
|
|
3825
|
+
this._client.logger.debug(
|
|
3826
|
+
`skiping nottification for pending invite to callID: ${incomingInvite.callID}`
|
|
3827
|
+
);
|
|
3438
3828
|
return;
|
|
3439
3829
|
}
|
|
3440
3830
|
this._pendingInvites[incomingInvite.callID] = incomingInvite;
|
|
@@ -3471,6 +3861,11 @@ var SATSession = class extends JWTSession {
|
|
|
3471
3861
|
return __async(this, null, function* () {
|
|
3472
3862
|
});
|
|
3473
3863
|
}
|
|
3864
|
+
/**
|
|
3865
|
+
* Reauthenticate with the SignalWire Network using a newer SAT.
|
|
3866
|
+
* If the session has expired, this will reconnect it.
|
|
3867
|
+
* @return Promise<void>
|
|
3868
|
+
*/
|
|
3474
3869
|
reauthenticate() {
|
|
3475
3870
|
return __async(this, null, function* () {
|
|
3476
3871
|
this.logger.debug("Session Reauthenticate", {
|
|
@@ -3561,7 +3956,10 @@ var WSClient = class extends import_core42.BaseClient {
|
|
|
3561
3956
|
}
|
|
3562
3957
|
const joinMutedHandler = (params) => {
|
|
3563
3958
|
var _a2;
|
|
3564
|
-
const member = (_a2 = params.room_session.members) == null ? void 0 : _a2.find(
|
|
3959
|
+
const member = (_a2 = params.room_session.members) == null ? void 0 : _a2.find(
|
|
3960
|
+
// @ts-expect-error FIXME:
|
|
3961
|
+
(m) => m.id === room.memberId || m.member_id === room.memberId
|
|
3962
|
+
);
|
|
3565
3963
|
if (member == null ? void 0 : member.audio_muted) {
|
|
3566
3964
|
try {
|
|
3567
3965
|
room.stopOutboundAudio();
|
|
@@ -3627,7 +4025,7 @@ var WSClient = class extends import_core42.BaseClient {
|
|
|
3627
4025
|
stopCameraWhileMuted: true,
|
|
3628
4026
|
stopMicrophoneWhileMuted: true,
|
|
3629
4027
|
watchMediaPackets: false,
|
|
3630
|
-
destinationNumber:
|
|
4028
|
+
destinationNumber: params.to,
|
|
3631
4029
|
nodeId: params.nodeId,
|
|
3632
4030
|
attach: (_e = params.attach) != null ? _e : false,
|
|
3633
4031
|
disableUdpIceServers: params.disableUdpIceServers || false,
|
|
@@ -3758,44 +4156,49 @@ var WSClient = class extends import_core42.BaseClient {
|
|
|
3758
4156
|
});
|
|
3759
4157
|
}
|
|
3760
4158
|
handlePushNotification(params) {
|
|
3761
|
-
return new Promise(
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
4159
|
+
return new Promise(
|
|
4160
|
+
(resolve, reject) => __async(this, null, function* () {
|
|
4161
|
+
const { decrypted, type } = params;
|
|
4162
|
+
if (type !== "call_invite") {
|
|
4163
|
+
this.logger.warn("Unknown notification type", params);
|
|
4164
|
+
reject("Unknown notification type");
|
|
4165
|
+
}
|
|
4166
|
+
this.logger.debug("handlePushNotification", params);
|
|
4167
|
+
const {
|
|
4168
|
+
params: { params: payload },
|
|
4169
|
+
node_id: nodeId
|
|
4170
|
+
} = decrypted;
|
|
3773
4171
|
try {
|
|
3774
|
-
|
|
4172
|
+
try {
|
|
4173
|
+
yield this.executeVertoSubscribe(payload.callID, nodeId);
|
|
4174
|
+
} catch (error) {
|
|
4175
|
+
this.logger.warn("Verto Subscribe", error);
|
|
4176
|
+
}
|
|
4177
|
+
this._incomingCallManager.handleIncomingInvite(__spreadValues({
|
|
4178
|
+
source: "pushNotification",
|
|
4179
|
+
nodeId
|
|
4180
|
+
}, payload));
|
|
4181
|
+
resolve({ resultType: "inboundCall" });
|
|
3775
4182
|
} catch (error) {
|
|
3776
|
-
|
|
4183
|
+
reject(error);
|
|
3777
4184
|
}
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
nodeId
|
|
3781
|
-
}, payload));
|
|
3782
|
-
resolve({ resultType: "inboundCall" });
|
|
3783
|
-
} catch (error) {
|
|
3784
|
-
reject(error);
|
|
3785
|
-
}
|
|
3786
|
-
}));
|
|
4185
|
+
})
|
|
4186
|
+
);
|
|
3787
4187
|
}
|
|
3788
4188
|
updateToken(token) {
|
|
3789
4189
|
return new Promise((resolve, reject) => {
|
|
3790
|
-
this.once("session.auth_error", (error) => {
|
|
4190
|
+
this.session.once("session.auth_error", (error) => {
|
|
3791
4191
|
reject(error);
|
|
3792
4192
|
});
|
|
3793
|
-
this.once("session.connected", () => {
|
|
4193
|
+
this.session.once("session.connected", () => {
|
|
3794
4194
|
resolve();
|
|
3795
4195
|
});
|
|
3796
4196
|
this.store.dispatch(import_core42.actions.reauthAction({ token }));
|
|
3797
4197
|
});
|
|
3798
4198
|
}
|
|
4199
|
+
/**
|
|
4200
|
+
* Mark the client as 'online' to receive calls over WebSocket
|
|
4201
|
+
*/
|
|
3799
4202
|
online(_0) {
|
|
3800
4203
|
return __async(this, arguments, function* ({ incomingCallHandlers }) {
|
|
3801
4204
|
this._incomingCallManager.setNotificationHandlers(incomingCallHandlers);
|
|
@@ -3805,6 +4208,9 @@ var WSClient = class extends import_core42.BaseClient {
|
|
|
3805
4208
|
});
|
|
3806
4209
|
});
|
|
3807
4210
|
}
|
|
4211
|
+
/**
|
|
4212
|
+
* Mark the client as 'offline' to receive calls over WebSocket
|
|
4213
|
+
*/
|
|
3808
4214
|
offline() {
|
|
3809
4215
|
this._incomingCallManager.setNotificationHandlers({});
|
|
3810
4216
|
return this.execute({
|
|
@@ -3815,7 +4221,7 @@ var WSClient = class extends import_core42.BaseClient {
|
|
|
3815
4221
|
};
|
|
3816
4222
|
|
|
3817
4223
|
// src/fabric/SignalWire.ts
|
|
3818
|
-
var SignalWire = (() => {
|
|
4224
|
+
var SignalWire = /* @__PURE__ */ (() => {
|
|
3819
4225
|
let instance = null;
|
|
3820
4226
|
return (params) => {
|
|
3821
4227
|
if (!instance) {
|
|
@@ -3857,6 +4263,9 @@ var SignalWire = (() => {
|
|
|
3857
4263
|
sendMessage: conversation.sendMessage.bind(conversation),
|
|
3858
4264
|
join: conversation.joinConversation.bind(conversation)
|
|
3859
4265
|
},
|
|
4266
|
+
// @ts-expect-error For debugging purposes
|
|
4267
|
+
on: wsClient.on.bind(wsClient),
|
|
4268
|
+
off: wsClient.off.bind(wsClient),
|
|
3860
4269
|
__httpClient: httpClient,
|
|
3861
4270
|
__wsClient: wsClient
|
|
3862
4271
|
});
|
|
@@ -3922,7 +4331,9 @@ var createRoomObject = (roomOptions) => {
|
|
|
3922
4331
|
rootElement = el;
|
|
3923
4332
|
} else {
|
|
3924
4333
|
rootElement = document.body;
|
|
3925
|
-
(0, import_core43.getLogger)().warn(
|
|
4334
|
+
(0, import_core43.getLogger)().warn(
|
|
4335
|
+
`We couldn't find an element with id: ${rootElementId}: using 'document.body' instead.`
|
|
4336
|
+
);
|
|
3926
4337
|
}
|
|
3927
4338
|
}
|
|
3928
4339
|
const roomObject = client.rooms.makeRoomObject({
|
|
@@ -4066,7 +4477,9 @@ var RoomSession = function(roomOptions) {
|
|
|
4066
4477
|
const deprecatedParams = ["audio", "video"];
|
|
4067
4478
|
deprecatedParams.forEach((param) => {
|
|
4068
4479
|
if (param in roomOptions) {
|
|
4069
|
-
(0, import_core44.getLogger)().warn(
|
|
4480
|
+
(0, import_core44.getLogger)().warn(
|
|
4481
|
+
`The '${param}' parameter on the RoomSession constructor is deprecated. Set it on the '.join()' function instead.`
|
|
4482
|
+
);
|
|
4070
4483
|
}
|
|
4071
4484
|
});
|
|
4072
4485
|
const allowReattach = (roomOptions == null ? void 0 : roomOptions.reattach) !== false;
|
|
@@ -4104,6 +4517,8 @@ var RoomSession = function(roomOptions) {
|
|
|
4104
4517
|
};
|
|
4105
4518
|
const client = createClient(userOptions);
|
|
4106
4519
|
const room = client.rooms.makeRoomObject({
|
|
4520
|
+
// audio,
|
|
4521
|
+
// video: video === true ? VIDEO_CONSTRAINTS : video,
|
|
4107
4522
|
negotiateAudio: true,
|
|
4108
4523
|
negotiateVideo: true,
|
|
4109
4524
|
iceServers,
|
|
@@ -4141,14 +4556,19 @@ var RoomSession = function(roomOptions) {
|
|
|
4141
4556
|
if (authState && authState.type === "video") {
|
|
4142
4557
|
const mediaOptions = getJoinMediaParams(__spreadValues({
|
|
4143
4558
|
authState,
|
|
4559
|
+
// constructor values override the send
|
|
4144
4560
|
sendAudio: Boolean(audio),
|
|
4145
4561
|
sendVideo: Boolean(video)
|
|
4146
4562
|
}, params));
|
|
4147
4563
|
if (!checkMediaParams(mediaOptions)) {
|
|
4148
4564
|
client.disconnect();
|
|
4149
|
-
return reject(
|
|
4565
|
+
return reject(
|
|
4566
|
+
new Error(
|
|
4567
|
+
`Invalid arguments to join the room. The token used has join_as: '${authState.join_as}'.
|
|
4150
4568
|
${JSON.stringify(params, null, 2)}
|
|
4151
|
-
`
|
|
4569
|
+
`
|
|
4570
|
+
)
|
|
4571
|
+
);
|
|
4152
4572
|
}
|
|
4153
4573
|
(0, import_core44.getLogger)().debug("Set mediaOptions", mediaOptions);
|
|
4154
4574
|
room.updateMediaOptions({
|
|
@@ -4180,7 +4600,9 @@ ${JSON.stringify(params, null, 2)}
|
|
|
4180
4600
|
return interceptors[prop];
|
|
4181
4601
|
}
|
|
4182
4602
|
if (!target.active && UNSAFE_PROP_ACCESS.includes(prop)) {
|
|
4183
|
-
throw new Error(
|
|
4603
|
+
throw new Error(
|
|
4604
|
+
`Tried to access the property/method "${prop}" before the room was connected. Please call roomSession.join() first.`
|
|
4605
|
+
);
|
|
4184
4606
|
}
|
|
4185
4607
|
return Reflect.get(target, prop, receiver);
|
|
4186
4608
|
}
|