isometrik-plugin-chat-sdk 1.3.19 → 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 +689 -369
- package/dist/cjs/login-page_3.cjs.entry.js.map +1 -1
- package/dist/cjs/media-gallery.cjs.entry.js +1 -1
- package/dist/cjs/media-limits-eba42629.js +165 -0
- package/dist/cjs/media-limits-eba42629.js.map +1 -0
- package/dist/cjs/member-add.cjs.entry.js +3 -3
- package/dist/cjs/message-bubble.cjs.entry.js +30 -8
- package/dist/cjs/message-bubble.cjs.entry.js.map +1 -1
- package/dist/cjs/my-component.cjs.entry.js +1 -1
- package/dist/cjs/new-chat-sidebar.cjs.entry.js +2 -2
- package/dist/cjs/reaction-container.cjs.entry.js +4 -4
- package/dist/cjs/runtime-controls-201c71ba.js +650 -0
- package/dist/cjs/runtime-controls-201c71ba.js.map +1 -0
- package/dist/cjs/send-media-14908d4b.js +375 -0
- package/dist/cjs/send-media-14908d4b.js.map +1 -0
- package/dist/cjs/signup-page.cjs.entry.js +1 -1
- package/dist/cjs/{toast-0bf1e688.js → toast-f810e550.js} +8 -8
- package/dist/cjs/toast-f810e550.js.map +1 -0
- package/dist/collection/collection-manifest.json +2 -1
- package/dist/collection/components/ChatUIComponent/ChatDocumentMessageBubble.js +1 -1
- package/dist/collection/components/ChatUIComponent/ChatImageMessageBubble.js +1 -1
- package/dist/collection/components/ChatUIComponent/ChatVideoMessageBubble.js +1 -1
- package/dist/collection/components/ChatUIComponent/Footer/ChatFooter.js +61 -14
- package/dist/collection/components/ChatUIComponent/Footer/ChatFooter.js.map +1 -1
- package/dist/collection/components/ChatUIComponent/ReactionContainer.js +2 -2
- package/dist/collection/components/ChatUIComponent/WebChatBody/WebChatBody.js +7 -6
- package/dist/collection/components/ChatUIComponent/WebChatBody/WebChatBody.js.map +1 -1
- package/dist/collection/components/ChatUIComponent/shared/attachment-preview/attachment-preview.js +39 -8
- package/dist/collection/components/ChatUIComponent/shared/attachment-preview/attachment-preview.js.map +1 -1
- package/dist/collection/components/ChatUIComponent/shared/document-message/document-message.js +53 -3
- package/dist/collection/components/ChatUIComponent/shared/document-message/document-message.js.map +1 -1
- package/dist/collection/components/ChatUIComponent/shared/forward-message/forward-message.js +2 -2
- package/dist/collection/components/ChatUIComponent/shared/image-message/image-message.js +19 -1
- package/dist/collection/components/ChatUIComponent/shared/image-message/image-message.js.map +1 -1
- package/dist/collection/components/ChatUIComponent/shared/incoming-text-message-bubble/incoming-text-message-bubble.js +1 -1
- package/dist/collection/components/ChatUIComponent/shared/message-bubble/message-bubble.js +47 -7
- package/dist/collection/components/ChatUIComponent/shared/message-bubble/message-bubble.js.map +1 -1
- package/dist/collection/components/ChatUIComponent/shared/message-date-pill/message-date-pill.js +1 -1
- package/dist/collection/components/ChatUIComponent/shared/new chat/new-chat.stories.js +1 -1
- package/dist/collection/components/ChatUIComponent/shared/outgoing-text-message-bubble/outgoing-text-message-bubble.js +19 -1
- package/dist/collection/components/ChatUIComponent/shared/outgoing-text-message-bubble/outgoing-text-message-bubble.js.map +1 -1
- package/dist/collection/components/ChatUIComponent/shared/reply-message-container/reply-message-container.js +1 -1
- package/dist/collection/components/ChatUIComponent/shared/video-message/video-message.js +20 -2
- package/dist/collection/components/ChatUIComponent/shared/video-message/video-message.js.map +1 -1
- package/dist/collection/components/my-component/my-component.js +1 -1
- package/dist/collection/components/my-component/web-chat/FLOW.js +1 -1
- package/dist/collection/components/my-component/web-chat/FLOW.js.map +1 -1
- package/dist/collection/components/my-component/web-chat/WebChat.js +113 -12
- package/dist/collection/components/my-component/web-chat/WebChat.js.map +1 -1
- package/dist/collection/components/my-component/web-chat/bootstrap.js +7 -0
- package/dist/collection/components/my-component/web-chat/bootstrap.js.map +1 -1
- package/dist/collection/components/my-component/web-chat/data-fetch.js +14 -5
- package/dist/collection/components/my-component/web-chat/data-fetch.js.map +1 -1
- package/dist/collection/components/my-component/web-chat/mqtt-host.js +133 -34
- package/dist/collection/components/my-component/web-chat/mqtt-host.js.map +1 -1
- package/dist/collection/components/my-component/web-chat/offline-host.js +212 -0
- package/dist/collection/components/my-component/web-chat/offline-host.js.map +1 -0
- package/dist/collection/components/my-component/web-chat/public-send.js +96 -21
- package/dist/collection/components/my-component/web-chat/public-send.js.map +1 -1
- package/dist/collection/components/my-component/web-chat/shell-render.js +47 -28
- package/dist/collection/components/my-component/web-chat/shell-render.js.map +1 -1
- package/dist/collection/components/theme-provider.js +114 -45
- package/dist/collection/components/theme-provider.js.map +1 -1
- package/dist/collection/constants/chat-creds.js +2 -2
- package/dist/collection/demos/custom-ui-demo-elements.js +2 -2
- package/dist/collection/demos/custom-ui-demo-elements.js.map +1 -1
- package/dist/collection/global/expose-sdk.js +29 -0
- package/dist/collection/global/expose-sdk.js.map +1 -0
- package/dist/collection/index.js +10 -141
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/lib/chat/index.js +3 -0
- package/dist/collection/lib/chat/index.js.map +1 -1
- package/dist/collection/lib/chat/media-limits.js +21 -0
- package/dist/collection/lib/chat/media-limits.js.map +1 -0
- package/dist/collection/lib/chat/media-outbox.js +43 -0
- package/dist/collection/lib/chat/media-outbox.js.map +1 -0
- package/dist/collection/lib/chat/preview-kind.js +41 -0
- package/dist/collection/lib/chat/preview-kind.js.map +1 -0
- package/dist/collection/lib/chat/send-media.js +5 -2
- package/dist/collection/lib/chat/send-media.js.map +1 -1
- package/dist/collection/lib/custom-ui/contracts.js +1 -1
- package/dist/collection/lib/custom-ui/contracts.js.map +1 -1
- package/dist/collection/lib/custom-ui/index.js +1 -1
- package/dist/collection/lib/custom-ui/index.js.map +1 -1
- package/dist/collection/lib/custom-ui/public-api.js +1 -0
- package/dist/collection/lib/custom-ui/public-api.js.map +1 -1
- package/dist/collection/lib/destroy-chat.js +15 -16
- package/dist/collection/lib/destroy-chat.js.map +1 -0
- package/dist/collection/lib/mqtt/inbound-queue.js +17 -0
- package/dist/collection/lib/mqtt/inbound-queue.js.map +1 -0
- package/dist/collection/lib/mqtt/index.js +2 -1
- package/dist/collection/lib/mqtt/index.js.map +1 -1
- package/dist/collection/lib/mqtt/session.js +50 -6
- package/dist/collection/lib/mqtt/session.js.map +1 -1
- package/dist/collection/lib/offline/client.js +167 -0
- package/dist/collection/lib/offline/client.js.map +1 -0
- package/dist/collection/lib/offline/idb.js +181 -0
- package/dist/collection/lib/offline/idb.js.map +1 -0
- package/dist/collection/lib/offline/index.js +10 -0
- package/dist/collection/lib/offline/index.js.map +1 -0
- package/dist/collection/lib/offline/memory-db.js +64 -0
- package/dist/collection/lib/offline/memory-db.js.map +1 -0
- package/dist/collection/lib/offline/merge.js +24 -0
- package/dist/collection/lib/offline/merge.js.map +1 -0
- package/dist/collection/lib/offline/multitab.js +47 -0
- package/dist/collection/lib/offline/multitab.js.map +1 -0
- package/dist/collection/lib/offline/types.js +2 -0
- package/dist/collection/lib/offline/types.js.map +1 -0
- package/dist/collection/lib/toast.js +6 -6
- package/dist/collection/lib/toast.js.map +1 -1
- package/dist/collection/sdk/api.js +4 -0
- package/dist/collection/sdk/api.js.map +1 -0
- package/dist/collection/sdk/composition.js +43 -0
- package/dist/collection/sdk/composition.js.map +1 -0
- package/dist/collection/sdk/headless-api.js +37 -0
- package/dist/collection/sdk/headless-api.js.map +1 -0
- package/dist/collection/sdk/index.js +11 -0
- package/dist/collection/sdk/index.js.map +1 -0
- package/dist/collection/sdk/init.js +207 -0
- package/dist/collection/sdk/init.js.map +1 -0
- package/dist/collection/sdk/instance.js +63 -0
- package/dist/collection/sdk/instance.js.map +1 -0
- package/dist/collection/sdk/react-bridge.js +145 -0
- package/dist/collection/sdk/react-bridge.js.map +1 -0
- package/dist/collection/sdk/runtime-controls.js +54 -0
- package/dist/collection/sdk/runtime-controls.js.map +1 -0
- package/dist/collection/sdk/slots.js +57 -0
- package/dist/collection/sdk/slots.js.map +1 -0
- package/dist/collection/sdk/theme-tokens.js +99 -0
- package/dist/collection/sdk/theme-tokens.js.map +1 -0
- package/dist/collection/sdk/webchat-api.js +36 -0
- package/dist/collection/sdk/webchat-api.js.map +1 -0
- package/dist/collection/testing/chat-assets-mock.js +45 -0
- package/dist/collection/testing/chat-creds-mock.js +18 -0
- package/dist/collection/testing/emoji-picker-mock.js +2 -0
- package/dist/collection/testing/file-mock.js +1 -0
- package/dist/collection/testing/groupcast-mock.js +7 -0
- package/dist/collection/testing/helpers-mock.js +4 -0
- package/dist/collection/testing/iso-chat-sdk-mock.js +19 -0
- package/dist/collection/testing/toast-mock.js +2 -0
- package/dist/components/ChatFooter.js +62 -15
- package/dist/components/ChatFooter.js.map +1 -1
- package/dist/components/ChatSidebar.js +1 -1
- package/dist/components/{GroupCast.js → GroupCast2.js} +2 -2
- package/dist/components/GroupCast2.js.map +1 -0
- package/dist/components/WebChat.js +624 -305
- package/dist/components/WebChat.js.map +1 -1
- package/dist/components/WebChatBody.js +8 -7
- package/dist/components/WebChatBody.js.map +1 -1
- package/dist/components/attachment-preview2.js +40 -9
- package/dist/components/attachment-preview2.js.map +1 -1
- package/dist/components/chat-app.js +3 -3
- package/dist/components/chat-app.js.map +1 -1
- package/dist/components/chat-assets.js +1 -1
- package/dist/components/chat-creds.js +2 -2
- package/dist/components/chat-creds.js.map +1 -1
- package/dist/components/chat-document-message-bubble.js +1 -1
- package/dist/components/chat-image-message-bubble.js +1 -1
- package/dist/components/chat-tile2.js +1 -1
- package/dist/components/chat-video-message-bubble.js +1 -1
- package/dist/components/client.js +728 -0
- package/dist/components/client.js.map +1 -0
- package/dist/components/contact-info2.js +2 -117
- package/dist/components/contact-info2.js.map +1 -1
- package/dist/components/contracts.js +1 -1
- package/dist/components/contracts.js.map +1 -1
- package/dist/components/destroy-chat.js +14 -16
- package/dist/components/destroy-chat.js.map +1 -1
- package/dist/components/document-message2.js +35 -5
- package/dist/components/document-message2.js.map +1 -1
- package/dist/components/forward-message.js +2 -2
- package/dist/components/group-cast.js +1 -1
- package/dist/components/{groupcast2.js → groupcast.js} +1 -1
- package/dist/components/groupcast.js.map +1 -0
- package/dist/components/image-message2.js +3 -1
- package/dist/components/image-message2.js.map +1 -1
- package/dist/components/incoming-text-message-bubble2.js +1 -1
- package/dist/components/index.js +551 -60
- package/dist/components/index.js.map +1 -1
- package/dist/components/index2.js +1 -1
- package/dist/components/index2.js.map +1 -1
- package/dist/components/media-limits.js +24 -0
- package/dist/components/media-limits.js.map +1 -0
- package/dist/components/member-add.js +1 -1
- package/dist/components/message-bubble2.js +31 -7
- package/dist/components/message-bubble2.js.map +1 -1
- package/dist/components/message-date-pill2.js +1 -1
- package/dist/components/messages.js +131 -0
- package/dist/components/messages.js.map +1 -0
- package/dist/components/my-component.js +1 -1
- package/dist/components/outgoing-text-message-bubble2.js +3 -1
- package/dist/components/outgoing-text-message-bubble2.js.map +1 -1
- package/dist/components/preview-kind.js +30 -0
- package/dist/components/preview-kind.js.map +1 -0
- package/dist/components/reaction-container.js +2 -2
- package/dist/components/reply-message-container2.js +1 -1
- package/dist/components/theme-provider2.js +56 -44
- package/dist/components/theme-provider2.js.map +1 -1
- package/dist/components/theme-tokens.js +102 -0
- package/dist/components/theme-tokens.js.map +1 -0
- package/dist/components/toast.js +6 -6
- package/dist/components/toast.js.map +1 -1
- package/dist/components/video-message2.js +4 -2
- package/dist/components/video-message2.js.map +1 -1
- package/dist/esm/app-globals-2beecb81.js +36 -0
- package/dist/esm/app-globals-2beecb81.js.map +1 -0
- package/dist/esm/attachment-preview_22.entry.js +120 -42
- package/dist/esm/attachment-preview_22.entry.js.map +1 -1
- package/dist/esm/audio-bubble_4.entry.js +39 -9
- package/dist/esm/audio-bubble_4.entry.js.map +1 -1
- package/dist/esm/chat-app.entry.js +2 -2
- package/dist/esm/chat-app.entry.js.map +1 -1
- package/dist/esm/{chat-assets-e3173222.js → chat-assets-bb056958.js} +2 -2
- package/dist/esm/{chat-assets-e3173222.js.map → chat-assets-bb056958.js.map} +1 -1
- package/dist/esm/{chat-creds-5d0982fc.js → chat-creds-aafad4d0.js} +3 -3
- package/dist/esm/chat-creds-aafad4d0.js.map +1 -0
- package/dist/esm/chat-document-message-bubble.entry.js +1 -1
- package/dist/esm/chat-image-message-bubble.entry.js +1 -1
- package/dist/esm/chat-tile_3.entry.js +1 -1
- package/dist/esm/chat-video-message-bubble.entry.js +1 -1
- package/dist/esm/client-4a3e00da.js +477 -0
- package/dist/esm/client-4a3e00da.js.map +1 -0
- package/dist/esm/{contracts-614be4db.js → contracts-50f4ddae.js} +2 -2
- package/dist/esm/contracts-50f4ddae.js.map +1 -0
- package/dist/esm/destroy-chat-d0ee28d6.js +22 -0
- package/dist/esm/destroy-chat-d0ee28d6.js.map +1 -0
- package/dist/esm/doublecheck-261763ef.js +32 -0
- package/dist/esm/doublecheck-261763ef.js.map +1 -0
- package/dist/esm/{drawer-8f721119.js → drawer-74c188f1.js} +2 -2
- package/dist/esm/{drawer-8f721119.js.map → drawer-74c188f1.js.map} +1 -1
- package/dist/esm/forward-memebers.entry.js +3 -3
- package/dist/esm/forward-message.entry.js +2 -2
- package/dist/esm/group-chat-contacts.entry.js +2 -2
- package/dist/esm/{group-members-806fd7a2.js → group-members-05414da2.js} +2 -118
- package/dist/esm/group-members-05414da2.js.map +1 -0
- package/dist/esm/{groupcast-2ce7187f.js → groupcast-9c7d2a32.js} +2 -2
- package/dist/esm/{groupcast-2ce7187f.js.map → groupcast-9c7d2a32.js.map} +1 -1
- package/dist/esm/{helpers-4c6d09a7.js → helpers-f33b895c.js} +2 -2
- package/dist/esm/{helpers-4c6d09a7.js.map → helpers-f33b895c.js.map} +1 -1
- package/dist/esm/{index-beb184c6.js → index-4c865e34.js} +2 -2
- package/dist/esm/index-4c865e34.js.map +1 -0
- package/dist/esm/index.js +17 -171
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/isometrik-webchat.js +10 -2
- package/dist/esm/isometrik-webchat.js.map +1 -1
- package/dist/esm/loader.js +10 -2
- package/dist/esm/loader.js.map +1 -1
- package/dist/esm/login-page_3.entry.js +672 -352
- package/dist/esm/login-page_3.entry.js.map +1 -1
- package/dist/esm/media-gallery.entry.js +1 -1
- package/dist/esm/media-limits-3fa07c09.js +152 -0
- package/dist/esm/media-limits-3fa07c09.js.map +1 -0
- package/dist/esm/member-add.entry.js +5 -5
- package/dist/esm/message-bubble.entry.js +30 -8
- package/dist/esm/message-bubble.entry.js.map +1 -1
- package/dist/esm/my-component.entry.js +1 -1
- package/dist/esm/new-chat-sidebar.entry.js +3 -3
- package/dist/esm/reaction-container.entry.js +4 -4
- package/dist/esm/runtime-controls-cf599fe2.js +623 -0
- package/dist/esm/runtime-controls-cf599fe2.js.map +1 -0
- package/dist/esm/send-media-917dcc2f.js +353 -0
- package/dist/esm/send-media-917dcc2f.js.map +1 -0
- package/dist/esm/signup-page.entry.js +1 -1
- package/dist/esm/{toast-d8ea763c.js → toast-533dd183.js} +8 -8
- package/dist/esm/toast-533dd183.js.map +1 -0
- package/dist/isometrik-webchat/index.esm.js +1 -1
- package/dist/isometrik-webchat/index.esm.js.map +1 -1
- package/dist/isometrik-webchat/isometrik-webchat.css +1 -1
- package/dist/isometrik-webchat/isometrik-webchat.esm.js +1 -1
- package/dist/isometrik-webchat/isometrik-webchat.esm.js.map +1 -1
- package/dist/isometrik-webchat/p-0731d488.js +2 -0
- package/dist/isometrik-webchat/p-0731d488.js.map +1 -0
- package/dist/isometrik-webchat/{p-a15092d9.entry.js → p-1854b156.entry.js} +2 -2
- package/dist/isometrik-webchat/p-1854b156.entry.js.map +1 -0
- package/dist/isometrik-webchat/{p-5fea3fd2.entry.js → p-2d3e8cd4.entry.js} +2 -2
- package/dist/isometrik-webchat/p-315eee9a.js +2 -0
- package/dist/isometrik-webchat/p-315eee9a.js.map +1 -0
- package/dist/isometrik-webchat/{p-e7f58d3f.entry.js → p-39b626ed.entry.js} +2 -2
- package/dist/isometrik-webchat/{p-eb1f3118.entry.js → p-3c70c22c.entry.js} +2 -2
- package/dist/isometrik-webchat/p-4cb54460.js +2 -0
- package/dist/isometrik-webchat/p-4cb54460.js.map +1 -0
- package/dist/isometrik-webchat/{p-f24cdbbb.js → p-5162774c.js} +1 -1
- package/dist/isometrik-webchat/p-5162774c.js.map +1 -0
- package/dist/isometrik-webchat/p-53ee98a7.entry.js +2 -0
- package/dist/isometrik-webchat/p-53ee98a7.entry.js.map +1 -0
- package/dist/isometrik-webchat/{p-5cbc1a16.entry.js → p-586f6978.entry.js} +2 -2
- package/dist/isometrik-webchat/{p-5f7eebbf.entry.js → p-5d243250.entry.js} +2 -2
- package/dist/isometrik-webchat/{p-23df1c24.js → p-5d98a8a0.js} +2 -2
- package/dist/isometrik-webchat/p-7f415f28.js +2 -0
- package/dist/isometrik-webchat/p-7f415f28.js.map +1 -0
- package/dist/isometrik-webchat/{p-d386acfe.js → p-7fd2c1ad.js} +1 -1
- package/dist/isometrik-webchat/p-7fd2c1ad.js.map +1 -0
- package/dist/isometrik-webchat/{p-e5884258.js → p-9982fa21.js} +2 -2
- package/dist/isometrik-webchat/{p-4db39c93.js → p-a5707f12.js} +2 -2
- package/dist/isometrik-webchat/{p-af775c83.entry.js → p-a876991d.entry.js} +2 -2
- package/dist/isometrik-webchat/{p-7b80b0b2.js → p-adc45831.js} +1 -1
- package/dist/isometrik-webchat/p-adc45831.js.map +1 -0
- package/dist/isometrik-webchat/p-ae168135.js +2 -0
- package/dist/isometrik-webchat/p-ae168135.js.map +1 -0
- package/dist/isometrik-webchat/{p-a6897edc.js → p-b1330793.js} +1 -1
- package/dist/isometrik-webchat/p-b1330793.js.map +1 -0
- package/dist/isometrik-webchat/p-b61d6c0c.entry.js +2 -0
- package/dist/isometrik-webchat/p-b61d6c0c.entry.js.map +1 -0
- package/dist/isometrik-webchat/p-b667a9fc.js +2 -0
- package/dist/isometrik-webchat/p-b667a9fc.js.map +1 -0
- package/dist/isometrik-webchat/p-b857775d.entry.js +2 -0
- package/dist/isometrik-webchat/p-bdcdf1c5.js +2 -0
- package/dist/isometrik-webchat/p-bdcdf1c5.js.map +1 -0
- package/dist/isometrik-webchat/p-c0c19621.entry.js +2 -0
- package/dist/isometrik-webchat/{p-064d6200.entry.js → p-ca47d693.entry.js} +2 -2
- package/dist/isometrik-webchat/p-d720cf14.entry.js +2 -0
- package/dist/isometrik-webchat/{p-53695fc6.entry.js.map → p-d720cf14.entry.js.map} +1 -1
- package/dist/isometrik-webchat/{p-5c22ee37.entry.js → p-d892b4d4.entry.js} +2 -2
- package/dist/isometrik-webchat/{p-7eb12da3.js → p-dd62bd69.js} +2 -2
- package/dist/isometrik-webchat/p-eb54f75d.js +2 -0
- package/dist/isometrik-webchat/p-eb54f75d.js.map +1 -0
- package/dist/isometrik-webchat/p-f1fbf3be.entry.js +2 -0
- package/dist/isometrik-webchat/p-f1fbf3be.entry.js.map +1 -0
- package/dist/isometrik-webchat/p-fb705915.entry.js +2 -0
- package/dist/isometrik-webchat/p-fb705915.entry.js.map +1 -0
- package/dist/isometrik-webchat/{p-2f6bb0a4.entry.js → p-fd6ce589.entry.js} +2 -2
- package/dist/isometrik-webchat/p-fdd327f5.entry.js +2 -0
- package/dist/types/components/ChatUIComponent/Footer/ChatFooter.d.ts +1 -0
- package/dist/types/components/ChatUIComponent/shared/attachment-preview/attachment-preview.d.ts +2 -0
- package/dist/types/components/ChatUIComponent/shared/document-message/document-message.d.ts +5 -0
- package/dist/types/components/ChatUIComponent/shared/image-message/image-message.d.ts +1 -0
- package/dist/types/components/ChatUIComponent/shared/message-bubble/message-bubble.d.ts +3 -0
- package/dist/types/components/ChatUIComponent/shared/outgoing-text-message-bubble/outgoing-text-message-bubble.d.ts +1 -0
- package/dist/types/components/ChatUIComponent/shared/video-message/video-message.d.ts +1 -0
- package/dist/types/components/my-component/web-chat/FLOW.d.ts +1 -1
- package/dist/types/components/my-component/web-chat/mqtt-host.d.ts +5 -0
- package/dist/types/components/my-component/web-chat/offline-host.d.ts +22 -0
- package/dist/types/components/theme-provider.d.ts +22 -27
- package/dist/types/components.d.ts +84 -11
- package/dist/types/demos/custom-ui-demo-elements.d.ts +1 -1
- package/dist/types/global/expose-sdk.d.ts +1 -0
- package/dist/types/index.d.ts +3 -44
- package/dist/types/lib/chat/index.d.ts +3 -0
- package/dist/types/lib/chat/media-limits.d.ts +11 -0
- package/dist/types/lib/chat/media-outbox.d.ts +8 -0
- package/dist/types/lib/chat/preview-kind.d.ts +30 -0
- package/dist/types/lib/custom-ui/contracts.d.ts +1 -1
- package/dist/types/lib/custom-ui/index.d.ts +1 -1
- package/dist/types/lib/custom-ui/public-api.d.ts +1 -1
- package/dist/types/lib/destroy-chat.d.ts +2 -0
- package/dist/types/lib/mqtt/inbound-queue.d.ts +7 -0
- package/dist/types/lib/mqtt/index.d.ts +2 -1
- package/dist/types/lib/mqtt/session.d.ts +22 -0
- package/dist/types/lib/offline/client.d.ts +44 -0
- package/dist/types/lib/offline/idb.d.ts +36 -0
- package/dist/types/lib/offline/index.d.ts +10 -0
- package/dist/types/lib/offline/memory-db.d.ts +20 -0
- package/dist/types/lib/offline/merge.d.ts +3 -0
- package/dist/types/lib/offline/multitab.d.ts +13 -0
- package/dist/types/lib/offline/types.d.ts +63 -0
- package/dist/types/sdk/api.d.ts +3 -0
- package/dist/types/sdk/composition.d.ts +32 -0
- package/dist/types/sdk/headless-api.d.ts +37 -0
- package/dist/types/sdk/index.d.ts +10 -0
- package/dist/types/sdk/init.d.ts +87 -0
- package/dist/types/sdk/instance.d.ts +15 -0
- package/dist/types/sdk/react-bridge.d.ts +64 -0
- package/dist/types/sdk/runtime-controls.d.ts +14 -0
- package/dist/types/sdk/slots.d.ts +15 -0
- package/dist/types/sdk/theme-tokens.d.ts +22 -0
- package/dist/types/sdk/webchat-api.d.ts +22 -0
- package/docs/ARCHITECTURE.md +272 -0
- package/docs/CUSTOMIZATION.md +236 -0
- package/docs/INTEGRATION.md +286 -0
- package/docs/RELIABILITY.md +51 -0
- package/docs/theme-tokens.template.css +72 -0
- package/package.json +8 -2
- package/readme.md +38 -17
- package/dist/cjs/app-globals-3a1e7e63.js +0 -7
- package/dist/cjs/app-globals-3a1e7e63.js.map +0 -1
- package/dist/cjs/chat-creds-cf537d4b.js.map +0 -1
- package/dist/cjs/contracts-31632812.js.map +0 -1
- package/dist/cjs/destroy-chat-be25dec7.js +0 -26
- package/dist/cjs/destroy-chat-be25dec7.js.map +0 -1
- package/dist/cjs/doublecheck-997afc94.js +0 -7
- package/dist/cjs/doublecheck-997afc94.js.map +0 -1
- package/dist/cjs/group-members-73ad1074.js.map +0 -1
- package/dist/cjs/index-1a26d11d.js.map +0 -1
- package/dist/cjs/toast-0bf1e688.js.map +0 -1
- package/dist/components/GroupCast.js.map +0 -1
- package/dist/components/groupcast2.js.map +0 -1
- package/dist/esm/app-globals-0f993ce5.js +0 -5
- package/dist/esm/app-globals-0f993ce5.js.map +0 -1
- package/dist/esm/chat-creds-5d0982fc.js.map +0 -1
- package/dist/esm/contracts-614be4db.js.map +0 -1
- package/dist/esm/destroy-chat-e2ebe165.js +0 -24
- package/dist/esm/destroy-chat-e2ebe165.js.map +0 -1
- package/dist/esm/doublecheck-5e208ef0.js +0 -5
- package/dist/esm/doublecheck-5e208ef0.js.map +0 -1
- package/dist/esm/group-members-806fd7a2.js.map +0 -1
- package/dist/esm/index-beb184c6.js.map +0 -1
- package/dist/esm/toast-d8ea763c.js.map +0 -1
- package/dist/isometrik-webchat/p-01fd0eb4.entry.js +0 -2
- package/dist/isometrik-webchat/p-01fd0eb4.entry.js.map +0 -1
- package/dist/isometrik-webchat/p-0f9c3f95.entry.js +0 -2
- package/dist/isometrik-webchat/p-0f9c3f95.entry.js.map +0 -1
- package/dist/isometrik-webchat/p-1c53e658.js +0 -2
- package/dist/isometrik-webchat/p-1c53e658.js.map +0 -1
- package/dist/isometrik-webchat/p-1df58381.entry.js +0 -2
- package/dist/isometrik-webchat/p-1df58381.entry.js.map +0 -1
- package/dist/isometrik-webchat/p-3c690532.entry.js +0 -2
- package/dist/isometrik-webchat/p-3c690532.entry.js.map +0 -1
- package/dist/isometrik-webchat/p-3c8cbd5f.js +0 -2
- package/dist/isometrik-webchat/p-3c8cbd5f.js.map +0 -1
- package/dist/isometrik-webchat/p-4e762019.js +0 -2
- package/dist/isometrik-webchat/p-4e762019.js.map +0 -1
- package/dist/isometrik-webchat/p-53695fc6.entry.js +0 -2
- package/dist/isometrik-webchat/p-7b80b0b2.js.map +0 -1
- package/dist/isometrik-webchat/p-9924b1bf.entry.js +0 -2
- package/dist/isometrik-webchat/p-a15092d9.entry.js.map +0 -1
- package/dist/isometrik-webchat/p-a6897edc.js.map +0 -1
- package/dist/isometrik-webchat/p-b2bf55b1.entry.js +0 -2
- package/dist/isometrik-webchat/p-bfecfa97.entry.js +0 -2
- package/dist/isometrik-webchat/p-d386acfe.js.map +0 -1
- package/dist/isometrik-webchat/p-e1255160.js +0 -2
- package/dist/isometrik-webchat/p-e1255160.js.map +0 -1
- package/dist/isometrik-webchat/p-f24cdbbb.js.map +0 -1
- /package/dist/isometrik-webchat/{p-5fea3fd2.entry.js.map → p-2d3e8cd4.entry.js.map} +0 -0
- /package/dist/isometrik-webchat/{p-e7f58d3f.entry.js.map → p-39b626ed.entry.js.map} +0 -0
- /package/dist/isometrik-webchat/{p-eb1f3118.entry.js.map → p-3c70c22c.entry.js.map} +0 -0
- /package/dist/isometrik-webchat/{p-5cbc1a16.entry.js.map → p-586f6978.entry.js.map} +0 -0
- /package/dist/isometrik-webchat/{p-5f7eebbf.entry.js.map → p-5d243250.entry.js.map} +0 -0
- /package/dist/isometrik-webchat/{p-23df1c24.js.map → p-5d98a8a0.js.map} +0 -0
- /package/dist/isometrik-webchat/{p-e5884258.js.map → p-9982fa21.js.map} +0 -0
- /package/dist/isometrik-webchat/{p-4db39c93.js.map → p-a5707f12.js.map} +0 -0
- /package/dist/isometrik-webchat/{p-af775c83.entry.js.map → p-a876991d.entry.js.map} +0 -0
- /package/dist/isometrik-webchat/{p-bfecfa97.entry.js.map → p-b857775d.entry.js.map} +0 -0
- /package/dist/isometrik-webchat/{p-9924b1bf.entry.js.map → p-c0c19621.entry.js.map} +0 -0
- /package/dist/isometrik-webchat/{p-064d6200.entry.js.map → p-ca47d693.entry.js.map} +0 -0
- /package/dist/isometrik-webchat/{p-5c22ee37.entry.js.map → p-d892b4d4.entry.js.map} +0 -0
- /package/dist/isometrik-webchat/{p-7eb12da3.js.map → p-dd62bd69.js.map} +0 -0
- /package/dist/isometrik-webchat/{p-2f6bb0a4.entry.js.map → p-fd6ce589.entry.js.map} +0 -0
- /package/dist/isometrik-webchat/{p-b2bf55b1.entry.js.map → p-fdd327f5.entry.js.map} +0 -0
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React → WebChat bridge (no React dependency in this package).
|
|
3
|
+
*
|
|
4
|
+
* Hosts pass their own `createElement` + `createRoot` so the core SDK stays
|
|
5
|
+
* framework-agnostic.
|
|
6
|
+
*
|
|
7
|
+
* 1) Panels (slots): mountReactInSlot → HTMLElement for `slots['profile-rail']`
|
|
8
|
+
* 2) Rows/overlays (customParts): defineReactCustomPart → CE tag for customParts
|
|
9
|
+
*/
|
|
10
|
+
import { createSlotHost } from "./slots";
|
|
11
|
+
const ROOT_KEY = '__isometrikReactBridge';
|
|
12
|
+
function paint(store, react, propsFromHost) {
|
|
13
|
+
store.root.render(react.createElement(store.Component, Object.assign(Object.assign({}, (store.extraProps || {})), propsFromHost)));
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Wrap a React component as a custom element for `customParts`.
|
|
17
|
+
* SDK assigns props (conversation, onSelect, …); we re-render React.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* import { createElement } from 'react';
|
|
21
|
+
* import { createRoot } from 'react-dom/client';
|
|
22
|
+
* defineReactCustomPart('app-chat-tile', MyTile, {
|
|
23
|
+
* react: { createElement },
|
|
24
|
+
* createRoot,
|
|
25
|
+
* propKeys: ['conversation', 'isSelected', 'unreadCount', 'previewText', 'onSelect'],
|
|
26
|
+
* });
|
|
27
|
+
* initializeIsometrikWebchat({ customParts: { chatTile: 'app-chat-tile' }, … });
|
|
28
|
+
*/
|
|
29
|
+
export function defineReactCustomPart(tag, Component, opts) {
|
|
30
|
+
if (typeof customElements === 'undefined')
|
|
31
|
+
return tag;
|
|
32
|
+
if (customElements.get(tag))
|
|
33
|
+
return tag;
|
|
34
|
+
const { react, createRoot, propKeys, extraProps } = opts;
|
|
35
|
+
class ReactPart extends HTMLElement {
|
|
36
|
+
constructor() {
|
|
37
|
+
super(...arguments);
|
|
38
|
+
this._store = null;
|
|
39
|
+
}
|
|
40
|
+
connectedCallback() {
|
|
41
|
+
if (!this._store) {
|
|
42
|
+
this._store = { root: createRoot(this), Component, extraProps };
|
|
43
|
+
}
|
|
44
|
+
this.render();
|
|
45
|
+
}
|
|
46
|
+
disconnectedCallback() {
|
|
47
|
+
var _a;
|
|
48
|
+
try {
|
|
49
|
+
(_a = this._store) === null || _a === void 0 ? void 0 : _a.root.unmount();
|
|
50
|
+
}
|
|
51
|
+
catch (_b) {
|
|
52
|
+
/* unmount is best-effort */
|
|
53
|
+
}
|
|
54
|
+
this._store = null;
|
|
55
|
+
}
|
|
56
|
+
/** Called by applyCustomPartProps after Object.assign. */
|
|
57
|
+
render() {
|
|
58
|
+
if (!this._store || !this.isConnected)
|
|
59
|
+
return;
|
|
60
|
+
const fromSetters = {};
|
|
61
|
+
propKeys.forEach(key => {
|
|
62
|
+
fromSetters[key] = this[`_${key}`];
|
|
63
|
+
});
|
|
64
|
+
paint(this._store, react, fromSetters);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
propKeys.forEach(key => {
|
|
68
|
+
const store = `_${key}`;
|
|
69
|
+
Object.defineProperty(ReactPart.prototype, key, {
|
|
70
|
+
get() {
|
|
71
|
+
return this[store];
|
|
72
|
+
},
|
|
73
|
+
set(value) {
|
|
74
|
+
if (this[store] === value)
|
|
75
|
+
return;
|
|
76
|
+
this[store] = value;
|
|
77
|
+
if (this.isConnected)
|
|
78
|
+
this.render();
|
|
79
|
+
},
|
|
80
|
+
configurable: true,
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
customElements.define(tag, ReactPart);
|
|
84
|
+
return tag;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Mount a React component into a slot host for panel overrides.
|
|
88
|
+
* Pass the returned element in `slots: { 'profile-rail': el }`.
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* const rail = mountReactInSlot('profile-rail', MyProfileRail, {
|
|
92
|
+
* react: { createElement },
|
|
93
|
+
* createRoot,
|
|
94
|
+
* props: { userId: '…' },
|
|
95
|
+
* });
|
|
96
|
+
* initializeIsometrikWebchat({ slots: { 'profile-rail': rail }, … });
|
|
97
|
+
* // later: rail.updateProps({ badge: 3 }); rail.unmount();
|
|
98
|
+
*/
|
|
99
|
+
export function mountReactInSlot(slotName, Component, opts) {
|
|
100
|
+
const host = createSlotHost(slotName, opts.className);
|
|
101
|
+
// display:contents can break React roots — use block for React mounts.
|
|
102
|
+
host.style.display = 'block';
|
|
103
|
+
host.style.height = '100%';
|
|
104
|
+
const store = {
|
|
105
|
+
root: opts.createRoot(host),
|
|
106
|
+
Component,
|
|
107
|
+
extraProps: opts.props,
|
|
108
|
+
};
|
|
109
|
+
host[ROOT_KEY] = store;
|
|
110
|
+
paint(store, opts.react, {});
|
|
111
|
+
host.updateProps = (next) => {
|
|
112
|
+
store.extraProps = Object.assign(Object.assign({}, (store.extraProps || {})), next);
|
|
113
|
+
paint(store, opts.react, {});
|
|
114
|
+
};
|
|
115
|
+
host.unmount = () => {
|
|
116
|
+
try {
|
|
117
|
+
store.root.unmount();
|
|
118
|
+
}
|
|
119
|
+
catch (_a) {
|
|
120
|
+
/* ignore */
|
|
121
|
+
}
|
|
122
|
+
delete host[ROOT_KEY];
|
|
123
|
+
};
|
|
124
|
+
return host;
|
|
125
|
+
}
|
|
126
|
+
export function unmountReactSlot(host) {
|
|
127
|
+
if (!host)
|
|
128
|
+
return;
|
|
129
|
+
const anyHost = host;
|
|
130
|
+
if (typeof anyHost.unmount === 'function') {
|
|
131
|
+
anyHost.unmount();
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
const store = host[ROOT_KEY];
|
|
135
|
+
if (!store)
|
|
136
|
+
return;
|
|
137
|
+
try {
|
|
138
|
+
store.root.unmount();
|
|
139
|
+
}
|
|
140
|
+
catch (_a) {
|
|
141
|
+
/* ignore */
|
|
142
|
+
}
|
|
143
|
+
delete host[ROOT_KEY];
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=react-bridge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-bridge.js","sourceRoot":"","sources":["../../src/sdk/react-bridge.ts"],"names":[],"mappings":"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","sourcesContent":["/**\n * React → WebChat bridge (no React dependency in this package).\n *\n * Hosts pass their own `createElement` + `createRoot` so the core SDK stays\n * framework-agnostic.\n *\n * 1) Panels (slots): mountReactInSlot → HTMLElement for `slots['profile-rail']`\n * 2) Rows/overlays (customParts): defineReactCustomPart → CE tag for customParts\n */\n\nimport type { WebChatSlotName } from '../lib/custom-ui';\nimport { createSlotHost } from './slots';\n\nexport type ReactLike = {\n createElement: (type: any, props: any, ...children: any[]) => any;\n};\n\nexport type ReactRootLike = {\n render: (node: any) => void;\n unmount: () => void;\n};\n\nexport type CreateRootLike = (container: Element) => ReactRootLike;\n\ntype BridgeRootStore = {\n root: ReactRootLike;\n Component: any;\n extraProps?: Record<string, unknown>;\n};\n\nconst ROOT_KEY = '__isometrikReactBridge';\n\nfunction paint(store: BridgeRootStore, react: ReactLike, propsFromHost: Record<string, unknown>) {\n store.root.render(\n react.createElement(store.Component, {\n ...(store.extraProps || {}),\n ...propsFromHost,\n }),\n );\n}\n\n/**\n * Wrap a React component as a custom element for `customParts`.\n * SDK assigns props (conversation, onSelect, …); we re-render React.\n *\n * @example\n * import { createElement } from 'react';\n * import { createRoot } from 'react-dom/client';\n * defineReactCustomPart('app-chat-tile', MyTile, {\n * react: { createElement },\n * createRoot,\n * propKeys: ['conversation', 'isSelected', 'unreadCount', 'previewText', 'onSelect'],\n * });\n * initializeIsometrikWebchat({ customParts: { chatTile: 'app-chat-tile' }, … });\n */\nexport function defineReactCustomPart(\n tag: string,\n Component: any,\n opts: {\n react: ReactLike;\n createRoot: CreateRootLike;\n /** Prop names the SDK writes on the CE (see lib/custom-ui/contracts.ts). */\n propKeys: string[];\n /** Static props merged into every render. */\n extraProps?: Record<string, unknown>;\n },\n): string {\n if (typeof customElements === 'undefined') return tag;\n if (customElements.get(tag)) return tag;\n\n const { react, createRoot, propKeys, extraProps } = opts;\n\n class ReactPart extends HTMLElement {\n private _store: BridgeRootStore | null = null;\n\n connectedCallback() {\n if (!this._store) {\n this._store = { root: createRoot(this), Component, extraProps };\n }\n this.render();\n }\n\n disconnectedCallback() {\n try {\n this._store?.root.unmount();\n } catch {\n /* unmount is best-effort */\n }\n this._store = null;\n }\n\n /** Called by applyCustomPartProps after Object.assign. */\n render() {\n if (!this._store || !this.isConnected) return;\n const fromSetters: Record<string, unknown> = {};\n propKeys.forEach(key => {\n fromSetters[key] = (this as any)[`_${key}`];\n });\n paint(this._store, react, fromSetters);\n }\n }\n\n propKeys.forEach(key => {\n const store = `_${key}`;\n Object.defineProperty(ReactPart.prototype, key, {\n get() {\n return (this as any)[store];\n },\n set(value) {\n if ((this as any)[store] === value) return;\n (this as any)[store] = value;\n if (this.isConnected) (this as HTMLElement & { render: () => void }).render();\n },\n configurable: true,\n });\n });\n\n customElements.define(tag, ReactPart);\n return tag;\n}\n\nexport type ReactSlotHost = HTMLElement & {\n updateProps: (props: Record<string, unknown>) => void;\n unmount: () => void;\n};\n\n/**\n * Mount a React component into a slot host for panel overrides.\n * Pass the returned element in `slots: { 'profile-rail': el }`.\n *\n * @example\n * const rail = mountReactInSlot('profile-rail', MyProfileRail, {\n * react: { createElement },\n * createRoot,\n * props: { userId: '…' },\n * });\n * initializeIsometrikWebchat({ slots: { 'profile-rail': rail }, … });\n * // later: rail.updateProps({ badge: 3 }); rail.unmount();\n */\nexport function mountReactInSlot(\n slotName: WebChatSlotName,\n Component: any,\n opts: {\n react: ReactLike;\n createRoot: CreateRootLike;\n props?: Record<string, unknown>;\n className?: string;\n },\n): ReactSlotHost {\n const host = createSlotHost(slotName, opts.className) as ReactSlotHost;\n // display:contents can break React roots — use block for React mounts.\n host.style.display = 'block';\n host.style.height = '100%';\n\n const store: BridgeRootStore = {\n root: opts.createRoot(host),\n Component,\n extraProps: opts.props,\n };\n (host as any)[ROOT_KEY] = store;\n paint(store, opts.react, {});\n\n host.updateProps = (next: Record<string, unknown>) => {\n store.extraProps = { ...(store.extraProps || {}), ...next };\n paint(store, opts.react, {});\n };\n host.unmount = () => {\n try {\n store.root.unmount();\n } catch {\n /* ignore */\n }\n delete (host as any)[ROOT_KEY];\n };\n return host;\n}\n\nexport function unmountReactSlot(host: HTMLElement | null | undefined): void {\n if (!host) return;\n const anyHost = host as ReactSlotHost;\n if (typeof anyHost.unmount === 'function') {\n anyHost.unmount();\n return;\n }\n const store = (host as any)[ROOT_KEY] as BridgeRootStore | undefined;\n if (!store) return;\n try {\n store.root.unmount();\n } catch {\n /* ignore */\n }\n delete (host as any)[ROOT_KEY];\n}\n"]}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Theme / sidebar controls — instance-first (no bare querySelector in happy path).
|
|
3
|
+
*/
|
|
4
|
+
import { normalizeThemeObject } from "./theme-tokens";
|
|
5
|
+
import { resolveThemeProvider, resolveWebChat } from "./instance";
|
|
6
|
+
export function customChatSidebar(props, from) {
|
|
7
|
+
const chatComponent = resolveWebChat(from);
|
|
8
|
+
if (!chatComponent) {
|
|
9
|
+
console.error('Isometrik chat is not initialized');
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
if (props.isChatFilter !== undefined) {
|
|
13
|
+
chatComponent.isChatFilter = props.isChatFilter;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export function switchChatTheme(theme, from) {
|
|
17
|
+
const themeProvider = resolveThemeProvider(from);
|
|
18
|
+
const chat = resolveWebChat(from);
|
|
19
|
+
if (chat) {
|
|
20
|
+
chat.defaultTheme = theme;
|
|
21
|
+
}
|
|
22
|
+
if (themeProvider) {
|
|
23
|
+
themeProvider.setAttribute('mode', theme);
|
|
24
|
+
if (typeof themeProvider.setTheme === 'function') {
|
|
25
|
+
themeProvider.setTheme(theme);
|
|
26
|
+
}
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
console.error('Theme provider is not initialized');
|
|
30
|
+
}
|
|
31
|
+
export function applyCustomTheme(customTheme, from) {
|
|
32
|
+
const themeProvider = resolveThemeProvider(from);
|
|
33
|
+
if (!themeProvider) {
|
|
34
|
+
console.error('Theme provider is not initialized');
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (customTheme.themePath) {
|
|
38
|
+
themeProvider.setAttribute('theme-path', customTheme.themePath);
|
|
39
|
+
}
|
|
40
|
+
if (customTheme.themeObject) {
|
|
41
|
+
themeProvider.themeObject = normalizeThemeObject(customTheme.themeObject);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
export function toggleTheme(from) {
|
|
45
|
+
const themeProvider = resolveThemeProvider(from);
|
|
46
|
+
if (!themeProvider) {
|
|
47
|
+
console.error('Theme provider is not initialized');
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
if (typeof themeProvider.toggleTheme === 'function') {
|
|
51
|
+
themeProvider.toggleTheme();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=runtime-controls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-controls.js","sourceRoot":"","sources":["../../src/sdk/runtime-controls.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAElE,MAAM,UAAU,iBAAiB,CAC/B,KAAiC,EACjC,IAAqB;IAErB,MAAM,aAAa,GAAG,cAAc,CAAC,IAAI,CAAQ,CAAC;IAClD,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,OAAO,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACnD,OAAO;IACT,CAAC;IACD,IAAI,KAAK,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;QACrC,aAAa,CAAC,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;IAClD,CAAC;AACH,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,KAAuB,EAAE,IAAqB;IAC5E,MAAM,aAAa,GAAG,oBAAoB,CAAC,IAAI,CAAQ,CAAC;IACxD,MAAM,IAAI,GAAG,cAAc,CAAC,IAAI,CAAQ,CAAC;IAEzC,IAAI,IAAI,EAAE,CAAC;QACT,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;IAC5B,CAAC;IACD,IAAI,aAAa,EAAE,CAAC;QAClB,aAAa,CAAC,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QAC1C,IAAI,OAAO,aAAa,CAAC,QAAQ,KAAK,UAAU,EAAE,CAAC;YACjD,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAChC,CAAC;QACD,OAAO;IACT,CAAC;IACD,OAAO,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC;AACrD,CAAC;AAED,MAAM,UAAU,gBAAgB,CAC9B,WAGC,EACD,IAAqB;IAErB,MAAM,aAAa,GAAG,oBAAoB,CAAC,IAAI,CAAQ,CAAC;IACxD,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,OAAO,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACnD,OAAO;IACT,CAAC;IAED,IAAI,WAAW,CAAC,SAAS,EAAE,CAAC;QAC1B,aAAa,CAAC,YAAY,CAAC,YAAY,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;IAClE,CAAC;IAED,IAAI,WAAW,CAAC,WAAW,EAAE,CAAC;QAC5B,aAAa,CAAC,WAAW,GAAG,oBAAoB,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IAC5E,CAAC;AACH,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,IAAqB;IAC/C,MAAM,aAAa,GAAG,oBAAoB,CAAC,IAAI,CAAQ,CAAC;IACxD,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,OAAO,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACnD,OAAO;IACT,CAAC;IACD,IAAI,OAAO,aAAa,CAAC,WAAW,KAAK,UAAU,EAAE,CAAC;QACpD,aAAa,CAAC,WAAW,EAAE,CAAC;IAC9B,CAAC;AACH,CAAC","sourcesContent":["/**\n * Theme / sidebar controls — instance-first (no bare querySelector in happy path).\n */\n\nimport { normalizeThemeObject } from './theme-tokens';\nimport { resolveThemeProvider, resolveWebChat } from './instance';\n\nexport function customChatSidebar(\n props: { isChatFilter?: boolean },\n from?: Element | null,\n): void {\n const chatComponent = resolveWebChat(from) as any;\n if (!chatComponent) {\n console.error('Isometrik chat is not initialized');\n return;\n }\n if (props.isChatFilter !== undefined) {\n chatComponent.isChatFilter = props.isChatFilter;\n }\n}\n\nexport function switchChatTheme(theme: 'dark' | 'light', from?: Element | null): void {\n const themeProvider = resolveThemeProvider(from) as any;\n const chat = resolveWebChat(from) as any;\n\n if (chat) {\n chat.defaultTheme = theme;\n }\n if (themeProvider) {\n themeProvider.setAttribute('mode', theme);\n if (typeof themeProvider.setTheme === 'function') {\n themeProvider.setTheme(theme);\n }\n return;\n }\n console.error('Theme provider is not initialized');\n}\n\nexport function applyCustomTheme(\n customTheme: {\n themePath?: string;\n themeObject?: { [key: string]: string };\n },\n from?: Element | null,\n): void {\n const themeProvider = resolveThemeProvider(from) as any;\n if (!themeProvider) {\n console.error('Theme provider is not initialized');\n return;\n }\n\n if (customTheme.themePath) {\n themeProvider.setAttribute('theme-path', customTheme.themePath);\n }\n\n if (customTheme.themeObject) {\n themeProvider.themeObject = normalizeThemeObject(customTheme.themeObject);\n }\n}\n\nexport function toggleTheme(from?: Element | null): void {\n const themeProvider = resolveThemeProvider(from) as any;\n if (!themeProvider) {\n console.error('Theme provider is not initialized');\n return;\n }\n if (typeof themeProvider.toggleTheme === 'function') {\n themeProvider.toggleTheme();\n }\n}\n"]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework-agnostic slot helpers.
|
|
3
|
+
* React / Angular / Vue / vanilla all end up calling these with real HTMLElements.
|
|
4
|
+
*
|
|
5
|
+
* Note: avoid `instanceof HTMLElement` — it fails across jsdom realms in Jest.
|
|
6
|
+
*/
|
|
7
|
+
function isElement(node) {
|
|
8
|
+
return !!node && node.nodeType === 1;
|
|
9
|
+
}
|
|
10
|
+
function slotNameOf(el) {
|
|
11
|
+
return el.getAttribute('slot') || el.slot || null;
|
|
12
|
+
}
|
|
13
|
+
/** Attach (or replace) a named slot on <web-chat>. */
|
|
14
|
+
export function setWebChatSlot(chatComponent, slotName, element) {
|
|
15
|
+
if (!chatComponent || !element)
|
|
16
|
+
return null;
|
|
17
|
+
clearWebChatSlot(chatComponent, slotName);
|
|
18
|
+
element.slot = slotName;
|
|
19
|
+
element.setAttribute('slot', slotName);
|
|
20
|
+
chatComponent.appendChild(element);
|
|
21
|
+
return element;
|
|
22
|
+
}
|
|
23
|
+
/** Remove host content for a named slot. */
|
|
24
|
+
export function clearWebChatSlot(chatComponent, slotName) {
|
|
25
|
+
if (!chatComponent)
|
|
26
|
+
return;
|
|
27
|
+
Array.from(chatComponent.children).forEach(node => {
|
|
28
|
+
if (!isElement(node))
|
|
29
|
+
return;
|
|
30
|
+
if (slotNameOf(node) === slotName) {
|
|
31
|
+
node.remove();
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/** Create a plain wrapper element ready to receive framework content (e.g. React portal target). */
|
|
36
|
+
export function createSlotHost(slotName, className) {
|
|
37
|
+
const el = document.createElement('div');
|
|
38
|
+
el.slot = slotName;
|
|
39
|
+
el.setAttribute('slot', slotName);
|
|
40
|
+
el.setAttribute('data-isometrik-slot', slotName);
|
|
41
|
+
if (className)
|
|
42
|
+
el.className = className;
|
|
43
|
+
el.style.height = '100%';
|
|
44
|
+
el.style.width = '100%';
|
|
45
|
+
el.style.display = 'contents';
|
|
46
|
+
return el;
|
|
47
|
+
}
|
|
48
|
+
/** Attach many slots at once (same shape as initialize props.slots). */
|
|
49
|
+
export function setWebChatSlots(chatComponent, slots) {
|
|
50
|
+
if (!chatComponent || !slots)
|
|
51
|
+
return;
|
|
52
|
+
Object.entries(slots).forEach(([name, el]) => {
|
|
53
|
+
if (el)
|
|
54
|
+
setWebChatSlot(chatComponent, name, el);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=slots.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slots.js","sourceRoot":"","sources":["../../src/sdk/slots.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,SAAS,SAAS,CAAC,IAAkC;IACnD,OAAO,CAAC,CAAC,IAAI,IAAI,IAAI,CAAC,QAAQ,KAAK,CAAC,CAAC;AACvC,CAAC;AAED,SAAS,UAAU,CAAC,EAAe;IACjC,OAAO,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,IAAI,IAAI,IAAI,CAAC;AACpD,CAAC;AAED,sDAAsD;AACtD,MAAM,UAAU,cAAc,CAC5B,aAA6C,EAC7C,QAAyB,EACzB,OAAoB;IAEpB,IAAI,CAAC,aAAa,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAC5C,gBAAgB,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;IAC1C,OAAO,CAAC,IAAI,GAAG,QAAQ,CAAC;IACxB,OAAO,CAAC,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACvC,aAAa,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IACnC,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,4CAA4C;AAC5C,MAAM,UAAU,gBAAgB,CAC9B,aAA6C,EAC7C,QAAyB;IAEzB,IAAI,CAAC,aAAa;QAAE,OAAO;IAC3B,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QAChD,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;YAAE,OAAO;QAC7B,IAAI,UAAU,CAAC,IAAI,CAAC,KAAK,QAAQ,EAAE,CAAC;YAClC,IAAI,CAAC,MAAM,EAAE,CAAC;QAChB,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED,oGAAoG;AACpG,MAAM,UAAU,cAAc,CAAC,QAAyB,EAAE,SAAkB;IAC1E,MAAM,EAAE,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IACzC,EAAE,CAAC,IAAI,GAAG,QAAQ,CAAC;IACnB,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAClC,EAAE,CAAC,YAAY,CAAC,qBAAqB,EAAE,QAAQ,CAAC,CAAC;IACjD,IAAI,SAAS;QAAE,EAAE,CAAC,SAAS,GAAG,SAAS,CAAC;IACxC,EAAE,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,EAAE,CAAC,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC;IACxB,EAAE,CAAC,KAAK,CAAC,OAAO,GAAG,UAAU,CAAC;IAC9B,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,eAAe,CAC7B,aAA6C,EAC7C,KAAqD;IAErD,IAAI,CAAC,aAAa,IAAI,CAAC,KAAK;QAAE,OAAO;IACpC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAkD,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,EAAE;QAC7F,IAAI,EAAE;YAAE,cAAc,CAAC,aAAa,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["/**\n * Framework-agnostic slot helpers.\n * React / Angular / Vue / vanilla all end up calling these with real HTMLElements.\n *\n * Note: avoid `instanceof HTMLElement` — it fails across jsdom realms in Jest.\n */\n\nimport type { WebChatSlotName } from '../lib/custom-ui';\n\nfunction isElement(node: ChildNode | null | undefined): node is HTMLElement {\n return !!node && node.nodeType === 1;\n}\n\nfunction slotNameOf(el: HTMLElement): string | null {\n return el.getAttribute('slot') || el.slot || null;\n}\n\n/** Attach (or replace) a named slot on <web-chat>. */\nexport function setWebChatSlot(\n chatComponent: HTMLElement | null | undefined,\n slotName: WebChatSlotName,\n element: HTMLElement,\n): HTMLElement | null {\n if (!chatComponent || !element) return null;\n clearWebChatSlot(chatComponent, slotName);\n element.slot = slotName;\n element.setAttribute('slot', slotName);\n chatComponent.appendChild(element);\n return element;\n}\n\n/** Remove host content for a named slot. */\nexport function clearWebChatSlot(\n chatComponent: HTMLElement | null | undefined,\n slotName: WebChatSlotName,\n): void {\n if (!chatComponent) return;\n Array.from(chatComponent.children).forEach(node => {\n if (!isElement(node)) return;\n if (slotNameOf(node) === slotName) {\n node.remove();\n }\n });\n}\n\n/** Create a plain wrapper element ready to receive framework content (e.g. React portal target). */\nexport function createSlotHost(slotName: WebChatSlotName, className?: string): HTMLElement {\n const el = document.createElement('div');\n el.slot = slotName;\n el.setAttribute('slot', slotName);\n el.setAttribute('data-isometrik-slot', slotName);\n if (className) el.className = className;\n el.style.height = '100%';\n el.style.width = '100%';\n el.style.display = 'contents';\n return el;\n}\n\n/** Attach many slots at once (same shape as initialize props.slots). */\nexport function setWebChatSlots(\n chatComponent: HTMLElement | null | undefined,\n slots?: Partial<Record<WebChatSlotName, HTMLElement>>,\n): void {\n if (!chatComponent || !slots) return;\n (Object.entries(slots) as [WebChatSlotName, HTMLElement | undefined][]).forEach(([name, el]) => {\n if (el) setWebChatSlot(chatComponent, name, el);\n });\n}\n"]}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public theme token catalog for host apps.
|
|
3
|
+
* Pass values via initializeIsometrikWebchat({ theme: { ... } }) or a CSS file (themeUrl).
|
|
4
|
+
*
|
|
5
|
+
* Apply order: package defaults → themeUrl stylesheet → theme object (wins).
|
|
6
|
+
*
|
|
7
|
+
* Legacy aliases (*-color) still appear in older UI; set both when overriding colors
|
|
8
|
+
* if you need full coverage until those call sites are normalized.
|
|
9
|
+
*/
|
|
10
|
+
export const THEME_TOKEN_NAMES = [
|
|
11
|
+
// Typography
|
|
12
|
+
'--font-primary',
|
|
13
|
+
'--text-2',
|
|
14
|
+
'--text-4',
|
|
15
|
+
'--text-6',
|
|
16
|
+
'--text-8',
|
|
17
|
+
'--text-10',
|
|
18
|
+
'--text-12',
|
|
19
|
+
'--text-14',
|
|
20
|
+
'--text-16',
|
|
21
|
+
'--text-18',
|
|
22
|
+
'--text-20',
|
|
23
|
+
'--text-22',
|
|
24
|
+
'--text-24',
|
|
25
|
+
'--fw-400',
|
|
26
|
+
'--fw-500',
|
|
27
|
+
'--fw-600',
|
|
28
|
+
'--fw-700',
|
|
29
|
+
// Surfaces
|
|
30
|
+
'--bg-primary',
|
|
31
|
+
'--bg-secondary',
|
|
32
|
+
'--bg-tertiary',
|
|
33
|
+
'--bg-input',
|
|
34
|
+
'--bg-row-hover',
|
|
35
|
+
// Text
|
|
36
|
+
'--text-primary',
|
|
37
|
+
'--text-secondary',
|
|
38
|
+
'--text-tertiary',
|
|
39
|
+
'--text-on-brand',
|
|
40
|
+
// Brand
|
|
41
|
+
'--brand',
|
|
42
|
+
'--brand-soft',
|
|
43
|
+
'--brand-muted',
|
|
44
|
+
// Borders / status / chrome
|
|
45
|
+
'--border',
|
|
46
|
+
'--border-subtle',
|
|
47
|
+
'--success',
|
|
48
|
+
'--danger',
|
|
49
|
+
'--hover-overlay',
|
|
50
|
+
'--overlay',
|
|
51
|
+
'--focus-ring',
|
|
52
|
+
'--icon',
|
|
53
|
+
'--svg-icon-filter',
|
|
54
|
+
// Layout helpers hosts sometimes tweak
|
|
55
|
+
'--rail-width',
|
|
56
|
+
'--control',
|
|
57
|
+
'--avatar',
|
|
58
|
+
'--rounded-8',
|
|
59
|
+
'--rounded-12',
|
|
60
|
+
'--rounded-full',
|
|
61
|
+
// Legacy aliases still referenced by some components
|
|
62
|
+
'--bg-primary-color',
|
|
63
|
+
'--bg-secondary-color',
|
|
64
|
+
'--bg-primary-light',
|
|
65
|
+
'--text-primary-color',
|
|
66
|
+
'--text-secondary-color',
|
|
67
|
+
'--text-tertiary-color',
|
|
68
|
+
'--text-success-color',
|
|
69
|
+
'--text-danger-color',
|
|
70
|
+
'--text-warning-color',
|
|
71
|
+
'--text-info-color',
|
|
72
|
+
'--text-last-seen',
|
|
73
|
+
];
|
|
74
|
+
/** Map short keys → canonical CSS vars (hosts may omit the leading --). */
|
|
75
|
+
export function normalizeThemeObject(input) {
|
|
76
|
+
if (!input)
|
|
77
|
+
return {};
|
|
78
|
+
const out = {};
|
|
79
|
+
for (const [rawKey, value] of Object.entries(input)) {
|
|
80
|
+
if (value == null || value === '')
|
|
81
|
+
continue;
|
|
82
|
+
const key = rawKey.startsWith('--') ? rawKey : `--${rawKey}`;
|
|
83
|
+
out[key] = value;
|
|
84
|
+
}
|
|
85
|
+
return out;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Apply theme object as inline CSS variables on a host element.
|
|
89
|
+
* Scoped to the chat root so multiple embeds don't fight over <html>.
|
|
90
|
+
*/
|
|
91
|
+
export function applyThemeObjectToElement(el, theme) {
|
|
92
|
+
if (!el || !theme)
|
|
93
|
+
return;
|
|
94
|
+
const normalized = normalizeThemeObject(theme);
|
|
95
|
+
for (const [key, value] of Object.entries(normalized)) {
|
|
96
|
+
el.style.setProperty(key, value);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=theme-tokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme-tokens.js","sourceRoot":"","sources":["../../src/sdk/theme-tokens.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,aAAa;IACb,gBAAgB;IAChB,UAAU;IACV,UAAU;IACV,UAAU;IACV,UAAU;IACV,WAAW;IACX,WAAW;IACX,WAAW;IACX,WAAW;IACX,WAAW;IACX,WAAW;IACX,WAAW;IACX,WAAW;IACX,UAAU;IACV,UAAU;IACV,UAAU;IACV,UAAU;IAEV,WAAW;IACX,cAAc;IACd,gBAAgB;IAChB,eAAe;IACf,YAAY;IACZ,gBAAgB;IAEhB,OAAO;IACP,gBAAgB;IAChB,kBAAkB;IAClB,iBAAiB;IACjB,iBAAiB;IAEjB,QAAQ;IACR,SAAS;IACT,cAAc;IACd,eAAe;IAEf,4BAA4B;IAC5B,UAAU;IACV,iBAAiB;IACjB,WAAW;IACX,UAAU;IACV,iBAAiB;IACjB,WAAW;IACX,cAAc;IACd,QAAQ;IACR,mBAAmB;IAEnB,uCAAuC;IACvC,cAAc;IACd,WAAW;IACX,UAAU;IACV,aAAa;IACb,cAAc;IACd,gBAAgB;IAEhB,qDAAqD;IACrD,oBAAoB;IACpB,sBAAsB;IACtB,oBAAoB;IACpB,sBAAsB;IACtB,wBAAwB;IACxB,uBAAuB;IACvB,sBAAsB;IACtB,qBAAqB;IACrB,sBAAsB;IACtB,mBAAmB;IACnB,kBAAkB;CACV,CAAC;AASX,2EAA2E;AAC3E,MAAM,UAAU,oBAAoB,CAAC,KAAqC;IACxE,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,CAAC;IACtB,MAAM,GAAG,GAA2B,EAAE,CAAC;IACvC,KAAK,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACpD,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,KAAK,EAAE;YAAE,SAAS;QAC5C,MAAM,GAAG,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,MAAM,EAAE,CAAC;QAC7D,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IACnB,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CACvC,EAAkC,EAClC,KAAqC;IAErC,IAAI,CAAC,EAAE,IAAI,CAAC,KAAK;QAAE,OAAO;IAC1B,MAAM,UAAU,GAAG,oBAAoB,CAAC,KAAK,CAAC,CAAC;IAC/C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;QACtD,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACnC,CAAC;AACH,CAAC","sourcesContent":["/**\n * Public theme token catalog for host apps.\n * Pass values via initializeIsometrikWebchat({ theme: { ... } }) or a CSS file (themeUrl).\n *\n * Apply order: package defaults → themeUrl stylesheet → theme object (wins).\n *\n * Legacy aliases (*-color) still appear in older UI; set both when overriding colors\n * if you need full coverage until those call sites are normalized.\n */\n\nexport const THEME_TOKEN_NAMES = [\n // Typography\n '--font-primary',\n '--text-2',\n '--text-4',\n '--text-6',\n '--text-8',\n '--text-10',\n '--text-12',\n '--text-14',\n '--text-16',\n '--text-18',\n '--text-20',\n '--text-22',\n '--text-24',\n '--fw-400',\n '--fw-500',\n '--fw-600',\n '--fw-700',\n\n // Surfaces\n '--bg-primary',\n '--bg-secondary',\n '--bg-tertiary',\n '--bg-input',\n '--bg-row-hover',\n\n // Text\n '--text-primary',\n '--text-secondary',\n '--text-tertiary',\n '--text-on-brand',\n\n // Brand\n '--brand',\n '--brand-soft',\n '--brand-muted',\n\n // Borders / status / chrome\n '--border',\n '--border-subtle',\n '--success',\n '--danger',\n '--hover-overlay',\n '--overlay',\n '--focus-ring',\n '--icon',\n '--svg-icon-filter',\n\n // Layout helpers hosts sometimes tweak\n '--rail-width',\n '--control',\n '--avatar',\n '--rounded-8',\n '--rounded-12',\n '--rounded-full',\n\n // Legacy aliases still referenced by some components\n '--bg-primary-color',\n '--bg-secondary-color',\n '--bg-primary-light',\n '--text-primary-color',\n '--text-secondary-color',\n '--text-tertiary-color',\n '--text-success-color',\n '--text-danger-color',\n '--text-warning-color',\n '--text-info-color',\n '--text-last-seen',\n] as const;\n\nexport type ThemeTokenName = (typeof THEME_TOKEN_NAMES)[number];\n\n/** Host-provided overrides. Keys should be CSS custom property names (with leading --). */\nexport type ThemeTokenMap = Partial<Record<ThemeTokenName, string>> & {\n [cssVar: `--${string}`]: string | undefined;\n};\n\n/** Map short keys → canonical CSS vars (hosts may omit the leading --). */\nexport function normalizeThemeObject(input?: Record<string, string> | null): Record<string, string> {\n if (!input) return {};\n const out: Record<string, string> = {};\n for (const [rawKey, value] of Object.entries(input)) {\n if (value == null || value === '') continue;\n const key = rawKey.startsWith('--') ? rawKey : `--${rawKey}`;\n out[key] = value;\n }\n return out;\n}\n\n/**\n * Apply theme object as inline CSS variables on a host element.\n * Scoped to the chat root so multiple embeds don't fight over <html>.\n */\nexport function applyThemeObjectToElement(\n el: HTMLElement | null | undefined,\n theme?: Record<string, string> | null,\n): void {\n if (!el || !theme) return;\n const normalized = normalizeThemeObject(theme);\n for (const [key, value] of Object.entries(normalized)) {\n el.style.setProperty(key, value);\n }\n}\n"]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bound actions/events for a live <web-chat> instance.
|
|
3
|
+
* No REST imports — safe for unit tests without ChatSDK.
|
|
4
|
+
*/
|
|
5
|
+
import { WEB_CHAT_PUBLIC_EVENTS, WEB_CHAT_PUBLIC_METHODS } from "../lib/custom-ui";
|
|
6
|
+
function callMethod(el, name, ...args) {
|
|
7
|
+
const fn = el === null || el === void 0 ? void 0 : el[name];
|
|
8
|
+
if (typeof fn !== 'function') {
|
|
9
|
+
return Promise.reject(new Error(`[isometrik-webchat] method "${name}" is not available`));
|
|
10
|
+
}
|
|
11
|
+
return Promise.resolve(fn.apply(el, args));
|
|
12
|
+
}
|
|
13
|
+
/** Bind public methods/events to a mounted <web-chat> element. */
|
|
14
|
+
export function createWebChatApi(chatComponent) {
|
|
15
|
+
if (!chatComponent)
|
|
16
|
+
return null;
|
|
17
|
+
const el = chatComponent;
|
|
18
|
+
return {
|
|
19
|
+
selectConversation: id => callMethod(el, 'selectConversation', id),
|
|
20
|
+
sendText: (body, conversationId) => callMethod(el, 'sendText', body, conversationId),
|
|
21
|
+
sendMedia: (files, conversationId, caption) => callMethod(el, 'sendMedia', files, conversationId, caption),
|
|
22
|
+
setReply: message => callMethod(el, 'setReply', message),
|
|
23
|
+
clearReply: () => callMethod(el, 'clearReply'),
|
|
24
|
+
loadMoreMessages: () => callMethod(el, 'loadMoreMessages'),
|
|
25
|
+
loadMoreConversations: () => callMethod(el, 'loadMoreConversations'),
|
|
26
|
+
getChatState: () => callMethod(el, 'getChatState'),
|
|
27
|
+
setCustomParts: parts => callMethod(el, 'setCustomParts', parts),
|
|
28
|
+
on(event, handler) {
|
|
29
|
+
el.addEventListener(event, handler);
|
|
30
|
+
return () => el.removeEventListener(event, handler);
|
|
31
|
+
},
|
|
32
|
+
methods: WEB_CHAT_PUBLIC_METHODS,
|
|
33
|
+
events: WEB_CHAT_PUBLIC_EVENTS,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=webchat-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webchat-api.js","sourceRoot":"","sources":["../../src/sdk/webchat-api.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAkBnF,SAAS,UAAU,CAAC,EAAO,EAAE,IAA4C,EAAE,GAAG,IAAW;IACvF,MAAM,EAAE,GAAG,EAAE,aAAF,EAAE,uBAAF,EAAE,CAAG,IAAI,CAAC,CAAC;IACtB,IAAI,OAAO,EAAE,KAAK,UAAU,EAAE,CAAC;QAC7B,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,+BAA+B,IAAI,oBAAoB,CAAC,CAAC,CAAC;IAC5F,CAAC;IACD,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC;AAC7C,CAAC;AAED,kEAAkE;AAClE,MAAM,UAAU,gBAAgB,CAAC,aAA6C;IAC5E,IAAI,CAAC,aAAa;QAAE,OAAO,IAAI,CAAC;IAChC,MAAM,EAAE,GAAG,aAAoB,CAAC;IAEhC,OAAO;QACL,kBAAkB,EAAE,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,EAAE,EAAE,oBAAoB,EAAE,EAAE,CAAC;QAClE,QAAQ,EAAE,CAAC,IAAI,EAAE,cAAc,EAAE,EAAE,CAAC,UAAU,CAAC,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,cAAc,CAAC;QACpF,SAAS,EAAE,CAAC,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,cAAc,EAAE,OAAO,CAAC;QAC1G,QAAQ,EAAE,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,EAAE,EAAE,UAAU,EAAE,OAAO,CAAC;QACxD,UAAU,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,EAAE,EAAE,YAAY,CAAC;QAC9C,gBAAgB,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,EAAE,EAAE,kBAAkB,CAAC;QAC1D,qBAAqB,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,EAAE,EAAE,uBAAuB,CAAC;QACpE,YAAY,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,EAAE,EAAE,cAAc,CAAC;QAClD,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CAAC,EAAE,EAAE,gBAAgB,EAAE,KAAK,CAAC;QAChE,EAAE,CAAC,KAAK,EAAE,OAAO;YACf,EAAE,CAAC,gBAAgB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;YACpC,OAAO,GAAG,EAAE,CAAC,EAAE,CAAC,mBAAmB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QACtD,CAAC;QACD,OAAO,EAAE,uBAAuB;QAChC,MAAM,EAAE,sBAAsB;KAC/B,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Bound actions/events for a live <web-chat> instance.\n * No REST imports — safe for unit tests without ChatSDK.\n */\n\nimport { WEB_CHAT_PUBLIC_EVENTS, WEB_CHAT_PUBLIC_METHODS } from '../lib/custom-ui';\nimport type { WebChatPublicEvent, WebChatPublicMethod } from '../lib/custom-ui';\n\nexport type WebChatApi = {\n selectConversation: (conversationId: string | null) => Promise<void>;\n sendText: (body: string, conversationId?: string) => Promise<unknown>;\n sendMedia: (files: File[] | FileList, conversationId?: string, caption?: string) => Promise<unknown>;\n setReply: (message: any | null) => Promise<void>;\n clearReply: () => Promise<void>;\n loadMoreMessages: () => Promise<void>;\n loadMoreConversations: () => Promise<void>;\n getChatState: () => Promise<Record<string, unknown>>;\n setCustomParts: (parts: Record<string, string>) => Promise<unknown>;\n on: (event: WebChatPublicEvent, handler: (ev: Event) => void) => () => void;\n methods: typeof WEB_CHAT_PUBLIC_METHODS;\n events: typeof WEB_CHAT_PUBLIC_EVENTS;\n};\n\nfunction callMethod(el: any, name: WebChatPublicMethod | 'setCustomParts', ...args: any[]) {\n const fn = el?.[name];\n if (typeof fn !== 'function') {\n return Promise.reject(new Error(`[isometrik-webchat] method \"${name}\" is not available`));\n }\n return Promise.resolve(fn.apply(el, args));\n}\n\n/** Bind public methods/events to a mounted <web-chat> element. */\nexport function createWebChatApi(chatComponent: HTMLElement | null | undefined): WebChatApi | null {\n if (!chatComponent) return null;\n const el = chatComponent as any;\n\n return {\n selectConversation: id => callMethod(el, 'selectConversation', id),\n sendText: (body, conversationId) => callMethod(el, 'sendText', body, conversationId),\n sendMedia: (files, conversationId, caption) => callMethod(el, 'sendMedia', files, conversationId, caption),\n setReply: message => callMethod(el, 'setReply', message),\n clearReply: () => callMethod(el, 'clearReply'),\n loadMoreMessages: () => callMethod(el, 'loadMoreMessages'),\n loadMoreConversations: () => callMethod(el, 'loadMoreConversations'),\n getChatState: () => callMethod(el, 'getChatState'),\n setCustomParts: parts => callMethod(el, 'setCustomParts', parts),\n on(event, handler) {\n el.addEventListener(event, handler);\n return () => el.removeEventListener(event, handler);\n },\n methods: WEB_CHAT_PUBLIC_METHODS,\n events: WEB_CHAT_PUBLIC_EVENTS,\n };\n}\n"]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/** Jest stub for constants/chat-assets (avoids import.meta). */
|
|
2
|
+
const stub = name => `mock://${name}`;
|
|
3
|
+
|
|
4
|
+
const icons = {
|
|
5
|
+
ChatBg: stub('ChatBg'),
|
|
6
|
+
CloseButton: stub('CloseButton'),
|
|
7
|
+
Cancel: stub('Cancel'),
|
|
8
|
+
SUN: stub('SUN'),
|
|
9
|
+
MOON: stub('MOON'),
|
|
10
|
+
Message: stub('Message'),
|
|
11
|
+
Message_outline: stub('Message_outline'),
|
|
12
|
+
Group: stub('Group'),
|
|
13
|
+
Message_Add: stub('Message_Add'),
|
|
14
|
+
Login_banner: stub('Login_banner'),
|
|
15
|
+
Group_cast: stub('Group_cast'),
|
|
16
|
+
New_Chat: stub('New_Chat'),
|
|
17
|
+
Three_Dots: stub('Three_Dots'),
|
|
18
|
+
New_Group: stub('New_Group'),
|
|
19
|
+
Dark_Theme: stub('Dark_Theme'),
|
|
20
|
+
Block_User: stub('Block_User'),
|
|
21
|
+
Edit: stub('Edit'),
|
|
22
|
+
Left_Arrow: stub('Left_Arrow'),
|
|
23
|
+
Logout: stub('Logout'),
|
|
24
|
+
Camera_Add: stub('Camera_Add'),
|
|
25
|
+
Search: stub('Search'),
|
|
26
|
+
Clear_Chat: stub('Clear_Chat'),
|
|
27
|
+
Delete: stub('Delete'),
|
|
28
|
+
Drop_Down: stub('Drop_Down'),
|
|
29
|
+
Reply: stub('Reply'),
|
|
30
|
+
Forward: stub('Forward'),
|
|
31
|
+
Info: stub('Info'),
|
|
32
|
+
Add_User: stub('Add_User'),
|
|
33
|
+
Icon_Doc: stub('Icon_Doc'),
|
|
34
|
+
Icon_Excel: stub('Icon_Excel'),
|
|
35
|
+
Icon_Txt: stub('Icon_Txt'),
|
|
36
|
+
Icon_Rtf: stub('Icon_Rtf'),
|
|
37
|
+
Icon_Link: stub('Icon_Link'),
|
|
38
|
+
Icon_Image: stub('Icon_Image'),
|
|
39
|
+
Microphone: stub('Microphone'),
|
|
40
|
+
Send: stub('Send'),
|
|
41
|
+
Smile: stub('Smile'),
|
|
42
|
+
Attachment: stub('Attachment'),
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
module.exports = { ...icons, default: icons };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
CHAT_CREDS: {
|
|
3
|
+
userToken: 'tok',
|
|
4
|
+
appSecret: 'app',
|
|
5
|
+
licenseKey: 'lic',
|
|
6
|
+
userSecret: 'usec',
|
|
7
|
+
accountId: 'acc',
|
|
8
|
+
keysetId: 'key',
|
|
9
|
+
projectId: 'proj',
|
|
10
|
+
baseUrl: 'https://example.test',
|
|
11
|
+
isometrikUserId: 'u1',
|
|
12
|
+
},
|
|
13
|
+
MQTT_CREDS: {
|
|
14
|
+
username: 'mqtt-user',
|
|
15
|
+
password: 'mqtt-pass',
|
|
16
|
+
},
|
|
17
|
+
isometrikFlutterAppSecrets: {},
|
|
18
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = 'test-file-stub';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const message = {
|
|
2
|
+
postMessages: jest.fn(async () => ({ messageId: 'server-msg-1' })),
|
|
3
|
+
postMessagesPresignedurls: jest.fn(async ({ attachments }) => ({
|
|
4
|
+
presignedUrls: (attachments || []).map((_, i) => ({
|
|
5
|
+
mediaPresignedUrl: `https://upload.test/${i}`,
|
|
6
|
+
mediaId: `mid-${i}`,
|
|
7
|
+
mediaUrl: `https://cdn.test/${i}`,
|
|
8
|
+
thumbnailUrl: `https://cdn.test/${i}`,
|
|
9
|
+
})),
|
|
10
|
+
})),
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
module.exports = {
|
|
14
|
+
__esModule: true,
|
|
15
|
+
default: {
|
|
16
|
+
getInstance: () => ({ message }),
|
|
17
|
+
},
|
|
18
|
+
__messageMocks: message,
|
|
19
|
+
};
|