@docshound/chat-react 0.9.1 → 0.10.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/LICENSE +18 -4
- package/README.md +3 -2
- package/dist/index.d.ts +7 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/LICENSE
CHANGED
|
@@ -1,7 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
MIT License
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Copyright (c) 2024 DocsHound, Inc.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
6
11
|
|
|
7
|
-
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# DocsHound Chat for React
|
|
2
2
|
|
|
3
3
|
`@docshound/chat-react` is a React component library for integrating the DocsHound chat widget into your React / Next.js applications.
|
|
4
4
|
|
|
@@ -54,6 +54,7 @@ The DocsHoundChat component accepts the following props:
|
|
|
54
54
|
- `accentColor`: The accent color of the chat interface. Optional.
|
|
55
55
|
- `triggerLabel`: The label for the trigger button that starts the chat. Optional.
|
|
56
56
|
- `token`: Authentication token for jwt / password / basic protected guides. Optional.
|
|
57
|
+
- `mcpToken`: Authentication token for an additional support MCP server. Optional.
|
|
57
58
|
|
|
58
59
|
## Hooks
|
|
59
60
|
|
|
@@ -90,4 +91,4 @@ Hook's API:
|
|
|
90
91
|
|
|
91
92
|
## License
|
|
92
93
|
|
|
93
|
-
MIT
|
|
94
|
+
MIT © DocsHound, Inc.
|
package/dist/index.d.ts
CHANGED
|
@@ -90,8 +90,14 @@ type DocsHoundChatProps = {
|
|
|
90
90
|
* Optional field.
|
|
91
91
|
*/
|
|
92
92
|
token?: string;
|
|
93
|
+
/**
|
|
94
|
+
* Authentication token for additional support MCP server
|
|
95
|
+
*
|
|
96
|
+
* Optional field.
|
|
97
|
+
*/
|
|
98
|
+
mcpToken?: string;
|
|
93
99
|
};
|
|
94
|
-
declare const DocsHoundChat: ({ src, agentName, agentAvatarUrl, accentColor, platform, position, theme, triggerLabel, userAvatarUrl, userId, userEmail, userName, firstMessage, token, }: DocsHoundChatProps) => react_jsx_runtime.JSX.Element;
|
|
100
|
+
declare const DocsHoundChat: ({ src, agentName, agentAvatarUrl, accentColor, platform, position, theme, triggerLabel, userAvatarUrl, userId, userEmail, userName, firstMessage, token, mcpToken, }: DocsHoundChatProps) => react_jsx_runtime.JSX.Element;
|
|
95
101
|
|
|
96
102
|
type UseDocsHoundChat = {
|
|
97
103
|
/**
|
package/dist/index.esm.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as e}from"react/jsx-runtime";import{useEffect as t,useCallback as o}from"react";const n=({src:o,agentName:n,agentAvatarUrl:r,accentColor:c,platform:s,position:a,theme:d,triggerLabel:i,userAvatarUrl:u,userId:m,userEmail:l,userName:h,firstMessage:p,token:g})=>{const
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{useEffect as t,useCallback as o}from"react";const n=({src:o,agentName:n,agentAvatarUrl:r,accentColor:c,platform:s,position:a,theme:d,triggerLabel:i,userAvatarUrl:u,userId:m,userEmail:l,userName:h,firstMessage:p,token:g,mcpToken:f})=>{const v="__DH_CHAT_SCRIPT__";return t(()=>{if(!customElements.get("docshound-chat")){if(!document.getElementById(v)){let e="";e=o.endsWith("/-/chat.js")?o:o.endsWith("/")?`${o}-/chat.js`:`${o}/-/chat.js`;const t=document.createElement("script");t.src=e,t.id=v,t.type="text/javascript",t.async=!0,t.defer=!0,document.head.appendChild(t)}}},[]),e("docshound-chat",{"agent-name":n,"agent-avatar-url":r,"accent-color":c,platform:s,position:a,theme:d,"trigger-label":i,"user-id":m,"user-email":l,"user-name":h,"user-avatar-url":u,"first-message":p,token:g,"mcp-token":f})};function r(...e){"development"===process.env.NODE_ENV&&console.warn(...e)}function c(){return{show:o(e=>{const t=document.querySelector("docshound-chat");t&&t.show?t.show(e):r("DocsHound Chat component not mounted or not initialized")},[]),clear:o(()=>{const e=document.querySelector("docshound-chat");e&&e.clear?e.clear():r("DocsHound Chat component not mounted or not initialized")},[]),sendQuestion:o(e=>{const t=document.querySelector("docshound-chat");t&&t.sendQuestion?t.sendQuestion(e):r("DocsHound Chat component not mounted or not initialized")},[])}}export{n as DocsHoundChat,c as useDocsHoundChat};
|
|
2
2
|
//# sourceMappingURL=index.esm.js.map
|
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../src/components/DocsHoundChat.tsx","../src/utils/devLog.ts","../src/hooks/useDocsHoundChat.tsx"],"sourcesContent":["import { useEffect } from \"react\";\n\nexport type DocsHoundChatProps = {\n
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../src/components/DocsHoundChat.tsx","../src/utils/devLog.ts","../src/hooks/useDocsHoundChat.tsx"],"sourcesContent":["import { useEffect } from \"react\";\n\nexport type DocsHoundChatProps = {\n /**\n * Domain where the guide is published. Eg: https://docs.docshound.com\n *\n * This field is not reactive, so if you change it, you need to reload the page.\n *\n * Required field;\n */\n src: string;\n\n /**\n * The name of the agent responding in the chat.\n *\n * Optional field. Defaults to value set in the DocsHound.\n */\n agentName?: string;\n\n /**\n * The URL for the avatar image of the agent.\n *\n * Optional field. Defaults to value set in the DocsHound.\n */\n agentAvatarUrl?: string;\n\n /**\n * A unique identifier for the user interacting with the chat.\n * This should be unique identifier coming from your system.\n * Used to identify the user and their support tickets.\n *\n * Optional field. Defaults to undefined.\n */\n userId?: string;\n\n /**\n * The email address of the user interacting with the chat.\n * Will be pre-filled for the user when they decide to submit a support ticket.\n *\n * Optional field. Defaults to undefined.\n */\n userEmail?: string;\n\n /**\n * The display name of the user interacting with the chat.\n *\n * Optional field. Defaults to 'You'.\n */\n userName?: string;\n\n /**\n * The platform where the chat is being used. Could be either 'site' (marketing site), 'app' (application), or 'docs' (documentation site / platform).\n *\n * Optional field, defaults to 'app'.\n */\n platform?: \"site\" | \"app\" | \"docs\";\n\n /**\n * The URL for the avatar image of the user interacting with the chat.\n *\n * Optional field. Defaults to generic user avatar.\n */\n userAvatarUrl?: string;\n\n /**\n * The initial agent message that will be prepopulated when user opens the chatbot widget.\n *\n * Optional field. Default to value set in DocsHound.\n */\n firstMessage?: string;\n\n /**\n * Defines the theme of the chat interface, either 'light' or 'dark'.\n *\n * Optional field. Defaults to value set in DocsHound.\n */\n theme?: \"light\" | \"dark\";\n\n /**\n * Defines the position of the chat trigger on the screen. Can be either 'right', 'right-bottom' or 'right-top'.\n *\n * Optional field. Defaults to 'right'\n */\n position?: \"right\" | \"right-top\" | \"right-bottom\";\n\n /**\n * Sets the accent color of the chat interface (e.g., for buttons or highlights).\n *\n * Optional field. Defaults to value set in DocsHound.\n */\n accentColor?: string;\n\n /**\n * The label for the trigger button that starts the chat.\n *\n * Optional field. Defaults to value set in DocsHound.\n */\n triggerLabel?: string;\n\n /**\n * Authentication token for jwt / password / basic protected guides\n *\n * Optional field.\n */\n token?: string;\n\n /**\n * Authentication token for additional support MCP server\n *\n * Optional field.\n */\n mcpToken?: string;\n};\n\nexport const DocsHoundChat = ({\n src,\n agentName,\n agentAvatarUrl,\n accentColor,\n platform,\n position,\n theme,\n triggerLabel,\n userAvatarUrl,\n userId,\n userEmail,\n userName,\n firstMessage,\n token,\n mcpToken,\n}: DocsHoundChatProps) => {\n const id = `__DH_CHAT_SCRIPT__`;\n\n useEffect(() => {\n if (!customElements.get(\"docshound-chat\")) {\n let existingScript = document.getElementById(\n id\n ) as HTMLScriptElement | null;\n\n if (!existingScript) {\n let finalSrc = \"\";\n\n if (src.endsWith(\"/-/chat.js\")) {\n finalSrc = src;\n } else if (src.endsWith(\"/\")) {\n finalSrc = `${src}-/chat.js`;\n } else {\n finalSrc = `${src}/-/chat.js`;\n }\n\n const script = document.createElement(\"script\");\n script.src = finalSrc;\n script.id = id;\n script.type = \"text/javascript\";\n script.async = true;\n script.defer = true;\n document.head.appendChild(script);\n }\n }\n }, []);\n\n return (\n <docshound-chat\n agent-name={agentName}\n agent-avatar-url={agentAvatarUrl}\n accent-color={accentColor}\n platform={platform}\n position={position}\n theme={theme}\n trigger-label={triggerLabel}\n user-id={userId}\n user-email={userEmail}\n user-name={userName}\n user-avatar-url={userAvatarUrl}\n first-message={firstMessage}\n token={token}\n mcp-token={mcpToken}\n />\n );\n};\n","export function devWarn(...args: Parameters<typeof console.warn>) {\n if (process.env.NODE_ENV === 'development') {\n console.warn(...args);\n }\n}","import { useCallback } from \"react\";\nimport { devWarn } from \"../utils/devLog\";\n\ntype UseDocsHoundChat = {\n\t/**\n\t * Method to clear thread and send a query on behalf of the user\n\t *\n\t * @param question - user query\n\t */\n\tsendQuestion: (question: string) => void;\n\n\t/**\n\t * Method to show or hide the chat component\n\t *\n\t * @param show - Whether to show or hide the chat component\n\t */\n\tshow: (show: boolean) => void;\n\n\t/**\n\t * Method to clear history of the chat component\n\t */\n\tclear: () => void;\n};\n\nexport function useDocsHoundChat(): UseDocsHoundChat {\n\tconst show = useCallback((show: boolean) => {\n\t\tconst element = document.querySelector(\n\t\t\t\"docshound-chat\"\n\t\t) as DocsHoundChatElement | null;\n\t\tif (element && element.show) {\n\t\t\telement.show(show);\n\t\t} else {\n\t\t\tdevWarn(\"DocsHound Chat component not mounted or not initialized\");\n\t\t}\n\t}, []);\n\n\tconst clear = useCallback(() => {\n\t\tconst element = document.querySelector(\n\t\t\t\"docshound-chat\"\n\t\t) as DocsHoundChatElement | null;\n\t\tif (element && element.clear) {\n\t\t\telement.clear();\n\t\t} else {\n\t\t\tdevWarn(\"DocsHound Chat component not mounted or not initialized\");\n\t\t}\n\t}, []);\n\n\tconst sendQuestion = useCallback((question: string) => {\n\t\tconst element = document.querySelector(\n\t\t\t\"docshound-chat\"\n\t\t) as DocsHoundChatElement | null;\n\t\tif (element && element.sendQuestion) {\n\t\t\telement.sendQuestion(question);\n\t\t} else {\n\t\t\tdevWarn(\"DocsHound Chat component not mounted or not initialized\");\n\t\t}\n\t}, []);\n\n\t// Return the show and clear methods\n\treturn { show, clear, sendQuestion };\n}\n\nexport default useDocsHoundChat;\n"],"names":["DocsHoundChat","src","agentName","agentAvatarUrl","accentColor","platform","position","theme","triggerLabel","userAvatarUrl","userId","userEmail","userName","firstMessage","token","mcpToken","id","useEffect","customElements","get","document","getElementById","finalSrc","endsWith","script","createElement","type","async","defer","head","appendChild","_jsx","devWarn","args","process","env","NODE_ENV","console","warn","useDocsHoundChat","show","useCallback","element","querySelector","clear","sendQuestion","question"],"mappings":"2FAkHO,MAAMA,EAAgB,EAC3BC,MACAC,YACAC,iBACAC,cACAC,WACAC,WACAC,QACAC,eACAC,gBACAC,SACAC,YACAC,WACAC,eACAC,QACAC,eAEA,MAAMC,EAAK,qBA8BX,OA5BAC,EAAU,KACR,IAAKC,eAAeC,IAAI,kBAAmB,CAKzC,IAJqBC,SAASC,eAC5BL,GAGmB,CACnB,IAAIM,EAAW,GAGbA,EADErB,EAAIsB,SAAS,cACJtB,EACFA,EAAIsB,SAAS,KACX,GAAGtB,aAEH,GAAGA,cAGhB,MAAMuB,EAASJ,SAASK,cAAc,UACtCD,EAAOvB,IAAMqB,EACbE,EAAOR,GAAKA,EACZQ,EAAOE,KAAO,kBACdF,EAAOG,OAAQ,EACfH,EAAOI,OAAQ,EACfR,SAASS,KAAKC,YAAYN,EAC5B,CACF,GACC,IAGDO,EAAA,iBAAA,CAAA,aACc7B,EAAS,mBACHC,iBACJC,EACdC,SAAUA,EACVC,SAAUA,EACVC,MAAOA,EAAK,gBACGC,YACNE,EAAM,aACHC,EAAS,YACVC,oBACMH,EAAa,gBACfI,EACfC,MAAOA,cACIC,KChLX,SAAUiB,KAAWC,GACI,gBAAzBC,QAAQC,IAAIC,UACdC,QAAQC,QAAQL,EAEpB,UCoBgBM,IAmCf,MAAO,CAAEC,KAlCIC,EAAaD,IACzB,MAAME,EAAUtB,SAASuB,cACxB,kBAEGD,GAAWA,EAAQF,KACtBE,EAAQF,KAAKA,GAEbR,EAAQ,4DAEP,IAyBYY,MAvBDH,EAAY,KACzB,MAAMC,EAAUtB,SAASuB,cACxB,kBAEGD,GAAWA,EAAQE,MACtBF,EAAQE,QAERZ,EAAQ,4DAEP,IAcmBa,aAZDJ,EAAaK,IACjC,MAAMJ,EAAUtB,SAASuB,cACxB,kBAEGD,GAAWA,EAAQG,aACtBH,EAAQG,aAAaC,GAErBd,EAAQ,4DAEP,IAIJ"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),t=require("react");function o(...e){"development"===process.env.NODE_ENV&&console.warn(...e)}exports.DocsHoundChat=({src:o,agentName:n,agentAvatarUrl:s,accentColor:a,platform:c,position:r,theme:u,triggerLabel:d,userAvatarUrl:i,userId:l,userEmail:m,userName:h,firstMessage:p,token:g})=>{const
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),t=require("react");function o(...e){"development"===process.env.NODE_ENV&&console.warn(...e)}exports.DocsHoundChat=({src:o,agentName:n,agentAvatarUrl:s,accentColor:a,platform:c,position:r,theme:u,triggerLabel:d,userAvatarUrl:i,userId:l,userEmail:m,userName:h,firstMessage:p,token:g,mcpToken:C})=>{const f="__DH_CHAT_SCRIPT__";return t.useEffect(()=>{if(!customElements.get("docshound-chat")){if(!document.getElementById(f)){let e="";e=o.endsWith("/-/chat.js")?o:o.endsWith("/")?`${o}-/chat.js`:`${o}/-/chat.js`;const t=document.createElement("script");t.src=e,t.id=f,t.type="text/javascript",t.async=!0,t.defer=!0,document.head.appendChild(t)}}},[]),e.jsx("docshound-chat",{"agent-name":n,"agent-avatar-url":s,"accent-color":a,platform:c,position:r,theme:u,"trigger-label":d,"user-id":l,"user-email":m,"user-name":h,"user-avatar-url":i,"first-message":p,token:g,"mcp-token":C})},exports.useDocsHoundChat=function(){return{show:t.useCallback(e=>{const t=document.querySelector("docshound-chat");t&&t.show?t.show(e):o("DocsHound Chat component not mounted or not initialized")},[]),clear:t.useCallback(()=>{const e=document.querySelector("docshound-chat");e&&e.clear?e.clear():o("DocsHound Chat component not mounted or not initialized")},[]),sendQuestion:t.useCallback(e=>{const t=document.querySelector("docshound-chat");t&&t.sendQuestion?t.sendQuestion(e):o("DocsHound Chat component not mounted or not initialized")},[])}};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/utils/devLog.ts","../src/components/DocsHoundChat.tsx","../src/hooks/useDocsHoundChat.tsx"],"sourcesContent":["export function devWarn(...args: Parameters<typeof console.warn>) {\n if (process.env.NODE_ENV === 'development') {\n console.warn(...args);\n }\n}","import { useEffect } from \"react\";\n\nexport type DocsHoundChatProps = {\n
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/utils/devLog.ts","../src/components/DocsHoundChat.tsx","../src/hooks/useDocsHoundChat.tsx"],"sourcesContent":["export function devWarn(...args: Parameters<typeof console.warn>) {\n if (process.env.NODE_ENV === 'development') {\n console.warn(...args);\n }\n}","import { useEffect } from \"react\";\n\nexport type DocsHoundChatProps = {\n /**\n * Domain where the guide is published. Eg: https://docs.docshound.com\n *\n * This field is not reactive, so if you change it, you need to reload the page.\n *\n * Required field;\n */\n src: string;\n\n /**\n * The name of the agent responding in the chat.\n *\n * Optional field. Defaults to value set in the DocsHound.\n */\n agentName?: string;\n\n /**\n * The URL for the avatar image of the agent.\n *\n * Optional field. Defaults to value set in the DocsHound.\n */\n agentAvatarUrl?: string;\n\n /**\n * A unique identifier for the user interacting with the chat.\n * This should be unique identifier coming from your system.\n * Used to identify the user and their support tickets.\n *\n * Optional field. Defaults to undefined.\n */\n userId?: string;\n\n /**\n * The email address of the user interacting with the chat.\n * Will be pre-filled for the user when they decide to submit a support ticket.\n *\n * Optional field. Defaults to undefined.\n */\n userEmail?: string;\n\n /**\n * The display name of the user interacting with the chat.\n *\n * Optional field. Defaults to 'You'.\n */\n userName?: string;\n\n /**\n * The platform where the chat is being used. Could be either 'site' (marketing site), 'app' (application), or 'docs' (documentation site / platform).\n *\n * Optional field, defaults to 'app'.\n */\n platform?: \"site\" | \"app\" | \"docs\";\n\n /**\n * The URL for the avatar image of the user interacting with the chat.\n *\n * Optional field. Defaults to generic user avatar.\n */\n userAvatarUrl?: string;\n\n /**\n * The initial agent message that will be prepopulated when user opens the chatbot widget.\n *\n * Optional field. Default to value set in DocsHound.\n */\n firstMessage?: string;\n\n /**\n * Defines the theme of the chat interface, either 'light' or 'dark'.\n *\n * Optional field. Defaults to value set in DocsHound.\n */\n theme?: \"light\" | \"dark\";\n\n /**\n * Defines the position of the chat trigger on the screen. Can be either 'right', 'right-bottom' or 'right-top'.\n *\n * Optional field. Defaults to 'right'\n */\n position?: \"right\" | \"right-top\" | \"right-bottom\";\n\n /**\n * Sets the accent color of the chat interface (e.g., for buttons or highlights).\n *\n * Optional field. Defaults to value set in DocsHound.\n */\n accentColor?: string;\n\n /**\n * The label for the trigger button that starts the chat.\n *\n * Optional field. Defaults to value set in DocsHound.\n */\n triggerLabel?: string;\n\n /**\n * Authentication token for jwt / password / basic protected guides\n *\n * Optional field.\n */\n token?: string;\n\n /**\n * Authentication token for additional support MCP server\n *\n * Optional field.\n */\n mcpToken?: string;\n};\n\nexport const DocsHoundChat = ({\n src,\n agentName,\n agentAvatarUrl,\n accentColor,\n platform,\n position,\n theme,\n triggerLabel,\n userAvatarUrl,\n userId,\n userEmail,\n userName,\n firstMessage,\n token,\n mcpToken,\n}: DocsHoundChatProps) => {\n const id = `__DH_CHAT_SCRIPT__`;\n\n useEffect(() => {\n if (!customElements.get(\"docshound-chat\")) {\n let existingScript = document.getElementById(\n id\n ) as HTMLScriptElement | null;\n\n if (!existingScript) {\n let finalSrc = \"\";\n\n if (src.endsWith(\"/-/chat.js\")) {\n finalSrc = src;\n } else if (src.endsWith(\"/\")) {\n finalSrc = `${src}-/chat.js`;\n } else {\n finalSrc = `${src}/-/chat.js`;\n }\n\n const script = document.createElement(\"script\");\n script.src = finalSrc;\n script.id = id;\n script.type = \"text/javascript\";\n script.async = true;\n script.defer = true;\n document.head.appendChild(script);\n }\n }\n }, []);\n\n return (\n <docshound-chat\n agent-name={agentName}\n agent-avatar-url={agentAvatarUrl}\n accent-color={accentColor}\n platform={platform}\n position={position}\n theme={theme}\n trigger-label={triggerLabel}\n user-id={userId}\n user-email={userEmail}\n user-name={userName}\n user-avatar-url={userAvatarUrl}\n first-message={firstMessage}\n token={token}\n mcp-token={mcpToken}\n />\n );\n};\n","import { useCallback } from \"react\";\nimport { devWarn } from \"../utils/devLog\";\n\ntype UseDocsHoundChat = {\n\t/**\n\t * Method to clear thread and send a query on behalf of the user\n\t *\n\t * @param question - user query\n\t */\n\tsendQuestion: (question: string) => void;\n\n\t/**\n\t * Method to show or hide the chat component\n\t *\n\t * @param show - Whether to show or hide the chat component\n\t */\n\tshow: (show: boolean) => void;\n\n\t/**\n\t * Method to clear history of the chat component\n\t */\n\tclear: () => void;\n};\n\nexport function useDocsHoundChat(): UseDocsHoundChat {\n\tconst show = useCallback((show: boolean) => {\n\t\tconst element = document.querySelector(\n\t\t\t\"docshound-chat\"\n\t\t) as DocsHoundChatElement | null;\n\t\tif (element && element.show) {\n\t\t\telement.show(show);\n\t\t} else {\n\t\t\tdevWarn(\"DocsHound Chat component not mounted or not initialized\");\n\t\t}\n\t}, []);\n\n\tconst clear = useCallback(() => {\n\t\tconst element = document.querySelector(\n\t\t\t\"docshound-chat\"\n\t\t) as DocsHoundChatElement | null;\n\t\tif (element && element.clear) {\n\t\t\telement.clear();\n\t\t} else {\n\t\t\tdevWarn(\"DocsHound Chat component not mounted or not initialized\");\n\t\t}\n\t}, []);\n\n\tconst sendQuestion = useCallback((question: string) => {\n\t\tconst element = document.querySelector(\n\t\t\t\"docshound-chat\"\n\t\t) as DocsHoundChatElement | null;\n\t\tif (element && element.sendQuestion) {\n\t\t\telement.sendQuestion(question);\n\t\t} else {\n\t\t\tdevWarn(\"DocsHound Chat component not mounted or not initialized\");\n\t\t}\n\t}, []);\n\n\t// Return the show and clear methods\n\treturn { show, clear, sendQuestion };\n}\n\nexport default useDocsHoundChat;\n"],"names":["devWarn","args","process","env","NODE_ENV","console","warn","src","agentName","agentAvatarUrl","accentColor","platform","position","theme","triggerLabel","userAvatarUrl","userId","userEmail","userName","firstMessage","token","mcpToken","id","useEffect","customElements","get","document","getElementById","finalSrc","endsWith","script","createElement","type","async","defer","head","appendChild","_jsx","show","useCallback","element","querySelector","clear","sendQuestion","question"],"mappings":"mEAAM,SAAUA,KAAWC,GACI,gBAAzBC,QAAQC,IAAIC,UACdC,QAAQC,QAAQL,EAEpB,uBC8G6B,EAC3BM,MACAC,YACAC,iBACAC,cACAC,WACAC,WACAC,QACAC,eACAC,gBACAC,SACAC,YACAC,WACAC,eACAC,QACAC,eAEA,MAAMC,EAAK,qBA8BX,OA5BAC,EAAAA,UAAU,KACR,IAAKC,eAAeC,IAAI,kBAAmB,CAKzC,IAJqBC,SAASC,eAC5BL,GAGmB,CACnB,IAAIM,EAAW,GAGbA,EADErB,EAAIsB,SAAS,cACJtB,EACFA,EAAIsB,SAAS,KACX,GAAGtB,aAEH,GAAGA,cAGhB,MAAMuB,EAASJ,SAASK,cAAc,UACtCD,EAAOvB,IAAMqB,EACbE,EAAOR,GAAKA,EACZQ,EAAOE,KAAO,kBACdF,EAAOG,OAAQ,EACfH,EAAOI,OAAQ,EACfR,SAASS,KAAKC,YAAYN,EAC5B,CACF,GACC,IAGDO,EAAAA,IAAA,iBAAA,CAAA,aACc7B,EAAS,mBACHC,iBACJC,EACdC,SAAUA,EACVC,SAAUA,EACVC,MAAOA,EAAK,gBACGC,YACNE,EAAM,aACHC,EAAS,YACVC,oBACMH,EAAa,gBACfI,EACfC,MAAOA,cACIC,yCCrHhB,MAAO,CAAEiB,KAlCIC,cAAaD,IACzB,MAAME,EAAUd,SAASe,cACxB,kBAEGD,GAAWA,EAAQF,KACtBE,EAAQF,KAAKA,GAEbtC,EAAQ,4DAEP,IAyBY0C,MAvBDH,EAAAA,YAAY,KACzB,MAAMC,EAAUd,SAASe,cACxB,kBAEGD,GAAWA,EAAQE,MACtBF,EAAQE,QAER1C,EAAQ,4DAEP,IAcmB2C,aAZDJ,cAAaK,IACjC,MAAMJ,EAAUd,SAASe,cACxB,kBAEGD,GAAWA,EAAQG,aACtBH,EAAQG,aAAaC,GAErB5C,EAAQ,4DAEP,IAIJ"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docshound/chat-react",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.10.1",
|
|
5
5
|
"description": "React component library for integrating the DocsHound chat widget into React and Next.js applications.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"React",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"Documentation",
|
|
14
14
|
"Knowledge Base"
|
|
15
15
|
],
|
|
16
|
-
"author": "DocsHound",
|
|
16
|
+
"author": "DocsHound, Inc.",
|
|
17
17
|
"files": [
|
|
18
18
|
"dist"
|
|
19
19
|
],
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@rollup/plugin-commonjs": "^28.0.1",
|
|
30
30
|
"@rollup/plugin-node-resolve": "^15.3.0",
|
|
31
|
-
"@rollup/plugin-terser": "^0.
|
|
31
|
+
"@rollup/plugin-terser": "^1.0.2",
|
|
32
32
|
"@rollup/plugin-typescript": "^12.1.1",
|
|
33
33
|
"@types/node": "^22.7.8",
|
|
34
34
|
"@types/react": "^18",
|