isometrik-plugin-chat-sdk 1.3.18 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +708 -376
- 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 +152 -41
- 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 +643 -312
- 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 +691 -359
- 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 +13 -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-09fc122b.entry.js +0 -2
- package/dist/isometrik-webchat/p-09fc122b.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
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
import { h, Fragment, proxyCustomElement, HTMLElement, createEvent } from '@stencil/core/internal/client';
|
|
2
2
|
import { d as defineCustomElement$5 } from './spinner-loader2.js';
|
|
3
3
|
import { d as defineCustomElement$s } from './ChatSidebar.js';
|
|
4
|
-
import { d as defineCustomElement$n } from './
|
|
4
|
+
import { d as defineCustomElement$n } from './GroupCast2.js';
|
|
5
5
|
import { d as defineCustomElement$2 } from './WebChatHeader.js';
|
|
6
6
|
import { d as defineCustomElement$u } from './ChatFooter.js';
|
|
7
7
|
import { d as defineCustomElement$a } from './Profile.js';
|
|
8
8
|
import { d as defineCustomElement$9 } from './profile-sidebar2.js';
|
|
9
|
-
import {
|
|
9
|
+
import { d as defineCustomElement$q } from './contact-info2.js';
|
|
10
10
|
import { g as groupMembersStore, d as defineCustomElement$1 } from './WebchatRightSide.js';
|
|
11
11
|
import { d as defineCustomElement$t } from './chat-loading-placeholder2.js';
|
|
12
12
|
import { d as drawerDialogService } from './drawer.js';
|
|
13
13
|
import { g as getDeviceID, a as getGroupcastUrlQuery } from './helpers.js';
|
|
14
14
|
import { M } from './index.m.js';
|
|
15
15
|
import { c as createStore } from './conversation.js';
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
16
|
+
import { b as getGroupcastMessage, r as removeGroupcastMember, d as deleteGroupCast } from './groupcast.js';
|
|
17
|
+
import { n as getOfflineClient, o as mergeMessagesById, q as isBrowserOnline, p as prepareMediaAttachments, u as uploadAndPostMediaMessage, i as initializeChatSdk, f as fetchUserDetails, a as fetchConversationsPage, m as mergeUniqueConversations, c as fetchGroupcastDetails, b as fetchConversationDetails, d as fetchGroupcastMembersPage, e as fetchGroupcastContactsPage, v as buildLocalMediaAttachments, h as customTypeFromMime, j as buildReplyMetaData, s as sortConversationsByLatestMessage, k as resolveRegionMode } from './client.js';
|
|
18
|
+
import { t as takeMediaFiles, M as MAX_MEDIA_PER_MESSAGE, m as mediaLimitToastMessage } from './media-limits.js';
|
|
19
|
+
import { f as fetchMessagesPage, s as searchMessages, a as fetchLinkMessages, b as fetchMediaCount, c as fetchMediaAttachments } from './messages.js';
|
|
18
20
|
import { s as showToast } from './toast.js';
|
|
21
|
+
import { M as MQTT_CREDS, i as isometrikFlutterAppSecrets } from './chat-creds.js';
|
|
19
22
|
import { r as removeConversationMember, g as getConversationEligibleMembers } from './group-members.js';
|
|
20
23
|
import { W as WEB_CONTENT } from './content.js';
|
|
21
24
|
import { h as hasNamedSlot } from './index2.js';
|
|
@@ -44,10 +47,64 @@ import { d as defineCustomElement$6 } from './searchable-list2.js';
|
|
|
44
47
|
import { d as defineCustomElement$4 } from './video-message2.js';
|
|
45
48
|
import { d as defineCustomElement$3 } from './WebChatBody.js';
|
|
46
49
|
|
|
50
|
+
const MAX_OUTBOX_MEDIA_BYTES = 12 * 1024 * 1024;
|
|
51
|
+
function arrayBufferToBase64(buf) {
|
|
52
|
+
const bytes = new Uint8Array(buf);
|
|
53
|
+
const chunk = 0x8000;
|
|
54
|
+
let binary = '';
|
|
55
|
+
for (let i = 0; i < bytes.length; i += chunk) {
|
|
56
|
+
binary += String.fromCharCode(...bytes.subarray(i, i + chunk));
|
|
57
|
+
}
|
|
58
|
+
return btoa(binary);
|
|
59
|
+
}
|
|
60
|
+
function base64ToUint8(base64) {
|
|
61
|
+
const binary = atob(base64);
|
|
62
|
+
const out = new Uint8Array(binary.length);
|
|
63
|
+
for (let i = 0; i < binary.length; i++)
|
|
64
|
+
out[i] = binary.charCodeAt(i);
|
|
65
|
+
return out;
|
|
66
|
+
}
|
|
67
|
+
async function filesToOutboxMedia(files) {
|
|
68
|
+
const accepted = takeMediaFiles(files, 0).accepted;
|
|
69
|
+
let total = 0;
|
|
70
|
+
const out = [];
|
|
71
|
+
for (const file of accepted) {
|
|
72
|
+
// Skip oversized; keep packing remaining files that still fit
|
|
73
|
+
if (total + file.size > MAX_OUTBOX_MEDIA_BYTES)
|
|
74
|
+
continue;
|
|
75
|
+
const base64 = arrayBufferToBase64(await file.arrayBuffer());
|
|
76
|
+
out.push({
|
|
77
|
+
name: file.name,
|
|
78
|
+
mimeType: file.type || 'application/octet-stream',
|
|
79
|
+
size: file.size,
|
|
80
|
+
base64,
|
|
81
|
+
});
|
|
82
|
+
total += file.size;
|
|
83
|
+
}
|
|
84
|
+
return out;
|
|
85
|
+
}
|
|
86
|
+
function outboxMediaToFiles(mediaFiles) {
|
|
87
|
+
if (!(mediaFiles === null || mediaFiles === void 0 ? void 0 : mediaFiles.length))
|
|
88
|
+
return [];
|
|
89
|
+
return mediaFiles.slice(0, MAX_MEDIA_PER_MESSAGE).map(m => new File([base64ToUint8(m.base64)], m.name, { type: m.mimeType || 'application/octet-stream' }));
|
|
90
|
+
}
|
|
91
|
+
|
|
47
92
|
/**
|
|
48
93
|
* Thin MQTT lifecycle helper around test-iso-chat-sdk's mqtt client.
|
|
49
94
|
* Keeps connect/subscribe/teardown idempotent so remounts don't stack listeners.
|
|
95
|
+
*
|
|
96
|
+
* Supports mqtt.js reconnect: on each `connect` (including after reconnect)
|
|
97
|
+
* call `resubscribe()` so the user topic is always live.
|
|
50
98
|
*/
|
|
99
|
+
/** Sensible mqtt.js reconnect defaults (ms). */
|
|
100
|
+
const MQTT_RECONNECT_PERIOD_MS = 2000;
|
|
101
|
+
const MQTT_CONNECT_TIMEOUT_MS = 12000;
|
|
102
|
+
function applyMqttReconnectOptions(rawClient) {
|
|
103
|
+
if (!(rawClient === null || rawClient === void 0 ? void 0 : rawClient.options))
|
|
104
|
+
return;
|
|
105
|
+
rawClient.options.reconnectPeriod = MQTT_RECONNECT_PERIOD_MS;
|
|
106
|
+
rawClient.options.connectTimeout = MQTT_CONNECT_TIMEOUT_MS;
|
|
107
|
+
}
|
|
51
108
|
function removeClientListener(client, event, handler) {
|
|
52
109
|
if (typeof client.removeListener === 'function') {
|
|
53
110
|
client.removeListener(event, handler);
|
|
@@ -62,14 +119,18 @@ class MqttSession {
|
|
|
62
119
|
this.handlers = {};
|
|
63
120
|
this.boundConnect = null;
|
|
64
121
|
this.boundDisconnect = null;
|
|
122
|
+
this.boundOffline = null;
|
|
123
|
+
this.boundReconnect = null;
|
|
65
124
|
this.boundError = null;
|
|
66
125
|
this.boundMessage = null;
|
|
126
|
+
/** Last successfully subscribed topic. */
|
|
67
127
|
this.subscribedTopic = null;
|
|
128
|
+
/** Topic we want — used to force resubscribe after reconnect. */
|
|
129
|
+
this.desiredTopic = null;
|
|
68
130
|
this.listenersAttached = false;
|
|
69
131
|
this.messageListenerAttached = false;
|
|
70
132
|
}
|
|
71
133
|
attach(mqtt, handlers) {
|
|
72
|
-
// Teardown previous bindings if re-attaching to same or new client
|
|
73
134
|
this.detachListenersOnly();
|
|
74
135
|
this.mqtt = mqtt;
|
|
75
136
|
this.handlers = handlers;
|
|
@@ -81,6 +142,14 @@ class MqttSession {
|
|
|
81
142
|
var _a, _b;
|
|
82
143
|
(_b = (_a = this.handlers).onDisconnect) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
83
144
|
};
|
|
145
|
+
this.boundOffline = () => {
|
|
146
|
+
var _a, _b;
|
|
147
|
+
(_b = (_a = this.handlers).onOffline) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
148
|
+
};
|
|
149
|
+
this.boundReconnect = () => {
|
|
150
|
+
var _a, _b;
|
|
151
|
+
(_b = (_a = this.handlers).onReconnect) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
152
|
+
};
|
|
84
153
|
this.boundError = (error) => {
|
|
85
154
|
var _a, _b;
|
|
86
155
|
(_b = (_a = this.handlers).onError) === null || _b === void 0 ? void 0 : _b.call(_a, error);
|
|
@@ -89,14 +158,18 @@ class MqttSession {
|
|
|
89
158
|
var _a, _b;
|
|
90
159
|
void ((_b = (_a = this.handlers).onMessage) === null || _b === void 0 ? void 0 : _b.call(_a, topic, payload));
|
|
91
160
|
};
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
161
|
+
const { client } = mqtt;
|
|
162
|
+
client.on('connect', this.boundConnect);
|
|
163
|
+
client.on('disconnect', this.boundDisconnect);
|
|
164
|
+
client.on('offline', this.boundOffline);
|
|
165
|
+
client.on('reconnect', this.boundReconnect);
|
|
166
|
+
client.on('error', this.boundError);
|
|
95
167
|
this.listenersAttached = true;
|
|
96
168
|
}
|
|
97
169
|
subscribe(topic) {
|
|
98
170
|
if (!this.mqtt)
|
|
99
171
|
return;
|
|
172
|
+
this.desiredTopic = topic;
|
|
100
173
|
if (this.subscribedTopic === topic) {
|
|
101
174
|
this.ensureMessageListener();
|
|
102
175
|
return;
|
|
@@ -106,7 +179,7 @@ class MqttSession {
|
|
|
106
179
|
this.mqtt.client.unsubscribe(this.subscribedTopic);
|
|
107
180
|
}
|
|
108
181
|
catch (_a) {
|
|
109
|
-
|
|
182
|
+
/* ignore */
|
|
110
183
|
}
|
|
111
184
|
}
|
|
112
185
|
this.mqtt.client.subscribe(topic, err => {
|
|
@@ -118,6 +191,16 @@ class MqttSession {
|
|
|
118
191
|
});
|
|
119
192
|
this.ensureMessageListener();
|
|
120
193
|
}
|
|
194
|
+
/** After reconnect, force subscribe again even if topic string is unchanged. */
|
|
195
|
+
resubscribe() {
|
|
196
|
+
if (!this.desiredTopic)
|
|
197
|
+
return;
|
|
198
|
+
this.subscribedTopic = null;
|
|
199
|
+
this.subscribe(this.desiredTopic);
|
|
200
|
+
}
|
|
201
|
+
getDesiredTopic() {
|
|
202
|
+
return this.desiredTopic;
|
|
203
|
+
}
|
|
121
204
|
ensureMessageListener() {
|
|
122
205
|
if (!this.mqtt || this.messageListenerAttached || !this.boundMessage)
|
|
123
206
|
return;
|
|
@@ -135,6 +218,10 @@ class MqttSession {
|
|
|
135
218
|
removeClientListener(client, 'connect', this.boundConnect);
|
|
136
219
|
if (this.boundDisconnect)
|
|
137
220
|
removeClientListener(client, 'disconnect', this.boundDisconnect);
|
|
221
|
+
if (this.boundOffline)
|
|
222
|
+
removeClientListener(client, 'offline', this.boundOffline);
|
|
223
|
+
if (this.boundReconnect)
|
|
224
|
+
removeClientListener(client, 'reconnect', this.boundReconnect);
|
|
138
225
|
if (this.boundError)
|
|
139
226
|
removeClientListener(client, 'error', this.boundError);
|
|
140
227
|
if (this.boundMessage && this.messageListenerAttached) {
|
|
@@ -151,7 +238,7 @@ class MqttSession {
|
|
|
151
238
|
this.mqtt.client.unsubscribe(this.subscribedTopic);
|
|
152
239
|
}
|
|
153
240
|
catch (_a) {
|
|
154
|
-
|
|
241
|
+
/* ignore */
|
|
155
242
|
}
|
|
156
243
|
}
|
|
157
244
|
this.detachListenersOnly();
|
|
@@ -160,6 +247,7 @@ class MqttSession {
|
|
|
160
247
|
this.mqtt.disconnect();
|
|
161
248
|
}
|
|
162
249
|
else if (typeof this.mqtt.client.end === 'function') {
|
|
250
|
+
// force end — do not leave zombie reconnect loops after unmount
|
|
163
251
|
this.mqtt.client.end(true);
|
|
164
252
|
}
|
|
165
253
|
}
|
|
@@ -168,6 +256,7 @@ class MqttSession {
|
|
|
168
256
|
}
|
|
169
257
|
this.mqtt = null;
|
|
170
258
|
this.subscribedTopic = null;
|
|
259
|
+
this.desiredTopic = null;
|
|
171
260
|
this.handlers = {};
|
|
172
261
|
}
|
|
173
262
|
}
|
|
@@ -738,211 +827,234 @@ async function dispatchMqttMessage(parsedMessage, ctx) {
|
|
|
738
827
|
}
|
|
739
828
|
}
|
|
740
829
|
|
|
741
|
-
/**
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
});
|
|
757
|
-
}
|
|
758
|
-
function mergeUniqueConversations(existing, incoming) {
|
|
759
|
-
const list = Array.isArray(existing) ? existing : [];
|
|
760
|
-
const next = Array.isArray(incoming) ? incoming : [];
|
|
761
|
-
return [
|
|
762
|
-
...list,
|
|
763
|
-
...next.filter(newConv => !list.some(existingConv => existingConv.conversationId === newConv.conversationId)),
|
|
764
|
-
];
|
|
765
|
-
}
|
|
766
|
-
async function fetchConversationsPage(opts) {
|
|
767
|
-
var _a, _b, _c;
|
|
768
|
-
const query = {
|
|
769
|
-
limit: (_a = opts.limit) !== null && _a !== void 0 ? _a : 20,
|
|
770
|
-
skip: (_b = opts.skip) !== null && _b !== void 0 ? _b : 0,
|
|
771
|
-
includeMembers: (_c = opts.includeMembers) !== null && _c !== void 0 ? _c : true,
|
|
772
|
-
};
|
|
773
|
-
if (opts.searchTag)
|
|
774
|
-
query.searchTag = opts.searchTag;
|
|
775
|
-
const res = await M.getInstance().Conversation.getConversations(query);
|
|
776
|
-
return (res === null || res === void 0 ? void 0 : res.conversations) || [];
|
|
777
|
-
}
|
|
778
|
-
async function fetchConversationDetails(conversationId, includeMembers = true) {
|
|
779
|
-
const res = await M.getInstance().Conversation.getConversationDetails({ conversationId, includeMembers }, conversationId);
|
|
780
|
-
return res === null || res === void 0 ? void 0 : res.conversationDetails;
|
|
830
|
+
/**
|
|
831
|
+
* Serialize inbound MQTT handling per host so rapid messages don't race @State updates.
|
|
832
|
+
*/
|
|
833
|
+
const tails = new WeakMap();
|
|
834
|
+
/** Run `task` after any prior MQTT tasks for this host have finished. */
|
|
835
|
+
function enqueueMqttTask(host, task) {
|
|
836
|
+
const prev = tails.get(host) || Promise.resolve();
|
|
837
|
+
const next = prev
|
|
838
|
+
.then(() => task())
|
|
839
|
+
.catch(err => {
|
|
840
|
+
console.error('MQTT inbound task failed:', err);
|
|
841
|
+
})
|
|
842
|
+
.then(() => undefined);
|
|
843
|
+
tails.set(host, next);
|
|
844
|
+
return next;
|
|
781
845
|
}
|
|
782
846
|
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
licenseKey: config.licenseKey || isometrikFlutterAppSecrets.licenseKey,
|
|
788
|
-
appSecret: config.appSecret || isometrikFlutterAppSecrets.appSecret,
|
|
789
|
-
userSecret: config.userSecret || isometrikFlutterAppSecrets.userSecret,
|
|
790
|
-
userToken: config.userToken,
|
|
791
|
-
});
|
|
792
|
-
}
|
|
793
|
-
/** Normalize getUserDetails API response into the shape WebChat stores. */
|
|
794
|
-
async function fetchUserDetails() {
|
|
795
|
-
var _a, _b, _c;
|
|
796
|
-
const res = await M.getInstance().user.getUserDetails();
|
|
797
|
-
return {
|
|
798
|
-
userId: (res === null || res === void 0 ? void 0 : res.userId) || '',
|
|
799
|
-
userIdentifier: (res === null || res === void 0 ? void 0 : res.userIdentifier) || '',
|
|
800
|
-
firstName: ((_a = res === null || res === void 0 ? void 0 : res.metaData) === null || _a === void 0 ? void 0 : _a.firstName) || '',
|
|
801
|
-
lastName: ((_b = res === null || res === void 0 ? void 0 : res.metaData) === null || _b === void 0 ? void 0 : _b.lastName) || '',
|
|
802
|
-
updatedAt: (res === null || res === void 0 ? void 0 : res.updatedAt) || '',
|
|
803
|
-
userName: (res === null || res === void 0 ? void 0 : res.userName) || '',
|
|
804
|
-
online: (res === null || res === void 0 ? void 0 : res.online) || '',
|
|
805
|
-
userProfileImageUrl: (res === null || res === void 0 ? void 0 : res.userProfileImageUrl) || '',
|
|
806
|
-
profilePic: ((_c = res === null || res === void 0 ? void 0 : res.metaData) === null || _c === void 0 ? void 0 : _c.profilePic) || '',
|
|
807
|
-
};
|
|
808
|
-
}
|
|
847
|
+
const getTotalUnreadConversationsCount = async () => {
|
|
848
|
+
const response = await M.getInstance().Conversation.getConversationUnreadCount();
|
|
849
|
+
return response?.count;
|
|
850
|
+
};
|
|
809
851
|
|
|
810
|
-
|
|
852
|
+
/**
|
|
853
|
+
* Wire OfflineClient into <web-chat> lifecycle.
|
|
854
|
+
*/
|
|
855
|
+
function userIdOf(host) {
|
|
811
856
|
var _a;
|
|
812
|
-
|
|
813
|
-
|
|
857
|
+
return ((_a = host.userMetaData) === null || _a === void 0 ? void 0 : _a.userId) || host.isometrikUserId || host.isometrikUserIdFromCookie || null;
|
|
858
|
+
}
|
|
859
|
+
function hostInitOffline(host) {
|
|
860
|
+
const client = getOfflineClient();
|
|
861
|
+
const uid = userIdOf(host);
|
|
862
|
+
if (uid)
|
|
863
|
+
client.setUser(uid);
|
|
864
|
+
client.startTabSync(event => {
|
|
865
|
+
var _a;
|
|
866
|
+
if (event.type === 'messages' && event.conversationId === host.selectedConversationId) {
|
|
867
|
+
host.allMessages = mergeMessagesById(host.allMessages || [], event.messages || []);
|
|
868
|
+
}
|
|
869
|
+
if (event.type === 'conversations') {
|
|
870
|
+
// Prefer newer network list; only fill gaps from peer tab
|
|
871
|
+
const incoming = event.conversations || [];
|
|
872
|
+
if (!((_a = host.allConversationList) === null || _a === void 0 ? void 0 : _a.length) && incoming.length) {
|
|
873
|
+
host.allConversationList = incoming;
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
});
|
|
877
|
+
if (typeof window !== 'undefined') {
|
|
878
|
+
host._onOnline = () => {
|
|
879
|
+
void hostFlushOutbox(host);
|
|
880
|
+
};
|
|
881
|
+
window.addEventListener('online', host._onOnline);
|
|
882
|
+
}
|
|
814
883
|
}
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
884
|
+
function hostTeardownOffline(host) {
|
|
885
|
+
getOfflineClient().stopTabSync();
|
|
886
|
+
if (typeof window !== 'undefined' && host._onOnline) {
|
|
887
|
+
window.removeEventListener('online', host._onOnline);
|
|
888
|
+
host._onOnline = null;
|
|
889
|
+
}
|
|
818
890
|
}
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
const
|
|
822
|
-
|
|
891
|
+
/** Paint cached conversations immediately (before network). */
|
|
892
|
+
async function hostHydrateConversationsFromCache(host) {
|
|
893
|
+
const uid = userIdOf(host);
|
|
894
|
+
if (!uid)
|
|
895
|
+
return;
|
|
896
|
+
try {
|
|
897
|
+
const cached = await getOfflineClient().loadConversations(uid);
|
|
898
|
+
if (cached.length && (!host.allConversationList || host.allConversationList.length === 0)) {
|
|
899
|
+
host.allConversationList = cached;
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
catch (e) {
|
|
903
|
+
console.error('offline hydrate conversations failed', e);
|
|
904
|
+
}
|
|
823
905
|
}
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
return 3;
|
|
839
|
-
}
|
|
840
|
-
function customTypeFromMime(mime) {
|
|
841
|
-
if (!mime)
|
|
842
|
-
return 'AttachmentMessage:Multiple';
|
|
843
|
-
if (mime.startsWith('image/'))
|
|
844
|
-
return 'AttachmentMessage:Image';
|
|
845
|
-
if (mime.startsWith('video/'))
|
|
846
|
-
return 'AttachmentMessage:Video';
|
|
847
|
-
if (mime.startsWith('audio/'))
|
|
848
|
-
return 'AttachmentMessage:Audio';
|
|
849
|
-
if (mime.startsWith('application/'))
|
|
850
|
-
return 'AttachmentMessage:Doc';
|
|
851
|
-
return 'AttachmentMessage:Multiple';
|
|
852
|
-
}
|
|
853
|
-
function buildReplyMetaData(replyMessage, caption) {
|
|
854
|
-
var _a, _b, _c;
|
|
855
|
-
if (!replyMessage && !(caption === null || caption === void 0 ? void 0 : caption.trim()))
|
|
856
|
-
return {};
|
|
857
|
-
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]) && {
|
|
858
|
-
parentMessageName: replyMessage.attachments[0].name,
|
|
859
|
-
parentMessageMediaUrl: replyMessage.attachments[0].mediaUrl,
|
|
860
|
-
parentMessageType: replyMessage.attachments[0].mimeType,
|
|
861
|
-
})))), ((caption === null || caption === void 0 ? void 0 : caption.trim()) && { captionMessage: caption.trim() }));
|
|
862
|
-
}
|
|
863
|
-
function prepareMediaAttachments(files) {
|
|
864
|
-
return files.map(file => ({
|
|
865
|
-
nameWithExtension: file.name,
|
|
866
|
-
mediaType: mediaTypeFromMime(file.type),
|
|
867
|
-
mediaId: String(file.lastModified || Date.now()),
|
|
868
|
-
mimeType: file.type || 'application/octet-stream',
|
|
869
|
-
size: file.size,
|
|
870
|
-
file,
|
|
871
|
-
}));
|
|
906
|
+
async function hostHydrateMessagesFromCache(host, conversationId) {
|
|
907
|
+
const uid = userIdOf(host);
|
|
908
|
+
const id = conversationId || host.selectedConversationId;
|
|
909
|
+
if (!uid || !id)
|
|
910
|
+
return;
|
|
911
|
+
try {
|
|
912
|
+
const cached = await getOfflineClient().loadMessages(uid, id);
|
|
913
|
+
if (cached.length) {
|
|
914
|
+
host.allMessages = mergeMessagesById(host.allMessages || [], cached);
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
catch (e) {
|
|
918
|
+
console.error('offline hydrate messages failed', e);
|
|
919
|
+
}
|
|
872
920
|
}
|
|
873
|
-
function
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
}
|
|
921
|
+
async function hostPersistConversations(host) {
|
|
922
|
+
var _a;
|
|
923
|
+
const uid = userIdOf(host);
|
|
924
|
+
if (!uid || !((_a = host.allConversationList) === null || _a === void 0 ? void 0 : _a.length))
|
|
925
|
+
return;
|
|
926
|
+
try {
|
|
927
|
+
await getOfflineClient().persistConversations(uid, host.allConversationList);
|
|
928
|
+
}
|
|
929
|
+
catch (e) {
|
|
930
|
+
console.error('offline persist conversations failed', e);
|
|
931
|
+
}
|
|
881
932
|
}
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
const
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
933
|
+
async function hostPersistMessages(host, conversationId) {
|
|
934
|
+
var _a;
|
|
935
|
+
const uid = userIdOf(host);
|
|
936
|
+
const id = conversationId || host.selectedConversationId;
|
|
937
|
+
if (!uid || !id || !((_a = host.allMessages) === null || _a === void 0 ? void 0 : _a.length))
|
|
938
|
+
return;
|
|
939
|
+
try {
|
|
940
|
+
await getOfflineClient().persistMessages(uid, id, host.allMessages);
|
|
941
|
+
const last = host.allMessages[host.allMessages.length - 1];
|
|
942
|
+
const cursor = (last === null || last === void 0 ? void 0 : last.sentAt) || (last === null || last === void 0 ? void 0 : last.updatedAt) || Date.now();
|
|
943
|
+
await getOfflineClient().setCursor(uid, id, cursor);
|
|
944
|
+
}
|
|
945
|
+
catch (e) {
|
|
946
|
+
console.error('offline persist messages failed', e);
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
async function hostEnqueueFailedText(host, opts) {
|
|
950
|
+
var _a, _b, _c;
|
|
951
|
+
const uid = userIdOf(host);
|
|
952
|
+
if (!uid)
|
|
953
|
+
return;
|
|
954
|
+
const reply = host.replyMessage;
|
|
955
|
+
await getOfflineClient().enqueueText({
|
|
956
|
+
localId: opts.localId,
|
|
957
|
+
userId: uid,
|
|
958
|
+
conversationId: opts.conversationId,
|
|
959
|
+
body: opts.body,
|
|
960
|
+
metaData: (_a = opts.localMessage) === null || _a === void 0 ? void 0 : _a.metaData,
|
|
961
|
+
messageType: (_c = (_b = opts.localMessage) === null || _b === void 0 ? void 0 : _b.messageType) !== null && _c !== void 0 ? _c : 0,
|
|
962
|
+
parentMessageId: reply === null || reply === void 0 ? void 0 : reply.messageId,
|
|
963
|
+
customType: opts.body.match(/(https?:\/\/[^\s]+)/g)
|
|
964
|
+
? 'AttachmentMessage:Link'
|
|
965
|
+
: 'AttachmentMessage:Text',
|
|
966
|
+
searchableTags: opts.body.split(/\s+/).filter(Boolean).slice(0, 20),
|
|
890
967
|
});
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
968
|
+
// Mark bubble as pending/outbox so UI can show retry state
|
|
969
|
+
host.allMessages = (host.allMessages || []).map((m) => m.messageId === opts.localId
|
|
970
|
+
? Object.assign(Object.assign({}, m), { deliveredToAll: 'pending', deliveryStatus: 'outbox', outbox: true }) : m);
|
|
971
|
+
await hostPersistMessages(host, opts.conversationId);
|
|
972
|
+
}
|
|
973
|
+
async function hostEnqueueFailedMedia(host, opts) {
|
|
974
|
+
var _a, _b, _c, _d, _e, _f;
|
|
975
|
+
const uid = userIdOf(host);
|
|
976
|
+
if (!uid)
|
|
977
|
+
return;
|
|
978
|
+
const mediaFiles = await filesToOutboxMedia(opts.files);
|
|
979
|
+
if (!mediaFiles.length)
|
|
980
|
+
return;
|
|
981
|
+
const reply = host.replyMessage;
|
|
982
|
+
await getOfflineClient().enqueueMedia({
|
|
983
|
+
localId: opts.localId,
|
|
984
|
+
userId: uid,
|
|
985
|
+
conversationId: opts.conversationId,
|
|
986
|
+
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',
|
|
987
|
+
caption: opts.caption,
|
|
988
|
+
mediaFiles,
|
|
989
|
+
metaData: (_c = opts.localMessage) === null || _c === void 0 ? void 0 : _c.metaData,
|
|
990
|
+
messageType: (_e = (_d = opts.localMessage) === null || _d === void 0 ? void 0 : _d.messageType) !== null && _e !== void 0 ? _e : 0,
|
|
991
|
+
parentMessageId: reply === null || reply === void 0 ? void 0 : reply.messageId,
|
|
992
|
+
customType: ((_f = opts.localMessage) === null || _f === void 0 ? void 0 : _f.customType) || 'AttachmentMessage:Multiple',
|
|
993
|
+
});
|
|
994
|
+
host.allMessages = (host.allMessages || []).map((m) => m.messageId === opts.localId
|
|
995
|
+
? Object.assign(Object.assign({}, m), { deliveredToAll: 'pending', deliveryStatus: 'outbox', outbox: true }) : m);
|
|
996
|
+
await hostPersistMessages(host, opts.conversationId);
|
|
997
|
+
}
|
|
998
|
+
async function sendOutboxItem(host, item) {
|
|
999
|
+
var _a;
|
|
1000
|
+
const deviceId = host.deviceId || (await getDeviceID());
|
|
1001
|
+
if (item.kind === 'media') {
|
|
1002
|
+
const files = outboxMediaToFiles(item.mediaFiles);
|
|
1003
|
+
if (!files.length)
|
|
1004
|
+
throw new Error('Media outbox item has no files');
|
|
1005
|
+
const attachments = prepareMediaAttachments(files);
|
|
1006
|
+
const apiId = await uploadAndPostMediaMessage({
|
|
1007
|
+
conversationId: item.conversationId,
|
|
1008
|
+
deviceId,
|
|
1009
|
+
attachments,
|
|
1010
|
+
caption: item.caption || item.body,
|
|
1011
|
+
replyMessage: item.parentMessageId
|
|
1012
|
+
? { messageId: item.parentMessageId }
|
|
1013
|
+
: null,
|
|
921
1014
|
});
|
|
922
|
-
|
|
923
|
-
|
|
1015
|
+
if (apiId && item.conversationId === host.selectedConversationId) {
|
|
1016
|
+
host.allMessages = (host.allMessages || []).map((m) => m.messageId === item.localId
|
|
1017
|
+
? Object.assign(Object.assign({}, m), { messageId: apiId, deliveredToAll: false, outbox: false, deliveryStatus: 'sent' }) : m);
|
|
1018
|
+
await hostPersistMessages(host, item.conversationId);
|
|
1019
|
+
}
|
|
1020
|
+
return apiId || null;
|
|
1021
|
+
}
|
|
924
1022
|
const payload = {
|
|
925
1023
|
showInConversation: true,
|
|
926
|
-
messageType:
|
|
927
|
-
parentMessageId:
|
|
1024
|
+
messageType: (_a = item.messageType) !== null && _a !== void 0 ? _a : 0,
|
|
1025
|
+
parentMessageId: item.parentMessageId,
|
|
1026
|
+
searchableTags: item.searchableTags || [],
|
|
928
1027
|
encrypted: false,
|
|
929
|
-
conversationId,
|
|
930
|
-
body: (caption === null || caption === void 0 ? void 0 : caption.trim()) || 'AttachmentMessage:Multiple',
|
|
931
|
-
customType,
|
|
932
|
-
attachments: allPayloads,
|
|
1028
|
+
conversationId: item.conversationId,
|
|
933
1029
|
deviceId,
|
|
934
|
-
|
|
1030
|
+
customType: item.customType || 'AttachmentMessage:Text',
|
|
1031
|
+
body: item.body,
|
|
1032
|
+
metaData: item.metaData || {},
|
|
935
1033
|
};
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
1034
|
+
const res = await M.getInstance().message.postMessages(payload);
|
|
1035
|
+
const apiId = res === null || res === void 0 ? void 0 : res.messageId;
|
|
1036
|
+
if (apiId && item.conversationId === host.selectedConversationId) {
|
|
1037
|
+
host.allMessages = (host.allMessages || []).map((m) => m.messageId === item.localId
|
|
1038
|
+
? Object.assign(Object.assign({}, m), { messageId: apiId, deliveredToAll: false, outbox: false, deliveryStatus: 'sent' }) : m);
|
|
1039
|
+
await hostPersistMessages(host, item.conversationId);
|
|
1040
|
+
}
|
|
1041
|
+
return apiId || null;
|
|
1042
|
+
}
|
|
1043
|
+
async function hostFlushOutbox(host) {
|
|
1044
|
+
var _a;
|
|
1045
|
+
const uid = userIdOf(host);
|
|
1046
|
+
if (!uid || !isBrowserOnline())
|
|
1047
|
+
return;
|
|
1048
|
+
try {
|
|
1049
|
+
const result = await getOfflineClient().flushOutbox(uid, item => sendOutboxItem(host, item));
|
|
1050
|
+
if (result.sent > 0) {
|
|
1051
|
+
void Promise.resolve((_a = host.getConversations) === null || _a === void 0 ? void 0 : _a.call(host, 0)).catch(() => undefined);
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
catch (e) {
|
|
1055
|
+
console.error('outbox flush failed', e);
|
|
1056
|
+
}
|
|
940
1057
|
}
|
|
941
|
-
|
|
942
|
-
const getTotalUnreadConversationsCount = async () => {
|
|
943
|
-
const response = await M.getInstance().Conversation.getConversationUnreadCount();
|
|
944
|
-
return response?.count;
|
|
945
|
-
};
|
|
946
1058
|
|
|
947
1059
|
/**
|
|
948
1060
|
* Ordered startup for <web-chat>.
|
|
@@ -960,6 +1072,9 @@ const getTotalUnreadConversationsCount = async () => {
|
|
|
960
1072
|
*/
|
|
961
1073
|
async function bootstrapWebChat(host, generation) {
|
|
962
1074
|
try {
|
|
1075
|
+
hostInitOffline(host);
|
|
1076
|
+
// Instant paint from IndexedDB while network warms up
|
|
1077
|
+
void hostHydrateConversationsFromCache(host);
|
|
963
1078
|
try {
|
|
964
1079
|
host.updateLoading(10, 'Preparing secure session…');
|
|
965
1080
|
const deviceId = await getDeviceID();
|
|
@@ -998,6 +1113,8 @@ async function bootstrapWebChat(host, generation) {
|
|
|
998
1113
|
try {
|
|
999
1114
|
host.updateLoading(55, 'Fetching users…');
|
|
1000
1115
|
await host.getUserDetails();
|
|
1116
|
+
hostInitOffline(host); // re-bind userId after profile load
|
|
1117
|
+
void hostHydrateConversationsFromCache(host);
|
|
1001
1118
|
}
|
|
1002
1119
|
catch (userError) {
|
|
1003
1120
|
console.error('Failed to get user details:', userError);
|
|
@@ -1052,6 +1169,7 @@ async function bootstrapWebChat(host, generation) {
|
|
|
1052
1169
|
host.checkMobileView();
|
|
1053
1170
|
window.addEventListener('resize', host.boundCheckMobileView);
|
|
1054
1171
|
host.updateLoading(100, 'Almost ready…');
|
|
1172
|
+
void hostFlushOutbox(host);
|
|
1055
1173
|
}
|
|
1056
1174
|
catch (error) {
|
|
1057
1175
|
console.error('Critical initialization error:', error);
|
|
@@ -1124,6 +1242,7 @@ async function hostGetConversations(host, skip = 0, searchTag = null, showLoader
|
|
|
1124
1242
|
try {
|
|
1125
1243
|
const conversations = await fetchConversationsPage({ skip, searchTag });
|
|
1126
1244
|
host.allConversationList = mergeUniqueConversations(host.allConversationList, conversations);
|
|
1245
|
+
void hostPersistConversations(host);
|
|
1127
1246
|
}
|
|
1128
1247
|
catch (error) {
|
|
1129
1248
|
console.error('getConversations fetching error', error);
|
|
@@ -1167,17 +1286,23 @@ async function hostGetMessages(host, skip, conversationId) {
|
|
|
1167
1286
|
conversationId: conversationId || host.selectedConversationId,
|
|
1168
1287
|
skip,
|
|
1169
1288
|
});
|
|
1289
|
+
const targetId = conversationId || host.selectedConversationId;
|
|
1170
1290
|
if (skip == 0) {
|
|
1171
|
-
if (conversationId)
|
|
1172
|
-
host.selectConversationMessages = [
|
|
1173
|
-
|
|
1174
|
-
|
|
1291
|
+
if (conversationId) {
|
|
1292
|
+
host.selectConversationMessages = mergeMessagesById(host.selectConversationMessages || [], messages);
|
|
1293
|
+
}
|
|
1294
|
+
else {
|
|
1295
|
+
// Merge with any optimistic/outbox rows already on screen
|
|
1296
|
+
host.allMessages = mergeMessagesById(host.allMessages || [], messages);
|
|
1297
|
+
}
|
|
1175
1298
|
}
|
|
1176
1299
|
else {
|
|
1177
|
-
host.allMessages =
|
|
1300
|
+
host.allMessages = mergeMessagesById(messages, host.allMessages || []);
|
|
1178
1301
|
}
|
|
1179
1302
|
// API 404s a page past the end; a short page means this page is the last.
|
|
1180
1303
|
host.isMessageLimitEnd = messages.length < 20;
|
|
1304
|
+
if (targetId)
|
|
1305
|
+
void hostPersistMessages(host, targetId);
|
|
1181
1306
|
}
|
|
1182
1307
|
catch (error) {
|
|
1183
1308
|
if ((error === null || error === void 0 ? void 0 : error.status) === 404 || (error === null || error === void 0 ? void 0 : error.statusCode) === 404) {
|
|
@@ -1313,7 +1438,7 @@ async function hostSendText(host, body, conversationId) {
|
|
|
1313
1438
|
const deviceId = host.deviceId || (await getDeviceID());
|
|
1314
1439
|
const localId = `localId${Date.now()}${Math.random() * 100}`;
|
|
1315
1440
|
const reply = host.replyMessage;
|
|
1316
|
-
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 && {
|
|
1441
|
+
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 && {
|
|
1317
1442
|
parentMessageId: reply.messageId,
|
|
1318
1443
|
metaData: {
|
|
1319
1444
|
parentMessageId: reply.messageId,
|
|
@@ -1326,6 +1451,26 @@ async function hostSendText(host, body, conversationId) {
|
|
|
1326
1451
|
host.allMessages = [...host.allMessages, localMessage];
|
|
1327
1452
|
host.isMessageSending = true;
|
|
1328
1453
|
host.isScrollToBottom = true;
|
|
1454
|
+
const bumpConversationPreview = () => {
|
|
1455
|
+
host.allConversationList = sortConversationsByLatestMessage(host.allConversationList.map(c => {
|
|
1456
|
+
var _a;
|
|
1457
|
+
return c.conversationId === id
|
|
1458
|
+
? 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;
|
|
1459
|
+
}));
|
|
1460
|
+
};
|
|
1461
|
+
// Offline → optimistic bubble + outbox (sent when back online)
|
|
1462
|
+
if (!isBrowserOnline()) {
|
|
1463
|
+
await hostEnqueueFailedText(host, { localId, conversationId: id, body: text, localMessage });
|
|
1464
|
+
bumpConversationPreview();
|
|
1465
|
+
host.replyMessage = null;
|
|
1466
|
+
host.isMessageSending = false;
|
|
1467
|
+
showToast({
|
|
1468
|
+
message: 'You’re offline — message queued',
|
|
1469
|
+
type: 'warning',
|
|
1470
|
+
position: 'bottom-right',
|
|
1471
|
+
});
|
|
1472
|
+
return localId;
|
|
1473
|
+
}
|
|
1329
1474
|
try {
|
|
1330
1475
|
const payload = {
|
|
1331
1476
|
showInConversation: true,
|
|
@@ -1342,21 +1487,26 @@ async function hostSendText(host, body, conversationId) {
|
|
|
1342
1487
|
const res = await M.getInstance().message.postMessages(payload);
|
|
1343
1488
|
const apiId = res === null || res === void 0 ? void 0 : res.messageId;
|
|
1344
1489
|
if (apiId) {
|
|
1345
|
-
host.allMessages = host.allMessages.map(m => m.messageId === localId
|
|
1490
|
+
host.allMessages = host.allMessages.map(m => m.messageId === localId
|
|
1491
|
+
? Object.assign(Object.assign({}, m), { messageId: apiId, deliveredToAll: false, deliveryStatus: 'sent' }) : m);
|
|
1346
1492
|
}
|
|
1347
|
-
|
|
1348
|
-
var _a;
|
|
1349
|
-
return c.conversationId === id
|
|
1350
|
-
? 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;
|
|
1351
|
-
}));
|
|
1493
|
+
bumpConversationPreview();
|
|
1352
1494
|
host.replyMessage = null;
|
|
1495
|
+
void hostPersistMessages(host, id);
|
|
1353
1496
|
return apiId || localId;
|
|
1354
1497
|
}
|
|
1355
1498
|
catch (error) {
|
|
1356
1499
|
console.error('web-chat sendText failed', error);
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1500
|
+
// Keep bubble + queue for retry (network blip / server error)
|
|
1501
|
+
await hostEnqueueFailedText(host, { localId, conversationId: id, body: text, localMessage });
|
|
1502
|
+
bumpConversationPreview();
|
|
1503
|
+
host.emitChatError('sendText', (error === null || error === void 0 ? void 0 : error.message) || 'Failed to send — queued for retry', error);
|
|
1504
|
+
showToast({
|
|
1505
|
+
message: (error === null || error === void 0 ? void 0 : error.message) || 'Send failed — queued for retry',
|
|
1506
|
+
type: 'warning',
|
|
1507
|
+
position: 'bottom-right',
|
|
1508
|
+
});
|
|
1509
|
+
return localId;
|
|
1360
1510
|
}
|
|
1361
1511
|
finally {
|
|
1362
1512
|
host.isMessageSending = false;
|
|
@@ -1364,22 +1514,59 @@ async function hostSendText(host, body, conversationId) {
|
|
|
1364
1514
|
}
|
|
1365
1515
|
async function hostSendMedia(host, files, conversationId, caption) {
|
|
1366
1516
|
var _a;
|
|
1367
|
-
const
|
|
1517
|
+
const raw = Array.from(files || []).filter(Boolean);
|
|
1518
|
+
const { accepted: list, rejected } = takeMediaFiles(raw, 0);
|
|
1368
1519
|
const id = conversationId || host.selectedConversationId;
|
|
1369
|
-
if (!
|
|
1520
|
+
if (!raw.length || !id) {
|
|
1370
1521
|
host.emitChatError('sendMedia', 'Missing files or conversationId');
|
|
1371
1522
|
return null;
|
|
1372
1523
|
}
|
|
1524
|
+
if (rejected > 0) {
|
|
1525
|
+
showToast({
|
|
1526
|
+
message: mediaLimitToastMessage(rejected, MAX_MEDIA_PER_MESSAGE),
|
|
1527
|
+
type: 'warning',
|
|
1528
|
+
position: 'bottom-right',
|
|
1529
|
+
});
|
|
1530
|
+
}
|
|
1531
|
+
if (!list.length) {
|
|
1532
|
+
host.emitChatError('sendMedia', `Max ${MAX_MEDIA_PER_MESSAGE} files per message`);
|
|
1533
|
+
return null;
|
|
1534
|
+
}
|
|
1373
1535
|
const deviceId = host.deviceId || (await getDeviceID());
|
|
1374
1536
|
const reply = host.replyMessage;
|
|
1375
1537
|
const localId = `${Date.now()}${Math.random() * 100}`;
|
|
1376
1538
|
const attachments = prepareMediaAttachments(list);
|
|
1377
1539
|
const localAttachments = buildLocalMediaAttachments(list);
|
|
1378
1540
|
const body = (caption || '').trim() || 'AttachmentMessage:Multiple';
|
|
1379
|
-
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 }));
|
|
1541
|
+
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 ? customTypeFromMime(list[0].type) : 'AttachmentMessage:Multiple', metaData: buildReplyMetaData(reply, caption) }, (reply && { parentMessageId: reply.messageId }));
|
|
1380
1542
|
host.allMessages = [...host.allMessages, localMessage];
|
|
1381
1543
|
host.isMessageSending = true;
|
|
1382
1544
|
host.isScrollToBottom = true;
|
|
1545
|
+
const bumpConversationPreview = () => {
|
|
1546
|
+
host.allConversationList = sortConversationsByLatestMessage(host.allConversationList.map(c => {
|
|
1547
|
+
var _a;
|
|
1548
|
+
return c.conversationId === id
|
|
1549
|
+
? 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;
|
|
1550
|
+
}));
|
|
1551
|
+
};
|
|
1552
|
+
if (!isBrowserOnline()) {
|
|
1553
|
+
await hostEnqueueFailedMedia(host, {
|
|
1554
|
+
localId,
|
|
1555
|
+
conversationId: id,
|
|
1556
|
+
files: list,
|
|
1557
|
+
caption,
|
|
1558
|
+
localMessage,
|
|
1559
|
+
});
|
|
1560
|
+
bumpConversationPreview();
|
|
1561
|
+
host.replyMessage = null;
|
|
1562
|
+
host.isMessageSending = false;
|
|
1563
|
+
showToast({
|
|
1564
|
+
message: 'You’re offline — media queued',
|
|
1565
|
+
type: 'warning',
|
|
1566
|
+
position: 'bottom-right',
|
|
1567
|
+
});
|
|
1568
|
+
return localId;
|
|
1569
|
+
}
|
|
1383
1570
|
try {
|
|
1384
1571
|
const apiId = await uploadAndPostMediaMessage({
|
|
1385
1572
|
conversationId: id,
|
|
@@ -1389,21 +1576,31 @@ async function hostSendMedia(host, files, conversationId, caption) {
|
|
|
1389
1576
|
caption,
|
|
1390
1577
|
});
|
|
1391
1578
|
if (apiId) {
|
|
1392
|
-
host.allMessages = host.allMessages.map(m => m.messageId === localId
|
|
1579
|
+
host.allMessages = host.allMessages.map(m => m.messageId === localId
|
|
1580
|
+
? Object.assign(Object.assign({}, m), { messageId: apiId, deliveredToAll: false, deliveryStatus: 'sent' }) : m);
|
|
1393
1581
|
}
|
|
1394
|
-
|
|
1395
|
-
var _a;
|
|
1396
|
-
return c.conversationId === id
|
|
1397
|
-
? 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;
|
|
1398
|
-
}));
|
|
1582
|
+
bumpConversationPreview();
|
|
1399
1583
|
host.replyMessage = null;
|
|
1584
|
+
void hostPersistMessages(host, id);
|
|
1400
1585
|
return apiId || localId;
|
|
1401
1586
|
}
|
|
1402
1587
|
catch (error) {
|
|
1403
1588
|
console.error('web-chat sendMedia failed', error);
|
|
1589
|
+
await hostEnqueueFailedMedia(host, {
|
|
1590
|
+
localId,
|
|
1591
|
+
conversationId: id,
|
|
1592
|
+
files: list,
|
|
1593
|
+
caption,
|
|
1594
|
+
localMessage,
|
|
1595
|
+
});
|
|
1596
|
+
bumpConversationPreview();
|
|
1404
1597
|
host.emitChatError('sendMedia', (error === null || error === void 0 ? void 0 : error.message) || 'Failed to send media', error);
|
|
1405
|
-
showToast({
|
|
1406
|
-
|
|
1598
|
+
showToast({
|
|
1599
|
+
message: (error === null || error === void 0 ? void 0 : error.message) || 'Send failed — media queued for retry',
|
|
1600
|
+
type: 'warning',
|
|
1601
|
+
position: 'bottom-right',
|
|
1602
|
+
});
|
|
1603
|
+
return localId;
|
|
1407
1604
|
}
|
|
1408
1605
|
finally {
|
|
1409
1606
|
host.isMessageSending = false;
|
|
@@ -1510,18 +1707,39 @@ function createMqttContext(host) {
|
|
|
1510
1707
|
|
|
1511
1708
|
/**
|
|
1512
1709
|
* MQTT connect / subscribe / forward for <web-chat>.
|
|
1710
|
+
*
|
|
1711
|
+
* Butter path:
|
|
1712
|
+
* - mqtt.js auto-reconnect (bounded period)
|
|
1713
|
+
* - on every connect → resubscribe + gap-fill (soft merge, no UI wipe)
|
|
1714
|
+
* - while offline → light REST poll for open thread only
|
|
1715
|
+
* - inbound messages processed on a per-host serial queue
|
|
1513
1716
|
*/
|
|
1717
|
+
const OFFLINE_POLL_MS = 15000;
|
|
1514
1718
|
function hostAppendInboundMessage(host, parsedMessage) {
|
|
1515
1719
|
host.allMessages = appendUniqueById(host.allMessages, parsedMessage);
|
|
1720
|
+
void hostPersistMessages(host);
|
|
1516
1721
|
}
|
|
1722
|
+
/**
|
|
1723
|
+
* Build MQTT dispatch context from the live <web-chat> host.
|
|
1724
|
+
*
|
|
1725
|
+
* Do NOT `{...host}` / `Object.assign({}, host)` — Stencil `@State` (e.g.
|
|
1726
|
+
* `allConversationList`) lives behind prototype getters. A plain snapshot
|
|
1727
|
+
* drops them → `undefined.some` on `chatMessageSent` and realtime dies
|
|
1728
|
+
* even though MQTT is connected.
|
|
1729
|
+
*/
|
|
1517
1730
|
function hostCreateMqttContext(host) {
|
|
1518
|
-
return createMqttContext(Object.assign(
|
|
1731
|
+
return createMqttContext(Object.assign(host, {
|
|
1732
|
+
handleForwardMessage: (msg) => hostHandleForwardMessage(host, msg),
|
|
1733
|
+
appendInboundMessage: (msg) => hostAppendInboundMessage(host, msg),
|
|
1734
|
+
}));
|
|
1519
1735
|
}
|
|
1520
1736
|
async function hostHandleMqttMessage(host, message) {
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1737
|
+
return enqueueMqttTask(host, async () => {
|
|
1738
|
+
const parsedMessage = parseMqttPayload(message);
|
|
1739
|
+
if (!parsedMessage)
|
|
1740
|
+
return;
|
|
1741
|
+
await dispatchMqttMessage(parsedMessage, hostCreateMqttContext(host));
|
|
1742
|
+
});
|
|
1525
1743
|
}
|
|
1526
1744
|
function hostSubscribeToMqtt(host) {
|
|
1527
1745
|
const userId = host.isometrikUserId || host.isometrikUserIdFromCookie;
|
|
@@ -1536,8 +1754,111 @@ function hostSubscribeToMqtt(host) {
|
|
|
1536
1754
|
host.isSubscribedToTopic = true;
|
|
1537
1755
|
host.isMessageListenerAttached = true;
|
|
1538
1756
|
}
|
|
1757
|
+
function clearOfflinePoll(host) {
|
|
1758
|
+
if (host.mqttRefetchInterval) {
|
|
1759
|
+
clearInterval(host.mqttRefetchInterval);
|
|
1760
|
+
host.mqttRefetchInterval = null;
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1763
|
+
/** While MQTT is down, lightly refresh the open conversation (not a full wipe). */
|
|
1764
|
+
function startOfflinePoll(host) {
|
|
1765
|
+
if (host.mqttRefetchInterval)
|
|
1766
|
+
return;
|
|
1767
|
+
host.mqttRefetchInterval = setInterval(() => {
|
|
1768
|
+
if (host.isMqttConnected) {
|
|
1769
|
+
clearOfflinePoll(host);
|
|
1770
|
+
return;
|
|
1771
|
+
}
|
|
1772
|
+
void hostGapFillMessages(host);
|
|
1773
|
+
}, OFFLINE_POLL_MS);
|
|
1774
|
+
}
|
|
1775
|
+
/**
|
|
1776
|
+
* Soft gap-fill: fetch latest page and merge by messageId — no clearing the thread
|
|
1777
|
+
* (avoids flicker after reconnect).
|
|
1778
|
+
*/
|
|
1779
|
+
async function hostGapFillMessages(host) {
|
|
1780
|
+
const conversationId = host.selectedConversationId;
|
|
1781
|
+
if (!conversationId || typeof host.getMessages !== 'function')
|
|
1782
|
+
return;
|
|
1783
|
+
try {
|
|
1784
|
+
const page = await fetchMessagesPage({ conversationId, skip: 0 });
|
|
1785
|
+
if (!Array.isArray(page) || page.length === 0)
|
|
1786
|
+
return;
|
|
1787
|
+
const existing = Array.isArray(host.allMessages) ? host.allMessages : [];
|
|
1788
|
+
const byId = new Map();
|
|
1789
|
+
existing.forEach((m) => {
|
|
1790
|
+
if (m === null || m === void 0 ? void 0 : m.messageId)
|
|
1791
|
+
byId.set(m.messageId, m);
|
|
1792
|
+
});
|
|
1793
|
+
page.forEach((m) => {
|
|
1794
|
+
if (m === null || m === void 0 ? void 0 : m.messageId)
|
|
1795
|
+
byId.set(m.messageId, m);
|
|
1796
|
+
});
|
|
1797
|
+
const merged = Array.from(byId.values()).sort((a, b) => {
|
|
1798
|
+
var _a, _b, _c, _d;
|
|
1799
|
+
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;
|
|
1800
|
+
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;
|
|
1801
|
+
return ta - tb;
|
|
1802
|
+
});
|
|
1803
|
+
// Only write if something new arrived
|
|
1804
|
+
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))) {
|
|
1805
|
+
host.allMessages = merged;
|
|
1806
|
+
}
|
|
1807
|
+
}
|
|
1808
|
+
catch (e) {
|
|
1809
|
+
console.error('MQTT gap-fill failed:', e);
|
|
1810
|
+
}
|
|
1811
|
+
}
|
|
1812
|
+
async function onMqttConnected(host) {
|
|
1813
|
+
var _a, _b;
|
|
1814
|
+
const wasReconnect = (host.mqttConnectCount || 0) > 0;
|
|
1815
|
+
host.mqttConnectCount = (host.mqttConnectCount || 0) + 1;
|
|
1816
|
+
host.mqttInitialized = true;
|
|
1817
|
+
host.isMqttConnected = true;
|
|
1818
|
+
hostSubscribeToMqtt(host);
|
|
1819
|
+
host.mqttSession.resubscribe();
|
|
1820
|
+
clearOfflinePoll(host);
|
|
1821
|
+
if (host.selectedConversationId) {
|
|
1822
|
+
if (!host.isInitialCallDone) {
|
|
1823
|
+
try {
|
|
1824
|
+
await M.getInstance().message.putRead({ conversationId: host.selectedConversationId });
|
|
1825
|
+
}
|
|
1826
|
+
catch (_c) {
|
|
1827
|
+
/* non-fatal */
|
|
1828
|
+
}
|
|
1829
|
+
host.isInitialCallDone = true;
|
|
1830
|
+
}
|
|
1831
|
+
if (wasReconnect) {
|
|
1832
|
+
await hostGapFillMessages(host);
|
|
1833
|
+
void hostPersistMessages(host);
|
|
1834
|
+
// Refresh sidebar previews without blocking UI
|
|
1835
|
+
void Promise.resolve((_a = host.getConversations) === null || _a === void 0 ? void 0 : _a.call(host, 0)).catch(() => undefined);
|
|
1836
|
+
}
|
|
1837
|
+
// Drain any text messages queued while offline / failed
|
|
1838
|
+
void hostFlushOutbox(host);
|
|
1839
|
+
}
|
|
1840
|
+
else if (wasReconnect) {
|
|
1841
|
+
void Promise.resolve((_b = host.getConversations) === null || _b === void 0 ? void 0 : _b.call(host, 0)).catch(() => undefined);
|
|
1842
|
+
void hostFlushOutbox(host);
|
|
1843
|
+
}
|
|
1844
|
+
else {
|
|
1845
|
+
void hostFlushOutbox(host);
|
|
1846
|
+
}
|
|
1847
|
+
}
|
|
1848
|
+
function onMqttUnavailable(host, reason, error) {
|
|
1849
|
+
host.isMqttConnected = false;
|
|
1850
|
+
if (reason === 'error') {
|
|
1851
|
+
host.mqttInitialized = false;
|
|
1852
|
+
const msg = String((error === null || error === void 0 ? void 0 : error.message) || error || '');
|
|
1853
|
+
if (/not authorized/i.test(msg)) {
|
|
1854
|
+
// Auth failure — do not spin reconnect poll forever
|
|
1855
|
+
clearOfflinePoll(host);
|
|
1856
|
+
return;
|
|
1857
|
+
}
|
|
1858
|
+
}
|
|
1859
|
+
startOfflinePoll(host);
|
|
1860
|
+
}
|
|
1539
1861
|
async function hostSetupMqttClient(host) {
|
|
1540
|
-
var _a;
|
|
1541
1862
|
const deviceID = await getDeviceID();
|
|
1542
1863
|
const clientId = host.isometrikUserId || host.isometrikUserIdFromCookie;
|
|
1543
1864
|
const mqttClient = M.getInstance().initializeMqtt({
|
|
@@ -1550,44 +1871,28 @@ async function hostSetupMqttClient(host) {
|
|
|
1550
1871
|
deviceId: deviceID,
|
|
1551
1872
|
});
|
|
1552
1873
|
const raw = mqttClient.client;
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
if (raw === null || raw === void 0 ? void 0 : raw.reconnectTimer) {
|
|
1556
|
-
clearInterval(raw.reconnectTimer);
|
|
1557
|
-
raw.reconnectTimer = null;
|
|
1558
|
-
}
|
|
1559
|
-
(_a = raw === null || raw === void 0 ? void 0 : raw.removeAllListeners) === null || _a === void 0 ? void 0 : _a.call(raw, 'error');
|
|
1874
|
+
// Enable mqtt.js reconnect (was previously forced to 0).
|
|
1875
|
+
applyMqttReconnectOptions(raw);
|
|
1560
1876
|
host.mqttClient = mqttClient;
|
|
1561
1877
|
host.isMqttConnected = false;
|
|
1878
|
+
host.mqttConnectCount = host.mqttConnectCount || 0;
|
|
1562
1879
|
host.mqttSession.attach(mqttClient, {
|
|
1563
1880
|
onConnect: async () => {
|
|
1564
|
-
host
|
|
1565
|
-
host.isMqttConnected = true;
|
|
1566
|
-
hostSubscribeToMqtt(host);
|
|
1567
|
-
if (host.mqttRefetchInterval) {
|
|
1568
|
-
clearInterval(host.mqttRefetchInterval);
|
|
1569
|
-
host.mqttRefetchInterval = null;
|
|
1570
|
-
}
|
|
1571
|
-
if (!host.isInitialCallDone && host.selectedConversationId) {
|
|
1572
|
-
await M.getInstance().message.putRead({ conversationId: host.selectedConversationId });
|
|
1573
|
-
host.refetchMessages();
|
|
1574
|
-
host.isInitialCallDone = true;
|
|
1575
|
-
}
|
|
1881
|
+
await onMqttConnected(host);
|
|
1576
1882
|
},
|
|
1577
1883
|
onDisconnect: () => {
|
|
1884
|
+
onMqttUnavailable(host, 'disconnect');
|
|
1885
|
+
},
|
|
1886
|
+
onOffline: () => {
|
|
1887
|
+
onMqttUnavailable(host, 'offline');
|
|
1888
|
+
},
|
|
1889
|
+
onReconnect: () => {
|
|
1890
|
+
// mqtt.js is attempting reconnect — keep poll until connect succeeds
|
|
1578
1891
|
host.isMqttConnected = false;
|
|
1579
1892
|
},
|
|
1580
1893
|
onError: (error) => {
|
|
1581
1894
|
console.error('MQTT connection error:', error);
|
|
1582
|
-
host
|
|
1583
|
-
host.isMqttConnected = false;
|
|
1584
|
-
if (/not authorized/i.test(String((error === null || error === void 0 ? void 0 : error.message) || error)))
|
|
1585
|
-
return;
|
|
1586
|
-
if (!host.mqttRefetchInterval) {
|
|
1587
|
-
host.mqttRefetchInterval = setInterval(() => {
|
|
1588
|
-
host.refetchMessages();
|
|
1589
|
-
}, 30000);
|
|
1590
|
-
}
|
|
1895
|
+
onMqttUnavailable(host, 'error', error);
|
|
1591
1896
|
},
|
|
1592
1897
|
onMessage: async (_topic, message) => {
|
|
1593
1898
|
await hostHandleMqttMessage(host, message);
|
|
@@ -1595,9 +1900,10 @@ async function hostSetupMqttClient(host) {
|
|
|
1595
1900
|
});
|
|
1596
1901
|
}
|
|
1597
1902
|
async function hostHandleForwardMessage(host, parsedMessage) {
|
|
1598
|
-
var _a, _b;
|
|
1903
|
+
var _a, _b, _c;
|
|
1599
1904
|
try {
|
|
1600
|
-
const
|
|
1905
|
+
const list = (_a = host.allConversationList) !== null && _a !== void 0 ? _a : [];
|
|
1906
|
+
const conversationExists = list.some((conversation) => conversation.conversationId === parsedMessage.conversationId);
|
|
1601
1907
|
if (!conversationExists) {
|
|
1602
1908
|
const conversationDetails = await host.getUserConversationDetails(parsedMessage.conversationId);
|
|
1603
1909
|
const newConversation = {
|
|
@@ -1605,19 +1911,19 @@ async function hostHandleForwardMessage(host, parsedMessage) {
|
|
|
1605
1911
|
lastMessageDetails: {
|
|
1606
1912
|
body: parsedMessage.body,
|
|
1607
1913
|
updatedAt: parsedMessage.updatedAt || Date.now(),
|
|
1608
|
-
userName: (
|
|
1609
|
-
userProfileImageUrl: (
|
|
1914
|
+
userName: (_b = conversationDetails === null || conversationDetails === void 0 ? void 0 : conversationDetails.opponentDetails) === null || _b === void 0 ? void 0 : _b.userName,
|
|
1915
|
+
userProfileImageUrl: (_c = conversationDetails === null || conversationDetails === void 0 ? void 0 : conversationDetails.opponentDetails) === null || _c === void 0 ? void 0 : _c.userProfileImageUrl,
|
|
1610
1916
|
},
|
|
1611
1917
|
unreadMessagesCount: 0,
|
|
1612
1918
|
};
|
|
1613
1919
|
host.allConversationList = host.sortConversationsByLatestMessage([
|
|
1614
1920
|
newConversation,
|
|
1615
|
-
...
|
|
1921
|
+
...list,
|
|
1616
1922
|
]);
|
|
1617
1923
|
await host.getAllAttachments(newConversation.conversationId);
|
|
1618
1924
|
}
|
|
1619
1925
|
else {
|
|
1620
|
-
host.allConversationList = host.sortConversationsByLatestMessage(
|
|
1926
|
+
host.allConversationList = host.sortConversationsByLatestMessage(list.map((conversation) => {
|
|
1621
1927
|
if (conversation.conversationId === parsedMessage.conversationId) {
|
|
1622
1928
|
return Object.assign(Object.assign({}, conversation), { lastMessageDetails: Object.assign(Object.assign({}, conversation.lastMessageDetails), { body: parsedMessage.body, updatedAt: parsedMessage.updatedAt || Date.now() }), isGroup: conversation.isGroup, conversationTitle: conversation.conversationTitle, conversationImageUrl: conversation.conversationImageUrl, opponentDetails: conversation.opponentDetails });
|
|
1623
1929
|
}
|
|
@@ -2098,16 +2404,26 @@ const selectChatPlaceholderSvg = `
|
|
|
2098
2404
|
`;
|
|
2099
2405
|
|
|
2100
2406
|
/** Presentational shell tree for <web-chat> — keeps WebChat.tsx thin. */
|
|
2407
|
+
/** show / custom-slot / default matrix for any named region. */
|
|
2408
|
+
function renderRegion(host, slotName, show, renderDefault) {
|
|
2409
|
+
const mode = resolveRegionMode({
|
|
2410
|
+
show,
|
|
2411
|
+
hasCustomSlot: hasNamedSlot(host.el, slotName),
|
|
2412
|
+
});
|
|
2413
|
+
if (mode === 'hidden')
|
|
2414
|
+
return null;
|
|
2415
|
+
if (mode === 'custom')
|
|
2416
|
+
return h("slot", { name: slotName });
|
|
2417
|
+
return renderDefault();
|
|
2418
|
+
}
|
|
2101
2419
|
function renderBootLoader(host) {
|
|
2102
|
-
return (h("div", { class: "boot-loader-shell" },
|
|
2103
|
-
h("slot", { name: "boot-loader" },
|
|
2104
|
-
h("chat-loading-placeholder", { progress: host.loadingProgress, loadingStatus: host.loadingStatus }))));
|
|
2420
|
+
return (h("div", { class: "boot-loader-shell" }, renderRegion(host, 'boot-loader', true, () => (h("chat-loading-placeholder", { progress: host.loadingProgress, loadingStatus: host.loadingStatus })))));
|
|
2105
2421
|
}
|
|
2106
2422
|
function renderBusyOverlay(host) {
|
|
2107
2423
|
if (!host.isConversationLoading)
|
|
2108
2424
|
return null;
|
|
2109
2425
|
return (h("div", { class: "loaderoverlay" },
|
|
2110
|
-
h("spinner-loader", { height: "30px", width: "30px", spinTime: "1s", spinnerPrimaryColor: "var(--bg-primary
|
|
2426
|
+
h("spinner-loader", { height: "30px", width: "30px", spinTime: "1s", spinnerPrimaryColor: "var(--bg-primary)", spinnerSecondaryColor: "var(--text-primary)", spinnerBorderWidth: "2px" })));
|
|
2111
2427
|
}
|
|
2112
2428
|
function renderDefaultConversationList(host) {
|
|
2113
2429
|
var _a;
|
|
@@ -2125,47 +2441,50 @@ function renderDefaultConversationList(host) {
|
|
|
2125
2441
|
marginBottom: '10px',
|
|
2126
2442
|
}, filterTab: {
|
|
2127
2443
|
padding: '10px 15px',
|
|
2128
|
-
border: '1px solid var(--
|
|
2444
|
+
border: '1px solid var(--brand-soft)',
|
|
2129
2445
|
borderRadius: '25px',
|
|
2130
2446
|
backgroundColor: 'transparent',
|
|
2131
2447
|
cursor: 'pointer',
|
|
2132
2448
|
transition: 'background-color 0.3s',
|
|
2133
|
-
color: 'var(--text-tertiary
|
|
2449
|
+
color: 'var(--text-tertiary)',
|
|
2134
2450
|
fontSize: '12px',
|
|
2135
2451
|
textTransform: 'uppercase',
|
|
2136
2452
|
}, filterTabHover: {
|
|
2137
|
-
backgroundColor: 'var(--
|
|
2453
|
+
backgroundColor: 'var(--brand-soft)',
|
|
2138
2454
|
}, 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 }));
|
|
2139
2455
|
}
|
|
2140
2456
|
function renderSidebarTab(host) {
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
}
|
|
2153
|
-
return
|
|
2457
|
+
const groupcastOn = host.groupcastEnabled !== false;
|
|
2458
|
+
const tab = host.activeTab === 'GroupCast' && !groupcastOn ? 'Chat' : host.activeTab;
|
|
2459
|
+
if (tab === 'GroupCast') {
|
|
2460
|
+
return renderRegion(host, 'group-cast', true, () => (h("group-cast", { isLoadingMore: host.isLoadingMoreGroupcast, groupCastData: host.allGroupCastContacts, userMetaData: host.userMetaData, onGroupcastTileSelected: (e) => host.handleChatSelect(e.detail), onCreated: (g) => {
|
|
2461
|
+
if (!(g === null || g === void 0 ? void 0 : g.groupcastId))
|
|
2462
|
+
return;
|
|
2463
|
+
host.allGroupCastContacts = [g, ...(host.allGroupCastContacts || [])];
|
|
2464
|
+
} })));
|
|
2465
|
+
}
|
|
2466
|
+
if (tab === 'Profile') {
|
|
2467
|
+
return renderRegion(host, 'profile-page', true, () => (h("profile-page", { getUserDetails: host.getUserDetails, name: host.userMetaData.userName, profilePhotoUrl: host.userMetaData.userProfileImageUrl, closeDrawer: () => (host.activeTab = 'Chat'), toggleTheme: host.toggleTheme, defaultTheme: host.defaultTheme })));
|
|
2468
|
+
}
|
|
2469
|
+
return renderRegion(host, 'conversation-list', host.showConversationList, () => renderDefaultConversationList(host));
|
|
2470
|
+
}
|
|
2471
|
+
function renderProfileRail(host) {
|
|
2472
|
+
return renderRegion(host, 'profile-rail', host.showProfileRail, () => (h("profile-sidebar", { userMetaData: host.userMetaData, activeTab: host.activeTab, openChat: () => (host.activeTab = 'Chat'), openProfile: () => (host.activeTab = 'Profile'), openGroupCast: () => {
|
|
2473
|
+
if (host.groupcastEnabled === false)
|
|
2474
|
+
return;
|
|
2475
|
+
host.getGroupCastContacts();
|
|
2476
|
+
}, unreadConversationsCount: host.unreadConversationsCount })));
|
|
2154
2477
|
}
|
|
2155
2478
|
function renderDefaultSidebar(host) {
|
|
2156
|
-
// Hosts can pass showProfileRail={false} — no DOM poke / empty slots needed.
|
|
2157
|
-
const showRail = host.showProfileRail !== false;
|
|
2158
2479
|
return (h(Fragment, null,
|
|
2159
|
-
|
|
2160
|
-
h("profile-sidebar", { userMetaData: host.userMetaData, activeTab: host.activeTab, openChat: () => (host.activeTab = 'Chat'), openProfile: () => (host.activeTab = 'Profile'), openGroupCast: () => host.getGroupCastContacts(), unreadConversationsCount: host.unreadConversationsCount }))) : null,
|
|
2480
|
+
renderProfileRail(host),
|
|
2161
2481
|
h("div", { class: "sidebar-tab" }, renderSidebarTab(host))));
|
|
2162
2482
|
}
|
|
2163
2483
|
function renderLeftRail(host) {
|
|
2164
2484
|
return (h("div", { class: {
|
|
2165
2485
|
'chat-sidebar-container': true,
|
|
2166
2486
|
'hidden': host.isMobileView && !host.showSidebar,
|
|
2167
|
-
} },
|
|
2168
|
-
h("slot", { name: "sidebar" }, renderDefaultSidebar(host))));
|
|
2487
|
+
} }, renderRegion(host, 'sidebar', true, () => renderDefaultSidebar(host))));
|
|
2169
2488
|
}
|
|
2170
2489
|
function renderDefaultComposer(host) {
|
|
2171
2490
|
var _a;
|
|
@@ -2173,9 +2492,9 @@ function renderDefaultComposer(host) {
|
|
|
2173
2492
|
return (h("div", { style: {
|
|
2174
2493
|
padding: '1rem',
|
|
2175
2494
|
textAlign: 'center',
|
|
2176
|
-
backgroundColor: 'var(--bg-secondary
|
|
2177
|
-
color: 'var(--text-primary
|
|
2178
|
-
borderTop: '1px solid var(--bg-secondary
|
|
2495
|
+
backgroundColor: 'var(--bg-secondary)',
|
|
2496
|
+
color: 'var(--text-primary)',
|
|
2497
|
+
borderTop: '1px solid var(--bg-secondary)',
|
|
2179
2498
|
} }, "You are no longer a member of this group"));
|
|
2180
2499
|
}
|
|
2181
2500
|
if (host.isBlocked === 'loading') {
|
|
@@ -2184,9 +2503,6 @@ function renderDefaultComposer(host) {
|
|
|
2184
2503
|
if ((_a = host.conversationMetaData) === null || _a === void 0 ? void 0 : _a.messagingDisabled) {
|
|
2185
2504
|
return h("p", { class: "blockMessageContainer" }, WEB_CONTENT.BLOCK_CHAT_MESSAGE);
|
|
2186
2505
|
}
|
|
2187
|
-
// Only re-project when the host actually filled the slot. An empty
|
|
2188
|
-
// <slot slot="composer-input"> still counts as assigned content and
|
|
2189
|
-
// suppresses chat-footer's default <my-test-footer-ui> fallback.
|
|
2190
2506
|
const el = host.el;
|
|
2191
2507
|
return (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 },
|
|
2192
2508
|
hasNamedSlot(el, 'reply-preview') ? h("slot", { name: "reply-preview", slot: "reply-preview" }) : null,
|
|
@@ -2195,10 +2511,10 @@ function renderDefaultComposer(host) {
|
|
|
2195
2511
|
}
|
|
2196
2512
|
/** slot="composer" replaces whole footer; else reply-preview / attachment-preview / composer-input */
|
|
2197
2513
|
function renderComposerOrBanner(host) {
|
|
2198
|
-
return
|
|
2514
|
+
return renderRegion(host, 'composer', host.showComposer, () => renderDefaultComposer(host));
|
|
2199
2515
|
}
|
|
2200
2516
|
function renderDefaultEmptyChat(_host) {
|
|
2201
|
-
return (h("div", { style: { backgroundColor: 'var(--bg-secondary
|
|
2517
|
+
return (h("div", { style: { backgroundColor: 'var(--bg-secondary)', color: 'var(--text-tertiary)' }, class: "noChatSelectedPlaceholder" },
|
|
2202
2518
|
h("div", { innerHTML: selectChatPlaceholderSvg }),
|
|
2203
2519
|
h("span", null, "\"Start a Conversation\""),
|
|
2204
2520
|
h("span", null,
|
|
@@ -2208,23 +2524,23 @@ function renderDefaultEmptyChat(_host) {
|
|
|
2208
2524
|
}
|
|
2209
2525
|
function renderDefaultHeader(host) {
|
|
2210
2526
|
var _a, _b;
|
|
2211
|
-
return (h("web-chat-header", { searchedMessageDetails: host.searchedMessageDetails, onSearchHandler: (text) => host.getMessagesByQuery(text), onSearchResultClick: host.handleSearchResultClick, headerBgColor: "var(--bg-primary
|
|
2527
|
+
return (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() }));
|
|
2212
2528
|
}
|
|
2213
2529
|
function renderDefaultMessages(host) {
|
|
2214
2530
|
var _a;
|
|
2215
2531
|
return (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 : {} }, hasNamedSlot(host.el, 'message-info') ? h("slot", { name: "message-info", slot: "message-info" }) : null));
|
|
2216
2532
|
}
|
|
2217
2533
|
function renderActiveChat(host) {
|
|
2218
|
-
const info = host.
|
|
2534
|
+
const info = host.messageInfoView;
|
|
2219
2535
|
return (h("div", { class: { 'chat-pane-row': true, 'info-open': !!(info === null || info === void 0 ? void 0 : info.open) } },
|
|
2220
2536
|
h("div", { class: "chat-main-stack" },
|
|
2221
|
-
|
|
2222
|
-
|
|
2537
|
+
renderRegion(host, 'header', host.showHeader, () => renderDefaultHeader(host)),
|
|
2538
|
+
renderRegion(host, 'messages', true, () => renderDefaultMessages(host)),
|
|
2223
2539
|
renderComposerOrBanner(host)),
|
|
2224
2540
|
(info === null || info === void 0 ? void 0 : info.open) ? (h("div", { class: "message-info-dock" }, info.isLoading ? (h("div", { class: "message-info-loading" },
|
|
2225
2541
|
h("spinner-loader", { height: "20px", width: "20px", spinTime: "1s", spinnerPrimaryColor: "var(--brand, #2563eb)", spinnerSecondaryColor: "var(--border, #e5e7eb)", spinnerBorderWidth: "2px" }))) : (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: () => {
|
|
2226
2542
|
var _a, _b;
|
|
2227
|
-
host.
|
|
2543
|
+
host.messageInfoView = null;
|
|
2228
2544
|
(_b = (_a = host.chatBodyRef) === null || _a === void 0 ? void 0 : _a.closeMessageInfo) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
2229
2545
|
} })))) : null));
|
|
2230
2546
|
}
|
|
@@ -2242,7 +2558,7 @@ function renderChatPane(host) {
|
|
|
2242
2558
|
}
|
|
2243
2559
|
: host.selectedConversationId
|
|
2244
2560
|
? { background: 'var(--bg-tertiary, #f4f4f5)' }
|
|
2245
|
-
: undefined }, host.selectedConversationId ? (renderActiveChat(host)) : (
|
|
2561
|
+
: undefined }, host.selectedConversationId ? (renderActiveChat(host)) : (renderRegion(host, 'empty', host.showEmptyState, () => renderDefaultEmptyChat()))));
|
|
2246
2562
|
}
|
|
2247
2563
|
function renderDefaultRightPanel(host) {
|
|
2248
2564
|
return (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 },
|
|
@@ -2251,10 +2567,11 @@ function renderDefaultRightPanel(host) {
|
|
|
2251
2567
|
hasNamedSlot(host.el, 'message-search') ? h("slot", { name: "message-search", slot: "message-search" }) : null));
|
|
2252
2568
|
}
|
|
2253
2569
|
function renderRightRail(host) {
|
|
2570
|
+
if (host.showRightPanel === false)
|
|
2571
|
+
return null;
|
|
2254
2572
|
if (!host.showRightSideBar)
|
|
2255
2573
|
return null;
|
|
2256
|
-
return (h("div", { class: "chat-sidebar-right" },
|
|
2257
|
-
h("slot", { name: "right-panel" }, renderDefaultRightPanel(host))));
|
|
2574
|
+
return (h("div", { class: "chat-sidebar-right" }, renderRegion(host, 'right-panel', true, () => renderDefaultRightPanel(host))));
|
|
2258
2575
|
}
|
|
2259
2576
|
|
|
2260
2577
|
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)}}";
|
|
@@ -2279,6 +2596,8 @@ const WebChat = /*@__PURE__*/ proxyCustomElement(class WebChat extends HTMLEleme
|
|
|
2279
2596
|
this.mqttSession = new MqttSession();
|
|
2280
2597
|
this.boundCheckMobileView = () => this.checkMobileView();
|
|
2281
2598
|
this.mqttRefetchInterval = null;
|
|
2599
|
+
/** How many successful MQTT connects this mount (0 = first, >0 = reconnect). Used by mqtt-host. */
|
|
2600
|
+
this.mqttConnectCount = 0;
|
|
2282
2601
|
this.typingClearTimeout = null;
|
|
2283
2602
|
this.initGeneration = 0;
|
|
2284
2603
|
this.chatReadyEmitted = false;
|
|
@@ -2371,9 +2690,8 @@ const WebChat = /*@__PURE__*/ proxyCustomElement(class WebChat extends HTMLEleme
|
|
|
2371
2690
|
this.skip += 20;
|
|
2372
2691
|
}
|
|
2373
2692
|
}
|
|
2374
|
-
const chatBody =
|
|
2375
|
-
if (chatBody) {
|
|
2376
|
-
// @ts-ignore
|
|
2693
|
+
const chatBody = this.chatBodyRef;
|
|
2694
|
+
if (chatBody === null || chatBody === void 0 ? void 0 : chatBody.scrollToMessage) {
|
|
2377
2695
|
chatBody.scrollToMessage(messageId);
|
|
2378
2696
|
}
|
|
2379
2697
|
};
|
|
@@ -2404,9 +2722,14 @@ const WebChat = /*@__PURE__*/ proxyCustomElement(class WebChat extends HTMLEleme
|
|
|
2404
2722
|
this.accountId = undefined;
|
|
2405
2723
|
this.conversationId = undefined;
|
|
2406
2724
|
this.hostUrl = undefined;
|
|
2407
|
-
this.groupcastEnabled =
|
|
2725
|
+
this.groupcastEnabled = true;
|
|
2408
2726
|
this.showProfileRail = true;
|
|
2409
2727
|
this.showChatWallpaper = true;
|
|
2728
|
+
this.showHeader = true;
|
|
2729
|
+
this.showComposer = true;
|
|
2730
|
+
this.showEmptyState = true;
|
|
2731
|
+
this.showConversationList = true;
|
|
2732
|
+
this.showRightPanel = true;
|
|
2410
2733
|
this.unreadConversations = [];
|
|
2411
2734
|
this.allLinks = undefined;
|
|
2412
2735
|
this.allLinksCount = undefined;
|
|
@@ -2459,8 +2782,8 @@ const WebChat = /*@__PURE__*/ proxyCustomElement(class WebChat extends HTMLEleme
|
|
|
2459
2782
|
this.isSidebarHeaderLabel = true;
|
|
2460
2783
|
this.sidebarHeaderLabel = 'Chats';
|
|
2461
2784
|
this.isSidebarHeaderSearch = true;
|
|
2462
|
-
this.sidebarColor = 'var(--bg-primary
|
|
2463
|
-
this.sidebarSelectedColor = 'var(--
|
|
2785
|
+
this.sidebarColor = 'var(--bg-primary)';
|
|
2786
|
+
this.sidebarSelectedColor = 'var(--brand-soft)';
|
|
2464
2787
|
this.messageSearchText = '';
|
|
2465
2788
|
this.searchedMessageDetails = [];
|
|
2466
2789
|
this.initialConversationIdFromURL = '';
|
|
@@ -2646,6 +2969,7 @@ const WebChat = /*@__PURE__*/ proxyCustomElement(class WebChat extends HTMLEleme
|
|
|
2646
2969
|
clearTimeout(this.typingClearTimeout);
|
|
2647
2970
|
this.typingClearTimeout = null;
|
|
2648
2971
|
}
|
|
2972
|
+
hostTeardownOffline(this);
|
|
2649
2973
|
this.mqttSession.teardown();
|
|
2650
2974
|
this.mqttClient = null;
|
|
2651
2975
|
this.isMqttConnected = false;
|
|
@@ -2664,6 +2988,8 @@ const WebChat = /*@__PURE__*/ proxyCustomElement(class WebChat extends HTMLEleme
|
|
|
2664
2988
|
this.isContactInfoOpen = false;
|
|
2665
2989
|
this.isOpenSearchBar = false;
|
|
2666
2990
|
this.conversationMetaData = metaFromConversationList(this.allConversationList, conversationId);
|
|
2991
|
+
// Show cached thread instantly while network fetch runs
|
|
2992
|
+
void hostHydrateMessagesFromCache(this, conversationId);
|
|
2667
2993
|
if (typeof param === 'string') {
|
|
2668
2994
|
this.getAllAttachments(conversationId);
|
|
2669
2995
|
pushConversationUrl(conversationId || null);
|
|
@@ -2843,6 +3169,11 @@ const WebChat = /*@__PURE__*/ proxyCustomElement(class WebChat extends HTMLEleme
|
|
|
2843
3169
|
"groupcastEnabled": [4, "groupcast-enabled"],
|
|
2844
3170
|
"showProfileRail": [4, "show-profile-rail"],
|
|
2845
3171
|
"showChatWallpaper": [4, "show-chat-wallpaper"],
|
|
3172
|
+
"showHeader": [4, "show-header"],
|
|
3173
|
+
"showComposer": [4, "show-composer"],
|
|
3174
|
+
"showEmptyState": [4, "show-empty-state"],
|
|
3175
|
+
"showConversationList": [4, "show-conversation-list"],
|
|
3176
|
+
"showRightPanel": [4, "show-right-panel"],
|
|
2846
3177
|
"isChatFilter": [4, "is-chat-filter"],
|
|
2847
3178
|
"isAllChatButton": [4, "is-all-chat-button"],
|
|
2848
3179
|
"isSidebarHeaderLabel": [4, "is-sidebar-header-label"],
|