@talkjs/core 1.5.2 → 1.5.4
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/README.md +11 -3
- package/dist/talkSession.cjs +1 -1
- package/dist/talkSession.d.ts +25 -1
- package/dist/talkSession.js +90 -71
- package/package.json +2 -1
package/dist/talkSession.d.ts
CHANGED
|
@@ -597,7 +597,11 @@ export declare interface ConversationSnapshot {
|
|
|
597
597
|
*/
|
|
598
598
|
photoUrl: string | null;
|
|
599
599
|
/**
|
|
600
|
-
* One or more welcome messages that will
|
|
600
|
+
* One or more welcome messages that will be rendered at the start of this conversation as system messages.
|
|
601
|
+
*
|
|
602
|
+
* @remarks
|
|
603
|
+
* Welcome messages are rendered in the UI as messages, but they are not real messages.
|
|
604
|
+
* This means they do not appear when you list messages using the REST API or JS Data API, and you cannot reply or react to them.
|
|
601
605
|
*/
|
|
602
606
|
welcomeMessages: string[];
|
|
603
607
|
/**
|
|
@@ -726,6 +730,10 @@ export declare interface CreateConversationParams {
|
|
|
726
730
|
/**
|
|
727
731
|
* System messages which are sent at the beginning of a conversation.
|
|
728
732
|
* Default = no messages.
|
|
733
|
+
*
|
|
734
|
+
* @remarks
|
|
735
|
+
* Welcome messages are rendered in the UI as messages, but they are not real messages.
|
|
736
|
+
* This means they do not appear when you list messages using the REST API or JS Data API, and you cannot reply or react to them.
|
|
729
737
|
*/
|
|
730
738
|
welcomeMessages?: string[];
|
|
731
739
|
/**
|
|
@@ -807,6 +815,10 @@ export declare interface CreateUserParams {
|
|
|
807
815
|
/**
|
|
808
816
|
* The default message a person sees when starting a chat with this user.
|
|
809
817
|
* Default = no welcome message
|
|
818
|
+
*
|
|
819
|
+
* @remarks
|
|
820
|
+
* Welcome messages are rendered in the UI as messages, but they are not real messages.
|
|
821
|
+
* This means they do not appear when you list messages using the REST API or JS Data API, and you cannot reply or react to them.
|
|
810
822
|
*/
|
|
811
823
|
welcomeMessage?: string;
|
|
812
824
|
/**
|
|
@@ -2005,6 +2017,10 @@ export declare interface SetConversationParams {
|
|
|
2005
2017
|
/**
|
|
2006
2018
|
* System messages which are sent at the beginning of a conversation.
|
|
2007
2019
|
* Default = no messages.
|
|
2020
|
+
*
|
|
2021
|
+
* @remarks
|
|
2022
|
+
* Welcome messages are rendered in the UI as messages, but they are not real messages.
|
|
2023
|
+
* This means they do not appear when you list messages using the REST API or JS Data API, and you cannot reply or react to them.
|
|
2008
2024
|
*/
|
|
2009
2025
|
welcomeMessages?: string[] | null;
|
|
2010
2026
|
/**
|
|
@@ -2090,6 +2106,10 @@ export declare interface SetUserParams {
|
|
|
2090
2106
|
/**
|
|
2091
2107
|
* The default message a person sees when starting a chat with this user.
|
|
2092
2108
|
* Default = no welcome message
|
|
2109
|
+
*
|
|
2110
|
+
* @remarks
|
|
2111
|
+
* Welcome messages are rendered in the UI as messages, but they are not real messages.
|
|
2112
|
+
* This means they do not appear when you list messages using the REST API or JS Data API, and you cannot reply or react to them.
|
|
2093
2113
|
*/
|
|
2094
2114
|
welcomeMessage?: string | null;
|
|
2095
2115
|
/**
|
|
@@ -2719,6 +2739,10 @@ export declare interface UserSnapshot {
|
|
|
2719
2739
|
role: string;
|
|
2720
2740
|
/**
|
|
2721
2741
|
* The default message a person sees when starting a chat with this user
|
|
2742
|
+
*
|
|
2743
|
+
* @remarks
|
|
2744
|
+
* Welcome messages are rendered in the UI as messages, but they are not real messages.
|
|
2745
|
+
* This means they do not appear when you list messages using the REST API or JS Data API, and you cannot reply or react to them.
|
|
2722
2746
|
*/
|
|
2723
2747
|
welcomeMessage: string | null;
|
|
2724
2748
|
}
|
package/dist/talkSession.js
CHANGED
|
@@ -404,9 +404,9 @@ class A {
|
|
|
404
404
|
}
|
|
405
405
|
call(e2, t2, s2) {
|
|
406
406
|
return __async(this, null, function* () {
|
|
407
|
-
this.inactivityTimer.stop(), this.pendingCalls
|
|
407
|
+
this.inactivityTimer.stop(), this.pendingCalls++, this.logTrace("Called", t2, s2);
|
|
408
408
|
const n2 = yield this.connection.call(e2, t2, s2);
|
|
409
|
-
return this.pendingCalls--, "SUBSCRIBE" === e2 && n2.ok ? this.activeSubscriptions
|
|
409
|
+
return this.pendingCalls--, this.logTrace("Received", t2, s2), "SUBSCRIBE" === e2 && n2.ok ? (this.activeSubscriptions++, this.logTrace("Subscribed", t2, s2)) : "UNSUBSCRIBE" === e2 && n2.ok && (this.activeSubscriptions--, this.logTrace("Unsubscribed", t2, s2)), this.inactive && this.inactivityTimer.schedule(() => {
|
|
410
410
|
this.stateMachine.transition("stop");
|
|
411
411
|
}), n2;
|
|
412
412
|
});
|
|
@@ -417,6 +417,8 @@ class A {
|
|
|
417
417
|
isConnected() {
|
|
418
418
|
return "READY" === this.stateMachine.state;
|
|
419
419
|
}
|
|
420
|
+
logTrace(e2, t2, s2) {
|
|
421
|
+
}
|
|
420
422
|
}
|
|
421
423
|
class E {
|
|
422
424
|
constructor(e2, t2, s2) {
|
|
@@ -529,12 +531,12 @@ class I extends x {
|
|
|
529
531
|
this.connection.call("SUBSCRIBE", ["users"], { ids: e2 }).then((e3) => this.subscribeCalls.forEach((t2) => t2.deferred.resolve(e3)));
|
|
530
532
|
}
|
|
531
533
|
}
|
|
532
|
-
class
|
|
534
|
+
class S extends x {
|
|
533
535
|
constructor(e2, t2, s2) {
|
|
534
536
|
super(s2, () => this.sendMutate()), this.conversationId = e2, this.connection = t2, this.calls = [];
|
|
535
537
|
}
|
|
536
538
|
canPush(e2, t2) {
|
|
537
|
-
return !!
|
|
539
|
+
return !!S.isCorrectBatchTypeFor(e2, t2) && t2[1] === this.conversationId;
|
|
538
540
|
}
|
|
539
541
|
static isCorrectBatchTypeFor(e2, t2) {
|
|
540
542
|
return s(t2, ["conversations", "*", "participants", "*"]) && ("PUT" === e2 || "POST" === e2 || "PATCH" === e2);
|
|
@@ -555,7 +557,7 @@ class T extends x {
|
|
|
555
557
|
});
|
|
556
558
|
}
|
|
557
559
|
}
|
|
558
|
-
class
|
|
560
|
+
class T {
|
|
559
561
|
constructor(e2, t2, s2) {
|
|
560
562
|
this.pendingBatch = null, this.connection = new E(e2, t2, s2);
|
|
561
563
|
}
|
|
@@ -577,9 +579,9 @@ class S {
|
|
|
577
579
|
}
|
|
578
580
|
createEmptyBatchFor(e2, t2) {
|
|
579
581
|
if (I.isCorrectBatchTypeFor(e2, t2)) return new I(this.connection, () => this.pendingBatch = null);
|
|
580
|
-
if (
|
|
582
|
+
if (S.isCorrectBatchTypeFor(e2, t2)) {
|
|
581
583
|
const e3 = t2[1];
|
|
582
|
-
return new
|
|
584
|
+
return new S(e3, this.connection, () => this.pendingBatch = null);
|
|
583
585
|
}
|
|
584
586
|
return null;
|
|
585
587
|
}
|
|
@@ -587,7 +589,7 @@ class S {
|
|
|
587
589
|
const D = { 200: "RESOLVE", 400: "RESOLVE", 401: "RETRY", 402: "RESOLVE", 403: "RESOLVE", 404: "RESOLVE", 405: "RESOLVE", 409: "RESOLVE", 429: "DELAY", 500: "DELAY" };
|
|
588
590
|
class M {
|
|
589
591
|
constructor(e2, t2, s2) {
|
|
590
|
-
this.throttler = new F(), this.alive = true, this.connection = new
|
|
592
|
+
this.throttler = new F(), this.alive = true, this.connection = new T(e2, t2, s2);
|
|
591
593
|
}
|
|
592
594
|
call(e2, t2, s2) {
|
|
593
595
|
return __async(this, null, function* () {
|
|
@@ -769,7 +771,7 @@ class j {
|
|
|
769
771
|
}
|
|
770
772
|
class $ extends j {
|
|
771
773
|
constructor(e2, t2) {
|
|
772
|
-
super(e2), this.onTeardown = t2, this._error = null, this._lastGoodState = Promise.resolve(void 0);
|
|
774
|
+
super(e2), this.onTeardown = t2, this._error = null, this._lastGoodState = Promise.resolve(void 0), this.registerNewState(e2.resultPromise);
|
|
773
775
|
}
|
|
774
776
|
get error() {
|
|
775
777
|
return this._error;
|
|
@@ -799,7 +801,7 @@ class $ extends j {
|
|
|
799
801
|
class W extends $ {
|
|
800
802
|
constructor(e2, t2) {
|
|
801
803
|
const s2 = new Promise((e3) => setTimeout(e3)).then(() => this.fetchInitial(e2));
|
|
802
|
-
super({ seq: e2, resultPromise: s2 }, t2), this.initialSeq = e2, this.getDeepMutex = new U(), this.lastDeep = void 0;
|
|
804
|
+
super({ seq: e2, resultPromise: s2 }, t2.onTeardown), this.initialSeq = e2, this.getDeepMutex = new U(), this.lastDeep = void 0;
|
|
803
805
|
}
|
|
804
806
|
refetchInitial(e2) {
|
|
805
807
|
return __async(this, null, function* () {
|
|
@@ -868,15 +870,9 @@ class q extends W {
|
|
|
868
870
|
this.setError(l("UNSUBSCRIBED"));
|
|
869
871
|
}, this.unsubscribeDebounceMs);
|
|
870
872
|
}
|
|
871
|
-
getLoadMoreSeq() {
|
|
872
|
-
var _a2;
|
|
873
|
-
const e2 = (_a2 = this.lastEmitSeq) != null ? _a2 : 0, t2 = this.mostRecentState.seq;
|
|
874
|
-
return Math.max(e2, t2) + 1e-6;
|
|
875
|
-
}
|
|
876
873
|
emit(e2) {
|
|
877
874
|
return __async(this, null, function* () {
|
|
878
875
|
var _a2;
|
|
879
|
-
if (this.onlyUsedInternally) return;
|
|
880
876
|
if (this.lastEmitSeq && this.lastEmitSeq >= e2) return;
|
|
881
877
|
if (false === ((_a2 = this.lastEmitResult) == null ? void 0 : _a2.ok)) return;
|
|
882
878
|
this.lastEmitSeq = e2;
|
|
@@ -1082,7 +1078,7 @@ function se(e2, t2) {
|
|
|
1082
1078
|
}
|
|
1083
1079
|
class ne extends W {
|
|
1084
1080
|
constructor(e2, t2, s2, n2) {
|
|
1085
|
-
super(e2), this.conversationId = t2, this.message = s2, this.realtimeClient = n2;
|
|
1081
|
+
super(e2, {}), this.conversationId = t2, this.message = s2, this.realtimeClient = n2;
|
|
1086
1082
|
}
|
|
1087
1083
|
get messageId() {
|
|
1088
1084
|
return "string" == typeof this.message ? this.message : this.message.id;
|
|
@@ -1168,7 +1164,7 @@ function ie(e2) {
|
|
|
1168
1164
|
}
|
|
1169
1165
|
class ae extends W {
|
|
1170
1166
|
constructor(e2, t2, s2, n2) {
|
|
1171
|
-
super(e2), this.createdAt = t2, this.dataStore = s2, this.referencedDataStore = n2;
|
|
1167
|
+
super(e2, {}), this.createdAt = t2, this.dataStore = s2, this.referencedDataStore = n2;
|
|
1172
1168
|
}
|
|
1173
1169
|
get messageId() {
|
|
1174
1170
|
return this.dataStore.messageId;
|
|
@@ -1208,7 +1204,7 @@ class ae extends W {
|
|
|
1208
1204
|
}
|
|
1209
1205
|
class oe extends q {
|
|
1210
1206
|
constructor(e2, t2, s2, n2, r2) {
|
|
1211
|
-
super(e2, n2, r2), this.conversationId = t2, this.realtimeClient = s2, this.unsubscribeDebounceMs = 1e3, this.pendingLoadMore = void 0;
|
|
1207
|
+
super(e2, n2, r2), this.conversationId = t2, this.realtimeClient = s2, this.handlers = r2, this.unsubscribeDebounceMs = 1e3, this.pendingLoadMore = void 0;
|
|
1212
1208
|
}
|
|
1213
1209
|
listen(e2) {
|
|
1214
1210
|
return this.onlyUsedInternally && this.mostRecentState.resultPromise.then((e3) => {
|
|
@@ -1274,10 +1270,13 @@ class oe extends q {
|
|
|
1274
1270
|
const t2 = yield this.mostRecentState.resultPromise;
|
|
1275
1271
|
if (!t2.ok) return;
|
|
1276
1272
|
if (null === t2.value.windowEnd) return;
|
|
1277
|
-
const s2 = t2.value.windowEnd.cursor, n2 = yield ue({ count: e2, cursor: s2, conversationId: this.conversationId, realtimeClient: this.realtimeClient })
|
|
1278
|
-
this.
|
|
1273
|
+
const s2 = t2.value.windowEnd.cursor, n2 = yield ue({ count: e2, cursor: s2, conversationId: this.conversationId, realtimeClient: this.realtimeClient });
|
|
1274
|
+
yield this.handlers.onLoadedMore({ type: "virtual.messages.loadedmore", conversationId: this.conversationId, data: n2 });
|
|
1279
1275
|
});
|
|
1280
1276
|
}
|
|
1277
|
+
loadedMore(e2, t2) {
|
|
1278
|
+
this.mutate(e2, (s2) => null === s2.value.windowEnd ? s2 : t2.data.ok ? null === t2.data.value.messages ? (console.warn("[TalkJS] When loading more messages, the conversation no longer existed. We should have been told about this."), s2) : ce({ seq: e2, prevState: s2.value, messages: t2.data.value.messages, cursor: t2.data.value.nextCursor, conversationId: this.conversationId, realtimeClient: this.realtimeClient }) : t2.data);
|
|
1279
|
+
}
|
|
1281
1280
|
messageCreated(e2, t2) {
|
|
1282
1281
|
this.mutate(e2, (s2) => {
|
|
1283
1282
|
if (null === s2.value.stores) return console.warn("[TalkJS] Received a 'message.created' event for a nonexistent conversation."), s2;
|
|
@@ -1490,7 +1489,7 @@ class pe extends q {
|
|
|
1490
1489
|
}
|
|
1491
1490
|
class fe extends W {
|
|
1492
1491
|
constructor(e2, t2, s2, n2) {
|
|
1493
|
-
super(e2), this.conversationId = t2, this.participantData = s2, this.realtimeClient = n2;
|
|
1492
|
+
super(e2, {}), this.conversationId = t2, this.participantData = s2, this.realtimeClient = n2;
|
|
1494
1493
|
}
|
|
1495
1494
|
fetchInitial(e2) {
|
|
1496
1495
|
return __async(this, null, function* () {
|
|
@@ -1546,7 +1545,7 @@ class fe extends W {
|
|
|
1546
1545
|
}
|
|
1547
1546
|
class me extends q {
|
|
1548
1547
|
constructor(e2, t2, s2, n2, r2) {
|
|
1549
|
-
super(e2, n2, r2), this.conversationId = t2, this.realtimeClient = s2, this.unsubscribeDebounceMs = 1e3, this.pendingLoadMore = void 0;
|
|
1548
|
+
super(e2, n2, r2), this.conversationId = t2, this.realtimeClient = s2, this.handlers = r2, this.unsubscribeDebounceMs = 1e3, this.pendingLoadMore = void 0;
|
|
1550
1549
|
}
|
|
1551
1550
|
fetchInitial(e2) {
|
|
1552
1551
|
return __async(this, null, function* () {
|
|
@@ -1593,10 +1592,13 @@ class me extends q {
|
|
|
1593
1592
|
const t2 = yield this.mostRecentState.resultPromise;
|
|
1594
1593
|
if (!t2.ok) return;
|
|
1595
1594
|
if (null === t2.value.windowEnd) return;
|
|
1596
|
-
const s2 = t2.value.windowEnd.cursor, n2 = yield ge({ count: e2, cursor: s2, conversationId: this.conversationId, realtimeClient: this.realtimeClient })
|
|
1597
|
-
this.
|
|
1595
|
+
const s2 = t2.value.windowEnd.cursor, n2 = yield ge({ count: e2, cursor: s2, conversationId: this.conversationId, realtimeClient: this.realtimeClient });
|
|
1596
|
+
yield this.handlers.onLoadedMore({ type: "virtual.participants.loadedmore", conversationId: this.conversationId, data: n2 });
|
|
1598
1597
|
});
|
|
1599
1598
|
}
|
|
1599
|
+
loadedMore(e2, t2) {
|
|
1600
|
+
this.mutate(e2, (s2) => null === s2.value.windowEnd ? s2 : t2.data.ok ? null === t2.data.value.participants ? (console.warn("[TalkJS] When loading more participants, the conversation no longer existed. We should have been told about this."), s2) : ve({ seq: e2, prevStores: s2.value.stores, participants: t2.data.value.participants, cursor: t2.data.value.nextCursor, conversationId: this.conversationId, realtimeClient: this.realtimeClient }) : t2.data);
|
|
1601
|
+
}
|
|
1600
1602
|
participantCreated(e2, t2) {
|
|
1601
1603
|
this.mutate(e2, (s2) => {
|
|
1602
1604
|
if (null === s2.value.stores) return console.warn("[TalkJS] Received a 'participant.created' event for a nonexistent conversation."), s2;
|
|
@@ -1663,7 +1665,7 @@ function ve({ seq: e2, prevStores: t2, participants: s2, cursor: n2, conversatio
|
|
|
1663
1665
|
}
|
|
1664
1666
|
class we extends q {
|
|
1665
1667
|
constructor(e2, t2, s2, n2, r2) {
|
|
1666
|
-
super(e2, n2, r2), this.getConvDataStore = t2, this.realtimeClient = s2, this.unsubscribeDebounceMs = 1e3, this.pendingLoadMore = void 0;
|
|
1668
|
+
super(e2, n2, r2), this.getConvDataStore = t2, this.realtimeClient = s2, this.handlers = r2, this.unsubscribeDebounceMs = 1e3, this.pendingLoadMore = void 0;
|
|
1667
1669
|
}
|
|
1668
1670
|
fetchInitial(e2) {
|
|
1669
1671
|
return __async(this, null, function* () {
|
|
@@ -1712,8 +1714,8 @@ class we extends q {
|
|
|
1712
1714
|
const t2 = yield this.mostRecentState.resultPromise;
|
|
1713
1715
|
if (!t2.ok) return;
|
|
1714
1716
|
if (null === t2.value.windowEnd) return;
|
|
1715
|
-
const s2 = t2.value.windowEnd.cursor, n2 = yield be({ count: e2, cursor: s2, realtimeClient: this.realtimeClient })
|
|
1716
|
-
this.
|
|
1717
|
+
const s2 = t2.value.windowEnd.cursor, n2 = yield be({ count: e2, cursor: s2, realtimeClient: this.realtimeClient });
|
|
1718
|
+
yield this.handlers.onLoadedMore({ type: "virtual.conversations.loadedmore", data: n2 });
|
|
1717
1719
|
});
|
|
1718
1720
|
}
|
|
1719
1721
|
getConvFromCache(e2) {
|
|
@@ -1725,6 +1727,9 @@ class we extends q {
|
|
|
1725
1727
|
return void 0 === s2 ? l("NOT_IN_CACHE") : s2.store.getFromCache();
|
|
1726
1728
|
});
|
|
1727
1729
|
}
|
|
1730
|
+
loadedMore(e2, t2) {
|
|
1731
|
+
this.mutate(e2, (s2) => null === s2.value.windowEnd ? s2 : t2.data.ok ? null === t2.data.value.conversations ? (console.warn("[TalkJS] When loading more conversations, the user stopped existing, which should be impossible."), s2) : ye({ seq: e2, prevStores: s2.value.stores, conversations: t2.data.value.conversations, cursor: t2.data.value.nextCursor, getConvDataStore: this.getConvDataStore }) : t2.data);
|
|
1732
|
+
}
|
|
1728
1733
|
userCreated(e2, t2) {
|
|
1729
1734
|
this.mutate(e2, (e3) => null !== e3.value.stores ? e3 : c({ lastChanged: e3.value.lastChanged, stores: {}, windowEnd: null }));
|
|
1730
1735
|
}
|
|
@@ -1897,28 +1902,28 @@ class Ee extends q {
|
|
|
1897
1902
|
}
|
|
1898
1903
|
class ke {
|
|
1899
1904
|
constructor(e2, t2, s2) {
|
|
1900
|
-
this.realtimeClient = s2, this.convDataStores = {}, this.storeMap = {}, this.emitMutex = new U(), this.
|
|
1905
|
+
this.realtimeClient = s2, this.convDataStores = {}, this.storeMap = {}, this.emitMutex = new U(), this.virtualSeqOffset = 0, this.realPublishSeq = 0, this.refetchOnNextNetworkLoss = true, this.connection = new N(e2, t2, { onUpstreamRestarting: () => {
|
|
1901
1906
|
this.refetchOnNextNetworkLoss = false;
|
|
1902
1907
|
}, onReady: () => {
|
|
1903
1908
|
this.refetchOnNextNetworkLoss = true;
|
|
1904
1909
|
}, onResubscribeSent: () => {
|
|
1905
|
-
if (this.
|
|
1906
|
-
this.
|
|
1907
|
-
const e3 = this.
|
|
1910
|
+
if (this.virtualSeqOffset += this.realPublishSeq, this.realPublishSeq = 0, this.refetchOnNextNetworkLoss) {
|
|
1911
|
+
this.virtualSeqOffset++;
|
|
1912
|
+
const e3 = this.virtualSeq;
|
|
1908
1913
|
this.refetchAll(e3), this.emitAll(e3);
|
|
1909
1914
|
}
|
|
1910
1915
|
}, onResubscribeError: (e3, t3) => {
|
|
1911
1916
|
var _a2;
|
|
1912
1917
|
(_a2 = this.storeMap[xe(e3)]) == null ? void 0 : _a2.setError(t3);
|
|
1913
1918
|
}, onPublish: (e3, t3) => {
|
|
1914
|
-
this.
|
|
1915
|
-
const s3 = this.
|
|
1919
|
+
this.realPublishSeq = e3;
|
|
1920
|
+
const s3 = this.virtualSeq;
|
|
1916
1921
|
for (const e4 of t3) this.handlePublish(s3, e4);
|
|
1917
1922
|
this.emitAll(s3);
|
|
1918
1923
|
} });
|
|
1919
1924
|
}
|
|
1920
|
-
get
|
|
1921
|
-
return this.
|
|
1925
|
+
get virtualSeq() {
|
|
1926
|
+
return this.realPublishSeq + this.virtualSeqOffset;
|
|
1922
1927
|
}
|
|
1923
1928
|
refetchAll(e2) {
|
|
1924
1929
|
Object.values(this.storeMap).forEach((t2) => t2 == null ? void 0 : t2.refetch(e2));
|
|
@@ -1930,7 +1935,7 @@ class ke {
|
|
|
1930
1935
|
}));
|
|
1931
1936
|
}
|
|
1932
1937
|
handlePublish(e2, t2) {
|
|
1933
|
-
var _a2, _b, _c, _d, _e2, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t2, _u, _v, _w, _x, _y, _z, _A;
|
|
1938
|
+
var _a2, _b, _c, _d, _e2, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t2, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D;
|
|
1934
1939
|
switch (t2.type) {
|
|
1935
1940
|
case "user.created":
|
|
1936
1941
|
return (_a2 = this.storeMap[`/users/${t2.userId}`]) == null ? void 0 : _a2.userCreated(e2, t2), (_b = this.storeMap["/me/conversations"]) == null ? void 0 : _b.userCreated(e2, t2), void ((_c = this.storeMap[`/users/${t2.userId}/online`]) == null ? void 0 : _c.userCreated(e2, t2));
|
|
@@ -1964,6 +1969,12 @@ class ke {
|
|
|
1964
1969
|
return void ((_z = this.storeMap[`/me/conversations/${t2.conversationId}/participants`]) == null ? void 0 : _z.participantDeleted(e2, t2));
|
|
1965
1970
|
case "user.online.changed":
|
|
1966
1971
|
return void ((_A = this.storeMap[`/users/${t2.userId}/online`]) == null ? void 0 : _A.userOnlineChanged(e2, t2));
|
|
1972
|
+
case "virtual.conversations.loadedmore":
|
|
1973
|
+
return void ((_B = this.storeMap["/me/conversations"]) == null ? void 0 : _B.loadedMore(e2, t2));
|
|
1974
|
+
case "virtual.messages.loadedmore":
|
|
1975
|
+
return void ((_C = this.storeMap[`/me/conversations/${t2.conversationId}/messages`]) == null ? void 0 : _C.loadedMore(e2, t2));
|
|
1976
|
+
case "virtual.participants.loadedmore":
|
|
1977
|
+
return void ((_D = this.storeMap[`/me/conversations/${t2.conversationId}/participants`]) == null ? void 0 : _D.loadedMore(e2, t2));
|
|
1967
1978
|
}
|
|
1968
1979
|
}
|
|
1969
1980
|
call(e2, t2, n2, r2) {
|
|
@@ -2033,6 +2044,13 @@ class ke {
|
|
|
2033
2044
|
}
|
|
2034
2045
|
}, a2;
|
|
2035
2046
|
}
|
|
2047
|
+
onVirtualPublish(e2) {
|
|
2048
|
+
return __async(this, null, function* () {
|
|
2049
|
+
this.virtualSeqOffset++;
|
|
2050
|
+
const t2 = this.virtualSeq;
|
|
2051
|
+
this.handlePublish(t2, e2), yield this.emitAll(t2);
|
|
2052
|
+
});
|
|
2053
|
+
}
|
|
2036
2054
|
getOrCreateStore(e2) {
|
|
2037
2055
|
const t2 = xe(e2);
|
|
2038
2056
|
if (t2 in this.storeMap) return this.storeMap[t2];
|
|
@@ -2051,13 +2069,13 @@ class ke {
|
|
|
2051
2069
|
return this.connection.isConnected();
|
|
2052
2070
|
}
|
|
2053
2071
|
instantiateStore(e2, t2) {
|
|
2054
|
-
if (s(e2, ["users", "*"])) return new G(this.
|
|
2055
|
-
if (s(e2, ["me", "conversations", "*"])) return new le(this.
|
|
2056
|
-
if (s(e2, ["me", "conversations", "*", "messages"])) return new oe(this.
|
|
2057
|
-
if (s(e2, ["me", "conversations", "*", "participants"])) return new me(this.
|
|
2058
|
-
if (s(e2, ["me", "conversations", "*", "typing"])) return new pe(this.
|
|
2059
|
-
if (s(e2, ["me", "conversations"])) return new we(this.
|
|
2060
|
-
if (s(e2, ["users", "*", "online"])) return new Ee(this.
|
|
2072
|
+
if (s(e2, ["users", "*"])) return new G(this.virtualSeq, e2[1], this.realtimeClient, this.emitMutex, { onTeardown: t2 });
|
|
2073
|
+
if (s(e2, ["me", "conversations", "*"])) return new le(this.virtualSeq, this.subscribeConvData(e2[2]), this.realtimeClient, this.emitMutex, { onTeardown: t2 });
|
|
2074
|
+
if (s(e2, ["me", "conversations", "*", "messages"])) return new oe(this.virtualSeq, e2[2], this.realtimeClient, this.emitMutex, { onTeardown: t2, onLoadedMore: (e3) => this.onVirtualPublish(e3) });
|
|
2075
|
+
if (s(e2, ["me", "conversations", "*", "participants"])) return new me(this.virtualSeq, e2[2], this.realtimeClient, this.emitMutex, { onTeardown: t2, onLoadedMore: (e3) => this.onVirtualPublish(e3) });
|
|
2076
|
+
if (s(e2, ["me", "conversations", "*", "typing"])) return new pe(this.virtualSeq, e2[2], this.realtimeClient, this.emitMutex, { onTeardown: t2 });
|
|
2077
|
+
if (s(e2, ["me", "conversations"])) return new we(this.virtualSeq, (e3) => this.subscribeConvData(e3), this.realtimeClient, this.emitMutex, { onTeardown: t2, onLoadedMore: (e3) => this.onVirtualPublish(e3) });
|
|
2078
|
+
if (s(e2, ["users", "*", "online"])) return new Ee(this.virtualSeq, e2[1], this.realtimeClient, this.emitMutex, { onTeardown: t2 });
|
|
2061
2079
|
throw "Unreachable";
|
|
2062
2080
|
}
|
|
2063
2081
|
subscribeConvData(e2) {
|
|
@@ -2066,9 +2084,9 @@ class ke {
|
|
|
2066
2084
|
const e3 = this.convDataStores[t2];
|
|
2067
2085
|
return { store: e3, unsubscribe: e3.registerInternalSubscription() };
|
|
2068
2086
|
}
|
|
2069
|
-
const s2 = new Ce(this.
|
|
2087
|
+
const s2 = new Ce(this.virtualSeq, e2, this.realtimeClient, this.emitMutex, { onTeardown: () => {
|
|
2070
2088
|
delete this.convDataStores[t2];
|
|
2071
|
-
});
|
|
2089
|
+
} });
|
|
2072
2090
|
return this.convDataStores[t2] = s2, { store: s2, unsubscribe: s2.registerInternalSubscription() };
|
|
2073
2091
|
}
|
|
2074
2092
|
}
|
|
@@ -2102,7 +2120,7 @@ class Ie {
|
|
|
2102
2120
|
listMessages(e2, t2) {
|
|
2103
2121
|
return __async(this, null, function* () {
|
|
2104
2122
|
const s2 = yield this.call("GET", ["me", "conversations", e2, "messages"], t2);
|
|
2105
|
-
if (!s2.ok) return
|
|
2123
|
+
if (!s2.ok) return Se(s2, "Listing messages in " + e2);
|
|
2106
2124
|
const n2 = s2.value.data.data, r2 = yield Promise.all(n2.map((t3) => this.createMessageSnapshot(t3, e2))), i2 = r2.find((e3) => !e3.ok);
|
|
2107
2125
|
if (void 0 !== i2 && !i2.ok) return i2;
|
|
2108
2126
|
return c(r2.map(({ value: e3 }) => e3));
|
|
@@ -2131,7 +2149,7 @@ class Ie {
|
|
|
2131
2149
|
const s2 = yield this.call("GET", ["me", "conversations", e2, "messages", t2], {});
|
|
2132
2150
|
if (!s2.ok && "server" === s2.where && 404 === s2.value.status) return c(null);
|
|
2133
2151
|
if (!s2.ok && "server" === s2.where && 403 === s2.value.status && "NOT_A_PARTICIPANT" === s2.value.errorCode) return c(null);
|
|
2134
|
-
if (!s2.ok) return
|
|
2152
|
+
if (!s2.ok) return Se(s2, `Fetching referenced message ${t2} in conversation ${e2}`);
|
|
2135
2153
|
const n2 = s2.value.data, r2 = yield this.getUser(n2.senderId);
|
|
2136
2154
|
if (!r2.ok) return r2;
|
|
2137
2155
|
const i2 = r2.value;
|
|
@@ -2142,7 +2160,7 @@ class Ie {
|
|
|
2142
2160
|
return __async(this, null, function* () {
|
|
2143
2161
|
const t2 = yield this.call("GET", ["users", e2], { includePrivateFields: false });
|
|
2144
2162
|
if (!t2.ok && "server" === t2.where && 404 === t2.value.status) return c(null);
|
|
2145
|
-
if (!t2.ok) return
|
|
2163
|
+
if (!t2.ok) return Se(t2, "Get user " + e2);
|
|
2146
2164
|
return c(this.createUserSnapshot(t2.value.data));
|
|
2147
2165
|
});
|
|
2148
2166
|
}
|
|
@@ -2153,10 +2171,10 @@ class Ie {
|
|
|
2153
2171
|
return { id: e2.id, type: e2.type, sender: t2, referencedMessageId: e2.referencedMessageId, custom: e2.custom, createdAt: e2.createdAt, editedAt: e2.editedAt, origin: e2.origin, content: e2.content, reactions: ie(e2.reactions), plaintext: te(e2.content, {}) };
|
|
2154
2172
|
}
|
|
2155
2173
|
}
|
|
2156
|
-
function
|
|
2174
|
+
function Se(e2, t2) {
|
|
2157
2175
|
return "server" === e2.where ? h(__spreadProps(__spreadValues({}, e2.value), { operation: t2 })) : e2;
|
|
2158
2176
|
}
|
|
2159
|
-
function
|
|
2177
|
+
function Te(e2, s2) {
|
|
2160
2178
|
var _a2;
|
|
2161
2179
|
if (s2.ok) return s2.value;
|
|
2162
2180
|
throw "SESSION_DESTROYED" === s2.value ? new Error(`${e2} failed because the session was destroyed`) : new Error(t((_a2 = s2.value.operation) != null ? _a2 : e2, s2.value));
|
|
@@ -2171,7 +2189,7 @@ class De {
|
|
|
2171
2189
|
get() {
|
|
2172
2190
|
return __async(this, null, function* () {
|
|
2173
2191
|
const e2 = yield this._realtimeClient.getUser(this.brandedId);
|
|
2174
|
-
return
|
|
2192
|
+
return Te("Get user " + this.id, e2);
|
|
2175
2193
|
});
|
|
2176
2194
|
}
|
|
2177
2195
|
set(t2) {
|
|
@@ -2737,7 +2755,7 @@ var Qe, Ve = function() {
|
|
|
2737
2755
|
}, e2.urlMatchDoesNotHaveAtLeastOneWordChar = function(e3, t2) {
|
|
2738
2756
|
return !(!e3 || !t2) && (!this.hasFullProtocolRegex.test(t2) && !this.hasWordCharAfterProtocolRegex.test(e3));
|
|
2739
2757
|
}, e2.hasFullProtocolRegex = /^[A-Za-z][-.+A-Za-z0-9]*:\/\//, e2.uriSchemeRegex = /^[A-Za-z][-.+A-Za-z0-9]*:/, e2.hasWordCharAfterProtocolRegex = new RegExp(":[^\\s]*?[" + ct + "]"), e2.ipRegex = /[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?(:[0-9]*)?\/?$/, e2;
|
|
2740
|
-
}(), xt = (Qe = new RegExp("[/?#](?:[" + pt + "\\-+&@#/%=~_()|'$*\\[\\]{}?!:,.;^✓]*[" + pt + "\\-+&@#/%=~_()|'$*\\[\\]{}✓])?"), new RegExp(["(?:", "(", /(?:[A-Za-z][-.+A-Za-z0-9]{0,63}:(?![A-Za-z][-.+A-Za-z0-9]{0,63}:\/\/)(?!\d+\/?)(?:\/\/)?)/.source, vt(2), ")", "|", "(", "(//)?", /(?:www\.)/.source, vt(6), ")", "|", "(", "(//)?", vt(10) + "\\.", bt.source, "(?![-" + dt + "])", ")", ")", "(?::[0-9]+)?", "(?:" + Qe.source + ")?"].join(""), "gi")), It = new RegExp("[" + pt + "]"),
|
|
2758
|
+
}(), xt = (Qe = new RegExp("[/?#](?:[" + pt + "\\-+&@#/%=~_()|'$*\\[\\]{}?!:,.;^✓]*[" + pt + "\\-+&@#/%=~_()|'$*\\[\\]{}✓])?"), new RegExp(["(?:", "(", /(?:[A-Za-z][-.+A-Za-z0-9]{0,63}:(?![A-Za-z][-.+A-Za-z0-9]{0,63}:\/\/)(?!\d+\/?)(?:\/\/)?)/.source, vt(2), ")", "|", "(", "(//)?", /(?:www\.)/.source, vt(6), ")", "|", "(", "(//)?", vt(10) + "\\.", bt.source, "(?![-" + dt + "])", ")", ")", "(?::[0-9]+)?", "(?:" + Qe.source + ")?"].join(""), "gi")), It = new RegExp("[" + pt + "]"), St = function(e2) {
|
|
2741
2759
|
function t2(t3) {
|
|
2742
2760
|
var s2 = e2.call(this, t3) || this;
|
|
2743
2761
|
return s2.stripPrefix = { scheme: true, www: true }, s2.stripTrailingSlash = true, s2.decodePercentEncoding = true, s2.matcherRegex = xt, s2.wordCharRegExp = It, s2.stripPrefix = t3.stripPrefix, s2.stripTrailingSlash = t3.stripTrailingSlash, s2.decodePercentEncoding = t3.decodePercentEncoding, s2;
|
|
@@ -2784,10 +2802,10 @@ var Qe, Ve = function() {
|
|
|
2784
2802
|
var n2 = new RegExp("^((.?//)?[-." + pt + "]*[-" + pt + "]\\.[-" + pt + "]+)").exec(e3);
|
|
2785
2803
|
return null === n2 ? -1 : (s2 += n2[1].length, e3 = e3.slice(n2[1].length), /^[^-.A-Za-z0-9:\/?#]/.test(e3) ? s2 : -1);
|
|
2786
2804
|
}, t2;
|
|
2787
|
-
}(st),
|
|
2805
|
+
}(st), Tt = new RegExp("#[_" + pt + "]{1,139}(?![_" + pt + "])", "g"), Dt = new RegExp("[^" + pt + "]"), Mt = function(e2) {
|
|
2788
2806
|
function t2(t3) {
|
|
2789
2807
|
var s2 = e2.call(this, t3) || this;
|
|
2790
|
-
return s2.serviceName = "twitter", s2.matcherRegex =
|
|
2808
|
+
return s2.serviceName = "twitter", s2.matcherRegex = Tt, s2.nonWordCharRegex = Dt, s2.serviceName = t3.serviceName, s2;
|
|
2791
2809
|
}
|
|
2792
2810
|
return Ye(t2, e2), t2.prototype.parseMatches = function(e3) {
|
|
2793
2811
|
for (var t3, s2 = this.matcherRegex, n2 = this.nonWordCharRegex, r2 = this.serviceName, i2 = this.tagBuilder, a2 = []; null !== (t3 = s2.exec(e3)); ) {
|
|
@@ -2872,10 +2890,10 @@ function Ut(e2, t2) {
|
|
|
2872
2890
|
I2(f2);
|
|
2873
2891
|
break;
|
|
2874
2892
|
case 12:
|
|
2875
|
-
|
|
2893
|
+
S2(f2);
|
|
2876
2894
|
break;
|
|
2877
2895
|
case 13:
|
|
2878
|
-
|
|
2896
|
+
T2();
|
|
2879
2897
|
break;
|
|
2880
2898
|
case 14:
|
|
2881
2899
|
D2(f2);
|
|
@@ -2939,10 +2957,10 @@ function Ut(e2, t2) {
|
|
|
2939
2957
|
function I2(e3) {
|
|
2940
2958
|
at.test(e3) ? h2 = 4 : "/" === e3 ? h2 = 12 : ">" === e3 ? U2() : "<" === e3 ? O2() : (h2 = 4, c2--);
|
|
2941
2959
|
}
|
|
2942
|
-
function
|
|
2960
|
+
function S2(e3) {
|
|
2943
2961
|
">" === e3 ? (p2 = new jt(Ve(Ve({}, p2), { isClosing: true })), U2()) : h2 = 4;
|
|
2944
2962
|
}
|
|
2945
|
-
function
|
|
2963
|
+
function T2(t3) {
|
|
2946
2964
|
"--" === e2.substr(c2, 2) ? (c2 += 2, p2 = new jt(Ve(Ve({}, p2), { type: "comment" })), h2 = 14) : "DOCTYPE" === e2.substr(c2, 7).toUpperCase() ? (c2 += 7, p2 = new jt(Ve(Ve({}, p2), { type: "doctype" })), h2 = 20) : P2();
|
|
2947
2965
|
}
|
|
2948
2966
|
function D2(e3) {
|
|
@@ -3082,12 +3100,12 @@ var jt = function(e2) {
|
|
|
3082
3100
|
return this.replaceFn && (t2 = this.replaceFn.call(this.context, e3)), "string" == typeof t2 ? t2 : false === t2 ? e3.getMatchedText() : t2 instanceof Ge ? t2.toAnchorString() : e3.buildTag().toAnchorString();
|
|
3083
3101
|
}, e2.prototype.getMatchers = function() {
|
|
3084
3102
|
if (this.matchers) return this.matchers;
|
|
3085
|
-
var e3 = this.getTagBuilder(), t2 = [new Mt({ tagBuilder: e3, serviceName: this.hashtag }), new At({ tagBuilder: e3 }), new Bt({ tagBuilder: e3 }), new Ot({ tagBuilder: e3, serviceName: this.mention }), new
|
|
3103
|
+
var e3 = this.getTagBuilder(), t2 = [new Mt({ tagBuilder: e3, serviceName: this.hashtag }), new At({ tagBuilder: e3 }), new Bt({ tagBuilder: e3 }), new Ot({ tagBuilder: e3, serviceName: this.mention }), new St({ tagBuilder: e3, stripPrefix: this.stripPrefix, stripTrailingSlash: this.stripTrailingSlash, decodePercentEncoding: this.decodePercentEncoding })];
|
|
3086
3104
|
return this.matchers = t2;
|
|
3087
3105
|
}, e2.prototype.getTagBuilder = function() {
|
|
3088
3106
|
var e3 = this.tagBuilder;
|
|
3089
3107
|
return e3 || (e3 = this.tagBuilder = new Le({ newWindow: this.newWindow, truncate: this.truncate, className: this.className })), e3;
|
|
3090
|
-
}, e2.version = "3.14.3", e2.AnchorTagBuilder = Le, e2.HtmlTag = Ge, e2.matcher = { Email: At, Hashtag: Mt, Matcher: st, Mention: Ot, Phone: Bt, Url:
|
|
3108
|
+
}, e2.version = "3.14.3", e2.AnchorTagBuilder = Le, e2.HtmlTag = Ge, e2.matcher = { Email: At, Hashtag: Mt, Matcher: st, Mention: Ot, Phone: Bt, Url: St }, e2.match = { Email: Ze, Hashtag: Ke, Match: ze, Mention: Xe, Phone: et, Url: tt }, e2;
|
|
3091
3109
|
}();
|
|
3092
3110
|
function Wt(e2, t2 = e2) {
|
|
3093
3111
|
return { type: "autolink", url: e2, text: t2 };
|
|
@@ -3218,7 +3236,7 @@ class us {
|
|
|
3218
3236
|
if (!t2.ok && "server" === t2.where && 404 === t2.value.status) return null;
|
|
3219
3237
|
if (!t2.ok && "server" === t2.where && 403 === t2.value.status && "NOT_A_PARTICIPANT" === t2.value.errorCode) return null;
|
|
3220
3238
|
const s2 = e("Get message " + this.id, t2), n2 = yield this._realtimeClient.createMessageSnapshot(s2, this.brandedConversationId);
|
|
3221
|
-
return
|
|
3239
|
+
return Te("Get message " + this.id, n2);
|
|
3222
3240
|
});
|
|
3223
3241
|
}
|
|
3224
3242
|
edit(t2) {
|
|
@@ -3270,7 +3288,7 @@ class ls {
|
|
|
3270
3288
|
return __async(this, null, function* () {
|
|
3271
3289
|
const t2 = this._realtimeClient.listMessages(this.brandedId, { limit: 1 }), s2 = yield this._realtimeClient.call("GET", ["me", "conversations", this.brandedId], {});
|
|
3272
3290
|
if (!s2.ok && "server" === s2.where && 404 === s2.value.status) return null;
|
|
3273
|
-
const n2 = e("Get conversation " + this.id, s2), r2 =
|
|
3291
|
+
const n2 = e("Get conversation " + this.id, s2), r2 = Te("Get last message in conversation " + this.id, yield t2), i2 = 0 === r2.length ? null : r2[0];
|
|
3274
3292
|
return this._realtimeClient.createConversationSnapshotPreloaded(n2, i2);
|
|
3275
3293
|
});
|
|
3276
3294
|
}
|
|
@@ -3378,7 +3396,7 @@ class ps {
|
|
|
3378
3396
|
function fs({ method: e2, url: t2, data: s2, options: n2, attempts: r2, shouldRetry: i2, authProvider: o2 }) {
|
|
3379
3397
|
var _a2;
|
|
3380
3398
|
(!r2 || r2 <= 0) && (r2 = 1);
|
|
3381
|
-
const u2 = { "x-talkjs-client-build": "jssdk-dev", "x-talkjs-client-date": "2025-
|
|
3399
|
+
const u2 = { "x-talkjs-client-build": "jssdk-dev", "x-talkjs-client-date": "2025-09-25T14:26:35.703Z" };
|
|
3382
3400
|
s2 instanceof FormData || (u2["Content-Type"] = (_a2 = n2 == null ? void 0 : n2.contentType) != null ? _a2 : "application/json");
|
|
3383
3401
|
return a(r2, () => __async(this, null, function* () {
|
|
3384
3402
|
if (o2) {
|
|
@@ -3431,7 +3449,7 @@ const Cs = gs.startsWith("app.talkjs.com");
|
|
|
3431
3449
|
const As = "undefined" == typeof window ? { log: (e2) => Promise.resolve(), setData: (e2) => {
|
|
3432
3450
|
} } : new class {
|
|
3433
3451
|
constructor(e2) {
|
|
3434
|
-
this._timeCreated = Date.now(), this._enabled = Cs, this._trackJSData = { customer: { application: "", correlationId: "", sessionId: "", token: "", userId: "", version: "dev-2025-
|
|
3452
|
+
this._timeCreated = Date.now(), this._enabled = Cs, this._trackJSData = { customer: { application: "", correlationId: "", sessionId: "", token: "", userId: "", version: "dev-2025-09-25T14:26:35.703Z" }, entry: "direct", environment: { age: Date.now() - this._timeCreated, dependencies: {}, originalUrl: window.location.href, referrer: document.referrer, userAgent: window.navigator.userAgent }, metadata: [], nav: [], network: [], url: window.location.href, stack: "", timestamp: (/* @__PURE__ */ new Date()).toISOString(), version: "dev-2025-09-25T14:26:35.703Z", throttled: 0 }, this._url = `https://capture.trackjs.com/capture?token=${e2}`, this._trackJSData.customer.token = e2;
|
|
3435
3453
|
}
|
|
3436
3454
|
setData({ appId: e2, meId: t2, sessionId: s2 }) {
|
|
3437
3455
|
this._trackJSData.customer.userId = e2, this._trackJSData.customer.sessionId = `${e2}/${t2}`, this._trackJSData.customer.correlationId = s2;
|
|
@@ -3659,7 +3677,7 @@ class Is {
|
|
|
3659
3677
|
return this.target;
|
|
3660
3678
|
}
|
|
3661
3679
|
}
|
|
3662
|
-
const
|
|
3680
|
+
const Ss = new class {
|
|
3663
3681
|
constructor() {
|
|
3664
3682
|
this.registry = {};
|
|
3665
3683
|
}
|
|
@@ -3678,8 +3696,9 @@ const Ts = new class {
|
|
|
3678
3696
|
return `${e2}:${t2}`;
|
|
3679
3697
|
}
|
|
3680
3698
|
}();
|
|
3681
|
-
function
|
|
3682
|
-
|
|
3699
|
+
function Ts(e2) {
|
|
3700
|
+
if (!e2) throw new Error("[TalkJS] Must provide an options object to `getTalkSession`");
|
|
3701
|
+
return e2.forceCreateNew ? new Ds(e2) : Ss.getOrCreate(e2);
|
|
3683
3702
|
}
|
|
3684
3703
|
class Ds {
|
|
3685
3704
|
constructor(e2) {
|
|
@@ -3693,7 +3712,7 @@ class Ds {
|
|
|
3693
3712
|
const { appId: t2, userId: s2, token: n2, tokenFetcher: r2, signature: i2 } = e2;
|
|
3694
3713
|
this._appId = t2, this._apiUrls = e2.apiUrls ? new ps(e2.apiUrls.realtimeWsApiUrl, e2.apiUrls.internalHttpApiUrl, e2.apiUrls.restApiHttpUrl) : ps.fromHost(e2.host), this._authProvider = new ks(this._apiUrls, t2, s2, n2, r2, i2);
|
|
3695
3714
|
const a2 = Math.random().toString().split(".")[1];
|
|
3696
|
-
this._realtimeClient = new Ie(this._apiUrls.getRealtimeWsUrl(t2, s2, "1.5.
|
|
3715
|
+
this._realtimeClient = new Ie(this._apiUrls.getRealtimeWsUrl(t2, s2, "1.5.3", a2, e2.clientBuild), s2, this._authProvider), this.currentUser = new De(this._realtimeClient.userId, this._realtimeClient), this._terminationReason = o(), this._terminationReason.promise.then((e3) => {
|
|
3697
3716
|
console.error(`[TalkSession] ${e3}`);
|
|
3698
3717
|
}), function(e3, t3, s3) {
|
|
3699
3718
|
return __async(this, null, function* () {
|
|
@@ -3731,7 +3750,7 @@ class Ds {
|
|
|
3731
3750
|
return this._realtimeClient.subscribe(["me", "conversations"], e2);
|
|
3732
3751
|
}
|
|
3733
3752
|
terminate(e2) {
|
|
3734
|
-
|
|
3753
|
+
Ss.deregister(this._appId, this.currentUser.id), this._terminationReason.resolve(e2), this._realtimeClient.destroy();
|
|
3735
3754
|
}
|
|
3736
3755
|
_isConnected() {
|
|
3737
3756
|
return this._realtimeClient.isConnected();
|
|
@@ -3765,7 +3784,7 @@ function Ms(_0, _1, _2, _3) {
|
|
|
3765
3784
|
});
|
|
3766
3785
|
}
|
|
3767
3786
|
export {
|
|
3768
|
-
|
|
3787
|
+
Ts as getTalkSession,
|
|
3769
3788
|
f as registerPolyfills
|
|
3770
3789
|
};
|
|
3771
3790
|
//# sourceMappingURL=talkSession.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@talkjs/core",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.4",
|
|
4
4
|
"description": "Lets you connect to your TalkJS chat as a user and read, subscribe to, and update your chat data.",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://talkjs.com/?chat"
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
"scripts": {
|
|
29
|
+
"dev": "vite demo",
|
|
29
30
|
"typecheck": "tsc",
|
|
30
31
|
"lint": "eslint --max-warnings=0",
|
|
31
32
|
"test": "vitest run",
|