@snf/access-qa-bot 0.3.1 → 1.1.0-rc.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/index.d.ts CHANGED
@@ -1,17 +1,31 @@
1
1
  interface QABotProps {
2
- isLoggedIn?: boolean;
3
- isOpen?: boolean;
4
2
  apiKey?: string;
3
+ /** Whether the chat window is open by default (floating mode only, ignored for embedded) */
4
+ defaultOpen?: boolean;
5
+ disabled?: boolean;
6
+ /** Whether the bot is embedded in the page (always open when embedded) */
5
7
  embedded?: boolean;
6
- welcome?: string;
8
+ isLoggedIn?: boolean;
9
+ loginUrl?: string;
7
10
  prompt?: string;
8
- disabled?: boolean;
9
- onClose?: () => void;
11
+ welcome?: string;
10
12
  [key: string]: any; // Allow additional props
11
13
  }
12
14
 
15
+ // Note: To control the chat window externally, use the useChatWindow hook from react-chatbotify:
16
+ // import { useChatWindow } from 'react-chatbotify';
17
+ // const { toggleChatWindow } = useChatWindow();
18
+
13
19
  // React component
14
- export const QABot: (props: QABotProps) => JSX.Element;
20
+ export const QABot: React.ForwardRefExoticComponent<
21
+ QABotProps & React.RefAttributes<{
22
+ addMessage: (message: string) => void;
23
+ setBotIsLoggedIn: (status: boolean) => void;
24
+ openChat: () => void;
25
+ closeChat: () => void;
26
+ toggleChat: () => void;
27
+ }>
28
+ >;
15
29
 
16
30
  // Web Component class (available in the standalone build)
17
31
  export class WebComponentQABot extends HTMLElement {
@@ -22,15 +36,22 @@ export class WebComponentQABot extends HTMLElement {
22
36
  }
23
37
 
24
38
  // Function for non-React integration
25
- interface QAndAToolConfig extends QABotProps {
39
+ interface AccessQABotConfig extends QABotProps {
26
40
  target: HTMLElement;
27
41
  }
28
42
 
29
43
  // Main function for programmatic usage (works with React or Web Component)
30
- export function qAndATool(config: QAndAToolConfig): () => void;
44
+ export function accessQABot(config: AccessQABotConfig): {
45
+ addMessage: (message: string) => void;
46
+ setBotIsLoggedIn: (status: boolean) => void;
47
+ openChat: () => void;
48
+ closeChat: () => void;
49
+ toggleChat: () => void;
50
+ destroy: () => void;
51
+ };
31
52
 
32
53
  // Web Component specific function (exposed in the standalone bundle)
33
- export function webComponentQAndATool(config: QAndAToolConfig): () => void;
54
+ export function webComponentAccessQABot(config: AccessQABotConfig): () => void;
34
55
 
35
56
  // Default export (React component)
36
57
  export default QABot;
@@ -43,9 +64,9 @@ declare global {
43
64
 
44
65
  // Global object for standalone usage
45
66
  interface Window {
46
- accessQABot?: {
47
- WebComponentQABot: typeof WebComponentQABot;
48
- qAndATool: typeof webComponentQAndATool;
49
- }
67
+ accessQABot?: typeof webComponentAccessQABot;
50
68
  }
69
+
70
+ // Global function available without window prefix
71
+ var accessQABot: typeof webComponentAccessQABot;
51
72
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snf/access-qa-bot",
3
- "version": "0.3.1",
3
+ "version": "1.1.0-rc.1",
4
4
  "private": false,
5
5
  "homepage": ".",
6
6
  "description": "ACCESS Q&A Bot React Component and Web Component",
@@ -21,7 +21,7 @@
21
21
  "index.d.ts"
22
22
  ],
23
23
  "dependencies": {
24
- "react-chatbotify": "^2.0.0-beta.32"
24
+ "react-chatbotify": "^2.0.0-beta.38"
25
25
  },
26
26
  "peerDependencies": {
27
27
  "preact": "^10.0.0",