@aikaara/chat-sdk 1.4.9 → 1.4.11
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/{AikaaraLinkButton-CnQoe1id.mjs → AikaaraLinkButton-C0To_3Ln.mjs} +1 -1
- package/dist/{AikaaraLinkButton-C6P9Rkzp.cjs → AikaaraLinkButton-Cl0EObu4.cjs} +1 -1
- package/dist/{MountTenant-DRfdLtS5.cjs → MountTenant-CsY3-a9k.cjs} +3 -3
- package/dist/{MountTenant-wGTIJ3mp.mjs → MountTenant-NmqOsuTJ.mjs} +34 -5
- package/dist/cdn/aikaara-chat.iife.js +2 -2
- package/dist/headless.cjs +1 -1
- package/dist/headless.d.ts +4 -0
- package/dist/headless.mjs +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +2 -2
- package/dist/ui.cjs +1 -1
- package/dist/ui.d.ts +2 -0
- package/dist/ui.mjs +1 -1
- package/package.json +1 -1
|
@@ -176,14 +176,15 @@ class zl extends qs {
|
|
|
176
176
|
this.client = new bo(t);
|
|
177
177
|
}
|
|
178
178
|
async connect() {
|
|
179
|
+
const e = this.reconnectAttempt > 0;
|
|
179
180
|
this.setState("connecting");
|
|
180
181
|
try {
|
|
181
|
-
await this.client.connect(), this.setState("connected"), this.reconnectAttempt = 0;
|
|
182
|
-
} catch (
|
|
182
|
+
await this.client.connect(), this.setState("connected"), this.reconnectAttempt = 0, e && this.emit("reconnected", void 0);
|
|
183
|
+
} catch (t) {
|
|
183
184
|
if (this.setState("disconnected"), this.config.reconnect !== !1)
|
|
184
185
|
this.scheduleReconnect();
|
|
185
186
|
else
|
|
186
|
-
throw
|
|
187
|
+
throw t;
|
|
187
188
|
}
|
|
188
189
|
}
|
|
189
190
|
async disconnect() {
|
|
@@ -230,7 +231,7 @@ class zl extends qs {
|
|
|
230
231
|
this.reconnectAttempt++, this.reconnectTimer = setTimeout(async () => {
|
|
231
232
|
try {
|
|
232
233
|
const o = this.buildWsUrl(this.config.baseUrl, this.config.userToken);
|
|
233
|
-
this.client = new bo(o), await this.connect();
|
|
234
|
+
this.client.disconnect(), this.client = new bo(o), await this.connect();
|
|
234
235
|
} catch {
|
|
235
236
|
}
|
|
236
237
|
}, r);
|
|
@@ -11435,6 +11436,8 @@ class fh extends qs {
|
|
|
11435
11436
|
this.emit("connection:state", r), this.config.onConnectionStateChange?.(r);
|
|
11436
11437
|
}), this.connection.on("error", (r) => {
|
|
11437
11438
|
this.emit("error", r), this.config.onError?.(r);
|
|
11439
|
+
}), this.connection.on("reconnected", () => {
|
|
11440
|
+
this.resubscribeAfterReconnect();
|
|
11438
11441
|
})), this.usesTiledesk() && this.initTiledeskTransport();
|
|
11439
11442
|
}
|
|
11440
11443
|
usesAikaara() {
|
|
@@ -11702,6 +11705,17 @@ class fh extends qs {
|
|
|
11702
11705
|
} catch {
|
|
11703
11706
|
}
|
|
11704
11707
|
}
|
|
11708
|
+
async resubscribeAfterReconnect() {
|
|
11709
|
+
const e = this.conversationManager.conversationId;
|
|
11710
|
+
if (!(!e || !this.connection))
|
|
11711
|
+
try {
|
|
11712
|
+
this.subscription = await this.connection.subscribeToConversation(e), this.subscription.onReceived((t) => {
|
|
11713
|
+
this.handleBroadcast(t);
|
|
11714
|
+
});
|
|
11715
|
+
} catch (t) {
|
|
11716
|
+
this.emit("error", t instanceof Error ? t : new Error(String(t))), this.config.onError?.(t instanceof Error ? t : new Error(String(t)));
|
|
11717
|
+
}
|
|
11718
|
+
}
|
|
11705
11719
|
handleBroadcast(e) {
|
|
11706
11720
|
const t = this.conversationManager.conversationId;
|
|
11707
11721
|
switch (e.type) {
|
|
@@ -12573,6 +12587,10 @@ class Yh {
|
|
|
12573
12587
|
}), this.messageList.addEventListener("message-action", (e) => {
|
|
12574
12588
|
const t = e.detail;
|
|
12575
12589
|
if (!t?.text) return;
|
|
12590
|
+
if (this.shouldOpenSmartEdit(t.text)) {
|
|
12591
|
+
this.openSmartEdit();
|
|
12592
|
+
return;
|
|
12593
|
+
}
|
|
12576
12594
|
const r = this.client.config.templateActionAttributes ?? {}, o = t.attributes?.action ?? {}, n = {
|
|
12577
12595
|
...t.attributes,
|
|
12578
12596
|
action: { ...r, ...o }
|
|
@@ -12618,6 +12636,17 @@ class Yh {
|
|
|
12618
12636
|
}
|
|
12619
12637
|
console.info("[chat-action]", e.id, e.label);
|
|
12620
12638
|
}
|
|
12639
|
+
/**
|
|
12640
|
+
* True when the given quick-reply button text is listed in
|
|
12641
|
+
* `descriptor.smartEdit.openOnMessages` — i.e. clicking it should open the
|
|
12642
|
+
* Smart Edit modal instead of posting the text. Trimmed + case-insensitive.
|
|
12643
|
+
*/
|
|
12644
|
+
shouldOpenSmartEdit(e) {
|
|
12645
|
+
const t = window.__aikaara_descriptor__?.smartEdit?.openOnMessages;
|
|
12646
|
+
if (!Array.isArray(t) || t.length === 0) return !1;
|
|
12647
|
+
const r = (n) => n.trim().toLowerCase(), o = r(e);
|
|
12648
|
+
return t.some((n) => typeof n == "string" && r(n) === o);
|
|
12649
|
+
}
|
|
12621
12650
|
/**
|
|
12622
12651
|
* Open the Smart Edit modal. It opens with an EMPTY record — never the
|
|
12623
12652
|
* demo data (that is for the standalone demo page only), so a save can
|
|
@@ -14552,7 +14581,7 @@ class _d extends HTMLElement {
|
|
|
14552
14581
|
*/
|
|
14553
14582
|
mountLinkButton(e) {
|
|
14554
14583
|
const t = this.renderGen;
|
|
14555
|
-
import("./AikaaraLinkButton-
|
|
14584
|
+
import("./AikaaraLinkButton-C0To_3Ln.mjs").then(({ registerAikaaraLinkButton: r, AikaaraLinkButton: o }) => {
|
|
14556
14585
|
if (t !== this.renderGen) return;
|
|
14557
14586
|
r();
|
|
14558
14587
|
const n = document.createElement("aikaara-link-button");
|