@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,88 +1,115 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Meta,
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
3
|
import { Spin } from '@memori.ai/ui';
|
|
4
4
|
import { memori, tenant, integration } from '../../mocks/data';
|
|
5
5
|
import Memori, { Props } from '../../index';
|
|
6
6
|
import { LayoutProps } from '../MemoriWidget/MemoriWidget';
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
import { withWidgetProviders } from '../../../.storybook/decorators';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Canonical layout matrix — one story per LayoutName (plus Custom + HiddenChat note).
|
|
11
|
+
* Live staging/localhost agents live under `Live/` (see Live/Agents.stories.tsx).
|
|
12
|
+
*/
|
|
13
|
+
const meta = {
|
|
14
|
+
title: 'Layouts',
|
|
15
|
+
component: Memori,
|
|
16
|
+
decorators: [withWidgetProviders],
|
|
15
17
|
parameters: {
|
|
16
18
|
controls: { expanded: true },
|
|
17
19
|
layout: 'fullscreen',
|
|
18
20
|
},
|
|
19
|
-
}
|
|
21
|
+
} satisfies Meta<typeof Memori>;
|
|
20
22
|
|
|
21
23
|
export default meta;
|
|
24
|
+
type Story = StoryObj<typeof meta>;
|
|
22
25
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
DefaultLayout.args = {
|
|
35
|
-
memoriName: 'Layout Storybook',
|
|
36
|
-
ownerUserName: 'Andrea-Patini',
|
|
37
|
-
memoriID: 'ae20fc5a-cc15-4db9-b7dd-2cd4a621b85e',
|
|
38
|
-
ownerUserID: '91dbc9ba-b684-4fbe-9828-b5980af6cda9',
|
|
39
|
-
tenantID: 'aisuru-staging.aclambda.online',
|
|
40
|
-
engineURL: 'https://engine-staging.memori.ai/memori/v2',
|
|
41
|
-
apiURL: 'https://backend-staging.memori.ai/api/v2',
|
|
42
|
-
// baseURL: 'http://localhost:3000',
|
|
43
|
-
layout: 'ZOOMED_FULL_BODY',
|
|
26
|
+
/** Fixture-first base — deterministic sidebar entry for each layout. */
|
|
27
|
+
const fixtureBase: Partial<Props> = {
|
|
28
|
+
memori,
|
|
29
|
+
tenant,
|
|
30
|
+
memoriName: memori.name,
|
|
31
|
+
memoriID: memori.memoriID,
|
|
32
|
+
ownerUserName: 'memoridev',
|
|
33
|
+
tenantID: 'www.aisuru.com',
|
|
34
|
+
engineURL: 'https://engine.memori.ai',
|
|
35
|
+
apiURL: 'https://backend.memori.ai',
|
|
36
|
+
baseURL: 'https://www.aisuru.com',
|
|
44
37
|
uiLang: 'IT',
|
|
45
38
|
spokenLang: 'IT',
|
|
46
|
-
integrationID: '32922e14-24d6-4f5f-a06b-d963da14a658',
|
|
47
39
|
showSettings: true,
|
|
40
|
+
showShare: true,
|
|
48
41
|
};
|
|
49
42
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
43
|
+
/** Default layout = FULLPAGE (not Zoomed). */
|
|
44
|
+
export const FullPage: Story = {
|
|
45
|
+
args: {
|
|
46
|
+
...fixtureBase,
|
|
47
|
+
layout: 'FULLPAGE',
|
|
48
|
+
},
|
|
53
49
|
};
|
|
54
50
|
|
|
55
|
-
export const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
showSettings: true,
|
|
61
|
-
// memori: memori,
|
|
62
|
-
integration: {
|
|
63
|
-
...integration,
|
|
51
|
+
export const Chat: Story = {
|
|
52
|
+
args: {
|
|
53
|
+
...fixtureBase,
|
|
54
|
+
layout: 'CHAT',
|
|
55
|
+
showUpload: true,
|
|
64
56
|
},
|
|
65
|
-
tenant,
|
|
66
|
-
layout: 'TOTEM',
|
|
67
57
|
};
|
|
68
58
|
|
|
69
|
-
export const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
59
|
+
export const Totem: Story = {
|
|
60
|
+
args: {
|
|
61
|
+
...fixtureBase,
|
|
62
|
+
layout: 'TOTEM',
|
|
63
|
+
integration: { ...integration },
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export const ZoomedFullBody: Story = {
|
|
68
|
+
args: {
|
|
69
|
+
...fixtureBase,
|
|
70
|
+
layout: 'ZOOMED_FULL_BODY',
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const WebsiteAssistant: Story = {
|
|
75
|
+
args: {
|
|
76
|
+
...fixtureBase,
|
|
77
|
+
layout: 'WEBSITE_ASSISTANT',
|
|
78
|
+
multilingual: true,
|
|
79
|
+
integration: {
|
|
80
|
+
...integration,
|
|
81
|
+
customData: JSON.stringify({
|
|
82
|
+
textColor: '#2a2a2a',
|
|
83
|
+
buttonBgColor: '#653165',
|
|
84
|
+
buttonTextColor: '#ffffff',
|
|
85
|
+
blurBackground: true,
|
|
86
|
+
innerBgColor: 'light',
|
|
87
|
+
innerBgAlpha: 0.8,
|
|
88
|
+
multilanguage: true,
|
|
89
|
+
avatar: 'readyplayerme',
|
|
90
|
+
avatarURL:
|
|
91
|
+
'https://assets.memori.ai/api/v2/asset/b791f77c-1a94-4272-829e-eca82fcc62b7.glb',
|
|
92
|
+
}),
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export const WebsiteAssistantWithout3DAvatar: Story = {
|
|
98
|
+
args: {
|
|
99
|
+
...WebsiteAssistant.args,
|
|
100
|
+
avatar3dHidden: true,
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
/** Collapsed / FAB entry point for HIDDEN_CHAT. */
|
|
105
|
+
export const HiddenChat: Story = {
|
|
106
|
+
args: {
|
|
107
|
+
...fixtureBase,
|
|
108
|
+
layout: 'HIDDEN_CHAT',
|
|
109
|
+
},
|
|
79
110
|
};
|
|
80
111
|
|
|
81
112
|
const CustomLayout: React.FC<LayoutProps> = ({
|
|
82
|
-
Header,
|
|
83
|
-
headerProps,
|
|
84
|
-
Avatar,
|
|
85
|
-
avatarProps,
|
|
86
113
|
Chat,
|
|
87
114
|
chatProps,
|
|
88
115
|
StartPanel,
|
|
@@ -97,10 +124,11 @@ const CustomLayout: React.FC<LayoutProps> = ({
|
|
|
97
124
|
<>
|
|
98
125
|
{integrationStyle}
|
|
99
126
|
{integrationBackground}
|
|
100
|
-
|
|
101
|
-
|
|
127
|
+
<Spin
|
|
128
|
+
spinning={loading}
|
|
129
|
+
className="memori-mycustom-layout"
|
|
130
|
+
>
|
|
102
131
|
{poweredBy}
|
|
103
|
-
|
|
104
132
|
<div className="memori-mycustom-layout--controls">
|
|
105
133
|
{sessionId && hasUserActivatedSpeak && Chat && chatProps ? (
|
|
106
134
|
<Chat {...chatProps} />
|
|
@@ -112,121 +140,10 @@ const CustomLayout: React.FC<LayoutProps> = ({
|
|
|
112
140
|
</>
|
|
113
141
|
);
|
|
114
142
|
|
|
115
|
-
export const Custom =
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
showSettings: true,
|
|
121
|
-
memori: memori,
|
|
122
|
-
tenant,
|
|
123
|
-
layout: 'FULLPAGE',
|
|
124
|
-
customLayout: CustomLayout,
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
export const WebsiteAssistant2 = Template.bind({});
|
|
128
|
-
WebsiteAssistant2.args = {
|
|
129
|
-
memoriName: 'Marconi Express',
|
|
130
|
-
ownerUserName: 'exmita',
|
|
131
|
-
memoriID: '1755979f-28f1-45d1-8f41-bb34e1f7756b',
|
|
132
|
-
ownerUserID: '3194fcd3-040b-4d5e-a925-691911fb1177',
|
|
133
|
-
tenantID: 'exmachina.aclambda.online',
|
|
134
|
-
engineURL: 'https://engine.memori.ai',
|
|
135
|
-
apiURL: 'https://backend.memori.ai',
|
|
136
|
-
baseURL: 'https://exmachina.aclambda.online',
|
|
137
|
-
uiLang: 'IT',
|
|
138
|
-
avatar3dHidden: true,
|
|
139
|
-
spokenLang: 'IT',
|
|
140
|
-
layout: 'WEBSITE_ASSISTANT',
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
export const WebsiteAssistant3 = Template.bind({});
|
|
144
|
-
WebsiteAssistant3.args = {
|
|
145
|
-
memoriName: 'Layout Storybook',
|
|
146
|
-
ownerUserName: 'Andrea-Patini',
|
|
147
|
-
memoriID: 'ae20fc5a-cc15-4db9-b7dd-2cd4a621b85e',
|
|
148
|
-
ownerUserID: '91dbc9ba-b684-4fbe-9828-b5980af6cda9',
|
|
149
|
-
tenantID: 'aisuru-staging.aclambda.online',
|
|
150
|
-
engineURL: 'https://engine-staging.memori.ai/memori/v2',
|
|
151
|
-
apiURL: 'https://backend-staging.memori.ai/api/v2',
|
|
152
|
-
baseURL: 'http://localhost:3000',
|
|
153
|
-
layout: 'WEBSITE_ASSISTANT',
|
|
154
|
-
avatar3dHidden: true,
|
|
155
|
-
uiLang: 'IT',
|
|
156
|
-
spokenLang: 'IT',
|
|
157
|
-
showOnlyLastMessages: true,
|
|
158
|
-
integrationID: '716f4728-919c-4015-aae1-88998a081c6f',
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
export const WebsiteAssistant = Template.bind({});
|
|
162
|
-
WebsiteAssistant.args = {
|
|
163
|
-
uiLang: 'EN',
|
|
164
|
-
showShare: false,
|
|
165
|
-
showSettings: true,
|
|
166
|
-
memori: memori,
|
|
167
|
-
tenant,
|
|
168
|
-
layout: 'WEBSITE_ASSISTANT',
|
|
169
|
-
memoriName: 'Memori',
|
|
170
|
-
memoriID: '25ced51c-3520-41af-8bbe-222d861b8e32',
|
|
171
|
-
ownerUserName: 'memoridev',
|
|
172
|
-
tenantID: 'www.aisuru.com',
|
|
173
|
-
apiURL: 'https://backend.memori.ai',
|
|
174
|
-
baseURL: 'https://www.aisuru.com',
|
|
175
|
-
spokenLang: 'EN',
|
|
176
|
-
context: {
|
|
177
|
-
SOURCE: 'WEBSITE',
|
|
178
|
-
PATH: '/en/',
|
|
179
|
-
},
|
|
180
|
-
multilingual: true,
|
|
181
|
-
integrationID: 'cb3c4776-7f0b-4f97-a773-c32a5d7a3bf1',
|
|
182
|
-
integration: {
|
|
183
|
-
...integration,
|
|
184
|
-
customData: JSON.stringify({
|
|
185
|
-
textColor: '#2a2a2a',
|
|
186
|
-
buttonBgColor: '#653165',
|
|
187
|
-
buttonTextColor: '#ffffff',
|
|
188
|
-
blurBackground: true,
|
|
189
|
-
innerBgColor: 'light',
|
|
190
|
-
innerBgAlpha: 0.8,
|
|
191
|
-
multilanguage: true,
|
|
192
|
-
avatar: 'readyplayerme',
|
|
193
|
-
avatarURL:
|
|
194
|
-
'https://assets.memori.ai/api/v2/asset/b791f77c-1a94-4272-829e-eca82fcc62b7.glb',
|
|
195
|
-
}),
|
|
143
|
+
export const Custom: Story = {
|
|
144
|
+
args: {
|
|
145
|
+
...fixtureBase,
|
|
146
|
+
layout: 'FULLPAGE',
|
|
147
|
+
customLayout: CustomLayout,
|
|
196
148
|
},
|
|
197
149
|
};
|
|
198
|
-
|
|
199
|
-
export const WebsiteAssistantWithout3DAvatar = Template.bind({});
|
|
200
|
-
WebsiteAssistantWithout3DAvatar.args = {
|
|
201
|
-
...WebsiteAssistant.args,
|
|
202
|
-
avatar3dHidden: true,
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
export const HiddenChat = Template.bind({});
|
|
206
|
-
HiddenChat.args = {
|
|
207
|
-
...DefaultLayout.args,
|
|
208
|
-
uiLang: 'it',
|
|
209
|
-
showShare: true,
|
|
210
|
-
showSettings: true,
|
|
211
|
-
memori: memori,
|
|
212
|
-
tenant,
|
|
213
|
-
layout: 'HIDDEN_CHAT',
|
|
214
|
-
};
|
|
215
|
-
|
|
216
|
-
export const ZoomedFullBody = Template.bind({});
|
|
217
|
-
ZoomedFullBody.args = {
|
|
218
|
-
...DefaultLayout.args,
|
|
219
|
-
memoriName: 'Layout Storybook',
|
|
220
|
-
ownerUserName: 'Andrea-Patini',
|
|
221
|
-
memoriID: 'ae20fc5a-cc15-4db9-b7dd-2cd4a621b85e',
|
|
222
|
-
ownerUserID: '91dbc9ba-b684-4fbe-9828-b5980af6cda9',
|
|
223
|
-
tenantID: 'aisuru-staging.aclambda.online',
|
|
224
|
-
engineURL: 'https://engine-staging.memori.ai/memori/v2',
|
|
225
|
-
apiURL: 'https://backend-staging.memori.ai/api/v2',
|
|
226
|
-
// baseURL: 'http://localhost:3000',
|
|
227
|
-
layout: 'ZOOMED_FULL_BODY',
|
|
228
|
-
uiLang: 'IT',
|
|
229
|
-
spokenLang: 'IT',
|
|
230
|
-
integrationID: '32922e14-24d6-4f5f-a06b-d963da14a658',
|
|
231
|
-
showSettings: true,
|
|
232
|
-
};
|
|
@@ -180,6 +180,11 @@
|
|
|
180
180
|
internal scroll instead of pushing the scene up. */
|
|
181
181
|
.memori-totem-layout--controls {
|
|
182
182
|
z-index: 100;
|
|
183
|
+
display: flex;
|
|
184
|
+
width: 100%;
|
|
185
|
+
min-height: 0;
|
|
186
|
+
max-height: 48vh;
|
|
187
|
+
flex-direction: column;
|
|
183
188
|
flex-shrink: 0;
|
|
184
189
|
}
|
|
185
190
|
|
|
@@ -187,6 +192,8 @@
|
|
|
187
192
|
SECTION 2–3 — Single unified panel + shared alignment axis
|
|
188
193
|
One container (surface + 1px border + 12px radius). Inner sections have
|
|
189
194
|
NO border/shadow/width of their own, only 1px dividers between them.
|
|
195
|
+
A definite height (not just max-height) is required so nested overflow-y
|
|
196
|
+
auto actually scrolls instead of clipping.
|
|
190
197
|
========================================================================== */
|
|
191
198
|
.memori-totem-layout--controls .memori-chat--wrapper,
|
|
192
199
|
.memori-totem-layout--controls .memori--start-panel {
|
|
@@ -194,8 +201,11 @@
|
|
|
194
201
|
overflow: hidden;
|
|
195
202
|
width: 100%;
|
|
196
203
|
max-width: var(--memori-totem-max-width, 600px);
|
|
204
|
+
height: 48vh;
|
|
205
|
+
min-height: 0;
|
|
197
206
|
max-height: 48vh;
|
|
198
207
|
box-sizing: border-box;
|
|
208
|
+
flex: 1 1 auto;
|
|
199
209
|
flex-direction: column;
|
|
200
210
|
padding: 0;
|
|
201
211
|
border: 1px solid var(--memori-border-color);
|
|
@@ -206,34 +216,53 @@
|
|
|
206
216
|
|
|
207
217
|
/* Nested conversation column must not add its own axis/padding/surface. */
|
|
208
218
|
.memori-totem-layout--controls .memori-conversation-column {
|
|
219
|
+
display: flex;
|
|
220
|
+
overflow: hidden;
|
|
209
221
|
width: 100%;
|
|
210
222
|
max-width: none;
|
|
211
223
|
height: auto;
|
|
212
224
|
min-height: 0;
|
|
225
|
+
flex: 1 1 0%;
|
|
226
|
+
flex-direction: column;
|
|
213
227
|
padding: 0;
|
|
214
228
|
margin: 0;
|
|
215
229
|
}
|
|
216
230
|
|
|
217
|
-
/* Messages section:
|
|
218
|
-
.memori-totem-layout--controls .memori-chat--history
|
|
219
|
-
|
|
231
|
+
/* Messages section: remaining panel height; children must not size to content. */
|
|
232
|
+
.memori-totem-layout--controls .memori-chat--history,
|
|
233
|
+
.memori-totem-layout--controls .memori-chat--history.memori-chat--history-touch {
|
|
234
|
+
display: flex;
|
|
235
|
+
overflow: hidden;
|
|
236
|
+
height: auto !important;
|
|
220
237
|
min-height: 0;
|
|
221
|
-
flex: 1 1
|
|
238
|
+
flex: 1 1 0%;
|
|
239
|
+
flex-direction: column;
|
|
222
240
|
border: none;
|
|
223
241
|
border-radius: 0;
|
|
224
242
|
margin: 0;
|
|
225
243
|
background: transparent;
|
|
226
244
|
}
|
|
227
245
|
|
|
228
|
-
.memori-totem-layout--controls .memori-chat--content
|
|
229
|
-
|
|
246
|
+
.memori-totem-layout--controls .memori-chat--content,
|
|
247
|
+
.memori-totem-layout--controls .memori-chat--content.memori-chat--content-touch {
|
|
248
|
+
height: 0;
|
|
249
|
+
min-height: 0;
|
|
230
250
|
max-height: none;
|
|
251
|
+
flex: 1 1 auto;
|
|
231
252
|
padding: var(--memori-spacing-md);
|
|
232
253
|
background: transparent;
|
|
254
|
+
overflow-x: hidden;
|
|
255
|
+
overflow-y: auto;
|
|
256
|
+
overscroll-behavior: contain;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.memori-totem-layout--controls .memori-chat--content > * {
|
|
260
|
+
flex-shrink: 0;
|
|
233
261
|
}
|
|
234
262
|
|
|
235
263
|
/* Input section: 1px divider above, no own surface. */
|
|
236
264
|
.memori-totem-layout--controls .memori-chat-inputs-wrapper {
|
|
265
|
+
flex-shrink: 0;
|
|
237
266
|
padding: var(--memori-spacing-md);
|
|
238
267
|
border-top: 1px solid var(--memori-border-color);
|
|
239
268
|
background: transparent;
|
|
@@ -244,10 +273,15 @@
|
|
|
244
273
|
border-radius: 8px;
|
|
245
274
|
}
|
|
246
275
|
|
|
276
|
+
.memori-totem-layout--controls .memori-chat--bubble,
|
|
277
|
+
.memori-totem-layout--controls .memori-chat--bubble.memori-chat--user-bubble {
|
|
278
|
+
font-size: 1.125rem;
|
|
279
|
+
}
|
|
280
|
+
|
|
247
281
|
/* Start-panel body scrolls internally instead of stretching the panel. */
|
|
248
282
|
.memori-totem-layout--controls .memori--start-panel__body {
|
|
249
283
|
min-height: 0;
|
|
250
|
-
flex: 1 1
|
|
284
|
+
flex: 1 1 0%;
|
|
251
285
|
overflow-y: auto;
|
|
252
286
|
}
|
|
253
287
|
|
|
@@ -259,11 +293,11 @@
|
|
|
259
293
|
}
|
|
260
294
|
|
|
261
295
|
@media (max-width: 480px) {
|
|
262
|
-
.memori-totem-
|
|
296
|
+
.memori-totem-layout .memori-send-on-enter-menu {
|
|
263
297
|
display: none;
|
|
264
298
|
}
|
|
265
299
|
|
|
266
|
-
.memori-totem-
|
|
300
|
+
.memori-totem-layout .memori-header--button-settings {
|
|
267
301
|
display: none;
|
|
268
302
|
}
|
|
269
303
|
}
|
|
@@ -7,7 +7,10 @@
|
|
|
7
7
|
export interface NatsConfig {
|
|
8
8
|
/** WebSocket URL of the NATS server (e.g. wss://nats.hz.slnode.net:8080). */
|
|
9
9
|
url: string;
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Per-session NATS user JWT. Presented with `jwtAuthenticator` (bearer:
|
|
12
|
+
* no nkey seed on the client).
|
|
13
|
+
*/
|
|
11
14
|
token: string;
|
|
12
15
|
/**
|
|
13
16
|
* JetStream stream that stores session events. When set, the client consumes
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { act, renderHook, waitFor } from '@testing-library/react';
|
|
2
|
+
import { getNatsConfig } from './getNatsConfig';
|
|
3
|
+
import { useNats } from './useNats';
|
|
4
|
+
import { NatsSessionLifecycle, useNatsSession } from './useNatsSession';
|
|
5
|
+
|
|
6
|
+
jest.mock('./getNatsConfig', () => ({
|
|
7
|
+
getNatsConfig: jest.fn(),
|
|
8
|
+
}));
|
|
9
|
+
|
|
10
|
+
jest.mock('./useNatsSession', () => ({
|
|
11
|
+
useNatsSession: jest.fn(),
|
|
12
|
+
}));
|
|
13
|
+
|
|
14
|
+
const mockGetNatsConfig = getNatsConfig as jest.MockedFunction<
|
|
15
|
+
typeof getNatsConfig
|
|
16
|
+
>;
|
|
17
|
+
const mockUseNatsSession = useNatsSession as jest.MockedFunction<
|
|
18
|
+
typeof useNatsSession
|
|
19
|
+
>;
|
|
20
|
+
|
|
21
|
+
function latestLifecycle(): NatsSessionLifecycle {
|
|
22
|
+
return mockUseNatsSession.mock.calls.at(-1)?.[3] ?? {};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
describe('useNats credential lifecycle', () => {
|
|
26
|
+
beforeEach(() => {
|
|
27
|
+
jest.clearAllMocks();
|
|
28
|
+
mockGetNatsConfig.mockResolvedValue({
|
|
29
|
+
url: 'wss://nats.example.test',
|
|
30
|
+
token: 'fresh-jwt',
|
|
31
|
+
});
|
|
32
|
+
Object.defineProperty(document, 'visibilityState', {
|
|
33
|
+
configurable: true,
|
|
34
|
+
value: 'visible',
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it('refreshes the JWT on resume and catches up after reconnecting', async () => {
|
|
39
|
+
const onCatchUp = jest.fn();
|
|
40
|
+
renderHook(() =>
|
|
41
|
+
useNats({
|
|
42
|
+
baseUrl: 'https://dashboard.example.test',
|
|
43
|
+
sessionId: 'session-a',
|
|
44
|
+
onCatchUp,
|
|
45
|
+
})
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
await waitFor(() => expect(mockGetNatsConfig).toHaveBeenCalledTimes(1));
|
|
49
|
+
|
|
50
|
+
act(() => {
|
|
51
|
+
(document.dispatchEvent as (event: Event) => boolean)(
|
|
52
|
+
new Event('visibilitychange')
|
|
53
|
+
);
|
|
54
|
+
});
|
|
55
|
+
await waitFor(() => expect(mockGetNatsConfig).toHaveBeenCalledTimes(2));
|
|
56
|
+
|
|
57
|
+
act(() => latestLifecycle().onConnected?.());
|
|
58
|
+
expect(onCatchUp).toHaveBeenCalledTimes(1);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it('refreshes the JWT after an authorization error', async () => {
|
|
62
|
+
const onCatchUp = jest.fn();
|
|
63
|
+
renderHook(() =>
|
|
64
|
+
useNats({
|
|
65
|
+
baseUrl: 'https://dashboard.example.test',
|
|
66
|
+
sessionId: 'session-a',
|
|
67
|
+
onCatchUp,
|
|
68
|
+
})
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
await waitFor(() => expect(mockGetNatsConfig).toHaveBeenCalledTimes(1));
|
|
72
|
+
|
|
73
|
+
act(() => {
|
|
74
|
+
latestLifecycle().onAuthError?.(new Error('Authorization Violation'));
|
|
75
|
+
});
|
|
76
|
+
await waitFor(() => expect(mockGetNatsConfig).toHaveBeenCalledTimes(2));
|
|
77
|
+
|
|
78
|
+
act(() => latestLifecycle().onConnected?.());
|
|
79
|
+
expect(onCatchUp).toHaveBeenCalledTimes(1);
|
|
80
|
+
});
|
|
81
|
+
});
|