@memori.ai/memori-react 9.0.0-alpha.10 → 9.0.0-alpha.12

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 (90) hide show
  1. package/CHANGELOG.md +268 -0
  2. package/dist/components/ChatBubble/ChatBubble.js +11 -23
  3. package/dist/components/ChatBubble/ChatBubble.js.map +1 -1
  4. package/dist/components/MemoriArtifactSystem/components/ArtifactActions/styles.css +0 -1
  5. package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.css +14 -14
  6. package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js +1 -1
  7. package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js.map +1 -1
  8. package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/components/TabSwitch.css +4 -0
  9. package/dist/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.js +1 -1
  10. package/dist/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.js.map +1 -1
  11. package/dist/components/MemoriWidget/MemoriWidget.js +115 -115
  12. package/dist/components/MemoriWidget/MemoriWidget.js.map +1 -1
  13. package/dist/components/PoweredBy/PoweredBy.css +1 -8
  14. package/dist/components/StartPanel/StartPanel.js +1 -1
  15. package/dist/components/StartPanel/StartPanel.js.map +1 -1
  16. package/dist/components/layouts/Chat.js +6 -1
  17. package/dist/components/layouts/Chat.js.map +1 -1
  18. package/dist/components/layouts/WebsiteAssistant/website-assistant.css +5 -5
  19. package/dist/components/layouts/chat.css +76 -1
  20. package/dist/components/layouts/fullpage.css +2 -2
  21. package/dist/components/layouts/hidden-chat.css +2 -2
  22. package/dist/components/layouts/zoomed-full-body.css +1 -1
  23. package/dist/helpers/media.js +18 -3
  24. package/dist/helpers/media.js.map +1 -1
  25. package/dist/index.js +16 -16
  26. package/dist/index.js.map +1 -1
  27. package/dist/styles.css +1 -1
  28. package/dist/version.d.ts +1 -1
  29. package/dist/version.js +1 -1
  30. package/esm/components/ChatBubble/ChatBubble.js +12 -24
  31. package/esm/components/ChatBubble/ChatBubble.js.map +1 -1
  32. package/esm/components/MemoriArtifactSystem/components/ArtifactActions/styles.css +0 -1
  33. package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.css +14 -14
  34. package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js +1 -1
  35. package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js.map +1 -1
  36. package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/components/TabSwitch.css +4 -0
  37. package/esm/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.js +2 -2
  38. package/esm/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.js.map +1 -1
  39. package/esm/components/MemoriWidget/MemoriWidget.js +116 -116
  40. package/esm/components/MemoriWidget/MemoriWidget.js.map +1 -1
  41. package/esm/components/PoweredBy/PoweredBy.css +1 -8
  42. package/esm/components/StartPanel/StartPanel.js +1 -1
  43. package/esm/components/StartPanel/StartPanel.js.map +1 -1
  44. package/esm/components/layouts/Chat.js +6 -1
  45. package/esm/components/layouts/Chat.js.map +1 -1
  46. package/esm/components/layouts/WebsiteAssistant/website-assistant.css +5 -5
  47. package/esm/components/layouts/chat.css +76 -1
  48. package/esm/components/layouts/fullpage.css +2 -2
  49. package/esm/components/layouts/hidden-chat.css +2 -2
  50. package/esm/components/layouts/zoomed-full-body.css +1 -1
  51. package/esm/helpers/media.js +18 -3
  52. package/esm/helpers/media.js.map +1 -1
  53. package/esm/index.js +17 -17
  54. package/esm/index.js.map +1 -1
  55. package/esm/styles.css +1 -1
  56. package/esm/version.d.ts +1 -1
  57. package/esm/version.js +1 -1
  58. package/package.json +2 -2
  59. package/src/__snapshots__/index.test.tsx.snap +0 -50
  60. package/src/components/Chat/__snapshots__/Chat.test.tsx.snap +10 -10
  61. package/src/components/ChatBubble/ChatBubble.test.tsx +25 -1
  62. package/src/components/ChatBubble/ChatBubble.tsx +20 -27
  63. package/src/components/MemoriArtifactSystem/ArtifactDrawer.stories.tsx +1 -1
  64. package/src/components/MemoriArtifactSystem/components/ArtifactActions/styles.css +0 -1
  65. package/src/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.css +14 -14
  66. package/src/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.tsx +0 -2
  67. package/src/components/MemoriArtifactSystem/components/ArtifactDrawer/components/TabSwitch.css +4 -0
  68. package/src/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.tsx +2 -2
  69. package/src/components/MemoriWidget/MemoriWidget.tsx +3 -0
  70. package/src/components/PoweredBy/PoweredBy.css +1 -8
  71. package/src/components/StartPanel/StartPanel.tsx +1 -1
  72. package/src/components/layouts/Chat.tsx +14 -1
  73. package/src/components/layouts/HiddenChat.tsx +1 -1
  74. package/src/components/layouts/WebsiteAssistant/__snapshots__/WebsiteAssistant.test.tsx.snap +10 -0
  75. package/src/components/layouts/WebsiteAssistant/website-assistant.css +5 -5
  76. package/src/components/layouts/__snapshots__/Chat.test.tsx.snap +12 -1
  77. package/src/components/layouts/__snapshots__/FullPage.test.tsx.snap +20 -0
  78. package/src/components/layouts/__snapshots__/HiddenChat.test.tsx.snap +10 -0
  79. package/src/components/layouts/__snapshots__/Totem.test.tsx.snap +10 -0
  80. package/src/components/layouts/__snapshots__/ZoomedFullBody.test.tsx.snap +10 -0
  81. package/src/components/layouts/chat.css +76 -1
  82. package/src/components/layouts/fullpage.css +2 -2
  83. package/src/components/layouts/hidden-chat.css +2 -2
  84. package/src/components/layouts/layouts.stories.tsx +8 -8
  85. package/src/components/layouts/zoomed-full-body.css +1 -1
  86. package/src/helpers/media.test.ts +36 -0
  87. package/src/helpers/media.ts +39 -12
  88. package/src/index.tsx +1 -5
  89. package/src/styles.css +16 -0
  90. package/src/version.ts +1 -1
@@ -7,7 +7,7 @@ import { useTranslation } from 'react-i18next';
7
7
  import memoriApiClient from '@memori.ai/memori-api-client';
8
8
  import cx from 'classnames';
9
9
  import { DateTime } from 'luxon';
10
- import { useAlertManager, createAlertOptions, MemoriUIProvider, } from '@memori.ai/ui';
10
+ import { useAlertManager, createAlertOptions, MemoriUIProvider, AlertViewport, } from '@memori.ai/ui';
11
11
  import { WidgetSurfaceProvider } from '../../context/widgetSurfaceContext';
12
12
  import MemoriAuth from '../Auth/Auth';
13
13
  import Chat from '../Chat/Chat';
@@ -2358,132 +2358,132 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
2358
2358
  }), "data-theme": widgetTheme, "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({
2359
2359
  ...currentDialogState,
2360
2360
  sessionID: sessionId,
2361
- }), style: { height }, children: _jsx(MemoriUIProvider, { container: widgetRootEl, theme: widgetTheme, children: _jsx(WidgetSurfaceProvider, { value: widgetSurfaceEl, children: _jsxs("div", { ref: setWidgetSurfaceEl, className: "memori-widget__surface", children: [_jsx(Layout, { Header: Header, headerProps: headerProps, Avatar: Avatar, avatarProps: avatarProps, Chat: Chat, chatProps: chatProps, StartPanel: StartPanel, startPanelProps: startPanelProps, integrationStyle: integrationStyle, integrationBackground: integrationBackground, poweredBy: poweredBy, autoStart: autoStart, sessionId: sessionId, hasUserActivatedSpeak: hasUserActivatedSpeak, loading: loading, avatar3dHidden: avatar3dHidden !== null && avatar3dHidden !== void 0 ? avatar3dHidden : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.avatar_3d_hidden, totemContentMaxWidth: integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.totemContentMaxWidth }), _jsx(ArtifactAPIBridge, { pushMessage: (message) => {
2362
- setHistory(history => {
2363
- if (!history.length)
2364
- return history;
2365
- const lastMessage = history[history.length - 1];
2366
- if (!lastMessage || lastMessage.fromUser)
2367
- return history;
2368
- const updatedLastMessage = {
2369
- ...lastMessage,
2370
- text: lastMessage.text + message.text,
2371
- };
2372
- return [...history.slice(0, -1), updatedLastMessage];
2373
- });
2374
- } }), _jsx("audio", { id: "memori-audio", style: { display: 'none' }, src: "https://aisuru.com/intro.mp3" }), isClient && (_jsx(MemoriAuth, { withModal: true, pwdOrTokens: authModalState, openModal: !!authModalState, setPwdOrTokens: setAuthModalState, showTokens: memori.privacyType === 'SECRET', onFinish: (values) => {
2375
- var _a, _b, _c, _d;
2376
- if (values['password'])
2377
- setMemoriPwd(values['password']);
2378
- if (values['password'])
2379
- memoriPassword = values['password'];
2380
- if (values['tokens'])
2381
- setMemoriTokens(values['tokens']);
2382
- return reopenSession(!sessionId, values['password'], values['tokens'], personification === null || personification === void 0 ? void 0 : personification.tag, personification === null || personification === void 0 ? void 0 : personification.pin, {
2383
- LANG: userLang,
2384
- PATHNAME: (_a = window.location.pathname) === null || _a === void 0 ? void 0 : _a.toUpperCase(),
2385
- ROUTE: ((_d = (_c = (_b = window.location.pathname) === null || _b === void 0 ? void 0 : _b.split('/')) === null || _c === void 0 ? void 0 : _c.pop()) === null || _d === void 0 ? void 0 : _d.toUpperCase()) || '',
2386
- ...(initialContextVars || {}),
2387
- }, initialQuestion, birthDate)
2388
- .then(state => {
2389
- if (!(state === null || state === void 0 ? void 0 : state.sessionID)) {
2390
- throw new Error('AUTH_FAILED');
2391
- }
2392
- setAuthModalState(null);
2393
- if (state === null || state === void 0 ? void 0 : state.dialogState) {
2394
- setHasUserActivatedSpeak(true);
2395
- }
2396
- else {
2397
- onClickStart(state);
2398
- }
2399
- })
2400
- .catch(error => {
2401
- if (!(error instanceof Error) ||
2402
- error.message !== 'AUTH_FAILED') {
2403
- setGotErrorInOpening(true);
2404
- }
2405
- throw error;
2406
- });
2407
- }, minimumNumberOfRecoveryTokens: (_17 = memori === null || memori === void 0 ? void 0 : memori.minimumNumberOfRecoveryTokens) !== null && _17 !== void 0 ? _17 : 1 })), isClient && (_jsx(AgeVerificationModal, { visible: showAgeVerification, minAge: minAge, onClose: birthDate => {
2408
- var _a, _b, _c, _d;
2409
- if (birthDate) {
2410
- setBirthDate(birthDate);
2411
- setLocalConfig('birthDate', birthDate);
2412
- reopenSession(!sessionId, memoriPassword || memoriPwd || (memori === null || memori === void 0 ? void 0 : memori.secretToken), memoriTokens, personification === null || personification === void 0 ? void 0 : personification.tag, personification === null || personification === void 0 ? void 0 : personification.pin, {
2361
+ }), style: { height }, children: _jsxs(MemoriUIProvider, { container: widgetRootEl, theme: widgetTheme, children: [_jsx(AlertViewport, { placement: "top-end", style: { zIndex: 10002 } }), _jsx(WidgetSurfaceProvider, { value: widgetSurfaceEl, children: _jsxs("div", { ref: setWidgetSurfaceEl, className: "memori-widget__surface", children: [_jsx(Layout, { Header: Header, headerProps: headerProps, Avatar: Avatar, avatarProps: avatarProps, Chat: Chat, chatProps: chatProps, StartPanel: StartPanel, startPanelProps: startPanelProps, integrationStyle: integrationStyle, integrationBackground: integrationBackground, poweredBy: poweredBy, autoStart: autoStart, sessionId: sessionId, hasUserActivatedSpeak: hasUserActivatedSpeak, loading: loading, avatar3dHidden: avatar3dHidden !== null && avatar3dHidden !== void 0 ? avatar3dHidden : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.avatar_3d_hidden, totemContentMaxWidth: integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.totemContentMaxWidth }), _jsx(ArtifactAPIBridge, { pushMessage: (message) => {
2362
+ setHistory(history => {
2363
+ if (!history.length)
2364
+ return history;
2365
+ const lastMessage = history[history.length - 1];
2366
+ if (!lastMessage || lastMessage.fromUser)
2367
+ return history;
2368
+ const updatedLastMessage = {
2369
+ ...lastMessage,
2370
+ text: lastMessage.text + message.text,
2371
+ };
2372
+ return [...history.slice(0, -1), updatedLastMessage];
2373
+ });
2374
+ } }), _jsx("audio", { id: "memori-audio", style: { display: 'none' }, src: "https://aisuru.com/intro.mp3" }), isClient && (_jsx(MemoriAuth, { withModal: true, pwdOrTokens: authModalState, openModal: !!authModalState, setPwdOrTokens: setAuthModalState, showTokens: memori.privacyType === 'SECRET', onFinish: (values) => {
2375
+ var _a, _b, _c, _d;
2376
+ if (values['password'])
2377
+ setMemoriPwd(values['password']);
2378
+ if (values['password'])
2379
+ memoriPassword = values['password'];
2380
+ if (values['tokens'])
2381
+ setMemoriTokens(values['tokens']);
2382
+ return reopenSession(!sessionId, values['password'], values['tokens'], personification === null || personification === void 0 ? void 0 : personification.tag, personification === null || personification === void 0 ? void 0 : personification.pin, {
2413
2383
  LANG: userLang,
2414
2384
  PATHNAME: (_a = window.location.pathname) === null || _a === void 0 ? void 0 : _a.toUpperCase(),
2415
2385
  ROUTE: ((_d = (_c = (_b = window.location.pathname) === null || _b === void 0 ? void 0 : _b.split('/')) === null || _c === void 0 ? void 0 : _c.pop()) === null || _d === void 0 ? void 0 : _d.toUpperCase()) || '',
2416
2386
  ...(initialContextVars || {}),
2417
2387
  }, initialQuestion, birthDate)
2418
2388
  .then(state => {
2419
- setShowAgeVerification(false);
2389
+ if (!(state === null || state === void 0 ? void 0 : state.sessionID)) {
2390
+ throw new Error('AUTH_FAILED');
2391
+ }
2420
2392
  setAuthModalState(null);
2421
- onClickStart(state || undefined);
2393
+ if (state === null || state === void 0 ? void 0 : state.dialogState) {
2394
+ setHasUserActivatedSpeak(true);
2395
+ }
2396
+ else {
2397
+ onClickStart(state);
2398
+ }
2422
2399
  })
2423
- .catch(() => {
2424
- setShowAgeVerification(false);
2425
- setGotErrorInOpening(true);
2400
+ .catch(error => {
2401
+ if (!(error instanceof Error) ||
2402
+ error.message !== 'AUTH_FAILED') {
2403
+ setGotErrorInOpening(true);
2404
+ }
2405
+ throw error;
2426
2406
  });
2427
- }
2428
- else {
2429
- setShowAgeVerification(false);
2430
- setClickedStart(false);
2431
- }
2432
- } })), showSettingsDrawer && (_jsx(SettingsDrawer, { layout: selectedLayout, open: !!showSettingsDrawer, onClose: () => setShowSettingsDrawer(false), microphoneMode: continuousSpeech ? 'CONTINUOUS' : 'HOLD_TO_TALK', continuousSpeechTimeout: continuousSpeechTimeout, setMicrophoneMode: mode => setContinuousSpeech(mode === 'CONTINUOUS'), setContinuousSpeechTimeout: setContinuousSpeechTimeout, controlsPosition: controlsPosition, setControlsPosition: setControlsPosition, hideEmissions: hideEmissions, setHideEmissions: setHideEmissions, avatarType: avatarType, setAvatarType: setAvatarType, enablePositionControls: enablePositionControls, setEnablePositionControls: setEnablePositionControls, isAvatar3d: !!(integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.avatarURL), additionalSettings: additionalSettings, speakerMuted: speakerMuted })), showChatHistoryDrawer && (_jsx(ChatHistoryDrawer, { open: !!showChatHistoryDrawer, onClose: () => setShowChatHistoryDrawer(false), resumeSession: chatLog => {
2433
- setChatLogID(chatLog.chatLogID);
2434
- onClickStart(undefined, false, chatLog);
2435
- setShowChatHistoryDrawer(false);
2436
- }, apiClient: client, sessionId: sessionId || '', memori: memori, baseUrl: baseUrl, history: history, apiUrl: client.constants.BACKEND_URL, loginToken: loginToken, language: language, userLang: userLang, isMultilanguageEnabled: isMultilanguageEnabled })), showKnownFactsDrawer && sessionId && (_jsx(KnownFacts, { apiClient: client, memori: memori, sessionID: sessionId, visible: showKnownFactsDrawer, closeDrawer: () => setShowKnownFactsDrawer(false) })), showExpertsDrawer && !!experts && (_jsx(ExpertsDrawer, { apiUrl: client.constants.BACKEND_URL, baseUrl: baseUrl, tenant: tenant, experts: experts, open: showExpertsDrawer, onClose: () => setShowExpertsDrawer(false) })), showLoginDrawer && (tenant === null || tenant === void 0 ? void 0 : tenant.name) && (_jsx(LoginDrawer, { tenant: tenant, apiClient: client, open: !!showLoginDrawer, user: user, loginToken: loginToken, onClose: () => setShowLoginDrawer(false), drawerClassName: selectedLayout === 'WEBSITE_ASSISTANT'
2437
- ? 'memori-drawer--above-website-assistant'
2438
- : undefined, onLogin: (user, token) => {
2439
- var _a, _b, _c, _d;
2440
- reopenSession(false, memoriPassword || memoriPwd || (memori === null || memori === void 0 ? void 0 : memori.secretToken), [], personification === null || personification === void 0 ? void 0 : personification.tag, personification === null || personification === void 0 ? void 0 : personification.pin, {
2441
- LANG: userLang,
2442
- PATHNAME: (_a = window.location.pathname) === null || _a === void 0 ? void 0 : _a.toUpperCase(),
2443
- ROUTE: ((_d = (_c = (_b = window.location.pathname) === null || _b === void 0 ? void 0 : _b.split('/')) === null || _c === void 0 ? void 0 : _c.pop()) === null || _d === void 0 ? void 0 : _d.toUpperCase()) || '',
2444
- ...(initialContextVars || {}),
2445
- }, undefined, birthDate, { loginToken: token }, undefined, sessionId).then(state => {
2446
- var _a, _b;
2447
- setShowLoginDrawer(false);
2448
- setUser(user);
2449
- setLoginToken(token);
2450
- userTokenRef.current = token;
2451
- setLocalConfig('loginToken', token);
2452
- if ((state === null || state === void 0 ? void 0 : state.sessionID) &&
2453
- state.sessionID !== sessionId &&
2454
- (state === null || state === void 0 ? void 0 : state.dialogState)) {
2455
- const username = (user === null || user === void 0 ? void 0 : user.userName) || t('login.user');
2456
- pushMessage({
2457
- text: '',
2458
- emitter: state.dialogState.emitter,
2459
- media: (_b = (_a = state.dialogState.emittedMedia) !== null && _a !== void 0 ? _a : state.dialogState.media) !== null && _b !== void 0 ? _b : [],
2460
- fromUser: false,
2461
- initial: t('login.successfullyLoggedIn', {
2462
- username,
2463
- }),
2464
- contextVars: state.dialogState.contextVars,
2465
- date: state.dialogState.currentDate,
2466
- placeName: state.dialogState.currentPlaceName,
2467
- placeLatitude: state.dialogState.currentLatitude,
2468
- placeLongitude: state.dialogState.currentLongitude,
2469
- placeUncertaintyKm: state.dialogState.currentUncertaintyKm,
2470
- tag: state.dialogState.currentTag,
2471
- memoryTags: state.dialogState.memoryTags,
2407
+ }, minimumNumberOfRecoveryTokens: (_17 = memori === null || memori === void 0 ? void 0 : memori.minimumNumberOfRecoveryTokens) !== null && _17 !== void 0 ? _17 : 1 })), isClient && (_jsx(AgeVerificationModal, { visible: showAgeVerification, minAge: minAge, onClose: birthDate => {
2408
+ var _a, _b, _c, _d;
2409
+ if (birthDate) {
2410
+ setBirthDate(birthDate);
2411
+ setLocalConfig('birthDate', birthDate);
2412
+ reopenSession(!sessionId, memoriPassword || memoriPwd || (memori === null || memori === void 0 ? void 0 : memori.secretToken), memoriTokens, personification === null || personification === void 0 ? void 0 : personification.tag, personification === null || personification === void 0 ? void 0 : personification.pin, {
2413
+ LANG: userLang,
2414
+ PATHNAME: (_a = window.location.pathname) === null || _a === void 0 ? void 0 : _a.toUpperCase(),
2415
+ ROUTE: ((_d = (_c = (_b = window.location.pathname) === null || _b === void 0 ? void 0 : _b.split('/')) === null || _c === void 0 ? void 0 : _c.pop()) === null || _d === void 0 ? void 0 : _d.toUpperCase()) || '',
2416
+ ...(initialContextVars || {}),
2417
+ }, initialQuestion, birthDate)
2418
+ .then(state => {
2419
+ setShowAgeVerification(false);
2420
+ setAuthModalState(null);
2421
+ onClickStart(state || undefined);
2422
+ })
2423
+ .catch(() => {
2424
+ setShowAgeVerification(false);
2425
+ setGotErrorInOpening(true);
2472
2426
  });
2473
- setCurrentDialogState(state.dialogState);
2474
2427
  }
2475
- });
2476
- }, setUser: setUser, onLogout: () => {
2477
- if (!loginToken)
2478
- return;
2479
- client.backend.pwlUserLogout(loginToken).then(() => {
2480
- setShowLoginDrawer(false);
2481
- setUser(undefined);
2482
- setLoginToken(undefined);
2483
- userTokenRef.current = undefined;
2484
- removeLocalConfig('loginToken');
2485
- });
2486
- } }))] }) }) }) }));
2428
+ else {
2429
+ setShowAgeVerification(false);
2430
+ setClickedStart(false);
2431
+ }
2432
+ } })), showSettingsDrawer && (_jsx(SettingsDrawer, { layout: selectedLayout, open: !!showSettingsDrawer, onClose: () => setShowSettingsDrawer(false), microphoneMode: continuousSpeech ? 'CONTINUOUS' : 'HOLD_TO_TALK', continuousSpeechTimeout: continuousSpeechTimeout, setMicrophoneMode: mode => setContinuousSpeech(mode === 'CONTINUOUS'), setContinuousSpeechTimeout: setContinuousSpeechTimeout, controlsPosition: controlsPosition, setControlsPosition: setControlsPosition, hideEmissions: hideEmissions, setHideEmissions: setHideEmissions, avatarType: avatarType, setAvatarType: setAvatarType, enablePositionControls: enablePositionControls, setEnablePositionControls: setEnablePositionControls, isAvatar3d: !!(integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.avatarURL), additionalSettings: additionalSettings, speakerMuted: speakerMuted })), showChatHistoryDrawer && (_jsx(ChatHistoryDrawer, { open: !!showChatHistoryDrawer, onClose: () => setShowChatHistoryDrawer(false), resumeSession: chatLog => {
2433
+ setChatLogID(chatLog.chatLogID);
2434
+ onClickStart(undefined, false, chatLog);
2435
+ setShowChatHistoryDrawer(false);
2436
+ }, apiClient: client, sessionId: sessionId || '', memori: memori, baseUrl: baseUrl, history: history, apiUrl: client.constants.BACKEND_URL, loginToken: loginToken, language: language, userLang: userLang, isMultilanguageEnabled: isMultilanguageEnabled })), showKnownFactsDrawer && sessionId && (_jsx(KnownFacts, { apiClient: client, memori: memori, sessionID: sessionId, visible: showKnownFactsDrawer, closeDrawer: () => setShowKnownFactsDrawer(false) })), showExpertsDrawer && !!experts && (_jsx(ExpertsDrawer, { apiUrl: client.constants.BACKEND_URL, baseUrl: baseUrl, tenant: tenant, experts: experts, open: showExpertsDrawer, onClose: () => setShowExpertsDrawer(false) })), showLoginDrawer && (tenant === null || tenant === void 0 ? void 0 : tenant.name) && (_jsx(LoginDrawer, { tenant: tenant, apiClient: client, open: !!showLoginDrawer, user: user, loginToken: loginToken, onClose: () => setShowLoginDrawer(false), drawerClassName: selectedLayout === 'WEBSITE_ASSISTANT'
2437
+ ? 'memori-drawer--above-website-assistant'
2438
+ : undefined, onLogin: (user, token) => {
2439
+ var _a, _b, _c, _d;
2440
+ reopenSession(false, memoriPassword || memoriPwd || (memori === null || memori === void 0 ? void 0 : memori.secretToken), [], personification === null || personification === void 0 ? void 0 : personification.tag, personification === null || personification === void 0 ? void 0 : personification.pin, {
2441
+ LANG: userLang,
2442
+ PATHNAME: (_a = window.location.pathname) === null || _a === void 0 ? void 0 : _a.toUpperCase(),
2443
+ ROUTE: ((_d = (_c = (_b = window.location.pathname) === null || _b === void 0 ? void 0 : _b.split('/')) === null || _c === void 0 ? void 0 : _c.pop()) === null || _d === void 0 ? void 0 : _d.toUpperCase()) || '',
2444
+ ...(initialContextVars || {}),
2445
+ }, undefined, birthDate, { loginToken: token }, undefined, sessionId).then(state => {
2446
+ var _a, _b;
2447
+ setShowLoginDrawer(false);
2448
+ setUser(user);
2449
+ setLoginToken(token);
2450
+ userTokenRef.current = token;
2451
+ setLocalConfig('loginToken', token);
2452
+ if ((state === null || state === void 0 ? void 0 : state.sessionID) &&
2453
+ state.sessionID !== sessionId &&
2454
+ (state === null || state === void 0 ? void 0 : state.dialogState)) {
2455
+ const username = (user === null || user === void 0 ? void 0 : user.userName) || t('login.user');
2456
+ pushMessage({
2457
+ text: '',
2458
+ emitter: state.dialogState.emitter,
2459
+ media: (_b = (_a = state.dialogState.emittedMedia) !== null && _a !== void 0 ? _a : state.dialogState.media) !== null && _b !== void 0 ? _b : [],
2460
+ fromUser: false,
2461
+ initial: t('login.successfullyLoggedIn', {
2462
+ username,
2463
+ }),
2464
+ contextVars: state.dialogState.contextVars,
2465
+ date: state.dialogState.currentDate,
2466
+ placeName: state.dialogState.currentPlaceName,
2467
+ placeLatitude: state.dialogState.currentLatitude,
2468
+ placeLongitude: state.dialogState.currentLongitude,
2469
+ placeUncertaintyKm: state.dialogState.currentUncertaintyKm,
2470
+ tag: state.dialogState.currentTag,
2471
+ memoryTags: state.dialogState.memoryTags,
2472
+ });
2473
+ setCurrentDialogState(state.dialogState);
2474
+ }
2475
+ });
2476
+ }, setUser: setUser, onLogout: () => {
2477
+ if (!loginToken)
2478
+ return;
2479
+ client.backend.pwlUserLogout(loginToken).then(() => {
2480
+ setShowLoginDrawer(false);
2481
+ setUser(undefined);
2482
+ setLoginToken(undefined);
2483
+ userTokenRef.current = undefined;
2484
+ removeLocalConfig('loginToken');
2485
+ });
2486
+ } }))] }) })] }) }));
2487
2487
  };
2488
2488
  export default MemoriWidget;
2489
2489
  //# sourceMappingURL=MemoriWidget.js.map