@talkjs/core 1.6.0 → 1.6.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/README.md +9 -1
- package/dist/talkSession.cjs +1 -1
- package/dist/talkSession.js +60 -51
- package/package.json +1 -1
package/dist/talkSession.js
CHANGED
|
@@ -353,7 +353,8 @@ class C {
|
|
|
353
353
|
this.connection.stopWs();
|
|
354
354
|
}
|
|
355
355
|
startWs() {
|
|
356
|
-
this.connection.startWs()
|
|
356
|
+
this.connection.startWs(), this.authProvider.getToken().catch(() => {
|
|
357
|
+
});
|
|
357
358
|
}
|
|
358
359
|
destroy() {
|
|
359
360
|
this.stateMachine.transition("destroy");
|
|
@@ -738,10 +739,10 @@ function P(e2) {
|
|
|
738
739
|
}
|
|
739
740
|
}(e3)));
|
|
740
741
|
}
|
|
741
|
-
function
|
|
742
|
+
function j(e2, t2) {
|
|
742
743
|
return void 0 === t2 ? e2 : t2;
|
|
743
744
|
}
|
|
744
|
-
function
|
|
745
|
+
function U(e2, t2) {
|
|
745
746
|
return void 0 === t2 ? e2 : _(t2);
|
|
746
747
|
}
|
|
747
748
|
function $(e2, t2) {
|
|
@@ -958,7 +959,7 @@ function V(e2, t2) {
|
|
|
958
959
|
const s2 = t2.lastIndex;
|
|
959
960
|
let n2;
|
|
960
961
|
const r2 = [];
|
|
961
|
-
for (; null !== (n2 = t2.exec(e2)); ) r2.push(n2);
|
|
962
|
+
for (; null !== (n2 = t2.exec(e2)); ) r2.push(n2), "" === n2[0] && (t2.lastIndex += 1);
|
|
962
963
|
return t2.lastIndex = s2, r2;
|
|
963
964
|
}
|
|
964
965
|
function Z(e2) {
|
|
@@ -1014,8 +1015,12 @@ function se(e2) {
|
|
|
1014
1015
|
return s2 = s2.replace(/[^im]/g, "") + "g", new RegExp(t2[1], s2);
|
|
1015
1016
|
}
|
|
1016
1017
|
class ne {
|
|
1017
|
-
constructor({ mode: e2, allowedHostnames: t2, allowedPhoneNrs: s2, allowedMatches: n2, forbiddenMatches: r2,
|
|
1018
|
-
X.oneOf(e2, ["all", "otherOnly", "off"]), this.mode = e2, this.suppressLinks = false !==
|
|
1018
|
+
constructor({ mode: e2, allowedHostnames: t2, allowedPhoneNrs: s2, allowedMatches: n2, forbiddenMatches: r2, forbiddenWords: i2, suppressLinks: a2, suppressEmailAddresses: o2, suppressPhoneNumbers: u2, replacement: c2 }) {
|
|
1019
|
+
if (X.oneOf(e2, ["all", "otherOnly", "off"]), this.mode = e2, this.suppressLinks = false !== a2, this.suppressEmailAddresses = false !== o2, this.suppressPhoneNumbers = false !== u2, this.allowedHostnames = t2 || [], this.allowedPhoneNrs = (s2 || []).filter((e3) => e3).map((e3) => e3.replace(/[^0-9]/g, "")), this.allowedMatches = (n2 || []).filter(te).map((e3) => se(e3)), this.forbiddenMatches = (r2 || []).filter(te).map((e3) => se(e3)), i2) {
|
|
1020
|
+
const e3 = i2.split("\n").map((e4) => e4.trim().toLowerCase()).filter((e4) => e4.length > 0 && !e4.startsWith("#")).map((e4) => e4.replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1"));
|
|
1021
|
+
e3.length && this.forbiddenMatches.push(new RegExp(`\\b(${e3.join("|")})\\b`, "gi"));
|
|
1022
|
+
}
|
|
1023
|
+
X(() => this.allowedMatches.every((e3) => e3.flags.includes("g")), "All regexes in `suppressContactInfo.allowedMatches` must be global. Check `allowedMatches`!"), X(() => this.forbiddenMatches.every((e3) => e3.flags.includes("g")), "All regexes in `suppressContactInfo.forbiddenMatches` must be global. Check `forbiddenMatches`!"), c2 = c2 == null ? void 0 : c2.trim(), this.replacement = c2 && c2.length > 0 ? c2 : void 0;
|
|
1019
1024
|
}
|
|
1020
1025
|
shouldSuppress({ isContentBySender: e2 }) {
|
|
1021
1026
|
return "all" === this.mode || "otherOnly" === this.mode && !e2;
|
|
@@ -1117,7 +1122,7 @@ class ce extends z {
|
|
|
1117
1122
|
this.mutate(e2, (s2) => {
|
|
1118
1123
|
const n2 = s2.value.snapshot;
|
|
1119
1124
|
if (null === n2) return console.warn("[TalkJS] Received a 'used edited' event for a user that we thought didn't exist."), s2;
|
|
1120
|
-
return c({ snapshot: { id: n2.id, name:
|
|
1125
|
+
return c({ snapshot: { id: n2.id, name: j(n2.name, t2.diff.name), custom: $(n2.custom, t2.diff.custom), locale: j(n2.locale, t2.diff.locale), photoUrl: j(n2.photoUrl, t2.diff.photoUrl), role: j(n2.role, t2.diff.role), welcomeMessage: j(n2.welcomeMessage, t2.diff.welcomeMessage) }, lastChanged: e2 });
|
|
1121
1126
|
});
|
|
1122
1127
|
}
|
|
1123
1128
|
getFromCache() {
|
|
@@ -1186,7 +1191,7 @@ class le extends G {
|
|
|
1186
1191
|
const n2 = s2.value.data.content, r2 = (i2 = n2, void 0 === (a2 = t2.diff.content) ? i2 : O(a2));
|
|
1187
1192
|
var i2, a2;
|
|
1188
1193
|
const o2 = n2 === r2 ? s2.value.data.plaintext : re(r2, {});
|
|
1189
|
-
return c({ lastChanged: e2, sender: s2.value.sender, data: { id: s2.value.data.id, type: s2.value.data.type, createdAt: s2.value.data.createdAt, origin: s2.value.data.origin, referencedMessageId: s2.value.data.referencedMessageId, editedAt:
|
|
1194
|
+
return c({ lastChanged: e2, sender: s2.value.sender, data: { id: s2.value.data.id, type: s2.value.data.type, createdAt: s2.value.data.createdAt, origin: s2.value.data.origin, referencedMessageId: s2.value.data.referencedMessageId, editedAt: j(s2.value.data.editedAt, t2.diff.editedAt), custom: $(s2.value.data.custom, t2.diff.custom), plaintext: o2, content: r2, reactions: he(s2.value.data.reactions, t2.diff.reactions) } });
|
|
1190
1195
|
});
|
|
1191
1196
|
}
|
|
1192
1197
|
messageDeleted(e2, t2) {
|
|
@@ -1211,7 +1216,7 @@ function he(e2, t2) {
|
|
|
1211
1216
|
if (void 0 === t2) return e2;
|
|
1212
1217
|
const s2 = e2.map((e3) => {
|
|
1213
1218
|
const s3 = t2[e3.emoji];
|
|
1214
|
-
return void 0 === s3 ? e3 : _(null === s3 ? __spreadProps(__spreadValues({}, e3), { count: 0 }) : { emoji: e3.emoji, count:
|
|
1219
|
+
return void 0 === s3 ? e3 : _(null === s3 ? __spreadProps(__spreadValues({}, e3), { count: 0 }) : { emoji: e3.emoji, count: j(e3.count, s3.count), currentUserReacted: j(e3.currentUserReacted, s3.currentUserReacted) });
|
|
1215
1220
|
}).filter((e3) => e3.count > 0), n2 = new Set(s2.map((e3) => e3.emoji));
|
|
1216
1221
|
for (const e3 in t2) {
|
|
1217
1222
|
const r2 = t2[e3];
|
|
@@ -1583,7 +1588,7 @@ class ye extends G {
|
|
|
1583
1588
|
participantEdited(e2, t2) {
|
|
1584
1589
|
this.mutate(e2, (s2) => {
|
|
1585
1590
|
if (null === s2.value.data) return s2;
|
|
1586
|
-
return c({ lastChanged: e2, user: s2.value.user, data: { id: s2.value.data.id, access:
|
|
1591
|
+
return c({ lastChanged: e2, user: s2.value.user, data: { id: s2.value.data.id, access: j(s2.value.data.access, t2.diff.access), notify: j(s2.value.data.notify, t2.diff.notify), joinedAt: s2.value.data.joinedAt } });
|
|
1587
1592
|
});
|
|
1588
1593
|
}
|
|
1589
1594
|
participantDeleted(e2, t2) {
|
|
@@ -1908,7 +1913,7 @@ class Ie extends z {
|
|
|
1908
1913
|
}
|
|
1909
1914
|
function De(e2, t2) {
|
|
1910
1915
|
const s2 = t2;
|
|
1911
|
-
return { id: e2.id, createdAt: e2.createdAt, subject:
|
|
1916
|
+
return { id: e2.id, createdAt: e2.createdAt, subject: j(e2.subject, s2.subject), photoUrl: j(e2.photoUrl, s2.photoUrl), welcomeMessages: U(e2.welcomeMessages, s2.welcomeMessages), custom: $(e2.custom, s2.custom), lastMessageAt: j(e2.lastMessageAt, s2.lastMessageAt), unreadMessageCount: j(e2.unreadMessageCount, s2.unreadMessageCount), isUnread: j(e2.isUnread, s2.isUnread), access: j(e2.access, s2.access), notify: j(e2.notify, s2.notify), readUntil: j(e2.readUntil, s2.readUntil), everyoneReadUntil: j(e2.everyoneReadUntil, s2.everyoneReadUntil), joinedAt: e2.joinedAt };
|
|
1912
1917
|
}
|
|
1913
1918
|
class Se extends z {
|
|
1914
1919
|
constructor(e2, t2, s2, n2, r2) {
|
|
@@ -2324,7 +2329,7 @@ function Pe(e2) {
|
|
|
2324
2329
|
if (20 != a2.length) throw new Error("Length should be 20.");
|
|
2325
2330
|
return a2;
|
|
2326
2331
|
}
|
|
2327
|
-
const
|
|
2332
|
+
const je = (e2, t2, s2 = void 0) => function(e3, t3) {
|
|
2328
2333
|
return e3.reduce((e4, s3, n2) => e4.concat(t3(s3, n2)), []);
|
|
2329
2334
|
}(e2, (e3) => {
|
|
2330
2335
|
if ("string" == typeof e3) return t2(e3, s2);
|
|
@@ -2337,14 +2342,14 @@ const Ue = (e2, t2, s2 = void 0) => function(e3, t3) {
|
|
|
2337
2342
|
case "bulletList":
|
|
2338
2343
|
case "bulletpoint":
|
|
2339
2344
|
case "bulletPoint":
|
|
2340
|
-
return [{ type: e3.type, children:
|
|
2345
|
+
return [{ type: e3.type, children: je(e3.children, t2, e3.type) }];
|
|
2341
2346
|
case "link":
|
|
2342
|
-
return [{ type: e3.type, url: e3.url, children:
|
|
2347
|
+
return [{ type: e3.type, url: e3.url, children: je(e3.children, t2, e3.type) }];
|
|
2343
2348
|
case "actionlink":
|
|
2344
2349
|
case "actionLink":
|
|
2345
2350
|
case "actionbutton":
|
|
2346
2351
|
case "actionButton":
|
|
2347
|
-
return [{ type: e3.type, action: e3.action, params: e3.params, children:
|
|
2352
|
+
return [{ type: e3.type, action: e3.action, params: e3.params, children: je(e3.children, t2, e3.type) }];
|
|
2348
2353
|
case "mention":
|
|
2349
2354
|
case "autolink":
|
|
2350
2355
|
case "autoLink":
|
|
@@ -2359,7 +2364,7 @@ const Ue = (e2, t2, s2 = void 0) => function(e3, t3) {
|
|
|
2359
2364
|
return [e3];
|
|
2360
2365
|
}
|
|
2361
2366
|
});
|
|
2362
|
-
function
|
|
2367
|
+
function Ue(e2, t2) {
|
|
2363
2368
|
return (s2) => {
|
|
2364
2369
|
const n2 = s2;
|
|
2365
2370
|
let r2 = 0;
|
|
@@ -2383,7 +2388,7 @@ function Le(e2) {
|
|
|
2383
2388
|
}
|
|
2384
2389
|
function Ge(e2, t2 = 0) {
|
|
2385
2390
|
const s2 = qe[t2], n2 = s2 ? function(e3) {
|
|
2386
|
-
const t3 = ze.getOrCompute(e3, () => new RegExp(`(?:^|[\\s${$e}])(?:${e3.source})(?=[\\s${$e}]|$)`, "g")), s3 =
|
|
2391
|
+
const t3 = ze.getOrCompute(e3, () => new RegExp(`(?:^|[\\s${$e}])(?:${e3.source})(?=[\\s${$e}]|$)`, "g")), s3 = Ue(t3, (e4) => {
|
|
2387
2392
|
const t4 = e4[0][1], s4 = e4[1] || e4[2] || e4[3] || e4[4] || e4[5] || e4[6];
|
|
2388
2393
|
return [" ", { type: We[He[t4]], children: [s4] }];
|
|
2389
2394
|
});
|
|
@@ -2392,7 +2397,7 @@ function Ge(e2, t2 = 0) {
|
|
|
2392
2397
|
return t4.length > 1 && n3.unshift(t4.substring(1)), n3;
|
|
2393
2398
|
};
|
|
2394
2399
|
}(s2) : () => [e2];
|
|
2395
|
-
return
|
|
2400
|
+
return je(n2(e2), (e3, s3) => "bold" === s3 || "italic" === s3 || "strikethrough" === s3 ? Ge(e3, t2 | We[s3]) : [e3]);
|
|
2396
2401
|
}
|
|
2397
2402
|
const ze = function() {
|
|
2398
2403
|
const e2 = function() {
|
|
@@ -2866,7 +2871,7 @@ var tt, st = function() {
|
|
|
2866
2871
|
}
|
|
2867
2872
|
return a2;
|
|
2868
2873
|
}, t2;
|
|
2869
|
-
}(ut), Pt = new RegExp(/(?:(?:(?:(\+)?\d{1,3}[-\040.]?)?\(?\d{3}\)?[-\040.]?\d{3}[-\040.]?\d{4})|(?:(\+)(?:9[976]\d|8[987530]\d|6[987]\d|5[90]\d|42\d|3[875]\d|2[98654321]\d|9[8543210]|8[6421]|6[6543210]|5[87654321]|4[987654310]|3[9643210]|2[70]|7|1)[-\040.]?(?:\d[-\040.]?){6,12}\d+))([,;]+[0-9]+#?)*/.source + "|" + /(0([1-9]{1}-?[1-9]\d{3}|[1-9]{2}-?\d{3}|[1-9]{2}\d{1}-?\d{2}|[1-9]{2}\d{2}-?\d{1})-?\d{4}|0[789]0-?\d{4}-?\d{4}|050-?\d{4}-?\d{4})/.source, "g"),
|
|
2874
|
+
}(ut), Pt = new RegExp(/(?:(?:(?:(\+)?\d{1,3}[-\040.]?)?\(?\d{3}\)?[-\040.]?\d{3}[-\040.]?\d{4})|(?:(\+)(?:9[976]\d|8[987530]\d|6[987]\d|5[90]\d|42\d|3[875]\d|2[98654321]\d|9[8543210]|8[6421]|6[6543210]|5[87654321]|4[987654310]|3[9643210]|2[70]|7|1)[-\040.]?(?:\d[-\040.]?){6,12}\d+))([,;]+[0-9]+#?)*/.source + "|" + /(0([1-9]{1}-?[1-9]\d{3}|[1-9]{2}-?\d{3}|[1-9]{2}\d{1}-?\d{2}|[1-9]{2}\d{2}-?\d{1})-?\d{4}|0[789]0-?\d{4}-?\d{4}|050-?\d{4}-?\d{4})/.source, "g"), jt = function(e2) {
|
|
2870
2875
|
function t2() {
|
|
2871
2876
|
var t3 = null !== e2 && e2.apply(this, arguments) || this;
|
|
2872
2877
|
return t3.matcherRegex = Pt, t3;
|
|
@@ -2880,10 +2885,10 @@ var tt, st = function() {
|
|
|
2880
2885
|
}, t2.prototype.testMatch = function(e3) {
|
|
2881
2886
|
return ht.test(e3);
|
|
2882
2887
|
}, t2;
|
|
2883
|
-
}(ut),
|
|
2888
|
+
}(ut), Ut = new RegExp("@[_" + bt + "]{1,50}(?![_" + bt + "])", "g"), $t = new RegExp("@[_." + bt + "]{1,30}(?![_" + bt + "])", "g"), Wt = new RegExp("@[-_." + bt + "]{1,50}(?![-_" + bt + "])", "g"), qt = new RegExp("[^" + bt + "]"), Ht = function(e2) {
|
|
2884
2889
|
function t2(t3) {
|
|
2885
2890
|
var s2 = e2.call(this, t3) || this;
|
|
2886
|
-
return s2.serviceName = "twitter", s2.matcherRegexes = { twitter:
|
|
2891
|
+
return s2.serviceName = "twitter", s2.matcherRegexes = { twitter: Ut, instagram: $t, soundcloud: Wt }, s2.nonWordCharRegex = qt, s2.serviceName = t3.serviceName, s2;
|
|
2887
2892
|
}
|
|
2888
2893
|
return et(t2, e2), t2.prototype.parseMatches = function(e3) {
|
|
2889
2894
|
var t3, s2 = this.serviceName, n2 = this.matcherRegexes[this.serviceName], r2 = this.nonWordCharRegex, i2 = this.tagBuilder, a2 = [];
|
|
@@ -2977,19 +2982,19 @@ function Lt(e2, t2) {
|
|
|
2977
2982
|
"!" === e3 ? h2 = 13 : "/" === e3 ? (h2 = 2, p2 = new Gt(st(st({}, p2), { isClosing: true }))) : "<" === e3 ? P2() : ct.test(e3) ? (h2 = 3, p2 = new Gt(st(st({}, p2), { isOpening: true }))) : (h2 = 0, p2 = u2);
|
|
2978
2983
|
}
|
|
2979
2984
|
function v2(e3) {
|
|
2980
|
-
dt.test(e3) ? (p2 = new Gt(st(st({}, p2), { name:
|
|
2985
|
+
dt.test(e3) ? (p2 = new Gt(st(st({}, p2), { name: U2() })), h2 = 4) : "<" === e3 ? P2() : "/" === e3 ? (p2 = new Gt(st(st({}, p2), { name: U2() })), h2 = 12) : ">" === e3 ? (p2 = new Gt(st(st({}, p2), { name: U2() })), j2()) : ct.test(e3) || lt.test(e3) || ":" === e3 || O2();
|
|
2981
2986
|
}
|
|
2982
2987
|
function w2(e3) {
|
|
2983
2988
|
">" === e3 ? O2() : ct.test(e3) ? h2 = 3 : O2();
|
|
2984
2989
|
}
|
|
2985
2990
|
function b2(e3) {
|
|
2986
|
-
dt.test(e3) || ("/" === e3 ? h2 = 12 : ">" === e3 ?
|
|
2991
|
+
dt.test(e3) || ("/" === e3 ? h2 = 12 : ">" === e3 ? j2() : "<" === e3 ? P2() : "=" === e3 || pt.test(e3) || ft.test(e3) ? O2() : h2 = 5);
|
|
2987
2992
|
}
|
|
2988
2993
|
function y2(e3) {
|
|
2989
|
-
dt.test(e3) ? h2 = 6 : "/" === e3 ? h2 = 12 : "=" === e3 ? h2 = 7 : ">" === e3 ?
|
|
2994
|
+
dt.test(e3) ? h2 = 6 : "/" === e3 ? h2 = 12 : "=" === e3 ? h2 = 7 : ">" === e3 ? j2() : "<" === e3 ? P2() : pt.test(e3) && O2();
|
|
2990
2995
|
}
|
|
2991
2996
|
function C2(e3) {
|
|
2992
|
-
dt.test(e3) || ("/" === e3 ? h2 = 12 : "=" === e3 ? h2 = 7 : ">" === e3 ?
|
|
2997
|
+
dt.test(e3) || ("/" === e3 ? h2 = 12 : "=" === e3 ? h2 = 7 : ">" === e3 ? j2() : "<" === e3 ? P2() : pt.test(e3) ? O2() : h2 = 5);
|
|
2993
2998
|
}
|
|
2994
2999
|
function A2(e3) {
|
|
2995
3000
|
dt.test(e3) || ('"' === e3 ? h2 = 8 : "'" === e3 ? h2 = 9 : /[>=`]/.test(e3) ? O2() : "<" === e3 ? P2() : h2 = 10);
|
|
@@ -3001,13 +3006,13 @@ function Lt(e2, t2) {
|
|
|
3001
3006
|
"'" === e3 && (h2 = 11);
|
|
3002
3007
|
}
|
|
3003
3008
|
function x2(e3) {
|
|
3004
|
-
dt.test(e3) ? h2 = 4 : ">" === e3 ?
|
|
3009
|
+
dt.test(e3) ? h2 = 4 : ">" === e3 ? j2() : "<" === e3 && P2();
|
|
3005
3010
|
}
|
|
3006
3011
|
function T2(e3) {
|
|
3007
|
-
dt.test(e3) ? h2 = 4 : "/" === e3 ? h2 = 12 : ">" === e3 ?
|
|
3012
|
+
dt.test(e3) ? h2 = 4 : "/" === e3 ? h2 = 12 : ">" === e3 ? j2() : "<" === e3 ? P2() : (h2 = 4, c2--);
|
|
3008
3013
|
}
|
|
3009
3014
|
function I2(e3) {
|
|
3010
|
-
">" === e3 ? (p2 = new Gt(st(st({}, p2), { isClosing: true })),
|
|
3015
|
+
">" === e3 ? (p2 = new Gt(st(st({}, p2), { isClosing: true })), j2()) : h2 = 4;
|
|
3011
3016
|
}
|
|
3012
3017
|
function D2(t3) {
|
|
3013
3018
|
"--" === e2.substr(c2, 2) ? (c2 += 2, p2 = new Gt(st(st({}, p2), { type: "comment" })), h2 = 14) : "DOCTYPE" === e2.substr(c2, 7).toUpperCase() ? (c2 += 7, p2 = new Gt(st(st({}, p2), { type: "doctype" })), h2 = 20) : O2();
|
|
@@ -3025,13 +3030,13 @@ function Lt(e2, t2) {
|
|
|
3025
3030
|
h2 = "-" === e3 ? 18 : 16;
|
|
3026
3031
|
}
|
|
3027
3032
|
function R2(e3) {
|
|
3028
|
-
">" === e3 ?
|
|
3033
|
+
">" === e3 ? j2() : "!" === e3 ? h2 = 19 : "-" === e3 || (h2 = 16);
|
|
3029
3034
|
}
|
|
3030
3035
|
function N2(e3) {
|
|
3031
|
-
"-" === e3 ? h2 = 17 : ">" === e3 ?
|
|
3036
|
+
"-" === e3 ? h2 = 17 : ">" === e3 ? j2() : h2 = 16;
|
|
3032
3037
|
}
|
|
3033
3038
|
function _2(e3) {
|
|
3034
|
-
">" === e3 ?
|
|
3039
|
+
">" === e3 ? j2() : "<" === e3 && P2();
|
|
3035
3040
|
}
|
|
3036
3041
|
function O2() {
|
|
3037
3042
|
h2 = 0, p2 = u2;
|
|
@@ -3039,11 +3044,11 @@ function Lt(e2, t2) {
|
|
|
3039
3044
|
function P2() {
|
|
3040
3045
|
h2 = 1, p2 = new Gt({ idx: c2 });
|
|
3041
3046
|
}
|
|
3042
|
-
function
|
|
3047
|
+
function j2() {
|
|
3043
3048
|
var t3 = e2.slice(d2, p2.idx);
|
|
3044
3049
|
t3 && i2(t3, d2), "comment" === p2.type ? a2(p2.idx) : "doctype" === p2.type ? o2(p2.idx) : (p2.isOpening && n2(p2.name, p2.idx), p2.isClosing && r2(p2.name, p2.idx)), O2(), d2 = c2 + 1;
|
|
3045
3050
|
}
|
|
3046
|
-
function
|
|
3051
|
+
function U2() {
|
|
3047
3052
|
var t3 = p2.idx + (p2.isClosing ? 2 : 1);
|
|
3048
3053
|
return e2.slice(t3, c2).toLowerCase();
|
|
3049
3054
|
}
|
|
@@ -3149,28 +3154,28 @@ var Gt = function(e2) {
|
|
|
3149
3154
|
return this.replaceFn && (t2 = this.replaceFn.call(this.context, e3)), "string" == typeof t2 ? t2 : false === t2 ? e3.getMatchedText() : t2 instanceof Ve ? t2.toAnchorString() : e3.buildTag().toAnchorString();
|
|
3150
3155
|
}, e2.prototype.getMatchers = function() {
|
|
3151
3156
|
if (this.matchers) return this.matchers;
|
|
3152
|
-
var e3 = this.getTagBuilder(), t2 = [new Ot({ tagBuilder: e3, serviceName: this.hashtag }), new Dt({ tagBuilder: e3 }), new
|
|
3157
|
+
var e3 = this.getTagBuilder(), t2 = [new Ot({ tagBuilder: e3, serviceName: this.hashtag }), new Dt({ tagBuilder: e3 }), new jt({ tagBuilder: e3 }), new Ht({ tagBuilder: e3, serviceName: this.mention }), new Rt({ tagBuilder: e3, stripPrefix: this.stripPrefix, stripTrailingSlash: this.stripTrailingSlash, decodePercentEncoding: this.decodePercentEncoding })];
|
|
3153
3158
|
return this.matchers = t2;
|
|
3154
3159
|
}, e2.prototype.getTagBuilder = function() {
|
|
3155
3160
|
var e3 = this.tagBuilder;
|
|
3156
3161
|
return e3 || (e3 = this.tagBuilder = new Ze({ newWindow: this.newWindow, truncate: this.truncate, className: this.className })), e3;
|
|
3157
|
-
}, e2.version = "3.14.3", e2.AnchorTagBuilder = Ze, e2.HtmlTag = Ve, e2.matcher = { Email: Dt, Hashtag: Ot, Matcher: ut, Mention: Ht, Phone:
|
|
3162
|
+
}, e2.version = "3.14.3", e2.AnchorTagBuilder = Ze, e2.HtmlTag = Ve, e2.matcher = { Email: Dt, Hashtag: Ot, Matcher: ut, Mention: Ht, Phone: jt, Url: Rt }, e2.match = { Email: nt, Hashtag: rt, Match: Ke, Mention: it, Phone: at, Url: ot }, e2;
|
|
3158
3163
|
}();
|
|
3159
3164
|
function Jt(e2, t2 = e2) {
|
|
3160
3165
|
return { type: "autolink", url: e2, text: t2 };
|
|
3161
3166
|
}
|
|
3162
|
-
const Yt =
|
|
3167
|
+
const Yt = Ue(/<!!mention:([^>\s]*?)\|(.*?)>/gm, ([e2, t2, s2]) => /* @__PURE__ */ function(e3, t3) {
|
|
3163
3168
|
return { type: "mention", id: e3, text: t3 };
|
|
3164
|
-
}(decodeURIComponent(t2), s2)), Qt =
|
|
3169
|
+
}(decodeURIComponent(t2), s2)), Qt = Ue(/<!!customemoji:(.*?)>/gm, ([e2, t2]) => /* @__PURE__ */ function(e3) {
|
|
3165
3170
|
return { type: "customemoji", text: e3 };
|
|
3166
|
-
}(t2)), Vt =
|
|
3171
|
+
}(t2)), Vt = Ue(/<((?:https?|mailto):.*?)\|(.*?)>/gi, ([e2, t2, s2]) => /* @__PURE__ */ function(e3, t3 = []) {
|
|
3167
3172
|
return { type: "link", url: e3, children: t3 };
|
|
3168
|
-
}(t2, [s2])), Zt =
|
|
3173
|
+
}(t2, [s2])), Zt = Ue(/<actionlink:([^|]+)[|]([^>]*)>/gi, ([e2, t2, s2]) => {
|
|
3169
3174
|
const { action: n2, params: r2 } = Xt(t2);
|
|
3170
3175
|
return /* @__PURE__ */ function(e3, t3, s3 = []) {
|
|
3171
3176
|
return { type: "actionlink", action: e3, params: t3, children: s3 };
|
|
3172
3177
|
}(n2, r2, [s2]);
|
|
3173
|
-
}), Kt =
|
|
3178
|
+
}), Kt = Ue(/<actionbutton:([^|]+)[|]([^>]*)>/gi, ([e2, t2, s2]) => {
|
|
3174
3179
|
const { action: n2, params: r2 } = Xt(t2);
|
|
3175
3180
|
return /* @__PURE__ */ function(e3, t3, s3 = []) {
|
|
3176
3181
|
return { type: "actionbutton", action: e3, params: t3, children: s3 };
|
|
@@ -3181,9 +3186,9 @@ function Xt(e2) {
|
|
|
3181
3186
|
if (-1 === t2) return { action: e2, params: {} };
|
|
3182
3187
|
return { action: e2.slice(0, t2), params: Object.fromEntries(new URLSearchParams(e2.slice(t2))) };
|
|
3183
3188
|
}
|
|
3184
|
-
const es =
|
|
3189
|
+
const es = Ue(/(?:^|\n)(?:\s*[-*+]\s+[^\n]+(?:\n|$))+/g, ([e2]) => /* @__PURE__ */ function(e3 = []) {
|
|
3185
3190
|
return { type: "bulletlist", children: e3 };
|
|
3186
|
-
}([e2.startsWith("\n") ? e2.slice(1) : e2])), ts =
|
|
3191
|
+
}([e2.startsWith("\n") ? e2.slice(1) : e2])), ts = Ue(/^\s*[-*+]\s+([^\n]+)(?:\n|$)/gm, ([e2, t2]) => ({ type: "bulletpoint", children: [t2] })), ss = (e2) => {
|
|
3187
3192
|
const t2 = /(?:^|[^-:/\w])([(+]?[0-9](?:[-_+ ().]?[0-9]){5,11}[0-9])(?:[^-:/\w]|$)/g;
|
|
3188
3193
|
let s2 = 0;
|
|
3189
3194
|
const n2 = [];
|
|
@@ -3207,7 +3212,7 @@ const es = je(/(?:^|\n)(?:\s*[-*+]\s+[^\n]+(?:\n|$))+/g, ([e2]) => /* @__PURE__
|
|
|
3207
3212
|
function as(e2 = { except: [] }) {
|
|
3208
3213
|
var _a2;
|
|
3209
3214
|
const t2 = { multilineSteps: [], singlelineSteps: [] }, s2 = (_a2 = e2.except) != null ? _a2 : is.filter((t3) => !e2.only.includes(t3));
|
|
3210
|
-
return s2.includes("BulletPoint") || t2.multilineSteps.push(es, ts), s2.includes("Mention") || t2.singlelineSteps.push(Yt), s2.includes("CustomEmoji") || t2.singlelineSteps.push(Qt), s2.includes("Codespan") || t2.multilineSteps.push(
|
|
3215
|
+
return s2.includes("BulletPoint") || t2.multilineSteps.push(es, ts), s2.includes("Mention") || t2.singlelineSteps.push(Yt), s2.includes("CustomEmoji") || t2.singlelineSteps.push(Qt), s2.includes("Codespan") || t2.multilineSteps.push(Ue(/```([^]+?)```/g, ([e3, t3]) => ({ type: "codespan", text: t3.replace(/<!!mention:.*?\|([^>]*)>/gim, "@$1").replace(/<!!customemoji:(.*?)>/gim, "$1") }))), s2.includes("FormattedLink") || t2.singlelineSteps.push(Vt), s2.includes("Actions") || (t2.singlelineSteps.push(Zt), t2.singlelineSteps.push(Kt)), s2.includes("Wikitext") || t2.singlelineSteps.push(Le), s2.includes("Autolink") || t2.singlelineSteps.push(ns, ss), t2;
|
|
3211
3216
|
}
|
|
3212
3217
|
const os = function(e2) {
|
|
3213
3218
|
const t2 = RegExp(`[^${e2}]+${e2}?|${e2}`, "g");
|
|
@@ -3224,7 +3229,7 @@ function cs(e2) {
|
|
|
3224
3229
|
return us(e2, { except: ["FormattedLink", "Actions"] });
|
|
3225
3230
|
}
|
|
3226
3231
|
function ls(e2, t2) {
|
|
3227
|
-
return t2.reduce((e3, t3) =>
|
|
3232
|
+
return t2.reduce((e3, t3) => je(e3, t3), e2);
|
|
3228
3233
|
}
|
|
3229
3234
|
function hs(e2) {
|
|
3230
3235
|
const t2 = [];
|
|
@@ -3457,7 +3462,7 @@ class bs {
|
|
|
3457
3462
|
function ys({ method: e2, url: t2, data: s2, options: n2, attempts: r2, shouldRetry: i2, authProvider: o2, errorTracker: u2 }) {
|
|
3458
3463
|
var _a2;
|
|
3459
3464
|
(!r2 || r2 <= 0) && (r2 = 1);
|
|
3460
|
-
const c2 = { "x-talkjs-client-build": "jssdk-dev", "x-talkjs-client-date": "2025-12-
|
|
3465
|
+
const c2 = { "x-talkjs-client-build": "jssdk-dev", "x-talkjs-client-date": "2025-12-30T13:54:18.982Z" };
|
|
3461
3466
|
s2 instanceof FormData || (c2["Content-Type"] = (_a2 = n2 == null ? void 0 : n2.contentType) != null ? _a2 : "application/json");
|
|
3462
3467
|
return a(r2, () => __async(this, null, function* () {
|
|
3463
3468
|
if (o2) {
|
|
@@ -3486,7 +3491,7 @@ class Cs {
|
|
|
3486
3491
|
__privateAdd(this, _e2);
|
|
3487
3492
|
__privateAdd(this, _t2);
|
|
3488
3493
|
var _a2, _b, _c, _d;
|
|
3489
|
-
this._timeCreated = Date.now(), __privateSet(this, _e2, (_b = (_a2 = globalThis.document) == null ? void 0 : _a2.referrer) != null ? _b : ""), __privateSet(this, _t2, ((_d = (_c = globalThis.location) == null ? void 0 : _c.href) != null ? _d : globalThis.HermesInternal) ? "React Native Hermes" : ""), this._trackJSData = { customer: { application: "", correlationId: "", sessionId: "", token: "", userId: "", version: "dev-2025-12-
|
|
3494
|
+
this._timeCreated = Date.now(), __privateSet(this, _e2, (_b = (_a2 = globalThis.document) == null ? void 0 : _a2.referrer) != null ? _b : ""), __privateSet(this, _t2, ((_d = (_c = globalThis.location) == null ? void 0 : _c.href) != null ? _d : globalThis.HermesInternal) ? "React Native Hermes" : ""), this._trackJSData = { customer: { application: "", correlationId: "", sessionId: "", token: "", userId: "", version: "dev-2025-12-30T13:54:18.982Z" }, entry: "direct", environment: { age: Date.now() - this._timeCreated, dependencies: {}, originalUrl: __privateGet(this, _t2), referrer: __privateGet(this, _e2), userAgent: window.navigator.userAgent }, metadata: [], nav: [], network: [], url: __privateGet(this, _t2), stack: "", timestamp: (/* @__PURE__ */ new Date()).toISOString(), version: "dev-2025-12-30T13:54:18.982Z", throttled: 0 }, this._url = `https://capture.trackjs.com/capture?token=${e2}`, this._trackJSData.customer.token = e2;
|
|
3490
3495
|
}
|
|
3491
3496
|
setData({ appId: e2, meId: t2, sessionId: s2 }) {
|
|
3492
3497
|
this._trackJSData.customer.userId = e2, this._trackJSData.customer.sessionId = `${e2}/${t2}`, this._trackJSData.customer.correlationId = s2;
|
|
@@ -3579,13 +3584,13 @@ class xs {
|
|
|
3579
3584
|
this.apiUrls = e2, this.appId = t2, this.userId = s2, this.signature = n2, this.inner = new ks({ onChange: (e3) => {
|
|
3580
3585
|
e3.ok ? this.eventEmitter.emit("tokenChanged", e3.value) : this.emitTokenRefreshFailed(e3.value);
|
|
3581
3586
|
}, onNeedToken: () => __async(this, null, function* () {
|
|
3582
|
-
if (this._usingBokens) yield this.sendBokenRequest().then((e3) => this.inner.setTokenResult(c(e3))).catch((e3) => this.inner.setTokenResult(h(e3)));
|
|
3587
|
+
if (this._usingBokens && !this.signature && !this._calledBokens && (yield new Promise((e3) => setTimeout(e3, 1))), this._usingBokens) yield this.sendBokenRequest().then((e3) => this.inner.setTokenResult(c(e3))).catch((e3) => this.inner.setTokenResult(h(e3)));
|
|
3583
3588
|
else if (this.onNeedToken) this.onNeedToken();
|
|
3584
3589
|
else {
|
|
3585
3590
|
const e3 = l("Cannot refresh token, no `onNeedToken` provided.");
|
|
3586
3591
|
this.inner.setTokenResult(e3);
|
|
3587
3592
|
}
|
|
3588
|
-
}) }), this._usingBokens = true, this.onNeedToken = void 0, this.eventEmitter = new Es({ tokenChanged(e3) {
|
|
3593
|
+
}) }), this._usingBokens = true, this._calledBokens = false, this.onNeedToken = void 0, this.eventEmitter = new Es({ tokenChanged(e3) {
|
|
3589
3594
|
}, tokenRefreshFailed(e3) {
|
|
3590
3595
|
}, tokenAccepted(e3) {
|
|
3591
3596
|
} }), this.sessionExpiryWarningTimeoutId = void 0;
|
|
@@ -3602,8 +3607,11 @@ class xs {
|
|
|
3602
3607
|
throw e2.value;
|
|
3603
3608
|
});
|
|
3604
3609
|
}
|
|
3610
|
+
checkCanSetAuth() {
|
|
3611
|
+
if (this._calledBokens) throw new Error("[TalkJS] Cannot switch to JWT authentication once connected to TalkJS servers. To use JWTs, call `setToken` or set `onNeedToken` before triggering any requests or mounting any components. We recommend setting up authentication in your app's entry point (App.jsx, main.js, or similar) so it runs first.");
|
|
3612
|
+
}
|
|
3605
3613
|
setToken(e2) {
|
|
3606
|
-
setTimeout(() => this.checkJwt(e2), 200), this._usingBokens = false, this.inner.setTokenResult(c(e2));
|
|
3614
|
+
this.checkCanSetAuth(), setTimeout(() => this.checkJwt(e2), 200), this._usingBokens = false, this.inner.setTokenResult(c(e2));
|
|
3607
3615
|
}
|
|
3608
3616
|
setTokenError(e2) {
|
|
3609
3617
|
this._usingBokens = false, this.inner.setTokenResult(l(e2));
|
|
@@ -3615,7 +3623,7 @@ class xs {
|
|
|
3615
3623
|
this.inner.invalidateAndRefresh();
|
|
3616
3624
|
}
|
|
3617
3625
|
setOnNeedToken(e2) {
|
|
3618
|
-
this._usingBokens = false, this.onNeedToken = e2;
|
|
3626
|
+
this.checkCanSetAuth(), this._usingBokens = false, this.onNeedToken = e2;
|
|
3619
3627
|
}
|
|
3620
3628
|
onTokenChanged(e2) {
|
|
3621
3629
|
return this.eventEmitter.on("tokenChanged", e2), () => {
|
|
@@ -3704,6 +3712,7 @@ class xs {
|
|
|
3704
3712
|
}
|
|
3705
3713
|
sendBokenRequest() {
|
|
3706
3714
|
return __async(this, null, function* () {
|
|
3715
|
+
this._calledBokens = true;
|
|
3707
3716
|
let e2 = 0;
|
|
3708
3717
|
const t2 = this.apiUrls.getBokensUrl(this.appId, this.userId, this.signature), s2 = yield ys({ method: "GET", url: t2, attempts: 1e4, shouldRetry: (t3) => {
|
|
3709
3718
|
if (t3 instanceof Error) return true;
|
|
@@ -3767,7 +3776,7 @@ class Ss {
|
|
|
3767
3776
|
}
|
|
3768
3777
|
}));
|
|
3769
3778
|
const a2 = Math.random().toString().split(".")[1];
|
|
3770
|
-
this._realtimeClient = new Be(this._apiUrls.getRealtimeWsUrl(t2, s2, "1.
|
|
3779
|
+
this._realtimeClient = new Be(this._apiUrls.getRealtimeWsUrl(t2, s2, "1.6.0", a2, e2.clientBuild), s2, this._authProvider), this.currentUser = new _e(this._realtimeClient.userId, this._realtimeClient), this._terminationReason = o(), this._terminationReason.promise.then((e3) => {
|
|
3771
3780
|
console.error(`[TalkJS] ${e3}`);
|
|
3772
3781
|
}), function(e3, t3) {
|
|
3773
3782
|
return __async(this, null, function* () {
|