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

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 (108) hide show
  1. package/CHANGELOG.md +270 -0
  2. package/dist/components/Chat/Chat.css +19 -0
  3. package/dist/components/ChatBubble/ChatBubble.js +11 -23
  4. package/dist/components/ChatBubble/ChatBubble.js.map +1 -1
  5. package/dist/components/ChatInputs/ChatInputs.css +77 -3
  6. package/dist/components/ChatTextArea/ChatTextArea.css +5 -25
  7. package/dist/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.css +7 -2
  8. package/dist/components/MemoriArtifactSystem/components/ArtifactActions/styles.css +31 -15
  9. package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.css +181 -150
  10. package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js +7 -7
  11. package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js.map +1 -1
  12. package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/components/TabSwitch.css +11 -2
  13. package/dist/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.css +1 -0
  14. package/dist/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.js +1 -1
  15. package/dist/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.js.map +1 -1
  16. package/dist/components/MemoriWidget/MemoriWidget.js +120 -116
  17. package/dist/components/MemoriWidget/MemoriWidget.js.map +1 -1
  18. package/dist/components/MicrophoneButton/MicrophoneButton.css +22 -0
  19. package/dist/components/PoweredBy/PoweredBy.css +1 -8
  20. package/dist/components/StartPanel/StartPanel.js +1 -1
  21. package/dist/components/StartPanel/StartPanel.js.map +1 -1
  22. package/dist/components/layouts/Chat.js +6 -1
  23. package/dist/components/layouts/Chat.js.map +1 -1
  24. package/dist/components/layouts/WebsiteAssistant/website-assistant.css +5 -5
  25. package/dist/components/layouts/chat.css +98 -3
  26. package/dist/components/layouts/fullpage.css +7 -7
  27. package/dist/components/layouts/hidden-chat.css +2 -2
  28. package/dist/components/layouts/zoomed-full-body.css +6 -6
  29. package/dist/helpers/media.js +18 -3
  30. package/dist/helpers/media.js.map +1 -1
  31. package/dist/index.js +16 -16
  32. package/dist/index.js.map +1 -1
  33. package/dist/styles.css +1 -1
  34. package/dist/version.d.ts +1 -1
  35. package/dist/version.js +1 -1
  36. package/esm/components/Chat/Chat.css +19 -0
  37. package/esm/components/ChatBubble/ChatBubble.js +12 -24
  38. package/esm/components/ChatBubble/ChatBubble.js.map +1 -1
  39. package/esm/components/ChatInputs/ChatInputs.css +77 -3
  40. package/esm/components/ChatTextArea/ChatTextArea.css +5 -25
  41. package/esm/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.css +7 -2
  42. package/esm/components/MemoriArtifactSystem/components/ArtifactActions/styles.css +31 -15
  43. package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.css +181 -150
  44. package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js +8 -8
  45. package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js.map +1 -1
  46. package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/components/TabSwitch.css +11 -2
  47. package/esm/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.css +1 -0
  48. package/esm/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.js +2 -2
  49. package/esm/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.js.map +1 -1
  50. package/esm/components/MemoriWidget/MemoriWidget.js +121 -117
  51. package/esm/components/MemoriWidget/MemoriWidget.js.map +1 -1
  52. package/esm/components/MicrophoneButton/MicrophoneButton.css +22 -0
  53. package/esm/components/PoweredBy/PoweredBy.css +1 -8
  54. package/esm/components/StartPanel/StartPanel.js +1 -1
  55. package/esm/components/StartPanel/StartPanel.js.map +1 -1
  56. package/esm/components/layouts/Chat.js +6 -1
  57. package/esm/components/layouts/Chat.js.map +1 -1
  58. package/esm/components/layouts/WebsiteAssistant/website-assistant.css +5 -5
  59. package/esm/components/layouts/chat.css +98 -3
  60. package/esm/components/layouts/fullpage.css +7 -7
  61. package/esm/components/layouts/hidden-chat.css +2 -2
  62. package/esm/components/layouts/zoomed-full-body.css +6 -6
  63. package/esm/helpers/media.js +18 -3
  64. package/esm/helpers/media.js.map +1 -1
  65. package/esm/index.js +17 -17
  66. package/esm/index.js.map +1 -1
  67. package/esm/styles.css +1 -1
  68. package/esm/version.d.ts +1 -1
  69. package/esm/version.js +1 -1
  70. package/package.json +2 -2
  71. package/src/__snapshots__/index.test.tsx.snap +0 -50
  72. package/src/components/Chat/Chat.css +19 -0
  73. package/src/components/Chat/__snapshots__/Chat.test.tsx.snap +10 -10
  74. package/src/components/ChatBubble/ChatBubble.test.tsx +25 -1
  75. package/src/components/ChatBubble/ChatBubble.tsx +20 -27
  76. package/src/components/ChatInputs/ChatInputs.css +77 -3
  77. package/src/components/ChatTextArea/ChatTextArea.css +5 -25
  78. package/src/components/MemoriArtifactSystem/ArtifactDrawer.stories.tsx +1 -1
  79. package/src/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.css +7 -2
  80. package/src/components/MemoriArtifactSystem/components/ArtifactActions/styles.css +31 -15
  81. package/src/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.css +181 -150
  82. package/src/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.tsx +63 -74
  83. package/src/components/MemoriArtifactSystem/components/ArtifactDrawer/components/TabSwitch.css +11 -2
  84. package/src/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.css +1 -0
  85. package/src/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.tsx +2 -2
  86. package/src/components/MemoriWidget/MemoriWidget.tsx +8 -1
  87. package/src/components/MicrophoneButton/MicrophoneButton.css +22 -0
  88. package/src/components/PoweredBy/PoweredBy.css +1 -8
  89. package/src/components/StartPanel/StartPanel.tsx +1 -1
  90. package/src/components/layouts/Chat.tsx +14 -1
  91. package/src/components/layouts/HiddenChat.tsx +1 -1
  92. package/src/components/layouts/WebsiteAssistant/__snapshots__/WebsiteAssistant.test.tsx.snap +10 -0
  93. package/src/components/layouts/WebsiteAssistant/website-assistant.css +5 -5
  94. package/src/components/layouts/__snapshots__/Chat.test.tsx.snap +17 -2
  95. package/src/components/layouts/__snapshots__/FullPage.test.tsx.snap +30 -2
  96. package/src/components/layouts/__snapshots__/HiddenChat.test.tsx.snap +10 -0
  97. package/src/components/layouts/__snapshots__/Totem.test.tsx.snap +15 -1
  98. package/src/components/layouts/__snapshots__/ZoomedFullBody.test.tsx.snap +15 -1
  99. package/src/components/layouts/chat.css +98 -3
  100. package/src/components/layouts/fullpage.css +7 -7
  101. package/src/components/layouts/hidden-chat.css +2 -2
  102. package/src/components/layouts/layouts.stories.tsx +8 -8
  103. package/src/components/layouts/zoomed-full-body.css +6 -6
  104. package/src/helpers/media.test.ts +36 -0
  105. package/src/helpers/media.ts +39 -12
  106. package/src/index.tsx +1 -5
  107. package/src/styles.css +18 -5
  108. 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';
@@ -1612,7 +1612,11 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1612
1612
  }`);
1613
1613
  }
1614
1614
  if (integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.blurBackground) {
1615
- integrationStylesheetParts.push('.memori-widget .memori-chat--history--has-global-background::before { filter: blur(5px); }');
1615
+ integrationStylesheetParts.push(`.memori-widget .memori-chat--history--has-global-background::before,
1616
+ .memori-widget .memori-chat-layout--main--has-background::before {
1617
+ filter: blur(5px);
1618
+ transform: scale(1.06);
1619
+ }`);
1616
1620
  }
1617
1621
  const integrationStylesheet = `@layer integration {
1618
1622
  ${integrationStylesheetParts.join('\n ')}
@@ -2358,132 +2362,132 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
2358
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({
2359
2363
  ...currentDialogState,
2360
2364
  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, {
2365
+ }), 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) => {
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
+ } }), _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) => {
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, {
2413
2387
  LANG: userLang,
2414
2388
  PATHNAME: (_a = window.location.pathname) === null || _a === void 0 ? void 0 : _a.toUpperCase(),
2415
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()) || '',
2416
2390
  ...(initialContextVars || {}),
2417
2391
  }, initialQuestion, birthDate)
2418
2392
  .then(state => {
2419
- setShowAgeVerification(false);
2393
+ if (!(state === null || state === void 0 ? void 0 : state.sessionID)) {
2394
+ throw new Error('AUTH_FAILED');
2395
+ }
2420
2396
  setAuthModalState(null);
2421
- onClickStart(state || undefined);
2397
+ if (state === null || state === void 0 ? void 0 : state.dialogState) {
2398
+ setHasUserActivatedSpeak(true);
2399
+ }
2400
+ else {
2401
+ onClickStart(state);
2402
+ }
2422
2403
  })
2423
- .catch(() => {
2424
- setShowAgeVerification(false);
2425
- setGotErrorInOpening(true);
2404
+ .catch(error => {
2405
+ if (!(error instanceof Error) ||
2406
+ error.message !== 'AUTH_FAILED') {
2407
+ setGotErrorInOpening(true);
2408
+ }
2409
+ throw error;
2426
2410
  });
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,
2411
+ }, 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 => {
2412
+ var _a, _b, _c, _d;
2413
+ if (birthDate) {
2414
+ setBirthDate(birthDate);
2415
+ 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);
2472
2430
  });
2473
- setCurrentDialogState(state.dialogState);
2474
2431
  }
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
- } }))] }) }) }) }));
2432
+ else {
2433
+ setShowAgeVerification(false);
2434
+ setClickedStart(false);
2435
+ }
2436
+ } })), 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 => {
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 && (_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'
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
+ 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
+ removeLocalConfig('loginToken');
2489
+ });
2490
+ } }))] }) })] }) }));
2487
2491
  };
2488
2492
  export default MemoriWidget;
2489
2493
  //# sourceMappingURL=MemoriWidget.js.map