@snf/access-qa-bot 1.0.0-beta.1 → 2.0.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/README.md +266 -112
- package/build/static/css/main.css +1 -1
- package/build/static/css/main.css.map +1 -1
- package/build/static/js/main.js +1 -1
- package/build/static/js/main.js.map +1 -1
- package/dist/access-qa-bot.js +1 -1
- package/dist/access-qa-bot.js.map +1 -1
- package/dist/access-qa-bot.standalone.js +4 -4
- package/dist/access-qa-bot.standalone.js.map +1 -1
- package/dist/access-qa-bot.umd.cjs +1 -1
- package/dist/access-qa-bot.umd.cjs.map +1 -1
- package/index.d.ts +30 -36
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
interface QABotProps {
|
|
2
|
-
isLoggedIn?: boolean;
|
|
3
|
-
isAnonymous?: boolean;
|
|
4
|
-
defaultOpen?: boolean;
|
|
5
2
|
apiKey?: string;
|
|
3
|
+
/** Whether the chat window is open by default (floating mode only, ignored for embedded) */
|
|
4
|
+
defaultOpen?: boolean;
|
|
5
|
+
/** Whether the bot is embedded in the page (always open when embedded) */
|
|
6
6
|
embedded?: boolean;
|
|
7
|
+
isLoggedIn?: boolean;
|
|
8
|
+
loginUrl?: string;
|
|
7
9
|
welcome?: string;
|
|
8
|
-
prompt?: string;
|
|
9
|
-
disabled?: boolean;
|
|
10
|
-
visible?: boolean;
|
|
11
|
-
onClose?: () => void;
|
|
12
10
|
[key: string]: any; // Allow additional props
|
|
13
11
|
}
|
|
14
12
|
|
|
15
|
-
//
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
open: () => void;
|
|
19
|
-
close: () => void;
|
|
20
|
-
isOpen: () => boolean;
|
|
21
|
-
}
|
|
13
|
+
// Note: To control the chat window externally, use the useChatWindow hook from react-chatbotify:
|
|
14
|
+
// import { useChatWindow } from 'react-chatbotify';
|
|
15
|
+
// const { toggleChatWindow } = useChatWindow();
|
|
22
16
|
|
|
23
17
|
// React component
|
|
24
18
|
export const QABot: React.ForwardRefExoticComponent<
|
|
25
|
-
QABotProps & React.RefAttributes<
|
|
19
|
+
QABotProps & React.RefAttributes<{
|
|
20
|
+
addMessage: (message: string) => void;
|
|
21
|
+
setBotIsLoggedIn: (status: boolean) => void;
|
|
22
|
+
openChat: () => void;
|
|
23
|
+
closeChat: () => void;
|
|
24
|
+
toggleChat: () => void;
|
|
25
|
+
}>
|
|
26
26
|
>;
|
|
27
27
|
|
|
28
28
|
// Web Component class (available in the standalone build)
|
|
@@ -31,31 +31,25 @@ export class WebComponentQABot extends HTMLElement {
|
|
|
31
31
|
attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
|
|
32
32
|
connectedCallback(): void;
|
|
33
33
|
disconnectedCallback(): void;
|
|
34
|
-
toggle(): boolean;
|
|
35
|
-
open(): void;
|
|
36
|
-
close(): void;
|
|
37
|
-
isOpen(): boolean;
|
|
38
34
|
}
|
|
39
35
|
|
|
40
36
|
// Function for non-React integration
|
|
41
|
-
interface
|
|
37
|
+
interface QABotConfig extends QABotProps {
|
|
42
38
|
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;
|
|
52
39
|
}
|
|
53
40
|
|
|
54
41
|
// Main function for programmatic usage (works with React or Web Component)
|
|
55
|
-
export function
|
|
42
|
+
export function qaBot(config: QABotConfig): {
|
|
43
|
+
addMessage: (message: string) => void;
|
|
44
|
+
setBotIsLoggedIn: (status: boolean) => void;
|
|
45
|
+
openChat: () => void;
|
|
46
|
+
closeChat: () => void;
|
|
47
|
+
toggleChat: () => void;
|
|
48
|
+
destroy: () => void;
|
|
49
|
+
};
|
|
56
50
|
|
|
57
51
|
// Web Component specific function (exposed in the standalone bundle)
|
|
58
|
-
export function
|
|
52
|
+
export function webComponentQABot(config: QABotConfig): () => void;
|
|
59
53
|
|
|
60
54
|
// Default export (React component)
|
|
61
55
|
export default QABot;
|
|
@@ -63,14 +57,14 @@ export default QABot;
|
|
|
63
57
|
// Augment the HTMLElementTagNameMap to include our custom element
|
|
64
58
|
declare global {
|
|
65
59
|
interface HTMLElementTagNameMap {
|
|
66
|
-
'
|
|
60
|
+
'qa-bot': WebComponentQABot;
|
|
67
61
|
}
|
|
68
62
|
|
|
69
63
|
// Global object for standalone usage
|
|
70
64
|
interface Window {
|
|
71
|
-
|
|
72
|
-
WebComponentQABot: typeof WebComponentQABot;
|
|
73
|
-
qAndATool: typeof webComponentQAndATool;
|
|
74
|
-
}
|
|
65
|
+
qaBot?: typeof webComponentQABot;
|
|
75
66
|
}
|
|
67
|
+
|
|
68
|
+
// Global function available without window prefix
|
|
69
|
+
var qaBot: typeof webComponentQABot;
|
|
76
70
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@snf/access-qa-bot",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.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.
|
|
24
|
+
"react-chatbotify": "^2.0.0-beta.38"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"preact": "^10.0.0",
|