@botfabrik/engine-webclient 4.98.3 → 4.99.0

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.
@@ -13,7 +13,7 @@
13
13
  <meta name="theme-color" content="#000000" />
14
14
  <meta name="google" content="notranslate" />
15
15
  <title>Bubble Chat Client</title>
16
- <script type="module" crossorigin src="./assets/index-ftNt4iKK.js"></script>
16
+ <script type="module" crossorigin src="./assets/index-BNK6aREC.js"></script>
17
17
  <link rel="stylesheet" crossorigin href="./assets/index-COE1v99P.css">
18
18
  </head>
19
19
 
@@ -1,6 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const flat_1 = require("flat");
4
+ const TRANSLATION_KEY = 'website-messenger';
3
5
  const setTranslations = (socket, bot, clientLocale, clientName) => {
4
- socket.emit('set-translations', clientLocale, bot.translation.getResourceBundle(clientLocale)[clientName] || {});
6
+ socket.emit('set-translations', clientLocale, getTranslationsByClient(bot, clientLocale, clientName));
7
+ };
8
+ const getTranslationsByClient = (bot, clientLocale, clientName) => {
9
+ const deprecatedTranslations = bot.translation.getResourceBundle(clientLocale)[clientName];
10
+ if (deprecatedTranslations) {
11
+ bot.logger.warn('Website-Messenger is using deprecated translation structure');
12
+ return deprecatedTranslations;
13
+ }
14
+ else {
15
+ const webMessengerTranslations = bot.translation.getResourceBundle(clientLocale)[TRANSLATION_KEY] || {};
16
+ const defaults = webMessengerTranslations['defaults'] || {};
17
+ const overrides = webMessengerTranslations['overrides']?.[clientName] || {};
18
+ const defaultFlat = (0, flat_1.flatten)(defaults);
19
+ const overrideFlat = (0, flat_1.flatten)(overrides);
20
+ const mergedTranslations = { ...defaultFlat, ...overrideFlat };
21
+ return mergedTranslations;
22
+ }
5
23
  };
6
24
  exports.default = setTranslations;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botfabrik/engine-webclient",
3
- "version": "4.98.3",
3
+ "version": "4.99.0",
4
4
  "description": "Webclient for Botfabriks Bot Engine",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -20,13 +20,14 @@
20
20
  "dev:embed": "tsx --watch ./run-embed-local.ts"
21
21
  },
22
22
  "dependencies": {
23
- "@botfabrik/engine-domain": "^4.98.2",
24
- "@botfabrik/engine-transcript-export": "^4.98.2",
25
- "@botfabrik/engine-utils": "^4.98.2",
23
+ "@botfabrik/engine-domain": "^4.98.4",
24
+ "@botfabrik/engine-transcript-export": "^4.98.4",
25
+ "@botfabrik/engine-utils": "^4.98.4",
26
26
  "@google-cloud/speech": "^7.2.0",
27
27
  "@node-saml/passport-saml": "^5.1.0",
28
28
  "accept-language-parser": "^1.5.0",
29
29
  "express": "^5.1.0",
30
+ "flat": "^6.0.1",
30
31
  "jsonwebtoken": "^9.0.2",
31
32
  "passport": "^0.7.0",
32
33
  "uuid": "^11.1.0"
@@ -43,5 +44,5 @@
43
44
  "tsx": "^4.20.5",
44
45
  "typescript": "5.9.2"
45
46
  },
46
- "gitHead": "10e79975cfab229ed35f2668e9cd91130155262e"
47
+ "gitHead": "46d18bc5c9ed34ab3dc1d13c1805c437e31a6732"
47
48
  }