@memori.ai/memori-react 6.8.1 → 6.8.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 +1918 -0
- package/README.md +89 -48
- package/dist/I18nWrapper.js +3 -47
- package/dist/I18nWrapper.js.map +1 -1
- package/dist/components/AccountForm/AccountForm.d.ts +4 -2
- package/dist/components/AccountForm/AccountForm.js +2 -4
- package/dist/components/AccountForm/AccountForm.js.map +1 -1
- package/dist/components/AgeVerificationModal/AgeVerificationModal.css +1 -1
- package/dist/components/AgeVerificationModal/AgeVerificationModal.d.ts +1 -0
- package/dist/components/AgeVerificationModal/AgeVerificationModal.js +1 -1
- package/dist/components/AgeVerificationModal/AgeVerificationModal.js.map +1 -1
- package/dist/components/AttachmentLinkModal/AttachmentLinkModal.d.ts +1 -0
- package/dist/components/Auth/Auth.d.ts +1 -0
- package/dist/components/Avatar/Avatar.css +2 -2
- package/dist/components/Avatar/Avatar.d.ts +7 -0
- package/dist/components/Avatar/Avatar.js +70 -60
- package/dist/components/Avatar/Avatar.js.map +1 -1
- package/dist/components/Avatar/AvatarView/AvatarComponent/Shadow/DynamicShadow.d.ts +7 -0
- package/dist/components/Avatar/AvatarView/AvatarComponent/Shadow/DynamicShadow.js +62 -0
- package/dist/components/Avatar/AvatarView/AvatarComponent/Shadow/DynamicShadow.js.map +1 -0
- package/dist/components/Avatar/AvatarView/AvatarComponent/avatarComponent.d.ts +22 -0
- package/dist/components/Avatar/AvatarView/AvatarComponent/avatarComponent.js +41 -0
- package/dist/components/Avatar/AvatarView/AvatarComponent/avatarComponent.js.map +1 -0
- package/dist/components/Avatar/AvatarView/AvatarComponent/components/FullbodyAvatar/fullbodyAvatar.d.ts +18 -0
- package/dist/components/Avatar/AvatarView/AvatarComponent/components/FullbodyAvatar/fullbodyAvatar.js +185 -0
- package/dist/components/Avatar/AvatarView/AvatarComponent/components/FullbodyAvatar/fullbodyAvatar.js.map +1 -0
- package/dist/components/Avatar/AvatarView/AvatarComponent/components/FullbodyAvatar/types.d.ts +39 -0
- package/dist/components/Avatar/AvatarView/AvatarComponent/components/FullbodyAvatar/types.js +10 -0
- package/dist/components/Avatar/AvatarView/AvatarComponent/components/FullbodyAvatar/types.js.map +1 -0
- package/dist/components/Avatar/AvatarView/AvatarComponent/components/controllers/AvatarAnimator.d.ts +65 -0
- package/dist/components/Avatar/AvatarView/AvatarComponent/components/controllers/AvatarAnimator.js +747 -0
- package/dist/components/Avatar/AvatarView/AvatarComponent/components/controllers/AvatarAnimator.js.map +1 -0
- package/dist/components/Avatar/AvatarView/AvatarComponent/components/controllers/AvatarPositionController.d.ts +19 -0
- package/dist/components/Avatar/AvatarView/AvatarComponent/components/controllers/AvatarPositionController.js +60 -0
- package/dist/components/Avatar/AvatarView/AvatarComponent/components/controllers/AvatarPositionController.js.map +1 -0
- package/dist/components/Avatar/AvatarView/AvatarComponent/components/controllers/MorphTargetController.d.ts +24 -0
- package/dist/components/Avatar/AvatarView/AvatarComponent/components/controllers/MorphTargetController.js +133 -0
- package/dist/components/Avatar/AvatarView/AvatarComponent/components/controllers/MorphTargetController.js.map +1 -0
- package/dist/components/Avatar/AvatarView/AvatarComponent/components/controls.d.ts +26 -0
- package/dist/components/Avatar/AvatarView/AvatarComponent/components/controls.js +59 -0
- package/dist/components/Avatar/AvatarView/AvatarComponent/components/controls.js.map +1 -0
- package/dist/components/Avatar/AvatarView/AvatarComponent/components/halfbodyAvatar.d.ts +15 -0
- package/dist/components/Avatar/AvatarView/AvatarComponent/components/halfbodyAvatar.js +83 -0
- package/dist/components/Avatar/AvatarView/AvatarComponent/components/halfbodyAvatar.js.map +1 -0
- package/dist/components/{AvatarView → Avatar/AvatarView/AvatarComponent}/components/loader.d.ts +1 -0
- package/dist/components/{AvatarView → Avatar/AvatarView/AvatarComponent}/components/loader.js +1 -1
- package/dist/components/Avatar/AvatarView/AvatarComponent/components/loader.js.map +1 -0
- package/dist/components/Avatar/AvatarView/AvatarComponent/constants.d.ts +35 -0
- package/dist/components/Avatar/AvatarView/AvatarComponent/constants.js +99 -0
- package/dist/components/Avatar/AvatarView/AvatarComponent/constants.js.map +1 -0
- package/dist/components/Avatar/AvatarView/AvatarComponent/lights/Lights.d.ts +27 -0
- package/dist/components/Avatar/AvatarView/AvatarComponent/lights/Lights.js +52 -0
- package/dist/components/Avatar/AvatarView/AvatarComponent/lights/Lights.js.map +1 -0
- package/dist/components/Avatar/AvatarView/AvatarComponent/positionControls/positionControls.css +111 -0
- package/dist/components/Avatar/AvatarView/AvatarComponent/positionControls/positionControls.d.ts +11 -0
- package/dist/components/Avatar/AvatarView/AvatarComponent/positionControls/positionControls.js +110 -0
- package/dist/components/Avatar/AvatarView/AvatarComponent/positionControls/positionControls.js.map +1 -0
- package/dist/components/Avatar/AvatarView/index.d.ts +30 -0
- package/dist/components/Avatar/AvatarView/index.js +68 -0
- package/dist/components/Avatar/AvatarView/index.js.map +1 -0
- package/dist/components/Avatar/AvatarView/utils/hideHands.d.ts +2 -0
- package/dist/components/Avatar/AvatarView/utils/hideHands.js +14 -0
- package/dist/components/Avatar/AvatarView/utils/hideHands.js.map +1 -0
- package/dist/components/Avatar/AvatarView/utils/useEyeBlink.d.ts +16 -0
- package/dist/components/Avatar/AvatarView/utils/useEyeBlink.js +71 -0
- package/dist/components/Avatar/AvatarView/utils/useEyeBlink.js.map +1 -0
- package/dist/components/Avatar/AvatarView/utils/useHeadMovement.js.map +1 -0
- package/dist/components/Avatar/AvatarView/utils/useLoadingMorphAnim.js.map +1 -0
- package/dist/components/Avatar/AvatarView/utils/useMouthAnimation.d.ts +16 -0
- package/dist/components/Avatar/AvatarView/utils/useMouthAnimation.js +59 -0
- package/dist/components/Avatar/AvatarView/utils/useMouthAnimation.js.map +1 -0
- package/dist/components/Avatar/AvatarView/utils/useSmile.js +28 -0
- package/dist/components/Avatar/AvatarView/utils/useSmile.js.map +1 -0
- package/dist/components/Avatar/AvatarView/utils/utils.js.map +1 -0
- package/dist/components/Blob/Blob.d.ts +1 -0
- package/dist/components/BlockedMemoriBadge/BlockedMemoriBadge.d.ts +1 -0
- package/dist/components/Chat/Chat.d.ts +15 -7
- package/dist/components/Chat/Chat.js +49 -30
- package/dist/components/Chat/Chat.js.map +1 -1
- package/dist/components/ChatBubble/ChatBubble.css +91 -14
- package/dist/components/ChatBubble/ChatBubble.d.ts +14 -0
- package/dist/components/ChatBubble/ChatBubble.js +92 -67
- package/dist/components/ChatBubble/ChatBubble.js.map +1 -1
- package/dist/components/ChatHistoryDrawer/ChatHistory.css +414 -0
- package/dist/components/ChatHistoryDrawer/ChatHistory.d.ts +20 -0
- package/dist/components/ChatHistoryDrawer/ChatHistory.js +630 -0
- package/dist/components/ChatHistoryDrawer/ChatHistory.js.map +1 -0
- package/dist/components/ChatInputs/ChatInputs.d.ts +9 -3
- package/dist/components/ChatInputs/ChatInputs.js +47 -6
- package/dist/components/ChatInputs/ChatInputs.js.map +1 -1
- package/dist/components/ChatTextArea/ChatTextArea.css +9 -5
- package/dist/components/ChatTextArea/ChatTextArea.js +1 -1
- package/dist/components/ChatTextArea/ChatTextArea.js.map +1 -1
- package/dist/components/CompletionProviderStatus/CompletionProviderStatus.css +35 -17
- package/dist/components/CompletionProviderStatus/CompletionProviderStatus.d.ts +5 -3
- package/dist/components/CompletionProviderStatus/CompletionProviderStatus.js +142 -28
- package/dist/components/CompletionProviderStatus/CompletionProviderStatus.js.map +1 -1
- package/dist/components/CustomGLBModelViewer/ModelViewer.d.ts +1 -0
- package/dist/components/ExpertsDrawer/ExpertsDrawer.d.ts +1 -0
- package/dist/components/ExpertsDrawer/ExpertsDrawer.js +2 -2
- package/dist/components/ExpertsDrawer/ExpertsDrawer.js.map +1 -1
- package/dist/components/FeedbackButtons/FeedbackButtons.d.ts +1 -0
- package/dist/components/FilePreview/FilePreview.css +184 -0
- package/dist/components/FilePreview/FilePreview.d.ts +9 -0
- package/dist/components/FilePreview/FilePreview.js +74 -0
- package/dist/components/FilePreview/FilePreview.js.map +1 -0
- package/dist/components/Header/Header.css +3 -3
- package/dist/components/Header/Header.d.ts +5 -1
- package/dist/components/Header/Header.js +27 -13
- package/dist/components/Header/Header.js.map +1 -1
- package/dist/components/KnownFacts/KnownFacts.d.ts +4 -2
- package/dist/components/KnownFacts/KnownFacts.js +3 -5
- package/dist/components/KnownFacts/KnownFacts.js.map +1 -1
- package/dist/components/LoginDrawer/LoginDrawer.css +302 -0
- package/dist/components/LoginDrawer/LoginDrawer.d.ts +4 -2
- package/dist/components/LoginDrawer/LoginDrawer.js +9 -11
- package/dist/components/LoginDrawer/LoginDrawer.js.map +1 -1
- package/dist/components/MediaWidget/LinkItemWidget.css +10 -0
- package/dist/components/MediaWidget/LinkItemWidget.d.ts +1 -0
- package/dist/components/MediaWidget/LinkItemWidget.js +5 -2
- package/dist/components/MediaWidget/LinkItemWidget.js.map +1 -1
- package/dist/components/MediaWidget/MediaItemWidget.css +153 -3
- package/dist/components/MediaWidget/MediaItemWidget.d.ts +7 -2
- package/dist/components/MediaWidget/MediaItemWidget.js +89 -37
- package/dist/components/MediaWidget/MediaItemWidget.js.map +1 -1
- package/dist/components/MediaWidget/MediaWidget.d.ts +4 -1
- package/dist/components/MediaWidget/MediaWidget.js +2 -2
- package/dist/components/MediaWidget/MediaWidget.js.map +1 -1
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.css +163 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.d.ts +12 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.js +133 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.js.map +1 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/components/CopyButtonWithDropdown.d.ts +4 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/components/CopyButtonWithDropdown.js +286 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/components/CopyButtonWithDropdown.js.map +1 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/components/CopyMenuItem.d.ts +6 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/components/CopyMenuItem.js +40 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/components/CopyMenuItem.js.map +1 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/hooks/useCopyArtifact.d.ts +6 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/hooks/useCopyArtifact.js +492 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/hooks/useCopyArtifact.js.map +1 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/index.d.ts +5 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/index.js +14 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/index.js.map +1 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/styles.css +489 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/test/CopyButtonTest.d.ts +3 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/test/CopyButtonTest.js +64 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/test/CopyButtonTest.js.map +1 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/types.d.ts +61 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/types.js +3 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/types.js.map +1 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/utils/PDFExporter.d.ts +15 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/utils/PDFExporter.js +352 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/utils/PDFExporter.js.map +1 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.css +1059 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.d.ts +5 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js +167 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js.map +1 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/components/TabSwitch.css +150 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/components/TabSwitch.d.ts +9 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/components/TabSwitch.js +35 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/components/TabSwitch.js.map +1 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.css +253 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.d.ts +8 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.js +104 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.js.map +1 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.css +346 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.d.ts +7 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.js +89 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.js.map +1 -0
- package/dist/components/MemoriArtifactSystem/context/ArtifactContext.d.ts +13 -0
- package/dist/components/MemoriArtifactSystem/context/ArtifactContext.js +55 -0
- package/dist/components/MemoriArtifactSystem/context/ArtifactContext.js.map +1 -0
- package/dist/components/MemoriArtifactSystem/types/artifact.types.d.ts +14 -0
- package/dist/components/MemoriArtifactSystem/types/artifact.types.js +3 -0
- package/dist/components/MemoriArtifactSystem/types/artifact.types.js.map +1 -0
- package/dist/components/MemoriWidget/MemoriWidget.css +10 -4
- package/dist/components/MemoriWidget/MemoriWidget.d.ts +29 -11
- package/dist/components/MemoriWidget/MemoriWidget.js +763 -1051
- package/dist/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/dist/components/MicrophoneButton/MicrophoneButton.d.ts +1 -0
- package/dist/components/MicrophoneButton/MicrophoneButton.js +1 -1
- package/dist/components/MicrophoneButton/MicrophoneButton.js.map +1 -1
- package/dist/components/PositionDrawer/PositionDrawer.d.ts +1 -0
- package/dist/components/PoweredBy/PoweredBy.d.ts +1 -0
- package/dist/components/SendOnEnterMenu/SendOnEnterMenu.css +3 -3
- package/dist/components/SettingsDrawer/SettingsDrawer.css +9 -2
- package/dist/components/SettingsDrawer/SettingsDrawer.d.ts +8 -1
- package/dist/components/SettingsDrawer/SettingsDrawer.js +15 -6
- package/dist/components/SettingsDrawer/SettingsDrawer.js.map +1 -1
- package/dist/components/ShareButton/ShareButton.css +6 -0
- package/dist/components/ShareButton/ShareButton.d.ts +3 -1
- package/dist/components/ShareButton/ShareButton.js +14 -3
- package/dist/components/ShareButton/ShareButton.js.map +1 -1
- package/dist/components/SignupForm/SignupForm.d.ts +4 -2
- package/dist/components/SignupForm/SignupForm.js +6 -8
- package/dist/components/SignupForm/SignupForm.js.map +1 -1
- package/dist/components/Snippet/Snippet.d.ts +2 -2
- package/dist/components/Snippet/Snippet.js +36 -25
- package/dist/components/Snippet/Snippet.js.map +1 -1
- package/dist/components/StartPanel/StartPanel.css +34 -8
- package/dist/components/StartPanel/StartPanel.d.ts +8 -3
- package/dist/components/StartPanel/StartPanel.js +26 -15
- package/dist/components/StartPanel/StartPanel.js.map +1 -1
- package/dist/components/Typing/Typing.d.ts +1 -0
- package/dist/components/Typing/Typing.js +49 -47
- package/dist/components/Typing/Typing.js.map +1 -1
- package/dist/components/UploadButton/UploadButton.css +544 -0
- package/dist/components/UploadButton/UploadButton.d.ts +19 -0
- package/dist/components/UploadButton/UploadButton.js +226 -0
- package/dist/components/UploadButton/UploadButton.js.map +1 -0
- package/dist/components/UploadButton/UploadDocuments/UploadDocuments.d.ts +31 -0
- package/dist/components/UploadButton/UploadDocuments/UploadDocuments.js +244 -0
- package/dist/components/UploadButton/UploadDocuments/UploadDocuments.js.map +1 -0
- package/dist/components/UploadButton/UploadImages/UploadImages.d.ts +20 -0
- package/dist/components/UploadButton/UploadImages/UploadImages.js +172 -0
- package/dist/components/UploadButton/UploadImages/UploadImages.js.map +1 -0
- package/dist/components/UploadMenu/UploadMenu.css +3 -3
- package/dist/components/VenueWidget/VenueWidget.css +7 -0
- package/dist/components/VenueWidget/VenueWidget.d.ts +1 -0
- package/dist/components/VenueWidget/VenueWidget.js +1 -1
- package/dist/components/VenueWidget/VenueWidget.js.map +1 -1
- package/dist/components/WhyThisAnswer/WhyThisAnswer.css +43 -0
- package/dist/components/WhyThisAnswer/WhyThisAnswer.d.ts +4 -2
- package/dist/components/WhyThisAnswer/WhyThisAnswer.js +5 -6
- package/dist/components/WhyThisAnswer/WhyThisAnswer.js.map +1 -1
- package/dist/components/icons/AI.d.ts +1 -0
- package/dist/components/icons/Alert.d.ts +6 -0
- package/dist/components/icons/Alert.js +6 -0
- package/dist/components/icons/Alert.js.map +1 -0
- package/dist/components/icons/ArrowUp.d.ts +6 -0
- package/dist/components/icons/ArrowUp.js +6 -0
- package/dist/components/icons/ArrowUp.js.map +1 -0
- package/dist/components/icons/Bug.d.ts +6 -0
- package/dist/components/icons/Bug.js +6 -0
- package/dist/components/icons/Bug.js.map +1 -0
- package/dist/components/icons/Chat.d.ts +6 -0
- package/dist/components/icons/Chat.js +6 -0
- package/dist/components/icons/Chat.js.map +1 -0
- package/dist/components/icons/ChevronDown.d.ts +6 -0
- package/dist/components/icons/ChevronDown.js +6 -0
- package/dist/components/icons/ChevronDown.js.map +1 -0
- package/dist/components/icons/ChevronLeft.d.ts +1 -0
- package/dist/components/icons/ChevronRight.d.ts +1 -0
- package/dist/components/icons/ChevronUp.d.ts +6 -0
- package/dist/components/icons/ChevronUp.js +6 -0
- package/dist/components/icons/ChevronUp.js.map +1 -0
- package/dist/components/icons/Clear.d.ts +1 -0
- package/dist/components/icons/Close.d.ts +3 -1
- package/dist/components/icons/Close.js +1 -1
- package/dist/components/icons/Close.js.map +1 -1
- package/dist/components/icons/Code.d.ts +6 -0
- package/dist/components/icons/Code.js +6 -0
- package/dist/components/icons/Code.js.map +1 -0
- package/dist/components/icons/Copy.d.ts +1 -0
- package/dist/components/icons/Copy.js +1 -1
- package/dist/components/icons/Copy.js.map +1 -1
- package/dist/components/icons/DeepThought.d.ts +1 -0
- package/dist/components/icons/Delete.d.ts +1 -0
- package/dist/components/icons/Document.d.ts +5 -0
- package/dist/components/icons/Document.js +10 -0
- package/dist/components/icons/Document.js.map +1 -0
- package/dist/components/icons/Download.d.ts +1 -0
- package/dist/components/icons/Edit.d.ts +1 -0
- package/dist/components/icons/Expand.d.ts +1 -0
- package/dist/components/icons/Eye.d.ts +1 -0
- package/dist/components/icons/EyeInvisible.d.ts +1 -0
- package/dist/components/icons/Facebook.d.ts +1 -0
- package/dist/components/icons/Feedback.d.ts +1 -0
- package/dist/components/icons/File.d.ts +1 -0
- package/dist/components/icons/FileExcel.d.ts +1 -0
- package/dist/components/icons/FilePdf.d.ts +1 -0
- package/dist/components/icons/FileWord.d.ts +1 -0
- package/dist/components/icons/Fullscreen.d.ts +1 -0
- package/dist/components/icons/FullscreenExit.d.ts +1 -0
- package/dist/components/icons/Group.d.ts +1 -0
- package/dist/components/icons/History.d.ts +7 -0
- package/dist/components/icons/History.js +6 -0
- package/dist/components/icons/History.js.map +1 -0
- package/dist/components/icons/Image.d.ts +4 -0
- package/dist/components/icons/Image.js +9 -0
- package/dist/components/icons/Image.js.map +1 -0
- package/dist/components/icons/Info.d.ts +6 -0
- package/dist/components/icons/Info.js +6 -0
- package/dist/components/icons/Info.js.map +1 -0
- package/dist/components/icons/Link.d.ts +1 -0
- package/dist/components/icons/Linkedin.d.ts +1 -0
- package/dist/components/icons/Loading.d.ts +1 -0
- package/dist/components/icons/Mail.d.ts +1 -0
- package/dist/components/icons/MapMarker.d.ts +1 -0
- package/dist/components/icons/MenuHorizontal.d.ts +7 -0
- package/dist/components/icons/MenuHorizontal.js +6 -0
- package/dist/components/icons/MenuHorizontal.js.map +1 -0
- package/dist/components/icons/MenuVertical.d.ts +7 -0
- package/dist/components/icons/MenuVertical.js +6 -0
- package/dist/components/icons/MenuVertical.js.map +1 -0
- package/dist/components/icons/Message.d.ts +1 -0
- package/dist/components/icons/Microphone.d.ts +1 -0
- package/dist/components/icons/Minus.d.ts +1 -0
- package/dist/components/icons/MinusCircle.d.ts +1 -0
- package/dist/components/icons/PaperClip.d.ts +1 -0
- package/dist/components/icons/Picture.d.ts +1 -0
- package/dist/components/icons/Plus.d.ts +1 -0
- package/dist/components/icons/Preview.d.ts +4 -0
- package/dist/components/icons/Preview.js +9 -0
- package/dist/components/icons/Preview.js.map +1 -0
- package/dist/components/icons/Print.d.ts +6 -0
- package/dist/components/icons/Print.js +6 -0
- package/dist/components/icons/Print.js.map +1 -0
- package/dist/components/icons/QuestionHelp.d.ts +1 -0
- package/dist/components/icons/Refresh.d.ts +1 -0
- package/dist/components/icons/SelectIcon.d.ts +1 -0
- package/dist/components/icons/Send.d.ts +1 -0
- package/dist/components/icons/Setting.d.ts +1 -0
- package/dist/components/icons/Share.d.ts +1 -0
- package/dist/components/icons/Sound.d.ts +1 -0
- package/dist/components/icons/SoundDeactivated.d.ts +1 -0
- package/dist/components/icons/Telegram.d.ts +1 -0
- package/dist/components/icons/ThumbDown.d.ts +1 -0
- package/dist/components/icons/ThumbUp.d.ts +1 -0
- package/dist/components/icons/Translation.d.ts +1 -0
- package/dist/components/icons/Twitter.d.ts +1 -0
- package/dist/components/icons/Upload.d.ts +4 -0
- package/dist/components/icons/Upload.js +9 -0
- package/dist/components/icons/Upload.js.map +1 -0
- package/dist/components/icons/User.d.ts +1 -0
- package/dist/components/icons/Warning.d.ts +1 -0
- package/dist/components/icons/Warning.js +1 -1
- package/dist/components/icons/Warning.js.map +1 -1
- package/dist/components/icons/WhatsApp.d.ts +1 -0
- package/dist/components/layouts/Chat.js +9 -1
- package/dist/components/layouts/Chat.js.map +1 -1
- package/dist/components/layouts/FullPage.js +10 -1
- package/dist/components/layouts/FullPage.js.map +1 -1
- package/dist/components/layouts/HiddenChat.d.ts +4 -0
- package/dist/components/layouts/HiddenChat.js +147 -0
- package/dist/components/layouts/HiddenChat.js.map +1 -0
- package/dist/components/layouts/Totem.js +1 -1
- package/dist/components/layouts/Totem.js.map +1 -1
- package/dist/components/layouts/WebsiteAssistant.js +2 -2
- package/dist/components/layouts/WebsiteAssistant.js.map +1 -1
- package/dist/components/layouts/ZoomedFullBody.d.ts +4 -0
- package/dist/components/layouts/ZoomedFullBody.js +17 -0
- package/dist/components/layouts/ZoomedFullBody.js.map +1 -0
- package/dist/components/layouts/chat.css +358 -19
- package/dist/components/layouts/hidden-chat.css +254 -0
- package/dist/components/layouts/totem.css +19 -10
- package/dist/components/layouts/website-assistant.css +2 -2
- package/dist/components/layouts/zoomed-full-body.css +18 -0
- package/dist/components/ui/Alert.css +93 -0
- package/dist/components/ui/Alert.d.ts +18 -0
- package/dist/components/ui/Alert.js +42 -0
- package/dist/components/ui/Alert.js.map +1 -0
- package/dist/components/ui/Button.css +8 -2
- package/dist/components/ui/Button.d.ts +1 -0
- package/dist/components/ui/Button.js +2 -1
- package/dist/components/ui/Button.js.map +1 -1
- package/dist/components/ui/Card.css +5 -0
- package/dist/components/ui/Card.d.ts +1 -0
- package/dist/components/ui/Card.js +2 -1
- package/dist/components/ui/Card.js.map +1 -1
- package/dist/components/ui/ConfirmDialog.css +42 -0
- package/dist/components/ui/ConfirmDialog.d.ts +11 -0
- package/dist/components/ui/ConfirmDialog.js +12 -0
- package/dist/components/ui/ConfirmDialog.js.map +1 -0
- package/dist/components/ui/Drawer.css +121 -96
- package/dist/components/ui/Drawer.d.ts +17 -6
- package/dist/components/ui/Drawer.js +44 -13
- package/dist/components/ui/Drawer.js.map +1 -1
- package/dist/components/ui/Expandable.d.ts +3 -2
- package/dist/components/ui/Expandable.js +35 -20
- package/dist/components/ui/Expandable.js.map +1 -1
- package/dist/components/ui/Select.d.ts +1 -0
- package/dist/components/ui/Slider.css +192 -0
- package/dist/components/ui/Slider.d.ts +12 -0
- package/dist/components/ui/Slider.js +78 -0
- package/dist/components/ui/Slider.js.map +1 -0
- package/dist/components/ui/Table.css +15 -2
- package/dist/context/visemeContext.d.ts +24 -0
- package/dist/context/visemeContext.js +192 -0
- package/dist/context/visemeContext.js.map +1 -0
- package/dist/helpers/configuration.js +0 -1
- package/dist/helpers/configuration.js.map +1 -1
- package/dist/helpers/constants.d.ts +6 -0
- package/dist/helpers/constants.js +7 -1
- package/dist/helpers/constants.js.map +1 -1
- package/dist/helpers/error.js +53 -6
- package/dist/helpers/error.js.map +1 -1
- package/dist/helpers/markedExtendedTables.js +1 -1
- package/dist/helpers/markedExtendedTables.js.map +1 -1
- package/dist/helpers/message.d.ts +5 -0
- package/dist/helpers/message.js +98 -0
- package/dist/helpers/message.js.map +1 -0
- package/dist/helpers/sanitizer.d.ts +1 -0
- package/dist/helpers/sanitizer.js +9 -0
- package/dist/helpers/sanitizer.js.map +1 -0
- package/dist/helpers/statistics.d.ts +1 -12
- package/dist/helpers/statistics.js +1 -165
- package/dist/helpers/statistics.js.map +1 -1
- package/dist/helpers/stt/useSTT.d.ts +40 -0
- package/dist/helpers/stt/useSTT.js +527 -0
- package/dist/helpers/stt/useSTT.js.map +1 -0
- package/dist/helpers/translations.js +23 -4
- package/dist/helpers/translations.js.map +1 -1
- package/dist/helpers/tts/ttsVoiceUtility.d.ts +158 -0
- package/dist/helpers/tts/ttsVoiceUtility.js +192 -0
- package/dist/helpers/tts/ttsVoiceUtility.js.map +1 -0
- package/dist/helpers/tts/useTTS.d.ts +27 -0
- package/dist/helpers/tts/useTTS.js +297 -0
- package/dist/helpers/tts/useTTS.js.map +1 -0
- package/dist/helpers/utils.d.ts +40 -0
- package/dist/helpers/utils.js +157 -1
- package/dist/helpers/utils.js.map +1 -1
- package/dist/i18n.js +13 -1
- package/dist/i18n.js.map +1 -1
- package/dist/index.d.ts +14 -4
- package/dist/index.js +136 -84
- package/dist/index.js.map +1 -1
- package/dist/locales/de.json +593 -0
- package/dist/locales/en.json +250 -40
- package/dist/locales/es.json +593 -0
- package/dist/locales/fr.json +603 -0
- package/dist/locales/it.json +260 -48
- package/dist/styles.css +18 -2
- package/esm/I18nWrapper.js +4 -48
- package/esm/I18nWrapper.js.map +1 -1
- package/esm/components/AccountForm/AccountForm.d.ts +4 -2
- package/esm/components/AccountForm/AccountForm.js +2 -4
- package/esm/components/AccountForm/AccountForm.js.map +1 -1
- package/esm/components/AgeVerificationModal/AgeVerificationModal.css +1 -1
- package/esm/components/AgeVerificationModal/AgeVerificationModal.d.ts +1 -0
- package/esm/components/AgeVerificationModal/AgeVerificationModal.js +1 -1
- package/esm/components/AgeVerificationModal/AgeVerificationModal.js.map +1 -1
- package/esm/components/AttachmentLinkModal/AttachmentLinkModal.d.ts +1 -0
- package/esm/components/Auth/Auth.d.ts +1 -0
- package/esm/components/Avatar/Avatar.css +2 -2
- package/esm/components/Avatar/Avatar.d.ts +7 -0
- package/esm/components/Avatar/Avatar.js +72 -62
- package/esm/components/Avatar/Avatar.js.map +1 -1
- package/esm/components/Avatar/AvatarView/AvatarComponent/Shadow/DynamicShadow.d.ts +7 -0
- package/esm/components/Avatar/AvatarView/AvatarComponent/Shadow/DynamicShadow.js +60 -0
- package/esm/components/Avatar/AvatarView/AvatarComponent/Shadow/DynamicShadow.js.map +1 -0
- package/esm/components/Avatar/AvatarView/AvatarComponent/avatarComponent.d.ts +22 -0
- package/esm/components/Avatar/AvatarView/AvatarComponent/avatarComponent.js +36 -0
- package/esm/components/Avatar/AvatarView/AvatarComponent/avatarComponent.js.map +1 -0
- package/esm/components/Avatar/AvatarView/AvatarComponent/components/FullbodyAvatar/fullbodyAvatar.d.ts +18 -0
- package/esm/components/Avatar/AvatarView/AvatarComponent/components/FullbodyAvatar/fullbodyAvatar.js +180 -0
- package/esm/components/Avatar/AvatarView/AvatarComponent/components/FullbodyAvatar/fullbodyAvatar.js.map +1 -0
- package/esm/components/Avatar/AvatarView/AvatarComponent/components/FullbodyAvatar/types.d.ts +39 -0
- package/esm/components/Avatar/AvatarView/AvatarComponent/components/FullbodyAvatar/types.js +7 -0
- package/esm/components/Avatar/AvatarView/AvatarComponent/components/FullbodyAvatar/types.js.map +1 -0
- package/esm/components/Avatar/AvatarView/AvatarComponent/components/controllers/AvatarAnimator.d.ts +65 -0
- package/esm/components/Avatar/AvatarView/AvatarComponent/components/controllers/AvatarAnimator.js +743 -0
- package/esm/components/Avatar/AvatarView/AvatarComponent/components/controllers/AvatarAnimator.js.map +1 -0
- package/esm/components/Avatar/AvatarView/AvatarComponent/components/controllers/AvatarPositionController.d.ts +19 -0
- package/esm/components/Avatar/AvatarView/AvatarComponent/components/controllers/AvatarPositionController.js +56 -0
- package/esm/components/Avatar/AvatarView/AvatarComponent/components/controllers/AvatarPositionController.js.map +1 -0
- package/esm/components/Avatar/AvatarView/AvatarComponent/components/controllers/MorphTargetController.d.ts +24 -0
- package/esm/components/Avatar/AvatarView/AvatarComponent/components/controllers/MorphTargetController.js +129 -0
- package/esm/components/Avatar/AvatarView/AvatarComponent/components/controllers/MorphTargetController.js.map +1 -0
- package/esm/components/Avatar/AvatarView/AvatarComponent/components/controls.d.ts +26 -0
- package/esm/components/Avatar/AvatarView/AvatarComponent/components/controls.js +56 -0
- package/esm/components/Avatar/AvatarView/AvatarComponent/components/controls.js.map +1 -0
- package/esm/components/Avatar/AvatarView/AvatarComponent/components/halfbodyAvatar.d.ts +15 -0
- package/esm/components/Avatar/AvatarView/AvatarComponent/components/halfbodyAvatar.js +79 -0
- package/esm/components/Avatar/AvatarView/AvatarComponent/components/halfbodyAvatar.js.map +1 -0
- package/esm/components/{AvatarView → Avatar/AvatarView/AvatarComponent}/components/loader.d.ts +1 -0
- package/esm/components/{AvatarView → Avatar/AvatarView/AvatarComponent}/components/loader.js +1 -1
- package/esm/components/Avatar/AvatarView/AvatarComponent/components/loader.js.map +1 -0
- package/esm/components/Avatar/AvatarView/AvatarComponent/constants.d.ts +35 -0
- package/esm/components/Avatar/AvatarView/AvatarComponent/constants.js +96 -0
- package/esm/components/Avatar/AvatarView/AvatarComponent/constants.js.map +1 -0
- package/esm/components/Avatar/AvatarView/AvatarComponent/lights/Lights.d.ts +27 -0
- package/esm/components/Avatar/AvatarView/AvatarComponent/lights/Lights.js +48 -0
- package/esm/components/Avatar/AvatarView/AvatarComponent/lights/Lights.js.map +1 -0
- package/esm/components/Avatar/AvatarView/AvatarComponent/positionControls/positionControls.css +111 -0
- package/esm/components/Avatar/AvatarView/AvatarComponent/positionControls/positionControls.d.ts +11 -0
- package/esm/components/Avatar/AvatarView/AvatarComponent/positionControls/positionControls.js +107 -0
- package/esm/components/Avatar/AvatarView/AvatarComponent/positionControls/positionControls.js.map +1 -0
- package/esm/components/Avatar/AvatarView/index.d.ts +30 -0
- package/esm/components/Avatar/AvatarView/index.js +64 -0
- package/esm/components/Avatar/AvatarView/index.js.map +1 -0
- package/esm/components/Avatar/AvatarView/utils/hideHands.d.ts +2 -0
- package/esm/components/Avatar/AvatarView/utils/hideHands.js +10 -0
- package/esm/components/Avatar/AvatarView/utils/hideHands.js.map +1 -0
- package/esm/components/Avatar/AvatarView/utils/useEyeBlink.d.ts +16 -0
- package/esm/components/Avatar/AvatarView/utils/useEyeBlink.js +67 -0
- package/esm/components/Avatar/AvatarView/utils/useEyeBlink.js.map +1 -0
- package/esm/components/Avatar/AvatarView/utils/useHeadMovement.js.map +1 -0
- package/esm/components/Avatar/AvatarView/utils/useLoadingMorphAnim.js.map +1 -0
- package/esm/components/Avatar/AvatarView/utils/useMouthAnimation.d.ts +16 -0
- package/esm/components/Avatar/AvatarView/utils/useMouthAnimation.js +55 -0
- package/esm/components/Avatar/AvatarView/utils/useMouthAnimation.js.map +1 -0
- package/esm/components/Avatar/AvatarView/utils/useSmile.js +25 -0
- package/esm/components/Avatar/AvatarView/utils/useSmile.js.map +1 -0
- package/esm/components/Avatar/AvatarView/utils/utils.js.map +1 -0
- package/esm/components/Blob/Blob.d.ts +1 -0
- package/esm/components/BlockedMemoriBadge/BlockedMemoriBadge.d.ts +1 -0
- package/esm/components/Chat/Chat.d.ts +15 -7
- package/esm/components/Chat/Chat.js +49 -30
- package/esm/components/Chat/Chat.js.map +1 -1
- package/esm/components/ChatBubble/ChatBubble.css +91 -14
- package/esm/components/ChatBubble/ChatBubble.d.ts +14 -0
- package/esm/components/ChatBubble/ChatBubble.js +93 -68
- package/esm/components/ChatBubble/ChatBubble.js.map +1 -1
- package/esm/components/ChatHistoryDrawer/ChatHistory.css +414 -0
- package/esm/components/ChatHistoryDrawer/ChatHistory.d.ts +20 -0
- package/esm/components/ChatHistoryDrawer/ChatHistory.js +627 -0
- package/esm/components/ChatHistoryDrawer/ChatHistory.js.map +1 -0
- package/esm/components/ChatInputs/ChatInputs.d.ts +9 -3
- package/esm/components/ChatInputs/ChatInputs.js +48 -7
- package/esm/components/ChatInputs/ChatInputs.js.map +1 -1
- package/esm/components/ChatTextArea/ChatTextArea.css +9 -5
- package/esm/components/ChatTextArea/ChatTextArea.js +1 -1
- package/esm/components/ChatTextArea/ChatTextArea.js.map +1 -1
- package/esm/components/CompletionProviderStatus/CompletionProviderStatus.css +35 -17
- package/esm/components/CompletionProviderStatus/CompletionProviderStatus.d.ts +5 -3
- package/esm/components/CompletionProviderStatus/CompletionProviderStatus.js +143 -29
- package/esm/components/CompletionProviderStatus/CompletionProviderStatus.js.map +1 -1
- package/esm/components/CustomGLBModelViewer/ModelViewer.d.ts +1 -0
- package/esm/components/ExpertsDrawer/ExpertsDrawer.d.ts +1 -0
- package/esm/components/ExpertsDrawer/ExpertsDrawer.js +2 -2
- package/esm/components/ExpertsDrawer/ExpertsDrawer.js.map +1 -1
- package/esm/components/FeedbackButtons/FeedbackButtons.d.ts +1 -0
- package/esm/components/FilePreview/FilePreview.css +184 -0
- package/esm/components/FilePreview/FilePreview.d.ts +9 -0
- package/esm/components/FilePreview/FilePreview.js +71 -0
- package/esm/components/FilePreview/FilePreview.js.map +1 -0
- package/esm/components/Header/Header.css +3 -3
- package/esm/components/Header/Header.d.ts +5 -1
- package/esm/components/Header/Header.js +27 -13
- package/esm/components/Header/Header.js.map +1 -1
- package/esm/components/KnownFacts/KnownFacts.d.ts +4 -2
- package/esm/components/KnownFacts/KnownFacts.js +3 -5
- package/esm/components/KnownFacts/KnownFacts.js.map +1 -1
- package/esm/components/LoginDrawer/LoginDrawer.css +302 -0
- package/esm/components/LoginDrawer/LoginDrawer.d.ts +4 -2
- package/esm/components/LoginDrawer/LoginDrawer.js +9 -11
- package/esm/components/LoginDrawer/LoginDrawer.js.map +1 -1
- package/esm/components/MediaWidget/LinkItemWidget.css +10 -0
- package/esm/components/MediaWidget/LinkItemWidget.d.ts +1 -0
- package/esm/components/MediaWidget/LinkItemWidget.js +5 -2
- package/esm/components/MediaWidget/LinkItemWidget.js.map +1 -1
- package/esm/components/MediaWidget/MediaItemWidget.css +153 -3
- package/esm/components/MediaWidget/MediaItemWidget.d.ts +7 -2
- package/esm/components/MediaWidget/MediaItemWidget.js +90 -38
- package/esm/components/MediaWidget/MediaItemWidget.js.map +1 -1
- package/esm/components/MediaWidget/MediaWidget.d.ts +4 -1
- package/esm/components/MediaWidget/MediaWidget.js +2 -2
- package/esm/components/MediaWidget/MediaWidget.js.map +1 -1
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.css +163 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.d.ts +12 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.js +130 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.js.map +1 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/components/CopyButtonWithDropdown.d.ts +4 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/components/CopyButtonWithDropdown.js +283 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/components/CopyButtonWithDropdown.js.map +1 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/components/CopyMenuItem.d.ts +6 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/components/CopyMenuItem.js +37 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/components/CopyMenuItem.js.map +1 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/hooks/useCopyArtifact.d.ts +6 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/hooks/useCopyArtifact.js +487 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/hooks/useCopyArtifact.js.map +1 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/index.d.ts +5 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/index.js +6 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/index.js.map +1 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/styles.css +489 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/test/CopyButtonTest.d.ts +3 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/test/CopyButtonTest.js +62 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/test/CopyButtonTest.js.map +1 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/types.d.ts +61 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/types.js +2 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/types.js.map +1 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/utils/PDFExporter.d.ts +15 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/utils/PDFExporter.js +348 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/utils/PDFExporter.js.map +1 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.css +1059 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.d.ts +5 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js +164 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js.map +1 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/components/TabSwitch.css +150 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/components/TabSwitch.d.ts +9 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/components/TabSwitch.js +32 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/components/TabSwitch.js.map +1 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.css +253 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.d.ts +8 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.js +101 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.js.map +1 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.css +346 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.d.ts +7 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.js +86 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.js.map +1 -0
- package/esm/components/MemoriArtifactSystem/context/ArtifactContext.d.ts +13 -0
- package/esm/components/MemoriArtifactSystem/context/ArtifactContext.js +50 -0
- package/esm/components/MemoriArtifactSystem/context/ArtifactContext.js.map +1 -0
- package/esm/components/MemoriArtifactSystem/types/artifact.types.d.ts +14 -0
- package/esm/components/MemoriArtifactSystem/types/artifact.types.js +2 -0
- package/esm/components/MemoriArtifactSystem/types/artifact.types.js.map +1 -0
- package/esm/components/MemoriWidget/MemoriWidget.css +10 -4
- package/esm/components/MemoriWidget/MemoriWidget.d.ts +29 -11
- package/esm/components/MemoriWidget/MemoriWidget.js +766 -1054
- package/esm/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/esm/components/MicrophoneButton/MicrophoneButton.d.ts +1 -0
- package/esm/components/MicrophoneButton/MicrophoneButton.js +1 -1
- package/esm/components/MicrophoneButton/MicrophoneButton.js.map +1 -1
- package/esm/components/PositionDrawer/PositionDrawer.d.ts +1 -0
- package/esm/components/PoweredBy/PoweredBy.d.ts +1 -0
- package/esm/components/SendOnEnterMenu/SendOnEnterMenu.css +3 -3
- package/esm/components/SettingsDrawer/SettingsDrawer.css +9 -2
- package/esm/components/SettingsDrawer/SettingsDrawer.d.ts +8 -1
- package/esm/components/SettingsDrawer/SettingsDrawer.js +15 -6
- package/esm/components/SettingsDrawer/SettingsDrawer.js.map +1 -1
- package/esm/components/ShareButton/ShareButton.css +6 -0
- package/esm/components/ShareButton/ShareButton.d.ts +3 -1
- package/esm/components/ShareButton/ShareButton.js +14 -3
- package/esm/components/ShareButton/ShareButton.js.map +1 -1
- package/esm/components/SignupForm/SignupForm.d.ts +4 -2
- package/esm/components/SignupForm/SignupForm.js +6 -8
- package/esm/components/SignupForm/SignupForm.js.map +1 -1
- package/esm/components/Snippet/Snippet.d.ts +2 -2
- package/esm/components/Snippet/Snippet.js +36 -25
- package/esm/components/Snippet/Snippet.js.map +1 -1
- package/esm/components/StartPanel/StartPanel.css +34 -8
- package/esm/components/StartPanel/StartPanel.d.ts +8 -3
- package/esm/components/StartPanel/StartPanel.js +26 -15
- package/esm/components/StartPanel/StartPanel.js.map +1 -1
- package/esm/components/Typing/Typing.d.ts +1 -0
- package/esm/components/Typing/Typing.js +49 -47
- package/esm/components/Typing/Typing.js.map +1 -1
- package/esm/components/UploadButton/UploadButton.css +544 -0
- package/esm/components/UploadButton/UploadButton.d.ts +19 -0
- package/esm/components/UploadButton/UploadButton.js +223 -0
- package/esm/components/UploadButton/UploadButton.js.map +1 -0
- package/esm/components/UploadButton/UploadDocuments/UploadDocuments.d.ts +31 -0
- package/esm/components/UploadButton/UploadDocuments/UploadDocuments.js +241 -0
- package/esm/components/UploadButton/UploadDocuments/UploadDocuments.js.map +1 -0
- package/esm/components/UploadButton/UploadImages/UploadImages.d.ts +20 -0
- package/esm/components/UploadButton/UploadImages/UploadImages.js +169 -0
- package/esm/components/UploadButton/UploadImages/UploadImages.js.map +1 -0
- package/esm/components/UploadMenu/UploadMenu.css +3 -3
- package/esm/components/VenueWidget/VenueWidget.css +7 -0
- package/esm/components/VenueWidget/VenueWidget.d.ts +1 -0
- package/esm/components/VenueWidget/VenueWidget.js +1 -1
- package/esm/components/VenueWidget/VenueWidget.js.map +1 -1
- package/esm/components/WhyThisAnswer/WhyThisAnswer.css +43 -0
- package/esm/components/WhyThisAnswer/WhyThisAnswer.d.ts +4 -2
- package/esm/components/WhyThisAnswer/WhyThisAnswer.js +5 -6
- package/esm/components/WhyThisAnswer/WhyThisAnswer.js.map +1 -1
- package/esm/components/icons/AI.d.ts +1 -0
- package/esm/components/icons/Alert.d.ts +6 -0
- package/esm/components/icons/Alert.js +4 -0
- package/esm/components/icons/Alert.js.map +1 -0
- package/esm/components/icons/ArrowUp.d.ts +6 -0
- package/esm/components/icons/ArrowUp.js +4 -0
- package/esm/components/icons/ArrowUp.js.map +1 -0
- package/esm/components/icons/Bug.d.ts +6 -0
- package/esm/components/icons/Bug.js +4 -0
- package/esm/components/icons/Bug.js.map +1 -0
- package/esm/components/icons/Chat.d.ts +6 -0
- package/esm/components/icons/Chat.js +4 -0
- package/esm/components/icons/Chat.js.map +1 -0
- package/esm/components/icons/ChevronDown.d.ts +6 -0
- package/esm/components/icons/ChevronDown.js +4 -0
- package/esm/components/icons/ChevronDown.js.map +1 -0
- package/esm/components/icons/ChevronLeft.d.ts +1 -0
- package/esm/components/icons/ChevronRight.d.ts +1 -0
- package/esm/components/icons/ChevronUp.d.ts +6 -0
- package/esm/components/icons/ChevronUp.js +4 -0
- package/esm/components/icons/ChevronUp.js.map +1 -0
- package/esm/components/icons/Clear.d.ts +1 -0
- package/esm/components/icons/Close.d.ts +3 -1
- package/esm/components/icons/Close.js +1 -1
- package/esm/components/icons/Close.js.map +1 -1
- package/esm/components/icons/Code.d.ts +6 -0
- package/esm/components/icons/Code.js +4 -0
- package/esm/components/icons/Code.js.map +1 -0
- package/esm/components/icons/Copy.d.ts +1 -0
- package/esm/components/icons/Copy.js +2 -2
- package/esm/components/icons/Copy.js.map +1 -1
- package/esm/components/icons/DeepThought.d.ts +1 -0
- package/esm/components/icons/Delete.d.ts +1 -0
- package/esm/components/icons/Document.d.ts +5 -0
- package/esm/components/icons/Document.js +6 -0
- package/esm/components/icons/Document.js.map +1 -0
- package/esm/components/icons/Download.d.ts +1 -0
- package/esm/components/icons/Edit.d.ts +1 -0
- package/esm/components/icons/Expand.d.ts +1 -0
- package/esm/components/icons/Eye.d.ts +1 -0
- package/esm/components/icons/EyeInvisible.d.ts +1 -0
- package/esm/components/icons/Facebook.d.ts +1 -0
- package/esm/components/icons/Feedback.d.ts +1 -0
- package/esm/components/icons/File.d.ts +1 -0
- package/esm/components/icons/FileExcel.d.ts +1 -0
- package/esm/components/icons/FilePdf.d.ts +1 -0
- package/esm/components/icons/FileWord.d.ts +1 -0
- package/esm/components/icons/Fullscreen.d.ts +1 -0
- package/esm/components/icons/FullscreenExit.d.ts +1 -0
- package/esm/components/icons/Group.d.ts +1 -0
- package/esm/components/icons/History.d.ts +7 -0
- package/esm/components/icons/History.js +4 -0
- package/esm/components/icons/History.js.map +1 -0
- package/esm/components/icons/Image.d.ts +4 -0
- package/esm/components/icons/Image.js +5 -0
- package/esm/components/icons/Image.js.map +1 -0
- package/esm/components/icons/Info.d.ts +6 -0
- package/esm/components/icons/Info.js +4 -0
- package/esm/components/icons/Info.js.map +1 -0
- package/esm/components/icons/Link.d.ts +1 -0
- package/esm/components/icons/Linkedin.d.ts +1 -0
- package/esm/components/icons/Loading.d.ts +1 -0
- package/esm/components/icons/Mail.d.ts +1 -0
- package/esm/components/icons/MapMarker.d.ts +1 -0
- package/esm/components/icons/MenuHorizontal.d.ts +7 -0
- package/esm/components/icons/MenuHorizontal.js +4 -0
- package/esm/components/icons/MenuHorizontal.js.map +1 -0
- package/esm/components/icons/MenuVertical.d.ts +7 -0
- package/esm/components/icons/MenuVertical.js +4 -0
- package/esm/components/icons/MenuVertical.js.map +1 -0
- package/esm/components/icons/Message.d.ts +1 -0
- package/esm/components/icons/Microphone.d.ts +1 -0
- package/esm/components/icons/Minus.d.ts +1 -0
- package/esm/components/icons/MinusCircle.d.ts +1 -0
- package/esm/components/icons/PaperClip.d.ts +1 -0
- package/esm/components/icons/Picture.d.ts +1 -0
- package/esm/components/icons/Plus.d.ts +1 -0
- package/esm/components/icons/Preview.d.ts +4 -0
- package/esm/components/icons/Preview.js +5 -0
- package/esm/components/icons/Preview.js.map +1 -0
- package/esm/components/icons/Print.d.ts +6 -0
- package/esm/components/icons/Print.js +4 -0
- package/esm/components/icons/Print.js.map +1 -0
- package/esm/components/icons/QuestionHelp.d.ts +1 -0
- package/esm/components/icons/Refresh.d.ts +1 -0
- package/esm/components/icons/SelectIcon.d.ts +1 -0
- package/esm/components/icons/Send.d.ts +1 -0
- package/esm/components/icons/Setting.d.ts +1 -0
- package/esm/components/icons/Share.d.ts +1 -0
- package/esm/components/icons/Sound.d.ts +1 -0
- package/esm/components/icons/SoundDeactivated.d.ts +1 -0
- package/esm/components/icons/Telegram.d.ts +1 -0
- package/esm/components/icons/ThumbDown.d.ts +1 -0
- package/esm/components/icons/ThumbUp.d.ts +1 -0
- package/esm/components/icons/Translation.d.ts +1 -0
- package/esm/components/icons/Twitter.d.ts +1 -0
- package/esm/components/icons/Upload.d.ts +4 -0
- package/esm/components/icons/Upload.js +5 -0
- package/esm/components/icons/Upload.js.map +1 -0
- package/esm/components/icons/User.d.ts +1 -0
- package/esm/components/icons/Warning.d.ts +1 -0
- package/esm/components/icons/Warning.js +1 -1
- package/esm/components/icons/Warning.js.map +1 -1
- package/esm/components/icons/WhatsApp.d.ts +1 -0
- package/esm/components/layouts/Chat.js +9 -1
- package/esm/components/layouts/Chat.js.map +1 -1
- package/esm/components/layouts/FullPage.js +10 -1
- package/esm/components/layouts/FullPage.js.map +1 -1
- package/esm/components/layouts/HiddenChat.d.ts +4 -0
- package/esm/components/layouts/HiddenChat.js +144 -0
- package/esm/components/layouts/HiddenChat.js.map +1 -0
- package/esm/components/layouts/Totem.js +1 -1
- package/esm/components/layouts/Totem.js.map +1 -1
- package/esm/components/layouts/WebsiteAssistant.js +2 -2
- package/esm/components/layouts/WebsiteAssistant.js.map +1 -1
- package/esm/components/layouts/ZoomedFullBody.d.ts +4 -0
- package/esm/components/layouts/ZoomedFullBody.js +14 -0
- package/esm/components/layouts/ZoomedFullBody.js.map +1 -0
- package/esm/components/layouts/chat.css +358 -19
- package/esm/components/layouts/hidden-chat.css +254 -0
- package/esm/components/layouts/totem.css +19 -10
- package/esm/components/layouts/website-assistant.css +2 -2
- package/esm/components/layouts/zoomed-full-body.css +18 -0
- package/esm/components/ui/Alert.css +93 -0
- package/esm/components/ui/Alert.d.ts +18 -0
- package/esm/components/ui/Alert.js +39 -0
- package/esm/components/ui/Alert.js.map +1 -0
- package/esm/components/ui/Button.css +8 -2
- package/esm/components/ui/Button.d.ts +1 -0
- package/esm/components/ui/Button.js +2 -1
- package/esm/components/ui/Button.js.map +1 -1
- package/esm/components/ui/Card.css +5 -0
- package/esm/components/ui/Card.d.ts +1 -0
- package/esm/components/ui/Card.js +2 -1
- package/esm/components/ui/Card.js.map +1 -1
- package/esm/components/ui/ConfirmDialog.css +42 -0
- package/esm/components/ui/ConfirmDialog.d.ts +11 -0
- package/esm/components/ui/ConfirmDialog.js +9 -0
- package/esm/components/ui/ConfirmDialog.js.map +1 -0
- package/esm/components/ui/Drawer.css +121 -96
- package/esm/components/ui/Drawer.d.ts +17 -6
- package/esm/components/ui/Drawer.js +45 -14
- package/esm/components/ui/Drawer.js.map +1 -1
- package/esm/components/ui/Expandable.d.ts +3 -2
- package/esm/components/ui/Expandable.js +35 -20
- package/esm/components/ui/Expandable.js.map +1 -1
- package/esm/components/ui/Select.d.ts +1 -0
- package/esm/components/ui/Slider.css +192 -0
- package/esm/components/ui/Slider.d.ts +12 -0
- package/esm/components/ui/Slider.js +75 -0
- package/esm/components/ui/Slider.js.map +1 -0
- package/esm/components/ui/Table.css +15 -2
- package/esm/context/visemeContext.d.ts +24 -0
- package/esm/context/visemeContext.js +187 -0
- package/esm/context/visemeContext.js.map +1 -0
- package/esm/helpers/configuration.js +0 -1
- package/esm/helpers/configuration.js.map +1 -1
- package/esm/helpers/constants.d.ts +6 -0
- package/esm/helpers/constants.js +6 -0
- package/esm/helpers/constants.js.map +1 -1
- package/esm/helpers/error.js +53 -6
- package/esm/helpers/error.js.map +1 -1
- package/esm/helpers/markedExtendedTables.js +1 -1
- package/esm/helpers/markedExtendedTables.js.map +1 -1
- package/esm/helpers/message.d.ts +5 -0
- package/esm/helpers/message.js +91 -0
- package/esm/helpers/message.js.map +1 -0
- package/esm/helpers/sanitizer.d.ts +1 -0
- package/esm/helpers/sanitizer.js +5 -0
- package/esm/helpers/sanitizer.js.map +1 -0
- package/esm/helpers/statistics.d.ts +1 -12
- package/esm/helpers/statistics.js +0 -156
- package/esm/helpers/statistics.js.map +1 -1
- package/esm/helpers/stt/useSTT.d.ts +40 -0
- package/esm/helpers/stt/useSTT.js +523 -0
- package/esm/helpers/stt/useSTT.js.map +1 -0
- package/esm/helpers/translations.js +23 -4
- package/esm/helpers/translations.js.map +1 -1
- package/esm/helpers/tts/ttsVoiceUtility.d.ts +158 -0
- package/esm/helpers/tts/ttsVoiceUtility.js +182 -0
- package/esm/helpers/tts/ttsVoiceUtility.js.map +1 -0
- package/esm/helpers/tts/useTTS.d.ts +27 -0
- package/esm/helpers/tts/useTTS.js +293 -0
- package/esm/helpers/tts/useTTS.js.map +1 -0
- package/esm/helpers/utils.d.ts +40 -0
- package/esm/helpers/utils.js +143 -0
- package/esm/helpers/utils.js.map +1 -1
- package/esm/i18n.js +13 -1
- package/esm/i18n.js.map +1 -1
- package/esm/index.d.ts +14 -4
- package/esm/index.js +137 -85
- package/esm/index.js.map +1 -1
- package/esm/locales/de.json +593 -0
- package/esm/locales/en.json +250 -40
- package/esm/locales/es.json +593 -0
- package/esm/locales/fr.json +603 -0
- package/esm/locales/it.json +260 -48
- package/esm/styles.css +18 -2
- package/package.json +12 -13
- package/src/I18nWrapper.tsx +3 -60
- package/src/__snapshots__/index.test.tsx.snap +60 -0
- package/src/components/AccountForm/AccountForm.test.tsx +2 -1
- package/src/components/AccountForm/AccountForm.tsx +3 -5
- package/src/components/AgeVerificationModal/AgeVerificationModal.css +1 -1
- package/src/components/AgeVerificationModal/AgeVerificationModal.tsx +1 -1
- package/src/components/Avatar/Avatar.css +2 -2
- package/src/components/Avatar/Avatar.test.tsx +39 -20
- package/src/components/Avatar/Avatar.tsx +175 -145
- package/src/components/Avatar/AvatarView/AvatarComponent/Shadow/DynamicShadow.tsx +103 -0
- package/src/components/Avatar/AvatarView/AvatarComponent/avatarComponent.tsx +106 -0
- package/src/components/Avatar/AvatarView/AvatarComponent/components/FullbodyAvatar/fullbodyAvatar.tsx +348 -0
- package/src/components/Avatar/AvatarView/AvatarComponent/components/FullbodyAvatar/types.ts +44 -0
- package/src/components/Avatar/AvatarView/AvatarComponent/components/controllers/AvatarAnimator.ts +1250 -0
- package/src/components/Avatar/AvatarView/AvatarComponent/components/controllers/AvatarPositionController.ts +83 -0
- package/src/components/Avatar/AvatarView/AvatarComponent/components/controllers/MorphTargetController.ts +301 -0
- package/src/components/Avatar/AvatarView/AvatarComponent/components/controls.tsx +100 -0
- package/src/components/Avatar/AvatarView/AvatarComponent/components/halfbodyAvatar.tsx +152 -0
- package/src/components/{AvatarView → Avatar/AvatarView/AvatarComponent}/components/loader.tsx +1 -1
- package/src/components/Avatar/AvatarView/AvatarComponent/constants.ts +128 -0
- package/src/components/Avatar/AvatarView/AvatarComponent/lights/Lights.tsx +145 -0
- package/src/components/Avatar/AvatarView/AvatarComponent/positionControls/positionControls.css +111 -0
- package/src/components/Avatar/AvatarView/AvatarComponent/positionControls/positionControls.tsx +201 -0
- package/src/components/{AvatarView → Avatar/AvatarView}/AvatarView.stories.tsx +41 -7
- package/src/components/Avatar/AvatarView/index.tsx +194 -0
- package/src/components/Avatar/AvatarView/utils/hideHands.ts +11 -0
- package/src/components/Avatar/AvatarView/utils/useEyeBlink.ts +100 -0
- package/src/components/Avatar/AvatarView/utils/useMouthAnimation.ts +93 -0
- package/src/components/Avatar/AvatarView/utils/useSmile.ts +39 -0
- package/src/components/Avatar/__snapshots__/Avatar.test.tsx.snap +32 -93
- package/src/components/BlockedMemoriBadge/__snapshots__/BlockedMemoriBadge.test.tsx.snap +10 -0
- package/src/components/Chat/Chat.stories.tsx +498 -2
- package/src/components/Chat/Chat.test.tsx +241 -301
- package/src/components/Chat/Chat.tsx +120 -58
- package/src/components/Chat/__snapshots__/Chat.test.tsx.snap +1756 -1222
- package/src/components/ChatBubble/ChatBubble.css +91 -14
- package/src/components/ChatBubble/ChatBubble.stories.tsx +759 -16
- package/src/components/ChatBubble/ChatBubble.test.tsx +217 -2
- package/src/components/ChatBubble/ChatBubble.tsx +242 -90
- package/src/components/ChatBubble/__snapshots__/ChatBubble.test.tsx.snap +7728 -254
- package/src/components/ChatHistoryDrawer/ChatHistory.css +414 -0
- package/src/components/ChatHistoryDrawer/ChatHistory.stories.tsx +361 -0
- package/src/components/ChatHistoryDrawer/ChatHistory.test.tsx +107 -0
- package/src/components/ChatHistoryDrawer/ChatHistory.tsx +1191 -0
- package/src/components/ChatHistoryDrawer/__snapshots__/ChatHistory.test.tsx.snap +27 -0
- package/src/components/ChatInputs/ChatInputs.stories.tsx +5 -0
- package/src/components/ChatInputs/ChatInputs.test.tsx +0 -6
- package/src/components/ChatInputs/ChatInputs.tsx +136 -25
- package/src/components/ChatInputs/__snapshots__/ChatInputs.test.tsx.snap +6 -138
- package/src/components/ChatTextArea/ChatTextArea.css +9 -5
- package/src/components/ChatTextArea/ChatTextArea.tsx +1 -0
- package/src/components/ChatTextArea/__snapshots__/ChatTextArea.test.tsx.snap +3 -0
- package/src/components/CompletionProviderStatus/CompletionProviderStatus.css +35 -17
- package/src/components/CompletionProviderStatus/CompletionProviderStatus.stories.tsx +275 -22
- package/src/components/CompletionProviderStatus/CompletionProviderStatus.test.tsx +6 -4
- package/src/components/CompletionProviderStatus/CompletionProviderStatus.tsx +192 -39
- package/src/components/CompletionProviderStatus/__snapshots__/CompletionProviderStatus.test.tsx.snap +83 -15
- package/src/components/ExpertsDrawer/ExpertsDrawer.tsx +4 -2
- package/src/components/FilePreview/FilePreview.css +184 -0
- package/src/components/FilePreview/FilePreview.stories.tsx +66 -0
- package/src/components/FilePreview/FilePreview.test.tsx +26 -0
- package/src/components/FilePreview/FilePreview.tsx +177 -0
- package/src/components/FilePreview/__snapshots__/FilePreview.test.tsx.snap +275 -0
- package/src/components/Header/Header.css +3 -3
- package/src/components/Header/Header.stories.tsx +21 -1
- package/src/components/Header/Header.test.tsx +38 -1
- package/src/components/Header/Header.tsx +56 -16
- package/src/components/Header/__snapshots__/Header.test.tsx.snap +127 -375
- package/src/components/KnownFacts/KnownFacts.stories.tsx +5 -4
- package/src/components/KnownFacts/KnownFacts.test.tsx +6 -3
- package/src/components/KnownFacts/KnownFacts.tsx +4 -5
- package/src/components/LoginDrawer/LoginDrawer.css +302 -0
- package/src/components/LoginDrawer/LoginDrawer.stories.tsx +27 -1
- package/src/components/LoginDrawer/LoginDrawer.test.tsx +65 -8
- package/src/components/LoginDrawer/LoginDrawer.tsx +12 -13
- package/src/components/LoginDrawer/__snapshots__/LoginDrawer.test.tsx.snap +32 -0
- package/src/components/MediaWidget/LinkItemWidget.css +10 -0
- package/src/components/MediaWidget/LinkItemWidget.tsx +6 -1
- package/src/components/MediaWidget/MediaItemWidget.css +153 -3
- package/src/components/MediaWidget/MediaItemWidget.stories.tsx +6 -0
- package/src/components/MediaWidget/MediaItemWidget.tsx +229 -161
- package/src/components/MediaWidget/MediaWidget.test.tsx +2 -1
- package/src/components/MediaWidget/MediaWidget.tsx +5 -2
- package/src/components/MediaWidget/__snapshots__/LinkItemWidget.test.tsx.snap +4 -4
- package/src/components/MediaWidget/__snapshots__/MediaItemWidget.test.tsx.snap +150 -249
- package/src/components/MediaWidget/__snapshots__/MediaWidget.test.tsx.snap +2 -2
- package/src/components/MemoriArtifactSystem/ArtifactDrawer.stories.tsx +755 -0
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.css +163 -0
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.tsx +250 -0
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/CopyButton.stories.tsx +30 -0
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/components/CopyButtonWithDropdown.tsx +467 -0
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/components/CopyMenuItem.tsx +86 -0
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/hooks/useCopyArtifact.ts +619 -0
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/index.ts +9 -0
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/styles.css +489 -0
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/test/CopyButtonTest.tsx +90 -0
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/types.ts +73 -0
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/utils/PDFExporter.ts +454 -0
- package/src/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.css +1059 -0
- package/src/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.tsx +428 -0
- package/src/components/MemoriArtifactSystem/components/ArtifactDrawer/components/TabSwitch.css +150 -0
- package/src/components/MemoriArtifactSystem/components/ArtifactDrawer/components/TabSwitch.tsx +79 -0
- package/src/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.css +253 -0
- package/src/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.tsx +169 -0
- package/src/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.css +346 -0
- package/src/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.tsx +165 -0
- package/src/components/MemoriArtifactSystem/context/ArtifactContext.tsx +69 -0
- package/src/components/MemoriArtifactSystem/types/artifact.types.ts +16 -0
- package/src/components/MemoriWidget/MemoriWidget.css +10 -4
- package/src/components/MemoriWidget/MemoriWidget.stories.tsx +70 -11
- package/src/components/MemoriWidget/MemoriWidget.tsx +1344 -1349
- package/src/components/MicrophoneButton/MicrophoneButton.tsx +0 -1
- package/src/components/SendOnEnterMenu/SendOnEnterMenu.css +3 -3
- package/src/components/SettingsDrawer/SettingsDrawer.css +9 -2
- package/src/components/SettingsDrawer/SettingsDrawer.test.tsx +24 -0
- package/src/components/SettingsDrawer/SettingsDrawer.tsx +104 -14
- package/src/components/ShareButton/ShareButton.css +6 -0
- package/src/components/ShareButton/ShareButton.stories.tsx +18 -1
- package/src/components/ShareButton/ShareButton.test.tsx +8 -1
- package/src/components/ShareButton/ShareButton.tsx +49 -2
- package/src/components/ShareButton/__snapshots__/ShareButton.test.tsx.snap +35 -0
- package/src/components/SignupForm/SignupForm.test.tsx +3 -2
- package/src/components/SignupForm/SignupForm.tsx +8 -9
- package/src/components/Snippet/Snippet.stories.tsx +0 -8
- package/src/components/Snippet/Snippet.test.tsx +0 -1
- package/src/components/Snippet/Snippet.tsx +55 -36
- package/src/components/Snippet/__snapshots__/Snippet.test.tsx.snap +186 -2560
- package/src/components/StartPanel/StartPanel.css +34 -8
- package/src/components/StartPanel/StartPanel.stories.tsx +58 -23
- package/src/components/StartPanel/StartPanel.test.tsx +50 -17
- package/src/components/StartPanel/StartPanel.tsx +218 -152
- package/src/components/StartPanel/__snapshots__/StartPanel.test.tsx.snap +1340 -171
- package/src/components/Typing/Typing.tsx +52 -47
- package/src/components/UploadButton/UploadButton.css +544 -0
- package/src/components/UploadButton/UploadButton.stories.tsx +164 -0
- package/src/components/UploadButton/UploadButton.test.tsx +11 -0
- package/src/components/UploadButton/UploadButton.tsx +490 -0
- package/src/components/UploadButton/UploadDocuments/UploadDocuments.tsx +422 -0
- package/src/components/UploadButton/UploadImages/UploadImages.tsx +362 -0
- package/src/components/UploadButton/__snapshots__/UploadButton.test.tsx.snap +156 -0
- package/src/components/UploadMenu/UploadMenu.css +3 -3
- package/src/components/VenueWidget/VenueWidget.css +7 -0
- package/src/components/VenueWidget/VenueWidget.tsx +4 -4
- package/src/components/WhyThisAnswer/WhyThisAnswer.css +43 -0
- package/src/components/WhyThisAnswer/WhyThisAnswer.stories.tsx +46 -4
- package/src/components/WhyThisAnswer/WhyThisAnswer.test.tsx +132 -11
- package/src/components/WhyThisAnswer/WhyThisAnswer.tsx +36 -10
- package/src/components/WhyThisAnswer/__snapshots__/WhyThisAnswer.test.tsx.snap +15 -1
- package/src/components/icons/Alert.tsx +31 -0
- package/src/components/icons/ArrowUp.tsx +28 -0
- package/src/components/icons/Bug.tsx +81 -0
- package/src/components/icons/Chat.tsx +30 -0
- package/src/components/icons/ChevronDown.tsx +26 -0
- package/src/components/icons/ChevronUp.tsx +24 -0
- package/src/components/icons/Close.tsx +8 -1
- package/src/components/icons/Code.tsx +24 -0
- package/src/components/icons/Copy.tsx +8 -2
- package/src/components/icons/Document.tsx +50 -0
- package/src/components/icons/History.tsx +33 -0
- package/src/components/icons/Image.tsx +37 -0
- package/src/components/icons/Info.tsx +31 -0
- package/src/components/icons/MenuHorizontal.tsx +29 -0
- package/src/components/icons/MenuVertical.tsx +29 -0
- package/src/components/icons/Preview.tsx +29 -0
- package/src/components/icons/Print.tsx +34 -0
- package/src/components/icons/Upload.tsx +34 -0
- package/src/components/icons/Warning.tsx +2 -1
- package/src/components/icons/icons.stories.tsx +14 -6
- package/src/components/layouts/Chat.test.tsx +18 -10
- package/src/components/layouts/Chat.tsx +51 -31
- package/src/components/layouts/FullPage.test.tsx +42 -9
- package/src/components/layouts/FullPage.tsx +55 -30
- package/src/components/layouts/HiddenChat.test.tsx +40 -0
- package/src/components/layouts/HiddenChat.tsx +252 -0
- package/src/components/layouts/Totem.test.tsx +18 -10
- package/src/components/layouts/Totem.tsx +1 -7
- package/src/components/layouts/WebsiteAssistant.test.tsx +18 -10
- package/src/components/layouts/WebsiteAssistant.tsx +0 -7
- package/src/components/layouts/ZoomedFullBody.test.tsx +40 -0
- package/src/components/layouts/ZoomedFullBody.tsx +81 -0
- package/src/components/layouts/__snapshots__/Chat.test.tsx.snap +287 -197
- package/src/components/layouts/__snapshots__/FullPage.test.tsx.snap +827 -201
- package/src/components/layouts/__snapshots__/HiddenChat.test.tsx.snap +470 -0
- package/src/components/layouts/__snapshots__/Totem.test.tsx.snap +122 -36
- package/src/components/layouts/__snapshots__/WebsiteAssistant.test.tsx.snap +1 -1
- package/src/components/layouts/__snapshots__/ZoomedFullBody.test.tsx.snap +533 -0
- package/src/components/layouts/chat.css +358 -19
- package/src/components/layouts/hidden-chat.css +254 -0
- package/src/components/layouts/layouts.stories.tsx +257 -57
- package/src/components/layouts/totem.css +19 -10
- package/src/components/layouts/website-assistant.css +2 -2
- package/src/components/layouts/zoomed-full-body.css +18 -0
- package/src/components/ui/Alert.css +93 -0
- package/src/components/ui/Alert.stories.tsx +137 -0
- package/src/components/ui/Alert.test.tsx +129 -0
- package/src/components/ui/Alert.tsx +123 -0
- package/src/components/ui/Button.css +8 -2
- package/src/components/ui/Button.tsx +3 -0
- package/src/components/ui/Card.css +5 -0
- package/src/components/ui/Card.tsx +4 -0
- package/src/components/ui/ConfirmDialog.css +42 -0
- package/src/components/ui/ConfirmDialog.stories.tsx +216 -0
- package/src/components/ui/ConfirmDialog.test.tsx +124 -0
- package/src/components/ui/ConfirmDialog.tsx +58 -0
- package/src/components/ui/Drawer.css +121 -96
- package/src/components/ui/Drawer.stories.tsx +152 -67
- package/src/components/ui/Drawer.test.tsx +6 -2
- package/src/components/ui/Drawer.tsx +202 -90
- package/src/components/ui/Expandable.stories.tsx +128 -1
- package/src/components/ui/Expandable.tsx +44 -22
- package/src/components/ui/Slider.css +192 -0
- package/src/components/ui/Slider.stories.tsx +63 -0
- package/src/components/ui/Slider.tsx +142 -0
- package/src/components/ui/Table.css +15 -2
- package/src/components/ui/__snapshots__/Alert.test.tsx.snap +59 -0
- package/src/components/ui/__snapshots__/ConfirmDialog.test.tsx.snap +35 -0
- package/src/context/visemeContext.tsx +391 -0
- package/src/helpers/configuration.ts +0 -1
- package/src/helpers/constants.ts +10 -0
- package/src/helpers/error.ts +58 -6
- package/src/helpers/markedExtendedTables.js +1 -1
- package/src/helpers/message.ts +148 -0
- package/src/helpers/sanitizer.ts +17 -0
- package/src/helpers/statistics.ts +1 -195
- package/src/helpers/stt/useSTT.ts +774 -0
- package/src/helpers/translations.ts +29 -7
- package/src/helpers/tts/ttsVoiceUtility.ts +275 -0
- package/src/helpers/tts/useTTS.ts +464 -0
- package/src/helpers/utils.test.ts +38 -1
- package/src/helpers/utils.ts +200 -0
- package/src/i18n.ts +13 -1
- package/src/index.stories.tsx +266 -23
- package/src/index.test.tsx +130 -0
- package/src/index.tsx +245 -153
- package/src/locales/de.json +621 -0
- package/src/locales/en.json +251 -40
- package/src/locales/es.json +593 -0
- package/src/locales/fr.json +603 -0
- package/src/locales/it.json +262 -48
- package/src/mocks/data.ts +272 -9
- package/src/styles.css +18 -2
- package/dist/components/AttachmentMediaModal/AttachmentMediaModal.d.ts +0 -14
- package/dist/components/AttachmentMediaModal/AttachmentMediaModal.js +0 -66
- package/dist/components/AttachmentMediaModal/AttachmentMediaModal.js.map +0 -1
- package/dist/components/AvatarView/components/avatar.d.ts +0 -9
- package/dist/components/AvatarView/components/avatar.js +0 -35
- package/dist/components/AvatarView/components/avatar.js.map +0 -1
- package/dist/components/AvatarView/components/fullbodyAvatar.d.ts +0 -10
- package/dist/components/AvatarView/components/fullbodyAvatar.js +0 -62
- package/dist/components/AvatarView/components/fullbodyAvatar.js.map +0 -1
- package/dist/components/AvatarView/components/loader.js.map +0 -1
- package/dist/components/AvatarView/index.d.ts +0 -17
- package/dist/components/AvatarView/index.js +0 -35
- package/dist/components/AvatarView/index.js.map +0 -1
- package/dist/components/AvatarView/utils/useEyeBlink.d.ts +0 -2
- package/dist/components/AvatarView/utils/useEyeBlink.js +0 -40
- package/dist/components/AvatarView/utils/useEyeBlink.js.map +0 -1
- package/dist/components/AvatarView/utils/useHeadMovement.js.map +0 -1
- package/dist/components/AvatarView/utils/useLoadingMorphAnim.js.map +0 -1
- package/dist/components/AvatarView/utils/useMouthSpeaking.d.ts +0 -2
- package/dist/components/AvatarView/utils/useMouthSpeaking.js +0 -60
- package/dist/components/AvatarView/utils/useMouthSpeaking.js.map +0 -1
- package/dist/components/AvatarView/utils/useSmile.js +0 -30
- package/dist/components/AvatarView/utils/useSmile.js.map +0 -1
- package/dist/components/AvatarView/utils/utils.js.map +0 -1
- package/dist/components/ExportHistoryButton/ExportHistoryButton.d.ts +0 -14
- package/dist/components/ExportHistoryButton/ExportHistoryButton.js +0 -38
- package/dist/components/ExportHistoryButton/ExportHistoryButton.js.map +0 -1
- package/dist/components/ImageUpload/ImageUpload.css +0 -168
- package/dist/components/ImageUpload/ImageUpload.d.ts +0 -28
- package/dist/components/ImageUpload/ImageUpload.js +0 -163
- package/dist/components/ImageUpload/ImageUpload.js.map +0 -1
- package/dist/components/layouts/Default.d.ts +0 -17
- package/dist/components/layouts/Default.js +0 -8
- package/dist/components/layouts/Default.js.map +0 -1
- package/dist/components/ui/Message.d.ts +0 -17
- package/dist/components/ui/Message.js +0 -13
- package/dist/components/ui/Message.js.map +0 -1
- package/dist/helpers/tenant.d.ts +0 -2
- package/dist/helpers/tenant.js +0 -40
- package/dist/helpers/tenant.js.map +0 -1
- package/esm/components/AttachmentMediaModal/AttachmentMediaModal.d.ts +0 -14
- package/esm/components/AttachmentMediaModal/AttachmentMediaModal.js +0 -63
- package/esm/components/AttachmentMediaModal/AttachmentMediaModal.js.map +0 -1
- package/esm/components/AvatarView/components/avatar.d.ts +0 -9
- package/esm/components/AvatarView/components/avatar.js +0 -31
- package/esm/components/AvatarView/components/avatar.js.map +0 -1
- package/esm/components/AvatarView/components/fullbodyAvatar.d.ts +0 -10
- package/esm/components/AvatarView/components/fullbodyAvatar.js +0 -58
- package/esm/components/AvatarView/components/fullbodyAvatar.js.map +0 -1
- package/esm/components/AvatarView/components/loader.js.map +0 -1
- package/esm/components/AvatarView/index.d.ts +0 -17
- package/esm/components/AvatarView/index.js +0 -31
- package/esm/components/AvatarView/index.js.map +0 -1
- package/esm/components/AvatarView/utils/useEyeBlink.d.ts +0 -2
- package/esm/components/AvatarView/utils/useEyeBlink.js +0 -37
- package/esm/components/AvatarView/utils/useEyeBlink.js.map +0 -1
- package/esm/components/AvatarView/utils/useHeadMovement.js.map +0 -1
- package/esm/components/AvatarView/utils/useLoadingMorphAnim.js.map +0 -1
- package/esm/components/AvatarView/utils/useMouthSpeaking.d.ts +0 -2
- package/esm/components/AvatarView/utils/useMouthSpeaking.js +0 -57
- package/esm/components/AvatarView/utils/useMouthSpeaking.js.map +0 -1
- package/esm/components/AvatarView/utils/useSmile.js +0 -27
- package/esm/components/AvatarView/utils/useSmile.js.map +0 -1
- package/esm/components/AvatarView/utils/utils.js.map +0 -1
- package/esm/components/ExportHistoryButton/ExportHistoryButton.d.ts +0 -14
- package/esm/components/ExportHistoryButton/ExportHistoryButton.js +0 -35
- package/esm/components/ExportHistoryButton/ExportHistoryButton.js.map +0 -1
- package/esm/components/ImageUpload/ImageUpload.css +0 -168
- package/esm/components/ImageUpload/ImageUpload.d.ts +0 -28
- package/esm/components/ImageUpload/ImageUpload.js +0 -160
- package/esm/components/ImageUpload/ImageUpload.js.map +0 -1
- package/esm/components/layouts/Default.d.ts +0 -17
- package/esm/components/layouts/Default.js +0 -5
- package/esm/components/layouts/Default.js.map +0 -1
- package/esm/components/ui/Message.d.ts +0 -17
- package/esm/components/ui/Message.js +0 -10
- package/esm/components/ui/Message.js.map +0 -1
- package/esm/helpers/tenant.d.ts +0 -2
- package/esm/helpers/tenant.js +0 -36
- package/esm/helpers/tenant.js.map +0 -1
- package/src/components/AvatarView/components/avatar.tsx +0 -57
- package/src/components/AvatarView/components/fullbodyAvatar.tsx +0 -99
- package/src/components/AvatarView/index.tsx +0 -101
- package/src/components/AvatarView/utils/useEyeBlink.ts +0 -48
- package/src/components/AvatarView/utils/useMouthSpeaking.ts +0 -70
- package/src/components/AvatarView/utils/useSmile.ts +0 -31
- package/src/components/ExportHistoryButton/ExportHistoryButton.stories.tsx +0 -73
- package/src/components/ExportHistoryButton/ExportHistoryButton.test.tsx +0 -69
- package/src/components/ExportHistoryButton/ExportHistoryButton.tsx +0 -103
- package/src/components/ExportHistoryButton/__snapshots__/ExportHistoryButton.test.tsx.snap +0 -239
- package/src/helpers/statistics.test.ts +0 -213
- package/src/helpers/tenant.ts +0 -47
- /package/dist/components/{AvatarView → Avatar/AvatarView}/utils/useHeadMovement.d.ts +0 -0
- /package/dist/components/{AvatarView → Avatar/AvatarView}/utils/useHeadMovement.js +0 -0
- /package/dist/components/{AvatarView → Avatar/AvatarView}/utils/useLoadingMorphAnim.d.ts +0 -0
- /package/dist/components/{AvatarView → Avatar/AvatarView}/utils/useLoadingMorphAnim.js +0 -0
- /package/dist/components/{AvatarView → Avatar/AvatarView}/utils/useSmile.d.ts +0 -0
- /package/dist/components/{AvatarView → Avatar/AvatarView}/utils/utils.d.ts +0 -0
- /package/dist/components/{AvatarView → Avatar/AvatarView}/utils/utils.js +0 -0
- /package/esm/components/{AvatarView → Avatar/AvatarView}/utils/useHeadMovement.d.ts +0 -0
- /package/esm/components/{AvatarView → Avatar/AvatarView}/utils/useHeadMovement.js +0 -0
- /package/esm/components/{AvatarView → Avatar/AvatarView}/utils/useLoadingMorphAnim.d.ts +0 -0
- /package/esm/components/{AvatarView → Avatar/AvatarView}/utils/useLoadingMorphAnim.js +0 -0
- /package/esm/components/{AvatarView → Avatar/AvatarView}/utils/useSmile.d.ts +0 -0
- /package/esm/components/{AvatarView → Avatar/AvatarView}/utils/utils.d.ts +0 -0
- /package/esm/components/{AvatarView → Avatar/AvatarView}/utils/utils.js +0 -0
- /package/src/components/{AvatarView → Avatar/AvatarView}/utils/useHeadMovement.ts +0 -0
- /package/src/components/{AvatarView → Avatar/AvatarView}/utils/useLoadingMorphAnim.ts +0 -0
- /package/src/components/{AvatarView → Avatar/AvatarView}/utils/utils.ts +0 -0
|
@@ -6,7 +6,6 @@ const react_1 = require("react");
|
|
|
6
6
|
const react_i18next_1 = require("react-i18next");
|
|
7
7
|
const memori_api_client_1 = tslib_1.__importDefault(require("@memori.ai/memori-api-client"));
|
|
8
8
|
const standardized_audio_context_1 = require("standardized-audio-context");
|
|
9
|
-
const speechSdk = tslib_1.__importStar(require("microsoft-cognitiveservices-speech-sdk"));
|
|
10
9
|
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
11
10
|
const luxon_1 = require("luxon");
|
|
12
11
|
const react_hot_toast_1 = tslib_1.__importDefault(require("react-hot-toast"));
|
|
@@ -15,7 +14,6 @@ const Auth_1 = tslib_1.__importDefault(require("../Auth/Auth"));
|
|
|
15
14
|
const Chat_1 = tslib_1.__importDefault(require("../Chat/Chat"));
|
|
16
15
|
const StartPanel_1 = tslib_1.__importDefault(require("../StartPanel/StartPanel"));
|
|
17
16
|
const Avatar_1 = tslib_1.__importDefault(require("../Avatar/Avatar"));
|
|
18
|
-
const ChangeMode_1 = tslib_1.__importDefault(require("../ChangeMode/ChangeMode"));
|
|
19
17
|
const Header_1 = tslib_1.__importDefault(require("../Header/Header"));
|
|
20
18
|
const PoweredBy_1 = tslib_1.__importDefault(require("../PoweredBy/PoweredBy"));
|
|
21
19
|
const AgeVerificationModal_1 = tslib_1.__importDefault(require("../AgeVerificationModal/AgeVerificationModal"));
|
|
@@ -23,17 +21,26 @@ const SettingsDrawer_1 = tslib_1.__importDefault(require("../SettingsDrawer/Sett
|
|
|
23
21
|
const KnownFacts_1 = tslib_1.__importDefault(require("../KnownFacts/KnownFacts"));
|
|
24
22
|
const ExpertsDrawer_1 = tslib_1.__importDefault(require("../ExpertsDrawer/ExpertsDrawer"));
|
|
25
23
|
const LoginDrawer_1 = tslib_1.__importDefault(require("../LoginDrawer/LoginDrawer"));
|
|
24
|
+
const Button_1 = tslib_1.__importDefault(require("../ui/Button"));
|
|
25
|
+
const Close_1 = tslib_1.__importDefault(require("../icons/Close"));
|
|
26
26
|
const FullPage_1 = tslib_1.__importDefault(require("../layouts/FullPage"));
|
|
27
27
|
const Totem_1 = tslib_1.__importDefault(require("../layouts/Totem"));
|
|
28
28
|
const Chat_2 = tslib_1.__importDefault(require("../layouts/Chat"));
|
|
29
29
|
const WebsiteAssistant_1 = tslib_1.__importDefault(require("../layouts/WebsiteAssistant"));
|
|
30
|
+
const HiddenChat_1 = tslib_1.__importDefault(require("../layouts/HiddenChat"));
|
|
31
|
+
const ZoomedFullBody_1 = tslib_1.__importDefault(require("../layouts/ZoomedFullBody"));
|
|
30
32
|
const translations_1 = require("../../helpers/translations");
|
|
31
33
|
const configuration_1 = require("../../helpers/configuration");
|
|
32
34
|
const utils_1 = require("../../helpers/utils");
|
|
35
|
+
const ttsVoiceUtility_1 = require("../../helpers/tts/ttsVoiceUtility");
|
|
33
36
|
const constants_1 = require("../../helpers/constants");
|
|
34
37
|
const error_1 = require("../../helpers/error");
|
|
35
|
-
const statistics_1 = require("../../helpers/statistics");
|
|
36
38
|
const credits_1 = require("../../helpers/credits");
|
|
39
|
+
const sanitizer_1 = require("../../helpers/sanitizer");
|
|
40
|
+
const useTTS_1 = require("../../helpers/tts/useTTS");
|
|
41
|
+
const Alert_1 = tslib_1.__importDefault(require("../ui/Alert"));
|
|
42
|
+
const ChatHistory_1 = tslib_1.__importDefault(require("../ChatHistoryDrawer/ChatHistory"));
|
|
43
|
+
const useSTT_1 = require("../../helpers/stt/useSTT");
|
|
37
44
|
const getMemoriState = (integrationId) => {
|
|
38
45
|
var _a, _b, _c, _d, _f;
|
|
39
46
|
let widget = integrationId
|
|
@@ -49,7 +56,11 @@ const getMemoriState = (integrationId) => {
|
|
|
49
56
|
if (!engineState)
|
|
50
57
|
return null;
|
|
51
58
|
let dialogState = JSON.parse(engineState);
|
|
52
|
-
|
|
59
|
+
let loginToken = (0, configuration_1.getLocalConfig)('loginToken', undefined);
|
|
60
|
+
return {
|
|
61
|
+
...dialogState,
|
|
62
|
+
loginToken,
|
|
63
|
+
};
|
|
53
64
|
};
|
|
54
65
|
const typeMessage = (message, waitForPrevious = true, hidden = false, typingText, useLoaderTextAsMsg = false, hasBatchQueued = false) => {
|
|
55
66
|
const e = new CustomEvent('MemoriTextEntered', {
|
|
@@ -144,35 +155,37 @@ window.getMemoriState = getMemoriState;
|
|
|
144
155
|
window.typeMessage = typeMessage;
|
|
145
156
|
window.typeMessageHidden = typeMessageHidden;
|
|
146
157
|
window.typeBatchMessages = typeBatchMessages;
|
|
147
|
-
let recognizer;
|
|
148
|
-
let speechConfig;
|
|
149
|
-
let speechSynthesizer;
|
|
150
|
-
let audioDestination;
|
|
151
158
|
let audioContext;
|
|
152
159
|
let memoriPassword;
|
|
153
160
|
let speakerMuted = false;
|
|
154
|
-
let memoriSpeaking = false;
|
|
155
161
|
let userToken;
|
|
156
|
-
const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenantID, memoriLang, multilingual, integration, layout
|
|
157
|
-
var _a, _b, _c, _d, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _t, _u, _v, _w, _x, _y, _z, _0, _1;
|
|
162
|
+
const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenantID, memoriLang, multilingual, integration, layout, customLayout, showShare, preview = false, embed = false, showCopyButton = true, showTranslationOriginal = false, showInputs = true, showDates = false, showContextPerLine = false, showSettings, showTypingText = false, showClear = false, showLogin = false, showUpload, showOnlyLastMessages, showChatHistory, showReasoning, height = '100vh', secret, baseUrl = 'https://aisuru-staging.aclambda.online', apiURL = 'https://backend-staging.memori.ai', engineURL = 'https://engine-staging.memori.ai', initialContextVars, initialQuestion, ttsProvider, ogImage, sessionID: initialSessionID, tenant, personification, authToken, enableAudio, defaultSpeakerActive = true, disableTextEnteredEvents = false, onStateChange, additionalInfo, additionalSettings, customMediaRenderer, userAvatar, useMathFormatting = false, autoStart = false, applyVarsToRoot = false, showFunctionCache = false, }) => {
|
|
163
|
+
var _a, _b, _c, _d, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7;
|
|
158
164
|
const { t, i18n } = (0, react_i18next_1.useTranslation)();
|
|
159
165
|
const [isClient, setIsClient] = (0, react_1.useState)(false);
|
|
160
166
|
(0, react_1.useEffect)(() => {
|
|
161
167
|
setIsClient(true);
|
|
162
168
|
}, []);
|
|
163
|
-
const client = (0, memori_api_client_1.default)(
|
|
164
|
-
const { initSession, postTextEnteredEvent, postPlaceChangedEvent, postDateChangedEvent, postTimeoutEvent, postTagChangedEvent, getSession,
|
|
169
|
+
const client = (0, memori_api_client_1.default)(apiURL, engineURL);
|
|
170
|
+
const { initSession, deleteSession, postTextEnteredEvent, postPlaceChangedEvent, postDateChangedEvent, postTimeoutEvent, postTagChangedEvent, getSession, getExpertReferences, getSessionChatLogs, } = client;
|
|
165
171
|
const [instruct, setInstruct] = (0, react_1.useState)(false);
|
|
172
|
+
const [enableFocusChatInput, setEnableFocusChatInput] = (0, react_1.useState)(true);
|
|
166
173
|
const [loginToken, setLoginToken] = (0, react_1.useState)((_a = additionalInfo === null || additionalInfo === void 0 ? void 0 : additionalInfo.loginToken) !== null && _a !== void 0 ? _a : authToken);
|
|
167
174
|
const [user, setUser] = (0, react_1.useState)({
|
|
168
175
|
avatarURL: typeof userAvatar === 'string' ? userAvatar : undefined,
|
|
169
176
|
});
|
|
170
177
|
(0, react_1.useEffect)(() => {
|
|
171
|
-
if (loginToken &&
|
|
178
|
+
if (loginToken &&
|
|
179
|
+
!(user === null || user === void 0 ? void 0 : user.userID) &&
|
|
180
|
+
(showLogin || memori.requireLoginToken)) {
|
|
172
181
|
client.backend.getCurrentUser(loginToken).then(({ user, resultCode }) => {
|
|
173
182
|
if (user && resultCode === 0) {
|
|
174
183
|
setUser(user);
|
|
175
184
|
(0, configuration_1.setLocalConfig)('loginToken', loginToken);
|
|
185
|
+
if (!birthDate && user.birthDate) {
|
|
186
|
+
setBirthDate(user.birthDate);
|
|
187
|
+
(0, configuration_1.setLocalConfig)('birthDate', user.birthDate);
|
|
188
|
+
}
|
|
176
189
|
}
|
|
177
190
|
else {
|
|
178
191
|
(0, configuration_1.removeLocalConfig)('loginToken');
|
|
@@ -193,27 +206,44 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
193
206
|
: !!(integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.multilanguage);
|
|
194
207
|
const forcedTimeout = integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.forcedTimeout;
|
|
195
208
|
const [userLang, setUserLang] = (0, react_1.useState)((_o = (_m = (_l = (_k = memoriLang !== null && memoriLang !== void 0 ? memoriLang : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.lang) !== null && _k !== void 0 ? _k : language) !== null && _l !== void 0 ? _l : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.uiLang) !== null && _m !== void 0 ? _m : i18n.language) !== null && _o !== void 0 ? _o : 'IT');
|
|
209
|
+
const applyMathFormatting = useMathFormatting !== undefined
|
|
210
|
+
? useMathFormatting
|
|
211
|
+
: !!(integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.useMathFormatting);
|
|
212
|
+
(0, react_1.useEffect)(() => {
|
|
213
|
+
if (applyMathFormatting)
|
|
214
|
+
(0, utils_1.installMathJax)();
|
|
215
|
+
}, [applyMathFormatting]);
|
|
216
|
+
(0, react_1.useEffect)(() => {
|
|
217
|
+
if (isMultilanguageEnabled &&
|
|
218
|
+
userLang &&
|
|
219
|
+
constants_1.uiLanguages.includes(userLang.toLowerCase())) {
|
|
220
|
+
i18n.changeLanguage(userLang.toLowerCase());
|
|
221
|
+
}
|
|
222
|
+
}, [userLang]);
|
|
196
223
|
const [loading, setLoading] = (0, react_1.useState)(false);
|
|
197
224
|
const [memoriTyping, setMemoriTyping] = (0, react_1.useState)(false);
|
|
198
225
|
const [typingText, setTypingText] = (0, react_1.useState)();
|
|
199
226
|
const selectedLayout = layout || (integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.layout) || 'DEFAULT';
|
|
200
|
-
const
|
|
227
|
+
const defaultEnableAudio = (_p = enableAudio !== null && enableAudio !== void 0 ? enableAudio : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.enableAudio) !== null && _p !== void 0 ? _p : true;
|
|
201
228
|
const [hasUserActivatedListening, setHasUserActivatedListening] = (0, react_1.useState)(false);
|
|
202
229
|
const [showPositionDrawer, setShowPositionDrawer] = (0, react_1.useState)(false);
|
|
203
230
|
const [showSettingsDrawer, setShowSettingsDrawer] = (0, react_1.useState)(false);
|
|
231
|
+
const [showChatHistoryDrawer, setShowChatHistoryDrawer] = (0, react_1.useState)(false);
|
|
204
232
|
const [showKnownFactsDrawer, setShowKnownFactsDrawer] = (0, react_1.useState)(false);
|
|
205
233
|
const [showExpertsDrawer, setShowExpertsDrawer] = (0, react_1.useState)(false);
|
|
206
|
-
const [muteSpeaker, setMuteSpeaker] = (0, react_1.useState)(!defaultSpeakerActive);
|
|
207
234
|
const [continuousSpeech, setContinuousSpeech] = (0, react_1.useState)(false);
|
|
208
235
|
const [continuousSpeechTimeout, setContinuousSpeechTimeout] = (0, react_1.useState)(2);
|
|
209
|
-
const [isPlayingAudio, setIsPlayingAudio] = (0, react_1.useState)(false);
|
|
210
236
|
const [controlsPosition, setControlsPosition] = (0, react_1.useState)('center');
|
|
237
|
+
const [enablePositionControls, setEnablePositionControls] = (0, react_1.useState)(false);
|
|
238
|
+
const [avatarType, setAvatarType] = (0, react_1.useState)(null);
|
|
211
239
|
const [hideEmissions, setHideEmissions] = (0, react_1.useState)(false);
|
|
240
|
+
const speechSynthesizerRef = (0, react_1.useRef)(null);
|
|
241
|
+
const [memoriSpeaking, setMemoriSpeaking] = (0, react_1.useState)(false);
|
|
212
242
|
(0, react_1.useEffect)(() => {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
}, [speechSynthesizer]);
|
|
243
|
+
setMemoriSpeaking(!!speechSynthesizerRef.current);
|
|
244
|
+
}, [speechSynthesizerRef.current]);
|
|
216
245
|
(0, react_1.useEffect)(() => {
|
|
246
|
+
var _a;
|
|
217
247
|
let defaultControlsPosition = 'bottom';
|
|
218
248
|
let microphoneMode = (0, configuration_1.getLocalConfig)('microphoneMode', 'HOLD_TO_TALK');
|
|
219
249
|
if (window.innerWidth <= 768) {
|
|
@@ -227,17 +257,27 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
227
257
|
else {
|
|
228
258
|
defaultControlsPosition = 'bottom';
|
|
229
259
|
}
|
|
230
|
-
|
|
231
|
-
speakerMuted = (0, configuration_1.getLocalConfig)('muteSpeaker', !defaultSpeakerActive);
|
|
232
|
-
setContinuousSpeech(microphoneMode === 'CONTINUOUS');
|
|
260
|
+
setContinuousSpeech(speakerMuted ? false : microphoneMode === 'CONTINUOUS');
|
|
233
261
|
setContinuousSpeechTimeout((0, configuration_1.getLocalConfig)('continuousSpeechTimeout', 2));
|
|
234
262
|
setControlsPosition((0, configuration_1.getLocalConfig)('controlsPosition', defaultControlsPosition));
|
|
263
|
+
setAvatarType((0, configuration_1.getLocalConfig)('avatarType', 'avatar3d'));
|
|
235
264
|
setHideEmissions((0, configuration_1.getLocalConfig)('hideEmissions', false));
|
|
236
265
|
if (!(additionalInfo === null || additionalInfo === void 0 ? void 0 : additionalInfo.loginToken) && !authToken) {
|
|
237
266
|
setLoginToken((0, configuration_1.getLocalConfig)('loginToken', undefined));
|
|
238
267
|
userToken = (0, configuration_1.getLocalConfig)('loginToken', undefined);
|
|
268
|
+
setBirthDate((0, configuration_1.getLocalConfig)('birthDate', undefined));
|
|
269
|
+
}
|
|
270
|
+
if (!((_a = enableAudio !== null && enableAudio !== void 0 ? enableAudio : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.enableAudio) !== null && _a !== void 0 ? _a : true)) {
|
|
271
|
+
(0, configuration_1.setLocalConfig)('muteSpeaker', true);
|
|
239
272
|
}
|
|
240
273
|
}, []);
|
|
274
|
+
(0, react_1.useEffect)(() => {
|
|
275
|
+
var _a;
|
|
276
|
+
const isAudioEnabled = (_a = enableAudio !== null && enableAudio !== void 0 ? enableAudio : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.enableAudio) !== null && _a !== void 0 ? _a : true;
|
|
277
|
+
if (!isAudioEnabled) {
|
|
278
|
+
(0, configuration_1.setLocalConfig)('muteSpeaker', true);
|
|
279
|
+
}
|
|
280
|
+
}, [enableAudio, integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.enableAudio]);
|
|
241
281
|
const [memoriPwd, setMemoriPwd] = (0, react_1.useState)(secret);
|
|
242
282
|
const [memoriTokens, setMemoriTokens] = (0, react_1.useState)();
|
|
243
283
|
const [authModalState, setAuthModalState] = (0, react_1.useState)(null);
|
|
@@ -245,7 +285,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
245
285
|
const applyPosition = async (venue, sessionID) => {
|
|
246
286
|
var _a;
|
|
247
287
|
const session = sessionID !== null && sessionID !== void 0 ? sessionID : sessionId;
|
|
248
|
-
if (venue && session) {
|
|
288
|
+
if (venue && session && memori.needsPosition) {
|
|
249
289
|
const { currentState, ...response } = await postPlaceChangedEvent({
|
|
250
290
|
sessionId: session,
|
|
251
291
|
placeName: venue.placeName,
|
|
@@ -268,24 +308,25 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
268
308
|
const setPosition = (venue) => {
|
|
269
309
|
_setPosition(venue);
|
|
270
310
|
applyPosition(venue);
|
|
271
|
-
if (venue) {
|
|
311
|
+
if (venue && memori.needsPosition) {
|
|
272
312
|
(0, configuration_1.setLocalConfig)('position', JSON.stringify(venue));
|
|
273
313
|
}
|
|
274
|
-
else {
|
|
314
|
+
else if (!venue) {
|
|
275
315
|
(0, configuration_1.removeLocalConfig)('position');
|
|
276
316
|
}
|
|
277
317
|
};
|
|
278
318
|
(0, react_1.useEffect)(() => {
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
319
|
+
if (memori.needsPosition) {
|
|
320
|
+
const position = (0, configuration_1.getLocalConfig)('position', undefined);
|
|
321
|
+
if (position) {
|
|
322
|
+
_setPosition(position);
|
|
323
|
+
}
|
|
282
324
|
}
|
|
283
|
-
}, []);
|
|
325
|
+
}, [memori.needsPosition]);
|
|
284
326
|
const [userMessage, setUserMessage] = (0, react_1.useState)('');
|
|
285
327
|
const onChangeUserMessage = (value) => {
|
|
286
328
|
if (!value || value === '\n' || value.trim() === '') {
|
|
287
329
|
setUserMessage('');
|
|
288
|
-
resetInteractionTimeout();
|
|
289
330
|
return;
|
|
290
331
|
}
|
|
291
332
|
setUserMessage(value);
|
|
@@ -305,8 +346,9 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
305
346
|
];
|
|
306
347
|
});
|
|
307
348
|
};
|
|
349
|
+
const [chatLogID, setChatLogID] = (0, react_1.useState)(undefined);
|
|
308
350
|
const sendMessage = async (text, media, newSessionId, translate = true, translatedText, hidden = false, typingText, useLoaderTextAsMsg = false, hasBatchQueued = false) => {
|
|
309
|
-
var _a, _b, _c, _d;
|
|
351
|
+
var _a, _b, _c, _d, _f;
|
|
310
352
|
const sessionID = newSessionId ||
|
|
311
353
|
sessionId ||
|
|
312
354
|
((_a = window.getMemoriState()) === null || _a === void 0 ? void 0 : _a.sessionID);
|
|
@@ -326,32 +368,58 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
326
368
|
setTypingText(typingText);
|
|
327
369
|
let msg = text;
|
|
328
370
|
let gotError = false;
|
|
329
|
-
|
|
330
|
-
!
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
const
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
371
|
+
try {
|
|
372
|
+
if (!hidden &&
|
|
373
|
+
translate &&
|
|
374
|
+
isMultilanguageEnabled &&
|
|
375
|
+
userLang.toUpperCase() !== language.toUpperCase()) {
|
|
376
|
+
const translation = await (0, translations_1.getTranslation)(text, language, userLang, baseUrl);
|
|
377
|
+
msg = translation.text;
|
|
378
|
+
}
|
|
379
|
+
const findMediaDocument = media === null || media === void 0 ? void 0 : media.find(m => { var _a; return !m.mediumID && ((_a = m.properties) === null || _a === void 0 ? void 0 : _a.isAttachedFile); });
|
|
380
|
+
if (findMediaDocument) {
|
|
381
|
+
msg = msg + ' ' + findMediaDocument.content;
|
|
382
|
+
}
|
|
383
|
+
const mediaDocuments = media === null || media === void 0 ? void 0 : media.filter(m => { var _a; return !m.mediumID && ((_a = m.properties) === null || _a === void 0 ? void 0 : _a.isAttachedFile); });
|
|
384
|
+
if (mediaDocuments && mediaDocuments.length > 0) {
|
|
385
|
+
const documentContents = mediaDocuments
|
|
386
|
+
.map(doc => doc.content)
|
|
387
|
+
.join(' ');
|
|
388
|
+
msg = msg + ' ' + documentContents;
|
|
389
|
+
}
|
|
390
|
+
const { currentState, ...response } = await postTextEnteredEvent({
|
|
391
|
+
sessionId: sessionID,
|
|
392
|
+
text: msg,
|
|
393
|
+
});
|
|
394
|
+
if (response.resultCode === 0 && currentState) {
|
|
395
|
+
setChatLogID(undefined);
|
|
396
|
+
const emission = useLoaderTextAsMsg && typingText
|
|
397
|
+
? typingText
|
|
398
|
+
: (_b = currentState.emission) !== null && _b !== void 0 ? _b : currentDialogState === null || currentDialogState === void 0 ? void 0 : currentDialogState.emission;
|
|
399
|
+
if (userLang.toLowerCase() !== language.toLowerCase() &&
|
|
400
|
+
emission &&
|
|
401
|
+
isMultilanguageEnabled) {
|
|
402
|
+
currentState.emission = emission;
|
|
403
|
+
translateDialogState(currentState, userLang, msg).then(ts => {
|
|
404
|
+
let text = ts.translatedEmission || ts.emission;
|
|
405
|
+
if (text && text.trim() && !speakerMuted) {
|
|
406
|
+
handleSpeak(text);
|
|
407
|
+
}
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
else {
|
|
411
|
+
setCurrentDialogState({
|
|
412
|
+
...currentState,
|
|
413
|
+
emission,
|
|
414
|
+
});
|
|
348
415
|
if (emission) {
|
|
349
416
|
pushMessage({
|
|
350
417
|
text: emission,
|
|
351
418
|
emitter: currentState.emitter,
|
|
352
|
-
media: currentState.media,
|
|
419
|
+
media: (_c = currentState.emittedMedia) !== null && _c !== void 0 ? _c : currentState.media,
|
|
353
420
|
fromUser: false,
|
|
354
421
|
questionAnswered: msg,
|
|
422
|
+
generatedByAI: !!currentState.completion,
|
|
355
423
|
contextVars: currentState.contextVars,
|
|
356
424
|
date: currentState.currentDate,
|
|
357
425
|
placeName: currentState.currentPlaceName,
|
|
@@ -361,126 +429,54 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
361
429
|
tag: currentState.currentTag,
|
|
362
430
|
memoryTags: currentState.memoryTags,
|
|
363
431
|
});
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
}
|
|
367
|
-
else {
|
|
368
|
-
console.error(response, resp);
|
|
369
|
-
react_hot_toast_1.default.error(t((0, error_1.getErrori18nKey)(resp.resultCode)));
|
|
370
|
-
gotError = true;
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
else if (currentState.state === 'X2d' && memori.giverTag) {
|
|
374
|
-
const { currentState, ...resp } = await postTextEnteredEvent({
|
|
375
|
-
sessionId: sessionID,
|
|
376
|
-
text: Math.random().toString().substring(2, 8),
|
|
377
|
-
});
|
|
378
|
-
if (resp.resultCode === 0) {
|
|
379
|
-
const { currentState, ...resp } = await postTagChangedEvent(sessionID, memori.giverTag);
|
|
380
|
-
if (resp.resultCode === 0) {
|
|
381
|
-
setCurrentDialogState(currentState);
|
|
382
|
-
if (emission) {
|
|
383
|
-
pushMessage({
|
|
384
|
-
text: emission,
|
|
385
|
-
emitter: currentState.emitter,
|
|
386
|
-
media: currentState.media,
|
|
387
|
-
fromUser: false,
|
|
388
|
-
questionAnswered: msg,
|
|
389
|
-
contextVars: currentState.contextVars,
|
|
390
|
-
date: currentState.currentDate,
|
|
391
|
-
placeName: currentState.currentPlaceName,
|
|
392
|
-
placeLatitude: currentState.currentLatitude,
|
|
393
|
-
placeLongitude: currentState.currentLongitude,
|
|
394
|
-
placeUncertaintyKm: currentState.currentUncertaintyKm,
|
|
395
|
-
tag: currentState.currentTag,
|
|
396
|
-
memoryTags: currentState.memoryTags,
|
|
397
|
-
});
|
|
398
|
-
speak(emission);
|
|
432
|
+
if (emission && emission.trim()) {
|
|
433
|
+
handleSpeak(emission);
|
|
399
434
|
}
|
|
400
435
|
}
|
|
401
|
-
else {
|
|
402
|
-
console.error(response, resp);
|
|
403
|
-
react_hot_toast_1.default.error(t((0, error_1.getErrori18nKey)(resp.resultCode)));
|
|
404
|
-
gotError = true;
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
else {
|
|
408
|
-
console.error(response, resp);
|
|
409
|
-
react_hot_toast_1.default.error(t((0, error_1.getErrori18nKey)(resp.resultCode)));
|
|
410
|
-
gotError = true;
|
|
411
436
|
}
|
|
412
437
|
}
|
|
413
|
-
else if (
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
438
|
+
else if (response.resultCode === 404) {
|
|
439
|
+
setHistory(h => [...h.slice(0, h.length - 1)]);
|
|
440
|
+
reopenSession(false, memoriPwd || memori.secretToken, memoriTokens, undefined, undefined, {
|
|
441
|
+
PATHNAME: window.location.pathname,
|
|
442
|
+
ROUTE: ((_f = (_d = window.location.pathname) === null || _d === void 0 ? void 0 : _d.split('/')) === null || _f === void 0 ? void 0 : _f.pop()) || '',
|
|
443
|
+
...(initialContextVars || {}),
|
|
444
|
+
}, initialQuestion).then(state => {
|
|
445
|
+
console.info('session timeout');
|
|
446
|
+
if (state === null || state === void 0 ? void 0 : state.sessionID) {
|
|
447
|
+
setTimeout(() => {
|
|
448
|
+
sendMessage(text, media, state === null || state === void 0 ? void 0 : state.sessionID);
|
|
449
|
+
}, 500);
|
|
420
450
|
}
|
|
421
451
|
});
|
|
422
452
|
}
|
|
423
|
-
else {
|
|
424
|
-
setCurrentDialogState({
|
|
425
|
-
...currentState,
|
|
426
|
-
emission,
|
|
427
|
-
});
|
|
428
|
-
if (emission) {
|
|
429
|
-
pushMessage({
|
|
430
|
-
text: emission,
|
|
431
|
-
emitter: currentState.emitter,
|
|
432
|
-
media: currentState.media,
|
|
433
|
-
fromUser: false,
|
|
434
|
-
questionAnswered: msg,
|
|
435
|
-
generatedByAI: !!currentState.completion,
|
|
436
|
-
contextVars: currentState.contextVars,
|
|
437
|
-
date: currentState.currentDate,
|
|
438
|
-
placeName: currentState.currentPlaceName,
|
|
439
|
-
placeLatitude: currentState.currentLatitude,
|
|
440
|
-
placeLongitude: currentState.currentLongitude,
|
|
441
|
-
placeUncertaintyKm: currentState.currentUncertaintyKm,
|
|
442
|
-
tag: currentState.currentTag,
|
|
443
|
-
memoryTags: currentState.memoryTags,
|
|
444
|
-
});
|
|
445
|
-
speak(emission);
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
453
|
}
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
...(initialContextVars || {}),
|
|
455
|
-
}, initialQuestion).then(state => {
|
|
456
|
-
console.info('session timeout');
|
|
457
|
-
if (state === null || state === void 0 ? void 0 : state.sessionID) {
|
|
458
|
-
setTimeout(() => {
|
|
459
|
-
sendMessage(text, media, state === null || state === void 0 ? void 0 : state.sessionID);
|
|
460
|
-
}, 500);
|
|
461
|
-
}
|
|
462
|
-
});
|
|
454
|
+
catch (error) {
|
|
455
|
+
console.error(error);
|
|
456
|
+
gotError = true;
|
|
457
|
+
setTypingText(undefined);
|
|
458
|
+
setMemoriTyping(false);
|
|
463
459
|
}
|
|
464
460
|
if (!hasBatchQueued) {
|
|
465
461
|
setTypingText(undefined);
|
|
466
462
|
setMemoriTyping(false);
|
|
467
463
|
}
|
|
468
464
|
};
|
|
469
|
-
const translateDialogState = async (state, userLang, msg) => {
|
|
470
|
-
var _a, _b, _c;
|
|
471
|
-
const emission = (_a = state.emission) !== null && _a !== void 0 ? _a : currentDialogState === null || currentDialogState === void 0 ? void 0 : currentDialogState.emission;
|
|
465
|
+
const translateDialogState = async (state, userLang, msg, avoidPushingMessage = false) => {
|
|
466
|
+
var _a, _b, _c, _d, _f, _g;
|
|
467
|
+
const emission = (_a = state === null || state === void 0 ? void 0 : state.emission) !== null && _a !== void 0 ? _a : currentDialogState === null || currentDialogState === void 0 ? void 0 : currentDialogState.emission;
|
|
472
468
|
let translatedState = { ...state };
|
|
473
469
|
let translatedMsg = null;
|
|
474
470
|
if (!emission ||
|
|
475
|
-
instruct ||
|
|
476
471
|
language.toUpperCase() === userLang.toUpperCase() ||
|
|
477
|
-
!isMultilanguageEnabled
|
|
472
|
+
!isMultilanguageEnabled ||
|
|
473
|
+
avoidPushingMessage) {
|
|
478
474
|
translatedState = { ...state, emission };
|
|
479
475
|
if (emission) {
|
|
480
476
|
translatedMsg = {
|
|
481
477
|
text: emission,
|
|
482
478
|
emitter: state.emitter,
|
|
483
|
-
media: state.media,
|
|
479
|
+
media: (_b = state.emittedMedia) !== null && _b !== void 0 ? _b : state.media,
|
|
484
480
|
fromUser: false,
|
|
485
481
|
questionAnswered: msg,
|
|
486
482
|
contextVars: state.contextVars,
|
|
@@ -495,37 +491,60 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
495
491
|
}
|
|
496
492
|
}
|
|
497
493
|
else {
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
494
|
+
try {
|
|
495
|
+
const t = await (0, translations_1.getTranslation)(emission, userLang, language, baseUrl);
|
|
496
|
+
if (state.hints && state.hints.length > 0) {
|
|
497
|
+
const translatedHints = await Promise.all(((_c = state.hints) !== null && _c !== void 0 ? _c : []).map(async (hint) => {
|
|
498
|
+
var _a;
|
|
499
|
+
const tHint = await (0, translations_1.getTranslation)(hint, userLang, language, baseUrl);
|
|
500
|
+
return {
|
|
501
|
+
text: (_a = tHint === null || tHint === void 0 ? void 0 : tHint.text) !== null && _a !== void 0 ? _a : hint,
|
|
502
|
+
originalText: hint,
|
|
503
|
+
};
|
|
504
|
+
}));
|
|
505
|
+
translatedState = {
|
|
506
|
+
...state,
|
|
507
|
+
emission: t.text,
|
|
508
|
+
translatedHints,
|
|
506
509
|
};
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
510
|
+
}
|
|
511
|
+
else {
|
|
512
|
+
translatedState = {
|
|
513
|
+
...state,
|
|
514
|
+
emission: emission,
|
|
515
|
+
translatedEmission: t.text,
|
|
516
|
+
hints: (_d = state.hints) !== null && _d !== void 0 ? _d : (state.state === 'G1' ? currentDialogState === null || currentDialogState === void 0 ? void 0 : currentDialogState.hints : []),
|
|
517
|
+
};
|
|
518
|
+
}
|
|
519
|
+
if (t.text.length > 0) {
|
|
520
|
+
translatedMsg = {
|
|
521
|
+
text: emission,
|
|
522
|
+
translatedText: t.text,
|
|
523
|
+
emitter: state.emitter,
|
|
524
|
+
media: (_f = state.emittedMedia) !== null && _f !== void 0 ? _f : state.media,
|
|
525
|
+
fromUser: false,
|
|
526
|
+
questionAnswered: msg,
|
|
527
|
+
generatedByAI: !!state.completion,
|
|
528
|
+
contextVars: state.contextVars,
|
|
529
|
+
date: state.currentDate,
|
|
530
|
+
placeName: state.currentPlaceName,
|
|
531
|
+
placeLatitude: state.currentLatitude,
|
|
532
|
+
placeLongitude: state.currentLongitude,
|
|
533
|
+
placeUncertaintyKm: state.currentUncertaintyKm,
|
|
534
|
+
tag: state.currentTag,
|
|
535
|
+
memoryTags: state.memoryTags,
|
|
536
|
+
};
|
|
537
|
+
}
|
|
520
538
|
}
|
|
521
|
-
|
|
539
|
+
catch (error) {
|
|
540
|
+
console.error('[TRANSLATE] Error during translation:', error);
|
|
541
|
+
translatedState = { ...state, emission };
|
|
522
542
|
translatedMsg = {
|
|
523
|
-
text:
|
|
543
|
+
text: emission,
|
|
524
544
|
emitter: state.emitter,
|
|
525
|
-
media: state.media,
|
|
545
|
+
media: (_g = state.emittedMedia) !== null && _g !== void 0 ? _g : state.media,
|
|
526
546
|
fromUser: false,
|
|
527
547
|
questionAnswered: msg,
|
|
528
|
-
generatedByAI: !!state.completion,
|
|
529
548
|
contextVars: state.contextVars,
|
|
530
549
|
date: state.currentDate,
|
|
531
550
|
placeName: state.currentPlaceName,
|
|
@@ -535,9 +554,10 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
535
554
|
tag: state.currentTag,
|
|
536
555
|
memoryTags: state.memoryTags,
|
|
537
556
|
};
|
|
557
|
+
}
|
|
538
558
|
}
|
|
539
559
|
setCurrentDialogState(translatedState);
|
|
540
|
-
if (translatedMsg) {
|
|
560
|
+
if (!avoidPushingMessage && translatedMsg) {
|
|
541
561
|
pushMessage(translatedMsg);
|
|
542
562
|
}
|
|
543
563
|
return translatedState;
|
|
@@ -551,15 +571,75 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
551
571
|
: 0;
|
|
552
572
|
const [birthDate, setBirthDate] = (0, react_1.useState)();
|
|
553
573
|
const [showAgeVerification, setShowAgeVerification] = (0, react_1.useState)(false);
|
|
574
|
+
const getCultureCodeByLanguage = (lang) => {
|
|
575
|
+
var _a, _b;
|
|
576
|
+
let voice = '';
|
|
577
|
+
let voiceLang = (lang ||
|
|
578
|
+
((_b = (_a = memori.culture) === null || _a === void 0 ? void 0 : _a.split('-')) === null || _b === void 0 ? void 0 : _b[0]) ||
|
|
579
|
+
i18n.language ||
|
|
580
|
+
'IT').toUpperCase();
|
|
581
|
+
switch (voiceLang) {
|
|
582
|
+
case 'IT':
|
|
583
|
+
voice = 'it-IT';
|
|
584
|
+
break;
|
|
585
|
+
case 'DE':
|
|
586
|
+
voice = 'de-DE';
|
|
587
|
+
break;
|
|
588
|
+
case 'EN':
|
|
589
|
+
voice = 'en-GB';
|
|
590
|
+
break;
|
|
591
|
+
case 'ES':
|
|
592
|
+
voice = 'es-ES';
|
|
593
|
+
break;
|
|
594
|
+
case 'FR':
|
|
595
|
+
voice = 'fr-FR';
|
|
596
|
+
break;
|
|
597
|
+
case 'PT':
|
|
598
|
+
voice = 'pt-PT';
|
|
599
|
+
break;
|
|
600
|
+
case 'UK':
|
|
601
|
+
voice = 'uk-UK';
|
|
602
|
+
break;
|
|
603
|
+
case 'RU':
|
|
604
|
+
voice = 'ru-RU';
|
|
605
|
+
break;
|
|
606
|
+
case 'PL':
|
|
607
|
+
voice = 'pl-PL';
|
|
608
|
+
break;
|
|
609
|
+
case 'FI':
|
|
610
|
+
voice = 'fi-FI';
|
|
611
|
+
break;
|
|
612
|
+
case 'EL':
|
|
613
|
+
voice = 'el-GR';
|
|
614
|
+
break;
|
|
615
|
+
case 'AR':
|
|
616
|
+
voice = 'ar-SA';
|
|
617
|
+
break;
|
|
618
|
+
case 'ZH':
|
|
619
|
+
voice = 'zh-CN';
|
|
620
|
+
break;
|
|
621
|
+
case 'JA':
|
|
622
|
+
voice = 'ja-JP';
|
|
623
|
+
break;
|
|
624
|
+
default:
|
|
625
|
+
voice = 'it-IT';
|
|
626
|
+
break;
|
|
627
|
+
}
|
|
628
|
+
return voice;
|
|
629
|
+
};
|
|
554
630
|
const [sessionId, setSessionId] = (0, react_1.useState)(initialSessionID);
|
|
555
631
|
const [currentDialogState, _setCurrentDialogState] = (0, react_1.useState)();
|
|
556
632
|
const setCurrentDialogState = (state) => {
|
|
557
|
-
var _a;
|
|
633
|
+
var _a, _b;
|
|
558
634
|
_setCurrentDialogState(state);
|
|
559
635
|
if (onStateChange) {
|
|
560
636
|
onStateChange(state);
|
|
561
637
|
}
|
|
562
|
-
const
|
|
638
|
+
const e = new CustomEvent('MemoriNewDialogState', {
|
|
639
|
+
detail: state,
|
|
640
|
+
});
|
|
641
|
+
document.dispatchEvent(e);
|
|
642
|
+
const executableSnippets = (_b = ((_a = state === null || state === void 0 ? void 0 : state.emittedMedia) !== null && _a !== void 0 ? _a : state === null || state === void 0 ? void 0 : state.media)) === null || _b === void 0 ? void 0 : _b.filter(m => { var _a; return m.mimeType === 'text/javascript' && !!((_a = m.properties) === null || _a === void 0 ? void 0 : _a.executable); });
|
|
563
643
|
executableSnippets === null || executableSnippets === void 0 ? void 0 : executableSnippets.forEach(s => {
|
|
564
644
|
try {
|
|
565
645
|
setTimeout(() => {
|
|
@@ -574,14 +654,15 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
574
654
|
}, 1000);
|
|
575
655
|
}
|
|
576
656
|
catch (e) {
|
|
577
|
-
console.
|
|
657
|
+
console.warn(e);
|
|
578
658
|
}
|
|
579
659
|
});
|
|
580
660
|
};
|
|
581
661
|
const fetchSession = async (params) => {
|
|
582
662
|
var _a, _b, _c, _d, _f;
|
|
583
663
|
let storageBirthDate = (0, configuration_1.getLocalConfig)('birthDate', undefined);
|
|
584
|
-
|
|
664
|
+
let userBirthDate = (_a = birthDate !== null && birthDate !== void 0 ? birthDate : params.birthDate) !== null && _a !== void 0 ? _a : storageBirthDate;
|
|
665
|
+
if (!userBirthDate && !!minAge) {
|
|
585
666
|
setShowAgeVerification(true);
|
|
586
667
|
return;
|
|
587
668
|
}
|
|
@@ -594,13 +675,6 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
594
675
|
}
|
|
595
676
|
setLoading(true);
|
|
596
677
|
try {
|
|
597
|
-
if (!memori.giverTag && !!((_a = memori.receivedInvitations) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
598
|
-
let giverInvitation = memori.receivedInvitations.find((i) => i.type === 'GIVER' && i.state === 'ACCEPTED');
|
|
599
|
-
if (giverInvitation) {
|
|
600
|
-
memori.giverTag = giverInvitation.tag;
|
|
601
|
-
memori.giverPIN = giverInvitation.pin;
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
678
|
let referral;
|
|
605
679
|
try {
|
|
606
680
|
referral = (() => {
|
|
@@ -608,10 +682,11 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
608
682
|
})();
|
|
609
683
|
}
|
|
610
684
|
catch (err) {
|
|
611
|
-
console.
|
|
685
|
+
console.debug(err);
|
|
612
686
|
}
|
|
613
687
|
const session = await initSession({
|
|
614
688
|
...params,
|
|
689
|
+
birthDate: userBirthDate,
|
|
615
690
|
tag: (_b = params.tag) !== null && _b !== void 0 ? _b : personification === null || personification === void 0 ? void 0 : personification.tag,
|
|
616
691
|
pin: (_c = params.pin) !== null && _c !== void 0 ? _c : personification === null || personification === void 0 ? void 0 : personification.pin,
|
|
617
692
|
additionalInfo: {
|
|
@@ -619,13 +694,20 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
619
694
|
loginToken: (_f = (_d = userToken !== null && userToken !== void 0 ? userToken : loginToken) !== null && _d !== void 0 ? _d : additionalInfo === null || additionalInfo === void 0 ? void 0 : additionalInfo.loginToken) !== null && _f !== void 0 ? _f : authToken,
|
|
620
695
|
language: getCultureCodeByLanguage(userLang),
|
|
621
696
|
referral: referral,
|
|
697
|
+
timeZoneOffset: new Date().getTimezoneOffset().toString(),
|
|
622
698
|
},
|
|
623
699
|
});
|
|
624
700
|
if ((session === null || session === void 0 ? void 0 : session.sessionID) &&
|
|
625
701
|
(session === null || session === void 0 ? void 0 : session.currentState) &&
|
|
626
702
|
session.resultCode === 0) {
|
|
627
703
|
setSessionId(session.sessionID);
|
|
628
|
-
if (
|
|
704
|
+
if ((currentDialogState === null || currentDialogState === void 0 ? void 0 : currentDialogState.currentTag) && memori.giverTag) {
|
|
705
|
+
setInstruct((currentDialogState === null || currentDialogState === void 0 ? void 0 : currentDialogState.currentTag) === memori.giverTag);
|
|
706
|
+
}
|
|
707
|
+
else {
|
|
708
|
+
setInstruct(false);
|
|
709
|
+
}
|
|
710
|
+
if (position && memori.needsPosition)
|
|
629
711
|
applyPosition(position, session.sessionID);
|
|
630
712
|
setLoading(false);
|
|
631
713
|
return {
|
|
@@ -634,31 +716,35 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
634
716
|
};
|
|
635
717
|
}
|
|
636
718
|
else if (session === null || session === void 0 ? void 0 : session.resultMessage.startsWith('This Memori is aged restricted')) {
|
|
637
|
-
console.
|
|
719
|
+
console.warn(session);
|
|
638
720
|
react_hot_toast_1.default.error(t('underageTwinSession', { age: minAge }));
|
|
639
721
|
setGotErrorInOpening(true);
|
|
640
722
|
}
|
|
641
723
|
else if ((session === null || session === void 0 ? void 0 : session.resultCode) === 403) {
|
|
642
724
|
setMemoriPwd(undefined);
|
|
643
725
|
setAuthModalState('password');
|
|
726
|
+
return session;
|
|
644
727
|
}
|
|
645
728
|
else {
|
|
646
|
-
console.
|
|
647
|
-
react_hot_toast_1.default.error(t((0, error_1.getErrori18nKey)(session === null || session === void 0 ? void 0 : session.resultCode)))
|
|
729
|
+
console.warn(session);
|
|
730
|
+
react_hot_toast_1.default.error(tst => ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("p", { children: t((0, error_1.getErrori18nKey)(session === null || session === void 0 ? void 0 : session.resultCode)) }), (0, jsx_runtime_1.jsx)(Button_1.default, { outlined: true, padded: false, onClick: () => react_hot_toast_1.default.dismiss(tst.id), icon: (0, jsx_runtime_1.jsx)(Close_1.default, {}), children: t('close') })] })), {
|
|
731
|
+
duration: Infinity,
|
|
732
|
+
});
|
|
648
733
|
setGotErrorInOpening(true);
|
|
734
|
+
return session;
|
|
649
735
|
}
|
|
650
736
|
}
|
|
651
737
|
catch (err) {
|
|
652
738
|
console.error(err);
|
|
653
|
-
new Error('Error fetching session');
|
|
654
739
|
}
|
|
655
740
|
};
|
|
656
741
|
const reopenSession = async (updateDialogState = false, password, recoveryTokens, tag, pin, initialContextVars, initialQuestion, birthDate) => {
|
|
657
|
-
var _a, _b, _c, _d, _f;
|
|
742
|
+
var _a, _b, _c, _d, _f, _g, _h;
|
|
658
743
|
setLoading(true);
|
|
744
|
+
let storageBirthDate = (0, configuration_1.getLocalConfig)('birthDate', undefined);
|
|
745
|
+
let userBirthDate = birthDate !== null && birthDate !== void 0 ? birthDate : storageBirthDate;
|
|
659
746
|
try {
|
|
660
|
-
|
|
661
|
-
if (!(birthDate || storageBirthDate) && !!minAge) {
|
|
747
|
+
if (!userBirthDate && !!minAge) {
|
|
662
748
|
setShowAgeVerification(true);
|
|
663
749
|
return;
|
|
664
750
|
}
|
|
@@ -676,28 +762,30 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
676
762
|
referral = (() => {
|
|
677
763
|
return window.location.href;
|
|
678
764
|
})();
|
|
765
|
+
console.log('[REOPEN_SESSION] Got referral:', referral);
|
|
679
766
|
}
|
|
680
767
|
catch (err) {
|
|
681
|
-
console.
|
|
768
|
+
console.debug('[REOPEN_SESSION] Error getting referral:', err);
|
|
682
769
|
}
|
|
683
770
|
const { sessionID, currentState, ...response } = await initSession({
|
|
684
771
|
memoriID: (_a = memori.engineMemoriID) !== null && _a !== void 0 ? _a : '',
|
|
685
772
|
password: password || memoriPwd || memori.secretToken,
|
|
686
773
|
recoveryTokens: recoveryTokens || memoriTokens,
|
|
687
|
-
tag,
|
|
688
|
-
pin,
|
|
774
|
+
tag: tag !== null && tag !== void 0 ? tag : personification === null || personification === void 0 ? void 0 : personification.tag,
|
|
775
|
+
pin: pin !== null && pin !== void 0 ? pin : personification === null || personification === void 0 ? void 0 : personification.pin,
|
|
689
776
|
initialContextVars: {
|
|
690
777
|
PATHNAME: window.location.pathname,
|
|
691
778
|
ROUTE: ((_c = (_b = window.location.pathname) === null || _b === void 0 ? void 0 : _b.split('/')) === null || _c === void 0 ? void 0 : _c.pop()) || '',
|
|
692
779
|
...(initialContextVars || {}),
|
|
693
780
|
},
|
|
694
781
|
initialQuestion,
|
|
695
|
-
birthDate:
|
|
782
|
+
birthDate: userBirthDate,
|
|
696
783
|
additionalInfo: {
|
|
697
784
|
...(additionalInfo || {}),
|
|
698
785
|
loginToken: (_f = (_d = userToken !== null && userToken !== void 0 ? userToken : loginToken) !== null && _d !== void 0 ? _d : additionalInfo === null || additionalInfo === void 0 ? void 0 : additionalInfo.loginToken) !== null && _f !== void 0 ? _f : authToken,
|
|
699
786
|
language: getCultureCodeByLanguage(userLang),
|
|
700
787
|
referral: referral,
|
|
788
|
+
timeZoneOffset: new Date().getTimezoneOffset().toString(),
|
|
701
789
|
},
|
|
702
790
|
});
|
|
703
791
|
if (sessionID && currentState && response.resultCode === 0) {
|
|
@@ -710,7 +798,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
710
798
|
{
|
|
711
799
|
text: currentState.emission,
|
|
712
800
|
emitter: currentState.emitter,
|
|
713
|
-
media: currentState.media,
|
|
801
|
+
media: (_g = currentState.emittedMedia) !== null && _g !== void 0 ? _g : currentState.media,
|
|
714
802
|
fromUser: false,
|
|
715
803
|
initial: true,
|
|
716
804
|
contextVars: currentState.contextVars,
|
|
@@ -726,7 +814,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
726
814
|
: pushMessage({
|
|
727
815
|
text: currentState.emission,
|
|
728
816
|
emitter: currentState.emitter,
|
|
729
|
-
media: currentState.media,
|
|
817
|
+
media: (_h = currentState.emittedMedia) !== null && _h !== void 0 ? _h : currentState.media,
|
|
730
818
|
fromUser: false,
|
|
731
819
|
initial: true,
|
|
732
820
|
contextVars: currentState.contextVars,
|
|
@@ -740,10 +828,12 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
740
828
|
});
|
|
741
829
|
}
|
|
742
830
|
}
|
|
743
|
-
if (position)
|
|
831
|
+
if (position && memori.needsPosition) {
|
|
744
832
|
applyPosition(position, sessionID);
|
|
745
|
-
|
|
833
|
+
}
|
|
834
|
+
if (memori.needsDateTime) {
|
|
746
835
|
sendDateChangedEvent({ sessionID: sessionID, state: currentState });
|
|
836
|
+
}
|
|
747
837
|
setLoading(false);
|
|
748
838
|
return {
|
|
749
839
|
dialogState: currentState,
|
|
@@ -751,26 +841,118 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
751
841
|
};
|
|
752
842
|
}
|
|
753
843
|
else if (response === null || response === void 0 ? void 0 : response.resultMessage.startsWith('This Memori is aged restricted')) {
|
|
754
|
-
console.error(response);
|
|
844
|
+
console.error('[REOPEN_SESSION] Age restriction error:', response);
|
|
755
845
|
react_hot_toast_1.default.error(t('underageTwinSession', { age: minAge }));
|
|
756
846
|
setGotErrorInOpening(true);
|
|
757
847
|
}
|
|
758
848
|
else if ((response === null || response === void 0 ? void 0 : response.resultCode) === 403) {
|
|
849
|
+
console.error('[REOPEN_SESSION] Authentication error');
|
|
759
850
|
setMemoriPwd(undefined);
|
|
760
851
|
setAuthModalState('password');
|
|
761
852
|
}
|
|
762
853
|
else {
|
|
763
|
-
console.error(response);
|
|
854
|
+
console.error('[REOPEN_SESSION] Other error:', response);
|
|
764
855
|
react_hot_toast_1.default.error(t((0, error_1.getErrori18nKey)(response.resultCode)));
|
|
765
856
|
setGotErrorInOpening(true);
|
|
766
857
|
}
|
|
767
858
|
}
|
|
768
859
|
catch (err) {
|
|
769
|
-
console.error(err);
|
|
860
|
+
console.error('[REOPEN_SESSION] Caught error:', err);
|
|
770
861
|
}
|
|
771
862
|
setLoading(false);
|
|
772
863
|
return null;
|
|
773
864
|
};
|
|
865
|
+
const [chatLogs, setChatLogs] = (0, react_1.useState)([]);
|
|
866
|
+
const resumeSession = async (chatLog, questionsAndAnswers, initialContextVars, initialQuestion, birthDate) => {
|
|
867
|
+
var _a, _b, _c, _d, _f;
|
|
868
|
+
setLoading(true);
|
|
869
|
+
let storageBirthDate = (0, configuration_1.getLocalConfig)('birthDate', undefined);
|
|
870
|
+
let userBirthDate = birthDate !== null && birthDate !== void 0 ? birthDate : storageBirthDate;
|
|
871
|
+
try {
|
|
872
|
+
if (!userBirthDate && !!minAge) {
|
|
873
|
+
setShowAgeVerification(true);
|
|
874
|
+
return;
|
|
875
|
+
}
|
|
876
|
+
if (memori.privacyType !== 'PUBLIC' &&
|
|
877
|
+
!memoriPassword &&
|
|
878
|
+
!memori.secretToken &&
|
|
879
|
+
!memoriPwd &&
|
|
880
|
+
!memoriTokens) {
|
|
881
|
+
setAuthModalState('password');
|
|
882
|
+
return;
|
|
883
|
+
}
|
|
884
|
+
let referral;
|
|
885
|
+
try {
|
|
886
|
+
referral = (() => {
|
|
887
|
+
return window.location.href;
|
|
888
|
+
})();
|
|
889
|
+
console.log('[REOPEN_SESSION] Got referral:', referral);
|
|
890
|
+
}
|
|
891
|
+
catch (err) {
|
|
892
|
+
console.debug('[REOPEN_SESSION] Error getting referral:', err);
|
|
893
|
+
}
|
|
894
|
+
const { sessionID, currentState, ...response } = await initSession({
|
|
895
|
+
memoriID: (_a = memori.engineMemoriID) !== null && _a !== void 0 ? _a : '',
|
|
896
|
+
password: memoriPassword || memoriPwd || memori.secretToken,
|
|
897
|
+
recoveryTokens: memoriTokens,
|
|
898
|
+
tag: personification === null || personification === void 0 ? void 0 : personification.tag,
|
|
899
|
+
pin: personification === null || personification === void 0 ? void 0 : personification.pin,
|
|
900
|
+
continueFromChatLogID: chatLog.chatLogID,
|
|
901
|
+
initialContextVars: {
|
|
902
|
+
PATHNAME: window.location.pathname,
|
|
903
|
+
ROUTE: ((_c = (_b = window.location.pathname) === null || _b === void 0 ? void 0 : _b.split('/')) === null || _c === void 0 ? void 0 : _c.pop()) || '',
|
|
904
|
+
...(initialContextVars || {}),
|
|
905
|
+
},
|
|
906
|
+
initialQuestion,
|
|
907
|
+
birthDate: userBirthDate,
|
|
908
|
+
additionalInfo: {
|
|
909
|
+
...(additionalInfo || {}),
|
|
910
|
+
loginToken: (_f = (_d = userToken !== null && userToken !== void 0 ? userToken : loginToken) !== null && _d !== void 0 ? _d : additionalInfo === null || additionalInfo === void 0 ? void 0 : additionalInfo.loginToken) !== null && _f !== void 0 ? _f : authToken,
|
|
911
|
+
language: getCultureCodeByLanguage(userLang),
|
|
912
|
+
referral: referral,
|
|
913
|
+
timeZoneOffset: new Date().getTimezoneOffset().toString(),
|
|
914
|
+
},
|
|
915
|
+
});
|
|
916
|
+
if (sessionID) {
|
|
917
|
+
setSessionId(sessionID);
|
|
918
|
+
setHistory(chatLog.lines.map(log => {
|
|
919
|
+
var _a;
|
|
920
|
+
return ({
|
|
921
|
+
text: log.text,
|
|
922
|
+
emitter: log.emitter,
|
|
923
|
+
media: (_a = log.media) === null || _a === void 0 ? void 0 : _a.map(m => ({
|
|
924
|
+
...m,
|
|
925
|
+
mediumID: 'mediumID' in m ? String(m.mediumID) : crypto.randomUUID(),
|
|
926
|
+
})),
|
|
927
|
+
fromUser: log.inbound,
|
|
928
|
+
initial: false,
|
|
929
|
+
contextVars: log.contextVars,
|
|
930
|
+
date: log.timestamp,
|
|
931
|
+
});
|
|
932
|
+
}));
|
|
933
|
+
setChatLogs(questionsAndAnswers);
|
|
934
|
+
}
|
|
935
|
+
else if (response === null || response === void 0 ? void 0 : response.resultMessage.startsWith('This Memori is aged restricted')) {
|
|
936
|
+
console.error('[REOPEN_SESSION] Age restriction error:', response);
|
|
937
|
+
react_hot_toast_1.default.error(t('underageTwinSession', { age: minAge }));
|
|
938
|
+
setGotErrorInOpening(true);
|
|
939
|
+
}
|
|
940
|
+
else if ((response === null || response === void 0 ? void 0 : response.resultCode) === 403) {
|
|
941
|
+
console.error('[REOPEN_SESSION] Authentication error');
|
|
942
|
+
setMemoriPwd(undefined);
|
|
943
|
+
setAuthModalState('password');
|
|
944
|
+
}
|
|
945
|
+
else {
|
|
946
|
+
console.error('[REOPEN_SESSION] Other error:', response);
|
|
947
|
+
react_hot_toast_1.default.error(t((0, error_1.getErrori18nKey)(response.resultCode)));
|
|
948
|
+
setGotErrorInOpening(true);
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
catch (err) {
|
|
952
|
+
console.error('[RESUME_SESSION] Caught error:', err);
|
|
953
|
+
}
|
|
954
|
+
setLoading(false);
|
|
955
|
+
};
|
|
774
956
|
const changeTag = async (memoriId, sessionId, tag, pin) => {
|
|
775
957
|
var _a, _b, _c, _d, _f;
|
|
776
958
|
if (!memoriId || !sessionId) {
|
|
@@ -810,13 +992,13 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
810
992
|
})();
|
|
811
993
|
}
|
|
812
994
|
catch (err) {
|
|
813
|
-
console.
|
|
995
|
+
console.debug(err);
|
|
814
996
|
}
|
|
815
997
|
fetchSession({
|
|
816
998
|
memoriID: (_a = memori.engineMemoriID) !== null && _a !== void 0 ? _a : '',
|
|
817
999
|
password: secret || memoriPwd || memori.secretToken,
|
|
818
|
-
tag:
|
|
819
|
-
pin:
|
|
1000
|
+
tag: tag !== null && tag !== void 0 ? tag : personification === null || personification === void 0 ? void 0 : personification.tag,
|
|
1001
|
+
pin: pin !== null && pin !== void 0 ? pin : personification === null || personification === void 0 ? void 0 : personification.pin,
|
|
820
1002
|
initialContextVars: {
|
|
821
1003
|
PATHNAME: window.location.pathname,
|
|
822
1004
|
ROUTE: ((_c = (_b = window.location.pathname) === null || _b === void 0 ? void 0 : _b.split('/')) === null || _c === void 0 ? void 0 : _c.pop()) || '',
|
|
@@ -829,6 +1011,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
829
1011
|
loginToken: (_f = (_d = userToken !== null && userToken !== void 0 ? userToken : loginToken) !== null && _d !== void 0 ? _d : additionalInfo === null || additionalInfo === void 0 ? void 0 : additionalInfo.loginToken) !== null && _f !== void 0 ? _f : authToken,
|
|
830
1012
|
language: getCultureCodeByLanguage(userLang),
|
|
831
1013
|
referral: referral,
|
|
1014
|
+
timeZoneOffset: new Date().getTimezoneOffset().toString(),
|
|
832
1015
|
},
|
|
833
1016
|
});
|
|
834
1017
|
}
|
|
@@ -843,24 +1026,11 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
843
1026
|
}
|
|
844
1027
|
catch (_e) {
|
|
845
1028
|
let err = _e;
|
|
846
|
-
console.
|
|
1029
|
+
console.warn('[APPCONTEXT/CHANGETAG]', err);
|
|
847
1030
|
return Promise.reject(err);
|
|
848
1031
|
}
|
|
849
1032
|
return null;
|
|
850
1033
|
};
|
|
851
|
-
const restoreGiverTag = async () => {
|
|
852
|
-
if (sessionId && memori.giverTag && memori.giverPIN) {
|
|
853
|
-
setHistory([]);
|
|
854
|
-
await changeTag(memori.engineMemoriID, sessionId, memori.giverTag, memori.giverPIN);
|
|
855
|
-
}
|
|
856
|
-
};
|
|
857
|
-
(0, react_1.useEffect)(() => {
|
|
858
|
-
return () => {
|
|
859
|
-
if (!currentDialogState ||
|
|
860
|
-
(currentDialogState === null || currentDialogState === void 0 ? void 0 : currentDialogState.currentTag) !== memori.giverTag)
|
|
861
|
-
restoreGiverTag();
|
|
862
|
-
};
|
|
863
|
-
}, []);
|
|
864
1034
|
const sendDateChangedEvent = (0, react_1.useCallback)(async ({ sessionID, date, state, }) => {
|
|
865
1035
|
var _a;
|
|
866
1036
|
const session = sessionID !== null && sessionID !== void 0 ? sessionID : sessionId;
|
|
@@ -911,547 +1081,122 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
911
1081
|
timeoutRef.current = undefined;
|
|
912
1082
|
}
|
|
913
1083
|
};
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
1084
|
+
(0, react_1.useEffect)(() => {
|
|
1085
|
+
return () => {
|
|
1086
|
+
setHasUserActivatedSpeak(false);
|
|
1087
|
+
setClickedStart(false);
|
|
1088
|
+
clearInteractionTimeout();
|
|
1089
|
+
timeoutRef.current = undefined;
|
|
1090
|
+
};
|
|
1091
|
+
}, []);
|
|
1092
|
+
const [requestedListening, setRequestedListening] = (0, react_1.useState)(false);
|
|
1093
|
+
const startListeningRef = (0, react_1.useRef)(null);
|
|
1094
|
+
console.log('tenantID', tenantID);
|
|
1095
|
+
const ttsConfig = (0, react_1.useMemo)(() => {
|
|
1096
|
+
var _a, _b;
|
|
1097
|
+
return ({
|
|
1098
|
+
provider: ttsProvider,
|
|
1099
|
+
voice: (0, ttsVoiceUtility_1.getTTSVoice)(userLang || ((_b = (_a = memori.culture) === null || _a === void 0 ? void 0 : _a.split('-')) === null || _b === void 0 ? void 0 : _b[0]) || 'EN', ttsProvider, memori.voiceType),
|
|
1100
|
+
tenant: tenantID,
|
|
1101
|
+
region: 'westeurope',
|
|
1102
|
+
voiceType: memori.voiceType,
|
|
1103
|
+
layout: selectedLayout,
|
|
1104
|
+
});
|
|
1105
|
+
}, [ttsProvider, userLang, memori.culture, memori.voiceType]);
|
|
1106
|
+
const sttConfig = (0, react_1.useMemo)(() => ({
|
|
1107
|
+
provider: ttsProvider,
|
|
1108
|
+
language: getCultureCodeByLanguage(userLang),
|
|
1109
|
+
tenant: tenantID,
|
|
1110
|
+
}), [ttsProvider, userLang]);
|
|
1111
|
+
const { speak: ttsSpeak, stop: ttsStop, isPlaying: isPlayingAudio, speakerMuted, toggleMute, hasUserActivatedSpeak, setHasUserActivatedSpeak, error, setError, } = (0, useTTS_1.useTTS)(ttsConfig, {
|
|
1112
|
+
apiUrl: `${baseUrl}/api/tts`,
|
|
1113
|
+
continuousSpeech: continuousSpeech,
|
|
1114
|
+
preview: preview,
|
|
1115
|
+
}, autoStart, defaultEnableAudio, defaultSpeakerActive);
|
|
1116
|
+
const processSpeechAndSendMessage = (text) => {
|
|
1117
|
+
console.log('processSpeechAndSendMessage', text);
|
|
1118
|
+
if (!text || text.trim().length === 0) {
|
|
927
1119
|
return;
|
|
928
1120
|
}
|
|
929
|
-
else if (sessionId &&
|
|
930
|
-
hasUserActivatedSpeak &&
|
|
931
|
-
(currentDialogState === null || currentDialogState === void 0 ? void 0 : currentDialogState.acceptsTimeout)) {
|
|
932
|
-
const { currentState, ...response } = await postTimeoutEvent(sessionId);
|
|
933
|
-
if (response.resultCode === 0 && currentState) {
|
|
934
|
-
const emission = currentState.emission;
|
|
935
|
-
if (!instruct &&
|
|
936
|
-
isMultilanguageEnabled &&
|
|
937
|
-
userLang !== (i18n === null || i18n === void 0 ? void 0 : i18n.language) &&
|
|
938
|
-
emission &&
|
|
939
|
-
emission.length > 0) {
|
|
940
|
-
translateDialogState({ ...currentState, emission: emission }, userLang).then(ts => {
|
|
941
|
-
if (ts.emission) {
|
|
942
|
-
speak(ts.emission);
|
|
943
|
-
}
|
|
944
|
-
});
|
|
945
|
-
}
|
|
946
|
-
else if (emission && emission.length > 0) {
|
|
947
|
-
pushMessage({
|
|
948
|
-
text: emission,
|
|
949
|
-
emitter: currentState.emitter,
|
|
950
|
-
media: currentState.media,
|
|
951
|
-
fromUser: false,
|
|
952
|
-
generatedByAI: !!currentState.completion,
|
|
953
|
-
contextVars: currentState.contextVars,
|
|
954
|
-
date: currentState.currentDate,
|
|
955
|
-
placeName: currentState.currentPlaceName,
|
|
956
|
-
placeLatitude: currentState.currentLatitude,
|
|
957
|
-
placeLongitude: currentState.currentLongitude,
|
|
958
|
-
placeUncertaintyKm: currentState.currentUncertaintyKm,
|
|
959
|
-
tag: currentState.currentTag,
|
|
960
|
-
memoryTags: currentState.memoryTags,
|
|
961
|
-
});
|
|
962
|
-
speak(emission);
|
|
963
|
-
setCurrentDialogState({
|
|
964
|
-
...currentState,
|
|
965
|
-
hints: (_a = currentState.hints) !== null && _a !== void 0 ? _a : (currentState.state === 'G1' ? currentDialogState === null || currentDialogState === void 0 ? void 0 : currentDialogState.hints : []),
|
|
966
|
-
});
|
|
967
|
-
}
|
|
968
|
-
else {
|
|
969
|
-
resetInteractionTimeout();
|
|
970
|
-
return;
|
|
971
|
-
}
|
|
972
|
-
}
|
|
973
|
-
}
|
|
974
|
-
};
|
|
975
|
-
const setInteractionTimeout = () => {
|
|
976
|
-
let timeout = currentDialogState === null || currentDialogState === void 0 ? void 0 : currentDialogState.timeout;
|
|
977
|
-
if (!timeout) {
|
|
978
|
-
let timeoutLimit = 40;
|
|
979
|
-
let timeoutMinLimit = 25;
|
|
980
|
-
timeout =
|
|
981
|
-
Math.floor(Math.random() * (timeoutLimit - timeoutMinLimit)) +
|
|
982
|
-
timeoutMinLimit;
|
|
983
|
-
if (currentDialogState === null || currentDialogState === void 0 ? void 0 : currentDialogState.emission) {
|
|
984
|
-
let readTime = currentDialogState.emission.length / 26.5;
|
|
985
|
-
timeout = timeout + readTime;
|
|
986
|
-
}
|
|
987
|
-
}
|
|
988
|
-
if (forcedTimeout) {
|
|
989
|
-
timeout = forcedTimeout;
|
|
990
|
-
if (currentDialogState === null || currentDialogState === void 0 ? void 0 : currentDialogState.emission) {
|
|
991
|
-
let readTime = currentDialogState.emission.length / 26.5;
|
|
992
|
-
timeout = timeout + readTime;
|
|
993
|
-
}
|
|
994
|
-
}
|
|
995
|
-
let uiTimeout = setTimeout(handleTimeout, timeout * 1000);
|
|
996
|
-
setUserInteractionTimeout(uiTimeout);
|
|
997
|
-
timeoutRef.current = uiTimeout;
|
|
998
|
-
};
|
|
999
|
-
(0, react_1.useEffect)(() => {
|
|
1000
|
-
if (!!userMessage.length || isPlayingAudio || !!memoriTyping)
|
|
1001
|
-
clearInteractionTimeout();
|
|
1002
|
-
if (sessionId && !!!userMessage.length)
|
|
1003
|
-
resetInteractionTimeout();
|
|
1004
|
-
}, [
|
|
1005
|
-
currentDialogState === null || currentDialogState === void 0 ? void 0 : currentDialogState.acceptsTimeout,
|
|
1006
|
-
currentDialogState === null || currentDialogState === void 0 ? void 0 : currentDialogState.timeout,
|
|
1007
|
-
currentDialogState === null || currentDialogState === void 0 ? void 0 : currentDialogState.state,
|
|
1008
|
-
isPlayingAudio,
|
|
1009
|
-
sessionId,
|
|
1010
|
-
history,
|
|
1011
|
-
userMessage,
|
|
1012
|
-
memoriTyping,
|
|
1013
|
-
hasUserActivatedSpeak,
|
|
1014
|
-
]);
|
|
1015
|
-
(0, react_1.useEffect)(() => {
|
|
1016
|
-
return () => {
|
|
1017
|
-
setHasUserActivatedSpeak(false);
|
|
1018
|
-
setClickedStart(false);
|
|
1019
|
-
clearInteractionTimeout();
|
|
1020
|
-
timeoutRef.current = undefined;
|
|
1021
|
-
};
|
|
1022
|
-
}, []);
|
|
1023
|
-
const initializeTTS = () => {
|
|
1024
|
-
if (!AZURE_COGNITIVE_SERVICES_TTS_KEY)
|
|
1025
|
-
return;
|
|
1026
|
-
speechConfig = speechSdk.SpeechConfig.fromSubscription(AZURE_COGNITIVE_SERVICES_TTS_KEY, 'eastus');
|
|
1027
|
-
speechConfig.speechSynthesisLanguage = getCultureCodeByLanguage(userLang);
|
|
1028
|
-
speechConfig.speechSynthesisVoiceName = getTTSVoice(userLang);
|
|
1029
|
-
speechConfig.speechRecognitionLanguage = getCultureCodeByLanguage(userLang);
|
|
1030
|
-
if ((0, utils_1.hasTouchscreen)())
|
|
1031
|
-
speechConfig.speechSynthesisOutputFormat =
|
|
1032
|
-
speechSdk.SpeechSynthesisOutputFormat.Audio16Khz32KBitRateMonoMp3;
|
|
1033
|
-
audioContext = new standardized_audio_context_1.AudioContext();
|
|
1034
|
-
let buffer = audioContext.createBuffer(1, 10000, 22050);
|
|
1035
|
-
let source = audioContext.createBufferSource();
|
|
1036
|
-
source.buffer = buffer;
|
|
1037
|
-
source.connect(audioContext.destination);
|
|
1038
|
-
audioDestination = new speechSdk.SpeakerAudioDestination();
|
|
1039
|
-
let audioConfig = speechSdk.AudioConfig.fromSpeakerOutput(audioDestination);
|
|
1040
|
-
speechSynthesizer = new speechSdk.SpeechSynthesizer(speechConfig, audioConfig);
|
|
1041
|
-
};
|
|
1042
|
-
const getTTSVoice = (0, react_1.useCallback)((lang) => {
|
|
1043
|
-
var _a, _b, _c, _d;
|
|
1044
|
-
let voice = '';
|
|
1045
|
-
let voiceLang = ((_d = (_c = lang !== null && lang !== void 0 ? lang : (_b = (_a = memori.culture) === null || _a === void 0 ? void 0 : _a.split('-')) === null || _b === void 0 ? void 0 : _b[0]) !== null && _c !== void 0 ? _c : i18n.language) !== null && _d !== void 0 ? _d : 'IT').toUpperCase();
|
|
1046
|
-
let voiceType = memori.voiceType;
|
|
1047
|
-
if (memori.enableBoardOfExperts && (currentDialogState === null || currentDialogState === void 0 ? void 0 : currentDialogState.emitter)) {
|
|
1048
|
-
let expert = experts === null || experts === void 0 ? void 0 : experts.find(e => e.name === (currentDialogState === null || currentDialogState === void 0 ? void 0 : currentDialogState.emitter));
|
|
1049
|
-
}
|
|
1050
|
-
switch (voiceLang) {
|
|
1051
|
-
case 'IT':
|
|
1052
|
-
voice = `${voiceType === 'MALE' ? 'it-IT-DiegoNeural' : 'it-IT-ElsaNeural'}`;
|
|
1053
|
-
break;
|
|
1054
|
-
case 'DE':
|
|
1055
|
-
voice = `${voiceType === 'MALE' ? 'de-DE-ConradNeural' : 'de-DE-KatjaNeural'}`;
|
|
1056
|
-
break;
|
|
1057
|
-
case 'EN':
|
|
1058
|
-
voice = `${voiceType === 'MALE' ? 'en-GB-RyanNeural' : 'en-GB-SoniaNeural'}`;
|
|
1059
|
-
break;
|
|
1060
|
-
case 'ES':
|
|
1061
|
-
voice = `${voiceType === 'MALE' ? 'es-ES-AlvaroNeural' : 'es-ES-ElviraNeural'}`;
|
|
1062
|
-
break;
|
|
1063
|
-
case 'FR':
|
|
1064
|
-
voice = `${voiceType === 'MALE' ? 'fr-FR-HenriNeural' : 'fr-FR-DeniseNeural'}`;
|
|
1065
|
-
break;
|
|
1066
|
-
case 'PT':
|
|
1067
|
-
voice = `${voiceType === 'MALE' ? 'pt-PT-DuarteNeural' : 'pt-PT-RaquelNeural'}`;
|
|
1068
|
-
break;
|
|
1069
|
-
case 'UK':
|
|
1070
|
-
voice = `${voiceType === 'MALE' ? 'uk-UA-OstapNeural' : 'uk-UA-PolinaNeural'}`;
|
|
1071
|
-
break;
|
|
1072
|
-
case 'RU':
|
|
1073
|
-
voice = `${voiceType === 'MALE' ? 'ru-RU-DmitryNeural' : 'ru-RU-SvetlanaNeural'}`;
|
|
1074
|
-
break;
|
|
1075
|
-
case 'PL':
|
|
1076
|
-
voice = `${voiceType === 'MALE' ? 'pl-PL-MarekNeural' : 'pl-PL-AgnieszkaNeural'}`;
|
|
1077
|
-
break;
|
|
1078
|
-
case 'FI':
|
|
1079
|
-
voice = `${voiceType === 'MALE' ? 'fi-FI-HarriNeural' : 'fi-FI-SelmaNeural'}`;
|
|
1080
|
-
break;
|
|
1081
|
-
case 'EL':
|
|
1082
|
-
voice = `${voiceType === 'MALE' ? 'el-GR-NestorasNeural' : 'el-GR-AthinaNeural'}`;
|
|
1083
|
-
break;
|
|
1084
|
-
case 'AR':
|
|
1085
|
-
voice = `${voiceType === 'MALE' ? 'ar-SA-HamedNeural' : 'ar-SA-ZariyahNeural'}`;
|
|
1086
|
-
break;
|
|
1087
|
-
case 'ZH':
|
|
1088
|
-
voice = `${voiceType === 'MALE' ? 'zh-CN-YunxiNeural' : 'zh-CN-XiaoxiaoNeural'}`;
|
|
1089
|
-
break;
|
|
1090
|
-
case 'JA':
|
|
1091
|
-
voice = `${voiceType === 'MALE' ? 'ja-JP-KeitaNeural' : 'ja-JP-NanamiNeural'}`;
|
|
1092
|
-
break;
|
|
1093
|
-
default:
|
|
1094
|
-
voice = `${voiceType === 'MALE' ? 'it-IT-DiegoNeural' : 'it-IT-IsabellaNeural'}`;
|
|
1095
|
-
break;
|
|
1096
|
-
}
|
|
1097
|
-
return voice;
|
|
1098
|
-
}, [
|
|
1099
|
-
memori.voiceType,
|
|
1100
|
-
memori.enableBoardOfExperts,
|
|
1101
|
-
currentDialogState === null || currentDialogState === void 0 ? void 0 : currentDialogState.emitter,
|
|
1102
|
-
i18n.language,
|
|
1103
|
-
memori.culture,
|
|
1104
|
-
]);
|
|
1105
|
-
const getCultureCodeByLanguage = (lang) => {
|
|
1106
|
-
var _a, _b;
|
|
1107
|
-
let voice = '';
|
|
1108
|
-
let voiceLang = (lang ||
|
|
1109
|
-
((_b = (_a = memori.culture) === null || _a === void 0 ? void 0 : _a.split('-')) === null || _b === void 0 ? void 0 : _b[0]) ||
|
|
1110
|
-
i18n.language ||
|
|
1111
|
-
'IT').toUpperCase();
|
|
1112
|
-
switch (voiceLang) {
|
|
1113
|
-
case 'IT':
|
|
1114
|
-
voice = 'it-IT';
|
|
1115
|
-
break;
|
|
1116
|
-
case 'DE':
|
|
1117
|
-
voice = 'de-DE';
|
|
1118
|
-
break;
|
|
1119
|
-
case 'EN':
|
|
1120
|
-
voice = 'en-GB';
|
|
1121
|
-
break;
|
|
1122
|
-
case 'ES':
|
|
1123
|
-
voice = 'es-ES';
|
|
1124
|
-
break;
|
|
1125
|
-
case 'FR':
|
|
1126
|
-
voice = 'fr-FR';
|
|
1127
|
-
break;
|
|
1128
|
-
case 'PT':
|
|
1129
|
-
voice = 'pt-PT';
|
|
1130
|
-
break;
|
|
1131
|
-
case 'UK':
|
|
1132
|
-
voice = 'uk-UK';
|
|
1133
|
-
break;
|
|
1134
|
-
case 'RU':
|
|
1135
|
-
voice = 'ru-RU';
|
|
1136
|
-
break;
|
|
1137
|
-
case 'PL':
|
|
1138
|
-
voice = 'pl-PL';
|
|
1139
|
-
break;
|
|
1140
|
-
case 'FI':
|
|
1141
|
-
voice = 'fi-FI';
|
|
1142
|
-
break;
|
|
1143
|
-
case 'EL':
|
|
1144
|
-
voice = 'el-GR';
|
|
1145
|
-
break;
|
|
1146
|
-
case 'AR':
|
|
1147
|
-
voice = 'ar-SA';
|
|
1148
|
-
break;
|
|
1149
|
-
case 'ZH':
|
|
1150
|
-
voice = 'zh-CN';
|
|
1151
|
-
break;
|
|
1152
|
-
case 'JA':
|
|
1153
|
-
voice = 'ja-JP';
|
|
1154
|
-
break;
|
|
1155
|
-
default:
|
|
1156
|
-
voice = 'it-IT';
|
|
1157
|
-
break;
|
|
1158
|
-
}
|
|
1159
|
-
return voice;
|
|
1160
|
-
};
|
|
1161
|
-
const [phonemesMap, setPhonemesMap] = (0, react_1.useState)();
|
|
1162
|
-
const fetchLexiconJSON = async () => {
|
|
1163
1121
|
try {
|
|
1164
|
-
const
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
}
|
|
1171
|
-
};
|
|
1172
|
-
(0, react_1.useEffect)(() => {
|
|
1173
|
-
fetchLexiconJSON().then(lexicon => {
|
|
1174
|
-
setPhonemesMap(lexicon);
|
|
1175
|
-
});
|
|
1176
|
-
}, []);
|
|
1177
|
-
const replaceTextWithPhonemes = (text, lang) => {
|
|
1178
|
-
var _a;
|
|
1179
|
-
if (!phonemesMap)
|
|
1180
|
-
return text;
|
|
1181
|
-
const phonemes = {
|
|
1182
|
-
...((_a = phonemesMap.common) !== null && _a !== void 0 ? _a : {}),
|
|
1183
|
-
...((tenant === null || tenant === void 0 ? void 0 : tenant.id) && phonemesMap[tenant.id] ? phonemesMap[tenant.id] : {}),
|
|
1184
|
-
};
|
|
1185
|
-
const phonemesPairs = Object.keys(phonemes).map(word => {
|
|
1186
|
-
var _a;
|
|
1187
|
-
const phoneme = (_a = phonemes[word][lang.toLowerCase()]) !== null && _a !== void 0 ? _a : phonemes[word].default;
|
|
1188
|
-
return { word, phoneme, caseSensitive: phonemes[word].caseSensitive };
|
|
1189
|
-
});
|
|
1190
|
-
const ssmlText = phonemesPairs.reduce((acc, { word, phoneme, caseSensitive }) => {
|
|
1191
|
-
return acc.replace(new RegExp(`\\b${word}\\b`, caseSensitive ? 'g' : 'gi'), `<phoneme alphabet="ipa" ph="${phoneme}">${word}</phoneme>`);
|
|
1192
|
-
}, text);
|
|
1193
|
-
return ssmlText;
|
|
1194
|
-
};
|
|
1195
|
-
const emitEndSpeakEvent = () => {
|
|
1196
|
-
const e = new CustomEvent('MemoriEndSpeak');
|
|
1197
|
-
document.dispatchEvent(e);
|
|
1198
|
-
};
|
|
1199
|
-
const speak = (text) => {
|
|
1200
|
-
if (!AZURE_COGNITIVE_SERVICES_TTS_KEY || preview) {
|
|
1201
|
-
emitEndSpeakEvent();
|
|
1202
|
-
return;
|
|
1203
|
-
}
|
|
1204
|
-
stopListening();
|
|
1205
|
-
if (preview)
|
|
1206
|
-
return;
|
|
1207
|
-
if (muteSpeaker || speakerMuted) {
|
|
1208
|
-
memoriSpeaking = false;
|
|
1209
|
-
setMemoriTyping(false);
|
|
1210
|
-
emitEndSpeakEvent();
|
|
1211
|
-
if (continuousSpeech) {
|
|
1212
|
-
setListeningTimeout();
|
|
1122
|
+
const message = (0, utils_1.stripDuplicates)(text);
|
|
1123
|
+
console.debug('Processing speech message:', message);
|
|
1124
|
+
if (message.length > 0) {
|
|
1125
|
+
setUserMessage('');
|
|
1126
|
+
console.debug('Sending message:', message);
|
|
1127
|
+
sendMessage(message);
|
|
1213
1128
|
}
|
|
1214
|
-
return;
|
|
1215
|
-
}
|
|
1216
|
-
if (audioDestination)
|
|
1217
|
-
audioDestination.pause();
|
|
1218
|
-
let isSafari = window.navigator.userAgent.includes('Safari') &&
|
|
1219
|
-
!window.navigator.userAgent.includes('Chrome');
|
|
1220
|
-
let isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent);
|
|
1221
|
-
if (audioContext.state === 'interrupted') {
|
|
1222
|
-
audioContext.resume().then(() => speak(text));
|
|
1223
|
-
return;
|
|
1224
1129
|
}
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
let buffer = audioContext.createBuffer(1, 10000, 22050);
|
|
1228
|
-
let source = audioContext.createBufferSource();
|
|
1229
|
-
source.buffer = buffer;
|
|
1230
|
-
source.connect(audioContext.destination);
|
|
1130
|
+
catch (error) {
|
|
1131
|
+
console.error('Error in processSpeechAndSendMessage:', error);
|
|
1231
1132
|
}
|
|
1232
|
-
else if (audioContext.state === 'suspended') {
|
|
1233
|
-
stopAudio();
|
|
1234
|
-
audioContext = new standardized_audio_context_1.AudioContext();
|
|
1235
|
-
let buffer = audioContext.createBuffer(1, 10000, 22050);
|
|
1236
|
-
let source = audioContext.createBufferSource();
|
|
1237
|
-
source.buffer = buffer;
|
|
1238
|
-
source.connect(audioContext.destination);
|
|
1239
|
-
}
|
|
1240
|
-
if (!speechSynthesizer) {
|
|
1241
|
-
if (!isIOS) {
|
|
1242
|
-
audioDestination = new speechSdk.SpeakerAudioDestination();
|
|
1243
|
-
}
|
|
1244
|
-
let audioConfig = speechSdk.AudioConfig.fromSpeakerOutput(audioDestination);
|
|
1245
|
-
speechSynthesizer = new speechSdk.SpeechSynthesizer(speechConfig, audioConfig);
|
|
1246
|
-
}
|
|
1247
|
-
const source = audioContext.createBufferSource();
|
|
1248
|
-
source.addEventListener('ended', () => {
|
|
1249
|
-
setIsPlayingAudio(false);
|
|
1250
|
-
memoriSpeaking = false;
|
|
1251
|
-
});
|
|
1252
|
-
audioDestination.onAudioEnd = () => {
|
|
1253
|
-
setIsPlayingAudio(false);
|
|
1254
|
-
memoriSpeaking = false;
|
|
1255
|
-
source.disconnect();
|
|
1256
|
-
emitEndSpeakEvent();
|
|
1257
|
-
onEndSpeakStartListen();
|
|
1258
|
-
};
|
|
1259
|
-
speechSynthesizer.speakSsmlAsync(`<speak version="1.0" xmlns="http://www.w3.org/2001/10/synthesis" xmlns:mstts="https://www.w3.org/2001/mstts" xmlns:emo="http://www.w3.org/2009/10/emotionml" xml:lang="${getCultureCodeByLanguage(userLang)}"><voice name="${getTTSVoice(userLang)}"><s>${replaceTextWithPhonemes((0, utils_1.escapeHTML)((0, utils_1.stripMarkdown)((0, utils_1.stripEmojis)(text))), userLang.toLowerCase())}</s></voice></speak>`, result => {
|
|
1260
|
-
if (result) {
|
|
1261
|
-
setIsPlayingAudio(true);
|
|
1262
|
-
memoriSpeaking = true;
|
|
1263
|
-
try {
|
|
1264
|
-
audioContext.decodeAudioData(result.audioData, function (buffer) {
|
|
1265
|
-
source.buffer = buffer;
|
|
1266
|
-
source.connect(audioContext.destination);
|
|
1267
|
-
if (history.length < 1 || (isSafari && isIOS)) {
|
|
1268
|
-
source.start(0);
|
|
1269
|
-
}
|
|
1270
|
-
});
|
|
1271
|
-
audioContext.onstatechange = () => {
|
|
1272
|
-
if (audioContext.state === 'suspended' ||
|
|
1273
|
-
audioContext.state === 'closed') {
|
|
1274
|
-
source.disconnect();
|
|
1275
|
-
setIsPlayingAudio(false);
|
|
1276
|
-
memoriSpeaking = false;
|
|
1277
|
-
}
|
|
1278
|
-
else if (audioContext.state === 'interrupted') {
|
|
1279
|
-
audioContext.resume();
|
|
1280
|
-
}
|
|
1281
|
-
};
|
|
1282
|
-
audioContext.resume();
|
|
1283
|
-
if (speechSynthesizer) {
|
|
1284
|
-
speechSynthesizer.close();
|
|
1285
|
-
speechSynthesizer = null;
|
|
1286
|
-
}
|
|
1287
|
-
}
|
|
1288
|
-
catch (e) {
|
|
1289
|
-
console.error('speak error: ', e);
|
|
1290
|
-
window.speechSynthesis.speak(new SpeechSynthesisUtterance(text));
|
|
1291
|
-
setIsPlayingAudio(false);
|
|
1292
|
-
memoriSpeaking = false;
|
|
1293
|
-
if (speechSynthesizer) {
|
|
1294
|
-
speechSynthesizer.close();
|
|
1295
|
-
speechSynthesizer = null;
|
|
1296
|
-
}
|
|
1297
|
-
emitEndSpeakEvent();
|
|
1298
|
-
}
|
|
1299
|
-
}
|
|
1300
|
-
else {
|
|
1301
|
-
audioContext.resume();
|
|
1302
|
-
setIsPlayingAudio(false);
|
|
1303
|
-
memoriSpeaking = false;
|
|
1304
|
-
emitEndSpeakEvent();
|
|
1305
|
-
}
|
|
1306
|
-
}, error => {
|
|
1307
|
-
console.error('speak:', error);
|
|
1308
|
-
window.speechSynthesis.speak(new SpeechSynthesisUtterance(text));
|
|
1309
|
-
setIsPlayingAudio(false);
|
|
1310
|
-
memoriSpeaking = false;
|
|
1311
|
-
emitEndSpeakEvent();
|
|
1312
|
-
});
|
|
1313
|
-
setMemoriTyping(false);
|
|
1314
1133
|
};
|
|
1315
|
-
const
|
|
1316
|
-
|
|
1317
|
-
|
|
1134
|
+
const { isListening, startRecording, stopRecording, } = (0, useSTT_1.useSTT)(sttConfig, processSpeechAndSendMessage, {
|
|
1135
|
+
apiUrl: `${baseUrl}/api/stt`,
|
|
1136
|
+
continuousRecording: continuousSpeech,
|
|
1137
|
+
silenceTimeout: continuousSpeechTimeout,
|
|
1138
|
+
autoStart: autoStart,
|
|
1139
|
+
}, defaultEnableAudio);
|
|
1140
|
+
const handleSpeak = async (text) => {
|
|
1141
|
+
if (!text || !text.trim() || preview || speakerMuted || !defaultEnableAudio) {
|
|
1142
|
+
const e = new CustomEvent('MemoriEndSpeak');
|
|
1143
|
+
document.dispatchEvent(e);
|
|
1144
|
+
return Promise.resolve();
|
|
1145
|
+
}
|
|
1146
|
+
if (typeof stopRecording === 'function') {
|
|
1147
|
+
stopRecording();
|
|
1148
|
+
}
|
|
1149
|
+
const processedText = (0, sanitizer_1.sanitizeText)(text);
|
|
1150
|
+
return ttsSpeak(processedText);
|
|
1151
|
+
};
|
|
1152
|
+
const translateAndSpeak = (0, react_1.useCallback)(async (dialogState, language, msg, skipEmission = false) => {
|
|
1318
1153
|
try {
|
|
1319
|
-
if (
|
|
1320
|
-
|
|
1321
|
-
|
|
1154
|
+
if (!dialogState) {
|
|
1155
|
+
console.warn('translateAndSpeak called with empty dialog state');
|
|
1156
|
+
return null;
|
|
1322
1157
|
}
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1158
|
+
const translatedState = await translateDialogState(dialogState, language, msg, skipEmission);
|
|
1159
|
+
const textToSpeak = translatedState.translatedEmission || translatedState.emission;
|
|
1160
|
+
if (textToSpeak && textToSpeak.trim() && !skipEmission && !speakerMuted) {
|
|
1161
|
+
if (!hasUserActivatedSpeak) {
|
|
1162
|
+
setHasUserActivatedSpeak(true);
|
|
1163
|
+
}
|
|
1164
|
+
await handleSpeak(textToSpeak);
|
|
1329
1165
|
}
|
|
1166
|
+
return translatedState;
|
|
1330
1167
|
}
|
|
1331
|
-
catch (
|
|
1332
|
-
console.error('
|
|
1168
|
+
catch (error) {
|
|
1169
|
+
console.error('Error in translateAndSpeak:', error);
|
|
1170
|
+
if (!hasUserActivatedSpeak) {
|
|
1171
|
+
setHasUserActivatedSpeak(true);
|
|
1172
|
+
}
|
|
1173
|
+
return dialogState;
|
|
1333
1174
|
}
|
|
1334
|
-
}
|
|
1335
|
-
|
|
1175
|
+
}, [
|
|
1176
|
+
translateDialogState,
|
|
1177
|
+
handleSpeak,
|
|
1178
|
+
hasUserActivatedSpeak,
|
|
1179
|
+
setHasUserActivatedSpeak,
|
|
1180
|
+
]);
|
|
1181
|
+
const stopAudio = (0, react_1.useCallback)(async () => {
|
|
1182
|
+
ttsStop();
|
|
1183
|
+
}, [ttsStop]);
|
|
1184
|
+
const focusChatInput = () => {
|
|
1336
1185
|
let textarea = document.querySelector('#chat-fieldset textarea');
|
|
1337
|
-
if (textarea)
|
|
1186
|
+
if (textarea && enableFocusChatInput) {
|
|
1338
1187
|
textarea.focus();
|
|
1339
|
-
}, [currentDialogState === null || currentDialogState === void 0 ? void 0 : currentDialogState.emission]);
|
|
1340
|
-
const [transcript, setTranscript] = (0, react_1.useState)('');
|
|
1341
|
-
const resetTranscript = () => setTranscript('');
|
|
1342
|
-
const [transcriptTimeout, setTranscriptTimeout] = (0, react_1.useState)(null);
|
|
1343
|
-
const setListeningTimeout = () => {
|
|
1344
|
-
let timeout = setTimeout(async () => {
|
|
1345
|
-
clearListening();
|
|
1346
|
-
const message = (0, utils_1.stripDuplicates)(transcript);
|
|
1347
|
-
if (message.length > 0 && listening) {
|
|
1348
|
-
sendMessage(message);
|
|
1349
|
-
resetTranscript();
|
|
1350
|
-
setUserMessage('');
|
|
1351
|
-
}
|
|
1352
|
-
else if (listening) {
|
|
1353
|
-
resetInteractionTimeout();
|
|
1354
|
-
}
|
|
1355
|
-
}, continuousSpeechTimeout * 1000);
|
|
1356
|
-
setTranscriptTimeout(timeout);
|
|
1357
|
-
};
|
|
1358
|
-
const clearListeningTimeout = () => {
|
|
1359
|
-
if (transcriptTimeout) {
|
|
1360
|
-
clearTimeout(transcriptTimeout);
|
|
1361
|
-
setTranscriptTimeout(null);
|
|
1362
1188
|
}
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
clearListeningTimeout();
|
|
1366
|
-
if (continuousSpeech)
|
|
1367
|
-
setListeningTimeout();
|
|
1368
|
-
};
|
|
1369
|
-
(0, react_1.useEffect)(() => {
|
|
1370
|
-
resetListeningTimeout();
|
|
1371
|
-
resetInteractionTimeout();
|
|
1372
|
-
}, [transcript]);
|
|
1373
|
-
const startListening = () => {
|
|
1374
|
-
if (!AZURE_COGNITIVE_SERVICES_TTS_KEY)
|
|
1375
|
-
return;
|
|
1376
|
-
clearListening();
|
|
1377
|
-
setTranscript('');
|
|
1378
|
-
resetTranscript();
|
|
1379
|
-
try {
|
|
1380
|
-
navigator.mediaDevices
|
|
1381
|
-
.getUserMedia({ audio: true })
|
|
1382
|
-
.then(function (_stream) {
|
|
1383
|
-
setHasUserActivatedListening(true);
|
|
1384
|
-
if (!speechConfig) {
|
|
1385
|
-
speechConfig = speechSdk.SpeechConfig.fromSubscription(AZURE_COGNITIVE_SERVICES_TTS_KEY, 'eastus');
|
|
1386
|
-
speechConfig.speechRecognitionLanguage =
|
|
1387
|
-
getCultureCodeByLanguage(userLang);
|
|
1388
|
-
speechConfig.speechSynthesisLanguage =
|
|
1389
|
-
getCultureCodeByLanguage(userLang);
|
|
1390
|
-
speechConfig.speechSynthesisVoiceName = getTTSVoice(userLang);
|
|
1391
|
-
}
|
|
1392
|
-
const audioConfig = speechSdk.AudioConfig.fromDefaultMicrophoneInput();
|
|
1393
|
-
recognizer = new speechSdk.SpeechRecognizer(speechConfig, audioConfig);
|
|
1394
|
-
setListening(true);
|
|
1395
|
-
recognizer.recognized = (_s, e) => {
|
|
1396
|
-
if (!e.result.text)
|
|
1397
|
-
return;
|
|
1398
|
-
if (e.result.reason === speechSdk.ResultReason.RecognizedSpeech) {
|
|
1399
|
-
let transcript = e.result.text;
|
|
1400
|
-
setTranscript(transcript || '');
|
|
1401
|
-
if ((transcript === null || transcript === void 0 ? void 0 : transcript.length) > 0) {
|
|
1402
|
-
const transcriptMessage = (0, utils_1.stripDuplicates)(transcript);
|
|
1403
|
-
if (transcriptMessage.length > 0)
|
|
1404
|
-
setUserMessage(msg => `${msg} ${transcriptMessage}`);
|
|
1405
|
-
}
|
|
1406
|
-
}
|
|
1407
|
-
else if (e.result.reason === speechSdk.ResultReason.NoMatch) {
|
|
1408
|
-
console.debug('NOMATCH: Speech could not be recognized.');
|
|
1409
|
-
}
|
|
1410
|
-
};
|
|
1411
|
-
recognizer.canceled = (_s, e) => {
|
|
1412
|
-
if (e.reason === speechSdk.CancellationReason.Error) {
|
|
1413
|
-
console.debug(`"CANCELED: ErrorCode=${e.errorCode}`);
|
|
1414
|
-
console.debug(`"CANCELED: ErrorDetails=${e.errorDetails}`);
|
|
1415
|
-
console.debug('CANCELED: Did you set the speech resource key and region values?');
|
|
1416
|
-
}
|
|
1417
|
-
stopListening();
|
|
1418
|
-
};
|
|
1419
|
-
recognizer.sessionStopped = (_s, _e) => {
|
|
1420
|
-
stopListening();
|
|
1421
|
-
};
|
|
1422
|
-
resetTranscript();
|
|
1423
|
-
recognizer.startContinuousRecognitionAsync();
|
|
1424
|
-
})
|
|
1425
|
-
.catch(console.error);
|
|
1426
|
-
}
|
|
1427
|
-
catch (error) {
|
|
1428
|
-
console.error(error);
|
|
1429
|
-
}
|
|
1430
|
-
};
|
|
1431
|
-
const stopListening = () => {
|
|
1432
|
-
if (recognizer) {
|
|
1433
|
-
recognizer.stopContinuousRecognitionAsync();
|
|
1434
|
-
recognizer.close();
|
|
1435
|
-
recognizer = null;
|
|
1189
|
+
else {
|
|
1190
|
+
textarea === null || textarea === void 0 ? void 0 : textarea.blur();
|
|
1436
1191
|
}
|
|
1437
|
-
setListening(false);
|
|
1438
1192
|
};
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
clearListeningTimeout();
|
|
1443
|
-
};
|
|
1444
|
-
const resetListening = () => {
|
|
1445
|
-
if (listening) {
|
|
1446
|
-
clearListening();
|
|
1447
|
-
resetTranscript();
|
|
1448
|
-
setUserMessage('');
|
|
1449
|
-
startListening();
|
|
1193
|
+
(0, react_1.useEffect)(() => {
|
|
1194
|
+
if (selectedLayout !== 'TOTEM') {
|
|
1195
|
+
focusChatInput();
|
|
1450
1196
|
}
|
|
1451
|
-
};
|
|
1197
|
+
}, [currentDialogState === null || currentDialogState === void 0 ? void 0 : currentDialogState.emission]);
|
|
1452
1198
|
const resetUIEffects = () => {
|
|
1453
1199
|
try {
|
|
1454
|
-
clearListening();
|
|
1455
1200
|
clearInteractionTimeout();
|
|
1456
1201
|
setClickedStart(false);
|
|
1457
1202
|
timeoutRef.current = undefined;
|
|
@@ -1473,45 +1218,26 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
1473
1218
|
};
|
|
1474
1219
|
}, []);
|
|
1475
1220
|
(0, react_1.useEffect)(() => {
|
|
1476
|
-
if (
|
|
1477
|
-
clearListening();
|
|
1478
|
-
}, [currentDialogState === null || currentDialogState === void 0 ? void 0 : currentDialogState.state]);
|
|
1479
|
-
const [requestedListening, setRequestedListening] = (0, react_1.useState)(false);
|
|
1480
|
-
const onEndSpeakStartListen = (0, react_1.useCallback)((_e) => {
|
|
1481
|
-
if (isPlayingAudio && speechSynthesizer) {
|
|
1482
|
-
speechSynthesizer.close();
|
|
1483
|
-
speechSynthesizer = null;
|
|
1484
|
-
}
|
|
1485
|
-
if (continuousSpeech &&
|
|
1486
|
-
(hasUserActivatedListening || !requestedListening)) {
|
|
1487
|
-
setRequestedListening(true);
|
|
1488
|
-
startListening();
|
|
1489
|
-
}
|
|
1490
|
-
}, [continuousSpeech, hasUserActivatedListening]);
|
|
1491
|
-
(0, react_1.useEffect)(() => {
|
|
1492
|
-
if (history.length > 1 &&
|
|
1493
|
-
!isPlayingAudio &&
|
|
1221
|
+
if (!isPlayingAudio &&
|
|
1494
1222
|
continuousSpeech &&
|
|
1495
|
-
(hasUserActivatedListening || !requestedListening)
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
stopListening();
|
|
1223
|
+
(hasUserActivatedListening || !requestedListening) &&
|
|
1224
|
+
sessionId) {
|
|
1225
|
+
startRecording();
|
|
1499
1226
|
}
|
|
1500
|
-
|
|
1227
|
+
else if (isPlayingAudio && isListening) {
|
|
1228
|
+
stopRecording();
|
|
1229
|
+
}
|
|
1230
|
+
}, [isPlayingAudio, hasUserActivatedListening]);
|
|
1501
1231
|
(0, react_1.useEffect)(() => {
|
|
1502
|
-
|
|
1232
|
+
stopRecording();
|
|
1503
1233
|
}, [language]);
|
|
1504
1234
|
const [sendOnEnter, setSendOnEnter] = (0, react_1.useState)('keypress');
|
|
1505
1235
|
(0, react_1.useEffect)(() => {
|
|
1506
|
-
|
|
1507
|
-
if (window.innerWidth <= 768)
|
|
1236
|
+
if (window.innerWidth <= 768 && (0, utils_1.hasTouchscreen)())
|
|
1508
1237
|
setSendOnEnter('click');
|
|
1509
1238
|
else
|
|
1510
|
-
setSendOnEnter(
|
|
1239
|
+
setSendOnEnter('keypress');
|
|
1511
1240
|
}, []);
|
|
1512
|
-
(0, react_1.useEffect)(() => {
|
|
1513
|
-
(0, configuration_1.setLocalConfig)('sendOnEnter', sendOnEnter);
|
|
1514
|
-
}, [sendOnEnter]);
|
|
1515
1241
|
const [attachmentsMenuOpen, setAttachmentsMenuOpen] = (0, react_1.useState)();
|
|
1516
1242
|
const globalBackground = integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.globalBackground;
|
|
1517
1243
|
const globalBackgroundUrl = globalBackground
|
|
@@ -1520,8 +1246,8 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
1520
1246
|
const integrationProperties = (integration
|
|
1521
1247
|
? {
|
|
1522
1248
|
'--memori-chat-bubble-bg': '#fff',
|
|
1523
|
-
...(integrationConfig && !
|
|
1524
|
-
? { '--memori-text-color': (
|
|
1249
|
+
...(integrationConfig && !instruct
|
|
1250
|
+
? { '--memori-text-color': (_q = integrationConfig.textColor) !== null && _q !== void 0 ? _q : '#000' }
|
|
1525
1251
|
: {}),
|
|
1526
1252
|
...((integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.buttonBgColor)
|
|
1527
1253
|
? {
|
|
@@ -1545,12 +1271,12 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
1545
1271
|
? {
|
|
1546
1272
|
'--memori-inner-bg': `rgba(${integrationConfig.innerBgColor === 'dark'
|
|
1547
1273
|
? '0, 0, 0'
|
|
1548
|
-
: '255, 255, 255'}, ${(
|
|
1274
|
+
: '255, 255, 255'}, ${(_r = integrationConfig.innerBgAlpha) !== null && _r !== void 0 ? _r : 0.4})`,
|
|
1549
1275
|
'--memori-inner-content-pad': '1.5rem',
|
|
1550
1276
|
'--memori-nav-bg-image': 'none',
|
|
1551
1277
|
'--memori-nav-bg': `rgba(${integrationConfig.innerBgColor === 'dark'
|
|
1552
1278
|
? '0, 0, 0'
|
|
1553
|
-
: '255, 255, 255'}, ${(
|
|
1279
|
+
: '255, 255, 255'}, ${(_s = integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.innerBgAlpha) !== null && _s !== void 0 ? _s : 0.4})`,
|
|
1554
1280
|
}
|
|
1555
1281
|
: {
|
|
1556
1282
|
'--memori-inner-content-pad': '0px',
|
|
@@ -1558,11 +1284,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
1558
1284
|
}
|
|
1559
1285
|
: {});
|
|
1560
1286
|
const integrationStylesheet = `
|
|
1561
|
-
${preview
|
|
1562
|
-
? '#preview,'
|
|
1563
|
-
: selectedLayout === 'WEBSITE_ASSISTANT'
|
|
1564
|
-
? ''
|
|
1565
|
-
: ':root,'} .memori-widget, .memori-drawer, .memori-modal {
|
|
1287
|
+
${preview ? '#preview, ' : applyVarsToRoot ? ':root, ' : ''}memori-client, .memori-widget, .memori-drawer, .memori-modal {
|
|
1566
1288
|
${Object.entries(integrationProperties)
|
|
1567
1289
|
.map(([key, value]) => `${key}: ${value};`)
|
|
1568
1290
|
.join('\n')}
|
|
@@ -1571,6 +1293,8 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
1571
1293
|
const showAIicon = (integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.showAIicon) === undefined
|
|
1572
1294
|
? true
|
|
1573
1295
|
: integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.showAIicon;
|
|
1296
|
+
const enableUpload = !!(showUpload !== null && showUpload !== void 0 ? showUpload : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.showUpload);
|
|
1297
|
+
const enableReasoning = !!(showReasoning !== null && showReasoning !== void 0 ? showReasoning : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.showReasoning);
|
|
1574
1298
|
const showWhyThisAnswer = (integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.showWhyThisAnswer) === undefined
|
|
1575
1299
|
? true
|
|
1576
1300
|
: integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.showWhyThisAnswer;
|
|
@@ -1581,35 +1305,6 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
1581
1305
|
setAvatar3dVisible(true);
|
|
1582
1306
|
}
|
|
1583
1307
|
}, []);
|
|
1584
|
-
const [gamificationLevel, setGamificationLevel] = (0, react_1.useState)();
|
|
1585
|
-
const getGamificationPoints = async (memoriID) => {
|
|
1586
|
-
let gamificationPoints;
|
|
1587
|
-
let unansQuestions;
|
|
1588
|
-
try {
|
|
1589
|
-
const { contentQualityIndex, answerQualityIndex, unansweredQuestions, ...cqResp } = await getContentQualityIndexes(memoriID);
|
|
1590
|
-
if (cqResp.resultCode === 0) {
|
|
1591
|
-
gamificationPoints = contentQualityIndex;
|
|
1592
|
-
unansQuestions = unansweredQuestions;
|
|
1593
|
-
}
|
|
1594
|
-
}
|
|
1595
|
-
catch (_e) {
|
|
1596
|
-
let err = _e;
|
|
1597
|
-
console.error('[APPCONTEXT/QUERYGAMIFICATIONPOINTS]', err);
|
|
1598
|
-
}
|
|
1599
|
-
return {
|
|
1600
|
-
points: gamificationPoints !== null && gamificationPoints !== void 0 ? gamificationPoints : 0,
|
|
1601
|
-
unansweredQuestions: unansQuestions !== null && unansQuestions !== void 0 ? unansQuestions : 0,
|
|
1602
|
-
};
|
|
1603
|
-
};
|
|
1604
|
-
(0, react_1.useEffect)(() => {
|
|
1605
|
-
if (memori.engineMemoriID) {
|
|
1606
|
-
getGamificationPoints(memori.engineMemoriID)
|
|
1607
|
-
.then(value => {
|
|
1608
|
-
setGamificationLevel((0, statistics_1.getGamificationLevel)(value.points));
|
|
1609
|
-
})
|
|
1610
|
-
.catch(console.error);
|
|
1611
|
-
}
|
|
1612
|
-
}, [memori.engineMemoriID]);
|
|
1613
1308
|
(0, react_1.useEffect)(() => {
|
|
1614
1309
|
if (integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.seoTitle) {
|
|
1615
1310
|
let meta = document.createElement('meta');
|
|
@@ -1637,80 +1332,13 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
1637
1332
|
document.head.append(meta);
|
|
1638
1333
|
}
|
|
1639
1334
|
}, [integrationConfig, memori.avatarURL, ogImage]);
|
|
1640
|
-
const selectReceiverTag = async (tag) => {
|
|
1641
|
-
var _a;
|
|
1642
|
-
if (!sessionId)
|
|
1643
|
-
return;
|
|
1644
|
-
try {
|
|
1645
|
-
const { currentState, ...resp } = await postTagChangedEvent(sessionId, tag);
|
|
1646
|
-
if (resp.resultCode === 0) {
|
|
1647
|
-
pushMessage({
|
|
1648
|
-
text: tag,
|
|
1649
|
-
fromUser: true,
|
|
1650
|
-
});
|
|
1651
|
-
if (currentState.state === 'X4' && memori.giverTag) {
|
|
1652
|
-
const { currentState, ...resp } = await client.postTagChangedEvent(sessionId, memori.giverTag);
|
|
1653
|
-
if (resp.resultCode === 0) {
|
|
1654
|
-
setCurrentDialogState(currentState);
|
|
1655
|
-
if (currentState.emission) {
|
|
1656
|
-
pushMessage({
|
|
1657
|
-
text: currentState.emission,
|
|
1658
|
-
emitter: currentState.emitter,
|
|
1659
|
-
media: currentState.media,
|
|
1660
|
-
fromUser: false,
|
|
1661
|
-
contextVars: currentState.contextVars,
|
|
1662
|
-
date: currentState.currentDate,
|
|
1663
|
-
placeName: currentState.currentPlaceName,
|
|
1664
|
-
placeLatitude: currentState.currentLatitude,
|
|
1665
|
-
placeLongitude: currentState.currentLongitude,
|
|
1666
|
-
placeUncertaintyKm: currentState.currentUncertaintyKm,
|
|
1667
|
-
tag: currentState.currentTag,
|
|
1668
|
-
memoryTags: currentState.memoryTags,
|
|
1669
|
-
});
|
|
1670
|
-
}
|
|
1671
|
-
}
|
|
1672
|
-
else {
|
|
1673
|
-
console.error(resp);
|
|
1674
|
-
react_hot_toast_1.default.error(t((0, error_1.getErrori18nKey)(resp.resultCode)));
|
|
1675
|
-
}
|
|
1676
|
-
}
|
|
1677
|
-
else {
|
|
1678
|
-
setCurrentDialogState(currentState);
|
|
1679
|
-
if (currentState.emission) {
|
|
1680
|
-
pushMessage({
|
|
1681
|
-
text: currentState.emission,
|
|
1682
|
-
emitter: currentState.emitter,
|
|
1683
|
-
media: currentState.media,
|
|
1684
|
-
fromUser: false,
|
|
1685
|
-
contextVars: currentState.contextVars,
|
|
1686
|
-
date: currentState.currentDate,
|
|
1687
|
-
placeName: currentState.currentPlaceName,
|
|
1688
|
-
placeLatitude: currentState.currentLatitude,
|
|
1689
|
-
placeLongitude: currentState.currentLongitude,
|
|
1690
|
-
placeUncertaintyKm: currentState.currentUncertaintyKm,
|
|
1691
|
-
tag: currentState.currentTag,
|
|
1692
|
-
memoryTags: currentState.memoryTags,
|
|
1693
|
-
});
|
|
1694
|
-
}
|
|
1695
|
-
}
|
|
1696
|
-
}
|
|
1697
|
-
else {
|
|
1698
|
-
console.error(resp, tag, (_a = currentDialogState === null || currentDialogState === void 0 ? void 0 : currentDialogState.knownTags) === null || _a === void 0 ? void 0 : _a[tag]);
|
|
1699
|
-
react_hot_toast_1.default.error(t((0, error_1.getErrori18nKey)(resp.resultCode)));
|
|
1700
|
-
}
|
|
1701
|
-
}
|
|
1702
|
-
catch (e) {
|
|
1703
|
-
let err = e;
|
|
1704
|
-
console.error(err);
|
|
1705
|
-
react_hot_toast_1.default.error(err.message);
|
|
1706
|
-
}
|
|
1707
|
-
};
|
|
1708
1335
|
const simulateUserPrompt = (text, translatedText) => {
|
|
1709
|
-
stopListening();
|
|
1710
1336
|
stopAudio();
|
|
1711
1337
|
sendMessage(text, undefined, undefined, false, translatedText);
|
|
1712
1338
|
};
|
|
1713
1339
|
const memoriTextEnteredHandler = (0, react_1.useCallback)((e) => {
|
|
1340
|
+
if (disableTextEnteredEvents)
|
|
1341
|
+
return;
|
|
1714
1342
|
const { text, waitForPrevious, hidden, typingText, useLoaderTextAsMsg, hasBatchQueued, } = e.detail;
|
|
1715
1343
|
if (text) {
|
|
1716
1344
|
if (waitForPrevious &&
|
|
@@ -1721,34 +1349,45 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
1721
1349
|
}, 1000);
|
|
1722
1350
|
}
|
|
1723
1351
|
else {
|
|
1724
|
-
stopListening();
|
|
1725
1352
|
stopAudio();
|
|
1726
1353
|
sendMessage(text, undefined, undefined, undefined, undefined, hidden, typingText, useLoaderTextAsMsg, hasBatchQueued);
|
|
1727
1354
|
}
|
|
1728
1355
|
}
|
|
1729
|
-
}, [
|
|
1356
|
+
}, [
|
|
1357
|
+
sessionId,
|
|
1358
|
+
isPlayingAudio,
|
|
1359
|
+
memoriTyping,
|
|
1360
|
+
userLang,
|
|
1361
|
+
disableTextEnteredEvents,
|
|
1362
|
+
]);
|
|
1730
1363
|
(0, react_1.useEffect)(() => {
|
|
1731
|
-
|
|
1364
|
+
if (!disableTextEnteredEvents) {
|
|
1365
|
+
document.addEventListener('MemoriTextEntered', memoriTextEnteredHandler);
|
|
1366
|
+
}
|
|
1367
|
+
else {
|
|
1368
|
+
document.removeEventListener('MemoriTextEntered', memoriTextEnteredHandler);
|
|
1369
|
+
}
|
|
1732
1370
|
return () => {
|
|
1733
1371
|
document.removeEventListener('MemoriTextEntered', memoriTextEnteredHandler);
|
|
1734
1372
|
};
|
|
1735
|
-
}, [sessionId, userLang]);
|
|
1736
|
-
const onClickStart = (0, react_1.useCallback)(async (session) => {
|
|
1737
|
-
var _a, _b, _c, _d, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r,
|
|
1738
|
-
const sessionID = (session === null || session === void 0 ? void 0 : session.sessionID) || sessionId;
|
|
1739
|
-
const dialogState =
|
|
1373
|
+
}, [sessionId, userLang, disableTextEnteredEvents]);
|
|
1374
|
+
const onClickStart = (0, react_1.useCallback)(async (session, initialSessionExpired = false, chatLog) => {
|
|
1375
|
+
var _a, _b, _c, _d, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
1376
|
+
const sessionID = chatLog ? undefined : (session === null || session === void 0 ? void 0 : session.sessionID) || sessionId;
|
|
1377
|
+
const dialogState = chatLog
|
|
1378
|
+
? undefined
|
|
1379
|
+
: (session === null || session === void 0 ? void 0 : session.dialogState) || currentDialogState;
|
|
1740
1380
|
setClickedStart(true);
|
|
1741
|
-
let
|
|
1742
|
-
let isSafari = window.navigator.userAgent.includes('Safari') &&
|
|
1743
|
-
!window.navigator.userAgent.includes('Chrome');
|
|
1744
|
-
if (memoriAudioElement && isSafari) {
|
|
1745
|
-
memoriAudioElement.muted = false;
|
|
1746
|
-
memoriAudioElement.play().catch((e) => {
|
|
1747
|
-
console.error('error playing intro audio', e);
|
|
1748
|
-
});
|
|
1749
|
-
}
|
|
1381
|
+
let translatedMessages = [];
|
|
1750
1382
|
let storageBirthDate = (0, configuration_1.getLocalConfig)('birthDate', undefined);
|
|
1751
|
-
let birth = birthDate || storageBirthDate ||
|
|
1383
|
+
let birth = birthDate || storageBirthDate || (user === null || user === void 0 ? void 0 : user.birthDate);
|
|
1384
|
+
if (!birth && autoStart && initialSessionID)
|
|
1385
|
+
birth = '1970-01-01T10:24:03.845Z';
|
|
1386
|
+
const localPosition = (0, configuration_1.getLocalConfig)('position', undefined);
|
|
1387
|
+
if (autoStart && !localPosition && memori.needsPosition) {
|
|
1388
|
+
setShowPositionDrawer(true);
|
|
1389
|
+
return;
|
|
1390
|
+
}
|
|
1752
1391
|
if (!sessionID && !!minAge && !birth) {
|
|
1753
1392
|
setShowAgeVerification(true);
|
|
1754
1393
|
setClickedStart(false);
|
|
@@ -1763,7 +1402,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
1763
1402
|
setClickedStart(false);
|
|
1764
1403
|
return;
|
|
1765
1404
|
}
|
|
1766
|
-
else if (!sessionID) {
|
|
1405
|
+
else if (!sessionID || initialSessionExpired) {
|
|
1767
1406
|
setClickedStart(false);
|
|
1768
1407
|
setGotErrorInOpening(false);
|
|
1769
1408
|
const session = await fetchSession({
|
|
@@ -1771,77 +1410,107 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
1771
1410
|
password: secret || memoriPwd || memori.secretToken,
|
|
1772
1411
|
tag: personification === null || personification === void 0 ? void 0 : personification.tag,
|
|
1773
1412
|
pin: personification === null || personification === void 0 ? void 0 : personification.pin,
|
|
1413
|
+
continueFromChatLogID: chatLog === null || chatLog === void 0 ? void 0 : chatLog.chatLogID,
|
|
1774
1414
|
initialContextVars: {
|
|
1775
1415
|
PATHNAME: (_a = window.location.pathname) === null || _a === void 0 ? void 0 : _a.toUpperCase(),
|
|
1776
1416
|
ROUTE: ((_d = (_c = (_b = window.location.pathname) === null || _b === void 0 ? void 0 : _b.split('/')) === null || _c === void 0 ? void 0 : _c.pop()) === null || _d === void 0 ? void 0 : _d.toUpperCase()) || '',
|
|
1777
|
-
...(
|
|
1417
|
+
...((!chatLog
|
|
1418
|
+
? initialContextVars
|
|
1419
|
+
: chatLog.lines[chatLog.lines.length - 1].contextVars) || {}),
|
|
1778
1420
|
},
|
|
1779
|
-
initialQuestion,
|
|
1421
|
+
initialQuestion: chatLog ? undefined : initialQuestion,
|
|
1780
1422
|
birthDate: birth,
|
|
1781
1423
|
additionalInfo: {
|
|
1782
1424
|
...(additionalInfo || {}),
|
|
1783
1425
|
loginToken: (_g = (_f = userToken !== null && userToken !== void 0 ? userToken : loginToken) !== null && _f !== void 0 ? _f : additionalInfo === null || additionalInfo === void 0 ? void 0 : additionalInfo.loginToken) !== null && _g !== void 0 ? _g : authToken,
|
|
1784
1426
|
language: getCultureCodeByLanguage(userLang),
|
|
1427
|
+
timeZoneOffset: new Date().getTimezoneOffset().toString(),
|
|
1785
1428
|
},
|
|
1786
1429
|
});
|
|
1787
1430
|
if (session === null || session === void 0 ? void 0 : session.dialogState) {
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
.
|
|
1791
|
-
if (ts.emission) {
|
|
1792
|
-
speak(ts.emission);
|
|
1793
|
-
}
|
|
1794
|
-
})
|
|
1795
|
-
.finally(() => {
|
|
1431
|
+
if (!chatLog) {
|
|
1432
|
+
setHistory([]);
|
|
1433
|
+
await translateAndSpeak(session.dialogState, userLang);
|
|
1796
1434
|
setHasUserActivatedSpeak(true);
|
|
1797
|
-
}
|
|
1435
|
+
}
|
|
1436
|
+
else {
|
|
1437
|
+
const messages = chatLog.lines.map((l, i) => {
|
|
1438
|
+
var _a, _b;
|
|
1439
|
+
return ({
|
|
1440
|
+
text: l.text,
|
|
1441
|
+
media: (_b = (_a = l.media) === null || _a === void 0 ? void 0 : _a.filter(m => constants_1.allowedMediaTypes.includes(m.mimeType))) === null || _b === void 0 ? void 0 : _b.map(m => ({
|
|
1442
|
+
mediumID: `${i}-${m.mimeType}`,
|
|
1443
|
+
...m,
|
|
1444
|
+
})),
|
|
1445
|
+
fromUser: l.inbound,
|
|
1446
|
+
timestamp: l.timestamp,
|
|
1447
|
+
emitter: l.emitter,
|
|
1448
|
+
initial: i === 0,
|
|
1449
|
+
});
|
|
1450
|
+
});
|
|
1451
|
+
translatedMessages = messages !== null && messages !== void 0 ? messages : [];
|
|
1452
|
+
if (language.toUpperCase() !== userLang.toUpperCase() &&
|
|
1453
|
+
isMultilanguageEnabled) {
|
|
1454
|
+
try {
|
|
1455
|
+
translatedMessages = await Promise.all(messages.map(async (m) => {
|
|
1456
|
+
if ('originalText' in m && m.originalText) {
|
|
1457
|
+
return m;
|
|
1458
|
+
}
|
|
1459
|
+
return {
|
|
1460
|
+
...m,
|
|
1461
|
+
originalText: m.text,
|
|
1462
|
+
text: (await (0, translations_1.getTranslation)(m.text, userLang, language, baseUrl)).text,
|
|
1463
|
+
};
|
|
1464
|
+
}));
|
|
1465
|
+
}
|
|
1466
|
+
catch (e) {
|
|
1467
|
+
console.error('[CLICK_START] Error translating messages:', e);
|
|
1468
|
+
}
|
|
1469
|
+
}
|
|
1470
|
+
setHistory(translatedMessages);
|
|
1471
|
+
translateDialogState(session.dialogState, userLang, undefined, true).finally(() => {
|
|
1472
|
+
setHasUserActivatedSpeak(true);
|
|
1473
|
+
});
|
|
1474
|
+
}
|
|
1798
1475
|
}
|
|
1799
|
-
else {
|
|
1476
|
+
else if ((session === null || session === void 0 ? void 0 : session.resultCode) === 0) {
|
|
1800
1477
|
await onClickStart(session || undefined);
|
|
1801
1478
|
}
|
|
1479
|
+
else {
|
|
1480
|
+
setLoading(false);
|
|
1481
|
+
}
|
|
1802
1482
|
return;
|
|
1803
1483
|
}
|
|
1804
1484
|
else if (initialSessionID) {
|
|
1805
1485
|
const { currentState, ...response } = await getSession(sessionID);
|
|
1806
1486
|
if (response.resultCode !== 0 || !currentState) {
|
|
1807
|
-
console.debug('session expired, opening new session');
|
|
1808
1487
|
setGotErrorInOpening(true);
|
|
1809
1488
|
setSessionId(undefined);
|
|
1810
1489
|
setClickedStart(false);
|
|
1811
|
-
await onClickStart();
|
|
1490
|
+
await onClickStart(undefined, true);
|
|
1812
1491
|
return;
|
|
1813
1492
|
}
|
|
1814
1493
|
setHistory([]);
|
|
1815
|
-
if (position)
|
|
1494
|
+
if (position && memori.needsPosition) {
|
|
1816
1495
|
applyPosition(position, sessionID);
|
|
1817
|
-
|
|
1496
|
+
}
|
|
1497
|
+
if (memori.needsDateTime) {
|
|
1818
1498
|
sendDateChangedEvent({ sessionID: sessionID, state: currentState });
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1499
|
+
}
|
|
1500
|
+
if (personification &&
|
|
1501
|
+
currentState.currentTag !== personification.tag) {
|
|
1822
1502
|
try {
|
|
1823
|
-
console.debug('change tag #0');
|
|
1824
1503
|
await changeTag(memori.engineMemoriID, sessionID, '-');
|
|
1825
|
-
const session = await changeTag(memori.engineMemoriID, sessionID,
|
|
1504
|
+
const session = await changeTag(memori.engineMemoriID, sessionID, personification.tag, personification.pin);
|
|
1826
1505
|
if (session && session.resultCode === 0) {
|
|
1827
|
-
|
|
1828
|
-
.then(ts => {
|
|
1829
|
-
if (ts.emission) {
|
|
1830
|
-
speak(ts.emission);
|
|
1831
|
-
}
|
|
1832
|
-
})
|
|
1833
|
-
.finally(() => {
|
|
1834
|
-
setHasUserActivatedSpeak(true);
|
|
1835
|
-
});
|
|
1506
|
+
await translateAndSpeak(session.currentState, userLang);
|
|
1836
1507
|
}
|
|
1837
1508
|
else {
|
|
1838
|
-
console.error('session #1', session);
|
|
1839
1509
|
throw new Error('No session');
|
|
1840
1510
|
}
|
|
1841
1511
|
}
|
|
1842
1512
|
catch (e) {
|
|
1843
|
-
|
|
1844
|
-
reopenSession(true, memori === null || memori === void 0 ? void 0 : memori.secretToken, undefined, memori === null || memori === void 0 ? void 0 : memori.giverTag, memori === null || memori === void 0 ? void 0 : memori.giverPIN, {
|
|
1513
|
+
reopenSession(true, memori === null || memori === void 0 ? void 0 : memori.secretToken, undefined, personification.tag, personification.pin, {
|
|
1845
1514
|
PATHNAME: (_h = window.location.pathname) === null || _h === void 0 ? void 0 : _h.toUpperCase(),
|
|
1846
1515
|
ROUTE: ((_l = (_k = (_j = window.location.pathname) === null || _j === void 0 ? void 0 : _j.split('/')) === null || _k === void 0 ? void 0 : _k.pop()) === null || _l === void 0 ? void 0 : _l.toUpperCase()) ||
|
|
1847
1516
|
'',
|
|
@@ -1851,32 +1520,22 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
1851
1520
|
});
|
|
1852
1521
|
}
|
|
1853
1522
|
}
|
|
1854
|
-
else if (!
|
|
1855
|
-
|
|
1856
|
-
(
|
|
1523
|
+
else if (!personification &&
|
|
1524
|
+
(currentState === null || currentState === void 0 ? void 0 : currentState.currentTag) &&
|
|
1525
|
+
(currentState === null || currentState === void 0 ? void 0 : currentState.currentTag) !== constants_1.anonTag &&
|
|
1526
|
+
(currentState === null || currentState === void 0 ? void 0 : currentState.currentTag) !== '-') {
|
|
1857
1527
|
try {
|
|
1858
|
-
console.debug('change tag #3');
|
|
1859
1528
|
await changeTag(memori.engineMemoriID, sessionID, '-');
|
|
1860
|
-
const session = await changeTag(memori.engineMemoriID, sessionID,
|
|
1529
|
+
const session = await changeTag(memori.engineMemoriID, sessionID, constants_1.anonTag);
|
|
1861
1530
|
if (session && session.resultCode === 0) {
|
|
1862
|
-
|
|
1863
|
-
.then(ts => {
|
|
1864
|
-
if (ts.emission) {
|
|
1865
|
-
speak(ts.emission);
|
|
1866
|
-
}
|
|
1867
|
-
})
|
|
1868
|
-
.finally(() => {
|
|
1869
|
-
setHasUserActivatedSpeak(true);
|
|
1870
|
-
});
|
|
1531
|
+
await translateAndSpeak(session.currentState, userLang);
|
|
1871
1532
|
}
|
|
1872
1533
|
else {
|
|
1873
|
-
console.error('session #4', session);
|
|
1874
1534
|
throw new Error('No session');
|
|
1875
1535
|
}
|
|
1876
1536
|
}
|
|
1877
1537
|
catch (e) {
|
|
1878
|
-
|
|
1879
|
-
reopenSession(true, memori === null || memori === void 0 ? void 0 : memori.secretToken, undefined, personification.tag, personification.pin, {
|
|
1538
|
+
reopenSession(true, memori === null || memori === void 0 ? void 0 : memori.secretToken, undefined, undefined, undefined, {
|
|
1880
1539
|
PATHNAME: (_m = window.location.pathname) === null || _m === void 0 ? void 0 : _m.toUpperCase(),
|
|
1881
1540
|
ROUTE: ((_q = (_p = (_o = window.location.pathname) === null || _o === void 0 ? void 0 : _o.split('/')) === null || _p === void 0 ? void 0 : _p.pop()) === null || _q === void 0 ? void 0 : _q.toUpperCase()) ||
|
|
1882
1541
|
'',
|
|
@@ -1886,70 +1545,77 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
1886
1545
|
});
|
|
1887
1546
|
}
|
|
1888
1547
|
}
|
|
1889
|
-
else
|
|
1890
|
-
!personification &&
|
|
1891
|
-
(currentDialogState === null || currentDialogState === void 0 ? void 0 : currentDialogState.currentTag) !== constants_1.anonTag) {
|
|
1548
|
+
else {
|
|
1892
1549
|
try {
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
.
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
}
|
|
1902
|
-
|
|
1903
|
-
.
|
|
1904
|
-
|
|
1550
|
+
const { chatLogs } = await getSessionChatLogs(sessionID, sessionID);
|
|
1551
|
+
const messages = (_r = chatLogs === null || chatLogs === void 0 ? void 0 : chatLogs[0]) === null || _r === void 0 ? void 0 : _r.lines.map((l, i) => {
|
|
1552
|
+
var _a, _b;
|
|
1553
|
+
return ({
|
|
1554
|
+
text: l.text,
|
|
1555
|
+
media: (_b = (_a = l.media) === null || _a === void 0 ? void 0 : _a.filter(m => constants_1.allowedMediaTypes.includes(m.mimeType))) === null || _b === void 0 ? void 0 : _b.map(m => ({
|
|
1556
|
+
mediumID: `${i}-${m.mimeType}`,
|
|
1557
|
+
...m,
|
|
1558
|
+
})),
|
|
1559
|
+
fromUser: l.inbound,
|
|
1560
|
+
timestamp: l.timestamp,
|
|
1561
|
+
emitter: l.emitter,
|
|
1562
|
+
initial: i === 0,
|
|
1905
1563
|
});
|
|
1564
|
+
});
|
|
1565
|
+
translatedMessages = messages !== null && messages !== void 0 ? messages : [];
|
|
1566
|
+
if (language.toUpperCase() !== userLang.toUpperCase() &&
|
|
1567
|
+
isMultilanguageEnabled) {
|
|
1568
|
+
try {
|
|
1569
|
+
translatedMessages = await Promise.all(messages.map(async (m) => ({
|
|
1570
|
+
...m,
|
|
1571
|
+
originalText: m.text,
|
|
1572
|
+
text: (await (0, translations_1.getTranslation)(m.text, userLang, language, baseUrl)).text,
|
|
1573
|
+
})));
|
|
1574
|
+
}
|
|
1575
|
+
catch (e) {
|
|
1576
|
+
console.error('[CLICK_START] Error translating messages:', e);
|
|
1577
|
+
}
|
|
1906
1578
|
}
|
|
1907
|
-
|
|
1908
|
-
console.error('session #7', session);
|
|
1909
|
-
throw new Error('No session');
|
|
1910
|
-
}
|
|
1579
|
+
setHistory(translatedMessages);
|
|
1911
1580
|
}
|
|
1912
1581
|
catch (e) {
|
|
1913
|
-
console.error('
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1582
|
+
console.error('[CLICK_START] Error retrieving chat logs:', e);
|
|
1583
|
+
}
|
|
1584
|
+
if ((!!(translatedMessages === null || translatedMessages === void 0 ? void 0 : translatedMessages.length) && translatedMessages.length > 1) ||
|
|
1585
|
+
!initialQuestion) {
|
|
1586
|
+
await translateAndSpeak(currentState, userLang, undefined, !!(translatedMessages === null || translatedMessages === void 0 ? void 0 : translatedMessages.length));
|
|
1587
|
+
}
|
|
1588
|
+
else {
|
|
1589
|
+
translatedMessages = [];
|
|
1590
|
+
setHistory([]);
|
|
1591
|
+
setMemoriTyping(true);
|
|
1592
|
+
const response = await postTextEnteredEvent({
|
|
1593
|
+
sessionId: sessionID,
|
|
1594
|
+
text: initialQuestion,
|
|
1921
1595
|
});
|
|
1596
|
+
await translateAndSpeak((_s = response.currentState) !== null && _s !== void 0 ? _s : currentState, userLang, undefined, false);
|
|
1922
1597
|
}
|
|
1923
1598
|
}
|
|
1924
|
-
|
|
1925
|
-
translateDialogState(currentState, userLang)
|
|
1926
|
-
.then(ts => {
|
|
1927
|
-
if (ts.emission) {
|
|
1928
|
-
speak(ts.emission);
|
|
1929
|
-
}
|
|
1930
|
-
})
|
|
1931
|
-
.finally(() => {
|
|
1932
|
-
setHasUserActivatedSpeak(true);
|
|
1933
|
-
});
|
|
1934
|
-
}
|
|
1935
|
-
if (position)
|
|
1599
|
+
if (position && memori.needsPosition) {
|
|
1936
1600
|
applyPosition(position, sessionID);
|
|
1937
|
-
|
|
1601
|
+
}
|
|
1602
|
+
if (memori.needsDateTime) {
|
|
1938
1603
|
sendDateChangedEvent({ sessionID: sessionID, state: currentState });
|
|
1604
|
+
}
|
|
1939
1605
|
}
|
|
1940
1606
|
else {
|
|
1941
1607
|
setHistory([]);
|
|
1942
|
-
|
|
1943
|
-
.then(ts => {
|
|
1944
|
-
if (ts.emission) {
|
|
1945
|
-
speak(ts.emission);
|
|
1946
|
-
}
|
|
1947
|
-
})
|
|
1948
|
-
.finally(() => {
|
|
1949
|
-
setHasUserActivatedSpeak(true);
|
|
1950
|
-
});
|
|
1608
|
+
await translateAndSpeak(dialogState, userLang);
|
|
1951
1609
|
}
|
|
1952
1610
|
}, [memoriPwd, memori, memoriTokens, birthDate, sessionId, userLang, position]);
|
|
1611
|
+
(0, react_1.useEffect)(() => {
|
|
1612
|
+
console.log('clickedStart', clickedStart);
|
|
1613
|
+
console.log('autoStart', autoStart);
|
|
1614
|
+
console.log('selectedLayout', selectedLayout);
|
|
1615
|
+
if (!clickedStart && autoStart && selectedLayout !== 'HIDDEN_CHAT') {
|
|
1616
|
+
onClickStart();
|
|
1617
|
+
}
|
|
1618
|
+
}, [clickedStart, autoStart, selectedLayout]);
|
|
1953
1619
|
(0, react_1.useEffect)(() => {
|
|
1954
1620
|
const targetNode = document.querySelector(`memori-client[memoriname="${memori.name}"]`) ||
|
|
1955
1621
|
document.querySelector(`memori-client[memoriid="${memori.memoriID}"]`) ||
|
|
@@ -2030,7 +1696,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
2030
1696
|
}
|
|
2031
1697
|
catch (e) {
|
|
2032
1698
|
let err = e;
|
|
2033
|
-
console.
|
|
1699
|
+
console.debug(err);
|
|
2034
1700
|
}
|
|
2035
1701
|
}, [tenant === null || tenant === void 0 ? void 0 : tenant.billingDelegation, deepThoughtEnabled]);
|
|
2036
1702
|
(0, react_1.useEffect)(() => {
|
|
@@ -2038,24 +1704,49 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
2038
1704
|
checkCredits();
|
|
2039
1705
|
}
|
|
2040
1706
|
}, [tenant === null || tenant === void 0 ? void 0 : tenant.billingDelegation, deepThoughtEnabled]);
|
|
1707
|
+
(0, react_1.useEffect)(() => {
|
|
1708
|
+
const closeSession = () => {
|
|
1709
|
+
if (sessionId) {
|
|
1710
|
+
deleteSession(sessionId);
|
|
1711
|
+
}
|
|
1712
|
+
};
|
|
1713
|
+
window.addEventListener('beforeunload', closeSession);
|
|
1714
|
+
return () => {
|
|
1715
|
+
window.removeEventListener('beforeunload', closeSession);
|
|
1716
|
+
closeSession();
|
|
1717
|
+
};
|
|
1718
|
+
}, [sessionId]);
|
|
2041
1719
|
const showFullHistory = showOnlyLastMessages === undefined
|
|
2042
|
-
?
|
|
1720
|
+
? selectedLayout !== 'TOTEM' &&
|
|
1721
|
+
selectedLayout !== 'WEBSITE_ASSISTANT' &&
|
|
1722
|
+
selectedLayout !== 'HIDDEN_CHAT'
|
|
2043
1723
|
: !showOnlyLastMessages;
|
|
2044
1724
|
const headerProps = {
|
|
2045
|
-
memori
|
|
1725
|
+
memori: {
|
|
1726
|
+
...memori,
|
|
1727
|
+
ownerUserID: (_u = (_t = memori.ownerUserID) !== null && _t !== void 0 ? _t : ownerUserID) !== null && _u !== void 0 ? _u : undefined,
|
|
1728
|
+
},
|
|
2046
1729
|
tenant,
|
|
2047
1730
|
history,
|
|
2048
|
-
showShare: (
|
|
1731
|
+
showShare: (_v = showShare !== null && showShare !== void 0 ? showShare : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.showShare) !== null && _v !== void 0 ? _v : true,
|
|
2049
1732
|
position,
|
|
2050
1733
|
setShowPositionDrawer,
|
|
2051
1734
|
setShowSettingsDrawer,
|
|
2052
1735
|
setShowKnownFactsDrawer,
|
|
2053
1736
|
setShowExpertsDrawer,
|
|
2054
|
-
|
|
2055
|
-
speakerMuted:
|
|
1737
|
+
enableAudio: defaultEnableAudio,
|
|
1738
|
+
speakerMuted: speakerMuted !== null && speakerMuted !== void 0 ? speakerMuted : false,
|
|
2056
1739
|
setSpeakerMuted: mute => {
|
|
2057
|
-
|
|
2058
|
-
|
|
1740
|
+
var _a;
|
|
1741
|
+
if (!((_a = enableAudio !== null && enableAudio !== void 0 ? enableAudio : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.enableAudio) !== null && _a !== void 0 ? _a : true)) {
|
|
1742
|
+
mute = true;
|
|
1743
|
+
}
|
|
1744
|
+
toggleMute(mute);
|
|
1745
|
+
let microphoneMode = (0, configuration_1.getLocalConfig)('microphoneMode', 'HOLD_TO_TALK');
|
|
1746
|
+
if (microphoneMode === 'CONTINUOUS' && mute) {
|
|
1747
|
+
setContinuousSpeech(false);
|
|
1748
|
+
(0, configuration_1.setLocalConfig)('microphoneMode', 'HOLD_TO_TALK');
|
|
1749
|
+
}
|
|
2059
1750
|
(0, configuration_1.setLocalConfig)('muteSpeaker', !!mute);
|
|
2060
1751
|
if (mute) {
|
|
2061
1752
|
stopAudio();
|
|
@@ -2068,16 +1759,19 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
2068
1759
|
source.connect(audioContext.destination);
|
|
2069
1760
|
}
|
|
2070
1761
|
},
|
|
2071
|
-
|
|
1762
|
+
setShowChatHistoryDrawer,
|
|
1763
|
+
showSettings: (_w = showSettings !== null && showSettings !== void 0 ? showSettings : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.showSettings) !== null && _w !== void 0 ? _w : true,
|
|
1764
|
+
showChatHistory: (_x = showChatHistory !== null && showChatHistory !== void 0 ? showChatHistory : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.showChatHistory) !== null && _x !== void 0 ? _x : true,
|
|
2072
1765
|
hasUserActivatedSpeak,
|
|
2073
1766
|
showReload: selectedLayout === 'TOTEM',
|
|
2074
1767
|
showClear,
|
|
2075
1768
|
clearHistory: () => setHistory(h => h.slice(-1)),
|
|
2076
|
-
showLogin,
|
|
1769
|
+
showLogin: showLogin !== null && showLogin !== void 0 ? showLogin : memori.requireLoginToken,
|
|
2077
1770
|
setShowLoginDrawer,
|
|
2078
1771
|
loginToken,
|
|
2079
1772
|
user,
|
|
2080
1773
|
sessionID: sessionId,
|
|
1774
|
+
baseUrl,
|
|
2081
1775
|
};
|
|
2082
1776
|
const avatarProps = {
|
|
2083
1777
|
memori,
|
|
@@ -2088,31 +1782,36 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
2088
1782
|
avatar3dVisible,
|
|
2089
1783
|
setAvatar3dVisible,
|
|
2090
1784
|
hasUserActivatedSpeak,
|
|
2091
|
-
isPlayingAudio: isPlayingAudio &&
|
|
1785
|
+
isPlayingAudio: isPlayingAudio &&
|
|
1786
|
+
!speakerMuted &&
|
|
1787
|
+
((_y = enableAudio !== null && enableAudio !== void 0 ? enableAudio : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.enableAudio) !== null && _y !== void 0 ? _y : true),
|
|
2092
1788
|
loading: !!memoriTyping,
|
|
2093
1789
|
baseUrl,
|
|
2094
|
-
apiUrl,
|
|
1790
|
+
apiUrl: client.constants.BACKEND_URL,
|
|
1791
|
+
enablePositionControls,
|
|
1792
|
+
setEnablePositionControls,
|
|
1793
|
+
avatarType,
|
|
2095
1794
|
};
|
|
2096
1795
|
const startPanelProps = {
|
|
2097
1796
|
memori,
|
|
2098
1797
|
tenant: tenant,
|
|
2099
|
-
gamificationLevel: gamificationLevel,
|
|
2100
1798
|
language: language,
|
|
2101
1799
|
userLang: userLang,
|
|
2102
1800
|
setUserLang: setUserLang,
|
|
2103
1801
|
baseUrl: baseUrl,
|
|
2104
|
-
apiUrl:
|
|
1802
|
+
apiUrl: client.constants.BACKEND_URL,
|
|
2105
1803
|
position: position,
|
|
2106
1804
|
openPositionDrawer: () => setShowPositionDrawer(true),
|
|
2107
1805
|
integrationConfig: integrationConfig,
|
|
2108
1806
|
instruct: instruct,
|
|
2109
1807
|
sessionId: sessionId,
|
|
2110
1808
|
clickedStart: clickedStart,
|
|
1809
|
+
isMultilanguageEnabled: isMultilanguageEnabled,
|
|
2111
1810
|
onClickStart: onClickStart,
|
|
2112
|
-
initializeTTS: initializeTTS,
|
|
2113
1811
|
isUserLoggedIn: !!loginToken && !!(user === null || user === void 0 ? void 0 : user.userID),
|
|
1812
|
+
hasInitialSession: !!initialSessionID,
|
|
2114
1813
|
notEnoughCredits: needsCredits && !hasEnoughCredits,
|
|
2115
|
-
showLogin,
|
|
1814
|
+
showLogin: showLogin !== null && showLogin !== void 0 ? showLogin : memori.requireLoginToken,
|
|
2116
1815
|
setShowLoginDrawer,
|
|
2117
1816
|
user,
|
|
2118
1817
|
};
|
|
@@ -2122,68 +1821,61 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
2122
1821
|
tenant,
|
|
2123
1822
|
translateTo: isMultilanguageEnabled &&
|
|
2124
1823
|
userLang.toUpperCase() !==
|
|
2125
|
-
((
|
|
1824
|
+
((_3 = ((_2 = (_1 = (_0 = (_z = memori.culture) === null || _z === void 0 ? void 0 : _z.split('-')) === null || _0 === void 0 ? void 0 : _0[0]) !== null && _1 !== void 0 ? _1 : i18n.language) !== null && _2 !== void 0 ? _2 : 'IT')) === null || _3 === void 0 ? void 0 : _3.toUpperCase())
|
|
2126
1825
|
? userLang
|
|
2127
1826
|
: undefined,
|
|
2128
1827
|
baseUrl,
|
|
2129
|
-
apiUrl,
|
|
1828
|
+
apiUrl: client.constants.BACKEND_URL,
|
|
2130
1829
|
layout,
|
|
2131
1830
|
memoriTyping,
|
|
2132
1831
|
typingText,
|
|
2133
1832
|
showTypingText,
|
|
2134
1833
|
history: showFullHistory ? history : history.slice(-2),
|
|
2135
|
-
authToken: (
|
|
1834
|
+
authToken: (_5 = (_4 = loginToken !== null && loginToken !== void 0 ? loginToken : userToken) !== null && _4 !== void 0 ? _4 : additionalInfo === null || additionalInfo === void 0 ? void 0 : additionalInfo.loginToken) !== null && _5 !== void 0 ? _5 : authToken,
|
|
2136
1835
|
dialogState: currentDialogState,
|
|
2137
|
-
setDialogState: setCurrentDialogState,
|
|
2138
1836
|
pushMessage,
|
|
2139
1837
|
simulateUserPrompt,
|
|
2140
1838
|
showDates,
|
|
2141
1839
|
showContextPerLine,
|
|
2142
1840
|
showAIicon,
|
|
1841
|
+
showUpload: enableUpload,
|
|
1842
|
+
showReasoning: enableReasoning,
|
|
2143
1843
|
showWhyThisAnswer,
|
|
1844
|
+
showCopyButton,
|
|
1845
|
+
showTranslationOriginal,
|
|
2144
1846
|
client,
|
|
2145
|
-
|
|
1847
|
+
instruct,
|
|
2146
1848
|
preview,
|
|
2147
1849
|
sendOnEnter,
|
|
2148
1850
|
setSendOnEnter,
|
|
2149
1851
|
microphoneMode: continuousSpeech ? 'CONTINUOUS' : 'HOLD_TO_TALK',
|
|
2150
1852
|
attachmentsMenuOpen,
|
|
2151
1853
|
setAttachmentsMenuOpen,
|
|
2152
|
-
instruct,
|
|
2153
1854
|
showInputs,
|
|
2154
|
-
showMicrophone: !!
|
|
1855
|
+
showMicrophone: !!ttsProvider && ((_6 = enableAudio !== null && enableAudio !== void 0 ? enableAudio : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.enableAudio) !== null && _6 !== void 0 ? _6 : true),
|
|
1856
|
+
showFunctionCache,
|
|
2155
1857
|
userMessage,
|
|
2156
1858
|
onChangeUserMessage,
|
|
2157
|
-
sendMessage: (msg) => {
|
|
1859
|
+
sendMessage: (msg, media) => {
|
|
2158
1860
|
stopAudio();
|
|
2159
|
-
|
|
2160
|
-
sendMessage(msg);
|
|
1861
|
+
stopRecording();
|
|
1862
|
+
sendMessage(msg, media);
|
|
2161
1863
|
setUserMessage('');
|
|
2162
|
-
resetTranscript();
|
|
2163
1864
|
},
|
|
2164
|
-
stopListening:
|
|
2165
|
-
startListening,
|
|
1865
|
+
stopListening: stopRecording,
|
|
1866
|
+
startListening: startRecording,
|
|
2166
1867
|
stopAudio,
|
|
2167
|
-
|
|
2168
|
-
|
|
1868
|
+
listening: isListening,
|
|
1869
|
+
setEnableFocusChatInput,
|
|
2169
1870
|
isPlayingAudio,
|
|
2170
1871
|
customMediaRenderer,
|
|
2171
1872
|
user,
|
|
2172
1873
|
userAvatar,
|
|
2173
1874
|
experts,
|
|
1875
|
+
useMathFormatting: applyMathFormatting,
|
|
2174
1876
|
};
|
|
2175
1877
|
const integrationBackground = integration && globalBackgroundUrl ? ((0, jsx_runtime_1.jsx)("div", { className: "memori--global-background", children: (0, jsx_runtime_1.jsx)("div", { className: "memori--global-background-image", style: { backgroundImage: globalBackgroundUrl } }) })) : ((0, jsx_runtime_1.jsx)("div", { className: "memori--global-background no-background-image" }));
|
|
2176
1878
|
const integrationStyle = integration ? ((0, jsx_runtime_1.jsx)("style", { dangerouslySetInnerHTML: { __html: integrationStylesheet } })) : null;
|
|
2177
|
-
const onChangeMode = (mode) => {
|
|
2178
|
-
setInstruct(mode === 'instruct');
|
|
2179
|
-
setHasUserActivatedSpeak(false);
|
|
2180
|
-
setClickedStart(false);
|
|
2181
|
-
};
|
|
2182
|
-
const changeModeProps = {
|
|
2183
|
-
canInstruct: !!memori.giverTag,
|
|
2184
|
-
instruct: !!instruct,
|
|
2185
|
-
onChangeMode,
|
|
2186
|
-
};
|
|
2187
1879
|
const poweredBy = ((0, jsx_runtime_1.jsx)(PoweredBy_1.default, { tenant: tenant, userLang: userLang, integrationID: integration === null || integration === void 0 ? void 0 : integration.integrationID, memoriHash: `${memori.ownerTenantName}-${memori.ownerUserName}-${memori.name}` }));
|
|
2188
1880
|
const Layout = customLayout
|
|
2189
1881
|
? customLayout
|
|
@@ -2195,19 +1887,24 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
2195
1887
|
? FullPage_1.default
|
|
2196
1888
|
: selectedLayout === 'WEBSITE_ASSISTANT'
|
|
2197
1889
|
? WebsiteAssistant_1.default
|
|
2198
|
-
:
|
|
2199
|
-
|
|
1890
|
+
: selectedLayout === 'HIDDEN_CHAT'
|
|
1891
|
+
? HiddenChat_1.default
|
|
1892
|
+
: selectedLayout === 'ZOOMED_FULL_BODY'
|
|
1893
|
+
? ZoomedFullBody_1.default
|
|
1894
|
+
: FullPage_1.default;
|
|
1895
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)('memori', 'memori-widget', `memori-layout-${selectedLayout.toLowerCase()}`, `memori-controls-${controlsPosition.toLowerCase()}`, `memori--avatar-${(integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.avatar) || 'default'}`, {
|
|
1896
|
+
'memori--auto-start': autoStart,
|
|
2200
1897
|
'memori--preview': preview,
|
|
2201
1898
|
'memori--embed': embed,
|
|
2202
1899
|
'memori--with-integration': integration,
|
|
2203
|
-
'memori--with-speechkey': !!
|
|
1900
|
+
'memori--with-speechkey': !!ttsProvider,
|
|
2204
1901
|
'memori--active': hasUserActivatedSpeak,
|
|
2205
1902
|
'memori--hide-emissions': hideEmissions,
|
|
2206
1903
|
'memori--has-active-session': !!sessionId,
|
|
2207
1904
|
}), "data-memori-name": memori === null || memori === void 0 ? void 0 : memori.name, "data-memori-id": memori === null || memori === void 0 ? void 0 : memori.engineMemoriID, "data-memori-secondary-id": memori === null || memori === void 0 ? void 0 : memori.memoriID, "data-memori-session-id": sessionId, "data-memori-integration": integration === null || integration === void 0 ? void 0 : integration.integrationID, "data-memori-engine-state": JSON.stringify({
|
|
2208
1905
|
...currentDialogState,
|
|
2209
1906
|
sessionID: sessionId,
|
|
2210
|
-
}), style: { height }, children: [(0, jsx_runtime_1.jsx)(Layout, { Header: Header_1.default, headerProps: headerProps, Avatar: Avatar_1.default, avatarProps: avatarProps, Chat: Chat_1.default, chatProps: chatProps, StartPanel: StartPanel_1.default, startPanelProps: startPanelProps, integrationStyle: integrationStyle, integrationBackground: integrationBackground,
|
|
1907
|
+
}), style: { height }, children: [(0, jsx_runtime_1.jsx)(Layout, { Header: Header_1.default, headerProps: headerProps, Avatar: Avatar_1.default, avatarProps: avatarProps, Chat: Chat_1.default, chatProps: chatProps, StartPanel: StartPanel_1.default, startPanelProps: startPanelProps, integrationStyle: integrationStyle, integrationBackground: integrationBackground, poweredBy: poweredBy, autoStart: autoStart, sessionId: sessionId, hasUserActivatedSpeak: hasUserActivatedSpeak, loading: loading }), (0, jsx_runtime_1.jsx)("audio", { id: "memori-audio", style: { display: 'none' }, src: "https://aisuru.com/intro.mp3" }), isClient && ((0, jsx_runtime_1.jsx)(Auth_1.default, { withModal: true, pwdOrTokens: authModalState, openModal: !!authModalState, setPwdOrTokens: setAuthModalState, showTokens: memori.privacyType === 'SECRET', onFinish: async (values) => {
|
|
2211
1908
|
var _a, _b, _c, _d;
|
|
2212
1909
|
if (values['password'])
|
|
2213
1910
|
setMemoriPwd(values['password']);
|
|
@@ -2215,7 +1912,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
2215
1912
|
memoriPassword = values['password'];
|
|
2216
1913
|
if (values['tokens'])
|
|
2217
1914
|
setMemoriTokens(values['tokens']);
|
|
2218
|
-
reopenSession(!sessionId, values['password'], values['tokens'],
|
|
1915
|
+
reopenSession(!sessionId, values['password'], values['tokens'], personification === null || personification === void 0 ? void 0 : personification.tag, personification === null || personification === void 0 ? void 0 : personification.pin, {
|
|
2219
1916
|
PATHNAME: (_a = window.location.pathname) === null || _a === void 0 ? void 0 : _a.toUpperCase(),
|
|
2220
1917
|
ROUTE: ((_d = (_c = (_b = window.location.pathname) === null || _b === void 0 ? void 0 : _b.split('/')) === null || _c === void 0 ? void 0 : _c.pop()) === null || _d === void 0 ? void 0 : _d.toUpperCase()) ||
|
|
2221
1918
|
'',
|
|
@@ -2223,18 +1920,23 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
2223
1920
|
}, initialQuestion, birthDate)
|
|
2224
1921
|
.then(state => {
|
|
2225
1922
|
setAuthModalState(null);
|
|
2226
|
-
|
|
1923
|
+
if (state === null || state === void 0 ? void 0 : state.dialogState) {
|
|
1924
|
+
setHasUserActivatedSpeak(true);
|
|
1925
|
+
}
|
|
1926
|
+
else {
|
|
1927
|
+
onClickStart(state || undefined);
|
|
1928
|
+
}
|
|
2227
1929
|
})
|
|
2228
1930
|
.catch(() => {
|
|
2229
1931
|
setAuthModalState(null);
|
|
2230
1932
|
setGotErrorInOpening(true);
|
|
2231
1933
|
});
|
|
2232
|
-
}, minimumNumberOfRecoveryTokens: (
|
|
1934
|
+
}, minimumNumberOfRecoveryTokens: (_7 = memori === null || memori === void 0 ? void 0 : memori.minimumNumberOfRecoveryTokens) !== null && _7 !== void 0 ? _7 : 1 })), isClient && ((0, jsx_runtime_1.jsx)(AgeVerificationModal_1.default, { visible: showAgeVerification, minAge: minAge, onClose: birthDate => {
|
|
2233
1935
|
var _a, _b, _c, _d;
|
|
2234
1936
|
if (birthDate) {
|
|
2235
1937
|
setBirthDate(birthDate);
|
|
2236
1938
|
(0, configuration_1.setLocalConfig)('birthDate', birthDate);
|
|
2237
|
-
reopenSession(!sessionId, memoriPassword || memoriPwd || (memori === null || memori === void 0 ? void 0 : memori.secretToken), memoriTokens,
|
|
1939
|
+
reopenSession(!sessionId, memoriPassword || memoriPwd || (memori === null || memori === void 0 ? void 0 : memori.secretToken), memoriTokens, personification === null || personification === void 0 ? void 0 : personification.tag, personification === null || personification === void 0 ? void 0 : personification.pin, {
|
|
2238
1940
|
PATHNAME: (_a = window.location.pathname) === null || _a === void 0 ? void 0 : _a.toUpperCase(),
|
|
2239
1941
|
ROUTE: ((_d = (_c = (_b = window.location.pathname) === null || _b === void 0 ? void 0 : _b.split('/')) === null || _c === void 0 ? void 0 : _c.pop()) === null || _d === void 0 ? void 0 : _d.toUpperCase()) || '',
|
|
2240
1942
|
...(initialContextVars || {}),
|
|
@@ -2253,11 +1955,18 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
2253
1955
|
setShowAgeVerification(false);
|
|
2254
1956
|
setClickedStart(false);
|
|
2255
1957
|
}
|
|
2256
|
-
} })), showSettingsDrawer && ((0, jsx_runtime_1.jsx)(SettingsDrawer_1.default, { layout: selectedLayout, open: !!showSettingsDrawer, onClose: () => setShowSettingsDrawer(false), microphoneMode: continuousSpeech ? 'CONTINUOUS' : 'HOLD_TO_TALK', continuousSpeechTimeout: continuousSpeechTimeout, setMicrophoneMode: mode => setContinuousSpeech(mode === 'CONTINUOUS'), setContinuousSpeechTimeout: setContinuousSpeechTimeout, controlsPosition: controlsPosition, setControlsPosition: setControlsPosition, hideEmissions: hideEmissions, setHideEmissions: setHideEmissions, additionalSettings: additionalSettings })),
|
|
1958
|
+
} })), showSettingsDrawer && ((0, jsx_runtime_1.jsx)(SettingsDrawer_1.default, { layout: selectedLayout, open: !!showSettingsDrawer, onClose: () => setShowSettingsDrawer(false), microphoneMode: continuousSpeech ? 'CONTINUOUS' : 'HOLD_TO_TALK', continuousSpeechTimeout: continuousSpeechTimeout, setMicrophoneMode: mode => setContinuousSpeech(mode === 'CONTINUOUS'), setContinuousSpeechTimeout: setContinuousSpeechTimeout, controlsPosition: controlsPosition, setControlsPosition: setControlsPosition, hideEmissions: hideEmissions, setHideEmissions: setHideEmissions, avatarType: avatarType, setAvatarType: setAvatarType, enablePositionControls: enablePositionControls, setEnablePositionControls: setEnablePositionControls, isAvatar3d: !!(integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.avatarURL), additionalSettings: additionalSettings, speakerMuted: speakerMuted })), showChatHistoryDrawer && ((0, jsx_runtime_1.jsx)(ChatHistory_1.default, { open: !!showChatHistoryDrawer, onClose: () => setShowChatHistoryDrawer(false), resumeSession: chatLog => {
|
|
1959
|
+
setChatLogID(chatLog.chatLogID);
|
|
1960
|
+
onClickStart(undefined, false, chatLog);
|
|
1961
|
+
setShowChatHistoryDrawer(false);
|
|
1962
|
+
}, apiClient: client, sessionId: sessionId || '', memori: memori, baseUrl: baseUrl, history: history, apiUrl: client.constants.BACKEND_URL, loginToken: loginToken, language: language, userLang: userLang, isMultilanguageEnabled: isMultilanguageEnabled })), showPositionDrawer && ((0, jsx_runtime_1.jsx)(PositionDrawer_1.default, { memori: memori, open: !!showPositionDrawer, venue: position, setVenue: setPosition, onClose: position => {
|
|
2257
1963
|
if (position)
|
|
2258
1964
|
applyPosition(position);
|
|
2259
1965
|
setShowPositionDrawer(false);
|
|
2260
|
-
|
|
1966
|
+
if (autoStart) {
|
|
1967
|
+
onClickStart();
|
|
1968
|
+
}
|
|
1969
|
+
} })), showKnownFactsDrawer && sessionId && ((0, jsx_runtime_1.jsx)(KnownFacts_1.default, { apiClient: client, memori: memori, sessionID: sessionId, visible: showKnownFactsDrawer, closeDrawer: () => setShowKnownFactsDrawer(false) })), showExpertsDrawer && !!experts && ((0, jsx_runtime_1.jsx)(ExpertsDrawer_1.default, { apiUrl: client.constants.BACKEND_URL, baseUrl: baseUrl, tenant: tenant, experts: experts, open: showExpertsDrawer, onClose: () => setShowExpertsDrawer(false) })), showLoginDrawer && (tenant === null || tenant === void 0 ? void 0 : tenant.name) && ((0, jsx_runtime_1.jsx)(LoginDrawer_1.default, { tenant: tenant, apiClient: client, open: !!showLoginDrawer, user: user, loginToken: loginToken, onClose: () => setShowLoginDrawer(false), onLogin: (user, token) => {
|
|
2261
1970
|
setUser(user);
|
|
2262
1971
|
setLoginToken(token);
|
|
2263
1972
|
userToken = token;
|
|
@@ -2273,7 +1982,10 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
2273
1982
|
userToken = undefined;
|
|
2274
1983
|
(0, configuration_1.removeLocalConfig)('loginToken');
|
|
2275
1984
|
});
|
|
2276
|
-
} }))
|
|
1985
|
+
} })), error && ((0, jsx_runtime_1.jsx)(Alert_1.default, { open: !!error, onClose: () => {
|
|
1986
|
+
setError(null);
|
|
1987
|
+
window.open('chrome://settings/content/autoplay', '_blank');
|
|
1988
|
+
}, title: "Error", description: error.message, type: "error" }))] }));
|
|
2277
1989
|
};
|
|
2278
1990
|
exports.default = MemoriWidget;
|
|
2279
1991
|
//# sourceMappingURL=MemoriWidget.js.map
|