isometrik-plugin-chat-sdk 2.0.23 → 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
@@ -7,17 +7,17 @@ const chatCreds = require('./chat-creds-2dbc4087.js');
7
7
  const IsometrikLogo = require('./IsometrikLogo-9e642f65.js');
8
8
  const content = require('./content-8b271b56.js');
9
9
  const chatAssets = require('./chat-assets-8c4dc04f.js');
10
- const groupcast = require('./groupcast-bb393c81.js');
11
- const drawer = require('./drawer-3f9c87b4.js');
10
+ const session = require('./session-d44ca719.js');
11
+ const toast = require('./toast-a75f822c.js');
12
12
  const helpers = require('./helpers-877a7116.js');
13
+ const groupcast = require('./groupcast-9456b0c7.js');
14
+ const drawer = require('./drawer-3f9c87b4.js');
13
15
  const index_m = require('./index.m-ff115b26.js');
14
16
  const storageQuota = require('./storage-quota-2e81fb71.js');
15
- const groupcast$1 = require('./groupcast-e1e52bd1.js');
16
17
  const sendMedia = require('./send-media-8a841e50.js');
17
18
  const localNotification = require('./local-notification-a86a2b34.js');
18
19
  const client = require('./client-fef5fd3d.js');
19
20
  const messages = require('./messages-e129b34d.js');
20
- const toast = require('./toast-a75f822c.js');
21
21
  const groupMembers = require('./group-members-1205fc4c.js');
22
22
  const index$1 = require('./index-3411923c.js');
23
23
  require('./destroy-chat-7ae8fc99.js');
@@ -106,7 +106,7 @@ const ThemeProvider = class {
106
106
  }
107
107
  }
108
108
  applyThemeObject(theme) {
109
- groupcast.applyThemeObjectToElement(this.hostElement, theme || null);
109
+ session.applyThemeObjectToElement(this.hostElement, theme || null);
110
110
  }
111
111
  /** Mode class on this host only — CSS vars inherit into <web-chat> shadow. */
112
112
  updateThemeClass(mode) {
@@ -143,8 +143,8 @@ const ThemeProvider = class {
143
143
  return this.mode;
144
144
  }
145
145
  async setThemeObject(theme) {
146
- const normalized = groupcast.normalizeThemeObject(theme || undefined);
147
- groupcast.applyThemeObjectToElement(this.hostElement, normalized);
146
+ const normalized = session.normalizeThemeObject(theme || undefined);
147
+ session.applyThemeObjectToElement(this.hostElement, normalized);
148
148
  return normalized;
149
149
  }
150
150
  render() {
@@ -986,6 +986,110 @@ function enqueueMqttTask(host, task) {
986
986
  return next;
987
987
  }
988
988
 
989
+ /** URL + conversation-select helpers — no Stencil, no API. */
990
+ function pushConversationUrl(conversationId) {
991
+ const url = new URL(window.location.href);
992
+ url.search = '';
993
+ if (conversationId)
994
+ url.searchParams.set('conversation', conversationId);
995
+ window.history.pushState({}, '', url);
996
+ }
997
+ function pushGroupcastUrl(groupcastId) {
998
+ const url = new URL(window.location.href);
999
+ url.search = '';
1000
+ url.searchParams.set('groupcast', groupcastId);
1001
+ window.history.pushState({}, '', url);
1002
+ }
1003
+ function clearChatUrls() {
1004
+ const url = new URL(window.location.href);
1005
+ url.searchParams.delete('conversation');
1006
+ url.searchParams.delete('groupcast');
1007
+ window.history.pushState({}, '', url.toString());
1008
+ }
1009
+ /** Sidebar preview meta when picking a conversation from the list. */
1010
+ function metaFromConversationList(list, conversationId) {
1011
+ const target = list === null || list === void 0 ? void 0 : list.find(c => (c === null || c === void 0 ? void 0 : c.conversationId) === conversationId);
1012
+ if (!target)
1013
+ return null;
1014
+ return {
1015
+ isGroup: target === null || target === void 0 ? void 0 : target.isGroup,
1016
+ conversationImageUrl: (target === null || target === void 0 ? void 0 : target.isGroup) ? target === null || target === void 0 ? void 0 : target.conversationImageUrl : null,
1017
+ conversationTitle: (target === null || target === void 0 ? void 0 : target.isGroup) ? target === null || target === void 0 ? void 0 : target.conversationTitle : null,
1018
+ opponentDetails: Object.assign({}, target.opponentDetails),
1019
+ };
1020
+ }
1021
+ function zeroUnreadInList(list, conversationId) {
1022
+ return (list || []).map(conversation => {
1023
+ if (conversation.conversationId === conversationId) {
1024
+ conversation.unreadMessagesCount = 0;
1025
+ }
1026
+ return conversation;
1027
+ });
1028
+ }
1029
+
1030
+ function hostOpenDraftGroupcast(host, members) {
1031
+ if (!(members === null || members === void 0 ? void 0 : members.length) || members.length < 2) {
1032
+ toast.showToast({
1033
+ message: 'Select at least 2 recipients for a groupcast',
1034
+ type: 'error',
1035
+ position: 'bottom-right',
1036
+ });
1037
+ return;
1038
+ }
1039
+ host.draftGroupcast = { members };
1040
+ host.conversationMetaData = groupcast.buildDraftGroupcastMeta(members);
1041
+ host.selectedConversationId = groupcast.GROUPCAST_DRAFT_URL_ID;
1042
+ host.allMessages = [];
1043
+ host.groupcastCreateInFlight = null;
1044
+ pushGroupcastUrl(groupcast.GROUPCAST_DRAFT_URL_ID);
1045
+ host.activeTab = 'GroupCast';
1046
+ if (host.isMobileView)
1047
+ host.showSidebar = false;
1048
+ }
1049
+ /** Resolves draft URL to a real groupcastId before sending. Single-flight. */
1050
+ async function hostEnsureGroupcastCreated(host) {
1051
+ var _a, _b, _c;
1052
+ const { groupcastId } = helpers.getGroupcastUrlQuery();
1053
+ const id = groupcastId || host.selectedConversationId;
1054
+ if (!groupcast.isGroupcastDraftId(id))
1055
+ return id;
1056
+ if (!((_b = (_a = host.draftGroupcast) === null || _a === void 0 ? void 0 : _a.members) === null || _b === void 0 ? void 0 : _b.length)) {
1057
+ throw new Error('No groupcast draft — pick recipients again');
1058
+ }
1059
+ if (!host.groupcastCreateInFlight) {
1060
+ host.groupcastCreateInFlight = groupcast.createGroupcastFromDraft(host.draftGroupcast.members, {
1061
+ userName: (_c = host.userMetaData) === null || _c === void 0 ? void 0 : _c.userName,
1062
+ })
1063
+ .then(res => {
1064
+ var _a, _b, _c;
1065
+ const newId = res === null || res === void 0 ? void 0 : res.groupcastId;
1066
+ if (!newId)
1067
+ throw new Error('Groupcast create failed');
1068
+ host.draftGroupcast = null;
1069
+ pushGroupcastUrl(newId);
1070
+ host.selectedConversationId = newId;
1071
+ const created = {
1072
+ groupcastId: newId,
1073
+ groupcastTitle: groupcast.DEFAULT_GROUPCAST_TITLE,
1074
+ groupcastImageUrl: groupcast.DEFAULT_GROUPCAST_IMAGE_URL,
1075
+ 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,
1076
+ createdAt: Date.now(),
1077
+ customType: 'broadcast',
1078
+ metaData: (_c = host.conversationMetaData) === null || _c === void 0 ? void 0 : _c.metaData,
1079
+ };
1080
+ host.allGroupCastContacts = [created, ...(host.allGroupCastContacts || [])];
1081
+ host.conversationMetaData = Object.assign(Object.assign({}, host.conversationMetaData), { groupcastId: newId });
1082
+ host.groupcastCreateInFlight = null;
1083
+ return newId;
1084
+ })
1085
+ .catch(err => {
1086
+ host.groupcastCreateInFlight = null;
1087
+ throw err;
1088
+ });
1089
+ }
1090
+ return host.groupcastCreateInFlight;
1091
+ }
1092
+
989
1093
  const getTotalUnreadConversationsCount = async () => {
990
1094
  const response = await index_m.M.getInstance().Conversation.getConversationUnreadCount();
991
1095
  return response?.count;
@@ -1270,7 +1374,7 @@ async function bootstrapWebChat(host, generation) {
1270
1374
  try {
1271
1375
  host.updateLoading(25, 'Loading chat engine…');
1272
1376
  // initializeChatSdk also configures the media storage quota calls.
1273
- groupcast.initializeChatSdk({
1377
+ session.initializeChatSdk({
1274
1378
  baseUrl: host.baseUrl,
1275
1379
  licenseKey: host.licenseKey,
1276
1380
  appSecret: host.appSecret,
@@ -1308,8 +1412,11 @@ async function bootstrapWebChat(host, generation) {
1308
1412
  host.selectedConversationId = host.initialConversationIdFromURL;
1309
1413
  const isGroupCast = new URLSearchParams(window.location.search).has('groupcast');
1310
1414
  if (isGroupCast) {
1415
+ if (groupcast.isGroupcastDraftId(host.initialConversationIdFromURL)) {
1416
+ return;
1417
+ }
1311
1418
  await host.getGroupCastConversationDetails(host.initialConversationIdFromURL);
1312
- const messages = await groupcast$1.getGroupcastMessage(host.initialConversationIdFromURL);
1419
+ const messages = await groupcast.getGroupcastMessage(host.initialConversationIdFromURL);
1313
1420
  if (messages === null || messages === void 0 ? void 0 : messages.messages) {
1314
1421
  host.allMessages = messages.messages.reverse();
1315
1422
  }
@@ -1366,53 +1473,12 @@ async function bootstrapWebChat(host, generation) {
1366
1473
  }
1367
1474
  }
1368
1475
 
1369
- /** URL + conversation-select helpers — no Stencil, no API. */
1370
- function pushConversationUrl(conversationId) {
1371
- const url = new URL(window.location.href);
1372
- url.search = '';
1373
- if (conversationId)
1374
- url.searchParams.set('conversation', conversationId);
1375
- window.history.pushState({}, '', url);
1376
- }
1377
- function pushGroupcastUrl(groupcastId) {
1378
- const url = new URL(window.location.href);
1379
- url.search = '';
1380
- url.searchParams.set('groupcast', groupcastId);
1381
- window.history.pushState({}, '', url);
1382
- }
1383
- function clearChatUrls() {
1384
- const url = new URL(window.location.href);
1385
- url.searchParams.delete('conversation');
1386
- url.searchParams.delete('groupcast');
1387
- window.history.pushState({}, '', url.toString());
1388
- }
1389
- /** Sidebar preview meta when picking a conversation from the list. */
1390
- function metaFromConversationList(list, conversationId) {
1391
- const target = list === null || list === void 0 ? void 0 : list.find(c => (c === null || c === void 0 ? void 0 : c.conversationId) === conversationId);
1392
- if (!target)
1393
- return null;
1394
- return {
1395
- isGroup: target === null || target === void 0 ? void 0 : target.isGroup,
1396
- conversationImageUrl: (target === null || target === void 0 ? void 0 : target.isGroup) ? target === null || target === void 0 ? void 0 : target.conversationImageUrl : null,
1397
- conversationTitle: (target === null || target === void 0 ? void 0 : target.isGroup) ? target === null || target === void 0 ? void 0 : target.conversationTitle : null,
1398
- opponentDetails: Object.assign({}, target.opponentDetails),
1399
- };
1400
- }
1401
- function zeroUnreadInList(list, conversationId) {
1402
- return (list || []).map(conversation => {
1403
- if (conversation.conversationId === conversationId) {
1404
- conversation.unreadMessagesCount = 0;
1405
- }
1406
- return conversation;
1407
- });
1408
- }
1409
-
1410
1476
  /**
1411
1477
  * Data-fetch helpers for <web-chat> — keep WebChat.tsx as a thin shell.
1412
1478
  */
1413
1479
  async function hostGetUserDetails(host) {
1414
1480
  try {
1415
- host.userMetaData = await groupcast.fetchUserDetails();
1481
+ host.userMetaData = await session.fetchUserDetails();
1416
1482
  }
1417
1483
  catch (error) {
1418
1484
  console.error(error, 'getUserDetails fetching error');
@@ -1442,7 +1508,7 @@ async function hostGetConversations(host, skip = 0, searchTag = null, showLoader
1442
1508
  }
1443
1509
  }
1444
1510
  async function hostGetGroupCastConversationDetails(host, groupcastId) {
1445
- if (!groupcastId)
1511
+ if (!groupcastId || groupcast.isGroupcastDraftId(groupcastId))
1446
1512
  return;
1447
1513
  try {
1448
1514
  host.conversationMetaData = await groupcast.fetchGroupcastDetails(groupcastId);
@@ -2265,14 +2331,23 @@ async function apiCreateDmConversation(selectedContactId, selectedContactName) {
2265
2331
  * DOM / UI event bodies for <web-chat> — @Listen stays on the class, logic lives here.
2266
2332
  */
2267
2333
  async function hostRemoveMemberClicked(host, event) {
2268
- var _a;
2334
+ var _a, _b, _c, _d, _e, _f;
2269
2335
  const isGroupcast = event.detail.isGroupcast;
2270
2336
  const memberToRemove = event.detail.userId;
2271
2337
  const originalMembers = ((_a = host.conversationMetaData) === null || _a === void 0 ? void 0 : _a.members) || [];
2272
2338
  const groupcastId = event.detail.conversationId;
2273
2339
  try {
2274
2340
  if (isGroupcast) {
2275
- groupcast$1.removeGroupcastMember(groupcastId, memberToRemove);
2341
+ const memberIds = Array.isArray(memberToRemove) ? memberToRemove : [memberToRemove];
2342
+ await groupcast.removeGroupcastMember(groupcastId, memberIds);
2343
+ const existingDetail = (_c = (_b = host.conversationMetaData) === null || _b === void 0 ? void 0 : _b.metaData) === null || _c === void 0 ? void 0 : _c.membersDetail;
2344
+ const updatedDetail = groupcast.removeFromMembersDetail(existingDetail, memberIds);
2345
+ const updatedMeta = Object.assign(Object.assign({}, (((_d = host.conversationMetaData) === null || _d === void 0 ? void 0 : _d.metaData) || {})), { membersDetail: updatedDetail });
2346
+ await groupcast.updateGroupCast({ groupcastId, metaData: updatedMeta });
2347
+ 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 });
2348
+ host.groupcastMembers = (host.groupcastMembers || []).filter((m) => !memberIds.includes(m.userId));
2349
+ void host.getGroupcastMembers(groupcastId);
2350
+ void ((_f = host.getGroupCastContacts) === null || _f === void 0 ? void 0 : _f.call(host));
2276
2351
  }
2277
2352
  else {
2278
2353
  await groupMembers.removeConversationMember(host.selectedConversationId, memberToRemove);
@@ -2437,6 +2512,11 @@ async function hostSelectedConversationChange(host, newValue) {
2437
2512
  const isGroupcast = url.searchParams.has('groupcast');
2438
2513
  if (isGroupcast) {
2439
2514
  const groupcastId = url.searchParams.get('groupcast');
2515
+ if (groupcast.isGroupcastDraftId(groupcastId)) {
2516
+ host.isConversationLoading = false;
2517
+ host.emitSelectionChange();
2518
+ return;
2519
+ }
2440
2520
  try {
2441
2521
  host.isScrollToBottom = true;
2442
2522
  host.isMessageLimitEnd = true;
@@ -2444,7 +2524,7 @@ async function hostSelectedConversationChange(host, newValue) {
2444
2524
  host.skip = 0;
2445
2525
  host.allMessages = [];
2446
2526
  await host.getGroupCastConversationDetails(groupcastId);
2447
- const messages = await groupcast$1.getGroupcastMessage(groupcastId);
2527
+ const messages = await groupcast.getGroupcastMessage(groupcastId);
2448
2528
  if (messages === null || messages === void 0 ? void 0 : messages.messages) {
2449
2529
  host.allMessages = messages.messages.reverse();
2450
2530
  }
@@ -2463,10 +2543,11 @@ async function hostSelectedConversationChange(host, newValue) {
2463
2543
  const currentCount = unreadCountStore.getTotalUnreadCount();
2464
2544
  unreadCountStore.updateTotalUnreadCount(Math.max(0, currentCount - 1));
2465
2545
  }
2466
- // Always tell the server this thread is open — local unread flags race / miss.
2467
- void messages.markConversationRead(newValue).catch(err => {
2468
- console.warn('[webchat] markConversationRead failed', err);
2469
- });
2546
+ if (!groupcast.isGroupcastDraftId(newValue)) {
2547
+ void messages.markConversationRead(newValue).catch(err => {
2548
+ console.warn('[webchat] markConversationRead failed', err);
2549
+ });
2550
+ }
2470
2551
  host.emitSelectionChange();
2471
2552
  }
2472
2553
  else if (host.conversationDetailsInterval) {
@@ -2531,7 +2612,7 @@ async function hostDeleteGroupcast(host, e) {
2531
2612
  var _a;
2532
2613
  try {
2533
2614
  const groupcastId = (_a = e === null || e === void 0 ? void 0 : e.detail) === null || _a === void 0 ? void 0 : _a.groupcastId;
2534
- await groupcast$1.deleteGroupCast(groupcastId);
2615
+ await groupcast.deleteGroupCast(groupcastId);
2535
2616
  host.allGroupCastContacts = host.allGroupCastContacts.filter((groupcast) => groupcast.groupcastId !== groupcastId);
2536
2617
  clearChatUrls();
2537
2618
  host.selectedConversationId = null;
@@ -2779,7 +2860,7 @@ function shouldShowRightPanelScrim(host) {
2779
2860
  }
2780
2861
  /** show / custom-slot / default matrix for any named region. */
2781
2862
  function renderRegion(host, slotName, show, renderDefault) {
2782
- const mode = groupcast.resolveRegionMode({
2863
+ const mode = session.resolveRegionMode({
2783
2864
  show,
2784
2865
  hasCustomSlot: index$1.hasNamedSlot(host.el, slotName),
2785
2866
  });
@@ -2830,11 +2911,7 @@ function renderSidebarTab(host) {
2830
2911
  const groupcastOn = host.groupcastEnabled !== false;
2831
2912
  const tab = host.activeTab === 'GroupCast' && !groupcastOn ? 'Chat' : host.activeTab;
2832
2913
  if (tab === 'GroupCast') {
2833
- return renderRegion(host, 'group-cast', true, () => (index.h("group-cast", { isLoadingMore: host.isLoadingMoreGroupcast, groupCastData: host.allGroupCastContacts, userMetaData: host.userMetaData, onGroupcastTileSelected: (e) => host.handleChatSelect(e.detail), onCreated: (g) => {
2834
- if (!(g === null || g === void 0 ? void 0 : g.groupcastId))
2835
- return;
2836
- host.allGroupCastContacts = [g, ...(host.allGroupCastContacts || [])];
2837
- } })));
2914
+ return renderRegion(host, 'group-cast', true, () => (index.h("group-cast", { isLoadingMore: host.isLoadingMoreGroupcast, groupCastData: host.allGroupCastContacts, userMetaData: host.userMetaData, onGroupcastTileSelected: (e) => host.handleChatSelect(e.detail) })));
2838
2915
  }
2839
2916
  if (tab === 'Profile') {
2840
2917
  return renderRegion(host, 'profile-page', true, () => (index.h("profile-page", { getUserDetails: host.getUserDetails, name: host.userMetaData.userName, profilePhotoUrl: host.userMetaData.userProfileImageUrl, closeDrawer: () => (host.activeTab = 'Chat'), toggleTheme: host.toggleTheme, defaultTheme: host.defaultTheme })));
@@ -2873,7 +2950,7 @@ function renderDefaultComposer(host) {
2873
2950
  return index.h("p", { class: "blockMessageContainer" }, content.WEB_CONTENT.BLOCK_CHAT_MESSAGE);
2874
2951
  }
2875
2952
  const el = host.el;
2876
- return (index.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 },
2953
+ return (index.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 },
2877
2954
  index$1.hasNamedSlot(el, 'reply-preview') ? index.h("slot", { name: "reply-preview", slot: "reply-preview" }) : null,
2878
2955
  index$1.hasNamedSlot(el, 'attachment-preview') ? index.h("slot", { name: "attachment-preview", slot: "attachment-preview" }) : null,
2879
2956
  index$1.hasNamedSlot(el, 'composer-input') ? index.h("slot", { name: "composer-input", slot: "composer-input" }) : null));
@@ -2961,6 +3038,7 @@ const WebChat = class {
2961
3038
  this.messageReadStatusUpdated = index.createEvent(this, "messageReadStatusUpdated", 7);
2962
3039
  this.chatBodyRef = null;
2963
3040
  this.conversationDetailsInterval = null;
3041
+ this.groupcastCreateInFlight = null;
2964
3042
  this.mqttSession = new MqttSession();
2965
3043
  this.boundCheckMobileView = () => this.checkMobileView();
2966
3044
  this.mqttRefetchInterval = null;
@@ -2986,6 +3064,8 @@ const WebChat = class {
2986
3064
  };
2987
3065
  this.userTokenFromCookie = this.getCookie('userToken');
2988
3066
  this.isometrikUserIdFromCookie = this.getCookie('isometrikUserId');
3067
+ // ─── Open chat / URL (navigation.ts) ───
3068
+ this.ensureGroupcastReady = () => hostEnsureGroupcastCreated(this);
2989
3069
  /// for get user details start
2990
3070
  // ─── Data fetch (thin wrappers → data-fetch.ts → lib/chat) ───
2991
3071
  this.getUserDetails = async () => hostGetUserDetails(this);
@@ -3182,6 +3262,7 @@ const WebChat = class {
3182
3262
  this.isLoadingMoreGroupcast = false;
3183
3263
  this.hasMoreGroupcast = true;
3184
3264
  this.groupcastMembers = [];
3265
+ this.draftGroupcast = null;
3185
3266
  }
3186
3267
  emitConversationsChange() {
3187
3268
  this.conversationsChange.emit({ conversations: this.allConversationList });
@@ -3331,7 +3412,16 @@ const WebChat = class {
3331
3412
  const groupcastId = urlParams.get('groupcast');
3332
3413
  this.initialConversationIdFromURL = (_a = (isGroupcast ? groupcastId : conversationId)) !== null && _a !== void 0 ? _a : '';
3333
3414
  this.isMobileView = window.innerWidth <= 768;
3334
- this.selectedConversationId = isGroupcast ? groupcastId : conversationId;
3415
+ if (isGroupcast && groupcast.isGroupcastDraftId(groupcastId)) {
3416
+ this.selectedConversationId = null;
3417
+ this.initialConversationIdFromURL = '';
3418
+ const url = new URL(window.location.href);
3419
+ url.searchParams.delete('groupcast');
3420
+ window.history.replaceState({}, '', url.pathname + url.search);
3421
+ }
3422
+ else {
3423
+ this.selectedConversationId = isGroupcast ? groupcastId : conversationId;
3424
+ }
3335
3425
  if (this.isMobileView && (conversationId || groupcastId)) {
3336
3426
  this.showSidebar = false;
3337
3427
  }
@@ -3376,7 +3466,25 @@ const WebChat = class {
3376
3466
  async setupMqttClient() {
3377
3467
  return hostSetupMqttClient(this);
3378
3468
  }
3379
- // ─── Open chat / URL (navigation.ts) ───
3469
+ openDraftGroupcast(members) {
3470
+ hostOpenDraftGroupcast(this, members);
3471
+ }
3472
+ handleGroupcastDraftReady(event) {
3473
+ var _a;
3474
+ const members = (_a = event.detail) === null || _a === void 0 ? void 0 : _a.members;
3475
+ if (members === null || members === void 0 ? void 0 : members.length)
3476
+ this.openDraftGroupcast(members);
3477
+ }
3478
+ handleGroupcastMembersChanged(event) {
3479
+ var _a;
3480
+ const { groupcastId, membersDetail } = event.detail || {};
3481
+ if (!groupcastId || groupcastId !== this.selectedConversationId)
3482
+ return;
3483
+ if (membersDetail) {
3484
+ 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 });
3485
+ }
3486
+ void this.getGroupcastMembers(groupcastId);
3487
+ }
3380
3488
  handleChatSelect(param) {
3381
3489
  const conversationId = typeof param === 'string' ? param : param.groupcastId;
3382
3490
  this.selectedConversationId = conversationId;