isometrik-plugin-chat-sdk 1.3.19 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (476) hide show
  1. package/dist/cjs/app-globals-61a8bfde.js +38 -0
  2. package/dist/cjs/app-globals-61a8bfde.js.map +1 -0
  3. package/dist/cjs/attachment-preview_22.cjs.entry.js +122 -44
  4. package/dist/cjs/attachment-preview_22.cjs.entry.js.map +1 -1
  5. package/dist/cjs/audio-bubble_4.cjs.entry.js +38 -8
  6. package/dist/cjs/audio-bubble_4.cjs.entry.js.map +1 -1
  7. package/dist/cjs/chat-app.cjs.entry.js +2 -2
  8. package/dist/cjs/chat-app.cjs.entry.js.map +1 -1
  9. package/dist/cjs/{chat-creds-cf537d4b.js → chat-creds-2dbc4087.js} +3 -3
  10. package/dist/cjs/chat-creds-2dbc4087.js.map +1 -0
  11. package/dist/cjs/chat-document-message-bubble.cjs.entry.js +1 -1
  12. package/dist/cjs/chat-image-message-bubble.cjs.entry.js +1 -1
  13. package/dist/cjs/chat-video-message-bubble.cjs.entry.js +1 -1
  14. package/dist/cjs/client-80851676.js +482 -0
  15. package/dist/cjs/client-80851676.js.map +1 -0
  16. package/dist/cjs/{contracts-31632812.js → contracts-dfc84075.js} +2 -2
  17. package/dist/cjs/contracts-dfc84075.js.map +1 -0
  18. package/dist/cjs/destroy-chat-7ae8fc99.js +24 -0
  19. package/dist/cjs/destroy-chat-7ae8fc99.js.map +1 -0
  20. package/dist/cjs/doublecheck-c2461adc.js +36 -0
  21. package/dist/cjs/doublecheck-c2461adc.js.map +1 -0
  22. package/dist/cjs/{drawer-28cc94a4.js → drawer-811d2ce8.js} +2 -2
  23. package/dist/cjs/{drawer-28cc94a4.js.map → drawer-811d2ce8.js.map} +1 -1
  24. package/dist/cjs/forward-memebers.cjs.entry.js +2 -2
  25. package/dist/cjs/forward-message.cjs.entry.js +2 -2
  26. package/dist/cjs/group-chat-contacts.cjs.entry.js +2 -2
  27. package/dist/cjs/{group-members-73ad1074.js → group-members-5a82ec8a.js} +1 -125
  28. package/dist/cjs/group-members-5a82ec8a.js.map +1 -0
  29. package/dist/cjs/{helpers-8061ec7d.js → helpers-154861e9.js} +2 -2
  30. package/dist/cjs/{helpers-8061ec7d.js.map → helpers-154861e9.js.map} +1 -1
  31. package/dist/cjs/{index-1a26d11d.js → index-66f98408.js} +2 -2
  32. package/dist/cjs/index-66f98408.js.map +1 -0
  33. package/dist/cjs/index.cjs.js +55 -182
  34. package/dist/cjs/index.cjs.js.map +1 -1
  35. package/dist/cjs/isometrik-webchat.cjs.js +10 -2
  36. package/dist/cjs/isometrik-webchat.cjs.js.map +1 -1
  37. package/dist/cjs/loader.cjs.js +10 -2
  38. package/dist/cjs/loader.cjs.js.map +1 -1
  39. package/dist/cjs/login-page_3.cjs.entry.js +689 -369
  40. package/dist/cjs/login-page_3.cjs.entry.js.map +1 -1
  41. package/dist/cjs/media-gallery.cjs.entry.js +1 -1
  42. package/dist/cjs/media-limits-eba42629.js +165 -0
  43. package/dist/cjs/media-limits-eba42629.js.map +1 -0
  44. package/dist/cjs/member-add.cjs.entry.js +3 -3
  45. package/dist/cjs/message-bubble.cjs.entry.js +30 -8
  46. package/dist/cjs/message-bubble.cjs.entry.js.map +1 -1
  47. package/dist/cjs/my-component.cjs.entry.js +1 -1
  48. package/dist/cjs/new-chat-sidebar.cjs.entry.js +2 -2
  49. package/dist/cjs/reaction-container.cjs.entry.js +4 -4
  50. package/dist/cjs/runtime-controls-201c71ba.js +650 -0
  51. package/dist/cjs/runtime-controls-201c71ba.js.map +1 -0
  52. package/dist/cjs/send-media-14908d4b.js +375 -0
  53. package/dist/cjs/send-media-14908d4b.js.map +1 -0
  54. package/dist/cjs/signup-page.cjs.entry.js +1 -1
  55. package/dist/cjs/{toast-0bf1e688.js → toast-f810e550.js} +8 -8
  56. package/dist/cjs/toast-f810e550.js.map +1 -0
  57. package/dist/collection/collection-manifest.json +2 -1
  58. package/dist/collection/components/ChatUIComponent/ChatDocumentMessageBubble.js +1 -1
  59. package/dist/collection/components/ChatUIComponent/ChatImageMessageBubble.js +1 -1
  60. package/dist/collection/components/ChatUIComponent/ChatVideoMessageBubble.js +1 -1
  61. package/dist/collection/components/ChatUIComponent/Footer/ChatFooter.js +61 -14
  62. package/dist/collection/components/ChatUIComponent/Footer/ChatFooter.js.map +1 -1
  63. package/dist/collection/components/ChatUIComponent/ReactionContainer.js +2 -2
  64. package/dist/collection/components/ChatUIComponent/WebChatBody/WebChatBody.js +7 -6
  65. package/dist/collection/components/ChatUIComponent/WebChatBody/WebChatBody.js.map +1 -1
  66. package/dist/collection/components/ChatUIComponent/shared/attachment-preview/attachment-preview.js +39 -8
  67. package/dist/collection/components/ChatUIComponent/shared/attachment-preview/attachment-preview.js.map +1 -1
  68. package/dist/collection/components/ChatUIComponent/shared/document-message/document-message.js +53 -3
  69. package/dist/collection/components/ChatUIComponent/shared/document-message/document-message.js.map +1 -1
  70. package/dist/collection/components/ChatUIComponent/shared/forward-message/forward-message.js +2 -2
  71. package/dist/collection/components/ChatUIComponent/shared/image-message/image-message.js +19 -1
  72. package/dist/collection/components/ChatUIComponent/shared/image-message/image-message.js.map +1 -1
  73. package/dist/collection/components/ChatUIComponent/shared/incoming-text-message-bubble/incoming-text-message-bubble.js +1 -1
  74. package/dist/collection/components/ChatUIComponent/shared/message-bubble/message-bubble.js +47 -7
  75. package/dist/collection/components/ChatUIComponent/shared/message-bubble/message-bubble.js.map +1 -1
  76. package/dist/collection/components/ChatUIComponent/shared/message-date-pill/message-date-pill.js +1 -1
  77. package/dist/collection/components/ChatUIComponent/shared/new chat/new-chat.stories.js +1 -1
  78. package/dist/collection/components/ChatUIComponent/shared/outgoing-text-message-bubble/outgoing-text-message-bubble.js +19 -1
  79. package/dist/collection/components/ChatUIComponent/shared/outgoing-text-message-bubble/outgoing-text-message-bubble.js.map +1 -1
  80. package/dist/collection/components/ChatUIComponent/shared/reply-message-container/reply-message-container.js +1 -1
  81. package/dist/collection/components/ChatUIComponent/shared/video-message/video-message.js +20 -2
  82. package/dist/collection/components/ChatUIComponent/shared/video-message/video-message.js.map +1 -1
  83. package/dist/collection/components/my-component/my-component.js +1 -1
  84. package/dist/collection/components/my-component/web-chat/FLOW.js +1 -1
  85. package/dist/collection/components/my-component/web-chat/FLOW.js.map +1 -1
  86. package/dist/collection/components/my-component/web-chat/WebChat.js +113 -12
  87. package/dist/collection/components/my-component/web-chat/WebChat.js.map +1 -1
  88. package/dist/collection/components/my-component/web-chat/bootstrap.js +7 -0
  89. package/dist/collection/components/my-component/web-chat/bootstrap.js.map +1 -1
  90. package/dist/collection/components/my-component/web-chat/data-fetch.js +14 -5
  91. package/dist/collection/components/my-component/web-chat/data-fetch.js.map +1 -1
  92. package/dist/collection/components/my-component/web-chat/mqtt-host.js +133 -34
  93. package/dist/collection/components/my-component/web-chat/mqtt-host.js.map +1 -1
  94. package/dist/collection/components/my-component/web-chat/offline-host.js +212 -0
  95. package/dist/collection/components/my-component/web-chat/offline-host.js.map +1 -0
  96. package/dist/collection/components/my-component/web-chat/public-send.js +96 -21
  97. package/dist/collection/components/my-component/web-chat/public-send.js.map +1 -1
  98. package/dist/collection/components/my-component/web-chat/shell-render.js +47 -28
  99. package/dist/collection/components/my-component/web-chat/shell-render.js.map +1 -1
  100. package/dist/collection/components/theme-provider.js +114 -45
  101. package/dist/collection/components/theme-provider.js.map +1 -1
  102. package/dist/collection/constants/chat-creds.js +2 -2
  103. package/dist/collection/demos/custom-ui-demo-elements.js +2 -2
  104. package/dist/collection/demos/custom-ui-demo-elements.js.map +1 -1
  105. package/dist/collection/global/expose-sdk.js +29 -0
  106. package/dist/collection/global/expose-sdk.js.map +1 -0
  107. package/dist/collection/index.js +10 -141
  108. package/dist/collection/index.js.map +1 -1
  109. package/dist/collection/lib/chat/index.js +3 -0
  110. package/dist/collection/lib/chat/index.js.map +1 -1
  111. package/dist/collection/lib/chat/media-limits.js +21 -0
  112. package/dist/collection/lib/chat/media-limits.js.map +1 -0
  113. package/dist/collection/lib/chat/media-outbox.js +43 -0
  114. package/dist/collection/lib/chat/media-outbox.js.map +1 -0
  115. package/dist/collection/lib/chat/preview-kind.js +41 -0
  116. package/dist/collection/lib/chat/preview-kind.js.map +1 -0
  117. package/dist/collection/lib/chat/send-media.js +5 -2
  118. package/dist/collection/lib/chat/send-media.js.map +1 -1
  119. package/dist/collection/lib/custom-ui/contracts.js +1 -1
  120. package/dist/collection/lib/custom-ui/contracts.js.map +1 -1
  121. package/dist/collection/lib/custom-ui/index.js +1 -1
  122. package/dist/collection/lib/custom-ui/index.js.map +1 -1
  123. package/dist/collection/lib/custom-ui/public-api.js +1 -0
  124. package/dist/collection/lib/custom-ui/public-api.js.map +1 -1
  125. package/dist/collection/lib/destroy-chat.js +15 -16
  126. package/dist/collection/lib/destroy-chat.js.map +1 -0
  127. package/dist/collection/lib/mqtt/inbound-queue.js +17 -0
  128. package/dist/collection/lib/mqtt/inbound-queue.js.map +1 -0
  129. package/dist/collection/lib/mqtt/index.js +2 -1
  130. package/dist/collection/lib/mqtt/index.js.map +1 -1
  131. package/dist/collection/lib/mqtt/session.js +50 -6
  132. package/dist/collection/lib/mqtt/session.js.map +1 -1
  133. package/dist/collection/lib/offline/client.js +167 -0
  134. package/dist/collection/lib/offline/client.js.map +1 -0
  135. package/dist/collection/lib/offline/idb.js +181 -0
  136. package/dist/collection/lib/offline/idb.js.map +1 -0
  137. package/dist/collection/lib/offline/index.js +10 -0
  138. package/dist/collection/lib/offline/index.js.map +1 -0
  139. package/dist/collection/lib/offline/memory-db.js +64 -0
  140. package/dist/collection/lib/offline/memory-db.js.map +1 -0
  141. package/dist/collection/lib/offline/merge.js +24 -0
  142. package/dist/collection/lib/offline/merge.js.map +1 -0
  143. package/dist/collection/lib/offline/multitab.js +47 -0
  144. package/dist/collection/lib/offline/multitab.js.map +1 -0
  145. package/dist/collection/lib/offline/types.js +2 -0
  146. package/dist/collection/lib/offline/types.js.map +1 -0
  147. package/dist/collection/lib/toast.js +6 -6
  148. package/dist/collection/lib/toast.js.map +1 -1
  149. package/dist/collection/sdk/api.js +4 -0
  150. package/dist/collection/sdk/api.js.map +1 -0
  151. package/dist/collection/sdk/composition.js +43 -0
  152. package/dist/collection/sdk/composition.js.map +1 -0
  153. package/dist/collection/sdk/headless-api.js +37 -0
  154. package/dist/collection/sdk/headless-api.js.map +1 -0
  155. package/dist/collection/sdk/index.js +11 -0
  156. package/dist/collection/sdk/index.js.map +1 -0
  157. package/dist/collection/sdk/init.js +207 -0
  158. package/dist/collection/sdk/init.js.map +1 -0
  159. package/dist/collection/sdk/instance.js +63 -0
  160. package/dist/collection/sdk/instance.js.map +1 -0
  161. package/dist/collection/sdk/react-bridge.js +145 -0
  162. package/dist/collection/sdk/react-bridge.js.map +1 -0
  163. package/dist/collection/sdk/runtime-controls.js +54 -0
  164. package/dist/collection/sdk/runtime-controls.js.map +1 -0
  165. package/dist/collection/sdk/slots.js +57 -0
  166. package/dist/collection/sdk/slots.js.map +1 -0
  167. package/dist/collection/sdk/theme-tokens.js +99 -0
  168. package/dist/collection/sdk/theme-tokens.js.map +1 -0
  169. package/dist/collection/sdk/webchat-api.js +36 -0
  170. package/dist/collection/sdk/webchat-api.js.map +1 -0
  171. package/dist/collection/testing/chat-assets-mock.js +45 -0
  172. package/dist/collection/testing/chat-creds-mock.js +18 -0
  173. package/dist/collection/testing/emoji-picker-mock.js +2 -0
  174. package/dist/collection/testing/file-mock.js +1 -0
  175. package/dist/collection/testing/groupcast-mock.js +7 -0
  176. package/dist/collection/testing/helpers-mock.js +4 -0
  177. package/dist/collection/testing/iso-chat-sdk-mock.js +19 -0
  178. package/dist/collection/testing/toast-mock.js +2 -0
  179. package/dist/components/ChatFooter.js +62 -15
  180. package/dist/components/ChatFooter.js.map +1 -1
  181. package/dist/components/ChatSidebar.js +1 -1
  182. package/dist/components/{GroupCast.js → GroupCast2.js} +2 -2
  183. package/dist/components/GroupCast2.js.map +1 -0
  184. package/dist/components/WebChat.js +624 -305
  185. package/dist/components/WebChat.js.map +1 -1
  186. package/dist/components/WebChatBody.js +8 -7
  187. package/dist/components/WebChatBody.js.map +1 -1
  188. package/dist/components/attachment-preview2.js +40 -9
  189. package/dist/components/attachment-preview2.js.map +1 -1
  190. package/dist/components/chat-app.js +3 -3
  191. package/dist/components/chat-app.js.map +1 -1
  192. package/dist/components/chat-assets.js +1 -1
  193. package/dist/components/chat-creds.js +2 -2
  194. package/dist/components/chat-creds.js.map +1 -1
  195. package/dist/components/chat-document-message-bubble.js +1 -1
  196. package/dist/components/chat-image-message-bubble.js +1 -1
  197. package/dist/components/chat-tile2.js +1 -1
  198. package/dist/components/chat-video-message-bubble.js +1 -1
  199. package/dist/components/client.js +728 -0
  200. package/dist/components/client.js.map +1 -0
  201. package/dist/components/contact-info2.js +2 -117
  202. package/dist/components/contact-info2.js.map +1 -1
  203. package/dist/components/contracts.js +1 -1
  204. package/dist/components/contracts.js.map +1 -1
  205. package/dist/components/destroy-chat.js +14 -16
  206. package/dist/components/destroy-chat.js.map +1 -1
  207. package/dist/components/document-message2.js +35 -5
  208. package/dist/components/document-message2.js.map +1 -1
  209. package/dist/components/forward-message.js +2 -2
  210. package/dist/components/group-cast.js +1 -1
  211. package/dist/components/{groupcast2.js → groupcast.js} +1 -1
  212. package/dist/components/groupcast.js.map +1 -0
  213. package/dist/components/image-message2.js +3 -1
  214. package/dist/components/image-message2.js.map +1 -1
  215. package/dist/components/incoming-text-message-bubble2.js +1 -1
  216. package/dist/components/index.js +551 -60
  217. package/dist/components/index.js.map +1 -1
  218. package/dist/components/index2.js +1 -1
  219. package/dist/components/index2.js.map +1 -1
  220. package/dist/components/media-limits.js +24 -0
  221. package/dist/components/media-limits.js.map +1 -0
  222. package/dist/components/member-add.js +1 -1
  223. package/dist/components/message-bubble2.js +31 -7
  224. package/dist/components/message-bubble2.js.map +1 -1
  225. package/dist/components/message-date-pill2.js +1 -1
  226. package/dist/components/messages.js +131 -0
  227. package/dist/components/messages.js.map +1 -0
  228. package/dist/components/my-component.js +1 -1
  229. package/dist/components/outgoing-text-message-bubble2.js +3 -1
  230. package/dist/components/outgoing-text-message-bubble2.js.map +1 -1
  231. package/dist/components/preview-kind.js +30 -0
  232. package/dist/components/preview-kind.js.map +1 -0
  233. package/dist/components/reaction-container.js +2 -2
  234. package/dist/components/reply-message-container2.js +1 -1
  235. package/dist/components/theme-provider2.js +56 -44
  236. package/dist/components/theme-provider2.js.map +1 -1
  237. package/dist/components/theme-tokens.js +102 -0
  238. package/dist/components/theme-tokens.js.map +1 -0
  239. package/dist/components/toast.js +6 -6
  240. package/dist/components/toast.js.map +1 -1
  241. package/dist/components/video-message2.js +4 -2
  242. package/dist/components/video-message2.js.map +1 -1
  243. package/dist/esm/app-globals-2beecb81.js +36 -0
  244. package/dist/esm/app-globals-2beecb81.js.map +1 -0
  245. package/dist/esm/attachment-preview_22.entry.js +120 -42
  246. package/dist/esm/attachment-preview_22.entry.js.map +1 -1
  247. package/dist/esm/audio-bubble_4.entry.js +39 -9
  248. package/dist/esm/audio-bubble_4.entry.js.map +1 -1
  249. package/dist/esm/chat-app.entry.js +2 -2
  250. package/dist/esm/chat-app.entry.js.map +1 -1
  251. package/dist/esm/{chat-assets-e3173222.js → chat-assets-bb056958.js} +2 -2
  252. package/dist/esm/{chat-assets-e3173222.js.map → chat-assets-bb056958.js.map} +1 -1
  253. package/dist/esm/{chat-creds-5d0982fc.js → chat-creds-aafad4d0.js} +3 -3
  254. package/dist/esm/chat-creds-aafad4d0.js.map +1 -0
  255. package/dist/esm/chat-document-message-bubble.entry.js +1 -1
  256. package/dist/esm/chat-image-message-bubble.entry.js +1 -1
  257. package/dist/esm/chat-tile_3.entry.js +1 -1
  258. package/dist/esm/chat-video-message-bubble.entry.js +1 -1
  259. package/dist/esm/client-4a3e00da.js +477 -0
  260. package/dist/esm/client-4a3e00da.js.map +1 -0
  261. package/dist/esm/{contracts-614be4db.js → contracts-50f4ddae.js} +2 -2
  262. package/dist/esm/contracts-50f4ddae.js.map +1 -0
  263. package/dist/esm/destroy-chat-d0ee28d6.js +22 -0
  264. package/dist/esm/destroy-chat-d0ee28d6.js.map +1 -0
  265. package/dist/esm/doublecheck-261763ef.js +32 -0
  266. package/dist/esm/doublecheck-261763ef.js.map +1 -0
  267. package/dist/esm/{drawer-8f721119.js → drawer-74c188f1.js} +2 -2
  268. package/dist/esm/{drawer-8f721119.js.map → drawer-74c188f1.js.map} +1 -1
  269. package/dist/esm/forward-memebers.entry.js +3 -3
  270. package/dist/esm/forward-message.entry.js +2 -2
  271. package/dist/esm/group-chat-contacts.entry.js +2 -2
  272. package/dist/esm/{group-members-806fd7a2.js → group-members-05414da2.js} +2 -118
  273. package/dist/esm/group-members-05414da2.js.map +1 -0
  274. package/dist/esm/{groupcast-2ce7187f.js → groupcast-9c7d2a32.js} +2 -2
  275. package/dist/esm/{groupcast-2ce7187f.js.map → groupcast-9c7d2a32.js.map} +1 -1
  276. package/dist/esm/{helpers-4c6d09a7.js → helpers-f33b895c.js} +2 -2
  277. package/dist/esm/{helpers-4c6d09a7.js.map → helpers-f33b895c.js.map} +1 -1
  278. package/dist/esm/{index-beb184c6.js → index-4c865e34.js} +2 -2
  279. package/dist/esm/index-4c865e34.js.map +1 -0
  280. package/dist/esm/index.js +17 -171
  281. package/dist/esm/index.js.map +1 -1
  282. package/dist/esm/isometrik-webchat.js +10 -2
  283. package/dist/esm/isometrik-webchat.js.map +1 -1
  284. package/dist/esm/loader.js +10 -2
  285. package/dist/esm/loader.js.map +1 -1
  286. package/dist/esm/login-page_3.entry.js +672 -352
  287. package/dist/esm/login-page_3.entry.js.map +1 -1
  288. package/dist/esm/media-gallery.entry.js +1 -1
  289. package/dist/esm/media-limits-3fa07c09.js +152 -0
  290. package/dist/esm/media-limits-3fa07c09.js.map +1 -0
  291. package/dist/esm/member-add.entry.js +5 -5
  292. package/dist/esm/message-bubble.entry.js +30 -8
  293. package/dist/esm/message-bubble.entry.js.map +1 -1
  294. package/dist/esm/my-component.entry.js +1 -1
  295. package/dist/esm/new-chat-sidebar.entry.js +3 -3
  296. package/dist/esm/reaction-container.entry.js +4 -4
  297. package/dist/esm/runtime-controls-cf599fe2.js +623 -0
  298. package/dist/esm/runtime-controls-cf599fe2.js.map +1 -0
  299. package/dist/esm/send-media-917dcc2f.js +353 -0
  300. package/dist/esm/send-media-917dcc2f.js.map +1 -0
  301. package/dist/esm/signup-page.entry.js +1 -1
  302. package/dist/esm/{toast-d8ea763c.js → toast-533dd183.js} +8 -8
  303. package/dist/esm/toast-533dd183.js.map +1 -0
  304. package/dist/isometrik-webchat/index.esm.js +1 -1
  305. package/dist/isometrik-webchat/index.esm.js.map +1 -1
  306. package/dist/isometrik-webchat/isometrik-webchat.css +1 -1
  307. package/dist/isometrik-webchat/isometrik-webchat.esm.js +1 -1
  308. package/dist/isometrik-webchat/isometrik-webchat.esm.js.map +1 -1
  309. package/dist/isometrik-webchat/p-0731d488.js +2 -0
  310. package/dist/isometrik-webchat/p-0731d488.js.map +1 -0
  311. package/dist/isometrik-webchat/{p-a15092d9.entry.js → p-1854b156.entry.js} +2 -2
  312. package/dist/isometrik-webchat/p-1854b156.entry.js.map +1 -0
  313. package/dist/isometrik-webchat/{p-5fea3fd2.entry.js → p-2d3e8cd4.entry.js} +2 -2
  314. package/dist/isometrik-webchat/p-315eee9a.js +2 -0
  315. package/dist/isometrik-webchat/p-315eee9a.js.map +1 -0
  316. package/dist/isometrik-webchat/{p-e7f58d3f.entry.js → p-39b626ed.entry.js} +2 -2
  317. package/dist/isometrik-webchat/{p-eb1f3118.entry.js → p-3c70c22c.entry.js} +2 -2
  318. package/dist/isometrik-webchat/p-4cb54460.js +2 -0
  319. package/dist/isometrik-webchat/p-4cb54460.js.map +1 -0
  320. package/dist/isometrik-webchat/{p-f24cdbbb.js → p-5162774c.js} +1 -1
  321. package/dist/isometrik-webchat/p-5162774c.js.map +1 -0
  322. package/dist/isometrik-webchat/p-53ee98a7.entry.js +2 -0
  323. package/dist/isometrik-webchat/p-53ee98a7.entry.js.map +1 -0
  324. package/dist/isometrik-webchat/{p-5cbc1a16.entry.js → p-586f6978.entry.js} +2 -2
  325. package/dist/isometrik-webchat/{p-5f7eebbf.entry.js → p-5d243250.entry.js} +2 -2
  326. package/dist/isometrik-webchat/{p-23df1c24.js → p-5d98a8a0.js} +2 -2
  327. package/dist/isometrik-webchat/p-7f415f28.js +2 -0
  328. package/dist/isometrik-webchat/p-7f415f28.js.map +1 -0
  329. package/dist/isometrik-webchat/{p-d386acfe.js → p-7fd2c1ad.js} +1 -1
  330. package/dist/isometrik-webchat/p-7fd2c1ad.js.map +1 -0
  331. package/dist/isometrik-webchat/{p-e5884258.js → p-9982fa21.js} +2 -2
  332. package/dist/isometrik-webchat/{p-4db39c93.js → p-a5707f12.js} +2 -2
  333. package/dist/isometrik-webchat/{p-af775c83.entry.js → p-a876991d.entry.js} +2 -2
  334. package/dist/isometrik-webchat/{p-7b80b0b2.js → p-adc45831.js} +1 -1
  335. package/dist/isometrik-webchat/p-adc45831.js.map +1 -0
  336. package/dist/isometrik-webchat/p-ae168135.js +2 -0
  337. package/dist/isometrik-webchat/p-ae168135.js.map +1 -0
  338. package/dist/isometrik-webchat/{p-a6897edc.js → p-b1330793.js} +1 -1
  339. package/dist/isometrik-webchat/p-b1330793.js.map +1 -0
  340. package/dist/isometrik-webchat/p-b61d6c0c.entry.js +2 -0
  341. package/dist/isometrik-webchat/p-b61d6c0c.entry.js.map +1 -0
  342. package/dist/isometrik-webchat/p-b667a9fc.js +2 -0
  343. package/dist/isometrik-webchat/p-b667a9fc.js.map +1 -0
  344. package/dist/isometrik-webchat/p-b857775d.entry.js +2 -0
  345. package/dist/isometrik-webchat/p-bdcdf1c5.js +2 -0
  346. package/dist/isometrik-webchat/p-bdcdf1c5.js.map +1 -0
  347. package/dist/isometrik-webchat/p-c0c19621.entry.js +2 -0
  348. package/dist/isometrik-webchat/{p-064d6200.entry.js → p-ca47d693.entry.js} +2 -2
  349. package/dist/isometrik-webchat/p-d720cf14.entry.js +2 -0
  350. package/dist/isometrik-webchat/{p-53695fc6.entry.js.map → p-d720cf14.entry.js.map} +1 -1
  351. package/dist/isometrik-webchat/{p-5c22ee37.entry.js → p-d892b4d4.entry.js} +2 -2
  352. package/dist/isometrik-webchat/{p-7eb12da3.js → p-dd62bd69.js} +2 -2
  353. package/dist/isometrik-webchat/p-eb54f75d.js +2 -0
  354. package/dist/isometrik-webchat/p-eb54f75d.js.map +1 -0
  355. package/dist/isometrik-webchat/p-f1fbf3be.entry.js +2 -0
  356. package/dist/isometrik-webchat/p-f1fbf3be.entry.js.map +1 -0
  357. package/dist/isometrik-webchat/p-fb705915.entry.js +2 -0
  358. package/dist/isometrik-webchat/p-fb705915.entry.js.map +1 -0
  359. package/dist/isometrik-webchat/{p-2f6bb0a4.entry.js → p-fd6ce589.entry.js} +2 -2
  360. package/dist/isometrik-webchat/p-fdd327f5.entry.js +2 -0
  361. package/dist/types/components/ChatUIComponent/Footer/ChatFooter.d.ts +1 -0
  362. package/dist/types/components/ChatUIComponent/shared/attachment-preview/attachment-preview.d.ts +2 -0
  363. package/dist/types/components/ChatUIComponent/shared/document-message/document-message.d.ts +5 -0
  364. package/dist/types/components/ChatUIComponent/shared/image-message/image-message.d.ts +1 -0
  365. package/dist/types/components/ChatUIComponent/shared/message-bubble/message-bubble.d.ts +3 -0
  366. package/dist/types/components/ChatUIComponent/shared/outgoing-text-message-bubble/outgoing-text-message-bubble.d.ts +1 -0
  367. package/dist/types/components/ChatUIComponent/shared/video-message/video-message.d.ts +1 -0
  368. package/dist/types/components/my-component/web-chat/FLOW.d.ts +1 -1
  369. package/dist/types/components/my-component/web-chat/mqtt-host.d.ts +5 -0
  370. package/dist/types/components/my-component/web-chat/offline-host.d.ts +22 -0
  371. package/dist/types/components/theme-provider.d.ts +22 -27
  372. package/dist/types/components.d.ts +84 -11
  373. package/dist/types/demos/custom-ui-demo-elements.d.ts +1 -1
  374. package/dist/types/global/expose-sdk.d.ts +1 -0
  375. package/dist/types/index.d.ts +3 -44
  376. package/dist/types/lib/chat/index.d.ts +3 -0
  377. package/dist/types/lib/chat/media-limits.d.ts +11 -0
  378. package/dist/types/lib/chat/media-outbox.d.ts +8 -0
  379. package/dist/types/lib/chat/preview-kind.d.ts +30 -0
  380. package/dist/types/lib/custom-ui/contracts.d.ts +1 -1
  381. package/dist/types/lib/custom-ui/index.d.ts +1 -1
  382. package/dist/types/lib/custom-ui/public-api.d.ts +1 -1
  383. package/dist/types/lib/destroy-chat.d.ts +2 -0
  384. package/dist/types/lib/mqtt/inbound-queue.d.ts +7 -0
  385. package/dist/types/lib/mqtt/index.d.ts +2 -1
  386. package/dist/types/lib/mqtt/session.d.ts +22 -0
  387. package/dist/types/lib/offline/client.d.ts +44 -0
  388. package/dist/types/lib/offline/idb.d.ts +36 -0
  389. package/dist/types/lib/offline/index.d.ts +10 -0
  390. package/dist/types/lib/offline/memory-db.d.ts +20 -0
  391. package/dist/types/lib/offline/merge.d.ts +3 -0
  392. package/dist/types/lib/offline/multitab.d.ts +13 -0
  393. package/dist/types/lib/offline/types.d.ts +63 -0
  394. package/dist/types/sdk/api.d.ts +3 -0
  395. package/dist/types/sdk/composition.d.ts +32 -0
  396. package/dist/types/sdk/headless-api.d.ts +37 -0
  397. package/dist/types/sdk/index.d.ts +10 -0
  398. package/dist/types/sdk/init.d.ts +87 -0
  399. package/dist/types/sdk/instance.d.ts +15 -0
  400. package/dist/types/sdk/react-bridge.d.ts +64 -0
  401. package/dist/types/sdk/runtime-controls.d.ts +14 -0
  402. package/dist/types/sdk/slots.d.ts +15 -0
  403. package/dist/types/sdk/theme-tokens.d.ts +22 -0
  404. package/dist/types/sdk/webchat-api.d.ts +22 -0
  405. package/docs/ARCHITECTURE.md +272 -0
  406. package/docs/CUSTOMIZATION.md +236 -0
  407. package/docs/INTEGRATION.md +286 -0
  408. package/docs/RELIABILITY.md +51 -0
  409. package/docs/theme-tokens.template.css +72 -0
  410. package/package.json +8 -2
  411. package/readme.md +38 -17
  412. package/dist/cjs/app-globals-3a1e7e63.js +0 -7
  413. package/dist/cjs/app-globals-3a1e7e63.js.map +0 -1
  414. package/dist/cjs/chat-creds-cf537d4b.js.map +0 -1
  415. package/dist/cjs/contracts-31632812.js.map +0 -1
  416. package/dist/cjs/destroy-chat-be25dec7.js +0 -26
  417. package/dist/cjs/destroy-chat-be25dec7.js.map +0 -1
  418. package/dist/cjs/doublecheck-997afc94.js +0 -7
  419. package/dist/cjs/doublecheck-997afc94.js.map +0 -1
  420. package/dist/cjs/group-members-73ad1074.js.map +0 -1
  421. package/dist/cjs/index-1a26d11d.js.map +0 -1
  422. package/dist/cjs/toast-0bf1e688.js.map +0 -1
  423. package/dist/components/GroupCast.js.map +0 -1
  424. package/dist/components/groupcast2.js.map +0 -1
  425. package/dist/esm/app-globals-0f993ce5.js +0 -5
  426. package/dist/esm/app-globals-0f993ce5.js.map +0 -1
  427. package/dist/esm/chat-creds-5d0982fc.js.map +0 -1
  428. package/dist/esm/contracts-614be4db.js.map +0 -1
  429. package/dist/esm/destroy-chat-e2ebe165.js +0 -24
  430. package/dist/esm/destroy-chat-e2ebe165.js.map +0 -1
  431. package/dist/esm/doublecheck-5e208ef0.js +0 -5
  432. package/dist/esm/doublecheck-5e208ef0.js.map +0 -1
  433. package/dist/esm/group-members-806fd7a2.js.map +0 -1
  434. package/dist/esm/index-beb184c6.js.map +0 -1
  435. package/dist/esm/toast-d8ea763c.js.map +0 -1
  436. package/dist/isometrik-webchat/p-01fd0eb4.entry.js +0 -2
  437. package/dist/isometrik-webchat/p-01fd0eb4.entry.js.map +0 -1
  438. package/dist/isometrik-webchat/p-0f9c3f95.entry.js +0 -2
  439. package/dist/isometrik-webchat/p-0f9c3f95.entry.js.map +0 -1
  440. package/dist/isometrik-webchat/p-1c53e658.js +0 -2
  441. package/dist/isometrik-webchat/p-1c53e658.js.map +0 -1
  442. package/dist/isometrik-webchat/p-1df58381.entry.js +0 -2
  443. package/dist/isometrik-webchat/p-1df58381.entry.js.map +0 -1
  444. package/dist/isometrik-webchat/p-3c690532.entry.js +0 -2
  445. package/dist/isometrik-webchat/p-3c690532.entry.js.map +0 -1
  446. package/dist/isometrik-webchat/p-3c8cbd5f.js +0 -2
  447. package/dist/isometrik-webchat/p-3c8cbd5f.js.map +0 -1
  448. package/dist/isometrik-webchat/p-4e762019.js +0 -2
  449. package/dist/isometrik-webchat/p-4e762019.js.map +0 -1
  450. package/dist/isometrik-webchat/p-53695fc6.entry.js +0 -2
  451. package/dist/isometrik-webchat/p-7b80b0b2.js.map +0 -1
  452. package/dist/isometrik-webchat/p-9924b1bf.entry.js +0 -2
  453. package/dist/isometrik-webchat/p-a15092d9.entry.js.map +0 -1
  454. package/dist/isometrik-webchat/p-a6897edc.js.map +0 -1
  455. package/dist/isometrik-webchat/p-b2bf55b1.entry.js +0 -2
  456. package/dist/isometrik-webchat/p-bfecfa97.entry.js +0 -2
  457. package/dist/isometrik-webchat/p-d386acfe.js.map +0 -1
  458. package/dist/isometrik-webchat/p-e1255160.js +0 -2
  459. package/dist/isometrik-webchat/p-e1255160.js.map +0 -1
  460. package/dist/isometrik-webchat/p-f24cdbbb.js.map +0 -1
  461. /package/dist/isometrik-webchat/{p-5fea3fd2.entry.js.map → p-2d3e8cd4.entry.js.map} +0 -0
  462. /package/dist/isometrik-webchat/{p-e7f58d3f.entry.js.map → p-39b626ed.entry.js.map} +0 -0
  463. /package/dist/isometrik-webchat/{p-eb1f3118.entry.js.map → p-3c70c22c.entry.js.map} +0 -0
  464. /package/dist/isometrik-webchat/{p-5cbc1a16.entry.js.map → p-586f6978.entry.js.map} +0 -0
  465. /package/dist/isometrik-webchat/{p-5f7eebbf.entry.js.map → p-5d243250.entry.js.map} +0 -0
  466. /package/dist/isometrik-webchat/{p-23df1c24.js.map → p-5d98a8a0.js.map} +0 -0
  467. /package/dist/isometrik-webchat/{p-e5884258.js.map → p-9982fa21.js.map} +0 -0
  468. /package/dist/isometrik-webchat/{p-4db39c93.js.map → p-a5707f12.js.map} +0 -0
  469. /package/dist/isometrik-webchat/{p-af775c83.entry.js.map → p-a876991d.entry.js.map} +0 -0
  470. /package/dist/isometrik-webchat/{p-bfecfa97.entry.js.map → p-b857775d.entry.js.map} +0 -0
  471. /package/dist/isometrik-webchat/{p-9924b1bf.entry.js.map → p-c0c19621.entry.js.map} +0 -0
  472. /package/dist/isometrik-webchat/{p-064d6200.entry.js.map → p-ca47d693.entry.js.map} +0 -0
  473. /package/dist/isometrik-webchat/{p-5c22ee37.entry.js.map → p-d892b4d4.entry.js.map} +0 -0
  474. /package/dist/isometrik-webchat/{p-7eb12da3.js.map → p-dd62bd69.js.map} +0 -0
  475. /package/dist/isometrik-webchat/{p-2f6bb0a4.entry.js.map → p-fd6ce589.entry.js.map} +0 -0
  476. /package/dist/isometrik-webchat/{p-b2bf55b1.entry.js.map → p-fdd327f5.entry.js.map} +0 -0
@@ -1,6 +1,12 @@
1
- export { getAssetPath, setAssetPath, setNonce, setPlatformOptions } from '@stencil/core/internal/client';
2
1
  import { d as destroyChatDom } from './destroy-chat.js';
2
+ import { n as normalizeThemeObject, T as THEME_TOKEN_NAMES } from './theme-tokens.js';
3
+ export { T as THEME_TOKEN_NAMES, a as applyThemeObjectToElement, n as normalizeThemeObject } from './theme-tokens.js';
4
+ import { r as resolveShowProfileRailProp, i as initializeChatSdk, f as fetchUserDetails, a as fetchConversationsPage, b as fetchConversationDetails, s as sortConversationsByLatestMessage, m as mergeUniqueConversations, c as fetchGroupcastDetails, d as fetchGroupcastMembersPage, e as fetchGroupcastContactsPage, g as mediaTypeFromMime, h as customTypeFromMime, p as prepareMediaAttachments, j as buildReplyMetaData } from './client.js';
5
+ export { t as canUseIndexedDb, n as getOfflineClient, q as isBrowserOnline, o as mergeMessagesById, l as resolveProfileRailMode, k as resolveRegionMode, r as resolveShowProfileRailProp } from './client.js';
6
+ import { f as findWebChatHost } from './index2.js';
3
7
  export { W as WEB_CHAT_SLOTS, a as applyCustomPartProps, f as findWebChatHost } from './index2.js';
8
+ import { f as fetchMessagesPage, s as searchMessages, a as fetchLinkMessages, b as fetchMediaCount, c as fetchMediaAttachments, d as filterMediaMessages } from './messages.js';
9
+ export { getAssetPath, setAssetPath, setNonce, setPlatformOptions } from '@stencil/core/internal/client';
4
10
  export { d as deriveMessageStatus } from './contracts.js';
5
11
  export { f as format } from './utils.js';
6
12
 
@@ -29,6 +35,7 @@ const WEB_CHAT_PUBLIC_METHODS = [
29
35
  'loadMoreMessages',
30
36
  'loadMoreConversations',
31
37
  'getChatState',
38
+ 'setCustomParts',
32
39
  ];
33
40
 
34
41
  /**
@@ -66,32 +73,232 @@ function defineReactiveCustomPart(tag, propKeys, render) {
66
73
  customElements.define(tag, ReactivePart);
67
74
  }
68
75
 
69
- function attachWebChatSlots(chatComponent, slots) {
70
- if (!slots)
76
+ /**
77
+ * Bound actions/events for a live <web-chat> instance.
78
+ * No REST imports — safe for unit tests without ChatSDK.
79
+ */
80
+ function callMethod(el, name, ...args) {
81
+ const fn = el === null || el === void 0 ? void 0 : el[name];
82
+ if (typeof fn !== 'function') {
83
+ return Promise.reject(new Error(`[isometrik-webchat] method "${name}" is not available`));
84
+ }
85
+ return Promise.resolve(fn.apply(el, args));
86
+ }
87
+ /** Bind public methods/events to a mounted <web-chat> element. */
88
+ function createWebChatApi(chatComponent) {
89
+ if (!chatComponent)
90
+ return null;
91
+ const el = chatComponent;
92
+ return {
93
+ selectConversation: id => callMethod(el, 'selectConversation', id),
94
+ sendText: (body, conversationId) => callMethod(el, 'sendText', body, conversationId),
95
+ sendMedia: (files, conversationId, caption) => callMethod(el, 'sendMedia', files, conversationId, caption),
96
+ setReply: message => callMethod(el, 'setReply', message),
97
+ clearReply: () => callMethod(el, 'clearReply'),
98
+ loadMoreMessages: () => callMethod(el, 'loadMoreMessages'),
99
+ loadMoreConversations: () => callMethod(el, 'loadMoreConversations'),
100
+ getChatState: () => callMethod(el, 'getChatState'),
101
+ setCustomParts: parts => callMethod(el, 'setCustomParts', parts),
102
+ on(event, handler) {
103
+ el.addEventListener(event, handler);
104
+ return () => el.removeEventListener(event, handler);
105
+ },
106
+ methods: WEB_CHAT_PUBLIC_METHODS,
107
+ events: WEB_CHAT_PUBLIC_EVENTS,
108
+ };
109
+ }
110
+
111
+ /**
112
+ * Framework-agnostic slot helpers.
113
+ * React / Angular / Vue / vanilla all end up calling these with real HTMLElements.
114
+ *
115
+ * Note: avoid `instanceof HTMLElement` — it fails across jsdom realms in Jest.
116
+ */
117
+ function isElement(node) {
118
+ return !!node && node.nodeType === 1;
119
+ }
120
+ function slotNameOf(el) {
121
+ return el.getAttribute('slot') || el.slot || null;
122
+ }
123
+ /** Attach (or replace) a named slot on <web-chat>. */
124
+ function setWebChatSlot(chatComponent, slotName, element) {
125
+ if (!chatComponent || !element)
126
+ return null;
127
+ clearWebChatSlot(chatComponent, slotName);
128
+ element.slot = slotName;
129
+ element.setAttribute('slot', slotName);
130
+ chatComponent.appendChild(element);
131
+ return element;
132
+ }
133
+ /** Remove host content for a named slot. */
134
+ function clearWebChatSlot(chatComponent, slotName) {
135
+ if (!chatComponent)
71
136
  return;
72
- Object.entries(slots).forEach(([name, el]) => {
73
- if (!el)
137
+ Array.from(chatComponent.children).forEach(node => {
138
+ if (!isElement(node))
74
139
  return;
75
- el.slot = name;
76
- chatComponent.appendChild(el);
140
+ if (slotNameOf(node) === slotName) {
141
+ node.remove();
142
+ }
77
143
  });
78
144
  }
79
- function getStoredComponents() {
145
+ /** Create a plain wrapper element ready to receive framework content (e.g. React portal target). */
146
+ function createSlotHost(slotName, className) {
147
+ const el = document.createElement('div');
148
+ el.slot = slotName;
149
+ el.setAttribute('slot', slotName);
150
+ el.setAttribute('data-isometrik-slot', slotName);
151
+ if (className)
152
+ el.className = className;
153
+ el.style.height = '100%';
154
+ el.style.width = '100%';
155
+ el.style.display = 'contents';
156
+ return el;
157
+ }
158
+ /** Attach many slots at once (same shape as initialize props.slots). */
159
+ function setWebChatSlots(chatComponent, slots) {
160
+ if (!chatComponent || !slots)
161
+ return;
162
+ Object.entries(slots).forEach(([name, el]) => {
163
+ if (el)
164
+ setWebChatSlot(chatComponent, name, el);
165
+ });
166
+ }
167
+
168
+ /**
169
+ * Last-mounted chat instance registry + resolvers.
170
+ * Prefer explicit elements; fall back to store; querySelector is last resort.
171
+ */
172
+ function getChatStore() {
80
173
  if (typeof window === 'undefined')
81
174
  return {};
82
175
  window.__isometrikChatComponents = window.__isometrikChatComponents || {};
83
176
  return window.__isometrikChatComponents;
84
177
  }
178
+ function setChatStore(partial) {
179
+ const store = getChatStore();
180
+ if (partial.themeProvider !== undefined)
181
+ store.themeProvider = partial.themeProvider;
182
+ if (partial.chatComponent !== undefined)
183
+ store.chatComponent = partial.chatComponent;
184
+ }
185
+ function clearChatStore() {
186
+ if (typeof window === 'undefined')
187
+ return;
188
+ window.__isometrikChatComponents = {};
189
+ }
190
+ /** Resolve <theme-provider> from an explicit node, store, or (last) DOM. */
191
+ function resolveThemeProvider(from) {
192
+ var _a, _b;
193
+ if (from) {
194
+ const el = from;
195
+ if (el.tagName === 'THEME-PROVIDER')
196
+ return el;
197
+ const closest = (_a = el.closest) === null || _a === void 0 ? void 0 : _a.call(el, 'theme-provider');
198
+ if (closest)
199
+ return closest;
200
+ const host = findWebChatHost(el);
201
+ if (((_b = host === null || host === void 0 ? void 0 : host.parentElement) === null || _b === void 0 ? void 0 : _b.tagName) === 'THEME-PROVIDER') {
202
+ return host.parentElement;
203
+ }
204
+ }
205
+ const stored = getChatStore().themeProvider;
206
+ if (stored)
207
+ return stored;
208
+ if (typeof document === 'undefined')
209
+ return null;
210
+ return document.querySelector('theme-provider');
211
+ }
212
+ /** Resolve <web-chat> from an explicit node, store, or (last) DOM. */
213
+ function resolveWebChat(from) {
214
+ if (from) {
215
+ const el = from;
216
+ if (el.tagName === 'WEB-CHAT')
217
+ return el;
218
+ const host = findWebChatHost(el);
219
+ if (host)
220
+ return host;
221
+ }
222
+ const stored = getChatStore().chatComponent;
223
+ if (stored)
224
+ return stored;
225
+ if (typeof document === 'undefined')
226
+ return null;
227
+ return document.querySelector('web-chat');
228
+ }
229
+
230
+ const DEFAULT_THEME_URL = 'https://isometrik-website-bucket.s3.ap-south-1.amazonaws.com/styles/chat-combined-theme.css';
231
+ /** Identity for reuse — same user + project + mount target → skip re-bootstrap. */
232
+ function buildWebchatSessionKey(props) {
233
+ return [
234
+ props.containerId || '__body__',
235
+ props.isometrikUserId,
236
+ props.userToken,
237
+ props.projectId,
238
+ props.accountId,
239
+ props.keysetId,
240
+ ].join('|');
241
+ }
242
+ function getRetainState() {
243
+ if (typeof window === 'undefined') {
244
+ return { count: 0, sessionKey: '', instance: null, pendingDestroy: null };
245
+ }
246
+ const w = window;
247
+ if (!w.__isometrikChatRetain) {
248
+ w.__isometrikChatRetain = {
249
+ count: 0,
250
+ sessionKey: '',
251
+ instance: null,
252
+ pendingDestroy: null,
253
+ };
254
+ }
255
+ return w.__isometrikChatRetain;
256
+ }
257
+ function resolveThemeObject(props) {
258
+ const merged = Object.assign(Object.assign({}, (props.themeObject || {})), (props.theme || {}));
259
+ const normalized = normalizeThemeObject(merged);
260
+ return Object.keys(normalized).length ? normalized : undefined;
261
+ }
262
+ function applyOptionalBool(el, key, value) {
263
+ if (value !== undefined)
264
+ el[key] = value;
265
+ }
266
+ function isLiveInstance(instance) {
267
+ if (!instance)
268
+ return false;
269
+ const { themeProvider, chatComponent } = instance;
270
+ if (!themeProvider || !chatComponent)
271
+ return false;
272
+ // isConnected may be false in some test envs; also accept store match
273
+ const store = getChatStore();
274
+ return store.chatComponent === chatComponent && store.themeProvider === themeProvider;
275
+ }
85
276
  /** Tear down existing chat instance (MQTT via disconnectedCallback, DOM). */
86
- const destroyChat = function () {
277
+ function destroyIsometrikWebchat() {
278
+ const retain = getRetainState();
279
+ if (retain.pendingDestroy) {
280
+ clearTimeout(retain.pendingDestroy);
281
+ retain.pendingDestroy = null;
282
+ }
283
+ retain.count = 0;
284
+ retain.sessionKey = '';
285
+ retain.instance = null;
87
286
  destroyChatDom();
88
287
  document.querySelectorAll('theme-provider').forEach(el => {
89
288
  if (!el.querySelector('web-chat') && el.childNodes.length === 0) {
90
289
  el.remove();
91
290
  }
92
291
  });
93
- };
94
- const initializeChat = function (props) {
292
+ clearChatStore();
293
+ }
294
+ /** @deprecated Use destroyIsometrikWebchat */
295
+ const destroyChat = destroyIsometrikWebchat;
296
+ /**
297
+ * Force mount: always tears down previous instance then creates a new one.
298
+ * Prefer `retainIsometrikWebchat` / `ensureIsometrikWebchat` in React/SPA hosts
299
+ * to avoid double bootstrap (Strict Mode / remount).
300
+ */
301
+ function initializeIsometrikWebchat(props) {
95
302
  if (!props.licenseKey ||
96
303
  !props.appSecret ||
97
304
  !props.userSecret ||
@@ -103,21 +310,21 @@ const initializeChat = function (props) {
103
310
  console.error('Missing required props to Initialize chat!');
104
311
  return null;
105
312
  }
106
- // Idempotent: destroy previous instance before creating a new one
107
- destroyChat();
313
+ destroyIsometrikWebchat();
314
+ const sessionKey = buildWebchatSessionKey(props);
108
315
  const themeProvider = document.createElement('theme-provider');
316
+ const themeUrl = props.themeUrl || DEFAULT_THEME_URL;
317
+ const themeObject = resolveThemeObject(props);
109
318
  if (props.defaultTheme) {
110
319
  themeProvider.setAttribute('mode', props.defaultTheme);
111
320
  }
112
- if (props.themeUrl) {
113
- themeProvider.setAttribute('theme-path', props.themeUrl);
114
- }
115
- else {
116
- themeProvider.setAttribute('theme-path', 'https://isometrik-website-bucket.s3.ap-south-1.amazonaws.com/styles/chat-combined-theme.css');
321
+ themeProvider.setAttribute('theme-path', themeUrl);
322
+ if (themeObject) {
323
+ themeProvider.themeObject = themeObject;
117
324
  }
118
325
  const chatComponent = document.createElement('web-chat');
119
- chatComponent.baseUrl = (props === null || props === void 0 ? void 0 : props.baseUrl) || 'https://apis.isometrik.io';
120
- chatComponent.hostUrl = (props === null || props === void 0 ? void 0 : props.hostUrl) || 'wss://connections.isometrik.io:2053/mqtt';
326
+ chatComponent.baseUrl = props.baseUrl || 'https://apis.isometrik.io';
327
+ chatComponent.hostUrl = props.hostUrl || 'wss://connections.isometrik.io:2053/mqtt';
121
328
  chatComponent.licenseKey = props.licenseKey;
122
329
  chatComponent.appSecret = props.appSecret;
123
330
  chatComponent.userSecret = props.userSecret;
@@ -127,24 +334,21 @@ const initializeChat = function (props) {
127
334
  chatComponent.keysetId = props.keysetId;
128
335
  chatComponent.accountId = props.accountId;
129
336
  chatComponent.defaultTheme = props.defaultTheme || 'light';
130
- chatComponent.themeUrl =
131
- props.themeUrl ||
132
- 'https://isometrik-website-bucket.s3.ap-south-1.amazonaws.com/styles/chat-combined-theme.css';
337
+ chatComponent.themeUrl = themeUrl;
133
338
  chatComponent.style.width = '100%';
134
339
  chatComponent.style.height = '100%';
135
340
  if (props.customParts) {
136
341
  chatComponent.customParts = props.customParts;
137
342
  }
138
- if (props.showProfileRail !== undefined) {
139
- chatComponent.showProfileRail = props.showProfileRail;
140
- }
141
- if (props.showChatWallpaper !== undefined) {
142
- chatComponent.showChatWallpaper = props.showChatWallpaper;
143
- }
144
- if (props.groupcastEnabled !== undefined) {
145
- chatComponent.groupcastEnabled = props.groupcastEnabled;
146
- }
147
- attachWebChatSlots(chatComponent, props.slots);
343
+ applyOptionalBool(chatComponent, 'showProfileRail', resolveShowProfileRailProp(props));
344
+ applyOptionalBool(chatComponent, 'showChatWallpaper', props.showChatWallpaper);
345
+ applyOptionalBool(chatComponent, 'groupcastEnabled', props.groupcastEnabled);
346
+ applyOptionalBool(chatComponent, 'showHeader', props.showHeader);
347
+ applyOptionalBool(chatComponent, 'showComposer', props.showComposer);
348
+ applyOptionalBool(chatComponent, 'showEmptyState', props.showEmptyState);
349
+ applyOptionalBool(chatComponent, 'showConversationList', props.showConversationList);
350
+ applyOptionalBool(chatComponent, 'showRightPanel', props.showRightPanel);
351
+ setWebChatSlots(chatComponent, props.slots);
148
352
  themeProvider.appendChild(chatComponent);
149
353
  themeProvider.style.width = '100%';
150
354
  themeProvider.style.height = '100%';
@@ -157,13 +361,258 @@ const initializeChat = function (props) {
157
361
  console.error('Container with the specified ID not found. Appending to body instead.');
158
362
  document.body.appendChild(themeProvider);
159
363
  }
160
- const stored = getStoredComponents();
161
- stored.themeProvider = themeProvider;
162
- stored.chatComponent = chatComponent;
163
- return { themeProvider, chatComponent, destroy: destroyChat };
364
+ setChatStore({ themeProvider, chatComponent });
365
+ const api = createWebChatApi(chatComponent);
366
+ const instance = {
367
+ themeProvider,
368
+ chatComponent,
369
+ api,
370
+ sessionKey,
371
+ destroy: destroyIsometrikWebchat,
372
+ };
373
+ const retain = getRetainState();
374
+ retain.instance = instance;
375
+ retain.sessionKey = sessionKey;
376
+ retain.count = Math.max(retain.count, 1);
377
+ return instance;
378
+ }
379
+ /**
380
+ * Reuse live instance when session key matches (same user/token/container).
381
+ * Otherwise mounts fresh. Does not bump retain count — use `retainIsometrikWebchat` in React.
382
+ */
383
+ function ensureIsometrikWebchat(props) {
384
+ const retain = getRetainState();
385
+ if (retain.pendingDestroy) {
386
+ clearTimeout(retain.pendingDestroy);
387
+ retain.pendingDestroy = null;
388
+ }
389
+ const key = buildWebchatSessionKey(props);
390
+ if (retain.sessionKey === key && isLiveInstance(retain.instance)) {
391
+ return retain.instance;
392
+ }
393
+ return initializeIsometrikWebchat(props);
394
+ }
395
+ /**
396
+ * React / SPA friendly: acquire a chat instance.
397
+ * Pair with `releaseIsometrikWebchat` in effect cleanup.
398
+ * Survives React 18 Strict Mode double-mount without a second bootstrap.
399
+ */
400
+ function retainIsometrikWebchat(props) {
401
+ const retain = getRetainState();
402
+ if (retain.pendingDestroy) {
403
+ clearTimeout(retain.pendingDestroy);
404
+ retain.pendingDestroy = null;
405
+ }
406
+ retain.count += 1;
407
+ return ensureIsometrikWebchat(props);
408
+ }
409
+ /**
410
+ * Release a retain from `retainIsometrikWebchat`.
411
+ * Destroy is deferred so Strict Mode remount can cancel it.
412
+ * @param delayMs default 0 (macrotask) — enough for React 18 Strict Mode
413
+ */
414
+ function releaseIsometrikWebchat(delayMs = 0) {
415
+ const retain = getRetainState();
416
+ retain.count = Math.max(0, retain.count - 1);
417
+ if (retain.count > 0)
418
+ return;
419
+ if (retain.pendingDestroy)
420
+ clearTimeout(retain.pendingDestroy);
421
+ retain.pendingDestroy = setTimeout(() => {
422
+ retain.pendingDestroy = null;
423
+ if (retain.count > 0)
424
+ return;
425
+ destroyIsometrikWebchat();
426
+ }, delayMs);
427
+ }
428
+ /** @deprecated Use initializeIsometrikWebchat */
429
+ const initializeChat = initializeIsometrikWebchat;
430
+
431
+ /**
432
+ * Headless REST helpers — same paths the shell uses.
433
+ * Call session.init before other methods when not mounting <web-chat>.
434
+ */
435
+ const isometrikWebchatApi = {
436
+ session: {
437
+ init: (config) => initializeChatSdk(config),
438
+ fetchUserDetails,
439
+ },
440
+ conversations: {
441
+ list: fetchConversationsPage,
442
+ details: fetchConversationDetails,
443
+ sortByLatest: sortConversationsByLatestMessage,
444
+ mergeUnique: mergeUniqueConversations,
445
+ },
446
+ messages: {
447
+ list: fetchMessagesPage,
448
+ search: searchMessages,
449
+ links: fetchLinkMessages,
450
+ mediaCount: fetchMediaCount,
451
+ mediaAttachments: fetchMediaAttachments,
452
+ filterMedia: filterMediaMessages,
453
+ },
454
+ groupcast: {
455
+ details: fetchGroupcastDetails,
456
+ members: fetchGroupcastMembersPage,
457
+ contacts: fetchGroupcastContactsPage,
458
+ },
459
+ media: {
460
+ mediaTypeFromMime,
461
+ customTypeFromMime,
462
+ prepareMediaAttachments,
463
+ buildReplyMetaData,
464
+ },
164
465
  };
165
- const customChatSidebar = function (props) {
166
- const chatComponent = document.querySelector('web-chat');
466
+
467
+ /**
468
+ * React → WebChat bridge (no React dependency in this package).
469
+ *
470
+ * Hosts pass their own `createElement` + `createRoot` so the core SDK stays
471
+ * framework-agnostic.
472
+ *
473
+ * 1) Panels (slots): mountReactInSlot → HTMLElement for `slots['profile-rail']`
474
+ * 2) Rows/overlays (customParts): defineReactCustomPart → CE tag for customParts
475
+ */
476
+ const ROOT_KEY = '__isometrikReactBridge';
477
+ function paint(store, react, propsFromHost) {
478
+ store.root.render(react.createElement(store.Component, Object.assign(Object.assign({}, (store.extraProps || {})), propsFromHost)));
479
+ }
480
+ /**
481
+ * Wrap a React component as a custom element for `customParts`.
482
+ * SDK assigns props (conversation, onSelect, …); we re-render React.
483
+ *
484
+ * @example
485
+ * import { createElement } from 'react';
486
+ * import { createRoot } from 'react-dom/client';
487
+ * defineReactCustomPart('app-chat-tile', MyTile, {
488
+ * react: { createElement },
489
+ * createRoot,
490
+ * propKeys: ['conversation', 'isSelected', 'unreadCount', 'previewText', 'onSelect'],
491
+ * });
492
+ * initializeIsometrikWebchat({ customParts: { chatTile: 'app-chat-tile' }, … });
493
+ */
494
+ function defineReactCustomPart(tag, Component, opts) {
495
+ if (typeof customElements === 'undefined')
496
+ return tag;
497
+ if (customElements.get(tag))
498
+ return tag;
499
+ const { react, createRoot, propKeys, extraProps } = opts;
500
+ class ReactPart extends HTMLElement {
501
+ constructor() {
502
+ super(...arguments);
503
+ this._store = null;
504
+ }
505
+ connectedCallback() {
506
+ if (!this._store) {
507
+ this._store = { root: createRoot(this), Component, extraProps };
508
+ }
509
+ this.render();
510
+ }
511
+ disconnectedCallback() {
512
+ var _a;
513
+ try {
514
+ (_a = this._store) === null || _a === void 0 ? void 0 : _a.root.unmount();
515
+ }
516
+ catch (_b) {
517
+ /* unmount is best-effort */
518
+ }
519
+ this._store = null;
520
+ }
521
+ /** Called by applyCustomPartProps after Object.assign. */
522
+ render() {
523
+ if (!this._store || !this.isConnected)
524
+ return;
525
+ const fromSetters = {};
526
+ propKeys.forEach(key => {
527
+ fromSetters[key] = this[`_${key}`];
528
+ });
529
+ paint(this._store, react, fromSetters);
530
+ }
531
+ }
532
+ propKeys.forEach(key => {
533
+ const store = `_${key}`;
534
+ Object.defineProperty(ReactPart.prototype, key, {
535
+ get() {
536
+ return this[store];
537
+ },
538
+ set(value) {
539
+ if (this[store] === value)
540
+ return;
541
+ this[store] = value;
542
+ if (this.isConnected)
543
+ this.render();
544
+ },
545
+ configurable: true,
546
+ });
547
+ });
548
+ customElements.define(tag, ReactPart);
549
+ return tag;
550
+ }
551
+ /**
552
+ * Mount a React component into a slot host for panel overrides.
553
+ * Pass the returned element in `slots: { 'profile-rail': el }`.
554
+ *
555
+ * @example
556
+ * const rail = mountReactInSlot('profile-rail', MyProfileRail, {
557
+ * react: { createElement },
558
+ * createRoot,
559
+ * props: { userId: '…' },
560
+ * });
561
+ * initializeIsometrikWebchat({ slots: { 'profile-rail': rail }, … });
562
+ * // later: rail.updateProps({ badge: 3 }); rail.unmount();
563
+ */
564
+ function mountReactInSlot(slotName, Component, opts) {
565
+ const host = createSlotHost(slotName, opts.className);
566
+ // display:contents can break React roots — use block for React mounts.
567
+ host.style.display = 'block';
568
+ host.style.height = '100%';
569
+ const store = {
570
+ root: opts.createRoot(host),
571
+ Component,
572
+ extraProps: opts.props,
573
+ };
574
+ host[ROOT_KEY] = store;
575
+ paint(store, opts.react, {});
576
+ host.updateProps = (next) => {
577
+ store.extraProps = Object.assign(Object.assign({}, (store.extraProps || {})), next);
578
+ paint(store, opts.react, {});
579
+ };
580
+ host.unmount = () => {
581
+ try {
582
+ store.root.unmount();
583
+ }
584
+ catch (_a) {
585
+ /* ignore */
586
+ }
587
+ delete host[ROOT_KEY];
588
+ };
589
+ return host;
590
+ }
591
+ function unmountReactSlot(host) {
592
+ if (!host)
593
+ return;
594
+ const anyHost = host;
595
+ if (typeof anyHost.unmount === 'function') {
596
+ anyHost.unmount();
597
+ return;
598
+ }
599
+ const store = host[ROOT_KEY];
600
+ if (!store)
601
+ return;
602
+ try {
603
+ store.root.unmount();
604
+ }
605
+ catch (_a) {
606
+ /* ignore */
607
+ }
608
+ delete host[ROOT_KEY];
609
+ }
610
+
611
+ /**
612
+ * Theme / sidebar controls — instance-first (no bare querySelector in happy path).
613
+ */
614
+ function customChatSidebar(props, from) {
615
+ const chatComponent = resolveWebChat(from);
167
616
  if (!chatComponent) {
168
617
  console.error('Isometrik chat is not initialized');
169
618
  return;
@@ -171,20 +620,24 @@ const customChatSidebar = function (props) {
171
620
  if (props.isChatFilter !== undefined) {
172
621
  chatComponent.isChatFilter = props.isChatFilter;
173
622
  }
174
- };
175
- const switchChatTheme = function (theme) {
176
- const chatElements = document.getElementsByTagName('web-chat');
177
- for (let i = 0; i < chatElements.length; i++) {
178
- const chatWeb = chatElements[i];
179
- chatWeb.defaultTheme = theme;
180
- const themeProvider = getStoredComponents().themeProvider;
181
- if (themeProvider) {
182
- themeProvider.setAttribute('mode', theme);
623
+ }
624
+ function switchChatTheme(theme, from) {
625
+ const themeProvider = resolveThemeProvider(from);
626
+ const chat = resolveWebChat(from);
627
+ if (chat) {
628
+ chat.defaultTheme = theme;
629
+ }
630
+ if (themeProvider) {
631
+ themeProvider.setAttribute('mode', theme);
632
+ if (typeof themeProvider.setTheme === 'function') {
633
+ themeProvider.setTheme(theme);
183
634
  }
635
+ return;
184
636
  }
185
- };
186
- const applyCustomTheme = function (customTheme) {
187
- const themeProvider = document.querySelector('theme-provider');
637
+ console.error('Theme provider is not initialized');
638
+ }
639
+ function applyCustomTheme(customTheme, from) {
640
+ const themeProvider = resolveThemeProvider(from);
188
641
  if (!themeProvider) {
189
642
  console.error('Theme provider is not initialized');
190
643
  return;
@@ -193,26 +646,64 @@ const applyCustomTheme = function (customTheme) {
193
646
  themeProvider.setAttribute('theme-path', customTheme.themePath);
194
647
  }
195
648
  if (customTheme.themeObject) {
196
- themeProvider.themeObject = customTheme.themeObject;
649
+ themeProvider.themeObject = normalizeThemeObject(customTheme.themeObject);
197
650
  }
198
- };
199
- const toggleTheme = function () {
200
- const themeProvider = document.querySelector('theme-provider');
651
+ }
652
+ function toggleTheme(from) {
653
+ const themeProvider = resolveThemeProvider(from);
201
654
  if (!themeProvider) {
202
655
  console.error('Theme provider is not initialized');
203
656
  return;
204
657
  }
205
- themeProvider.toggleTheme();
206
- };
658
+ if (typeof themeProvider.toggleTheme === 'function') {
659
+ themeProvider.toggleTheme();
660
+ }
661
+ }
662
+
663
+ /**
664
+ * Expose public SDK helpers on window for www demos / script-tag hosts.
665
+ * Bundlers should prefer named ESM imports from the package entry.
666
+ */
667
+ function appGlobalScript () {
668
+ if (typeof window === 'undefined')
669
+ return;
670
+ const w = window;
671
+ w.initializeIsometrikWebchat = initializeIsometrikWebchat;
672
+ w.destroyIsometrikWebchat = destroyIsometrikWebchat;
673
+ w.ensureIsometrikWebchat = ensureIsometrikWebchat;
674
+ w.retainIsometrikWebchat = retainIsometrikWebchat;
675
+ w.releaseIsometrikWebchat = releaseIsometrikWebchat;
676
+ w.initializeChat = initializeIsometrikWebchat;
677
+ w.destroyChat = destroyIsometrikWebchat;
678
+ w.isometrikWebchatApi = isometrikWebchatApi;
679
+ w.createWebChatApi = createWebChatApi;
680
+ w.THEME_TOKEN_NAMES = THEME_TOKEN_NAMES;
681
+ w.mountReactInSlot = mountReactInSlot;
682
+ w.defineReactCustomPart = defineReactCustomPart;
683
+ w.unmountReactSlot = unmountReactSlot;
684
+ w.switchChatTheme = switchChatTheme;
685
+ w.applyCustomTheme = applyCustomTheme;
686
+ w.toggleTheme = toggleTheme;
687
+ w.resolveThemeProvider = resolveThemeProvider;
688
+ w.resolveWebChat = resolveWebChat;
689
+ }
690
+
691
+ const globalScripts = appGlobalScript;
692
+
207
693
  if (typeof window !== 'undefined') {
208
- window.initializeChat = initializeChat;
209
- window.destroyChat = destroyChat;
694
+ window.initializeIsometrikWebchat = initializeIsometrikWebchat;
695
+ window.destroyIsometrikWebchat = destroyIsometrikWebchat;
696
+ window.initializeChat = initializeIsometrikWebchat;
697
+ window.destroyChat = destroyIsometrikWebchat;
698
+ window.isometrikWebchatApi = isometrikWebchatApi;
210
699
  window.chatSidebarProps = customChatSidebar;
211
700
  window.switchChatTheme = switchChatTheme;
212
701
  window.applyCustomTheme = applyCustomTheme;
213
702
  window.toggleTheme = toggleTheme;
214
703
  }
215
704
 
216
- export { WEB_CHAT_PUBLIC_EVENTS, WEB_CHAT_PUBLIC_METHODS, applyCustomTheme, customChatSidebar, defineReactiveCustomPart, destroyChat, initializeChat, switchChatTheme, toggleTheme };
705
+ globalScripts();
706
+
707
+ export { WEB_CHAT_PUBLIC_EVENTS, WEB_CHAT_PUBLIC_METHODS, applyCustomTheme, buildWebchatSessionKey, clearWebChatSlot, createSlotHost, createWebChatApi, customChatSidebar, defineReactCustomPart, defineReactiveCustomPart, destroyChat, destroyIsometrikWebchat, ensureIsometrikWebchat, getChatStore, initializeChat, initializeIsometrikWebchat, isometrikWebchatApi, mountReactInSlot, releaseIsometrikWebchat, resolveThemeProvider, resolveWebChat, retainIsometrikWebchat, setWebChatSlot, setWebChatSlots, switchChatTheme, toggleTheme, unmountReactSlot };
217
708
 
218
709
  //# sourceMappingURL=index.js.map