@snf/access-qa-bot 2.1.0-rc.2 → 2.1.0-rc.5
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 +37 -97
- 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 +26 -26
- 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 +6 -35
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -15,37 +15,26 @@ interface QABotProps {
|
|
|
15
15
|
// Note: The React component uses controlled mode - manage state in your parent component:
|
|
16
16
|
//
|
|
17
17
|
// const [isOpen, setIsOpen] = useState(false);
|
|
18
|
-
//
|
|
18
|
+
// const [userLoggedIn, setUserLoggedIn] = useState(false);
|
|
19
|
+
// <QABot open={isOpen} onOpenChange={setIsOpen} isLoggedIn={userLoggedIn} />
|
|
19
20
|
//
|
|
20
|
-
// To
|
|
21
|
+
// To send messages programmatically, use the ref:
|
|
21
22
|
// const botRef = useRef();
|
|
22
|
-
// botRef.current?.
|
|
23
|
+
// botRef.current?.addMessage("Hello World!");
|
|
23
24
|
|
|
24
25
|
// React component
|
|
25
26
|
export const QABot: React.ForwardRefExoticComponent<
|
|
26
27
|
QABotProps & React.RefAttributes<{
|
|
27
28
|
addMessage: (message: string) => void;
|
|
28
|
-
setBotIsLoggedIn: (status: boolean) => void;
|
|
29
|
-
openChat: () => void;
|
|
30
|
-
closeChat: () => void;
|
|
31
|
-
toggleChat: () => void;
|
|
32
29
|
}>
|
|
33
30
|
>;
|
|
34
31
|
|
|
35
|
-
//
|
|
36
|
-
export class WebComponentQABot extends HTMLElement {
|
|
37
|
-
static observedAttributes: string[];
|
|
38
|
-
attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
|
|
39
|
-
connectedCallback(): void;
|
|
40
|
-
disconnectedCallback(): void;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Function for non-React integration
|
|
32
|
+
// Function for non-React integration (now React-backed for everything)
|
|
44
33
|
interface QABotConfig extends QABotProps {
|
|
45
34
|
target: HTMLElement;
|
|
46
35
|
}
|
|
47
36
|
|
|
48
|
-
// Main function for programmatic usage (
|
|
37
|
+
// Main function for programmatic usage (now React-backed for all usage)
|
|
49
38
|
export function qaBot(config: QABotConfig): {
|
|
50
39
|
addMessage: (message: string) => void;
|
|
51
40
|
setBotIsLoggedIn: (status: boolean) => void;
|
|
@@ -55,23 +44,5 @@ export function qaBot(config: QABotConfig): {
|
|
|
55
44
|
destroy: () => void;
|
|
56
45
|
};
|
|
57
46
|
|
|
58
|
-
// Web Component specific function (exposed in the standalone bundle)
|
|
59
|
-
export function webComponentQABot(config: QABotConfig): () => void;
|
|
60
|
-
|
|
61
47
|
// Default export (React component)
|
|
62
48
|
export default QABot;
|
|
63
|
-
|
|
64
|
-
// Augment the HTMLElementTagNameMap to include our custom element
|
|
65
|
-
declare global {
|
|
66
|
-
interface HTMLElementTagNameMap {
|
|
67
|
-
'qa-bot': WebComponentQABot;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// Global object for standalone usage
|
|
71
|
-
interface Window {
|
|
72
|
-
qaBot?: typeof webComponentQABot;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// Global function available without window prefix
|
|
76
|
-
var qaBot: typeof webComponentQABot;
|
|
77
|
-
}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@snf/access-qa-bot",
|
|
3
|
-
"version": "2.1.0-rc.
|
|
3
|
+
"version": "2.1.0-rc.5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"homepage": ".",
|
|
6
|
-
"description": "ACCESS Q&A Bot React Component
|
|
6
|
+
"description": "ACCESS Q&A Bot React Component",
|
|
7
7
|
"main": "./dist/access-qa-bot.umd.cjs",
|
|
8
8
|
"module": "./dist/access-qa-bot.js",
|
|
9
9
|
"exports": {
|