@exotel-npm-dev/exotel-ai-assist 1.2.9 → 1.3.0
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/controller/index.js +9 -2
- package/dist/index.js +17 -3
- package/dist/react/index.js +17 -3
- package/package.json +1 -1
- package/src/controller/index.ts +3 -2
- package/src/hooks/useExotelAIAssist.ts +8 -1
- package/src/transport/index.ts +3 -0
package/dist/controller/index.js
CHANGED
|
@@ -487,6 +487,12 @@ class BroadcastChannelTransport {
|
|
|
487
487
|
}
|
|
488
488
|
destroy() {
|
|
489
489
|
var _a;
|
|
490
|
+
if (this.isLeader) {
|
|
491
|
+
this.channel.postMessage({
|
|
492
|
+
type: "DISCONNECTED",
|
|
493
|
+
code: 1000
|
|
494
|
+
});
|
|
495
|
+
}
|
|
490
496
|
this._destroyed = true;
|
|
491
497
|
this.disconnect();
|
|
492
498
|
this.channel.close();
|
|
@@ -1705,12 +1711,13 @@ class ExotelAIAssistController extends EventEmitter {
|
|
|
1705
1711
|
if (this.connectionEstablished) {
|
|
1706
1712
|
const wasThrottled = this._streamState === "throttled";
|
|
1707
1713
|
if (this.readyFired && !wasThrottled) {
|
|
1708
|
-
this.readyFired = false;
|
|
1709
1714
|
this.emit("onReady", false);
|
|
1710
1715
|
}
|
|
1716
|
+
this.connectionEstablished = false;
|
|
1717
|
+
this.readyFired = false;
|
|
1718
|
+
this._streamState = null;
|
|
1711
1719
|
this._setStatus("disconnected");
|
|
1712
1720
|
this.emit("onCallEnd");
|
|
1713
|
-
this.destroy();
|
|
1714
1721
|
} else {
|
|
1715
1722
|
this._scheduleReconnect();
|
|
1716
1723
|
}
|
package/dist/index.js
CHANGED
|
@@ -19929,6 +19929,12 @@ class BroadcastChannelTransport {
|
|
|
19929
19929
|
}
|
|
19930
19930
|
destroy() {
|
|
19931
19931
|
var _a;
|
|
19932
|
+
if (this.isLeader) {
|
|
19933
|
+
this.channel.postMessage({
|
|
19934
|
+
type: "DISCONNECTED",
|
|
19935
|
+
code: 1000
|
|
19936
|
+
});
|
|
19937
|
+
}
|
|
19932
19938
|
this._destroyed = true;
|
|
19933
19939
|
this.disconnect();
|
|
19934
19940
|
this.channel.close();
|
|
@@ -21147,12 +21153,13 @@ class ExotelAIAssistController extends EventEmitter {
|
|
|
21147
21153
|
if (this.connectionEstablished) {
|
|
21148
21154
|
const wasThrottled = this._streamState === "throttled";
|
|
21149
21155
|
if (this.readyFired && !wasThrottled) {
|
|
21150
|
-
this.readyFired = false;
|
|
21151
21156
|
this.emit("onReady", false);
|
|
21152
21157
|
}
|
|
21158
|
+
this.connectionEstablished = false;
|
|
21159
|
+
this.readyFired = false;
|
|
21160
|
+
this._streamState = null;
|
|
21153
21161
|
this._setStatus("disconnected");
|
|
21154
21162
|
this.emit("onCallEnd");
|
|
21155
|
-
this.destroy();
|
|
21156
21163
|
} else {
|
|
21157
21164
|
this._scheduleReconnect();
|
|
21158
21165
|
}
|
|
@@ -21308,7 +21315,14 @@ function useExotelAIAssist(params) {
|
|
|
21308
21315
|
setLastError(null);
|
|
21309
21316
|
const ctrl = new ExotelAIAssistController(params);
|
|
21310
21317
|
controllerRef.current = ctrl;
|
|
21311
|
-
ctrl.on("onReady",
|
|
21318
|
+
ctrl.on("onReady", ready => {
|
|
21319
|
+
setIsReady(ready);
|
|
21320
|
+
if (!ready) {
|
|
21321
|
+
setSuggestions([]);
|
|
21322
|
+
setTranscripts([]);
|
|
21323
|
+
setSentiment(null);
|
|
21324
|
+
}
|
|
21325
|
+
});
|
|
21312
21326
|
ctrl.on("streamState", setStreamState);
|
|
21313
21327
|
ctrl.on("botConfig", setBotConfig);
|
|
21314
21328
|
ctrl.on("suggestion", s => setSuggestions(prev => [...prev, s].slice(-50)));
|
package/dist/react/index.js
CHANGED
|
@@ -5215,6 +5215,12 @@ class BroadcastChannelTransport {
|
|
|
5215
5215
|
}
|
|
5216
5216
|
destroy() {
|
|
5217
5217
|
var _a;
|
|
5218
|
+
if (this.isLeader) {
|
|
5219
|
+
this.channel.postMessage({
|
|
5220
|
+
type: "DISCONNECTED",
|
|
5221
|
+
code: 1000
|
|
5222
|
+
});
|
|
5223
|
+
}
|
|
5218
5224
|
this._destroyed = true;
|
|
5219
5225
|
this.disconnect();
|
|
5220
5226
|
this.channel.close();
|
|
@@ -6433,12 +6439,13 @@ class ExotelAIAssistController extends EventEmitter {
|
|
|
6433
6439
|
if (this.connectionEstablished) {
|
|
6434
6440
|
const wasThrottled = this._streamState === "throttled";
|
|
6435
6441
|
if (this.readyFired && !wasThrottled) {
|
|
6436
|
-
this.readyFired = false;
|
|
6437
6442
|
this.emit("onReady", false);
|
|
6438
6443
|
}
|
|
6444
|
+
this.connectionEstablished = false;
|
|
6445
|
+
this.readyFired = false;
|
|
6446
|
+
this._streamState = null;
|
|
6439
6447
|
this._setStatus("disconnected");
|
|
6440
6448
|
this.emit("onCallEnd");
|
|
6441
|
-
this.destroy();
|
|
6442
6449
|
} else {
|
|
6443
6450
|
this._scheduleReconnect();
|
|
6444
6451
|
}
|
|
@@ -6594,7 +6601,14 @@ function useExotelAIAssist(params) {
|
|
|
6594
6601
|
setLastError(null);
|
|
6595
6602
|
const ctrl = new ExotelAIAssistController(params);
|
|
6596
6603
|
controllerRef.current = ctrl;
|
|
6597
|
-
ctrl.on("onReady",
|
|
6604
|
+
ctrl.on("onReady", ready => {
|
|
6605
|
+
setIsReady(ready);
|
|
6606
|
+
if (!ready) {
|
|
6607
|
+
setSuggestions([]);
|
|
6608
|
+
setTranscripts([]);
|
|
6609
|
+
setSentiment(null);
|
|
6610
|
+
}
|
|
6611
|
+
});
|
|
6598
6612
|
ctrl.on("streamState", setStreamState);
|
|
6599
6613
|
ctrl.on("botConfig", setBotConfig);
|
|
6600
6614
|
ctrl.on("suggestion", s => setSuggestions(prev => [...prev, s].slice(-50)));
|
package/package.json
CHANGED
package/src/controller/index.ts
CHANGED
|
@@ -145,12 +145,13 @@ export class ExotelAIAssistController extends EventEmitter<ControllerEvents> {
|
|
|
145
145
|
if (this.connectionEstablished) {
|
|
146
146
|
const wasThrottled = this._streamState === "throttled";
|
|
147
147
|
if (this.readyFired && !wasThrottled) {
|
|
148
|
-
this.readyFired = false;
|
|
149
148
|
this.emit("onReady", false);
|
|
150
149
|
}
|
|
150
|
+
this.connectionEstablished = false;
|
|
151
|
+
this.readyFired = false;
|
|
152
|
+
this._streamState = null;
|
|
151
153
|
this._setStatus("disconnected");
|
|
152
154
|
this.emit("onCallEnd");
|
|
153
|
-
this.destroy();
|
|
154
155
|
} else {
|
|
155
156
|
this._scheduleReconnect();
|
|
156
157
|
}
|
|
@@ -63,7 +63,14 @@ export function useExotelAIAssist(params: ExotelAIAssistParams): UseExotelAIAssi
|
|
|
63
63
|
const ctrl = new ExotelAIAssistController(params);
|
|
64
64
|
controllerRef.current = ctrl;
|
|
65
65
|
|
|
66
|
-
ctrl.on("onReady",
|
|
66
|
+
ctrl.on("onReady", (ready) => {
|
|
67
|
+
setIsReady(ready);
|
|
68
|
+
if (!ready) {
|
|
69
|
+
setSuggestions([]);
|
|
70
|
+
setTranscripts([]);
|
|
71
|
+
setSentiment(null);
|
|
72
|
+
}
|
|
73
|
+
});
|
|
67
74
|
ctrl.on("streamState", setStreamState);
|
|
68
75
|
ctrl.on("botConfig", setBotConfig);
|
|
69
76
|
ctrl.on("suggestion", (s) => setSuggestions((prev) => [...prev, s].slice(-MAX_SUGGESTIONS)));
|
package/src/transport/index.ts
CHANGED
|
@@ -168,6 +168,9 @@ export class BroadcastChannelTransport implements ITransport {
|
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
destroy(): void {
|
|
171
|
+
if (this.isLeader) {
|
|
172
|
+
this.channel.postMessage({ type: "DISCONNECTED", code: 1000 } satisfies WorkerInboundMessage);
|
|
173
|
+
}
|
|
171
174
|
this._destroyed = true;
|
|
172
175
|
this.disconnect();
|
|
173
176
|
this.channel.close();
|