@memori.ai/memori-react 8.45.1 → 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 +27 -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 +4 -1
- package/dist/components/ChatHistoryDrawer/ChatResumeDrawer.js +7 -57
- package/dist/components/ChatHistoryDrawer/ChatResumeDrawer.js.map +1 -1
- package/dist/components/IconButton/IconButton.d.ts +1 -1
- 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/PositionPopover/PositionPopover.js +38 -25
- package/dist/components/PositionPopover/PositionPopover.js.map +1 -1
- package/dist/components/UploadButton/UploadButton.js +3 -0
- package/dist/components/UploadButton/UploadButton.js.map +1 -1
- package/dist/components/UploadButton/UploadDocuments/UploadDocuments.js +14 -2
- package/dist/components/UploadButton/UploadDocuments/UploadDocuments.js.map +1 -1
- package/dist/components/layouts/chat.css +27 -4
- package/dist/context/widgetSurfaceContext.js +2 -2
- package/dist/context/widgetSurfaceContext.js.map +1 -1
- package/dist/helpers/constants.d.ts +3 -2
- package/dist/helpers/constants.js +19 -20
- package/dist/helpers/constants.js.map +1 -1
- package/dist/helpers/positionPopover.d.ts +2 -1
- package/dist/helpers/positionPopover.js +12 -3
- package/dist/helpers/positionPopover.js.map +1 -1
- package/dist/helpers/tts/muteSpeaker.js +4 -3
- package/dist/helpers/tts/muteSpeaker.js.map +1 -1
- package/dist/helpers/usePressTooltip.js +2 -1
- package/dist/helpers/usePressTooltip.js.map +1 -1
- package/dist/helpers/utils.d.ts +2 -1
- package/dist/helpers/utils.js +7 -1
- package/dist/helpers/utils.js.map +1 -1
- package/dist/icons/MemoriIcon.js +1 -1
- package/dist/icons/MemoriIcon.js.map +1 -1
- 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/UploadButton/UploadButton.js +4 -1
- package/esm/components/UploadButton/UploadButton.js.map +1 -1
- package/esm/components/UploadButton/UploadDocuments/UploadDocuments.js +16 -4
- package/esm/components/UploadButton/UploadDocuments/UploadDocuments.js.map +1 -1
- package/esm/components/layouts/chat.css +27 -4
- package/esm/helpers/constants.d.ts +3 -2
- package/esm/helpers/constants.js +18 -19
- package/esm/helpers/constants.js.map +1 -1
- package/esm/helpers/utils.d.ts +2 -1
- package/esm/helpers/utils.js +6 -1
- package/esm/helpers/utils.js.map +1 -1
- 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/dist/testUtils.d.ts +0 -5
- package/dist/testUtils.js +0 -18
- package/dist/testUtils.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 -684
- package/src/components/UploadButton/UploadDocuments/UploadDocuments.tsx +0 -405
- 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 -267
- 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 -321
- package/src/helpers/utils.ts +0 -586
- 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
package/src/index.tsx
DELETED
|
@@ -1,592 +0,0 @@
|
|
|
1
|
-
import React, { useState, useEffect, useCallback } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
DialogState,
|
|
6
|
-
Memori as IMemori,
|
|
7
|
-
Tenant,
|
|
8
|
-
Integration,
|
|
9
|
-
} from '@memori.ai/memori-api-client/dist/types';
|
|
10
|
-
import memoriApiClient from '@memori.ai/memori-api-client';
|
|
11
|
-
|
|
12
|
-
import MemoriWidget, {
|
|
13
|
-
Props as WidgetProps,
|
|
14
|
-
} from './components/MemoriWidget/MemoriWidget';
|
|
15
|
-
import { VisemeProvider } from './context/visemeContext';
|
|
16
|
-
|
|
17
|
-
import { Toaster } from 'react-hot-toast';
|
|
18
|
-
import toast from 'react-hot-toast';
|
|
19
|
-
import { safeParseJSON } from './helpers/utils';
|
|
20
|
-
|
|
21
|
-
import i18n from './i18n';
|
|
22
|
-
import { useTranslation } from 'react-i18next';
|
|
23
|
-
import I18nWrapper from './I18nWrapper';
|
|
24
|
-
import { ArtifactProvider } from './components/MemoriArtifactSystem/context/ArtifactContext';
|
|
25
|
-
|
|
26
|
-
import { version } from './version';
|
|
27
|
-
|
|
28
|
-
export interface Props {
|
|
29
|
-
memoriName?: string | null;
|
|
30
|
-
memoriID?: string | null;
|
|
31
|
-
ownerUserName?: string | null;
|
|
32
|
-
ownerUserID?: string | null;
|
|
33
|
-
integration?: Integration;
|
|
34
|
-
integrationID?: string;
|
|
35
|
-
tenantID: string;
|
|
36
|
-
secretToken?: string;
|
|
37
|
-
sessionID?: string;
|
|
38
|
-
layout?: WidgetProps['layout'];
|
|
39
|
-
customLayout?: WidgetProps['customLayout'];
|
|
40
|
-
showShare?: boolean;
|
|
41
|
-
showChatHistory?: boolean;
|
|
42
|
-
showCopyButton?: boolean;
|
|
43
|
-
showTranslationOriginal?: boolean;
|
|
44
|
-
showInputs?: boolean;
|
|
45
|
-
showDates?: boolean;
|
|
46
|
-
showContextPerLine?: boolean;
|
|
47
|
-
showMessageConsumption?: boolean;
|
|
48
|
-
showSettings?: boolean;
|
|
49
|
-
__WEBCOMPONENT__?: boolean;
|
|
50
|
-
showClear?: boolean;
|
|
51
|
-
showOnlyLastMessages?: boolean;
|
|
52
|
-
showTypingText?: boolean;
|
|
53
|
-
showLogin?: boolean;
|
|
54
|
-
showUpload?: boolean;
|
|
55
|
-
showReasoning?: boolean;
|
|
56
|
-
/** When true and layout is WEBSITE_ASSISTANT, hide the 3D avatar in the expanded panel. */
|
|
57
|
-
avatar3dHidden?: boolean;
|
|
58
|
-
height?: number | string;
|
|
59
|
-
baseURL?: string;
|
|
60
|
-
apiURL?: string;
|
|
61
|
-
engineURL?: string;
|
|
62
|
-
tag?: string;
|
|
63
|
-
pin?: string;
|
|
64
|
-
context?: { [key: string]: string };
|
|
65
|
-
initialQuestion?: string;
|
|
66
|
-
uiLang?: 'en' | 'it' | 'fr' | 'es' | 'de' | 'IT' | 'EN' | 'FR' | 'ES' | 'DE';
|
|
67
|
-
spokenLang?: string;
|
|
68
|
-
multilingual?: boolean;
|
|
69
|
-
authToken?: string;
|
|
70
|
-
enableAudio?: boolean;
|
|
71
|
-
defaultSpeakerActive?: boolean;
|
|
72
|
-
disableTextEnteredEvents?: boolean;
|
|
73
|
-
onStateChange?: (state?: DialogState) => void;
|
|
74
|
-
additionalInfo?: WidgetProps['additionalInfo'];
|
|
75
|
-
customMediaRenderer?: WidgetProps['customMediaRenderer'];
|
|
76
|
-
additionalSettings?: WidgetProps['additionalSettings'];
|
|
77
|
-
userAvatar?: WidgetProps['userAvatar'];
|
|
78
|
-
useMathFormatting?: boolean;
|
|
79
|
-
autoStart?: boolean;
|
|
80
|
-
applyVarsToRoot?: boolean;
|
|
81
|
-
/** Max per-document content length (character count). Kept name for backward compatibility. Default: 300000. */
|
|
82
|
-
maxTotalMessagePayload?: number;
|
|
83
|
-
/** Max characters allowed in the chat textarea. When set, shows a counter (e.g. "0 / 500") and enforces that pasted content + existing text does not exceed this limit. */
|
|
84
|
-
maxTextareaCharacters?: number;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const getPreferredLanguages = () => {
|
|
88
|
-
const browserLanguage = navigator.language;
|
|
89
|
-
if (browserLanguage) {
|
|
90
|
-
let lng = browserLanguage.split('-')[0];
|
|
91
|
-
if (['en', 'it'].includes(lng)) {
|
|
92
|
-
return {
|
|
93
|
-
lng,
|
|
94
|
-
fallbackLng: lng === 'en' ? 'it' : 'en',
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
return {
|
|
99
|
-
lng: 'en',
|
|
100
|
-
fallbackLng: 'it',
|
|
101
|
-
};
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
const getParsedContext = (context?: string | null) => {
|
|
105
|
-
if (!context) return {};
|
|
106
|
-
const parsedContext = context?.split(',')?.reduce((acc, cur) => {
|
|
107
|
-
const [key, value] = cur.split(':').map(t => t.trim());
|
|
108
|
-
return { ...acc, [key]: value };
|
|
109
|
-
}, {});
|
|
110
|
-
return parsedContext;
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
const Memori: React.FC<Props> = ({
|
|
114
|
-
ownerUserName,
|
|
115
|
-
ownerUserID,
|
|
116
|
-
memoriName,
|
|
117
|
-
memoriID,
|
|
118
|
-
integration,
|
|
119
|
-
integrationID,
|
|
120
|
-
tenantID,
|
|
121
|
-
secretToken,
|
|
122
|
-
sessionID,
|
|
123
|
-
layout,
|
|
124
|
-
customLayout,
|
|
125
|
-
showShare,
|
|
126
|
-
showCopyButton = true,
|
|
127
|
-
showTranslationOriginal = false,
|
|
128
|
-
showSettings,
|
|
129
|
-
showTypingText = false,
|
|
130
|
-
showClear = false,
|
|
131
|
-
showOnlyLastMessages,
|
|
132
|
-
showInputs = true,
|
|
133
|
-
showDates = false,
|
|
134
|
-
showContextPerLine = false,
|
|
135
|
-
showMessageConsumption = false,
|
|
136
|
-
showUpload,
|
|
137
|
-
showLogin,
|
|
138
|
-
showReasoning,
|
|
139
|
-
avatar3dHidden,
|
|
140
|
-
height = '100%',
|
|
141
|
-
baseURL,
|
|
142
|
-
apiURL = 'https://backend.memori.ai',
|
|
143
|
-
engineURL = 'https://engine.memori.ai',
|
|
144
|
-
tag,
|
|
145
|
-
pin,
|
|
146
|
-
context,
|
|
147
|
-
initialQuestion,
|
|
148
|
-
showChatHistory = true,
|
|
149
|
-
uiLang,
|
|
150
|
-
spokenLang,
|
|
151
|
-
multilingual,
|
|
152
|
-
authToken,
|
|
153
|
-
enableAudio,
|
|
154
|
-
defaultSpeakerActive = true,
|
|
155
|
-
disableTextEnteredEvents = false,
|
|
156
|
-
onStateChange,
|
|
157
|
-
additionalInfo,
|
|
158
|
-
customMediaRenderer,
|
|
159
|
-
additionalSettings,
|
|
160
|
-
userAvatar,
|
|
161
|
-
useMathFormatting = false,
|
|
162
|
-
autoStart,
|
|
163
|
-
applyVarsToRoot = false,
|
|
164
|
-
__WEBCOMPONENT__ = false,
|
|
165
|
-
maxTotalMessagePayload,
|
|
166
|
-
maxTextareaCharacters,
|
|
167
|
-
}) => {
|
|
168
|
-
const [memori, setMemori] = useState<IMemori>();
|
|
169
|
-
const [tenant, setTenant] = useState<Tenant>();
|
|
170
|
-
const [provider, setProvider] = useState<string | undefined>();
|
|
171
|
-
const [sessionId, setSessionId] = useState<string | undefined>();
|
|
172
|
-
|
|
173
|
-
const { t } = useTranslation();
|
|
174
|
-
|
|
175
|
-
if (!((memoriID && ownerUserID) || (memoriName && ownerUserName))) {
|
|
176
|
-
throw new Error(
|
|
177
|
-
'Identifier pair required: please provide either memoriID and ownerUserID or memoriName and ownerUserName'
|
|
178
|
-
);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
const client = memoriApiClient(apiURL, engineURL);
|
|
182
|
-
|
|
183
|
-
const fetchSpeechKey = useCallback(async () => {
|
|
184
|
-
const url =
|
|
185
|
-
baseURL ||
|
|
186
|
-
(tenantID.startsWith('https://') ? tenantID : `https://${tenantID}`);
|
|
187
|
-
try {
|
|
188
|
-
const result = await fetch(`${url}/api/speechkey?tenant=${tenantID}`, {
|
|
189
|
-
method: 'GET',
|
|
190
|
-
headers: {
|
|
191
|
-
'Content-Type': 'application/json',
|
|
192
|
-
},
|
|
193
|
-
});
|
|
194
|
-
|
|
195
|
-
const data = await result.json();
|
|
196
|
-
|
|
197
|
-
if (data.provider) {
|
|
198
|
-
setProvider(data.provider);
|
|
199
|
-
} else {
|
|
200
|
-
console.warn('Provider not found in speech key response');
|
|
201
|
-
}
|
|
202
|
-
} catch (error) {
|
|
203
|
-
console.error('Error fetching speech key:', error);
|
|
204
|
-
}
|
|
205
|
-
}, [baseURL, tenantID]);
|
|
206
|
-
|
|
207
|
-
useEffect(() => {
|
|
208
|
-
fetchSpeechKey();
|
|
209
|
-
}, []);
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
* Fetches the Memori data from the backend
|
|
213
|
-
*/
|
|
214
|
-
const fetchMemori = useCallback(async () => {
|
|
215
|
-
if (memoriID && ownerUserID) {
|
|
216
|
-
const { memori, ...resp } = await client.backend.getMemoriByUserAndId(
|
|
217
|
-
tenantID,
|
|
218
|
-
ownerUserID,
|
|
219
|
-
memoriID
|
|
220
|
-
);
|
|
221
|
-
|
|
222
|
-
if (resp.resultCode === 0 && !!memori) {
|
|
223
|
-
setMemori(memori);
|
|
224
|
-
} else {
|
|
225
|
-
console.error('[MEMORI]', resp, memori);
|
|
226
|
-
}
|
|
227
|
-
} else if (memoriName && ownerUserName) {
|
|
228
|
-
const { memori, ...resp } = await client.backend.getMemori(
|
|
229
|
-
tenantID,
|
|
230
|
-
ownerUserName,
|
|
231
|
-
memoriName
|
|
232
|
-
);
|
|
233
|
-
|
|
234
|
-
if (resp.resultCode === 0 && !!memori) {
|
|
235
|
-
if (!memori.ownerUserID && ownerUserID) {
|
|
236
|
-
memori.ownerUserID = ownerUserID;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
setMemori(memori);
|
|
240
|
-
} else {
|
|
241
|
-
console.error('[MEMORI]', resp, memori);
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
}, [memoriID, ownerUserID, memoriName, ownerUserName, tenantID]);
|
|
245
|
-
useEffect(() => {
|
|
246
|
-
fetchMemori();
|
|
247
|
-
}, [fetchMemori, tenantID]);
|
|
248
|
-
|
|
249
|
-
/**
|
|
250
|
-
* Fetches the Tenant data from the backend
|
|
251
|
-
*/
|
|
252
|
-
const fetchTenant = useCallback(async () => {
|
|
253
|
-
const { tenant, ...resp } = await client.backend.tenant.getTenant(tenantID);
|
|
254
|
-
if (tenant && resp.resultCode === 0) setTenant(tenant);
|
|
255
|
-
else console.debug('[TENANT]', resp, tenant);
|
|
256
|
-
}, [tenantID, apiURL]);
|
|
257
|
-
useEffect(() => {
|
|
258
|
-
fetchTenant();
|
|
259
|
-
}, [fetchTenant]);
|
|
260
|
-
|
|
261
|
-
useEffect(() => {
|
|
262
|
-
const targetNode =
|
|
263
|
-
document.querySelector(`memori-client[memoriname="${memori?.name}"]`) ||
|
|
264
|
-
document.querySelector(`memori-client[memoriid="${memori?.memoriID}"]`) ||
|
|
265
|
-
document.querySelector('memori-client');
|
|
266
|
-
if (!targetNode) {
|
|
267
|
-
return;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
const config = { attributes: true, childList: false, subtree: false };
|
|
271
|
-
const callback: MutationCallback = (mutationList, _observer) => {
|
|
272
|
-
for (const mutation of mutationList) {
|
|
273
|
-
if (mutation.type === 'attributes') {
|
|
274
|
-
const target =
|
|
275
|
-
mutation.target.nodeName === 'MEMORI-CLIENT'
|
|
276
|
-
? mutation.target
|
|
277
|
-
: mutation.target.parentElement;
|
|
278
|
-
// @ts-ignore
|
|
279
|
-
const targetSessionId = target.getAttribute('sessionid') || undefined;
|
|
280
|
-
if (target && targetSessionId) {
|
|
281
|
-
setSessionId(targetSessionId);
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
};
|
|
286
|
-
const observer = new MutationObserver(callback);
|
|
287
|
-
observer.observe(targetNode, config);
|
|
288
|
-
|
|
289
|
-
return () => {
|
|
290
|
-
observer.disconnect();
|
|
291
|
-
};
|
|
292
|
-
}, []);
|
|
293
|
-
|
|
294
|
-
/**
|
|
295
|
-
* Sets the language in the i18n instance
|
|
296
|
-
*/
|
|
297
|
-
useEffect(() => {
|
|
298
|
-
if (uiLang) {
|
|
299
|
-
// @ts-ignore
|
|
300
|
-
i18n.changeLanguage(uiLang.toLowerCase());
|
|
301
|
-
} else {
|
|
302
|
-
const { lng, fallbackLng } = getPreferredLanguages();
|
|
303
|
-
// @ts-ignore
|
|
304
|
-
i18n.changeLanguage(lng).catch(() => {
|
|
305
|
-
// @ts-ignore
|
|
306
|
-
i18n.changeLanguage(fallbackLng);
|
|
307
|
-
});
|
|
308
|
-
}
|
|
309
|
-
}, [uiLang]);
|
|
310
|
-
|
|
311
|
-
const layoutIntegration =
|
|
312
|
-
integration ??
|
|
313
|
-
memori?.integrations?.find(i =>
|
|
314
|
-
integrationID
|
|
315
|
-
? i.integrationID === integrationID
|
|
316
|
-
: !!i.publish && i.type === 'LANDING_EXPERIENCE'
|
|
317
|
-
);
|
|
318
|
-
const layoutIntegrationConfig = safeParseJSON(
|
|
319
|
-
layoutIntegration?.customData ?? '{}'
|
|
320
|
-
);
|
|
321
|
-
|
|
322
|
-
const whiteListedDomains = [
|
|
323
|
-
tenant?.name,
|
|
324
|
-
...(tenant?.aliases || []),
|
|
325
|
-
...(layoutIntegrationConfig.whiteListedDomains || []),
|
|
326
|
-
];
|
|
327
|
-
if (layoutIntegrationConfig?.whiteListedDomains?.length) {
|
|
328
|
-
// check if we are client side
|
|
329
|
-
if (typeof window !== 'undefined') {
|
|
330
|
-
// check if the current domain is in the whiteListedDomains with Regex
|
|
331
|
-
if (
|
|
332
|
-
!whiteListedDomains.some((domain: string) =>
|
|
333
|
-
new RegExp(domain).test(window.location.hostname)
|
|
334
|
-
)
|
|
335
|
-
) {
|
|
336
|
-
return null;
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
const ignoreClientAttributes =
|
|
342
|
-
layoutIntegrationConfig.ignoreClientAttributes ?? false;
|
|
343
|
-
|
|
344
|
-
const clientAttributes = ignoreClientAttributes
|
|
345
|
-
? {
|
|
346
|
-
initialContextVars: getParsedContext(
|
|
347
|
-
layoutIntegrationConfig.contextVars
|
|
348
|
-
),
|
|
349
|
-
initialQuestion: layoutIntegrationConfig.initialQuestion as
|
|
350
|
-
| string
|
|
351
|
-
| undefined,
|
|
352
|
-
showLogin: memori?.enableDeepThought,
|
|
353
|
-
memoriLang: memori?.culture?.split('-')?.[0],
|
|
354
|
-
uiLang,
|
|
355
|
-
spokenLang,
|
|
356
|
-
autoStart:
|
|
357
|
-
layout === 'HIDDEN_CHAT'
|
|
358
|
-
? true
|
|
359
|
-
: layout === 'WEBSITE_ASSISTANT'
|
|
360
|
-
? false
|
|
361
|
-
: autoStart,
|
|
362
|
-
}
|
|
363
|
-
: {
|
|
364
|
-
...(tag && pin ? { personification: { tag, pin } } : {}),
|
|
365
|
-
multilingual,
|
|
366
|
-
showCopyButton,
|
|
367
|
-
showTranslationOriginal,
|
|
368
|
-
showSettings,
|
|
369
|
-
showChatHistory,
|
|
370
|
-
showShare,
|
|
371
|
-
showTypingText,
|
|
372
|
-
showClear,
|
|
373
|
-
showLogin: showLogin ?? memori?.enableDeepThought,
|
|
374
|
-
showUpload,
|
|
375
|
-
showReasoning,
|
|
376
|
-
showContextPerLine,
|
|
377
|
-
showMessageConsumption,
|
|
378
|
-
initialContextVars:
|
|
379
|
-
context ?? getParsedContext(layoutIntegrationConfig.contextVars),
|
|
380
|
-
initialQuestion:
|
|
381
|
-
initialQuestion ??
|
|
382
|
-
(layoutIntegrationConfig.initialQuestion as string | undefined),
|
|
383
|
-
autoStart:
|
|
384
|
-
layout === 'WEBSITE_ASSISTANT'
|
|
385
|
-
? false
|
|
386
|
-
: autoStart !== undefined
|
|
387
|
-
? autoStart
|
|
388
|
-
: layout === 'HIDDEN_CHAT'
|
|
389
|
-
? true
|
|
390
|
-
: autoStart,
|
|
391
|
-
enableAudio,
|
|
392
|
-
defaultSpeakerActive,
|
|
393
|
-
useMathFormatting,
|
|
394
|
-
memoriLang: memori?.culture?.split('-')?.[0],
|
|
395
|
-
uiLang,
|
|
396
|
-
spokenLang,
|
|
397
|
-
};
|
|
398
|
-
|
|
399
|
-
const [pulseSent, setPulseSent] = useState(false);
|
|
400
|
-
|
|
401
|
-
const sendPulse = useCallback(() => {
|
|
402
|
-
if ((memori?.memoriID || memoriID) && !pulseSent) {
|
|
403
|
-
let origin = window?.location.origin;
|
|
404
|
-
|
|
405
|
-
if (
|
|
406
|
-
!origin ||
|
|
407
|
-
origin.includes('localhost') ||
|
|
408
|
-
origin.includes('memori-ai.github.io')
|
|
409
|
-
) {
|
|
410
|
-
setPulseSent(true);
|
|
411
|
-
return;
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
setPulseSent(true);
|
|
415
|
-
fetch('https://pulse.aisuru.com/post', {
|
|
416
|
-
method: 'POST',
|
|
417
|
-
headers: {
|
|
418
|
-
'Content-Type': 'application/json',
|
|
419
|
-
},
|
|
420
|
-
body: JSON.stringify({
|
|
421
|
-
pulse: {
|
|
422
|
-
clientType: __WEBCOMPONENT__
|
|
423
|
-
? 'memori-webcomponent'
|
|
424
|
-
: 'memori-react',
|
|
425
|
-
clientVersion: `v${version}`,
|
|
426
|
-
userAgent: navigator.userAgent,
|
|
427
|
-
language: navigator.language,
|
|
428
|
-
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
429
|
-
memoriID: memori?.memoriID ?? memoriID,
|
|
430
|
-
tenant: tenantID,
|
|
431
|
-
referrer: origin,
|
|
432
|
-
},
|
|
433
|
-
}),
|
|
434
|
-
});
|
|
435
|
-
}
|
|
436
|
-
}, [memori?.memoriID, memoriID, tenantID, __WEBCOMPONENT__, pulseSent]);
|
|
437
|
-
|
|
438
|
-
useEffect(() => {
|
|
439
|
-
sendPulse();
|
|
440
|
-
}, [sendPulse]);
|
|
441
|
-
|
|
442
|
-
return (
|
|
443
|
-
<I18nWrapper>
|
|
444
|
-
<VisemeProvider>
|
|
445
|
-
<ArtifactProvider>
|
|
446
|
-
<Toaster position="top-center" reverseOrder={true} />
|
|
447
|
-
{memori ? (
|
|
448
|
-
<MemoriWidget
|
|
449
|
-
// General props
|
|
450
|
-
layout={layout}
|
|
451
|
-
customLayout={customLayout}
|
|
452
|
-
height={height}
|
|
453
|
-
baseUrl={
|
|
454
|
-
baseURL ||
|
|
455
|
-
(tenantID.startsWith('https://') ||
|
|
456
|
-
tenantID.startsWith('http://')
|
|
457
|
-
? tenantID
|
|
458
|
-
: `https://${tenantID}`)
|
|
459
|
-
}
|
|
460
|
-
apiURL={apiURL}
|
|
461
|
-
engineURL={engineURL}
|
|
462
|
-
memori={{
|
|
463
|
-
...memori,
|
|
464
|
-
secretToken,
|
|
465
|
-
}}
|
|
466
|
-
__WEBCOMPONENT__={__WEBCOMPONENT__}
|
|
467
|
-
ownerUserName={ownerUserName ?? memori.ownerUserName}
|
|
468
|
-
ownerUserID={ownerUserID ?? memori.ownerUserID}
|
|
469
|
-
tenant={tenant}
|
|
470
|
-
tenantID={tenantID}
|
|
471
|
-
sessionID={sessionID ?? sessionId}
|
|
472
|
-
secret={secretToken}
|
|
473
|
-
ttsProvider={
|
|
474
|
-
provider ? (provider as 'azure' | 'openai') : 'azure'
|
|
475
|
-
}
|
|
476
|
-
integration={layoutIntegration}
|
|
477
|
-
authToken={authToken}
|
|
478
|
-
onStateChange={onStateChange}
|
|
479
|
-
additionalInfo={additionalInfo}
|
|
480
|
-
customMediaRenderer={customMediaRenderer}
|
|
481
|
-
additionalSettings={additionalSettings}
|
|
482
|
-
userAvatar={userAvatar}
|
|
483
|
-
applyVarsToRoot={applyVarsToRoot}
|
|
484
|
-
maxTotalMessagePayload={maxTotalMessagePayload}
|
|
485
|
-
maxTextareaCharacters={maxTextareaCharacters}
|
|
486
|
-
disableTextEnteredEvents={disableTextEnteredEvents}
|
|
487
|
-
avatar3dHidden={avatar3dHidden}
|
|
488
|
-
// From layout, from client if allowed
|
|
489
|
-
{...clientAttributes}
|
|
490
|
-
// Client only
|
|
491
|
-
showOnlyLastMessages={showOnlyLastMessages}
|
|
492
|
-
showInputs={showInputs}
|
|
493
|
-
showDates={showDates}
|
|
494
|
-
/>
|
|
495
|
-
) : (
|
|
496
|
-
<div
|
|
497
|
-
style={{
|
|
498
|
-
display: 'flex',
|
|
499
|
-
alignItems: 'center',
|
|
500
|
-
justifyContent: 'center',
|
|
501
|
-
}}
|
|
502
|
-
>
|
|
503
|
-
<p
|
|
504
|
-
style={{
|
|
505
|
-
textAlign: 'center',
|
|
506
|
-
margin: '2rem auto',
|
|
507
|
-
textTransform: 'capitalize',
|
|
508
|
-
}}
|
|
509
|
-
>
|
|
510
|
-
{t('loading') || 'Loading'}...
|
|
511
|
-
</p>
|
|
512
|
-
</div>
|
|
513
|
-
)}
|
|
514
|
-
</ArtifactProvider>
|
|
515
|
-
</VisemeProvider>
|
|
516
|
-
</I18nWrapper>
|
|
517
|
-
);
|
|
518
|
-
};
|
|
519
|
-
|
|
520
|
-
Memori.propTypes = {
|
|
521
|
-
memoriName: PropTypes.string,
|
|
522
|
-
memoriID: PropTypes.string,
|
|
523
|
-
ownerUserName: PropTypes.string,
|
|
524
|
-
ownerUserID: PropTypes.string,
|
|
525
|
-
integrationID: PropTypes.string,
|
|
526
|
-
integration: PropTypes.any,
|
|
527
|
-
tenantID: PropTypes.string.isRequired,
|
|
528
|
-
secretToken: PropTypes.string,
|
|
529
|
-
sessionID: PropTypes.string,
|
|
530
|
-
layout: PropTypes.oneOf([
|
|
531
|
-
'DEFAULT',
|
|
532
|
-
'FULLPAGE',
|
|
533
|
-
'TOTEM',
|
|
534
|
-
'WEBSITE_ASSISTANT',
|
|
535
|
-
'CHAT',
|
|
536
|
-
'HIDDEN_CHAT',
|
|
537
|
-
'ZOOMED_FULL_BODY',
|
|
538
|
-
]),
|
|
539
|
-
customLayout: PropTypes.any,
|
|
540
|
-
showShare: PropTypes.bool,
|
|
541
|
-
showCopyButton: PropTypes.bool,
|
|
542
|
-
showTranslationOriginal: PropTypes.bool,
|
|
543
|
-
showInputs: PropTypes.bool,
|
|
544
|
-
showDates: PropTypes.bool,
|
|
545
|
-
showContextPerLine: PropTypes.bool,
|
|
546
|
-
showMessageConsumption: PropTypes.bool,
|
|
547
|
-
showSettings: PropTypes.bool,
|
|
548
|
-
showClear: PropTypes.bool,
|
|
549
|
-
showOnlyLastMessages: PropTypes.bool,
|
|
550
|
-
showTypingText: PropTypes.bool,
|
|
551
|
-
showLogin: PropTypes.bool,
|
|
552
|
-
showUpload: PropTypes.bool,
|
|
553
|
-
showReasoning: PropTypes.bool,
|
|
554
|
-
avatar3dHidden: PropTypes.bool,
|
|
555
|
-
height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
556
|
-
baseURL: PropTypes.string,
|
|
557
|
-
apiURL: PropTypes.string,
|
|
558
|
-
engineURL: PropTypes.string,
|
|
559
|
-
tag: PropTypes.string,
|
|
560
|
-
pin: PropTypes.string,
|
|
561
|
-
context: PropTypes.objectOf(PropTypes.any),
|
|
562
|
-
initialQuestion: PropTypes.string,
|
|
563
|
-
uiLang: PropTypes.oneOf([
|
|
564
|
-
'en',
|
|
565
|
-
'it',
|
|
566
|
-
'fr',
|
|
567
|
-
'es',
|
|
568
|
-
'de',
|
|
569
|
-
'EN',
|
|
570
|
-
'IT',
|
|
571
|
-
'FR',
|
|
572
|
-
'ES',
|
|
573
|
-
'DE',
|
|
574
|
-
]),
|
|
575
|
-
spokenLang: PropTypes.string,
|
|
576
|
-
multilingual: PropTypes.bool,
|
|
577
|
-
authToken: PropTypes.string,
|
|
578
|
-
enableAudio: PropTypes.bool,
|
|
579
|
-
defaultSpeakerActive: PropTypes.bool,
|
|
580
|
-
disableTextEnteredEvents: PropTypes.bool,
|
|
581
|
-
onStateChange: PropTypes.func,
|
|
582
|
-
additionalInfo: PropTypes.objectOf(PropTypes.any),
|
|
583
|
-
customMediaRenderer: PropTypes.func,
|
|
584
|
-
additionalSettings: PropTypes.any,
|
|
585
|
-
userAvatar: PropTypes.oneOfType([PropTypes.string, PropTypes.any]),
|
|
586
|
-
useMathFormatting: PropTypes.bool,
|
|
587
|
-
autoStart: PropTypes.bool,
|
|
588
|
-
applyVarsToRoot: PropTypes.bool,
|
|
589
|
-
maxTotalMessagePayload: PropTypes.number,
|
|
590
|
-
maxTextareaCharacters: PropTypes.number,
|
|
591
|
-
};
|
|
592
|
-
export default Memori;
|