imacaron-chatbot 0.3.0
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 +21 -0
- package/README.md +126 -0
- package/dist/Answer.d.ts +7 -0
- package/dist/Answer.js +7 -0
- package/dist/Answer.js.map +1 -0
- package/dist/Answers.d.ts +8 -0
- package/dist/Answers.js +7 -0
- package/dist/Answers.js.map +1 -0
- package/dist/Chatbot.d.ts +7 -0
- package/dist/Chatbot.js +121 -0
- package/dist/Chatbot.js.map +1 -0
- package/dist/History.d.ts +8 -0
- package/dist/History.js +11 -0
- package/dist/History.js.map +1 -0
- package/dist/Input.d.ts +7 -0
- package/dist/Input.js +24 -0
- package/dist/Input.js.map +1 -0
- package/dist/Question.d.ts +7 -0
- package/dist/Question.js +9 -0
- package/dist/Question.js.map +1 -0
- package/dist/Send.d.ts +2 -0
- package/dist/Send.js +6 -0
- package/dist/Send.js.map +1 -0
- package/dist/hooks/useChatbot.d.ts +2 -0
- package/dist/hooks/useChatbot.js +44 -0
- package/dist/hooks/useChatbot.js.map +1 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.js +8 -0
- package/dist/main.js.map +1 -0
- package/dist/types/TBot.d.ts +18 -0
- package/dist/types/TBot.js +2 -0
- package/dist/types/TBot.js.map +1 -0
- package/dist/types/TConfig.d.ts +7 -0
- package/dist/types/TConfig.js +2 -0
- package/dist/types/TConfig.js.map +1 -0
- package/dist/types/TQuestions.d.ts +21 -0
- package/dist/types/TQuestions.js +2 -0
- package/dist/types/TQuestions.js.map +1 -0
- package/dist/utils.d.ts +3 -0
- package/dist/utils.js +9 -0
- package/dist/utils.js.map +1 -0
- package/index.css +2 -0
- package/package.json +52 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 MacaronFR
|
|
4
|
+
|
|
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:
|
|
11
|
+
|
|
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
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# Chatbot
|
|
2
|
+
|
|
3
|
+
## Usage
|
|
4
|
+
|
|
5
|
+
First, you will need to put the chatbot button and root in your HTML.
|
|
6
|
+
The minimal structure is the following:
|
|
7
|
+
```html
|
|
8
|
+
<div class="chatbot" id="chatbot-button">
|
|
9
|
+
<button class="button-icon">Open</button>
|
|
10
|
+
<button class="button-icon not-visible">Close</button>
|
|
11
|
+
<div id="chatbot_root" class="chatbot-container not-visible"></div>
|
|
12
|
+
</div>
|
|
13
|
+
```
|
|
14
|
+
The structure, class and id names are important and can't be changed. However, you can change the button content at your will.
|
|
15
|
+
|
|
16
|
+
This is the default content of the buttons:
|
|
17
|
+
```html
|
|
18
|
+
<div class="chatbot" id="chatbot-button">
|
|
19
|
+
<button class="button-icon">
|
|
20
|
+
<svg width="32" height="30" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill="currentColor"><g clip-path="url(#messages__clip0_14307_15730)"><path fill-opacity="0.01" d="M0 0h24v24H0z"></path><mask id="messages__b" maskUnits="userSpaceOnUse" x="0" y="0" width="24" height="24" style="mask-type: alpha;"><g clip-path="url(#messages__clip1_14307_15730)"><g clip-path="url(#messages__clip2_14307_15730)"><mask id="messages__a" maskUnits="userSpaceOnUse" x="1" y="0" width="23" height="23" style="mask-type: alpha;"><path d="M2.571 22.286h-.008.008z"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M17.143 4.286c1.414 0 2.571 1.157 2.571 2.571v8.572c0 1.414-1.157 2.571-2.571 2.571H7.209l-4.037 4.037c-.162.162-.384.247-.606.248-.11 0-.219-.017-.32-.068-.317-.128-.532-.445-.532-.788V6.857c0-1.414 1.157-2.571 2.572-2.571h12.857zM4.286 6c-.472 0-.857.386-.857.857v12.506l2.82-2.82c.162-.163.377-.249.608-.249h10.286c.471 0 .857-.385.857-.857V6.866c0-.472-.386-.857-.857-.857H4.286V6z"></path><path d="M20.571.857c1.415 0 2.572 1.158 2.572 2.572V12c0 .472-.386.857-.857.857-.472 0-.857-.385-.857-.857V3.43c0-.472-.386-.857-.858-.857H7.714c-.471 0-.857-.386-.857-.857 0-.472.386-.858.857-.858h12.857z"></path></mask><g mask="url(#messages__a)"><path d="M-1.714-1.714h27.429v27.429H-1.714z"></path></g></g></g></mask><g mask="url(#messages__b)"><path d="M0 0h24v24H0V0z"></path></g></g><defs><clipPath id="messages__clip0_14307_15730"><path d="M0 0h24v24H0z"></path></clipPath><clipPath id="messages__clip1_14307_15730"><path d="M0 0h24v24H0z"></path></clipPath><clipPath id="messages__clip2_14307_15730"><path transform="translate(-1.714 -1.714)" d="M0 0h27.429v27.429H0z"></path></clipPath></defs></svg>
|
|
21
|
+
</button>
|
|
22
|
+
<button class="button-icon not-visible">
|
|
23
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 19 18" class="conversations-visitor-close-icon"><g fill="none" fill-rule="evenodd" stroke="none" stroke-width="1"><g fill="currentColor" transform="translate(-927 -991) translate(900.277 962)"><g transform="translate(27 29)"><path d="M10.627 9.013l6.872 6.873.708.707-1.415 1.414-.707-.707-6.872-6.872L2.34 17.3l-.707.707L.22 16.593l.707-.707L7.8 9.013.946 2.161l-.707-.708L1.653.04l.707.707L9.213 7.6 16.066.746l.707-.707 1.414 1.414-.707.708-6.853 6.852z"></path></g></g></g></svg>
|
|
24
|
+
</button>
|
|
25
|
+
<div id="chatbot_root" class="chatbot-container not-visible"></div>
|
|
26
|
+
</div>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
After that you will need to add the script and CSS to load the chatbot
|
|
30
|
+
```html
|
|
31
|
+
<script type="module" src="chatbot.js"></script>
|
|
32
|
+
<link rel="stylesheet" href="chatbot.css">
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Finally, you will need to initialize the chatbot by listening to the `chatbot-loaded` event and then calling the `initChatbot` function.
|
|
36
|
+
This function takes one argument of type [`TConfig`](./src/types/TConfig.ts).
|
|
37
|
+
|
|
38
|
+
Example:
|
|
39
|
+
```typescript
|
|
40
|
+
document.addEventListener("chatbot-loaded", () => initChatbot({ ... })
|
|
41
|
+
);
|
|
42
|
+
```
|
|
43
|
+
## Configuration
|
|
44
|
+
|
|
45
|
+
To use the chatbot, you will need to provide at least a title and a list [`TQuestions`](./src/types/TQuestions.ts) object.
|
|
46
|
+
You can also provide a callback `onEnd` that will take the data you or the user sent during the chatbot.
|
|
47
|
+
You can finally customize the end message text by setting the `endMessage` property and the new chat button text by setting the `endButtonText` property.
|
|
48
|
+
|
|
49
|
+
### Example
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
const config: TConfig = {
|
|
53
|
+
title: "Chatbot title",
|
|
54
|
+
questions: { ... },
|
|
55
|
+
onEnd: (data) => console.log(data),
|
|
56
|
+
endMessage: "Thanks for chatting with us!",
|
|
57
|
+
endButtonText: "Open new chat",
|
|
58
|
+
};
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### [`TQuestions`](./src/types/TQuestions.ts)
|
|
62
|
+
|
|
63
|
+
The `TQuestions` object is a map of question id to `TQuestion` object.
|
|
64
|
+
Each `TQuestion` object contains at least a question as a string or a list of string (a list will display a chat bubble for each element).
|
|
65
|
+
It can also contain an action as a `TAction` object.
|
|
66
|
+
It may also contain a list of `TAnswer` objects.
|
|
67
|
+
And it may have a `goto` string that if provided will redirect automatically to the question with the given id.
|
|
68
|
+
The chatbot will always start at the question with id `start`.
|
|
69
|
+
|
|
70
|
+
### Exemple
|
|
71
|
+
|
|
72
|
+
```json
|
|
73
|
+
{
|
|
74
|
+
"start": {
|
|
75
|
+
"question": "First question",
|
|
76
|
+
"answers": [
|
|
77
|
+
{ "text": "Answer 1", "next": "other_id" },
|
|
78
|
+
{ "text": "Answer 2", "next": "other_id", "action": { "action": "set", "property": "prop1", "value": "value1" } }
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
"other_id": {
|
|
82
|
+
"question": ["Question", "In 2 messages"],
|
|
83
|
+
"goto": "end",
|
|
84
|
+
"action": { "action": "ask", "property": "prop2" }
|
|
85
|
+
},
|
|
86
|
+
"end": {
|
|
87
|
+
"question": "End of chatbot",
|
|
88
|
+
"action": { "action": "end" }
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### `TAction`
|
|
94
|
+
|
|
95
|
+
The `TAction` object contains an `action` property that can be either `ask`, `set` or end.
|
|
96
|
+
If the action is `ask`, the chatbot will ask the user a question and wait for a response to set the `property` to the response.
|
|
97
|
+
If the action is `set`, the chatbot will set the given `property` to the given `value`.
|
|
98
|
+
If the action is `end`, the chatbot will end the conversation and call the `onEnd` callback with the data provided by the user.
|
|
99
|
+
An action can also contain a `goto` property that will redirect the chatbot to the question with the given id.
|
|
100
|
+
|
|
101
|
+
### `TAnswer`
|
|
102
|
+
|
|
103
|
+
The `TAnswer` object contains a `text` property that will be displayed as a message and a `next` property that will redirect the chatbot to the question with the given id.
|
|
104
|
+
It can also contain an `action` property that will be executed after the message is displayed.
|
|
105
|
+
The `at` property is used internally and you don't need to set it.
|
|
106
|
+
|
|
107
|
+
## Customization
|
|
108
|
+
|
|
109
|
+
You can customize the chatbot colors by setting variables in the `theme` layer.
|
|
110
|
+
To not be overridden by the chatbot default, you must place your custom style after the link to `chatbot.css`.
|
|
111
|
+
|
|
112
|
+
### Variables
|
|
113
|
+
|
|
114
|
+
| Name | Default | Description |
|
|
115
|
+
|------------------------|--------------------|---------------------------------------------------------------------------------------|
|
|
116
|
+
| --color-primary | rgb(178, 69, 146) | The main color. Used on header, selected response, options hover and endButton color. |
|
|
117
|
+
| --color-primary-dark | rgb(154, 12, 113) | Dark declination of the primary color. Used on hover of enButton. |
|
|
118
|
+
| --color-onprimary | rgb(255, 255, 255) | Text color on primary container. Used in header text and button icon color. |
|
|
119
|
+
| --color-question | rgb(245, 243, 242) | Question container background color. |
|
|
120
|
+
| --color-question-text | rgb(0, 0, 0) | Question text color. Used in end message text. |
|
|
121
|
+
| --color-background | rgb(255, 255, 255) | Chatbot background color. |
|
|
122
|
+
| --color-option | rgb(51, 71, 91) | Option border and text color. |
|
|
123
|
+
| --color-option-hover | --color-primary | Option border and text color on hover. By default same as primary. |
|
|
124
|
+
| --color-input | rgb(30, 41, 57) | Footer input text and border color. |
|
|
125
|
+
| --color-input-disabled | rgb(166, 160, 155) | Footer input text and border color when disabled (no input required). |
|
|
126
|
+
|
package/dist/Answer.d.ts
ADDED
package/dist/Answer.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export default function Answer(props) {
|
|
3
|
+
return React.createElement("div", { className: "bg-primary rounded-lg px-4 py-2 self-end text-onprimary" },
|
|
4
|
+
React.createElement("p", null, props.text),
|
|
5
|
+
React.createElement("p", { className: "w-full text-end text-xs" }, props.at));
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=Answer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Answer.js","sourceRoot":"","sources":["../src/Answer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAkB;IAChD,OAAO,6BAAK,SAAS,EAAE,yDAAyD;QAC/E,+BAAI,KAAK,CAAC,IAAI,CAAK;QACnB,2BAAG,SAAS,EAAE,yBAAyB,IAAG,KAAK,CAAC,EAAE,CAAK,CAClD,CAAA;AACP,CAAC"}
|
package/dist/Answers.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export default function Answers(props) {
|
|
3
|
+
return React.createElement("div", { className: "self-end flex flex-row flex-wrap items-end gap-2 max-w-[284px]" }, props.answers.map((el, i) => {
|
|
4
|
+
return (React.createElement("div", { className: "cursor-pointer bg-transparent rounded-lg px-4 py-2 border border-option text-option hover:text-option-hover hover:border-option-hover", key: i, onClick: () => props.onClick(el) }, el.text));
|
|
5
|
+
}));
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=Answers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Answers.js","sourceRoot":"","sources":["../src/Answers.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,KAAmB;IAClD,OAAO,6BAAK,SAAS,EAAE,gEAAgE,IACrF,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE;QAC5B,OAAO,CACN,6BAAK,SAAS,EAAE,uIAAuI,EAAE,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,IAC/L,EAAE,CAAC,IAAI,CACH,CACN,CAAA;IACF,CAAC,CAAC,CACG,CAAA;AACP,CAAC"}
|
package/dist/Chatbot.js
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
2
|
+
import Question from "./Question";
|
|
3
|
+
import Answers from "./Answers";
|
|
4
|
+
import History from "./History";
|
|
5
|
+
import Input from "./Input";
|
|
6
|
+
import { currentTime } from "./utils";
|
|
7
|
+
import useChatbot from "./hooks/useChatbot";
|
|
8
|
+
import React from "react";
|
|
9
|
+
document.getElementById("chatbot_root").onclick = (e) => {
|
|
10
|
+
e.stopPropagation();
|
|
11
|
+
};
|
|
12
|
+
document.getElementById("chatbot-button").addEventListener("click", () => {
|
|
13
|
+
document.getElementById("chatbot_root").classList.toggle("not-visible");
|
|
14
|
+
document.querySelectorAll(".button-icon").forEach(el => {
|
|
15
|
+
el.classList.toggle("not-visible");
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
export default function Chatbot(props) {
|
|
19
|
+
const config = useChatbot(props.config);
|
|
20
|
+
const [data, setData] = useState({});
|
|
21
|
+
const [chatbot, setChatbot] = useState(config.bot.questions);
|
|
22
|
+
const [currentQuestion, setCurrentQuestion] = useState(null);
|
|
23
|
+
const [currentQuestionId, setCurrentQuestionId] = useState(null);
|
|
24
|
+
const [history, setHistory] = useState({});
|
|
25
|
+
const [answers, setAnswers] = useState({});
|
|
26
|
+
const [end, setEnd] = useState(false);
|
|
27
|
+
const container = useRef(null);
|
|
28
|
+
const audio = useMemo(() => {
|
|
29
|
+
return new Audio("/notification.mp3");
|
|
30
|
+
}, []);
|
|
31
|
+
const clickAnswer = useCallback((answer) => {
|
|
32
|
+
if (answer.next && currentQuestion) {
|
|
33
|
+
answer.at = currentTime();
|
|
34
|
+
setHistory(prev => ({ ...prev, [currentQuestionId]: currentQuestion }));
|
|
35
|
+
setCurrentQuestionId(answer.next);
|
|
36
|
+
setCurrentQuestion(chatbot[answer.next]);
|
|
37
|
+
setAnswers(prev => ({ ...prev, [currentQuestionId]: answer }));
|
|
38
|
+
if (answer.action) {
|
|
39
|
+
if (answer.action.action === "set") {
|
|
40
|
+
setData(prev => ({ ...prev, [answer.action.property]: answer.action?.value }));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}, [currentQuestion, chatbot, currentQuestionId]);
|
|
45
|
+
const sendAnswer = useCallback((input) => {
|
|
46
|
+
if (currentQuestion && currentQuestion.action && currentQuestion.action.property) {
|
|
47
|
+
const prop = currentQuestion.action.property;
|
|
48
|
+
setData(prev => ({ ...prev, [prop]: input }));
|
|
49
|
+
setHistory(prev => ({ ...prev, [currentQuestionId]: currentQuestion }));
|
|
50
|
+
setCurrentQuestionId(currentQuestion.action.goto);
|
|
51
|
+
setCurrentQuestion(chatbot[currentQuestion.action.goto]);
|
|
52
|
+
setAnswers(prev => ({ ...prev, [currentQuestionId]: { text: input, at: currentTime() } }));
|
|
53
|
+
}
|
|
54
|
+
}, [currentQuestion, currentQuestionId, chatbot]);
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
setChatbot(config.bot.questions);
|
|
57
|
+
}, [config]);
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
if (chatbot["start"] !== undefined) {
|
|
60
|
+
setCurrentQuestion(chatbot["start"]);
|
|
61
|
+
setCurrentQuestionId("start");
|
|
62
|
+
}
|
|
63
|
+
}, [chatbot]);
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
container?.current?.scrollBy(0, 500);
|
|
66
|
+
if (currentQuestion && currentQuestion.at === undefined) {
|
|
67
|
+
setCurrentQuestion(prev => ({ ...prev, at: currentTime() }));
|
|
68
|
+
currentQuestion.at = currentTime();
|
|
69
|
+
}
|
|
70
|
+
if (currentQuestion && currentQuestion.goto) {
|
|
71
|
+
const next = currentQuestion.goto;
|
|
72
|
+
setTimeout(() => {
|
|
73
|
+
setHistory(prev => ({ ...prev, [currentQuestionId]: currentQuestion }));
|
|
74
|
+
setCurrentQuestionId(next);
|
|
75
|
+
setCurrentQuestion(chatbot[next]);
|
|
76
|
+
}, 2500);
|
|
77
|
+
}
|
|
78
|
+
}, [currentQuestion, chatbot, currentQuestionId]);
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
if (currentQuestion && currentQuestion.action) {
|
|
81
|
+
if (currentQuestion.action.property && currentQuestion.action.action === "set") {
|
|
82
|
+
setData(prev => ({ ...prev, [currentQuestion.action.property]: currentQuestion.action?.value }));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}, [config, currentQuestion]);
|
|
86
|
+
useEffect(() => {
|
|
87
|
+
if (currentQuestion && currentQuestion.action && currentQuestion.action.action === "end") {
|
|
88
|
+
setEnd(true);
|
|
89
|
+
if (config.onEnd) {
|
|
90
|
+
config.onEnd(data);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}, [config, currentQuestion, data]);
|
|
94
|
+
useEffect(() => {
|
|
95
|
+
if (currentQuestionId !== "start") {
|
|
96
|
+
audio.play();
|
|
97
|
+
}
|
|
98
|
+
}, [currentQuestionId, audio]);
|
|
99
|
+
return (React.createElement("div", { className: "h-[700px] flex flex-col overflow-hidden bg-background rounded-2xl absolute w-[416px] -top-[720px] -left-[356px]" },
|
|
100
|
+
React.createElement("header", { className: "bg-primary" },
|
|
101
|
+
React.createElement("nav", { className: "flex items-center h-full p-4 flex-col text-onprimary" },
|
|
102
|
+
React.createElement("div", { className: "flex w-full" }),
|
|
103
|
+
React.createElement("p", { className: "font-bold text-xl" }, config.bot.name))),
|
|
104
|
+
React.createElement("div", { className: "flex flex-col items-start gap-2 overflow-y-auto grow pb-8 px-4 pt-4 scroll-smooth", ref: container },
|
|
105
|
+
React.createElement(History, { history: history, answers: answers }),
|
|
106
|
+
currentQuestion && React.createElement("div", { className: "flex flex-col gap-2 w-full" },
|
|
107
|
+
React.createElement(Question, { text: currentQuestion.question, at: currentQuestion.at })),
|
|
108
|
+
currentQuestion && currentQuestion.answers && React.createElement(Answers, { answers: currentQuestion.answers, onClick: clickAnswer }),
|
|
109
|
+
end && React.createElement("div", { className: "w-full text-center" },
|
|
110
|
+
React.createElement("p", { className: "text-question-text" }, config.endMessage ?? "Votre chat est terminé"),
|
|
111
|
+
React.createElement("a", { className: "text-primary transition hover:underline hover:text-primary-dark cursor-pointer", onClick: () => {
|
|
112
|
+
setCurrentQuestion(chatbot["start"]);
|
|
113
|
+
setCurrentQuestionId("start");
|
|
114
|
+
setHistory({});
|
|
115
|
+
setAnswers({});
|
|
116
|
+
setEnd(false);
|
|
117
|
+
} }, config.endButtonText ?? "Pour commencer un nouveau chat, cliquez ici."))),
|
|
118
|
+
React.createElement("footer", { className: "w-full p-4 bg-transparent" },
|
|
119
|
+
React.createElement(Input, { disabled: currentQuestion?.action?.action !== "ask", onSend: sendAnswer }))));
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=Chatbot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Chatbot.js","sourceRoot":"","sources":["../src/Chatbot.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAExE,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,EAAC,WAAW,EAAC,MAAM,SAAS,CAAC;AACpC,OAAO,UAAU,MAAM,oBAAoB,CAAC;AAE5C,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,QAAQ,CAAC,cAAc,CAAC,cAAc,CAAE,CAAC,OAAO,GAAG,CAAC,CAAC,EAAE,EAAE;IACxD,CAAC,CAAC,eAAe,EAAE,CAAA;AACpB,CAAC,CAAA;AACD,QAAQ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AAC,CAAC;wBACrC,oBAAoB,CAAC,OAAO,CAAC,CAAC;wBAC9B,UAAU,CAAC,EAAE,CAAC,CAAC;wBACf,UAAU,CAAC,EAAE,CAAC,CAAC;wBACf,MAAM,CAAC,KAAK,CAAC,CAAC;oBACf,CAAC,IAAG,MAAM,CAAC,aAAa,IAAI,8CAA8C,CAAK,CAC1E,CACD;QACN,gCAAQ,SAAS,EAAE,2BAA2B;YAC7C,oBAAC,KAAK,IAAC,QAAQ,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,KAAK,KAAK,EAAE,MAAM,EAAE,UAAU,GAAG,CACzE,CACJ,CACN,CAAA;AACF,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { TAnswer, TQuestions } from "./types/TQuestions.ts";
|
|
2
|
+
import React from "react";
|
|
3
|
+
interface HistoryProps {
|
|
4
|
+
history: TQuestions;
|
|
5
|
+
answers: Record<string, TAnswer>;
|
|
6
|
+
}
|
|
7
|
+
export default function History(props: HistoryProps): React.JSX.Element[];
|
|
8
|
+
export {};
|
package/dist/History.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import Question from "./Question";
|
|
2
|
+
import Answer from "./Answer";
|
|
3
|
+
import React from "react";
|
|
4
|
+
export default function History(props) {
|
|
5
|
+
return Object.keys(props.history).map(k => {
|
|
6
|
+
return React.createElement("div", { className: "flex flex-col gap-2 w-full", key: k },
|
|
7
|
+
React.createElement(Question, { key: `${k}_question`, text: props.history[k].question, at: props.history[k].at }),
|
|
8
|
+
props.answers[k] && React.createElement(Answer, { key: `${k}_answer`, text: props.answers[k].text, at: props.answers[k].at }));
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=History.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"History.js","sourceRoot":"","sources":["../src/History.tsx"],"names":[],"mappings":"AACA,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,KAAmB;IAClD,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;QACzC,OAAO,6BAAK,SAAS,EAAE,4BAA4B,EAAE,GAAG,EAAE,CAAC;YAC1D,oBAAC,QAAQ,IAAC,GAAG,EAAE,GAAG,CAAC,WAAW,EAAE,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG;YACzF,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,oBAAC,MAAM,IAAC,GAAG,EAAE,GAAG,CAAC,SAAS,EAAE,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,CACpG,CAAA;IACP,CAAC,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/Input.d.ts
ADDED
package/dist/Input.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Send from "./Send";
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
export default function Input(props) {
|
|
5
|
+
const [value, setValue] = useState("");
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
if (props.disabled) {
|
|
8
|
+
setValue("");
|
|
9
|
+
}
|
|
10
|
+
}, [setValue, props.disabled]);
|
|
11
|
+
return React.createElement("div", { className: "border border-input rounded-full px-4 py-2 flex justify-between text-input" },
|
|
12
|
+
React.createElement("input", { type: "text", className: "focus:outline-none grow", value: value, onChange: e => setValue(e.target.value), disabled: props.disabled, onKeyDown: e => {
|
|
13
|
+
if (e.key === "Enter") {
|
|
14
|
+
props.onSend?.(value);
|
|
15
|
+
setValue("");
|
|
16
|
+
}
|
|
17
|
+
} }),
|
|
18
|
+
React.createElement("button", { className: "cursor-pointer text-input disabled:cursor-not-allowed disabled:text-input-disabled", disabled: value.length === 0 || props.disabled, onClick: () => {
|
|
19
|
+
props.onSend?.(value);
|
|
20
|
+
setValue("");
|
|
21
|
+
} },
|
|
22
|
+
React.createElement(Send, null)));
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=Input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Input.js","sourceRoot":"","sources":["../src/Input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,QAAQ,CAAC;AAC1B,OAAO,EAAC,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAO1C,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,KAAiB;IAC9C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IACvC,SAAS,CAAC,GAAG,EAAE;QACd,IAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;YACnB,QAAQ,CAAC,EAAE,CAAC,CAAC;QACd,CAAC;IACF,CAAC,EAAE,CAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC/B,OAAO,6BAAK,SAAS,EAAE,4EAA4E;QAClG,+BAAO,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,yBAAyB,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE;gBAC1J,IAAG,CAAC,CAAC,GAAG,KAAK,OAAO,EAAE,CAAC;oBACtB,KAAK,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,CAAA;oBACrB,QAAQ,CAAC,EAAE,CAAC,CAAC;gBACd,CAAC;YACF,CAAC,GAAG;QACJ,gCAAQ,SAAS,EAAE,oFAAoF,EAAE,QAAQ,EAAE,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE;gBACtK,KAAK,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,CAAA;gBACrB,QAAQ,CAAC,EAAE,CAAC,CAAC;YACd,CAAC;YACA,oBAAC,IAAI,OAAE,CACC,CACJ,CAAA;AACP,CAAC"}
|
package/dist/Question.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export default function Question(props) {
|
|
3
|
+
if (typeof props.text === "string")
|
|
4
|
+
return (React.createElement("div", { className: "min-h-8 bg-question text-question-text rounded-lg px-4 py-2 self-start whitespace-pre-wrap h-auto" },
|
|
5
|
+
React.createElement("p", null, props.text),
|
|
6
|
+
React.createElement("p", { className: "text-xs" }, props.at)));
|
|
7
|
+
return props.text.map((el, i) => React.createElement(Question, { text: el, key: i }));
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=Question.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Question.js","sourceRoot":"","sources":["../src/Question.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,KAAoB;IACpD,IAAG,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;QAAE,OAAO,CACzC,6BAAK,SAAS,EAAE,mGAAmG;YAClH,+BAAI,KAAK,CAAC,IAAI,CAAK;YACnB,2BAAG,SAAS,EAAE,SAAS,IAAG,KAAK,CAAC,EAAE,CAAK,CAClC,CACN,CAAA;IACD,OAAQ,KAAK,CAAC,IAAiB,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,oBAAC,QAAQ,IAAC,IAAI,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;AAC/E,CAAC"}
|
package/dist/Send.d.ts
ADDED
package/dist/Send.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export default function Send() {
|
|
3
|
+
return React.createElement("svg", { width: "1em", height: "1em", viewBox: "0 0 16 16", xmlns: "http://www.w3.org/2000/svg", className: "SendButton__SendIcon-biCvBD iJveov", style: { fill: "currentColor" } },
|
|
4
|
+
React.createElement("path", { d: "M12.377 1.772c.68-.183 1.389.005 1.892.508.503.503.69 1.206.508 1.892l-2.468 9.211c-.183.686-.697 1.2-1.383 1.383-.171.046-.343.068-.514.068h-.006c-.509 0-1-.2-1.372-.571l-2.56-2.56c-.668-.668-.668-1.754 0-2.423l3.229-3.228c.223-.223.583-.223.806 0 .222.223.222.582 0 .805L7.28 10.086c-.108.108-.165.251-.165.406 0 .154.057.297.165.405l2.56 2.56c.206.206.503.286.783.212.286-.074.497-.292.577-.578L13.67 3.88c.074-.286 0-.577-.212-.782-.211-.206-.503-.286-.783-.212L3.463 5.354c-.286.075-.497.292-.577.572-.074.285 0 .577.211.783l1.835 1.834c.223.223.222.583 0 .806-.223.223-.583.223-.806 0L2.292 7.514c-.503-.502-.692-1.205-.509-1.89.183-.68.697-1.2 1.383-1.383l9.211-2.47z" }));
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=Send.js.map
|
package/dist/Send.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Send.js","sourceRoot":"","sources":["../src/Send.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,CAAC,OAAO,UAAU,IAAI;IAC3B,OAAO,6BAAK,KAAK,EAAC,KAAK,EAAC,MAAM,EAAC,KAAK,EAAC,OAAO,EAAC,WAAW,EAAC,KAAK,EAAC,4BAA4B,EAAC,SAAS,EAAC,oCAAoC,EAAC,KAAK,EAAE,EAAC,IAAI,EAAE,cAAc,EAAC;QACvK,8BACC,CAAC,EAAC,oqBAAoqB,GAAQ,CAC1qB,CAAA;AACP,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { useCallback, useEffect, useState } from "react";
|
|
2
|
+
export default function useChatbot(initConfig) {
|
|
3
|
+
const [config, setConfig] = useState(initConfig ?? { bot: { name: "Chatbot", questions: {} } });
|
|
4
|
+
const init = useCallback((ev) => {
|
|
5
|
+
setConfig(ev.detail);
|
|
6
|
+
const theme = ev.detail.bot.theme;
|
|
7
|
+
if (theme) {
|
|
8
|
+
document.getElementById("chatbot-button").style.cssText = cssStringFromTheme(theme);
|
|
9
|
+
}
|
|
10
|
+
}, []);
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
document.addEventListener("chatbot-init", init);
|
|
13
|
+
document.dispatchEvent(new CustomEvent("chatbot-loaded"));
|
|
14
|
+
return () => {
|
|
15
|
+
document.removeEventListener("chatbot-init", init);
|
|
16
|
+
};
|
|
17
|
+
}, [init]);
|
|
18
|
+
return config;
|
|
19
|
+
}
|
|
20
|
+
function cssStringFromTheme(theme) {
|
|
21
|
+
let css = "";
|
|
22
|
+
if (theme.primary)
|
|
23
|
+
css += `--color-primary: ${theme.primary};\n`;
|
|
24
|
+
if (theme["primary-dark"])
|
|
25
|
+
css += `--color-primary-dark: ${theme["primary-dark"]};\n`;
|
|
26
|
+
if (theme.onprimary)
|
|
27
|
+
css += `--color-onprimary: ${theme.onprimary};\n`;
|
|
28
|
+
if (theme.question)
|
|
29
|
+
css += `--color-question: ${theme.question};\n`;
|
|
30
|
+
if (theme["question-text"])
|
|
31
|
+
css += `--color-question-text: ${theme["question-text"]};\n`;
|
|
32
|
+
if (theme.background)
|
|
33
|
+
css += `--color-background: ${theme.background};\n`;
|
|
34
|
+
if (theme.option)
|
|
35
|
+
css += `--color-option: ${theme.option};\n`;
|
|
36
|
+
if (theme["option-hover"])
|
|
37
|
+
css += `--color-option-hover: ${theme["option-hover"]};\n`;
|
|
38
|
+
if (theme.input)
|
|
39
|
+
css += `--color-input: ${theme.input};\n`;
|
|
40
|
+
if (theme["input-disabled"])
|
|
41
|
+
css += `--color-input-disabled: ${theme["input-disabled"]};\n`;
|
|
42
|
+
return css;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=useChatbot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useChatbot.js","sourceRoot":"","sources":["../../src/hooks/useChatbot.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAIvD,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,UAAoB;IACtD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAU,UAAU,IAAI,EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,EAAC,EAAC,CAAC,CAAC;IACvG,MAAM,IAAI,GAAG,WAAW,CAAC,CAAC,EAAS,EAAE,EAAE;QACtC,SAAS,CAAE,EAA2B,CAAC,MAAM,CAAC,CAAC;QAC/C,MAAM,KAAK,GAAI,EAA2B,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAA;QAC3D,IAAG,KAAK,EAAE,CAAC;YACV,QAAQ,CAAC,cAAc,CAAC,gBAAgB,CAAE,CAAC,KAAK,CAAC,OAAO,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAA;QACrF,CAAC;IACF,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,SAAS,CAAC,GAAG,EAAE;QACd,QAAQ,CAAC,gBAAgB,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;QAChD,QAAQ,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,gBAAgB,CAAC,CAAC,CAAC;QAC1D,OA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@@ -0,0 +1 @@
|
|
|
1
|
+
import './index.css';
|
package/dist/main.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { StrictMode } from 'react';
|
|
2
|
+
import { createRoot } from 'react-dom/client';
|
|
3
|
+
import './index.css';
|
|
4
|
+
import Chatbot from "./Chatbot";
|
|
5
|
+
import React from "react";
|
|
6
|
+
createRoot(document.getElementById('chatbot_root')).render(React.createElement(StrictMode, null,
|
|
7
|
+
React.createElement(Chatbot, null)));
|
|
8
|
+
//# sourceMappingURL=main.js.map
|
package/dist/main.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,OAAO,CAAA;AAChC,OAAO,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAA;AAC3C,OAAO,aAAa,CAAA;AACpB,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,UAAU,CAAC,QAAQ,CAAC,cAAc,CAAC,cAAc,CAAE,CAAC,CAAC,MAAM,CAC1D,oBAAC,UAAU;IACV,oBAAC,OAAO,OAAE,CACE,CACb,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { TQuestions } from "./TQuestions.ts";
|
|
2
|
+
export interface TBot {
|
|
3
|
+
name: string;
|
|
4
|
+
questions: TQuestions;
|
|
5
|
+
theme?: Theme;
|
|
6
|
+
}
|
|
7
|
+
export interface Theme {
|
|
8
|
+
primary?: string;
|
|
9
|
+
"primary-dark"?: string;
|
|
10
|
+
onprimary?: string;
|
|
11
|
+
question?: string;
|
|
12
|
+
"question-text"?: string;
|
|
13
|
+
background?: string;
|
|
14
|
+
option?: string;
|
|
15
|
+
"option-hover"?: string;
|
|
16
|
+
input?: string;
|
|
17
|
+
"input-disabled"?: string;
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TBot.js","sourceRoot":"","sources":["../../src/types/TBot.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TConfig.js","sourceRoot":"","sources":["../../src/types/TConfig.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type TQuestions = Record<string, TQuestion>;
|
|
2
|
+
export interface TQuestion {
|
|
3
|
+
question: string | string[];
|
|
4
|
+
action?: TAction;
|
|
5
|
+
answers?: TAnswer[];
|
|
6
|
+
goto?: string;
|
|
7
|
+
at?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface TAnswer {
|
|
10
|
+
text: string;
|
|
11
|
+
next?: string;
|
|
12
|
+
action?: TAction;
|
|
13
|
+
at?: string;
|
|
14
|
+
}
|
|
15
|
+
interface TAction {
|
|
16
|
+
action: "set" | "ask" | "end";
|
|
17
|
+
property?: string;
|
|
18
|
+
value?: any;
|
|
19
|
+
goto?: string;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TQuestions.js","sourceRoot":"","sources":["../../src/types/TQuestions.ts"],"names":[],"mappings":""}
|
package/dist/utils.d.ts
ADDED
package/dist/utils.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export function currentTime() {
|
|
2
|
+
const now = new Date();
|
|
3
|
+
return now.toLocaleTimeString("fr-FR", { hour: "2-digit", minute: "2-digit" });
|
|
4
|
+
}
|
|
5
|
+
export function initChatbot(config) {
|
|
6
|
+
const ev = new CustomEvent("chatbot-init", { detail: config });
|
|
7
|
+
document.dispatchEvent(ev);
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,WAAW;IAC1B,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;IACvB,OAAO,GAAG,CAAC,kBAAkB,CAAC,OAAO,EAAE,EAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAC,CAAC,CAAC;AAC9E,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,MAAe;IAC1C,MAAM,EAAE,GAAG,IAAI,WAAW,CAAC,cAAc,EAAE,EAAC,MAAM,EAAE,MAAM,EAAC,CAAC,CAAC;IAC7D,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;AAC5B,CAAC"}
|
package/index.css
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com */
|
|
2
|
+
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-font-weight:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-gray-800:oklch(27.8% .033 256.848);--color-stone-400:oklch(70.9% .01 56.259);--spacing:.25rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-xl:1.25rem;--text-xl--line-height:calc(1.75/1.25);--font-weight-bold:700;--radius-lg:.5rem;--radius-2xl:1rem;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-primary:#b24592;--color-primary-dark:#9a0c71;--color-onprimary:#fff;--color-question:#f5f3f2;--color-question-text:black;--color-background:#fff;--color-option:#33475b;--color-option-hover:var(--color-primary);--color-input:var(--color-gray-800);--color-input-disabled:var(--color-stone-400)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.absolute{position:absolute!important}.-top-\[720px\]{top:-720px!important}.-left-\[356px\]{left:-356px!important}.container{width:100%!important}@media (min-width:40rem){.container{max-width:40rem!important}}@media (min-width:48rem){.container{max-width:48rem!important}}@media (min-width:64rem){.container{max-width:64rem!important}}@media (min-width:80rem){.container{max-width:80rem!important}}@media (min-width:96rem){.container{max-width:96rem!important}}.flex{display:flex!important}.h-\[700px\]{height:700px!important}.h-auto{height:auto!important}.h-full{height:100%!important}.min-h-8{min-height:calc(var(--spacing)*8)!important}.w-\[416px\]{width:416px!important}.w-full{width:100%!important}.max-w-\[284px\]{max-width:284px!important}.grow{flex-grow:1!important}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)!important}.cursor-pointer{cursor:pointer!important}.flex-col{flex-direction:column!important}.flex-row{flex-direction:row!important}.flex-wrap{flex-wrap:wrap!important}.items-center{align-items:center!important}.items-end{align-items:flex-end!important}.items-start{align-items:flex-start!important}.justify-between{justify-content:space-between!important}.gap-2{gap:calc(var(--spacing)*2)!important}.self-end{align-self:flex-end!important}.self-start{align-self:flex-start!important}.overflow-hidden{overflow:hidden!important}.overflow-y-auto{overflow-y:auto!important}.scroll-smooth{scroll-behavior:smooth!important}.rounded-2xl{border-radius:var(--radius-2xl)!important}.rounded-full{border-radius:3.40282e38px!important}.rounded-lg{border-radius:var(--radius-lg)!important}.border{border-style:var(--tw-border-style)!important;border-width:1px!important}.border-input{border-color:var(--color-input)!important}.border-option{border-color:var(--color-option)!important}.bg-background{background-color:var(--color-background)!important}.bg-primary{background-color:var(--color-primary)!important}.bg-question{background-color:var(--color-question)!important}.bg-transparent{background-color:#0000!important}.p-4{padding:calc(var(--spacing)*4)!important}.px-4{padding-inline:calc(var(--spacing)*4)!important}.py-2{padding-block:calc(var(--spacing)*2)!important}.pt-4{padding-top:calc(var(--spacing)*4)!important}.pb-8{padding-bottom:calc(var(--spacing)*8)!important}.text-center{text-align:center!important}.text-end{text-align:end!important}.text-xl{font-size:var(--text-xl)!important;line-height:var(--tw-leading,var(--text-xl--line-height))!important}.text-xs{font-size:var(--text-xs)!important;line-height:var(--tw-leading,var(--text-xs--line-height))!important}.font-bold{--tw-font-weight:var(--font-weight-bold)!important;font-weight:var(--font-weight-bold)!important}.whitespace-pre-wrap{white-space:pre-wrap!important}.text-input{color:var(--color-input)!important}.text-onprimary{color:var(--color-onprimary)!important}.text-option{color:var(--color-option)!important}.text-primary{color:var(--color-primary)!important}.text-question-text{color:var(--color-question-text)!important}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events!important;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function))!important;transition-duration:var(--tw-duration,var(--default-transition-duration))!important}@media (hover:hover){.hover\:border-option-hover:hover{border-color:var(--color-option-hover)!important}.hover\:text-option-hover:hover{color:var(--color-option-hover)!important}.hover\:text-primary-dark:hover{color:var(--color-primary-dark)!important}.hover\:underline:hover{text-decoration-line:underline!important}}.focus\:outline-none:focus{--tw-outline-style:none!important;outline-style:none!important}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed!important}.disabled\:text-input-disabled:disabled{color:var(--color-input-disabled)!important}}.chatbot{background-color:var(--color-primary);cursor:pointer;color:var(--color-onprimary);border-radius:100%;justify-content:center;align-items:center;display:flex;position:fixed;bottom:15px;right:15px;width:60px!important;height:60px!important}.chatbot-container{opacity:1;cursor:default;transition:all .3s ease-in-out;bottom:0!important}.button-icon{opacity:1;rotate:0;cursor:pointer;transition:all .3s ease-in-out;position:absolute}.not-visible{opacity:0}.button-icon.not-visible{rotate:45deg}.chatbot-container.not-visible{bottom:-100px}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "imacaron-chatbot",
|
|
3
|
+
"description": "A chatbot open-source library for scenarized chatbot",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"files": [
|
|
7
|
+
"/dist",
|
|
8
|
+
"/index.css"
|
|
9
|
+
],
|
|
10
|
+
"types": "dist/index.d.ts",
|
|
11
|
+
"scripts": {
|
|
12
|
+
"dev": "vite",
|
|
13
|
+
"build": "rm -rf dist && tsc && tailwindcss -i src/index.css -o index.css --minify",
|
|
14
|
+
"prepublish": "npm run build"
|
|
15
|
+
},
|
|
16
|
+
"author": "Macaron",
|
|
17
|
+
"license": "ISC",
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@tailwindcss/cli": "^4.1.16",
|
|
20
|
+
"@tailwindcss/vite": "^4.1.16",
|
|
21
|
+
"react": "^19.1.1",
|
|
22
|
+
"react-dom": "^19.1.1",
|
|
23
|
+
"tailwindcss": "^4.1.16"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@eslint/js": "^9.36.0",
|
|
27
|
+
"@types/node": "^24.6.0",
|
|
28
|
+
"@types/react": "^19.1.16",
|
|
29
|
+
"@types/react-dom": "^19.1.9",
|
|
30
|
+
"@vitejs/plugin-react": "^5.0.4",
|
|
31
|
+
"eslint": "^9.36.0",
|
|
32
|
+
"eslint-plugin-react-hooks": "^5.2.0",
|
|
33
|
+
"eslint-plugin-react-refresh": "^0.4.22",
|
|
34
|
+
"globals": "^16.4.0",
|
|
35
|
+
"typescript": "~5.9.3",
|
|
36
|
+
"typescript-eslint": "^8.45.0",
|
|
37
|
+
"vite": "^7.1.7"
|
|
38
|
+
},
|
|
39
|
+
"keywords": [
|
|
40
|
+
"chatbot",
|
|
41
|
+
"chat",
|
|
42
|
+
"bot",
|
|
43
|
+
"library",
|
|
44
|
+
"react",
|
|
45
|
+
"js",
|
|
46
|
+
"typescript",
|
|
47
|
+
"open-source",
|
|
48
|
+
"open",
|
|
49
|
+
"source"
|
|
50
|
+
],
|
|
51
|
+
"version": "0.3.0"
|
|
52
|
+
}
|