isometrik-plugin-chat-sdk 1.0.0
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/LICENSE +21 -0
- package/dist/cjs/BlockChatList-720a703e.js +423 -0
- package/dist/cjs/BlockChatList-720a703e.js.map +1 -0
- package/dist/cjs/DocumentMessageBubble-c79bfbe5.js +493 -0
- package/dist/cjs/DocumentMessageBubble-c79bfbe5.js.map +1 -0
- package/dist/cjs/Image-67c52acd.js +135 -0
- package/dist/cjs/Image-67c52acd.js.map +1 -0
- package/dist/cjs/ImageMessageBubble-1218fb66.js +675 -0
- package/dist/cjs/ImageMessageBubble-1218fb66.js.map +1 -0
- package/dist/cjs/IsometrikLogo-976b1c34.js +44 -0
- package/dist/cjs/IsometrikLogo-976b1c34.js.map +1 -0
- package/dist/cjs/MessageSearch-5fc9dc00.js +5892 -0
- package/dist/cjs/MessageSearch-5fc9dc00.js.map +1 -0
- package/dist/cjs/ReactionsContainer-a6ce9059.js +375 -0
- package/dist/cjs/ReactionsContainer-a6ce9059.js.map +1 -0
- package/dist/cjs/Text-fedf6eab.js +60 -0
- package/dist/cjs/Text-fedf6eab.js.map +1 -0
- package/dist/cjs/VideoMessageBubble-c4694a78.js +571 -0
- package/dist/cjs/VideoMessageBubble-c4694a78.js.map +1 -0
- package/dist/cjs/WebChat-403e7ab1.js +2884 -0
- package/dist/cjs/WebChat-403e7ab1.js.map +1 -0
- package/dist/cjs/app-globals-3a1e7e63.js +7 -0
- package/dist/cjs/app-globals-3a1e7e63.js.map +1 -0
- package/dist/cjs/audio-bubble_8.cjs.entry.js +21011 -0
- package/dist/cjs/audio-bubble_8.cjs.entry.js.map +1 -0
- package/dist/cjs/block-chat-list.cjs.entry.js +16 -0
- package/dist/cjs/block-chat-list.cjs.entry.js.map +1 -0
- package/dist/cjs/chat-app.cjs.entry.js +55 -0
- package/dist/cjs/chat-app.cjs.entry.js.map +1 -0
- package/dist/cjs/chat-assets-6ab1faa6.js +9 -0
- package/dist/cjs/chat-assets-6ab1faa6.js.map +1 -0
- package/dist/cjs/chat-creds-f4cbf400.js +38 -0
- package/dist/cjs/chat-creds-f4cbf400.js.map +1 -0
- package/dist/cjs/chat-document-message-bubble.cjs.entry.js +24 -0
- package/dist/cjs/chat-document-message-bubble.cjs.entry.js.map +1 -0
- package/dist/cjs/chat-image-message-bubble.cjs.entry.js +26 -0
- package/dist/cjs/chat-image-message-bubble.cjs.entry.js.map +1 -0
- package/dist/cjs/chat-video-message-bubble.cjs.entry.js +24 -0
- package/dist/cjs/chat-video-message-bubble.cjs.entry.js.map +1 -0
- package/dist/cjs/content-eca5336c.js +81 -0
- package/dist/cjs/content-eca5336c.js.map +1 -0
- package/dist/cjs/dialog-drawer-9d04911c.js +5313 -0
- package/dist/cjs/dialog-drawer-9d04911c.js.map +1 -0
- package/dist/cjs/forward-memebers.cjs.entry.js +128 -0
- package/dist/cjs/forward-memebers.cjs.entry.js.map +1 -0
- package/dist/cjs/group-members-a60fb1cb.js +41 -0
- package/dist/cjs/group-members-a60fb1cb.js.map +1 -0
- package/dist/cjs/groupcast-49dae5ab.js +202 -0
- package/dist/cjs/groupcast-49dae5ab.js.map +1 -0
- package/dist/cjs/imagePlaceholder-030cc566.js +4365 -0
- package/dist/cjs/imagePlaceholder-030cc566.js.map +1 -0
- package/dist/cjs/index-9afe62b6.js +3129 -0
- package/dist/cjs/index-9afe62b6.js.map +1 -0
- package/dist/cjs/index.cjs.js +148 -0
- package/dist/cjs/index.cjs.js.map +1 -0
- package/dist/cjs/isometrik-webchat.cjs.js +54 -0
- package/dist/cjs/isometrik-webchat.cjs.js.map +1 -0
- package/dist/cjs/loader.cjs.js +17 -0
- package/dist/cjs/loader.cjs.js.map +1 -0
- package/dist/cjs/login-page.cjs.entry.js +85 -0
- package/dist/cjs/login-page.cjs.entry.js.map +1 -0
- package/dist/cjs/member-add.cjs.entry.js +122 -0
- package/dist/cjs/member-add.cjs.entry.js.map +1 -0
- package/dist/cjs/message-reaction-976f6261.js +24 -0
- package/dist/cjs/message-reaction-976f6261.js.map +1 -0
- package/dist/cjs/my-component.cjs.entry.js +29 -0
- package/dist/cjs/my-component.cjs.entry.js.map +1 -0
- package/dist/cjs/reaction-container.cjs.entry.js +52 -0
- package/dist/cjs/reaction-container.cjs.entry.js.map +1 -0
- package/dist/cjs/shadow-css-7c4dbc43.js +336 -0
- package/dist/cjs/shadow-css-7c4dbc43.js.map +1 -0
- package/dist/cjs/signup-page.cjs.entry.js +143 -0
- package/dist/cjs/signup-page.cjs.entry.js.map +1 -0
- package/dist/cjs/taguser-aca04ed9.js +512 -0
- package/dist/cjs/taguser-aca04ed9.js.map +1 -0
- package/dist/cjs/theme-provider_2.cjs.entry.js +113 -0
- package/dist/cjs/theme-provider_2.cjs.entry.js.map +1 -0
- package/dist/cjs/toast-helper-defae4a5.js +84 -0
- package/dist/cjs/toast-helper-defae4a5.js.map +1 -0
- package/dist/cjs/utils-bcad3386.js +9 -0
- package/dist/cjs/utils-bcad3386.js.map +1 -0
- package/dist/collection/api/conversations.js +12 -0
- package/dist/collection/api/group-members.js +36 -0
- package/dist/collection/api/groupcast.js +183 -0
- package/dist/collection/api/membership-control.js +13 -0
- package/dist/collection/api/message-reaction.js +16 -0
- package/dist/collection/api/social-accounts.js +282 -0
- package/dist/collection/app-root.js +51 -0
- package/dist/collection/app-root.js.map +1 -0
- package/dist/collection/assets/images/avatar.svg +1 -0
- package/dist/collection/assets/images/chatdefaultbg.svg +6140 -0
- package/dist/collection/assets/images/equalizer.svg +1 -0
- package/dist/collection/assets/images/imagePlaceholder.svg +2 -0
- package/dist/collection/assets/images/link.svg +1 -0
- package/dist/collection/assets/images/videoPlaceholder.svg +4 -0
- package/dist/collection/assets/images/videoThumbnail.svg +1 -0
- package/dist/collection/assets/svg/ExcelDocument.js +2 -0
- package/dist/collection/assets/svg/IsometrikLogo.js +38 -0
- package/dist/collection/assets/svg/Moon.svg +1 -0
- package/dist/collection/assets/svg/NoChatPlaceholder.js +16 -0
- package/dist/collection/assets/svg/NoContactsPlaceholder.js +9 -0
- package/dist/collection/assets/svg/NoMessagePlaceholder.svg +13 -0
- package/dist/collection/assets/svg/PdfDocument.js +2 -0
- package/dist/collection/assets/svg/ProfilePlaceholder.js +1 -0
- package/dist/collection/assets/svg/SelectChatPlaceholder.js +13 -0
- package/dist/collection/assets/svg/Sun.svg +1 -0
- package/dist/collection/assets/svg/broadcast-selected.svg +4 -0
- package/dist/collection/assets/svg/broadcst-default.svg +4 -0
- package/dist/collection/assets/svg/close.svg +1 -0
- package/dist/collection/assets/svg/group.svg +7 -0
- package/dist/collection/assets/svg/login.svg +3051 -0
- package/dist/collection/assets/svg/message-add.svg +5 -0
- package/dist/collection/assets/svg/message-bold.svg +3 -0
- package/dist/collection/assets/svg/message-outline.svg +5 -0
- package/dist/collection/collection-manifest.json +32 -0
- package/dist/collection/components/ChatUIComponent/AddMember.js +144 -0
- package/dist/collection/components/ChatUIComponent/AddMember.js.map +1 -0
- package/dist/collection/components/ChatUIComponent/AudioBubble.js +528 -0
- package/dist/collection/components/ChatUIComponent/AudioBubble.js.map +1 -0
- package/dist/collection/components/ChatUIComponent/BlockChatList.js +114 -0
- package/dist/collection/components/ChatUIComponent/BlockChatList.js.map +1 -0
- package/dist/collection/components/ChatUIComponent/ChatDocumentMessageBubble.js +11 -0
- package/dist/collection/components/ChatUIComponent/ChatDocumentMessageBubble.js.map +1 -0
- package/dist/collection/components/ChatUIComponent/ChatImageMessageBubble.js +11 -0
- package/dist/collection/components/ChatUIComponent/ChatImageMessageBubble.js.map +1 -0
- package/dist/collection/components/ChatUIComponent/ChatOwnProfile/Profile.js +540 -0
- package/dist/collection/components/ChatUIComponent/ChatOwnProfile/Profile.js.map +1 -0
- package/dist/collection/components/ChatUIComponent/ChatOwnProfile/profile-page.css +252 -0
- package/dist/collection/components/ChatUIComponent/ChatSidebar/ChatSidebar.js +1175 -0
- package/dist/collection/components/ChatUIComponent/ChatSidebar/ChatSidebar.js.map +1 -0
- package/dist/collection/components/ChatUIComponent/ChatVideoMessageBubble.js +11 -0
- package/dist/collection/components/ChatUIComponent/ChatVideoMessageBubble.js.map +1 -0
- package/dist/collection/components/ChatUIComponent/Footer/ChatFooter.js +790 -0
- package/dist/collection/components/ChatUIComponent/Footer/ChatFooter.js.map +1 -0
- package/dist/collection/components/ChatUIComponent/ForwardMessageList.js +152 -0
- package/dist/collection/components/ChatUIComponent/ForwardMessageList.js.map +1 -0
- package/dist/collection/components/ChatUIComponent/GroupCast.js +218 -0
- package/dist/collection/components/ChatUIComponent/GroupCast.js.map +1 -0
- package/dist/collection/components/ChatUIComponent/Header/WebChatHeader.js +590 -0
- package/dist/collection/components/ChatUIComponent/Header/WebChatHeader.js.map +1 -0
- package/dist/collection/components/ChatUIComponent/ReactionContainer.js +103 -0
- package/dist/collection/components/ChatUIComponent/ReactionContainer.js.map +1 -0
- package/dist/collection/components/ChatUIComponent/WebChatBody/WebChatBody.js +1352 -0
- package/dist/collection/components/ChatUIComponent/WebChatBody/WebChatBody.js.map +1 -0
- package/dist/collection/components/ChatUIComponent/WebChatBody/web-chat-body.css +277 -0
- package/dist/collection/components/Login.js +118 -0
- package/dist/collection/components/Login.js.map +1 -0
- package/dist/collection/components/Signup.js +177 -0
- package/dist/collection/components/Signup.js.map +1 -0
- package/dist/collection/components/chat-main.js +131 -0
- package/dist/collection/components/chat-main.js.map +1 -0
- package/dist/collection/components/my-component/my-component.css +3 -0
- package/dist/collection/components/my-component/my-component.js +83 -0
- package/dist/collection/components/my-component/my-component.js.map +1 -0
- package/dist/collection/components/my-component/web-chat/WebChat.js +2686 -0
- package/dist/collection/components/my-component/web-chat/WebChat.js.map +1 -0
- package/dist/collection/components/my-component/web-chat/WebchatRightSide.js +675 -0
- package/dist/collection/components/my-component/web-chat/WebchatRightSide.js.map +1 -0
- package/dist/collection/components/my-component/web-chat/web-chat.css +336 -0
- package/dist/collection/components/theme-provider.js +182 -0
- package/dist/collection/components/theme-provider.js.map +1 -0
- package/dist/collection/constants/chat-assets.js +12 -0
- package/dist/collection/constants/chat-creds.js +31 -0
- package/dist/collection/constants/content.js +75 -0
- package/dist/collection/constants/urls.js +1 -0
- package/dist/collection/index.js +135 -0
- package/dist/collection/index.js.map +1 -0
- package/dist/collection/lib/helpers.js +205 -0
- package/dist/collection/lib/taguser.js +123 -0
- package/dist/collection/store/conversation.js +25 -0
- package/dist/collection/store/conversation.js.map +1 -0
- package/dist/collection/store/group-members.js +24 -0
- package/dist/collection/store/group-members.js.map +1 -0
- package/dist/collection/store/unread-count.js +18 -0
- package/dist/collection/store/unread-count.js.map +1 -0
- package/dist/collection/stories/Components/ActionsPopup/ActionsPopup.js +222 -0
- package/dist/collection/stories/Components/ActionsPopup/ActionsPopup.stories.js +148 -0
- package/dist/collection/stories/Components/AttachmentBox/AttachmentBox.js +211 -0
- package/dist/collection/stories/Components/AttachmentBox/AttachmentPreview/AttachmentPreview.js +708 -0
- package/dist/collection/stories/Components/AttachmentBox/AttachmentPreview/AttachmentPreview.stories.js +57 -0
- package/dist/collection/stories/Components/AttachmentBox/Attachmentbox.stories.js +74 -0
- package/dist/collection/stories/Components/AttachmentBox/CameraPreview.js +231 -0
- package/dist/collection/stories/Components/BlockUsers/BlockUsers.js +337 -0
- package/dist/collection/stories/Components/Body/Body.js +48 -0
- package/dist/collection/stories/Components/Body/Body.stories.js +33 -0
- package/dist/collection/stories/Components/Buttons/Buttons.js +65 -0
- package/dist/collection/stories/Components/Buttons/Buttons.stories.js +132 -0
- package/dist/collection/stories/Components/ChatSidebar/ChatSidebar.js +951 -0
- package/dist/collection/stories/Components/ChatSidebar/ChatSidebar.stories.js +75 -0
- package/dist/collection/stories/Components/ChatSidebar/ContextMenu.js +109 -0
- package/dist/collection/stories/Components/ChatTile/ChatTile.js +290 -0
- package/dist/collection/stories/Components/ChatTile/ChatTile.stories.js +180 -0
- package/dist/collection/stories/Components/Chip/Chip.js +111 -0
- package/dist/collection/stories/Components/Chip/Chip.stories.js +149 -0
- package/dist/collection/stories/Components/ContactInfo/ContactInfo.js +1491 -0
- package/dist/collection/stories/Components/ContactInfo/ContactInfo.stories.js +118 -0
- package/dist/collection/stories/Components/ContactInfo/MediaList.js +147 -0
- package/dist/collection/stories/Components/ContactInfo/ProfileInfo.js +1219 -0
- package/dist/collection/stories/Components/ContactTile/ContactTile.js +416 -0
- package/dist/collection/stories/Components/ContactTile/ContactTile.stories.js +60 -0
- package/dist/collection/stories/Components/Dialog-Drawer/confirm.js +113 -0
- package/dist/collection/stories/Components/Dialog-Drawer/deletemessage.js +97 -0
- package/dist/collection/stories/Components/Dialog-Drawer/dialog-drawer.js +264 -0
- package/dist/collection/stories/Components/EmojiReactions/EmojiReactions.js +179 -0
- package/dist/collection/stories/Components/Footer/Footer.js +4 -0
- package/dist/collection/stories/Components/Footer/Footer.stories.js +155 -0
- package/dist/collection/stories/Components/ForwardMessage/ForwardMessageContainer.js +433 -0
- package/dist/collection/stories/Components/ForwardMessage/ForwardMessageContainer.stories.js +110 -0
- package/dist/collection/stories/Components/ForwardMessage/ForwardUi.js +46 -0
- package/dist/collection/stories/Components/GroupChatContacts/GroupChatContacts.js +546 -0
- package/dist/collection/stories/Components/GroupChatContacts/GroupChatContacts.stories.js +56 -0
- package/dist/collection/stories/Components/GroupInfo/GroupInfo.js +394 -0
- package/dist/collection/stories/Components/GroupInfo/GroupInfo.stories.js +107 -0
- package/dist/collection/stories/Components/Head/ClosedHeader/ClosedHead.js +129 -0
- package/dist/collection/stories/Components/Head/ClosedHeader/ClosedHead.stories.js +78 -0
- package/dist/collection/stories/Components/Head/Head.js +672 -0
- package/dist/collection/stories/Components/Head/Head.stories.js +91 -0
- package/dist/collection/stories/Components/Icon/Icon.js +115 -0
- package/dist/collection/stories/Components/Image/Image.js +41 -0
- package/dist/collection/stories/Components/Image/Image.stories.js +49 -0
- package/dist/collection/stories/Components/Image/Img.stories.js +178 -0
- package/dist/collection/stories/Components/Inputbox/Input.js +206 -0
- package/dist/collection/stories/Components/Inputbox/Input.stories.js +87 -0
- package/dist/collection/stories/Components/InstagramAccounts/InstagramAccountsPanel.js +605 -0
- package/dist/collection/stories/Components/Loader/Spinner/Spinner.js +60 -0
- package/dist/collection/stories/Components/Loader/Spinner/Spinner.stories.js +38 -0
- package/dist/collection/stories/Components/MainPlaceHolder/MainChatPlaceHolder.js +78 -0
- package/dist/collection/stories/Components/MainPlaceHolder/MainPlaceHolder.stories.js +130 -0
- package/dist/collection/stories/Components/MediaGallery/MediaGallery.js +868 -0
- package/dist/collection/stories/Components/MediaGallery/MediaGallery.stories.js +81 -0
- package/dist/collection/stories/Components/MembersList/MembersList.js +348 -0
- package/dist/collection/stories/Components/MessageBubble/AudioMessageBubble/AudioMesaageBubble.js +533 -0
- package/dist/collection/stories/Components/MessageBubble/DocumentMessageBubble/DocumentMessageBubble.js +484 -0
- package/dist/collection/stories/Components/MessageBubble/DocumentMessageBubble/DocumentMessageBubble.stories.js +54 -0
- package/dist/collection/stories/Components/MessageBubble/ImageMessageBubble/ImageMessageBubble.js +683 -0
- package/dist/collection/stories/Components/MessageBubble/ImageMessageBubble/ImageMessageBubble.stories.js +49 -0
- package/dist/collection/stories/Components/MessageBubble/IncomingTextMessageBubble/IncomingTextMessageBubble.js +450 -0
- package/dist/collection/stories/Components/MessageBubble/IncomingTextMessageBubble/IncomingTextMessageBubble.stories.js +56 -0
- package/dist/collection/stories/Components/MessageBubble/LinkMessageBubble/LinkMessageBubble.js +721 -0
- package/dist/collection/stories/Components/MessageBubble/OutgoingTextMessageBubble/OutgoingTextMessageBubble.js +139 -0
- package/dist/collection/stories/Components/MessageBubble/OutgoingTextMessageBubble/OutgoingTextMessageBubble.stories.js +63 -0
- package/dist/collection/stories/Components/MessageBubble/VideoMessageBubble/VideoMessageBubble.js +576 -0
- package/dist/collection/stories/Components/MessageBubble/VideoMessageBubble/VideoMessageBubble.stories.js +50 -0
- package/dist/collection/stories/Components/MessageDatePill/MessageDatePill.js +66 -0
- package/dist/collection/stories/Components/MessageDatePill/MessageDatePill.stories.js +48 -0
- package/dist/collection/stories/Components/MessageInfo/MessageInfo.js +465 -0
- package/dist/collection/stories/Components/MessageInfo/MessageInfo.stories.js +111 -0
- package/dist/collection/stories/Components/MessageSearch/MessageSearch.js +242 -0
- package/dist/collection/stories/Components/MessageSearchBar/SearchBar.js +523 -0
- package/dist/collection/stories/Components/MessageSearchBar/SearchBar.stories.js +98 -0
- package/dist/collection/stories/Components/MessageUnreadCount/MessageUnreadCount.js +51 -0
- package/dist/collection/stories/Components/MessageUnreadCount/MessageUnreadCount.stories.js +79 -0
- package/dist/collection/stories/Components/NewChatSidebar/NewChatSidebar.js +560 -0
- package/dist/collection/stories/Components/NewChatSidebar/NewChatSidebar.stories.js +56 -0
- package/dist/collection/stories/Components/Placeholder/NoContactsPlaceholder.js +57 -0
- package/dist/collection/stories/Components/Popup/ConfirmationPopup/DeleteConfirmationPopup/DeletePopup.js +114 -0
- package/dist/collection/stories/Components/ProfileSidebar/ProfileSidebar.js +166 -0
- package/dist/collection/stories/Components/ProfileSidebar/ProfileSidebar.stories.js +125 -0
- package/dist/collection/stories/Components/ProfileTab/ProfileTab.js +939 -0
- package/dist/collection/stories/Components/ProfileTab/ProfileTab.stories.js +144 -0
- package/dist/collection/stories/Components/ReactionsContainer/ReactionsContainer.js +166 -0
- package/dist/collection/stories/Components/ReactionsContainer/ReactionsContainer.stories.js +115 -0
- package/dist/collection/stories/Components/ReactionsContainer/ReactionsInfoCard/ReactionsInfoCard.js +98 -0
- package/dist/collection/stories/Components/ReactionsContainer/ReactionsInfoCard/ReactionsInfoCard.stories.js +55 -0
- package/dist/collection/stories/Components/ReadMark/BlueReadMark/BlueReadMark.js +27 -0
- package/dist/collection/stories/Components/ReadMark/BlueReadMark/BlueReadMark.stories.js +28 -0
- package/dist/collection/stories/Components/ReadMark/ClockMark/ClockMark.js +26 -0
- package/dist/collection/stories/Components/ReadMark/ClockMark/ClockMark.stories.js +33 -0
- package/dist/collection/stories/Components/ReadMark/DoubleMark/DoubleMark.js +27 -0
- package/dist/collection/stories/Components/ReadMark/DoubleMark/DoubleMark.stories.js +28 -0
- package/dist/collection/stories/Components/ReadMark/SingleMark/SingleMark.js +38 -0
- package/dist/collection/stories/Components/ReadMark/SingleMark/SingleMark.stories.js +33 -0
- package/dist/collection/stories/Components/ReplyBlock/MediaIcons.js +16 -0
- package/dist/collection/stories/Components/ReplyBlock/ReplyBlock.js +196 -0
- package/dist/collection/stories/Components/ReplyBlock/ReplyBlock.stories.js +57 -0
- package/dist/collection/stories/Components/ReplyMessageContainer/ReplyMessageContainer.js +645 -0
- package/dist/collection/stories/Components/ReplyMessageContainer/ReplyMessageContainer.stories.js +58 -0
- package/dist/collection/stories/Components/SearchableList/SearchableList.js +393 -0
- package/dist/collection/stories/Components/SearchableList/SearchableList.stories.js +65 -0
- package/dist/collection/stories/Components/SharePopup/SharePopup.js +152 -0
- package/dist/collection/stories/Components/SharePopup/SharePopup.stories.js +47 -0
- package/dist/collection/stories/Components/Splitscreen/Splitscreen.js +157 -0
- package/dist/collection/stories/Components/Splitscreen/Splitscreen.stories.js +100 -0
- package/dist/collection/stories/Components/TestFooter/MentionUserList.js +194 -0
- package/dist/collection/stories/Components/TestFooter/TestFooter.js +1339 -0
- package/dist/collection/stories/Components/TestFooter/TestFooter.stories.js +89 -0
- package/dist/collection/stories/Components/Text/Text.js +57 -0
- package/dist/collection/stories/Components/Text/Text.stories.js +83 -0
- package/dist/collection/stories/Components/TextStyle/TextStyle.js +38 -0
- package/dist/collection/stories/Components/TextStyle/TextStyle.stories.js +50 -0
- package/dist/collection/stories/Components/Time/Timestamp.js +50 -0
- package/dist/collection/stories/Components/Time/Timestamp.stories.js +34 -0
- package/dist/collection/stories/Components/Toaster/Toaster.js +94 -0
- package/dist/collection/stories/Components/Toaster/Toaster.stories.js +108 -0
- package/dist/collection/stories/Components/Toaster/toast-helper.js +79 -0
- package/dist/collection/stories/Components/Toaster/toast-helper.js.map +1 -0
- package/dist/collection/stories/Components/final/final.js +86 -0
- package/dist/collection/stories/Components/final/final.stories.js +30 -0
- package/dist/collection/stories/assets/SEARCH ICON.svg +1 -0
- package/dist/collection/types/ConversationDetailsTypes.js +2 -0
- package/dist/collection/types/ConversationDetailsTypes.js.map +1 -0
- package/dist/collection/utils/chatSdk.js +14 -0
- package/dist/collection/utils/getFomattedDate.js +34 -0
- package/dist/collection/utils/getFomattedDate.js.map +1 -0
- package/dist/collection/utils/unixTimeConverter.js +28 -0
- package/dist/collection/utils/utils.js +4 -0
- package/dist/collection/utils/utils.js.map +1 -0
- package/dist/esm/BlockChatList-9fc3a42b.js +421 -0
- package/dist/esm/BlockChatList-9fc3a42b.js.map +1 -0
- package/dist/esm/DocumentMessageBubble-b67726f2.js +491 -0
- package/dist/esm/DocumentMessageBubble-b67726f2.js.map +1 -0
- package/dist/esm/Image-bb9efda3.js +121 -0
- package/dist/esm/Image-bb9efda3.js.map +1 -0
- package/dist/esm/ImageMessageBubble-0e473f6e.js +673 -0
- package/dist/esm/ImageMessageBubble-0e473f6e.js.map +1 -0
- package/dist/esm/IsometrikLogo-14db76af.js +42 -0
- package/dist/esm/IsometrikLogo-14db76af.js.map +1 -0
- package/dist/esm/MessageSearch-4101a627.js +5875 -0
- package/dist/esm/MessageSearch-4101a627.js.map +1 -0
- package/dist/esm/ReactionsContainer-bdd74a3c.js +373 -0
- package/dist/esm/ReactionsContainer-bdd74a3c.js.map +1 -0
- package/dist/esm/Text-3b0b3898.js +58 -0
- package/dist/esm/Text-3b0b3898.js.map +1 -0
- package/dist/esm/VideoMessageBubble-88a7a53e.js +569 -0
- package/dist/esm/VideoMessageBubble-88a7a53e.js.map +1 -0
- package/dist/esm/WebChat-5448d615.js +2882 -0
- package/dist/esm/WebChat-5448d615.js.map +1 -0
- package/dist/esm/app-globals-0f993ce5.js +5 -0
- package/dist/esm/app-globals-0f993ce5.js.map +1 -0
- package/dist/esm/audio-bubble_8.entry.js +21001 -0
- package/dist/esm/audio-bubble_8.entry.js.map +1 -0
- package/dist/esm/block-chat-list.entry.js +8 -0
- package/dist/esm/block-chat-list.entry.js.map +1 -0
- package/dist/esm/chat-app.entry.js +51 -0
- package/dist/esm/chat-app.entry.js.map +1 -0
- package/dist/esm/chat-assets-bd8778d5.js +6 -0
- package/dist/esm/chat-assets-bd8778d5.js.map +1 -0
- package/dist/esm/chat-creds-ff086f05.js +35 -0
- package/dist/esm/chat-creds-ff086f05.js.map +1 -0
- package/dist/esm/chat-document-message-bubble.entry.js +20 -0
- package/dist/esm/chat-document-message-bubble.entry.js.map +1 -0
- package/dist/esm/chat-image-message-bubble.entry.js +22 -0
- package/dist/esm/chat-image-message-bubble.entry.js.map +1 -0
- package/dist/esm/chat-video-message-bubble.entry.js +20 -0
- package/dist/esm/chat-video-message-bubble.entry.js.map +1 -0
- package/dist/esm/content-5aea5e39.js +79 -0
- package/dist/esm/content-5aea5e39.js.map +1 -0
- package/dist/esm/dialog-drawer-9fa083b1.js +5304 -0
- package/dist/esm/dialog-drawer-9fa083b1.js.map +1 -0
- package/dist/esm/forward-memebers.entry.js +124 -0
- package/dist/esm/forward-memebers.entry.js.map +1 -0
- package/dist/esm/group-members-bb3c8db7.js +37 -0
- package/dist/esm/group-members-bb3c8db7.js.map +1 -0
- package/dist/esm/groupcast-d1c54a27.js +187 -0
- package/dist/esm/groupcast-d1c54a27.js.map +1 -0
- package/dist/esm/imagePlaceholder-e544f70b.js +4360 -0
- package/dist/esm/imagePlaceholder-e544f70b.js.map +1 -0
- package/dist/esm/index-fddf30b7.js +3093 -0
- package/dist/esm/index-fddf30b7.js.map +1 -0
- package/dist/esm/index.js +139 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/isometrik-webchat.js +49 -0
- package/dist/esm/isometrik-webchat.js.map +1 -0
- package/dist/esm/loader.js +13 -0
- package/dist/esm/loader.js.map +1 -0
- package/dist/esm/login-page.entry.js +81 -0
- package/dist/esm/login-page.entry.js.map +1 -0
- package/dist/esm/member-add.entry.js +118 -0
- package/dist/esm/member-add.entry.js.map +1 -0
- package/dist/esm/message-reaction-ad47ea1a.js +20 -0
- package/dist/esm/message-reaction-ad47ea1a.js.map +1 -0
- package/dist/esm/my-component.entry.js +25 -0
- package/dist/esm/my-component.entry.js.map +1 -0
- package/dist/esm/reaction-container.entry.js +48 -0
- package/dist/esm/reaction-container.entry.js.map +1 -0
- package/dist/esm/shadow-css-7ad5caf8.js +334 -0
- package/dist/esm/shadow-css-7ad5caf8.js.map +1 -0
- package/dist/esm/signup-page.entry.js +139 -0
- package/dist/esm/signup-page.entry.js.map +1 -0
- package/dist/esm/taguser-e9032d65.js +510 -0
- package/dist/esm/taguser-e9032d65.js.map +1 -0
- package/dist/esm/theme-provider_2.entry.js +108 -0
- package/dist/esm/theme-provider_2.entry.js.map +1 -0
- package/dist/esm/toast-helper-840fd8dc.js +82 -0
- package/dist/esm/toast-helper-840fd8dc.js.map +1 -0
- package/dist/esm/utils-11fcde98.js +7 -0
- package/dist/esm/utils-11fcde98.js.map +1 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/isometrik-webchat/index.esm.js +2 -0
- package/dist/isometrik-webchat/index.esm.js.map +1 -0
- package/dist/isometrik-webchat/isometrik-webchat.css +2 -0
- package/dist/isometrik-webchat/isometrik-webchat.esm.js +2 -0
- package/dist/isometrik-webchat/isometrik-webchat.esm.js.map +1 -0
- package/dist/isometrik-webchat/p-12774661.js +2 -0
- package/dist/isometrik-webchat/p-12774661.js.map +1 -0
- package/dist/isometrik-webchat/p-12e56271.js +549 -0
- package/dist/isometrik-webchat/p-12e56271.js.map +1 -0
- package/dist/isometrik-webchat/p-1415e589.js +2 -0
- package/dist/isometrik-webchat/p-1415e589.js.map +1 -0
- package/dist/isometrik-webchat/p-18f8d210.js +13 -0
- package/dist/isometrik-webchat/p-18f8d210.js.map +1 -0
- package/dist/isometrik-webchat/p-1b2461f4.js +357 -0
- package/dist/isometrik-webchat/p-1b2461f4.js.map +1 -0
- package/dist/isometrik-webchat/p-229095d4.js +2 -0
- package/dist/isometrik-webchat/p-229095d4.js.map +1 -0
- package/dist/isometrik-webchat/p-2953d06a.entry.js +2 -0
- package/dist/isometrik-webchat/p-2953d06a.entry.js.map +1 -0
- package/dist/isometrik-webchat/p-3004a123.js +2 -0
- package/dist/isometrik-webchat/p-3004a123.js.map +1 -0
- package/dist/isometrik-webchat/p-3044698a.js +2 -0
- package/dist/isometrik-webchat/p-3044698a.js.map +1 -0
- package/dist/isometrik-webchat/p-40517d7f.js +1098 -0
- package/dist/isometrik-webchat/p-40517d7f.js.map +1 -0
- package/dist/isometrik-webchat/p-42a62cf2.js +2 -0
- package/dist/isometrik-webchat/p-42a62cf2.js.map +1 -0
- package/dist/isometrik-webchat/p-48e1d174.js +45 -0
- package/dist/isometrik-webchat/p-48e1d174.js.map +1 -0
- package/dist/isometrik-webchat/p-48e243ec.entry.js +2 -0
- package/dist/isometrik-webchat/p-48e243ec.entry.js.map +1 -0
- package/dist/isometrik-webchat/p-4d2aca06.js +257 -0
- package/dist/isometrik-webchat/p-4d2aca06.js.map +1 -0
- package/dist/isometrik-webchat/p-610bfd8a.js +2 -0
- package/dist/isometrik-webchat/p-610bfd8a.js.map +1 -0
- package/dist/isometrik-webchat/p-674e4bb0.js +9 -0
- package/dist/isometrik-webchat/p-674e4bb0.js.map +1 -0
- package/dist/isometrik-webchat/p-8490e13d.js +192 -0
- package/dist/isometrik-webchat/p-8490e13d.js.map +1 -0
- package/dist/isometrik-webchat/p-858b0da8.entry.js +2 -0
- package/dist/isometrik-webchat/p-858b0da8.entry.js.map +1 -0
- package/dist/isometrik-webchat/p-89108249.entry.js +5010 -0
- package/dist/isometrik-webchat/p-89108249.entry.js.map +1 -0
- package/dist/isometrik-webchat/p-8dcdea59.js +2963 -0
- package/dist/isometrik-webchat/p-8dcdea59.js.map +1 -0
- package/dist/isometrik-webchat/p-92d0b21c.js +2 -0
- package/dist/isometrik-webchat/p-92d0b21c.js.map +1 -0
- package/dist/isometrik-webchat/p-ada9c8e8.entry.js +2 -0
- package/dist/isometrik-webchat/p-ada9c8e8.entry.js.map +1 -0
- package/dist/isometrik-webchat/p-adbb398d.entry.js +2 -0
- package/dist/isometrik-webchat/p-adbb398d.entry.js.map +1 -0
- package/dist/isometrik-webchat/p-b07dd267.js +2 -0
- package/dist/isometrik-webchat/p-b07dd267.js.map +1 -0
- package/dist/isometrik-webchat/p-bf0aeb22.entry.js +2 -0
- package/dist/isometrik-webchat/p-bf0aeb22.entry.js.map +1 -0
- package/dist/isometrik-webchat/p-bfd51dd4.entry.js +2 -0
- package/dist/isometrik-webchat/p-bfd51dd4.entry.js.map +1 -0
- package/dist/isometrik-webchat/p-c50aa410.entry.js +2 -0
- package/dist/isometrik-webchat/p-c50aa410.entry.js.map +1 -0
- package/dist/isometrik-webchat/p-cd34448c.entry.js +2 -0
- package/dist/isometrik-webchat/p-cd34448c.entry.js.map +1 -0
- package/dist/isometrik-webchat/p-d4b8ece6.entry.js +2 -0
- package/dist/isometrik-webchat/p-d4b8ece6.entry.js.map +1 -0
- package/dist/isometrik-webchat/p-de8a8642.js +197 -0
- package/dist/isometrik-webchat/p-de8a8642.js.map +1 -0
- package/dist/isometrik-webchat/p-e09b32eb.js +591 -0
- package/dist/isometrik-webchat/p-e09b32eb.js.map +1 -0
- package/dist/isometrik-webchat/p-e1255160.js +2 -0
- package/dist/isometrik-webchat/p-e1255160.js.map +1 -0
- package/dist/isometrik-webchat/p-e3731295.js +274 -0
- package/dist/isometrik-webchat/p-e3731295.js.map +1 -0
- package/dist/isometrik-webchat/p-e4efea64.entry.js +2 -0
- package/dist/isometrik-webchat/p-e4efea64.entry.js.map +1 -0
- package/dist/isometrik-webchat/p-ef6e482a.entry.js +2 -0
- package/dist/isometrik-webchat/p-ef6e482a.entry.js.map +1 -0
- package/dist/isometrik-webchat/p-f1f5d5bd.js +3 -0
- package/dist/isometrik-webchat/p-f1f5d5bd.js.map +1 -0
- package/dist/isometrik-webchat/p-ff9f3dfe.js +203 -0
- package/dist/isometrik-webchat/p-ff9f3dfe.js.map +1 -0
- package/dist/loader/cdn.js +1 -0
- package/dist/loader/index.cjs.js +1 -0
- package/dist/loader/index.d.ts +24 -0
- package/dist/loader/index.es2017.js +1 -0
- package/dist/loader/index.js +2 -0
- package/dist/loader/package.json +11 -0
- package/dist/types/app-root.d.ts +0 -0
- package/dist/types/components/ChatUIComponent/AddMember.d.ts +13 -0
- package/dist/types/components/ChatUIComponent/AudioBubble.d.ts +39 -0
- package/dist/types/components/ChatUIComponent/BlockChatList.d.ts +13 -0
- package/dist/types/components/ChatUIComponent/ChatDocumentMessageBubble.d.ts +5 -0
- package/dist/types/components/ChatUIComponent/ChatImageMessageBubble.d.ts +5 -0
- package/dist/types/components/ChatUIComponent/ChatOwnProfile/Profile.d.ts +42 -0
- package/dist/types/components/ChatUIComponent/ChatSidebar/ChatSidebar.d.ts +85 -0
- package/dist/types/components/ChatUIComponent/ChatVideoMessageBubble.d.ts +5 -0
- package/dist/types/components/ChatUIComponent/Footer/ChatFooter.d.ts +154 -0
- package/dist/types/components/ChatUIComponent/ForwardMessageList.d.ts +15 -0
- package/dist/types/components/ChatUIComponent/GroupCast.d.ts +26 -0
- package/dist/types/components/ChatUIComponent/Header/WebChatHeader.d.ts +45 -0
- package/dist/types/components/ChatUIComponent/ReactionContainer.d.ts +12 -0
- package/dist/types/components/ChatUIComponent/WebChatBody/WebChatBody.d.ts +120 -0
- package/dist/types/components/Login.d.ts +13 -0
- package/dist/types/components/Signup.d.ts +17 -0
- package/dist/types/components/chat-main.d.ts +15 -0
- package/dist/types/components/my-component/my-component.d.ts +16 -0
- package/dist/types/components/my-component/web-chat/WebchatRightSide.d.ts +42 -0
- package/dist/types/components/theme-provider.d.ts +44 -0
- package/dist/types/components.d.ts +838 -0
- package/dist/types/index.d.ts +37 -0
- package/dist/types/stencil-public-runtime.d.ts +1678 -0
- package/dist/types/store/conversation.d.ts +17 -0
- package/dist/types/store/group-members.d.ts +18 -0
- package/dist/types/store/unread-count.d.ts +10 -0
- package/dist/types/stories/Components/Toaster/toast-helper.d.ts +8 -0
- package/dist/types/types/ConversationDetailsTypes.d.ts +52 -0
- package/dist/types/utils/getFomattedDate.d.ts +1 -0
- package/dist/types/utils/utils.d.ts +1 -0
- package/package.json +89 -0
- package/readme.md +569 -0
|
@@ -0,0 +1,2884 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const index = require('./index-9afe62b6.js');
|
|
4
|
+
const Image = require('./Image-67c52acd.js');
|
|
5
|
+
const chatCreds = require('./chat-creds-f4cbf400.js');
|
|
6
|
+
const dialogDrawer = require('./dialog-drawer-9d04911c.js');
|
|
7
|
+
const groupMembers = require('./group-members-a60fb1cb.js');
|
|
8
|
+
const toastHelper = require('./toast-helper-defae4a5.js');
|
|
9
|
+
const MessageSearch = require('./MessageSearch-5fc9dc00.js');
|
|
10
|
+
const content = require('./content-eca5336c.js');
|
|
11
|
+
const groupcast = require('./groupcast-49dae5ab.js');
|
|
12
|
+
|
|
13
|
+
class ProfileSidebar extends Image.h {
|
|
14
|
+
static properties = {
|
|
15
|
+
userMetaData: { type: Object },
|
|
16
|
+
openAccounts: { type: Function },
|
|
17
|
+
openChat: { type: Function },
|
|
18
|
+
activeTab: { type: String },
|
|
19
|
+
isMqttConnected: { type: Boolean },
|
|
20
|
+
unreadConversationsCount: { type: Number },
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
constructor() {
|
|
24
|
+
super();
|
|
25
|
+
this.userMetaData = {};
|
|
26
|
+
this.activeTab = 'Chat';
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
static styles = Image.i`
|
|
30
|
+
:host {
|
|
31
|
+
display: block;
|
|
32
|
+
width: 68px;
|
|
33
|
+
min-width: 68px;
|
|
34
|
+
height: 100%;
|
|
35
|
+
flex-shrink: 0;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.profile-tab {
|
|
39
|
+
box-sizing: border-box;
|
|
40
|
+
min-width: 68px;
|
|
41
|
+
width: 68px;
|
|
42
|
+
transition: background-color var(--duration, 180ms) var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1));
|
|
43
|
+
display: flex;
|
|
44
|
+
align-items: center;
|
|
45
|
+
justify-content: space-between;
|
|
46
|
+
flex-direction: column;
|
|
47
|
+
height: 100%;
|
|
48
|
+
background-color: var(--sidebar-bg, #000000);
|
|
49
|
+
border-right: 1px solid var(--sidebar-border, #333333);
|
|
50
|
+
color: var(--sidebar-foreground, #ffffff);
|
|
51
|
+
padding: 16px 0 18px;
|
|
52
|
+
}
|
|
53
|
+
.chat-button {
|
|
54
|
+
width: 40px;
|
|
55
|
+
height: 40px;
|
|
56
|
+
display: flex;
|
|
57
|
+
align-items: center;
|
|
58
|
+
justify-content: center;
|
|
59
|
+
cursor: pointer;
|
|
60
|
+
position: relative;
|
|
61
|
+
border-radius: var(--radius-md, 12px);
|
|
62
|
+
color: var(--sidebar-foreground-secondary, #ffffff);
|
|
63
|
+
transition: background-color var(--duration, 180ms) var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)), transform 120ms var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1));
|
|
64
|
+
}
|
|
65
|
+
.chat-button:hover {
|
|
66
|
+
background-color: var(--sidebar-accent, color-mix(in srgb, #ffffff 10%, transparent));
|
|
67
|
+
}
|
|
68
|
+
.chat-button:active {
|
|
69
|
+
transform: scale(0.96);
|
|
70
|
+
}
|
|
71
|
+
.active-Chat {
|
|
72
|
+
background-color: var(--sidebar-accent, color-mix(in srgb, #ffffff 10%, transparent));
|
|
73
|
+
border-radius: var(--radius-md, 12px);
|
|
74
|
+
margin-top: 0;
|
|
75
|
+
}
|
|
76
|
+
.mqtt-indicator {
|
|
77
|
+
position: absolute;
|
|
78
|
+
right: 5px;
|
|
79
|
+
bottom: 7px;
|
|
80
|
+
width: 7px;
|
|
81
|
+
height: 7px;
|
|
82
|
+
border-radius: 50%;
|
|
83
|
+
filter: blur(0.3px);
|
|
84
|
+
}
|
|
85
|
+
.mqtt-indicator.connected {
|
|
86
|
+
background-color: var(--success, #0070f3);
|
|
87
|
+
}
|
|
88
|
+
.mqtt-indicator.disconnected {
|
|
89
|
+
background-color: var(--destructive, #ff0000);
|
|
90
|
+
}
|
|
91
|
+
.accounts-icon {
|
|
92
|
+
width: 22px;
|
|
93
|
+
height: 22px;
|
|
94
|
+
color: currentColor;
|
|
95
|
+
}
|
|
96
|
+
.top-buttons,
|
|
97
|
+
.bottom-buttons {
|
|
98
|
+
display: flex;
|
|
99
|
+
align-items: center;
|
|
100
|
+
justify-content: center;
|
|
101
|
+
flex-direction: column;
|
|
102
|
+
gap: 10px;
|
|
103
|
+
padding: 10px 0;
|
|
104
|
+
}
|
|
105
|
+
.unread-count {
|
|
106
|
+
position: absolute;
|
|
107
|
+
right: -2px;
|
|
108
|
+
top: -2px;
|
|
109
|
+
min-width: 16px;
|
|
110
|
+
height: 16px;
|
|
111
|
+
padding: 0 4px;
|
|
112
|
+
border-radius: var(--radius-pill, 999px);
|
|
113
|
+
background: var(--success, #0070f3);
|
|
114
|
+
display: flex;
|
|
115
|
+
align-items: center;
|
|
116
|
+
justify-content: center;
|
|
117
|
+
font-size: 10px;
|
|
118
|
+
font-weight: 600;
|
|
119
|
+
color: #ffffff;
|
|
120
|
+
}
|
|
121
|
+
@media (max-width: 768px) {
|
|
122
|
+
.profile-tab {
|
|
123
|
+
display: none;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
`;
|
|
127
|
+
|
|
128
|
+
renderChatIcon(active) {
|
|
129
|
+
return Image.ke`
|
|
130
|
+
<svg width="22" height="22" viewBox="0 0 24 24" fill="${active ? 'currentColor' : 'none'}" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
|
131
|
+
<path d="M21 15a4 4 0 0 1-4 4H8l-5 3V7a4 4 0 0 1 4-4h10a4 4 0 0 1 4 4z"></path>
|
|
132
|
+
</svg>
|
|
133
|
+
`;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
renderAccountsIcon() {
|
|
137
|
+
return Image.ke`
|
|
138
|
+
<svg class="accounts-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
|
139
|
+
<path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path>
|
|
140
|
+
<circle cx="9" cy="7" r="4"></circle>
|
|
141
|
+
<path d="M23 21v-2a4 4 0 0 0-3-3.87"></path>
|
|
142
|
+
<path d="M16 3.13a4 4 0 0 1 0 7.75"></path>
|
|
143
|
+
</svg>
|
|
144
|
+
`;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
render() {
|
|
148
|
+
return Image.ke`
|
|
149
|
+
<div class="profile-tab">
|
|
150
|
+
<div class="top-buttons">
|
|
151
|
+
<div class="${this.activeTab === 'Chat' ? 'active-Chat' : ''} chat-button" title="Chat" @click="${this.openChat}">
|
|
152
|
+
${this.renderChatIcon(this.activeTab === 'Chat')}
|
|
153
|
+
${this.unreadConversationsCount > 0
|
|
154
|
+
? Image.ke`<div class="unread-count">${this.unreadConversationsCount}</div>`
|
|
155
|
+
: ''}
|
|
156
|
+
</div>
|
|
157
|
+
</div>
|
|
158
|
+
|
|
159
|
+
<div class="bottom-buttons">
|
|
160
|
+
<div
|
|
161
|
+
class="${this.activeTab === 'Accounts' ? 'active-Chat' : ''} chat-button"
|
|
162
|
+
title="Accounts"
|
|
163
|
+
@click="${this.openAccounts}"
|
|
164
|
+
>
|
|
165
|
+
${this.renderAccountsIcon()}
|
|
166
|
+
${this.isMqttConnected
|
|
167
|
+
? Image.ke`<div class="mqtt-indicator connected"></div>`
|
|
168
|
+
: Image.ke`<div class="mqtt-indicator disconnected"></div>`}
|
|
169
|
+
</div>
|
|
170
|
+
</div>
|
|
171
|
+
</div>
|
|
172
|
+
`;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
customElements.define('profile-sidebar', ProfileSidebar);
|
|
177
|
+
|
|
178
|
+
class InstagramAccountsPanel extends Image.h {
|
|
179
|
+
static properties = {
|
|
180
|
+
agentUserId: { type: String },
|
|
181
|
+
defaultTheme: { type: String },
|
|
182
|
+
toggleTheme: { type: Function },
|
|
183
|
+
closeDrawer: { type: Function },
|
|
184
|
+
/** Optional callback (prefer CustomEvent for Stencil hosts). */
|
|
185
|
+
accountsChange: { type: Function },
|
|
186
|
+
/** When true, hide the X close (e.g. Instagram gate — no chat to return to). */
|
|
187
|
+
hideClose: { type: Boolean },
|
|
188
|
+
socialAccounts: { type: Array },
|
|
189
|
+
isSocialLoading: { type: Boolean },
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
constructor() {
|
|
193
|
+
super();
|
|
194
|
+
this.agentUserId = '';
|
|
195
|
+
this.defaultTheme = 'light';
|
|
196
|
+
this.toggleTheme = () => {};
|
|
197
|
+
this.closeDrawer = () => {};
|
|
198
|
+
this.accountsChange = null;
|
|
199
|
+
this.hideClose = false;
|
|
200
|
+
this.socialAccounts = [];
|
|
201
|
+
this.isSocialLoading = false;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
get connectedAccounts() {
|
|
205
|
+
return MessageSearch.getConnectedInstagramAccounts(this.socialAccounts);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
connectedCallback() {
|
|
209
|
+
super.connectedCallback();
|
|
210
|
+
this.loadSocialAccounts();
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
notifyAccountsChange(accounts = this.socialAccounts) {
|
|
214
|
+
const list = accounts || [];
|
|
215
|
+
// Stencil listens via onInstagramAccountsChange → event name "instagramAccountsChange"
|
|
216
|
+
this.dispatchEvent(
|
|
217
|
+
new CustomEvent('instagramAccountsChange', {
|
|
218
|
+
detail: list,
|
|
219
|
+
bubbles: true,
|
|
220
|
+
composed: true,
|
|
221
|
+
})
|
|
222
|
+
);
|
|
223
|
+
if (typeof this.accountsChange === 'function') {
|
|
224
|
+
this.accountsChange(list);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
async loadSocialAccounts() {
|
|
229
|
+
this.isSocialLoading = true;
|
|
230
|
+
try {
|
|
231
|
+
const data = await MessageSearch.getSocialAccounts({ platform: 'instagram' });
|
|
232
|
+
this.socialAccounts = data?.accounts || [];
|
|
233
|
+
this.notifyAccountsChange(this.socialAccounts);
|
|
234
|
+
} catch (error) {
|
|
235
|
+
console.error('Failed to load social accounts:', error);
|
|
236
|
+
this.socialAccounts = [];
|
|
237
|
+
this.notifyAccountsChange([]);
|
|
238
|
+
} finally {
|
|
239
|
+
this.isSocialLoading = false;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
formatSocialDate(ts) {
|
|
244
|
+
if (!ts) return '-';
|
|
245
|
+
try {
|
|
246
|
+
return new Date(ts).toLocaleDateString(undefined, {
|
|
247
|
+
day: 'numeric',
|
|
248
|
+
month: 'short',
|
|
249
|
+
year: 'numeric',
|
|
250
|
+
});
|
|
251
|
+
} catch {
|
|
252
|
+
return String(ts);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
async completeSocialCallback(payload) {
|
|
257
|
+
await MessageSearch.connectSocialAccountCallback({
|
|
258
|
+
platform: payload.platform || 'instagram',
|
|
259
|
+
username: payload.username || '',
|
|
260
|
+
displayName: payload.displayName || '',
|
|
261
|
+
loginMethod: 'instagram_login',
|
|
262
|
+
});
|
|
263
|
+
await this.loadSocialAccounts();
|
|
264
|
+
toastHelper.showToast({
|
|
265
|
+
message: 'Instagram connected',
|
|
266
|
+
type: 'success',
|
|
267
|
+
position: 'bottom-right',
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
async handleConnectInstagram() {
|
|
272
|
+
this.isSocialLoading = true;
|
|
273
|
+
try {
|
|
274
|
+
const data = await MessageSearch.connectSocialAccount({
|
|
275
|
+
platform: 'instagram',
|
|
276
|
+
redirectUrl: MessageSearch.getSocialRedirectUrl(),
|
|
277
|
+
loginMethod: 'instagram_login',
|
|
278
|
+
});
|
|
279
|
+
if (!data?.authUrl) throw new Error('No auth URL returned');
|
|
280
|
+
|
|
281
|
+
const result = await MessageSearch.openSocialAuthPopup(data.authUrl);
|
|
282
|
+
if (result?.redirected) return;
|
|
283
|
+
if (result?.cancelled) {
|
|
284
|
+
await this.loadSocialAccounts();
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
await this.completeSocialCallback(result || {});
|
|
288
|
+
} catch (error) {
|
|
289
|
+
console.error('Failed to connect Instagram:', error);
|
|
290
|
+
toastHelper.showToast({
|
|
291
|
+
message: error?.message || 'Failed to connect Instagram',
|
|
292
|
+
type: 'error',
|
|
293
|
+
position: 'bottom-right',
|
|
294
|
+
});
|
|
295
|
+
} finally {
|
|
296
|
+
this.isSocialLoading = false;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
handleDisconnectInstagram(accountId, username) {
|
|
301
|
+
dialogDrawer.drawerDialogService.openDialog('confirm-dialog', {
|
|
302
|
+
title: 'Disconnect Instagram',
|
|
303
|
+
description: `Disconnect @${username || 'this account'}?`,
|
|
304
|
+
handleConfirm: async () => {
|
|
305
|
+
dialogDrawer.drawerDialogService.closeDialog('confirm-dialog');
|
|
306
|
+
this.isSocialLoading = true;
|
|
307
|
+
try {
|
|
308
|
+
await MessageSearch.deleteSocialAccount({ accountId });
|
|
309
|
+
// API soft-disconnects (status=disconnected) — reload truth from server
|
|
310
|
+
await this.loadSocialAccounts();
|
|
311
|
+
toastHelper.showToast({
|
|
312
|
+
message: 'Instagram disconnected',
|
|
313
|
+
type: 'success',
|
|
314
|
+
position: 'bottom-right',
|
|
315
|
+
});
|
|
316
|
+
} catch (error) {
|
|
317
|
+
console.error('Failed to disconnect Instagram:', error);
|
|
318
|
+
toastHelper.showToast({
|
|
319
|
+
message: error?.message || 'Failed to disconnect Instagram',
|
|
320
|
+
type: 'error',
|
|
321
|
+
position: 'bottom-right',
|
|
322
|
+
});
|
|
323
|
+
} finally {
|
|
324
|
+
this.isSocialLoading = false;
|
|
325
|
+
}
|
|
326
|
+
},
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
renderSocialAccount(account) {
|
|
331
|
+
const name = account.displayName || account.username || 'Instagram';
|
|
332
|
+
const handle = account.username ? `@${account.username}` : '';
|
|
333
|
+
const isConnected = account.status === 'connected';
|
|
334
|
+
const gradId = `igGrad-${account.zernioAccountId || account.username || 'acc'}`;
|
|
335
|
+
|
|
336
|
+
return Image.ke`
|
|
337
|
+
<article class="ig-card">
|
|
338
|
+
<div class="ig-card-top">
|
|
339
|
+
<div class="ig-mark" aria-hidden="true">
|
|
340
|
+
<svg viewBox="0 0 24 24" width="22" height="22" fill="none">
|
|
341
|
+
<defs>
|
|
342
|
+
<linearGradient id=${gradId} x1="0%" y1="100%" x2="100%" y2="0%">
|
|
343
|
+
<stop offset="0%" stop-color="#f58529" />
|
|
344
|
+
<stop offset="50%" stop-color="#dd2a7b" />
|
|
345
|
+
<stop offset="100%" stop-color="#8134af" />
|
|
346
|
+
</linearGradient>
|
|
347
|
+
</defs>
|
|
348
|
+
<rect x="2" y="2" width="20" height="20" rx="5.5" stroke="url(#${gradId})" stroke-width="1.75" />
|
|
349
|
+
<circle cx="12" cy="12" r="4.25" stroke="url(#${gradId})" stroke-width="1.75" />
|
|
350
|
+
<circle cx="17.35" cy="6.65" r="1.15" fill="url(#${gradId})" />
|
|
351
|
+
</svg>
|
|
352
|
+
</div>
|
|
353
|
+
<div class="ig-identity">
|
|
354
|
+
<div class="ig-name-row">
|
|
355
|
+
<h3 class="ig-name">${name}</h3>
|
|
356
|
+
${isConnected
|
|
357
|
+
? Image.ke`<span class="ig-badge">Connected</span>`
|
|
358
|
+
: Image.ke`<span class="ig-badge is-muted">${account.status || 'Unknown'}</span>`}
|
|
359
|
+
</div>
|
|
360
|
+
${handle ? Image.ke`<p class="ig-handle">${handle}</p>` : null}
|
|
361
|
+
<p class="ig-connected-on">Connected ${this.formatSocialDate(account.connectedAt)}</p>
|
|
362
|
+
</div>
|
|
363
|
+
</div>
|
|
364
|
+
<div class="ig-actions">
|
|
365
|
+
${account.profileUrl
|
|
366
|
+
? Image.ke`<a class="ig-link" href=${account.profileUrl} target="_blank" rel="noopener noreferrer">View profile</a>`
|
|
367
|
+
: Image.ke`<span></span>`}
|
|
368
|
+
<button
|
|
369
|
+
type="button"
|
|
370
|
+
class="ig-disconnect"
|
|
371
|
+
@click=${() => this.handleDisconnectInstagram(account.zernioAccountId, account.username)}
|
|
372
|
+
>
|
|
373
|
+
Disconnect
|
|
374
|
+
</button>
|
|
375
|
+
</div>
|
|
376
|
+
</article>
|
|
377
|
+
`;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
renderConnectInstagram() {
|
|
381
|
+
return Image.ke`
|
|
382
|
+
<div class="ig-empty">
|
|
383
|
+
<p class="ig-empty-title">Connect Instagram to see chats</p>
|
|
384
|
+
<p class="ig-empty-copy">
|
|
385
|
+
Link your Instagram account first. After you disconnect, chats stay hidden until you connect again.
|
|
386
|
+
</p>
|
|
387
|
+
<button type="button" class="ig-connect" @click=${() => this.handleConnectInstagram()} ?disabled=${this.isSocialLoading}>
|
|
388
|
+
<span class="ig-mark" aria-hidden="true">
|
|
389
|
+
<svg viewBox="0 0 24 24" width="22" height="22" fill="none">
|
|
390
|
+
<defs>
|
|
391
|
+
<linearGradient id="igGradEmpty" x1="0%" y1="100%" x2="100%" y2="0%">
|
|
392
|
+
<stop offset="0%" stop-color="#f58529" />
|
|
393
|
+
<stop offset="50%" stop-color="#dd2a7b" />
|
|
394
|
+
<stop offset="100%" stop-color="#8134af" />
|
|
395
|
+
</linearGradient>
|
|
396
|
+
</defs>
|
|
397
|
+
<rect x="2" y="2" width="20" height="20" rx="5.5" stroke="url(#igGradEmpty)" stroke-width="1.75" />
|
|
398
|
+
<circle cx="12" cy="12" r="4.25" stroke="url(#igGradEmpty)" stroke-width="1.75" />
|
|
399
|
+
<circle cx="17.35" cy="6.65" r="1.15" fill="url(#igGradEmpty)" />
|
|
400
|
+
</svg>
|
|
401
|
+
</span>
|
|
402
|
+
<span class="ig-connect-copy">
|
|
403
|
+
<span class="ig-connect-title">${this.isSocialLoading ? 'Connecting…' : 'Connect Instagram'}</span>
|
|
404
|
+
<span class="ig-connect-sub">Link your business account to manage DMs here</span>
|
|
405
|
+
</span>
|
|
406
|
+
</button>
|
|
407
|
+
</div>
|
|
408
|
+
`;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
render() {
|
|
412
|
+
return Image.ke`
|
|
413
|
+
<div class="panel">
|
|
414
|
+
<div class="header">
|
|
415
|
+
${this.hideClose
|
|
416
|
+
? null
|
|
417
|
+
: Image.ke`<div class="close-btn" @click=${this.closeDrawer} title="Close">
|
|
418
|
+
<svg xmlns="http://www.w3.org/2000/svg" height="30" viewBox="0 -960 960 960" width="30" fill="var(--text-primary-color)">
|
|
419
|
+
<path d="m249-207-42-42 231-231-231-231 42-42 231 231 231-231 42 42-231 231 231 231-42 42-231-231-231 231Z" />
|
|
420
|
+
</svg>
|
|
421
|
+
</div>`}
|
|
422
|
+
<h1 class="title">Instagram connected accounts</h1>
|
|
423
|
+
</div>
|
|
424
|
+
|
|
425
|
+
<div class="body">
|
|
426
|
+
${this.isSocialLoading
|
|
427
|
+
? Image.ke`<div class="ig-skeleton" aria-hidden="true">
|
|
428
|
+
<div class="ig-skeleton-mark"></div>
|
|
429
|
+
<div class="ig-skeleton-lines">
|
|
430
|
+
<div class="ig-skeleton-line wide"></div>
|
|
431
|
+
<div class="ig-skeleton-line"></div>
|
|
432
|
+
</div>
|
|
433
|
+
</div>`
|
|
434
|
+
: this.connectedAccounts.length
|
|
435
|
+
? this.connectedAccounts.map(account => this.renderSocialAccount(account))
|
|
436
|
+
: this.renderConnectInstagram()}
|
|
437
|
+
</div>
|
|
438
|
+
|
|
439
|
+
<div class="bottom-actions">
|
|
440
|
+
<button type="button" class="action-button" @click=${this.toggleTheme}>
|
|
441
|
+
${this.defaultTheme === 'dark'
|
|
442
|
+
? Image.ke`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
|
443
|
+
<circle cx="12" cy="12" r="4"></circle>
|
|
444
|
+
<path d="M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"></path>
|
|
445
|
+
</svg>`
|
|
446
|
+
: Image.ke`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
|
447
|
+
<path d="M21 14.5A8.5 8.5 0 0 1 9.5 3 7 7 0 1 0 21 14.5z"></path>
|
|
448
|
+
</svg>`}
|
|
449
|
+
<span>${this.defaultTheme === 'dark' ? 'Light Theme' : 'Dark Theme'}</span>
|
|
450
|
+
</button>
|
|
451
|
+
</div>
|
|
452
|
+
</div>
|
|
453
|
+
`;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
static styles = Image.i`
|
|
457
|
+
:host {
|
|
458
|
+
display: block;
|
|
459
|
+
height: 100%;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
.panel {
|
|
463
|
+
padding: 16px 20px 24px;
|
|
464
|
+
display: flex;
|
|
465
|
+
flex-direction: column;
|
|
466
|
+
height: 100%;
|
|
467
|
+
box-sizing: border-box;
|
|
468
|
+
overflow-y: auto;
|
|
469
|
+
background-color: var(--bg-primary-color);
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
.header {
|
|
473
|
+
display: flex;
|
|
474
|
+
align-items: center;
|
|
475
|
+
margin-bottom: 24px;
|
|
476
|
+
flex-shrink: 0;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
.close-btn {
|
|
480
|
+
cursor: pointer;
|
|
481
|
+
display: flex;
|
|
482
|
+
align-items: center;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
.title {
|
|
486
|
+
font-size: 1.25rem;
|
|
487
|
+
font-weight: 600;
|
|
488
|
+
margin: 0 0 0 8px;
|
|
489
|
+
color: var(--text-primary-color);
|
|
490
|
+
line-height: 1.3;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
.body {
|
|
494
|
+
flex: 1;
|
|
495
|
+
min-height: 0;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
.ig-card {
|
|
499
|
+
display: flex;
|
|
500
|
+
flex-direction: column;
|
|
501
|
+
gap: 14px;
|
|
502
|
+
padding: 14px;
|
|
503
|
+
border-radius: 12px;
|
|
504
|
+
border: 1px solid var(--border-subtle, color-mix(in srgb, var(--text-primary-color) 10%, transparent));
|
|
505
|
+
background: color-mix(in srgb, var(--bg-secondary-color, #f5f5f5) 70%, transparent);
|
|
506
|
+
margin-bottom: 12px;
|
|
507
|
+
animation: ig-in 280ms cubic-bezier(0.16, 1, 0.3, 1);
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
@keyframes ig-in {
|
|
511
|
+
from {
|
|
512
|
+
opacity: 0;
|
|
513
|
+
transform: translateY(6px);
|
|
514
|
+
}
|
|
515
|
+
to {
|
|
516
|
+
opacity: 1;
|
|
517
|
+
transform: translateY(0);
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
@media (prefers-reduced-motion: reduce) {
|
|
522
|
+
.ig-card {
|
|
523
|
+
animation: none;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
.ig-card-top {
|
|
528
|
+
display: flex;
|
|
529
|
+
align-items: flex-start;
|
|
530
|
+
gap: 12px;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
.ig-mark {
|
|
534
|
+
width: 40px;
|
|
535
|
+
height: 40px;
|
|
536
|
+
border-radius: 12px;
|
|
537
|
+
display: grid;
|
|
538
|
+
place-items: center;
|
|
539
|
+
flex-shrink: 0;
|
|
540
|
+
background: color-mix(in srgb, #dd2a7b 8%, var(--bg-primary-color, #fff));
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
.ig-identity {
|
|
544
|
+
min-width: 0;
|
|
545
|
+
flex: 1;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
.ig-name-row {
|
|
549
|
+
display: flex;
|
|
550
|
+
align-items: center;
|
|
551
|
+
gap: 8px;
|
|
552
|
+
flex-wrap: wrap;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
.ig-name {
|
|
556
|
+
margin: 0;
|
|
557
|
+
font-size: 0.9375rem;
|
|
558
|
+
font-weight: 600;
|
|
559
|
+
color: var(--text-primary-color);
|
|
560
|
+
line-height: 1.3;
|
|
561
|
+
overflow: hidden;
|
|
562
|
+
text-overflow: ellipsis;
|
|
563
|
+
white-space: nowrap;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
.ig-badge {
|
|
567
|
+
font-size: 0.6875rem;
|
|
568
|
+
font-weight: 600;
|
|
569
|
+
letter-spacing: 0.01em;
|
|
570
|
+
padding: 3px 8px;
|
|
571
|
+
border-radius: 999px;
|
|
572
|
+
background: color-mix(in srgb, var(--success) 14%, transparent);
|
|
573
|
+
color: #15803d;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
.ig-badge.is-muted {
|
|
577
|
+
background: color-mix(in srgb, var(--text-secondary-color) 14%, transparent);
|
|
578
|
+
color: var(--text-secondary-color);
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
.ig-handle {
|
|
582
|
+
margin: 2px 0 0;
|
|
583
|
+
font-size: 0.8125rem;
|
|
584
|
+
color: var(--text-secondary-color);
|
|
585
|
+
overflow: hidden;
|
|
586
|
+
text-overflow: ellipsis;
|
|
587
|
+
white-space: nowrap;
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
.ig-connected-on {
|
|
591
|
+
margin: 6px 0 0;
|
|
592
|
+
font-size: 0.75rem;
|
|
593
|
+
color: var(--text-secondary-color);
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
.ig-actions {
|
|
597
|
+
display: flex;
|
|
598
|
+
align-items: center;
|
|
599
|
+
justify-content: space-between;
|
|
600
|
+
gap: 12px;
|
|
601
|
+
padding-top: 2px;
|
|
602
|
+
border-top: 1px solid var(--border-subtle, color-mix(in srgb, var(--text-primary-color) 8%, transparent));
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
.ig-link {
|
|
606
|
+
font-size: 0.8125rem;
|
|
607
|
+
font-weight: 500;
|
|
608
|
+
color: var(--base-color, var(--primary));
|
|
609
|
+
text-decoration: none;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
.ig-link:hover {
|
|
613
|
+
text-decoration: underline;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
.ig-disconnect {
|
|
617
|
+
background: none;
|
|
618
|
+
border: none;
|
|
619
|
+
cursor: pointer;
|
|
620
|
+
color: var(--text-danger-color, #e53935);
|
|
621
|
+
font-size: 0.8125rem;
|
|
622
|
+
font-weight: 500;
|
|
623
|
+
padding: 4px 0;
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
.ig-disconnect:hover {
|
|
627
|
+
opacity: 0.85;
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
.ig-connect {
|
|
631
|
+
width: 100%;
|
|
632
|
+
display: flex;
|
|
633
|
+
align-items: center;
|
|
634
|
+
gap: 12px;
|
|
635
|
+
text-align: left;
|
|
636
|
+
padding: 12px 14px;
|
|
637
|
+
border-radius: 12px;
|
|
638
|
+
border: 1px dashed color-mix(in srgb, var(--text-primary-color) 18%, transparent);
|
|
639
|
+
background: transparent;
|
|
640
|
+
cursor: pointer;
|
|
641
|
+
box-sizing: border-box;
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
.ig-empty {
|
|
645
|
+
display: flex;
|
|
646
|
+
flex-direction: column;
|
|
647
|
+
gap: 12px;
|
|
648
|
+
padding: 8px 0 4px;
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
.ig-empty-title {
|
|
652
|
+
margin: 0;
|
|
653
|
+
font-size: 1rem;
|
|
654
|
+
font-weight: 600;
|
|
655
|
+
color: var(--text-primary-color);
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
.ig-empty-copy {
|
|
659
|
+
margin: 0;
|
|
660
|
+
font-size: 0.875rem;
|
|
661
|
+
line-height: 1.45;
|
|
662
|
+
color: var(--text-secondary-color);
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
.ig-connect:hover {
|
|
666
|
+
background: var(--bg-secondary-color, #f5f5f5);
|
|
667
|
+
border-style: solid;
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
.ig-connect:disabled {
|
|
671
|
+
opacity: 0.6;
|
|
672
|
+
cursor: not-allowed;
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
.ig-connect-copy {
|
|
676
|
+
display: flex;
|
|
677
|
+
flex-direction: column;
|
|
678
|
+
gap: 2px;
|
|
679
|
+
min-width: 0;
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
.ig-connect-title {
|
|
683
|
+
font-size: 0.875rem;
|
|
684
|
+
font-weight: 600;
|
|
685
|
+
color: var(--text-primary-color);
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
.ig-connect-sub {
|
|
689
|
+
font-size: 0.75rem;
|
|
690
|
+
color: var(--text-secondary-color);
|
|
691
|
+
line-height: 1.35;
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
.ig-skeleton {
|
|
695
|
+
display: flex;
|
|
696
|
+
align-items: center;
|
|
697
|
+
gap: 12px;
|
|
698
|
+
padding: 14px;
|
|
699
|
+
border-radius: 12px;
|
|
700
|
+
border: 1px solid var(--border-subtle, color-mix(in srgb, var(--text-primary-color) 10%, transparent));
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
.ig-skeleton-mark {
|
|
704
|
+
width: 40px;
|
|
705
|
+
height: 40px;
|
|
706
|
+
border-radius: 12px;
|
|
707
|
+
background: color-mix(in srgb, var(--text-secondary-color) 12%, transparent);
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
.ig-skeleton-lines {
|
|
711
|
+
flex: 1;
|
|
712
|
+
display: flex;
|
|
713
|
+
flex-direction: column;
|
|
714
|
+
gap: 8px;
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
.ig-skeleton-line {
|
|
718
|
+
height: 10px;
|
|
719
|
+
width: 42%;
|
|
720
|
+
border-radius: 999px;
|
|
721
|
+
background: color-mix(in srgb, var(--text-secondary-color) 12%, transparent);
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
.ig-skeleton-line.wide {
|
|
725
|
+
width: 68%;
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
.bottom-actions {
|
|
729
|
+
margin-top: auto;
|
|
730
|
+
display: flex;
|
|
731
|
+
flex-direction: column;
|
|
732
|
+
gap: 2px;
|
|
733
|
+
padding-top: 16px;
|
|
734
|
+
border-top: 1px solid var(--border-subtle, #eaeaea);
|
|
735
|
+
flex-shrink: 0;
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
.action-button {
|
|
739
|
+
display: flex;
|
|
740
|
+
align-items: center;
|
|
741
|
+
gap: 12px;
|
|
742
|
+
background: none;
|
|
743
|
+
border: none;
|
|
744
|
+
cursor: pointer;
|
|
745
|
+
color: var(--text-primary-color, #111111);
|
|
746
|
+
font-size: 15px;
|
|
747
|
+
line-height: 1.3;
|
|
748
|
+
padding: 12px 8px;
|
|
749
|
+
text-align: left;
|
|
750
|
+
width: 100%;
|
|
751
|
+
box-sizing: border-box;
|
|
752
|
+
border-radius: 8px;
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
.action-button:hover {
|
|
756
|
+
background-color: var(--bg-secondary-color, #f5f5f5);
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
.action-button svg {
|
|
760
|
+
width: 18px;
|
|
761
|
+
height: 18px;
|
|
762
|
+
min-width: 18px;
|
|
763
|
+
flex-shrink: 0;
|
|
764
|
+
stroke: currentColor;
|
|
765
|
+
}
|
|
766
|
+
`;
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
customElements.define('instagram-accounts-panel', InstagramAccountsPanel);
|
|
770
|
+
|
|
771
|
+
class ChatLoadingPlaceholder extends Image.h {
|
|
772
|
+
static properties = {
|
|
773
|
+
progress: { type: Number },
|
|
774
|
+
loadingStatus: { type: String }
|
|
775
|
+
};
|
|
776
|
+
|
|
777
|
+
static styles = Image.i`
|
|
778
|
+
.loading-container {
|
|
779
|
+
position: fixed;
|
|
780
|
+
top: 0;
|
|
781
|
+
left: 0;
|
|
782
|
+
width: 100%;
|
|
783
|
+
height: 100%;
|
|
784
|
+
background-color: var(--bg-secondary-color);
|
|
785
|
+
display: flex;
|
|
786
|
+
flex-direction: column;
|
|
787
|
+
justify-content: center;
|
|
788
|
+
align-items: center;
|
|
789
|
+
z-index: 1000;
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
.whatsapp-logo {
|
|
793
|
+
margin-bottom: 30px;
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
.progress-container {
|
|
797
|
+
width: 250px;
|
|
798
|
+
height: 4px;
|
|
799
|
+
background-color: var(--bg-primary-color);
|
|
800
|
+
border-radius: 2px;
|
|
801
|
+
margin-bottom: 10px;
|
|
802
|
+
overflow: hidden;
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
.progress-bar {
|
|
806
|
+
height: 100%;
|
|
807
|
+
background-color: var(--base-color);
|
|
808
|
+
border-radius: 2px;
|
|
809
|
+
transition: width 0.3s ease;
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
.progress-text {
|
|
813
|
+
font-size: 14px;
|
|
814
|
+
color: var(--text-primary-color);
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
.status-text {
|
|
818
|
+
margin-top: 15px;
|
|
819
|
+
font-size: 16px;
|
|
820
|
+
color: var(--text-secondary-color);
|
|
821
|
+
}
|
|
822
|
+
`;
|
|
823
|
+
|
|
824
|
+
constructor() {
|
|
825
|
+
super();
|
|
826
|
+
this.progress = 0;
|
|
827
|
+
this.loadingStatus = 'Initializing...';
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
render() {
|
|
831
|
+
return Image.ke`
|
|
832
|
+
<div class="loading-container">
|
|
833
|
+
|
|
834
|
+
<div class="progress-container">
|
|
835
|
+
<div class="progress-bar" style="width: ${this.progress}%"></div>
|
|
836
|
+
</div>
|
|
837
|
+
<div class="progress-text">${this.progress}%</div>
|
|
838
|
+
<div class="status-text">${content.WEB_CONTENT.PLACEHOLDER_CONTENT.LOADING}</div>
|
|
839
|
+
</div>
|
|
840
|
+
`;
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
// Define the element
|
|
845
|
+
customElements.define('chat-loading-placeholder', ChatLoadingPlaceholder);
|
|
846
|
+
|
|
847
|
+
const getTotalUnreadConversationsCount = async () => {
|
|
848
|
+
const response = await Image.M.getInstance().Conversation.getConversationUnreadCount();
|
|
849
|
+
return response?.count;
|
|
850
|
+
};
|
|
851
|
+
|
|
852
|
+
const { state, onChange } = MessageSearch.createStore({
|
|
853
|
+
totalUnreadCount: 0
|
|
854
|
+
});
|
|
855
|
+
const unreadCountStore = {
|
|
856
|
+
state,
|
|
857
|
+
// Update total unread count
|
|
858
|
+
updateTotalUnreadCount(count) {
|
|
859
|
+
state.totalUnreadCount = count;
|
|
860
|
+
},
|
|
861
|
+
// Get current unread count
|
|
862
|
+
getTotalUnreadCount() {
|
|
863
|
+
return state.totalUnreadCount;
|
|
864
|
+
},
|
|
865
|
+
// Subscribe to changes
|
|
866
|
+
onChange: onChange
|
|
867
|
+
};
|
|
868
|
+
|
|
869
|
+
const webChatCss = ":host{display:flex;flex:1;font-family:var(--font-sans);color:var(--text-primary-color)}web-chat{display:flex;flex:1}.isometrik-quickchat{display:flex;height:100dvh;width:100%;min-height:0;overflow:hidden;background:var(--bg-primary-color);color:var(--text-primary-color)}.isometrik-quickchat.is-resizing{cursor:col-resize;user-select:none}.isometrik-quickchat.is-resizing *{cursor:col-resize !important;user-select:none !important}.chat-sidebar-container{position:relative;flex:0 0 calc(68px + var(--sidebar-width));width:calc(68px + var(--sidebar-width));max-width:calc(68px + var(--sidebar-width));height:100%;min-height:0;min-width:0;overflow:visible;transition:transform var(--duration) var(--ease-out);border-right:1px solid var(--border-subtle);display:flex;flex-direction:row;background-color:var(--bg-primary-color);box-shadow:none;z-index:2}.isometrik-quickchat.is-instagram-gate .chat-sidebar-container.is-full-gate{flex:1 1 auto;width:100%;max-width:none;border-right:none}.isometrik-quickchat.is-instagram-gate .sidebar-tab{max-width:480px;margin:0 auto;width:100%}.chat-sidebar-container.is-resizing{transition:none}.sidebar-tab{flex:1 1 auto;width:auto;height:100%;min-height:0;min-width:0;overflow:hidden;background-color:var(--bg-primary-color)}.sidebar-resize-handle{position:absolute;top:0;right:-5px;width:10px;height:100%;z-index:30;cursor:col-resize;display:flex;align-items:center;justify-content:center;touch-action:none}.sidebar-resize-handle::before{content:'';position:absolute;top:0;bottom:0;left:50%;width:1px;transform:translateX(-50%);background:transparent;transition:background-color var(--duration) var(--ease-out), width 120ms var(--ease-out)}.sidebar-resize-grip{width:3px;height:32px;border-radius:999px;background:var(--border, #eaeaea);opacity:0;transition:opacity var(--duration) var(--ease-out), background-color var(--duration) var(--ease-out), height 120ms var(--ease-out);pointer-events:none}.sidebar-resize-handle:hover::before,.sidebar-resize-handle.active::before{width:2px;background:var(--text-primary-color)}.sidebar-resize-handle:hover .sidebar-resize-grip,.sidebar-resize-handle.active .sidebar-resize-grip{opacity:1;background:var(--text-primary-color);height:40px}.chat-body-container{flex:1;display:flex;flex-direction:column;min-width:0;background-color:var(--bg-secondary-color)}.noChatSelectedPlaceholder{height:100%;width:100%;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:0;padding:40px 24px;color:var(--text-secondary-color);background-image:radial-gradient(circle, var(--border-subtle) 1px, transparent 1.2px);background-size:22px 22px}.empty-mark{position:relative;width:92px;height:68px;margin-bottom:24px}.empty-mark span{position:absolute;width:56px;height:38px;background:var(--primary, #000000)}.empty-mark span:first-child{left:0;top:0;opacity:0.18;border-radius:18px 18px 4px 18px}.empty-mark span:last-child{right:0;bottom:0;border-radius:18px 18px 18px 4px}.noChatSelectedPlaceholder h2{margin:0;font-size:24px;font-weight:600;letter-spacing:-0.04em;color:var(--text-primary-color);line-height:1.15}.noChatSelectedPlaceholder p{margin:8px 0 0;font-size:14px;line-height:1.5;max-width:34ch;text-align:center;color:var(--text-secondary-color)}.empty-cta{margin-top:20px;border:none;cursor:pointer;font-family:inherit;font-size:13px;font-weight:600;color:var(--primary-foreground, #ffffff);background:var(--primary, #000000);border-radius:var(--radius-pill);padding:10px 18px;transition:transform 120ms var(--ease-out), filter 180ms var(--ease-out)}.empty-cta:hover{filter:brightness(1.06)}.empty-cta:active{transform:scale(0.98)}.chat-sidebar-right{flex:0 0 var(--sidebar-width);width:var(--sidebar-width);max-width:var(--sidebar-width);min-width:0;overflow:hidden;transition:transform var(--duration) var(--ease-out);border-left:1px solid var(--border-subtle);background-color:var(--bg-primary-color)}.loaderoverlay{width:100%;position:absolute;margin:auto;background:var(--overlay-color);z-index:1400}.loadingPlaceholder{height:100%;width:100%;z-index:12839283}.back-button{display:none;padding:0;background:none;border:none;cursor:pointer;align-items:center;gap:4px}spinner-loader{display:flex;height:100dvh}.blockMessageContainer{text-align:center;padding:16px 0;margin:0;background-color:var(--bg-primary-color);color:var(--text-secondary-color);font-size:var(--text-secondary-size);border-top:1px solid var(--border-subtle)}@media (max-width: 768px){.isometrik-quickchat{position:relative;overflow:hidden}.sidebar-resize-handle{display:none}.chat-sidebar-right{width:100%;max-width:none;flex:none;position:fixed;z-index:10;border-right:1px solid var(--border-subtle)}.chat-sidebar-container{width:100%;height:100%;position:absolute;left:0;top:0;transform:translateX(0);transition:transform var(--duration) var(--ease-out);z-index:2;flex:none;max-width:none;min-width:100% !important;overflow:hidden;box-shadow:none}.chat-sidebar-container.hidden{transform:translateX(-100%)}.chat-body-container{width:100%;height:100%;position:absolute;left:0;top:0;transform:translateX(100%);transition:transform var(--duration) var(--ease-out);z-index:1}.chat-body-container.hidden{transform:translateX(0)}.chat-body-container.show{transform:translateX(0);z-index:3}.back-button{display:flex;align-items:center;justify-content:center;position:absolute;right:3rem;z-index:10;top:2.3rem}}";
|
|
870
|
+
const WebChatStyle0 = webChatCss;
|
|
871
|
+
|
|
872
|
+
const WebChat = class {
|
|
873
|
+
constructor(hostRef) {
|
|
874
|
+
index.registerInstance(this, hostRef);
|
|
875
|
+
this.unreadMessageCountUpdated = index.createEvent(this, "unreadMessageCountUpdated", 7);
|
|
876
|
+
this.conversationNotFound = index.createEvent(this, "conversationNotFound", 7);
|
|
877
|
+
this.messageReadStatusUpdated = index.createEvent(this, "messageReadStatusUpdated", 7);
|
|
878
|
+
this.chatBodyRef = null;
|
|
879
|
+
this.conversationDetailsInterval = null;
|
|
880
|
+
this.SIDEBAR_MIN = 280;
|
|
881
|
+
this.SIDEBAR_MAX = 560;
|
|
882
|
+
this.SIDEBAR_RAIL = 68;
|
|
883
|
+
this.SIDEBAR_WIDTH_KEY = 'isometrik-sidebar-list-width';
|
|
884
|
+
this.sidebarResizeOriginLeft = 0;
|
|
885
|
+
this.clampSidebarWidth = (width) => {
|
|
886
|
+
const maxByViewport = Math.floor(window.innerWidth * 0.55) - this.SIDEBAR_RAIL;
|
|
887
|
+
const max = Math.min(this.SIDEBAR_MAX, Math.max(this.SIDEBAR_MIN, maxByViewport));
|
|
888
|
+
return Math.min(Math.max(Math.round(width), this.SIDEBAR_MIN), max);
|
|
889
|
+
};
|
|
890
|
+
this.onSidebarResizeMove = (e) => {
|
|
891
|
+
if (!this.isResizingSidebar)
|
|
892
|
+
return;
|
|
893
|
+
this.sidebarListWidth = this.clampSidebarWidth(e.clientX - this.sidebarResizeOriginLeft - this.SIDEBAR_RAIL);
|
|
894
|
+
};
|
|
895
|
+
this.onSidebarResizeEnd = () => {
|
|
896
|
+
if (!this.isResizingSidebar)
|
|
897
|
+
return;
|
|
898
|
+
this.isResizingSidebar = false;
|
|
899
|
+
try {
|
|
900
|
+
localStorage.setItem(this.SIDEBAR_WIDTH_KEY, String(this.sidebarListWidth));
|
|
901
|
+
}
|
|
902
|
+
catch (_) { }
|
|
903
|
+
window.removeEventListener('pointermove', this.onSidebarResizeMove);
|
|
904
|
+
window.removeEventListener('pointerup', this.onSidebarResizeEnd);
|
|
905
|
+
};
|
|
906
|
+
this.startSidebarResize = (e) => {
|
|
907
|
+
var _a;
|
|
908
|
+
if (this.isMobileView)
|
|
909
|
+
return;
|
|
910
|
+
e.preventDefault();
|
|
911
|
+
const handle = e.currentTarget;
|
|
912
|
+
const sidebar = handle.closest('.chat-sidebar-container');
|
|
913
|
+
this.sidebarResizeOriginLeft = (_a = sidebar === null || sidebar === void 0 ? void 0 : sidebar.getBoundingClientRect().left) !== null && _a !== void 0 ? _a : 0;
|
|
914
|
+
this.isResizingSidebar = true;
|
|
915
|
+
window.addEventListener('pointermove', this.onSidebarResizeMove);
|
|
916
|
+
window.addEventListener('pointerup', this.onSidebarResizeEnd);
|
|
917
|
+
};
|
|
918
|
+
this.handleReplyMessage = (e) => {
|
|
919
|
+
this.replyMessage = e.detail;
|
|
920
|
+
};
|
|
921
|
+
this.handleremoveReplyMessage = () => {
|
|
922
|
+
this.replyMessage = null;
|
|
923
|
+
};
|
|
924
|
+
this.handleMessageSearchTextChange = (e) => {
|
|
925
|
+
this.messageSearchText = e.detail;
|
|
926
|
+
};
|
|
927
|
+
this.getCookie = (name) => {
|
|
928
|
+
const value = `; ${document.cookie}`;
|
|
929
|
+
const parts = value.split(`; ${name}=`);
|
|
930
|
+
if (parts.length === 2)
|
|
931
|
+
return parts.pop().split(';').shift();
|
|
932
|
+
};
|
|
933
|
+
// Auth from chat-creds (no login UI)
|
|
934
|
+
this.userTokenFromCookie = chatCreds.CHAT_CREDS.userToken;
|
|
935
|
+
this.isometrikUserIdFromCookie = chatCreds.CHAT_CREDS.isometrikUserId;
|
|
936
|
+
this.clearConversationState = () => {
|
|
937
|
+
this.allConversationList = [];
|
|
938
|
+
this.selectedConversationId = null;
|
|
939
|
+
this.initialConversationIdFromURL = '';
|
|
940
|
+
this.allMessages = [];
|
|
941
|
+
this.selectConversationMessages = [];
|
|
942
|
+
this.conversationMetaData = {};
|
|
943
|
+
this.selctConversationMetaData = {};
|
|
944
|
+
this.allAttachments = [];
|
|
945
|
+
this.selectConverSationAttachments = [];
|
|
946
|
+
this.unreadConversationsCount = 0;
|
|
947
|
+
this.hasMoreConversations = false;
|
|
948
|
+
this.isContactInfoOpen = false;
|
|
949
|
+
this.isProfileInfoOpen = false;
|
|
950
|
+
this.showRightSideBar = false;
|
|
951
|
+
unreadCountStore.updateTotalUnreadCount(0);
|
|
952
|
+
if (typeof window !== 'undefined') {
|
|
953
|
+
const url = new URL(window.location.href);
|
|
954
|
+
url.searchParams.delete('conversation');
|
|
955
|
+
url.searchParams.delete('groupcast');
|
|
956
|
+
window.history.replaceState({}, '', url);
|
|
957
|
+
}
|
|
958
|
+
};
|
|
959
|
+
this.applyInstagramAccounts = (accounts = [], options = {}) => {
|
|
960
|
+
const connected = MessageSearch.hasConnectedInstagramAccounts(accounts);
|
|
961
|
+
const wasConnected = this.isInstagramConnected;
|
|
962
|
+
this.isInstagramConnected = connected;
|
|
963
|
+
if (!connected) {
|
|
964
|
+
this.clearConversationState();
|
|
965
|
+
this.activeTab = 'Accounts';
|
|
966
|
+
return;
|
|
967
|
+
}
|
|
968
|
+
// After a live connect (not initial boot), switch to Chat and fetch conversations.
|
|
969
|
+
if (!options.bootstrap && !wasConnected) {
|
|
970
|
+
this.activeTab = 'Chat';
|
|
971
|
+
void this.loadConversationsAfterInstagramConnect();
|
|
972
|
+
}
|
|
973
|
+
};
|
|
974
|
+
this.refreshInstagramConnectionGate = async () => {
|
|
975
|
+
const data = await MessageSearch.getSocialAccounts({ platform: 'instagram' });
|
|
976
|
+
this.applyInstagramAccounts((data === null || data === void 0 ? void 0 : data.accounts) || [], { bootstrap: true });
|
|
977
|
+
};
|
|
978
|
+
this.loadConversationsAfterInstagramConnect = async () => {
|
|
979
|
+
if (!this.isInstagramConnected)
|
|
980
|
+
return;
|
|
981
|
+
try {
|
|
982
|
+
this.isConversationLoading = true;
|
|
983
|
+
const unreadCount = await getTotalUnreadConversationsCount();
|
|
984
|
+
unreadCountStore.updateTotalUnreadCount(unreadCount);
|
|
985
|
+
this.unreadConversationsCount = unreadCount;
|
|
986
|
+
unreadCountStore.onChange('totalUnreadCount', value => {
|
|
987
|
+
this.unreadConversationsCount = value;
|
|
988
|
+
});
|
|
989
|
+
await this.getConversations();
|
|
990
|
+
}
|
|
991
|
+
catch (error) {
|
|
992
|
+
console.error('Failed to load conversations after Instagram connect:', error);
|
|
993
|
+
}
|
|
994
|
+
finally {
|
|
995
|
+
this.isConversationLoading = false;
|
|
996
|
+
}
|
|
997
|
+
};
|
|
998
|
+
this.handleInstagramAccountsChange = (accounts = []) => {
|
|
999
|
+
this.applyInstagramAccounts(accounts);
|
|
1000
|
+
};
|
|
1001
|
+
this.openChatTab = () => {
|
|
1002
|
+
if (this.isInstagramConnected) {
|
|
1003
|
+
this.activeTab = 'Chat';
|
|
1004
|
+
return;
|
|
1005
|
+
}
|
|
1006
|
+
this.activeTab = 'Accounts';
|
|
1007
|
+
};
|
|
1008
|
+
this.closeAccountsDrawer = () => {
|
|
1009
|
+
this.activeTab = this.isInstagramConnected ? 'Chat' : 'Accounts';
|
|
1010
|
+
};
|
|
1011
|
+
/// for get user details start
|
|
1012
|
+
this.getUserDetails = async () => {
|
|
1013
|
+
var _a, _b, _c;
|
|
1014
|
+
try {
|
|
1015
|
+
const res = await Image.M.getInstance().user.getUserDetails();
|
|
1016
|
+
const userDetails = {
|
|
1017
|
+
//@ts-ignore
|
|
1018
|
+
userId: (res === null || res === void 0 ? void 0 : res.userId) || '',
|
|
1019
|
+
userIdentifier: (res === null || res === void 0 ? void 0 : res.userIdentifier) || '',
|
|
1020
|
+
//@ts-ignore
|
|
1021
|
+
firstName: ((_a = res === null || res === void 0 ? void 0 : res.metaData) === null || _a === void 0 ? void 0 : _a.firstName) || '',
|
|
1022
|
+
//@ts-ignore
|
|
1023
|
+
lastName: ((_b = res === null || res === void 0 ? void 0 : res.metaData) === null || _b === void 0 ? void 0 : _b.lastName) || '',
|
|
1024
|
+
updatedAt: (res === null || res === void 0 ? void 0 : res.updatedAt) || '',
|
|
1025
|
+
userName: (res === null || res === void 0 ? void 0 : res.userName) || '',
|
|
1026
|
+
online: (res === null || res === void 0 ? void 0 : res.online) || '',
|
|
1027
|
+
userProfileImageUrl: (res === null || res === void 0 ? void 0 : res.userProfileImageUrl) || '',
|
|
1028
|
+
//@ts-ignore
|
|
1029
|
+
profilePic: ((_c = res === null || res === void 0 ? void 0 : res.metaData) === null || _c === void 0 ? void 0 : _c.profilePic) || '',
|
|
1030
|
+
};
|
|
1031
|
+
this.userMetaData = userDetails;
|
|
1032
|
+
}
|
|
1033
|
+
catch (error) {
|
|
1034
|
+
console.error(error, 'getUserDetails fetching error');
|
|
1035
|
+
}
|
|
1036
|
+
};
|
|
1037
|
+
/// for get user details end
|
|
1038
|
+
/** Completes Instagram OAuth when redirected back with zernioAccountId. */
|
|
1039
|
+
this.handleSocialConnectCallback = async () => {
|
|
1040
|
+
// Popup return: hand off to opener and close this window
|
|
1041
|
+
if (MessageSearch.notifyOpenerIfSocialPopupCallback())
|
|
1042
|
+
return;
|
|
1043
|
+
const payload = MessageSearch.parseSocialCallbackParams();
|
|
1044
|
+
if (!payload)
|
|
1045
|
+
return;
|
|
1046
|
+
try {
|
|
1047
|
+
await MessageSearch.connectSocialAccountCallback({
|
|
1048
|
+
platform: payload.platform || 'instagram',
|
|
1049
|
+
username: payload.username || '',
|
|
1050
|
+
displayName: payload.displayName || '',
|
|
1051
|
+
loginMethod: 'instagram_login',
|
|
1052
|
+
});
|
|
1053
|
+
toastHelper.showToast({
|
|
1054
|
+
message: 'Instagram connected',
|
|
1055
|
+
type: 'success',
|
|
1056
|
+
position: 'bottom-right',
|
|
1057
|
+
});
|
|
1058
|
+
this.activeTab = 'Chat';
|
|
1059
|
+
}
|
|
1060
|
+
catch (error) {
|
|
1061
|
+
console.error('Social connect callback failed:', error);
|
|
1062
|
+
toastHelper.showToast({
|
|
1063
|
+
message: (error === null || error === void 0 ? void 0 : error.message) || 'Failed to connect Instagram',
|
|
1064
|
+
type: 'error',
|
|
1065
|
+
position: 'bottom-right',
|
|
1066
|
+
});
|
|
1067
|
+
}
|
|
1068
|
+
finally {
|
|
1069
|
+
MessageSearch.clearSocialCallbackParamsFromUrl();
|
|
1070
|
+
}
|
|
1071
|
+
};
|
|
1072
|
+
//get all Conversation
|
|
1073
|
+
this.getConversations = async (skip = 0, searchTag = null, showLoader = false) => {
|
|
1074
|
+
this.hasMoreConversations = true;
|
|
1075
|
+
const queryParamsGetConversations = {
|
|
1076
|
+
limit: 20,
|
|
1077
|
+
skip: skip,
|
|
1078
|
+
includeMembers: true,
|
|
1079
|
+
};
|
|
1080
|
+
if (searchTag) {
|
|
1081
|
+
queryParamsGetConversations['searchTag'] = searchTag;
|
|
1082
|
+
}
|
|
1083
|
+
if (showLoader) {
|
|
1084
|
+
this.isLoadingConversationList = true;
|
|
1085
|
+
}
|
|
1086
|
+
try {
|
|
1087
|
+
const res = await Image.M.getInstance().Conversation.getConversations(queryParamsGetConversations);
|
|
1088
|
+
const uniqueConversations = res.conversations.filter(newConv => !this.allConversationList.some(existingConv => existingConv.conversationId === newConv.conversationId));
|
|
1089
|
+
this.allConversationList = [...this.allConversationList, ...uniqueConversations];
|
|
1090
|
+
}
|
|
1091
|
+
catch (error) {
|
|
1092
|
+
console.error('getConversations fetching error', error);
|
|
1093
|
+
if ((error === null || error === void 0 ? void 0 : error.status) === 404 || (error === null || error === void 0 ? void 0 : error.statusCode) === 404) {
|
|
1094
|
+
this.hasMoreConversations = false;
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
finally {
|
|
1098
|
+
this.isLoadingConversationList = false;
|
|
1099
|
+
}
|
|
1100
|
+
};
|
|
1101
|
+
//get all Conversation end
|
|
1102
|
+
this.getGroupCastConversationDetails = async (groupcastId) => {
|
|
1103
|
+
var _a;
|
|
1104
|
+
try {
|
|
1105
|
+
const res = await groupcast.getGroupcast({ ids: groupcastId });
|
|
1106
|
+
this.conversationMetaData = (_a = res === null || res === void 0 ? void 0 : res.groupcasts) === null || _a === void 0 ? void 0 : _a[0];
|
|
1107
|
+
}
|
|
1108
|
+
catch (error) {
|
|
1109
|
+
console.error(error, 'GroupCast details fetching error');
|
|
1110
|
+
}
|
|
1111
|
+
};
|
|
1112
|
+
this.getUserConversationDetails = async (conversationId) => {
|
|
1113
|
+
const queryParamsGetConversationDetails = {
|
|
1114
|
+
conversationId: conversationId || this.selectedConversationId,
|
|
1115
|
+
includeMembers: true,
|
|
1116
|
+
};
|
|
1117
|
+
try {
|
|
1118
|
+
const res = await Image.M.getInstance().Conversation.getConversationDetails(queryParamsGetConversationDetails, conversationId || this.selectedConversationId);
|
|
1119
|
+
if (conversationId) {
|
|
1120
|
+
this.selctConversationMetaData = res.conversationDetails;
|
|
1121
|
+
}
|
|
1122
|
+
else {
|
|
1123
|
+
this.conversationMetaData = res.conversationDetails;
|
|
1124
|
+
}
|
|
1125
|
+
return res.conversationDetails;
|
|
1126
|
+
}
|
|
1127
|
+
catch (error) {
|
|
1128
|
+
console.error(error, 'getConversationDetails fetching error');
|
|
1129
|
+
}
|
|
1130
|
+
};
|
|
1131
|
+
/// for get all messages start
|
|
1132
|
+
this.getMessages = async (skip, conversationId) => {
|
|
1133
|
+
this.isMessagesLoading = true;
|
|
1134
|
+
this.isScrollToTop = true;
|
|
1135
|
+
this.isMessageLimitEnd = false;
|
|
1136
|
+
try {
|
|
1137
|
+
const res = await Image.M.getInstance().message.getMessages({ conversationId: conversationId || this.selectedConversationId, limit: 20, skip: skip });
|
|
1138
|
+
if (skip == 0) {
|
|
1139
|
+
if (conversationId) {
|
|
1140
|
+
this.selectConversationMessages = [...res.messages.reverse()];
|
|
1141
|
+
}
|
|
1142
|
+
else {
|
|
1143
|
+
this.allMessages = [...res.messages.reverse()];
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
else {
|
|
1147
|
+
this.allMessages = [...res.messages.reverse(), ...this.allMessages];
|
|
1148
|
+
}
|
|
1149
|
+
this.allMessages.forEach(message => {
|
|
1150
|
+
if (message.hasOwnProperty('attachments') && message.attachments !== null) ;
|
|
1151
|
+
});
|
|
1152
|
+
}
|
|
1153
|
+
catch (error) {
|
|
1154
|
+
if ((error === null || error === void 0 ? void 0 : error.status) === 404 || (error === null || error === void 0 ? void 0 : error.statusCode) === 404) {
|
|
1155
|
+
this.isMessageLimitEnd = true;
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
finally {
|
|
1159
|
+
this.isMessagesLoading = false;
|
|
1160
|
+
}
|
|
1161
|
+
};
|
|
1162
|
+
///for get all messages end
|
|
1163
|
+
//for get unread Messages Count
|
|
1164
|
+
this.getMessageUnreadCount = async () => {
|
|
1165
|
+
try {
|
|
1166
|
+
const res = await Image.M.getInstance().message.getUnreadCount({ converationId: this.selectedConversationId });
|
|
1167
|
+
this.unreadMessageCountFromApi = res.count; // Update state with unread count
|
|
1168
|
+
}
|
|
1169
|
+
catch (error) {
|
|
1170
|
+
console.error('Error while getting unread count', error);
|
|
1171
|
+
}
|
|
1172
|
+
};
|
|
1173
|
+
// for get unread Messages Count END
|
|
1174
|
+
this.getMessagesByQuery = async (searchText) => {
|
|
1175
|
+
const queryParamForMessagesSearch = {
|
|
1176
|
+
conversationId: this.selectedConversationId,
|
|
1177
|
+
searchTag: searchText,
|
|
1178
|
+
skip: 0,
|
|
1179
|
+
limit: 20,
|
|
1180
|
+
};
|
|
1181
|
+
this.isLoadingMessage = true;
|
|
1182
|
+
try {
|
|
1183
|
+
const res = await Image.M.getInstance().message.getMessages(queryParamForMessagesSearch);
|
|
1184
|
+
this.searchedMessageDetails = res.messages;
|
|
1185
|
+
}
|
|
1186
|
+
catch (error) {
|
|
1187
|
+
this.searchedMessageDetails = [];
|
|
1188
|
+
console.error('Error while searching messages in a chat', error);
|
|
1189
|
+
}
|
|
1190
|
+
finally {
|
|
1191
|
+
this.isLoadingMessage = false;
|
|
1192
|
+
}
|
|
1193
|
+
};
|
|
1194
|
+
this.getAllLinks = async (selectedConversationIDForAttachments) => {
|
|
1195
|
+
const queryParamForGetAllAttachments = {
|
|
1196
|
+
conversationId: selectedConversationIDForAttachments,
|
|
1197
|
+
customTypes: 'AttachmentMessage:Link',
|
|
1198
|
+
};
|
|
1199
|
+
try {
|
|
1200
|
+
const res = await Image.M.getInstance().message.getMessages(queryParamForGetAllAttachments);
|
|
1201
|
+
this.allLinks = [...res.messages];
|
|
1202
|
+
}
|
|
1203
|
+
catch (error) {
|
|
1204
|
+
console.error('Error while fetching all the links for a particular conversation', error);
|
|
1205
|
+
this.allLinks = [];
|
|
1206
|
+
}
|
|
1207
|
+
};
|
|
1208
|
+
this.getGroupcastMembers = async (groupcastId) => {
|
|
1209
|
+
try {
|
|
1210
|
+
const res = await groupcast.getGroupcastMembers({ groupcastId });
|
|
1211
|
+
this.groupcastMembers = res === null || res === void 0 ? void 0 : res.members;
|
|
1212
|
+
}
|
|
1213
|
+
catch (error) {
|
|
1214
|
+
console.error('Error while fetching all the links for a particular conversation', error);
|
|
1215
|
+
this.groupcastMembers = [];
|
|
1216
|
+
}
|
|
1217
|
+
};
|
|
1218
|
+
this.getAllLinksCount = async (selectedConversationIDForAttachments) => {
|
|
1219
|
+
const queryParamForGetAllAttachments = {
|
|
1220
|
+
conversationId: selectedConversationIDForAttachments,
|
|
1221
|
+
customTypes: 'AttachmentMessage:Link,AttachmentMessage:Multiple,AttachmentMessage:Image,AttachmentMessage:Video,AttachmentMessage:Audio,AttachmentMessage:File',
|
|
1222
|
+
};
|
|
1223
|
+
try {
|
|
1224
|
+
const res = await Image.M.getInstance().message.getMessagesCount(queryParamForGetAllAttachments);
|
|
1225
|
+
this.allLinksCount = res.messagesCount;
|
|
1226
|
+
}
|
|
1227
|
+
catch (error) {
|
|
1228
|
+
console.error('Error while fetching all the links for a particular conversation', error);
|
|
1229
|
+
this.allLinksCount = 0;
|
|
1230
|
+
}
|
|
1231
|
+
};
|
|
1232
|
+
this.getAllAttachments = async (selectedConversationIDForAttachments, from) => {
|
|
1233
|
+
const queryParamForGetAllAttachments = {
|
|
1234
|
+
conversationId: selectedConversationIDForAttachments,
|
|
1235
|
+
customTypes: 'AttachmentMessage:Media,AttachmentMessage:Multiple',
|
|
1236
|
+
};
|
|
1237
|
+
this.loadingMediaGallery = true;
|
|
1238
|
+
this.allAttachments = [];
|
|
1239
|
+
this.selectConverSationAttachments = [];
|
|
1240
|
+
try {
|
|
1241
|
+
//@ts-ignore
|
|
1242
|
+
const res = await Image.M.getInstance().message.getMessages(queryParamForGetAllAttachments);
|
|
1243
|
+
if (Array.isArray(res.messages)) {
|
|
1244
|
+
const filteredMessages = res.messages.filter(message => {
|
|
1245
|
+
if (!message.attachments || !Array.isArray(message.attachments)) {
|
|
1246
|
+
return false;
|
|
1247
|
+
}
|
|
1248
|
+
const validAttachments = message.attachments.filter(attachment => attachment.mimeType && !attachment.mimeType.startsWith('application'));
|
|
1249
|
+
return validAttachments.length > 0;
|
|
1250
|
+
});
|
|
1251
|
+
if (from === 'Profile-info') {
|
|
1252
|
+
this.selectConverSationAttachments = [...filteredMessages];
|
|
1253
|
+
}
|
|
1254
|
+
else {
|
|
1255
|
+
this.allAttachments = [...filteredMessages];
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
catch (error) {
|
|
1260
|
+
console.error('Error while fetching all the attachments for a particular conversation', error);
|
|
1261
|
+
this.allAttachments = [];
|
|
1262
|
+
this.selectConverSationAttachments = [];
|
|
1263
|
+
}
|
|
1264
|
+
finally {
|
|
1265
|
+
this.loadingMediaGallery = false;
|
|
1266
|
+
}
|
|
1267
|
+
};
|
|
1268
|
+
// for clear all messages in a conversation for self
|
|
1269
|
+
this.clearConversation = async (conversationId) => {
|
|
1270
|
+
try {
|
|
1271
|
+
// Call the API to clear the conversation
|
|
1272
|
+
await Image.M.getInstance().Conversation.deleteConversationLocal({
|
|
1273
|
+
conversationId: conversationId || this.selectedConversationId,
|
|
1274
|
+
});
|
|
1275
|
+
// Clear messages from local state
|
|
1276
|
+
this.allMessages = [];
|
|
1277
|
+
// Update the conversation list to remove the last message
|
|
1278
|
+
this.allConversationList = this.allConversationList.map(conversation => {
|
|
1279
|
+
if (conversation.conversationId === this.selectedConversationId) {
|
|
1280
|
+
return Object.assign(Object.assign({}, conversation), { lastMessageDetails: Object.assign(Object.assign({}, conversation.lastMessageDetails), { body: '', updatedAt: Date.now() }) });
|
|
1281
|
+
}
|
|
1282
|
+
return conversation;
|
|
1283
|
+
});
|
|
1284
|
+
}
|
|
1285
|
+
catch (error) {
|
|
1286
|
+
console.error('Error while clearing conversation:', error);
|
|
1287
|
+
}
|
|
1288
|
+
finally {
|
|
1289
|
+
dialogDrawer.drawerDialogService.closeDialog('confirm-dialog');
|
|
1290
|
+
}
|
|
1291
|
+
};
|
|
1292
|
+
this.deleteConversation = async (conversationId) => {
|
|
1293
|
+
try {
|
|
1294
|
+
await Image.M.getInstance().Conversation.deleteConversationClear({
|
|
1295
|
+
conversationId: conversationId,
|
|
1296
|
+
});
|
|
1297
|
+
// Check if the deleted conversation ID is the same as the selected conversation ID
|
|
1298
|
+
if (this.selectedConversationId === conversationId) {
|
|
1299
|
+
// Remove the conversation ID from the URL
|
|
1300
|
+
const url = new URL(window.location.href);
|
|
1301
|
+
url.searchParams.delete('conversation');
|
|
1302
|
+
window.history.pushState({}, '', url);
|
|
1303
|
+
// Reset the selected conversation ID
|
|
1304
|
+
this.selectedConversationId = null;
|
|
1305
|
+
this.showSidebar = true; // Show sidebar if no conversation is selected
|
|
1306
|
+
}
|
|
1307
|
+
// Remove the conversation from the local state
|
|
1308
|
+
this.allConversationList = this.allConversationList.filter(conversation => conversation.conversationId !== conversationId);
|
|
1309
|
+
}
|
|
1310
|
+
catch (error) {
|
|
1311
|
+
console.error('Error while deleting the chat', error);
|
|
1312
|
+
}
|
|
1313
|
+
finally {
|
|
1314
|
+
dialogDrawer.drawerDialogService.closeDialog('confirm-dialog');
|
|
1315
|
+
}
|
|
1316
|
+
};
|
|
1317
|
+
this.blockUser = async (conversationId, userName) => {
|
|
1318
|
+
try {
|
|
1319
|
+
await Image.M.getInstance().user.postUserBlock({
|
|
1320
|
+
opponentId: conversationId,
|
|
1321
|
+
});
|
|
1322
|
+
this.isBlocked = null;
|
|
1323
|
+
toastHelper.showToast({
|
|
1324
|
+
message: `${userName} blocked`,
|
|
1325
|
+
type: 'info',
|
|
1326
|
+
duration: 3000,
|
|
1327
|
+
position: 'bottom-left',
|
|
1328
|
+
});
|
|
1329
|
+
}
|
|
1330
|
+
catch (error) {
|
|
1331
|
+
this.isConversationLoading = false;
|
|
1332
|
+
console.error(`Failed to block user with ID ${conversationId}:`, error);
|
|
1333
|
+
}
|
|
1334
|
+
finally {
|
|
1335
|
+
dialogDrawer.drawerDialogService.closeDialog('confirm-dialog');
|
|
1336
|
+
}
|
|
1337
|
+
};
|
|
1338
|
+
this.unblockUser = async (conversationId, userName) => {
|
|
1339
|
+
try {
|
|
1340
|
+
await Image.M.getInstance().user.postUserUnblock({
|
|
1341
|
+
opponentId: conversationId,
|
|
1342
|
+
});
|
|
1343
|
+
this.isBlocked = null;
|
|
1344
|
+
toastHelper.showToast({
|
|
1345
|
+
message: `${userName} unblocked`,
|
|
1346
|
+
type: 'success',
|
|
1347
|
+
duration: 3000,
|
|
1348
|
+
position: 'bottom-left',
|
|
1349
|
+
});
|
|
1350
|
+
}
|
|
1351
|
+
catch (error) {
|
|
1352
|
+
this.isConversationLoading = false;
|
|
1353
|
+
console.error(`Failed to unblock user with ID ${conversationId}:`, error);
|
|
1354
|
+
}
|
|
1355
|
+
finally {
|
|
1356
|
+
dialogDrawer.drawerDialogService.closeDialog('confirm-dialog');
|
|
1357
|
+
}
|
|
1358
|
+
};
|
|
1359
|
+
this.changeScrollToBottomState = (newState) => {
|
|
1360
|
+
this.isScrollToBottom = newState;
|
|
1361
|
+
};
|
|
1362
|
+
this.changeScrollToTopState = (newState) => {
|
|
1363
|
+
this.isScrollToTop = newState;
|
|
1364
|
+
};
|
|
1365
|
+
this.updateSkip = () => {
|
|
1366
|
+
if (!this.isMessageLimitEnd) {
|
|
1367
|
+
this.skip += 20;
|
|
1368
|
+
}
|
|
1369
|
+
};
|
|
1370
|
+
this.updateAllMessages = (newMessages) => {
|
|
1371
|
+
this.allMessages = newMessages;
|
|
1372
|
+
};
|
|
1373
|
+
this.refetchMessages = () => {
|
|
1374
|
+
this.isScrollToBottom = true;
|
|
1375
|
+
this.isMessageLimitEnd = true;
|
|
1376
|
+
this.messageAction = { action: '', initiator: false };
|
|
1377
|
+
this.skip = 0;
|
|
1378
|
+
this.allMessages = [];
|
|
1379
|
+
this.getMessages(0);
|
|
1380
|
+
this.getMessageAction();
|
|
1381
|
+
};
|
|
1382
|
+
this.changeMessageSendingState = (newState) => {
|
|
1383
|
+
this.isMessageSending = newState;
|
|
1384
|
+
};
|
|
1385
|
+
this.getMessageAction = () => {
|
|
1386
|
+
var _a, _b, _c, _d, _e;
|
|
1387
|
+
const lastMessage = this.isProfileInfoOpen ? (_a = this.selectConversationMessages) === null || _a === void 0 ? void 0 : _a[((_b = this.selectConversationMessages) === null || _b === void 0 ? void 0 : _b.length) - 1] : (_c = this.allMessages) === null || _c === void 0 ? void 0 : _c[((_d = this.allMessages) === null || _d === void 0 ? void 0 : _d.length) - 1];
|
|
1388
|
+
if (lastMessage && ['userBlockConversation', 'userUnblockConversation'].includes(lastMessage === null || lastMessage === void 0 ? void 0 : lastMessage.action)) {
|
|
1389
|
+
this.messageAction = { action: lastMessage === null || lastMessage === void 0 ? void 0 : lastMessage.action, initiator: (lastMessage === null || lastMessage === void 0 ? void 0 : lastMessage.initiatorId) == ((_e = this.userMetaData) === null || _e === void 0 ? void 0 : _e.userId) };
|
|
1390
|
+
}
|
|
1391
|
+
};
|
|
1392
|
+
this.deleteMessageFromSelf = async (payload) => {
|
|
1393
|
+
try {
|
|
1394
|
+
await Image.M.getInstance().message.deleteMessageSelf(payload);
|
|
1395
|
+
this.allMessages = this.allMessages.filter((message) => message.messageId !== payload.messageIds);
|
|
1396
|
+
this.allConversationList = this.sortConversationsByLatestMessage(this.allConversationList.map(conversation => {
|
|
1397
|
+
var _a, _b, _c;
|
|
1398
|
+
if (conversation.conversationId === payload.conversationId && ((_a = conversation === null || conversation === void 0 ? void 0 : conversation.lastMessageDetails) === null || _a === void 0 ? void 0 : _a.messageId) === payload.messageIds) {
|
|
1399
|
+
const remainingMessages = this.allMessages.filter(msg => msg.conversationId === payload.conversationId).sort((a, b) => (a.sentAt || 0) - (b.sentAt || 0));
|
|
1400
|
+
const lastMessage = remainingMessages.length > 0 ? remainingMessages[remainingMessages.length - 1] : null;
|
|
1401
|
+
return Object.assign(Object.assign({}, conversation), { lastMessageDetails: lastMessage
|
|
1402
|
+
? Object.assign(Object.assign({}, lastMessage), { body: lastMessage.body, updatedAt: lastMessage.sentAt || Date.now(), action: lastMessage.action || '', senderName: (_b = lastMessage === null || lastMessage === void 0 ? void 0 : lastMessage.senderInfo) === null || _b === void 0 ? void 0 : _b.userName, senderId: (_c = lastMessage === null || lastMessage === void 0 ? void 0 : lastMessage.senderInfo) === null || _c === void 0 ? void 0 : _c.userId }) : null });
|
|
1403
|
+
}
|
|
1404
|
+
return conversation;
|
|
1405
|
+
}));
|
|
1406
|
+
}
|
|
1407
|
+
catch (error) {
|
|
1408
|
+
toastHelper.showToast({
|
|
1409
|
+
type: 'error',
|
|
1410
|
+
message: (error === null || error === void 0 ? void 0 : error.message) || 'Failed to delete the message',
|
|
1411
|
+
position: 'bottom-right',
|
|
1412
|
+
});
|
|
1413
|
+
}
|
|
1414
|
+
finally {
|
|
1415
|
+
dialogDrawer.drawerDialogService.closeDialog('delete-message');
|
|
1416
|
+
}
|
|
1417
|
+
};
|
|
1418
|
+
this.deleteMeassageFromEveryOne = async (payload) => {
|
|
1419
|
+
try {
|
|
1420
|
+
await Image.M.getInstance().message.deleteMessagesEveryone(payload);
|
|
1421
|
+
this.allMessages = this.allMessages.filter((message) => message.messageId !== payload.messageIds);
|
|
1422
|
+
this.allConversationList = this.sortConversationsByLatestMessage(this.allConversationList.map(conversation => {
|
|
1423
|
+
var _a, _b, _c;
|
|
1424
|
+
if (conversation.conversationId === payload.conversationId && ((_a = conversation === null || conversation === void 0 ? void 0 : conversation.lastMessageDetails) === null || _a === void 0 ? void 0 : _a.messageId) === payload.messageIds) {
|
|
1425
|
+
const remainingMessages = this.allMessages.filter(msg => msg.conversationId === payload.conversationId).sort((a, b) => (a.sentAt || 0) - (b.sentAt || 0));
|
|
1426
|
+
const lastMessage = remainingMessages.length > 0 ? remainingMessages[remainingMessages.length - 1] : null;
|
|
1427
|
+
return Object.assign(Object.assign({}, conversation), { lastMessageDetails: lastMessage
|
|
1428
|
+
? Object.assign(Object.assign({}, lastMessage), { body: lastMessage.body, updatedAt: lastMessage.sentAt || Date.now(), action: lastMessage.action || '', senderName: (_b = lastMessage === null || lastMessage === void 0 ? void 0 : lastMessage.senderInfo) === null || _b === void 0 ? void 0 : _b.userName, senderId: (_c = lastMessage === null || lastMessage === void 0 ? void 0 : lastMessage.senderInfo) === null || _c === void 0 ? void 0 : _c.userId }) : null });
|
|
1429
|
+
}
|
|
1430
|
+
return conversation;
|
|
1431
|
+
}));
|
|
1432
|
+
}
|
|
1433
|
+
catch (error) {
|
|
1434
|
+
console.error(error, 'delete all error');
|
|
1435
|
+
toastHelper.showToast({
|
|
1436
|
+
type: 'error',
|
|
1437
|
+
message: (error === null || error === void 0 ? void 0 : error.message) || 'Failed to delete the message',
|
|
1438
|
+
position: 'bottom-right',
|
|
1439
|
+
});
|
|
1440
|
+
}
|
|
1441
|
+
finally {
|
|
1442
|
+
dialogDrawer.drawerDialogService.closeDialog('delete-message');
|
|
1443
|
+
}
|
|
1444
|
+
};
|
|
1445
|
+
this.typingTimeout = null;
|
|
1446
|
+
this.handleChatOpen = () => {
|
|
1447
|
+
this.isChatClosed = false;
|
|
1448
|
+
};
|
|
1449
|
+
this.handleSearchResultClick = async (messageId) => {
|
|
1450
|
+
this.highlightedMessageId = messageId;
|
|
1451
|
+
const messageExists = this.allMessages.some(message => message.messageId === messageId);
|
|
1452
|
+
if (!messageExists) {
|
|
1453
|
+
while (!this.allMessages.some(message => message.messageId === messageId)) {
|
|
1454
|
+
await this.getMessages(this.skip);
|
|
1455
|
+
this.skip += 20;
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1458
|
+
// Scroll to the message once it is loaded
|
|
1459
|
+
const chatBody = document.querySelector('web-chat-body');
|
|
1460
|
+
if (chatBody) {
|
|
1461
|
+
// @ts-ignore
|
|
1462
|
+
chatBody.scrollToMessage(messageId);
|
|
1463
|
+
}
|
|
1464
|
+
};
|
|
1465
|
+
this.handleCloseChat = () => {
|
|
1466
|
+
this.selectedConversationId = null;
|
|
1467
|
+
this.showSidebar = true;
|
|
1468
|
+
const url = new URL(window.location.href);
|
|
1469
|
+
url.searchParams.delete('conversation');
|
|
1470
|
+
url.searchParams.delete('groupcast');
|
|
1471
|
+
window.history.pushState({}, '', url.toString());
|
|
1472
|
+
this.activeTab = 'Chat';
|
|
1473
|
+
dialogDrawer.drawerDialogService.closeDialog('confirm-dialog');
|
|
1474
|
+
};
|
|
1475
|
+
this.updateConversationList = (updatedList) => {
|
|
1476
|
+
// Ensure the list is sorted
|
|
1477
|
+
const sortedList = this.sortConversationsByLatestMessage(updatedList);
|
|
1478
|
+
// Update the state and return the sorted list
|
|
1479
|
+
this.allConversationList = sortedList;
|
|
1480
|
+
return sortedList;
|
|
1481
|
+
};
|
|
1482
|
+
this.getGroupCastContacts = async (skip = 0) => {
|
|
1483
|
+
var _a;
|
|
1484
|
+
this.activeTab = 'GroupCast';
|
|
1485
|
+
if (!this.hasMoreGroupcast || this.isLoadingMoreGroupcast)
|
|
1486
|
+
return;
|
|
1487
|
+
this.isLoadingMoreGroupcast = true;
|
|
1488
|
+
try {
|
|
1489
|
+
const response = await groupcast.getGroupcast({ skip, limit: 20 });
|
|
1490
|
+
if (((_a = response === null || response === void 0 ? void 0 : response.groupcasts) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
1491
|
+
this.allGroupCastContacts = skip === 0
|
|
1492
|
+
? response.groupcasts
|
|
1493
|
+
: [...this.allGroupCastContacts, ...response.groupcasts];
|
|
1494
|
+
this.groupcastSkip = skip;
|
|
1495
|
+
}
|
|
1496
|
+
else {
|
|
1497
|
+
this.hasMoreGroupcast = false;
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
1500
|
+
catch (error) {
|
|
1501
|
+
console.error('Error fetching groupcast contacts:', error);
|
|
1502
|
+
this.hasMoreGroupcast = false;
|
|
1503
|
+
}
|
|
1504
|
+
finally {
|
|
1505
|
+
this.isLoadingMoreGroupcast = false;
|
|
1506
|
+
}
|
|
1507
|
+
};
|
|
1508
|
+
this.name = undefined;
|
|
1509
|
+
this.baseUrl = undefined;
|
|
1510
|
+
this.licenseKey = undefined;
|
|
1511
|
+
this.appSecret = undefined;
|
|
1512
|
+
this.userSecret = undefined;
|
|
1513
|
+
this.userToken = undefined;
|
|
1514
|
+
this.themeUrl = undefined;
|
|
1515
|
+
this.defaultTheme = undefined;
|
|
1516
|
+
this.isometrikUserId = undefined;
|
|
1517
|
+
this.projectId = undefined;
|
|
1518
|
+
this.keysetId = undefined;
|
|
1519
|
+
this.accountId = undefined;
|
|
1520
|
+
this.conversationId = undefined;
|
|
1521
|
+
this.hostUrl = undefined;
|
|
1522
|
+
this.groupcastEnabled = undefined;
|
|
1523
|
+
this.socialRedirectUrl = undefined;
|
|
1524
|
+
this.unreadConversations = [];
|
|
1525
|
+
this.allLinks = undefined;
|
|
1526
|
+
this.allLinksCount = undefined;
|
|
1527
|
+
this.isInitialized = false;
|
|
1528
|
+
this.findUserId = {};
|
|
1529
|
+
this.mqttClient = null;
|
|
1530
|
+
this.mqttInitialized = false;
|
|
1531
|
+
this.isMqttConnected = false;
|
|
1532
|
+
this.allMessages = [];
|
|
1533
|
+
this.selectConversationMessages = [];
|
|
1534
|
+
this.userMetaData = null;
|
|
1535
|
+
this.allConversationList = [];
|
|
1536
|
+
this.conversationMetaData = {};
|
|
1537
|
+
this.selctConversationMetaData = {};
|
|
1538
|
+
this.isMessageLimitEnd = false;
|
|
1539
|
+
this.skip = 0;
|
|
1540
|
+
this.isMessagesLoading = false;
|
|
1541
|
+
this.isMessageSending = false;
|
|
1542
|
+
this.deviceId = '';
|
|
1543
|
+
this.isScrollToBottom = true;
|
|
1544
|
+
this.isScrollToTop = false;
|
|
1545
|
+
this.isConversationLoading = false;
|
|
1546
|
+
this.isLoadingConversationList = false;
|
|
1547
|
+
this.unreadConversationsCount = 0;
|
|
1548
|
+
this.isChatClosed = false;
|
|
1549
|
+
this.isChatMinimized = false;
|
|
1550
|
+
this.isSubscribedToTopic = false;
|
|
1551
|
+
this.isMessageListenerAttached = false;
|
|
1552
|
+
this.isInitialCallDone = false;
|
|
1553
|
+
this.isTyping = false;
|
|
1554
|
+
this.typingUserName = '';
|
|
1555
|
+
this.selectedConversationId = null;
|
|
1556
|
+
this.unreadMessageCount = null;
|
|
1557
|
+
this.unreadMessageCountFromApi = null;
|
|
1558
|
+
this.isLoading = true;
|
|
1559
|
+
this.loadingProgress = 0;
|
|
1560
|
+
this.loadingStatus = 'Initializing...';
|
|
1561
|
+
this.isLoadingMessage = false;
|
|
1562
|
+
this.hasMoreConversations = false;
|
|
1563
|
+
this.eligibleMembers = [];
|
|
1564
|
+
this.membersListSkip = 0;
|
|
1565
|
+
this.hasMoreEligibleMembers = true;
|
|
1566
|
+
this.isMobileView = false;
|
|
1567
|
+
this.showSidebar = false;
|
|
1568
|
+
this.isContactInfoOpen = false;
|
|
1569
|
+
this.isProfileInfoOpen = false;
|
|
1570
|
+
this.isOpenSearchBar = false;
|
|
1571
|
+
this.isChatFilter = false;
|
|
1572
|
+
this.isAllChatButton = true;
|
|
1573
|
+
this.isSidebarHeaderLabel = true;
|
|
1574
|
+
this.sidebarHeaderLabel = 'Chats';
|
|
1575
|
+
this.isSidebarHeaderSearch = true;
|
|
1576
|
+
this.sidebarColor = 'var(--bg-primary-color)';
|
|
1577
|
+
this.sidebarSelectedColor = 'var(--bg-primary-light)';
|
|
1578
|
+
this.messageSearchText = '';
|
|
1579
|
+
this.searchedMessageDetails = [];
|
|
1580
|
+
this.initialConversationIdFromURL = '';
|
|
1581
|
+
this.allAttachments = [];
|
|
1582
|
+
this.selectConverSationAttachments = [];
|
|
1583
|
+
this.highlightedMessageId = null;
|
|
1584
|
+
this.messageAction = { action: '', initiator: false };
|
|
1585
|
+
this.replyMessage = null;
|
|
1586
|
+
this.loadingMediaGallery = false;
|
|
1587
|
+
this.activeTab = 'Chat';
|
|
1588
|
+
this.isInstagramConnected = false;
|
|
1589
|
+
this.showRightSideBar = false;
|
|
1590
|
+
this.conversationIdFromContactinfo = '';
|
|
1591
|
+
this.exitedGroupIds = new Set();
|
|
1592
|
+
this.conversationCountSkip = 0;
|
|
1593
|
+
this.typingConversationId = null;
|
|
1594
|
+
this.newMessageNotification = null;
|
|
1595
|
+
this.isBlocked = null;
|
|
1596
|
+
this.allGroupCastContacts = [];
|
|
1597
|
+
this.toggleTheme = undefined;
|
|
1598
|
+
this.groupcastSkip = 0;
|
|
1599
|
+
this.isLoadingMoreGroupcast = false;
|
|
1600
|
+
this.hasMoreGroupcast = true;
|
|
1601
|
+
this.groupcastMembers = [];
|
|
1602
|
+
this.sidebarListWidth = 360;
|
|
1603
|
+
this.isResizingSidebar = false;
|
|
1604
|
+
}
|
|
1605
|
+
async handleConversationChange() {
|
|
1606
|
+
this.replyMessage = null;
|
|
1607
|
+
this.isBlocked = null;
|
|
1608
|
+
this.conversationMetaData = {};
|
|
1609
|
+
this.allAttachments = [];
|
|
1610
|
+
}
|
|
1611
|
+
checkMobileView() {
|
|
1612
|
+
this.isMobileView = window.innerWidth <= 768;
|
|
1613
|
+
}
|
|
1614
|
+
componentWillLoad() {
|
|
1615
|
+
var _a;
|
|
1616
|
+
// Instagram OAuth return URL — host page where accounts are linked
|
|
1617
|
+
if ((_a = this.socialRedirectUrl) === null || _a === void 0 ? void 0 : _a.trim()) {
|
|
1618
|
+
chatCreds.CHAT_CREDS.socialRedirectUrl = this.socialRedirectUrl.trim();
|
|
1619
|
+
}
|
|
1620
|
+
// OAuth popup return: notify opener ASAP and close (skip full chat boot)
|
|
1621
|
+
if (MessageSearch.notifyOpenerIfSocialPopupCallback())
|
|
1622
|
+
return;
|
|
1623
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
1624
|
+
const isGroupcast = urlParams.has('groupcast');
|
|
1625
|
+
const conversationId = urlParams.get('conversation');
|
|
1626
|
+
const groupcastId = urlParams.get('groupcast');
|
|
1627
|
+
this.initialConversationIdFromURL = isGroupcast ? groupcastId : conversationId;
|
|
1628
|
+
this.isMobileView = window.innerWidth <= 768;
|
|
1629
|
+
this.selectedConversationId = isGroupcast ? groupcastId : conversationId;
|
|
1630
|
+
if (this.isMobileView && (conversationId || groupcastId)) {
|
|
1631
|
+
this.showSidebar = false;
|
|
1632
|
+
}
|
|
1633
|
+
else {
|
|
1634
|
+
this.showSidebar = true;
|
|
1635
|
+
}
|
|
1636
|
+
try {
|
|
1637
|
+
const saved = localStorage.getItem(this.SIDEBAR_WIDTH_KEY);
|
|
1638
|
+
if (saved) {
|
|
1639
|
+
this.sidebarListWidth = this.clampSidebarWidth(parseInt(saved, 10) || 360);
|
|
1640
|
+
}
|
|
1641
|
+
}
|
|
1642
|
+
catch (_) { }
|
|
1643
|
+
}
|
|
1644
|
+
async componentDidLoad() {
|
|
1645
|
+
try {
|
|
1646
|
+
// Device ID
|
|
1647
|
+
// this.loadTheme();
|
|
1648
|
+
try {
|
|
1649
|
+
this.updateLoading(10, 'Getting device ID...');
|
|
1650
|
+
const deviceId = await dialogDrawer.getDeviceID();
|
|
1651
|
+
this.deviceId = deviceId;
|
|
1652
|
+
}
|
|
1653
|
+
catch (error) {
|
|
1654
|
+
console.error('Error getting device ID:', error);
|
|
1655
|
+
}
|
|
1656
|
+
// Initialize SDK
|
|
1657
|
+
try {
|
|
1658
|
+
this.updateLoading(25, 'Initializing chat SDK...');
|
|
1659
|
+
Image.M.initializeInstance({
|
|
1660
|
+
baseUrl: chatCreds.CHAT_CREDS.baseUrl,
|
|
1661
|
+
licenseKey: chatCreds.CHAT_CREDS.licenseKey,
|
|
1662
|
+
appSecret: chatCreds.CHAT_CREDS.appSecret,
|
|
1663
|
+
userSecret: chatCreds.CHAT_CREDS.userSecret,
|
|
1664
|
+
userToken: this.userTokenFromCookie,
|
|
1665
|
+
});
|
|
1666
|
+
this.isInitialized = true;
|
|
1667
|
+
}
|
|
1668
|
+
catch (sdkError) {
|
|
1669
|
+
console.error('ChatSDK failed to initialize', sdkError);
|
|
1670
|
+
this.isInitialized = false;
|
|
1671
|
+
throw new Error('Failed to initialize chat SDK');
|
|
1672
|
+
}
|
|
1673
|
+
// MQTT setup
|
|
1674
|
+
try {
|
|
1675
|
+
this.updateLoading(40, 'Setting up MQTT client...');
|
|
1676
|
+
await this.setupMqttClient();
|
|
1677
|
+
}
|
|
1678
|
+
catch (mqttError) {
|
|
1679
|
+
console.error('MQTT client setup failed:', mqttError);
|
|
1680
|
+
}
|
|
1681
|
+
// User details + Instagram OAuth return (if any)
|
|
1682
|
+
try {
|
|
1683
|
+
this.updateLoading(55, 'Getting user details...');
|
|
1684
|
+
await this.getUserDetails();
|
|
1685
|
+
await this.handleSocialConnectCallback();
|
|
1686
|
+
}
|
|
1687
|
+
catch (userError) {
|
|
1688
|
+
console.error('Failed to get user details:', userError);
|
|
1689
|
+
}
|
|
1690
|
+
// Gate chats behind a connected Instagram account
|
|
1691
|
+
try {
|
|
1692
|
+
this.updateLoading(65, 'Checking Instagram connection...');
|
|
1693
|
+
await this.refreshInstagramConnectionGate();
|
|
1694
|
+
}
|
|
1695
|
+
catch (igError) {
|
|
1696
|
+
console.error('Failed to check Instagram accounts:', igError);
|
|
1697
|
+
this.applyInstagramAccounts([]);
|
|
1698
|
+
}
|
|
1699
|
+
if (!this.isInstagramConnected) {
|
|
1700
|
+
this.activeTab = 'Accounts';
|
|
1701
|
+
this.updateLoading(100, 'Connect Instagram to continue');
|
|
1702
|
+
this.checkMobileView();
|
|
1703
|
+
window.addEventListener('resize', this.checkMobileView.bind(this));
|
|
1704
|
+
return;
|
|
1705
|
+
}
|
|
1706
|
+
// Conversation details
|
|
1707
|
+
if (this.initialConversationIdFromURL) {
|
|
1708
|
+
try {
|
|
1709
|
+
this.updateLoading(70, 'Loading conversation...');
|
|
1710
|
+
this.selectedConversationId = this.initialConversationIdFromURL;
|
|
1711
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
1712
|
+
const isGroupCast = urlParams.has('groupcast');
|
|
1713
|
+
if (isGroupCast) {
|
|
1714
|
+
await this.getGroupCastConversationDetails(this.initialConversationIdFromURL);
|
|
1715
|
+
const messages = await groupcast.getGroupcastMessage(this.initialConversationIdFromURL);
|
|
1716
|
+
if (messages === null || messages === void 0 ? void 0 : messages.messages) {
|
|
1717
|
+
this.allMessages = messages === null || messages === void 0 ? void 0 : messages.messages.reverse();
|
|
1718
|
+
}
|
|
1719
|
+
}
|
|
1720
|
+
else {
|
|
1721
|
+
await this.getUserConversationDetails();
|
|
1722
|
+
await this.getMessages(0);
|
|
1723
|
+
await this.getAllAttachments(this.initialConversationIdFromURL);
|
|
1724
|
+
}
|
|
1725
|
+
}
|
|
1726
|
+
catch (conversationError) {
|
|
1727
|
+
console.error('Failed to load conversation details:', conversationError);
|
|
1728
|
+
}
|
|
1729
|
+
}
|
|
1730
|
+
try {
|
|
1731
|
+
this.updateLoading(85, 'Checking unread messages...');
|
|
1732
|
+
const unreadCount = await getTotalUnreadConversationsCount();
|
|
1733
|
+
unreadCountStore.updateTotalUnreadCount(unreadCount);
|
|
1734
|
+
this.unreadConversationsCount = unreadCount;
|
|
1735
|
+
unreadCountStore.onChange('totalUnreadCount', value => {
|
|
1736
|
+
this.unreadConversationsCount = value;
|
|
1737
|
+
});
|
|
1738
|
+
}
|
|
1739
|
+
catch (unreadError) {
|
|
1740
|
+
console.error('Error fetching unread conversations:', unreadError);
|
|
1741
|
+
this.unreadConversationsCount = 0;
|
|
1742
|
+
unreadCountStore.updateTotalUnreadCount(0);
|
|
1743
|
+
}
|
|
1744
|
+
// Get all conversations
|
|
1745
|
+
try {
|
|
1746
|
+
this.updateLoading(95, 'Loading conversations...');
|
|
1747
|
+
await this.getConversations();
|
|
1748
|
+
}
|
|
1749
|
+
catch (conversationsError) {
|
|
1750
|
+
console.error('Failed to load conversations:', conversationsError);
|
|
1751
|
+
}
|
|
1752
|
+
this.checkMobileView();
|
|
1753
|
+
window.addEventListener('resize', this.checkMobileView.bind(this));
|
|
1754
|
+
this.updateLoading(100, 'Complete!');
|
|
1755
|
+
}
|
|
1756
|
+
catch (error) {
|
|
1757
|
+
console.error('Critical initialization error:', error);
|
|
1758
|
+
}
|
|
1759
|
+
finally {
|
|
1760
|
+
// Short delay to show the 100% state before hiding
|
|
1761
|
+
setTimeout(() => {
|
|
1762
|
+
this.isLoading = false;
|
|
1763
|
+
}, 500);
|
|
1764
|
+
}
|
|
1765
|
+
}
|
|
1766
|
+
updateLoading(progress, status) {
|
|
1767
|
+
this.loadingProgress = progress;
|
|
1768
|
+
this.loadingStatus = status;
|
|
1769
|
+
}
|
|
1770
|
+
disconnectedCallback() {
|
|
1771
|
+
window.removeEventListener('resize', this.checkMobileView.bind(this));
|
|
1772
|
+
window.removeEventListener('pointermove', this.onSidebarResizeMove);
|
|
1773
|
+
window.removeEventListener('pointerup', this.onSidebarResizeEnd);
|
|
1774
|
+
if (this.conversationDetailsInterval) {
|
|
1775
|
+
clearInterval(this.conversationDetailsInterval);
|
|
1776
|
+
}
|
|
1777
|
+
}
|
|
1778
|
+
async setupMqttClient() {
|
|
1779
|
+
// let retryToConnect:any = null;
|
|
1780
|
+
const deviceID = await dialogDrawer.getDeviceID();
|
|
1781
|
+
const mqttClient = Image.M.getInstance().initializeMqtt({
|
|
1782
|
+
hostUri: chatCreds.MQTT_CREDS.URL ,
|
|
1783
|
+
clientId: chatCreds.CHAT_CREDS.isometrikUserId,
|
|
1784
|
+
licenseKey: chatCreds.CHAT_CREDS.licenseKey,
|
|
1785
|
+
projectId: chatCreds.CHAT_CREDS.projectId,
|
|
1786
|
+
keysetId: chatCreds.CHAT_CREDS.keysetId,
|
|
1787
|
+
accountId: chatCreds.CHAT_CREDS.accountId,
|
|
1788
|
+
deviceId: deviceID,
|
|
1789
|
+
});
|
|
1790
|
+
// const mqttClient = ChatSDK.getInstance().initializeMqtt({
|
|
1791
|
+
// hostUri: this.hostUrl,
|
|
1792
|
+
// clientId: this.isometrikUserId,
|
|
1793
|
+
// licenseKey: this.licenseKey,
|
|
1794
|
+
// projectId: this.projectId,
|
|
1795
|
+
// keysetId: this.keysetId,
|
|
1796
|
+
// accountId: this.accountId,
|
|
1797
|
+
// deviceId: deviceID,
|
|
1798
|
+
// });
|
|
1799
|
+
this.mqttClient = mqttClient;
|
|
1800
|
+
let refetchInterval = null;
|
|
1801
|
+
this.isMqttConnected = false;
|
|
1802
|
+
this.mqttClient.client.on('connect', async () => {
|
|
1803
|
+
this.mqttInitialized = true;
|
|
1804
|
+
this.isMqttConnected = true;
|
|
1805
|
+
this.subscribeToMQTT();
|
|
1806
|
+
if (refetchInterval) {
|
|
1807
|
+
clearInterval(refetchInterval);
|
|
1808
|
+
refetchInterval = null;
|
|
1809
|
+
}
|
|
1810
|
+
if (!this.isInitialCallDone && this.selectedConversationId) {
|
|
1811
|
+
await Image.M.getInstance().message.putRead({ conversationId: this.selectedConversationId });
|
|
1812
|
+
this.refetchMessages();
|
|
1813
|
+
this.isInitialCallDone = true;
|
|
1814
|
+
}
|
|
1815
|
+
});
|
|
1816
|
+
this.mqttClient.client.on('disconnect', () => {
|
|
1817
|
+
this.isMqttConnected = false;
|
|
1818
|
+
});
|
|
1819
|
+
this.mqttClient.client.on('error', (error) => {
|
|
1820
|
+
console.error('MQTT connection error:--->', error);
|
|
1821
|
+
this.mqttInitialized = false;
|
|
1822
|
+
this.isMqttConnected = false;
|
|
1823
|
+
this.isInitialCallDone = true;
|
|
1824
|
+
if (!refetchInterval) {
|
|
1825
|
+
refetchInterval = setInterval(() => {
|
|
1826
|
+
console.error('MQTT connection failed, refetching messages...');
|
|
1827
|
+
this.refetchMessages();
|
|
1828
|
+
}, 30000);
|
|
1829
|
+
}
|
|
1830
|
+
});
|
|
1831
|
+
}
|
|
1832
|
+
handleChatSelect(param) {
|
|
1833
|
+
const conversationId = typeof param === 'string' ? param : param.groupcastId;
|
|
1834
|
+
this.selectedConversationId = conversationId;
|
|
1835
|
+
this.isProfileInfoOpen = false;
|
|
1836
|
+
this.isContactInfoOpen = false;
|
|
1837
|
+
this.isOpenSearchBar = false;
|
|
1838
|
+
const targetConversation = this.allConversationList.find(conversation => (conversation === null || conversation === void 0 ? void 0 : conversation.conversationId) === conversationId);
|
|
1839
|
+
this.conversationMetaData = targetConversation
|
|
1840
|
+
? {
|
|
1841
|
+
isGroup: targetConversation === null || targetConversation === void 0 ? void 0 : targetConversation.isGroup,
|
|
1842
|
+
conversationImageUrl: (targetConversation === null || targetConversation === void 0 ? void 0 : targetConversation.isGroup) ? targetConversation === null || targetConversation === void 0 ? void 0 : targetConversation.conversationImageUrl : null,
|
|
1843
|
+
conversationTitle: (targetConversation === null || targetConversation === void 0 ? void 0 : targetConversation.isGroup) ? targetConversation === null || targetConversation === void 0 ? void 0 : targetConversation.conversationTitle : null,
|
|
1844
|
+
opponentDetails: Object.assign({}, targetConversation.opponentDetails),
|
|
1845
|
+
}
|
|
1846
|
+
: null;
|
|
1847
|
+
if (typeof param === 'string') {
|
|
1848
|
+
this.getAllAttachments(conversationId);
|
|
1849
|
+
}
|
|
1850
|
+
const url = new URL(window.location.href);
|
|
1851
|
+
url.search = '';
|
|
1852
|
+
if (typeof param === 'object') {
|
|
1853
|
+
url.searchParams.set('groupcast', param.groupcastId);
|
|
1854
|
+
this.activeTab = 'GroupCast';
|
|
1855
|
+
this.getGroupCastContacts();
|
|
1856
|
+
this.conversationMetaData = null;
|
|
1857
|
+
}
|
|
1858
|
+
else {
|
|
1859
|
+
if (conversationId) {
|
|
1860
|
+
url.searchParams.set('conversation', conversationId);
|
|
1861
|
+
if (this.isMobileView) {
|
|
1862
|
+
this.showSidebar = false;
|
|
1863
|
+
}
|
|
1864
|
+
}
|
|
1865
|
+
else {
|
|
1866
|
+
url.searchParams.delete('conversation');
|
|
1867
|
+
this.showSidebar = true;
|
|
1868
|
+
}
|
|
1869
|
+
}
|
|
1870
|
+
window.history.pushState({}, '', url);
|
|
1871
|
+
// Reset unread count for the selected conversation
|
|
1872
|
+
this.allConversationList = this.allConversationList.map(conversation => {
|
|
1873
|
+
if (conversation.conversationId === conversationId) {
|
|
1874
|
+
conversation.unreadMessagesCount = 0;
|
|
1875
|
+
}
|
|
1876
|
+
return conversation;
|
|
1877
|
+
});
|
|
1878
|
+
// Emit event to update unread message count in the sidebar
|
|
1879
|
+
this.unreadMessageCountUpdated.emit({
|
|
1880
|
+
detail: {
|
|
1881
|
+
conversationId: conversationId,
|
|
1882
|
+
count: 0,
|
|
1883
|
+
},
|
|
1884
|
+
});
|
|
1885
|
+
}
|
|
1886
|
+
handleBackButton() {
|
|
1887
|
+
this.showSidebar = true;
|
|
1888
|
+
this.selectedConversationId = null;
|
|
1889
|
+
const url = new URL(window.location.href);
|
|
1890
|
+
url.searchParams.delete('conversation');
|
|
1891
|
+
window.history.pushState({}, '', url);
|
|
1892
|
+
}
|
|
1893
|
+
sortConversationsByLatestMessage(conversations) {
|
|
1894
|
+
return [...conversations].sort((a, b) => {
|
|
1895
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
1896
|
+
if ((((_a = a === null || a === void 0 ? void 0 : a.lastMessageDetails) === null || _a === void 0 ? void 0 : _a.action) == 'chatMessageSent' || ((_b = a === null || a === void 0 ? void 0 : a.lastMessageDetails) === null || _b === void 0 ? void 0 : _b.action) == 'forward') &&
|
|
1897
|
+
(((_c = a === null || a === void 0 ? void 0 : a.lastMessageDetails) === null || _c === void 0 ? void 0 : _c.body) === '' || ((_d = a === null || a === void 0 ? void 0 : a.lastMessageDetails) === null || _d === void 0 ? void 0 : _d.action) === 'clearConversation'))
|
|
1898
|
+
return;
|
|
1899
|
+
if ((((_e = b === null || b === void 0 ? void 0 : b.lastMessageDetails) === null || _e === void 0 ? void 0 : _e.action) == 'chatMessageSent' || ((_f = b === null || b === void 0 ? void 0 : b.lastMessageDetails) === null || _f === void 0 ? void 0 : _f.action) == 'forward') &&
|
|
1900
|
+
(((_g = b === null || b === void 0 ? void 0 : b.lastMessageDetails) === null || _g === void 0 ? void 0 : _g.body) === '' || ((_h = b === null || b === void 0 ? void 0 : b.lastMessageDetails) === null || _h === void 0 ? void 0 : _h.action) === 'clearConversation'))
|
|
1901
|
+
return;
|
|
1902
|
+
const timestampA = (_j = a === null || a === void 0 ? void 0 : a.lastMessageDetails) === null || _j === void 0 ? void 0 : _j.updatedAt;
|
|
1903
|
+
const timestampB = (_k = b === null || b === void 0 ? void 0 : b.lastMessageDetails) === null || _k === void 0 ? void 0 : _k.updatedAt;
|
|
1904
|
+
return timestampB - timestampA;
|
|
1905
|
+
});
|
|
1906
|
+
}
|
|
1907
|
+
subscribeToMQTT() {
|
|
1908
|
+
const topic = `/${chatCreds.CHAT_CREDS.accountId}/${chatCreds.CHAT_CREDS.projectId}/Message/${chatCreds.CHAT_CREDS.isometrikUserId}`;
|
|
1909
|
+
if (!this.isSubscribedToTopic) {
|
|
1910
|
+
this.mqttClient.client.subscribe(topic, (error) => {
|
|
1911
|
+
if (error) {
|
|
1912
|
+
console.error('Subscribed Failed to subscribe:--->', error);
|
|
1913
|
+
}
|
|
1914
|
+
else {
|
|
1915
|
+
console.log(`Subscribed to MQTT topic--->: ${topic}`);
|
|
1916
|
+
this.isSubscribedToTopic = true;
|
|
1917
|
+
}
|
|
1918
|
+
});
|
|
1919
|
+
}
|
|
1920
|
+
if (!this.isMessageListenerAttached) {
|
|
1921
|
+
// Set up the listener for incoming messages
|
|
1922
|
+
this.mqttClient.client.on('message', async (topic, message) => {
|
|
1923
|
+
var _a, _b, _c, _d, _e, _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;
|
|
1924
|
+
const parsedMessage = JSON.parse(message.toString());
|
|
1925
|
+
console.log(`New Incoming message from ${topic}:`, parsedMessage);
|
|
1926
|
+
if (parsedMessage.action === 'conversationCreated' && parsedMessage.conversationDetails) {
|
|
1927
|
+
const newConversation = Object.assign({ conversationId: parsedMessage.conversationId, lastMessageDetails: {
|
|
1928
|
+
body: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.body,
|
|
1929
|
+
updatedAt: ((_a = parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.conversationDetails) === null || _a === void 0 ? void 0 : _a.updatedAt) || Date.now(),
|
|
1930
|
+
userName: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.senderName,
|
|
1931
|
+
userProfileImageUrl: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.senderProfileImageUrl,
|
|
1932
|
+
action: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.action,
|
|
1933
|
+
isDeliveredToAllMembers: false,
|
|
1934
|
+
isReadByAllMembers: false,
|
|
1935
|
+
senderId: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.senderId,
|
|
1936
|
+
sentAt: (parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.sentAt) || 0,
|
|
1937
|
+
members: (parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.members) || [],
|
|
1938
|
+
senderName: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.senderName,
|
|
1939
|
+
messageId: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.messageId,
|
|
1940
|
+
}, isGroup: parsedMessage.conversationDetails.isGroup, conversationTitle: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.conversationTitle, conversationImageUrl: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.conversationImageUrl }, parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.conversationDetails);
|
|
1941
|
+
// Add the new conversation to the list and sort
|
|
1942
|
+
this.allConversationList = this.sortConversationsByLatestMessage([newConversation, ...this.allConversationList]);
|
|
1943
|
+
}
|
|
1944
|
+
if ((parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.action) === '"deleteConversationLocally"') {
|
|
1945
|
+
this.allConversationList = this.allConversationList.filter(conversation => conversation.conversationId !== parsedMessage.conversationId);
|
|
1946
|
+
if (this.selectedConversationId === parsedMessage.conversationId) {
|
|
1947
|
+
this.selectedConversationId = null;
|
|
1948
|
+
this.showSidebar = true;
|
|
1949
|
+
const url = new URL(window.location.href);
|
|
1950
|
+
url.searchParams.delete('conversation');
|
|
1951
|
+
window.history.pushState({}, '', url);
|
|
1952
|
+
}
|
|
1953
|
+
}
|
|
1954
|
+
if ((parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.action) === 'forward') {
|
|
1955
|
+
this.handleForwardMessage(parsedMessage);
|
|
1956
|
+
}
|
|
1957
|
+
if ((parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.action) === 'typingEvent' && parsedMessage.userId != this.userMetaData.userId) {
|
|
1958
|
+
this.isTyping = true;
|
|
1959
|
+
this.typingConversationId = parsedMessage.conversationId;
|
|
1960
|
+
this.typingUserName = parsedMessage.userName;
|
|
1961
|
+
// Add a timeout to reset the typing status after a few seconds
|
|
1962
|
+
setTimeout(() => {
|
|
1963
|
+
if (this.typingConversationId === parsedMessage.conversationId) {
|
|
1964
|
+
this.isTyping = false;
|
|
1965
|
+
this.typingConversationId = null;
|
|
1966
|
+
this.typingUserName = '';
|
|
1967
|
+
}
|
|
1968
|
+
}, 3000); // Reset after 3 seconds
|
|
1969
|
+
}
|
|
1970
|
+
else if ((parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.action) !== 'typingEvent') {
|
|
1971
|
+
this.isTyping = false;
|
|
1972
|
+
this.typingConversationId = null;
|
|
1973
|
+
this.typingUserName = '';
|
|
1974
|
+
}
|
|
1975
|
+
if ((parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.action) === 'multipleMessagesRead' && parsedMessage.userId != ((_b = this.userMetaData) === null || _b === void 0 ? void 0 : _b.userId)) {
|
|
1976
|
+
// Update messages read status
|
|
1977
|
+
this.allMessages = (_c = this.allMessages) === null || _c === void 0 ? void 0 : _c.map(message => { var _a, _b; return (message === null || message === void 0 ? void 0 : message.readByAll) != true && ((message === null || message === void 0 ? void 0 : message.senderId) || ((_a = message === null || message === void 0 ? void 0 : message.senderInfo) === null || _a === void 0 ? void 0 : _a.userId)) == ((_b = this.userMetaData) === null || _b === void 0 ? void 0 : _b.userId) ? Object.assign(Object.assign({}, message), { readByAll: true }) : message; });
|
|
1978
|
+
// Emit event for message read status update
|
|
1979
|
+
this.messageReadStatusUpdated.emit({
|
|
1980
|
+
detail: {
|
|
1981
|
+
conversationId: parsedMessage.conversationId,
|
|
1982
|
+
isRead: true,
|
|
1983
|
+
isDelivered: true,
|
|
1984
|
+
messageId: parsedMessage.messageId,
|
|
1985
|
+
},
|
|
1986
|
+
});
|
|
1987
|
+
}
|
|
1988
|
+
if ((parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.action) == 'messagesDeleteForAll') {
|
|
1989
|
+
this.allMessages = this.allMessages.filter((message) => message.messageId != parsedMessage.messageIds[0]);
|
|
1990
|
+
if ((parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.userId) !== ((_d = this.userMetaData) === null || _d === void 0 ? void 0 : _d.userId)) {
|
|
1991
|
+
this.allConversationList = this.sortConversationsByLatestMessage(this.allConversationList.map(conversation => {
|
|
1992
|
+
var _a, _b, _c, _d;
|
|
1993
|
+
if (conversation.conversationId === parsedMessage.conversationId && ((_a = conversation === null || conversation === void 0 ? void 0 : conversation.lastMessageDetails) === null || _a === void 0 ? void 0 : _a.messageId) === parsedMessage.messageIds[0]) {
|
|
1994
|
+
const lastMessage = conversation === null || conversation === void 0 ? void 0 : conversation.lastMessageDetails;
|
|
1995
|
+
return Object.assign(Object.assign({}, conversation), { lastMessageDetails: lastMessage
|
|
1996
|
+
? Object.assign(Object.assign({}, lastMessage), { body: conversation.isGroup
|
|
1997
|
+
? `This Message Was Deleted`
|
|
1998
|
+
: `${(lastMessage === null || lastMessage === void 0 ? void 0 : lastMessage.senderId) === ((_b = this.userMetaData) === null || _b === void 0 ? void 0 : _b.userId) ? 'You' : lastMessage === null || lastMessage === void 0 ? void 0 : lastMessage.senderName} have Delete message`, updatedAt: parsedMessage.sentAt || Date.now(), action: parsedMessage.action || '', senderName: (parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.userName) || ((_c = lastMessage === null || lastMessage === void 0 ? void 0 : lastMessage.senderInfo) === null || _c === void 0 ? void 0 : _c.userName), senderId: (lastMessage === null || lastMessage === void 0 ? void 0 : lastMessage.userId) || ((_d = lastMessage === null || lastMessage === void 0 ? void 0 : lastMessage.senderInfo) === null || _d === void 0 ? void 0 : _d.userId) }) : null });
|
|
1999
|
+
}
|
|
2000
|
+
if (conversation.conversationId === parsedMessage.conversationId) {
|
|
2001
|
+
return Object.assign(Object.assign({}, conversation), { unreadMessagesCount: conversation.unreadMessagesCount - 1 });
|
|
2002
|
+
}
|
|
2003
|
+
return conversation;
|
|
2004
|
+
}));
|
|
2005
|
+
}
|
|
2006
|
+
}
|
|
2007
|
+
if ((parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.senderId) == ((_e = this.userMetaData) === null || _e === void 0 ? void 0 : _e.userId) && ((parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.action) == 'chatMessageSent' || (parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.action) == 'forward')) {
|
|
2008
|
+
this.changeMessageSendingState(false);
|
|
2009
|
+
this.allMessages = this.allMessages.map(message => {
|
|
2010
|
+
var _a, _b;
|
|
2011
|
+
if (message.messageId == parsedMessage.messageId) {
|
|
2012
|
+
return Object.assign(Object.assign({}, parsedMessage), { mentionedUsers: ((_a = parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.mentionedUsers) === null || _a === void 0 ? void 0 : _a.length)
|
|
2013
|
+
? (_b = parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.mentionedUsers) === null || _b === void 0 ? void 0 : _b.map(pmUser => {
|
|
2014
|
+
const matchingUser = message.mentionedUsers.find(mUser => mUser.userId === pmUser.userId);
|
|
2015
|
+
return Object.assign(Object.assign({}, pmUser), { userName: matchingUser ? matchingUser === null || matchingUser === void 0 ? void 0 : matchingUser.userName : undefined });
|
|
2016
|
+
})
|
|
2017
|
+
: [] });
|
|
2018
|
+
}
|
|
2019
|
+
return message;
|
|
2020
|
+
});
|
|
2021
|
+
}
|
|
2022
|
+
if ((parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.action) == 'messageDelivered' && parsedMessage.senderId != ((_f = this.userMetaData) === null || _f === void 0 ? void 0 : _f.userId)) {
|
|
2023
|
+
this.allMessages = (_g = this.allMessages) === null || _g === void 0 ? void 0 : _g.map(message => ((message === null || message === void 0 ? void 0 : message.messageId) === (parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.messageId) ? Object.assign(Object.assign({}, message), { deliveredToAll: true }) : message));
|
|
2024
|
+
}
|
|
2025
|
+
if ((parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.action) == 'userBlockConversation' || parsedMessage.action == 'userUnblockConversation' || parsedMessage.action == 'userUnblock') {
|
|
2026
|
+
if (parsedMessage.action === 'userBlockConversation') {
|
|
2027
|
+
if (parsedMessage.conversationId === this.selectedConversationId) {
|
|
2028
|
+
this.conversationMetaData = Object.assign(Object.assign({}, this.conversationMetaData), { messagingDisabled: true, updateBlockStatus: Date.now() });
|
|
2029
|
+
}
|
|
2030
|
+
this.allConversationList = this.sortConversationsByLatestMessage(this.allConversationList.map(conversation => {
|
|
2031
|
+
var _a;
|
|
2032
|
+
if (conversation.conversationId === parsedMessage.conversationId) {
|
|
2033
|
+
return Object.assign(Object.assign({}, conversation), { lastMessageDetails: Object.assign(Object.assign({}, conversation.lastMessageDetails), { body: `${(parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.initiatorId) === ((_a = this.userMetaData) === null || _a === void 0 ? void 0 : _a.userId)
|
|
2034
|
+
? `🚫 You blocked ${parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.opponentName}`
|
|
2035
|
+
: `🚫 ${parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.initiatorName} blocked you`}`, updatedAt: parsedMessage.sentAt || Date.now(), action: parsedMessage.action || '', initiatorName: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.initiatorName, initiatorId: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.initiatorId, opponentName: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.opponentName }) });
|
|
2036
|
+
}
|
|
2037
|
+
if (conversation.conversationId === parsedMessage.conversationId) {
|
|
2038
|
+
return Object.assign(Object.assign({}, conversation), { unreadMessagesCount: conversation.unreadMessagesCount - 1 });
|
|
2039
|
+
}
|
|
2040
|
+
return conversation;
|
|
2041
|
+
}));
|
|
2042
|
+
}
|
|
2043
|
+
if (parsedMessage.action == 'userUnblock' || parsedMessage.action === 'userUnblockConversation') {
|
|
2044
|
+
if (parsedMessage.conversationId === this.selectedConversationId) {
|
|
2045
|
+
this.conversationMetaData = Object.assign(Object.assign({}, this.conversationMetaData), { messagingDisabled: false, updateBlockStatus: Date.now() });
|
|
2046
|
+
}
|
|
2047
|
+
this.allConversationList = this.sortConversationsByLatestMessage(this.allConversationList.map(conversation => {
|
|
2048
|
+
var _a;
|
|
2049
|
+
if (conversation.conversationId === parsedMessage.conversationId) {
|
|
2050
|
+
return Object.assign(Object.assign({}, conversation), { lastMessageDetails: Object.assign(Object.assign({}, conversation.lastMessageDetails), { body: `${(parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.initiatorId) === ((_a = this.userMetaData) === null || _a === void 0 ? void 0 : _a.userId) ? `You unblocked ${parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.opponentName}` : `${parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.initiatorName} unblocked you`}`, updatedAt: parsedMessage.sentAt || Date.now(), action: parsedMessage.action || '', initiatorName: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.initiatorName, initiatorId: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.initiatorId, opponentName: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.opponentName }) });
|
|
2051
|
+
}
|
|
2052
|
+
if (conversation.conversationId === parsedMessage.conversationId) {
|
|
2053
|
+
return Object.assign(Object.assign({}, conversation), { unreadMessagesCount: conversation.unreadMessagesCount - 1 });
|
|
2054
|
+
}
|
|
2055
|
+
return conversation;
|
|
2056
|
+
}));
|
|
2057
|
+
}
|
|
2058
|
+
}
|
|
2059
|
+
if ((parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.action) === 'reactionAdd') {
|
|
2060
|
+
// Only process reactions for the currently selected conversation
|
|
2061
|
+
// Check if conversationId matches, or if message exists in current conversation (fallback)
|
|
2062
|
+
const messageExists = this.allMessages.some(msg => msg.messageId === parsedMessage.messageId);
|
|
2063
|
+
const isCurrentConversation = parsedMessage.conversationId === this.selectedConversationId ||
|
|
2064
|
+
(messageExists && this.selectedConversationId);
|
|
2065
|
+
if (isCurrentConversation) {
|
|
2066
|
+
this.allMessages = this.allMessages.map(message => {
|
|
2067
|
+
if (message.messageId === parsedMessage.messageId) {
|
|
2068
|
+
// Create a copy of existing reactions or initialize empty object
|
|
2069
|
+
const existingReactions = Object.assign({}, (message.reactions || {}));
|
|
2070
|
+
// Get existing users array for this reaction type or initialize empty array
|
|
2071
|
+
// Handle both array of userIds and array of user objects
|
|
2072
|
+
let existingUsers = existingReactions[parsedMessage.reactionType] || [];
|
|
2073
|
+
// If it's an array of objects, extract userIds
|
|
2074
|
+
if (Array.isArray(existingUsers) && existingUsers.length > 0 && typeof existingUsers[0] === 'object') {
|
|
2075
|
+
existingUsers = existingUsers.map(u => u.userId || u);
|
|
2076
|
+
}
|
|
2077
|
+
// Check if user already reacted
|
|
2078
|
+
const userAlreadyReacted = existingUsers.includes(parsedMessage.userId);
|
|
2079
|
+
if (!userAlreadyReacted) {
|
|
2080
|
+
// Update reactions to match API structure
|
|
2081
|
+
const updateReaction = Object.assign(Object.assign({}, existingReactions), { [parsedMessage.reactionType]: [...existingUsers, parsedMessage.userId] });
|
|
2082
|
+
return Object.assign(Object.assign({}, message), { reactions: updateReaction });
|
|
2083
|
+
}
|
|
2084
|
+
return message;
|
|
2085
|
+
}
|
|
2086
|
+
return message;
|
|
2087
|
+
});
|
|
2088
|
+
}
|
|
2089
|
+
}
|
|
2090
|
+
if ((parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.action) === 'reactionRemove') {
|
|
2091
|
+
// Only process reactions for the currently selected conversation
|
|
2092
|
+
if (parsedMessage.conversationId === this.selectedConversationId) {
|
|
2093
|
+
this.allMessages = this.allMessages.map(message => {
|
|
2094
|
+
if (message.messageId === parsedMessage.messageId) {
|
|
2095
|
+
const existingReactions = Object.assign({}, (message.reactions || {}));
|
|
2096
|
+
const existingUsers = existingReactions[parsedMessage.reactionType] || [];
|
|
2097
|
+
// Filter out the user who removed the reaction
|
|
2098
|
+
const updatedUsers = Array.isArray(existingUsers)
|
|
2099
|
+
? existingUsers.filter(userId => userId !== parsedMessage.userId)
|
|
2100
|
+
: [];
|
|
2101
|
+
if (updatedUsers.length > 0) {
|
|
2102
|
+
existingReactions[parsedMessage.reactionType] = updatedUsers;
|
|
2103
|
+
}
|
|
2104
|
+
else {
|
|
2105
|
+
delete existingReactions[parsedMessage.reactionType];
|
|
2106
|
+
}
|
|
2107
|
+
return Object.assign(Object.assign({}, message), { reactions: existingReactions });
|
|
2108
|
+
}
|
|
2109
|
+
return message;
|
|
2110
|
+
});
|
|
2111
|
+
}
|
|
2112
|
+
}
|
|
2113
|
+
if ((parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.action) === 'membersAdd') {
|
|
2114
|
+
const conversationExists = this.allConversationList.some(conversation => conversation.conversationId === (parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.conversationId));
|
|
2115
|
+
if (parsedMessage.conversationId === this.selectedConversationId) {
|
|
2116
|
+
this.conversationMetaData.members = [
|
|
2117
|
+
...this.conversationMetaData.members,
|
|
2118
|
+
...parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.members.map(member => ({
|
|
2119
|
+
userId: member.memberId,
|
|
2120
|
+
userName: member.memberName,
|
|
2121
|
+
userProfileImageUrl: member.memberProfileImageUrl,
|
|
2122
|
+
userIdentifier: member.memberIdentifier,
|
|
2123
|
+
isAdmin: member.isAdmin || false,
|
|
2124
|
+
})),
|
|
2125
|
+
];
|
|
2126
|
+
}
|
|
2127
|
+
const isCurrentUserAdded = (_h = parsedMessage.members) === null || _h === void 0 ? void 0 : _h.some(member => { var _a; return member.memberId === ((_a = this.userMetaData) === null || _a === void 0 ? void 0 : _a.userId); });
|
|
2128
|
+
if (!conversationExists && isCurrentUserAdded) {
|
|
2129
|
+
// Create new conversation object for added member
|
|
2130
|
+
const newConversation = {
|
|
2131
|
+
conversationId: parsedMessage.conversationId,
|
|
2132
|
+
isGroup: true,
|
|
2133
|
+
conversationTitle: parsedMessage.conversationTitle,
|
|
2134
|
+
conversationImageUrl: parsedMessage.conversationImageUrl,
|
|
2135
|
+
lastMessageDetails: {
|
|
2136
|
+
body: `${parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.userName} added you`,
|
|
2137
|
+
sentAt: (parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.sentAt) || Date.now(),
|
|
2138
|
+
action: 'membersAdd',
|
|
2139
|
+
userName: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.userName,
|
|
2140
|
+
userProfileImageUrl: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.userProfileImageUrl,
|
|
2141
|
+
senderId: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.userId,
|
|
2142
|
+
senderName: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.userName,
|
|
2143
|
+
memberAdded: (_j = parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.members) === null || _j === void 0 ? void 0 : _j.map(member => member.memberName),
|
|
2144
|
+
memberAddedUserId: (_k = parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.members) === null || _k === void 0 ? void 0 : _k.map(member => member.memberId),
|
|
2145
|
+
},
|
|
2146
|
+
unreadMessagesCount: 1,
|
|
2147
|
+
members: parsedMessage.members || [],
|
|
2148
|
+
};
|
|
2149
|
+
// Add the new conversation to the list and sort
|
|
2150
|
+
this.allConversationList = this.sortConversationsByLatestMessage([newConversation, ...this.allConversationList]);
|
|
2151
|
+
// Update unread count
|
|
2152
|
+
this.unreadMessageCountUpdated.emit({
|
|
2153
|
+
detail: {
|
|
2154
|
+
conversationId: parsedMessage.conversationId,
|
|
2155
|
+
count: 1,
|
|
2156
|
+
},
|
|
2157
|
+
});
|
|
2158
|
+
}
|
|
2159
|
+
else if (conversationExists) {
|
|
2160
|
+
// Update existing conversation with new member info
|
|
2161
|
+
this.allConversationList = this.sortConversationsByLatestMessage(this.allConversationList.map(conversation => {
|
|
2162
|
+
var _a, _b, _c, _d;
|
|
2163
|
+
if (conversation.conversationId === parsedMessage.conversationId) {
|
|
2164
|
+
return Object.assign(Object.assign({}, conversation), { lastMessageDetails: Object.assign(Object.assign({}, conversation.lastMessageDetails), { body: `${parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.userName} added ${(_b = (_a = parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.members) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.memberName}`, sentAt: (parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.sentAt) || Date.now(), action: 'membersAdd', userName: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.userName, userProfileImageUrl: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.userProfileImageUrl, memberAdded: (_c = parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.members) === null || _c === void 0 ? void 0 : _c.map(member => member.memberName), memberAddedUserId: (_d = parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.members) === null || _d === void 0 ? void 0 : _d.map(member => member.memberId), members: [...(conversation.members || []), ...parsedMessage.members] }), members: [...(conversation.members || []), ...parsedMessage.members] });
|
|
2165
|
+
}
|
|
2166
|
+
return conversation;
|
|
2167
|
+
}));
|
|
2168
|
+
}
|
|
2169
|
+
}
|
|
2170
|
+
if ((parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.action) === 'membersRemove') {
|
|
2171
|
+
const conversationExists = this.allConversationList.some(conversation => conversation.conversationId === (parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.conversationId));
|
|
2172
|
+
if (parsedMessage.conversationId === this.selectedConversationId) {
|
|
2173
|
+
this.conversationMetaData.members = (_m = (_l = this.conversationMetaData) === null || _l === void 0 ? void 0 : _l.members) === null || _m === void 0 ? void 0 : _m.filter(user => { var _a, _b; return (user === null || user === void 0 ? void 0 : user.userId) !== ((_b = (_a = parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.members) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.memberId); });
|
|
2174
|
+
}
|
|
2175
|
+
if (conversationExists) {
|
|
2176
|
+
// Update existing conversation with new member info
|
|
2177
|
+
this.allConversationList = this.sortConversationsByLatestMessage(this.allConversationList.map(conversation => {
|
|
2178
|
+
var _a, _b, _c;
|
|
2179
|
+
if (conversation.conversationId === parsedMessage.conversationId) {
|
|
2180
|
+
return Object.assign(Object.assign({}, conversation), { lastMessageDetails: Object.assign(Object.assign({}, conversation.lastMessageDetails), { body: `${parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.userName} removed ${(_a = parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.members[0]) === null || _a === void 0 ? void 0 : _a.memberName}`, sentAt: (parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.sentAt) || Date.now(), action: 'membersRemove', userName: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.userName, userProfileImageUrl: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.userProfileImageUrl, memberAdded: (_b = parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.members) === null || _b === void 0 ? void 0 : _b.map(member => member.memberName), memberAddedUserId: (_c = parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.members) === null || _c === void 0 ? void 0 : _c.map(member => member.memberId), members: [...(conversation.members || []), ...parsedMessage.members] }), members: [...(conversation.members || []), ...parsedMessage.members] });
|
|
2181
|
+
}
|
|
2182
|
+
return conversation;
|
|
2183
|
+
}));
|
|
2184
|
+
}
|
|
2185
|
+
}
|
|
2186
|
+
if ((parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.action) === 'addAdmin') {
|
|
2187
|
+
const conversationExists = this.allConversationList.some(conversation => conversation.conversationId === parsedMessage.conversationId);
|
|
2188
|
+
if (parsedMessage.conversationId === this.selectedConversationId) {
|
|
2189
|
+
this.conversationMetaData.members = (_p = (_o = this.conversationMetaData) === null || _o === void 0 ? void 0 : _o.members) === null || _p === void 0 ? void 0 : _p.map(member => {
|
|
2190
|
+
return Object.assign(Object.assign({}, member), { isAdmin: member.userId === parsedMessage.memberId ? true : member.isAdmin });
|
|
2191
|
+
});
|
|
2192
|
+
}
|
|
2193
|
+
if (conversationExists) {
|
|
2194
|
+
this.allConversationList = this.sortConversationsByLatestMessage(this.allConversationList.map(conversation => {
|
|
2195
|
+
if (conversation.conversationId === parsedMessage.conversationId) {
|
|
2196
|
+
return Object.assign(Object.assign({}, conversation), { lastMessageDetails: Object.assign(Object.assign({}, conversation.lastMessageDetails), { body: `${(parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.initiatorId) === this.userMetaData.userId ? 'you' : parsedMessage.memberName} made ${parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.memberName} an admin`, sentAt: (parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.sentAt) || Date.now(), action: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.action, userName: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.userName, userProfileImageUrl: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.userProfileImageUrl, initiatorId: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.initiatorId, initiatorName: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.initiatorName, memberName: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.memberName }) });
|
|
2197
|
+
}
|
|
2198
|
+
return conversation;
|
|
2199
|
+
}));
|
|
2200
|
+
}
|
|
2201
|
+
else if (!conversationExists) {
|
|
2202
|
+
const newConversation = {
|
|
2203
|
+
conversationId: parsedMessage.conversationId,
|
|
2204
|
+
lastMessageDetails: {
|
|
2205
|
+
body: `${(parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.initiatorId) === this.userMetaData.userId ? 'you' : parsedMessage.memberName} made ${parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.memberName} an admin`,
|
|
2206
|
+
sentAt: (parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.sentAt) || Date.now(),
|
|
2207
|
+
action: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.action,
|
|
2208
|
+
userName: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.userName,
|
|
2209
|
+
userProfileImageUrl: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.userProfileImageUrl,
|
|
2210
|
+
initiatorId: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.initiatorId,
|
|
2211
|
+
initiatorName: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.initiatorName,
|
|
2212
|
+
memberName: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.memberName,
|
|
2213
|
+
},
|
|
2214
|
+
isGroup: true,
|
|
2215
|
+
conversationTitle: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.conversationTitle,
|
|
2216
|
+
conversationImageUrl: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.conversationImageUrl,
|
|
2217
|
+
};
|
|
2218
|
+
// Add the new conversation to the list and sort
|
|
2219
|
+
this.allConversationList = this.sortConversationsByLatestMessage([newConversation, ...this.allConversationList]);
|
|
2220
|
+
}
|
|
2221
|
+
}
|
|
2222
|
+
if ((parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.action) === 'removeAdmin') {
|
|
2223
|
+
const conversationExists = this.allConversationList.some(conversation => conversation.conversationId === parsedMessage.conversationId);
|
|
2224
|
+
if (parsedMessage.conversationId === this.selectedConversationId) {
|
|
2225
|
+
this.conversationMetaData.members = (_r = (_q = this.conversationMetaData) === null || _q === void 0 ? void 0 : _q.members) === null || _r === void 0 ? void 0 : _r.map(member => {
|
|
2226
|
+
return Object.assign(Object.assign({}, member), { isAdmin: member.userId === parsedMessage.memberId ? false : member.isAdmin });
|
|
2227
|
+
});
|
|
2228
|
+
}
|
|
2229
|
+
if (conversationExists) {
|
|
2230
|
+
this.allConversationList = this.sortConversationsByLatestMessage(this.allConversationList.map(conversation => {
|
|
2231
|
+
if (conversation.conversationId === parsedMessage.conversationId) {
|
|
2232
|
+
return Object.assign(Object.assign({}, conversation), { lastMessageDetails: Object.assign(Object.assign({}, conversation.lastMessageDetails), { body: `${(parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.initiatorId) === this.userMetaData.userId ? 'you' : parsedMessage.memberName} removed ${parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.memberName} as an admin`, sentAt: (parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.sentAt) || Date.now(), action: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.action, userName: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.userName, userProfileImageUrl: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.userProfileImageUrl, initiatorId: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.initiatorId, initiatorName: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.initiatorName, memberName: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.memberName }) });
|
|
2233
|
+
}
|
|
2234
|
+
return conversation;
|
|
2235
|
+
}));
|
|
2236
|
+
}
|
|
2237
|
+
else if (!conversationExists) {
|
|
2238
|
+
const newConversation = {
|
|
2239
|
+
conversationId: parsedMessage.conversationId,
|
|
2240
|
+
lastMessageDetails: {
|
|
2241
|
+
body: `${(parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.initiatorId) === this.userMetaData.userId ? 'you' : parsedMessage.memberName} removed ${parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.memberName} as an admin`,
|
|
2242
|
+
sentAt: (parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.sentAt) || Date.now(),
|
|
2243
|
+
action: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.action,
|
|
2244
|
+
userName: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.userName,
|
|
2245
|
+
userProfileImageUrl: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.userProfileImageUrl,
|
|
2246
|
+
initiatorId: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.initiatorId,
|
|
2247
|
+
initiatorName: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.initiatorName,
|
|
2248
|
+
memberName: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.memberName,
|
|
2249
|
+
},
|
|
2250
|
+
isGroup: true,
|
|
2251
|
+
conversationTitle: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.conversationTitle,
|
|
2252
|
+
conversationImageUrl: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.conversationImageUrl,
|
|
2253
|
+
};
|
|
2254
|
+
// Add the new conversation to the list and sort
|
|
2255
|
+
this.allConversationList = this.sortConversationsByLatestMessage([newConversation, ...this.allConversationList]);
|
|
2256
|
+
}
|
|
2257
|
+
}
|
|
2258
|
+
if ((parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.action) == 'chatMessageSent' || (parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.action) == 'forward') {
|
|
2259
|
+
const conversationExists = this.allConversationList.some(conversation => conversation.conversationId === parsedMessage.conversationId);
|
|
2260
|
+
const isGroup = !parsedMessage.privateOneToOne;
|
|
2261
|
+
if (!conversationExists) {
|
|
2262
|
+
// Create a new conversation object from the message data
|
|
2263
|
+
const newConversation = {
|
|
2264
|
+
conversationId: parsedMessage.conversationId,
|
|
2265
|
+
lastMessageDetails: {
|
|
2266
|
+
body: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.body,
|
|
2267
|
+
updatedAt: (parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.sentAt) || Date.now(),
|
|
2268
|
+
userName: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.senderName,
|
|
2269
|
+
userProfileImageUrl: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.senderProfileImageUrl,
|
|
2270
|
+
action: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.action,
|
|
2271
|
+
isDeliveredToAllMembers: false,
|
|
2272
|
+
isReadByAllMembers: false,
|
|
2273
|
+
isPendingAllMembers: false,
|
|
2274
|
+
senderId: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.senderId,
|
|
2275
|
+
sentAt: (parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.sentAt) || 0,
|
|
2276
|
+
members: (parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.members) || [],
|
|
2277
|
+
senderName: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.senderName,
|
|
2278
|
+
messageId: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.messageId,
|
|
2279
|
+
},
|
|
2280
|
+
isGroup: isGroup,
|
|
2281
|
+
conversationTitle: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.conversationTitle,
|
|
2282
|
+
conversationImageUrl: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.conversationImageUrl,
|
|
2283
|
+
opponentDetails: !isGroup
|
|
2284
|
+
? {
|
|
2285
|
+
// Use the sender's details only if they're not the current user
|
|
2286
|
+
userName: (parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.senderId) !== ((_s = this.userMetaData) === null || _s === void 0 ? void 0 : _s.userId) ? parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.senderName : (_u = (_t = this.conversationMetaData) === null || _t === void 0 ? void 0 : _t.opponentDetails) === null || _u === void 0 ? void 0 : _u.userName,
|
|
2287
|
+
userProfileImageUrl: (parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.senderId) !== ((_v = this.userMetaData) === null || _v === void 0 ? void 0 : _v.userId)
|
|
2288
|
+
? parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.senderProfileImageUrl
|
|
2289
|
+
: (_x = (_w = this.conversationMetaData) === null || _w === void 0 ? void 0 : _w.opponentDetails) === null || _x === void 0 ? void 0 : _x.userProfileImageUrl,
|
|
2290
|
+
userId: (parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.senderId) !== ((_y = this.userMetaData) === null || _y === void 0 ? void 0 : _y.userId) ? parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.senderId : (_0 = (_z = this.conversationMetaData) === null || _z === void 0 ? void 0 : _z.opponentDetails) === null || _0 === void 0 ? void 0 : _0.userId,
|
|
2291
|
+
}
|
|
2292
|
+
: null,
|
|
2293
|
+
};
|
|
2294
|
+
// Add the new conversation to the list and sort
|
|
2295
|
+
this.allConversationList = this.sortConversationsByLatestMessage([newConversation, ...this.allConversationList]);
|
|
2296
|
+
}
|
|
2297
|
+
else {
|
|
2298
|
+
// Update existing conversation
|
|
2299
|
+
this.allConversationList = this.sortConversationsByLatestMessage(this.allConversationList.map(conversation => {
|
|
2300
|
+
if (conversation.conversationId === parsedMessage.conversationId) {
|
|
2301
|
+
return Object.assign(Object.assign({}, conversation), { lastMessageDetails: Object.assign(Object.assign({}, conversation.lastMessageDetails), { body: parsedMessage.body, updatedAt: parsedMessage.updatedAt || parsedMessage.sentAt || Date.now(), attachments: (parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.attachments) || [], action: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.action, isDeliveredToAllMembers: false, isReadByAllMembers: false, isPendingAllMembers: false, senderId: parsedMessage.senderId, sentAt: (parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.sentAt) || 0, members: (parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.members) || [], senderName: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.senderName, messageId: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.messageId, opponentDetails: conversation.opponentDetails }), isGroup: conversation.isGroup, conversationTitle: conversation.conversationTitle, conversationImageUrl: conversation.conversationImageUrl, opponentDetails: conversation.opponentDetails });
|
|
2302
|
+
}
|
|
2303
|
+
return conversation;
|
|
2304
|
+
}));
|
|
2305
|
+
}
|
|
2306
|
+
// Re-sort the conversations after update
|
|
2307
|
+
this.allConversationList = this.sortConversationsByLatestMessage(this.allConversationList);
|
|
2308
|
+
if (parsedMessage.conversationId === this.selectedConversationId) {
|
|
2309
|
+
if (parsedMessage.senderId !== ((_1 = this.userMetaData) === null || _1 === void 0 ? void 0 : _1.userId)) {
|
|
2310
|
+
const currentCount = ((_2 = this.newMessageNotification) === null || _2 === void 0 ? void 0 : _2.count) || 0;
|
|
2311
|
+
this.newMessageNotification = {
|
|
2312
|
+
messageId: parsedMessage.messageId,
|
|
2313
|
+
count: currentCount + 1,
|
|
2314
|
+
conversationId: parsedMessage.conversationId,
|
|
2315
|
+
};
|
|
2316
|
+
}
|
|
2317
|
+
}
|
|
2318
|
+
}
|
|
2319
|
+
if ((parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.senderId) != ((_3 = this.userMetaData) === null || _3 === void 0 ? void 0 : _3.userId) &&
|
|
2320
|
+
(parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.action) != 'typingEvent' &&
|
|
2321
|
+
(parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.action) != 'messageRead' &&
|
|
2322
|
+
(parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.action) != 'multipleMessagesRead' &&
|
|
2323
|
+
(parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.action) != 'messageRead' &&
|
|
2324
|
+
(parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.action) != 'messagesDeleteForAll' &&
|
|
2325
|
+
(parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.action) != 'messagesDeleteLocal' &&
|
|
2326
|
+
(parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.action) != 'messageDelivered' &&
|
|
2327
|
+
(parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.action) != 'conversationCreated') {
|
|
2328
|
+
// if(parsedMessage.conversationId === this.selectedConversationId) {
|
|
2329
|
+
// this.allMessages = [...this.allMessages, parsedMessage];
|
|
2330
|
+
// }
|
|
2331
|
+
if (parsedMessage.conversationId === this.selectedConversationId) {
|
|
2332
|
+
this.allMessages = [...this.allMessages, parsedMessage];
|
|
2333
|
+
}
|
|
2334
|
+
else {
|
|
2335
|
+
this.allConversationList = this.allConversationList.map(conversation => {
|
|
2336
|
+
if (conversation.conversationId === (parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.conversationId)) {
|
|
2337
|
+
const currentUnreadCount = parseInt(conversation.unreadMessagesCount) || 0;
|
|
2338
|
+
conversation.unreadMessagesCount = currentUnreadCount + 1;
|
|
2339
|
+
this.unreadMessageCount = conversation.unreadMessagesCount;
|
|
2340
|
+
}
|
|
2341
|
+
return conversation;
|
|
2342
|
+
});
|
|
2343
|
+
}
|
|
2344
|
+
this.unreadMessageCountUpdated.emit({
|
|
2345
|
+
detail: {
|
|
2346
|
+
conversationId: parsedMessage.conversationId,
|
|
2347
|
+
count: 1,
|
|
2348
|
+
},
|
|
2349
|
+
// bubbles: true,
|
|
2350
|
+
// composed: true
|
|
2351
|
+
});
|
|
2352
|
+
try {
|
|
2353
|
+
await Image.M.getInstance().message.putIndicateDelivered({ conversationId: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.conversationId, messageId: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.messageId });
|
|
2354
|
+
}
|
|
2355
|
+
catch (error) {
|
|
2356
|
+
console.error(error, 'putIndicateDelivered request error');
|
|
2357
|
+
}
|
|
2358
|
+
}
|
|
2359
|
+
// Handle message delivery status updates
|
|
2360
|
+
if ((parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.action) === 'messageDelivered' || (parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.action) === 'messageRead') {
|
|
2361
|
+
const isRead = (parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.action) === 'messageRead';
|
|
2362
|
+
const isDelivered = (parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.action) === 'messageDelivered';
|
|
2363
|
+
// Update conversation list with new message status
|
|
2364
|
+
this.allConversationList = this.allConversationList.map(conversation => {
|
|
2365
|
+
var _a, _b, _c;
|
|
2366
|
+
if (conversation.conversationId === parsedMessage.conversationId) {
|
|
2367
|
+
// Only update if the status has actually changed
|
|
2368
|
+
const currentReadStatus = (_a = conversation.lastMessageDetails) === null || _a === void 0 ? void 0 : _a.readByAll;
|
|
2369
|
+
const currentDeliveredStatus = (_b = conversation.lastMessageDetails) === null || _b === void 0 ? void 0 : _b.deliveredToAll;
|
|
2370
|
+
if (currentReadStatus !== isRead || currentDeliveredStatus !== isDelivered) {
|
|
2371
|
+
// Emit event when status changes
|
|
2372
|
+
this.messageReadStatusUpdated.emit({
|
|
2373
|
+
detail: {
|
|
2374
|
+
conversationId: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.conversationId,
|
|
2375
|
+
isRead,
|
|
2376
|
+
isDelivered,
|
|
2377
|
+
messageId: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.messageId,
|
|
2378
|
+
},
|
|
2379
|
+
bubbles: true,
|
|
2380
|
+
composed: true,
|
|
2381
|
+
});
|
|
2382
|
+
return Object.assign(Object.assign({}, conversation), { lastMessageDetails: Object.assign(Object.assign({}, conversation.lastMessageDetails), { readByAll: isRead, deliveredToAll: isDelivered, senderId: (_c = conversation.lastMessageDetails) === null || _c === void 0 ? void 0 : _c.senderId }) });
|
|
2383
|
+
}
|
|
2384
|
+
}
|
|
2385
|
+
return conversation;
|
|
2386
|
+
});
|
|
2387
|
+
}
|
|
2388
|
+
if ((parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.action) == 'messageRead' && parsedMessage.senderId != ((_4 = this.userMetaData) === null || _4 === void 0 ? void 0 : _4.userId)) {
|
|
2389
|
+
// Update single message read status
|
|
2390
|
+
this.allMessages = (_5 = this.allMessages) === null || _5 === void 0 ? void 0 : _5.map(message => ((message === null || message === void 0 ? void 0 : message.messageId) === (parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.messageId) ? Object.assign(Object.assign({}, message), { readByAll: true }) : message));
|
|
2391
|
+
// Emit event for message read status update
|
|
2392
|
+
this.messageReadStatusUpdated.emit({
|
|
2393
|
+
detail: {
|
|
2394
|
+
conversationId: parsedMessage.conversationId,
|
|
2395
|
+
isRead: true,
|
|
2396
|
+
isDelivered: true,
|
|
2397
|
+
messageId: parsedMessage.messageId,
|
|
2398
|
+
},
|
|
2399
|
+
});
|
|
2400
|
+
}
|
|
2401
|
+
// Update unread count if message is not in current conversation
|
|
2402
|
+
if (((parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.action) == 'chatMessageSent' || (parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.action) == 'forward') && parsedMessage.senderId != ((_6 = this.userMetaData) === null || _6 === void 0 ? void 0 : _6.userId)) {
|
|
2403
|
+
const totalUnreadConversation = (_7 = this.allConversationList) === null || _7 === void 0 ? void 0 : _7.filter(conversation => (conversation === null || conversation === void 0 ? void 0 : conversation.unreadMessagesCount) > 0);
|
|
2404
|
+
if ((totalUnreadConversation === null || totalUnreadConversation === void 0 ? void 0 : totalUnreadConversation.length) > 0) {
|
|
2405
|
+
unreadCountStore.updateTotalUnreadCount(totalUnreadConversation === null || totalUnreadConversation === void 0 ? void 0 : totalUnreadConversation.length);
|
|
2406
|
+
}
|
|
2407
|
+
}
|
|
2408
|
+
// Add this to your existing MQTT message handler in subscribeToMQTT()
|
|
2409
|
+
if (topic.includes('/members')) {
|
|
2410
|
+
try {
|
|
2411
|
+
const memberUpdate = JSON.parse(message.toString());
|
|
2412
|
+
if (memberUpdate.type === 'member_removed' && memberUpdate.conversationId === this.selectedConversationId) {
|
|
2413
|
+
// Update conversation metadata and group members store
|
|
2414
|
+
this.conversationMetaData = Object.assign(Object.assign({}, this.conversationMetaData), { members: memberUpdate.updatedMembers });
|
|
2415
|
+
MessageSearch.groupMembersStore.initializeMembers(memberUpdate.updatedMembers, memberUpdate.conversationId);
|
|
2416
|
+
// Show toast notification for other members
|
|
2417
|
+
if (memberUpdate.removedByUserId !== chatCreds.CHAT_CREDS.isometrikUserId) {
|
|
2418
|
+
toastHelper.showToast({
|
|
2419
|
+
message: 'A member has been removed from the group',
|
|
2420
|
+
type: 'info',
|
|
2421
|
+
duration: 3000,
|
|
2422
|
+
position: 'bottom-left',
|
|
2423
|
+
});
|
|
2424
|
+
}
|
|
2425
|
+
}
|
|
2426
|
+
}
|
|
2427
|
+
catch (error) {
|
|
2428
|
+
console.error('Error handling member update message:', error);
|
|
2429
|
+
}
|
|
2430
|
+
}
|
|
2431
|
+
});
|
|
2432
|
+
this.isMessageListenerAttached = true;
|
|
2433
|
+
}
|
|
2434
|
+
}
|
|
2435
|
+
///
|
|
2436
|
+
async handleForwardMessage(parsedMessage) {
|
|
2437
|
+
var _a, _b;
|
|
2438
|
+
try {
|
|
2439
|
+
// Check if the conversation already exists
|
|
2440
|
+
const conversationExists = this.allConversationList.some(conversation => conversation.conversationId === parsedMessage.conversationId);
|
|
2441
|
+
if (!conversationExists) {
|
|
2442
|
+
// Get conversation details first
|
|
2443
|
+
const conversationDetails = await this.getUserConversationDetails(parsedMessage.conversationId);
|
|
2444
|
+
// Use the conversation details to create the new conversation object
|
|
2445
|
+
const newConversation = {
|
|
2446
|
+
conversationId: parsedMessage.conversationId,
|
|
2447
|
+
lastMessageDetails: {
|
|
2448
|
+
body: parsedMessage.body,
|
|
2449
|
+
updatedAt: parsedMessage.updatedAt || Date.now(),
|
|
2450
|
+
// @ts-ignore
|
|
2451
|
+
userName: (_a = conversationDetails === null || conversationDetails === void 0 ? void 0 : conversationDetails.opponentDetails) === null || _a === void 0 ? void 0 : _a.userName,
|
|
2452
|
+
// @ts-ignore
|
|
2453
|
+
userProfileImageUrl: (_b = conversationDetails === null || conversationDetails === void 0 ? void 0 : conversationDetails.opponentDetails) === null || _b === void 0 ? void 0 : _b.userProfileImageUrl,
|
|
2454
|
+
},
|
|
2455
|
+
unreadMessagesCount: 0,
|
|
2456
|
+
// Add details from the API response
|
|
2457
|
+
};
|
|
2458
|
+
// Add the new conversation to the list and sort
|
|
2459
|
+
this.allConversationList = this.sortConversationsByLatestMessage([newConversation, ...this.allConversationList]);
|
|
2460
|
+
await this.getAllAttachments(newConversation.conversationId);
|
|
2461
|
+
}
|
|
2462
|
+
else {
|
|
2463
|
+
// Update existing conversation
|
|
2464
|
+
this.allConversationList = this.sortConversationsByLatestMessage(this.allConversationList.map(conversation => {
|
|
2465
|
+
if (conversation.conversationId === parsedMessage.conversationId) {
|
|
2466
|
+
return Object.assign(Object.assign({}, conversation), { lastMessageDetails: Object.assign(Object.assign({}, conversation.lastMessageDetails), { body: parsedMessage.body, updatedAt: parsedMessage.updatedAt || Date.now() }), isGroup: conversation.isGroup, conversationTitle: conversation.conversationTitle, conversationImageUrl: conversation.conversationImageUrl, opponentDetails: conversation.opponentDetails });
|
|
2467
|
+
}
|
|
2468
|
+
return conversation;
|
|
2469
|
+
}));
|
|
2470
|
+
}
|
|
2471
|
+
this.unreadMessageCountUpdated.emit({
|
|
2472
|
+
detail: {
|
|
2473
|
+
conversationId: parsedMessage.conversationId,
|
|
2474
|
+
count: 1,
|
|
2475
|
+
},
|
|
2476
|
+
});
|
|
2477
|
+
}
|
|
2478
|
+
catch (error) {
|
|
2479
|
+
console.error('Error handling forward message:', error);
|
|
2480
|
+
}
|
|
2481
|
+
}
|
|
2482
|
+
async handleRemoveMemberClicked(event) {
|
|
2483
|
+
var _a;
|
|
2484
|
+
const isGroupcast = event.detail.isGroupcast;
|
|
2485
|
+
const memberToRemove = event.detail.userId;
|
|
2486
|
+
const originalMembers = ((_a = this.conversationMetaData) === null || _a === void 0 ? void 0 : _a.members) || [];
|
|
2487
|
+
const groupcastId = event.detail.conversationId;
|
|
2488
|
+
try {
|
|
2489
|
+
if (isGroupcast) {
|
|
2490
|
+
groupcast.removeGroupcastMember(groupcastId, memberToRemove);
|
|
2491
|
+
}
|
|
2492
|
+
else {
|
|
2493
|
+
await groupMembers.removeConversationMember(this.selectedConversationId, memberToRemove);
|
|
2494
|
+
const updatedMembers = originalMembers.filter(member => member.userId !== memberToRemove);
|
|
2495
|
+
this.conversationMetaData = Object.assign(Object.assign({}, this.conversationMetaData), { members: updatedMembers });
|
|
2496
|
+
MessageSearch.groupMembersStore.initializeMembers(updatedMembers, this.selectedConversationId);
|
|
2497
|
+
}
|
|
2498
|
+
toastHelper.showToast({
|
|
2499
|
+
message: 'Member removed successfully',
|
|
2500
|
+
type: 'success',
|
|
2501
|
+
duration: 3000,
|
|
2502
|
+
position: 'bottom-left',
|
|
2503
|
+
});
|
|
2504
|
+
}
|
|
2505
|
+
catch (error) {
|
|
2506
|
+
console.error('Error removing member:', error);
|
|
2507
|
+
toastHelper.showToast({
|
|
2508
|
+
message: 'Failed to remove member',
|
|
2509
|
+
type: 'error',
|
|
2510
|
+
duration: 3000,
|
|
2511
|
+
position: 'bottom-left',
|
|
2512
|
+
});
|
|
2513
|
+
}
|
|
2514
|
+
finally {
|
|
2515
|
+
dialogDrawer.drawerDialogService.closeDialog('confirm-dialog');
|
|
2516
|
+
}
|
|
2517
|
+
}
|
|
2518
|
+
async onProfileClick(event) {
|
|
2519
|
+
if (event.type === 'profile-clicked') {
|
|
2520
|
+
this.activeTab = 'Profile';
|
|
2521
|
+
}
|
|
2522
|
+
}
|
|
2523
|
+
async handleMembersListScrolledToBottom(event) {
|
|
2524
|
+
try {
|
|
2525
|
+
this.hasMoreEligibleMembers = true;
|
|
2526
|
+
this.membersListSkip += 20;
|
|
2527
|
+
const newMembers = await groupMembers.getConversationEligibleMembers(this.selectedConversationId);
|
|
2528
|
+
if (newMembers.conversationEligibleMembers.length < 20) {
|
|
2529
|
+
this.hasMoreEligibleMembers = false;
|
|
2530
|
+
}
|
|
2531
|
+
this.eligibleMembers = [...this.eligibleMembers, ...newMembers.conversationEligibleMembers];
|
|
2532
|
+
const membersList = event.target;
|
|
2533
|
+
membersList.isLoading = false;
|
|
2534
|
+
}
|
|
2535
|
+
catch (error) {
|
|
2536
|
+
console.error('Error loading more members:', error);
|
|
2537
|
+
this.hasMoreEligibleMembers = false;
|
|
2538
|
+
const membersList = event.target;
|
|
2539
|
+
membersList.isLoading = false;
|
|
2540
|
+
}
|
|
2541
|
+
}
|
|
2542
|
+
async handleContactInfo(event) {
|
|
2543
|
+
const { type } = event.detail;
|
|
2544
|
+
if (type === 'close-right-Sidebar') {
|
|
2545
|
+
this.showRightSideBar = false;
|
|
2546
|
+
this.isOpenSearchBar = false;
|
|
2547
|
+
this.isContactInfoOpen = false;
|
|
2548
|
+
this.isProfileInfoOpen = false;
|
|
2549
|
+
this.searchedMessageDetails = [];
|
|
2550
|
+
}
|
|
2551
|
+
}
|
|
2552
|
+
async handleProfileInfo(event) {
|
|
2553
|
+
const { type } = event.detail;
|
|
2554
|
+
if (type === 'close-contact-info') {
|
|
2555
|
+
this.showRightSideBar = true;
|
|
2556
|
+
this.isContactInfoOpen = true;
|
|
2557
|
+
this.isProfileInfoOpen = false;
|
|
2558
|
+
this.searchedMessageDetails = [];
|
|
2559
|
+
}
|
|
2560
|
+
}
|
|
2561
|
+
async handleOpen(event) {
|
|
2562
|
+
const { type, renderComponent, userId, userName } = event.detail;
|
|
2563
|
+
const { isGroupcast, groupcastId } = await dialogDrawer.getGroupcastUrlQuery();
|
|
2564
|
+
if (type === 'open-right-Sidebar') {
|
|
2565
|
+
this.showRightSideBar = true;
|
|
2566
|
+
if (renderComponent === 'message-search-container') {
|
|
2567
|
+
this.isOpenSearchBar = true;
|
|
2568
|
+
this.isContactInfoOpen = false;
|
|
2569
|
+
this.isProfileInfoOpen = false;
|
|
2570
|
+
}
|
|
2571
|
+
else if (renderComponent === 'contact-info') {
|
|
2572
|
+
this.isContactInfoOpen = true;
|
|
2573
|
+
this.getAllLinksCount(this.selectedConversationId);
|
|
2574
|
+
if (isGroupcast) {
|
|
2575
|
+
this.getGroupcastMembers(groupcastId);
|
|
2576
|
+
}
|
|
2577
|
+
this.isOpenSearchBar = false;
|
|
2578
|
+
}
|
|
2579
|
+
else if (renderComponent === 'profile-info') {
|
|
2580
|
+
this.isContactInfoOpen = false;
|
|
2581
|
+
this.isProfileInfoOpen = true;
|
|
2582
|
+
this.isOpenSearchBar = false;
|
|
2583
|
+
this.getConversationId(userId, userName);
|
|
2584
|
+
}
|
|
2585
|
+
}
|
|
2586
|
+
}
|
|
2587
|
+
async getConversationId(selectedContactId, selectedContactName) {
|
|
2588
|
+
try {
|
|
2589
|
+
const paramsForCreateConversation = {
|
|
2590
|
+
typingEvents: true,
|
|
2591
|
+
readEvents: true,
|
|
2592
|
+
pushNotifications: true,
|
|
2593
|
+
members: [selectedContactId],
|
|
2594
|
+
isGroup: false,
|
|
2595
|
+
conversationType: 0,
|
|
2596
|
+
searchableTags: [selectedContactName],
|
|
2597
|
+
};
|
|
2598
|
+
const res = await Image.M.getInstance().Conversation.postConversation(paramsForCreateConversation);
|
|
2599
|
+
if (res.conversationId) {
|
|
2600
|
+
this.conversationIdFromContactinfo = res.conversationId;
|
|
2601
|
+
this.getUserConversationDetails(res.conversationId);
|
|
2602
|
+
this.getAllAttachments(res.conversationId, 'Profile-info');
|
|
2603
|
+
this.getMessages(0, res.conversationId);
|
|
2604
|
+
}
|
|
2605
|
+
}
|
|
2606
|
+
catch (error) {
|
|
2607
|
+
console.error('Error creating conversation:', error);
|
|
2608
|
+
}
|
|
2609
|
+
}
|
|
2610
|
+
async handleGetLinks(event) {
|
|
2611
|
+
const { conversationId } = event.detail;
|
|
2612
|
+
this.getAllLinks(conversationId);
|
|
2613
|
+
}
|
|
2614
|
+
handleSkipChange() {
|
|
2615
|
+
if (!this.isMessageLimitEnd) {
|
|
2616
|
+
this.getMessages(this.skip);
|
|
2617
|
+
}
|
|
2618
|
+
}
|
|
2619
|
+
handleTypingChange() {
|
|
2620
|
+
if (this.isTyping) {
|
|
2621
|
+
if (this.typingTimeout) {
|
|
2622
|
+
clearTimeout(this.typingTimeout);
|
|
2623
|
+
}
|
|
2624
|
+
this.typingTimeout = setTimeout(() => {
|
|
2625
|
+
this.isTyping = false;
|
|
2626
|
+
this.typingUserName = '';
|
|
2627
|
+
}, 10000);
|
|
2628
|
+
}
|
|
2629
|
+
}
|
|
2630
|
+
async handleSelectedConversationChange(newValue) {
|
|
2631
|
+
if (newValue) {
|
|
2632
|
+
this.isConversationLoading = true;
|
|
2633
|
+
const url = new URL(window.location.href);
|
|
2634
|
+
const isGroupcast = url.searchParams.has('groupcast');
|
|
2635
|
+
if (isGroupcast) {
|
|
2636
|
+
const groupcastId = url.searchParams.get('groupcast');
|
|
2637
|
+
try {
|
|
2638
|
+
this.isScrollToBottom = true;
|
|
2639
|
+
this.isMessageLimitEnd = true;
|
|
2640
|
+
this.messageAction = { action: '', initiator: false };
|
|
2641
|
+
this.skip = 0;
|
|
2642
|
+
this.allMessages = [];
|
|
2643
|
+
await this.getGroupCastConversationDetails(groupcastId);
|
|
2644
|
+
const messages = await groupcast.getGroupcastMessage(groupcastId);
|
|
2645
|
+
if (messages === null || messages === void 0 ? void 0 : messages.messages) {
|
|
2646
|
+
this.allMessages = messages === null || messages === void 0 ? void 0 : messages.messages.reverse();
|
|
2647
|
+
}
|
|
2648
|
+
}
|
|
2649
|
+
catch (error) {
|
|
2650
|
+
console.error('Error while getting groupcast data', error);
|
|
2651
|
+
}
|
|
2652
|
+
}
|
|
2653
|
+
else {
|
|
2654
|
+
this.refetchMessages();
|
|
2655
|
+
this.getUserConversationDetails();
|
|
2656
|
+
}
|
|
2657
|
+
this.isConversationLoading = false;
|
|
2658
|
+
const selectedConversation = this.allConversationList.find(conv => conv.conversationId === newValue);
|
|
2659
|
+
if (selectedConversation && selectedConversation.unreadMessagesCount > 0) {
|
|
2660
|
+
const currentCount = unreadCountStore.getTotalUnreadCount();
|
|
2661
|
+
const newCount = Math.max(0, currentCount - 1);
|
|
2662
|
+
unreadCountStore.updateTotalUnreadCount(newCount);
|
|
2663
|
+
}
|
|
2664
|
+
}
|
|
2665
|
+
else {
|
|
2666
|
+
if (this.conversationDetailsInterval) {
|
|
2667
|
+
clearInterval(this.conversationDetailsInterval);
|
|
2668
|
+
}
|
|
2669
|
+
}
|
|
2670
|
+
}
|
|
2671
|
+
async handlemessageAction() {
|
|
2672
|
+
this.getMessageAction();
|
|
2673
|
+
}
|
|
2674
|
+
handleGroupExited(event) {
|
|
2675
|
+
const { conversationId } = event.detail;
|
|
2676
|
+
// Add the group ID to the set of exited groups
|
|
2677
|
+
this.exitedGroupIds.add(conversationId);
|
|
2678
|
+
}
|
|
2679
|
+
handleTaguserClick(event) {
|
|
2680
|
+
const { userId, userName } = event.detail;
|
|
2681
|
+
if (userId && userName) {
|
|
2682
|
+
this.createConversation(userId, userName);
|
|
2683
|
+
}
|
|
2684
|
+
}
|
|
2685
|
+
async createConversation(selectedContactId, selectedContactName) {
|
|
2686
|
+
try {
|
|
2687
|
+
const paramsForCreateConversation = {
|
|
2688
|
+
typingEvents: true,
|
|
2689
|
+
readEvents: true,
|
|
2690
|
+
pushNotifications: true,
|
|
2691
|
+
members: [selectedContactId],
|
|
2692
|
+
isGroup: false,
|
|
2693
|
+
conversationType: 0,
|
|
2694
|
+
searchableTags: [selectedContactName],
|
|
2695
|
+
};
|
|
2696
|
+
const res = await Image.M.getInstance().Conversation.postConversation(paramsForCreateConversation);
|
|
2697
|
+
if (res.conversationId) {
|
|
2698
|
+
this.handleChatSelect(res.conversationId);
|
|
2699
|
+
}
|
|
2700
|
+
}
|
|
2701
|
+
catch (error) {
|
|
2702
|
+
console.error('Error creating conversation:', error);
|
|
2703
|
+
}
|
|
2704
|
+
}
|
|
2705
|
+
handleContactAction(event) {
|
|
2706
|
+
const action = event.detail.action;
|
|
2707
|
+
switch (action) {
|
|
2708
|
+
case 'exit-group':
|
|
2709
|
+
break;
|
|
2710
|
+
case 'block-contact':
|
|
2711
|
+
this.blockUser(event.detail.oppenentId, event.detail.userName);
|
|
2712
|
+
break;
|
|
2713
|
+
case 'unblock-contact':
|
|
2714
|
+
this.unblockUser(event.detail.oppenentId, event.detail.userName);
|
|
2715
|
+
break;
|
|
2716
|
+
case 'delete-chat':
|
|
2717
|
+
this.deleteConversation(event.detail.conversationId);
|
|
2718
|
+
break;
|
|
2719
|
+
case 'clear-chat':
|
|
2720
|
+
// Call clearConversation with the selected conversation ID
|
|
2721
|
+
this.clearConversation(event.detail.conversationId);
|
|
2722
|
+
break;
|
|
2723
|
+
}
|
|
2724
|
+
}
|
|
2725
|
+
handleChatTileScrolledToBottom() {
|
|
2726
|
+
this.conversationCountSkip += 20;
|
|
2727
|
+
if (this.hasMoreConversations) {
|
|
2728
|
+
this.getConversations(this.conversationCountSkip);
|
|
2729
|
+
}
|
|
2730
|
+
}
|
|
2731
|
+
// Add a method to reset notification count
|
|
2732
|
+
resetNewMessageNotification() {
|
|
2733
|
+
this.newMessageNotification = null;
|
|
2734
|
+
}
|
|
2735
|
+
async handleConversationUpdate(event) {
|
|
2736
|
+
const { conversationId, type, value } = event.detail;
|
|
2737
|
+
// Immediately update the conversation in the list (optimistic update)
|
|
2738
|
+
if (type === 'title' && value) {
|
|
2739
|
+
this.allConversationList = this.allConversationList.map(conv => conv.conversationId === conversationId
|
|
2740
|
+
? Object.assign(Object.assign({}, conv), { conversationTitle: value }) : conv);
|
|
2741
|
+
}
|
|
2742
|
+
else if (type === 'image' && value) {
|
|
2743
|
+
this.allConversationList = this.allConversationList.map(conv => conv.conversationId === conversationId
|
|
2744
|
+
? Object.assign(Object.assign({}, conv), { conversationImageUrl: value }) : conv);
|
|
2745
|
+
}
|
|
2746
|
+
try {
|
|
2747
|
+
// Fetch updated conversation details from server for consistency
|
|
2748
|
+
const response = await Image.M.getInstance().Conversation.getConversationDetails(conversationId, 'true');
|
|
2749
|
+
if (response) {
|
|
2750
|
+
// Update the conversation in the list with server response
|
|
2751
|
+
this.allConversationList = this.allConversationList.map(conv => (conv.conversationId === conversationId ? Object.assign(Object.assign({}, conv), response) : conv));
|
|
2752
|
+
// If this is the currently selected conversation, update conversation metadata
|
|
2753
|
+
if (this.selectedConversationId === conversationId) {
|
|
2754
|
+
this.conversationMetaData = response;
|
|
2755
|
+
}
|
|
2756
|
+
}
|
|
2757
|
+
}
|
|
2758
|
+
catch (error) {
|
|
2759
|
+
console.error('Error refreshing conversation details:', error);
|
|
2760
|
+
}
|
|
2761
|
+
}
|
|
2762
|
+
async watchPropHandler(newValue) {
|
|
2763
|
+
if ((newValue === null || newValue === void 0 ? void 0 : newValue.updateBlockStatus) || ((newValue === null || newValue === void 0 ? void 0 : newValue.messagingDisabled) && this.isBlocked === null)) {
|
|
2764
|
+
await this.findBlokedUser();
|
|
2765
|
+
}
|
|
2766
|
+
}
|
|
2767
|
+
async findBlokedUser() {
|
|
2768
|
+
var _a, _b;
|
|
2769
|
+
this.isBlocked = 'loading';
|
|
2770
|
+
try {
|
|
2771
|
+
const findRes = await Image.M.getInstance().user.getUserBlock({
|
|
2772
|
+
searchTag: (_b = (_a = this.conversationMetaData) === null || _a === void 0 ? void 0 : _a.opponentDetails) === null || _b === void 0 ? void 0 : _b.userName,
|
|
2773
|
+
});
|
|
2774
|
+
const users = (findRes === null || findRes === void 0 ? void 0 : findRes.users) || [];
|
|
2775
|
+
const currUser = users === null || users === void 0 ? void 0 : users.find(u => { var _a, _b; return (u === null || u === void 0 ? void 0 : u.userId) === ((_b = (_a = this.conversationMetaData) === null || _a === void 0 ? void 0 : _a.opponentDetails) === null || _b === void 0 ? void 0 : _b.userId); });
|
|
2776
|
+
this.isBlocked = currUser ? true : null;
|
|
2777
|
+
}
|
|
2778
|
+
catch (e) {
|
|
2779
|
+
this.isBlocked = null;
|
|
2780
|
+
}
|
|
2781
|
+
finally {
|
|
2782
|
+
this.isConversationLoading = false;
|
|
2783
|
+
}
|
|
2784
|
+
}
|
|
2785
|
+
handleGroupcastScroll() {
|
|
2786
|
+
if (this.hasMoreGroupcast && !this.isLoadingMoreGroupcast) {
|
|
2787
|
+
this.getGroupCastContacts(this.groupcastSkip + 20);
|
|
2788
|
+
}
|
|
2789
|
+
}
|
|
2790
|
+
async handleDeleteGroupcast(e) {
|
|
2791
|
+
var _a;
|
|
2792
|
+
try {
|
|
2793
|
+
const groupcastId = (_a = e === null || e === void 0 ? void 0 : e.detail) === null || _a === void 0 ? void 0 : _a.groupcastId;
|
|
2794
|
+
await groupcast.deleteGroupCast(groupcastId);
|
|
2795
|
+
this.allGroupCastContacts = this.allGroupCastContacts.filter(groupcast => groupcast.groupcastId !== groupcastId);
|
|
2796
|
+
const url = new URL(window.location.href);
|
|
2797
|
+
url.searchParams.delete('groupcast');
|
|
2798
|
+
window.history.pushState({}, '', url);
|
|
2799
|
+
this.selectedConversationId = null;
|
|
2800
|
+
this.showSidebar = true;
|
|
2801
|
+
toastHelper.showToast({
|
|
2802
|
+
message: 'Groupcast deleted successfully',
|
|
2803
|
+
type: 'success',
|
|
2804
|
+
duration: 3000,
|
|
2805
|
+
position: 'bottom-left',
|
|
2806
|
+
});
|
|
2807
|
+
}
|
|
2808
|
+
catch (error) {
|
|
2809
|
+
console.error('Error deleting groupcast:', error);
|
|
2810
|
+
toastHelper.showToast({
|
|
2811
|
+
message: 'Error while deleting groupcast',
|
|
2812
|
+
type: 'error',
|
|
2813
|
+
duration: 3000,
|
|
2814
|
+
position: 'bottom-left',
|
|
2815
|
+
});
|
|
2816
|
+
}
|
|
2817
|
+
}
|
|
2818
|
+
render() {
|
|
2819
|
+
var _a, _b, _c, _d, _e;
|
|
2820
|
+
return (index.h(index.Fragment, { key: '54bf58235570d4cd19ae3bbc1ac54dda2346d644' }, this.isLoading ? (index.h("chat-loading-placeholder", { progress: this.loadingProgress, loadingStatus: this.loadingStatus })) : (index.h(index.Fragment, null, this.isConversationLoading ? (index.h("div", { class: "loaderoverlay" }, index.h("spinner-loader", { height: "30px", width: "30px", spinTime: "1s", spinnerPrimaryColor: "var(--bg-primary-color)", spinnerSecondaryColor: "var(--text-primary-color)", spinnerBorderWidth: "2px" }))) : null, index.h("div", { class: {
|
|
2821
|
+
'isometrik-quickchat': true,
|
|
2822
|
+
'is-resizing': this.isResizingSidebar,
|
|
2823
|
+
'is-instagram-gate': !this.isInstagramConnected,
|
|
2824
|
+
}, style: { '--sidebar-width': `${this.sidebarListWidth}px` } }, index.h("div", { class: {
|
|
2825
|
+
'chat-sidebar-container': true,
|
|
2826
|
+
'hidden': this.isMobileView && !this.showSidebar,
|
|
2827
|
+
'is-resizing': this.isResizingSidebar,
|
|
2828
|
+
'is-full-gate': !this.isInstagramConnected,
|
|
2829
|
+
} }, index.h("profile-sidebar", { userMetaData: this.userMetaData, activeTab: this.activeTab, openChat: this.openChatTab, openAccounts: () => (this.activeTab = 'Accounts'), isMqttConnected: this.isMqttConnected, unreadConversationsCount: this.isInstagramConnected ? this.unreadConversationsCount : 0 }), index.h("div", { class: 'sidebar-tab' }, this.activeTab === 'GroupCast' ? (index.h("group-cast", { isLoadingMore: this.isLoadingMoreGroupcast, groupCastData: this.allGroupCastContacts, onGroupcastTileSelected: (e) => this.handleChatSelect(e.detail) })) : this.activeTab === 'Chat' && this.isInstagramConnected ? (index.h("chat-side-bar", { conversationDetails: this.conversationMetaData, isMqttConnected: this.isMqttConnected, unreadConversationsCount: this.unreadConversationsCount, hasMoreConversations: this.hasMoreConversations, userMetaData: this.userMetaData, onChatTileSelected: (e) => this.handleChatSelect(e.detail), onDeleteConversation: (conversationId) => this.deleteConversation(conversationId), conversationList: this.allConversationList, isTyping: this.isTyping, typingUserName: this.typingUserName, typingConversationId: this.typingConversationId,
|
|
2830
|
+
// unreadMessageCount={this.unreadMessageCount}
|
|
2831
|
+
//@ts-ignore
|
|
2832
|
+
isChatFilter: this.isChatFilter, customTypes: [
|
|
2833
|
+
{ type: 'Test conversations', label: 'Unread' },
|
|
2834
|
+
{ type: 'SingleChat', label: 'Past' },
|
|
2835
|
+
{ type: 'Chatbot', label: 'Present' },
|
|
2836
|
+
], isAllChatButton: this.isAllChatButton, filterTabsContainer: {
|
|
2837
|
+
display: 'flex',
|
|
2838
|
+
gap: '10px',
|
|
2839
|
+
width: '100%',
|
|
2840
|
+
flexWrap: 'wrap',
|
|
2841
|
+
marginBottom: '10px',
|
|
2842
|
+
}, filterTab: {
|
|
2843
|
+
padding: '6px 12px',
|
|
2844
|
+
border: '1px solid var(--border-subtle)',
|
|
2845
|
+
borderRadius: 'var(--radius-pill)',
|
|
2846
|
+
backgroundColor: 'transparent',
|
|
2847
|
+
cursor: 'pointer',
|
|
2848
|
+
transition: 'background-color 0.18s, color 0.18s',
|
|
2849
|
+
color: 'var(--text-secondary-color)',
|
|
2850
|
+
fontSize: '13px',
|
|
2851
|
+
fontWeight: '500',
|
|
2852
|
+
}, filterTabHover: {
|
|
2853
|
+
backgroundColor: 'var(--bg-primary-light)',
|
|
2854
|
+
color: 'var(--text-primary-color)',
|
|
2855
|
+
}, isSidebarHeaderLabel: this.isSidebarHeaderLabel, isSidebarHeaderSearch: this.isSidebarHeaderSearch, sidebarHeaderLabel: this.sidebarHeaderLabel, sidebarColor: this.sidebarColor, sidebarSelectedColor: this.sidebarSelectedColor, onGroupExited: (e) => this.handleGroupExited(e), handleSearchData: (searchTag) => this.getConversations(0, searchTag, true), allMessages: this.allMessages, isConversationLoading: this.isLoadingConversationList })) : this.activeTab === 'Accounts' || !this.isInstagramConnected ? (index.h("instagram-accounts-panel", { agentUserId: (_a = this.userMetaData) === null || _a === void 0 ? void 0 : _a.userId, defaultTheme: this.defaultTheme, toggleTheme: this.toggleTheme, closeDrawer: this.closeAccountsDrawer, hideClose: !this.isInstagramConnected, onInstagramAccountsChange: (e) => this.handleInstagramAccountsChange(e.detail || []) })) : (index.h("profile-page", { getUserDetails: this.getUserDetails, name: this.userMetaData.userName, profilePhotoUrl: this.userMetaData.userProfileImageUrl, closeDrawer: () => (this.activeTab = this.isInstagramConnected ? 'Chat' : 'Accounts'), toggleTheme: this.toggleTheme, defaultTheme: this.defaultTheme, agentUserId: (_b = this.userMetaData) === null || _b === void 0 ? void 0 : _b.userId, onInstagramAccountsChanged: (e) => this.handleInstagramAccountsChange(e.detail || []) }))), !this.isMobileView && this.isInstagramConnected ? (index.h("div", { class: {
|
|
2856
|
+
'sidebar-resize-handle': true,
|
|
2857
|
+
'active': this.isResizingSidebar,
|
|
2858
|
+
}, role: "separator", "aria-orientation": "vertical", "aria-label": "Resize sidebar", "aria-valuenow": this.sidebarListWidth, "aria-valuemin": this.SIDEBAR_MIN, "aria-valuemax": this.SIDEBAR_MAX, onPointerDown: this.startSidebarResize }, index.h("span", { class: "sidebar-resize-grip", "aria-hidden": "true" }))) : null), this.isInstagramConnected ? (index.h("div", { class: {
|
|
2859
|
+
'chat-body-container': true,
|
|
2860
|
+
'show': this.isMobileView && this.selectedConversationId && !this.showSidebar,
|
|
2861
|
+
} }, this.selectedConversationId ? (index.h(index.Fragment, null, index.h("web-chat-header", { searchedMessageDetails: this.searchedMessageDetails, onSearchHandler: (text) => this.getMessagesByQuery(text), onSearchResultClick: this.handleSearchResultClick, headerBgColor: "var(--bg-primary-color)", headerLastSeenColor: "var(--text-last-seen)", headerSvgColor: "var(--text-primary-color)", headerUsernameColor: "var(--text-primary-color)", onClearConversation: () => this.clearConversation(), conversationDetails: this.conversationMetaData, isTyping: this.isTyping && this.selectedConversationId === this.typingConversationId, typingUserName: this.typingUserName, chatBodyRef: this.chatBodyRef, onTextClick: () => this.getAllAttachments(this.selectedConversationId), allAttachments: this.allAttachments, lastSeen: (_d = (_c = this.conversationMetaData) === null || _c === void 0 ? void 0 : _c.opponentDetails) === null || _d === void 0 ? void 0 : _d.lastSeen, userMetaData: this.userMetaData, selectedConversationId: this.selectedConversationId, messageAction: this.messageAction, eligibleMembers: this.eligibleMembers, hasMoreEligibleMembers: this.hasMoreEligibleMembers, handleCloseChat: () => this.handleCloseChat(), typingConversationId: this.typingConversationId, isBlocked: this.isBlocked, onBackButtonClick: this.handleBackButton }), index.h("web-chat-body", { ref: el => (this.chatBodyRef = el), allAttachments: this.allAttachments, isMessagesLoading: this.isMessagesLoading, updateSkip: this.updateSkip, isMessageLimitEnd: this.isMessageLimitEnd, allMessages: this.allMessages, userMetaData: this.userMetaData, skip: this.skip, isScrollToBottom: this.isScrollToBottom, changeScrollToBottomState: this.changeScrollToBottomState, isMessageSending: this.isMessageSending, isScrollToTop: this.isScrollToTop, changeScrollToTopState: this.changeScrollToTopState, deleteForSelf: this.deleteMessageFromSelf, deleteForAll: this.deleteMeassageFromEveryOne, isChatClosed: this.isChatClosed, isChatMinimized: this.isChatMinimized, updateAllMessages: this.updateAllMessages, selectedConversationId: this.selectedConversationId, highlightedMessageId: this.highlightedMessageId, onMediaClick: () => this.getAllAttachments(this.selectedConversationId), onReplyMessageDetails: this.handleReplyMessage, conversationList: this.allConversationList, newMessageNotification: this.newMessageNotification, onNewMessageCountReset: () => this.resetNewMessageNotification(), conversationDetails: this.conversationMetaData, loadingMediaGallery: this.loadingMediaGallery }), this.exitedGroupIds.has(this.selectedConversationId) ? (index.h("div", { style: {
|
|
2862
|
+
padding: '1rem',
|
|
2863
|
+
textAlign: 'center',
|
|
2864
|
+
backgroundColor: 'var(--bg-primary-color)',
|
|
2865
|
+
color: 'var(--text-secondary-color)',
|
|
2866
|
+
borderTop: '1px solid var(--border-subtle)',
|
|
2867
|
+
fontSize: '13px',
|
|
2868
|
+
} }, "You are no longer a member of this group")) : this.isBlocked === 'loading' ? (index.h("p", { class: "blockMessageContainer" }, content.WEB_CONTENT.PLEASE_WAIT)) : ((_e = this.conversationMetaData) === null || _e === void 0 ? void 0 : _e.messagingDisabled) ? (index.h("p", { class: "blockMessageContainer" }, content.WEB_CONTENT.BLOCK_CHAT_MESSAGE)) : (index.h("chat-footer", { userMetaData: this.userMetaData, updateAllMessages: this.updateAllMessages, changeMessageSendingState: this.changeMessageSendingState, changeScrollToBottomState: this.changeScrollToBottomState, refetchMessages: this.refetchMessages, allMessages: this.allMessages, selectedConversationId: this.selectedConversationId, replyMessage: this.replyMessage, handleremoveReplyMessage: this.handleremoveReplyMessage, conversationDetails: this.conversationMetaData, allConversationList: this.allConversationList, updateConversationListProp: this.updateConversationList })))) : (index.h("div", { class: "noChatSelectedPlaceholder" }, index.h("div", { class: "empty-mark", "aria-hidden": "true" }, index.h("span", null), index.h("span", null)), index.h("h2", null, "Select a chat"), index.h("p", null, "Open a thread on the left to get started."))))) : null, this.isInstagramConnected && this.showRightSideBar ? (index.h("div", { class: 'chat-sidebar-right' }, index.h("web-chat-right-sidebar", { conversationMetaData: this.isProfileInfoOpen ? this.selctConversationMetaData : this.conversationMetaData, selectedConversationId: this.selectedConversationId, hasMoreEligibleMembers: this.hasMoreEligibleMembers, eligibleMembers: this.eligibleMembers, allAttachments: this.isProfileInfoOpen ? this.selectConverSationAttachments : this.allAttachments, userMetaData: this.userMetaData, messageAction: this.messageAction, searchedMessageDetails: this.searchedMessageDetails, onSearchHandler: (text) => this.getMessagesByQuery(text), onSearchResultClick: this.handleSearchResultClick, isContactInfoOpen: this.isContactInfoOpen, isProfileInfoOpen: this.isProfileInfoOpen, isOpenSearchBar: this.isOpenSearchBar, chatBodyRef: this.chatBodyRef, isLoadingMessage: this.isLoadingMessage, conversationIdFromContactinfo: this.conversationIdFromContactinfo, openOwnProfile: () => (this.activeTab = 'Profile'), handleChatSelect: conversationId => this.handleChatSelect(conversationId), allLinks: this.allLinks, allLinksCount: this.allLinksCount, isBlocked: this.isBlocked, groupcastMembers: this.groupcastMembers }))) : null)))));
|
|
2869
|
+
}
|
|
2870
|
+
static get watchers() { return {
|
|
2871
|
+
"selectedConversationId": ["handleConversationChange", "handleSelectedConversationChange"],
|
|
2872
|
+
"skip": ["handleSkipChange"],
|
|
2873
|
+
"isTyping": ["handleTypingChange"],
|
|
2874
|
+
"initialConversationIdFromURL": ["handleSelectedConversationChange"],
|
|
2875
|
+
"allMessages": ["handlemessageAction"],
|
|
2876
|
+
"selectConversationMessages": ["handlemessageAction"],
|
|
2877
|
+
"conversationMetaData": ["watchPropHandler"]
|
|
2878
|
+
}; }
|
|
2879
|
+
};
|
|
2880
|
+
WebChat.style = WebChatStyle0;
|
|
2881
|
+
|
|
2882
|
+
exports.WebChat = WebChat;
|
|
2883
|
+
|
|
2884
|
+
//# sourceMappingURL=WebChat-403e7ab1.js.map
|