isometrik-plugin-chat-sdk 1.3.18 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 +708 -376
  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 +152 -41
  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 +643 -312
  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 +691 -359
  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 +13 -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-09fc122b.entry.js +0 -2
  439. package/dist/isometrik-webchat/p-09fc122b.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
@@ -0,0 +1,728 @@
1
+ import { M } from './index.m.js';
2
+ import { C as CHAT_CREDS, i as isometrikFlutterAppSecrets } from './chat-creds.js';
3
+ import { g as getGroupcast, a as getGroupcastMembers } from './groupcast.js';
4
+ import { t as takeMediaFiles } from './media-limits.js';
5
+
6
+ /**
7
+ * UI composition helpers for the shell.
8
+ * Pure functions — easy to unit test, no Stencil.
9
+ *
10
+ * Matrix for every region:
11
+ * show === false → hidden (wins over custom slot)
12
+ * custom slot → custom
13
+ * else → SDK default
14
+ */
15
+ function resolveRegionMode(opts) {
16
+ if (opts.show === false)
17
+ return 'hidden';
18
+ if (opts.hasCustomSlot)
19
+ return 'custom';
20
+ return 'default';
21
+ }
22
+ /**
23
+ * Profile icon rail resolution (same matrix as resolveRegionMode).
24
+ */
25
+ function resolveProfileRailMode(opts) {
26
+ return resolveRegionMode({
27
+ show: opts.showProfileRail,
28
+ hasCustomSlot: opts.hasCustomSlot,
29
+ });
30
+ }
31
+ /**
32
+ * Init prop alias: showProfileSidebar wins over showProfileRail when both set.
33
+ * Returns undefined when neither is passed (component default applies).
34
+ */
35
+ function resolveShowProfileRailProp(opts) {
36
+ if (opts.showProfileSidebar !== undefined && opts.showProfileRail !== undefined) {
37
+ if (opts.showProfileSidebar !== opts.showProfileRail) {
38
+ console.warn('[isometrik-webchat] showProfileSidebar and showProfileRail disagree; using showProfileSidebar');
39
+ }
40
+ return opts.showProfileSidebar;
41
+ }
42
+ if (opts.showProfileSidebar !== undefined)
43
+ return opts.showProfileSidebar;
44
+ if (opts.showProfileRail !== undefined)
45
+ return opts.showProfileRail;
46
+ return undefined;
47
+ }
48
+
49
+ /** Newest last-message first. Skips empty/cleared last messages when sorting. */
50
+ function sortConversationsByLatestMessage(conversations) {
51
+ return [...conversations].sort((a, b) => {
52
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
53
+ if ((((_a = a === null || a === void 0 ? void 0 : a.lastMessageDetails) === null || _a === void 0 ? void 0 : _a.action) == 'chatMessageSent' || ((_b = a === null || a === void 0 ? void 0 : a.lastMessageDetails) === null || _b === void 0 ? void 0 : _b.action) == 'forward') &&
54
+ (((_c = a === null || a === void 0 ? void 0 : a.lastMessageDetails) === null || _c === void 0 ? void 0 : _c.body) === '' || ((_d = a === null || a === void 0 ? void 0 : a.lastMessageDetails) === null || _d === void 0 ? void 0 : _d.action) === 'clearConversation')) {
55
+ return 0;
56
+ }
57
+ if ((((_e = b === null || b === void 0 ? void 0 : b.lastMessageDetails) === null || _e === void 0 ? void 0 : _e.action) == 'chatMessageSent' || ((_f = b === null || b === void 0 ? void 0 : b.lastMessageDetails) === null || _f === void 0 ? void 0 : _f.action) == 'forward') &&
58
+ (((_g = b === null || b === void 0 ? void 0 : b.lastMessageDetails) === null || _g === void 0 ? void 0 : _g.body) === '' || ((_h = b === null || b === void 0 ? void 0 : b.lastMessageDetails) === null || _h === void 0 ? void 0 : _h.action) === 'clearConversation')) {
59
+ return 0;
60
+ }
61
+ const timestampA = (_j = a === null || a === void 0 ? void 0 : a.lastMessageDetails) === null || _j === void 0 ? void 0 : _j.updatedAt;
62
+ const timestampB = (_k = b === null || b === void 0 ? void 0 : b.lastMessageDetails) === null || _k === void 0 ? void 0 : _k.updatedAt;
63
+ return timestampB - timestampA;
64
+ });
65
+ }
66
+ function mergeUniqueConversations(existing, incoming) {
67
+ const list = Array.isArray(existing) ? existing : [];
68
+ const next = Array.isArray(incoming) ? incoming : [];
69
+ return [
70
+ ...list,
71
+ ...next.filter(newConv => !list.some(existingConv => existingConv.conversationId === newConv.conversationId)),
72
+ ];
73
+ }
74
+ async function fetchConversationsPage(opts) {
75
+ var _a, _b, _c;
76
+ const query = {
77
+ limit: (_a = opts.limit) !== null && _a !== void 0 ? _a : 20,
78
+ skip: (_b = opts.skip) !== null && _b !== void 0 ? _b : 0,
79
+ includeMembers: (_c = opts.includeMembers) !== null && _c !== void 0 ? _c : true,
80
+ };
81
+ if (opts.searchTag)
82
+ query.searchTag = opts.searchTag;
83
+ const res = await M.getInstance().Conversation.getConversations(query);
84
+ return (res === null || res === void 0 ? void 0 : res.conversations) || [];
85
+ }
86
+ async function fetchConversationDetails(conversationId, includeMembers = true) {
87
+ const res = await M.getInstance().Conversation.getConversationDetails({ conversationId, includeMembers }, conversationId);
88
+ return res === null || res === void 0 ? void 0 : res.conversationDetails;
89
+ }
90
+
91
+ /** Init ChatSDK singleton. Props win; chat-creds used as local-demo fallback. */
92
+ function initializeChatSdk(config) {
93
+ M.initializeInstance({
94
+ baseUrl: config.baseUrl || CHAT_CREDS.baseUrl,
95
+ licenseKey: config.licenseKey || isometrikFlutterAppSecrets.licenseKey,
96
+ appSecret: config.appSecret || isometrikFlutterAppSecrets.appSecret,
97
+ userSecret: config.userSecret || isometrikFlutterAppSecrets.userSecret,
98
+ userToken: config.userToken,
99
+ });
100
+ }
101
+ /** Normalize getUserDetails API response into the shape WebChat stores. */
102
+ async function fetchUserDetails() {
103
+ var _a, _b, _c;
104
+ const res = await M.getInstance().user.getUserDetails();
105
+ return {
106
+ userId: (res === null || res === void 0 ? void 0 : res.userId) || '',
107
+ userIdentifier: (res === null || res === void 0 ? void 0 : res.userIdentifier) || '',
108
+ firstName: ((_a = res === null || res === void 0 ? void 0 : res.metaData) === null || _a === void 0 ? void 0 : _a.firstName) || '',
109
+ lastName: ((_b = res === null || res === void 0 ? void 0 : res.metaData) === null || _b === void 0 ? void 0 : _b.lastName) || '',
110
+ updatedAt: (res === null || res === void 0 ? void 0 : res.updatedAt) || '',
111
+ userName: (res === null || res === void 0 ? void 0 : res.userName) || '',
112
+ online: (res === null || res === void 0 ? void 0 : res.online) || '',
113
+ userProfileImageUrl: (res === null || res === void 0 ? void 0 : res.userProfileImageUrl) || '',
114
+ profilePic: ((_c = res === null || res === void 0 ? void 0 : res.metaData) === null || _c === void 0 ? void 0 : _c.profilePic) || '',
115
+ };
116
+ }
117
+
118
+ async function fetchGroupcastDetails(groupcastId) {
119
+ var _a;
120
+ const res = await getGroupcast({ ids: groupcastId });
121
+ return ((_a = res === null || res === void 0 ? void 0 : res.groupcasts) === null || _a === void 0 ? void 0 : _a[0]) || null;
122
+ }
123
+ async function fetchGroupcastMembersPage(groupcastId) {
124
+ const res = await getGroupcastMembers({ groupcastId });
125
+ return (res === null || res === void 0 ? void 0 : res.members) || [];
126
+ }
127
+ async function fetchGroupcastContactsPage(opts = {}) {
128
+ var _a, _b;
129
+ const res = await getGroupcast({ skip: (_a = opts.skip) !== null && _a !== void 0 ? _a : 0, limit: (_b = opts.limit) !== null && _b !== void 0 ? _b : 20 });
130
+ return (res === null || res === void 0 ? void 0 : res.groupcasts) || [];
131
+ }
132
+
133
+ /**
134
+ * Shared media-send helpers for ChatFooter + public web-chat.sendMedia.
135
+ * Conversation path only (groupcast keeps using ChatFooter).
136
+ */
137
+ function mediaTypeFromMime(mime) {
138
+ if (!mime)
139
+ return 3;
140
+ if (mime.startsWith('image/'))
141
+ return 0;
142
+ if (mime.startsWith('video/'))
143
+ return 1;
144
+ if (mime.startsWith('audio/'))
145
+ return 2;
146
+ return 3;
147
+ }
148
+ function customTypeFromMime(mime) {
149
+ if (!mime)
150
+ return 'AttachmentMessage:Multiple';
151
+ if (mime.startsWith('image/'))
152
+ return 'AttachmentMessage:Image';
153
+ if (mime.startsWith('video/'))
154
+ return 'AttachmentMessage:Video';
155
+ if (mime.startsWith('audio/'))
156
+ return 'AttachmentMessage:Audio';
157
+ if (mime.startsWith('application/'))
158
+ return 'AttachmentMessage:Doc';
159
+ return 'AttachmentMessage:Multiple';
160
+ }
161
+ function buildReplyMetaData(replyMessage, caption) {
162
+ var _a, _b, _c;
163
+ if (!replyMessage && !(caption === null || caption === void 0 ? void 0 : caption.trim()))
164
+ return {};
165
+ return Object.assign(Object.assign({}, (replyMessage && Object.assign({ parentMessageId: replyMessage.messageId, parentMessage: replyMessage.body, parentMessageTime: replyMessage.sentAt, parentMessageSenderId: ((_a = replyMessage.senderInfo) === null || _a === void 0 ? void 0 : _a.userId) || replyMessage.senderId, parentMessageSenderName: ((_b = replyMessage.senderInfo) === null || _b === void 0 ? void 0 : _b.userName) || replyMessage.userName }, (((_c = replyMessage === null || replyMessage === void 0 ? void 0 : replyMessage.attachments) === null || _c === void 0 ? void 0 : _c[0]) && {
166
+ parentMessageName: replyMessage.attachments[0].name,
167
+ parentMessageMediaUrl: replyMessage.attachments[0].mediaUrl,
168
+ parentMessageType: replyMessage.attachments[0].mimeType,
169
+ })))), ((caption === null || caption === void 0 ? void 0 : caption.trim()) && { captionMessage: caption.trim() }));
170
+ }
171
+ function prepareMediaAttachments(files) {
172
+ // Hard-cap so public API / footer can't exceed one-message limit.
173
+ const capped = takeMediaFiles(files, 0).accepted;
174
+ return capped.map(file => ({
175
+ nameWithExtension: file.name,
176
+ mediaType: mediaTypeFromMime(file.type),
177
+ mediaId: String(file.lastModified || Date.now()) + Math.random().toString(36).slice(2, 6),
178
+ mimeType: file.type || 'application/octet-stream',
179
+ size: file.size,
180
+ file,
181
+ }));
182
+ }
183
+ function buildLocalMediaAttachments(files) {
184
+ return files.map(file => ({
185
+ name: file.name,
186
+ size: file.size,
187
+ type: (file.type || '').split('/')[0] || 'file',
188
+ mediaUrl: typeof URL !== 'undefined' ? URL.createObjectURL(file) : '',
189
+ mimeType: file.type || 'application/octet-stream',
190
+ }));
191
+ }
192
+ /** Presign → PUT files → postMessages. Returns API messageId. */
193
+ async function uploadAndPostMediaMessage(args) {
194
+ const { conversationId, deviceId, attachments, replyMessage, caption, mentionedUsers } = args;
195
+ if (!conversationId || !(attachments === null || attachments === void 0 ? void 0 : attachments.length))
196
+ return null;
197
+ const resForPresignedUrl = await M.getInstance().message.postMessagesPresignedurls({
198
+ conversationId,
199
+ attachments,
200
+ });
201
+ const presignedUrls = (resForPresignedUrl === null || resForPresignedUrl === void 0 ? void 0 : resForPresignedUrl.presignedUrls)
202
+ ? resForPresignedUrl.presignedUrls
203
+ : (resForPresignedUrl === null || resForPresignedUrl === void 0 ? void 0 : resForPresignedUrl.presignedUrl)
204
+ ? [resForPresignedUrl]
205
+ : null;
206
+ if (!(presignedUrls === null || presignedUrls === void 0 ? void 0 : presignedUrls.length)) {
207
+ throw new Error('No presigned URLs returned for media upload');
208
+ }
209
+ const allPayloads = [];
210
+ await Promise.all(presignedUrls.map(async (urlDetails, index) => {
211
+ const { mediaPresignedUrl, mediaId, mediaUrl, thumbnailUrl } = urlDetails;
212
+ const attachmentPayload = attachments[index];
213
+ if (!attachmentPayload || !mediaPresignedUrl)
214
+ return;
215
+ allPayloads.push({
216
+ mediaId,
217
+ mediaUrl,
218
+ thumbnailUrl,
219
+ mediaType: attachmentPayload.mediaType,
220
+ nameWithExtension: attachmentPayload.nameWithExtension,
221
+ name: attachmentPayload.nameWithExtension,
222
+ mimeType: attachmentPayload.mimeType,
223
+ extension: attachmentPayload.mimeType.split('/')[1] || '',
224
+ size: attachmentPayload.size,
225
+ attachmentType: 0,
226
+ });
227
+ await fetch(mediaPresignedUrl, {
228
+ method: 'PUT',
229
+ body: attachmentPayload.file,
230
+ headers: { 'Content-Type': attachmentPayload.mimeType },
231
+ });
232
+ }));
233
+ const customType = attachments.length === 1 ? customTypeFromMime(attachments[0].mimeType) : 'AttachmentMessage:Multiple';
234
+ const payload = {
235
+ showInConversation: true,
236
+ messageType: replyMessage ? 2 : 0,
237
+ parentMessageId: replyMessage === null || replyMessage === void 0 ? void 0 : replyMessage.messageId,
238
+ encrypted: false,
239
+ conversationId,
240
+ body: (caption === null || caption === void 0 ? void 0 : caption.trim()) || 'AttachmentMessage:Multiple',
241
+ customType,
242
+ attachments: allPayloads,
243
+ deviceId,
244
+ metaData: buildReplyMetaData(replyMessage, caption),
245
+ };
246
+ if (mentionedUsers === null || mentionedUsers === void 0 ? void 0 : mentionedUsers.length)
247
+ payload.mentionedUsers = mentionedUsers;
248
+ const sendMessageRes = await M.getInstance().message.postMessages(payload);
249
+ return (sendMessageRes === null || sendMessageRes === void 0 ? void 0 : sendMessageRes.messageId) || null;
250
+ }
251
+
252
+ /**
253
+ * Minimal IndexedDB wrapper — no extra dependency.
254
+ * DB: isometrik-webchat-v1
255
+ */
256
+ var __rest = (undefined && undefined.__rest) || function (s, e) {
257
+ var t = {};
258
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
259
+ t[p] = s[p];
260
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
261
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
262
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
263
+ t[p[i]] = s[p[i]];
264
+ }
265
+ return t;
266
+ };
267
+ const DB_NAME = 'isometrik-webchat-v1';
268
+ const DB_VERSION = 1;
269
+ function openDb() {
270
+ return new Promise((resolve, reject) => {
271
+ const req = indexedDB.open(DB_NAME, DB_VERSION);
272
+ req.onupgradeneeded = () => {
273
+ const db = req.result;
274
+ if (!db.objectStoreNames.contains('conversations')) {
275
+ const s = db.createObjectStore('conversations', { keyPath: 'id' });
276
+ s.createIndex('userId', 'userId', { unique: false });
277
+ }
278
+ if (!db.objectStoreNames.contains('messages')) {
279
+ const s = db.createObjectStore('messages', { keyPath: 'id' });
280
+ s.createIndex('userId', 'userId', { unique: false });
281
+ s.createIndex('userConv', ['userId', 'conversationId'], { unique: false });
282
+ }
283
+ if (!db.objectStoreNames.contains('outbox')) {
284
+ const s = db.createObjectStore('outbox', { keyPath: 'localId' });
285
+ s.createIndex('userId', 'userId', { unique: false });
286
+ }
287
+ if (!db.objectStoreNames.contains('meta')) {
288
+ db.createObjectStore('meta', { keyPath: 'key' });
289
+ }
290
+ };
291
+ req.onsuccess = () => resolve(req.result);
292
+ req.onerror = () => reject(req.error);
293
+ });
294
+ }
295
+ function reqToPromise(req) {
296
+ return new Promise((resolve, reject) => {
297
+ req.onsuccess = () => resolve(req.result);
298
+ req.onerror = () => reject(req.error);
299
+ });
300
+ }
301
+ function txDone(tx) {
302
+ return new Promise((resolve, reject) => {
303
+ tx.oncomplete = () => resolve();
304
+ tx.onerror = () => reject(tx.error);
305
+ tx.onabort = () => reject(tx.error);
306
+ });
307
+ }
308
+ class IdbOfflineDb {
309
+ constructor() {
310
+ this.dbPromise = null;
311
+ }
312
+ db() {
313
+ if (!this.dbPromise)
314
+ this.dbPromise = openDb();
315
+ return this.dbPromise;
316
+ }
317
+ async putConversation(row) {
318
+ const db = await this.db();
319
+ const tx = db.transaction('conversations', 'readwrite');
320
+ tx.objectStore('conversations').put(Object.assign(Object.assign({}, row), { id: `${row.userId}:${row.conversationId}` }));
321
+ await txDone(tx);
322
+ }
323
+ async putConversations(rows) {
324
+ if (!rows.length)
325
+ return;
326
+ const db = await this.db();
327
+ const tx = db.transaction('conversations', 'readwrite');
328
+ const store = tx.objectStore('conversations');
329
+ for (const row of rows) {
330
+ store.put(Object.assign(Object.assign({}, row), { id: `${row.userId}:${row.conversationId}` }));
331
+ }
332
+ await txDone(tx);
333
+ }
334
+ async getConversations(userId) {
335
+ const db = await this.db();
336
+ const tx = db.transaction('conversations', 'readonly');
337
+ const idx = tx.objectStore('conversations').index('userId');
338
+ const rows = await reqToPromise(idx.getAll(userId));
339
+ return (rows || []).map((_a) => {
340
+ var rest = __rest(_a, ["id"]);
341
+ return rest;
342
+ });
343
+ }
344
+ async putMessage(row) {
345
+ const db = await this.db();
346
+ const tx = db.transaction('messages', 'readwrite');
347
+ tx.objectStore('messages').put(Object.assign(Object.assign({}, row), { id: `${row.userId}:${row.messageId}` }));
348
+ await txDone(tx);
349
+ }
350
+ async putMessages(rows) {
351
+ if (!rows.length)
352
+ return;
353
+ const db = await this.db();
354
+ const tx = db.transaction('messages', 'readwrite');
355
+ const store = tx.objectStore('messages');
356
+ for (const row of rows) {
357
+ store.put(Object.assign(Object.assign({}, row), { id: `${row.userId}:${row.messageId}` }));
358
+ }
359
+ await txDone(tx);
360
+ }
361
+ async getMessages(userId, conversationId) {
362
+ const db = await this.db();
363
+ const tx = db.transaction('messages', 'readonly');
364
+ const idx = tx.objectStore('messages').index('userConv');
365
+ const rows = await reqToPromise(idx.getAll([userId, conversationId]));
366
+ const list = (rows || []).map((_a) => {
367
+ var rest = __rest(_a, ["id"]);
368
+ return rest;
369
+ });
370
+ return list.sort((a, b) => { var _a, _b, _c, _d; return ((_b = (_a = a.payload) === null || _a === void 0 ? void 0 : _a.sentAt) !== null && _b !== void 0 ? _b : a.updatedAt) - ((_d = (_c = b.payload) === null || _c === void 0 ? void 0 : _c.sentAt) !== null && _d !== void 0 ? _d : b.updatedAt); });
371
+ }
372
+ async putOutbox(item) {
373
+ const db = await this.db();
374
+ const tx = db.transaction('outbox', 'readwrite');
375
+ tx.objectStore('outbox').put(item);
376
+ await txDone(tx);
377
+ }
378
+ async getOutbox(userId) {
379
+ const db = await this.db();
380
+ const tx = db.transaction('outbox', 'readonly');
381
+ const idx = tx.objectStore('outbox').index('userId');
382
+ const rows = (await reqToPromise(idx.getAll(userId)));
383
+ return (rows || []).sort((a, b) => a.createdAt - b.createdAt);
384
+ }
385
+ async deleteOutbox(localId) {
386
+ const db = await this.db();
387
+ const tx = db.transaction('outbox', 'readwrite');
388
+ tx.objectStore('outbox').delete(localId);
389
+ await txDone(tx);
390
+ }
391
+ async putMeta(row) {
392
+ const db = await this.db();
393
+ const tx = db.transaction('meta', 'readwrite');
394
+ tx.objectStore('meta').put(row);
395
+ await txDone(tx);
396
+ }
397
+ async getMeta(key) {
398
+ const db = await this.db();
399
+ const tx = db.transaction('meta', 'readonly');
400
+ const row = await reqToPromise(tx.objectStore('meta').get(key));
401
+ return row === null || row === void 0 ? void 0 : row.value;
402
+ }
403
+ async clearUser(userId) {
404
+ const conv = await this.getConversations(userId);
405
+ const db = await this.db();
406
+ const tx = db.transaction(['conversations', 'messages', 'outbox', 'meta'], 'readwrite');
407
+ for (const c of conv) {
408
+ tx.objectStore('conversations').delete(`${userId}:${c.conversationId}`);
409
+ }
410
+ // messages: scan userId index
411
+ const msgIdx = tx.objectStore('messages').index('userId');
412
+ const msgs = await reqToPromise(msgIdx.getAll(userId));
413
+ for (const m of msgs || []) {
414
+ tx.objectStore('messages').delete(m.id);
415
+ }
416
+ const out = await reqToPromise(tx.objectStore('outbox').index('userId').getAll(userId));
417
+ for (const o of out || []) {
418
+ tx.objectStore('outbox').delete(o.localId);
419
+ }
420
+ await txDone(tx);
421
+ }
422
+ }
423
+ function canUseIndexedDb() {
424
+ try {
425
+ return typeof indexedDB !== 'undefined' && !!indexedDB.open;
426
+ }
427
+ catch (_a) {
428
+ return false;
429
+ }
430
+ }
431
+
432
+ /** In-memory fallback when IndexedDB is unavailable (SSR / tests / private mode). */
433
+ class MemoryOfflineDb {
434
+ constructor() {
435
+ this.conversations = new Map();
436
+ this.messages = new Map();
437
+ this.outbox = new Map();
438
+ this.meta = new Map();
439
+ }
440
+ async putConversation(row) {
441
+ this.conversations.set(`${row.userId}:${row.conversationId}`, row);
442
+ }
443
+ async putConversations(rows) {
444
+ for (const row of rows)
445
+ await this.putConversation(row);
446
+ }
447
+ async getConversations(userId) {
448
+ return [...this.conversations.values()].filter(r => r.userId === userId);
449
+ }
450
+ async putMessage(row) {
451
+ this.messages.set(`${row.userId}:${row.messageId}`, row);
452
+ }
453
+ async putMessages(rows) {
454
+ for (const row of rows)
455
+ await this.putMessage(row);
456
+ }
457
+ async getMessages(userId, conversationId) {
458
+ return [...this.messages.values()]
459
+ .filter(r => r.userId === userId && r.conversationId === conversationId)
460
+ .sort((a, b) => { var _a, _b, _c, _d; return ((_b = (_a = a.payload) === null || _a === void 0 ? void 0 : _a.sentAt) !== null && _b !== void 0 ? _b : a.updatedAt) - ((_d = (_c = b.payload) === null || _c === void 0 ? void 0 : _c.sentAt) !== null && _d !== void 0 ? _d : b.updatedAt); });
461
+ }
462
+ async putOutbox(item) {
463
+ this.outbox.set(item.localId, item);
464
+ }
465
+ async getOutbox(userId) {
466
+ return [...this.outbox.values()]
467
+ .filter(i => i.userId === userId)
468
+ .sort((a, b) => a.createdAt - b.createdAt);
469
+ }
470
+ async deleteOutbox(localId) {
471
+ this.outbox.delete(localId);
472
+ }
473
+ async putMeta(row) {
474
+ this.meta.set(row.key, row);
475
+ }
476
+ async getMeta(key) {
477
+ var _a;
478
+ return (_a = this.meta.get(key)) === null || _a === void 0 ? void 0 : _a.value;
479
+ }
480
+ async clearUser(userId) {
481
+ for (const [k, v] of this.conversations)
482
+ if (v.userId === userId)
483
+ this.conversations.delete(k);
484
+ for (const [k, v] of this.messages)
485
+ if (v.userId === userId)
486
+ this.messages.delete(k);
487
+ for (const [k, v] of this.outbox)
488
+ if (v.userId === userId)
489
+ this.outbox.delete(k);
490
+ for (const [k] of this.meta)
491
+ if (k.startsWith(`${userId}:`))
492
+ this.meta.delete(k);
493
+ }
494
+ }
495
+
496
+ /**
497
+ * Multi-tab sync via BroadcastChannel (same origin).
498
+ * Falls back to no-op when BroadcastChannel is missing.
499
+ */
500
+ const CHANNEL = 'isometrik-webchat-offline-v1';
501
+ class OfflineTabBus {
502
+ constructor() {
503
+ this.channel = null;
504
+ this.handler = null;
505
+ }
506
+ start(handler) {
507
+ this.handler = handler;
508
+ if (typeof BroadcastChannel === 'undefined')
509
+ return;
510
+ try {
511
+ this.channel = new BroadcastChannel(CHANNEL);
512
+ this.channel.onmessage = ev => {
513
+ if ((ev === null || ev === void 0 ? void 0 : ev.data) && this.handler)
514
+ this.handler(ev.data);
515
+ };
516
+ }
517
+ catch (_a) {
518
+ this.channel = null;
519
+ }
520
+ }
521
+ publish(event) {
522
+ var _a;
523
+ try {
524
+ (_a = this.channel) === null || _a === void 0 ? void 0 : _a.postMessage(event);
525
+ }
526
+ catch (_b) {
527
+ /* ignore */
528
+ }
529
+ }
530
+ stop() {
531
+ var _a;
532
+ try {
533
+ (_a = this.channel) === null || _a === void 0 ? void 0 : _a.close();
534
+ }
535
+ catch (_b) {
536
+ /* ignore */
537
+ }
538
+ this.channel = null;
539
+ this.handler = null;
540
+ }
541
+ }
542
+
543
+ /** Merge message arrays by messageId, sort by sentAt. */
544
+ function mergeMessagesById(existing, incoming) {
545
+ const byId = new Map();
546
+ (existing || []).forEach(m => {
547
+ if (m === null || m === void 0 ? void 0 : m.messageId)
548
+ byId.set(String(m.messageId), m);
549
+ });
550
+ (incoming || []).forEach(m => {
551
+ if (m === null || m === void 0 ? void 0 : m.messageId)
552
+ byId.set(String(m.messageId), m);
553
+ });
554
+ return Array.from(byId.values()).sort((a, b) => {
555
+ var _a, _b, _c, _d;
556
+ const ta = (_b = (_a = a === null || a === void 0 ? void 0 : a.sentAt) !== null && _a !== void 0 ? _a : a === null || a === void 0 ? void 0 : a.updatedAt) !== null && _b !== void 0 ? _b : 0;
557
+ const tb = (_d = (_c = b === null || b === void 0 ? void 0 : b.sentAt) !== null && _c !== void 0 ? _c : b === null || b === void 0 ? void 0 : b.updatedAt) !== null && _d !== void 0 ? _d : 0;
558
+ return ta - tb;
559
+ });
560
+ }
561
+ function isBrowserOnline() {
562
+ if (typeof navigator === 'undefined')
563
+ return true;
564
+ return navigator.onLine !== false;
565
+ }
566
+
567
+ /**
568
+ * Offline client: IndexedDB (or memory) + outbox + multi-tab bus.
569
+ */
570
+ function now() {
571
+ return Date.now();
572
+ }
573
+ class OfflineClient {
574
+ constructor(db) {
575
+ this.bus = new OfflineTabBus();
576
+ this.flushing = false;
577
+ this.userId = null;
578
+ this.db = db || (canUseIndexedDb() ? new IdbOfflineDb() : new MemoryOfflineDb());
579
+ }
580
+ /** For tests — inject memory backend. */
581
+ static withMemory() {
582
+ return new OfflineClient(new MemoryOfflineDb());
583
+ }
584
+ setUser(userId) {
585
+ this.userId = userId;
586
+ }
587
+ startTabSync(onRemote) {
588
+ this.bus.start(event => {
589
+ if (!this.userId || event.userId !== this.userId)
590
+ return;
591
+ onRemote(event);
592
+ });
593
+ }
594
+ stopTabSync() {
595
+ this.bus.stop();
596
+ }
597
+ async persistConversations(userId, conversations) {
598
+ const rows = (conversations || [])
599
+ .filter(c => c === null || c === void 0 ? void 0 : c.conversationId)
600
+ .map(c => ({
601
+ conversationId: c.conversationId,
602
+ userId,
603
+ payload: c,
604
+ updatedAt: now(),
605
+ }));
606
+ await this.db.putConversations(rows);
607
+ this.bus.publish({ type: 'conversations', userId, conversations });
608
+ }
609
+ async loadConversations(userId) {
610
+ const rows = await this.db.getConversations(userId);
611
+ return rows
612
+ .map(r => r.payload)
613
+ .sort((a, b) => { var _a, _b; return (((_a = b === null || b === void 0 ? void 0 : b.lastMessageDetails) === null || _a === void 0 ? void 0 : _a.updatedAt) || 0) - (((_b = a === null || a === void 0 ? void 0 : a.lastMessageDetails) === null || _b === void 0 ? void 0 : _b.updatedAt) || 0); });
614
+ }
615
+ async persistMessages(userId, conversationId, messages) {
616
+ const rows = (messages || [])
617
+ .filter(m => m === null || m === void 0 ? void 0 : m.messageId)
618
+ .map(m => ({
619
+ messageId: m.messageId,
620
+ conversationId,
621
+ userId,
622
+ payload: m,
623
+ updatedAt: now(),
624
+ }));
625
+ await this.db.putMessages(rows);
626
+ this.bus.publish({ type: 'messages', userId, conversationId, messages });
627
+ }
628
+ async loadMessages(userId, conversationId) {
629
+ const rows = await this.db.getMessages(userId, conversationId);
630
+ return rows.map(r => r.payload);
631
+ }
632
+ async mergeAndPersistMessages(userId, conversationId, incoming) {
633
+ const existing = await this.loadMessages(userId, conversationId);
634
+ const merged = mergeMessagesById(existing, incoming);
635
+ await this.persistMessages(userId, conversationId, merged);
636
+ return merged;
637
+ }
638
+ async enqueueText(item) {
639
+ const row = Object.assign(Object.assign({}, item), { kind: 'text', status: 'pending', attempts: 0, createdAt: now(), updatedAt: now() });
640
+ await this.db.putOutbox(row);
641
+ const items = await this.db.getOutbox(item.userId);
642
+ this.bus.publish({ type: 'outbox', userId: item.userId, items });
643
+ return row;
644
+ }
645
+ async enqueueMedia(item) {
646
+ const row = Object.assign(Object.assign({}, item), { kind: 'media', body: item.body || item.caption || 'AttachmentMessage:Multiple', status: 'pending', attempts: 0, createdAt: now(), updatedAt: now() });
647
+ await this.db.putOutbox(row);
648
+ const items = await this.db.getOutbox(item.userId);
649
+ this.bus.publish({ type: 'outbox', userId: item.userId, items });
650
+ return row;
651
+ }
652
+ async updateOutbox(item) {
653
+ item.updatedAt = now();
654
+ await this.db.putOutbox(item);
655
+ }
656
+ async listOutbox(userId) {
657
+ return this.db.getOutbox(userId);
658
+ }
659
+ async removeOutbox(localId) {
660
+ await this.db.deleteOutbox(localId);
661
+ }
662
+ async setCursor(userId, conversationId, cursor) {
663
+ await this.db.putMeta({
664
+ key: `${userId}:cursor:${conversationId}`,
665
+ value: cursor,
666
+ updatedAt: now(),
667
+ });
668
+ }
669
+ async getCursor(userId, conversationId) {
670
+ return this.db.getMeta(`${userId}:cursor:${conversationId}`);
671
+ }
672
+ /**
673
+ * Flush pending text outbox via `sendFn`.
674
+ * sendFn should return server messageId on success.
675
+ */
676
+ async flushOutbox(userId, sendFn) {
677
+ if (this.flushing)
678
+ return { sent: 0, failed: 0 };
679
+ this.flushing = true;
680
+ let sent = 0;
681
+ let failed = 0;
682
+ try {
683
+ const items = (await this.db.getOutbox(userId)).filter(i => i.status === 'pending' || i.status === 'failed');
684
+ for (const item of items) {
685
+ if (item.attempts >= 8)
686
+ continue;
687
+ item.status = 'sending';
688
+ item.attempts += 1;
689
+ await this.updateOutbox(item);
690
+ try {
691
+ const serverId = await sendFn(item);
692
+ if (serverId) {
693
+ await this.db.deleteOutbox(item.localId);
694
+ sent += 1;
695
+ }
696
+ else {
697
+ item.status = 'failed';
698
+ item.lastError = 'send returned empty';
699
+ await this.updateOutbox(item);
700
+ failed += 1;
701
+ }
702
+ }
703
+ catch (e) {
704
+ item.status = 'failed';
705
+ item.lastError = (e === null || e === void 0 ? void 0 : e.message) || String(e);
706
+ await this.updateOutbox(item);
707
+ failed += 1;
708
+ }
709
+ }
710
+ const next = await this.db.getOutbox(userId);
711
+ this.bus.publish({ type: 'outbox', userId, items: next });
712
+ }
713
+ finally {
714
+ this.flushing = false;
715
+ }
716
+ return { sent, failed };
717
+ }
718
+ }
719
+ let singleton = null;
720
+ function getOfflineClient() {
721
+ if (!singleton)
722
+ singleton = new OfflineClient();
723
+ return singleton;
724
+ }
725
+
726
+ export { fetchConversationsPage as a, fetchConversationDetails as b, fetchGroupcastDetails as c, fetchGroupcastMembersPage as d, fetchGroupcastContactsPage as e, fetchUserDetails as f, mediaTypeFromMime as g, customTypeFromMime as h, initializeChatSdk as i, buildReplyMetaData as j, resolveRegionMode as k, resolveProfileRailMode as l, mergeUniqueConversations as m, getOfflineClient as n, mergeMessagesById as o, prepareMediaAttachments as p, isBrowserOnline as q, resolveShowProfileRailProp as r, sortConversationsByLatestMessage as s, canUseIndexedDb as t, uploadAndPostMediaMessage as u, buildLocalMediaAttachments as v };
727
+
728
+ //# sourceMappingURL=client.js.map