@headwai/chat-bubble 8.0.2 → 8.2.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/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [8.2.0] - 2026-01-21
6
+
7
+ ## Added
8
+
9
+ - Capability to render html in disclaimer message and info message.
10
+
5
11
  ## [8.0.2] - 2026-01-05
6
12
 
7
13
  ### Changed
package/README.dev.md CHANGED
@@ -43,9 +43,6 @@ npm run dev
43
43
  http://localhost:5174/
44
44
  ```
45
45
 
46
- 7. Alternatively, build and test deployed version:
47
- [Build and Deploy](#build-and-deploy) and open `./test-widget.html` in a browser.
48
-
49
46
  ## Configuration
50
47
 
51
48
  The HeadwAI Chat Bubble can be configured using environment variables or by changing the attributes of the instance.
@@ -54,6 +51,27 @@ The HeadwAI Chat Bubble can be configured using environment variables or by chan
54
51
 
55
52
  Create a `.env` by copying `.env.example` file in your project root with the following variables:
56
53
 
54
+ All configuration attributes listed in the [Configuration section of README.md](README.md#configuration) can be overwritten using VITE\_ environment variables. For example:
55
+
56
+ ```bash
57
+ # Production .env file - Core API Configuration
58
+ VITE_CHAT_BUBBLE_API_URL=https://company.headwai-one.at
59
+ VITE_CHAT_BUBBLE_ASSISTANT_ID=customer-support-assistant-id
60
+
61
+ # Message Configuration
62
+ VITE_CHAT_BUBBLE_MAX_MESSAGES=50
63
+ VITE_CHAT_BUBBLE_INITIAL_MESSAGE=Welcome! How can we help you today?
64
+ VITE_CHAT_BUBBLE_PLACEHOLDER_TEXT=Type your message here...
65
+
66
+ # UI Styling Configuration
67
+ VITE_CHAT_BUBBLE_USER_MESSAGE_BG_COLOR=#0066cc
68
+ VITE_CHAT_BUBBLE_AI_MESSAGE_BG_COLOR=#f8f9fa
69
+ VITE_CHAT_BUBBLE_FAVICON_BG_COLOR=#0066cc
70
+
71
+ # Branding Configuration
72
+ VITE_CHAT_BUBBLE_CHAT_TITLE=Customer Support
73
+ ```
74
+
57
75
  ### Window Object Configuration
58
76
 
59
77
  ```html
@@ -66,7 +84,7 @@ Create a `.env` by copying `.env.example` file in your project root with the fol
66
84
  </script>
67
85
  ```
68
86
 
69
- ### Via data attributes (Multiple chat bubbles):\*\*
87
+ ### Data attributes (Multiple chat bubbles):\*\*
70
88
 
71
89
  ```html
72
90
  <div
@@ -84,30 +102,16 @@ Create a `.env` by copying `.env.example` file in your project root with the fol
84
102
 
85
103
  For simple integration instructions, see [README.md](README.md) which provides a streamlined guide for customers.
86
104
 
87
- ## Build and Deploy
105
+ ## Deployment
88
106
 
89
- This project builds a standalone widget that can be integrated into any website.
107
+ ### Automated Publishing
90
108
 
91
- **What gets bundled:**
109
+ The GitHub Actions workflow automatically builds and publishes to npm when:
92
110
 
93
- - All logic and request/response interceptors
94
- - Environment variable configuration
95
- - ✅ All chat functionality
96
- - ✅ UI components and styling
111
+ 1. A version bump is created and committed to a PR
112
+ 2. The PR is merged to the `main` branch
97
113
 
98
- **Build and deployment steps:**
99
-
100
- 1. **Configure environment variables** for production:
101
-
102
- ```bash
103
- # Production .env file
104
- VITE_CHAT_BUBBLE_API_URL=https://company.headwai-one.at
105
- VITE_CHAT_BUBBLE_ASSISTANT_ID=customer-support-assistant-id
106
- ```
107
-
108
- 2. **Bump package version**
109
-
110
- Use npm's built-in version command which automatically updates `package.json`, `package-lock.json`, creates a git commit, and tags the release:
114
+ **Version bump commands:**
111
115
 
112
116
  ```bash
113
117
  # Patch version bump (e.g., 6.3.0 -> 6.3.1)
@@ -118,31 +122,6 @@ npm version minor
118
122
 
119
123
  # Major version bump (e.g., 6.3.0 -> 7.0.0)
120
124
  npm version major
121
-
122
- # Specific version
123
- npm version 6.4.0
124
- ```
125
-
126
- ## Publishing to NPM and jsDelivr Access
127
-
128
- ### Publishing Steps
129
-
130
- 3. **Build widget**:
131
-
132
- ```bash
133
- npm run build
134
- ```
135
-
136
- 4. **Login to NPM** (if not already logged in):
137
-
138
- ```bash
139
- npm login
140
- ```
141
-
142
- 5. **Publish the package**:
143
-
144
- ```bash
145
- npm publish
146
125
  ```
147
126
 
148
127
  ### jsDelivr CDN Access
@@ -380,7 +359,28 @@ Origin: http://localhost:5174
380
359
  "{{CURRENT_TIMEZONE}}": "Europe/Lisbon",
381
360
  "{{USER_LANGUAGE}}": "en-GB"
382
361
  },
383
- "chat_id": "3cd6f38c-effc-4038-948a-4fd345ea19b1"
362
+ "chat_id": "3cd6f38c-effc-4038-948a-4fd345ea19b1",
363
+ "parent_id": "2860fdae-4c43-4f59-8217-33dfc92b47d3", // ID of the parent user message
364
+ "parent_message": { // complete parent user message object
365
+ "id": "2860fdae-4c43-4f59-8217-33dfc92b47d3",
366
+ "role": "user",
367
+ "content": "previous user message",
368
+ "timestamp": 1760362655
369
+ },
370
+ "id": "29948ec6-6975-4d3a-b019-ceb8b7f7c698", // ID for the new assistant message being created
371
+ "params": {}, // optional - additional parameters
372
+ "tool_servers": [], // optional - tool server configurations
373
+ "features": { // optional - feature flags
374
+ "image_generation": false,
375
+ "code_interpreter": false,
376
+ "web_search": false,
377
+ "memory": false
378
+ },
379
+ "background_tasks": { // optional - background task configurations
380
+ "title_generation": true,
381
+ "tags_generation": false,
382
+ "follow_up_generation": false
383
+ }
384
384
  }
385
385
 
386
386
  ```
@@ -846,224 +846,6 @@ Origin: http://localhost:5174
846
846
  }
847
847
  ```
848
848
 
849
- ### Configuration Attributes
850
-
851
- The HeadwAI Chat Bubble can be configured using environment variables, data attributes, or runtime configuration. All attributes have fallback defaults.
852
-
853
- #### Core API Configuration
854
-
855
- | Attribute | Environment Variable | Data Attribute | Purpose | Default |
856
- | ------------- | ------------------------------- | ------------------------------- | ----------------------------------------- | ------------------- |
857
- | `apiUrl` | `VITE_CHAT_BUBBLE_API_URL` | `data-chat-bubble-api-url` | Base URL for API endpoints | `https://localhost` |
858
- | `assistantId` | `VITE_CHAT_BUBBLE_ASSISTANT_ID` | `data-chat-bubble-assistant-id` | Assistant identifier to use for responses | `test-model` |
859
- | Attribute | Environment Variable | Data Attribute | Purpose | Default |
860
- | ------------- | ------------------------------- | ------------------------------- | ----------------------------------------- | ------------------- |
861
- | `apiUrl` | `VITE_CHAT_BUBBLE_API_URL` | `data-chat-bubble-api-url` | Base URL for API endpoints | `https://localhost` |
862
- | `assistantId` | `VITE_CHAT_BUBBLE_ASSISTANT_ID` | `data-chat-bubble-assistant-id` | Assistant identifier to use for responses | `test-model` |
863
-
864
- #### Message Configuration
865
-
866
- | Attribute | Environment Variable | Data Attribute | Purpose | Default |
867
- | ----------------- | ----------------------------------- | ----------------------------------- | ------------------------------------------------------ | --------------------------- |
868
- | `maxMessages` | `VITE_CHAT_BUBBLE_MAX_MESSAGES` | `data-chat-bubble-max-messages` | Maximum messages to include in context (0 = unlimited) | `0` |
869
- | `initialMessage` | `VITE_CHAT_BUBBLE_INITIAL_MESSAGE` | `data-chat-bubble-initial-message` | First message shown when chat opens | `Hey, how can I help you?` |
870
- | `placeholderText` | `VITE_CHAT_BUBBLE_PLACEHOLDER_TEXT` | `data-chat-bubble-placeholder-text` | Input field placeholder text | `Enter your questions here` |
871
-
872
- #### UI Styling Configuration
873
-
874
- | Attribute | Environment Variable | Data Attribute | Purpose | Default |
875
- | -------------------------------- | ---------------------------------------------- | ---------------------------------------------------- | ------------------------------------- | --------- |
876
- | `userMessageBackgroundColor` | `VITE_CHAT_BUBBLE_USER_MESSAGE_BG_COLOR` | `data-chat-bubble-user-message-background-color` | Background color for user messages | `#007bff` |
877
- | `userMessageTextColor` | `VITE_CHAT_BUBBLE_USER_MESSAGE_TEXT_COLOR` | `data-chat-bubble-user-message-text-color` | Text color for user messages | `#000000` |
878
- | `aiMessageBackgroundColor` | `VITE_CHAT_BUBBLE_AI_MESSAGE_BG_COLOR` | `data-chat-bubble-ai-message-background-color` | Background color for AI messages | `#f1f3f4` |
879
- | `aiMessageTextColor` | `VITE_CHAT_BUBBLE_AI_MESSAGE_TEXT_COLOR` | `data-chat-bubble-ai-message-text-color` | Text color for AI messages | `#000000` |
880
- | `feedbackMessageBackgroundColor` | `VITE_CHAT_BUBBLE_FEEDBACK_MESSAGE_BG_COLOR` | `data-chat-bubble-feedback-message-background-color` | Background color for feedback buttons | `#ffffff` |
881
- | `feedbackMessageTextColor` | `VITE_CHAT_BUBBLE_FEEDBACK_MESSAGE_TEXT_COLOR` | `data-chat-bubble-feedback-message-text-color` | Text color for feedback buttons | `#000000` |
882
- | `faviconBackgroundColor` | `VITE_CHAT_BUBBLE_FAVICON_BG_COLOR` | `data-chat-bubble-favicon-background-color` | Background color for chat icon | `#667eea` |
883
- | `fontFamily` | `VITE_CHAT_BUBBLE_FONT_FAMILY` | `data-chat-bubble-font-family` | Font family for chat interface | `inherit` |
884
- | `fontSize` | `VITE_CHAT_BUBBLE_FONT_SIZE` | `data-chat-bubble-font-size` | Font size for chat interface | `inherit` |
885
-
886
- #### Branding Configuration
887
-
888
- | Attribute | Environment Variable | Data Attribute | Purpose | Default |
889
- | ------------- | ------------------------------- | ------------------------------- | -------------------------- | --------------------- |
890
- | `chatTitle` | `VITE_CHAT_BUBBLE_CHAT_TITLE` | `data-chat-bubble-chat-title` | Title shown in chat header | `HeadwAI Chat Bubble` |
891
- | `faviconPath` | `VITE_CHAT_BUBBLE_FAVICON_PATH` | `data-chat-bubble-favicon-path` | Path to chat icon/logo | `./icons/favicon.svg` |
892
-
893
- ### API Request Flow and Data Format
894
-
895
- #### Chat Completions Request
896
-
897
- ```javascript
898
- {
899
- "messages": [
900
- {
901
- "role": "user|assistant",
902
- "content": "message text"
903
- }
904
- ],
905
- "model": "customer-support-assistant-id",
906
- "stream": true,
907
- "chat_id": "uuid-if-existing",
908
- "params": {},
909
- "tool_servers": [],
910
- "features": {
911
- "image_generation": false,
912
- "code_interpreter": false,
913
- "web_search": false,
914
- "memory": false
915
- },
916
- "variables": {
917
- "{{USER_NAME}}": "David Schneebauer | headwAI GmbH",
918
- "{{USER_LOCATION}}": "Unknown",
919
- "{{CURRENT_DATETIME}}": "2025-01-07 15:30:45",
920
- // ... additional template variables
921
- },
922
- "background_tasks": {
923
- "title_generation": true,
924
- "tags_generation": false,
925
- "follow_up_generation": false
926
- }
927
- }
928
- ```
929
-
930
- #### Chat Creation Request
931
-
932
- ```javascript
933
- {
934
- "assistantId": "customer-support-assistant-id",
935
- "chat": {
936
- "id": "",
937
- "title": "New Chatbubble Chat",
938
- "models": ["customer-support-assistant-id"],
939
- "params": {},
940
- "history": {
941
- "messages": {"message-id": {...}},
942
- "currentId": "last-message-id"
943
- },
944
- "messages": [{
945
- "id": "uuid",
946
- "parentId": "parent-uuid",
947
- "childrenIds": ["child-uuid"],
948
- "role": "assistant|user",
949
- "content": "message content",
950
- "timestamp": 1704636645,
951
- "models": ["customer-support-assistant-id"]
952
- }],
953
- "tags": [],
954
- "timestamp": 1704636645000
955
- },
956
- "folder_id": null
957
- }
958
- ```
959
-
960
- #### Chat Storage Request
961
-
962
- ```javascript
963
- {
964
- "assistantId": "customer-support-assistant-id",
965
- "chat": {
966
- "models": ["customer-support-assistant-id"],
967
- "history": {
968
- "messages": {
969
- "message-uuid-1": {
970
- "id": "message-uuid-1",
971
- "parentId": null,
972
- "childrenIds": ["message-uuid-2"],
973
- "role": "user",
974
- "content": "user message content",
975
- "timestamp": 1704636645,
976
- "models": ["customer-support-assistant-id"]
977
- },
978
- "message-uuid-2": {
979
- "id": "message-uuid-2",
980
- "parentId": "message-uuid-1",
981
- "childrenIds": [],
982
- "role": "assistant",
983
- "content": "assistant response content",
984
- "model": "customer-support-assistant-id",
985
- "modelId": "customer-support-assistant-id",
986
- "modelIdx": 0,
987
- "timestamp": 1704636645,
988
- "sources": []
989
- }
990
- },
991
- "currentId": "message-uuid-2"
992
- },
993
- "messages": [
994
- {
995
- "id": "message-uuid-1",
996
- "parentId": null,
997
- "childrenIds": ["message-uuid-2"],
998
- "role": "user",
999
- "content": "user message content",
1000
- "timestamp": 1704636645,
1001
- "models": ["customer-support-assistant-id"]
1002
- },
1003
- {
1004
- "id": "message-uuid-2",
1005
- "parentId": "message-uuid-1",
1006
- "childrenIds": [],
1007
- "role": "assistant",
1008
- "content": "assistant response content",
1009
- "model": "customer-support-assistant-id",
1010
- "modelId": "customer-support-assistant-id",
1011
- "modelIdx": 0,
1012
- "timestamp": 1704636645,
1013
- "sources": []
1014
- }
1015
- ],
1016
- "params": {}
1017
- }
1018
- }
1019
- ```
1020
-
1021
- #### Feedback Request
1022
-
1023
- ```javascript
1024
- {
1025
- "assistantId": "customer-support-assistant-id",
1026
- "type": "rating",
1027
- "data": {
1028
- "rating": 1, // 1 for positive, -1 for negative
1029
- "model_id": "customer-support-assistant-id"
1030
- },
1031
- "meta": {
1032
- "model_id": "customer-support-assistant-id",
1033
- "message_id": "message-uuid",
1034
- "message_index": 2,
1035
- "chat_id": "chat-uuid",
1036
- "base_models": {"customer-support-assistant-id": "customer-support-assistant-id"}
1037
- },
1038
- "snapshot": {
1039
- "chat": {
1040
- // Complete chat state for context
1041
- }
1042
- }
1043
- }
1044
- ```
1045
-
1046
- ## API Compatibility
1047
-
1048
- This component is designed to work with OpenAI-compatible APIs. The request and response interceptors handle the message format transformation between deep-chat and OpenAI formats.
1049
-
1050
- ### Supported Message Flow
1051
-
1052
- 1. **User Input** → Deep Chat format
1053
- 2. **Request Interceptor** → Transforms to OpenAI format
1054
- 3. **API Call** → Your configured endpoint
1055
- 4. **Response Interceptor** → Transforms back to Deep Chat format
1056
- 5. **Display** → Rendered in chat interface
1057
-
1058
- ## Development
1059
-
1060
- ### Scripts
1061
-
1062
- - `npm run dev` - Start development server
1063
- - `npm run build` - Build widget for production
1064
- - `npm run build:widget` - Build standalone widget
1065
- - `npm run preview` - Preview production build
1066
-
1067
849
  ## Troubleshooting
1068
850
 
1069
851
  ### Common Issues