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.
@@ -0,0 +1,6 @@
1
+ declare const CheckboxGroupContent: ({ bodyText, isFormDisabled, messageIndex }: {
2
+ bodyText: any;
3
+ isFormDisabled?: boolean;
4
+ messageIndex: any;
5
+ }) => import("react/jsx-runtime").JSX.Element;
6
+ export default CheckboxGroupContent;
@@ -1,4 +1,4 @@
1
- declare const Steps: ({ steps, questions, questionsStepsMap, stepFormDataMap, isFormDisabled, activeFormIntent, isRestreaming }: {
1
+ declare const Steps: ({ steps, questions, questionsStepsMap, stepFormDataMap, isFormDisabled, activeFormIntent, isRestreaming, sessionId, chatSessionId }: {
2
2
  steps: any;
3
3
  questions?: any[];
4
4
  questionsStepsMap?: {};
@@ -6,5 +6,7 @@ declare const Steps: ({ steps, questions, questionsStepsMap, stepFormDataMap, is
6
6
  isFormDisabled?: boolean;
7
7
  activeFormIntent?: any;
8
8
  isRestreaming?: boolean;
9
+ sessionId?: string;
10
+ chatSessionId?: string;
9
11
  }) => import("react/jsx-runtime").JSX.Element;
10
12
  export default Steps;
@@ -1,4 +1,4 @@
1
- declare const TabularContent: ({ steps: initialSteps, currentTabValue, children, questions: initialQuestions, questionsStepsMap: initialQuestionsStepsMap, stepFormDataMap: initialStepFormDataMap, isFormDisabled, sessionId: propSessionId, botProps, currentMode, agentId }: {
1
+ declare const TabularContent: ({ steps: initialSteps, currentTabValue, children, questions: initialQuestions, questionsStepsMap: initialQuestionsStepsMap, stepFormDataMap: initialStepFormDataMap, isFormDisabled, sessionId: propSessionId, chatSessionId, botProps, currentMode, agentId }: {
2
2
  steps: any;
3
3
  currentTabValue: any;
4
4
  children: any;
@@ -7,6 +7,7 @@ declare const TabularContent: ({ steps: initialSteps, currentTabValue, children,
7
7
  stepFormDataMap?: {};
8
8
  isFormDisabled?: boolean;
9
9
  sessionId?: string;
10
+ chatSessionId?: string;
10
11
  botProps?: any;
11
12
  currentMode?: string;
12
13
  agentId?: string;
@@ -1,4 +1,4 @@
1
- declare const Steps: ({ steps, setSteps, done, setTabValue, setDone, finalStepDone, setFinalStepDone, stepChange, currentMode, questions, questionsStepsMap, stepFormDataMap, isFormDisabled, botProps, agentId, sessionId, }: {
1
+ declare const Steps: ({ steps, setSteps, done, setTabValue, setDone, finalStepDone, setFinalStepDone, stepChange, currentMode, questions, questionsStepsMap, stepFormDataMap, isFormDisabled, botProps, agentId, sessionId, chatSessionId, }: {
2
2
  steps: any;
3
3
  setSteps: any;
4
4
  done: any;
@@ -15,5 +15,6 @@ declare const Steps: ({ steps, setSteps, done, setTabValue, setDone, finalStepDo
15
15
  botProps?: any;
16
16
  agentId?: string;
17
17
  sessionId?: string;
18
+ chatSessionId?: string;
18
19
  }) => import("react/jsx-runtime").JSX.Element;
19
20
  export default Steps;
package/dist/index.cjs.js CHANGED
@@ -107,6 +107,18 @@ const getAgentVisibilityData = () => {
107
107
  console.error("getSmartBotVisibilityData error", error);
108
108
  }
109
109
  };
110
+ const getHideNavbotData = async (applicationCode) => {
111
+ try {
112
+ let { data } = await tenantConfigActions.tenantConfigApiCache(applicationCode, {
113
+ attribute_name: "hide_navbot",
114
+ })();
115
+ return data?.data?.[0]?.attribute_value?.value;
116
+ }
117
+ catch (error) {
118
+ console.error("getHideNavbotData error", error);
119
+ return false;
120
+ }
121
+ };
110
122
  const getAgentExceptionUserList = (applicationCode) => {
111
123
  try {
112
124
  return tenantConfigActions.tenantConfigApiCache(applicationCode, {
@@ -552,6 +564,26 @@ const parseResponse = (data, type, agentId = "", currentMode = "", disableTimeAn
552
564
  paramName: data?.data?.param_name
553
565
  }
554
566
  };
567
+ case "checkboxGroup":
568
+ return {
569
+ ...data,
570
+ timeStamp: timeString,
571
+ userType: "bot",
572
+ userName: userName,
573
+ headerTitle: data?.data?.label || "",
574
+ bodyType: "checkboxGroup",
575
+ bodyText: {
576
+ label: data?.data?.label,
577
+ orientation: data?.data?.orientation,
578
+ options: data?.data?.options,
579
+ defaultSelected: data?.data?.defaultSelected,
580
+ minOptions: data?.data?.minOptions,
581
+ maxOptions: data?.data?.maxOptions,
582
+ isRequired: data?.data?.isRequired,
583
+ isDisabled: data?.data?.isDisabled,
584
+ paramName: data?.data?.param_name
585
+ }
586
+ };
555
587
  case "button":
556
588
  return {
557
589
  ...data,
@@ -1154,13 +1186,6 @@ const resolveInternalPath = (href) => {
1154
1186
  return null;
1155
1187
  }
1156
1188
  };
1157
- /**
1158
- * Minimizes the chat window so the user can see the screen they navigated to.
1159
- * SmartBot (index.tsx) listens for this event and sets partialClose.
1160
- */
1161
- const minimizeChatBot = () => {
1162
- window.dispatchEvent(new CustomEvent("smartBotMinimize"));
1163
- };
1164
1189
  /**
1165
1190
  * Anchor rendered inside chatbot markdown. Internal links are navigated through
1166
1191
  * react-router so the chatbot is not remounted by a full page load.
@@ -1179,7 +1204,6 @@ const MarkdownLink = ({ href, children, ...props }) => {
1179
1204
  if (currentPath !== internalPath) {
1180
1205
  navigate(internalPath);
1181
1206
  }
1182
- minimizeChatBot();
1183
1207
  };
1184
1208
  return (jsxRuntime.jsx("a", { href: href, target: "_self", onClick: handleClick, ...props, children: children }));
1185
1209
  };
@@ -1282,7 +1306,6 @@ const TextRenderer = ({ text, thinking }) => {
1282
1306
  if (currentPath !== internalPath) {
1283
1307
  navigate(internalPath);
1284
1308
  }
1285
- minimizeChatBot();
1286
1309
  };
1287
1310
  // If the input contains rich HTML, render it directly with DOMPurify sanitization
1288
1311
  if (containsRichHtml(text)) {
@@ -7466,6 +7489,61 @@ const CheckboxContent = ({ bodyText, isFormDisabled = false, messageIndex }) =>
7466
7489
  return (jsxRuntime.jsx("div", { style: { width: '100%', marginTop: '10px' }, children: jsxRuntime.jsx(impactUiV3.Checkbox, { label: label, checked: checked, required: required, disabled: disabled || isFormDisabled, onChange: (e) => handleChange(e), variant: "default" }) }));
7467
7490
  };
7468
7491
 
7492
+ const CheckboxGroupContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
7493
+ const formKey = `${messageIndex}_${bodyText?.paramName}`;
7494
+ const classes = useStyles$a();
7495
+ const { label, orientation, options = [], defaultSelected, minOptions, maxOptions, isRequired, isDisabled, } = bodyText || {};
7496
+ const min = minOptions ?? 1;
7497
+ const max = maxOptions ?? options.length;
7498
+ const chatbotContext = reactRedux.useSelector((state) => state.smartBotReducer.chatbotContext);
7499
+ const chatbotContextRef = React.useRef(chatbotContext);
7500
+ chatbotContextRef.current = chatbotContext;
7501
+ const persistedFormValues = reactRedux.useSelector((state) => state.smartBotReducer.persistedFormValues);
7502
+ const dispatch = reactRedux.useDispatch();
7503
+ const [selected, setSelected] = React.useState(() => {
7504
+ const persisted = persistedFormValues?.[formKey];
7505
+ if (Array.isArray(persisted))
7506
+ return persisted;
7507
+ return Array.isArray(defaultSelected) ? defaultSelected : [];
7508
+ });
7509
+ if (lodash.isEmpty(bodyText))
7510
+ return null;
7511
+ const groupDisabled = isDisabled || isFormDisabled;
7512
+ const dispatchSelection = (newValues) => {
7513
+ const latestContext = chatbotContextRef.current;
7514
+ dispatch(smartBotActions.setChatbotContext({
7515
+ ...latestContext,
7516
+ [bodyText?.paramName]: {
7517
+ ...latestContext?.[bodyText?.paramName],
7518
+ [bodyText?.paramName]: newValues,
7519
+ updated: true,
7520
+ },
7521
+ }));
7522
+ dispatch(smartBotActions.setPersistedFormValues({ [formKey]: newValues }));
7523
+ };
7524
+ const handleChange = (optionValue, isChecked) => {
7525
+ try {
7526
+ const newValues = isChecked
7527
+ ? [...selected, optionValue]
7528
+ : selected.filter((val) => val !== optionValue);
7529
+ setSelected(newValues);
7530
+ dispatchSelection(newValues);
7531
+ }
7532
+ catch (error) {
7533
+ console.error("Error in checkboxGroup handleChange", error);
7534
+ }
7535
+ };
7536
+ const isRow = orientation === "row";
7537
+ const overMax = selected.length > max;
7538
+ const belowMin = isRequired && selected.length < min;
7539
+ return (jsxRuntime.jsxs("div", { style: { width: "100%", marginTop: "10px" }, children: [label && (jsxRuntime.jsxs("p", { className: classes.radioGrpLabel, children: [label, isRequired ? " *" : ""] })), jsxRuntime.jsx("div", { style: {
7540
+ display: "flex",
7541
+ flexDirection: isRow ? "row" : "column",
7542
+ flexWrap: isRow ? "wrap" : "nowrap",
7543
+ gap: isRow ? "16px" : "8px",
7544
+ }, children: options.map((option) => (jsxRuntime.jsx(impactUiV3.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 && (jsxRuntime.jsx("p", { className: classes.radioGrpLabel, style: { margin: "8px 0 0 0", color: "red" }, children: `Select at most ${max} option${max > 1 ? "s" : ""}` })), !overMax && belowMin && (jsxRuntime.jsx("p", { className: classes.radioGrpLabel, style: { margin: "8px 0 0 0", color: "red" }, children: `Select at least ${min} option${min > 1 ? "s" : ""}` }))] }));
7545
+ };
7546
+
7469
7547
  const RadioContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
7470
7548
  const formKey = `${messageIndex}_${bodyText?.paramName}`;
7471
7549
  const classes = useStyles$a();
@@ -7749,6 +7827,38 @@ const StepFormContent = ({ formData, messageIndex = 0, isFormDisabled = false, s
7749
7827
  return false;
7750
7828
  });
7751
7829
  }, [formData, chatbotContext, persistedFormValues, messageIndex]);
7830
+ // Validate checkboxGroup fields against their minOptions/maxOptions bounds.
7831
+ // A required group must have selectedCount within [min, max]; any group (even
7832
+ // non-required) must not exceed max. Blocks submit when out of bounds.
7833
+ const checkboxGroupsValid = React.useMemo(() => {
7834
+ if (!formData || !Array.isArray(formData))
7835
+ return true;
7836
+ const groups = formData.filter((item) => item?.type === "checkboxGroup");
7837
+ return groups.every((item) => {
7838
+ const data = item.data || {};
7839
+ const param = data.param_name;
7840
+ const options = data.options || [];
7841
+ const min = data.minOptions ?? 1;
7842
+ const max = data.maxOptions ?? options.length;
7843
+ // Resolve current selection: chatbotContext first, then persistedFormValues
7844
+ let selectedValues = [];
7845
+ const ctx = chatbotContext?.[param];
7846
+ if (ctx && ctx.updated && Array.isArray(ctx[param])) {
7847
+ selectedValues = ctx[param];
7848
+ }
7849
+ else {
7850
+ const persisted = persistedFormValues?.[`${messageIndex}_${param}`];
7851
+ if (Array.isArray(persisted))
7852
+ selectedValues = persisted;
7853
+ }
7854
+ const count = selectedValues.length;
7855
+ if (count > max)
7856
+ return false;
7857
+ if (data.isRequired && count < min)
7858
+ return false;
7859
+ return true;
7860
+ });
7861
+ }, [formData, chatbotContext, persistedFormValues, messageIndex]);
7752
7862
  // Extract select-type filter configs from formData for cross-filter cascading
7753
7863
  // and sort them based on the filters_hierarchy_order from tenant config
7754
7864
  const crossFilterConfigs = React.useMemo(() => {
@@ -7857,10 +7967,12 @@ const StepFormContent = ({ formData, messageIndex = 0, isFormDisabled = false, s
7857
7967
  return jsxRuntime.jsx(DateRangePickerContent, { bodyText: parsedData.bodyText, isFormDisabled: formFieldsDisabled, messageIndex: messageIndex }, key);
7858
7968
  case "checkbox":
7859
7969
  return jsxRuntime.jsx(CheckboxContent, { bodyText: parsedData.bodyText, isFormDisabled: formFieldsDisabled, messageIndex: messageIndex }, key);
7970
+ case "checkboxGroup":
7971
+ return jsxRuntime.jsx(CheckboxGroupContent, { bodyText: parsedData.bodyText, isFormDisabled: formFieldsDisabled, messageIndex: messageIndex }, key);
7860
7972
  case "radio":
7861
7973
  return jsxRuntime.jsx(RadioContent, { bodyText: parsedData.bodyText, isFormDisabled: formFieldsDisabled, messageIndex: messageIndex }, key);
7862
7974
  case "button":
7863
- return jsxRuntime.jsx(ButtonContent, { bodyText: parsedData.bodyText, isFormDisabled: isFormDisabled || isFormSubmitted || isTimedOut, isStepFormSubmit: true, isFormValid: requiredFieldsFilled, formParamNames: formParamNames, messageIndex: messageIndex }, key);
7975
+ return jsxRuntime.jsx(ButtonContent, { bodyText: parsedData.bodyText, isFormDisabled: isFormDisabled || isFormSubmitted || isTimedOut, isStepFormSubmit: true, isFormValid: requiredFieldsFilled && checkboxGroupsValid, formParamNames: formParamNames, messageIndex: messageIndex }, key);
7864
7976
  case "input":
7865
7977
  return jsxRuntime.jsx(InputContent, { bodyText: parsedData.bodyText, isFormDisabled: formFieldsDisabled, messageIndex: messageIndex }, key);
7866
7978
  case "image":
@@ -8256,7 +8368,7 @@ const getQuestionStatus$1 = (questionSteps) => {
8256
8368
  /**
8257
8369
  * Renders a single progress bar item (main point + sub-items)
8258
8370
  */
8259
- const ProgressBarItem$1 = ({ question, questionSteps, isLast, classes, formData, showSavedFilters = true, preSelectedFilters = null, isFormDisabled, onAllSubItemsAnimated = undefined, botProps = null, currentMode = "", agentId = "", sessionId = "" }) => {
8371
+ const ProgressBarItem$1 = ({ question, questionSteps, isLast, classes, formData, showSavedFilters = true, preSelectedFilters = null, isFormDisabled, onAllSubItemsAnimated = undefined, botProps = null, currentMode = "", agentId = "", sessionId = "", index = 0, chatSessionId = "" }) => {
8260
8372
  const status = getQuestionStatus$1(questionSteps);
8261
8373
  const animatedCountRef = React.useRef(0);
8262
8374
  const [isExpanded, setIsExpanded] = React.useState(true);
@@ -8290,9 +8402,9 @@ const ProgressBarItem$1 = ({ question, questionSteps, isLast, classes, formData,
8290
8402
  if (animatedCountRef.current >= arr.length && onAllSubItemsAnimated) {
8291
8403
  onAllSubItemsAnimated();
8292
8404
  }
8293
- } }) }, idx))) })), formData && isExpanded && (jsxRuntime.jsx("div", { className: classes.stepFormContainer, children: jsxRuntime.jsx(StepFormContent, { formData: formData, isFormDisabled: isFormDisabled, showSavedFilters: showSavedFilters, preSelectedFilters: preSelectedFilters, botProps: botProps, currentMode: currentMode, agentId: agentId, sessionId: sessionId }) }))] })] }));
8405
+ } }) }, idx))) })), formData && isExpanded && (jsxRuntime.jsx("div", { className: classes.stepFormContainer, children: jsxRuntime.jsx(StepFormContent, { formData: formData, isFormDisabled: isFormDisabled, showSavedFilters: showSavedFilters, preSelectedFilters: preSelectedFilters, botProps: botProps, currentMode: currentMode, agentId: agentId, sessionId: sessionId, messageIndex: `${String(chatSessionId)}_${index}` }) }))] })] }));
8294
8406
  };
8295
- const Steps$1 = ({ steps, setSteps, done, setTabValue, setDone, finalStepDone, setFinalStepDone, stepChange, currentMode, questions = [], questionsStepsMap = {}, stepFormDataMap = {}, isFormDisabled = false, botProps = null, agentId = "", sessionId = "", }) => {
8407
+ const Steps$1 = ({ steps, setSteps, done, setTabValue, setDone, finalStepDone, setFinalStepDone, stepChange, currentMode, questions = [], questionsStepsMap = {}, stepFormDataMap = {}, isFormDisabled = false, botProps = null, agentId = "", sessionId = "", chatSessionId = "", }) => {
8296
8408
  const classes = useStyles$4();
8297
8409
  React.useState(false);
8298
8410
  const [showThinking, setShowThinking] = React.useState(false);
@@ -8375,7 +8487,7 @@ const Steps$1 = ({ steps, setSteps, done, setTabValue, setDone, finalStepDone, s
8375
8487
  const showSavedFilters = formEntry && !Array.isArray(formEntry) ? formEntry.showSavedFilters : true;
8376
8488
  const preSelectedFilters = formEntry && !Array.isArray(formEntry) ? formEntry.preSelectedFilters : null;
8377
8489
  const isLast = index === questions.length - 1;
8378
- return (jsxRuntime.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
8490
+ return (jsxRuntime.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
8379
8491
  ? () => setShowThinking(true)
8380
8492
  : undefined }, index));
8381
8493
  }), showThinking && !done && (jsxRuntime.jsx("div", { style: {
@@ -8403,6 +8515,8 @@ const renderWidgetItem = (item, index, isFormDisabled) => {
8403
8515
  return jsxRuntime.jsx(RadioContent, { bodyText: parsedData.bodyText, isFormDisabled: isFormDisabled }, key);
8404
8516
  case "checkbox":
8405
8517
  return jsxRuntime.jsx(CheckboxContent, { bodyText: parsedData.bodyText, isFormDisabled: isFormDisabled }, key);
8518
+ case "checkboxGroup":
8519
+ return jsxRuntime.jsx(CheckboxGroupContent, { bodyText: parsedData.bodyText, isFormDisabled: isFormDisabled }, key);
8406
8520
  case "select":
8407
8521
  return jsxRuntime.jsx(SelectContent, { bodyText: parsedData.bodyText, isFormDisabled: isFormDisabled }, key);
8408
8522
  case "slider":
@@ -8437,7 +8551,7 @@ const AgentResponse$1 = (props) => {
8437
8551
  };
8438
8552
 
8439
8553
  const StepsResponseTab = (props) => {
8440
- const { steps, setSteps, stepsDone, setStepsDone, finalStepDone, setFinalStepDone, content, isStreaming, stepChange, currentMode, questions, questionsStepsMap, stepFormDataMap, isFormDisabled, streamingWidgetData, isRetrying, botProps, agentId, sessionId, } = props;
8554
+ const { steps, setSteps, stepsDone, setStepsDone, finalStepDone, setFinalStepDone, content, isStreaming, stepChange, currentMode, questions, questionsStepsMap, stepFormDataMap, isFormDisabled, streamingWidgetData, isRetrying, botProps, agentId, sessionId, chatSessionId, } = props;
8441
8555
  const dispatch = reactRedux.useDispatch();
8442
8556
  const thinkingContext = reactRedux.useSelector((state) => state.smartBotReducer.thinkingContext);
8443
8557
  const streamStartTimeRef = React.useRef(thinkingContext?.streamStartTime);
@@ -8501,7 +8615,7 @@ const StepsResponseTab = (props) => {
8501
8615
  icon: jsxRuntime.jsx(PsychologyOutlinedIcon, { fontSize: "large" }),
8502
8616
  },
8503
8617
  ], tabPanels: [
8504
- jsxRuntime.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 }),
8618
+ jsxRuntime.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 }),
8505
8619
  jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(AgentResponse$1, { content: content, isStreaming: isStreaming, streamingWidgetData: streamingWidgetData, isFormDisabled: isFormDisabled || isTimedOut }), timeoutMessage && (jsxRuntime.jsx("div", { style: { marginTop: "8px", padding: "0 8px" }, children: jsxRuntime.jsx(TextRenderer, { text: timeoutMessage, thinking: "" }) }))] }),
8506
8620
  ], value: tabValue }) }));
8507
8621
  };
@@ -10073,7 +10187,7 @@ const StreamedContent = ({ botData, botProps }) => {
10073
10187
  * @returns {JSX.Element} Rendered content with optional blinking cursor
10074
10188
  */
10075
10189
  const renderContent = () => {
10076
- return (jsxRuntime.jsxs("div", { className: classes.streamContainer, children: [jsxRuntime.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 && (jsxRuntime.jsx("div", { className: classes.retryContainer, children: jsxRuntime.jsx(TextRenderer, { text: `Auto re-trying in ${retryCountdown}s`, thinking: "" }) }))] }));
10190
+ return (jsxRuntime.jsxs("div", { className: classes.streamContainer, children: [jsxRuntime.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 && (jsxRuntime.jsx("div", { className: classes.retryContainer, children: jsxRuntime.jsx(TextRenderer, { text: `Auto re-trying in ${retryCountdown}s`, thinking: "" }) }))] }));
10077
10191
  };
10078
10192
  if (currentMode === "agent") {
10079
10193
  return renderContent();
@@ -10269,7 +10383,7 @@ const getQuestionStatus = (questionSteps) => {
10269
10383
  /**
10270
10384
  * Renders a single progress bar item (main point + sub-items)
10271
10385
  */
10272
- const ProgressBarItem = ({ question, questionSteps, isLast, classes, formData, isFormDisabled, isRestreaming = false, showSavedFilters = true, preSelectedFilters = null }) => {
10386
+ const ProgressBarItem = ({ question, questionSteps, isLast, classes, formData, isFormDisabled, isRestreaming = false, showSavedFilters = true, preSelectedFilters = null, sessionId = "", index = 0, chatSessionId = "" }) => {
10273
10387
  const baseStatus = getQuestionStatus(questionSteps);
10274
10388
  // When restreaming and this is the last item, show as in-progress
10275
10389
  const status = (isRestreaming && isLast) ? "in-progress" : baseStatus;
@@ -10299,9 +10413,9 @@ const ProgressBarItem = ({ question, questionSteps, isLast, classes, formData, i
10299
10413
  setIsExpanded(true);
10300
10414
  }
10301
10415
  }, [status, formData]);
10302
- return (jsxRuntime.jsxs("div", { className: classes.progressItem, children: [jsxRuntime.jsxs("div", { className: classes.progressTrack, children: [jsxRuntime.jsx("div", { className: `${classes.progressDot} ${dotClass}` }), !isLast && jsxRuntime.jsx("div", { className: `${classes.progressLine} ${lineClass}` })] }), jsxRuntime.jsxs("div", { className: classes.progressContent, children: [jsxRuntime.jsxs("div", { className: classes.progressHeader, onClick: handleToggle, children: [jsxRuntime.jsx("span", { className: `${classes.progressHeaderText} ${textClass}`, children: question }), hasSubItems && (jsxRuntime.jsx(ChevronRightIcon$1, { className: `${classes.progressChevron} ${textClass} ${isExpanded ? "expanded" : ""}` }))] }), hasSubItems && isExpanded && status === "in-progress" && (jsxRuntime.jsxs("div", { className: classes.reasoningLabel, children: [jsxRuntime.jsx(SvgReasoningIcon, {}), "Working on the next step..."] })), hasSubItems && isExpanded && !isProcessingRequest && (jsxRuntime.jsx("div", { className: classes.progressSubItems, style: { maxHeight: isExpanded ? "500px" : "0", opacity: isExpanded ? 1 : 0 }, children: questionSteps.map((step, idx) => (jsxRuntime.jsx("div", { className: classes.progressSubItem, children: jsxRuntime.jsx(SubStepRenderer, { text: `${step.header}${step.sub_header ? ` - ${step.sub_header}` : ""}` }) }, idx))) })), formData && isExpanded && (jsxRuntime.jsx("div", { className: classes.stepFormContainer, children: jsxRuntime.jsx(StepFormContent, { formData: formData, isFormDisabled: isFormDisabled, showSavedFilters: showSavedFilters, preSelectedFilters: preSelectedFilters }) }))] })] }));
10416
+ return (jsxRuntime.jsxs("div", { className: classes.progressItem, children: [jsxRuntime.jsxs("div", { className: classes.progressTrack, children: [jsxRuntime.jsx("div", { className: `${classes.progressDot} ${dotClass}` }), !isLast && jsxRuntime.jsx("div", { className: `${classes.progressLine} ${lineClass}` })] }), jsxRuntime.jsxs("div", { className: classes.progressContent, children: [jsxRuntime.jsxs("div", { className: classes.progressHeader, onClick: handleToggle, children: [jsxRuntime.jsx("span", { className: `${classes.progressHeaderText} ${textClass}`, children: question }), hasSubItems && (jsxRuntime.jsx(ChevronRightIcon$1, { className: `${classes.progressChevron} ${textClass} ${isExpanded ? "expanded" : ""}` }))] }), hasSubItems && isExpanded && status === "in-progress" && (jsxRuntime.jsxs("div", { className: classes.reasoningLabel, children: [jsxRuntime.jsx(SvgReasoningIcon, {}), "Working on the next step..."] })), hasSubItems && isExpanded && !isProcessingRequest && (jsxRuntime.jsx("div", { className: classes.progressSubItems, style: { maxHeight: isExpanded ? "500px" : "0", opacity: isExpanded ? 1 : 0 }, children: questionSteps.map((step, idx) => (jsxRuntime.jsx("div", { className: classes.progressSubItem, children: jsxRuntime.jsx(SubStepRenderer, { text: `${step.header}${step.sub_header ? ` - ${step.sub_header}` : ""}` }) }, idx))) })), formData && isExpanded && (jsxRuntime.jsx("div", { className: classes.stepFormContainer, children: jsxRuntime.jsx(StepFormContent, { formData: formData, isFormDisabled: isFormDisabled, showSavedFilters: showSavedFilters, preSelectedFilters: preSelectedFilters, messageIndex: `${String(chatSessionId)}_${index}` }) }))] })] }));
10303
10417
  };
10304
- const Steps = ({ steps, questions = [], questionsStepsMap = {}, stepFormDataMap = {}, isFormDisabled = false, activeFormIntent = null, isRestreaming = false }) => {
10418
+ const Steps = ({ steps, questions = [], questionsStepsMap = {}, stepFormDataMap = {}, isFormDisabled = false, activeFormIntent = null, isRestreaming = false, sessionId = "", chatSessionId = "" }) => {
10305
10419
  const classes = useStyles$3();
10306
10420
  React.useState(false);
10307
10421
  const hasQuestions = questions.length > 0;
@@ -10330,7 +10444,7 @@ const Steps = ({ steps, questions = [], questionsStepsMap = {}, stepFormDataMap
10330
10444
  const formDisabledForThis = activeFormIntent
10331
10445
  ? question !== activeFormIntent
10332
10446
  : isFormDisabled;
10333
- return (jsxRuntime.jsx(ProgressBarItem, { question: question, questionSteps: questionSteps, isLast: index === questions.length - 1, classes: classes, formData: formData, isFormDisabled: formDisabledForThis, isRestreaming: isRestreaming, showSavedFilters: showSavedFilters, preSelectedFilters: preSelectedFilters }, index));
10447
+ return (jsxRuntime.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));
10334
10448
  }) }));
10335
10449
  };
10336
10450
 
@@ -10343,7 +10457,7 @@ const AgentResponse = ({ children }) => {
10343
10457
  // Only the active instance should process stepFormStreamData from Redux.
10344
10458
  let instanceCounter = 0;
10345
10459
  let activeTabularInstanceId = null;
10346
- const TabularContent = ({ steps: initialSteps, currentTabValue, children, questions: initialQuestions = [], questionsStepsMap: initialQuestionsStepsMap = {}, stepFormDataMap: initialStepFormDataMap = {}, isFormDisabled = false, sessionId: propSessionId = "", botProps = null, currentMode = "", agentId = "" }) => {
10460
+ const TabularContent = ({ steps: initialSteps, currentTabValue, children, questions: initialQuestions = [], questionsStepsMap: initialQuestionsStepsMap = {}, stepFormDataMap: initialStepFormDataMap = {}, isFormDisabled = false, sessionId: propSessionId = "", chatSessionId = "", botProps = null, currentMode = "", agentId = "" }) => {
10347
10461
  const dispatch = reactRedux.useDispatch();
10348
10462
  const stepFormStreamData = reactRedux.useSelector((state) => state.smartBotReducer.stepFormStreamData);
10349
10463
  const thinkingContext = reactRedux.useSelector((state) => state.smartBotReducer.thinkingContext);
@@ -10824,7 +10938,7 @@ const TabularContent = ({ steps: initialSteps, currentTabValue, children, questi
10824
10938
  icon: jsxRuntime.jsx(PsychologyOutlinedIcon, { fontSize: "large" }),
10825
10939
  },
10826
10940
  ], tabPanels: [
10827
- jsxRuntime.jsx(Steps, { steps: stepsState, questions: questionsState, questionsStepsMap: questionsStepsMapState, stepFormDataMap: stepFormDataMapState, isFormDisabled: (isFormDisabled && !isRestreaming) || stepFormSubmitted || isTimedOut, activeFormIntent: hasNewStepFormFromRestream ? activeFormIntent : null, isRestreaming: isRestreaming }),
10941
+ jsxRuntime.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 }),
10828
10942
  jsxRuntime.jsxs(AgentResponse, { children: [children, renderedWidgets.length > 0 && (jsxRuntime.jsx("div", { className: "restream-widget-content", children: renderedWidgets })), retryCountdown > 0 && (jsxRuntime.jsx("div", { style: { marginTop: "8px" }, children: jsxRuntime.jsx(TextRenderer, { text: `Auto re-trying in ${retryCountdown}s`, thinking: "" }) })), timeoutMessage && (jsxRuntime.jsx("div", { style: { marginTop: "8px" }, children: jsxRuntime.jsx(TextRenderer, { text: timeoutMessage, thinking: "" }) }))] }),
10829
10943
  ], value: tabValue }) }));
10830
10944
  };
@@ -10867,6 +10981,8 @@ const CombinedContent = ({ botData, props }) => {
10867
10981
  return jsxRuntime.jsx(DateRangePickerContent, { bodyText: parsedData.bodyText, isFormDisabled: isFormDisabled, messageIndex: botData.messageIndex }, key);
10868
10982
  case "checkbox":
10869
10983
  return jsxRuntime.jsx(CheckboxContent, { bodyText: parsedData.bodyText, isFormDisabled: isFormDisabled, messageIndex: botData.messageIndex }, key);
10984
+ case "checkboxGroup":
10985
+ return jsxRuntime.jsx(CheckboxGroupContent, { bodyText: parsedData.bodyText, isFormDisabled: isFormDisabled, messageIndex: botData.messageIndex }, key);
10870
10986
  case "radio":
10871
10987
  return jsxRuntime.jsx(RadioContent, { bodyText: parsedData.bodyText, isFormDisabled: isFormDisabled, messageIndex: botData.messageIndex }, key);
10872
10988
  case "button":
@@ -10902,7 +11018,7 @@ const CombinedContent = ({ botData, props }) => {
10902
11018
  const validContent = renderedContent.filter(content => content !== null);
10903
11019
  const renderCombinedContent = () => (jsxRuntime.jsx("div", { className: "combined-content-container", children: validContent.length > 0 ? (validContent.map((content, index) => (jsxRuntime.jsx("div", { className: "combined-content-item", children: content }, `wrapper-${index}`)))) : (jsxRuntime.jsx("div", { children: "No valid content to display" })) }));
10904
11020
  if (isTabEnabled) {
10905
- return (jsxRuntime.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() }));
11021
+ return (jsxRuntime.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() }));
10906
11022
  }
10907
11023
  return renderCombinedContent();
10908
11024
  };
@@ -10965,6 +11081,8 @@ const BotMessage = ({ botData, state, handleLikeDislike, props }) => {
10965
11081
  return jsxRuntime.jsx(DateRangePickerContent, { bodyText: botData.bodyText, isFormDisabled: botData.isFormDisabled, messageIndex: botData.messageIndex });
10966
11082
  case "checkbox":
10967
11083
  return jsxRuntime.jsx(CheckboxContent, { bodyText: botData.bodyText, isFormDisabled: botData.isFormDisabled, messageIndex: botData.messageIndex });
11084
+ case "checkboxGroup":
11085
+ return jsxRuntime.jsx(CheckboxGroupContent, { bodyText: botData.bodyText, isFormDisabled: botData.isFormDisabled, messageIndex: botData.messageIndex });
10968
11086
  case "radio":
10969
11087
  return jsxRuntime.jsx(RadioContent, { bodyText: botData.bodyText, isFormDisabled: botData.isFormDisabled, messageIndex: botData.messageIndex });
10970
11088
  case "button":
@@ -15304,9 +15422,11 @@ const SmartBot = (props) => {
15304
15422
  skipHierarchyCall: true,
15305
15423
  })();
15306
15424
  let showAgentIcon = await getAgentVisibilityData();
15425
+ let appCode = utils$2.getApplicationCodeFromURL(applicationName);
15426
+ let hideNavbot = await getHideNavbotData(appCode);
15427
+ const filterNavigationTab = (tabs) => hideNavbot ? tabs.filter((tab) => tab.name !== "Navigation") : tabs;
15307
15428
  if (!lodash.isEmpty(accessDataResponse) &&
15308
15429
  showAgentIcon?.data?.data[0]?.attribute_value?.value) {
15309
- let appCode = utils$2.getApplicationCodeFromURL(applicationName);
15310
15430
  let list = await getAgentExceptionUserList(appCode);
15311
15431
  let isWhitelisted = false;
15312
15432
  if (list?.data?.data[0]?.attribute_value?.allow_all) {
@@ -15518,7 +15638,7 @@ const SmartBot = (props) => {
15518
15638
  icon: jsxRuntime.jsx(SvgNavigationIcon, {}),
15519
15639
  }
15520
15640
  ];
15521
- setTabList(tabListData);
15641
+ setTabList(filterNavigationTab(tabListData));
15522
15642
  }
15523
15643
  else {
15524
15644
  setCurrentMode("navigation");
@@ -16098,10 +16218,50 @@ const SmartBot = (props) => {
16098
16218
  }
16099
16219
  fetchConversations(null, "agent");
16100
16220
  }, [renameConversation, deleteConversation, fetchConversations]);
16221
+ // Ref to the SmartBot wrapper so we can scope outside-click detection and the
16222
+ // collapse-button query to this (local) chatbot instance only.
16223
+ const smartBotWrapperRef = React.useRef(null);
16224
+ // Collapse the expanded/docked chatbot into the small draggable panel by
16225
+ // triggering impact-ui's header "Collapse chatbot" control. That button is
16226
+ // only present while expanded (its label becomes "Expand chatbot" once
16227
+ // collapsed), so this is a safe no-op when already collapsed.
16228
+ const collapseChatBotIfExpanded = React.useCallback(() => {
16229
+ const root = smartBotWrapperRef.current;
16230
+ if (!root)
16231
+ return;
16232
+ const collapseBtn = root.querySelector('button[aria-label="Collapse chatbot"]');
16233
+ if (collapseBtn)
16234
+ collapseBtn.click();
16235
+ }, []);
16236
+ // Auto-collapse to draggable mode when the user interacts outside the bot.
16237
+ React.useEffect(() => {
16238
+ const handleOutsideInteraction = (e) => {
16239
+ const root = smartBotWrapperRef.current;
16240
+ if (!root)
16241
+ return;
16242
+ if (root.contains(e.target))
16243
+ return; // interaction inside the bot → ignore
16244
+ collapseChatBotIfExpanded();
16245
+ };
16246
+ document.addEventListener("mousedown", handleOutsideInteraction, true);
16247
+ return () => {
16248
+ document.removeEventListener("mousedown", handleOutsideInteraction, true);
16249
+ };
16250
+ }, [collapseChatBotIfExpanded]);
16251
+ // Auto-collapse on route changes (skip the initial mount so freshly opening
16252
+ // the bot doesn't immediately collapse it).
16253
+ const hasMountedForCollapseRef = React.useRef(false);
16254
+ React.useEffect(() => {
16255
+ if (!hasMountedForCollapseRef.current) {
16256
+ hasMountedForCollapseRef.current = true;
16257
+ return;
16258
+ }
16259
+ collapseChatBotIfExpanded();
16260
+ }, [location.pathname, collapseChatBotIfExpanded]);
16101
16261
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [partialClose && (minimizedStreamData?.isStreaming || minimizedStreamData?.stepStatus === "step_form") && (jsxRuntime.jsx(MinimizedChatWidget, { onExpand: () => {
16102
16262
  setShowModal(true);
16103
16263
  setPartialClose(false);
16104
- } })), jsxRuntime.jsxs("div", { className: `${classes.agentStyleOverride} ${partialClose ? classes.hideBotStyle : ""} `, children: [jsxRuntime.jsx(MemoryModal, { isModalOpen: isModalOpen, setIsModalOpen: setIsModalOpen, displaySnackMessages: displaySnackMessages }), jsxRuntime.jsx(UploadModal, { isUploadModalOpen: isUploadModalOpen, setIsUploadModalOpen: setIsUploadModalOpen, displaySnackMessages: displaySnackMessages }), jsxRuntime.jsx(impactUiV3.ChatBotComponent, { isFullWidth: forceOpen, userName: userName, showHistoryPanel: false, customInputComponent: currentMode === "agent" && !showSavedFilters ? (jsxRuntime.jsx(ChatbotInput, { newChatScreen: newChatScreen, inputValue: userInput, setInputValue: setUserInput, isStopIcon: isStop, onSendIconClick: onSendIconClick, onStopIconClick: onStopIconClick, currentMode: currentMode, filterOptions: filterOptions,
16264
+ } })), jsxRuntime.jsxs("div", { ref: smartBotWrapperRef, className: `${classes.agentStyleOverride} ${partialClose ? classes.hideBotStyle : ""} `, children: [jsxRuntime.jsx(MemoryModal, { isModalOpen: isModalOpen, setIsModalOpen: setIsModalOpen, displaySnackMessages: displaySnackMessages }), jsxRuntime.jsx(UploadModal, { isUploadModalOpen: isUploadModalOpen, setIsUploadModalOpen: setIsUploadModalOpen, displaySnackMessages: displaySnackMessages }), jsxRuntime.jsx(impactUiV3.ChatBotComponent, { isFullWidth: forceOpen, userName: userName, showHistoryPanel: false, customInputComponent: currentMode === "agent" && !showSavedFilters ? (jsxRuntime.jsx(ChatbotInput, { newChatScreen: newChatScreen, inputValue: userInput, setInputValue: setUserInput, isStopIcon: isStop, onSendIconClick: onSendIconClick, onStopIconClick: onStopIconClick, currentMode: currentMode, filterOptions: filterOptions,
16105
16265
  // onSaveClick={saveCurrentChat}
16106
16266
  savedFilterSets: savedFilterSets, selectedFilterSet: selectedFilterSet, onFilterSetSelect: (filterSet) => setSelectedFilterSet(filterSet), onClearFilterSet: () => setSelectedFilterSet(null), onTriggerRefresh: triggerRefreshAction, answerMode: answerMode, setAnswerMode: setAnswerMode })) : showSavedFilters ? jsxRuntime.jsx(jsxRuntime.Fragment, {}) : null, isChatBotOpen: showModal || forceOpen, historyPanelData: historyPanelData, onHistorySearchChange: (params) => { console.log("History Search Change", params); }, onHistorySelectConversation: (params) => {
16107
16267
  console.log("History Select Conversation", params);