@ihoomanai/chat-widget 2.3.0 → 2.4.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.
@@ -1 +1 @@
1
- {"version":3,"file":"widget.d.ts","sourceRoot":"","sources":["../src/widget.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAMV,cAAc,EAEf,MAAM,SAAS,CAAC;AAw7CjB;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,cAA0B,CAAC;AAErD;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,cAAc,CAErD"}
1
+ {"version":3,"file":"widget.d.ts","sourceRoot":"","sources":["../src/widget.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAMV,cAAc,EAEf,MAAM,SAAS,CAAC;AAi9CjB;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,cAA0B,CAAC;AAErD;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,cAAc,CAErD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ihoomanai/chat-widget",
3
- "version": "2.3.0",
3
+ "version": "2.4.0",
4
4
  "type": "module",
5
5
  "description": "Universal chat support widget for any website - secure Widget ID based initialization",
6
6
  "main": "dist/index.cjs.js",
package/src/widget.ts CHANGED
@@ -1181,17 +1181,42 @@ function toggle(): void {
1181
1181
  * Start a new conversation
1182
1182
  */
1183
1183
  function startNewConversation(): void {
1184
+ // Clear session and visitor to force a completely new conversation
1184
1185
  state.sessionId = null;
1186
+ state.visitorId = null;
1185
1187
  state.messages = [];
1188
+ isLiveAgentMode = false;
1189
+
1190
+ // Clear stored session
1186
1191
  storage('session_id', null);
1192
+ // Generate new visitor ID
1193
+ state.visitorId = generateId('v_');
1194
+ storage('visitor_id', state.visitorId);
1187
1195
 
1196
+ // Clear UI
1188
1197
  if (elements.messages) {
1189
1198
  elements.messages.innerHTML = '';
1190
1199
  }
1191
1200
 
1201
+ // Hide status bar
1202
+ updateStatusBar('hidden');
1203
+
1204
+ // Stop any live agent polling
1205
+ stopLiveAgentPolling();
1206
+
1207
+ // Reconnect WebSocket with new visitor ID (no session_id)
1208
+ if (ws) {
1209
+ ws.close();
1210
+ ws = null;
1211
+ }
1212
+ connectWebSocket();
1213
+
1214
+ // Show welcome message
1192
1215
  if (config.welcomeMessage) {
1193
1216
  addMessage(config.welcomeMessage, 'bot');
1194
1217
  }
1218
+
1219
+ emit('newConversation');
1195
1220
  }
1196
1221
 
1197
1222
  /**