isometrik-plugin-chat-sdk 2.0.22 → 2.0.24

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 (181) hide show
  1. package/dist/cjs/{app-globals-0e7848be.js → app-globals-f55c4dba.js} +4 -4
  2. package/dist/cjs/{app-globals-0e7848be.js.map → app-globals-f55c4dba.js.map} +1 -1
  3. package/dist/cjs/attachment-preview_23.cjs.entry.js +98 -97
  4. package/dist/cjs/attachment-preview_23.cjs.entry.js.map +1 -1
  5. package/dist/cjs/{chat-tile_3.cjs.entry.js → chat-tile_2.cjs.entry.js} +1 -66
  6. package/dist/cjs/chat-tile_2.cjs.entry.js.map +1 -0
  7. package/dist/cjs/forward-memebers.cjs.entry.js +24 -5
  8. package/dist/cjs/forward-memebers.cjs.entry.js.map +1 -1
  9. package/dist/cjs/groupcast-9456b0c7.js +356 -0
  10. package/dist/cjs/groupcast-9456b0c7.js.map +1 -0
  11. package/dist/cjs/index.cjs.js +9 -9
  12. package/dist/cjs/iso-group-info.cjs.entry.js +74 -0
  13. package/dist/cjs/iso-group-info.cjs.entry.js.map +1 -0
  14. package/dist/cjs/isometrik-webchat.cjs.js +5 -5
  15. package/dist/cjs/loader.cjs.js +5 -5
  16. package/dist/cjs/login-page_3.cjs.entry.js +177 -69
  17. package/dist/cjs/login-page_3.cjs.entry.js.map +1 -1
  18. package/dist/cjs/member-add.cjs.entry.js +23 -5
  19. package/dist/cjs/member-add.cjs.entry.js.map +1 -1
  20. package/dist/cjs/{runtime-controls-a70872fe.js → runtime-controls-6d4fd7ed.js} +8 -7
  21. package/dist/cjs/runtime-controls-6d4fd7ed.js.map +1 -0
  22. package/dist/cjs/{groupcast-bb393c81.js → session-d44ca719.js} +1 -20
  23. package/dist/cjs/session-d44ca719.js.map +1 -0
  24. package/dist/collection/api/groupcast.js +42 -4
  25. package/dist/collection/components/ChatUIComponent/AddMember.js +24 -5
  26. package/dist/collection/components/ChatUIComponent/AddMember.js.map +1 -1
  27. package/dist/collection/components/ChatUIComponent/ChatSidebar/ChatSidebar.js +25 -2
  28. package/dist/collection/components/ChatUIComponent/ChatSidebar/ChatSidebar.js.map +1 -1
  29. package/dist/collection/components/ChatUIComponent/Footer/ChatFooter.js +58 -3
  30. package/dist/collection/components/ChatUIComponent/Footer/ChatFooter.js.map +1 -1
  31. package/dist/collection/components/ChatUIComponent/Header/WebChatHeader.js +15 -6
  32. package/dist/collection/components/ChatUIComponent/Header/WebChatHeader.js.map +1 -1
  33. package/dist/collection/components/ChatUIComponent/shared/ForwardMessageList/ForwardMessageList.js +24 -5
  34. package/dist/collection/components/ChatUIComponent/shared/ForwardMessageList/ForwardMessageList.js.map +1 -1
  35. package/dist/collection/components/ChatUIComponent/shared/GroupCast/GroupCast.js +29 -110
  36. package/dist/collection/components/ChatUIComponent/shared/GroupCast/GroupCast.js.map +1 -1
  37. package/dist/collection/components/ChatUIComponent/shared/contact-info/contact-info.js +4 -2
  38. package/dist/collection/components/ChatUIComponent/shared/contact-info/contact-info.js.map +1 -1
  39. package/dist/collection/components/ChatUIComponent/shared/message-search/message-search.js +4 -4
  40. package/dist/collection/components/ChatUIComponent/shared/message-search/message-search.js.map +1 -1
  41. package/dist/collection/components/my-component/web-chat/WebChat.js +49 -4
  42. package/dist/collection/components/my-component/web-chat/WebChat.js.map +1 -1
  43. package/dist/collection/components/my-component/web-chat/bootstrap.js +4 -0
  44. package/dist/collection/components/my-component/web-chat/bootstrap.js.map +1 -1
  45. package/dist/collection/components/my-component/web-chat/data-fetch.js +2 -2
  46. package/dist/collection/components/my-component/web-chat/data-fetch.js.map +1 -1
  47. package/dist/collection/components/my-component/web-chat/event-handlers.js +23 -6
  48. package/dist/collection/components/my-component/web-chat/event-handlers.js.map +1 -1
  49. package/dist/collection/components/my-component/web-chat/groupcast-draft.js +67 -0
  50. package/dist/collection/components/my-component/web-chat/groupcast-draft.js.map +1 -0
  51. package/dist/collection/components/my-component/web-chat/shell-render.js +2 -6
  52. package/dist/collection/components/my-component/web-chat/shell-render.js.map +1 -1
  53. package/dist/collection/lib/chat/groupcast.js +81 -1
  54. package/dist/collection/lib/chat/groupcast.js.map +1 -1
  55. package/dist/collection/lib/chat/index.js +1 -1
  56. package/dist/collection/lib/chat/index.js.map +1 -1
  57. package/dist/components/ChatFooter.js +41 -5
  58. package/dist/components/ChatFooter.js.map +1 -1
  59. package/dist/components/ChatSidebar.js +26 -3
  60. package/dist/components/ChatSidebar.js.map +1 -1
  61. package/dist/components/{GroupCast2.js → GroupCast3.js} +21 -98
  62. package/dist/components/GroupCast3.js.map +1 -0
  63. package/dist/components/WebChat.js +172 -62
  64. package/dist/components/WebChat.js.map +1 -1
  65. package/dist/components/WebChatBody.js +2 -2
  66. package/dist/components/WebChatHeader.js +15 -6
  67. package/dist/components/WebChatHeader.js.map +1 -1
  68. package/dist/components/chat-app.js +1 -1
  69. package/dist/components/client.js +1 -17
  70. package/dist/components/client.js.map +1 -1
  71. package/dist/components/contact-info2.js +4 -2
  72. package/dist/components/contact-info2.js.map +1 -1
  73. package/dist/components/forward-memebers.js +24 -5
  74. package/dist/components/forward-memebers.js.map +1 -1
  75. package/dist/components/group-cast.js +1 -1
  76. package/dist/components/groupcast.js +94 -192
  77. package/dist/components/groupcast.js.map +1 -1
  78. package/dist/{esm/groupcast-c6da3918.js → components/groupcast2.js} +45 -7
  79. package/dist/components/groupcast2.js.map +1 -0
  80. package/dist/components/helpers.js +1 -1
  81. package/dist/components/index.js +3 -2
  82. package/dist/components/index.js.map +1 -1
  83. package/dist/components/member-add.js +24 -5
  84. package/dist/components/member-add.js.map +1 -1
  85. package/dist/components/message-search2.js +4 -4
  86. package/dist/components/message-search2.js.map +1 -1
  87. package/dist/esm/{app-globals-eba1ca0c.js → app-globals-5dd18915.js} +3 -3
  88. package/dist/esm/{app-globals-eba1ca0c.js.map → app-globals-5dd18915.js.map} +1 -1
  89. package/dist/esm/attachment-preview_23.entry.js +99 -98
  90. package/dist/esm/attachment-preview_23.entry.js.map +1 -1
  91. package/dist/esm/audio-bubble_4.entry.js +1 -1
  92. package/dist/esm/{chat-tile_3.entry.js → chat-tile_2.entry.js} +3 -67
  93. package/dist/esm/chat-tile_2.entry.js.map +1 -0
  94. package/dist/esm/forward-memebers.entry.js +24 -5
  95. package/dist/esm/forward-memebers.entry.js.map +1 -1
  96. package/dist/esm/group-chat-contacts.entry.js +1 -1
  97. package/dist/esm/groupcast-e32d3b10.js +331 -0
  98. package/dist/esm/groupcast-e32d3b10.js.map +1 -0
  99. package/dist/esm/{helpers-1632a4c7.js → helpers-d452bc0f.js} +2 -2
  100. package/dist/esm/{helpers-1632a4c7.js.map → helpers-d452bc0f.js.map} +1 -1
  101. package/dist/esm/index.js +4 -4
  102. package/dist/esm/iso-group-info.entry.js +70 -0
  103. package/dist/esm/iso-group-info.entry.js.map +1 -0
  104. package/dist/esm/isometrik-webchat.js +5 -5
  105. package/dist/esm/loader.js +5 -5
  106. package/dist/esm/login-page_3.entry.js +168 -60
  107. package/dist/esm/login-page_3.entry.js.map +1 -1
  108. package/dist/esm/member-add.entry.js +25 -7
  109. package/dist/esm/member-add.entry.js.map +1 -1
  110. package/dist/esm/new-chat-sidebar.entry.js +1 -1
  111. package/dist/esm/{runtime-controls-bdb84aeb.js → runtime-controls-6dafba73.js} +3 -2
  112. package/dist/esm/runtime-controls-6dafba73.js.map +1 -0
  113. package/dist/esm/{groupcast-4f15b050.js → session-ed7217a7.js} +2 -18
  114. package/dist/esm/session-ed7217a7.js.map +1 -0
  115. package/dist/isometrik-webchat/index.esm.js +1 -1
  116. package/dist/isometrik-webchat/isometrik-webchat.esm.js +1 -1
  117. package/dist/isometrik-webchat/isometrik-webchat.esm.js.map +1 -1
  118. package/dist/isometrik-webchat/p-056f6809.entry.js +2 -0
  119. package/dist/isometrik-webchat/p-056f6809.entry.js.map +1 -0
  120. package/dist/isometrik-webchat/p-05b33578.js +2 -0
  121. package/dist/isometrik-webchat/{p-57f97cef.entry.js → p-0649db69.entry.js} +2 -2
  122. package/dist/isometrik-webchat/p-068abd0a.entry.js +2 -0
  123. package/dist/isometrik-webchat/p-068abd0a.entry.js.map +1 -0
  124. package/dist/isometrik-webchat/p-22404d0d.entry.js +2 -0
  125. package/dist/isometrik-webchat/p-22404d0d.entry.js.map +1 -0
  126. package/dist/isometrik-webchat/p-7d01ccbb.js +2 -0
  127. package/dist/isometrik-webchat/p-7d01ccbb.js.map +1 -0
  128. package/dist/isometrik-webchat/p-90c38a4e.entry.js +2 -0
  129. package/dist/isometrik-webchat/p-90c38a4e.entry.js.map +1 -0
  130. package/dist/isometrik-webchat/{p-0bb42151.entry.js → p-94f0c983.entry.js} +2 -2
  131. package/dist/isometrik-webchat/p-ac671eb5.js +2 -0
  132. package/dist/isometrik-webchat/p-ac671eb5.js.map +1 -0
  133. package/dist/isometrik-webchat/p-b884d9ee.entry.js +2 -0
  134. package/dist/isometrik-webchat/p-b884d9ee.entry.js.map +1 -0
  135. package/dist/isometrik-webchat/p-c4333279.entry.js +2 -0
  136. package/dist/isometrik-webchat/p-c4333279.entry.js.map +1 -0
  137. package/dist/isometrik-webchat/p-cce7d971.js +2 -0
  138. package/dist/isometrik-webchat/{p-a83932d4.js.map → p-cce7d971.js.map} +1 -1
  139. package/dist/isometrik-webchat/{p-02db2116.entry.js → p-ec03caec.entry.js} +2 -2
  140. package/dist/isometrik-webchat/{p-3dca1e56.js → p-f97e3f6d.js} +2 -2
  141. package/dist/types/components/ChatUIComponent/AddMember.d.ts +1 -0
  142. package/dist/types/components/ChatUIComponent/Footer/ChatFooter.d.ts +3 -1
  143. package/dist/types/components/ChatUIComponent/shared/ForwardMessageList/ForwardMessageList.d.ts +3 -0
  144. package/dist/types/components/ChatUIComponent/shared/GroupCast/GroupCast.d.ts +2 -11
  145. package/dist/types/components/my-component/web-chat/WebChat.d.ts +23 -0
  146. package/dist/types/components/my-component/web-chat/groupcast-draft.d.ts +23 -0
  147. package/dist/types/components.d.ts +13 -2
  148. package/dist/types/lib/chat/groupcast.d.ts +66 -0
  149. package/dist/types/lib/chat/index.d.ts +1 -1
  150. package/package.json +1 -1
  151. package/dist/cjs/chat-tile_3.cjs.entry.js.map +0 -1
  152. package/dist/cjs/groupcast-bb393c81.js.map +0 -1
  153. package/dist/cjs/groupcast-e1e52bd1.js +0 -213
  154. package/dist/cjs/groupcast-e1e52bd1.js.map +0 -1
  155. package/dist/cjs/runtime-controls-a70872fe.js.map +0 -1
  156. package/dist/components/GroupCast2.js.map +0 -1
  157. package/dist/esm/chat-tile_3.entry.js.map +0 -1
  158. package/dist/esm/groupcast-4f15b050.js.map +0 -1
  159. package/dist/esm/groupcast-c6da3918.js.map +0 -1
  160. package/dist/esm/runtime-controls-bdb84aeb.js.map +0 -1
  161. package/dist/isometrik-webchat/p-03933431.entry.js +0 -2
  162. package/dist/isometrik-webchat/p-03933431.entry.js.map +0 -1
  163. package/dist/isometrik-webchat/p-1f0e8230.entry.js +0 -2
  164. package/dist/isometrik-webchat/p-1f0e8230.entry.js.map +0 -1
  165. package/dist/isometrik-webchat/p-3a0409fc.js +0 -2
  166. package/dist/isometrik-webchat/p-3a0409fc.js.map +0 -1
  167. package/dist/isometrik-webchat/p-46be73c5.js +0 -2
  168. package/dist/isometrik-webchat/p-46be73c5.js.map +0 -1
  169. package/dist/isometrik-webchat/p-605cb14e.entry.js +0 -2
  170. package/dist/isometrik-webchat/p-605cb14e.entry.js.map +0 -1
  171. package/dist/isometrik-webchat/p-69d953cb.entry.js +0 -2
  172. package/dist/isometrik-webchat/p-69d953cb.entry.js.map +0 -1
  173. package/dist/isometrik-webchat/p-6c5eb178.js +0 -2
  174. package/dist/isometrik-webchat/p-a83932d4.js +0 -2
  175. package/dist/isometrik-webchat/p-b0f6f9ab.entry.js +0 -2
  176. package/dist/isometrik-webchat/p-b0f6f9ab.entry.js.map +0 -1
  177. /package/dist/isometrik-webchat/{p-6c5eb178.js.map → p-05b33578.js.map} +0 -0
  178. /package/dist/isometrik-webchat/{p-57f97cef.entry.js.map → p-0649db69.entry.js.map} +0 -0
  179. /package/dist/isometrik-webchat/{p-0bb42151.entry.js.map → p-94f0c983.entry.js.map} +0 -0
  180. /package/dist/isometrik-webchat/{p-02db2116.entry.js.map → p-ec03caec.entry.js.map} +0 -0
  181. /package/dist/isometrik-webchat/{p-3dca1e56.js.map → p-f97e3f6d.js.map} +0 -0
@@ -3,17 +3,17 @@ import { M as MQTT_CREDS, i as isometrikFlutterAppSecrets, C as CHAT_CREDS } fro
3
3
  import { i as isometrikLogo } from './IsometrikLogo-36cb0542.js';
4
4
  import { W as WEB_CONTENT } from './content-fd0af283.js';
5
5
  import { b as ChatBg, L as Login_banner } from './chat-assets-27beb552.js';
6
- import { d as applyThemeObjectToElement, n as normalizeThemeObject, i as initializeChatSdk, f as fetchUserDetails, a as fetchGroupcastDetails, b as fetchGroupcastMembersPage, c as fetchGroupcastContactsPage, e as resolveRegionMode } from './groupcast-4f15b050.js';
6
+ import { a as applyThemeObjectToElement, n as normalizeThemeObject, i as initializeChatSdk, f as fetchUserDetails, b as resolveRegionMode } from './session-ed7217a7.js';
7
+ import { s as showToast } from './toast-f681e916.js';
8
+ import { b as getGroupcastUrlQuery, c as getDeviceID } from './helpers-d452bc0f.js';
9
+ import { d as buildDraftGroupcastMeta, G as GROUPCAST_DRAFT_URL_ID, i as isGroupcastDraftId, e as createGroupcastFromDraft, D as DEFAULT_GROUPCAST_TITLE, h as DEFAULT_GROUPCAST_IMAGE_URL, j as getGroupcastMessage, f as fetchGroupcastDetails, a as fetchGroupcastMembersPage, b as fetchGroupcastContactsPage, r as removeGroupcastMember, k as removeFromMembersDetail, u as updateGroupCast, l as deleteGroupCast } from './groupcast-e32d3b10.js';
7
10
  import { drawerDialogService } from './drawer-a457d820.js';
8
- import { b as getDeviceID, c as getGroupcastUrlQuery } from './helpers-1632a4c7.js';
9
11
  import { M } from './index.m-8c70037f.js';
10
12
  import { c as createStore, s as storageQuotaStore, g as groupMembersStore, w as withConversationPushFlag } from './storage-quota-6329fabe.js';
11
- import { d as getGroupcastMessage, r as removeGroupcastMember, e as deleteGroupCast } from './groupcast-c6da3918.js';
12
13
  import { t as takeMediaFiles, M as MAX_MEDIA_PER_MESSAGE, k as attachmentBodyForApi, p as prepareMediaAttachments, u as uploadAndPostMediaMessage, l as isAttachmentBodyPlaceholder, n as isSameNameUploadCancelledError, o as normalizeConversationSearchTag, f as fetchConversationsPage, m as mergeUniqueConversations, q as filterConversationsBySearch, a as fetchConversationDetails, r as mediaLimitToastMessage, v as buildLocalMediaAttachments, w as attachmentBodyForOutgoing, x as resolveCustomTypeForUpload, d as buildReplyMetaData, s as sortConversationsByLatestMessage, g as fetchStorageMedia } from './send-media-04f7ca0a.js';
13
14
  import { f as findConversationForPush, s as showLocalMessageNotification, m as messagePushContextFrom, w as withHostMessagePushFields } from './local-notification-f9ae9062.js';
14
15
  import { g as getOfflineClient, m as mergeMessagesById, i as isBrowserOnline } from './client-de7fbead.js';
15
16
  import { f as fetchMessagesPage, s as searchMessages, b as fetchLinkMessages, c as fetchMediaCount, d as fetchMediaAttachments, m as markConversationRead } from './messages-057dbecb.js';
16
- import { s as showToast } from './toast-f681e916.js';
17
17
  import { r as removeConversationMember, g as getConversationEligibleMembers } from './group-members-d603f29f.js';
18
18
  import { h as hasNamedSlot } from './index-142896ce.js';
19
19
  import './destroy-chat-d0ee28d6.js';
@@ -982,6 +982,110 @@ function enqueueMqttTask(host, task) {
982
982
  return next;
983
983
  }
984
984
 
985
+ /** URL + conversation-select helpers — no Stencil, no API. */
986
+ function pushConversationUrl(conversationId) {
987
+ const url = new URL(window.location.href);
988
+ url.search = '';
989
+ if (conversationId)
990
+ url.searchParams.set('conversation', conversationId);
991
+ window.history.pushState({}, '', url);
992
+ }
993
+ function pushGroupcastUrl(groupcastId) {
994
+ const url = new URL(window.location.href);
995
+ url.search = '';
996
+ url.searchParams.set('groupcast', groupcastId);
997
+ window.history.pushState({}, '', url);
998
+ }
999
+ function clearChatUrls() {
1000
+ const url = new URL(window.location.href);
1001
+ url.searchParams.delete('conversation');
1002
+ url.searchParams.delete('groupcast');
1003
+ window.history.pushState({}, '', url.toString());
1004
+ }
1005
+ /** Sidebar preview meta when picking a conversation from the list. */
1006
+ function metaFromConversationList(list, conversationId) {
1007
+ const target = list === null || list === void 0 ? void 0 : list.find(c => (c === null || c === void 0 ? void 0 : c.conversationId) === conversationId);
1008
+ if (!target)
1009
+ return null;
1010
+ return {
1011
+ isGroup: target === null || target === void 0 ? void 0 : target.isGroup,
1012
+ conversationImageUrl: (target === null || target === void 0 ? void 0 : target.isGroup) ? target === null || target === void 0 ? void 0 : target.conversationImageUrl : null,
1013
+ conversationTitle: (target === null || target === void 0 ? void 0 : target.isGroup) ? target === null || target === void 0 ? void 0 : target.conversationTitle : null,
1014
+ opponentDetails: Object.assign({}, target.opponentDetails),
1015
+ };
1016
+ }
1017
+ function zeroUnreadInList(list, conversationId) {
1018
+ return (list || []).map(conversation => {
1019
+ if (conversation.conversationId === conversationId) {
1020
+ conversation.unreadMessagesCount = 0;
1021
+ }
1022
+ return conversation;
1023
+ });
1024
+ }
1025
+
1026
+ function hostOpenDraftGroupcast(host, members) {
1027
+ if (!(members === null || members === void 0 ? void 0 : members.length) || members.length < 2) {
1028
+ showToast({
1029
+ message: 'Select at least 2 recipients for a groupcast',
1030
+ type: 'error',
1031
+ position: 'bottom-right',
1032
+ });
1033
+ return;
1034
+ }
1035
+ host.draftGroupcast = { members };
1036
+ host.conversationMetaData = buildDraftGroupcastMeta(members);
1037
+ host.selectedConversationId = GROUPCAST_DRAFT_URL_ID;
1038
+ host.allMessages = [];
1039
+ host.groupcastCreateInFlight = null;
1040
+ pushGroupcastUrl(GROUPCAST_DRAFT_URL_ID);
1041
+ host.activeTab = 'GroupCast';
1042
+ if (host.isMobileView)
1043
+ host.showSidebar = false;
1044
+ }
1045
+ /** Resolves draft URL to a real groupcastId before sending. Single-flight. */
1046
+ async function hostEnsureGroupcastCreated(host) {
1047
+ var _a, _b, _c;
1048
+ const { groupcastId } = getGroupcastUrlQuery();
1049
+ const id = groupcastId || host.selectedConversationId;
1050
+ if (!isGroupcastDraftId(id))
1051
+ return id;
1052
+ if (!((_b = (_a = host.draftGroupcast) === null || _a === void 0 ? void 0 : _a.members) === null || _b === void 0 ? void 0 : _b.length)) {
1053
+ throw new Error('No groupcast draft — pick recipients again');
1054
+ }
1055
+ if (!host.groupcastCreateInFlight) {
1056
+ host.groupcastCreateInFlight = createGroupcastFromDraft(host.draftGroupcast.members, {
1057
+ userName: (_c = host.userMetaData) === null || _c === void 0 ? void 0 : _c.userName,
1058
+ })
1059
+ .then(res => {
1060
+ var _a, _b, _c;
1061
+ const newId = res === null || res === void 0 ? void 0 : res.groupcastId;
1062
+ if (!newId)
1063
+ throw new Error('Groupcast create failed');
1064
+ host.draftGroupcast = null;
1065
+ pushGroupcastUrl(newId);
1066
+ host.selectedConversationId = newId;
1067
+ const created = {
1068
+ groupcastId: newId,
1069
+ groupcastTitle: DEFAULT_GROUPCAST_TITLE,
1070
+ groupcastImageUrl: DEFAULT_GROUPCAST_IMAGE_URL,
1071
+ membersCount: (_a = res === null || res === void 0 ? void 0 : res.membersCount) !== null && _a !== void 0 ? _a : (_b = host.conversationMetaData) === null || _b === void 0 ? void 0 : _b.membersCount,
1072
+ createdAt: Date.now(),
1073
+ customType: 'broadcast',
1074
+ metaData: (_c = host.conversationMetaData) === null || _c === void 0 ? void 0 : _c.metaData,
1075
+ };
1076
+ host.allGroupCastContacts = [created, ...(host.allGroupCastContacts || [])];
1077
+ host.conversationMetaData = Object.assign(Object.assign({}, host.conversationMetaData), { groupcastId: newId });
1078
+ host.groupcastCreateInFlight = null;
1079
+ return newId;
1080
+ })
1081
+ .catch(err => {
1082
+ host.groupcastCreateInFlight = null;
1083
+ throw err;
1084
+ });
1085
+ }
1086
+ return host.groupcastCreateInFlight;
1087
+ }
1088
+
985
1089
  const getTotalUnreadConversationsCount = async () => {
986
1090
  const response = await M.getInstance().Conversation.getConversationUnreadCount();
987
1091
  return response?.count;
@@ -1304,6 +1408,9 @@ async function bootstrapWebChat(host, generation) {
1304
1408
  host.selectedConversationId = host.initialConversationIdFromURL;
1305
1409
  const isGroupCast = new URLSearchParams(window.location.search).has('groupcast');
1306
1410
  if (isGroupCast) {
1411
+ if (isGroupcastDraftId(host.initialConversationIdFromURL)) {
1412
+ return;
1413
+ }
1307
1414
  await host.getGroupCastConversationDetails(host.initialConversationIdFromURL);
1308
1415
  const messages = await getGroupcastMessage(host.initialConversationIdFromURL);
1309
1416
  if (messages === null || messages === void 0 ? void 0 : messages.messages) {
@@ -1362,47 +1469,6 @@ async function bootstrapWebChat(host, generation) {
1362
1469
  }
1363
1470
  }
1364
1471
 
1365
- /** URL + conversation-select helpers — no Stencil, no API. */
1366
- function pushConversationUrl(conversationId) {
1367
- const url = new URL(window.location.href);
1368
- url.search = '';
1369
- if (conversationId)
1370
- url.searchParams.set('conversation', conversationId);
1371
- window.history.pushState({}, '', url);
1372
- }
1373
- function pushGroupcastUrl(groupcastId) {
1374
- const url = new URL(window.location.href);
1375
- url.search = '';
1376
- url.searchParams.set('groupcast', groupcastId);
1377
- window.history.pushState({}, '', url);
1378
- }
1379
- function clearChatUrls() {
1380
- const url = new URL(window.location.href);
1381
- url.searchParams.delete('conversation');
1382
- url.searchParams.delete('groupcast');
1383
- window.history.pushState({}, '', url.toString());
1384
- }
1385
- /** Sidebar preview meta when picking a conversation from the list. */
1386
- function metaFromConversationList(list, conversationId) {
1387
- const target = list === null || list === void 0 ? void 0 : list.find(c => (c === null || c === void 0 ? void 0 : c.conversationId) === conversationId);
1388
- if (!target)
1389
- return null;
1390
- return {
1391
- isGroup: target === null || target === void 0 ? void 0 : target.isGroup,
1392
- conversationImageUrl: (target === null || target === void 0 ? void 0 : target.isGroup) ? target === null || target === void 0 ? void 0 : target.conversationImageUrl : null,
1393
- conversationTitle: (target === null || target === void 0 ? void 0 : target.isGroup) ? target === null || target === void 0 ? void 0 : target.conversationTitle : null,
1394
- opponentDetails: Object.assign({}, target.opponentDetails),
1395
- };
1396
- }
1397
- function zeroUnreadInList(list, conversationId) {
1398
- return (list || []).map(conversation => {
1399
- if (conversation.conversationId === conversationId) {
1400
- conversation.unreadMessagesCount = 0;
1401
- }
1402
- return conversation;
1403
- });
1404
- }
1405
-
1406
1472
  /**
1407
1473
  * Data-fetch helpers for <web-chat> — keep WebChat.tsx as a thin shell.
1408
1474
  */
@@ -1438,7 +1504,7 @@ async function hostGetConversations(host, skip = 0, searchTag = null, showLoader
1438
1504
  }
1439
1505
  }
1440
1506
  async function hostGetGroupCastConversationDetails(host, groupcastId) {
1441
- if (!groupcastId)
1507
+ if (!groupcastId || isGroupcastDraftId(groupcastId))
1442
1508
  return;
1443
1509
  try {
1444
1510
  host.conversationMetaData = await fetchGroupcastDetails(groupcastId);
@@ -2261,14 +2327,23 @@ async function apiCreateDmConversation(selectedContactId, selectedContactName) {
2261
2327
  * DOM / UI event bodies for <web-chat> — @Listen stays on the class, logic lives here.
2262
2328
  */
2263
2329
  async function hostRemoveMemberClicked(host, event) {
2264
- var _a;
2330
+ var _a, _b, _c, _d, _e, _f;
2265
2331
  const isGroupcast = event.detail.isGroupcast;
2266
2332
  const memberToRemove = event.detail.userId;
2267
2333
  const originalMembers = ((_a = host.conversationMetaData) === null || _a === void 0 ? void 0 : _a.members) || [];
2268
2334
  const groupcastId = event.detail.conversationId;
2269
2335
  try {
2270
2336
  if (isGroupcast) {
2271
- removeGroupcastMember(groupcastId, memberToRemove);
2337
+ const memberIds = Array.isArray(memberToRemove) ? memberToRemove : [memberToRemove];
2338
+ await removeGroupcastMember(groupcastId, memberIds);
2339
+ const existingDetail = (_c = (_b = host.conversationMetaData) === null || _b === void 0 ? void 0 : _b.metaData) === null || _c === void 0 ? void 0 : _c.membersDetail;
2340
+ const updatedDetail = removeFromMembersDetail(existingDetail, memberIds);
2341
+ const updatedMeta = Object.assign(Object.assign({}, (((_d = host.conversationMetaData) === null || _d === void 0 ? void 0 : _d.metaData) || {})), { membersDetail: updatedDetail });
2342
+ await updateGroupCast({ groupcastId, metaData: updatedMeta });
2343
+ host.conversationMetaData = Object.assign(Object.assign({}, host.conversationMetaData), { metaData: updatedMeta, members: (((_e = host.conversationMetaData) === null || _e === void 0 ? void 0 : _e.members) || []).filter((m) => !memberIds.includes(m.userId)), membersCount: updatedDetail.length });
2344
+ host.groupcastMembers = (host.groupcastMembers || []).filter((m) => !memberIds.includes(m.userId));
2345
+ void host.getGroupcastMembers(groupcastId);
2346
+ void ((_f = host.getGroupCastContacts) === null || _f === void 0 ? void 0 : _f.call(host));
2272
2347
  }
2273
2348
  else {
2274
2349
  await removeConversationMember(host.selectedConversationId, memberToRemove);
@@ -2433,6 +2508,11 @@ async function hostSelectedConversationChange(host, newValue) {
2433
2508
  const isGroupcast = url.searchParams.has('groupcast');
2434
2509
  if (isGroupcast) {
2435
2510
  const groupcastId = url.searchParams.get('groupcast');
2511
+ if (isGroupcastDraftId(groupcastId)) {
2512
+ host.isConversationLoading = false;
2513
+ host.emitSelectionChange();
2514
+ return;
2515
+ }
2436
2516
  try {
2437
2517
  host.isScrollToBottom = true;
2438
2518
  host.isMessageLimitEnd = true;
@@ -2459,10 +2539,11 @@ async function hostSelectedConversationChange(host, newValue) {
2459
2539
  const currentCount = unreadCountStore.getTotalUnreadCount();
2460
2540
  unreadCountStore.updateTotalUnreadCount(Math.max(0, currentCount - 1));
2461
2541
  }
2462
- // Always tell the server this thread is open — local unread flags race / miss.
2463
- void markConversationRead(newValue).catch(err => {
2464
- console.warn('[webchat] markConversationRead failed', err);
2465
- });
2542
+ if (!isGroupcastDraftId(newValue)) {
2543
+ void markConversationRead(newValue).catch(err => {
2544
+ console.warn('[webchat] markConversationRead failed', err);
2545
+ });
2546
+ }
2466
2547
  host.emitSelectionChange();
2467
2548
  }
2468
2549
  else if (host.conversationDetailsInterval) {
@@ -2826,11 +2907,7 @@ function renderSidebarTab(host) {
2826
2907
  const groupcastOn = host.groupcastEnabled !== false;
2827
2908
  const tab = host.activeTab === 'GroupCast' && !groupcastOn ? 'Chat' : host.activeTab;
2828
2909
  if (tab === 'GroupCast') {
2829
- return renderRegion(host, 'group-cast', true, () => (h("group-cast", { isLoadingMore: host.isLoadingMoreGroupcast, groupCastData: host.allGroupCastContacts, userMetaData: host.userMetaData, onGroupcastTileSelected: (e) => host.handleChatSelect(e.detail), onCreated: (g) => {
2830
- if (!(g === null || g === void 0 ? void 0 : g.groupcastId))
2831
- return;
2832
- host.allGroupCastContacts = [g, ...(host.allGroupCastContacts || [])];
2833
- } })));
2910
+ return renderRegion(host, 'group-cast', true, () => (h("group-cast", { isLoadingMore: host.isLoadingMoreGroupcast, groupCastData: host.allGroupCastContacts, userMetaData: host.userMetaData, onGroupcastTileSelected: (e) => host.handleChatSelect(e.detail) })));
2834
2911
  }
2835
2912
  if (tab === 'Profile') {
2836
2913
  return renderRegion(host, 'profile-page', true, () => (h("profile-page", { getUserDetails: host.getUserDetails, name: host.userMetaData.userName, profilePhotoUrl: host.userMetaData.userProfileImageUrl, closeDrawer: () => (host.activeTab = 'Chat'), toggleTheme: host.toggleTheme, defaultTheme: host.defaultTheme })));
@@ -2869,7 +2946,7 @@ function renderDefaultComposer(host) {
2869
2946
  return h("p", { class: "blockMessageContainer" }, WEB_CONTENT.BLOCK_CHAT_MESSAGE);
2870
2947
  }
2871
2948
  const el = host.el;
2872
- return (h("chat-footer", { userMetaData: host.userMetaData, updateAllMessages: host.updateAllMessages, changeMessageSendingState: host.changeMessageSendingState, changeScrollToBottomState: host.changeScrollToBottomState, refetchMessages: host.refetchMessages, allMessages: host.allMessages, selectedConversationId: host.selectedConversationId, replyMessage: host.replyMessage, handleremoveReplyMessage: host.handleremoveReplyMessage, conversationDetails: host.conversationMetaData, allConversationList: host.allConversationList, updateConversationListProp: host.updateConversationList },
2949
+ return (h("chat-footer", { userMetaData: host.userMetaData, updateAllMessages: host.updateAllMessages, changeMessageSendingState: host.changeMessageSendingState, changeScrollToBottomState: host.changeScrollToBottomState, refetchMessages: host.refetchMessages, allMessages: host.allMessages, selectedConversationId: host.selectedConversationId, replyMessage: host.replyMessage, handleremoveReplyMessage: host.handleremoveReplyMessage, conversationDetails: host.conversationMetaData, allConversationList: host.allConversationList, updateConversationListProp: host.updateConversationList, ensureGroupcastReady: host.ensureGroupcastReady },
2873
2950
  hasNamedSlot(el, 'reply-preview') ? h("slot", { name: "reply-preview", slot: "reply-preview" }) : null,
2874
2951
  hasNamedSlot(el, 'attachment-preview') ? h("slot", { name: "attachment-preview", slot: "attachment-preview" }) : null,
2875
2952
  hasNamedSlot(el, 'composer-input') ? h("slot", { name: "composer-input", slot: "composer-input" }) : null));
@@ -2957,6 +3034,7 @@ const WebChat = class {
2957
3034
  this.messageReadStatusUpdated = createEvent(this, "messageReadStatusUpdated", 7);
2958
3035
  this.chatBodyRef = null;
2959
3036
  this.conversationDetailsInterval = null;
3037
+ this.groupcastCreateInFlight = null;
2960
3038
  this.mqttSession = new MqttSession();
2961
3039
  this.boundCheckMobileView = () => this.checkMobileView();
2962
3040
  this.mqttRefetchInterval = null;
@@ -2982,6 +3060,8 @@ const WebChat = class {
2982
3060
  };
2983
3061
  this.userTokenFromCookie = this.getCookie('userToken');
2984
3062
  this.isometrikUserIdFromCookie = this.getCookie('isometrikUserId');
3063
+ // ─── Open chat / URL (navigation.ts) ───
3064
+ this.ensureGroupcastReady = () => hostEnsureGroupcastCreated(this);
2985
3065
  /// for get user details start
2986
3066
  // ─── Data fetch (thin wrappers → data-fetch.ts → lib/chat) ───
2987
3067
  this.getUserDetails = async () => hostGetUserDetails(this);
@@ -3178,6 +3258,7 @@ const WebChat = class {
3178
3258
  this.isLoadingMoreGroupcast = false;
3179
3259
  this.hasMoreGroupcast = true;
3180
3260
  this.groupcastMembers = [];
3261
+ this.draftGroupcast = null;
3181
3262
  }
3182
3263
  emitConversationsChange() {
3183
3264
  this.conversationsChange.emit({ conversations: this.allConversationList });
@@ -3327,7 +3408,16 @@ const WebChat = class {
3327
3408
  const groupcastId = urlParams.get('groupcast');
3328
3409
  this.initialConversationIdFromURL = (_a = (isGroupcast ? groupcastId : conversationId)) !== null && _a !== void 0 ? _a : '';
3329
3410
  this.isMobileView = window.innerWidth <= 768;
3330
- this.selectedConversationId = isGroupcast ? groupcastId : conversationId;
3411
+ if (isGroupcast && isGroupcastDraftId(groupcastId)) {
3412
+ this.selectedConversationId = null;
3413
+ this.initialConversationIdFromURL = '';
3414
+ const url = new URL(window.location.href);
3415
+ url.searchParams.delete('groupcast');
3416
+ window.history.replaceState({}, '', url.pathname + url.search);
3417
+ }
3418
+ else {
3419
+ this.selectedConversationId = isGroupcast ? groupcastId : conversationId;
3420
+ }
3331
3421
  if (this.isMobileView && (conversationId || groupcastId)) {
3332
3422
  this.showSidebar = false;
3333
3423
  }
@@ -3372,7 +3462,25 @@ const WebChat = class {
3372
3462
  async setupMqttClient() {
3373
3463
  return hostSetupMqttClient(this);
3374
3464
  }
3375
- // ─── Open chat / URL (navigation.ts) ───
3465
+ openDraftGroupcast(members) {
3466
+ hostOpenDraftGroupcast(this, members);
3467
+ }
3468
+ handleGroupcastDraftReady(event) {
3469
+ var _a;
3470
+ const members = (_a = event.detail) === null || _a === void 0 ? void 0 : _a.members;
3471
+ if (members === null || members === void 0 ? void 0 : members.length)
3472
+ this.openDraftGroupcast(members);
3473
+ }
3474
+ handleGroupcastMembersChanged(event) {
3475
+ var _a;
3476
+ const { groupcastId, membersDetail } = event.detail || {};
3477
+ if (!groupcastId || groupcastId !== this.selectedConversationId)
3478
+ return;
3479
+ if (membersDetail) {
3480
+ this.conversationMetaData = Object.assign(Object.assign({}, this.conversationMetaData), { metaData: Object.assign(Object.assign({}, (((_a = this.conversationMetaData) === null || _a === void 0 ? void 0 : _a.metaData) || {})), { membersDetail }), membersCount: membersDetail.length });
3481
+ }
3482
+ void this.getGroupcastMembers(groupcastId);
3483
+ }
3376
3484
  handleChatSelect(param) {
3377
3485
  const conversationId = typeof param === 'string' ? param : param.groupcastId;
3378
3486
  this.selectedConversationId = conversationId;