impact-chatbot 2.3.15 → 2.3.16
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 +20 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +20 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/utils/coreUtils.d.ts +7 -0
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -891,6 +891,25 @@ const replaceSpecialCharacter = (str) => {
|
|
|
891
891
|
return result;
|
|
892
892
|
}
|
|
893
893
|
};
|
|
894
|
+
/**
|
|
895
|
+
* @function
|
|
896
|
+
* @description Function is used to return string by replacing the special characters with respective key mapped to SPECIAL_CHARACTER_MAPPING
|
|
897
|
+
* @param {String} str
|
|
898
|
+
* @returns {String} key of mapped special character used in the string
|
|
899
|
+
*/
|
|
900
|
+
const replaceSpecialCharToCharCode = (str) => {
|
|
901
|
+
let re = new RegExp(`[${Object.values(SPECIAL_CHARACTER_MAPPING).join("")}]`, "g");
|
|
902
|
+
return str.replace(re, function (matched) {
|
|
903
|
+
let code;
|
|
904
|
+
for (const [key, value] of Object.entries(SPECIAL_CHARACTER_MAPPING)) {
|
|
905
|
+
if (value === matched) {
|
|
906
|
+
code = key;
|
|
907
|
+
return code;
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
return code;
|
|
911
|
+
});
|
|
912
|
+
};
|
|
894
913
|
|
|
895
914
|
/**
|
|
896
915
|
* Utility functions extracted from core/Utils/functions/utils.js
|
|
@@ -6774,7 +6793,7 @@ const InputContent = ({ bodyText }) => {
|
|
|
6774
6793
|
setValue(newValue);
|
|
6775
6794
|
chatbotContext[bodyText?.paramName] = {
|
|
6776
6795
|
...chatbotContext?.[bodyText?.paramName],
|
|
6777
|
-
[bodyText?.paramName]: newValue,
|
|
6796
|
+
[bodyText?.paramName]: replaceSpecialCharToCharCode(newValue),
|
|
6778
6797
|
updated: true,
|
|
6779
6798
|
type: inputType,
|
|
6780
6799
|
};
|