isometrik-plugin-chat-sdk 2.0.14 → 2.0.16

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 (31) hide show
  1. package/dist/cjs/attachment-preview_22.cjs.entry.js +2 -2
  2. package/dist/cjs/attachment-preview_22.cjs.entry.js.map +1 -1
  3. package/dist/cjs/login-page_3.cjs.entry.js +47 -13
  4. package/dist/cjs/login-page_3.cjs.entry.js.map +1 -1
  5. package/dist/collection/components/ChatUIComponent/ChatSidebar/ChatSidebar.js +2 -2
  6. package/dist/collection/components/ChatUIComponent/ChatSidebar/ChatSidebar.js.map +1 -1
  7. package/dist/collection/components/my-component/web-chat/event-handlers.js +30 -3
  8. package/dist/collection/components/my-component/web-chat/event-handlers.js.map +1 -1
  9. package/dist/collection/components/my-component/web-chat/shell-render.js +1 -7
  10. package/dist/collection/components/my-component/web-chat/shell-render.js.map +1 -1
  11. package/dist/collection/components/my-component/web-chat/web-chat.css +35 -0
  12. package/dist/collection/lib/mqtt/dispatch.js +13 -2
  13. package/dist/collection/lib/mqtt/dispatch.js.map +1 -1
  14. package/dist/components/ChatSidebar.js +2 -2
  15. package/dist/components/ChatSidebar.js.map +1 -1
  16. package/dist/components/WebChat.js +47 -13
  17. package/dist/components/WebChat.js.map +1 -1
  18. package/dist/esm/attachment-preview_22.entry.js +2 -2
  19. package/dist/esm/attachment-preview_22.entry.js.map +1 -1
  20. package/dist/esm/login-page_3.entry.js +47 -13
  21. package/dist/esm/login-page_3.entry.js.map +1 -1
  22. package/dist/isometrik-webchat/isometrik-webchat.esm.js +1 -1
  23. package/dist/isometrik-webchat/p-39b6adef.entry.js +2 -0
  24. package/dist/isometrik-webchat/p-39b6adef.entry.js.map +1 -0
  25. package/dist/isometrik-webchat/p-57d958b8.entry.js +2 -0
  26. package/dist/isometrik-webchat/p-57d958b8.entry.js.map +1 -0
  27. package/package.json +1 -1
  28. package/dist/isometrik-webchat/p-2c87c3fd.entry.js +0 -2
  29. package/dist/isometrik-webchat/p-2c87c3fd.entry.js.map +0 -1
  30. package/dist/isometrik-webchat/p-5672fae7.entry.js +0 -2
  31. package/dist/isometrik-webchat/p-5672fae7.entry.js.map +0 -1
@@ -704,6 +704,7 @@ async function dispatchMqttMessage(parsedMessage, ctx) {
704
704
  if ((parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.action) === MQTT_ACTIONS.memberLeave || (parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.action) === 'memberLeave') {
705
705
  const leaveId = String(mqttActorId(parsedMessage) || '');
706
706
  const leaveName = (parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.userName) || (parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.memberName) || 'Someone';
707
+ const leaveAt = (parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.sentAt) || Date.now();
707
708
  const conversationExists = ctx.allConversationList.some(conversation => conversation.conversationId === (parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.conversationId));
708
709
  if (parsedMessage.conversationId === ctx.selectedConversationId && leaveId) {
709
710
  ctx.conversationMetaData = Object.assign(Object.assign({}, ctx.conversationMetaData), { members: (_p = (_o = ctx.conversationMetaData) === null || _o === void 0 ? void 0 : _o.members) === null || _p === void 0 ? void 0 : _p.filter((user) => String((user === null || user === void 0 ? void 0 : user.userId) || (user === null || user === void 0 ? void 0 : user.memberId) || '') !== leaveId) });
@@ -715,9 +716,15 @@ async function dispatchMqttMessage(parsedMessage, ctx) {
715
716
  const nextMembers = leaveId
716
717
  ? (conversation.members || []).filter((m) => String((m === null || m === void 0 ? void 0 : m.userId) || (m === null || m === void 0 ? void 0 : m.memberId) || '') !== leaveId)
717
718
  : conversation.members;
718
- return Object.assign(Object.assign({}, conversation), { lastMessageDetails: Object.assign(Object.assign({}, conversation.lastMessageDetails), { body: `${leaveName} left the conversation`, sentAt: (parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.sentAt) || Date.now(), action: 'memberLeave', userId: leaveId || (parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.userId), userName: leaveName, userProfileImageUrl: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.userProfileImageUrl }), members: nextMembers });
719
+ return Object.assign(Object.assign({}, conversation), { lastMessageDetails: Object.assign(Object.assign({}, conversation.lastMessageDetails), { body: `${leaveName} left the conversation`, sentAt: leaveAt, action: 'memberLeave', userId: leaveId || (parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.userId), userName: leaveName, userProfileImageUrl: parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.userProfileImageUrl }), members: nextMembers });
719
720
  }));
720
721
  }
722
+ // Self-leave is skipped by the generic append guard (actor === self) — inject here
723
+ // so the open thread shows the same "X left" pill the sidebar preview shows.
724
+ if (parsedMessage.conversationId === ctx.selectedConversationId) {
725
+ ctx.appendInboundMessage(Object.assign(Object.assign({}, parsedMessage), { action: 'memberLeave', userId: leaveId || (parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.userId), userName: leaveName, sentAt: leaveAt, messageId: parsedMessage.messageId ||
726
+ `memberLeave-${leaveId || 'unknown'}-${leaveAt}` }));
727
+ }
721
728
  }
722
729
  if ((parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.action) === 'addAdmin') {
723
730
  const conversationExists = ctx.allConversationList.some(conversation => conversation.conversationId === parsedMessage.conversationId);
@@ -853,8 +860,12 @@ async function dispatchMqttMessage(parsedMessage, ctx) {
853
860
  }
854
861
  }
855
862
  // Append inbound pills/bubbles. Use mqttActorId — leave events often set userId, not senderId.
863
+ // memberLeave is appended in its dedicated block (incl. self-leave) — skip here to avoid dupes.
856
864
  const actorId = mqttActorId(parsedMessage);
857
- if (actorId != ((_5 = ctx.userMetaData) === null || _5 === void 0 ? void 0 : _5.userId) && !isStatusOnlyAction(parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.action)) {
865
+ if (actorId != ((_5 = ctx.userMetaData) === null || _5 === void 0 ? void 0 : _5.userId) &&
866
+ !isStatusOnlyAction(parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.action) &&
867
+ (parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.action) !== MQTT_ACTIONS.memberLeave &&
868
+ (parsedMessage === null || parsedMessage === void 0 ? void 0 : parsedMessage.action) !== 'memberLeave') {
858
869
  if (parsedMessage.conversationId === ctx.selectedConversationId) {
859
870
  ctx.appendInboundMessage(parsedMessage);
860
871
  }
@@ -2395,11 +2406,38 @@ async function hostDeleteGroupcast(host, e) {
2395
2406
  }
2396
2407
  }
2397
2408
  function hostGroupExited(host, event) {
2398
- var _a;
2409
+ var _a, _b, _c;
2399
2410
  const conversationId = (_a = event.detail) === null || _a === void 0 ? void 0 : _a.conversationId;
2400
- if (conversationId) {
2401
- host.exitedGroupIds.add(conversationId);
2411
+ if (!conversationId)
2412
+ return;
2413
+ // New Set so Stencil @State re-renders the exited composer banner.
2414
+ const nextExited = new Set(host.exitedGroupIds || []);
2415
+ nextExited.add(conversationId);
2416
+ host.exitedGroupIds = nextExited;
2417
+ const selfId = String(((_b = host.userMetaData) === null || _b === void 0 ? void 0 : _b.userId) || '');
2418
+ const selfName = String(((_c = host.userMetaData) === null || _c === void 0 ? void 0 : _c.userName) || 'You');
2419
+ const sentAt = Date.now();
2420
+ const leaveMsg = {
2421
+ action: 'memberLeave',
2422
+ userId: selfId,
2423
+ userName: selfName,
2424
+ conversationId,
2425
+ sentAt,
2426
+ messageId: `local-leave-${conversationId}-${sentAt}`,
2427
+ };
2428
+ // API leave can finish before MQTT — keep body in sync with sidebar "You left".
2429
+ if (host.selectedConversationId === conversationId) {
2430
+ const list = Array.isArray(host.allMessages) ? host.allMessages : [];
2431
+ const already = list.some((m) => (m === null || m === void 0 ? void 0 : m.action) === 'memberLeave' &&
2432
+ String((m === null || m === void 0 ? void 0 : m.userId) || '') === selfId &&
2433
+ Math.abs(Number((m === null || m === void 0 ? void 0 : m.sentAt) || 0) - sentAt) < 60000);
2434
+ if (!already) {
2435
+ host.allMessages = [...list, leaveMsg];
2436
+ host.isScrollToBottom = true;
2437
+ }
2402
2438
  }
2439
+ host.allConversationList = (host.allConversationList || []).map((c) => (c === null || c === void 0 ? void 0 : c.conversationId) === conversationId
2440
+ ? Object.assign(Object.assign({}, c), { lastMessageDetails: Object.assign(Object.assign({}, c.lastMessageDetails), { action: 'memberLeave', body: 'You left the conversation', userId: selfId, userName: selfName, sentAt }) }) : c);
2403
2441
  }
2404
2442
  function hostTagUserClick(host, event) {
2405
2443
  const { userId, userName } = event.detail || {};
@@ -2630,13 +2668,9 @@ function renderLeftRail(host) {
2630
2668
  function renderDefaultComposer(host) {
2631
2669
  var _a;
2632
2670
  if (host.exitedGroupIds.has(host.selectedConversationId)) {
2633
- return (index.h("div", { style: {
2634
- padding: '1rem',
2635
- textAlign: 'center',
2636
- backgroundColor: 'var(--bg-secondary)',
2637
- color: 'var(--text-primary)',
2638
- borderTop: '1px solid var(--bg-secondary)',
2639
- } }, "You are no longer a member of this group"));
2671
+ return (index.h("div", { class: "exited-group-banner", role: "status", "aria-live": "polite" },
2672
+ index.h("div", { class: "exited-group-banner-pill" }, "You are no longer a member of this group"),
2673
+ index.h("p", { class: "exited-group-banner-hint" }, "You can still read past messages, but you can\u2019t send new ones.")));
2640
2674
  }
2641
2675
  if (host.isBlocked === 'loading') {
2642
2676
  return index.h("p", { class: "blockMessageContainer" }, content.WEB_CONTENT.PLEASE_WAIT);
@@ -2715,7 +2749,7 @@ function renderRightRail(host) {
2715
2749
  return (index.h("div", { class: "chat-sidebar-right" }, renderRegion(host, 'right-panel', true, () => renderDefaultRightPanel(host))));
2716
2750
  }
2717
2751
 
2718
- const webChatCss = ":host{display:flex;flex:1;width:var(--w-full);min-height:0;height:100%}web-chat{display:flex;flex:1;width:var(--w-full);min-height:0;height:100%}.boot-loader-shell{display:flex;flex:1;width:var(--w-full);min-height:0;height:100%;align-items:stretch;justify-content:stretch}.boot-loader-shell>chat-loading-placeholder,.boot-loader-shell>slot[name='boot-loader']{display:flex;flex:1;width:var(--w-full);min-height:0;height:100%}.isometrik-quickchat{box-shadow:none;display:flex;flex:1 1 auto;height:100%;min-height:0;width:var(--w-full);max-height:100%;overflow:hidden}.chat-sidebar-container{width:30%;min-width:var(--sidebar-width);transition:all 0.3s ease;border-right:1px solid var(--border);display:flex;flex-direction:row;background-color:var(--bg-primary);overflow:hidden;min-height:0}profile-sidebar,profile-sidebar-ui{display:flex;height:var(--h-full);flex-shrink:0}.chat-sidebar-right{width:30%;min-width:var(--sidebar-width);transition:all 0.3s ease;border-left:1px solid var(--border);background-color:var(--bg-primary)}.loaderoverlay{width:var(--w-full);position:absolute;margin:auto;background:var(--overlay);z-index:1400}.sidebar-tab{flex:1;min-width:0;height:var(--h-full);min-height:0;background-color:var(--bg-primary);display:flex;flex-direction:column;overflow:hidden}.sidebar-tab>*{flex:1;min-height:0;min-width:0;width:var(--w-full);max-width:var(--w-full)}.chat-body-container{flex:1;display:flex;flex-direction:column;transition:all 0.3s ease;background-color:var(--bg-secondary);position:relative;min-height:0;min-width:0}.chat-pane-row{flex:1;min-height:0;min-width:0;display:flex;flex-direction:row;align-items:stretch;overflow:hidden}.chat-main-stack{flex:1;min-width:0;min-height:0;display:flex;flex-direction:column;overflow:hidden}.message-info-dock{flex:0 0 clamp(280px, 36%, 380px);height:var(--h-full);min-height:0;display:flex;flex-direction:column;background:var(--bg-primary);border-left:1px solid var(--border);overflow:hidden}.message-info-dock message-info{flex:1;min-height:0;height:var(--h-full);display:block}.message-info-loading{flex:1;display:flex;align-items:center;justify-content:center}.chat-sidebar-container>slot[name='sidebar'],.chat-sidebar-container slot[name='profile-rail'],.sidebar-tab>slot[name='conversation-list'],.sidebar-tab>slot[name='profile-page'],.sidebar-tab>slot[name='group-cast'],.chat-body-container>slot[name='empty'],.chat-main-stack>slot[name='header'],.chat-main-stack>slot[name='messages'],.chat-main-stack>slot[name='composer'],.chat-sidebar-right>slot[name='right-panel']{display:contents}::slotted([slot='sidebar']),::slotted([slot='profile-rail']),::slotted([slot='conversation-list']),::slotted([slot='profile-page']),::slotted([slot='group-cast']),::slotted([slot='empty']),::slotted([slot='messages']),::slotted([slot='right-panel']),::slotted([slot='contact-info']),::slotted([slot='profile-info']),::slotted([slot='message-search']),::slotted([slot='boot-loader']){display:flex;flex-direction:column;flex:1;min-height:0;width:var(--w-full);height:var(--h-full)}::slotted([slot='header']),::slotted([slot='composer']),::slotted([slot='composer-input']),::slotted([slot='reply-preview']),::slotted([slot='attachment-preview']){display:block;width:var(--w-full);flex-shrink:0}.noChatSelectedPlaceholder{height:var(--h-full);width:var(--w-full);display:flex;align-items:center;justify-content:center;font-size:var(--text-20);flex-direction:column;gap:var(--gap-4);color:var(--text-primary)}.noChatSelectedPlaceholder span:nth-child(2){font-size:var(--text-24);font-weight:var(--fw-700);margin-top:var(--space-16)}.noChatSelectedPlaceholder span:nth-child(3){font-size:var(--text-18);text-align:center;color:var(--text-secondary)}.loadingPlaceholder{height:var(--h-full);width:var(--w-full);z-index:12839283}.back-button{display:none;padding:0;background:none;border:none;cursor:pointer;align-items:center;gap:var(--gap-4)}spinner-loader{display:flex;height:100%}.blockMessageContainer{text-align:center;padding:var(--space-16) 0;margin:0;background-color:var(--bg-secondary);color:var(--text-secondary)}@media (max-width: 768px){.isometrik-quickchat{position:relative;overflow:hidden}.chat-sidebar-right{width:var(--w-full);height:var(--h-full);min-width:100% !important;position:absolute;left:0;top:0;z-index:20;display:flex;flex-direction:column;background-color:var(--bg-primary);transition:all 0.3s ease;border:none}.chat-sidebar-right>*{flex:1;min-height:0;width:var(--w-full);height:var(--h-full)}.chat-sidebar-container{width:var(--w-full);height:var(--h-full);position:absolute;left:0;top:0;transform:translateX(0);transition:transform 0.3s ease;z-index:2;min-width:100% !important}.chat-sidebar-container.hidden{transform:translateX(-100%)}.chat-body-container{width:var(--w-full);height:var(--h-full);position:absolute;left:0;top:0;transform:translateX(100%);transition:transform 0.3s ease;z-index:1}.chat-body-container.hidden{transform:translateX(0)}.chat-body-container.show{transform:translateX(0);z-index:3}.back-button{display:flex;align-items:center;justify-content:center;position:absolute;right:var(--rail-width);z-index:10;top:var(--space-16)}}";
2752
+ const webChatCss = ":host{display:flex;flex:1;width:var(--w-full);min-height:0;height:100%}web-chat{display:flex;flex:1;width:var(--w-full);min-height:0;height:100%}.boot-loader-shell{display:flex;flex:1;width:var(--w-full);min-height:0;height:100%;align-items:stretch;justify-content:stretch}.boot-loader-shell>chat-loading-placeholder,.boot-loader-shell>slot[name='boot-loader']{display:flex;flex:1;width:var(--w-full);min-height:0;height:100%}.isometrik-quickchat{box-shadow:none;display:flex;flex:1 1 auto;height:100%;min-height:0;width:var(--w-full);max-height:100%;overflow:hidden}.chat-sidebar-container{width:30%;min-width:var(--sidebar-width);transition:all 0.3s ease;border-right:1px solid var(--border);display:flex;flex-direction:row;background-color:var(--bg-primary);overflow:hidden;min-height:0}profile-sidebar,profile-sidebar-ui{display:flex;height:var(--h-full);flex-shrink:0}.chat-sidebar-right{width:30%;min-width:var(--sidebar-width);transition:all 0.3s ease;border-left:1px solid var(--border);background-color:var(--bg-primary)}.loaderoverlay{width:var(--w-full);position:absolute;margin:auto;background:var(--overlay);z-index:1400}.sidebar-tab{flex:1;min-width:0;height:var(--h-full);min-height:0;background-color:var(--bg-primary);display:flex;flex-direction:column;overflow:hidden}.sidebar-tab>*{flex:1;min-height:0;min-width:0;width:var(--w-full);max-width:var(--w-full)}.chat-body-container{flex:1;display:flex;flex-direction:column;transition:all 0.3s ease;background-color:var(--bg-secondary);position:relative;min-height:0;min-width:0}.chat-pane-row{flex:1;min-height:0;min-width:0;display:flex;flex-direction:row;align-items:stretch;overflow:hidden}.chat-main-stack{flex:1;min-width:0;min-height:0;display:flex;flex-direction:column;overflow:hidden}.message-info-dock{flex:0 0 clamp(280px, 36%, 380px);height:var(--h-full);min-height:0;display:flex;flex-direction:column;background:var(--bg-primary);border-left:1px solid var(--border);overflow:hidden}.message-info-dock message-info{flex:1;min-height:0;height:var(--h-full);display:block}.message-info-loading{flex:1;display:flex;align-items:center;justify-content:center}.chat-sidebar-container>slot[name='sidebar'],.chat-sidebar-container slot[name='profile-rail'],.sidebar-tab>slot[name='conversation-list'],.sidebar-tab>slot[name='profile-page'],.sidebar-tab>slot[name='group-cast'],.chat-body-container>slot[name='empty'],.chat-main-stack>slot[name='header'],.chat-main-stack>slot[name='messages'],.chat-main-stack>slot[name='composer'],.chat-sidebar-right>slot[name='right-panel']{display:contents}::slotted([slot='sidebar']),::slotted([slot='profile-rail']),::slotted([slot='conversation-list']),::slotted([slot='profile-page']),::slotted([slot='group-cast']),::slotted([slot='empty']),::slotted([slot='messages']),::slotted([slot='right-panel']),::slotted([slot='contact-info']),::slotted([slot='profile-info']),::slotted([slot='message-search']),::slotted([slot='boot-loader']){display:flex;flex-direction:column;flex:1;min-height:0;width:var(--w-full);height:var(--h-full)}::slotted([slot='header']),::slotted([slot='composer']),::slotted([slot='composer-input']),::slotted([slot='reply-preview']),::slotted([slot='attachment-preview']){display:block;width:var(--w-full);flex-shrink:0}.noChatSelectedPlaceholder{height:var(--h-full);width:var(--w-full);display:flex;align-items:center;justify-content:center;font-size:var(--text-20);flex-direction:column;gap:var(--gap-4);color:var(--text-primary)}.noChatSelectedPlaceholder span:nth-child(2){font-size:var(--text-24);font-weight:var(--fw-700);margin-top:var(--space-16)}.noChatSelectedPlaceholder span:nth-child(3){font-size:var(--text-18);text-align:center;color:var(--text-secondary)}.loadingPlaceholder{height:var(--h-full);width:var(--w-full);z-index:12839283}.back-button{display:none;padding:0;background:none;border:none;cursor:pointer;align-items:center;gap:var(--gap-4)}spinner-loader{display:flex;height:100%}.blockMessageContainer{text-align:center;padding:var(--space-16) 0;margin:0;background-color:var(--bg-secondary);color:var(--text-secondary)}.exited-group-banner{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:0.4rem;padding:0.875rem 1rem 1rem;border-top:1px solid var(--border-subtle, var(--bg-secondary));background:var(--bg-surface, var(--bg-primary));text-align:center}.exited-group-banner-pill{display:inline-flex;align-items:center;justify-content:center;max-width:100%;padding:0.4rem 0.85rem;border-radius:999px;background:var(--bg-secondary, #f4f4f5);color:var(--text-secondary, #52525b);font-size:0.8125rem;font-weight:500;letter-spacing:-0.01em;line-height:1.3}.exited-group-banner-hint{margin:0;max-width:18rem;font-size:0.75rem;line-height:1.35;color:var(--text-tertiary, #71717a)}@media (max-width: 768px){.isometrik-quickchat{position:relative;overflow:hidden}.chat-sidebar-right{width:var(--w-full);height:var(--h-full);min-width:100% !important;position:absolute;left:0;top:0;z-index:20;display:flex;flex-direction:column;background-color:var(--bg-primary);transition:all 0.3s ease;border:none}.chat-sidebar-right>*{flex:1;min-height:0;width:var(--w-full);height:var(--h-full)}.chat-sidebar-container{width:var(--w-full);height:var(--h-full);position:absolute;left:0;top:0;transform:translateX(0);transition:transform 0.3s ease;z-index:2;min-width:100% !important}.chat-sidebar-container.hidden{transform:translateX(-100%)}.chat-body-container{width:var(--w-full);height:var(--h-full);position:absolute;left:0;top:0;transform:translateX(100%);transition:transform 0.3s ease;z-index:1}.chat-body-container.hidden{transform:translateX(0)}.chat-body-container.show{transform:translateX(0);z-index:3}.back-button{display:flex;align-items:center;justify-content:center;position:absolute;right:var(--rail-width);z-index:10;top:var(--space-16)}}";
2719
2753
  const WebChatStyle0 = webChatCss;
2720
2754
 
2721
2755
  const WebChat = class {