@makebot.it/js 1.0.2 → 1.1.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/README.md +170 -0
- package/dist/index.d.ts +143 -18
- package/dist/index.js +0 -1
- package/dist/web.js +1239 -46
- package/package.json +4 -3
- package/dist/components/Bot.d.ts +0 -31
- package/dist/components/Bot.d.ts.map +0 -1
- package/dist/components/Button.d.ts +0 -13
- package/dist/components/Button.d.ts.map +0 -1
- package/dist/components/ConversationContainer/AvatarSideContainer.d.ts +0 -9
- package/dist/components/ConversationContainer/AvatarSideContainer.d.ts.map +0 -1
- package/dist/components/ConversationContainer/ChatChunk.d.ts +0 -23
- package/dist/components/ConversationContainer/ChatChunk.d.ts.map +0 -1
- package/dist/components/ConversationContainer/ChatContainer.d.ts +0 -20
- package/dist/components/ConversationContainer/ChatContainer.d.ts.map +0 -1
- package/dist/components/ConversationContainer/LoadingChunk.d.ts +0 -7
- package/dist/components/ConversationContainer/LoadingChunk.d.ts.map +0 -1
- package/dist/components/ErrorMessage.d.ts +0 -6
- package/dist/components/ErrorMessage.d.ts.map +0 -1
- package/dist/components/FixedInputFooter.d.ts +0 -11
- package/dist/components/FixedInputFooter.d.ts.map +0 -1
- package/dist/components/InputChatBlock.d.ts +0 -16
- package/dist/components/InputChatBlock.d.ts.map +0 -1
- package/dist/components/LiteBadge.d.ts +0 -6
- package/dist/components/LiteBadge.d.ts.map +0 -1
- package/dist/components/Modal.d.ts +0 -9
- package/dist/components/Modal.d.ts.map +0 -1
- package/dist/components/ProgressBar.d.ts +0 -6
- package/dist/components/ProgressBar.d.ts.map +0 -1
- package/dist/components/SendButton.d.ts +0 -9
- package/dist/components/SendButton.d.ts.map +0 -1
- package/dist/components/Spinner.d.ts +0 -3
- package/dist/components/Spinner.d.ts.map +0 -1
- package/dist/components/TextInputAddFileButton.d.ts +0 -7
- package/dist/components/TextInputAddFileButton.d.ts.map +0 -1
- package/dist/components/TypingBubble.d.ts +0 -2
- package/dist/components/TypingBubble.d.ts.map +0 -1
- package/dist/components/avatars/Avatar.d.ts +0 -5
- package/dist/components/avatars/Avatar.d.ts.map +0 -1
- package/dist/components/avatars/DefaultAvatar.d.ts +0 -4
- package/dist/components/avatars/DefaultAvatar.d.ts.map +0 -1
- package/dist/components/bubbles/GuestBubble.d.ts +0 -9
- package/dist/components/bubbles/GuestBubble.d.ts.map +0 -1
- package/dist/components/bubbles/HostBubble.d.ts +0 -13
- package/dist/components/bubbles/HostBubble.d.ts.map +0 -1
- package/dist/components/bubbles/LoadingBubble.d.ts +0 -2
- package/dist/components/bubbles/LoadingBubble.d.ts.map +0 -1
- package/dist/components/bubbles/StreamingBubble.d.ts +0 -7
- package/dist/components/bubbles/StreamingBubble.d.ts.map +0 -1
- package/dist/components/carousel.d.ts +0 -10
- package/dist/components/carousel.d.ts.map +0 -1
- package/dist/components/icons/ArrowLeftIcon.d.ts +0 -3
- package/dist/components/icons/ArrowLeftIcon.d.ts.map +0 -1
- package/dist/components/icons/ArrowRightIcon.d.ts +0 -3
- package/dist/components/icons/ArrowRightIcon.d.ts.map +0 -1
- package/dist/components/icons/CameraIcon.d.ts +0 -3
- package/dist/components/icons/CameraIcon.d.ts.map +0 -1
- package/dist/components/icons/CheckIcon.d.ts +0 -3
- package/dist/components/icons/CheckIcon.d.ts.map +0 -1
- package/dist/components/icons/ChevronDownIcon.d.ts +0 -3
- package/dist/components/icons/ChevronDownIcon.d.ts.map +0 -1
- package/dist/components/icons/ChevronUpIcon.d.ts +0 -3
- package/dist/components/icons/ChevronUpIcon.d.ts.map +0 -1
- package/dist/components/icons/CloseIcon.d.ts +0 -3
- package/dist/components/icons/CloseIcon.d.ts.map +0 -1
- package/dist/components/icons/FileIcon.d.ts +0 -3
- package/dist/components/icons/FileIcon.d.ts.map +0 -1
- package/dist/components/icons/MakebotLogo.d.ts +0 -2
- package/dist/components/icons/MakebotLogo.d.ts.map +0 -1
- package/dist/components/icons/MicrophoneIcon.d.ts +0 -3
- package/dist/components/icons/MicrophoneIcon.d.ts.map +0 -1
- package/dist/components/icons/PaperClipIcon.d.ts +0 -3
- package/dist/components/icons/PaperClipIcon.d.ts.map +0 -1
- package/dist/components/icons/PictureIcon.d.ts +0 -3
- package/dist/components/icons/PictureIcon.d.ts.map +0 -1
- package/dist/components/icons/PlusIcon.d.ts +0 -3
- package/dist/components/icons/PlusIcon.d.ts.map +0 -1
- package/dist/components/icons/SendIcon.d.ts +0 -3
- package/dist/components/icons/SendIcon.d.ts.map +0 -1
- package/dist/components/inputs/SearchInput.d.ts +0 -9
- package/dist/components/inputs/SearchInput.d.ts.map +0 -1
- package/dist/components/inputs/ShortTextInput.d.ts +0 -9
- package/dist/components/inputs/ShortTextInput.d.ts.map +0 -1
- package/dist/components/inputs/Textarea.d.ts +0 -9
- package/dist/components/inputs/Textarea.d.ts.map +0 -1
- package/dist/constants.d.ts +0 -86
- package/dist/constants.d.ts.map +0 -1
- package/dist/contexts/BotContainerContext.d.ts +0 -4
- package/dist/contexts/BotContainerContext.d.ts.map +0 -1
- package/dist/contexts/ChatContainerSizeContext.d.ts +0 -9
- package/dist/contexts/ChatContainerSizeContext.d.ts.map +0 -1
- package/dist/features/blocks/bubbles/audio/components/AudioBubble.d.ts +0 -8
- package/dist/features/blocks/bubbles/audio/components/AudioBubble.d.ts.map +0 -1
- package/dist/features/blocks/bubbles/contact/components/ContactBubble.d.ts +0 -11
- package/dist/features/blocks/bubbles/contact/components/ContactBubble.d.ts.map +0 -1
- package/dist/features/blocks/bubbles/embed/components/CustomEmbedBubble.d.ts +0 -11
- package/dist/features/blocks/bubbles/embed/components/CustomEmbedBubble.d.ts.map +0 -1
- package/dist/features/blocks/bubbles/embed/components/EmbedBubble.d.ts +0 -11
- package/dist/features/blocks/bubbles/embed/components/EmbedBubble.d.ts.map +0 -1
- package/dist/features/blocks/bubbles/image/components/ImageBubble.d.ts +0 -10
- package/dist/features/blocks/bubbles/image/components/ImageBubble.d.ts.map +0 -1
- package/dist/features/blocks/bubbles/location/components/LocationBubble.d.ts +0 -11
- package/dist/features/blocks/bubbles/location/components/LocationBubble.d.ts.map +0 -1
- package/dist/features/blocks/bubbles/pix/components/PixBubble.d.ts +0 -11
- package/dist/features/blocks/bubbles/pix/components/PixBubble.d.ts.map +0 -1
- package/dist/features/blocks/bubbles/textBubble/components/TextBubble.d.ts +0 -12
- package/dist/features/blocks/bubbles/textBubble/components/TextBubble.d.ts.map +0 -1
- package/dist/features/blocks/bubbles/textBubble/components/plate/PlateBlock.d.ts +0 -9
- package/dist/features/blocks/bubbles/textBubble/components/plate/PlateBlock.d.ts.map +0 -1
- package/dist/features/blocks/bubbles/textBubble/components/plate/PlateText.d.ts +0 -9
- package/dist/features/blocks/bubbles/textBubble/components/plate/PlateText.d.ts.map +0 -1
- package/dist/features/blocks/bubbles/textBubble/helpers/convertRichTextToPlainText.d.ts +0 -3
- package/dist/features/blocks/bubbles/textBubble/helpers/convertRichTextToPlainText.d.ts.map +0 -1
- package/dist/features/blocks/bubbles/video/components/VideoBubble.d.ts +0 -9
- package/dist/features/blocks/bubbles/video/components/VideoBubble.d.ts.map +0 -1
- package/dist/features/blocks/inputs/buttons/components/Buttons.d.ts +0 -11
- package/dist/features/blocks/inputs/buttons/components/Buttons.d.ts.map +0 -1
- package/dist/features/blocks/inputs/buttons/components/Checkbox.d.ts +0 -7
- package/dist/features/blocks/inputs/buttons/components/Checkbox.d.ts.map +0 -1
- package/dist/features/blocks/inputs/buttons/components/MultipleChoicesForm.d.ts +0 -10
- package/dist/features/blocks/inputs/buttons/components/MultipleChoicesForm.d.ts.map +0 -1
- package/dist/features/blocks/inputs/cards/CardsCaroussel.d.ts +0 -20
- package/dist/features/blocks/inputs/cards/CardsCaroussel.d.ts.map +0 -1
- package/dist/features/blocks/inputs/date/components/DateForm.d.ts +0 -10
- package/dist/features/blocks/inputs/date/components/DateForm.d.ts.map +0 -1
- package/dist/features/blocks/inputs/email/components/EmailInput.d.ts +0 -10
- package/dist/features/blocks/inputs/email/components/EmailInput.d.ts.map +0 -1
- package/dist/features/blocks/inputs/fileUpload/components/FilePreview.d.ts +0 -8
- package/dist/features/blocks/inputs/fileUpload/components/FilePreview.d.ts.map +0 -1
- package/dist/features/blocks/inputs/fileUpload/components/FileUploadForm.d.ts +0 -11
- package/dist/features/blocks/inputs/fileUpload/components/FileUploadForm.d.ts.map +0 -1
- package/dist/features/blocks/inputs/fileUpload/components/SelectedFile.d.ts +0 -6
- package/dist/features/blocks/inputs/fileUpload/components/SelectedFile.d.ts.map +0 -1
- package/dist/features/blocks/inputs/fileUpload/helpers/sanitizeSelectedFiles.d.ts +0 -15
- package/dist/features/blocks/inputs/fileUpload/helpers/sanitizeSelectedFiles.d.ts.map +0 -1
- package/dist/features/blocks/inputs/fileUpload/helpers/uploadFiles.d.ts +0 -28
- package/dist/features/blocks/inputs/fileUpload/helpers/uploadFiles.d.ts.map +0 -1
- package/dist/features/blocks/inputs/list/components/List.d.ts +0 -9
- package/dist/features/blocks/inputs/list/components/List.d.ts.map +0 -1
- package/dist/features/blocks/inputs/number/components/NumberInput.d.ts +0 -10
- package/dist/features/blocks/inputs/number/components/NumberInput.d.ts.map +0 -1
- package/dist/features/blocks/inputs/number/numberInputHelper.d.ts +0 -2
- package/dist/features/blocks/inputs/number/numberInputHelper.d.ts.map +0 -1
- package/dist/features/blocks/inputs/payment/components/PaymentForm.d.ts +0 -12
- package/dist/features/blocks/inputs/payment/components/PaymentForm.d.ts.map +0 -1
- package/dist/features/blocks/inputs/payment/components/StripePaymentForm.d.ts +0 -12
- package/dist/features/blocks/inputs/payment/components/StripePaymentForm.d.ts.map +0 -1
- package/dist/features/blocks/inputs/payment/helpers/paymentInProgressStorage.d.ts +0 -5
- package/dist/features/blocks/inputs/payment/helpers/paymentInProgressStorage.d.ts.map +0 -1
- package/dist/features/blocks/inputs/phone/components/PhoneInput.d.ts +0 -9
- package/dist/features/blocks/inputs/phone/components/PhoneInput.d.ts.map +0 -1
- package/dist/features/blocks/inputs/rating/components/RatingForm.d.ts +0 -10
- package/dist/features/blocks/inputs/rating/components/RatingForm.d.ts.map +0 -1
- package/dist/features/blocks/inputs/textInput/components/TextInput.d.ts +0 -11
- package/dist/features/blocks/inputs/textInput/components/TextInput.d.ts.map +0 -1
- package/dist/features/blocks/inputs/textInput/components/VoiceRecorder.d.ts +0 -12
- package/dist/features/blocks/inputs/textInput/components/VoiceRecorder.d.ts.map +0 -1
- package/dist/features/blocks/inputs/textInput/components/VolumeProcessor.d.ts +0 -2
- package/dist/features/blocks/inputs/textInput/components/VolumeProcessor.d.ts.map +0 -1
- package/dist/features/blocks/inputs/time/components/TimeForm.d.ts +0 -10
- package/dist/features/blocks/inputs/time/components/TimeForm.d.ts.map +0 -1
- package/dist/features/blocks/inputs/url/components/UrlInput.d.ts +0 -10
- package/dist/features/blocks/inputs/url/components/UrlInput.d.ts.map +0 -1
- package/dist/features/blocks/integrations/chatwoot/constants.d.ts +0 -2
- package/dist/features/blocks/integrations/chatwoot/constants.d.ts.map +0 -1
- package/dist/features/blocks/integrations/chatwoot/utils/executeChatwoot.d.ts +0 -7
- package/dist/features/blocks/integrations/chatwoot/utils/executeChatwoot.d.ts.map +0 -1
- package/dist/features/blocks/integrations/chatwoot/utils/index.d.ts +0 -2
- package/dist/features/blocks/integrations/chatwoot/utils/index.d.ts.map +0 -1
- package/dist/features/blocks/integrations/googleAnalytics/utils/executeGoogleAnalytics.d.ts +0 -3
- package/dist/features/blocks/integrations/googleAnalytics/utils/executeGoogleAnalytics.d.ts.map +0 -1
- package/dist/features/blocks/integrations/httpRequest/executeHttpRequest.d.ts +0 -3
- package/dist/features/blocks/integrations/httpRequest/executeHttpRequest.d.ts.map +0 -1
- package/dist/features/blocks/integrations/openai/streamChat.d.ts +0 -19
- package/dist/features/blocks/integrations/openai/streamChat.d.ts.map +0 -1
- package/dist/features/blocks/integrations/pixel/executePixel.d.ts +0 -3
- package/dist/features/blocks/integrations/pixel/executePixel.d.ts.map +0 -1
- package/dist/features/blocks/logic/redirect/utils/executeRedirect.d.ts +0 -5
- package/dist/features/blocks/logic/redirect/utils/executeRedirect.d.ts.map +0 -1
- package/dist/features/blocks/logic/script/executeScript.d.ts +0 -19
- package/dist/features/blocks/logic/script/executeScript.d.ts.map +0 -1
- package/dist/features/blocks/logic/setVariable/executeSetVariable.d.ts +0 -7
- package/dist/features/blocks/logic/setVariable/executeSetVariable.d.ts.map +0 -1
- package/dist/features/blocks/logic/wait/utils/executeWait.d.ts +0 -6
- package/dist/features/blocks/logic/wait/utils/executeWait.d.ts.map +0 -1
- package/dist/features/blocks/logic/webhook/listenForWebhook.d.ts +0 -13
- package/dist/features/blocks/logic/webhook/listenForWebhook.d.ts.map +0 -1
- package/dist/features/bubble/components/Bubble.d.ts +0 -15
- package/dist/features/bubble/components/Bubble.d.ts.map +0 -1
- package/dist/features/bubble/components/BubbleButton.d.ts +0 -8
- package/dist/features/bubble/components/BubbleButton.d.ts.map +0 -1
- package/dist/features/bubble/components/PreviewMessage.d.ts +0 -8
- package/dist/features/bubble/components/PreviewMessage.d.ts.map +0 -1
- package/dist/features/bubble/types.d.ts +0 -37
- package/dist/features/bubble/types.d.ts.map +0 -1
- package/dist/features/commands/index.d.ts +0 -12
- package/dist/features/commands/index.d.ts.map +0 -1
- package/dist/features/commands/types.d.ts +0 -26
- package/dist/features/commands/types.d.ts.map +0 -1
- package/dist/features/commands/utils/close.d.ts +0 -3
- package/dist/features/commands/utils/close.d.ts.map +0 -1
- package/dist/features/commands/utils/hidePreviewMessage.d.ts +0 -3
- package/dist/features/commands/utils/hidePreviewMessage.d.ts.map +0 -1
- package/dist/features/commands/utils/open.d.ts +0 -3
- package/dist/features/commands/utils/open.d.ts.map +0 -1
- package/dist/features/commands/utils/reload.d.ts +0 -3
- package/dist/features/commands/utils/reload.d.ts.map +0 -1
- package/dist/features/commands/utils/sendCommand.d.ts +0 -3
- package/dist/features/commands/utils/sendCommand.d.ts.map +0 -1
- package/dist/features/commands/utils/setInputValue.d.ts +0 -3
- package/dist/features/commands/utils/setInputValue.d.ts.map +0 -1
- package/dist/features/commands/utils/setPrefilledVariables.d.ts +0 -3
- package/dist/features/commands/utils/setPrefilledVariables.d.ts.map +0 -1
- package/dist/features/commands/utils/showPreviewMessage.d.ts +0 -3
- package/dist/features/commands/utils/showPreviewMessage.d.ts.map +0 -1
- package/dist/features/commands/utils/toggle.d.ts +0 -3
- package/dist/features/commands/utils/toggle.d.ts.map +0 -1
- package/dist/features/commands/utils/unmount.d.ts +0 -3
- package/dist/features/commands/utils/unmount.d.ts.map +0 -1
- package/dist/features/popup/components/Popup.d.ts +0 -11
- package/dist/features/popup/components/Popup.d.ts.map +0 -1
- package/dist/features/popup/types.d.ts +0 -9
- package/dist/features/popup/types.d.ts.map +0 -1
- package/dist/features/standard/components/Standard.d.ts +0 -5
- package/dist/features/standard/components/Standard.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/lib/gtag.d.ts +0 -4
- package/dist/lib/gtag.d.ts.map +0 -1
- package/dist/lib/gtm.d.ts +0 -3
- package/dist/lib/gtm.d.ts.map +0 -1
- package/dist/lib/pixel.d.ts +0 -4
- package/dist/lib/pixel.d.ts.map +0 -1
- package/dist/queries/continueChatQuery.d.ts +0 -722
- package/dist/queries/continueChatQuery.d.ts.map +0 -1
- package/dist/queries/saveClientLogsQuery.d.ts +0 -7
- package/dist/queries/saveClientLogsQuery.d.ts.map +0 -1
- package/dist/queries/startChatQuery.d.ts +0 -20
- package/dist/queries/startChatQuery.d.ts.map +0 -1
- package/dist/register.d.ts +0 -2
- package/dist/register.d.ts.map +0 -1
- package/dist/types.d.ts +0 -49
- package/dist/types.d.ts.map +0 -1
- package/dist/utils/CorsError.d.ts +0 -4
- package/dist/utils/CorsError.d.ts.map +0 -1
- package/dist/utils/dynamicTheme.d.ts +0 -4
- package/dist/utils/dynamicTheme.d.ts.map +0 -1
- package/dist/utils/error.d.ts +0 -2
- package/dist/utils/error.d.ts.map +0 -1
- package/dist/utils/executeClientSideActions.d.ts +0 -25
- package/dist/utils/executeClientSideActions.d.ts.map +0 -1
- package/dist/utils/getAnswerContent.d.ts +0 -3
- package/dist/utils/getAnswerContent.d.ts.map +0 -1
- package/dist/utils/getPartyKitHost.d.ts +0 -2
- package/dist/utils/getPartyKitHost.d.ts.map +0 -1
- package/dist/utils/guessApiHost.d.ts +0 -6
- package/dist/utils/guessApiHost.d.ts.map +0 -1
- package/dist/utils/injectFont.d.ts +0 -3
- package/dist/utils/injectFont.d.ts.map +0 -1
- package/dist/utils/injectStartProps.d.ts +0 -3
- package/dist/utils/injectStartProps.d.ts.map +0 -1
- package/dist/utils/migrateLegacyChatChunks.d.ts +0 -10
- package/dist/utils/migrateLegacyChatChunks.d.ts.map +0 -1
- package/dist/utils/persist.d.ts +0 -9
- package/dist/utils/persist.d.ts.map +0 -1
- package/dist/utils/resolveBubbleButtonSize.d.ts +0 -5
- package/dist/utils/resolveBubbleButtonSize.d.ts.map +0 -1
- package/dist/utils/scrollContainer.d.ts +0 -2
- package/dist/utils/scrollContainer.d.ts.map +0 -1
- package/dist/utils/setCssVariablesValue.d.ts +0 -16
- package/dist/utils/setCssVariablesValue.d.ts.map +0 -1
- package/dist/utils/storage.d.ts +0 -875
- package/dist/utils/storage.d.ts.map +0 -1
- package/dist/utils/toaster.d.ts +0 -2
- package/dist/utils/toaster.d.ts.map +0 -1
- package/dist/web.d.ts +0 -19
- package/dist/web.d.ts.map +0 -1
- package/dist/window.d.ts +0 -29
- package/dist/window.d.ts.map +0 -1
package/README.md
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# Biblioteca Makebot JS
|
|
2
|
+
|
|
3
|
+
Biblioteca frontend para incorporar makebots do [Makebot](https://www.makebot.it/).
|
|
4
|
+
|
|
5
|
+
## Instalação
|
|
6
|
+
|
|
7
|
+
### Usando npm
|
|
8
|
+
|
|
9
|
+
Para instalar, basta executar:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @makebot.it/js
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### Diretamente no seu HTML
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
<script type="module">
|
|
19
|
+
import Makebot from 'https://cdn.jsdelivr.net/npm/@makebot.it/js@0/dist/web.js'
|
|
20
|
+
|
|
21
|
+
Makebot.initStandard({
|
|
22
|
+
makebot: 'meu-makebot',
|
|
23
|
+
})
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<makebot-standard style="width: 100%; height: 600px; "></makebot-standard>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Padrão
|
|
30
|
+
|
|
31
|
+
Você pode obter o código HTML e Javascript padrão clicando no botão "HTML e Javascript" na aba "Compartilhar" do seu makebot.
|
|
32
|
+
|
|
33
|
+
Lá, você pode alterar as dimensões do contêiner. Aqui está um exemplo de código:
|
|
34
|
+
|
|
35
|
+
```html
|
|
36
|
+
<script type="module">
|
|
37
|
+
import Makebot from "https://cdn.jsdelivr.net/npm/@makebot.it/js@0/dist/web.js";
|
|
38
|
+
|
|
39
|
+
Makebot.initStandard({
|
|
40
|
+
makebot: "meu-makebot",
|
|
41
|
+
});
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<makebot-standard style="width: 100%; height: 600px; "></makebot-standard>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Este código está criando um contêiner com largura de 100% (corresponderá à largura herdada) e 600px de altura.
|
|
48
|
+
|
|
49
|
+
## Popup
|
|
50
|
+
|
|
51
|
+
Você pode obter o código HTML e Javascript do popup clicando no botão "HTML e Javascript" na aba "Compartilhar" do seu makebot.
|
|
52
|
+
|
|
53
|
+
Aqui está um exemplo:
|
|
54
|
+
|
|
55
|
+
```html
|
|
56
|
+
<script type="module">
|
|
57
|
+
import Makebot from "https://cdn.jsdelivr.net/npm/@makebot.it/js@0/dist/web.js";
|
|
58
|
+
|
|
59
|
+
Makebot.initPopup({
|
|
60
|
+
makebot: "meu-makebot",
|
|
61
|
+
apiHost: "http://localhost:3001",
|
|
62
|
+
autoShowDelay: 3000,
|
|
63
|
+
});
|
|
64
|
+
</script>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Este código acionará automaticamente a janela popup após 3 segundos.
|
|
68
|
+
|
|
69
|
+
### Abrir ou fechar um popup
|
|
70
|
+
|
|
71
|
+
Você pode usar estes comandos:
|
|
72
|
+
|
|
73
|
+
```js
|
|
74
|
+
Makebot.open();
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
```js
|
|
78
|
+
Makebot.close();
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
```js
|
|
82
|
+
Makebot.toggle();
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Você pode vincular esses comandos a um elemento de botão, por exemplo:
|
|
86
|
+
|
|
87
|
+
```html
|
|
88
|
+
<button onclick="Makebot.open()">Contate-nos</button>
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Balão
|
|
92
|
+
|
|
93
|
+
Você pode obter o código HTML e Javascript do balão clicando no botão "HTML e Javascript" na aba "Compartilhar" do seu makebot.
|
|
94
|
+
|
|
95
|
+
Aqui está um exemplo:
|
|
96
|
+
|
|
97
|
+
```html
|
|
98
|
+
<script type="module">
|
|
99
|
+
import Makebot from "https://cdn.jsdelivr.net/npm/@makebot.it/js@0/dist/web.js";
|
|
100
|
+
|
|
101
|
+
Makebot.initBubble({
|
|
102
|
+
makebot: "meu-makebot",
|
|
103
|
+
previewMessage: {
|
|
104
|
+
message: "Tenho uma pergunta para você!",
|
|
105
|
+
autoShowDelay: 5000,
|
|
106
|
+
avatarUrl: "https://avatars.githubusercontent.com/u/10166337?v=4",
|
|
107
|
+
},
|
|
108
|
+
theme: {
|
|
109
|
+
button: { backgroundColor: "#0042DA", iconColor: "#FFFFFF" },
|
|
110
|
+
previewMessage: { backgroundColor: "#ffffff", textColor: "black" },
|
|
111
|
+
chatWindow: { backgroundColor: "#ffffff" },
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
</script>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Este código mostrará o balão e deixará uma mensagem de pré-visualização aparecer após 5 segundos.
|
|
118
|
+
|
|
119
|
+
### Abra ou feche a mensagem de pré-visualização
|
|
120
|
+
|
|
121
|
+
Você pode usar estes comandos:
|
|
122
|
+
|
|
123
|
+
```js
|
|
124
|
+
Makebot.showPreviewMessage();
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
```js
|
|
128
|
+
Makebot.hidePreviewMessage();
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Abra ou feche o makebot
|
|
132
|
+
|
|
133
|
+
Você pode usar estes comandos:
|
|
134
|
+
|
|
135
|
+
```js
|
|
136
|
+
Makebot.open();
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
```js
|
|
140
|
+
Makebot.close();
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
```js
|
|
144
|
+
Makebot.toggle();
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Você pode vincular esses comandos a um elemento de botão, por exemplo:
|
|
148
|
+
|
|
149
|
+
```html
|
|
150
|
+
<button onclick="Makebot.open()">Contate-nos</button>
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Configuração adicional
|
|
154
|
+
|
|
155
|
+
Você pode preencher previamente os valores das variáveis do bot no seu código de incorporação adicionando a opção `prefilledVariables`. Aqui está um exemplo:
|
|
156
|
+
|
|
157
|
+
```js
|
|
158
|
+
Makebot.initStandard({
|
|
159
|
+
makebot: "meu-makebot",
|
|
160
|
+
prefilledVariables: {
|
|
161
|
+
"URL Site": "https://meusite.com.br/conta",
|
|
162
|
+
"Nome": "Paulo Silva",
|
|
163
|
+
},
|
|
164
|
+
});
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Ele preencherá previamente a variável `URL Site` com "https://meu-site/conta" e a variável `Nome` com "Paulo Silva".
|
|
168
|
+
Observe que, se a URL do seu site contiver parâmetros de consulta (por exemplo, https://bot.makebot.it/meu-makebot?URL%20Site=https://meusite.com.br/conta&Nome=Paulo%20Silva), (Observe que os espaços nos nomes das variáveis devem ser substituídos por %20), as variáveis serão injetadas automaticamente no makebot. Portanto, você não precisa transferir manualmente os parâmetros de consulta para a configuração de incorporação do bot.
|
|
169
|
+
|
|
170
|
+
Mais informações sobre variáveis: [aqui](https://docs.makebot.it/editor/variables).
|
package/dist/index.d.ts
CHANGED
|
@@ -1,18 +1,143 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import { InputBlock } from '@makebot.it/blocks-inputs/schema';
|
|
2
|
+
import { StartMakebot, StartFrom } from '@makebot.it/chat-api/schemas';
|
|
3
|
+
import { LogInSession } from '@makebot.it/logs/schemas';
|
|
4
|
+
import { Font } from '@makebot.it/theme/schemas';
|
|
5
|
+
|
|
6
|
+
type BubbleParams = {
|
|
7
|
+
theme?: BubbleTheme;
|
|
8
|
+
previewMessage?: PreviewMessageParams;
|
|
9
|
+
autoShowDelay?: number;
|
|
10
|
+
};
|
|
11
|
+
type BubbleTheme = {
|
|
12
|
+
chatWindow?: ChatWindowTheme;
|
|
13
|
+
button?: ButtonTheme;
|
|
14
|
+
previewMessage?: PreviewMessageTheme;
|
|
15
|
+
placement?: "left" | "right";
|
|
16
|
+
position?: "fixed" | "static";
|
|
17
|
+
};
|
|
18
|
+
type ChatWindowTheme = {
|
|
19
|
+
backgroundColor?: string;
|
|
20
|
+
maxWidth?: string;
|
|
21
|
+
maxHeight?: string;
|
|
22
|
+
};
|
|
23
|
+
type ButtonTheme = {
|
|
24
|
+
isHidden?: boolean;
|
|
25
|
+
size?: "medium" | "large" | `${number}px`;
|
|
26
|
+
backgroundColor?: string;
|
|
27
|
+
iconColor?: string;
|
|
28
|
+
customIconSrc?: string;
|
|
29
|
+
customCloseIconSrc?: string;
|
|
30
|
+
};
|
|
31
|
+
type PreviewMessageParams = {
|
|
32
|
+
avatarUrl?: string;
|
|
33
|
+
message: string;
|
|
34
|
+
autoShowDelay?: number;
|
|
35
|
+
};
|
|
36
|
+
type PreviewMessageTheme = {
|
|
37
|
+
backgroundColor?: string;
|
|
38
|
+
textColor?: string;
|
|
39
|
+
closeButtonBackgroundColor?: string;
|
|
40
|
+
closeButtonIconColor?: string;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
type CommandArgs = {
|
|
44
|
+
id?: string;
|
|
45
|
+
};
|
|
46
|
+
type CommandData = CommandArgs & {
|
|
47
|
+
isFromMakebot: boolean;
|
|
48
|
+
} & ({
|
|
49
|
+
command: "open" | "toggle" | "close" | "hidePreviewMessage" | "unmount" | "reload";
|
|
50
|
+
} | ShowMessageCommandData | SetPrefilledVariablesCommandData | SetInputValueCommandData | SendCommandCommandData);
|
|
51
|
+
type ShowMessageCommandData = {
|
|
52
|
+
command: "showPreviewMessage";
|
|
53
|
+
message?: Pick<PreviewMessageParams, "avatarUrl" | "message">;
|
|
54
|
+
};
|
|
55
|
+
type SetPrefilledVariablesCommandData = {
|
|
56
|
+
command: "setPrefilledVariables";
|
|
57
|
+
variables: Record<string, string | number | boolean>;
|
|
58
|
+
};
|
|
59
|
+
type SetInputValueCommandData = {
|
|
60
|
+
command: "setInputValue";
|
|
61
|
+
value: string;
|
|
62
|
+
};
|
|
63
|
+
type SendCommandCommandData = {
|
|
64
|
+
command: "sendCommand";
|
|
65
|
+
text: string;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
declare const close: ({ id }?: CommandArgs) => void;
|
|
69
|
+
|
|
70
|
+
declare const open: ({ id }?: CommandArgs) => void;
|
|
71
|
+
|
|
72
|
+
declare const showPreviewMessage: (proactiveMessage: ShowMessageCommandData["message"] | undefined, { id }?: CommandArgs) => void;
|
|
73
|
+
|
|
74
|
+
declare const toggle: ({ id }?: CommandArgs) => void;
|
|
75
|
+
|
|
76
|
+
declare const setInputValue: (value: string, { id }?: CommandArgs) => void;
|
|
77
|
+
|
|
78
|
+
declare const unmount: ({ id }?: CommandArgs) => void;
|
|
79
|
+
|
|
80
|
+
declare const setPrefilledVariables: (variables: Record<string, string | number | boolean>, { id }?: CommandArgs) => void;
|
|
81
|
+
|
|
82
|
+
declare const hidePreviewMessage: ({ id }?: CommandArgs) => void;
|
|
83
|
+
|
|
84
|
+
declare const sendCommand: (text: string, { id }?: CommandArgs) => void;
|
|
85
|
+
|
|
86
|
+
declare const reload: ({ id }?: CommandArgs) => void;
|
|
87
|
+
|
|
88
|
+
type BotProps = {
|
|
89
|
+
id?: string;
|
|
90
|
+
makebot: string | StartMakebot | undefined;
|
|
91
|
+
isPreview?: boolean;
|
|
92
|
+
resultId?: string;
|
|
93
|
+
prefilledVariables?: Record<string, unknown>;
|
|
94
|
+
apiHost?: string;
|
|
95
|
+
wsHost?: string;
|
|
96
|
+
font?: Font;
|
|
97
|
+
progressBarRef?: HTMLDivElement;
|
|
98
|
+
startFrom?: StartFrom;
|
|
99
|
+
sessionId?: string;
|
|
100
|
+
onNewInputBlock?: (inputBlock: InputBlock) => void;
|
|
101
|
+
onAnswer?: (answer: {
|
|
102
|
+
message: string;
|
|
103
|
+
blockId: string;
|
|
104
|
+
}) => void;
|
|
105
|
+
onInit?: () => void;
|
|
106
|
+
onEnd?: () => void;
|
|
107
|
+
onNewLogs?: (logs: LogInSession[]) => void;
|
|
108
|
+
onChatStatePersisted?: (isEnabled: boolean) => void;
|
|
109
|
+
onScriptExecutionSuccess?: (message: string) => void;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
type PopupParams = {
|
|
113
|
+
autoShowDelay?: number;
|
|
114
|
+
theme?: {
|
|
115
|
+
width?: string;
|
|
116
|
+
backgroundColor?: string;
|
|
117
|
+
zIndex?: number;
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
type PopupProps = BotProps & PopupParams & {
|
|
122
|
+
defaultOpen?: boolean;
|
|
123
|
+
isOpen?: boolean;
|
|
124
|
+
onOpen?: () => void;
|
|
125
|
+
onClose?: () => void;
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
type BubbleProps = BotProps & BubbleParams & {
|
|
129
|
+
inlineStyle?: {
|
|
130
|
+
[key: string]: string;
|
|
131
|
+
};
|
|
132
|
+
isOpen?: boolean;
|
|
133
|
+
onOpen?: () => void;
|
|
134
|
+
onClose?: () => void;
|
|
135
|
+
onPreviewMessageClick?: () => void;
|
|
136
|
+
onPreviewMessageDismissed?: () => void;
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
declare const resolveButtonSize: (size: NonNullable<NonNullable<BubbleProps["theme"]>["button"]>["size"], { isHidden }?: {
|
|
140
|
+
isHidden?: boolean;
|
|
141
|
+
}) => `${number}px`;
|
|
142
|
+
|
|
143
|
+
export { type BotProps, type BubbleParams, type BubbleProps, type BubbleTheme, type ButtonTheme, type ChatWindowTheme, type CommandArgs, type CommandData, type PopupParams, type PopupProps, type PreviewMessageParams, type PreviewMessageTheme, type SendCommandCommandData, type SetInputValueCommandData, type SetPrefilledVariablesCommandData, type ShowMessageCommandData, close, hidePreviewMessage, open, reload, resolveButtonSize, sendCommand, setInputValue, setPrefilledVariables, showPreviewMessage, toggle, unmount };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
// v0.9.11
|
|
2
1
|
var s=({id:o}={})=>{let e={isFromMakebot:!0,command:"close",id:o};window.postMessage(e)};var r=({id:o}={})=>{let e={isFromMakebot:!0,command:"open",id:o};window.postMessage(e)};var p=(o,{id:e}={})=>{let m={isFromMakebot:!0,command:"showPreviewMessage",message:o,id:e};window.postMessage(m)};var g=({id:o}={})=>{let e={isFromMakebot:!0,command:"toggle",id:o};window.postMessage(e)};var u=(o,{id:e}={})=>{let m={isFromMakebot:!0,command:"setInputValue",value:o,id:e};window.postMessage(m)};var f=({id:o}={})=>{let e={isFromMakebot:!0,command:"unmount",id:o};window.postMessage(e)};var c=(o,{id:e}={})=>{let m={isFromMakebot:!0,command:"setPrefilledVariables",variables:o,id:e};window.postMessage(m)};var l=({id:o}={})=>{let e={isFromMakebot:!0,command:"hidePreviewMessage",id:o};window.postMessage(e)};var y=(o,{id:e}={})=>{let m={isFromMakebot:!0,command:"sendCommand",text:o,id:e};window.postMessage(m)};var D=({id:o}={})=>{let e={isFromMakebot:!0,command:"reload",id:o};window.postMessage(e)};var t=(o,{isHidden:e=!1}={})=>e?"0px":o==="large"?"64px":o==="medium"||!o?"48px":typeof o=="string"&&/^\d+px$/.test(o.trim())?o.trim():(console.warn("[Makebot] Tamanho de bot\xE3o inv\xE1lido. Use 'm\xE9dio', 'grande' ou um valor em pixels expl\xEDcita (ex.: '52px')."),"48px");export{s as close,l as hidePreviewMessage,r as open,D as reload,t as resolveButtonSize,y as sendCommand,u as setInputValue,c as setPrefilledVariables,p as showPreviewMessage,g as toggle,f as unmount};
|