@snf/access-qa-bot 0.3.0 → 1.0.0-beta.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,29 @@
1
1
  interface QABotProps {
2
2
  isLoggedIn?: boolean;
3
- isOpen?: boolean;
3
+ isAnonymous?: boolean;
4
+ defaultOpen?: boolean;
4
5
  apiKey?: string;
5
6
  embedded?: boolean;
6
7
  welcome?: string;
7
8
  prompt?: string;
8
9
  disabled?: boolean;
10
+ visible?: boolean;
9
11
  onClose?: () => void;
10
12
  [key: string]: any; // Allow additional props
11
13
  }
12
14
 
15
+ // React component with ref
16
+ interface QABotRef {
17
+ toggle: () => boolean;
18
+ open: () => void;
19
+ close: () => void;
20
+ isOpen: () => boolean;
21
+ }
22
+
13
23
  // React component
14
- export const QABot: (props: QABotProps) => JSX.Element;
24
+ export const QABot: React.ForwardRefExoticComponent<
25
+ QABotProps & React.RefAttributes<QABotRef>
26
+ >;
15
27
 
16
28
  // Web Component class (available in the standalone build)
17
29
  export class WebComponentQABot extends HTMLElement {
@@ -19,18 +31,31 @@ export class WebComponentQABot extends HTMLElement {
19
31
  attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
20
32
  connectedCallback(): void;
21
33
  disconnectedCallback(): void;
34
+ toggle(): boolean;
35
+ open(): void;
36
+ close(): void;
37
+ isOpen(): boolean;
22
38
  }
23
39
 
24
40
  // Function for non-React integration
25
41
  interface QAndAToolConfig extends QABotProps {
26
42
  target: HTMLElement;
43
+ returnRef?: boolean;
44
+ }
45
+
46
+ // Return type when returnRef is true
47
+ interface QABotControlMethods {
48
+ toggle: () => boolean;
49
+ open: () => void;
50
+ close: () => void;
51
+ isOpen: () => boolean;
27
52
  }
28
53
 
29
54
  // Main function for programmatic usage (works with React or Web Component)
30
- export function qAndATool(config: QAndAToolConfig): () => void;
55
+ export function qAndATool(config: QAndAToolConfig): (() => void) | QABotControlMethods;
31
56
 
32
57
  // Web Component specific function (exposed in the standalone bundle)
33
- export function webComponentQAndATool(config: QAndAToolConfig): () => void;
58
+ export function webComponentQAndATool(config: QAndAToolConfig): (() => void) | QABotControlMethods;
34
59
 
35
60
  // Default export (React component)
36
61
  export default QABot;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snf/access-qa-bot",
3
- "version": "0.3.0",
3
+ "version": "1.0.0-beta.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.35"
25
25
  },
26
26
  "peerDependencies": {
27
27
  "preact": "^10.0.0",