isometrik-plugin-chat-sdk 2.0.20 → 2.0.22

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 (576) hide show
  1. package/dist/cjs/admin-transfer-dialog.cjs.entry.js +2 -2
  2. package/dist/cjs/{app-globals-2824b330.js → app-globals-0e7848be.js} +3 -3
  3. package/dist/cjs/{app-globals-2824b330.js.map → app-globals-0e7848be.js.map} +1 -1
  4. package/dist/cjs/{attachment-preview_22.cjs.entry.js → attachment-preview_23.cjs.entry.js} +692 -388
  5. package/dist/cjs/attachment-preview_23.cjs.entry.js.map +1 -0
  6. package/dist/cjs/audio-bubble_4.cjs.entry.js +66 -22
  7. package/dist/cjs/audio-bubble_4.cjs.entry.js.map +1 -1
  8. package/dist/cjs/chat-app.cjs.entry.js +1 -1
  9. package/dist/cjs/chat-document-message-bubble.cjs.entry.js +1 -1
  10. package/dist/cjs/chat-image-message-bubble.cjs.entry.js +1 -1
  11. package/dist/cjs/chat-tile_3.cjs.entry.js +14 -10
  12. package/dist/cjs/chat-tile_3.cjs.entry.js.map +1 -1
  13. package/dist/cjs/chat-video-message-bubble.cjs.entry.js +1 -1
  14. package/dist/cjs/confirm-dialog.cjs.entry.js +1 -1
  15. package/dist/cjs/{content-ebca062a.js → content-8b271b56.js} +3 -1
  16. package/dist/cjs/content-8b271b56.js.map +1 -0
  17. package/dist/cjs/delete-message.cjs.entry.js +1 -1
  18. package/dist/cjs/download-9ccc0a6c.js +120 -0
  19. package/dist/cjs/download-9ccc0a6c.js.map +1 -0
  20. package/dist/cjs/{drawer-00a2323a.js → drawer-3f9c87b4.js} +42 -5
  21. package/dist/cjs/drawer-3f9c87b4.js.map +1 -0
  22. package/dist/cjs/forward-memebers.cjs.entry.js +61 -24
  23. package/dist/cjs/forward-memebers.cjs.entry.js.map +1 -1
  24. package/dist/cjs/forward-message.cjs.entry.js +2 -2
  25. package/dist/cjs/group-chat-contacts.cjs.entry.js +2 -2
  26. package/dist/cjs/{group-members-b3bea06e.js → group-members-1205fc4c.js} +5 -5
  27. package/dist/cjs/{group-members-b3bea06e.js.map → group-members-1205fc4c.js.map} +1 -1
  28. package/dist/cjs/{groupcast-8441b4df.js → groupcast-bb393c81.js} +14 -54
  29. package/dist/cjs/groupcast-bb393c81.js.map +1 -0
  30. package/dist/cjs/{groupcast-f24da720.js → groupcast-e1e52bd1.js} +16 -16
  31. package/dist/cjs/{groupcast-f24da720.js.map → groupcast-e1e52bd1.js.map} +1 -1
  32. package/dist/cjs/{helpers-154861e9.js → helpers-877a7116.js} +30 -1
  33. package/dist/cjs/helpers-877a7116.js.map +1 -0
  34. package/dist/cjs/index.cjs.js +8 -6
  35. package/dist/cjs/index.cjs.js.map +1 -1
  36. package/dist/cjs/{toast-91093c84.js → index.m-ff115b26.js} +1 -156
  37. package/dist/cjs/{toast-91093c84.js.map → index.m-ff115b26.js.map} +1 -1
  38. package/dist/cjs/info-panel-media_2.cjs.entry.js +244 -0
  39. package/dist/cjs/info-panel-media_2.cjs.entry.js.map +1 -0
  40. package/dist/cjs/isometrik-webchat.cjs.js +11 -9
  41. package/dist/cjs/isometrik-webchat.cjs.js.map +1 -1
  42. package/dist/cjs/loader.cjs.js +11 -9
  43. package/dist/cjs/loader.cjs.js.map +1 -1
  44. package/dist/cjs/{local-notification-bdd04d7a.js → local-notification-a86a2b34.js} +3 -3
  45. package/dist/cjs/local-notification-a86a2b34.js.map +1 -0
  46. package/dist/cjs/login-page_3.cjs.entry.js +258 -104
  47. package/dist/cjs/login-page_3.cjs.entry.js.map +1 -1
  48. package/dist/cjs/media-gallery.cjs.entry.js +10 -2
  49. package/dist/cjs/media-gallery.cjs.entry.js.map +1 -1
  50. package/dist/cjs/member-add.cjs.entry.js +20 -11
  51. package/dist/cjs/member-add.cjs.entry.js.map +1 -1
  52. package/dist/cjs/message-bubble.cjs.entry.js +2 -2
  53. package/dist/cjs/{message-reaction-82a4f93c.js → message-reaction-8f93a048.js} +5 -5
  54. package/dist/cjs/{message-reaction-82a4f93c.js.map → message-reaction-8f93a048.js.map} +1 -1
  55. package/dist/cjs/messages-e129b34d.js +179 -0
  56. package/dist/cjs/messages-e129b34d.js.map +1 -0
  57. package/dist/cjs/my-component.cjs.entry.js +1 -1
  58. package/dist/cjs/new-chat-sidebar.cjs.entry.js +2 -2
  59. package/dist/cjs/play-b473e0ab.js +13 -0
  60. package/dist/cjs/play-b473e0ab.js.map +1 -0
  61. package/dist/cjs/profile-avatar.cjs.entry.js +1 -1
  62. package/dist/cjs/reaction-container.cjs.entry.js +5 -4
  63. package/dist/cjs/reaction-container.cjs.entry.js.map +1 -1
  64. package/dist/cjs/{runtime-controls-cfc8fc31.js → runtime-controls-a70872fe.js} +33 -15
  65. package/dist/cjs/runtime-controls-a70872fe.js.map +1 -0
  66. package/dist/cjs/{send-media-4ee967d4.js → send-media-8a841e50.js} +559 -192
  67. package/dist/cjs/send-media-8a841e50.js.map +1 -0
  68. package/dist/cjs/share-popup.cjs.entry.js +1 -1
  69. package/dist/cjs/signup-page.cjs.entry.js +2 -2
  70. package/dist/cjs/spinner-loader.cjs.entry.js +1 -1
  71. package/dist/cjs/{group-members-cef1198e.js → storage-quota-2e81fb71.js} +254 -10
  72. package/dist/cjs/storage-quota-2e81fb71.js.map +1 -0
  73. package/dist/cjs/toast-a75f822c.js +159 -0
  74. package/dist/cjs/toast-a75f822c.js.map +1 -0
  75. package/dist/collection/collection-manifest.json +10 -8
  76. package/dist/collection/components/ChatUIComponent/AddMember.js +14 -7
  77. package/dist/collection/components/ChatUIComponent/AddMember.js.map +1 -1
  78. package/dist/collection/components/ChatUIComponent/ChatDocumentMessageBubble.js +1 -1
  79. package/dist/collection/components/ChatUIComponent/ChatImageMessageBubble.js +1 -1
  80. package/dist/collection/components/ChatUIComponent/ChatOwnProfile/Profile.js +8 -2
  81. package/dist/collection/components/ChatUIComponent/ChatOwnProfile/Profile.js.map +1 -1
  82. package/dist/collection/components/ChatUIComponent/ChatSidebar/ChatSidebar.js +90 -47
  83. package/dist/collection/components/ChatUIComponent/ChatSidebar/ChatSidebar.js.map +1 -1
  84. package/dist/collection/components/ChatUIComponent/ChatVideoMessageBubble.js +1 -1
  85. package/dist/collection/components/ChatUIComponent/Footer/ChatFooter.js +105 -37
  86. package/dist/collection/components/ChatUIComponent/Footer/ChatFooter.js.map +1 -1
  87. package/dist/collection/components/ChatUIComponent/Header/WebChatHeader.js +45 -11
  88. package/dist/collection/components/ChatUIComponent/Header/WebChatHeader.js.map +1 -1
  89. package/dist/collection/components/ChatUIComponent/ReactionContainer.js +2 -2
  90. package/dist/collection/components/ChatUIComponent/WebChatBody/WebChatBody.js +38 -13
  91. package/dist/collection/components/ChatUIComponent/WebChatBody/WebChatBody.js.map +1 -1
  92. package/dist/collection/components/ChatUIComponent/WebChatBody/web-chat-body.css +1 -0
  93. package/dist/collection/components/ChatUIComponent/shared/AudioBubble/AudioBubble.js +22 -10
  94. package/dist/collection/components/ChatUIComponent/shared/AudioBubble/AudioBubble.js.map +1 -1
  95. package/dist/collection/components/ChatUIComponent/shared/ForwardMessageList/ForwardMessageList.js +55 -19
  96. package/dist/collection/components/ChatUIComponent/shared/ForwardMessageList/ForwardMessageList.js.map +1 -1
  97. package/dist/collection/components/ChatUIComponent/shared/admin-transfer-dialog/admin-transfer-dialog.js +2 -2
  98. package/dist/collection/components/ChatUIComponent/shared/attachment-preview/attachment-preview.js +1 -1
  99. package/dist/collection/components/ChatUIComponent/shared/block chatlist/BlockChatList.js +1 -1
  100. package/dist/collection/components/ChatUIComponent/shared/chat-loading-placeholder/chat-loading-placeholder.js +1 -1
  101. package/dist/collection/components/ChatUIComponent/shared/chat-tile/chat-tile.js +31 -9
  102. package/dist/collection/components/ChatUIComponent/shared/chat-tile/chat-tile.js.map +1 -1
  103. package/dist/collection/components/ChatUIComponent/shared/confirm-dialog/confirm-dialog.js +1 -1
  104. package/dist/collection/components/ChatUIComponent/shared/contact-info/contact-info.js +66 -157
  105. package/dist/collection/components/ChatUIComponent/shared/contact-info/contact-info.js.map +1 -1
  106. package/dist/collection/components/ChatUIComponent/shared/delete-message/delete-message.js +1 -1
  107. package/dist/collection/components/ChatUIComponent/shared/document-message/document-message.js +14 -4
  108. package/dist/collection/components/ChatUIComponent/shared/document-message/document-message.js.map +1 -1
  109. package/dist/collection/components/ChatUIComponent/shared/forward-message/forward-message.js +2 -2
  110. package/dist/collection/components/ChatUIComponent/shared/group-info/group-info.js +1 -1
  111. package/dist/collection/components/ChatUIComponent/shared/image-message/image-message.js +65 -2
  112. package/dist/collection/components/ChatUIComponent/shared/image-message/image-message.js.map +1 -1
  113. package/dist/collection/components/ChatUIComponent/shared/incoming-text-message-bubble/incoming-text-message-bubble.js +1 -1
  114. package/dist/collection/components/ChatUIComponent/shared/info-panel-media/info-panel-media.js +335 -0
  115. package/dist/collection/components/ChatUIComponent/shared/info-panel-media/info-panel-media.js.map +1 -0
  116. package/dist/collection/components/ChatUIComponent/shared/link-preview/link-preview.js +1 -1
  117. package/dist/collection/components/ChatUIComponent/shared/media-gallery/media-gallery.js +11 -2
  118. package/dist/collection/components/ChatUIComponent/shared/media-gallery/media-gallery.js.map +1 -1
  119. package/dist/collection/components/ChatUIComponent/shared/message-bubble/message-bubble.js +2 -2
  120. package/dist/collection/components/ChatUIComponent/shared/message-date-pill/message-date-pill.js +1 -1
  121. package/dist/collection/components/ChatUIComponent/shared/message-info/message-info.js +1 -1
  122. package/dist/collection/components/ChatUIComponent/shared/message-search/message-search.js +1 -1
  123. package/dist/collection/components/ChatUIComponent/shared/new chat/new-chat.js +1 -1
  124. package/dist/collection/components/ChatUIComponent/shared/outgoing-text-message-bubble/outgoing-text-message-bubble.js +1 -1
  125. package/dist/collection/components/ChatUIComponent/shared/profile sidebar/profile-sidebar.js +1 -1
  126. package/dist/collection/components/ChatUIComponent/shared/profile-avatar/profile-avatar.js +1 -1
  127. package/dist/collection/components/ChatUIComponent/shared/profile-info/profile-info.js +70 -3
  128. package/dist/collection/components/ChatUIComponent/shared/profile-info/profile-info.js.map +1 -1
  129. package/dist/collection/components/ChatUIComponent/shared/reply-block/reply-block.js +1 -1
  130. package/dist/collection/components/ChatUIComponent/shared/reply-message-container/reply-message-container.js +31 -2
  131. package/dist/collection/components/ChatUIComponent/shared/reply-message-container/reply-message-container.js.map +1 -1
  132. package/dist/collection/components/ChatUIComponent/shared/reply-message-container/reply-message-container.stories.js +10 -6
  133. package/dist/collection/components/ChatUIComponent/shared/searchable list/searchable-list.js +3 -3
  134. package/dist/collection/components/ChatUIComponent/shared/share-popup/share-popup.js +1 -1
  135. package/dist/collection/components/ChatUIComponent/shared/spinner-loader/spinner-loader.js +1 -1
  136. package/dist/collection/components/ChatUIComponent/shared/storage/storage-manager.js +140 -0
  137. package/dist/collection/components/ChatUIComponent/shared/storage/storage-manager.js.map +1 -0
  138. package/dist/collection/components/ChatUIComponent/shared/video-message/video-message.js +35 -3
  139. package/dist/collection/components/ChatUIComponent/shared/video-message/video-message.js.map +1 -1
  140. package/dist/collection/components/Login.js +1 -1
  141. package/dist/collection/components/Signup.js +2 -2
  142. package/dist/collection/components/chat-main.js +1 -1
  143. package/dist/collection/components/my-component/my-component.js +1 -1
  144. package/dist/collection/components/my-component/web-chat/WebChat.js +145 -1
  145. package/dist/collection/components/my-component/web-chat/WebChat.js.map +1 -1
  146. package/dist/collection/components/my-component/web-chat/WebchatRightSide.js +44 -2
  147. package/dist/collection/components/my-component/web-chat/WebchatRightSide.js.map +1 -1
  148. package/dist/collection/components/my-component/web-chat/bootstrap.js +1 -0
  149. package/dist/collection/components/my-component/web-chat/bootstrap.js.map +1 -1
  150. package/dist/collection/components/my-component/web-chat/conversation-ops.js +22 -2
  151. package/dist/collection/components/my-component/web-chat/conversation-ops.js.map +1 -1
  152. package/dist/collection/components/my-component/web-chat/data-fetch.js +9 -4
  153. package/dist/collection/components/my-component/web-chat/data-fetch.js.map +1 -1
  154. package/dist/collection/components/my-component/web-chat/event-handlers.js +51 -10
  155. package/dist/collection/components/my-component/web-chat/event-handlers.js.map +1 -1
  156. package/dist/collection/components/my-component/web-chat/mutations.js +38 -8
  157. package/dist/collection/components/my-component/web-chat/mutations.js.map +1 -1
  158. package/dist/collection/components/my-component/web-chat/offline-host.js +31 -17
  159. package/dist/collection/components/my-component/web-chat/offline-host.js.map +1 -1
  160. package/dist/collection/components/my-component/web-chat/public-send.js +6 -1
  161. package/dist/collection/components/my-component/web-chat/public-send.js.map +1 -1
  162. package/dist/collection/components/my-component/web-chat/shell-render.js +11 -9
  163. package/dist/collection/components/my-component/web-chat/shell-render.js.map +1 -1
  164. package/dist/collection/components/my-component/web-chat/web-chat.css +40 -3
  165. package/dist/collection/components/theme-provider.js +1 -1
  166. package/dist/collection/constants/content.js +2 -0
  167. package/dist/collection/lib/chat/block-status.js +12 -0
  168. package/dist/collection/lib/chat/block-status.js.map +1 -0
  169. package/dist/collection/lib/chat/clipboard-paste.js +68 -0
  170. package/dist/collection/lib/chat/clipboard-paste.js.map +1 -0
  171. package/dist/collection/lib/chat/conversations.js +47 -3
  172. package/dist/collection/lib/chat/conversations.js.map +1 -1
  173. package/dist/collection/lib/chat/download-media.js +112 -0
  174. package/dist/collection/lib/chat/download-media.js.map +1 -0
  175. package/dist/collection/lib/chat/index.js +6 -2
  176. package/dist/collection/lib/chat/index.js.map +1 -1
  177. package/dist/collection/lib/chat/local-notification.js +1 -1
  178. package/dist/collection/lib/chat/local-notification.js.map +1 -1
  179. package/dist/collection/lib/chat/same-name-upload.js +53 -0
  180. package/dist/collection/lib/chat/same-name-upload.js.map +1 -0
  181. package/dist/collection/lib/chat/send-media.js +194 -27
  182. package/dist/collection/lib/chat/send-media.js.map +1 -1
  183. package/dist/collection/lib/chat/session.js +9 -3
  184. package/dist/collection/lib/chat/session.js.map +1 -1
  185. package/dist/collection/lib/chat/storage-quota.js +226 -0
  186. package/dist/collection/lib/chat/storage-quota.js.map +1 -0
  187. package/dist/collection/lib/custom-ui/public-api.js +5 -0
  188. package/dist/collection/lib/custom-ui/public-api.js.map +1 -1
  189. package/dist/collection/lib/drawer.js +42 -4
  190. package/dist/collection/lib/drawer.js.map +1 -1
  191. package/dist/collection/lib/helpers.js +29 -1
  192. package/dist/collection/lib/mqtt/dispatch.js +7 -3
  193. package/dist/collection/lib/mqtt/dispatch.js.map +1 -1
  194. package/dist/collection/sdk/headless-api.js +8 -0
  195. package/dist/collection/sdk/headless-api.js.map +1 -1
  196. package/dist/collection/sdk/index.js +1 -0
  197. package/dist/collection/sdk/index.js.map +1 -1
  198. package/dist/collection/sdk/webchat-api.js +5 -0
  199. package/dist/collection/sdk/webchat-api.js.map +1 -1
  200. package/dist/collection/store/storage-quota.js +244 -0
  201. package/dist/collection/store/storage-quota.js.map +1 -0
  202. package/dist/collection/testing/iso-chat-sdk-mock.js +10 -6
  203. package/dist/components/AudioBubble.js +22 -10
  204. package/dist/components/AudioBubble.js.map +1 -1
  205. package/dist/components/BlockChatList.js +2 -2
  206. package/dist/components/ChatFooter.js +172 -37
  207. package/dist/components/ChatFooter.js.map +1 -1
  208. package/dist/components/ChatSidebar.js +102 -49
  209. package/dist/components/ChatSidebar.js.map +1 -1
  210. package/dist/components/GroupCast2.js +1 -1
  211. package/dist/components/Login.js +1 -1
  212. package/dist/components/Profile.js +20 -9
  213. package/dist/components/Profile.js.map +1 -1
  214. package/dist/components/WebChat.js +301 -126
  215. package/dist/components/WebChat.js.map +1 -1
  216. package/dist/components/WebChatBody.js +39 -14
  217. package/dist/components/WebChatBody.js.map +1 -1
  218. package/dist/components/WebChatHeader.js +48 -15
  219. package/dist/components/WebChatHeader.js.map +1 -1
  220. package/dist/components/WebchatRightSide.js +22 -7
  221. package/dist/components/WebchatRightSide.js.map +1 -1
  222. package/dist/components/admin-transfer-dialog.js +2 -2
  223. package/dist/components/attachment-preview2.js +1 -1
  224. package/dist/components/chat-app.js +85 -73
  225. package/dist/components/chat-app.js.map +1 -1
  226. package/dist/components/chat-assets.js +1 -1
  227. package/dist/components/chat-document-message-bubble.js +1 -1
  228. package/dist/components/chat-image-message-bubble.js +1 -1
  229. package/dist/components/chat-loading-placeholder2.js +1 -1
  230. package/dist/components/chat-tile2.js +12 -7
  231. package/dist/components/chat-tile2.js.map +1 -1
  232. package/dist/components/chat-video-message-bubble.js +1 -1
  233. package/dist/components/client.js +11 -47
  234. package/dist/components/client.js.map +1 -1
  235. package/dist/components/confirm-dialog.js +1 -1
  236. package/dist/components/contact-info2.js +73 -162
  237. package/dist/components/contact-info2.js.map +1 -1
  238. package/dist/components/content.js +2 -0
  239. package/dist/components/content.js.map +1 -1
  240. package/dist/components/conversation.js +1 -1
  241. package/dist/components/conversations.js +91 -0
  242. package/dist/components/conversations.js.map +1 -0
  243. package/dist/components/delete-message.js +1 -1
  244. package/dist/components/document-message2.js +15 -6
  245. package/dist/components/document-message2.js.map +1 -1
  246. package/dist/components/download-media.js +115 -0
  247. package/dist/components/download-media.js.map +1 -0
  248. package/dist/components/download.js +5 -0
  249. package/dist/components/download.js.map +1 -0
  250. package/dist/components/drawer.js +42 -5
  251. package/dist/components/drawer.js.map +1 -1
  252. package/dist/components/forward-memebers.js +56 -20
  253. package/dist/components/forward-memebers.js.map +1 -1
  254. package/dist/components/forward-message.js +2 -2
  255. package/dist/components/group-chat-contacts2.js +1 -1
  256. package/dist/components/group-info.js +1 -1
  257. package/dist/components/group-members.js +26 -298
  258. package/dist/components/group-members.js.map +1 -1
  259. package/dist/components/helpers.js +28 -1
  260. package/dist/components/helpers.js.map +1 -1
  261. package/dist/components/image-message2.js +17 -2
  262. package/dist/components/image-message2.js.map +1 -1
  263. package/dist/components/incoming-text-message-bubble2.js +1 -1
  264. package/dist/components/index.js +21 -2
  265. package/dist/components/index.js.map +1 -1
  266. package/dist/{esm/group-members-7909941c.js → components/index3.js} +3 -52
  267. package/dist/components/index3.js.map +1 -0
  268. package/dist/components/info-panel-media.d.ts +11 -0
  269. package/dist/components/info-panel-media.js +8 -0
  270. package/dist/components/info-panel-media.js.map +1 -0
  271. package/dist/components/info-panel-media2.js +242 -0
  272. package/dist/components/info-panel-media2.js.map +1 -0
  273. package/dist/components/link-preview2.js +1 -1
  274. package/dist/components/local-notification.js +1 -1
  275. package/dist/components/local-notification.js.map +1 -1
  276. package/dist/components/media-gallery.js +11 -2
  277. package/dist/components/media-gallery.js.map +1 -1
  278. package/dist/components/member-add.js +16 -9
  279. package/dist/components/member-add.js.map +1 -1
  280. package/dist/components/message-bubble2.js +2 -2
  281. package/dist/components/message-date-pill2.js +1 -1
  282. package/dist/components/message-info2.js +2 -2
  283. package/dist/components/message-search2.js +1 -1
  284. package/dist/components/messages.js +1 -1
  285. package/dist/components/my-component.js +1 -1
  286. package/dist/components/new-chat-sidebar.js +1 -1
  287. package/dist/components/new-chat2.js +1 -1
  288. package/dist/components/outgoing-text-message-bubble2.js +1 -1
  289. package/dist/components/profile-avatar2.js +1 -1
  290. package/dist/components/profile-info2.js +69 -6
  291. package/dist/components/profile-info2.js.map +1 -1
  292. package/dist/components/profile-sidebar2.js +2 -2
  293. package/dist/components/prompt-exit-group.js +26 -3
  294. package/dist/components/prompt-exit-group.js.map +1 -1
  295. package/dist/components/reaction-container.js +2 -2
  296. package/dist/components/reply-block2.js +1 -1
  297. package/dist/components/reply-message-container2.js +12 -2
  298. package/dist/components/reply-message-container2.js.map +1 -1
  299. package/dist/components/searchable-list2.js +3 -3
  300. package/dist/components/send-media.js +242 -33
  301. package/dist/components/send-media.js.map +1 -1
  302. package/dist/components/share-popup.js +1 -1
  303. package/dist/components/signup-page.js +2 -2
  304. package/dist/components/spinner-loader2.js +1 -1
  305. package/dist/components/storage-manager.js +125 -0
  306. package/dist/components/storage-manager.js.map +1 -0
  307. package/dist/components/storage-quota.js +223 -0
  308. package/dist/components/storage-quota.js.map +1 -0
  309. package/dist/components/storage-quota2.js +248 -0
  310. package/dist/components/storage-quota2.js.map +1 -0
  311. package/dist/components/theme-provider2.js +1 -1
  312. package/dist/components/video-message2.js +19 -3
  313. package/dist/components/video-message2.js.map +1 -1
  314. package/dist/components/web-chat-storage.d.ts +11 -0
  315. package/dist/components/web-chat-storage.js +8 -0
  316. package/dist/components/web-chat-storage.js.map +1 -0
  317. package/dist/esm/admin-transfer-dialog.entry.js +2 -2
  318. package/dist/esm/{app-globals-e3f4717b.js → app-globals-eba1ca0c.js} +3 -3
  319. package/dist/esm/{app-globals-e3f4717b.js.map → app-globals-eba1ca0c.js.map} +1 -1
  320. package/dist/esm/{attachment-preview_22.entry.js → attachment-preview_23.entry.js} +657 -354
  321. package/dist/esm/attachment-preview_23.entry.js.map +1 -0
  322. package/dist/esm/audio-bubble_4.entry.js +66 -22
  323. package/dist/esm/audio-bubble_4.entry.js.map +1 -1
  324. package/dist/esm/chat-app.entry.js +1 -1
  325. package/dist/esm/chat-document-message-bubble.entry.js +1 -1
  326. package/dist/esm/chat-image-message-bubble.entry.js +1 -1
  327. package/dist/esm/chat-tile_3.entry.js +15 -11
  328. package/dist/esm/chat-tile_3.entry.js.map +1 -1
  329. package/dist/esm/chat-video-message-bubble.entry.js +1 -1
  330. package/dist/esm/confirm-dialog.entry.js +1 -1
  331. package/dist/esm/{content-fb138a93.js → content-fd0af283.js} +3 -1
  332. package/dist/esm/content-fd0af283.js.map +1 -0
  333. package/dist/esm/delete-message.entry.js +1 -1
  334. package/dist/esm/download-5368a10f.js +117 -0
  335. package/dist/esm/download-5368a10f.js.map +1 -0
  336. package/dist/esm/{drawer-7de04622.js → drawer-a457d820.js} +43 -6
  337. package/dist/esm/drawer-a457d820.js.map +1 -0
  338. package/dist/esm/forward-memebers.entry.js +59 -22
  339. package/dist/esm/forward-memebers.entry.js.map +1 -1
  340. package/dist/esm/forward-message.entry.js +2 -2
  341. package/dist/esm/group-chat-contacts.entry.js +2 -2
  342. package/dist/esm/{group-members-36cf9395.js → group-members-d603f29f.js} +2 -2
  343. package/dist/esm/{group-members-36cf9395.js.map → group-members-d603f29f.js.map} +1 -1
  344. package/dist/esm/{groupcast-5fb19ec3.js → groupcast-4f15b050.js} +14 -50
  345. package/dist/esm/groupcast-4f15b050.js.map +1 -0
  346. package/dist/esm/{groupcast-f96c1d9e.js → groupcast-c6da3918.js} +2 -2
  347. package/dist/esm/{groupcast-f96c1d9e.js.map → groupcast-c6da3918.js.map} +1 -1
  348. package/dist/esm/{helpers-f33b895c.js → helpers-1632a4c7.js} +29 -2
  349. package/dist/esm/helpers-1632a4c7.js.map +1 -0
  350. package/dist/esm/index.js +9 -7
  351. package/dist/esm/index.js.map +1 -1
  352. package/dist/esm/{toast-a1531088.js → index.m-8c70037f.js} +2 -156
  353. package/dist/esm/{toast-a1531088.js.map → index.m-8c70037f.js.map} +1 -1
  354. package/dist/esm/info-panel-media_2.entry.js +239 -0
  355. package/dist/esm/info-panel-media_2.entry.js.map +1 -0
  356. package/dist/esm/isometrik-webchat.js +11 -9
  357. package/dist/esm/isometrik-webchat.js.map +1 -1
  358. package/dist/esm/loader.js +11 -9
  359. package/dist/esm/loader.js.map +1 -1
  360. package/dist/esm/{local-notification-4c1e166d.js → local-notification-f9ae9062.js} +3 -3
  361. package/dist/esm/local-notification-f9ae9062.js.map +1 -0
  362. package/dist/esm/login-page_3.entry.js +219 -65
  363. package/dist/esm/login-page_3.entry.js.map +1 -1
  364. package/dist/esm/media-gallery.entry.js +10 -2
  365. package/dist/esm/media-gallery.entry.js.map +1 -1
  366. package/dist/esm/member-add.entry.js +20 -11
  367. package/dist/esm/member-add.entry.js.map +1 -1
  368. package/dist/esm/message-bubble.entry.js +2 -2
  369. package/dist/esm/{message-reaction-0d2ef75f.js → message-reaction-0a2bb115.js} +2 -2
  370. package/dist/esm/{message-reaction-0d2ef75f.js.map → message-reaction-0a2bb115.js.map} +1 -1
  371. package/dist/esm/messages-057dbecb.js +167 -0
  372. package/dist/esm/messages-057dbecb.js.map +1 -0
  373. package/dist/esm/my-component.entry.js +1 -1
  374. package/dist/esm/new-chat-sidebar.entry.js +2 -2
  375. package/dist/esm/play-05ae077a.js +9 -0
  376. package/dist/esm/play-05ae077a.js.map +1 -0
  377. package/dist/esm/profile-avatar.entry.js +1 -1
  378. package/dist/esm/reaction-container.entry.js +5 -4
  379. package/dist/esm/reaction-container.entry.js.map +1 -1
  380. package/dist/esm/{runtime-controls-ff81e90a.js → runtime-controls-bdb84aeb.js} +21 -3
  381. package/dist/esm/runtime-controls-bdb84aeb.js.map +1 -0
  382. package/dist/esm/{send-media-58e7145b.js → send-media-04f7ca0a.js} +533 -180
  383. package/dist/esm/send-media-04f7ca0a.js.map +1 -0
  384. package/dist/esm/share-popup.entry.js +1 -1
  385. package/dist/esm/signup-page.entry.js +2 -2
  386. package/dist/esm/spinner-loader.entry.js +1 -1
  387. package/dist/esm/storage-quota-6329fabe.js +578 -0
  388. package/dist/esm/storage-quota-6329fabe.js.map +1 -0
  389. package/dist/esm/toast-f681e916.js +157 -0
  390. package/dist/esm/toast-f681e916.js.map +1 -0
  391. package/dist/isometrik-webchat/index.esm.js +1 -1
  392. package/dist/isometrik-webchat/index.esm.js.map +1 -1
  393. package/dist/isometrik-webchat/isometrik-webchat.esm.js +1 -1
  394. package/dist/isometrik-webchat/isometrik-webchat.esm.js.map +1 -1
  395. package/dist/isometrik-webchat/p-0161f40b.js +2 -0
  396. package/dist/isometrik-webchat/p-0161f40b.js.map +1 -0
  397. package/dist/isometrik-webchat/{p-d892b4d4.entry.js → p-02db2116.entry.js} +2 -2
  398. package/dist/isometrik-webchat/p-03933431.entry.js +2 -0
  399. package/dist/isometrik-webchat/{p-352b589e.entry.js.map → p-03933431.entry.js.map} +1 -1
  400. package/dist/isometrik-webchat/{p-c591fa45.js → p-04fdbd0a.js} +2 -2
  401. package/dist/isometrik-webchat/p-0bb42151.entry.js +2 -0
  402. package/dist/isometrik-webchat/p-0bb42151.entry.js.map +1 -0
  403. package/dist/isometrik-webchat/{p-c5bff6a1.entry.js → p-119fc683.entry.js} +2 -2
  404. package/dist/isometrik-webchat/p-19d37e1f.js +2 -0
  405. package/dist/isometrik-webchat/p-19d37e1f.js.map +1 -0
  406. package/dist/isometrik-webchat/{p-925decda.js → p-1dc52239.js} +2 -2
  407. package/dist/isometrik-webchat/p-1f0e8230.entry.js +2 -0
  408. package/dist/isometrik-webchat/p-1f0e8230.entry.js.map +1 -0
  409. package/dist/isometrik-webchat/{p-7b25f234.entry.js → p-35f2b9ae.entry.js} +2 -2
  410. package/dist/isometrik-webchat/p-3a0409fc.js +2 -0
  411. package/dist/isometrik-webchat/p-3a0409fc.js.map +1 -0
  412. package/dist/isometrik-webchat/{p-9982fa21.js → p-3dca1e56.js} +2 -2
  413. package/dist/isometrik-webchat/p-3dca1e56.js.map +1 -0
  414. package/dist/isometrik-webchat/p-40217f22.js +2 -0
  415. package/dist/isometrik-webchat/p-40217f22.js.map +1 -0
  416. package/dist/isometrik-webchat/{p-3b3dc33e.js → p-46be73c5.js} +2 -2
  417. package/dist/isometrik-webchat/p-56521ea4.entry.js +2 -0
  418. package/dist/isometrik-webchat/{p-f7d05551.entry.js → p-57f97cef.entry.js} +2 -2
  419. package/dist/isometrik-webchat/p-5f7eebbf.entry.js +2 -0
  420. package/dist/isometrik-webchat/p-605cb14e.entry.js +2 -0
  421. package/dist/isometrik-webchat/p-605cb14e.entry.js.map +1 -0
  422. package/dist/isometrik-webchat/p-640e2c03.entry.js +2 -0
  423. package/dist/isometrik-webchat/p-69d953cb.entry.js +2 -0
  424. package/dist/isometrik-webchat/p-69d953cb.entry.js.map +1 -0
  425. package/dist/isometrik-webchat/p-6c5eb178.js +2 -0
  426. package/dist/isometrik-webchat/{p-d8b65cf4.entry.js → p-6eadaa6c.entry.js} +2 -2
  427. package/dist/isometrik-webchat/{p-161fcb35.entry.js → p-7130f547.entry.js} +2 -2
  428. package/dist/isometrik-webchat/p-782d1bd2.js +2 -0
  429. package/dist/isometrik-webchat/p-782d1bd2.js.map +1 -0
  430. package/dist/isometrik-webchat/p-8142a54d.js +2 -0
  431. package/dist/isometrik-webchat/p-8142a54d.js.map +1 -0
  432. package/dist/isometrik-webchat/{p-cbb1179b.entry.js → p-89a8fc58.entry.js} +2 -2
  433. package/dist/isometrik-webchat/p-8f17345f.js +7 -0
  434. package/dist/isometrik-webchat/p-8f17345f.js.map +1 -0
  435. package/dist/isometrik-webchat/p-991d5437.js +2 -0
  436. package/dist/isometrik-webchat/p-991d5437.js.map +1 -0
  437. package/dist/isometrik-webchat/p-9b70e93f.entry.js +2 -0
  438. package/dist/isometrik-webchat/p-a5faa465.entry.js +2 -0
  439. package/dist/isometrik-webchat/p-a5faa465.entry.js.map +1 -0
  440. package/dist/isometrik-webchat/p-a83932d4.js +2 -0
  441. package/dist/isometrik-webchat/p-a83932d4.js.map +1 -0
  442. package/dist/isometrik-webchat/p-b0f6f9ab.entry.js +2 -0
  443. package/dist/isometrik-webchat/p-b0f6f9ab.entry.js.map +1 -0
  444. package/dist/isometrik-webchat/{p-3664e0ad.entry.js → p-b431d864.entry.js} +2 -2
  445. package/dist/isometrik-webchat/{p-0ccfbe90.entry.js → p-b516938b.entry.js} +2 -2
  446. package/dist/isometrik-webchat/p-be09cdc8.js +2 -0
  447. package/dist/isometrik-webchat/p-be09cdc8.js.map +1 -0
  448. package/dist/isometrik-webchat/{p-5b965e04.js → p-c4b7babb.js} +2 -2
  449. package/dist/isometrik-webchat/{p-5b965e04.js.map → p-c4b7babb.js.map} +1 -1
  450. package/dist/isometrik-webchat/p-d0f6679d.entry.js +2 -0
  451. package/dist/isometrik-webchat/p-d0f6679d.entry.js.map +1 -0
  452. package/dist/isometrik-webchat/p-d44c612a.entry.js +2 -0
  453. package/dist/isometrik-webchat/p-dc963574.entry.js +2 -0
  454. package/dist/isometrik-webchat/{p-5d1877d1.entry.js.map → p-dc963574.entry.js.map} +1 -1
  455. package/dist/isometrik-webchat/p-eb1f3118.entry.js +2 -0
  456. package/dist/isometrik-webchat/p-f18fa23d.js +2 -0
  457. package/dist/isometrik-webchat/p-f18fa23d.js.map +1 -0
  458. package/dist/isometrik-webchat/{p-08ba6153.entry.js → p-f5502a63.entry.js} +2 -2
  459. package/dist/types/components/ChatUIComponent/ChatOwnProfile/Profile.d.ts +2 -0
  460. package/dist/types/components/ChatUIComponent/ChatSidebar/ChatSidebar.d.ts +10 -0
  461. package/dist/types/components/ChatUIComponent/Footer/ChatFooter.d.ts +3 -0
  462. package/dist/types/components/ChatUIComponent/Header/WebChatHeader.d.ts +3 -0
  463. package/dist/types/components/ChatUIComponent/WebChatBody/WebChatBody.d.ts +5 -0
  464. package/dist/types/components/ChatUIComponent/shared/ForwardMessageList/ForwardMessageList.d.ts +5 -2
  465. package/dist/types/components/ChatUIComponent/shared/chat-tile/chat-tile.d.ts +4 -1
  466. package/dist/types/components/ChatUIComponent/shared/contact-info/contact-info.d.ts +8 -22
  467. package/dist/types/components/ChatUIComponent/shared/image-message/image-message.d.ts +5 -0
  468. package/dist/types/components/ChatUIComponent/shared/info-panel-media/info-panel-media.d.ts +45 -0
  469. package/dist/types/components/ChatUIComponent/shared/media-gallery/media-gallery.d.ts +1 -0
  470. package/dist/types/components/ChatUIComponent/shared/profile-info/profile-info.d.ts +8 -0
  471. package/dist/types/components/ChatUIComponent/shared/reply-message-container/reply-message-container.d.ts +3 -0
  472. package/dist/types/components/ChatUIComponent/shared/storage/storage-manager.d.ts +17 -0
  473. package/dist/types/components/ChatUIComponent/shared/video-message/video-message.d.ts +3 -0
  474. package/dist/types/components/my-component/web-chat/WebChat.d.ts +22 -0
  475. package/dist/types/components/my-component/web-chat/WebchatRightSide.d.ts +7 -0
  476. package/dist/types/components/my-component/web-chat/conversation-ops.d.ts +10 -2
  477. package/dist/types/components/my-component/web-chat/event-handlers.d.ts +5 -0
  478. package/dist/types/components/my-component/web-chat/mutations.d.ts +2 -2
  479. package/dist/types/components.d.ts +133 -2
  480. package/dist/types/lib/chat/block-status.d.ts +11 -0
  481. package/dist/types/lib/chat/clipboard-paste.d.ts +16 -0
  482. package/dist/types/lib/chat/download-media.d.ts +11 -0
  483. package/dist/types/lib/chat/index.d.ts +6 -2
  484. package/dist/types/lib/chat/same-name-upload.d.ts +24 -0
  485. package/dist/types/lib/chat/send-media.d.ts +90 -0
  486. package/dist/types/lib/chat/storage-quota.d.ts +98 -0
  487. package/dist/types/lib/custom-ui/public-api.d.ts +1 -1
  488. package/dist/types/lib/drawer.d.ts +1 -0
  489. package/dist/types/sdk/headless-api.d.ts +7 -0
  490. package/dist/types/sdk/index.d.ts +1 -0
  491. package/dist/types/sdk/webchat-api.d.ts +14 -0
  492. package/dist/types/store/storage-quota.d.ts +64 -0
  493. package/docs/MEDIA_STORAGE_QUOTA.md +130 -0
  494. package/package.json +3 -2
  495. package/dist/cjs/attachment-preview_22.cjs.entry.js.map +0 -1
  496. package/dist/cjs/content-ebca062a.js.map +0 -1
  497. package/dist/cjs/drawer-00a2323a.js.map +0 -1
  498. package/dist/cjs/group-members-cef1198e.js.map +0 -1
  499. package/dist/cjs/groupcast-8441b4df.js.map +0 -1
  500. package/dist/cjs/helpers-154861e9.js.map +0 -1
  501. package/dist/cjs/link-preview.cjs.entry.js +0 -49
  502. package/dist/cjs/link-preview.cjs.entry.js.map +0 -1
  503. package/dist/cjs/local-notification-bdd04d7a.js.map +0 -1
  504. package/dist/cjs/runtime-controls-cfc8fc31.js.map +0 -1
  505. package/dist/cjs/send-media-4ee967d4.js.map +0 -1
  506. package/dist/components/group-members2.js +0 -37
  507. package/dist/components/group-members2.js.map +0 -1
  508. package/dist/esm/attachment-preview_22.entry.js.map +0 -1
  509. package/dist/esm/content-fb138a93.js.map +0 -1
  510. package/dist/esm/drawer-7de04622.js.map +0 -1
  511. package/dist/esm/group-members-7909941c.js.map +0 -1
  512. package/dist/esm/groupcast-5fb19ec3.js.map +0 -1
  513. package/dist/esm/helpers-f33b895c.js.map +0 -1
  514. package/dist/esm/link-preview.entry.js +0 -45
  515. package/dist/esm/link-preview.entry.js.map +0 -1
  516. package/dist/esm/local-notification-4c1e166d.js.map +0 -1
  517. package/dist/esm/runtime-controls-ff81e90a.js.map +0 -1
  518. package/dist/esm/send-media-58e7145b.js.map +0 -1
  519. package/dist/isometrik-webchat/p-09980c53.entry.js +0 -2
  520. package/dist/isometrik-webchat/p-09980c53.entry.js.map +0 -1
  521. package/dist/isometrik-webchat/p-1eecc7c5.entry.js +0 -2
  522. package/dist/isometrik-webchat/p-1eecc7c5.entry.js.map +0 -1
  523. package/dist/isometrik-webchat/p-2cf296e6.entry.js +0 -2
  524. package/dist/isometrik-webchat/p-2e9974e1.entry.js +0 -2
  525. package/dist/isometrik-webchat/p-343f50b4.js +0 -7
  526. package/dist/isometrik-webchat/p-343f50b4.js.map +0 -1
  527. package/dist/isometrik-webchat/p-352b589e.entry.js +0 -2
  528. package/dist/isometrik-webchat/p-44da28d3.entry.js +0 -2
  529. package/dist/isometrik-webchat/p-44da28d3.entry.js.map +0 -1
  530. package/dist/isometrik-webchat/p-48ce4dca.entry.js +0 -2
  531. package/dist/isometrik-webchat/p-52a575c0.entry.js +0 -2
  532. package/dist/isometrik-webchat/p-52a575c0.entry.js.map +0 -1
  533. package/dist/isometrik-webchat/p-5cfb953d.js +0 -2
  534. package/dist/isometrik-webchat/p-5cfb953d.js.map +0 -1
  535. package/dist/isometrik-webchat/p-5d1877d1.entry.js +0 -2
  536. package/dist/isometrik-webchat/p-6f5037b2.js +0 -2
  537. package/dist/isometrik-webchat/p-6f5037b2.js.map +0 -1
  538. package/dist/isometrik-webchat/p-78fb47c4.js +0 -2
  539. package/dist/isometrik-webchat/p-78fb47c4.js.map +0 -1
  540. package/dist/isometrik-webchat/p-9982fa21.js.map +0 -1
  541. package/dist/isometrik-webchat/p-a9efcf1c.entry.js +0 -2
  542. package/dist/isometrik-webchat/p-a9efcf1c.entry.js.map +0 -1
  543. package/dist/isometrik-webchat/p-ad02a8ca.entry.js +0 -2
  544. package/dist/isometrik-webchat/p-b0baa9ad.entry.js +0 -2
  545. package/dist/isometrik-webchat/p-b0baa9ad.entry.js.map +0 -1
  546. package/dist/isometrik-webchat/p-b385ac4b.js +0 -2
  547. package/dist/isometrik-webchat/p-b385ac4b.js.map +0 -1
  548. package/dist/isometrik-webchat/p-c83e2d5d.entry.js +0 -2
  549. package/dist/isometrik-webchat/p-d758e431.js +0 -2
  550. package/dist/isometrik-webchat/p-d864bb9f.entry.js +0 -2
  551. package/dist/isometrik-webchat/p-d864bb9f.entry.js.map +0 -1
  552. package/dist/isometrik-webchat/p-dab06d54.js +0 -2
  553. package/dist/isometrik-webchat/p-dab06d54.js.map +0 -1
  554. package/dist/isometrik-webchat/p-e40e8866.js +0 -2
  555. package/dist/isometrik-webchat/p-e40e8866.js.map +0 -1
  556. package/dist/isometrik-webchat/p-e48a1217.entry.js +0 -2
  557. /package/dist/isometrik-webchat/{p-d892b4d4.entry.js.map → p-02db2116.entry.js.map} +0 -0
  558. /package/dist/isometrik-webchat/{p-c591fa45.js.map → p-04fdbd0a.js.map} +0 -0
  559. /package/dist/isometrik-webchat/{p-c5bff6a1.entry.js.map → p-119fc683.entry.js.map} +0 -0
  560. /package/dist/isometrik-webchat/{p-925decda.js.map → p-1dc52239.js.map} +0 -0
  561. /package/dist/isometrik-webchat/{p-7b25f234.entry.js.map → p-35f2b9ae.entry.js.map} +0 -0
  562. /package/dist/isometrik-webchat/{p-3b3dc33e.js.map → p-46be73c5.js.map} +0 -0
  563. /package/dist/isometrik-webchat/{p-2cf296e6.entry.js.map → p-56521ea4.entry.js.map} +0 -0
  564. /package/dist/isometrik-webchat/{p-f7d05551.entry.js.map → p-57f97cef.entry.js.map} +0 -0
  565. /package/dist/isometrik-webchat/{p-ad02a8ca.entry.js.map → p-5f7eebbf.entry.js.map} +0 -0
  566. /package/dist/isometrik-webchat/{p-c83e2d5d.entry.js.map → p-640e2c03.entry.js.map} +0 -0
  567. /package/dist/isometrik-webchat/{p-d758e431.js.map → p-6c5eb178.js.map} +0 -0
  568. /package/dist/isometrik-webchat/{p-d8b65cf4.entry.js.map → p-6eadaa6c.entry.js.map} +0 -0
  569. /package/dist/isometrik-webchat/{p-161fcb35.entry.js.map → p-7130f547.entry.js.map} +0 -0
  570. /package/dist/isometrik-webchat/{p-cbb1179b.entry.js.map → p-89a8fc58.entry.js.map} +0 -0
  571. /package/dist/isometrik-webchat/{p-e48a1217.entry.js.map → p-9b70e93f.entry.js.map} +0 -0
  572. /package/dist/isometrik-webchat/{p-3664e0ad.entry.js.map → p-b431d864.entry.js.map} +0 -0
  573. /package/dist/isometrik-webchat/{p-0ccfbe90.entry.js.map → p-b516938b.entry.js.map} +0 -0
  574. /package/dist/isometrik-webchat/{p-48ce4dca.entry.js.map → p-d44c612a.entry.js.map} +0 -0
  575. /package/dist/isometrik-webchat/{p-2e9974e1.entry.js.map → p-eb1f3118.entry.js.map} +0 -0
  576. /package/dist/isometrik-webchat/{p-08ba6153.entry.js.map → p-f5502a63.entry.js.map} +0 -0
@@ -1,168 +1,312 @@
1
1
  'use strict';
2
2
 
3
- const toast = require('./toast-91093c84.js');
4
- const localNotification = require('./local-notification-bdd04d7a.js');
3
+ const index_m = require('./index.m-ff115b26.js');
4
+ const localNotification = require('./local-notification-a86a2b34.js');
5
5
 
6
- async function fetchMessagesPage(opts) {
7
- var _a, _b;
8
- const res = await toast.M.getInstance().message.getMessages({
9
- conversationId: opts.conversationId,
6
+ /** Trimmed search text for conversation list queries; empty strings become undefined. */
7
+ function normalizeConversationSearchTag(searchTag) {
8
+ const trimmed = typeof searchTag === 'string' ? searchTag.trim() : '';
9
+ return trimmed ? trimmed : undefined;
10
+ }
11
+ /** Lowercase haystack for case-insensitive conversation search (title, opponent, tags). */
12
+ function conversationSearchHaystack(conversation) {
13
+ var _a;
14
+ const parts = [];
15
+ const title = conversation === null || conversation === void 0 ? void 0 : conversation.conversationTitle;
16
+ const userName = (_a = conversation === null || conversation === void 0 ? void 0 : conversation.opponentDetails) === null || _a === void 0 ? void 0 : _a.userName;
17
+ const groupcastTitle = conversation === null || conversation === void 0 ? void 0 : conversation.groupcastTitle;
18
+ if (title)
19
+ parts.push(String(title));
20
+ if (userName)
21
+ parts.push(String(userName));
22
+ if (groupcastTitle)
23
+ parts.push(String(groupcastTitle));
24
+ const tags = conversation === null || conversation === void 0 ? void 0 : conversation.searchableTags;
25
+ if (Array.isArray(tags)) {
26
+ for (const tag of tags) {
27
+ if (tag != null && String(tag).trim())
28
+ parts.push(String(tag));
29
+ }
30
+ }
31
+ return parts.join(' ').toLocaleLowerCase();
32
+ }
33
+ /** Case-insensitive match against conversation title, opponent name, and searchableTags. */
34
+ function conversationMatchesSearch(conversation, searchTag) {
35
+ var _a;
36
+ const needle = (_a = normalizeConversationSearchTag(searchTag)) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase();
37
+ if (!needle)
38
+ return true;
39
+ return conversationSearchHaystack(conversation).includes(needle);
40
+ }
41
+ function filterConversationsBySearch(conversations, searchTag) {
42
+ const needle = normalizeConversationSearchTag(searchTag);
43
+ if (!needle)
44
+ return Array.isArray(conversations) ? conversations : [];
45
+ const list = Array.isArray(conversations) ? conversations : [];
46
+ return list.filter(c => conversationMatchesSearch(c, needle));
47
+ }
48
+ /** Newest last-message first. Skips empty/cleared last messages when sorting. */
49
+ function sortConversationsByLatestMessage(conversations) {
50
+ return [...conversations].sort((a, b) => {
51
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
52
+ 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') &&
53
+ (((_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')) {
54
+ return 0;
55
+ }
56
+ 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') &&
57
+ (((_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')) {
58
+ return 0;
59
+ }
60
+ const timestampA = (_j = a === null || a === void 0 ? void 0 : a.lastMessageDetails) === null || _j === void 0 ? void 0 : _j.updatedAt;
61
+ const timestampB = (_k = b === null || b === void 0 ? void 0 : b.lastMessageDetails) === null || _k === void 0 ? void 0 : _k.updatedAt;
62
+ return timestampB - timestampA;
63
+ });
64
+ }
65
+ function mergeUniqueConversations(existing, incoming) {
66
+ const list = Array.isArray(existing) ? existing : [];
67
+ const next = Array.isArray(incoming) ? incoming : [];
68
+ return [
69
+ ...list,
70
+ ...next.filter(newConv => !list.some(existingConv => existingConv.conversationId === newConv.conversationId)),
71
+ ];
72
+ }
73
+ async function fetchConversationsPage(opts) {
74
+ var _a, _b, _c;
75
+ const query = {
10
76
  limit: (_a = opts.limit) !== null && _a !== void 0 ? _a : 20,
11
77
  skip: (_b = opts.skip) !== null && _b !== void 0 ? _b : 0,
12
- });
13
- return ((res === null || res === void 0 ? void 0 : res.messages) || []).slice().reverse();
78
+ includeMembers: (_c = opts.includeMembers) !== null && _c !== void 0 ? _c : true,
79
+ };
80
+ const searchTag = normalizeConversationSearchTag(opts.searchTag);
81
+ if (searchTag)
82
+ query.searchTag = searchTag.toLocaleLowerCase();
83
+ const res = await index_m.M.getInstance().Conversation.getConversations(query);
84
+ const conversations = (res === null || res === void 0 ? void 0 : res.conversations) || [];
85
+ return searchTag ? filterConversationsBySearch(conversations, searchTag) : conversations;
14
86
  }
15
- /** Mark an open conversation read on the server (idempotent). */
16
- async function markConversationRead(conversationId) {
17
- const id = String(conversationId || '').trim();
18
- if (!id)
19
- return;
20
- await toast.M.getInstance().message.putRead({ conversationId: id });
87
+ async function fetchConversationDetails(conversationId, includeMembers = true) {
88
+ const res = await index_m.M.getInstance().Conversation.getConversationDetails({ conversationId, includeMembers }, conversationId);
89
+ return res === null || res === void 0 ? void 0 : res.conversationDetails;
21
90
  }
22
- function messageIdOf(m) {
91
+
92
+ /**
93
+ * Per-user media storage quota — data layer for <web-chat>.
94
+ *
95
+ * The core `test-iso-chat-sdk` does not expose the `/chat/quota/*` endpoints,
96
+ * so these are plain `fetch` calls (same approach as the presigned-URL PUTs in
97
+ * send-media.ts), authenticated with the standard chat headers.
98
+ *
99
+ * Usage is **server-authoritative** — never compute it on-device. The feature
100
+ * is dormant until an admin turns quota on for the project (`quotaEnabled`
101
+ * false), in which case uploads are never gated and the storage screen shows a
102
+ * neutral "not limited" state.
103
+ *
104
+ * Mirrors the Flutter SDK's `IsmChatStorageQuota*` surface.
105
+ */
106
+ /** App-level error code the API returns for an over-quota presign/send. */
107
+ const QUOTA_EXCEEDED_CODE = 6;
108
+ let config = null;
109
+ /** Called once during <web-chat> bootstrap (same creds as ChatSDK init). */
110
+ function setStorageQuotaConfig(next) {
111
+ config = Object.assign({}, next);
112
+ }
113
+ function authHeaders() {
114
+ const c = config;
115
+ return {
116
+ licenseKey: c.licenseKey,
117
+ appSecret: c.appSecret,
118
+ userToken: c.userToken,
119
+ 'Content-Type': 'application/json',
120
+ };
121
+ }
122
+ function toInt(value) {
123
+ if (value === null || value === undefined)
124
+ return null;
125
+ const n = typeof value === 'number' ? value : Number(value);
126
+ return Number.isFinite(n) ? Math.trunc(n) : null;
127
+ }
128
+ function normalizeTier(value) {
129
+ if (value === 'paid')
130
+ return 'paid';
131
+ if (value === 'free')
132
+ return 'free';
133
+ return null;
134
+ }
135
+ function normalizeUsage(raw) {
23
136
  var _a;
24
- return String((_a = m === null || m === void 0 ? void 0 : m.messageId) !== null && _a !== void 0 ? _a : '').trim();
137
+ const quotaEnabled = (raw === null || raw === void 0 ? void 0 : raw.quotaEnabled) === true;
138
+ return {
139
+ quotaEnabled,
140
+ usedBytes: toInt(raw === null || raw === void 0 ? void 0 : raw.usedBytes),
141
+ quotaBytes: toInt(raw === null || raw === void 0 ? void 0 : raw.quotaBytes),
142
+ remainingBytes: toInt(raw === null || raw === void 0 ? void 0 : raw.remainingBytes),
143
+ tier: quotaEnabled ? (_a = normalizeTier(raw === null || raw === void 0 ? void 0 : raw.tier)) !== null && _a !== void 0 ? _a : 'free' : normalizeTier(raw === null || raw === void 0 ? void 0 : raw.tier),
144
+ // Missing canUpload must never wrongly block the composer.
145
+ canUpload: (raw === null || raw === void 0 ? void 0 : raw.canUpload) !== false,
146
+ };
25
147
  }
26
- function sentAtOf(m) {
27
- var _a, _b;
28
- const n = Number((_b = (_a = m.sentAt) !== null && _a !== void 0 ? _a : m.updatedAt) !== null && _b !== void 0 ? _b : 0);
29
- return Number.isFinite(n) ? n : 0;
30
- }
31
- /** Soft merge for gap-fill — keeps existing rows, upserts by messageId. */
32
- function mergeMessagesById(existing, incoming) {
33
- const byId = new Map();
34
- for (const m of existing) {
35
- const id = messageIdOf(m);
36
- if (id)
37
- byId.set(id, m);
148
+ function normalizeMediaItem(raw) {
149
+ var _a, _b, _c, _d, _e, _f;
150
+ const trim = (v) => {
151
+ const s = typeof v === 'string' ? v.trim() : '';
152
+ return s.length ? s : null;
153
+ };
154
+ return {
155
+ mediaId: String((_a = raw === null || raw === void 0 ? void 0 : raw.mediaId) !== null && _a !== void 0 ? _a : ''),
156
+ messageId: String((_b = raw === null || raw === void 0 ? void 0 : raw.messageId) !== null && _b !== void 0 ? _b : ''),
157
+ conversationId: String((_c = raw === null || raw === void 0 ? void 0 : raw.conversationId) !== null && _c !== void 0 ? _c : ''),
158
+ attachmentType: (_d = toInt(raw === null || raw === void 0 ? void 0 : raw.attachmentType)) !== null && _d !== void 0 ? _d : 0,
159
+ name: String((_e = raw === null || raw === void 0 ? void 0 : raw.name) !== null && _e !== void 0 ? _e : ''),
160
+ size: (_f = toInt(raw === null || raw === void 0 ? void 0 : raw.size)) !== null && _f !== void 0 ? _f : 0,
161
+ mediaUrl: trim(raw === null || raw === void 0 ? void 0 : raw.mediaUrl),
162
+ thumbnailUrl: trim(raw === null || raw === void 0 ? void 0 : raw.thumbnailUrl),
163
+ restricted: (raw === null || raw === void 0 ? void 0 : raw.restricted) === true,
164
+ };
165
+ }
166
+ /** `GET /chat/quota/storage/usage`. Returns `null` on a transport error. */
167
+ async function fetchStorageUsage() {
168
+ if (!config)
169
+ return null;
170
+ try {
171
+ const res = await fetch(`${config.baseUrl}/chat/quota/storage/usage`, {
172
+ method: 'GET',
173
+ headers: authHeaders(),
174
+ });
175
+ if (!res.ok)
176
+ return null;
177
+ return normalizeUsage(await res.json());
38
178
  }
39
- let added = 0;
40
- for (const m of incoming) {
41
- const id = messageIdOf(m);
42
- if (!id)
43
- continue;
44
- if (!byId.has(id))
45
- added += 1;
46
- byId.set(id, m);
179
+ catch (_a) {
180
+ return null;
47
181
  }
48
- const next = Array.from(byId.values()).sort((a, b) => sentAtOf(a) - sentAtOf(b));
49
- return { next, added };
50
182
  }
51
- async function searchMessages(opts) {
183
+ /** `GET /chat/quota/storage/media`. `limit` is clamped to 1..20. */
184
+ async function fetchStorageMedia(opts = {}) {
52
185
  var _a, _b;
53
- const res = await toast.M.getInstance().message.getMessages({
54
- conversationId: opts.conversationId,
55
- searchTag: opts.searchTag,
56
- skip: (_a = opts.skip) !== null && _a !== void 0 ? _a : 0,
57
- limit: (_b = opts.limit) !== null && _b !== void 0 ? _b : 20,
58
- });
59
- return (res === null || res === void 0 ? void 0 : res.messages) || [];
60
- }
61
- async function fetchLinkMessages(conversationId) {
62
- const res = await toast.M.getInstance().message.getMessages({
63
- conversationId,
64
- customTypes: 'AttachmentMessage:Link',
65
- });
66
- return (res === null || res === void 0 ? void 0 : res.messages) || [];
186
+ if (!config)
187
+ return null;
188
+ const limit = Math.min(20, Math.max(1, (_a = opts.limit) !== null && _a !== void 0 ? _a : 20));
189
+ const skip = Math.max(0, (_b = opts.skip) !== null && _b !== void 0 ? _b : 0);
190
+ const params = new URLSearchParams({ limit: String(limit), skip: String(skip) });
191
+ if (opts.conversationId)
192
+ params.set('conversationId', opts.conversationId);
193
+ try {
194
+ const res = await fetch(`${config.baseUrl}/chat/quota/storage/media?${params.toString()}`, {
195
+ method: 'GET',
196
+ headers: authHeaders(),
197
+ });
198
+ if (!res.ok)
199
+ return null;
200
+ const data = await res.json();
201
+ return {
202
+ quotaEnabled: (data === null || data === void 0 ? void 0 : data.quotaEnabled) === true,
203
+ msg: data === null || data === void 0 ? void 0 : data.msg,
204
+ media: Array.isArray(data === null || data === void 0 ? void 0 : data.media) ? data.media.map(normalizeMediaItem) : [],
205
+ };
206
+ }
207
+ catch (_c) {
208
+ return null;
209
+ }
67
210
  }
68
- async function fetchMediaCount(conversationId) {
211
+ function parseDeleteResult(raw) {
69
212
  var _a;
70
- const res = await toast.M.getInstance().message.getMessagesCount({
71
- conversationId,
72
- customTypes: 'AttachmentMessage:Link,AttachmentMessage:Multiple,AttachmentMessage:Image,AttachmentMessage:Video,AttachmentMessage:Audio,AttachmentMessage:File,AttachmentMessage:Doc',
73
- });
74
- return (_a = res === null || res === void 0 ? void 0 : res.messagesCount) !== null && _a !== void 0 ? _a : 0;
213
+ return {
214
+ freedBytes: (_a = toInt(raw === null || raw === void 0 ? void 0 : raw.freedBytes)) !== null && _a !== void 0 ? _a : 0,
215
+ usedBytes: toInt(raw === null || raw === void 0 ? void 0 : raw.usedBytes),
216
+ quotaBytes: toInt(raw === null || raw === void 0 ? void 0 : raw.quotaBytes),
217
+ msg: raw === null || raw === void 0 ? void 0 : raw.msg,
218
+ };
75
219
  }
76
- const RASTER = /\.(jpe?g|png|gif|webp|bmp|avif)(\?|#|$)/i;
77
- /** http(s) image first, then the local preview the chat bubble is already showing. */
78
- function mediaPreviewUrls(att) {
79
- if (!att)
80
- return [];
81
- const all = [att.thumbnailUrl, att.mediaUrl, att.localUrl, att.url].map(u => String(u || '')).filter(Boolean);
82
- const raster = all.filter(u => /^https?:/i.test(u) && RASTER.test(u));
83
- const local = all.filter(u => u.startsWith('data:') || u.startsWith('blob:'));
84
- const rest = all.filter(u => !raster.includes(u) && !local.includes(u));
85
- return [...new Set([...raster, ...local, ...rest])];
86
- }
87
- /** pdf / excel / rtf / txt from mime, extension, or file name. */
88
- function docIconKind(doc) {
89
- const t = `${(doc === null || doc === void 0 ? void 0 : doc.mimeType) || ''} ${(doc === null || doc === void 0 ? void 0 : doc.extension) || ''} ${(doc === null || doc === void 0 ? void 0 : doc.name) || ''} ${(doc === null || doc === void 0 ? void 0 : doc.nameWithExtension) || ''} ${(doc === null || doc === void 0 ? void 0 : doc.fileName) || ''}`.toLowerCase();
90
- if (/xlsx?|spreadsheet|excel|csv/.test(t))
91
- return 'excel';
92
- if (t.includes('pdf'))
93
- return 'pdf';
94
- if (t.includes('rtf'))
95
- return 'rtf';
96
- if (t.includes('text/plain') || /(^|[^a-z])txt([^a-z]|$)/.test(t))
97
- return 'txt';
98
- return 'file';
99
- }
100
- /** send-media.ts: 0 image, 1 video → media; 3 document → docs. */
101
- function attachmentBucket(att) {
102
- if (!att)
103
- return null;
104
- const mime = String(att.mimeType || '');
105
- if (mime.startsWith('image/') || mime.startsWith('video/'))
106
- return 'media';
107
- if (mime.startsWith('application/') || mime === 'text/plain' || mime.includes('rtf'))
108
- return 'docs';
109
- const type = att.mediaType == null || att.mediaType === '' ? NaN : Number(att.mediaType);
110
- if (type === 0 || type === 1)
111
- return 'media';
112
- if (type === 3)
113
- return 'docs';
114
- return null;
220
+ async function runDelete(url, body) {
221
+ if (!config)
222
+ return { result: null, status: 0, error: 'Storage quota not configured' };
223
+ try {
224
+ const res = await fetch(url, Object.assign({ method: 'DELETE', headers: authHeaders() }, (body !== undefined ? { body: JSON.stringify(body) } : {})));
225
+ const data = await res.json().catch(() => ({}));
226
+ if (!res.ok) {
227
+ return { result: null, status: res.status, error: (data === null || data === void 0 ? void 0 : data.error) || (data === null || data === void 0 ? void 0 : data.message) };
228
+ }
229
+ return { result: parseDeleteResult(data), status: res.status };
230
+ }
231
+ catch (e) {
232
+ return { result: null, status: 0, error: e === null || e === void 0 ? void 0 : e.message };
233
+ }
115
234
  }
116
- function splitSharedMessages(messages) {
117
- const media = [];
118
- const docs = [];
119
- const list = Array.isArray(messages) ? messages : [];
120
- list.forEach(message => {
121
- const atts = Array.isArray(message === null || message === void 0 ? void 0 : message.attachments)
122
- ? message.attachments
123
- : (message === null || message === void 0 ? void 0 : message.mediaUrl) || (message === null || message === void 0 ? void 0 : message.thumbnailUrl)
124
- ? [message]
125
- : [];
126
- atts.forEach((att) => {
127
- var _a;
128
- const item = Object.assign(Object.assign({}, att), { date: (message === null || message === void 0 ? void 0 : message.sentAt) || (att === null || att === void 0 ? void 0 : att.date), sender: ((_a = message === null || message === void 0 ? void 0 : message.senderInfo) === null || _a === void 0 ? void 0 : _a.userName) || (att === null || att === void 0 ? void 0 : att.sender) });
129
- const bucket = attachmentBucket(att);
130
- if (bucket === 'docs')
131
- docs.push(item);
132
- else if (bucket === 'media')
133
- media.push(item);
134
- });
135
- });
136
- return { media, docs };
235
+ /** `DELETE /chat/quota/media` with `{ mediaIds }` (1..50). For everyone. */
236
+ function deleteStorageMediaApi(mediaIds) {
237
+ if (!config)
238
+ return Promise.resolve({ result: null, status: 0, error: 'Storage quota not configured' });
239
+ return runDelete(`${config.baseUrl}/chat/quota/media`, { mediaIds });
240
+ }
241
+ /** `DELETE /chat/quota/storage/conversation/{id}/media`. For everyone. */
242
+ function deleteConversationStorageMediaApi(conversationId) {
243
+ if (!config)
244
+ return Promise.resolve({ result: null, status: 0, error: 'Storage quota not configured' });
245
+ return runDelete(`${config.baseUrl}/chat/quota/storage/conversation/${conversationId}/media`);
246
+ }
247
+ // ----------------------------------------------------------------- helpers
248
+ /** Fraction of the allowance used, 0..1. `0` when quota is off/unknown. */
249
+ function usedFraction(usage) {
250
+ var _a;
251
+ if (!usage || !usage.quotaEnabled || !usage.quotaBytes)
252
+ return 0;
253
+ const f = ((_a = usage.usedBytes) !== null && _a !== void 0 ? _a : 0) / usage.quotaBytes;
254
+ return Number.isFinite(f) ? Math.min(1, Math.max(0, f)) : 0;
137
255
  }
138
- /** Keep messages that have non-document media attachments. */
139
- function filterMediaMessages(messages) {
140
- if (!Array.isArray(messages))
141
- return [];
142
- return messages.filter(message => {
143
- if (!message.attachments || !Array.isArray(message.attachments))
144
- return false;
145
- const valid = message.attachments.filter((attachment) => (attachment === null || attachment === void 0 ? void 0 : attachment.mimeType) && !String(attachment.mimeType).startsWith('application'));
146
- return valid.length > 0;
147
- });
256
+ /** At/over the allowance (uploads blocked). Always false when quota is off. */
257
+ function isOverLimit(usage) {
258
+ return !!usage && usage.quotaEnabled && !usage.canUpload;
148
259
  }
149
- async function fetchMediaAttachments(conversationId) {
150
- const customTypes = 'AttachmentMessage:Media,AttachmentMessage:Multiple,AttachmentMessage:Image,AttachmentMessage:Video,AttachmentMessage:Audio,AttachmentMessage:File,AttachmentMessage:Doc';
151
- const pageSize = 20;
152
- const all = [];
153
- for (let skip = 0; skip < 1000; skip += pageSize) {
154
- const res = await toast.M.getInstance().message.getMessages({
155
- conversationId,
156
- customTypes,
157
- limit: pageSize,
158
- skip,
159
- });
160
- const batch = Array.isArray(res === null || res === void 0 ? void 0 : res.messages) ? res.messages : [];
161
- all.push(...batch);
162
- if (batch.length < pageSize)
163
- break;
164
- }
165
- return all;
260
+ /**
261
+ * True when usage is at or above `threshold` of the allowance (default `0.9` = 90%).
262
+ * Used by the conversation-list warning banner — mirrors Flutter's
263
+ * `IsmChatStorageUsageModel.shouldWarnNearQuota`.
264
+ * Always false when quota is off or quota size is unknown/zero.
265
+ */
266
+ function shouldWarnNearQuota(usage, threshold = 0.9) {
267
+ if (!(usage === null || usage === void 0 ? void 0 : usage.quotaEnabled))
268
+ return false;
269
+ const quota = usage.quotaBytes;
270
+ if (quota == null || quota <= 0)
271
+ return false;
272
+ return usedFraction(usage) >= threshold;
273
+ }
274
+ /** Whether an upload of `size` bytes fits. Always true when quota is off. */
275
+ function canUploadBytes(usage, size) {
276
+ if (!usage || !usage.quotaEnabled)
277
+ return true;
278
+ if (!usage.canUpload)
279
+ return false;
280
+ if (usage.remainingBytes == null)
281
+ return true;
282
+ return size <= usage.remainingBytes;
283
+ }
284
+ /** Whether an error/response is the storage-quota rejection (errorCode 6). */
285
+ function isQuotaExceededError(err) {
286
+ var _a, _b, _c, _d;
287
+ if (!err)
288
+ return false;
289
+ const code = (_c = (_a = err === null || err === void 0 ? void 0 : err.errorCode) !== null && _a !== void 0 ? _a : (_b = err === null || err === void 0 ? void 0 : err.data) === null || _b === void 0 ? void 0 : _b.errorCode) !== null && _c !== void 0 ? _c : (_d = err === null || err === void 0 ? void 0 : err.response) === null || _d === void 0 ? void 0 : _d.errorCode;
290
+ if (code === QUOTA_EXCEEDED_CODE)
291
+ return true;
292
+ const msg = String((err === null || err === void 0 ? void 0 : err.error) || (err === null || err === void 0 ? void 0 : err.message) || '').toLowerCase();
293
+ return msg.includes('storage quota');
294
+ }
295
+ /**
296
+ * Human-readable byte sizes for UI copy (e.g. `24.14 MB`, `1.07 GB`).
297
+ *
298
+ * Uses **decimal SI** steps (1 KB = 1_000 B, 1 MB = 1_000_000 B) so numbers match
299
+ * common product/dashboard expectations. API fields are still raw byte counts.
300
+ */
301
+ function formatBytes(bytes, fractionDigits = 2) {
302
+ const n = typeof bytes === 'number' && Number.isFinite(bytes) ? bytes : 0;
303
+ if (n <= 0)
304
+ return '0 B';
305
+ const base = 1000;
306
+ const units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB'];
307
+ const i = Math.min(units.length - 1, Math.floor(Math.log(n) / Math.log(base)));
308
+ const value = n / Math.pow(base, i);
309
+ return `${value.toFixed(i === 0 ? 0 : fractionDigits)} ${units[i]}`;
166
310
  }
167
311
 
168
312
  /** One chat message may carry at most this many attachments. */
@@ -620,14 +764,86 @@ function roundRect(ctx, x, y, width, height, radius) {
620
764
  }
621
765
 
622
766
  /**
623
- * Shared media-send helpers for ChatFooter + public web-chat.sendMedia.
624
- * Conversation path only (groupcast keeps using ChatFooter).
767
+ * Same-name storage upload UX (quota feature).
625
768
  *
626
- * Attachment body contract (Flutter / Swift / web):
627
- * - API rejects empty body → caption, filename (single doc), or 'AttachmentMessage:Multiple'
628
- * - Real caption for UI lives in metaData.caption (read captionMessage for older web sends)
769
+ * Contract: see SAME_NAME_UPLOAD_FRONTEND.md in product docs — presign returns
770
+ * `duplicate: true` without PUT URLs; user picks reshare vs `forceUpload: true`.
771
+ * Reused from send-media.ts, ChatFooter, and uploadAndPostMediaMessage.
629
772
  */
773
+ const SAME_NAME_UPLOAD_WARNING = 'A file with the same name is already in your storage.';
774
+ class SameNameUploadCancelledError extends Error {
775
+ constructor(message = 'Same-name upload cancelled') {
776
+ super(message);
777
+ this.name = 'SameNameUploadCancelledError';
778
+ }
779
+ }
780
+ function isSameNameUploadCancelledError(err) {
781
+ return err instanceof SameNameUploadCancelledError;
782
+ }
783
+ /**
784
+ * Modal: primary = new copy (forceUpload path), secondary = reshare older file.
785
+ * Drawer dismiss → cancel (caller removes optimistic message).
786
+ *
787
+ * Dynamic-imports drawer so unit tests that import send-media do not load Stencil shells.
788
+ */
789
+ function promptSameNameUpload(args) {
790
+ const { fileName, warning } = args;
791
+ const description = (warning === null || warning === void 0 ? void 0 : warning.trim()) || `“${fileName}”\n\n${SAME_NAME_UPLOAD_WARNING}`;
792
+ return Promise.resolve().then(function () { return require('./drawer-3f9c87b4.js'); }).then(({ drawerDialogService }) => {
793
+ return new Promise(resolve => {
794
+ const finish = (choice) => {
795
+ drawerDialogService.closeDialog('confirm-dialog');
796
+ resolve(choice);
797
+ };
798
+ let settled = false;
799
+ const settle = (choice) => {
800
+ if (settled)
801
+ return;
802
+ settled = true;
803
+ finish(choice);
804
+ };
805
+ drawerDialogService.openDialog('confirm-dialog', {
806
+ title: 'File already in storage',
807
+ description,
808
+ yesText: 'Upload a copy',
809
+ noText: 'Reshare older file',
810
+ handleConfirm: () => settle('forceUpload'),
811
+ handleCancel: () => settle('reshare'),
812
+ // Overlay / × close (drawer.ts calls onDismiss) → cancel send.
813
+ onDismiss: () => settle('cancel'),
814
+ });
815
+ });
816
+ });
817
+ }
818
+
819
+ var __rest = (undefined && undefined.__rest) || function (s, e) {
820
+ var t = {};
821
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
822
+ t[p] = s[p];
823
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
824
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
825
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
826
+ t[p[i]] = s[p[i]];
827
+ }
828
+ return t;
829
+ };
630
830
  const ATTACHMENT_BODY_PLACEHOLDER = 'AttachmentMessage:Multiple';
831
+ const DOCUMENT_ATTACHMENT_CUSTOM_TYPES = new Set(['AttachmentMessage:Doc', 'AttachmentMessage:File']);
832
+ /** Display/download filename on an attachment record (API may use `name` or `nameWithExtension`). */
833
+ function attachmentFileLabel(attachment) {
834
+ var _a, _b;
835
+ return String((_b = (_a = attachment === null || attachment === void 0 ? void 0 : attachment.name) !== null && _a !== void 0 ? _a : attachment === null || attachment === void 0 ? void 0 : attachment.nameWithExtension) !== null && _b !== void 0 ? _b : '').trim();
836
+ }
837
+ function labelsEqual(a, b) {
838
+ return a.localeCompare(b, undefined, { sensitivity: 'accent' }) === 0;
839
+ }
840
+ function attachmentFileLabels(attachments) {
841
+ return (attachments || []).map(a => attachmentFileLabel(a)).filter(Boolean);
842
+ }
843
+ /** Filename-only API body for a single document (e.g. `report.pdf`). */
844
+ function bodyLooksLikeStandaloneFileName(body) {
845
+ return /^[^\s/\\]+\.[^\s.]+$/i.test(body);
846
+ }
631
847
  function mediaTypeFromMime(mime) {
632
848
  if (!mime)
633
849
  return 3;
@@ -661,8 +877,12 @@ function attachmentCaption(message) {
661
877
  var _a, _b, _c, _d;
662
878
  const meta = message === null || message === void 0 ? void 0 : message.metaData;
663
879
  const fromMeta = String((_b = (_a = meta === null || meta === void 0 ? void 0 : meta.caption) !== null && _a !== void 0 ? _a : meta === null || meta === void 0 ? void 0 : meta.captionMessage) !== null && _b !== void 0 ? _b : '').trim();
664
- if (fromMeta)
880
+ const labels = attachmentFileLabels(message === null || message === void 0 ? void 0 : message.attachments);
881
+ if (fromMeta) {
882
+ if (labels.some(l => labelsEqual(l, fromMeta)))
883
+ return '';
665
884
  return fromMeta;
885
+ }
666
886
  const body = String((_c = message === null || message === void 0 ? void 0 : message.body) !== null && _c !== void 0 ? _c : '').trim();
667
887
  const customType = String((_d = message === null || message === void 0 ? void 0 : message.customType) !== null && _d !== void 0 ? _d : '').trim();
668
888
  // Multiple attachments: real caption lives in metaData only (Flutter/Swift/web); never use body text
@@ -670,8 +890,26 @@ function attachmentCaption(message) {
670
890
  return '';
671
891
  if (isAttachmentBodyPlaceholder(body))
672
892
  return '';
893
+ // Single doc without caption: body is the filename for the API — already shown on the card
894
+ if (labels.some(l => labelsEqual(l, body)))
895
+ return '';
896
+ if (DOCUMENT_ATTACHMENT_CUSTOM_TYPES.has(customType) &&
897
+ bodyLooksLikeStandaloneFileName(body) &&
898
+ labels.length <= 1) {
899
+ return '';
900
+ }
673
901
  return body;
674
902
  }
903
+ /** Document bubble caption — drop text that only repeats the attachment filename. */
904
+ function suppressDuplicateFileCaption(caption, attachment) {
905
+ const text = String(caption !== null && caption !== void 0 ? caption : '').trim();
906
+ if (!text)
907
+ return '';
908
+ const label = attachmentFileLabel(attachment);
909
+ if (label && labelsEqual(text, label))
910
+ return '';
911
+ return text;
912
+ }
675
913
  /** @deprecated Prefer attachmentBodyForOutgoing — kept for callers that only pass caption. */
676
914
  function attachmentBodyForApi(caption) {
677
915
  return (caption === null || caption === void 0 ? void 0 : caption.trim()) || ATTACHMENT_BODY_PLACEHOLDER;
@@ -827,6 +1065,142 @@ function buildLocalMediaAttachments(files) {
827
1065
  };
828
1066
  });
829
1067
  }
1068
+ function isPresignDuplicateSlot(slot) {
1069
+ return (slot === null || slot === void 0 ? void 0 : slot.duplicate) === true;
1070
+ }
1071
+ function presignedSlotsByMediaId(slots) {
1072
+ const map = new Map();
1073
+ for (const slot of slots || []) {
1074
+ if ((slot === null || slot === void 0 ? void 0 : slot.mediaId) != null)
1075
+ map.set(String(slot.mediaId), slot);
1076
+ }
1077
+ return map;
1078
+ }
1079
+ function presignRequestAttachments(attachments, forceUploadMediaIds) {
1080
+ return attachments.map(a => (Object.assign({ mediaId: a.mediaId, mediaType: a.mediaType, nameWithExtension: a.nameWithExtension }, ((forceUploadMediaIds === null || forceUploadMediaIds === void 0 ? void 0 : forceUploadMediaIds.has(a.mediaId)) ? { forceUpload: true } : {}))));
1081
+ }
1082
+ async function fetchPresignedUrlSlots(conversationId, attachments, forceUploadMediaIds) {
1083
+ const res = await index_m.M.getInstance().message.postMessagesPresignedurls({
1084
+ conversationId,
1085
+ attachments: presignRequestAttachments(attachments, forceUploadMediaIds),
1086
+ });
1087
+ const presignedUrls = (res === null || res === void 0 ? void 0 : res.presignedUrls)
1088
+ ? res.presignedUrls
1089
+ : (res === null || res === void 0 ? void 0 : res.presignedUrl)
1090
+ ? [res]
1091
+ : null;
1092
+ if (!(presignedUrls === null || presignedUrls === void 0 ? void 0 : presignedUrls.length)) {
1093
+ throw new Error('No presigned URLs returned for media upload');
1094
+ }
1095
+ return presignedUrls;
1096
+ }
1097
+ /**
1098
+ * Build message attachment for reshare after `duplicate: true` — no PUT.
1099
+ * Presign request uses client `attachment.mediaId` to match the slot; POST /chat/message
1100
+ * must use `slot.existingMediaId` so the server reuses the stored object (0 quota bytes).
1101
+ */
1102
+ function buildReshareAttachmentPayload(slot, attachment) {
1103
+ const mediaUrl = String(slot.mediaUrl || '');
1104
+ if (!mediaUrl) {
1105
+ throw new Error('Duplicate file response missing mediaUrl');
1106
+ }
1107
+ const existingMediaId = String(slot.existingMediaId || '').trim();
1108
+ if (!existingMediaId) {
1109
+ throw new Error('Duplicate file response missing existingMediaId');
1110
+ }
1111
+ const isPdf = isPdfFileAttachment(attachment);
1112
+ const isOffice = isOfficeFileAttachment(attachment);
1113
+ const needsImageThumb = isPdf || isOffice;
1114
+ const thumbnailUrl = needsImageThumb
1115
+ ? documentThumbnailUrl({ mediaUrl, thumbnailUrl: slot.thumbnailUrl })
1116
+ : String(slot.thumbnailUrl || mediaUrl);
1117
+ const fileExt = extensionFromFileName(attachment.nameWithExtension);
1118
+ return {
1119
+ mediaId: existingMediaId,
1120
+ mediaUrl,
1121
+ thumbnailUrl,
1122
+ mediaType: attachment.mediaType,
1123
+ nameWithExtension: attachment.nameWithExtension,
1124
+ name: attachment.nameWithExtension,
1125
+ mimeType: attachment.mimeType,
1126
+ extension: fileExt,
1127
+ size: attachment.size,
1128
+ attachmentType: attachment.mediaType,
1129
+ };
1130
+ }
1131
+ function mapOutgoingAttachmentsForApi(payloads) {
1132
+ return payloads.map(p => {
1133
+ if (p.forceUpload) {
1134
+ const rest = __rest(p, ["forceUpload"]);
1135
+ return Object.assign(Object.assign({}, rest), { forceUpload: true });
1136
+ }
1137
+ const rest = __rest(p, ["forceUpload"]);
1138
+ return rest;
1139
+ });
1140
+ }
1141
+ /**
1142
+ * Presign → (optional same-name prompt) → PUT or reshare → payloads for postMessages.
1143
+ * Processes duplicates sequentially so the user can choose per file.
1144
+ */
1145
+ async function resolveAttachmentPayloads(args) {
1146
+ var _a, _b, _c, _d;
1147
+ const { conversationId, attachments, renderPdfThumbnail, renderOfficeThumbnail } = args;
1148
+ const prompt = (_a = args.sameNameUploadPrompt) !== null && _a !== void 0 ? _a : promptSameNameUpload;
1149
+ const slots = (_b = args.presignedSlots) !== null && _b !== void 0 ? _b : (await fetchPresignedUrlSlots(conversationId, attachments));
1150
+ const slotById = presignedSlotsByMediaId(slots);
1151
+ const payloads = [];
1152
+ for (let index = 0; index < attachments.length; index++) {
1153
+ const attachment = attachments[index];
1154
+ const urlDetails = (_c = slotById.get(attachment.mediaId)) !== null && _c !== void 0 ? _c : slots[index];
1155
+ if (!urlDetails)
1156
+ continue;
1157
+ if (isPresignDuplicateSlot(urlDetails)) {
1158
+ const choice = await prompt({
1159
+ fileName: attachment.nameWithExtension,
1160
+ warning: urlDetails.warning,
1161
+ });
1162
+ if (choice === 'cancel') {
1163
+ throw new SameNameUploadCancelledError();
1164
+ }
1165
+ if (choice === 'reshare') {
1166
+ payloads.push(buildReshareAttachmentPayload(urlDetails, attachment));
1167
+ continue;
1168
+ }
1169
+ const forced = await fetchPresignedUrlSlots(conversationId, [attachment], new Set([attachment.mediaId]));
1170
+ const forceSlot = (_d = presignedSlotsByMediaId(forced).get(attachment.mediaId)) !== null && _d !== void 0 ? _d : forced[0];
1171
+ if (!forceSlot || isPresignDuplicateSlot(forceSlot)) {
1172
+ throw new Error('Could not get upload URL for duplicate file copy');
1173
+ }
1174
+ const uploaded = await uploadPresignedMediaAttachment({
1175
+ urlDetails: forceSlot,
1176
+ attachment,
1177
+ conversationId,
1178
+ renderPdfThumbnail,
1179
+ renderOfficeThumbnail,
1180
+ });
1181
+ if (!uploaded) {
1182
+ throw new Error('Upload failed for duplicate file copy');
1183
+ }
1184
+ payloads.push(Object.assign(Object.assign({}, uploaded), { forceUpload: true }));
1185
+ continue;
1186
+ }
1187
+ const uploaded = await uploadPresignedMediaAttachment({
1188
+ urlDetails,
1189
+ attachment,
1190
+ conversationId,
1191
+ renderPdfThumbnail,
1192
+ renderOfficeThumbnail,
1193
+ });
1194
+ if (!uploaded) {
1195
+ throw new Error(`Upload failed for ${attachment.nameWithExtension}`);
1196
+ }
1197
+ payloads.push(uploaded);
1198
+ }
1199
+ if (!payloads.length) {
1200
+ throw new Error('No attachments to send');
1201
+ }
1202
+ return payloads;
1203
+ }
830
1204
  /** PDF (or a file named *.pdf). The app cannot paint these bytes with Image.network. */
831
1205
  function isPdfFileAttachment(file) {
832
1206
  const mime = String((file === null || file === void 0 ? void 0 : file.mimeType) || '').toLowerCase();
@@ -1005,7 +1379,7 @@ async function putDocumentThumbnail(opts) {
1005
1379
  }
1006
1380
  if (!opts.conversationId)
1007
1381
  return '';
1008
- const res = await toast.M.getInstance().message.postMessagesPresignedurls({
1382
+ const res = await index_m.M.getInstance().message.postMessagesPresignedurls({
1009
1383
  conversationId: opts.conversationId,
1010
1384
  attachments: [
1011
1385
  {
@@ -1044,7 +1418,7 @@ async function uploadPresignedMediaAttachment(opts) {
1044
1418
  if (!attachment)
1045
1419
  return null;
1046
1420
  const mediaPresignedUrl = (urlDetails === null || urlDetails === void 0 ? void 0 : urlDetails.mediaPresignedUrl) || (urlDetails === null || urlDetails === void 0 ? void 0 : urlDetails.presignedUrl);
1047
- const mediaId = (urlDetails === null || urlDetails === void 0 ? void 0 : urlDetails.mediaId) || (urlDetails === null || urlDetails === void 0 ? void 0 : urlDetails.mediaUrl);
1421
+ const mediaId = attachment.mediaId || (urlDetails === null || urlDetails === void 0 ? void 0 : urlDetails.mediaId) || (urlDetails === null || urlDetails === void 0 ? void 0 : urlDetails.mediaUrl);
1048
1422
  const mediaUrl = urlDetails === null || urlDetails === void 0 ? void 0 : urlDetails.mediaUrl;
1049
1423
  const thumbnailPresignedUrl = urlDetails === null || urlDetails === void 0 ? void 0 : urlDetails.thumbnailPresignedUrl;
1050
1424
  const isPdf = isPdfFileAttachment(attachment);
@@ -1114,35 +1488,14 @@ async function uploadPresignedMediaAttachment(opts) {
1114
1488
  }
1115
1489
  /** Presign → PUT files → postMessages. Returns API messageId. */
1116
1490
  async function uploadAndPostMediaMessage(args) {
1117
- const { conversationId, deviceId, attachments, replyMessage, caption, mentionedUsers, pushContext } = args;
1491
+ const { conversationId, deviceId, attachments, replyMessage, caption, mentionedUsers, pushContext, sameNameUploadPrompt, } = args;
1118
1492
  if (!conversationId || !(attachments === null || attachments === void 0 ? void 0 : attachments.length))
1119
1493
  return null;
1120
- const resForPresignedUrl = await toast.M.getInstance().message.postMessagesPresignedurls({
1494
+ const allPayloads = await resolveAttachmentPayloads({
1121
1495
  conversationId,
1122
1496
  attachments,
1497
+ sameNameUploadPrompt,
1123
1498
  });
1124
- const presignedUrls = (resForPresignedUrl === null || resForPresignedUrl === void 0 ? void 0 : resForPresignedUrl.presignedUrls)
1125
- ? resForPresignedUrl.presignedUrls
1126
- : (resForPresignedUrl === null || resForPresignedUrl === void 0 ? void 0 : resForPresignedUrl.presignedUrl)
1127
- ? [resForPresignedUrl]
1128
- : null;
1129
- if (!(presignedUrls === null || presignedUrls === void 0 ? void 0 : presignedUrls.length)) {
1130
- throw new Error('No presigned URLs returned for media upload');
1131
- }
1132
- /** Typed array so `postMessages` payload is not `any[]` (strict noImplicitAny). */
1133
- const allPayloads = [];
1134
- await Promise.all(presignedUrls.map(async (urlDetails, index) => {
1135
- const attachmentPayload = attachments[index];
1136
- if (!attachmentPayload)
1137
- return;
1138
- const payload = await uploadPresignedMediaAttachment({
1139
- urlDetails,
1140
- attachment: attachmentPayload,
1141
- conversationId,
1142
- });
1143
- if (payload)
1144
- allPayloads.push(payload);
1145
- }));
1146
1499
  const customType = resolveCustomTypeForUpload(attachments);
1147
1500
  const payload = {
1148
1501
  showInConversation: true,
@@ -1152,14 +1505,14 @@ async function uploadAndPostMediaMessage(args) {
1152
1505
  conversationId,
1153
1506
  body: attachmentBodyForOutgoing(caption, attachments),
1154
1507
  customType,
1155
- attachments: allPayloads,
1508
+ attachments: mapOutgoingAttachmentsForApi(allPayloads),
1156
1509
  deviceId,
1157
1510
  metaData: buildReplyMetaData(replyMessage, caption),
1158
1511
  };
1159
1512
  if (mentionedUsers === null || mentionedUsers === void 0 ? void 0 : mentionedUsers.length)
1160
1513
  payload.mentionedUsers = mentionedUsers;
1161
1514
  localNotification.withHostMessagePushFields(payload, pushContext);
1162
- const sendMessageRes = await toast.M.getInstance().message.postMessages(payload);
1515
+ const sendMessageRes = await index_m.M.getInstance().message.postMessages(payload);
1163
1516
  return (sendMessageRes === null || sendMessageRes === void 0 ? void 0 : sendMessageRes.messageId) || null;
1164
1517
  }
1165
1518
 
@@ -1168,27 +1521,41 @@ exports.MAX_MEDIA_PER_MESSAGE = MAX_MEDIA_PER_MESSAGE;
1168
1521
  exports.attachmentBodyForApi = attachmentBodyForApi;
1169
1522
  exports.attachmentBodyForOutgoing = attachmentBodyForOutgoing;
1170
1523
  exports.attachmentCaption = attachmentCaption;
1524
+ exports.attachmentFileLabel = attachmentFileLabel;
1171
1525
  exports.buildLocalMediaAttachments = buildLocalMediaAttachments;
1172
1526
  exports.buildReplyMetaData = buildReplyMetaData;
1527
+ exports.canUploadBytes = canUploadBytes;
1528
+ exports.conversationMatchesSearch = conversationMatchesSearch;
1173
1529
  exports.customTypeFromMime = customTypeFromMime;
1174
- exports.docIconKind = docIconKind;
1175
- exports.fetchLinkMessages = fetchLinkMessages;
1176
- exports.fetchMediaAttachments = fetchMediaAttachments;
1177
- exports.fetchMediaCount = fetchMediaCount;
1178
- exports.fetchMessagesPage = fetchMessagesPage;
1179
- exports.filterMediaMessages = filterMediaMessages;
1530
+ exports.deleteConversationStorageMediaApi = deleteConversationStorageMediaApi;
1531
+ exports.deleteStorageMediaApi = deleteStorageMediaApi;
1532
+ exports.fetchConversationDetails = fetchConversationDetails;
1533
+ exports.fetchConversationsPage = fetchConversationsPage;
1534
+ exports.fetchStorageMedia = fetchStorageMedia;
1535
+ exports.fetchStorageUsage = fetchStorageUsage;
1536
+ exports.filterConversationsBySearch = filterConversationsBySearch;
1537
+ exports.formatBytes = formatBytes;
1180
1538
  exports.isAttachmentBodyPlaceholder = isAttachmentBodyPlaceholder;
1181
- exports.markConversationRead = markConversationRead;
1539
+ exports.isOverLimit = isOverLimit;
1540
+ exports.isPresignDuplicateSlot = isPresignDuplicateSlot;
1541
+ exports.isQuotaExceededError = isQuotaExceededError;
1542
+ exports.isSameNameUploadCancelledError = isSameNameUploadCancelledError;
1543
+ exports.mapOutgoingAttachmentsForApi = mapOutgoingAttachmentsForApi;
1182
1544
  exports.mediaLimitToastMessage = mediaLimitToastMessage;
1183
- exports.mediaPreviewUrls = mediaPreviewUrls;
1184
1545
  exports.mediaTypeFromMime = mediaTypeFromMime;
1185
- exports.mergeMessagesById = mergeMessagesById;
1546
+ exports.mergeUniqueConversations = mergeUniqueConversations;
1547
+ exports.normalizeConversationSearchTag = normalizeConversationSearchTag;
1186
1548
  exports.prepareMediaAttachments = prepareMediaAttachments;
1549
+ exports.presignedSlotsByMediaId = presignedSlotsByMediaId;
1550
+ exports.resolveAttachmentPayloads = resolveAttachmentPayloads;
1187
1551
  exports.resolveCustomTypeForUpload = resolveCustomTypeForUpload;
1188
- exports.searchMessages = searchMessages;
1189
- exports.splitSharedMessages = splitSharedMessages;
1552
+ exports.setStorageQuotaConfig = setStorageQuotaConfig;
1553
+ exports.shouldWarnNearQuota = shouldWarnNearQuota;
1554
+ exports.sortConversationsByLatestMessage = sortConversationsByLatestMessage;
1555
+ exports.suppressDuplicateFileCaption = suppressDuplicateFileCaption;
1190
1556
  exports.takeMediaFiles = takeMediaFiles;
1191
1557
  exports.uploadAndPostMediaMessage = uploadAndPostMediaMessage;
1192
1558
  exports.uploadPresignedMediaAttachment = uploadPresignedMediaAttachment;
1559
+ exports.usedFraction = usedFraction;
1193
1560
 
1194
- //# sourceMappingURL=send-media-4ee967d4.js.map
1561
+ //# sourceMappingURL=send-media-8a841e50.js.map