@memori.ai/memori-react 9.0.0-alpha.21 → 9.0.0-alpha.23
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 +453 -0
- package/dist/components/AgeVerificationModal/AgeVerificationModal.css +1 -7
- package/dist/components/AgeVerificationModal/AgeVerificationModal.js +1 -1
- package/dist/components/AgeVerificationModal/AgeVerificationModal.js.map +1 -1
- package/dist/components/Auth/Auth.css +12 -5
- package/dist/components/Auth/Auth.d.ts +1 -1
- package/dist/components/Auth/Auth.js +46 -32
- package/dist/components/Auth/Auth.js.map +1 -1
- package/dist/components/BlockedMemoriBadge/BlockedMemoriBadge.css +7 -6
- package/dist/components/Chat/Chat.css +1 -0
- package/dist/components/Chat/Chat.js +1 -1
- package/dist/components/Chat/Chat.js.map +1 -1
- package/dist/components/ChatBubble/ChatBubble.css +32 -5
- package/dist/components/ChatBubble/ChatBubble.js +14 -11
- package/dist/components/ChatBubble/ChatBubble.js.map +1 -1
- package/dist/components/ChatHistoryDrawer/ChatHistory.d.ts +3 -1
- package/dist/components/ChatHistoryDrawer/ChatHistory.js +2 -2
- package/dist/components/ChatHistoryDrawer/ChatHistory.js.map +1 -1
- package/dist/components/ChatHistoryDrawer/ChatResumeDrawer.css +1 -1
- package/dist/components/ChatHistoryDrawer/ChatResumeDrawer.d.ts +3 -1
- package/dist/components/ChatHistoryDrawer/ChatResumeDrawer.js +7 -57
- package/dist/components/ChatHistoryDrawer/ChatResumeDrawer.js.map +1 -1
- package/dist/components/ChatInputs/ChatInputs.js +10 -1
- package/dist/components/ChatInputs/ChatInputs.js.map +1 -1
- package/dist/components/ChatTextArea/ChatTextArea.css +1 -1
- package/dist/components/ContentPreviewModal/ContentPreviewModal.css +1 -10
- package/dist/components/ContentPreviewModal/ContentPreviewModal.js +1 -1
- package/dist/components/ContentPreviewModal/ContentPreviewModal.js.map +1 -1
- package/dist/components/ExpertsDrawer/ExpertsDrawer.css +0 -6
- package/dist/components/FeedbackButtons/FeedbackButtons.js +2 -2
- package/dist/components/FeedbackButtons/FeedbackButtons.js.map +1 -1
- package/dist/components/Header/Header.css +8 -3
- package/dist/components/Header/Header.js +15 -18
- package/dist/components/Header/Header.js.map +1 -1
- package/dist/components/IconButton/IconButton.d.ts +1 -1
- package/dist/components/KnownFacts/KnownFacts.css +1 -1
- package/dist/components/KnownFacts/KnownFacts.js +2 -5
- package/dist/components/KnownFacts/KnownFacts.js.map +1 -1
- package/dist/components/LoginDrawer/LoginDrawer.css +16 -14
- package/dist/components/LoginDrawer/LoginDrawer.js +19 -11
- package/dist/components/LoginDrawer/LoginDrawer.js.map +1 -1
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/styles.css +4 -4
- package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.css +28 -5
- package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js +2 -2
- package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js.map +1 -1
- package/dist/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.js +1 -1
- package/dist/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.js.map +1 -1
- package/dist/components/MemoriWidget/MemoriWidget.d.ts +1 -0
- package/dist/components/MemoriWidget/MemoriWidget.js +93 -32
- package/dist/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/dist/components/MobileSessionPanel/MobileSessionPanel.css +2 -2
- package/dist/components/PositionPopover/PositionPopover.css +3 -3
- package/dist/components/PositionPopover/PositionPopover.js +38 -25
- package/dist/components/PositionPopover/PositionPopover.js.map +1 -1
- package/dist/components/Snippet/Snippet.css +1 -1
- package/dist/components/StartPanel/StartPanel.css +19 -3
- package/dist/components/StartPanel/StartPanel.js +12 -18
- package/dist/components/StartPanel/StartPanel.js.map +1 -1
- package/dist/components/layouts/WebsiteAssistant/website-assistant.css +3 -3
- package/dist/components/layouts/chat.css +5 -2
- package/dist/components/layouts/totem.css +43 -9
- package/dist/helpers/nats/getNatsConfig.js.map +1 -1
- package/dist/helpers/nats/useNats.d.ts +2 -1
- package/dist/helpers/nats/useNats.js +87 -20
- package/dist/helpers/nats/useNats.js.map +1 -1
- package/dist/helpers/nats/useNatsSession.d.ts +6 -1
- package/dist/helpers/nats/useNatsSession.js +48 -7
- package/dist/helpers/nats/useNatsSession.js.map +1 -1
- package/dist/helpers/positionPopover.d.ts +2 -1
- package/dist/helpers/positionPopover.js +10 -2
- package/dist/helpers/positionPopover.js.map +1 -1
- package/dist/icons/MemoriIcon.js +1 -1
- package/dist/icons/MemoriIcon.js.map +1 -1
- package/dist/locales/de.json +4 -1
- package/dist/locales/en.json +3 -1
- package/dist/locales/es.json +3 -1
- package/dist/locales/fr.json +3 -1
- package/dist/locales/it.json +3 -1
- package/dist/styles.css +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/esm/components/AgeVerificationModal/AgeVerificationModal.css +1 -7
- package/esm/components/AgeVerificationModal/AgeVerificationModal.js +1 -1
- package/esm/components/AgeVerificationModal/AgeVerificationModal.js.map +1 -1
- package/esm/components/Auth/Auth.css +12 -5
- package/esm/components/Auth/Auth.d.ts +1 -1
- package/esm/components/Auth/Auth.js +47 -33
- package/esm/components/Auth/Auth.js.map +1 -1
- package/esm/components/BlockedMemoriBadge/BlockedMemoriBadge.css +7 -6
- package/esm/components/Chat/Chat.css +1 -0
- package/esm/components/Chat/Chat.js +1 -1
- package/esm/components/Chat/Chat.js.map +1 -1
- package/esm/components/ChatBubble/ChatBubble.css +32 -5
- package/esm/components/ChatBubble/ChatBubble.js +14 -11
- package/esm/components/ChatBubble/ChatBubble.js.map +1 -1
- package/esm/components/ChatHistoryDrawer/ChatHistory.d.ts +3 -1
- package/esm/components/ChatHistoryDrawer/ChatHistory.js +2 -2
- package/esm/components/ChatHistoryDrawer/ChatHistory.js.map +1 -1
- package/esm/components/ChatHistoryDrawer/ChatResumeDrawer.css +1 -1
- package/esm/components/ChatHistoryDrawer/ChatResumeDrawer.d.ts +3 -1
- package/esm/components/ChatHistoryDrawer/ChatResumeDrawer.js +9 -59
- package/esm/components/ChatHistoryDrawer/ChatResumeDrawer.js.map +1 -1
- package/esm/components/ChatInputs/ChatInputs.js +11 -2
- package/esm/components/ChatInputs/ChatInputs.js.map +1 -1
- package/esm/components/ChatTextArea/ChatTextArea.css +1 -1
- package/esm/components/ContentPreviewModal/ContentPreviewModal.css +1 -10
- package/esm/components/ContentPreviewModal/ContentPreviewModal.js +1 -1
- package/esm/components/ContentPreviewModal/ContentPreviewModal.js.map +1 -1
- package/esm/components/ExpertsDrawer/ExpertsDrawer.css +0 -6
- package/esm/components/FeedbackButtons/FeedbackButtons.js +2 -2
- package/esm/components/FeedbackButtons/FeedbackButtons.js.map +1 -1
- package/esm/components/Header/Header.css +8 -3
- package/esm/components/Header/Header.js +15 -18
- package/esm/components/Header/Header.js.map +1 -1
- package/esm/components/IconButton/IconButton.d.ts +1 -1
- package/esm/components/KnownFacts/KnownFacts.css +1 -1
- package/esm/components/KnownFacts/KnownFacts.js +2 -5
- package/esm/components/KnownFacts/KnownFacts.js.map +1 -1
- package/esm/components/LoginDrawer/LoginDrawer.css +16 -14
- package/esm/components/LoginDrawer/LoginDrawer.js +20 -12
- package/esm/components/LoginDrawer/LoginDrawer.js.map +1 -1
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/styles.css +4 -4
- package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.css +28 -5
- package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js +2 -2
- package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js.map +1 -1
- package/esm/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.js +1 -1
- package/esm/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.js.map +1 -1
- package/esm/components/MemoriWidget/MemoriWidget.d.ts +1 -0
- package/esm/components/MemoriWidget/MemoriWidget.js +93 -33
- package/esm/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/esm/components/MobileSessionPanel/MobileSessionPanel.css +2 -2
- package/esm/components/PositionPopover/PositionPopover.css +3 -3
- package/esm/components/PositionPopover/PositionPopover.js +39 -26
- package/esm/components/PositionPopover/PositionPopover.js.map +1 -1
- package/esm/components/Snippet/Snippet.css +1 -1
- package/esm/components/StartPanel/StartPanel.css +19 -3
- package/esm/components/StartPanel/StartPanel.js +12 -18
- package/esm/components/StartPanel/StartPanel.js.map +1 -1
- package/esm/components/layouts/WebsiteAssistant/website-assistant.css +3 -3
- package/esm/components/layouts/chat.css +5 -2
- package/esm/components/layouts/totem.css +43 -9
- package/esm/helpers/nats/getNatsConfig.js.map +1 -1
- package/esm/helpers/nats/useNats.d.ts +2 -1
- package/esm/helpers/nats/useNats.js +87 -20
- package/esm/helpers/nats/useNats.js.map +1 -1
- package/esm/helpers/nats/useNatsSession.d.ts +6 -1
- package/esm/helpers/nats/useNatsSession.js +48 -8
- package/esm/helpers/nats/useNatsSession.js.map +1 -1
- package/esm/helpers/positionPopover.d.ts +2 -1
- package/esm/helpers/positionPopover.js +9 -2
- package/esm/helpers/positionPopover.js.map +1 -1
- package/esm/icons/MemoriIcon.js +1 -1
- package/esm/icons/MemoriIcon.js.map +1 -1
- package/esm/locales/de.json +4 -1
- package/esm/locales/en.json +3 -1
- package/esm/locales/es.json +3 -1
- package/esm/locales/fr.json +3 -1
- package/esm/locales/it.json +3 -1
- package/esm/styles.css +1 -1
- package/esm/version.d.ts +1 -1
- package/esm/version.js +1 -1
- package/package.json +8 -5
- package/src/Live/Agents.stories.tsx +49 -0
- package/src/Live/KnownFacts.stories.tsx +50 -0
- package/src/Showcase.stories.tsx +3 -14
- package/src/components/AgeVerificationModal/AgeVerificationModal.css +1 -7
- package/src/components/AgeVerificationModal/AgeVerificationModal.stories.tsx +1 -1
- package/src/components/AgeVerificationModal/AgeVerificationModal.tsx +1 -0
- package/src/components/Auth/Auth.css +12 -5
- package/src/components/Auth/Auth.stories.tsx +1 -1
- package/src/components/Auth/Auth.test.tsx +68 -1
- package/src/components/Auth/Auth.tsx +69 -54
- package/src/components/Auth/__snapshots__/Auth.test.tsx.snap +5 -6
- package/src/components/Avatar/Avatar.stories.tsx +1 -18
- package/src/components/Avatar/AvatarView/AvatarView.stories.tsx +1 -103
- package/src/components/Blob/Blob.stories.tsx +1 -1
- package/src/components/BlockedMemoriBadge/BlockedMemoriBadge.css +7 -6
- package/src/components/BlockedMemoriBadge/BlockedMemoriBadge.stories.tsx +1 -1
- package/src/components/ChangeMode/ChangeMode.stories.tsx +1 -1
- package/src/components/Chat/Chat.css +1 -0
- package/src/components/Chat/Chat.stories.tsx +61 -7
- package/src/components/Chat/Chat.tsx +1 -0
- package/src/components/Chat/__snapshots__/Chat.test.tsx.snap +151 -151
- package/src/components/ChatBubble/ChatBubble.css +32 -5
- package/src/components/ChatBubble/ChatBubble.stories.tsx +24 -2
- package/src/components/ChatBubble/ChatBubble.test.tsx +37 -1
- package/src/components/ChatBubble/ChatBubble.tsx +308 -299
- package/src/components/ChatBubble/__snapshots__/ChatBubble.test.tsx.snap +384 -264
- package/src/components/ChatHistoryDrawer/ChatHistory.stories.tsx +1 -1
- package/src/components/ChatHistoryDrawer/ChatHistory.tsx +6 -0
- package/src/components/ChatHistoryDrawer/ChatResumeDrawer.css +1 -1
- package/src/components/ChatHistoryDrawer/ChatResumeDrawer.tsx +24 -81
- package/src/components/ChatInputs/ChatInputs.stories.tsx +1 -39
- package/src/components/ChatInputs/ChatInputs.test.tsx +47 -0
- package/src/components/ChatInputs/ChatInputs.tsx +12 -2
- package/src/components/ChatTextArea/ChatTextArea.css +1 -1
- package/src/components/CompletionProviderStatus/CompletionProviderStatus.stories.tsx +1 -1
- package/src/components/ContentPreviewModal/ContentPreviewModal.css +1 -10
- package/src/components/ContentPreviewModal/ContentPreviewModal.tsx +1 -1
- package/src/components/ExpertsDrawer/ExpertsDrawer.css +0 -6
- package/src/components/ExpertsDrawer/ExpertsDrawer.stories.tsx +1 -1
- package/src/components/FeedbackButtons/FeedbackButtons.stories.tsx +29 -10
- package/src/components/FeedbackButtons/FeedbackButtons.tsx +2 -0
- package/src/components/FeedbackButtons/__snapshots__/FeedbackButtons.test.tsx.snap +1 -1
- package/src/components/Header/Header.css +8 -3
- package/src/components/Header/Header.stories.tsx +1 -1
- package/src/components/Header/Header.tsx +146 -117
- package/src/components/KnownFacts/KnownFacts.css +1 -1
- package/src/components/KnownFacts/KnownFacts.stories.tsx +1 -23
- package/src/components/KnownFacts/KnownFacts.tsx +4 -9
- package/src/components/KnownFacts/__snapshots__/KnownFacts.test.tsx.snap +6 -2
- package/src/components/LoginDrawer/LoginDrawer.css +16 -14
- package/src/components/LoginDrawer/LoginDrawer.stories.tsx +2 -52
- package/src/components/LoginDrawer/LoginDrawer.tsx +51 -39
- package/src/components/LoginDrawer/__snapshots__/LoginDrawer.test.tsx.snap +33 -11
- package/src/components/MediaWidget/MediaItemWidget.stories.tsx +1 -15
- package/src/components/MediaWidget/MediaWidget.stories.tsx +1 -45
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/CopyButton.stories.tsx +1 -1
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/styles.css +4 -4
- package/src/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.css +28 -5
- package/src/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.tsx +4 -6
- package/src/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.tsx +1 -1
- package/src/components/MemoriArtifactSystem/utils/ArtifactAPI.test.tsx +32 -28
- package/src/components/MemoriWidget/MemoriUIProvider.contract.test.tsx +55 -0
- package/src/components/MemoriWidget/MemoriWidget.stories.tsx +55 -77
- package/src/components/MemoriWidget/MemoriWidget.tsx +114 -45
- package/src/components/MemoriWidget/getChatStyles.test.ts +24 -0
- package/src/components/MicrophoneButton/MicrophoneButton.stories.tsx +1 -1
- package/src/components/MobileSessionPanel/MobileSessionPanel.css +2 -2
- package/src/components/PositionPopover/PositionPopover.css +3 -3
- package/src/components/PositionPopover/PositionPopover.stories.tsx +1 -1
- package/src/components/PositionPopover/PositionPopover.tsx +50 -28
- package/src/components/PoweredBy/PoweredBy.stories.tsx +1 -54
- package/src/components/PoweredBy/__snapshots__/PoweredBy.test.tsx.snap +2 -2
- package/src/components/SendOnEnterMenu/SendOnEnterMenu.stories.tsx +1 -1
- package/src/components/SettingsDrawer/SettingsDrawer.stories.tsx +1 -1
- package/src/components/ShareButton/ShareButton.stories.tsx +1 -1
- package/src/components/Snippet/Snippet.css +1 -1
- package/src/components/Snippet/Snippet.stories.tsx +1 -1
- package/src/components/StartPanel/StartPanel.css +19 -3
- package/src/components/StartPanel/StartPanel.stories.tsx +2 -2
- package/src/components/StartPanel/StartPanel.tsx +22 -35
- package/src/components/StartPanel/__snapshots__/StartPanel.test.tsx.snap +177 -121
- package/src/components/Typing/Typing.stories.tsx +1 -1
- package/src/components/WhyThisAnswer/WhyThisAnswer.stories.tsx +22 -44
- package/src/components/WhyThisAnswer/__snapshots__/WhyThisAnswer.test.tsx.snap +9 -3
- package/src/components/layouts/FullBody/FullBody.stories.tsx +55 -68
- package/src/components/layouts/Totem/Totem.stories.tsx +69 -87
- package/src/components/layouts/WebsiteAssistant/website-assistant.css +3 -3
- package/src/components/layouts/ZoomedFullBody/ZoomedFullBody.stories.tsx +69 -87
- package/src/components/layouts/__snapshots__/Chat.test.tsx.snap +19 -41
- package/src/components/layouts/__snapshots__/FullPage.test.tsx.snap +39 -83
- package/src/components/layouts/__snapshots__/HiddenChat.test.tsx.snap +15 -11
- package/src/components/layouts/__snapshots__/Totem.test.tsx.snap +116 -42
- package/src/components/layouts/__snapshots__/ZoomedFullBody.test.tsx.snap +18 -40
- package/src/components/layouts/chat.css +5 -2
- package/src/components/layouts/layouts.stories.tsx +96 -179
- package/src/components/layouts/totem.css +43 -9
- package/src/helpers/nats/getNatsConfig.ts +4 -1
- package/src/helpers/nats/useNats.test.tsx +81 -0
- package/src/helpers/nats/useNats.ts +109 -29
- package/src/helpers/nats/useNatsSession.test.ts +16 -0
- package/src/helpers/nats/useNatsSession.ts +79 -13
- package/src/helpers/positionPopover.test.ts +36 -1
- package/src/helpers/positionPopover.ts +21 -4
- package/src/i18n.knownFacts.test.ts +40 -0
- package/src/icons/MemoriIcon.tsx +1 -1
- package/src/index.stories.tsx +1 -47
- package/src/locales/de.json +4 -1
- package/src/locales/en.json +3 -1
- package/src/locales/es.json +3 -1
- package/src/locales/fr.json +3 -1
- package/src/locales/it.json +3 -1
- package/src/styles.css +13 -27
- package/src/version.ts +1 -1
- package/src/components/ChatTextArea/ChatTextArea.stories.tsx +0 -55
- package/src/components/CustomGLBModelViewer/ModelViewer.stories.tsx +0 -58
- package/src/components/DateSelector/DateSelector.stories.tsx +0 -47
- package/src/components/FilePreview/FilePreview.stories.tsx +0 -63
- package/src/components/MemoriArtifactSystem/ArtifactDrawer.stories.tsx +0 -265
- package/src/components/UploadButton/UploadButton.stories.tsx +0 -510
- package/src/components/VenueWidget/VenueWidget.stories.tsx +0 -69
- package/src/components/layouts/WebsiteAssistant/WebsiteAssistant.stories.tsx +0 -115
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { ArtifactAPIBridge } from '../MemoriArtifactSystem/utils/ArtifactAPI';
|
|
3
3
|
import { checkPii } from '../../helpers/piiDetection';
|
|
4
|
-
import { shouldRestartSessionOnPositionPopoverClose } from '../../helpers/positionPopover';
|
|
4
|
+
import { shouldHoldAutoStartForPosition, shouldRestartSessionOnPositionPopoverClose, } from '../../helpers/positionPopover';
|
|
5
5
|
import { useState, useEffect, useCallback, useRef, useMemo, } from 'react';
|
|
6
6
|
import { useTranslation } from 'react-i18next';
|
|
7
7
|
import memoriApiClient from '@memori.ai/memori-api-client';
|
|
@@ -80,6 +80,21 @@ function readCorrelationID(response) {
|
|
|
80
80
|
const value = response.correlationID;
|
|
81
81
|
return typeof value === 'string' && value.length > 0 ? value : undefined;
|
|
82
82
|
}
|
|
83
|
+
export function dialogStateFingerprint(state) {
|
|
84
|
+
if (!state)
|
|
85
|
+
return '';
|
|
86
|
+
return JSON.stringify({
|
|
87
|
+
state: state.state,
|
|
88
|
+
previousState: state.previousState,
|
|
89
|
+
emission: state.emission,
|
|
90
|
+
emitter: state.emitter,
|
|
91
|
+
lastMatchedMemoryID: state.lastMatchedMemoryID,
|
|
92
|
+
currentDate: state.currentDate,
|
|
93
|
+
currentMemoryID: state.currentMemoryID,
|
|
94
|
+
contextVars: state.contextVars,
|
|
95
|
+
emittedMedia: state.emittedMedia,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
83
98
|
const typeMessage = (message, waitForPrevious = true, hidden = false, typingText, useLoaderTextAsMsg = false, hasBatchQueued = false) => {
|
|
84
99
|
const e = new CustomEvent('MemoriTextEntered', {
|
|
85
100
|
detail: {
|
|
@@ -183,22 +198,9 @@ export function getChatStyles(config) {
|
|
|
183
198
|
const primaryContent = (_a = config === null || config === void 0 ? void 0 : config.buttonTextColor) !== null && _a !== void 0 ? _a : '#ffffff';
|
|
184
199
|
return {
|
|
185
200
|
'--memori-primary-color': primary,
|
|
186
|
-
'--memori-primary': primary,
|
|
187
201
|
'--memori-primary-content': primaryContent,
|
|
188
|
-
'--memori-primary-hover': 'color-mix(in oklch, var(--memori-primary), var(--memori-surface-contrast, black) 15%)',
|
|
189
|
-
'--memori-primary-active': 'color-mix(in oklch, var(--memori-primary), var(--memori-surface-contrast, black) 25%)',
|
|
190
|
-
'--memori-primary-disabled': 'color-mix(in oklch, var(--memori-primary), transparent 60%)',
|
|
191
|
-
'--memori-primary-subtle': 'color-mix(in oklch, var(--memori-primary), var(--memori-surface-contrast-inverse, white) 60%)',
|
|
192
|
-
'--memori-primary-subtle-hover': 'color-mix(in oklch, var(--memori-primary), var(--memori-surface-contrast-inverse, white) 50%)',
|
|
193
|
-
'--memori-border-primary': 'color-mix(in oklch, var(--memori-primary), transparent 70%)',
|
|
194
|
-
'--memori-border-primary-hover': 'color-mix(in oklch, var(--memori-primary), transparent 50%)',
|
|
195
|
-
'--memori-focus-ring-color': 'color-mix(in oklch, var(--memori-primary), transparent 80%)',
|
|
196
|
-
'--memori-focus-ring': '0 0 0 3px var(--memori-focus-ring-color)',
|
|
197
|
-
'--memori-shadow-primary': '0 8px 16px -4px color-mix(in oklch, var(--memori-primary), transparent 70%)',
|
|
198
|
-
'--memori-skeleton-base': 'color-mix(in oklch, var(--memori-primary), var(--memori-surface-contrast-inverse, white) 85%)',
|
|
199
|
-
'--memori-skeleton-highlight': 'color-mix(in oklch, var(--memori-primary), var(--memori-surface-contrast-inverse, white) 75%)',
|
|
200
202
|
'--memori-icon-active-bg': 'color-mix(in oklch, var(--memori-primary) 12%, transparent)',
|
|
201
|
-
'--memori-icon-recording-bg': 'color-mix(in oklch, var(--memori-error
|
|
203
|
+
'--memori-icon-recording-bg': 'color-mix(in oklch, var(--memori-error) 12%, transparent)',
|
|
202
204
|
};
|
|
203
205
|
}
|
|
204
206
|
const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenantID, memoriLang, uiLang, spokenLang, multilingual, integration, layout, customLayout, showShare, preview = false, embed = false, showCopyButton = true, showTranslationOriginal = false, showInputs = true, showDates = false, showContextPerLine = false, showMessageConsumption = false, showSettings, showTypingText = false, showClear = false, showLogin = false, showUpload, showOnlyLastMessages, showChatHistory, showReasoning, avatar3dHidden, height = '100vh', secret, baseUrl = 'https://aisuru-staging.aclambda.online', apiURL = 'https://backend-staging.memori.ai', engineURL = 'https://engine-staging.memori.ai', initialContextVars, initialQuestion, ttsProvider, ogImage, sessionID: initialSessionID, tenant, personification, authToken, enableAudio, defaultSpeakerActive = true, disableTextEnteredEvents = false, onStateChange, additionalInfo, additionalSettings, customMediaRenderer, userAvatar, __WEBCOMPONENT__ = false, useMathFormatting = false, autoStart = false, applyVarsToRoot = false, showFunctionCache = false, maxTotalMessagePayload, maxTextareaCharacters, }) => {
|
|
@@ -566,6 +568,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
566
568
|
if (response.resultCode === 0 && correlationID) {
|
|
567
569
|
registerPendingEnterText(correlationID, {
|
|
568
570
|
msg,
|
|
571
|
+
stateBeforeRequest: dialogStateFingerprint(currentDialogState),
|
|
569
572
|
text,
|
|
570
573
|
media,
|
|
571
574
|
translate,
|
|
@@ -822,7 +825,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
822
825
|
}
|
|
823
826
|
}, [initialSessionID]);
|
|
824
827
|
const fetchSession = async (params) => {
|
|
825
|
-
var _a, _b, _c, _d, _f, _g, _h;
|
|
828
|
+
var _a, _b, _c, _d, _f, _g, _h, _j;
|
|
826
829
|
let storageBirthDate = getLocalConfig('birthDate', undefined);
|
|
827
830
|
let userBirthDate = (_a = birthDate !== null && birthDate !== void 0 ? birthDate : params.birthDate) !== null && _a !== void 0 ? _a : storageBirthDate;
|
|
828
831
|
if (!userBirthDate && !!minAge) {
|
|
@@ -830,8 +833,10 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
830
833
|
return;
|
|
831
834
|
}
|
|
832
835
|
if (memori.privacyType !== 'PUBLIC' &&
|
|
836
|
+
!params.password &&
|
|
833
837
|
!memori.secretToken &&
|
|
834
838
|
!memoriPwd &&
|
|
839
|
+
!((_b = params.recoveryTokens) === null || _b === void 0 ? void 0 : _b.length) &&
|
|
835
840
|
!memoriTokens) {
|
|
836
841
|
setAuthModalState('password');
|
|
837
842
|
return;
|
|
@@ -847,17 +852,17 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
847
852
|
return window.location.href;
|
|
848
853
|
})();
|
|
849
854
|
}
|
|
850
|
-
catch (
|
|
855
|
+
catch (_k) {
|
|
851
856
|
}
|
|
852
857
|
const session = await initSession({
|
|
853
858
|
...params,
|
|
854
859
|
birthDate: userBirthDate,
|
|
855
|
-
tag: (
|
|
856
|
-
pin: (
|
|
860
|
+
tag: (_c = params.tag) !== null && _c !== void 0 ? _c : personification === null || personification === void 0 ? void 0 : personification.tag,
|
|
861
|
+
pin: (_d = params.pin) !== null && _d !== void 0 ? _d : personification === null || personification === void 0 ? void 0 : personification.pin,
|
|
857
862
|
additionalInfo: {
|
|
858
863
|
...(params.additionalInfo || additionalInfo || {}),
|
|
859
|
-
loginToken: resolveLoginToken((
|
|
860
|
-
language: ((
|
|
864
|
+
loginToken: resolveLoginToken((_f = params.additionalInfo) === null || _f === void 0 ? void 0 : _f.loginToken),
|
|
865
|
+
language: ((_j = userLang !== null && userLang !== void 0 ? userLang : (_h = (_g = memori.culture) === null || _g === void 0 ? void 0 : _g.split('-')) === null || _h === void 0 ? void 0 : _h[0]) !== null && _j !== void 0 ? _j : 'IT').toLowerCase(),
|
|
861
866
|
referral: referral,
|
|
862
867
|
timeZoneOffset: new Date().getTimezoneOffset().toString(),
|
|
863
868
|
},
|
|
@@ -913,15 +918,17 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
913
918
|
try {
|
|
914
919
|
if (!userBirthDate && !!minAge) {
|
|
915
920
|
setShowAgeVerification(true);
|
|
921
|
+
setLoading(false);
|
|
916
922
|
return;
|
|
917
923
|
}
|
|
918
924
|
if (memori.privacyType !== 'PUBLIC' &&
|
|
919
925
|
!password &&
|
|
920
926
|
!memori.secretToken &&
|
|
921
927
|
!memoriPwd &&
|
|
922
|
-
!recoveryTokens &&
|
|
928
|
+
!(recoveryTokens === null || recoveryTokens === void 0 ? void 0 : recoveryTokens.length) &&
|
|
923
929
|
!memoriTokens) {
|
|
924
930
|
setAuthModalState('password');
|
|
931
|
+
setLoading(false);
|
|
925
932
|
return;
|
|
926
933
|
}
|
|
927
934
|
if (!(await checkCredits({ notify: true }))) {
|
|
@@ -1478,6 +1485,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
1478
1485
|
reject(new Error('NATS enter-text response timeout'));
|
|
1479
1486
|
}, timeoutMs);
|
|
1480
1487
|
registerPendingEnterText(correlationID, {
|
|
1488
|
+
stateBeforeRequest: dialogStateFingerprint(currentDialogState),
|
|
1481
1489
|
waitForResponse: {
|
|
1482
1490
|
resolve: event => {
|
|
1483
1491
|
clearTimeout(timeoutId);
|
|
@@ -1490,7 +1498,45 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
1490
1498
|
timeoutId,
|
|
1491
1499
|
},
|
|
1492
1500
|
});
|
|
1493
|
-
}), [registerPendingEnterText, clearEnterTextPending]);
|
|
1501
|
+
}), [registerPendingEnterText, clearEnterTextPending, currentDialogState]);
|
|
1502
|
+
const catchUpPendingEnterText = useCallback(async () => {
|
|
1503
|
+
if (!sessionId || pendingEnterTextRef.current.size === 0)
|
|
1504
|
+
return;
|
|
1505
|
+
const latest = Array.from(pendingEnterTextRef.current.entries()).pop();
|
|
1506
|
+
if (!latest)
|
|
1507
|
+
return;
|
|
1508
|
+
const [correlationID, pending] = latest;
|
|
1509
|
+
try {
|
|
1510
|
+
const { currentState, resultCode, resultMessage, requestID } = await getSession(sessionId);
|
|
1511
|
+
if (resultCode !== 0 || !currentState) {
|
|
1512
|
+
deliverEnterTextNatsResponse(correlationID, {
|
|
1513
|
+
eventType: 'dialog_text_entered_response',
|
|
1514
|
+
correlationID,
|
|
1515
|
+
requestID,
|
|
1516
|
+
resultCode,
|
|
1517
|
+
resultMessage,
|
|
1518
|
+
currentState,
|
|
1519
|
+
});
|
|
1520
|
+
return;
|
|
1521
|
+
}
|
|
1522
|
+
if (dialogStateFingerprint(currentState) === pending.stateBeforeRequest) {
|
|
1523
|
+
console.info('[NATS] catch-up: pending turn has not completed yet');
|
|
1524
|
+
return;
|
|
1525
|
+
}
|
|
1526
|
+
console.info('[NATS] catch-up: applying current engine session state');
|
|
1527
|
+
deliverEnterTextNatsResponse(correlationID, {
|
|
1528
|
+
eventType: 'dialog_text_entered_response',
|
|
1529
|
+
correlationID,
|
|
1530
|
+
requestID,
|
|
1531
|
+
resultCode,
|
|
1532
|
+
resultMessage,
|
|
1533
|
+
currentState,
|
|
1534
|
+
});
|
|
1535
|
+
}
|
|
1536
|
+
catch (error) {
|
|
1537
|
+
logWidgetError('NATS catch-up failed', error);
|
|
1538
|
+
}
|
|
1539
|
+
}, [sessionId, deliverEnterTextNatsResponse]);
|
|
1494
1540
|
useNats({
|
|
1495
1541
|
baseUrl,
|
|
1496
1542
|
sessionId,
|
|
@@ -1510,6 +1556,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
1510
1556
|
deliverEnterTextNatsResponse(correlationID, event);
|
|
1511
1557
|
}, [deliverEnterTextNatsResponse]),
|
|
1512
1558
|
onError: deliverEnterTextNatsError,
|
|
1559
|
+
onCatchUp: catchUpPendingEnterText,
|
|
1513
1560
|
});
|
|
1514
1561
|
const focusChatInput = () => {
|
|
1515
1562
|
let textarea = document.querySelector('#chat-fieldset textarea');
|
|
@@ -1548,16 +1595,22 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
1548
1595
|
}, []);
|
|
1549
1596
|
useEffect(() => {
|
|
1550
1597
|
if (!isPlayingAudio &&
|
|
1598
|
+
!memoriTyping &&
|
|
1551
1599
|
continuousSpeech &&
|
|
1552
1600
|
(hasUserActivatedListening || !requestedListening) &&
|
|
1553
1601
|
sessionId &&
|
|
1554
1602
|
!hasUserTypedMessage) {
|
|
1555
1603
|
startRecording();
|
|
1556
1604
|
}
|
|
1557
|
-
else if (isPlayingAudio && isListening) {
|
|
1605
|
+
else if ((isPlayingAudio || memoriTyping) && isListening) {
|
|
1558
1606
|
stopRecording();
|
|
1559
1607
|
}
|
|
1560
|
-
}, [
|
|
1608
|
+
}, [
|
|
1609
|
+
isPlayingAudio,
|
|
1610
|
+
hasUserActivatedListening,
|
|
1611
|
+
hasUserTypedMessage,
|
|
1612
|
+
memoriTyping,
|
|
1613
|
+
]);
|
|
1561
1614
|
useEffect(() => {
|
|
1562
1615
|
stopRecording();
|
|
1563
1616
|
}, [language]);
|
|
@@ -1607,7 +1660,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
1607
1660
|
transform: none;
|
|
1608
1661
|
}`);
|
|
1609
1662
|
}
|
|
1610
|
-
const integrationStylesheet = `@layer
|
|
1663
|
+
const integrationStylesheet = `@layer memori.overrides {
|
|
1611
1664
|
${integrationStylesheetParts.join('\n ')}
|
|
1612
1665
|
}
|
|
1613
1666
|
`;
|
|
@@ -1709,8 +1762,9 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
1709
1762
|
if (!birth && autoStart && (initialSessionID || targetSessionID))
|
|
1710
1763
|
birth = '1970-01-01T10:24:03.845Z';
|
|
1711
1764
|
const localPosition = getLocalConfig('position', undefined);
|
|
1712
|
-
if (autoStart &&
|
|
1713
|
-
|
|
1765
|
+
if (autoStart &&
|
|
1766
|
+
shouldHoldAutoStartForPosition(!!memori.needsPosition, Boolean(position || localPosition))) {
|
|
1767
|
+
setClickedStart(false);
|
|
1714
1768
|
return;
|
|
1715
1769
|
}
|
|
1716
1770
|
if (!(await checkCredits({ notify: true }))) {
|
|
@@ -1987,8 +2041,9 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
1987
2041
|
}, [memoriPwd, memori, memoriTokens, birthDate, sessionId, userLang, position]);
|
|
1988
2042
|
const setPositionPopoverOpen = useCallback((open) => {
|
|
1989
2043
|
const sessionAlreadyStarted = !!(sessionId && hasUserActivatedSpeak);
|
|
2044
|
+
const hasPosition = Boolean(position || getLocalConfig('position', undefined));
|
|
1990
2045
|
setPositionPopoverOpenState(wasOpen => {
|
|
1991
|
-
if (shouldRestartSessionOnPositionPopoverClose(wasOpen, open, autoStart, sessionAlreadyStarted)) {
|
|
2046
|
+
if (shouldRestartSessionOnPositionPopoverClose(wasOpen, open, autoStart, sessionAlreadyStarted, hasPosition)) {
|
|
1992
2047
|
queueMicrotask(() => {
|
|
1993
2048
|
onClickStart();
|
|
1994
2049
|
});
|
|
@@ -2000,14 +2055,17 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
2000
2055
|
}
|
|
2001
2056
|
return open;
|
|
2002
2057
|
});
|
|
2003
|
-
}, [autoStart, onClickStart, sessionId, hasUserActivatedSpeak]);
|
|
2058
|
+
}, [autoStart, onClickStart, sessionId, hasUserActivatedSpeak, position]);
|
|
2004
2059
|
useEffect(() => {
|
|
2060
|
+
const storedPosition = getLocalConfig('position', undefined);
|
|
2061
|
+
const hasPosition = Boolean(position || storedPosition);
|
|
2005
2062
|
if (!clickedStart &&
|
|
2006
2063
|
!sessionStartingRef.current &&
|
|
2007
2064
|
!sessionId &&
|
|
2008
2065
|
autoStart &&
|
|
2009
2066
|
selectedLayout !== 'HIDDEN_CHAT' &&
|
|
2010
|
-
(!needsCredits || hasEnoughCredits)
|
|
2067
|
+
(!needsCredits || hasEnoughCredits) &&
|
|
2068
|
+
!shouldHoldAutoStartForPosition(!!memori.needsPosition, hasPosition)) {
|
|
2011
2069
|
onClickStart();
|
|
2012
2070
|
}
|
|
2013
2071
|
}, [
|
|
@@ -2017,6 +2075,8 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
2017
2075
|
sessionId,
|
|
2018
2076
|
needsCredits,
|
|
2019
2077
|
hasEnoughCredits,
|
|
2078
|
+
position,
|
|
2079
|
+
memori.needsPosition,
|
|
2020
2080
|
]);
|
|
2021
2081
|
useEffect(() => {
|
|
2022
2082
|
var _a;
|
|
@@ -2154,7 +2214,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
2154
2214
|
};
|
|
2155
2215
|
}, [sessionId]);
|
|
2156
2216
|
const showFullHistory = showOnlyLastMessages === undefined
|
|
2157
|
-
? selectedLayout !== '
|
|
2217
|
+
? selectedLayout !== 'WEBSITE_ASSISTANT'
|
|
2158
2218
|
: !showOnlyLastMessages;
|
|
2159
2219
|
const canShowLoginButton = !(tenant === null || tenant === void 0 ? void 0 : tenant.ssoLogin) &&
|
|
2160
2220
|
((_y = showLogin !== null && showLogin !== void 0 ? showLogin : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.showLogin) !== null && _y !== void 0 ? _y : memori.requireLoginToken);
|
|
@@ -2438,7 +2498,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
2438
2498
|
setChatLogID(chatLog.chatLogID);
|
|
2439
2499
|
onClickStart(undefined, false, chatLog);
|
|
2440
2500
|
setShowChatHistoryDrawer(false);
|
|
2441
|
-
}, 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'
|
|
2501
|
+
}, apiClient: client, sessionId: sessionId || '', memori: memori, baseUrl: baseUrl, history: history, apiUrl: client.constants.BACKEND_URL, loginToken: loginToken, language: language, userLang: userLang, isMultilanguageEnabled: isMultilanguageEnabled, showFunctionCache: showFunctionCache, showMessageConsumption: enableMessageConsumption })), 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'
|
|
2442
2502
|
? 'memori-drawer--above-website-assistant'
|
|
2443
2503
|
: undefined, onLogin: (user, token) => {
|
|
2444
2504
|
var _a, _b, _c, _d;
|