impact-chatbot 2.3.78 → 2.3.79
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.
|
@@ -8,10 +8,12 @@ export declare const stepFormStreamControl: {
|
|
|
8
8
|
initValue: boolean;
|
|
9
9
|
uniqueChatId: string;
|
|
10
10
|
};
|
|
11
|
-
declare const ButtonContent: ({ bodyText, isFormDisabled, isStepFormSubmit, isFormValid }: {
|
|
11
|
+
declare const ButtonContent: ({ bodyText, isFormDisabled, isStepFormSubmit, isFormValid, formParamNames, messageIndex }: {
|
|
12
12
|
bodyText: any;
|
|
13
13
|
isFormDisabled?: boolean;
|
|
14
14
|
isStepFormSubmit?: boolean;
|
|
15
15
|
isFormValid?: boolean;
|
|
16
|
+
formParamNames?: any[];
|
|
17
|
+
messageIndex?: number;
|
|
16
18
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
17
19
|
export default ButtonContent;
|
package/dist/index.cjs.js
CHANGED
|
@@ -5509,7 +5509,7 @@ const useStyles$8 = styles.makeStyles((theme) => ({
|
|
|
5509
5509
|
}));
|
|
5510
5510
|
const MAX_RETRY_COUNT_BUTTON = 1;
|
|
5511
5511
|
const RETRY_COUNTDOWN_SECONDS_BUTTON = 15;
|
|
5512
|
-
const ButtonContent = ({ bodyText, isFormDisabled = false, isStepFormSubmit = false, isFormValid = true }) => {
|
|
5512
|
+
const ButtonContent = ({ bodyText, isFormDisabled = false, isStepFormSubmit = false, isFormValid = true, formParamNames = [], messageIndex = 0 }) => {
|
|
5513
5513
|
const classes = useStyles$8();
|
|
5514
5514
|
const dispatch = reactRedux.useDispatch();
|
|
5515
5515
|
const sourceRef = React.useRef(null);
|
|
@@ -5535,19 +5535,56 @@ const ButtonContent = ({ bodyText, isFormDisabled = false, isStepFormSubmit = fa
|
|
|
5535
5535
|
status: "",
|
|
5536
5536
|
});
|
|
5537
5537
|
const chatbotContext = reactRedux.useSelector((state) => state.smartBotReducer.chatbotContext);
|
|
5538
|
+
const chatbotContextRef = React.useRef(chatbotContext);
|
|
5539
|
+
chatbotContextRef.current = chatbotContext;
|
|
5540
|
+
const persistedFormValues = reactRedux.useSelector((state) => state.smartBotReducer.persistedFormValues);
|
|
5541
|
+
const persistedFormValuesRef = React.useRef(persistedFormValues);
|
|
5542
|
+
persistedFormValuesRef.current = persistedFormValues;
|
|
5538
5543
|
const thinkingContext = reactRedux.useSelector((state) => state.smartBotReducer.thinkingContext);
|
|
5539
5544
|
const handleButtonClick = (button) => {
|
|
5540
5545
|
if (isStepFormSubmit) {
|
|
5541
|
-
//
|
|
5546
|
+
// Read the latest chatbotContext from ref to avoid stale closures
|
|
5547
|
+
const currentContext = chatbotContextRef.current;
|
|
5548
|
+
const currentPersisted = persistedFormValuesRef.current;
|
|
5549
|
+
// Build the user_input ONLY from formParamNames (current form's fields)
|
|
5542
5550
|
const userInput = {};
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
|
|
5551
|
+
if (formParamNames.length > 0) {
|
|
5552
|
+
formParamNames.forEach((paramName) => {
|
|
5553
|
+
// Primary source: chatbotContext (set by handleChange in form components)
|
|
5554
|
+
if (currentContext[paramName]?.updated) {
|
|
5555
|
+
let value = currentContext[paramName][paramName];
|
|
5556
|
+
userInput[paramName] = isArray$1(value)
|
|
5557
|
+
? value
|
|
5558
|
+
: typeof value === 'number' ? value : String(value);
|
|
5559
|
+
}
|
|
5560
|
+
else {
|
|
5561
|
+
// Fallback: persistedFormValues (covers edge case where chatbotContext
|
|
5562
|
+
// was cleared but the form still has a valid selection displayed)
|
|
5563
|
+
const persistedKey = `${messageIndex}_${paramName}`;
|
|
5564
|
+
const persistedValue = currentPersisted[persistedKey];
|
|
5565
|
+
if (persistedValue !== undefined && persistedValue !== null) {
|
|
5566
|
+
// For select components, persistedFormValues stores option objects
|
|
5567
|
+
if (isArray$1(persistedValue)) {
|
|
5568
|
+
userInput[paramName] = persistedValue.map((opt) => opt.value !== undefined ? opt.value : opt);
|
|
5569
|
+
}
|
|
5570
|
+
else {
|
|
5571
|
+
userInput[paramName] = typeof persistedValue === 'number' ? persistedValue : String(persistedValue);
|
|
5572
|
+
}
|
|
5573
|
+
}
|
|
5574
|
+
}
|
|
5575
|
+
});
|
|
5576
|
+
}
|
|
5577
|
+
else {
|
|
5578
|
+
// Legacy fallback: no formParamNames provided, iterate chatbotContext
|
|
5579
|
+
for (const key in currentContext) {
|
|
5580
|
+
if (key.startsWith('__'))
|
|
5581
|
+
continue;
|
|
5582
|
+
if (currentContext[key]?.updated) {
|
|
5583
|
+
let value = currentContext[key][key];
|
|
5584
|
+
userInput[key] = isArray$1(value)
|
|
5585
|
+
? value
|
|
5586
|
+
: typeof value === 'number' ? value : String(value);
|
|
5587
|
+
}
|
|
5551
5588
|
}
|
|
5552
5589
|
}
|
|
5553
5590
|
dispatch(smartBotActions.setChatbotContext({}));
|
|
@@ -5885,6 +5922,8 @@ const TableContent = ({ bodyText }) => {
|
|
|
5885
5922
|
const [isModalOpen, setIsModalOpen] = React.useState(false);
|
|
5886
5923
|
const [downloadUrl, setDownloadUrl] = React.useState("");
|
|
5887
5924
|
const chatbotContext = reactRedux.useSelector((state) => state.smartBotReducer.chatbotContext);
|
|
5925
|
+
const chatbotContextRef = React.useRef(chatbotContext);
|
|
5926
|
+
chatbotContextRef.current = chatbotContext;
|
|
5888
5927
|
const dispatch = reactRedux.useDispatch();
|
|
5889
5928
|
React.useEffect(() => {
|
|
5890
5929
|
let formattedColumns = getFormattedTableConfig(table_config);
|
|
@@ -5930,9 +5969,10 @@ const TableContent = ({ bodyText }) => {
|
|
|
5930
5969
|
const onSelectionChanged = (event) => {
|
|
5931
5970
|
try {
|
|
5932
5971
|
const selectedList = event.api.getSelectedRows();
|
|
5972
|
+
const latestContext = chatbotContextRef.current;
|
|
5933
5973
|
dispatch(smartBotActions.setChatbotContext({
|
|
5934
|
-
...
|
|
5935
|
-
tables: { ...
|
|
5974
|
+
...latestContext,
|
|
5975
|
+
tables: { ...latestContext?.tables, [table_name]: selectedList },
|
|
5936
5976
|
}));
|
|
5937
5977
|
}
|
|
5938
5978
|
catch (error) {
|
|
@@ -6803,6 +6843,8 @@ const SliderContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
6803
6843
|
const formKey = `${messageIndex}_${bodyText?.paramName}`;
|
|
6804
6844
|
const { header, headerOrentiation, inputPosition, label, max, min, required, disabled, } = bodyText;
|
|
6805
6845
|
const chatbotContext = reactRedux.useSelector((state) => state.smartBotReducer.chatbotContext);
|
|
6846
|
+
const chatbotContextRef = React.useRef(chatbotContext);
|
|
6847
|
+
chatbotContextRef.current = chatbotContext;
|
|
6806
6848
|
const persistedFormValues = reactRedux.useSelector((state) => state.smartBotReducer.persistedFormValues);
|
|
6807
6849
|
const dispatch = reactRedux.useDispatch();
|
|
6808
6850
|
const [sliderValue, setSliderValue] = React.useState(persistedFormValues[formKey] !== undefined ? persistedFormValues[formKey] : 0);
|
|
@@ -6810,16 +6852,18 @@ const SliderContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
6810
6852
|
return null;
|
|
6811
6853
|
const handleChange = (value) => {
|
|
6812
6854
|
try {
|
|
6813
|
-
|
|
6855
|
+
const newValue = value?.target?.value;
|
|
6856
|
+
setSliderValue(newValue);
|
|
6857
|
+
const latestContext = chatbotContextRef.current;
|
|
6814
6858
|
dispatch(smartBotActions.setChatbotContext({
|
|
6815
|
-
...
|
|
6859
|
+
...latestContext,
|
|
6816
6860
|
[bodyText?.paramName]: {
|
|
6817
|
-
...
|
|
6818
|
-
[bodyText?.paramName]:
|
|
6861
|
+
...latestContext?.[bodyText?.paramName],
|
|
6862
|
+
[bodyText?.paramName]: newValue,
|
|
6819
6863
|
updated: true,
|
|
6820
6864
|
},
|
|
6821
6865
|
}));
|
|
6822
|
-
dispatch(smartBotActions.setPersistedFormValues({ [formKey]:
|
|
6866
|
+
dispatch(smartBotActions.setPersistedFormValues({ [formKey]: newValue }));
|
|
6823
6867
|
}
|
|
6824
6868
|
catch (error) {
|
|
6825
6869
|
console.error("Error in slider handleChange", error);
|
|
@@ -6855,6 +6899,8 @@ const SelectContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
6855
6899
|
const searchTermRef = React.useRef("");
|
|
6856
6900
|
const selectAllCountRef = React.useRef(persistedFormValues?.[selectAllKey] || 0);
|
|
6857
6901
|
const chatbotContext = reactRedux.useSelector((state) => state.smartBotReducer.chatbotContext);
|
|
6902
|
+
const chatbotContextRef = React.useRef(chatbotContext);
|
|
6903
|
+
chatbotContextRef.current = chatbotContext;
|
|
6858
6904
|
const heirarchyKeyValuePairs = reactRedux.useSelector((state) => state.smartBotReducer.heirarchyKeyValuePairs);
|
|
6859
6905
|
const dispatch = reactRedux.useDispatch();
|
|
6860
6906
|
// Cross-filter cascading context (optional — graceful fallback when not wrapped)
|
|
@@ -6872,10 +6918,11 @@ const SelectContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
6872
6918
|
else {
|
|
6873
6919
|
value = selectedOptions.value;
|
|
6874
6920
|
}
|
|
6921
|
+
const latestContext = chatbotContextRef.current;
|
|
6875
6922
|
const updatedContext = {
|
|
6876
|
-
...
|
|
6923
|
+
...latestContext,
|
|
6877
6924
|
[bodyText?.paramName]: {
|
|
6878
|
-
...
|
|
6925
|
+
...latestContext?.[bodyText?.paramName],
|
|
6879
6926
|
[bodyText?.paramName]: value,
|
|
6880
6927
|
updated: true,
|
|
6881
6928
|
},
|
|
@@ -6925,10 +6972,11 @@ const SelectContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
6925
6972
|
setCurrentSelectedOptions([]);
|
|
6926
6973
|
setIsAllSelected(false);
|
|
6927
6974
|
// Also clear from chatbotContext and persistedFormValues
|
|
6975
|
+
const ctx = chatbotContextRef.current;
|
|
6928
6976
|
dispatch(smartBotActions.setChatbotContext({
|
|
6929
|
-
...
|
|
6977
|
+
...ctx,
|
|
6930
6978
|
[bodyText?.paramName]: {
|
|
6931
|
-
...
|
|
6979
|
+
...ctx?.[bodyText?.paramName],
|
|
6932
6980
|
[bodyText?.paramName]: [],
|
|
6933
6981
|
updated: true,
|
|
6934
6982
|
},
|
|
@@ -6986,10 +7034,11 @@ const SelectContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
6986
7034
|
isRequired: isRequired, isDisabled: isDisabled || isFormDisabled, isClearable: !(isDisabled || isFormDisabled), onClearAll: () => {
|
|
6987
7035
|
setCurrentSelectedOptions([]);
|
|
6988
7036
|
setIsAllSelected(false);
|
|
7037
|
+
const ctx1 = chatbotContextRef.current;
|
|
6989
7038
|
dispatch(smartBotActions.setChatbotContext({
|
|
6990
|
-
...
|
|
7039
|
+
...ctx1,
|
|
6991
7040
|
[bodyText?.paramName]: {
|
|
6992
|
-
...
|
|
7041
|
+
...ctx1?.[bodyText?.paramName],
|
|
6993
7042
|
[bodyText?.paramName]: [],
|
|
6994
7043
|
updated: true,
|
|
6995
7044
|
},
|
|
@@ -7068,10 +7117,11 @@ const SelectContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
7068
7117
|
selectAllCountRef.current = allOptionsRef.current.length;
|
|
7069
7118
|
}
|
|
7070
7119
|
setIsAllSelected(true);
|
|
7120
|
+
const ctx2 = chatbotContextRef.current;
|
|
7071
7121
|
dispatch(smartBotActions.setChatbotContext({
|
|
7072
|
-
...
|
|
7122
|
+
...ctx2,
|
|
7073
7123
|
[bodyText?.paramName]: {
|
|
7074
|
-
...
|
|
7124
|
+
...ctx2?.[bodyText?.paramName],
|
|
7075
7125
|
[bodyText?.paramName]: valuesToDispatch,
|
|
7076
7126
|
updated: true,
|
|
7077
7127
|
},
|
|
@@ -7089,10 +7139,11 @@ const SelectContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
7089
7139
|
else {
|
|
7090
7140
|
setCurrentSelectedOptions([]);
|
|
7091
7141
|
setIsAllSelected(false);
|
|
7142
|
+
const ctx3 = chatbotContextRef.current;
|
|
7092
7143
|
dispatch(smartBotActions.setChatbotContext({
|
|
7093
|
-
...
|
|
7144
|
+
...ctx3,
|
|
7094
7145
|
[bodyText?.paramName]: {
|
|
7095
|
-
...
|
|
7146
|
+
...ctx3?.[bodyText?.paramName],
|
|
7096
7147
|
[bodyText?.paramName]: [],
|
|
7097
7148
|
updated: true,
|
|
7098
7149
|
},
|
|
@@ -7114,6 +7165,8 @@ const DatePickerContent = ({ bodyText, isFormDisabled = false, messageIndex }) =
|
|
|
7114
7165
|
const formKey = `${messageIndex}_${bodyText?.paramName}`;
|
|
7115
7166
|
const { displayFormat, label, isRequired, labelOrientation, placeholder, minDate, maxDate, isDisabled, minStartDate, } = bodyText;
|
|
7116
7167
|
const chatbotContext = reactRedux.useSelector((state) => state.smartBotReducer.chatbotContext);
|
|
7168
|
+
const chatbotContextRef = React.useRef(chatbotContext);
|
|
7169
|
+
chatbotContextRef.current = chatbotContext;
|
|
7117
7170
|
const persistedFormValues = reactRedux.useSelector((state) => state.smartBotReducer.persistedFormValues);
|
|
7118
7171
|
const dispatch = reactRedux.useDispatch();
|
|
7119
7172
|
const [selectedDate, setSelectedDate] = React.useState(persistedFormValues[formKey] || null);
|
|
@@ -7122,10 +7175,11 @@ const DatePickerContent = ({ bodyText, isFormDisabled = false, messageIndex }) =
|
|
|
7122
7175
|
const handleDateChange = (date) => {
|
|
7123
7176
|
try {
|
|
7124
7177
|
setSelectedDate(date);
|
|
7178
|
+
const latestContext = chatbotContextRef.current;
|
|
7125
7179
|
dispatch(smartBotActions.setChatbotContext({
|
|
7126
|
-
...
|
|
7180
|
+
...latestContext,
|
|
7127
7181
|
[bodyText?.paramName]: {
|
|
7128
|
-
...
|
|
7182
|
+
...latestContext?.[bodyText?.paramName],
|
|
7129
7183
|
[bodyText?.paramName]: moment(date).format(displayFormat),
|
|
7130
7184
|
updated: true,
|
|
7131
7185
|
},
|
|
@@ -7153,6 +7207,8 @@ const DateRangePickerContent = ({ bodyText, isFormDisabled = false, messageIndex
|
|
|
7153
7207
|
const formKey = `${messageIndex}_${bodyText?.paramName}`;
|
|
7154
7208
|
const { displayFormat, label, isRequired, labelOrientation, minDate, maxDate, isDisabled, showMonthYearSelect, minStartDate, } = bodyText;
|
|
7155
7209
|
const chatbotContext = reactRedux.useSelector((state) => state.smartBotReducer.chatbotContext);
|
|
7210
|
+
const chatbotContextRef = React.useRef(chatbotContext);
|
|
7211
|
+
chatbotContextRef.current = chatbotContext;
|
|
7156
7212
|
const persistedFormValues = reactRedux.useSelector((state) => state.smartBotReducer.persistedFormValues);
|
|
7157
7213
|
const dispatch = reactRedux.useDispatch();
|
|
7158
7214
|
const [startDate, setStartDate] = React.useState(persistedFormValues[formKey]?.startDate || null);
|
|
@@ -7163,10 +7219,11 @@ const DateRangePickerContent = ({ bodyText, isFormDisabled = false, messageIndex
|
|
|
7163
7219
|
try {
|
|
7164
7220
|
setStartDate(start);
|
|
7165
7221
|
setEndDate(end);
|
|
7222
|
+
const latestContext = chatbotContextRef.current;
|
|
7166
7223
|
dispatch(smartBotActions.setChatbotContext({
|
|
7167
|
-
...
|
|
7224
|
+
...latestContext,
|
|
7168
7225
|
[bodyText?.paramName]: {
|
|
7169
|
-
...
|
|
7226
|
+
...latestContext?.[bodyText?.paramName],
|
|
7170
7227
|
[bodyText?.paramName]: {
|
|
7171
7228
|
startDate: start ? moment(start).format(displayFormat) : null,
|
|
7172
7229
|
endDate: end ? moment(end).format(displayFormat) : null,
|
|
@@ -7201,6 +7258,8 @@ const CheckboxContent = ({ bodyText, isFormDisabled = false, messageIndex }) =>
|
|
|
7201
7258
|
const formKey = `${messageIndex}_${bodyText?.paramName}`;
|
|
7202
7259
|
const { label, checked: checkedValue, required, disabled, } = bodyText;
|
|
7203
7260
|
const chatbotContext = reactRedux.useSelector((state) => state.smartBotReducer.chatbotContext);
|
|
7261
|
+
const chatbotContextRef = React.useRef(chatbotContext);
|
|
7262
|
+
chatbotContextRef.current = chatbotContext;
|
|
7204
7263
|
const persistedFormValues = reactRedux.useSelector((state) => state.smartBotReducer.persistedFormValues);
|
|
7205
7264
|
const dispatch = reactRedux.useDispatch();
|
|
7206
7265
|
const [checked, setChecked] = React.useState(persistedFormValues[formKey] !== undefined ? persistedFormValues[formKey] : checkedValue);
|
|
@@ -7209,15 +7268,11 @@ const CheckboxContent = ({ bodyText, isFormDisabled = false, messageIndex }) =>
|
|
|
7209
7268
|
const handleChange = (isChecked) => {
|
|
7210
7269
|
try {
|
|
7211
7270
|
setChecked(isChecked?.currentTarget?.checked);
|
|
7212
|
-
|
|
7213
|
-
// ...chatbotContext?.checkbox,
|
|
7214
|
-
// [bodyText?.paramName]: isChecked?.currentTarget?.checked,
|
|
7215
|
-
// updated: true
|
|
7216
|
-
// };
|
|
7271
|
+
const latestContext = chatbotContextRef.current;
|
|
7217
7272
|
dispatch(smartBotActions.setChatbotContext({
|
|
7218
|
-
...
|
|
7273
|
+
...latestContext,
|
|
7219
7274
|
[bodyText?.paramName]: {
|
|
7220
|
-
...
|
|
7275
|
+
...latestContext?.[bodyText?.paramName],
|
|
7221
7276
|
[bodyText?.paramName]: isChecked?.currentTarget?.checked,
|
|
7222
7277
|
updated: true,
|
|
7223
7278
|
},
|
|
@@ -7236,6 +7291,8 @@ const RadioContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
7236
7291
|
const classes = useStyles$a();
|
|
7237
7292
|
const { label, isDisabled, orientation, options } = bodyText;
|
|
7238
7293
|
const chatbotContext = reactRedux.useSelector((state) => state.smartBotReducer.chatbotContext);
|
|
7294
|
+
const chatbotContextRef = React.useRef(chatbotContext);
|
|
7295
|
+
chatbotContextRef.current = chatbotContext;
|
|
7239
7296
|
const persistedFormValues = reactRedux.useSelector((state) => state.smartBotReducer.persistedFormValues);
|
|
7240
7297
|
const dispatch = reactRedux.useDispatch();
|
|
7241
7298
|
const [selectedOption, setSelectedOption] = React.useState(persistedFormValues[formKey] ?? null);
|
|
@@ -7250,10 +7307,11 @@ const RadioContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
7250
7307
|
// [bodyText?.paramName]: value,
|
|
7251
7308
|
// updated: true,
|
|
7252
7309
|
// };
|
|
7310
|
+
const latestContext = chatbotContextRef.current;
|
|
7253
7311
|
dispatch(smartBotActions.setChatbotContext({
|
|
7254
|
-
...
|
|
7312
|
+
...latestContext,
|
|
7255
7313
|
[bodyText?.paramName]: {
|
|
7256
|
-
...
|
|
7314
|
+
...latestContext?.[bodyText?.paramName],
|
|
7257
7315
|
[bodyText?.paramName]: value,
|
|
7258
7316
|
updated: true,
|
|
7259
7317
|
},
|
|
@@ -7271,6 +7329,8 @@ const InputContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
7271
7329
|
const formKey = `${messageIndex}_${bodyText?.paramName}`;
|
|
7272
7330
|
const { label, placeholder, isRequired, isDisabled, inputType, labelOrientation, defaultValue, maxLength, minLength, } = bodyText;
|
|
7273
7331
|
const chatbotContext = reactRedux.useSelector((state) => state.smartBotReducer.chatbotContext);
|
|
7332
|
+
const chatbotContextRef = React.useRef(chatbotContext);
|
|
7333
|
+
chatbotContextRef.current = chatbotContext;
|
|
7274
7334
|
const persistedFormValues = reactRedux.useSelector((state) => state.smartBotReducer.persistedFormValues);
|
|
7275
7335
|
const dispatch = reactRedux.useDispatch();
|
|
7276
7336
|
const [value, setValue] = React.useState(persistedFormValues[formKey] !== undefined ? persistedFormValues[formKey] : (defaultValue || ""));
|
|
@@ -7280,10 +7340,11 @@ const InputContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
7280
7340
|
try {
|
|
7281
7341
|
const newValue = event?.target?.value || event?.currentTarget?.value || "";
|
|
7282
7342
|
setValue(newValue);
|
|
7343
|
+
const latestContext = chatbotContextRef.current;
|
|
7283
7344
|
dispatch(smartBotActions.setChatbotContext({
|
|
7284
|
-
...
|
|
7345
|
+
...latestContext,
|
|
7285
7346
|
[bodyText?.paramName]: {
|
|
7286
|
-
...
|
|
7347
|
+
...latestContext?.[bodyText?.paramName],
|
|
7287
7348
|
[bodyText?.paramName]: replaceSpecialCharToCharCode(newValue),
|
|
7288
7349
|
updated: true,
|
|
7289
7350
|
type: inputType,
|
|
@@ -7579,6 +7640,15 @@ const StepFormContent = ({ formData, messageIndex = 0, isFormDisabled = false, s
|
|
|
7579
7640
|
});
|
|
7580
7641
|
return selections;
|
|
7581
7642
|
}, [crossFilterConfigs, chatbotContext, persistedFormValues, messageIndex]);
|
|
7643
|
+
// Extract the param names of the current form's fields so ButtonContent
|
|
7644
|
+
// can restrict user_input to only these keys (avoids leaking stale context).
|
|
7645
|
+
const formParamNames = React.useMemo(() => {
|
|
7646
|
+
if (!formData || !Array.isArray(formData))
|
|
7647
|
+
return [];
|
|
7648
|
+
return formData
|
|
7649
|
+
.filter((item) => item?.type !== "button" && item?.data?.param_name)
|
|
7650
|
+
.map((item) => item.data.param_name);
|
|
7651
|
+
}, [formData]);
|
|
7582
7652
|
if (!formData || !Array.isArray(formData) || formData.length === 0) {
|
|
7583
7653
|
return null;
|
|
7584
7654
|
}
|
|
@@ -7606,7 +7676,7 @@ const StepFormContent = ({ formData, messageIndex = 0, isFormDisabled = false, s
|
|
|
7606
7676
|
case "radio":
|
|
7607
7677
|
return jsxRuntime.jsx(RadioContent, { bodyText: parsedData.bodyText, isFormDisabled: formFieldsDisabled, messageIndex: messageIndex }, key);
|
|
7608
7678
|
case "button":
|
|
7609
|
-
return jsxRuntime.jsx(ButtonContent, { bodyText: parsedData.bodyText, isFormDisabled: isFormDisabled || isFormSubmitted || isTimedOut, isStepFormSubmit: true, isFormValid: requiredFieldsFilled }, key);
|
|
7679
|
+
return jsxRuntime.jsx(ButtonContent, { bodyText: parsedData.bodyText, isFormDisabled: isFormDisabled || isFormSubmitted || isTimedOut, isStepFormSubmit: true, isFormValid: requiredFieldsFilled, formParamNames: formParamNames, messageIndex: messageIndex }, key);
|
|
7610
7680
|
case "input":
|
|
7611
7681
|
return jsxRuntime.jsx(InputContent, { bodyText: parsedData.bodyText, isFormDisabled: formFieldsDisabled, messageIndex: messageIndex }, key);
|
|
7612
7682
|
case "image":
|