impact-chatbot 2.3.87 → 2.3.89

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.esm.js CHANGED
@@ -85,6 +85,18 @@ const getAgentVisibilityData = () => {
85
85
  console.error("getSmartBotVisibilityData error", error);
86
86
  }
87
87
  };
88
+ const getHideNavbotData = async (applicationCode) => {
89
+ try {
90
+ let { data } = await tenantConfigApiCache(applicationCode, {
91
+ attribute_name: "hide_navbot",
92
+ })();
93
+ return data?.data?.[0]?.attribute_value?.value;
94
+ }
95
+ catch (error) {
96
+ console.error("getHideNavbotData error", error);
97
+ return false;
98
+ }
99
+ };
88
100
  const getAgentExceptionUserList = (applicationCode) => {
89
101
  try {
90
102
  return tenantConfigApiCache(applicationCode, {
@@ -530,6 +542,26 @@ const parseResponse = (data, type, agentId = "", currentMode = "", disableTimeAn
530
542
  paramName: data?.data?.param_name
531
543
  }
532
544
  };
545
+ case "checkboxGroup":
546
+ return {
547
+ ...data,
548
+ timeStamp: timeString,
549
+ userType: "bot",
550
+ userName: userName,
551
+ headerTitle: data?.data?.label || "",
552
+ bodyType: "checkboxGroup",
553
+ bodyText: {
554
+ label: data?.data?.label,
555
+ orientation: data?.data?.orientation,
556
+ options: data?.data?.options,
557
+ defaultSelected: data?.data?.defaultSelected,
558
+ minOptions: data?.data?.minOptions,
559
+ maxOptions: data?.data?.maxOptions,
560
+ isRequired: data?.data?.isRequired,
561
+ isDisabled: data?.data?.isDisabled,
562
+ paramName: data?.data?.param_name
563
+ }
564
+ };
533
565
  case "button":
534
566
  return {
535
567
  ...data,
@@ -1132,13 +1164,6 @@ const resolveInternalPath = (href) => {
1132
1164
  return null;
1133
1165
  }
1134
1166
  };
1135
- /**
1136
- * Minimizes the chat window so the user can see the screen they navigated to.
1137
- * SmartBot (index.tsx) listens for this event and sets partialClose.
1138
- */
1139
- const minimizeChatBot = () => {
1140
- window.dispatchEvent(new CustomEvent("smartBotMinimize"));
1141
- };
1142
1167
  /**
1143
1168
  * Anchor rendered inside chatbot markdown. Internal links are navigated through
1144
1169
  * react-router so the chatbot is not remounted by a full page load.
@@ -1157,7 +1182,6 @@ const MarkdownLink = ({ href, children, ...props }) => {
1157
1182
  if (currentPath !== internalPath) {
1158
1183
  navigate(internalPath);
1159
1184
  }
1160
- minimizeChatBot();
1161
1185
  };
1162
1186
  return (jsx("a", { href: href, target: "_self", onClick: handleClick, ...props, children: children }));
1163
1187
  };
@@ -1260,7 +1284,6 @@ const TextRenderer = ({ text, thinking }) => {
1260
1284
  if (currentPath !== internalPath) {
1261
1285
  navigate(internalPath);
1262
1286
  }
1263
- minimizeChatBot();
1264
1287
  };
1265
1288
  // If the input contains rich HTML, render it directly with DOMPurify sanitization
1266
1289
  if (containsRichHtml(text)) {
@@ -7444,6 +7467,61 @@ const CheckboxContent = ({ bodyText, isFormDisabled = false, messageIndex }) =>
7444
7467
  return (jsx("div", { style: { width: '100%', marginTop: '10px' }, children: jsx(Checkbox, { label: label, checked: checked, required: required, disabled: disabled || isFormDisabled, onChange: (e) => handleChange(e), variant: "default" }) }));
7445
7468
  };
7446
7469
 
7470
+ const CheckboxGroupContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
7471
+ const formKey = `${messageIndex}_${bodyText?.paramName}`;
7472
+ const classes = useStyles$a();
7473
+ const { label, orientation, options = [], defaultSelected, minOptions, maxOptions, isRequired, isDisabled, } = bodyText || {};
7474
+ const min = minOptions ?? 1;
7475
+ const max = maxOptions ?? options.length;
7476
+ const chatbotContext = useSelector((state) => state.smartBotReducer.chatbotContext);
7477
+ const chatbotContextRef = useRef(chatbotContext);
7478
+ chatbotContextRef.current = chatbotContext;
7479
+ const persistedFormValues = useSelector((state) => state.smartBotReducer.persistedFormValues);
7480
+ const dispatch = useDispatch();
7481
+ const [selected, setSelected] = useState(() => {
7482
+ const persisted = persistedFormValues?.[formKey];
7483
+ if (Array.isArray(persisted))
7484
+ return persisted;
7485
+ return Array.isArray(defaultSelected) ? defaultSelected : [];
7486
+ });
7487
+ if (isEmpty$1(bodyText))
7488
+ return null;
7489
+ const groupDisabled = isDisabled || isFormDisabled;
7490
+ const dispatchSelection = (newValues) => {
7491
+ const latestContext = chatbotContextRef.current;
7492
+ dispatch(setChatbotContext({
7493
+ ...latestContext,
7494
+ [bodyText?.paramName]: {
7495
+ ...latestContext?.[bodyText?.paramName],
7496
+ [bodyText?.paramName]: newValues,
7497
+ updated: true,
7498
+ },
7499
+ }));
7500
+ dispatch(setPersistedFormValues({ [formKey]: newValues }));
7501
+ };
7502
+ const handleChange = (optionValue, isChecked) => {
7503
+ try {
7504
+ const newValues = isChecked
7505
+ ? [...selected, optionValue]
7506
+ : selected.filter((val) => val !== optionValue);
7507
+ setSelected(newValues);
7508
+ dispatchSelection(newValues);
7509
+ }
7510
+ catch (error) {
7511
+ console.error("Error in checkboxGroup handleChange", error);
7512
+ }
7513
+ };
7514
+ const isRow = orientation === "row";
7515
+ const overMax = selected.length > max;
7516
+ const belowMin = isRequired && selected.length < min;
7517
+ return (jsxs("div", { style: { width: "100%", marginTop: "10px" }, children: [label && (jsxs("p", { className: classes.radioGrpLabel, children: [label, isRequired ? " *" : ""] })), jsx("div", { style: {
7518
+ display: "flex",
7519
+ flexDirection: isRow ? "row" : "column",
7520
+ flexWrap: isRow ? "wrap" : "nowrap",
7521
+ gap: isRow ? "16px" : "8px",
7522
+ }, children: options.map((option) => (jsx(Checkbox, { label: option.label, checked: selected.includes(option.value), disabled: option.disabled || groupDisabled, onChange: (e) => handleChange(option.value, e?.currentTarget?.checked), variant: "default" }, option.value))) }), overMax && (jsx("p", { className: classes.radioGrpLabel, style: { margin: "8px 0 0 0", color: "red" }, children: `Select at most ${max} option${max > 1 ? "s" : ""}` })), !overMax && belowMin && (jsx("p", { className: classes.radioGrpLabel, style: { margin: "8px 0 0 0", color: "red" }, children: `Select at least ${min} option${min > 1 ? "s" : ""}` }))] }));
7523
+ };
7524
+
7447
7525
  const RadioContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
7448
7526
  const formKey = `${messageIndex}_${bodyText?.paramName}`;
7449
7527
  const classes = useStyles$a();
@@ -7727,6 +7805,38 @@ const StepFormContent = ({ formData, messageIndex = 0, isFormDisabled = false, s
7727
7805
  return false;
7728
7806
  });
7729
7807
  }, [formData, chatbotContext, persistedFormValues, messageIndex]);
7808
+ // Validate checkboxGroup fields against their minOptions/maxOptions bounds.
7809
+ // A required group must have selectedCount within [min, max]; any group (even
7810
+ // non-required) must not exceed max. Blocks submit when out of bounds.
7811
+ const checkboxGroupsValid = useMemo(() => {
7812
+ if (!formData || !Array.isArray(formData))
7813
+ return true;
7814
+ const groups = formData.filter((item) => item?.type === "checkboxGroup");
7815
+ return groups.every((item) => {
7816
+ const data = item.data || {};
7817
+ const param = data.param_name;
7818
+ const options = data.options || [];
7819
+ const min = data.minOptions ?? 1;
7820
+ const max = data.maxOptions ?? options.length;
7821
+ // Resolve current selection: chatbotContext first, then persistedFormValues
7822
+ let selectedValues = [];
7823
+ const ctx = chatbotContext?.[param];
7824
+ if (ctx && ctx.updated && Array.isArray(ctx[param])) {
7825
+ selectedValues = ctx[param];
7826
+ }
7827
+ else {
7828
+ const persisted = persistedFormValues?.[`${messageIndex}_${param}`];
7829
+ if (Array.isArray(persisted))
7830
+ selectedValues = persisted;
7831
+ }
7832
+ const count = selectedValues.length;
7833
+ if (count > max)
7834
+ return false;
7835
+ if (data.isRequired && count < min)
7836
+ return false;
7837
+ return true;
7838
+ });
7839
+ }, [formData, chatbotContext, persistedFormValues, messageIndex]);
7730
7840
  // Extract select-type filter configs from formData for cross-filter cascading
7731
7841
  // and sort them based on the filters_hierarchy_order from tenant config
7732
7842
  const crossFilterConfigs = useMemo(() => {
@@ -7835,10 +7945,12 @@ const StepFormContent = ({ formData, messageIndex = 0, isFormDisabled = false, s
7835
7945
  return jsx(DateRangePickerContent, { bodyText: parsedData.bodyText, isFormDisabled: formFieldsDisabled, messageIndex: messageIndex }, key);
7836
7946
  case "checkbox":
7837
7947
  return jsx(CheckboxContent, { bodyText: parsedData.bodyText, isFormDisabled: formFieldsDisabled, messageIndex: messageIndex }, key);
7948
+ case "checkboxGroup":
7949
+ return jsx(CheckboxGroupContent, { bodyText: parsedData.bodyText, isFormDisabled: formFieldsDisabled, messageIndex: messageIndex }, key);
7838
7950
  case "radio":
7839
7951
  return jsx(RadioContent, { bodyText: parsedData.bodyText, isFormDisabled: formFieldsDisabled, messageIndex: messageIndex }, key);
7840
7952
  case "button":
7841
- return jsx(ButtonContent, { bodyText: parsedData.bodyText, isFormDisabled: isFormDisabled || isFormSubmitted || isTimedOut, isStepFormSubmit: true, isFormValid: requiredFieldsFilled, formParamNames: formParamNames, messageIndex: messageIndex }, key);
7953
+ return jsx(ButtonContent, { bodyText: parsedData.bodyText, isFormDisabled: isFormDisabled || isFormSubmitted || isTimedOut, isStepFormSubmit: true, isFormValid: requiredFieldsFilled && checkboxGroupsValid, formParamNames: formParamNames, messageIndex: messageIndex }, key);
7842
7954
  case "input":
7843
7955
  return jsx(InputContent, { bodyText: parsedData.bodyText, isFormDisabled: formFieldsDisabled, messageIndex: messageIndex }, key);
7844
7956
  case "image":
@@ -8234,7 +8346,7 @@ const getQuestionStatus$1 = (questionSteps) => {
8234
8346
  /**
8235
8347
  * Renders a single progress bar item (main point + sub-items)
8236
8348
  */
8237
- const ProgressBarItem$1 = ({ question, questionSteps, isLast, classes, formData, showSavedFilters = true, preSelectedFilters = null, isFormDisabled, onAllSubItemsAnimated = undefined, botProps = null, currentMode = "", agentId = "", sessionId = "" }) => {
8349
+ const ProgressBarItem$1 = ({ question, questionSteps, isLast, classes, formData, showSavedFilters = true, preSelectedFilters = null, isFormDisabled, onAllSubItemsAnimated = undefined, botProps = null, currentMode = "", agentId = "", sessionId = "", index = 0, chatSessionId = "" }) => {
8238
8350
  const status = getQuestionStatus$1(questionSteps);
8239
8351
  const animatedCountRef = useRef(0);
8240
8352
  const [isExpanded, setIsExpanded] = useState(true);
@@ -8268,9 +8380,9 @@ const ProgressBarItem$1 = ({ question, questionSteps, isLast, classes, formData,
8268
8380
  if (animatedCountRef.current >= arr.length && onAllSubItemsAnimated) {
8269
8381
  onAllSubItemsAnimated();
8270
8382
  }
8271
- } }) }, idx))) })), formData && isExpanded && (jsx("div", { className: classes.stepFormContainer, children: jsx(StepFormContent, { formData: formData, isFormDisabled: isFormDisabled, showSavedFilters: showSavedFilters, preSelectedFilters: preSelectedFilters, botProps: botProps, currentMode: currentMode, agentId: agentId, sessionId: sessionId }) }))] })] }));
8383
+ } }) }, idx))) })), formData && isExpanded && (jsx("div", { className: classes.stepFormContainer, children: jsx(StepFormContent, { formData: formData, isFormDisabled: isFormDisabled, showSavedFilters: showSavedFilters, preSelectedFilters: preSelectedFilters, botProps: botProps, currentMode: currentMode, agentId: agentId, sessionId: sessionId, messageIndex: `${String(chatSessionId)}_${index}` }) }))] })] }));
8272
8384
  };
8273
- const Steps$1 = ({ steps, setSteps, done, setTabValue, setDone, finalStepDone, setFinalStepDone, stepChange, currentMode, questions = [], questionsStepsMap = {}, stepFormDataMap = {}, isFormDisabled = false, botProps = null, agentId = "", sessionId = "", }) => {
8385
+ const Steps$1 = ({ steps, setSteps, done, setTabValue, setDone, finalStepDone, setFinalStepDone, stepChange, currentMode, questions = [], questionsStepsMap = {}, stepFormDataMap = {}, isFormDisabled = false, botProps = null, agentId = "", sessionId = "", chatSessionId = "", }) => {
8274
8386
  const classes = useStyles$4();
8275
8387
  useState(false);
8276
8388
  const [showThinking, setShowThinking] = useState(false);
@@ -8353,7 +8465,7 @@ const Steps$1 = ({ steps, setSteps, done, setTabValue, setDone, finalStepDone, s
8353
8465
  const showSavedFilters = formEntry && !Array.isArray(formEntry) ? formEntry.showSavedFilters : true;
8354
8466
  const preSelectedFilters = formEntry && !Array.isArray(formEntry) ? formEntry.preSelectedFilters : null;
8355
8467
  const isLast = index === questions.length - 1;
8356
- return (jsx(ProgressBarItem$1, { question: question, questionSteps: questionSteps, isLast: isLast && !showThinking, classes: classes, formData: formData, isFormDisabled: isFormDisabled, showSavedFilters: showSavedFilters, preSelectedFilters: preSelectedFilters, botProps: botProps, currentMode: currentMode, agentId: agentId, sessionId: sessionId, onAllSubItemsAnimated: isLast && lastQuestionCompleted && !done
8468
+ return (jsx(ProgressBarItem$1, { question: question, questionSteps: questionSteps, isLast: isLast && !showThinking, classes: classes, formData: formData, isFormDisabled: isFormDisabled, showSavedFilters: showSavedFilters, preSelectedFilters: preSelectedFilters, botProps: botProps, currentMode: currentMode, agentId: agentId, sessionId: sessionId, index: index, chatSessionId: chatSessionId, onAllSubItemsAnimated: isLast && lastQuestionCompleted && !done
8357
8469
  ? () => setShowThinking(true)
8358
8470
  : undefined }, index));
8359
8471
  }), showThinking && !done && (jsx("div", { style: {
@@ -8381,6 +8493,8 @@ const renderWidgetItem = (item, index, isFormDisabled) => {
8381
8493
  return jsx(RadioContent, { bodyText: parsedData.bodyText, isFormDisabled: isFormDisabled }, key);
8382
8494
  case "checkbox":
8383
8495
  return jsx(CheckboxContent, { bodyText: parsedData.bodyText, isFormDisabled: isFormDisabled }, key);
8496
+ case "checkboxGroup":
8497
+ return jsx(CheckboxGroupContent, { bodyText: parsedData.bodyText, isFormDisabled: isFormDisabled }, key);
8384
8498
  case "select":
8385
8499
  return jsx(SelectContent, { bodyText: parsedData.bodyText, isFormDisabled: isFormDisabled }, key);
8386
8500
  case "slider":
@@ -8415,7 +8529,7 @@ const AgentResponse$1 = (props) => {
8415
8529
  };
8416
8530
 
8417
8531
  const StepsResponseTab = (props) => {
8418
- const { steps, setSteps, stepsDone, setStepsDone, finalStepDone, setFinalStepDone, content, isStreaming, stepChange, currentMode, questions, questionsStepsMap, stepFormDataMap, isFormDisabled, streamingWidgetData, isRetrying, botProps, agentId, sessionId, } = props;
8532
+ const { steps, setSteps, stepsDone, setStepsDone, finalStepDone, setFinalStepDone, content, isStreaming, stepChange, currentMode, questions, questionsStepsMap, stepFormDataMap, isFormDisabled, streamingWidgetData, isRetrying, botProps, agentId, sessionId, chatSessionId, } = props;
8419
8533
  const dispatch = useDispatch();
8420
8534
  const thinkingContext = useSelector((state) => state.smartBotReducer.thinkingContext);
8421
8535
  const streamStartTimeRef = useRef(thinkingContext?.streamStartTime);
@@ -8479,7 +8593,7 @@ const StepsResponseTab = (props) => {
8479
8593
  icon: jsx(PsychologyOutlinedIcon, { fontSize: "large" }),
8480
8594
  },
8481
8595
  ], tabPanels: [
8482
- jsx(Steps$1, { steps: steps, setSteps: setSteps, done: stepsDone, setDone: setStepsDone, setTabValue: setTabValue, finalStepDone: finalStepDone, setFinalStepDone: setFinalStepDone, stepChange: stepChange, currentMode: currentMode, questions: questions, questionsStepsMap: questionsStepsMap, stepFormDataMap: stepFormDataMap, isFormDisabled: isFormDisabled || isTimedOut, botProps: botProps, agentId: agentId, sessionId: sessionId }),
8596
+ jsx(Steps$1, { steps: steps, setSteps: setSteps, done: stepsDone, setDone: setStepsDone, setTabValue: setTabValue, finalStepDone: finalStepDone, setFinalStepDone: setFinalStepDone, stepChange: stepChange, currentMode: currentMode, questions: questions, questionsStepsMap: questionsStepsMap, stepFormDataMap: stepFormDataMap, isFormDisabled: isFormDisabled || isTimedOut, botProps: botProps, agentId: agentId, sessionId: sessionId, chatSessionId: chatSessionId }),
8483
8597
  jsxs(Fragment, { children: [jsx(AgentResponse$1, { content: content, isStreaming: isStreaming, streamingWidgetData: streamingWidgetData, isFormDisabled: isFormDisabled || isTimedOut }), timeoutMessage && (jsx("div", { style: { marginTop: "8px", padding: "0 8px" }, children: jsx(TextRenderer, { text: timeoutMessage, thinking: "" }) }))] }),
8484
8598
  ], value: tabValue }) }));
8485
8599
  };
@@ -10051,7 +10165,7 @@ const StreamedContent = ({ botData, botProps }) => {
10051
10165
  * @returns {JSX.Element} Rendered content with optional blinking cursor
10052
10166
  */
10053
10167
  const renderContent = () => {
10054
- return (jsxs("div", { className: classes.streamContainer, children: [jsx(StepsResponseTab, { steps: steps, stepChange: stepChange, setSteps: setSteps, stepsDone: stepsDone, setStepsDone: setStepsDone, finalStepDone: finalStepDone, setFinalStepDone: setFinalStepDone, content: content, isStreaming: isStreaming, currentMode: currentMode, questions: questions, questionsStepsMap: questionsStepsMap, stepFormDataMap: stepFormDataMap, isFormDisabled: botData?.isFormDisabled || false, streamingWidgetData: streamingWidgetData, isRetrying: isRetrying, botProps: botProps, agentId: botData?.inputBody?.agent_id || "", sessionId: messageToStoreRef.current?.sessionId || "" }), isRetrying && (jsx("div", { className: classes.retryContainer, children: jsx(TextRenderer, { text: `Auto re-trying in ${retryCountdown}s`, thinking: "" }) }))] }));
10168
+ return (jsxs("div", { className: classes.streamContainer, children: [jsx(StepsResponseTab, { steps: steps, stepChange: stepChange, setSteps: setSteps, stepsDone: stepsDone, setStepsDone: setStepsDone, finalStepDone: finalStepDone, setFinalStepDone: setFinalStepDone, content: content, isStreaming: isStreaming, currentMode: currentMode, questions: questions, questionsStepsMap: questionsStepsMap, stepFormDataMap: stepFormDataMap, isFormDisabled: botData?.isFormDisabled || false, streamingWidgetData: streamingWidgetData, isRetrying: isRetrying, botProps: botProps, agentId: botData?.inputBody?.agent_id || "", sessionId: messageToStoreRef.current?.sessionId || "", chatSessionId: messageToStoreRef.current?.chatSessionId || botData?.chatSessionId || "" }), isRetrying && (jsx("div", { className: classes.retryContainer, children: jsx(TextRenderer, { text: `Auto re-trying in ${retryCountdown}s`, thinking: "" }) }))] }));
10055
10169
  };
10056
10170
  if (currentMode === "agent") {
10057
10171
  return renderContent();
@@ -10247,7 +10361,7 @@ const getQuestionStatus = (questionSteps) => {
10247
10361
  /**
10248
10362
  * Renders a single progress bar item (main point + sub-items)
10249
10363
  */
10250
- const ProgressBarItem = ({ question, questionSteps, isLast, classes, formData, isFormDisabled, isRestreaming = false, showSavedFilters = true, preSelectedFilters = null }) => {
10364
+ const ProgressBarItem = ({ question, questionSteps, isLast, classes, formData, isFormDisabled, isRestreaming = false, showSavedFilters = true, preSelectedFilters = null, sessionId = "", index = 0, chatSessionId = "" }) => {
10251
10365
  const baseStatus = getQuestionStatus(questionSteps);
10252
10366
  // When restreaming and this is the last item, show as in-progress
10253
10367
  const status = (isRestreaming && isLast) ? "in-progress" : baseStatus;
@@ -10277,9 +10391,9 @@ const ProgressBarItem = ({ question, questionSteps, isLast, classes, formData, i
10277
10391
  setIsExpanded(true);
10278
10392
  }
10279
10393
  }, [status, formData]);
10280
- return (jsxs("div", { className: classes.progressItem, children: [jsxs("div", { className: classes.progressTrack, children: [jsx("div", { className: `${classes.progressDot} ${dotClass}` }), !isLast && jsx("div", { className: `${classes.progressLine} ${lineClass}` })] }), jsxs("div", { className: classes.progressContent, children: [jsxs("div", { className: classes.progressHeader, onClick: handleToggle, children: [jsx("span", { className: `${classes.progressHeaderText} ${textClass}`, children: question }), hasSubItems && (jsx(ChevronRightIcon$1, { className: `${classes.progressChevron} ${textClass} ${isExpanded ? "expanded" : ""}` }))] }), hasSubItems && isExpanded && status === "in-progress" && (jsxs("div", { className: classes.reasoningLabel, children: [jsx(SvgReasoningIcon, {}), "Working on the next step..."] })), hasSubItems && isExpanded && !isProcessingRequest && (jsx("div", { className: classes.progressSubItems, style: { maxHeight: isExpanded ? "500px" : "0", opacity: isExpanded ? 1 : 0 }, children: questionSteps.map((step, idx) => (jsx("div", { className: classes.progressSubItem, children: jsx(SubStepRenderer, { text: `${step.header}${step.sub_header ? ` - ${step.sub_header}` : ""}` }) }, idx))) })), formData && isExpanded && (jsx("div", { className: classes.stepFormContainer, children: jsx(StepFormContent, { formData: formData, isFormDisabled: isFormDisabled, showSavedFilters: showSavedFilters, preSelectedFilters: preSelectedFilters }) }))] })] }));
10394
+ return (jsxs("div", { className: classes.progressItem, children: [jsxs("div", { className: classes.progressTrack, children: [jsx("div", { className: `${classes.progressDot} ${dotClass}` }), !isLast && jsx("div", { className: `${classes.progressLine} ${lineClass}` })] }), jsxs("div", { className: classes.progressContent, children: [jsxs("div", { className: classes.progressHeader, onClick: handleToggle, children: [jsx("span", { className: `${classes.progressHeaderText} ${textClass}`, children: question }), hasSubItems && (jsx(ChevronRightIcon$1, { className: `${classes.progressChevron} ${textClass} ${isExpanded ? "expanded" : ""}` }))] }), hasSubItems && isExpanded && status === "in-progress" && (jsxs("div", { className: classes.reasoningLabel, children: [jsx(SvgReasoningIcon, {}), "Working on the next step..."] })), hasSubItems && isExpanded && !isProcessingRequest && (jsx("div", { className: classes.progressSubItems, style: { maxHeight: isExpanded ? "500px" : "0", opacity: isExpanded ? 1 : 0 }, children: questionSteps.map((step, idx) => (jsx("div", { className: classes.progressSubItem, children: jsx(SubStepRenderer, { text: `${step.header}${step.sub_header ? ` - ${step.sub_header}` : ""}` }) }, idx))) })), formData && isExpanded && (jsx("div", { className: classes.stepFormContainer, children: jsx(StepFormContent, { formData: formData, isFormDisabled: isFormDisabled, showSavedFilters: showSavedFilters, preSelectedFilters: preSelectedFilters, messageIndex: `${String(chatSessionId)}_${index}` }) }))] })] }));
10281
10395
  };
10282
- const Steps = ({ steps, questions = [], questionsStepsMap = {}, stepFormDataMap = {}, isFormDisabled = false, activeFormIntent = null, isRestreaming = false }) => {
10396
+ const Steps = ({ steps, questions = [], questionsStepsMap = {}, stepFormDataMap = {}, isFormDisabled = false, activeFormIntent = null, isRestreaming = false, sessionId = "", chatSessionId = "" }) => {
10283
10397
  const classes = useStyles$3();
10284
10398
  useState(false);
10285
10399
  const hasQuestions = questions.length > 0;
@@ -10308,7 +10422,7 @@ const Steps = ({ steps, questions = [], questionsStepsMap = {}, stepFormDataMap
10308
10422
  const formDisabledForThis = activeFormIntent
10309
10423
  ? question !== activeFormIntent
10310
10424
  : isFormDisabled;
10311
- return (jsx(ProgressBarItem, { question: question, questionSteps: questionSteps, isLast: index === questions.length - 1, classes: classes, formData: formData, isFormDisabled: formDisabledForThis, isRestreaming: isRestreaming, showSavedFilters: showSavedFilters, preSelectedFilters: preSelectedFilters }, index));
10425
+ return (jsx(ProgressBarItem, { question: question, questionSteps: questionSteps, isLast: index === questions.length - 1, classes: classes, formData: formData, isFormDisabled: formDisabledForThis, isRestreaming: isRestreaming, showSavedFilters: showSavedFilters, preSelectedFilters: preSelectedFilters, sessionId: sessionId, index: index, chatSessionId: chatSessionId }, index));
10312
10426
  }) }));
10313
10427
  };
10314
10428
 
@@ -10321,7 +10435,7 @@ const AgentResponse = ({ children }) => {
10321
10435
  // Only the active instance should process stepFormStreamData from Redux.
10322
10436
  let instanceCounter = 0;
10323
10437
  let activeTabularInstanceId = null;
10324
- const TabularContent = ({ steps: initialSteps, currentTabValue, children, questions: initialQuestions = [], questionsStepsMap: initialQuestionsStepsMap = {}, stepFormDataMap: initialStepFormDataMap = {}, isFormDisabled = false, sessionId: propSessionId = "", botProps = null, currentMode = "", agentId = "" }) => {
10438
+ const TabularContent = ({ steps: initialSteps, currentTabValue, children, questions: initialQuestions = [], questionsStepsMap: initialQuestionsStepsMap = {}, stepFormDataMap: initialStepFormDataMap = {}, isFormDisabled = false, sessionId: propSessionId = "", chatSessionId = "", botProps = null, currentMode = "", agentId = "" }) => {
10325
10439
  const dispatch = useDispatch();
10326
10440
  const stepFormStreamData = useSelector((state) => state.smartBotReducer.stepFormStreamData);
10327
10441
  const thinkingContext = useSelector((state) => state.smartBotReducer.thinkingContext);
@@ -10802,7 +10916,7 @@ const TabularContent = ({ steps: initialSteps, currentTabValue, children, questi
10802
10916
  icon: jsx(PsychologyOutlinedIcon, { fontSize: "large" }),
10803
10917
  },
10804
10918
  ], tabPanels: [
10805
- jsx(Steps, { steps: stepsState, questions: questionsState, questionsStepsMap: questionsStepsMapState, stepFormDataMap: stepFormDataMapState, isFormDisabled: (isFormDisabled && !isRestreaming) || stepFormSubmitted || isTimedOut, activeFormIntent: hasNewStepFormFromRestream ? activeFormIntent : null, isRestreaming: isRestreaming }),
10919
+ jsx(Steps, { steps: stepsState, questions: questionsState, questionsStepsMap: questionsStepsMapState, stepFormDataMap: stepFormDataMapState, isFormDisabled: (isFormDisabled && !isRestreaming) || stepFormSubmitted || isTimedOut, activeFormIntent: hasNewStepFormFromRestream ? activeFormIntent : null, isRestreaming: isRestreaming, sessionId: propSessionId, chatSessionId: chatSessionId, agentId: agentId }),
10806
10920
  jsxs(AgentResponse, { children: [children, renderedWidgets.length > 0 && (jsx("div", { className: "restream-widget-content", children: renderedWidgets })), retryCountdown > 0 && (jsx("div", { style: { marginTop: "8px" }, children: jsx(TextRenderer, { text: `Auto re-trying in ${retryCountdown}s`, thinking: "" }) })), timeoutMessage && (jsx("div", { style: { marginTop: "8px" }, children: jsx(TextRenderer, { text: timeoutMessage, thinking: "" }) }))] }),
10807
10921
  ], value: tabValue }) }));
10808
10922
  };
@@ -10845,6 +10959,8 @@ const CombinedContent = ({ botData, props }) => {
10845
10959
  return jsx(DateRangePickerContent, { bodyText: parsedData.bodyText, isFormDisabled: isFormDisabled, messageIndex: botData.messageIndex }, key);
10846
10960
  case "checkbox":
10847
10961
  return jsx(CheckboxContent, { bodyText: parsedData.bodyText, isFormDisabled: isFormDisabled, messageIndex: botData.messageIndex }, key);
10962
+ case "checkboxGroup":
10963
+ return jsx(CheckboxGroupContent, { bodyText: parsedData.bodyText, isFormDisabled: isFormDisabled, messageIndex: botData.messageIndex }, key);
10848
10964
  case "radio":
10849
10965
  return jsx(RadioContent, { bodyText: parsedData.bodyText, isFormDisabled: isFormDisabled, messageIndex: botData.messageIndex }, key);
10850
10966
  case "button":
@@ -10880,7 +10996,7 @@ const CombinedContent = ({ botData, props }) => {
10880
10996
  const validContent = renderedContent.filter(content => content !== null);
10881
10997
  const renderCombinedContent = () => (jsx("div", { className: "combined-content-container", children: validContent.length > 0 ? (validContent.map((content, index) => (jsx("div", { className: "combined-content-item", children: content }, `wrapper-${index}`)))) : (jsx("div", { children: "No valid content to display" })) }));
10882
10998
  if (isTabEnabled) {
10883
- return (jsx(TabularContent, { steps: botData?.utilityData?.steps || [], currentTabValue: botData?.utilityData?.currentTabValue || "steps", questions: botData?.utilityData?.questions || [], questionsStepsMap: botData?.utilityData?.questionsStepsMap || {}, stepFormDataMap: botData?.utilityData?.stepFormDataMap || {}, isFormDisabled: isFormDisabled, sessionId: botData?.sessionId || "", botProps: props, currentMode: botData?.currentMode || "", agentId: botData?.agentId || "", children: renderCombinedContent() }));
10999
+ return (jsx(TabularContent, { steps: botData?.utilityData?.steps || [], currentTabValue: botData?.utilityData?.currentTabValue || "steps", questions: botData?.utilityData?.questions || [], questionsStepsMap: botData?.utilityData?.questionsStepsMap || {}, stepFormDataMap: botData?.utilityData?.stepFormDataMap || {}, isFormDisabled: isFormDisabled, sessionId: botData?.sessionId || "", chatSessionId: botData?.chatSessionId || "", botProps: props, currentMode: botData?.currentMode || "", agentId: botData?.agentId || "", children: renderCombinedContent() }));
10884
11000
  }
10885
11001
  return renderCombinedContent();
10886
11002
  };
@@ -10943,6 +11059,8 @@ const BotMessage = ({ botData, state, handleLikeDislike, props }) => {
10943
11059
  return jsx(DateRangePickerContent, { bodyText: botData.bodyText, isFormDisabled: botData.isFormDisabled, messageIndex: botData.messageIndex });
10944
11060
  case "checkbox":
10945
11061
  return jsx(CheckboxContent, { bodyText: botData.bodyText, isFormDisabled: botData.isFormDisabled, messageIndex: botData.messageIndex });
11062
+ case "checkboxGroup":
11063
+ return jsx(CheckboxGroupContent, { bodyText: botData.bodyText, isFormDisabled: botData.isFormDisabled, messageIndex: botData.messageIndex });
10946
11064
  case "radio":
10947
11065
  return jsx(RadioContent, { bodyText: botData.bodyText, isFormDisabled: botData.isFormDisabled, messageIndex: botData.messageIndex });
10948
11066
  case "button":
@@ -15282,9 +15400,11 @@ const SmartBot = (props) => {
15282
15400
  skipHierarchyCall: true,
15283
15401
  })();
15284
15402
  let showAgentIcon = await getAgentVisibilityData();
15403
+ let appCode = getApplicationCodeFromURL(applicationName);
15404
+ let hideNavbot = await getHideNavbotData(appCode);
15405
+ const filterNavigationTab = (tabs) => hideNavbot ? tabs.filter((tab) => tab.name !== "Navigation") : tabs;
15285
15406
  if (!isEmpty$1(accessDataResponse) &&
15286
15407
  showAgentIcon?.data?.data[0]?.attribute_value?.value) {
15287
- let appCode = getApplicationCodeFromURL(applicationName);
15288
15408
  let list = await getAgentExceptionUserList(appCode);
15289
15409
  let isWhitelisted = false;
15290
15410
  if (list?.data?.data[0]?.attribute_value?.allow_all) {
@@ -15496,7 +15616,7 @@ const SmartBot = (props) => {
15496
15616
  icon: jsx(SvgNavigationIcon, {}),
15497
15617
  }
15498
15618
  ];
15499
- setTabList(tabListData);
15619
+ setTabList(filterNavigationTab(tabListData));
15500
15620
  }
15501
15621
  else {
15502
15622
  setCurrentMode("navigation");
@@ -16076,10 +16196,50 @@ const SmartBot = (props) => {
16076
16196
  }
16077
16197
  fetchConversations(null, "agent");
16078
16198
  }, [renameConversation, deleteConversation, fetchConversations]);
16199
+ // Ref to the SmartBot wrapper so we can scope outside-click detection and the
16200
+ // collapse-button query to this (local) chatbot instance only.
16201
+ const smartBotWrapperRef = useRef(null);
16202
+ // Collapse the expanded/docked chatbot into the small draggable panel by
16203
+ // triggering impact-ui's header "Collapse chatbot" control. That button is
16204
+ // only present while expanded (its label becomes "Expand chatbot" once
16205
+ // collapsed), so this is a safe no-op when already collapsed.
16206
+ const collapseChatBotIfExpanded = useCallback(() => {
16207
+ const root = smartBotWrapperRef.current;
16208
+ if (!root)
16209
+ return;
16210
+ const collapseBtn = root.querySelector('button[aria-label="Collapse chatbot"]');
16211
+ if (collapseBtn)
16212
+ collapseBtn.click();
16213
+ }, []);
16214
+ // Auto-collapse to draggable mode when the user interacts outside the bot.
16215
+ useEffect(() => {
16216
+ const handleOutsideInteraction = (e) => {
16217
+ const root = smartBotWrapperRef.current;
16218
+ if (!root)
16219
+ return;
16220
+ if (root.contains(e.target))
16221
+ return; // interaction inside the bot → ignore
16222
+ collapseChatBotIfExpanded();
16223
+ };
16224
+ document.addEventListener("mousedown", handleOutsideInteraction, true);
16225
+ return () => {
16226
+ document.removeEventListener("mousedown", handleOutsideInteraction, true);
16227
+ };
16228
+ }, [collapseChatBotIfExpanded]);
16229
+ // Auto-collapse on route changes (skip the initial mount so freshly opening
16230
+ // the bot doesn't immediately collapse it).
16231
+ const hasMountedForCollapseRef = useRef(false);
16232
+ useEffect(() => {
16233
+ if (!hasMountedForCollapseRef.current) {
16234
+ hasMountedForCollapseRef.current = true;
16235
+ return;
16236
+ }
16237
+ collapseChatBotIfExpanded();
16238
+ }, [location.pathname, collapseChatBotIfExpanded]);
16079
16239
  return (jsxs(Fragment, { children: [partialClose && (minimizedStreamData?.isStreaming || minimizedStreamData?.stepStatus === "step_form") && (jsx(MinimizedChatWidget, { onExpand: () => {
16080
16240
  setShowModal(true);
16081
16241
  setPartialClose(false);
16082
- } })), jsxs("div", { className: `${classes.agentStyleOverride} ${partialClose ? classes.hideBotStyle : ""} `, children: [jsx(MemoryModal, { isModalOpen: isModalOpen, setIsModalOpen: setIsModalOpen, displaySnackMessages: displaySnackMessages }), jsx(UploadModal, { isUploadModalOpen: isUploadModalOpen, setIsUploadModalOpen: setIsUploadModalOpen, displaySnackMessages: displaySnackMessages }), jsx(ChatBotComponent, { isFullWidth: forceOpen, userName: userName, showHistoryPanel: false, customInputComponent: currentMode === "agent" && !showSavedFilters ? (jsx(ChatbotInput, { newChatScreen: newChatScreen, inputValue: userInput, setInputValue: setUserInput, isStopIcon: isStop, onSendIconClick: onSendIconClick, onStopIconClick: onStopIconClick, currentMode: currentMode, filterOptions: filterOptions,
16242
+ } })), jsxs("div", { ref: smartBotWrapperRef, className: `${classes.agentStyleOverride} ${partialClose ? classes.hideBotStyle : ""} `, children: [jsx(MemoryModal, { isModalOpen: isModalOpen, setIsModalOpen: setIsModalOpen, displaySnackMessages: displaySnackMessages }), jsx(UploadModal, { isUploadModalOpen: isUploadModalOpen, setIsUploadModalOpen: setIsUploadModalOpen, displaySnackMessages: displaySnackMessages }), jsx(ChatBotComponent, { isFullWidth: forceOpen, userName: userName, showHistoryPanel: false, customInputComponent: currentMode === "agent" && !showSavedFilters ? (jsx(ChatbotInput, { newChatScreen: newChatScreen, inputValue: userInput, setInputValue: setUserInput, isStopIcon: isStop, onSendIconClick: onSendIconClick, onStopIconClick: onStopIconClick, currentMode: currentMode, filterOptions: filterOptions,
16083
16243
  // onSaveClick={saveCurrentChat}
16084
16244
  savedFilterSets: savedFilterSets, selectedFilterSet: selectedFilterSet, onFilterSetSelect: (filterSet) => setSelectedFilterSet(filterSet), onClearFilterSet: () => setSelectedFilterSet(null), onTriggerRefresh: triggerRefreshAction, answerMode: answerMode, setAnswerMode: setAnswerMode })) : showSavedFilters ? jsx(Fragment, {}) : null, isChatBotOpen: showModal || forceOpen, historyPanelData: historyPanelData, onHistorySearchChange: (params) => { console.log("History Search Change", params); }, onHistorySelectConversation: (params) => {
16085
16245
  console.log("History Select Conversation", params);