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

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 +266 -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
@@ -2362,132 +2362,132 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
2362
2362
  }), "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({
2363
2363
  ...currentDialogState,
2364
2364
  sessionID: sessionId,
2365
- }), style: { height }, children: (0, jsx_runtime_1.jsx)(ui_1.MemoriUIProvider, { container: widgetRootEl, theme: widgetTheme, children: (0, jsx_runtime_1.jsx)(widgetSurfaceContext_1.WidgetSurfaceProvider, { value: widgetSurfaceEl, children: (0, jsx_runtime_1.jsxs)("div", { ref: setWidgetSurfaceEl, className: "memori-widget__surface", 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 !== 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 }), (0, jsx_runtime_1.jsx)(ArtifactAPI_1.ArtifactAPIBridge, { pushMessage: (message) => {
2366
- setHistory(history => {
2367
- if (!history.length)
2368
- return history;
2369
- const lastMessage = history[history.length - 1];
2370
- if (!lastMessage || lastMessage.fromUser)
2371
- return history;
2372
- const updatedLastMessage = {
2373
- ...lastMessage,
2374
- text: lastMessage.text + message.text,
2375
- };
2376
- return [...history.slice(0, -1), updatedLastMessage];
2377
- });
2378
- } }), (0, jsx_runtime_1.jsx)("audio", { id: "memori-audio", style: { display: 'none' }, src: "https://aisuru.com/intro.mp3" }), isClient && ((0, jsx_runtime_1.jsx)(Auth_1.default, { withModal: true, pwdOrTokens: authModalState, openModal: !!authModalState, setPwdOrTokens: setAuthModalState, showTokens: memori.privacyType === 'SECRET', onFinish: (values) => {
2379
- var _a, _b, _c, _d;
2380
- if (values['password'])
2381
- setMemoriPwd(values['password']);
2382
- if (values['password'])
2383
- memoriPassword = values['password'];
2384
- if (values['tokens'])
2385
- setMemoriTokens(values['tokens']);
2386
- 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, {
2387
- LANG: userLang,
2388
- PATHNAME: (_a = window.location.pathname) === null || _a === void 0 ? void 0 : _a.toUpperCase(),
2389
- 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()) || '',
2390
- ...(initialContextVars || {}),
2391
- }, initialQuestion, birthDate)
2392
- .then(state => {
2393
- if (!(state === null || state === void 0 ? void 0 : state.sessionID)) {
2394
- throw new Error('AUTH_FAILED');
2395
- }
2396
- setAuthModalState(null);
2397
- if (state === null || state === void 0 ? void 0 : state.dialogState) {
2398
- setHasUserActivatedSpeak(true);
2399
- }
2400
- else {
2401
- onClickStart(state);
2402
- }
2403
- })
2404
- .catch(error => {
2405
- if (!(error instanceof Error) ||
2406
- error.message !== 'AUTH_FAILED') {
2407
- setGotErrorInOpening(true);
2408
- }
2409
- throw error;
2410
- });
2411
- }, 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 => {
2412
- var _a, _b, _c, _d;
2413
- if (birthDate) {
2414
- setBirthDate(birthDate);
2415
- (0, configuration_1.setLocalConfig)('birthDate', birthDate);
2416
- 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, {
2365
+ }), style: { height }, children: (0, jsx_runtime_1.jsxs)(ui_1.MemoriUIProvider, { container: widgetRootEl, theme: widgetTheme, children: [(0, jsx_runtime_1.jsx)(ui_1.AlertViewport, { placement: "top-end", style: { zIndex: 10002 } }), (0, jsx_runtime_1.jsx)(widgetSurfaceContext_1.WidgetSurfaceProvider, { value: widgetSurfaceEl, children: (0, jsx_runtime_1.jsxs)("div", { ref: setWidgetSurfaceEl, className: "memori-widget__surface", 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 !== 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 }), (0, jsx_runtime_1.jsx)(ArtifactAPI_1.ArtifactAPIBridge, { pushMessage: (message) => {
2366
+ setHistory(history => {
2367
+ if (!history.length)
2368
+ return history;
2369
+ const lastMessage = history[history.length - 1];
2370
+ if (!lastMessage || lastMessage.fromUser)
2371
+ return history;
2372
+ const updatedLastMessage = {
2373
+ ...lastMessage,
2374
+ text: lastMessage.text + message.text,
2375
+ };
2376
+ return [...history.slice(0, -1), updatedLastMessage];
2377
+ });
2378
+ } }), (0, jsx_runtime_1.jsx)("audio", { id: "memori-audio", style: { display: 'none' }, src: "https://aisuru.com/intro.mp3" }), isClient && ((0, jsx_runtime_1.jsx)(Auth_1.default, { withModal: true, pwdOrTokens: authModalState, openModal: !!authModalState, setPwdOrTokens: setAuthModalState, showTokens: memori.privacyType === 'SECRET', onFinish: (values) => {
2379
+ var _a, _b, _c, _d;
2380
+ if (values['password'])
2381
+ setMemoriPwd(values['password']);
2382
+ if (values['password'])
2383
+ memoriPassword = values['password'];
2384
+ if (values['tokens'])
2385
+ setMemoriTokens(values['tokens']);
2386
+ 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, {
2417
2387
  LANG: userLang,
2418
2388
  PATHNAME: (_a = window.location.pathname) === null || _a === void 0 ? void 0 : _a.toUpperCase(),
2419
2389
  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()) || '',
2420
2390
  ...(initialContextVars || {}),
2421
2391
  }, initialQuestion, birthDate)
2422
2392
  .then(state => {
2423
- setShowAgeVerification(false);
2393
+ if (!(state === null || state === void 0 ? void 0 : state.sessionID)) {
2394
+ throw new Error('AUTH_FAILED');
2395
+ }
2424
2396
  setAuthModalState(null);
2425
- onClickStart(state || undefined);
2397
+ if (state === null || state === void 0 ? void 0 : state.dialogState) {
2398
+ setHasUserActivatedSpeak(true);
2399
+ }
2400
+ else {
2401
+ onClickStart(state);
2402
+ }
2426
2403
  })
2427
- .catch(() => {
2428
- setShowAgeVerification(false);
2429
- setGotErrorInOpening(true);
2404
+ .catch(error => {
2405
+ if (!(error instanceof Error) ||
2406
+ error.message !== 'AUTH_FAILED') {
2407
+ setGotErrorInOpening(true);
2408
+ }
2409
+ throw error;
2430
2410
  });
2431
- }
2432
- else {
2433
- setShowAgeVerification(false);
2434
- setClickedStart(false);
2435
- }
2436
- } })), showSettingsDrawer && ((0, jsx_runtime_1.jsx)(SettingsDrawer_1.default, { 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 && ((0, jsx_runtime_1.jsx)(ChatHistory_1.default, { open: !!showChatHistoryDrawer, onClose: () => setShowChatHistoryDrawer(false), resumeSession: chatLog => {
2437
- setChatLogID(chatLog.chatLogID);
2438
- onClickStart(undefined, false, chatLog);
2439
- setShowChatHistoryDrawer(false);
2440
- }, 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 && ((0, jsx_runtime_1.jsx)(KnownFacts_1.default, { apiClient: client, memori: memori, sessionID: sessionId, visible: showKnownFactsDrawer, closeDrawer: () => setShowKnownFactsDrawer(false) })), showExpertsDrawer && !!experts && ((0, jsx_runtime_1.jsx)(ExpertsDrawer_1.default, { 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) && ((0, jsx_runtime_1.jsx)(LoginDrawer_1.default, { tenant: tenant, apiClient: client, open: !!showLoginDrawer, user: user, loginToken: loginToken, onClose: () => setShowLoginDrawer(false), drawerClassName: selectedLayout === 'WEBSITE_ASSISTANT'
2441
- ? 'memori-drawer--above-website-assistant'
2442
- : undefined, onLogin: (user, token) => {
2443
- var _a, _b, _c, _d;
2444
- 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, {
2445
- LANG: userLang,
2446
- PATHNAME: (_a = window.location.pathname) === null || _a === void 0 ? void 0 : _a.toUpperCase(),
2447
- 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()) || '',
2448
- ...(initialContextVars || {}),
2449
- }, undefined, birthDate, { loginToken: token }, undefined, sessionId).then(state => {
2450
- var _a, _b;
2451
- setShowLoginDrawer(false);
2452
- setUser(user);
2453
- setLoginToken(token);
2454
- userTokenRef.current = token;
2455
- (0, configuration_1.setLocalConfig)('loginToken', token);
2456
- if ((state === null || state === void 0 ? void 0 : state.sessionID) &&
2457
- state.sessionID !== sessionId &&
2458
- (state === null || state === void 0 ? void 0 : state.dialogState)) {
2459
- const username = (user === null || user === void 0 ? void 0 : user.userName) || t('login.user');
2460
- pushMessage({
2461
- text: '',
2462
- emitter: state.dialogState.emitter,
2463
- media: (_b = (_a = state.dialogState.emittedMedia) !== null && _a !== void 0 ? _a : state.dialogState.media) !== null && _b !== void 0 ? _b : [],
2464
- fromUser: false,
2465
- initial: t('login.successfullyLoggedIn', {
2466
- username,
2467
- }),
2468
- contextVars: state.dialogState.contextVars,
2469
- date: state.dialogState.currentDate,
2470
- placeName: state.dialogState.currentPlaceName,
2471
- placeLatitude: state.dialogState.currentLatitude,
2472
- placeLongitude: state.dialogState.currentLongitude,
2473
- placeUncertaintyKm: state.dialogState.currentUncertaintyKm,
2474
- tag: state.dialogState.currentTag,
2475
- memoryTags: state.dialogState.memoryTags,
2411
+ }, 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 => {
2412
+ var _a, _b, _c, _d;
2413
+ if (birthDate) {
2414
+ setBirthDate(birthDate);
2415
+ (0, configuration_1.setLocalConfig)('birthDate', birthDate);
2416
+ 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, {
2417
+ LANG: userLang,
2418
+ PATHNAME: (_a = window.location.pathname) === null || _a === void 0 ? void 0 : _a.toUpperCase(),
2419
+ 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()) || '',
2420
+ ...(initialContextVars || {}),
2421
+ }, initialQuestion, birthDate)
2422
+ .then(state => {
2423
+ setShowAgeVerification(false);
2424
+ setAuthModalState(null);
2425
+ onClickStart(state || undefined);
2426
+ })
2427
+ .catch(() => {
2428
+ setShowAgeVerification(false);
2429
+ setGotErrorInOpening(true);
2476
2430
  });
2477
- setCurrentDialogState(state.dialogState);
2478
2431
  }
2479
- });
2480
- }, setUser: setUser, onLogout: () => {
2481
- if (!loginToken)
2482
- return;
2483
- client.backend.pwlUserLogout(loginToken).then(() => {
2484
- setShowLoginDrawer(false);
2485
- setUser(undefined);
2486
- setLoginToken(undefined);
2487
- userTokenRef.current = undefined;
2488
- (0, configuration_1.removeLocalConfig)('loginToken');
2489
- });
2490
- } }))] }) }) }) }));
2432
+ else {
2433
+ setShowAgeVerification(false);
2434
+ setClickedStart(false);
2435
+ }
2436
+ } })), showSettingsDrawer && ((0, jsx_runtime_1.jsx)(SettingsDrawer_1.default, { 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 && ((0, jsx_runtime_1.jsx)(ChatHistory_1.default, { open: !!showChatHistoryDrawer, onClose: () => setShowChatHistoryDrawer(false), resumeSession: chatLog => {
2437
+ setChatLogID(chatLog.chatLogID);
2438
+ onClickStart(undefined, false, chatLog);
2439
+ setShowChatHistoryDrawer(false);
2440
+ }, 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 && ((0, jsx_runtime_1.jsx)(KnownFacts_1.default, { apiClient: client, memori: memori, sessionID: sessionId, visible: showKnownFactsDrawer, closeDrawer: () => setShowKnownFactsDrawer(false) })), showExpertsDrawer && !!experts && ((0, jsx_runtime_1.jsx)(ExpertsDrawer_1.default, { 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) && ((0, jsx_runtime_1.jsx)(LoginDrawer_1.default, { tenant: tenant, apiClient: client, open: !!showLoginDrawer, user: user, loginToken: loginToken, onClose: () => setShowLoginDrawer(false), drawerClassName: selectedLayout === 'WEBSITE_ASSISTANT'
2441
+ ? 'memori-drawer--above-website-assistant'
2442
+ : undefined, onLogin: (user, token) => {
2443
+ var _a, _b, _c, _d;
2444
+ 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, {
2445
+ LANG: userLang,
2446
+ PATHNAME: (_a = window.location.pathname) === null || _a === void 0 ? void 0 : _a.toUpperCase(),
2447
+ 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()) || '',
2448
+ ...(initialContextVars || {}),
2449
+ }, undefined, birthDate, { loginToken: token }, undefined, sessionId).then(state => {
2450
+ var _a, _b;
2451
+ setShowLoginDrawer(false);
2452
+ setUser(user);
2453
+ setLoginToken(token);
2454
+ userTokenRef.current = token;
2455
+ (0, configuration_1.setLocalConfig)('loginToken', token);
2456
+ if ((state === null || state === void 0 ? void 0 : state.sessionID) &&
2457
+ state.sessionID !== sessionId &&
2458
+ (state === null || state === void 0 ? void 0 : state.dialogState)) {
2459
+ const username = (user === null || user === void 0 ? void 0 : user.userName) || t('login.user');
2460
+ pushMessage({
2461
+ text: '',
2462
+ emitter: state.dialogState.emitter,
2463
+ media: (_b = (_a = state.dialogState.emittedMedia) !== null && _a !== void 0 ? _a : state.dialogState.media) !== null && _b !== void 0 ? _b : [],
2464
+ fromUser: false,
2465
+ initial: t('login.successfullyLoggedIn', {
2466
+ username,
2467
+ }),
2468
+ contextVars: state.dialogState.contextVars,
2469
+ date: state.dialogState.currentDate,
2470
+ placeName: state.dialogState.currentPlaceName,
2471
+ placeLatitude: state.dialogState.currentLatitude,
2472
+ placeLongitude: state.dialogState.currentLongitude,
2473
+ placeUncertaintyKm: state.dialogState.currentUncertaintyKm,
2474
+ tag: state.dialogState.currentTag,
2475
+ memoryTags: state.dialogState.memoryTags,
2476
+ });
2477
+ setCurrentDialogState(state.dialogState);
2478
+ }
2479
+ });
2480
+ }, setUser: setUser, onLogout: () => {
2481
+ if (!loginToken)
2482
+ return;
2483
+ client.backend.pwlUserLogout(loginToken).then(() => {
2484
+ setShowLoginDrawer(false);
2485
+ setUser(undefined);
2486
+ setLoginToken(undefined);
2487
+ userTokenRef.current = undefined;
2488
+ (0, configuration_1.removeLocalConfig)('loginToken');
2489
+ });
2490
+ } }))] }) })] }) }));
2491
2491
  };
2492
2492
  exports.default = MemoriWidget;
2493
2493
  //# sourceMappingURL=MemoriWidget.js.map