@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,17 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Meta, Story } from '@storybook/react';
|
|
3
3
|
import { memori, integration, tenant } from '../../mocks/data';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
4
|
+
import Memori, { Props } from '../../index';
|
|
5
|
+
import { withWidgetProviders } from '../../../.storybook/decorators';
|
|
6
6
|
|
|
7
7
|
import './MemoriWidget.css';
|
|
8
|
-
import { VisemeProvider } from '../../context/visemeContext';
|
|
9
|
-
import { ArtifactProvider } from '../MemoriArtifactSystem/context/ArtifactContext';
|
|
10
|
-
import { AlertProvider } from '@memori.ai/ui';
|
|
11
8
|
|
|
12
9
|
const meta: Meta = {
|
|
13
|
-
title: '
|
|
14
|
-
component:
|
|
10
|
+
title: 'Compositions/MemoriWidget',
|
|
11
|
+
component: Memori,
|
|
12
|
+
decorators: [withWidgetProviders],
|
|
15
13
|
argTypes: {
|
|
16
14
|
AZURE_COGNITIVE_SERVICES_TTS_KEY: {
|
|
17
15
|
control: {
|
|
@@ -37,79 +35,74 @@ const meta: Meta = {
|
|
|
37
35
|
|
|
38
36
|
export default meta;
|
|
39
37
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
38
|
+
/** Same live agent as Layouts / Full Page. */
|
|
39
|
+
const fixtureBase: Partial<Props> = {
|
|
40
|
+
memori,
|
|
41
|
+
tenant,
|
|
42
|
+
memoriName: memori.name,
|
|
43
|
+
memoriID: memori.memoriID,
|
|
44
|
+
ownerUserName: 'memoridev',
|
|
45
|
+
tenantID: 'www.aisuru.com',
|
|
46
|
+
engineURL: 'https://engine.memori.ai',
|
|
47
|
+
apiURL: 'https://backend.memori.ai',
|
|
48
|
+
baseURL: 'https://www.aisuru.com',
|
|
49
|
+
uiLang: 'IT',
|
|
50
|
+
spokenLang: 'IT',
|
|
51
|
+
showSettings: true,
|
|
52
|
+
showShare: true,
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const Template: Story<Props> = args => <Memori {...args} />;
|
|
51
56
|
// By passing using the Args format for exported stories, you can control the props for a component for reuse in a test
|
|
52
57
|
// https://storybook.js.org/docs/react/workflows/unit-testing
|
|
53
58
|
export const Default = Template.bind({});
|
|
54
59
|
Default.args = {
|
|
55
|
-
|
|
56
|
-
|
|
60
|
+
...fixtureBase,
|
|
61
|
+
layout: 'FULLPAGE',
|
|
57
62
|
};
|
|
58
63
|
|
|
59
64
|
export const WithAutoStart = Template.bind({});
|
|
60
65
|
WithAutoStart.args = {
|
|
61
|
-
|
|
62
|
-
tenant,
|
|
66
|
+
...fixtureBase,
|
|
63
67
|
autoStart: true,
|
|
64
68
|
layout: 'FULLPAGE',
|
|
65
69
|
};
|
|
66
70
|
|
|
67
71
|
export const WithPosition = Template.bind({});
|
|
68
72
|
WithPosition.args = {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
73
|
+
...fixtureBase,
|
|
74
|
+
layout: 'FULLPAGE',
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export const WithAutoStartAndRequiredPosition = Template.bind({});
|
|
78
|
+
WithAutoStartAndRequiredPosition.args = {
|
|
79
|
+
...fixtureBase,
|
|
80
|
+
autoStart: true,
|
|
74
81
|
layout: 'FULLPAGE',
|
|
75
82
|
};
|
|
76
83
|
|
|
77
84
|
export const WithLoginRequired = Template.bind({});
|
|
78
85
|
WithLoginRequired.args = {
|
|
79
|
-
|
|
80
|
-
...memori,
|
|
81
|
-
requireLoginToken: true,
|
|
82
|
-
},
|
|
83
|
-
tenant,
|
|
86
|
+
...fixtureBase,
|
|
84
87
|
layout: 'FULLPAGE',
|
|
85
88
|
};
|
|
86
89
|
|
|
87
90
|
export const WithDates = Template.bind({});
|
|
88
91
|
WithDates.args = {
|
|
89
|
-
|
|
90
|
-
...memori,
|
|
91
|
-
needsDateTime: true,
|
|
92
|
-
},
|
|
93
|
-
tenant,
|
|
92
|
+
...fixtureBase,
|
|
94
93
|
layout: 'FULLPAGE',
|
|
95
94
|
};
|
|
96
95
|
|
|
97
96
|
/** To test dateUTC/place in Enter Text: open DevTools → Network, start chat, set position (header position icon) if testing place, then send a message. Inspect the request to your backend/engine for body.dateUTC (ISO) and body.place (placeName, latitude, longitude, uncertaintyKm). */
|
|
98
97
|
export const WithDateAndPlaceForEnterText = Template.bind({});
|
|
99
98
|
WithDateAndPlaceForEnterText.args = {
|
|
100
|
-
|
|
101
|
-
...memori,
|
|
102
|
-
needsDateTime: true,
|
|
103
|
-
needsPosition: true,
|
|
104
|
-
},
|
|
105
|
-
tenant,
|
|
99
|
+
...fixtureBase,
|
|
106
100
|
layout: 'FULLPAGE',
|
|
107
101
|
};
|
|
108
102
|
|
|
109
103
|
export const WithPublicPageIntegration = Template.bind({});
|
|
110
104
|
WithPublicPageIntegration.args = {
|
|
111
|
-
|
|
112
|
-
tenant,
|
|
105
|
+
...fixtureBase,
|
|
113
106
|
integration: {
|
|
114
107
|
...integration,
|
|
115
108
|
customData: JSON.stringify({
|
|
@@ -125,8 +118,7 @@ WithPublicPageIntegration.args = {
|
|
|
125
118
|
|
|
126
119
|
export const WithPublicPageIntegrationAndFullbodyAvatar = Template.bind({});
|
|
127
120
|
WithPublicPageIntegrationAndFullbodyAvatar.args = {
|
|
128
|
-
|
|
129
|
-
tenant,
|
|
121
|
+
...fixtureBase,
|
|
130
122
|
integration: {
|
|
131
123
|
...integration,
|
|
132
124
|
customData: JSON.stringify({
|
|
@@ -142,8 +134,7 @@ WithPublicPageIntegrationAndFullbodyAvatar.args = {
|
|
|
142
134
|
|
|
143
135
|
export const WithPublicPageIntegrationAndNonDefaultLang = Template.bind({});
|
|
144
136
|
WithPublicPageIntegrationAndNonDefaultLang.args = {
|
|
145
|
-
|
|
146
|
-
tenant,
|
|
137
|
+
...fixtureBase,
|
|
147
138
|
integration: {
|
|
148
139
|
...integration,
|
|
149
140
|
customData: JSON.stringify({
|
|
@@ -156,40 +147,35 @@ WithPublicPageIntegrationAndNonDefaultLang.args = {
|
|
|
156
147
|
|
|
157
148
|
export const ShowShare = Template.bind({});
|
|
158
149
|
ShowShare.args = {
|
|
159
|
-
|
|
160
|
-
tenant,
|
|
150
|
+
...fixtureBase,
|
|
161
151
|
showShare: true,
|
|
162
152
|
layout: 'FULLPAGE',
|
|
163
153
|
};
|
|
164
154
|
|
|
165
155
|
export const ShowSettings = Template.bind({});
|
|
166
156
|
ShowSettings.args = {
|
|
167
|
-
|
|
168
|
-
tenant,
|
|
157
|
+
...fixtureBase,
|
|
169
158
|
showSettings: true,
|
|
170
159
|
layout: 'FULLPAGE',
|
|
171
160
|
};
|
|
172
161
|
|
|
173
162
|
export const ShowClear = Template.bind({});
|
|
174
163
|
ShowClear.args = {
|
|
175
|
-
|
|
176
|
-
tenant,
|
|
164
|
+
...fixtureBase,
|
|
177
165
|
showClear: true,
|
|
178
166
|
layout: 'FULLPAGE',
|
|
179
167
|
};
|
|
180
168
|
|
|
181
169
|
export const ShowUpload = Template.bind({});
|
|
182
170
|
ShowUpload.args = {
|
|
183
|
-
|
|
184
|
-
tenant,
|
|
171
|
+
...fixtureBase,
|
|
185
172
|
showUpload: true,
|
|
186
173
|
layout: 'FULLPAGE',
|
|
187
174
|
};
|
|
188
175
|
|
|
189
176
|
export const ShowUploadFromIntegration = Template.bind({});
|
|
190
177
|
ShowUploadFromIntegration.args = {
|
|
191
|
-
|
|
192
|
-
tenant,
|
|
178
|
+
...fixtureBase,
|
|
193
179
|
showUpload: false,
|
|
194
180
|
integration: {
|
|
195
181
|
...integration,
|
|
@@ -203,8 +189,7 @@ ShowUploadFromIntegration.args = {
|
|
|
203
189
|
|
|
204
190
|
export const WithoutAudio = Template.bind({});
|
|
205
191
|
WithoutAudio.args = {
|
|
206
|
-
|
|
207
|
-
tenant,
|
|
192
|
+
...fixtureBase,
|
|
208
193
|
enableAudio: false,
|
|
209
194
|
AZURE_COGNITIVE_SERVICES_TTS_KEY: 'provide your key here',
|
|
210
195
|
layout: 'FULLPAGE',
|
|
@@ -212,8 +197,7 @@ WithoutAudio.args = {
|
|
|
212
197
|
|
|
213
198
|
export const WithoutAudioFromIntegrationConfig = Template.bind({});
|
|
214
199
|
WithoutAudioFromIntegrationConfig.args = {
|
|
215
|
-
|
|
216
|
-
tenant,
|
|
200
|
+
...fixtureBase,
|
|
217
201
|
integration: {
|
|
218
202
|
...integration,
|
|
219
203
|
customData: JSON.stringify({
|
|
@@ -226,8 +210,7 @@ WithoutAudioFromIntegrationConfig.args = {
|
|
|
226
210
|
|
|
227
211
|
export const DefautSpeakerDisabled = Template.bind({});
|
|
228
212
|
DefautSpeakerDisabled.args = {
|
|
229
|
-
|
|
230
|
-
tenant,
|
|
213
|
+
...fixtureBase,
|
|
231
214
|
defaultSpeakerActive: false,
|
|
232
215
|
AZURE_COGNITIVE_SERVICES_TTS_KEY: 'provide your key here',
|
|
233
216
|
layout: 'FULLPAGE',
|
|
@@ -235,32 +218,28 @@ DefautSpeakerDisabled.args = {
|
|
|
235
218
|
|
|
236
219
|
export const ShowOnlyLastMessages = Template.bind({});
|
|
237
220
|
ShowOnlyLastMessages.args = {
|
|
238
|
-
|
|
239
|
-
tenant,
|
|
221
|
+
...fixtureBase,
|
|
240
222
|
showOnlyLastMessages: true,
|
|
241
223
|
layout: 'FULLPAGE',
|
|
242
224
|
};
|
|
243
225
|
|
|
244
226
|
export const ShowOnlyLastMessagesWithAnotherDefault = Template.bind({});
|
|
245
227
|
ShowOnlyLastMessagesWithAnotherDefault.args = {
|
|
246
|
-
|
|
247
|
-
tenant,
|
|
228
|
+
...fixtureBase,
|
|
248
229
|
showOnlyLastMessages: false,
|
|
249
230
|
layout: 'FULLPAGE',
|
|
250
231
|
};
|
|
251
232
|
|
|
252
233
|
export const WithAzureSpeechKey = Template.bind({});
|
|
253
234
|
WithAzureSpeechKey.args = {
|
|
254
|
-
|
|
255
|
-
tenant,
|
|
235
|
+
...fixtureBase,
|
|
256
236
|
AZURE_COGNITIVE_SERVICES_TTS_KEY: 'provide your key here',
|
|
257
237
|
layout: 'FULLPAGE',
|
|
258
238
|
};
|
|
259
239
|
|
|
260
240
|
export const WithCustomMediaRenderer = Template.bind({});
|
|
261
241
|
WithCustomMediaRenderer.args = {
|
|
262
|
-
|
|
263
|
-
tenant,
|
|
242
|
+
...fixtureBase,
|
|
264
243
|
customMediaRenderer: (mimeType: string) => (
|
|
265
244
|
<div
|
|
266
245
|
style={{
|
|
@@ -280,16 +259,15 @@ WithCustomMediaRenderer.args = {
|
|
|
280
259
|
|
|
281
260
|
export const WithUserAvatar = Template.bind({});
|
|
282
261
|
WithUserAvatar.args = {
|
|
283
|
-
|
|
284
|
-
tenant,
|
|
262
|
+
...fixtureBase,
|
|
285
263
|
userAvatar: 'https://picsum.photos/200',
|
|
286
264
|
layout: 'FULLPAGE',
|
|
287
265
|
};
|
|
288
266
|
|
|
289
267
|
export const WithUserAvatarAsElement = Template.bind({});
|
|
290
268
|
WithUserAvatarAsElement.args = {
|
|
291
|
-
|
|
292
|
-
tenant,
|
|
269
|
+
...fixtureBase,
|
|
293
270
|
userAvatar: <span>USER</span>,
|
|
294
271
|
layout: 'FULLPAGE',
|
|
295
272
|
};
|
|
273
|
+
|
|
@@ -24,7 +24,10 @@ import type {
|
|
|
24
24
|
PiiDetectionConfig,
|
|
25
25
|
} from '../../types/layout';
|
|
26
26
|
import { checkPii } from '../../helpers/piiDetection'; // PII check when integrationConfig.layout has piiDetection.enabled
|
|
27
|
-
import {
|
|
27
|
+
import {
|
|
28
|
+
shouldHoldAutoStartForPosition,
|
|
29
|
+
shouldRestartSessionOnPositionPopoverClose,
|
|
30
|
+
} from '../../helpers/positionPopover';
|
|
28
31
|
|
|
29
32
|
// Libraries
|
|
30
33
|
import React, {
|
|
@@ -173,6 +176,22 @@ function readCorrelationID(response: {
|
|
|
173
176
|
return typeof value === 'string' && value.length > 0 ? value : undefined;
|
|
174
177
|
}
|
|
175
178
|
|
|
179
|
+
/** Stable engine-owned fields used to tell whether a pending turn completed. */
|
|
180
|
+
export function dialogStateFingerprint(state: DialogState | undefined): string {
|
|
181
|
+
if (!state) return '';
|
|
182
|
+
return JSON.stringify({
|
|
183
|
+
state: state.state,
|
|
184
|
+
previousState: state.previousState,
|
|
185
|
+
emission: state.emission,
|
|
186
|
+
emitter: state.emitter,
|
|
187
|
+
lastMatchedMemoryID: state.lastMatchedMemoryID,
|
|
188
|
+
currentDate: state.currentDate,
|
|
189
|
+
currentMemoryID: state.currentMemoryID,
|
|
190
|
+
contextVars: state.contextVars,
|
|
191
|
+
emittedMedia: state.emittedMedia,
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
|
|
176
195
|
type MemoriTextEnteredEvent = CustomEvent<{
|
|
177
196
|
text: string;
|
|
178
197
|
waitForPrevious?: boolean;
|
|
@@ -511,9 +530,8 @@ type ChatStylesConfig = {
|
|
|
511
530
|
|
|
512
531
|
/**
|
|
513
532
|
* Returns CSS custom properties for the chat container when a brand primary is set.
|
|
514
|
-
*
|
|
515
|
-
*
|
|
516
|
-
* If buttonBgColor is missing, returns {} so global CSS defaults are used.
|
|
533
|
+
* Sets the UI brand hook (`--memori-primary-color`); hover/active/subtle derive from
|
|
534
|
+
* `@memori.ai/ui` theme tokens. Widget-only icon soft fills stay here.
|
|
517
535
|
*/
|
|
518
536
|
export function getChatStyles(
|
|
519
537
|
config: ChatStylesConfig | null | undefined
|
|
@@ -523,41 +541,14 @@ export function getChatStyles(
|
|
|
523
541
|
|
|
524
542
|
const primaryContent = config?.buttonTextColor ?? '#ffffff';
|
|
525
543
|
|
|
526
|
-
// Match @memori.ai/ui token semantics:
|
|
527
|
-
// --memori-surface-contrast = ink (#000 light / #fff dark)
|
|
528
|
-
// --memori-surface-contrast-inverse = surface (#fff light / #000 dark)
|
|
529
544
|
return {
|
|
530
545
|
'--memori-primary-color': primary,
|
|
531
|
-
'--memori-primary': primary,
|
|
532
546
|
'--memori-primary-content': primaryContent,
|
|
533
|
-
'--memori-primary-hover':
|
|
534
|
-
'color-mix(in oklch, var(--memori-primary), var(--memori-surface-contrast, black) 15%)',
|
|
535
|
-
'--memori-primary-active':
|
|
536
|
-
'color-mix(in oklch, var(--memori-primary), var(--memori-surface-contrast, black) 25%)',
|
|
537
|
-
'--memori-primary-disabled':
|
|
538
|
-
'color-mix(in oklch, var(--memori-primary), transparent 60%)',
|
|
539
|
-
'--memori-primary-subtle':
|
|
540
|
-
'color-mix(in oklch, var(--memori-primary), var(--memori-surface-contrast-inverse, white) 60%)',
|
|
541
|
-
'--memori-primary-subtle-hover':
|
|
542
|
-
'color-mix(in oklch, var(--memori-primary), var(--memori-surface-contrast-inverse, white) 50%)',
|
|
543
|
-
'--memori-border-primary':
|
|
544
|
-
'color-mix(in oklch, var(--memori-primary), transparent 70%)',
|
|
545
|
-
'--memori-border-primary-hover':
|
|
546
|
-
'color-mix(in oklch, var(--memori-primary), transparent 50%)',
|
|
547
|
-
'--memori-focus-ring-color':
|
|
548
|
-
'color-mix(in oklch, var(--memori-primary), transparent 80%)',
|
|
549
|
-
'--memori-focus-ring': '0 0 0 3px var(--memori-focus-ring-color)',
|
|
550
|
-
'--memori-shadow-primary':
|
|
551
|
-
'0 8px 16px -4px color-mix(in oklch, var(--memori-primary), transparent 70%)',
|
|
552
|
-
'--memori-skeleton-base':
|
|
553
|
-
'color-mix(in oklch, var(--memori-primary), var(--memori-surface-contrast-inverse, white) 85%)',
|
|
554
|
-
'--memori-skeleton-highlight':
|
|
555
|
-
'color-mix(in oklch, var(--memori-primary), var(--memori-surface-contrast-inverse, white) 75%)',
|
|
556
547
|
/* Soft fills for secondary IconButton active / recording (never solid CTA) */
|
|
557
548
|
'--memori-icon-active-bg':
|
|
558
549
|
'color-mix(in oklch, var(--memori-primary) 12%, transparent)',
|
|
559
550
|
'--memori-icon-recording-bg':
|
|
560
|
-
'color-mix(in oklch, var(--memori-error
|
|
551
|
+
'color-mix(in oklch, var(--memori-error) 12%, transparent)',
|
|
561
552
|
} as CSSProperties;
|
|
562
553
|
}
|
|
563
554
|
|
|
@@ -814,6 +805,7 @@ const MemoriWidget = ({
|
|
|
814
805
|
|
|
815
806
|
type PendingEnterText = EnterTextRetryParams & {
|
|
816
807
|
msg?: string;
|
|
808
|
+
stateBeforeRequest?: string;
|
|
817
809
|
waitForResponse?: {
|
|
818
810
|
resolve: (event: NatsDialogResponseEvent) => void;
|
|
819
811
|
reject: (error: Error) => void;
|
|
@@ -1204,6 +1196,7 @@ const MemoriWidget = ({
|
|
|
1204
1196
|
if (response.resultCode === 0 && correlationID) {
|
|
1205
1197
|
registerPendingEnterText(correlationID, {
|
|
1206
1198
|
msg,
|
|
1199
|
+
stateBeforeRequest: dialogStateFingerprint(currentDialogState),
|
|
1207
1200
|
text,
|
|
1208
1201
|
media,
|
|
1209
1202
|
translate,
|
|
@@ -1536,8 +1529,10 @@ const MemoriWidget = ({
|
|
|
1536
1529
|
// Check if authentication is needed for private Memori
|
|
1537
1530
|
if (
|
|
1538
1531
|
memori.privacyType !== 'PUBLIC' &&
|
|
1532
|
+
!params.password &&
|
|
1539
1533
|
!memori.secretToken &&
|
|
1540
1534
|
!memoriPwd &&
|
|
1535
|
+
!params.recoveryTokens?.length &&
|
|
1541
1536
|
!memoriTokens
|
|
1542
1537
|
) {
|
|
1543
1538
|
setAuthModalState('password');
|
|
@@ -1700,6 +1695,7 @@ const MemoriWidget = ({
|
|
|
1700
1695
|
// Show age verification if required and birth date not provided
|
|
1701
1696
|
if (!userBirthDate && !!minAge) {
|
|
1702
1697
|
setShowAgeVerification(true);
|
|
1698
|
+
setLoading(false);
|
|
1703
1699
|
return;
|
|
1704
1700
|
}
|
|
1705
1701
|
|
|
@@ -1709,10 +1705,11 @@ const MemoriWidget = ({
|
|
|
1709
1705
|
!password &&
|
|
1710
1706
|
!memori.secretToken &&
|
|
1711
1707
|
!memoriPwd &&
|
|
1712
|
-
!recoveryTokens &&
|
|
1708
|
+
!recoveryTokens?.length &&
|
|
1713
1709
|
!memoriTokens
|
|
1714
1710
|
) {
|
|
1715
1711
|
setAuthModalState('password');
|
|
1712
|
+
setLoading(false);
|
|
1716
1713
|
return;
|
|
1717
1714
|
}
|
|
1718
1715
|
|
|
@@ -2524,6 +2521,7 @@ const MemoriWidget = ({
|
|
|
2524
2521
|
}, timeoutMs);
|
|
2525
2522
|
|
|
2526
2523
|
registerPendingEnterText(correlationID, {
|
|
2524
|
+
stateBeforeRequest: dialogStateFingerprint(currentDialogState),
|
|
2527
2525
|
waitForResponse: {
|
|
2528
2526
|
resolve: event => {
|
|
2529
2527
|
clearTimeout(timeoutId);
|
|
@@ -2537,9 +2535,53 @@ const MemoriWidget = ({
|
|
|
2537
2535
|
},
|
|
2538
2536
|
});
|
|
2539
2537
|
}),
|
|
2540
|
-
[registerPendingEnterText, clearEnterTextPending]
|
|
2538
|
+
[registerPendingEnterText, clearEnterTextPending, currentDialogState]
|
|
2541
2539
|
);
|
|
2542
2540
|
|
|
2541
|
+
const catchUpPendingEnterText = useCallback(async () => {
|
|
2542
|
+
if (!sessionId || pendingEnterTextRef.current.size === 0) return;
|
|
2543
|
+
|
|
2544
|
+
// Async turns are registered in send order. The current session state can
|
|
2545
|
+
// only represent the latest completed turn, so reconcile the latest one.
|
|
2546
|
+
const latest = Array.from(pendingEnterTextRef.current.entries()).pop();
|
|
2547
|
+
if (!latest) return;
|
|
2548
|
+
const [correlationID, pending] = latest;
|
|
2549
|
+
|
|
2550
|
+
try {
|
|
2551
|
+
const { currentState, resultCode, resultMessage, requestID } =
|
|
2552
|
+
await getSession(sessionId);
|
|
2553
|
+
|
|
2554
|
+
if (resultCode !== 0 || !currentState) {
|
|
2555
|
+
deliverEnterTextNatsResponse(correlationID, {
|
|
2556
|
+
eventType: 'dialog_text_entered_response',
|
|
2557
|
+
correlationID,
|
|
2558
|
+
requestID,
|
|
2559
|
+
resultCode,
|
|
2560
|
+
resultMessage,
|
|
2561
|
+
currentState,
|
|
2562
|
+
});
|
|
2563
|
+
return;
|
|
2564
|
+
}
|
|
2565
|
+
|
|
2566
|
+
if (dialogStateFingerprint(currentState) === pending.stateBeforeRequest) {
|
|
2567
|
+
console.info('[NATS] catch-up: pending turn has not completed yet');
|
|
2568
|
+
return;
|
|
2569
|
+
}
|
|
2570
|
+
|
|
2571
|
+
console.info('[NATS] catch-up: applying current engine session state');
|
|
2572
|
+
deliverEnterTextNatsResponse(correlationID, {
|
|
2573
|
+
eventType: 'dialog_text_entered_response',
|
|
2574
|
+
correlationID,
|
|
2575
|
+
requestID,
|
|
2576
|
+
resultCode,
|
|
2577
|
+
resultMessage,
|
|
2578
|
+
currentState,
|
|
2579
|
+
});
|
|
2580
|
+
} catch (error) {
|
|
2581
|
+
logWidgetError('NATS catch-up failed', error);
|
|
2582
|
+
}
|
|
2583
|
+
}, [sessionId, deliverEnterTextNatsResponse]);
|
|
2584
|
+
|
|
2543
2585
|
// NATS subscription: receives progress updates and the async enter-text response.
|
|
2544
2586
|
useNats({
|
|
2545
2587
|
baseUrl,
|
|
@@ -2564,6 +2606,7 @@ const MemoriWidget = ({
|
|
|
2564
2606
|
[deliverEnterTextNatsResponse]
|
|
2565
2607
|
),
|
|
2566
2608
|
onError: deliverEnterTextNatsError,
|
|
2609
|
+
onCatchUp: catchUpPendingEnterText,
|
|
2567
2610
|
});
|
|
2568
2611
|
|
|
2569
2612
|
const focusChatInput = () => {
|
|
@@ -2613,20 +2656,26 @@ const MemoriWidget = ({
|
|
|
2613
2656
|
}, []);
|
|
2614
2657
|
|
|
2615
2658
|
useEffect(() => {
|
|
2616
|
-
// if memori is speaking, don't start listening
|
|
2659
|
+
// if memori is speaking or generating a reply, don't start listening
|
|
2617
2660
|
if (
|
|
2618
2661
|
!isPlayingAudio &&
|
|
2662
|
+
!memoriTyping &&
|
|
2619
2663
|
continuousSpeech &&
|
|
2620
2664
|
(hasUserActivatedListening || !requestedListening) &&
|
|
2621
2665
|
sessionId &&
|
|
2622
2666
|
!hasUserTypedMessage // Don't start recording if user has typed a message
|
|
2623
2667
|
) {
|
|
2624
2668
|
startRecording();
|
|
2625
|
-
} else if (isPlayingAudio && isListening) {
|
|
2669
|
+
} else if ((isPlayingAudio || memoriTyping) && isListening) {
|
|
2626
2670
|
stopRecording();
|
|
2627
2671
|
}
|
|
2628
2672
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2629
|
-
}, [
|
|
2673
|
+
}, [
|
|
2674
|
+
isPlayingAudio,
|
|
2675
|
+
hasUserActivatedListening,
|
|
2676
|
+
hasUserTypedMessage,
|
|
2677
|
+
memoriTyping,
|
|
2678
|
+
]);
|
|
2630
2679
|
|
|
2631
2680
|
useEffect(() => {
|
|
2632
2681
|
stopRecording();
|
|
@@ -2701,7 +2750,7 @@ const MemoriWidget = ({
|
|
|
2701
2750
|
}`
|
|
2702
2751
|
);
|
|
2703
2752
|
}
|
|
2704
|
-
const integrationStylesheet = `@layer
|
|
2753
|
+
const integrationStylesheet = `@layer memori.overrides {
|
|
2705
2754
|
${integrationStylesheetParts.join('\n ')}
|
|
2706
2755
|
}
|
|
2707
2756
|
`;
|
|
@@ -2874,9 +2923,15 @@ const MemoriWidget = ({
|
|
|
2874
2923
|
'position',
|
|
2875
2924
|
undefined
|
|
2876
2925
|
);
|
|
2877
|
-
//
|
|
2878
|
-
if (
|
|
2879
|
-
|
|
2926
|
+
// Wait on the start panel for location share/skip; do not open the header popover.
|
|
2927
|
+
if (
|
|
2928
|
+
autoStart &&
|
|
2929
|
+
shouldHoldAutoStartForPosition(
|
|
2930
|
+
!!memori.needsPosition,
|
|
2931
|
+
Boolean(position || localPosition)
|
|
2932
|
+
)
|
|
2933
|
+
) {
|
|
2934
|
+
setClickedStart(false);
|
|
2880
2935
|
return;
|
|
2881
2936
|
}
|
|
2882
2937
|
|
|
@@ -3282,13 +3337,17 @@ const MemoriWidget = ({
|
|
|
3282
3337
|
const setPositionPopoverOpen = useCallback(
|
|
3283
3338
|
(open: boolean) => {
|
|
3284
3339
|
const sessionAlreadyStarted = !!(sessionId && hasUserActivatedSpeak);
|
|
3340
|
+
const hasPosition = Boolean(
|
|
3341
|
+
position || getLocalConfig<Venue | undefined>('position', undefined)
|
|
3342
|
+
);
|
|
3285
3343
|
setPositionPopoverOpenState(wasOpen => {
|
|
3286
3344
|
if (
|
|
3287
3345
|
shouldRestartSessionOnPositionPopoverClose(
|
|
3288
3346
|
wasOpen,
|
|
3289
3347
|
open,
|
|
3290
3348
|
autoStart,
|
|
3291
|
-
sessionAlreadyStarted
|
|
3349
|
+
sessionAlreadyStarted,
|
|
3350
|
+
hasPosition
|
|
3292
3351
|
)
|
|
3293
3352
|
) {
|
|
3294
3353
|
// Defer: React setState updaters must stay pure.
|
|
@@ -3304,17 +3363,23 @@ const MemoriWidget = ({
|
|
|
3304
3363
|
return open;
|
|
3305
3364
|
});
|
|
3306
3365
|
},
|
|
3307
|
-
[autoStart, onClickStart, sessionId, hasUserActivatedSpeak]
|
|
3366
|
+
[autoStart, onClickStart, sessionId, hasUserActivatedSpeak, position]
|
|
3308
3367
|
);
|
|
3309
3368
|
|
|
3310
3369
|
useEffect(() => {
|
|
3370
|
+
const storedPosition = getLocalConfig<Venue | undefined>(
|
|
3371
|
+
'position',
|
|
3372
|
+
undefined
|
|
3373
|
+
);
|
|
3374
|
+
const hasPosition = Boolean(position || storedPosition);
|
|
3311
3375
|
if (
|
|
3312
3376
|
!clickedStart &&
|
|
3313
3377
|
!sessionStartingRef.current &&
|
|
3314
3378
|
!sessionId &&
|
|
3315
3379
|
autoStart &&
|
|
3316
3380
|
selectedLayout !== 'HIDDEN_CHAT' &&
|
|
3317
|
-
(!needsCredits || hasEnoughCredits)
|
|
3381
|
+
(!needsCredits || hasEnoughCredits) &&
|
|
3382
|
+
!shouldHoldAutoStartForPosition(!!memori.needsPosition, hasPosition)
|
|
3318
3383
|
) {
|
|
3319
3384
|
onClickStart();
|
|
3320
3385
|
}
|
|
@@ -3325,6 +3390,8 @@ const MemoriWidget = ({
|
|
|
3325
3390
|
sessionId,
|
|
3326
3391
|
needsCredits,
|
|
3327
3392
|
hasEnoughCredits,
|
|
3393
|
+
position,
|
|
3394
|
+
memori.needsPosition,
|
|
3328
3395
|
]);
|
|
3329
3396
|
|
|
3330
3397
|
useEffect(() => {
|
|
@@ -3488,7 +3555,7 @@ const MemoriWidget = ({
|
|
|
3488
3555
|
|
|
3489
3556
|
const showFullHistory =
|
|
3490
3557
|
showOnlyLastMessages === undefined
|
|
3491
|
-
? selectedLayout !== '
|
|
3558
|
+
? selectedLayout !== 'WEBSITE_ASSISTANT'
|
|
3492
3559
|
: !showOnlyLastMessages;
|
|
3493
3560
|
const canShowLoginButton =
|
|
3494
3561
|
!tenant?.ssoLogin &&
|
|
@@ -3964,6 +4031,8 @@ const MemoriWidget = ({
|
|
|
3964
4031
|
language={language}
|
|
3965
4032
|
userLang={userLang}
|
|
3966
4033
|
isMultilanguageEnabled={isMultilanguageEnabled}
|
|
4034
|
+
showFunctionCache={showFunctionCache}
|
|
4035
|
+
showMessageConsumption={enableMessageConsumption}
|
|
3967
4036
|
/>
|
|
3968
4037
|
)}
|
|
3969
4038
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { getChatStyles } from './MemoriWidget';
|
|
2
|
+
|
|
3
|
+
describe('getChatStyles', () => {
|
|
4
|
+
it('returns empty object when no brand primary is set', () => {
|
|
5
|
+
expect(getChatStyles(undefined)).toEqual({});
|
|
6
|
+
expect(getChatStyles({})).toEqual({});
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
it('sets only the brand hook and widget-domain icon tokens', () => {
|
|
10
|
+
const styles = getChatStyles({
|
|
11
|
+
buttonBgColor: '#8246af',
|
|
12
|
+
buttonTextColor: '#fff',
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
expect(styles).toMatchObject({
|
|
16
|
+
'--memori-primary-color': '#8246af',
|
|
17
|
+
'--memori-primary-content': '#fff',
|
|
18
|
+
});
|
|
19
|
+
expect(styles).not.toHaveProperty('--memori-primary-hover');
|
|
20
|
+
expect(styles).not.toHaveProperty('--memori-primary-active');
|
|
21
|
+
expect(styles).toHaveProperty('--memori-icon-active-bg');
|
|
22
|
+
expect(styles).toHaveProperty('--memori-icon-recording-bg');
|
|
23
|
+
});
|
|
24
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
.memori-mobile-session-panel--overlay {
|
|
2
|
-
position:
|
|
2
|
+
position: absolute;
|
|
3
3
|
z-index: 2100;
|
|
4
4
|
top: 0;
|
|
5
5
|
right: 0;
|
|
@@ -343,7 +343,7 @@
|
|
|
343
343
|
.memori-dropdown--user-email {
|
|
344
344
|
overflow: hidden;
|
|
345
345
|
margin: 0;
|
|
346
|
-
color: var(--memori-
|
|
346
|
+
color: var(--memori-neutral, #666);
|
|
347
347
|
font-size: 0.875rem;
|
|
348
348
|
line-height: 1.35;
|
|
349
349
|
text-overflow: ellipsis;
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
|
|
38
38
|
.memori-position-popover__switch-icon {
|
|
39
39
|
flex-shrink: 0;
|
|
40
|
-
color: var(--memori-
|
|
40
|
+
color: var(--memori-neutral, rgba(255, 255, 255, 0.75));
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
.memori-position-popover__switch-label {
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
.memori-position-popover__switch-label-subtitle {
|
|
58
|
-
color: var(--memori-
|
|
58
|
+
color: var(--memori-neutral, rgba(255, 255, 255, 0.65));
|
|
59
59
|
font-size: 0.75rem;
|
|
60
60
|
line-height: 1.2;
|
|
61
61
|
}
|
|
@@ -181,7 +181,7 @@
|
|
|
181
181
|
|
|
182
182
|
.memori-position-popover__error {
|
|
183
183
|
margin: 0 0 var(--memori-spacing-sm);
|
|
184
|
-
color: var(--memori-
|
|
184
|
+
color: var(--memori-error, #c53030);
|
|
185
185
|
font-size: 0.875rem;
|
|
186
186
|
line-height: var(--memori-text-line-normal);
|
|
187
187
|
}
|