wingbot 3.44.3 → 3.44.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wingbot",
3
- "version": "3.44.3",
3
+ "version": "3.44.4",
4
4
  "description": "Enterprise Messaging Bot Conversation Engine",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -36,7 +36,8 @@ function getVoiceControlFromParams (params, lang = null) {
36
36
 
37
37
  voiceControlProps.forEach((prop) => {
38
38
  if (params[prop]) {
39
- voiceControl[prop] = getLanguageText(params[prop], lang);
39
+ // for voice control do not default to other languages
40
+ voiceControl[prop] = getLanguageText(params[prop], lang, true);
40
41
  }
41
42
  });
42
43
 
@@ -61,9 +61,10 @@ function isTextObjectEmpty (text) {
61
61
  /**
62
62
  * @param {Translations} translations
63
63
  * @param {string} [lang]
64
+ * @param {boolean} [disableDefaulting] - it will try to find translation for other language
64
65
  * @returns {null|string}
65
66
  */
66
- function getLanguageText (translations, lang = null) {
67
+ function getLanguageText (translations, lang = null, disableDefaulting = false) {
67
68
  let foundText;
68
69
 
69
70
  if (isArrayOfObjects(translations)) {
@@ -71,7 +72,7 @@ function getLanguageText (translations, lang = null) {
71
72
  // @ts-ignore
72
73
  foundText = translations.find((t) => t.l === lang);
73
74
  }
74
- if (isTextObjectEmpty(foundText)) {
75
+ if (isTextObjectEmpty(foundText) && !disableDefaulting) {
75
76
  // @ts-ignore
76
77
  foundText = translations.find((t) => !isTextObjectEmpty(t));
77
78
  }