@ohos-ports/flowise-embed 0.0.0-stage → 3.1.6-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.
Files changed (190) hide show
  1. package/.env.example +34 -0
  2. package/.eslintrc.cjs +14 -0
  3. package/.husky/pre-commit +18 -0
  4. package/.prettierignore +3 -0
  5. package/.prettierrc +8 -0
  6. package/README.md +443 -2
  7. package/base.json +21 -0
  8. package/dist/components/Badge.d.ts +10 -0
  9. package/dist/components/Badge.d.ts.map +1 -0
  10. package/dist/components/Bot.d.ts +140 -0
  11. package/dist/components/Bot.d.ts.map +1 -0
  12. package/dist/components/FeedbackContentDialog.d.ts +10 -0
  13. package/dist/components/FeedbackContentDialog.d.ts.map +1 -0
  14. package/dist/components/TypingBubble.d.ts +2 -0
  15. package/dist/components/TypingBubble.d.ts.map +1 -0
  16. package/dist/components/avatars/Avatar.d.ts +4 -0
  17. package/dist/components/avatars/Avatar.d.ts.map +1 -0
  18. package/dist/components/avatars/DefaultAvatar.d.ts +2 -0
  19. package/dist/components/avatars/DefaultAvatar.d.ts.map +1 -0
  20. package/dist/components/bubbles/AgentReasoningBubble.d.ts +16 -0
  21. package/dist/components/bubbles/AgentReasoningBubble.d.ts.map +1 -0
  22. package/dist/components/bubbles/BotBubble.d.ts +39 -0
  23. package/dist/components/bubbles/BotBubble.d.ts.map +1 -0
  24. package/dist/components/bubbles/FollowUpPromptBubble.d.ts +8 -0
  25. package/dist/components/bubbles/FollowUpPromptBubble.d.ts.map +1 -0
  26. package/dist/components/bubbles/GuestBubble.d.ts +16 -0
  27. package/dist/components/bubbles/GuestBubble.d.ts.map +1 -0
  28. package/dist/components/bubbles/LeadCaptureBubble.d.ts +20 -0
  29. package/dist/components/bubbles/LeadCaptureBubble.d.ts.map +1 -0
  30. package/dist/components/bubbles/LoadingBubble.d.ts +2 -0
  31. package/dist/components/bubbles/LoadingBubble.d.ts.map +1 -0
  32. package/dist/components/bubbles/SourceBubble.d.ts +12 -0
  33. package/dist/components/bubbles/SourceBubble.d.ts.map +1 -0
  34. package/dist/components/bubbles/StarterPromptBubble.d.ts +8 -0
  35. package/dist/components/bubbles/StarterPromptBubble.d.ts.map +1 -0
  36. package/dist/components/bubbles/ThinkingBubble.d.ts +10 -0
  37. package/dist/components/bubbles/ThinkingBubble.d.ts.map +1 -0
  38. package/dist/components/buttons/AttachmentUploadButton.d.ts +11 -0
  39. package/dist/components/buttons/AttachmentUploadButton.d.ts.map +1 -0
  40. package/dist/components/buttons/CancelButton.d.ts +10 -0
  41. package/dist/components/buttons/CancelButton.d.ts.map +1 -0
  42. package/dist/components/buttons/FeedbackButtons.d.ts +13 -0
  43. package/dist/components/buttons/FeedbackButtons.d.ts.map +1 -0
  44. package/dist/components/buttons/ImageUploadButton.d.ts +11 -0
  45. package/dist/components/buttons/ImageUploadButton.d.ts.map +1 -0
  46. package/dist/components/buttons/LeadCaptureButtons.d.ts +11 -0
  47. package/dist/components/buttons/LeadCaptureButtons.d.ts.map +1 -0
  48. package/dist/components/buttons/RecordAudioButton.d.ts +11 -0
  49. package/dist/components/buttons/RecordAudioButton.d.ts.map +1 -0
  50. package/dist/components/buttons/RegenerateResponseButton.d.ts +10 -0
  51. package/dist/components/buttons/RegenerateResponseButton.d.ts.map +1 -0
  52. package/dist/components/buttons/SendButton.d.ts +12 -0
  53. package/dist/components/buttons/SendButton.d.ts.map +1 -0
  54. package/dist/components/buttons/StopButton.d.ts +9 -0
  55. package/dist/components/buttons/StopButton.d.ts.map +1 -0
  56. package/dist/components/buttons/TTSButton.d.ts +10 -0
  57. package/dist/components/buttons/TTSButton.d.ts.map +1 -0
  58. package/dist/components/buttons/TracesButton.d.ts +10 -0
  59. package/dist/components/buttons/TracesButton.d.ts.map +1 -0
  60. package/dist/components/icons/AddImageIcon.d.ts +3 -0
  61. package/dist/components/icons/AddImageIcon.d.ts.map +1 -0
  62. package/dist/components/icons/AttachmentIcon.d.ts +3 -0
  63. package/dist/components/icons/AttachmentIcon.d.ts.map +1 -0
  64. package/dist/components/icons/ChevronDownIcon.d.ts +3 -0
  65. package/dist/components/icons/ChevronDownIcon.d.ts.map +1 -0
  66. package/dist/components/icons/ChevronRightIcon.d.ts +3 -0
  67. package/dist/components/icons/ChevronRightIcon.d.ts.map +1 -0
  68. package/dist/components/icons/CircleDotIcon.d.ts +3 -0
  69. package/dist/components/icons/CircleDotIcon.d.ts.map +1 -0
  70. package/dist/components/icons/ClipboardIcon.d.ts +3 -0
  71. package/dist/components/icons/ClipboardIcon.d.ts.map +1 -0
  72. package/dist/components/icons/DeleteIcon.d.ts +3 -0
  73. package/dist/components/icons/DeleteIcon.d.ts.map +1 -0
  74. package/dist/components/icons/DownloadFileIcon.d.ts +2 -0
  75. package/dist/components/icons/DownloadFileIcon.d.ts.map +1 -0
  76. package/dist/components/icons/FileIcon.d.ts +3 -0
  77. package/dist/components/icons/FileIcon.d.ts.map +1 -0
  78. package/dist/components/icons/FolderIcon.d.ts +4 -0
  79. package/dist/components/icons/FolderIcon.d.ts.map +1 -0
  80. package/dist/components/icons/GlobeIcon.d.ts +3 -0
  81. package/dist/components/icons/GlobeIcon.d.ts.map +1 -0
  82. package/dist/components/icons/RecordIcon.d.ts +3 -0
  83. package/dist/components/icons/RecordIcon.d.ts.map +1 -0
  84. package/dist/components/icons/SendIcon.d.ts +3 -0
  85. package/dist/components/icons/SendIcon.d.ts.map +1 -0
  86. package/dist/components/icons/SparklesIcon.d.ts +3 -0
  87. package/dist/components/icons/SparklesIcon.d.ts.map +1 -0
  88. package/dist/components/icons/SquareStopIcon.d.ts +3 -0
  89. package/dist/components/icons/SquareStopIcon.d.ts.map +1 -0
  90. package/dist/components/icons/ThumbsDownIcon.d.ts +3 -0
  91. package/dist/components/icons/ThumbsDownIcon.d.ts.map +1 -0
  92. package/dist/components/icons/ThumbsUpIcon.d.ts +3 -0
  93. package/dist/components/icons/ThumbsUpIcon.d.ts.map +1 -0
  94. package/dist/components/icons/TickIcon.d.ts +2 -0
  95. package/dist/components/icons/TickIcon.d.ts.map +1 -0
  96. package/dist/components/icons/TracesIcon.d.ts +3 -0
  97. package/dist/components/icons/TracesIcon.d.ts.map +1 -0
  98. package/dist/components/icons/TrashIcon.d.ts +3 -0
  99. package/dist/components/icons/TrashIcon.d.ts.map +1 -0
  100. package/dist/components/icons/VolumeIcon.d.ts +3 -0
  101. package/dist/components/icons/VolumeIcon.d.ts.map +1 -0
  102. package/dist/components/icons/XIcon.d.ts +5 -0
  103. package/dist/components/icons/XIcon.d.ts.map +1 -0
  104. package/dist/components/icons/index.d.ts +21 -0
  105. package/dist/components/icons/index.d.ts.map +1 -0
  106. package/dist/components/index.d.ts +3 -0
  107. package/dist/components/index.d.ts.map +1 -0
  108. package/dist/components/inputs/textInput/components/FilePreview.d.ts +12 -0
  109. package/dist/components/inputs/textInput/components/FilePreview.d.ts.map +1 -0
  110. package/dist/components/inputs/textInput/components/ShortTextInput.d.ts +10 -0
  111. package/dist/components/inputs/textInput/components/ShortTextInput.d.ts.map +1 -0
  112. package/dist/components/inputs/textInput/components/TextInput.d.ts +33 -0
  113. package/dist/components/inputs/textInput/components/TextInput.d.ts.map +1 -0
  114. package/dist/components/inputs/textInput/index.d.ts +3 -0
  115. package/dist/components/inputs/textInput/index.d.ts.map +1 -0
  116. package/dist/components/treeview/AgentflowIcons.d.ts +15 -0
  117. package/dist/components/treeview/AgentflowIcons.d.ts.map +1 -0
  118. package/dist/components/treeview/DataTransformer.d.ts +7 -0
  119. package/dist/components/treeview/DataTransformer.d.ts.map +1 -0
  120. package/dist/components/treeview/NodeDetailsContent.d.ts +36 -0
  121. package/dist/components/treeview/NodeDetailsContent.d.ts.map +1 -0
  122. package/dist/components/treeview/NodeDetailsDialog.d.ts +20 -0
  123. package/dist/components/treeview/NodeDetailsDialog.d.ts.map +1 -0
  124. package/dist/components/treeview/RichTreeView.d.ts +25 -0
  125. package/dist/components/treeview/RichTreeView.d.ts.map +1 -0
  126. package/dist/components/treeview/TracesDialog.d.ts +16 -0
  127. package/dist/components/treeview/TracesDialog.d.ts.map +1 -0
  128. package/dist/components/treeview/TreeView.d.ts +22 -0
  129. package/dist/components/treeview/TreeView.d.ts.map +1 -0
  130. package/dist/components/treeview/WorkflowTreeView.d.ts +19 -0
  131. package/dist/components/treeview/WorkflowTreeView.d.ts.map +1 -0
  132. package/dist/components/treeview/workflowUtils.d.ts +25 -0
  133. package/dist/components/treeview/workflowUtils.d.ts.map +1 -0
  134. package/dist/constants.d.ts +4 -0
  135. package/dist/constants.d.ts.map +1 -0
  136. package/dist/features/bubble/components/Bubble.d.ts +5 -0
  137. package/dist/features/bubble/components/Bubble.d.ts.map +1 -0
  138. package/dist/features/bubble/components/BubbleButton.d.ts +16 -0
  139. package/dist/features/bubble/components/BubbleButton.d.ts.map +1 -0
  140. package/dist/features/bubble/components/Tooltip.d.ts +15 -0
  141. package/dist/features/bubble/components/Tooltip.d.ts.map +1 -0
  142. package/dist/features/bubble/components/index.d.ts +2 -0
  143. package/dist/features/bubble/components/index.d.ts.map +1 -0
  144. package/dist/features/bubble/index.d.ts +2 -0
  145. package/dist/features/bubble/index.d.ts.map +1 -0
  146. package/dist/features/bubble/types.d.ts +118 -0
  147. package/dist/features/bubble/types.d.ts.map +1 -0
  148. package/dist/features/full/components/Full.d.ts +7 -0
  149. package/dist/features/full/components/Full.d.ts.map +1 -0
  150. package/dist/features/full/components/index.d.ts +2 -0
  151. package/dist/features/full/components/index.d.ts.map +1 -0
  152. package/dist/features/full/index.d.ts +2 -0
  153. package/dist/features/full/index.d.ts.map +1 -0
  154. package/dist/features/popup/components/DisclaimerPopup.d.ts +18 -0
  155. package/dist/features/popup/components/DisclaimerPopup.d.ts.map +1 -0
  156. package/dist/features/popup/components/Popup.d.ts +8 -0
  157. package/dist/features/popup/components/Popup.d.ts.map +1 -0
  158. package/dist/features/popup/components/index.d.ts +3 -0
  159. package/dist/features/popup/components/index.d.ts.map +1 -0
  160. package/dist/features/popup/index.d.ts +2 -0
  161. package/dist/features/popup/index.d.ts.map +1 -0
  162. package/dist/features/popup/types.d.ts +8 -0
  163. package/dist/features/popup/types.d.ts.map +1 -0
  164. package/dist/index.d.ts +5 -0
  165. package/dist/index.d.ts.map +1 -0
  166. package/dist/queries/sendMessageQuery.d.ts +118 -0
  167. package/dist/queries/sendMessageQuery.d.ts.map +1 -0
  168. package/dist/register.d.ts +2 -0
  169. package/dist/register.d.ts.map +1 -0
  170. package/dist/types.d.ts +1 -0
  171. package/dist/types.d.ts.map +1 -0
  172. package/dist/utils/audioRecording.d.ts +21 -0
  173. package/dist/utils/audioRecording.d.ts.map +1 -0
  174. package/dist/utils/chatInputHistory.d.ts +22 -0
  175. package/dist/utils/chatInputHistory.d.ts.map +1 -0
  176. package/dist/utils/index.d.ts +26 -0
  177. package/dist/utils/index.d.ts.map +1 -0
  178. package/dist/utils/isMobileSignal.d.ts +2 -0
  179. package/dist/utils/isMobileSignal.d.ts.map +1 -0
  180. package/dist/web.d.ts +28 -0
  181. package/dist/web.d.ts.map +1 -0
  182. package/dist/web.js +1 -0
  183. package/dist/web.umd.js +1 -0
  184. package/dist/window.d.ts +46 -0
  185. package/dist/window.d.ts.map +1 -0
  186. package/images/ChatEmbed.gif +0 -0
  187. package/images/proxyserver.png +0 -0
  188. package/package.json +74 -4
  189. package/public/index.html +37 -0
  190. package/server.js +394 -0
package/.env.example ADDED
@@ -0,0 +1,34 @@
1
+ # ==============================================
2
+ # REQUIRED CONFIGURATION
3
+ # ==============================================
4
+
5
+ # API Host URL (required)
6
+ # This should be the URL where your Flowise instance is running
7
+ # Example: https://your-flowise-instance.com
8
+ API_HOST=
9
+
10
+ # Flowise API Key (required)
11
+ # Generate this from your Flowise instance settings page
12
+ # Example: OxxGE-h_LaH7ZYorStjTOik1XY999RxxoHpCSYl8BXxc
13
+ FLOWISE_API_KEY=
14
+
15
+ # ==============================================
16
+ # CHATFLOWS CONFIGURATION (required)
17
+ # ==============================================
18
+
19
+ # Format: [identifier]=[chatflowId],[allowedDomain1],[allowedDomain2],...
20
+ #
21
+ # Each entry consists of:
22
+ # - identifier: Any name you choose (e.g., agent1, support, salesbot)
23
+ # - chatflowId: The UUID of your Flowise chatflow
24
+ # - allowedDomains: Comma-separated list of domains where this chat can be embedded
25
+ # Note: Wildcard domains (*) are not supported for security reasons
26
+ #
27
+ # Examples:
28
+ # agent1=20db97c6-64c9-4411-bab4-7d6202171600,https://example1.com
29
+ # support=1c28f529-a70f-5001-9bc5-4f4c5d03d8c0,https://example2.com,https://another-example2.com
30
+ # salesbot=3db97c6-64c9-4411-bab4-7d620217160a,https://sales.example.com
31
+
32
+ # Add your chatflows below:
33
+ chatflow_1=
34
+ chatflow_2=
package/.eslintrc.cjs ADDED
@@ -0,0 +1,14 @@
1
+ module.exports = {
2
+ root: true,
3
+ extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier', 'plugin:solid/typescript'],
4
+ plugins: ['@typescript-eslint', 'solid'],
5
+ parser: '@typescript-eslint/parser',
6
+ ignorePatterns: ['**/*.md'],
7
+ rules: {
8
+ '@next/next/no-img-element': 'off',
9
+ '@next/next/no-html-link-for-pages': 'off',
10
+ 'solid/no-innerhtml': 'off',
11
+ '@typescript-eslint/no-namespace': 'off',
12
+ '@typescript-eslint/no-explicit-any': 'off'
13
+ }
14
+ }
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env sh
2
+ . "$(dirname -- "$0")/_/husky.sh"
3
+
4
+ set -e # Exit on any error
5
+
6
+ echo "Running ESLint for linting..."
7
+ npm run lint
8
+
9
+ echo "Running ESLint for fixing issues..."
10
+ npm run lint-fix
11
+
12
+ echo "Formatting code..."
13
+ npm run format
14
+
15
+ echo "Checking formatting..."
16
+ npm run format:check
17
+
18
+ echo "Pre-commit checks passed."
@@ -0,0 +1,3 @@
1
+ node_modules
2
+ build
3
+ dist
package/.prettierrc ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "semi": true,
3
+ "singleQuote": true,
4
+ "tabWidth": 2,
5
+ "trailingComma": "all",
6
+ "printWidth": 150,
7
+ "endOfLine": "lf"
8
+ }
package/README.md CHANGED
@@ -1,3 +1,444 @@
1
- # Temporary Holding Version
1
+ <!-- markdownlint-disable MD030 -->
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ # Flowise Embed
4
+
5
+ Javascript library to display flowise chatbot on your website
6
+
7
+ ![Flowise](https://github.com/FlowiseAI/FlowiseChatEmbed/blob/main/images/ChatEmbed.gif?raw=true)
8
+
9
+ Install:
10
+
11
+ ```bash
12
+ yarn install
13
+ ```
14
+
15
+ Dev:
16
+
17
+ ```bash
18
+ yarn dev
19
+ ```
20
+
21
+ A development server will be running on http://localhost:5678 automatically. Update `public/index.html` to connect directly to Flowise:
22
+
23
+ ```html
24
+ <!-- public/index.html -->
25
+ <script type="module">
26
+ import Chatbot from 'https://localhost:5678/web.js'; // Change to from './web.js' to 'https://localhost:5678/web.js'
27
+ Chatbot.init({
28
+ chatflowid: '91e9c803-5169-4db9-8207-3c0915d71c5f', // Add your Flowise chatflowid
29
+ apiHost: 'https://your-flowise-instance.com', // Add your Flowise apiHost
30
+ });
31
+ </script>
32
+ ```
33
+
34
+ Build:
35
+
36
+ ```bash
37
+ yarn build
38
+ ```
39
+
40
+ ## Embed in your HTML
41
+
42
+ ### PopUp
43
+
44
+ ```html
45
+ <script type="module">
46
+ import Chatbot from 'https://cdn.jsdelivr.net/npm/flowise-embed/dist/web.js';
47
+ Chatbot.init({
48
+ chatflowid: '<chatflowid>',
49
+ apiHost: 'http://localhost:3000',
50
+ });
51
+ </script>
52
+ ```
53
+
54
+ ### FullPage
55
+
56
+ ```html
57
+ <script type="module">
58
+ import Chatbot from 'https://cdn.jsdelivr.net/npm/flowise-embed/dist/web.js';
59
+ Chatbot.initFull({
60
+ chatflowid: '<chatflowid>',
61
+ apiHost: 'http://localhost:3000',
62
+ });
63
+ </script>
64
+ <flowise-fullchatbot></flowise-fullchatbot>
65
+ ```
66
+
67
+ To enable full screen, add `margin: 0` to <code>body</code> style. The default height is `100dvh` (full viewport height), so omitting `height` is recommended for true full-screen mode.
68
+
69
+ ```html
70
+ <body style="margin: 0">
71
+ <script type="module">
72
+ import Chatbot from 'https://cdn.jsdelivr.net/npm/flowise-embed/dist/web.js';
73
+ Chatbot.initFull({
74
+ chatflowid: '<chatflowid>',
75
+ apiHost: 'http://localhost:3000',
76
+ });
77
+ </script>
78
+ </body>
79
+ ```
80
+
81
+ #### Responsive height and width
82
+
83
+ `height` and `width` accept a **number** (pixels) or a **CSS string**:
84
+
85
+ | Value | Behaviour |
86
+ | ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
87
+ | `height: 700` | Fixed 700px, automatically shrinks on smaller screens |
88
+ | `height: '700px'` | Same as above via string |
89
+ | `height: '80dvh'` | Responsive — 80% of viewport height on all screen sizes |
90
+ | `height: 'min(700px, 80dvh)'` | Caps at 700px on large screens, shrinks proportionally on small screens |
91
+ | `height: '100%'` | Relative to the `<flowise-fullchatbot>` host element — only works if the host has an explicit height set (e.g. via CSS). Use `'100dvh'` or omit `height` for full-viewport behaviour instead. |
92
+
93
+ The same options apply to `width`.
94
+
95
+ ### Clear Chat
96
+
97
+ ```html
98
+ <script type="module">
99
+ import Chatbot from 'https://cdn.jsdelivr.net/npm/flowise-embed/dist/web.js';
100
+ Chatbot.initFull({
101
+ chatflowid: '<chatflowid>',
102
+ apiHost: 'http://localhost:3000',
103
+ id: 'my-chatbot',
104
+ });
105
+ </script>
106
+
107
+ <!-- Call clearChat after the bot has mounted, e.g. from a button -->
108
+ <button onclick="Chatbot.clearChat()">Clear All Chats</button>
109
+ <button onclick="Chatbot.clearChat('my-chatbot')">Clear Specific Chat</button>
110
+ ```
111
+
112
+ ## Configuration
113
+
114
+ You can also customize chatbot with different configuration
115
+
116
+ ```html
117
+ <script type="module">
118
+ import Chatbot from 'https://cdn.jsdelivr.net/npm/flowise-embed/dist/web.js';
119
+ Chatbot.init({
120
+ chatflowid: '91e9c803-5169-4db9-8207-3c0915d71c5f',
121
+ apiHost: 'http://localhost:3000',
122
+ pageTitle: 'Flowise Chatbot Widget', // Optional: browser tab title. Empty string falls back to "Flowise Chatbot Widget"
123
+ chatflowConfig: {
124
+ // topK: 2
125
+ },
126
+ observersConfig: {
127
+ // (optional) Allows you to execute code in parent based upon signal observations within the chatbot.
128
+ // The userinput field submitted to bot ("" when reset by bot)
129
+ observeUserInput: (userInput) => {
130
+ console.log({ userInput });
131
+ },
132
+ // The bot message stack has changed
133
+ observeMessages: (messages) => {
134
+ console.log({ messages });
135
+ },
136
+ // The bot loading signal changed
137
+ observeLoading: (loading) => {
138
+ console.log({ loading });
139
+ },
140
+ },
141
+ theme: {
142
+ button: {
143
+ backgroundColor: '#3B81F6',
144
+ right: 20,
145
+ bottom: 20,
146
+ size: 48, // small | medium | large | number
147
+ dragAndDrop: true,
148
+ iconColor: 'white',
149
+ customIconSrc: 'https://raw.githubusercontent.com/walkxcode/dashboard-icons/main/svg/google-messages.svg',
150
+ autoWindowOpen: {
151
+ autoOpen: true, //parameter to control automatic window opening
152
+ openDelay: 2, // Optional parameter for delay time in seconds
153
+ autoOpenOnMobile: false, //parameter to control automatic window opening in mobile
154
+ },
155
+ },
156
+ tooltip: {
157
+ showTooltip: true,
158
+ tooltipMessage: 'Hi There 👋!',
159
+ tooltipBackgroundColor: 'black',
160
+ tooltipTextColor: 'white',
161
+ tooltipFontSize: 16,
162
+ },
163
+ disclaimer: {
164
+ title: 'Disclaimer',
165
+ message: 'By using this chatbot, you agree to the <a target="_blank" href="https://flowiseai.com/terms">Terms & Condition</a>',
166
+ textColor: 'black',
167
+ buttonColor: '#3b82f6',
168
+ buttonText: 'Start Chatting',
169
+ buttonTextColor: 'white',
170
+ blurredBackgroundColor: 'rgba(0, 0, 0, 0.4)', //The color of the blurred background that overlays the chat interface
171
+ backgroundColor: 'white',
172
+ denyButtonText: 'Cancel',
173
+ denyButtonBgColor: '#ef4444',
174
+ },
175
+ form: {
176
+ backgroundColor: 'white',
177
+ textColor: 'black',
178
+ }
179
+ customCSS: ``, // Add custom CSS styles. Use !important to override default styles
180
+ chatWindow: {
181
+ showTitle: true,
182
+ showAgentMessages: true,
183
+ title: 'Flowise Bot',
184
+ titleAvatarSrc: 'https://raw.githubusercontent.com/walkxcode/dashboard-icons/main/svg/google-messages.svg',
185
+ titleBackgroundColor: '#3B81F6',
186
+ titleTextColor: '#ffffff',
187
+ welcomeMessage: 'Hello! This is custom welcome message',
188
+ errorMessage: 'This is a custom error message',
189
+ backgroundColor: '#ffffff',
190
+ backgroundImage: 'enter image path or link', // If set, this will overlap the background color of the chat window.
191
+ height: 700, // number (px) or CSS string e.g. '80dvh', 'min(700px, 80dvh)'
192
+ width: 400, // number (px) or CSS string e.g. '400px', '50vw'
193
+ fontSize: 16,
194
+ starterPrompts: ['What is a bot?', 'Who are you?'], // It overrides the starter prompts set by the chat flow passed
195
+ starterPromptFontSize: 15,
196
+ clearChatOnReload: false, // If set to true, the chat will be cleared when the page reloads
197
+ sourceDocsTitle: 'Sources:',
198
+ renderHTML: true,
199
+ headerHtml: '<div style="padding: 10px; background: #f0f0f0;"><h3>My Custom Header</h3></div>', // Optional HTML rendered at the top of the chat window
200
+ botMessage: {
201
+ backgroundColor: '#f7f8ff',
202
+ textColor: '#303235',
203
+ showAvatar: true,
204
+ avatarSrc: 'https://raw.githubusercontent.com/zahidkhawaja/langchain-chat-nextjs/main/public/parroticon.png',
205
+ },
206
+ userMessage: {
207
+ backgroundColor: '#3B81F6',
208
+ textColor: '#ffffff',
209
+ showAvatar: true,
210
+ avatarSrc: 'https://raw.githubusercontent.com/zahidkhawaja/langchain-chat-nextjs/main/public/usericon.png',
211
+ },
212
+ textInput: {
213
+ placeholder: 'Type your question',
214
+ backgroundColor: '#ffffff',
215
+ textColor: '#303235',
216
+ sendButtonColor: '#3B81F6',
217
+ maxChars: 50,
218
+ maxCharsWarningMessage: 'You exceeded the characters limit. Please input less than 50 characters.',
219
+ enableInputHistory: false,
220
+ autoFocus: true, // If not used, autofocus is disabled on mobile and enabled on desktop. true enables it on both, false disables it on both.
221
+ sendMessageSound: true,
222
+ // sendSoundLocation: "send_message.mp3", // If this is not used, the default sound effect will be played if sendSoundMessage is true.
223
+ receiveMessageSound: true,
224
+ // receiveSoundLocation: "receive_message.mp3", // If this is not used, the default sound effect will be played if receiveSoundMessage is true.
225
+ },
226
+ feedback: {
227
+ color: '#303235',
228
+ },
229
+ dateTimeToggle: {
230
+ date: true,
231
+ time: true,
232
+ },
233
+ footer: {
234
+ textColor: '#303235',
235
+ text: 'Powered by',
236
+ company: 'Flowise',
237
+ companyLink: 'https://flowiseai.com',
238
+ },
239
+ },
240
+ },
241
+ });
242
+ </script>
243
+ ```
244
+
245
+ ## Dialog Portal (`dialogContainer`)
246
+
247
+ By default, the `NodeDetailsDialog` (shown when clicking an agent node in the workflow tree view) renders inside the chatbot's shadow DOM. This means its `position: fixed` and `z-index` values are relative to the shadow host element, not the top-level page — which can cause the dialog to appear behind other page elements.
248
+
249
+ The `dialogContainer` prop lets you render the dialog into a host-page element instead, placing it in the document's stacking context so it always appears on top.
250
+
251
+ **Works with both `init` (popup) and `initFull` (full-page) embed modes.**
252
+
253
+ ### Usage
254
+
255
+ Pass a CSS selector string or a direct `HTMLElement` reference:
256
+
257
+ ```html
258
+ <!-- Add a portal target anywhere in your page -->
259
+ <div id="flowise-portal"></div>
260
+
261
+ <script type="module">
262
+ import Chatbot from 'https://cdn.jsdelivr.net/npm/flowise-embed/dist/web.js';
263
+
264
+ // Using a CSS selector string
265
+ Chatbot.init({
266
+ chatflowid: '<chatflowid>',
267
+ apiHost: 'http://localhost:3000',
268
+ dialogContainer: '#flowise-portal',
269
+ });
270
+
271
+ // Or pass a direct element reference
272
+ Chatbot.init({
273
+ chatflowid: '<chatflowid>',
274
+ apiHost: 'http://localhost:3000',
275
+ dialogContainer: document.getElementById('flowise-portal'),
276
+ });
277
+ </script>
278
+ ```
279
+
280
+ The same options apply to `initFull`:
281
+
282
+ ```html
283
+ <div id="flowise-portal"></div>
284
+ <flowise-fullchatbot></flowise-fullchatbot>
285
+
286
+ <script type="module">
287
+ import Chatbot from 'https://cdn.jsdelivr.net/npm/flowise-embed/dist/web.js';
288
+ Chatbot.initFull({
289
+ chatflowid: '<chatflowid>',
290
+ apiHost: 'http://localhost:3000',
291
+ dialogContainer: '#flowise-portal',
292
+ });
293
+ </script>
294
+ ```
295
+
296
+ ### Notes
297
+
298
+ - The `NodeDetailsDialog` will only render if `chatWindow.showAgentMessages` is `true`
299
+ - If `dialogContainer` is omitted, the dialog renders inline inside the shadow DOM (existing behaviour, no change).
300
+ - In popup mode (`init`), if `dialogContainer` is not provided the dialog falls back to rendering inside the bubble's own container.
301
+ - If a CSS selector string is provided but no matching element exists in the DOM at initialisation time, the dialog falls back to inline rendering and a warning is logged to the console.
302
+ - The portal target element itself does not need any particular styling — the dialog uses `position: fixed` to position itself within the viewport.
303
+
304
+ ## (Experimental) Proxy Server Setup
305
+
306
+ The Flowise Embed Proxy Server enhances the security of your chatbot implementation by acting as a protective intermediary layer. This server eliminates the need to expose sensitive Flowise instance details in your frontend code and provides several key security benefits:
307
+
308
+ ![Proxy Server](https://github.com/FlowiseAI/FlowiseChatEmbed/blob/main/images/proxyserver.png?raw=true)
309
+
310
+ - **Enhanced Security**: Conceals your Flowise API host and chatflow IDs from client-side exposure
311
+ - **Access Control**: Implements strict domain-based restrictions for chatbot embedding
312
+ - **Secure Communication**: Acts as a secure gateway for all interactions between your website and Flowise instance
313
+ - **Authentication Management**: Handles API key authentication securely on the server side, away from client exposure
314
+
315
+ This proxy server can be deployed to any Node.js hosting platform.
316
+
317
+ ## Quick Start
318
+
319
+ 1. Configure environment:
320
+
321
+ ```bash
322
+ # Copy .env.example to .env and configure required settings:
323
+ API_HOST=https://your-flowise-instance.com
324
+ FLOWISE_API_KEY=your-api-key
325
+
326
+ # Configure your chatflows:
327
+ # Format: [identifier]=[chatflowId],[allowedDomain1],[allowedDomain2],...
328
+ #
329
+ # identifier: Any name you choose (e.g., agent1, support, salesbot)
330
+ # chatflowId: The UUID of your Flowise chatflow
331
+ # allowedDomains: Comma-separated list of domains where this chat can be embedded
332
+ #
333
+ # Examples:
334
+ support=abc123-def456,https://example.com
335
+ agent1=xyz789-uvw456,https://sales.example.com
336
+ helpdesk=ghi123-jkl456,https://help.example.com,https://support.example.com
337
+ ```
338
+
339
+ 2. Install dependencies: (assuming you did not run `yarn install` yet)
340
+
341
+ ```bash
342
+ yarn install
343
+ ```
344
+
345
+ 3. Start proxy server:
346
+
347
+ ```bash
348
+ yarn start
349
+ # Server will be available at:
350
+ # - Local: http://localhost:3001
351
+ # - Cloud: [Your Platform URL] (e.g., https://your-app.herokuapp.com)
352
+ ```
353
+
354
+ 4. Once the proxy server is running in production, you will be able to embed your chatbots safely without exposing your Flowise API host and chatflow IDs as below:
355
+
356
+ ```html
357
+ <script type="module">
358
+ import Chatbot from 'your-proxy-server-url/web.js'; // Must be 'your-proxy-server-url/web.js'
359
+ Chatbot.init({
360
+ chatflowid: 'your-identifier-here', // Must match an identifier from your .env
361
+ apiHost: 'your-proxy-server-url', // Must match the URL of your proxy server
362
+ chatflowConfig: {
363
+ // ...
364
+ },
365
+ });
366
+ </script>
367
+ ```
368
+
369
+ 5. (optional) If you want to test any identifier in public/index.html, you can update it as below:
370
+
371
+ ```html
372
+ <!-- public/index.html -->
373
+ chatflowid: 'your-identifier-here' // Must match an identifier from your .env
374
+ ```
375
+
376
+ **Important Notes:**
377
+
378
+ - To ensure secure embedding, you must explicitly whitelist the websites authorized to embed each chatbot. This configuration is done within the .env file. Note that this also applies to your server's URL when deployed to a cloud environment, or http://localhost:3001 for local development, if needed you must whitelist it as well.
379
+ - Wildcard domains (\*) are not supported for security reasons
380
+ - Identifiers are case-insensitive (e.g., 'Support' and 'support' are treated the same)
381
+
382
+ ## Cloud Deployment Requirements
383
+
384
+ When deploying to cloud platforms, you must configure the environment variables directly in your platform. The proxy server will not start without these variables being properly set. Compatible with Nixpacks for automatic deployment configuration.
385
+
386
+ ## Development Mode (For Local Testing)
387
+
388
+ 1. Configure your environment variables (see above)
389
+
390
+ 2. Start the proxy server:
391
+
392
+ ```bash
393
+ yarn start
394
+ # Server will be available at:
395
+ # - Local: http://localhost:3001
396
+ ```
397
+
398
+ 3. Update the test page configuration:
399
+
400
+ - Open `public/index.html` in your code editor
401
+ - Modify the `chatflowid` and `apiHost` to match your `.env` settings:
402
+
403
+ ```html
404
+ <!-- public/index.html -->
405
+ <script type="module">
406
+ import Chatbot from './web.js';
407
+ Chatbot.init({
408
+ chatflowid: 'agent1', // Must match an identifier from your .env
409
+ apiHost: 'http://localhost:3001', // Change this from window.location.origin to 'http://localhost:3001'
410
+ });
411
+ </script>
412
+ ```
413
+
414
+ For full page testing, use this configuration instead:
415
+
416
+ ```html
417
+ <!-- public/index.html -->
418
+ <flowise-fullchatbot></flowise-fullchatbot>
419
+ <script type="module">
420
+ import Chatbot from './web.js';
421
+ Chatbot.initFull({
422
+ chatflowid: 'agent1', // Must match an identifier from your .env
423
+ apiHost: 'http://localhost:3001', // Change this from window.location.origin to 'http://localhost:3001'
424
+ });
425
+ </script>
426
+ ```
427
+
428
+ 4. While the proxy server is running, open a new terminal and start the development server:
429
+
430
+ ```bash
431
+ yarn dev
432
+ # This will serve the test page on http://localhost:5678 automatically
433
+ ```
434
+
435
+ 5. Test the chatbot:
436
+
437
+ - Navigate to http://localhost:5678
438
+ - The chatbot should now be visible and functional
439
+
440
+ **Note:** The development URL (http://localhost:5678) is automatically added to allowed domains in development mode. You don't need to add it manually.
441
+
442
+ ## License
443
+
444
+ Source code in this repository is made available under the [MIT License](https://github.com/FlowiseAI/Flowise/blob/master/LICENSE.md).
package/base.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "display": "Default",
4
+ "compilerOptions": {
5
+ "composite": false,
6
+ "declaration": true,
7
+ "declarationMap": true,
8
+ "esModuleInterop": true,
9
+ "forceConsistentCasingInFileNames": true,
10
+ "inlineSources": false,
11
+ "isolatedModules": true,
12
+ "moduleResolution": "node",
13
+ "noUnusedLocals": false,
14
+ "noUnusedParameters": false,
15
+ "preserveWatchOutput": true,
16
+ "skipLibCheck": true,
17
+ "strict": true,
18
+ "downlevelIteration": true
19
+ },
20
+ "exclude": ["node_modules"]
21
+ }
@@ -0,0 +1,10 @@
1
+ import { FooterTheme } from '@/features/bubble/types';
2
+ type Props = {
3
+ footer?: FooterTheme;
4
+ botContainer: HTMLDivElement | undefined;
5
+ poweredByTextColor?: string;
6
+ badgeBackgroundColor?: string;
7
+ };
8
+ export declare const Badge: (props: Props) => import("solid-js").JSX.Element;
9
+ export {};
10
+ //# sourceMappingURL=Badge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../src/components/Badge.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAGtD,KAAK,KAAK,GAAG;IACX,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,YAAY,EAAE,cAAc,GAAG,SAAS,CAAC;IACzC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC;AAIF,eAAO,MAAM,KAAK,UAAW,KAAK,mCA+DjC,CAAC"}