@memori.ai/memori-react 9.0.0-alpha.4 → 9.0.0-alpha.6
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 +62 -0
- package/dist/components/AgeVerificationModal/AgeVerificationModal.js +5 -2
- package/dist/components/AgeVerificationModal/AgeVerificationModal.js.map +1 -1
- package/dist/components/Avatar/Avatar.js +5 -10
- package/dist/components/Avatar/Avatar.js.map +1 -1
- package/dist/components/Avatar/AvatarView/AvatarComponent/components/FullbodyAvatar/fullbodyAvatar.js +8 -1
- package/dist/components/Avatar/AvatarView/AvatarComponent/components/FullbodyAvatar/fullbodyAvatar.js.map +1 -1
- package/dist/components/Avatar/AvatarView/AvatarComponent/components/controllers/MorphTargetController.js +1 -1
- package/dist/components/Avatar/AvatarView/AvatarComponent/components/controllers/MorphTargetController.js.map +1 -1
- package/dist/components/Avatar/AvatarView/AvatarComponent/constants.d.ts +2 -0
- package/dist/components/Avatar/AvatarView/AvatarComponent/constants.js +14 -5
- package/dist/components/Avatar/AvatarView/AvatarComponent/constants.js.map +1 -1
- package/dist/components/ChatBubble/ChatBubble.js +22 -16
- package/dist/components/ChatBubble/ChatBubble.js.map +1 -1
- package/dist/components/CompletionProviderStatus/CompletionProviderStatus.js +6 -3
- package/dist/components/CompletionProviderStatus/CompletionProviderStatus.js.map +1 -1
- package/dist/components/DateSelector/DateSelector.d.ts +2 -1
- package/dist/components/DateSelector/DateSelector.js +17 -7
- package/dist/components/DateSelector/DateSelector.js.map +1 -1
- package/dist/components/FilePreview/FilePreview.js +22 -5
- package/dist/components/FilePreview/FilePreview.js.map +1 -1
- package/dist/components/Header/ChatConsumptionDropdown.js +1 -1
- package/dist/components/Header/ChatConsumptionDropdown.js.map +1 -1
- package/dist/components/Header/Header.css +2 -1
- package/dist/components/Header/Header.js +1 -1
- package/dist/components/Header/Header.js.map +1 -1
- package/dist/components/MediaWidget/MediaItemWidget.js +14 -12
- package/dist/components/MediaWidget/MediaItemWidget.js.map +1 -1
- package/dist/components/MediaWidget/MediaItemWidget.utils.d.ts +3 -2
- package/dist/components/MediaWidget/MediaItemWidget.utils.js +28 -6
- package/dist/components/MediaWidget/MediaItemWidget.utils.js.map +1 -1
- package/dist/components/MediaWidget/MediaPreviewModal.js +6 -7
- package/dist/components/MediaWidget/MediaPreviewModal.js.map +1 -1
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/styles.css +5 -4
- package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.css +90 -38
- package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.d.ts +1 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js +14 -9
- package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js.map +1 -1
- package/dist/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.js +2 -2
- package/dist/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.js.map +1 -1
- package/dist/components/MemoriWidget/MemoriWidget.js +632 -280
- package/dist/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/dist/components/StartPanel/StartPanel.js +10 -5
- package/dist/components/StartPanel/StartPanel.js.map +1 -1
- package/dist/components/UploadButton/UploadButton.js +21 -5
- package/dist/components/UploadButton/UploadButton.js.map +1 -1
- package/dist/components/UploadButton/UploadDocuments/UploadDocuments.js +123 -59
- package/dist/components/UploadButton/UploadDocuments/UploadDocuments.js.map +1 -1
- package/dist/components/layouts/Chat.js +25 -30
- package/dist/components/layouts/Chat.js.map +1 -1
- package/dist/components/layouts/FullPage.js +5 -8
- package/dist/components/layouts/FullPage.js.map +1 -1
- package/dist/components/layouts/HiddenChat.js +2 -1
- package/dist/components/layouts/HiddenChat.js.map +1 -1
- package/dist/components/layouts/WebsiteAssistant/WebsiteAssistant.js +5 -1
- package/dist/components/layouts/WebsiteAssistant/WebsiteAssistant.js.map +1 -1
- package/dist/components/layouts/WebsiteAssistant/website-assistant.css +3 -4
- package/dist/components/layouts/ZoomedFullBody.js +4 -7
- package/dist/components/layouts/ZoomedFullBody.js.map +1 -1
- package/dist/components/layouts/chat.css +19 -31
- package/dist/components/layouts/fullpage.css +52 -19
- package/dist/components/layouts/zoomed-full-body.css +40 -1
- package/dist/helpers/constants.d.ts +3 -0
- package/dist/helpers/constants.js +27 -1
- package/dist/helpers/constants.js.map +1 -1
- package/dist/helpers/credits.d.ts +5 -2
- package/dist/helpers/credits.js +5 -1
- package/dist/helpers/credits.js.map +1 -1
- package/dist/helpers/message.d.ts +1 -1
- package/dist/helpers/message.js +4 -4
- package/dist/helpers/message.js.map +1 -1
- package/dist/helpers/nats/getNatsConfig.d.ts +9 -0
- package/dist/helpers/nats/getNatsConfig.js +65 -0
- package/dist/helpers/nats/getNatsConfig.js.map +1 -0
- package/dist/helpers/nats/isSessionExpiredError.d.ts +3 -0
- package/dist/helpers/nats/isSessionExpiredError.js +36 -0
- package/dist/helpers/nats/isSessionExpiredError.js.map +1 -0
- package/dist/helpers/nats/useNats.d.ts +12 -0
- package/dist/helpers/nats/useNats.js +75 -0
- package/dist/helpers/nats/useNats.js.map +1 -0
- package/dist/helpers/nats/useNatsSession.d.ts +28 -0
- package/dist/helpers/nats/useNatsSession.js +212 -0
- package/dist/helpers/nats/useNatsSession.js.map +1 -0
- package/dist/helpers/usePressTooltip.d.ts +13 -0
- package/dist/helpers/usePressTooltip.js +23 -0
- package/dist/helpers/usePressTooltip.js.map +1 -0
- package/dist/helpers/utils.d.ts +21 -0
- package/dist/helpers/utils.js +75 -4
- package/dist/helpers/utils.js.map +1 -1
- package/dist/locales/de.json +1 -0
- package/dist/locales/en.json +1 -0
- package/dist/locales/es.json +1 -0
- package/dist/locales/fr.json +1 -0
- package/dist/locales/it.json +1 -0
- package/dist/styles.css +1 -1
- package/dist/types/integration.d.ts +3 -0
- package/dist/types/integration.js +16 -0
- package/dist/types/integration.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/esm/components/AgeVerificationModal/AgeVerificationModal.js +5 -2
- package/esm/components/AgeVerificationModal/AgeVerificationModal.js.map +1 -1
- package/esm/components/Avatar/Avatar.js +5 -10
- package/esm/components/Avatar/Avatar.js.map +1 -1
- package/esm/components/Avatar/AvatarView/AvatarComponent/components/FullbodyAvatar/fullbodyAvatar.js +9 -2
- package/esm/components/Avatar/AvatarView/AvatarComponent/components/FullbodyAvatar/fullbodyAvatar.js.map +1 -1
- package/esm/components/Avatar/AvatarView/AvatarComponent/components/controllers/MorphTargetController.js +2 -2
- package/esm/components/Avatar/AvatarView/AvatarComponent/components/controllers/MorphTargetController.js.map +1 -1
- package/esm/components/Avatar/AvatarView/AvatarComponent/constants.d.ts +2 -0
- package/esm/components/Avatar/AvatarView/AvatarComponent/constants.js +13 -4
- package/esm/components/Avatar/AvatarView/AvatarComponent/constants.js.map +1 -1
- package/esm/components/ChatBubble/ChatBubble.js +22 -16
- package/esm/components/ChatBubble/ChatBubble.js.map +1 -1
- package/esm/components/CompletionProviderStatus/CompletionProviderStatus.js +6 -3
- package/esm/components/CompletionProviderStatus/CompletionProviderStatus.js.map +1 -1
- package/esm/components/DateSelector/DateSelector.d.ts +2 -1
- package/esm/components/DateSelector/DateSelector.js +17 -7
- package/esm/components/DateSelector/DateSelector.js.map +1 -1
- package/esm/components/FilePreview/FilePreview.js +24 -7
- package/esm/components/FilePreview/FilePreview.js.map +1 -1
- package/esm/components/Header/ChatConsumptionDropdown.js +1 -1
- package/esm/components/Header/ChatConsumptionDropdown.js.map +1 -1
- package/esm/components/Header/Header.css +2 -1
- package/esm/components/Header/Header.js +1 -1
- package/esm/components/Header/Header.js.map +1 -1
- package/esm/components/MediaWidget/MediaItemWidget.js +16 -14
- package/esm/components/MediaWidget/MediaItemWidget.js.map +1 -1
- package/esm/components/MediaWidget/MediaItemWidget.utils.d.ts +3 -2
- package/esm/components/MediaWidget/MediaItemWidget.utils.js +27 -6
- package/esm/components/MediaWidget/MediaItemWidget.utils.js.map +1 -1
- package/esm/components/MediaWidget/MediaPreviewModal.js +6 -7
- package/esm/components/MediaWidget/MediaPreviewModal.js.map +1 -1
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/styles.css +5 -4
- package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.css +90 -38
- package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.d.ts +1 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js +14 -9
- package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js.map +1 -1
- package/esm/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.js +2 -2
- package/esm/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.js.map +1 -1
- package/esm/components/MemoriWidget/MemoriWidget.js +632 -280
- package/esm/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/esm/components/StartPanel/StartPanel.js +10 -5
- package/esm/components/StartPanel/StartPanel.js.map +1 -1
- package/esm/components/UploadButton/UploadButton.js +21 -5
- package/esm/components/UploadButton/UploadButton.js.map +1 -1
- package/esm/components/UploadButton/UploadDocuments/UploadDocuments.js +123 -59
- package/esm/components/UploadButton/UploadDocuments/UploadDocuments.js.map +1 -1
- package/esm/components/layouts/Chat.js +25 -30
- package/esm/components/layouts/Chat.js.map +1 -1
- package/esm/components/layouts/FullPage.js +5 -8
- package/esm/components/layouts/FullPage.js.map +1 -1
- package/esm/components/layouts/HiddenChat.js +2 -1
- package/esm/components/layouts/HiddenChat.js.map +1 -1
- package/esm/components/layouts/WebsiteAssistant/WebsiteAssistant.js +5 -1
- package/esm/components/layouts/WebsiteAssistant/WebsiteAssistant.js.map +1 -1
- package/esm/components/layouts/WebsiteAssistant/website-assistant.css +3 -4
- package/esm/components/layouts/ZoomedFullBody.js +4 -7
- package/esm/components/layouts/ZoomedFullBody.js.map +1 -1
- package/esm/components/layouts/chat.css +19 -31
- package/esm/components/layouts/fullpage.css +52 -19
- package/esm/components/layouts/zoomed-full-body.css +40 -1
- package/esm/helpers/constants.d.ts +3 -0
- package/esm/helpers/constants.js +26 -0
- package/esm/helpers/constants.js.map +1 -1
- package/esm/helpers/credits.d.ts +5 -2
- package/esm/helpers/credits.js +5 -1
- package/esm/helpers/credits.js.map +1 -1
- package/esm/helpers/message.d.ts +1 -1
- package/esm/helpers/message.js +2 -2
- package/esm/helpers/message.js.map +1 -1
- package/esm/helpers/nats/getNatsConfig.d.ts +9 -0
- package/esm/helpers/nats/getNatsConfig.js +61 -0
- package/esm/helpers/nats/getNatsConfig.js.map +1 -0
- package/esm/helpers/nats/isSessionExpiredError.d.ts +3 -0
- package/esm/helpers/nats/isSessionExpiredError.js +32 -0
- package/esm/helpers/nats/isSessionExpiredError.js.map +1 -0
- package/esm/helpers/nats/useNats.d.ts +12 -0
- package/esm/helpers/nats/useNats.js +72 -0
- package/esm/helpers/nats/useNats.js.map +1 -0
- package/esm/helpers/nats/useNatsSession.d.ts +28 -0
- package/esm/helpers/nats/useNatsSession.js +208 -0
- package/esm/helpers/nats/useNatsSession.js.map +1 -0
- package/esm/helpers/usePressTooltip.d.ts +13 -0
- package/esm/helpers/usePressTooltip.js +20 -0
- package/esm/helpers/usePressTooltip.js.map +1 -0
- package/esm/helpers/utils.d.ts +21 -0
- package/esm/helpers/utils.js +68 -3
- package/esm/helpers/utils.js.map +1 -1
- package/esm/locales/de.json +1 -0
- package/esm/locales/en.json +1 -0
- package/esm/locales/es.json +1 -0
- package/esm/locales/fr.json +1 -0
- package/esm/locales/it.json +1 -0
- package/esm/styles.css +1 -1
- package/esm/types/integration.d.ts +3 -0
- package/esm/types/integration.js +11 -0
- package/esm/types/integration.js.map +1 -0
- package/esm/version.d.ts +1 -1
- package/esm/version.js +1 -1
- package/package.json +6 -4
- package/src/components/AgeVerificationModal/AgeVerificationModal.tsx +6 -1
- package/src/components/Avatar/Avatar.stories.tsx +45 -28
- package/src/components/Avatar/Avatar.test.tsx +54 -0
- package/src/components/Avatar/Avatar.tsx +8 -12
- package/src/components/Avatar/AvatarView/AvatarComponent/components/FullbodyAvatar/fullbodyAvatar.tsx +12 -5
- package/src/components/Avatar/AvatarView/AvatarComponent/components/controllers/MorphTargetController.ts +2 -1
- package/src/components/Avatar/AvatarView/AvatarComponent/constants.ts +16 -4
- package/src/components/Avatar/__snapshots__/Avatar.test.tsx.snap +164 -0
- package/src/components/ChatBubble/ChatBubble.tsx +41 -12
- package/src/components/CompletionProviderStatus/CompletionProviderStatus.tsx +8 -4
- package/src/components/DateSelector/DateSelector.stories.tsx +11 -2
- package/src/components/DateSelector/DateSelector.tsx +28 -9
- package/src/components/FilePreview/FilePreview.tsx +28 -7
- package/src/components/Header/ChatConsumptionDropdown.tsx +5 -1
- package/src/components/Header/Header.css +2 -1
- package/src/components/Header/Header.tsx +1 -0
- package/src/components/MediaWidget/MediaItemWidget.tsx +26 -13
- package/src/components/MediaWidget/MediaItemWidget.utils.test.ts +45 -2
- package/src/components/MediaWidget/MediaItemWidget.utils.ts +39 -6
- package/src/components/MediaWidget/MediaPreviewModal.tsx +9 -7
- package/src/components/MemoriArtifactSystem/ArtifactDrawer.stories.tsx +218 -2252
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/styles.css +5 -4
- package/src/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.css +90 -38
- package/src/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.tsx +31 -14
- package/src/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.tsx +4 -3
- package/src/components/MemoriWidget/MemoriWidget.tsx +785 -331
- package/src/components/StartPanel/StartPanel.stories.tsx +22 -0
- package/src/components/StartPanel/StartPanel.test.tsx +64 -1
- package/src/components/StartPanel/StartPanel.tsx +26 -3
- package/src/components/StartPanel/__snapshots__/StartPanel.test.tsx.snap +261 -0
- package/src/components/UploadButton/UploadButton.tsx +30 -11
- package/src/components/UploadButton/UploadDocuments/UploadDocuments.tsx +148 -61
- package/src/components/UploadButton/__snapshots__/UploadButton.test.tsx.snap +2 -2
- package/src/components/layouts/Chat.tsx +16 -19
- package/src/components/layouts/FullPage.tsx +32 -25
- package/src/components/layouts/HiddenChat.tsx +4 -0
- package/src/components/layouts/WebsiteAssistant/WebsiteAssistant.tsx +8 -0
- package/src/components/layouts/WebsiteAssistant/website-assistant.css +3 -4
- package/src/components/layouts/ZoomedFullBody.tsx +30 -24
- package/src/components/layouts/__snapshots__/Chat.test.tsx.snap +6 -3
- package/src/components/layouts/__snapshots__/FullPage.test.tsx.snap +824 -810
- package/src/components/layouts/__snapshots__/ZoomedFullBody.test.tsx.snap +280 -273
- package/src/components/layouts/chat.css +19 -31
- package/src/components/layouts/fullpage.css +52 -19
- package/src/components/layouts/layouts.stories.tsx +131 -12
- package/src/components/layouts/zoomed-full-body.css +40 -1
- package/src/helpers/constants.ts +32 -1
- package/src/helpers/credits.ts +16 -1
- package/src/helpers/message.test.ts +28 -1
- package/src/helpers/message.ts +4 -4
- package/src/helpers/nats/getNatsConfig.ts +145 -0
- package/src/helpers/nats/isSessionExpiredError.test.ts +38 -0
- package/src/helpers/nats/isSessionExpiredError.ts +51 -0
- package/src/helpers/nats/useNats.ts +124 -0
- package/src/helpers/nats/useNatsSession.ts +394 -0
- package/src/helpers/usePressTooltip.ts +29 -0
- package/src/helpers/utils.test.ts +162 -0
- package/src/helpers/utils.ts +108 -3
- package/src/index.stories.tsx +32 -0
- package/src/locales/de.json +1 -0
- package/src/locales/en.json +1 -0
- package/src/locales/es.json +1 -0
- package/src/locales/fr.json +1 -0
- package/src/locales/it.json +1 -0
- package/src/styles.css +4 -7
- package/src/types/integration.test.ts +32 -0
- package/src/types/integration.ts +31 -0
- package/src/version.ts +1 -1
|
@@ -274,15 +274,6 @@
|
|
|
274
274
|
transition: all 0.05s ease-in-out;
|
|
275
275
|
}
|
|
276
276
|
|
|
277
|
-
.memori-chat-layout--main-with-artifact {
|
|
278
|
-
display: flex;
|
|
279
|
-
flex-direction: row;
|
|
280
|
-
align-items: center;
|
|
281
|
-
justify-content: space-between;
|
|
282
|
-
/* padding: 1rem; */
|
|
283
|
-
gap: 1rem;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
277
|
.memori-chat-layout--controls {
|
|
287
278
|
position: relative;
|
|
288
279
|
z-index: 5;
|
|
@@ -293,15 +284,28 @@
|
|
|
293
284
|
max-height: 100%;
|
|
294
285
|
flex: 1;
|
|
295
286
|
flex-direction: column;
|
|
296
|
-
/* padding-bottom: 1.5rem; */
|
|
297
287
|
transition: all 0.05s ease-in-out;
|
|
298
288
|
}
|
|
299
289
|
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
290
|
+
/* Artifact drawer column inside the Chat layout's flex row */
|
|
291
|
+
.memori-chat-layout .memori--grid-column-artifact {
|
|
292
|
+
overflow: hidden;
|
|
293
|
+
width: 0;
|
|
294
|
+
min-width: 0;
|
|
295
|
+
flex-shrink: 0;
|
|
296
|
+
transition: width 0.25s ease;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
.memori-chat-layout .memori--grid-column-artifact--open {
|
|
300
|
+
width: 480px;
|
|
301
|
+
border-left: 1px solid var(--memori-border-color);
|
|
302
|
+
background: var(--memori-secondary-background);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
@media (max-width: 1260px) {
|
|
306
|
+
.memori-chat-layout .memori--grid-column-artifact {
|
|
307
|
+
display: none;
|
|
308
|
+
}
|
|
305
309
|
}
|
|
306
310
|
|
|
307
311
|
.memori-chat-layout--artifact-panel {
|
|
@@ -638,19 +642,3 @@
|
|
|
638
642
|
}
|
|
639
643
|
}
|
|
640
644
|
|
|
641
|
-
/* Adjust chat layout when drawer is open */
|
|
642
|
-
.memori-chat-layout:has(.memori-chat-layout--artifact-drawer .memori-artifact-drawer[data-headlessui-state~='open'])
|
|
643
|
-
.memori-chat-layout--controls {
|
|
644
|
-
margin-right: 50%;
|
|
645
|
-
filter: blur(1px);
|
|
646
|
-
opacity: 0.8;
|
|
647
|
-
transform: scale(0.98);
|
|
648
|
-
transition: all 0.05s ease-in-out;
|
|
649
|
-
}
|
|
650
|
-
|
|
651
|
-
.memori-chat-layout:has(.memori-chat-layout--artifact-drawer .memori-artifact-drawer[data-headlessui-state~='open'])
|
|
652
|
-
.memori-chat-layout--main {
|
|
653
|
-
backdrop-filter: blur(5px);
|
|
654
|
-
background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(248, 250, 252, 0.02) 100%);
|
|
655
|
-
transition: all 0.05s ease-in-out;
|
|
656
|
-
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* FullPage layout – spacing, typography and structure using global design tokens */
|
|
2
2
|
|
|
3
3
|
.memori-widget.memori-layout-fullpage {
|
|
4
|
-
max-width: var(--memori-layout-max-width);
|
|
4
|
+
/* max-width: var(--memori-layout-max-width); */
|
|
5
5
|
/* min-height: 100vh;
|
|
6
6
|
min-height: 100dvh; */
|
|
7
7
|
padding: var(--memori-spacing-md);
|
|
@@ -17,22 +17,11 @@
|
|
|
17
17
|
flex-direction: column;
|
|
18
18
|
gap: 0;
|
|
19
19
|
}
|
|
20
|
-
/*
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
left: 8%;
|
|
26
|
-
} */
|
|
27
|
-
|
|
28
|
-
/* 3D avatar: pin “Powered by” to the corner so it clears the figure */
|
|
29
|
-
.memori-widget.memori-layout-fullpage > .memori-spin > .memori--powered-by,
|
|
30
|
-
.memori-widget.memori-layout-fullpage.memori--avatar-readyplayerme > .memori-spin > .memori--powered-by,
|
|
31
|
-
.memori-widget.memori-layout-fullpage.memori--avatar-readyplayerme-full > .memori-spin > .memori--powered-by,
|
|
32
|
-
.memori-widget.memori-layout-fullpage.memori--avatar-customglb > .memori-spin > .memori--powered-by,
|
|
33
|
-
.memori-widget.memori-layout-fullpage.memori--avatar-customrpm > .memori-spin > .memori--powered-by {
|
|
34
|
-
bottom: 3.5rem;
|
|
35
|
-
left: 1.5rem;
|
|
20
|
+
/* "Powered by" is rendered inside .memori--grid-column-left and pinned to its bottom-left corner
|
|
21
|
+
via the default absolute positioning defined in PoweredBy.css. */
|
|
22
|
+
.memori-widget.memori-layout-fullpage .memori--grid-column-left > .memori--powered-by {
|
|
23
|
+
bottom: 1rem;
|
|
24
|
+
left: 1rem;
|
|
36
25
|
}
|
|
37
26
|
|
|
38
27
|
/* Header spacing + fullpage chrome (brand + actions bar) */
|
|
@@ -50,8 +39,8 @@
|
|
|
50
39
|
min-width: 100%;
|
|
51
40
|
flex-shrink: 0;
|
|
52
41
|
/* padding: 0.625rem 0.9rem; */
|
|
53
|
-
border: 1px solid color-mix(in srgb, var(--memori-text-color, #111827) 12%, transparent);
|
|
54
|
-
border-radius: 0.9rem;
|
|
42
|
+
border-bottom: 1px solid color-mix(in srgb, var(--memori-text-color, #111827) 12%, transparent);
|
|
43
|
+
/* border-radius: 0.9rem; */
|
|
55
44
|
-webkit-backdrop-filter: blur(12px);
|
|
56
45
|
backdrop-filter: blur(12px);
|
|
57
46
|
background: color-mix(in oklch, var(--memori-secondary-background), transparent 8%);
|
|
@@ -161,9 +150,22 @@
|
|
|
161
150
|
flex: 0 0 auto;
|
|
162
151
|
}
|
|
163
152
|
|
|
153
|
+
/* Full-height flex row: [grid] [artifact column] — outside the grid so artifact
|
|
154
|
+
spans the entire content height without inheriting grid padding/max-width */
|
|
155
|
+
.memori-widget.memori-layout-fullpage .memori-fullpage-content-row {
|
|
156
|
+
display: flex;
|
|
157
|
+
overflow: hidden;
|
|
158
|
+
min-height: 0;
|
|
159
|
+
flex: 1 1 auto;
|
|
160
|
+
flex-direction: row;
|
|
161
|
+
align-items: stretch;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
164
|
/* Grid: main + left column (avatar) */
|
|
165
165
|
.memori-widget.memori-layout-fullpage .memori--grid {
|
|
166
166
|
display: flex;
|
|
167
|
+
width: 100%;
|
|
168
|
+
max-width: var(--memori-layout-max-width);
|
|
167
169
|
height: 100%;
|
|
168
170
|
min-height: 0;
|
|
169
171
|
flex: 1 1 auto;
|
|
@@ -172,6 +174,7 @@
|
|
|
172
174
|
padding: 0 var(--memori-spacing-md) var(--memori-spacing-md);
|
|
173
175
|
padding-top: var(--memori-spacing-md);
|
|
174
176
|
padding-bottom: var(--memori-spacing-xl);
|
|
177
|
+
margin: 0 auto;
|
|
175
178
|
gap: var(--memori-spacing-md);
|
|
176
179
|
}
|
|
177
180
|
|
|
@@ -208,6 +211,36 @@
|
|
|
208
211
|
justify-content: stretch;
|
|
209
212
|
}
|
|
210
213
|
|
|
214
|
+
/* Artifact column — flex sibling of .memori--grid inside .memori-fullpage-content-row.
|
|
215
|
+
Sits outside the padded grid so it spans the full content height with no padding gaps. */
|
|
216
|
+
.memori-widget.memori-layout-fullpage .memori--grid-column-artifact {
|
|
217
|
+
overflow: hidden;
|
|
218
|
+
width: 0;
|
|
219
|
+
min-width: 0;
|
|
220
|
+
flex-shrink: 0;
|
|
221
|
+
transition: width 0.25s ease;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.memori-widget.memori-layout-fullpage .memori--grid-column-artifact--open {
|
|
225
|
+
width: 600px;
|
|
226
|
+
border-left: 1px solid color-mix(in srgb, var(--memori-text-color, #111827) 10%, transparent);
|
|
227
|
+
background: var(--memori-secondary-background);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/* Hide avatar column when artifact drawer is open.
|
|
231
|
+
Selector updated: artifact is now a sibling of .memori--grid, not inside it. */
|
|
232
|
+
.memori-widget.memori-layout-fullpage
|
|
233
|
+
.memori-fullpage-content-row:has(.memori--grid-column-artifact--open)
|
|
234
|
+
.memori--grid-column-left {
|
|
235
|
+
display: none;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
@media (max-width: 1260px) {
|
|
239
|
+
.memori-widget.memori-layout-fullpage .memori--grid-column-artifact {
|
|
240
|
+
display: none;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
211
244
|
.memori-widget.memori-layout-fullpage .memori-chat-layout--controls {
|
|
212
245
|
display: flex;
|
|
213
246
|
width: 100%;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Meta, Story } from '@storybook/react';
|
|
3
|
+
import { Spin } from '@memori.ai/ui';
|
|
3
4
|
import { memori, tenant, integration } from '../../mocks/data';
|
|
4
5
|
import Memori, { Props } from '../../index';
|
|
6
|
+
import { LayoutProps } from '../MemoriWidget/MemoriWidget';
|
|
5
7
|
import I18nWrapper from '../../I18nWrapper';
|
|
6
8
|
import { VisemeProvider } from '../../context/visemeContext';
|
|
7
9
|
import { ArtifactProvider } from '../MemoriArtifactSystem/context/ArtifactContext';
|
|
@@ -30,25 +32,18 @@ const Template: Story<Props> = args => (
|
|
|
30
32
|
|
|
31
33
|
const DefaultLayout = Template.bind({});
|
|
32
34
|
DefaultLayout.args = {
|
|
33
|
-
memoriName: '
|
|
34
|
-
ownerUserName: '
|
|
35
|
-
memoriID: '
|
|
35
|
+
memoriName: 'prova-sharepoint',
|
|
36
|
+
ownerUserName: 'Andrea-Patini',
|
|
37
|
+
memoriID: '019f129c-a5a3-74d3-b0c8-b7794437bb23',
|
|
36
38
|
ownerUserID: '91dbc9ba-b684-4fbe-9828-b5980af6cda9',
|
|
37
39
|
tenantID: 'aisuru-staging.aclambda.online',
|
|
38
40
|
engineURL: 'https://engine-staging.memori.ai/memori/v2',
|
|
39
41
|
apiURL: 'https://backend-staging.memori.ai/api/v2',
|
|
42
|
+
baseURL: 'https://aisuru-staging.aclambda.online',
|
|
40
43
|
layout: 'FULLPAGE',
|
|
41
44
|
uiLang: 'IT',
|
|
42
45
|
spokenLang: 'IT',
|
|
43
|
-
integrationID: '
|
|
44
|
-
autoStart: false,
|
|
45
|
-
sessionID: '' as string | undefined,
|
|
46
|
-
showUpload: true,
|
|
47
|
-
showReasoning: false,
|
|
48
|
-
showLogin: true,
|
|
49
|
-
multilingual: true,
|
|
50
|
-
avatar3dHidden: true,
|
|
51
|
-
showMessageConsumption: true,
|
|
46
|
+
integrationID: '019f1896-730d-7e19-9a88-6413f485247b',
|
|
52
47
|
};
|
|
53
48
|
|
|
54
49
|
export const Default = Template.bind({});
|
|
@@ -82,6 +77,130 @@ ChatOnly.args = {
|
|
|
82
77
|
layout: 'CHAT',
|
|
83
78
|
};
|
|
84
79
|
|
|
80
|
+
const CustomLayout: React.FC<LayoutProps> = ({
|
|
81
|
+
Header,
|
|
82
|
+
headerProps,
|
|
83
|
+
Avatar,
|
|
84
|
+
avatarProps,
|
|
85
|
+
Chat,
|
|
86
|
+
chatProps,
|
|
87
|
+
StartPanel,
|
|
88
|
+
startPanelProps,
|
|
89
|
+
integrationStyle,
|
|
90
|
+
integrationBackground,
|
|
91
|
+
sessionId,
|
|
92
|
+
hasUserActivatedSpeak,
|
|
93
|
+
loading = false,
|
|
94
|
+
poweredBy,
|
|
95
|
+
}) => (
|
|
96
|
+
<>
|
|
97
|
+
{integrationStyle}
|
|
98
|
+
{integrationBackground}
|
|
99
|
+
|
|
100
|
+
<Spin spinning={loading} className="memori-mycustom-layout">
|
|
101
|
+
{poweredBy}
|
|
102
|
+
|
|
103
|
+
<div className="memori-mycustom-layout--controls">
|
|
104
|
+
{sessionId && hasUserActivatedSpeak && Chat && chatProps ? (
|
|
105
|
+
<Chat {...chatProps} />
|
|
106
|
+
) : startPanelProps ? (
|
|
107
|
+
<StartPanel {...startPanelProps} />
|
|
108
|
+
) : null}
|
|
109
|
+
</div>
|
|
110
|
+
</Spin>
|
|
111
|
+
</>
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
export const Custom = Template.bind({});
|
|
115
|
+
Custom.args = {
|
|
116
|
+
...DefaultLayout.args,
|
|
117
|
+
uiLang: 'it',
|
|
118
|
+
showShare: true,
|
|
119
|
+
showSettings: true,
|
|
120
|
+
memori: memori,
|
|
121
|
+
tenant,
|
|
122
|
+
layout: 'FULLPAGE',
|
|
123
|
+
customLayout: CustomLayout,
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
export const WebsiteAssistant2 = Template.bind({});
|
|
127
|
+
WebsiteAssistant2.args = {
|
|
128
|
+
memoriName: 'Marconi Express',
|
|
129
|
+
ownerUserName: 'exmita',
|
|
130
|
+
memoriID: '1755979f-28f1-45d1-8f41-bb34e1f7756b',
|
|
131
|
+
ownerUserID: '3194fcd3-040b-4d5e-a925-691911fb1177',
|
|
132
|
+
tenantID: 'exmachina.aclambda.online',
|
|
133
|
+
engineURL: 'https://engine.memori.ai',
|
|
134
|
+
apiURL: 'https://backend.memori.ai',
|
|
135
|
+
baseURL: 'https://exmachina.aclambda.online',
|
|
136
|
+
uiLang: 'IT',
|
|
137
|
+
avatar3dHidden: true,
|
|
138
|
+
spokenLang: 'IT',
|
|
139
|
+
layout: 'WEBSITE_ASSISTANT',
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
export const WebsiteAssistant3 = Template.bind({});
|
|
143
|
+
WebsiteAssistant3.args = {
|
|
144
|
+
memoriName: 'Layout Storybook',
|
|
145
|
+
ownerUserName: 'Andrea-Patini',
|
|
146
|
+
memoriID: 'ae20fc5a-cc15-4db9-b7dd-2cd4a621b85e',
|
|
147
|
+
ownerUserID: '91dbc9ba-b684-4fbe-9828-b5980af6cda9',
|
|
148
|
+
tenantID: 'aisuru-staging.aclambda.online',
|
|
149
|
+
engineURL: 'https://engine-staging.memori.ai/memori/v2',
|
|
150
|
+
apiURL: 'https://backend-staging.memori.ai/api/v2',
|
|
151
|
+
baseURL: 'http://localhost:3000',
|
|
152
|
+
layout: 'WEBSITE_ASSISTANT',
|
|
153
|
+
avatar3dHidden: true,
|
|
154
|
+
uiLang: 'IT',
|
|
155
|
+
spokenLang: 'IT',
|
|
156
|
+
showOnlyLastMessages: true,
|
|
157
|
+
integrationID: '716f4728-919c-4015-aae1-88998a081c6f',
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
export const WebsiteAssistant = Template.bind({});
|
|
161
|
+
WebsiteAssistant.args = {
|
|
162
|
+
uiLang: 'EN',
|
|
163
|
+
showShare: false,
|
|
164
|
+
showSettings: true,
|
|
165
|
+
memori: memori,
|
|
166
|
+
tenant,
|
|
167
|
+
layout: 'WEBSITE_ASSISTANT',
|
|
168
|
+
memoriName: 'Memori',
|
|
169
|
+
memoriID: '25ced51c-3520-41af-8bbe-222d861b8e32',
|
|
170
|
+
ownerUserName: 'memoridev',
|
|
171
|
+
tenantID: 'www.aisuru.com',
|
|
172
|
+
apiURL: 'https://backend.memori.ai',
|
|
173
|
+
baseURL: 'https://www.aisuru.com',
|
|
174
|
+
spokenLang: 'EN',
|
|
175
|
+
context: {
|
|
176
|
+
SOURCE: 'WEBSITE',
|
|
177
|
+
PATH: '/en/',
|
|
178
|
+
},
|
|
179
|
+
multilingual: true,
|
|
180
|
+
integrationID: 'cb3c4776-7f0b-4f97-a773-c32a5d7a3bf1',
|
|
181
|
+
integration: {
|
|
182
|
+
...integration,
|
|
183
|
+
customData: JSON.stringify({
|
|
184
|
+
textColor: '#2a2a2a',
|
|
185
|
+
buttonBgColor: '#653165',
|
|
186
|
+
buttonTextColor: '#ffffff',
|
|
187
|
+
blurBackground: true,
|
|
188
|
+
innerBgColor: 'light',
|
|
189
|
+
innerBgAlpha: 0.8,
|
|
190
|
+
multilanguage: true,
|
|
191
|
+
avatar: 'readyplayerme',
|
|
192
|
+
avatarURL:
|
|
193
|
+
'https://assets.memori.ai/api/v2/asset/b791f77c-1a94-4272-829e-eca82fcc62b7.glb',
|
|
194
|
+
}),
|
|
195
|
+
},
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
export const WebsiteAssistantWithout3DAvatar = Template.bind({});
|
|
199
|
+
WebsiteAssistantWithout3DAvatar.args = {
|
|
200
|
+
...WebsiteAssistant.args,
|
|
201
|
+
avatar3dHidden: true,
|
|
202
|
+
};
|
|
203
|
+
|
|
85
204
|
export const HiddenChat = Template.bind({});
|
|
86
205
|
HiddenChat.args = {
|
|
87
206
|
...DefaultLayout.args,
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
.memori-widget.memori-layout-zoomed_full_body {
|
|
14
|
-
max-width: var(--memori-layout-max-width);
|
|
14
|
+
/* max-width: var(--memori-layout-max-width); */
|
|
15
15
|
padding: var(--memori-spacing-md);
|
|
16
16
|
margin-right: auto;
|
|
17
17
|
margin-left: auto;
|
|
@@ -143,6 +143,8 @@
|
|
|
143
143
|
/* Grid: main + left column (avatar) */
|
|
144
144
|
.memori-widget.memori-layout-zoomed_full_body .memori--grid {
|
|
145
145
|
display: flex;
|
|
146
|
+
width: 100%;
|
|
147
|
+
max-width: var(--memori-layout-max-width);
|
|
146
148
|
height: 100%;
|
|
147
149
|
min-height: 0;
|
|
148
150
|
flex: 1 1 auto;
|
|
@@ -151,6 +153,7 @@
|
|
|
151
153
|
padding: 0 var(--memori-spacing-md) var(--memori-spacing-md);
|
|
152
154
|
padding-top: var(--memori-spacing-md);
|
|
153
155
|
padding-bottom: var(--memori-spacing-xl);
|
|
156
|
+
margin: 0 auto;
|
|
154
157
|
gap: var(--memori-spacing-md);
|
|
155
158
|
}
|
|
156
159
|
|
|
@@ -187,6 +190,42 @@
|
|
|
187
190
|
justify-content: stretch;
|
|
188
191
|
}
|
|
189
192
|
|
|
193
|
+
/* Full-height flex row: [grid] [artifact column] */
|
|
194
|
+
.memori-widget.memori-layout-zoomed_full_body .memori-fullpage-content-row {
|
|
195
|
+
display: flex;
|
|
196
|
+
overflow: hidden;
|
|
197
|
+
min-height: 0;
|
|
198
|
+
flex: 1 1 auto;
|
|
199
|
+
flex-direction: row;
|
|
200
|
+
align-items: stretch;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/* Artifact column — flex sibling of .memori--grid, outside the padded grid */
|
|
204
|
+
.memori-widget.memori-layout-zoomed_full_body .memori--grid-column-artifact {
|
|
205
|
+
overflow: hidden;
|
|
206
|
+
width: 0;
|
|
207
|
+
min-width: 0;
|
|
208
|
+
flex-shrink: 0;
|
|
209
|
+
transition: width 0.25s ease;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.memori-widget.memori-layout-zoomed_full_body .memori--grid-column-artifact--open {
|
|
213
|
+
width: 480px;
|
|
214
|
+
border-left: 1px solid color-mix(in srgb, var(--memori-text-color, #111827) 10%, transparent);
|
|
215
|
+
background: var(--memori-secondary-background);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/* Hide avatar column when artifact drawer is open */
|
|
219
|
+
.memori-widget.memori-layout-zoomed_full_body .memori-fullpage-content-row:has(.memori--grid-column-artifact--open) .memori--grid-column-left {
|
|
220
|
+
display: none;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
@media (max-width: 1260px) {
|
|
224
|
+
.memori-widget.memori-layout-zoomed_full_body .memori--grid-column-artifact {
|
|
225
|
+
display: none;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
190
229
|
.memori-widget.memori-layout-zoomed_full_body .memori-chat-layout--controls {
|
|
191
230
|
display: flex;
|
|
192
231
|
width: 100%;
|
package/src/helpers/constants.ts
CHANGED
|
@@ -36,7 +36,7 @@ export const getGroupedChatLanguages = () => {
|
|
|
36
36
|
popularLanguageCodes.includes(lang.value)
|
|
37
37
|
);
|
|
38
38
|
const all = chatLanguages.filter(lang => !popularLanguageCodes.includes(lang.value));
|
|
39
|
-
return {
|
|
39
|
+
return {
|
|
40
40
|
popular,
|
|
41
41
|
all,
|
|
42
42
|
};
|
|
@@ -44,6 +44,15 @@ export const getGroupedChatLanguages = () => {
|
|
|
44
44
|
|
|
45
45
|
export const uiLanguages = ['en', 'it', 'fr', 'es', 'de'];
|
|
46
46
|
|
|
47
|
+
/** Extensions uploaded as original Office binaries (no text extraction) */
|
|
48
|
+
export const officeNativeExtensions = [
|
|
49
|
+
'.doc',
|
|
50
|
+
'.docx',
|
|
51
|
+
'.dotx',
|
|
52
|
+
'.xltx',
|
|
53
|
+
'.potx',
|
|
54
|
+
] as const;
|
|
55
|
+
|
|
47
56
|
export const allowedMediaTypes = [
|
|
48
57
|
'image/jpeg',
|
|
49
58
|
'image/png',
|
|
@@ -51,6 +60,7 @@ export const allowedMediaTypes = [
|
|
|
51
60
|
'image/gif',
|
|
52
61
|
'application/msword',
|
|
53
62
|
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
63
|
+
'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
|
|
54
64
|
'application/vnd.ms-excel',
|
|
55
65
|
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
56
66
|
'application/pdf',
|
|
@@ -63,6 +73,27 @@ export const allowedMediaTypes = [
|
|
|
63
73
|
'model/gltf-binary',
|
|
64
74
|
];
|
|
65
75
|
|
|
76
|
+
/** Short badge labels for Office document cards */
|
|
77
|
+
export const officeMimeShortLabels: Record<string, string> = {
|
|
78
|
+
'application/msword': 'Word',
|
|
79
|
+
'application/vnd.openxmlformats-officedocument.wordprocessingml.document': 'Word',
|
|
80
|
+
'application/vnd.openxmlformats-officedocument.wordprocessingml.template': 'Word',
|
|
81
|
+
'application/vnd.ms-excel': 'Excel',
|
|
82
|
+
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': 'Excel',
|
|
83
|
+
'application/vnd.openxmlformats-officedocument.spreadsheetml.template': 'Excel',
|
|
84
|
+
'application/vnd.openxmlformats-officedocument.presentationml.template': 'PPT',
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export const officeExtensionShortLabels: Record<string, string> = {
|
|
88
|
+
DOC: 'Word',
|
|
89
|
+
DOCX: 'Word',
|
|
90
|
+
DOTX: 'Word',
|
|
91
|
+
XLS: 'Excel',
|
|
92
|
+
XLSX: 'Excel',
|
|
93
|
+
XLTX: 'Excel',
|
|
94
|
+
POTX: 'PPT',
|
|
95
|
+
};
|
|
96
|
+
|
|
66
97
|
export const anonTag = '👤';
|
|
67
98
|
|
|
68
99
|
export const prismSyntaxLangs = [
|
package/src/helpers/credits.ts
CHANGED
|
@@ -1,23 +1,37 @@
|
|
|
1
1
|
// POST http://localhost:3000/api/verify-tokens operation=session_creation userID=585ec0ff-e805-495e-b8fc-5b0b8dd288ff tenant=aisuru-staging-tokenized.aclambda.online
|
|
2
|
+
export type CreditsOperation =
|
|
3
|
+
| 'twin_creation'
|
|
4
|
+
| 'session_creation'
|
|
5
|
+
| 'import_document'
|
|
6
|
+
// accepted by the API and normalized to session_creation
|
|
7
|
+
| 'dt_session_creation';
|
|
8
|
+
|
|
2
9
|
export const getCredits = async ({
|
|
3
10
|
operation = 'session_creation',
|
|
4
11
|
baseUrl,
|
|
5
12
|
userID,
|
|
6
13
|
userName,
|
|
7
14
|
tenant,
|
|
15
|
+
characters,
|
|
8
16
|
}: {
|
|
9
|
-
operation?:
|
|
17
|
+
operation?: CreditsOperation;
|
|
10
18
|
baseUrl: string;
|
|
11
19
|
userID?: string | null;
|
|
12
20
|
userName?: string | null;
|
|
13
21
|
tenant: string;
|
|
22
|
+
characters?: number;
|
|
14
23
|
}): Promise<{
|
|
15
24
|
enough: boolean;
|
|
16
25
|
required: number;
|
|
26
|
+
tokens?: number;
|
|
17
27
|
}> => {
|
|
18
28
|
if (!userID && !userName) {
|
|
19
29
|
throw new Error('Either userID or userName must be provided');
|
|
20
30
|
}
|
|
31
|
+
if (operation === 'import_document' && characters == null) {
|
|
32
|
+
throw new Error('characters must be provided for import_document');
|
|
33
|
+
}
|
|
34
|
+
|
|
21
35
|
const resp = await fetch(`${baseUrl}/api/verify-tokens`, {
|
|
22
36
|
method: 'POST',
|
|
23
37
|
headers: {
|
|
@@ -28,6 +42,7 @@ export const getCredits = async ({
|
|
|
28
42
|
userID,
|
|
29
43
|
userName,
|
|
30
44
|
tenant,
|
|
45
|
+
...(operation === 'import_document' ? { characters } : {}),
|
|
31
46
|
}),
|
|
32
47
|
});
|
|
33
48
|
|
|
@@ -1,4 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
renderMsg,
|
|
3
|
+
sanitizeMsg,
|
|
4
|
+
stripAttachmentTags,
|
|
5
|
+
stripAllInternalTags,
|
|
6
|
+
} from './message';
|
|
7
|
+
|
|
8
|
+
describe('sanitizeMsg', () => {
|
|
9
|
+
it('strips onerror from partner XSS img payload', () => {
|
|
10
|
+
const payload =
|
|
11
|
+
'<img src="immagine-inesistente.jpg" onerror="alert(\'XSS Eseguito!\')">';
|
|
12
|
+
const result = sanitizeMsg(payload);
|
|
13
|
+
expect(result).toBe('<img src="immagine-inesistente.jpg">');
|
|
14
|
+
expect(result).not.toMatch(/onerror/i);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('strips svg onload handlers', () => {
|
|
18
|
+
const result = sanitizeMsg('<svg onload="alert(1)"></svg>');
|
|
19
|
+
expect(result).not.toMatch(/onload/i);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
2
22
|
|
|
3
23
|
describe('renderMsg', () => {
|
|
4
24
|
it('should render message with reasoning and output tag adjacent correctly', () => {
|
|
@@ -11,6 +31,13 @@ describe('renderMsg', () => {
|
|
|
11
31
|
'<details class="memori-think"><summary>Reasoning...</summary>L\'utente vuole che io elenchi i parametri dell\'ALBERO ESISTENTE.</details>\n\n<output class="rails-query" style="display:none">\nproject = Project.find("68d99b05783713e16737d32b")\n</output>\n\n<p>Recupero tutti i 7 parametri dell\'ALBERO ESISTENTE...</p>'
|
|
12
32
|
);
|
|
13
33
|
});
|
|
34
|
+
|
|
35
|
+
it('strips onerror from XSS img payload in rendered output', () => {
|
|
36
|
+
const payload =
|
|
37
|
+
'<img src="immagine-inesistente.jpg" onerror="alert(\'XSS Eseguito!\')">';
|
|
38
|
+
const result = renderMsg(payload, false, 'Reasoning...', false);
|
|
39
|
+
expect(result.text).not.toMatch(/onerror/i);
|
|
40
|
+
});
|
|
14
41
|
});
|
|
15
42
|
|
|
16
43
|
describe('stripAttachmentTags', () => {
|
package/src/helpers/message.ts
CHANGED
|
@@ -85,6 +85,9 @@ export const truncateMessage = (message: string) => {
|
|
|
85
85
|
return truncatedMessage;
|
|
86
86
|
};
|
|
87
87
|
|
|
88
|
+
export const sanitizeMsg = (msg: string) =>
|
|
89
|
+
DOMPurify.sanitize(msg, { ADD_ATTR: ['target'] });
|
|
90
|
+
|
|
88
91
|
export const renderMsg = (
|
|
89
92
|
text: string,
|
|
90
93
|
useMathFormatting = false,
|
|
@@ -196,9 +199,6 @@ export const renderMsg = (
|
|
|
196
199
|
return { text: finalText };
|
|
197
200
|
} catch (e) {
|
|
198
201
|
console.error('Error rendering message:', e);
|
|
199
|
-
return { text };
|
|
202
|
+
return { text: sanitizeMsg(text) };
|
|
200
203
|
}
|
|
201
204
|
};
|
|
202
|
-
|
|
203
|
-
export const sanitizeMsg = (msg: string) =>
|
|
204
|
-
DOMPurify.sanitize(msg, { ADD_ATTR: ['target'] });
|