@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/browser.umd.js
CHANGED
|
@@ -20695,6 +20695,8 @@ var ClientSessionManager = class extends Destroyable {
|
|
|
20695
20695
|
this._errors$ = this.createReplaySubject(1);
|
|
20696
20696
|
this._authState$ = this.createBehaviorSubject({ kind: "unauthenticated" });
|
|
20697
20697
|
this._wasClientBound = false;
|
|
20698
|
+
this._lastFreshConnectReminted = false;
|
|
20699
|
+
this._remintBeforeNextFreshConnect = false;
|
|
20698
20700
|
this._userInfo$ = this.createBehaviorSubject(null);
|
|
20699
20701
|
this._calls$ = this.createBehaviorSubject({});
|
|
20700
20702
|
this._iceServers$ = this.createBehaviorSubject([]);
|
|
@@ -20900,7 +20902,17 @@ var ClientSessionManager = class extends Destroyable {
|
|
|
20900
20902
|
if (isRecoverableAuthError$1 && hasStoredState) {
|
|
20901
20903
|
logger$9.debug("[Session] Recoverable auth error — cleaning up stored state and reconnecting fresh");
|
|
20902
20904
|
await this.discardResumeStateAndReconnect();
|
|
20903
|
-
} else this.
|
|
20905
|
+
} else if (isRecoverableAuthError$1 && this.onBeforeReconnect && !this._lastFreshConnectReminted) {
|
|
20906
|
+
logger$9.debug("[Session] Fresh connect refused — re-minting the credential and retrying once");
|
|
20907
|
+
this._remintBeforeNextFreshConnect = true;
|
|
20908
|
+
this.transport.reconnect();
|
|
20909
|
+
} else {
|
|
20910
|
+
this._errors$.next(error);
|
|
20911
|
+
if (isRecoverableAuthError$1) {
|
|
20912
|
+
this.transport.disconnect();
|
|
20913
|
+
this.onAuthenticationRejected?.();
|
|
20914
|
+
}
|
|
20915
|
+
}
|
|
20904
20916
|
}
|
|
20905
20917
|
/**
|
|
20906
20918
|
* Clear the resume state (authorization_state + protocol) and ask the
|
|
@@ -20992,6 +21004,7 @@ var ClientSessionManager = class extends Destroyable {
|
|
|
20992
21004
|
}
|
|
20993
21005
|
async authenticate() {
|
|
20994
21006
|
logger$9.debug("[Session] Starting authentication process");
|
|
21007
|
+
this._lastFreshConnectReminted = false;
|
|
20995
21008
|
const persistedParams = await (0, import_cjs$7.firstValueFrom)((0, import_cjs$7.combineLatest)({
|
|
20996
21009
|
protocol: this.transport.protocol$,
|
|
20997
21010
|
authorization_state: this.authorizationState$
|
|
@@ -21008,8 +21021,11 @@ var ClientSessionManager = class extends Destroyable {
|
|
|
21008
21021
|
else {
|
|
21009
21022
|
const credential = this.getCredential();
|
|
21010
21023
|
const credentialExpired = credential.expiry_at !== void 0 && credential.expiry_at <= Date.now() + CREDENTIAL_EXPIRY_SKEW_MS;
|
|
21011
|
-
|
|
21024
|
+
const remint = this.clientBound || credentialExpired || this._remintBeforeNextFreshConnect;
|
|
21025
|
+
this._remintBeforeNextFreshConnect = false;
|
|
21026
|
+
if (this.onBeforeReconnect && remint) {
|
|
21012
21027
|
logger$9.debug("[Session] Refreshing credentials before fresh connect");
|
|
21028
|
+
this._lastFreshConnectReminted = true;
|
|
21013
21029
|
await this.onBeforeReconnect();
|
|
21014
21030
|
}
|
|
21015
21031
|
}
|
|
@@ -23069,6 +23085,7 @@ var SignalWire = class extends Destroyable {
|
|
|
23069
23085
|
this.persistClientBoundMarker(Boolean(authorization?.cnf?.jkt));
|
|
23070
23086
|
});
|
|
23071
23087
|
await this._clientSession.connect();
|
|
23088
|
+
this._clientSession.onAuthenticationRejected = () => void this.disconnect();
|
|
23072
23089
|
await this._refreshCoordinator?.activate(this._deps.user, this._clientSession);
|
|
23073
23090
|
this.subscribeTo(this._clientSession.authenticated$.pipe((0, import_cjs$1.skip)(1), (0, import_cjs$1.filter)(Boolean)), async () => {
|
|
23074
23091
|
try {
|
|
@@ -23248,7 +23265,7 @@ var SignalWire = class extends Destroyable {
|
|
|
23248
23265
|
logger$1.warn("[SignalWire] Failed to initialize VisibilityController:", error);
|
|
23249
23266
|
}
|
|
23250
23267
|
try {
|
|
23251
|
-
this._diagnosticsCollector = new DiagnosticsCollector({ sdkVersion: "4.0.0-rc.
|
|
23268
|
+
this._diagnosticsCollector = new DiagnosticsCollector({ sdkVersion: "4.0.0-rc.5" });
|
|
23252
23269
|
} catch (error) {
|
|
23253
23270
|
logger$1.warn("[SignalWire] Failed to initialize DiagnosticsCollector:", error);
|
|
23254
23271
|
}
|
|
@@ -23803,7 +23820,7 @@ var StaticCredentialProvider = class {
|
|
|
23803
23820
|
/**
|
|
23804
23821
|
* Library version from package.json, injected at build time.
|
|
23805
23822
|
*/
|
|
23806
|
-
const version = "4.0.0-rc.
|
|
23823
|
+
const version = "4.0.0-rc.5";
|
|
23807
23824
|
/**
|
|
23808
23825
|
* Flag indicating the library has been loaded and is ready to use.
|
|
23809
23826
|
* For UMD builds: `window.SignalWire.ready`
|
|
@@ -23825,7 +23842,7 @@ const ready = true;
|
|
|
23825
23842
|
*/
|
|
23826
23843
|
const emitReadyEvent = () => {
|
|
23827
23844
|
if (typeof window !== "undefined") {
|
|
23828
|
-
const event = new CustomEvent("signalwire:js:ready", { detail: { version: "4.0.0-rc.
|
|
23845
|
+
const event = new CustomEvent("signalwire:js:ready", { detail: { version: "4.0.0-rc.5" } });
|
|
23829
23846
|
window.dispatchEvent(event);
|
|
23830
23847
|
}
|
|
23831
23848
|
};
|