@botdojo/chat-sdk 0.0.7 → 0.0.8
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/lib/index.js +12 -5
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React2 from 'react';
|
|
2
|
+
import React2__default, { useRef, useState, useCallback, useEffect, createContext, useMemo, useReducer, useContext } from 'react';
|
|
3
|
+
import * as __ReactDOM from 'react-dom';
|
|
2
4
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
5
|
|
|
6
|
+
var require = (id) => {
|
|
7
|
+
if (id === 'react') return React2;
|
|
8
|
+
if (id === 'react-dom') return __ReactDOM;
|
|
9
|
+
throw new Error('Dynamic require not supported: ' + id);
|
|
10
|
+
};
|
|
4
11
|
var __create = Object.create;
|
|
5
12
|
var __defProp = Object.defineProperty;
|
|
6
13
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -8470,7 +8477,7 @@ var BotDojoChat = ({
|
|
|
8470
8477
|
console.log("[BotDojoChat] Updated model context");
|
|
8471
8478
|
}
|
|
8472
8479
|
}, [connector, modelContext2]);
|
|
8473
|
-
const controlMethods =
|
|
8480
|
+
const controlMethods = React2__default.useMemo(() => ({
|
|
8474
8481
|
openChat: () => {
|
|
8475
8482
|
if (mode === "inline") {
|
|
8476
8483
|
console.warn("[BotDojoChat] openChat() is not applicable in inline mode");
|
|
@@ -9649,7 +9656,7 @@ var BotDojoChat = ({
|
|
|
9649
9656
|
|
|
9650
9657
|
// src/headless/HeadlessChat.tsx
|
|
9651
9658
|
var import_sdk_canvas2 = __toESM(require_src3());
|
|
9652
|
-
var HeadlessChat =
|
|
9659
|
+
var HeadlessChat = React2__default.forwardRef(
|
|
9653
9660
|
(props, ref) => {
|
|
9654
9661
|
const {
|
|
9655
9662
|
apiKey,
|
|
@@ -9676,7 +9683,7 @@ var HeadlessChat = React2.forwardRef(
|
|
|
9676
9683
|
const [currentStatus, setCurrentStatus] = useState("idle");
|
|
9677
9684
|
const [externalUIChannelId, setExternalUIChannelId] = useState(null);
|
|
9678
9685
|
const currentMessageRef = useRef(null);
|
|
9679
|
-
const iframeUrl =
|
|
9686
|
+
const iframeUrl = React2__default.useMemo(() => {
|
|
9680
9687
|
const url2 = new URL("/headless-embed", baseUrl);
|
|
9681
9688
|
url2.searchParams.set("apiKey", apiKey);
|
|
9682
9689
|
if (externalUIChannelId)
|
|
@@ -9716,7 +9723,7 @@ var HeadlessChat = React2.forwardRef(
|
|
|
9716
9723
|
type: "cancel_execution"
|
|
9717
9724
|
});
|
|
9718
9725
|
}, [sendToIframe]);
|
|
9719
|
-
|
|
9726
|
+
React2__default.useImperativeHandle(ref, () => ({
|
|
9720
9727
|
sendMessage,
|
|
9721
9728
|
updateConfig,
|
|
9722
9729
|
clearHistory,
|