isometrik-plugin-chat-sdk 1.3.14 → 1.3.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 (62) hide show
  1. package/dist/cjs/attachment-preview_22.cjs.entry.js +20 -2
  2. package/dist/cjs/attachment-preview_22.cjs.entry.js.map +1 -1
  3. package/dist/cjs/contracts-31632812.js.map +1 -1
  4. package/dist/cjs/index-1a26d11d.js.map +1 -1
  5. package/dist/cjs/index.cjs.js +6 -0
  6. package/dist/cjs/index.cjs.js.map +1 -1
  7. package/dist/cjs/isometrik-webchat.cjs.js +1 -1
  8. package/dist/cjs/loader.cjs.js +1 -1
  9. package/dist/cjs/login-page_3.cjs.entry.js +11 -4
  10. package/dist/cjs/login-page_3.cjs.entry.js.map +1 -1
  11. package/dist/collection/components/ChatUIComponent/ChatSidebar/ChatSidebar.js +3 -3
  12. package/dist/collection/components/ChatUIComponent/ChatSidebar/ChatSidebar.js.map +1 -1
  13. package/dist/collection/components/ChatUIComponent/shared/new chat/new-chat.js +40 -1
  14. package/dist/collection/components/ChatUIComponent/shared/new chat/new-chat.js.map +1 -1
  15. package/dist/collection/components/my-component/web-chat/WebChat.js +40 -2
  16. package/dist/collection/components/my-component/web-chat/WebChat.js.map +1 -1
  17. package/dist/collection/components/my-component/web-chat/shell-render.js +8 -3
  18. package/dist/collection/components/my-component/web-chat/shell-render.js.map +1 -1
  19. package/dist/collection/index.js +6 -0
  20. package/dist/collection/index.js.map +1 -1
  21. package/dist/collection/lib/custom-ui/contracts.js.map +1 -1
  22. package/dist/collection/lib/custom-ui/index.js.map +1 -1
  23. package/dist/components/ChatSidebar.js +1 -1
  24. package/dist/components/ChatSidebar.js.map +1 -1
  25. package/dist/components/WebChat.js +13 -4
  26. package/dist/components/WebChat.js.map +1 -1
  27. package/dist/components/contracts.js.map +1 -1
  28. package/dist/components/index.js +6 -0
  29. package/dist/components/index.js.map +1 -1
  30. package/dist/components/index2.js.map +1 -1
  31. package/dist/components/new-chat2.js +20 -1
  32. package/dist/components/new-chat2.js.map +1 -1
  33. package/dist/esm/attachment-preview_22.entry.js +20 -2
  34. package/dist/esm/attachment-preview_22.entry.js.map +1 -1
  35. package/dist/esm/contracts-614be4db.js.map +1 -1
  36. package/dist/esm/index-beb184c6.js.map +1 -1
  37. package/dist/esm/index.js +6 -0
  38. package/dist/esm/index.js.map +1 -1
  39. package/dist/esm/isometrik-webchat.js +1 -1
  40. package/dist/esm/loader.js +1 -1
  41. package/dist/esm/login-page_3.entry.js +11 -4
  42. package/dist/esm/login-page_3.entry.js.map +1 -1
  43. package/dist/isometrik-webchat/index.esm.js +1 -1
  44. package/dist/isometrik-webchat/index.esm.js.map +1 -1
  45. package/dist/isometrik-webchat/isometrik-webchat.esm.js +1 -1
  46. package/dist/isometrik-webchat/isometrik-webchat.esm.js.map +1 -1
  47. package/dist/isometrik-webchat/p-37e3ab26.entry.js +2 -0
  48. package/dist/isometrik-webchat/p-37e3ab26.entry.js.map +1 -0
  49. package/dist/isometrik-webchat/{p-6ffeb379.entry.js → p-4fd74f21.entry.js} +2 -2
  50. package/dist/isometrik-webchat/p-4fd74f21.entry.js.map +1 -0
  51. package/dist/isometrik-webchat/p-7b80b0b2.js.map +1 -1
  52. package/dist/isometrik-webchat/p-a6897edc.js.map +1 -1
  53. package/dist/types/components/ChatUIComponent/ChatSidebar/ChatSidebar.d.ts +2 -0
  54. package/dist/types/components/ChatUIComponent/shared/new chat/new-chat.d.ts +3 -0
  55. package/dist/types/components.d.ts +28 -0
  56. package/dist/types/index.d.ts +4 -0
  57. package/dist/types/lib/custom-ui/contracts.d.ts +8 -0
  58. package/dist/types/lib/custom-ui/index.d.ts +3 -1
  59. package/package.json +5 -2
  60. package/dist/isometrik-webchat/p-6ffeb379.entry.js.map +0 -1
  61. package/dist/isometrik-webchat/p-c544329c.entry.js +0 -2
  62. package/dist/isometrik-webchat/p-c544329c.entry.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"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AAG,QAAQ,CAAC,aAAa,CAAC,gBAAgB,CAAQ,CAAC;IACtE,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,OAAO,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACnD,OAAO;IACT,CAAC;IAED,IAAI,WAAW,CAAC,SAAS,EAAE,CAAC;QAC1B,aAAa,CAAC,YAAY,CAAC,YAAY,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;IAClE,CAAC;IAED,IAAI,WAAW,CAAC,WAAW,EAAE,CAAC;QAC5B,aAAa,CAAC,WAAW,GAAG,WAAW,CAAC,WAAW,CAAC;IACtD,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,MAAM,aAAa,GAAG,QAAQ,CAAC,aAAa,CAAC,gBAAgB,CAAQ,CAAC;IACtE,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,OAAO,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACnD,OAAO;IACT,CAAC;IAED,aAAa,CAAC,WAAW,EAAE,CAAC;AAC9B,CAAC,CAAC;AAEF,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;IACjC,MAAc,CAAC,cAAc,GAAG,cAAc,CAAC;IAC/C,MAAc,CAAC,WAAW,GAAG,WAAW,CAAC;IACzC,MAAc,CAAC,gBAAgB,GAAG,iBAAiB,CAAC;IACpD,MAAc,CAAC,eAAe,GAAG,eAAe,CAAC;IACjD,MAAc,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;IACnD,MAAc,CAAC,WAAW,GAAG,WAAW,CAAC;AAC5C,CAAC","sourcesContent":["import { destroyChatDom } from './lib/destroy-chat';\nimport type { WebChatSlotName, WebChatCustomParts } from './lib/custom-ui';\nexport type { WebChatSlotName, WebChatCustomParts } from './lib/custom-ui';\nexport type {\n ChatReadyDetail,\n ConversationsChangeDetail,\n MessagesChangeDetail,\n SelectionChangeDetail,\n ReplyChangeDetail,\n ChatErrorDetail,\n WebChatPublicEvent,\n WebChatPublicMethod,\n MessageDeliveryStatus,\n MessageBubbleProps,\n ChatTileProps,\n GroupcastTileProps,\n MessageDatePillProps,\n SearchResultProps,\n MemberRowProps,\n OverlayDialogProps,\n MediaGalleryProps,\n ContextMenuProps,\n BlockListProps,\n ToastPartProps,\n} from './lib/custom-ui';\nexport {\n WEB_CHAT_SLOTS,\n WEB_CHAT_PUBLIC_EVENTS,\n WEB_CHAT_PUBLIC_METHODS,\n deriveMessageStatus,\n findWebChatHost,\n applyCustomPartProps,\n defineReactiveCustomPart,\n} from './lib/custom-ui';\nexport { format } from './utils/utils';\n/**\n * Stencil-generated component types (full catalog).\n * Prefer the explicit custom-ui / InitializeChatProps exports above for host apps.\n * Lazy loader: `isometrik-webchat/loader`\n * Custom elements: `dist/components/` (dist-custom-elements output)\n */\nexport type * from './components.d.ts';\n\nexport type InitializeChatProps = {\n baseUrl?: string;\n hostUrl?: string;\n licenseKey: string;\n appSecret: string;\n userSecret: string;\n userToken: string;\n isometrikUserId: string;\n projectId: string;\n keysetId: string;\n accountId: string;\n defaultTheme?: 'dark' | 'light';\n themeUrl?: string;\n containerId?: string;\n /** Optional custom UI nodes — each gets `slot=\"<name>\"` and is appended to <web-chat>. */\n slots?: Partial<Record<WebChatSlotName, HTMLElement>>;\n /** Custom element tags for list rows / dialogs. See WebChatCustomParts. */\n customParts?: WebChatCustomParts;\n};\n\nfunction attachWebChatSlots(\n chatComponent: HTMLElement,\n slots?: Partial<Record<WebChatSlotName, HTMLElement>>,\n) {\n if (!slots) return;\n (Object.entries(slots) as [WebChatSlotName, HTMLElement | undefined][]).forEach(([name, el]) => {\n if (!el) return;\n el.slot = name;\n chatComponent.appendChild(el);\n });\n}\n\nfunction getStoredComponents(): { themeProvider?: HTMLElement; chatComponent?: any } {\n if (typeof window === 'undefined') return {};\n (window as any).__isometrikChatComponents = (window as any).__isometrikChatComponents || {};\n return (window as any).__isometrikChatComponents;\n}\n\n/** Tear down existing chat instance (MQTT via disconnectedCallback, DOM). */\nexport const destroyChat = function () {\n destroyChatDom();\n document.querySelectorAll('theme-provider').forEach(el => {\n if (!el.querySelector('web-chat') && el.childNodes.length === 0) {\n el.remove();\n }\n });\n};\n\nexport const initializeChat = function (props: InitializeChatProps) {\n if (\n !props.licenseKey ||\n !props.appSecret ||\n !props.userSecret ||\n !props.userToken ||\n !props.isometrikUserId ||\n !props.projectId ||\n !props.keysetId ||\n !props.accountId\n ) {\n console.error('Missing required props to Initialize chat!');\n return null;\n }\n\n // Idempotent: destroy previous instance before creating a new one\n destroyChat();\n\n const themeProvider = document.createElement('theme-provider');\n\n if (props.defaultTheme) {\n themeProvider.setAttribute('mode', props.defaultTheme);\n }\n\n if (props.themeUrl) {\n themeProvider.setAttribute('theme-path', props.themeUrl);\n } else {\n themeProvider.setAttribute(\n 'theme-path',\n 'https://isometrik-website-bucket.s3.ap-south-1.amazonaws.com/styles/chat-combined-theme.css',\n );\n }\n\n const chatComponent = document.createElement('web-chat') as any;\n\n chatComponent.baseUrl = props?.baseUrl || 'https://apis.isometrik.io';\n chatComponent.hostUrl = props?.hostUrl || 'wss://connections.isometrik.io:2053/mqtt';\n chatComponent.licenseKey = props.licenseKey;\n chatComponent.appSecret = props.appSecret;\n chatComponent.userSecret = props.userSecret;\n chatComponent.userToken = props.userToken;\n chatComponent.isometrikUserId = props.isometrikUserId;\n chatComponent.projectId = props.projectId;\n chatComponent.keysetId = props.keysetId;\n chatComponent.accountId = props.accountId;\n chatComponent.defaultTheme = props.defaultTheme || 'light';\n chatComponent.themeUrl =\n props.themeUrl ||\n 'https://isometrik-website-bucket.s3.ap-south-1.amazonaws.com/styles/chat-combined-theme.css';\n\n chatComponent.style.width = '100%';\n chatComponent.style.height = '100%';\n\n if (props.customParts) {\n chatComponent.customParts = props.customParts;\n }\n\n attachWebChatSlots(chatComponent, props.slots);\n\n themeProvider.appendChild(chatComponent);\n themeProvider.style.width = '100%';\n themeProvider.style.height = '100%';\n themeProvider.style.display = 'block';\n\n const container = props.containerId ? document.getElementById(props.containerId) : document.body;\n if (container) {\n container.appendChild(themeProvider);\n } else {\n console.error('Container with the specified ID not found. Appending to body instead.');\n document.body.appendChild(themeProvider);\n }\n\n const stored = getStoredComponents();\n stored.themeProvider = themeProvider;\n stored.chatComponent = chatComponent;\n\n return { themeProvider, chatComponent, destroy: destroyChat };\n};\n\nexport const customChatSidebar = function (props: { isChatFilter?: boolean }) {\n const chatComponent = document.querySelector('web-chat') as any;\n if (!chatComponent) {\n console.error('Isometrik chat is not initialized');\n return;\n }\n\n if (props.isChatFilter !== undefined) {\n chatComponent.isChatFilter = props.isChatFilter;\n }\n};\n\nexport const switchChatTheme = function (theme: 'dark' | 'light') {\n const chatElements = document.getElementsByTagName('web-chat');\n\n for (let i = 0; i < chatElements.length; i++) {\n const chatWeb = chatElements[i] as any;\n chatWeb.defaultTheme = theme;\n\n const themeProvider = getStoredComponents().themeProvider;\n if (themeProvider) {\n themeProvider.setAttribute('mode', theme);\n }\n }\n};\n\nexport const applyCustomTheme = function (customTheme: {\n themePath?: string;\n themeObject?: { [key: string]: string };\n}) {\n const themeProvider = document.querySelector('theme-provider') as any;\n if (!themeProvider) {\n console.error('Theme provider is not initialized');\n return;\n }\n\n if (customTheme.themePath) {\n themeProvider.setAttribute('theme-path', customTheme.themePath);\n }\n\n if (customTheme.themeObject) {\n themeProvider.themeObject = customTheme.themeObject;\n }\n};\n\nexport const toggleTheme = function () {\n const themeProvider = document.querySelector('theme-provider') as any;\n if (!themeProvider) {\n console.error('Theme provider is not initialized');\n return;\n }\n\n themeProvider.toggleTheme();\n};\n\nif (typeof window !== 'undefined') {\n (window as any).initializeChat = initializeChat;\n (window as any).destroyChat = destroyChat;\n (window as any).chatSidebarProps = customChatSidebar;\n (window as any).switchChatTheme = switchChatTheme;\n (window as any).applyCustomTheme = applyCustomTheme;\n (window as any).toggleTheme = toggleTheme;\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"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yChatDom } from './lib/destroy-chat';\nimport type { WebChatSlotName, WebChatCustomParts } from './lib/custom-ui';\nexport type { WebChatSlotName, WebChatCustomParts } from './lib/custom-ui';\nexport type {\n ChatReadyDetail,\n ConversationsChangeDetail,\n MessagesChangeDetail,\n SelectionChangeDetail,\n ReplyChangeDetail,\n ChatErrorDetail,\n WebChatPublicEvent,\n WebChatPublicMethod,\n MessageDeliveryStatus,\n MessageBubbleProps,\n ChatTileProps,\n GroupcastTileProps,\n MessageDatePillProps,\n SearchResultProps,\n MemberRowProps,\n OverlayDialogProps,\n MediaGalleryProps,\n ContextMenuProps,\n BlockListProps,\n ToastPartProps,\n} from './lib/custom-ui';\nexport {\n WEB_CHAT_SLOTS,\n WEB_CHAT_PUBLIC_EVENTS,\n WEB_CHAT_PUBLIC_METHODS,\n deriveMessageStatus,\n findWebChatHost,\n applyCustomPartProps,\n defineReactiveCustomPart,\n} from './lib/custom-ui';\nexport { format } from './utils/utils';\n/**\n * Stencil-generated component types (full catalog).\n * Prefer the explicit custom-ui / InitializeChatProps exports above for host apps.\n * Lazy loader: `isometrik-webchat/loader`\n * Custom elements: `dist/components/` (dist-custom-elements output)\n */\nexport type * from './components.d.ts';\n\nexport type InitializeChatProps = {\n baseUrl?: string;\n hostUrl?: string;\n licenseKey: string;\n appSecret: string;\n userSecret: string;\n userToken: string;\n isometrikUserId: string;\n projectId: string;\n keysetId: string;\n accountId: string;\n defaultTheme?: 'dark' | 'light';\n themeUrl?: string;\n containerId?: string;\n /** Optional custom UI nodes — each gets `slot=\"<name>\"` and is appended to <web-chat>. */\n slots?: Partial<Record<WebChatSlotName, HTMLElement>>;\n /** Custom element tags for list rows / dialogs. See WebChatCustomParts. */\n customParts?: WebChatCustomParts;\n /** When false, hide the left profile icon rail. Default true. */\n showProfileRail?: boolean;\n /** When false, no doodle wallpaper behind messages. Default true. */\n showChatWallpaper?: boolean;\n};\n\nfunction attachWebChatSlots(\n chatComponent: HTMLElement,\n slots?: Partial<Record<WebChatSlotName, HTMLElement>>,\n) {\n if (!slots) return;\n (Object.entries(slots) as [WebChatSlotName, HTMLElement | undefined][]).forEach(([name, el]) => {\n if (!el) return;\n el.slot = name;\n chatComponent.appendChild(el);\n });\n}\n\nfunction getStoredComponents(): { themeProvider?: HTMLElement; chatComponent?: any } {\n if (typeof window === 'undefined') return {};\n (window as any).__isometrikChatComponents = (window as any).__isometrikChatComponents || {};\n return (window as any).__isometrikChatComponents;\n}\n\n/** Tear down existing chat instance (MQTT via disconnectedCallback, DOM). */\nexport const destroyChat = function () {\n destroyChatDom();\n document.querySelectorAll('theme-provider').forEach(el => {\n if (!el.querySelector('web-chat') && el.childNodes.length === 0) {\n el.remove();\n }\n });\n};\n\nexport const initializeChat = function (props: InitializeChatProps) {\n if (\n !props.licenseKey ||\n !props.appSecret ||\n !props.userSecret ||\n !props.userToken ||\n !props.isometrikUserId ||\n !props.projectId ||\n !props.keysetId ||\n !props.accountId\n ) {\n console.error('Missing required props to Initialize chat!');\n return null;\n }\n\n // Idempotent: destroy previous instance before creating a new one\n destroyChat();\n\n const themeProvider = document.createElement('theme-provider');\n\n if (props.defaultTheme) {\n themeProvider.setAttribute('mode', props.defaultTheme);\n }\n\n if (props.themeUrl) {\n themeProvider.setAttribute('theme-path', props.themeUrl);\n } else {\n themeProvider.setAttribute(\n 'theme-path',\n 'https://isometrik-website-bucket.s3.ap-south-1.amazonaws.com/styles/chat-combined-theme.css',\n );\n }\n\n const chatComponent = document.createElement('web-chat') as any;\n\n chatComponent.baseUrl = props?.baseUrl || 'https://apis.isometrik.io';\n chatComponent.hostUrl = props?.hostUrl || 'wss://connections.isometrik.io:2053/mqtt';\n chatComponent.licenseKey = props.licenseKey;\n chatComponent.appSecret = props.appSecret;\n chatComponent.userSecret = props.userSecret;\n chatComponent.userToken = props.userToken;\n chatComponent.isometrikUserId = props.isometrikUserId;\n chatComponent.projectId = props.projectId;\n chatComponent.keysetId = props.keysetId;\n chatComponent.accountId = props.accountId;\n chatComponent.defaultTheme = props.defaultTheme || 'light';\n chatComponent.themeUrl =\n props.themeUrl ||\n 'https://isometrik-website-bucket.s3.ap-south-1.amazonaws.com/styles/chat-combined-theme.css';\n\n chatComponent.style.width = '100%';\n chatComponent.style.height = '100%';\n\n if (props.customParts) {\n chatComponent.customParts = props.customParts;\n }\n\n if (props.showProfileRail !== undefined) {\n chatComponent.showProfileRail = props.showProfileRail;\n }\n\n if (props.showChatWallpaper !== undefined) {\n chatComponent.showChatWallpaper = props.showChatWallpaper;\n }\n\n attachWebChatSlots(chatComponent, props.slots);\n\n themeProvider.appendChild(chatComponent);\n themeProvider.style.width = '100%';\n themeProvider.style.height = '100%';\n themeProvider.style.display = 'block';\n\n const container = props.containerId ? document.getElementById(props.containerId) : document.body;\n if (container) {\n container.appendChild(themeProvider);\n } else {\n console.error('Container with the specified ID not found. Appending to body instead.');\n document.body.appendChild(themeProvider);\n }\n\n const stored = getStoredComponents();\n stored.themeProvider = themeProvider;\n stored.chatComponent = chatComponent;\n\n return { themeProvider, chatComponent, destroy: destroyChat };\n};\n\nexport const customChatSidebar = function (props: { isChatFilter?: boolean }) {\n const chatComponent = document.querySelector('web-chat') as any;\n if (!chatComponent) {\n console.error('Isometrik chat is not initialized');\n return;\n }\n\n if (props.isChatFilter !== undefined) {\n chatComponent.isChatFilter = props.isChatFilter;\n }\n};\n\nexport const switchChatTheme = function (theme: 'dark' | 'light') {\n const chatElements = document.getElementsByTagName('web-chat');\n\n for (let i = 0; i < chatElements.length; i++) {\n const chatWeb = chatElements[i] as any;\n chatWeb.defaultTheme = theme;\n\n const themeProvider = getStoredComponents().themeProvider;\n if (themeProvider) {\n themeProvider.setAttribute('mode', theme);\n }\n }\n};\n\nexport const applyCustomTheme = function (customTheme: {\n themePath?: string;\n themeObject?: { [key: string]: string };\n}) {\n const themeProvider = document.querySelector('theme-provider') as any;\n if (!themeProvider) {\n console.error('Theme provider is not initialized');\n return;\n }\n\n if (customTheme.themePath) {\n themeProvider.setAttribute('theme-path', customTheme.themePath);\n }\n\n if (customTheme.themeObject) {\n themeProvider.themeObject = customTheme.themeObject;\n }\n};\n\nexport const toggleTheme = function () {\n const themeProvider = document.querySelector('theme-provider') as any;\n if (!themeProvider) {\n console.error('Theme provider is not initialized');\n return;\n }\n\n themeProvider.toggleTheme();\n};\n\nif (typeof window !== 'undefined') {\n (window as any).initializeChat = initializeChat;\n (window as any).destroyChat = destroyChat;\n (window as any).chatSidebarProps = customChatSidebar;\n (window as any).switchChatTheme = switchChatTheme;\n (window as any).applyCustomTheme = applyCustomTheme;\n (window as any).toggleTheme = toggleTheme;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"contracts.js","sourceRoot":"","sources":["../../../src/lib/custom-ui/contracts.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,MAAM,UAAU,mBAAmB,CAAC,OAAY;IAC9C,IAAI,CAAC,OAAO;QAAE,OAAO,MAAM,CAAC;IAC5B,IAAI,OAAO,CAAC,cAAc,KAAK,SAAS,IAAI,OAAO,CAAC,SAAS;QAAE,OAAO,SAAS,CAAC;IAChF,IAAI,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,kBAAkB;QAAE,OAAO,MAAM,CAAC;IACnE,IAAI,OAAO,CAAC,cAAc,KAAK,IAAI,IAAI,OAAO,CAAC,cAAc,KAAK,MAAM,IAAI,OAAO,CAAC,uBAAuB,EAAE,CAAC;QAC5G,OAAO,WAAW,CAAC;IACrB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["/**\n * Rounit-style prop contracts for customParts.\n *\n * Primary customization model:\n * customParts = host UI; SDK passes data + callbacks (functionality stays in SDK).\n * Slots remain secondary (layout panels only).\n */\n\n/** Delivery/read status derived from Isometrik message fields. */\nexport type MessageDeliveryStatus = 'pending' | 'sent' | 'delivered' | 'read';\n\nexport function deriveMessageStatus(message: any): MessageDeliveryStatus {\n if (!message) return 'sent';\n if (message.deliveredToAll === 'pending' || message.isPending) return 'pending';\n if (message.readByAll || message.isReadByAllMembers) return 'read';\n if (message.deliveredToAll === true || message.deliveredToAll === 'true' || message.isDeliveredToAllMembers) {\n return 'delivered';\n }\n return 'sent';\n}\n\n/**\n * Props SDK assigns on customParts.messageBubble custom elements.\n * Host CE should read these as properties (not only attributes).\n * Prefer property setters / `.render()` so Stencil prop updates re-paint.\n */\nexport type MessageBubbleProps = {\n /** Full Isometrik message (body, attachments, metaData, reactions, …). */\n message: any;\n isSelf: boolean;\n status: MessageDeliveryStatus;\n userMetaData: any;\n conversationDetails: any;\n allAttachments?: any;\n /** SDK opens default message actions sheet (reply/forward/delete/info). */\n onTap?: (message: any) => void;\n /** SDK enters reply mode for this message. */\n onReply?: (message: any) => void;\n /** SDK opens forward dialog. */\n onForward?: (message: any) => void;\n /** SDK opens delete dialog. */\n onDelete?: (message: any) => void;\n /** SDK opens read/delivery info (self messages). */\n onInfo?: (message: any) => void;\n};\n\n/** Props SDK assigns on customParts.chatTile custom elements. */\nexport type ChatTileProps = {\n /** Full Isometrik conversation (includes metaData). */\n conversation: any;\n isSelected: boolean;\n userMetaData: any;\n unreadCount: number | string;\n previewText: string;\n isTyping?: boolean;\n typingUserName?: string | null;\n /** SDK selects this conversation (same as default tile click). */\n onSelect?: (conversationId: string) => void;\n};\n\n/** Props for customParts.groupcastTile. */\nexport type GroupcastTileProps = {\n groupcast: any;\n conversation: any;\n isSelected: boolean;\n userMetaData?: any;\n unreadCount?: number | string;\n previewText?: string;\n onSelect?: (groupcastId: string) => void;\n};\n\n/** customParts.messageDatePill */\nexport type MessageDatePillProps = {\n content: string;\n textColor?: string;\n borderRadius?: string;\n bgColor?: string;\n padding?: string;\n fontSize?: string;\n fontWeight?: string;\n};\n\n/** customParts.searchResult */\nexport type SearchResultProps = {\n message: any;\n onSelect?: () => void;\n};\n\n/** customParts.memberRow */\nexport type MemberRowProps = {\n member: any;\n userMetaData: any;\n isGroupcast?: boolean;\n showActions?: boolean;\n};\n\n/** Overlay: customParts.forwardDialog / addMember (drawer clone or CE). */\nexport type OverlayDialogProps = {\n dialogData?: any;\n onClose?: () => void;\n isMobile?: boolean;\n};\n\n/** customParts.mediaGallery */\nexport type MediaGalleryProps = {\n allAttachments?: any;\n mainImageIndex?: number;\n topbarBgColor?: string;\n iconColor?: string;\n galleryImageSize?: string;\n isZoomed?: boolean;\n loadingMediaGallery?: boolean;\n zoomLevel?: number;\n isSharePopupOpen?: boolean;\n shareLink?: string;\n};\n\n/** customParts.contextMenu */\nexport type ContextMenuProps = {\n x?: number;\n y?: number;\n isOpen?: boolean;\n menuItems?: any[];\n onMenuItemSelected?: (e: any) => void;\n onMenuClosed?: () => void;\n};\n\n/** customParts.blockList */\nexport type BlockListProps = {\n blockedUsers?: any[];\n isLoading?: boolean;\n handleUnblock?: (user: any) => void;\n goBack?: () => void;\n height?: string;\n};\n\n/** customParts.toast — also accepted by showToast when tag is set. */\nexport type ToastPartProps = {\n message: string;\n duration?: number;\n type?: 'success' | 'error' | 'warning' | 'info';\n position?: string;\n};\n"]}
1
+ {"version":3,"file":"contracts.js","sourceRoot":"","sources":["../../../src/lib/custom-ui/contracts.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,MAAM,UAAU,mBAAmB,CAAC,OAAY;IAC9C,IAAI,CAAC,OAAO;QAAE,OAAO,MAAM,CAAC;IAC5B,IAAI,OAAO,CAAC,cAAc,KAAK,SAAS,IAAI,OAAO,CAAC,SAAS;QAAE,OAAO,SAAS,CAAC;IAChF,IAAI,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,kBAAkB;QAAE,OAAO,MAAM,CAAC;IACnE,IAAI,OAAO,CAAC,cAAc,KAAK,IAAI,IAAI,OAAO,CAAC,cAAc,KAAK,MAAM,IAAI,OAAO,CAAC,uBAAuB,EAAE,CAAC;QAC5G,OAAO,WAAW,CAAC;IACrB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["/**\n * Rounit-style prop contracts for customParts.\n *\n * Primary customization model:\n * customParts = host UI; SDK passes data + callbacks (functionality stays in SDK).\n * Slots remain secondary (layout panels only).\n */\n\n/** Delivery/read status derived from Isometrik message fields. */\nexport type MessageDeliveryStatus = 'pending' | 'sent' | 'delivered' | 'read';\n\nexport function deriveMessageStatus(message: any): MessageDeliveryStatus {\n if (!message) return 'sent';\n if (message.deliveredToAll === 'pending' || message.isPending) return 'pending';\n if (message.readByAll || message.isReadByAllMembers) return 'read';\n if (message.deliveredToAll === true || message.deliveredToAll === 'true' || message.isDeliveredToAllMembers) {\n return 'delivered';\n }\n return 'sent';\n}\n\n/**\n * Props SDK assigns on customParts.messageBubble custom elements.\n * Host CE should read these as properties (not only attributes).\n * Prefer property setters / `.render()` so Stencil prop updates re-paint.\n */\nexport type MessageBubbleProps = {\n /** Full Isometrik message (body, attachments, metaData, reactions, …). */\n message: any;\n isSelf: boolean;\n status: MessageDeliveryStatus;\n userMetaData: any;\n conversationDetails: any;\n allAttachments?: any;\n /** SDK opens default message actions sheet (reply/forward/delete/info). */\n onTap?: (message: any) => void;\n /** SDK enters reply mode for this message. */\n onReply?: (message: any) => void;\n /** SDK opens forward dialog. */\n onForward?: (message: any) => void;\n /** SDK opens delete dialog. */\n onDelete?: (message: any) => void;\n /** SDK opens read/delivery info (self messages). */\n onInfo?: (message: any) => void;\n};\n\n/** Props SDK assigns on customParts.chatTile custom elements. */\nexport type ChatTileProps = {\n /** Full Isometrik conversation (includes metaData). */\n conversation: any;\n isSelected: boolean;\n userMetaData: any;\n unreadCount: number | string;\n previewText: string;\n isTyping?: boolean;\n typingUserName?: string | null;\n /** SDK selects this conversation (same as default tile click). */\n onSelect?: (conversationId: string) => void;\n};\n\n/** Props for customParts.groupcastTile. */\nexport type GroupcastTileProps = {\n groupcast: any;\n conversation: any;\n isSelected: boolean;\n userMetaData?: any;\n unreadCount?: number | string;\n previewText?: string;\n onSelect?: (groupcastId: string) => void;\n};\n\n/** customParts.messageDatePill */\nexport type MessageDatePillProps = {\n content: string;\n textColor?: string;\n borderRadius?: string;\n bgColor?: string;\n padding?: string;\n fontSize?: string;\n fontWeight?: string;\n};\n\n/** customParts.searchResult */\nexport type SearchResultProps = {\n message: any;\n onSelect?: () => void;\n};\n\n/** customParts.memberRow */\nexport type MemberRowProps = {\n member: any;\n userMetaData: any;\n isGroupcast?: boolean;\n showActions?: boolean;\n};\n\n/** customParts.contactRow — New Chat contact list. */\nexport type ContactRowProps = {\n contact: any;\n name: string;\n imageUrl?: string;\n meta?: string;\n onSelect?: (contact: any) => void;\n};\n\n/** Overlay: customParts.forwardDialog / addMember (drawer clone or CE). */\nexport type OverlayDialogProps = {\n dialogData?: any;\n onClose?: () => void;\n isMobile?: boolean;\n};\n\n/** customParts.mediaGallery */\nexport type MediaGalleryProps = {\n allAttachments?: any;\n mainImageIndex?: number;\n topbarBgColor?: string;\n iconColor?: string;\n galleryImageSize?: string;\n isZoomed?: boolean;\n loadingMediaGallery?: boolean;\n zoomLevel?: number;\n isSharePopupOpen?: boolean;\n shareLink?: string;\n};\n\n/** customParts.contextMenu */\nexport type ContextMenuProps = {\n x?: number;\n y?: number;\n isOpen?: boolean;\n menuItems?: any[];\n onMenuItemSelected?: (e: any) => void;\n onMenuClosed?: () => void;\n};\n\n/** customParts.blockList */\nexport type BlockListProps = {\n blockedUsers?: any[];\n isLoading?: boolean;\n handleUnblock?: (user: any) => void;\n goBack?: () => void;\n height?: string;\n};\n\n/** customParts.toast — also accepted by showToast when tag is set. */\nexport type ToastPartProps = {\n message: string;\n duration?: number;\n type?: 'success' | 'error' | 'warning' | 'info';\n position?: string;\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/custom-ui/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,iBAAiB;IACjB,SAAS;IACT,cAAc;IACd,mBAAmB;IACnB,cAAc;IACd,YAAY;IACZ,QAAQ;IACR,UAAU;IACV,UAAU;IACV,gBAAgB;IA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* PRIMARY (Rounit model): customParts — host CE tags; SDK passes props + callbacks.\n * SECONDARY: named slots — layout panels only (no per-row props).\n * ADVANCED: events/methods — headless / full custom chrome.\n */\n\nexport const WEB_CHAT_SLOTS = [\n // shell / panels\n 'sidebar',\n 'profile-rail',\n 'conversation-list',\n 'profile-page',\n 'group-cast',\n 'header',\n 'messages',\n 'composer',\n 'composer-input',\n 'reply-preview',\n 'attachment-preview',\n 'empty',\n 'right-panel',\n 'contact-info',\n 'profile-info',\n 'message-search',\n 'boot-loader',\n // overlays\n 'forward-dialog',\n 'message-info',\n 'media-gallery',\n 'add-member',\n 'context-menu',\n 'block-list',\n 'toast',\n] as const;\n\nexport type WebChatSlotName = (typeof WEB_CHAT_SLOTS)[number];\n\n/** Custom element tags for repeating rows / drawer dialogs. */\nexport type WebChatCustomParts = {\n messageBubble?: string;\n chatTile?: string;\n groupcastTile?: string;\n messageDatePill?: string;\n searchResult?: string;\n memberRow?: string;\n /** Drawer dialogs (render outside <web-chat> shadow) */\n forwardDialog?: string;\n addMember?: string;\n mediaGallery?: string;\n contextMenu?: string;\n blockList?: string;\n toast?: string;\n};\n\nexport function hasNamedSlot(host: HTMLElement, name: string): boolean {\n return Array.from(host.children).some(node => {\n // Avoid `instanceof HTMLElement` — fails across jsdom realms in Jest.\n if (!node || node.nodeType !== 1) return false;\n const el = node as HTMLElement;\n if (el.getAttribute('slot') !== name) return false;\n if (el.tagName === 'SLOT') {\n return (el as HTMLSlotElement).assignedNodes({ flatten: true }).length > 0;\n }\n return true;\n });\n}\n\n/** Walk up (incl. shadow hosts) to the owning <web-chat>. */\nexport function findWebChatHost(from?: Element | null): HTMLElement | null {\n let node: Element | null = from || null;\n while (node) {\n if (node.tagName === 'WEB-CHAT') return node as HTMLElement;\n const root = node.getRootNode?.();\n if (root instanceof ShadowRoot) {\n node = root.host;\n continue;\n }\n node = node.parentElement;\n }\n return null;\n}\n\n/** Fallback only — prefer findWebChatHost(from) for multi-instance safety. */\nexport function getWebChatElement(): HTMLElement | null {\n if (typeof document === 'undefined') return null;\n return document.querySelector('web-chat');\n}\n\nexport function getCustomPartTag(\n part: keyof WebChatCustomParts,\n host?: Element | null,\n): string | undefined {\n const webChat = (findWebChatHost(host) || (!host ? getWebChatElement() : null)) as any;\n return webChat?.customParts?.[part];\n}\n\n/** Assign props and nudge CE to re-paint (calls `.render()` if present). */\nexport function applyCustomPartProps(el: HTMLElement, props?: Record<string, unknown>): HTMLElement {\n if (props) Object.assign(el, props);\n const anyEl = el as any;\n if (typeof anyEl.render === 'function') {\n try {\n anyEl.render();\n } catch {\n /* host CE render is best-effort */\n }\n }\n el.dispatchEvent(new CustomEvent('custompart-props', { detail: props, bubbles: false }));\n return el;\n}\n\n/** Create a host-registered CE for a customPart, or null. */\nexport function createCustomPartElement(\n part: keyof WebChatCustomParts,\n props?: Record<string, unknown>,\n host?: Element | null,\n): HTMLElement | null {\n const tag = getCustomPartTag(part, host);\n if (!tag || typeof document === 'undefined') return null;\n return applyCustomPartProps(document.createElement(tag), props);\n}\n\n/**\n * Resolve overlay UI for drawers / deep trees:\n * 1) customParts tag\n * 2) clone of light-DOM [slot=\"…\"] on <web-chat>\n */\nexport function resolveOverlayElement(\n slotName: WebChatSlotName,\n partKey: keyof WebChatCustomParts,\n props?: Record<string, unknown>,\n host?: Element | null,\n): HTMLElement | null {\n const fromPart = createCustomPartElement(partKey, props, host);\n if (fromPart) return fromPart;\n\n const webChat = findWebChatHost(host) || (!host ? getWebChatElement() : null);\n if (!webChat) return null;\n const slotted = Array.from(webChat.children).find(\n node => node instanceof HTMLElement && node.getAttribute('slot') === slotName && node.tagName !== 'SLOT',\n ) as HTMLElement | undefined;\n if (!slotted) return null;\n\n const clone = slotted.cloneNode(true) as HTMLElement;\n clone.removeAttribute('slot');\n return applyCustomPartProps(clone, props);\n}\n\nexport type {\n ChatReadyDetail,\n ConversationsChangeDetail,\n MessagesChangeDetail,\n SelectionChangeDetail,\n ReplyChangeDetail,\n ChatErrorDetail,\n WebChatPublicEvent,\n WebChatPublicMethod,\n} from './public-api';\nexport { WEB_CHAT_PUBLIC_EVENTS, WEB_CHAT_PUBLIC_METHODS } from './public-api';\nexport type {\n MessageDeliveryStatus,\n MessageBubbleProps,\n ChatTileProps,\n GroupcastTileProps,\n MessageDatePillProps,\n SearchResultProps,\n MemberRowProps,\n OverlayDialogProps,\n MediaGalleryProps,\n ContextMenuProps,\n BlockListProps,\n ToastPartProps,\n} from './contracts';\nexport { deriveMessageStatus } from './contracts';\nexport { defineReactiveCustomPart } from './define-part';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/custom-ui/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,iBAAiB;IACjB,SAAS;IACT,cAAc;IACd,mBAAmB;IACnB,cAAc;IACd,YAAY;IACZ,QAAQ;IACR,UAAU;IACV,UAAU;IACV,gBAAgB;IAChB,eAAe;IACf,oBAAoB;IACpB,OAAO;IACP,aAAa;IACb,cAAc;IACd,cAAc;IACd,gBAAgB;IAChB,aAAa;IACb,WAAW;IACX,gBAAgB;IAChB,cAAc;IACd,eAAe;IACf,YAAY;IACZ,cAAc;IACd,YAAY;IACZ,OAAO;CACC,CAAC;AAuBX,MAAM,UAAU,YAAY,CAAC,IAAiB,EAAE,IAAY;IAC1D,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QAC3C,sEAAsE;QACtE,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,QAAQ,KAAK,CAAC;YAAE,OAAO,KAAK,CAAC;QAC/C,MAAM,EAAE,GAAG,IAAmB,CAAC;QAC/B,IAAI,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC,KAAK,IAAI;YAAE,OAAO,KAAK,CAAC;QACnD,IAAI,EAAE,CAAC,OAAO,KAAK,MAAM,EAAE,CAAC;YAC1B,OAAQ,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C,IAAI,CAAC,EAAE,CAAC,IAAI,YAAY,WAAW,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,KAAK,QAAQ,IAAI,IAAI,CAAC,OAAO,KAAK,MAAM,CAC9E,CAAC;IAC7B,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAE1B,MAAM,KAAK,GAAG,OAAO,CAAC,SAAS,CAAC,IAAI,CAAgB,CAAC;IACrD,KAAK,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;IAC9B,OAAO,oBAAoB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAC5C,CAAC;AAYD,OAAO,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAgB/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC","sourcesContent":["/**\n * Custom UI contract for <web-chat>.\n *\n * PRIMARY (Rounit model): customParts — host CE tags; SDK passes props + callbacks.\n * SECONDARY: named slots — layout panels only (no per-row props).\n * ADVANCED: events/methods — headless / full custom chrome.\n */\n\nexport const WEB_CHAT_SLOTS = [\n // shell / panels\n 'sidebar',\n 'profile-rail',\n 'conversation-list',\n 'profile-page',\n 'group-cast',\n 'header',\n 'messages',\n 'composer',\n 'composer-input',\n 'reply-preview',\n 'attachment-preview',\n 'empty',\n 'right-panel',\n 'contact-info',\n 'profile-info',\n 'message-search',\n 'boot-loader',\n // overlays\n 'forward-dialog',\n 'message-info',\n 'media-gallery',\n 'add-member',\n 'context-menu',\n 'block-list',\n 'toast',\n] as const;\n\nexport type WebChatSlotName = (typeof WEB_CHAT_SLOTS)[number];\n\n/** Custom element tags for repeating rows / drawer dialogs. */\nexport type WebChatCustomParts = {\n messageBubble?: string;\n chatTile?: string;\n groupcastTile?: string;\n messageDatePill?: string;\n searchResult?: string;\n memberRow?: string;\n /** New Chat / contact picker row. */\n contactRow?: string;\n /** Drawer dialogs (render outside <web-chat> shadow) */\n forwardDialog?: string;\n addMember?: string;\n mediaGallery?: string;\n contextMenu?: string;\n blockList?: string;\n toast?: string;\n};\n\nexport function hasNamedSlot(host: HTMLElement, name: string): boolean {\n return Array.from(host.children).some(node => {\n // Avoid `instanceof HTMLElement` — fails across jsdom realms in Jest.\n if (!node || node.nodeType !== 1) return false;\n const el = node as HTMLElement;\n if (el.getAttribute('slot') !== name) return false;\n if (el.tagName === 'SLOT') {\n return (el as HTMLSlotElement).assignedNodes({ flatten: true }).length > 0;\n }\n return true;\n });\n}\n\n/** Walk up (incl. shadow hosts) to the owning <web-chat>. */\nexport function findWebChatHost(from?: Element | null): HTMLElement | null {\n let node: Element | null = from || null;\n while (node) {\n if (node.tagName === 'WEB-CHAT') return node as HTMLElement;\n const root = node.getRootNode?.();\n if (root instanceof ShadowRoot) {\n node = root.host;\n continue;\n }\n node = node.parentElement;\n }\n return null;\n}\n\n/** Fallback only — prefer findWebChatHost(from) for multi-instance safety. */\nexport function getWebChatElement(): HTMLElement | null {\n if (typeof document === 'undefined') return null;\n return document.querySelector('web-chat');\n}\n\nexport function getCustomPartTag(\n part: keyof WebChatCustomParts,\n host?: Element | null,\n): string | undefined {\n const webChat = (findWebChatHost(host) || (!host ? getWebChatElement() : null)) as any;\n return webChat?.customParts?.[part];\n}\n\n/** Assign props and nudge CE to re-paint (calls `.render()` if present). */\nexport function applyCustomPartProps(el: HTMLElement, props?: Record<string, unknown>): HTMLElement {\n if (props) Object.assign(el, props);\n const anyEl = el as any;\n if (typeof anyEl.render === 'function') {\n try {\n anyEl.render();\n } catch {\n /* host CE render is best-effort */\n }\n }\n el.dispatchEvent(new CustomEvent('custompart-props', { detail: props, bubbles: false }));\n return el;\n}\n\n/** Create a host-registered CE for a customPart, or null. */\nexport function createCustomPartElement(\n part: keyof WebChatCustomParts,\n props?: Record<string, unknown>,\n host?: Element | null,\n): HTMLElement | null {\n const tag = getCustomPartTag(part, host);\n if (!tag || typeof document === 'undefined') return null;\n return applyCustomPartProps(document.createElement(tag), props);\n}\n\n/**\n * Resolve overlay UI for drawers / deep trees:\n * 1) customParts tag\n * 2) clone of light-DOM [slot=\"…\"] on <web-chat>\n */\nexport function resolveOverlayElement(\n slotName: WebChatSlotName,\n partKey: keyof WebChatCustomParts,\n props?: Record<string, unknown>,\n host?: Element | null,\n): HTMLElement | null {\n const fromPart = createCustomPartElement(partKey, props, host);\n if (fromPart) return fromPart;\n\n const webChat = findWebChatHost(host) || (!host ? getWebChatElement() : null);\n if (!webChat) return null;\n const slotted = Array.from(webChat.children).find(\n node => node instanceof HTMLElement && node.getAttribute('slot') === slotName && node.tagName !== 'SLOT',\n ) as HTMLElement | undefined;\n if (!slotted) return null;\n\n const clone = slotted.cloneNode(true) as HTMLElement;\n clone.removeAttribute('slot');\n return applyCustomPartProps(clone, props);\n}\n\nexport type {\n ChatReadyDetail,\n ConversationsChangeDetail,\n MessagesChangeDetail,\n SelectionChangeDetail,\n ReplyChangeDetail,\n ChatErrorDetail,\n WebChatPublicEvent,\n WebChatPublicMethod,\n} from './public-api';\nexport { WEB_CHAT_PUBLIC_EVENTS, WEB_CHAT_PUBLIC_METHODS } from './public-api';\nexport type {\n MessageDeliveryStatus,\n MessageBubbleProps,\n ChatTileProps,\n GroupcastTileProps,\n MessageDatePillProps,\n SearchResultProps,\n MemberRowProps,\n ContactRowProps,\n OverlayDialogProps,\n MediaGalleryProps,\n ContextMenuProps,\n BlockListProps,\n ToastPartProps,\n} from './contracts';\nexport { deriveMessageStatus } from './contracts';\nexport { defineReactiveCustomPart } from './define-part';\n"]}
@@ -933,7 +933,7 @@ const ChatSidebar = /*@__PURE__*/ proxyCustomElement(class ChatSidebar extends H
933
933
  const title = tile.isGroup ? tile.conversationTitle : (_a = tile === null || tile === void 0 ? void 0 : tile.opponentDetails) === null || _a === void 0 ? void 0 : _a.userName;
934
934
  return (title || '').toLowerCase().includes(searchQuery);
935
935
  });
936
- return (h("div", { class: "chat-sidebar-container", style: { backgroundColor: this.sidebarColor || undefined } }, this.isGroupCreationLoading && (h("div", { class: "loader" }, h("spinner-loader", { height: "30px", width: "30px", spinTime: "1s", spinnerPrimaryColor: "var(--bg-primary)", spinnerSecondaryColor: "var(--text-primary)", spinnerBorderWidth: "2px" }))), this.showGroupInfo ? (h("div", { class: "new-chat-panel" }, h("iso-group-info", { label: this.memberPickerIsGroupCast ? 'Create New Groupcast' : 'Create New Group', selectedUserIds: this.pendingGroupMembers.map(m => m.userId), selectedUsers: this.pendingGroupMembers, isGroupCast: this.memberPickerIsGroupCast, closeGroupInfo: this.closeGroupInfoStep, afterCreate: this.finishGroupInfoStep }))) : this.showMemberPicker ? (h("div", { class: "new-chat-panel" }, h("div", { class: "picker-back" }, h("button", { type: "button", onClick: this.closeMemberPicker, "aria-label": "Back" }, h("img", { class: "theme-icon", src: Left_Arrow, alt: "" })), h("h2", { class: "picker-title" }, this.memberPickerIsGroupCast ? 'New Group Cast' : 'New Group')), h("searchable-list", { label: this.memberPickerIsGroupCast ? 'New Group Cast' : 'New Group', hideTopbar: true, contactList: this.nonBlockedContacts, isSearching: true, isLoading: this.isLoadingMember, hasMore: this.hasMoreMembers, skip: this.skip, paginationLoading: this.isPaginationMember, getForwardMessageMemberList: (query, skip) => this.getAllGroupMemeber(query || '', skip || 0), onSend: this.submitMemberPicker, height: "100%" }))) : this.showNewChat ? (h("div", { class: "new-chat-panel" }, h("new-chat", { contactList: this.nonBlockedContacts, isLoading: this.isLoadingMember, hasMore: this.hasMoreMembers, skip: this.skip, paginationLoading: this.isPaginationMember, onSearch: (query, skip) => this.getAllMemeber(query || '', skip || 0), onSelect: this.handleNewChatContactPick, onClose: () => this.closeNewChat() }))) : ([
936
+ return (h("div", { class: "chat-sidebar-container", style: { backgroundColor: this.sidebarColor || undefined } }, this.isGroupCreationLoading && (h("div", { class: "loader" }, h("spinner-loader", { height: "30px", width: "30px", spinTime: "1s", spinnerPrimaryColor: "var(--bg-primary)", spinnerSecondaryColor: "var(--text-primary)", spinnerBorderWidth: "2px" }))), this.showGroupInfo ? (h("div", { class: "new-chat-panel" }, h("iso-group-info", { label: this.memberPickerIsGroupCast ? 'Create New Groupcast' : 'Create New Group', selectedUserIds: this.pendingGroupMembers.map(m => m.userId), selectedUsers: this.pendingGroupMembers, isGroupCast: this.memberPickerIsGroupCast, closeGroupInfo: this.closeGroupInfoStep, afterCreate: this.finishGroupInfoStep }))) : this.showMemberPicker ? (h("div", { class: "new-chat-panel" }, h("div", { class: "picker-back" }, h("button", { type: "button", onClick: this.closeMemberPicker, "aria-label": "Back" }, h("img", { class: "theme-icon", src: Left_Arrow, alt: "" })), h("h2", { class: "picker-title" }, this.memberPickerIsGroupCast ? 'New Group Cast' : 'New Group')), h("searchable-list", { label: this.memberPickerIsGroupCast ? 'New Group Cast' : 'New Group', hideTopbar: true, contactList: this.nonBlockedContacts, isSearching: true, isLoading: this.isLoadingMember, hasMore: this.hasMoreMembers, skip: this.skip, paginationLoading: this.isPaginationMember, getForwardMessageMemberList: (query, skip) => this.getAllGroupMemeber(query || '', skip || 0), onSend: this.submitMemberPicker, height: "100%" }))) : this.showNewChat ? (h("div", { class: "new-chat-panel" }, h("new-chat", { contactList: this.nonBlockedContacts, isLoading: this.isLoadingMember, hasMore: this.hasMoreMembers, skip: this.skip, paginationLoading: this.isPaginationMember, onSearch: (query, skip) => this.getAllMemeber(query || '', skip || 0), onSelect: this.handleNewChatContactPick, onClose: () => this.closeNewChat(), customParts: this.customParts }))) : ([
937
937
  h("div", { class: "chat-sidebar-top" }, h("div", { class: "chat-sidebar-header-row" }, this.isSidebarHeaderLabel ? (h("h1", { class: "chat-sidebar-header" }, this.sidebarHeaderLabel || 'Chats')) : (h("span", null)), h("div", { class: "chat-sidebar-actions" }, h("button", { type: "button", class: "icon-btn", title: "New Chat", onClick: () => this.openNewChat() }, h("img", { src: New_Chat, alt: "New chat" })), h("div", { class: "more-wrap" }, h("button", { type: "button", class: "icon-btn", title: "More Options", "aria-label": "More options", "aria-haspopup": "menu", "aria-expanded": this.showMoreMenu ? 'true' : 'false', onClick: this.toggleMoreMenu }, h("img", { class: "theme-icon", src: Three_Dots, alt: "" })), this.showMoreMenu ? (h("div", { class: "more-menu", role: "menu" }, h("button", { type: "button", class: "more-item", role: "menuitem", onClick: this.onNewGroupFromMenu }, h("img", { class: "theme-icon", src: New_Group, alt: "" }), h("span", null, "New group")), h("div", { class: "more-divider" }), h("button", { type: "button", class: "more-item danger", role: "menuitem", onClick: this.onLogoutFromMenu }, h("img", { class: "theme-icon", src: Logout, alt: "" }), h("span", null, "Log out")))) : null))), this.isSidebarHeaderSearch !== false ? (h("div", { class: "chat-sidebar-search" }, h("input", { type: "search", placeholder: "Search or start new chat", value: this.searchQuery, onInput: (e) => this.handleSearch(e) }))) : null),
938
938
  h("div", { class: "chat-sidebar-list", onScroll: (e) => this.handleListScroll(e) }, this.isConversationLoading ? (h("div", { class: "chat-sidebar-loading" }, h("spinner-loader", { height: "15px", width: "15px", spinTime: "1s", spinnerPrimaryColor: "var(--bg-primary)", spinnerSecondaryColor: "var(--text-primary)", spinnerBorderWidth: "2px" }))) : filteredConversations.length > 0 ? (filteredConversations.map((tile) => this.renderConversationTile(tile))) : (h("div", { class: "chat-sidebar-empty" }, "No conversation found")), this.isLoading && this.hasMoreConversations && (h("div", { class: "chat-sidebar-loading" }, h("spinner-loader", { height: "15px", width: "15px", spinTime: "1s", spinnerPrimaryColor: "var(--bg-primary)", spinnerSecondaryColor: "var(--text-primary)", spinnerBorderWidth: "2px" })))),
939
939
  ])));