@memori.ai/memori-react 8.45.2 → 8.45.4
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 +20 -0
- package/dist/components/Chat/Chat.js +4 -1
- package/dist/components/Chat/Chat.js.map +1 -1
- package/dist/components/ChatHistoryDrawer/ChatResumeDrawer.d.ts +39 -0
- package/dist/components/ChatHistoryDrawer/ChatResumeDrawer.js +66 -0
- package/dist/components/ChatHistoryDrawer/ChatResumeDrawer.js.map +1 -0
- package/dist/components/DrawerFooter/DrawerFooter.d.ts +12 -0
- package/dist/components/DrawerFooter/DrawerFooter.js +10 -0
- package/dist/components/DrawerFooter/DrawerFooter.js.map +1 -0
- package/dist/components/IconButton/IconButton.d.ts +9 -0
- package/dist/components/IconButton/IconButton.js +36 -0
- package/dist/components/IconButton/IconButton.js.map +1 -0
- package/dist/components/MemoriWidget/MemoriWidget.d.ts +1 -1
- package/dist/components/MemoriWidget/MemoriWidget.js +2 -1
- package/dist/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/dist/components/MobileSessionPanel/MobileSessionPanel.d.ts +65 -0
- package/dist/components/MobileSessionPanel/MobileSessionPanel.js +294 -0
- package/dist/components/MobileSessionPanel/MobileSessionPanel.js.map +1 -0
- package/dist/components/PositionPopover/PositionPopover.d.ts +22 -0
- package/dist/components/PositionPopover/PositionPopover.js +208 -0
- package/dist/components/PositionPopover/PositionPopover.js.map +1 -0
- package/dist/components/layouts/WebsiteAssistant/WebsiteAssistant.d.ts +4 -0
- package/dist/components/layouts/WebsiteAssistant/WebsiteAssistant.js +64 -0
- package/dist/components/layouts/WebsiteAssistant/WebsiteAssistant.js.map +1 -0
- package/dist/components/layouts/chat.css +27 -4
- package/dist/context/widgetSurfaceContext.d.ts +3 -0
- package/dist/context/widgetSurfaceContext.js +11 -0
- package/dist/context/widgetSurfaceContext.js.map +1 -0
- package/dist/helpers/positionPopover.d.ts +2 -0
- package/dist/helpers/positionPopover.js +16 -0
- package/dist/helpers/positionPopover.js.map +1 -0
- package/dist/helpers/tts/muteSpeaker.d.ts +13 -0
- package/dist/helpers/tts/muteSpeaker.js +27 -0
- package/dist/helpers/tts/muteSpeaker.js.map +1 -0
- package/dist/helpers/usePressTooltip.d.ts +13 -0
- package/dist/helpers/usePressTooltip.js +24 -0
- package/dist/helpers/usePressTooltip.js.map +1 -0
- package/dist/icons/FacebookIcon.d.ts +3 -0
- package/dist/icons/FacebookIcon.js +6 -0
- package/dist/icons/FacebookIcon.js.map +1 -0
- package/dist/icons/LinkedinIcon.d.ts +3 -0
- package/dist/icons/LinkedinIcon.js +6 -0
- package/dist/icons/LinkedinIcon.js.map +1 -0
- package/dist/icons/MemoriIcon.d.ts +3 -0
- package/dist/icons/MemoriIcon.js +8 -0
- package/dist/icons/MemoriIcon.js.map +1 -0
- package/dist/icons/TelegramIcon.d.ts +3 -0
- package/dist/icons/TelegramIcon.js +6 -0
- package/dist/icons/TelegramIcon.js.map +1 -0
- package/dist/icons/TwitterIcon.d.ts +3 -0
- package/dist/icons/TwitterIcon.js +6 -0
- package/dist/icons/TwitterIcon.js.map +1 -0
- package/dist/icons/WhatsappIcon.d.ts +3 -0
- package/dist/icons/WhatsappIcon.js +6 -0
- package/dist/icons/WhatsappIcon.js.map +1 -0
- package/dist/icons/artifacts/DocumentIcon.d.ts +3 -0
- package/dist/icons/artifacts/DocumentIcon.js +6 -0
- package/dist/icons/artifacts/DocumentIcon.js.map +1 -0
- package/dist/icons/artifacts/HtmlIcon.d.ts +3 -0
- package/dist/icons/artifacts/HtmlIcon.js +6 -0
- package/dist/icons/artifacts/HtmlIcon.js.map +1 -0
- package/dist/icons/artifacts/JavascriptIcon.d.ts +3 -0
- package/dist/icons/artifacts/JavascriptIcon.js +6 -0
- package/dist/icons/artifacts/JavascriptIcon.js.map +1 -0
- package/dist/icons/artifacts/MarkdownIcon.d.ts +3 -0
- package/dist/icons/artifacts/MarkdownIcon.js +6 -0
- package/dist/icons/artifacts/MarkdownIcon.js.map +1 -0
- package/dist/icons/artifacts/PythonIcon.d.ts +3 -0
- package/dist/icons/artifacts/PythonIcon.js +6 -0
- package/dist/icons/artifacts/PythonIcon.js.map +1 -0
- package/dist/icons/artifacts/SvgIcon.d.ts +3 -0
- package/dist/icons/artifacts/SvgIcon.js +6 -0
- package/dist/icons/artifacts/SvgIcon.js.map +1 -0
- package/dist/icons/artifacts/XmlIcon.d.ts +3 -0
- package/dist/icons/artifacts/XmlIcon.js +6 -0
- package/dist/icons/artifacts/XmlIcon.js.map +1 -0
- package/dist/icons/artifacts/cssIcon.d.ts +3 -0
- package/dist/icons/artifacts/cssIcon.js +6 -0
- package/dist/icons/artifacts/cssIcon.js.map +1 -0
- package/dist/styles.css +1 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/esm/components/Chat/Chat.js +4 -1
- package/esm/components/Chat/Chat.js.map +1 -1
- package/esm/components/MemoriWidget/MemoriWidget.d.ts +1 -1
- package/esm/components/MemoriWidget/MemoriWidget.js +2 -1
- package/esm/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/esm/components/layouts/chat.css +27 -4
- package/esm/styles.css +1 -2
- package/esm/version.d.ts +1 -1
- package/esm/version.js +1 -1
- package/package.json +6 -7
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/test/CopyButtonTest.d.ts +0 -3
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/test/CopyButtonTest.js +0 -64
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/test/CopyButtonTest.js.map +0 -1
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/test/CopyButtonTest.d.ts +0 -3
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/test/CopyButtonTest.js +0 -62
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/test/CopyButtonTest.js.map +0 -1
- package/src/I18nWrapper.tsx +0 -13
- package/src/__snapshots__/index.test.tsx.snap +0 -96
- package/src/components/AgeVerificationModal/AgeVerificationModal.css +0 -95
- package/src/components/AgeVerificationModal/AgeVerificationModal.stories.tsx +0 -46
- package/src/components/AgeVerificationModal/AgeVerificationModal.test.tsx +0 -33
- package/src/components/AgeVerificationModal/AgeVerificationModal.tsx +0 -99
- package/src/components/AgeVerificationModal/__snapshots__/AgeVerificationModal.test.tsx.snap +0 -19
- package/src/components/Auth/Auth.css +0 -57
- package/src/components/Auth/Auth.stories.tsx +0 -90
- package/src/components/Auth/Auth.test.tsx +0 -63
- package/src/components/Auth/Auth.tsx +0 -201
- package/src/components/Auth/__snapshots__/Auth.test.tsx.snap +0 -143
- package/src/components/Avatar/Avatar.css +0 -151
- package/src/components/Avatar/Avatar.stories.tsx +0 -160
- package/src/components/Avatar/Avatar.test.tsx +0 -158
- package/src/components/Avatar/Avatar.tsx +0 -245
- package/src/components/Avatar/AvatarView/AvatarComponent/Shadow/DynamicShadow.tsx +0 -103
- package/src/components/Avatar/AvatarView/AvatarComponent/avatarComponent.tsx +0 -105
- package/src/components/Avatar/AvatarView/AvatarComponent/components/FullbodyAvatar/fullbodyAvatar.tsx +0 -338
- package/src/components/Avatar/AvatarView/AvatarComponent/components/FullbodyAvatar/types.ts +0 -44
- package/src/components/Avatar/AvatarView/AvatarComponent/components/controllers/AvatarAnimator.ts +0 -1091
- package/src/components/Avatar/AvatarView/AvatarComponent/components/controllers/AvatarPositionController.ts +0 -83
- package/src/components/Avatar/AvatarView/AvatarComponent/components/controllers/MorphTargetController.ts +0 -301
- package/src/components/Avatar/AvatarView/AvatarComponent/components/controls.tsx +0 -100
- package/src/components/Avatar/AvatarView/AvatarComponent/components/halfbodyAvatar.tsx +0 -152
- package/src/components/Avatar/AvatarView/AvatarComponent/components/loader.tsx +0 -31
- package/src/components/Avatar/AvatarView/AvatarComponent/constants.ts +0 -141
- package/src/components/Avatar/AvatarView/AvatarComponent/lights/Lights.tsx +0 -145
- package/src/components/Avatar/AvatarView/AvatarComponent/positionControls/positionControls.css +0 -111
- package/src/components/Avatar/AvatarView/AvatarComponent/positionControls/positionControls.tsx +0 -201
- package/src/components/Avatar/AvatarView/AvatarView.stories.tsx +0 -254
- package/src/components/Avatar/AvatarView/index.tsx +0 -194
- package/src/components/Avatar/AvatarView/utils/hideHands.ts +0 -11
- package/src/components/Avatar/AvatarView/utils/useEyeBlink.ts +0 -100
- package/src/components/Avatar/AvatarView/utils/useHeadMovement.ts +0 -72
- package/src/components/Avatar/AvatarView/utils/useLoadingMorphAnim.ts +0 -38
- package/src/components/Avatar/AvatarView/utils/useMouthAnimation.ts +0 -93
- package/src/components/Avatar/AvatarView/utils/useSmile.ts +0 -39
- package/src/components/Avatar/AvatarView/utils/utils.ts +0 -55
- package/src/components/Avatar/__snapshots__/Avatar.test.tsx.snap +0 -246
- package/src/components/Blob/Blob.css +0 -286
- package/src/components/Blob/Blob.stories.tsx +0 -53
- package/src/components/Blob/Blob.test.tsx +0 -18
- package/src/components/Blob/Blob.tsx +0 -26
- package/src/components/Blob/__snapshots__/Blob.test.tsx.snap +0 -80
- package/src/components/BlockedMemoriBadge/BlockedMemoriBadge.css +0 -40
- package/src/components/BlockedMemoriBadge/BlockedMemoriBadge.stories.tsx +0 -58
- package/src/components/BlockedMemoriBadge/BlockedMemoriBadge.test.tsx +0 -53
- package/src/components/BlockedMemoriBadge/BlockedMemoriBadge.tsx +0 -74
- package/src/components/BlockedMemoriBadge/__snapshots__/BlockedMemoriBadge.test.tsx.snap +0 -181
- package/src/components/ChangeMode/ChangeMode.css +0 -22
- package/src/components/ChangeMode/ChangeMode.stories.tsx +0 -50
- package/src/components/ChangeMode/ChangeMode.test.tsx +0 -24
- package/src/components/ChangeMode/ChangeMode.tsx +0 -51
- package/src/components/ChangeMode/__snapshots__/ChangeMode.test.tsx.snap +0 -107
- package/src/components/Chat/Chat.css +0 -285
- package/src/components/Chat/Chat.stories.tsx +0 -1684
- package/src/components/Chat/Chat.test.tsx +0 -372
- package/src/components/Chat/Chat.tsx +0 -778
- package/src/components/Chat/__snapshots__/Chat.test.tsx.snap +0 -6816
- package/src/components/ChatBubble/ChatBubble.css +0 -430
- package/src/components/ChatBubble/ChatBubble.stories.tsx +0 -1192
- package/src/components/ChatBubble/ChatBubble.test.tsx +0 -481
- package/src/components/ChatBubble/ChatBubble.tsx +0 -776
- package/src/components/ChatBubble/__snapshots__/ChatBubble.test.tsx.snap +0 -8734
- package/src/components/ChatHistoryDrawer/ChatHistory.css +0 -587
- package/src/components/ChatHistoryDrawer/ChatHistory.stories.tsx +0 -410
- package/src/components/ChatHistoryDrawer/ChatHistory.test.tsx +0 -107
- package/src/components/ChatHistoryDrawer/ChatHistory.tsx +0 -1298
- package/src/components/ChatHistoryDrawer/__snapshots__/ChatHistory.test.tsx.snap +0 -27
- package/src/components/ChatInputs/ChatInputs.css +0 -340
- package/src/components/ChatInputs/ChatInputs.stories.tsx +0 -251
- package/src/components/ChatInputs/ChatInputs.tsx +0 -487
- package/src/components/ChatTextArea/ChatTextArea.css +0 -185
- package/src/components/ChatTextArea/ChatTextArea.stories.tsx +0 -55
- package/src/components/ChatTextArea/ChatTextArea.test.tsx +0 -28
- package/src/components/ChatTextArea/ChatTextArea.tsx +0 -171
- package/src/components/ChatTextArea/__snapshots__/ChatTextArea.test.tsx.snap +0 -68
- package/src/components/CompletionProviderStatus/CompletionProviderStatus.css +0 -36
- package/src/components/CompletionProviderStatus/CompletionProviderStatus.stories.tsx +0 -296
- package/src/components/CompletionProviderStatus/CompletionProviderStatus.test.tsx +0 -31
- package/src/components/CompletionProviderStatus/CompletionProviderStatus.tsx +0 -232
- package/src/components/CompletionProviderStatus/__snapshots__/CompletionProviderStatus.test.tsx.snap +0 -96
- package/src/components/ContentPreviewModal/ContentPreviewModal.css +0 -128
- package/src/components/ContentPreviewModal/ContentPreviewModal.tsx +0 -67
- package/src/components/ContentPreviewModal/index.ts +0 -2
- package/src/components/CustomGLBModelViewer/ModelViewer.css +0 -11
- package/src/components/CustomGLBModelViewer/ModelViewer.stories.tsx +0 -58
- package/src/components/CustomGLBModelViewer/ModelViewer.test.tsx +0 -13
- package/src/components/CustomGLBModelViewer/ModelViewer.tsx +0 -37
- package/src/components/CustomGLBModelViewer/__snapshots__/ModelViewer.test.tsx.snap +0 -20
- package/src/components/DateSelector/DateSelector.css +0 -158
- package/src/components/DateSelector/DateSelector.stories.tsx +0 -47
- package/src/components/DateSelector/DateSelector.test.tsx +0 -149
- package/src/components/DateSelector/DateSelector.tsx +0 -251
- package/src/components/DateSelector/__snapshots__/DateSelector.test.tsx.snap +0 -1954
- package/src/components/ErrorBoundary/ErrorBoundary.tsx +0 -54
- package/src/components/ExpertsDrawer/ExpertsDrawer.css +0 -67
- package/src/components/ExpertsDrawer/ExpertsDrawer.stories.tsx +0 -54
- package/src/components/ExpertsDrawer/ExpertsDrawer.test.tsx +0 -53
- package/src/components/ExpertsDrawer/ExpertsDrawer.tsx +0 -69
- package/src/components/ExpertsDrawer/__snapshots__/ExpertsDrawer.test.tsx.snap +0 -11
- package/src/components/ExportHistoryButton/ExportHistoryButton.css +0 -22
- package/src/components/FeedbackButtons/FeedbackButtons.css +0 -107
- package/src/components/FeedbackButtons/FeedbackButtons.stories.tsx +0 -52
- package/src/components/FeedbackButtons/FeedbackButtons.test.tsx +0 -11
- package/src/components/FeedbackButtons/FeedbackButtons.tsx +0 -152
- package/src/components/FeedbackButtons/__snapshots__/FeedbackButtons.test.tsx.snap +0 -42
- package/src/components/FilePreview/FilePreview.css +0 -358
- package/src/components/FilePreview/FilePreview.stories.tsx +0 -63
- package/src/components/FilePreview/FilePreview.test.tsx +0 -26
- package/src/components/FilePreview/FilePreview.tsx +0 -277
- package/src/components/FilePreview/__snapshots__/FilePreview.test.tsx.snap +0 -185
- package/src/components/Header/ChatConsumptionDropdown.test.tsx +0 -117
- package/src/components/Header/ChatConsumptionDropdown.tsx +0 -275
- package/src/components/Header/Header.css +0 -282
- package/src/components/Header/Header.stories.tsx +0 -338
- package/src/components/Header/Header.test.tsx +0 -371
- package/src/components/Header/Header.tsx +0 -442
- package/src/components/Header/__snapshots__/Header.test.tsx.snap +0 -964
- package/src/components/KnownFacts/KnownFacts.css +0 -19
- package/src/components/KnownFacts/KnownFacts.stories.tsx +0 -80
- package/src/components/KnownFacts/KnownFacts.test.tsx +0 -57
- package/src/components/KnownFacts/KnownFacts.tsx +0 -376
- package/src/components/KnownFacts/__snapshots__/KnownFacts.test.tsx.snap +0 -19
- package/src/components/LoginDrawer/LoginDrawer.css +0 -1616
- package/src/components/LoginDrawer/LoginDrawer.stories.tsx +0 -102
- package/src/components/LoginDrawer/LoginDrawer.test.tsx +0 -199
- package/src/components/LoginDrawer/LoginDrawer.tsx +0 -600
- package/src/components/LoginDrawer/__snapshots__/LoginDrawer.test.tsx.snap +0 -91
- package/src/components/MediaWidget/DocumentCard.test.tsx +0 -45
- package/src/components/MediaWidget/DocumentCard.tsx +0 -19
- package/src/components/MediaWidget/MediaItemWidget.css +0 -1398
- package/src/components/MediaWidget/MediaItemWidget.stories.tsx +0 -423
- package/src/components/MediaWidget/MediaItemWidget.test.tsx +0 -248
- package/src/components/MediaWidget/MediaItemWidget.tsx +0 -997
- package/src/components/MediaWidget/MediaItemWidget.types.ts +0 -65
- package/src/components/MediaWidget/MediaItemWidget.utils.test.ts +0 -367
- package/src/components/MediaWidget/MediaItemWidget.utils.ts +0 -227
- package/src/components/MediaWidget/MediaPreviewModal.test.tsx +0 -271
- package/src/components/MediaWidget/MediaPreviewModal.tsx +0 -425
- package/src/components/MediaWidget/MediaWidget.css +0 -131
- package/src/components/MediaWidget/MediaWidget.stories.tsx +0 -319
- package/src/components/MediaWidget/MediaWidget.test.tsx +0 -41
- package/src/components/MediaWidget/MediaWidget.tsx +0 -107
- package/src/components/MediaWidget/__snapshots__/DocumentCard.test.tsx.snap +0 -24
- package/src/components/MediaWidget/__snapshots__/MediaItemWidget.test.tsx.snap +0 -791
- package/src/components/MediaWidget/__snapshots__/MediaWidget.test.tsx.snap +0 -154
- package/src/components/MemoriArtifactSystem/ArtifactDrawer.stories.tsx +0 -2299
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.css +0 -163
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.tsx +0 -250
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/CopyButton.stories.tsx +0 -30
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/components/CopyButtonWithDropdown.tsx +0 -467
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/components/CopyMenuItem.tsx +0 -89
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/hooks/useCopyArtifact.ts +0 -619
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/index.ts +0 -9
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/styles.css +0 -489
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/test/CopyButtonTest.tsx +0 -90
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/types.ts +0 -73
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/utils/PDFExporter.ts +0 -454
- package/src/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.css +0 -1059
- package/src/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.tsx +0 -431
- package/src/components/MemoriArtifactSystem/components/ArtifactDrawer/components/TabSwitch.css +0 -150
- package/src/components/MemoriArtifactSystem/components/ArtifactDrawer/components/TabSwitch.tsx +0 -79
- package/src/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.css +0 -253
- package/src/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.tsx +0 -561
- package/src/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.css +0 -355
- package/src/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.tsx +0 -160
- package/src/components/MemoriArtifactSystem/context/ArtifactContext.tsx +0 -167
- package/src/components/MemoriArtifactSystem/types/artifact.types.ts +0 -35
- package/src/components/MemoriArtifactSystem/utils/ArtifactAPI.test.tsx +0 -308
- package/src/components/MemoriArtifactSystem/utils/ArtifactAPI.tsx +0 -379
- package/src/components/MemoriArtifactSystem/utils/applyEdits.test.ts +0 -85
- package/src/components/MemoriArtifactSystem/utils/applyEdits.ts +0 -173
- package/src/components/MemoriWidget/MemoriWidget.css +0 -220
- package/src/components/MemoriWidget/MemoriWidget.stories.tsx +0 -274
- package/src/components/MemoriWidget/MemoriWidget.tsx +0 -3930
- package/src/components/MicrophoneButton/MicrophoneButton.css +0 -142
- package/src/components/MicrophoneButton/MicrophoneButton.stories.tsx +0 -52
- package/src/components/MicrophoneButton/MicrophoneButton.tsx +0 -128
- package/src/components/PositionDrawer/PositionDrawer.stories.tsx +0 -51
- package/src/components/PositionDrawer/PositionDrawer.test.tsx +0 -39
- package/src/components/PositionDrawer/PositionDrawer.tsx +0 -50
- package/src/components/PositionDrawer/__snapshots__/PositionDrawer.test.tsx.snap +0 -17
- package/src/components/PoweredBy/PoweredBy.css +0 -47
- package/src/components/PoweredBy/PoweredBy.stories.tsx +0 -75
- package/src/components/PoweredBy/PoweredBy.test.tsx +0 -15
- package/src/components/PoweredBy/PoweredBy.tsx +0 -44
- package/src/components/PoweredBy/__snapshots__/PoweredBy.test.tsx.snap +0 -55
- package/src/components/SendOnEnterMenu/SendOnEnterMenu.css +0 -47
- package/src/components/SendOnEnterMenu/SendOnEnterMenu.stories.tsx +0 -58
- package/src/components/SendOnEnterMenu/SendOnEnterMenu.test.tsx +0 -17
- package/src/components/SendOnEnterMenu/SendOnEnterMenu.tsx +0 -82
- package/src/components/SendOnEnterMenu/__snapshots__/SendOnEnterMenu.test.tsx.snap +0 -57
- package/src/components/SettingsDrawer/SettingsDrawer.css +0 -24
- package/src/components/SettingsDrawer/SettingsDrawer.stories.tsx +0 -94
- package/src/components/SettingsDrawer/SettingsDrawer.test.tsx +0 -202
- package/src/components/SettingsDrawer/SettingsDrawer.tsx +0 -255
- package/src/components/SettingsDrawer/__snapshots__/SettingsDrawer.test.tsx.snap +0 -59
- package/src/components/ShareButton/ShareButton.css +0 -73
- package/src/components/ShareButton/ShareButton.stories.tsx +0 -98
- package/src/components/ShareButton/ShareButton.test.tsx +0 -53
- package/src/components/ShareButton/ShareButton.tsx +0 -395
- package/src/components/ShareButton/__snapshots__/ShareButton.test.tsx.snap +0 -316
- package/src/components/Snippet/Snippet.css +0 -142
- package/src/components/Snippet/Snippet.stories.tsx +0 -286
- package/src/components/Snippet/Snippet.test.tsx +0 -176
- package/src/components/Snippet/Snippet.tsx +0 -148
- package/src/components/Snippet/__snapshots__/Snippet.test.tsx.snap +0 -603
- package/src/components/StartPanel/StartPanel.css +0 -273
- package/src/components/StartPanel/StartPanel.stories.tsx +0 -404
- package/src/components/StartPanel/StartPanel.test.tsx +0 -360
- package/src/components/StartPanel/StartPanel.tsx +0 -426
- package/src/components/StartPanel/__snapshots__/StartPanel.test.tsx.snap +0 -1986
- package/src/components/Typing/Typing.stories.tsx +0 -130
- package/src/components/Typing/Typing.test.tsx +0 -62
- package/src/components/Typing/Typing.tsx +0 -154
- package/src/components/Typing/__snapshots__/Typing.test.tsx.snap +0 -133
- package/src/components/UploadButton/UploadButton.css +0 -542
- package/src/components/UploadButton/UploadButton.stories.tsx +0 -376
- package/src/components/UploadButton/UploadButton.test.tsx +0 -11
- package/src/components/UploadButton/UploadButton.tsx +0 -688
- package/src/components/UploadButton/UploadDocuments/UploadDocuments.tsx +0 -421
- package/src/components/UploadButton/UploadImages/UploadImages.tsx +0 -538
- package/src/components/UploadButton/__snapshots__/UploadButton.test.tsx.snap +0 -165
- package/src/components/VenueWidget/VenueWidget.css +0 -163
- package/src/components/VenueWidget/VenueWidget.stories.tsx +0 -66
- package/src/components/VenueWidget/VenueWidget.test.tsx +0 -49
- package/src/components/VenueWidget/VenueWidget.tsx +0 -458
- package/src/components/VenueWidget/__snapshots__/VenueWidget.test.tsx.snap +0 -370
- package/src/components/WhyThisAnswer/WhyThisAnswer.css +0 -171
- package/src/components/WhyThisAnswer/WhyThisAnswer.stories.tsx +0 -285
- package/src/components/WhyThisAnswer/WhyThisAnswer.test.tsx +0 -245
- package/src/components/WhyThisAnswer/WhyThisAnswer.tsx +0 -233
- package/src/components/WhyThisAnswer/__snapshots__/WhyThisAnswer.test.tsx.snap +0 -27
- package/src/components/icons/AI.tsx +0 -34
- package/src/components/icons/Alert.tsx +0 -31
- package/src/components/icons/ArrowUp.tsx +0 -28
- package/src/components/icons/Bug.tsx +0 -81
- package/src/components/icons/Chat.tsx +0 -30
- package/src/components/icons/ChevronDown.tsx +0 -26
- package/src/components/icons/ChevronLeft.tsx +0 -28
- package/src/components/icons/ChevronRight.tsx +0 -28
- package/src/components/icons/ChevronUp.tsx +0 -24
- package/src/components/icons/Clear.tsx +0 -23
- package/src/components/icons/Close.tsx +0 -30
- package/src/components/icons/Code.tsx +0 -24
- package/src/components/icons/Copy.tsx +0 -23
- package/src/components/icons/DeepThought.tsx +0 -38
- package/src/components/icons/Delete.tsx +0 -23
- package/src/components/icons/Document.tsx +0 -50
- package/src/components/icons/Download.tsx +0 -23
- package/src/components/icons/Edit.tsx +0 -17
- package/src/components/icons/Expand.tsx +0 -23
- package/src/components/icons/Eye.tsx +0 -17
- package/src/components/icons/EyeInvisible.tsx +0 -24
- package/src/components/icons/Facebook.tsx +0 -23
- package/src/components/icons/Feedback.tsx +0 -24
- package/src/components/icons/File.tsx +0 -17
- package/src/components/icons/FileExcel.tsx +0 -23
- package/src/components/icons/FilePdf.tsx +0 -23
- package/src/components/icons/FileWord.tsx +0 -23
- package/src/components/icons/Fullscreen.tsx +0 -23
- package/src/components/icons/FullscreenExit.tsx +0 -23
- package/src/components/icons/GasStation.tsx +0 -36
- package/src/components/icons/Group.tsx +0 -30
- package/src/components/icons/History.tsx +0 -33
- package/src/components/icons/Image.tsx +0 -37
- package/src/components/icons/Info.tsx +0 -31
- package/src/components/icons/Link.tsx +0 -17
- package/src/components/icons/Linkedin.tsx +0 -23
- package/src/components/icons/Loading.tsx +0 -28
- package/src/components/icons/Logout.tsx +0 -27
- package/src/components/icons/Mail.tsx +0 -17
- package/src/components/icons/MapMarker.tsx +0 -26
- package/src/components/icons/MenuHorizontal.tsx +0 -29
- package/src/components/icons/MenuVertical.tsx +0 -29
- package/src/components/icons/Message.tsx +0 -23
- package/src/components/icons/Microphone.tsx +0 -23
- package/src/components/icons/Minus.tsx +0 -23
- package/src/components/icons/MinusCircle.tsx +0 -24
- package/src/components/icons/PaperClip.tsx +0 -23
- package/src/components/icons/Picture.tsx +0 -23
- package/src/components/icons/Plus.tsx +0 -18
- package/src/components/icons/Preview.tsx +0 -29
- package/src/components/icons/Print.tsx +0 -38
- package/src/components/icons/QuestionHelp.tsx +0 -30
- package/src/components/icons/Refresh.tsx +0 -30
- package/src/components/icons/SelectIcon.tsx +0 -28
- package/src/components/icons/Send.tsx +0 -17
- package/src/components/icons/Setting.tsx +0 -23
- package/src/components/icons/Share.tsx +0 -23
- package/src/components/icons/Sound.tsx +0 -23
- package/src/components/icons/SoundDeactivated.tsx +0 -27
- package/src/components/icons/Telegram.tsx +0 -26
- package/src/components/icons/ThumbDown.tsx +0 -29
- package/src/components/icons/ThumbUp.tsx +0 -29
- package/src/components/icons/Translation.tsx +0 -24
- package/src/components/icons/Twitter.tsx +0 -23
- package/src/components/icons/Upload.tsx +0 -34
- package/src/components/icons/User.tsx +0 -17
- package/src/components/icons/Warning.tsx +0 -24
- package/src/components/icons/WhatsApp.tsx +0 -24
- package/src/components/icons/icons.stories.css +0 -5
- package/src/components/icons/icons.stories.tsx +0 -81
- package/src/components/icons/loading.css +0 -14
- package/src/components/layouts/Chat.test.tsx +0 -40
- package/src/components/layouts/Chat.tsx +0 -69
- package/src/components/layouts/FullBody/FullBody.stories.tsx +0 -110
- package/src/components/layouts/FullPage.test.tsx +0 -65
- package/src/components/layouts/FullPage.tsx +0 -80
- package/src/components/layouts/HiddenChat.test.tsx +0 -40
- package/src/components/layouts/HiddenChat.tsx +0 -233
- package/src/components/layouts/Totem/Totem.stories.tsx +0 -131
- package/src/components/layouts/Totem.test.tsx +0 -40
- package/src/components/layouts/Totem.tsx +0 -49
- package/src/components/layouts/WebsiteAssistant.test.tsx +0 -40
- package/src/components/layouts/WebsiteAssistant.tsx +0 -132
- package/src/components/layouts/ZoomedFullBody/ZoomedFullBody.stories.tsx +0 -131
- package/src/components/layouts/ZoomedFullBody.test.tsx +0 -40
- package/src/components/layouts/ZoomedFullBody.tsx +0 -81
- package/src/components/layouts/__snapshots__/Chat.test.tsx.snap +0 -457
- package/src/components/layouts/__snapshots__/FullPage.test.tsx.snap +0 -1045
- package/src/components/layouts/__snapshots__/HiddenChat.test.tsx.snap +0 -460
- package/src/components/layouts/__snapshots__/Totem.test.tsx.snap +0 -566
- package/src/components/layouts/__snapshots__/WebsiteAssistant.test.tsx.snap +0 -59
- package/src/components/layouts/__snapshots__/ZoomedFullBody.test.tsx.snap +0 -523
- package/src/components/layouts/chat.css +0 -451
- package/src/components/layouts/hidden-chat.css +0 -276
- package/src/components/layouts/layouts.stories.tsx +0 -231
- package/src/components/layouts/totem.css +0 -221
- package/src/components/layouts/website-assistant.css +0 -677
- package/src/components/layouts/zoomed-full-body.css +0 -18
- package/src/components/ui/Alert.css +0 -93
- package/src/components/ui/Alert.stories.tsx +0 -137
- package/src/components/ui/Alert.test.tsx +0 -129
- package/src/components/ui/Alert.tsx +0 -123
- package/src/components/ui/Button.css +0 -167
- package/src/components/ui/Button.stories.tsx +0 -156
- package/src/components/ui/Button.test.tsx +0 -74
- package/src/components/ui/Button.tsx +0 -107
- package/src/components/ui/Card.css +0 -65
- package/src/components/ui/Card.stories.tsx +0 -95
- package/src/components/ui/Card.test.tsx +0 -47
- package/src/components/ui/Card.tsx +0 -48
- package/src/components/ui/Checkbox.css +0 -116
- package/src/components/ui/Checkbox.stories.tsx +0 -74
- package/src/components/ui/Checkbox.test.tsx +0 -28
- package/src/components/ui/Checkbox.tsx +0 -58
- package/src/components/ui/ConfirmDialog.css +0 -42
- package/src/components/ui/ConfirmDialog.stories.tsx +0 -216
- package/src/components/ui/ConfirmDialog.test.tsx +0 -124
- package/src/components/ui/ConfirmDialog.tsx +0 -58
- package/src/components/ui/Details.css +0 -66
- package/src/components/ui/Drawer.css +0 -270
- package/src/components/ui/Drawer.stories.tsx +0 -267
- package/src/components/ui/Drawer.test.tsx +0 -130
- package/src/components/ui/Drawer.tsx +0 -293
- package/src/components/ui/Dropdown.css +0 -173
- package/src/components/ui/Dropdown.tsx +0 -63
- package/src/components/ui/Expandable.css +0 -15
- package/src/components/ui/Expandable.stories.tsx +0 -180
- package/src/components/ui/Expandable.test.tsx +0 -107
- package/src/components/ui/Expandable.tsx +0 -121
- package/src/components/ui/Modal.css +0 -98
- package/src/components/ui/Modal.stories.tsx +0 -171
- package/src/components/ui/Modal.test.tsx +0 -111
- package/src/components/ui/Modal.tsx +0 -117
- package/src/components/ui/Select.css +0 -138
- package/src/components/ui/Select.stories.tsx +0 -79
- package/src/components/ui/Select.test.tsx +0 -84
- package/src/components/ui/Select.tsx +0 -79
- package/src/components/ui/Slider.css +0 -192
- package/src/components/ui/Slider.stories.tsx +0 -63
- package/src/components/ui/Slider.tsx +0 -142
- package/src/components/ui/Spin.css +0 -31
- package/src/components/ui/Spin.stories.tsx +0 -64
- package/src/components/ui/Spin.test.tsx +0 -41
- package/src/components/ui/Spin.tsx +0 -31
- package/src/components/ui/Table.css +0 -132
- package/src/components/ui/Tooltip.css +0 -171
- package/src/components/ui/Tooltip.stories.tsx +0 -109
- package/src/components/ui/Tooltip.test.tsx +0 -102
- package/src/components/ui/Tooltip.tsx +0 -163
- package/src/components/ui/__snapshots__/Alert.test.tsx.snap +0 -59
- package/src/components/ui/__snapshots__/Button.test.tsx.snap +0 -204
- package/src/components/ui/__snapshots__/Card.test.tsx.snap +0 -321
- package/src/components/ui/__snapshots__/Checkbox.test.tsx.snap +0 -131
- package/src/components/ui/__snapshots__/ConfirmDialog.test.tsx.snap +0 -35
- package/src/components/ui/__snapshots__/Drawer.test.tsx.snap +0 -67
- package/src/components/ui/__snapshots__/Expandable.test.tsx.snap +0 -159
- package/src/components/ui/__snapshots__/Modal.test.tsx.snap +0 -59
- package/src/components/ui/__snapshots__/Select.test.tsx.snap +0 -254
- package/src/components/ui/__snapshots__/Spin.test.tsx.snap +0 -193
- package/src/components/ui/__snapshots__/Tooltip.test.tsx.snap +0 -113
- package/src/components/ui/definitions.stories.tsx +0 -139
- package/src/context/visemeContext.tsx +0 -384
- package/src/helpers/chatPdfExport.ts +0 -544
- package/src/helpers/configuration.ts +0 -42
- package/src/helpers/constants.ts +0 -268
- package/src/helpers/convertDocument.test.ts +0 -67
- package/src/helpers/convertDocument.ts +0 -35
- package/src/helpers/credits.ts +0 -54
- package/src/helpers/error.test.ts +0 -29
- package/src/helpers/error.ts +0 -278
- package/src/helpers/imageCompression.ts +0 -230
- package/src/helpers/llmUsage.ts +0 -328
- package/src/helpers/markedExtendedTables.js +0 -217
- package/src/helpers/media.test.ts +0 -169
- package/src/helpers/media.ts +0 -81
- package/src/helpers/message.test.ts +0 -126
- package/src/helpers/message.ts +0 -219
- package/src/helpers/nats/getNatsConfig.ts +0 -148
- package/src/helpers/nats/isSessionExpiredError.test.ts +0 -38
- package/src/helpers/nats/isSessionExpiredError.ts +0 -51
- package/src/helpers/nats/useNats.test.tsx +0 -81
- package/src/helpers/nats/useNats.ts +0 -204
- package/src/helpers/nats/useNatsSession.test.ts +0 -16
- package/src/helpers/nats/useNatsSession.ts +0 -460
- package/src/helpers/piiDetection.test.ts +0 -186
- package/src/helpers/piiDetection.ts +0 -91
- package/src/helpers/sanitizer.ts +0 -17
- package/src/helpers/statistics.ts +0 -58
- package/src/helpers/stt/useSTT.ts +0 -515
- package/src/helpers/translations.ts +0 -39
- package/src/helpers/tts/ttsVoiceUtility.ts +0 -275
- package/src/helpers/tts/useTTS.ts +0 -621
- package/src/helpers/utils.test.ts +0 -331
- package/src/helpers/utils.ts +0 -591
- package/src/helpers/venue.ts +0 -36
- package/src/i18n.ts +0 -39
- package/src/index.stories.tsx +0 -220
- package/src/index.test.tsx +0 -156
- package/src/index.tsx +0 -592
- package/src/locales/de.json +0 -680
- package/src/locales/en.json +0 -754
- package/src/locales/es.json +0 -682
- package/src/locales/fr.json +0 -682
- package/src/locales/it.json +0 -750
- package/src/mocks/data.ts +0 -790
- package/src/styles.css +0 -126
- package/src/types/integration.test.ts +0 -32
- package/src/types/integration.ts +0 -31
- package/src/types/layout.ts +0 -50
- package/src/version.ts +0 -2
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
import { getResourceUrl } from './media';
|
|
2
|
-
|
|
3
|
-
const tenantID = 'app.memorytwin.com';
|
|
4
|
-
const sessionID = 'e995ac6f-8014-4ac0-9992-60fe87ae8b44';
|
|
5
|
-
const mediumID = 'a196b513-d745-4121-8913-8f457b999add';
|
|
6
|
-
|
|
7
|
-
describe('Media URL helper', () => {
|
|
8
|
-
it('Get default avatar URL with no url', async () => {
|
|
9
|
-
expect(
|
|
10
|
-
getResourceUrl({
|
|
11
|
-
type: 'avatar',
|
|
12
|
-
baseURL: 'https://twin.memori.ai',
|
|
13
|
-
apiURL: 'https://backend.memori.ai/api/v2',
|
|
14
|
-
})
|
|
15
|
-
).toBe('https://twin.memori.ai/images/memoriAvatar.png?v=20231208');
|
|
16
|
-
});
|
|
17
|
-
it('Get default cover URL with no url', async () => {
|
|
18
|
-
expect(
|
|
19
|
-
getResourceUrl({
|
|
20
|
-
type: 'cover',
|
|
21
|
-
apiURL: 'https://backend.memori.ai/api/v2',
|
|
22
|
-
baseURL: 'https://twin.memori.ai',
|
|
23
|
-
})
|
|
24
|
-
).toBe('https://twin.memori.ai/images/memoriCover.png');
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it('Get correct URL for media', async () => {
|
|
28
|
-
expect(
|
|
29
|
-
getResourceUrl({
|
|
30
|
-
resourceURI:
|
|
31
|
-
'https://assets.memori.ai/api/v2/asset/0eed819c-b496-4419-a9a3-aacbe949bb7c.jpeg/',
|
|
32
|
-
sessionID: sessionID,
|
|
33
|
-
apiURL: 'https://backend.memori.ai/api/v2',
|
|
34
|
-
})
|
|
35
|
-
).toBe(
|
|
36
|
-
`https://assets.memori.ai/api/v2/asset/0eed819c-b496-4419-a9a3-aacbe949bb7c.jpeg/${sessionID}`
|
|
37
|
-
);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it('Get correct URL for external media', async () => {
|
|
41
|
-
expect(
|
|
42
|
-
getResourceUrl({
|
|
43
|
-
resourceURI:
|
|
44
|
-
'https://api.lorem.space/image/game?w=150&h=220&hash=8B7BCDC2',
|
|
45
|
-
apiURL: 'https://backend.memori.ai/api/v2',
|
|
46
|
-
sessionID: sessionID,
|
|
47
|
-
})
|
|
48
|
-
).toBe('https://api.lorem.space/image/game?w=150&h=220&hash=8B7BCDC2');
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
it('appends session ID for aisuru.ai asset URLs', () => {
|
|
52
|
-
expect(
|
|
53
|
-
getResourceUrl({
|
|
54
|
-
resourceURI:
|
|
55
|
-
'https://backend-ws-bologna.aisuru.ai/api/v2/asset/ad10ce11-914b-4b9b-a033-ba06cb4b4042.pdf',
|
|
56
|
-
sessionID: sessionID,
|
|
57
|
-
})
|
|
58
|
-
).toBe(
|
|
59
|
-
`https://backend-ws-bologna.aisuru.ai/api/v2/asset/ad10ce11-914b-4b9b-a033-ba06cb4b4042.pdf/${sessionID}`
|
|
60
|
-
);
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
it('appends session ID for /api/v2/asset/ paths on unknown hosts', () => {
|
|
64
|
-
expect(
|
|
65
|
-
getResourceUrl({
|
|
66
|
-
resourceURI:
|
|
67
|
-
'https://custom-backend.example.com/api/v2/asset/abc123.pdf',
|
|
68
|
-
sessionID: sessionID,
|
|
69
|
-
})
|
|
70
|
-
).toBe(
|
|
71
|
-
`https://custom-backend.example.com/api/v2/asset/abc123.pdf/${sessionID}`
|
|
72
|
-
);
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
it('appends session ID when resource host matches apiURL host', () => {
|
|
76
|
-
expect(
|
|
77
|
-
getResourceUrl({
|
|
78
|
-
resourceURI: 'https://my-api.example.com/files/doc.pdf',
|
|
79
|
-
sessionID: sessionID,
|
|
80
|
-
apiURL: 'https://my-api.example.com/api/v2',
|
|
81
|
-
})
|
|
82
|
-
).toBe(`https://my-api.example.com/files/doc.pdf/${sessionID}`);
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
it('Get correct URL for old memoriai/memory media', async () => {
|
|
87
|
-
expect(
|
|
88
|
-
getResourceUrl({
|
|
89
|
-
resourceURI:
|
|
90
|
-
'https://backend.memori.ai/api/v1/memoriai/memory/2d434f42-3e95-46ad-9bd5-a10b65977407/media/cloud/studio.memori.ai/2f7b56d1-06a2-4908-9dd3-ef30359b5d05.jpeg',
|
|
91
|
-
apiURL: 'https://backend.memori.ai/api/v2',
|
|
92
|
-
sessionID: sessionID,
|
|
93
|
-
})
|
|
94
|
-
).toBe(
|
|
95
|
-
`https://backend.memori.ai/api/v1/memoriai/memory/2d434f42-3e95-46ad-9bd5-a10b65977407/media/cloud/studio.memori.ai/2f7b56d1-06a2-4908-9dd3-ef30359b5d05.jpeg?memori-ai-session-id=${sessionID}`
|
|
96
|
-
);
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
it('Get correct URL for old cloud://tenantID media', async () => {
|
|
100
|
-
expect(
|
|
101
|
-
getResourceUrl({
|
|
102
|
-
// cloud://twin.memori.ai/5fc7cd8b-7c8f-4d92-83ad-f48d04b6aafe.jpeg
|
|
103
|
-
resourceURI: `cloud://${tenantID}/${mediumID}`,
|
|
104
|
-
apiURL: 'https://backend.memori.ai/api/v2',
|
|
105
|
-
sessionID: sessionID,
|
|
106
|
-
tenantID: tenantID,
|
|
107
|
-
})
|
|
108
|
-
).toBe(
|
|
109
|
-
`https://backend.memori.ai/api/v1/CloudAsset/${tenantID}/${mediumID}`
|
|
110
|
-
);
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
it('Get correct URL for old cloud://tenantID media', async () => {
|
|
114
|
-
expect(
|
|
115
|
-
getResourceUrl({
|
|
116
|
-
// cloud://twin.memori.ai/5fc7cd8b-7c8f-4d92-83ad-f48d04b6aafe.jpeg
|
|
117
|
-
resourceURI: `cloud://twin.memori.ai/5fc7cd8b-7c8f-4d92-83ad-f48d04b6aafe.jpeg
|
|
118
|
-
`,
|
|
119
|
-
apiURL: 'https://backend.memori.ai/api/v2',
|
|
120
|
-
sessionID: sessionID,
|
|
121
|
-
tenantID: 'twin.memori.ai',
|
|
122
|
-
})
|
|
123
|
-
).toBe(
|
|
124
|
-
`https://backend.memori.ai/api/v1/CloudAsset/twin.memori.ai/5fc7cd8b-7c8f-4d92-83ad-f48d04b6aafe.jpeg
|
|
125
|
-
`
|
|
126
|
-
);
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
it('Get correct URL for old cloud://tenantID media', async () => {
|
|
130
|
-
expect(
|
|
131
|
-
getResourceUrl({
|
|
132
|
-
resourceURI:
|
|
133
|
-
'cloud://twin.memori.ai/6c30043c-9de1-4d13-87e4-c53adb3f9885.jpg',
|
|
134
|
-
apiURL: 'https://backend.memori.ai/api/v2',
|
|
135
|
-
sessionID: sessionID,
|
|
136
|
-
tenantID: 'twin.memori.ai',
|
|
137
|
-
})
|
|
138
|
-
).toBe(
|
|
139
|
-
`https://backend.memori.ai/api/v1/CloudAsset/twin.memori.ai/6c30043c-9de1-4d13-87e4-c53adb3f9885.jpg`
|
|
140
|
-
);
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
it('Get correct URL for old cloud://tenantID media with old non-existent tenant', async () => {
|
|
144
|
-
expect(
|
|
145
|
-
getResourceUrl({
|
|
146
|
-
// cloud://twin.memori.ai/5fc7cd8b-7c8f-4d92-83ad-f48d04b6aafe.jpeg
|
|
147
|
-
resourceURI: `cloud://twin.memori.ai/5fc7cd8b-7c8f-4d92-83ad-f48d04b6aafe.jpeg
|
|
148
|
-
`,
|
|
149
|
-
apiURL: 'https://backend.memori.ai/api/v2',
|
|
150
|
-
sessionID: sessionID,
|
|
151
|
-
tenantID: 'app.memorytwin.com',
|
|
152
|
-
})
|
|
153
|
-
).toBe(
|
|
154
|
-
`https://backend.memori.ai/api/v1/CloudAsset/twin.memori.ai/5fc7cd8b-7c8f-4d92-83ad-f48d04b6aafe.jpeg
|
|
155
|
-
`
|
|
156
|
-
);
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
it('Get correct URL for old guid://tenant media', async () => {
|
|
160
|
-
expect(
|
|
161
|
-
getResourceUrl({
|
|
162
|
-
resourceURI: `guid://${mediumID}`,
|
|
163
|
-
apiURL: 'https://backend.memori.ai/api/v2',
|
|
164
|
-
sessionID: sessionID,
|
|
165
|
-
tenantID: tenantID,
|
|
166
|
-
})
|
|
167
|
-
).toBe(`https://backend.memori.ai/api/v1/GuidAsset/${mediumID}`);
|
|
168
|
-
});
|
|
169
|
-
});
|
package/src/helpers/media.ts
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
export interface ResourceURLParams {
|
|
2
|
-
type?: 'avatar' | 'cover';
|
|
3
|
-
resourceURI?: string;
|
|
4
|
-
sessionID?: string;
|
|
5
|
-
baseURL?: string;
|
|
6
|
-
apiURL?: string;
|
|
7
|
-
tenantID?: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Whether this HTTP(S) URL should get a session ID appended for auth.
|
|
12
|
-
* Matches Memori asset API paths on any host, known Memori/AIsuru hosts,
|
|
13
|
-
* and the configured API host — instead of a hard hostname allowlist only.
|
|
14
|
-
*/
|
|
15
|
-
const shouldAppendSessionId = (
|
|
16
|
-
resourceURI: string,
|
|
17
|
-
apiURL?: string
|
|
18
|
-
): boolean => {
|
|
19
|
-
const url = new URL(resourceURI);
|
|
20
|
-
const { hostname, pathname } = url;
|
|
21
|
-
|
|
22
|
-
// Memori asset endpoints require session auth regardless of host
|
|
23
|
-
// (e.g. backend-ws-bologna.aisuru.ai/api/v2/asset/…)
|
|
24
|
-
if (/\/api\/v\d+\/asset\//i.test(pathname)) {
|
|
25
|
-
return true;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
if (apiURL) {
|
|
29
|
-
try {
|
|
30
|
-
if (new URL(apiURL).hostname === hostname) {
|
|
31
|
-
return true;
|
|
32
|
-
}
|
|
33
|
-
} catch {
|
|
34
|
-
// ignore invalid apiURL
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return false;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export const getResourceUrl = ({
|
|
42
|
-
type,
|
|
43
|
-
resourceURI,
|
|
44
|
-
sessionID,
|
|
45
|
-
baseURL = '',
|
|
46
|
-
apiURL = '',
|
|
47
|
-
}: ResourceURLParams): string => {
|
|
48
|
-
let defaultUri =
|
|
49
|
-
type === 'cover'
|
|
50
|
-
? `${baseURL}/images/memoriCover.png`
|
|
51
|
-
: `${baseURL}/images/memoriAvatar.png?v=20231208`;
|
|
52
|
-
|
|
53
|
-
try {
|
|
54
|
-
if (!resourceURI || resourceURI.length === 0) {
|
|
55
|
-
return defaultUri;
|
|
56
|
-
} else if (
|
|
57
|
-
resourceURI.includes('memoriai/memory') &&
|
|
58
|
-
!resourceURI.includes('memori-ai-session-id') &&
|
|
59
|
-
sessionID
|
|
60
|
-
) {
|
|
61
|
-
return `${resourceURI}?memori-ai-session-id=${sessionID}`;
|
|
62
|
-
} else if (
|
|
63
|
-
(resourceURI.startsWith('https://') ||
|
|
64
|
-
resourceURI.startsWith('http://')) &&
|
|
65
|
-
shouldAppendSessionId(resourceURI, apiURL)
|
|
66
|
-
) {
|
|
67
|
-
return `${resourceURI}${resourceURI.endsWith('/') || !sessionID ? '' : '/'
|
|
68
|
-
}${sessionID || ''}`;
|
|
69
|
-
} else if (resourceURI.startsWith('cloud://')) {
|
|
70
|
-
return `${apiURL?.replace(/v2/, 'v1') || ''
|
|
71
|
-
}/CloudAsset/${resourceURI.replace('cloud://', '')}`;
|
|
72
|
-
} else if (resourceURI.startsWith('guid://')) {
|
|
73
|
-
return `${apiURL?.replace(/v2/, 'v1') || ''
|
|
74
|
-
}/GuidAsset/${resourceURI.replace('guid://', '')}`;
|
|
75
|
-
} else {
|
|
76
|
-
return resourceURI || defaultUri;
|
|
77
|
-
}
|
|
78
|
-
} catch (e) {
|
|
79
|
-
return resourceURI || defaultUri;
|
|
80
|
-
}
|
|
81
|
-
};
|
|
@@ -1,126 +0,0 @@
|
|
|
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
|
-
});
|
|
22
|
-
|
|
23
|
-
describe('renderMsg', () => {
|
|
24
|
-
it('should render message with reasoning and output tag adjacent correctly', () => {
|
|
25
|
-
const problematicText =
|
|
26
|
-
'<think>L\'utente vuole che io elenchi i parametri dell\'ALBERO ESISTENTE.</think>\n\n<output class="rails-query" style="display:none">\nproject = Project.find("68d99b05783713e16737d32b")\n</output>\n\nRecupero tutti i 7 parametri dell\'ALBERO ESISTENTE...';
|
|
27
|
-
|
|
28
|
-
const result = renderMsg(problematicText, false, 'Reasoning...', true);
|
|
29
|
-
|
|
30
|
-
expect(result.text).toBe(
|
|
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>'
|
|
32
|
-
);
|
|
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
|
-
});
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
describe('stripAttachmentTags', () => {
|
|
44
|
-
it('strips <document_attachment> tags', () => {
|
|
45
|
-
const input = 'hello <document_attachment filename="note.md" type="text/markdown">some content</document_attachment> world';
|
|
46
|
-
expect(stripAttachmentTags(input)).toBe('hello world');
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
it('strips <attachment_source> tags', () => {
|
|
50
|
-
const input = 'before <attachment_source>\nhttps://example.com/file.txt\n</attachment_source> after';
|
|
51
|
-
expect(stripAttachmentTags(input)).toBe('before after');
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
it('strips <attachment_link> tags', () => {
|
|
55
|
-
const input = 'before <attachment_link>\nhttps://example.com/file.txt\n</attachment_link> after';
|
|
56
|
-
expect(stripAttachmentTags(input)).toBe('before after');
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
it('returns the same string when no tags are present', () => {
|
|
60
|
-
expect(stripAttachmentTags('plain text')).toBe('plain text');
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
describe('stripAllInternalTags', () => {
|
|
65
|
-
it('strips <document> wrapper tags', () => {
|
|
66
|
-
expect(stripAllInternalTags('<document name="a.pdf">inner</document>'))
|
|
67
|
-
.toBe('inner');
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
it('strips <documents> wrapper tags', () => {
|
|
71
|
-
expect(stripAllInternalTags('<documents>inner</documents>'))
|
|
72
|
-
.toBe('inner');
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
it('strips <attachment> wrapper tags', () => {
|
|
76
|
-
expect(stripAllInternalTags('<attachment name="file.txt">inner</attachment>'))
|
|
77
|
-
.toBe('inner');
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
it('strips <attachments> wrapper tags', () => {
|
|
81
|
-
expect(stripAllInternalTags('<attachments>inner</attachments>'))
|
|
82
|
-
.toBe('inner');
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
it('strips self-closing document tags', () => {
|
|
86
|
-
expect(stripAllInternalTags('before <document src="x" /> after'))
|
|
87
|
-
.toBe('before after');
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
it('strips asset URLs', () => {
|
|
91
|
-
const input = 'hello\n\nhttps://assets-staging.memori.ai/api/v2/asset/abc-123.md\n\nworld';
|
|
92
|
-
expect(stripAllInternalTags(input)).toBe('hello\n\nworld');
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
it('strips multiple asset URLs on separate lines', () => {
|
|
96
|
-
const input = 'content\n\nhttps://assets-staging.memori.ai/api/v2/asset/abc.md\n\nhttps://assets-staging.memori.ai/api/v2/asset/def.txt';
|
|
97
|
-
expect(stripAllInternalTags(input)).toBe('content');
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
it('strips all tag types and asset URLs combined', () => {
|
|
101
|
-
const input = [
|
|
102
|
-
'<documents>',
|
|
103
|
-
'<document name="note.md">',
|
|
104
|
-
'User question here',
|
|
105
|
-
'</document>',
|
|
106
|
-
'</documents>',
|
|
107
|
-
'<attachment_source>https://example.com/source</attachment_source>',
|
|
108
|
-
'<attachment_link>https://example.com/link</attachment_link>',
|
|
109
|
-
'https://assets-staging.memori.ai/api/v2/asset/file.md',
|
|
110
|
-
].join('\n');
|
|
111
|
-
expect(stripAllInternalTags(input)).toBe('User question here');
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
it('collapses excessive blank lines after stripping', () => {
|
|
115
|
-
const input = 'hello\n\n\n\n\nworld';
|
|
116
|
-
expect(stripAllInternalTags(input)).toBe('hello\n\nworld');
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
it('returns empty string for input that is only tags', () => {
|
|
120
|
-
expect(stripAllInternalTags('<documents></documents>')).toBe('');
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
it('handles empty string', () => {
|
|
124
|
-
expect(stripAllInternalTags('')).toBe('');
|
|
125
|
-
});
|
|
126
|
-
});
|
package/src/helpers/message.ts
DELETED
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
import { marked } from 'marked';
|
|
2
|
-
import DOMPurify from 'dompurify';
|
|
3
|
-
import { MAX_MSG_CHARS, MAX_MSG_WORDS } from './constants';
|
|
4
|
-
import { cleanUrl } from './utils';
|
|
5
|
-
import markedLinkifyIt from 'marked-linkify-it';
|
|
6
|
-
import markedKatex from 'marked-katex-extension';
|
|
7
|
-
import markedExtendedTables from './markedExtendedTables';
|
|
8
|
-
|
|
9
|
-
// Always configure marked with necessary extensions
|
|
10
|
-
marked.use({
|
|
11
|
-
async: false,
|
|
12
|
-
gfm: true,
|
|
13
|
-
pedantic: false,
|
|
14
|
-
renderer: {
|
|
15
|
-
link: ({
|
|
16
|
-
href,
|
|
17
|
-
title,
|
|
18
|
-
text,
|
|
19
|
-
}: {
|
|
20
|
-
href: string | null;
|
|
21
|
-
title?: string | null;
|
|
22
|
-
text: string;
|
|
23
|
-
}) => {
|
|
24
|
-
const cleanHref = href ? cleanUrl(href) : null;
|
|
25
|
-
|
|
26
|
-
if (cleanHref === null) {
|
|
27
|
-
return text;
|
|
28
|
-
}
|
|
29
|
-
href = cleanHref;
|
|
30
|
-
let out = '<a href="' + href + '"';
|
|
31
|
-
if (title) {
|
|
32
|
-
out += ' title="' + title + '"';
|
|
33
|
-
}
|
|
34
|
-
out += ' target="_blank" rel="noopener noreferrer">' + text + '</a>';
|
|
35
|
-
return out;
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
marked.use(markedLinkifyIt());
|
|
41
|
-
marked.use(markedExtendedTables());
|
|
42
|
-
|
|
43
|
-
export const stripAttachmentTags = (value: string) =>
|
|
44
|
-
value
|
|
45
|
-
.replaceAll(
|
|
46
|
-
/<document_attachment filename="([^"]+)" type="([^"]+)">([\s\S]*?)<\/document_attachment>/g,
|
|
47
|
-
''
|
|
48
|
-
)
|
|
49
|
-
.replaceAll(/<attachment_source>\s*[\s\S]*?\s*<\/attachment_source>/g, '')
|
|
50
|
-
.replaceAll(/<attachment_link>\s*[\s\S]*?\s*<\/attachment_link>/g, '');
|
|
51
|
-
|
|
52
|
-
const ASSET_URL_RE = /https?:\/\/\S*\/api\/v\d+\/asset\/\S+/gi;
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Strips all internal document/attachment wrapper tags AND bare asset URLs.
|
|
56
|
-
* Use this for any user-facing text output (copy, export, tooltips, etc.).
|
|
57
|
-
*/
|
|
58
|
-
export const stripAllInternalTags = (value: string) =>
|
|
59
|
-
stripAttachmentTags(value)
|
|
60
|
-
.replace(/<\/?documents?\b[^>]*>/gi, '')
|
|
61
|
-
.replace(/<documents?\b[^>]*\/>/gi, '')
|
|
62
|
-
.replace(/<\/?attachments?\b[^>]*>/gi, '')
|
|
63
|
-
.replace(/<attachments?\b[^>]*\/>/gi, '')
|
|
64
|
-
.replace(ASSET_URL_RE, '')
|
|
65
|
-
.replace(/\n{3,}/g, '\n\n')
|
|
66
|
-
.trim();
|
|
67
|
-
|
|
68
|
-
export const needsTruncation = (message: string) => {
|
|
69
|
-
return (
|
|
70
|
-
message.length > MAX_MSG_CHARS || message.split(' ').length > MAX_MSG_WORDS
|
|
71
|
-
);
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
export const truncateMessage = (message: string) => {
|
|
75
|
-
let truncatedMessage = message;
|
|
76
|
-
if (message.length > MAX_MSG_CHARS) {
|
|
77
|
-
truncatedMessage = `${message.slice(0, MAX_MSG_CHARS)}\n<br />...`;
|
|
78
|
-
}
|
|
79
|
-
if (truncatedMessage.split(' ').length > MAX_MSG_WORDS) {
|
|
80
|
-
truncatedMessage = truncatedMessage
|
|
81
|
-
.split(' ')
|
|
82
|
-
.slice(0, MAX_MSG_WORDS)
|
|
83
|
-
.join(' ');
|
|
84
|
-
}
|
|
85
|
-
return truncatedMessage;
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
export const sanitizeMsg = (msg: string) =>
|
|
89
|
-
DOMPurify.sanitize(msg, { ADD_ATTR: ['target'] });
|
|
90
|
-
|
|
91
|
-
export const renderMsg = (
|
|
92
|
-
text: string,
|
|
93
|
-
useMathFormatting = false,
|
|
94
|
-
reasoningText = 'Reasoning...',
|
|
95
|
-
showReasoning: boolean
|
|
96
|
-
): {
|
|
97
|
-
text: string;
|
|
98
|
-
} => {
|
|
99
|
-
try {
|
|
100
|
-
// Preprocessing del testo per gestire i delimitatori LaTeX
|
|
101
|
-
let preprocessedText = text
|
|
102
|
-
.trim()
|
|
103
|
-
.replaceAll(
|
|
104
|
-
/\[([^\]]+)\]\(([^\)]+)\)/g,
|
|
105
|
-
'<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>'
|
|
106
|
-
)
|
|
107
|
-
.replaceAll(
|
|
108
|
-
/<think.*?>(.*?)<\/think>/gs,
|
|
109
|
-
showReasoning
|
|
110
|
-
? `<details class="memori-think"><summary>${reasoningText}</summary>$1</details>`
|
|
111
|
-
: ''
|
|
112
|
-
)
|
|
113
|
-
.replaceAll(
|
|
114
|
-
/<output\s+class\s*=\s*["\']memori-artifact["\'][^>]*data-mimetype\s*=\s*["\']([^"']+)["\'][^>]*>([\s\S]*?)(?:<\/output>|$)/gi,
|
|
115
|
-
''
|
|
116
|
-
)
|
|
117
|
-
// Preferred: data-action="update" on memori-artifact
|
|
118
|
-
.replaceAll(
|
|
119
|
-
/<output\s+class\s*=\s*["\']memori-artifact["\'][^>]*data-action\s*=\s*["\']update["\'][^>]*>([\s\S]*?)(?:<\/output>|$)/gi,
|
|
120
|
-
''
|
|
121
|
-
)
|
|
122
|
-
// data-action may appear before class
|
|
123
|
-
.replaceAll(
|
|
124
|
-
/<output\s+[^>]*data-action\s*=\s*["\']update["\'][^>]*class\s*=\s*["\'][^"']*memori-artifact[^"']*["\'][^>]*>([\s\S]*?)(?:<\/output>|$)/gi,
|
|
125
|
-
''
|
|
126
|
-
)
|
|
127
|
-
// Legacy class name
|
|
128
|
-
.replaceAll(
|
|
129
|
-
/<output\s+class\s*=\s*["\']memori-artifact-update["\'][^>]*>([\s\S]*?)(?:<\/output>|$)/gi,
|
|
130
|
-
''
|
|
131
|
-
)
|
|
132
|
-
.replaceAll(/```markdown([^```]+)```/g, '$1')
|
|
133
|
-
.replaceAll('($', '( $')
|
|
134
|
-
.replaceAll(':$', ': $')
|
|
135
|
-
.replaceAll('\frac', '\\frac')
|
|
136
|
-
.replaceAll('\beta', '\\beta')
|
|
137
|
-
.replaceAll('cdot', '\\cdot');
|
|
138
|
-
|
|
139
|
-
preprocessedText = stripAttachmentTags(preprocessedText);
|
|
140
|
-
|
|
141
|
-
// Correzione dei delimitatori LaTeX inconsistenti
|
|
142
|
-
if (useMathFormatting) {
|
|
143
|
-
// Abilita il supporto per KaTeX
|
|
144
|
-
marked.use(markedKatex({}));
|
|
145
|
-
|
|
146
|
-
// Normalizza tutti i delimitatori LaTeX per equazioni su linea separata
|
|
147
|
-
// Da \\[ ... \\] o \\[ ... ] a $$ ... $$
|
|
148
|
-
preprocessedText = preprocessedText.replace(
|
|
149
|
-
/\\+\[(.*?)\\*\]/gs,
|
|
150
|
-
(_, content) => {
|
|
151
|
-
return `$$${content}$$`;
|
|
152
|
-
}
|
|
153
|
-
);
|
|
154
|
-
|
|
155
|
-
// Gestione dei delimitatori [ ... ] che dovrebbero essere equazioni
|
|
156
|
-
preprocessedText = preprocessedText.replace(
|
|
157
|
-
/\[([^[\]]+?)\]/g,
|
|
158
|
-
(match, content) => {
|
|
159
|
-
// Verifica se sembra una formula matematica
|
|
160
|
-
if (
|
|
161
|
-
/[\\+a-z0-9_{}^=\-\+\*\/]+/i.test(content) &&
|
|
162
|
-
!match.startsWith('[http') &&
|
|
163
|
-
!match.includes('](')
|
|
164
|
-
) {
|
|
165
|
-
return `$$${content}$$`;
|
|
166
|
-
}
|
|
167
|
-
return match; // Mantieni invariati i link e altre strutture
|
|
168
|
-
}
|
|
169
|
-
);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
// Extract output tags before markdown processing to preserve their content as raw text
|
|
173
|
-
const outputTags: string[] = [];
|
|
174
|
-
let outputPlaceholder = 0;
|
|
175
|
-
|
|
176
|
-
// Replace output tags with placeholders to prevent markdown parsing inside them
|
|
177
|
-
preprocessedText = preprocessedText.replace(
|
|
178
|
-
/(<output[^>]*>)([\s\S]*?)(<\/output>)/g,
|
|
179
|
-
(_, openTag, content, closeTag) => {
|
|
180
|
-
const placeholder = `<!--OUTPUT_PLACEHOLDER_${outputPlaceholder++}-->`;
|
|
181
|
-
outputTags.push(`${openTag}${content}${closeTag}`);
|
|
182
|
-
return placeholder;
|
|
183
|
-
}
|
|
184
|
-
);
|
|
185
|
-
|
|
186
|
-
// Ensure proper separation after placeholders
|
|
187
|
-
preprocessedText = preprocessedText.replace(
|
|
188
|
-
/(<!--OUTPUT_PLACEHOLDER_\d+-->)\s*([^\s<\n-])/g,
|
|
189
|
-
'$1\n\n$2'
|
|
190
|
-
);
|
|
191
|
-
|
|
192
|
-
// Ora procedi con il parsing markdown
|
|
193
|
-
let parsedText = marked.parse(preprocessedText).toString().trim();
|
|
194
|
-
|
|
195
|
-
// Restore output tags from placeholders (after markdown processing)
|
|
196
|
-
outputTags.forEach((tag, index) => {
|
|
197
|
-
parsedText = parsedText.replace(
|
|
198
|
-
`<!--OUTPUT_PLACEHOLDER_${index}-->`,
|
|
199
|
-
tag
|
|
200
|
-
);
|
|
201
|
-
});
|
|
202
|
-
|
|
203
|
-
// Sanitize HTML
|
|
204
|
-
parsedText = DOMPurify.sanitize(parsedText, {
|
|
205
|
-
ADD_ATTR: ['target'],
|
|
206
|
-
});
|
|
207
|
-
|
|
208
|
-
// Clean up final text
|
|
209
|
-
const finalText = parsedText
|
|
210
|
-
.replace(/(<br>)+/g, '<br>')
|
|
211
|
-
.replace(/<p><\/p>/g, '<br>')
|
|
212
|
-
.replace(/<p><br><\/p>/g, '<br>');
|
|
213
|
-
|
|
214
|
-
return { text: finalText };
|
|
215
|
-
} catch (e) {
|
|
216
|
-
console.error('Error rendering message:', e);
|
|
217
|
-
return { text: sanitizeMsg(text) };
|
|
218
|
-
}
|
|
219
|
-
};
|