@eshal-bot/chat-widget 0.1.38 → 0.1.39

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.
@@ -56008,21 +56008,22 @@
56008
56008
  // {category} placeholder is substituted at the call site (no i18n
56009
56009
  // interpolation engine here). Rendered through ReactMarkdown so the
56010
56010
  // **bold** segment comes out bold.
56011
- // Original was
56012
- // "Sure! Here are the main topics under **{category}**. Pick one or
56013
- // type your question below."
56014
- // referring to a tag-chip picker (TagSelectorInline) that's been off
56015
- // since EV-901 (SHOW_TAG_SELECTOR_BAR = false in ChatWindow.jsx).
56016
- // With no tag picker rendered, "Pick one" dangled there was
56017
- // literally nothing to pick. Updated to drop the tag hint and tell
56018
- // the user to ask their question directly; the category filter
56019
- // already constrains RAG to the right corner of the knowledge base.
56020
- // (The widget doesn't currently call this string itself — the
56021
- // mirror in frontend/src/lib/i18n/widgetI18n.js is the active
56022
- // copy used by the Testing Lab + chatbot-preview. Kept in sync
56023
- // here so a future widget-side renderer doesn't ship the stale
56024
- // copy.)
56025
- categoryTopicsHeading: "Sure ask anything about **{category}** and I'll answer using only what's published under that topic.",
56011
+ //
56012
+ // Copy history:
56013
+ // v1 "Sure! Here are the main topics under **{category}**. Pick
56014
+ // one or type your question below." (referenced the
56015
+ // TagSelectorInline tag-chip picker; off since EV-901).
56016
+ // v2 "Sure ask anything about **{category}** and I'll answer
56017
+ // using only what's published under that topic." (after the
56018
+ // tag picker was hidden explained the scoped behaviour).
56019
+ // v3 (current) "Please ask your **{category}** question below."
56020
+ // (user feedback 2026-05-29: shorter + friendlier; category
56021
+ // scope is now implicit from the picker UI affordance).
56022
+ //
56023
+ // Kept in sync with frontend/src/lib/i18n/widgetI18n.js (the active
56024
+ // copy used by the Testing Lab + chatbot-preview) so a future
56025
+ // widget-side renderer doesn't ship a stale string.
56026
+ categoryTopicsHeading: "Please ask your **{category}** question below.",
56026
56027
  // Heading shown above the initial-state quick-questions list, in
56027
56028
  // parallel with the category picker's "Choose a topic to get started:".
56028
56029
  quickQuestionsHeadingLabel: "Or ask a quick question:",
@@ -59383,6 +59384,7 @@
59383
59384
  (activeCategory === null || activeCategory === void 0 ? void 0 : activeCategory.tags) || [];
59384
59385
  const handleSelectCategory = reactExports.useCallback(categoryId => {
59385
59386
  if (!onWidgetFilterChange) return;
59387
+ const prevId = (widgetFilter === null || widgetFilter === void 0 ? void 0 : widgetFilter.category) || null;
59386
59388
  if (!categoryId) {
59387
59389
  onWidgetFilterChange(null);
59388
59390
  return;
@@ -59393,16 +59395,22 @@
59393
59395
  });
59394
59396
  setCategoryPickUserMsgCount(userMessageCount);
59395
59397
 
59396
- // EV-901: single click = single answer. Send the category label
59397
- // as a user inquiry so the bot responds directly, instead of the
59398
- // old two-step flow that synthesized a "here are sub-topics" stub
59399
- // and waited for the user to pick a sub-tag.
59400
- if (onDirectSend) {
59398
+ // Initial-state pick: inject a localized assistant ack bubble
59399
+ // ("Please ask your **{category}** question below.") to mirror
59400
+ // the testing-lab / chatbot-preview behaviour (InlineChat.tsx).
59401
+ // Mid-conversation switches stay silent the top CategoryTabsBar
59402
+ // is enough affordance there. Same-chip re-tap is a no-op too.
59403
+ // Replaces any prior ack bubble so switching categories shows
59404
+ // ONE bubble at a time, not a growing stack.
59405
+ if (!hasUserMessages && categoryId !== prevId && onSynthesizeAssistantMessage) {
59401
59406
  const cat = (filterCategories || []).find(c => c.id === categoryId);
59402
59407
  const label = (cat === null || cat === void 0 ? void 0 : cat.label) || categoryId;
59403
- onDirectSend(label);
59408
+ const heading = t("categoryTopicsHeading").replace("{category}", label);
59409
+ onSynthesizeAssistantMessage(heading, {
59410
+ replaceMarker: "category-intro"
59411
+ });
59404
59412
  }
59405
- }, [onWidgetFilterChange, userMessageCount, filterCategories, onDirectSend]);
59413
+ }, [onWidgetFilterChange, widgetFilter, userMessageCount, filterCategories, hasUserMessages, onSynthesizeAssistantMessage, t]);
59406
59414
  reactExports.useCallback(tag => {
59407
59415
  const categoryId = (widgetFilter === null || widgetFilter === void 0 ? void 0 : widgetFilter.category) || (activeCategory === null || activeCategory === void 0 ? void 0 : activeCategory.id);
59408
59416
  if (categoryId && onWidgetFilterChange) {
@@ -59433,8 +59441,13 @@
59433
59441
 
59434
59442
  // QuickQuestions are hidden when the bottom slot is occupied by the
59435
59443
  // tag selector — the user explicitly asked for tag pills to take the
59436
- // place of QQ on the initial screen.
59437
- const shouldShowQuickQuestions = !hasUserMessages && quickQuestions.length > 0 && quickQuestionsEnabled && !showTagSelector;
59444
+ // place of QQ on the initial screen. Also hidden once a category is
59445
+ // picked in the initial state: the category-intro ack bubble
59446
+ // ("Please ask your X question below.") explicitly cues the user to
59447
+ // type their question, so showing conversation-starter chips
59448
+ // underneath would contradict that affordance — matches the
59449
+ // chatbot-preview behaviour.
59450
+ const shouldShowQuickQuestions = !hasUserMessages && quickQuestions.length > 0 && quickQuestionsEnabled && !showTagSelector && !(widgetFilter !== null && widgetFilter !== void 0 && widgetFilter.category);
59438
59451
  const hasOnboardingQuestions = onboardingQuestions && onboardingQuestions.length > 0;
59439
59452
  const isCsatEnabled = Boolean(csatEnabled);
59440
59453
  const shouldHideResolveForOnboarding = onboardingEnabled && hasOnboardingQuestions && !onboardingCompleted;