@memori.ai/memori-react 8.21.0 → 8.23.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.
Files changed (63) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/components/DrawerFooter/DrawerFooter.css +63 -0
  3. package/dist/components/DrawerFooter/DrawerFooter.d.ts +12 -0
  4. package/dist/components/DrawerFooter/DrawerFooter.js +10 -0
  5. package/dist/components/DrawerFooter/DrawerFooter.js.map +1 -0
  6. package/dist/components/MemoriWidget/MemoriWidget.d.ts +4 -1
  7. package/dist/components/MemoriWidget/MemoriWidget.js +71 -87
  8. package/dist/components/MemoriWidget/MemoriWidget.js.map +1 -1
  9. package/dist/components/layouts/WebsiteAssistant.js +3 -3
  10. package/dist/components/layouts/WebsiteAssistant.js.map +1 -1
  11. package/dist/icons/FacebookIcon.d.ts +3 -0
  12. package/dist/icons/FacebookIcon.js +6 -0
  13. package/dist/icons/FacebookIcon.js.map +1 -0
  14. package/dist/icons/LinkedinIcon.d.ts +3 -0
  15. package/dist/icons/LinkedinIcon.js +6 -0
  16. package/dist/icons/LinkedinIcon.js.map +1 -0
  17. package/dist/icons/TelegramIcon.d.ts +3 -0
  18. package/dist/icons/TelegramIcon.js +6 -0
  19. package/dist/icons/TelegramIcon.js.map +1 -0
  20. package/dist/icons/TwitterIcon.d.ts +3 -0
  21. package/dist/icons/TwitterIcon.js +6 -0
  22. package/dist/icons/TwitterIcon.js.map +1 -0
  23. package/dist/icons/WhatsappIcon.d.ts +3 -0
  24. package/dist/icons/WhatsappIcon.js +6 -0
  25. package/dist/icons/WhatsappIcon.js.map +1 -0
  26. package/dist/index.js +6 -2
  27. package/dist/index.js.map +1 -1
  28. package/dist/version.d.ts +1 -1
  29. package/dist/version.js +1 -1
  30. package/esm/components/DrawerFooter/DrawerFooter.css +63 -0
  31. package/esm/components/DrawerFooter/DrawerFooter.d.ts +12 -0
  32. package/esm/components/DrawerFooter/DrawerFooter.js +8 -0
  33. package/esm/components/DrawerFooter/DrawerFooter.js.map +1 -0
  34. package/esm/components/MemoriWidget/MemoriWidget.d.ts +4 -1
  35. package/esm/components/MemoriWidget/MemoriWidget.js +71 -87
  36. package/esm/components/MemoriWidget/MemoriWidget.js.map +1 -1
  37. package/esm/components/layouts/WebsiteAssistant.js +3 -3
  38. package/esm/components/layouts/WebsiteAssistant.js.map +1 -1
  39. package/esm/icons/FacebookIcon.d.ts +3 -0
  40. package/esm/icons/FacebookIcon.js +4 -0
  41. package/esm/icons/FacebookIcon.js.map +1 -0
  42. package/esm/icons/LinkedinIcon.d.ts +3 -0
  43. package/esm/icons/LinkedinIcon.js +4 -0
  44. package/esm/icons/LinkedinIcon.js.map +1 -0
  45. package/esm/icons/TelegramIcon.d.ts +3 -0
  46. package/esm/icons/TelegramIcon.js +4 -0
  47. package/esm/icons/TelegramIcon.js.map +1 -0
  48. package/esm/icons/TwitterIcon.d.ts +3 -0
  49. package/esm/icons/TwitterIcon.js +4 -0
  50. package/esm/icons/TwitterIcon.js.map +1 -0
  51. package/esm/icons/WhatsappIcon.d.ts +3 -0
  52. package/esm/icons/WhatsappIcon.js +4 -0
  53. package/esm/icons/WhatsappIcon.js.map +1 -0
  54. package/esm/index.js +6 -2
  55. package/esm/index.js.map +1 -1
  56. package/esm/version.d.ts +1 -1
  57. package/esm/version.js +1 -1
  58. package/package.json +1 -1
  59. package/src/components/MemoriWidget/MemoriWidget.tsx +100 -102
  60. package/src/components/layouts/WebsiteAssistant.tsx +25 -22
  61. package/src/components/layouts/layouts.stories.tsx +21 -0
  62. package/src/index.tsx +5 -1
  63. package/src/version.ts +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
 
2
2
 
3
+ ## [8.23.0](https://github.com/memori-ai/memori-react/compare/v8.22.0...v8.23.0) (2026-03-16)
4
+
5
+
6
+ ### Features
7
+
8
+ * add avatar3dHidden prop to WebsiteAssistant layout ([8803b75](https://github.com/memori-ai/memori-react/commit/8803b751df3f34aff37af500a650b29ccb012218))
9
+
10
+
11
+ ### Changes
12
+
13
+ * dont send date event every minute, but when opening session and sending TextEntered ([25f083e](https://github.com/memori-ai/memori-react/commit/25f083efadb8d07b311e371739711eabcdffdc1b))
14
+
15
+ ## [8.22.0](https://github.com/memori-ai/memori-react/compare/v8.21.0...v8.22.0) (2026-03-02)
16
+
17
+
18
+ ### Features
19
+
20
+ * add uiLang and spokenLang props to MemoriWidget ([f066cd6](https://github.com/memori-ai/memori-react/commit/f066cd6a930bbcd6201801c8d96e20c5be454646))
21
+
3
22
  ## [8.21.0](https://github.com/memori-ai/memori-react/compare/v8.20.0...v8.21.0) (2026-02-27)
4
23
 
5
24
 
@@ -0,0 +1,63 @@
1
+ .memori-drawer-footer {
2
+ flex-shrink: 0;
3
+ padding: var(--memori-spacing-md);
4
+ border-top: 1px solid var(--memori-border-color, #e5e7eb);
5
+ background: var(--memori-main-background);
6
+ box-shadow: 0 -8px 24px -8px rgba(0, 0, 0, 0.06), 0 -2px 8px -2px rgba(0, 0, 0, 0.03);
7
+ }
8
+
9
+ .memori-drawer-footer__inner {
10
+ display: flex;
11
+ flex-direction: row;
12
+ flex-wrap: wrap;
13
+ align-items: center;
14
+ justify-content: space-between;
15
+ gap: var(--memori-spacing-lg);
16
+ }
17
+
18
+ .memori-drawer-footer__start {
19
+ display: flex;
20
+ align-items: center;
21
+ gap: var(--memori-spacing-md);
22
+ }
23
+
24
+ .memori-drawer-footer__end {
25
+ display: flex;
26
+ align-items: center;
27
+ justify-content: flex-end;
28
+ margin-left: auto;
29
+ gap: var(--memori-spacing-md);
30
+ }
31
+
32
+ .memori-drawer-footer__end .memori-button {
33
+ min-height: 44px;
34
+ padding: 10px var(--memori-spacing-lg);
35
+ border-radius: 10px;
36
+ font-weight: 500;
37
+ transition: transform 0.15s ease, box-shadow 0.15s ease;
38
+ }
39
+
40
+ .memori-drawer-footer__end .memori-button:hover:not([disabled]) {
41
+ transform: translateY(-1px);
42
+ }
43
+
44
+ .memori-drawer-footer__inner--centered {
45
+ justify-content: center;
46
+ }
47
+
48
+ @media (max-width: 768px) {
49
+ .memori-drawer-footer {
50
+ padding: var(--memori-spacing-md) var(--memori-spacing-lg);
51
+ }
52
+
53
+ .memori-drawer-footer__inner {
54
+ flex-direction: column;
55
+ align-items: stretch;
56
+ gap: var(--memori-spacing-md);
57
+ }
58
+
59
+ .memori-drawer-footer__end {
60
+ justify-content: flex-end;
61
+ margin-left: 0;
62
+ }
63
+ }
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ export interface DrawerFooterProps {
3
+ children?: React.ReactNode;
4
+ start?: React.ReactNode;
5
+ end?: React.ReactNode;
6
+ center?: React.ReactNode;
7
+ closeLabel?: string;
8
+ onClose?: () => void;
9
+ className?: string;
10
+ }
11
+ declare const DrawerFooter: React.FC<DrawerFooterProps>;
12
+ export default DrawerFooter;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const jsx_runtime_1 = require("react/jsx-runtime");
4
+ const ui_1 = require("@memori.ai/ui");
5
+ const DrawerFooter = ({ children, start, end, center, closeLabel, onClose, className = '', }) => {
6
+ const hasSlots = start != null || end != null || center != null || closeLabel != null;
7
+ return ((0, jsx_runtime_1.jsx)("footer", { className: `memori-drawer-footer ${className}`.trim(), role: "contentinfo", children: center != null ? ((0, jsx_runtime_1.jsx)("div", { className: "memori-drawer-footer__inner memori-drawer-footer__inner--centered", children: center })) : children != null && !hasSlots ? ((0, jsx_runtime_1.jsx)("div", { className: "memori-drawer-footer__inner memori-drawer-footer__inner--centered", children: children })) : ((0, jsx_runtime_1.jsxs)("div", { className: "memori-drawer-footer__inner", children: [start != null && ((0, jsx_runtime_1.jsx)("div", { className: "memori-drawer-footer__start", children: start })), (0, jsx_runtime_1.jsxs)("div", { className: "memori-drawer-footer__end", children: [end, closeLabel != null && onClose != null && ((0, jsx_runtime_1.jsx)(ui_1.Button, { variant: "primary", onClick: onClose, children: closeLabel }))] })] })) }));
8
+ };
9
+ exports.default = DrawerFooter;
10
+ //# sourceMappingURL=DrawerFooter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DrawerFooter.js","sourceRoot":"","sources":["../../../src/components/DrawerFooter/DrawerFooter.tsx"],"names":[],"mappings":";;;AACA,sCAAuC;AAgBvC,MAAM,YAAY,GAAgC,CAAC,EACjD,QAAQ,EACR,KAAK,EACL,GAAG,EACH,MAAM,EACN,UAAU,EACV,OAAO,EACP,SAAS,GAAG,EAAE,GACf,EAAE,EAAE;IACH,MAAM,QAAQ,GAAG,KAAK,IAAI,IAAI,IAAI,GAAG,IAAI,IAAI,IAAI,MAAM,IAAI,IAAI,IAAI,UAAU,IAAI,IAAI,CAAC;IAEtF,OAAO,CACL,mCACE,SAAS,EAAE,wBAAwB,SAAS,EAAE,CAAC,IAAI,EAAE,EACrD,IAAI,EAAC,aAAa,YAEjB,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,CAChB,gCAAK,SAAS,EAAC,mEAAmE,YAC/E,MAAM,GACH,CACP,CAAC,CAAC,CAAC,QAAQ,IAAI,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAClC,gCAAK,SAAS,EAAC,mEAAmE,YAC/E,QAAQ,GACL,CACP,CAAC,CAAC,CAAC,CACF,iCAAK,SAAS,EAAC,6BAA6B,aACzC,KAAK,IAAI,IAAI,IAAI,CAChB,gCAAK,SAAS,EAAC,6BAA6B,YAAE,KAAK,GAAO,CAC3D,EACD,iCAAK,SAAS,EAAC,2BAA2B,aACvC,GAAG,EACH,UAAU,IAAI,IAAI,IAAI,OAAO,IAAI,IAAI,IAAI,CACxC,uBAAC,WAAM,IAAC,OAAO,EAAC,SAAS,EAAC,OAAO,EAAE,OAAO,YACvC,UAAU,GACJ,CACV,IACG,IACF,CACP,GACM,CACV,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,YAAY,CAAC"}
@@ -79,6 +79,7 @@ export interface LayoutProps {
79
79
  loading?: boolean;
80
80
  autoStart?: boolean;
81
81
  onSidebarToggle?: (isOpen: boolean) => void;
82
+ avatar3dHidden?: boolean;
82
83
  }
83
84
  export interface Props {
84
85
  memori: Memori;
@@ -87,6 +88,8 @@ export interface Props {
87
88
  tenantID: string;
88
89
  memoriConfigs?: MemoriConfig[];
89
90
  memoriLang?: string;
91
+ uiLang?: string;
92
+ spokenLang?: string;
90
93
  multilingual?: boolean;
91
94
  integration?: Integration;
92
95
  layout?: LayoutName;
@@ -144,5 +147,5 @@ export interface Props {
144
147
  maxTotalMessagePayload?: number;
145
148
  maxTextareaCharacters?: number;
146
149
  }
147
- declare const MemoriWidget: ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenantID, memoriLang, multilingual, integration, layout, customLayout, showShare, preview, embed, showCopyButton, showTranslationOriginal, showInputs, showDates, showContextPerLine, showSettings, showTypingText, showClear, showLogin, showUpload, showOnlyLastMessages, showChatHistory, showReasoning, height, secret, baseUrl, apiURL, engineURL, initialContextVars, initialQuestion, ttsProvider, ogImage, sessionID: initialSessionID, tenant, personification, authToken, enableAudio, defaultSpeakerActive, disableTextEnteredEvents, onStateChange, additionalInfo, additionalSettings, customMediaRenderer, userAvatar, __WEBCOMPONENT__, useMathFormatting, autoStart, applyVarsToRoot, showFunctionCache, maxTotalMessagePayload, maxTextareaCharacters, }: Props) => JSX.Element;
150
+ declare const MemoriWidget: ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenantID, memoriLang, uiLang, spokenLang, multilingual, integration, layout, customLayout, showShare, preview, embed, showCopyButton, showTranslationOriginal, showInputs, showDates, showContextPerLine, showSettings, showTypingText, showClear, showLogin, showUpload, showOnlyLastMessages, showChatHistory, showReasoning, height, secret, baseUrl, apiURL, engineURL, initialContextVars, initialQuestion, ttsProvider, ogImage, sessionID: initialSessionID, tenant, personification, authToken, enableAudio, defaultSpeakerActive, disableTextEnteredEvents, onStateChange, additionalInfo, additionalSettings, customMediaRenderer, userAvatar, __WEBCOMPONENT__, useMathFormatting, autoStart, applyVarsToRoot, showFunctionCache, maxTotalMessagePayload, maxTextareaCharacters, }: Props) => JSX.Element;
148
151
  export default MemoriWidget;
@@ -158,15 +158,15 @@ window.typeBatchMessages = typeBatchMessages;
158
158
  let audioContext;
159
159
  let memoriPassword;
160
160
  let userToken;
161
- const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenantID, memoriLang, multilingual, integration, layout, customLayout, showShare, preview = false, embed = false, showCopyButton = true, showTranslationOriginal = false, showInputs = true, showDates = false, showContextPerLine = false, showSettings, showTypingText = false, showClear = false, showLogin = false, showUpload, showOnlyLastMessages, showChatHistory, showReasoning, height = '100vh', secret, baseUrl = 'https://aisuru-staging.aclambda.online', apiURL = 'https://backend-staging.memori.ai', engineURL = 'https://engine-staging.memori.ai', initialContextVars, initialQuestion, ttsProvider, ogImage, sessionID: initialSessionID, tenant, personification, authToken, enableAudio, defaultSpeakerActive = true, disableTextEnteredEvents = false, onStateChange, additionalInfo, additionalSettings, customMediaRenderer, userAvatar, __WEBCOMPONENT__ = false, useMathFormatting = false, autoStart = false, applyVarsToRoot = false, showFunctionCache = false, maxTotalMessagePayload, maxTextareaCharacters, }) => {
162
- var _a, _b, _c, _d, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17;
161
+ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenantID, memoriLang, uiLang, spokenLang, multilingual, integration, layout, customLayout, showShare, preview = false, embed = false, showCopyButton = true, showTranslationOriginal = false, showInputs = true, showDates = false, showContextPerLine = false, showSettings, showTypingText = false, showClear = false, showLogin = false, showUpload, showOnlyLastMessages, showChatHistory, showReasoning, height = '100vh', secret, baseUrl = 'https://aisuru-staging.aclambda.online', apiURL = 'https://backend-staging.memori.ai', engineURL = 'https://engine-staging.memori.ai', initialContextVars, initialQuestion, ttsProvider, ogImage, sessionID: initialSessionID, tenant, personification, authToken, enableAudio, defaultSpeakerActive = true, disableTextEnteredEvents = false, onStateChange, additionalInfo, additionalSettings, customMediaRenderer, userAvatar, __WEBCOMPONENT__ = false, useMathFormatting = false, autoStart = false, applyVarsToRoot = false, showFunctionCache = false, maxTotalMessagePayload, maxTextareaCharacters, }) => {
162
+ var _a, _b, _c, _d, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18;
163
163
  const { t, i18n } = (0, react_i18next_1.useTranslation)();
164
164
  const [isClient, setIsClient] = (0, react_1.useState)(false);
165
165
  (0, react_1.useEffect)(() => {
166
166
  setIsClient(true);
167
167
  }, []);
168
168
  const client = (0, memori_api_client_1.default)(apiURL, engineURL);
169
- const { initSession, deleteSession, postTextEnteredEvent, postPlaceChangedEvent, postDateChangedEvent, postTimeoutEvent, postTagChangedEvent, getSession, getExpertReferences, getSessionChatLogs, } = client;
169
+ const { initSession, deleteSession, postTextEnteredEvent, postPlaceChangedEvent, postDateChangedEvent, postTagChangedEvent, getSession, getExpertReferences, getSessionChatLogs, } = client;
170
170
  const [instruct, setInstruct] = (0, react_1.useState)(false);
171
171
  const [enableFocusChatInput, setEnableFocusChatInput] = (0, react_1.useState)(true);
172
172
  const [loginToken, setLoginToken] = (0, react_1.useState)((_a = additionalInfo === null || additionalInfo === void 0 ? void 0 : additionalInfo.loginToken) !== null && _a !== void 0 ? _a : authToken);
@@ -206,7 +206,12 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
206
206
  ? multilingual
207
207
  : !!(integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.multilanguage);
208
208
  const forcedTimeout = integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.forcedTimeout;
209
- const [userLang, setUserLang] = (0, react_1.useState)((_o = (_m = (_l = (_k = memoriLang !== null && memoriLang !== void 0 ? memoriLang : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.lang) !== null && _k !== void 0 ? _k : language) !== null && _l !== void 0 ? _l : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.uiLang) !== null && _m !== void 0 ? _m : i18n.language) !== null && _o !== void 0 ? _o : 'IT');
209
+ const [userLang, setUserLang] = (0, react_1.useState)((_p = (_o = (_m = (_l = (_k = spokenLang !== null && spokenLang !== void 0 ? spokenLang : memoriLang) !== null && _k !== void 0 ? _k : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.lang) !== null && _l !== void 0 ? _l : language) !== null && _m !== void 0 ? _m : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.uiLang) !== null && _o !== void 0 ? _o : i18n.language) !== null && _p !== void 0 ? _p : 'IT');
210
+ (0, react_1.useEffect)(() => {
211
+ if (spokenLang != null) {
212
+ setUserLang(spokenLang);
213
+ }
214
+ }, [spokenLang]);
210
215
  const applyMathFormatting = useMathFormatting !== undefined
211
216
  ? useMathFormatting
212
217
  : !!(integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.useMathFormatting);
@@ -215,12 +220,15 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
215
220
  (0, utils_1.installMathJax)();
216
221
  }, [applyMathFormatting]);
217
222
  (0, react_1.useEffect)(() => {
218
- if (isMultilanguageEnabled &&
219
- userLang &&
220
- constants_1.uiLanguages.includes(userLang.toLowerCase())) {
221
- i18n.changeLanguage(userLang.toLowerCase());
222
- }
223
- }, [userLang]);
223
+ const langToApply = uiLang && constants_1.uiLanguages.includes(uiLang.toLowerCase())
224
+ ? uiLang.toLowerCase()
225
+ : userLang && constants_1.uiLanguages.includes(userLang.toLowerCase())
226
+ ? userLang.toLowerCase()
227
+ : null;
228
+ if (langToApply && typeof (i18n === null || i18n === void 0 ? void 0 : i18n.changeLanguage) === 'function') {
229
+ i18n.changeLanguage(langToApply);
230
+ }
231
+ }, [uiLang, userLang]);
224
232
  const [loading, setLoading] = (0, react_1.useState)(false);
225
233
  const [memoriTyping, setMemoriTyping] = (0, react_1.useState)(false);
226
234
  const [typingText, setTypingText] = (0, react_1.useState)();
@@ -228,14 +236,24 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
228
236
  ? layout
229
237
  : typeof (integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.layout) === 'string'
230
238
  ? integrationConfig.layout
231
- : (_p = integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.layout) === null || _p === void 0 ? void 0 : _p.name;
239
+ : (_q = integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.layout) === null || _q === void 0 ? void 0 : _q.name;
232
240
  const selectedLayout = layoutName || 'DEFAULT';
233
241
  const piiDetection = typeof (integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.layout) === 'object' &&
234
242
  (integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.layout) !== null &&
235
- ((_r = (_q = integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.layout) === null || _q === void 0 ? void 0 : _q.piiDetection) === null || _r === void 0 ? void 0 : _r.enabled)
243
+ ((_s = (_r = integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.layout) === null || _r === void 0 ? void 0 : _r.piiDetection) === null || _s === void 0 ? void 0 : _s.enabled)
236
244
  ? integrationConfig.layout.piiDetection
237
245
  : undefined;
238
- const defaultEnableAudio = (_s = enableAudio !== null && enableAudio !== void 0 ? enableAudio : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.enableAudio) !== null && _s !== void 0 ? _s : true;
246
+ const layoutObj = typeof layout === 'object' && layout !== null ? layout : null;
247
+ const integrationLayoutObj = typeof (integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.layout) === 'object' &&
248
+ (integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.layout) !== null
249
+ ? integrationConfig.layout
250
+ : null;
251
+ const avatar3dHidden = selectedLayout === 'WEBSITE_ASSISTANT' &&
252
+ ((layoutObj === null || layoutObj === void 0 ? void 0 : layoutObj.avatar_3d_hidden) ===
253
+ true ||
254
+ (integrationLayoutObj === null || integrationLayoutObj === void 0 ? void 0 : integrationLayoutObj.avatar_3d_hidden) === true ||
255
+ (integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.avatar_3d_hidden) === true);
256
+ const defaultEnableAudio = (_t = enableAudio !== null && enableAudio !== void 0 ? enableAudio : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.enableAudio) !== null && _t !== void 0 ? _t : true;
239
257
  const [hasUserActivatedListening, setHasUserActivatedListening] = (0, react_1.useState)(false);
240
258
  const [hasUserTypedMessage, setHasUserTypedMessage] = (0, react_1.useState)(false);
241
259
  const [showPositionDrawer, setShowPositionDrawer] = (0, react_1.useState)(false);
@@ -366,6 +384,9 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
366
384
  ((_a = window.getMemoriState()) === null || _a === void 0 ? void 0 : _a.sessionID);
367
385
  if (!sessionID || !(text === null || text === void 0 ? void 0 : text.length))
368
386
  return;
387
+ if (memori.needsDateTime) {
388
+ await sendDateChangedEvent({ sessionID: sessionID });
389
+ }
369
390
  let msg = text;
370
391
  if (!hidden &&
371
392
  translate &&
@@ -376,9 +397,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
376
397
  }
377
398
  const mediaDocuments = media === null || media === void 0 ? void 0 : media.filter(m => { var _a; return m.type === 'document' && ((_a = m.properties) === null || _a === void 0 ? void 0 : _a.isAttachedFile); });
378
399
  if (mediaDocuments && mediaDocuments.length > 0) {
379
- const documentContents = mediaDocuments
380
- .map(doc => doc.content)
381
- .join(' ');
400
+ const documentContents = mediaDocuments.map(doc => doc.content).join(' ');
382
401
  msg = msg + ' ' + documentContents;
383
402
  }
384
403
  if (piiDetection === null || piiDetection === void 0 ? void 0 : piiDetection.enabled) {
@@ -485,14 +504,17 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
485
504
  });
486
505
  }
487
506
  else if (response.resultCode === 500 && response.resultMessage) {
488
- setHistory(h => [...h, {
507
+ setHistory(h => [
508
+ ...h,
509
+ {
489
510
  text: 'Error: ' + response.resultMessage,
490
511
  emitter: 'system',
491
512
  fromUser: false,
492
513
  initial: false,
493
514
  contextVars: {},
494
515
  date: new Date().toISOString(),
495
- }]);
516
+ },
517
+ ]);
496
518
  }
497
519
  else {
498
520
  console.warn('[SEND_MESSAGE]', response);
@@ -764,6 +786,12 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
764
786
  }
765
787
  if (position && memori.needsPosition)
766
788
  applyPosition(position, session.sessionID);
789
+ if (memori.needsDateTime) {
790
+ await sendDateChangedEvent({
791
+ sessionID: session.sessionID,
792
+ state: session === null || session === void 0 ? void 0 : session.currentState,
793
+ });
794
+ }
767
795
  setLoading(false);
768
796
  return {
769
797
  dialogState: session.currentState,
@@ -1034,53 +1062,6 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1034
1062
  });
1035
1063
  }
1036
1064
  }, [currentDialogState, memori.needsDateTime, sessionId]);
1037
- (0, react_1.useEffect)(() => {
1038
- if (sessionId && memori.needsDateTime) {
1039
- sendDateChangedEvent({ sessionID: sessionId, state: currentDialogState });
1040
- let datePolling = null;
1041
- let isTabVisible = !document.hidden;
1042
- const startDatePolling = () => {
1043
- if (datePolling) {
1044
- clearInterval(datePolling);
1045
- }
1046
- datePolling = setInterval(() => {
1047
- if (!document.hidden) {
1048
- sendDateChangedEvent({
1049
- sessionID: sessionId,
1050
- });
1051
- }
1052
- }, 60 * 1000);
1053
- };
1054
- const stopDatePolling = () => {
1055
- if (datePolling) {
1056
- clearInterval(datePolling);
1057
- datePolling = null;
1058
- }
1059
- };
1060
- const handleVisibilityChange = () => {
1061
- const isVisible = !document.hidden;
1062
- if (isVisible && !isTabVisible) {
1063
- sendDateChangedEvent({
1064
- sessionID: sessionId,
1065
- state: currentDialogState,
1066
- });
1067
- startDatePolling();
1068
- }
1069
- else if (!isVisible && isTabVisible) {
1070
- stopDatePolling();
1071
- }
1072
- isTabVisible = isVisible;
1073
- };
1074
- if (isTabVisible) {
1075
- startDatePolling();
1076
- }
1077
- document.addEventListener('visibilitychange', handleVisibilityChange);
1078
- return () => {
1079
- stopDatePolling();
1080
- document.removeEventListener('visibilitychange', handleVisibilityChange);
1081
- };
1082
- }
1083
- }, [memori.needsDateTime, sessionId]);
1084
1065
  const [userInteractionTimeout, setUserInteractionTimeout] = (0, react_1.useState)();
1085
1066
  const timeoutRef = (0, react_1.useRef)();
1086
1067
  const clearInteractionTimeout = () => {
@@ -1123,7 +1104,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1123
1104
  apiUrl: `${baseUrl}/api/tts`,
1124
1105
  continuousSpeech: continuousSpeech,
1125
1106
  preview: preview,
1126
- }, autoStart, defaultEnableAudio, (_t = defaultSpeakerActive !== null && defaultSpeakerActive !== void 0 ? defaultSpeakerActive : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.defaultSpeakerActive) !== null && _t !== void 0 ? _t : true);
1107
+ }, autoStart, defaultEnableAudio, (_u = defaultSpeakerActive !== null && defaultSpeakerActive !== void 0 ? defaultSpeakerActive : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.defaultSpeakerActive) !== null && _u !== void 0 ? _u : true);
1127
1108
  const shouldPlayAudio = (text) => {
1128
1109
  const currentSpeakerMuted = (0, configuration_1.getLocalConfig)('muteSpeaker', !defaultEnableAudio);
1129
1110
  console.log('[MemoriWidget] shouldPlayAudio', currentSpeakerMuted);
@@ -1261,7 +1242,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1261
1242
  ? {
1262
1243
  '--memori-chat-bubble-bg': '#fff',
1263
1244
  ...(integrationConfig && !instruct
1264
- ? { '--memori-text-color': (_u = integrationConfig.textColor) !== null && _u !== void 0 ? _u : '#000' }
1245
+ ? { '--memori-text-color': (_v = integrationConfig.textColor) !== null && _v !== void 0 ? _v : '#000' }
1265
1246
  : {}),
1266
1247
  ...((integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.buttonBgColor)
1267
1248
  ? {
@@ -1285,12 +1266,12 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1285
1266
  ? {
1286
1267
  '--memori-inner-bg': `rgba(${integrationConfig.innerBgColor === 'dark'
1287
1268
  ? '0, 0, 0'
1288
- : '255, 255, 255'}, ${(_v = integrationConfig.innerBgAlpha) !== null && _v !== void 0 ? _v : 0.4})`,
1269
+ : '255, 255, 255'}, ${(_w = integrationConfig.innerBgAlpha) !== null && _w !== void 0 ? _w : 0.4})`,
1289
1270
  '--memori-inner-content-pad': '1.5rem',
1290
1271
  '--memori-nav-bg-image': 'none',
1291
1272
  '--memori-nav-bg': `rgba(${integrationConfig.innerBgColor === 'dark'
1292
1273
  ? '0, 0, 0'
1293
- : '255, 255, 255'}, ${(_w = integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.innerBgAlpha) !== null && _w !== void 0 ? _w : 0.4})`,
1274
+ : '255, 255, 255'}, ${(_x = integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.innerBgAlpha) !== null && _x !== void 0 ? _x : 0.4})`,
1294
1275
  }
1295
1276
  : {
1296
1277
  '--memori-inner-content-pad': '0px',
@@ -1619,14 +1600,17 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1619
1600
  text: initialQuestion,
1620
1601
  });
1621
1602
  if (response.resultCode === 500 && response.resultMessage) {
1622
- setHistory(h => [...h, {
1603
+ setHistory(h => [
1604
+ ...h,
1605
+ {
1623
1606
  text: 'Error: ' + response.resultMessage,
1624
1607
  emitter: 'system',
1625
1608
  fromUser: false,
1626
1609
  initial: false,
1627
1610
  contextVars: {},
1628
1611
  date: new Date().toISOString(),
1629
- }]);
1612
+ },
1613
+ ]);
1630
1614
  setMemoriTyping(false);
1631
1615
  return;
1632
1616
  }
@@ -1758,12 +1742,12 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1758
1742
  const headerProps = {
1759
1743
  memori: {
1760
1744
  ...memori,
1761
- ownerUserID: (_y = (_x = memori.ownerUserID) !== null && _x !== void 0 ? _x : ownerUserID) !== null && _y !== void 0 ? _y : undefined,
1745
+ ownerUserID: (_z = (_y = memori.ownerUserID) !== null && _y !== void 0 ? _y : ownerUserID) !== null && _z !== void 0 ? _z : undefined,
1762
1746
  },
1763
1747
  apiClient: client,
1764
1748
  tenant,
1765
1749
  history,
1766
- showShare: (_z = showShare !== null && showShare !== void 0 ? showShare : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.showShare) !== null && _z !== void 0 ? _z : true,
1750
+ showShare: (_0 = showShare !== null && showShare !== void 0 ? showShare : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.showShare) !== null && _0 !== void 0 ? _0 : true,
1767
1751
  position,
1768
1752
  layout: selectedLayout,
1769
1753
  additionalSettings,
@@ -1771,19 +1755,19 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1771
1755
  setShowSettingsDrawer,
1772
1756
  setShowKnownFactsDrawer,
1773
1757
  setShowExpertsDrawer,
1774
- enableAudio: (_0 = enableAudio !== null && enableAudio !== void 0 ? enableAudio : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.enableAudio) !== null && _0 !== void 0 ? _0 : true,
1758
+ enableAudio: (_1 = enableAudio !== null && enableAudio !== void 0 ? enableAudio : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.enableAudio) !== null && _1 !== void 0 ? _1 : true,
1775
1759
  speakerMuted: speakerMuted !== null && speakerMuted !== void 0 ? speakerMuted : false,
1776
1760
  setSpeakerMuted: (mute) => {
1777
1761
  toggleMute(mute);
1778
1762
  },
1779
1763
  setShowChatHistoryDrawer,
1780
- showSettings: (_1 = showSettings !== null && showSettings !== void 0 ? showSettings : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.showSettings) !== null && _1 !== void 0 ? _1 : true,
1781
- showChatHistory: (_2 = showChatHistory !== null && showChatHistory !== void 0 ? showChatHistory : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.showChatHistory) !== null && _2 !== void 0 ? _2 : true,
1764
+ showSettings: (_2 = showSettings !== null && showSettings !== void 0 ? showSettings : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.showSettings) !== null && _2 !== void 0 ? _2 : true,
1765
+ showChatHistory: (_3 = showChatHistory !== null && showChatHistory !== void 0 ? showChatHistory : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.showChatHistory) !== null && _3 !== void 0 ? _3 : true,
1782
1766
  hasUserActivatedSpeak,
1783
1767
  showReload: selectedLayout === 'TOTEM',
1784
- showClear: (_3 = showClear !== null && showClear !== void 0 ? showClear : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.showClear) !== null && _3 !== void 0 ? _3 : false,
1768
+ showClear: (_4 = showClear !== null && showClear !== void 0 ? showClear : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.showClear) !== null && _4 !== void 0 ? _4 : false,
1785
1769
  clearHistory: () => setHistory(h => h.slice(-1)),
1786
- showLogin: (_4 = showLogin !== null && showLogin !== void 0 ? showLogin : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.showLogin) !== null && _4 !== void 0 ? _4 : memori.requireLoginToken,
1770
+ showLogin: (_5 = showLogin !== null && showLogin !== void 0 ? showLogin : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.showLogin) !== null && _5 !== void 0 ? _5 : memori.requireLoginToken,
1787
1771
  setShowLoginDrawer,
1788
1772
  loginToken,
1789
1773
  user,
@@ -1812,7 +1796,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1812
1796
  hasUserActivatedSpeak,
1813
1797
  isPlayingAudio: isPlayingAudio &&
1814
1798
  !speakerMuted &&
1815
- ((_5 = enableAudio !== null && enableAudio !== void 0 ? enableAudio : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.enableAudio) !== null && _5 !== void 0 ? _5 : true),
1799
+ ((_6 = enableAudio !== null && enableAudio !== void 0 ? enableAudio : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.enableAudio) !== null && _6 !== void 0 ? _6 : true),
1816
1800
  loading: !!memoriTyping,
1817
1801
  baseUrl,
1818
1802
  apiUrl: client.constants.BACKEND_URL,
@@ -1849,7 +1833,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1849
1833
  tenant,
1850
1834
  translateTo: isMultilanguageEnabled &&
1851
1835
  userLang.toUpperCase() !==
1852
- ((_10 = ((_9 = (_8 = (_7 = (_6 = memori.culture) === null || _6 === void 0 ? void 0 : _6.split('-')) === null || _7 === void 0 ? void 0 : _7[0]) !== null && _8 !== void 0 ? _8 : i18n.language) !== null && _9 !== void 0 ? _9 : 'IT')) === null || _10 === void 0 ? void 0 : _10.toUpperCase())
1836
+ ((_11 = ((_10 = (_9 = (_8 = (_7 = memori.culture) === null || _7 === void 0 ? void 0 : _7.split('-')) === null || _8 === void 0 ? void 0 : _8[0]) !== null && _9 !== void 0 ? _9 : i18n.language) !== null && _10 !== void 0 ? _10 : 'IT')) === null || _11 === void 0 ? void 0 : _11.toUpperCase())
1853
1837
  ? userLang
1854
1838
  : undefined,
1855
1839
  baseUrl,
@@ -1857,9 +1841,9 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1857
1841
  layout,
1858
1842
  memoriTyping,
1859
1843
  typingText,
1860
- showTypingText: (_11 = showTypingText !== null && showTypingText !== void 0 ? showTypingText : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.showTypingText) !== null && _11 !== void 0 ? _11 : false,
1844
+ showTypingText: (_12 = showTypingText !== null && showTypingText !== void 0 ? showTypingText : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.showTypingText) !== null && _12 !== void 0 ? _12 : false,
1861
1845
  history: showFullHistory ? history : history.slice(-2),
1862
- authToken: (_13 = (_12 = loginToken !== null && loginToken !== void 0 ? loginToken : userToken) !== null && _12 !== void 0 ? _12 : additionalInfo === null || additionalInfo === void 0 ? void 0 : additionalInfo.loginToken) !== null && _13 !== void 0 ? _13 : authToken,
1846
+ authToken: (_14 = (_13 = loginToken !== null && loginToken !== void 0 ? loginToken : userToken) !== null && _13 !== void 0 ? _13 : additionalInfo === null || additionalInfo === void 0 ? void 0 : additionalInfo.loginToken) !== null && _14 !== void 0 ? _14 : authToken,
1863
1847
  dialogState: currentDialogState,
1864
1848
  pushMessage,
1865
1849
  simulateUserPrompt,
@@ -1869,8 +1853,8 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1869
1853
  showUpload: enableUpload,
1870
1854
  showReasoning: enableReasoning,
1871
1855
  showWhyThisAnswer,
1872
- showCopyButton: (_14 = showCopyButton !== null && showCopyButton !== void 0 ? showCopyButton : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.showCopyButton) !== null && _14 !== void 0 ? _14 : true,
1873
- showTranslationOriginal: (_15 = showTranslationOriginal !== null && showTranslationOriginal !== void 0 ? showTranslationOriginal : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.showTranslationOriginal) !== null && _15 !== void 0 ? _15 : false,
1856
+ showCopyButton: (_15 = showCopyButton !== null && showCopyButton !== void 0 ? showCopyButton : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.showCopyButton) !== null && _15 !== void 0 ? _15 : true,
1857
+ showTranslationOriginal: (_16 = showTranslationOriginal !== null && showTranslationOriginal !== void 0 ? showTranslationOriginal : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.showTranslationOriginal) !== null && _16 !== void 0 ? _16 : false,
1874
1858
  client,
1875
1859
  instruct,
1876
1860
  preview,
@@ -1880,7 +1864,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1880
1864
  attachmentsMenuOpen,
1881
1865
  setAttachmentsMenuOpen,
1882
1866
  showInputs,
1883
- showMicrophone: !!ttsProvider && ((_16 = enableAudio !== null && enableAudio !== void 0 ? enableAudio : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.enableAudio) !== null && _16 !== void 0 ? _16 : true),
1867
+ showMicrophone: !!ttsProvider && ((_17 = enableAudio !== null && enableAudio !== void 0 ? enableAudio : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.enableAudio) !== null && _17 !== void 0 ? _17 : true),
1884
1868
  showFunctionCache,
1885
1869
  userMessage,
1886
1870
  onChangeUserMessage,
@@ -1938,7 +1922,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1938
1922
  }), "data-memori-name": memori === null || memori === void 0 ? void 0 : memori.name, "data-memori-id": memori === null || memori === void 0 ? void 0 : memori.engineMemoriID, "data-memori-secondary-id": memori === null || memori === void 0 ? void 0 : memori.memoriID, "data-memori-session-id": sessionId, "data-memori-integration": integration === null || integration === void 0 ? void 0 : integration.integrationID, "data-memori-engine-state": JSON.stringify({
1939
1923
  ...currentDialogState,
1940
1924
  sessionID: sessionId,
1941
- }), style: { height }, children: [(0, jsx_runtime_1.jsx)(Layout, { Header: Header_1.default, headerProps: headerProps, Avatar: Avatar_1.default, avatarProps: avatarProps, Chat: Chat_1.default, chatProps: chatProps, StartPanel: StartPanel_1.default, startPanelProps: startPanelProps, integrationStyle: integrationStyle, integrationBackground: integrationBackground, poweredBy: poweredBy, autoStart: autoStart, sessionId: sessionId, hasUserActivatedSpeak: hasUserActivatedSpeak, loading: loading }), (0, jsx_runtime_1.jsx)(ArtifactAPI_1.ArtifactAPIBridge, { pushMessage: (message) => {
1925
+ }), style: { height }, children: [(0, jsx_runtime_1.jsx)(Layout, { Header: Header_1.default, headerProps: headerProps, Avatar: Avatar_1.default, avatarProps: avatarProps, Chat: Chat_1.default, chatProps: chatProps, StartPanel: StartPanel_1.default, startPanelProps: startPanelProps, integrationStyle: integrationStyle, integrationBackground: integrationBackground, poweredBy: poweredBy, autoStart: autoStart, sessionId: sessionId, hasUserActivatedSpeak: hasUserActivatedSpeak, loading: loading, avatar3dHidden: avatar3dHidden }), (0, jsx_runtime_1.jsx)(ArtifactAPI_1.ArtifactAPIBridge, { pushMessage: (message) => {
1942
1926
  setHistory(history => {
1943
1927
  if (!history.length)
1944
1928
  return history;
@@ -1985,7 +1969,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1985
1969
  }
1986
1970
  throw error;
1987
1971
  });
1988
- }, minimumNumberOfRecoveryTokens: (_17 = memori === null || memori === void 0 ? void 0 : memori.minimumNumberOfRecoveryTokens) !== null && _17 !== void 0 ? _17 : 1 })), isClient && ((0, jsx_runtime_1.jsx)(AgeVerificationModal_1.default, { visible: showAgeVerification, minAge: minAge, onClose: birthDate => {
1972
+ }, minimumNumberOfRecoveryTokens: (_18 = memori === null || memori === void 0 ? void 0 : memori.minimumNumberOfRecoveryTokens) !== null && _18 !== void 0 ? _18 : 1 })), isClient && ((0, jsx_runtime_1.jsx)(AgeVerificationModal_1.default, { visible: showAgeVerification, minAge: minAge, onClose: birthDate => {
1989
1973
  var _a, _b, _c, _d;
1990
1974
  if (birthDate) {
1991
1975
  setBirthDate(birthDate);