@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.
- package/CHANGELOG.md +270 -0
- package/dist/components/Chat/Chat.css +19 -0
- package/dist/components/ChatBubble/ChatBubble.js +11 -23
- package/dist/components/ChatBubble/ChatBubble.js.map +1 -1
- package/dist/components/ChatInputs/ChatInputs.css +77 -3
- package/dist/components/ChatTextArea/ChatTextArea.css +5 -25
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.css +7 -2
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/styles.css +31 -15
- package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.css +181 -150
- package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js +7 -7
- package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js.map +1 -1
- package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/components/TabSwitch.css +11 -2
- package/dist/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.css +1 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.js +1 -1
- package/dist/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.js.map +1 -1
- package/dist/components/MemoriWidget/MemoriWidget.js +120 -116
- package/dist/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/dist/components/MicrophoneButton/MicrophoneButton.css +22 -0
- package/dist/components/PoweredBy/PoweredBy.css +1 -8
- package/dist/components/StartPanel/StartPanel.js +1 -1
- package/dist/components/StartPanel/StartPanel.js.map +1 -1
- package/dist/components/layouts/Chat.js +6 -1
- package/dist/components/layouts/Chat.js.map +1 -1
- package/dist/components/layouts/WebsiteAssistant/website-assistant.css +5 -5
- package/dist/components/layouts/chat.css +98 -3
- package/dist/components/layouts/fullpage.css +7 -7
- package/dist/components/layouts/hidden-chat.css +2 -2
- package/dist/components/layouts/zoomed-full-body.css +6 -6
- package/dist/helpers/media.js +18 -3
- package/dist/helpers/media.js.map +1 -1
- package/dist/index.js +16 -16
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/esm/components/Chat/Chat.css +19 -0
- package/esm/components/ChatBubble/ChatBubble.js +12 -24
- package/esm/components/ChatBubble/ChatBubble.js.map +1 -1
- package/esm/components/ChatInputs/ChatInputs.css +77 -3
- package/esm/components/ChatTextArea/ChatTextArea.css +5 -25
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.css +7 -2
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/styles.css +31 -15
- package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.css +181 -150
- package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js +8 -8
- package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js.map +1 -1
- package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/components/TabSwitch.css +11 -2
- package/esm/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.css +1 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.js +2 -2
- package/esm/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.js.map +1 -1
- package/esm/components/MemoriWidget/MemoriWidget.js +121 -117
- package/esm/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/esm/components/MicrophoneButton/MicrophoneButton.css +22 -0
- package/esm/components/PoweredBy/PoweredBy.css +1 -8
- package/esm/components/StartPanel/StartPanel.js +1 -1
- package/esm/components/StartPanel/StartPanel.js.map +1 -1
- package/esm/components/layouts/Chat.js +6 -1
- package/esm/components/layouts/Chat.js.map +1 -1
- package/esm/components/layouts/WebsiteAssistant/website-assistant.css +5 -5
- package/esm/components/layouts/chat.css +98 -3
- package/esm/components/layouts/fullpage.css +7 -7
- package/esm/components/layouts/hidden-chat.css +2 -2
- package/esm/components/layouts/zoomed-full-body.css +6 -6
- package/esm/helpers/media.js +18 -3
- package/esm/helpers/media.js.map +1 -1
- package/esm/index.js +17 -17
- package/esm/index.js.map +1 -1
- package/esm/styles.css +1 -1
- package/esm/version.d.ts +1 -1
- package/esm/version.js +1 -1
- package/package.json +2 -2
- package/src/__snapshots__/index.test.tsx.snap +0 -50
- package/src/components/Chat/Chat.css +19 -0
- package/src/components/Chat/__snapshots__/Chat.test.tsx.snap +10 -10
- package/src/components/ChatBubble/ChatBubble.test.tsx +25 -1
- package/src/components/ChatBubble/ChatBubble.tsx +20 -27
- package/src/components/ChatInputs/ChatInputs.css +77 -3
- package/src/components/ChatTextArea/ChatTextArea.css +5 -25
- package/src/components/MemoriArtifactSystem/ArtifactDrawer.stories.tsx +1 -1
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.css +7 -2
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/styles.css +31 -15
- package/src/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.css +181 -150
- package/src/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.tsx +63 -74
- package/src/components/MemoriArtifactSystem/components/ArtifactDrawer/components/TabSwitch.css +11 -2
- package/src/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.css +1 -0
- package/src/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.tsx +2 -2
- package/src/components/MemoriWidget/MemoriWidget.tsx +8 -1
- package/src/components/MicrophoneButton/MicrophoneButton.css +22 -0
- package/src/components/PoweredBy/PoweredBy.css +1 -8
- package/src/components/StartPanel/StartPanel.tsx +1 -1
- package/src/components/layouts/Chat.tsx +14 -1
- package/src/components/layouts/HiddenChat.tsx +1 -1
- package/src/components/layouts/WebsiteAssistant/__snapshots__/WebsiteAssistant.test.tsx.snap +10 -0
- package/src/components/layouts/WebsiteAssistant/website-assistant.css +5 -5
- package/src/components/layouts/__snapshots__/Chat.test.tsx.snap +17 -2
- package/src/components/layouts/__snapshots__/FullPage.test.tsx.snap +30 -2
- package/src/components/layouts/__snapshots__/HiddenChat.test.tsx.snap +10 -0
- package/src/components/layouts/__snapshots__/Totem.test.tsx.snap +15 -1
- package/src/components/layouts/__snapshots__/ZoomedFullBody.test.tsx.snap +15 -1
- package/src/components/layouts/chat.css +98 -3
- package/src/components/layouts/fullpage.css +7 -7
- package/src/components/layouts/hidden-chat.css +2 -2
- package/src/components/layouts/layouts.stories.tsx +8 -8
- package/src/components/layouts/zoomed-full-body.css +6 -6
- package/src/helpers/media.test.ts +36 -0
- package/src/helpers/media.ts +39 -12
- package/src/index.tsx +1 -5
- package/src/styles.css +18 -5
- 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(
|
|
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:
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
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
|
-
|
|
2393
|
+
if (!(state === null || state === void 0 ? void 0 : state.sessionID)) {
|
|
2394
|
+
throw new Error('AUTH_FAILED');
|
|
2395
|
+
}
|
|
2420
2396
|
setAuthModalState(null);
|
|
2421
|
-
|
|
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
|
-
|
|
2425
|
-
|
|
2404
|
+
.catch(error => {
|
|
2405
|
+
if (!(error instanceof Error) ||
|
|
2406
|
+
error.message !== 'AUTH_FAILED') {
|
|
2407
|
+
setGotErrorInOpening(true);
|
|
2408
|
+
}
|
|
2409
|
+
throw error;
|
|
2426
2410
|
});
|
|
2427
|
-
}
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
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
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
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
|