@chat-leo/chatleolib 2.1.0 → 2.1.1
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/index.d.ts.map +1 -1
- package/dist/index.esm.js +8 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +8 -5
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +8 -5
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -7560,7 +7560,7 @@
|
|
|
7560
7560
|
this.clients.delete(client);
|
|
7561
7561
|
}
|
|
7562
7562
|
async requestConnection(client, options = {}) {
|
|
7563
|
-
var _b, _c, _d, _e, _f, _g;
|
|
7563
|
+
var _b, _c, _d, _e, _f, _g, _h;
|
|
7564
7564
|
console.debug(`requestConnection`, client, options);
|
|
7565
7565
|
client.chatStore = this.chatStore;
|
|
7566
7566
|
this.registerClient(client);
|
|
@@ -7577,18 +7577,21 @@
|
|
|
7577
7577
|
console.debug('Already logged in, hydrate client');
|
|
7578
7578
|
(_b = client.setLoading) === null || _b === void 0 ? void 0 : _b.call(client, false);
|
|
7579
7579
|
(_c = client.setLoggedIn) === null || _c === void 0 ? void 0 : _c.call(client, true, this.userProfile);
|
|
7580
|
+
// A client that joins an already-connected session must learn the current
|
|
7581
|
+
// status, or it keeps its initial "disconnected" state (stale Offline banner).
|
|
7582
|
+
(_d = client.setConnectionStatus) === null || _d === void 0 ? void 0 : _d.call(client, this.chatStore.connectionStatus);
|
|
7580
7583
|
return { status: 'connected' };
|
|
7581
7584
|
}
|
|
7582
7585
|
// No active session: allow client to wait without triggering login if no credentials
|
|
7583
7586
|
const hasCreds = Boolean(options.ticket || (options.username && options.password));
|
|
7584
7587
|
if (!this.loginPromise && !hasCreds) {
|
|
7585
7588
|
console.debug('No active session, allow client to wait');
|
|
7586
|
-
(
|
|
7589
|
+
(_e = client.setLoading) === null || _e === void 0 ? void 0 : _e.call(client, false);
|
|
7587
7590
|
return { status: 'waiting' };
|
|
7588
7591
|
}
|
|
7589
7592
|
console.debug('Requesting connection');
|
|
7590
7593
|
// Gate concurrent logins
|
|
7591
|
-
(
|
|
7594
|
+
(_f = client.setLoading) === null || _f === void 0 ? void 0 : _f.call(client, true);
|
|
7592
7595
|
if (!this.loginPromise && hasCreds) {
|
|
7593
7596
|
// Start a new login process
|
|
7594
7597
|
this.loginPromise = this.performLogin(options)
|
|
@@ -7608,8 +7611,8 @@
|
|
|
7608
7611
|
catch (err) {
|
|
7609
7612
|
// notify this client of error
|
|
7610
7613
|
console.error('Login failed', err);
|
|
7611
|
-
(
|
|
7612
|
-
(
|
|
7614
|
+
(_g = client.setLoading) === null || _g === void 0 ? void 0 : _g.call(client, false);
|
|
7615
|
+
(_h = client.setLoggedIn) === null || _h === void 0 ? void 0 : _h.call(client, false, null);
|
|
7613
7616
|
return { status: 'error' };
|
|
7614
7617
|
}
|
|
7615
7618
|
}
|