isometrik-plugin-chat-sdk 1.3.19 → 2.0.1
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/dist/cjs/app-globals-61a8bfde.js +38 -0
- package/dist/cjs/app-globals-61a8bfde.js.map +1 -0
- package/dist/cjs/attachment-preview_22.cjs.entry.js +122 -44
- package/dist/cjs/attachment-preview_22.cjs.entry.js.map +1 -1
- package/dist/cjs/audio-bubble_4.cjs.entry.js +38 -8
- package/dist/cjs/audio-bubble_4.cjs.entry.js.map +1 -1
- package/dist/cjs/chat-app.cjs.entry.js +2 -2
- package/dist/cjs/chat-app.cjs.entry.js.map +1 -1
- package/dist/cjs/{chat-creds-cf537d4b.js → chat-creds-2dbc4087.js} +3 -3
- package/dist/cjs/chat-creds-2dbc4087.js.map +1 -0
- package/dist/cjs/chat-document-message-bubble.cjs.entry.js +1 -1
- package/dist/cjs/chat-image-message-bubble.cjs.entry.js +1 -1
- package/dist/cjs/chat-video-message-bubble.cjs.entry.js +1 -1
- package/dist/cjs/client-80851676.js +482 -0
- package/dist/cjs/client-80851676.js.map +1 -0
- package/dist/cjs/{contracts-31632812.js → contracts-dfc84075.js} +2 -2
- package/dist/cjs/contracts-dfc84075.js.map +1 -0
- package/dist/cjs/destroy-chat-7ae8fc99.js +24 -0
- package/dist/cjs/destroy-chat-7ae8fc99.js.map +1 -0
- package/dist/cjs/doublecheck-c2461adc.js +36 -0
- package/dist/cjs/doublecheck-c2461adc.js.map +1 -0
- package/dist/cjs/{drawer-28cc94a4.js → drawer-811d2ce8.js} +2 -2
- package/dist/cjs/{drawer-28cc94a4.js.map → drawer-811d2ce8.js.map} +1 -1
- package/dist/cjs/forward-memebers.cjs.entry.js +2 -2
- package/dist/cjs/forward-message.cjs.entry.js +2 -2
- package/dist/cjs/group-chat-contacts.cjs.entry.js +2 -2
- package/dist/cjs/{group-members-73ad1074.js → group-members-5a82ec8a.js} +1 -125
- package/dist/cjs/group-members-5a82ec8a.js.map +1 -0
- package/dist/cjs/{helpers-8061ec7d.js → helpers-154861e9.js} +2 -2
- package/dist/cjs/{helpers-8061ec7d.js.map → helpers-154861e9.js.map} +1 -1
- package/dist/cjs/{index-1a26d11d.js → index-66f98408.js} +2 -2
- package/dist/cjs/index-66f98408.js.map +1 -0
- package/dist/cjs/index.cjs.js +55 -182
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/isometrik-webchat.cjs.js +10 -2
- package/dist/cjs/isometrik-webchat.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +10 -2
- package/dist/cjs/loader.cjs.js.map +1 -1
- package/dist/cjs/login-page_3.cjs.entry.js +689 -369
- package/dist/cjs/login-page_3.cjs.entry.js.map +1 -1
- package/dist/cjs/media-gallery.cjs.entry.js +1 -1
- package/dist/cjs/media-limits-eba42629.js +165 -0
- package/dist/cjs/media-limits-eba42629.js.map +1 -0
- package/dist/cjs/member-add.cjs.entry.js +3 -3
- package/dist/cjs/message-bubble.cjs.entry.js +30 -8
- package/dist/cjs/message-bubble.cjs.entry.js.map +1 -1
- package/dist/cjs/my-component.cjs.entry.js +1 -1
- package/dist/cjs/new-chat-sidebar.cjs.entry.js +2 -2
- package/dist/cjs/reaction-container.cjs.entry.js +4 -4
- package/dist/cjs/runtime-controls-201c71ba.js +650 -0
- package/dist/cjs/runtime-controls-201c71ba.js.map +1 -0
- package/dist/cjs/send-media-14908d4b.js +375 -0
- package/dist/cjs/send-media-14908d4b.js.map +1 -0
- package/dist/cjs/signup-page.cjs.entry.js +1 -1
- package/dist/cjs/{toast-0bf1e688.js → toast-f810e550.js} +8 -8
- package/dist/cjs/toast-f810e550.js.map +1 -0
- package/dist/collection/collection-manifest.json +2 -1
- package/dist/collection/components/ChatUIComponent/ChatDocumentMessageBubble.js +1 -1
- package/dist/collection/components/ChatUIComponent/ChatImageMessageBubble.js +1 -1
- package/dist/collection/components/ChatUIComponent/ChatVideoMessageBubble.js +1 -1
- package/dist/collection/components/ChatUIComponent/Footer/ChatFooter.js +61 -14
- package/dist/collection/components/ChatUIComponent/Footer/ChatFooter.js.map +1 -1
- package/dist/collection/components/ChatUIComponent/ReactionContainer.js +2 -2
- package/dist/collection/components/ChatUIComponent/WebChatBody/WebChatBody.js +7 -6
- package/dist/collection/components/ChatUIComponent/WebChatBody/WebChatBody.js.map +1 -1
- package/dist/collection/components/ChatUIComponent/shared/attachment-preview/attachment-preview.js +39 -8
- package/dist/collection/components/ChatUIComponent/shared/attachment-preview/attachment-preview.js.map +1 -1
- package/dist/collection/components/ChatUIComponent/shared/document-message/document-message.js +53 -3
- package/dist/collection/components/ChatUIComponent/shared/document-message/document-message.js.map +1 -1
- package/dist/collection/components/ChatUIComponent/shared/forward-message/forward-message.js +2 -2
- package/dist/collection/components/ChatUIComponent/shared/image-message/image-message.js +19 -1
- package/dist/collection/components/ChatUIComponent/shared/image-message/image-message.js.map +1 -1
- package/dist/collection/components/ChatUIComponent/shared/incoming-text-message-bubble/incoming-text-message-bubble.js +1 -1
- package/dist/collection/components/ChatUIComponent/shared/message-bubble/message-bubble.js +47 -7
- package/dist/collection/components/ChatUIComponent/shared/message-bubble/message-bubble.js.map +1 -1
- package/dist/collection/components/ChatUIComponent/shared/message-date-pill/message-date-pill.js +1 -1
- package/dist/collection/components/ChatUIComponent/shared/new chat/new-chat.stories.js +1 -1
- package/dist/collection/components/ChatUIComponent/shared/outgoing-text-message-bubble/outgoing-text-message-bubble.js +19 -1
- package/dist/collection/components/ChatUIComponent/shared/outgoing-text-message-bubble/outgoing-text-message-bubble.js.map +1 -1
- package/dist/collection/components/ChatUIComponent/shared/reply-message-container/reply-message-container.js +1 -1
- package/dist/collection/components/ChatUIComponent/shared/video-message/video-message.js +20 -2
- package/dist/collection/components/ChatUIComponent/shared/video-message/video-message.js.map +1 -1
- package/dist/collection/components/my-component/my-component.js +1 -1
- package/dist/collection/components/my-component/web-chat/FLOW.js +1 -1
- package/dist/collection/components/my-component/web-chat/FLOW.js.map +1 -1
- package/dist/collection/components/my-component/web-chat/WebChat.js +113 -12
- package/dist/collection/components/my-component/web-chat/WebChat.js.map +1 -1
- package/dist/collection/components/my-component/web-chat/bootstrap.js +7 -0
- package/dist/collection/components/my-component/web-chat/bootstrap.js.map +1 -1
- package/dist/collection/components/my-component/web-chat/data-fetch.js +14 -5
- package/dist/collection/components/my-component/web-chat/data-fetch.js.map +1 -1
- package/dist/collection/components/my-component/web-chat/mqtt-host.js +133 -34
- package/dist/collection/components/my-component/web-chat/mqtt-host.js.map +1 -1
- package/dist/collection/components/my-component/web-chat/offline-host.js +212 -0
- package/dist/collection/components/my-component/web-chat/offline-host.js.map +1 -0
- package/dist/collection/components/my-component/web-chat/public-send.js +96 -21
- package/dist/collection/components/my-component/web-chat/public-send.js.map +1 -1
- package/dist/collection/components/my-component/web-chat/shell-render.js +47 -28
- package/dist/collection/components/my-component/web-chat/shell-render.js.map +1 -1
- package/dist/collection/components/theme-provider.js +114 -45
- package/dist/collection/components/theme-provider.js.map +1 -1
- package/dist/collection/constants/chat-creds.js +2 -2
- package/dist/collection/demos/custom-ui-demo-elements.js +2 -2
- package/dist/collection/demos/custom-ui-demo-elements.js.map +1 -1
- package/dist/collection/global/expose-sdk.js +29 -0
- package/dist/collection/global/expose-sdk.js.map +1 -0
- package/dist/collection/index.js +10 -141
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/lib/chat/index.js +3 -0
- package/dist/collection/lib/chat/index.js.map +1 -1
- package/dist/collection/lib/chat/media-limits.js +21 -0
- package/dist/collection/lib/chat/media-limits.js.map +1 -0
- package/dist/collection/lib/chat/media-outbox.js +43 -0
- package/dist/collection/lib/chat/media-outbox.js.map +1 -0
- package/dist/collection/lib/chat/preview-kind.js +41 -0
- package/dist/collection/lib/chat/preview-kind.js.map +1 -0
- package/dist/collection/lib/chat/send-media.js +5 -2
- package/dist/collection/lib/chat/send-media.js.map +1 -1
- package/dist/collection/lib/custom-ui/contracts.js +1 -1
- package/dist/collection/lib/custom-ui/contracts.js.map +1 -1
- package/dist/collection/lib/custom-ui/index.js +1 -1
- package/dist/collection/lib/custom-ui/index.js.map +1 -1
- package/dist/collection/lib/custom-ui/public-api.js +1 -0
- package/dist/collection/lib/custom-ui/public-api.js.map +1 -1
- package/dist/collection/lib/destroy-chat.js +15 -16
- package/dist/collection/lib/destroy-chat.js.map +1 -0
- package/dist/collection/lib/mqtt/inbound-queue.js +17 -0
- package/dist/collection/lib/mqtt/inbound-queue.js.map +1 -0
- package/dist/collection/lib/mqtt/index.js +2 -1
- package/dist/collection/lib/mqtt/index.js.map +1 -1
- package/dist/collection/lib/mqtt/session.js +50 -6
- package/dist/collection/lib/mqtt/session.js.map +1 -1
- package/dist/collection/lib/offline/client.js +167 -0
- package/dist/collection/lib/offline/client.js.map +1 -0
- package/dist/collection/lib/offline/idb.js +181 -0
- package/dist/collection/lib/offline/idb.js.map +1 -0
- package/dist/collection/lib/offline/index.js +10 -0
- package/dist/collection/lib/offline/index.js.map +1 -0
- package/dist/collection/lib/offline/memory-db.js +64 -0
- package/dist/collection/lib/offline/memory-db.js.map +1 -0
- package/dist/collection/lib/offline/merge.js +24 -0
- package/dist/collection/lib/offline/merge.js.map +1 -0
- package/dist/collection/lib/offline/multitab.js +47 -0
- package/dist/collection/lib/offline/multitab.js.map +1 -0
- package/dist/collection/lib/offline/types.js +2 -0
- package/dist/collection/lib/offline/types.js.map +1 -0
- package/dist/collection/lib/toast.js +6 -6
- package/dist/collection/lib/toast.js.map +1 -1
- package/dist/collection/sdk/api.js +4 -0
- package/dist/collection/sdk/api.js.map +1 -0
- package/dist/collection/sdk/composition.js +43 -0
- package/dist/collection/sdk/composition.js.map +1 -0
- package/dist/collection/sdk/headless-api.js +37 -0
- package/dist/collection/sdk/headless-api.js.map +1 -0
- package/dist/collection/sdk/index.js +11 -0
- package/dist/collection/sdk/index.js.map +1 -0
- package/dist/collection/sdk/init.js +207 -0
- package/dist/collection/sdk/init.js.map +1 -0
- package/dist/collection/sdk/instance.js +63 -0
- package/dist/collection/sdk/instance.js.map +1 -0
- package/dist/collection/sdk/react-bridge.js +145 -0
- package/dist/collection/sdk/react-bridge.js.map +1 -0
- package/dist/collection/sdk/runtime-controls.js +54 -0
- package/dist/collection/sdk/runtime-controls.js.map +1 -0
- package/dist/collection/sdk/slots.js +57 -0
- package/dist/collection/sdk/slots.js.map +1 -0
- package/dist/collection/sdk/theme-tokens.js +99 -0
- package/dist/collection/sdk/theme-tokens.js.map +1 -0
- package/dist/collection/sdk/webchat-api.js +36 -0
- package/dist/collection/sdk/webchat-api.js.map +1 -0
- package/dist/collection/testing/chat-assets-mock.js +45 -0
- package/dist/collection/testing/chat-creds-mock.js +18 -0
- package/dist/collection/testing/emoji-picker-mock.js +2 -0
- package/dist/collection/testing/file-mock.js +1 -0
- package/dist/collection/testing/groupcast-mock.js +7 -0
- package/dist/collection/testing/helpers-mock.js +4 -0
- package/dist/collection/testing/iso-chat-sdk-mock.js +19 -0
- package/dist/collection/testing/toast-mock.js +2 -0
- package/dist/components/ChatFooter.js +62 -15
- package/dist/components/ChatFooter.js.map +1 -1
- package/dist/components/ChatSidebar.js +1 -1
- package/dist/components/{GroupCast.js → GroupCast2.js} +2 -2
- package/dist/components/GroupCast2.js.map +1 -0
- package/dist/components/WebChat.js +624 -305
- package/dist/components/WebChat.js.map +1 -1
- package/dist/components/WebChatBody.js +8 -7
- package/dist/components/WebChatBody.js.map +1 -1
- package/dist/components/attachment-preview2.js +40 -9
- package/dist/components/attachment-preview2.js.map +1 -1
- package/dist/components/chat-app.js +3 -3
- package/dist/components/chat-app.js.map +1 -1
- package/dist/components/chat-assets.js +1 -1
- package/dist/components/chat-creds.js +2 -2
- package/dist/components/chat-creds.js.map +1 -1
- package/dist/components/chat-document-message-bubble.js +1 -1
- package/dist/components/chat-image-message-bubble.js +1 -1
- package/dist/components/chat-tile2.js +1 -1
- package/dist/components/chat-video-message-bubble.js +1 -1
- package/dist/components/client.js +728 -0
- package/dist/components/client.js.map +1 -0
- package/dist/components/contact-info2.js +2 -117
- package/dist/components/contact-info2.js.map +1 -1
- package/dist/components/contracts.js +1 -1
- package/dist/components/contracts.js.map +1 -1
- package/dist/components/destroy-chat.js +14 -16
- package/dist/components/destroy-chat.js.map +1 -1
- package/dist/components/document-message2.js +35 -5
- package/dist/components/document-message2.js.map +1 -1
- package/dist/components/forward-message.js +2 -2
- package/dist/components/group-cast.js +1 -1
- package/dist/components/{groupcast2.js → groupcast.js} +1 -1
- package/dist/components/groupcast.js.map +1 -0
- package/dist/components/image-message2.js +3 -1
- package/dist/components/image-message2.js.map +1 -1
- package/dist/components/incoming-text-message-bubble2.js +1 -1
- package/dist/components/index.js +551 -60
- package/dist/components/index.js.map +1 -1
- package/dist/components/index2.js +1 -1
- package/dist/components/index2.js.map +1 -1
- package/dist/components/media-limits.js +24 -0
- package/dist/components/media-limits.js.map +1 -0
- package/dist/components/member-add.js +1 -1
- package/dist/components/message-bubble2.js +31 -7
- package/dist/components/message-bubble2.js.map +1 -1
- package/dist/components/message-date-pill2.js +1 -1
- package/dist/components/messages.js +131 -0
- package/dist/components/messages.js.map +1 -0
- package/dist/components/my-component.js +1 -1
- package/dist/components/outgoing-text-message-bubble2.js +3 -1
- package/dist/components/outgoing-text-message-bubble2.js.map +1 -1
- package/dist/components/preview-kind.js +30 -0
- package/dist/components/preview-kind.js.map +1 -0
- package/dist/components/reaction-container.js +2 -2
- package/dist/components/reply-message-container2.js +1 -1
- package/dist/components/theme-provider2.js +56 -44
- package/dist/components/theme-provider2.js.map +1 -1
- package/dist/components/theme-tokens.js +102 -0
- package/dist/components/theme-tokens.js.map +1 -0
- package/dist/components/toast.js +6 -6
- package/dist/components/toast.js.map +1 -1
- package/dist/components/video-message2.js +4 -2
- package/dist/components/video-message2.js.map +1 -1
- package/dist/esm/app-globals-2beecb81.js +36 -0
- package/dist/esm/app-globals-2beecb81.js.map +1 -0
- package/dist/esm/attachment-preview_22.entry.js +120 -42
- package/dist/esm/attachment-preview_22.entry.js.map +1 -1
- package/dist/esm/audio-bubble_4.entry.js +39 -9
- package/dist/esm/audio-bubble_4.entry.js.map +1 -1
- package/dist/esm/chat-app.entry.js +2 -2
- package/dist/esm/chat-app.entry.js.map +1 -1
- package/dist/esm/{chat-assets-e3173222.js → chat-assets-bb056958.js} +2 -2
- package/dist/esm/{chat-assets-e3173222.js.map → chat-assets-bb056958.js.map} +1 -1
- package/dist/esm/{chat-creds-5d0982fc.js → chat-creds-aafad4d0.js} +3 -3
- package/dist/esm/chat-creds-aafad4d0.js.map +1 -0
- package/dist/esm/chat-document-message-bubble.entry.js +1 -1
- package/dist/esm/chat-image-message-bubble.entry.js +1 -1
- package/dist/esm/chat-tile_3.entry.js +1 -1
- package/dist/esm/chat-video-message-bubble.entry.js +1 -1
- package/dist/esm/client-4a3e00da.js +477 -0
- package/dist/esm/client-4a3e00da.js.map +1 -0
- package/dist/esm/{contracts-614be4db.js → contracts-50f4ddae.js} +2 -2
- package/dist/esm/contracts-50f4ddae.js.map +1 -0
- package/dist/esm/destroy-chat-d0ee28d6.js +22 -0
- package/dist/esm/destroy-chat-d0ee28d6.js.map +1 -0
- package/dist/esm/doublecheck-261763ef.js +32 -0
- package/dist/esm/doublecheck-261763ef.js.map +1 -0
- package/dist/esm/{drawer-8f721119.js → drawer-74c188f1.js} +2 -2
- package/dist/esm/{drawer-8f721119.js.map → drawer-74c188f1.js.map} +1 -1
- package/dist/esm/forward-memebers.entry.js +3 -3
- package/dist/esm/forward-message.entry.js +2 -2
- package/dist/esm/group-chat-contacts.entry.js +2 -2
- package/dist/esm/{group-members-806fd7a2.js → group-members-05414da2.js} +2 -118
- package/dist/esm/group-members-05414da2.js.map +1 -0
- package/dist/esm/{groupcast-2ce7187f.js → groupcast-9c7d2a32.js} +2 -2
- package/dist/esm/{groupcast-2ce7187f.js.map → groupcast-9c7d2a32.js.map} +1 -1
- package/dist/esm/{helpers-4c6d09a7.js → helpers-f33b895c.js} +2 -2
- package/dist/esm/{helpers-4c6d09a7.js.map → helpers-f33b895c.js.map} +1 -1
- package/dist/esm/{index-beb184c6.js → index-4c865e34.js} +2 -2
- package/dist/esm/index-4c865e34.js.map +1 -0
- package/dist/esm/index.js +17 -171
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/isometrik-webchat.js +10 -2
- package/dist/esm/isometrik-webchat.js.map +1 -1
- package/dist/esm/loader.js +10 -2
- package/dist/esm/loader.js.map +1 -1
- package/dist/esm/login-page_3.entry.js +672 -352
- package/dist/esm/login-page_3.entry.js.map +1 -1
- package/dist/esm/media-gallery.entry.js +1 -1
- package/dist/esm/media-limits-3fa07c09.js +152 -0
- package/dist/esm/media-limits-3fa07c09.js.map +1 -0
- package/dist/esm/member-add.entry.js +5 -5
- package/dist/esm/message-bubble.entry.js +30 -8
- package/dist/esm/message-bubble.entry.js.map +1 -1
- package/dist/esm/my-component.entry.js +1 -1
- package/dist/esm/new-chat-sidebar.entry.js +3 -3
- package/dist/esm/reaction-container.entry.js +4 -4
- package/dist/esm/runtime-controls-cf599fe2.js +623 -0
- package/dist/esm/runtime-controls-cf599fe2.js.map +1 -0
- package/dist/esm/send-media-917dcc2f.js +353 -0
- package/dist/esm/send-media-917dcc2f.js.map +1 -0
- package/dist/esm/signup-page.entry.js +1 -1
- package/dist/esm/{toast-d8ea763c.js → toast-533dd183.js} +8 -8
- package/dist/esm/toast-533dd183.js.map +1 -0
- package/dist/isometrik-webchat/index.esm.js +1 -1
- package/dist/isometrik-webchat/index.esm.js.map +1 -1
- package/dist/isometrik-webchat/isometrik-webchat.css +1 -1
- package/dist/isometrik-webchat/isometrik-webchat.esm.js +1 -1
- package/dist/isometrik-webchat/isometrik-webchat.esm.js.map +1 -1
- package/dist/isometrik-webchat/p-0731d488.js +2 -0
- package/dist/isometrik-webchat/p-0731d488.js.map +1 -0
- package/dist/isometrik-webchat/{p-a15092d9.entry.js → p-1854b156.entry.js} +2 -2
- package/dist/isometrik-webchat/p-1854b156.entry.js.map +1 -0
- package/dist/isometrik-webchat/{p-5fea3fd2.entry.js → p-2d3e8cd4.entry.js} +2 -2
- package/dist/isometrik-webchat/p-315eee9a.js +2 -0
- package/dist/isometrik-webchat/p-315eee9a.js.map +1 -0
- package/dist/isometrik-webchat/{p-e7f58d3f.entry.js → p-39b626ed.entry.js} +2 -2
- package/dist/isometrik-webchat/{p-eb1f3118.entry.js → p-3c70c22c.entry.js} +2 -2
- package/dist/isometrik-webchat/p-4cb54460.js +2 -0
- package/dist/isometrik-webchat/p-4cb54460.js.map +1 -0
- package/dist/isometrik-webchat/{p-f24cdbbb.js → p-5162774c.js} +1 -1
- package/dist/isometrik-webchat/p-5162774c.js.map +1 -0
- package/dist/isometrik-webchat/p-53ee98a7.entry.js +2 -0
- package/dist/isometrik-webchat/p-53ee98a7.entry.js.map +1 -0
- package/dist/isometrik-webchat/{p-5cbc1a16.entry.js → p-586f6978.entry.js} +2 -2
- package/dist/isometrik-webchat/{p-5f7eebbf.entry.js → p-5d243250.entry.js} +2 -2
- package/dist/isometrik-webchat/{p-23df1c24.js → p-5d98a8a0.js} +2 -2
- package/dist/isometrik-webchat/p-7f415f28.js +2 -0
- package/dist/isometrik-webchat/p-7f415f28.js.map +1 -0
- package/dist/isometrik-webchat/{p-d386acfe.js → p-7fd2c1ad.js} +1 -1
- package/dist/isometrik-webchat/p-7fd2c1ad.js.map +1 -0
- package/dist/isometrik-webchat/{p-e5884258.js → p-9982fa21.js} +2 -2
- package/dist/isometrik-webchat/{p-4db39c93.js → p-a5707f12.js} +2 -2
- package/dist/isometrik-webchat/{p-af775c83.entry.js → p-a876991d.entry.js} +2 -2
- package/dist/isometrik-webchat/{p-7b80b0b2.js → p-adc45831.js} +1 -1
- package/dist/isometrik-webchat/p-adc45831.js.map +1 -0
- package/dist/isometrik-webchat/p-ae168135.js +2 -0
- package/dist/isometrik-webchat/p-ae168135.js.map +1 -0
- package/dist/isometrik-webchat/{p-a6897edc.js → p-b1330793.js} +1 -1
- package/dist/isometrik-webchat/p-b1330793.js.map +1 -0
- package/dist/isometrik-webchat/p-b61d6c0c.entry.js +2 -0
- package/dist/isometrik-webchat/p-b61d6c0c.entry.js.map +1 -0
- package/dist/isometrik-webchat/p-b667a9fc.js +2 -0
- package/dist/isometrik-webchat/p-b667a9fc.js.map +1 -0
- package/dist/isometrik-webchat/p-b857775d.entry.js +2 -0
- package/dist/isometrik-webchat/p-bdcdf1c5.js +2 -0
- package/dist/isometrik-webchat/p-bdcdf1c5.js.map +1 -0
- package/dist/isometrik-webchat/p-c0c19621.entry.js +2 -0
- package/dist/isometrik-webchat/{p-064d6200.entry.js → p-ca47d693.entry.js} +2 -2
- package/dist/isometrik-webchat/p-d720cf14.entry.js +2 -0
- package/dist/isometrik-webchat/{p-53695fc6.entry.js.map → p-d720cf14.entry.js.map} +1 -1
- package/dist/isometrik-webchat/{p-5c22ee37.entry.js → p-d892b4d4.entry.js} +2 -2
- package/dist/isometrik-webchat/{p-7eb12da3.js → p-dd62bd69.js} +2 -2
- package/dist/isometrik-webchat/p-eb54f75d.js +2 -0
- package/dist/isometrik-webchat/p-eb54f75d.js.map +1 -0
- package/dist/isometrik-webchat/p-f1fbf3be.entry.js +2 -0
- package/dist/isometrik-webchat/p-f1fbf3be.entry.js.map +1 -0
- package/dist/isometrik-webchat/p-fb705915.entry.js +2 -0
- package/dist/isometrik-webchat/p-fb705915.entry.js.map +1 -0
- package/dist/isometrik-webchat/{p-2f6bb0a4.entry.js → p-fd6ce589.entry.js} +2 -2
- package/dist/isometrik-webchat/p-fdd327f5.entry.js +2 -0
- package/dist/types/components/ChatUIComponent/Footer/ChatFooter.d.ts +1 -0
- package/dist/types/components/ChatUIComponent/shared/attachment-preview/attachment-preview.d.ts +2 -0
- package/dist/types/components/ChatUIComponent/shared/document-message/document-message.d.ts +5 -0
- package/dist/types/components/ChatUIComponent/shared/image-message/image-message.d.ts +1 -0
- package/dist/types/components/ChatUIComponent/shared/message-bubble/message-bubble.d.ts +3 -0
- package/dist/types/components/ChatUIComponent/shared/outgoing-text-message-bubble/outgoing-text-message-bubble.d.ts +1 -0
- package/dist/types/components/ChatUIComponent/shared/video-message/video-message.d.ts +1 -0
- package/dist/types/components/my-component/web-chat/FLOW.d.ts +1 -1
- package/dist/types/components/my-component/web-chat/mqtt-host.d.ts +5 -0
- package/dist/types/components/my-component/web-chat/offline-host.d.ts +22 -0
- package/dist/types/components/theme-provider.d.ts +22 -27
- package/dist/types/components.d.ts +84 -11
- package/dist/types/demos/custom-ui-demo-elements.d.ts +1 -1
- package/dist/types/global/expose-sdk.d.ts +1 -0
- package/dist/types/index.d.ts +3 -44
- package/dist/types/lib/chat/index.d.ts +3 -0
- package/dist/types/lib/chat/media-limits.d.ts +11 -0
- package/dist/types/lib/chat/media-outbox.d.ts +8 -0
- package/dist/types/lib/chat/preview-kind.d.ts +30 -0
- package/dist/types/lib/custom-ui/contracts.d.ts +1 -1
- package/dist/types/lib/custom-ui/index.d.ts +1 -1
- package/dist/types/lib/custom-ui/public-api.d.ts +1 -1
- package/dist/types/lib/destroy-chat.d.ts +2 -0
- package/dist/types/lib/mqtt/inbound-queue.d.ts +7 -0
- package/dist/types/lib/mqtt/index.d.ts +2 -1
- package/dist/types/lib/mqtt/session.d.ts +22 -0
- package/dist/types/lib/offline/client.d.ts +44 -0
- package/dist/types/lib/offline/idb.d.ts +36 -0
- package/dist/types/lib/offline/index.d.ts +10 -0
- package/dist/types/lib/offline/memory-db.d.ts +20 -0
- package/dist/types/lib/offline/merge.d.ts +3 -0
- package/dist/types/lib/offline/multitab.d.ts +13 -0
- package/dist/types/lib/offline/types.d.ts +63 -0
- package/dist/types/sdk/api.d.ts +3 -0
- package/dist/types/sdk/composition.d.ts +32 -0
- package/dist/types/sdk/headless-api.d.ts +37 -0
- package/dist/types/sdk/index.d.ts +10 -0
- package/dist/types/sdk/init.d.ts +87 -0
- package/dist/types/sdk/instance.d.ts +15 -0
- package/dist/types/sdk/react-bridge.d.ts +64 -0
- package/dist/types/sdk/runtime-controls.d.ts +14 -0
- package/dist/types/sdk/slots.d.ts +15 -0
- package/dist/types/sdk/theme-tokens.d.ts +22 -0
- package/dist/types/sdk/webchat-api.d.ts +22 -0
- package/docs/ARCHITECTURE.md +272 -0
- package/docs/CUSTOMIZATION.md +236 -0
- package/docs/INTEGRATION.md +286 -0
- package/docs/RELIABILITY.md +51 -0
- package/docs/theme-tokens.template.css +72 -0
- package/package.json +8 -2
- package/readme.md +38 -17
- package/dist/cjs/app-globals-3a1e7e63.js +0 -7
- package/dist/cjs/app-globals-3a1e7e63.js.map +0 -1
- package/dist/cjs/chat-creds-cf537d4b.js.map +0 -1
- package/dist/cjs/contracts-31632812.js.map +0 -1
- package/dist/cjs/destroy-chat-be25dec7.js +0 -26
- package/dist/cjs/destroy-chat-be25dec7.js.map +0 -1
- package/dist/cjs/doublecheck-997afc94.js +0 -7
- package/dist/cjs/doublecheck-997afc94.js.map +0 -1
- package/dist/cjs/group-members-73ad1074.js.map +0 -1
- package/dist/cjs/index-1a26d11d.js.map +0 -1
- package/dist/cjs/toast-0bf1e688.js.map +0 -1
- package/dist/components/GroupCast.js.map +0 -1
- package/dist/components/groupcast2.js.map +0 -1
- package/dist/esm/app-globals-0f993ce5.js +0 -5
- package/dist/esm/app-globals-0f993ce5.js.map +0 -1
- package/dist/esm/chat-creds-5d0982fc.js.map +0 -1
- package/dist/esm/contracts-614be4db.js.map +0 -1
- package/dist/esm/destroy-chat-e2ebe165.js +0 -24
- package/dist/esm/destroy-chat-e2ebe165.js.map +0 -1
- package/dist/esm/doublecheck-5e208ef0.js +0 -5
- package/dist/esm/doublecheck-5e208ef0.js.map +0 -1
- package/dist/esm/group-members-806fd7a2.js.map +0 -1
- package/dist/esm/index-beb184c6.js.map +0 -1
- package/dist/esm/toast-d8ea763c.js.map +0 -1
- package/dist/isometrik-webchat/p-01fd0eb4.entry.js +0 -2
- package/dist/isometrik-webchat/p-01fd0eb4.entry.js.map +0 -1
- package/dist/isometrik-webchat/p-0f9c3f95.entry.js +0 -2
- package/dist/isometrik-webchat/p-0f9c3f95.entry.js.map +0 -1
- package/dist/isometrik-webchat/p-1c53e658.js +0 -2
- package/dist/isometrik-webchat/p-1c53e658.js.map +0 -1
- package/dist/isometrik-webchat/p-1df58381.entry.js +0 -2
- package/dist/isometrik-webchat/p-1df58381.entry.js.map +0 -1
- package/dist/isometrik-webchat/p-3c690532.entry.js +0 -2
- package/dist/isometrik-webchat/p-3c690532.entry.js.map +0 -1
- package/dist/isometrik-webchat/p-3c8cbd5f.js +0 -2
- package/dist/isometrik-webchat/p-3c8cbd5f.js.map +0 -1
- package/dist/isometrik-webchat/p-4e762019.js +0 -2
- package/dist/isometrik-webchat/p-4e762019.js.map +0 -1
- package/dist/isometrik-webchat/p-53695fc6.entry.js +0 -2
- package/dist/isometrik-webchat/p-7b80b0b2.js.map +0 -1
- package/dist/isometrik-webchat/p-9924b1bf.entry.js +0 -2
- package/dist/isometrik-webchat/p-a15092d9.entry.js.map +0 -1
- package/dist/isometrik-webchat/p-a6897edc.js.map +0 -1
- package/dist/isometrik-webchat/p-b2bf55b1.entry.js +0 -2
- package/dist/isometrik-webchat/p-bfecfa97.entry.js +0 -2
- package/dist/isometrik-webchat/p-d386acfe.js.map +0 -1
- package/dist/isometrik-webchat/p-e1255160.js +0 -2
- package/dist/isometrik-webchat/p-e1255160.js.map +0 -1
- package/dist/isometrik-webchat/p-f24cdbbb.js.map +0 -1
- /package/dist/isometrik-webchat/{p-5fea3fd2.entry.js.map → p-2d3e8cd4.entry.js.map} +0 -0
- /package/dist/isometrik-webchat/{p-e7f58d3f.entry.js.map → p-39b626ed.entry.js.map} +0 -0
- /package/dist/isometrik-webchat/{p-eb1f3118.entry.js.map → p-3c70c22c.entry.js.map} +0 -0
- /package/dist/isometrik-webchat/{p-5cbc1a16.entry.js.map → p-586f6978.entry.js.map} +0 -0
- /package/dist/isometrik-webchat/{p-5f7eebbf.entry.js.map → p-5d243250.entry.js.map} +0 -0
- /package/dist/isometrik-webchat/{p-23df1c24.js.map → p-5d98a8a0.js.map} +0 -0
- /package/dist/isometrik-webchat/{p-e5884258.js.map → p-9982fa21.js.map} +0 -0
- /package/dist/isometrik-webchat/{p-4db39c93.js.map → p-a5707f12.js.map} +0 -0
- /package/dist/isometrik-webchat/{p-af775c83.entry.js.map → p-a876991d.entry.js.map} +0 -0
- /package/dist/isometrik-webchat/{p-bfecfa97.entry.js.map → p-b857775d.entry.js.map} +0 -0
- /package/dist/isometrik-webchat/{p-9924b1bf.entry.js.map → p-c0c19621.entry.js.map} +0 -0
- /package/dist/isometrik-webchat/{p-064d6200.entry.js.map → p-ca47d693.entry.js.map} +0 -0
- /package/dist/isometrik-webchat/{p-5c22ee37.entry.js.map → p-d892b4d4.entry.js.map} +0 -0
- /package/dist/isometrik-webchat/{p-7eb12da3.js.map → p-dd62bd69.js.map} +0 -0
- /package/dist/isometrik-webchat/{p-2f6bb0a4.entry.js.map → p-fd6ce589.entry.js.map} +0 -0
- /package/dist/isometrik-webchat/{p-b2bf55b1.entry.js.map → p-fdd327f5.entry.js.map} +0 -0
|
@@ -3,113 +3,176 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-f624fc47.js');
|
|
6
|
-
const chatCreds = require('./chat-creds-
|
|
6
|
+
const chatCreds = require('./chat-creds-2dbc4087.js');
|
|
7
7
|
const IsometrikLogo = require('./IsometrikLogo-9e642f65.js');
|
|
8
8
|
const content = require('./content-ebca062a.js');
|
|
9
9
|
const chatAssets = require('./chat-assets-686620e7.js');
|
|
10
|
-
const
|
|
11
|
-
const
|
|
10
|
+
const sendMedia = require('./send-media-14908d4b.js');
|
|
11
|
+
const drawer = require('./drawer-811d2ce8.js');
|
|
12
|
+
const helpers = require('./helpers-154861e9.js');
|
|
12
13
|
const index_m = require('./index.m-ff115b26.js');
|
|
13
|
-
const groupMembers = require('./group-members-
|
|
14
|
+
const groupMembers = require('./group-members-5a82ec8a.js');
|
|
14
15
|
const groupcast = require('./groupcast-c93d4a7d.js');
|
|
15
|
-
const
|
|
16
|
+
const mediaLimits = require('./media-limits-eba42629.js');
|
|
17
|
+
const client = require('./client-80851676.js');
|
|
18
|
+
const toast = require('./toast-f810e550.js');
|
|
16
19
|
const groupMembers$1 = require('./group-members-1205fc4c.js');
|
|
17
|
-
const index$1 = require('./index-
|
|
18
|
-
require('./destroy-chat-
|
|
20
|
+
const index$1 = require('./index-66f98408.js');
|
|
21
|
+
require('./destroy-chat-7ae8fc99.js');
|
|
22
|
+
|
|
23
|
+
const MAX_OUTBOX_MEDIA_BYTES = 12 * 1024 * 1024;
|
|
24
|
+
function arrayBufferToBase64(buf) {
|
|
25
|
+
const bytes = new Uint8Array(buf);
|
|
26
|
+
const chunk = 0x8000;
|
|
27
|
+
let binary = '';
|
|
28
|
+
for (let i = 0; i < bytes.length; i += chunk) {
|
|
29
|
+
binary += String.fromCharCode(...bytes.subarray(i, i + chunk));
|
|
30
|
+
}
|
|
31
|
+
return btoa(binary);
|
|
32
|
+
}
|
|
33
|
+
function base64ToUint8(base64) {
|
|
34
|
+
const binary = atob(base64);
|
|
35
|
+
const out = new Uint8Array(binary.length);
|
|
36
|
+
for (let i = 0; i < binary.length; i++)
|
|
37
|
+
out[i] = binary.charCodeAt(i);
|
|
38
|
+
return out;
|
|
39
|
+
}
|
|
40
|
+
async function filesToOutboxMedia(files) {
|
|
41
|
+
const accepted = mediaLimits.takeMediaFiles(files, 0).accepted;
|
|
42
|
+
let total = 0;
|
|
43
|
+
const out = [];
|
|
44
|
+
for (const file of accepted) {
|
|
45
|
+
// Skip oversized; keep packing remaining files that still fit
|
|
46
|
+
if (total + file.size > MAX_OUTBOX_MEDIA_BYTES)
|
|
47
|
+
continue;
|
|
48
|
+
const base64 = arrayBufferToBase64(await file.arrayBuffer());
|
|
49
|
+
out.push({
|
|
50
|
+
name: file.name,
|
|
51
|
+
mimeType: file.type || 'application/octet-stream',
|
|
52
|
+
size: file.size,
|
|
53
|
+
base64,
|
|
54
|
+
});
|
|
55
|
+
total += file.size;
|
|
56
|
+
}
|
|
57
|
+
return out;
|
|
58
|
+
}
|
|
59
|
+
function outboxMediaToFiles(mediaFiles) {
|
|
60
|
+
if (!(mediaFiles === null || mediaFiles === void 0 ? void 0 : mediaFiles.length))
|
|
61
|
+
return [];
|
|
62
|
+
return mediaFiles.slice(0, mediaLimits.MAX_MEDIA_PER_MESSAGE).map(m => new File([base64ToUint8(m.base64)], m.name, { type: m.mimeType || 'application/octet-stream' }));
|
|
63
|
+
}
|
|
19
64
|
|
|
20
65
|
const ThemeProvider = class {
|
|
21
66
|
constructor(hostRef) {
|
|
22
67
|
index.registerInstance(this, hostRef);
|
|
68
|
+
this.stylesheetId = `isometrik-theme-stylesheet-${Math.random().toString(36).slice(2, 9)}`;
|
|
23
69
|
this.themePath = undefined;
|
|
24
70
|
this.mode = 'light';
|
|
71
|
+
this.themeObject = undefined;
|
|
72
|
+
this.mirrorToDocument = false;
|
|
25
73
|
this.styleElement = null;
|
|
26
74
|
}
|
|
27
|
-
/**
|
|
28
|
-
* Watch for changes to the theme path and update the stylesheet
|
|
29
|
-
*/
|
|
30
75
|
handleThemePathChange(newPath) {
|
|
31
76
|
if (newPath) {
|
|
32
77
|
this.loadThemeFromPath(newPath);
|
|
33
78
|
}
|
|
34
79
|
}
|
|
35
|
-
/**
|
|
36
|
-
* Watch for changes to theme mode
|
|
37
|
-
*/
|
|
38
80
|
handleModeChange(newMode) {
|
|
39
81
|
this.updateThemeClass(newMode);
|
|
40
82
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
83
|
+
handleThemeObjectChange(next) {
|
|
84
|
+
this.applyThemeObject(next);
|
|
85
|
+
}
|
|
86
|
+
handleMirrorChange() {
|
|
87
|
+
this.updateThemeClass(this.mode);
|
|
88
|
+
}
|
|
44
89
|
componentDidLoad() {
|
|
45
|
-
// Load theme from path if provided
|
|
46
90
|
if (this.themePath) {
|
|
47
91
|
this.loadThemeFromPath(this.themePath);
|
|
48
92
|
}
|
|
49
|
-
// Set initial theme class
|
|
50
93
|
this.updateThemeClass(this.mode);
|
|
94
|
+
this.applyThemeObject(this.themeObject);
|
|
51
95
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
96
|
+
disconnectedCallback() {
|
|
97
|
+
var _a;
|
|
98
|
+
if ((_a = this.styleElement) === null || _a === void 0 ? void 0 : _a.parentNode) {
|
|
99
|
+
this.styleElement.parentNode.removeChild(this.styleElement);
|
|
100
|
+
this.styleElement = null;
|
|
101
|
+
}
|
|
102
|
+
if (this.mirrorToDocument) {
|
|
103
|
+
document.documentElement.classList.remove('theme-light', 'theme-dark');
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
applyThemeObject(theme) {
|
|
107
|
+
sendMedia.applyThemeObjectToElement(this.hostElement, theme || null);
|
|
108
|
+
}
|
|
109
|
+
/** Mode class on this host only — CSS vars inherit into <web-chat> shadow. */
|
|
55
110
|
updateThemeClass(mode) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
111
|
+
this.hostElement.classList.remove('theme-light', 'theme-dark');
|
|
112
|
+
this.hostElement.classList.add(`theme-${mode}`);
|
|
113
|
+
if (this.mirrorToDocument) {
|
|
114
|
+
document.documentElement.classList.remove('theme-light', 'theme-dark');
|
|
115
|
+
document.documentElement.classList.add(`theme-${mode}`);
|
|
116
|
+
}
|
|
117
|
+
this.hostElement.dispatchEvent(new CustomEvent('themechange', {
|
|
118
|
+
detail: { mode, scoped: !this.mirrorToDocument },
|
|
63
119
|
bubbles: true,
|
|
64
|
-
composed: true
|
|
65
|
-
});
|
|
66
|
-
this.hostElement.dispatchEvent(themeChangeEvent);
|
|
120
|
+
composed: true,
|
|
121
|
+
}));
|
|
67
122
|
}
|
|
68
|
-
/**
|
|
69
|
-
* Load a theme from a CSS file path
|
|
70
|
-
*/
|
|
71
123
|
loadThemeFromPath(path) {
|
|
72
|
-
|
|
73
|
-
if (this.styleElement) {
|
|
74
|
-
|
|
124
|
+
var _a;
|
|
125
|
+
if ((_a = this.styleElement) === null || _a === void 0 ? void 0 : _a.parentNode) {
|
|
126
|
+
this.styleElement.parentNode.removeChild(this.styleElement);
|
|
75
127
|
}
|
|
76
|
-
// Create a new link element for the CSS file
|
|
77
128
|
this.styleElement = document.createElement('link');
|
|
78
129
|
this.styleElement.rel = 'stylesheet';
|
|
79
130
|
this.styleElement.href = path;
|
|
80
|
-
|
|
81
|
-
this.styleElement.
|
|
82
|
-
// Append the stylesheet to the document head
|
|
131
|
+
this.styleElement.id = this.stylesheetId;
|
|
132
|
+
this.styleElement.setAttribute('data-isometrik-theme', '1');
|
|
83
133
|
document.head.appendChild(this.styleElement);
|
|
84
134
|
}
|
|
85
|
-
/**
|
|
86
|
-
* Public method to toggle between light and dark themes
|
|
87
|
-
*/
|
|
88
135
|
async toggleTheme() {
|
|
89
136
|
this.mode = this.mode === 'light' ? 'dark' : 'light';
|
|
90
137
|
return this.mode;
|
|
91
138
|
}
|
|
92
|
-
/**
|
|
93
|
-
* Public method to set theme explicitly
|
|
94
|
-
*/
|
|
95
139
|
async setTheme(mode) {
|
|
96
140
|
this.mode = mode;
|
|
97
141
|
return this.mode;
|
|
98
142
|
}
|
|
143
|
+
async setThemeObject(theme) {
|
|
144
|
+
const normalized = sendMedia.normalizeThemeObject(theme || undefined);
|
|
145
|
+
sendMedia.applyThemeObjectToElement(this.hostElement, normalized);
|
|
146
|
+
return normalized;
|
|
147
|
+
}
|
|
99
148
|
render() {
|
|
100
|
-
return (index.h("div", { key: '
|
|
149
|
+
return (index.h("div", { key: 'eda588f5d70658cdbb4d2c112b87e967e26851f4', class: `theme-provider-container theme-${this.mode}` }, index.h("slot", { key: '1c0c507b5f4380353fb5af4332f1873eecd84d5c' })));
|
|
101
150
|
}
|
|
102
151
|
get hostElement() { return index.getElement(this); }
|
|
103
152
|
static get watchers() { return {
|
|
104
153
|
"themePath": ["handleThemePathChange"],
|
|
105
|
-
"mode": ["handleModeChange"]
|
|
154
|
+
"mode": ["handleModeChange"],
|
|
155
|
+
"themeObject": ["handleThemeObjectChange"],
|
|
156
|
+
"mirrorToDocument": ["handleMirrorChange"]
|
|
106
157
|
}; }
|
|
107
158
|
};
|
|
108
159
|
|
|
109
160
|
/**
|
|
110
161
|
* Thin MQTT lifecycle helper around test-iso-chat-sdk's mqtt client.
|
|
111
162
|
* Keeps connect/subscribe/teardown idempotent so remounts don't stack listeners.
|
|
163
|
+
*
|
|
164
|
+
* Supports mqtt.js reconnect: on each `connect` (including after reconnect)
|
|
165
|
+
* call `resubscribe()` so the user topic is always live.
|
|
112
166
|
*/
|
|
167
|
+
/** Sensible mqtt.js reconnect defaults (ms). */
|
|
168
|
+
const MQTT_RECONNECT_PERIOD_MS = 2000;
|
|
169
|
+
const MQTT_CONNECT_TIMEOUT_MS = 12000;
|
|
170
|
+
function applyMqttReconnectOptions(rawClient) {
|
|
171
|
+
if (!(rawClient === null || rawClient === void 0 ? void 0 : rawClient.options))
|
|
172
|
+
return;
|
|
173
|
+
rawClient.options.reconnectPeriod = MQTT_RECONNECT_PERIOD_MS;
|
|
174
|
+
rawClient.options.connectTimeout = MQTT_CONNECT_TIMEOUT_MS;
|
|
175
|
+
}
|
|
113
176
|
function removeClientListener(client, event, handler) {
|
|
114
177
|
if (typeof client.removeListener === 'function') {
|
|
115
178
|
client.removeListener(event, handler);
|
|
@@ -124,14 +187,18 @@ class MqttSession {
|
|
|
124
187
|
this.handlers = {};
|
|
125
188
|
this.boundConnect = null;
|
|
126
189
|
this.boundDisconnect = null;
|
|
190
|
+
this.boundOffline = null;
|
|
191
|
+
this.boundReconnect = null;
|
|
127
192
|
this.boundError = null;
|
|
128
193
|
this.boundMessage = null;
|
|
194
|
+
/** Last successfully subscribed topic. */
|
|
129
195
|
this.subscribedTopic = null;
|
|
196
|
+
/** Topic we want — used to force resubscribe after reconnect. */
|
|
197
|
+
this.desiredTopic = null;
|
|
130
198
|
this.listenersAttached = false;
|
|
131
199
|
this.messageListenerAttached = false;
|
|
132
200
|
}
|
|
133
201
|
attach(mqtt, handlers) {
|
|
134
|
-
// Teardown previous bindings if re-attaching to same or new client
|
|
135
202
|
this.detachListenersOnly();
|
|
136
203
|
this.mqtt = mqtt;
|
|
137
204
|
this.handlers = handlers;
|
|
@@ -143,6 +210,14 @@ class MqttSession {
|
|
|
143
210
|
var _a, _b;
|
|
144
211
|
(_b = (_a = this.handlers).onDisconnect) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
145
212
|
};
|
|
213
|
+
this.boundOffline = () => {
|
|
214
|
+
var _a, _b;
|
|
215
|
+
(_b = (_a = this.handlers).onOffline) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
216
|
+
};
|
|
217
|
+
this.boundReconnect = () => {
|
|
218
|
+
var _a, _b;
|
|
219
|
+
(_b = (_a = this.handlers).onReconnect) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
220
|
+
};
|
|
146
221
|
this.boundError = (error) => {
|
|
147
222
|
var _a, _b;
|
|
148
223
|
(_b = (_a = this.handlers).onError) === null || _b === void 0 ? void 0 : _b.call(_a, error);
|
|
@@ -151,14 +226,18 @@ class MqttSession {
|
|
|
151
226
|
var _a, _b;
|
|
152
227
|
void ((_b = (_a = this.handlers).onMessage) === null || _b === void 0 ? void 0 : _b.call(_a, topic, payload));
|
|
153
228
|
};
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
229
|
+
const { client } = mqtt;
|
|
230
|
+
client.on('connect', this.boundConnect);
|
|
231
|
+
client.on('disconnect', this.boundDisconnect);
|
|
232
|
+
client.on('offline', this.boundOffline);
|
|
233
|
+
client.on('reconnect', this.boundReconnect);
|
|
234
|
+
client.on('error', this.boundError);
|
|
157
235
|
this.listenersAttached = true;
|
|
158
236
|
}
|
|
159
237
|
subscribe(topic) {
|
|
160
238
|
if (!this.mqtt)
|
|
161
239
|
return;
|
|
240
|
+
this.desiredTopic = topic;
|
|
162
241
|
if (this.subscribedTopic === topic) {
|
|
163
242
|
this.ensureMessageListener();
|
|
164
243
|
return;
|
|
@@ -168,7 +247,7 @@ class MqttSession {
|
|
|
168
247
|
this.mqtt.client.unsubscribe(this.subscribedTopic);
|
|
169
248
|
}
|
|
170
249
|
catch (_a) {
|
|
171
|
-
|
|
250
|
+
/* ignore */
|
|
172
251
|
}
|
|
173
252
|
}
|
|
174
253
|
this.mqtt.client.subscribe(topic, err => {
|
|
@@ -180,6 +259,16 @@ class MqttSession {
|
|
|
180
259
|
});
|
|
181
260
|
this.ensureMessageListener();
|
|
182
261
|
}
|
|
262
|
+
/** After reconnect, force subscribe again even if topic string is unchanged. */
|
|
263
|
+
resubscribe() {
|
|
264
|
+
if (!this.desiredTopic)
|
|
265
|
+
return;
|
|
266
|
+
this.subscribedTopic = null;
|
|
267
|
+
this.subscribe(this.desiredTopic);
|
|
268
|
+
}
|
|
269
|
+
getDesiredTopic() {
|
|
270
|
+
return this.desiredTopic;
|
|
271
|
+
}
|
|
183
272
|
ensureMessageListener() {
|
|
184
273
|
if (!this.mqtt || this.messageListenerAttached || !this.boundMessage)
|
|
185
274
|
return;
|
|
@@ -197,6 +286,10 @@ class MqttSession {
|
|
|
197
286
|
removeClientListener(client, 'connect', this.boundConnect);
|
|
198
287
|
if (this.boundDisconnect)
|
|
199
288
|
removeClientListener(client, 'disconnect', this.boundDisconnect);
|
|
289
|
+
if (this.boundOffline)
|
|
290
|
+
removeClientListener(client, 'offline', this.boundOffline);
|
|
291
|
+
if (this.boundReconnect)
|
|
292
|
+
removeClientListener(client, 'reconnect', this.boundReconnect);
|
|
200
293
|
if (this.boundError)
|
|
201
294
|
removeClientListener(client, 'error', this.boundError);
|
|
202
295
|
if (this.boundMessage && this.messageListenerAttached) {
|
|
@@ -213,7 +306,7 @@ class MqttSession {
|
|
|
213
306
|
this.mqtt.client.unsubscribe(this.subscribedTopic);
|
|
214
307
|
}
|
|
215
308
|
catch (_a) {
|
|
216
|
-
|
|
309
|
+
/* ignore */
|
|
217
310
|
}
|
|
218
311
|
}
|
|
219
312
|
this.detachListenersOnly();
|
|
@@ -222,6 +315,7 @@ class MqttSession {
|
|
|
222
315
|
this.mqtt.disconnect();
|
|
223
316
|
}
|
|
224
317
|
else if (typeof this.mqtt.client.end === 'function') {
|
|
318
|
+
// force end — do not leave zombie reconnect loops after unmount
|
|
225
319
|
this.mqtt.client.end(true);
|
|
226
320
|
}
|
|
227
321
|
}
|
|
@@ -230,6 +324,7 @@ class MqttSession {
|
|
|
230
324
|
}
|
|
231
325
|
this.mqtt = null;
|
|
232
326
|
this.subscribedTopic = null;
|
|
327
|
+
this.desiredTopic = null;
|
|
233
328
|
this.handlers = {};
|
|
234
329
|
}
|
|
235
330
|
}
|
|
@@ -800,211 +895,234 @@ async function dispatchMqttMessage(parsedMessage, ctx) {
|
|
|
800
895
|
}
|
|
801
896
|
}
|
|
802
897
|
|
|
803
|
-
/**
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
});
|
|
819
|
-
}
|
|
820
|
-
function mergeUniqueConversations(existing, incoming) {
|
|
821
|
-
const list = Array.isArray(existing) ? existing : [];
|
|
822
|
-
const next = Array.isArray(incoming) ? incoming : [];
|
|
823
|
-
return [
|
|
824
|
-
...list,
|
|
825
|
-
...next.filter(newConv => !list.some(existingConv => existingConv.conversationId === newConv.conversationId)),
|
|
826
|
-
];
|
|
827
|
-
}
|
|
828
|
-
async function fetchConversationsPage(opts) {
|
|
829
|
-
var _a, _b, _c;
|
|
830
|
-
const query = {
|
|
831
|
-
limit: (_a = opts.limit) !== null && _a !== void 0 ? _a : 20,
|
|
832
|
-
skip: (_b = opts.skip) !== null && _b !== void 0 ? _b : 0,
|
|
833
|
-
includeMembers: (_c = opts.includeMembers) !== null && _c !== void 0 ? _c : true,
|
|
834
|
-
};
|
|
835
|
-
if (opts.searchTag)
|
|
836
|
-
query.searchTag = opts.searchTag;
|
|
837
|
-
const res = await index_m.M.getInstance().Conversation.getConversations(query);
|
|
838
|
-
return (res === null || res === void 0 ? void 0 : res.conversations) || [];
|
|
839
|
-
}
|
|
840
|
-
async function fetchConversationDetails(conversationId, includeMembers = true) {
|
|
841
|
-
const res = await index_m.M.getInstance().Conversation.getConversationDetails({ conversationId, includeMembers }, conversationId);
|
|
842
|
-
return res === null || res === void 0 ? void 0 : res.conversationDetails;
|
|
898
|
+
/**
|
|
899
|
+
* Serialize inbound MQTT handling per host so rapid messages don't race @State updates.
|
|
900
|
+
*/
|
|
901
|
+
const tails = new WeakMap();
|
|
902
|
+
/** Run `task` after any prior MQTT tasks for this host have finished. */
|
|
903
|
+
function enqueueMqttTask(host, task) {
|
|
904
|
+
const prev = tails.get(host) || Promise.resolve();
|
|
905
|
+
const next = prev
|
|
906
|
+
.then(() => task())
|
|
907
|
+
.catch(err => {
|
|
908
|
+
console.error('MQTT inbound task failed:', err);
|
|
909
|
+
})
|
|
910
|
+
.then(() => undefined);
|
|
911
|
+
tails.set(host, next);
|
|
912
|
+
return next;
|
|
843
913
|
}
|
|
844
914
|
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
licenseKey: config.licenseKey || chatCreds.isometrikFlutterAppSecrets.licenseKey,
|
|
850
|
-
appSecret: config.appSecret || chatCreds.isometrikFlutterAppSecrets.appSecret,
|
|
851
|
-
userSecret: config.userSecret || chatCreds.isometrikFlutterAppSecrets.userSecret,
|
|
852
|
-
userToken: config.userToken,
|
|
853
|
-
});
|
|
854
|
-
}
|
|
855
|
-
/** Normalize getUserDetails API response into the shape WebChat stores. */
|
|
856
|
-
async function fetchUserDetails() {
|
|
857
|
-
var _a, _b, _c;
|
|
858
|
-
const res = await index_m.M.getInstance().user.getUserDetails();
|
|
859
|
-
return {
|
|
860
|
-
userId: (res === null || res === void 0 ? void 0 : res.userId) || '',
|
|
861
|
-
userIdentifier: (res === null || res === void 0 ? void 0 : res.userIdentifier) || '',
|
|
862
|
-
firstName: ((_a = res === null || res === void 0 ? void 0 : res.metaData) === null || _a === void 0 ? void 0 : _a.firstName) || '',
|
|
863
|
-
lastName: ((_b = res === null || res === void 0 ? void 0 : res.metaData) === null || _b === void 0 ? void 0 : _b.lastName) || '',
|
|
864
|
-
updatedAt: (res === null || res === void 0 ? void 0 : res.updatedAt) || '',
|
|
865
|
-
userName: (res === null || res === void 0 ? void 0 : res.userName) || '',
|
|
866
|
-
online: (res === null || res === void 0 ? void 0 : res.online) || '',
|
|
867
|
-
userProfileImageUrl: (res === null || res === void 0 ? void 0 : res.userProfileImageUrl) || '',
|
|
868
|
-
profilePic: ((_c = res === null || res === void 0 ? void 0 : res.metaData) === null || _c === void 0 ? void 0 : _c.profilePic) || '',
|
|
869
|
-
};
|
|
870
|
-
}
|
|
915
|
+
const getTotalUnreadConversationsCount = async () => {
|
|
916
|
+
const response = await index_m.M.getInstance().Conversation.getConversationUnreadCount();
|
|
917
|
+
return response?.count;
|
|
918
|
+
};
|
|
871
919
|
|
|
872
|
-
|
|
920
|
+
/**
|
|
921
|
+
* Wire OfflineClient into <web-chat> lifecycle.
|
|
922
|
+
*/
|
|
923
|
+
function userIdOf(host) {
|
|
873
924
|
var _a;
|
|
874
|
-
|
|
875
|
-
|
|
925
|
+
return ((_a = host.userMetaData) === null || _a === void 0 ? void 0 : _a.userId) || host.isometrikUserId || host.isometrikUserIdFromCookie || null;
|
|
926
|
+
}
|
|
927
|
+
function hostInitOffline(host) {
|
|
928
|
+
const client$1 = client.getOfflineClient();
|
|
929
|
+
const uid = userIdOf(host);
|
|
930
|
+
if (uid)
|
|
931
|
+
client$1.setUser(uid);
|
|
932
|
+
client$1.startTabSync(event => {
|
|
933
|
+
var _a;
|
|
934
|
+
if (event.type === 'messages' && event.conversationId === host.selectedConversationId) {
|
|
935
|
+
host.allMessages = client.mergeMessagesById(host.allMessages || [], event.messages || []);
|
|
936
|
+
}
|
|
937
|
+
if (event.type === 'conversations') {
|
|
938
|
+
// Prefer newer network list; only fill gaps from peer tab
|
|
939
|
+
const incoming = event.conversations || [];
|
|
940
|
+
if (!((_a = host.allConversationList) === null || _a === void 0 ? void 0 : _a.length) && incoming.length) {
|
|
941
|
+
host.allConversationList = incoming;
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
});
|
|
945
|
+
if (typeof window !== 'undefined') {
|
|
946
|
+
host._onOnline = () => {
|
|
947
|
+
void hostFlushOutbox(host);
|
|
948
|
+
};
|
|
949
|
+
window.addEventListener('online', host._onOnline);
|
|
950
|
+
}
|
|
876
951
|
}
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
952
|
+
function hostTeardownOffline(host) {
|
|
953
|
+
client.getOfflineClient().stopTabSync();
|
|
954
|
+
if (typeof window !== 'undefined' && host._onOnline) {
|
|
955
|
+
window.removeEventListener('online', host._onOnline);
|
|
956
|
+
host._onOnline = null;
|
|
957
|
+
}
|
|
880
958
|
}
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
const
|
|
884
|
-
|
|
959
|
+
/** Paint cached conversations immediately (before network). */
|
|
960
|
+
async function hostHydrateConversationsFromCache(host) {
|
|
961
|
+
const uid = userIdOf(host);
|
|
962
|
+
if (!uid)
|
|
963
|
+
return;
|
|
964
|
+
try {
|
|
965
|
+
const cached = await client.getOfflineClient().loadConversations(uid);
|
|
966
|
+
if (cached.length && (!host.allConversationList || host.allConversationList.length === 0)) {
|
|
967
|
+
host.allConversationList = cached;
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
catch (e) {
|
|
971
|
+
console.error('offline hydrate conversations failed', e);
|
|
972
|
+
}
|
|
885
973
|
}
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
return 3;
|
|
901
|
-
}
|
|
902
|
-
function customTypeFromMime(mime) {
|
|
903
|
-
if (!mime)
|
|
904
|
-
return 'AttachmentMessage:Multiple';
|
|
905
|
-
if (mime.startsWith('image/'))
|
|
906
|
-
return 'AttachmentMessage:Image';
|
|
907
|
-
if (mime.startsWith('video/'))
|
|
908
|
-
return 'AttachmentMessage:Video';
|
|
909
|
-
if (mime.startsWith('audio/'))
|
|
910
|
-
return 'AttachmentMessage:Audio';
|
|
911
|
-
if (mime.startsWith('application/'))
|
|
912
|
-
return 'AttachmentMessage:Doc';
|
|
913
|
-
return 'AttachmentMessage:Multiple';
|
|
914
|
-
}
|
|
915
|
-
function buildReplyMetaData(replyMessage, caption) {
|
|
916
|
-
var _a, _b, _c;
|
|
917
|
-
if (!replyMessage && !(caption === null || caption === void 0 ? void 0 : caption.trim()))
|
|
918
|
-
return {};
|
|
919
|
-
return Object.assign(Object.assign({}, (replyMessage && Object.assign({ parentMessageId: replyMessage.messageId, parentMessage: replyMessage.body, parentMessageTime: replyMessage.sentAt, parentMessageSenderId: ((_a = replyMessage.senderInfo) === null || _a === void 0 ? void 0 : _a.userId) || replyMessage.senderId, parentMessageSenderName: ((_b = replyMessage.senderInfo) === null || _b === void 0 ? void 0 : _b.userName) || replyMessage.userName }, (((_c = replyMessage === null || replyMessage === void 0 ? void 0 : replyMessage.attachments) === null || _c === void 0 ? void 0 : _c[0]) && {
|
|
920
|
-
parentMessageName: replyMessage.attachments[0].name,
|
|
921
|
-
parentMessageMediaUrl: replyMessage.attachments[0].mediaUrl,
|
|
922
|
-
parentMessageType: replyMessage.attachments[0].mimeType,
|
|
923
|
-
})))), ((caption === null || caption === void 0 ? void 0 : caption.trim()) && { captionMessage: caption.trim() }));
|
|
924
|
-
}
|
|
925
|
-
function prepareMediaAttachments(files) {
|
|
926
|
-
return files.map(file => ({
|
|
927
|
-
nameWithExtension: file.name,
|
|
928
|
-
mediaType: mediaTypeFromMime(file.type),
|
|
929
|
-
mediaId: String(file.lastModified || Date.now()),
|
|
930
|
-
mimeType: file.type || 'application/octet-stream',
|
|
931
|
-
size: file.size,
|
|
932
|
-
file,
|
|
933
|
-
}));
|
|
974
|
+
async function hostHydrateMessagesFromCache(host, conversationId) {
|
|
975
|
+
const uid = userIdOf(host);
|
|
976
|
+
const id = conversationId || host.selectedConversationId;
|
|
977
|
+
if (!uid || !id)
|
|
978
|
+
return;
|
|
979
|
+
try {
|
|
980
|
+
const cached = await client.getOfflineClient().loadMessages(uid, id);
|
|
981
|
+
if (cached.length) {
|
|
982
|
+
host.allMessages = client.mergeMessagesById(host.allMessages || [], cached);
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
catch (e) {
|
|
986
|
+
console.error('offline hydrate messages failed', e);
|
|
987
|
+
}
|
|
934
988
|
}
|
|
935
|
-
function
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
}
|
|
989
|
+
async function hostPersistConversations(host) {
|
|
990
|
+
var _a;
|
|
991
|
+
const uid = userIdOf(host);
|
|
992
|
+
if (!uid || !((_a = host.allConversationList) === null || _a === void 0 ? void 0 : _a.length))
|
|
993
|
+
return;
|
|
994
|
+
try {
|
|
995
|
+
await client.getOfflineClient().persistConversations(uid, host.allConversationList);
|
|
996
|
+
}
|
|
997
|
+
catch (e) {
|
|
998
|
+
console.error('offline persist conversations failed', e);
|
|
999
|
+
}
|
|
943
1000
|
}
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
const
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
1001
|
+
async function hostPersistMessages(host, conversationId) {
|
|
1002
|
+
var _a;
|
|
1003
|
+
const uid = userIdOf(host);
|
|
1004
|
+
const id = conversationId || host.selectedConversationId;
|
|
1005
|
+
if (!uid || !id || !((_a = host.allMessages) === null || _a === void 0 ? void 0 : _a.length))
|
|
1006
|
+
return;
|
|
1007
|
+
try {
|
|
1008
|
+
await client.getOfflineClient().persistMessages(uid, id, host.allMessages);
|
|
1009
|
+
const last = host.allMessages[host.allMessages.length - 1];
|
|
1010
|
+
const cursor = (last === null || last === void 0 ? void 0 : last.sentAt) || (last === null || last === void 0 ? void 0 : last.updatedAt) || Date.now();
|
|
1011
|
+
await client.getOfflineClient().setCursor(uid, id, cursor);
|
|
1012
|
+
}
|
|
1013
|
+
catch (e) {
|
|
1014
|
+
console.error('offline persist messages failed', e);
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
async function hostEnqueueFailedText(host, opts) {
|
|
1018
|
+
var _a, _b, _c;
|
|
1019
|
+
const uid = userIdOf(host);
|
|
1020
|
+
if (!uid)
|
|
1021
|
+
return;
|
|
1022
|
+
const reply = host.replyMessage;
|
|
1023
|
+
await client.getOfflineClient().enqueueText({
|
|
1024
|
+
localId: opts.localId,
|
|
1025
|
+
userId: uid,
|
|
1026
|
+
conversationId: opts.conversationId,
|
|
1027
|
+
body: opts.body,
|
|
1028
|
+
metaData: (_a = opts.localMessage) === null || _a === void 0 ? void 0 : _a.metaData,
|
|
1029
|
+
messageType: (_c = (_b = opts.localMessage) === null || _b === void 0 ? void 0 : _b.messageType) !== null && _c !== void 0 ? _c : 0,
|
|
1030
|
+
parentMessageId: reply === null || reply === void 0 ? void 0 : reply.messageId,
|
|
1031
|
+
customType: opts.body.match(/(https?:\/\/[^\s]+)/g)
|
|
1032
|
+
? 'AttachmentMessage:Link'
|
|
1033
|
+
: 'AttachmentMessage:Text',
|
|
1034
|
+
searchableTags: opts.body.split(/\s+/).filter(Boolean).slice(0, 20),
|
|
952
1035
|
});
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
1036
|
+
// Mark bubble as pending/outbox so UI can show retry state
|
|
1037
|
+
host.allMessages = (host.allMessages || []).map((m) => m.messageId === opts.localId
|
|
1038
|
+
? Object.assign(Object.assign({}, m), { deliveredToAll: 'pending', deliveryStatus: 'outbox', outbox: true }) : m);
|
|
1039
|
+
await hostPersistMessages(host, opts.conversationId);
|
|
1040
|
+
}
|
|
1041
|
+
async function hostEnqueueFailedMedia(host, opts) {
|
|
1042
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1043
|
+
const uid = userIdOf(host);
|
|
1044
|
+
if (!uid)
|
|
1045
|
+
return;
|
|
1046
|
+
const mediaFiles = await filesToOutboxMedia(opts.files);
|
|
1047
|
+
if (!mediaFiles.length)
|
|
1048
|
+
return;
|
|
1049
|
+
const reply = host.replyMessage;
|
|
1050
|
+
await client.getOfflineClient().enqueueMedia({
|
|
1051
|
+
localId: opts.localId,
|
|
1052
|
+
userId: uid,
|
|
1053
|
+
conversationId: opts.conversationId,
|
|
1054
|
+
body: ((_a = opts.caption) === null || _a === void 0 ? void 0 : _a.trim()) || ((_b = opts.localMessage) === null || _b === void 0 ? void 0 : _b.body) || 'AttachmentMessage:Multiple',
|
|
1055
|
+
caption: opts.caption,
|
|
1056
|
+
mediaFiles,
|
|
1057
|
+
metaData: (_c = opts.localMessage) === null || _c === void 0 ? void 0 : _c.metaData,
|
|
1058
|
+
messageType: (_e = (_d = opts.localMessage) === null || _d === void 0 ? void 0 : _d.messageType) !== null && _e !== void 0 ? _e : 0,
|
|
1059
|
+
parentMessageId: reply === null || reply === void 0 ? void 0 : reply.messageId,
|
|
1060
|
+
customType: ((_f = opts.localMessage) === null || _f === void 0 ? void 0 : _f.customType) || 'AttachmentMessage:Multiple',
|
|
1061
|
+
});
|
|
1062
|
+
host.allMessages = (host.allMessages || []).map((m) => m.messageId === opts.localId
|
|
1063
|
+
? Object.assign(Object.assign({}, m), { deliveredToAll: 'pending', deliveryStatus: 'outbox', outbox: true }) : m);
|
|
1064
|
+
await hostPersistMessages(host, opts.conversationId);
|
|
1065
|
+
}
|
|
1066
|
+
async function sendOutboxItem(host, item) {
|
|
1067
|
+
var _a;
|
|
1068
|
+
const deviceId = host.deviceId || (await helpers.getDeviceID());
|
|
1069
|
+
if (item.kind === 'media') {
|
|
1070
|
+
const files = outboxMediaToFiles(item.mediaFiles);
|
|
1071
|
+
if (!files.length)
|
|
1072
|
+
throw new Error('Media outbox item has no files');
|
|
1073
|
+
const attachments = sendMedia.prepareMediaAttachments(files);
|
|
1074
|
+
const apiId = await sendMedia.uploadAndPostMediaMessage({
|
|
1075
|
+
conversationId: item.conversationId,
|
|
1076
|
+
deviceId,
|
|
1077
|
+
attachments,
|
|
1078
|
+
caption: item.caption || item.body,
|
|
1079
|
+
replyMessage: item.parentMessageId
|
|
1080
|
+
? { messageId: item.parentMessageId }
|
|
1081
|
+
: null,
|
|
983
1082
|
});
|
|
984
|
-
|
|
985
|
-
|
|
1083
|
+
if (apiId && item.conversationId === host.selectedConversationId) {
|
|
1084
|
+
host.allMessages = (host.allMessages || []).map((m) => m.messageId === item.localId
|
|
1085
|
+
? Object.assign(Object.assign({}, m), { messageId: apiId, deliveredToAll: false, outbox: false, deliveryStatus: 'sent' }) : m);
|
|
1086
|
+
await hostPersistMessages(host, item.conversationId);
|
|
1087
|
+
}
|
|
1088
|
+
return apiId || null;
|
|
1089
|
+
}
|
|
986
1090
|
const payload = {
|
|
987
1091
|
showInConversation: true,
|
|
988
|
-
messageType:
|
|
989
|
-
parentMessageId:
|
|
1092
|
+
messageType: (_a = item.messageType) !== null && _a !== void 0 ? _a : 0,
|
|
1093
|
+
parentMessageId: item.parentMessageId,
|
|
1094
|
+
searchableTags: item.searchableTags || [],
|
|
990
1095
|
encrypted: false,
|
|
991
|
-
conversationId,
|
|
992
|
-
body: (caption === null || caption === void 0 ? void 0 : caption.trim()) || 'AttachmentMessage:Multiple',
|
|
993
|
-
customType,
|
|
994
|
-
attachments: allPayloads,
|
|
1096
|
+
conversationId: item.conversationId,
|
|
995
1097
|
deviceId,
|
|
996
|
-
|
|
1098
|
+
customType: item.customType || 'AttachmentMessage:Text',
|
|
1099
|
+
body: item.body,
|
|
1100
|
+
metaData: item.metaData || {},
|
|
997
1101
|
};
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1102
|
+
const res = await index_m.M.getInstance().message.postMessages(payload);
|
|
1103
|
+
const apiId = res === null || res === void 0 ? void 0 : res.messageId;
|
|
1104
|
+
if (apiId && item.conversationId === host.selectedConversationId) {
|
|
1105
|
+
host.allMessages = (host.allMessages || []).map((m) => m.messageId === item.localId
|
|
1106
|
+
? Object.assign(Object.assign({}, m), { messageId: apiId, deliveredToAll: false, outbox: false, deliveryStatus: 'sent' }) : m);
|
|
1107
|
+
await hostPersistMessages(host, item.conversationId);
|
|
1108
|
+
}
|
|
1109
|
+
return apiId || null;
|
|
1110
|
+
}
|
|
1111
|
+
async function hostFlushOutbox(host) {
|
|
1112
|
+
var _a;
|
|
1113
|
+
const uid = userIdOf(host);
|
|
1114
|
+
if (!uid || !client.isBrowserOnline())
|
|
1115
|
+
return;
|
|
1116
|
+
try {
|
|
1117
|
+
const result = await client.getOfflineClient().flushOutbox(uid, item => sendOutboxItem(host, item));
|
|
1118
|
+
if (result.sent > 0) {
|
|
1119
|
+
void Promise.resolve((_a = host.getConversations) === null || _a === void 0 ? void 0 : _a.call(host, 0)).catch(() => undefined);
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
catch (e) {
|
|
1123
|
+
console.error('outbox flush failed', e);
|
|
1124
|
+
}
|
|
1002
1125
|
}
|
|
1003
|
-
|
|
1004
|
-
const getTotalUnreadConversationsCount = async () => {
|
|
1005
|
-
const response = await index_m.M.getInstance().Conversation.getConversationUnreadCount();
|
|
1006
|
-
return response?.count;
|
|
1007
|
-
};
|
|
1008
1126
|
|
|
1009
1127
|
/**
|
|
1010
1128
|
* Ordered startup for <web-chat>.
|
|
@@ -1022,6 +1140,9 @@ const getTotalUnreadConversationsCount = async () => {
|
|
|
1022
1140
|
*/
|
|
1023
1141
|
async function bootstrapWebChat(host, generation) {
|
|
1024
1142
|
try {
|
|
1143
|
+
hostInitOffline(host);
|
|
1144
|
+
// Instant paint from IndexedDB while network warms up
|
|
1145
|
+
void hostHydrateConversationsFromCache(host);
|
|
1025
1146
|
try {
|
|
1026
1147
|
host.updateLoading(10, 'Preparing secure session…');
|
|
1027
1148
|
const deviceId = await helpers.getDeviceID();
|
|
@@ -1034,7 +1155,7 @@ async function bootstrapWebChat(host, generation) {
|
|
|
1034
1155
|
}
|
|
1035
1156
|
try {
|
|
1036
1157
|
host.updateLoading(25, 'Loading chat engine…');
|
|
1037
|
-
initializeChatSdk({
|
|
1158
|
+
sendMedia.initializeChatSdk({
|
|
1038
1159
|
baseUrl: host.baseUrl,
|
|
1039
1160
|
licenseKey: host.licenseKey,
|
|
1040
1161
|
appSecret: host.appSecret,
|
|
@@ -1060,6 +1181,8 @@ async function bootstrapWebChat(host, generation) {
|
|
|
1060
1181
|
try {
|
|
1061
1182
|
host.updateLoading(55, 'Fetching users…');
|
|
1062
1183
|
await host.getUserDetails();
|
|
1184
|
+
hostInitOffline(host); // re-bind userId after profile load
|
|
1185
|
+
void hostHydrateConversationsFromCache(host);
|
|
1063
1186
|
}
|
|
1064
1187
|
catch (userError) {
|
|
1065
1188
|
console.error('Failed to get user details:', userError);
|
|
@@ -1114,6 +1237,7 @@ async function bootstrapWebChat(host, generation) {
|
|
|
1114
1237
|
host.checkMobileView();
|
|
1115
1238
|
window.addEventListener('resize', host.boundCheckMobileView);
|
|
1116
1239
|
host.updateLoading(100, 'Almost ready…');
|
|
1240
|
+
void hostFlushOutbox(host);
|
|
1117
1241
|
}
|
|
1118
1242
|
catch (error) {
|
|
1119
1243
|
console.error('Critical initialization error:', error);
|
|
@@ -1173,7 +1297,7 @@ function zeroUnreadInList(list, conversationId) {
|
|
|
1173
1297
|
*/
|
|
1174
1298
|
async function hostGetUserDetails(host) {
|
|
1175
1299
|
try {
|
|
1176
|
-
host.userMetaData = await fetchUserDetails();
|
|
1300
|
+
host.userMetaData = await sendMedia.fetchUserDetails();
|
|
1177
1301
|
}
|
|
1178
1302
|
catch (error) {
|
|
1179
1303
|
console.error(error, 'getUserDetails fetching error');
|
|
@@ -1184,8 +1308,9 @@ async function hostGetConversations(host, skip = 0, searchTag = null, showLoader
|
|
|
1184
1308
|
if (showLoader)
|
|
1185
1309
|
host.isLoadingConversationList = true;
|
|
1186
1310
|
try {
|
|
1187
|
-
const conversations = await fetchConversationsPage({ skip, searchTag });
|
|
1188
|
-
host.allConversationList = mergeUniqueConversations(host.allConversationList, conversations);
|
|
1311
|
+
const conversations = await sendMedia.fetchConversationsPage({ skip, searchTag });
|
|
1312
|
+
host.allConversationList = sendMedia.mergeUniqueConversations(host.allConversationList, conversations);
|
|
1313
|
+
void hostPersistConversations(host);
|
|
1189
1314
|
}
|
|
1190
1315
|
catch (error) {
|
|
1191
1316
|
console.error('getConversations fetching error', error);
|
|
@@ -1201,7 +1326,7 @@ async function hostGetGroupCastConversationDetails(host, groupcastId) {
|
|
|
1201
1326
|
if (!groupcastId)
|
|
1202
1327
|
return;
|
|
1203
1328
|
try {
|
|
1204
|
-
host.conversationMetaData = await fetchGroupcastDetails(groupcastId);
|
|
1329
|
+
host.conversationMetaData = await sendMedia.fetchGroupcastDetails(groupcastId);
|
|
1205
1330
|
}
|
|
1206
1331
|
catch (error) {
|
|
1207
1332
|
console.error(error, 'GroupCast details fetching error');
|
|
@@ -1210,7 +1335,7 @@ async function hostGetGroupCastConversationDetails(host, groupcastId) {
|
|
|
1210
1335
|
async function hostGetUserConversationDetails(host, conversationId) {
|
|
1211
1336
|
const id = conversationId || host.selectedConversationId;
|
|
1212
1337
|
try {
|
|
1213
|
-
const details = await fetchConversationDetails(id);
|
|
1338
|
+
const details = await sendMedia.fetchConversationDetails(id);
|
|
1214
1339
|
if (conversationId)
|
|
1215
1340
|
host.selctConversationMetaData = details;
|
|
1216
1341
|
else
|
|
@@ -1225,21 +1350,27 @@ async function hostGetMessages(host, skip, conversationId) {
|
|
|
1225
1350
|
host.isMessagesLoading = true;
|
|
1226
1351
|
host.isScrollToTop = true;
|
|
1227
1352
|
try {
|
|
1228
|
-
const messages = await
|
|
1353
|
+
const messages = await mediaLimits.fetchMessagesPage({
|
|
1229
1354
|
conversationId: conversationId || host.selectedConversationId,
|
|
1230
1355
|
skip,
|
|
1231
1356
|
});
|
|
1357
|
+
const targetId = conversationId || host.selectedConversationId;
|
|
1232
1358
|
if (skip == 0) {
|
|
1233
|
-
if (conversationId)
|
|
1234
|
-
host.selectConversationMessages = [
|
|
1235
|
-
|
|
1236
|
-
|
|
1359
|
+
if (conversationId) {
|
|
1360
|
+
host.selectConversationMessages = client.mergeMessagesById(host.selectConversationMessages || [], messages);
|
|
1361
|
+
}
|
|
1362
|
+
else {
|
|
1363
|
+
// Merge with any optimistic/outbox rows already on screen
|
|
1364
|
+
host.allMessages = client.mergeMessagesById(host.allMessages || [], messages);
|
|
1365
|
+
}
|
|
1237
1366
|
}
|
|
1238
1367
|
else {
|
|
1239
|
-
host.allMessages =
|
|
1368
|
+
host.allMessages = client.mergeMessagesById(messages, host.allMessages || []);
|
|
1240
1369
|
}
|
|
1241
1370
|
// API 404s a page past the end; a short page means this page is the last.
|
|
1242
1371
|
host.isMessageLimitEnd = messages.length < 20;
|
|
1372
|
+
if (targetId)
|
|
1373
|
+
void hostPersistMessages(host, targetId);
|
|
1243
1374
|
}
|
|
1244
1375
|
catch (error) {
|
|
1245
1376
|
if ((error === null || error === void 0 ? void 0 : error.status) === 404 || (error === null || error === void 0 ? void 0 : error.statusCode) === 404) {
|
|
@@ -1264,7 +1395,7 @@ async function hostGetMessageUnreadCount(host) {
|
|
|
1264
1395
|
async function hostGetMessagesByQuery(host, searchText) {
|
|
1265
1396
|
host.isLoadingMessage = true;
|
|
1266
1397
|
try {
|
|
1267
|
-
host.searchedMessageDetails = await
|
|
1398
|
+
host.searchedMessageDetails = await mediaLimits.searchMessages({
|
|
1268
1399
|
conversationId: host.selectedConversationId,
|
|
1269
1400
|
searchTag: searchText,
|
|
1270
1401
|
});
|
|
@@ -1280,7 +1411,7 @@ async function hostGetMessagesByQuery(host, searchText) {
|
|
|
1280
1411
|
async function hostGetAllLinks(host, conversationId) {
|
|
1281
1412
|
host.allLinks = [];
|
|
1282
1413
|
try {
|
|
1283
|
-
host.allLinks = await
|
|
1414
|
+
host.allLinks = await mediaLimits.fetchLinkMessages(conversationId);
|
|
1284
1415
|
}
|
|
1285
1416
|
catch (error) {
|
|
1286
1417
|
console.error('Error while fetching all the links for a particular conversation', error);
|
|
@@ -1289,7 +1420,7 @@ async function hostGetAllLinks(host, conversationId) {
|
|
|
1289
1420
|
}
|
|
1290
1421
|
async function hostGetGroupcastMembers(host, groupcastId) {
|
|
1291
1422
|
try {
|
|
1292
|
-
host.groupcastMembers = await fetchGroupcastMembersPage(groupcastId);
|
|
1423
|
+
host.groupcastMembers = await sendMedia.fetchGroupcastMembersPage(groupcastId);
|
|
1293
1424
|
}
|
|
1294
1425
|
catch (error) {
|
|
1295
1426
|
console.error('Error while fetching groupcast members', error);
|
|
@@ -1298,7 +1429,7 @@ async function hostGetGroupcastMembers(host, groupcastId) {
|
|
|
1298
1429
|
}
|
|
1299
1430
|
async function hostGetAllLinksCount(host, conversationId) {
|
|
1300
1431
|
try {
|
|
1301
|
-
host.allLinksCount = await
|
|
1432
|
+
host.allLinksCount = await mediaLimits.fetchMediaCount(conversationId);
|
|
1302
1433
|
}
|
|
1303
1434
|
catch (error) {
|
|
1304
1435
|
console.error('Error while fetching media count', error);
|
|
@@ -1310,7 +1441,7 @@ async function hostGetAllAttachments(host, conversationId, from) {
|
|
|
1310
1441
|
host.allAttachments = [];
|
|
1311
1442
|
host.selectConverSationAttachments = [];
|
|
1312
1443
|
try {
|
|
1313
|
-
const filteredMessages = await
|
|
1444
|
+
const filteredMessages = await mediaLimits.fetchMediaAttachments(conversationId);
|
|
1314
1445
|
// merge in-chat media so a just-sent image shows before API catch-up
|
|
1315
1446
|
const live = (host.allMessages || []).filter((m) => Array.isArray(m === null || m === void 0 ? void 0 : m.attachments) &&
|
|
1316
1447
|
m.attachments.some((a) => (a === null || a === void 0 ? void 0 : a.mediaUrl) || (a === null || a === void 0 ? void 0 : a.thumbnailUrl)));
|
|
@@ -1343,7 +1474,7 @@ async function hostGetGroupCastContacts(host, skip = 0) {
|
|
|
1343
1474
|
return;
|
|
1344
1475
|
host.isLoadingMoreGroupcast = true;
|
|
1345
1476
|
try {
|
|
1346
|
-
const groupcasts = await fetchGroupcastContactsPage({ skip, limit: 20 });
|
|
1477
|
+
const groupcasts = await sendMedia.fetchGroupcastContactsPage({ skip, limit: 20 });
|
|
1347
1478
|
if ((groupcasts === null || groupcasts === void 0 ? void 0 : groupcasts.length) > 0) {
|
|
1348
1479
|
host.allGroupCastContacts = skip === 0 ? groupcasts : [...host.allGroupCastContacts, ...groupcasts];
|
|
1349
1480
|
host.groupcastSkip = skip;
|
|
@@ -1375,7 +1506,7 @@ async function hostSendText(host, body, conversationId) {
|
|
|
1375
1506
|
const deviceId = host.deviceId || (await helpers.getDeviceID());
|
|
1376
1507
|
const localId = `localId${Date.now()}${Math.random() * 100}`;
|
|
1377
1508
|
const reply = host.replyMessage;
|
|
1378
|
-
const localMessage = Object.assign({ body: text, messageId: localId, deliveredToAll: 'pending', senderId: (_a = host.userMetaData) === null || _a === void 0 ? void 0 : _a.userId, messageType: reply ? 2 : 0, sentAt: Date.now() }, (reply && {
|
|
1509
|
+
const localMessage = Object.assign({ body: text, messageId: localId, deliveredToAll: 'pending', deliveryStatus: 'sending', senderId: (_a = host.userMetaData) === null || _a === void 0 ? void 0 : _a.userId, messageType: reply ? 2 : 0, sentAt: Date.now() }, (reply && {
|
|
1379
1510
|
parentMessageId: reply.messageId,
|
|
1380
1511
|
metaData: {
|
|
1381
1512
|
parentMessageId: reply.messageId,
|
|
@@ -1388,6 +1519,26 @@ async function hostSendText(host, body, conversationId) {
|
|
|
1388
1519
|
host.allMessages = [...host.allMessages, localMessage];
|
|
1389
1520
|
host.isMessageSending = true;
|
|
1390
1521
|
host.isScrollToBottom = true;
|
|
1522
|
+
const bumpConversationPreview = () => {
|
|
1523
|
+
host.allConversationList = sendMedia.sortConversationsByLatestMessage(host.allConversationList.map(c => {
|
|
1524
|
+
var _a;
|
|
1525
|
+
return c.conversationId === id
|
|
1526
|
+
? Object.assign(Object.assign({}, c), { lastMessageDetails: Object.assign(Object.assign({}, c.lastMessageDetails), { body: text, updatedAt: Date.now(), senderId: (_a = host.userMetaData) === null || _a === void 0 ? void 0 : _a.userId }) }) : c;
|
|
1527
|
+
}));
|
|
1528
|
+
};
|
|
1529
|
+
// Offline → optimistic bubble + outbox (sent when back online)
|
|
1530
|
+
if (!client.isBrowserOnline()) {
|
|
1531
|
+
await hostEnqueueFailedText(host, { localId, conversationId: id, body: text, localMessage });
|
|
1532
|
+
bumpConversationPreview();
|
|
1533
|
+
host.replyMessage = null;
|
|
1534
|
+
host.isMessageSending = false;
|
|
1535
|
+
toast.showToast({
|
|
1536
|
+
message: 'You’re offline — message queued',
|
|
1537
|
+
type: 'warning',
|
|
1538
|
+
position: 'bottom-right',
|
|
1539
|
+
});
|
|
1540
|
+
return localId;
|
|
1541
|
+
}
|
|
1391
1542
|
try {
|
|
1392
1543
|
const payload = {
|
|
1393
1544
|
showInConversation: true,
|
|
@@ -1404,21 +1555,26 @@ async function hostSendText(host, body, conversationId) {
|
|
|
1404
1555
|
const res = await index_m.M.getInstance().message.postMessages(payload);
|
|
1405
1556
|
const apiId = res === null || res === void 0 ? void 0 : res.messageId;
|
|
1406
1557
|
if (apiId) {
|
|
1407
|
-
host.allMessages = host.allMessages.map(m => m.messageId === localId
|
|
1558
|
+
host.allMessages = host.allMessages.map(m => m.messageId === localId
|
|
1559
|
+
? Object.assign(Object.assign({}, m), { messageId: apiId, deliveredToAll: false, deliveryStatus: 'sent' }) : m);
|
|
1408
1560
|
}
|
|
1409
|
-
|
|
1410
|
-
var _a;
|
|
1411
|
-
return c.conversationId === id
|
|
1412
|
-
? Object.assign(Object.assign({}, c), { lastMessageDetails: Object.assign(Object.assign({}, c.lastMessageDetails), { body: text, updatedAt: Date.now(), senderId: (_a = host.userMetaData) === null || _a === void 0 ? void 0 : _a.userId }) }) : c;
|
|
1413
|
-
}));
|
|
1561
|
+
bumpConversationPreview();
|
|
1414
1562
|
host.replyMessage = null;
|
|
1563
|
+
void hostPersistMessages(host, id);
|
|
1415
1564
|
return apiId || localId;
|
|
1416
1565
|
}
|
|
1417
1566
|
catch (error) {
|
|
1418
1567
|
console.error('web-chat sendText failed', error);
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1568
|
+
// Keep bubble + queue for retry (network blip / server error)
|
|
1569
|
+
await hostEnqueueFailedText(host, { localId, conversationId: id, body: text, localMessage });
|
|
1570
|
+
bumpConversationPreview();
|
|
1571
|
+
host.emitChatError('sendText', (error === null || error === void 0 ? void 0 : error.message) || 'Failed to send — queued for retry', error);
|
|
1572
|
+
toast.showToast({
|
|
1573
|
+
message: (error === null || error === void 0 ? void 0 : error.message) || 'Send failed — queued for retry',
|
|
1574
|
+
type: 'warning',
|
|
1575
|
+
position: 'bottom-right',
|
|
1576
|
+
});
|
|
1577
|
+
return localId;
|
|
1422
1578
|
}
|
|
1423
1579
|
finally {
|
|
1424
1580
|
host.isMessageSending = false;
|
|
@@ -1426,24 +1582,61 @@ async function hostSendText(host, body, conversationId) {
|
|
|
1426
1582
|
}
|
|
1427
1583
|
async function hostSendMedia(host, files, conversationId, caption) {
|
|
1428
1584
|
var _a;
|
|
1429
|
-
const
|
|
1585
|
+
const raw = Array.from(files || []).filter(Boolean);
|
|
1586
|
+
const { accepted: list, rejected } = mediaLimits.takeMediaFiles(raw, 0);
|
|
1430
1587
|
const id = conversationId || host.selectedConversationId;
|
|
1431
|
-
if (!
|
|
1588
|
+
if (!raw.length || !id) {
|
|
1432
1589
|
host.emitChatError('sendMedia', 'Missing files or conversationId');
|
|
1433
1590
|
return null;
|
|
1434
1591
|
}
|
|
1592
|
+
if (rejected > 0) {
|
|
1593
|
+
toast.showToast({
|
|
1594
|
+
message: mediaLimits.mediaLimitToastMessage(rejected, mediaLimits.MAX_MEDIA_PER_MESSAGE),
|
|
1595
|
+
type: 'warning',
|
|
1596
|
+
position: 'bottom-right',
|
|
1597
|
+
});
|
|
1598
|
+
}
|
|
1599
|
+
if (!list.length) {
|
|
1600
|
+
host.emitChatError('sendMedia', `Max ${mediaLimits.MAX_MEDIA_PER_MESSAGE} files per message`);
|
|
1601
|
+
return null;
|
|
1602
|
+
}
|
|
1435
1603
|
const deviceId = host.deviceId || (await helpers.getDeviceID());
|
|
1436
1604
|
const reply = host.replyMessage;
|
|
1437
1605
|
const localId = `${Date.now()}${Math.random() * 100}`;
|
|
1438
|
-
const attachments = prepareMediaAttachments(list);
|
|
1439
|
-
const localAttachments = buildLocalMediaAttachments(list);
|
|
1606
|
+
const attachments = sendMedia.prepareMediaAttachments(list);
|
|
1607
|
+
const localAttachments = sendMedia.buildLocalMediaAttachments(list);
|
|
1440
1608
|
const body = (caption || '').trim() || 'AttachmentMessage:Multiple';
|
|
1441
|
-
const localMessage = Object.assign({ body, messageId: localId, deliveredToAll: 'pending', senderId: (_a = host.userMetaData) === null || _a === void 0 ? void 0 : _a.userId, messageType: reply ? 2 : 0, sentAt: Date.now(), attachments: localAttachments, customType: list.length === 1 ? customTypeFromMime(list[0].type) : 'AttachmentMessage:Multiple', metaData: buildReplyMetaData(reply, caption) }, (reply && { parentMessageId: reply.messageId }));
|
|
1609
|
+
const localMessage = Object.assign({ body, messageId: localId, deliveredToAll: 'pending', deliveryStatus: 'sending', senderId: (_a = host.userMetaData) === null || _a === void 0 ? void 0 : _a.userId, messageType: reply ? 2 : 0, sentAt: Date.now(), attachments: localAttachments, customType: list.length === 1 ? sendMedia.customTypeFromMime(list[0].type) : 'AttachmentMessage:Multiple', metaData: sendMedia.buildReplyMetaData(reply, caption) }, (reply && { parentMessageId: reply.messageId }));
|
|
1442
1610
|
host.allMessages = [...host.allMessages, localMessage];
|
|
1443
1611
|
host.isMessageSending = true;
|
|
1444
1612
|
host.isScrollToBottom = true;
|
|
1613
|
+
const bumpConversationPreview = () => {
|
|
1614
|
+
host.allConversationList = sendMedia.sortConversationsByLatestMessage(host.allConversationList.map(c => {
|
|
1615
|
+
var _a;
|
|
1616
|
+
return c.conversationId === id
|
|
1617
|
+
? Object.assign(Object.assign({}, c), { lastMessageDetails: Object.assign(Object.assign({}, c.lastMessageDetails), { body: localMessage.customType || body, updatedAt: Date.now(), senderId: (_a = host.userMetaData) === null || _a === void 0 ? void 0 : _a.userId }) }) : c;
|
|
1618
|
+
}));
|
|
1619
|
+
};
|
|
1620
|
+
if (!client.isBrowserOnline()) {
|
|
1621
|
+
await hostEnqueueFailedMedia(host, {
|
|
1622
|
+
localId,
|
|
1623
|
+
conversationId: id,
|
|
1624
|
+
files: list,
|
|
1625
|
+
caption,
|
|
1626
|
+
localMessage,
|
|
1627
|
+
});
|
|
1628
|
+
bumpConversationPreview();
|
|
1629
|
+
host.replyMessage = null;
|
|
1630
|
+
host.isMessageSending = false;
|
|
1631
|
+
toast.showToast({
|
|
1632
|
+
message: 'You’re offline — media queued',
|
|
1633
|
+
type: 'warning',
|
|
1634
|
+
position: 'bottom-right',
|
|
1635
|
+
});
|
|
1636
|
+
return localId;
|
|
1637
|
+
}
|
|
1445
1638
|
try {
|
|
1446
|
-
const apiId = await uploadAndPostMediaMessage({
|
|
1639
|
+
const apiId = await sendMedia.uploadAndPostMediaMessage({
|
|
1447
1640
|
conversationId: id,
|
|
1448
1641
|
deviceId,
|
|
1449
1642
|
attachments,
|
|
@@ -1451,21 +1644,31 @@ async function hostSendMedia(host, files, conversationId, caption) {
|
|
|
1451
1644
|
caption,
|
|
1452
1645
|
});
|
|
1453
1646
|
if (apiId) {
|
|
1454
|
-
host.allMessages = host.allMessages.map(m => m.messageId === localId
|
|
1647
|
+
host.allMessages = host.allMessages.map(m => m.messageId === localId
|
|
1648
|
+
? Object.assign(Object.assign({}, m), { messageId: apiId, deliveredToAll: false, deliveryStatus: 'sent' }) : m);
|
|
1455
1649
|
}
|
|
1456
|
-
|
|
1457
|
-
var _a;
|
|
1458
|
-
return c.conversationId === id
|
|
1459
|
-
? Object.assign(Object.assign({}, c), { lastMessageDetails: Object.assign(Object.assign({}, c.lastMessageDetails), { body: localMessage.customType || body, updatedAt: Date.now(), senderId: (_a = host.userMetaData) === null || _a === void 0 ? void 0 : _a.userId }) }) : c;
|
|
1460
|
-
}));
|
|
1650
|
+
bumpConversationPreview();
|
|
1461
1651
|
host.replyMessage = null;
|
|
1652
|
+
void hostPersistMessages(host, id);
|
|
1462
1653
|
return apiId || localId;
|
|
1463
1654
|
}
|
|
1464
1655
|
catch (error) {
|
|
1465
1656
|
console.error('web-chat sendMedia failed', error);
|
|
1657
|
+
await hostEnqueueFailedMedia(host, {
|
|
1658
|
+
localId,
|
|
1659
|
+
conversationId: id,
|
|
1660
|
+
files: list,
|
|
1661
|
+
caption,
|
|
1662
|
+
localMessage,
|
|
1663
|
+
});
|
|
1664
|
+
bumpConversationPreview();
|
|
1466
1665
|
host.emitChatError('sendMedia', (error === null || error === void 0 ? void 0 : error.message) || 'Failed to send media', error);
|
|
1467
|
-
toast.showToast({
|
|
1468
|
-
|
|
1666
|
+
toast.showToast({
|
|
1667
|
+
message: (error === null || error === void 0 ? void 0 : error.message) || 'Send failed — media queued for retry',
|
|
1668
|
+
type: 'warning',
|
|
1669
|
+
position: 'bottom-right',
|
|
1670
|
+
});
|
|
1671
|
+
return localId;
|
|
1469
1672
|
}
|
|
1470
1673
|
finally {
|
|
1471
1674
|
host.isMessageSending = false;
|
|
@@ -1572,9 +1775,17 @@ function createMqttContext(host) {
|
|
|
1572
1775
|
|
|
1573
1776
|
/**
|
|
1574
1777
|
* MQTT connect / subscribe / forward for <web-chat>.
|
|
1778
|
+
*
|
|
1779
|
+
* Butter path:
|
|
1780
|
+
* - mqtt.js auto-reconnect (bounded period)
|
|
1781
|
+
* - on every connect → resubscribe + gap-fill (soft merge, no UI wipe)
|
|
1782
|
+
* - while offline → light REST poll for open thread only
|
|
1783
|
+
* - inbound messages processed on a per-host serial queue
|
|
1575
1784
|
*/
|
|
1785
|
+
const OFFLINE_POLL_MS = 15000;
|
|
1576
1786
|
function hostAppendInboundMessage(host, parsedMessage) {
|
|
1577
1787
|
host.allMessages = appendUniqueById(host.allMessages, parsedMessage);
|
|
1788
|
+
void hostPersistMessages(host);
|
|
1578
1789
|
}
|
|
1579
1790
|
/**
|
|
1580
1791
|
* Build MQTT dispatch context from the live <web-chat> host.
|
|
@@ -1591,10 +1802,12 @@ function hostCreateMqttContext(host) {
|
|
|
1591
1802
|
}));
|
|
1592
1803
|
}
|
|
1593
1804
|
async function hostHandleMqttMessage(host, message) {
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1805
|
+
return enqueueMqttTask(host, async () => {
|
|
1806
|
+
const parsedMessage = parseMqttPayload(message);
|
|
1807
|
+
if (!parsedMessage)
|
|
1808
|
+
return;
|
|
1809
|
+
await dispatchMqttMessage(parsedMessage, hostCreateMqttContext(host));
|
|
1810
|
+
});
|
|
1598
1811
|
}
|
|
1599
1812
|
function hostSubscribeToMqtt(host) {
|
|
1600
1813
|
const userId = host.isometrikUserId || host.isometrikUserIdFromCookie;
|
|
@@ -1609,8 +1822,111 @@ function hostSubscribeToMqtt(host) {
|
|
|
1609
1822
|
host.isSubscribedToTopic = true;
|
|
1610
1823
|
host.isMessageListenerAttached = true;
|
|
1611
1824
|
}
|
|
1825
|
+
function clearOfflinePoll(host) {
|
|
1826
|
+
if (host.mqttRefetchInterval) {
|
|
1827
|
+
clearInterval(host.mqttRefetchInterval);
|
|
1828
|
+
host.mqttRefetchInterval = null;
|
|
1829
|
+
}
|
|
1830
|
+
}
|
|
1831
|
+
/** While MQTT is down, lightly refresh the open conversation (not a full wipe). */
|
|
1832
|
+
function startOfflinePoll(host) {
|
|
1833
|
+
if (host.mqttRefetchInterval)
|
|
1834
|
+
return;
|
|
1835
|
+
host.mqttRefetchInterval = setInterval(() => {
|
|
1836
|
+
if (host.isMqttConnected) {
|
|
1837
|
+
clearOfflinePoll(host);
|
|
1838
|
+
return;
|
|
1839
|
+
}
|
|
1840
|
+
void hostGapFillMessages(host);
|
|
1841
|
+
}, OFFLINE_POLL_MS);
|
|
1842
|
+
}
|
|
1843
|
+
/**
|
|
1844
|
+
* Soft gap-fill: fetch latest page and merge by messageId — no clearing the thread
|
|
1845
|
+
* (avoids flicker after reconnect).
|
|
1846
|
+
*/
|
|
1847
|
+
async function hostGapFillMessages(host) {
|
|
1848
|
+
const conversationId = host.selectedConversationId;
|
|
1849
|
+
if (!conversationId || typeof host.getMessages !== 'function')
|
|
1850
|
+
return;
|
|
1851
|
+
try {
|
|
1852
|
+
const page = await mediaLimits.fetchMessagesPage({ conversationId, skip: 0 });
|
|
1853
|
+
if (!Array.isArray(page) || page.length === 0)
|
|
1854
|
+
return;
|
|
1855
|
+
const existing = Array.isArray(host.allMessages) ? host.allMessages : [];
|
|
1856
|
+
const byId = new Map();
|
|
1857
|
+
existing.forEach((m) => {
|
|
1858
|
+
if (m === null || m === void 0 ? void 0 : m.messageId)
|
|
1859
|
+
byId.set(m.messageId, m);
|
|
1860
|
+
});
|
|
1861
|
+
page.forEach((m) => {
|
|
1862
|
+
if (m === null || m === void 0 ? void 0 : m.messageId)
|
|
1863
|
+
byId.set(m.messageId, m);
|
|
1864
|
+
});
|
|
1865
|
+
const merged = Array.from(byId.values()).sort((a, b) => {
|
|
1866
|
+
var _a, _b, _c, _d;
|
|
1867
|
+
const ta = (_b = (_a = a === null || a === void 0 ? void 0 : a.sentAt) !== null && _a !== void 0 ? _a : a === null || a === void 0 ? void 0 : a.updatedAt) !== null && _b !== void 0 ? _b : 0;
|
|
1868
|
+
const tb = (_d = (_c = b === null || b === void 0 ? void 0 : b.sentAt) !== null && _c !== void 0 ? _c : b === null || b === void 0 ? void 0 : b.updatedAt) !== null && _d !== void 0 ? _d : 0;
|
|
1869
|
+
return ta - tb;
|
|
1870
|
+
});
|
|
1871
|
+
// Only write if something new arrived
|
|
1872
|
+
if (merged.length !== existing.length || page.some((m) => (m === null || m === void 0 ? void 0 : m.messageId) && !existing.some((e) => (e === null || e === void 0 ? void 0 : e.messageId) === m.messageId))) {
|
|
1873
|
+
host.allMessages = merged;
|
|
1874
|
+
}
|
|
1875
|
+
}
|
|
1876
|
+
catch (e) {
|
|
1877
|
+
console.error('MQTT gap-fill failed:', e);
|
|
1878
|
+
}
|
|
1879
|
+
}
|
|
1880
|
+
async function onMqttConnected(host) {
|
|
1881
|
+
var _a, _b;
|
|
1882
|
+
const wasReconnect = (host.mqttConnectCount || 0) > 0;
|
|
1883
|
+
host.mqttConnectCount = (host.mqttConnectCount || 0) + 1;
|
|
1884
|
+
host.mqttInitialized = true;
|
|
1885
|
+
host.isMqttConnected = true;
|
|
1886
|
+
hostSubscribeToMqtt(host);
|
|
1887
|
+
host.mqttSession.resubscribe();
|
|
1888
|
+
clearOfflinePoll(host);
|
|
1889
|
+
if (host.selectedConversationId) {
|
|
1890
|
+
if (!host.isInitialCallDone) {
|
|
1891
|
+
try {
|
|
1892
|
+
await index_m.M.getInstance().message.putRead({ conversationId: host.selectedConversationId });
|
|
1893
|
+
}
|
|
1894
|
+
catch (_c) {
|
|
1895
|
+
/* non-fatal */
|
|
1896
|
+
}
|
|
1897
|
+
host.isInitialCallDone = true;
|
|
1898
|
+
}
|
|
1899
|
+
if (wasReconnect) {
|
|
1900
|
+
await hostGapFillMessages(host);
|
|
1901
|
+
void hostPersistMessages(host);
|
|
1902
|
+
// Refresh sidebar previews without blocking UI
|
|
1903
|
+
void Promise.resolve((_a = host.getConversations) === null || _a === void 0 ? void 0 : _a.call(host, 0)).catch(() => undefined);
|
|
1904
|
+
}
|
|
1905
|
+
// Drain any text messages queued while offline / failed
|
|
1906
|
+
void hostFlushOutbox(host);
|
|
1907
|
+
}
|
|
1908
|
+
else if (wasReconnect) {
|
|
1909
|
+
void Promise.resolve((_b = host.getConversations) === null || _b === void 0 ? void 0 : _b.call(host, 0)).catch(() => undefined);
|
|
1910
|
+
void hostFlushOutbox(host);
|
|
1911
|
+
}
|
|
1912
|
+
else {
|
|
1913
|
+
void hostFlushOutbox(host);
|
|
1914
|
+
}
|
|
1915
|
+
}
|
|
1916
|
+
function onMqttUnavailable(host, reason, error) {
|
|
1917
|
+
host.isMqttConnected = false;
|
|
1918
|
+
if (reason === 'error') {
|
|
1919
|
+
host.mqttInitialized = false;
|
|
1920
|
+
const msg = String((error === null || error === void 0 ? void 0 : error.message) || error || '');
|
|
1921
|
+
if (/not authorized/i.test(msg)) {
|
|
1922
|
+
// Auth failure — do not spin reconnect poll forever
|
|
1923
|
+
clearOfflinePoll(host);
|
|
1924
|
+
return;
|
|
1925
|
+
}
|
|
1926
|
+
}
|
|
1927
|
+
startOfflinePoll(host);
|
|
1928
|
+
}
|
|
1612
1929
|
async function hostSetupMqttClient(host) {
|
|
1613
|
-
var _a;
|
|
1614
1930
|
const deviceID = await helpers.getDeviceID();
|
|
1615
1931
|
const clientId = host.isometrikUserId || host.isometrikUserIdFromCookie;
|
|
1616
1932
|
const mqttClient = index_m.M.getInstance().initializeMqtt({
|
|
@@ -1623,44 +1939,28 @@ async function hostSetupMqttClient(host) {
|
|
|
1623
1939
|
deviceId: deviceID,
|
|
1624
1940
|
});
|
|
1625
1941
|
const raw = mqttClient.client;
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
if (raw === null || raw === void 0 ? void 0 : raw.reconnectTimer) {
|
|
1629
|
-
clearInterval(raw.reconnectTimer);
|
|
1630
|
-
raw.reconnectTimer = null;
|
|
1631
|
-
}
|
|
1632
|
-
(_a = raw === null || raw === void 0 ? void 0 : raw.removeAllListeners) === null || _a === void 0 ? void 0 : _a.call(raw, 'error');
|
|
1942
|
+
// Enable mqtt.js reconnect (was previously forced to 0).
|
|
1943
|
+
applyMqttReconnectOptions(raw);
|
|
1633
1944
|
host.mqttClient = mqttClient;
|
|
1634
1945
|
host.isMqttConnected = false;
|
|
1946
|
+
host.mqttConnectCount = host.mqttConnectCount || 0;
|
|
1635
1947
|
host.mqttSession.attach(mqttClient, {
|
|
1636
1948
|
onConnect: async () => {
|
|
1637
|
-
host
|
|
1638
|
-
host.isMqttConnected = true;
|
|
1639
|
-
hostSubscribeToMqtt(host);
|
|
1640
|
-
if (host.mqttRefetchInterval) {
|
|
1641
|
-
clearInterval(host.mqttRefetchInterval);
|
|
1642
|
-
host.mqttRefetchInterval = null;
|
|
1643
|
-
}
|
|
1644
|
-
if (!host.isInitialCallDone && host.selectedConversationId) {
|
|
1645
|
-
await index_m.M.getInstance().message.putRead({ conversationId: host.selectedConversationId });
|
|
1646
|
-
host.refetchMessages();
|
|
1647
|
-
host.isInitialCallDone = true;
|
|
1648
|
-
}
|
|
1949
|
+
await onMqttConnected(host);
|
|
1649
1950
|
},
|
|
1650
1951
|
onDisconnect: () => {
|
|
1952
|
+
onMqttUnavailable(host, 'disconnect');
|
|
1953
|
+
},
|
|
1954
|
+
onOffline: () => {
|
|
1955
|
+
onMqttUnavailable(host, 'offline');
|
|
1956
|
+
},
|
|
1957
|
+
onReconnect: () => {
|
|
1958
|
+
// mqtt.js is attempting reconnect — keep poll until connect succeeds
|
|
1651
1959
|
host.isMqttConnected = false;
|
|
1652
1960
|
},
|
|
1653
1961
|
onError: (error) => {
|
|
1654
1962
|
console.error('MQTT connection error:', error);
|
|
1655
|
-
host
|
|
1656
|
-
host.isMqttConnected = false;
|
|
1657
|
-
if (/not authorized/i.test(String((error === null || error === void 0 ? void 0 : error.message) || error)))
|
|
1658
|
-
return;
|
|
1659
|
-
if (!host.mqttRefetchInterval) {
|
|
1660
|
-
host.mqttRefetchInterval = setInterval(() => {
|
|
1661
|
-
host.refetchMessages();
|
|
1662
|
-
}, 30000);
|
|
1663
|
-
}
|
|
1963
|
+
onMqttUnavailable(host, 'error', error);
|
|
1664
1964
|
},
|
|
1665
1965
|
onMessage: async (_topic, message) => {
|
|
1666
1966
|
await hostHandleMqttMessage(host, message);
|
|
@@ -1748,7 +2048,7 @@ function removeMessageById(messages, messageId) {
|
|
|
1748
2048
|
}
|
|
1749
2049
|
/** After deleting a message, fix lastMessageDetails on the conversation row if needed. */
|
|
1750
2050
|
function patchListAfterMessageDelete(list, remainingMessages, payload) {
|
|
1751
|
-
return sortConversationsByLatestMessage((list || []).map(conversation => {
|
|
2051
|
+
return sendMedia.sortConversationsByLatestMessage((list || []).map(conversation => {
|
|
1752
2052
|
var _a, _b, _c;
|
|
1753
2053
|
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) {
|
|
1754
2054
|
const forConv = remainingMessages
|
|
@@ -2172,16 +2472,26 @@ const selectChatPlaceholderSvg = `
|
|
|
2172
2472
|
`;
|
|
2173
2473
|
|
|
2174
2474
|
/** Presentational shell tree for <web-chat> — keeps WebChat.tsx thin. */
|
|
2475
|
+
/** show / custom-slot / default matrix for any named region. */
|
|
2476
|
+
function renderRegion(host, slotName, show, renderDefault) {
|
|
2477
|
+
const mode = sendMedia.resolveRegionMode({
|
|
2478
|
+
show,
|
|
2479
|
+
hasCustomSlot: index$1.hasNamedSlot(host.el, slotName),
|
|
2480
|
+
});
|
|
2481
|
+
if (mode === 'hidden')
|
|
2482
|
+
return null;
|
|
2483
|
+
if (mode === 'custom')
|
|
2484
|
+
return index.h("slot", { name: slotName });
|
|
2485
|
+
return renderDefault();
|
|
2486
|
+
}
|
|
2175
2487
|
function renderBootLoader(host) {
|
|
2176
|
-
return (index.h("div", { class: "boot-loader-shell" },
|
|
2177
|
-
index.h("slot", { name: "boot-loader" },
|
|
2178
|
-
index.h("chat-loading-placeholder", { progress: host.loadingProgress, loadingStatus: host.loadingStatus }))));
|
|
2488
|
+
return (index.h("div", { class: "boot-loader-shell" }, renderRegion(host, 'boot-loader', true, () => (index.h("chat-loading-placeholder", { progress: host.loadingProgress, loadingStatus: host.loadingStatus })))));
|
|
2179
2489
|
}
|
|
2180
2490
|
function renderBusyOverlay(host) {
|
|
2181
2491
|
if (!host.isConversationLoading)
|
|
2182
2492
|
return null;
|
|
2183
2493
|
return (index.h("div", { class: "loaderoverlay" },
|
|
2184
|
-
index.h("spinner-loader", { height: "30px", width: "30px", spinTime: "1s", spinnerPrimaryColor: "var(--bg-primary
|
|
2494
|
+
index.h("spinner-loader", { height: "30px", width: "30px", spinTime: "1s", spinnerPrimaryColor: "var(--bg-primary)", spinnerSecondaryColor: "var(--text-primary)", spinnerBorderWidth: "2px" })));
|
|
2185
2495
|
}
|
|
2186
2496
|
function renderDefaultConversationList(host) {
|
|
2187
2497
|
var _a;
|
|
@@ -2199,47 +2509,50 @@ function renderDefaultConversationList(host) {
|
|
|
2199
2509
|
marginBottom: '10px',
|
|
2200
2510
|
}, filterTab: {
|
|
2201
2511
|
padding: '10px 15px',
|
|
2202
|
-
border: '1px solid var(--
|
|
2512
|
+
border: '1px solid var(--brand-soft)',
|
|
2203
2513
|
borderRadius: '25px',
|
|
2204
2514
|
backgroundColor: 'transparent',
|
|
2205
2515
|
cursor: 'pointer',
|
|
2206
2516
|
transition: 'background-color 0.3s',
|
|
2207
|
-
color: 'var(--text-tertiary
|
|
2517
|
+
color: 'var(--text-tertiary)',
|
|
2208
2518
|
fontSize: '12px',
|
|
2209
2519
|
textTransform: 'uppercase',
|
|
2210
2520
|
}, filterTabHover: {
|
|
2211
|
-
backgroundColor: 'var(--
|
|
2521
|
+
backgroundColor: 'var(--brand-soft)',
|
|
2212
2522
|
}, isSidebarHeaderLabel: host.isSidebarHeaderLabel, isSidebarHeaderSearch: host.isSidebarHeaderSearch, sidebarHeaderLabel: host.sidebarHeaderLabel, sidebarColor: host.sidebarColor, sidebarSelectedColor: host.sidebarSelectedColor, onGroupExited: (e) => host.handleGroupExited(e), handleSearchData: (searchTag) => host.getConversations(0, searchTag, true), allMessages: host.allMessages, isConversationLoading: host.isLoadingConversationList }));
|
|
2213
2523
|
}
|
|
2214
2524
|
function renderSidebarTab(host) {
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
}
|
|
2227
|
-
return
|
|
2525
|
+
const groupcastOn = host.groupcastEnabled !== false;
|
|
2526
|
+
const tab = host.activeTab === 'GroupCast' && !groupcastOn ? 'Chat' : host.activeTab;
|
|
2527
|
+
if (tab === 'GroupCast') {
|
|
2528
|
+
return renderRegion(host, 'group-cast', true, () => (index.h("group-cast", { isLoadingMore: host.isLoadingMoreGroupcast, groupCastData: host.allGroupCastContacts, userMetaData: host.userMetaData, onGroupcastTileSelected: (e) => host.handleChatSelect(e.detail), onCreated: (g) => {
|
|
2529
|
+
if (!(g === null || g === void 0 ? void 0 : g.groupcastId))
|
|
2530
|
+
return;
|
|
2531
|
+
host.allGroupCastContacts = [g, ...(host.allGroupCastContacts || [])];
|
|
2532
|
+
} })));
|
|
2533
|
+
}
|
|
2534
|
+
if (tab === 'Profile') {
|
|
2535
|
+
return renderRegion(host, 'profile-page', true, () => (index.h("profile-page", { getUserDetails: host.getUserDetails, name: host.userMetaData.userName, profilePhotoUrl: host.userMetaData.userProfileImageUrl, closeDrawer: () => (host.activeTab = 'Chat'), toggleTheme: host.toggleTheme, defaultTheme: host.defaultTheme })));
|
|
2536
|
+
}
|
|
2537
|
+
return renderRegion(host, 'conversation-list', host.showConversationList, () => renderDefaultConversationList(host));
|
|
2538
|
+
}
|
|
2539
|
+
function renderProfileRail(host) {
|
|
2540
|
+
return renderRegion(host, 'profile-rail', host.showProfileRail, () => (index.h("profile-sidebar", { userMetaData: host.userMetaData, activeTab: host.activeTab, openChat: () => (host.activeTab = 'Chat'), openProfile: () => (host.activeTab = 'Profile'), openGroupCast: () => {
|
|
2541
|
+
if (host.groupcastEnabled === false)
|
|
2542
|
+
return;
|
|
2543
|
+
host.getGroupCastContacts();
|
|
2544
|
+
}, unreadConversationsCount: host.unreadConversationsCount })));
|
|
2228
2545
|
}
|
|
2229
2546
|
function renderDefaultSidebar(host) {
|
|
2230
|
-
// Hosts can pass showProfileRail={false} — no DOM poke / empty slots needed.
|
|
2231
|
-
const showRail = host.showProfileRail !== false;
|
|
2232
2547
|
return (index.h(index.Fragment, null,
|
|
2233
|
-
|
|
2234
|
-
index.h("profile-sidebar", { userMetaData: host.userMetaData, activeTab: host.activeTab, openChat: () => (host.activeTab = 'Chat'), openProfile: () => (host.activeTab = 'Profile'), openGroupCast: () => host.getGroupCastContacts(), unreadConversationsCount: host.unreadConversationsCount }))) : null,
|
|
2548
|
+
renderProfileRail(host),
|
|
2235
2549
|
index.h("div", { class: "sidebar-tab" }, renderSidebarTab(host))));
|
|
2236
2550
|
}
|
|
2237
2551
|
function renderLeftRail(host) {
|
|
2238
2552
|
return (index.h("div", { class: {
|
|
2239
2553
|
'chat-sidebar-container': true,
|
|
2240
2554
|
'hidden': host.isMobileView && !host.showSidebar,
|
|
2241
|
-
} },
|
|
2242
|
-
index.h("slot", { name: "sidebar" }, renderDefaultSidebar(host))));
|
|
2555
|
+
} }, renderRegion(host, 'sidebar', true, () => renderDefaultSidebar(host))));
|
|
2243
2556
|
}
|
|
2244
2557
|
function renderDefaultComposer(host) {
|
|
2245
2558
|
var _a;
|
|
@@ -2247,9 +2560,9 @@ function renderDefaultComposer(host) {
|
|
|
2247
2560
|
return (index.h("div", { style: {
|
|
2248
2561
|
padding: '1rem',
|
|
2249
2562
|
textAlign: 'center',
|
|
2250
|
-
backgroundColor: 'var(--bg-secondary
|
|
2251
|
-
color: 'var(--text-primary
|
|
2252
|
-
borderTop: '1px solid var(--bg-secondary
|
|
2563
|
+
backgroundColor: 'var(--bg-secondary)',
|
|
2564
|
+
color: 'var(--text-primary)',
|
|
2565
|
+
borderTop: '1px solid var(--bg-secondary)',
|
|
2253
2566
|
} }, "You are no longer a member of this group"));
|
|
2254
2567
|
}
|
|
2255
2568
|
if (host.isBlocked === 'loading') {
|
|
@@ -2258,9 +2571,6 @@ function renderDefaultComposer(host) {
|
|
|
2258
2571
|
if ((_a = host.conversationMetaData) === null || _a === void 0 ? void 0 : _a.messagingDisabled) {
|
|
2259
2572
|
return index.h("p", { class: "blockMessageContainer" }, content.WEB_CONTENT.BLOCK_CHAT_MESSAGE);
|
|
2260
2573
|
}
|
|
2261
|
-
// Only re-project when the host actually filled the slot. An empty
|
|
2262
|
-
// <slot slot="composer-input"> still counts as assigned content and
|
|
2263
|
-
// suppresses chat-footer's default <my-test-footer-ui> fallback.
|
|
2264
2574
|
const el = host.el;
|
|
2265
2575
|
return (index.h("chat-footer", { userMetaData: host.userMetaData, updateAllMessages: host.updateAllMessages, changeMessageSendingState: host.changeMessageSendingState, changeScrollToBottomState: host.changeScrollToBottomState, refetchMessages: host.refetchMessages, allMessages: host.allMessages, selectedConversationId: host.selectedConversationId, replyMessage: host.replyMessage, handleremoveReplyMessage: host.handleremoveReplyMessage, conversationDetails: host.conversationMetaData, allConversationList: host.allConversationList, updateConversationListProp: host.updateConversationList },
|
|
2266
2576
|
index$1.hasNamedSlot(el, 'reply-preview') ? index.h("slot", { name: "reply-preview", slot: "reply-preview" }) : null,
|
|
@@ -2269,10 +2579,10 @@ function renderDefaultComposer(host) {
|
|
|
2269
2579
|
}
|
|
2270
2580
|
/** slot="composer" replaces whole footer; else reply-preview / attachment-preview / composer-input */
|
|
2271
2581
|
function renderComposerOrBanner(host) {
|
|
2272
|
-
return
|
|
2582
|
+
return renderRegion(host, 'composer', host.showComposer, () => renderDefaultComposer(host));
|
|
2273
2583
|
}
|
|
2274
2584
|
function renderDefaultEmptyChat(_host) {
|
|
2275
|
-
return (index.h("div", { style: { backgroundColor: 'var(--bg-secondary
|
|
2585
|
+
return (index.h("div", { style: { backgroundColor: 'var(--bg-secondary)', color: 'var(--text-tertiary)' }, class: "noChatSelectedPlaceholder" },
|
|
2276
2586
|
index.h("div", { innerHTML: selectChatPlaceholderSvg }),
|
|
2277
2587
|
index.h("span", null, "\"Start a Conversation\""),
|
|
2278
2588
|
index.h("span", null,
|
|
@@ -2282,23 +2592,23 @@ function renderDefaultEmptyChat(_host) {
|
|
|
2282
2592
|
}
|
|
2283
2593
|
function renderDefaultHeader(host) {
|
|
2284
2594
|
var _a, _b;
|
|
2285
|
-
return (index.h("web-chat-header", { searchedMessageDetails: host.searchedMessageDetails, onSearchHandler: (text) => host.getMessagesByQuery(text), onSearchResultClick: host.handleSearchResultClick, headerBgColor: "var(--bg-primary
|
|
2595
|
+
return (index.h("web-chat-header", { searchedMessageDetails: host.searchedMessageDetails, onSearchHandler: (text) => host.getMessagesByQuery(text), onSearchResultClick: host.handleSearchResultClick, headerBgColor: "var(--bg-primary)", headerLastSeenColor: "var(--text-secondary)", headerSvgColor: "var(--text-primary)", headerUsernameColor: "var(--text-primary)", onClearConversation: () => host.clearConversation(), conversationDetails: host.conversationMetaData, isTyping: host.isTyping && host.selectedConversationId === host.typingConversationId, typingUserName: host.typingUserName, chatBodyRef: host.chatBodyRef, onTextClick: () => host.getAllAttachments(host.selectedConversationId), allAttachments: host.allAttachments, lastSeen: (_b = (_a = host.conversationMetaData) === null || _a === void 0 ? void 0 : _a.opponentDetails) === null || _b === void 0 ? void 0 : _b.lastSeen, userMetaData: host.userMetaData, selectedConversationId: host.selectedConversationId, messageAction: host.messageAction, eligibleMembers: host.eligibleMembers, hasMoreEligibleMembers: host.hasMoreEligibleMembers, handleCloseChat: () => host.handleCloseChat(), typingConversationId: host.typingConversationId, isBlocked: host.isBlocked, onBackButtonClick: () => host.handleBackButton() }));
|
|
2286
2596
|
}
|
|
2287
2597
|
function renderDefaultMessages(host) {
|
|
2288
2598
|
var _a;
|
|
2289
2599
|
return (index.h("web-chat-body", { ref: el => (host.chatBodyRef = el), allAttachments: host.allAttachments, isMessagesLoading: host.isMessagesLoading, updateSkip: host.updateSkip, isMessageLimitEnd: host.isMessageLimitEnd, allMessages: host.allMessages, userMetaData: host.userMetaData, skip: host.skip, isScrollToBottom: host.isScrollToBottom, changeScrollToBottomState: host.changeScrollToBottomState, isMessageSending: host.isMessageSending, isScrollToTop: host.isScrollToTop, changeScrollToTopState: host.changeScrollToTopState, deleteForSelf: host.deleteMessageFromSelf, deleteForAll: host.deleteMeassageFromEveryOne, isChatClosed: host.isChatClosed, isChatMinimized: host.isChatMinimized, updateAllMessages: host.updateAllMessages, selectedConversationId: host.selectedConversationId, highlightedMessageId: host.highlightedMessageId, onMediaClick: () => host.getAllAttachments(host.selectedConversationId), onReplyMessageDetails: host.handleReplyMessage, conversationList: host.allConversationList, newMessageNotification: host.newMessageNotification, onNewMessageCountReset: () => host.resetNewMessageNotification(), conversationDetails: host.conversationMetaData, loadingMediaGallery: host.loadingMediaGallery, customParts: (_a = host.customParts) !== null && _a !== void 0 ? _a : {} }, index$1.hasNamedSlot(host.el, 'message-info') ? index.h("slot", { name: "message-info", slot: "message-info" }) : null));
|
|
2290
2600
|
}
|
|
2291
2601
|
function renderActiveChat(host) {
|
|
2292
|
-
const info = host.
|
|
2602
|
+
const info = host.messageInfoView;
|
|
2293
2603
|
return (index.h("div", { class: { 'chat-pane-row': true, 'info-open': !!(info === null || info === void 0 ? void 0 : info.open) } },
|
|
2294
2604
|
index.h("div", { class: "chat-main-stack" },
|
|
2295
|
-
|
|
2296
|
-
|
|
2605
|
+
renderRegion(host, 'header', host.showHeader, () => renderDefaultHeader(host)),
|
|
2606
|
+
renderRegion(host, 'messages', true, () => renderDefaultMessages(host)),
|
|
2297
2607
|
renderComposerOrBanner(host)),
|
|
2298
2608
|
(info === null || info === void 0 ? void 0 : info.open) ? (index.h("div", { class: "message-info-dock" }, info.isLoading ? (index.h("div", { class: "message-info-loading" },
|
|
2299
2609
|
index.h("spinner-loader", { height: "20px", width: "20px", spinTime: "1s", spinnerPrimaryColor: "var(--brand, #2563eb)", spinnerSecondaryColor: "var(--border, #e5e7eb)", spinnerBorderWidth: "2px" }))) : (index.h("message-info", { selectedMessage: info.selectedMessage, messageDeliveryTime: info.messageDeliveryTime, messageReadTime: info.messageReadTime, readUserList: info.readUserList || [], deliveryUserList: info.deliveryUserList || [], isGroup: info.isGroup, pendingReadCount: info.pendingReadCount, pendingDeliveryCount: info.pendingDeliveryCount, allAttachments: host.allAttachments, onMediaClick: () => host.getAllAttachments(host.selectedConversationId), closePopup: () => {
|
|
2300
2610
|
var _a, _b;
|
|
2301
|
-
host.
|
|
2611
|
+
host.messageInfoView = null;
|
|
2302
2612
|
(_b = (_a = host.chatBodyRef) === null || _a === void 0 ? void 0 : _a.closeMessageInfo) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
2303
2613
|
} })))) : null));
|
|
2304
2614
|
}
|
|
@@ -2316,7 +2626,7 @@ function renderChatPane(host) {
|
|
|
2316
2626
|
}
|
|
2317
2627
|
: host.selectedConversationId
|
|
2318
2628
|
? { background: 'var(--bg-tertiary, #f4f4f5)' }
|
|
2319
|
-
: undefined }, host.selectedConversationId ? (renderActiveChat(host)) : (
|
|
2629
|
+
: undefined }, host.selectedConversationId ? (renderActiveChat(host)) : (renderRegion(host, 'empty', host.showEmptyState, () => renderDefaultEmptyChat()))));
|
|
2320
2630
|
}
|
|
2321
2631
|
function renderDefaultRightPanel(host) {
|
|
2322
2632
|
return (index.h("web-chat-right-sidebar", { conversationMetaData: host.isProfileInfoOpen ? host.selctConversationMetaData : host.conversationMetaData, selectedConversationId: host.selectedConversationId, hasMoreEligibleMembers: host.hasMoreEligibleMembers, eligibleMembers: host.eligibleMembers, allAttachments: host.isProfileInfoOpen ? host.selectConverSationAttachments : host.allAttachments, userMetaData: host.userMetaData, messageAction: host.messageAction, searchedMessageDetails: host.searchedMessageDetails, onSearchHandler: (text) => host.getMessagesByQuery(text), onSearchResultClick: host.handleSearchResultClick, isContactInfoOpen: host.isContactInfoOpen, isProfileInfoOpen: host.isProfileInfoOpen, isOpenSearchBar: host.isOpenSearchBar, chatBodyRef: host.chatBodyRef, isLoadingMessage: host.isLoadingMessage, conversationIdFromContactinfo: host.conversationIdFromContactinfo, openOwnProfile: () => (host.activeTab = 'Profile'), handleChatSelect: conversationId => host.handleChatSelect(conversationId), allLinks: host.allLinks, allLinksCount: host.allLinksCount, isBlocked: host.isBlocked, groupcastMembers: host.groupcastMembers },
|
|
@@ -2325,10 +2635,11 @@ function renderDefaultRightPanel(host) {
|
|
|
2325
2635
|
index$1.hasNamedSlot(host.el, 'message-search') ? index.h("slot", { name: "message-search", slot: "message-search" }) : null));
|
|
2326
2636
|
}
|
|
2327
2637
|
function renderRightRail(host) {
|
|
2638
|
+
if (host.showRightPanel === false)
|
|
2639
|
+
return null;
|
|
2328
2640
|
if (!host.showRightSideBar)
|
|
2329
2641
|
return null;
|
|
2330
|
-
return (index.h("div", { class: "chat-sidebar-right" },
|
|
2331
|
-
index.h("slot", { name: "right-panel" }, renderDefaultRightPanel(host))));
|
|
2642
|
+
return (index.h("div", { class: "chat-sidebar-right" }, renderRegion(host, 'right-panel', true, () => renderDefaultRightPanel(host))));
|
|
2332
2643
|
}
|
|
2333
2644
|
|
|
2334
2645
|
const webChatCss = ":host{display:flex;flex:1;width:var(--w-full);min-height:100dvh;height:var(--h-full)}web-chat{display:flex;flex:1;width:var(--w-full);min-height:100dvh;height:var(--h-full)}.boot-loader-shell{display:flex;flex:1;width:var(--w-full);min-height:100dvh;height:var(--h-full);align-items:stretch;justify-content:stretch}.boot-loader-shell>chat-loading-placeholder,.boot-loader-shell>slot[name='boot-loader']{display:flex;flex:1;width:var(--w-full);min-height:100dvh}.isometrik-quickchat{box-shadow:0 0 1.25rem 1px color-mix(in srgb, var(--brand) 15%, transparent);display:flex;height:100dvh;width:var(--w-full)}.chat-sidebar-container{width:30%;min-width:var(--sidebar-width);transition:all 0.3s ease;border-right:1px solid var(--border);display:flex;flex-direction:row;background-color:var(--bg-primary);overflow:hidden;min-height:0}profile-sidebar,profile-sidebar-ui{display:flex;height:var(--h-full);flex-shrink:0}.chat-sidebar-right{width:30%;min-width:var(--sidebar-width);transition:all 0.3s ease;border-left:1px solid var(--border);background-color:var(--bg-primary)}.loaderoverlay{width:var(--w-full);position:absolute;margin:auto;background:var(--overlay);z-index:1400}.sidebar-tab{flex:1;min-width:0;height:var(--h-full);min-height:0;background-color:var(--bg-primary);display:flex;flex-direction:column;overflow:hidden}.sidebar-tab>*{flex:1;min-height:0;min-width:0;width:var(--w-full);max-width:var(--w-full)}.chat-body-container{flex:1;display:flex;flex-direction:column;transition:all 0.3s ease;background-color:var(--bg-secondary);position:relative;min-height:0;min-width:0}.chat-pane-row{flex:1;min-height:0;min-width:0;display:flex;flex-direction:row;align-items:stretch;overflow:hidden}.chat-main-stack{flex:1;min-width:0;min-height:0;display:flex;flex-direction:column;overflow:hidden}.message-info-dock{flex:0 0 clamp(280px, 36%, 380px);height:var(--h-full);min-height:0;display:flex;flex-direction:column;background:var(--bg-primary);border-left:1px solid var(--border);overflow:hidden}.message-info-dock message-info{flex:1;min-height:0;height:var(--h-full);display:block}.message-info-loading{flex:1;display:flex;align-items:center;justify-content:center}.chat-sidebar-container>slot[name='sidebar'],.chat-sidebar-container slot[name='profile-rail'],.sidebar-tab>slot[name='conversation-list'],.sidebar-tab>slot[name='profile-page'],.sidebar-tab>slot[name='group-cast'],.chat-body-container>slot[name='empty'],.chat-main-stack>slot[name='header'],.chat-main-stack>slot[name='messages'],.chat-main-stack>slot[name='composer'],.chat-sidebar-right>slot[name='right-panel']{display:contents}::slotted([slot='sidebar']),::slotted([slot='profile-rail']),::slotted([slot='conversation-list']),::slotted([slot='profile-page']),::slotted([slot='group-cast']),::slotted([slot='empty']),::slotted([slot='messages']),::slotted([slot='right-panel']),::slotted([slot='contact-info']),::slotted([slot='profile-info']),::slotted([slot='message-search']),::slotted([slot='boot-loader']){display:flex;flex-direction:column;flex:1;min-height:0;width:var(--w-full);height:var(--h-full)}::slotted([slot='header']),::slotted([slot='composer']),::slotted([slot='composer-input']),::slotted([slot='reply-preview']),::slotted([slot='attachment-preview']){display:block;width:var(--w-full);flex-shrink:0}.noChatSelectedPlaceholder{height:var(--h-full);width:var(--w-full);display:flex;align-items:center;justify-content:center;font-size:var(--text-20);flex-direction:column;gap:var(--gap-4);color:var(--text-primary)}.noChatSelectedPlaceholder span:nth-child(2){font-size:var(--text-24);font-weight:var(--fw-700);margin-top:var(--space-16)}.noChatSelectedPlaceholder span:nth-child(3){font-size:var(--text-18);text-align:center;color:var(--text-secondary)}.loadingPlaceholder{height:var(--h-full);width:var(--w-full);z-index:12839283}.back-button{display:none;padding:0;background:none;border:none;cursor:pointer;align-items:center;gap:var(--gap-4)}spinner-loader{display:flex;height:100dvh}.blockMessageContainer{text-align:center;padding:var(--space-16) 0;margin:0;background-color:var(--bg-secondary);color:var(--text-secondary)}@media (max-width: 768px){.isometrik-quickchat{position:relative;overflow:hidden}.chat-sidebar-right{width:var(--w-full);height:var(--h-full);min-width:100% !important;position:absolute;left:0;top:0;z-index:20;display:flex;flex-direction:column;background-color:var(--bg-primary);transition:all 0.3s ease;border:none}.chat-sidebar-right>*{flex:1;min-height:0;width:var(--w-full);height:var(--h-full)}.chat-sidebar-container{width:var(--w-full);height:var(--h-full);position:absolute;left:0;top:0;transform:translateX(0);transition:transform 0.3s ease;z-index:2;min-width:100% !important}.chat-sidebar-container.hidden{transform:translateX(-100%)}.chat-body-container{width:var(--w-full);height:var(--h-full);position:absolute;left:0;top:0;transform:translateX(100%);transition:transform 0.3s ease;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:var(--rail-width);z-index:10;top:var(--space-16)}}";
|
|
@@ -2351,6 +2662,8 @@ const WebChat = class {
|
|
|
2351
2662
|
this.mqttSession = new MqttSession();
|
|
2352
2663
|
this.boundCheckMobileView = () => this.checkMobileView();
|
|
2353
2664
|
this.mqttRefetchInterval = null;
|
|
2665
|
+
/** How many successful MQTT connects this mount (0 = first, >0 = reconnect). Used by mqtt-host. */
|
|
2666
|
+
this.mqttConnectCount = 0;
|
|
2354
2667
|
this.typingClearTimeout = null;
|
|
2355
2668
|
this.initGeneration = 0;
|
|
2356
2669
|
this.chatReadyEmitted = false;
|
|
@@ -2443,9 +2756,8 @@ const WebChat = class {
|
|
|
2443
2756
|
this.skip += 20;
|
|
2444
2757
|
}
|
|
2445
2758
|
}
|
|
2446
|
-
const chatBody =
|
|
2447
|
-
if (chatBody) {
|
|
2448
|
-
// @ts-ignore
|
|
2759
|
+
const chatBody = this.chatBodyRef;
|
|
2760
|
+
if (chatBody === null || chatBody === void 0 ? void 0 : chatBody.scrollToMessage) {
|
|
2449
2761
|
chatBody.scrollToMessage(messageId);
|
|
2450
2762
|
}
|
|
2451
2763
|
};
|
|
@@ -2457,7 +2769,7 @@ const WebChat = class {
|
|
|
2457
2769
|
drawer.drawerDialogService.closeDialog('confirm-dialog');
|
|
2458
2770
|
};
|
|
2459
2771
|
this.updateConversationList = (updatedList) => {
|
|
2460
|
-
const sortedList = sortConversationsByLatestMessage(updatedList);
|
|
2772
|
+
const sortedList = sendMedia.sortConversationsByLatestMessage(updatedList);
|
|
2461
2773
|
this.allConversationList = sortedList;
|
|
2462
2774
|
return sortedList;
|
|
2463
2775
|
};
|
|
@@ -2476,9 +2788,14 @@ const WebChat = class {
|
|
|
2476
2788
|
this.accountId = undefined;
|
|
2477
2789
|
this.conversationId = undefined;
|
|
2478
2790
|
this.hostUrl = undefined;
|
|
2479
|
-
this.groupcastEnabled =
|
|
2791
|
+
this.groupcastEnabled = true;
|
|
2480
2792
|
this.showProfileRail = true;
|
|
2481
2793
|
this.showChatWallpaper = true;
|
|
2794
|
+
this.showHeader = true;
|
|
2795
|
+
this.showComposer = true;
|
|
2796
|
+
this.showEmptyState = true;
|
|
2797
|
+
this.showConversationList = true;
|
|
2798
|
+
this.showRightPanel = true;
|
|
2482
2799
|
this.unreadConversations = [];
|
|
2483
2800
|
this.allLinks = undefined;
|
|
2484
2801
|
this.allLinksCount = undefined;
|
|
@@ -2531,8 +2848,8 @@ const WebChat = class {
|
|
|
2531
2848
|
this.isSidebarHeaderLabel = true;
|
|
2532
2849
|
this.sidebarHeaderLabel = 'Chats';
|
|
2533
2850
|
this.isSidebarHeaderSearch = true;
|
|
2534
|
-
this.sidebarColor = 'var(--bg-primary
|
|
2535
|
-
this.sidebarSelectedColor = 'var(--
|
|
2851
|
+
this.sidebarColor = 'var(--bg-primary)';
|
|
2852
|
+
this.sidebarSelectedColor = 'var(--brand-soft)';
|
|
2536
2853
|
this.messageSearchText = '';
|
|
2537
2854
|
this.searchedMessageDetails = [];
|
|
2538
2855
|
this.initialConversationIdFromURL = '';
|
|
@@ -2718,6 +3035,7 @@ const WebChat = class {
|
|
|
2718
3035
|
clearTimeout(this.typingClearTimeout);
|
|
2719
3036
|
this.typingClearTimeout = null;
|
|
2720
3037
|
}
|
|
3038
|
+
hostTeardownOffline(this);
|
|
2721
3039
|
this.mqttSession.teardown();
|
|
2722
3040
|
this.mqttClient = null;
|
|
2723
3041
|
this.isMqttConnected = false;
|
|
@@ -2736,6 +3054,8 @@ const WebChat = class {
|
|
|
2736
3054
|
this.isContactInfoOpen = false;
|
|
2737
3055
|
this.isOpenSearchBar = false;
|
|
2738
3056
|
this.conversationMetaData = metaFromConversationList(this.allConversationList, conversationId);
|
|
3057
|
+
// Show cached thread instantly while network fetch runs
|
|
3058
|
+
void hostHydrateMessagesFromCache(this, conversationId);
|
|
2739
3059
|
if (typeof param === 'string') {
|
|
2740
3060
|
this.getAllAttachments(conversationId);
|
|
2741
3061
|
pushConversationUrl(conversationId || null);
|
|
@@ -2764,7 +3084,7 @@ const WebChat = class {
|
|
|
2764
3084
|
pushConversationUrl(null);
|
|
2765
3085
|
}
|
|
2766
3086
|
sortConversationsByLatestMessage(conversations) {
|
|
2767
|
-
return sortConversationsByLatestMessage(conversations);
|
|
3087
|
+
return sendMedia.sortConversationsByLatestMessage(conversations);
|
|
2768
3088
|
}
|
|
2769
3089
|
async handleRemoveMemberClicked(event) {
|
|
2770
3090
|
return hostRemoveMemberClicked(this, event);
|