@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.mjs
CHANGED
|
@@ -10167,6 +10167,7 @@ var NavigatorDeviceController = class extends Destroyable {
|
|
|
10167
10167
|
|
|
10168
10168
|
//#endregion
|
|
10169
10169
|
//#region src/dependencies/DefaultLocalStorage.ts
|
|
10170
|
+
/** Default storage implementation backed by browser `localStorage` and `sessionStorage`. */
|
|
10170
10171
|
var DefaultLocalStorage = class {
|
|
10171
10172
|
constructor() {
|
|
10172
10173
|
if (typeof localStorage === "undefined") throw new StorageNotAvailableError("localStorage");
|
|
@@ -11961,54 +11962,71 @@ var Participant = class extends Destroyable {
|
|
|
11961
11962
|
get type() {
|
|
11962
11963
|
return this._state$.value.type;
|
|
11963
11964
|
}
|
|
11965
|
+
/** Whether the participant has raised their hand. */
|
|
11964
11966
|
get handraised() {
|
|
11965
11967
|
return this._state$.value.handraised ?? false;
|
|
11966
11968
|
}
|
|
11969
|
+
/** Whether the participant is visible in the layout. */
|
|
11967
11970
|
get visible() {
|
|
11968
11971
|
return this._state$.value.visible ?? false;
|
|
11969
11972
|
}
|
|
11973
|
+
/** Whether the participant's audio is muted. */
|
|
11970
11974
|
get audioMuted() {
|
|
11971
11975
|
return this._state$.value.audio_muted ?? false;
|
|
11972
11976
|
}
|
|
11977
|
+
/** Whether the participant's video is muted. */
|
|
11973
11978
|
get videoMuted() {
|
|
11974
11979
|
return this._state$.value.video_muted ?? false;
|
|
11975
11980
|
}
|
|
11981
|
+
/** Whether the participant is deafened (incoming audio muted). */
|
|
11976
11982
|
get deaf() {
|
|
11977
11983
|
return this._state$.value.deaf ?? false;
|
|
11978
11984
|
}
|
|
11985
|
+
/** Current microphone input volume level, or `undefined` if not set. */
|
|
11979
11986
|
get inputVolume() {
|
|
11980
11987
|
return this._state$.value.input_volume;
|
|
11981
11988
|
}
|
|
11989
|
+
/** Current speaker output volume level, or `undefined` if not set. */
|
|
11982
11990
|
get outputVolume() {
|
|
11983
11991
|
return this._state$.value.output_volume;
|
|
11984
11992
|
}
|
|
11993
|
+
/** Current microphone input sensitivity level, or `undefined` if not set. */
|
|
11985
11994
|
get inputSensitivity() {
|
|
11986
11995
|
return this._state$.value.input_sensitivity;
|
|
11987
11996
|
}
|
|
11997
|
+
/** Whether echo cancellation is enabled. */
|
|
11988
11998
|
get echoCancellation() {
|
|
11989
11999
|
return this._state$.value.echo_cancellation ?? false;
|
|
11990
12000
|
}
|
|
12001
|
+
/** Whether automatic gain control is enabled. */
|
|
11991
12002
|
get autoGain() {
|
|
11992
12003
|
return this._state$.value.auto_gain ?? false;
|
|
11993
12004
|
}
|
|
12005
|
+
/** Whether noise suppression is enabled. */
|
|
11994
12006
|
get noiseSuppression() {
|
|
11995
12007
|
return this._state$.value.noise_suppression ?? false;
|
|
11996
12008
|
}
|
|
12009
|
+
/** Whether low-bitrate mode is active. */
|
|
11997
12010
|
get lowbitrate() {
|
|
11998
12011
|
return this._state$.value.lowbitrate ?? false;
|
|
11999
12012
|
}
|
|
12013
|
+
/** Whether noise reduction (denoise) is active. */
|
|
12000
12014
|
get denoise() {
|
|
12001
12015
|
return this._state$.value.denoise ?? false;
|
|
12002
12016
|
}
|
|
12017
|
+
/** Custom metadata for this participant, or `undefined` if not set. */
|
|
12003
12018
|
get meta() {
|
|
12004
12019
|
return this._state$.value.meta;
|
|
12005
12020
|
}
|
|
12021
|
+
/** Subscriber ID of this participant, or `undefined` if not available. */
|
|
12006
12022
|
get subscriberId() {
|
|
12007
12023
|
return this._state$.value.subscriber_id;
|
|
12008
12024
|
}
|
|
12025
|
+
/** Address ID of this participant, or `undefined` if not available. */
|
|
12009
12026
|
get addressId() {
|
|
12010
12027
|
return this._state$.value.address_id;
|
|
12011
12028
|
}
|
|
12029
|
+
/** Server node ID for this participant, or `undefined` if not available. */
|
|
12012
12030
|
get nodeId() {
|
|
12013
12031
|
return this._state$.value.node_id;
|
|
12014
12032
|
}
|
|
@@ -12080,15 +12098,24 @@ var Participant = class extends Destroyable {
|
|
|
12080
12098
|
async setAudioInputSensitivity(value) {
|
|
12081
12099
|
await this.executeMethod(this.id, "call.microphone.sensitivity.set", { sensitivity: value });
|
|
12082
12100
|
}
|
|
12083
|
-
/**
|
|
12101
|
+
/**
|
|
12102
|
+
* Sets the microphone input volume level.
|
|
12103
|
+
* @param value - Volume level (0-100).
|
|
12104
|
+
*/
|
|
12084
12105
|
async setAudioInputVolume(value) {
|
|
12085
12106
|
await this.executeMethod(this.id, "call.microphone.volume.set", { volume: value });
|
|
12086
12107
|
}
|
|
12087
|
-
/**
|
|
12108
|
+
/**
|
|
12109
|
+
* Sets the speaker output volume level.
|
|
12110
|
+
* @param value - Volume level (0-100).
|
|
12111
|
+
*/
|
|
12088
12112
|
async setAudioOutputVolume(value) {
|
|
12089
12113
|
await this.executeMethod(this.id, "call.speaker.volume.set", { volume: value });
|
|
12090
12114
|
}
|
|
12091
|
-
/**
|
|
12115
|
+
/**
|
|
12116
|
+
* Sets the participant's position in the video layout.
|
|
12117
|
+
* @param value - The {@link VideoPosition} to assign (e.g. `'auto'`, `'reserved-0'`).
|
|
12118
|
+
*/
|
|
12092
12119
|
async setPosition(value) {
|
|
12093
12120
|
await this.executeMethod(this.id, "call.member.position.set", { position: value });
|
|
12094
12121
|
}
|
|
@@ -12106,12 +12133,23 @@ var Participant = class extends Destroyable {
|
|
|
12106
12133
|
async end() {
|
|
12107
12134
|
await this.executeMethod(this.id, "call.end", {});
|
|
12108
12135
|
}
|
|
12136
|
+
/**
|
|
12137
|
+
* Replaces custom metadata for this participant.
|
|
12138
|
+
* @param _meta - Metadata object to set.
|
|
12139
|
+
* @throws {UnimplementedError} Not yet implemented.
|
|
12140
|
+
*/
|
|
12109
12141
|
async setMeta(_meta) {
|
|
12110
12142
|
throw new UnimplementedError();
|
|
12111
12143
|
}
|
|
12144
|
+
/**
|
|
12145
|
+
* Merges values into custom metadata (unlike {@link setMeta} which replaces).
|
|
12146
|
+
* @param _meta - Metadata to merge.
|
|
12147
|
+
* @throws {UnimplementedError} Not yet implemented.
|
|
12148
|
+
*/
|
|
12112
12149
|
async updateMeta(_meta) {
|
|
12113
12150
|
throw new UnimplementedError();
|
|
12114
12151
|
}
|
|
12152
|
+
/** Destroys the participant, releasing all subscriptions and references. */
|
|
12115
12153
|
destroy() {
|
|
12116
12154
|
this.executeMethod = void 0;
|
|
12117
12155
|
super.destroy();
|
|
@@ -12124,6 +12162,7 @@ var Participant = class extends Destroyable {
|
|
|
12124
12162
|
* and local media stream management.
|
|
12125
12163
|
*/
|
|
12126
12164
|
var SelfParticipant = class extends Participant {
|
|
12165
|
+
/** @internal */
|
|
12127
12166
|
constructor(id, executeMethod, vertoManager, deviceController) {
|
|
12128
12167
|
super(id, executeMethod, deviceController);
|
|
12129
12168
|
this.vertoManager = vertoManager;
|
|
@@ -12214,6 +12253,7 @@ var SelfParticipant = class extends Participant {
|
|
|
12214
12253
|
this.deviceController.selectAudioOutputDevice(device);
|
|
12215
12254
|
if (options.savePreference) PreferencesContainer.instance.preferredAudioOutput = device;
|
|
12216
12255
|
}
|
|
12256
|
+
/** Mutes local audio. Falls back to local device mute if the server RPC fails. */
|
|
12217
12257
|
async mute() {
|
|
12218
12258
|
try {
|
|
12219
12259
|
await super.mute();
|
|
@@ -12223,6 +12263,7 @@ var SelfParticipant = class extends Participant {
|
|
|
12223
12263
|
this.vertoManager.muteMainAudioInputDevice();
|
|
12224
12264
|
}
|
|
12225
12265
|
}
|
|
12266
|
+
/** Unmutes local audio. Falls back to local device unmute if the server RPC fails. */
|
|
12226
12267
|
async unmute() {
|
|
12227
12268
|
try {
|
|
12228
12269
|
await super.unmute();
|
|
@@ -12232,6 +12273,7 @@ var SelfParticipant = class extends Participant {
|
|
|
12232
12273
|
await this.vertoManager.unmuteMainAudioInputDevice();
|
|
12233
12274
|
}
|
|
12234
12275
|
}
|
|
12276
|
+
/** Mutes local video. Falls back to local device mute if the server RPC fails. */
|
|
12235
12277
|
async muteVideo() {
|
|
12236
12278
|
try {
|
|
12237
12279
|
await super.muteVideo();
|
|
@@ -12241,6 +12283,7 @@ var SelfParticipant = class extends Participant {
|
|
|
12241
12283
|
this.vertoManager.muteMainVideoInputDevice();
|
|
12242
12284
|
}
|
|
12243
12285
|
}
|
|
12286
|
+
/** Unmutes local video. Falls back to local device unmute if the server RPC fails. */
|
|
12244
12287
|
async unmuteVideo() {
|
|
12245
12288
|
try {
|
|
12246
12289
|
await super.unmuteVideo();
|
|
@@ -14505,7 +14548,7 @@ var WebRTCVertoManager = class extends VertoManager {
|
|
|
14505
14548
|
*
|
|
14506
14549
|
* @see selectAudioInputDevice
|
|
14507
14550
|
* @see selectVideoInputDevice
|
|
14508
|
-
* @param options
|
|
14551
|
+
* @param options - Media options specifying which input devices to add (defaults to audio only).
|
|
14509
14552
|
*/
|
|
14510
14553
|
async addMainInputDevices(options = { audio: true }) {
|
|
14511
14554
|
let deviceKind = void 0;
|
|
@@ -14589,7 +14632,7 @@ var WebRTCVertoManager = class extends VertoManager {
|
|
|
14589
14632
|
try {
|
|
14590
14633
|
const causeParams = cause ? {
|
|
14591
14634
|
cause,
|
|
14592
|
-
|
|
14635
|
+
causeCode: VertoByeCauseCodes[cause]
|
|
14593
14636
|
} : {};
|
|
14594
14637
|
await this.executeVerto(VertoBye({
|
|
14595
14638
|
...causeParams,
|
|
@@ -14788,24 +14831,42 @@ var WebRTCCall = class extends Destroyable {
|
|
|
14788
14831
|
get self() {
|
|
14789
14832
|
return this.callEventsManager.self;
|
|
14790
14833
|
}
|
|
14834
|
+
/** Toggles the call lock state, preventing or allowing new participants from joining. */
|
|
14791
14835
|
async toggleLock() {
|
|
14792
14836
|
const method = this.locked ? "call.unlock" : "call.lock";
|
|
14793
14837
|
await this.executeMethod(this.selfId ?? "", method, {});
|
|
14794
14838
|
}
|
|
14839
|
+
/**
|
|
14840
|
+
* Toggles the hold state of the call (pauses/resumes local media transmission).
|
|
14841
|
+
*
|
|
14842
|
+
* Distinct from {@link Participant.toggleMute} which mutes individual tracks.
|
|
14843
|
+
*/
|
|
14795
14844
|
async toggleHold() {
|
|
14796
14845
|
if (this._holdState) await this.vertoManager.unhold();
|
|
14797
14846
|
else await this.vertoManager.hold();
|
|
14798
14847
|
this._holdState = !this._holdState;
|
|
14799
14848
|
}
|
|
14849
|
+
/** @throws {UnimplementedError} Not yet implemented. Status tracked via {@link recording$}. */
|
|
14800
14850
|
async startRecording() {
|
|
14801
14851
|
throw new UnimplementedError();
|
|
14802
14852
|
}
|
|
14853
|
+
/** @throws {UnimplementedError} Not yet implemented. Status tracked via {@link streaming$}. */
|
|
14803
14854
|
async startStreaming() {
|
|
14804
14855
|
throw new UnimplementedError();
|
|
14805
14856
|
}
|
|
14857
|
+
/**
|
|
14858
|
+
* Replaces the call's custom metadata.
|
|
14859
|
+
* @param _meta - Metadata object to set.
|
|
14860
|
+
* @throws {UnimplementedError} Not yet implemented.
|
|
14861
|
+
*/
|
|
14806
14862
|
async setMeta(_meta) {
|
|
14807
14863
|
throw new UnimplementedError();
|
|
14808
14864
|
}
|
|
14865
|
+
/**
|
|
14866
|
+
* Merges values into the call's custom metadata (unlike {@link setMeta} which replaces).
|
|
14867
|
+
* @param _meta - Metadata to merge.
|
|
14868
|
+
* @throws {UnimplementedError} Not yet implemented.
|
|
14869
|
+
*/
|
|
14809
14870
|
async updateMeta(_meta) {
|
|
14810
14871
|
throw new UnimplementedError();
|
|
14811
14872
|
}
|
|
@@ -14817,7 +14878,17 @@ var WebRTCCall = class extends Destroyable {
|
|
|
14817
14878
|
get layoutLayers() {
|
|
14818
14879
|
return this.callEventsManager.layoutLayers;
|
|
14819
14880
|
}
|
|
14820
|
-
/**
|
|
14881
|
+
/**
|
|
14882
|
+
* Executes a Verto RPC method targeting a specific participant.
|
|
14883
|
+
*
|
|
14884
|
+
* Constructs call context (node_id, call_id, member_id) and sends the RPC request.
|
|
14885
|
+
*
|
|
14886
|
+
* @param target - Target member ID string, or a {@link MemberTarget} object.
|
|
14887
|
+
* @param method - Verto method name (e.g. `'call.mute'`, `'call.member.remove'`).
|
|
14888
|
+
* @param args - Parameters for the RPC method.
|
|
14889
|
+
* @returns The RPC response.
|
|
14890
|
+
* @throws {JSONRPCError} If the RPC call returns an error.
|
|
14891
|
+
*/
|
|
14821
14892
|
async executeMethod(target, method, args) {
|
|
14822
14893
|
const params = this.buildMethodParams(target, args);
|
|
14823
14894
|
const request = buildRPCRequest({
|
|
@@ -14979,7 +15050,16 @@ var WebRTCCall = class extends Destroyable {
|
|
|
14979
15050
|
get participantsId$() {
|
|
14980
15051
|
return this.cachedObservable("participantsId$", () => this.participants$.pipe((0, import_cjs$9.map)((participants) => participants.map((participant) => participant.id))));
|
|
14981
15052
|
}
|
|
14982
|
-
/**
|
|
15053
|
+
/**
|
|
15054
|
+
* Executes a raw JSON-RPC request on the client session.
|
|
15055
|
+
*
|
|
15056
|
+
* Lower-level than {@link executeMethod} — allows full control over the RPC request structure.
|
|
15057
|
+
*
|
|
15058
|
+
* @param request - Complete JSON-RPC request object.
|
|
15059
|
+
* @param options - Optional RPC execution options (timeout, etc.).
|
|
15060
|
+
* @returns The RPC response.
|
|
15061
|
+
* @throws {JSONRPCError} If the RPC call returns an error response.
|
|
15062
|
+
*/
|
|
14983
15063
|
async execute(request, options) {
|
|
14984
15064
|
return this.clientSession.execute(request, options);
|
|
14985
15065
|
}
|
|
@@ -15018,11 +15098,11 @@ var WebRTCCall = class extends Destroyable {
|
|
|
15018
15098
|
get callUpdated$() {
|
|
15019
15099
|
return this.publicCachedObservable("callUpdated$", () => this.callSessionEvents$.pipe(filterAs(isCallUpdatedMetadata, "params"), (0, import_cjs$9.takeUntil)(this.destroyed$)));
|
|
15020
15100
|
}
|
|
15021
|
-
/** Observable of member-joined events. */
|
|
15101
|
+
/** Observable of member-joined events, emitted when a remote participant joins the call. */
|
|
15022
15102
|
get memberJoined$() {
|
|
15023
15103
|
return this.publicCachedObservable("memberJoined$", () => this.callSessionEvents$.pipe(filterAs(isMemberJoinedMetadata, "params"), (0, import_cjs$9.takeUntil)(this.destroyed$)));
|
|
15024
15104
|
}
|
|
15025
|
-
/** Observable of member-left events. */
|
|
15105
|
+
/** Observable of member-left events, emitted when a participant leaves the call. */
|
|
15026
15106
|
get memberLeft$() {
|
|
15027
15107
|
return this.publicCachedObservable("memberLeft$", () => this.callSessionEvents$.pipe(filterAs(isMemberLeftMetadata, "params"), (0, import_cjs$9.takeUntil)(this.destroyed$)));
|
|
15028
15108
|
}
|
|
@@ -15062,7 +15142,17 @@ var WebRTCCall = class extends Destroyable {
|
|
|
15062
15142
|
get layoutEvent$() {
|
|
15063
15143
|
return this.cachedObservable("layoutEvent$", () => this.callEvent$.pipe(filterAs(isLayoutChangedMetadata, "params")));
|
|
15064
15144
|
}
|
|
15065
|
-
/**
|
|
15145
|
+
/**
|
|
15146
|
+
* Hangs up the call and releases all resources.
|
|
15147
|
+
*
|
|
15148
|
+
* Sends a Verto `bye` to the server, transitions status to `'disconnecting'`,
|
|
15149
|
+
* then destroys the call. After this, the call instance is no longer usable.
|
|
15150
|
+
*
|
|
15151
|
+
* @example
|
|
15152
|
+
* ```ts
|
|
15153
|
+
* await call.hangup();
|
|
15154
|
+
* ```
|
|
15155
|
+
*/
|
|
15066
15156
|
async hangup() {
|
|
15067
15157
|
this._status$.next("disconnecting");
|
|
15068
15158
|
try {
|
|
@@ -15071,11 +15161,35 @@ var WebRTCCall = class extends Destroyable {
|
|
|
15071
15161
|
this.destroy();
|
|
15072
15162
|
}
|
|
15073
15163
|
}
|
|
15074
|
-
/**
|
|
15164
|
+
/**
|
|
15165
|
+
* Sends DTMF digits on the call.
|
|
15166
|
+
*
|
|
15167
|
+
* @param dtmf - The digit string to send (e.g. `'1234#'`).
|
|
15168
|
+
*
|
|
15169
|
+
* @example
|
|
15170
|
+
* ```ts
|
|
15171
|
+
* await call.sendDigits('1234#');
|
|
15172
|
+
* ```
|
|
15173
|
+
*/
|
|
15075
15174
|
async sendDigits(dtmf) {
|
|
15076
15175
|
return this.vertoManager.sendDigits(dtmf);
|
|
15077
15176
|
}
|
|
15078
|
-
/**
|
|
15177
|
+
/**
|
|
15178
|
+
* Accepts an inbound call, optionally overriding media options for the answer.
|
|
15179
|
+
*
|
|
15180
|
+
* @param options - Optional media constraints for the answer (audio/video).
|
|
15181
|
+
*
|
|
15182
|
+
* @example
|
|
15183
|
+
* ```ts
|
|
15184
|
+
* // Accept with defaults
|
|
15185
|
+
* call.answer();
|
|
15186
|
+
*
|
|
15187
|
+
* // Accept audio-only
|
|
15188
|
+
* call.answer({ audio: true, video: false });
|
|
15189
|
+
* ```
|
|
15190
|
+
* @see {@link reject} to decline the call instead.
|
|
15191
|
+
* @see {@link answered$} to observe the acceptance state.
|
|
15192
|
+
*/
|
|
15079
15193
|
answer(options) {
|
|
15080
15194
|
this._answerMediaOptions = options;
|
|
15081
15195
|
this._answered$.next(true);
|
|
@@ -15084,7 +15198,12 @@ var WebRTCCall = class extends Destroyable {
|
|
|
15084
15198
|
get answerMediaOptions() {
|
|
15085
15199
|
return this._answerMediaOptions;
|
|
15086
15200
|
}
|
|
15087
|
-
/**
|
|
15201
|
+
/**
|
|
15202
|
+
* Rejects an inbound call, preventing media negotiation.
|
|
15203
|
+
*
|
|
15204
|
+
* @see {@link answer} to accept the call instead.
|
|
15205
|
+
* @see {@link answered$} to observe the rejection state.
|
|
15206
|
+
*/
|
|
15088
15207
|
reject() {
|
|
15089
15208
|
this._answered$.next(false);
|
|
15090
15209
|
}
|
|
@@ -15094,8 +15213,17 @@ var WebRTCCall = class extends Destroyable {
|
|
|
15094
15213
|
}
|
|
15095
15214
|
/**
|
|
15096
15215
|
* Sets the call layout and participant positions.
|
|
15216
|
+
*
|
|
15097
15217
|
* @param layout - Layout name (must be one of {@link layouts}).
|
|
15098
|
-
* @param positions - Map of member IDs to
|
|
15218
|
+
* @param positions - Map of member IDs to {@link VideoPosition} values.
|
|
15219
|
+
* @throws {InvalidParams} If the layout is not in the available {@link layouts}.
|
|
15220
|
+
*
|
|
15221
|
+
* @example
|
|
15222
|
+
* ```ts
|
|
15223
|
+
* await call.setLayout('grid-responsive', {
|
|
15224
|
+
* [participantId]: 'reserved-0',
|
|
15225
|
+
* });
|
|
15226
|
+
* ```
|
|
15099
15227
|
*/
|
|
15100
15228
|
async setLayout(layout, positions) {
|
|
15101
15229
|
if (!this.layouts.includes(layout)) throw new InvalidParams(`Layout ${layout} is not available in the current call layouts: ${this.layouts.join(", ")}`);
|
|
@@ -15105,7 +15233,12 @@ var WebRTCCall = class extends Destroyable {
|
|
|
15105
15233
|
positions
|
|
15106
15234
|
});
|
|
15107
15235
|
}
|
|
15108
|
-
/**
|
|
15236
|
+
/**
|
|
15237
|
+
* Transfers the call to another destination.
|
|
15238
|
+
*
|
|
15239
|
+
* @param options - Transfer configuration including the target destination.
|
|
15240
|
+
* @see {@link status$} to observe the transfer progress.
|
|
15241
|
+
*/
|
|
15109
15242
|
async transfer(options) {
|
|
15110
15243
|
return this.vertoManager.transfer(options);
|
|
15111
15244
|
}
|
|
@@ -15466,11 +15599,28 @@ var Address = class extends Destroyable {
|
|
|
15466
15599
|
get locked$() {
|
|
15467
15600
|
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$)));
|
|
15468
15601
|
}
|
|
15469
|
-
/**
|
|
15602
|
+
/**
|
|
15603
|
+
* Sends a text message to this address.
|
|
15604
|
+
*
|
|
15605
|
+
* @param text - The message text to send.
|
|
15606
|
+
*
|
|
15607
|
+
* @example
|
|
15608
|
+
* ```ts
|
|
15609
|
+
* await address.sendText('Hello!');
|
|
15610
|
+
* ```
|
|
15611
|
+
*/
|
|
15470
15612
|
async sendText(text) {
|
|
15471
15613
|
return this.conversationManager.sendText(text, this.id);
|
|
15472
15614
|
}
|
|
15473
|
-
/**
|
|
15615
|
+
/**
|
|
15616
|
+
* Collection of text messages for this address, with pagination support.
|
|
15617
|
+
*
|
|
15618
|
+
* Returns `undefined` until {@link textMessages$} has been subscribed to (lazy-loaded).
|
|
15619
|
+
* Filters to `'chat'` subtype messages from the conversation.
|
|
15620
|
+
*
|
|
15621
|
+
* @see {@link textMessages$} to trigger lazy loading.
|
|
15622
|
+
* @see {@link sendText} to send a new message.
|
|
15623
|
+
*/
|
|
15474
15624
|
get textMessage() {
|
|
15475
15625
|
if (!this._conversationMessages) return;
|
|
15476
15626
|
this._textMessages$ = this._textMessages$ ?? new EntityCollectionTransformed(this._conversationMessages, (item) => item.subtype === "chat", (item) => ({
|
|
@@ -15481,7 +15631,14 @@ var Address = class extends Destroyable {
|
|
|
15481
15631
|
}));
|
|
15482
15632
|
return this._textMessages$;
|
|
15483
15633
|
}
|
|
15484
|
-
/**
|
|
15634
|
+
/**
|
|
15635
|
+
* Collection of call history entries for this address, with pagination support.
|
|
15636
|
+
*
|
|
15637
|
+
* Returns `undefined` until {@link history$} has been subscribed to (lazy-loaded).
|
|
15638
|
+
* Filters to `'log'` subtype messages including kind, status, start/end times.
|
|
15639
|
+
*
|
|
15640
|
+
* @see {@link history$} to trigger lazy loading.
|
|
15641
|
+
*/
|
|
15485
15642
|
get history() {
|
|
15486
15643
|
if (!this._conversationMessages) return;
|
|
15487
15644
|
this._history$ = this._history$ ?? new EntityCollectionTransformed(this._conversationMessages, (item) => item.subtype === "log", (item) => ({
|
|
@@ -16071,11 +16228,18 @@ var AddressFetcher = class extends Fetcher {
|
|
|
16071
16228
|
logger$4.error("Failed to fetch addresses");
|
|
16072
16229
|
}
|
|
16073
16230
|
};
|
|
16231
|
+
/** Collection of address states with reactive updates and pagination. */
|
|
16074
16232
|
var AddressStateCollection = class extends EntityCollection {
|
|
16075
16233
|
constructor(update$, http, onError) {
|
|
16076
16234
|
super(new AddressFetcher(http), update$, onError);
|
|
16077
16235
|
}
|
|
16078
16236
|
};
|
|
16237
|
+
/**
|
|
16238
|
+
* Manages the directory of {@link Address} entries with paginated loading.
|
|
16239
|
+
*
|
|
16240
|
+
* Implements the {@link Directory} interface and provides reactive access to
|
|
16241
|
+
* addresses via observables, along with pagination and lookup methods.
|
|
16242
|
+
*/
|
|
16079
16243
|
var DirectoryManager = class extends Destroyable {
|
|
16080
16244
|
constructor(http, clientSession, conversationManager, onError) {
|
|
16081
16245
|
super();
|
|
@@ -16100,6 +16264,7 @@ var DirectoryManager = class extends Destroyable {
|
|
|
16100
16264
|
this._statesCollection = new AddressStateCollection(clientSession.signalingEvent$.pipe(filterAs(isConversationMessageUpdatedMetadata, "params"), (0, import_cjs$2.map)((_) => ({}))), this.http, this.onError);
|
|
16101
16265
|
this.initSubscriptions();
|
|
16102
16266
|
}
|
|
16267
|
+
/** Whether addresses are currently being loaded from the server. */
|
|
16103
16268
|
get loading() {
|
|
16104
16269
|
return this._statesCollection.loading;
|
|
16105
16270
|
}
|
|
@@ -16113,28 +16278,57 @@ var DirectoryManager = class extends Destroyable {
|
|
|
16113
16278
|
}
|
|
16114
16279
|
});
|
|
16115
16280
|
}
|
|
16281
|
+
/** Observable stream of all addresses in the directory. */
|
|
16116
16282
|
get addresses$() {
|
|
16117
16283
|
return this._addresses$.asObservable();
|
|
16118
16284
|
}
|
|
16285
|
+
/** Current snapshot of all loaded addresses. */
|
|
16119
16286
|
get addresses() {
|
|
16120
16287
|
return this._addresses$.value;
|
|
16121
16288
|
}
|
|
16289
|
+
/** Observable indicating whether more addresses can be loaded. */
|
|
16122
16290
|
get hasMore$() {
|
|
16123
16291
|
return this._statesCollection.hasMore$;
|
|
16124
16292
|
}
|
|
16293
|
+
/** Observable of the current loading state. */
|
|
16125
16294
|
get loading$() {
|
|
16126
16295
|
return this._statesCollection.loading$;
|
|
16127
16296
|
}
|
|
16297
|
+
/**
|
|
16298
|
+
* Loads the next page of addresses from the server.
|
|
16299
|
+
*
|
|
16300
|
+
* No-op if {@link hasMore$} is `false`. Loading state is observable via {@link loading$}.
|
|
16301
|
+
* New addresses are appended to {@link addresses$} when the page loads.
|
|
16302
|
+
*/
|
|
16128
16303
|
loadMore() {
|
|
16129
16304
|
if (this._statesCollection.hasMore) this._statesCollection.loadMore();
|
|
16130
16305
|
}
|
|
16306
|
+
/**
|
|
16307
|
+
* Returns a reactive observable for a specific address by ID.
|
|
16308
|
+
* @param id - The address ID to observe.
|
|
16309
|
+
* @returns An observable of the address, or `undefined` if not found.
|
|
16310
|
+
*/
|
|
16131
16311
|
get$(id) {
|
|
16132
16312
|
if (!this._observableRegistry.has(id)) this.addNewAddress(id);
|
|
16133
16313
|
return this._observableRegistry.get(id);
|
|
16134
16314
|
}
|
|
16315
|
+
/**
|
|
16316
|
+
* Returns an address by ID from the local cache.
|
|
16317
|
+
* @param addressId - The address ID to look up.
|
|
16318
|
+
* @returns The address, or `undefined` if not found.
|
|
16319
|
+
*/
|
|
16135
16320
|
get(addressId) {
|
|
16136
16321
|
return this._addressesInstances.get(addressId);
|
|
16137
16322
|
}
|
|
16323
|
+
/**
|
|
16324
|
+
* Finds an address ID by its resource name (URI).
|
|
16325
|
+
*
|
|
16326
|
+
* Searches locally loaded addresses first, then queries the server if not found.
|
|
16327
|
+
* The resource name is the {@link Address.name} identifier, distinct from display name.
|
|
16328
|
+
*
|
|
16329
|
+
* @param name - The resource name to search for (exact match, e.g. `'/public/conference'`).
|
|
16330
|
+
* @returns The address ID, or `undefined` if no match is found locally or on server.
|
|
16331
|
+
*/
|
|
16138
16332
|
async findAddressIdByURI(name) {
|
|
16139
16333
|
let addressId = this._addressesInstances.values().find((addr) => addr.name === name)?.id;
|
|
16140
16334
|
if (!addressId) {
|
|
@@ -16569,6 +16763,12 @@ const buildOptionsFromDestination = (destination) => {
|
|
|
16569
16763
|
* ```
|
|
16570
16764
|
*/
|
|
16571
16765
|
var SignalWire = class extends Destroyable {
|
|
16766
|
+
/**
|
|
16767
|
+
* Creates a new SignalWire client and begins connecting.
|
|
16768
|
+
*
|
|
16769
|
+
* @param credentialProvider - Provider that supplies authentication credentials.
|
|
16770
|
+
* @param options - Configuration options (connection, device monitoring, preferences).
|
|
16771
|
+
*/
|
|
16572
16772
|
constructor(credentialProvider, options = {}) {
|
|
16573
16773
|
super();
|
|
16574
16774
|
this.preferences = new ClientPreferences();
|
|
@@ -16802,7 +17002,12 @@ var SignalWire = class extends Destroyable {
|
|
|
16802
17002
|
get errors$() {
|
|
16803
17003
|
return this.deferEmission(this._errors$.asObservable());
|
|
16804
17004
|
}
|
|
16805
|
-
/**
|
|
17005
|
+
/**
|
|
17006
|
+
* Disconnects the WebSocket and tears down the current session.
|
|
17007
|
+
*
|
|
17008
|
+
* The client can be reconnected by calling {@link connect} again,
|
|
17009
|
+
* which creates a fresh transport and session.
|
|
17010
|
+
*/
|
|
16806
17011
|
async disconnect() {
|
|
16807
17012
|
await this._clientSession.disconnect();
|
|
16808
17013
|
this._clientSession.destroy();
|
|
@@ -16811,7 +17016,14 @@ var SignalWire = class extends Destroyable {
|
|
|
16811
17016
|
async waitAuthentication() {
|
|
16812
17017
|
await (0, import_cjs.firstValueFrom)(this.ready$.pipe((0, import_cjs.filter)((ready$1) => ready$1 === true)));
|
|
16813
17018
|
}
|
|
16814
|
-
/**
|
|
17019
|
+
/**
|
|
17020
|
+
* Registers the subscriber as online to receive inbound calls and events.
|
|
17021
|
+
*
|
|
17022
|
+
* Waits for authentication to complete before sending the registration.
|
|
17023
|
+
* If the initial attempt fails, reauthentication is attempted automatically.
|
|
17024
|
+
*
|
|
17025
|
+
* @throws {InvalidCredentialsError} If registration and reauthentication both fail.
|
|
17026
|
+
*/
|
|
16815
17027
|
async register() {
|
|
16816
17028
|
try {
|
|
16817
17029
|
await this.waitAuthentication();
|
|
@@ -16839,7 +17051,11 @@ var SignalWire = class extends Destroyable {
|
|
|
16839
17051
|
throw error;
|
|
16840
17052
|
}
|
|
16841
17053
|
}
|
|
16842
|
-
/**
|
|
17054
|
+
/**
|
|
17055
|
+
* Unregisters the subscriber, going offline for inbound calls.
|
|
17056
|
+
*
|
|
17057
|
+
* The WebSocket connection remains open; use {@link disconnect} to fully close it.
|
|
17058
|
+
*/
|
|
16843
17059
|
async unregister() {
|
|
16844
17060
|
try {
|
|
16845
17061
|
await this._transport.execute(RPCExecute({
|
|
@@ -16855,9 +17071,27 @@ var SignalWire = class extends Destroyable {
|
|
|
16855
17071
|
}
|
|
16856
17072
|
/**
|
|
16857
17073
|
* Places an outbound call to the given destination.
|
|
16858
|
-
*
|
|
16859
|
-
*
|
|
17074
|
+
*
|
|
17075
|
+
* Waits for authentication before dialing. Media options are merged from
|
|
17076
|
+
* saved preferences, destination query parameters (e.g. `?channel=video`),
|
|
17077
|
+
* and the provided `options` (highest priority).
|
|
17078
|
+
*
|
|
17079
|
+
* Returns a {@link Call} in `'ringing'` state. Subscribe to {@link Call.status$}
|
|
17080
|
+
* to track progression through `'connected'` → `'disconnected'`.
|
|
17081
|
+
*
|
|
17082
|
+
* @param destination - Address URI string (e.g. `'/public/my-room'`) or {@link Address} instance.
|
|
17083
|
+
* @param options - Media and dial options (audio/video, device constraints). Overrides defaults.
|
|
16860
17084
|
* @returns The created {@link Call} instance.
|
|
17085
|
+
* @throws {Error} If authentication is not complete or call creation fails.
|
|
17086
|
+
*
|
|
17087
|
+
* @example
|
|
17088
|
+
* ```ts
|
|
17089
|
+
* const call = await client.dial('/public/conference', {
|
|
17090
|
+
* audio: true,
|
|
17091
|
+
* video: true,
|
|
17092
|
+
* });
|
|
17093
|
+
* call.status$.subscribe(status => console.log('Call:', status));
|
|
17094
|
+
* ```
|
|
16861
17095
|
*/
|
|
16862
17096
|
async dial(destination, options = {}) {
|
|
16863
17097
|
const computed_options = {
|
|
@@ -16953,12 +17187,23 @@ var SignalWire = class extends Destroyable {
|
|
|
16953
17187
|
disableDeviceMonitoring() {
|
|
16954
17188
|
this._deviceController.disableDeviceMonitoring();
|
|
16955
17189
|
}
|
|
17190
|
+
/**
|
|
17191
|
+
* Returns the capabilities of a media device.
|
|
17192
|
+
* @param deviceInfo - The device to query.
|
|
17193
|
+
* @returns The device capabilities, or `null` if unavailable.
|
|
17194
|
+
*/
|
|
16956
17195
|
async getDeviceCapabilities(deviceInfo) {
|
|
16957
17196
|
return this._deviceController.getDeviceCapabilities(deviceInfo);
|
|
16958
17197
|
}
|
|
17198
|
+
/**
|
|
17199
|
+
* Checks whether a device is still available and usable.
|
|
17200
|
+
* @param deviceInfo - The device to validate, or `null`.
|
|
17201
|
+
* @returns `true` if the device is valid and available. Returns `false` for `null`, audio output devices, or unavailable devices.
|
|
17202
|
+
*/
|
|
16959
17203
|
async isValidDevice(deviceInfo) {
|
|
16960
17204
|
return this._deviceController.isValidDevice(deviceInfo);
|
|
16961
17205
|
}
|
|
17206
|
+
/** Destroys the client, clearing timers and releasing all resources. */
|
|
16962
17207
|
destroy() {
|
|
16963
17208
|
if (this._refreshTimerId) {
|
|
16964
17209
|
clearTimeout(this._refreshTimerId);
|
|
@@ -16971,6 +17216,7 @@ var SignalWire = class extends Destroyable {
|
|
|
16971
17216
|
//#endregion
|
|
16972
17217
|
//#region src/dependencies/EmbedTokenCredentialProvider.ts
|
|
16973
17218
|
const logger = getLogger();
|
|
17219
|
+
/** Credential provider that exchanges an embed token for a SAT via the host's token endpoint. */
|
|
16974
17220
|
var EmbedTokenCredentialProvider = class {
|
|
16975
17221
|
constructor(host, embedToken) {
|
|
16976
17222
|
this.host = host;
|