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.cjs.js +98 -43
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +98 -43
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -6364,11 +6364,8 @@ const useStyles$3 = makeStyles((theme) => ({
|
|
|
6364
6364
|
progressSubItems: {
|
|
6365
6365
|
display: "flex",
|
|
6366
6366
|
flexDirection: "column",
|
|
6367
|
-
gap: pxToRem(
|
|
6368
|
-
marginTop: pxToRem(
|
|
6369
|
-
padding: `${pxToRem(8)} ${pxToRem(14)}`,
|
|
6370
|
-
background: colours.greys100,
|
|
6371
|
-
borderRadius: pxToRem(8),
|
|
6367
|
+
gap: pxToRem(12),
|
|
6368
|
+
marginTop: pxToRem(6),
|
|
6372
6369
|
transition: "opacity 0.3s ease",
|
|
6373
6370
|
overflow: "auto",
|
|
6374
6371
|
maxHeight: pxToRem(300),
|
|
@@ -6400,26 +6397,55 @@ const useStyles$3 = makeStyles((theme) => ({
|
|
|
6400
6397
|
},
|
|
6401
6398
|
},
|
|
6402
6399
|
progressSubItem: {
|
|
6403
|
-
|
|
6404
|
-
|
|
6405
|
-
|
|
6406
|
-
|
|
6407
|
-
|
|
6408
|
-
fontWeight: 400,
|
|
6409
|
-
lineHeight: pxToRem(20),
|
|
6410
|
-
color: colours.darkBlack,
|
|
6411
|
-
"&::before": {
|
|
6412
|
-
content: '"•"',
|
|
6413
|
-
flexShrink: 0,
|
|
6414
|
-
color: colours.darkBlack,
|
|
6415
|
-
fontSize: pxToRem(14),
|
|
6416
|
-
lineHeight: pxToRem(20),
|
|
6417
|
-
},
|
|
6400
|
+
fontFamily: "Manrope",
|
|
6401
|
+
fontSize: pxToRem(12),
|
|
6402
|
+
fontWeight: 600,
|
|
6403
|
+
lineHeight: pxToRem(18),
|
|
6404
|
+
color: "#888",
|
|
6418
6405
|
},
|
|
6419
6406
|
stepFormContainer: {
|
|
6420
6407
|
marginTop: pxToRem(8),
|
|
6421
6408
|
},
|
|
6422
6409
|
}));
|
|
6410
|
+
/**
|
|
6411
|
+
* Typewriter effect component — reveals text character by character.
|
|
6412
|
+
* Tracks already-animated text so the effect only plays once (survives remounts).
|
|
6413
|
+
*/
|
|
6414
|
+
const animatedTexts$1 = new Set();
|
|
6415
|
+
const TypewriterText$1 = ({ text, speed = 15 }) => {
|
|
6416
|
+
const alreadyAnimated = animatedTexts$1.has(text);
|
|
6417
|
+
const [displayed, setDisplayed] = React.useState(alreadyAnimated ? text : "");
|
|
6418
|
+
const indexRef = React.useRef(alreadyAnimated ? text?.length || 0 : 0);
|
|
6419
|
+
const prevTextRef = React.useRef(text || "");
|
|
6420
|
+
React.useEffect(() => {
|
|
6421
|
+
if (!text)
|
|
6422
|
+
return;
|
|
6423
|
+
// If already animated, show full text immediately
|
|
6424
|
+
if (animatedTexts$1.has(text)) {
|
|
6425
|
+
setDisplayed(text);
|
|
6426
|
+
return;
|
|
6427
|
+
}
|
|
6428
|
+
// If text changed, reset
|
|
6429
|
+
if (text !== prevTextRef.current) {
|
|
6430
|
+
prevTextRef.current = text;
|
|
6431
|
+
indexRef.current = 0;
|
|
6432
|
+
setDisplayed("");
|
|
6433
|
+
}
|
|
6434
|
+
const interval = setInterval(() => {
|
|
6435
|
+
indexRef.current += 1;
|
|
6436
|
+
if (indexRef.current >= text.length) {
|
|
6437
|
+
setDisplayed(text);
|
|
6438
|
+
animatedTexts$1.add(text);
|
|
6439
|
+
clearInterval(interval);
|
|
6440
|
+
}
|
|
6441
|
+
else {
|
|
6442
|
+
setDisplayed(text.slice(0, indexRef.current));
|
|
6443
|
+
}
|
|
6444
|
+
}, speed);
|
|
6445
|
+
return () => clearInterval(interval);
|
|
6446
|
+
}, [text, speed]);
|
|
6447
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, { children: displayed });
|
|
6448
|
+
};
|
|
6423
6449
|
/**
|
|
6424
6450
|
* Determines the overall status of a question based on its steps.
|
|
6425
6451
|
* - "completed": all steps are completed
|
|
@@ -6475,7 +6501,7 @@ const ProgressBarItem$1 = ({ question, questionSteps, isLast, classes, formData,
|
|
|
6475
6501
|
setIsExpanded(true);
|
|
6476
6502
|
}
|
|
6477
6503
|
}, [status, formData]);
|
|
6478
|
-
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, {}), "Reasoning..."] })), hasSubItems && isExpanded && (jsxRuntime.jsx("div", { className: classes.progressSubItems, style: {
|
|
6504
|
+
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, {}), "Reasoning..."] })), hasSubItems && isExpanded && (jsxRuntime.jsx("div", { className: classes.progressSubItems, style: { opacity: isExpanded ? 1 : 0 }, children: questionSteps.map((step, idx) => (jsxRuntime.jsx("div", { className: classes.progressSubItem, children: jsxRuntime.jsx(TypewriterText$1, { 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 }) }))] })] }));
|
|
6479
6505
|
};
|
|
6480
6506
|
const Steps$1 = ({ steps, setSteps, done, setTabValue, setDone, finalStepDone, setFinalStepDone, stepChange, currentMode, questions = [], questionsStepsMap = {}, stepFormDataMap = {}, isFormDisabled = false, }) => {
|
|
6481
6507
|
const classes = useStyles$3();
|
|
@@ -6868,6 +6894,10 @@ const StreamedContent = ({ botData }) => {
|
|
|
6868
6894
|
}
|
|
6869
6895
|
let intentSteps = lodash.cloneDeep(questionsStepsMapRef.current[currentIntent]);
|
|
6870
6896
|
if (newStep.header) {
|
|
6897
|
+
// Remove placeholder if it's the only entry — real step replaces it
|
|
6898
|
+
if (intentSteps.length === 1 && intentSteps[0].header === "Processing Request") {
|
|
6899
|
+
intentSteps = [];
|
|
6900
|
+
}
|
|
6871
6901
|
// Only add/update sub-steps that have a non-empty header
|
|
6872
6902
|
const existingIdx = intentSteps.findIndex((s) => s.header === newStep.header);
|
|
6873
6903
|
if (existingIdx !== -1) {
|
|
@@ -7525,11 +7555,8 @@ const useStyles$2 = makeStyles((theme) => ({
|
|
|
7525
7555
|
progressSubItems: {
|
|
7526
7556
|
display: "flex",
|
|
7527
7557
|
flexDirection: "column",
|
|
7528
|
-
gap: pxToRem(
|
|
7529
|
-
marginTop: pxToRem(
|
|
7530
|
-
padding: `${pxToRem(8)} ${pxToRem(14)}`,
|
|
7531
|
-
background: colours.greys100,
|
|
7532
|
-
borderRadius: pxToRem(8),
|
|
7558
|
+
gap: pxToRem(12),
|
|
7559
|
+
marginTop: pxToRem(6),
|
|
7533
7560
|
transition: "max-height 0.3s ease, opacity 0.3s ease",
|
|
7534
7561
|
overflow: "auto",
|
|
7535
7562
|
maxHeight: pxToRem(300),
|
|
@@ -7561,26 +7588,55 @@ const useStyles$2 = makeStyles((theme) => ({
|
|
|
7561
7588
|
},
|
|
7562
7589
|
},
|
|
7563
7590
|
progressSubItem: {
|
|
7564
|
-
|
|
7565
|
-
|
|
7566
|
-
|
|
7567
|
-
|
|
7568
|
-
|
|
7569
|
-
fontWeight: 400,
|
|
7570
|
-
lineHeight: pxToRem(20),
|
|
7571
|
-
color: colours.darkBlack,
|
|
7572
|
-
"&::before": {
|
|
7573
|
-
content: '"•"',
|
|
7574
|
-
flexShrink: 0,
|
|
7575
|
-
color: colours.darkBlack,
|
|
7576
|
-
fontSize: pxToRem(14),
|
|
7577
|
-
lineHeight: pxToRem(20),
|
|
7578
|
-
},
|
|
7591
|
+
fontFamily: "Manrope",
|
|
7592
|
+
fontSize: pxToRem(12),
|
|
7593
|
+
fontWeight: 600,
|
|
7594
|
+
lineHeight: pxToRem(18),
|
|
7595
|
+
color: "#888",
|
|
7579
7596
|
},
|
|
7580
7597
|
stepFormContainer: {
|
|
7581
7598
|
marginTop: pxToRem(8),
|
|
7582
7599
|
},
|
|
7583
7600
|
}));
|
|
7601
|
+
/**
|
|
7602
|
+
* Typewriter effect component — reveals text character by character.
|
|
7603
|
+
* Tracks already-animated text so the effect only plays once (survives remounts).
|
|
7604
|
+
*/
|
|
7605
|
+
const animatedTexts = new Set();
|
|
7606
|
+
const TypewriterText = ({ text, speed = 15 }) => {
|
|
7607
|
+
const alreadyAnimated = animatedTexts.has(text);
|
|
7608
|
+
const [displayed, setDisplayed] = React.useState(alreadyAnimated ? text : "");
|
|
7609
|
+
const indexRef = React.useRef(alreadyAnimated ? text?.length || 0 : 0);
|
|
7610
|
+
const prevTextRef = React.useRef(text || "");
|
|
7611
|
+
React.useEffect(() => {
|
|
7612
|
+
if (!text)
|
|
7613
|
+
return;
|
|
7614
|
+
// If already animated, show full text immediately
|
|
7615
|
+
if (animatedTexts.has(text)) {
|
|
7616
|
+
setDisplayed(text);
|
|
7617
|
+
return;
|
|
7618
|
+
}
|
|
7619
|
+
// If text changed, reset
|
|
7620
|
+
if (text !== prevTextRef.current) {
|
|
7621
|
+
prevTextRef.current = text;
|
|
7622
|
+
indexRef.current = 0;
|
|
7623
|
+
setDisplayed("");
|
|
7624
|
+
}
|
|
7625
|
+
const interval = setInterval(() => {
|
|
7626
|
+
indexRef.current += 1;
|
|
7627
|
+
if (indexRef.current >= text.length) {
|
|
7628
|
+
setDisplayed(text);
|
|
7629
|
+
animatedTexts.add(text);
|
|
7630
|
+
clearInterval(interval);
|
|
7631
|
+
}
|
|
7632
|
+
else {
|
|
7633
|
+
setDisplayed(text.slice(0, indexRef.current));
|
|
7634
|
+
}
|
|
7635
|
+
}, speed);
|
|
7636
|
+
return () => clearInterval(interval);
|
|
7637
|
+
}, [text, speed]);
|
|
7638
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, { children: displayed });
|
|
7639
|
+
};
|
|
7584
7640
|
/**
|
|
7585
7641
|
* Determines the overall status of a question based on its steps.
|
|
7586
7642
|
*/
|
|
@@ -7630,7 +7686,7 @@ const ProgressBarItem = ({ question, questionSteps, isLast, classes, formData, i
|
|
|
7630
7686
|
setIsExpanded(true);
|
|
7631
7687
|
}
|
|
7632
7688
|
}, [status, formData]);
|
|
7633
|
-
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, {}), "Reasoning..."] })), hasSubItems && isExpanded && (jsxRuntime.jsx("div", { className: classes.progressSubItems, style: { maxHeight: isExpanded ? "500px" : "0", opacity: isExpanded ? 1 : 0 }, children: questionSteps.map((step, idx) => (jsxRuntime.
|
|
7689
|
+
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, {}), "Reasoning..."] })), hasSubItems && isExpanded && (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(TypewriterText, { 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 }) }))] })] }));
|
|
7634
7690
|
};
|
|
7635
7691
|
const Steps = ({ steps, questions = [], questionsStepsMap = {}, stepFormDataMap = {}, isFormDisabled = false, activeFormIntent = null, isRestreaming = false }) => {
|
|
7636
7692
|
const classes = useStyles$2();
|
|
@@ -11651,7 +11707,6 @@ const SmartBot = (props) => {
|
|
|
11651
11707
|
React.useEffect(() => {
|
|
11652
11708
|
const handleStepFormStreamStart = () => {
|
|
11653
11709
|
setIsStop(true);
|
|
11654
|
-
const { stepFormStreamControl } = require("./components/message-template/components/message-content/ButtonContent");
|
|
11655
11710
|
const abortStepFormStream = () => {
|
|
11656
11711
|
if (stepFormStreamControl.abort) {
|
|
11657
11712
|
stepFormStreamControl.abort();
|