impact-chatbot 2.3.39 → 2.3.41

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
@@ -6342,11 +6342,8 @@ const useStyles$3 = makeStyles$1((theme) => ({
6342
6342
  progressSubItems: {
6343
6343
  display: "flex",
6344
6344
  flexDirection: "column",
6345
- gap: pxToRem(14),
6346
- marginTop: pxToRem(8),
6347
- padding: `${pxToRem(8)} ${pxToRem(14)}`,
6348
- background: colours.greys100,
6349
- borderRadius: pxToRem(8),
6345
+ gap: pxToRem(12),
6346
+ marginTop: pxToRem(6),
6350
6347
  transition: "opacity 0.3s ease",
6351
6348
  overflow: "auto",
6352
6349
  maxHeight: pxToRem(300),
@@ -6378,26 +6375,55 @@ const useStyles$3 = makeStyles$1((theme) => ({
6378
6375
  },
6379
6376
  },
6380
6377
  progressSubItem: {
6381
- display: "flex",
6382
- alignItems: "flex-start",
6383
- gap: pxToRem(6),
6384
- fontFamily: "'JetBrains Mono', monospace",
6385
- fontSize: pxToRem(14),
6386
- fontWeight: 400,
6387
- lineHeight: pxToRem(20),
6388
- color: colours.darkBlack,
6389
- "&::before": {
6390
- content: '"•"',
6391
- flexShrink: 0,
6392
- color: colours.darkBlack,
6393
- fontSize: pxToRem(14),
6394
- lineHeight: pxToRem(20),
6395
- },
6378
+ fontFamily: "Manrope",
6379
+ fontSize: pxToRem(12),
6380
+ fontWeight: 600,
6381
+ lineHeight: pxToRem(18),
6382
+ color: "#888",
6396
6383
  },
6397
6384
  stepFormContainer: {
6398
6385
  marginTop: pxToRem(8),
6399
6386
  },
6400
6387
  }));
6388
+ /**
6389
+ * Typewriter effect component — reveals text character by character.
6390
+ * Tracks already-animated text so the effect only plays once (survives remounts).
6391
+ */
6392
+ const animatedTexts$1 = new Set();
6393
+ const TypewriterText$1 = ({ text, speed = 15 }) => {
6394
+ const alreadyAnimated = animatedTexts$1.has(text);
6395
+ const [displayed, setDisplayed] = useState(alreadyAnimated ? text : "");
6396
+ const indexRef = useRef(alreadyAnimated ? text?.length || 0 : 0);
6397
+ const prevTextRef = useRef(text || "");
6398
+ useEffect(() => {
6399
+ if (!text)
6400
+ return;
6401
+ // If already animated, show full text immediately
6402
+ if (animatedTexts$1.has(text)) {
6403
+ setDisplayed(text);
6404
+ return;
6405
+ }
6406
+ // If text changed, reset
6407
+ if (text !== prevTextRef.current) {
6408
+ prevTextRef.current = text;
6409
+ indexRef.current = 0;
6410
+ setDisplayed("");
6411
+ }
6412
+ const interval = setInterval(() => {
6413
+ indexRef.current += 1;
6414
+ if (indexRef.current >= text.length) {
6415
+ setDisplayed(text);
6416
+ animatedTexts$1.add(text);
6417
+ clearInterval(interval);
6418
+ }
6419
+ else {
6420
+ setDisplayed(text.slice(0, indexRef.current));
6421
+ }
6422
+ }, speed);
6423
+ return () => clearInterval(interval);
6424
+ }, [text, speed]);
6425
+ return jsx(Fragment, { children: displayed });
6426
+ };
6401
6427
  /**
6402
6428
  * Determines the overall status of a question based on its steps.
6403
6429
  * - "completed": all steps are completed
@@ -6453,7 +6479,7 @@ const ProgressBarItem$1 = ({ question, questionSteps, isLast, classes, formData,
6453
6479
  setIsExpanded(true);
6454
6480
  }
6455
6481
  }, [status, formData]);
6456
- 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, {}), "Reasoning..."] })), hasSubItems && isExpanded && (jsx("div", { className: classes.progressSubItems, style: { maxHeight: isExpanded ? "500px" : "0", opacity: isExpanded ? 1 : 0 }, children: questionSteps.map((step, idx) => (jsxs("div", { className: classes.progressSubItem, children: [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 }) }))] })] }));
6482
+ 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, {}), "Reasoning..."] })), hasSubItems && isExpanded && (jsx("div", { className: classes.progressSubItems, style: { opacity: isExpanded ? 1 : 0 }, children: questionSteps.map((step, idx) => (jsx("div", { className: classes.progressSubItem, children: jsx(TypewriterText$1, { 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 }) }))] })] }));
6457
6483
  };
6458
6484
  const Steps$1 = ({ steps, setSteps, done, setTabValue, setDone, finalStepDone, setFinalStepDone, stepChange, currentMode, questions = [], questionsStepsMap = {}, stepFormDataMap = {}, isFormDisabled = false, }) => {
6459
6485
  const classes = useStyles$3();
@@ -6846,6 +6872,10 @@ const StreamedContent = ({ botData }) => {
6846
6872
  }
6847
6873
  let intentSteps = cloneDeep(questionsStepsMapRef.current[currentIntent]);
6848
6874
  if (newStep.header) {
6875
+ // Remove placeholder if it's the only entry — real step replaces it
6876
+ if (intentSteps.length === 1 && intentSteps[0].header === "Processing Request") {
6877
+ intentSteps = [];
6878
+ }
6849
6879
  // Only add/update sub-steps that have a non-empty header
6850
6880
  const existingIdx = intentSteps.findIndex((s) => s.header === newStep.header);
6851
6881
  if (existingIdx !== -1) {
@@ -7503,11 +7533,8 @@ const useStyles$2 = makeStyles$1((theme) => ({
7503
7533
  progressSubItems: {
7504
7534
  display: "flex",
7505
7535
  flexDirection: "column",
7506
- gap: pxToRem(14),
7507
- marginTop: pxToRem(8),
7508
- padding: `${pxToRem(8)} ${pxToRem(14)}`,
7509
- background: colours.greys100,
7510
- borderRadius: pxToRem(8),
7536
+ gap: pxToRem(12),
7537
+ marginTop: pxToRem(6),
7511
7538
  transition: "max-height 0.3s ease, opacity 0.3s ease",
7512
7539
  overflow: "auto",
7513
7540
  maxHeight: pxToRem(300),
@@ -7539,26 +7566,55 @@ const useStyles$2 = makeStyles$1((theme) => ({
7539
7566
  },
7540
7567
  },
7541
7568
  progressSubItem: {
7542
- display: "flex",
7543
- alignItems: "flex-start",
7544
- gap: pxToRem(6),
7545
- fontFamily: "'JetBrains Mono', monospace",
7546
- fontSize: pxToRem(14),
7547
- fontWeight: 400,
7548
- lineHeight: pxToRem(20),
7549
- color: colours.darkBlack,
7550
- "&::before": {
7551
- content: '"•"',
7552
- flexShrink: 0,
7553
- color: colours.darkBlack,
7554
- fontSize: pxToRem(14),
7555
- lineHeight: pxToRem(20),
7556
- },
7569
+ fontFamily: "Manrope",
7570
+ fontSize: pxToRem(12),
7571
+ fontWeight: 600,
7572
+ lineHeight: pxToRem(18),
7573
+ color: "#888",
7557
7574
  },
7558
7575
  stepFormContainer: {
7559
7576
  marginTop: pxToRem(8),
7560
7577
  },
7561
7578
  }));
7579
+ /**
7580
+ * Typewriter effect component — reveals text character by character.
7581
+ * Tracks already-animated text so the effect only plays once (survives remounts).
7582
+ */
7583
+ const animatedTexts = new Set();
7584
+ const TypewriterText = ({ text, speed = 15 }) => {
7585
+ const alreadyAnimated = animatedTexts.has(text);
7586
+ const [displayed, setDisplayed] = useState(alreadyAnimated ? text : "");
7587
+ const indexRef = useRef(alreadyAnimated ? text?.length || 0 : 0);
7588
+ const prevTextRef = useRef(text || "");
7589
+ useEffect(() => {
7590
+ if (!text)
7591
+ return;
7592
+ // If already animated, show full text immediately
7593
+ if (animatedTexts.has(text)) {
7594
+ setDisplayed(text);
7595
+ return;
7596
+ }
7597
+ // If text changed, reset
7598
+ if (text !== prevTextRef.current) {
7599
+ prevTextRef.current = text;
7600
+ indexRef.current = 0;
7601
+ setDisplayed("");
7602
+ }
7603
+ const interval = setInterval(() => {
7604
+ indexRef.current += 1;
7605
+ if (indexRef.current >= text.length) {
7606
+ setDisplayed(text);
7607
+ animatedTexts.add(text);
7608
+ clearInterval(interval);
7609
+ }
7610
+ else {
7611
+ setDisplayed(text.slice(0, indexRef.current));
7612
+ }
7613
+ }, speed);
7614
+ return () => clearInterval(interval);
7615
+ }, [text, speed]);
7616
+ return jsx(Fragment, { children: displayed });
7617
+ };
7562
7618
  /**
7563
7619
  * Determines the overall status of a question based on its steps.
7564
7620
  */
@@ -7608,7 +7664,7 @@ const ProgressBarItem = ({ question, questionSteps, isLast, classes, formData, i
7608
7664
  setIsExpanded(true);
7609
7665
  }
7610
7666
  }, [status, formData]);
7611
- 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, {}), "Reasoning..."] })), hasSubItems && isExpanded && (jsx("div", { className: classes.progressSubItems, style: { maxHeight: isExpanded ? "500px" : "0", opacity: isExpanded ? 1 : 0 }, children: questionSteps.map((step, idx) => (jsxs("div", { className: classes.progressSubItem, children: [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 }) }))] })] }));
7667
+ 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, {}), "Reasoning..."] })), hasSubItems && isExpanded && (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(TypewriterText, { 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 }) }))] })] }));
7612
7668
  };
7613
7669
  const Steps = ({ steps, questions = [], questionsStepsMap = {}, stepFormDataMap = {}, isFormDisabled = false, activeFormIntent = null, isRestreaming = false }) => {
7614
7670
  const classes = useStyles$2();
@@ -11629,7 +11685,6 @@ const SmartBot = (props) => {
11629
11685
  useEffect(() => {
11630
11686
  const handleStepFormStreamStart = () => {
11631
11687
  setIsStop(true);
11632
- const { stepFormStreamControl } = require("./components/message-template/components/message-content/ButtonContent");
11633
11688
  const abortStepFormStream = () => {
11634
11689
  if (stepFormStreamControl.abort) {
11635
11690
  stepFormStreamControl.abort();