@signalwire/js 4.0.0-rc.4 → 4.0.0-rc.5
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 +22 -5
- package/dist/browser.mjs.map +1 -1
- package/dist/browser.umd.js +22 -5
- package/dist/browser.umd.js.map +1 -1
- package/dist/index.cjs +22 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -0
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +8 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +22 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -9919,6 +9919,8 @@ var ClientSessionManager = class extends Destroyable {
|
|
|
9919
9919
|
this._errors$ = this.createReplaySubject(1);
|
|
9920
9920
|
this._authState$ = this.createBehaviorSubject({ kind: "unauthenticated" });
|
|
9921
9921
|
this._wasClientBound = false;
|
|
9922
|
+
this._lastFreshConnectReminted = false;
|
|
9923
|
+
this._remintBeforeNextFreshConnect = false;
|
|
9922
9924
|
this._userInfo$ = this.createBehaviorSubject(null);
|
|
9923
9925
|
this._calls$ = this.createBehaviorSubject({});
|
|
9924
9926
|
this._iceServers$ = this.createBehaviorSubject([]);
|
|
@@ -10124,7 +10126,17 @@ var ClientSessionManager = class extends Destroyable {
|
|
|
10124
10126
|
if (isRecoverableAuthError$1 && hasStoredState) {
|
|
10125
10127
|
logger$9.debug("[Session] Recoverable auth error — cleaning up stored state and reconnecting fresh");
|
|
10126
10128
|
await this.discardResumeStateAndReconnect();
|
|
10127
|
-
} else this.
|
|
10129
|
+
} else if (isRecoverableAuthError$1 && this.onBeforeReconnect && !this._lastFreshConnectReminted) {
|
|
10130
|
+
logger$9.debug("[Session] Fresh connect refused — re-minting the credential and retrying once");
|
|
10131
|
+
this._remintBeforeNextFreshConnect = true;
|
|
10132
|
+
this.transport.reconnect();
|
|
10133
|
+
} else {
|
|
10134
|
+
this._errors$.next(error);
|
|
10135
|
+
if (isRecoverableAuthError$1) {
|
|
10136
|
+
this.transport.disconnect();
|
|
10137
|
+
this.onAuthenticationRejected?.();
|
|
10138
|
+
}
|
|
10139
|
+
}
|
|
10128
10140
|
}
|
|
10129
10141
|
/**
|
|
10130
10142
|
* Clear the resume state (authorization_state + protocol) and ask the
|
|
@@ -10216,6 +10228,7 @@ var ClientSessionManager = class extends Destroyable {
|
|
|
10216
10228
|
}
|
|
10217
10229
|
async authenticate() {
|
|
10218
10230
|
logger$9.debug("[Session] Starting authentication process");
|
|
10231
|
+
this._lastFreshConnectReminted = false;
|
|
10219
10232
|
const persistedParams = await (0, rxjs.firstValueFrom)((0, rxjs.combineLatest)({
|
|
10220
10233
|
protocol: this.transport.protocol$,
|
|
10221
10234
|
authorization_state: this.authorizationState$
|
|
@@ -10232,8 +10245,11 @@ var ClientSessionManager = class extends Destroyable {
|
|
|
10232
10245
|
else {
|
|
10233
10246
|
const credential = this.getCredential();
|
|
10234
10247
|
const credentialExpired = credential.expiry_at !== void 0 && credential.expiry_at <= Date.now() + require_operators.CREDENTIAL_EXPIRY_SKEW_MS;
|
|
10235
|
-
|
|
10248
|
+
const remint = this.clientBound || credentialExpired || this._remintBeforeNextFreshConnect;
|
|
10249
|
+
this._remintBeforeNextFreshConnect = false;
|
|
10250
|
+
if (this.onBeforeReconnect && remint) {
|
|
10236
10251
|
logger$9.debug("[Session] Refreshing credentials before fresh connect");
|
|
10252
|
+
this._lastFreshConnectReminted = true;
|
|
10237
10253
|
await this.onBeforeReconnect();
|
|
10238
10254
|
}
|
|
10239
10255
|
}
|
|
@@ -12287,6 +12303,7 @@ var SignalWire = class extends Destroyable {
|
|
|
12287
12303
|
this.persistClientBoundMarker(Boolean(authorization?.cnf?.jkt));
|
|
12288
12304
|
});
|
|
12289
12305
|
await this._clientSession.connect();
|
|
12306
|
+
this._clientSession.onAuthenticationRejected = () => void this.disconnect();
|
|
12290
12307
|
await this._refreshCoordinator?.activate(this._deps.user, this._clientSession);
|
|
12291
12308
|
this.subscribeTo(this._clientSession.authenticated$.pipe((0, rxjs.skip)(1), (0, rxjs.filter)(Boolean)), async () => {
|
|
12292
12309
|
try {
|
|
@@ -12466,7 +12483,7 @@ var SignalWire = class extends Destroyable {
|
|
|
12466
12483
|
logger$1.warn("[SignalWire] Failed to initialize VisibilityController:", error);
|
|
12467
12484
|
}
|
|
12468
12485
|
try {
|
|
12469
|
-
this._diagnosticsCollector = new DiagnosticsCollector({ sdkVersion: "4.0.0-rc.
|
|
12486
|
+
this._diagnosticsCollector = new DiagnosticsCollector({ sdkVersion: "4.0.0-rc.5" });
|
|
12470
12487
|
} catch (error) {
|
|
12471
12488
|
logger$1.warn("[SignalWire] Failed to initialize DiagnosticsCollector:", error);
|
|
12472
12489
|
}
|
|
@@ -13020,7 +13037,7 @@ var StaticCredentialProvider = class {
|
|
|
13020
13037
|
/**
|
|
13021
13038
|
* Library version from package.json, injected at build time.
|
|
13022
13039
|
*/
|
|
13023
|
-
const version = "4.0.0-rc.
|
|
13040
|
+
const version = "4.0.0-rc.5";
|
|
13024
13041
|
/**
|
|
13025
13042
|
* Flag indicating the library has been loaded and is ready to use.
|
|
13026
13043
|
* For UMD builds: `window.SignalWire.ready`
|
|
@@ -13042,7 +13059,7 @@ const ready = true;
|
|
|
13042
13059
|
*/
|
|
13043
13060
|
const emitReadyEvent = () => {
|
|
13044
13061
|
if (typeof window !== "undefined") {
|
|
13045
|
-
const event = new CustomEvent("signalwire:js:ready", { detail: { version: "4.0.0-rc.
|
|
13062
|
+
const event = new CustomEvent("signalwire:js:ready", { detail: { version: "4.0.0-rc.5" } });
|
|
13046
13063
|
window.dispatchEvent(event);
|
|
13047
13064
|
}
|
|
13048
13065
|
};
|