@signalwire/js 4.0.0-dev-20260428212324 → 4.0.0-dev-20260430003639
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 +119 -82
- package/dist/browser.mjs.map +1 -1
- package/dist/browser.umd.js +119 -82
- package/dist/browser.umd.js.map +1 -1
- package/dist/index.cjs +105 -68
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +50 -48
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +50 -48
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +105 -68
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1743,15 +1743,15 @@ var DependencyContainer = class {
|
|
|
1743
1743
|
this._baseURL = this.apiHost;
|
|
1744
1744
|
this._credential = {};
|
|
1745
1745
|
}
|
|
1746
|
-
get
|
|
1747
|
-
return this.
|
|
1746
|
+
get userId() {
|
|
1747
|
+
return this.user.id;
|
|
1748
1748
|
}
|
|
1749
|
-
get
|
|
1750
|
-
if (!this.
|
|
1751
|
-
return this.
|
|
1749
|
+
get user() {
|
|
1750
|
+
if (!this._user) throw new require_operators.DependencyError("User");
|
|
1751
|
+
return this._user;
|
|
1752
1752
|
}
|
|
1753
|
-
set
|
|
1754
|
-
this.
|
|
1753
|
+
set user(user) {
|
|
1754
|
+
this._user = user;
|
|
1755
1755
|
}
|
|
1756
1756
|
get storage() {
|
|
1757
1757
|
if (!this._storageManager) {
|
|
@@ -1797,16 +1797,16 @@ var DependencyContainer = class {
|
|
|
1797
1797
|
this._deviceController = void 0;
|
|
1798
1798
|
}
|
|
1799
1799
|
get authorizationStateKey() {
|
|
1800
|
-
return `sw:${this.
|
|
1800
|
+
return `sw:${this.userId}:as`;
|
|
1801
1801
|
}
|
|
1802
1802
|
get protocolKey() {
|
|
1803
|
-
return `sw:${this.
|
|
1803
|
+
return `sw:${this.userId}:pt`;
|
|
1804
1804
|
}
|
|
1805
1805
|
get attachedCallsKey() {
|
|
1806
|
-
return `sw:${this.
|
|
1806
|
+
return `sw:${this.userId}:att`;
|
|
1807
1807
|
}
|
|
1808
|
-
|
|
1809
|
-
return this.
|
|
1808
|
+
getUserFromAddressId() {
|
|
1809
|
+
return this.user.addresses[0]?.id ?? "";
|
|
1810
1810
|
}
|
|
1811
1811
|
set baseURL(baseURL) {
|
|
1812
1812
|
this._baseURL = baseURL;
|
|
@@ -2632,14 +2632,14 @@ var Fetchable = class extends Destroyable {
|
|
|
2632
2632
|
};
|
|
2633
2633
|
|
|
2634
2634
|
//#endregion
|
|
2635
|
-
//#region src/core/entities/
|
|
2635
|
+
//#region src/core/entities/User.ts
|
|
2636
2636
|
/**
|
|
2637
|
-
* Authenticated
|
|
2637
|
+
* Authenticated user profile.
|
|
2638
2638
|
*
|
|
2639
2639
|
* Fetched automatically when a {@link SignalWire} connects.
|
|
2640
2640
|
* Contains identity, contact, and organization details.
|
|
2641
2641
|
*/
|
|
2642
|
-
var
|
|
2642
|
+
var User = class extends Fetchable {
|
|
2643
2643
|
constructor(http) {
|
|
2644
2644
|
super("/api/fabric/subscriber/info", http);
|
|
2645
2645
|
}
|
|
@@ -3334,9 +3334,9 @@ var Participant = class extends Destroyable {
|
|
|
3334
3334
|
get meta$() {
|
|
3335
3335
|
return this.cachedObservable("meta$", () => this._state$.pipe((0, rxjs_operators.map)((state) => state.meta), (0, rxjs_operators.distinctUntilChanged)()));
|
|
3336
3336
|
}
|
|
3337
|
-
/** Observable of the participant's
|
|
3338
|
-
get
|
|
3339
|
-
return this.cachedObservable("
|
|
3337
|
+
/** Observable of the participant's user ID. */
|
|
3338
|
+
get userId$() {
|
|
3339
|
+
return this.cachedObservable("userId$", () => this._state$.pipe((0, rxjs_operators.map)((state) => state.subscriber_id), (0, rxjs_operators.distinctUntilChanged)()));
|
|
3340
3340
|
}
|
|
3341
3341
|
/** Observable of the participant's address ID. */
|
|
3342
3342
|
get addressId$() {
|
|
@@ -3440,8 +3440,8 @@ var Participant = class extends Destroyable {
|
|
|
3440
3440
|
get meta() {
|
|
3441
3441
|
return this._state$.value.meta;
|
|
3442
3442
|
}
|
|
3443
|
-
/**
|
|
3444
|
-
get
|
|
3443
|
+
/** User ID of this participant, or `undefined` if not available. */
|
|
3444
|
+
get userId() {
|
|
3445
3445
|
return this._state$.value.subscriber_id;
|
|
3446
3446
|
}
|
|
3447
3447
|
/** Address ID of this participant, or `undefined` if not available. */
|
|
@@ -4911,6 +4911,12 @@ var TransceiverController = class extends Destroyable {
|
|
|
4911
4911
|
scaleResolutionDownBy: Number(rid) * 6 || 1
|
|
4912
4912
|
}));
|
|
4913
4913
|
}
|
|
4914
|
+
/**
|
|
4915
|
+
* Resolve the current MediaTrackConstraints for an input kind, normalising
|
|
4916
|
+
* boolean shorthand to an empty object. Public so the surrounding
|
|
4917
|
+
* RTCPeerConnectionController can drive its own pipeline-aware getUserMedia
|
|
4918
|
+
* call with the same effective constraints the transceiver would have used.
|
|
4919
|
+
*/
|
|
4914
4920
|
getConstraintsFor(kind) {
|
|
4915
4921
|
const constraints = kind === "audio" ? this.inputAudioDeviceConstraints : this.inputVideoDeviceConstraints;
|
|
4916
4922
|
return typeof constraints === "boolean" ? {} : constraints;
|
|
@@ -5236,7 +5242,19 @@ var RTCPeerConnectionController = class extends Destroyable {
|
|
|
5236
5242
|
return this._memberId;
|
|
5237
5243
|
}
|
|
5238
5244
|
stopTrackSender(kind, options = { updateTransceiverDirection: false }) {
|
|
5239
|
-
|
|
5245
|
+
const audioCovered = kind === "audio" || kind === "both";
|
|
5246
|
+
if (audioCovered && this._localAudioPipeline) this.stopRawAudioInputForPipeline();
|
|
5247
|
+
if (!audioCovered) this.transceiverController?.stopTrackSender(kind, options);
|
|
5248
|
+
else if (kind === "both") this.transceiverController?.stopTrackSender("video", options);
|
|
5249
|
+
else if (!this._localAudioPipeline) this.transceiverController?.stopTrackSender(kind, options);
|
|
5250
|
+
}
|
|
5251
|
+
stopRawAudioInputForPipeline() {
|
|
5252
|
+
const rawTracks = this.localStreamController.localAudioTracks;
|
|
5253
|
+
for (const track of rawTracks) if (track.readyState === "live") {
|
|
5254
|
+
track.stop();
|
|
5255
|
+
this.localStreamController.removeTrack(track.id);
|
|
5256
|
+
}
|
|
5257
|
+
this._localAudioPipeline?.setInputTrack(null);
|
|
5240
5258
|
}
|
|
5241
5259
|
get isNegotiating$() {
|
|
5242
5260
|
return this._isNegotiating$.asObservable();
|
|
@@ -5741,8 +5759,27 @@ var RTCPeerConnectionController = class extends Destroyable {
|
|
|
5741
5759
|
await this.transceiverController?.setupRemoteTransceivers(this.type);
|
|
5742
5760
|
}
|
|
5743
5761
|
async restoreTrackSender(kind) {
|
|
5744
|
-
|
|
5745
|
-
if (
|
|
5762
|
+
const audioCovered = kind === "audio" || kind === "both";
|
|
5763
|
+
if (audioCovered && this._localAudioPipeline) await this.restoreRawAudioInputForPipeline();
|
|
5764
|
+
if (!audioCovered) await this.transceiverController?.restoreTrackSender(kind);
|
|
5765
|
+
else if (kind === "both") await this.transceiverController?.restoreTrackSender("video");
|
|
5766
|
+
else if (!this._localAudioPipeline) await this.transceiverController?.restoreTrackSender(kind);
|
|
5767
|
+
}
|
|
5768
|
+
async restoreRawAudioInputForPipeline() {
|
|
5769
|
+
if (!this._localAudioPipeline) return;
|
|
5770
|
+
const constraints = this.transceiverController?.getConstraintsFor("audio") ?? {};
|
|
5771
|
+
let stream;
|
|
5772
|
+
try {
|
|
5773
|
+
stream = await this.getUserMedia({ audio: constraints });
|
|
5774
|
+
} catch (error) {
|
|
5775
|
+
logger$16.error("[RTCPeerConnectionController] Failed to re-acquire mic for pipeline restore:", error);
|
|
5776
|
+
this._errors$.next(toError(error));
|
|
5777
|
+
return;
|
|
5778
|
+
}
|
|
5779
|
+
const newTrack = stream.getAudioTracks().at(0);
|
|
5780
|
+
if (!newTrack) return;
|
|
5781
|
+
this.localStreamController.addTrack(newTrack);
|
|
5782
|
+
this._localAudioPipeline.setInputTrack(newTrack);
|
|
5746
5783
|
}
|
|
5747
5784
|
/**
|
|
5748
5785
|
* Return the lazily-created {@link LocalAudioPipeline}, constructing it on
|
|
@@ -9102,7 +9139,7 @@ var ClientSessionManager = class extends Destroyable {
|
|
|
9102
9139
|
this._errors$ = this.createReplaySubject(1);
|
|
9103
9140
|
this._authState$ = this.createBehaviorSubject({ kind: "unauthenticated" });
|
|
9104
9141
|
this._wasClientBound = false;
|
|
9105
|
-
this.
|
|
9142
|
+
this._userInfo$ = this.createBehaviorSubject(null);
|
|
9106
9143
|
this._calls$ = this.createBehaviorSubject({});
|
|
9107
9144
|
this._iceServers$ = this.createBehaviorSubject([]);
|
|
9108
9145
|
attachManager.setSession(this);
|
|
@@ -9115,11 +9152,11 @@ var ClientSessionManager = class extends Destroyable {
|
|
|
9115
9152
|
get incomingCalls() {
|
|
9116
9153
|
return Object.values(this._calls$.value).filter((call) => call.direction === "inbound");
|
|
9117
9154
|
}
|
|
9118
|
-
get
|
|
9119
|
-
return this.
|
|
9155
|
+
get userInfo$() {
|
|
9156
|
+
return this._userInfo$.asObservable();
|
|
9120
9157
|
}
|
|
9121
|
-
get
|
|
9122
|
-
return this.
|
|
9158
|
+
get userInfo() {
|
|
9159
|
+
return this._userInfo$.value;
|
|
9123
9160
|
}
|
|
9124
9161
|
get calls$() {
|
|
9125
9162
|
return this.cachedObservable("calls$", () => this._calls$.pipe((0, rxjs.map)((calls) => Object.values(calls))));
|
|
@@ -9564,22 +9601,22 @@ var ConversationMessageCollection = class extends EntityCollection {
|
|
|
9564
9601
|
}
|
|
9565
9602
|
};
|
|
9566
9603
|
var ConversationsManager = class {
|
|
9567
|
-
constructor(clientSession, http,
|
|
9604
|
+
constructor(clientSession, http, getUserAddressId, onError) {
|
|
9568
9605
|
this.clientSession = clientSession;
|
|
9569
9606
|
this.http = http;
|
|
9570
|
-
this.
|
|
9607
|
+
this.getUserAddressId = getUserAddressId;
|
|
9571
9608
|
this.onError = onError;
|
|
9572
9609
|
this.groupIds = /* @__PURE__ */ new Map();
|
|
9573
9610
|
}
|
|
9574
9611
|
async join(addressId) {
|
|
9575
|
-
const
|
|
9612
|
+
const userFromAddressId = this.getUserAddressId();
|
|
9576
9613
|
try {
|
|
9577
9614
|
const response = await this.http.request({
|
|
9578
9615
|
...POST_PARAMS,
|
|
9579
9616
|
url: `/api/fabric/conversations/join`,
|
|
9580
9617
|
body: JSON.stringify({
|
|
9581
|
-
from_fabric_address_id:
|
|
9582
|
-
fabric_address_ids: [addressId,
|
|
9618
|
+
from_fabric_address_id: userFromAddressId,
|
|
9619
|
+
fabric_address_ids: [addressId, userFromAddressId]
|
|
9583
9620
|
})
|
|
9584
9621
|
});
|
|
9585
9622
|
if (response.ok && !!response.body) {
|
|
@@ -9601,14 +9638,14 @@ var ConversationsManager = class {
|
|
|
9601
9638
|
}
|
|
9602
9639
|
async sendText(text, destinationAddressId) {
|
|
9603
9640
|
const groupId = this.groupIds.get(destinationAddressId) ?? await this.join(destinationAddressId);
|
|
9604
|
-
const
|
|
9641
|
+
const userFromAddressId = this.getUserAddressId();
|
|
9605
9642
|
try {
|
|
9606
9643
|
if ((await this.http.request({
|
|
9607
9644
|
...POST_PARAMS,
|
|
9608
9645
|
url: "/api/fabric/messages",
|
|
9609
9646
|
body: JSON.stringify({
|
|
9610
9647
|
group_id: groupId,
|
|
9611
|
-
from_fabric_address_id:
|
|
9648
|
+
from_fabric_address_id: userFromAddressId,
|
|
9612
9649
|
text
|
|
9613
9650
|
})
|
|
9614
9651
|
})).ok) return;
|
|
@@ -9680,17 +9717,17 @@ var DeviceTokenManager = class extends Destroyable {
|
|
|
9680
9717
|
return this._effectiveExpireIn;
|
|
9681
9718
|
}
|
|
9682
9719
|
/**
|
|
9683
|
-
* Activates the Client Bound SAT flow when the
|
|
9720
|
+
* Activates the Client Bound SAT flow when the user's token has
|
|
9684
9721
|
* `sat:refresh` scope.
|
|
9685
9722
|
*
|
|
9686
9723
|
* Steps:
|
|
9687
|
-
* 1. Check
|
|
9724
|
+
* 1. Check user's `sat_claims` for `sat:refresh` scope
|
|
9688
9725
|
* 2. Call `/api/fabric/subscriber/devices/token` with a DPoP proof
|
|
9689
9726
|
* 3. Reauthenticate the session with the Client Bound SAT + DPoP proof
|
|
9690
9727
|
* 4. Emit token to trigger the reactive refresh pipeline
|
|
9691
9728
|
*/
|
|
9692
|
-
async activate(
|
|
9693
|
-
const { satClaims } =
|
|
9729
|
+
async activate(user, session, updateCredential) {
|
|
9730
|
+
const { satClaims } = user;
|
|
9694
9731
|
if (!satClaims?.scope?.includes(SAT_REFRESH_SCOPE)) {
|
|
9695
9732
|
logger$6.debug("[DeviceToken] No sat:refresh scope, skipping Client Bound SAT activation");
|
|
9696
9733
|
return;
|
|
@@ -10533,7 +10570,7 @@ var SignalWire = class extends Destroyable {
|
|
|
10533
10570
|
constructor(credentialProvider, options = {}) {
|
|
10534
10571
|
super();
|
|
10535
10572
|
this.preferences = new ClientPreferences();
|
|
10536
|
-
this.
|
|
10573
|
+
this._user$ = this.createBehaviorSubject(void 0);
|
|
10537
10574
|
this._directory$ = this.createBehaviorSubject(void 0);
|
|
10538
10575
|
this._isConnected$ = this.createBehaviorSubject(false);
|
|
10539
10576
|
this._isRegistered$ = this.createBehaviorSubject(false);
|
|
@@ -10673,7 +10710,7 @@ var SignalWire = class extends Destroyable {
|
|
|
10673
10710
|
if (this._deps.persistSession) this._deps.storage.setItem("sw:cached_credential", credential, "local");
|
|
10674
10711
|
}
|
|
10675
10712
|
async init() {
|
|
10676
|
-
this.
|
|
10713
|
+
this._user$.next(new User(this._deps.http));
|
|
10677
10714
|
if (!this._options.skipConnection) await this.connect();
|
|
10678
10715
|
if (!this._options.reconnectAttachedCalls && this._attachManager) await this._attachManager.flush();
|
|
10679
10716
|
if (!this._options.skipRegister) try {
|
|
@@ -10737,13 +10774,13 @@ var SignalWire = class extends Destroyable {
|
|
|
10737
10774
|
async connect() {
|
|
10738
10775
|
await this.teardownTransportAndSession();
|
|
10739
10776
|
try {
|
|
10740
|
-
const
|
|
10741
|
-
if (!
|
|
10742
|
-
if (!await (0, rxjs.firstValueFrom)(
|
|
10743
|
-
this._deps.
|
|
10777
|
+
const user = this._user$.value;
|
|
10778
|
+
if (!user) throw new require_operators.UnexpectedError("User not initialized before connect");
|
|
10779
|
+
if (!await (0, rxjs.firstValueFrom)(user.fetched$)) throw new require_operators.UnexpectedError("Failed to fetch user information - fetched$ emitted false");
|
|
10780
|
+
this._deps.user = user;
|
|
10744
10781
|
} catch (error) {
|
|
10745
|
-
logger$1.error(`[SignalWire] Failed to fetch
|
|
10746
|
-
throw new require_operators.UnexpectedError("Error fetching
|
|
10782
|
+
logger$1.error(`[SignalWire] Failed to fetch user information: ${error instanceof Error ? error.message : "Unknown error"}. This usually means the user token is invalid or expired.`);
|
|
10783
|
+
throw new require_operators.UnexpectedError("Error fetching user information", { cause: error });
|
|
10747
10784
|
}
|
|
10748
10785
|
const errorHandler = (error) => {
|
|
10749
10786
|
this._errors$.next(error);
|
|
@@ -10777,7 +10814,7 @@ var SignalWire = class extends Destroyable {
|
|
|
10777
10814
|
logger$1.debug("[SignalWire] Developer refresh disabled — Client Bound SAT activation starting");
|
|
10778
10815
|
}
|
|
10779
10816
|
this._deviceTokenManager = new DeviceTokenManager(this._dpopManager, this._deps.http, (error) => this._errors$.next(error), () => this._deps.credential);
|
|
10780
|
-
await this._deviceTokenManager.activate(this._deps.
|
|
10817
|
+
await this._deviceTokenManager.activate(this._deps.user, this._clientSession, (cred) => {
|
|
10781
10818
|
this._deps.credential = {
|
|
10782
10819
|
...this._deps.credential,
|
|
10783
10820
|
...cred
|
|
@@ -10787,7 +10824,7 @@ var SignalWire = class extends Destroyable {
|
|
|
10787
10824
|
this.subscribeTo(this._clientSession.authenticated$.pipe((0, rxjs.skip)(1), (0, rxjs.filter)(Boolean)), async () => {
|
|
10788
10825
|
try {
|
|
10789
10826
|
if (this._deviceTokenManager) {
|
|
10790
|
-
await this._deviceTokenManager.activate(this._deps.
|
|
10827
|
+
await this._deviceTokenManager.activate(this._deps.user, this._clientSession, (cred) => {
|
|
10791
10828
|
this._deps.credential = {
|
|
10792
10829
|
...this._deps.credential,
|
|
10793
10830
|
...cred
|
|
@@ -10800,15 +10837,15 @@ var SignalWire = class extends Destroyable {
|
|
|
10800
10837
|
this._errors$.next(error instanceof Error ? error : new Error(String(error), { cause: error }));
|
|
10801
10838
|
}
|
|
10802
10839
|
try {
|
|
10803
|
-
logger$1.debug("[SignalWire] Re-registering
|
|
10840
|
+
logger$1.debug("[SignalWire] Re-registering user after reconnect");
|
|
10804
10841
|
await this.register();
|
|
10805
|
-
logger$1.debug("[SignalWire]
|
|
10842
|
+
logger$1.debug("[SignalWire] User re-registered successfully after reconnect");
|
|
10806
10843
|
} catch (error) {
|
|
10807
10844
|
logger$1.error("[SignalWire] Re-registration failed after reconnect:", error);
|
|
10808
10845
|
this._errors$.next(error instanceof Error ? error : new Error(String(error), { cause: error }));
|
|
10809
10846
|
}
|
|
10810
10847
|
});
|
|
10811
|
-
const conversationManager = new ConversationsManager(this._clientSession, this._deps.http, () => this._deps.
|
|
10848
|
+
const conversationManager = new ConversationsManager(this._clientSession, this._deps.http, () => this._deps.getUserFromAddressId(), errorHandler);
|
|
10812
10849
|
const directory = new DirectoryManager(this._deps.http, this._clientSession, conversationManager, errorHandler);
|
|
10813
10850
|
this._directory$.next(directory);
|
|
10814
10851
|
this._clientSession.setDirectory(directory);
|
|
@@ -10819,22 +10856,22 @@ var SignalWire = class extends Destroyable {
|
|
|
10819
10856
|
});
|
|
10820
10857
|
}
|
|
10821
10858
|
/**
|
|
10822
|
-
* Observable that emits the {@link
|
|
10859
|
+
* Observable that emits the {@link User} profile once fetched,
|
|
10823
10860
|
* or `undefined` before authentication completes.
|
|
10824
10861
|
*
|
|
10825
10862
|
* @example
|
|
10826
10863
|
* ```ts
|
|
10827
|
-
* client.
|
|
10828
|
-
* if (
|
|
10864
|
+
* client.user$.subscribe(u => {
|
|
10865
|
+
* if (u) console.log('Logged in as', u.email);
|
|
10829
10866
|
* });
|
|
10830
10867
|
* ```
|
|
10831
10868
|
*/
|
|
10832
|
-
get
|
|
10833
|
-
return this.deferEmission(this.
|
|
10869
|
+
get user$() {
|
|
10870
|
+
return this.deferEmission(this._user$.asObservable());
|
|
10834
10871
|
}
|
|
10835
|
-
/** Current
|
|
10836
|
-
get
|
|
10837
|
-
return this.
|
|
10872
|
+
/** Current user snapshot, or `undefined` if not yet authenticated. */
|
|
10873
|
+
get user() {
|
|
10874
|
+
return this._user$.value;
|
|
10838
10875
|
}
|
|
10839
10876
|
/**
|
|
10840
10877
|
* Observable that emits the {@link Directory} instance once the client is connected,
|
|
@@ -10858,11 +10895,11 @@ var SignalWire = class extends Destroyable {
|
|
|
10858
10895
|
get directory() {
|
|
10859
10896
|
return this._directory$.value;
|
|
10860
10897
|
}
|
|
10861
|
-
/** Observable that emits when the
|
|
10898
|
+
/** Observable that emits when the user registration state changes. */
|
|
10862
10899
|
get isRegistered$() {
|
|
10863
10900
|
return this.deferEmission(this._isRegistered$.asObservable());
|
|
10864
10901
|
}
|
|
10865
|
-
/** Whether the
|
|
10902
|
+
/** Whether the user is currently registered. */
|
|
10866
10903
|
get isRegistered() {
|
|
10867
10904
|
return this._isRegistered$.value;
|
|
10868
10905
|
}
|
|
@@ -10995,7 +11032,7 @@ var SignalWire = class extends Destroyable {
|
|
|
10995
11032
|
await (0, rxjs.firstValueFrom)(this.ready$.pipe((0, rxjs.filter)((ready$1) => ready$1 === true)));
|
|
10996
11033
|
}
|
|
10997
11034
|
/**
|
|
10998
|
-
* Registers the
|
|
11035
|
+
* Registers the user as online to receive inbound calls and events.
|
|
10999
11036
|
*
|
|
11000
11037
|
* Waits for authentication to complete before sending the registration.
|
|
11001
11038
|
* If the initial attempt fails, reauthentication is attempted automatically.
|
|
@@ -11016,7 +11053,7 @@ var SignalWire = class extends Destroyable {
|
|
|
11016
11053
|
this._errors$.next(error instanceof Error ? error : new Error(String(error), { cause: error }));
|
|
11017
11054
|
throw error;
|
|
11018
11055
|
}
|
|
11019
|
-
logger$1.debug("[SignalWire] Failed to register
|
|
11056
|
+
logger$1.debug("[SignalWire] Failed to register user, trying reauthentication...");
|
|
11020
11057
|
try {
|
|
11021
11058
|
await this._clientSession.reauthenticate(this._deps.credential.token);
|
|
11022
11059
|
logger$1.debug("[SignalWire] Reauthentication successful, retrying register()");
|
|
@@ -11027,14 +11064,14 @@ var SignalWire = class extends Destroyable {
|
|
|
11027
11064
|
this._isRegistered$.next(true);
|
|
11028
11065
|
} catch (reauthError) {
|
|
11029
11066
|
logger$1.error("[SignalWire] Reauthentication failed during register():", reauthError);
|
|
11030
|
-
const registerError = new require_operators.InvalidCredentialsError("Failed to register
|
|
11067
|
+
const registerError = new require_operators.InvalidCredentialsError("Failed to register user, and reauthentication attempt also failed. Please check your credentials.", { cause: reauthError instanceof Error ? reauthError : new Error(String(reauthError), { cause: reauthError }) });
|
|
11031
11068
|
this._errors$.next(registerError);
|
|
11032
11069
|
throw registerError;
|
|
11033
11070
|
}
|
|
11034
11071
|
}
|
|
11035
11072
|
}
|
|
11036
11073
|
/**
|
|
11037
|
-
* Unregisters the
|
|
11074
|
+
* Unregisters the user, going offline for inbound calls.
|
|
11038
11075
|
*
|
|
11039
11076
|
* The WebSocket connection remains open; use {@link disconnect} to fully close it.
|
|
11040
11077
|
*/
|
|
@@ -11046,7 +11083,7 @@ var SignalWire = class extends Destroyable {
|
|
|
11046
11083
|
}));
|
|
11047
11084
|
this._isRegistered$.next(false);
|
|
11048
11085
|
} catch (error) {
|
|
11049
|
-
logger$1.error("[SignalWire] Failed to unregister
|
|
11086
|
+
logger$1.error("[SignalWire] Failed to unregister user:", error);
|
|
11050
11087
|
this._errors$.next(error instanceof Error ? error : new Error(String(error), { cause: error }));
|
|
11051
11088
|
throw error;
|
|
11052
11089
|
}
|
|
@@ -11521,9 +11558,9 @@ exports.SelfCapabilities = SelfCapabilities;
|
|
|
11521
11558
|
exports.SelfParticipant = SelfParticipant;
|
|
11522
11559
|
exports.SignalWire = SignalWire;
|
|
11523
11560
|
exports.StaticCredentialProvider = StaticCredentialProvider;
|
|
11524
|
-
exports.Subscriber = Subscriber;
|
|
11525
11561
|
exports.TokenRefreshError = require_operators.TokenRefreshError;
|
|
11526
11562
|
exports.UnexpectedError = require_operators.UnexpectedError;
|
|
11563
|
+
exports.User = User;
|
|
11527
11564
|
exports.VertoPongError = require_operators.VertoPongError;
|
|
11528
11565
|
exports.WebRTCCall = WebRTCCall;
|
|
11529
11566
|
exports.embeddableCall = embeddableCall;
|