@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/index.cjs
CHANGED
|
@@ -799,6 +799,7 @@ var NavigatorDeviceController = class extends Destroyable {
|
|
|
799
799
|
|
|
800
800
|
//#endregion
|
|
801
801
|
//#region src/dependencies/DefaultLocalStorage.ts
|
|
802
|
+
/** Default storage implementation backed by browser `localStorage` and `sessionStorage`. */
|
|
802
803
|
var DefaultLocalStorage = class {
|
|
803
804
|
constructor() {
|
|
804
805
|
if (typeof localStorage === "undefined") throw new require_operators.StorageNotAvailableError("localStorage");
|
|
@@ -1676,54 +1677,71 @@ var Participant = class extends Destroyable {
|
|
|
1676
1677
|
get type() {
|
|
1677
1678
|
return this._state$.value.type;
|
|
1678
1679
|
}
|
|
1680
|
+
/** Whether the participant has raised their hand. */
|
|
1679
1681
|
get handraised() {
|
|
1680
1682
|
return this._state$.value.handraised ?? false;
|
|
1681
1683
|
}
|
|
1684
|
+
/** Whether the participant is visible in the layout. */
|
|
1682
1685
|
get visible() {
|
|
1683
1686
|
return this._state$.value.visible ?? false;
|
|
1684
1687
|
}
|
|
1688
|
+
/** Whether the participant's audio is muted. */
|
|
1685
1689
|
get audioMuted() {
|
|
1686
1690
|
return this._state$.value.audio_muted ?? false;
|
|
1687
1691
|
}
|
|
1692
|
+
/** Whether the participant's video is muted. */
|
|
1688
1693
|
get videoMuted() {
|
|
1689
1694
|
return this._state$.value.video_muted ?? false;
|
|
1690
1695
|
}
|
|
1696
|
+
/** Whether the participant is deafened (incoming audio muted). */
|
|
1691
1697
|
get deaf() {
|
|
1692
1698
|
return this._state$.value.deaf ?? false;
|
|
1693
1699
|
}
|
|
1700
|
+
/** Current microphone input volume level, or `undefined` if not set. */
|
|
1694
1701
|
get inputVolume() {
|
|
1695
1702
|
return this._state$.value.input_volume;
|
|
1696
1703
|
}
|
|
1704
|
+
/** Current speaker output volume level, or `undefined` if not set. */
|
|
1697
1705
|
get outputVolume() {
|
|
1698
1706
|
return this._state$.value.output_volume;
|
|
1699
1707
|
}
|
|
1708
|
+
/** Current microphone input sensitivity level, or `undefined` if not set. */
|
|
1700
1709
|
get inputSensitivity() {
|
|
1701
1710
|
return this._state$.value.input_sensitivity;
|
|
1702
1711
|
}
|
|
1712
|
+
/** Whether echo cancellation is enabled. */
|
|
1703
1713
|
get echoCancellation() {
|
|
1704
1714
|
return this._state$.value.echo_cancellation ?? false;
|
|
1705
1715
|
}
|
|
1716
|
+
/** Whether automatic gain control is enabled. */
|
|
1706
1717
|
get autoGain() {
|
|
1707
1718
|
return this._state$.value.auto_gain ?? false;
|
|
1708
1719
|
}
|
|
1720
|
+
/** Whether noise suppression is enabled. */
|
|
1709
1721
|
get noiseSuppression() {
|
|
1710
1722
|
return this._state$.value.noise_suppression ?? false;
|
|
1711
1723
|
}
|
|
1724
|
+
/** Whether low-bitrate mode is active. */
|
|
1712
1725
|
get lowbitrate() {
|
|
1713
1726
|
return this._state$.value.lowbitrate ?? false;
|
|
1714
1727
|
}
|
|
1728
|
+
/** Whether noise reduction (denoise) is active. */
|
|
1715
1729
|
get denoise() {
|
|
1716
1730
|
return this._state$.value.denoise ?? false;
|
|
1717
1731
|
}
|
|
1732
|
+
/** Custom metadata for this participant, or `undefined` if not set. */
|
|
1718
1733
|
get meta() {
|
|
1719
1734
|
return this._state$.value.meta;
|
|
1720
1735
|
}
|
|
1736
|
+
/** Subscriber ID of this participant, or `undefined` if not available. */
|
|
1721
1737
|
get subscriberId() {
|
|
1722
1738
|
return this._state$.value.subscriber_id;
|
|
1723
1739
|
}
|
|
1740
|
+
/** Address ID of this participant, or `undefined` if not available. */
|
|
1724
1741
|
get addressId() {
|
|
1725
1742
|
return this._state$.value.address_id;
|
|
1726
1743
|
}
|
|
1744
|
+
/** Server node ID for this participant, or `undefined` if not available. */
|
|
1727
1745
|
get nodeId() {
|
|
1728
1746
|
return this._state$.value.node_id;
|
|
1729
1747
|
}
|
|
@@ -1795,15 +1813,24 @@ var Participant = class extends Destroyable {
|
|
|
1795
1813
|
async setAudioInputSensitivity(value) {
|
|
1796
1814
|
await this.executeMethod(this.id, "call.microphone.sensitivity.set", { sensitivity: value });
|
|
1797
1815
|
}
|
|
1798
|
-
/**
|
|
1816
|
+
/**
|
|
1817
|
+
* Sets the microphone input volume level.
|
|
1818
|
+
* @param value - Volume level (0-100).
|
|
1819
|
+
*/
|
|
1799
1820
|
async setAudioInputVolume(value) {
|
|
1800
1821
|
await this.executeMethod(this.id, "call.microphone.volume.set", { volume: value });
|
|
1801
1822
|
}
|
|
1802
|
-
/**
|
|
1823
|
+
/**
|
|
1824
|
+
* Sets the speaker output volume level.
|
|
1825
|
+
* @param value - Volume level (0-100).
|
|
1826
|
+
*/
|
|
1803
1827
|
async setAudioOutputVolume(value) {
|
|
1804
1828
|
await this.executeMethod(this.id, "call.speaker.volume.set", { volume: value });
|
|
1805
1829
|
}
|
|
1806
|
-
/**
|
|
1830
|
+
/**
|
|
1831
|
+
* Sets the participant's position in the video layout.
|
|
1832
|
+
* @param value - The {@link VideoPosition} to assign (e.g. `'auto'`, `'reserved-0'`).
|
|
1833
|
+
*/
|
|
1807
1834
|
async setPosition(value) {
|
|
1808
1835
|
await this.executeMethod(this.id, "call.member.position.set", { position: value });
|
|
1809
1836
|
}
|
|
@@ -1821,12 +1848,23 @@ var Participant = class extends Destroyable {
|
|
|
1821
1848
|
async end() {
|
|
1822
1849
|
await this.executeMethod(this.id, "call.end", {});
|
|
1823
1850
|
}
|
|
1851
|
+
/**
|
|
1852
|
+
* Replaces custom metadata for this participant.
|
|
1853
|
+
* @param _meta - Metadata object to set.
|
|
1854
|
+
* @throws {UnimplementedError} Not yet implemented.
|
|
1855
|
+
*/
|
|
1824
1856
|
async setMeta(_meta) {
|
|
1825
1857
|
throw new require_operators.UnimplementedError();
|
|
1826
1858
|
}
|
|
1859
|
+
/**
|
|
1860
|
+
* Merges values into custom metadata (unlike {@link setMeta} which replaces).
|
|
1861
|
+
* @param _meta - Metadata to merge.
|
|
1862
|
+
* @throws {UnimplementedError} Not yet implemented.
|
|
1863
|
+
*/
|
|
1827
1864
|
async updateMeta(_meta) {
|
|
1828
1865
|
throw new require_operators.UnimplementedError();
|
|
1829
1866
|
}
|
|
1867
|
+
/** Destroys the participant, releasing all subscriptions and references. */
|
|
1830
1868
|
destroy() {
|
|
1831
1869
|
this.executeMethod = void 0;
|
|
1832
1870
|
super.destroy();
|
|
@@ -1839,6 +1877,7 @@ var Participant = class extends Destroyable {
|
|
|
1839
1877
|
* and local media stream management.
|
|
1840
1878
|
*/
|
|
1841
1879
|
var SelfParticipant = class extends Participant {
|
|
1880
|
+
/** @internal */
|
|
1842
1881
|
constructor(id, executeMethod, vertoManager, deviceController) {
|
|
1843
1882
|
super(id, executeMethod, deviceController);
|
|
1844
1883
|
this.vertoManager = vertoManager;
|
|
@@ -1929,6 +1968,7 @@ var SelfParticipant = class extends Participant {
|
|
|
1929
1968
|
this.deviceController.selectAudioOutputDevice(device);
|
|
1930
1969
|
if (options.savePreference) PreferencesContainer.instance.preferredAudioOutput = device;
|
|
1931
1970
|
}
|
|
1971
|
+
/** Mutes local audio. Falls back to local device mute if the server RPC fails. */
|
|
1932
1972
|
async mute() {
|
|
1933
1973
|
try {
|
|
1934
1974
|
await super.mute();
|
|
@@ -1938,6 +1978,7 @@ var SelfParticipant = class extends Participant {
|
|
|
1938
1978
|
this.vertoManager.muteMainAudioInputDevice();
|
|
1939
1979
|
}
|
|
1940
1980
|
}
|
|
1981
|
+
/** Unmutes local audio. Falls back to local device unmute if the server RPC fails. */
|
|
1941
1982
|
async unmute() {
|
|
1942
1983
|
try {
|
|
1943
1984
|
await super.unmute();
|
|
@@ -1947,6 +1988,7 @@ var SelfParticipant = class extends Participant {
|
|
|
1947
1988
|
await this.vertoManager.unmuteMainAudioInputDevice();
|
|
1948
1989
|
}
|
|
1949
1990
|
}
|
|
1991
|
+
/** Mutes local video. Falls back to local device mute if the server RPC fails. */
|
|
1950
1992
|
async muteVideo() {
|
|
1951
1993
|
try {
|
|
1952
1994
|
await super.muteVideo();
|
|
@@ -1956,6 +1998,7 @@ var SelfParticipant = class extends Participant {
|
|
|
1956
1998
|
this.vertoManager.muteMainVideoInputDevice();
|
|
1957
1999
|
}
|
|
1958
2000
|
}
|
|
2001
|
+
/** Unmutes local video. Falls back to local device unmute if the server RPC fails. */
|
|
1959
2002
|
async unmuteVideo() {
|
|
1960
2003
|
try {
|
|
1961
2004
|
await super.unmuteVideo();
|
|
@@ -4099,7 +4142,7 @@ var WebRTCVertoManager = class extends VertoManager {
|
|
|
4099
4142
|
*
|
|
4100
4143
|
* @see selectAudioInputDevice
|
|
4101
4144
|
* @see selectVideoInputDevice
|
|
4102
|
-
* @param options
|
|
4145
|
+
* @param options - Media options specifying which input devices to add (defaults to audio only).
|
|
4103
4146
|
*/
|
|
4104
4147
|
async addMainInputDevices(options = { audio: true }) {
|
|
4105
4148
|
let deviceKind = void 0;
|
|
@@ -4183,7 +4226,7 @@ var WebRTCVertoManager = class extends VertoManager {
|
|
|
4183
4226
|
try {
|
|
4184
4227
|
const causeParams = cause ? {
|
|
4185
4228
|
cause,
|
|
4186
|
-
|
|
4229
|
+
causeCode: VertoByeCauseCodes[cause]
|
|
4187
4230
|
} : {};
|
|
4188
4231
|
await this.executeVerto(VertoBye({
|
|
4189
4232
|
...causeParams,
|
|
@@ -4381,24 +4424,42 @@ var WebRTCCall = class extends Destroyable {
|
|
|
4381
4424
|
get self() {
|
|
4382
4425
|
return this.callEventsManager.self;
|
|
4383
4426
|
}
|
|
4427
|
+
/** Toggles the call lock state, preventing or allowing new participants from joining. */
|
|
4384
4428
|
async toggleLock() {
|
|
4385
4429
|
const method = this.locked ? "call.unlock" : "call.lock";
|
|
4386
4430
|
await this.executeMethod(this.selfId ?? "", method, {});
|
|
4387
4431
|
}
|
|
4432
|
+
/**
|
|
4433
|
+
* Toggles the hold state of the call (pauses/resumes local media transmission).
|
|
4434
|
+
*
|
|
4435
|
+
* Distinct from {@link Participant.toggleMute} which mutes individual tracks.
|
|
4436
|
+
*/
|
|
4388
4437
|
async toggleHold() {
|
|
4389
4438
|
if (this._holdState) await this.vertoManager.unhold();
|
|
4390
4439
|
else await this.vertoManager.hold();
|
|
4391
4440
|
this._holdState = !this._holdState;
|
|
4392
4441
|
}
|
|
4442
|
+
/** @throws {UnimplementedError} Not yet implemented. Status tracked via {@link recording$}. */
|
|
4393
4443
|
async startRecording() {
|
|
4394
4444
|
throw new require_operators.UnimplementedError();
|
|
4395
4445
|
}
|
|
4446
|
+
/** @throws {UnimplementedError} Not yet implemented. Status tracked via {@link streaming$}. */
|
|
4396
4447
|
async startStreaming() {
|
|
4397
4448
|
throw new require_operators.UnimplementedError();
|
|
4398
4449
|
}
|
|
4450
|
+
/**
|
|
4451
|
+
* Replaces the call's custom metadata.
|
|
4452
|
+
* @param _meta - Metadata object to set.
|
|
4453
|
+
* @throws {UnimplementedError} Not yet implemented.
|
|
4454
|
+
*/
|
|
4399
4455
|
async setMeta(_meta) {
|
|
4400
4456
|
throw new require_operators.UnimplementedError();
|
|
4401
4457
|
}
|
|
4458
|
+
/**
|
|
4459
|
+
* Merges values into the call's custom metadata (unlike {@link setMeta} which replaces).
|
|
4460
|
+
* @param _meta - Metadata to merge.
|
|
4461
|
+
* @throws {UnimplementedError} Not yet implemented.
|
|
4462
|
+
*/
|
|
4402
4463
|
async updateMeta(_meta) {
|
|
4403
4464
|
throw new require_operators.UnimplementedError();
|
|
4404
4465
|
}
|
|
@@ -4410,7 +4471,17 @@ var WebRTCCall = class extends Destroyable {
|
|
|
4410
4471
|
get layoutLayers() {
|
|
4411
4472
|
return this.callEventsManager.layoutLayers;
|
|
4412
4473
|
}
|
|
4413
|
-
/**
|
|
4474
|
+
/**
|
|
4475
|
+
* Executes a Verto RPC method targeting a specific participant.
|
|
4476
|
+
*
|
|
4477
|
+
* Constructs call context (node_id, call_id, member_id) and sends the RPC request.
|
|
4478
|
+
*
|
|
4479
|
+
* @param target - Target member ID string, or a {@link MemberTarget} object.
|
|
4480
|
+
* @param method - Verto method name (e.g. `'call.mute'`, `'call.member.remove'`).
|
|
4481
|
+
* @param args - Parameters for the RPC method.
|
|
4482
|
+
* @returns The RPC response.
|
|
4483
|
+
* @throws {JSONRPCError} If the RPC call returns an error.
|
|
4484
|
+
*/
|
|
4414
4485
|
async executeMethod(target, method, args) {
|
|
4415
4486
|
const params = this.buildMethodParams(target, args);
|
|
4416
4487
|
const request = buildRPCRequest({
|
|
@@ -4572,7 +4643,16 @@ var WebRTCCall = class extends Destroyable {
|
|
|
4572
4643
|
get participantsId$() {
|
|
4573
4644
|
return this.cachedObservable("participantsId$", () => this.participants$.pipe((0, rxjs.map)((participants) => participants.map((participant) => participant.id))));
|
|
4574
4645
|
}
|
|
4575
|
-
/**
|
|
4646
|
+
/**
|
|
4647
|
+
* Executes a raw JSON-RPC request on the client session.
|
|
4648
|
+
*
|
|
4649
|
+
* Lower-level than {@link executeMethod} — allows full control over the RPC request structure.
|
|
4650
|
+
*
|
|
4651
|
+
* @param request - Complete JSON-RPC request object.
|
|
4652
|
+
* @param options - Optional RPC execution options (timeout, etc.).
|
|
4653
|
+
* @returns The RPC response.
|
|
4654
|
+
* @throws {JSONRPCError} If the RPC call returns an error response.
|
|
4655
|
+
*/
|
|
4576
4656
|
async execute(request, options) {
|
|
4577
4657
|
return this.clientSession.execute(request, options);
|
|
4578
4658
|
}
|
|
@@ -4611,11 +4691,11 @@ var WebRTCCall = class extends Destroyable {
|
|
|
4611
4691
|
get callUpdated$() {
|
|
4612
4692
|
return this.publicCachedObservable("callUpdated$", () => this.callSessionEvents$.pipe(require_operators.filterAs(isCallUpdatedMetadata, "params"), (0, rxjs.takeUntil)(this.destroyed$)));
|
|
4613
4693
|
}
|
|
4614
|
-
/** Observable of member-joined events. */
|
|
4694
|
+
/** Observable of member-joined events, emitted when a remote participant joins the call. */
|
|
4615
4695
|
get memberJoined$() {
|
|
4616
4696
|
return this.publicCachedObservable("memberJoined$", () => this.callSessionEvents$.pipe(require_operators.filterAs(isMemberJoinedMetadata, "params"), (0, rxjs.takeUntil)(this.destroyed$)));
|
|
4617
4697
|
}
|
|
4618
|
-
/** Observable of member-left events. */
|
|
4698
|
+
/** Observable of member-left events, emitted when a participant leaves the call. */
|
|
4619
4699
|
get memberLeft$() {
|
|
4620
4700
|
return this.publicCachedObservable("memberLeft$", () => this.callSessionEvents$.pipe(require_operators.filterAs(isMemberLeftMetadata, "params"), (0, rxjs.takeUntil)(this.destroyed$)));
|
|
4621
4701
|
}
|
|
@@ -4655,7 +4735,17 @@ var WebRTCCall = class extends Destroyable {
|
|
|
4655
4735
|
get layoutEvent$() {
|
|
4656
4736
|
return this.cachedObservable("layoutEvent$", () => this.callEvent$.pipe(require_operators.filterAs(isLayoutChangedMetadata, "params")));
|
|
4657
4737
|
}
|
|
4658
|
-
/**
|
|
4738
|
+
/**
|
|
4739
|
+
* Hangs up the call and releases all resources.
|
|
4740
|
+
*
|
|
4741
|
+
* Sends a Verto `bye` to the server, transitions status to `'disconnecting'`,
|
|
4742
|
+
* then destroys the call. After this, the call instance is no longer usable.
|
|
4743
|
+
*
|
|
4744
|
+
* @example
|
|
4745
|
+
* ```ts
|
|
4746
|
+
* await call.hangup();
|
|
4747
|
+
* ```
|
|
4748
|
+
*/
|
|
4659
4749
|
async hangup() {
|
|
4660
4750
|
this._status$.next("disconnecting");
|
|
4661
4751
|
try {
|
|
@@ -4664,11 +4754,35 @@ var WebRTCCall = class extends Destroyable {
|
|
|
4664
4754
|
this.destroy();
|
|
4665
4755
|
}
|
|
4666
4756
|
}
|
|
4667
|
-
/**
|
|
4757
|
+
/**
|
|
4758
|
+
* Sends DTMF digits on the call.
|
|
4759
|
+
*
|
|
4760
|
+
* @param dtmf - The digit string to send (e.g. `'1234#'`).
|
|
4761
|
+
*
|
|
4762
|
+
* @example
|
|
4763
|
+
* ```ts
|
|
4764
|
+
* await call.sendDigits('1234#');
|
|
4765
|
+
* ```
|
|
4766
|
+
*/
|
|
4668
4767
|
async sendDigits(dtmf) {
|
|
4669
4768
|
return this.vertoManager.sendDigits(dtmf);
|
|
4670
4769
|
}
|
|
4671
|
-
/**
|
|
4770
|
+
/**
|
|
4771
|
+
* Accepts an inbound call, optionally overriding media options for the answer.
|
|
4772
|
+
*
|
|
4773
|
+
* @param options - Optional media constraints for the answer (audio/video).
|
|
4774
|
+
*
|
|
4775
|
+
* @example
|
|
4776
|
+
* ```ts
|
|
4777
|
+
* // Accept with defaults
|
|
4778
|
+
* call.answer();
|
|
4779
|
+
*
|
|
4780
|
+
* // Accept audio-only
|
|
4781
|
+
* call.answer({ audio: true, video: false });
|
|
4782
|
+
* ```
|
|
4783
|
+
* @see {@link reject} to decline the call instead.
|
|
4784
|
+
* @see {@link answered$} to observe the acceptance state.
|
|
4785
|
+
*/
|
|
4672
4786
|
answer(options) {
|
|
4673
4787
|
this._answerMediaOptions = options;
|
|
4674
4788
|
this._answered$.next(true);
|
|
@@ -4677,7 +4791,12 @@ var WebRTCCall = class extends Destroyable {
|
|
|
4677
4791
|
get answerMediaOptions() {
|
|
4678
4792
|
return this._answerMediaOptions;
|
|
4679
4793
|
}
|
|
4680
|
-
/**
|
|
4794
|
+
/**
|
|
4795
|
+
* Rejects an inbound call, preventing media negotiation.
|
|
4796
|
+
*
|
|
4797
|
+
* @see {@link answer} to accept the call instead.
|
|
4798
|
+
* @see {@link answered$} to observe the rejection state.
|
|
4799
|
+
*/
|
|
4681
4800
|
reject() {
|
|
4682
4801
|
this._answered$.next(false);
|
|
4683
4802
|
}
|
|
@@ -4687,8 +4806,17 @@ var WebRTCCall = class extends Destroyable {
|
|
|
4687
4806
|
}
|
|
4688
4807
|
/**
|
|
4689
4808
|
* Sets the call layout and participant positions.
|
|
4809
|
+
*
|
|
4690
4810
|
* @param layout - Layout name (must be one of {@link layouts}).
|
|
4691
|
-
* @param positions - Map of member IDs to
|
|
4811
|
+
* @param positions - Map of member IDs to {@link VideoPosition} values.
|
|
4812
|
+
* @throws {InvalidParams} If the layout is not in the available {@link layouts}.
|
|
4813
|
+
*
|
|
4814
|
+
* @example
|
|
4815
|
+
* ```ts
|
|
4816
|
+
* await call.setLayout('grid-responsive', {
|
|
4817
|
+
* [participantId]: 'reserved-0',
|
|
4818
|
+
* });
|
|
4819
|
+
* ```
|
|
4692
4820
|
*/
|
|
4693
4821
|
async setLayout(layout, positions) {
|
|
4694
4822
|
if (!this.layouts.includes(layout)) throw new require_operators.InvalidParams(`Layout ${layout} is not available in the current call layouts: ${this.layouts.join(", ")}`);
|
|
@@ -4698,7 +4826,12 @@ var WebRTCCall = class extends Destroyable {
|
|
|
4698
4826
|
positions
|
|
4699
4827
|
});
|
|
4700
4828
|
}
|
|
4701
|
-
/**
|
|
4829
|
+
/**
|
|
4830
|
+
* Transfers the call to another destination.
|
|
4831
|
+
*
|
|
4832
|
+
* @param options - Transfer configuration including the target destination.
|
|
4833
|
+
* @see {@link status$} to observe the transfer progress.
|
|
4834
|
+
*/
|
|
4702
4835
|
async transfer(options) {
|
|
4703
4836
|
return this.vertoManager.transfer(options);
|
|
4704
4837
|
}
|
|
@@ -5057,11 +5190,28 @@ var Address = class extends Destroyable {
|
|
|
5057
5190
|
get locked$() {
|
|
5058
5191
|
return this.cachedObservable("locked$", () => this._state$.pipe(require_operators.filterNull(), (0, rxjs.shareReplay)(1), (0, rxjs.map)((state) => state.locked), (0, rxjs.takeUntil)(this.destroyed$)));
|
|
5059
5192
|
}
|
|
5060
|
-
/**
|
|
5193
|
+
/**
|
|
5194
|
+
* Sends a text message to this address.
|
|
5195
|
+
*
|
|
5196
|
+
* @param text - The message text to send.
|
|
5197
|
+
*
|
|
5198
|
+
* @example
|
|
5199
|
+
* ```ts
|
|
5200
|
+
* await address.sendText('Hello!');
|
|
5201
|
+
* ```
|
|
5202
|
+
*/
|
|
5061
5203
|
async sendText(text) {
|
|
5062
5204
|
return this.conversationManager.sendText(text, this.id);
|
|
5063
5205
|
}
|
|
5064
|
-
/**
|
|
5206
|
+
/**
|
|
5207
|
+
* Collection of text messages for this address, with pagination support.
|
|
5208
|
+
*
|
|
5209
|
+
* Returns `undefined` until {@link textMessages$} has been subscribed to (lazy-loaded).
|
|
5210
|
+
* Filters to `'chat'` subtype messages from the conversation.
|
|
5211
|
+
*
|
|
5212
|
+
* @see {@link textMessages$} to trigger lazy loading.
|
|
5213
|
+
* @see {@link sendText} to send a new message.
|
|
5214
|
+
*/
|
|
5065
5215
|
get textMessage() {
|
|
5066
5216
|
if (!this._conversationMessages) return;
|
|
5067
5217
|
this._textMessages$ = this._textMessages$ ?? new EntityCollectionTransformed(this._conversationMessages, (item) => item.subtype === "chat", (item) => ({
|
|
@@ -5072,7 +5222,14 @@ var Address = class extends Destroyable {
|
|
|
5072
5222
|
}));
|
|
5073
5223
|
return this._textMessages$;
|
|
5074
5224
|
}
|
|
5075
|
-
/**
|
|
5225
|
+
/**
|
|
5226
|
+
* Collection of call history entries for this address, with pagination support.
|
|
5227
|
+
*
|
|
5228
|
+
* Returns `undefined` until {@link history$} has been subscribed to (lazy-loaded).
|
|
5229
|
+
* Filters to `'log'` subtype messages including kind, status, start/end times.
|
|
5230
|
+
*
|
|
5231
|
+
* @see {@link history$} to trigger lazy loading.
|
|
5232
|
+
*/
|
|
5076
5233
|
get history() {
|
|
5077
5234
|
if (!this._conversationMessages) return;
|
|
5078
5235
|
this._history$ = this._history$ ?? new EntityCollectionTransformed(this._conversationMessages, (item) => item.subtype === "log", (item) => ({
|
|
@@ -5657,11 +5814,18 @@ var AddressFetcher = class extends Fetcher {
|
|
|
5657
5814
|
logger$4.error("Failed to fetch addresses");
|
|
5658
5815
|
}
|
|
5659
5816
|
};
|
|
5817
|
+
/** Collection of address states with reactive updates and pagination. */
|
|
5660
5818
|
var AddressStateCollection = class extends EntityCollection {
|
|
5661
5819
|
constructor(update$, http, onError) {
|
|
5662
5820
|
super(new AddressFetcher(http), update$, onError);
|
|
5663
5821
|
}
|
|
5664
5822
|
};
|
|
5823
|
+
/**
|
|
5824
|
+
* Manages the directory of {@link Address} entries with paginated loading.
|
|
5825
|
+
*
|
|
5826
|
+
* Implements the {@link Directory} interface and provides reactive access to
|
|
5827
|
+
* addresses via observables, along with pagination and lookup methods.
|
|
5828
|
+
*/
|
|
5665
5829
|
var DirectoryManager = class extends Destroyable {
|
|
5666
5830
|
constructor(http, clientSession, conversationManager, onError) {
|
|
5667
5831
|
super();
|
|
@@ -5686,6 +5850,7 @@ var DirectoryManager = class extends Destroyable {
|
|
|
5686
5850
|
this._statesCollection = new AddressStateCollection(clientSession.signalingEvent$.pipe(require_operators.filterAs(isConversationMessageUpdatedMetadata, "params"), (0, rxjs.map)((_) => ({}))), this.http, this.onError);
|
|
5687
5851
|
this.initSubscriptions();
|
|
5688
5852
|
}
|
|
5853
|
+
/** Whether addresses are currently being loaded from the server. */
|
|
5689
5854
|
get loading() {
|
|
5690
5855
|
return this._statesCollection.loading;
|
|
5691
5856
|
}
|
|
@@ -5699,28 +5864,57 @@ var DirectoryManager = class extends Destroyable {
|
|
|
5699
5864
|
}
|
|
5700
5865
|
});
|
|
5701
5866
|
}
|
|
5867
|
+
/** Observable stream of all addresses in the directory. */
|
|
5702
5868
|
get addresses$() {
|
|
5703
5869
|
return this._addresses$.asObservable();
|
|
5704
5870
|
}
|
|
5871
|
+
/** Current snapshot of all loaded addresses. */
|
|
5705
5872
|
get addresses() {
|
|
5706
5873
|
return this._addresses$.value;
|
|
5707
5874
|
}
|
|
5875
|
+
/** Observable indicating whether more addresses can be loaded. */
|
|
5708
5876
|
get hasMore$() {
|
|
5709
5877
|
return this._statesCollection.hasMore$;
|
|
5710
5878
|
}
|
|
5879
|
+
/** Observable of the current loading state. */
|
|
5711
5880
|
get loading$() {
|
|
5712
5881
|
return this._statesCollection.loading$;
|
|
5713
5882
|
}
|
|
5883
|
+
/**
|
|
5884
|
+
* Loads the next page of addresses from the server.
|
|
5885
|
+
*
|
|
5886
|
+
* No-op if {@link hasMore$} is `false`. Loading state is observable via {@link loading$}.
|
|
5887
|
+
* New addresses are appended to {@link addresses$} when the page loads.
|
|
5888
|
+
*/
|
|
5714
5889
|
loadMore() {
|
|
5715
5890
|
if (this._statesCollection.hasMore) this._statesCollection.loadMore();
|
|
5716
5891
|
}
|
|
5892
|
+
/**
|
|
5893
|
+
* Returns a reactive observable for a specific address by ID.
|
|
5894
|
+
* @param id - The address ID to observe.
|
|
5895
|
+
* @returns An observable of the address, or `undefined` if not found.
|
|
5896
|
+
*/
|
|
5717
5897
|
get$(id) {
|
|
5718
5898
|
if (!this._observableRegistry.has(id)) this.addNewAddress(id);
|
|
5719
5899
|
return this._observableRegistry.get(id);
|
|
5720
5900
|
}
|
|
5901
|
+
/**
|
|
5902
|
+
* Returns an address by ID from the local cache.
|
|
5903
|
+
* @param addressId - The address ID to look up.
|
|
5904
|
+
* @returns The address, or `undefined` if not found.
|
|
5905
|
+
*/
|
|
5721
5906
|
get(addressId) {
|
|
5722
5907
|
return this._addressesInstances.get(addressId);
|
|
5723
5908
|
}
|
|
5909
|
+
/**
|
|
5910
|
+
* Finds an address ID by its resource name (URI).
|
|
5911
|
+
*
|
|
5912
|
+
* Searches locally loaded addresses first, then queries the server if not found.
|
|
5913
|
+
* The resource name is the {@link Address.name} identifier, distinct from display name.
|
|
5914
|
+
*
|
|
5915
|
+
* @param name - The resource name to search for (exact match, e.g. `'/public/conference'`).
|
|
5916
|
+
* @returns The address ID, or `undefined` if no match is found locally or on server.
|
|
5917
|
+
*/
|
|
5724
5918
|
async findAddressIdByURI(name) {
|
|
5725
5919
|
let addressId = this._addressesInstances.values().find((addr) => addr.name === name)?.id;
|
|
5726
5920
|
if (!addressId) {
|
|
@@ -6153,6 +6347,12 @@ const buildOptionsFromDestination = (destination) => {
|
|
|
6153
6347
|
* ```
|
|
6154
6348
|
*/
|
|
6155
6349
|
var SignalWire = class extends Destroyable {
|
|
6350
|
+
/**
|
|
6351
|
+
* Creates a new SignalWire client and begins connecting.
|
|
6352
|
+
*
|
|
6353
|
+
* @param credentialProvider - Provider that supplies authentication credentials.
|
|
6354
|
+
* @param options - Configuration options (connection, device monitoring, preferences).
|
|
6355
|
+
*/
|
|
6156
6356
|
constructor(credentialProvider, options = {}) {
|
|
6157
6357
|
super();
|
|
6158
6358
|
this.preferences = new ClientPreferences();
|
|
@@ -6386,7 +6586,12 @@ var SignalWire = class extends Destroyable {
|
|
|
6386
6586
|
get errors$() {
|
|
6387
6587
|
return this.deferEmission(this._errors$.asObservable());
|
|
6388
6588
|
}
|
|
6389
|
-
/**
|
|
6589
|
+
/**
|
|
6590
|
+
* Disconnects the WebSocket and tears down the current session.
|
|
6591
|
+
*
|
|
6592
|
+
* The client can be reconnected by calling {@link connect} again,
|
|
6593
|
+
* which creates a fresh transport and session.
|
|
6594
|
+
*/
|
|
6390
6595
|
async disconnect() {
|
|
6391
6596
|
await this._clientSession.disconnect();
|
|
6392
6597
|
this._clientSession.destroy();
|
|
@@ -6395,7 +6600,14 @@ var SignalWire = class extends Destroyable {
|
|
|
6395
6600
|
async waitAuthentication() {
|
|
6396
6601
|
await (0, rxjs.firstValueFrom)(this.ready$.pipe((0, rxjs.filter)((ready$1) => ready$1 === true)));
|
|
6397
6602
|
}
|
|
6398
|
-
/**
|
|
6603
|
+
/**
|
|
6604
|
+
* Registers the subscriber as online to receive inbound calls and events.
|
|
6605
|
+
*
|
|
6606
|
+
* Waits for authentication to complete before sending the registration.
|
|
6607
|
+
* If the initial attempt fails, reauthentication is attempted automatically.
|
|
6608
|
+
*
|
|
6609
|
+
* @throws {InvalidCredentialsError} If registration and reauthentication both fail.
|
|
6610
|
+
*/
|
|
6399
6611
|
async register() {
|
|
6400
6612
|
try {
|
|
6401
6613
|
await this.waitAuthentication();
|
|
@@ -6423,7 +6635,11 @@ var SignalWire = class extends Destroyable {
|
|
|
6423
6635
|
throw error;
|
|
6424
6636
|
}
|
|
6425
6637
|
}
|
|
6426
|
-
/**
|
|
6638
|
+
/**
|
|
6639
|
+
* Unregisters the subscriber, going offline for inbound calls.
|
|
6640
|
+
*
|
|
6641
|
+
* The WebSocket connection remains open; use {@link disconnect} to fully close it.
|
|
6642
|
+
*/
|
|
6427
6643
|
async unregister() {
|
|
6428
6644
|
try {
|
|
6429
6645
|
await this._transport.execute(RPCExecute({
|
|
@@ -6439,9 +6655,27 @@ var SignalWire = class extends Destroyable {
|
|
|
6439
6655
|
}
|
|
6440
6656
|
/**
|
|
6441
6657
|
* Places an outbound call to the given destination.
|
|
6442
|
-
*
|
|
6443
|
-
*
|
|
6658
|
+
*
|
|
6659
|
+
* Waits for authentication before dialing. Media options are merged from
|
|
6660
|
+
* saved preferences, destination query parameters (e.g. `?channel=video`),
|
|
6661
|
+
* and the provided `options` (highest priority).
|
|
6662
|
+
*
|
|
6663
|
+
* Returns a {@link Call} in `'ringing'` state. Subscribe to {@link Call.status$}
|
|
6664
|
+
* to track progression through `'connected'` → `'disconnected'`.
|
|
6665
|
+
*
|
|
6666
|
+
* @param destination - Address URI string (e.g. `'/public/my-room'`) or {@link Address} instance.
|
|
6667
|
+
* @param options - Media and dial options (audio/video, device constraints). Overrides defaults.
|
|
6444
6668
|
* @returns The created {@link Call} instance.
|
|
6669
|
+
* @throws {Error} If authentication is not complete or call creation fails.
|
|
6670
|
+
*
|
|
6671
|
+
* @example
|
|
6672
|
+
* ```ts
|
|
6673
|
+
* const call = await client.dial('/public/conference', {
|
|
6674
|
+
* audio: true,
|
|
6675
|
+
* video: true,
|
|
6676
|
+
* });
|
|
6677
|
+
* call.status$.subscribe(status => console.log('Call:', status));
|
|
6678
|
+
* ```
|
|
6445
6679
|
*/
|
|
6446
6680
|
async dial(destination, options = {}) {
|
|
6447
6681
|
const computed_options = {
|
|
@@ -6537,12 +6771,23 @@ var SignalWire = class extends Destroyable {
|
|
|
6537
6771
|
disableDeviceMonitoring() {
|
|
6538
6772
|
this._deviceController.disableDeviceMonitoring();
|
|
6539
6773
|
}
|
|
6774
|
+
/**
|
|
6775
|
+
* Returns the capabilities of a media device.
|
|
6776
|
+
* @param deviceInfo - The device to query.
|
|
6777
|
+
* @returns The device capabilities, or `null` if unavailable.
|
|
6778
|
+
*/
|
|
6540
6779
|
async getDeviceCapabilities(deviceInfo) {
|
|
6541
6780
|
return this._deviceController.getDeviceCapabilities(deviceInfo);
|
|
6542
6781
|
}
|
|
6782
|
+
/**
|
|
6783
|
+
* Checks whether a device is still available and usable.
|
|
6784
|
+
* @param deviceInfo - The device to validate, or `null`.
|
|
6785
|
+
* @returns `true` if the device is valid and available. Returns `false` for `null`, audio output devices, or unavailable devices.
|
|
6786
|
+
*/
|
|
6543
6787
|
async isValidDevice(deviceInfo) {
|
|
6544
6788
|
return this._deviceController.isValidDevice(deviceInfo);
|
|
6545
6789
|
}
|
|
6790
|
+
/** Destroys the client, clearing timers and releasing all resources. */
|
|
6546
6791
|
destroy() {
|
|
6547
6792
|
if (this._refreshTimerId) {
|
|
6548
6793
|
clearTimeout(this._refreshTimerId);
|
|
@@ -6555,6 +6800,7 @@ var SignalWire = class extends Destroyable {
|
|
|
6555
6800
|
//#endregion
|
|
6556
6801
|
//#region src/dependencies/EmbedTokenCredentialProvider.ts
|
|
6557
6802
|
const logger = require_operators.getLogger();
|
|
6803
|
+
/** Credential provider that exchanges an embed token for a SAT via the host's token endpoint. */
|
|
6558
6804
|
var EmbedTokenCredentialProvider = class {
|
|
6559
6805
|
constructor(host, embedToken) {
|
|
6560
6806
|
this.host = host;
|