@signalwire/js 4.0.0-dev-20260324190414 → 4.0.0-dev-20260326210326
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/browser.mjs +269 -23
- package/dist/browser.mjs.map +1 -1
- package/dist/browser.umd.js +269 -23
- package/dist/browser.umd.js.map +1 -1
- package/dist/index.cjs +269 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +354 -31
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +354 -31
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +269 -23
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/browser.umd.js
CHANGED
|
@@ -10171,6 +10171,7 @@ var NavigatorDeviceController = class extends Destroyable {
|
|
|
10171
10171
|
|
|
10172
10172
|
//#endregion
|
|
10173
10173
|
//#region src/dependencies/DefaultLocalStorage.ts
|
|
10174
|
+
/** Default storage implementation backed by browser `localStorage` and `sessionStorage`. */
|
|
10174
10175
|
var DefaultLocalStorage = class {
|
|
10175
10176
|
constructor() {
|
|
10176
10177
|
if (typeof localStorage === "undefined") throw new StorageNotAvailableError("localStorage");
|
|
@@ -11965,54 +11966,71 @@ var Participant = class extends Destroyable {
|
|
|
11965
11966
|
get type() {
|
|
11966
11967
|
return this._state$.value.type;
|
|
11967
11968
|
}
|
|
11969
|
+
/** Whether the participant has raised their hand. */
|
|
11968
11970
|
get handraised() {
|
|
11969
11971
|
return this._state$.value.handraised ?? false;
|
|
11970
11972
|
}
|
|
11973
|
+
/** Whether the participant is visible in the layout. */
|
|
11971
11974
|
get visible() {
|
|
11972
11975
|
return this._state$.value.visible ?? false;
|
|
11973
11976
|
}
|
|
11977
|
+
/** Whether the participant's audio is muted. */
|
|
11974
11978
|
get audioMuted() {
|
|
11975
11979
|
return this._state$.value.audio_muted ?? false;
|
|
11976
11980
|
}
|
|
11981
|
+
/** Whether the participant's video is muted. */
|
|
11977
11982
|
get videoMuted() {
|
|
11978
11983
|
return this._state$.value.video_muted ?? false;
|
|
11979
11984
|
}
|
|
11985
|
+
/** Whether the participant is deafened (incoming audio muted). */
|
|
11980
11986
|
get deaf() {
|
|
11981
11987
|
return this._state$.value.deaf ?? false;
|
|
11982
11988
|
}
|
|
11989
|
+
/** Current microphone input volume level, or `undefined` if not set. */
|
|
11983
11990
|
get inputVolume() {
|
|
11984
11991
|
return this._state$.value.input_volume;
|
|
11985
11992
|
}
|
|
11993
|
+
/** Current speaker output volume level, or `undefined` if not set. */
|
|
11986
11994
|
get outputVolume() {
|
|
11987
11995
|
return this._state$.value.output_volume;
|
|
11988
11996
|
}
|
|
11997
|
+
/** Current microphone input sensitivity level, or `undefined` if not set. */
|
|
11989
11998
|
get inputSensitivity() {
|
|
11990
11999
|
return this._state$.value.input_sensitivity;
|
|
11991
12000
|
}
|
|
12001
|
+
/** Whether echo cancellation is enabled. */
|
|
11992
12002
|
get echoCancellation() {
|
|
11993
12003
|
return this._state$.value.echo_cancellation ?? false;
|
|
11994
12004
|
}
|
|
12005
|
+
/** Whether automatic gain control is enabled. */
|
|
11995
12006
|
get autoGain() {
|
|
11996
12007
|
return this._state$.value.auto_gain ?? false;
|
|
11997
12008
|
}
|
|
12009
|
+
/** Whether noise suppression is enabled. */
|
|
11998
12010
|
get noiseSuppression() {
|
|
11999
12011
|
return this._state$.value.noise_suppression ?? false;
|
|
12000
12012
|
}
|
|
12013
|
+
/** Whether low-bitrate mode is active. */
|
|
12001
12014
|
get lowbitrate() {
|
|
12002
12015
|
return this._state$.value.lowbitrate ?? false;
|
|
12003
12016
|
}
|
|
12017
|
+
/** Whether noise reduction (denoise) is active. */
|
|
12004
12018
|
get denoise() {
|
|
12005
12019
|
return this._state$.value.denoise ?? false;
|
|
12006
12020
|
}
|
|
12021
|
+
/** Custom metadata for this participant, or `undefined` if not set. */
|
|
12007
12022
|
get meta() {
|
|
12008
12023
|
return this._state$.value.meta;
|
|
12009
12024
|
}
|
|
12025
|
+
/** Subscriber ID of this participant, or `undefined` if not available. */
|
|
12010
12026
|
get subscriberId() {
|
|
12011
12027
|
return this._state$.value.subscriber_id;
|
|
12012
12028
|
}
|
|
12029
|
+
/** Address ID of this participant, or `undefined` if not available. */
|
|
12013
12030
|
get addressId() {
|
|
12014
12031
|
return this._state$.value.address_id;
|
|
12015
12032
|
}
|
|
12033
|
+
/** Server node ID for this participant, or `undefined` if not available. */
|
|
12016
12034
|
get nodeId() {
|
|
12017
12035
|
return this._state$.value.node_id;
|
|
12018
12036
|
}
|
|
@@ -12084,15 +12102,24 @@ var Participant = class extends Destroyable {
|
|
|
12084
12102
|
async setAudioInputSensitivity(value) {
|
|
12085
12103
|
await this.executeMethod(this.id, "call.microphone.sensitivity.set", { sensitivity: value });
|
|
12086
12104
|
}
|
|
12087
|
-
/**
|
|
12105
|
+
/**
|
|
12106
|
+
* Sets the microphone input volume level.
|
|
12107
|
+
* @param value - Volume level (0-100).
|
|
12108
|
+
*/
|
|
12088
12109
|
async setAudioInputVolume(value) {
|
|
12089
12110
|
await this.executeMethod(this.id, "call.microphone.volume.set", { volume: value });
|
|
12090
12111
|
}
|
|
12091
|
-
/**
|
|
12112
|
+
/**
|
|
12113
|
+
* Sets the speaker output volume level.
|
|
12114
|
+
* @param value - Volume level (0-100).
|
|
12115
|
+
*/
|
|
12092
12116
|
async setAudioOutputVolume(value) {
|
|
12093
12117
|
await this.executeMethod(this.id, "call.speaker.volume.set", { volume: value });
|
|
12094
12118
|
}
|
|
12095
|
-
/**
|
|
12119
|
+
/**
|
|
12120
|
+
* Sets the participant's position in the video layout.
|
|
12121
|
+
* @param value - The {@link VideoPosition} to assign (e.g. `'auto'`, `'reserved-0'`).
|
|
12122
|
+
*/
|
|
12096
12123
|
async setPosition(value) {
|
|
12097
12124
|
await this.executeMethod(this.id, "call.member.position.set", { position: value });
|
|
12098
12125
|
}
|
|
@@ -12110,12 +12137,23 @@ var Participant = class extends Destroyable {
|
|
|
12110
12137
|
async end() {
|
|
12111
12138
|
await this.executeMethod(this.id, "call.end", {});
|
|
12112
12139
|
}
|
|
12140
|
+
/**
|
|
12141
|
+
* Replaces custom metadata for this participant.
|
|
12142
|
+
* @param _meta - Metadata object to set.
|
|
12143
|
+
* @throws {UnimplementedError} Not yet implemented.
|
|
12144
|
+
*/
|
|
12113
12145
|
async setMeta(_meta) {
|
|
12114
12146
|
throw new UnimplementedError();
|
|
12115
12147
|
}
|
|
12148
|
+
/**
|
|
12149
|
+
* Merges values into custom metadata (unlike {@link setMeta} which replaces).
|
|
12150
|
+
* @param _meta - Metadata to merge.
|
|
12151
|
+
* @throws {UnimplementedError} Not yet implemented.
|
|
12152
|
+
*/
|
|
12116
12153
|
async updateMeta(_meta) {
|
|
12117
12154
|
throw new UnimplementedError();
|
|
12118
12155
|
}
|
|
12156
|
+
/** Destroys the participant, releasing all subscriptions and references. */
|
|
12119
12157
|
destroy() {
|
|
12120
12158
|
this.executeMethod = void 0;
|
|
12121
12159
|
super.destroy();
|
|
@@ -12128,6 +12166,7 @@ var Participant = class extends Destroyable {
|
|
|
12128
12166
|
* and local media stream management.
|
|
12129
12167
|
*/
|
|
12130
12168
|
var SelfParticipant = class extends Participant {
|
|
12169
|
+
/** @internal */
|
|
12131
12170
|
constructor(id, executeMethod, vertoManager, deviceController) {
|
|
12132
12171
|
super(id, executeMethod, deviceController);
|
|
12133
12172
|
this.vertoManager = vertoManager;
|
|
@@ -12218,6 +12257,7 @@ var SelfParticipant = class extends Participant {
|
|
|
12218
12257
|
this.deviceController.selectAudioOutputDevice(device);
|
|
12219
12258
|
if (options.savePreference) PreferencesContainer.instance.preferredAudioOutput = device;
|
|
12220
12259
|
}
|
|
12260
|
+
/** Mutes local audio. Falls back to local device mute if the server RPC fails. */
|
|
12221
12261
|
async mute() {
|
|
12222
12262
|
try {
|
|
12223
12263
|
await super.mute();
|
|
@@ -12227,6 +12267,7 @@ var SelfParticipant = class extends Participant {
|
|
|
12227
12267
|
this.vertoManager.muteMainAudioInputDevice();
|
|
12228
12268
|
}
|
|
12229
12269
|
}
|
|
12270
|
+
/** Unmutes local audio. Falls back to local device unmute if the server RPC fails. */
|
|
12230
12271
|
async unmute() {
|
|
12231
12272
|
try {
|
|
12232
12273
|
await super.unmute();
|
|
@@ -12236,6 +12277,7 @@ var SelfParticipant = class extends Participant {
|
|
|
12236
12277
|
await this.vertoManager.unmuteMainAudioInputDevice();
|
|
12237
12278
|
}
|
|
12238
12279
|
}
|
|
12280
|
+
/** Mutes local video. Falls back to local device mute if the server RPC fails. */
|
|
12239
12281
|
async muteVideo() {
|
|
12240
12282
|
try {
|
|
12241
12283
|
await super.muteVideo();
|
|
@@ -12245,6 +12287,7 @@ var SelfParticipant = class extends Participant {
|
|
|
12245
12287
|
this.vertoManager.muteMainVideoInputDevice();
|
|
12246
12288
|
}
|
|
12247
12289
|
}
|
|
12290
|
+
/** Unmutes local video. Falls back to local device unmute if the server RPC fails. */
|
|
12248
12291
|
async unmuteVideo() {
|
|
12249
12292
|
try {
|
|
12250
12293
|
await super.unmuteVideo();
|
|
@@ -14509,7 +14552,7 @@ var WebRTCVertoManager = class extends VertoManager {
|
|
|
14509
14552
|
*
|
|
14510
14553
|
* @see selectAudioInputDevice
|
|
14511
14554
|
* @see selectVideoInputDevice
|
|
14512
|
-
* @param options
|
|
14555
|
+
* @param options - Media options specifying which input devices to add (defaults to audio only).
|
|
14513
14556
|
*/
|
|
14514
14557
|
async addMainInputDevices(options = { audio: true }) {
|
|
14515
14558
|
let deviceKind = void 0;
|
|
@@ -14593,7 +14636,7 @@ var WebRTCVertoManager = class extends VertoManager {
|
|
|
14593
14636
|
try {
|
|
14594
14637
|
const causeParams = cause ? {
|
|
14595
14638
|
cause,
|
|
14596
|
-
|
|
14639
|
+
causeCode: VertoByeCauseCodes[cause]
|
|
14597
14640
|
} : {};
|
|
14598
14641
|
await this.executeVerto(VertoBye({
|
|
14599
14642
|
...causeParams,
|
|
@@ -14792,24 +14835,42 @@ var WebRTCCall = class extends Destroyable {
|
|
|
14792
14835
|
get self() {
|
|
14793
14836
|
return this.callEventsManager.self;
|
|
14794
14837
|
}
|
|
14838
|
+
/** Toggles the call lock state, preventing or allowing new participants from joining. */
|
|
14795
14839
|
async toggleLock() {
|
|
14796
14840
|
const method = this.locked ? "call.unlock" : "call.lock";
|
|
14797
14841
|
await this.executeMethod(this.selfId ?? "", method, {});
|
|
14798
14842
|
}
|
|
14843
|
+
/**
|
|
14844
|
+
* Toggles the hold state of the call (pauses/resumes local media transmission).
|
|
14845
|
+
*
|
|
14846
|
+
* Distinct from {@link Participant.toggleMute} which mutes individual tracks.
|
|
14847
|
+
*/
|
|
14799
14848
|
async toggleHold() {
|
|
14800
14849
|
if (this._holdState) await this.vertoManager.unhold();
|
|
14801
14850
|
else await this.vertoManager.hold();
|
|
14802
14851
|
this._holdState = !this._holdState;
|
|
14803
14852
|
}
|
|
14853
|
+
/** @throws {UnimplementedError} Not yet implemented. Status tracked via {@link recording$}. */
|
|
14804
14854
|
async startRecording() {
|
|
14805
14855
|
throw new UnimplementedError();
|
|
14806
14856
|
}
|
|
14857
|
+
/** @throws {UnimplementedError} Not yet implemented. Status tracked via {@link streaming$}. */
|
|
14807
14858
|
async startStreaming() {
|
|
14808
14859
|
throw new UnimplementedError();
|
|
14809
14860
|
}
|
|
14861
|
+
/**
|
|
14862
|
+
* Replaces the call's custom metadata.
|
|
14863
|
+
* @param _meta - Metadata object to set.
|
|
14864
|
+
* @throws {UnimplementedError} Not yet implemented.
|
|
14865
|
+
*/
|
|
14810
14866
|
async setMeta(_meta) {
|
|
14811
14867
|
throw new UnimplementedError();
|
|
14812
14868
|
}
|
|
14869
|
+
/**
|
|
14870
|
+
* Merges values into the call's custom metadata (unlike {@link setMeta} which replaces).
|
|
14871
|
+
* @param _meta - Metadata to merge.
|
|
14872
|
+
* @throws {UnimplementedError} Not yet implemented.
|
|
14873
|
+
*/
|
|
14813
14874
|
async updateMeta(_meta) {
|
|
14814
14875
|
throw new UnimplementedError();
|
|
14815
14876
|
}
|
|
@@ -14821,7 +14882,17 @@ var WebRTCCall = class extends Destroyable {
|
|
|
14821
14882
|
get layoutLayers() {
|
|
14822
14883
|
return this.callEventsManager.layoutLayers;
|
|
14823
14884
|
}
|
|
14824
|
-
/**
|
|
14885
|
+
/**
|
|
14886
|
+
* Executes a Verto RPC method targeting a specific participant.
|
|
14887
|
+
*
|
|
14888
|
+
* Constructs call context (node_id, call_id, member_id) and sends the RPC request.
|
|
14889
|
+
*
|
|
14890
|
+
* @param target - Target member ID string, or a {@link MemberTarget} object.
|
|
14891
|
+
* @param method - Verto method name (e.g. `'call.mute'`, `'call.member.remove'`).
|
|
14892
|
+
* @param args - Parameters for the RPC method.
|
|
14893
|
+
* @returns The RPC response.
|
|
14894
|
+
* @throws {JSONRPCError} If the RPC call returns an error.
|
|
14895
|
+
*/
|
|
14825
14896
|
async executeMethod(target, method, args) {
|
|
14826
14897
|
const params = this.buildMethodParams(target, args);
|
|
14827
14898
|
const request = buildRPCRequest({
|
|
@@ -14983,7 +15054,16 @@ var WebRTCCall = class extends Destroyable {
|
|
|
14983
15054
|
get participantsId$() {
|
|
14984
15055
|
return this.cachedObservable("participantsId$", () => this.participants$.pipe((0, import_cjs$9.map)((participants) => participants.map((participant) => participant.id))));
|
|
14985
15056
|
}
|
|
14986
|
-
/**
|
|
15057
|
+
/**
|
|
15058
|
+
* Executes a raw JSON-RPC request on the client session.
|
|
15059
|
+
*
|
|
15060
|
+
* Lower-level than {@link executeMethod} — allows full control over the RPC request structure.
|
|
15061
|
+
*
|
|
15062
|
+
* @param request - Complete JSON-RPC request object.
|
|
15063
|
+
* @param options - Optional RPC execution options (timeout, etc.).
|
|
15064
|
+
* @returns The RPC response.
|
|
15065
|
+
* @throws {JSONRPCError} If the RPC call returns an error response.
|
|
15066
|
+
*/
|
|
14987
15067
|
async execute(request, options) {
|
|
14988
15068
|
return this.clientSession.execute(request, options);
|
|
14989
15069
|
}
|
|
@@ -15022,11 +15102,11 @@ var WebRTCCall = class extends Destroyable {
|
|
|
15022
15102
|
get callUpdated$() {
|
|
15023
15103
|
return this.publicCachedObservable("callUpdated$", () => this.callSessionEvents$.pipe(filterAs(isCallUpdatedMetadata, "params"), (0, import_cjs$9.takeUntil)(this.destroyed$)));
|
|
15024
15104
|
}
|
|
15025
|
-
/** Observable of member-joined events. */
|
|
15105
|
+
/** Observable of member-joined events, emitted when a remote participant joins the call. */
|
|
15026
15106
|
get memberJoined$() {
|
|
15027
15107
|
return this.publicCachedObservable("memberJoined$", () => this.callSessionEvents$.pipe(filterAs(isMemberJoinedMetadata, "params"), (0, import_cjs$9.takeUntil)(this.destroyed$)));
|
|
15028
15108
|
}
|
|
15029
|
-
/** Observable of member-left events. */
|
|
15109
|
+
/** Observable of member-left events, emitted when a participant leaves the call. */
|
|
15030
15110
|
get memberLeft$() {
|
|
15031
15111
|
return this.publicCachedObservable("memberLeft$", () => this.callSessionEvents$.pipe(filterAs(isMemberLeftMetadata, "params"), (0, import_cjs$9.takeUntil)(this.destroyed$)));
|
|
15032
15112
|
}
|
|
@@ -15066,7 +15146,17 @@ var WebRTCCall = class extends Destroyable {
|
|
|
15066
15146
|
get layoutEvent$() {
|
|
15067
15147
|
return this.cachedObservable("layoutEvent$", () => this.callEvent$.pipe(filterAs(isLayoutChangedMetadata, "params")));
|
|
15068
15148
|
}
|
|
15069
|
-
/**
|
|
15149
|
+
/**
|
|
15150
|
+
* Hangs up the call and releases all resources.
|
|
15151
|
+
*
|
|
15152
|
+
* Sends a Verto `bye` to the server, transitions status to `'disconnecting'`,
|
|
15153
|
+
* then destroys the call. After this, the call instance is no longer usable.
|
|
15154
|
+
*
|
|
15155
|
+
* @example
|
|
15156
|
+
* ```ts
|
|
15157
|
+
* await call.hangup();
|
|
15158
|
+
* ```
|
|
15159
|
+
*/
|
|
15070
15160
|
async hangup() {
|
|
15071
15161
|
this._status$.next("disconnecting");
|
|
15072
15162
|
try {
|
|
@@ -15075,11 +15165,35 @@ var WebRTCCall = class extends Destroyable {
|
|
|
15075
15165
|
this.destroy();
|
|
15076
15166
|
}
|
|
15077
15167
|
}
|
|
15078
|
-
/**
|
|
15168
|
+
/**
|
|
15169
|
+
* Sends DTMF digits on the call.
|
|
15170
|
+
*
|
|
15171
|
+
* @param dtmf - The digit string to send (e.g. `'1234#'`).
|
|
15172
|
+
*
|
|
15173
|
+
* @example
|
|
15174
|
+
* ```ts
|
|
15175
|
+
* await call.sendDigits('1234#');
|
|
15176
|
+
* ```
|
|
15177
|
+
*/
|
|
15079
15178
|
async sendDigits(dtmf) {
|
|
15080
15179
|
return this.vertoManager.sendDigits(dtmf);
|
|
15081
15180
|
}
|
|
15082
|
-
/**
|
|
15181
|
+
/**
|
|
15182
|
+
* Accepts an inbound call, optionally overriding media options for the answer.
|
|
15183
|
+
*
|
|
15184
|
+
* @param options - Optional media constraints for the answer (audio/video).
|
|
15185
|
+
*
|
|
15186
|
+
* @example
|
|
15187
|
+
* ```ts
|
|
15188
|
+
* // Accept with defaults
|
|
15189
|
+
* call.answer();
|
|
15190
|
+
*
|
|
15191
|
+
* // Accept audio-only
|
|
15192
|
+
* call.answer({ audio: true, video: false });
|
|
15193
|
+
* ```
|
|
15194
|
+
* @see {@link reject} to decline the call instead.
|
|
15195
|
+
* @see {@link answered$} to observe the acceptance state.
|
|
15196
|
+
*/
|
|
15083
15197
|
answer(options) {
|
|
15084
15198
|
this._answerMediaOptions = options;
|
|
15085
15199
|
this._answered$.next(true);
|
|
@@ -15088,7 +15202,12 @@ var WebRTCCall = class extends Destroyable {
|
|
|
15088
15202
|
get answerMediaOptions() {
|
|
15089
15203
|
return this._answerMediaOptions;
|
|
15090
15204
|
}
|
|
15091
|
-
/**
|
|
15205
|
+
/**
|
|
15206
|
+
* Rejects an inbound call, preventing media negotiation.
|
|
15207
|
+
*
|
|
15208
|
+
* @see {@link answer} to accept the call instead.
|
|
15209
|
+
* @see {@link answered$} to observe the rejection state.
|
|
15210
|
+
*/
|
|
15092
15211
|
reject() {
|
|
15093
15212
|
this._answered$.next(false);
|
|
15094
15213
|
}
|
|
@@ -15098,8 +15217,17 @@ var WebRTCCall = class extends Destroyable {
|
|
|
15098
15217
|
}
|
|
15099
15218
|
/**
|
|
15100
15219
|
* Sets the call layout and participant positions.
|
|
15220
|
+
*
|
|
15101
15221
|
* @param layout - Layout name (must be one of {@link layouts}).
|
|
15102
|
-
* @param positions - Map of member IDs to
|
|
15222
|
+
* @param positions - Map of member IDs to {@link VideoPosition} values.
|
|
15223
|
+
* @throws {InvalidParams} If the layout is not in the available {@link layouts}.
|
|
15224
|
+
*
|
|
15225
|
+
* @example
|
|
15226
|
+
* ```ts
|
|
15227
|
+
* await call.setLayout('grid-responsive', {
|
|
15228
|
+
* [participantId]: 'reserved-0',
|
|
15229
|
+
* });
|
|
15230
|
+
* ```
|
|
15103
15231
|
*/
|
|
15104
15232
|
async setLayout(layout, positions) {
|
|
15105
15233
|
if (!this.layouts.includes(layout)) throw new InvalidParams(`Layout ${layout} is not available in the current call layouts: ${this.layouts.join(", ")}`);
|
|
@@ -15109,7 +15237,12 @@ var WebRTCCall = class extends Destroyable {
|
|
|
15109
15237
|
positions
|
|
15110
15238
|
});
|
|
15111
15239
|
}
|
|
15112
|
-
/**
|
|
15240
|
+
/**
|
|
15241
|
+
* Transfers the call to another destination.
|
|
15242
|
+
*
|
|
15243
|
+
* @param options - Transfer configuration including the target destination.
|
|
15244
|
+
* @see {@link status$} to observe the transfer progress.
|
|
15245
|
+
*/
|
|
15113
15246
|
async transfer(options) {
|
|
15114
15247
|
return this.vertoManager.transfer(options);
|
|
15115
15248
|
}
|
|
@@ -15470,11 +15603,28 @@ var Address = class extends Destroyable {
|
|
|
15470
15603
|
get locked$() {
|
|
15471
15604
|
return this.cachedObservable("locked$", () => this._state$.pipe(filterNull(), (0, import_cjs$7.shareReplay)(1), (0, import_cjs$7.map)((state) => state.locked), (0, import_cjs$7.takeUntil)(this.destroyed$)));
|
|
15472
15605
|
}
|
|
15473
|
-
/**
|
|
15606
|
+
/**
|
|
15607
|
+
* Sends a text message to this address.
|
|
15608
|
+
*
|
|
15609
|
+
* @param text - The message text to send.
|
|
15610
|
+
*
|
|
15611
|
+
* @example
|
|
15612
|
+
* ```ts
|
|
15613
|
+
* await address.sendText('Hello!');
|
|
15614
|
+
* ```
|
|
15615
|
+
*/
|
|
15474
15616
|
async sendText(text) {
|
|
15475
15617
|
return this.conversationManager.sendText(text, this.id);
|
|
15476
15618
|
}
|
|
15477
|
-
/**
|
|
15619
|
+
/**
|
|
15620
|
+
* Collection of text messages for this address, with pagination support.
|
|
15621
|
+
*
|
|
15622
|
+
* Returns `undefined` until {@link textMessages$} has been subscribed to (lazy-loaded).
|
|
15623
|
+
* Filters to `'chat'` subtype messages from the conversation.
|
|
15624
|
+
*
|
|
15625
|
+
* @see {@link textMessages$} to trigger lazy loading.
|
|
15626
|
+
* @see {@link sendText} to send a new message.
|
|
15627
|
+
*/
|
|
15478
15628
|
get textMessage() {
|
|
15479
15629
|
if (!this._conversationMessages) return;
|
|
15480
15630
|
this._textMessages$ = this._textMessages$ ?? new EntityCollectionTransformed(this._conversationMessages, (item) => item.subtype === "chat", (item) => ({
|
|
@@ -15485,7 +15635,14 @@ var Address = class extends Destroyable {
|
|
|
15485
15635
|
}));
|
|
15486
15636
|
return this._textMessages$;
|
|
15487
15637
|
}
|
|
15488
|
-
/**
|
|
15638
|
+
/**
|
|
15639
|
+
* Collection of call history entries for this address, with pagination support.
|
|
15640
|
+
*
|
|
15641
|
+
* Returns `undefined` until {@link history$} has been subscribed to (lazy-loaded).
|
|
15642
|
+
* Filters to `'log'` subtype messages including kind, status, start/end times.
|
|
15643
|
+
*
|
|
15644
|
+
* @see {@link history$} to trigger lazy loading.
|
|
15645
|
+
*/
|
|
15489
15646
|
get history() {
|
|
15490
15647
|
if (!this._conversationMessages) return;
|
|
15491
15648
|
this._history$ = this._history$ ?? new EntityCollectionTransformed(this._conversationMessages, (item) => item.subtype === "log", (item) => ({
|
|
@@ -16075,11 +16232,18 @@ var AddressFetcher = class extends Fetcher {
|
|
|
16075
16232
|
logger$4.error("Failed to fetch addresses");
|
|
16076
16233
|
}
|
|
16077
16234
|
};
|
|
16235
|
+
/** Collection of address states with reactive updates and pagination. */
|
|
16078
16236
|
var AddressStateCollection = class extends EntityCollection {
|
|
16079
16237
|
constructor(update$, http, onError) {
|
|
16080
16238
|
super(new AddressFetcher(http), update$, onError);
|
|
16081
16239
|
}
|
|
16082
16240
|
};
|
|
16241
|
+
/**
|
|
16242
|
+
* Manages the directory of {@link Address} entries with paginated loading.
|
|
16243
|
+
*
|
|
16244
|
+
* Implements the {@link Directory} interface and provides reactive access to
|
|
16245
|
+
* addresses via observables, along with pagination and lookup methods.
|
|
16246
|
+
*/
|
|
16083
16247
|
var DirectoryManager = class extends Destroyable {
|
|
16084
16248
|
constructor(http, clientSession, conversationManager, onError) {
|
|
16085
16249
|
super();
|
|
@@ -16104,6 +16268,7 @@ var DirectoryManager = class extends Destroyable {
|
|
|
16104
16268
|
this._statesCollection = new AddressStateCollection(clientSession.signalingEvent$.pipe(filterAs(isConversationMessageUpdatedMetadata, "params"), (0, import_cjs$2.map)((_) => ({}))), this.http, this.onError);
|
|
16105
16269
|
this.initSubscriptions();
|
|
16106
16270
|
}
|
|
16271
|
+
/** Whether addresses are currently being loaded from the server. */
|
|
16107
16272
|
get loading() {
|
|
16108
16273
|
return this._statesCollection.loading;
|
|
16109
16274
|
}
|
|
@@ -16117,28 +16282,57 @@ var DirectoryManager = class extends Destroyable {
|
|
|
16117
16282
|
}
|
|
16118
16283
|
});
|
|
16119
16284
|
}
|
|
16285
|
+
/** Observable stream of all addresses in the directory. */
|
|
16120
16286
|
get addresses$() {
|
|
16121
16287
|
return this._addresses$.asObservable();
|
|
16122
16288
|
}
|
|
16289
|
+
/** Current snapshot of all loaded addresses. */
|
|
16123
16290
|
get addresses() {
|
|
16124
16291
|
return this._addresses$.value;
|
|
16125
16292
|
}
|
|
16293
|
+
/** Observable indicating whether more addresses can be loaded. */
|
|
16126
16294
|
get hasMore$() {
|
|
16127
16295
|
return this._statesCollection.hasMore$;
|
|
16128
16296
|
}
|
|
16297
|
+
/** Observable of the current loading state. */
|
|
16129
16298
|
get loading$() {
|
|
16130
16299
|
return this._statesCollection.loading$;
|
|
16131
16300
|
}
|
|
16301
|
+
/**
|
|
16302
|
+
* Loads the next page of addresses from the server.
|
|
16303
|
+
*
|
|
16304
|
+
* No-op if {@link hasMore$} is `false`. Loading state is observable via {@link loading$}.
|
|
16305
|
+
* New addresses are appended to {@link addresses$} when the page loads.
|
|
16306
|
+
*/
|
|
16132
16307
|
loadMore() {
|
|
16133
16308
|
if (this._statesCollection.hasMore) this._statesCollection.loadMore();
|
|
16134
16309
|
}
|
|
16310
|
+
/**
|
|
16311
|
+
* Returns a reactive observable for a specific address by ID.
|
|
16312
|
+
* @param id - The address ID to observe.
|
|
16313
|
+
* @returns An observable of the address, or `undefined` if not found.
|
|
16314
|
+
*/
|
|
16135
16315
|
get$(id) {
|
|
16136
16316
|
if (!this._observableRegistry.has(id)) this.addNewAddress(id);
|
|
16137
16317
|
return this._observableRegistry.get(id);
|
|
16138
16318
|
}
|
|
16319
|
+
/**
|
|
16320
|
+
* Returns an address by ID from the local cache.
|
|
16321
|
+
* @param addressId - The address ID to look up.
|
|
16322
|
+
* @returns The address, or `undefined` if not found.
|
|
16323
|
+
*/
|
|
16139
16324
|
get(addressId) {
|
|
16140
16325
|
return this._addressesInstances.get(addressId);
|
|
16141
16326
|
}
|
|
16327
|
+
/**
|
|
16328
|
+
* Finds an address ID by its resource name (URI).
|
|
16329
|
+
*
|
|
16330
|
+
* Searches locally loaded addresses first, then queries the server if not found.
|
|
16331
|
+
* The resource name is the {@link Address.name} identifier, distinct from display name.
|
|
16332
|
+
*
|
|
16333
|
+
* @param name - The resource name to search for (exact match, e.g. `'/public/conference'`).
|
|
16334
|
+
* @returns The address ID, or `undefined` if no match is found locally or on server.
|
|
16335
|
+
*/
|
|
16142
16336
|
async findAddressIdByURI(name) {
|
|
16143
16337
|
let addressId = this._addressesInstances.values().find((addr) => addr.name === name)?.id;
|
|
16144
16338
|
if (!addressId) {
|
|
@@ -16573,6 +16767,12 @@ const buildOptionsFromDestination = (destination) => {
|
|
|
16573
16767
|
* ```
|
|
16574
16768
|
*/
|
|
16575
16769
|
var SignalWire = class extends Destroyable {
|
|
16770
|
+
/**
|
|
16771
|
+
* Creates a new SignalWire client and begins connecting.
|
|
16772
|
+
*
|
|
16773
|
+
* @param credentialProvider - Provider that supplies authentication credentials.
|
|
16774
|
+
* @param options - Configuration options (connection, device monitoring, preferences).
|
|
16775
|
+
*/
|
|
16576
16776
|
constructor(credentialProvider, options = {}) {
|
|
16577
16777
|
super();
|
|
16578
16778
|
this.preferences = new ClientPreferences();
|
|
@@ -16806,7 +17006,12 @@ var SignalWire = class extends Destroyable {
|
|
|
16806
17006
|
get errors$() {
|
|
16807
17007
|
return this.deferEmission(this._errors$.asObservable());
|
|
16808
17008
|
}
|
|
16809
|
-
/**
|
|
17009
|
+
/**
|
|
17010
|
+
* Disconnects the WebSocket and tears down the current session.
|
|
17011
|
+
*
|
|
17012
|
+
* The client can be reconnected by calling {@link connect} again,
|
|
17013
|
+
* which creates a fresh transport and session.
|
|
17014
|
+
*/
|
|
16810
17015
|
async disconnect() {
|
|
16811
17016
|
await this._clientSession.disconnect();
|
|
16812
17017
|
this._clientSession.destroy();
|
|
@@ -16815,7 +17020,14 @@ var SignalWire = class extends Destroyable {
|
|
|
16815
17020
|
async waitAuthentication() {
|
|
16816
17021
|
await (0, import_cjs.firstValueFrom)(this.ready$.pipe((0, import_cjs.filter)((ready$1) => ready$1 === true)));
|
|
16817
17022
|
}
|
|
16818
|
-
/**
|
|
17023
|
+
/**
|
|
17024
|
+
* Registers the subscriber as online to receive inbound calls and events.
|
|
17025
|
+
*
|
|
17026
|
+
* Waits for authentication to complete before sending the registration.
|
|
17027
|
+
* If the initial attempt fails, reauthentication is attempted automatically.
|
|
17028
|
+
*
|
|
17029
|
+
* @throws {InvalidCredentialsError} If registration and reauthentication both fail.
|
|
17030
|
+
*/
|
|
16819
17031
|
async register() {
|
|
16820
17032
|
try {
|
|
16821
17033
|
await this.waitAuthentication();
|
|
@@ -16843,7 +17055,11 @@ var SignalWire = class extends Destroyable {
|
|
|
16843
17055
|
throw error;
|
|
16844
17056
|
}
|
|
16845
17057
|
}
|
|
16846
|
-
/**
|
|
17058
|
+
/**
|
|
17059
|
+
* Unregisters the subscriber, going offline for inbound calls.
|
|
17060
|
+
*
|
|
17061
|
+
* The WebSocket connection remains open; use {@link disconnect} to fully close it.
|
|
17062
|
+
*/
|
|
16847
17063
|
async unregister() {
|
|
16848
17064
|
try {
|
|
16849
17065
|
await this._transport.execute(RPCExecute({
|
|
@@ -16859,9 +17075,27 @@ var SignalWire = class extends Destroyable {
|
|
|
16859
17075
|
}
|
|
16860
17076
|
/**
|
|
16861
17077
|
* Places an outbound call to the given destination.
|
|
16862
|
-
*
|
|
16863
|
-
*
|
|
17078
|
+
*
|
|
17079
|
+
* Waits for authentication before dialing. Media options are merged from
|
|
17080
|
+
* saved preferences, destination query parameters (e.g. `?channel=video`),
|
|
17081
|
+
* and the provided `options` (highest priority).
|
|
17082
|
+
*
|
|
17083
|
+
* Returns a {@link Call} in `'ringing'` state. Subscribe to {@link Call.status$}
|
|
17084
|
+
* to track progression through `'connected'` → `'disconnected'`.
|
|
17085
|
+
*
|
|
17086
|
+
* @param destination - Address URI string (e.g. `'/public/my-room'`) or {@link Address} instance.
|
|
17087
|
+
* @param options - Media and dial options (audio/video, device constraints). Overrides defaults.
|
|
16864
17088
|
* @returns The created {@link Call} instance.
|
|
17089
|
+
* @throws {Error} If authentication is not complete or call creation fails.
|
|
17090
|
+
*
|
|
17091
|
+
* @example
|
|
17092
|
+
* ```ts
|
|
17093
|
+
* const call = await client.dial('/public/conference', {
|
|
17094
|
+
* audio: true,
|
|
17095
|
+
* video: true,
|
|
17096
|
+
* });
|
|
17097
|
+
* call.status$.subscribe(status => console.log('Call:', status));
|
|
17098
|
+
* ```
|
|
16865
17099
|
*/
|
|
16866
17100
|
async dial(destination, options = {}) {
|
|
16867
17101
|
const computed_options = {
|
|
@@ -16957,12 +17191,23 @@ var SignalWire = class extends Destroyable {
|
|
|
16957
17191
|
disableDeviceMonitoring() {
|
|
16958
17192
|
this._deviceController.disableDeviceMonitoring();
|
|
16959
17193
|
}
|
|
17194
|
+
/**
|
|
17195
|
+
* Returns the capabilities of a media device.
|
|
17196
|
+
* @param deviceInfo - The device to query.
|
|
17197
|
+
* @returns The device capabilities, or `null` if unavailable.
|
|
17198
|
+
*/
|
|
16960
17199
|
async getDeviceCapabilities(deviceInfo) {
|
|
16961
17200
|
return this._deviceController.getDeviceCapabilities(deviceInfo);
|
|
16962
17201
|
}
|
|
17202
|
+
/**
|
|
17203
|
+
* Checks whether a device is still available and usable.
|
|
17204
|
+
* @param deviceInfo - The device to validate, or `null`.
|
|
17205
|
+
* @returns `true` if the device is valid and available. Returns `false` for `null`, audio output devices, or unavailable devices.
|
|
17206
|
+
*/
|
|
16963
17207
|
async isValidDevice(deviceInfo) {
|
|
16964
17208
|
return this._deviceController.isValidDevice(deviceInfo);
|
|
16965
17209
|
}
|
|
17210
|
+
/** Destroys the client, clearing timers and releasing all resources. */
|
|
16966
17211
|
destroy() {
|
|
16967
17212
|
if (this._refreshTimerId) {
|
|
16968
17213
|
clearTimeout(this._refreshTimerId);
|
|
@@ -16975,6 +17220,7 @@ var SignalWire = class extends Destroyable {
|
|
|
16975
17220
|
//#endregion
|
|
16976
17221
|
//#region src/dependencies/EmbedTokenCredentialProvider.ts
|
|
16977
17222
|
const logger = getLogger();
|
|
17223
|
+
/** Credential provider that exchanges an embed token for a SAT via the host's token endpoint. */
|
|
16978
17224
|
var EmbedTokenCredentialProvider = class {
|
|
16979
17225
|
constructor(host, embedToken) {
|
|
16980
17226
|
this.host = host;
|