@axos-web-dev/shared-components 1.0.100-dev.42-chatbot-reset-fix.1 → 1.0.100-dev.42-chatbot-reset-fix.2

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.
@@ -52,8 +52,8 @@ import "../Carousel/index.js";
52
52
  /* empty css */
53
53
  import "../Chatbot/store/chat.js";
54
54
  import "../Chatbot/authenticate.js";
55
- import "react-use";
56
55
  import "../Chatbot/Chatbot.css.ts.vanilla.css.js";
56
+ import "react-use";
57
57
  /* empty css */
58
58
  import "../Chatbot/store/messages.js";
59
59
  /* empty css */
@@ -1,4 +1,3 @@
1
- import "./Chatbot.css.ts.vanilla.css.js";
2
1
  import '../assets/Chatbot/ChatWindow.css';/* empty css */
3
2
  var windowStyle = "_13n1jqk0";
4
3
  var windowOpenStyle = "_13n1jqk1";
@@ -1,3 +1,4 @@
1
+ import "./Chatbot.css.ts.vanilla.css.js";
1
2
  var chatbotAXB = "_1hpv6vm0";
2
3
  var chatbotUFB = "_1hpv6vm1";
3
4
  export {
@@ -218,6 +218,13 @@ const Chatbot = ({
218
218
  isMountedRef.current = true;
219
219
  await createClient();
220
220
  });
221
+ useEffect(() => {
222
+ if (menusLoaded && pendingStart && !hasStarted) {
223
+ startChat();
224
+ setHasStarted(true);
225
+ setPendingStart(false);
226
+ }
227
+ }, [menusLoaded, pendingStart, hasStarted]);
221
228
  useUnmount(() => {
222
229
  console.log("Chatbot unmounted");
223
230
  deregisterEventHandlers();
@@ -227,14 +234,10 @@ const Chatbot = ({
227
234
  setHasStarted(false);
228
235
  setStatus("idle");
229
236
  clearMessages();
237
+ clientRef.current?.destroy();
238
+ clientRef.current?.destroyChat();
239
+ clientRef.current = null;
230
240
  });
231
- useEffect(() => {
232
- if (menusLoaded && pendingStart && !hasStarted) {
233
- startChat();
234
- setHasStarted(true);
235
- setPendingStart(false);
236
- }
237
- }, [menusLoaded, pendingStart, hasStarted]);
238
241
  return /* @__PURE__ */ jsxs("div", { className: project === "ufb" ? chatbotUFB : chatbotAXB, children: [
239
242
  /* @__PURE__ */ jsx(Bubble, { onClick: handleClick }),
240
243
  /* @__PURE__ */ jsx(
@@ -61,8 +61,8 @@ import "../Carousel/index.js";
61
61
  /* empty css */
62
62
  import "../Chatbot/store/chat.js";
63
63
  import "../Chatbot/authenticate.js";
64
- import "react-use";
65
64
  import "../Chatbot/Chatbot.css.ts.vanilla.css.js";
65
+ import "react-use";
66
66
  /* empty css */
67
67
  import "../Chatbot/store/messages.js";
68
68
  /* empty css */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@axos-web-dev/shared-components",
3
3
  "description": "Axos shared components library for web.",
4
- "version": "1.0.100-dev.42-chatbot-reset-fix.1",
4
+ "version": "1.0.100-dev.42-chatbot-reset-fix.2",
5
5
  "type": "module",
6
6
  "module": "dist/main.js",
7
7
  "types": "dist/main.d.ts",