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