wealth-alpha-chat-widget 2.1.5 → 2.1.6

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/dist/index.mjs CHANGED
@@ -1410,6 +1410,13 @@ function WealthChat(props) {
1410
1410
  planRef.current = { known: true, plan: user.plan };
1411
1411
  if (!prev.known || prev.plan === user.plan) return;
1412
1412
  if (chatState.messages.length === 0) return;
1413
+ const hasUserActivity = chatState.messages.some((m) => m.role === "user");
1414
+ if (!hasUserActivity) {
1415
+ clearChat();
1416
+ welcomeShownRef.shown = false;
1417
+ setHistory([]);
1418
+ return;
1419
+ }
1413
1420
  deactivatePriorChips();
1414
1421
  appendBotResponse({
1415
1422
  message: user.welcomeMessage ?? buildWelcome(user.name, user.plan),
@@ -1417,7 +1424,16 @@ function WealthChat(props) {
1417
1424
  sessionId: session?.sessionId ?? "",
1418
1425
  endOfFlow: false
1419
1426
  });
1420
- }, [user, chatState.messages.length, deactivatePriorChips, appendBotResponse, session]);
1427
+ }, [
1428
+ user,
1429
+ chatState.messages,
1430
+ clearChat,
1431
+ setHistory,
1432
+ deactivatePriorChips,
1433
+ appendBotResponse,
1434
+ session,
1435
+ welcomeShownRef
1436
+ ]);
1421
1437
  const handleChipClick = useCallback(
1422
1438
  async (chip) => {
1423
1439
  touch();