@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,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dialogStateFingerprint = dialogStateFingerprint;
|
|
3
4
|
exports.getChatStyles = getChatStyles;
|
|
4
5
|
const tslib_1 = require("tslib");
|
|
5
6
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
@@ -84,6 +85,21 @@ function readCorrelationID(response) {
|
|
|
84
85
|
const value = response.correlationID;
|
|
85
86
|
return typeof value === 'string' && value.length > 0 ? value : undefined;
|
|
86
87
|
}
|
|
88
|
+
function dialogStateFingerprint(state) {
|
|
89
|
+
if (!state)
|
|
90
|
+
return '';
|
|
91
|
+
return JSON.stringify({
|
|
92
|
+
state: state.state,
|
|
93
|
+
previousState: state.previousState,
|
|
94
|
+
emission: state.emission,
|
|
95
|
+
emitter: state.emitter,
|
|
96
|
+
lastMatchedMemoryID: state.lastMatchedMemoryID,
|
|
97
|
+
currentDate: state.currentDate,
|
|
98
|
+
currentMemoryID: state.currentMemoryID,
|
|
99
|
+
contextVars: state.contextVars,
|
|
100
|
+
emittedMedia: state.emittedMedia,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
87
103
|
const typeMessage = (message, waitForPrevious = true, hidden = false, typingText, useLoaderTextAsMsg = false, hasBatchQueued = false) => {
|
|
88
104
|
const e = new CustomEvent('MemoriTextEntered', {
|
|
89
105
|
detail: {
|
|
@@ -187,22 +203,9 @@ function getChatStyles(config) {
|
|
|
187
203
|
const primaryContent = (_a = config === null || config === void 0 ? void 0 : config.buttonTextColor) !== null && _a !== void 0 ? _a : '#ffffff';
|
|
188
204
|
return {
|
|
189
205
|
'--memori-primary-color': primary,
|
|
190
|
-
'--memori-primary': primary,
|
|
191
206
|
'--memori-primary-content': primaryContent,
|
|
192
|
-
'--memori-primary-hover': 'color-mix(in oklch, var(--memori-primary), var(--memori-surface-contrast, black) 15%)',
|
|
193
|
-
'--memori-primary-active': 'color-mix(in oklch, var(--memori-primary), var(--memori-surface-contrast, black) 25%)',
|
|
194
|
-
'--memori-primary-disabled': 'color-mix(in oklch, var(--memori-primary), transparent 60%)',
|
|
195
|
-
'--memori-primary-subtle': 'color-mix(in oklch, var(--memori-primary), var(--memori-surface-contrast-inverse, white) 60%)',
|
|
196
|
-
'--memori-primary-subtle-hover': 'color-mix(in oklch, var(--memori-primary), var(--memori-surface-contrast-inverse, white) 50%)',
|
|
197
|
-
'--memori-border-primary': 'color-mix(in oklch, var(--memori-primary), transparent 70%)',
|
|
198
|
-
'--memori-border-primary-hover': 'color-mix(in oklch, var(--memori-primary), transparent 50%)',
|
|
199
|
-
'--memori-focus-ring-color': 'color-mix(in oklch, var(--memori-primary), transparent 80%)',
|
|
200
|
-
'--memori-focus-ring': '0 0 0 3px var(--memori-focus-ring-color)',
|
|
201
|
-
'--memori-shadow-primary': '0 8px 16px -4px color-mix(in oklch, var(--memori-primary), transparent 70%)',
|
|
202
|
-
'--memori-skeleton-base': 'color-mix(in oklch, var(--memori-primary), var(--memori-surface-contrast-inverse, white) 85%)',
|
|
203
|
-
'--memori-skeleton-highlight': 'color-mix(in oklch, var(--memori-primary), var(--memori-surface-contrast-inverse, white) 75%)',
|
|
204
207
|
'--memori-icon-active-bg': 'color-mix(in oklch, var(--memori-primary) 12%, transparent)',
|
|
205
|
-
'--memori-icon-recording-bg': 'color-mix(in oklch, var(--memori-error
|
|
208
|
+
'--memori-icon-recording-bg': 'color-mix(in oklch, var(--memori-error) 12%, transparent)',
|
|
206
209
|
};
|
|
207
210
|
}
|
|
208
211
|
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, }) => {
|
|
@@ -570,6 +573,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
570
573
|
if (response.resultCode === 0 && correlationID) {
|
|
571
574
|
registerPendingEnterText(correlationID, {
|
|
572
575
|
msg,
|
|
576
|
+
stateBeforeRequest: dialogStateFingerprint(currentDialogState),
|
|
573
577
|
text,
|
|
574
578
|
media,
|
|
575
579
|
translate,
|
|
@@ -826,7 +830,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
826
830
|
}
|
|
827
831
|
}, [initialSessionID]);
|
|
828
832
|
const fetchSession = async (params) => {
|
|
829
|
-
var _a, _b, _c, _d, _f, _g, _h;
|
|
833
|
+
var _a, _b, _c, _d, _f, _g, _h, _j;
|
|
830
834
|
let storageBirthDate = (0, configuration_1.getLocalConfig)('birthDate', undefined);
|
|
831
835
|
let userBirthDate = (_a = birthDate !== null && birthDate !== void 0 ? birthDate : params.birthDate) !== null && _a !== void 0 ? _a : storageBirthDate;
|
|
832
836
|
if (!userBirthDate && !!minAge) {
|
|
@@ -834,8 +838,10 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
834
838
|
return;
|
|
835
839
|
}
|
|
836
840
|
if (memori.privacyType !== 'PUBLIC' &&
|
|
841
|
+
!params.password &&
|
|
837
842
|
!memori.secretToken &&
|
|
838
843
|
!memoriPwd &&
|
|
844
|
+
!((_b = params.recoveryTokens) === null || _b === void 0 ? void 0 : _b.length) &&
|
|
839
845
|
!memoriTokens) {
|
|
840
846
|
setAuthModalState('password');
|
|
841
847
|
return;
|
|
@@ -851,17 +857,17 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
851
857
|
return window.location.href;
|
|
852
858
|
})();
|
|
853
859
|
}
|
|
854
|
-
catch (
|
|
860
|
+
catch (_k) {
|
|
855
861
|
}
|
|
856
862
|
const session = await initSession({
|
|
857
863
|
...params,
|
|
858
864
|
birthDate: userBirthDate,
|
|
859
|
-
tag: (
|
|
860
|
-
pin: (
|
|
865
|
+
tag: (_c = params.tag) !== null && _c !== void 0 ? _c : personification === null || personification === void 0 ? void 0 : personification.tag,
|
|
866
|
+
pin: (_d = params.pin) !== null && _d !== void 0 ? _d : personification === null || personification === void 0 ? void 0 : personification.pin,
|
|
861
867
|
additionalInfo: {
|
|
862
868
|
...(params.additionalInfo || additionalInfo || {}),
|
|
863
|
-
loginToken: resolveLoginToken((
|
|
864
|
-
language: ((
|
|
869
|
+
loginToken: resolveLoginToken((_f = params.additionalInfo) === null || _f === void 0 ? void 0 : _f.loginToken),
|
|
870
|
+
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(),
|
|
865
871
|
referral: referral,
|
|
866
872
|
timeZoneOffset: new Date().getTimezoneOffset().toString(),
|
|
867
873
|
},
|
|
@@ -917,15 +923,17 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
917
923
|
try {
|
|
918
924
|
if (!userBirthDate && !!minAge) {
|
|
919
925
|
setShowAgeVerification(true);
|
|
926
|
+
setLoading(false);
|
|
920
927
|
return;
|
|
921
928
|
}
|
|
922
929
|
if (memori.privacyType !== 'PUBLIC' &&
|
|
923
930
|
!password &&
|
|
924
931
|
!memori.secretToken &&
|
|
925
932
|
!memoriPwd &&
|
|
926
|
-
!recoveryTokens &&
|
|
933
|
+
!(recoveryTokens === null || recoveryTokens === void 0 ? void 0 : recoveryTokens.length) &&
|
|
927
934
|
!memoriTokens) {
|
|
928
935
|
setAuthModalState('password');
|
|
936
|
+
setLoading(false);
|
|
929
937
|
return;
|
|
930
938
|
}
|
|
931
939
|
if (!(await checkCredits({ notify: true }))) {
|
|
@@ -1482,6 +1490,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
1482
1490
|
reject(new Error('NATS enter-text response timeout'));
|
|
1483
1491
|
}, timeoutMs);
|
|
1484
1492
|
registerPendingEnterText(correlationID, {
|
|
1493
|
+
stateBeforeRequest: dialogStateFingerprint(currentDialogState),
|
|
1485
1494
|
waitForResponse: {
|
|
1486
1495
|
resolve: event => {
|
|
1487
1496
|
clearTimeout(timeoutId);
|
|
@@ -1494,7 +1503,45 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
1494
1503
|
timeoutId,
|
|
1495
1504
|
},
|
|
1496
1505
|
});
|
|
1497
|
-
}), [registerPendingEnterText, clearEnterTextPending]);
|
|
1506
|
+
}), [registerPendingEnterText, clearEnterTextPending, currentDialogState]);
|
|
1507
|
+
const catchUpPendingEnterText = (0, react_1.useCallback)(async () => {
|
|
1508
|
+
if (!sessionId || pendingEnterTextRef.current.size === 0)
|
|
1509
|
+
return;
|
|
1510
|
+
const latest = Array.from(pendingEnterTextRef.current.entries()).pop();
|
|
1511
|
+
if (!latest)
|
|
1512
|
+
return;
|
|
1513
|
+
const [correlationID, pending] = latest;
|
|
1514
|
+
try {
|
|
1515
|
+
const { currentState, resultCode, resultMessage, requestID } = await getSession(sessionId);
|
|
1516
|
+
if (resultCode !== 0 || !currentState) {
|
|
1517
|
+
deliverEnterTextNatsResponse(correlationID, {
|
|
1518
|
+
eventType: 'dialog_text_entered_response',
|
|
1519
|
+
correlationID,
|
|
1520
|
+
requestID,
|
|
1521
|
+
resultCode,
|
|
1522
|
+
resultMessage,
|
|
1523
|
+
currentState,
|
|
1524
|
+
});
|
|
1525
|
+
return;
|
|
1526
|
+
}
|
|
1527
|
+
if (dialogStateFingerprint(currentState) === pending.stateBeforeRequest) {
|
|
1528
|
+
console.info('[NATS] catch-up: pending turn has not completed yet');
|
|
1529
|
+
return;
|
|
1530
|
+
}
|
|
1531
|
+
console.info('[NATS] catch-up: applying current engine session state');
|
|
1532
|
+
deliverEnterTextNatsResponse(correlationID, {
|
|
1533
|
+
eventType: 'dialog_text_entered_response',
|
|
1534
|
+
correlationID,
|
|
1535
|
+
requestID,
|
|
1536
|
+
resultCode,
|
|
1537
|
+
resultMessage,
|
|
1538
|
+
currentState,
|
|
1539
|
+
});
|
|
1540
|
+
}
|
|
1541
|
+
catch (error) {
|
|
1542
|
+
logWidgetError('NATS catch-up failed', error);
|
|
1543
|
+
}
|
|
1544
|
+
}, [sessionId, deliverEnterTextNatsResponse]);
|
|
1498
1545
|
(0, useNats_1.useNats)({
|
|
1499
1546
|
baseUrl,
|
|
1500
1547
|
sessionId,
|
|
@@ -1514,6 +1561,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
1514
1561
|
deliverEnterTextNatsResponse(correlationID, event);
|
|
1515
1562
|
}, [deliverEnterTextNatsResponse]),
|
|
1516
1563
|
onError: deliverEnterTextNatsError,
|
|
1564
|
+
onCatchUp: catchUpPendingEnterText,
|
|
1517
1565
|
});
|
|
1518
1566
|
const focusChatInput = () => {
|
|
1519
1567
|
let textarea = document.querySelector('#chat-fieldset textarea');
|
|
@@ -1552,16 +1600,22 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
1552
1600
|
}, []);
|
|
1553
1601
|
(0, react_1.useEffect)(() => {
|
|
1554
1602
|
if (!isPlayingAudio &&
|
|
1603
|
+
!memoriTyping &&
|
|
1555
1604
|
continuousSpeech &&
|
|
1556
1605
|
(hasUserActivatedListening || !requestedListening) &&
|
|
1557
1606
|
sessionId &&
|
|
1558
1607
|
!hasUserTypedMessage) {
|
|
1559
1608
|
startRecording();
|
|
1560
1609
|
}
|
|
1561
|
-
else if (isPlayingAudio && isListening) {
|
|
1610
|
+
else if ((isPlayingAudio || memoriTyping) && isListening) {
|
|
1562
1611
|
stopRecording();
|
|
1563
1612
|
}
|
|
1564
|
-
}, [
|
|
1613
|
+
}, [
|
|
1614
|
+
isPlayingAudio,
|
|
1615
|
+
hasUserActivatedListening,
|
|
1616
|
+
hasUserTypedMessage,
|
|
1617
|
+
memoriTyping,
|
|
1618
|
+
]);
|
|
1565
1619
|
(0, react_1.useEffect)(() => {
|
|
1566
1620
|
stopRecording();
|
|
1567
1621
|
}, [language]);
|
|
@@ -1611,7 +1665,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
1611
1665
|
transform: none;
|
|
1612
1666
|
}`);
|
|
1613
1667
|
}
|
|
1614
|
-
const integrationStylesheet = `@layer
|
|
1668
|
+
const integrationStylesheet = `@layer memori.overrides {
|
|
1615
1669
|
${integrationStylesheetParts.join('\n ')}
|
|
1616
1670
|
}
|
|
1617
1671
|
`;
|
|
@@ -1713,8 +1767,9 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
1713
1767
|
if (!birth && autoStart && (initialSessionID || targetSessionID))
|
|
1714
1768
|
birth = '1970-01-01T10:24:03.845Z';
|
|
1715
1769
|
const localPosition = (0, configuration_1.getLocalConfig)('position', undefined);
|
|
1716
|
-
if (autoStart &&
|
|
1717
|
-
|
|
1770
|
+
if (autoStart &&
|
|
1771
|
+
(0, positionPopover_1.shouldHoldAutoStartForPosition)(!!memori.needsPosition, Boolean(position || localPosition))) {
|
|
1772
|
+
setClickedStart(false);
|
|
1718
1773
|
return;
|
|
1719
1774
|
}
|
|
1720
1775
|
if (!(await checkCredits({ notify: true }))) {
|
|
@@ -1991,8 +2046,9 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
1991
2046
|
}, [memoriPwd, memori, memoriTokens, birthDate, sessionId, userLang, position]);
|
|
1992
2047
|
const setPositionPopoverOpen = (0, react_1.useCallback)((open) => {
|
|
1993
2048
|
const sessionAlreadyStarted = !!(sessionId && hasUserActivatedSpeak);
|
|
2049
|
+
const hasPosition = Boolean(position || (0, configuration_1.getLocalConfig)('position', undefined));
|
|
1994
2050
|
setPositionPopoverOpenState(wasOpen => {
|
|
1995
|
-
if ((0, positionPopover_1.shouldRestartSessionOnPositionPopoverClose)(wasOpen, open, autoStart, sessionAlreadyStarted)) {
|
|
2051
|
+
if ((0, positionPopover_1.shouldRestartSessionOnPositionPopoverClose)(wasOpen, open, autoStart, sessionAlreadyStarted, hasPosition)) {
|
|
1996
2052
|
queueMicrotask(() => {
|
|
1997
2053
|
onClickStart();
|
|
1998
2054
|
});
|
|
@@ -2004,14 +2060,17 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
2004
2060
|
}
|
|
2005
2061
|
return open;
|
|
2006
2062
|
});
|
|
2007
|
-
}, [autoStart, onClickStart, sessionId, hasUserActivatedSpeak]);
|
|
2063
|
+
}, [autoStart, onClickStart, sessionId, hasUserActivatedSpeak, position]);
|
|
2008
2064
|
(0, react_1.useEffect)(() => {
|
|
2065
|
+
const storedPosition = (0, configuration_1.getLocalConfig)('position', undefined);
|
|
2066
|
+
const hasPosition = Boolean(position || storedPosition);
|
|
2009
2067
|
if (!clickedStart &&
|
|
2010
2068
|
!sessionStartingRef.current &&
|
|
2011
2069
|
!sessionId &&
|
|
2012
2070
|
autoStart &&
|
|
2013
2071
|
selectedLayout !== 'HIDDEN_CHAT' &&
|
|
2014
|
-
(!needsCredits || hasEnoughCredits)
|
|
2072
|
+
(!needsCredits || hasEnoughCredits) &&
|
|
2073
|
+
!(0, positionPopover_1.shouldHoldAutoStartForPosition)(!!memori.needsPosition, hasPosition)) {
|
|
2015
2074
|
onClickStart();
|
|
2016
2075
|
}
|
|
2017
2076
|
}, [
|
|
@@ -2021,6 +2080,8 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
2021
2080
|
sessionId,
|
|
2022
2081
|
needsCredits,
|
|
2023
2082
|
hasEnoughCredits,
|
|
2083
|
+
position,
|
|
2084
|
+
memori.needsPosition,
|
|
2024
2085
|
]);
|
|
2025
2086
|
(0, react_1.useEffect)(() => {
|
|
2026
2087
|
var _a;
|
|
@@ -2158,7 +2219,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
2158
2219
|
};
|
|
2159
2220
|
}, [sessionId]);
|
|
2160
2221
|
const showFullHistory = showOnlyLastMessages === undefined
|
|
2161
|
-
? selectedLayout !== '
|
|
2222
|
+
? selectedLayout !== 'WEBSITE_ASSISTANT'
|
|
2162
2223
|
: !showOnlyLastMessages;
|
|
2163
2224
|
const canShowLoginButton = !(tenant === null || tenant === void 0 ? void 0 : tenant.ssoLogin) &&
|
|
2164
2225
|
((_y = showLogin !== null && showLogin !== void 0 ? showLogin : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.showLogin) !== null && _y !== void 0 ? _y : memori.requireLoginToken);
|
|
@@ -2442,7 +2503,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
2442
2503
|
setChatLogID(chatLog.chatLogID);
|
|
2443
2504
|
onClickStart(undefined, false, chatLog);
|
|
2444
2505
|
setShowChatHistoryDrawer(false);
|
|
2445
|
-
}, 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'
|
|
2506
|
+
}, 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 && ((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'
|
|
2446
2507
|
? 'memori-drawer--above-website-assistant'
|
|
2447
2508
|
: undefined, onLogin: (user, token) => {
|
|
2448
2509
|
var _a, _b, _c, _d;
|